@quillsql/react 2.16.78 → 2.16.80
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/dist/index.cjs +1911 -1314
- package/dist/index.d.cts +24 -2
- package/dist/index.d.ts +24 -2
- package/dist/index.js +1679 -1081
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15076,46 +15076,12 @@ function parseQueryDateRangeByDatabaseType(minRange, maxRange, databaseType) {
|
|
|
15076
15076
|
}
|
|
15077
15077
|
}
|
|
15078
15078
|
function getDateFormatFromBucket(dateBucket) {
|
|
15079
|
-
|
|
15080
|
-
switch (dateBucket) {
|
|
15081
|
-
case "day":
|
|
15082
|
-
format9 = "MMM_dd";
|
|
15083
|
-
break;
|
|
15084
|
-
case "week":
|
|
15085
|
-
format9 = "MMM_dd-MMM_dd";
|
|
15086
|
-
break;
|
|
15087
|
-
case "month":
|
|
15088
|
-
format9 = "MMM_yyyy";
|
|
15089
|
-
break;
|
|
15090
|
-
case "year":
|
|
15091
|
-
format9 = "yyyy";
|
|
15092
|
-
break;
|
|
15093
|
-
default:
|
|
15094
|
-
format9 = "MMM_yyyy";
|
|
15095
|
-
break;
|
|
15096
|
-
}
|
|
15097
|
-
return format9;
|
|
15079
|
+
return DATE_BUCKET_AXIS_FORMATS[dateBucket] ?? "MMM_yyyy";
|
|
15098
15080
|
}
|
|
15099
15081
|
function getDateString(value, dateRange, dateBucket, databaseType) {
|
|
15100
15082
|
let format9;
|
|
15101
15083
|
if (dateBucket) {
|
|
15102
|
-
|
|
15103
|
-
case "day":
|
|
15104
|
-
format9 = "MMM_dd";
|
|
15105
|
-
break;
|
|
15106
|
-
case "week":
|
|
15107
|
-
format9 = "MMM_dd-MMM_dd";
|
|
15108
|
-
break;
|
|
15109
|
-
case "month":
|
|
15110
|
-
format9 = "MMM_yyyy";
|
|
15111
|
-
break;
|
|
15112
|
-
case "year":
|
|
15113
|
-
format9 = "yyyy";
|
|
15114
|
-
break;
|
|
15115
|
-
default:
|
|
15116
|
-
format9 = "MMM_yyyy";
|
|
15117
|
-
break;
|
|
15118
|
-
}
|
|
15084
|
+
format9 = getDateFormatFromBucket(dateBucket);
|
|
15119
15085
|
} else {
|
|
15120
15086
|
if (!dateRange) {
|
|
15121
15087
|
format9 = "MMM_yyyy";
|
|
@@ -15204,12 +15170,19 @@ function getExclusiveDateBucketRange(startInput, bucket) {
|
|
|
15204
15170
|
endExclusive: endExclusive.toISOString()
|
|
15205
15171
|
};
|
|
15206
15172
|
}
|
|
15173
|
+
var DATE_BUCKET_AXIS_FORMATS;
|
|
15207
15174
|
var init_dates = __esm({
|
|
15208
15175
|
"src/utils/dates.ts"() {
|
|
15209
15176
|
"use strict";
|
|
15210
15177
|
init_dateRangePickerUtils();
|
|
15211
15178
|
init_inMemoryPivotEngine();
|
|
15212
15179
|
init_valueFormatter();
|
|
15180
|
+
DATE_BUCKET_AXIS_FORMATS = {
|
|
15181
|
+
day: "MMM_dd_yyyy",
|
|
15182
|
+
week: "MMM_dd-MMM_dd",
|
|
15183
|
+
month: "MMM_yyyy",
|
|
15184
|
+
year: "yyyy"
|
|
15185
|
+
};
|
|
15213
15186
|
}
|
|
15214
15187
|
});
|
|
15215
15188
|
|
|
@@ -21354,6 +21327,22 @@ init_dates();
|
|
|
21354
21327
|
init_pivotConstructor();
|
|
21355
21328
|
init_columnProcessing();
|
|
21356
21329
|
init_paginationProcessing();
|
|
21330
|
+
|
|
21331
|
+
// src/utils/dashboardProfiler.ts
|
|
21332
|
+
function profileDashboard(event, data) {
|
|
21333
|
+
if (typeof window === "undefined") return;
|
|
21334
|
+
const profileWindow = window;
|
|
21335
|
+
if (!profileWindow.__QUILL_DASHBOARD_PROFILE__) return;
|
|
21336
|
+
const entry = {
|
|
21337
|
+
at: Math.round(performance.now() * 10) / 10,
|
|
21338
|
+
event,
|
|
21339
|
+
data
|
|
21340
|
+
};
|
|
21341
|
+
profileWindow.__QUILL_DASHBOARD_TRACE__ ??= [];
|
|
21342
|
+
profileWindow.__QUILL_DASHBOARD_TRACE__.push(entry);
|
|
21343
|
+
}
|
|
21344
|
+
|
|
21345
|
+
// src/utils/dashboard.ts
|
|
21357
21346
|
var defaultDashboardItem = {
|
|
21358
21347
|
id: "",
|
|
21359
21348
|
name: "",
|
|
@@ -21439,6 +21428,15 @@ async function cleanDashboardItem({
|
|
|
21439
21428
|
const pivotChartProcessing = {
|
|
21440
21429
|
page: DEFAULT_PAGINATION
|
|
21441
21430
|
};
|
|
21431
|
+
profileDashboard("clean-dashboard-pivot-path", {
|
|
21432
|
+
reportId: item._id ?? item.id ?? null,
|
|
21433
|
+
chartType: item.chartType,
|
|
21434
|
+
skipPivotFetch: !!skipPivotFetch,
|
|
21435
|
+
hasRows: !!item.rows,
|
|
21436
|
+
rowCount: item.rows?.length ?? 0,
|
|
21437
|
+
hasFields: !!item.fields,
|
|
21438
|
+
path: item.pivot && skipPivotFetch && item.rows && item.fields ? "process-locally" : "get-pivot-table"
|
|
21439
|
+
});
|
|
21442
21440
|
if (item.pivot && skipPivotFetch && item.rows && item.fields) {
|
|
21443
21441
|
const pivotSourceRows = item.rows.map((row) => ({ ...row }));
|
|
21444
21442
|
const dateFilter = dashboardFilters?.find(
|
|
@@ -21546,6 +21544,7 @@ async function cleanDashboardItem({
|
|
|
21546
21544
|
pivotColumns: pivotTable ? pivotTable.columns : void 0,
|
|
21547
21545
|
compareRows: item.compareRows,
|
|
21548
21546
|
showLegend: item.showLegend ?? false,
|
|
21547
|
+
chartSort: item.chartSort,
|
|
21549
21548
|
columns: processedColumns.map((column) => {
|
|
21550
21549
|
return {
|
|
21551
21550
|
field: column.field,
|
|
@@ -21746,6 +21745,32 @@ init_filterProcessing();
|
|
|
21746
21745
|
|
|
21747
21746
|
// src/utils/chartBuilder.ts
|
|
21748
21747
|
init_textProcessing();
|
|
21748
|
+
var MAX_CHART_ROWS = 500;
|
|
21749
|
+
var MAX_CHART_MARKS = 5e3;
|
|
21750
|
+
var UNLIMITED_CHART_TYPES = /* @__PURE__ */ new Set([
|
|
21751
|
+
"metric",
|
|
21752
|
+
"table",
|
|
21753
|
+
"gauge",
|
|
21754
|
+
"us map",
|
|
21755
|
+
"world map"
|
|
21756
|
+
]);
|
|
21757
|
+
function getChartRenderLimitError(report) {
|
|
21758
|
+
if (!report) return void 0;
|
|
21759
|
+
if (UNLIMITED_CHART_TYPES.has(report.chartType?.toLowerCase() ?? "")) {
|
|
21760
|
+
return void 0;
|
|
21761
|
+
}
|
|
21762
|
+
const rowCount = report.pivot ? report.pivotRowCount ?? report.pivotRows?.length ?? report.rows?.length : report.rowCount ?? report.rows?.length;
|
|
21763
|
+
if (rowCount !== void 0 && rowCount > MAX_CHART_ROWS) {
|
|
21764
|
+
return `Charts can only display ${MAX_CHART_ROWS} rows. Please modify the query.`;
|
|
21765
|
+
}
|
|
21766
|
+
const renderedRows = report.rows?.length ?? 0;
|
|
21767
|
+
const renderedSeries = Math.max(report.yAxisFields?.length ?? 0, 1);
|
|
21768
|
+
const renderedMarks = renderedRows * renderedSeries;
|
|
21769
|
+
if (renderedMarks > MAX_CHART_MARKS) {
|
|
21770
|
+
return `Charts can only render ${MAX_CHART_MARKS.toLocaleString()} data points. This chart would render ${renderedMarks.toLocaleString()}. Please reduce the number of rows or series.`;
|
|
21771
|
+
}
|
|
21772
|
+
return void 0;
|
|
21773
|
+
}
|
|
21749
21774
|
function isStackedChartType(chartType) {
|
|
21750
21775
|
const normalized = chartType?.toLowerCase();
|
|
21751
21776
|
return normalized === "stacked" || normalized === "stacked bar";
|
|
@@ -22348,6 +22373,376 @@ async function fetchPivotTemplateReportForUseForm({
|
|
|
22348
22373
|
}
|
|
22349
22374
|
}
|
|
22350
22375
|
|
|
22376
|
+
// src/utils/color.ts
|
|
22377
|
+
var DEFAULT_GRADIENT_COLORS = [
|
|
22378
|
+
"#4E80EE",
|
|
22379
|
+
// vivid indigo
|
|
22380
|
+
"#586FF4",
|
|
22381
|
+
"#6464FA",
|
|
22382
|
+
"#715AFE",
|
|
22383
|
+
"#8450FF",
|
|
22384
|
+
"#9B48FF",
|
|
22385
|
+
"#B33FFF",
|
|
22386
|
+
"#CA37F3",
|
|
22387
|
+
"#DE2FE1",
|
|
22388
|
+
"#F028CB",
|
|
22389
|
+
"#FF20B5"
|
|
22390
|
+
];
|
|
22391
|
+
function generateArrayFromColor(colors, length) {
|
|
22392
|
+
if (length <= 0) {
|
|
22393
|
+
return [];
|
|
22394
|
+
}
|
|
22395
|
+
if (typeof colors === "string") {
|
|
22396
|
+
const trimmedColor = colors.trim();
|
|
22397
|
+
return monochromaticInterpolation(
|
|
22398
|
+
trimmedColor.length > 0 ? trimmedColor : DEFAULT_GRADIENT_COLORS[0],
|
|
22399
|
+
length
|
|
22400
|
+
);
|
|
22401
|
+
}
|
|
22402
|
+
const normalizedColors = colors.filter((color) => typeof color === "string").map((color) => color.trim()).filter((color) => color.length > 0);
|
|
22403
|
+
const baseColors = normalizedColors.length > 0 ? normalizedColors : DEFAULT_GRADIENT_COLORS;
|
|
22404
|
+
if (baseColors.length === 1) {
|
|
22405
|
+
return monochromaticInterpolation(baseColors[0], length);
|
|
22406
|
+
}
|
|
22407
|
+
if (length <= baseColors.length) {
|
|
22408
|
+
return baseColors.slice(0, length);
|
|
22409
|
+
}
|
|
22410
|
+
const pairs = baseColors.length - 1;
|
|
22411
|
+
if (pairs <= 0) {
|
|
22412
|
+
return [baseColors[0]];
|
|
22413
|
+
}
|
|
22414
|
+
const needed = length - baseColors.length;
|
|
22415
|
+
const baseAmount = Math.floor(needed / pairs);
|
|
22416
|
+
const extras = needed % pairs;
|
|
22417
|
+
let result = [];
|
|
22418
|
+
let i = 0;
|
|
22419
|
+
let j = 1;
|
|
22420
|
+
while (j < baseColors.length) {
|
|
22421
|
+
const additional = i < extras ? 1 : 0;
|
|
22422
|
+
const interpLength = 2 + baseAmount + additional;
|
|
22423
|
+
const interp = interpolateBetween(
|
|
22424
|
+
baseColors[i],
|
|
22425
|
+
baseColors[j],
|
|
22426
|
+
interpLength
|
|
22427
|
+
);
|
|
22428
|
+
const lastIndex = j === baseColors.length - 1 ? void 0 : -1;
|
|
22429
|
+
result = result.concat(interp.slice(0, lastIndex));
|
|
22430
|
+
i++;
|
|
22431
|
+
j++;
|
|
22432
|
+
}
|
|
22433
|
+
return result;
|
|
22434
|
+
}
|
|
22435
|
+
function buildSeriesColorMap(keys, colors) {
|
|
22436
|
+
const uniqueKeys = [
|
|
22437
|
+
...new Set(keys.map((key) => key.replace("comparison_", "")))
|
|
22438
|
+
].sort();
|
|
22439
|
+
const palette = generateArrayFromColor(colors, uniqueKeys.length);
|
|
22440
|
+
return Object.fromEntries(
|
|
22441
|
+
uniqueKeys.map((key, index) => [key, palette[index]])
|
|
22442
|
+
);
|
|
22443
|
+
}
|
|
22444
|
+
function hexToRgb(hex) {
|
|
22445
|
+
const r = parseInt(hex.substring(1, 3), 16);
|
|
22446
|
+
const g = parseInt(hex.substring(3, 5), 16);
|
|
22447
|
+
const b = parseInt(hex.substring(5, 7), 16);
|
|
22448
|
+
return { r, g, b };
|
|
22449
|
+
}
|
|
22450
|
+
function rgbToHex(rgb) {
|
|
22451
|
+
const rHex = rgb.r.toString(16).padStart(2, "0");
|
|
22452
|
+
const gHex = rgb.g.toString(16).padStart(2, "0");
|
|
22453
|
+
const bHex = rgb.b.toString(16).padStart(2, "0");
|
|
22454
|
+
return `#${rHex}${gHex}${bHex}`;
|
|
22455
|
+
}
|
|
22456
|
+
function colorToHSL(color) {
|
|
22457
|
+
const colorHex = namedColorToHex(color);
|
|
22458
|
+
const { r, g, b } = hexToRgb(colorHex);
|
|
22459
|
+
return rgbToHsl(r, g, b);
|
|
22460
|
+
}
|
|
22461
|
+
function interpolateBetween(leftColor, rightColor, length = 3) {
|
|
22462
|
+
const [h, s, _l] = colorToHSL(leftColor);
|
|
22463
|
+
const [h2, s2, _l2] = colorToHSL(rightColor);
|
|
22464
|
+
const hues = linspace(h, h2, length);
|
|
22465
|
+
const saturations = linspace(s, s2, length);
|
|
22466
|
+
const lightnesses = linspace(_l, _l2, length);
|
|
22467
|
+
return Array.from({ length }).map((_, i) => {
|
|
22468
|
+
const [r, g, b] = HSLtoRGB(hues[i], saturations[i], lightnesses[i]);
|
|
22469
|
+
return rgbToHex({ r: Math.round(r), g: Math.round(g), b: Math.round(b) });
|
|
22470
|
+
});
|
|
22471
|
+
}
|
|
22472
|
+
function monochromaticInterpolation(color, length) {
|
|
22473
|
+
const [h, s] = colorToHSL(color);
|
|
22474
|
+
const hues = linspace(h, h, length);
|
|
22475
|
+
const saturations = linspace(s, s, length);
|
|
22476
|
+
const lightnesses = linspace(0.6, 0.9, length);
|
|
22477
|
+
return Array.from({ length }).map((_, i) => {
|
|
22478
|
+
const [r, g, b] = HSLtoRGB(hues[i], saturations[i], lightnesses[i]);
|
|
22479
|
+
return rgbToHex({ r: Math.round(r), g: Math.round(g), b: Math.round(b) });
|
|
22480
|
+
});
|
|
22481
|
+
}
|
|
22482
|
+
function linspace(start, end, num) {
|
|
22483
|
+
if (num <= 1) return [start];
|
|
22484
|
+
const step = (end - start) / (num - 1);
|
|
22485
|
+
const result = new Array(num);
|
|
22486
|
+
for (let i = 0; i < num; i++) {
|
|
22487
|
+
result[i] = start + step * i;
|
|
22488
|
+
}
|
|
22489
|
+
return result;
|
|
22490
|
+
}
|
|
22491
|
+
function stableColorIndex(field) {
|
|
22492
|
+
let hash = 0;
|
|
22493
|
+
for (const character of field.replace("comparison_", "")) {
|
|
22494
|
+
hash = Math.imul(hash, 31) + character.charCodeAt(0) >>> 0;
|
|
22495
|
+
}
|
|
22496
|
+
return hash;
|
|
22497
|
+
}
|
|
22498
|
+
function selectColor(element, colors, index) {
|
|
22499
|
+
if (!element?.field) return "gray";
|
|
22500
|
+
const isComparison = element.field.includes("comparison_");
|
|
22501
|
+
const color = colors[index % colors.length] ?? "";
|
|
22502
|
+
if (!isComparison) {
|
|
22503
|
+
return color;
|
|
22504
|
+
}
|
|
22505
|
+
if (Object.keys(COLOR_TO_HEX).includes(color)) {
|
|
22506
|
+
const colorHex = COLOR_TO_HEX[color];
|
|
22507
|
+
const rgbArray = hexToRGB(colorHex);
|
|
22508
|
+
return toGrayscale(rgbArray);
|
|
22509
|
+
}
|
|
22510
|
+
if (color?.startsWith("#")) {
|
|
22511
|
+
const rgbArray = hexToRGB(color);
|
|
22512
|
+
return toGrayscale(rgbArray);
|
|
22513
|
+
}
|
|
22514
|
+
return "gray";
|
|
22515
|
+
}
|
|
22516
|
+
function hexToRGB(hex) {
|
|
22517
|
+
const regex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i;
|
|
22518
|
+
const result = regex.exec(hex);
|
|
22519
|
+
if (result) {
|
|
22520
|
+
return [
|
|
22521
|
+
parseInt(result[1], 16),
|
|
22522
|
+
// index 0 is whole string, then ()'s
|
|
22523
|
+
parseInt(result[2], 16),
|
|
22524
|
+
parseInt(result[3], 16),
|
|
22525
|
+
...result[4] ? [parseInt(result[4], 16)] : []
|
|
22526
|
+
// <- alpha channel
|
|
22527
|
+
];
|
|
22528
|
+
}
|
|
22529
|
+
const rgba = hex.match(/[0-9.]+/g);
|
|
22530
|
+
if (rgba) {
|
|
22531
|
+
return [
|
|
22532
|
+
Number(rgba[0]),
|
|
22533
|
+
Number(rgba[1]),
|
|
22534
|
+
Number(rgba[2]),
|
|
22535
|
+
...rgba[3] ? [Number(rgba[3])] : []
|
|
22536
|
+
];
|
|
22537
|
+
}
|
|
22538
|
+
return [128, 128, 128];
|
|
22539
|
+
}
|
|
22540
|
+
function toGrayscale(rgba) {
|
|
22541
|
+
if (rgba.length < 3) return "rbg(128, 128, 128)";
|
|
22542
|
+
let sum = 0;
|
|
22543
|
+
sum += Number(rgba[0] * 0.89);
|
|
22544
|
+
sum += Number(rgba[1] * 1.77);
|
|
22545
|
+
sum += Number(rgba[2] * 0.33);
|
|
22546
|
+
const avg = (sum / 3).toFixed(2);
|
|
22547
|
+
return `rgb(${avg}, ${avg}, ${avg})`;
|
|
22548
|
+
}
|
|
22549
|
+
function namedColorToHex(color) {
|
|
22550
|
+
if (Object.keys(COLOR_TO_HEX).includes(color)) {
|
|
22551
|
+
return COLOR_TO_HEX[color];
|
|
22552
|
+
}
|
|
22553
|
+
return color;
|
|
22554
|
+
}
|
|
22555
|
+
var COLOR_TO_HEX = {
|
|
22556
|
+
aliceblue: "#f0f8ff",
|
|
22557
|
+
antiquewhite: "#faebd7",
|
|
22558
|
+
aqua: "#00ffff",
|
|
22559
|
+
aquamarine: "#7fffd4",
|
|
22560
|
+
azure: "#f0ffff",
|
|
22561
|
+
beige: "#f5f5dc",
|
|
22562
|
+
bisque: "#ffe4c4",
|
|
22563
|
+
black: "#000000",
|
|
22564
|
+
blanchedalmond: "#ffebcd",
|
|
22565
|
+
blue: "#0000ff",
|
|
22566
|
+
blueviolet: "#8a2be2",
|
|
22567
|
+
brown: "#a52a2a",
|
|
22568
|
+
burlywood: "#deb887",
|
|
22569
|
+
cadetblue: "#5f9ea0",
|
|
22570
|
+
chartreuse: "#7fff00",
|
|
22571
|
+
chocolate: "#d2691e",
|
|
22572
|
+
coral: "#ff7f50",
|
|
22573
|
+
cornflowerblue: "#6495ed",
|
|
22574
|
+
cornsilk: "#fff8dc",
|
|
22575
|
+
crimson: "#dc143c",
|
|
22576
|
+
cyan: "#00ffff",
|
|
22577
|
+
darkblue: "#00008b",
|
|
22578
|
+
darkcyan: "#008b8b",
|
|
22579
|
+
darkgoldenrod: "#b8860b",
|
|
22580
|
+
darkgray: "#a9a9a9",
|
|
22581
|
+
darkgreen: "#006400",
|
|
22582
|
+
darkkhaki: "#bdb76b",
|
|
22583
|
+
darkmagenta: "#8b008b",
|
|
22584
|
+
darkolivegreen: "#556b2f",
|
|
22585
|
+
darkorange: "#ff8c00",
|
|
22586
|
+
darkorchid: "#9932cc",
|
|
22587
|
+
darkred: "#8b0000",
|
|
22588
|
+
darksalmon: "#e9967a",
|
|
22589
|
+
darkseagreen: "#8fbc8f",
|
|
22590
|
+
darkslateblue: "#483d8b",
|
|
22591
|
+
darkslategray: "#2f4f4f",
|
|
22592
|
+
darkturquoise: "#00ced1",
|
|
22593
|
+
darkviolet: "#9400d3",
|
|
22594
|
+
deeppink: "#ff1493",
|
|
22595
|
+
deepskyblue: "#00bfff",
|
|
22596
|
+
dimgray: "#696969",
|
|
22597
|
+
dodgerblue: "#1e90ff",
|
|
22598
|
+
firebrick: "#b22222",
|
|
22599
|
+
floralwhite: "#fffaf0",
|
|
22600
|
+
forestgreen: "#228b22",
|
|
22601
|
+
fuchsia: "#ff00ff",
|
|
22602
|
+
gainsboro: "#dcdcdc",
|
|
22603
|
+
ghostwhite: "#f8f8ff",
|
|
22604
|
+
gold: "#ffd700",
|
|
22605
|
+
goldenrod: "#daa520",
|
|
22606
|
+
gray: "#808080",
|
|
22607
|
+
green: "#008000",
|
|
22608
|
+
greenyellow: "#adff2f",
|
|
22609
|
+
honeydew: "#f0fff0",
|
|
22610
|
+
hotpink: "#ff69b4",
|
|
22611
|
+
indianred: "#cd5c5c",
|
|
22612
|
+
indigo: "#4b0082",
|
|
22613
|
+
ivory: "#fffff0",
|
|
22614
|
+
khaki: "#f0e68c",
|
|
22615
|
+
lavender: "#e6e6fa",
|
|
22616
|
+
lavenderblush: "#fff0f5",
|
|
22617
|
+
lawngreen: "#7cfc00",
|
|
22618
|
+
lemonchiffon: "#fffacd",
|
|
22619
|
+
lightblue: "#add8e6",
|
|
22620
|
+
lightcoral: "#f08080",
|
|
22621
|
+
lightcyan: "#e0ffff",
|
|
22622
|
+
lightgoldenrodyellow: "#fafad2",
|
|
22623
|
+
lightgrey: "#d3d3d3",
|
|
22624
|
+
lightgreen: "#90ee90",
|
|
22625
|
+
lightpink: "#ffb6c1",
|
|
22626
|
+
lightsalmon: "#ffa07a",
|
|
22627
|
+
lightseagreen: "#20b2aa",
|
|
22628
|
+
lightskyblue: "#87cefa",
|
|
22629
|
+
lightslategray: "#778899",
|
|
22630
|
+
lightsteelblue: "#b0c4de",
|
|
22631
|
+
lightyellow: "#ffffe0",
|
|
22632
|
+
lime: "#00ff00",
|
|
22633
|
+
limegreen: "#32cd32",
|
|
22634
|
+
linen: "#faf0e6",
|
|
22635
|
+
magenta: "#ff00ff",
|
|
22636
|
+
maroon: "#800000",
|
|
22637
|
+
mediumaquamarine: "#66cdaa",
|
|
22638
|
+
mediumblue: "#0000cd",
|
|
22639
|
+
mediumorchid: "#ba55d3",
|
|
22640
|
+
mediumpurple: "#9370d8",
|
|
22641
|
+
mediumseagreen: "#3cb371",
|
|
22642
|
+
mediumslateblue: "#7b68ee",
|
|
22643
|
+
mediumspringgreen: "#00fa9a",
|
|
22644
|
+
mediumturquoise: "#48d1cc",
|
|
22645
|
+
mediumvioletred: "#c71585",
|
|
22646
|
+
midnightblue: "#191970",
|
|
22647
|
+
mintcream: "#f5fffa",
|
|
22648
|
+
mistyrose: "#ffe4e1",
|
|
22649
|
+
moccasin: "#ffe4b5",
|
|
22650
|
+
navajowhite: "#ffdead",
|
|
22651
|
+
navy: "#000080",
|
|
22652
|
+
oldlace: "#fdf5e6",
|
|
22653
|
+
olive: "#808000",
|
|
22654
|
+
olivedrab: "#6b8e23",
|
|
22655
|
+
orange: "#ffa500",
|
|
22656
|
+
orangered: "#ff4500",
|
|
22657
|
+
orchid: "#da70d6",
|
|
22658
|
+
palegoldenrod: "#eee8aa",
|
|
22659
|
+
palegreen: "#98fb98",
|
|
22660
|
+
paleturquoise: "#afeeee",
|
|
22661
|
+
palevioletred: "#d87093",
|
|
22662
|
+
papayawhip: "#ffefd5",
|
|
22663
|
+
peachpuff: "#ffdab9",
|
|
22664
|
+
peru: "#cd853f",
|
|
22665
|
+
pink: "#ffc0cb",
|
|
22666
|
+
plum: "#dda0dd",
|
|
22667
|
+
powderblue: "#b0e0e6",
|
|
22668
|
+
purple: "#800080",
|
|
22669
|
+
rebeccapurple: "#663399",
|
|
22670
|
+
red: "#ff0000",
|
|
22671
|
+
rosybrown: "#bc8f8f",
|
|
22672
|
+
royalblue: "#4169e1",
|
|
22673
|
+
saddlebrown: "#8b4513",
|
|
22674
|
+
salmon: "#fa8072",
|
|
22675
|
+
sandybrown: "#f4a460",
|
|
22676
|
+
seagreen: "#2e8b57",
|
|
22677
|
+
seashell: "#fff5ee",
|
|
22678
|
+
sienna: "#a0522d",
|
|
22679
|
+
silver: "#c0c0c0",
|
|
22680
|
+
skyblue: "#87ceeb",
|
|
22681
|
+
slateblue: "#6a5acd",
|
|
22682
|
+
slategray: "#708090",
|
|
22683
|
+
snow: "#fffafa",
|
|
22684
|
+
springgreen: "#00ff7f",
|
|
22685
|
+
steelblue: "#4682b4",
|
|
22686
|
+
tan: "#d2b48c",
|
|
22687
|
+
teal: "#008080",
|
|
22688
|
+
thistle: "#d8bfd8",
|
|
22689
|
+
tomato: "#ff6347",
|
|
22690
|
+
turquoise: "#40e0d0",
|
|
22691
|
+
violet: "#ee82ee",
|
|
22692
|
+
wheat: "#f5deb3",
|
|
22693
|
+
white: "#ffffff",
|
|
22694
|
+
whitesmoke: "#f5f5f5",
|
|
22695
|
+
yellow: "#ffff00",
|
|
22696
|
+
yellowgreen: "#9acd32"
|
|
22697
|
+
};
|
|
22698
|
+
function rgbToHsl(r, g, b) {
|
|
22699
|
+
r /= 255, g /= 255, b /= 255;
|
|
22700
|
+
const max2 = Math.max(r, g, b), min2 = Math.min(r, g, b);
|
|
22701
|
+
let h = (max2 + min2) / 2;
|
|
22702
|
+
let s = (max2 + min2) / 2;
|
|
22703
|
+
const l = (max2 + min2) / 2;
|
|
22704
|
+
if (max2 == min2) {
|
|
22705
|
+
h = s = 0;
|
|
22706
|
+
} else {
|
|
22707
|
+
const d = max2 - min2;
|
|
22708
|
+
s = l > 0.5 ? d / (2 - max2 - min2) : d / (max2 + min2);
|
|
22709
|
+
switch (max2) {
|
|
22710
|
+
case r:
|
|
22711
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
22712
|
+
break;
|
|
22713
|
+
case g:
|
|
22714
|
+
h = (b - r) / d + 2;
|
|
22715
|
+
break;
|
|
22716
|
+
case b:
|
|
22717
|
+
h = (r - g) / d + 4;
|
|
22718
|
+
break;
|
|
22719
|
+
}
|
|
22720
|
+
h /= 6;
|
|
22721
|
+
}
|
|
22722
|
+
return [h, s, l];
|
|
22723
|
+
}
|
|
22724
|
+
function HSLtoRGB(h, s, l) {
|
|
22725
|
+
let r, g, b;
|
|
22726
|
+
if (s == 0) {
|
|
22727
|
+
r = g = b = l;
|
|
22728
|
+
} else {
|
|
22729
|
+
const hue2rgb = (p2, q2, t) => {
|
|
22730
|
+
if (t < 0) t += 1;
|
|
22731
|
+
if (t > 1) t -= 1;
|
|
22732
|
+
if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t;
|
|
22733
|
+
if (t < 1 / 2) return q2;
|
|
22734
|
+
if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6;
|
|
22735
|
+
return p2;
|
|
22736
|
+
};
|
|
22737
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
22738
|
+
const p = 2 * l - q;
|
|
22739
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
22740
|
+
g = hue2rgb(p, q, h);
|
|
22741
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
22742
|
+
}
|
|
22743
|
+
return [r * 255, g * 255, b * 255];
|
|
22744
|
+
}
|
|
22745
|
+
|
|
22351
22746
|
// src/utils/report.ts
|
|
22352
22747
|
init_columnProcessing();
|
|
22353
22748
|
init_dataFetcher();
|
|
@@ -22361,90 +22756,514 @@ init_valueFormatter();
|
|
|
22361
22756
|
init_astFilterProcessing();
|
|
22362
22757
|
init_reportBuilder();
|
|
22363
22758
|
init_astProcessing();
|
|
22364
|
-
|
|
22365
|
-
|
|
22366
|
-
|
|
22367
|
-
|
|
22368
|
-
|
|
22369
|
-
|
|
22370
|
-
|
|
22371
|
-
|
|
22372
|
-
|
|
22373
|
-
|
|
22374
|
-
|
|
22375
|
-
|
|
22376
|
-
|
|
22377
|
-
|
|
22378
|
-
|
|
22379
|
-
|
|
22380
|
-
|
|
22381
|
-
|
|
22382
|
-
|
|
22383
|
-
|
|
22384
|
-
|
|
22385
|
-
|
|
22386
|
-
|
|
22387
|
-
referenceLineYValues: reportInternal.referenceLineYValues,
|
|
22388
|
-
referenceLines: reportInternal.referenceLines,
|
|
22389
|
-
includeCustomFields: reportInternal.includeCustomFields,
|
|
22390
|
-
columnsWithCustomFields: reportInternal.columnsWithCustomFields,
|
|
22391
|
-
pivotRows: reportInternal.pivotRows,
|
|
22392
|
-
pivotColumns: reportInternal.pivotColumns,
|
|
22393
|
-
pivotRowCount: reportInternal.pivotRowCount,
|
|
22394
|
-
filterMap: reportInternal.filterMap,
|
|
22395
|
-
showLegend: reportInternal.showLegend
|
|
22396
|
-
};
|
|
22759
|
+
|
|
22760
|
+
// src/utils/chartSort.ts
|
|
22761
|
+
init_columnProcessing();
|
|
22762
|
+
|
|
22763
|
+
// src/utils/pivotAggregations.ts
|
|
22764
|
+
function getPivotAggregations(report) {
|
|
22765
|
+
const pivot = report.pivot;
|
|
22766
|
+
if (!pivot) return [];
|
|
22767
|
+
if ("aggregations" in pivot && Array.isArray(pivot.aggregations)) {
|
|
22768
|
+
return pivot.aggregations;
|
|
22769
|
+
}
|
|
22770
|
+
if ("aggregationType" in pivot && pivot.aggregationType) {
|
|
22771
|
+
return [
|
|
22772
|
+
{
|
|
22773
|
+
aggregationType: pivot.aggregationType,
|
|
22774
|
+
valueField: pivot.valueField,
|
|
22775
|
+
valueField2: pivot.valueField2,
|
|
22776
|
+
valueField2Type: pivot.valueField2Type,
|
|
22777
|
+
valueFieldType: pivot.valueFieldType
|
|
22778
|
+
}
|
|
22779
|
+
];
|
|
22780
|
+
}
|
|
22781
|
+
return [];
|
|
22397
22782
|
}
|
|
22398
|
-
|
|
22399
|
-
|
|
22400
|
-
|
|
22401
|
-
|
|
22402
|
-
filters = [],
|
|
22403
|
-
getToken,
|
|
22404
|
-
abortSignal,
|
|
22405
|
-
additionalProcessing,
|
|
22406
|
-
overwriteCache = false
|
|
22407
|
-
}) {
|
|
22408
|
-
const fetchResp = await quillFetch({
|
|
22409
|
-
client,
|
|
22410
|
-
task: "report",
|
|
22411
|
-
metadata: {
|
|
22412
|
-
reportId,
|
|
22413
|
-
clientId: client.id,
|
|
22414
|
-
databaseType: client.databaseType,
|
|
22415
|
-
filters: filters.map((filter) => ({ ...filter, options: void 0 })),
|
|
22416
|
-
useNewNodeSql: true,
|
|
22417
|
-
tenants,
|
|
22418
|
-
additionalProcessing,
|
|
22419
|
-
overwriteCache
|
|
22420
|
-
},
|
|
22421
|
-
abortSignal,
|
|
22422
|
-
getToken
|
|
22423
|
-
});
|
|
22424
|
-
const resp = await parseFetchResponse(client, "report", fetchResp, getToken);
|
|
22425
|
-
if (client.databaseType?.toLowerCase() === "bigquery") {
|
|
22426
|
-
parseValueFromBigQueryDates(resp.rows, resp.fields);
|
|
22783
|
+
function getAggregationFieldKey(aggregation, hasMultipleAggregations) {
|
|
22784
|
+
if (!aggregation.aggregationType) return null;
|
|
22785
|
+
if (!aggregation.valueField && aggregation.aggregationType === "percentage") {
|
|
22786
|
+
return "percentage";
|
|
22427
22787
|
}
|
|
22428
|
-
|
|
22429
|
-
|
|
22430
|
-
|
|
22431
|
-
|
|
22432
|
-
fields: resp.fields || []
|
|
22433
|
-
};
|
|
22788
|
+
if (aggregation.valueField) {
|
|
22789
|
+
return hasMultipleAggregations ? `${aggregation.valueField}_${aggregation.aggregationType}` : aggregation.valueField;
|
|
22790
|
+
}
|
|
22791
|
+
return hasMultipleAggregations ? `${aggregation.aggregationType}_${aggregation.aggregationType}` : aggregation.aggregationType;
|
|
22434
22792
|
}
|
|
22435
|
-
|
|
22436
|
-
|
|
22437
|
-
|
|
22438
|
-
|
|
22439
|
-
|
|
22440
|
-
|
|
22441
|
-
|
|
22442
|
-
|
|
22443
|
-
|
|
22444
|
-
|
|
22445
|
-
|
|
22446
|
-
|
|
22447
|
-
|
|
22793
|
+
function getAggregationIdentityKey(aggregation) {
|
|
22794
|
+
if (!aggregation) return "";
|
|
22795
|
+
const aggregationType = String(aggregation.aggregationType ?? "").trim().toLowerCase();
|
|
22796
|
+
const valueField = String(aggregation.valueField ?? "").trim().toLowerCase();
|
|
22797
|
+
return `${aggregationType}::${valueField}`;
|
|
22798
|
+
}
|
|
22799
|
+
function trimFieldSuffix(value, suffix) {
|
|
22800
|
+
const normalizedSuffix = String(suffix ?? "").trim();
|
|
22801
|
+
if (!normalizedSuffix) return value;
|
|
22802
|
+
for (const separator of ["_", ":"]) {
|
|
22803
|
+
const ending = `${separator}${normalizedSuffix}`;
|
|
22804
|
+
if (value.endsWith(ending)) {
|
|
22805
|
+
return value.slice(0, -ending.length);
|
|
22806
|
+
}
|
|
22807
|
+
}
|
|
22808
|
+
return value;
|
|
22809
|
+
}
|
|
22810
|
+
function getPivotColumnValueForSeries(field, aggregation, hasMultipleAggregations) {
|
|
22811
|
+
let value = String(field ?? "").replace(/^comparison_/, "").trim();
|
|
22812
|
+
if (hasMultipleAggregations) {
|
|
22813
|
+
value = trimFieldSuffix(value, aggregation.aggregationType);
|
|
22814
|
+
}
|
|
22815
|
+
return trimFieldSuffix(value, aggregation.valueField);
|
|
22816
|
+
}
|
|
22817
|
+
function trailingPivotMeasureSegmentBeforeAggType(normalizedField, normalizedAggregationType) {
|
|
22818
|
+
const suffix = `_${normalizedAggregationType}`;
|
|
22819
|
+
if (!normalizedField.endsWith(suffix)) return null;
|
|
22820
|
+
const base = normalizedField.slice(0, -suffix.length);
|
|
22821
|
+
const lastUnderscore = base.lastIndexOf("_");
|
|
22822
|
+
if (lastUnderscore < 0) return null;
|
|
22823
|
+
const candidate = base.slice(lastUnderscore + 1).trim();
|
|
22824
|
+
return candidate || null;
|
|
22825
|
+
}
|
|
22826
|
+
var PIVOT_FIELD_AGG_MATCH_TIER = {
|
|
22827
|
+
looseAggSuffix: 1,
|
|
22828
|
+
rawValueField: 2,
|
|
22829
|
+
pivotWideValueAndAggSuffix: 3,
|
|
22830
|
+
canonicalValueAggOrCount: 4
|
|
22831
|
+
};
|
|
22832
|
+
function matchPivotFieldToAggregationTier(normalizedField, aggregation) {
|
|
22833
|
+
const aggregationType = String(aggregation.aggregationType ?? "").trim();
|
|
22834
|
+
if (!aggregationType) return null;
|
|
22835
|
+
const type = aggregationType.toLowerCase();
|
|
22836
|
+
const valueField = String(aggregation.valueField ?? "").trim().toLowerCase();
|
|
22837
|
+
if (!valueField && normalizedField === type) {
|
|
22838
|
+
return PIVOT_FIELD_AGG_MATCH_TIER.canonicalValueAggOrCount;
|
|
22839
|
+
}
|
|
22840
|
+
if (valueField && normalizedField === valueField) {
|
|
22841
|
+
return PIVOT_FIELD_AGG_MATCH_TIER.rawValueField;
|
|
22842
|
+
}
|
|
22843
|
+
if (valueField && normalizedField === `${valueField}_${type}`) {
|
|
22844
|
+
return PIVOT_FIELD_AGG_MATCH_TIER.canonicalValueAggOrCount;
|
|
22845
|
+
}
|
|
22846
|
+
if (valueField && normalizedField.endsWith(`_${valueField}_${type}`)) {
|
|
22847
|
+
return PIVOT_FIELD_AGG_MATCH_TIER.pivotWideValueAndAggSuffix;
|
|
22848
|
+
}
|
|
22849
|
+
if (normalizedField.endsWith(`_${type}`) || normalizedField.endsWith(`:${type}`)) {
|
|
22850
|
+
const embeddedMeasure = trailingPivotMeasureSegmentBeforeAggType(
|
|
22851
|
+
normalizedField,
|
|
22852
|
+
type
|
|
22853
|
+
);
|
|
22854
|
+
if (embeddedMeasure && valueField && embeddedMeasure !== valueField) {
|
|
22855
|
+
return null;
|
|
22856
|
+
}
|
|
22857
|
+
return PIVOT_FIELD_AGG_MATCH_TIER.looseAggSuffix;
|
|
22858
|
+
}
|
|
22859
|
+
return null;
|
|
22860
|
+
}
|
|
22861
|
+
function findAggregationForFieldStrict(field, aggregations) {
|
|
22862
|
+
const normalizedField = String(field ?? "").trim().toLowerCase();
|
|
22863
|
+
let best;
|
|
22864
|
+
for (let index = 0; index < aggregations.length; index++) {
|
|
22865
|
+
const aggregation = aggregations[index];
|
|
22866
|
+
const tier = matchPivotFieldToAggregationTier(normalizedField, aggregation);
|
|
22867
|
+
if (tier == null) continue;
|
|
22868
|
+
if (!best || tier > best.tier || tier === best.tier && index < best.index) {
|
|
22869
|
+
best = { aggregation, tier, index };
|
|
22870
|
+
}
|
|
22871
|
+
}
|
|
22872
|
+
return best?.aggregation;
|
|
22873
|
+
}
|
|
22874
|
+
|
|
22875
|
+
// src/utils/chartSort.ts
|
|
22876
|
+
var ROW_SORT_CHART_TYPES = /* @__PURE__ */ new Set([
|
|
22877
|
+
"column",
|
|
22878
|
+
"stacked",
|
|
22879
|
+
"stacked bar",
|
|
22880
|
+
"line",
|
|
22881
|
+
"radar",
|
|
22882
|
+
"bar",
|
|
22883
|
+
"pie"
|
|
22884
|
+
]);
|
|
22885
|
+
var TWO_DIMENSIONAL_SORT_CHART_TYPES = /* @__PURE__ */ new Set([
|
|
22886
|
+
"column",
|
|
22887
|
+
"stacked",
|
|
22888
|
+
"stacked bar",
|
|
22889
|
+
"line",
|
|
22890
|
+
"radar"
|
|
22891
|
+
]);
|
|
22892
|
+
var directionLabel = (direction) => direction === "DESC" ? "descending" : "ascending";
|
|
22893
|
+
function dimensionOrderLabel(report, field, direction) {
|
|
22894
|
+
const fieldType = String(
|
|
22895
|
+
field === report.pivot?.rowField ? report.pivot.rowFieldType : field === report.pivot?.columnField ? report.pivot.columnFieldType : ""
|
|
22896
|
+
).toLowerCase();
|
|
22897
|
+
const format9 = field === report.xAxisField ? String(report.xAxisFormat ?? "") : "";
|
|
22898
|
+
const isDate = /date|time/.test(fieldType) || /^(date|yyyy|MMM_|hh_)/.test(format9);
|
|
22899
|
+
const isNumber = /int|number|numeric|decimal|float|double/.test(fieldType) || /^(whole_number|one_decimal_place|two_decimal_places|percent|dollar_)/.test(
|
|
22900
|
+
format9
|
|
22901
|
+
);
|
|
22902
|
+
if (isDate) {
|
|
22903
|
+
return direction === "ASC" ? "oldest to newest" : "newest to oldest";
|
|
22904
|
+
}
|
|
22905
|
+
if (isNumber) {
|
|
22906
|
+
return direction === "ASC" ? "low to high" : "high to low";
|
|
22907
|
+
}
|
|
22908
|
+
return direction === "ASC" ? "A to Z" : "Z to A";
|
|
22909
|
+
}
|
|
22910
|
+
function formatChartSortValue(chartSort) {
|
|
22911
|
+
if (!chartSort?.field) return "";
|
|
22912
|
+
return `${chartSort.target}:${chartSort.field} ${directionLabel(
|
|
22913
|
+
chartSort.direction
|
|
22914
|
+
)}`;
|
|
22915
|
+
}
|
|
22916
|
+
function parseChartSortValue(value) {
|
|
22917
|
+
const trimmed = String(value ?? "").trim();
|
|
22918
|
+
if (!trimmed) return void 0;
|
|
22919
|
+
const match = trimmed.match(/^(rows|series):(.*)\s+(ascending|descending)$/i);
|
|
22920
|
+
if (!match) return void 0;
|
|
22921
|
+
const target = String(match[1]).toLowerCase();
|
|
22922
|
+
const field = String(match[2] ?? "").trim();
|
|
22923
|
+
if (!field) return void 0;
|
|
22924
|
+
return {
|
|
22925
|
+
target,
|
|
22926
|
+
field,
|
|
22927
|
+
direction: String(match[3]).toLowerCase() === "descending" ? "DESC" : "ASC"
|
|
22928
|
+
};
|
|
22929
|
+
}
|
|
22930
|
+
function getSupportedChartSortTargets(report) {
|
|
22931
|
+
const chartType = String(report.chartType ?? "").toLowerCase();
|
|
22932
|
+
const rowField = String(report.pivot?.rowField ?? "").trim();
|
|
22933
|
+
const columnField = String(report.pivot?.columnField ?? "").trim();
|
|
22934
|
+
if (report.pivot && !rowField) return [];
|
|
22935
|
+
if (rowField && columnField) {
|
|
22936
|
+
return TWO_DIMENSIONAL_SORT_CHART_TYPES.has(chartType) ? ["rows", "series"] : [];
|
|
22937
|
+
}
|
|
22938
|
+
return ROW_SORT_CHART_TYPES.has(chartType) ? ["rows"] : [];
|
|
22939
|
+
}
|
|
22940
|
+
function getChartSortOptions(report) {
|
|
22941
|
+
if (!report || getSupportedChartSortTargets(report).length === 0) return [];
|
|
22942
|
+
const rowField = String(
|
|
22943
|
+
report.pivot?.rowField || report.xAxisField || ""
|
|
22944
|
+
).trim();
|
|
22945
|
+
const columnField = String(report.pivot?.columnField ?? "").trim();
|
|
22946
|
+
const isTwoDimensional = Boolean(rowField && columnField);
|
|
22947
|
+
const aggregations = getPivotAggregations(report);
|
|
22948
|
+
const totals = aggregations.flatMap((aggregation) => {
|
|
22949
|
+
const field = getAggregationFieldKey(aggregation, aggregations.length > 1);
|
|
22950
|
+
return field ? [
|
|
22951
|
+
{
|
|
22952
|
+
field,
|
|
22953
|
+
label: `Total ${getPivotAggregationLabel(report, aggregation)}`
|
|
22954
|
+
}
|
|
22955
|
+
] : [];
|
|
22956
|
+
});
|
|
22957
|
+
const groups = isTwoDimensional ? [
|
|
22958
|
+
{
|
|
22959
|
+
target: "rows",
|
|
22960
|
+
targetField: rowField,
|
|
22961
|
+
targetLabel: getReportFieldLabel(report, rowField),
|
|
22962
|
+
fields: [
|
|
22963
|
+
{ field: rowField, label: getReportFieldLabel(report, rowField) },
|
|
22964
|
+
...totals
|
|
22965
|
+
]
|
|
22966
|
+
},
|
|
22967
|
+
{
|
|
22968
|
+
target: "series",
|
|
22969
|
+
targetField: columnField,
|
|
22970
|
+
targetLabel: getReportFieldLabel(report, columnField),
|
|
22971
|
+
fields: [
|
|
22972
|
+
{
|
|
22973
|
+
field: columnField,
|
|
22974
|
+
label: getReportFieldLabel(report, columnField)
|
|
22975
|
+
},
|
|
22976
|
+
...totals
|
|
22977
|
+
]
|
|
22978
|
+
}
|
|
22979
|
+
] : [
|
|
22980
|
+
{
|
|
22981
|
+
target: "rows",
|
|
22982
|
+
targetField: rowField,
|
|
22983
|
+
targetLabel: report.pivot?.rowField ? getReportFieldLabel(report, rowField) : String(report.xAxisLabel || rowField).trim(),
|
|
22984
|
+
fields: [
|
|
22985
|
+
{
|
|
22986
|
+
field: rowField,
|
|
22987
|
+
label: report.pivot?.rowField ? getReportFieldLabel(report, rowField) : String(report.xAxisLabel || rowField).trim()
|
|
22988
|
+
},
|
|
22989
|
+
...(report.yAxisFields ?? []).filter(({ field }) => !String(field).startsWith("comparison_")).map(({ field, label }) => ({
|
|
22990
|
+
field: String(field ?? "").trim(),
|
|
22991
|
+
label: String(label || field || "").trim()
|
|
22992
|
+
}))
|
|
22993
|
+
]
|
|
22994
|
+
}
|
|
22995
|
+
];
|
|
22996
|
+
return groups.flatMap(
|
|
22997
|
+
({ target, targetField, targetLabel, fields }) => Array.from(
|
|
22998
|
+
new Map(
|
|
22999
|
+
fields.filter(({ field }) => Boolean(field)).map((field) => [field.field, field])
|
|
23000
|
+
).values()
|
|
23001
|
+
).flatMap(
|
|
23002
|
+
({ field, label }) => ["ASC", "DESC"].map((direction) => ({
|
|
23003
|
+
label: field === targetField ? `${targetLabel} \u2014 ${dimensionOrderLabel(
|
|
23004
|
+
report,
|
|
23005
|
+
targetField,
|
|
23006
|
+
direction
|
|
23007
|
+
)}` : `${targetLabel} by ${label || field} \u2014 ${direction === "ASC" ? "low to high" : "high to low"}`,
|
|
23008
|
+
value: formatChartSortValue({ target, field, direction })
|
|
23009
|
+
}))
|
|
23010
|
+
)
|
|
23011
|
+
);
|
|
23012
|
+
}
|
|
23013
|
+
function getReportFieldLabel(report, field) {
|
|
23014
|
+
const pivotFilter = field === report.pivot?.rowField ? report.pivot.rowFilter : field === report.pivot?.columnField ? report.pivot.columnFilter : null;
|
|
23015
|
+
if (pivotFilter?.label) return pivotFilter.label;
|
|
23016
|
+
return report.columns.find(
|
|
23017
|
+
(column) => column.field === field || column.field.endsWith(`.${field}`)
|
|
23018
|
+
)?.label ?? field.split(".").pop().replace(/[_-]+/g, " ").replace(/\b\w/g, (character) => character.toUpperCase());
|
|
23019
|
+
}
|
|
23020
|
+
function getPivotAggregationLabel(report, aggregation) {
|
|
23021
|
+
const aggregationLabel = aggregation.aggregationType ? formatAggregationTypeForDisplay(
|
|
23022
|
+
aggregation.aggregationType
|
|
23023
|
+
) : "Value";
|
|
23024
|
+
const valueField = String(aggregation.valueField ?? "").trim();
|
|
23025
|
+
if (!valueField) return aggregationLabel;
|
|
23026
|
+
const valueLabel = report.columns.find(({ field }) => field === valueField)?.label || valueField.replace(/[_-]+/g, " ").replace(/\b\w/g, (character) => character.toUpperCase());
|
|
23027
|
+
if (aggregation.aggregationType === "sum") return valueLabel;
|
|
23028
|
+
return `${aggregationLabel} ${valueLabel}`;
|
|
23029
|
+
}
|
|
23030
|
+
function isEmpty(value) {
|
|
23031
|
+
return value === null || value === void 0 || value === "";
|
|
23032
|
+
}
|
|
23033
|
+
function getNumericValue(value) {
|
|
23034
|
+
if (typeof value === "number") {
|
|
23035
|
+
return Number.isFinite(value) ? value : void 0;
|
|
23036
|
+
}
|
|
23037
|
+
const normalized = String(value ?? "").trim().replace(/[$£€¥,%\s,]/g, "");
|
|
23038
|
+
if (!normalized) return void 0;
|
|
23039
|
+
const parsed = Number(normalized);
|
|
23040
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
23041
|
+
}
|
|
23042
|
+
function compareValues2(left, right) {
|
|
23043
|
+
const leftNumber = getNumericValue(left);
|
|
23044
|
+
const rightNumber = getNumericValue(right);
|
|
23045
|
+
if (leftNumber !== void 0 && rightNumber !== void 0) {
|
|
23046
|
+
return leftNumber - rightNumber;
|
|
23047
|
+
}
|
|
23048
|
+
return String(left).localeCompare(String(right), void 0, {
|
|
23049
|
+
numeric: true,
|
|
23050
|
+
sensitivity: "base"
|
|
23051
|
+
});
|
|
23052
|
+
}
|
|
23053
|
+
function getPivotSeries(report) {
|
|
23054
|
+
const aggregations = getPivotAggregations(report);
|
|
23055
|
+
const hasMultipleAggregations = aggregations.length > 1;
|
|
23056
|
+
return report.yAxisFields.map((axis, index) => {
|
|
23057
|
+
const normalizedField = axis.field.replace(/^comparison_/, "");
|
|
23058
|
+
const aggregation = aggregations.length === 1 ? aggregations[0] : findAggregationForFieldStrict(normalizedField, aggregations);
|
|
23059
|
+
return {
|
|
23060
|
+
axis,
|
|
23061
|
+
index,
|
|
23062
|
+
aggregationIdentity: getAggregationIdentityKey(aggregation),
|
|
23063
|
+
columnValue: aggregation ? getPivotColumnValueForSeries(
|
|
23064
|
+
normalizedField,
|
|
23065
|
+
aggregation,
|
|
23066
|
+
hasMultipleAggregations
|
|
23067
|
+
) : normalizedField
|
|
23068
|
+
};
|
|
23069
|
+
});
|
|
23070
|
+
}
|
|
23071
|
+
function compareText(left, right) {
|
|
23072
|
+
return left.localeCompare(right, void 0, {
|
|
23073
|
+
numeric: true,
|
|
23074
|
+
sensitivity: "base"
|
|
23075
|
+
});
|
|
23076
|
+
}
|
|
23077
|
+
function applyTwoDimensionalPivotSeriesSort(report, chartSort) {
|
|
23078
|
+
const columnField = String(report.pivot?.columnField ?? "").trim();
|
|
23079
|
+
if (!columnField) return report;
|
|
23080
|
+
const multiplier = chartSort.direction === "DESC" ? -1 : 1;
|
|
23081
|
+
const series = getPivotSeries(report);
|
|
23082
|
+
const aggregations = getPivotAggregations(report);
|
|
23083
|
+
let compareColumnValues;
|
|
23084
|
+
if (chartSort.field === columnField) {
|
|
23085
|
+
compareColumnValues = (left, right) => compareText(left, right) * multiplier;
|
|
23086
|
+
} else {
|
|
23087
|
+
const selectedAggregation = aggregations.find(
|
|
23088
|
+
(aggregation) => getAggregationFieldKey(aggregation, aggregations.length > 1) === chartSort.field
|
|
23089
|
+
);
|
|
23090
|
+
if (!selectedAggregation) return report;
|
|
23091
|
+
const selectedIdentity = getAggregationIdentityKey(selectedAggregation);
|
|
23092
|
+
const totals = /* @__PURE__ */ new Map();
|
|
23093
|
+
for (const entry of series) {
|
|
23094
|
+
if (entry.axis.field.startsWith("comparison_") || entry.aggregationIdentity !== selectedIdentity) {
|
|
23095
|
+
continue;
|
|
23096
|
+
}
|
|
23097
|
+
const total = report.rows.reduce(
|
|
23098
|
+
(sum, row) => sum + (getNumericValue(row[entry.axis.field]) ?? 0),
|
|
23099
|
+
0
|
|
23100
|
+
);
|
|
23101
|
+
totals.set(entry.columnValue, total);
|
|
23102
|
+
}
|
|
23103
|
+
compareColumnValues = (left, right) => {
|
|
23104
|
+
const compared = (totals.get(left) ?? 0) - (totals.get(right) ?? 0);
|
|
23105
|
+
return compared === 0 ? compareText(left, right) : compared * multiplier;
|
|
23106
|
+
};
|
|
23107
|
+
}
|
|
23108
|
+
const yAxisFields = [...series].sort((left, right) => {
|
|
23109
|
+
const compared = compareColumnValues(left.columnValue, right.columnValue);
|
|
23110
|
+
return compared === 0 ? left.index - right.index : compared;
|
|
23111
|
+
}).map(({ axis }) => axis);
|
|
23112
|
+
return {
|
|
23113
|
+
...report,
|
|
23114
|
+
chartSort,
|
|
23115
|
+
yAxisFields
|
|
23116
|
+
};
|
|
23117
|
+
}
|
|
23118
|
+
function applyChartRowSort(report, chartSort) {
|
|
23119
|
+
const { field, direction } = chartSort;
|
|
23120
|
+
const multiplier = direction === "DESC" ? -1 : 1;
|
|
23121
|
+
const rowField = String(
|
|
23122
|
+
report.pivot?.rowField || report.xAxisField || ""
|
|
23123
|
+
).trim();
|
|
23124
|
+
const aggregations = getPivotAggregations(report);
|
|
23125
|
+
const selectedAggregation = aggregations.find(
|
|
23126
|
+
(aggregation) => getAggregationFieldKey(aggregation, aggregations.length > 1) === field
|
|
23127
|
+
);
|
|
23128
|
+
const selectedIdentity = getAggregationIdentityKey(selectedAggregation);
|
|
23129
|
+
const totalSeries = selectedAggregation ? getPivotSeries(report).filter(
|
|
23130
|
+
(series) => !series.axis.field.startsWith("comparison_") && series.aggregationIdentity === selectedIdentity
|
|
23131
|
+
) : [];
|
|
23132
|
+
const getSortValue = (row) => {
|
|
23133
|
+
const rawDate = row.__quillRawDate;
|
|
23134
|
+
if (field === rowField && rawDate !== null && rawDate !== void 0 && rawDate !== "") {
|
|
23135
|
+
return rawDate;
|
|
23136
|
+
}
|
|
23137
|
+
if (selectedAggregation && report.pivot?.columnField) {
|
|
23138
|
+
return totalSeries.reduce(
|
|
23139
|
+
(total, series) => total + (getNumericValue(row[series.axis.field]) ?? 0),
|
|
23140
|
+
0
|
|
23141
|
+
);
|
|
23142
|
+
}
|
|
23143
|
+
return row[field];
|
|
23144
|
+
};
|
|
23145
|
+
const rows = report.rows.map((row, index) => ({ row, index })).sort((left, right) => {
|
|
23146
|
+
const leftValue = getSortValue(left.row);
|
|
23147
|
+
const rightValue = getSortValue(right.row);
|
|
23148
|
+
if (isEmpty(leftValue) && isEmpty(rightValue)) {
|
|
23149
|
+
return left.index - right.index;
|
|
23150
|
+
}
|
|
23151
|
+
if (isEmpty(leftValue)) return 1;
|
|
23152
|
+
if (isEmpty(rightValue)) return -1;
|
|
23153
|
+
const compared = compareValues2(leftValue, rightValue);
|
|
23154
|
+
return compared === 0 ? left.index - right.index : compared * multiplier;
|
|
23155
|
+
}).map(({ row }) => row);
|
|
23156
|
+
return {
|
|
23157
|
+
...report,
|
|
23158
|
+
chartSort,
|
|
23159
|
+
rows
|
|
23160
|
+
};
|
|
23161
|
+
}
|
|
23162
|
+
function applyChartSort(report, chartSort = report.chartSort) {
|
|
23163
|
+
if (!chartSort?.field || !Array.isArray(report.rows)) return report;
|
|
23164
|
+
const validOption = getChartSortOptions(report).some(
|
|
23165
|
+
({ value }) => value === formatChartSortValue(chartSort)
|
|
23166
|
+
);
|
|
23167
|
+
if (!validOption) return report;
|
|
23168
|
+
if (chartSort.target === "series") {
|
|
23169
|
+
return applyTwoDimensionalPivotSeriesSort(report, chartSort);
|
|
23170
|
+
}
|
|
23171
|
+
return applyChartRowSort(report, chartSort);
|
|
23172
|
+
}
|
|
23173
|
+
|
|
23174
|
+
// src/utils/report.ts
|
|
23175
|
+
function extractAllReportValuesFromQuillInternalReport(reportInternal) {
|
|
23176
|
+
return {
|
|
23177
|
+
id: reportInternal.id,
|
|
23178
|
+
name: reportInternal.name,
|
|
23179
|
+
dashboardName: reportInternal.dashboardName,
|
|
23180
|
+
// section: reportInternal.section,
|
|
23181
|
+
pagination: reportInternal.pagination,
|
|
23182
|
+
sort: reportInternal.sort,
|
|
23183
|
+
rows: reportInternal.rows,
|
|
23184
|
+
columns: reportInternal.columns,
|
|
23185
|
+
chartType: reportInternal.chartType,
|
|
23186
|
+
dateField: reportInternal.dateField,
|
|
23187
|
+
pivot: reportInternal.pivot,
|
|
23188
|
+
xAxisLabel: reportInternal.xAxisLabel,
|
|
23189
|
+
xAxisField: reportInternal.xAxisField,
|
|
23190
|
+
xAxisFormat: reportInternal.xAxisFormat,
|
|
23191
|
+
yAxisFields: reportInternal.yAxisFields,
|
|
23192
|
+
order: reportInternal.order,
|
|
23193
|
+
compareRows: reportInternal.compareRows,
|
|
23194
|
+
filtersApplied: reportInternal.filtersApplied,
|
|
23195
|
+
queryString: reportInternal.queryString,
|
|
23196
|
+
rowCount: reportInternal.rowCount,
|
|
23197
|
+
template: reportInternal.template,
|
|
23198
|
+
referenceLineYValues: reportInternal.referenceLineYValues,
|
|
23199
|
+
referenceLines: reportInternal.referenceLines,
|
|
23200
|
+
includeCustomFields: reportInternal.includeCustomFields,
|
|
23201
|
+
columnsWithCustomFields: reportInternal.columnsWithCustomFields,
|
|
23202
|
+
pivotRows: reportInternal.pivotRows,
|
|
23203
|
+
pivotColumns: reportInternal.pivotColumns,
|
|
23204
|
+
pivotRowCount: reportInternal.pivotRowCount,
|
|
23205
|
+
filterMap: reportInternal.filterMap,
|
|
23206
|
+
showLegend: reportInternal.showLegend,
|
|
23207
|
+
chartSort: reportInternal.chartSort
|
|
23208
|
+
};
|
|
23209
|
+
}
|
|
23210
|
+
async function fetchReportRows({
|
|
23211
|
+
reportId,
|
|
23212
|
+
client,
|
|
23213
|
+
tenants,
|
|
23214
|
+
filters = [],
|
|
23215
|
+
getToken,
|
|
23216
|
+
abortSignal,
|
|
23217
|
+
additionalProcessing,
|
|
23218
|
+
overwriteCache = false
|
|
23219
|
+
}) {
|
|
23220
|
+
const startedAt = performance.now();
|
|
23221
|
+
profileDashboard("raw-report-rows-fetch-start", { reportId });
|
|
23222
|
+
const fetchResp = await quillFetch({
|
|
23223
|
+
client,
|
|
23224
|
+
task: "report",
|
|
23225
|
+
metadata: {
|
|
23226
|
+
reportId,
|
|
23227
|
+
clientId: client.id,
|
|
23228
|
+
databaseType: client.databaseType,
|
|
23229
|
+
filters: filters.map((filter) => ({ ...filter, options: void 0 })),
|
|
23230
|
+
useNewNodeSql: true,
|
|
23231
|
+
tenants,
|
|
23232
|
+
additionalProcessing,
|
|
23233
|
+
overwriteCache
|
|
23234
|
+
},
|
|
23235
|
+
abortSignal,
|
|
23236
|
+
getToken
|
|
23237
|
+
});
|
|
23238
|
+
const resp = await parseFetchResponse(client, "report", fetchResp, getToken);
|
|
23239
|
+
profileDashboard("raw-report-rows-fetch-finish", {
|
|
23240
|
+
reportId,
|
|
23241
|
+
elapsedMs: Math.round(performance.now() - startedAt),
|
|
23242
|
+
rowCount: resp.rows?.length ?? 0
|
|
23243
|
+
});
|
|
23244
|
+
if (client.databaseType?.toLowerCase() === "bigquery") {
|
|
23245
|
+
parseValueFromBigQueryDates(resp.rows, resp.fields);
|
|
23246
|
+
}
|
|
23247
|
+
return {
|
|
23248
|
+
rows: resp.rows || [],
|
|
23249
|
+
rowCount: resp.rowCount || 0,
|
|
23250
|
+
columns: resp.columns || [],
|
|
23251
|
+
fields: resp.fields || []
|
|
23252
|
+
};
|
|
23253
|
+
}
|
|
23254
|
+
async function fetchReport({
|
|
23255
|
+
reportId,
|
|
23256
|
+
client,
|
|
23257
|
+
tenants,
|
|
23258
|
+
flags,
|
|
23259
|
+
useReportTask = true,
|
|
23260
|
+
filters = [],
|
|
23261
|
+
additionalProcessing,
|
|
23262
|
+
dateBucket,
|
|
23263
|
+
customFields,
|
|
23264
|
+
rowsOnly,
|
|
23265
|
+
rowCountOnly,
|
|
23266
|
+
abortSignal,
|
|
22448
23267
|
getToken,
|
|
22449
23268
|
eventTracking,
|
|
22450
23269
|
usePivotTask = false,
|
|
@@ -22457,8 +23276,16 @@ async function fetchReport({
|
|
|
22457
23276
|
}) {
|
|
22458
23277
|
let reportInfo = void 0;
|
|
22459
23278
|
let errorMessage = void 0;
|
|
23279
|
+
const startedAt = performance.now();
|
|
22460
23280
|
try {
|
|
22461
23281
|
const task = usePivotTask ? "pivot-template" : useReportTask ? "report" : "item";
|
|
23282
|
+
profileDashboard("fetch-report-start", {
|
|
23283
|
+
reportId: reportId ?? null,
|
|
23284
|
+
task,
|
|
23285
|
+
usePivotTask,
|
|
23286
|
+
skipPivotFetch: skipPivotFetch ?? null,
|
|
23287
|
+
shareRequest
|
|
23288
|
+
});
|
|
22462
23289
|
let pivotForRequest = pivot ?? void 0;
|
|
22463
23290
|
let reportBuilderStateForRequest = reportBuilderState ?? void 0;
|
|
22464
23291
|
if (usePivotTask && (pivotForRequest != null || reportBuilderStateForRequest?.pivot != null)) {
|
|
@@ -22501,6 +23328,16 @@ async function fetchReport({
|
|
|
22501
23328
|
getToken
|
|
22502
23329
|
});
|
|
22503
23330
|
const resp = await parseFetchResponse(client, task, fetchResp, getToken);
|
|
23331
|
+
profileDashboard("fetch-report-response", {
|
|
23332
|
+
reportId: reportId ?? null,
|
|
23333
|
+
task,
|
|
23334
|
+
elapsedMs: Math.round(performance.now() - startedAt),
|
|
23335
|
+
hasRows: !!resp?.rows,
|
|
23336
|
+
rowCount: resp?.rows?.length ?? 0,
|
|
23337
|
+
hasFields: !!resp?.fields,
|
|
23338
|
+
hasPivotRows: !!resp?.pivotRows,
|
|
23339
|
+
pivotRowCount: resp?.pivotRows?.length ?? 0
|
|
23340
|
+
});
|
|
22504
23341
|
reportInfo = await processReportResponse({
|
|
22505
23342
|
resp,
|
|
22506
23343
|
client,
|
|
@@ -22516,6 +23353,13 @@ async function fetchReport({
|
|
|
22516
23353
|
skipPivotFetch: skipPivotFetch ?? !usePivotTask,
|
|
22517
23354
|
overwriteCache
|
|
22518
23355
|
});
|
|
23356
|
+
profileDashboard("fetch-report-processed", {
|
|
23357
|
+
reportId: reportId ?? null,
|
|
23358
|
+
task,
|
|
23359
|
+
elapsedMs: Math.round(performance.now() - startedAt),
|
|
23360
|
+
rowCount: reportInfo.rows?.length ?? 0,
|
|
23361
|
+
pivotRowCount: reportInfo.pivotRows?.length ?? 0
|
|
23362
|
+
});
|
|
22519
23363
|
} catch (error) {
|
|
22520
23364
|
if (error instanceof Error && error.name === "AbortError") {
|
|
22521
23365
|
throw error;
|
|
@@ -22568,6 +23412,15 @@ async function processReportResponse({
|
|
|
22568
23412
|
overwriteCache
|
|
22569
23413
|
}) {
|
|
22570
23414
|
const shouldSkipPivotFetch = skipPivotFetch || !!resp?.pivotRows && !!resp?.fields;
|
|
23415
|
+
profileDashboard("process-report-pivot-decision", {
|
|
23416
|
+
reportId: resp?._id ?? resp?.id ?? null,
|
|
23417
|
+
requestedSkipPivotFetch: skipPivotFetch,
|
|
23418
|
+
hasPivot: !!resp?.pivot,
|
|
23419
|
+
hasRows: !!resp?.rows,
|
|
23420
|
+
hasFields: !!resp?.fields,
|
|
23421
|
+
hasPivotRows: !!resp?.pivotRows,
|
|
23422
|
+
shouldSkipPivotFetch
|
|
23423
|
+
});
|
|
22571
23424
|
const dashboardItem = {
|
|
22572
23425
|
...resp,
|
|
22573
23426
|
filtersApplied: filters?.filter(
|
|
@@ -22814,6 +23667,51 @@ function formattedPivotRowsAndColumns(report, dashboardFilters = [], options = {
|
|
|
22814
23667
|
rowCount: report.chartType === "table" ? report.pivotRowCount ?? report.rowCount : rows ? rows.length : 0
|
|
22815
23668
|
};
|
|
22816
23669
|
}
|
|
23670
|
+
function hasPreformattedDateBucketLabels(report) {
|
|
23671
|
+
const pivot = report.pivot;
|
|
23672
|
+
if (!pivot?.dateBucket) return false;
|
|
23673
|
+
if (report.chartType?.toLowerCase() === "table") return false;
|
|
23674
|
+
return report.xAxisField?.trim() === pivot.rowField?.trim();
|
|
23675
|
+
}
|
|
23676
|
+
function prepareStaticChartReport(report, { removePagination }) {
|
|
23677
|
+
const config = report.pivot ? {
|
|
23678
|
+
...report,
|
|
23679
|
+
...formattedPivotRowsAndColumns(report, [], { formatRows: false })
|
|
23680
|
+
} : { ...report };
|
|
23681
|
+
if (removePagination) {
|
|
23682
|
+
config.pagination = void 0;
|
|
23683
|
+
}
|
|
23684
|
+
if (hasPreformattedDateBucketLabels(config)) {
|
|
23685
|
+
config.xAxisFormat = "string";
|
|
23686
|
+
}
|
|
23687
|
+
return applyChartSort(config);
|
|
23688
|
+
}
|
|
23689
|
+
function getReportSeriesFields(report) {
|
|
23690
|
+
const drilldownFields = report?.pivot?.columnFilter?.options.map(({ value }) => value) ?? [];
|
|
23691
|
+
if (drilldownFields.length > 0) {
|
|
23692
|
+
return drilldownFields;
|
|
23693
|
+
}
|
|
23694
|
+
if (report?.pivot?.columnValues?.length) {
|
|
23695
|
+
return report.pivot.columnValues;
|
|
23696
|
+
}
|
|
23697
|
+
return report?.yAxisFields?.map(({ field }) => field) ?? [];
|
|
23698
|
+
}
|
|
23699
|
+
function resolveReportColorMap(report, colors, overrides = {}) {
|
|
23700
|
+
const seriesColors = buildSeriesColorMap(
|
|
23701
|
+
getReportSeriesFields(report),
|
|
23702
|
+
colors
|
|
23703
|
+
);
|
|
23704
|
+
const generated = Object.fromEntries(
|
|
23705
|
+
Object.entries(seriesColors).map(([field, color]) => [
|
|
23706
|
+
field,
|
|
23707
|
+
{ primary: color, comparison: color }
|
|
23708
|
+
])
|
|
23709
|
+
);
|
|
23710
|
+
return {
|
|
23711
|
+
...generated,
|
|
23712
|
+
...overrides
|
|
23713
|
+
};
|
|
23714
|
+
}
|
|
22817
23715
|
function convertInternalReportToReport(report, dashboardFilters, eventTracking, initiator) {
|
|
22818
23716
|
try {
|
|
22819
23717
|
if (!report) {
|
|
@@ -22837,7 +23735,7 @@ function convertInternalReportToReport(report, dashboardFilters, eventTracking,
|
|
|
22837
23735
|
...pivotFormatted
|
|
22838
23736
|
};
|
|
22839
23737
|
pivotReport.formattedBaseRows = formattedBaseRows;
|
|
22840
|
-
return pivotReport;
|
|
23738
|
+
return applyChartSort(pivotReport);
|
|
22841
23739
|
}
|
|
22842
23740
|
let rows = report.rows;
|
|
22843
23741
|
if (report.chartType === "metric") {
|
|
@@ -22849,11 +23747,11 @@ function convertInternalReportToReport(report, dashboardFilters, eventTracking,
|
|
|
22849
23747
|
} else if (report.chartType === "table" && initiator !== "useDashboardReport") {
|
|
22850
23748
|
rows = formatRowsFromReport(report);
|
|
22851
23749
|
}
|
|
22852
|
-
return {
|
|
23750
|
+
return applyChartSort({
|
|
22853
23751
|
...extractAllReportValuesFromQuillInternalReport(formattedReport),
|
|
22854
23752
|
rows,
|
|
22855
23753
|
yAxisFields: shouldPreserveYAxisFields ? report.yAxisFields : getYAxisFields(report, dashboardFilters)
|
|
22856
|
-
};
|
|
23754
|
+
});
|
|
22857
23755
|
} catch (error) {
|
|
22858
23756
|
eventTracking?.logError?.({
|
|
22859
23757
|
type: "bug",
|
|
@@ -25850,8 +26748,14 @@ var reportsReducer = (state = {}, action) => {
|
|
|
25850
26748
|
};
|
|
25851
26749
|
var reportsLoadingStateReducer = (state = {}, action) => {
|
|
25852
26750
|
switch (action.type) {
|
|
25853
|
-
case "SET_REPORT_LOADING":
|
|
26751
|
+
case "SET_REPORT_LOADING": {
|
|
26752
|
+
profileDashboard("report-loading-state", {
|
|
26753
|
+
reportId: action.id,
|
|
26754
|
+
previous: state[action.id] ?? false,
|
|
26755
|
+
next: action.data
|
|
26756
|
+
});
|
|
25854
26757
|
return { ...state, [action.id]: action.data };
|
|
26758
|
+
}
|
|
25855
26759
|
default:
|
|
25856
26760
|
return state;
|
|
25857
26761
|
}
|
|
@@ -25867,6 +26771,11 @@ var ReportsContext = createContext({
|
|
|
25867
26771
|
var customReportFiltersReducer = (state, action) => {
|
|
25868
26772
|
switch (action.type) {
|
|
25869
26773
|
case "ADD_CUSTOM_REPORT_FILTERS":
|
|
26774
|
+
profileDashboard("custom-report-filters-add", {
|
|
26775
|
+
reportId: action.reportId,
|
|
26776
|
+
filterCount: action.data?.length ?? 0,
|
|
26777
|
+
removesEntry: !action.data
|
|
26778
|
+
});
|
|
25870
26779
|
if (!action.data) {
|
|
25871
26780
|
const newState = { ...state };
|
|
25872
26781
|
delete newState[action.reportId];
|
|
@@ -26142,7 +27051,14 @@ var ContextProvider = ({
|
|
|
26142
27051
|
const mappedTenantsRequests = useRef(/* @__PURE__ */ new Set());
|
|
26143
27052
|
const loadDashboardProcessId = useRef({});
|
|
26144
27053
|
useEffect(() => {
|
|
27054
|
+
profileDashboard("custom-report-filters-changed", {
|
|
27055
|
+
reportIds: Object.keys(customReportFilters),
|
|
27056
|
+
currentLoadedFlag: customFiltersLoaded
|
|
27057
|
+
});
|
|
26145
27058
|
if (Object.keys(customReportFilters).length) {
|
|
27059
|
+
profileDashboard("custom-filters-loaded-set", {
|
|
27060
|
+
next: true
|
|
27061
|
+
});
|
|
26146
27062
|
setCustomFiltersLoaded(true);
|
|
26147
27063
|
}
|
|
26148
27064
|
}, [customReportFilters]);
|
|
@@ -27727,6 +28643,7 @@ init_dataFetcher();
|
|
|
27727
28643
|
init_tableProcessing();
|
|
27728
28644
|
init_paginationProcessing();
|
|
27729
28645
|
init_inMemoryPivotEngine();
|
|
28646
|
+
init_pivotConstructor();
|
|
27730
28647
|
|
|
27731
28648
|
// src/utils/dashboardPagination.ts
|
|
27732
28649
|
function isDashboardPivotTable(report) {
|
|
@@ -28441,6 +29358,7 @@ var useDashboard = (dashboardName, config) => {
|
|
|
28441
29358
|
const { getCacheCab } = useContext(CacheCabContext);
|
|
28442
29359
|
const reportRequestIds = useRef2({});
|
|
28443
29360
|
const reportFetchAbortController = useRef2(null);
|
|
29361
|
+
const dashboardFetchGeneration = useRef2(0);
|
|
28444
29362
|
const lastDashboardName = useRef2(null);
|
|
28445
29363
|
const pendingNameChangeReload = useRef2(false);
|
|
28446
29364
|
const [loadedDashes, setLoadedDashes] = useState2([]);
|
|
@@ -28450,12 +29368,6 @@ var useDashboard = (dashboardName, config) => {
|
|
|
28450
29368
|
() => getCacheCab(config?.cacheType),
|
|
28451
29369
|
[getCacheCab, config?.cacheType]
|
|
28452
29370
|
);
|
|
28453
|
-
useEffect2(() => {
|
|
28454
|
-
return () => {
|
|
28455
|
-
reportFetchAbortController.current?.abort();
|
|
28456
|
-
reportFetchAbortController.current = null;
|
|
28457
|
-
};
|
|
28458
|
-
}, [dashboardName]);
|
|
28459
29371
|
useEffect2(() => {
|
|
28460
29372
|
const nameChanged = dashboardName !== lastDashboardName.current;
|
|
28461
29373
|
if (nameChanged) {
|
|
@@ -28518,15 +29430,42 @@ var useDashboard = (dashboardName, config) => {
|
|
|
28518
29430
|
);
|
|
28519
29431
|
}, [dashboardFilters]);
|
|
28520
29432
|
useEffect2(() => {
|
|
29433
|
+
profileDashboard("initial-fetch-effect", {
|
|
29434
|
+
dashboardName,
|
|
29435
|
+
fetchedInitialReports: fetchedInitialReports.current,
|
|
29436
|
+
hasData: !!data,
|
|
29437
|
+
dashboardFiltersReady: dashboardFilters !== null,
|
|
29438
|
+
customFiltersLoaded,
|
|
29439
|
+
customReportFilterIds: Object.keys(customReportFilters)
|
|
29440
|
+
});
|
|
28521
29441
|
if (!fetchedInitialReports.current && data && dashboardFilters !== null) {
|
|
28522
29442
|
fetchedInitialReports.current = true;
|
|
28523
|
-
fetchReports(
|
|
29443
|
+
void fetchReports(
|
|
29444
|
+
[],
|
|
29445
|
+
dashboardFilters ?? [],
|
|
29446
|
+
config?.pageSize,
|
|
29447
|
+
false,
|
|
29448
|
+
"initial-effect"
|
|
29449
|
+
);
|
|
28524
29450
|
}
|
|
28525
29451
|
}, [fetchedInitialReports, data, dashboardFilters, customFiltersLoaded]);
|
|
28526
29452
|
useEffect2(() => {
|
|
29453
|
+
profileDashboard("custom-filter-fetch-effect", {
|
|
29454
|
+
dashboardName,
|
|
29455
|
+
customFiltersLoaded,
|
|
29456
|
+
hasData: !!data,
|
|
29457
|
+
dashboardFiltersReady: dashboardFilters !== null,
|
|
29458
|
+
customReportFilterIds: Object.keys(customReportFilters)
|
|
29459
|
+
});
|
|
28527
29460
|
if (customFiltersLoaded && data && dashboardFilters !== null) {
|
|
28528
29461
|
fetchedInitialReports.current = true;
|
|
28529
|
-
fetchReports(
|
|
29462
|
+
void fetchReports(
|
|
29463
|
+
[],
|
|
29464
|
+
dashboardFilters ?? [],
|
|
29465
|
+
config?.pageSize,
|
|
29466
|
+
false,
|
|
29467
|
+
"custom-filters-effect"
|
|
29468
|
+
);
|
|
28530
29469
|
}
|
|
28531
29470
|
}, [customFiltersLoaded]);
|
|
28532
29471
|
const applyDashboardFilters = (filtersToUpdate) => {
|
|
@@ -28637,11 +29576,23 @@ var useDashboard = (dashboardName, config) => {
|
|
|
28637
29576
|
const customFilters = filters2.filter(isFilter2);
|
|
28638
29577
|
const newCustomFilters = applyCustomFilters(customFilters);
|
|
28639
29578
|
const newDashboardFilters = applyDashboardFilters(dashboardFilters2);
|
|
28640
|
-
fetchReports(
|
|
29579
|
+
void fetchReports(
|
|
29580
|
+
newCustomFilters,
|
|
29581
|
+
newDashboardFilters,
|
|
29582
|
+
void 0,
|
|
29583
|
+
false,
|
|
29584
|
+
"apply-filters"
|
|
29585
|
+
);
|
|
28641
29586
|
};
|
|
28642
29587
|
const forceCacheRefresh = () => {
|
|
28643
29588
|
if (!cacheEnabled) return;
|
|
28644
|
-
fetchReports(
|
|
29589
|
+
void fetchReports(
|
|
29590
|
+
[],
|
|
29591
|
+
dashboardFilters ?? [],
|
|
29592
|
+
config?.pageSize,
|
|
29593
|
+
true,
|
|
29594
|
+
"force-cache-refresh"
|
|
29595
|
+
);
|
|
28645
29596
|
};
|
|
28646
29597
|
const primeReportSource = async (reportId) => {
|
|
28647
29598
|
const reportInfo = allReportsById[reportId];
|
|
@@ -28683,9 +29634,36 @@ var useDashboard = (dashboardName, config) => {
|
|
|
28683
29634
|
}
|
|
28684
29635
|
);
|
|
28685
29636
|
};
|
|
28686
|
-
const fetchReports = async (customFilters, dashboardFilters2, pageSize, forceCacheToRefresh = false) => {
|
|
28687
|
-
if (!client || !sections)
|
|
28688
|
-
|
|
29637
|
+
const fetchReports = async (customFilters, dashboardFilters2, pageSize, forceCacheToRefresh = false, reason = "unknown") => {
|
|
29638
|
+
if (!client || !sections) {
|
|
29639
|
+
profileDashboard("dashboard-fetch-skipped", {
|
|
29640
|
+
dashboardName,
|
|
29641
|
+
reason,
|
|
29642
|
+
hasClient: !!client,
|
|
29643
|
+
hasSections: !!sections
|
|
29644
|
+
});
|
|
29645
|
+
return;
|
|
29646
|
+
}
|
|
29647
|
+
const generation = dashboardFetchGeneration.current + 1;
|
|
29648
|
+
dashboardFetchGeneration.current = generation;
|
|
29649
|
+
const previousController = reportFetchAbortController.current;
|
|
29650
|
+
profileDashboard("dashboard-fetch-start", {
|
|
29651
|
+
dashboardName,
|
|
29652
|
+
generation,
|
|
29653
|
+
reason,
|
|
29654
|
+
reportCount: Object.values(sections).flat().length,
|
|
29655
|
+
customFilterCount: customFilters.length,
|
|
29656
|
+
customReportFilterIds: Object.keys(customReportFilters),
|
|
29657
|
+
abortsPreviousGeneration: !!previousController
|
|
29658
|
+
});
|
|
29659
|
+
if (previousController) {
|
|
29660
|
+
profileDashboard("dashboard-fetch-abort-previous", {
|
|
29661
|
+
dashboardName,
|
|
29662
|
+
generation,
|
|
29663
|
+
reason
|
|
29664
|
+
});
|
|
29665
|
+
previousController.abort();
|
|
29666
|
+
}
|
|
28689
29667
|
const abortController = new AbortController();
|
|
28690
29668
|
reportFetchAbortController.current = abortController;
|
|
28691
29669
|
const abortSignal = abortController.signal;
|
|
@@ -28697,6 +29675,32 @@ var useDashboard = (dashboardName, config) => {
|
|
|
28697
29675
|
const reportId = reportInfo.id;
|
|
28698
29676
|
const requestId = (reportRequestIds.current[reportId] ?? 0) + 1;
|
|
28699
29677
|
reportRequestIds.current[reportId] = requestId;
|
|
29678
|
+
const reportStartedAt = performance.now();
|
|
29679
|
+
profileDashboard("report-fetch-start", {
|
|
29680
|
+
dashboardName,
|
|
29681
|
+
generation,
|
|
29682
|
+
reason,
|
|
29683
|
+
reportId,
|
|
29684
|
+
requestId,
|
|
29685
|
+
chartType: reportInfo.chartType,
|
|
29686
|
+
pivot: !!reportInfo.pivot,
|
|
29687
|
+
customFilterCount: customReportFilters[reportId]?.length ?? 0
|
|
29688
|
+
});
|
|
29689
|
+
abortSignal.addEventListener(
|
|
29690
|
+
"abort",
|
|
29691
|
+
() => {
|
|
29692
|
+
profileDashboard("report-fetch-aborted", {
|
|
29693
|
+
dashboardName,
|
|
29694
|
+
generation,
|
|
29695
|
+
reason,
|
|
29696
|
+
reportId,
|
|
29697
|
+
requestId,
|
|
29698
|
+
elapsedMs: Math.round(performance.now() - reportStartedAt),
|
|
29699
|
+
currentRequestId: reportRequestIds.current[reportId]
|
|
29700
|
+
});
|
|
29701
|
+
},
|
|
29702
|
+
{ once: true }
|
|
29703
|
+
);
|
|
28700
29704
|
reportsLoadingStateDispatch({
|
|
28701
29705
|
type: "SET_REPORT_LOADING",
|
|
28702
29706
|
id: reportId,
|
|
@@ -28923,20 +29927,65 @@ var useDashboard = (dashboardName, config) => {
|
|
|
28923
29927
|
additionalProcessing: reportAdditionalProcessing
|
|
28924
29928
|
}
|
|
28925
29929
|
];
|
|
28926
|
-
const fetchDashboardReport = () =>
|
|
28927
|
-
|
|
28928
|
-
|
|
28929
|
-
|
|
28930
|
-
|
|
28931
|
-
|
|
28932
|
-
|
|
28933
|
-
|
|
28934
|
-
|
|
28935
|
-
|
|
28936
|
-
|
|
28937
|
-
|
|
28938
|
-
|
|
28939
|
-
|
|
29930
|
+
const fetchDashboardReport = async () => {
|
|
29931
|
+
if (usePivotTask && reportInfo.pivot) {
|
|
29932
|
+
try {
|
|
29933
|
+
const dateFilter = allFilters.find(
|
|
29934
|
+
(filter) => filter.filterType === "date_range" /* Date */ || filter.operator === "BETWEEN"
|
|
29935
|
+
);
|
|
29936
|
+
const pivotData = await generatePivotWithSQL({
|
|
29937
|
+
pivot: reportInfo.pivot,
|
|
29938
|
+
report: reportInfo,
|
|
29939
|
+
client,
|
|
29940
|
+
dateBucket: reportInfo.pivot.dateBucket,
|
|
29941
|
+
dateFilter,
|
|
29942
|
+
dashboardName,
|
|
29943
|
+
dashboardFilters: allFilters,
|
|
29944
|
+
tenants,
|
|
29945
|
+
additionalProcessing: reportAdditionalProcessing,
|
|
29946
|
+
getToken,
|
|
29947
|
+
overwriteCache: forceCacheToRefresh,
|
|
29948
|
+
abortSignal
|
|
29949
|
+
});
|
|
29950
|
+
return {
|
|
29951
|
+
report: {
|
|
29952
|
+
...reportInfo,
|
|
29953
|
+
rows: [],
|
|
29954
|
+
columnInternal: pivotData.columns,
|
|
29955
|
+
pivotRows: pivotData.rows,
|
|
29956
|
+
pivotColumns: pivotData.columns,
|
|
29957
|
+
pivotRowCount: pivotData.rowCount,
|
|
29958
|
+
pivotQuery: pivotData.pivotQuery,
|
|
29959
|
+
comparisonPivotQuery: pivotData.comparisonPivotQuery
|
|
29960
|
+
},
|
|
29961
|
+
error: void 0
|
|
29962
|
+
};
|
|
29963
|
+
} catch (error2) {
|
|
29964
|
+
if (abortSignal.aborted || error2 instanceof Error && error2.name === "AbortError") {
|
|
29965
|
+
const abortError = new Error("Dashboard report fetch aborted");
|
|
29966
|
+
abortError.name = "AbortError";
|
|
29967
|
+
throw abortError;
|
|
29968
|
+
}
|
|
29969
|
+
return {
|
|
29970
|
+
report: reportInfo,
|
|
29971
|
+
error: error2 instanceof Error ? error2.message : String(error2 ?? "Failed to fetch pivot report")
|
|
29972
|
+
};
|
|
29973
|
+
}
|
|
29974
|
+
}
|
|
29975
|
+
return fetchReport({
|
|
29976
|
+
reportId,
|
|
29977
|
+
client,
|
|
29978
|
+
tenants,
|
|
29979
|
+
flags,
|
|
29980
|
+
additionalProcessing: reportAdditionalProcessing,
|
|
29981
|
+
filters: allFilters,
|
|
29982
|
+
getToken,
|
|
29983
|
+
eventTracking,
|
|
29984
|
+
abortSignal,
|
|
29985
|
+
overwriteCache: forceCacheToRefresh,
|
|
29986
|
+
shareRequest: !forceCacheToRefresh
|
|
29987
|
+
});
|
|
29988
|
+
};
|
|
28940
29989
|
const result = forceCacheToRefresh ? await fetchDashboardReport() : await queryClient.fetchQuery({
|
|
28941
29990
|
queryKey,
|
|
28942
29991
|
queryFn: fetchDashboardReport,
|
|
@@ -29015,10 +30064,25 @@ var useDashboard = (dashboardName, config) => {
|
|
|
29015
30064
|
return report;
|
|
29016
30065
|
})
|
|
29017
30066
|
).catch((error) => {
|
|
30067
|
+
profileDashboard("dashboard-fetch-rejected", {
|
|
30068
|
+
dashboardName,
|
|
30069
|
+
generation,
|
|
30070
|
+
reason,
|
|
30071
|
+
errorName: error instanceof Error ? error.name : typeof error,
|
|
30072
|
+
errorMessage: error instanceof Error ? error.message : String(error)
|
|
30073
|
+
});
|
|
29018
30074
|
if (!(error instanceof Error) || error.name !== "AbortError") {
|
|
29019
30075
|
throw error;
|
|
29020
30076
|
}
|
|
29021
30077
|
});
|
|
30078
|
+
profileDashboard("dashboard-fetch-settled", {
|
|
30079
|
+
dashboardName,
|
|
30080
|
+
generation,
|
|
30081
|
+
reason,
|
|
30082
|
+
elapsedMs: Date.now() - fetchStartTime,
|
|
30083
|
+
aborted: abortSignal.aborted,
|
|
30084
|
+
latestGeneration: dashboardFetchGeneration.current
|
|
30085
|
+
});
|
|
29022
30086
|
if (!loadedDashes.includes(dashboardName) || !cacheEnabled || forceCacheToRefresh) {
|
|
29023
30087
|
setLoadedDashes(
|
|
29024
30088
|
(prev) => prev.includes(dashboardName) ? prev : [...prev, dashboardName]
|
|
@@ -29747,636 +30811,273 @@ function QuillCustomDocumentComponent({
|
|
|
29747
30811
|
/* @__PURE__ */ jsx2("tr", { children: /* @__PURE__ */ jsx2("td", { colSpan: report.columns.length, children: "\xA0" }) }),
|
|
29748
30812
|
/* @__PURE__ */ jsx2("tr", { children: /* @__PURE__ */ jsxs(
|
|
29749
30813
|
"td",
|
|
29750
|
-
{
|
|
29751
|
-
style: {
|
|
29752
|
-
fontSize: "8px",
|
|
29753
|
-
textAlign: "left",
|
|
29754
|
-
whiteSpace: "nowrap",
|
|
29755
|
-
overflow: "hidden",
|
|
29756
|
-
textOverflow: "ellipsis",
|
|
29757
|
-
width: "100%",
|
|
29758
|
-
margin: 0
|
|
29759
|
-
},
|
|
29760
|
-
colSpan: report.columns.length,
|
|
29761
|
-
children: [
|
|
29762
|
-
"Page ",
|
|
29763
|
-
pageNumber,
|
|
29764
|
-
" of ",
|
|
29765
|
-
numberOfPages
|
|
29766
|
-
]
|
|
29767
|
-
}
|
|
29768
|
-
) })
|
|
29769
|
-
] })
|
|
29770
|
-
]
|
|
29771
|
-
}
|
|
29772
|
-
)
|
|
29773
|
-
}
|
|
29774
|
-
) })
|
|
29775
|
-
}
|
|
29776
|
-
);
|
|
29777
|
-
}
|
|
29778
|
-
|
|
29779
|
-
// src/Chart.tsx
|
|
29780
|
-
import { differenceInHours } from "date-fns";
|
|
29781
|
-
|
|
29782
|
-
// src/components/Chart/BarList.tsx
|
|
29783
|
-
init_valueFormatter();
|
|
29784
|
-
init_chart();
|
|
29785
|
-
import React2 from "react";
|
|
29786
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
29787
|
-
var getWidthsFromValues = (dataValues) => {
|
|
29788
|
-
let maxValue = -Infinity;
|
|
29789
|
-
dataValues.forEach((value) => {
|
|
29790
|
-
maxValue = Math.max(maxValue, value);
|
|
29791
|
-
});
|
|
29792
|
-
return dataValues.map((value) => {
|
|
29793
|
-
if (value === 0) return 0;
|
|
29794
|
-
return Math.max(value / maxValue * 100, 1);
|
|
29795
|
-
});
|
|
29796
|
-
};
|
|
29797
|
-
function getColors(colorMap, xAxisField, colors) {
|
|
29798
|
-
if (colorMap && colorMap[xAxisField] && colorMap[xAxisField]["primary"]) {
|
|
29799
|
-
return colorMap[xAxisField]["primary"];
|
|
29800
|
-
} else if (colors) {
|
|
29801
|
-
return hexToRgbaWith10PercentAlpha(colors[0]);
|
|
29802
|
-
}
|
|
29803
|
-
return hexToRgbaWith10PercentAlpha(void 0);
|
|
29804
|
-
}
|
|
29805
|
-
var BarList = React2.forwardRef((props, ref) => {
|
|
29806
|
-
const {
|
|
29807
|
-
data = [],
|
|
29808
|
-
yAxisFields,
|
|
29809
|
-
xAxisField,
|
|
29810
|
-
xAxisFormat,
|
|
29811
|
-
colors,
|
|
29812
|
-
colorMap = {},
|
|
29813
|
-
// valueFormatter = (value: any) => value,valueFormatter
|
|
29814
|
-
showAnimation = true,
|
|
29815
|
-
className,
|
|
29816
|
-
containerStyle,
|
|
29817
|
-
theme,
|
|
29818
|
-
onClickChartElement,
|
|
29819
|
-
scrollable,
|
|
29820
|
-
...other
|
|
29821
|
-
} = props;
|
|
29822
|
-
const widths = getWidthsFromValues(
|
|
29823
|
-
data.map((item) => {
|
|
29824
|
-
if (yAxisFields && yAxisFields[0] && yAxisFields[0].field) {
|
|
29825
|
-
return item[yAxisFields[0].field];
|
|
29826
|
-
}
|
|
29827
|
-
return 0;
|
|
29828
|
-
})
|
|
29829
|
-
);
|
|
29830
|
-
const NUM_TO_SHOW = scrollable ? 500 : 5;
|
|
29831
|
-
if (!data || data.length === 0) {
|
|
29832
|
-
return /* @__PURE__ */ jsx3(
|
|
29833
|
-
"div",
|
|
29834
|
-
{
|
|
29835
|
-
style: {
|
|
29836
|
-
display: "flex",
|
|
29837
|
-
flex: "1 0 auto",
|
|
29838
|
-
// height: '100%',
|
|
29839
|
-
margin: "auto",
|
|
29840
|
-
justifyContent: "center",
|
|
29841
|
-
alignItems: "center",
|
|
29842
|
-
fontSize: 13,
|
|
29843
|
-
fontFamily: theme?.fontFamily,
|
|
29844
|
-
color: theme.secondaryTextColor,
|
|
29845
|
-
...containerStyle
|
|
29846
|
-
},
|
|
29847
|
-
className,
|
|
29848
|
-
children: "No results"
|
|
29849
|
-
}
|
|
29850
|
-
);
|
|
29851
|
-
}
|
|
29852
|
-
return /* @__PURE__ */ jsx3(
|
|
29853
|
-
"div",
|
|
29854
|
-
{
|
|
29855
|
-
ref,
|
|
29856
|
-
className,
|
|
29857
|
-
style: {
|
|
29858
|
-
// width: '100%',
|
|
29859
|
-
boxSizing: "content-box",
|
|
29860
|
-
height: "100%",
|
|
29861
|
-
// marginLeft: 25,
|
|
29862
|
-
// background: 'red',
|
|
29863
|
-
// paddingRight: 25,
|
|
29864
|
-
// paddingRight: 25,
|
|
29865
|
-
...containerStyle
|
|
29866
|
-
},
|
|
29867
|
-
...other,
|
|
29868
|
-
children: /* @__PURE__ */ jsxs2(
|
|
29869
|
-
"div",
|
|
29870
|
-
{
|
|
29871
|
-
style: {
|
|
29872
|
-
display: "flex",
|
|
29873
|
-
justifyContent: "space-between",
|
|
29874
|
-
boxSizing: "content-box",
|
|
29875
|
-
overflow: scrollable ? "scroll" : "hidden",
|
|
29876
|
-
width: "100%",
|
|
29877
|
-
height: "100%"
|
|
29878
|
-
},
|
|
29879
|
-
children: [
|
|
29880
|
-
/* @__PURE__ */ jsxs2(
|
|
29881
|
-
"div",
|
|
29882
|
-
{
|
|
29883
|
-
style: {
|
|
29884
|
-
width: "100%",
|
|
29885
|
-
boxSizing: "content-box",
|
|
29886
|
-
height: "100%",
|
|
29887
|
-
position: "relative",
|
|
29888
|
-
paddingRight: 25
|
|
29889
|
-
},
|
|
29890
|
-
children: [
|
|
29891
|
-
data.slice(0, NUM_TO_SHOW).map((item, idx) => {
|
|
29892
|
-
return /* @__PURE__ */ jsx3(
|
|
29893
|
-
"div",
|
|
29894
|
-
{
|
|
29895
|
-
style: {
|
|
29896
|
-
width: `${widths[idx]}%`,
|
|
29897
|
-
transition: showAnimation ? "all 2s" : "",
|
|
29898
|
-
boxSizing: "content-box",
|
|
29899
|
-
backgroundColor: getColors(colorMap, xAxisField, colors),
|
|
29900
|
-
display: "flex",
|
|
29901
|
-
alignItems: "center",
|
|
29902
|
-
height: "36px",
|
|
29903
|
-
marginBottom: "8px",
|
|
29904
|
-
borderRadius: "4px"
|
|
29905
|
-
},
|
|
29906
|
-
onClick: () => onClickChartElement?.(item),
|
|
29907
|
-
children: /* @__PURE__ */ jsx3(
|
|
29908
|
-
"div",
|
|
29909
|
-
{
|
|
29910
|
-
style: {
|
|
29911
|
-
boxSizing: "content-box",
|
|
29912
|
-
position: "absolute",
|
|
29913
|
-
maxWidth: "100%",
|
|
29914
|
-
display: "flex",
|
|
29915
|
-
marginLeft: "8px"
|
|
29916
|
-
},
|
|
29917
|
-
children: /* @__PURE__ */ jsx3(
|
|
29918
|
-
"p",
|
|
29919
|
-
{
|
|
29920
|
-
style: {
|
|
29921
|
-
color: theme?.chartLabelColor,
|
|
29922
|
-
boxSizing: "content-box",
|
|
29923
|
-
whiteSpace: "nowrap",
|
|
29924
|
-
overflow: "hidden",
|
|
29925
|
-
textOverflow: "ellipsis",
|
|
29926
|
-
fontFamily: theme?.chartLabelFontFamily || theme?.fontFamily,
|
|
29927
|
-
fontSize: theme?.fontSizeSmall || "14px"
|
|
29928
|
-
},
|
|
29929
|
-
children: valueFormatter({
|
|
29930
|
-
value: item[xAxisField] ?? item[`comparison_${xAxisField}`],
|
|
29931
|
-
field: xAxisField,
|
|
29932
|
-
// @ts-ignore
|
|
29933
|
-
fields: [{ field: xAxisField, format: xAxisFormat }]
|
|
29934
|
-
})
|
|
29935
|
-
}
|
|
29936
|
-
)
|
|
29937
|
-
}
|
|
29938
|
-
)
|
|
29939
|
-
},
|
|
29940
|
-
item[xAxisField] + "label" + idx
|
|
29941
|
-
);
|
|
29942
|
-
}),
|
|
29943
|
-
data.length > NUM_TO_SHOW && /* @__PURE__ */ jsxs2(
|
|
29944
|
-
"div",
|
|
29945
|
-
{
|
|
29946
|
-
style: {
|
|
29947
|
-
color: theme?.chartLabelColor,
|
|
29948
|
-
boxSizing: "content-box",
|
|
29949
|
-
fontFamily: theme?.chartLabelFontFamily || theme?.fontFamily,
|
|
29950
|
-
fontSize: theme?.fontSizeSmall || "14px"
|
|
29951
|
-
},
|
|
29952
|
-
children: [
|
|
29953
|
-
"...",
|
|
29954
|
-
data.length - NUM_TO_SHOW,
|
|
29955
|
-
" more"
|
|
29956
|
-
]
|
|
29957
|
-
}
|
|
29958
|
-
)
|
|
29959
|
-
]
|
|
29960
|
-
}
|
|
29961
|
-
),
|
|
29962
|
-
/* @__PURE__ */ jsx3(
|
|
29963
|
-
"div",
|
|
29964
|
-
{
|
|
29965
|
-
style: {
|
|
29966
|
-
boxSizing: "content-box",
|
|
29967
|
-
textAlign: "right",
|
|
29968
|
-
minWidth: "min-content",
|
|
29969
|
-
paddingLeft: 10
|
|
29970
|
-
},
|
|
29971
|
-
children: data.slice(0, NUM_TO_SHOW).map((item, idx) => /* @__PURE__ */ jsx3(
|
|
29972
|
-
"div",
|
|
29973
|
-
{
|
|
29974
|
-
style: {
|
|
29975
|
-
boxSizing: "content-box",
|
|
29976
|
-
display: "flex",
|
|
29977
|
-
alignItems: "center",
|
|
29978
|
-
justifyContent: "flex-end",
|
|
29979
|
-
marginBottom: idx === data.length - 1 ? 0 : "8px",
|
|
29980
|
-
height: "36px"
|
|
29981
|
-
},
|
|
29982
|
-
children: /* @__PURE__ */ jsx3(
|
|
29983
|
-
"p",
|
|
29984
|
-
{
|
|
29985
|
-
style: {
|
|
29986
|
-
color: theme?.chartLabelColor,
|
|
29987
|
-
boxSizing: "content-box",
|
|
29988
|
-
fontFamily: theme?.chartLabelFontFamily || theme?.fontFamily,
|
|
29989
|
-
whiteSpace: "nowrap",
|
|
29990
|
-
overflow: "hidden",
|
|
29991
|
-
textOverflow: "ellipsis",
|
|
29992
|
-
fontSize: theme?.fontSizeSmall || "14px"
|
|
29993
|
-
},
|
|
29994
|
-
children: valueFormatter({
|
|
29995
|
-
value: yAxisFields && yAxisFields[0] && item[yAxisFields[0].field] ? item[yAxisFields[0].field] : 0,
|
|
29996
|
-
field: yAxisFields && yAxisFields[0] && yAxisFields[0].field,
|
|
29997
|
-
fields: yAxisFields
|
|
29998
|
-
})
|
|
29999
|
-
}
|
|
30000
|
-
)
|
|
30001
|
-
},
|
|
30002
|
-
item[xAxisField] + "value" + idx
|
|
30003
|
-
))
|
|
30004
|
-
}
|
|
30005
|
-
)
|
|
30006
|
-
]
|
|
30007
|
-
}
|
|
30008
|
-
)
|
|
30009
|
-
}
|
|
30010
|
-
);
|
|
30011
|
-
});
|
|
30012
|
-
var BarList_default = BarList;
|
|
30013
|
-
|
|
30014
|
-
// src/components/Chart/PieChart.tsx
|
|
30015
|
-
import React4, { useMemo as useMemo4 } from "react";
|
|
30016
|
-
import { Legend, Pie, PieChart, ResponsiveContainer, Tooltip } from "recharts";
|
|
30017
|
-
|
|
30018
|
-
// src/utils/color.ts
|
|
30019
|
-
var DEFAULT_GRADIENT_COLORS = [
|
|
30020
|
-
"#4E80EE",
|
|
30021
|
-
// vivid indigo
|
|
30022
|
-
"#586FF4",
|
|
30023
|
-
"#6464FA",
|
|
30024
|
-
"#715AFE",
|
|
30025
|
-
"#8450FF",
|
|
30026
|
-
"#9B48FF",
|
|
30027
|
-
"#B33FFF",
|
|
30028
|
-
"#CA37F3",
|
|
30029
|
-
"#DE2FE1",
|
|
30030
|
-
"#F028CB",
|
|
30031
|
-
"#FF20B5"
|
|
30032
|
-
];
|
|
30033
|
-
function generateArrayFromColor(colors, length) {
|
|
30034
|
-
if (length <= 0) {
|
|
30035
|
-
return [];
|
|
30036
|
-
}
|
|
30037
|
-
if (typeof colors === "string") {
|
|
30038
|
-
const trimmedColor = colors.trim();
|
|
30039
|
-
return monochromaticInterpolation(
|
|
30040
|
-
trimmedColor.length > 0 ? trimmedColor : DEFAULT_GRADIENT_COLORS[0],
|
|
30041
|
-
length
|
|
30042
|
-
);
|
|
30043
|
-
}
|
|
30044
|
-
const normalizedColors = colors.filter((color) => typeof color === "string").map((color) => color.trim()).filter((color) => color.length > 0);
|
|
30045
|
-
const baseColors = normalizedColors.length > 0 ? normalizedColors : DEFAULT_GRADIENT_COLORS;
|
|
30046
|
-
if (baseColors.length === 1) {
|
|
30047
|
-
return monochromaticInterpolation(baseColors[0], length);
|
|
30048
|
-
}
|
|
30049
|
-
if (length <= baseColors.length) {
|
|
30050
|
-
return baseColors.slice(0, length);
|
|
30051
|
-
}
|
|
30052
|
-
const pairs = baseColors.length - 1;
|
|
30053
|
-
if (pairs <= 0) {
|
|
30054
|
-
return [baseColors[0]];
|
|
30055
|
-
}
|
|
30056
|
-
const needed = length - baseColors.length;
|
|
30057
|
-
const baseAmount = Math.floor(needed / pairs);
|
|
30058
|
-
const extras = needed % pairs;
|
|
30059
|
-
let result = [];
|
|
30060
|
-
let i = 0;
|
|
30061
|
-
let j = 1;
|
|
30062
|
-
while (j < baseColors.length) {
|
|
30063
|
-
const additional = i < extras ? 1 : 0;
|
|
30064
|
-
const interpLength = 2 + baseAmount + additional;
|
|
30065
|
-
const interp = interpolateBetween(
|
|
30066
|
-
baseColors[i],
|
|
30067
|
-
baseColors[j],
|
|
30068
|
-
interpLength
|
|
30069
|
-
);
|
|
30070
|
-
const lastIndex = j === baseColors.length - 1 ? void 0 : -1;
|
|
30071
|
-
result = result.concat(interp.slice(0, lastIndex));
|
|
30072
|
-
i++;
|
|
30073
|
-
j++;
|
|
30074
|
-
}
|
|
30075
|
-
return result;
|
|
30076
|
-
}
|
|
30077
|
-
function hexToRgb(hex) {
|
|
30078
|
-
const r = parseInt(hex.substring(1, 3), 16);
|
|
30079
|
-
const g = parseInt(hex.substring(3, 5), 16);
|
|
30080
|
-
const b = parseInt(hex.substring(5, 7), 16);
|
|
30081
|
-
return { r, g, b };
|
|
30082
|
-
}
|
|
30083
|
-
function rgbToHex(rgb) {
|
|
30084
|
-
const rHex = rgb.r.toString(16).padStart(2, "0");
|
|
30085
|
-
const gHex = rgb.g.toString(16).padStart(2, "0");
|
|
30086
|
-
const bHex = rgb.b.toString(16).padStart(2, "0");
|
|
30087
|
-
return `#${rHex}${gHex}${bHex}`;
|
|
30088
|
-
}
|
|
30089
|
-
function colorToHSL(color) {
|
|
30090
|
-
const colorHex = namedColorToHex(color);
|
|
30091
|
-
const { r, g, b } = hexToRgb(colorHex);
|
|
30092
|
-
return rgbToHsl(r, g, b);
|
|
30093
|
-
}
|
|
30094
|
-
function interpolateBetween(leftColor, rightColor, length = 3) {
|
|
30095
|
-
const [h, s, _l] = colorToHSL(leftColor);
|
|
30096
|
-
const [h2, s2, _l2] = colorToHSL(rightColor);
|
|
30097
|
-
const hues = linspace(h, h2, length);
|
|
30098
|
-
const saturations = linspace(s, s2, length);
|
|
30099
|
-
const lightnesses = linspace(_l, _l2, length);
|
|
30100
|
-
return Array.from({ length }).map((_, i) => {
|
|
30101
|
-
const [r, g, b] = HSLtoRGB(hues[i], saturations[i], lightnesses[i]);
|
|
30102
|
-
return rgbToHex({ r: Math.round(r), g: Math.round(g), b: Math.round(b) });
|
|
30103
|
-
});
|
|
30104
|
-
}
|
|
30105
|
-
function monochromaticInterpolation(color, length) {
|
|
30106
|
-
const [h, s] = colorToHSL(color);
|
|
30107
|
-
const hues = linspace(h, h, length);
|
|
30108
|
-
const saturations = linspace(s, s, length);
|
|
30109
|
-
const lightnesses = linspace(0.6, 0.9, length);
|
|
30110
|
-
return Array.from({ length }).map((_, i) => {
|
|
30111
|
-
const [r, g, b] = HSLtoRGB(hues[i], saturations[i], lightnesses[i]);
|
|
30112
|
-
return rgbToHex({ r: Math.round(r), g: Math.round(g), b: Math.round(b) });
|
|
30113
|
-
});
|
|
30114
|
-
}
|
|
30115
|
-
function linspace(start, end, num) {
|
|
30116
|
-
if (num <= 1) return [start];
|
|
30117
|
-
const step = (end - start) / (num - 1);
|
|
30118
|
-
const result = new Array(num);
|
|
30119
|
-
for (let i = 0; i < num; i++) {
|
|
30120
|
-
result[i] = start + step * i;
|
|
30121
|
-
}
|
|
30122
|
-
return result;
|
|
30123
|
-
}
|
|
30124
|
-
function stableColorIndex(field) {
|
|
30125
|
-
let hash = 0;
|
|
30126
|
-
for (const character of field.replace("comparison_", "")) {
|
|
30127
|
-
hash = Math.imul(hash, 31) + character.charCodeAt(0) >>> 0;
|
|
30128
|
-
}
|
|
30129
|
-
return hash;
|
|
30130
|
-
}
|
|
30131
|
-
function selectColor(element, colors, index) {
|
|
30132
|
-
if (!element?.field) return "gray";
|
|
30133
|
-
const isComparison = element.field.includes("comparison_");
|
|
30134
|
-
const color = colors[index % colors.length] ?? "";
|
|
30135
|
-
if (!isComparison) {
|
|
30136
|
-
return color;
|
|
30137
|
-
}
|
|
30138
|
-
if (Object.keys(COLOR_TO_HEX).includes(color)) {
|
|
30139
|
-
const colorHex = COLOR_TO_HEX[color];
|
|
30140
|
-
const rgbArray = hexToRGB(colorHex);
|
|
30141
|
-
return toGrayscale(rgbArray);
|
|
30142
|
-
}
|
|
30143
|
-
if (color?.startsWith("#")) {
|
|
30144
|
-
const rgbArray = hexToRGB(color);
|
|
30145
|
-
return toGrayscale(rgbArray);
|
|
30146
|
-
}
|
|
30147
|
-
return "gray";
|
|
30148
|
-
}
|
|
30149
|
-
function hexToRGB(hex) {
|
|
30150
|
-
const regex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i;
|
|
30151
|
-
const result = regex.exec(hex);
|
|
30152
|
-
if (result) {
|
|
30153
|
-
return [
|
|
30154
|
-
parseInt(result[1], 16),
|
|
30155
|
-
// index 0 is whole string, then ()'s
|
|
30156
|
-
parseInt(result[2], 16),
|
|
30157
|
-
parseInt(result[3], 16),
|
|
30158
|
-
...result[4] ? [parseInt(result[4], 16)] : []
|
|
30159
|
-
// <- alpha channel
|
|
30160
|
-
];
|
|
30161
|
-
}
|
|
30162
|
-
const rgba = hex.match(/[0-9.]+/g);
|
|
30163
|
-
if (rgba) {
|
|
30164
|
-
return [
|
|
30165
|
-
Number(rgba[0]),
|
|
30166
|
-
Number(rgba[1]),
|
|
30167
|
-
Number(rgba[2]),
|
|
30168
|
-
...rgba[3] ? [Number(rgba[3])] : []
|
|
30169
|
-
];
|
|
30170
|
-
}
|
|
30171
|
-
return [128, 128, 128];
|
|
30172
|
-
}
|
|
30173
|
-
function toGrayscale(rgba) {
|
|
30174
|
-
if (rgba.length < 3) return "rbg(128, 128, 128)";
|
|
30175
|
-
let sum = 0;
|
|
30176
|
-
sum += Number(rgba[0] * 0.89);
|
|
30177
|
-
sum += Number(rgba[1] * 1.77);
|
|
30178
|
-
sum += Number(rgba[2] * 0.33);
|
|
30179
|
-
const avg = (sum / 3).toFixed(2);
|
|
30180
|
-
return `rgb(${avg}, ${avg}, ${avg})`;
|
|
30181
|
-
}
|
|
30182
|
-
function namedColorToHex(color) {
|
|
30183
|
-
if (Object.keys(COLOR_TO_HEX).includes(color)) {
|
|
30184
|
-
return COLOR_TO_HEX[color];
|
|
30185
|
-
}
|
|
30186
|
-
return color;
|
|
30187
|
-
}
|
|
30188
|
-
var COLOR_TO_HEX = {
|
|
30189
|
-
aliceblue: "#f0f8ff",
|
|
30190
|
-
antiquewhite: "#faebd7",
|
|
30191
|
-
aqua: "#00ffff",
|
|
30192
|
-
aquamarine: "#7fffd4",
|
|
30193
|
-
azure: "#f0ffff",
|
|
30194
|
-
beige: "#f5f5dc",
|
|
30195
|
-
bisque: "#ffe4c4",
|
|
30196
|
-
black: "#000000",
|
|
30197
|
-
blanchedalmond: "#ffebcd",
|
|
30198
|
-
blue: "#0000ff",
|
|
30199
|
-
blueviolet: "#8a2be2",
|
|
30200
|
-
brown: "#a52a2a",
|
|
30201
|
-
burlywood: "#deb887",
|
|
30202
|
-
cadetblue: "#5f9ea0",
|
|
30203
|
-
chartreuse: "#7fff00",
|
|
30204
|
-
chocolate: "#d2691e",
|
|
30205
|
-
coral: "#ff7f50",
|
|
30206
|
-
cornflowerblue: "#6495ed",
|
|
30207
|
-
cornsilk: "#fff8dc",
|
|
30208
|
-
crimson: "#dc143c",
|
|
30209
|
-
cyan: "#00ffff",
|
|
30210
|
-
darkblue: "#00008b",
|
|
30211
|
-
darkcyan: "#008b8b",
|
|
30212
|
-
darkgoldenrod: "#b8860b",
|
|
30213
|
-
darkgray: "#a9a9a9",
|
|
30214
|
-
darkgreen: "#006400",
|
|
30215
|
-
darkkhaki: "#bdb76b",
|
|
30216
|
-
darkmagenta: "#8b008b",
|
|
30217
|
-
darkolivegreen: "#556b2f",
|
|
30218
|
-
darkorange: "#ff8c00",
|
|
30219
|
-
darkorchid: "#9932cc",
|
|
30220
|
-
darkred: "#8b0000",
|
|
30221
|
-
darksalmon: "#e9967a",
|
|
30222
|
-
darkseagreen: "#8fbc8f",
|
|
30223
|
-
darkslateblue: "#483d8b",
|
|
30224
|
-
darkslategray: "#2f4f4f",
|
|
30225
|
-
darkturquoise: "#00ced1",
|
|
30226
|
-
darkviolet: "#9400d3",
|
|
30227
|
-
deeppink: "#ff1493",
|
|
30228
|
-
deepskyblue: "#00bfff",
|
|
30229
|
-
dimgray: "#696969",
|
|
30230
|
-
dodgerblue: "#1e90ff",
|
|
30231
|
-
firebrick: "#b22222",
|
|
30232
|
-
floralwhite: "#fffaf0",
|
|
30233
|
-
forestgreen: "#228b22",
|
|
30234
|
-
fuchsia: "#ff00ff",
|
|
30235
|
-
gainsboro: "#dcdcdc",
|
|
30236
|
-
ghostwhite: "#f8f8ff",
|
|
30237
|
-
gold: "#ffd700",
|
|
30238
|
-
goldenrod: "#daa520",
|
|
30239
|
-
gray: "#808080",
|
|
30240
|
-
green: "#008000",
|
|
30241
|
-
greenyellow: "#adff2f",
|
|
30242
|
-
honeydew: "#f0fff0",
|
|
30243
|
-
hotpink: "#ff69b4",
|
|
30244
|
-
indianred: "#cd5c5c",
|
|
30245
|
-
indigo: "#4b0082",
|
|
30246
|
-
ivory: "#fffff0",
|
|
30247
|
-
khaki: "#f0e68c",
|
|
30248
|
-
lavender: "#e6e6fa",
|
|
30249
|
-
lavenderblush: "#fff0f5",
|
|
30250
|
-
lawngreen: "#7cfc00",
|
|
30251
|
-
lemonchiffon: "#fffacd",
|
|
30252
|
-
lightblue: "#add8e6",
|
|
30253
|
-
lightcoral: "#f08080",
|
|
30254
|
-
lightcyan: "#e0ffff",
|
|
30255
|
-
lightgoldenrodyellow: "#fafad2",
|
|
30256
|
-
lightgrey: "#d3d3d3",
|
|
30257
|
-
lightgreen: "#90ee90",
|
|
30258
|
-
lightpink: "#ffb6c1",
|
|
30259
|
-
lightsalmon: "#ffa07a",
|
|
30260
|
-
lightseagreen: "#20b2aa",
|
|
30261
|
-
lightskyblue: "#87cefa",
|
|
30262
|
-
lightslategray: "#778899",
|
|
30263
|
-
lightsteelblue: "#b0c4de",
|
|
30264
|
-
lightyellow: "#ffffe0",
|
|
30265
|
-
lime: "#00ff00",
|
|
30266
|
-
limegreen: "#32cd32",
|
|
30267
|
-
linen: "#faf0e6",
|
|
30268
|
-
magenta: "#ff00ff",
|
|
30269
|
-
maroon: "#800000",
|
|
30270
|
-
mediumaquamarine: "#66cdaa",
|
|
30271
|
-
mediumblue: "#0000cd",
|
|
30272
|
-
mediumorchid: "#ba55d3",
|
|
30273
|
-
mediumpurple: "#9370d8",
|
|
30274
|
-
mediumseagreen: "#3cb371",
|
|
30275
|
-
mediumslateblue: "#7b68ee",
|
|
30276
|
-
mediumspringgreen: "#00fa9a",
|
|
30277
|
-
mediumturquoise: "#48d1cc",
|
|
30278
|
-
mediumvioletred: "#c71585",
|
|
30279
|
-
midnightblue: "#191970",
|
|
30280
|
-
mintcream: "#f5fffa",
|
|
30281
|
-
mistyrose: "#ffe4e1",
|
|
30282
|
-
moccasin: "#ffe4b5",
|
|
30283
|
-
navajowhite: "#ffdead",
|
|
30284
|
-
navy: "#000080",
|
|
30285
|
-
oldlace: "#fdf5e6",
|
|
30286
|
-
olive: "#808000",
|
|
30287
|
-
olivedrab: "#6b8e23",
|
|
30288
|
-
orange: "#ffa500",
|
|
30289
|
-
orangered: "#ff4500",
|
|
30290
|
-
orchid: "#da70d6",
|
|
30291
|
-
palegoldenrod: "#eee8aa",
|
|
30292
|
-
palegreen: "#98fb98",
|
|
30293
|
-
paleturquoise: "#afeeee",
|
|
30294
|
-
palevioletred: "#d87093",
|
|
30295
|
-
papayawhip: "#ffefd5",
|
|
30296
|
-
peachpuff: "#ffdab9",
|
|
30297
|
-
peru: "#cd853f",
|
|
30298
|
-
pink: "#ffc0cb",
|
|
30299
|
-
plum: "#dda0dd",
|
|
30300
|
-
powderblue: "#b0e0e6",
|
|
30301
|
-
purple: "#800080",
|
|
30302
|
-
rebeccapurple: "#663399",
|
|
30303
|
-
red: "#ff0000",
|
|
30304
|
-
rosybrown: "#bc8f8f",
|
|
30305
|
-
royalblue: "#4169e1",
|
|
30306
|
-
saddlebrown: "#8b4513",
|
|
30307
|
-
salmon: "#fa8072",
|
|
30308
|
-
sandybrown: "#f4a460",
|
|
30309
|
-
seagreen: "#2e8b57",
|
|
30310
|
-
seashell: "#fff5ee",
|
|
30311
|
-
sienna: "#a0522d",
|
|
30312
|
-
silver: "#c0c0c0",
|
|
30313
|
-
skyblue: "#87ceeb",
|
|
30314
|
-
slateblue: "#6a5acd",
|
|
30315
|
-
slategray: "#708090",
|
|
30316
|
-
snow: "#fffafa",
|
|
30317
|
-
springgreen: "#00ff7f",
|
|
30318
|
-
steelblue: "#4682b4",
|
|
30319
|
-
tan: "#d2b48c",
|
|
30320
|
-
teal: "#008080",
|
|
30321
|
-
thistle: "#d8bfd8",
|
|
30322
|
-
tomato: "#ff6347",
|
|
30323
|
-
turquoise: "#40e0d0",
|
|
30324
|
-
violet: "#ee82ee",
|
|
30325
|
-
wheat: "#f5deb3",
|
|
30326
|
-
white: "#ffffff",
|
|
30327
|
-
whitesmoke: "#f5f5f5",
|
|
30328
|
-
yellow: "#ffff00",
|
|
30329
|
-
yellowgreen: "#9acd32"
|
|
30330
|
-
};
|
|
30331
|
-
function rgbToHsl(r, g, b) {
|
|
30332
|
-
r /= 255, g /= 255, b /= 255;
|
|
30333
|
-
const max2 = Math.max(r, g, b), min2 = Math.min(r, g, b);
|
|
30334
|
-
let h = (max2 + min2) / 2;
|
|
30335
|
-
let s = (max2 + min2) / 2;
|
|
30336
|
-
const l = (max2 + min2) / 2;
|
|
30337
|
-
if (max2 == min2) {
|
|
30338
|
-
h = s = 0;
|
|
30339
|
-
} else {
|
|
30340
|
-
const d = max2 - min2;
|
|
30341
|
-
s = l > 0.5 ? d / (2 - max2 - min2) : d / (max2 + min2);
|
|
30342
|
-
switch (max2) {
|
|
30343
|
-
case r:
|
|
30344
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
30345
|
-
break;
|
|
30346
|
-
case g:
|
|
30347
|
-
h = (b - r) / d + 2;
|
|
30348
|
-
break;
|
|
30349
|
-
case b:
|
|
30350
|
-
h = (r - g) / d + 4;
|
|
30351
|
-
break;
|
|
30814
|
+
{
|
|
30815
|
+
style: {
|
|
30816
|
+
fontSize: "8px",
|
|
30817
|
+
textAlign: "left",
|
|
30818
|
+
whiteSpace: "nowrap",
|
|
30819
|
+
overflow: "hidden",
|
|
30820
|
+
textOverflow: "ellipsis",
|
|
30821
|
+
width: "100%",
|
|
30822
|
+
margin: 0
|
|
30823
|
+
},
|
|
30824
|
+
colSpan: report.columns.length,
|
|
30825
|
+
children: [
|
|
30826
|
+
"Page ",
|
|
30827
|
+
pageNumber,
|
|
30828
|
+
" of ",
|
|
30829
|
+
numberOfPages
|
|
30830
|
+
]
|
|
30831
|
+
}
|
|
30832
|
+
) })
|
|
30833
|
+
] })
|
|
30834
|
+
]
|
|
30835
|
+
}
|
|
30836
|
+
)
|
|
30837
|
+
}
|
|
30838
|
+
) })
|
|
30352
30839
|
}
|
|
30353
|
-
|
|
30354
|
-
}
|
|
30355
|
-
return [h, s, l];
|
|
30840
|
+
);
|
|
30356
30841
|
}
|
|
30357
|
-
|
|
30358
|
-
|
|
30359
|
-
|
|
30360
|
-
|
|
30361
|
-
|
|
30362
|
-
|
|
30363
|
-
|
|
30364
|
-
|
|
30365
|
-
|
|
30366
|
-
|
|
30367
|
-
|
|
30368
|
-
|
|
30369
|
-
|
|
30370
|
-
|
|
30371
|
-
|
|
30372
|
-
|
|
30373
|
-
|
|
30374
|
-
|
|
30842
|
+
|
|
30843
|
+
// src/Chart.tsx
|
|
30844
|
+
import { differenceInHours } from "date-fns";
|
|
30845
|
+
|
|
30846
|
+
// src/components/Chart/BarList.tsx
|
|
30847
|
+
init_valueFormatter();
|
|
30848
|
+
init_chart();
|
|
30849
|
+
import React2 from "react";
|
|
30850
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
30851
|
+
var getWidthsFromValues = (dataValues) => {
|
|
30852
|
+
let maxValue = -Infinity;
|
|
30853
|
+
dataValues.forEach((value) => {
|
|
30854
|
+
maxValue = Math.max(maxValue, value);
|
|
30855
|
+
});
|
|
30856
|
+
return dataValues.map((value) => {
|
|
30857
|
+
if (value === 0) return 0;
|
|
30858
|
+
return Math.max(value / maxValue * 100, 1);
|
|
30859
|
+
});
|
|
30860
|
+
};
|
|
30861
|
+
function getColors(colorMap, xAxisField, colors) {
|
|
30862
|
+
if (colorMap && colorMap[xAxisField] && colorMap[xAxisField]["primary"]) {
|
|
30863
|
+
return colorMap[xAxisField]["primary"];
|
|
30864
|
+
} else if (colors) {
|
|
30865
|
+
return hexToRgbaWith10PercentAlpha(colors[0]);
|
|
30375
30866
|
}
|
|
30376
|
-
return
|
|
30867
|
+
return hexToRgbaWith10PercentAlpha(void 0);
|
|
30377
30868
|
}
|
|
30869
|
+
var BarList = React2.forwardRef((props, ref) => {
|
|
30870
|
+
const {
|
|
30871
|
+
data = [],
|
|
30872
|
+
yAxisFields,
|
|
30873
|
+
xAxisField,
|
|
30874
|
+
xAxisFormat,
|
|
30875
|
+
colors,
|
|
30876
|
+
colorMap = {},
|
|
30877
|
+
// valueFormatter = (value: any) => value,valueFormatter
|
|
30878
|
+
showAnimation = true,
|
|
30879
|
+
className,
|
|
30880
|
+
containerStyle,
|
|
30881
|
+
theme,
|
|
30882
|
+
onClickChartElement,
|
|
30883
|
+
scrollable,
|
|
30884
|
+
...other
|
|
30885
|
+
} = props;
|
|
30886
|
+
const widths = getWidthsFromValues(
|
|
30887
|
+
data.map((item) => {
|
|
30888
|
+
if (yAxisFields && yAxisFields[0] && yAxisFields[0].field) {
|
|
30889
|
+
return item[yAxisFields[0].field];
|
|
30890
|
+
}
|
|
30891
|
+
return 0;
|
|
30892
|
+
})
|
|
30893
|
+
);
|
|
30894
|
+
const NUM_TO_SHOW = scrollable ? 500 : 5;
|
|
30895
|
+
if (!data || data.length === 0) {
|
|
30896
|
+
return /* @__PURE__ */ jsx3(
|
|
30897
|
+
"div",
|
|
30898
|
+
{
|
|
30899
|
+
style: {
|
|
30900
|
+
display: "flex",
|
|
30901
|
+
flex: "1 0 auto",
|
|
30902
|
+
// height: '100%',
|
|
30903
|
+
margin: "auto",
|
|
30904
|
+
justifyContent: "center",
|
|
30905
|
+
alignItems: "center",
|
|
30906
|
+
fontSize: 13,
|
|
30907
|
+
fontFamily: theme?.fontFamily,
|
|
30908
|
+
color: theme.secondaryTextColor,
|
|
30909
|
+
...containerStyle
|
|
30910
|
+
},
|
|
30911
|
+
className,
|
|
30912
|
+
children: "No results"
|
|
30913
|
+
}
|
|
30914
|
+
);
|
|
30915
|
+
}
|
|
30916
|
+
return /* @__PURE__ */ jsx3(
|
|
30917
|
+
"div",
|
|
30918
|
+
{
|
|
30919
|
+
ref,
|
|
30920
|
+
className,
|
|
30921
|
+
style: {
|
|
30922
|
+
// width: '100%',
|
|
30923
|
+
boxSizing: "content-box",
|
|
30924
|
+
height: "100%",
|
|
30925
|
+
// marginLeft: 25,
|
|
30926
|
+
// background: 'red',
|
|
30927
|
+
// paddingRight: 25,
|
|
30928
|
+
// paddingRight: 25,
|
|
30929
|
+
...containerStyle
|
|
30930
|
+
},
|
|
30931
|
+
...other,
|
|
30932
|
+
children: /* @__PURE__ */ jsxs2(
|
|
30933
|
+
"div",
|
|
30934
|
+
{
|
|
30935
|
+
style: {
|
|
30936
|
+
display: "flex",
|
|
30937
|
+
justifyContent: "space-between",
|
|
30938
|
+
boxSizing: "content-box",
|
|
30939
|
+
overflow: scrollable ? "scroll" : "hidden",
|
|
30940
|
+
width: "100%",
|
|
30941
|
+
height: "100%"
|
|
30942
|
+
},
|
|
30943
|
+
children: [
|
|
30944
|
+
/* @__PURE__ */ jsxs2(
|
|
30945
|
+
"div",
|
|
30946
|
+
{
|
|
30947
|
+
style: {
|
|
30948
|
+
width: "100%",
|
|
30949
|
+
boxSizing: "content-box",
|
|
30950
|
+
height: "100%",
|
|
30951
|
+
position: "relative",
|
|
30952
|
+
paddingRight: 25
|
|
30953
|
+
},
|
|
30954
|
+
children: [
|
|
30955
|
+
data.slice(0, NUM_TO_SHOW).map((item, idx) => {
|
|
30956
|
+
return /* @__PURE__ */ jsx3(
|
|
30957
|
+
"div",
|
|
30958
|
+
{
|
|
30959
|
+
style: {
|
|
30960
|
+
width: `${widths[idx]}%`,
|
|
30961
|
+
transition: showAnimation ? "all 2s" : "",
|
|
30962
|
+
boxSizing: "content-box",
|
|
30963
|
+
backgroundColor: getColors(colorMap, xAxisField, colors),
|
|
30964
|
+
display: "flex",
|
|
30965
|
+
alignItems: "center",
|
|
30966
|
+
height: "36px",
|
|
30967
|
+
marginBottom: "8px",
|
|
30968
|
+
borderRadius: "4px"
|
|
30969
|
+
},
|
|
30970
|
+
onClick: () => onClickChartElement?.(item),
|
|
30971
|
+
children: /* @__PURE__ */ jsx3(
|
|
30972
|
+
"div",
|
|
30973
|
+
{
|
|
30974
|
+
style: {
|
|
30975
|
+
boxSizing: "content-box",
|
|
30976
|
+
position: "absolute",
|
|
30977
|
+
maxWidth: "100%",
|
|
30978
|
+
display: "flex",
|
|
30979
|
+
marginLeft: "8px"
|
|
30980
|
+
},
|
|
30981
|
+
children: /* @__PURE__ */ jsx3(
|
|
30982
|
+
"p",
|
|
30983
|
+
{
|
|
30984
|
+
style: {
|
|
30985
|
+
color: theme?.chartLabelColor,
|
|
30986
|
+
boxSizing: "content-box",
|
|
30987
|
+
whiteSpace: "nowrap",
|
|
30988
|
+
overflow: "hidden",
|
|
30989
|
+
textOverflow: "ellipsis",
|
|
30990
|
+
fontFamily: theme?.chartLabelFontFamily || theme?.fontFamily,
|
|
30991
|
+
fontSize: theme?.fontSizeSmall || "14px"
|
|
30992
|
+
},
|
|
30993
|
+
children: valueFormatter({
|
|
30994
|
+
value: item[xAxisField] ?? item[`comparison_${xAxisField}`],
|
|
30995
|
+
field: xAxisField,
|
|
30996
|
+
// @ts-ignore
|
|
30997
|
+
fields: [{ field: xAxisField, format: xAxisFormat }]
|
|
30998
|
+
})
|
|
30999
|
+
}
|
|
31000
|
+
)
|
|
31001
|
+
}
|
|
31002
|
+
)
|
|
31003
|
+
},
|
|
31004
|
+
item[xAxisField] + "label" + idx
|
|
31005
|
+
);
|
|
31006
|
+
}),
|
|
31007
|
+
data.length > NUM_TO_SHOW && /* @__PURE__ */ jsxs2(
|
|
31008
|
+
"div",
|
|
31009
|
+
{
|
|
31010
|
+
style: {
|
|
31011
|
+
color: theme?.chartLabelColor,
|
|
31012
|
+
boxSizing: "content-box",
|
|
31013
|
+
fontFamily: theme?.chartLabelFontFamily || theme?.fontFamily,
|
|
31014
|
+
fontSize: theme?.fontSizeSmall || "14px"
|
|
31015
|
+
},
|
|
31016
|
+
children: [
|
|
31017
|
+
"...",
|
|
31018
|
+
data.length - NUM_TO_SHOW,
|
|
31019
|
+
" more"
|
|
31020
|
+
]
|
|
31021
|
+
}
|
|
31022
|
+
)
|
|
31023
|
+
]
|
|
31024
|
+
}
|
|
31025
|
+
),
|
|
31026
|
+
/* @__PURE__ */ jsx3(
|
|
31027
|
+
"div",
|
|
31028
|
+
{
|
|
31029
|
+
style: {
|
|
31030
|
+
boxSizing: "content-box",
|
|
31031
|
+
textAlign: "right",
|
|
31032
|
+
minWidth: "min-content",
|
|
31033
|
+
paddingLeft: 10
|
|
31034
|
+
},
|
|
31035
|
+
children: data.slice(0, NUM_TO_SHOW).map((item, idx) => /* @__PURE__ */ jsx3(
|
|
31036
|
+
"div",
|
|
31037
|
+
{
|
|
31038
|
+
style: {
|
|
31039
|
+
boxSizing: "content-box",
|
|
31040
|
+
display: "flex",
|
|
31041
|
+
alignItems: "center",
|
|
31042
|
+
justifyContent: "flex-end",
|
|
31043
|
+
marginBottom: idx === data.length - 1 ? 0 : "8px",
|
|
31044
|
+
height: "36px"
|
|
31045
|
+
},
|
|
31046
|
+
children: /* @__PURE__ */ jsx3(
|
|
31047
|
+
"p",
|
|
31048
|
+
{
|
|
31049
|
+
style: {
|
|
31050
|
+
color: theme?.chartLabelColor,
|
|
31051
|
+
boxSizing: "content-box",
|
|
31052
|
+
fontFamily: theme?.chartLabelFontFamily || theme?.fontFamily,
|
|
31053
|
+
whiteSpace: "nowrap",
|
|
31054
|
+
overflow: "hidden",
|
|
31055
|
+
textOverflow: "ellipsis",
|
|
31056
|
+
fontSize: theme?.fontSizeSmall || "14px"
|
|
31057
|
+
},
|
|
31058
|
+
children: valueFormatter({
|
|
31059
|
+
value: yAxisFields && yAxisFields[0] && item[yAxisFields[0].field] ? item[yAxisFields[0].field] : 0,
|
|
31060
|
+
field: yAxisFields && yAxisFields[0] && yAxisFields[0].field,
|
|
31061
|
+
fields: yAxisFields
|
|
31062
|
+
})
|
|
31063
|
+
}
|
|
31064
|
+
)
|
|
31065
|
+
},
|
|
31066
|
+
item[xAxisField] + "value" + idx
|
|
31067
|
+
))
|
|
31068
|
+
}
|
|
31069
|
+
)
|
|
31070
|
+
]
|
|
31071
|
+
}
|
|
31072
|
+
)
|
|
31073
|
+
}
|
|
31074
|
+
);
|
|
31075
|
+
});
|
|
31076
|
+
var BarList_default = BarList;
|
|
30378
31077
|
|
|
30379
31078
|
// src/components/Chart/PieChart.tsx
|
|
31079
|
+
import React4, { useMemo as useMemo4 } from "react";
|
|
31080
|
+
import { Legend, Pie, PieChart, ResponsiveContainer, Tooltip } from "recharts";
|
|
30380
31081
|
init_util();
|
|
30381
31082
|
init_valueFormatter();
|
|
30382
31083
|
|
|
@@ -35167,16 +35868,9 @@ function BarChart({
|
|
|
35167
35868
|
}
|
|
35168
35869
|
return colorMap?.[field]?.[key];
|
|
35169
35870
|
};
|
|
35170
|
-
const
|
|
35171
|
-
|
|
35172
|
-
|
|
35173
|
-
(a, b) => Object.keys(data[0]).indexOf(a.field) - Object.keys(data[0]).indexOf(b.field)
|
|
35174
|
-
).filter(
|
|
35175
|
-
(field) => comparison || !field.field.startsWith("comparison_")
|
|
35176
|
-
);
|
|
35177
|
-
}
|
|
35178
|
-
return fields;
|
|
35179
|
-
};
|
|
35871
|
+
const getVisibleYAxisFields = (fields) => fields.filter(
|
|
35872
|
+
({ field }) => comparison || !field.startsWith("comparison_")
|
|
35873
|
+
);
|
|
35180
35874
|
const valueDomain = useMemo9(
|
|
35181
35875
|
() => stackedMode ? getStackedDomain(data, yAxisFields, comparison) : getDomain(data, yAxisFields, referenceLines),
|
|
35182
35876
|
[stackedMode, data, yAxisFields, referenceLines, comparison]
|
|
@@ -35202,13 +35896,13 @@ function BarChart({
|
|
|
35202
35896
|
const customBarShape = useMemo9(() => {
|
|
35203
35897
|
if (!theme?.barChartCornerRadius && !theme?.barChartCornerRadiusRatio)
|
|
35204
35898
|
return void 0;
|
|
35205
|
-
return createCustomBar(
|
|
35899
|
+
return createCustomBar(getVisibleYAxisFields(yAxisFields), theme, layout);
|
|
35206
35900
|
}, [isStacked, yAxisFields, theme, layout]);
|
|
35207
35901
|
const customActiveBarShape = useMemo9(() => {
|
|
35208
35902
|
if (!theme?.barChartCornerRadius && !theme?.barChartCornerRadiusRatio)
|
|
35209
35903
|
return void 0;
|
|
35210
35904
|
return createCustomBar(
|
|
35211
|
-
|
|
35905
|
+
getVisibleYAxisFields(yAxisFields),
|
|
35212
35906
|
theme,
|
|
35213
35907
|
layout,
|
|
35214
35908
|
true
|
|
@@ -35382,9 +36076,9 @@ function BarChart({
|
|
|
35382
36076
|
}
|
|
35383
36077
|
const row = payload[0]?.payload ?? {};
|
|
35384
36078
|
const activeLabel = label ?? row[xAxisField] ?? "";
|
|
35385
|
-
const payloadItems =
|
|
35386
|
-
|
|
35387
|
-
|
|
36079
|
+
const payloadItems = getVisibleYAxisFields(
|
|
36080
|
+
yAxisFields
|
|
36081
|
+
).map((field) => {
|
|
35388
36082
|
const rawName = field.label;
|
|
35389
36083
|
const name2 = rawName ? humanizeChartSeriesTooltipLabel(rawName) : "";
|
|
35390
36084
|
return {
|
|
@@ -35437,7 +36131,7 @@ function BarChart({
|
|
|
35437
36131
|
position: isHorizontalBars ? void 0 : { y: 0 }
|
|
35438
36132
|
}
|
|
35439
36133
|
),
|
|
35440
|
-
|
|
36134
|
+
getVisibleYAxisFields(yAxisFields).map((elem, index) => {
|
|
35441
36135
|
return /* @__PURE__ */ jsx38(
|
|
35442
36136
|
Bar,
|
|
35443
36137
|
{
|
|
@@ -35454,9 +36148,9 @@ function BarChart({
|
|
|
35454
36148
|
style: {
|
|
35455
36149
|
cursor: onClickChartElement ? "pointer" : void 0
|
|
35456
36150
|
},
|
|
35457
|
-
onClick: (bar,
|
|
36151
|
+
onClick: (bar, index2, event) => {
|
|
35458
36152
|
event?.stopPropagation();
|
|
35459
|
-
const payload = bar.payload ?? data[
|
|
36153
|
+
const payload = bar.payload ?? data[index2] ?? {};
|
|
35460
36154
|
onClickChartElement?.({
|
|
35461
36155
|
...payload,
|
|
35462
36156
|
interactionType: "bar",
|
|
@@ -35477,11 +36171,11 @@ function BarChart({
|
|
|
35477
36171
|
series: elem.field,
|
|
35478
36172
|
value: payload[elem.field] ?? bar.value,
|
|
35479
36173
|
row: payload,
|
|
35480
|
-
index
|
|
36174
|
+
index: index2
|
|
35481
36175
|
});
|
|
35482
36176
|
}
|
|
35483
36177
|
},
|
|
35484
|
-
elem.field
|
|
36178
|
+
`${index}:${elem.field}`
|
|
35485
36179
|
);
|
|
35486
36180
|
}),
|
|
35487
36181
|
referenceLines && referenceLines.map(({ label, query }) => /* @__PURE__ */ jsx38(
|
|
@@ -38601,13 +39295,23 @@ var ChartDataLoader = ({
|
|
|
38601
39295
|
reportFilters,
|
|
38602
39296
|
dashboardFilters
|
|
38603
39297
|
]);
|
|
38604
|
-
const fetchReportHelper = async (useReportTask = true) => {
|
|
39298
|
+
const fetchReportHelper = async (useReportTask = true, reason = "unknown") => {
|
|
38605
39299
|
if (!client || !filters) {
|
|
38606
39300
|
if (!fetchReportAbortController.current) setLoading(false);
|
|
38607
39301
|
return;
|
|
38608
39302
|
}
|
|
38609
39303
|
const fetchRowsRequestId = rowsRequestId.current + 1;
|
|
38610
39304
|
rowsRequestId.current = fetchRowsRequestId;
|
|
39305
|
+
const startedAt = performance.now();
|
|
39306
|
+
profileDashboard("chart-data-loader-fetch-start", {
|
|
39307
|
+
reportId: item.id,
|
|
39308
|
+
requestId: fetchRowsRequestId,
|
|
39309
|
+
reason,
|
|
39310
|
+
useReportTask,
|
|
39311
|
+
triggerReload: (dashboardName ? dashboard : reports)[item.id]?.triggerReload,
|
|
39312
|
+
abortsPrevious: !!fetchReportAbortController.current,
|
|
39313
|
+
pivot: !!item.pivot
|
|
39314
|
+
});
|
|
38611
39315
|
previousUserFilters.current = userFilters;
|
|
38612
39316
|
previousDateBucket.current = dateBucket;
|
|
38613
39317
|
setLoading(true);
|
|
@@ -38740,6 +39444,14 @@ var ChartDataLoader = ({
|
|
|
38740
39444
|
});
|
|
38741
39445
|
setError(e.message ?? "Error fetching report");
|
|
38742
39446
|
} finally {
|
|
39447
|
+
profileDashboard("chart-data-loader-fetch-finish", {
|
|
39448
|
+
reportId: item.id,
|
|
39449
|
+
requestId: fetchRowsRequestId,
|
|
39450
|
+
reason,
|
|
39451
|
+
elapsedMs: Math.round(performance.now() - startedAt),
|
|
39452
|
+
isLatestRequest: fetchRowsRequestId === rowsRequestId.current,
|
|
39453
|
+
startsBackgroundFetch: !!backgroundFetch
|
|
39454
|
+
});
|
|
38743
39455
|
if (fetchRowsRequestId === rowsRequestId.current) {
|
|
38744
39456
|
fetchReportAbortController.current = null;
|
|
38745
39457
|
setLoading(false);
|
|
@@ -38774,7 +39486,7 @@ var ChartDataLoader = ({
|
|
|
38774
39486
|
previousTenants.current = tenants;
|
|
38775
39487
|
previousFilters.current = filters;
|
|
38776
39488
|
previousCustomFields.current = schemaData.customFields;
|
|
38777
|
-
fetchReportHelper();
|
|
39489
|
+
fetchReportHelper(true, "inputs-effect");
|
|
38778
39490
|
}, [
|
|
38779
39491
|
filters,
|
|
38780
39492
|
userFilters,
|
|
@@ -38786,8 +39498,13 @@ var ChartDataLoader = ({
|
|
|
38786
39498
|
]);
|
|
38787
39499
|
useEffect12(() => {
|
|
38788
39500
|
const tempReport = (dashboardName ? dashboard : reports)[item.id];
|
|
39501
|
+
profileDashboard("chart-data-loader-trigger-effect", {
|
|
39502
|
+
reportId: item.id,
|
|
39503
|
+
triggerReload: tempReport?.triggerReload ?? null,
|
|
39504
|
+
hasError: !!tempReport?.error
|
|
39505
|
+
});
|
|
38789
39506
|
if (tempReport && tempReport.triggerReload) {
|
|
38790
|
-
fetchReportHelper();
|
|
39507
|
+
fetchReportHelper(true, "trigger-reload-effect");
|
|
38791
39508
|
} else if (tempReport?.error) {
|
|
38792
39509
|
setError(tempReport.error);
|
|
38793
39510
|
}
|
|
@@ -40426,7 +41143,6 @@ function QuillTableDashboardComponent({
|
|
|
40426
41143
|
// src/Chart.tsx
|
|
40427
41144
|
init_valueFormatter();
|
|
40428
41145
|
import { Fragment as Fragment6, jsx as jsx50, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
40429
|
-
var MAX_ROWS_FOR_GENERIC_TABLE = 500;
|
|
40430
41146
|
function Chart({
|
|
40431
41147
|
colors,
|
|
40432
41148
|
reportId,
|
|
@@ -40708,6 +41424,14 @@ function Chart({
|
|
|
40708
41424
|
}
|
|
40709
41425
|
};
|
|
40710
41426
|
useEffect16(() => {
|
|
41427
|
+
profileDashboard("chart-fetch-decision", {
|
|
41428
|
+
reportId,
|
|
41429
|
+
clientLoading,
|
|
41430
|
+
isDashboardsLoading,
|
|
41431
|
+
hasDashboardReport: !!dashboardReport,
|
|
41432
|
+
hasReport: !!reports[reportId],
|
|
41433
|
+
dashboardFiltersReady: dashboardFilters !== null
|
|
41434
|
+
});
|
|
40711
41435
|
if (reportId === void 0 || reportId === "" || clientLoading || isDashboardsLoading) {
|
|
40712
41436
|
return;
|
|
40713
41437
|
}
|
|
@@ -40729,6 +41453,7 @@ function Chart({
|
|
|
40729
41453
|
});
|
|
40730
41454
|
setLoading(false);
|
|
40731
41455
|
} else if (!reports[reportId]) {
|
|
41456
|
+
profileDashboard("chart-fetch-individual", { reportId });
|
|
40732
41457
|
fetchReportHelper();
|
|
40733
41458
|
return;
|
|
40734
41459
|
}
|
|
@@ -40949,8 +41674,9 @@ var ChartDisplay = ({
|
|
|
40949
41674
|
return void 0;
|
|
40950
41675
|
}, [config, specificReportFilters, specificDashboardFilters]);
|
|
40951
41676
|
const resolvedShowLegend = showLegend !== void 0 ? showLegend : config?.showLegend ?? false;
|
|
41677
|
+
const resolvedColorMap = resolveReportColorMap(config, chartColors, colorMap);
|
|
40952
41678
|
const [page, setPage] = useState20(0);
|
|
40953
|
-
const
|
|
41679
|
+
const chartRenderLimitError = getChartRenderLimitError(config);
|
|
40954
41680
|
const tableDisplay = useMemo17(() => {
|
|
40955
41681
|
if (!config || config.chartType?.toLowerCase() !== "table") {
|
|
40956
41682
|
return void 0;
|
|
@@ -40983,15 +41709,8 @@ var ChartDisplay = ({
|
|
|
40983
41709
|
}, [config]);
|
|
40984
41710
|
if (loading) {
|
|
40985
41711
|
return /* @__PURE__ */ jsx50("div", { className, style: containerStyle, children: /* @__PURE__ */ jsx50(LoadingComponent, {}) });
|
|
40986
|
-
} else if (
|
|
40987
|
-
|
|
40988
|
-
) && rowCountForLimit !== void 0 && rowCountForLimit > MAX_ROWS_FOR_GENERIC_TABLE) {
|
|
40989
|
-
return /* @__PURE__ */ jsx50("div", { style: containerStyle, className, children: /* @__PURE__ */ jsx50(
|
|
40990
|
-
ErrorComponent,
|
|
40991
|
-
{
|
|
40992
|
-
errorMessage: `Charts can only display ${MAX_ROWS_FOR_GENERIC_TABLE} rows. Please modify the query.`
|
|
40993
|
-
}
|
|
40994
|
-
) });
|
|
41712
|
+
} else if (chartRenderLimitError) {
|
|
41713
|
+
return /* @__PURE__ */ jsx50("div", { style: containerStyle, className, children: /* @__PURE__ */ jsx50(ErrorComponent, { errorMessage: chartRenderLimitError }) });
|
|
40995
41714
|
}
|
|
40996
41715
|
if (config?.chartType?.toLowerCase() === "pie") {
|
|
40997
41716
|
return /* @__PURE__ */ jsx50(
|
|
@@ -41057,7 +41776,7 @@ var ChartDisplay = ({
|
|
|
41057
41776
|
xAxisFormat: config?.xAxisFormat ?? "string",
|
|
41058
41777
|
containerStyle,
|
|
41059
41778
|
className,
|
|
41060
|
-
colorMap,
|
|
41779
|
+
colorMap: resolvedColorMap,
|
|
41061
41780
|
onClickChartElement,
|
|
41062
41781
|
scrollable,
|
|
41063
41782
|
showAnimation: isAnimationActive
|
|
@@ -41083,7 +41802,7 @@ var ChartDisplay = ({
|
|
|
41083
41802
|
hideXAxis,
|
|
41084
41803
|
hideYAxis,
|
|
41085
41804
|
hideCartesianGrid,
|
|
41086
|
-
colorMap,
|
|
41805
|
+
colorMap: resolvedColorMap,
|
|
41087
41806
|
onClickChartElement,
|
|
41088
41807
|
onClickLegendElement,
|
|
41089
41808
|
dateFilter: !hideDateRangeFilter ? dateFilter : void 0,
|
|
@@ -41111,7 +41830,7 @@ var ChartDisplay = ({
|
|
|
41111
41830
|
hideXAxis,
|
|
41112
41831
|
hideYAxis,
|
|
41113
41832
|
hideCartesianGrid,
|
|
41114
|
-
colorMap,
|
|
41833
|
+
colorMap: resolvedColorMap,
|
|
41115
41834
|
onClickChartElement,
|
|
41116
41835
|
onClickLegendElement,
|
|
41117
41836
|
dateFilter: !hideDateRangeFilter ? dateFilter : void 0,
|
|
@@ -41233,7 +41952,7 @@ var ChartDisplay = ({
|
|
|
41233
41952
|
xAxisFormat: config?.xAxisFormat ?? "string",
|
|
41234
41953
|
containerStyle,
|
|
41235
41954
|
className,
|
|
41236
|
-
colorMap,
|
|
41955
|
+
colorMap: resolvedColorMap,
|
|
41237
41956
|
onClickChartElement
|
|
41238
41957
|
}
|
|
41239
41958
|
);
|
|
@@ -41250,7 +41969,7 @@ var ChartDisplay = ({
|
|
|
41250
41969
|
xAxisFormat: config?.xAxisFormat ?? "string",
|
|
41251
41970
|
containerStyle,
|
|
41252
41971
|
className,
|
|
41253
|
-
colorMap,
|
|
41972
|
+
colorMap: resolvedColorMap,
|
|
41254
41973
|
onClickChartElement
|
|
41255
41974
|
}
|
|
41256
41975
|
);
|
|
@@ -41260,7 +41979,7 @@ var ChartDisplay = ({
|
|
|
41260
41979
|
RadarChart,
|
|
41261
41980
|
{
|
|
41262
41981
|
colors: chartColors,
|
|
41263
|
-
colorMap,
|
|
41982
|
+
colorMap: resolvedColorMap,
|
|
41264
41983
|
yAxisFields: config?.yAxisFields.sort(sortComparisonFirst) ?? [],
|
|
41265
41984
|
data: config?.rows ?? [],
|
|
41266
41985
|
xAxisField: config?.xAxisField ?? "",
|
|
@@ -41281,7 +42000,7 @@ var ChartDisplay = ({
|
|
|
41281
42000
|
LineChart,
|
|
41282
42001
|
{
|
|
41283
42002
|
colors: chartColors,
|
|
41284
|
-
colorMap,
|
|
42003
|
+
colorMap: resolvedColorMap,
|
|
41285
42004
|
yAxisFields: config?.yAxisFields.sort(sortComparisonFirst) || [],
|
|
41286
42005
|
data: config?.rows || [],
|
|
41287
42006
|
xAxisField: config?.xAxisField || "",
|
|
@@ -44415,7 +45134,7 @@ import { useContext as useContext22, useMemo as useMemo22 } from "react";
|
|
|
44415
45134
|
init_Filter();
|
|
44416
45135
|
|
|
44417
45136
|
// src/StaticChart.tsx
|
|
44418
|
-
import { useMemo as useMemo21 } from "react";
|
|
45137
|
+
import { useEffect as useEffect20, useMemo as useMemo21 } from "react";
|
|
44419
45138
|
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
44420
45139
|
var CHART_TYPE_STYLES = {
|
|
44421
45140
|
metric: { height: "100px", width: "200px" },
|
|
@@ -44444,6 +45163,22 @@ function StaticChart(props) {
|
|
|
44444
45163
|
prevPage,
|
|
44445
45164
|
sortRows: sortRows3
|
|
44446
45165
|
} = useDashboardReportInternal(reportId);
|
|
45166
|
+
useEffect20(() => {
|
|
45167
|
+
profileDashboard("static-chart-state", {
|
|
45168
|
+
reportId,
|
|
45169
|
+
loading,
|
|
45170
|
+
hasReport: !!report,
|
|
45171
|
+
error: error ?? null,
|
|
45172
|
+
rowCount: report?.rows?.length ?? 0,
|
|
45173
|
+
pivotRowCount: report?.pivotRows?.length ?? 0
|
|
45174
|
+
});
|
|
45175
|
+
}, [reportId, loading, report, error]);
|
|
45176
|
+
useEffect20(() => {
|
|
45177
|
+
profileDashboard("static-chart-mounted", { reportId });
|
|
45178
|
+
return () => {
|
|
45179
|
+
profileDashboard("static-chart-unmounted", { reportId });
|
|
45180
|
+
};
|
|
45181
|
+
}, [reportId]);
|
|
44447
45182
|
const baseStyle = report?.chartType && CHART_TYPE_STYLES[report.chartType] ? CHART_TYPE_STYLES[report.chartType] : DEFAULT_STYLE;
|
|
44448
45183
|
const mergedStyle = className ? { ...containerStyle ?? {} } : { ...baseStyle, ...containerStyle ?? {} };
|
|
44449
45184
|
const safeContainerStyle = {
|
|
@@ -44468,13 +45203,12 @@ function StaticChart(props) {
|
|
|
44468
45203
|
});
|
|
44469
45204
|
};
|
|
44470
45205
|
const useLocalPivotTablePagination = isDashboardPivotTable(report);
|
|
44471
|
-
const config = useMemo21(
|
|
44472
|
-
|
|
44473
|
-
|
|
44474
|
-
|
|
44475
|
-
|
|
44476
|
-
|
|
44477
|
-
}, [report, useLocalPivotTablePagination]);
|
|
45206
|
+
const config = useMemo21(
|
|
45207
|
+
() => report ? prepareStaticChartReport(report, {
|
|
45208
|
+
removePagination: useLocalPivotTablePagination
|
|
45209
|
+
}) : void 0,
|
|
45210
|
+
[report, useLocalPivotTablePagination]
|
|
45211
|
+
);
|
|
44478
45212
|
if (error) {
|
|
44479
45213
|
return /* @__PURE__ */ jsx60(ChartError, { errorMessage: error, containerStyle: safeContainerStyle });
|
|
44480
45214
|
}
|
|
@@ -45258,7 +45992,7 @@ var QuillProvider_default = QuillProvider;
|
|
|
45258
45992
|
// src/Table.tsx
|
|
45259
45993
|
import {
|
|
45260
45994
|
useContext as useContext23,
|
|
45261
|
-
useEffect as
|
|
45995
|
+
useEffect as useEffect21,
|
|
45262
45996
|
useMemo as useMemo23,
|
|
45263
45997
|
useState as useState27
|
|
45264
45998
|
} from "react";
|
|
@@ -45331,7 +46065,7 @@ var Table = ({
|
|
|
45331
46065
|
setLoading(false);
|
|
45332
46066
|
}
|
|
45333
46067
|
};
|
|
45334
|
-
|
|
46068
|
+
useEffect21(() => {
|
|
45335
46069
|
if (props.reportId === void 0 || props.reportId === "" || clientLoading) {
|
|
45336
46070
|
return;
|
|
45337
46071
|
}
|
|
@@ -45443,7 +46177,7 @@ var Table_default = Table;
|
|
|
45443
46177
|
import {
|
|
45444
46178
|
useState as useState33,
|
|
45445
46179
|
useContext as useContext30,
|
|
45446
|
-
useEffect as
|
|
46180
|
+
useEffect as useEffect26,
|
|
45447
46181
|
useRef as useRef20,
|
|
45448
46182
|
useMemo as useMemo28,
|
|
45449
46183
|
useCallback as useCallback4
|
|
@@ -45452,7 +46186,7 @@ import MonacoEditor from "@monaco-editor/react";
|
|
|
45452
46186
|
|
|
45453
46187
|
// src/ChartBuilder.tsx
|
|
45454
46188
|
import {
|
|
45455
|
-
useEffect as
|
|
46189
|
+
useEffect as useEffect24,
|
|
45456
46190
|
useRef as useRef19,
|
|
45457
46191
|
useState as useState31,
|
|
45458
46192
|
useContext as useContext28,
|
|
@@ -45482,7 +46216,7 @@ import {
|
|
|
45482
46216
|
useContext as useContext25,
|
|
45483
46217
|
useMemo as useMemo24,
|
|
45484
46218
|
useState as useState28,
|
|
45485
|
-
useEffect as
|
|
46219
|
+
useEffect as useEffect22,
|
|
45486
46220
|
useRef as useRef16
|
|
45487
46221
|
} from "react";
|
|
45488
46222
|
|
|
@@ -46110,7 +46844,7 @@ var PivotModal = ({
|
|
|
46110
46844
|
setDateRanges(dateRangeByColumn || {});
|
|
46111
46845
|
}
|
|
46112
46846
|
};
|
|
46113
|
-
|
|
46847
|
+
useEffect22(() => {
|
|
46114
46848
|
const calculatePivotCardSize = () => {
|
|
46115
46849
|
if (rowFieldRef.current && colFieldRef.current) {
|
|
46116
46850
|
const rowFieldSize = rowFieldRef.current?.getBoundingClientRect();
|
|
@@ -46131,7 +46865,7 @@ var PivotModal = ({
|
|
|
46131
46865
|
}, 500);
|
|
46132
46866
|
}
|
|
46133
46867
|
}, [showUpdatePivot, isOpen]);
|
|
46134
|
-
|
|
46868
|
+
useEffect22(() => {
|
|
46135
46869
|
const fetchPivotData = async () => {
|
|
46136
46870
|
if (pivotRowField && data && columns && pivotAggregations2?.every((p) => p?.valueField && p?.aggregationType)) {
|
|
46137
46871
|
const pivot = buildCurrentPivot();
|
|
@@ -46243,7 +46977,7 @@ var PivotModal = ({
|
|
|
46243
46977
|
};
|
|
46244
46978
|
fetchPivotData();
|
|
46245
46979
|
}, [initialSelectedPivotTable]);
|
|
46246
|
-
|
|
46980
|
+
useEffect22(() => {
|
|
46247
46981
|
if (pivotRowField && data && columns) {
|
|
46248
46982
|
getDistinctValues();
|
|
46249
46983
|
getAllDateRangesByColumn();
|
|
@@ -46251,7 +46985,7 @@ var PivotModal = ({
|
|
|
46251
46985
|
getDistinctValues();
|
|
46252
46986
|
}
|
|
46253
46987
|
}, [initialSelectedPivotTable, columns, data, pivotRowField]);
|
|
46254
|
-
|
|
46988
|
+
useEffect22(() => {
|
|
46255
46989
|
setAllowedFields(initialUniqueValues || {});
|
|
46256
46990
|
setUniqueValues(initialUniqueValues);
|
|
46257
46991
|
}, [initialUniqueValues, columns]);
|
|
@@ -46263,7 +46997,7 @@ var PivotModal = ({
|
|
|
46263
46997
|
return possibleColumns;
|
|
46264
46998
|
};
|
|
46265
46999
|
const [selectedPivotTable, setSelectedPivotTable] = useState28(null);
|
|
46266
|
-
|
|
47000
|
+
useEffect22(() => {
|
|
46267
47001
|
const fetchPivotTables = async () => {
|
|
46268
47002
|
if (selectedPivotIndex === -1) {
|
|
46269
47003
|
return null;
|
|
@@ -46317,7 +47051,7 @@ var PivotModal = ({
|
|
|
46317
47051
|
fetchPivotTables();
|
|
46318
47052
|
}, [selectedPivotIndex, data, dateRange, createdPivots]);
|
|
46319
47053
|
const previousUniqueValuesRef = useRef16();
|
|
46320
|
-
|
|
47054
|
+
useEffect22(() => {
|
|
46321
47055
|
if (!uniqueValuesIsLoading && !equal5(uniqueValues, previousUniqueValuesRef.current)) {
|
|
46322
47056
|
previousUniqueValuesRef.current = uniqueValues;
|
|
46323
47057
|
setRecommendedPivotTables([]);
|
|
@@ -46805,7 +47539,7 @@ var PivotModal = ({
|
|
|
46805
47539
|
[]
|
|
46806
47540
|
);
|
|
46807
47541
|
const [createdPivotTables, setCreatedPivotTables] = useState28([]);
|
|
46808
|
-
|
|
47542
|
+
useEffect22(() => {
|
|
46809
47543
|
const fetchPivotTables = async () => {
|
|
46810
47544
|
const pts = await Promise.all(
|
|
46811
47545
|
createdPivots.map(async (p) => {
|
|
@@ -46879,7 +47613,7 @@ var PivotModal = ({
|
|
|
46879
47613
|
setPopoverPosition("bottom");
|
|
46880
47614
|
}
|
|
46881
47615
|
};
|
|
46882
|
-
|
|
47616
|
+
useEffect22(() => {
|
|
46883
47617
|
handleResize();
|
|
46884
47618
|
window.addEventListener("resize", handleResize);
|
|
46885
47619
|
const parentElement = parentRef?.current;
|
|
@@ -47725,7 +48459,7 @@ var validateReport = (formData, dashboardData, defaultDateFilter, allTables) =>
|
|
|
47725
48459
|
// src/components/Chart/InternalChart.tsx
|
|
47726
48460
|
import {
|
|
47727
48461
|
useState as useState29,
|
|
47728
|
-
useEffect as
|
|
48462
|
+
useEffect as useEffect23,
|
|
47729
48463
|
useContext as useContext26,
|
|
47730
48464
|
useMemo as useMemo25,
|
|
47731
48465
|
useRef as useRef17,
|
|
@@ -47884,7 +48618,7 @@ function InternalChart({
|
|
|
47884
48618
|
const [lockedFilters, setLockedFilters] = useState29(
|
|
47885
48619
|
{}
|
|
47886
48620
|
);
|
|
47887
|
-
|
|
48621
|
+
useEffect23(() => {
|
|
47888
48622
|
return () => {
|
|
47889
48623
|
Object.values(multiselectDebounceRef.current).forEach((timer) => {
|
|
47890
48624
|
if (timer) {
|
|
@@ -47893,7 +48627,7 @@ function InternalChart({
|
|
|
47893
48627
|
});
|
|
47894
48628
|
};
|
|
47895
48629
|
}, []);
|
|
47896
|
-
|
|
48630
|
+
useEffect23(() => {
|
|
47897
48631
|
if (reportDateFilter) {
|
|
47898
48632
|
const customDateFilter = filters?.find(
|
|
47899
48633
|
(f) => f.filterType === "date" /* Date */
|
|
@@ -49139,7 +49873,7 @@ function ChartBuilderWithModal(props) {
|
|
|
49139
49873
|
const [filtersEnabledState, setFiltersEnabledState] = useState31(
|
|
49140
49874
|
!!props.reportId
|
|
49141
49875
|
);
|
|
49142
|
-
|
|
49876
|
+
useEffect24(() => {
|
|
49143
49877
|
function handleResize() {
|
|
49144
49878
|
const screenSize = window.innerWidth;
|
|
49145
49879
|
if (screenSize >= 1200) {
|
|
@@ -49378,7 +50112,7 @@ function ChartBuilder({
|
|
|
49378
50112
|
setFilterIssues([]);
|
|
49379
50113
|
}
|
|
49380
50114
|
};
|
|
49381
|
-
|
|
50115
|
+
useEffect24(() => {
|
|
49382
50116
|
const handleResize = () => {
|
|
49383
50117
|
setWindowWidth(window.innerWidth);
|
|
49384
50118
|
if (inputRef.current && selectRef.current) {
|
|
@@ -49414,7 +50148,7 @@ function ChartBuilder({
|
|
|
49414
50148
|
const hasExistingData = useMemo27(() => {
|
|
49415
50149
|
return report?.rows && report.rows.length > 0 || report?.pivotRows && report.pivotRows.length > 0;
|
|
49416
50150
|
}, [report?.rows, report?.pivotRows]);
|
|
49417
|
-
|
|
50151
|
+
useEffect24(() => {
|
|
49418
50152
|
if (!reportFilters[report?.id ?? TEMP_REPORT_ID]) {
|
|
49419
50153
|
loadFiltersForReport(
|
|
49420
50154
|
report?.id ?? TEMP_REPORT_ID,
|
|
@@ -49873,12 +50607,12 @@ function ChartBuilder({
|
|
|
49873
50607
|
customFieldsInTabularColumns,
|
|
49874
50608
|
chartBuilderFormDataContainsCustomFields
|
|
49875
50609
|
]);
|
|
49876
|
-
|
|
50610
|
+
useEffect24(() => {
|
|
49877
50611
|
if (!loadingFormData && triggeredEditChart) {
|
|
49878
50612
|
editChart();
|
|
49879
50613
|
}
|
|
49880
50614
|
}, [loadingFormData]);
|
|
49881
|
-
|
|
50615
|
+
useEffect24(() => {
|
|
49882
50616
|
if (initializedRef.current) {
|
|
49883
50617
|
return;
|
|
49884
50618
|
}
|
|
@@ -50006,13 +50740,13 @@ function ChartBuilder({
|
|
|
50006
50740
|
}
|
|
50007
50741
|
getFormData();
|
|
50008
50742
|
}, []);
|
|
50009
|
-
|
|
50743
|
+
useEffect24(() => {
|
|
50010
50744
|
if (report?.triggerReload === false && report?.rows) {
|
|
50011
50745
|
setRows(report.rows);
|
|
50012
50746
|
setIsLoading(false);
|
|
50013
50747
|
}
|
|
50014
50748
|
}, [report?.triggerReload, report?.rows]);
|
|
50015
|
-
|
|
50749
|
+
useEffect24(() => {
|
|
50016
50750
|
if (!report?.rows || report.rows.length === 0) return;
|
|
50017
50751
|
setRows((prev) => {
|
|
50018
50752
|
if (prev.length > 0) return prev;
|
|
@@ -50020,7 +50754,7 @@ function ChartBuilder({
|
|
|
50020
50754
|
return report.rows;
|
|
50021
50755
|
});
|
|
50022
50756
|
}, [report?.rows]);
|
|
50023
|
-
|
|
50757
|
+
useEffect24(() => {
|
|
50024
50758
|
if (report?.triggerReload === false && report?.columns && report.columns.length > 0 && formData.columns.length === 0) {
|
|
50025
50759
|
const mappedColumns = report.columns.map((col) => ({
|
|
50026
50760
|
...col,
|
|
@@ -50033,7 +50767,7 @@ function ChartBuilder({
|
|
|
50033
50767
|
}
|
|
50034
50768
|
}, [report?.triggerReload, report?.columns, formData.columns.length]);
|
|
50035
50769
|
const ranMountQuery = useRef19(false);
|
|
50036
|
-
|
|
50770
|
+
useEffect24(() => {
|
|
50037
50771
|
if (runQueryOnMount && reportFiltersLoaded && filtersEnabled && !ranMountQuery.current) {
|
|
50038
50772
|
ranMountQuery.current = true;
|
|
50039
50773
|
handleRunQuery(baseProcessing, currentDashboardFilters);
|
|
@@ -50270,7 +51004,7 @@ function ChartBuilder({
|
|
|
50270
51004
|
});
|
|
50271
51005
|
};
|
|
50272
51006
|
const filtersEnabledRef = useRef19(filtersEnabled);
|
|
50273
|
-
|
|
51007
|
+
useEffect24(() => {
|
|
50274
51008
|
if (filtersEnabledRef.current !== filtersEnabled) {
|
|
50275
51009
|
filtersEnabledRef.current = filtersEnabled;
|
|
50276
51010
|
setCurrentPage(0);
|
|
@@ -53085,7 +53819,7 @@ function reconcileReportWithColumns(report, columns, previousReport) {
|
|
|
53085
53819
|
}
|
|
53086
53820
|
|
|
53087
53821
|
// src/hooks/useLongLoading.tsx
|
|
53088
|
-
import { useContext as useContext29, useEffect as
|
|
53822
|
+
import { useContext as useContext29, useEffect as useEffect25, useState as useState32 } from "react";
|
|
53089
53823
|
function useLongLoading(isLoading, meta) {
|
|
53090
53824
|
const {
|
|
53091
53825
|
origin,
|
|
@@ -53096,7 +53830,7 @@ function useLongLoading(isLoading, meta) {
|
|
|
53096
53830
|
const [isLongLoading, setIsLongLoading] = useState32(false);
|
|
53097
53831
|
const [isAbnormalLoading, setIsAbnormalLoading] = useState32(false);
|
|
53098
53832
|
const { eventTracking } = useContext29(EventTrackingContext);
|
|
53099
|
-
|
|
53833
|
+
useEffect25(() => {
|
|
53100
53834
|
let longTimer = null;
|
|
53101
53835
|
let abnormalTimer = null;
|
|
53102
53836
|
if (isLoading) {
|
|
@@ -53354,17 +54088,17 @@ function SQLEditor({
|
|
|
53354
54088
|
schemaData.schemaWithCustomFields,
|
|
53355
54089
|
destinationDashboardConfig?.tenantKeys
|
|
53356
54090
|
]);
|
|
53357
|
-
|
|
54091
|
+
useEffect26(() => {
|
|
53358
54092
|
if (tableRef.current) {
|
|
53359
54093
|
setCachedHeight(tableRef.current.clientHeight);
|
|
53360
54094
|
}
|
|
53361
54095
|
}, [tableRef.current?.clientHeight]);
|
|
53362
|
-
|
|
54096
|
+
useEffect26(() => {
|
|
53363
54097
|
if (!data && !dashboardIsLoading) {
|
|
53364
54098
|
reload();
|
|
53365
54099
|
}
|
|
53366
54100
|
}, [data, dashboardIsLoading]);
|
|
53367
|
-
|
|
54101
|
+
useEffect26(() => {
|
|
53368
54102
|
const loadReport = async () => {
|
|
53369
54103
|
let reportToLoad;
|
|
53370
54104
|
if (!client) {
|
|
@@ -53439,14 +54173,14 @@ function SQLEditor({
|
|
|
53439
54173
|
);
|
|
53440
54174
|
}) ?? [];
|
|
53441
54175
|
}, [tableSearchQuery, schemaData.schemaWithCustomFields]);
|
|
53442
|
-
|
|
54176
|
+
useEffect26(() => {
|
|
53443
54177
|
if (client) {
|
|
53444
54178
|
setRows([]);
|
|
53445
54179
|
setColumns([]);
|
|
53446
54180
|
setDisplayTable(false);
|
|
53447
54181
|
}
|
|
53448
54182
|
}, [client?.id]);
|
|
53449
|
-
|
|
54183
|
+
useEffect26(() => {
|
|
53450
54184
|
if (isChartBuilderOpen === false) {
|
|
53451
54185
|
onCloseChartBuilder && onCloseChartBuilder();
|
|
53452
54186
|
}
|
|
@@ -53713,7 +54447,7 @@ function SQLEditor({
|
|
|
53713
54447
|
}
|
|
53714
54448
|
return getTablesHelper(getSelectFromAST(resp.ast), dbTables, skipStar);
|
|
53715
54449
|
};
|
|
53716
|
-
|
|
54450
|
+
useEffect26(() => {
|
|
53717
54451
|
if (onChangeQuery) {
|
|
53718
54452
|
onChangeQuery(query || "");
|
|
53719
54453
|
}
|
|
@@ -54342,7 +55076,7 @@ var SQLEditorComponent = ({
|
|
|
54342
55076
|
const [editorKey, setEditorKey] = useState33(0);
|
|
54343
55077
|
const { eventTracking } = useContext30(EventTrackingContext);
|
|
54344
55078
|
const currentProvider = useRef20(null);
|
|
54345
|
-
|
|
55079
|
+
useEffect26(() => {
|
|
54346
55080
|
if (currentProvider.current) {
|
|
54347
55081
|
currentProvider.current.dispose();
|
|
54348
55082
|
if (schema && schema.length !== 0) {
|
|
@@ -54812,14 +55546,14 @@ function SchemaItem({
|
|
|
54812
55546
|
// src/ReportBuilder.tsx
|
|
54813
55547
|
import {
|
|
54814
55548
|
useContext as useContext34,
|
|
54815
|
-
useEffect as
|
|
55549
|
+
useEffect as useEffect30,
|
|
54816
55550
|
useRef as useRef22,
|
|
54817
55551
|
useState as useState39
|
|
54818
55552
|
} from "react";
|
|
54819
55553
|
init_constants();
|
|
54820
55554
|
|
|
54821
55555
|
// src/hooks/useReportBuilder.tsx
|
|
54822
|
-
import { useContext as useContext31, useEffect as
|
|
55556
|
+
import { useContext as useContext31, useEffect as useEffect27, useMemo as useMemo29, useState as useState34 } from "react";
|
|
54823
55557
|
init_tableProcessing();
|
|
54824
55558
|
init_ReportBuilder();
|
|
54825
55559
|
init_constants();
|
|
@@ -56047,7 +56781,7 @@ var useReportBuilderInternal = ({
|
|
|
56047
56781
|
flags: tempReport?.flags
|
|
56048
56782
|
});
|
|
56049
56783
|
};
|
|
56050
|
-
|
|
56784
|
+
useEffect27(() => {
|
|
56051
56785
|
if (!client) {
|
|
56052
56786
|
return;
|
|
56053
56787
|
}
|
|
@@ -56081,7 +56815,7 @@ var useReportBuilderInternal = ({
|
|
|
56081
56815
|
}
|
|
56082
56816
|
return state;
|
|
56083
56817
|
};
|
|
56084
|
-
|
|
56818
|
+
useEffect27(() => {
|
|
56085
56819
|
const loadChart = async () => {
|
|
56086
56820
|
if (!client || !reportId) return;
|
|
56087
56821
|
const report = allReportsById[reportId];
|
|
@@ -56119,7 +56853,7 @@ var useReportBuilderInternal = ({
|
|
|
56119
56853
|
loadChart();
|
|
56120
56854
|
}
|
|
56121
56855
|
}, [allReportsById[reportId || ""], client]);
|
|
56122
|
-
|
|
56856
|
+
useEffect27(() => {
|
|
56123
56857
|
if (initialTableName) {
|
|
56124
56858
|
const tableColumns = filteredSchema.find((table) => {
|
|
56125
56859
|
return table.name === initialTableName;
|
|
@@ -56139,7 +56873,7 @@ var useReportBuilderInternal = ({
|
|
|
56139
56873
|
}
|
|
56140
56874
|
}
|
|
56141
56875
|
}, [filteredSchema, initialTableName]);
|
|
56142
|
-
|
|
56876
|
+
useEffect27(() => {
|
|
56143
56877
|
if (!data && !dashboardIsLoading) {
|
|
56144
56878
|
reload();
|
|
56145
56879
|
}
|
|
@@ -56349,7 +57083,7 @@ var useReportBuilder = ({
|
|
|
56349
57083
|
init_ReportBuilder();
|
|
56350
57084
|
|
|
56351
57085
|
// src/components/ReportBuilder/AddColumnModal.tsx
|
|
56352
|
-
import { useState as useState35, useRef as useRef21, useMemo as useMemo30, useEffect as
|
|
57086
|
+
import { useState as useState35, useRef as useRef21, useMemo as useMemo30, useEffect as useEffect28, useContext as useContext32 } from "react";
|
|
56353
57087
|
import {
|
|
56354
57088
|
DndContext as DndContext2,
|
|
56355
57089
|
closestCenter as closestCenter2,
|
|
@@ -56425,13 +57159,13 @@ function AddColumnModal({
|
|
|
56425
57159
|
return columnOptions.includes(column) && (search.length === 0 || column.toLowerCase().includes(search.toLowerCase()) || snakeAndCamelCaseToTitleCase(column).toLowerCase().includes(search.toLowerCase()));
|
|
56426
57160
|
});
|
|
56427
57161
|
}, [search, columnOptions, orderedColumnNames]);
|
|
56428
|
-
|
|
57162
|
+
useEffect28(() => {
|
|
56429
57163
|
const remainingColumns = columnOptions.filter(
|
|
56430
57164
|
(col) => !modalSelectedColumns.includes(col)
|
|
56431
57165
|
);
|
|
56432
57166
|
setOrderedColumnNames([...modalSelectedColumns, ...remainingColumns]);
|
|
56433
57167
|
}, [columnOptions]);
|
|
56434
|
-
|
|
57168
|
+
useEffect28(() => {
|
|
56435
57169
|
if (!schemaLoading && initialLoad) {
|
|
56436
57170
|
setTimeout(() => setInitialLoad(false), 200);
|
|
56437
57171
|
}
|
|
@@ -57314,7 +58048,7 @@ var AddFilters = ({
|
|
|
57314
58048
|
};
|
|
57315
58049
|
|
|
57316
58050
|
// src/internals/ReportBuilder/PivotForm.tsx
|
|
57317
|
-
import { useContext as useContext33, useEffect as
|
|
58051
|
+
import { useContext as useContext33, useEffect as useEffect29, useState as useState36 } from "react";
|
|
57318
58052
|
init_textProcessing();
|
|
57319
58053
|
init_pivotProcessing();
|
|
57320
58054
|
import { jsx as jsx77, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
@@ -57358,7 +58092,7 @@ function PivotForm({
|
|
|
57358
58092
|
);
|
|
57359
58093
|
const [showLimitInput, setShowLimitInput] = useState36(!!pivotLimit);
|
|
57360
58094
|
const [showSortInput, setShowSortInput] = useState36(!!pivotSort);
|
|
57361
|
-
|
|
58095
|
+
useEffect29(() => {
|
|
57362
58096
|
if (uniqueValues) {
|
|
57363
58097
|
const possibleColumns = getPossiblePivotFieldOptions(
|
|
57364
58098
|
columns,
|
|
@@ -57369,12 +58103,12 @@ function PivotForm({
|
|
|
57369
58103
|
setAllowedValueFields(possibleColumns.valueFields);
|
|
57370
58104
|
}
|
|
57371
58105
|
}, [columns, uniqueValues]);
|
|
57372
|
-
|
|
58106
|
+
useEffect29(() => {
|
|
57373
58107
|
setSortFieldInput(pivotSort?.sortField ?? "");
|
|
57374
58108
|
setSortDirectionInput(pivotSort?.sortDirection ?? "");
|
|
57375
58109
|
setShowSortInput(!!pivotSort);
|
|
57376
58110
|
}, [pivotSort]);
|
|
57377
|
-
|
|
58111
|
+
useEffect29(() => {
|
|
57378
58112
|
setLimitInput(pivotLimit?.toString() ?? "");
|
|
57379
58113
|
setShowLimitInput(!!pivotLimit);
|
|
57380
58114
|
}, [pivotLimit]);
|
|
@@ -58916,7 +59650,7 @@ function ReportBuilder({
|
|
|
58916
59650
|
setTimeout(() => setIsCopying(false), 800);
|
|
58917
59651
|
}
|
|
58918
59652
|
};
|
|
58919
|
-
|
|
59653
|
+
useEffect30(() => {
|
|
58920
59654
|
if (isChartBuilderOpen === false) {
|
|
58921
59655
|
onCloseChartBuilder && onCloseChartBuilder();
|
|
58922
59656
|
}
|
|
@@ -59350,7 +60084,7 @@ function ReportBuilder({
|
|
|
59350
60084
|
// src/ChartEditor.tsx
|
|
59351
60085
|
import {
|
|
59352
60086
|
useContext as useContext35,
|
|
59353
|
-
useEffect as
|
|
60087
|
+
useEffect as useEffect31,
|
|
59354
60088
|
useMemo as useMemo32,
|
|
59355
60089
|
useRef as useRef23,
|
|
59356
60090
|
useState as useState40
|
|
@@ -59434,7 +60168,7 @@ function ChartEditor({
|
|
|
59434
60168
|
const dateRange = useMemo32(() => {
|
|
59435
60169
|
return dateFilter?.startDate ? { start: dateFilter.startDate, end: dateFilter.endDate } : void 0;
|
|
59436
60170
|
}, [dateFilter]);
|
|
59437
|
-
|
|
60171
|
+
useEffect31(() => {
|
|
59438
60172
|
function handleResize() {
|
|
59439
60173
|
const screenSize = window.innerWidth;
|
|
59440
60174
|
if (screenSize >= 1200) {
|
|
@@ -59482,7 +60216,7 @@ function ChartEditor({
|
|
|
59482
60216
|
}
|
|
59483
60217
|
addReport(report2);
|
|
59484
60218
|
};
|
|
59485
|
-
|
|
60219
|
+
useEffect31(() => {
|
|
59486
60220
|
if (!isOpen || !reportId) {
|
|
59487
60221
|
return;
|
|
59488
60222
|
}
|
|
@@ -59579,7 +60313,7 @@ function ChartEditor({
|
|
|
59579
60313
|
}
|
|
59580
60314
|
|
|
59581
60315
|
// src/Chat.tsx
|
|
59582
|
-
import { useContext as useContext37, useEffect as useEffect33, useRef as useRef25, useState as
|
|
60316
|
+
import { useContext as useContext37, useEffect as useEffect33, useRef as useRef25, useState as useState42 } from "react";
|
|
59583
60317
|
|
|
59584
60318
|
// src/ChatChartCard.tsx
|
|
59585
60319
|
import { useMemo as useMemo34 } from "react";
|
|
@@ -59595,7 +60329,7 @@ import {
|
|
|
59595
60329
|
useMemo as useMemo33,
|
|
59596
60330
|
useReducer as useReducer2,
|
|
59597
60331
|
useRef as useRef24,
|
|
59598
|
-
useState as
|
|
60332
|
+
useState as useState41
|
|
59599
60333
|
} from "react";
|
|
59600
60334
|
import {
|
|
59601
60335
|
keepPreviousData,
|
|
@@ -60786,20 +61520,6 @@ function useFormReducer(state, action) {
|
|
|
60786
61520
|
}
|
|
60787
61521
|
}
|
|
60788
61522
|
|
|
60789
|
-
// src/hooks/useForm.refreshDebounce.ts
|
|
60790
|
-
import { useEffect as useEffect31, useState as useState41 } from "react";
|
|
60791
|
-
var REPORT_REFRESH_DEBOUNCE_MS = 200;
|
|
60792
|
-
function useDebouncedRefreshInput(value, delayMs = REPORT_REFRESH_DEBOUNCE_MS) {
|
|
60793
|
-
const [debouncedValue, setDebouncedValue] = useState41(value);
|
|
60794
|
-
useEffect31(() => {
|
|
60795
|
-
const timeout = setTimeout(() => {
|
|
60796
|
-
setDebouncedValue(value);
|
|
60797
|
-
}, delayMs);
|
|
60798
|
-
return () => clearTimeout(timeout);
|
|
60799
|
-
}, [delayMs, value]);
|
|
60800
|
-
return debouncedValue;
|
|
60801
|
-
}
|
|
60802
|
-
|
|
60803
61523
|
// src/utils/pivotDateBuckets.ts
|
|
60804
61524
|
import {
|
|
60805
61525
|
eachDayOfInterval as eachDayOfInterval3,
|
|
@@ -61933,22 +62653,6 @@ var buildQueryBuilderFieldConfigByName = (schemaTables) => {
|
|
|
61933
62653
|
function getReportBuilderTableNames(report) {
|
|
61934
62654
|
return (report?.reportBuilderState?.tables ?? []).map((table) => String(table.name ?? "").trim()).filter(Boolean);
|
|
61935
62655
|
}
|
|
61936
|
-
function getPivotAggregations(report) {
|
|
61937
|
-
const pivot = report.pivot;
|
|
61938
|
-
if (!pivot) return [];
|
|
61939
|
-
if ("aggregations" in pivot && Array.isArray(pivot.aggregations)) {
|
|
61940
|
-
return pivot.aggregations;
|
|
61941
|
-
}
|
|
61942
|
-
if ("aggregationType" in pivot && pivot.aggregationType) {
|
|
61943
|
-
return [
|
|
61944
|
-
{
|
|
61945
|
-
aggregationType: pivot.aggregationType,
|
|
61946
|
-
valueField: pivot.valueField
|
|
61947
|
-
}
|
|
61948
|
-
];
|
|
61949
|
-
}
|
|
61950
|
-
return [];
|
|
61951
|
-
}
|
|
61952
62656
|
function trimAggregationSuffix(value, aggregationType) {
|
|
61953
62657
|
if (!aggregationType) return value;
|
|
61954
62658
|
const suffixes = [`_${aggregationType}`, `:${aggregationType}`];
|
|
@@ -61956,16 +62660,6 @@ function trimAggregationSuffix(value, aggregationType) {
|
|
|
61956
62660
|
if (!matchedSuffix) return value;
|
|
61957
62661
|
return value.slice(0, -matchedSuffix.length);
|
|
61958
62662
|
}
|
|
61959
|
-
function getAggregationFieldKey(aggregation, hasMultipleAggregations) {
|
|
61960
|
-
if (!aggregation.aggregationType) return null;
|
|
61961
|
-
if (!aggregation.valueField && aggregation.aggregationType === "percentage") {
|
|
61962
|
-
return "percentage";
|
|
61963
|
-
}
|
|
61964
|
-
if (aggregation.valueField) {
|
|
61965
|
-
return hasMultipleAggregations ? `${aggregation.valueField}_${aggregation.aggregationType}` : aggregation.valueField;
|
|
61966
|
-
}
|
|
61967
|
-
return hasMultipleAggregations ? `${aggregation.aggregationType}_${aggregation.aggregationType}` : String(aggregation.aggregationType);
|
|
61968
|
-
}
|
|
61969
62663
|
function buildSyntheticAggregationOnlyDisplayRows(chart) {
|
|
61970
62664
|
const pivot = chart.pivot;
|
|
61971
62665
|
if (!pivot) return null;
|
|
@@ -62005,69 +62699,6 @@ function buildSyntheticAggregationOnlyDisplayRows(chart) {
|
|
|
62005
62699
|
}
|
|
62006
62700
|
return null;
|
|
62007
62701
|
}
|
|
62008
|
-
function trailingPivotMeasureSegmentBeforeAggType(normalizedField, normalizedAggregationType) {
|
|
62009
|
-
const suf = `_${normalizedAggregationType}`;
|
|
62010
|
-
if (!normalizedField.endsWith(suf)) return null;
|
|
62011
|
-
const base = normalizedField.slice(0, -suf.length);
|
|
62012
|
-
const lastUnderscore = base.lastIndexOf("_");
|
|
62013
|
-
if (lastUnderscore < 0) return null;
|
|
62014
|
-
const candidate = base.slice(lastUnderscore + 1).trim();
|
|
62015
|
-
return candidate || null;
|
|
62016
|
-
}
|
|
62017
|
-
var PIVOT_FIELD_AGG_MATCH_TIER = {
|
|
62018
|
-
looseAggSuffix: 1,
|
|
62019
|
-
rawValueField: 2,
|
|
62020
|
-
pivotWideValueAndAggSuffix: 3,
|
|
62021
|
-
canonicalValueAggOrCount: 4
|
|
62022
|
-
};
|
|
62023
|
-
function matchPivotFieldToAggregationTier(normalizedField, aggregation) {
|
|
62024
|
-
const aggregationType = String(aggregation.aggregationType ?? "").trim();
|
|
62025
|
-
if (!aggregationType) return null;
|
|
62026
|
-
const t = aggregationType.toLowerCase();
|
|
62027
|
-
const vf = String(aggregation.valueField ?? "").trim().toLowerCase();
|
|
62028
|
-
if (!vf && normalizedField === t) {
|
|
62029
|
-
return PIVOT_FIELD_AGG_MATCH_TIER.canonicalValueAggOrCount;
|
|
62030
|
-
}
|
|
62031
|
-
if (vf && normalizedField === vf) {
|
|
62032
|
-
return PIVOT_FIELD_AGG_MATCH_TIER.rawValueField;
|
|
62033
|
-
}
|
|
62034
|
-
if (vf && normalizedField === `${vf}_${t}`) {
|
|
62035
|
-
return PIVOT_FIELD_AGG_MATCH_TIER.canonicalValueAggOrCount;
|
|
62036
|
-
}
|
|
62037
|
-
if (vf && normalizedField.endsWith(`_${vf}_${t}`)) {
|
|
62038
|
-
return PIVOT_FIELD_AGG_MATCH_TIER.pivotWideValueAndAggSuffix;
|
|
62039
|
-
}
|
|
62040
|
-
if (normalizedField.endsWith(`_${t}`) || normalizedField.endsWith(`:${t}`)) {
|
|
62041
|
-
const embeddedMeasure = trailingPivotMeasureSegmentBeforeAggType(
|
|
62042
|
-
normalizedField,
|
|
62043
|
-
t
|
|
62044
|
-
);
|
|
62045
|
-
if (embeddedMeasure && vf && embeddedMeasure !== vf) {
|
|
62046
|
-
return null;
|
|
62047
|
-
}
|
|
62048
|
-
return PIVOT_FIELD_AGG_MATCH_TIER.looseAggSuffix;
|
|
62049
|
-
}
|
|
62050
|
-
return null;
|
|
62051
|
-
}
|
|
62052
|
-
function findAggregationForFieldStrict(field, aggregations) {
|
|
62053
|
-
const normalizedField = String(field ?? "").trim().toLowerCase();
|
|
62054
|
-
let best = null;
|
|
62055
|
-
for (let index = 0; index < aggregations.length; index++) {
|
|
62056
|
-
const aggregation = aggregations[index];
|
|
62057
|
-
const tier = matchPivotFieldToAggregationTier(normalizedField, aggregation);
|
|
62058
|
-
if (tier == null) continue;
|
|
62059
|
-
if (!best || tier > best.tier || tier === best.tier && index < best.index) {
|
|
62060
|
-
best = { aggregation, tier, index };
|
|
62061
|
-
}
|
|
62062
|
-
}
|
|
62063
|
-
return best?.aggregation;
|
|
62064
|
-
}
|
|
62065
|
-
function getAggregationIdentityKey(aggregation) {
|
|
62066
|
-
if (!aggregation) return "";
|
|
62067
|
-
const aggregationType = String(aggregation.aggregationType ?? "").trim().toLowerCase();
|
|
62068
|
-
const valueField = String(aggregation.valueField ?? "").trim().toLowerCase();
|
|
62069
|
-
return `${aggregationType}::${valueField}`;
|
|
62070
|
-
}
|
|
62071
62702
|
function buildAggregationLabel(aggregation, report) {
|
|
62072
62703
|
const aggregationType = aggregation.aggregationType ?? "value";
|
|
62073
62704
|
const reportBuilderTableNames = report?.reportBuilderState?.tables?.map((table) => table.name).filter(Boolean) ?? [];
|
|
@@ -64617,10 +65248,10 @@ function generateDraftSessionId() {
|
|
|
64617
65248
|
}
|
|
64618
65249
|
function useReport(reportIdArg, options = {}) {
|
|
64619
65250
|
const propReportId = String(reportIdArg ?? "").trim();
|
|
64620
|
-
const [createdReportBootstrap, setCreatedReportBootstrap] =
|
|
65251
|
+
const [createdReportBootstrap, setCreatedReportBootstrap] = useState41(null);
|
|
64621
65252
|
const effectiveReportId = propReportId || createdReportBootstrap?.reportId || "";
|
|
64622
65253
|
const { eventTracking } = useContext36(EventTrackingContext);
|
|
64623
|
-
const [draftSessionId, setDraftSessionId] =
|
|
65254
|
+
const [draftSessionId, setDraftSessionId] = useState41(generateDraftSessionId);
|
|
64624
65255
|
const useInMemoryEngines = options.useInMemoryEngines ?? false;
|
|
64625
65256
|
const dateBucketMode = options.dateBucketMode ?? "dynamic";
|
|
64626
65257
|
const restrictFieldOptionsToSelectedDatasources = options.restrictFieldOptionsToSelectedDatasources ?? true;
|
|
@@ -64634,7 +65265,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64634
65265
|
...getDefaultPaginationState(),
|
|
64635
65266
|
...options.initialState?.pagination ?? {}
|
|
64636
65267
|
});
|
|
64637
|
-
const [internalPagination, setInternalPagination] =
|
|
65268
|
+
const [internalPagination, setInternalPagination] = useState41(
|
|
64638
65269
|
initialPaginationRef.current
|
|
64639
65270
|
);
|
|
64640
65271
|
const pagination = controlledPagination ?? internalPagination;
|
|
@@ -64727,13 +65358,13 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64727
65358
|
dateBucketSetViaSetReportRef.current = false;
|
|
64728
65359
|
aggregationStateSetViaSetReportRef.current = false;
|
|
64729
65360
|
}
|
|
64730
|
-
const [chartPivotHydrationEpoch, setChartPivotHydrationEpoch] =
|
|
65361
|
+
const [chartPivotHydrationEpoch, setChartPivotHydrationEpoch] = useState41(0);
|
|
64731
65362
|
const [
|
|
64732
65363
|
expandReportBuilderColumnsForFlatTable,
|
|
64733
65364
|
setExpandReportBuilderColumnsForFlatTable
|
|
64734
|
-
] =
|
|
65365
|
+
] = useState41(false);
|
|
64735
65366
|
const prevPivotStateForColumnExpansionRef = useRef24(null);
|
|
64736
|
-
const [sourceReport, setSourceReport] =
|
|
65367
|
+
const [sourceReport, setSourceReport] = useState41(
|
|
64737
65368
|
null
|
|
64738
65369
|
);
|
|
64739
65370
|
const prevSourceReportIdForPivotHydrationRef = useRef24(null);
|
|
@@ -64748,15 +65379,17 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64748
65379
|
lastPivotHydrateCompletedSourceIdRef.current = null;
|
|
64749
65380
|
}
|
|
64750
65381
|
}
|
|
64751
|
-
const [preserveSchemaWideOptions, setPreserveSchemaWideOptions] =
|
|
64752
|
-
const [initialSchemaScopedTableNames, setInitialSchemaScopedTableNames] =
|
|
64753
|
-
const [tableColumnsEditedSignature, setTableColumnsEditedSignature] =
|
|
65382
|
+
const [preserveSchemaWideOptions, setPreserveSchemaWideOptions] = useState41(false);
|
|
65383
|
+
const [initialSchemaScopedTableNames, setInitialSchemaScopedTableNames] = useState41(null);
|
|
65384
|
+
const [tableColumnsEditedSignature, setTableColumnsEditedSignature] = useState41(null);
|
|
64754
65385
|
useEffect32(() => {
|
|
64755
65386
|
setTableColumnsEditedSignature(null);
|
|
64756
65387
|
}, [effectiveReportId]);
|
|
64757
|
-
const [chartAxisEdits, setChartAxisEdits] =
|
|
64758
|
-
const [chartVisibilityOverrides, setChartVisibilityOverrides] =
|
|
65388
|
+
const [chartAxisEdits, setChartAxisEdits] = useState41({});
|
|
65389
|
+
const [chartVisibilityOverrides, setChartVisibilityOverrides] = useState41({});
|
|
65390
|
+
const [chartSortOverride, setChartSortOverride] = useState41(void 0);
|
|
64759
65391
|
const [client] = useContext36(ClientContext);
|
|
65392
|
+
const { loadDashboard } = useContext36(DashboardConfigContext);
|
|
64760
65393
|
const queryClient = useQueryClient2();
|
|
64761
65394
|
const [schemaData] = useContext36(SchemaDataContext);
|
|
64762
65395
|
const { tenants, flags } = useContext36(TenantContext);
|
|
@@ -64886,6 +65519,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64886
65519
|
useEffect32(() => {
|
|
64887
65520
|
setChartAxisEdits({});
|
|
64888
65521
|
setChartVisibilityOverrides({});
|
|
65522
|
+
setChartSortOverride(void 0);
|
|
64889
65523
|
}, [effectiveReportId]);
|
|
64890
65524
|
const bootstrapReportTaskUsedForReportIdRef = useRef24(null);
|
|
64891
65525
|
const sharedInitialRequestUsedForReportIdRef = useRef24(null);
|
|
@@ -66788,7 +67422,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66788
67422
|
filterStack
|
|
66789
67423
|
]);
|
|
66790
67424
|
const shouldForceTableRefreshFromFilters = !useInMemoryEngines && !pivotState;
|
|
66791
|
-
const
|
|
67425
|
+
const tableRefreshInput = useMemo33(
|
|
66792
67426
|
() => ({
|
|
66793
67427
|
version: tableRefreshVersion,
|
|
66794
67428
|
reportBuilderStateHash: effectiveReportBuilderStateHash,
|
|
@@ -66804,18 +67438,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66804
67438
|
tableRefreshVersion
|
|
66805
67439
|
]
|
|
66806
67440
|
);
|
|
66807
|
-
const debouncedTableRefreshInput = useDebouncedRefreshInput(
|
|
66808
|
-
immediateTableRefreshInput
|
|
66809
|
-
);
|
|
66810
|
-
const disableTableRefreshDebounceForDiagnostics = process.env.NODE_ENV === "test" && process.env.QUILL_DISABLE_REPORT_REFRESH_DEBOUNCE === "true";
|
|
66811
|
-
const tableRefreshInput = disableTableRefreshDebounceForDiagnostics ? immediateTableRefreshInput : debouncedTableRefreshInput;
|
|
66812
|
-
const tableRefreshInputIsCurrent = tableRefreshInput.version === tableRefreshVersion && tableRefreshInput.reportBuilderStateHash === effectiveReportBuilderStateHash;
|
|
66813
67441
|
const completedTableRefreshRef = useRef24(null);
|
|
66814
67442
|
if (completedTableRefreshRef.current?.reportId !== effectiveReportId) {
|
|
66815
67443
|
completedTableRefreshRef.current = null;
|
|
66816
67444
|
}
|
|
66817
|
-
const tableRefreshInputAlreadyCompleted =
|
|
66818
|
-
const tableRefreshQueryEnabled = !reportOverride &&
|
|
67445
|
+
const tableRefreshInputAlreadyCompleted = completedTableRefreshRef.current?.reportId === effectiveReportId && completedTableRefreshRef.current.version >= tableRefreshInput.version;
|
|
67446
|
+
const tableRefreshQueryEnabled = !reportOverride && !tableRefreshInputAlreadyCompleted && tableRefreshInput.version > 0 && Boolean(sourceReport) && Boolean(client) && Boolean(tableRefreshInput.reportBuilderState) && !pendingPivotRefresh && sourceReportMatchesEffectiveReportId && tableRefreshInput.shouldRefresh;
|
|
66819
67447
|
const tableRefreshQuery = useQuery({
|
|
66820
67448
|
queryKey: createUseFormTableRefreshQueryKey({
|
|
66821
67449
|
reportId: effectiveReportId,
|
|
@@ -67309,9 +67937,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67309
67937
|
(option) => ["ASC", "DESC"].map((direction) => {
|
|
67310
67938
|
const field = String(option.value ?? "").trim();
|
|
67311
67939
|
const labelField = String(option.label ?? field).trim();
|
|
67312
|
-
const
|
|
67940
|
+
const directionLabel2 = toFlatSortDirectionLabel(direction);
|
|
67313
67941
|
return {
|
|
67314
|
-
label: `${toTitleCaseLabel(labelField)} ${
|
|
67942
|
+
label: `${toTitleCaseLabel(labelField)} ${directionLabel2}`,
|
|
67315
67943
|
value: toFlatSortValue(field, direction)
|
|
67316
67944
|
};
|
|
67317
67945
|
})
|
|
@@ -67999,9 +68627,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67999
68627
|
chartAxesBaseChart,
|
|
68000
68628
|
resolvedXAxisField
|
|
68001
68629
|
);
|
|
68002
|
-
if (bucketFormat
|
|
68003
|
-
defaultFormat = bucketFormat;
|
|
68004
|
-
}
|
|
68630
|
+
if (bucketFormat) return bucketFormat;
|
|
68005
68631
|
if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && chartAxisEdits.xAxisFormat === void 0) {
|
|
68006
68632
|
defaultFormat = "string";
|
|
68007
68633
|
}
|
|
@@ -68266,6 +68892,16 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68266
68892
|
}
|
|
68267
68893
|
};
|
|
68268
68894
|
}, [chart, filterOptions, filtersForQueryBuilder]);
|
|
68895
|
+
const resolvedChartSort = chartSortOverride === void 0 ? sourceReport?.chartSort : chartSortOverride ?? void 0;
|
|
68896
|
+
const chartSort = formatChartSortValue(resolvedChartSort);
|
|
68897
|
+
const chartSortOptions = useMemo33(
|
|
68898
|
+
() => getChartSortOptions(chartForUi),
|
|
68899
|
+
[chartForUi]
|
|
68900
|
+
);
|
|
68901
|
+
const chartWithSort = useMemo33(
|
|
68902
|
+
() => chartForUi ? applyChartSort(chartForUi, resolvedChartSort) : chartForUi,
|
|
68903
|
+
[chartForUi, resolvedChartSort]
|
|
68904
|
+
);
|
|
68269
68905
|
const isPivotTableChart = String(chartType ?? "").toLowerCase() === "table" && Boolean(pivotState);
|
|
68270
68906
|
const pivotTableColumnControls = useMemo33(
|
|
68271
68907
|
() => isPivotTableChart ? buildPivotColumnPivotTableFormattingColumns(pivotState, chart) : null,
|
|
@@ -69060,6 +69696,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69060
69696
|
showLegend: Boolean(effectiveNextState.showLegend)
|
|
69061
69697
|
}));
|
|
69062
69698
|
}
|
|
69699
|
+
if (effectiveNextState.chartSort !== void 0) {
|
|
69700
|
+
setChartSortOverride(
|
|
69701
|
+
parseChartSortValue(effectiveNextState.chartSort) ?? null
|
|
69702
|
+
);
|
|
69703
|
+
}
|
|
69063
69704
|
if (effectiveNextState.xAxis !== void 0 || effectiveNextState.yAxis !== void 0 || effectiveNextState.chartAxes !== void 0) {
|
|
69064
69705
|
const cx = {
|
|
69065
69706
|
...effectiveNextState.chartAxes,
|
|
@@ -69632,57 +70273,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69632
70273
|
})
|
|
69633
70274
|
});
|
|
69634
70275
|
}
|
|
69635
|
-
} catch
|
|
69636
|
-
const requestedFieldNames = (resolved?.rules ?? []).map((rule) => String(rule?.field ?? "").trim()).filter(Boolean);
|
|
69637
|
-
const relevantFieldConfigs = Object.fromEntries(
|
|
69638
|
-
Object.entries(queryBuilderFieldConfigByName ?? {}).filter(
|
|
69639
|
-
([key, config]) => {
|
|
69640
|
-
const configuredField = String(config?.field ?? "").trim();
|
|
69641
|
-
return requestedFieldNames.some((requestedField) => {
|
|
69642
|
-
const bareRequestedField = requestedField.split(".").pop() ?? "";
|
|
69643
|
-
return key === requestedField || configuredField === requestedField || configuredField === bareRequestedField;
|
|
69644
|
-
});
|
|
69645
|
-
}
|
|
69646
|
-
)
|
|
69647
|
-
);
|
|
69648
|
-
console.error("[useForm] setFilters swallowed error", {
|
|
69649
|
-
error: error instanceof Error ? error.message : String(error),
|
|
69650
|
-
stack: error instanceof Error ? error.stack : void 0,
|
|
69651
|
-
reportId: effectiveReportId,
|
|
69652
|
-
requestedRules: (resolved?.rules ?? []).map((rule) => ({
|
|
69653
|
-
table: rule?.table,
|
|
69654
|
-
field: rule?.field,
|
|
69655
|
-
operator: rule?.operator,
|
|
69656
|
-
value: rule?.value
|
|
69657
|
-
})),
|
|
69658
|
-
normalizedRules: (nextFiltersNormalizedForConfig?.rules ?? []).map((rule) => ({
|
|
69659
|
-
table: rule?.table,
|
|
69660
|
-
field: rule?.field,
|
|
69661
|
-
operator: rule?.operator,
|
|
69662
|
-
value: rule?.value
|
|
69663
|
-
})),
|
|
69664
|
-
relevantFieldConfigs,
|
|
69665
|
-
pivot: nextPivot,
|
|
69666
|
-
reportBuilderTables: effectiveReportBuilderState?.tables,
|
|
69667
|
-
reportBuilderColumns: effectiveReportBuilderColumns.filter(
|
|
69668
|
-
(column) => requestedFieldNames.some((requestedField) => {
|
|
69669
|
-
const bareRequestedField = requestedField.split(".").pop() ?? "";
|
|
69670
|
-
return String(column.field ?? "").trim() === bareRequestedField;
|
|
69671
|
-
})
|
|
69672
|
-
).map((column) => ({
|
|
69673
|
-
table: column.table,
|
|
69674
|
-
field: column.field,
|
|
69675
|
-
alias: column.alias
|
|
69676
|
-
})),
|
|
69677
|
-
schemaTablesWithRequestedFields: schemaForReportBuilderState.filter(
|
|
69678
|
-
(table2) => table2.columns?.some(
|
|
69679
|
-
(column) => requestedFieldNames.some(
|
|
69680
|
-
(requestedField) => String(column.field ?? "").trim() === (requestedField.split(".").pop() ?? "")
|
|
69681
|
-
)
|
|
69682
|
-
)
|
|
69683
|
-
).map((table2) => table2.name),
|
|
69684
|
-
fieldConfigKeys: Object.keys(queryBuilderFieldConfigByName ?? {})
|
|
69685
|
-
});
|
|
70276
|
+
} catch {
|
|
69686
70277
|
}
|
|
69687
70278
|
};
|
|
69688
70279
|
const saveChanges = useCallback5(async () => {
|
|
@@ -69721,7 +70312,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69721
70312
|
xAxisFormat: resolvedXAxisFormat,
|
|
69722
70313
|
xAxisLabel: resolvedXAxisLabel,
|
|
69723
70314
|
yAxisFields: resolvedYAxisFields,
|
|
69724
|
-
showLegend: chartVisibility.showLegend
|
|
70315
|
+
showLegend: chartVisibility.showLegend,
|
|
70316
|
+
chartSort: resolvedChartSort ?? null
|
|
69725
70317
|
},
|
|
69726
70318
|
dashboardItemId: effectiveReportId || void 0,
|
|
69727
70319
|
client,
|
|
@@ -69739,6 +70331,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69739
70331
|
queryKey: ["quill", "dashboard-report", savedReportId],
|
|
69740
70332
|
refetchType: "none"
|
|
69741
70333
|
});
|
|
70334
|
+
await loadDashboard(dashboardNameForNewReport, true);
|
|
69742
70335
|
}
|
|
69743
70336
|
return resp;
|
|
69744
70337
|
}, [
|
|
@@ -69751,11 +70344,13 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69751
70344
|
eventTracking,
|
|
69752
70345
|
formReportName,
|
|
69753
70346
|
getToken,
|
|
70347
|
+
loadDashboard,
|
|
69754
70348
|
queryClient,
|
|
69755
70349
|
resolvedXAxisField,
|
|
69756
70350
|
resolvedXAxisFormat,
|
|
69757
70351
|
resolvedXAxisLabel,
|
|
69758
70352
|
resolvedChartType,
|
|
70353
|
+
resolvedChartSort,
|
|
69759
70354
|
resolvedYAxisFields,
|
|
69760
70355
|
sourceReport,
|
|
69761
70356
|
setDraftSessionId,
|
|
@@ -69764,7 +70359,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69764
70359
|
]);
|
|
69765
70360
|
return {
|
|
69766
70361
|
/* ── Chart & table (exceptions: not value/options pairs) ── */
|
|
69767
|
-
chart:
|
|
70362
|
+
chart: chartWithSort,
|
|
69768
70363
|
chartLoading,
|
|
69769
70364
|
table,
|
|
69770
70365
|
tableLoading,
|
|
@@ -69792,6 +70387,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69792
70387
|
aggregationDescriptionOptions: cleanedAggregations,
|
|
69793
70388
|
sort: cleanedSort,
|
|
69794
70389
|
sortOptions,
|
|
70390
|
+
/** Display-only chart ordering; update with a value from `chartSortOptions`. */
|
|
70391
|
+
chartSort,
|
|
70392
|
+
chartSortOptions,
|
|
69795
70393
|
chartType: resolvedChartType,
|
|
69796
70394
|
chartTypeOptions: chartTypes,
|
|
69797
70395
|
/** Selected tabular columns in display order. */
|
|
@@ -70135,7 +70733,7 @@ function ToolCallBlock({ toolCall }) {
|
|
|
70135
70733
|
);
|
|
70136
70734
|
}
|
|
70137
70735
|
function ToolCallResult({ content }) {
|
|
70138
|
-
const [expanded, setExpanded] =
|
|
70736
|
+
const [expanded, setExpanded] = useState42(false);
|
|
70139
70737
|
if (!content) return null;
|
|
70140
70738
|
const isLong = content.length > 300;
|
|
70141
70739
|
const displayed = isLong && !expanded ? content.slice(0, 300) + "..." : content;
|
|
@@ -70190,11 +70788,11 @@ function Chat({
|
|
|
70190
70788
|
const [client] = useContext37(ClientContext);
|
|
70191
70789
|
const { getToken } = useContext37(FetchContext);
|
|
70192
70790
|
const { tenants } = useContext37(TenantContext);
|
|
70193
|
-
const [messages, setMessages] =
|
|
70194
|
-
const [input, setInput] =
|
|
70195
|
-
const [inputError, setInputError] =
|
|
70196
|
-
const [isLoading, setIsLoading] =
|
|
70197
|
-
const [model, setModel] =
|
|
70791
|
+
const [messages, setMessages] = useState42([]);
|
|
70792
|
+
const [input, setInput] = useState42("");
|
|
70793
|
+
const [inputError, setInputError] = useState42("");
|
|
70794
|
+
const [isLoading, setIsLoading] = useState42(false);
|
|
70795
|
+
const [model, setModel] = useState42("gemini-3-flash-preview");
|
|
70198
70796
|
const containerRef = useRef25(null);
|
|
70199
70797
|
const textareaRef = useRef25(null);
|
|
70200
70798
|
const abortControllerRef = useRef25(null);
|
|
@@ -70632,7 +71230,7 @@ function Chat({
|
|
|
70632
71230
|
}
|
|
70633
71231
|
|
|
70634
71232
|
// src/hooks/useReportFilterDraft.ts
|
|
70635
|
-
import { useCallback as useCallback6, useEffect as useEffect34, useMemo as useMemo35, useRef as useRef26, useState as
|
|
71233
|
+
import { useCallback as useCallback6, useEffect as useEffect34, useMemo as useMemo35, useRef as useRef26, useState as useState43 } from "react";
|
|
70636
71234
|
var normalizeOperatorKey = (operator) => String(operator ?? "").trim().toLowerCase().replace(/[_\s]+/g, "");
|
|
70637
71235
|
var defaultFilterRuleValueForOperator = (operator) => {
|
|
70638
71236
|
const key = normalizeOperatorKey(operator);
|
|
@@ -70694,9 +71292,9 @@ function useReportFilterDraft(args) {
|
|
|
70694
71292
|
() => fieldCatalogSignature(effectiveFields),
|
|
70695
71293
|
[effectiveFields]
|
|
70696
71294
|
);
|
|
70697
|
-
const [resetEpoch, setResetEpoch] =
|
|
70698
|
-
const [draftQuery, setDraftQuery] =
|
|
70699
|
-
const [hasUnappliedFilterChanges, setHasUnappliedFilterChanges] =
|
|
71295
|
+
const [resetEpoch, setResetEpoch] = useState43(0);
|
|
71296
|
+
const [draftQuery, setDraftQuery] = useState43(committed);
|
|
71297
|
+
const [hasUnappliedFilterChanges, setHasUnappliedFilterChanges] = useState43(false);
|
|
70700
71298
|
const draftResetKey = `${reportId}|${committedSignature}|${resetEpoch}`;
|
|
70701
71299
|
useEffect34(() => {
|
|
70702
71300
|
setDraftQuery(committedRef.current);
|
|
@@ -70790,7 +71388,7 @@ import {
|
|
|
70790
71388
|
useContext as useContext38,
|
|
70791
71389
|
useLayoutEffect as useLayoutEffect5,
|
|
70792
71390
|
useRef as useRef27,
|
|
70793
|
-
useState as
|
|
71391
|
+
useState as useState44
|
|
70794
71392
|
} from "react";
|
|
70795
71393
|
import { jsx as jsx89, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
70796
71394
|
var CHART_MIN_PX = 220;
|
|
@@ -70892,7 +71490,7 @@ function ReportDetail({
|
|
|
70892
71490
|
const useDetailTableFromUseForm = isTableChart && !isPivotTableChartConfig(chart);
|
|
70893
71491
|
const showBottomRawTable = !isTableChart;
|
|
70894
71492
|
const chartSlotRef = useRef27(null);
|
|
70895
|
-
const [chartHeightPx, setChartHeightPx] =
|
|
71493
|
+
const [chartHeightPx, setChartHeightPx] = useState44(360);
|
|
70896
71494
|
useLayoutEffect5(() => {
|
|
70897
71495
|
const el = chartSlotRef.current;
|
|
70898
71496
|
if (!el) {
|
|
@@ -71056,7 +71654,7 @@ var useTenants = (dashboardName) => {
|
|
|
71056
71654
|
};
|
|
71057
71655
|
|
|
71058
71656
|
// src/hooks/useQuill.ts
|
|
71059
|
-
import { useContext as useContext40, useEffect as useEffect36, useMemo as useMemo36, useState as
|
|
71657
|
+
import { useContext as useContext40, useEffect as useEffect36, useMemo as useMemo36, useState as useState45 } from "react";
|
|
71060
71658
|
init_paginationProcessing();
|
|
71061
71659
|
init_tableProcessing();
|
|
71062
71660
|
init_dataProcessing();
|
|
@@ -71079,9 +71677,9 @@ var useQuill = (reportId, pagination) => {
|
|
|
71079
71677
|
const [client, isClientLoading] = useContext40(ClientContext);
|
|
71080
71678
|
const { tenants } = useContext40(TenantContext);
|
|
71081
71679
|
const { eventTracking } = useContext40(EventTrackingContext);
|
|
71082
|
-
const [loading, setLoading] =
|
|
71083
|
-
const [error, setError] =
|
|
71084
|
-
const [previousPage, setPreviousPage] =
|
|
71680
|
+
const [loading, setLoading] = useState45(true);
|
|
71681
|
+
const [error, setError] = useState45(void 0);
|
|
71682
|
+
const [previousPage, setPreviousPage] = useState45(0);
|
|
71085
71683
|
const processedReport = useMemo36(() => {
|
|
71086
71684
|
return reportId && allReportsById[reportId] ? convertInternalReportToReport(
|
|
71087
71685
|
mergeComparisonRange(allReportsById[reportId]),
|
|
@@ -71090,7 +71688,7 @@ var useQuill = (reportId, pagination) => {
|
|
|
71090
71688
|
"useQuill"
|
|
71091
71689
|
) : void 0;
|
|
71092
71690
|
}, [reportId, reportId && allReportsById[reportId], specificReportFilters]);
|
|
71093
|
-
const [additionalProcessing, setAdditionProcessing] =
|
|
71691
|
+
const [additionalProcessing, setAdditionProcessing] = useState45(
|
|
71094
71692
|
pagination ? {
|
|
71095
71693
|
page: pagination
|
|
71096
71694
|
} : void 0
|
|
@@ -71306,7 +71904,7 @@ var useMemoizedRows = (reportId) => {
|
|
|
71306
71904
|
};
|
|
71307
71905
|
|
|
71308
71906
|
// src/hooks/useAskQuill.tsx
|
|
71309
|
-
import { useContext as useContext41, useEffect as useEffect37, useState as
|
|
71907
|
+
import { useContext as useContext41, useEffect as useEffect37, useState as useState46 } from "react";
|
|
71310
71908
|
init_astProcessing();
|
|
71311
71909
|
init_astFilterProcessing();
|
|
71312
71910
|
init_pivotProcessing();
|
|
@@ -71339,8 +71937,8 @@ var useAskQuill = (dashboardName) => {
|
|
|
71339
71937
|
const { tenants } = useContext41(TenantContext);
|
|
71340
71938
|
const { getToken } = useContext41(FetchContext);
|
|
71341
71939
|
const { eventTracking } = useContext41(EventTrackingContext);
|
|
71342
|
-
const [astInfo, setAstInfo] =
|
|
71343
|
-
const [data, setData] =
|
|
71940
|
+
const [astInfo, setAstInfo] = useState46(void 0);
|
|
71941
|
+
const [data, setData] = useState46({
|
|
71344
71942
|
rows: [],
|
|
71345
71943
|
columns: [],
|
|
71346
71944
|
pivot: null,
|
|
@@ -71350,9 +71948,9 @@ var useAskQuill = (dashboardName) => {
|
|
|
71350
71948
|
pivotColumnFields: [],
|
|
71351
71949
|
pivotValueFields: []
|
|
71352
71950
|
});
|
|
71353
|
-
const [loading, setLoading] =
|
|
71354
|
-
const [error, setError] =
|
|
71355
|
-
const [ask, setAsk] =
|
|
71951
|
+
const [loading, setLoading] = useState46(false);
|
|
71952
|
+
const [error, setError] = useState46(void 0);
|
|
71953
|
+
const [ask, setAsk] = useState46(
|
|
71356
71954
|
async () => void 0
|
|
71357
71955
|
);
|
|
71358
71956
|
const askHelper = async (query) => {
|
|
@@ -71566,13 +72164,13 @@ var useAskQuill = (dashboardName) => {
|
|
|
71566
72164
|
};
|
|
71567
72165
|
|
|
71568
72166
|
// src/hooks/useVirtualTables.tsx
|
|
71569
|
-
import { useContext as useContext42, useState as
|
|
72167
|
+
import { useContext as useContext42, useState as useState47 } from "react";
|
|
71570
72168
|
var useVirtualTables = () => {
|
|
71571
72169
|
const [schemaData, setSchemaData] = useContext42(SchemaDataContext);
|
|
71572
72170
|
const { tenants } = useContext42(TenantContext);
|
|
71573
72171
|
const { getToken, quillFetchWithToken } = useContext42(FetchContext);
|
|
71574
72172
|
const { eventTracking } = useContext42(EventTrackingContext);
|
|
71575
|
-
const [loadingTables, setLoadingTables] =
|
|
72173
|
+
const [loadingTables, setLoadingTables] = useState47({});
|
|
71576
72174
|
const handleReload = async (client, caller) => {
|
|
71577
72175
|
setSchemaData({ ...schemaData, isSchemaLoading: true });
|
|
71578
72176
|
setLoadingTables(
|