@quillsql/react 2.16.50 → 2.16.51
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 +69 -418
- package/dist/index.js +210 -554
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20060,27 +20060,6 @@ function parseData(rows, queryType) {
|
|
|
20060
20060
|
return rows;
|
|
20061
20061
|
}
|
|
20062
20062
|
}
|
|
20063
|
-
function isQuillFetchDebugEnabled() {
|
|
20064
|
-
if (typeof globalThis !== "undefined") {
|
|
20065
|
-
for (const debugFlag of QUILL_FETCH_DEBUG_FLAGS) {
|
|
20066
|
-
if (globalThis?.[debugFlag] === true) {
|
|
20067
|
-
return true;
|
|
20068
|
-
}
|
|
20069
|
-
}
|
|
20070
|
-
}
|
|
20071
|
-
if (typeof process !== "undefined" && typeof process.env !== "undefined") {
|
|
20072
|
-
const envCandidates = [
|
|
20073
|
-
process?.env?.QUILL_DEBUG_USEFORM_HYDRATION,
|
|
20074
|
-
process?.env?.QUILL_DEBUG_USEFORM_FILTERS,
|
|
20075
|
-
process?.env?.QUILL_DEBUG_DATA_FETCHER
|
|
20076
|
-
];
|
|
20077
|
-
return envCandidates.some((candidate) => {
|
|
20078
|
-
const normalized = String(candidate ?? "").trim().toLowerCase();
|
|
20079
|
-
return normalized === "1" || normalized === "true";
|
|
20080
|
-
});
|
|
20081
|
-
}
|
|
20082
|
-
return false;
|
|
20083
|
-
}
|
|
20084
20063
|
async function testSqlViewState(client, referencedTables, getToken) {
|
|
20085
20064
|
let errorMessage = null;
|
|
20086
20065
|
await Promise.all(
|
|
@@ -20566,7 +20545,7 @@ async function fetchRelevantInfoFromState(reportBuilderState, tables, columns, a
|
|
|
20566
20545
|
return { error: error.message };
|
|
20567
20546
|
}
|
|
20568
20547
|
}
|
|
20569
|
-
var
|
|
20548
|
+
var quillFetch, parseFetchResponse;
|
|
20570
20549
|
var init_dataFetcher = __esm({
|
|
20571
20550
|
"src/utils/dataFetcher.tsx"() {
|
|
20572
20551
|
"use strict";
|
|
@@ -20575,16 +20554,6 @@ var init_dataFetcher = __esm({
|
|
|
20575
20554
|
init_tableProcessing();
|
|
20576
20555
|
init_dates();
|
|
20577
20556
|
init_changelogNotify();
|
|
20578
|
-
QUILL_FETCH_DEBUG_FLAGS = [
|
|
20579
|
-
"__QUILL_DEBUG_USEFORM_HYDRATION__",
|
|
20580
|
-
"__QUILL_DEBUG_USEFORM_FILTERS__",
|
|
20581
|
-
"__QUILL_DEBUG_DATA_FETCHER__"
|
|
20582
|
-
];
|
|
20583
|
-
quillFetchDebugSeq = 0;
|
|
20584
|
-
logQuillFetchDebug = (label, payload) => {
|
|
20585
|
-
if (!isQuillFetchDebugEnabled()) return;
|
|
20586
|
-
console.log(`[quillFetch-debug] ${label}`, payload);
|
|
20587
|
-
};
|
|
20588
20557
|
quillFetch = async ({
|
|
20589
20558
|
client,
|
|
20590
20559
|
task,
|
|
@@ -20595,24 +20564,7 @@ var init_dataFetcher = __esm({
|
|
|
20595
20564
|
urlParameters,
|
|
20596
20565
|
getToken
|
|
20597
20566
|
}) => {
|
|
20598
|
-
const debugSeq = ++quillFetchDebugSeq;
|
|
20599
|
-
const debugStart = Date.now();
|
|
20600
|
-
logQuillFetchDebug("request", {
|
|
20601
|
-
seq: debugSeq,
|
|
20602
|
-
task,
|
|
20603
|
-
reportId: metadata?.reportId,
|
|
20604
|
-
dashboardItemId: metadata?.dashboardItemId,
|
|
20605
|
-
hasPivot: Boolean(metadata?.pivot),
|
|
20606
|
-
hasReportBuilderState: Boolean(metadata?.reportBuilderState),
|
|
20607
|
-
filtersLength: Array.isArray(metadata?.filters) ? metadata.filters.length : void 0
|
|
20608
|
-
});
|
|
20609
20567
|
const token = await getToken();
|
|
20610
|
-
logQuillFetchDebug("token-acquired", {
|
|
20611
|
-
seq: debugSeq,
|
|
20612
|
-
task,
|
|
20613
|
-
ms: Date.now() - debugStart,
|
|
20614
|
-
hasToken: Boolean(token)
|
|
20615
|
-
});
|
|
20616
20568
|
const queryString = urlParameters ?? `task=${task}`;
|
|
20617
20569
|
const endpoint = client.queryEndpoint ? `${client.queryEndpoint}?${queryString}` : `${QUILL_SERVER}${QUILL_QUERY_ENDPOINT}?${queryString}`;
|
|
20618
20570
|
try {
|
|
@@ -20644,17 +20596,6 @@ var init_dataFetcher = __esm({
|
|
|
20644
20596
|
if (task !== "fetch-changelog-list" && Array.isArray(normalizedData?.changelogs)) {
|
|
20645
20597
|
notifyChangelogs(normalizedData.changelogs);
|
|
20646
20598
|
}
|
|
20647
|
-
logQuillFetchDebug("response", {
|
|
20648
|
-
seq: debugSeq,
|
|
20649
|
-
task,
|
|
20650
|
-
ms: Date.now() - debugStart,
|
|
20651
|
-
status: result.status,
|
|
20652
|
-
error: result.error,
|
|
20653
|
-
dataError: normalizedData?.error,
|
|
20654
|
-
queryResultRowCounts: Array.isArray(result.queries?.queryResults) ? result.queries.queryResults.map(
|
|
20655
|
-
(qr) => Array.isArray(qr?.rows) ? qr.rows.length : null
|
|
20656
|
-
) : void 0
|
|
20657
|
-
});
|
|
20658
20599
|
return {
|
|
20659
20600
|
data: normalizedData,
|
|
20660
20601
|
queries: result.queries,
|
|
@@ -20663,19 +20604,8 @@ var init_dataFetcher = __esm({
|
|
|
20663
20604
|
};
|
|
20664
20605
|
} catch (e) {
|
|
20665
20606
|
if (e instanceof Error && e.name === "AbortError") {
|
|
20666
|
-
logQuillFetchDebug("aborted", {
|
|
20667
|
-
seq: debugSeq,
|
|
20668
|
-
task,
|
|
20669
|
-
ms: Date.now() - debugStart
|
|
20670
|
-
});
|
|
20671
20607
|
throw e;
|
|
20672
20608
|
}
|
|
20673
|
-
logQuillFetchDebug("threw", {
|
|
20674
|
-
seq: debugSeq,
|
|
20675
|
-
task,
|
|
20676
|
-
ms: Date.now() - debugStart,
|
|
20677
|
-
message: e instanceof Error ? e.message : String(e)
|
|
20678
|
-
});
|
|
20679
20609
|
if (task !== "set-section-order") {
|
|
20680
20610
|
console.error("Failed to fetch:", e);
|
|
20681
20611
|
}
|
|
@@ -21106,7 +21036,7 @@ import {
|
|
|
21106
21036
|
useEffect as useEffect19,
|
|
21107
21037
|
useState as useState26,
|
|
21108
21038
|
useMemo as useMemo19,
|
|
21109
|
-
useRef as
|
|
21039
|
+
useRef as useRef15
|
|
21110
21040
|
} from "react";
|
|
21111
21041
|
|
|
21112
21042
|
// src/Chart.tsx
|
|
@@ -21115,7 +21045,7 @@ import {
|
|
|
21115
21045
|
useEffect as useEffect16,
|
|
21116
21046
|
useContext as useContext17,
|
|
21117
21047
|
useMemo as useMemo16,
|
|
21118
|
-
useRef as
|
|
21048
|
+
useRef as useRef13
|
|
21119
21049
|
} from "react";
|
|
21120
21050
|
|
|
21121
21051
|
// src/utils/csv.ts
|
|
@@ -29272,62 +29202,6 @@ function stableColorIndex(field) {
|
|
|
29272
29202
|
}
|
|
29273
29203
|
return hash;
|
|
29274
29204
|
}
|
|
29275
|
-
function assignStableSeriesColors(fields, colors, knownFields = fields) {
|
|
29276
|
-
const normalize2 = (values) => [
|
|
29277
|
-
...new Set(
|
|
29278
|
-
values.filter((field) => typeof field === "string").map((field) => field.replace("comparison_", ""))
|
|
29279
|
-
)
|
|
29280
|
-
];
|
|
29281
|
-
const uniqueFields = normalize2(fields);
|
|
29282
|
-
const universe = normalize2([...knownFields, ...fields]);
|
|
29283
|
-
const result = /* @__PURE__ */ new Map();
|
|
29284
|
-
if (universe.length === 0) {
|
|
29285
|
-
return result;
|
|
29286
|
-
}
|
|
29287
|
-
if (!colors.length) {
|
|
29288
|
-
for (const field of uniqueFields) {
|
|
29289
|
-
result.set(field, "gray");
|
|
29290
|
-
}
|
|
29291
|
-
return result;
|
|
29292
|
-
}
|
|
29293
|
-
const palette = colors.length >= universe.length ? colors : generateArrayFromColor(colors, universe.length);
|
|
29294
|
-
const ordered = [...universe].sort((a, b) => {
|
|
29295
|
-
const diff = stableColorIndex(a) - stableColorIndex(b);
|
|
29296
|
-
return diff !== 0 ? diff : a.localeCompare(b);
|
|
29297
|
-
});
|
|
29298
|
-
const usedIndices = /* @__PURE__ */ new Set();
|
|
29299
|
-
const deferred = [];
|
|
29300
|
-
const assigned = /* @__PURE__ */ new Map();
|
|
29301
|
-
for (const field of ordered) {
|
|
29302
|
-
const preferred = stableColorIndex(field) % palette.length;
|
|
29303
|
-
if (!usedIndices.has(preferred)) {
|
|
29304
|
-
usedIndices.add(preferred);
|
|
29305
|
-
assigned.set(field, palette[preferred]);
|
|
29306
|
-
} else {
|
|
29307
|
-
deferred.push(field);
|
|
29308
|
-
}
|
|
29309
|
-
}
|
|
29310
|
-
for (const field of deferred) {
|
|
29311
|
-
const preferred = stableColorIndex(field) % palette.length;
|
|
29312
|
-
let found = false;
|
|
29313
|
-
for (let offset = 1; offset < palette.length; offset++) {
|
|
29314
|
-
const idx = (preferred + offset) % palette.length;
|
|
29315
|
-
if (!usedIndices.has(idx)) {
|
|
29316
|
-
usedIndices.add(idx);
|
|
29317
|
-
assigned.set(field, palette[idx]);
|
|
29318
|
-
found = true;
|
|
29319
|
-
break;
|
|
29320
|
-
}
|
|
29321
|
-
}
|
|
29322
|
-
if (!found) {
|
|
29323
|
-
assigned.set(field, palette[preferred]);
|
|
29324
|
-
}
|
|
29325
|
-
}
|
|
29326
|
-
for (const field of uniqueFields) {
|
|
29327
|
-
result.set(field, assigned.get(field));
|
|
29328
|
-
}
|
|
29329
|
-
return result;
|
|
29330
|
-
}
|
|
29331
29205
|
function selectColor(element, colors, index) {
|
|
29332
29206
|
if (!element?.field) return "gray";
|
|
29333
29207
|
const isComparison = element.field.includes("comparison_");
|
|
@@ -34287,7 +34161,7 @@ var CustomBar_default = CustomBar;
|
|
|
34287
34161
|
// src/components/Chart/BarChart.tsx
|
|
34288
34162
|
init_columnProcessing();
|
|
34289
34163
|
init_textProcessing();
|
|
34290
|
-
import { useMemo as useMemo8
|
|
34164
|
+
import { useMemo as useMemo8 } from "react";
|
|
34291
34165
|
import { Fragment as Fragment3, jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
34292
34166
|
var CATEGORY_AXIS_WIDTH = 120;
|
|
34293
34167
|
var VALUE_AXIS_WIDTH = 44;
|
|
@@ -34387,21 +34261,6 @@ function BarChart({
|
|
|
34387
34261
|
() => stackedMode ? getStackedDomain(data, yAxisFields, comparison) : getDomain(data, yAxisFields, referenceLines),
|
|
34388
34262
|
[stackedMode, data, yAxisFields, referenceLines, comparison]
|
|
34389
34263
|
);
|
|
34390
|
-
const knownSeriesFieldsRef = useRef6([]);
|
|
34391
|
-
const knownColorsKeyRef = useRef6("");
|
|
34392
|
-
const seriesColorByField = useMemo8(() => {
|
|
34393
|
-
const visibleFields = yAxisFields.filter((field) => comparison || !field.field.startsWith("comparison_")).map((field) => field.field);
|
|
34394
|
-
const colorsKey = colors.join("\0");
|
|
34395
|
-
if (knownColorsKeyRef.current !== colorsKey) {
|
|
34396
|
-
knownSeriesFieldsRef.current = [];
|
|
34397
|
-
knownColorsKeyRef.current = colorsKey;
|
|
34398
|
-
}
|
|
34399
|
-
const knownFields = [
|
|
34400
|
-
.../* @__PURE__ */ new Set([...knownSeriesFieldsRef.current, ...visibleFields])
|
|
34401
|
-
];
|
|
34402
|
-
knownSeriesFieldsRef.current = knownFields;
|
|
34403
|
-
return assignStableSeriesColors(visibleFields, colors, knownFields);
|
|
34404
|
-
}, [yAxisFields, colors, comparison]);
|
|
34405
34264
|
const allowDecimals = useMemo8(
|
|
34406
34265
|
() => getAllowDecimals(data, yAxisFields, referenceLines),
|
|
34407
34266
|
[data, yAxisFields, referenceLines]
|
|
@@ -34664,15 +34523,7 @@ function BarChart({
|
|
|
34664
34523
|
dataKey: elem.field,
|
|
34665
34524
|
stackId: stackedMode ? "same_id" : isStacked ? elem.field.replace("comparison_", "") : void 0,
|
|
34666
34525
|
type: "linear",
|
|
34667
|
-
fill: getCustomColor(elem.field) ?? selectColor(
|
|
34668
|
-
elem,
|
|
34669
|
-
[
|
|
34670
|
-
seriesColorByField.get(
|
|
34671
|
-
elem.field.replace("comparison_", "")
|
|
34672
|
-
) ?? colors[0] ?? "gray"
|
|
34673
|
-
],
|
|
34674
|
-
0
|
|
34675
|
-
),
|
|
34526
|
+
fill: getCustomColor(elem.field) ?? selectColor(elem, colors, stableColorIndex(elem.field)),
|
|
34676
34527
|
isAnimationActive,
|
|
34677
34528
|
shape: customBarShape,
|
|
34678
34529
|
activeBar: customActiveBarShape ?? {
|
|
@@ -34866,7 +34717,7 @@ import { useMemo as useMemo12 } from "react";
|
|
|
34866
34717
|
import {
|
|
34867
34718
|
useContext as useContext9,
|
|
34868
34719
|
useEffect as useEffect10,
|
|
34869
|
-
useRef as
|
|
34720
|
+
useRef as useRef7,
|
|
34870
34721
|
useState as useState12
|
|
34871
34722
|
} from "react";
|
|
34872
34723
|
import {
|
|
@@ -34889,7 +34740,7 @@ import {
|
|
|
34889
34740
|
import {
|
|
34890
34741
|
useContext as useContext8,
|
|
34891
34742
|
useMemo as useMemo9,
|
|
34892
|
-
useRef as
|
|
34743
|
+
useRef as useRef6,
|
|
34893
34744
|
useState as useState11,
|
|
34894
34745
|
useEffect as useEffect9
|
|
34895
34746
|
} from "react";
|
|
@@ -34908,8 +34759,8 @@ function QuillSelectComponent({
|
|
|
34908
34759
|
}) {
|
|
34909
34760
|
const [theme] = useContext8(ThemeContext);
|
|
34910
34761
|
const [showModal, setShowModal] = useState11(false);
|
|
34911
|
-
const modalRef =
|
|
34912
|
-
const buttonRef =
|
|
34762
|
+
const modalRef = useRef6(null);
|
|
34763
|
+
const buttonRef = useRef6(null);
|
|
34913
34764
|
useOnClickOutside_default(
|
|
34914
34765
|
modalRef,
|
|
34915
34766
|
(event) => {
|
|
@@ -34934,7 +34785,7 @@ function QuillSelectComponent({
|
|
|
34934
34785
|
}, [sortedItems]);
|
|
34935
34786
|
const [popoverPosition, setPopoverPosition] = useState11(void 0);
|
|
34936
34787
|
const [z, setZ] = useState11(10);
|
|
34937
|
-
const scrollableParentRef =
|
|
34788
|
+
const scrollableParentRef = useRef6(document.body);
|
|
34938
34789
|
const updatePosition = () => {
|
|
34939
34790
|
if (buttonRef.current) {
|
|
34940
34791
|
requestAnimationFrame(() => {
|
|
@@ -35259,8 +35110,8 @@ function QuillDateRangePicker({
|
|
|
35259
35110
|
);
|
|
35260
35111
|
const [localPreset, setLocalPreset] = useState12(preset);
|
|
35261
35112
|
const [showModal, setShowModal] = useState12(false);
|
|
35262
|
-
const buttonRef =
|
|
35263
|
-
const modalRef =
|
|
35113
|
+
const buttonRef = useRef7(null);
|
|
35114
|
+
const modalRef = useRef7(null);
|
|
35264
35115
|
useEffect10(() => {
|
|
35265
35116
|
setLocalEndDate(dateRange.endDate);
|
|
35266
35117
|
setLocalStartDate(dateRange.startDate);
|
|
@@ -35776,7 +35627,7 @@ import React7, {
|
|
|
35776
35627
|
useContext as useContext10,
|
|
35777
35628
|
useEffect as useEffect11,
|
|
35778
35629
|
useMemo as useMemo10,
|
|
35779
|
-
useRef as
|
|
35630
|
+
useRef as useRef8,
|
|
35780
35631
|
useState as useState13
|
|
35781
35632
|
} from "react";
|
|
35782
35633
|
import { createPortal as createPortal3 } from "react-dom";
|
|
@@ -35796,15 +35647,15 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
35796
35647
|
const [theme] = useContext10(ThemeContext);
|
|
35797
35648
|
const [selectedOptions, setSelectedOptions] = useState13([]);
|
|
35798
35649
|
const [showModal, setShowModal] = useState13(false);
|
|
35799
|
-
const modalRef =
|
|
35800
|
-
const buttonRef =
|
|
35801
|
-
const debounceTimeoutId =
|
|
35650
|
+
const modalRef = useRef8(null);
|
|
35651
|
+
const buttonRef = useRef8(null);
|
|
35652
|
+
const debounceTimeoutId = useRef8(null);
|
|
35802
35653
|
const [searchQuery, setSearchQuery] = React7.useState("");
|
|
35803
35654
|
const [exceedsLimit, setExceedsLimit] = useState13(false);
|
|
35804
35655
|
const [popoverPosition, setPopoverPosition] = useState13(void 0);
|
|
35805
35656
|
const [z, setZ] = useState13(10);
|
|
35806
|
-
const scrollableParentRef =
|
|
35807
|
-
const selectAllRef =
|
|
35657
|
+
const scrollableParentRef = useRef8(document.body);
|
|
35658
|
+
const selectAllRef = useRef8(null);
|
|
35808
35659
|
let CheckboxState;
|
|
35809
35660
|
((CheckboxState2) => {
|
|
35810
35661
|
CheckboxState2[CheckboxState2["SELECTED"] = 0] = "SELECTED";
|
|
@@ -36441,7 +36292,7 @@ var ListboxTextInput = ({
|
|
|
36441
36292
|
import React8, {
|
|
36442
36293
|
useContext as useContext11,
|
|
36443
36294
|
useMemo as useMemo11,
|
|
36444
|
-
useRef as
|
|
36295
|
+
useRef as useRef9,
|
|
36445
36296
|
useState as useState14
|
|
36446
36297
|
} from "react";
|
|
36447
36298
|
import { jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
@@ -36458,8 +36309,8 @@ function QuillSelectComponentWithCombo({
|
|
|
36458
36309
|
}) {
|
|
36459
36310
|
const [theme] = useContext11(ThemeContext);
|
|
36460
36311
|
const [showModal, setShowModal] = useState14(false);
|
|
36461
|
-
const modalRef =
|
|
36462
|
-
const buttonRef =
|
|
36312
|
+
const modalRef = useRef9(null);
|
|
36313
|
+
const buttonRef = useRef9(null);
|
|
36463
36314
|
const [searchQuery, setSearchQuery] = React8.useState("");
|
|
36464
36315
|
const filteredItems = React8.useMemo(() => {
|
|
36465
36316
|
if (searchQuery === "") {
|
|
@@ -37416,7 +37267,7 @@ var MetricDisplay = ({
|
|
|
37416
37267
|
};
|
|
37417
37268
|
|
|
37418
37269
|
// src/components/Dashboard/DataLoader.tsx
|
|
37419
|
-
import { useContext as useContext13, useEffect as useEffect12, useMemo as useMemo13, useRef as
|
|
37270
|
+
import { useContext as useContext13, useEffect as useEffect12, useMemo as useMemo13, useRef as useRef10, useState as useState15 } from "react";
|
|
37420
37271
|
init_paginationProcessing();
|
|
37421
37272
|
init_tableProcessing();
|
|
37422
37273
|
import equal2 from "fast-deep-equal";
|
|
@@ -37556,17 +37407,17 @@ function DataLoader({
|
|
|
37556
37407
|
reportFilters,
|
|
37557
37408
|
dashboardFilters
|
|
37558
37409
|
]);
|
|
37559
|
-
const previousFilters =
|
|
37560
|
-
const previousUserFilters =
|
|
37561
|
-
const previousTenants =
|
|
37562
|
-
const previousCustomFields =
|
|
37410
|
+
const previousFilters = useRef10(filters);
|
|
37411
|
+
const previousUserFilters = useRef10(userFilters);
|
|
37412
|
+
const previousTenants = useRef10(tenants);
|
|
37413
|
+
const previousCustomFields = useRef10(schemaData.customFields);
|
|
37563
37414
|
const [rowCountIsLoading, setRowCountIsLoading] = useState15(false);
|
|
37564
|
-
const rowsRequestId =
|
|
37565
|
-
const rowsAbortController =
|
|
37566
|
-
const rowCountRequestId =
|
|
37567
|
-
const rowCountAbortController =
|
|
37568
|
-
const updateTableRowsRequestId =
|
|
37569
|
-
const updateTableRowsAbortController =
|
|
37415
|
+
const rowsRequestId = useRef10(0);
|
|
37416
|
+
const rowsAbortController = useRef10(null);
|
|
37417
|
+
const rowCountRequestId = useRef10(0);
|
|
37418
|
+
const rowCountAbortController = useRef10(null);
|
|
37419
|
+
const updateTableRowsRequestId = useRef10(0);
|
|
37420
|
+
const updateTableRowsAbortController = useRef10(null);
|
|
37570
37421
|
const fetchRowCount = async (processing) => {
|
|
37571
37422
|
if (!client || !filters) {
|
|
37572
37423
|
if (!rowCountAbortController.current) return;
|
|
@@ -37966,13 +37817,13 @@ var ChartDataLoader = ({
|
|
|
37966
37817
|
const [error, setError] = useState15(void 0);
|
|
37967
37818
|
const [client] = useContext13(ClientContext);
|
|
37968
37819
|
const [schemaData] = useContext13(SchemaDataContext);
|
|
37969
|
-
const previousFilters =
|
|
37970
|
-
const previousUserFilters =
|
|
37971
|
-
const previousDateBucket =
|
|
37972
|
-
const previousTenants =
|
|
37973
|
-
const previousCustomFields =
|
|
37974
|
-
const fetchReportAbortController =
|
|
37975
|
-
const rowsRequestId =
|
|
37820
|
+
const previousFilters = useRef10(filters);
|
|
37821
|
+
const previousUserFilters = useRef10(userFilters);
|
|
37822
|
+
const previousDateBucket = useRef10(dateBucket);
|
|
37823
|
+
const previousTenants = useRef10(tenants);
|
|
37824
|
+
const previousCustomFields = useRef10(schemaData.customFields);
|
|
37825
|
+
const fetchReportAbortController = useRef10(null);
|
|
37826
|
+
const rowsRequestId = useRef10(0);
|
|
37976
37827
|
const chartReport = useMemo13(() => {
|
|
37977
37828
|
const report = dashboardName ? dashboard[item.id] : reports[item.id];
|
|
37978
37829
|
if (!report) {
|
|
@@ -38247,7 +38098,7 @@ var useReportInternal = (reportId) => {
|
|
|
38247
38098
|
import equal3 from "fast-deep-equal";
|
|
38248
38099
|
|
|
38249
38100
|
// src/components/Chart/MapChart.tsx
|
|
38250
|
-
import { useEffect as useEffect13, useMemo as useMemo15, useRef as
|
|
38101
|
+
import { useEffect as useEffect13, useMemo as useMemo15, useRef as useRef11, useState as useState17 } from "react";
|
|
38251
38102
|
init_valueFormatter();
|
|
38252
38103
|
import usStates10m from "us-atlas/states-10m.json";
|
|
38253
38104
|
import worldCountries50m from "world-atlas/countries-50m.json";
|
|
@@ -38861,7 +38712,7 @@ function USMap({
|
|
|
38861
38712
|
containerStyle
|
|
38862
38713
|
}) {
|
|
38863
38714
|
const simpleMaps = useSimpleMapsModule();
|
|
38864
|
-
const containerRef =
|
|
38715
|
+
const containerRef = useRef11(null);
|
|
38865
38716
|
const [hoveredState, setHoveredState] = useState17(
|
|
38866
38717
|
void 0
|
|
38867
38718
|
);
|
|
@@ -39057,7 +38908,7 @@ function WorldMap({
|
|
|
39057
38908
|
containerStyle
|
|
39058
38909
|
}) {
|
|
39059
38910
|
const simpleMaps = useSimpleMapsModule();
|
|
39060
|
-
const containerRef =
|
|
38911
|
+
const containerRef = useRef11(null);
|
|
39061
38912
|
const [hoveredCountry, setHoveredCountry] = useState17(
|
|
39062
38913
|
void 0
|
|
39063
38914
|
);
|
|
@@ -39308,7 +39159,7 @@ function MapLayout({
|
|
|
39308
39159
|
}
|
|
39309
39160
|
|
|
39310
39161
|
// src/components/Chart/GaugeChart.tsx
|
|
39311
|
-
import { useEffect as useEffect14, useRef as
|
|
39162
|
+
import { useEffect as useEffect14, useRef as useRef12, useState as useState18 } from "react";
|
|
39312
39163
|
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
39313
39164
|
function GaugeChart({
|
|
39314
39165
|
data,
|
|
@@ -39340,15 +39191,15 @@ function D3Gauge({
|
|
|
39340
39191
|
colors,
|
|
39341
39192
|
isAnimationActive
|
|
39342
39193
|
}) {
|
|
39343
|
-
const containerRef =
|
|
39344
|
-
const svgRef =
|
|
39345
|
-
const gaugeGroupRef =
|
|
39346
|
-
const needleRef =
|
|
39347
|
-
const needleOutlineRef =
|
|
39348
|
-
const textRef =
|
|
39349
|
-
const animationFrameRef =
|
|
39350
|
-
const previousPercentageRef =
|
|
39351
|
-
const firstMountRef =
|
|
39194
|
+
const containerRef = useRef12(null);
|
|
39195
|
+
const svgRef = useRef12(null);
|
|
39196
|
+
const gaugeGroupRef = useRef12(null);
|
|
39197
|
+
const needleRef = useRef12(null);
|
|
39198
|
+
const needleOutlineRef = useRef12(null);
|
|
39199
|
+
const textRef = useRef12(null);
|
|
39200
|
+
const animationFrameRef = useRef12(null);
|
|
39201
|
+
const previousPercentageRef = useRef12(0);
|
|
39202
|
+
const firstMountRef = useRef12(true);
|
|
39352
39203
|
const startAngle = -(3 * Math.PI) / 4;
|
|
39353
39204
|
const totalAngle = 3 * Math.PI / 2;
|
|
39354
39205
|
const [arc, setArc] = useState18(null);
|
|
@@ -39885,7 +39736,7 @@ function Chart({
|
|
|
39885
39736
|
filters,
|
|
39886
39737
|
dashboardCustomFilters[allReportsById[reportId]?.dashboardName ?? ""]
|
|
39887
39738
|
]);
|
|
39888
|
-
const previousFilters =
|
|
39739
|
+
const previousFilters = useRef13(void 0);
|
|
39889
39740
|
if (!equal3(previousFilters.current, filters)) {
|
|
39890
39741
|
previousFilters.current = filters;
|
|
39891
39742
|
}
|
|
@@ -40944,7 +40795,7 @@ import {
|
|
|
40944
40795
|
useContext as useContext20,
|
|
40945
40796
|
useEffect as useEffect17,
|
|
40946
40797
|
useMemo as useMemo17,
|
|
40947
|
-
useRef as
|
|
40798
|
+
useRef as useRef14,
|
|
40948
40799
|
useState as useState22
|
|
40949
40800
|
} from "react";
|
|
40950
40801
|
init_util();
|
|
@@ -41443,7 +41294,7 @@ var FilterPopoverWrapper = ({
|
|
|
41443
41294
|
const [isOpen, setIsOpen] = useState22(false);
|
|
41444
41295
|
const [uniqueValues, setUniqueValues] = useState22(void 0);
|
|
41445
41296
|
const [uniqueValuesIsLoading, setUniqueValuesIsLoading] = useState22(false);
|
|
41446
|
-
const prevFiltersRef =
|
|
41297
|
+
const prevFiltersRef = useRef14("");
|
|
41447
41298
|
const columnInternals = useMemo17(() => {
|
|
41448
41299
|
if (!tables) {
|
|
41449
41300
|
return null;
|
|
@@ -42702,7 +42553,7 @@ function DashboardLegacy({
|
|
|
42702
42553
|
});
|
|
42703
42554
|
return map;
|
|
42704
42555
|
}, [data?.sections, data?.sectionOrder]);
|
|
42705
|
-
const mounted =
|
|
42556
|
+
const mounted = useRef15(false);
|
|
42706
42557
|
useEffect19(() => {
|
|
42707
42558
|
if (!mounted.current) {
|
|
42708
42559
|
mounted.current = true;
|
|
@@ -42744,16 +42595,16 @@ function DashboardLegacy({
|
|
|
42744
42595
|
) : defaultOptionsV2;
|
|
42745
42596
|
}, [populatedDashboardFilters]);
|
|
42746
42597
|
const [filterValues, setFilterValues] = useState26({});
|
|
42747
|
-
const prevNameRef =
|
|
42748
|
-
const prevFlagsRef =
|
|
42749
|
-
const prevClientRef =
|
|
42750
|
-
const addFilterPopoverButtonRef =
|
|
42751
|
-
const viewFiltersPopoverButtonRef =
|
|
42752
|
-
const previousFilters =
|
|
42598
|
+
const prevNameRef = useRef15(name2);
|
|
42599
|
+
const prevFlagsRef = useRef15(flags);
|
|
42600
|
+
const prevClientRef = useRef15(client?.id ?? "");
|
|
42601
|
+
const addFilterPopoverButtonRef = useRef15(null);
|
|
42602
|
+
const viewFiltersPopoverButtonRef = useRef15(null);
|
|
42603
|
+
const previousFilters = useRef15(filters);
|
|
42753
42604
|
if (!equal4(previousFilters.current, filters)) {
|
|
42754
42605
|
previousFilters.current = filters;
|
|
42755
42606
|
}
|
|
42756
|
-
const isInitialLoadOfDashboardRef =
|
|
42607
|
+
const isInitialLoadOfDashboardRef = useRef15(false);
|
|
42757
42608
|
const referencedTables = useMemo19(() => {
|
|
42758
42609
|
const sections = data?.sections || {};
|
|
42759
42610
|
const tables2 = Object.values(sections).flatMap(
|
|
@@ -42781,7 +42632,7 @@ function DashboardLegacy({
|
|
|
42781
42632
|
prevFlagsRef.current = flags;
|
|
42782
42633
|
});
|
|
42783
42634
|
}, [name2, isClientLoading]);
|
|
42784
|
-
const tenantMounted =
|
|
42635
|
+
const tenantMounted = useRef15(false);
|
|
42785
42636
|
useEffect19(() => {
|
|
42786
42637
|
if (!tenantMounted.current) {
|
|
42787
42638
|
tenantMounted.current = true;
|
|
@@ -44810,7 +44661,7 @@ import {
|
|
|
44810
44661
|
useState as useState33,
|
|
44811
44662
|
useContext as useContext30,
|
|
44812
44663
|
useEffect as useEffect25,
|
|
44813
|
-
useRef as
|
|
44664
|
+
useRef as useRef20,
|
|
44814
44665
|
useMemo as useMemo27,
|
|
44815
44666
|
useCallback as useCallback4
|
|
44816
44667
|
} from "react";
|
|
@@ -44819,7 +44670,7 @@ import MonacoEditor from "@monaco-editor/react";
|
|
|
44819
44670
|
// src/ChartBuilder.tsx
|
|
44820
44671
|
import {
|
|
44821
44672
|
useEffect as useEffect23,
|
|
44822
|
-
useRef as
|
|
44673
|
+
useRef as useRef19,
|
|
44823
44674
|
useState as useState31,
|
|
44824
44675
|
useContext as useContext28,
|
|
44825
44676
|
useMemo as useMemo26,
|
|
@@ -44849,7 +44700,7 @@ import {
|
|
|
44849
44700
|
useMemo as useMemo23,
|
|
44850
44701
|
useState as useState28,
|
|
44851
44702
|
useEffect as useEffect21,
|
|
44852
|
-
useRef as
|
|
44703
|
+
useRef as useRef16
|
|
44853
44704
|
} from "react";
|
|
44854
44705
|
|
|
44855
44706
|
// src/internals/ReportBuilder/PivotList.tsx
|
|
@@ -45324,8 +45175,8 @@ var PivotModal = ({
|
|
|
45324
45175
|
const [schemaData] = useContext25(SchemaDataContext);
|
|
45325
45176
|
const { tenants } = useContext25(TenantContext);
|
|
45326
45177
|
const { eventTracking } = useContext25(EventTrackingContext);
|
|
45327
|
-
const rowFieldRef =
|
|
45328
|
-
const colFieldRef =
|
|
45178
|
+
const rowFieldRef = useRef16(null);
|
|
45179
|
+
const colFieldRef = useRef16(null);
|
|
45329
45180
|
const [pivotCardWidth, setPivotCardWidth] = useState28(420);
|
|
45330
45181
|
const [samplePivotTable, setSamplePivotTable] = useState28(null);
|
|
45331
45182
|
const [hasNoRecommendedPivots, sethasNoRecommendedPivots] = useState28(false);
|
|
@@ -45334,7 +45185,7 @@ var PivotModal = ({
|
|
|
45334
45185
|
const [allowedRowFields, setAllowedRowFields] = useState28([]);
|
|
45335
45186
|
const [allowedValueFields, setAllowedValueFields] = useState28([]);
|
|
45336
45187
|
const [uniqueValues, setUniqueValues] = useState28(initialUniqueValues);
|
|
45337
|
-
const buttonRef =
|
|
45188
|
+
const buttonRef = useRef16(null);
|
|
45338
45189
|
const [dateRanges, setDateRanges] = useState28({});
|
|
45339
45190
|
const [pivotError, setPivotError] = useState28("");
|
|
45340
45191
|
const [limitInput, setLimitInput] = useState28(
|
|
@@ -45353,7 +45204,7 @@ var PivotModal = ({
|
|
|
45353
45204
|
const [popoverPosition, setPopoverPosition] = useState28(
|
|
45354
45205
|
"bottom"
|
|
45355
45206
|
);
|
|
45356
|
-
const popoverRef =
|
|
45207
|
+
const popoverRef = useRef16(null);
|
|
45357
45208
|
const columnsToShow = useMemo23(() => {
|
|
45358
45209
|
return (columns || []).reduce((map, col) => {
|
|
45359
45210
|
map[col.field] = col.format;
|
|
@@ -45682,7 +45533,7 @@ var PivotModal = ({
|
|
|
45682
45533
|
};
|
|
45683
45534
|
fetchPivotTables();
|
|
45684
45535
|
}, [selectedPivotIndex, data, dateRange, createdPivots]);
|
|
45685
|
-
const previousUniqueValuesRef =
|
|
45536
|
+
const previousUniqueValuesRef = useRef16();
|
|
45686
45537
|
useEffect21(() => {
|
|
45687
45538
|
if (!uniqueValuesIsLoading && !equal5(uniqueValues, previousUniqueValuesRef.current)) {
|
|
45688
45539
|
previousUniqueValuesRef.current = uniqueValues;
|
|
@@ -47094,7 +46945,7 @@ import {
|
|
|
47094
46945
|
useEffect as useEffect22,
|
|
47095
46946
|
useContext as useContext26,
|
|
47096
46947
|
useMemo as useMemo24,
|
|
47097
|
-
useRef as
|
|
46948
|
+
useRef as useRef17,
|
|
47098
46949
|
useLayoutEffect as useLayoutEffect3
|
|
47099
46950
|
} from "react";
|
|
47100
46951
|
import { differenceInHours as differenceInHours2 } from "date-fns";
|
|
@@ -47216,7 +47067,7 @@ function InternalChart({
|
|
|
47216
47067
|
const { dashboardConfig } = useContext26(DashboardConfigContext);
|
|
47217
47068
|
const { eventTracking } = useContext26(EventTrackingContext);
|
|
47218
47069
|
const [filtersPopoverOpen, setFiltersPopoverOpen] = useState29(false);
|
|
47219
|
-
const filtersButtonRef =
|
|
47070
|
+
const filtersButtonRef = useRef17(null);
|
|
47220
47071
|
const currentReportFilters = useMemo24(() => {
|
|
47221
47072
|
const dashFilters = dashboardConfig[report?.dashboardName ?? ""]?.config.filters;
|
|
47222
47073
|
if (!dashFilters)
|
|
@@ -47245,8 +47096,8 @@ function InternalChart({
|
|
|
47245
47096
|
) : defaultOptionsV2;
|
|
47246
47097
|
}, [reportDateFilter]);
|
|
47247
47098
|
const [filterValues, setFilterValues] = useState29({});
|
|
47248
|
-
const multiselectDebounceRef =
|
|
47249
|
-
const latestMultiselectValueRef =
|
|
47099
|
+
const multiselectDebounceRef = useRef17({});
|
|
47100
|
+
const latestMultiselectValueRef = useRef17({});
|
|
47250
47101
|
const [lockedFilters, setLockedFilters] = useState29(
|
|
47251
47102
|
{}
|
|
47252
47103
|
);
|
|
@@ -47408,7 +47259,7 @@ function InternalChart({
|
|
|
47408
47259
|
onDashboardFilterChange(filter.label, filterValue);
|
|
47409
47260
|
};
|
|
47410
47261
|
const [filtersExpanded, setFiltersExpanded] = useState29(false);
|
|
47411
|
-
const filtersContainerRef =
|
|
47262
|
+
const filtersContainerRef = useRef17(null);
|
|
47412
47263
|
const [visibleFilters, setVisibleFilters] = useState29([]);
|
|
47413
47264
|
const filtersOverflowing = useMemo24(() => {
|
|
47414
47265
|
return visibleFilters.some((visible) => visible);
|
|
@@ -47674,7 +47525,7 @@ init_dates();
|
|
|
47674
47525
|
import React16, {
|
|
47675
47526
|
useContext as useContext27,
|
|
47676
47527
|
useMemo as useMemo25,
|
|
47677
|
-
useRef as
|
|
47528
|
+
useRef as useRef18,
|
|
47678
47529
|
useState as useState30
|
|
47679
47530
|
} from "react";
|
|
47680
47531
|
import { Fragment as Fragment12, jsx as jsx68, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
@@ -47694,9 +47545,9 @@ function QuillMultiSelectSectionList({
|
|
|
47694
47545
|
}) {
|
|
47695
47546
|
const [theme] = useContext27(ThemeContext);
|
|
47696
47547
|
const [showModal, setShowModal] = useState30(false);
|
|
47697
|
-
const modalRef =
|
|
47698
|
-
const buttonRef =
|
|
47699
|
-
const debounceTimeoutId =
|
|
47548
|
+
const modalRef = useRef18(null);
|
|
47549
|
+
const buttonRef = useRef18(null);
|
|
47550
|
+
const debounceTimeoutId = useRef18(null);
|
|
47700
47551
|
const [searchQuery, setSearchQuery] = React16.useState("");
|
|
47701
47552
|
useOnClickOutside_default(
|
|
47702
47553
|
modalRef,
|
|
@@ -48483,7 +48334,7 @@ function createReportFromForm(formData, report, eventTracking, selectedPivotTabl
|
|
|
48483
48334
|
return newReport;
|
|
48484
48335
|
}
|
|
48485
48336
|
function ChartBuilderWithModal(props) {
|
|
48486
|
-
const parentRef =
|
|
48337
|
+
const parentRef = useRef19(null);
|
|
48487
48338
|
const [modalWidth, setModalWidth] = useState31(200);
|
|
48488
48339
|
const [modalHeight, setModalHeight] = useState31(200);
|
|
48489
48340
|
const { isOpen, setIsOpen, title, isHorizontalView } = props;
|
|
@@ -48650,8 +48501,8 @@ function ChartBuilder({
|
|
|
48650
48501
|
const MIN_FORM_WIDTH = 700;
|
|
48651
48502
|
const [pivotCardWidth, setPivotCardWidth] = useState31(MIN_FORM_WIDTH);
|
|
48652
48503
|
const [formWidth, setFormWidth] = useState31(MIN_FORM_WIDTH);
|
|
48653
|
-
const inputRef =
|
|
48654
|
-
const selectRef =
|
|
48504
|
+
const inputRef = useRef19(null);
|
|
48505
|
+
const selectRef = useRef19(null);
|
|
48655
48506
|
const processColumns = (columns2) => {
|
|
48656
48507
|
if (schemaData.schemaWithCustomFields) {
|
|
48657
48508
|
const newProcessedColumns = columns2?.map((col) => {
|
|
@@ -48710,8 +48561,8 @@ function ChartBuilder({
|
|
|
48710
48561
|
processColumns(report?.columnInternal ?? [])
|
|
48711
48562
|
);
|
|
48712
48563
|
const [currentPage, setCurrentPage] = useState31(0);
|
|
48713
|
-
const parentRef =
|
|
48714
|
-
const deleteRef =
|
|
48564
|
+
const parentRef = useRef19(null);
|
|
48565
|
+
const deleteRef = useRef19(null);
|
|
48715
48566
|
const modalPadding = 20;
|
|
48716
48567
|
const deleteButtonMargin = -12;
|
|
48717
48568
|
const { dashboardFilters } = useContext28(DashboardFiltersContext);
|
|
@@ -48764,7 +48615,7 @@ function ChartBuilder({
|
|
|
48764
48615
|
abortLoadingFilters
|
|
48765
48616
|
} = useContext28(ReportFiltersContext);
|
|
48766
48617
|
const { reportsDispatch } = useContext28(ReportsContext);
|
|
48767
|
-
const initialFilters =
|
|
48618
|
+
const initialFilters = useRef19(reportFilters[report?.id ?? TEMP_REPORT_ID]);
|
|
48768
48619
|
const [reportFiltersLoaded, setReportFiltersLoaded] = useState31(!filtersEnabled);
|
|
48769
48620
|
const hasExistingData = useMemo26(() => {
|
|
48770
48621
|
return report?.rows && report.rows.length > 0 || report?.pivotRows && report.pivotRows.length > 0;
|
|
@@ -49058,7 +48909,7 @@ function ChartBuilder({
|
|
|
49058
48909
|
};
|
|
49059
48910
|
}
|
|
49060
48911
|
};
|
|
49061
|
-
const initializedRef =
|
|
48912
|
+
const initializedRef = useRef19(false);
|
|
49062
48913
|
const getCurrentSection = () => {
|
|
49063
48914
|
let id = report?.id ?? "";
|
|
49064
48915
|
if (id === "" || id === TEMP_REPORT_ID) {
|
|
@@ -49387,7 +49238,7 @@ function ChartBuilder({
|
|
|
49387
49238
|
}));
|
|
49388
49239
|
}
|
|
49389
49240
|
}, [report?.triggerReload, report?.columns, formData.columns.length]);
|
|
49390
|
-
const ranMountQuery =
|
|
49241
|
+
const ranMountQuery = useRef19(false);
|
|
49391
49242
|
useEffect23(() => {
|
|
49392
49243
|
if (runQueryOnMount && reportFiltersLoaded && filtersEnabled && !ranMountQuery.current) {
|
|
49393
49244
|
ranMountQuery.current = true;
|
|
@@ -49624,7 +49475,7 @@ function ChartBuilder({
|
|
|
49624
49475
|
return handleRunQuery(baseProcessing, updatedFilters);
|
|
49625
49476
|
});
|
|
49626
49477
|
};
|
|
49627
|
-
const filtersEnabledRef =
|
|
49478
|
+
const filtersEnabledRef = useRef19(filtersEnabled);
|
|
49628
49479
|
useEffect23(() => {
|
|
49629
49480
|
if (filtersEnabledRef.current !== filtersEnabled) {
|
|
49630
49481
|
filtersEnabledRef.current = filtersEnabled;
|
|
@@ -52629,7 +52480,7 @@ function SQLEditor({
|
|
|
52629
52480
|
}) {
|
|
52630
52481
|
const computedButtonLabel = addToDashboardButtonLabel === "Add to dashboard" ? reportId || report?.id ? "Save changes" : "Add to dashboard" : addToDashboardButtonLabel;
|
|
52631
52482
|
const [sqlPrompt, setSqlPrompt] = useState33("");
|
|
52632
|
-
const sqlPromptFormRef =
|
|
52483
|
+
const sqlPromptFormRef = useRef20(null);
|
|
52633
52484
|
const sqlPromptInputWidth = useResponsiveFirstChildWidth_default(sqlPromptFormRef, {
|
|
52634
52485
|
gap: 12,
|
|
52635
52486
|
initialWidth: 320,
|
|
@@ -52689,7 +52540,7 @@ function SQLEditor({
|
|
|
52689
52540
|
};
|
|
52690
52541
|
return initial;
|
|
52691
52542
|
});
|
|
52692
|
-
const tableRef =
|
|
52543
|
+
const tableRef = useRef20(null);
|
|
52693
52544
|
const [cachedHeight, setCachedHeight] = useState33(0);
|
|
52694
52545
|
const DEFAULT_ROWS_PER_PAGE = 5;
|
|
52695
52546
|
const ROW_HEIGHT = 37;
|
|
@@ -53691,7 +53542,7 @@ var SQLEditorComponent = ({
|
|
|
53691
53542
|
}) => {
|
|
53692
53543
|
const [editorKey, setEditorKey] = useState33(0);
|
|
53693
53544
|
const { eventTracking } = useContext30(EventTrackingContext);
|
|
53694
|
-
const currentProvider =
|
|
53545
|
+
const currentProvider = useRef20(null);
|
|
53695
53546
|
useEffect25(() => {
|
|
53696
53547
|
if (currentProvider.current) {
|
|
53697
53548
|
currentProvider.current.dispose();
|
|
@@ -54163,7 +54014,7 @@ function SchemaItem({
|
|
|
54163
54014
|
import {
|
|
54164
54015
|
useContext as useContext34,
|
|
54165
54016
|
useEffect as useEffect29,
|
|
54166
|
-
useRef as
|
|
54017
|
+
useRef as useRef22,
|
|
54167
54018
|
useState as useState39
|
|
54168
54019
|
} from "react";
|
|
54169
54020
|
init_constants();
|
|
@@ -55699,7 +55550,7 @@ var useReportBuilder = ({
|
|
|
55699
55550
|
init_ReportBuilder();
|
|
55700
55551
|
|
|
55701
55552
|
// src/components/ReportBuilder/AddColumnModal.tsx
|
|
55702
|
-
import { useState as useState35, useRef as
|
|
55553
|
+
import { useState as useState35, useRef as useRef21, useMemo as useMemo29, useEffect as useEffect27, useContext as useContext32 } from "react";
|
|
55703
55554
|
import {
|
|
55704
55555
|
DndContext as DndContext2,
|
|
55705
55556
|
closestCenter as closestCenter2,
|
|
@@ -55740,7 +55591,7 @@ function AddColumnModal({
|
|
|
55740
55591
|
const [theme] = useContext32(ThemeContext);
|
|
55741
55592
|
const [search, setSearch] = useState35("");
|
|
55742
55593
|
const [initialLoad, setInitialLoad] = useState35(true);
|
|
55743
|
-
const textInputContainerRef =
|
|
55594
|
+
const textInputContainerRef = useRef21(null);
|
|
55744
55595
|
const [modalSelectedColumns, setModalSelectedColumns] = useState35(
|
|
55745
55596
|
selectedColumns.map((col) => `${col.table}.${col.field}`)
|
|
55746
55597
|
);
|
|
@@ -58194,8 +58045,8 @@ function ReportBuilder({
|
|
|
58194
58045
|
const [theme] = useContext34(ThemeContext);
|
|
58195
58046
|
const [client] = useContext34(ClientContext);
|
|
58196
58047
|
const { getToken } = useContext34(FetchContext);
|
|
58197
|
-
const parentRef =
|
|
58198
|
-
const askAIFormRef =
|
|
58048
|
+
const parentRef = useRef22(null);
|
|
58049
|
+
const askAIFormRef = useRef22(null);
|
|
58199
58050
|
const [isCopying, setIsCopying] = useState39(false);
|
|
58200
58051
|
const [isChartBuilderOpen, setIsChartBuilderOpen] = useState39(false);
|
|
58201
58052
|
const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = useState39(false);
|
|
@@ -58702,7 +58553,7 @@ import {
|
|
|
58702
58553
|
useContext as useContext35,
|
|
58703
58554
|
useEffect as useEffect30,
|
|
58704
58555
|
useMemo as useMemo31,
|
|
58705
|
-
useRef as
|
|
58556
|
+
useRef as useRef23,
|
|
58706
58557
|
useState as useState40
|
|
58707
58558
|
} from "react";
|
|
58708
58559
|
import { jsx as jsx86 } from "react/jsx-runtime";
|
|
@@ -58751,7 +58602,7 @@ function ChartEditor({
|
|
|
58751
58602
|
onClickChartElement,
|
|
58752
58603
|
onClickChartError
|
|
58753
58604
|
}) {
|
|
58754
|
-
const parentRef =
|
|
58605
|
+
const parentRef = useRef23(null);
|
|
58755
58606
|
const [modalWidth, setModalWidth] = useState40(200);
|
|
58756
58607
|
const [modalHeight, setModalHeight] = useState40(200);
|
|
58757
58608
|
const { allReportsById } = useAllReports();
|
|
@@ -58929,7 +58780,7 @@ function ChartEditor({
|
|
|
58929
58780
|
}
|
|
58930
58781
|
|
|
58931
58782
|
// src/Chat.tsx
|
|
58932
|
-
import { useContext as useContext37, useEffect as useEffect32, useRef as
|
|
58783
|
+
import { useContext as useContext37, useEffect as useEffect32, useRef as useRef25, useState as useState42 } from "react";
|
|
58933
58784
|
|
|
58934
58785
|
// src/ChatChartCard.tsx
|
|
58935
58786
|
import { useMemo as useMemo33 } from "react";
|
|
@@ -58944,7 +58795,7 @@ import {
|
|
|
58944
58795
|
useLayoutEffect as useLayoutEffect4,
|
|
58945
58796
|
useMemo as useMemo32,
|
|
58946
58797
|
useReducer as useReducer2,
|
|
58947
|
-
useRef as
|
|
58798
|
+
useRef as useRef24,
|
|
58948
58799
|
useState as useState41
|
|
58949
58800
|
} from "react";
|
|
58950
58801
|
import { keepPreviousData, useQuery } from "@tanstack/react-query";
|
|
@@ -60131,6 +59982,37 @@ function useFormReducer(state, action) {
|
|
|
60131
59982
|
}
|
|
60132
59983
|
}
|
|
60133
59984
|
|
|
59985
|
+
// src/utils/pivotDateBuckets.ts
|
|
59986
|
+
import {
|
|
59987
|
+
eachDayOfInterval as eachDayOfInterval3,
|
|
59988
|
+
eachMonthOfInterval as eachMonthOfInterval2,
|
|
59989
|
+
eachWeekOfInterval as eachWeekOfInterval2,
|
|
59990
|
+
eachYearOfInterval as eachYearOfInterval2
|
|
59991
|
+
} from "date-fns";
|
|
59992
|
+
function buildPivotDateBucketStarts(range, bucket) {
|
|
59993
|
+
const min2 = new Date(range.min);
|
|
59994
|
+
const max2 = new Date(range.max);
|
|
59995
|
+
if (Number.isNaN(min2.getTime()) || Number.isNaN(max2.getTime())) return [];
|
|
59996
|
+
const start = min2 <= max2 ? min2 : max2;
|
|
59997
|
+
const end = min2 <= max2 ? max2 : min2;
|
|
59998
|
+
const asLocalCalendarDate = (date) => new Date(
|
|
59999
|
+
date.getUTCFullYear(),
|
|
60000
|
+
date.getUTCMonth(),
|
|
60001
|
+
date.getUTCDate(),
|
|
60002
|
+
12
|
|
60003
|
+
);
|
|
60004
|
+
const interval = {
|
|
60005
|
+
start: asLocalCalendarDate(start),
|
|
60006
|
+
end: asLocalCalendarDate(end)
|
|
60007
|
+
};
|
|
60008
|
+
const dates = bucket === "day" ? eachDayOfInterval3(interval) : bucket === "week" ? eachWeekOfInterval2(interval, { weekStartsOn: 1 }) : bucket === "year" ? eachYearOfInterval2(interval) : eachMonthOfInterval2(interval);
|
|
60009
|
+
return dates.map(
|
|
60010
|
+
(date) => new Date(
|
|
60011
|
+
Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())
|
|
60012
|
+
).toISOString()
|
|
60013
|
+
);
|
|
60014
|
+
}
|
|
60015
|
+
|
|
60134
60016
|
// src/hooks/useForm.queries.ts
|
|
60135
60017
|
var QUERY_KEY_UNDEFINED = "__undefined__";
|
|
60136
60018
|
var QUERY_KEY_FUNCTION = "__function__";
|
|
@@ -60308,70 +60190,6 @@ var AXIS_FORMAT_OPTIONS = [
|
|
|
60308
60190
|
{ value: "MMM_dd_hh:mm_ap_pm", label: "date and time" },
|
|
60309
60191
|
{ value: "hh_ap_pm", label: "hour" }
|
|
60310
60192
|
];
|
|
60311
|
-
var USEFORM_FILTERS_DEBUG_FLAG = "__QUILL_DEBUG_USEFORM_FILTERS__";
|
|
60312
|
-
var USEFORM_REFRESH_DEBUG_FLAG = "__QUILL_DEBUG_USEFORM_REFRESH__";
|
|
60313
|
-
var USEFORM_PIVOT_SHAPE_DEBUG_FLAG = "__QUILL_DEBUG_USEFORM_PIVOT_SHAPE__";
|
|
60314
|
-
var USEFORM_TASK_DEBUG_FLAG = "__QUILL_DEBUG_USEFORM_TASKS__";
|
|
60315
|
-
var isUseFormFiltersDebugEnabled = () => {
|
|
60316
|
-
const globalValue = typeof globalThis !== "undefined" ? globalThis?.[USEFORM_FILTERS_DEBUG_FLAG] : void 0;
|
|
60317
|
-
if (globalValue === true) {
|
|
60318
|
-
return true;
|
|
60319
|
-
}
|
|
60320
|
-
if (typeof process !== "undefined" && typeof process.env !== "undefined") {
|
|
60321
|
-
const envValue = String(
|
|
60322
|
-
process?.env?.QUILL_DEBUG_USEFORM_FILTERS ?? ""
|
|
60323
|
-
).trim().toLowerCase();
|
|
60324
|
-
return envValue === "1" || envValue === "true";
|
|
60325
|
-
}
|
|
60326
|
-
return false;
|
|
60327
|
-
};
|
|
60328
|
-
var isUseFormRefreshDebugEnabled = () => {
|
|
60329
|
-
const globalValue = typeof globalThis !== "undefined" ? globalThis?.[USEFORM_REFRESH_DEBUG_FLAG] : void 0;
|
|
60330
|
-
if (globalValue === true) {
|
|
60331
|
-
return true;
|
|
60332
|
-
}
|
|
60333
|
-
if (typeof process !== "undefined" && typeof process.env !== "undefined") {
|
|
60334
|
-
const envValue = String(
|
|
60335
|
-
process?.env?.QUILL_DEBUG_USEFORM_REFRESH ?? ""
|
|
60336
|
-
).trim().toLowerCase();
|
|
60337
|
-
return envValue === "1" || envValue === "true";
|
|
60338
|
-
}
|
|
60339
|
-
return false;
|
|
60340
|
-
};
|
|
60341
|
-
var isUseFormTaskDebugEnabled = () => {
|
|
60342
|
-
const globalValue = typeof globalThis !== "undefined" ? globalThis?.[USEFORM_TASK_DEBUG_FLAG] : void 0;
|
|
60343
|
-
if (globalValue === true) {
|
|
60344
|
-
return true;
|
|
60345
|
-
}
|
|
60346
|
-
if (typeof process !== "undefined" && typeof process.env !== "undefined") {
|
|
60347
|
-
const envValue = String(
|
|
60348
|
-
process?.env?.QUILL_DEBUG_USEFORM_TASKS ?? ""
|
|
60349
|
-
).trim().toLowerCase();
|
|
60350
|
-
return envValue === "1" || envValue === "true";
|
|
60351
|
-
}
|
|
60352
|
-
return false;
|
|
60353
|
-
};
|
|
60354
|
-
var logUseFormTaskDebug = (label, payload) => {
|
|
60355
|
-
if (!isUseFormTaskDebugEnabled()) return;
|
|
60356
|
-
console.log(`[useReport][task] ${label}`, payload);
|
|
60357
|
-
};
|
|
60358
|
-
var isUseFormPivotShapeDebugEnabled = () => {
|
|
60359
|
-
const globalValue = typeof globalThis !== "undefined" ? globalThis?.[USEFORM_PIVOT_SHAPE_DEBUG_FLAG] : void 0;
|
|
60360
|
-
if (globalValue === true) {
|
|
60361
|
-
return true;
|
|
60362
|
-
}
|
|
60363
|
-
if (typeof process !== "undefined" && typeof process.env !== "undefined") {
|
|
60364
|
-
const envValue = String(
|
|
60365
|
-
process?.env?.QUILL_DEBUG_USEFORM_PIVOT_SHAPE ?? ""
|
|
60366
|
-
).trim().toLowerCase();
|
|
60367
|
-
return envValue === "1" || envValue === "true";
|
|
60368
|
-
}
|
|
60369
|
-
return false;
|
|
60370
|
-
};
|
|
60371
|
-
var logUseFormPivotShapeDebug = (label, payload) => {
|
|
60372
|
-
if (!isUseFormPivotShapeDebugEnabled()) return;
|
|
60373
|
-
console.log(`[useReport][pivot-shape] ${label}`, payload);
|
|
60374
|
-
};
|
|
60375
60193
|
var BOOLEAN_FILTER_VALUE_OPTIONS = [
|
|
60376
60194
|
{ name: "true", label: "True", value: "true" },
|
|
60377
60195
|
{ name: "false", label: "False", value: "false" }
|
|
@@ -61263,30 +61081,24 @@ function shouldUsePivotRowFieldAsXAxis(chartType, pivotRowField, rowColumnFormat
|
|
|
61263
61081
|
function normalizePivotChartForDisplay(chart) {
|
|
61264
61082
|
const swapPivotRowsForChartRows = Boolean(chart?.pivot) && Array.isArray(chart?.pivotRows) && chart.pivotRows.length > 0;
|
|
61265
61083
|
const syntheticAggregationOnlyRows = chart && !swapPivotRowsForChartRows ? buildSyntheticAggregationOnlyDisplayRows(chart) : null;
|
|
61084
|
+
const hasExplicitEmptyGroupedPivot = Boolean(
|
|
61085
|
+
String(chart?.pivot?.rowField ?? "").trim() || String(chart?.pivot?.columnField ?? "").trim()
|
|
61086
|
+
) && Array.isArray(chart?.pivotRows) && chart.pivotRows.length === 0;
|
|
61266
61087
|
const detailRowsAreNotPivotBuckets = Boolean(chart) && !swapPivotRowsForChartRows && !syntheticAggregationOnlyRows && chartDetailRowsMissingPivotRowBucket(chart);
|
|
61267
|
-
logUseFormPivotShapeDebug("normalizePivotChartForDisplay:gate", {
|
|
61268
|
-
hasPivot: Boolean(chart?.pivot),
|
|
61269
|
-
pivotRowField: chart?.pivot?.rowField,
|
|
61270
|
-
pivotRowsIsArray: Array.isArray(chart?.pivotRows),
|
|
61271
|
-
pivotRowsLength: Array.isArray(chart?.pivotRows) ? chart.pivotRows.length : null,
|
|
61272
|
-
incomingChartRowsLength: Array.isArray(chart?.rows) ? chart.rows.length : null,
|
|
61273
|
-
swapPivotRowsForChartRows
|
|
61274
|
-
});
|
|
61275
61088
|
const config = swapPivotRowsForChartRows ? {
|
|
61276
61089
|
...chart,
|
|
61277
61090
|
rows: chart.pivotRows
|
|
61278
61091
|
} : syntheticAggregationOnlyRows ? {
|
|
61279
61092
|
...chart,
|
|
61280
61093
|
rows: syntheticAggregationOnlyRows
|
|
61094
|
+
} : hasExplicitEmptyGroupedPivot ? {
|
|
61095
|
+
...chart,
|
|
61096
|
+
rows: []
|
|
61281
61097
|
} : detailRowsAreNotPivotBuckets ? {
|
|
61282
61098
|
...chart,
|
|
61283
61099
|
rows: []
|
|
61284
61100
|
} : chart;
|
|
61285
61101
|
if (!config) return config;
|
|
61286
|
-
logUseFormPivotShapeDebug("normalizePivotChartForDisplay:postGateRows", {
|
|
61287
|
-
effectiveRowsLength: Array.isArray(config.rows) ? config.rows.length : null,
|
|
61288
|
-
stillUsingDetailRows: Boolean(config.pivot) && !swapPivotRowsForChartRows && Array.isArray(config.rows) && config.rows.length > 0
|
|
61289
|
-
});
|
|
61290
61102
|
if (!config.pivot) return config;
|
|
61291
61103
|
const pivotRowFieldEarly = String(config.pivot?.rowField ?? "").trim();
|
|
61292
61104
|
const rowColumn = (config.pivotColumns ?? config.columns ?? []).find(
|
|
@@ -62929,9 +62741,6 @@ async function loadViaInMemoryEngines({
|
|
|
62929
62741
|
pivot,
|
|
62930
62742
|
reportBuilderState,
|
|
62931
62743
|
allowReportTaskBootstrap = false,
|
|
62932
|
-
debugSource,
|
|
62933
|
-
debugRunId,
|
|
62934
|
-
debugLoadRequestId,
|
|
62935
62744
|
draftSessionId
|
|
62936
62745
|
}) {
|
|
62937
62746
|
const requestedTask = allowReportTaskBootstrap ? "report" : "item";
|
|
@@ -62941,17 +62750,6 @@ async function loadViaInMemoryEngines({
|
|
|
62941
62750
|
rowsPerRequest: DEFAULT_USE_REPORT_ROWS_PER_REQUEST
|
|
62942
62751
|
}
|
|
62943
62752
|
} : {};
|
|
62944
|
-
logUseFormTaskDebug("dispatch fetchReport", {
|
|
62945
|
-
reportId,
|
|
62946
|
-
task: requestedTask,
|
|
62947
|
-
source: debugSource ?? "unknown",
|
|
62948
|
-
runId: debugRunId ?? null,
|
|
62949
|
-
loadRequestId: debugLoadRequestId ?? null,
|
|
62950
|
-
allowReportTaskBootstrap,
|
|
62951
|
-
filterCount: internalFilters.length,
|
|
62952
|
-
hasPivot: Boolean(pivot),
|
|
62953
|
-
hasReportBuilderState: Boolean(reportBuilderState)
|
|
62954
|
-
});
|
|
62955
62753
|
const { report, error } = await fetchReport({
|
|
62956
62754
|
reportId,
|
|
62957
62755
|
client,
|
|
@@ -63031,9 +62829,6 @@ async function loadViaPivotTemplate({
|
|
|
63031
62829
|
reportBuilderState,
|
|
63032
62830
|
baseReport,
|
|
63033
62831
|
schema,
|
|
63034
|
-
debugSource,
|
|
63035
|
-
debugRunId,
|
|
63036
|
-
debugLoadRequestId,
|
|
63037
62832
|
draftSessionId
|
|
63038
62833
|
}) {
|
|
63039
62834
|
const pivotForTemplate = enrichPivotRowFieldTypeForTemplate(
|
|
@@ -63041,16 +62836,6 @@ async function loadViaPivotTemplate({
|
|
|
63041
62836
|
schema,
|
|
63042
62837
|
baseReport
|
|
63043
62838
|
);
|
|
63044
|
-
logUseFormTaskDebug("dispatch fetchReport", {
|
|
63045
|
-
reportId,
|
|
63046
|
-
task: "pivot-template",
|
|
63047
|
-
source: debugSource ?? "unknown",
|
|
63048
|
-
runId: debugRunId ?? null,
|
|
63049
|
-
loadRequestId: debugLoadRequestId ?? null,
|
|
63050
|
-
filterCount: internalFilters.length,
|
|
63051
|
-
hasPivot: Boolean(pivotForTemplate),
|
|
63052
|
-
hasReportBuilderState: Boolean(reportBuilderState)
|
|
63053
|
-
});
|
|
63054
62839
|
const { report, error } = await fetchPivotTemplateReportForUseForm({
|
|
63055
62840
|
reportId,
|
|
63056
62841
|
client,
|
|
@@ -63278,19 +63063,8 @@ async function loadPivotTemplateInParallelWithReportTask({
|
|
|
63278
63063
|
customFields,
|
|
63279
63064
|
dashboardName,
|
|
63280
63065
|
pivotRefreshOnly = false,
|
|
63281
|
-
debugSource,
|
|
63282
|
-
debugRunId,
|
|
63283
|
-
debugLoadRequestId,
|
|
63284
63066
|
draftSessionId
|
|
63285
63067
|
}) {
|
|
63286
|
-
logUseFormTaskDebug("parallel loader route", {
|
|
63287
|
-
reportId,
|
|
63288
|
-
source: debugSource ?? "unknown",
|
|
63289
|
-
runId: debugRunId ?? null,
|
|
63290
|
-
loadRequestId: debugLoadRequestId ?? null,
|
|
63291
|
-
pivotRefreshOnly,
|
|
63292
|
-
tasks: pivotRefreshOnly ? ["pivot-template"] : ["report", "pivot-template", "report-builder-state"]
|
|
63293
|
-
});
|
|
63294
63068
|
if (pivotRefreshOnly) {
|
|
63295
63069
|
const pivotOnlyResult = await loadViaPivotTemplate({
|
|
63296
63070
|
reportId,
|
|
@@ -63303,9 +63077,6 @@ async function loadPivotTemplateInParallelWithReportTask({
|
|
|
63303
63077
|
reportBuilderState,
|
|
63304
63078
|
baseReport,
|
|
63305
63079
|
schema,
|
|
63306
|
-
debugSource,
|
|
63307
|
-
debugRunId,
|
|
63308
|
-
debugLoadRequestId,
|
|
63309
63080
|
draftSessionId
|
|
63310
63081
|
});
|
|
63311
63082
|
return pivotOnlyResult;
|
|
@@ -63321,9 +63092,6 @@ async function loadPivotTemplateInParallelWithReportTask({
|
|
|
63321
63092
|
pivot,
|
|
63322
63093
|
reportBuilderState,
|
|
63323
63094
|
allowReportTaskBootstrap: true,
|
|
63324
|
-
debugSource,
|
|
63325
|
-
debugRunId,
|
|
63326
|
-
debugLoadRequestId,
|
|
63327
63095
|
draftSessionId
|
|
63328
63096
|
}),
|
|
63329
63097
|
loadViaPivotTemplate({
|
|
@@ -63337,9 +63105,6 @@ async function loadPivotTemplateInParallelWithReportTask({
|
|
|
63337
63105
|
reportBuilderState,
|
|
63338
63106
|
baseReport,
|
|
63339
63107
|
schema,
|
|
63340
|
-
debugSource,
|
|
63341
|
-
debugRunId,
|
|
63342
|
-
debugLoadRequestId,
|
|
63343
63108
|
draftSessionId
|
|
63344
63109
|
}),
|
|
63345
63110
|
fetchReportBuilderStateByReportId({
|
|
@@ -63522,9 +63287,6 @@ async function loadReportForUseForm({
|
|
|
63522
63287
|
customFields,
|
|
63523
63288
|
dashboardName,
|
|
63524
63289
|
useInMemoryEngines,
|
|
63525
|
-
debugSource,
|
|
63526
|
-
debugRunId,
|
|
63527
|
-
debugLoadRequestId,
|
|
63528
63290
|
draftSessionId
|
|
63529
63291
|
}) {
|
|
63530
63292
|
const effectivePivot = pivot ?? initialReportBuilderState?.pivot ?? void 0;
|
|
@@ -63533,18 +63295,6 @@ async function loadReportForUseForm({
|
|
|
63533
63295
|
...initialReportBuilderState,
|
|
63534
63296
|
pivot: effectivePivot ?? initialReportBuilderState.pivot ?? null
|
|
63535
63297
|
} : void 0;
|
|
63536
|
-
logUseFormTaskDebug("resolve loader route", {
|
|
63537
|
-
reportId,
|
|
63538
|
-
source: debugSource ?? "unknown",
|
|
63539
|
-
runId: debugRunId ?? null,
|
|
63540
|
-
loadRequestId: debugLoadRequestId ?? null,
|
|
63541
|
-
hasPivot,
|
|
63542
|
-
hasReportBuilderState: Boolean(reportBuilderStateForLoad),
|
|
63543
|
-
allowReportTaskBootstrap,
|
|
63544
|
-
includeReportBuilderStateInPivotTask,
|
|
63545
|
-
filterCount: internalFilters.length,
|
|
63546
|
-
useInMemoryEngines
|
|
63547
|
-
});
|
|
63548
63298
|
if (hasPivot) {
|
|
63549
63299
|
const pivotResult = await loadPivotTemplateInParallelWithReportTask({
|
|
63550
63300
|
reportId,
|
|
@@ -63560,9 +63310,6 @@ async function loadReportForUseForm({
|
|
|
63560
63310
|
customFields,
|
|
63561
63311
|
dashboardName,
|
|
63562
63312
|
pivotRefreshOnly: includeReportBuilderStateInPivotTask,
|
|
63563
|
-
debugSource,
|
|
63564
|
-
debugRunId,
|
|
63565
|
-
debugLoadRequestId,
|
|
63566
63313
|
draftSessionId
|
|
63567
63314
|
});
|
|
63568
63315
|
const pivotRows = pivotResult.report?.pivotRows;
|
|
@@ -63571,7 +63318,7 @@ async function loadReportForUseForm({
|
|
|
63571
63318
|
const hasRowBucketKey = !rowFieldTrimmed || Array.isArray(pivotRows) && pivotRows.some(
|
|
63572
63319
|
(row) => row && typeof row === "object" && Object.prototype.hasOwnProperty.call(row, rowFieldTrimmed)
|
|
63573
63320
|
);
|
|
63574
|
-
const hasMatchingPivotData = pivotResult.report && !pivotResult.error && Array.isArray(pivotRows) && pivotRows.length
|
|
63321
|
+
const hasMatchingPivotData = pivotResult.report && !pivotResult.error && Array.isArray(pivotRows) && (pivotRows.length === 0 || hasRowBucketKey);
|
|
63575
63322
|
if (hasMatchingPivotData) {
|
|
63576
63323
|
return pivotResult;
|
|
63577
63324
|
}
|
|
@@ -63611,25 +63358,12 @@ async function loadReportForUseForm({
|
|
|
63611
63358
|
schema,
|
|
63612
63359
|
customFields,
|
|
63613
63360
|
dashboardName,
|
|
63614
|
-
debugSource,
|
|
63615
|
-
debugRunId,
|
|
63616
|
-
debugLoadRequestId,
|
|
63617
63361
|
draftSessionId
|
|
63618
63362
|
});
|
|
63619
63363
|
const normalizedBootstrapResult = bootstrapResult.report?.pivot == null ? stripPivotFromResult(bootstrapResult) : bootstrapResult;
|
|
63620
63364
|
return normalizedBootstrapResult;
|
|
63621
63365
|
}
|
|
63622
63366
|
const shouldUseReportTaskForReload = internalFilters.length > 0;
|
|
63623
|
-
const resolvedTask = shouldUseReportTaskForReload ? "report" : "item";
|
|
63624
|
-
logUseFormTaskDebug("non-bootstrap task route", {
|
|
63625
|
-
reportId,
|
|
63626
|
-
task: resolvedTask,
|
|
63627
|
-
source: debugSource ?? "unknown",
|
|
63628
|
-
runId: debugRunId ?? null,
|
|
63629
|
-
loadRequestId: debugLoadRequestId ?? null,
|
|
63630
|
-
reason: shouldUseReportTaskForReload ? "live internal filters are present" : "no live internal filters are present",
|
|
63631
|
-
filterCount: internalFilters.length
|
|
63632
|
-
});
|
|
63633
63367
|
return loadViaInMemoryEngines({
|
|
63634
63368
|
reportId,
|
|
63635
63369
|
client,
|
|
@@ -63638,9 +63372,6 @@ async function loadReportForUseForm({
|
|
|
63638
63372
|
tenants,
|
|
63639
63373
|
flags,
|
|
63640
63374
|
allowReportTaskBootstrap: shouldUseReportTaskForReload,
|
|
63641
|
-
debugSource,
|
|
63642
|
-
debugRunId,
|
|
63643
|
-
debugLoadRequestId,
|
|
63644
63375
|
draftSessionId
|
|
63645
63376
|
});
|
|
63646
63377
|
}
|
|
@@ -63659,18 +63390,12 @@ async function loadReportForUseForm({
|
|
|
63659
63390
|
function generateDraftSessionId() {
|
|
63660
63391
|
return typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `draft-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
|
|
63661
63392
|
}
|
|
63662
|
-
var nextUseReportDebugRunId = 0;
|
|
63663
63393
|
function useReport(reportIdArg, options = {}) {
|
|
63664
63394
|
const propReportId = String(reportIdArg ?? "").trim();
|
|
63665
63395
|
const [createdReportId, setCreatedReportId] = useState41(null);
|
|
63666
63396
|
const effectiveReportId = propReportId || createdReportId || "";
|
|
63667
63397
|
const { eventTracking } = useContext36(EventTrackingContext);
|
|
63668
63398
|
const [draftSessionId, setDraftSessionId] = useState41(generateDraftSessionId);
|
|
63669
|
-
const [taskDebugRunId] = useState41(() => {
|
|
63670
|
-
nextUseReportDebugRunId += 1;
|
|
63671
|
-
return nextUseReportDebugRunId;
|
|
63672
|
-
});
|
|
63673
|
-
const taskDebugLoadRequestIdRef = useRef25(0);
|
|
63674
63399
|
const useInMemoryEngines = options.useInMemoryEngines ?? false;
|
|
63675
63400
|
const restrictFieldOptionsToSelectedDatasources = options.restrictFieldOptionsToSelectedDatasources ?? true;
|
|
63676
63401
|
const reportOverride = options.reportOverride ?? null;
|
|
@@ -63679,7 +63404,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63679
63404
|
options.destinationDashboardName ?? ""
|
|
63680
63405
|
).trim();
|
|
63681
63406
|
const controlledPagination = options.state?.pagination;
|
|
63682
|
-
const initialPaginationRef =
|
|
63407
|
+
const initialPaginationRef = useRef24({
|
|
63683
63408
|
...getDefaultPaginationState(),
|
|
63684
63409
|
...options.initialState?.pagination ?? {}
|
|
63685
63410
|
});
|
|
@@ -63693,15 +63418,15 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63693
63418
|
);
|
|
63694
63419
|
const pagination = controlledPagination ?? internalPagination;
|
|
63695
63420
|
const paginationActive = paginationInteracted || Boolean(controlledPagination);
|
|
63696
|
-
const paginationRef =
|
|
63421
|
+
const paginationRef = useRef24(pagination);
|
|
63697
63422
|
paginationRef.current = pagination;
|
|
63698
|
-
const onPaginationChangeRef =
|
|
63423
|
+
const onPaginationChangeRef = useRef24(options.onPaginationChange);
|
|
63699
63424
|
onPaginationChangeRef.current = options.onPaginationChange;
|
|
63700
|
-
const controlledPaginationRef =
|
|
63425
|
+
const controlledPaginationRef = useRef24(Boolean(controlledPagination));
|
|
63701
63426
|
controlledPaginationRef.current = Boolean(controlledPagination);
|
|
63702
|
-
const autoResetPageIndexRef =
|
|
63427
|
+
const autoResetPageIndexRef = useRef24(true);
|
|
63703
63428
|
autoResetPageIndexRef.current = options.autoResetPageIndex ?? true;
|
|
63704
|
-
const paginationPageCountRef =
|
|
63429
|
+
const paginationPageCountRef = useRef24(-1);
|
|
63705
63430
|
const applyPaginationUpdate = useCallback5(
|
|
63706
63431
|
(updater, { activate = true } = {}) => {
|
|
63707
63432
|
if (activate) {
|
|
@@ -63770,13 +63495,13 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63770
63495
|
() => setPageIndex(paginationPageCountRef.current - 1),
|
|
63771
63496
|
[setPageIndex]
|
|
63772
63497
|
);
|
|
63773
|
-
const chartPivotHydratedFromSourceRef =
|
|
63774
|
-
const lastPivotHydrateCompletedSourceIdRef =
|
|
63775
|
-
const groupRowsBySetViaSetReportRef =
|
|
63776
|
-
const groupColumnsBySetViaSetReportRef =
|
|
63777
|
-
const dateBucketSetViaSetReportRef =
|
|
63778
|
-
const aggregationStateSetViaSetReportRef =
|
|
63779
|
-
const prevReportIdForChartPivotHydrationRef =
|
|
63498
|
+
const chartPivotHydratedFromSourceRef = useRef24(false);
|
|
63499
|
+
const lastPivotHydrateCompletedSourceIdRef = useRef24(null);
|
|
63500
|
+
const groupRowsBySetViaSetReportRef = useRef24(false);
|
|
63501
|
+
const groupColumnsBySetViaSetReportRef = useRef24(false);
|
|
63502
|
+
const dateBucketSetViaSetReportRef = useRef24(false);
|
|
63503
|
+
const aggregationStateSetViaSetReportRef = useRef24(false);
|
|
63504
|
+
const prevReportIdForChartPivotHydrationRef = useRef24(effectiveReportId);
|
|
63780
63505
|
if (prevReportIdForChartPivotHydrationRef.current !== effectiveReportId) {
|
|
63781
63506
|
prevReportIdForChartPivotHydrationRef.current = effectiveReportId;
|
|
63782
63507
|
chartPivotHydratedFromSourceRef.current = false;
|
|
@@ -63790,11 +63515,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63790
63515
|
expandReportBuilderColumnsForFlatTable,
|
|
63791
63516
|
setExpandReportBuilderColumnsForFlatTable
|
|
63792
63517
|
] = useState41(false);
|
|
63793
|
-
const prevPivotStateForColumnExpansionRef =
|
|
63518
|
+
const prevPivotStateForColumnExpansionRef = useRef24(null);
|
|
63794
63519
|
const [sourceReport, setSourceReport] = useState41(
|
|
63795
63520
|
null
|
|
63796
63521
|
);
|
|
63797
|
-
const prevSourceReportIdForPivotHydrationRef =
|
|
63522
|
+
const prevSourceReportIdForPivotHydrationRef = useRef24(null);
|
|
63798
63523
|
{
|
|
63799
63524
|
const currentSourceId = sourceReport ? String(
|
|
63800
63525
|
sourceReport.id ?? sourceReport._id ?? ""
|
|
@@ -63880,12 +63605,10 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63880
63605
|
const dashboardNameForNewReport = useMemo32(() => {
|
|
63881
63606
|
return [clientDefaultDashboardName, destinationDashboardName].map((entry) => String(entry ?? "").trim()).find((entry) => entry.length > 0) ?? "";
|
|
63882
63607
|
}, [clientDefaultDashboardName, destinationDashboardName]);
|
|
63883
|
-
const filterStackRef =
|
|
63608
|
+
const filterStackRef = useRef24(filterStack);
|
|
63884
63609
|
filterStackRef.current = filterStack;
|
|
63885
63610
|
const resolvedGroupRowsBy = decodePivotGroupOptionValue(groupRowsBy);
|
|
63886
63611
|
const resolvedGroupColumnsBy = decodePivotGroupOptionValue(groupColumnsBy);
|
|
63887
|
-
const useFormRefreshDebugEnabled = isUseFormRefreshDebugEnabled();
|
|
63888
|
-
const useFormFiltersDebugEnabled = isUseFormFiltersDebugEnabled();
|
|
63889
63612
|
useEffect31(() => {
|
|
63890
63613
|
if (propReportId) {
|
|
63891
63614
|
setCreatedReportId(null);
|
|
@@ -63895,8 +63618,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63895
63618
|
setChartAxisEdits({});
|
|
63896
63619
|
setChartVisibilityOverrides({});
|
|
63897
63620
|
}, [effectiveReportId]);
|
|
63898
|
-
const bootstrapReportTaskUsedForReportIdRef =
|
|
63899
|
-
const schemaScopeInitializedForReportIdRef =
|
|
63621
|
+
const bootstrapReportTaskUsedForReportIdRef = useRef24(null);
|
|
63622
|
+
const schemaScopeInitializedForReportIdRef = useRef24(null);
|
|
63900
63623
|
const initializeSchemaScopeForReport = (report) => {
|
|
63901
63624
|
if (!report) return;
|
|
63902
63625
|
if (schemaScopeInitializedForReportIdRef.current === effectiveReportId)
|
|
@@ -63924,8 +63647,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63924
63647
|
}
|
|
63925
63648
|
return schemaData.schema ?? [];
|
|
63926
63649
|
}, [schemaData.schema, schemaData.schemaWithCustomFields]);
|
|
63927
|
-
const schemaForReportBuilderStateRef =
|
|
63928
|
-
const customFieldsRef =
|
|
63650
|
+
const schemaForReportBuilderStateRef = useRef24(schemaForReportBuilderState);
|
|
63651
|
+
const customFieldsRef = useRef24(schemaData.customFields);
|
|
63929
63652
|
schemaForReportBuilderStateRef.current = schemaForReportBuilderState;
|
|
63930
63653
|
customFieldsRef.current = schemaData.customFields;
|
|
63931
63654
|
const isBoolAggregationField = useCallback5(
|
|
@@ -64434,26 +64157,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64434
64157
|
const filterUniqueValuesEnabled = Boolean(
|
|
64435
64158
|
client && client?.queryEndpoint && filterUniqueValuesRequest && filterUniqueValuesRequest.stringColumns.length > 0
|
|
64436
64159
|
);
|
|
64437
|
-
useEffect31(() => {
|
|
64438
|
-
if (!useFormFiltersDebugEnabled) return;
|
|
64439
|
-
const hasClient = Boolean(client);
|
|
64440
|
-
const hasQueryEndpoint = Boolean(client?.queryEndpoint);
|
|
64441
|
-
const hasRequest = Boolean(filterUniqueValuesRequest);
|
|
64442
|
-
const stringColumnsCount = filterUniqueValuesRequest?.stringColumns.length ?? 0;
|
|
64443
|
-
const stringColumnsByTableCount = filterUniqueValuesRequest?.stringColumnsByTable.length ?? 0;
|
|
64444
|
-
const missingReasons = [];
|
|
64445
|
-
if (!hasClient) missingReasons.push("missing-client");
|
|
64446
|
-
if (!hasQueryEndpoint) missingReasons.push("missing-query-endpoint");
|
|
64447
|
-
if (!hasRequest) missingReasons.push("missing-filterUniqueValuesRequest");
|
|
64448
|
-
if (stringColumnsCount === 0) missingReasons.push("no-string-columns");
|
|
64449
|
-
}, [
|
|
64450
|
-
client,
|
|
64451
|
-
filterUniqueValuesEnabled,
|
|
64452
|
-
filterUniqueValuesRequest,
|
|
64453
|
-
filterUniqueValuesRequestHash,
|
|
64454
|
-
effectiveReportId,
|
|
64455
|
-
useFormFiltersDebugEnabled
|
|
64456
|
-
]);
|
|
64457
64160
|
const filterUniqueValuesQuery = useQuery({
|
|
64458
64161
|
queryKey: [
|
|
64459
64162
|
"useReport",
|
|
@@ -64557,22 +64260,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64557
64260
|
filterUniqueValuesQuery.data?.uniqueValuesByColumn,
|
|
64558
64261
|
filterUniqueValuesRequest?.stringColumnsByTable
|
|
64559
64262
|
]);
|
|
64560
|
-
useEffect31(() => {
|
|
64561
|
-
if (!useFormFiltersDebugEnabled) return;
|
|
64562
|
-
if (filterUniqueValuesQuery.status !== "success" && filterUniqueValuesQuery.status !== "error") {
|
|
64563
|
-
return;
|
|
64564
|
-
}
|
|
64565
|
-
const uniqueValuesByColumn = filterUniqueValuesQuery.data?.uniqueValuesByColumn ?? {};
|
|
64566
|
-
const uniqueValuesByColumnRecord = uniqueValuesByColumn && typeof uniqueValuesByColumn === "object" ? uniqueValuesByColumn : {};
|
|
64567
|
-
}, [
|
|
64568
|
-
backendUniqueValuesByFieldName,
|
|
64569
|
-
filterUniqueValuesEnabled,
|
|
64570
|
-
filterUniqueValuesQuery.data,
|
|
64571
|
-
filterUniqueValuesQuery.status,
|
|
64572
|
-
filterUniqueValuesRequest,
|
|
64573
|
-
effectiveReportId,
|
|
64574
|
-
useFormFiltersDebugEnabled
|
|
64575
|
-
]);
|
|
64576
64263
|
const filterValueOptionsByFieldName = useMemo32(() => {
|
|
64577
64264
|
const optionsByField = /* @__PURE__ */ new Map();
|
|
64578
64265
|
const selectedMultiselectByField = collectSelectedStringMultiselectValuesByField(queryFilters);
|
|
@@ -64740,8 +64427,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64740
64427
|
queryBuilderFieldConfigByName,
|
|
64741
64428
|
queryFilters
|
|
64742
64429
|
]);
|
|
64743
|
-
const filterFieldsStableReportIdRef =
|
|
64744
|
-
const filterFieldsStableCacheRef =
|
|
64430
|
+
const filterFieldsStableReportIdRef = useRef24("");
|
|
64431
|
+
const filterFieldsStableCacheRef = useRef24([]);
|
|
64745
64432
|
const filterFields = useMemo32(() => {
|
|
64746
64433
|
const rid = String(effectiveReportId ?? "");
|
|
64747
64434
|
if (filterFieldsStableReportIdRef.current !== rid) {
|
|
@@ -64973,8 +64660,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64973
64660
|
clientHash
|
|
64974
64661
|
}),
|
|
64975
64662
|
queryFn: createUseFormQueryFn(async () => {
|
|
64976
|
-
taskDebugLoadRequestIdRef.current += 1;
|
|
64977
|
-
const debugLoadRequestId = taskDebugLoadRequestIdRef.current;
|
|
64978
64663
|
const allowReportTaskBootstrap = !initialReportBuilderState && bootstrapReportTaskUsedForReportIdRef.current !== effectiveReportId;
|
|
64979
64664
|
const loadTargetId = String(effectiveReportId ?? "").trim();
|
|
64980
64665
|
const sourceReportIdentity = String(
|
|
@@ -64998,9 +64683,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64998
64683
|
customFields: customFieldsRef.current,
|
|
64999
64684
|
dashboardName: resolvedSourceDashboardName,
|
|
65000
64685
|
useInMemoryEngines,
|
|
65001
|
-
debugSource: "initial-load",
|
|
65002
|
-
debugRunId: taskDebugRunId,
|
|
65003
|
-
debugLoadRequestId,
|
|
65004
64686
|
draftSessionId: draftSessionId || void 0
|
|
65005
64687
|
});
|
|
65006
64688
|
return loadResult;
|
|
@@ -65340,19 +65022,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65340
65022
|
resolveCache.set(fieldName, resolved);
|
|
65341
65023
|
return resolved;
|
|
65342
65024
|
}
|
|
65343
|
-
if (isUseFormFiltersDebugEnabled()) {
|
|
65344
|
-
console.error(
|
|
65345
|
-
"[useForm-debug] normalizeQueryBuilderFieldNameForConfig ambiguous",
|
|
65346
|
-
{
|
|
65347
|
-
fieldName,
|
|
65348
|
-
candidateKeys: candidates.map(([key]) => key),
|
|
65349
|
-
preferredTableNames: Array.from(preferredTableNames),
|
|
65350
|
-
primaryTableName,
|
|
65351
|
-
effectiveReportBuilderTableNames,
|
|
65352
|
-
baseReportBuilderTableNames
|
|
65353
|
-
}
|
|
65354
|
-
);
|
|
65355
|
-
}
|
|
65356
65025
|
return fieldName;
|
|
65357
65026
|
};
|
|
65358
65027
|
}, [
|
|
@@ -65630,7 +65299,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65630
65299
|
() => stableSerializeForQueryKey(effectiveReportBuilderState),
|
|
65631
65300
|
[effectiveReportBuilderState]
|
|
65632
65301
|
);
|
|
65633
|
-
const prevPaginationResetStateHashRef =
|
|
65302
|
+
const prevPaginationResetStateHashRef = useRef24(null);
|
|
65634
65303
|
useEffect31(() => {
|
|
65635
65304
|
const prevHash = prevPaginationResetStateHashRef.current;
|
|
65636
65305
|
prevPaginationResetStateHashRef.current = effectiveReportBuilderStateHash;
|
|
@@ -65744,8 +65413,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65744
65413
|
}, [
|
|
65745
65414
|
effectiveReportId,
|
|
65746
65415
|
tableRefreshQuery.data,
|
|
65747
|
-
tableRefreshQueryEnabled
|
|
65748
|
-
useFormRefreshDebugEnabled
|
|
65416
|
+
tableRefreshQueryEnabled
|
|
65749
65417
|
]);
|
|
65750
65418
|
const chartTypes = useMemo32(() => {
|
|
65751
65419
|
return getChartTypeOptions2({ pivot: pivotState });
|
|
@@ -66308,7 +65976,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66308
65976
|
...sourceReport,
|
|
66309
65977
|
reportBuilderState: effectiveReportBuilderState
|
|
66310
65978
|
};
|
|
66311
|
-
taskDebugLoadRequestIdRef.current += 1;
|
|
66312
65979
|
const pivotRefreshResult = await loadReportForUseForm({
|
|
66313
65980
|
reportId: effectiveReportId,
|
|
66314
65981
|
initialReportBuilderState: effectiveReportBuilderState,
|
|
@@ -66324,9 +65991,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66324
65991
|
customFields: schemaData.customFields,
|
|
66325
65992
|
dashboardName: resolvedSourceDashboardName,
|
|
66326
65993
|
useInMemoryEngines,
|
|
66327
|
-
debugSource: "pivot-refresh",
|
|
66328
|
-
debugRunId: taskDebugRunId,
|
|
66329
|
-
debugLoadRequestId: taskDebugLoadRequestIdRef.current,
|
|
66330
65994
|
draftSessionId: draftSessionId || void 0
|
|
66331
65995
|
});
|
|
66332
65996
|
return pivotRefreshResult;
|
|
@@ -66490,8 +66154,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66490
66154
|
pivotTableDataRefreshQuery.data,
|
|
66491
66155
|
pivotTableDataRefreshQuery.status,
|
|
66492
66156
|
pivotTableDataRefreshQueryEnabled,
|
|
66493
|
-
effectiveReportId
|
|
66494
|
-
useFormRefreshDebugEnabled
|
|
66157
|
+
effectiveReportId
|
|
66495
66158
|
]);
|
|
66496
66159
|
useEffect31(() => {
|
|
66497
66160
|
if (!pivotRefreshQueryEnabled) return;
|
|
@@ -66543,8 +66206,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66543
66206
|
pivotRefreshQuery.data,
|
|
66544
66207
|
pivotRefreshQuery.status,
|
|
66545
66208
|
pivotRefreshQueryEnabled,
|
|
66546
|
-
effectiveReportId
|
|
66547
|
-
useFormRefreshDebugEnabled
|
|
66209
|
+
effectiveReportId
|
|
66548
66210
|
]);
|
|
66549
66211
|
const chartData = useMemo32(() => {
|
|
66550
66212
|
if (!sourceReport) return void 0;
|
|
@@ -66552,8 +66214,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66552
66214
|
const chartPivotForDisplay = nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
|
|
66553
66215
|
const rowCountForChart = chartPivotForDisplay ? sourceReport.pivotRowCount ?? (Array.isArray(sourceReport.pivotRows) ? sourceReport.pivotRows.length : sourceReport.rowCount) : useInMemoryEngines ? rowsForChart.length : sourceReport.rowCount;
|
|
66554
66216
|
const referencedTablesForChart = effectiveReportBuilderState?.tables.map((table2) => table2.name).filter((name2) => Boolean(name2));
|
|
66555
|
-
const pivotRowsForChart = Array.isArray(sourceReport.pivotRows)
|
|
66556
|
-
const rowCountForChartResolved = chartPivotForDisplay ? pivotRowsForChart
|
|
66217
|
+
const pivotRowsForChart = Array.isArray(sourceReport.pivotRows) ? sourceReport.pivotRows : void 0;
|
|
66218
|
+
const rowCountForChartResolved = chartPivotForDisplay ? Array.isArray(pivotRowsForChart) ? pivotRowsForChart.length : rowCountForChart : rowCountForChart;
|
|
66557
66219
|
const chartDataPayload = {
|
|
66558
66220
|
...sourceReport,
|
|
66559
66221
|
rows: rowsForChart,
|
|
@@ -66564,15 +66226,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66564
66226
|
referencedTables: referencedTablesForChart && referencedTablesForChart.length > 0 ? referencedTablesForChart : sourceReport.referencedTables,
|
|
66565
66227
|
pivotRows: pivotRowsForChart,
|
|
66566
66228
|
pivotColumns: sourceReport.pivotColumns,
|
|
66567
|
-
pivotRowCount: pivotRowsForChart.length
|
|
66229
|
+
pivotRowCount: Array.isArray(pivotRowsForChart) ? pivotRowsForChart.length : sourceReport.pivotRowCount
|
|
66568
66230
|
};
|
|
66569
|
-
logUseFormPivotShapeDebug("chartData:memo", {
|
|
66570
|
-
reportId: sourceReport.id,
|
|
66571
|
-
detailRowsLength: rowsForChart.length,
|
|
66572
|
-
pivotRowsIsArray: Array.isArray(sourceReport.pivotRows),
|
|
66573
|
-
pivotRowsLength: Array.isArray(sourceReport.pivotRows) ? sourceReport.pivotRows.length : null,
|
|
66574
|
-
hasNextPivot: Boolean(nextPivot)
|
|
66575
|
-
});
|
|
66576
66231
|
return chartDataPayload;
|
|
66577
66232
|
}, [
|
|
66578
66233
|
sourceReport,
|
|
@@ -66884,26 +66539,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66884
66539
|
xAxisLabel: resolvedXAxisLabel
|
|
66885
66540
|
});
|
|
66886
66541
|
}
|
|
66887
|
-
logUseFormPivotShapeDebug("chart:formatting(yAxis+pivotColumns)", {
|
|
66888
|
-
chartType: baseChart.chartType,
|
|
66889
|
-
pivotRowField: baseChart.pivot?.rowField,
|
|
66890
|
-
xAxisField: resolvedXAxisField,
|
|
66891
|
-
xAxisFormat: resolvedXAxisFormat,
|
|
66892
|
-
yAxisFieldsForDisplay: (resolvedYAxisFieldsForDisplay ?? []).map((y) => ({
|
|
66893
|
-
field: y.field,
|
|
66894
|
-
format: y.format,
|
|
66895
|
-
label: y.label
|
|
66896
|
-
})),
|
|
66897
|
-
pivotColumnsSample: (baseChart.pivotColumns ?? []).slice(0, 12).map((c) => ({
|
|
66898
|
-
field: c.field,
|
|
66899
|
-
format: c.format,
|
|
66900
|
-
label: c.label
|
|
66901
|
-
})),
|
|
66902
|
-
mergedColumnFormatsSample: (columns2 ?? baseChart.columns ?? []).slice(0, 12).map((c) => ({
|
|
66903
|
-
field: c.field,
|
|
66904
|
-
format: c.format
|
|
66905
|
-
}))
|
|
66906
|
-
});
|
|
66907
66542
|
return {
|
|
66908
66543
|
...baseChart,
|
|
66909
66544
|
xAxisField: resolvedXAxisField,
|
|
@@ -66919,6 +66554,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66919
66554
|
resolvedXAxisLabel,
|
|
66920
66555
|
resolvedYAxisFieldsForDisplay
|
|
66921
66556
|
]);
|
|
66557
|
+
const pivotDateFilterRangeCacheRef = useRef24({ key: "", min: null, max: null });
|
|
66922
66558
|
const filterOptions = useMemo32(() => {
|
|
66923
66559
|
const out = [];
|
|
66924
66560
|
for (const [field, values] of filterValueOptionsByFieldName) {
|
|
@@ -66934,25 +66570,43 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66934
66570
|
if (rowField && isDateType(String(pivot?.rowFieldType ?? ""))) {
|
|
66935
66571
|
const field = pivot?.rowFieldTable ? `${pivot.rowFieldTable}.${rowField}` : rowField;
|
|
66936
66572
|
const bucket = dateBucket || pivot?.dateBucket || "month";
|
|
66937
|
-
const
|
|
66573
|
+
const labelsByRaw = /* @__PURE__ */ new Map();
|
|
66574
|
+
const cacheKey = `${String(effectiveReportId ?? "")}\0${field}\0${bucket}`;
|
|
66575
|
+
if (pivotDateFilterRangeCacheRef.current.key !== cacheKey) {
|
|
66576
|
+
pivotDateFilterRangeCacheRef.current = {
|
|
66577
|
+
key: cacheKey,
|
|
66578
|
+
min: null,
|
|
66579
|
+
max: null
|
|
66580
|
+
};
|
|
66581
|
+
}
|
|
66938
66582
|
for (const row of chart?.rows ?? []) {
|
|
66939
66583
|
const record = row;
|
|
66940
66584
|
const raw = record.__quillRawDate;
|
|
66941
66585
|
if (raw == null || raw === "") continue;
|
|
66942
66586
|
const key = String(raw);
|
|
66943
|
-
|
|
66944
|
-
|
|
66587
|
+
const timestamp = new Date(key).getTime();
|
|
66588
|
+
if (Number.isNaN(timestamp)) continue;
|
|
66589
|
+
labelsByRaw.set(key, String(record[rowField] ?? key));
|
|
66590
|
+
const cachedMin = pivotDateFilterRangeCacheRef.current.min;
|
|
66591
|
+
const cachedMax = pivotDateFilterRangeCacheRef.current.max;
|
|
66592
|
+
if (cachedMin == null || timestamp < new Date(cachedMin).getTime()) {
|
|
66593
|
+
pivotDateFilterRangeCacheRef.current.min = key;
|
|
66594
|
+
}
|
|
66595
|
+
if (cachedMax == null || timestamp > new Date(cachedMax).getTime()) {
|
|
66596
|
+
pivotDateFilterRangeCacheRef.current.max = key;
|
|
66945
66597
|
}
|
|
66946
66598
|
}
|
|
66599
|
+
const { min: min2, max: max2 } = pivotDateFilterRangeCacheRef.current;
|
|
66600
|
+
const options2 = min2 && max2 ? buildPivotDateBucketStarts({ min: min2, max: max2 }, bucket).map((value) => ({
|
|
66601
|
+
value,
|
|
66602
|
+
label: labelsByRaw.get(value) ?? getDateString(value, void 0, bucket)
|
|
66603
|
+
})) : [];
|
|
66947
66604
|
out.push({
|
|
66948
66605
|
field,
|
|
66949
66606
|
fieldType: "date",
|
|
66950
66607
|
operator: "inBucket",
|
|
66951
66608
|
dateBucket: bucket,
|
|
66952
|
-
options:
|
|
66953
|
-
value,
|
|
66954
|
-
label: byRaw.get(value) ?? value
|
|
66955
|
-
}))
|
|
66609
|
+
options: options2
|
|
66956
66610
|
});
|
|
66957
66611
|
}
|
|
66958
66612
|
return out;
|
|
@@ -66960,6 +66614,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66960
66614
|
chart?.pivot,
|
|
66961
66615
|
chart?.rows,
|
|
66962
66616
|
dateBucket,
|
|
66617
|
+
effectiveReportId,
|
|
66963
66618
|
filterValueOptionsByFieldName
|
|
66964
66619
|
]);
|
|
66965
66620
|
const chartForUi = useMemo32(() => {
|
|
@@ -67189,7 +66844,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67189
66844
|
xAxisOptions,
|
|
67190
66845
|
yAxisOptions
|
|
67191
66846
|
]);
|
|
67192
|
-
const tableFormatCacheRef =
|
|
66847
|
+
const tableFormatCacheRef = useRef24(/* @__PURE__ */ new Map());
|
|
67193
66848
|
const tableFormatMerge = useMemo32(
|
|
67194
66849
|
() => mergeDisplayAndSourceForTableFormats({
|
|
67195
66850
|
effectiveReportBuilderTableNames,
|
|
@@ -67564,7 +67219,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67564
67219
|
sourceReport?.columns,
|
|
67565
67220
|
tableFormatMerge
|
|
67566
67221
|
]);
|
|
67567
|
-
const tableColumnSettingsCoalesceRef =
|
|
67222
|
+
const tableColumnSettingsCoalesceRef = useRef24(
|
|
67568
67223
|
/* @__PURE__ */ new Map()
|
|
67569
67224
|
);
|
|
67570
67225
|
useLayoutEffect4(() => {
|
|
@@ -68382,6 +68037,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68382
68037
|
} catch (error) {
|
|
68383
68038
|
console.error("[useForm] setFilters swallowed error", {
|
|
68384
68039
|
error: error instanceof Error ? error.message : String(error),
|
|
68040
|
+
stack: error instanceof Error ? error.stack : void 0,
|
|
68385
68041
|
requestedRules: (resolved?.rules ?? []).map((rule) => ({
|
|
68386
68042
|
table: rule?.table,
|
|
68387
68043
|
field: rule?.field,
|
|
@@ -68882,9 +68538,9 @@ function Chat({
|
|
|
68882
68538
|
const [inputError, setInputError] = useState42("");
|
|
68883
68539
|
const [isLoading, setIsLoading] = useState42(false);
|
|
68884
68540
|
const [model, setModel] = useState42("gemini-3-flash-preview");
|
|
68885
|
-
const containerRef =
|
|
68886
|
-
const textareaRef =
|
|
68887
|
-
const abortControllerRef =
|
|
68541
|
+
const containerRef = useRef25(null);
|
|
68542
|
+
const textareaRef = useRef25(null);
|
|
68543
|
+
const abortControllerRef = useRef25(null);
|
|
68888
68544
|
useEffect32(() => {
|
|
68889
68545
|
if (!containerRef.current) {
|
|
68890
68546
|
return;
|
|
@@ -69319,7 +68975,7 @@ function Chat({
|
|
|
69319
68975
|
}
|
|
69320
68976
|
|
|
69321
68977
|
// src/hooks/useReportFilterDraft.ts
|
|
69322
|
-
import { useCallback as useCallback6, useMemo as useMemo34, useRef as
|
|
68978
|
+
import { useCallback as useCallback6, useMemo as useMemo34, useRef as useRef26, useState as useState43 } from "react";
|
|
69323
68979
|
var normalizeOperatorKey = (operator) => String(operator ?? "").trim().toLowerCase().replace(/[_\s]+/g, "");
|
|
69324
68980
|
var defaultFilterRuleValueForOperator = (operator) => {
|
|
69325
68981
|
const key = normalizeOperatorKey(operator);
|
|
@@ -69358,12 +69014,12 @@ function useReportFilterDraft(args) {
|
|
|
69358
69014
|
const committed = queryBuilderFiltersForEditor(
|
|
69359
69015
|
isQueryBuilderDisplayGroup(committedFilters) ? committedFilters : EMPTY_COMMITTED_FILTERS
|
|
69360
69016
|
);
|
|
69361
|
-
const committedRef =
|
|
69017
|
+
const committedRef = useRef26(committed);
|
|
69362
69018
|
committedRef.current = committed;
|
|
69363
|
-
const setFiltersRef =
|
|
69019
|
+
const setFiltersRef = useRef26(setFilters);
|
|
69364
69020
|
setFiltersRef.current = setFilters;
|
|
69365
|
-
const lastNonEmptyFieldsRef =
|
|
69366
|
-
const prevReportIdForFieldsRef =
|
|
69021
|
+
const lastNonEmptyFieldsRef = useRef26([]);
|
|
69022
|
+
const prevReportIdForFieldsRef = useRef26(reportId);
|
|
69367
69023
|
if (prevReportIdForFieldsRef.current !== reportId) {
|
|
69368
69024
|
prevReportIdForFieldsRef.current = reportId;
|
|
69369
69025
|
lastNonEmptyFieldsRef.current = [];
|
|
@@ -69385,7 +69041,7 @@ function useReportFilterDraft(args) {
|
|
|
69385
69041
|
const [draftQuery, setDraftQuery] = useState43(committed);
|
|
69386
69042
|
const [hasUnappliedFilterChanges, setHasUnappliedFilterChanges] = useState43(false);
|
|
69387
69043
|
const draftResetKey = `${reportId}|${committedSignature}|${resetEpoch}`;
|
|
69388
|
-
const prevDraftResetKeyRef =
|
|
69044
|
+
const prevDraftResetKeyRef = useRef26(draftResetKey);
|
|
69389
69045
|
if (prevDraftResetKeyRef.current !== draftResetKey) {
|
|
69390
69046
|
prevDraftResetKeyRef.current = draftResetKey;
|
|
69391
69047
|
setDraftQuery(committed);
|
|
@@ -69478,7 +69134,7 @@ function useReportQueryBuilder(args) {
|
|
|
69478
69134
|
import {
|
|
69479
69135
|
useContext as useContext38,
|
|
69480
69136
|
useLayoutEffect as useLayoutEffect5,
|
|
69481
|
-
useRef as
|
|
69137
|
+
useRef as useRef27,
|
|
69482
69138
|
useState as useState44
|
|
69483
69139
|
} from "react";
|
|
69484
69140
|
import { jsx as jsx89, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
@@ -69579,7 +69235,7 @@ function ReportDetail({
|
|
|
69579
69235
|
const isTableChart = type === "table";
|
|
69580
69236
|
const useDetailTableFromUseForm = isTableChart && !isPivotTableChartConfig(chart);
|
|
69581
69237
|
const showBottomRawTable = !isTableChart;
|
|
69582
|
-
const chartSlotRef =
|
|
69238
|
+
const chartSlotRef = useRef27(null);
|
|
69583
69239
|
const [chartHeightPx, setChartHeightPx] = useState44(360);
|
|
69584
69240
|
useLayoutEffect5(() => {
|
|
69585
69241
|
const el = chartSlotRef.current;
|