@quillsql/react 2.16.94 → 2.16.96
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 +453 -92
- package/dist/index.js +453 -92
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -15133,7 +15133,7 @@ var init_dates = __esm({
|
|
|
15133
15133
|
init_inMemoryPivotEngine();
|
|
15134
15134
|
init_valueFormatter();
|
|
15135
15135
|
DATE_BUCKET_AXIS_FORMATS = {
|
|
15136
|
-
day: "
|
|
15136
|
+
day: "MMM_dd",
|
|
15137
15137
|
week: "MMM_dd-MMM_dd",
|
|
15138
15138
|
month: "MMM_yyyy",
|
|
15139
15139
|
year: "yyyy"
|
|
@@ -17137,6 +17137,79 @@ var init_paginationProcessing = __esm({
|
|
|
17137
17137
|
}
|
|
17138
17138
|
});
|
|
17139
17139
|
|
|
17140
|
+
// src/utils/dashboardProfiler.ts
|
|
17141
|
+
function profilingEnabled() {
|
|
17142
|
+
if (typeof process !== "undefined" && process.env?.QUILL_DASHBOARD_PROFILE === "true") {
|
|
17143
|
+
return true;
|
|
17144
|
+
}
|
|
17145
|
+
if (typeof window === "undefined") return false;
|
|
17146
|
+
return Boolean(window.__QUILL_DASHBOARD_PROFILE__);
|
|
17147
|
+
}
|
|
17148
|
+
function profileStore() {
|
|
17149
|
+
if (typeof window !== "undefined") {
|
|
17150
|
+
const profileWindow = window;
|
|
17151
|
+
profileWindow.__QUILL_DASHBOARD_TRACE__ ??= [];
|
|
17152
|
+
return profileWindow.__QUILL_DASHBOARD_TRACE__;
|
|
17153
|
+
}
|
|
17154
|
+
const globalStore = globalThis;
|
|
17155
|
+
globalStore.__QUILL_DASHBOARD_TRACE__ ??= [];
|
|
17156
|
+
return globalStore.__QUILL_DASHBOARD_TRACE__;
|
|
17157
|
+
}
|
|
17158
|
+
function queryKeyFamily(queryKey) {
|
|
17159
|
+
const head = String(queryKey[0] ?? "");
|
|
17160
|
+
const next = String(queryKey[1] ?? "");
|
|
17161
|
+
if (head === "quill" && next === "dashboard-report") {
|
|
17162
|
+
return "quill/dashboard-report";
|
|
17163
|
+
}
|
|
17164
|
+
if (head === "useReport") {
|
|
17165
|
+
return `useReport/${next || "unknown"}`;
|
|
17166
|
+
}
|
|
17167
|
+
return head || "other";
|
|
17168
|
+
}
|
|
17169
|
+
function summarizeEngineRequest(input) {
|
|
17170
|
+
const metadata = input.metadata ?? {};
|
|
17171
|
+
return {
|
|
17172
|
+
task: input.task ?? null,
|
|
17173
|
+
shareRequest: Boolean(input.shareRequest),
|
|
17174
|
+
reuseExisting: input.reuseExisting ?? null,
|
|
17175
|
+
settled: input.settled ?? null,
|
|
17176
|
+
reportId: metadata.reportId ?? null,
|
|
17177
|
+
metadataKeys: Object.keys(metadata).sort(),
|
|
17178
|
+
dashboardName: metadata.dashboardName ?? null,
|
|
17179
|
+
dashboardItemId: metadata.dashboardItemId ?? null,
|
|
17180
|
+
useNewNodeSql: metadata.useNewNodeSql ?? null,
|
|
17181
|
+
dateBucket: metadata.dateBucket ?? null,
|
|
17182
|
+
hasPivot: Boolean(metadata.pivot),
|
|
17183
|
+
hasReportBuilderState: Boolean(metadata.reportBuilderState),
|
|
17184
|
+
additionalProcessing: metadata.additionalProcessing ?? null,
|
|
17185
|
+
filterCount: Array.isArray(metadata.filters) ? metadata.filters.length : null
|
|
17186
|
+
};
|
|
17187
|
+
}
|
|
17188
|
+
function profileDashboard(event, data) {
|
|
17189
|
+
if (!profilingEnabled()) return;
|
|
17190
|
+
const entry = {
|
|
17191
|
+
at: Math.round(performance.now() * 10) / 10,
|
|
17192
|
+
event,
|
|
17193
|
+
data
|
|
17194
|
+
};
|
|
17195
|
+
profileStore().push(entry);
|
|
17196
|
+
if (typeof window !== "undefined") {
|
|
17197
|
+
const profileWindow = window;
|
|
17198
|
+
profileWindow.__QUILL_DASHBOARD_PROFILE__ = true;
|
|
17199
|
+
profileWindow.__QUILL_DUMP_DASHBOARD_PROFILE__ = () => profileWindow.__QUILL_DASHBOARD_TRACE__ ?? [];
|
|
17200
|
+
}
|
|
17201
|
+
if (typeof process !== "undefined" && process.env?.QUILL_DASHBOARD_PROFILE_CONSOLE === "true" && CONSOLE_EVENT_PATTERN.test(event)) {
|
|
17202
|
+
console.log(`[quill-profile] ${event}`, data ?? {});
|
|
17203
|
+
}
|
|
17204
|
+
}
|
|
17205
|
+
var CONSOLE_EVENT_PATTERN;
|
|
17206
|
+
var init_dashboardProfiler = __esm({
|
|
17207
|
+
"src/utils/dashboardProfiler.ts"() {
|
|
17208
|
+
"use strict";
|
|
17209
|
+
CONSOLE_EVENT_PATTERN = /cache|initial-load|use-report-loading|network|unique-values|table-refresh|pivot|shared-request|engine-fetch|generate-pivot/;
|
|
17210
|
+
}
|
|
17211
|
+
});
|
|
17212
|
+
|
|
17140
17213
|
// src/utils/pivotConstructor.ts
|
|
17141
17214
|
function normalizeLegacyPivotSortFieldValue(sortField) {
|
|
17142
17215
|
if (sortField === void 0) {
|
|
@@ -17249,6 +17322,22 @@ async function generatePivotWithSQL({
|
|
|
17249
17322
|
rowLimit: pivot.rowLimit,
|
|
17250
17323
|
dateBucket: resolvedDateBucket
|
|
17251
17324
|
};
|
|
17325
|
+
profileDashboard(
|
|
17326
|
+
"generate-pivot-sql",
|
|
17327
|
+
summarizeEngineRequest({
|
|
17328
|
+
task: "pivot-template",
|
|
17329
|
+
shareRequest: false,
|
|
17330
|
+
metadata: {
|
|
17331
|
+
reportId: report?.id,
|
|
17332
|
+
dashboardName,
|
|
17333
|
+
dateBucket: resolvedDateBucket,
|
|
17334
|
+
additionalProcessing,
|
|
17335
|
+
pivot: pivotConfig,
|
|
17336
|
+
reportBuilderState,
|
|
17337
|
+
filters: dashboardFilters
|
|
17338
|
+
}
|
|
17339
|
+
})
|
|
17340
|
+
);
|
|
17252
17341
|
const resp = await quillFetch({
|
|
17253
17342
|
client,
|
|
17254
17343
|
task: "pivot-template",
|
|
@@ -17621,6 +17710,7 @@ var init_pivotConstructor = __esm({
|
|
|
17621
17710
|
init_columnType();
|
|
17622
17711
|
init_dataFetcher();
|
|
17623
17712
|
init_dataProcessing();
|
|
17713
|
+
init_dashboardProfiler();
|
|
17624
17714
|
init_dates();
|
|
17625
17715
|
init_textProcessing();
|
|
17626
17716
|
init_valueFormatter();
|
|
@@ -20044,6 +20134,20 @@ async function getOrFetchSharedRequest({
|
|
|
20044
20134
|
}) {
|
|
20045
20135
|
if (signal?.aborted) throw createAbortError(signal);
|
|
20046
20136
|
let entry = entries.get(key);
|
|
20137
|
+
const reuseExisting = Boolean(entry);
|
|
20138
|
+
profileDashboard("shared-request", {
|
|
20139
|
+
...summarizeEngineRequest({
|
|
20140
|
+
task: void 0,
|
|
20141
|
+
shareRequest: true,
|
|
20142
|
+
reuseExisting,
|
|
20143
|
+
settled: entry?.settled,
|
|
20144
|
+
metadata: { reportId }
|
|
20145
|
+
}),
|
|
20146
|
+
reportId: reportId ?? null,
|
|
20147
|
+
reuseExisting,
|
|
20148
|
+
settled: entry?.settled ?? false,
|
|
20149
|
+
keyLength: key.length
|
|
20150
|
+
});
|
|
20047
20151
|
if (!entry) {
|
|
20048
20152
|
const controller = new AbortController();
|
|
20049
20153
|
entry = {
|
|
@@ -20119,6 +20223,7 @@ var ORPHAN_GRACE_MS, COMPLETED_TTL_MS, entries;
|
|
|
20119
20223
|
var init_reportRequestPool = __esm({
|
|
20120
20224
|
"src/utils/reportRequestPool.ts"() {
|
|
20121
20225
|
"use strict";
|
|
20226
|
+
init_dashboardProfiler();
|
|
20122
20227
|
ORPHAN_GRACE_MS = 100;
|
|
20123
20228
|
COMPLETED_TTL_MS = 15e3;
|
|
20124
20229
|
entries = /* @__PURE__ */ new Map();
|
|
@@ -20681,6 +20786,7 @@ var init_dataFetcher = __esm({
|
|
|
20681
20786
|
init_dates();
|
|
20682
20787
|
init_changelogNotify();
|
|
20683
20788
|
init_reportRequestPool();
|
|
20789
|
+
init_dashboardProfiler();
|
|
20684
20790
|
quillFetch = async ({
|
|
20685
20791
|
client,
|
|
20686
20792
|
task,
|
|
@@ -20741,6 +20847,14 @@ var init_dataFetcher = __esm({
|
|
|
20741
20847
|
return { error: "Failed to fetch data" };
|
|
20742
20848
|
}
|
|
20743
20849
|
};
|
|
20850
|
+
profileDashboard(
|
|
20851
|
+
"engine-fetch",
|
|
20852
|
+
summarizeEngineRequest({
|
|
20853
|
+
task,
|
|
20854
|
+
shareRequest,
|
|
20855
|
+
metadata
|
|
20856
|
+
})
|
|
20857
|
+
);
|
|
20744
20858
|
if (!shareRequest) {
|
|
20745
20859
|
return execute(abortSignal);
|
|
20746
20860
|
}
|
|
@@ -21376,22 +21490,7 @@ init_dates();
|
|
|
21376
21490
|
init_pivotConstructor();
|
|
21377
21491
|
init_columnProcessing();
|
|
21378
21492
|
init_paginationProcessing();
|
|
21379
|
-
|
|
21380
|
-
// src/utils/dashboardProfiler.ts
|
|
21381
|
-
function profileDashboard(event, data) {
|
|
21382
|
-
if (typeof window === "undefined") return;
|
|
21383
|
-
const profileWindow = window;
|
|
21384
|
-
if (!profileWindow.__QUILL_DASHBOARD_PROFILE__) return;
|
|
21385
|
-
const entry = {
|
|
21386
|
-
at: Math.round(performance.now() * 10) / 10,
|
|
21387
|
-
event,
|
|
21388
|
-
data
|
|
21389
|
-
};
|
|
21390
|
-
profileWindow.__QUILL_DASHBOARD_TRACE__ ??= [];
|
|
21391
|
-
profileWindow.__QUILL_DASHBOARD_TRACE__.push(entry);
|
|
21392
|
-
}
|
|
21393
|
-
|
|
21394
|
-
// src/utils/dashboard.ts
|
|
21493
|
+
init_dashboardProfiler();
|
|
21395
21494
|
var defaultDashboardItem = {
|
|
21396
21495
|
id: "",
|
|
21397
21496
|
name: "",
|
|
@@ -22805,6 +22904,7 @@ init_tableProcessing();
|
|
|
22805
22904
|
init_textProcessing();
|
|
22806
22905
|
init_valueFormatter();
|
|
22807
22906
|
init_astFilterProcessing();
|
|
22907
|
+
init_dashboardProfiler();
|
|
22808
22908
|
init_reportBuilder();
|
|
22809
22909
|
init_astProcessing();
|
|
22810
22910
|
|
|
@@ -26577,6 +26677,7 @@ function normalizePSTRanges(start, end) {
|
|
|
26577
26677
|
|
|
26578
26678
|
// src/Context.tsx
|
|
26579
26679
|
init_changelogNotify();
|
|
26680
|
+
init_dashboardProfiler();
|
|
26580
26681
|
|
|
26581
26682
|
// src/reportStore.ts
|
|
26582
26683
|
var import_react = require("react");
|
|
@@ -32347,7 +32448,7 @@ function QuillTable({
|
|
|
32347
32448
|
setSortColumn(sort?.field || "");
|
|
32348
32449
|
setSortDirection(sort?.direction || "desc");
|
|
32349
32450
|
}, [sort]);
|
|
32350
|
-
const holdFullPageLoader =
|
|
32451
|
+
const holdFullPageLoader = Boolean(isLoading);
|
|
32351
32452
|
const pageCountUnknown = manualPagination && pageCount === -1;
|
|
32352
32453
|
const { activeRows, maxPage } = (0, import_react14.useMemo)(() => {
|
|
32353
32454
|
const start = currentPage * rowsPerPage;
|
|
@@ -37204,6 +37305,7 @@ function getDashboardReportProcessing(report, serverPagination) {
|
|
|
37204
37305
|
}
|
|
37205
37306
|
|
|
37206
37307
|
// src/hooks/useDashboard.ts
|
|
37308
|
+
init_dashboardProfiler();
|
|
37207
37309
|
var DEFAULT_DASHBOARD_REPORT_STALE_TIME_MS = 5 * 60 * 1e3;
|
|
37208
37310
|
var useDashboardConfigInternal = (dashboardName) => {
|
|
37209
37311
|
const { dashboardConfig, isLoading: dashboardsLoading } = (0, import_react26.useContext)(
|
|
@@ -38314,6 +38416,14 @@ var useDashboard = (dashboardName, config) => {
|
|
|
38314
38416
|
additionalProcessing
|
|
38315
38417
|
);
|
|
38316
38418
|
const usePivotTask = !cacheEnabled && !!reportInfo.pivot;
|
|
38419
|
+
profileDashboard("dashboard-report-cache-path", {
|
|
38420
|
+
reportId,
|
|
38421
|
+
cacheEnabled,
|
|
38422
|
+
cacheCabCacheable: cacheCab.isCacheable(reportId),
|
|
38423
|
+
usePivotTask,
|
|
38424
|
+
forceCacheToRefresh,
|
|
38425
|
+
hasPivot: Boolean(reportInfo.pivot)
|
|
38426
|
+
});
|
|
38317
38427
|
const allFilters = dashboardFilters2.concat(customFilters).concat(customReportFiltersArray);
|
|
38318
38428
|
const applyInMemoryPivotIfNeeded = (report2) => {
|
|
38319
38429
|
const pivotToApply = reportInfo.pivot ?? report2.pivot;
|
|
@@ -38547,7 +38657,9 @@ var useDashboard = (dashboardName, config) => {
|
|
|
38547
38657
|
pivotColumns: pivotData.columns,
|
|
38548
38658
|
pivotRowCount: pivotData.rowCount,
|
|
38549
38659
|
pivotQuery: pivotData.pivotQuery,
|
|
38550
|
-
comparisonPivotQuery: pivotData.comparisonPivotQuery
|
|
38660
|
+
comparisonPivotQuery: pivotData.comparisonPivotQuery,
|
|
38661
|
+
pivotResultRowField: pivotData.rowField,
|
|
38662
|
+
pivotResultSourceRowField: reportInfo.pivot?.rowField
|
|
38551
38663
|
},
|
|
38552
38664
|
error: void 0
|
|
38553
38665
|
};
|
|
@@ -38577,6 +38689,26 @@ var useDashboard = (dashboardName, config) => {
|
|
|
38577
38689
|
shareRequest: !forceCacheToRefresh
|
|
38578
38690
|
});
|
|
38579
38691
|
};
|
|
38692
|
+
const existingState = queryClient.getQueryState(queryKey);
|
|
38693
|
+
const existingData = queryClient.getQueryData(queryKey);
|
|
38694
|
+
const dataUpdatedAt = existingState?.dataUpdatedAt ?? 0;
|
|
38695
|
+
const ageMs = dataUpdatedAt ? Date.now() - dataUpdatedAt : null;
|
|
38696
|
+
const isStale = dataUpdatedAt === 0 || Date.now() - dataUpdatedAt >= reportStaleTimeMs;
|
|
38697
|
+
profileDashboard("dashboard-report-tanstack-cache", {
|
|
38698
|
+
reportId,
|
|
38699
|
+
keyFamily: "quill/dashboard-report",
|
|
38700
|
+
cacheEnabled,
|
|
38701
|
+
usePivotTask,
|
|
38702
|
+
forceCacheToRefresh,
|
|
38703
|
+
staleTimeMs: reportStaleTimeMs,
|
|
38704
|
+
status: existingState?.status ?? "missing",
|
|
38705
|
+
fetchStatus: existingState?.fetchStatus ?? "idle",
|
|
38706
|
+
hasData: existingData !== void 0,
|
|
38707
|
+
dataUpdatedAt,
|
|
38708
|
+
ageMs,
|
|
38709
|
+
isStale,
|
|
38710
|
+
willReuseTanstack: !forceCacheToRefresh && existingData !== void 0 && !isStale
|
|
38711
|
+
});
|
|
38580
38712
|
const result = forceCacheToRefresh ? await fetchDashboardReport() : await queryClient.fetchQuery({
|
|
38581
38713
|
queryKey,
|
|
38582
38714
|
queryFn: fetchDashboardReport,
|
|
@@ -38979,6 +39111,7 @@ var useDashboardReport = (reportId, config) => {
|
|
|
38979
39111
|
};
|
|
38980
39112
|
|
|
38981
39113
|
// src/components/Dashboard/DataLoader.tsx
|
|
39114
|
+
init_dashboardProfiler();
|
|
38982
39115
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
38983
39116
|
var constructReportFromItem = (item) => {
|
|
38984
39117
|
return {
|
|
@@ -41394,6 +41527,7 @@ function QuillTableDashboardComponent({
|
|
|
41394
41527
|
|
|
41395
41528
|
// src/Chart.tsx
|
|
41396
41529
|
init_valueFormatter();
|
|
41530
|
+
init_dashboardProfiler();
|
|
41397
41531
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
41398
41532
|
function Chart({
|
|
41399
41533
|
colors,
|
|
@@ -45378,6 +45512,7 @@ init_Filter();
|
|
|
45378
45512
|
|
|
45379
45513
|
// src/StaticChart.tsx
|
|
45380
45514
|
var import_react42 = require("react");
|
|
45515
|
+
init_dashboardProfiler();
|
|
45381
45516
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
45382
45517
|
var CHART_TYPE_STYLES = {
|
|
45383
45518
|
metric: { height: "100px", width: "200px" },
|
|
@@ -61912,6 +62047,24 @@ function useDebouncedRefreshInput(value, delayMs = REPORT_REFRESH_DEBOUNCE_MS) {
|
|
|
61912
62047
|
|
|
61913
62048
|
// src/utils/pivotDateBuckets.ts
|
|
61914
62049
|
var import_date_fns18 = require("date-fns");
|
|
62050
|
+
var PIVOT_DATE_BUCKETS = /* @__PURE__ */ new Set([
|
|
62051
|
+
"day",
|
|
62052
|
+
"week",
|
|
62053
|
+
"month",
|
|
62054
|
+
"year"
|
|
62055
|
+
]);
|
|
62056
|
+
function inBucketDateBucketForField(rules, field) {
|
|
62057
|
+
for (const entry of rules) {
|
|
62058
|
+
if (!entry || typeof entry !== "object") continue;
|
|
62059
|
+
const rule = entry;
|
|
62060
|
+
if (rule.operator !== "inBucket" || rule.field !== field) continue;
|
|
62061
|
+
const bucket = rule.value && typeof rule.value === "object" && !Array.isArray(rule.value) ? rule.value.bucket : void 0;
|
|
62062
|
+
if (typeof bucket === "string" && PIVOT_DATE_BUCKETS.has(bucket)) {
|
|
62063
|
+
return bucket;
|
|
62064
|
+
}
|
|
62065
|
+
}
|
|
62066
|
+
return void 0;
|
|
62067
|
+
}
|
|
61915
62068
|
function buildPivotDateBucketStarts(range, bucket) {
|
|
61916
62069
|
const min2 = new Date(range.min);
|
|
61917
62070
|
const max2 = new Date(range.max);
|
|
@@ -62231,6 +62384,7 @@ function resolveReportFromCacheCab({
|
|
|
62231
62384
|
}
|
|
62232
62385
|
|
|
62233
62386
|
// src/hooks/useForm.tsx
|
|
62387
|
+
init_dashboardProfiler();
|
|
62234
62388
|
init_reportRequestPool();
|
|
62235
62389
|
|
|
62236
62390
|
// src/hooks/useForm.queries.ts
|
|
@@ -62276,6 +62430,15 @@ function createUseFormInitialLoadQueryKey(input) {
|
|
|
62276
62430
|
input.additionalSchemaHash
|
|
62277
62431
|
];
|
|
62278
62432
|
}
|
|
62433
|
+
var DASHBOARD_REPORT_STALE_TIME_MS = 5 * 60 * 1e3;
|
|
62434
|
+
function findCachedDashboardReportQuery(queryClient, reportId) {
|
|
62435
|
+
const id = String(reportId ?? "").trim();
|
|
62436
|
+
if (!id) return void 0;
|
|
62437
|
+
return queryClient.getQueryCache().findAll({ queryKey: ["quill", "dashboard-report", id] }).find((query) => {
|
|
62438
|
+
const data = query.state.data;
|
|
62439
|
+
return Boolean(data?.report) && !data?.error;
|
|
62440
|
+
});
|
|
62441
|
+
}
|
|
62279
62442
|
function shouldBootstrapUseFormInitialLoad(input) {
|
|
62280
62443
|
return !input.hasInitialReportBuilderState && input.previouslyBootstrappedIdentity !== input.currentIdentity;
|
|
62281
62444
|
}
|
|
@@ -63258,6 +63421,11 @@ function getPivotTableSlotReportColumn(reportColumns, aggregations, rowField, pi
|
|
|
63258
63421
|
}
|
|
63259
63422
|
return cols[aggIndex + 1];
|
|
63260
63423
|
}
|
|
63424
|
+
function pivotRowKey(chart) {
|
|
63425
|
+
return String(
|
|
63426
|
+
chart?.pivotResultRowField ?? chart?.pivot?.rowField ?? ""
|
|
63427
|
+
).trim();
|
|
63428
|
+
}
|
|
63261
63429
|
function isPivotTableDateBucketRowAxis(chart, xAxisField) {
|
|
63262
63430
|
if (!chart?.pivot) return false;
|
|
63263
63431
|
if (String(chart.chartType ?? "").toLowerCase() !== "table") return false;
|
|
@@ -63266,7 +63434,8 @@ function isPivotTableDateBucketRowAxis(chart, xAxisField) {
|
|
|
63266
63434
|
}
|
|
63267
63435
|
const rowField = String(chart.pivot.rowField ?? "").trim();
|
|
63268
63436
|
const xf = String(xAxisField ?? "").trim();
|
|
63269
|
-
|
|
63437
|
+
const rowKey = pivotRowKey(chart);
|
|
63438
|
+
if (!rowField || xf !== rowField && xf !== rowKey) return false;
|
|
63270
63439
|
return isDateType(String(chart.pivot.rowFieldType ?? ""));
|
|
63271
63440
|
}
|
|
63272
63441
|
var RESOLVABLE_X_AXIS_DATE_BUCKETS = /* @__PURE__ */ new Set([
|
|
@@ -63280,22 +63449,24 @@ function resolvePivotDateBucketXAxisFormat(chart, xAxisField) {
|
|
|
63280
63449
|
const dateBucket = String(chart?.pivot?.dateBucket ?? "").trim().toLowerCase();
|
|
63281
63450
|
if (!RESOLVABLE_X_AXIS_DATE_BUCKETS.has(dateBucket)) return null;
|
|
63282
63451
|
const rowField = String(chart?.pivot?.rowField ?? "").trim();
|
|
63283
|
-
|
|
63452
|
+
const xf = String(xAxisField ?? "").trim();
|
|
63453
|
+
const rowKey = pivotRowKey(chart);
|
|
63454
|
+
if (!rowField || xf !== rowField && xf !== rowKey) return null;
|
|
63284
63455
|
if (!isDateType(String(chart?.pivot?.rowFieldType ?? ""))) return null;
|
|
63285
63456
|
return getDateFormatFromBucket(dateBucket);
|
|
63286
63457
|
}
|
|
63287
63458
|
function chartDetailRowsMissingPivotRowBucket(chart) {
|
|
63288
63459
|
if (!chart?.pivot) return false;
|
|
63289
|
-
const
|
|
63290
|
-
if (!
|
|
63460
|
+
const rowKey = pivotRowKey(chart);
|
|
63461
|
+
if (!rowKey) return false;
|
|
63291
63462
|
const rows = chart.rows;
|
|
63292
63463
|
if (!Array.isArray(rows) || rows.length === 0) return false;
|
|
63293
63464
|
const first = rows.find(
|
|
63294
63465
|
(r) => r && typeof r === "object" && Object.keys(r).length > 0
|
|
63295
63466
|
);
|
|
63296
63467
|
if (!first) return false;
|
|
63297
|
-
if (!Object.prototype.hasOwnProperty.call(first,
|
|
63298
|
-
const v = first[
|
|
63468
|
+
if (!Object.prototype.hasOwnProperty.call(first, rowKey)) return true;
|
|
63469
|
+
const v = first[rowKey];
|
|
63299
63470
|
return v === void 0 || v === null;
|
|
63300
63471
|
}
|
|
63301
63472
|
function shouldUsePivotRowFieldAsXAxis(chartType, pivotRowField, rowColumnFormat) {
|
|
@@ -63331,7 +63502,7 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63331
63502
|
} : chart;
|
|
63332
63503
|
if (!config) return config;
|
|
63333
63504
|
if (!config.pivot) return config;
|
|
63334
|
-
const pivotRowFieldEarly =
|
|
63505
|
+
const pivotRowFieldEarly = pivotRowKey(config);
|
|
63335
63506
|
const rowColumn = (config.pivotColumns ?? config.columns ?? []).find(
|
|
63336
63507
|
(col) => String(col.field ?? "").trim() === pivotRowFieldEarly
|
|
63337
63508
|
);
|
|
@@ -63366,7 +63537,7 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63366
63537
|
return keys;
|
|
63367
63538
|
})() : [];
|
|
63368
63539
|
const pivotValueFields = pivotRowFields.filter(
|
|
63369
|
-
(field) => field !== withResolvedXAxis.pivot?.rowField
|
|
63540
|
+
(field) => field !== pivotRowKey(withResolvedXAxis) && field !== withResolvedXAxis.pivot?.rowField
|
|
63370
63541
|
);
|
|
63371
63542
|
const isAggregationOnlyPivot = !String(withResolvedXAxis.pivot?.rowField ?? "").trim() && !String(withResolvedXAxis.pivot?.columnField ?? "").trim();
|
|
63372
63543
|
const yAxisFormatByField = new Map(
|
|
@@ -63487,7 +63658,7 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63487
63658
|
const normalizedPivotColumns = pivotColumnFields.length > 0 ? pivotColumnFields.map((field) => {
|
|
63488
63659
|
const knownColumn = knownColumnsByField.get(field);
|
|
63489
63660
|
const yAxis = yAxisFields.find((axis) => axis.field === field);
|
|
63490
|
-
const format9 = yAxis?.format ?? knownColumn?.format ?? (field === withResolvedXAxis.pivot?.rowField ? isMetricOrGauge ? "string" : withResolvedXAxis.xAxisFormat ?? "string" : yAxisFallbackFormat);
|
|
63661
|
+
const format9 = yAxis?.format ?? knownColumn?.format ?? (field === pivotRowKey(withResolvedXAxis) || field === withResolvedXAxis.pivot?.rowField ? isMetricOrGauge ? "string" : withResolvedXAxis.xAxisFormat ?? "string" : yAxisFallbackFormat);
|
|
63491
63662
|
return {
|
|
63492
63663
|
field,
|
|
63493
63664
|
label: yAxis?.label ?? knownColumn?.label ?? field,
|
|
@@ -63500,7 +63671,7 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63500
63671
|
const slotCol = getPivotTableSlotReportColumn(
|
|
63501
63672
|
pivotTableSlotColumns,
|
|
63502
63673
|
aggregations,
|
|
63503
|
-
withResolvedXAxis.pivot?.rowField,
|
|
63674
|
+
pivotRowKey(withResolvedXAxis) || withResolvedXAxis.pivot?.rowField,
|
|
63504
63675
|
col.field
|
|
63505
63676
|
);
|
|
63506
63677
|
if (!slotCol) return col;
|
|
@@ -63522,9 +63693,7 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63522
63693
|
const normalizedXAxisFormat = normalizedXAxisField === withResolvedXAxis.xAxisField ? withResolvedXAxis.xAxisFormat : yAxisFields.find((axis) => axis.field === normalizedXAxisField)?.format ?? pivotTableDisplayColumns.find(
|
|
63523
63694
|
(column) => column.field === normalizedXAxisField
|
|
63524
63695
|
)?.format ?? withResolvedXAxis.xAxisFormat;
|
|
63525
|
-
const pivotDisplayRowField =
|
|
63526
|
-
withResolvedXAxis.pivot?.rowField ?? ""
|
|
63527
|
-
).trim();
|
|
63696
|
+
const pivotDisplayRowField = pivotRowKey(withResolvedXAxis);
|
|
63528
63697
|
const pivotDisplayRowFieldType = String(
|
|
63529
63698
|
withResolvedXAxis.pivot?.rowFieldType ?? ""
|
|
63530
63699
|
).trim();
|
|
@@ -65449,8 +65618,7 @@ async function fetchReportBuilderStateByReportId({
|
|
|
65449
65618
|
if (!state || typeof state !== "object") {
|
|
65450
65619
|
return null;
|
|
65451
65620
|
}
|
|
65452
|
-
|
|
65453
|
-
return parsedState;
|
|
65621
|
+
return state;
|
|
65454
65622
|
} catch (error) {
|
|
65455
65623
|
if (error instanceof Error && error.name === "AbortError") {
|
|
65456
65624
|
throw error;
|
|
@@ -65489,10 +65657,11 @@ function applyFetchedReportBuilderState(result, fetchedReportBuilderState) {
|
|
|
65489
65657
|
}).filter(
|
|
65490
65658
|
(table) => Boolean(table)
|
|
65491
65659
|
);
|
|
65660
|
+
const keptExistingRules = existingRules.rules.length > 0;
|
|
65492
65661
|
const mergedState = {
|
|
65493
65662
|
tables: mergedTables,
|
|
65494
65663
|
columns: existingColumns.length > 0 ? existingColumns : fetchedColumns,
|
|
65495
|
-
rules:
|
|
65664
|
+
rules: keptExistingRules ? existingRules : fetchedRules,
|
|
65496
65665
|
pivot: existingState?.pivot ?? fetchedReportBuilderState.pivot ?? null,
|
|
65497
65666
|
sort: existingSort.length > 0 ? existingSort : fetchedSort,
|
|
65498
65667
|
limit: existingState?.limit ?? fetchedReportBuilderState.limit ?? null
|
|
@@ -66488,19 +66657,30 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66488
66657
|
)
|
|
66489
66658
|
});
|
|
66490
66659
|
const diagnostics = globalThis.__QUILL_CACHECAB_DIAGNOSTICS__;
|
|
66660
|
+
const durationMs = performance.now() - startedAt;
|
|
66661
|
+
const outcome = resolution.resolved ? "hit" : "fallback";
|
|
66491
66662
|
if (Array.isArray(diagnostics)) {
|
|
66492
66663
|
diagnostics.push({
|
|
66493
66664
|
reportId: effectiveReportId,
|
|
66494
66665
|
operation,
|
|
66495
|
-
outcome
|
|
66666
|
+
outcome,
|
|
66496
66667
|
reason: resolution.resolved ? "complete" : resolution.reason,
|
|
66497
66668
|
details: resolution.resolved ? void 0 : resolution.details,
|
|
66498
66669
|
snapshotReason: snapshot?.reason ?? "cache_miss",
|
|
66499
66670
|
forcedIncompleteSnapshot: Boolean(snapshot) && !snapshot?.complete && forceIncompleteCacheCabForParity,
|
|
66500
66671
|
rowCount: snapshot?.rowCount ?? 0,
|
|
66501
|
-
durationMs
|
|
66672
|
+
durationMs
|
|
66502
66673
|
});
|
|
66503
66674
|
}
|
|
66675
|
+
profileDashboard("use-report-cachecab", {
|
|
66676
|
+
reportId: effectiveReportId,
|
|
66677
|
+
operation,
|
|
66678
|
+
outcome,
|
|
66679
|
+
reason: resolution.resolved ? "complete" : resolution.reason,
|
|
66680
|
+
snapshotReason: snapshot?.reason ?? "cache_miss",
|
|
66681
|
+
rowCount: snapshot?.rowCount ?? 0,
|
|
66682
|
+
durationMs: Math.round(durationMs * 10) / 10
|
|
66683
|
+
});
|
|
66504
66684
|
return resolution.resolved ? resolution.report : null;
|
|
66505
66685
|
},
|
|
66506
66686
|
[
|
|
@@ -67074,9 +67254,15 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67074
67254
|
if (alias) localValues[alias] = values;
|
|
67075
67255
|
}
|
|
67076
67256
|
if (hasEveryColumn) {
|
|
67257
|
+
profileDashboard("use-report-unique-values-cachecab-hit", {
|
|
67258
|
+
reportId: effectiveReportId
|
|
67259
|
+
});
|
|
67077
67260
|
return { uniqueValuesByColumn: localValues };
|
|
67078
67261
|
}
|
|
67079
67262
|
}
|
|
67263
|
+
profileDashboard("use-report-unique-values-network", {
|
|
67264
|
+
reportId: effectiveReportId
|
|
67265
|
+
});
|
|
67080
67266
|
const tablesForUniqueValues = filterUniqueValuesRequest.reportBuilderState?.tables?.map(
|
|
67081
67267
|
(table2) => String(table2?.name ?? "").trim()
|
|
67082
67268
|
) ?? filterUniqueValuesRequest.stringColumnsByTable.map((column) => String(column.table ?? "").trim()).filter(Boolean);
|
|
@@ -67595,6 +67781,29 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67595
67781
|
const initialLoadQuery = (0, import_react_query3.useQuery)({
|
|
67596
67782
|
queryKey: initialLoadQueryKey,
|
|
67597
67783
|
queryFn: createUseFormQueryFn(async (signal) => {
|
|
67784
|
+
const tanstackState = queryClient.getQueryState(initialLoadQueryKey);
|
|
67785
|
+
const dashboardReportQueries = queryClient.getQueryCache().getAll().filter(
|
|
67786
|
+
(query) => queryKeyFamily(query.queryKey) === "quill/dashboard-report"
|
|
67787
|
+
);
|
|
67788
|
+
const matchingDashboardReport = dashboardReportQueries.find(
|
|
67789
|
+
(query) => String(query.queryKey[2] ?? "") === String(effectiveReportId)
|
|
67790
|
+
);
|
|
67791
|
+
profileDashboard("use-report-initial-load-queryfn", {
|
|
67792
|
+
reportId: effectiveReportId,
|
|
67793
|
+
reason: "TanStack ran this queryFn, so useReport/initial-load had no fresh cached data",
|
|
67794
|
+
keyFamily: "useReport/initial-load",
|
|
67795
|
+
status: tanstackState?.status ?? "missing",
|
|
67796
|
+
hasData: tanstackState?.data !== void 0,
|
|
67797
|
+
dataUpdatedAt: tanstackState?.dataUpdatedAt ?? 0,
|
|
67798
|
+
staleTime: 0,
|
|
67799
|
+
dashboardReportQueryCount: dashboardReportQueries.length,
|
|
67800
|
+
matchingDashboardReport: matchingDashboardReport ? {
|
|
67801
|
+
hasData: matchingDashboardReport.state.data !== void 0,
|
|
67802
|
+
status: matchingDashboardReport.state.status,
|
|
67803
|
+
staleTime: matchingDashboardReport.options?.staleTime ?? 0,
|
|
67804
|
+
unusedByUseReport: true
|
|
67805
|
+
} : null
|
|
67806
|
+
});
|
|
67598
67807
|
let cachedReportBuilderState = initialReportBuilderStateForLoad ?? void 0;
|
|
67599
67808
|
if (!cachedReportBuilderState) {
|
|
67600
67809
|
const snapshot = await cacheCab.getReportSnapshot(
|
|
@@ -67619,6 +67828,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67619
67828
|
operation: "initial"
|
|
67620
67829
|
});
|
|
67621
67830
|
if (cachedReport) {
|
|
67831
|
+
profileDashboard("use-report-initial-load-served-from-cachecab", {
|
|
67832
|
+
reportId: effectiveReportId
|
|
67833
|
+
});
|
|
67622
67834
|
return { report: cachedReport };
|
|
67623
67835
|
}
|
|
67624
67836
|
const allowReportTaskBootstrap = shouldBootstrapUseFormInitialLoad({
|
|
@@ -67633,6 +67845,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67633
67845
|
const formFiltersBelongToLoadTarget = Boolean(loadTargetId) && sourceReportIdentity === loadTargetId;
|
|
67634
67846
|
const rulesForLoad = useInMemoryEngines || !formFiltersBelongToLoadTarget ? EMPTY_QUERY_FILTERS : queryFilters;
|
|
67635
67847
|
const shareInitialRequest = sharedInitialRequestUsedForReportIdRef.current !== effectiveReportId;
|
|
67848
|
+
profileDashboard("use-report-initial-load-network", {
|
|
67849
|
+
reportId: effectiveReportId,
|
|
67850
|
+
path: "loadReportForUseForm",
|
|
67851
|
+
hasCachedReportBuilderState: Boolean(cachedReportBuilderState)
|
|
67852
|
+
});
|
|
67853
|
+
const networkStartedAt = performance.now();
|
|
67636
67854
|
const loadResult = await loadReportForUseForm({
|
|
67637
67855
|
reportId: effectiveReportId,
|
|
67638
67856
|
initialReportBuilderState: initialReportBuilderStateForLoad,
|
|
@@ -67652,6 +67870,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67652
67870
|
rowsOnly: isCreatedReportBootstrapLoad,
|
|
67653
67871
|
abortSignal: signal
|
|
67654
67872
|
});
|
|
67873
|
+
profileDashboard("use-report-initial-load-network-done", {
|
|
67874
|
+
reportId: effectiveReportId,
|
|
67875
|
+
durationMs: Math.round(performance.now() - networkStartedAt),
|
|
67876
|
+
hasReport: Boolean(loadResult.report),
|
|
67877
|
+
error: loadResult.error ?? null
|
|
67878
|
+
});
|
|
67655
67879
|
if (loadResult.report && !loadResult.error) {
|
|
67656
67880
|
if (allowReportTaskBootstrap) {
|
|
67657
67881
|
bootstrapReportTaskUsedForInitialLoadRef.current = initialLoadIdentityHash;
|
|
@@ -67663,7 +67887,35 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67663
67887
|
return loadResult;
|
|
67664
67888
|
}),
|
|
67665
67889
|
enabled: Boolean(effectiveReportId) && Boolean(client) && !reportOverride,
|
|
67666
|
-
retry: false
|
|
67890
|
+
retry: false,
|
|
67891
|
+
initialData: () => {
|
|
67892
|
+
const cached = findCachedDashboardReportQuery(
|
|
67893
|
+
queryClient,
|
|
67894
|
+
effectiveReportId
|
|
67895
|
+
);
|
|
67896
|
+
const data = cached?.state.data;
|
|
67897
|
+
return data?.report ? { report: data.report, error: data.error } : void 0;
|
|
67898
|
+
},
|
|
67899
|
+
initialDataUpdatedAt: () => findCachedDashboardReportQuery(queryClient, effectiveReportId)?.state.dataUpdatedAt,
|
|
67900
|
+
staleTime: DASHBOARD_REPORT_STALE_TIME_MS
|
|
67901
|
+
});
|
|
67902
|
+
const reportBuilderStateQuery = (0, import_react_query3.useQuery)({
|
|
67903
|
+
queryKey: ["useReport", "report-builder-state", effectiveReportId],
|
|
67904
|
+
queryFn: createUseFormQueryFn((signal) => {
|
|
67905
|
+
if (!client) {
|
|
67906
|
+
return Promise.resolve(null);
|
|
67907
|
+
}
|
|
67908
|
+
return fetchReportBuilderStateByReportId({
|
|
67909
|
+
reportId: effectiveReportId,
|
|
67910
|
+
client,
|
|
67911
|
+
getToken,
|
|
67912
|
+
draftSessionId: draftSessionId || void 0,
|
|
67913
|
+
tenants,
|
|
67914
|
+
abortSignal: signal
|
|
67915
|
+
});
|
|
67916
|
+
}),
|
|
67917
|
+
enabled: Boolean(effectiveReportId) && Boolean(client) && !reportOverride,
|
|
67918
|
+
staleTime: 0
|
|
67667
67919
|
});
|
|
67668
67920
|
const reportNameQueryReportId = String(effectiveReportId ?? "").trim();
|
|
67669
67921
|
const reportNameQuery = (0, import_react_query3.useQuery)({
|
|
@@ -67695,10 +67947,21 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67695
67947
|
const displayReportName = formReportName !== void 0 ? formReportName : resolvedReportName;
|
|
67696
67948
|
(0, import_react63.useEffect)(() => {
|
|
67697
67949
|
if (reportOverride) return;
|
|
67698
|
-
const report =
|
|
67950
|
+
const report = applyFetchedReportBuilderState(
|
|
67951
|
+
initialLoadQuery.data ?? { report: null },
|
|
67952
|
+
reportBuilderStateQuery.data ?? null
|
|
67953
|
+
).report ?? null;
|
|
67699
67954
|
initializeSchemaScopeForReport(report);
|
|
67700
67955
|
setSourceReport(report);
|
|
67701
|
-
}, [
|
|
67956
|
+
}, [
|
|
67957
|
+
initialLoadQuery.data,
|
|
67958
|
+
initialLoadQuery.fetchStatus,
|
|
67959
|
+
initialLoadQuery.isFetching,
|
|
67960
|
+
initialLoadQuery.isPending,
|
|
67961
|
+
reportBuilderStateQuery.data,
|
|
67962
|
+
reportOverride,
|
|
67963
|
+
effectiveReportId
|
|
67964
|
+
]);
|
|
67702
67965
|
(0, import_react63.useEffect)(() => {
|
|
67703
67966
|
if (!sourceReport) {
|
|
67704
67967
|
return;
|
|
@@ -67714,15 +67977,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67714
67977
|
const shouldPromoteColumnToRowFromPendingFlag = pendingPromoteColumnToRow && !String(prev.groupRowsBy ?? "").trim();
|
|
67715
67978
|
const sourceReportBuilderTables = (sourceReport.reportBuilderState?.tables ?? []).filter((table2) => Boolean(String(table2?.name ?? "").trim()));
|
|
67716
67979
|
const sourceReportBuilderTableNames = sourceReportBuilderTables.map((table2) => table2.name).filter((name2) => Boolean(name2));
|
|
67717
|
-
const sourceQueryColumns = normalizeReportBuilderColumns(
|
|
67718
|
-
sourceReport.reportBuilderState?.columns ?? (sourceReport.columns ?? []).map((column) => ({
|
|
67719
|
-
field: column.field,
|
|
67720
|
-
table: column.table ?? resolveColumnTableFromReportMetadata(
|
|
67721
|
-
sourceReport,
|
|
67722
|
-
column.field
|
|
67723
|
-
)
|
|
67724
|
-
}))
|
|
67725
|
-
);
|
|
67726
67980
|
const nextQueryFilters = prev.queryFilters.rules.length ? prev.queryFilters : rulesFromReport(sourceReport);
|
|
67727
67981
|
const pivotAggregationsFromSource = Array.isArray(sourceReport.pivot?.aggregations) ? sourceReport.pivot.aggregations : sourceReport.pivot?.aggregationType ? [
|
|
67728
67982
|
{
|
|
@@ -67789,6 +68043,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67789
68043
|
tables: tableScopeForDisplayColumns,
|
|
67790
68044
|
schemaTables: schemaForReportBuilderState
|
|
67791
68045
|
});
|
|
68046
|
+
const sourceQueryColumns = normalizeReportBuilderColumns(
|
|
68047
|
+
sourceReport.reportBuilderState?.columns?.length ? sourceReport.reportBuilderState.columns : sourceDisplayColumnsFromSchema
|
|
68048
|
+
);
|
|
67792
68049
|
const savedDisplayColumns = normalizeReportBuilderColumns(
|
|
67793
68050
|
(sourceReport.columns ?? []).map((column) => ({
|
|
67794
68051
|
...column,
|
|
@@ -68302,13 +68559,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68302
68559
|
tables: effectiveReportBuilderState.tables,
|
|
68303
68560
|
schemaTables: schemaForReportBuilderState
|
|
68304
68561
|
});
|
|
68305
|
-
|
|
68306
|
-
if (columnsToFetch.length === 0) {
|
|
68562
|
+
if (allColumnsBySelectedTable.length === 0) {
|
|
68307
68563
|
return void 0;
|
|
68308
68564
|
}
|
|
68309
68565
|
return {
|
|
68310
68566
|
...effectiveReportBuilderState,
|
|
68311
|
-
columns:
|
|
68567
|
+
columns: allColumnsBySelectedTable,
|
|
68312
68568
|
pivot: null,
|
|
68313
68569
|
sort: [],
|
|
68314
68570
|
limit: null
|
|
@@ -68351,6 +68607,29 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68351
68607
|
refreshDecision.shouldRefresh,
|
|
68352
68608
|
queryFilters
|
|
68353
68609
|
]);
|
|
68610
|
+
const shouldSkipRedundantPivotTableDataQuery = (0, import_react63.useMemo)(() => {
|
|
68611
|
+
if (!sourceReport || !pivotState) {
|
|
68612
|
+
return false;
|
|
68613
|
+
}
|
|
68614
|
+
if (tableRefreshVersion !== 0 || pivotRefreshVersion !== 0) {
|
|
68615
|
+
return false;
|
|
68616
|
+
}
|
|
68617
|
+
if (!Array.isArray(sourceReport.rows) || sourceReport.rows.length === 0) {
|
|
68618
|
+
return false;
|
|
68619
|
+
}
|
|
68620
|
+
if (refreshDecision.shouldRefresh) {
|
|
68621
|
+
return false;
|
|
68622
|
+
}
|
|
68623
|
+
const sourceRules = sourceReport.reportBuilderState?.rules ?? EMPTY_QUERY_FILTERS;
|
|
68624
|
+
return stableSerializeForQueryKey(queryFilters) === stableSerializeForQueryKey(sourceRules);
|
|
68625
|
+
}, [
|
|
68626
|
+
sourceReport,
|
|
68627
|
+
pivotState,
|
|
68628
|
+
tableRefreshVersion,
|
|
68629
|
+
pivotRefreshVersion,
|
|
68630
|
+
refreshDecision.shouldRefresh,
|
|
68631
|
+
queryFilters
|
|
68632
|
+
]);
|
|
68354
68633
|
const shouldForceTableRefreshFromFilters = !useInMemoryEngines && !pivotState;
|
|
68355
68634
|
const immediateTableRefreshInput = (0, import_react63.useMemo)(
|
|
68356
68635
|
() => ({
|
|
@@ -68399,8 +68678,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68399
68678
|
operation: "table"
|
|
68400
68679
|
});
|
|
68401
68680
|
if (cachedReport) {
|
|
68681
|
+
profileDashboard("use-report-table-refresh-cachecab-hit", {
|
|
68682
|
+
reportId: effectiveReportId
|
|
68683
|
+
});
|
|
68402
68684
|
return { report: cachedReport };
|
|
68403
68685
|
}
|
|
68686
|
+
profileDashboard("use-report-table-refresh-network", {
|
|
68687
|
+
reportId: effectiveReportId
|
|
68688
|
+
});
|
|
68404
68689
|
return loadViaReportBuilderState({
|
|
68405
68690
|
reportId: effectiveReportId,
|
|
68406
68691
|
reportBuilderState: tableRefreshInput.reportBuilderState,
|
|
@@ -69014,7 +69299,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69014
69299
|
sourceReport
|
|
69015
69300
|
]);
|
|
69016
69301
|
const pivotRefreshQueryEnabled = !reportOverride && pendingPivotRefresh && !shouldSkipPivotRefreshForUnchangedPivot && Boolean(sourceReport) && Boolean(client) && Boolean(effectiveReportBuilderState) && Boolean(nextPivot) && sourceReportMatchesEffectiveReportId;
|
|
69017
|
-
const
|
|
69302
|
+
const initialLoadSettled = Boolean(reportOverride) || !effectiveReportId || Boolean(client) && !initialLoadQuery.isPending && !initialLoadQuery.isFetching;
|
|
69303
|
+
const pivotTableDataRefreshQueryEnabled = !reportOverride && Boolean(sourceReport) && Boolean(client) && Boolean(nextPivot) && Boolean(pivotTableDataReportBuilderState) && !pendingPivotRefresh && sourceReportMatchesEffectiveReportId && initialLoadSettled && !shouldSkipRedundantPivotTableDataQuery;
|
|
69018
69304
|
const pivotRefreshQuery = (0, import_react_query3.useQuery)({
|
|
69019
69305
|
queryKey: createUseFormPivotRefreshQueryKey({
|
|
69020
69306
|
reportId: effectiveReportId,
|
|
@@ -69128,7 +69414,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69128
69414
|
const paginationRangeStart = pagination.pageIndex * pagination.pageSize;
|
|
69129
69415
|
const paginationRangeEnd = paginationRangeStart + pagination.pageSize;
|
|
69130
69416
|
const pageWithinBaseWindow = paginationRangeEnd <= baseWindowRowsLength || trustedSourceRowCount !== void 0 && trustedSourceRowCount <= baseWindowRowsLength;
|
|
69131
|
-
const tablePageQueryEnabled = !pageWithinBaseWindow && !reportOverride && !useInMemoryEngines && Boolean(client) && Boolean(sourceReport) && Boolean(tablePageReportBuilderState) && sourceReportMatchesEffectiveReportId && !pendingPivotRefresh;
|
|
69417
|
+
const tablePageQueryEnabled = !pageWithinBaseWindow && !reportOverride && !useInMemoryEngines && Boolean(client) && Boolean(sourceReport) && Boolean(tablePageReportBuilderState) && sourceReportMatchesEffectiveReportId && !pendingPivotRefresh && initialLoadSettled;
|
|
69132
69418
|
const tablePageQuery = (0, import_react_query3.useQuery)({
|
|
69133
69419
|
queryKey: createUseFormTablePageQueryKey({
|
|
69134
69420
|
reportId: effectiveReportId,
|
|
@@ -69300,21 +69586,17 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69300
69586
|
if (!sourceReport) return void 0;
|
|
69301
69587
|
const rowsForChart = Array.isArray(sourceReport.rows) ? sourceReport.rows : [];
|
|
69302
69588
|
const chartPivot = pendingPivotChangesDimensions ? sourceReport.pivot ?? null : nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
|
|
69303
|
-
const
|
|
69304
|
-
...chartPivot,
|
|
69305
|
-
rowField: sourceReport.pivotResultRowField
|
|
69306
|
-
} : chartPivot;
|
|
69307
|
-
const rowCountForChart = chartPivotForDisplay ? sourceReport.pivotRowCount ?? (Array.isArray(sourceReport.pivotRows) ? sourceReport.pivotRows.length : sourceReport.rowCount) : useInMemoryEngines ? rowsForChart.length : sourceReport.rowCount;
|
|
69589
|
+
const rowCountForChart = chartPivot ? sourceReport.pivotRowCount ?? (Array.isArray(sourceReport.pivotRows) ? sourceReport.pivotRows.length : sourceReport.rowCount) : useInMemoryEngines ? rowsForChart.length : sourceReport.rowCount;
|
|
69308
69590
|
const referencedTablesForChart = effectiveReportBuilderState?.tables.map((table2) => table2.name).filter((name2) => Boolean(name2));
|
|
69309
69591
|
const pivotRowsForChart = Array.isArray(sourceReport.pivotRows) ? sourceReport.pivotRows : void 0;
|
|
69310
|
-
const rowCountForChartResolved =
|
|
69592
|
+
const rowCountForChartResolved = chartPivot ? Array.isArray(pivotRowsForChart) ? pivotRowsForChart.length : rowCountForChart : rowCountForChart;
|
|
69311
69593
|
const chartDataPayload = {
|
|
69312
69594
|
...sourceReport,
|
|
69313
69595
|
rows: rowsForChart,
|
|
69314
69596
|
rowCount: rowCountForChartResolved,
|
|
69315
69597
|
chartType: chartType ?? sourceReport.chartType,
|
|
69316
69598
|
reportBuilderState: effectiveReportBuilderState,
|
|
69317
|
-
pivot:
|
|
69599
|
+
pivot: chartPivot,
|
|
69318
69600
|
referencedTables: referencedTablesForChart && referencedTablesForChart.length > 0 ? referencedTablesForChart : sourceReport.referencedTables,
|
|
69319
69601
|
pivotRows: pivotRowsForChart,
|
|
69320
69602
|
pivotColumns: sourceReport.pivotColumns,
|
|
@@ -69415,7 +69697,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69415
69697
|
const xAxisOptions = (0, import_react63.useMemo)(() => {
|
|
69416
69698
|
if (!chartAxesBaseChart) return chartAxisOptions;
|
|
69417
69699
|
const pivot = chartAxesBaseChart.pivot;
|
|
69418
|
-
const pivotRowField =
|
|
69700
|
+
const pivotRowField = pivotRowKey(chartAxesBaseChart);
|
|
69419
69701
|
const chartType2 = String(chartAxesBaseChart.chartType ?? "").toLowerCase();
|
|
69420
69702
|
if (pivot && pivotRowField) {
|
|
69421
69703
|
if (["metric", "gauge"].includes(chartType2)) {
|
|
@@ -69536,9 +69818,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69536
69818
|
const resolvedXAxisField = (0, import_react63.useMemo)(() => {
|
|
69537
69819
|
if (!chartAxesBaseChart) return "";
|
|
69538
69820
|
const chartType2 = String(chartAxesBaseChart.chartType ?? "").toLowerCase();
|
|
69539
|
-
const pivotRowField =
|
|
69540
|
-
chartAxesBaseChart.pivot?.rowField ?? ""
|
|
69541
|
-
).trim();
|
|
69821
|
+
const pivotRowField = pivotRowKey(chartAxesBaseChart);
|
|
69542
69822
|
if (pivotRowField) {
|
|
69543
69823
|
const rowColumn = (chartAxesBaseChart.pivotColumns ?? chartAxesBaseChart.columns ?? []).find((col) => String(col.field ?? "").trim() === pivotRowField);
|
|
69544
69824
|
if (shouldUsePivotRowFieldAsXAxis(
|
|
@@ -69674,11 +69954,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69674
69954
|
columns2 = mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
69675
69955
|
columns: columns2 ?? baseChart.columns,
|
|
69676
69956
|
yAxisFields: resolvedYAxisFieldsForDisplay,
|
|
69677
|
-
pivotRowField:
|
|
69957
|
+
pivotRowField: pivotRowKey(baseChart),
|
|
69678
69958
|
xAxisLabel: resolvedXAxisLabel
|
|
69679
69959
|
});
|
|
69680
69960
|
} else {
|
|
69681
|
-
const pivotRowField =
|
|
69961
|
+
const pivotRowField = pivotRowKey(baseChart);
|
|
69682
69962
|
const pivotLabelByField = new Map(
|
|
69683
69963
|
(baseChart.pivotColumns ?? []).map((column) => [
|
|
69684
69964
|
String(column.field ?? "").trim(),
|
|
@@ -69726,8 +70006,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69726
70006
|
const rowField = String(pivot?.rowField ?? "").trim();
|
|
69727
70007
|
if (rowField && isDateType(String(pivot?.rowFieldType ?? ""))) {
|
|
69728
70008
|
const field = pivot?.rowFieldTable ? `${pivot.rowFieldTable}.${rowField}` : rowField;
|
|
69729
|
-
const
|
|
69730
|
-
const
|
|
70009
|
+
const chartBucket = dateBucket || pivot?.dateBucket || "month";
|
|
70010
|
+
const bucket = inBucketDateBucketForField(
|
|
70011
|
+
filtersForQueryBuilder.rules ?? [],
|
|
70012
|
+
field
|
|
70013
|
+
) ?? chartBucket;
|
|
69731
70014
|
const cacheKey = `${String(effectiveReportId ?? "")}\0${field}\0${bucket}`;
|
|
69732
70015
|
if (pivotDateFilterRangeCacheRef.current.key !== cacheKey) {
|
|
69733
70016
|
pivotDateFilterRangeCacheRef.current = {
|
|
@@ -69743,7 +70026,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69743
70026
|
const key = String(raw);
|
|
69744
70027
|
const timestamp = new Date(key).getTime();
|
|
69745
70028
|
if (Number.isNaN(timestamp)) continue;
|
|
69746
|
-
labelsByRaw.set(key, String(record[rowField] ?? key));
|
|
69747
70029
|
const cachedMin = pivotDateFilterRangeCacheRef.current.min;
|
|
69748
70030
|
const cachedMax = pivotDateFilterRangeCacheRef.current.max;
|
|
69749
70031
|
if (cachedMin == null || timestamp < new Date(cachedMin).getTime()) {
|
|
@@ -69756,7 +70038,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69756
70038
|
const { min: min2, max: max2 } = pivotDateFilterRangeCacheRef.current;
|
|
69757
70039
|
const options2 = min2 && max2 ? buildPivotDateBucketStarts({ min: min2, max: max2 }, bucket).map((value) => ({
|
|
69758
70040
|
value,
|
|
69759
|
-
label:
|
|
70041
|
+
label: getDateString(value, void 0, bucket)
|
|
69760
70042
|
})) : [];
|
|
69761
70043
|
out.push({
|
|
69762
70044
|
field,
|
|
@@ -69772,7 +70054,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69772
70054
|
chart?.rows,
|
|
69773
70055
|
dateBucket,
|
|
69774
70056
|
effectiveReportId,
|
|
69775
|
-
filterValueOptionsByFieldName
|
|
70057
|
+
filterValueOptionsByFieldName,
|
|
70058
|
+
filtersForQueryBuilder.rules
|
|
69776
70059
|
]);
|
|
69777
70060
|
const chartForUi = (0, import_react63.useMemo)(() => {
|
|
69778
70061
|
if (!chart?.pivot) return chart;
|
|
@@ -69785,10 +70068,10 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69785
70068
|
};
|
|
69786
70069
|
const selectedValue = (field, operator, options2) => {
|
|
69787
70070
|
const rule = filtersForQueryBuilder.rules.find(
|
|
69788
|
-
(entry) => typeof entry === "object" && entry !== null && "field" in entry && entry.field === field && entry.operator === operator
|
|
70071
|
+
(entry) => typeof entry === "object" && entry !== null && "field" in entry && entry.field === field && (entry.operator === operator || operator === "inBucket" && entry.operator === "between")
|
|
69789
70072
|
);
|
|
69790
70073
|
if (!rule) return null;
|
|
69791
|
-
const raw = operator === "inBucket" ? rule.value?.start : Array.isArray(rule.value) ? rule.value[0] : void 0;
|
|
70074
|
+
const raw = operator === "inBucket" ? rule.operator === "between" && Array.isArray(rule.value) ? rule.value[0] : rule.value?.start : Array.isArray(rule.value) ? rule.value[0] : void 0;
|
|
69792
70075
|
if (raw == null) return null;
|
|
69793
70076
|
const value = String(raw);
|
|
69794
70077
|
return options2.some((option) => option.value === value) ? value : null;
|
|
@@ -70044,9 +70327,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70044
70327
|
sourceReport,
|
|
70045
70328
|
includeSelectedSchemaFallback: tableColumnsEditedSignature !== null
|
|
70046
70329
|
});
|
|
70047
|
-
const pivotRowFieldForTable =
|
|
70048
|
-
sourceReport?.pivot?.rowField ?? ""
|
|
70049
|
-
).trim();
|
|
70330
|
+
const pivotRowFieldForTable = pivotRowKey(sourceReport);
|
|
70050
70331
|
const pivotRowTableUsesAxisFormat = chartAxisEdits.xAxisFormat !== void 0;
|
|
70051
70332
|
const columns2 = String(chartType ?? "").toLowerCase() === "table" && sourceReport?.pivot && pivotRowFieldForTable && String(resolvedXAxisField ?? "").trim() === pivotRowFieldForTable ? mergedFromReport.map(
|
|
70052
70333
|
(column) => column.field === pivotRowFieldForTable ? {
|
|
@@ -70058,7 +70339,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70058
70339
|
const pivotLabeledColumns = String(chartType ?? "").toLowerCase() === "table" && sourceReport?.pivot ? mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
70059
70340
|
columns: columns2,
|
|
70060
70341
|
yAxisFields: resolvedYAxisFieldsForDisplay,
|
|
70061
|
-
pivotRowField:
|
|
70342
|
+
pivotRowField: pivotRowKey(sourceReport),
|
|
70062
70343
|
xAxisLabel: resolvedXAxisLabel
|
|
70063
70344
|
}) ?? columns2 : columns2;
|
|
70064
70345
|
const tableColumnsWithPivotDisplayLabels = pivotLabeledColumns.map(
|
|
@@ -70307,7 +70588,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70307
70588
|
if (slotFormatting) {
|
|
70308
70589
|
const aggregations = slotFormatting.aggregations;
|
|
70309
70590
|
const hasMultiple = aggregations.length > 1;
|
|
70310
|
-
const rowField =
|
|
70591
|
+
const rowField = pivotRowKey(chart);
|
|
70311
70592
|
const firstValueColumnFormat = String(
|
|
70312
70593
|
(chart.columns ?? []).find(
|
|
70313
70594
|
(c) => String(c.field ?? "").trim() !== rowField
|
|
@@ -70343,9 +70624,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70343
70624
|
}
|
|
70344
70625
|
}
|
|
70345
70626
|
}
|
|
70346
|
-
const pivotRowFieldForSettings =
|
|
70347
|
-
chart?.pivot?.rowField ?? ""
|
|
70348
|
-
).trim();
|
|
70627
|
+
const pivotRowFieldForSettings = pivotRowKey(chart);
|
|
70349
70628
|
const rowAxisLabel = String(resolvedXAxisLabel ?? "").trim();
|
|
70350
70629
|
for (const columnId of activeTableColumnIds) {
|
|
70351
70630
|
const option = columnOptionById.get(columnId);
|
|
@@ -70405,7 +70684,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70405
70684
|
tableColumnSettingsCoalesceRef.current = new Map(tableColumnSettingsById);
|
|
70406
70685
|
}, [tableColumnSettingsById]);
|
|
70407
70686
|
const tableColumnItems = (0, import_react63.useMemo)(() => {
|
|
70408
|
-
const pivotRowFieldForFormat =
|
|
70687
|
+
const pivotRowFieldForFormat = pivotRowKey(chart);
|
|
70409
70688
|
const pivotRowFieldType = String(chart?.pivot?.rowFieldType ?? "").trim();
|
|
70410
70689
|
const items = activeTableColumnIds.map((columnId) => {
|
|
70411
70690
|
const option = columnOptionById.get(columnId);
|
|
@@ -70444,7 +70723,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70444
70723
|
return new Map(tableColumnItems.map((item) => [item.id, item]));
|
|
70445
70724
|
}, [tableColumnItems]);
|
|
70446
70725
|
const tableColumnValues = (0, import_react63.useMemo)(() => {
|
|
70447
|
-
const pivotRowFieldForFormat =
|
|
70726
|
+
const pivotRowFieldForFormat = pivotRowKey(chart);
|
|
70448
70727
|
const pivotRowFieldType = String(chart?.pivot?.rowFieldType ?? "").trim();
|
|
70449
70728
|
return tableColumnItems.map((item) => {
|
|
70450
70729
|
const coerced = coerceTableColumnFormatToAxisValue(item.format);
|
|
@@ -70462,11 +70741,92 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70462
70741
|
isPivotTableChart,
|
|
70463
70742
|
tableColumnItems
|
|
70464
70743
|
]);
|
|
70465
|
-
const initialLoadInProgress = !reportOverride && Boolean(effectiveReportId) && (!client || initialLoadQuery.isPending || initialLoadQuery.isFetching);
|
|
70744
|
+
const initialLoadInProgress = !reportOverride && Boolean(effectiveReportId) && (!client || initialLoadQuery.isPending || initialLoadQuery.isFetching || reportBuilderStateQuery.isPending || reportBuilderStateQuery.isFetching);
|
|
70466
70745
|
const filterUniqueValuesLoading = filterUniqueValuesEnabled && (filterUniqueValuesQuery.isPending || filterUniqueValuesQuery.isFetching);
|
|
70467
70746
|
const chartLoading = initialLoadInProgress || pendingPivotRefresh || (Boolean(nextPivot) ? pivotRefreshQuery.isFetching : tableRefreshQuery.isFetching);
|
|
70468
|
-
const
|
|
70747
|
+
const awaitingPivotDetailRows = Boolean(nextPivot || sourceReport?.pivot) && !reportOverride && Boolean(sourceReport) && sourceReportMatchesEffectiveReportId && (!Array.isArray(sourceReport?.rows) || sourceReport.rows.length === 0) && pivotTableDataRefreshQuery.status !== "error";
|
|
70748
|
+
const tableLoading = initialLoadInProgress || pendingPivotRefresh || awaitingPivotDetailRows || tablePageFetching && pagination.pageIndex > 0 || (Boolean(nextPivot) ? pivotTableDataRefreshQuery.isFetching : tableRefreshQuery.isFetching);
|
|
70469
70749
|
const loading = chartLoading || tableLoading;
|
|
70750
|
+
const lastUseReportLoadingLogRef = (0, import_react63.useRef)("");
|
|
70751
|
+
(0, import_react63.useEffect)(() => {
|
|
70752
|
+
const snapshot = {
|
|
70753
|
+
reportId: effectiveReportId,
|
|
70754
|
+
chartLoading,
|
|
70755
|
+
tableLoading,
|
|
70756
|
+
loading,
|
|
70757
|
+
initialLoadInProgress,
|
|
70758
|
+
initialLoad: {
|
|
70759
|
+
status: initialLoadQuery.status,
|
|
70760
|
+
fetchStatus: initialLoadQuery.fetchStatus,
|
|
70761
|
+
isPending: initialLoadQuery.isPending,
|
|
70762
|
+
isFetching: initialLoadQuery.isFetching,
|
|
70763
|
+
hasData: initialLoadQuery.data !== void 0,
|
|
70764
|
+
dataUpdatedAt: initialLoadQuery.dataUpdatedAt,
|
|
70765
|
+
staleTime: 0
|
|
70766
|
+
},
|
|
70767
|
+
pendingPivotRefresh,
|
|
70768
|
+
pivotRefresh: {
|
|
70769
|
+
enabled: pivotRefreshQueryEnabled,
|
|
70770
|
+
isFetching: pivotRefreshQuery.isFetching
|
|
70771
|
+
},
|
|
70772
|
+
tableRefresh: {
|
|
70773
|
+
enabled: tableRefreshQueryEnabled,
|
|
70774
|
+
isFetching: tableRefreshQuery.isFetching
|
|
70775
|
+
},
|
|
70776
|
+
pivotTableData: {
|
|
70777
|
+
enabled: pivotTableDataRefreshQueryEnabled,
|
|
70778
|
+
isFetching: pivotTableDataRefreshQuery.isFetching
|
|
70779
|
+
},
|
|
70780
|
+
tablePage: {
|
|
70781
|
+
enabled: tablePageQueryEnabled,
|
|
70782
|
+
isFetching: tablePageQuery.isFetching
|
|
70783
|
+
},
|
|
70784
|
+
uniqueValues: {
|
|
70785
|
+
enabled: filterUniqueValuesEnabled,
|
|
70786
|
+
isFetching: filterUniqueValuesQuery.isFetching,
|
|
70787
|
+
isPending: filterUniqueValuesQuery.isPending
|
|
70788
|
+
},
|
|
70789
|
+
whyChartLoading: {
|
|
70790
|
+
noClient: !client,
|
|
70791
|
+
initialPending: initialLoadQuery.isPending,
|
|
70792
|
+
initialFetching: initialLoadQuery.isFetching,
|
|
70793
|
+
pendingPivotRefresh,
|
|
70794
|
+
pivotRefreshFetching: Boolean(nextPivot) && pivotRefreshQuery.isFetching,
|
|
70795
|
+
tableRefreshFetching: !nextPivot && tableRefreshQuery.isFetching
|
|
70796
|
+
}
|
|
70797
|
+
};
|
|
70798
|
+
const serialized = JSON.stringify(snapshot);
|
|
70799
|
+
if (serialized === lastUseReportLoadingLogRef.current) return;
|
|
70800
|
+
lastUseReportLoadingLogRef.current = serialized;
|
|
70801
|
+
profileDashboard("use-report-loading", snapshot);
|
|
70802
|
+
}, [
|
|
70803
|
+
client,
|
|
70804
|
+
chartLoading,
|
|
70805
|
+
effectiveReportId,
|
|
70806
|
+
filterUniqueValuesEnabled,
|
|
70807
|
+
filterUniqueValuesQuery.fetchStatus,
|
|
70808
|
+
filterUniqueValuesQuery.isFetching,
|
|
70809
|
+
filterUniqueValuesQuery.isPending,
|
|
70810
|
+
initialLoadInProgress,
|
|
70811
|
+
initialLoadQuery.data,
|
|
70812
|
+
initialLoadQuery.dataUpdatedAt,
|
|
70813
|
+
initialLoadQuery.fetchStatus,
|
|
70814
|
+
initialLoadQuery.isFetching,
|
|
70815
|
+
initialLoadQuery.isPending,
|
|
70816
|
+
initialLoadQuery.status,
|
|
70817
|
+
loading,
|
|
70818
|
+
nextPivot,
|
|
70819
|
+
pendingPivotRefresh,
|
|
70820
|
+
pivotRefreshQuery.isFetching,
|
|
70821
|
+
pivotRefreshQueryEnabled,
|
|
70822
|
+
pivotTableDataRefreshQuery.isFetching,
|
|
70823
|
+
pivotTableDataRefreshQueryEnabled,
|
|
70824
|
+
tableLoading,
|
|
70825
|
+
tablePageQuery.isFetching,
|
|
70826
|
+
tablePageQueryEnabled,
|
|
70827
|
+
tableRefreshQuery.isFetching,
|
|
70828
|
+
tableRefreshQueryEnabled
|
|
70829
|
+
]);
|
|
70470
70830
|
const buildSetReportColumnsFromIds = (nextColumnIds, settingsById) => {
|
|
70471
70831
|
const normalizedNextIds = nextColumnIds.map((columnId) => String(columnId ?? "").trim()).filter(Boolean);
|
|
70472
70832
|
return normalizedNextIds.map((columnId) => {
|
|
@@ -70506,7 +70866,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70506
70866
|
const option = columnOptionById.get(normalizedId);
|
|
70507
70867
|
const pivotField = String(option?.field ?? normalizedId).trim();
|
|
70508
70868
|
const pivotModel = chartAxesBaseChart.pivot;
|
|
70509
|
-
const rowField =
|
|
70869
|
+
const rowField = pivotRowKey(chartAxesBaseChart);
|
|
70510
70870
|
if (!pivotModel) return null;
|
|
70511
70871
|
const isPivotRowColumn = Boolean(
|
|
70512
70872
|
pivotField && rowField && pivotField === rowField
|
|
@@ -71209,7 +71569,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71209
71569
|
};
|
|
71210
71570
|
const saveChanges = (0, import_react63.useCallback)(
|
|
71211
71571
|
async (overrides) => {
|
|
71212
|
-
if (!client || !sourceReport || !effectiveReportBuilderState)
|
|
71572
|
+
if (!client || !sourceReport || !effectiveReportBuilderState) {
|
|
71573
|
+
return;
|
|
71574
|
+
}
|
|
71213
71575
|
const sourceRest = {
|
|
71214
71576
|
...sourceReport
|
|
71215
71577
|
};
|
|
@@ -72315,10 +72677,9 @@ function useReportFilterDraft(args) {
|
|
|
72315
72677
|
);
|
|
72316
72678
|
return stringField?.name ?? fields[0]?.name ?? "";
|
|
72317
72679
|
}, []);
|
|
72318
|
-
const getDefaultValue = (0, import_react66.useCallback)(
|
|
72319
|
-
|
|
72320
|
-
|
|
72321
|
-
);
|
|
72680
|
+
const getDefaultValue = (0, import_react66.useCallback)((rule) => {
|
|
72681
|
+
return defaultFilterRuleValueForOperator(rule?.operator);
|
|
72682
|
+
}, []);
|
|
72322
72683
|
const filterDraftQueryBuilderProps = (0, import_react66.useMemo)(
|
|
72323
72684
|
() => ({
|
|
72324
72685
|
...queryBuilderProps,
|