@quillsql/react 2.16.93 → 2.16.94
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 +160 -426
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +160 -426
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -107,7 +107,7 @@ function formatIdentifierLabel(str) {
|
|
|
107
107
|
if (hasUnderscore || hasCamelCaseBoundary) {
|
|
108
108
|
return snakeAndCamelCaseToTitleCase(str);
|
|
109
109
|
}
|
|
110
|
-
return str;
|
|
110
|
+
return str.split(/\s+/).map((word) => word === "id" ? "ID" : capitalize(word)).join(" ");
|
|
111
111
|
}
|
|
112
112
|
function removeDoubleQuotes(str) {
|
|
113
113
|
if (!str) {
|
|
@@ -153,11 +153,12 @@ function getValidDate(dateString) {
|
|
|
153
153
|
const dates = FORMATS.map((fmt) => parse(dateString, fmt, /* @__PURE__ */ new Date()));
|
|
154
154
|
return dates.find((date) => isValid(date));
|
|
155
155
|
}
|
|
156
|
-
var DATE_FORMAT_TYPES, NUMBER_FORMAT_TYPES, valueFormatter, quillFormat, quillAutoFormat, formatString, formatterDollar, formatDollarAmount, formatterCentsDollar, formatDollarCents, wholeNumberFormatter, formatWholeNumber, formatOneDecimalPlace, formatterTwoDecimalPlaces, formatTwoDecimalPlaces, formatterPercent, formatPercent, _getUTCDateHelper, format_YYYY, format_MMM_yyyy, format_hh_ap_pm, format_MMM_d, format_MMM_dd_yyyy, format_MMM_d_MMM_d, format_MMM_dd_hh_mm_ap_pm, format_wo_yyyy, localeFormatter, FORMATS, compareValues;
|
|
156
|
+
var DATE_OUTSIDE_RANGE, DATE_FORMAT_TYPES, NUMBER_FORMAT_TYPES, valueFormatter, quillFormat, quillAutoFormat, formatString, formatterDollar, formatDollarAmount, formatterCentsDollar, formatDollarCents, wholeNumberFormatter, formatWholeNumber, formatOneDecimalPlace, formatterTwoDecimalPlaces, formatTwoDecimalPlaces, formatterPercent, formatPercent, _getUTCDateHelper, format_YYYY, format_MMM_yyyy, format_hh_ap_pm, format_MMM_d, format_MMM_dd_yyyy, format_MMM_d_MMM_d, format_MMM_dd_hh_mm_ap_pm, format_wo_yyyy, localeFormatter, FORMATS, compareValues;
|
|
157
157
|
var init_valueFormatter = __esm({
|
|
158
158
|
"src/utils/valueFormatter.ts"() {
|
|
159
159
|
"use strict";
|
|
160
160
|
init_textProcessing();
|
|
161
|
+
DATE_OUTSIDE_RANGE = "Date outside range";
|
|
161
162
|
DATE_FORMAT_TYPES = [
|
|
162
163
|
"yyyy",
|
|
163
164
|
"MMM_yyyy",
|
|
@@ -406,7 +407,7 @@ var init_valueFormatter = __esm({
|
|
|
406
407
|
weekEnd = utcEnd;
|
|
407
408
|
}
|
|
408
409
|
if (isAfter(weekStart, utcEnd) || isBefore(weekEnd, utcStart)) {
|
|
409
|
-
return
|
|
410
|
+
return DATE_OUTSIDE_RANGE;
|
|
410
411
|
}
|
|
411
412
|
}
|
|
412
413
|
}
|
|
@@ -17183,79 +17184,6 @@ var init_paginationProcessing = __esm({
|
|
|
17183
17184
|
}
|
|
17184
17185
|
});
|
|
17185
17186
|
|
|
17186
|
-
// src/utils/dashboardProfiler.ts
|
|
17187
|
-
function profilingEnabled() {
|
|
17188
|
-
if (typeof process !== "undefined" && process.env?.QUILL_DASHBOARD_PROFILE === "true") {
|
|
17189
|
-
return true;
|
|
17190
|
-
}
|
|
17191
|
-
if (typeof window === "undefined") return false;
|
|
17192
|
-
return Boolean(window.__QUILL_DASHBOARD_PROFILE__);
|
|
17193
|
-
}
|
|
17194
|
-
function profileStore() {
|
|
17195
|
-
if (typeof window !== "undefined") {
|
|
17196
|
-
const profileWindow = window;
|
|
17197
|
-
profileWindow.__QUILL_DASHBOARD_TRACE__ ??= [];
|
|
17198
|
-
return profileWindow.__QUILL_DASHBOARD_TRACE__;
|
|
17199
|
-
}
|
|
17200
|
-
const globalStore = globalThis;
|
|
17201
|
-
globalStore.__QUILL_DASHBOARD_TRACE__ ??= [];
|
|
17202
|
-
return globalStore.__QUILL_DASHBOARD_TRACE__;
|
|
17203
|
-
}
|
|
17204
|
-
function queryKeyFamily(queryKey) {
|
|
17205
|
-
const head = String(queryKey[0] ?? "");
|
|
17206
|
-
const next = String(queryKey[1] ?? "");
|
|
17207
|
-
if (head === "quill" && next === "dashboard-report") {
|
|
17208
|
-
return "quill/dashboard-report";
|
|
17209
|
-
}
|
|
17210
|
-
if (head === "useReport") {
|
|
17211
|
-
return `useReport/${next || "unknown"}`;
|
|
17212
|
-
}
|
|
17213
|
-
return head || "other";
|
|
17214
|
-
}
|
|
17215
|
-
function summarizeEngineRequest(input) {
|
|
17216
|
-
const metadata = input.metadata ?? {};
|
|
17217
|
-
return {
|
|
17218
|
-
task: input.task ?? null,
|
|
17219
|
-
shareRequest: Boolean(input.shareRequest),
|
|
17220
|
-
reuseExisting: input.reuseExisting ?? null,
|
|
17221
|
-
settled: input.settled ?? null,
|
|
17222
|
-
reportId: metadata.reportId ?? null,
|
|
17223
|
-
metadataKeys: Object.keys(metadata).sort(),
|
|
17224
|
-
dashboardName: metadata.dashboardName ?? null,
|
|
17225
|
-
dashboardItemId: metadata.dashboardItemId ?? null,
|
|
17226
|
-
useNewNodeSql: metadata.useNewNodeSql ?? null,
|
|
17227
|
-
dateBucket: metadata.dateBucket ?? null,
|
|
17228
|
-
hasPivot: Boolean(metadata.pivot),
|
|
17229
|
-
hasReportBuilderState: Boolean(metadata.reportBuilderState),
|
|
17230
|
-
additionalProcessing: metadata.additionalProcessing ?? null,
|
|
17231
|
-
filterCount: Array.isArray(metadata.filters) ? metadata.filters.length : null
|
|
17232
|
-
};
|
|
17233
|
-
}
|
|
17234
|
-
function profileDashboard(event, data) {
|
|
17235
|
-
if (!profilingEnabled()) return;
|
|
17236
|
-
const entry = {
|
|
17237
|
-
at: Math.round(performance.now() * 10) / 10,
|
|
17238
|
-
event,
|
|
17239
|
-
data
|
|
17240
|
-
};
|
|
17241
|
-
profileStore().push(entry);
|
|
17242
|
-
if (typeof window !== "undefined") {
|
|
17243
|
-
const profileWindow = window;
|
|
17244
|
-
profileWindow.__QUILL_DASHBOARD_PROFILE__ = true;
|
|
17245
|
-
profileWindow.__QUILL_DUMP_DASHBOARD_PROFILE__ = () => profileWindow.__QUILL_DASHBOARD_TRACE__ ?? [];
|
|
17246
|
-
}
|
|
17247
|
-
if (typeof process !== "undefined" && process.env?.QUILL_DASHBOARD_PROFILE_CONSOLE === "true" && CONSOLE_EVENT_PATTERN.test(event)) {
|
|
17248
|
-
console.log(`[quill-profile] ${event}`, data ?? {});
|
|
17249
|
-
}
|
|
17250
|
-
}
|
|
17251
|
-
var CONSOLE_EVENT_PATTERN;
|
|
17252
|
-
var init_dashboardProfiler = __esm({
|
|
17253
|
-
"src/utils/dashboardProfiler.ts"() {
|
|
17254
|
-
"use strict";
|
|
17255
|
-
CONSOLE_EVENT_PATTERN = /cache|initial-load|use-report-loading|network|unique-values|table-refresh|pivot|shared-request|engine-fetch|generate-pivot/;
|
|
17256
|
-
}
|
|
17257
|
-
});
|
|
17258
|
-
|
|
17259
17187
|
// src/utils/pivotConstructor.ts
|
|
17260
17188
|
function normalizeLegacyPivotSortFieldValue(sortField) {
|
|
17261
17189
|
if (sortField === void 0) {
|
|
@@ -17368,22 +17296,6 @@ async function generatePivotWithSQL({
|
|
|
17368
17296
|
rowLimit: pivot.rowLimit,
|
|
17369
17297
|
dateBucket: resolvedDateBucket
|
|
17370
17298
|
};
|
|
17371
|
-
profileDashboard(
|
|
17372
|
-
"generate-pivot-sql",
|
|
17373
|
-
summarizeEngineRequest({
|
|
17374
|
-
task: "pivot-template",
|
|
17375
|
-
shareRequest: false,
|
|
17376
|
-
metadata: {
|
|
17377
|
-
reportId: report?.id,
|
|
17378
|
-
dashboardName,
|
|
17379
|
-
dateBucket: resolvedDateBucket,
|
|
17380
|
-
additionalProcessing,
|
|
17381
|
-
pivot: pivotConfig,
|
|
17382
|
-
reportBuilderState,
|
|
17383
|
-
filters: dashboardFilters
|
|
17384
|
-
}
|
|
17385
|
-
})
|
|
17386
|
-
);
|
|
17387
17299
|
const resp = await quillFetch({
|
|
17388
17300
|
client,
|
|
17389
17301
|
task: "pivot-template",
|
|
@@ -17423,7 +17335,7 @@ async function generatePivotWithSQL({
|
|
|
17423
17335
|
);
|
|
17424
17336
|
const responseRows = queryResponseRows;
|
|
17425
17337
|
const responseFields = queryResponseFields;
|
|
17426
|
-
|
|
17338
|
+
let rows = resultRowField ? responseRows.map(
|
|
17427
17339
|
(row) => !row[resultRowField] ? { ...row, [resultRowField]: "-" } : row
|
|
17428
17340
|
) : responseRows;
|
|
17429
17341
|
if (pivot.columnField && client.databaseType?.toLowerCase() === "bigquery") {
|
|
@@ -17462,24 +17374,21 @@ async function generatePivotWithSQL({
|
|
|
17462
17374
|
return 0;
|
|
17463
17375
|
});
|
|
17464
17376
|
if (resultRowField && !isStringType(pivot.rowFieldType || "")) {
|
|
17465
|
-
|
|
17466
|
-
|
|
17467
|
-
|
|
17468
|
-
|
|
17469
|
-
const rowDate = new Date(value);
|
|
17470
|
-
if (rowDate < dateFilter.startDate) {
|
|
17471
|
-
value = dateFilter.startDate.toISOString();
|
|
17472
|
-
} else if (rowDate > dateFilter.endDate) {
|
|
17473
|
-
value = dateFilter.endDate.toISOString();
|
|
17474
|
-
}
|
|
17475
|
-
}
|
|
17377
|
+
const dateRange = dateFilter?.startDate && dateFilter?.endDate ? { start: dateFilter.startDate, end: dateFilter.endDate } : void 0;
|
|
17378
|
+
rows = rows.filter((row) => {
|
|
17379
|
+
const rawValue = typeof row[resultRowField] === "object" ? row[resultRowField].value : row[resultRowField];
|
|
17380
|
+
row.__quillRawDate = rawValue;
|
|
17476
17381
|
const dateString = getDateString(
|
|
17477
|
-
|
|
17478
|
-
|
|
17382
|
+
rawValue,
|
|
17383
|
+
dateRange,
|
|
17479
17384
|
dateBucket,
|
|
17480
17385
|
databaseType
|
|
17481
17386
|
);
|
|
17387
|
+
if (dateBucket === "week" && dateRange && dateString === DATE_OUTSIDE_RANGE) {
|
|
17388
|
+
return false;
|
|
17389
|
+
}
|
|
17482
17390
|
row[resultRowField] = dateString;
|
|
17391
|
+
return true;
|
|
17483
17392
|
});
|
|
17484
17393
|
if (resultRowField && pivot.rowFieldType && !isStringType(pivot.rowFieldType) && dateFilter?.startDate && dateFilter?.endDate) {
|
|
17485
17394
|
const dateSet = new Set(rows.map((row) => row[resultRowField]));
|
|
@@ -17644,7 +17553,7 @@ function processPivotData({
|
|
|
17644
17553
|
const pivotRowField = processColumnName(
|
|
17645
17554
|
String(resultRowField ?? pivot.rowField ?? "")
|
|
17646
17555
|
);
|
|
17647
|
-
|
|
17556
|
+
let rows = pivotRowField ? responseRows.map(
|
|
17648
17557
|
(row) => !row[pivotRowField] ? { ...row, [pivotRowField]: "-" } : row
|
|
17649
17558
|
) : responseRows;
|
|
17650
17559
|
if (pivot.columnField && client.databaseType?.toLowerCase() === "bigquery") {
|
|
@@ -17683,24 +17592,21 @@ function processPivotData({
|
|
|
17683
17592
|
return 0;
|
|
17684
17593
|
});
|
|
17685
17594
|
if (pivotRowField && !isStringType(pivot.rowFieldType || "")) {
|
|
17686
|
-
|
|
17687
|
-
|
|
17688
|
-
|
|
17689
|
-
|
|
17690
|
-
const rowDate = new Date(value);
|
|
17691
|
-
if (rowDate < dateFilter.startDate) {
|
|
17692
|
-
value = dateFilter.startDate.toISOString();
|
|
17693
|
-
} else if (rowDate > dateFilter.endDate) {
|
|
17694
|
-
value = dateFilter.endDate.toISOString();
|
|
17695
|
-
}
|
|
17696
|
-
}
|
|
17595
|
+
const dateRange = dateFilter?.startDate && dateFilter?.endDate ? { start: dateFilter.startDate, end: dateFilter.endDate } : void 0;
|
|
17596
|
+
rows = rows.filter((row) => {
|
|
17597
|
+
const rawValue = typeof row[pivotRowField] === "object" ? row[pivotRowField].value : row[pivotRowField];
|
|
17598
|
+
row.__quillRawDate = rawValue;
|
|
17697
17599
|
const dateString = getDateString(
|
|
17698
|
-
|
|
17699
|
-
|
|
17600
|
+
rawValue,
|
|
17601
|
+
dateRange,
|
|
17700
17602
|
dateBucket,
|
|
17701
17603
|
databaseType
|
|
17702
17604
|
);
|
|
17605
|
+
if (dateBucket === "week" && dateRange && dateString === DATE_OUTSIDE_RANGE) {
|
|
17606
|
+
return false;
|
|
17607
|
+
}
|
|
17703
17608
|
row[pivotRowField] = dateString;
|
|
17609
|
+
return true;
|
|
17704
17610
|
});
|
|
17705
17611
|
if (pivotRowField && pivot.rowFieldType && !isStringType(pivot.rowFieldType) && dateFilter?.startDate && dateFilter?.endDate) {
|
|
17706
17612
|
const dateSet = new Set(rows.map((row) => row[pivotRowField]));
|
|
@@ -17762,9 +17668,9 @@ var init_pivotConstructor = __esm({
|
|
|
17762
17668
|
init_columnType();
|
|
17763
17669
|
init_dataFetcher();
|
|
17764
17670
|
init_dataProcessing();
|
|
17765
|
-
init_dashboardProfiler();
|
|
17766
17671
|
init_dates();
|
|
17767
17672
|
init_textProcessing();
|
|
17673
|
+
init_valueFormatter();
|
|
17768
17674
|
}
|
|
17769
17675
|
});
|
|
17770
17676
|
|
|
@@ -20184,20 +20090,6 @@ async function getOrFetchSharedRequest({
|
|
|
20184
20090
|
}) {
|
|
20185
20091
|
if (signal?.aborted) throw createAbortError(signal);
|
|
20186
20092
|
let entry = entries.get(key);
|
|
20187
|
-
const reuseExisting = Boolean(entry);
|
|
20188
|
-
profileDashboard("shared-request", {
|
|
20189
|
-
...summarizeEngineRequest({
|
|
20190
|
-
task: void 0,
|
|
20191
|
-
shareRequest: true,
|
|
20192
|
-
reuseExisting,
|
|
20193
|
-
settled: entry?.settled,
|
|
20194
|
-
metadata: { reportId }
|
|
20195
|
-
}),
|
|
20196
|
-
reportId: reportId ?? null,
|
|
20197
|
-
reuseExisting,
|
|
20198
|
-
settled: entry?.settled ?? false,
|
|
20199
|
-
keyLength: key.length
|
|
20200
|
-
});
|
|
20201
20093
|
if (!entry) {
|
|
20202
20094
|
const controller = new AbortController();
|
|
20203
20095
|
entry = {
|
|
@@ -20273,7 +20165,6 @@ var ORPHAN_GRACE_MS, COMPLETED_TTL_MS, entries;
|
|
|
20273
20165
|
var init_reportRequestPool = __esm({
|
|
20274
20166
|
"src/utils/reportRequestPool.ts"() {
|
|
20275
20167
|
"use strict";
|
|
20276
|
-
init_dashboardProfiler();
|
|
20277
20168
|
ORPHAN_GRACE_MS = 100;
|
|
20278
20169
|
COMPLETED_TTL_MS = 15e3;
|
|
20279
20170
|
entries = /* @__PURE__ */ new Map();
|
|
@@ -20836,7 +20727,6 @@ var init_dataFetcher = __esm({
|
|
|
20836
20727
|
init_dates();
|
|
20837
20728
|
init_changelogNotify();
|
|
20838
20729
|
init_reportRequestPool();
|
|
20839
|
-
init_dashboardProfiler();
|
|
20840
20730
|
quillFetch = async ({
|
|
20841
20731
|
client,
|
|
20842
20732
|
task,
|
|
@@ -20897,14 +20787,6 @@ var init_dataFetcher = __esm({
|
|
|
20897
20787
|
return { error: "Failed to fetch data" };
|
|
20898
20788
|
}
|
|
20899
20789
|
};
|
|
20900
|
-
profileDashboard(
|
|
20901
|
-
"engine-fetch",
|
|
20902
|
-
summarizeEngineRequest({
|
|
20903
|
-
task,
|
|
20904
|
-
shareRequest,
|
|
20905
|
-
metadata
|
|
20906
|
-
})
|
|
20907
|
-
);
|
|
20908
20790
|
if (!shareRequest) {
|
|
20909
20791
|
return execute(abortSignal);
|
|
20910
20792
|
}
|
|
@@ -21476,7 +21358,22 @@ init_dates();
|
|
|
21476
21358
|
init_pivotConstructor();
|
|
21477
21359
|
init_columnProcessing();
|
|
21478
21360
|
init_paginationProcessing();
|
|
21479
|
-
|
|
21361
|
+
|
|
21362
|
+
// src/utils/dashboardProfiler.ts
|
|
21363
|
+
function profileDashboard(event, data) {
|
|
21364
|
+
if (typeof window === "undefined") return;
|
|
21365
|
+
const profileWindow = window;
|
|
21366
|
+
if (!profileWindow.__QUILL_DASHBOARD_PROFILE__) return;
|
|
21367
|
+
const entry = {
|
|
21368
|
+
at: Math.round(performance.now() * 10) / 10,
|
|
21369
|
+
event,
|
|
21370
|
+
data
|
|
21371
|
+
};
|
|
21372
|
+
profileWindow.__QUILL_DASHBOARD_TRACE__ ??= [];
|
|
21373
|
+
profileWindow.__QUILL_DASHBOARD_TRACE__.push(entry);
|
|
21374
|
+
}
|
|
21375
|
+
|
|
21376
|
+
// src/utils/dashboard.ts
|
|
21480
21377
|
var defaultDashboardItem = {
|
|
21481
21378
|
id: "",
|
|
21482
21379
|
name: "",
|
|
@@ -22883,13 +22780,13 @@ init_columnProcessing();
|
|
|
22883
22780
|
init_dataFetcher();
|
|
22884
22781
|
init_dataProcessing();
|
|
22885
22782
|
init_dates();
|
|
22783
|
+
init_columnType();
|
|
22886
22784
|
init_paginationProcessing();
|
|
22887
22785
|
init_pivotProcessing();
|
|
22888
22786
|
init_tableProcessing();
|
|
22889
22787
|
init_textProcessing();
|
|
22890
22788
|
init_valueFormatter();
|
|
22891
22789
|
init_astFilterProcessing();
|
|
22892
|
-
init_dashboardProfiler();
|
|
22893
22790
|
init_reportBuilder();
|
|
22894
22791
|
init_astProcessing();
|
|
22895
22792
|
|
|
@@ -23809,6 +23706,15 @@ function hasPreformattedDateBucketLabels(report) {
|
|
|
23809
23706
|
if (report.chartType?.toLowerCase() === "table") return false;
|
|
23810
23707
|
return report.xAxisField?.trim() === pivot.rowField?.trim();
|
|
23811
23708
|
}
|
|
23709
|
+
function resolvePivotBucketXAxisFormat(report) {
|
|
23710
|
+
const pivot = report.pivot;
|
|
23711
|
+
if (!pivot?.dateBucket) return null;
|
|
23712
|
+
if (report.chartType?.toLowerCase() === "table") return null;
|
|
23713
|
+
const rowField = pivot.rowField?.trim();
|
|
23714
|
+
if (!rowField || report.xAxisField?.trim() !== rowField) return null;
|
|
23715
|
+
if (!isDateType(String(pivot.rowFieldType ?? ""))) return null;
|
|
23716
|
+
return getDateFormatFromBucket(pivot.dateBucket);
|
|
23717
|
+
}
|
|
23812
23718
|
function applySavedPivotColumnLabels(report, pivotColumns) {
|
|
23813
23719
|
return pivotColumns?.map((column) => {
|
|
23814
23720
|
const savedColumn = report.columns?.find(
|
|
@@ -23884,6 +23790,10 @@ function convertInternalReportToReport(report, dashboardFilters, eventTracking,
|
|
|
23884
23790
|
...extractAllReportValuesFromQuillInternalReport(formattedReport),
|
|
23885
23791
|
...pivotFormatted
|
|
23886
23792
|
};
|
|
23793
|
+
const bucketXAxisFormat = resolvePivotBucketXAxisFormat(pivotReport);
|
|
23794
|
+
if (bucketXAxisFormat) {
|
|
23795
|
+
pivotReport.xAxisFormat = bucketXAxisFormat;
|
|
23796
|
+
}
|
|
23887
23797
|
pivotReport.formattedBaseRows = formattedBaseRows;
|
|
23888
23798
|
return applyChartSort(pivotReport);
|
|
23889
23799
|
}
|
|
@@ -26673,7 +26583,6 @@ function normalizePSTRanges(start, end) {
|
|
|
26673
26583
|
|
|
26674
26584
|
// src/Context.tsx
|
|
26675
26585
|
init_changelogNotify();
|
|
26676
|
-
init_dashboardProfiler();
|
|
26677
26586
|
|
|
26678
26587
|
// src/reportStore.ts
|
|
26679
26588
|
import { createContext, useContext, useSyncExternalStore } from "react";
|
|
@@ -32455,7 +32364,7 @@ function QuillTable({
|
|
|
32455
32364
|
setSortColumn(sort?.field || "");
|
|
32456
32365
|
setSortDirection(sort?.direction || "desc");
|
|
32457
32366
|
}, [sort]);
|
|
32458
|
-
const holdFullPageLoader =
|
|
32367
|
+
const holdFullPageLoader = rows?.length === 0 && isLoading;
|
|
32459
32368
|
const pageCountUnknown = manualPagination && pageCount === -1;
|
|
32460
32369
|
const { activeRows, maxPage } = useMemo4(() => {
|
|
32461
32370
|
const start = currentPage * rowsPerPage;
|
|
@@ -34210,9 +34119,8 @@ function RadarChart({
|
|
|
34210
34119
|
fields: [{ field: xAxisField, format: xAxisFormat }]
|
|
34211
34120
|
}),
|
|
34212
34121
|
valueFormatter: (value, name2) => {
|
|
34213
|
-
const
|
|
34214
|
-
|
|
34215
|
-
)?.dataKey;
|
|
34122
|
+
const payloadItem = payloadItems.find((p) => p.dataKey === name2) ?? payloadItems.find((p) => p.name === name2);
|
|
34123
|
+
const field = payloadItem?.dataKey;
|
|
34216
34124
|
if (!field) return value;
|
|
34217
34125
|
return valueFormatter({
|
|
34218
34126
|
value,
|
|
@@ -37383,7 +37291,6 @@ function getDashboardReportProcessing(report, serverPagination) {
|
|
|
37383
37291
|
}
|
|
37384
37292
|
|
|
37385
37293
|
// src/hooks/useDashboard.ts
|
|
37386
|
-
init_dashboardProfiler();
|
|
37387
37294
|
var DEFAULT_DASHBOARD_REPORT_STALE_TIME_MS = 5 * 60 * 1e3;
|
|
37388
37295
|
var useDashboardConfigInternal = (dashboardName) => {
|
|
37389
37296
|
const { dashboardConfig, isLoading: dashboardsLoading } = useContext13(
|
|
@@ -37762,7 +37669,8 @@ var useDashboards = () => {
|
|
|
37762
37669
|
reports: Object.values(dashboard.config.sections ?? {}).flat(),
|
|
37763
37670
|
tenantKeys: dashboard.config.tenantKeys,
|
|
37764
37671
|
createdAt: dashboard.config.createdAt,
|
|
37765
|
-
sectionOrder: dashboard.config.sectionOrder
|
|
37672
|
+
sectionOrder: dashboard.config.sectionOrder,
|
|
37673
|
+
hidden: dashboard.config.hidden
|
|
37766
37674
|
};
|
|
37767
37675
|
}).sort(
|
|
37768
37676
|
(a, b) => (a.createdAt?.getTime() ?? 0) - (b.createdAt?.getTime() ?? 0)
|
|
@@ -38493,14 +38401,6 @@ var useDashboard = (dashboardName, config) => {
|
|
|
38493
38401
|
additionalProcessing
|
|
38494
38402
|
);
|
|
38495
38403
|
const usePivotTask = !cacheEnabled && !!reportInfo.pivot;
|
|
38496
|
-
profileDashboard("dashboard-report-cache-path", {
|
|
38497
|
-
reportId,
|
|
38498
|
-
cacheEnabled,
|
|
38499
|
-
cacheCabCacheable: cacheCab.isCacheable(reportId),
|
|
38500
|
-
usePivotTask,
|
|
38501
|
-
forceCacheToRefresh,
|
|
38502
|
-
hasPivot: Boolean(reportInfo.pivot)
|
|
38503
|
-
});
|
|
38504
38404
|
const allFilters = dashboardFilters2.concat(customFilters).concat(customReportFiltersArray);
|
|
38505
38405
|
const applyInMemoryPivotIfNeeded = (report2) => {
|
|
38506
38406
|
const pivotToApply = reportInfo.pivot ?? report2.pivot;
|
|
@@ -38734,9 +38634,7 @@ var useDashboard = (dashboardName, config) => {
|
|
|
38734
38634
|
pivotColumns: pivotData.columns,
|
|
38735
38635
|
pivotRowCount: pivotData.rowCount,
|
|
38736
38636
|
pivotQuery: pivotData.pivotQuery,
|
|
38737
|
-
comparisonPivotQuery: pivotData.comparisonPivotQuery
|
|
38738
|
-
pivotResultRowField: pivotData.rowField,
|
|
38739
|
-
pivotResultSourceRowField: reportInfo.pivot?.rowField
|
|
38637
|
+
comparisonPivotQuery: pivotData.comparisonPivotQuery
|
|
38740
38638
|
},
|
|
38741
38639
|
error: void 0
|
|
38742
38640
|
};
|
|
@@ -38766,26 +38664,6 @@ var useDashboard = (dashboardName, config) => {
|
|
|
38766
38664
|
shareRequest: !forceCacheToRefresh
|
|
38767
38665
|
});
|
|
38768
38666
|
};
|
|
38769
|
-
const existingState = queryClient.getQueryState(queryKey);
|
|
38770
|
-
const existingData = queryClient.getQueryData(queryKey);
|
|
38771
|
-
const dataUpdatedAt = existingState?.dataUpdatedAt ?? 0;
|
|
38772
|
-
const ageMs = dataUpdatedAt ? Date.now() - dataUpdatedAt : null;
|
|
38773
|
-
const isStale = dataUpdatedAt === 0 || Date.now() - dataUpdatedAt >= reportStaleTimeMs;
|
|
38774
|
-
profileDashboard("dashboard-report-tanstack-cache", {
|
|
38775
|
-
reportId,
|
|
38776
|
-
keyFamily: "quill/dashboard-report",
|
|
38777
|
-
cacheEnabled,
|
|
38778
|
-
usePivotTask,
|
|
38779
|
-
forceCacheToRefresh,
|
|
38780
|
-
staleTimeMs: reportStaleTimeMs,
|
|
38781
|
-
status: existingState?.status ?? "missing",
|
|
38782
|
-
fetchStatus: existingState?.fetchStatus ?? "idle",
|
|
38783
|
-
hasData: existingData !== void 0,
|
|
38784
|
-
dataUpdatedAt,
|
|
38785
|
-
ageMs,
|
|
38786
|
-
isStale,
|
|
38787
|
-
willReuseTanstack: !forceCacheToRefresh && existingData !== void 0 && !isStale
|
|
38788
|
-
});
|
|
38789
38667
|
const result = forceCacheToRefresh ? await fetchDashboardReport() : await queryClient.fetchQuery({
|
|
38790
38668
|
queryKey,
|
|
38791
38669
|
queryFn: fetchDashboardReport,
|
|
@@ -39188,7 +39066,6 @@ var useDashboardReport = (reportId, config) => {
|
|
|
39188
39066
|
};
|
|
39189
39067
|
|
|
39190
39068
|
// src/components/Dashboard/DataLoader.tsx
|
|
39191
|
-
init_dashboardProfiler();
|
|
39192
39069
|
import { Fragment as Fragment5, jsx as jsx46 } from "react/jsx-runtime";
|
|
39193
39070
|
var constructReportFromItem = (item) => {
|
|
39194
39071
|
return {
|
|
@@ -41604,7 +41481,6 @@ function QuillTableDashboardComponent({
|
|
|
41604
41481
|
|
|
41605
41482
|
// src/Chart.tsx
|
|
41606
41483
|
init_valueFormatter();
|
|
41607
|
-
init_dashboardProfiler();
|
|
41608
41484
|
import { Fragment as Fragment6, jsx as jsx50, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
41609
41485
|
function Chart({
|
|
41610
41486
|
colors,
|
|
@@ -45596,7 +45472,6 @@ init_Filter();
|
|
|
45596
45472
|
|
|
45597
45473
|
// src/StaticChart.tsx
|
|
45598
45474
|
import { useEffect as useEffect20, useMemo as useMemo21 } from "react";
|
|
45599
|
-
init_dashboardProfiler();
|
|
45600
45475
|
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
45601
45476
|
var CHART_TYPE_STYLES = {
|
|
45602
45477
|
metric: { height: "100px", width: "200px" },
|
|
@@ -46445,6 +46320,7 @@ var QuillProvider = ({
|
|
|
46445
46320
|
isAdmin,
|
|
46446
46321
|
getAuthorizationToken,
|
|
46447
46322
|
eventTracking,
|
|
46323
|
+
onChangelogs,
|
|
46448
46324
|
children
|
|
46449
46325
|
}
|
|
46450
46326
|
) });
|
|
@@ -62563,7 +62439,6 @@ function resolveReportFromCacheCab({
|
|
|
62563
62439
|
}
|
|
62564
62440
|
|
|
62565
62441
|
// src/hooks/useForm.tsx
|
|
62566
|
-
init_dashboardProfiler();
|
|
62567
62442
|
init_reportRequestPool();
|
|
62568
62443
|
|
|
62569
62444
|
// src/hooks/useForm.queries.ts
|
|
@@ -62609,15 +62484,6 @@ function createUseFormInitialLoadQueryKey(input) {
|
|
|
62609
62484
|
input.additionalSchemaHash
|
|
62610
62485
|
];
|
|
62611
62486
|
}
|
|
62612
|
-
var DASHBOARD_REPORT_STALE_TIME_MS = 5 * 60 * 1e3;
|
|
62613
|
-
function findCachedDashboardReportQuery(queryClient, reportId) {
|
|
62614
|
-
const id = String(reportId ?? "").trim();
|
|
62615
|
-
if (!id) return void 0;
|
|
62616
|
-
return queryClient.getQueryCache().findAll({ queryKey: ["quill", "dashboard-report", id] }).find((query) => {
|
|
62617
|
-
const data = query.state.data;
|
|
62618
|
-
return Boolean(data?.report) && !data?.error;
|
|
62619
|
-
});
|
|
62620
|
-
}
|
|
62621
62487
|
function shouldBootstrapUseFormInitialLoad(input) {
|
|
62622
62488
|
return !input.hasInitialReportBuilderState && input.previouslyBootstrappedIdentity !== input.currentIdentity;
|
|
62623
62489
|
}
|
|
@@ -63600,11 +63466,6 @@ function getPivotTableSlotReportColumn(reportColumns, aggregations, rowField, pi
|
|
|
63600
63466
|
}
|
|
63601
63467
|
return cols[aggIndex + 1];
|
|
63602
63468
|
}
|
|
63603
|
-
function pivotRowKey(chart) {
|
|
63604
|
-
return String(
|
|
63605
|
-
chart?.pivotResultRowField ?? chart?.pivot?.rowField ?? ""
|
|
63606
|
-
).trim();
|
|
63607
|
-
}
|
|
63608
63469
|
function isPivotTableDateBucketRowAxis(chart, xAxisField) {
|
|
63609
63470
|
if (!chart?.pivot) return false;
|
|
63610
63471
|
if (String(chart.chartType ?? "").toLowerCase() !== "table") return false;
|
|
@@ -63613,8 +63474,7 @@ function isPivotTableDateBucketRowAxis(chart, xAxisField) {
|
|
|
63613
63474
|
}
|
|
63614
63475
|
const rowField = String(chart.pivot.rowField ?? "").trim();
|
|
63615
63476
|
const xf = String(xAxisField ?? "").trim();
|
|
63616
|
-
|
|
63617
|
-
if (!rowField || xf !== rowField && xf !== rowKey) return false;
|
|
63477
|
+
if (!rowField || xf !== rowField) return false;
|
|
63618
63478
|
return isDateType(String(chart.pivot.rowFieldType ?? ""));
|
|
63619
63479
|
}
|
|
63620
63480
|
var RESOLVABLE_X_AXIS_DATE_BUCKETS = /* @__PURE__ */ new Set([
|
|
@@ -63628,24 +63488,22 @@ function resolvePivotDateBucketXAxisFormat(chart, xAxisField) {
|
|
|
63628
63488
|
const dateBucket = String(chart?.pivot?.dateBucket ?? "").trim().toLowerCase();
|
|
63629
63489
|
if (!RESOLVABLE_X_AXIS_DATE_BUCKETS.has(dateBucket)) return null;
|
|
63630
63490
|
const rowField = String(chart?.pivot?.rowField ?? "").trim();
|
|
63631
|
-
|
|
63632
|
-
const rowKey = pivotRowKey(chart);
|
|
63633
|
-
if (!rowField || xf !== rowField && xf !== rowKey) return null;
|
|
63491
|
+
if (!rowField || String(xAxisField ?? "").trim() !== rowField) return null;
|
|
63634
63492
|
if (!isDateType(String(chart?.pivot?.rowFieldType ?? ""))) return null;
|
|
63635
63493
|
return getDateFormatFromBucket(dateBucket);
|
|
63636
63494
|
}
|
|
63637
63495
|
function chartDetailRowsMissingPivotRowBucket(chart) {
|
|
63638
63496
|
if (!chart?.pivot) return false;
|
|
63639
|
-
const
|
|
63640
|
-
if (!
|
|
63497
|
+
const rowField = String(chart.pivot.rowField ?? "").trim();
|
|
63498
|
+
if (!rowField) return false;
|
|
63641
63499
|
const rows = chart.rows;
|
|
63642
63500
|
if (!Array.isArray(rows) || rows.length === 0) return false;
|
|
63643
63501
|
const first = rows.find(
|
|
63644
63502
|
(r) => r && typeof r === "object" && Object.keys(r).length > 0
|
|
63645
63503
|
);
|
|
63646
63504
|
if (!first) return false;
|
|
63647
|
-
if (!Object.prototype.hasOwnProperty.call(first,
|
|
63648
|
-
const v = first[
|
|
63505
|
+
if (!Object.prototype.hasOwnProperty.call(first, rowField)) return true;
|
|
63506
|
+
const v = first[rowField];
|
|
63649
63507
|
return v === void 0 || v === null;
|
|
63650
63508
|
}
|
|
63651
63509
|
function shouldUsePivotRowFieldAsXAxis(chartType, pivotRowField, rowColumnFormat) {
|
|
@@ -63681,7 +63539,7 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63681
63539
|
} : chart;
|
|
63682
63540
|
if (!config) return config;
|
|
63683
63541
|
if (!config.pivot) return config;
|
|
63684
|
-
const pivotRowFieldEarly =
|
|
63542
|
+
const pivotRowFieldEarly = String(config.pivot?.rowField ?? "").trim();
|
|
63685
63543
|
const rowColumn = (config.pivotColumns ?? config.columns ?? []).find(
|
|
63686
63544
|
(col) => String(col.field ?? "").trim() === pivotRowFieldEarly
|
|
63687
63545
|
);
|
|
@@ -63700,11 +63558,23 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63700
63558
|
const firstPivotRow = (withResolvedXAxis.rows ?? []).find(
|
|
63701
63559
|
(row) => Object.keys(row).length > 0
|
|
63702
63560
|
);
|
|
63703
|
-
const
|
|
63704
|
-
|
|
63705
|
-
)
|
|
63561
|
+
const pivotRowFieldName = String(
|
|
63562
|
+
withResolvedXAxis.pivot?.rowField ?? ""
|
|
63563
|
+
).trim();
|
|
63564
|
+
const pivotRowFields = firstPivotRow ? (() => {
|
|
63565
|
+
const keys = Object.keys(firstPivotRow).filter(
|
|
63566
|
+
(field) => !INTERNAL_PIVOT_ROW_FIELDS.has(field)
|
|
63567
|
+
);
|
|
63568
|
+
if (pivotRowFieldName && keys.includes(pivotRowFieldName)) {
|
|
63569
|
+
return [
|
|
63570
|
+
pivotRowFieldName,
|
|
63571
|
+
...keys.filter((field) => field !== pivotRowFieldName)
|
|
63572
|
+
];
|
|
63573
|
+
}
|
|
63574
|
+
return keys;
|
|
63575
|
+
})() : [];
|
|
63706
63576
|
const pivotValueFields = pivotRowFields.filter(
|
|
63707
|
-
(field) => field !==
|
|
63577
|
+
(field) => field !== withResolvedXAxis.pivot?.rowField
|
|
63708
63578
|
);
|
|
63709
63579
|
const isAggregationOnlyPivot = !String(withResolvedXAxis.pivot?.rowField ?? "").trim() && !String(withResolvedXAxis.pivot?.columnField ?? "").trim();
|
|
63710
63580
|
const yAxisFormatByField = new Map(
|
|
@@ -63715,6 +63585,10 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63715
63585
|
);
|
|
63716
63586
|
const resolveYAxisFormat = (field, aggregation) => {
|
|
63717
63587
|
if (aggregation?.aggregationType === "count") {
|
|
63588
|
+
const savedFormat = yAxisFormatByField.get(field) ?? yAxisFormatByField.get("count") ?? withResolvedXAxis.yAxisFields?.find(
|
|
63589
|
+
(axis) => String(axis.field ?? "").trim() === field
|
|
63590
|
+
)?.format ?? withResolvedXAxis.yAxisFields?.[0]?.format;
|
|
63591
|
+
if (savedFormat) return savedFormat;
|
|
63718
63592
|
return "whole_number";
|
|
63719
63593
|
}
|
|
63720
63594
|
if (aggregation?.aggregationType === "percentage") {
|
|
@@ -63821,7 +63695,7 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63821
63695
|
const normalizedPivotColumns = pivotColumnFields.length > 0 ? pivotColumnFields.map((field) => {
|
|
63822
63696
|
const knownColumn = knownColumnsByField.get(field);
|
|
63823
63697
|
const yAxis = yAxisFields.find((axis) => axis.field === field);
|
|
63824
|
-
const format9 = yAxis?.format ?? knownColumn?.format ?? (field ===
|
|
63698
|
+
const format9 = yAxis?.format ?? knownColumn?.format ?? (field === withResolvedXAxis.pivot?.rowField ? isMetricOrGauge ? "string" : withResolvedXAxis.xAxisFormat ?? "string" : yAxisFallbackFormat);
|
|
63825
63699
|
return {
|
|
63826
63700
|
field,
|
|
63827
63701
|
label: yAxis?.label ?? knownColumn?.label ?? field,
|
|
@@ -63834,7 +63708,7 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63834
63708
|
const slotCol = getPivotTableSlotReportColumn(
|
|
63835
63709
|
pivotTableSlotColumns,
|
|
63836
63710
|
aggregations,
|
|
63837
|
-
|
|
63711
|
+
withResolvedXAxis.pivot?.rowField,
|
|
63838
63712
|
col.field
|
|
63839
63713
|
);
|
|
63840
63714
|
if (!slotCol) return col;
|
|
@@ -63856,7 +63730,9 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63856
63730
|
const normalizedXAxisFormat = normalizedXAxisField === withResolvedXAxis.xAxisField ? withResolvedXAxis.xAxisFormat : yAxisFields.find((axis) => axis.field === normalizedXAxisField)?.format ?? pivotTableDisplayColumns.find(
|
|
63857
63731
|
(column) => column.field === normalizedXAxisField
|
|
63858
63732
|
)?.format ?? withResolvedXAxis.xAxisFormat;
|
|
63859
|
-
const pivotDisplayRowField =
|
|
63733
|
+
const pivotDisplayRowField = String(
|
|
63734
|
+
withResolvedXAxis.pivot?.rowField ?? ""
|
|
63735
|
+
).trim();
|
|
63860
63736
|
const pivotDisplayRowFieldType = String(
|
|
63861
63737
|
withResolvedXAxis.pivot?.rowFieldType ?? ""
|
|
63862
63738
|
).trim();
|
|
@@ -66820,30 +66696,19 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66820
66696
|
)
|
|
66821
66697
|
});
|
|
66822
66698
|
const diagnostics = globalThis.__QUILL_CACHECAB_DIAGNOSTICS__;
|
|
66823
|
-
const durationMs = performance.now() - startedAt;
|
|
66824
|
-
const outcome = resolution.resolved ? "hit" : "fallback";
|
|
66825
66699
|
if (Array.isArray(diagnostics)) {
|
|
66826
66700
|
diagnostics.push({
|
|
66827
66701
|
reportId: effectiveReportId,
|
|
66828
66702
|
operation,
|
|
66829
|
-
outcome,
|
|
66703
|
+
outcome: resolution.resolved ? "hit" : "fallback",
|
|
66830
66704
|
reason: resolution.resolved ? "complete" : resolution.reason,
|
|
66831
66705
|
details: resolution.resolved ? void 0 : resolution.details,
|
|
66832
66706
|
snapshotReason: snapshot?.reason ?? "cache_miss",
|
|
66833
66707
|
forcedIncompleteSnapshot: Boolean(snapshot) && !snapshot?.complete && forceIncompleteCacheCabForParity,
|
|
66834
66708
|
rowCount: snapshot?.rowCount ?? 0,
|
|
66835
|
-
durationMs
|
|
66709
|
+
durationMs: performance.now() - startedAt
|
|
66836
66710
|
});
|
|
66837
66711
|
}
|
|
66838
|
-
profileDashboard("use-report-cachecab", {
|
|
66839
|
-
reportId: effectiveReportId,
|
|
66840
|
-
operation,
|
|
66841
|
-
outcome,
|
|
66842
|
-
reason: resolution.resolved ? "complete" : resolution.reason,
|
|
66843
|
-
snapshotReason: snapshot?.reason ?? "cache_miss",
|
|
66844
|
-
rowCount: snapshot?.rowCount ?? 0,
|
|
66845
|
-
durationMs: Math.round(durationMs * 10) / 10
|
|
66846
|
-
});
|
|
66847
66712
|
return resolution.resolved ? resolution.report : null;
|
|
66848
66713
|
},
|
|
66849
66714
|
[
|
|
@@ -67417,15 +67282,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67417
67282
|
if (alias) localValues[alias] = values;
|
|
67418
67283
|
}
|
|
67419
67284
|
if (hasEveryColumn) {
|
|
67420
|
-
profileDashboard("use-report-unique-values-cachecab-hit", {
|
|
67421
|
-
reportId: effectiveReportId
|
|
67422
|
-
});
|
|
67423
67285
|
return { uniqueValuesByColumn: localValues };
|
|
67424
67286
|
}
|
|
67425
67287
|
}
|
|
67426
|
-
profileDashboard("use-report-unique-values-network", {
|
|
67427
|
-
reportId: effectiveReportId
|
|
67428
|
-
});
|
|
67429
67288
|
const tablesForUniqueValues = filterUniqueValuesRequest.reportBuilderState?.tables?.map(
|
|
67430
67289
|
(table2) => String(table2?.name ?? "").trim()
|
|
67431
67290
|
) ?? filterUniqueValuesRequest.stringColumnsByTable.map((column) => String(column.table ?? "").trim()).filter(Boolean);
|
|
@@ -67944,29 +67803,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67944
67803
|
const initialLoadQuery = useQuery({
|
|
67945
67804
|
queryKey: initialLoadQueryKey,
|
|
67946
67805
|
queryFn: createUseFormQueryFn(async (signal) => {
|
|
67947
|
-
const tanstackState = queryClient.getQueryState(initialLoadQueryKey);
|
|
67948
|
-
const dashboardReportQueries = queryClient.getQueryCache().getAll().filter(
|
|
67949
|
-
(query) => queryKeyFamily(query.queryKey) === "quill/dashboard-report"
|
|
67950
|
-
);
|
|
67951
|
-
const matchingDashboardReport = dashboardReportQueries.find(
|
|
67952
|
-
(query) => String(query.queryKey[2] ?? "") === String(effectiveReportId)
|
|
67953
|
-
);
|
|
67954
|
-
profileDashboard("use-report-initial-load-queryfn", {
|
|
67955
|
-
reportId: effectiveReportId,
|
|
67956
|
-
reason: "TanStack ran this queryFn, so useReport/initial-load had no fresh cached data",
|
|
67957
|
-
keyFamily: "useReport/initial-load",
|
|
67958
|
-
status: tanstackState?.status ?? "missing",
|
|
67959
|
-
hasData: tanstackState?.data !== void 0,
|
|
67960
|
-
dataUpdatedAt: tanstackState?.dataUpdatedAt ?? 0,
|
|
67961
|
-
staleTime: 0,
|
|
67962
|
-
dashboardReportQueryCount: dashboardReportQueries.length,
|
|
67963
|
-
matchingDashboardReport: matchingDashboardReport ? {
|
|
67964
|
-
hasData: matchingDashboardReport.state.data !== void 0,
|
|
67965
|
-
status: matchingDashboardReport.state.status,
|
|
67966
|
-
staleTime: matchingDashboardReport.options?.staleTime ?? 0,
|
|
67967
|
-
unusedByUseReport: true
|
|
67968
|
-
} : null
|
|
67969
|
-
});
|
|
67970
67806
|
let cachedReportBuilderState = initialReportBuilderStateForLoad ?? void 0;
|
|
67971
67807
|
if (!cachedReportBuilderState) {
|
|
67972
67808
|
const snapshot = await cacheCab.getReportSnapshot(
|
|
@@ -67991,9 +67827,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67991
67827
|
operation: "initial"
|
|
67992
67828
|
});
|
|
67993
67829
|
if (cachedReport) {
|
|
67994
|
-
profileDashboard("use-report-initial-load-served-from-cachecab", {
|
|
67995
|
-
reportId: effectiveReportId
|
|
67996
|
-
});
|
|
67997
67830
|
return { report: cachedReport };
|
|
67998
67831
|
}
|
|
67999
67832
|
const allowReportTaskBootstrap = shouldBootstrapUseFormInitialLoad({
|
|
@@ -68008,12 +67841,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68008
67841
|
const formFiltersBelongToLoadTarget = Boolean(loadTargetId) && sourceReportIdentity === loadTargetId;
|
|
68009
67842
|
const rulesForLoad = useInMemoryEngines || !formFiltersBelongToLoadTarget ? EMPTY_QUERY_FILTERS : queryFilters;
|
|
68010
67843
|
const shareInitialRequest = sharedInitialRequestUsedForReportIdRef.current !== effectiveReportId;
|
|
68011
|
-
profileDashboard("use-report-initial-load-network", {
|
|
68012
|
-
reportId: effectiveReportId,
|
|
68013
|
-
path: "loadReportForUseForm",
|
|
68014
|
-
hasCachedReportBuilderState: Boolean(cachedReportBuilderState)
|
|
68015
|
-
});
|
|
68016
|
-
const networkStartedAt = performance.now();
|
|
68017
67844
|
const loadResult = await loadReportForUseForm({
|
|
68018
67845
|
reportId: effectiveReportId,
|
|
68019
67846
|
initialReportBuilderState: initialReportBuilderStateForLoad,
|
|
@@ -68033,12 +67860,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68033
67860
|
rowsOnly: isCreatedReportBootstrapLoad,
|
|
68034
67861
|
abortSignal: signal
|
|
68035
67862
|
});
|
|
68036
|
-
profileDashboard("use-report-initial-load-network-done", {
|
|
68037
|
-
reportId: effectiveReportId,
|
|
68038
|
-
durationMs: Math.round(performance.now() - networkStartedAt),
|
|
68039
|
-
hasReport: Boolean(loadResult.report),
|
|
68040
|
-
error: loadResult.error ?? null
|
|
68041
|
-
});
|
|
68042
67863
|
if (loadResult.report && !loadResult.error) {
|
|
68043
67864
|
if (allowReportTaskBootstrap) {
|
|
68044
67865
|
bootstrapReportTaskUsedForInitialLoadRef.current = initialLoadIdentityHash;
|
|
@@ -68050,17 +67871,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68050
67871
|
return loadResult;
|
|
68051
67872
|
}),
|
|
68052
67873
|
enabled: Boolean(effectiveReportId) && Boolean(client) && !reportOverride,
|
|
68053
|
-
retry: false
|
|
68054
|
-
initialData: () => {
|
|
68055
|
-
const cached = findCachedDashboardReportQuery(
|
|
68056
|
-
queryClient,
|
|
68057
|
-
effectiveReportId
|
|
68058
|
-
);
|
|
68059
|
-
const data = cached?.state.data;
|
|
68060
|
-
return data?.report ? { report: data.report, error: data.error } : void 0;
|
|
68061
|
-
},
|
|
68062
|
-
initialDataUpdatedAt: () => findCachedDashboardReportQuery(queryClient, effectiveReportId)?.state.dataUpdatedAt,
|
|
68063
|
-
staleTime: DASHBOARD_REPORT_STALE_TIME_MS
|
|
67874
|
+
retry: false
|
|
68064
67875
|
});
|
|
68065
67876
|
const reportNameQueryReportId = String(effectiveReportId ?? "").trim();
|
|
68066
67877
|
const reportNameQuery = useQuery({
|
|
@@ -68111,6 +67922,15 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68111
67922
|
const shouldPromoteColumnToRowFromPendingFlag = pendingPromoteColumnToRow && !String(prev.groupRowsBy ?? "").trim();
|
|
68112
67923
|
const sourceReportBuilderTables = (sourceReport.reportBuilderState?.tables ?? []).filter((table2) => Boolean(String(table2?.name ?? "").trim()));
|
|
68113
67924
|
const sourceReportBuilderTableNames = sourceReportBuilderTables.map((table2) => table2.name).filter((name2) => Boolean(name2));
|
|
67925
|
+
const sourceQueryColumns = normalizeReportBuilderColumns(
|
|
67926
|
+
sourceReport.reportBuilderState?.columns ?? (sourceReport.columns ?? []).map((column) => ({
|
|
67927
|
+
field: column.field,
|
|
67928
|
+
table: column.table ?? resolveColumnTableFromReportMetadata(
|
|
67929
|
+
sourceReport,
|
|
67930
|
+
column.field
|
|
67931
|
+
)
|
|
67932
|
+
}))
|
|
67933
|
+
);
|
|
68114
67934
|
const nextQueryFilters = prev.queryFilters.rules.length ? prev.queryFilters : rulesFromReport(sourceReport);
|
|
68115
67935
|
const pivotAggregationsFromSource = Array.isArray(sourceReport.pivot?.aggregations) ? sourceReport.pivot.aggregations : sourceReport.pivot?.aggregationType ? [
|
|
68116
67936
|
{
|
|
@@ -68177,9 +67997,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68177
67997
|
tables: tableScopeForDisplayColumns,
|
|
68178
67998
|
schemaTables: schemaForReportBuilderState
|
|
68179
67999
|
});
|
|
68180
|
-
const sourceQueryColumns = normalizeReportBuilderColumns(
|
|
68181
|
-
sourceReport.reportBuilderState?.columns?.length ? sourceReport.reportBuilderState.columns : sourceDisplayColumnsFromSchema
|
|
68182
|
-
);
|
|
68183
68000
|
const savedDisplayColumns = normalizeReportBuilderColumns(
|
|
68184
68001
|
(sourceReport.columns ?? []).map((column) => ({
|
|
68185
68002
|
...column,
|
|
@@ -68693,12 +68510,13 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68693
68510
|
tables: effectiveReportBuilderState.tables,
|
|
68694
68511
|
schemaTables: schemaForReportBuilderState
|
|
68695
68512
|
});
|
|
68696
|
-
|
|
68513
|
+
const columnsToFetch = allColumnsBySelectedTable.length > 0 ? allColumnsBySelectedTable : effectiveReportBuilderState.columns;
|
|
68514
|
+
if (columnsToFetch.length === 0) {
|
|
68697
68515
|
return void 0;
|
|
68698
68516
|
}
|
|
68699
68517
|
return {
|
|
68700
68518
|
...effectiveReportBuilderState,
|
|
68701
|
-
columns:
|
|
68519
|
+
columns: columnsToFetch,
|
|
68702
68520
|
pivot: null,
|
|
68703
68521
|
sort: [],
|
|
68704
68522
|
limit: null
|
|
@@ -68741,29 +68559,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68741
68559
|
refreshDecision.shouldRefresh,
|
|
68742
68560
|
queryFilters
|
|
68743
68561
|
]);
|
|
68744
|
-
const shouldSkipRedundantPivotTableDataQuery = useMemo33(() => {
|
|
68745
|
-
if (!sourceReport || !pivotState) {
|
|
68746
|
-
return false;
|
|
68747
|
-
}
|
|
68748
|
-
if (tableRefreshVersion !== 0 || pivotRefreshVersion !== 0) {
|
|
68749
|
-
return false;
|
|
68750
|
-
}
|
|
68751
|
-
if (!Array.isArray(sourceReport.rows) || sourceReport.rows.length === 0) {
|
|
68752
|
-
return false;
|
|
68753
|
-
}
|
|
68754
|
-
if (refreshDecision.shouldRefresh) {
|
|
68755
|
-
return false;
|
|
68756
|
-
}
|
|
68757
|
-
const sourceRules = sourceReport.reportBuilderState?.rules ?? EMPTY_QUERY_FILTERS;
|
|
68758
|
-
return stableSerializeForQueryKey(queryFilters) === stableSerializeForQueryKey(sourceRules);
|
|
68759
|
-
}, [
|
|
68760
|
-
sourceReport,
|
|
68761
|
-
pivotState,
|
|
68762
|
-
tableRefreshVersion,
|
|
68763
|
-
pivotRefreshVersion,
|
|
68764
|
-
refreshDecision.shouldRefresh,
|
|
68765
|
-
queryFilters
|
|
68766
|
-
]);
|
|
68767
68562
|
const shouldForceTableRefreshFromFilters = !useInMemoryEngines && !pivotState;
|
|
68768
68563
|
const immediateTableRefreshInput = useMemo33(
|
|
68769
68564
|
() => ({
|
|
@@ -68812,14 +68607,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68812
68607
|
operation: "table"
|
|
68813
68608
|
});
|
|
68814
68609
|
if (cachedReport) {
|
|
68815
|
-
profileDashboard("use-report-table-refresh-cachecab-hit", {
|
|
68816
|
-
reportId: effectiveReportId
|
|
68817
|
-
});
|
|
68818
68610
|
return { report: cachedReport };
|
|
68819
68611
|
}
|
|
68820
|
-
profileDashboard("use-report-table-refresh-network", {
|
|
68821
|
-
reportId: effectiveReportId
|
|
68822
|
-
});
|
|
68823
68612
|
return loadViaReportBuilderState({
|
|
68824
68613
|
reportId: effectiveReportId,
|
|
68825
68614
|
reportBuilderState: tableRefreshInput.reportBuilderState,
|
|
@@ -69433,8 +69222,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69433
69222
|
sourceReport
|
|
69434
69223
|
]);
|
|
69435
69224
|
const pivotRefreshQueryEnabled = !reportOverride && pendingPivotRefresh && !shouldSkipPivotRefreshForUnchangedPivot && Boolean(sourceReport) && Boolean(client) && Boolean(effectiveReportBuilderState) && Boolean(nextPivot) && sourceReportMatchesEffectiveReportId;
|
|
69436
|
-
const
|
|
69437
|
-
const pivotTableDataRefreshQueryEnabled = !reportOverride && Boolean(sourceReport) && Boolean(client) && Boolean(nextPivot) && Boolean(pivotTableDataReportBuilderState) && !pendingPivotRefresh && sourceReportMatchesEffectiveReportId && initialLoadSettled && !shouldSkipRedundantPivotTableDataQuery;
|
|
69225
|
+
const pivotTableDataRefreshQueryEnabled = !reportOverride && Boolean(sourceReport) && Boolean(client) && Boolean(nextPivot) && Boolean(pivotTableDataReportBuilderState) && !pendingPivotRefresh && sourceReportMatchesEffectiveReportId;
|
|
69438
69226
|
const pivotRefreshQuery = useQuery({
|
|
69439
69227
|
queryKey: createUseFormPivotRefreshQueryKey({
|
|
69440
69228
|
reportId: effectiveReportId,
|
|
@@ -69548,7 +69336,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69548
69336
|
const paginationRangeStart = pagination.pageIndex * pagination.pageSize;
|
|
69549
69337
|
const paginationRangeEnd = paginationRangeStart + pagination.pageSize;
|
|
69550
69338
|
const pageWithinBaseWindow = paginationRangeEnd <= baseWindowRowsLength || trustedSourceRowCount !== void 0 && trustedSourceRowCount <= baseWindowRowsLength;
|
|
69551
|
-
const tablePageQueryEnabled = !pageWithinBaseWindow && !reportOverride && !useInMemoryEngines && Boolean(client) && Boolean(sourceReport) && Boolean(tablePageReportBuilderState) && sourceReportMatchesEffectiveReportId && !pendingPivotRefresh
|
|
69339
|
+
const tablePageQueryEnabled = !pageWithinBaseWindow && !reportOverride && !useInMemoryEngines && Boolean(client) && Boolean(sourceReport) && Boolean(tablePageReportBuilderState) && sourceReportMatchesEffectiveReportId && !pendingPivotRefresh;
|
|
69552
69340
|
const tablePageQuery = useQuery({
|
|
69553
69341
|
queryKey: createUseFormTablePageQueryKey({
|
|
69554
69342
|
reportId: effectiveReportId,
|
|
@@ -69720,17 +69508,21 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69720
69508
|
if (!sourceReport) return void 0;
|
|
69721
69509
|
const rowsForChart = Array.isArray(sourceReport.rows) ? sourceReport.rows : [];
|
|
69722
69510
|
const chartPivot = pendingPivotChangesDimensions ? sourceReport.pivot ?? null : nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
|
|
69723
|
-
const
|
|
69511
|
+
const chartPivotForDisplay = chartPivot && sourceReport.pivotResultRowField && sourceReport.pivotResultSourceRowField === chartPivot.rowField ? {
|
|
69512
|
+
...chartPivot,
|
|
69513
|
+
rowField: sourceReport.pivotResultRowField
|
|
69514
|
+
} : chartPivot;
|
|
69515
|
+
const rowCountForChart = chartPivotForDisplay ? sourceReport.pivotRowCount ?? (Array.isArray(sourceReport.pivotRows) ? sourceReport.pivotRows.length : sourceReport.rowCount) : useInMemoryEngines ? rowsForChart.length : sourceReport.rowCount;
|
|
69724
69516
|
const referencedTablesForChart = effectiveReportBuilderState?.tables.map((table2) => table2.name).filter((name2) => Boolean(name2));
|
|
69725
69517
|
const pivotRowsForChart = Array.isArray(sourceReport.pivotRows) ? sourceReport.pivotRows : void 0;
|
|
69726
|
-
const rowCountForChartResolved =
|
|
69518
|
+
const rowCountForChartResolved = chartPivotForDisplay ? Array.isArray(pivotRowsForChart) ? pivotRowsForChart.length : rowCountForChart : rowCountForChart;
|
|
69727
69519
|
const chartDataPayload = {
|
|
69728
69520
|
...sourceReport,
|
|
69729
69521
|
rows: rowsForChart,
|
|
69730
69522
|
rowCount: rowCountForChartResolved,
|
|
69731
69523
|
chartType: chartType ?? sourceReport.chartType,
|
|
69732
69524
|
reportBuilderState: effectiveReportBuilderState,
|
|
69733
|
-
pivot:
|
|
69525
|
+
pivot: chartPivotForDisplay,
|
|
69734
69526
|
referencedTables: referencedTablesForChart && referencedTablesForChart.length > 0 ? referencedTablesForChart : sourceReport.referencedTables,
|
|
69735
69527
|
pivotRows: pivotRowsForChart,
|
|
69736
69528
|
pivotColumns: sourceReport.pivotColumns,
|
|
@@ -69781,6 +69573,15 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69781
69573
|
}
|
|
69782
69574
|
for (const yAxis2 of chartAxesBaseChart.yAxisFields ?? []) {
|
|
69783
69575
|
registerOption(yAxis2.field, yAxis2.label, yAxis2.format);
|
|
69576
|
+
if (yAxis2.format) {
|
|
69577
|
+
const existing = optionsByField.get(yAxis2.field);
|
|
69578
|
+
if (existing) {
|
|
69579
|
+
optionsByField.set(yAxis2.field, {
|
|
69580
|
+
...existing,
|
|
69581
|
+
format: toAxisFormat(yAxis2.format, existing.format)
|
|
69582
|
+
});
|
|
69583
|
+
}
|
|
69584
|
+
}
|
|
69784
69585
|
}
|
|
69785
69586
|
if (chartAxesBaseChart.pivot?.columnField) {
|
|
69786
69587
|
for (const aggregationAxis of buildPivotAggregationAxisFields(
|
|
@@ -69794,11 +69595,22 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69794
69595
|
);
|
|
69795
69596
|
}
|
|
69796
69597
|
}
|
|
69598
|
+
const xField = String(chartAxesBaseChart.xAxisField ?? "").trim();
|
|
69599
|
+
const savedXFormat = String(chartAxesBaseChart.xAxisFormat ?? "").trim();
|
|
69797
69600
|
registerOption(
|
|
69798
|
-
|
|
69601
|
+
xField,
|
|
69799
69602
|
chartAxesBaseChart.xAxisLabel || chartAxesBaseChart.xAxisField,
|
|
69800
69603
|
chartAxesBaseChart.xAxisFormat
|
|
69801
69604
|
);
|
|
69605
|
+
if (xField && savedXFormat) {
|
|
69606
|
+
const existing = optionsByField.get(xField);
|
|
69607
|
+
if (existing) {
|
|
69608
|
+
optionsByField.set(xField, {
|
|
69609
|
+
...existing,
|
|
69610
|
+
format: toAxisFormat(savedXFormat, existing.format)
|
|
69611
|
+
});
|
|
69612
|
+
}
|
|
69613
|
+
}
|
|
69802
69614
|
return Array.from(optionsByField.values());
|
|
69803
69615
|
}, [chartAxesBaseChart, resolveTableDisplayLabel]);
|
|
69804
69616
|
const chartAxisOptionByField = useMemo33(() => {
|
|
@@ -69811,7 +69623,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69811
69623
|
const xAxisOptions = useMemo33(() => {
|
|
69812
69624
|
if (!chartAxesBaseChart) return chartAxisOptions;
|
|
69813
69625
|
const pivot = chartAxesBaseChart.pivot;
|
|
69814
|
-
const pivotRowField =
|
|
69626
|
+
const pivotRowField = String(pivot?.rowField ?? "").trim();
|
|
69815
69627
|
const chartType2 = String(chartAxesBaseChart.chartType ?? "").toLowerCase();
|
|
69816
69628
|
if (pivot && pivotRowField) {
|
|
69817
69629
|
if (["metric", "gauge"].includes(chartType2)) {
|
|
@@ -69932,7 +69744,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69932
69744
|
const resolvedXAxisField = useMemo33(() => {
|
|
69933
69745
|
if (!chartAxesBaseChart) return "";
|
|
69934
69746
|
const chartType2 = String(chartAxesBaseChart.chartType ?? "").toLowerCase();
|
|
69935
|
-
const pivotRowField =
|
|
69747
|
+
const pivotRowField = String(
|
|
69748
|
+
chartAxesBaseChart.pivot?.rowField ?? ""
|
|
69749
|
+
).trim();
|
|
69936
69750
|
if (pivotRowField) {
|
|
69937
69751
|
const rowColumn = (chartAxesBaseChart.pivotColumns ?? chartAxesBaseChart.columns ?? []).find((col) => String(col.field ?? "").trim() === pivotRowField);
|
|
69938
69752
|
if (shouldUsePivotRowFieldAsXAxis(
|
|
@@ -70068,11 +69882,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70068
69882
|
columns2 = mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
70069
69883
|
columns: columns2 ?? baseChart.columns,
|
|
70070
69884
|
yAxisFields: resolvedYAxisFieldsForDisplay,
|
|
70071
|
-
pivotRowField:
|
|
69885
|
+
pivotRowField: String(baseChart.pivot.rowField ?? ""),
|
|
70072
69886
|
xAxisLabel: resolvedXAxisLabel
|
|
70073
69887
|
});
|
|
70074
69888
|
} else {
|
|
70075
|
-
const pivotRowField =
|
|
69889
|
+
const pivotRowField = String(baseChart.pivot.rowField ?? "").trim();
|
|
70076
69890
|
const pivotLabelByField = new Map(
|
|
70077
69891
|
(baseChart.pivotColumns ?? []).map((column) => [
|
|
70078
69892
|
String(column.field ?? "").trim(),
|
|
@@ -70137,10 +69951,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70137
69951
|
const key = String(raw);
|
|
70138
69952
|
const timestamp = new Date(key).getTime();
|
|
70139
69953
|
if (Number.isNaN(timestamp)) continue;
|
|
70140
|
-
labelsByRaw.set(
|
|
70141
|
-
key,
|
|
70142
|
-
String(record[pivotRowKey(chart)] ?? record[rowField] ?? key)
|
|
70143
|
-
);
|
|
69954
|
+
labelsByRaw.set(key, String(record[rowField] ?? key));
|
|
70144
69955
|
const cachedMin = pivotDateFilterRangeCacheRef.current.min;
|
|
70145
69956
|
const cachedMax = pivotDateFilterRangeCacheRef.current.max;
|
|
70146
69957
|
if (cachedMin == null || timestamp < new Date(cachedMin).getTime()) {
|
|
@@ -70441,7 +70252,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70441
70252
|
sourceReport,
|
|
70442
70253
|
includeSelectedSchemaFallback: tableColumnsEditedSignature !== null
|
|
70443
70254
|
});
|
|
70444
|
-
const pivotRowFieldForTable =
|
|
70255
|
+
const pivotRowFieldForTable = String(
|
|
70256
|
+
sourceReport?.pivot?.rowField ?? ""
|
|
70257
|
+
).trim();
|
|
70445
70258
|
const pivotRowTableUsesAxisFormat = chartAxisEdits.xAxisFormat !== void 0;
|
|
70446
70259
|
const columns2 = String(chartType ?? "").toLowerCase() === "table" && sourceReport?.pivot && pivotRowFieldForTable && String(resolvedXAxisField ?? "").trim() === pivotRowFieldForTable ? mergedFromReport.map(
|
|
70447
70260
|
(column) => column.field === pivotRowFieldForTable ? {
|
|
@@ -70453,7 +70266,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70453
70266
|
const pivotLabeledColumns = String(chartType ?? "").toLowerCase() === "table" && sourceReport?.pivot ? mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
70454
70267
|
columns: columns2,
|
|
70455
70268
|
yAxisFields: resolvedYAxisFieldsForDisplay,
|
|
70456
|
-
pivotRowField:
|
|
70269
|
+
pivotRowField: String(sourceReport.pivot.rowField ?? ""),
|
|
70457
70270
|
xAxisLabel: resolvedXAxisLabel
|
|
70458
70271
|
}) ?? columns2 : columns2;
|
|
70459
70272
|
const tableColumnsWithPivotDisplayLabels = pivotLabeledColumns.map(
|
|
@@ -70702,7 +70515,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70702
70515
|
if (slotFormatting) {
|
|
70703
70516
|
const aggregations = slotFormatting.aggregations;
|
|
70704
70517
|
const hasMultiple = aggregations.length > 1;
|
|
70705
|
-
const rowField =
|
|
70518
|
+
const rowField = String(pivotState?.rowField ?? "").trim();
|
|
70706
70519
|
const firstValueColumnFormat = String(
|
|
70707
70520
|
(chart.columns ?? []).find(
|
|
70708
70521
|
(c) => String(c.field ?? "").trim() !== rowField
|
|
@@ -70738,7 +70551,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70738
70551
|
}
|
|
70739
70552
|
}
|
|
70740
70553
|
}
|
|
70741
|
-
const pivotRowFieldForSettings =
|
|
70554
|
+
const pivotRowFieldForSettings = String(
|
|
70555
|
+
chart?.pivot?.rowField ?? ""
|
|
70556
|
+
).trim();
|
|
70742
70557
|
const rowAxisLabel = String(resolvedXAxisLabel ?? "").trim();
|
|
70743
70558
|
for (const columnId of activeTableColumnIds) {
|
|
70744
70559
|
const option = columnOptionById.get(columnId);
|
|
@@ -70798,7 +70613,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70798
70613
|
tableColumnSettingsCoalesceRef.current = new Map(tableColumnSettingsById);
|
|
70799
70614
|
}, [tableColumnSettingsById]);
|
|
70800
70615
|
const tableColumnItems = useMemo33(() => {
|
|
70801
|
-
const pivotRowFieldForFormat =
|
|
70616
|
+
const pivotRowFieldForFormat = String(chart?.pivot?.rowField ?? "").trim();
|
|
70802
70617
|
const pivotRowFieldType = String(chart?.pivot?.rowFieldType ?? "").trim();
|
|
70803
70618
|
const items = activeTableColumnIds.map((columnId) => {
|
|
70804
70619
|
const option = columnOptionById.get(columnId);
|
|
@@ -70837,7 +70652,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70837
70652
|
return new Map(tableColumnItems.map((item) => [item.id, item]));
|
|
70838
70653
|
}, [tableColumnItems]);
|
|
70839
70654
|
const tableColumnValues = useMemo33(() => {
|
|
70840
|
-
const pivotRowFieldForFormat =
|
|
70655
|
+
const pivotRowFieldForFormat = String(chart?.pivot?.rowField ?? "").trim();
|
|
70841
70656
|
const pivotRowFieldType = String(chart?.pivot?.rowFieldType ?? "").trim();
|
|
70842
70657
|
return tableColumnItems.map((item) => {
|
|
70843
70658
|
const coerced = coerceTableColumnFormatToAxisValue(item.format);
|
|
@@ -70858,89 +70673,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70858
70673
|
const initialLoadInProgress = !reportOverride && Boolean(effectiveReportId) && (!client || initialLoadQuery.isPending || initialLoadQuery.isFetching);
|
|
70859
70674
|
const filterUniqueValuesLoading = filterUniqueValuesEnabled && (filterUniqueValuesQuery.isPending || filterUniqueValuesQuery.isFetching);
|
|
70860
70675
|
const chartLoading = initialLoadInProgress || pendingPivotRefresh || (Boolean(nextPivot) ? pivotRefreshQuery.isFetching : tableRefreshQuery.isFetching);
|
|
70861
|
-
const
|
|
70862
|
-
const tableLoading = initialLoadInProgress || pendingPivotRefresh || awaitingPivotDetailRows || tablePageFetching && pagination.pageIndex > 0 || (Boolean(nextPivot) ? pivotTableDataRefreshQuery.isFetching : tableRefreshQuery.isFetching);
|
|
70676
|
+
const tableLoading = initialLoadInProgress || pendingPivotRefresh || tablePageFetching || (Boolean(nextPivot) ? pivotTableDataRefreshQuery.isFetching : tableRefreshQuery.isFetching);
|
|
70863
70677
|
const loading = chartLoading || tableLoading;
|
|
70864
|
-
const lastUseReportLoadingLogRef = useRef24("");
|
|
70865
|
-
useEffect33(() => {
|
|
70866
|
-
const snapshot = {
|
|
70867
|
-
reportId: effectiveReportId,
|
|
70868
|
-
chartLoading,
|
|
70869
|
-
tableLoading,
|
|
70870
|
-
loading,
|
|
70871
|
-
initialLoadInProgress,
|
|
70872
|
-
initialLoad: {
|
|
70873
|
-
status: initialLoadQuery.status,
|
|
70874
|
-
fetchStatus: initialLoadQuery.fetchStatus,
|
|
70875
|
-
isPending: initialLoadQuery.isPending,
|
|
70876
|
-
isFetching: initialLoadQuery.isFetching,
|
|
70877
|
-
hasData: initialLoadQuery.data !== void 0,
|
|
70878
|
-
dataUpdatedAt: initialLoadQuery.dataUpdatedAt,
|
|
70879
|
-
staleTime: 0
|
|
70880
|
-
},
|
|
70881
|
-
pendingPivotRefresh,
|
|
70882
|
-
pivotRefresh: {
|
|
70883
|
-
enabled: pivotRefreshQueryEnabled,
|
|
70884
|
-
isFetching: pivotRefreshQuery.isFetching
|
|
70885
|
-
},
|
|
70886
|
-
tableRefresh: {
|
|
70887
|
-
enabled: tableRefreshQueryEnabled,
|
|
70888
|
-
isFetching: tableRefreshQuery.isFetching
|
|
70889
|
-
},
|
|
70890
|
-
pivotTableData: {
|
|
70891
|
-
enabled: pivotTableDataRefreshQueryEnabled,
|
|
70892
|
-
isFetching: pivotTableDataRefreshQuery.isFetching
|
|
70893
|
-
},
|
|
70894
|
-
tablePage: {
|
|
70895
|
-
enabled: tablePageQueryEnabled,
|
|
70896
|
-
isFetching: tablePageQuery.isFetching
|
|
70897
|
-
},
|
|
70898
|
-
uniqueValues: {
|
|
70899
|
-
enabled: filterUniqueValuesEnabled,
|
|
70900
|
-
isFetching: filterUniqueValuesQuery.isFetching,
|
|
70901
|
-
isPending: filterUniqueValuesQuery.isPending
|
|
70902
|
-
},
|
|
70903
|
-
whyChartLoading: {
|
|
70904
|
-
noClient: !client,
|
|
70905
|
-
initialPending: initialLoadQuery.isPending,
|
|
70906
|
-
initialFetching: initialLoadQuery.isFetching,
|
|
70907
|
-
pendingPivotRefresh,
|
|
70908
|
-
pivotRefreshFetching: Boolean(nextPivot) && pivotRefreshQuery.isFetching,
|
|
70909
|
-
tableRefreshFetching: !nextPivot && tableRefreshQuery.isFetching
|
|
70910
|
-
}
|
|
70911
|
-
};
|
|
70912
|
-
const serialized = JSON.stringify(snapshot);
|
|
70913
|
-
if (serialized === lastUseReportLoadingLogRef.current) return;
|
|
70914
|
-
lastUseReportLoadingLogRef.current = serialized;
|
|
70915
|
-
profileDashboard("use-report-loading", snapshot);
|
|
70916
|
-
}, [
|
|
70917
|
-
client,
|
|
70918
|
-
chartLoading,
|
|
70919
|
-
effectiveReportId,
|
|
70920
|
-
filterUniqueValuesEnabled,
|
|
70921
|
-
filterUniqueValuesQuery.fetchStatus,
|
|
70922
|
-
filterUniqueValuesQuery.isFetching,
|
|
70923
|
-
filterUniqueValuesQuery.isPending,
|
|
70924
|
-
initialLoadInProgress,
|
|
70925
|
-
initialLoadQuery.data,
|
|
70926
|
-
initialLoadQuery.dataUpdatedAt,
|
|
70927
|
-
initialLoadQuery.fetchStatus,
|
|
70928
|
-
initialLoadQuery.isFetching,
|
|
70929
|
-
initialLoadQuery.isPending,
|
|
70930
|
-
initialLoadQuery.status,
|
|
70931
|
-
loading,
|
|
70932
|
-
nextPivot,
|
|
70933
|
-
pendingPivotRefresh,
|
|
70934
|
-
pivotRefreshQuery.isFetching,
|
|
70935
|
-
pivotRefreshQueryEnabled,
|
|
70936
|
-
pivotTableDataRefreshQuery.isFetching,
|
|
70937
|
-
pivotTableDataRefreshQueryEnabled,
|
|
70938
|
-
tableLoading,
|
|
70939
|
-
tablePageQuery.isFetching,
|
|
70940
|
-
tablePageQueryEnabled,
|
|
70941
|
-
tableRefreshQuery.isFetching,
|
|
70942
|
-
tableRefreshQueryEnabled
|
|
70943
|
-
]);
|
|
70944
70678
|
const buildSetReportColumnsFromIds = (nextColumnIds, settingsById) => {
|
|
70945
70679
|
const normalizedNextIds = nextColumnIds.map((columnId) => String(columnId ?? "").trim()).filter(Boolean);
|
|
70946
70680
|
return normalizedNextIds.map((columnId) => {
|
|
@@ -70980,7 +70714,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70980
70714
|
const option = columnOptionById.get(normalizedId);
|
|
70981
70715
|
const pivotField = String(option?.field ?? normalizedId).trim();
|
|
70982
70716
|
const pivotModel = chartAxesBaseChart.pivot;
|
|
70983
|
-
const rowField =
|
|
70717
|
+
const rowField = String(pivotModel?.rowField ?? "").trim();
|
|
70984
70718
|
if (!pivotModel) return null;
|
|
70985
70719
|
const isPivotRowColumn = Boolean(
|
|
70986
70720
|
pivotField && rowField && pivotField === rowField
|