@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.cjs
CHANGED
|
@@ -20015,27 +20015,6 @@ function parseData(rows, queryType) {
|
|
|
20015
20015
|
return rows;
|
|
20016
20016
|
}
|
|
20017
20017
|
}
|
|
20018
|
-
function isQuillFetchDebugEnabled() {
|
|
20019
|
-
if (typeof globalThis !== "undefined") {
|
|
20020
|
-
for (const debugFlag of QUILL_FETCH_DEBUG_FLAGS) {
|
|
20021
|
-
if (globalThis?.[debugFlag] === true) {
|
|
20022
|
-
return true;
|
|
20023
|
-
}
|
|
20024
|
-
}
|
|
20025
|
-
}
|
|
20026
|
-
if (typeof process !== "undefined" && typeof process.env !== "undefined") {
|
|
20027
|
-
const envCandidates = [
|
|
20028
|
-
process?.env?.QUILL_DEBUG_USEFORM_HYDRATION,
|
|
20029
|
-
process?.env?.QUILL_DEBUG_USEFORM_FILTERS,
|
|
20030
|
-
process?.env?.QUILL_DEBUG_DATA_FETCHER
|
|
20031
|
-
];
|
|
20032
|
-
return envCandidates.some((candidate) => {
|
|
20033
|
-
const normalized = String(candidate ?? "").trim().toLowerCase();
|
|
20034
|
-
return normalized === "1" || normalized === "true";
|
|
20035
|
-
});
|
|
20036
|
-
}
|
|
20037
|
-
return false;
|
|
20038
|
-
}
|
|
20039
20018
|
async function testSqlViewState(client, referencedTables, getToken) {
|
|
20040
20019
|
let errorMessage = null;
|
|
20041
20020
|
await Promise.all(
|
|
@@ -20521,7 +20500,7 @@ async function fetchRelevantInfoFromState(reportBuilderState, tables, columns, a
|
|
|
20521
20500
|
return { error: error.message };
|
|
20522
20501
|
}
|
|
20523
20502
|
}
|
|
20524
|
-
var
|
|
20503
|
+
var quillFetch, parseFetchResponse;
|
|
20525
20504
|
var init_dataFetcher = __esm({
|
|
20526
20505
|
"src/utils/dataFetcher.tsx"() {
|
|
20527
20506
|
"use strict";
|
|
@@ -20530,16 +20509,6 @@ var init_dataFetcher = __esm({
|
|
|
20530
20509
|
init_tableProcessing();
|
|
20531
20510
|
init_dates();
|
|
20532
20511
|
init_changelogNotify();
|
|
20533
|
-
QUILL_FETCH_DEBUG_FLAGS = [
|
|
20534
|
-
"__QUILL_DEBUG_USEFORM_HYDRATION__",
|
|
20535
|
-
"__QUILL_DEBUG_USEFORM_FILTERS__",
|
|
20536
|
-
"__QUILL_DEBUG_DATA_FETCHER__"
|
|
20537
|
-
];
|
|
20538
|
-
quillFetchDebugSeq = 0;
|
|
20539
|
-
logQuillFetchDebug = (label, payload) => {
|
|
20540
|
-
if (!isQuillFetchDebugEnabled()) return;
|
|
20541
|
-
console.log(`[quillFetch-debug] ${label}`, payload);
|
|
20542
|
-
};
|
|
20543
20512
|
quillFetch = async ({
|
|
20544
20513
|
client,
|
|
20545
20514
|
task,
|
|
@@ -20550,24 +20519,7 @@ var init_dataFetcher = __esm({
|
|
|
20550
20519
|
urlParameters,
|
|
20551
20520
|
getToken
|
|
20552
20521
|
}) => {
|
|
20553
|
-
const debugSeq = ++quillFetchDebugSeq;
|
|
20554
|
-
const debugStart = Date.now();
|
|
20555
|
-
logQuillFetchDebug("request", {
|
|
20556
|
-
seq: debugSeq,
|
|
20557
|
-
task,
|
|
20558
|
-
reportId: metadata?.reportId,
|
|
20559
|
-
dashboardItemId: metadata?.dashboardItemId,
|
|
20560
|
-
hasPivot: Boolean(metadata?.pivot),
|
|
20561
|
-
hasReportBuilderState: Boolean(metadata?.reportBuilderState),
|
|
20562
|
-
filtersLength: Array.isArray(metadata?.filters) ? metadata.filters.length : void 0
|
|
20563
|
-
});
|
|
20564
20522
|
const token = await getToken();
|
|
20565
|
-
logQuillFetchDebug("token-acquired", {
|
|
20566
|
-
seq: debugSeq,
|
|
20567
|
-
task,
|
|
20568
|
-
ms: Date.now() - debugStart,
|
|
20569
|
-
hasToken: Boolean(token)
|
|
20570
|
-
});
|
|
20571
20523
|
const queryString = urlParameters ?? `task=${task}`;
|
|
20572
20524
|
const endpoint = client.queryEndpoint ? `${client.queryEndpoint}?${queryString}` : `${QUILL_SERVER}${QUILL_QUERY_ENDPOINT}?${queryString}`;
|
|
20573
20525
|
try {
|
|
@@ -20599,17 +20551,6 @@ var init_dataFetcher = __esm({
|
|
|
20599
20551
|
if (task !== "fetch-changelog-list" && Array.isArray(normalizedData?.changelogs)) {
|
|
20600
20552
|
notifyChangelogs(normalizedData.changelogs);
|
|
20601
20553
|
}
|
|
20602
|
-
logQuillFetchDebug("response", {
|
|
20603
|
-
seq: debugSeq,
|
|
20604
|
-
task,
|
|
20605
|
-
ms: Date.now() - debugStart,
|
|
20606
|
-
status: result.status,
|
|
20607
|
-
error: result.error,
|
|
20608
|
-
dataError: normalizedData?.error,
|
|
20609
|
-
queryResultRowCounts: Array.isArray(result.queries?.queryResults) ? result.queries.queryResults.map(
|
|
20610
|
-
(qr) => Array.isArray(qr?.rows) ? qr.rows.length : null
|
|
20611
|
-
) : void 0
|
|
20612
|
-
});
|
|
20613
20554
|
return {
|
|
20614
20555
|
data: normalizedData,
|
|
20615
20556
|
queries: result.queries,
|
|
@@ -20618,19 +20559,8 @@ var init_dataFetcher = __esm({
|
|
|
20618
20559
|
};
|
|
20619
20560
|
} catch (e) {
|
|
20620
20561
|
if (e instanceof Error && e.name === "AbortError") {
|
|
20621
|
-
logQuillFetchDebug("aborted", {
|
|
20622
|
-
seq: debugSeq,
|
|
20623
|
-
task,
|
|
20624
|
-
ms: Date.now() - debugStart
|
|
20625
|
-
});
|
|
20626
20562
|
throw e;
|
|
20627
20563
|
}
|
|
20628
|
-
logQuillFetchDebug("threw", {
|
|
20629
|
-
seq: debugSeq,
|
|
20630
|
-
task,
|
|
20631
|
-
ms: Date.now() - debugStart,
|
|
20632
|
-
message: e instanceof Error ? e.message : String(e)
|
|
20633
|
-
});
|
|
20634
20564
|
if (task !== "set-section-order") {
|
|
20635
20565
|
console.error("Failed to fetch:", e);
|
|
20636
20566
|
}
|
|
@@ -29251,62 +29181,6 @@ function stableColorIndex(field) {
|
|
|
29251
29181
|
}
|
|
29252
29182
|
return hash;
|
|
29253
29183
|
}
|
|
29254
|
-
function assignStableSeriesColors(fields, colors, knownFields = fields) {
|
|
29255
|
-
const normalize2 = (values) => [
|
|
29256
|
-
...new Set(
|
|
29257
|
-
values.filter((field) => typeof field === "string").map((field) => field.replace("comparison_", ""))
|
|
29258
|
-
)
|
|
29259
|
-
];
|
|
29260
|
-
const uniqueFields = normalize2(fields);
|
|
29261
|
-
const universe = normalize2([...knownFields, ...fields]);
|
|
29262
|
-
const result = /* @__PURE__ */ new Map();
|
|
29263
|
-
if (universe.length === 0) {
|
|
29264
|
-
return result;
|
|
29265
|
-
}
|
|
29266
|
-
if (!colors.length) {
|
|
29267
|
-
for (const field of uniqueFields) {
|
|
29268
|
-
result.set(field, "gray");
|
|
29269
|
-
}
|
|
29270
|
-
return result;
|
|
29271
|
-
}
|
|
29272
|
-
const palette = colors.length >= universe.length ? colors : generateArrayFromColor(colors, universe.length);
|
|
29273
|
-
const ordered = [...universe].sort((a, b) => {
|
|
29274
|
-
const diff = stableColorIndex(a) - stableColorIndex(b);
|
|
29275
|
-
return diff !== 0 ? diff : a.localeCompare(b);
|
|
29276
|
-
});
|
|
29277
|
-
const usedIndices = /* @__PURE__ */ new Set();
|
|
29278
|
-
const deferred = [];
|
|
29279
|
-
const assigned = /* @__PURE__ */ new Map();
|
|
29280
|
-
for (const field of ordered) {
|
|
29281
|
-
const preferred = stableColorIndex(field) % palette.length;
|
|
29282
|
-
if (!usedIndices.has(preferred)) {
|
|
29283
|
-
usedIndices.add(preferred);
|
|
29284
|
-
assigned.set(field, palette[preferred]);
|
|
29285
|
-
} else {
|
|
29286
|
-
deferred.push(field);
|
|
29287
|
-
}
|
|
29288
|
-
}
|
|
29289
|
-
for (const field of deferred) {
|
|
29290
|
-
const preferred = stableColorIndex(field) % palette.length;
|
|
29291
|
-
let found = false;
|
|
29292
|
-
for (let offset = 1; offset < palette.length; offset++) {
|
|
29293
|
-
const idx = (preferred + offset) % palette.length;
|
|
29294
|
-
if (!usedIndices.has(idx)) {
|
|
29295
|
-
usedIndices.add(idx);
|
|
29296
|
-
assigned.set(field, palette[idx]);
|
|
29297
|
-
found = true;
|
|
29298
|
-
break;
|
|
29299
|
-
}
|
|
29300
|
-
}
|
|
29301
|
-
if (!found) {
|
|
29302
|
-
assigned.set(field, palette[preferred]);
|
|
29303
|
-
}
|
|
29304
|
-
}
|
|
29305
|
-
for (const field of uniqueFields) {
|
|
29306
|
-
result.set(field, assigned.get(field));
|
|
29307
|
-
}
|
|
29308
|
-
return result;
|
|
29309
|
-
}
|
|
29310
29184
|
function selectColor(element, colors, index) {
|
|
29311
29185
|
if (!element?.field) return "gray";
|
|
29312
29186
|
const isComparison = element.field.includes("comparison_");
|
|
@@ -34327,21 +34201,6 @@ function BarChart({
|
|
|
34327
34201
|
() => stackedMode ? getStackedDomain(data, yAxisFields, comparison) : getDomain(data, yAxisFields, referenceLines),
|
|
34328
34202
|
[stackedMode, data, yAxisFields, referenceLines, comparison]
|
|
34329
34203
|
);
|
|
34330
|
-
const knownSeriesFieldsRef = (0, import_react18.useRef)([]);
|
|
34331
|
-
const knownColorsKeyRef = (0, import_react18.useRef)("");
|
|
34332
|
-
const seriesColorByField = (0, import_react18.useMemo)(() => {
|
|
34333
|
-
const visibleFields = yAxisFields.filter((field) => comparison || !field.field.startsWith("comparison_")).map((field) => field.field);
|
|
34334
|
-
const colorsKey = colors.join("\0");
|
|
34335
|
-
if (knownColorsKeyRef.current !== colorsKey) {
|
|
34336
|
-
knownSeriesFieldsRef.current = [];
|
|
34337
|
-
knownColorsKeyRef.current = colorsKey;
|
|
34338
|
-
}
|
|
34339
|
-
const knownFields = [
|
|
34340
|
-
.../* @__PURE__ */ new Set([...knownSeriesFieldsRef.current, ...visibleFields])
|
|
34341
|
-
];
|
|
34342
|
-
knownSeriesFieldsRef.current = knownFields;
|
|
34343
|
-
return assignStableSeriesColors(visibleFields, colors, knownFields);
|
|
34344
|
-
}, [yAxisFields, colors, comparison]);
|
|
34345
34204
|
const allowDecimals = (0, import_react18.useMemo)(
|
|
34346
34205
|
() => getAllowDecimals(data, yAxisFields, referenceLines),
|
|
34347
34206
|
[data, yAxisFields, referenceLines]
|
|
@@ -34604,15 +34463,7 @@ function BarChart({
|
|
|
34604
34463
|
dataKey: elem.field,
|
|
34605
34464
|
stackId: stackedMode ? "same_id" : isStacked ? elem.field.replace("comparison_", "") : void 0,
|
|
34606
34465
|
type: "linear",
|
|
34607
|
-
fill: getCustomColor(elem.field) ?? selectColor(
|
|
34608
|
-
elem,
|
|
34609
|
-
[
|
|
34610
|
-
seriesColorByField.get(
|
|
34611
|
-
elem.field.replace("comparison_", "")
|
|
34612
|
-
) ?? colors[0] ?? "gray"
|
|
34613
|
-
],
|
|
34614
|
-
0
|
|
34615
|
-
),
|
|
34466
|
+
fill: getCustomColor(elem.field) ?? selectColor(elem, colors, stableColorIndex(elem.field)),
|
|
34616
34467
|
isAnimationActive,
|
|
34617
34468
|
shape: customBarShape,
|
|
34618
34469
|
activeBar: customActiveBarShape ?? {
|
|
@@ -59924,6 +59775,32 @@ function useFormReducer(state, action) {
|
|
|
59924
59775
|
}
|
|
59925
59776
|
}
|
|
59926
59777
|
|
|
59778
|
+
// src/utils/pivotDateBuckets.ts
|
|
59779
|
+
var import_date_fns18 = require("date-fns");
|
|
59780
|
+
function buildPivotDateBucketStarts(range, bucket) {
|
|
59781
|
+
const min2 = new Date(range.min);
|
|
59782
|
+
const max2 = new Date(range.max);
|
|
59783
|
+
if (Number.isNaN(min2.getTime()) || Number.isNaN(max2.getTime())) return [];
|
|
59784
|
+
const start = min2 <= max2 ? min2 : max2;
|
|
59785
|
+
const end = min2 <= max2 ? max2 : min2;
|
|
59786
|
+
const asLocalCalendarDate = (date) => new Date(
|
|
59787
|
+
date.getUTCFullYear(),
|
|
59788
|
+
date.getUTCMonth(),
|
|
59789
|
+
date.getUTCDate(),
|
|
59790
|
+
12
|
|
59791
|
+
);
|
|
59792
|
+
const interval = {
|
|
59793
|
+
start: asLocalCalendarDate(start),
|
|
59794
|
+
end: asLocalCalendarDate(end)
|
|
59795
|
+
};
|
|
59796
|
+
const dates = bucket === "day" ? (0, import_date_fns18.eachDayOfInterval)(interval) : bucket === "week" ? (0, import_date_fns18.eachWeekOfInterval)(interval, { weekStartsOn: 1 }) : bucket === "year" ? (0, import_date_fns18.eachYearOfInterval)(interval) : (0, import_date_fns18.eachMonthOfInterval)(interval);
|
|
59797
|
+
return dates.map(
|
|
59798
|
+
(date) => new Date(
|
|
59799
|
+
Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())
|
|
59800
|
+
).toISOString()
|
|
59801
|
+
);
|
|
59802
|
+
}
|
|
59803
|
+
|
|
59927
59804
|
// src/hooks/useForm.queries.ts
|
|
59928
59805
|
var QUERY_KEY_UNDEFINED = "__undefined__";
|
|
59929
59806
|
var QUERY_KEY_FUNCTION = "__function__";
|
|
@@ -60101,70 +59978,6 @@ var AXIS_FORMAT_OPTIONS = [
|
|
|
60101
59978
|
{ value: "MMM_dd_hh:mm_ap_pm", label: "date and time" },
|
|
60102
59979
|
{ value: "hh_ap_pm", label: "hour" }
|
|
60103
59980
|
];
|
|
60104
|
-
var USEFORM_FILTERS_DEBUG_FLAG = "__QUILL_DEBUG_USEFORM_FILTERS__";
|
|
60105
|
-
var USEFORM_REFRESH_DEBUG_FLAG = "__QUILL_DEBUG_USEFORM_REFRESH__";
|
|
60106
|
-
var USEFORM_PIVOT_SHAPE_DEBUG_FLAG = "__QUILL_DEBUG_USEFORM_PIVOT_SHAPE__";
|
|
60107
|
-
var USEFORM_TASK_DEBUG_FLAG = "__QUILL_DEBUG_USEFORM_TASKS__";
|
|
60108
|
-
var isUseFormFiltersDebugEnabled = () => {
|
|
60109
|
-
const globalValue = typeof globalThis !== "undefined" ? globalThis?.[USEFORM_FILTERS_DEBUG_FLAG] : void 0;
|
|
60110
|
-
if (globalValue === true) {
|
|
60111
|
-
return true;
|
|
60112
|
-
}
|
|
60113
|
-
if (typeof process !== "undefined" && typeof process.env !== "undefined") {
|
|
60114
|
-
const envValue = String(
|
|
60115
|
-
process?.env?.QUILL_DEBUG_USEFORM_FILTERS ?? ""
|
|
60116
|
-
).trim().toLowerCase();
|
|
60117
|
-
return envValue === "1" || envValue === "true";
|
|
60118
|
-
}
|
|
60119
|
-
return false;
|
|
60120
|
-
};
|
|
60121
|
-
var isUseFormRefreshDebugEnabled = () => {
|
|
60122
|
-
const globalValue = typeof globalThis !== "undefined" ? globalThis?.[USEFORM_REFRESH_DEBUG_FLAG] : void 0;
|
|
60123
|
-
if (globalValue === true) {
|
|
60124
|
-
return true;
|
|
60125
|
-
}
|
|
60126
|
-
if (typeof process !== "undefined" && typeof process.env !== "undefined") {
|
|
60127
|
-
const envValue = String(
|
|
60128
|
-
process?.env?.QUILL_DEBUG_USEFORM_REFRESH ?? ""
|
|
60129
|
-
).trim().toLowerCase();
|
|
60130
|
-
return envValue === "1" || envValue === "true";
|
|
60131
|
-
}
|
|
60132
|
-
return false;
|
|
60133
|
-
};
|
|
60134
|
-
var isUseFormTaskDebugEnabled = () => {
|
|
60135
|
-
const globalValue = typeof globalThis !== "undefined" ? globalThis?.[USEFORM_TASK_DEBUG_FLAG] : void 0;
|
|
60136
|
-
if (globalValue === true) {
|
|
60137
|
-
return true;
|
|
60138
|
-
}
|
|
60139
|
-
if (typeof process !== "undefined" && typeof process.env !== "undefined") {
|
|
60140
|
-
const envValue = String(
|
|
60141
|
-
process?.env?.QUILL_DEBUG_USEFORM_TASKS ?? ""
|
|
60142
|
-
).trim().toLowerCase();
|
|
60143
|
-
return envValue === "1" || envValue === "true";
|
|
60144
|
-
}
|
|
60145
|
-
return false;
|
|
60146
|
-
};
|
|
60147
|
-
var logUseFormTaskDebug = (label, payload) => {
|
|
60148
|
-
if (!isUseFormTaskDebugEnabled()) return;
|
|
60149
|
-
console.log(`[useReport][task] ${label}`, payload);
|
|
60150
|
-
};
|
|
60151
|
-
var isUseFormPivotShapeDebugEnabled = () => {
|
|
60152
|
-
const globalValue = typeof globalThis !== "undefined" ? globalThis?.[USEFORM_PIVOT_SHAPE_DEBUG_FLAG] : void 0;
|
|
60153
|
-
if (globalValue === true) {
|
|
60154
|
-
return true;
|
|
60155
|
-
}
|
|
60156
|
-
if (typeof process !== "undefined" && typeof process.env !== "undefined") {
|
|
60157
|
-
const envValue = String(
|
|
60158
|
-
process?.env?.QUILL_DEBUG_USEFORM_PIVOT_SHAPE ?? ""
|
|
60159
|
-
).trim().toLowerCase();
|
|
60160
|
-
return envValue === "1" || envValue === "true";
|
|
60161
|
-
}
|
|
60162
|
-
return false;
|
|
60163
|
-
};
|
|
60164
|
-
var logUseFormPivotShapeDebug = (label, payload) => {
|
|
60165
|
-
if (!isUseFormPivotShapeDebugEnabled()) return;
|
|
60166
|
-
console.log(`[useReport][pivot-shape] ${label}`, payload);
|
|
60167
|
-
};
|
|
60168
59981
|
var BOOLEAN_FILTER_VALUE_OPTIONS = [
|
|
60169
59982
|
{ name: "true", label: "True", value: "true" },
|
|
60170
59983
|
{ name: "false", label: "False", value: "false" }
|
|
@@ -61056,30 +60869,24 @@ function shouldUsePivotRowFieldAsXAxis(chartType, pivotRowField, rowColumnFormat
|
|
|
61056
60869
|
function normalizePivotChartForDisplay(chart) {
|
|
61057
60870
|
const swapPivotRowsForChartRows = Boolean(chart?.pivot) && Array.isArray(chart?.pivotRows) && chart.pivotRows.length > 0;
|
|
61058
60871
|
const syntheticAggregationOnlyRows = chart && !swapPivotRowsForChartRows ? buildSyntheticAggregationOnlyDisplayRows(chart) : null;
|
|
60872
|
+
const hasExplicitEmptyGroupedPivot = Boolean(
|
|
60873
|
+
String(chart?.pivot?.rowField ?? "").trim() || String(chart?.pivot?.columnField ?? "").trim()
|
|
60874
|
+
) && Array.isArray(chart?.pivotRows) && chart.pivotRows.length === 0;
|
|
61059
60875
|
const detailRowsAreNotPivotBuckets = Boolean(chart) && !swapPivotRowsForChartRows && !syntheticAggregationOnlyRows && chartDetailRowsMissingPivotRowBucket(chart);
|
|
61060
|
-
logUseFormPivotShapeDebug("normalizePivotChartForDisplay:gate", {
|
|
61061
|
-
hasPivot: Boolean(chart?.pivot),
|
|
61062
|
-
pivotRowField: chart?.pivot?.rowField,
|
|
61063
|
-
pivotRowsIsArray: Array.isArray(chart?.pivotRows),
|
|
61064
|
-
pivotRowsLength: Array.isArray(chart?.pivotRows) ? chart.pivotRows.length : null,
|
|
61065
|
-
incomingChartRowsLength: Array.isArray(chart?.rows) ? chart.rows.length : null,
|
|
61066
|
-
swapPivotRowsForChartRows
|
|
61067
|
-
});
|
|
61068
60876
|
const config = swapPivotRowsForChartRows ? {
|
|
61069
60877
|
...chart,
|
|
61070
60878
|
rows: chart.pivotRows
|
|
61071
60879
|
} : syntheticAggregationOnlyRows ? {
|
|
61072
60880
|
...chart,
|
|
61073
60881
|
rows: syntheticAggregationOnlyRows
|
|
60882
|
+
} : hasExplicitEmptyGroupedPivot ? {
|
|
60883
|
+
...chart,
|
|
60884
|
+
rows: []
|
|
61074
60885
|
} : detailRowsAreNotPivotBuckets ? {
|
|
61075
60886
|
...chart,
|
|
61076
60887
|
rows: []
|
|
61077
60888
|
} : chart;
|
|
61078
60889
|
if (!config) return config;
|
|
61079
|
-
logUseFormPivotShapeDebug("normalizePivotChartForDisplay:postGateRows", {
|
|
61080
|
-
effectiveRowsLength: Array.isArray(config.rows) ? config.rows.length : null,
|
|
61081
|
-
stillUsingDetailRows: Boolean(config.pivot) && !swapPivotRowsForChartRows && Array.isArray(config.rows) && config.rows.length > 0
|
|
61082
|
-
});
|
|
61083
60890
|
if (!config.pivot) return config;
|
|
61084
60891
|
const pivotRowFieldEarly = String(config.pivot?.rowField ?? "").trim();
|
|
61085
60892
|
const rowColumn = (config.pivotColumns ?? config.columns ?? []).find(
|
|
@@ -62722,9 +62529,6 @@ async function loadViaInMemoryEngines({
|
|
|
62722
62529
|
pivot,
|
|
62723
62530
|
reportBuilderState,
|
|
62724
62531
|
allowReportTaskBootstrap = false,
|
|
62725
|
-
debugSource,
|
|
62726
|
-
debugRunId,
|
|
62727
|
-
debugLoadRequestId,
|
|
62728
62532
|
draftSessionId
|
|
62729
62533
|
}) {
|
|
62730
62534
|
const requestedTask = allowReportTaskBootstrap ? "report" : "item";
|
|
@@ -62734,17 +62538,6 @@ async function loadViaInMemoryEngines({
|
|
|
62734
62538
|
rowsPerRequest: DEFAULT_USE_REPORT_ROWS_PER_REQUEST
|
|
62735
62539
|
}
|
|
62736
62540
|
} : {};
|
|
62737
|
-
logUseFormTaskDebug("dispatch fetchReport", {
|
|
62738
|
-
reportId,
|
|
62739
|
-
task: requestedTask,
|
|
62740
|
-
source: debugSource ?? "unknown",
|
|
62741
|
-
runId: debugRunId ?? null,
|
|
62742
|
-
loadRequestId: debugLoadRequestId ?? null,
|
|
62743
|
-
allowReportTaskBootstrap,
|
|
62744
|
-
filterCount: internalFilters.length,
|
|
62745
|
-
hasPivot: Boolean(pivot),
|
|
62746
|
-
hasReportBuilderState: Boolean(reportBuilderState)
|
|
62747
|
-
});
|
|
62748
62541
|
const { report, error } = await fetchReport({
|
|
62749
62542
|
reportId,
|
|
62750
62543
|
client,
|
|
@@ -62824,9 +62617,6 @@ async function loadViaPivotTemplate({
|
|
|
62824
62617
|
reportBuilderState,
|
|
62825
62618
|
baseReport,
|
|
62826
62619
|
schema,
|
|
62827
|
-
debugSource,
|
|
62828
|
-
debugRunId,
|
|
62829
|
-
debugLoadRequestId,
|
|
62830
62620
|
draftSessionId
|
|
62831
62621
|
}) {
|
|
62832
62622
|
const pivotForTemplate = enrichPivotRowFieldTypeForTemplate(
|
|
@@ -62834,16 +62624,6 @@ async function loadViaPivotTemplate({
|
|
|
62834
62624
|
schema,
|
|
62835
62625
|
baseReport
|
|
62836
62626
|
);
|
|
62837
|
-
logUseFormTaskDebug("dispatch fetchReport", {
|
|
62838
|
-
reportId,
|
|
62839
|
-
task: "pivot-template",
|
|
62840
|
-
source: debugSource ?? "unknown",
|
|
62841
|
-
runId: debugRunId ?? null,
|
|
62842
|
-
loadRequestId: debugLoadRequestId ?? null,
|
|
62843
|
-
filterCount: internalFilters.length,
|
|
62844
|
-
hasPivot: Boolean(pivotForTemplate),
|
|
62845
|
-
hasReportBuilderState: Boolean(reportBuilderState)
|
|
62846
|
-
});
|
|
62847
62627
|
const { report, error } = await fetchPivotTemplateReportForUseForm({
|
|
62848
62628
|
reportId,
|
|
62849
62629
|
client,
|
|
@@ -63071,19 +62851,8 @@ async function loadPivotTemplateInParallelWithReportTask({
|
|
|
63071
62851
|
customFields,
|
|
63072
62852
|
dashboardName,
|
|
63073
62853
|
pivotRefreshOnly = false,
|
|
63074
|
-
debugSource,
|
|
63075
|
-
debugRunId,
|
|
63076
|
-
debugLoadRequestId,
|
|
63077
62854
|
draftSessionId
|
|
63078
62855
|
}) {
|
|
63079
|
-
logUseFormTaskDebug("parallel loader route", {
|
|
63080
|
-
reportId,
|
|
63081
|
-
source: debugSource ?? "unknown",
|
|
63082
|
-
runId: debugRunId ?? null,
|
|
63083
|
-
loadRequestId: debugLoadRequestId ?? null,
|
|
63084
|
-
pivotRefreshOnly,
|
|
63085
|
-
tasks: pivotRefreshOnly ? ["pivot-template"] : ["report", "pivot-template", "report-builder-state"]
|
|
63086
|
-
});
|
|
63087
62856
|
if (pivotRefreshOnly) {
|
|
63088
62857
|
const pivotOnlyResult = await loadViaPivotTemplate({
|
|
63089
62858
|
reportId,
|
|
@@ -63096,9 +62865,6 @@ async function loadPivotTemplateInParallelWithReportTask({
|
|
|
63096
62865
|
reportBuilderState,
|
|
63097
62866
|
baseReport,
|
|
63098
62867
|
schema,
|
|
63099
|
-
debugSource,
|
|
63100
|
-
debugRunId,
|
|
63101
|
-
debugLoadRequestId,
|
|
63102
62868
|
draftSessionId
|
|
63103
62869
|
});
|
|
63104
62870
|
return pivotOnlyResult;
|
|
@@ -63114,9 +62880,6 @@ async function loadPivotTemplateInParallelWithReportTask({
|
|
|
63114
62880
|
pivot,
|
|
63115
62881
|
reportBuilderState,
|
|
63116
62882
|
allowReportTaskBootstrap: true,
|
|
63117
|
-
debugSource,
|
|
63118
|
-
debugRunId,
|
|
63119
|
-
debugLoadRequestId,
|
|
63120
62883
|
draftSessionId
|
|
63121
62884
|
}),
|
|
63122
62885
|
loadViaPivotTemplate({
|
|
@@ -63130,9 +62893,6 @@ async function loadPivotTemplateInParallelWithReportTask({
|
|
|
63130
62893
|
reportBuilderState,
|
|
63131
62894
|
baseReport,
|
|
63132
62895
|
schema,
|
|
63133
|
-
debugSource,
|
|
63134
|
-
debugRunId,
|
|
63135
|
-
debugLoadRequestId,
|
|
63136
62896
|
draftSessionId
|
|
63137
62897
|
}),
|
|
63138
62898
|
fetchReportBuilderStateByReportId({
|
|
@@ -63315,9 +63075,6 @@ async function loadReportForUseForm({
|
|
|
63315
63075
|
customFields,
|
|
63316
63076
|
dashboardName,
|
|
63317
63077
|
useInMemoryEngines,
|
|
63318
|
-
debugSource,
|
|
63319
|
-
debugRunId,
|
|
63320
|
-
debugLoadRequestId,
|
|
63321
63078
|
draftSessionId
|
|
63322
63079
|
}) {
|
|
63323
63080
|
const effectivePivot = pivot ?? initialReportBuilderState?.pivot ?? void 0;
|
|
@@ -63326,18 +63083,6 @@ async function loadReportForUseForm({
|
|
|
63326
63083
|
...initialReportBuilderState,
|
|
63327
63084
|
pivot: effectivePivot ?? initialReportBuilderState.pivot ?? null
|
|
63328
63085
|
} : void 0;
|
|
63329
|
-
logUseFormTaskDebug("resolve loader route", {
|
|
63330
|
-
reportId,
|
|
63331
|
-
source: debugSource ?? "unknown",
|
|
63332
|
-
runId: debugRunId ?? null,
|
|
63333
|
-
loadRequestId: debugLoadRequestId ?? null,
|
|
63334
|
-
hasPivot,
|
|
63335
|
-
hasReportBuilderState: Boolean(reportBuilderStateForLoad),
|
|
63336
|
-
allowReportTaskBootstrap,
|
|
63337
|
-
includeReportBuilderStateInPivotTask,
|
|
63338
|
-
filterCount: internalFilters.length,
|
|
63339
|
-
useInMemoryEngines
|
|
63340
|
-
});
|
|
63341
63086
|
if (hasPivot) {
|
|
63342
63087
|
const pivotResult = await loadPivotTemplateInParallelWithReportTask({
|
|
63343
63088
|
reportId,
|
|
@@ -63353,9 +63098,6 @@ async function loadReportForUseForm({
|
|
|
63353
63098
|
customFields,
|
|
63354
63099
|
dashboardName,
|
|
63355
63100
|
pivotRefreshOnly: includeReportBuilderStateInPivotTask,
|
|
63356
|
-
debugSource,
|
|
63357
|
-
debugRunId,
|
|
63358
|
-
debugLoadRequestId,
|
|
63359
63101
|
draftSessionId
|
|
63360
63102
|
});
|
|
63361
63103
|
const pivotRows = pivotResult.report?.pivotRows;
|
|
@@ -63364,7 +63106,7 @@ async function loadReportForUseForm({
|
|
|
63364
63106
|
const hasRowBucketKey = !rowFieldTrimmed || Array.isArray(pivotRows) && pivotRows.some(
|
|
63365
63107
|
(row) => row && typeof row === "object" && Object.prototype.hasOwnProperty.call(row, rowFieldTrimmed)
|
|
63366
63108
|
);
|
|
63367
|
-
const hasMatchingPivotData = pivotResult.report && !pivotResult.error && Array.isArray(pivotRows) && pivotRows.length
|
|
63109
|
+
const hasMatchingPivotData = pivotResult.report && !pivotResult.error && Array.isArray(pivotRows) && (pivotRows.length === 0 || hasRowBucketKey);
|
|
63368
63110
|
if (hasMatchingPivotData) {
|
|
63369
63111
|
return pivotResult;
|
|
63370
63112
|
}
|
|
@@ -63404,25 +63146,12 @@ async function loadReportForUseForm({
|
|
|
63404
63146
|
schema,
|
|
63405
63147
|
customFields,
|
|
63406
63148
|
dashboardName,
|
|
63407
|
-
debugSource,
|
|
63408
|
-
debugRunId,
|
|
63409
|
-
debugLoadRequestId,
|
|
63410
63149
|
draftSessionId
|
|
63411
63150
|
});
|
|
63412
63151
|
const normalizedBootstrapResult = bootstrapResult.report?.pivot == null ? stripPivotFromResult(bootstrapResult) : bootstrapResult;
|
|
63413
63152
|
return normalizedBootstrapResult;
|
|
63414
63153
|
}
|
|
63415
63154
|
const shouldUseReportTaskForReload = internalFilters.length > 0;
|
|
63416
|
-
const resolvedTask = shouldUseReportTaskForReload ? "report" : "item";
|
|
63417
|
-
logUseFormTaskDebug("non-bootstrap task route", {
|
|
63418
|
-
reportId,
|
|
63419
|
-
task: resolvedTask,
|
|
63420
|
-
source: debugSource ?? "unknown",
|
|
63421
|
-
runId: debugRunId ?? null,
|
|
63422
|
-
loadRequestId: debugLoadRequestId ?? null,
|
|
63423
|
-
reason: shouldUseReportTaskForReload ? "live internal filters are present" : "no live internal filters are present",
|
|
63424
|
-
filterCount: internalFilters.length
|
|
63425
|
-
});
|
|
63426
63155
|
return loadViaInMemoryEngines({
|
|
63427
63156
|
reportId,
|
|
63428
63157
|
client,
|
|
@@ -63431,9 +63160,6 @@ async function loadReportForUseForm({
|
|
|
63431
63160
|
tenants,
|
|
63432
63161
|
flags,
|
|
63433
63162
|
allowReportTaskBootstrap: shouldUseReportTaskForReload,
|
|
63434
|
-
debugSource,
|
|
63435
|
-
debugRunId,
|
|
63436
|
-
debugLoadRequestId,
|
|
63437
63163
|
draftSessionId
|
|
63438
63164
|
});
|
|
63439
63165
|
}
|
|
@@ -63452,18 +63178,12 @@ async function loadReportForUseForm({
|
|
|
63452
63178
|
function generateDraftSessionId() {
|
|
63453
63179
|
return typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `draft-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
|
|
63454
63180
|
}
|
|
63455
|
-
var nextUseReportDebugRunId = 0;
|
|
63456
63181
|
function useReport(reportIdArg, options = {}) {
|
|
63457
63182
|
const propReportId = String(reportIdArg ?? "").trim();
|
|
63458
63183
|
const [createdReportId, setCreatedReportId] = (0, import_react61.useState)(null);
|
|
63459
63184
|
const effectiveReportId = propReportId || createdReportId || "";
|
|
63460
63185
|
const { eventTracking } = (0, import_react61.useContext)(EventTrackingContext);
|
|
63461
63186
|
const [draftSessionId, setDraftSessionId] = (0, import_react61.useState)(generateDraftSessionId);
|
|
63462
|
-
const [taskDebugRunId] = (0, import_react61.useState)(() => {
|
|
63463
|
-
nextUseReportDebugRunId += 1;
|
|
63464
|
-
return nextUseReportDebugRunId;
|
|
63465
|
-
});
|
|
63466
|
-
const taskDebugLoadRequestIdRef = (0, import_react61.useRef)(0);
|
|
63467
63187
|
const useInMemoryEngines = options.useInMemoryEngines ?? false;
|
|
63468
63188
|
const restrictFieldOptionsToSelectedDatasources = options.restrictFieldOptionsToSelectedDatasources ?? true;
|
|
63469
63189
|
const reportOverride = options.reportOverride ?? null;
|
|
@@ -63677,8 +63397,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63677
63397
|
filterStackRef.current = filterStack;
|
|
63678
63398
|
const resolvedGroupRowsBy = decodePivotGroupOptionValue(groupRowsBy);
|
|
63679
63399
|
const resolvedGroupColumnsBy = decodePivotGroupOptionValue(groupColumnsBy);
|
|
63680
|
-
const useFormRefreshDebugEnabled = isUseFormRefreshDebugEnabled();
|
|
63681
|
-
const useFormFiltersDebugEnabled = isUseFormFiltersDebugEnabled();
|
|
63682
63400
|
(0, import_react61.useEffect)(() => {
|
|
63683
63401
|
if (propReportId) {
|
|
63684
63402
|
setCreatedReportId(null);
|
|
@@ -64227,26 +63945,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64227
63945
|
const filterUniqueValuesEnabled = Boolean(
|
|
64228
63946
|
client && client?.queryEndpoint && filterUniqueValuesRequest && filterUniqueValuesRequest.stringColumns.length > 0
|
|
64229
63947
|
);
|
|
64230
|
-
(0, import_react61.useEffect)(() => {
|
|
64231
|
-
if (!useFormFiltersDebugEnabled) return;
|
|
64232
|
-
const hasClient = Boolean(client);
|
|
64233
|
-
const hasQueryEndpoint = Boolean(client?.queryEndpoint);
|
|
64234
|
-
const hasRequest = Boolean(filterUniqueValuesRequest);
|
|
64235
|
-
const stringColumnsCount = filterUniqueValuesRequest?.stringColumns.length ?? 0;
|
|
64236
|
-
const stringColumnsByTableCount = filterUniqueValuesRequest?.stringColumnsByTable.length ?? 0;
|
|
64237
|
-
const missingReasons = [];
|
|
64238
|
-
if (!hasClient) missingReasons.push("missing-client");
|
|
64239
|
-
if (!hasQueryEndpoint) missingReasons.push("missing-query-endpoint");
|
|
64240
|
-
if (!hasRequest) missingReasons.push("missing-filterUniqueValuesRequest");
|
|
64241
|
-
if (stringColumnsCount === 0) missingReasons.push("no-string-columns");
|
|
64242
|
-
}, [
|
|
64243
|
-
client,
|
|
64244
|
-
filterUniqueValuesEnabled,
|
|
64245
|
-
filterUniqueValuesRequest,
|
|
64246
|
-
filterUniqueValuesRequestHash,
|
|
64247
|
-
effectiveReportId,
|
|
64248
|
-
useFormFiltersDebugEnabled
|
|
64249
|
-
]);
|
|
64250
63948
|
const filterUniqueValuesQuery = (0, import_react_query2.useQuery)({
|
|
64251
63949
|
queryKey: [
|
|
64252
63950
|
"useReport",
|
|
@@ -64350,22 +64048,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64350
64048
|
filterUniqueValuesQuery.data?.uniqueValuesByColumn,
|
|
64351
64049
|
filterUniqueValuesRequest?.stringColumnsByTable
|
|
64352
64050
|
]);
|
|
64353
|
-
(0, import_react61.useEffect)(() => {
|
|
64354
|
-
if (!useFormFiltersDebugEnabled) return;
|
|
64355
|
-
if (filterUniqueValuesQuery.status !== "success" && filterUniqueValuesQuery.status !== "error") {
|
|
64356
|
-
return;
|
|
64357
|
-
}
|
|
64358
|
-
const uniqueValuesByColumn = filterUniqueValuesQuery.data?.uniqueValuesByColumn ?? {};
|
|
64359
|
-
const uniqueValuesByColumnRecord = uniqueValuesByColumn && typeof uniqueValuesByColumn === "object" ? uniqueValuesByColumn : {};
|
|
64360
|
-
}, [
|
|
64361
|
-
backendUniqueValuesByFieldName,
|
|
64362
|
-
filterUniqueValuesEnabled,
|
|
64363
|
-
filterUniqueValuesQuery.data,
|
|
64364
|
-
filterUniqueValuesQuery.status,
|
|
64365
|
-
filterUniqueValuesRequest,
|
|
64366
|
-
effectiveReportId,
|
|
64367
|
-
useFormFiltersDebugEnabled
|
|
64368
|
-
]);
|
|
64369
64051
|
const filterValueOptionsByFieldName = (0, import_react61.useMemo)(() => {
|
|
64370
64052
|
const optionsByField = /* @__PURE__ */ new Map();
|
|
64371
64053
|
const selectedMultiselectByField = collectSelectedStringMultiselectValuesByField(queryFilters);
|
|
@@ -64766,8 +64448,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64766
64448
|
clientHash
|
|
64767
64449
|
}),
|
|
64768
64450
|
queryFn: createUseFormQueryFn(async () => {
|
|
64769
|
-
taskDebugLoadRequestIdRef.current += 1;
|
|
64770
|
-
const debugLoadRequestId = taskDebugLoadRequestIdRef.current;
|
|
64771
64451
|
const allowReportTaskBootstrap = !initialReportBuilderState && bootstrapReportTaskUsedForReportIdRef.current !== effectiveReportId;
|
|
64772
64452
|
const loadTargetId = String(effectiveReportId ?? "").trim();
|
|
64773
64453
|
const sourceReportIdentity = String(
|
|
@@ -64791,9 +64471,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64791
64471
|
customFields: customFieldsRef.current,
|
|
64792
64472
|
dashboardName: resolvedSourceDashboardName,
|
|
64793
64473
|
useInMemoryEngines,
|
|
64794
|
-
debugSource: "initial-load",
|
|
64795
|
-
debugRunId: taskDebugRunId,
|
|
64796
|
-
debugLoadRequestId,
|
|
64797
64474
|
draftSessionId: draftSessionId || void 0
|
|
64798
64475
|
});
|
|
64799
64476
|
return loadResult;
|
|
@@ -65133,19 +64810,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65133
64810
|
resolveCache.set(fieldName, resolved);
|
|
65134
64811
|
return resolved;
|
|
65135
64812
|
}
|
|
65136
|
-
if (isUseFormFiltersDebugEnabled()) {
|
|
65137
|
-
console.error(
|
|
65138
|
-
"[useForm-debug] normalizeQueryBuilderFieldNameForConfig ambiguous",
|
|
65139
|
-
{
|
|
65140
|
-
fieldName,
|
|
65141
|
-
candidateKeys: candidates.map(([key]) => key),
|
|
65142
|
-
preferredTableNames: Array.from(preferredTableNames),
|
|
65143
|
-
primaryTableName,
|
|
65144
|
-
effectiveReportBuilderTableNames,
|
|
65145
|
-
baseReportBuilderTableNames
|
|
65146
|
-
}
|
|
65147
|
-
);
|
|
65148
|
-
}
|
|
65149
64813
|
return fieldName;
|
|
65150
64814
|
};
|
|
65151
64815
|
}, [
|
|
@@ -65537,8 +65201,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65537
65201
|
}, [
|
|
65538
65202
|
effectiveReportId,
|
|
65539
65203
|
tableRefreshQuery.data,
|
|
65540
|
-
tableRefreshQueryEnabled
|
|
65541
|
-
useFormRefreshDebugEnabled
|
|
65204
|
+
tableRefreshQueryEnabled
|
|
65542
65205
|
]);
|
|
65543
65206
|
const chartTypes = (0, import_react61.useMemo)(() => {
|
|
65544
65207
|
return getChartTypeOptions2({ pivot: pivotState });
|
|
@@ -66101,7 +65764,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66101
65764
|
...sourceReport,
|
|
66102
65765
|
reportBuilderState: effectiveReportBuilderState
|
|
66103
65766
|
};
|
|
66104
|
-
taskDebugLoadRequestIdRef.current += 1;
|
|
66105
65767
|
const pivotRefreshResult = await loadReportForUseForm({
|
|
66106
65768
|
reportId: effectiveReportId,
|
|
66107
65769
|
initialReportBuilderState: effectiveReportBuilderState,
|
|
@@ -66117,9 +65779,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66117
65779
|
customFields: schemaData.customFields,
|
|
66118
65780
|
dashboardName: resolvedSourceDashboardName,
|
|
66119
65781
|
useInMemoryEngines,
|
|
66120
|
-
debugSource: "pivot-refresh",
|
|
66121
|
-
debugRunId: taskDebugRunId,
|
|
66122
|
-
debugLoadRequestId: taskDebugLoadRequestIdRef.current,
|
|
66123
65782
|
draftSessionId: draftSessionId || void 0
|
|
66124
65783
|
});
|
|
66125
65784
|
return pivotRefreshResult;
|
|
@@ -66283,8 +65942,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66283
65942
|
pivotTableDataRefreshQuery.data,
|
|
66284
65943
|
pivotTableDataRefreshQuery.status,
|
|
66285
65944
|
pivotTableDataRefreshQueryEnabled,
|
|
66286
|
-
effectiveReportId
|
|
66287
|
-
useFormRefreshDebugEnabled
|
|
65945
|
+
effectiveReportId
|
|
66288
65946
|
]);
|
|
66289
65947
|
(0, import_react61.useEffect)(() => {
|
|
66290
65948
|
if (!pivotRefreshQueryEnabled) return;
|
|
@@ -66336,8 +65994,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66336
65994
|
pivotRefreshQuery.data,
|
|
66337
65995
|
pivotRefreshQuery.status,
|
|
66338
65996
|
pivotRefreshQueryEnabled,
|
|
66339
|
-
effectiveReportId
|
|
66340
|
-
useFormRefreshDebugEnabled
|
|
65997
|
+
effectiveReportId
|
|
66341
65998
|
]);
|
|
66342
65999
|
const chartData = (0, import_react61.useMemo)(() => {
|
|
66343
66000
|
if (!sourceReport) return void 0;
|
|
@@ -66345,8 +66002,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66345
66002
|
const chartPivotForDisplay = nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
|
|
66346
66003
|
const rowCountForChart = chartPivotForDisplay ? sourceReport.pivotRowCount ?? (Array.isArray(sourceReport.pivotRows) ? sourceReport.pivotRows.length : sourceReport.rowCount) : useInMemoryEngines ? rowsForChart.length : sourceReport.rowCount;
|
|
66347
66004
|
const referencedTablesForChart = effectiveReportBuilderState?.tables.map((table2) => table2.name).filter((name2) => Boolean(name2));
|
|
66348
|
-
const pivotRowsForChart = Array.isArray(sourceReport.pivotRows)
|
|
66349
|
-
const rowCountForChartResolved = chartPivotForDisplay ? pivotRowsForChart
|
|
66005
|
+
const pivotRowsForChart = Array.isArray(sourceReport.pivotRows) ? sourceReport.pivotRows : void 0;
|
|
66006
|
+
const rowCountForChartResolved = chartPivotForDisplay ? Array.isArray(pivotRowsForChart) ? pivotRowsForChart.length : rowCountForChart : rowCountForChart;
|
|
66350
66007
|
const chartDataPayload = {
|
|
66351
66008
|
...sourceReport,
|
|
66352
66009
|
rows: rowsForChart,
|
|
@@ -66357,15 +66014,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66357
66014
|
referencedTables: referencedTablesForChart && referencedTablesForChart.length > 0 ? referencedTablesForChart : sourceReport.referencedTables,
|
|
66358
66015
|
pivotRows: pivotRowsForChart,
|
|
66359
66016
|
pivotColumns: sourceReport.pivotColumns,
|
|
66360
|
-
pivotRowCount: pivotRowsForChart.length
|
|
66017
|
+
pivotRowCount: Array.isArray(pivotRowsForChart) ? pivotRowsForChart.length : sourceReport.pivotRowCount
|
|
66361
66018
|
};
|
|
66362
|
-
logUseFormPivotShapeDebug("chartData:memo", {
|
|
66363
|
-
reportId: sourceReport.id,
|
|
66364
|
-
detailRowsLength: rowsForChart.length,
|
|
66365
|
-
pivotRowsIsArray: Array.isArray(sourceReport.pivotRows),
|
|
66366
|
-
pivotRowsLength: Array.isArray(sourceReport.pivotRows) ? sourceReport.pivotRows.length : null,
|
|
66367
|
-
hasNextPivot: Boolean(nextPivot)
|
|
66368
|
-
});
|
|
66369
66019
|
return chartDataPayload;
|
|
66370
66020
|
}, [
|
|
66371
66021
|
sourceReport,
|
|
@@ -66677,26 +66327,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66677
66327
|
xAxisLabel: resolvedXAxisLabel
|
|
66678
66328
|
});
|
|
66679
66329
|
}
|
|
66680
|
-
logUseFormPivotShapeDebug("chart:formatting(yAxis+pivotColumns)", {
|
|
66681
|
-
chartType: baseChart.chartType,
|
|
66682
|
-
pivotRowField: baseChart.pivot?.rowField,
|
|
66683
|
-
xAxisField: resolvedXAxisField,
|
|
66684
|
-
xAxisFormat: resolvedXAxisFormat,
|
|
66685
|
-
yAxisFieldsForDisplay: (resolvedYAxisFieldsForDisplay ?? []).map((y) => ({
|
|
66686
|
-
field: y.field,
|
|
66687
|
-
format: y.format,
|
|
66688
|
-
label: y.label
|
|
66689
|
-
})),
|
|
66690
|
-
pivotColumnsSample: (baseChart.pivotColumns ?? []).slice(0, 12).map((c) => ({
|
|
66691
|
-
field: c.field,
|
|
66692
|
-
format: c.format,
|
|
66693
|
-
label: c.label
|
|
66694
|
-
})),
|
|
66695
|
-
mergedColumnFormatsSample: (columns2 ?? baseChart.columns ?? []).slice(0, 12).map((c) => ({
|
|
66696
|
-
field: c.field,
|
|
66697
|
-
format: c.format
|
|
66698
|
-
}))
|
|
66699
|
-
});
|
|
66700
66330
|
return {
|
|
66701
66331
|
...baseChart,
|
|
66702
66332
|
xAxisField: resolvedXAxisField,
|
|
@@ -66712,6 +66342,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66712
66342
|
resolvedXAxisLabel,
|
|
66713
66343
|
resolvedYAxisFieldsForDisplay
|
|
66714
66344
|
]);
|
|
66345
|
+
const pivotDateFilterRangeCacheRef = (0, import_react61.useRef)({ key: "", min: null, max: null });
|
|
66715
66346
|
const filterOptions = (0, import_react61.useMemo)(() => {
|
|
66716
66347
|
const out = [];
|
|
66717
66348
|
for (const [field, values] of filterValueOptionsByFieldName) {
|
|
@@ -66727,25 +66358,43 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66727
66358
|
if (rowField && isDateType(String(pivot?.rowFieldType ?? ""))) {
|
|
66728
66359
|
const field = pivot?.rowFieldTable ? `${pivot.rowFieldTable}.${rowField}` : rowField;
|
|
66729
66360
|
const bucket = dateBucket || pivot?.dateBucket || "month";
|
|
66730
|
-
const
|
|
66361
|
+
const labelsByRaw = /* @__PURE__ */ new Map();
|
|
66362
|
+
const cacheKey = `${String(effectiveReportId ?? "")}\0${field}\0${bucket}`;
|
|
66363
|
+
if (pivotDateFilterRangeCacheRef.current.key !== cacheKey) {
|
|
66364
|
+
pivotDateFilterRangeCacheRef.current = {
|
|
66365
|
+
key: cacheKey,
|
|
66366
|
+
min: null,
|
|
66367
|
+
max: null
|
|
66368
|
+
};
|
|
66369
|
+
}
|
|
66731
66370
|
for (const row of chart?.rows ?? []) {
|
|
66732
66371
|
const record = row;
|
|
66733
66372
|
const raw = record.__quillRawDate;
|
|
66734
66373
|
if (raw == null || raw === "") continue;
|
|
66735
66374
|
const key = String(raw);
|
|
66736
|
-
|
|
66737
|
-
|
|
66375
|
+
const timestamp = new Date(key).getTime();
|
|
66376
|
+
if (Number.isNaN(timestamp)) continue;
|
|
66377
|
+
labelsByRaw.set(key, String(record[rowField] ?? key));
|
|
66378
|
+
const cachedMin = pivotDateFilterRangeCacheRef.current.min;
|
|
66379
|
+
const cachedMax = pivotDateFilterRangeCacheRef.current.max;
|
|
66380
|
+
if (cachedMin == null || timestamp < new Date(cachedMin).getTime()) {
|
|
66381
|
+
pivotDateFilterRangeCacheRef.current.min = key;
|
|
66382
|
+
}
|
|
66383
|
+
if (cachedMax == null || timestamp > new Date(cachedMax).getTime()) {
|
|
66384
|
+
pivotDateFilterRangeCacheRef.current.max = key;
|
|
66738
66385
|
}
|
|
66739
66386
|
}
|
|
66387
|
+
const { min: min2, max: max2 } = pivotDateFilterRangeCacheRef.current;
|
|
66388
|
+
const options2 = min2 && max2 ? buildPivotDateBucketStarts({ min: min2, max: max2 }, bucket).map((value) => ({
|
|
66389
|
+
value,
|
|
66390
|
+
label: labelsByRaw.get(value) ?? getDateString(value, void 0, bucket)
|
|
66391
|
+
})) : [];
|
|
66740
66392
|
out.push({
|
|
66741
66393
|
field,
|
|
66742
66394
|
fieldType: "date",
|
|
66743
66395
|
operator: "inBucket",
|
|
66744
66396
|
dateBucket: bucket,
|
|
66745
|
-
options:
|
|
66746
|
-
value,
|
|
66747
|
-
label: byRaw.get(value) ?? value
|
|
66748
|
-
}))
|
|
66397
|
+
options: options2
|
|
66749
66398
|
});
|
|
66750
66399
|
}
|
|
66751
66400
|
return out;
|
|
@@ -66753,6 +66402,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66753
66402
|
chart?.pivot,
|
|
66754
66403
|
chart?.rows,
|
|
66755
66404
|
dateBucket,
|
|
66405
|
+
effectiveReportId,
|
|
66756
66406
|
filterValueOptionsByFieldName
|
|
66757
66407
|
]);
|
|
66758
66408
|
const chartForUi = (0, import_react61.useMemo)(() => {
|
|
@@ -68175,6 +67825,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68175
67825
|
} catch (error) {
|
|
68176
67826
|
console.error("[useForm] setFilters swallowed error", {
|
|
68177
67827
|
error: error instanceof Error ? error.message : String(error),
|
|
67828
|
+
stack: error instanceof Error ? error.stack : void 0,
|
|
68178
67829
|
requestedRules: (resolved?.rules ?? []).map((rule) => ({
|
|
68179
67830
|
table: rule?.table,
|
|
68180
67831
|
field: rule?.field,
|