@quillsql/react 2.16.48 → 2.16.50
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 +1415 -834
- package/dist/index.d.cts +227 -219
- package/dist/index.d.ts +227 -219
- package/dist/index.js +1459 -879
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,89 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
+
// src/utils/textProcessing.ts
|
|
37
|
+
function capitalize(text) {
|
|
38
|
+
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
39
|
+
}
|
|
40
|
+
function matchCasing(text, template) {
|
|
41
|
+
if (!text || !template) {
|
|
42
|
+
return text ?? "";
|
|
43
|
+
}
|
|
44
|
+
const isTitleCase = (str) => /^[A-Z][a-z]*([A-Z][a-z]*)*$/.test(str);
|
|
45
|
+
const isCamelCase = (str) => /^[a-z]+([A-Z][a-z]*)*$/.test(str);
|
|
46
|
+
const isSnakeCase = (str) => /^[a-z0-9]+(_[a-z0-9]+)*$/.test(str);
|
|
47
|
+
const isAllLowerCase = (str) => /^[a-z]+$/.test(str);
|
|
48
|
+
const isAllUpperCase = (str) => /^[A-Z]+$/.test(str);
|
|
49
|
+
const isCapitalized = (str) => /^[A-Z][a-z]*$/.test(str);
|
|
50
|
+
const isScreamingSnakeCase = (str) => /^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$/.test(str);
|
|
51
|
+
const toTitleCase = (str) => str.toLowerCase().replace(/\b\w/g, (char) => char.toUpperCase());
|
|
52
|
+
const toCamelCase = (str) => str.replace(/_./g, (match) => match.charAt(1).toUpperCase()).toLowerCase();
|
|
53
|
+
const toSnakeCase = (str) => str.replace(/[A-Z]/g, (match) => `_${match.toLowerCase()}`);
|
|
54
|
+
const toLowerCase = (str) => str.toLowerCase();
|
|
55
|
+
const toUpperCase = (str) => str.toUpperCase();
|
|
56
|
+
const toCapitalized = (str) => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
57
|
+
const toScreamingSnakeCase = (str) => str.replace(/([A-Z])/g, "_$1").replace(/^_/, "").toUpperCase();
|
|
58
|
+
if (isTitleCase(template)) {
|
|
59
|
+
return toTitleCase(text);
|
|
60
|
+
} else if (isCamelCase(template)) {
|
|
61
|
+
return toCamelCase(text);
|
|
62
|
+
} else if (isSnakeCase(template)) {
|
|
63
|
+
return toSnakeCase(text);
|
|
64
|
+
} else if (isAllLowerCase(template)) {
|
|
65
|
+
return toLowerCase(text);
|
|
66
|
+
} else if (isAllUpperCase(template)) {
|
|
67
|
+
return toUpperCase(text);
|
|
68
|
+
} else if (isCapitalized(template)) {
|
|
69
|
+
return toCapitalized(text);
|
|
70
|
+
} else if (isScreamingSnakeCase(template)) {
|
|
71
|
+
return toScreamingSnakeCase(text);
|
|
72
|
+
} else {
|
|
73
|
+
return text;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function snakeCaseToTitleCase(str) {
|
|
77
|
+
if (!str) {
|
|
78
|
+
return str;
|
|
79
|
+
}
|
|
80
|
+
return str.toString().split(/_| /).map(
|
|
81
|
+
(word) => word === "id" ? "ID" : word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
|
|
82
|
+
).join(" ");
|
|
83
|
+
}
|
|
84
|
+
function snakeAndCamelCaseToTitleCase(str) {
|
|
85
|
+
if (!str || typeof str !== "string") {
|
|
86
|
+
return str;
|
|
87
|
+
}
|
|
88
|
+
if (str.includes("_")) {
|
|
89
|
+
return str.split(/_| /).map((word) => word === "id" ? "ID" : capitalize(word)).join(" ");
|
|
90
|
+
} else {
|
|
91
|
+
const text = str.replace(/([a-z])([A-Z])/g, "$1 $2");
|
|
92
|
+
const newText = text.split(" ").map((word) => word === "Id" || word === "id" ? "ID" : capitalize(word)).join(" ");
|
|
93
|
+
return newText;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function formatIdentifierLabel(str) {
|
|
97
|
+
if (!str || typeof str !== "string") {
|
|
98
|
+
return str;
|
|
99
|
+
}
|
|
100
|
+
const hasUnderscore = str.includes("_");
|
|
101
|
+
const hasCamelCaseBoundary = /[a-z0-9][A-Z]/.test(str);
|
|
102
|
+
if (hasUnderscore || hasCamelCaseBoundary) {
|
|
103
|
+
return snakeAndCamelCaseToTitleCase(str);
|
|
104
|
+
}
|
|
105
|
+
return str;
|
|
106
|
+
}
|
|
107
|
+
function removeDoubleQuotes(str) {
|
|
108
|
+
if (!str) {
|
|
109
|
+
return str;
|
|
110
|
+
}
|
|
111
|
+
return str.replace(/"/g, "");
|
|
112
|
+
}
|
|
113
|
+
var init_textProcessing = __esm({
|
|
114
|
+
"src/utils/textProcessing.ts"() {
|
|
115
|
+
"use strict";
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
36
119
|
// src/utils/valueFormatter.ts
|
|
37
120
|
function parseNumber(value) {
|
|
38
121
|
if (typeof value === "number") return value;
|
|
@@ -59,6 +142,7 @@ var init_valueFormatter = __esm({
|
|
|
59
142
|
"use strict";
|
|
60
143
|
import_date_fns = require("date-fns");
|
|
61
144
|
import_date_fns_tz = require("date-fns-tz");
|
|
145
|
+
init_textProcessing();
|
|
62
146
|
DATE_FORMAT_TYPES = [
|
|
63
147
|
"yyyy",
|
|
64
148
|
"MMM_yyyy",
|
|
@@ -221,7 +305,7 @@ var init_valueFormatter = __esm({
|
|
|
221
305
|
if (typeof value === "object") {
|
|
222
306
|
return JSON.stringify(value);
|
|
223
307
|
}
|
|
224
|
-
return value.toString();
|
|
308
|
+
return formatIdentifierLabel(value.toString());
|
|
225
309
|
};
|
|
226
310
|
formatterDollar = new Intl.NumberFormat("en-US", {
|
|
227
311
|
style: "currency",
|
|
@@ -494,78 +578,6 @@ var init_ast = __esm({
|
|
|
494
578
|
}
|
|
495
579
|
});
|
|
496
580
|
|
|
497
|
-
// src/utils/textProcessing.ts
|
|
498
|
-
function capitalize(text) {
|
|
499
|
-
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
500
|
-
}
|
|
501
|
-
function matchCasing(text, template) {
|
|
502
|
-
if (!text || !template) {
|
|
503
|
-
return text ?? "";
|
|
504
|
-
}
|
|
505
|
-
const isTitleCase = (str) => /^[A-Z][a-z]*([A-Z][a-z]*)*$/.test(str);
|
|
506
|
-
const isCamelCase = (str) => /^[a-z]+([A-Z][a-z]*)*$/.test(str);
|
|
507
|
-
const isSnakeCase = (str) => /^[a-z0-9]+(_[a-z0-9]+)*$/.test(str);
|
|
508
|
-
const isAllLowerCase = (str) => /^[a-z]+$/.test(str);
|
|
509
|
-
const isAllUpperCase = (str) => /^[A-Z]+$/.test(str);
|
|
510
|
-
const isCapitalized = (str) => /^[A-Z][a-z]*$/.test(str);
|
|
511
|
-
const isScreamingSnakeCase = (str) => /^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$/.test(str);
|
|
512
|
-
const toTitleCase = (str) => str.toLowerCase().replace(/\b\w/g, (char) => char.toUpperCase());
|
|
513
|
-
const toCamelCase = (str) => str.replace(/_./g, (match) => match.charAt(1).toUpperCase()).toLowerCase();
|
|
514
|
-
const toSnakeCase = (str) => str.replace(/[A-Z]/g, (match) => `_${match.toLowerCase()}`);
|
|
515
|
-
const toLowerCase = (str) => str.toLowerCase();
|
|
516
|
-
const toUpperCase = (str) => str.toUpperCase();
|
|
517
|
-
const toCapitalized = (str) => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
518
|
-
const toScreamingSnakeCase = (str) => str.replace(/([A-Z])/g, "_$1").replace(/^_/, "").toUpperCase();
|
|
519
|
-
if (isTitleCase(template)) {
|
|
520
|
-
return toTitleCase(text);
|
|
521
|
-
} else if (isCamelCase(template)) {
|
|
522
|
-
return toCamelCase(text);
|
|
523
|
-
} else if (isSnakeCase(template)) {
|
|
524
|
-
return toSnakeCase(text);
|
|
525
|
-
} else if (isAllLowerCase(template)) {
|
|
526
|
-
return toLowerCase(text);
|
|
527
|
-
} else if (isAllUpperCase(template)) {
|
|
528
|
-
return toUpperCase(text);
|
|
529
|
-
} else if (isCapitalized(template)) {
|
|
530
|
-
return toCapitalized(text);
|
|
531
|
-
} else if (isScreamingSnakeCase(template)) {
|
|
532
|
-
return toScreamingSnakeCase(text);
|
|
533
|
-
} else {
|
|
534
|
-
return text;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
function snakeCaseToTitleCase(str) {
|
|
538
|
-
if (!str) {
|
|
539
|
-
return str;
|
|
540
|
-
}
|
|
541
|
-
return str.toString().split(/_| /).map(
|
|
542
|
-
(word) => word === "id" ? "ID" : word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
|
|
543
|
-
).join(" ");
|
|
544
|
-
}
|
|
545
|
-
function snakeAndCamelCaseToTitleCase(str) {
|
|
546
|
-
if (!str || typeof str !== "string") {
|
|
547
|
-
return str;
|
|
548
|
-
}
|
|
549
|
-
if (str.includes("_")) {
|
|
550
|
-
return str.split(/_| /).map((word) => word === "id" ? "ID" : capitalize(word)).join(" ");
|
|
551
|
-
} else {
|
|
552
|
-
const text = str.replace(/([a-z])([A-Z])/g, "$1 $2");
|
|
553
|
-
const newText = text.split(" ").map((word) => word === "Id" || word === "id" ? "ID" : capitalize(word)).join(" ");
|
|
554
|
-
return newText;
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
function removeDoubleQuotes(str) {
|
|
558
|
-
if (!str) {
|
|
559
|
-
return str;
|
|
560
|
-
}
|
|
561
|
-
return str.replace(/"/g, "");
|
|
562
|
-
}
|
|
563
|
-
var init_textProcessing = __esm({
|
|
564
|
-
"src/utils/textProcessing.ts"() {
|
|
565
|
-
"use strict";
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
|
|
569
581
|
// src/components/ReportBuilder/bigDateMap.ts
|
|
570
582
|
function cleanDateFieldName(fieldName) {
|
|
571
583
|
if (!fieldName) return void 0;
|
|
@@ -15085,6 +15097,63 @@ function getDateString(value, dateRange, dateBucket, databaseType) {
|
|
|
15085
15097
|
function isDateField(fieldType) {
|
|
15086
15098
|
return fieldType === "date" || fieldType === "datetime" || fieldType === "timestamp" || fieldType === "timestamptz" || fieldType === "yyyy" || fieldType === "MMM_yyyy" || fieldType === "MMM_dd" || fieldType === "MMM_dd_yyyy" || fieldType === "MMM_dd_hh:mm_ap_pm" || fieldType === "hh_ap_pm";
|
|
15087
15099
|
}
|
|
15100
|
+
function getExclusiveDateBucketRange(startInput, bucket) {
|
|
15101
|
+
const parsed = startInput instanceof Date ? startInput : new Date(startInput);
|
|
15102
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
15103
|
+
throw new Error(`Invalid bucket start date: ${String(startInput)}`);
|
|
15104
|
+
}
|
|
15105
|
+
let start;
|
|
15106
|
+
let endExclusive;
|
|
15107
|
+
switch (bucket) {
|
|
15108
|
+
case "day": {
|
|
15109
|
+
start = new Date(
|
|
15110
|
+
Date.UTC(
|
|
15111
|
+
parsed.getUTCFullYear(),
|
|
15112
|
+
parsed.getUTCMonth(),
|
|
15113
|
+
parsed.getUTCDate()
|
|
15114
|
+
)
|
|
15115
|
+
);
|
|
15116
|
+
endExclusive = new Date(start);
|
|
15117
|
+
endExclusive.setUTCDate(endExclusive.getUTCDate() + 1);
|
|
15118
|
+
break;
|
|
15119
|
+
}
|
|
15120
|
+
case "week": {
|
|
15121
|
+
const day = parsed.getUTCDay();
|
|
15122
|
+
start = new Date(
|
|
15123
|
+
Date.UTC(
|
|
15124
|
+
parsed.getUTCFullYear(),
|
|
15125
|
+
parsed.getUTCMonth(),
|
|
15126
|
+
parsed.getUTCDate() - (day + 6) % 7
|
|
15127
|
+
)
|
|
15128
|
+
);
|
|
15129
|
+
endExclusive = new Date(start);
|
|
15130
|
+
endExclusive.setUTCDate(endExclusive.getUTCDate() + 7);
|
|
15131
|
+
break;
|
|
15132
|
+
}
|
|
15133
|
+
case "month": {
|
|
15134
|
+
start = new Date(
|
|
15135
|
+
Date.UTC(parsed.getUTCFullYear(), parsed.getUTCMonth(), 1)
|
|
15136
|
+
);
|
|
15137
|
+
endExclusive = new Date(
|
|
15138
|
+
Date.UTC(parsed.getUTCFullYear(), parsed.getUTCMonth() + 1, 1)
|
|
15139
|
+
);
|
|
15140
|
+
break;
|
|
15141
|
+
}
|
|
15142
|
+
case "year": {
|
|
15143
|
+
start = new Date(Date.UTC(parsed.getUTCFullYear(), 0, 1));
|
|
15144
|
+
endExclusive = new Date(Date.UTC(parsed.getUTCFullYear() + 1, 0, 1));
|
|
15145
|
+
break;
|
|
15146
|
+
}
|
|
15147
|
+
default: {
|
|
15148
|
+
const _exhaustive = bucket;
|
|
15149
|
+
throw new Error(`Unsupported date bucket: ${String(_exhaustive)}`);
|
|
15150
|
+
}
|
|
15151
|
+
}
|
|
15152
|
+
return {
|
|
15153
|
+
start: start.toISOString(),
|
|
15154
|
+
endExclusive: endExclusive.toISOString()
|
|
15155
|
+
};
|
|
15156
|
+
}
|
|
15088
15157
|
var import_date_fns5;
|
|
15089
15158
|
var init_dates = __esm({
|
|
15090
15159
|
"src/utils/dates.ts"() {
|
|
@@ -17206,7 +17275,7 @@ async function generatePivotWithSQL({
|
|
|
17206
17275
|
client,
|
|
17207
17276
|
task: "pivot-template",
|
|
17208
17277
|
metadata: {
|
|
17209
|
-
clientId: client.
|
|
17278
|
+
clientId: client.id,
|
|
17210
17279
|
pivot: pivotConfig,
|
|
17211
17280
|
reportId: report?.id !== "__quillTempReport" ? report?.id : void 0,
|
|
17212
17281
|
itemQuery: reportBuilderState ? void 0 : report?.queryString,
|
|
@@ -19032,7 +19101,7 @@ var init_tableProcessing = __esm({
|
|
|
19032
19101
|
metadata: {
|
|
19033
19102
|
reportBuilderState,
|
|
19034
19103
|
stringColumns: stringColumns.map((col) => col.field),
|
|
19035
|
-
clientId: client.
|
|
19104
|
+
clientId: client.id,
|
|
19036
19105
|
databaseType: client.databaseType?.toLowerCase() || "postgresql",
|
|
19037
19106
|
customFields,
|
|
19038
19107
|
filters: void 0,
|
|
@@ -19223,7 +19292,7 @@ var init_tableProcessing = __esm({
|
|
|
19223
19292
|
metadata: {
|
|
19224
19293
|
reportBuilderState,
|
|
19225
19294
|
columns: stringNames,
|
|
19226
|
-
clientId: client.
|
|
19295
|
+
clientId: client.id,
|
|
19227
19296
|
databaseType: client.databaseType,
|
|
19228
19297
|
customFieldsByTable: customFields,
|
|
19229
19298
|
useNewNodeSql: true,
|
|
@@ -19238,7 +19307,7 @@ var init_tableProcessing = __esm({
|
|
|
19238
19307
|
task: "query",
|
|
19239
19308
|
metadata: {
|
|
19240
19309
|
query: countQuery,
|
|
19241
|
-
clientId: client.
|
|
19310
|
+
clientId: client.id,
|
|
19242
19311
|
databaseType: client.databaseType,
|
|
19243
19312
|
customFieldsByTable: customFields,
|
|
19244
19313
|
useNewNodeSql: true,
|
|
@@ -19298,7 +19367,7 @@ var init_tableProcessing = __esm({
|
|
|
19298
19367
|
metadata: {
|
|
19299
19368
|
reportBuilderState,
|
|
19300
19369
|
stringColumns: columns,
|
|
19301
|
-
clientId: client.
|
|
19370
|
+
clientId: client.id,
|
|
19302
19371
|
databaseType: client.databaseType?.toLowerCase() || "postgresql",
|
|
19303
19372
|
customFields,
|
|
19304
19373
|
filters,
|
|
@@ -19348,7 +19417,7 @@ var init_tableProcessing = __esm({
|
|
|
19348
19417
|
task: "query",
|
|
19349
19418
|
metadata: {
|
|
19350
19419
|
query,
|
|
19351
|
-
clientId: client.
|
|
19420
|
+
clientId: client.id,
|
|
19352
19421
|
databaseType: client.databaseType,
|
|
19353
19422
|
customFieldsByTable: customFields,
|
|
19354
19423
|
useNewNodeSql: true,
|
|
@@ -19460,7 +19529,7 @@ var init_tableProcessing = __esm({
|
|
|
19460
19529
|
task: "query",
|
|
19461
19530
|
metadata: {
|
|
19462
19531
|
query,
|
|
19463
|
-
clientId: client.
|
|
19532
|
+
clientId: client.id,
|
|
19464
19533
|
databaseType: client.databaseType,
|
|
19465
19534
|
customFieldsByTable: customFields,
|
|
19466
19535
|
useNewNodeSql: true,
|
|
@@ -19589,7 +19658,7 @@ var init_tableProcessing = __esm({
|
|
|
19589
19658
|
metadata: {
|
|
19590
19659
|
query,
|
|
19591
19660
|
filterMap,
|
|
19592
|
-
clientId: client.
|
|
19661
|
+
clientId: client.id,
|
|
19593
19662
|
databaseType: client?.databaseType,
|
|
19594
19663
|
customFieldsByTable: customFields,
|
|
19595
19664
|
additionalProcessing: processing,
|
|
@@ -19624,7 +19693,7 @@ var init_tableProcessing = __esm({
|
|
|
19624
19693
|
task: "log-broken-query",
|
|
19625
19694
|
metadata: {
|
|
19626
19695
|
query,
|
|
19627
|
-
clientId: client.
|
|
19696
|
+
clientId: client.id,
|
|
19628
19697
|
error: parsingError
|
|
19629
19698
|
},
|
|
19630
19699
|
getToken
|
|
@@ -19735,7 +19804,7 @@ var init_tableProcessing = __esm({
|
|
|
19735
19804
|
metadata: {
|
|
19736
19805
|
dashboardItemId: reportId,
|
|
19737
19806
|
filters: minimalFilters,
|
|
19738
|
-
clientId: client?.
|
|
19807
|
+
clientId: client?.id,
|
|
19739
19808
|
databaseType: client?.databaseType,
|
|
19740
19809
|
additionalProcessing: updatedProcessing,
|
|
19741
19810
|
forcePagination: true,
|
|
@@ -19808,7 +19877,7 @@ var init_tableProcessing = __esm({
|
|
|
19808
19877
|
rowCountOnly,
|
|
19809
19878
|
customFields,
|
|
19810
19879
|
tenants,
|
|
19811
|
-
clientId: client.
|
|
19880
|
+
clientId: client.id,
|
|
19812
19881
|
databaseType: client.databaseType?.toLowerCase() || "postgresql",
|
|
19813
19882
|
dashboardName,
|
|
19814
19883
|
...reportId ? {
|
|
@@ -19979,7 +20048,7 @@ async function testSqlViewState(client, referencedTables, getToken) {
|
|
|
19979
20048
|
task: "test-view",
|
|
19980
20049
|
metadata: {
|
|
19981
20050
|
tables: [table],
|
|
19982
|
-
clientId: client.
|
|
20051
|
+
clientId: client.id
|
|
19983
20052
|
},
|
|
19984
20053
|
getToken
|
|
19985
20054
|
});
|
|
@@ -19988,7 +20057,7 @@ async function testSqlViewState(client, referencedTables, getToken) {
|
|
|
19988
20057
|
metadata: {
|
|
19989
20058
|
table,
|
|
19990
20059
|
task: "set-broken-view",
|
|
19991
|
-
clientId: client.
|
|
20060
|
+
clientId: client.id
|
|
19992
20061
|
}
|
|
19993
20062
|
};
|
|
19994
20063
|
quillFetch({
|
|
@@ -20098,7 +20167,7 @@ async function* quillStream({
|
|
|
20098
20167
|
body: JSON.stringify({
|
|
20099
20168
|
metadata: {
|
|
20100
20169
|
task,
|
|
20101
|
-
clientId: client.
|
|
20170
|
+
clientId: client.id,
|
|
20102
20171
|
...metadata
|
|
20103
20172
|
}
|
|
20104
20173
|
}),
|
|
@@ -20327,7 +20396,7 @@ async function getData(client, cloudQueryEndpoint, noCred, hostedRequestBody, cl
|
|
|
20327
20396
|
body: method === "POST" ? JSON.stringify({
|
|
20328
20397
|
...cloudRequestBody,
|
|
20329
20398
|
...{
|
|
20330
|
-
publicKey: client?.
|
|
20399
|
+
publicKey: client?.id
|
|
20331
20400
|
}
|
|
20332
20401
|
}) : null,
|
|
20333
20402
|
signal: abortSignal
|
|
@@ -20356,7 +20425,7 @@ async function fetchSqlQuery(ast, client, getToken, formData) {
|
|
|
20356
20425
|
client,
|
|
20357
20426
|
task: "sqlify",
|
|
20358
20427
|
metadata: {
|
|
20359
|
-
clientId: client.
|
|
20428
|
+
clientId: client.id,
|
|
20360
20429
|
useNewNodeSql: true,
|
|
20361
20430
|
ast: { ...ast, where }
|
|
20362
20431
|
},
|
|
@@ -20377,7 +20446,7 @@ async function fetchSqlQueryFromState(reportBuilderState, client, getToken, data
|
|
|
20377
20446
|
client,
|
|
20378
20447
|
task: "sqlify",
|
|
20379
20448
|
metadata: {
|
|
20380
|
-
clientId: client.
|
|
20449
|
+
clientId: client.id,
|
|
20381
20450
|
useNewNodeSql: true,
|
|
20382
20451
|
ast
|
|
20383
20452
|
},
|
|
@@ -20394,7 +20463,7 @@ async function fetchQueryDateRangesFromState(reportBuilderState, columns, client
|
|
|
20394
20463
|
client,
|
|
20395
20464
|
task: "report-builder-date-ranges",
|
|
20396
20465
|
metadata: {
|
|
20397
|
-
clientId: client.
|
|
20466
|
+
clientId: client.id,
|
|
20398
20467
|
reportBuilderState,
|
|
20399
20468
|
dateColumns: columns,
|
|
20400
20469
|
databaseType: databaseType || "postgresql",
|
|
@@ -20512,7 +20581,7 @@ var init_dataFetcher = __esm({
|
|
|
20512
20581
|
body: JSON.stringify({
|
|
20513
20582
|
metadata: {
|
|
20514
20583
|
task,
|
|
20515
|
-
clientId: client.clientId,
|
|
20584
|
+
clientId: client.id ?? client.clientId,
|
|
20516
20585
|
...metadata
|
|
20517
20586
|
}
|
|
20518
20587
|
}),
|
|
@@ -21022,7 +21091,6 @@ __export(index_exports, {
|
|
|
21022
21091
|
Table: () => Table_default,
|
|
21023
21092
|
ThemeContext: () => ThemeContext,
|
|
21024
21093
|
areQueryBuilderFilterDraftsDirty: () => areQueryBuilderFilterDraftsDirty,
|
|
21025
|
-
buildSeededFilterQuery: () => buildSeededFilterQuery,
|
|
21026
21094
|
countFilterRules: () => countFilterRules,
|
|
21027
21095
|
defaultFilterRuleValueForOperator: () => defaultFilterRuleValueForOperator,
|
|
21028
21096
|
downloadCSV: () => downloadCSV,
|
|
@@ -21031,6 +21099,7 @@ __export(index_exports, {
|
|
|
21031
21099
|
isQueryBuilderDisplayRule: () => isQueryBuilderDisplayRule,
|
|
21032
21100
|
normalizeRelativeDateRules: () => normalizeRelativeDateRules,
|
|
21033
21101
|
prepareQueryBuilderFiltersForSet: () => prepareQueryBuilderFiltersForSet,
|
|
21102
|
+
queryBuilderFiltersForEditor: () => queryBuilderFiltersForEditor,
|
|
21034
21103
|
quillFetch: () => quillFetch,
|
|
21035
21104
|
stripQueryBuilderTransientFields: () => stripQueryBuilderTransientFields,
|
|
21036
21105
|
tableColumnFormatFromUiSelection: () => tableColumnFormatFromUiSelection,
|
|
@@ -21047,6 +21116,7 @@ __export(index_exports, {
|
|
|
21047
21116
|
useQuill: () => useQuill,
|
|
21048
21117
|
useReport: () => useReport,
|
|
21049
21118
|
useReportBuilder: () => useReportBuilder,
|
|
21119
|
+
useReportQueryBuilder: () => useReportQueryBuilder,
|
|
21050
21120
|
useReports: () => useReports,
|
|
21051
21121
|
useTenants: () => useTenants,
|
|
21052
21122
|
useVirtualTables: () => useVirtualTables
|
|
@@ -21530,7 +21600,7 @@ async function getDashboard(dashboardName, client, getToken, tenants, flags) {
|
|
|
21530
21600
|
task: "dashboard",
|
|
21531
21601
|
metadata: {
|
|
21532
21602
|
name: dashboardName,
|
|
21533
|
-
clientId: client.
|
|
21603
|
+
clientId: client.id,
|
|
21534
21604
|
databaseType: client.databaseType,
|
|
21535
21605
|
useNewNodeSql: true,
|
|
21536
21606
|
tenants,
|
|
@@ -21905,7 +21975,7 @@ function createPivotTemplateMetadata({
|
|
|
21905
21975
|
reportId,
|
|
21906
21976
|
dashboardItemId: reportId,
|
|
21907
21977
|
...draftSessionId ? { draftSessionId: String(draftSessionId).trim() } : {},
|
|
21908
|
-
clientId: client.
|
|
21978
|
+
clientId: client.id,
|
|
21909
21979
|
databaseType: client.databaseType,
|
|
21910
21980
|
filters: removeFilterOptions(filters),
|
|
21911
21981
|
additionalProcessing: normalizedAdditionalProcessing,
|
|
@@ -22222,7 +22292,7 @@ async function fetchReportRows({
|
|
|
22222
22292
|
task: "report",
|
|
22223
22293
|
metadata: {
|
|
22224
22294
|
reportId,
|
|
22225
|
-
clientId: client.
|
|
22295
|
+
clientId: client.id,
|
|
22226
22296
|
databaseType: client.databaseType,
|
|
22227
22297
|
filters: filters.map((filter) => ({ ...filter, options: void 0 })),
|
|
22228
22298
|
useNewNodeSql: true,
|
|
@@ -22292,7 +22362,7 @@ async function fetchReport({
|
|
|
22292
22362
|
reportId,
|
|
22293
22363
|
dashboardItemId: reportId,
|
|
22294
22364
|
...draftSessionId ? { draftSessionId: String(draftSessionId).trim() } : {},
|
|
22295
|
-
clientId: client.
|
|
22365
|
+
clientId: client.id,
|
|
22296
22366
|
databaseType: client.databaseType,
|
|
22297
22367
|
filters: filters.map((filter) => ({ ...filter, options: void 0 })),
|
|
22298
22368
|
customFields,
|
|
@@ -22429,7 +22499,7 @@ async function fetchReportName({
|
|
|
22429
22499
|
task: "report-name",
|
|
22430
22500
|
metadata: {
|
|
22431
22501
|
reportId,
|
|
22432
|
-
clientId: client.
|
|
22502
|
+
clientId: client.id,
|
|
22433
22503
|
databaseType: client.databaseType,
|
|
22434
22504
|
tenants
|
|
22435
22505
|
},
|
|
@@ -22453,7 +22523,7 @@ async function fetchReportRowCount(reportId, client, getToken, tenants, flags, u
|
|
|
22453
22523
|
metadata: {
|
|
22454
22524
|
reportId,
|
|
22455
22525
|
dashboardItemId: reportId,
|
|
22456
|
-
clientId: client.
|
|
22526
|
+
clientId: client.id,
|
|
22457
22527
|
databaseType: client.databaseType,
|
|
22458
22528
|
filters: filters.map((filter) => ({ ...filter, options: void 0 })),
|
|
22459
22529
|
customFields,
|
|
@@ -22483,7 +22553,7 @@ async function saveReport({
|
|
|
22483
22553
|
tenants,
|
|
22484
22554
|
draftSessionId
|
|
22485
22555
|
}) {
|
|
22486
|
-
const {
|
|
22556
|
+
const { id, databaseType } = client;
|
|
22487
22557
|
const {
|
|
22488
22558
|
reportBuilderState,
|
|
22489
22559
|
queryString,
|
|
@@ -22523,7 +22593,7 @@ async function saveReport({
|
|
|
22523
22593
|
...dashboardItemId ? { reportId: dashboardItemId } : {},
|
|
22524
22594
|
...draftSessionId ? { draftSessionId: String(draftSessionId).trim() } : {},
|
|
22525
22595
|
// Remove useNewNodeSql since backend will handle conversion
|
|
22526
|
-
clientId:
|
|
22596
|
+
clientId: id,
|
|
22527
22597
|
tenants,
|
|
22528
22598
|
// Only include adminMode for 'create' task, not 'create-report'
|
|
22529
22599
|
...isCreateTask && { adminMode },
|
|
@@ -23337,7 +23407,6 @@ var getSchemaInfo = async ({
|
|
|
23337
23407
|
getToken,
|
|
23338
23408
|
eventTracking
|
|
23339
23409
|
}) => {
|
|
23340
|
-
const { publicKey } = client;
|
|
23341
23410
|
let customFieldsByTableUnique = null;
|
|
23342
23411
|
if (client.featureFlags?.customFieldsEnabled && tenants && tenants[0] !== "QUILL_ALL_TENANTS" && tenants.length === 1 && (typeof tenants[0] !== "object" || tenants[0].tenantIds?.[0] !== "QUILL_ALL_TENANTS" && tenants[0].tenantIds?.length === 1)) {
|
|
23343
23412
|
try {
|
|
@@ -23356,13 +23425,13 @@ var getSchemaInfo = async ({
|
|
|
23356
23425
|
client,
|
|
23357
23426
|
task: "schema",
|
|
23358
23427
|
metadata: {
|
|
23359
|
-
clientId:
|
|
23428
|
+
clientId: client.id,
|
|
23360
23429
|
removeCustomerField: true,
|
|
23361
23430
|
removeCustomFieldRef: true,
|
|
23362
23431
|
tableIds,
|
|
23363
23432
|
customFieldsByTable: customFieldsByTableUnique,
|
|
23364
23433
|
useNewCustomFields: true,
|
|
23365
|
-
gatherSchemaData: "665610862cf7a3000be66453" ===
|
|
23434
|
+
gatherSchemaData: "665610862cf7a3000be66453" === client.id ? true : false,
|
|
23366
23435
|
// TODO: this should be a feature flag on the client
|
|
23367
23436
|
tenants
|
|
23368
23437
|
},
|
|
@@ -24461,7 +24530,7 @@ var CacheCab = class {
|
|
|
24461
24530
|
task: "report",
|
|
24462
24531
|
metadata: {
|
|
24463
24532
|
reportId,
|
|
24464
|
-
clientId: client.
|
|
24533
|
+
clientId: client.id,
|
|
24465
24534
|
databaseType: client.databaseType,
|
|
24466
24535
|
filters: adjusted,
|
|
24467
24536
|
additionalProcessing: { page: { rowsPerPage: 1e3, rowsPerRequest: 1e5 } },
|
|
@@ -24600,7 +24669,7 @@ var CacheCab = class {
|
|
|
24600
24669
|
);
|
|
24601
24670
|
const keyParts = [
|
|
24602
24671
|
reportId,
|
|
24603
|
-
client.
|
|
24672
|
+
client.id,
|
|
24604
24673
|
client.databaseType,
|
|
24605
24674
|
hashString(stableStringify(canonicalizeForKey(tenants ?? null))),
|
|
24606
24675
|
hashString(stableStringify(canonicalizeForKey(flags ?? null))),
|
|
@@ -25238,12 +25307,11 @@ var ContextProvider = ({
|
|
|
25238
25307
|
typeof window !== "undefined" && sessionStorage ? JSON.parse(sessionStorage.getItem("quill-client") ?? "null") : null
|
|
25239
25308
|
);
|
|
25240
25309
|
const populatedClient = (0, import_react.useMemo)(() => {
|
|
25241
|
-
if (!client || client.
|
|
25310
|
+
if (!client || client.id !== publicKey) return null;
|
|
25242
25311
|
return {
|
|
25243
25312
|
...client,
|
|
25244
|
-
publicKey,
|
|
25245
|
-
_id: publicKey,
|
|
25246
25313
|
id: publicKey,
|
|
25314
|
+
clientId: publicKey,
|
|
25247
25315
|
queryHeaders,
|
|
25248
25316
|
queryEndpoint,
|
|
25249
25317
|
streamEndpoint,
|
|
@@ -25406,7 +25474,7 @@ var ContextProvider = ({
|
|
|
25406
25474
|
try {
|
|
25407
25475
|
const result = await quillFetch({
|
|
25408
25476
|
client: {
|
|
25409
|
-
|
|
25477
|
+
id: publicKey,
|
|
25410
25478
|
queryEndpoint,
|
|
25411
25479
|
queryHeaders,
|
|
25412
25480
|
withCredentials: !!withCredentials
|
|
@@ -25528,7 +25596,7 @@ var ContextProvider = ({
|
|
|
25528
25596
|
try {
|
|
25529
25597
|
const resp = await quillFetch({
|
|
25530
25598
|
client: {
|
|
25531
|
-
|
|
25599
|
+
id: publicKey,
|
|
25532
25600
|
queryEndpoint,
|
|
25533
25601
|
queryHeaders,
|
|
25534
25602
|
withCredentials: !!withCredentials
|
|
@@ -25536,7 +25604,7 @@ var ContextProvider = ({
|
|
|
25536
25604
|
task: fetchRows ? "report" : "report-info",
|
|
25537
25605
|
metadata: {
|
|
25538
25606
|
reportId,
|
|
25539
|
-
clientId: populatedClient.
|
|
25607
|
+
clientId: populatedClient.id,
|
|
25540
25608
|
useNewNodeSql: true,
|
|
25541
25609
|
filters: filters?.map((f) => ({ ...f, options: void 0 })),
|
|
25542
25610
|
additionalProcessing,
|
|
@@ -25719,7 +25787,7 @@ var ContextProvider = ({
|
|
|
25719
25787
|
try {
|
|
25720
25788
|
const result = await quillFetch({
|
|
25721
25789
|
client: {
|
|
25722
|
-
|
|
25790
|
+
id: publicKey,
|
|
25723
25791
|
queryEndpoint,
|
|
25724
25792
|
queryHeaders,
|
|
25725
25793
|
withCredentials: !!withCredentials
|
|
@@ -25939,7 +26007,7 @@ var ContextProvider = ({
|
|
|
25939
26007
|
});
|
|
25940
26008
|
return curDashboardConfig;
|
|
25941
26009
|
}
|
|
25942
|
-
if (!populatedClient || !populatedClient.
|
|
26010
|
+
if (!populatedClient || !populatedClient.id) {
|
|
25943
26011
|
return curDashboardConfig;
|
|
25944
26012
|
}
|
|
25945
26013
|
if (dashboardName === null || dashboardName === void 0)
|
|
@@ -26093,7 +26161,7 @@ var ContextProvider = ({
|
|
|
26093
26161
|
try {
|
|
26094
26162
|
const result = await quillFetch({
|
|
26095
26163
|
client: {
|
|
26096
|
-
|
|
26164
|
+
id: publicKey2,
|
|
26097
26165
|
queryEndpoint,
|
|
26098
26166
|
queryHeaders,
|
|
26099
26167
|
withCredentials: !!withCredentials
|
|
@@ -26636,8 +26704,7 @@ var ContextProvider = ({
|
|
|
26636
26704
|
withCredentials: withCredentials ?? false,
|
|
26637
26705
|
databaseType: envClient.databaseType,
|
|
26638
26706
|
name: envClient.name,
|
|
26639
|
-
|
|
26640
|
-
publicKey: publicKey2,
|
|
26707
|
+
id: publicKey2,
|
|
26641
26708
|
featureFlags: envClient.featureFlags,
|
|
26642
26709
|
clerkOrgId: envClient.clerkOrgId,
|
|
26643
26710
|
allTenantTypes: hydratedTenantTypes
|
|
@@ -26709,16 +26776,16 @@ var ContextProvider = ({
|
|
|
26709
26776
|
}, [publicKey]);
|
|
26710
26777
|
(0, import_react.useEffect)(() => {
|
|
26711
26778
|
if (!hasHandledInitialPopulatedClient.current) {
|
|
26712
|
-
if (!populatedClient?.
|
|
26779
|
+
if (!populatedClient?.id && !populatedClient?.currentTenants) {
|
|
26713
26780
|
return;
|
|
26714
26781
|
}
|
|
26715
26782
|
hasHandledInitialPopulatedClient.current = true;
|
|
26716
|
-
currentPublicKey.current = populatedClient?.
|
|
26783
|
+
currentPublicKey.current = populatedClient?.id ?? null;
|
|
26717
26784
|
currentTenant.current = populatedClient?.currentTenants ?? null;
|
|
26718
26785
|
return;
|
|
26719
26786
|
}
|
|
26720
26787
|
let publicKeyChanged = false;
|
|
26721
|
-
if (populatedClient?.
|
|
26788
|
+
if (populatedClient?.id && currentPublicKey.current !== populatedClient?.id) {
|
|
26722
26789
|
publicKeyChanged = true;
|
|
26723
26790
|
dispatch({ type: "CLEAR_DASHBOARDS" });
|
|
26724
26791
|
dashboardFiltersDispatch({ type: "CLEAR_DASHBOARD_FILTERS" });
|
|
@@ -26727,7 +26794,7 @@ var ContextProvider = ({
|
|
|
26727
26794
|
backfilledDashboards.current.clear();
|
|
26728
26795
|
if (isAdmin) {
|
|
26729
26796
|
setIsDashboardsLoading(true);
|
|
26730
|
-
fetchDashboards(populatedClient?.
|
|
26797
|
+
fetchDashboards(populatedClient?.id);
|
|
26731
26798
|
} else {
|
|
26732
26799
|
setIsDashboardsLoading(false);
|
|
26733
26800
|
}
|
|
@@ -26759,17 +26826,17 @@ var ContextProvider = ({
|
|
|
26759
26826
|
})
|
|
26760
26827
|
);
|
|
26761
26828
|
}
|
|
26762
|
-
if (populatedClient?.currentTenants && populatedClient?.
|
|
26829
|
+
if (populatedClient?.currentTenants && populatedClient?.id) {
|
|
26763
26830
|
const tenant = typeof populatedClient?.currentTenants[0] === "object" ? populatedClient?.currentTenants[0]?.tenantField : void 0;
|
|
26764
26831
|
const tenantIds = tenant && typeof populatedClient?.currentTenants[0] === "object" ? populatedClient?.currentTenants[0]?.tenantIds : populatedClient?.currentTenants;
|
|
26765
26832
|
eventTracking?.setUser?.({
|
|
26766
|
-
clientId: populatedClient.
|
|
26833
|
+
clientId: populatedClient.id,
|
|
26767
26834
|
clerkOrgId: populatedClient.clerkOrgId,
|
|
26768
26835
|
tenant,
|
|
26769
26836
|
tenantIds
|
|
26770
26837
|
});
|
|
26771
26838
|
}
|
|
26772
|
-
}, [populatedClient?.currentTenants, populatedClient?.
|
|
26839
|
+
}, [populatedClient?.currentTenants, populatedClient?.id]);
|
|
26773
26840
|
if (!theme) {
|
|
26774
26841
|
return null;
|
|
26775
26842
|
}
|
|
@@ -27078,7 +27145,7 @@ var useDashboardInternal = (dashboardName, customFilters) => {
|
|
|
27078
27145
|
});
|
|
27079
27146
|
const body = {
|
|
27080
27147
|
task: "set-section-order",
|
|
27081
|
-
clientId: client.
|
|
27148
|
+
clientId: client.id,
|
|
27082
27149
|
dashboardName,
|
|
27083
27150
|
sectionOrder
|
|
27084
27151
|
};
|
|
@@ -27306,7 +27373,7 @@ var useDashboards = () => {
|
|
|
27306
27373
|
dateFilter,
|
|
27307
27374
|
name: name2.trim(),
|
|
27308
27375
|
task: "edit-dashboard",
|
|
27309
|
-
clientId: clientId ?? client.
|
|
27376
|
+
clientId: clientId ?? client.id,
|
|
27310
27377
|
tenantKeys: dashboardOwners
|
|
27311
27378
|
};
|
|
27312
27379
|
try {
|
|
@@ -27381,7 +27448,7 @@ var useDashboards = () => {
|
|
|
27381
27448
|
initialCacheDateRange,
|
|
27382
27449
|
name: name2.trim(),
|
|
27383
27450
|
task: "edit-dashboard",
|
|
27384
|
-
clientId: clientId ?? client.
|
|
27451
|
+
clientId: clientId ?? client.id,
|
|
27385
27452
|
tenantKeys
|
|
27386
27453
|
};
|
|
27387
27454
|
try {
|
|
@@ -27559,7 +27626,7 @@ var useDashboards = () => {
|
|
|
27559
27626
|
client,
|
|
27560
27627
|
task: "delete-dashboard",
|
|
27561
27628
|
metadata: {
|
|
27562
|
-
clientId: client.
|
|
27629
|
+
clientId: client.id,
|
|
27563
27630
|
databaseType: client.databaseType,
|
|
27564
27631
|
name: name2
|
|
27565
27632
|
}
|
|
@@ -28404,7 +28471,7 @@ async function getExportData(client, dashboardFilters, reportId, getToken, event
|
|
|
28404
28471
|
metadata: {
|
|
28405
28472
|
reportId,
|
|
28406
28473
|
dashboardItemId: reportId,
|
|
28407
|
-
clientId: client.
|
|
28474
|
+
clientId: client.id,
|
|
28408
28475
|
databaseType: client?.databaseType,
|
|
28409
28476
|
filters: minimalFilters,
|
|
28410
28477
|
useNewNodeSql: true,
|
|
@@ -29177,6 +29244,69 @@ function linspace(start, end, num) {
|
|
|
29177
29244
|
}
|
|
29178
29245
|
return result;
|
|
29179
29246
|
}
|
|
29247
|
+
function stableColorIndex(field) {
|
|
29248
|
+
let hash = 0;
|
|
29249
|
+
for (const character of field.replace("comparison_", "")) {
|
|
29250
|
+
hash = Math.imul(hash, 31) + character.charCodeAt(0) >>> 0;
|
|
29251
|
+
}
|
|
29252
|
+
return hash;
|
|
29253
|
+
}
|
|
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
|
+
}
|
|
29180
29310
|
function selectColor(element, colors, index) {
|
|
29181
29311
|
if (!element?.field) return "gray";
|
|
29182
29312
|
const isComparison = element.field.includes("comparison_");
|
|
@@ -31461,15 +31591,19 @@ var QuillPortal = ({
|
|
|
31461
31591
|
};
|
|
31462
31592
|
|
|
31463
31593
|
// src/components/Chart/CustomLegend.tsx
|
|
31594
|
+
init_textProcessing();
|
|
31464
31595
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
31465
31596
|
var getLegendLabel = (entry) => {
|
|
31466
31597
|
const label = entry?.payload?.name ?? entry?.value ?? entry?.dataKey ?? "";
|
|
31467
|
-
return
|
|
31598
|
+
return snakeAndCamelCaseToTitleCase(
|
|
31599
|
+
typeof label === "string" ? label : String(label ?? "")
|
|
31600
|
+
);
|
|
31468
31601
|
};
|
|
31469
31602
|
var LegendItem = ({
|
|
31470
31603
|
entry,
|
|
31471
31604
|
index,
|
|
31472
|
-
theme
|
|
31605
|
+
theme,
|
|
31606
|
+
onClick
|
|
31473
31607
|
}) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
31474
31608
|
"div",
|
|
31475
31609
|
{
|
|
@@ -31478,30 +31612,37 @@ var LegendItem = ({
|
|
|
31478
31612
|
alignItems: "baseline",
|
|
31479
31613
|
marginRight: "1rem"
|
|
31480
31614
|
},
|
|
31481
|
-
|
|
31482
|
-
|
|
31483
|
-
|
|
31484
|
-
|
|
31485
|
-
|
|
31486
|
-
|
|
31487
|
-
|
|
31488
|
-
|
|
31489
|
-
|
|
31490
|
-
|
|
31491
|
-
|
|
31492
|
-
|
|
31493
|
-
|
|
31494
|
-
|
|
31495
|
-
|
|
31496
|
-
|
|
31497
|
-
|
|
31498
|
-
|
|
31499
|
-
|
|
31500
|
-
|
|
31501
|
-
|
|
31502
|
-
|
|
31503
|
-
|
|
31504
|
-
|
|
31615
|
+
onClick: () => onClick ? onClick(entry) : void 0,
|
|
31616
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
31617
|
+
"div",
|
|
31618
|
+
{
|
|
31619
|
+
style: { display: "flex", flexDirection: "row", alignItems: "center" },
|
|
31620
|
+
children: [
|
|
31621
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
31622
|
+
"svg",
|
|
31623
|
+
{
|
|
31624
|
+
style: { marginRight: "0.5rem" },
|
|
31625
|
+
width: "16",
|
|
31626
|
+
height: "16",
|
|
31627
|
+
viewBox: "0 0 16 16",
|
|
31628
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("rect", { width: "16", height: "16", rx: "3", fill: entry?.color })
|
|
31629
|
+
}
|
|
31630
|
+
),
|
|
31631
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
31632
|
+
"span",
|
|
31633
|
+
{
|
|
31634
|
+
style: {
|
|
31635
|
+
color: theme?.secondaryTextColor,
|
|
31636
|
+
fontFamily: theme?.fontFamily,
|
|
31637
|
+
fontSize: theme?.fontSizeMedium || "14px",
|
|
31638
|
+
whiteSpace: "nowrap"
|
|
31639
|
+
},
|
|
31640
|
+
children: getLegendLabel(entry)
|
|
31641
|
+
}
|
|
31642
|
+
)
|
|
31643
|
+
]
|
|
31644
|
+
}
|
|
31645
|
+
)
|
|
31505
31646
|
},
|
|
31506
31647
|
`legend-${index}`
|
|
31507
31648
|
);
|
|
@@ -31515,7 +31656,8 @@ var getOuterWidth = (element) => {
|
|
|
31515
31656
|
};
|
|
31516
31657
|
var RenderLegend = ({
|
|
31517
31658
|
payload,
|
|
31518
|
-
limit
|
|
31659
|
+
limit,
|
|
31660
|
+
onClickLegendElement
|
|
31519
31661
|
}) => {
|
|
31520
31662
|
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
31521
31663
|
const [isOpen, setIsOpen] = (0, import_react12.useState)(false);
|
|
@@ -31528,7 +31670,10 @@ var RenderLegend = ({
|
|
|
31528
31670
|
const safePayload = payload ?? [];
|
|
31529
31671
|
const maxItems = limit ?? safePayload.length;
|
|
31530
31672
|
const measuredLimit = visibleCount ?? maxItems;
|
|
31531
|
-
const visiblePayload = safePayload.slice(
|
|
31673
|
+
const visiblePayload = safePayload.slice(
|
|
31674
|
+
0,
|
|
31675
|
+
Math.min(maxItems, measuredLimit)
|
|
31676
|
+
);
|
|
31532
31677
|
const handleOpen = () => setIsOpen(true);
|
|
31533
31678
|
const handleClose = () => setIsOpen(false);
|
|
31534
31679
|
(0, import_react12.useLayoutEffect)(() => {
|
|
@@ -31589,7 +31734,6 @@ var RenderLegend = ({
|
|
|
31589
31734
|
visibility: "hidden",
|
|
31590
31735
|
height: 0,
|
|
31591
31736
|
overflow: "hidden",
|
|
31592
|
-
pointerEvents: "none",
|
|
31593
31737
|
display: "flex",
|
|
31594
31738
|
alignItems: "center",
|
|
31595
31739
|
flexWrap: "nowrap",
|
|
@@ -31613,7 +31757,15 @@ var RenderLegend = ({
|
|
|
31613
31757
|
ref: (element) => {
|
|
31614
31758
|
itemRefs.current[index] = element;
|
|
31615
31759
|
},
|
|
31616
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
31760
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
31761
|
+
LegendItem,
|
|
31762
|
+
{
|
|
31763
|
+
entry,
|
|
31764
|
+
index,
|
|
31765
|
+
theme,
|
|
31766
|
+
onClick: onClickLegendElement
|
|
31767
|
+
}
|
|
31768
|
+
)
|
|
31617
31769
|
},
|
|
31618
31770
|
`legend-measure-${index}`
|
|
31619
31771
|
))
|
|
@@ -31654,7 +31806,8 @@ var RenderLegend = ({
|
|
|
31654
31806
|
{
|
|
31655
31807
|
entry,
|
|
31656
31808
|
index,
|
|
31657
|
-
theme
|
|
31809
|
+
theme,
|
|
31810
|
+
onClick: onClickLegendElement
|
|
31658
31811
|
},
|
|
31659
31812
|
`legend-${index}`
|
|
31660
31813
|
))
|
|
@@ -31701,7 +31854,8 @@ var RenderLegend = ({
|
|
|
31701
31854
|
{
|
|
31702
31855
|
entry,
|
|
31703
31856
|
index,
|
|
31704
|
-
theme
|
|
31857
|
+
theme,
|
|
31858
|
+
onClick: onClickLegendElement
|
|
31705
31859
|
},
|
|
31706
31860
|
`legend-popover-${index}`
|
|
31707
31861
|
))
|
|
@@ -31973,6 +32127,7 @@ var PieChartWrapper = import_react13.default.forwardRef(
|
|
|
31973
32127
|
containerStyle,
|
|
31974
32128
|
theme,
|
|
31975
32129
|
onClickChartElement,
|
|
32130
|
+
onClickLegendElement,
|
|
31976
32131
|
yAxisFields,
|
|
31977
32132
|
showLegend = false,
|
|
31978
32133
|
...other
|
|
@@ -32069,7 +32224,13 @@ var PieChartWrapper = import_react13.default.forwardRef(
|
|
|
32069
32224
|
paddingBottom: 20,
|
|
32070
32225
|
fontFamily: theme?.fontFamily
|
|
32071
32226
|
},
|
|
32072
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
32227
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
32228
|
+
RenderLegend,
|
|
32229
|
+
{
|
|
32230
|
+
limit: 5,
|
|
32231
|
+
onClickLegendElement
|
|
32232
|
+
}
|
|
32233
|
+
)
|
|
32073
32234
|
}
|
|
32074
32235
|
),
|
|
32075
32236
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
@@ -32704,6 +32865,7 @@ init_valueFormatter();
|
|
|
32704
32865
|
// src/utils/axisFormatter.ts
|
|
32705
32866
|
var import_date_fns11 = require("date-fns");
|
|
32706
32867
|
var import_date_fns_tz4 = require("date-fns-tz");
|
|
32868
|
+
init_textProcessing();
|
|
32707
32869
|
var axisFormatter = ({ value, field, fields }) => {
|
|
32708
32870
|
if (field === void 0 || field === null) return "";
|
|
32709
32871
|
if (value === void 0 || value === null) return "";
|
|
@@ -32753,7 +32915,7 @@ var formatString2 = (value) => {
|
|
|
32753
32915
|
if (typeof value === "object") {
|
|
32754
32916
|
return JSON.stringify(value);
|
|
32755
32917
|
}
|
|
32756
|
-
return value.toString();
|
|
32918
|
+
return formatIdentifierLabel(value.toString());
|
|
32757
32919
|
};
|
|
32758
32920
|
var formatterDecimal2 = new Intl.NumberFormat("en-US", {
|
|
32759
32921
|
style: "decimal",
|
|
@@ -32960,6 +33122,7 @@ function ChartTooltipRow2({
|
|
|
32960
33122
|
}
|
|
32961
33123
|
|
|
32962
33124
|
// src/components/Chart/ChartTooltipGroup.tsx
|
|
33125
|
+
init_textProcessing();
|
|
32963
33126
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
32964
33127
|
function ChartTooltipGroup({
|
|
32965
33128
|
name: name2,
|
|
@@ -32994,7 +33157,7 @@ function ChartTooltipGroup({
|
|
|
32994
33157
|
paddingBottom: 2,
|
|
32995
33158
|
textTransform: "capitalize"
|
|
32996
33159
|
},
|
|
32997
|
-
children: name2
|
|
33160
|
+
children: formatIdentifierLabel(name2)
|
|
32998
33161
|
}
|
|
32999
33162
|
),
|
|
33000
33163
|
items.map(({ color, value, name: name3 }, idx) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
@@ -33015,6 +33178,7 @@ function ChartTooltipGroup({
|
|
|
33015
33178
|
|
|
33016
33179
|
// src/components/Chart/ChartTooltip.tsx
|
|
33017
33180
|
init_dates();
|
|
33181
|
+
init_textProcessing();
|
|
33018
33182
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
33019
33183
|
var ChartTooltipPrimary = (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(ChartTooltipFrame2, { theme: props.theme, children: [
|
|
33020
33184
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
@@ -33049,7 +33213,7 @@ var ChartTooltipPrimary = (props) => /* @__PURE__ */ (0, import_jsx_runtime33.js
|
|
|
33049
33213
|
paddingTop: 2,
|
|
33050
33214
|
paddingBottom: 2
|
|
33051
33215
|
},
|
|
33052
|
-
children: !isNaN(new Date(props.label)) && props.dateFormatter ? props.dateFormatter(props.label) : !isNaN(new Date(props.label)) ? (0, import_date_fns12.format)(new Date(props.label), "MMM yyyy") : props.label
|
|
33216
|
+
children: !isNaN(new Date(props.label)) && props.dateFormatter ? props.dateFormatter(props.label) : !isNaN(new Date(props.label)) ? (0, import_date_fns12.format)(new Date(props.label), "MMM yyyy") : formatIdentifierLabel(props.label)
|
|
33053
33217
|
}
|
|
33054
33218
|
)
|
|
33055
33219
|
}
|
|
@@ -33132,7 +33296,7 @@ function reformatComparisonPayload(props, primaryLabel, comparisonLabel) {
|
|
|
33132
33296
|
return columnsByKey;
|
|
33133
33297
|
}
|
|
33134
33298
|
function getTooltipLabel(props, altTooltipLabel, isDateXAxis) {
|
|
33135
|
-
return props.payload.length <= 2 && altTooltipLabel && isDateXAxis ? !isNaN(new Date(altTooltipLabel)) && props.dateFormatter ? props.dateFormatter(altTooltipLabel) : !isNaN(new Date(altTooltipLabel)) ? (0, import_date_fns12.format)(new Date(altTooltipLabel), "MMM yyyy") : altTooltipLabel : !isNaN(new Date(props.label)) && props.dateFormatter ? props.dateFormatter(props.label) : !isNaN(new Date(props.label)) ? (0, import_date_fns12.format)(new Date(props.label), "MMM yyyy") : props.label;
|
|
33299
|
+
return props.payload.length <= 2 && altTooltipLabel && isDateXAxis ? !isNaN(new Date(altTooltipLabel)) && props.dateFormatter ? props.dateFormatter(altTooltipLabel) : !isNaN(new Date(altTooltipLabel)) ? (0, import_date_fns12.format)(new Date(altTooltipLabel), "MMM yyyy") : formatIdentifierLabel(altTooltipLabel) : !isNaN(new Date(props.label)) && props.dateFormatter ? props.dateFormatter(props.label) : !isNaN(new Date(props.label)) ? (0, import_date_fns12.format)(new Date(props.label), "MMM yyyy") : formatIdentifierLabel(props.label);
|
|
33136
33300
|
}
|
|
33137
33301
|
function ChartTooltipComparison(props) {
|
|
33138
33302
|
const isDateXAxis = isDateFormat2(props.xAxisFormat);
|
|
@@ -33388,6 +33552,7 @@ function CustomReferenceLine({
|
|
|
33388
33552
|
|
|
33389
33553
|
// src/components/Chart/LineChart.tsx
|
|
33390
33554
|
init_columnProcessing();
|
|
33555
|
+
init_textProcessing();
|
|
33391
33556
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
33392
33557
|
function createLineForEmptyChart(yAxisFields, dateFilter, xAxisField, xAxisFormat) {
|
|
33393
33558
|
let lineChartData = [];
|
|
@@ -33424,6 +33589,8 @@ function LineChart({
|
|
|
33424
33589
|
cartesianGridLineColor,
|
|
33425
33590
|
onClickChartElement = () => {
|
|
33426
33591
|
},
|
|
33592
|
+
onClickLegendElement = () => {
|
|
33593
|
+
},
|
|
33427
33594
|
dateFilter,
|
|
33428
33595
|
referenceLines,
|
|
33429
33596
|
showLegend = false
|
|
@@ -33520,7 +33687,7 @@ function LineChart({
|
|
|
33520
33687
|
paddingBottom: 20,
|
|
33521
33688
|
fontFamily: theme?.fontFamily
|
|
33522
33689
|
},
|
|
33523
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderLegend, {})
|
|
33690
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(RenderLegend, { onClickLegendElement })
|
|
33524
33691
|
}
|
|
33525
33692
|
),
|
|
33526
33693
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
@@ -33608,7 +33775,9 @@ function LineChart({
|
|
|
33608
33775
|
color: p.color || "black",
|
|
33609
33776
|
chartType: "line",
|
|
33610
33777
|
dataKey: p.dataKey?.toLocaleString() || "",
|
|
33611
|
-
name:
|
|
33778
|
+
name: snakeAndCamelCaseToTitleCase(
|
|
33779
|
+
name2 || p.name?.toString() || ""
|
|
33780
|
+
),
|
|
33612
33781
|
payload: p.payload || {},
|
|
33613
33782
|
type: p.type || "none",
|
|
33614
33783
|
unit: "string",
|
|
@@ -33701,6 +33870,7 @@ function LineChart({
|
|
|
33701
33870
|
import_recharts2.Area,
|
|
33702
33871
|
{
|
|
33703
33872
|
type: "linear",
|
|
33873
|
+
name: elem.label || elem.field,
|
|
33704
33874
|
dataKey: elem.field,
|
|
33705
33875
|
stroke: getCustomColor(index, elem.field) ?? selectColor(elem, colors, index - numComparisons),
|
|
33706
33876
|
fill: `url(#${uniqueId})`,
|
|
@@ -33723,6 +33893,7 @@ function LineChart({
|
|
|
33723
33893
|
var import_recharts3 = require("recharts");
|
|
33724
33894
|
var import_react16 = require("react");
|
|
33725
33895
|
init_valueFormatter();
|
|
33896
|
+
init_textProcessing();
|
|
33726
33897
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
33727
33898
|
function RadarChart({
|
|
33728
33899
|
colors,
|
|
@@ -33738,6 +33909,8 @@ function RadarChart({
|
|
|
33738
33909
|
isAnimationActive = true,
|
|
33739
33910
|
onClickChartElement = () => {
|
|
33740
33911
|
},
|
|
33912
|
+
onClickLegendElement = () => {
|
|
33913
|
+
},
|
|
33741
33914
|
dateFilter,
|
|
33742
33915
|
showLegend = false
|
|
33743
33916
|
}) {
|
|
@@ -33831,7 +34004,7 @@ function RadarChart({
|
|
|
33831
34004
|
paddingBottom: 20,
|
|
33832
34005
|
fontFamily: theme?.fontFamily
|
|
33833
34006
|
},
|
|
33834
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RenderLegend, {})
|
|
34007
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RenderLegend, { onClickLegendElement })
|
|
33835
34008
|
}
|
|
33836
34009
|
),
|
|
33837
34010
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
@@ -33866,7 +34039,9 @@ function RadarChart({
|
|
|
33866
34039
|
color: p.color || "black",
|
|
33867
34040
|
chartType: "radar",
|
|
33868
34041
|
dataKey: p.dataKey?.toLocaleString() || "",
|
|
33869
|
-
name:
|
|
34042
|
+
name: snakeAndCamelCaseToTitleCase(
|
|
34043
|
+
name2 || p.name?.toString() || ""
|
|
34044
|
+
),
|
|
33870
34045
|
payload: p.payload || {},
|
|
33871
34046
|
type: p.type || "none",
|
|
33872
34047
|
unit: "string",
|
|
@@ -33973,6 +34148,10 @@ var CustomBar = (0, import_react17.memo)((props) => {
|
|
|
33973
34148
|
width: rawWidth,
|
|
33974
34149
|
height: rawHeight,
|
|
33975
34150
|
fill,
|
|
34151
|
+
fillOpacity,
|
|
34152
|
+
stroke,
|
|
34153
|
+
strokeWidth,
|
|
34154
|
+
style,
|
|
33976
34155
|
yAxisFields = [],
|
|
33977
34156
|
dataKey,
|
|
33978
34157
|
payload = {},
|
|
@@ -34030,7 +34209,17 @@ var CustomBar = (0, import_react17.memo)((props) => {
|
|
|
34030
34209
|
rawY,
|
|
34031
34210
|
radius
|
|
34032
34211
|
]);
|
|
34033
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
34212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
34213
|
+
"path",
|
|
34214
|
+
{
|
|
34215
|
+
d: path,
|
|
34216
|
+
fill,
|
|
34217
|
+
fillOpacity,
|
|
34218
|
+
stroke,
|
|
34219
|
+
strokeWidth,
|
|
34220
|
+
style
|
|
34221
|
+
}
|
|
34222
|
+
);
|
|
34034
34223
|
});
|
|
34035
34224
|
CustomBar.displayName = "CustomBar";
|
|
34036
34225
|
var CustomBar_default = CustomBar;
|
|
@@ -34038,10 +34227,25 @@ var CustomBar_default = CustomBar;
|
|
|
34038
34227
|
// src/components/Chart/BarChart.tsx
|
|
34039
34228
|
var import_react18 = require("react");
|
|
34040
34229
|
init_columnProcessing();
|
|
34230
|
+
init_textProcessing();
|
|
34041
34231
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
34042
34232
|
var CATEGORY_AXIS_WIDTH = 120;
|
|
34043
34233
|
var VALUE_AXIS_WIDTH = 44;
|
|
34044
34234
|
var STACKED_DOMAIN_HEADROOM = 1.05;
|
|
34235
|
+
function rowValueFromPivotRow(row, xAxisField, fallbackLabel) {
|
|
34236
|
+
const rawDate = row?.__quillRawDate;
|
|
34237
|
+
if (rawDate != null && rawDate !== "") {
|
|
34238
|
+
return String(rawDate);
|
|
34239
|
+
}
|
|
34240
|
+
const category = row?.[xAxisField];
|
|
34241
|
+
if (category != null && category !== "") {
|
|
34242
|
+
return String(category);
|
|
34243
|
+
}
|
|
34244
|
+
if (fallbackLabel != null && fallbackLabel !== "") {
|
|
34245
|
+
return String(fallbackLabel);
|
|
34246
|
+
}
|
|
34247
|
+
return null;
|
|
34248
|
+
}
|
|
34045
34249
|
function getStackedDomain(data, fields, comparison) {
|
|
34046
34250
|
const fieldsArray = fields.filter((field) => comparison || !field.field.startsWith("comparison_")).map((field) => field.field);
|
|
34047
34251
|
if (fieldsArray.length === 0 || data.length === 0) {
|
|
@@ -34063,14 +34267,16 @@ function getStackedDomain(data, fields, comparison) {
|
|
|
34063
34267
|
}
|
|
34064
34268
|
return [0, maxStack * STACKED_DOMAIN_HEADROOM];
|
|
34065
34269
|
}
|
|
34066
|
-
var createCustomBar = (yAxisFields, theme, layout) => {
|
|
34270
|
+
var createCustomBar = (yAxisFields, theme, layout, active = false) => {
|
|
34067
34271
|
return (props) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
34068
34272
|
CustomBar_default,
|
|
34069
34273
|
{
|
|
34070
34274
|
...props,
|
|
34071
34275
|
yAxisFields,
|
|
34072
34276
|
theme,
|
|
34073
|
-
layout
|
|
34277
|
+
layout,
|
|
34278
|
+
stroke: active ? theme?.primaryTextColor ?? "#111827" : props.stroke,
|
|
34279
|
+
strokeWidth: active ? 1.5 : props.strokeWidth
|
|
34074
34280
|
}
|
|
34075
34281
|
);
|
|
34076
34282
|
};
|
|
@@ -34091,6 +34297,7 @@ function BarChart({
|
|
|
34091
34297
|
hideYAxis = false,
|
|
34092
34298
|
hideCartesianGrid = false,
|
|
34093
34299
|
onClickChartElement,
|
|
34300
|
+
onClickLegendElement,
|
|
34094
34301
|
dateFilter,
|
|
34095
34302
|
referenceLines,
|
|
34096
34303
|
showLegend = false,
|
|
@@ -34120,6 +34327,21 @@ function BarChart({
|
|
|
34120
34327
|
() => stackedMode ? getStackedDomain(data, yAxisFields, comparison) : getDomain(data, yAxisFields, referenceLines),
|
|
34121
34328
|
[stackedMode, data, yAxisFields, referenceLines, comparison]
|
|
34122
34329
|
);
|
|
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]);
|
|
34123
34345
|
const allowDecimals = (0, import_react18.useMemo)(
|
|
34124
34346
|
() => getAllowDecimals(data, yAxisFields, referenceLines),
|
|
34125
34347
|
[data, yAxisFields, referenceLines]
|
|
@@ -34143,6 +34365,16 @@ function BarChart({
|
|
|
34143
34365
|
return void 0;
|
|
34144
34366
|
return createCustomBar(sortYAxisFields([...yAxisFields]), theme, layout);
|
|
34145
34367
|
}, [isStacked, yAxisFields, theme, layout]);
|
|
34368
|
+
const customActiveBarShape = (0, import_react18.useMemo)(() => {
|
|
34369
|
+
if (!theme?.barChartCornerRadius && !theme?.barChartCornerRadiusRatio)
|
|
34370
|
+
return void 0;
|
|
34371
|
+
return createCustomBar(
|
|
34372
|
+
sortYAxisFields([...yAxisFields]),
|
|
34373
|
+
theme,
|
|
34374
|
+
layout,
|
|
34375
|
+
true
|
|
34376
|
+
);
|
|
34377
|
+
}, [isStacked, yAxisFields, theme, layout]);
|
|
34146
34378
|
if (!data || data.length === 0) {
|
|
34147
34379
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
34148
34380
|
"div",
|
|
@@ -34184,9 +34416,28 @@ function BarChart({
|
|
|
34184
34416
|
{
|
|
34185
34417
|
data: data ?? [],
|
|
34186
34418
|
layout,
|
|
34187
|
-
onClick: (event) =>
|
|
34188
|
-
event?.
|
|
34189
|
-
|
|
34419
|
+
onClick: (event) => {
|
|
34420
|
+
if (!onClickChartElement || event?.activeLabel === void 0 || event?.activeTooltipIndex === void 0) {
|
|
34421
|
+
return;
|
|
34422
|
+
}
|
|
34423
|
+
const index = Number(event.activeTooltipIndex);
|
|
34424
|
+
const row = event.activePayload?.[0]?.payload ?? data[index] ?? {};
|
|
34425
|
+
onClickChartElement({
|
|
34426
|
+
...row,
|
|
34427
|
+
interactionType: "bucket",
|
|
34428
|
+
activeLabel: event.activeLabel,
|
|
34429
|
+
rowValue: rowValueFromPivotRow(row, xAxisField, event.activeLabel),
|
|
34430
|
+
columnValue: void 0,
|
|
34431
|
+
activeDataKey: void 0,
|
|
34432
|
+
activeValue: void 0,
|
|
34433
|
+
activePayload: event.activePayload ?? [],
|
|
34434
|
+
category: event.activeLabel,
|
|
34435
|
+
series: void 0,
|
|
34436
|
+
value: void 0,
|
|
34437
|
+
row,
|
|
34438
|
+
index
|
|
34439
|
+
});
|
|
34440
|
+
},
|
|
34190
34441
|
children: [
|
|
34191
34442
|
!hideCartesianGrid && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
34192
34443
|
import_recharts4.CartesianGrid,
|
|
@@ -34206,7 +34457,7 @@ function BarChart({
|
|
|
34206
34457
|
wrapperStyle: {
|
|
34207
34458
|
paddingBottom: 20
|
|
34208
34459
|
},
|
|
34209
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(RenderLegend, {})
|
|
34460
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(RenderLegend, { onClickLegendElement })
|
|
34210
34461
|
}
|
|
34211
34462
|
),
|
|
34212
34463
|
isHorizontalBars ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
@@ -34285,11 +34536,13 @@ function BarChart({
|
|
|
34285
34536
|
{
|
|
34286
34537
|
wrapperStyle: { outline: "none", zIndex: 2 },
|
|
34287
34538
|
isAnimationActive: false,
|
|
34288
|
-
cursor:
|
|
34539
|
+
cursor: false,
|
|
34540
|
+
shared: false,
|
|
34289
34541
|
content: ({ active, payload, label }) => {
|
|
34290
34542
|
if (!payload || payload.length === 0) {
|
|
34291
34543
|
return null;
|
|
34292
34544
|
}
|
|
34545
|
+
const activeLabel = label ?? payload[0]?.payload?.[xAxisField] ?? "";
|
|
34293
34546
|
const payloadItems = payload.map((p) => {
|
|
34294
34547
|
const rawName = yAxisFields?.find(
|
|
34295
34548
|
(f) => f.field === p.name?.toString()
|
|
@@ -34300,7 +34553,9 @@ function BarChart({
|
|
|
34300
34553
|
color: p.color || "black",
|
|
34301
34554
|
chartType: "line",
|
|
34302
34555
|
dataKey: p.dataKey?.toLocaleString() || "",
|
|
34303
|
-
name:
|
|
34556
|
+
name: snakeAndCamelCaseToTitleCase(
|
|
34557
|
+
name2 || p.name?.toString() || ""
|
|
34558
|
+
),
|
|
34304
34559
|
payload: p.payload || {},
|
|
34305
34560
|
type: p.type || "none",
|
|
34306
34561
|
unit: "string",
|
|
@@ -34313,7 +34568,7 @@ function BarChart({
|
|
|
34313
34568
|
theme,
|
|
34314
34569
|
active,
|
|
34315
34570
|
payload: payloadItems,
|
|
34316
|
-
label
|
|
34571
|
+
label: `${activeLabel}`,
|
|
34317
34572
|
dateFormatter: (value) => valueFormatter({
|
|
34318
34573
|
value,
|
|
34319
34574
|
field: xAxisField,
|
|
@@ -34345,21 +34600,55 @@ function BarChart({
|
|
|
34345
34600
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
34346
34601
|
import_recharts4.Bar,
|
|
34347
34602
|
{
|
|
34603
|
+
name: elem.label || elem.field,
|
|
34348
34604
|
dataKey: elem.field,
|
|
34349
34605
|
stackId: stackedMode ? "same_id" : isStacked ? elem.field.replace("comparison_", "") : void 0,
|
|
34350
34606
|
type: "linear",
|
|
34351
34607
|
fill: getCustomColor(elem.field) ?? selectColor(
|
|
34352
34608
|
elem,
|
|
34353
|
-
|
|
34354
|
-
|
|
34355
|
-
|
|
34356
|
-
|
|
34357
|
-
|
|
34358
|
-
|
|
34359
|
-
)
|
|
34609
|
+
[
|
|
34610
|
+
seriesColorByField.get(
|
|
34611
|
+
elem.field.replace("comparison_", "")
|
|
34612
|
+
) ?? colors[0] ?? "gray"
|
|
34613
|
+
],
|
|
34614
|
+
0
|
|
34360
34615
|
),
|
|
34361
34616
|
isAnimationActive,
|
|
34362
|
-
shape: customBarShape
|
|
34617
|
+
shape: customBarShape,
|
|
34618
|
+
activeBar: customActiveBarShape ?? {
|
|
34619
|
+
fillOpacity: 1,
|
|
34620
|
+
stroke: theme?.primaryTextColor ?? "#111827",
|
|
34621
|
+
strokeWidth: 1.5
|
|
34622
|
+
},
|
|
34623
|
+
style: {
|
|
34624
|
+
cursor: onClickChartElement ? "pointer" : void 0
|
|
34625
|
+
},
|
|
34626
|
+
onClick: (bar, index, event) => {
|
|
34627
|
+
event?.stopPropagation();
|
|
34628
|
+
const payload = bar.payload ?? data[index] ?? {};
|
|
34629
|
+
onClickChartElement?.({
|
|
34630
|
+
...payload,
|
|
34631
|
+
interactionType: "bar",
|
|
34632
|
+
activeLabel: payload[xAxisField],
|
|
34633
|
+
rowValue: rowValueFromPivotRow(payload, xAxisField),
|
|
34634
|
+
columnValue: elem.field,
|
|
34635
|
+
activeDataKey: elem.field,
|
|
34636
|
+
activeValue: payload[elem.field] ?? bar.value,
|
|
34637
|
+
activePayload: [
|
|
34638
|
+
{
|
|
34639
|
+
dataKey: elem.field,
|
|
34640
|
+
name: elem.label || elem.field,
|
|
34641
|
+
payload,
|
|
34642
|
+
value: payload[elem.field] ?? bar.value
|
|
34643
|
+
}
|
|
34644
|
+
],
|
|
34645
|
+
category: payload[xAxisField],
|
|
34646
|
+
series: elem.field,
|
|
34647
|
+
value: payload[elem.field] ?? bar.value,
|
|
34648
|
+
row: payload,
|
|
34649
|
+
index
|
|
34650
|
+
});
|
|
34651
|
+
}
|
|
34363
34652
|
},
|
|
34364
34653
|
elem.field
|
|
34365
34654
|
);
|
|
@@ -39917,6 +40206,7 @@ var ChartDisplay = ({
|
|
|
39917
40206
|
onPageChange,
|
|
39918
40207
|
onSortChange,
|
|
39919
40208
|
onClickChartElement,
|
|
40209
|
+
onClickLegendElement,
|
|
39920
40210
|
overrideTheme,
|
|
39921
40211
|
referenceLines,
|
|
39922
40212
|
showLegend,
|
|
@@ -40001,6 +40291,7 @@ var ChartDisplay = ({
|
|
|
40001
40291
|
theme: overrideTheme ?? theme,
|
|
40002
40292
|
colorMap,
|
|
40003
40293
|
onClickChartElement,
|
|
40294
|
+
onClickLegendElement,
|
|
40004
40295
|
yAxisFields: config?.yAxisFields,
|
|
40005
40296
|
showLegend: resolvedShowLegend
|
|
40006
40297
|
}
|
|
@@ -40077,6 +40368,7 @@ var ChartDisplay = ({
|
|
|
40077
40368
|
hideCartesianGrid,
|
|
40078
40369
|
colorMap,
|
|
40079
40370
|
onClickChartElement,
|
|
40371
|
+
onClickLegendElement,
|
|
40080
40372
|
dateFilter: !hideDateRangeFilter ? dateFilter : void 0,
|
|
40081
40373
|
referenceLines,
|
|
40082
40374
|
showLegend: resolvedShowLegend
|
|
@@ -40104,6 +40396,7 @@ var ChartDisplay = ({
|
|
|
40104
40396
|
hideCartesianGrid,
|
|
40105
40397
|
colorMap,
|
|
40106
40398
|
onClickChartElement,
|
|
40399
|
+
onClickLegendElement,
|
|
40107
40400
|
dateFilter: !hideDateRangeFilter ? dateFilter : void 0,
|
|
40108
40401
|
referenceLines,
|
|
40109
40402
|
showLegend: resolvedShowLegend,
|
|
@@ -40260,6 +40553,7 @@ var ChartDisplay = ({
|
|
|
40260
40553
|
className,
|
|
40261
40554
|
isAnimationActive,
|
|
40262
40555
|
onClickChartElement,
|
|
40556
|
+
onClickLegendElement,
|
|
40263
40557
|
dateFilter: !hideDateRangeFilter ? dateFilter : void 0,
|
|
40264
40558
|
showLegend: resolvedShowLegend
|
|
40265
40559
|
}
|
|
@@ -40290,6 +40584,7 @@ var ChartDisplay = ({
|
|
|
40290
40584
|
comparisonLineStyle: comparisonLineStyle ?? "solid",
|
|
40291
40585
|
cartesianGridLineColor,
|
|
40292
40586
|
onClickChartElement,
|
|
40587
|
+
onClickLegendElement,
|
|
40293
40588
|
dateFilter: !hideDateRangeFilter ? dateFilter : void 0,
|
|
40294
40589
|
referenceLines,
|
|
40295
40590
|
showLegend: resolvedShowLegend
|
|
@@ -42348,7 +42643,7 @@ function DashboardLegacy({
|
|
|
42348
42643
|
const [filterValues, setFilterValues] = (0, import_react40.useState)({});
|
|
42349
42644
|
const prevNameRef = (0, import_react40.useRef)(name2);
|
|
42350
42645
|
const prevFlagsRef = (0, import_react40.useRef)(flags);
|
|
42351
|
-
const prevClientRef = (0, import_react40.useRef)(client?.
|
|
42646
|
+
const prevClientRef = (0, import_react40.useRef)(client?.id ?? "");
|
|
42352
42647
|
const addFilterPopoverButtonRef = (0, import_react40.useRef)(null);
|
|
42353
42648
|
const viewFiltersPopoverButtonRef = (0, import_react40.useRef)(null);
|
|
42354
42649
|
const previousFilters = (0, import_react40.useRef)(filters);
|
|
@@ -42404,15 +42699,15 @@ function DashboardLegacy({
|
|
|
42404
42699
|
});
|
|
42405
42700
|
}, [flags]);
|
|
42406
42701
|
(0, import_react40.useEffect)(() => {
|
|
42407
|
-
if (prevClientRef.current === client?.
|
|
42702
|
+
if (prevClientRef.current === client?.id) {
|
|
42408
42703
|
return;
|
|
42409
42704
|
}
|
|
42410
|
-
const isInitialKeySet = !prevClientRef.current && client?.
|
|
42705
|
+
const isInitialKeySet = !prevClientRef.current && client?.id;
|
|
42411
42706
|
if (isInitialKeySet && Object.values(data?.sections ?? {}).flat().length) {
|
|
42412
|
-
prevClientRef.current = client?.
|
|
42707
|
+
prevClientRef.current = client?.id ?? "";
|
|
42413
42708
|
return;
|
|
42414
42709
|
}
|
|
42415
|
-
prevClientRef.current = client?.
|
|
42710
|
+
prevClientRef.current = client?.id ?? "";
|
|
42416
42711
|
if (isClientLoading) {
|
|
42417
42712
|
return;
|
|
42418
42713
|
}
|
|
@@ -42424,7 +42719,7 @@ function DashboardLegacy({
|
|
|
42424
42719
|
prevFlagsRef.current = flags;
|
|
42425
42720
|
isInitialLoadOfDashboardRef.current = false;
|
|
42426
42721
|
});
|
|
42427
|
-
}, [client?.
|
|
42722
|
+
}, [client?.id]);
|
|
42428
42723
|
(0, import_react40.useEffect)(() => {
|
|
42429
42724
|
setFilterValues(
|
|
42430
42725
|
Object.values(populatedDashboardFilters ?? {}).reduce((acc, f) => {
|
|
@@ -43407,6 +43702,7 @@ function StaticChart(props) {
|
|
|
43407
43702
|
const {
|
|
43408
43703
|
reportId,
|
|
43409
43704
|
onClickChartElement,
|
|
43705
|
+
onClickLegendElement,
|
|
43410
43706
|
containerStyle,
|
|
43411
43707
|
showLegend,
|
|
43412
43708
|
className
|
|
@@ -43459,6 +43755,7 @@ function StaticChart(props) {
|
|
|
43459
43755
|
reportId,
|
|
43460
43756
|
config,
|
|
43461
43757
|
onClickChartElement,
|
|
43758
|
+
onClickLegendElement,
|
|
43462
43759
|
loading,
|
|
43463
43760
|
className,
|
|
43464
43761
|
containerStyle: safeContainerStyle,
|
|
@@ -48501,7 +48798,7 @@ function ChartBuilder({
|
|
|
48501
48798
|
task: "dashboard",
|
|
48502
48799
|
metadata: {
|
|
48503
48800
|
name: dashboardName,
|
|
48504
|
-
clientId: client.
|
|
48801
|
+
clientId: client.id,
|
|
48505
48802
|
databaseType: client.databaseType,
|
|
48506
48803
|
useNewNodeSql: true,
|
|
48507
48804
|
tenants
|
|
@@ -48561,11 +48858,11 @@ function ChartBuilder({
|
|
|
48561
48858
|
const getReferencedTables = async (client2, dbTables, sqlQuery, reportBuilderState2, skipStar) => {
|
|
48562
48859
|
const metadata = reportBuilderState2 ? {
|
|
48563
48860
|
reportBuilderState: reportBuilderState2,
|
|
48564
|
-
clientId: client2.
|
|
48861
|
+
clientId: client2.id,
|
|
48565
48862
|
useNewNodeSql: true
|
|
48566
48863
|
} : {
|
|
48567
48864
|
query: sqlQuery,
|
|
48568
|
-
clientId: client2.
|
|
48865
|
+
clientId: client2.id,
|
|
48569
48866
|
useNewNodeSql: true
|
|
48570
48867
|
};
|
|
48571
48868
|
try {
|
|
@@ -48791,7 +49088,7 @@ function ChartBuilder({
|
|
|
48791
49088
|
client,
|
|
48792
49089
|
task: "dashnames",
|
|
48793
49090
|
metadata: {
|
|
48794
|
-
clientId: client.
|
|
49091
|
+
clientId: client.id
|
|
48795
49092
|
}
|
|
48796
49093
|
});
|
|
48797
49094
|
dashNames = resp.dashboardNames;
|
|
@@ -52336,7 +52633,7 @@ function SQLEditor({
|
|
|
52336
52633
|
setColumns([]);
|
|
52337
52634
|
setDisplayTable(false);
|
|
52338
52635
|
}
|
|
52339
|
-
}, [client?.
|
|
52636
|
+
}, [client?.id]);
|
|
52340
52637
|
(0, import_react51.useEffect)(() => {
|
|
52341
52638
|
if (isChartBuilderOpen === false) {
|
|
52342
52639
|
onCloseChartBuilder && onCloseChartBuilder();
|
|
@@ -52595,7 +52892,7 @@ function SQLEditor({
|
|
|
52595
52892
|
task: "astify",
|
|
52596
52893
|
metadata: {
|
|
52597
52894
|
query: sqlQuery,
|
|
52598
|
-
clientId: client2.
|
|
52895
|
+
clientId: client2.id,
|
|
52599
52896
|
useNewNodeSql: true
|
|
52600
52897
|
}
|
|
52601
52898
|
});
|
|
@@ -52788,7 +53085,7 @@ function SQLEditor({
|
|
|
52788
53085
|
query: query || "",
|
|
52789
53086
|
schema: filteredSchema,
|
|
52790
53087
|
databaseType: client?.databaseType ?? "postgresql",
|
|
52791
|
-
clientName: client?.
|
|
53088
|
+
clientName: client?.id || "",
|
|
52792
53089
|
setQuery,
|
|
52793
53090
|
handleRunQuery: () => {
|
|
52794
53091
|
handleRunQuery(currentProcessing, true);
|
|
@@ -54942,7 +55239,7 @@ var useReportBuilderInternal = ({
|
|
|
54942
55239
|
!client.featureFlags?.["recommendedPivotsDisabled"]
|
|
54943
55240
|
);
|
|
54944
55241
|
}
|
|
54945
|
-
if (!initialTableName && !reportId && client.
|
|
55242
|
+
if (!initialTableName && !reportId && client.id) {
|
|
54946
55243
|
clearAllState();
|
|
54947
55244
|
}
|
|
54948
55245
|
}, [client]);
|
|
@@ -58434,13 +58731,13 @@ function ChartEditor({
|
|
|
58434
58731
|
}
|
|
58435
58732
|
|
|
58436
58733
|
// src/Chat.tsx
|
|
58437
|
-
var
|
|
58734
|
+
var import_react63 = require("react");
|
|
58438
58735
|
|
|
58439
58736
|
// src/ChatChartCard.tsx
|
|
58440
|
-
var
|
|
58737
|
+
var import_react62 = require("react");
|
|
58441
58738
|
|
|
58442
58739
|
// src/hooks/useForm.tsx
|
|
58443
|
-
var
|
|
58740
|
+
var import_react61 = require("react");
|
|
58444
58741
|
var import_react_query2 = require("@tanstack/react-query");
|
|
58445
58742
|
init_Filter();
|
|
58446
58743
|
init_ReportBuilder();
|
|
@@ -58457,6 +58754,7 @@ init_valueFormatter();
|
|
|
58457
58754
|
// src/utils/queryBuilderFilters.ts
|
|
58458
58755
|
init_Filter();
|
|
58459
58756
|
init_reportBuilder();
|
|
58757
|
+
init_dates();
|
|
58460
58758
|
var buildOperatorOption = (value, label, arity) => ({
|
|
58461
58759
|
name: value,
|
|
58462
58760
|
value,
|
|
@@ -58625,6 +58923,26 @@ var DATE_UNIT_BY_KEY = {
|
|
|
58625
58923
|
day: TimeUnit.Day,
|
|
58626
58924
|
hour: TimeUnit.Hour
|
|
58627
58925
|
};
|
|
58926
|
+
var DATE_BUCKETS = /* @__PURE__ */ new Set(["day", "week", "month", "year"]);
|
|
58927
|
+
var parseInBucketValue = (value) => {
|
|
58928
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
58929
|
+
throw new Error(
|
|
58930
|
+
'inBucket value must be `{ start: string, bucket: "day"|"week"|"month"|"year" }`'
|
|
58931
|
+
);
|
|
58932
|
+
}
|
|
58933
|
+
const record = value;
|
|
58934
|
+
const start = String(record.start ?? "").trim();
|
|
58935
|
+
const bucket = String(record.bucket ?? "").trim().toLowerCase();
|
|
58936
|
+
if (!start) {
|
|
58937
|
+
throw new Error("inBucket value.start is required");
|
|
58938
|
+
}
|
|
58939
|
+
if (!DATE_BUCKETS.has(bucket)) {
|
|
58940
|
+
throw new Error(
|
|
58941
|
+
`inBucket value.bucket must be day|week|month|year (got "${String(record.bucket)}")`
|
|
58942
|
+
);
|
|
58943
|
+
}
|
|
58944
|
+
return { start, bucket };
|
|
58945
|
+
};
|
|
58628
58946
|
var EMPTY_QUERY_GROUP = {
|
|
58629
58947
|
combinator: "and",
|
|
58630
58948
|
rules: []
|
|
@@ -58844,6 +59162,17 @@ var internalFilterToRule = (filter) => {
|
|
|
58844
59162
|
}
|
|
58845
59163
|
case "date-custom-filter" /* DateCustomFilter */: {
|
|
58846
59164
|
const customDate = filter.value;
|
|
59165
|
+
const dateCustom = filter;
|
|
59166
|
+
if (dateCustom.fromInBucket && dateCustom.dateBucket) {
|
|
59167
|
+
return {
|
|
59168
|
+
field,
|
|
59169
|
+
operator: "inBucket",
|
|
59170
|
+
value: {
|
|
59171
|
+
start: customDate.startDate,
|
|
59172
|
+
bucket: dateCustom.dateBucket
|
|
59173
|
+
}
|
|
59174
|
+
};
|
|
59175
|
+
}
|
|
58847
59176
|
return {
|
|
58848
59177
|
field,
|
|
58849
59178
|
operator: "between",
|
|
@@ -59028,6 +59357,24 @@ var queryRuleToInternalFilter = (rule, fieldConfigByName) => {
|
|
|
59028
59357
|
}
|
|
59029
59358
|
};
|
|
59030
59359
|
}
|
|
59360
|
+
if (compactOperatorKey === "inbucket") {
|
|
59361
|
+
const { start, bucket } = parseInBucketValue(rule.value);
|
|
59362
|
+
const range = getExclusiveDateBucketRange(start, bucket);
|
|
59363
|
+
const endInclusive = new Date(Date.parse(range.endExclusive) - 1).toISOString();
|
|
59364
|
+
return {
|
|
59365
|
+
filterType: "date-custom-filter" /* DateCustomFilter */,
|
|
59366
|
+
fieldType: FieldType.Date,
|
|
59367
|
+
operator: DateOperator.Custom,
|
|
59368
|
+
field,
|
|
59369
|
+
table,
|
|
59370
|
+
value: {
|
|
59371
|
+
startDate: range.start,
|
|
59372
|
+
endDate: endInclusive
|
|
59373
|
+
},
|
|
59374
|
+
dateBucket: bucket,
|
|
59375
|
+
fromInBucket: true
|
|
59376
|
+
};
|
|
59377
|
+
}
|
|
59031
59378
|
const dateComparisonOperator = QUERY_TO_DATE_COMPARISON_OPERATOR[compactOperatorKey] ?? QUERY_TO_DATE_COMPARISON_OPERATOR[operatorKey];
|
|
59032
59379
|
if (!dateComparisonOperator) {
|
|
59033
59380
|
throw new Error(`Unsupported date operator "${String(rule.operator)}"`);
|
|
@@ -59214,6 +59561,31 @@ var filterStackToQueryBuilderFilters = (filterStack, fieldConfigByName, qualifyA
|
|
|
59214
59561
|
) : base;
|
|
59215
59562
|
return qualified;
|
|
59216
59563
|
};
|
|
59564
|
+
var queryBuilderFiltersForEditor = (group) => {
|
|
59565
|
+
const mapEntry = (entry) => {
|
|
59566
|
+
if (isCombinator(entry)) return entry;
|
|
59567
|
+
if (isRuleGroup(entry)) {
|
|
59568
|
+
return queryBuilderFiltersForEditor(entry);
|
|
59569
|
+
}
|
|
59570
|
+
if (!isRule(entry)) return entry;
|
|
59571
|
+
const operator = String(entry.operator ?? "").trim().toLowerCase().replace(/[_\s]+/g, "");
|
|
59572
|
+
if (operator !== "inbucket") return entry;
|
|
59573
|
+
const { start, bucket } = parseInBucketValue(entry.value);
|
|
59574
|
+
const range = getExclusiveDateBucketRange(start, bucket);
|
|
59575
|
+
const endInclusive = new Date(
|
|
59576
|
+
Date.parse(range.endExclusive) - 1
|
|
59577
|
+
).toISOString();
|
|
59578
|
+
return {
|
|
59579
|
+
...entry,
|
|
59580
|
+
operator: "between",
|
|
59581
|
+
value: [range.start, endInclusive]
|
|
59582
|
+
};
|
|
59583
|
+
};
|
|
59584
|
+
return {
|
|
59585
|
+
combinator: normalizeCombinator(group.combinator, "and"),
|
|
59586
|
+
rules: (group.rules ?? []).map(mapEntry)
|
|
59587
|
+
};
|
|
59588
|
+
};
|
|
59217
59589
|
var queryBuilderFiltersToFilterStack = (query, fieldConfigByName) => {
|
|
59218
59590
|
if (!isRuleGroup(query)) {
|
|
59219
59591
|
throw new Error("Query must be a rule group");
|
|
@@ -59449,171 +59821,6 @@ function countFilterRules(value) {
|
|
|
59449
59821
|
}, 0);
|
|
59450
59822
|
}
|
|
59451
59823
|
|
|
59452
|
-
// src/hooks/useReportFilterDraft.ts
|
|
59453
|
-
var import_react61 = require("react");
|
|
59454
|
-
var normalizeOperatorKey = (operator) => String(operator ?? "").trim().toLowerCase().replace(/[_\s]+/g, "");
|
|
59455
|
-
var defaultFilterRuleValueForOperator = (operator) => {
|
|
59456
|
-
const key = normalizeOperatorKey(operator);
|
|
59457
|
-
if (key === "in" || key === "notin") {
|
|
59458
|
-
return [];
|
|
59459
|
-
}
|
|
59460
|
-
return "";
|
|
59461
|
-
};
|
|
59462
|
-
var buildSeededFilterQuery = (queryBuilderProps) => {
|
|
59463
|
-
const fieldData = queryBuilderProps?.fields?.[0];
|
|
59464
|
-
const fieldName = String(fieldData?.name ?? "").trim();
|
|
59465
|
-
let operator = "in";
|
|
59466
|
-
const firstOperator = queryBuilderProps?.getOperators?.(fieldName, {
|
|
59467
|
-
fieldData
|
|
59468
|
-
})?.[0];
|
|
59469
|
-
if (firstOperator) {
|
|
59470
|
-
operator = String(firstOperator.name ?? firstOperator.value ?? "in");
|
|
59471
|
-
}
|
|
59472
|
-
return {
|
|
59473
|
-
combinator: "and",
|
|
59474
|
-
rules: [
|
|
59475
|
-
{
|
|
59476
|
-
field: fieldName,
|
|
59477
|
-
operator,
|
|
59478
|
-
value: defaultFilterRuleValueForOperator(operator)
|
|
59479
|
-
}
|
|
59480
|
-
]
|
|
59481
|
-
};
|
|
59482
|
-
};
|
|
59483
|
-
var EMPTY_COMMITTED_FILTERS = {
|
|
59484
|
-
combinator: "and",
|
|
59485
|
-
rules: []
|
|
59486
|
-
};
|
|
59487
|
-
var hashString2 = (input) => {
|
|
59488
|
-
let hash = 2166136261;
|
|
59489
|
-
for (let i = 0; i < input.length; i++) {
|
|
59490
|
-
hash ^= input.charCodeAt(i);
|
|
59491
|
-
hash = Math.imul(hash, 16777619);
|
|
59492
|
-
}
|
|
59493
|
-
return String(hash >>> 0);
|
|
59494
|
-
};
|
|
59495
|
-
var fieldCatalogSignature = (fields) => {
|
|
59496
|
-
const names = fields.map((field) => String(field.name ?? "").trim()).filter(Boolean).sort();
|
|
59497
|
-
return `${names.length}:${hashString2(names.join("\0"))}`;
|
|
59498
|
-
};
|
|
59499
|
-
var committedFiltersSignature = (committed) => {
|
|
59500
|
-
try {
|
|
59501
|
-
return hashString2(
|
|
59502
|
-
JSON.stringify(stripQueryBuilderTransientFields(committed))
|
|
59503
|
-
);
|
|
59504
|
-
} catch {
|
|
59505
|
-
return "unserializable";
|
|
59506
|
-
}
|
|
59507
|
-
};
|
|
59508
|
-
function useReportFilterDraft(args) {
|
|
59509
|
-
const { reportId, committedFilters, queryBuilderProps, setFilters } = args;
|
|
59510
|
-
const committed = isQueryBuilderDisplayGroup(committedFilters) ? committedFilters : EMPTY_COMMITTED_FILTERS;
|
|
59511
|
-
const committedRef = (0, import_react61.useRef)(committed);
|
|
59512
|
-
committedRef.current = committed;
|
|
59513
|
-
const setFiltersRef = (0, import_react61.useRef)(setFilters);
|
|
59514
|
-
setFiltersRef.current = setFilters;
|
|
59515
|
-
const lastNonEmptyFieldsRef = (0, import_react61.useRef)([]);
|
|
59516
|
-
const prevReportIdForFieldsRef = (0, import_react61.useRef)(reportId);
|
|
59517
|
-
if (prevReportIdForFieldsRef.current !== reportId) {
|
|
59518
|
-
prevReportIdForFieldsRef.current = reportId;
|
|
59519
|
-
lastNonEmptyFieldsRef.current = [];
|
|
59520
|
-
}
|
|
59521
|
-
if (queryBuilderProps.fields.length > 0) {
|
|
59522
|
-
lastNonEmptyFieldsRef.current = queryBuilderProps.fields;
|
|
59523
|
-
}
|
|
59524
|
-
const effectiveFields = queryBuilderProps.fields.length > 0 ? queryBuilderProps.fields : lastNonEmptyFieldsRef.current;
|
|
59525
|
-
const effectiveFieldsRef = (0, import_react61.useRef)(effectiveFields);
|
|
59526
|
-
effectiveFieldsRef.current = effectiveFields;
|
|
59527
|
-
const getOperatorsRef = (0, import_react61.useRef)(queryBuilderProps.getOperators);
|
|
59528
|
-
getOperatorsRef.current = queryBuilderProps.getOperators;
|
|
59529
|
-
const committedSignature = (0, import_react61.useMemo)(
|
|
59530
|
-
() => committedFiltersSignature(committed),
|
|
59531
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- `committed` normalizes null to a stable constant
|
|
59532
|
-
[committedFilters]
|
|
59533
|
-
);
|
|
59534
|
-
const fieldsSignature = (0, import_react61.useMemo)(
|
|
59535
|
-
() => fieldCatalogSignature(effectiveFields),
|
|
59536
|
-
[effectiveFields]
|
|
59537
|
-
);
|
|
59538
|
-
const [resetEpoch, setResetEpoch] = (0, import_react61.useState)(0);
|
|
59539
|
-
const [seedEpoch, setSeedEpoch] = (0, import_react61.useState)(0);
|
|
59540
|
-
const draftRef = (0, import_react61.useRef)(committed);
|
|
59541
|
-
const [isFilterDraftDirty, setIsFilterDraftDirty] = (0, import_react61.useState)(false);
|
|
59542
|
-
const [isFilterDraftEmpty, setIsFilterDraftEmpty] = (0, import_react61.useState)(
|
|
59543
|
-
committed.rules.length === 0
|
|
59544
|
-
);
|
|
59545
|
-
const draftResetKey = `${reportId}|${committedSignature}|${resetEpoch}`;
|
|
59546
|
-
const prevDraftResetKeyRef = (0, import_react61.useRef)(draftResetKey);
|
|
59547
|
-
if (prevDraftResetKeyRef.current !== draftResetKey) {
|
|
59548
|
-
prevDraftResetKeyRef.current = draftResetKey;
|
|
59549
|
-
draftRef.current = committed;
|
|
59550
|
-
const nextEmpty = committed.rules.length === 0;
|
|
59551
|
-
if (isFilterDraftDirty) setIsFilterDraftDirty(false);
|
|
59552
|
-
if (isFilterDraftEmpty !== nextEmpty) setIsFilterDraftEmpty(nextEmpty);
|
|
59553
|
-
}
|
|
59554
|
-
const filterDraftKey = `${draftResetKey}|${seedEpoch}|${fieldsSignature}`;
|
|
59555
|
-
const handleQueryChange = (0, import_react61.useCallback)((next) => {
|
|
59556
|
-
if (!isQueryBuilderDisplayGroup(next)) return;
|
|
59557
|
-
const nextGroup = next;
|
|
59558
|
-
draftRef.current = nextGroup;
|
|
59559
|
-
const nextDirty = areQueryBuilderFilterDraftsDirty(
|
|
59560
|
-
nextGroup,
|
|
59561
|
-
committedRef.current
|
|
59562
|
-
);
|
|
59563
|
-
const nextEmpty = nextGroup.rules.length === 0;
|
|
59564
|
-
setIsFilterDraftDirty((prev) => prev === nextDirty ? prev : nextDirty);
|
|
59565
|
-
setIsFilterDraftEmpty((prev) => prev === nextEmpty ? prev : nextEmpty);
|
|
59566
|
-
}, []);
|
|
59567
|
-
const commitFilterDraft = (0, import_react61.useCallback)(() => {
|
|
59568
|
-
setFiltersRef.current(draftRef.current);
|
|
59569
|
-
}, []);
|
|
59570
|
-
const resetFilterDraft = (0, import_react61.useCallback)(() => {
|
|
59571
|
-
draftRef.current = committedRef.current;
|
|
59572
|
-
setIsFilterDraftDirty(false);
|
|
59573
|
-
setIsFilterDraftEmpty(committedRef.current.rules.length === 0);
|
|
59574
|
-
setResetEpoch((epoch) => epoch + 1);
|
|
59575
|
-
}, []);
|
|
59576
|
-
const seedFilterDraft = (0, import_react61.useCallback)(() => {
|
|
59577
|
-
const seeded = buildSeededFilterQuery({
|
|
59578
|
-
fields: effectiveFieldsRef.current,
|
|
59579
|
-
getOperators: getOperatorsRef.current
|
|
59580
|
-
});
|
|
59581
|
-
draftRef.current = seeded;
|
|
59582
|
-
setIsFilterDraftDirty(
|
|
59583
|
-
areQueryBuilderFilterDraftsDirty(seeded, committedRef.current)
|
|
59584
|
-
);
|
|
59585
|
-
setIsFilterDraftEmpty(false);
|
|
59586
|
-
setSeedEpoch((epoch) => epoch + 1);
|
|
59587
|
-
}, []);
|
|
59588
|
-
const getDefaultValue = (0, import_react61.useCallback)(
|
|
59589
|
-
(rule) => defaultFilterRuleValueForOperator(rule?.operator),
|
|
59590
|
-
[]
|
|
59591
|
-
);
|
|
59592
|
-
const filterDraftQueryBuilderProps = (0, import_react61.useMemo)(
|
|
59593
|
-
() => ({
|
|
59594
|
-
...queryBuilderProps,
|
|
59595
|
-
fields: effectiveFields,
|
|
59596
|
-
// Uncontrolled: react-querybuilder owns the draft; only read at mount,
|
|
59597
|
-
// so passing the live draft means popover/remount cycles keep edits.
|
|
59598
|
-
defaultQuery: draftRef.current,
|
|
59599
|
-
onQueryChange: handleQueryChange,
|
|
59600
|
-
addRuleToNewGroups: true,
|
|
59601
|
-
getDefaultValue
|
|
59602
|
-
}),
|
|
59603
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- filterDraftKey covers draftRef resets
|
|
59604
|
-
[queryBuilderProps, effectiveFields, handleQueryChange, getDefaultValue, filterDraftKey]
|
|
59605
|
-
);
|
|
59606
|
-
return {
|
|
59607
|
-
filterDraftKey,
|
|
59608
|
-
filterDraftQueryBuilderProps,
|
|
59609
|
-
isFilterDraftDirty,
|
|
59610
|
-
isFilterDraftEmpty,
|
|
59611
|
-
commitFilterDraft,
|
|
59612
|
-
resetFilterDraft,
|
|
59613
|
-
seedFilterDraft
|
|
59614
|
-
};
|
|
59615
|
-
}
|
|
59616
|
-
|
|
59617
59824
|
// src/hooks/useFormRefreshDecision.ts
|
|
59618
59825
|
var normalize = (value) => String(value ?? "").trim();
|
|
59619
59826
|
var toColumnKey = (table, field) => `${table}::${field}`;
|
|
@@ -59871,6 +60078,13 @@ var AGGREGATION_OPTION_TYPES = [
|
|
|
59871
60078
|
var QUERY_BUILDER_MULTI_VALUE_OPERATORS = /* @__PURE__ */ new Set(["in", "notin"]);
|
|
59872
60079
|
var TABLE_FORMAT_CACHE_MAX_ENTRIES = 5e3;
|
|
59873
60080
|
var PIVOT_DATE_BUCKET_FORMAT_OPTIONS = ["date"];
|
|
60081
|
+
var PIVOT_DATE_BUCKET_OPTIONS = [
|
|
60082
|
+
{ label: "Automatic", value: "" },
|
|
60083
|
+
{ label: "Daily", value: "day" },
|
|
60084
|
+
{ label: "Weekly", value: "week" },
|
|
60085
|
+
{ label: "Monthly", value: "month" },
|
|
60086
|
+
{ label: "Yearly", value: "year" }
|
|
60087
|
+
];
|
|
59874
60088
|
var AXIS_FORMAT_OPTIONS = [
|
|
59875
60089
|
{ value: "string", label: "string" },
|
|
59876
60090
|
{ value: "whole_number", label: "whole number" },
|
|
@@ -59890,6 +60104,7 @@ var AXIS_FORMAT_OPTIONS = [
|
|
|
59890
60104
|
var USEFORM_FILTERS_DEBUG_FLAG = "__QUILL_DEBUG_USEFORM_FILTERS__";
|
|
59891
60105
|
var USEFORM_REFRESH_DEBUG_FLAG = "__QUILL_DEBUG_USEFORM_REFRESH__";
|
|
59892
60106
|
var USEFORM_PIVOT_SHAPE_DEBUG_FLAG = "__QUILL_DEBUG_USEFORM_PIVOT_SHAPE__";
|
|
60107
|
+
var USEFORM_TASK_DEBUG_FLAG = "__QUILL_DEBUG_USEFORM_TASKS__";
|
|
59893
60108
|
var isUseFormFiltersDebugEnabled = () => {
|
|
59894
60109
|
const globalValue = typeof globalThis !== "undefined" ? globalThis?.[USEFORM_FILTERS_DEBUG_FLAG] : void 0;
|
|
59895
60110
|
if (globalValue === true) {
|
|
@@ -59916,6 +60131,23 @@ var isUseFormRefreshDebugEnabled = () => {
|
|
|
59916
60131
|
}
|
|
59917
60132
|
return false;
|
|
59918
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
|
+
};
|
|
59919
60151
|
var isUseFormPivotShapeDebugEnabled = () => {
|
|
59920
60152
|
const globalValue = typeof globalThis !== "undefined" ? globalThis?.[USEFORM_PIVOT_SHAPE_DEBUG_FLAG] : void 0;
|
|
59921
60153
|
if (globalValue === true) {
|
|
@@ -59933,6 +60165,10 @@ var logUseFormPivotShapeDebug = (label, payload) => {
|
|
|
59933
60165
|
if (!isUseFormPivotShapeDebugEnabled()) return;
|
|
59934
60166
|
console.log(`[useReport][pivot-shape] ${label}`, payload);
|
|
59935
60167
|
};
|
|
60168
|
+
var BOOLEAN_FILTER_VALUE_OPTIONS = [
|
|
60169
|
+
{ name: "true", label: "True", value: "true" },
|
|
60170
|
+
{ name: "false", label: "False", value: "false" }
|
|
60171
|
+
];
|
|
59936
60172
|
function canonicalTablesForFilterUniqueValuesQueryKey(tables) {
|
|
59937
60173
|
return (tables ?? []).map((table) => {
|
|
59938
60174
|
const name2 = String(table?.name ?? "").trim();
|
|
@@ -60396,6 +60632,8 @@ function normalizePivotForRefreshComparison(pivot) {
|
|
|
60396
60632
|
const {
|
|
60397
60633
|
rowFieldTable: _pivotRowTable,
|
|
60398
60634
|
columnFieldTable: _pivotColumnTable,
|
|
60635
|
+
rowFilter: _rowFilter,
|
|
60636
|
+
columnFilter: _columnFilter,
|
|
60399
60637
|
aggregations,
|
|
60400
60638
|
...pivotRest
|
|
60401
60639
|
} = record;
|
|
@@ -62005,16 +62243,6 @@ function mergeDisplayAndSourceForTableFormats(args) {
|
|
|
62005
62243
|
});
|
|
62006
62244
|
return { columns, formatByColumnOptionId };
|
|
62007
62245
|
}
|
|
62008
|
-
var USE_FORM_AXIS_SERIES_COLORS = [
|
|
62009
|
-
"#6366f1",
|
|
62010
|
-
"#f59e0b",
|
|
62011
|
-
"#10b981",
|
|
62012
|
-
"#ef4444",
|
|
62013
|
-
"#8b5cf6",
|
|
62014
|
-
"#06b6d4",
|
|
62015
|
-
"#f97316",
|
|
62016
|
-
"#84cc16"
|
|
62017
|
-
];
|
|
62018
62246
|
function axisFormatToSelectLabel(format9) {
|
|
62019
62247
|
const raw = String(format9 ?? "").trim();
|
|
62020
62248
|
const exact = AXIS_FORMAT_OPTIONS.find((option) => option.value === raw);
|
|
@@ -62075,9 +62303,6 @@ function getChartTypeOptions2(formData) {
|
|
|
62075
62303
|
(elem) => !(formData.pivot && formData.pivot.columnField && (elem === "bar" || elem === "pie" || elem === "US map" || elem === "World map"))
|
|
62076
62304
|
).map((elem) => ({ label: elem, value: elem }));
|
|
62077
62305
|
}
|
|
62078
|
-
function isSetReportTableColumnSidebarPatch(columns) {
|
|
62079
|
-
return Boolean(columns) && typeof columns === "object" && !Array.isArray(columns) && "patch" in columns && typeof columns.patch === "object" && columns.patch !== null && typeof columns.patch.id === "string";
|
|
62080
|
-
}
|
|
62081
62306
|
function processPivotState(next, options = {}) {
|
|
62082
62307
|
const {
|
|
62083
62308
|
nextState,
|
|
@@ -62134,7 +62359,10 @@ function processPivotState(next, options = {}) {
|
|
|
62134
62359
|
}
|
|
62135
62360
|
const valueField = String(aggregation.valueField ?? "").trim();
|
|
62136
62361
|
if (!valueField) {
|
|
62137
|
-
return {
|
|
62362
|
+
return {
|
|
62363
|
+
...aggregation,
|
|
62364
|
+
aggregationType: "count"
|
|
62365
|
+
};
|
|
62138
62366
|
}
|
|
62139
62367
|
const valueField2 = String(aggregation.valueField2 ?? "").trim();
|
|
62140
62368
|
if (valueField2 && valueField2 !== valueField) {
|
|
@@ -62494,6 +62722,9 @@ async function loadViaInMemoryEngines({
|
|
|
62494
62722
|
pivot,
|
|
62495
62723
|
reportBuilderState,
|
|
62496
62724
|
allowReportTaskBootstrap = false,
|
|
62725
|
+
debugSource,
|
|
62726
|
+
debugRunId,
|
|
62727
|
+
debugLoadRequestId,
|
|
62497
62728
|
draftSessionId
|
|
62498
62729
|
}) {
|
|
62499
62730
|
const requestedTask = allowReportTaskBootstrap ? "report" : "item";
|
|
@@ -62503,6 +62734,17 @@ async function loadViaInMemoryEngines({
|
|
|
62503
62734
|
rowsPerRequest: DEFAULT_USE_REPORT_ROWS_PER_REQUEST
|
|
62504
62735
|
}
|
|
62505
62736
|
} : {};
|
|
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
|
+
});
|
|
62506
62748
|
const { report, error } = await fetchReport({
|
|
62507
62749
|
reportId,
|
|
62508
62750
|
client,
|
|
@@ -62582,6 +62824,9 @@ async function loadViaPivotTemplate({
|
|
|
62582
62824
|
reportBuilderState,
|
|
62583
62825
|
baseReport,
|
|
62584
62826
|
schema,
|
|
62827
|
+
debugSource,
|
|
62828
|
+
debugRunId,
|
|
62829
|
+
debugLoadRequestId,
|
|
62585
62830
|
draftSessionId
|
|
62586
62831
|
}) {
|
|
62587
62832
|
const pivotForTemplate = enrichPivotRowFieldTypeForTemplate(
|
|
@@ -62589,6 +62834,16 @@ async function loadViaPivotTemplate({
|
|
|
62589
62834
|
schema,
|
|
62590
62835
|
baseReport
|
|
62591
62836
|
);
|
|
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
|
+
});
|
|
62592
62847
|
const { report, error } = await fetchPivotTemplateReportForUseForm({
|
|
62593
62848
|
reportId,
|
|
62594
62849
|
client,
|
|
@@ -62816,8 +63071,19 @@ async function loadPivotTemplateInParallelWithReportTask({
|
|
|
62816
63071
|
customFields,
|
|
62817
63072
|
dashboardName,
|
|
62818
63073
|
pivotRefreshOnly = false,
|
|
63074
|
+
debugSource,
|
|
63075
|
+
debugRunId,
|
|
63076
|
+
debugLoadRequestId,
|
|
62819
63077
|
draftSessionId
|
|
62820
63078
|
}) {
|
|
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
|
+
});
|
|
62821
63087
|
if (pivotRefreshOnly) {
|
|
62822
63088
|
const pivotOnlyResult = await loadViaPivotTemplate({
|
|
62823
63089
|
reportId,
|
|
@@ -62830,6 +63096,9 @@ async function loadPivotTemplateInParallelWithReportTask({
|
|
|
62830
63096
|
reportBuilderState,
|
|
62831
63097
|
baseReport,
|
|
62832
63098
|
schema,
|
|
63099
|
+
debugSource,
|
|
63100
|
+
debugRunId,
|
|
63101
|
+
debugLoadRequestId,
|
|
62833
63102
|
draftSessionId
|
|
62834
63103
|
});
|
|
62835
63104
|
return pivotOnlyResult;
|
|
@@ -62845,6 +63114,9 @@ async function loadPivotTemplateInParallelWithReportTask({
|
|
|
62845
63114
|
pivot,
|
|
62846
63115
|
reportBuilderState,
|
|
62847
63116
|
allowReportTaskBootstrap: true,
|
|
63117
|
+
debugSource,
|
|
63118
|
+
debugRunId,
|
|
63119
|
+
debugLoadRequestId,
|
|
62848
63120
|
draftSessionId
|
|
62849
63121
|
}),
|
|
62850
63122
|
loadViaPivotTemplate({
|
|
@@ -62858,6 +63130,9 @@ async function loadPivotTemplateInParallelWithReportTask({
|
|
|
62858
63130
|
reportBuilderState,
|
|
62859
63131
|
baseReport,
|
|
62860
63132
|
schema,
|
|
63133
|
+
debugSource,
|
|
63134
|
+
debugRunId,
|
|
63135
|
+
debugLoadRequestId,
|
|
62861
63136
|
draftSessionId
|
|
62862
63137
|
}),
|
|
62863
63138
|
fetchReportBuilderStateByReportId({
|
|
@@ -63040,6 +63315,9 @@ async function loadReportForUseForm({
|
|
|
63040
63315
|
customFields,
|
|
63041
63316
|
dashboardName,
|
|
63042
63317
|
useInMemoryEngines,
|
|
63318
|
+
debugSource,
|
|
63319
|
+
debugRunId,
|
|
63320
|
+
debugLoadRequestId,
|
|
63043
63321
|
draftSessionId
|
|
63044
63322
|
}) {
|
|
63045
63323
|
const effectivePivot = pivot ?? initialReportBuilderState?.pivot ?? void 0;
|
|
@@ -63048,6 +63326,18 @@ async function loadReportForUseForm({
|
|
|
63048
63326
|
...initialReportBuilderState,
|
|
63049
63327
|
pivot: effectivePivot ?? initialReportBuilderState.pivot ?? null
|
|
63050
63328
|
} : 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
|
+
});
|
|
63051
63341
|
if (hasPivot) {
|
|
63052
63342
|
const pivotResult = await loadPivotTemplateInParallelWithReportTask({
|
|
63053
63343
|
reportId,
|
|
@@ -63063,6 +63353,9 @@ async function loadReportForUseForm({
|
|
|
63063
63353
|
customFields,
|
|
63064
63354
|
dashboardName,
|
|
63065
63355
|
pivotRefreshOnly: includeReportBuilderStateInPivotTask,
|
|
63356
|
+
debugSource,
|
|
63357
|
+
debugRunId,
|
|
63358
|
+
debugLoadRequestId,
|
|
63066
63359
|
draftSessionId
|
|
63067
63360
|
});
|
|
63068
63361
|
const pivotRows = pivotResult.report?.pivotRows;
|
|
@@ -63111,6 +63404,9 @@ async function loadReportForUseForm({
|
|
|
63111
63404
|
schema,
|
|
63112
63405
|
customFields,
|
|
63113
63406
|
dashboardName,
|
|
63407
|
+
debugSource,
|
|
63408
|
+
debugRunId,
|
|
63409
|
+
debugLoadRequestId,
|
|
63114
63410
|
draftSessionId
|
|
63115
63411
|
});
|
|
63116
63412
|
const normalizedBootstrapResult = bootstrapResult.report?.pivot == null ? stripPivotFromResult(bootstrapResult) : bootstrapResult;
|
|
@@ -63118,6 +63414,15 @@ async function loadReportForUseForm({
|
|
|
63118
63414
|
}
|
|
63119
63415
|
const shouldUseReportTaskForReload = internalFilters.length > 0;
|
|
63120
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
|
+
});
|
|
63121
63426
|
return loadViaInMemoryEngines({
|
|
63122
63427
|
reportId,
|
|
63123
63428
|
client,
|
|
@@ -63126,6 +63431,9 @@ async function loadReportForUseForm({
|
|
|
63126
63431
|
tenants,
|
|
63127
63432
|
flags,
|
|
63128
63433
|
allowReportTaskBootstrap: shouldUseReportTaskForReload,
|
|
63434
|
+
debugSource,
|
|
63435
|
+
debugRunId,
|
|
63436
|
+
debugLoadRequestId,
|
|
63129
63437
|
draftSessionId
|
|
63130
63438
|
});
|
|
63131
63439
|
}
|
|
@@ -63144,12 +63452,18 @@ async function loadReportForUseForm({
|
|
|
63144
63452
|
function generateDraftSessionId() {
|
|
63145
63453
|
return typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : `draft-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
|
|
63146
63454
|
}
|
|
63455
|
+
var nextUseReportDebugRunId = 0;
|
|
63147
63456
|
function useReport(reportIdArg, options = {}) {
|
|
63148
63457
|
const propReportId = String(reportIdArg ?? "").trim();
|
|
63149
|
-
const [createdReportId, setCreatedReportId] = (0,
|
|
63458
|
+
const [createdReportId, setCreatedReportId] = (0, import_react61.useState)(null);
|
|
63150
63459
|
const effectiveReportId = propReportId || createdReportId || "";
|
|
63151
|
-
const { eventTracking } = (0,
|
|
63152
|
-
const [draftSessionId, setDraftSessionId] = (0,
|
|
63460
|
+
const { eventTracking } = (0, import_react61.useContext)(EventTrackingContext);
|
|
63461
|
+
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);
|
|
63153
63467
|
const useInMemoryEngines = options.useInMemoryEngines ?? false;
|
|
63154
63468
|
const restrictFieldOptionsToSelectedDatasources = options.restrictFieldOptionsToSelectedDatasources ?? true;
|
|
63155
63469
|
const reportOverride = options.reportOverride ?? null;
|
|
@@ -63158,30 +63472,30 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63158
63472
|
options.destinationDashboardName ?? ""
|
|
63159
63473
|
).trim();
|
|
63160
63474
|
const controlledPagination = options.state?.pagination;
|
|
63161
|
-
const initialPaginationRef = (0,
|
|
63475
|
+
const initialPaginationRef = (0, import_react61.useRef)({
|
|
63162
63476
|
...getDefaultPaginationState(),
|
|
63163
63477
|
...options.initialState?.pagination ?? {}
|
|
63164
63478
|
});
|
|
63165
|
-
const [internalPagination, setInternalPagination] = (0,
|
|
63479
|
+
const [internalPagination, setInternalPagination] = (0, import_react61.useState)(
|
|
63166
63480
|
initialPaginationRef.current
|
|
63167
63481
|
);
|
|
63168
|
-
const [paginationInteracted, setPaginationInteracted] = (0,
|
|
63482
|
+
const [paginationInteracted, setPaginationInteracted] = (0, import_react61.useState)(
|
|
63169
63483
|
() => Boolean(
|
|
63170
63484
|
options.state?.pagination || options.initialState?.pagination || options.onPaginationChange
|
|
63171
63485
|
)
|
|
63172
63486
|
);
|
|
63173
63487
|
const pagination = controlledPagination ?? internalPagination;
|
|
63174
63488
|
const paginationActive = paginationInteracted || Boolean(controlledPagination);
|
|
63175
|
-
const paginationRef = (0,
|
|
63489
|
+
const paginationRef = (0, import_react61.useRef)(pagination);
|
|
63176
63490
|
paginationRef.current = pagination;
|
|
63177
|
-
const onPaginationChangeRef = (0,
|
|
63491
|
+
const onPaginationChangeRef = (0, import_react61.useRef)(options.onPaginationChange);
|
|
63178
63492
|
onPaginationChangeRef.current = options.onPaginationChange;
|
|
63179
|
-
const controlledPaginationRef = (0,
|
|
63493
|
+
const controlledPaginationRef = (0, import_react61.useRef)(Boolean(controlledPagination));
|
|
63180
63494
|
controlledPaginationRef.current = Boolean(controlledPagination);
|
|
63181
|
-
const autoResetPageIndexRef = (0,
|
|
63495
|
+
const autoResetPageIndexRef = (0, import_react61.useRef)(true);
|
|
63182
63496
|
autoResetPageIndexRef.current = options.autoResetPageIndex ?? true;
|
|
63183
|
-
const paginationPageCountRef = (0,
|
|
63184
|
-
const applyPaginationUpdate = (0,
|
|
63497
|
+
const paginationPageCountRef = (0, import_react61.useRef)(-1);
|
|
63498
|
+
const applyPaginationUpdate = (0, import_react61.useCallback)(
|
|
63185
63499
|
(updater, { activate = true } = {}) => {
|
|
63186
63500
|
if (activate) {
|
|
63187
63501
|
setPaginationInteracted(true);
|
|
@@ -63193,11 +63507,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63193
63507
|
},
|
|
63194
63508
|
[]
|
|
63195
63509
|
);
|
|
63196
|
-
const setPagination = (0,
|
|
63510
|
+
const setPagination = (0, import_react61.useCallback)(
|
|
63197
63511
|
(updater) => applyPaginationUpdate(updater),
|
|
63198
63512
|
[applyPaginationUpdate]
|
|
63199
63513
|
);
|
|
63200
|
-
const setPageIndex = (0,
|
|
63514
|
+
const setPageIndex = (0, import_react61.useCallback)(
|
|
63201
63515
|
(updater) => applyPaginationUpdate((old) => ({
|
|
63202
63516
|
...old,
|
|
63203
63517
|
pageIndex: clampPageIndex(
|
|
@@ -63207,7 +63521,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63207
63521
|
})),
|
|
63208
63522
|
[applyPaginationUpdate]
|
|
63209
63523
|
);
|
|
63210
|
-
const setPageSize = (0,
|
|
63524
|
+
const setPageSize = (0, import_react61.useCallback)(
|
|
63211
63525
|
(updater) => applyPaginationUpdate(
|
|
63212
63526
|
(old) => paginationStateAfterPageSizeChange(
|
|
63213
63527
|
old,
|
|
@@ -63216,62 +63530,64 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63216
63530
|
),
|
|
63217
63531
|
[applyPaginationUpdate]
|
|
63218
63532
|
);
|
|
63219
|
-
const resetPagination = (0,
|
|
63533
|
+
const resetPagination = (0, import_react61.useCallback)(
|
|
63220
63534
|
(defaultState) => applyPaginationUpdate(
|
|
63221
63535
|
defaultState ? getDefaultPaginationState() : initialPaginationRef.current
|
|
63222
63536
|
),
|
|
63223
63537
|
[applyPaginationUpdate]
|
|
63224
63538
|
);
|
|
63225
|
-
const resetPageIndex = (0,
|
|
63539
|
+
const resetPageIndex = (0, import_react61.useCallback)(
|
|
63226
63540
|
(defaultState) => {
|
|
63227
63541
|
const target = defaultState ? 0 : initialPaginationRef.current.pageIndex;
|
|
63228
63542
|
setPageIndex(target);
|
|
63229
63543
|
},
|
|
63230
63544
|
[setPageIndex]
|
|
63231
63545
|
);
|
|
63232
|
-
const resetPageSize = (0,
|
|
63546
|
+
const resetPageSize = (0, import_react61.useCallback)(
|
|
63233
63547
|
(defaultState) => {
|
|
63234
63548
|
const target = defaultState ? getDefaultPaginationState().pageSize : initialPaginationRef.current.pageSize;
|
|
63235
63549
|
setPageSize(target);
|
|
63236
63550
|
},
|
|
63237
63551
|
[setPageSize]
|
|
63238
63552
|
);
|
|
63239
|
-
const nextPage = (0,
|
|
63553
|
+
const nextPage = (0, import_react61.useCallback)(
|
|
63240
63554
|
() => setPageIndex((old) => old + 1),
|
|
63241
63555
|
[setPageIndex]
|
|
63242
63556
|
);
|
|
63243
|
-
const previousPage = (0,
|
|
63557
|
+
const previousPage = (0, import_react61.useCallback)(
|
|
63244
63558
|
() => setPageIndex((old) => old - 1),
|
|
63245
63559
|
[setPageIndex]
|
|
63246
63560
|
);
|
|
63247
|
-
const firstPage = (0,
|
|
63248
|
-
const lastPage = (0,
|
|
63561
|
+
const firstPage = (0, import_react61.useCallback)(() => setPageIndex(0), [setPageIndex]);
|
|
63562
|
+
const lastPage = (0, import_react61.useCallback)(
|
|
63249
63563
|
() => setPageIndex(paginationPageCountRef.current - 1),
|
|
63250
63564
|
[setPageIndex]
|
|
63251
63565
|
);
|
|
63252
|
-
const chartPivotHydratedFromSourceRef = (0,
|
|
63253
|
-
const lastPivotHydrateCompletedSourceIdRef = (0,
|
|
63254
|
-
const groupRowsBySetViaSetReportRef = (0,
|
|
63255
|
-
const groupColumnsBySetViaSetReportRef = (0,
|
|
63256
|
-
const
|
|
63257
|
-
const
|
|
63566
|
+
const chartPivotHydratedFromSourceRef = (0, import_react61.useRef)(false);
|
|
63567
|
+
const lastPivotHydrateCompletedSourceIdRef = (0, import_react61.useRef)(null);
|
|
63568
|
+
const groupRowsBySetViaSetReportRef = (0, import_react61.useRef)(false);
|
|
63569
|
+
const groupColumnsBySetViaSetReportRef = (0, import_react61.useRef)(false);
|
|
63570
|
+
const dateBucketSetViaSetReportRef = (0, import_react61.useRef)(false);
|
|
63571
|
+
const aggregationStateSetViaSetReportRef = (0, import_react61.useRef)(false);
|
|
63572
|
+
const prevReportIdForChartPivotHydrationRef = (0, import_react61.useRef)(effectiveReportId);
|
|
63258
63573
|
if (prevReportIdForChartPivotHydrationRef.current !== effectiveReportId) {
|
|
63259
63574
|
prevReportIdForChartPivotHydrationRef.current = effectiveReportId;
|
|
63260
63575
|
chartPivotHydratedFromSourceRef.current = false;
|
|
63261
63576
|
groupRowsBySetViaSetReportRef.current = false;
|
|
63262
63577
|
groupColumnsBySetViaSetReportRef.current = false;
|
|
63578
|
+
dateBucketSetViaSetReportRef.current = false;
|
|
63263
63579
|
aggregationStateSetViaSetReportRef.current = false;
|
|
63264
63580
|
}
|
|
63265
|
-
const [chartPivotHydrationEpoch, setChartPivotHydrationEpoch] = (0,
|
|
63581
|
+
const [chartPivotHydrationEpoch, setChartPivotHydrationEpoch] = (0, import_react61.useState)(0);
|
|
63266
63582
|
const [
|
|
63267
63583
|
expandReportBuilderColumnsForFlatTable,
|
|
63268
63584
|
setExpandReportBuilderColumnsForFlatTable
|
|
63269
|
-
] = (0,
|
|
63270
|
-
const prevPivotStateForColumnExpansionRef = (0,
|
|
63271
|
-
const [sourceReport, setSourceReport] = (0,
|
|
63585
|
+
] = (0, import_react61.useState)(false);
|
|
63586
|
+
const prevPivotStateForColumnExpansionRef = (0, import_react61.useRef)(null);
|
|
63587
|
+
const [sourceReport, setSourceReport] = (0, import_react61.useState)(
|
|
63272
63588
|
null
|
|
63273
63589
|
);
|
|
63274
|
-
const prevSourceReportIdForPivotHydrationRef = (0,
|
|
63590
|
+
const prevSourceReportIdForPivotHydrationRef = (0, import_react61.useRef)(null);
|
|
63275
63591
|
{
|
|
63276
63592
|
const currentSourceId = sourceReport ? String(
|
|
63277
63593
|
sourceReport.id ?? sourceReport._id ?? ""
|
|
@@ -63283,15 +63599,15 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63283
63599
|
lastPivotHydrateCompletedSourceIdRef.current = null;
|
|
63284
63600
|
}
|
|
63285
63601
|
}
|
|
63286
|
-
const [preserveSchemaWideOptions, setPreserveSchemaWideOptions] = (0,
|
|
63287
|
-
const [initialSchemaScopedTableNames, setInitialSchemaScopedTableNames] = (0,
|
|
63288
|
-
const [tableColumnsEditedSignature, setTableColumnsEditedSignature] = (0,
|
|
63289
|
-
const [chartAxisEdits, setChartAxisEdits] = (0,
|
|
63290
|
-
const [chartVisibilityOverrides, setChartVisibilityOverrides] = (0,
|
|
63291
|
-
const [client] = (0,
|
|
63292
|
-
const [schemaData] = (0,
|
|
63293
|
-
const { tenants, flags } = (0,
|
|
63294
|
-
const { getToken } = (0,
|
|
63602
|
+
const [preserveSchemaWideOptions, setPreserveSchemaWideOptions] = (0, import_react61.useState)(false);
|
|
63603
|
+
const [initialSchemaScopedTableNames, setInitialSchemaScopedTableNames] = (0, import_react61.useState)(null);
|
|
63604
|
+
const [tableColumnsEditedSignature, setTableColumnsEditedSignature] = (0, import_react61.useState)(null);
|
|
63605
|
+
const [chartAxisEdits, setChartAxisEdits] = (0, import_react61.useState)({});
|
|
63606
|
+
const [chartVisibilityOverrides, setChartVisibilityOverrides] = (0, import_react61.useState)({});
|
|
63607
|
+
const [client] = (0, import_react61.useContext)(ClientContext);
|
|
63608
|
+
const [schemaData] = (0, import_react61.useContext)(SchemaDataContext);
|
|
63609
|
+
const { tenants, flags } = (0, import_react61.useContext)(TenantContext);
|
|
63610
|
+
const { getToken } = (0, import_react61.useContext)(FetchContext);
|
|
63295
63611
|
const clientDefaultDashboardName = String(
|
|
63296
63612
|
client?.defaultDashboard?.name ?? ""
|
|
63297
63613
|
).trim();
|
|
@@ -63300,7 +63616,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63300
63616
|
clientDefaultDashboardName,
|
|
63301
63617
|
destinationDashboardName
|
|
63302
63618
|
].map((entry) => String(entry ?? "").trim()).find((entry) => entry.length > 0) ?? "";
|
|
63303
|
-
const initialFormState = (0,
|
|
63619
|
+
const initialFormState = (0, import_react61.useMemo)(
|
|
63304
63620
|
() => ({
|
|
63305
63621
|
columns: [],
|
|
63306
63622
|
queryColumns: [],
|
|
@@ -63308,6 +63624,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63308
63624
|
queryFilters: { combinator: "and", rules: [] },
|
|
63309
63625
|
groupRowsBy: void 0,
|
|
63310
63626
|
groupColumnsBy: void 0,
|
|
63627
|
+
dateBucket: void 0,
|
|
63311
63628
|
aggregationState: [],
|
|
63312
63629
|
aggregationTablesByIndex: [],
|
|
63313
63630
|
pivotSort: void 0,
|
|
@@ -63318,7 +63635,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63318
63635
|
}),
|
|
63319
63636
|
[]
|
|
63320
63637
|
);
|
|
63321
|
-
const [formRuntimeState, dispatchFormRuntime] = (0,
|
|
63638
|
+
const [formRuntimeState, dispatchFormRuntime] = (0, import_react61.useReducer)(
|
|
63322
63639
|
useFormReducer,
|
|
63323
63640
|
initialFormState,
|
|
63324
63641
|
createInitialUseFormReducerState
|
|
@@ -63337,6 +63654,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63337
63654
|
queryFilters,
|
|
63338
63655
|
groupRowsBy,
|
|
63339
63656
|
groupColumnsBy,
|
|
63657
|
+
dateBucket,
|
|
63340
63658
|
aggregationState,
|
|
63341
63659
|
aggregationTablesByIndex,
|
|
63342
63660
|
pivotSort,
|
|
@@ -63346,32 +63664,32 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63346
63664
|
schemaDatasourceIds
|
|
63347
63665
|
} = formState;
|
|
63348
63666
|
const schemaDatasourceIdsKey = schemaDatasourceIds?.map((id) => String(id ?? "").trim()).join("\0") ?? "";
|
|
63349
|
-
const queryColumnsBootstrapKey = (0,
|
|
63667
|
+
const queryColumnsBootstrapKey = (0, import_react61.useMemo)(
|
|
63350
63668
|
() => queryColumns.map(
|
|
63351
63669
|
(c) => `${String(c.table ?? "").trim()}\0${String(c.field ?? "").trim()}`
|
|
63352
63670
|
).join("\n"),
|
|
63353
63671
|
[queryColumns]
|
|
63354
63672
|
);
|
|
63355
|
-
const dashboardNameForNewReport = (0,
|
|
63673
|
+
const dashboardNameForNewReport = (0, import_react61.useMemo)(() => {
|
|
63356
63674
|
return [clientDefaultDashboardName, destinationDashboardName].map((entry) => String(entry ?? "").trim()).find((entry) => entry.length > 0) ?? "";
|
|
63357
63675
|
}, [clientDefaultDashboardName, destinationDashboardName]);
|
|
63358
|
-
const filterStackRef = (0,
|
|
63676
|
+
const filterStackRef = (0, import_react61.useRef)(filterStack);
|
|
63359
63677
|
filterStackRef.current = filterStack;
|
|
63360
63678
|
const resolvedGroupRowsBy = decodePivotGroupOptionValue(groupRowsBy);
|
|
63361
63679
|
const resolvedGroupColumnsBy = decodePivotGroupOptionValue(groupColumnsBy);
|
|
63362
63680
|
const useFormRefreshDebugEnabled = isUseFormRefreshDebugEnabled();
|
|
63363
63681
|
const useFormFiltersDebugEnabled = isUseFormFiltersDebugEnabled();
|
|
63364
|
-
(0,
|
|
63682
|
+
(0, import_react61.useEffect)(() => {
|
|
63365
63683
|
if (propReportId) {
|
|
63366
63684
|
setCreatedReportId(null);
|
|
63367
63685
|
}
|
|
63368
63686
|
}, [propReportId]);
|
|
63369
|
-
(0,
|
|
63687
|
+
(0, import_react61.useEffect)(() => {
|
|
63370
63688
|
setChartAxisEdits({});
|
|
63371
63689
|
setChartVisibilityOverrides({});
|
|
63372
63690
|
}, [effectiveReportId]);
|
|
63373
|
-
const bootstrapReportTaskUsedForReportIdRef = (0,
|
|
63374
|
-
const schemaScopeInitializedForReportIdRef = (0,
|
|
63691
|
+
const bootstrapReportTaskUsedForReportIdRef = (0, import_react61.useRef)(null);
|
|
63692
|
+
const schemaScopeInitializedForReportIdRef = (0, import_react61.useRef)(null);
|
|
63375
63693
|
const initializeSchemaScopeForReport = (report) => {
|
|
63376
63694
|
if (!report) return;
|
|
63377
63695
|
if (schemaScopeInitializedForReportIdRef.current === effectiveReportId)
|
|
@@ -63384,26 +63702,26 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63384
63702
|
);
|
|
63385
63703
|
schemaScopeInitializedForReportIdRef.current = effectiveReportId;
|
|
63386
63704
|
};
|
|
63387
|
-
const internalFilters = (0,
|
|
63705
|
+
const internalFilters = (0, import_react61.useMemo)(
|
|
63388
63706
|
() => internalFiltersFromFilterStack(filterStack),
|
|
63389
63707
|
[filterStack]
|
|
63390
63708
|
);
|
|
63391
|
-
const customFilters = (0,
|
|
63709
|
+
const customFilters = (0, import_react61.useMemo)(
|
|
63392
63710
|
() => customFiltersFromFilterStack(filterStack),
|
|
63393
63711
|
[filterStack]
|
|
63394
63712
|
);
|
|
63395
|
-
const reloadKey = (0,
|
|
63396
|
-
const schemaForReportBuilderState = (0,
|
|
63713
|
+
const reloadKey = (0, import_react61.useMemo)(() => 0, []);
|
|
63714
|
+
const schemaForReportBuilderState = (0, import_react61.useMemo)(() => {
|
|
63397
63715
|
if (schemaData.schemaWithCustomFields?.length) {
|
|
63398
63716
|
return schemaData.schemaWithCustomFields;
|
|
63399
63717
|
}
|
|
63400
63718
|
return schemaData.schema ?? [];
|
|
63401
63719
|
}, [schemaData.schema, schemaData.schemaWithCustomFields]);
|
|
63402
|
-
const schemaForReportBuilderStateRef = (0,
|
|
63403
|
-
const customFieldsRef = (0,
|
|
63720
|
+
const schemaForReportBuilderStateRef = (0, import_react61.useRef)(schemaForReportBuilderState);
|
|
63721
|
+
const customFieldsRef = (0, import_react61.useRef)(schemaData.customFields);
|
|
63404
63722
|
schemaForReportBuilderStateRef.current = schemaForReportBuilderState;
|
|
63405
63723
|
customFieldsRef.current = schemaData.customFields;
|
|
63406
|
-
const isBoolAggregationField = (0,
|
|
63724
|
+
const isBoolAggregationField = (0, import_react61.useCallback)(
|
|
63407
63725
|
(field, table2) => {
|
|
63408
63726
|
const fieldType = resolveFieldType({
|
|
63409
63727
|
field,
|
|
@@ -63416,19 +63734,19 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63416
63734
|
},
|
|
63417
63735
|
[]
|
|
63418
63736
|
);
|
|
63419
|
-
const schemaForeignKeyMap = (0,
|
|
63737
|
+
const schemaForeignKeyMap = (0, import_react61.useMemo)(
|
|
63420
63738
|
() => getSchemaForeignKeyMapping(schemaForReportBuilderState),
|
|
63421
63739
|
[schemaForReportBuilderState]
|
|
63422
63740
|
);
|
|
63423
63741
|
const reportBuilderBaseTableNamesKey = (sourceReport?.reportBuilderState?.tables ?? []).map((t) => String(t?.name ?? "").trim()).filter(Boolean).join("\0") ?? "";
|
|
63424
|
-
const selectedBaseTableNamesForFieldOptions = (0,
|
|
63742
|
+
const selectedBaseTableNamesForFieldOptions = (0, import_react61.useMemo)(() => {
|
|
63425
63743
|
const fromPicker = schemaDatasourceIds?.map((id) => String(id ?? "").trim()).filter(Boolean) ?? [];
|
|
63426
63744
|
if (fromPicker.length > 0) {
|
|
63427
63745
|
return fromPicker;
|
|
63428
63746
|
}
|
|
63429
63747
|
return (sourceReport?.reportBuilderState?.tables ?? []).map((t) => String(t?.name ?? "").trim()).filter(Boolean);
|
|
63430
63748
|
}, [schemaDatasourceIdsKey, reportBuilderBaseTableNamesKey]);
|
|
63431
|
-
const fieldOptionsAllowedTableNames = (0,
|
|
63749
|
+
const fieldOptionsAllowedTableNames = (0, import_react61.useMemo)(() => {
|
|
63432
63750
|
if (!restrictFieldOptionsToSelectedDatasources) {
|
|
63433
63751
|
return null;
|
|
63434
63752
|
}
|
|
@@ -63440,7 +63758,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63440
63758
|
restrictFieldOptionsToSelectedDatasources,
|
|
63441
63759
|
selectedBaseTableNamesForFieldOptions
|
|
63442
63760
|
]);
|
|
63443
|
-
(0,
|
|
63761
|
+
(0, import_react61.useEffect)(() => {
|
|
63444
63762
|
if (reportOverride) return;
|
|
63445
63763
|
if (propReportId) return;
|
|
63446
63764
|
if (createdReportId) return;
|
|
@@ -63530,18 +63848,18 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63530
63848
|
schemaForReportBuilderState,
|
|
63531
63849
|
queryColumnsBootstrapKey
|
|
63532
63850
|
]);
|
|
63533
|
-
const datasourceOptions = (0,
|
|
63851
|
+
const datasourceOptions = (0, import_react61.useMemo)(() => {
|
|
63534
63852
|
const seen = /* @__PURE__ */ new Set();
|
|
63535
63853
|
const result = [];
|
|
63536
63854
|
for (const table2 of schemaForReportBuilderState) {
|
|
63537
63855
|
const name2 = String(table2.name ?? "").trim();
|
|
63538
63856
|
if (!name2 || seen.has(name2)) continue;
|
|
63539
63857
|
seen.add(name2);
|
|
63540
|
-
result.push({
|
|
63858
|
+
result.push({ value: name2, label: toTitleCaseLabel(name2) });
|
|
63541
63859
|
}
|
|
63542
63860
|
return result;
|
|
63543
63861
|
}, [schemaForReportBuilderState]);
|
|
63544
|
-
const queryBuilderFieldConfigByName = (0,
|
|
63862
|
+
const queryBuilderFieldConfigByName = (0, import_react61.useMemo)(() => {
|
|
63545
63863
|
const configByName = buildQueryBuilderFieldConfigByName(
|
|
63546
63864
|
schemaForReportBuilderState
|
|
63547
63865
|
);
|
|
@@ -63675,7 +63993,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63675
63993
|
sourceReport?.columns,
|
|
63676
63994
|
sourceReport?.reportBuilderState?.columns
|
|
63677
63995
|
]);
|
|
63678
|
-
const filterUniqueValuesRequest = (0,
|
|
63996
|
+
const filterUniqueValuesRequest = (0, import_react61.useMemo)(() => {
|
|
63679
63997
|
const dashboardName = resolvedSourceDashboardName;
|
|
63680
63998
|
const reportBuilderStateFromSource = sourceReport?.reportBuilderState;
|
|
63681
63999
|
const isStringReportBuilderColumn = (column) => {
|
|
@@ -63896,20 +64214,20 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63896
64214
|
sourceReport?.reportBuilderState,
|
|
63897
64215
|
resolvedSourceDashboardName
|
|
63898
64216
|
]);
|
|
63899
|
-
const filterUniqueValuesRequestHash = (0,
|
|
64217
|
+
const filterUniqueValuesRequestHash = (0, import_react61.useMemo)(
|
|
63900
64218
|
() => stableSerializeForQueryKey(
|
|
63901
64219
|
filterUniqueValuesRequestForQueryKey(filterUniqueValuesRequest)
|
|
63902
64220
|
),
|
|
63903
64221
|
[filterUniqueValuesRequest]
|
|
63904
64222
|
);
|
|
63905
|
-
const customFiltersHashForUniqueValues = (0,
|
|
64223
|
+
const customFiltersHashForUniqueValues = (0, import_react61.useMemo)(
|
|
63906
64224
|
() => stableSerializeForQueryKey(customFilters),
|
|
63907
64225
|
[customFilters]
|
|
63908
64226
|
);
|
|
63909
64227
|
const filterUniqueValuesEnabled = Boolean(
|
|
63910
64228
|
client && client?.queryEndpoint && filterUniqueValuesRequest && filterUniqueValuesRequest.stringColumns.length > 0
|
|
63911
64229
|
);
|
|
63912
|
-
(0,
|
|
64230
|
+
(0, import_react61.useEffect)(() => {
|
|
63913
64231
|
if (!useFormFiltersDebugEnabled) return;
|
|
63914
64232
|
const hasClient = Boolean(client);
|
|
63915
64233
|
const hasQueryEndpoint = Boolean(client?.queryEndpoint);
|
|
@@ -63999,7 +64317,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63999
64317
|
enabled: filterUniqueValuesEnabled,
|
|
64000
64318
|
retry: false
|
|
64001
64319
|
});
|
|
64002
|
-
const backendUniqueValuesByFieldName = (0,
|
|
64320
|
+
const backendUniqueValuesByFieldName = (0, import_react61.useMemo)(() => {
|
|
64003
64321
|
const valuesByField = /* @__PURE__ */ new Map();
|
|
64004
64322
|
const uniqueValuesByColumn = filterUniqueValuesQuery.data?.uniqueValuesByColumn;
|
|
64005
64323
|
if (!uniqueValuesByColumn || typeof uniqueValuesByColumn !== "object") {
|
|
@@ -64032,7 +64350,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64032
64350
|
filterUniqueValuesQuery.data?.uniqueValuesByColumn,
|
|
64033
64351
|
filterUniqueValuesRequest?.stringColumnsByTable
|
|
64034
64352
|
]);
|
|
64035
|
-
(0,
|
|
64353
|
+
(0, import_react61.useEffect)(() => {
|
|
64036
64354
|
if (!useFormFiltersDebugEnabled) return;
|
|
64037
64355
|
if (filterUniqueValuesQuery.status !== "success" && filterUniqueValuesQuery.status !== "error") {
|
|
64038
64356
|
return;
|
|
@@ -64048,7 +64366,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64048
64366
|
effectiveReportId,
|
|
64049
64367
|
useFormFiltersDebugEnabled
|
|
64050
64368
|
]);
|
|
64051
|
-
const filterValueOptionsByFieldName = (0,
|
|
64369
|
+
const filterValueOptionsByFieldName = (0, import_react61.useMemo)(() => {
|
|
64052
64370
|
const optionsByField = /* @__PURE__ */ new Map();
|
|
64053
64371
|
const selectedMultiselectByField = collectSelectedStringMultiselectValuesByField(queryFilters);
|
|
64054
64372
|
const collectValuesForField = (fieldName) => {
|
|
@@ -64114,7 +64432,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64114
64432
|
queryBuilderFieldConfigByName,
|
|
64115
64433
|
queryFilters
|
|
64116
64434
|
]);
|
|
64117
|
-
const filterFieldsComputed = (0,
|
|
64435
|
+
const filterFieldsComputed = (0, import_react61.useMemo)(() => {
|
|
64118
64436
|
const fields = [];
|
|
64119
64437
|
const seen = /* @__PURE__ */ new Set();
|
|
64120
64438
|
const addField = (fieldName, fieldType, tableName, rawFieldName) => {
|
|
@@ -64215,9 +64533,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64215
64533
|
queryBuilderFieldConfigByName,
|
|
64216
64534
|
queryFilters
|
|
64217
64535
|
]);
|
|
64218
|
-
const filterFieldsStableReportIdRef = (0,
|
|
64219
|
-
const filterFieldsStableCacheRef = (0,
|
|
64220
|
-
const filterFields = (0,
|
|
64536
|
+
const filterFieldsStableReportIdRef = (0, import_react61.useRef)("");
|
|
64537
|
+
const filterFieldsStableCacheRef = (0, import_react61.useRef)([]);
|
|
64538
|
+
const filterFields = (0, import_react61.useMemo)(() => {
|
|
64221
64539
|
const rid = String(effectiveReportId ?? "");
|
|
64222
64540
|
if (filterFieldsStableReportIdRef.current !== rid) {
|
|
64223
64541
|
filterFieldsStableReportIdRef.current = rid;
|
|
@@ -64232,14 +64550,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64232
64550
|
}
|
|
64233
64551
|
return filterFieldsComputed;
|
|
64234
64552
|
}, [effectiveReportId, filterFieldsComputed]);
|
|
64235
|
-
const getFilterOperators = (0,
|
|
64553
|
+
const getFilterOperators = (0, import_react61.useMemo)(
|
|
64236
64554
|
() => (_field, misc) => {
|
|
64237
64555
|
const fieldType = misc?.fieldData?.quillFieldType ?? queryBuilderFieldConfigByName[String(_field ?? "").trim()]?.fieldType ?? "string";
|
|
64238
64556
|
return QUERY_BUILDER_OPERATORS_BY_FIELD_TYPE[fieldType] ?? QUERY_BUILDER_OPERATORS_BY_FIELD_TYPE.string;
|
|
64239
64557
|
},
|
|
64240
64558
|
[queryBuilderFieldConfigByName]
|
|
64241
64559
|
);
|
|
64242
|
-
const getFilterInputType = (0,
|
|
64560
|
+
const getFilterInputType = (0, import_react61.useMemo)(
|
|
64243
64561
|
() => (_field, operator, misc) => {
|
|
64244
64562
|
const fieldType = misc?.fieldData?.quillFieldType ?? queryBuilderFieldConfigByName[String(_field ?? "").trim()]?.fieldType ?? "string";
|
|
64245
64563
|
if (fieldType === "date" && isRelativeDateQueryBuilderOperator(operator)) {
|
|
@@ -64249,17 +64567,20 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64249
64567
|
},
|
|
64250
64568
|
[queryBuilderFieldConfigByName]
|
|
64251
64569
|
);
|
|
64252
|
-
const getFilterValueEditorType = (0,
|
|
64570
|
+
const getFilterValueEditorType = (0, import_react61.useMemo)(
|
|
64253
64571
|
() => (_field, operator, misc) => {
|
|
64254
64572
|
const fieldType = misc?.fieldData?.quillFieldType ?? queryBuilderFieldConfigByName[String(_field ?? "").trim()]?.fieldType;
|
|
64255
64573
|
if (fieldType === "string" && isMultiValueOperator(operator)) {
|
|
64256
64574
|
return "multiselect";
|
|
64257
64575
|
}
|
|
64576
|
+
if (fieldType === "boolean") {
|
|
64577
|
+
return "select";
|
|
64578
|
+
}
|
|
64258
64579
|
return void 0;
|
|
64259
64580
|
},
|
|
64260
64581
|
[queryBuilderFieldConfigByName]
|
|
64261
64582
|
);
|
|
64262
|
-
const getFilterValues = (0,
|
|
64583
|
+
const getFilterValues = (0, import_react61.useMemo)(
|
|
64263
64584
|
() => (_field, operator, misc) => {
|
|
64264
64585
|
const fieldName = String(_field ?? "").trim();
|
|
64265
64586
|
if (!fieldName) {
|
|
@@ -64270,6 +64591,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64270
64591
|
misc,
|
|
64271
64592
|
queryBuilderFieldConfigByName
|
|
64272
64593
|
);
|
|
64594
|
+
if (fieldType === "boolean") {
|
|
64595
|
+
return BOOLEAN_FILTER_VALUE_OPTIONS;
|
|
64596
|
+
}
|
|
64273
64597
|
if (fieldType !== "string" || !isMultiValueOperator(operator)) {
|
|
64274
64598
|
return [];
|
|
64275
64599
|
}
|
|
@@ -64286,7 +64610,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64286
64610
|
},
|
|
64287
64611
|
[filterValueOptionsByFieldName, queryBuilderFieldConfigByName]
|
|
64288
64612
|
);
|
|
64289
|
-
const filterQueryBuilderProps = (0,
|
|
64613
|
+
const filterQueryBuilderProps = (0, import_react61.useMemo)(
|
|
64290
64614
|
() => ({
|
|
64291
64615
|
fields: filterFields,
|
|
64292
64616
|
listsAsArrays: true,
|
|
@@ -64303,7 +64627,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64303
64627
|
getFilterValues
|
|
64304
64628
|
]
|
|
64305
64629
|
);
|
|
64306
|
-
const filtersForQueryBuilder = (0,
|
|
64630
|
+
const filtersForQueryBuilder = (0, import_react61.useMemo)(
|
|
64307
64631
|
() => canonicalizeMultiselectStringRulesToOptionValues(
|
|
64308
64632
|
queryFilters,
|
|
64309
64633
|
filterValueOptionsByFieldName,
|
|
@@ -64370,12 +64694,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64370
64694
|
...table2 ? { table: table2 } : {}
|
|
64371
64695
|
};
|
|
64372
64696
|
};
|
|
64373
|
-
const tenantHash = (0,
|
|
64697
|
+
const tenantHash = (0, import_react61.useMemo)(
|
|
64374
64698
|
() => stableSerializeForQueryKey(tenants),
|
|
64375
64699
|
[tenants]
|
|
64376
64700
|
);
|
|
64377
|
-
const flagHash = (0,
|
|
64378
|
-
const clientHash = (0,
|
|
64701
|
+
const flagHash = (0, import_react61.useMemo)(() => stableSerializeForQueryKey(flags), [flags]);
|
|
64702
|
+
const clientHash = (0, import_react61.useMemo)(
|
|
64379
64703
|
() => stableSerializeForQueryKey({
|
|
64380
64704
|
publicKey: client?.publicKey,
|
|
64381
64705
|
clientId: client?.clientId,
|
|
@@ -64383,16 +64707,16 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64383
64707
|
}),
|
|
64384
64708
|
[client]
|
|
64385
64709
|
);
|
|
64386
|
-
const reloadKeyHash = (0,
|
|
64710
|
+
const reloadKeyHash = (0, import_react61.useMemo)(
|
|
64387
64711
|
() => stableSerializeForQueryKey(reloadKey),
|
|
64388
64712
|
[reloadKey]
|
|
64389
64713
|
);
|
|
64390
|
-
(0,
|
|
64714
|
+
(0, import_react61.useEffect)(() => {
|
|
64391
64715
|
if (!reportOverride) return;
|
|
64392
64716
|
initializeSchemaScopeForReport(reportOverride);
|
|
64393
64717
|
setSourceReport(reportOverride);
|
|
64394
64718
|
}, [reportOverride, propReportId]);
|
|
64395
|
-
(0,
|
|
64719
|
+
(0, import_react61.useEffect)(() => {
|
|
64396
64720
|
schemaScopeInitializedForReportIdRef.current = null;
|
|
64397
64721
|
bootstrapReportTaskUsedForReportIdRef.current = null;
|
|
64398
64722
|
setPreserveSchemaWideOptions(false);
|
|
@@ -64416,6 +64740,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64416
64740
|
// grouping from the prior report would otherwise win over the new report.
|
|
64417
64741
|
groupRowsBy: void 0,
|
|
64418
64742
|
groupColumnsBy: void 0,
|
|
64743
|
+
dateBucket: void 0,
|
|
64419
64744
|
aggregationState: [],
|
|
64420
64745
|
aggregationTablesByIndex: [],
|
|
64421
64746
|
pivotSort: void 0,
|
|
@@ -64441,6 +64766,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64441
64766
|
clientHash
|
|
64442
64767
|
}),
|
|
64443
64768
|
queryFn: createUseFormQueryFn(async () => {
|
|
64769
|
+
taskDebugLoadRequestIdRef.current += 1;
|
|
64770
|
+
const debugLoadRequestId = taskDebugLoadRequestIdRef.current;
|
|
64444
64771
|
const allowReportTaskBootstrap = !initialReportBuilderState && bootstrapReportTaskUsedForReportIdRef.current !== effectiveReportId;
|
|
64445
64772
|
const loadTargetId = String(effectiveReportId ?? "").trim();
|
|
64446
64773
|
const sourceReportIdentity = String(
|
|
@@ -64464,6 +64791,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64464
64791
|
customFields: customFieldsRef.current,
|
|
64465
64792
|
dashboardName: resolvedSourceDashboardName,
|
|
64466
64793
|
useInMemoryEngines,
|
|
64794
|
+
debugSource: "initial-load",
|
|
64795
|
+
debugRunId: taskDebugRunId,
|
|
64796
|
+
debugLoadRequestId,
|
|
64467
64797
|
draftSessionId: draftSessionId || void 0
|
|
64468
64798
|
});
|
|
64469
64799
|
return loadResult;
|
|
@@ -64497,13 +64827,13 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64497
64827
|
const sourceReportNameForTitle = String(sourceReport?.name ?? "").trim();
|
|
64498
64828
|
const reportTitleFromTask = String(reportNameQuery.data?.name ?? "").trim();
|
|
64499
64829
|
const resolvedReportName = reportNameQueryReportId && sourceReportIdForTitle === reportNameQueryReportId && sourceReportNameForTitle ? sourceReportNameForTitle : reportTitleFromTask || sourceReportNameForTitle || "";
|
|
64500
|
-
(0,
|
|
64830
|
+
(0, import_react61.useEffect)(() => {
|
|
64501
64831
|
if (reportOverride) return;
|
|
64502
64832
|
const report = initialLoadQuery.data?.report ?? null;
|
|
64503
64833
|
initializeSchemaScopeForReport(report);
|
|
64504
64834
|
setSourceReport(report);
|
|
64505
64835
|
}, [initialLoadQuery.data, reportOverride, effectiveReportId]);
|
|
64506
|
-
(0,
|
|
64836
|
+
(0, import_react61.useEffect)(() => {
|
|
64507
64837
|
if (!sourceReport) {
|
|
64508
64838
|
return;
|
|
64509
64839
|
}
|
|
@@ -64602,6 +64932,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64602
64932
|
const sourceDisplayColumns = sourceDisplayColumnsFromSchema.length > 0 ? sourceDisplayColumnsFromSchema : sourceQueryColumns;
|
|
64603
64933
|
const nextGroupRowsBy = shouldTakePivotGroupsFromSource ? groupRowsBySetViaSetReportRef.current ? prev.groupRowsBy : sourceRowGroupOption : prev.groupRowsBy !== void 0 ? prev.groupRowsBy : groupRowsBySetViaSetReportRef.current ? prev.groupRowsBy : sourceRowGroupOption;
|
|
64604
64934
|
const nextGroupColumnsBy = shouldTakePivotGroupsFromSource ? groupColumnsBySetViaSetReportRef.current ? prev.groupColumnsBy : sourceColumnGroupOption : prev.groupColumnsBy !== void 0 ? prev.groupColumnsBy : prev.groupRowsBy !== void 0 ? prev.groupColumnsBy : sourceColumnGroupOption;
|
|
64935
|
+
const sourceDateBucket = sourceReport.pivot?.dateBucket ?? sourceReport.reportBuilderState?.pivot?.dateBucket;
|
|
64936
|
+
const nextDateBucket = dateBucketSetViaSetReportRef.current ? prev.dateBucket : sourceDateBucket;
|
|
64605
64937
|
const nextFromSource = {
|
|
64606
64938
|
...prev,
|
|
64607
64939
|
queryColumns: prev.queryColumns.length ? prev.queryColumns : sourceQueryColumns,
|
|
@@ -64610,6 +64942,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64610
64942
|
queryFilters: nextQueryFilters,
|
|
64611
64943
|
groupRowsBy: nextGroupRowsBy,
|
|
64612
64944
|
groupColumnsBy: nextGroupColumnsBy,
|
|
64945
|
+
dateBucket: nextDateBucket,
|
|
64613
64946
|
aggregationState: nextAggregationState,
|
|
64614
64947
|
aggregationTablesByIndex: nextAggregationTablesByIndex,
|
|
64615
64948
|
pivotSort: prev.pivotSort ?? (sourceReport.pivot?.sort && sourceReport.pivot?.sortField && sourceReport.pivot?.sortDirection ? {
|
|
@@ -64642,11 +64975,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64642
64975
|
schemaForReportBuilderState,
|
|
64643
64976
|
sourceReport
|
|
64644
64977
|
]);
|
|
64645
|
-
const appliedAggregationState = (0,
|
|
64978
|
+
const appliedAggregationState = (0, import_react61.useMemo)(
|
|
64646
64979
|
() => aggregationState.filter(isAppliedAggregation),
|
|
64647
64980
|
[aggregationState]
|
|
64648
64981
|
);
|
|
64649
|
-
const pivotState = (0,
|
|
64982
|
+
const pivotState = (0, import_react61.useMemo)(() => {
|
|
64650
64983
|
if (!resolvedGroupRowsBy && !resolvedGroupColumnsBy && appliedAggregationState.length === 0) {
|
|
64651
64984
|
return null;
|
|
64652
64985
|
}
|
|
@@ -64690,6 +65023,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64690
65023
|
rowFieldType,
|
|
64691
65024
|
columnField: effectiveColumnField,
|
|
64692
65025
|
columnFieldType,
|
|
65026
|
+
dateBucket: chartPivotHydratedFromSourceRef.current ? dateBucket : dateBucket ?? priorPivot?.dateBucket,
|
|
64693
65027
|
aggregations,
|
|
64694
65028
|
...rowFieldTable ? { rowFieldTable } : {},
|
|
64695
65029
|
...columnFieldTable ? { columnFieldTable } : {}
|
|
@@ -64700,6 +65034,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64700
65034
|
aggregationTablesByIndex,
|
|
64701
65035
|
appliedAggregationState,
|
|
64702
65036
|
baseReportBuilderTables,
|
|
65037
|
+
dateBucket,
|
|
64703
65038
|
groupColumnsBy,
|
|
64704
65039
|
groupRowsBy,
|
|
64705
65040
|
schemaForReportBuilderState,
|
|
@@ -64711,7 +65046,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64711
65046
|
effectiveReportId,
|
|
64712
65047
|
chartPivotHydrationEpoch
|
|
64713
65048
|
]);
|
|
64714
|
-
(0,
|
|
65049
|
+
(0, import_react61.useEffect)(() => {
|
|
64715
65050
|
const previous = prevPivotStateForColumnExpansionRef.current;
|
|
64716
65051
|
if (previous && !pivotState) {
|
|
64717
65052
|
setExpandReportBuilderColumnsForFlatTable(true);
|
|
@@ -64721,7 +65056,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64721
65056
|
}
|
|
64722
65057
|
prevPivotStateForColumnExpansionRef.current = pivotState;
|
|
64723
65058
|
}, [pivotState]);
|
|
64724
|
-
const effectiveReportBuilderTables = (0,
|
|
65059
|
+
const effectiveReportBuilderTables = (0, import_react61.useMemo)(() => {
|
|
64725
65060
|
const explicitBaseFromSchemaPicker = Array.isArray(schemaDatasourceIds) && schemaDatasourceIds.length > 0 ? schemaDatasourceIds.map((tableName) => String(tableName ?? "").trim()).filter(Boolean).map((name2) => ({ name: name2 })) : null;
|
|
64726
65061
|
const baseTablesForMerge = explicitBaseFromSchemaPicker ?? baseReportBuilderTables;
|
|
64727
65062
|
return mergeReportBuilderTables(
|
|
@@ -64745,28 +65080,18 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64745
65080
|
queryColumns,
|
|
64746
65081
|
schemaDatasourceIds
|
|
64747
65082
|
]);
|
|
64748
|
-
const datasources = (0,
|
|
64749
|
-
return effectiveReportBuilderTables.map((table2) =>
|
|
64750
|
-
const name2 = String(table2.name ?? "").trim();
|
|
64751
|
-
if (!name2) return null;
|
|
64752
|
-
const alias = String(table2.alias ?? "").trim();
|
|
64753
|
-
return {
|
|
64754
|
-
id: name2,
|
|
64755
|
-
label: alias || name2
|
|
64756
|
-
};
|
|
64757
|
-
}).filter(
|
|
64758
|
-
(entry) => Boolean(entry)
|
|
64759
|
-
);
|
|
65083
|
+
const datasources = (0, import_react61.useMemo)(() => {
|
|
65084
|
+
return effectiveReportBuilderTables.map((table2) => String(table2.name ?? "").trim()).filter((name2) => Boolean(name2));
|
|
64760
65085
|
}, [effectiveReportBuilderTables]);
|
|
64761
|
-
const effectiveReportBuilderTableNames = (0,
|
|
65086
|
+
const effectiveReportBuilderTableNames = (0, import_react61.useMemo)(
|
|
64762
65087
|
() => effectiveReportBuilderTables.map((table2) => String(table2.name ?? "").trim()).filter((name2) => Boolean(name2)),
|
|
64763
65088
|
[effectiveReportBuilderTables]
|
|
64764
65089
|
);
|
|
64765
|
-
const baseReportBuilderTableNames = (0,
|
|
65090
|
+
const baseReportBuilderTableNames = (0, import_react61.useMemo)(
|
|
64766
65091
|
() => baseReportBuilderTables.map((table2) => String(table2.name ?? "").trim()).filter((name2) => Boolean(name2)),
|
|
64767
65092
|
[baseReportBuilderTables]
|
|
64768
65093
|
);
|
|
64769
|
-
const normalizeQueryBuilderFieldNameForConfig = (0,
|
|
65094
|
+
const normalizeQueryBuilderFieldNameForConfig = (0, import_react61.useMemo)(() => {
|
|
64770
65095
|
const configEntries = Object.entries(queryBuilderFieldConfigByName);
|
|
64771
65096
|
const preferredTableNames = /* @__PURE__ */ new Set([
|
|
64772
65097
|
...effectiveReportBuilderTableNames,
|
|
@@ -64828,7 +65153,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64828
65153
|
effectiveReportBuilderTableNames,
|
|
64829
65154
|
queryBuilderFieldConfigByName
|
|
64830
65155
|
]);
|
|
64831
|
-
const normalizeQueryBuilderFiltersForConfig = (0,
|
|
65156
|
+
const normalizeQueryBuilderFiltersForConfig = (0, import_react61.useMemo)(() => {
|
|
64832
65157
|
const normalizeGroup = (group) => {
|
|
64833
65158
|
const groupRules = Array.isArray(group.rules) ? group.rules : [];
|
|
64834
65159
|
const nextRules = groupRules.map((entry) => {
|
|
@@ -64865,14 +65190,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64865
65190
|
return normalizeGroup(group);
|
|
64866
65191
|
};
|
|
64867
65192
|
}, [normalizeQueryBuilderFieldNameForConfig, queryBuilderFieldConfigByName]);
|
|
64868
|
-
const refreshSelectionTables = (0,
|
|
65193
|
+
const refreshSelectionTables = (0, import_react61.useMemo)(() => {
|
|
64869
65194
|
return [
|
|
64870
65195
|
getPivotGroupOptionTable(groupRowsBy),
|
|
64871
65196
|
getPivotGroupOptionTable(groupColumnsBy),
|
|
64872
65197
|
...aggregationTablesByIndex
|
|
64873
65198
|
].map((tableName) => String(tableName ?? "").trim()).filter((tableName) => Boolean(tableName));
|
|
64874
65199
|
}, [aggregationTablesByIndex, groupColumnsBy, groupRowsBy]);
|
|
64875
|
-
const refreshSelectionFields = (0,
|
|
65200
|
+
const refreshSelectionFields = (0, import_react61.useMemo)(() => {
|
|
64876
65201
|
const resolveFieldTableForSelection = (field, tableHint) => {
|
|
64877
65202
|
const fieldName = String(field ?? "").trim();
|
|
64878
65203
|
if (!fieldName) return "";
|
|
@@ -64922,7 +65247,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64922
65247
|
schemaForReportBuilderState,
|
|
64923
65248
|
sourceReport
|
|
64924
65249
|
]);
|
|
64925
|
-
const refreshDecision = (0,
|
|
65250
|
+
const refreshDecision = (0, import_react61.useMemo)(
|
|
64926
65251
|
() => decideReportBuilderRefresh({
|
|
64927
65252
|
baseTables: baseReportBuilderTables,
|
|
64928
65253
|
baseColumns: baseReportBuilderColumns,
|
|
@@ -64936,7 +65261,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64936
65261
|
refreshSelectionTables
|
|
64937
65262
|
]
|
|
64938
65263
|
);
|
|
64939
|
-
const effectiveReportBuilderColumns = (0,
|
|
65264
|
+
const effectiveReportBuilderColumns = (0, import_react61.useMemo)(() => {
|
|
64940
65265
|
const columnsFromPivot = [];
|
|
64941
65266
|
const appendPivotColumn = (field, tableHint) => {
|
|
64942
65267
|
const normalizedField = String(field ?? "").trim();
|
|
@@ -64999,7 +65324,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64999
65324
|
queryColumns,
|
|
65000
65325
|
sourceReport
|
|
65001
65326
|
]);
|
|
65002
|
-
(0,
|
|
65327
|
+
(0, import_react61.useEffect)(() => {
|
|
65003
65328
|
if (!Array.isArray(filterStack) || filterStack.length === 0) {
|
|
65004
65329
|
return;
|
|
65005
65330
|
}
|
|
@@ -65034,7 +65359,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65034
65359
|
queryBuilderFieldConfigByName,
|
|
65035
65360
|
queryFilters
|
|
65036
65361
|
]);
|
|
65037
|
-
const resolvedSortFieldType = (0,
|
|
65362
|
+
const resolvedSortFieldType = (0, import_react61.useMemo)(() => {
|
|
65038
65363
|
const sortField = pivotSort?.sortField;
|
|
65039
65364
|
if (!sortField || !pivotState) return void 0;
|
|
65040
65365
|
if (sortField === resolvedGroupRowsBy) {
|
|
@@ -65055,7 +65380,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65055
65380
|
resolvedGroupColumnsBy,
|
|
65056
65381
|
resolvedGroupRowsBy
|
|
65057
65382
|
]);
|
|
65058
|
-
const effectiveReportBuilderState = (0,
|
|
65383
|
+
const effectiveReportBuilderState = (0, import_react61.useMemo)(() => {
|
|
65059
65384
|
if (!sourceReport && effectiveReportBuilderTables.length === 0) {
|
|
65060
65385
|
return void 0;
|
|
65061
65386
|
}
|
|
@@ -65094,12 +65419,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65094
65419
|
resolvedSortFieldType,
|
|
65095
65420
|
sourceReport
|
|
65096
65421
|
]);
|
|
65097
|
-
const effectiveReportBuilderStateHash = (0,
|
|
65422
|
+
const effectiveReportBuilderStateHash = (0, import_react61.useMemo)(
|
|
65098
65423
|
() => stableSerializeForQueryKey(effectiveReportBuilderState),
|
|
65099
65424
|
[effectiveReportBuilderState]
|
|
65100
65425
|
);
|
|
65101
|
-
const prevPaginationResetStateHashRef = (0,
|
|
65102
|
-
(0,
|
|
65426
|
+
const prevPaginationResetStateHashRef = (0, import_react61.useRef)(null);
|
|
65427
|
+
(0, import_react61.useEffect)(() => {
|
|
65103
65428
|
const prevHash = prevPaginationResetStateHashRef.current;
|
|
65104
65429
|
prevPaginationResetStateHashRef.current = effectiveReportBuilderStateHash;
|
|
65105
65430
|
if (prevHash === null || prevHash === effectiveReportBuilderStateHash) {
|
|
@@ -65115,7 +65440,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65115
65440
|
activate: false
|
|
65116
65441
|
});
|
|
65117
65442
|
}, [applyPaginationUpdate, effectiveReportBuilderStateHash]);
|
|
65118
|
-
const pivotTableDataReportBuilderState = (0,
|
|
65443
|
+
const pivotTableDataReportBuilderState = (0, import_react61.useMemo)(() => {
|
|
65119
65444
|
if (!effectiveReportBuilderState?.pivot) {
|
|
65120
65445
|
return void 0;
|
|
65121
65446
|
}
|
|
@@ -65135,11 +65460,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65135
65460
|
limit: null
|
|
65136
65461
|
};
|
|
65137
65462
|
}, [effectiveReportBuilderState, schemaForReportBuilderState]);
|
|
65138
|
-
const pivotTableDataReportBuilderStateHash = (0,
|
|
65463
|
+
const pivotTableDataReportBuilderStateHash = (0, import_react61.useMemo)(
|
|
65139
65464
|
() => stableSerializeForQueryKey(pivotTableDataReportBuilderState),
|
|
65140
65465
|
[pivotTableDataReportBuilderState]
|
|
65141
65466
|
);
|
|
65142
|
-
const sourceReportMatchesEffectiveReportId = (0,
|
|
65467
|
+
const sourceReportMatchesEffectiveReportId = (0, import_react61.useMemo)(() => {
|
|
65143
65468
|
const loadTarget = String(effectiveReportId ?? "").trim();
|
|
65144
65469
|
if (!loadTarget || !sourceReport) {
|
|
65145
65470
|
return true;
|
|
@@ -65149,7 +65474,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65149
65474
|
).trim();
|
|
65150
65475
|
return sid === loadTarget;
|
|
65151
65476
|
}, [effectiveReportId, sourceReport]);
|
|
65152
|
-
const shouldSkipRedundantFlatTableReportBuilderQuery = (0,
|
|
65477
|
+
const shouldSkipRedundantFlatTableReportBuilderQuery = (0, import_react61.useMemo)(() => {
|
|
65153
65478
|
if (!sourceReport || pivotState) {
|
|
65154
65479
|
return false;
|
|
65155
65480
|
}
|
|
@@ -65204,7 +65529,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65204
65529
|
enabled: tableRefreshQueryEnabled,
|
|
65205
65530
|
retry: false
|
|
65206
65531
|
});
|
|
65207
|
-
(0,
|
|
65532
|
+
(0, import_react61.useEffect)(() => {
|
|
65208
65533
|
if (!tableRefreshQueryEnabled) return;
|
|
65209
65534
|
const report = tableRefreshQuery.data?.report;
|
|
65210
65535
|
if (tableRefreshQuery.data?.error || !report) return;
|
|
@@ -65215,10 +65540,10 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65215
65540
|
tableRefreshQueryEnabled,
|
|
65216
65541
|
useFormRefreshDebugEnabled
|
|
65217
65542
|
]);
|
|
65218
|
-
const chartTypes = (0,
|
|
65543
|
+
const chartTypes = (0, import_react61.useMemo)(() => {
|
|
65219
65544
|
return getChartTypeOptions2({ pivot: pivotState });
|
|
65220
65545
|
}, [pivotState]);
|
|
65221
|
-
(0,
|
|
65546
|
+
(0, import_react61.useEffect)(() => {
|
|
65222
65547
|
if (!sourceReport) {
|
|
65223
65548
|
return;
|
|
65224
65549
|
}
|
|
@@ -65253,7 +65578,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65253
65578
|
});
|
|
65254
65579
|
}
|
|
65255
65580
|
}, [chartType, chartTypes, sourceReport]);
|
|
65256
|
-
const schemaScopedTableNames = (0,
|
|
65581
|
+
const schemaScopedTableNames = (0, import_react61.useMemo)(() => {
|
|
65257
65582
|
if (preserveSchemaWideOptions) {
|
|
65258
65583
|
return [];
|
|
65259
65584
|
}
|
|
@@ -65268,7 +65593,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65268
65593
|
preserveSchemaWideOptions,
|
|
65269
65594
|
sourceReport?.reportBuilderState?.tables
|
|
65270
65595
|
]);
|
|
65271
|
-
const joinCompatibleSchemaTableNames = (0,
|
|
65596
|
+
const joinCompatibleSchemaTableNames = (0, import_react61.useMemo)(() => {
|
|
65272
65597
|
if (schemaScopedTableNames.length === 0) {
|
|
65273
65598
|
return [];
|
|
65274
65599
|
}
|
|
@@ -65277,7 +65602,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65277
65602
|
schemaForeignKeyMap
|
|
65278
65603
|
);
|
|
65279
65604
|
}, [schemaForeignKeyMap, schemaScopedTableNames]);
|
|
65280
|
-
const aggregationFallbackTarget = (0,
|
|
65605
|
+
const aggregationFallbackTarget = (0, import_react61.useMemo)(() => {
|
|
65281
65606
|
const tableNames = effectiveReportBuilderTables.map((table2) => table2.name).filter((name2) => Boolean(name2));
|
|
65282
65607
|
const referencedTableNames = (sourceReport?.referencedTables ?? []).filter(
|
|
65283
65608
|
(name2) => typeof name2 === "string" && name2.length > 0
|
|
@@ -65285,7 +65610,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65285
65610
|
const tableNamesToUse = tableNames.length ? tableNames : referencedTableNames;
|
|
65286
65611
|
return tableNamesToUse.length > 0 ? tableNamesToUse.join(", ") : "table";
|
|
65287
65612
|
}, [effectiveReportBuilderTables, sourceReport?.referencedTables]);
|
|
65288
|
-
const aggregationFallbackTableName = (0,
|
|
65613
|
+
const aggregationFallbackTableName = (0, import_react61.useMemo)(() => {
|
|
65289
65614
|
const tableNames = effectiveReportBuilderTables.map((table2) => table2.name).filter((name2) => Boolean(name2));
|
|
65290
65615
|
const referencedTableNames = (sourceReport?.referencedTables ?? []).filter(
|
|
65291
65616
|
(name2) => typeof name2 === "string" && name2.length > 0
|
|
@@ -65293,7 +65618,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65293
65618
|
const tableNamesToUse = tableNames.length ? tableNames : referencedTableNames;
|
|
65294
65619
|
return tableNamesToUse[0] ?? "table";
|
|
65295
65620
|
}, [effectiveReportBuilderTables, sourceReport?.referencedTables]);
|
|
65296
|
-
const cleanedAggregations = (0,
|
|
65621
|
+
const cleanedAggregations = (0, import_react61.useMemo)(() => {
|
|
65297
65622
|
return aggregationState.filter((aggregation) => Boolean(aggregation?.aggregationType)).map((aggregation, index) => {
|
|
65298
65623
|
const aggregationType = String(aggregation.aggregationType);
|
|
65299
65624
|
const normalizedAggregationType = aggregationType.toLowerCase();
|
|
@@ -65315,7 +65640,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65315
65640
|
aggregationTablesByIndex,
|
|
65316
65641
|
isBoolAggregationField
|
|
65317
65642
|
]);
|
|
65318
|
-
const { aggregationBaseOptions, aggregationOptionTableLookup } = (0,
|
|
65643
|
+
const { aggregationBaseOptions, aggregationOptionTableLookup } = (0, import_react61.useMemo)(() => {
|
|
65319
65644
|
const joinScoped = fieldOptionsAllowedTableNames ? joinCompatibleSchemaTableNames.filter(
|
|
65320
65645
|
(name2) => fieldOptionsAllowedTableNames.has(name2)
|
|
65321
65646
|
) : joinCompatibleSchemaTableNames;
|
|
@@ -65361,7 +65686,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65361
65686
|
if (!canAggregateColumn(column, aggregationType)) continue;
|
|
65362
65687
|
const isNumberSharePercentage = aggregationType === "percentage" && !isBoolColumn;
|
|
65363
65688
|
if (isNumberSharePercentage && !resolvedGroupRowsBy) continue;
|
|
65364
|
-
const value = `${aggregationType}:${fieldName}`;
|
|
65689
|
+
const value = tableName ? `${aggregationType}:${tableName}::${fieldName}` : `${aggregationType}:${fieldName}`;
|
|
65365
65690
|
if (seen.has(value)) continue;
|
|
65366
65691
|
const aggregationWord = aggregationType === "percentage" ? isBoolColumn ? "Percent" : "Percent of Total" : formatAggregationTypeForDisplay(aggregationType);
|
|
65367
65692
|
options2.push({
|
|
@@ -65369,8 +65694,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65369
65694
|
label: tableName ? `${aggregationWord} ${toTitleCaseLabel(tableName)} ${toTitleCaseLabel(fieldName)}` : `${aggregationWord} ${toTitleCaseLabel(fieldName)}`
|
|
65370
65695
|
});
|
|
65371
65696
|
seen.add(value);
|
|
65372
|
-
if (tableName
|
|
65373
|
-
tableLookup.
|
|
65697
|
+
if (tableName) {
|
|
65698
|
+
if (!tableLookup.has(value)) {
|
|
65699
|
+
tableLookup.set(value, tableName);
|
|
65700
|
+
}
|
|
65701
|
+
const unqualifiedValue = `${aggregationType}:${fieldName}`;
|
|
65702
|
+
if (!tableLookup.has(unqualifiedValue)) {
|
|
65703
|
+
tableLookup.set(unqualifiedValue, tableName);
|
|
65704
|
+
}
|
|
65374
65705
|
}
|
|
65375
65706
|
}
|
|
65376
65707
|
}
|
|
@@ -65392,7 +65723,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65392
65723
|
resolvedGroupRowsBy,
|
|
65393
65724
|
schemaForReportBuilderState
|
|
65394
65725
|
]);
|
|
65395
|
-
const { schemaColumnOptions, columnIdentifierLookup } = (0,
|
|
65726
|
+
const { schemaColumnOptions, columnIdentifierLookup } = (0, import_react61.useMemo)(() => {
|
|
65396
65727
|
const lookup = /* @__PURE__ */ new Map();
|
|
65397
65728
|
const options2 = [];
|
|
65398
65729
|
for (const table2 of schemaData.schemaWithCustomFields) {
|
|
@@ -65419,7 +65750,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65419
65750
|
columnIdentifierLookup: lookup
|
|
65420
65751
|
};
|
|
65421
65752
|
}, [schemaData.schemaWithCustomFields]);
|
|
65422
|
-
const tableColumnPickerPoolOptions = (0,
|
|
65753
|
+
const tableColumnPickerPoolOptions = (0, import_react61.useMemo)(() => {
|
|
65423
65754
|
const allowed = new Set(
|
|
65424
65755
|
effectiveReportBuilderTableNames.map((name2) => String(name2 ?? "").trim()).filter(Boolean)
|
|
65425
65756
|
);
|
|
@@ -65430,16 +65761,16 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65430
65761
|
(option) => allowed.has(String(option.tableName ?? "").trim())
|
|
65431
65762
|
);
|
|
65432
65763
|
}, [effectiveReportBuilderTableNames, schemaColumnOptions]);
|
|
65433
|
-
const columns = (0,
|
|
65764
|
+
const columns = (0, import_react61.useMemo)(() => {
|
|
65434
65765
|
return displayColumns.filter((column) => Boolean(column.field)).map((column) => encodeColumnOptionValue(column.table, column.field));
|
|
65435
65766
|
}, [displayColumns]);
|
|
65436
|
-
const selectedColumnOptions = (0,
|
|
65767
|
+
const selectedColumnOptions = (0, import_react61.useMemo)(() => {
|
|
65437
65768
|
return displayColumns.map((column) => {
|
|
65438
65769
|
const value = column.alias || column.field;
|
|
65439
65770
|
return value ? { label: value, value } : null;
|
|
65440
65771
|
}).filter((option) => option !== null);
|
|
65441
65772
|
}, [displayColumns]);
|
|
65442
|
-
const scopedSchemaColumns = (0,
|
|
65773
|
+
const scopedSchemaColumns = (0, import_react61.useMemo)(() => {
|
|
65443
65774
|
const tableNames = fieldOptionsAllowedTableNames ? Array.from(fieldOptionsAllowedTableNames) : joinCompatibleSchemaTableNames;
|
|
65444
65775
|
const schemaTables = schemaForReportBuilderState;
|
|
65445
65776
|
const tablesToUse = tableNames.length ? schemaTables.filter((table2) => tableNames.includes(table2.name ?? "")) : schemaTables;
|
|
@@ -65460,7 +65791,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65460
65791
|
joinCompatibleSchemaTableNames,
|
|
65461
65792
|
schemaForReportBuilderState
|
|
65462
65793
|
]);
|
|
65463
|
-
const pivotUniqueValuesByColumn = (0,
|
|
65794
|
+
const pivotUniqueValuesByColumn = (0, import_react61.useMemo)(() => {
|
|
65464
65795
|
const explicitUniqueValues = sourceReport?.uniqueStringsByColumn ?? sourceReport?.columnUniqueValues ?? sourceReport?.uniqueValues;
|
|
65465
65796
|
if (explicitUniqueValues && typeof explicitUniqueValues === "object" && !Array.isArray(explicitUniqueValues)) {
|
|
65466
65797
|
return explicitUniqueValues;
|
|
@@ -65486,7 +65817,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65486
65817
|
}
|
|
65487
65818
|
return result;
|
|
65488
65819
|
}, [sourceReport]);
|
|
65489
|
-
const possiblePivotFields = (0,
|
|
65820
|
+
const possiblePivotFields = (0, import_react61.useMemo)(() => {
|
|
65490
65821
|
const options2 = getPossiblePivotFieldOptions(
|
|
65491
65822
|
scopedSchemaColumns,
|
|
65492
65823
|
pivotUniqueValuesByColumn
|
|
@@ -65497,7 +65828,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65497
65828
|
columnFields: options2.columnFields.filter((field) => !isIdColumn(field))
|
|
65498
65829
|
};
|
|
65499
65830
|
}, [scopedSchemaColumns, pivotUniqueValuesByColumn]);
|
|
65500
|
-
const groupRowsByOptions = (0,
|
|
65831
|
+
const groupRowsByOptions = (0, import_react61.useMemo)(() => {
|
|
65501
65832
|
const allowedFields = new Set(possiblePivotFields.rowFields);
|
|
65502
65833
|
const seenValues = /* @__PURE__ */ new Set();
|
|
65503
65834
|
const options2 = [];
|
|
@@ -65524,7 +65855,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65524
65855
|
}
|
|
65525
65856
|
return options2;
|
|
65526
65857
|
}, [groupRowsBy, possiblePivotFields.rowFields, scopedSchemaColumns]);
|
|
65527
|
-
const groupColumnsByOptions = (0,
|
|
65858
|
+
const groupColumnsByOptions = (0, import_react61.useMemo)(() => {
|
|
65528
65859
|
const allowedFields = new Set(possiblePivotFields.columnFields);
|
|
65529
65860
|
const seenValues = /* @__PURE__ */ new Set();
|
|
65530
65861
|
const options2 = [];
|
|
@@ -65551,19 +65882,19 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65551
65882
|
}
|
|
65552
65883
|
return options2;
|
|
65553
65884
|
}, [groupColumnsBy, possiblePivotFields.columnFields, scopedSchemaColumns]);
|
|
65554
|
-
const cleanedSort = (0,
|
|
65885
|
+
const cleanedSort = (0, import_react61.useMemo)(() => {
|
|
65555
65886
|
const activeSort = resolvedGroupRowsBy ? pivotSort : regularSort;
|
|
65556
65887
|
if (!activeSort?.sortField || !activeSort?.sortDirection) {
|
|
65557
65888
|
return "";
|
|
65558
65889
|
}
|
|
65559
65890
|
return toFlatSortValue(activeSort.sortField, activeSort.sortDirection);
|
|
65560
65891
|
}, [pivotSort, regularSort, resolvedGroupRowsBy]);
|
|
65561
|
-
const aggregationSortLabelFallbackTable = (0,
|
|
65892
|
+
const aggregationSortLabelFallbackTable = (0, import_react61.useMemo)(() => {
|
|
65562
65893
|
const reportBuilderTableName = effectiveReportBuilderTables.map((table2) => String(table2.name ?? "").trim()).find((tableName) => Boolean(tableName));
|
|
65563
65894
|
if (reportBuilderTableName) return reportBuilderTableName;
|
|
65564
65895
|
return (sourceReport?.referencedTables ?? []).map((tableName) => String(tableName ?? "").trim()).find((tableName) => Boolean(tableName));
|
|
65565
65896
|
}, [effectiveReportBuilderTables, sourceReport?.referencedTables]);
|
|
65566
|
-
const sortOptions = (0,
|
|
65897
|
+
const sortOptions = (0, import_react61.useMemo)(() => {
|
|
65567
65898
|
if (resolvedGroupRowsBy) {
|
|
65568
65899
|
const aggregationSortFields = getPivotAggregationSortFields(
|
|
65569
65900
|
aggregationState,
|
|
@@ -65622,12 +65953,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65622
65953
|
resolvedGroupRowsBy,
|
|
65623
65954
|
selectedColumnOptions
|
|
65624
65955
|
]);
|
|
65625
|
-
const aggregationOptions = (0,
|
|
65956
|
+
const { aggregationValues, aggregationOptions } = (0, import_react61.useMemo)(() => {
|
|
65626
65957
|
const baseOptions = aggregationBaseOptions.map((option) => ({
|
|
65627
65958
|
value: option.value,
|
|
65628
65959
|
label: option.label
|
|
65629
65960
|
}));
|
|
65630
|
-
|
|
65961
|
+
const seenValues = new Set(baseOptions.map((option) => option.value));
|
|
65962
|
+
const injectedOptions = [];
|
|
65963
|
+
const values = aggregationState.map((aggregation, index) => {
|
|
65631
65964
|
const normalizedAggregationType = String(
|
|
65632
65965
|
aggregation.aggregationType ?? ""
|
|
65633
65966
|
).toLowerCase();
|
|
@@ -65635,27 +65968,36 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65635
65968
|
const currentValueField = String(aggregation.valueField ?? "").trim();
|
|
65636
65969
|
const currentValueField2 = String(aggregation.valueField2 ?? "").trim();
|
|
65637
65970
|
const isPercentageRatio = normalizedAggregationType === "percentage" && Boolean(currentValueField) && Boolean(currentValueField2);
|
|
65638
|
-
const
|
|
65639
|
-
const
|
|
65640
|
-
const
|
|
65641
|
-
|
|
65642
|
-
|
|
65643
|
-
|
|
65644
|
-
|
|
65645
|
-
|
|
65646
|
-
|
|
65647
|
-
|
|
65648
|
-
|
|
65971
|
+
const isTableTarget = !isPercentageRatio && !currentValueField && (normalizedAggregationType === "count" || normalizedAggregationType === "percentage");
|
|
65972
|
+
const labelTarget = isPercentageRatio ? `${currentValueField}:${currentValueField2}` : currentValueField ? currentValueField : isTableTarget ? tableHint || aggregationFallbackTableName : aggregationFallbackTarget;
|
|
65973
|
+
const fieldTable = isTableTarget || !aggregation.aggregationType ? "" : tableHint || String(
|
|
65974
|
+
aggregationOptionTableLookup.get(
|
|
65975
|
+
`${aggregation.aggregationType}:${labelTarget}`
|
|
65976
|
+
) ?? ""
|
|
65977
|
+
).trim();
|
|
65978
|
+
const currentValue = aggregation.aggregationType ? `${aggregation.aggregationType}:${fieldTable ? `${fieldTable}::` : ""}${labelTarget}` : "";
|
|
65979
|
+
if (currentValue && !seenValues.has(currentValue)) {
|
|
65980
|
+
const isBoolPercentage = normalizedAggregationType === "percentage" && Boolean(currentValueField) && isBoolAggregationField(currentValueField, tableHint || void 0) === true;
|
|
65981
|
+
const currentLabel = isPercentageRatio ? `Percent ${toTitleCaseLabel(currentValueField)} of ${toTitleCaseLabel(currentValueField2)}` : normalizedAggregationType === "percentage" ? isBoolPercentage ? `Percent ${toTitleCaseLabel(labelTarget)}` : `Percent of Total ${toTitleCaseLabel(labelTarget)}` : `${formatAggregationTypeForDisplay(aggregation.aggregationType)} ${toTitleCaseLabel(labelTarget)}`;
|
|
65982
|
+
injectedOptions.push({ value: currentValue, label: currentLabel });
|
|
65983
|
+
seenValues.add(currentValue);
|
|
65984
|
+
}
|
|
65985
|
+
return currentValue;
|
|
65649
65986
|
});
|
|
65987
|
+
return {
|
|
65988
|
+
aggregationValues: values,
|
|
65989
|
+
aggregationOptions: [...injectedOptions, ...baseOptions]
|
|
65990
|
+
};
|
|
65650
65991
|
}, [
|
|
65651
65992
|
aggregationFallbackTableName,
|
|
65652
65993
|
aggregationFallbackTarget,
|
|
65653
65994
|
aggregationState,
|
|
65654
65995
|
aggregationBaseOptions,
|
|
65996
|
+
aggregationOptionTableLookup,
|
|
65655
65997
|
aggregationTablesByIndex,
|
|
65656
65998
|
isBoolAggregationField
|
|
65657
65999
|
]);
|
|
65658
|
-
const nextPivot = (0,
|
|
66000
|
+
const nextPivot = (0, import_react61.useMemo)(() => {
|
|
65659
66001
|
if (!sourceReport) return null;
|
|
65660
66002
|
return pivotState ? {
|
|
65661
66003
|
...pivotState,
|
|
@@ -65666,15 +66008,15 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65666
66008
|
rowLimit: limit?.value
|
|
65667
66009
|
} : null;
|
|
65668
66010
|
}, [sourceReport, pivotState, pivotSort, limit, resolvedSortFieldType]);
|
|
65669
|
-
const nextPivotHash = (0,
|
|
66011
|
+
const nextPivotHash = (0, import_react61.useMemo)(
|
|
65670
66012
|
() => stableSerializeForQueryKey(nextPivot),
|
|
65671
66013
|
[nextPivot]
|
|
65672
66014
|
);
|
|
65673
|
-
const filterStackHash = (0,
|
|
66015
|
+
const filterStackHash = (0, import_react61.useMemo)(
|
|
65674
66016
|
() => stableSerializeForQueryKey(filterStack),
|
|
65675
66017
|
[filterStack]
|
|
65676
66018
|
);
|
|
65677
|
-
const shouldSkipPivotRefreshForUnchangedPivot = (0,
|
|
66019
|
+
const shouldSkipPivotRefreshForUnchangedPivot = (0, import_react61.useMemo)(() => {
|
|
65678
66020
|
if (!sourceReport || !nextPivot) return false;
|
|
65679
66021
|
if (!Array.isArray(sourceReport.rows) || sourceReport.rows.length === 0) {
|
|
65680
66022
|
return false;
|
|
@@ -65692,7 +66034,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65692
66034
|
);
|
|
65693
66035
|
return hasSamePivot && sourceFilterStackHash === filterStackHash;
|
|
65694
66036
|
}, [filterStackHash, nextPivot, sourceReport]);
|
|
65695
|
-
(0,
|
|
66037
|
+
(0, import_react61.useEffect)(() => {
|
|
65696
66038
|
if (!pendingPivotRefresh) return;
|
|
65697
66039
|
if (!nextPivot) {
|
|
65698
66040
|
if (!sourceReport) {
|
|
@@ -65712,7 +66054,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65712
66054
|
shouldSkipPivotRefreshForUnchangedPivot,
|
|
65713
66055
|
sourceReport
|
|
65714
66056
|
]);
|
|
65715
|
-
const shouldSkipRedundantPivotTableDataReportBuilderQuery = (0,
|
|
66057
|
+
const shouldSkipRedundantPivotTableDataReportBuilderQuery = (0, import_react61.useMemo)(() => {
|
|
65716
66058
|
if (!sourceReport || !nextPivot) {
|
|
65717
66059
|
return false;
|
|
65718
66060
|
}
|
|
@@ -65759,6 +66101,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65759
66101
|
...sourceReport,
|
|
65760
66102
|
reportBuilderState: effectiveReportBuilderState
|
|
65761
66103
|
};
|
|
66104
|
+
taskDebugLoadRequestIdRef.current += 1;
|
|
65762
66105
|
const pivotRefreshResult = await loadReportForUseForm({
|
|
65763
66106
|
reportId: effectiveReportId,
|
|
65764
66107
|
initialReportBuilderState: effectiveReportBuilderState,
|
|
@@ -65774,6 +66117,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65774
66117
|
customFields: schemaData.customFields,
|
|
65775
66118
|
dashboardName: resolvedSourceDashboardName,
|
|
65776
66119
|
useInMemoryEngines,
|
|
66120
|
+
debugSource: "pivot-refresh",
|
|
66121
|
+
debugRunId: taskDebugRunId,
|
|
66122
|
+
debugLoadRequestId: taskDebugLoadRequestIdRef.current,
|
|
65777
66123
|
draftSessionId: draftSessionId || void 0
|
|
65778
66124
|
});
|
|
65779
66125
|
return pivotRefreshResult;
|
|
@@ -65814,7 +66160,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65814
66160
|
});
|
|
65815
66161
|
const tablePageReportBuilderState = pivotTableDataReportBuilderState ?? effectiveReportBuilderState;
|
|
65816
66162
|
const tablePageReportBuilderStateHash = pivotTableDataReportBuilderState ? pivotTableDataReportBuilderStateHash : effectiveReportBuilderStateHash;
|
|
65817
|
-
const tablePaginationSort = (0,
|
|
66163
|
+
const tablePaginationSort = (0, import_react61.useMemo)(() => {
|
|
65818
66164
|
const sortEntry = tablePageReportBuilderState?.sort?.[0];
|
|
65819
66165
|
const field = String(sortEntry?.field ?? "").trim();
|
|
65820
66166
|
if (!field || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(field)) {
|
|
@@ -65876,7 +66222,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65876
66222
|
const tablePageRows = tablePageQueryEnabled && !tablePageQuery.data?.error && Array.isArray(tablePageQuery.data?.report?.rows) ? tablePageQuery.data.report.rows : void 0;
|
|
65877
66223
|
const tablePageRowCount = tablePageQueryEnabled && typeof tablePageQuery.data?.report?.rowCount === "number" && tablePageQuery.data.report.rowCount > 0 ? tablePageQuery.data.report.rowCount : void 0;
|
|
65878
66224
|
const tablePageFetching = tablePageQueryEnabled && tablePageQuery.isFetching;
|
|
65879
|
-
const paginationTotalRowCount = (0,
|
|
66225
|
+
const paginationTotalRowCount = (0, import_react61.useMemo)(() => {
|
|
65880
66226
|
if (tablePageRowCount !== void 0) {
|
|
65881
66227
|
return Math.max(tablePageRowCount, baseWindowRowsLength);
|
|
65882
66228
|
}
|
|
@@ -65899,7 +66245,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65899
66245
|
pagination.pageSize
|
|
65900
66246
|
);
|
|
65901
66247
|
paginationPageCountRef.current = paginationPageCount;
|
|
65902
|
-
(0,
|
|
66248
|
+
(0, import_react61.useEffect)(() => {
|
|
65903
66249
|
if (!pivotTableDataRefreshQueryEnabled) return;
|
|
65904
66250
|
if (pivotTableDataRefreshQuery.status !== "success" && pivotTableDataRefreshQuery.status !== "error") {
|
|
65905
66251
|
return;
|
|
@@ -65918,6 +66264,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65918
66264
|
return {
|
|
65919
66265
|
...previousReport,
|
|
65920
66266
|
...report,
|
|
66267
|
+
xAxisFormat: previousReport.xAxisFormat,
|
|
66268
|
+
columns: previousReport.columns,
|
|
66269
|
+
yAxisFields: previousReport.yAxisFields,
|
|
65921
66270
|
pivot: previousReport.pivot,
|
|
65922
66271
|
pivotRows: previousReport.pivotRows,
|
|
65923
66272
|
pivotColumns: previousReport.pivotColumns,
|
|
@@ -65937,7 +66286,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65937
66286
|
effectiveReportId,
|
|
65938
66287
|
useFormRefreshDebugEnabled
|
|
65939
66288
|
]);
|
|
65940
|
-
(0,
|
|
66289
|
+
(0, import_react61.useEffect)(() => {
|
|
65941
66290
|
if (!pivotRefreshQueryEnabled) return;
|
|
65942
66291
|
if (pivotRefreshQuery.status !== "success" && pivotRefreshQuery.status !== "error") {
|
|
65943
66292
|
return;
|
|
@@ -65990,7 +66339,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65990
66339
|
effectiveReportId,
|
|
65991
66340
|
useFormRefreshDebugEnabled
|
|
65992
66341
|
]);
|
|
65993
|
-
const chartData = (0,
|
|
66342
|
+
const chartData = (0, import_react61.useMemo)(() => {
|
|
65994
66343
|
if (!sourceReport) return void 0;
|
|
65995
66344
|
const rowsForChart = Array.isArray(sourceReport.rows) ? sourceReport.rows : [];
|
|
65996
66345
|
const chartPivotForDisplay = nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
|
|
@@ -66026,18 +66375,18 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66026
66375
|
useInMemoryEngines,
|
|
66027
66376
|
chartPivotHydrationEpoch
|
|
66028
66377
|
]);
|
|
66029
|
-
const baseChart = (0,
|
|
66378
|
+
const baseChart = (0, import_react61.useMemo)(
|
|
66030
66379
|
() => normalizePivotChartForDisplay(chartData),
|
|
66031
66380
|
[chartData]
|
|
66032
66381
|
);
|
|
66033
|
-
const chartAxesBaseChart = (0,
|
|
66382
|
+
const chartAxesBaseChart = (0, import_react61.useMemo)(() => {
|
|
66034
66383
|
if (!chartData) return void 0;
|
|
66035
66384
|
if (chartData.pivot?.columnField) {
|
|
66036
66385
|
return normalizePivotChartForAxisControls(chartData, effectiveReportId);
|
|
66037
66386
|
}
|
|
66038
66387
|
return baseChart;
|
|
66039
66388
|
}, [baseChart, chartData, effectiveReportId]);
|
|
66040
|
-
const chartAxisOptions = (0,
|
|
66389
|
+
const chartAxisOptions = (0, import_react61.useMemo)(() => {
|
|
66041
66390
|
if (!chartAxesBaseChart) return [];
|
|
66042
66391
|
const optionsByField = /* @__PURE__ */ new Map();
|
|
66043
66392
|
const registerOption = (fieldRaw, labelRaw, formatRaw) => {
|
|
@@ -66054,8 +66403,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66054
66403
|
for (const column of chartAxesBaseChart.columns ?? []) {
|
|
66055
66404
|
registerOption(column.field, column.label, column.format);
|
|
66056
66405
|
}
|
|
66057
|
-
for (const
|
|
66058
|
-
registerOption(
|
|
66406
|
+
for (const yAxis2 of chartAxesBaseChart.yAxisFields ?? []) {
|
|
66407
|
+
registerOption(yAxis2.field, yAxis2.label, yAxis2.format);
|
|
66059
66408
|
}
|
|
66060
66409
|
if (chartAxesBaseChart.pivot?.columnField) {
|
|
66061
66410
|
for (const aggregationAxis of buildPivotAggregationAxisFields(
|
|
@@ -66075,14 +66424,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66075
66424
|
);
|
|
66076
66425
|
return Array.from(optionsByField.values());
|
|
66077
66426
|
}, [chartAxesBaseChart]);
|
|
66078
|
-
const chartAxisOptionByField = (0,
|
|
66427
|
+
const chartAxisOptionByField = (0, import_react61.useMemo)(() => {
|
|
66079
66428
|
const optionsByField = /* @__PURE__ */ new Map();
|
|
66080
66429
|
for (const option of chartAxisOptions) {
|
|
66081
66430
|
optionsByField.set(option.value, option);
|
|
66082
66431
|
}
|
|
66083
66432
|
return optionsByField;
|
|
66084
66433
|
}, [chartAxisOptions]);
|
|
66085
|
-
const xAxisOptions = (0,
|
|
66434
|
+
const xAxisOptions = (0, import_react61.useMemo)(() => {
|
|
66086
66435
|
if (!chartAxesBaseChart) return chartAxisOptions;
|
|
66087
66436
|
const pivot = chartAxesBaseChart.pivot;
|
|
66088
66437
|
const pivotRowField = String(pivot?.rowField ?? "").trim();
|
|
@@ -66105,7 +66454,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66105
66454
|
}
|
|
66106
66455
|
return chartAxisOptions;
|
|
66107
66456
|
}, [chartAxesBaseChart, chartAxisOptions, chartAxisOptionByField]);
|
|
66108
|
-
const yAxisOptions = (0,
|
|
66457
|
+
const yAxisOptions = (0, import_react61.useMemo)(() => {
|
|
66109
66458
|
if (!chartAxesBaseChart) return [];
|
|
66110
66459
|
const keepOption = (option) => {
|
|
66111
66460
|
const col = findSchemaColumnForChartAxisField(
|
|
@@ -66141,21 +66490,21 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66141
66490
|
chartAxisOptions,
|
|
66142
66491
|
schemaColumnOptions
|
|
66143
66492
|
]);
|
|
66144
|
-
const normalizedChartXAxisOptions = (0,
|
|
66493
|
+
const normalizedChartXAxisOptions = (0, import_react61.useMemo)(() => {
|
|
66145
66494
|
return xAxisOptions.map((option) => ({
|
|
66146
66495
|
value: String(option.value ?? "").trim(),
|
|
66147
66496
|
label: String(option.label ?? option.value ?? "").trim(),
|
|
66148
66497
|
format: String(option.format ?? "").trim()
|
|
66149
66498
|
}));
|
|
66150
66499
|
}, [xAxisOptions]);
|
|
66151
|
-
const normalizedChartYAxisOptions = (0,
|
|
66500
|
+
const normalizedChartYAxisOptions = (0, import_react61.useMemo)(() => {
|
|
66152
66501
|
return yAxisOptions.map((option) => ({
|
|
66153
66502
|
value: String(option.value ?? "").trim(),
|
|
66154
66503
|
label: String(option.label ?? option.value ?? "").trim(),
|
|
66155
66504
|
format: String(option.format ?? "").trim()
|
|
66156
66505
|
}));
|
|
66157
66506
|
}, [yAxisOptions]);
|
|
66158
|
-
const resolvedYAxisFields = (0,
|
|
66507
|
+
const resolvedYAxisFields = (0, import_react61.useMemo)(() => {
|
|
66159
66508
|
if (!chartAxesBaseChart) return [];
|
|
66160
66509
|
const normalizeYAxisField = (yAxisFieldRaw) => {
|
|
66161
66510
|
const field = String(yAxisFieldRaw?.field ?? "").trim();
|
|
@@ -66198,7 +66547,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66198
66547
|
chartAxisOptionByField,
|
|
66199
66548
|
chartAxisOptions
|
|
66200
66549
|
]);
|
|
66201
|
-
const resolvedXAxisField = (0,
|
|
66550
|
+
const resolvedXAxisField = (0, import_react61.useMemo)(() => {
|
|
66202
66551
|
if (!chartAxesBaseChart) return "";
|
|
66203
66552
|
const chartType2 = String(chartAxesBaseChart.chartType ?? "").toLowerCase();
|
|
66204
66553
|
const pivotRowField = String(
|
|
@@ -66230,7 +66579,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66230
66579
|
chartAxisOptions,
|
|
66231
66580
|
resolvedYAxisFields
|
|
66232
66581
|
]);
|
|
66233
|
-
const resolvedXAxisFormat = (0,
|
|
66582
|
+
const resolvedXAxisFormat = (0, import_react61.useMemo)(() => {
|
|
66234
66583
|
if (!chartAxesBaseChart) {
|
|
66235
66584
|
return "string";
|
|
66236
66585
|
}
|
|
@@ -66258,7 +66607,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66258
66607
|
resolvedXAxisField,
|
|
66259
66608
|
resolvedYAxisFields
|
|
66260
66609
|
]);
|
|
66261
|
-
const resolvedXAxisLabel = (0,
|
|
66610
|
+
const resolvedXAxisLabel = (0, import_react61.useMemo)(() => {
|
|
66262
66611
|
const defaultXLabel = String(
|
|
66263
66612
|
chartAxesBaseChart?.xAxisLabel ?? chartAxisOptionByField.get(resolvedXAxisField)?.label ?? ""
|
|
66264
66613
|
).trim();
|
|
@@ -66272,62 +66621,49 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66272
66621
|
chartAxisOptionByField,
|
|
66273
66622
|
resolvedXAxisField
|
|
66274
66623
|
]);
|
|
66275
|
-
const chartVisibility = (0,
|
|
66624
|
+
const chartVisibility = (0, import_react61.useMemo)(
|
|
66276
66625
|
() => ({
|
|
66277
66626
|
showLegend: chartVisibilityOverrides.showLegend ?? Boolean(baseChart?.showLegend ?? false)
|
|
66278
66627
|
}),
|
|
66279
66628
|
[baseChart?.showLegend, chartVisibilityOverrides]
|
|
66280
66629
|
);
|
|
66281
|
-
const
|
|
66630
|
+
const xAxis = (0, import_react61.useMemo)(() => {
|
|
66282
66631
|
const pivotBucketXAxis = isPivotTableDateBucketRowAxis(
|
|
66283
66632
|
chartAxesBaseChart,
|
|
66284
66633
|
resolvedXAxisField
|
|
66285
66634
|
);
|
|
66286
66635
|
const xFormatLabel = pivotBucketXAxis && String(resolvedXAxisFormat ?? "").trim() === "string" ? "date" : axisFormatToSelectLabel(resolvedXAxisFormat);
|
|
66287
66636
|
return {
|
|
66288
|
-
|
|
66289
|
-
|
|
66290
|
-
|
|
66291
|
-
format: xFormatLabel,
|
|
66292
|
-
show: true,
|
|
66293
|
-
rotation: 0,
|
|
66294
|
-
fontSize: 12
|
|
66295
|
-
},
|
|
66296
|
-
yAxis: {
|
|
66297
|
-
fields: resolvedYAxisFields.map((yAxisField, index) => ({
|
|
66298
|
-
field: yAxisField.field,
|
|
66299
|
-
label: String(yAxisField.label ?? "").trim(),
|
|
66300
|
-
format: axisFormatToSelectLabel(
|
|
66301
|
-
toAxisFormat(yAxisField.format, "string")
|
|
66302
|
-
),
|
|
66303
|
-
color: USE_FORM_AXIS_SERIES_COLORS[index % USE_FORM_AXIS_SERIES_COLORS.length]
|
|
66304
|
-
})),
|
|
66305
|
-
label: "",
|
|
66306
|
-
show: true,
|
|
66307
|
-
min: "",
|
|
66308
|
-
max: "",
|
|
66309
|
-
fontSize: 12
|
|
66310
|
-
},
|
|
66311
|
-
legend: {
|
|
66312
|
-
show: chartVisibility.showLegend
|
|
66313
|
-
}
|
|
66637
|
+
field: resolvedXAxisField,
|
|
66638
|
+
label: resolvedXAxisLabel,
|
|
66639
|
+
format: xFormatLabel
|
|
66314
66640
|
};
|
|
66315
66641
|
}, [
|
|
66316
66642
|
chartAxesBaseChart,
|
|
66317
66643
|
resolvedXAxisLabel,
|
|
66318
66644
|
resolvedXAxisField,
|
|
66319
|
-
resolvedXAxisFormat
|
|
66320
|
-
resolvedYAxisFields,
|
|
66321
|
-
chartVisibility.showLegend
|
|
66645
|
+
resolvedXAxisFormat
|
|
66322
66646
|
]);
|
|
66323
|
-
const
|
|
66647
|
+
const yAxis = (0, import_react61.useMemo)(
|
|
66648
|
+
() => ({
|
|
66649
|
+
fields: resolvedYAxisFields.map((yAxisField) => ({
|
|
66650
|
+
field: yAxisField.field,
|
|
66651
|
+
label: String(yAxisField.label ?? "").trim(),
|
|
66652
|
+
format: axisFormatToSelectLabel(
|
|
66653
|
+
toAxisFormat(yAxisField.format, "string")
|
|
66654
|
+
)
|
|
66655
|
+
}))
|
|
66656
|
+
}),
|
|
66657
|
+
[resolvedYAxisFields]
|
|
66658
|
+
);
|
|
66659
|
+
const resolvedYAxisFieldsForDisplay = (0, import_react61.useMemo)(() => {
|
|
66324
66660
|
if (!baseChart) return resolvedYAxisFields;
|
|
66325
66661
|
return mapResolvedPivotYAxisFieldsForDisplay({
|
|
66326
66662
|
chart: baseChart,
|
|
66327
66663
|
resolvedYAxisFields
|
|
66328
66664
|
});
|
|
66329
66665
|
}, [baseChart, resolvedYAxisFields]);
|
|
66330
|
-
const chart = (0,
|
|
66666
|
+
const chart = (0, import_react61.useMemo)(() => {
|
|
66331
66667
|
if (!baseChart) return void 0;
|
|
66332
66668
|
let columns2 = mergeChartColumnFormatsFromYAxisFields(
|
|
66333
66669
|
baseChart.columns,
|
|
@@ -66376,10 +66712,128 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66376
66712
|
resolvedXAxisLabel,
|
|
66377
66713
|
resolvedYAxisFieldsForDisplay
|
|
66378
66714
|
]);
|
|
66715
|
+
const filterOptions = (0, import_react61.useMemo)(() => {
|
|
66716
|
+
const out = [];
|
|
66717
|
+
for (const [field, values] of filterValueOptionsByFieldName) {
|
|
66718
|
+
out.push({
|
|
66719
|
+
field,
|
|
66720
|
+
fieldType: "string",
|
|
66721
|
+
operator: "in",
|
|
66722
|
+
options: values.map(({ label, value }) => ({ label, value }))
|
|
66723
|
+
});
|
|
66724
|
+
}
|
|
66725
|
+
const pivot = chart?.pivot;
|
|
66726
|
+
const rowField = String(pivot?.rowField ?? "").trim();
|
|
66727
|
+
if (rowField && isDateType(String(pivot?.rowFieldType ?? ""))) {
|
|
66728
|
+
const field = pivot?.rowFieldTable ? `${pivot.rowFieldTable}.${rowField}` : rowField;
|
|
66729
|
+
const bucket = dateBucket || pivot?.dateBucket || "month";
|
|
66730
|
+
const byRaw = /* @__PURE__ */ new Map();
|
|
66731
|
+
for (const row of chart?.rows ?? []) {
|
|
66732
|
+
const record = row;
|
|
66733
|
+
const raw = record.__quillRawDate;
|
|
66734
|
+
if (raw == null || raw === "") continue;
|
|
66735
|
+
const key = String(raw);
|
|
66736
|
+
if (!byRaw.has(key)) {
|
|
66737
|
+
byRaw.set(key, String(record[rowField] ?? key));
|
|
66738
|
+
}
|
|
66739
|
+
}
|
|
66740
|
+
out.push({
|
|
66741
|
+
field,
|
|
66742
|
+
fieldType: "date",
|
|
66743
|
+
operator: "inBucket",
|
|
66744
|
+
dateBucket: bucket,
|
|
66745
|
+
options: [...byRaw.keys()].sort().map((value) => ({
|
|
66746
|
+
value,
|
|
66747
|
+
label: byRaw.get(value) ?? value
|
|
66748
|
+
}))
|
|
66749
|
+
});
|
|
66750
|
+
}
|
|
66751
|
+
return out;
|
|
66752
|
+
}, [
|
|
66753
|
+
chart?.pivot,
|
|
66754
|
+
chart?.rows,
|
|
66755
|
+
dateBucket,
|
|
66756
|
+
filterValueOptionsByFieldName
|
|
66757
|
+
]);
|
|
66758
|
+
const chartForUi = (0, import_react61.useMemo)(() => {
|
|
66759
|
+
if (!chart?.pivot) return chart;
|
|
66760
|
+
const pivot = chart.pivot;
|
|
66761
|
+
const qualify = (field, table2) => table2 ? `${table2}.${field}` : field;
|
|
66762
|
+
const labelFor = (field) => chart.columns?.find((column) => column.field === field)?.label ?? field.split(".").pop().replace(/[_-]+/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
|
|
66763
|
+
const matchField = (entryField, field, table2) => {
|
|
66764
|
+
const qualified = qualify(field, table2);
|
|
66765
|
+
return entryField === qualified || entryField === field || entryField.endsWith(`.${field}`);
|
|
66766
|
+
};
|
|
66767
|
+
const selectedValue = (field, operator, options2) => {
|
|
66768
|
+
const rule = filtersForQueryBuilder.rules.find(
|
|
66769
|
+
(entry) => typeof entry === "object" && entry !== null && "field" in entry && entry.field === field && entry.operator === operator
|
|
66770
|
+
);
|
|
66771
|
+
if (!rule) return null;
|
|
66772
|
+
const raw = operator === "inBucket" ? rule.value?.start : Array.isArray(rule.value) ? rule.value[0] : void 0;
|
|
66773
|
+
if (raw == null) return null;
|
|
66774
|
+
const value = String(raw);
|
|
66775
|
+
return options2.some((option) => option.value === value) ? value : null;
|
|
66776
|
+
};
|
|
66777
|
+
let rowFilter = null;
|
|
66778
|
+
const rowField = String(pivot.rowField ?? "").trim();
|
|
66779
|
+
if (rowField) {
|
|
66780
|
+
if (isDateType(String(pivot.rowFieldType ?? ""))) {
|
|
66781
|
+
const entry = filterOptions.find(
|
|
66782
|
+
(option) => option.operator === "inBucket" && matchField(option.field, rowField, pivot.rowFieldTable)
|
|
66783
|
+
);
|
|
66784
|
+
if (entry) {
|
|
66785
|
+
const field = qualify(rowField, pivot.rowFieldTable);
|
|
66786
|
+
rowFilter = {
|
|
66787
|
+
...entry,
|
|
66788
|
+
field,
|
|
66789
|
+
label: labelFor(rowField),
|
|
66790
|
+
value: selectedValue(field, entry.operator, entry.options)
|
|
66791
|
+
};
|
|
66792
|
+
}
|
|
66793
|
+
} else {
|
|
66794
|
+
const entry = filterOptions.find(
|
|
66795
|
+
(option) => option.operator === "in" && matchField(option.field, rowField, pivot.rowFieldTable)
|
|
66796
|
+
);
|
|
66797
|
+
if (entry) {
|
|
66798
|
+
const field = qualify(rowField, pivot.rowFieldTable);
|
|
66799
|
+
rowFilter = {
|
|
66800
|
+
...entry,
|
|
66801
|
+
field,
|
|
66802
|
+
label: labelFor(rowField),
|
|
66803
|
+
value: selectedValue(field, entry.operator, entry.options)
|
|
66804
|
+
};
|
|
66805
|
+
}
|
|
66806
|
+
}
|
|
66807
|
+
}
|
|
66808
|
+
let columnFilter = null;
|
|
66809
|
+
const columnField = String(pivot.columnField ?? "").trim();
|
|
66810
|
+
if (columnField) {
|
|
66811
|
+
const entry = filterOptions.find(
|
|
66812
|
+
(option) => option.operator === "in" && matchField(option.field, columnField, pivot.columnFieldTable)
|
|
66813
|
+
);
|
|
66814
|
+
if (entry) {
|
|
66815
|
+
const field = qualify(columnField, pivot.columnFieldTable);
|
|
66816
|
+
columnFilter = {
|
|
66817
|
+
...entry,
|
|
66818
|
+
field,
|
|
66819
|
+
label: labelFor(columnField),
|
|
66820
|
+
value: selectedValue(field, entry.operator, entry.options)
|
|
66821
|
+
};
|
|
66822
|
+
}
|
|
66823
|
+
}
|
|
66824
|
+
return {
|
|
66825
|
+
...chart,
|
|
66826
|
+
pivot: {
|
|
66827
|
+
...pivot,
|
|
66828
|
+
rowFilter,
|
|
66829
|
+
columnFilter
|
|
66830
|
+
}
|
|
66831
|
+
};
|
|
66832
|
+
}, [chart, filterOptions, filtersForQueryBuilder]);
|
|
66379
66833
|
const isPivotTableChart = String(chartType ?? "").toLowerCase() === "table" && Boolean(
|
|
66380
66834
|
chart && chart.pivot && Array.isArray(chart.columns) && chart.columns.length > 0
|
|
66381
66835
|
);
|
|
66382
|
-
const chartAxes = (0,
|
|
66836
|
+
const chartAxes = (0, import_react61.useMemo)(() => {
|
|
66383
66837
|
const yAxisItems = resolvedYAxisFields.map(
|
|
66384
66838
|
(yAxisField, index) => ({
|
|
66385
66839
|
id: String(index),
|
|
@@ -66528,8 +66982,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66528
66982
|
xAxisOptions,
|
|
66529
66983
|
yAxisOptions
|
|
66530
66984
|
]);
|
|
66531
|
-
const tableFormatCacheRef = (0,
|
|
66532
|
-
const tableFormatMerge = (0,
|
|
66985
|
+
const tableFormatCacheRef = (0, import_react61.useRef)(/* @__PURE__ */ new Map());
|
|
66986
|
+
const tableFormatMerge = (0, import_react61.useMemo)(
|
|
66533
66987
|
() => mergeDisplayAndSourceForTableFormats({
|
|
66534
66988
|
effectiveReportBuilderTableNames,
|
|
66535
66989
|
scopedSchemaColumns,
|
|
@@ -66543,7 +66997,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66543
66997
|
sourceReport
|
|
66544
66998
|
]
|
|
66545
66999
|
);
|
|
66546
|
-
const table = (0,
|
|
67000
|
+
const table = (0, import_react61.useMemo)(() => {
|
|
66547
67001
|
const baseWindowRows = Array.isArray(sourceReport?.rows) ? sourceReport.rows : [];
|
|
66548
67002
|
const rawRows = !paginationActive ? baseWindowRows : tablePageRows ?? baseWindowRows.slice(paginationRangeStart, paginationRangeEnd);
|
|
66549
67003
|
const { columns: mergedFromReport } = mergeDisplayAndSourceForTableFormats({
|
|
@@ -66672,7 +67126,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66672
67126
|
const {
|
|
66673
67127
|
columnsOptions: tableFormattingColumnOptions,
|
|
66674
67128
|
hasTableDrivenColumnOrder
|
|
66675
|
-
} = (0,
|
|
67129
|
+
} = (0, import_react61.useMemo)(() => {
|
|
66676
67130
|
if (isPivotTableChart && chart?.columns?.length) {
|
|
66677
67131
|
const aggregationSlotColumns = buildPivotColumnPivotTableFormattingColumns(chart);
|
|
66678
67132
|
const pivotTableColumns = aggregationSlotColumns ? aggregationSlotColumns.tableColumns : chart.columns.map((c) => ({
|
|
@@ -66706,32 +67160,24 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66706
67160
|
schemaColumnOptions,
|
|
66707
67161
|
table.columns
|
|
66708
67162
|
]);
|
|
66709
|
-
const
|
|
66710
|
-
() => tableColumnPickerPoolOptions.map((option) => ({
|
|
66711
|
-
id: option.value,
|
|
66712
|
-
label: option.label,
|
|
66713
|
-
type: option.type
|
|
66714
|
-
})),
|
|
66715
|
-
[tableColumnPickerPoolOptions]
|
|
66716
|
-
);
|
|
66717
|
-
const axisSelectFormatLabels = (0, import_react62.useMemo)(
|
|
67163
|
+
const axisSelectFormatLabels = (0, import_react61.useMemo)(
|
|
66718
67164
|
() => AXIS_FORMAT_OPTIONS.map((option) => option.label),
|
|
66719
67165
|
[]
|
|
66720
67166
|
);
|
|
66721
|
-
const xAxisFormatOptionLabels = (0,
|
|
67167
|
+
const xAxisFormatOptionLabels = (0, import_react61.useMemo)(() => {
|
|
66722
67168
|
if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField)) {
|
|
66723
67169
|
return ["date", ...axisSelectFormatLabels];
|
|
66724
67170
|
}
|
|
66725
67171
|
return axisSelectFormatLabels;
|
|
66726
67172
|
}, [chartAxesBaseChart, resolvedXAxisField, axisSelectFormatLabels]);
|
|
66727
|
-
const tableDerivedColumnOrder = (0,
|
|
67173
|
+
const tableDerivedColumnOrder = (0, import_react61.useMemo)(() => {
|
|
66728
67174
|
return tableFormattingColumnOptions.map((option) => option.value);
|
|
66729
67175
|
}, [tableFormattingColumnOptions]);
|
|
66730
|
-
const tableDerivedColumnOrderSignature = (0,
|
|
67176
|
+
const tableDerivedColumnOrderSignature = (0, import_react61.useMemo)(
|
|
66731
67177
|
() => tableDerivedColumnOrder.join("|"),
|
|
66732
67178
|
[tableDerivedColumnOrder]
|
|
66733
67179
|
);
|
|
66734
|
-
const activeTableColumnIds = (0,
|
|
67180
|
+
const activeTableColumnIds = (0, import_react61.useMemo)(() => {
|
|
66735
67181
|
if (isPivotTableChart && chart?.columns?.length) {
|
|
66736
67182
|
const aggregationSlotColumns = buildPivotColumnPivotTableFormattingColumns(chart);
|
|
66737
67183
|
if (aggregationSlotColumns) {
|
|
@@ -66770,7 +67216,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66770
67216
|
tableDerivedColumnOrder,
|
|
66771
67217
|
tableFormattingColumnOptions
|
|
66772
67218
|
]);
|
|
66773
|
-
const columnOptionById = (0,
|
|
67219
|
+
const columnOptionById = (0, import_react61.useMemo)(() => {
|
|
66774
67220
|
const map = /* @__PURE__ */ new Map();
|
|
66775
67221
|
for (const option of tableColumnPickerPoolOptions) {
|
|
66776
67222
|
map.set(option.value, option);
|
|
@@ -66782,7 +67228,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66782
67228
|
}
|
|
66783
67229
|
return map;
|
|
66784
67230
|
}, [tableColumnPickerPoolOptions, tableFormattingColumnOptions]);
|
|
66785
|
-
const displayColumnById = (0,
|
|
67231
|
+
const displayColumnById = (0, import_react61.useMemo)(() => {
|
|
66786
67232
|
const map = /* @__PURE__ */ new Map();
|
|
66787
67233
|
for (const column of displayColumns) {
|
|
66788
67234
|
const field = String(column.field ?? "").trim();
|
|
@@ -66793,7 +67239,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66793
67239
|
}
|
|
66794
67240
|
return map;
|
|
66795
67241
|
}, [displayColumns]);
|
|
66796
|
-
const tableColumnSettingsById = (0,
|
|
67242
|
+
const tableColumnSettingsById = (0, import_react61.useMemo)(() => {
|
|
66797
67243
|
const map = /* @__PURE__ */ new Map();
|
|
66798
67244
|
const effectiveById = tableFormatMerge.formatByColumnOptionId;
|
|
66799
67245
|
const chartColById = /* @__PURE__ */ new Map();
|
|
@@ -66911,13 +67357,13 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66911
67357
|
sourceReport?.columns,
|
|
66912
67358
|
tableFormatMerge
|
|
66913
67359
|
]);
|
|
66914
|
-
const tableColumnSettingsCoalesceRef = (0,
|
|
67360
|
+
const tableColumnSettingsCoalesceRef = (0, import_react61.useRef)(
|
|
66915
67361
|
/* @__PURE__ */ new Map()
|
|
66916
67362
|
);
|
|
66917
|
-
(0,
|
|
67363
|
+
(0, import_react61.useLayoutEffect)(() => {
|
|
66918
67364
|
tableColumnSettingsCoalesceRef.current = new Map(tableColumnSettingsById);
|
|
66919
67365
|
}, [tableColumnSettingsById]);
|
|
66920
|
-
const tableColumnItems = (0,
|
|
67366
|
+
const tableColumnItems = (0, import_react61.useMemo)(() => {
|
|
66921
67367
|
const pivotRowFieldForFormat = String(chart?.pivot?.rowField ?? "").trim();
|
|
66922
67368
|
const pivotRowFieldType = String(chart?.pivot?.rowFieldType ?? "").trim();
|
|
66923
67369
|
const items = activeTableColumnIds.map((columnId) => {
|
|
@@ -66953,19 +67399,18 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66953
67399
|
isPivotTableChart,
|
|
66954
67400
|
tableColumnSettingsById
|
|
66955
67401
|
]);
|
|
66956
|
-
const tableColumnById = (0,
|
|
67402
|
+
const tableColumnById = (0, import_react61.useMemo)(() => {
|
|
66957
67403
|
return new Map(tableColumnItems.map((item) => [item.id, item]));
|
|
66958
67404
|
}, [tableColumnItems]);
|
|
66959
|
-
const
|
|
67405
|
+
const tableColumnValues = (0, import_react61.useMemo)(() => {
|
|
66960
67406
|
const pivotRowFieldForFormat = String(chart?.pivot?.rowField ?? "").trim();
|
|
66961
67407
|
const pivotRowFieldType = String(chart?.pivot?.rowFieldType ?? "").trim();
|
|
66962
67408
|
return tableColumnItems.map((item) => {
|
|
66963
67409
|
const coerced = coerceTableColumnFormatToAxisValue(item.format);
|
|
66964
67410
|
const usePivotDateOptions = isPivotTableChart && item.field === pivotRowFieldForFormat && isDateType(pivotRowFieldType) && coerced === "string";
|
|
66965
67411
|
return {
|
|
66966
|
-
|
|
67412
|
+
value: item.id,
|
|
66967
67413
|
label: item.label,
|
|
66968
|
-
visible: true,
|
|
66969
67414
|
format: item.formatLabel,
|
|
66970
67415
|
...usePivotDateOptions ? { formatOptions: [...PIVOT_DATE_BUCKET_FORMAT_OPTIONS] } : {}
|
|
66971
67416
|
};
|
|
@@ -67128,30 +67573,44 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67128
67573
|
columns: buildSetReportColumnsFromIds(nextColumnIds, nextSettingsById)
|
|
67129
67574
|
};
|
|
67130
67575
|
};
|
|
67131
|
-
let
|
|
67576
|
+
let applyReportChange;
|
|
67577
|
+
const setReport = (nextState) => {
|
|
67578
|
+
const { columns: nextColumns, ...rest } = nextState;
|
|
67579
|
+
const nextSettingsById = nextColumns === void 0 ? tableColumnSettingsById : new Map(
|
|
67580
|
+
nextColumns.map((column) => [
|
|
67581
|
+
column.value,
|
|
67582
|
+
{ label: column.label, format: column.format }
|
|
67583
|
+
])
|
|
67584
|
+
);
|
|
67585
|
+
applyReportChange({
|
|
67586
|
+
...rest,
|
|
67587
|
+
...nextColumns !== void 0 ? {
|
|
67588
|
+
columns: buildSetReportColumnsFromIds(
|
|
67589
|
+
nextColumns.map((column) => column.value),
|
|
67590
|
+
nextSettingsById
|
|
67591
|
+
)
|
|
67592
|
+
} : {}
|
|
67593
|
+
});
|
|
67594
|
+
};
|
|
67132
67595
|
const commitTableColumns = (nextColumnIds, settingsById) => {
|
|
67133
|
-
|
|
67596
|
+
applyReportChange({
|
|
67134
67597
|
columns: buildSetReportColumnsFromIds(nextColumnIds, settingsById)
|
|
67135
67598
|
});
|
|
67136
67599
|
};
|
|
67137
|
-
|
|
67138
|
-
|
|
67139
|
-
if (isSetReportTableColumnSidebarPatch(nextState.columns)) {
|
|
67140
|
-
const expanded = buildColumnSidebarSetReportInput(
|
|
67141
|
-
nextState.columns.patch
|
|
67142
|
-
);
|
|
67143
|
-
if (!expanded) return;
|
|
67144
|
-
const { columns: _omitSidebarColumnPatch, ...rest } = nextState;
|
|
67145
|
-
effectiveNextState = { ...rest, ...expanded };
|
|
67146
|
-
}
|
|
67600
|
+
applyReportChange = (nextState) => {
|
|
67601
|
+
const effectiveNextState = nextState;
|
|
67147
67602
|
if (effectiveNextState.showLegend !== void 0) {
|
|
67148
67603
|
setChartVisibilityOverrides((previous) => ({
|
|
67149
67604
|
...previous,
|
|
67150
67605
|
showLegend: Boolean(effectiveNextState.showLegend)
|
|
67151
67606
|
}));
|
|
67152
67607
|
}
|
|
67153
|
-
if (effectiveNextState.chartAxes !== void 0) {
|
|
67154
|
-
const cx =
|
|
67608
|
+
if (effectiveNextState.xAxis !== void 0 || effectiveNextState.yAxis !== void 0 || effectiveNextState.chartAxes !== void 0) {
|
|
67609
|
+
const cx = {
|
|
67610
|
+
...effectiveNextState.chartAxes,
|
|
67611
|
+
...effectiveNextState.xAxis !== void 0 ? { xAxis: effectiveNextState.xAxis } : {},
|
|
67612
|
+
...effectiveNextState.yAxis !== void 0 ? { yAxis: effectiveNextState.yAxis } : {}
|
|
67613
|
+
};
|
|
67155
67614
|
setChartAxisEdits((previousEdits) => {
|
|
67156
67615
|
const nextEdits = { ...previousEdits };
|
|
67157
67616
|
if (cx.xAxis) {
|
|
@@ -67216,15 +67675,18 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67216
67675
|
});
|
|
67217
67676
|
}
|
|
67218
67677
|
const isPivotSortUpdate = effectiveNextState.sort !== void 0 && Boolean(nextPivot);
|
|
67219
|
-
const
|
|
67220
|
-
|
|
67221
|
-
|
|
67678
|
+
const isAppendingEmptyAggregationPlaceholder = Array.isArray(effectiveNextState.aggregations) && effectiveNextState.aggregations.length === aggregationValues.length + 1 && effectiveNextState.aggregations.slice(0, aggregationValues.length).every(
|
|
67679
|
+
(value, index) => String(value ?? "") === aggregationValues[index]
|
|
67680
|
+
) && String(
|
|
67681
|
+
effectiveNextState.aggregations[aggregationValues.length] ?? ""
|
|
67682
|
+
).trim().length === 0;
|
|
67683
|
+
const touchesPivotState = effectiveNextState.groupRowsBy !== void 0 || effectiveNextState.groupColumnsBy !== void 0 || effectiveNextState.dateBucket !== void 0 || effectiveNextState.aggregations !== void 0 && !isAppendingEmptyAggregationPlaceholder || isPivotSortUpdate || effectiveNextState.limit !== void 0;
|
|
67222
67684
|
const isDatasourceUpdate = effectiveNextState.datasources !== void 0;
|
|
67223
67685
|
const hasRowGroupSelection = typeof effectiveNextState.groupRowsBy === "string" && effectiveNextState.groupRowsBy.trim().length > 0;
|
|
67224
67686
|
const hasColumnGroupSelection = typeof effectiveNextState.groupColumnsBy === "string" && effectiveNextState.groupColumnsBy.trim().length > 0;
|
|
67225
|
-
const hasAggregationSelection = effectiveNextState.aggregations !== void 0 && (typeof effectiveNextState.aggregations === "string" ? effectiveNextState.aggregations.trim().length > 0 :
|
|
67226
|
-
(aggregation) => Boolean(aggregation?.aggregationType) && Boolean(String(aggregation?.valueField ?? "").trim())
|
|
67227
|
-
)
|
|
67687
|
+
const hasAggregationSelection = effectiveNextState.aggregations !== void 0 && (typeof effectiveNextState.aggregations === "string" ? effectiveNextState.aggregations.trim().length > 0 : effectiveNextState.aggregations.some(
|
|
67688
|
+
(aggregation) => typeof aggregation === "string" ? aggregation.trim().length > 0 : Boolean(aggregation?.aggregationType) && Boolean(String(aggregation?.valueField ?? "").trim())
|
|
67689
|
+
));
|
|
67228
67690
|
const isClearingRowGrouping = effectiveNextState.groupRowsBy !== void 0 && String(effectiveNextState.groupRowsBy ?? "").trim().length === 0;
|
|
67229
67691
|
const queuePromoteColumnToRow = isClearingRowGrouping && !sourceReport;
|
|
67230
67692
|
const shouldRefreshExpandedTableData = useInMemoryEngines && (hasRowGroupSelection || hasColumnGroupSelection || hasAggregationSelection) || !useInMemoryEngines && !nextPivot && effectiveNextState.sort !== void 0;
|
|
@@ -67297,7 +67759,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67297
67759
|
}
|
|
67298
67760
|
}
|
|
67299
67761
|
}
|
|
67300
|
-
if (effectiveNextState.columns !== void 0
|
|
67762
|
+
if (effectiveNextState.columns !== void 0) {
|
|
67301
67763
|
const normalizedDisplayColumns = normalizeColumnsInput(
|
|
67302
67764
|
effectiveNextState.columns,
|
|
67303
67765
|
columnIdentifierLookup
|
|
@@ -67384,6 +67846,10 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67384
67846
|
groupColumnsBySetViaSetReportRef.current = true;
|
|
67385
67847
|
next.groupColumnsBy = effectiveNextState.groupColumnsBy || void 0;
|
|
67386
67848
|
}
|
|
67849
|
+
if (effectiveNextState.dateBucket !== void 0) {
|
|
67850
|
+
dateBucketSetViaSetReportRef.current = true;
|
|
67851
|
+
next.dateBucket = effectiveNextState.dateBucket || void 0;
|
|
67852
|
+
}
|
|
67387
67853
|
if (effectiveNextState.aggregations !== void 0) {
|
|
67388
67854
|
aggregationStateSetViaSetReportRef.current = true;
|
|
67389
67855
|
next.aggregationTablesByIndex = [...next.aggregationTablesByIndex];
|
|
@@ -67398,54 +67864,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67398
67864
|
],
|
|
67399
67865
|
schemaForeignKeyMap
|
|
67400
67866
|
).map((table2) => table2.name).filter((name2) => Boolean(name2));
|
|
67401
|
-
if (typeof effectiveNextState.aggregations === "
|
|
67402
|
-
const { index, value } = effectiveNextState.aggregations;
|
|
67403
|
-
if (index >= 0 && index <= next.aggregationState.length) {
|
|
67404
|
-
const rawValue = String(value ?? "").trim();
|
|
67405
|
-
next.aggregationState = [...next.aggregationState];
|
|
67406
|
-
if (!rawValue) {
|
|
67407
|
-
if (index === next.aggregationState.length) {
|
|
67408
|
-
next.aggregationState.push({ valueField: "" });
|
|
67409
|
-
next.aggregationTablesByIndex.push(void 0);
|
|
67410
|
-
} else if (index < next.aggregationState.length) {
|
|
67411
|
-
next.aggregationState.splice(index, 1);
|
|
67412
|
-
next.aggregationTablesByIndex.splice(index, 1);
|
|
67413
|
-
}
|
|
67414
|
-
} else {
|
|
67415
|
-
const [aggregationTypeRaw] = rawValue.split(":");
|
|
67416
|
-
const aggregationType = aggregationTypeRaw;
|
|
67417
|
-
const { field: target, table: table2 } = resolveAggregationSelection(
|
|
67418
|
-
rawValue,
|
|
67419
|
-
aggregationOptionTableLookup,
|
|
67420
|
-
preferredTables
|
|
67421
|
-
);
|
|
67422
|
-
const normalizedSelection = normalizeAggregationSelection(
|
|
67423
|
-
aggregationType,
|
|
67424
|
-
target,
|
|
67425
|
-
table2,
|
|
67426
|
-
preferredTables
|
|
67427
|
-
);
|
|
67428
|
-
const existing = next.aggregationState[index];
|
|
67429
|
-
const preservedValueField2 = aggregationType !== "percentage" && existing?.valueField2 ? { valueField2: existing.valueField2 } : {};
|
|
67430
|
-
const nextAggregation = {
|
|
67431
|
-
...preservedValueField2,
|
|
67432
|
-
aggregationType,
|
|
67433
|
-
...normalizedSelection.valueField ? { valueField: normalizedSelection.valueField } : {},
|
|
67434
|
-
...normalizedSelection.valueField2 ? { valueField2: normalizedSelection.valueField2 } : {},
|
|
67435
|
-
...normalizedSelection.table ? { valueFieldTable: normalizedSelection.table } : {}
|
|
67436
|
-
};
|
|
67437
|
-
if (index === next.aggregationState.length) {
|
|
67438
|
-
next.aggregationState.push(nextAggregation);
|
|
67439
|
-
next.aggregationTablesByIndex.push(
|
|
67440
|
-
normalizedSelection.table || void 0
|
|
67441
|
-
);
|
|
67442
|
-
} else {
|
|
67443
|
-
next.aggregationState[index] = nextAggregation;
|
|
67444
|
-
next.aggregationTablesByIndex[index] = normalizedSelection.table || void 0;
|
|
67445
|
-
}
|
|
67446
|
-
}
|
|
67447
|
-
}
|
|
67448
|
-
} else if (typeof effectiveNextState.aggregations === "string") {
|
|
67867
|
+
if (typeof effectiveNextState.aggregations === "string") {
|
|
67449
67868
|
const rawValue = effectiveNextState.aggregations.trim();
|
|
67450
67869
|
if (!rawValue) {
|
|
67451
67870
|
next.aggregationState = [];
|
|
@@ -67477,15 +67896,49 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67477
67896
|
];
|
|
67478
67897
|
}
|
|
67479
67898
|
} else {
|
|
67480
|
-
|
|
67481
|
-
|
|
67482
|
-
|
|
67483
|
-
|
|
67484
|
-
|
|
67485
|
-
|
|
67486
|
-
|
|
67487
|
-
|
|
67899
|
+
const decoded = effectiveNextState.aggregations.map(
|
|
67900
|
+
(aggregation) => {
|
|
67901
|
+
if (typeof aggregation !== "string") {
|
|
67902
|
+
return {
|
|
67903
|
+
aggregation,
|
|
67904
|
+
table: String(aggregation.valueFieldTable ?? "").trim() || resolveFieldTable({
|
|
67905
|
+
report: sourceReport,
|
|
67906
|
+
field: aggregation.valueField,
|
|
67907
|
+
schemaTables: schemaForReportBuilderState,
|
|
67908
|
+
preferredTables
|
|
67909
|
+
}) || void 0
|
|
67910
|
+
};
|
|
67911
|
+
}
|
|
67912
|
+
const rawValue = aggregation.trim();
|
|
67913
|
+
if (!rawValue) {
|
|
67914
|
+
return { aggregation: { valueField: "" }, table: void 0 };
|
|
67915
|
+
}
|
|
67916
|
+
const [aggregationTypeRaw] = rawValue.split(":");
|
|
67917
|
+
const aggregationType = aggregationTypeRaw;
|
|
67918
|
+
const { field: target, table: table2 } = resolveAggregationSelection(
|
|
67919
|
+
rawValue,
|
|
67920
|
+
aggregationOptionTableLookup,
|
|
67921
|
+
preferredTables
|
|
67922
|
+
);
|
|
67923
|
+
const normalizedSelection = normalizeAggregationSelection(
|
|
67924
|
+
aggregationType,
|
|
67925
|
+
target,
|
|
67926
|
+
table2,
|
|
67927
|
+
preferredTables
|
|
67928
|
+
);
|
|
67929
|
+
return {
|
|
67930
|
+
aggregation: {
|
|
67931
|
+
aggregationType,
|
|
67932
|
+
...normalizedSelection.valueField ? { valueField: normalizedSelection.valueField } : {},
|
|
67933
|
+
...normalizedSelection.valueField2 ? { valueField2: normalizedSelection.valueField2 } : {},
|
|
67934
|
+
...normalizedSelection.table ? { valueFieldTable: normalizedSelection.table } : {}
|
|
67935
|
+
},
|
|
67936
|
+
table: normalizedSelection.table || void 0
|
|
67937
|
+
};
|
|
67938
|
+
}
|
|
67488
67939
|
);
|
|
67940
|
+
next.aggregationState = decoded.map((entry) => entry.aggregation);
|
|
67941
|
+
next.aggregationTablesByIndex = decoded.map((entry) => entry.table);
|
|
67489
67942
|
}
|
|
67490
67943
|
}
|
|
67491
67944
|
if (effectiveNextState.sort !== void 0) {
|
|
@@ -67600,29 +68053,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67600
68053
|
}
|
|
67601
68054
|
});
|
|
67602
68055
|
};
|
|
67603
|
-
const
|
|
67604
|
-
|
|
67605
|
-
|
|
67606
|
-
byId: tableColumnById,
|
|
67607
|
-
columnList: tableColumnList,
|
|
67608
|
-
getSetReportColumns: (ids) => {
|
|
67609
|
-
const out = [];
|
|
67610
|
-
for (const rawId of ids) {
|
|
67611
|
-
const id = String(rawId ?? "").trim();
|
|
67612
|
-
if (!id) continue;
|
|
67613
|
-
const option = columnOptionById.get(id);
|
|
67614
|
-
if (!option) continue;
|
|
67615
|
-
const item = tableColumnById.get(id);
|
|
67616
|
-
const customLabel = String(item?.customLabel ?? "").trim();
|
|
67617
|
-
const format9 = String(item?.format ?? "").trim();
|
|
67618
|
-
out.push({
|
|
67619
|
-
field: option.field,
|
|
67620
|
-
...option.tableName ? { table: option.tableName } : {},
|
|
67621
|
-
...customLabel ? { label: customLabel } : {},
|
|
67622
|
-
...format9 ? { format: format9 } : {}
|
|
67623
|
-
});
|
|
67624
|
-
}
|
|
67625
|
-
return out;
|
|
68056
|
+
const columnActions = {
|
|
68057
|
+
replace: (nextColumns) => {
|
|
68058
|
+
applyReportChange({ columns: nextColumns });
|
|
67626
68059
|
},
|
|
67627
68060
|
reorder: (oldIndex, newIndex) => {
|
|
67628
68061
|
if (loading || isPivotTableChart) return;
|
|
@@ -67686,25 +68119,20 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67686
68119
|
setTableColumnsEditedSignature(tableDerivedColumnOrderSignature);
|
|
67687
68120
|
commitTableColumns(nextColumnIds, tableColumnSettingsById);
|
|
67688
68121
|
},
|
|
67689
|
-
getColumnSidebarSetReportInput: (id, updates) => {
|
|
67690
|
-
const normalizedId = String(id ?? "").trim();
|
|
67691
|
-
if (!normalizedId) return null;
|
|
67692
|
-
return {
|
|
67693
|
-
columns: { patch: { id: normalizedId, ...updates } }
|
|
67694
|
-
};
|
|
67695
|
-
},
|
|
67696
68122
|
update: (id, updates) => {
|
|
67697
68123
|
const normalizedId = String(id ?? "").trim();
|
|
67698
68124
|
if (!normalizedId) return;
|
|
67699
|
-
|
|
67700
|
-
|
|
68125
|
+
const expanded = buildColumnSidebarSetReportInput({
|
|
68126
|
+
id: normalizedId,
|
|
68127
|
+
...updates
|
|
67701
68128
|
});
|
|
67702
|
-
|
|
67703
|
-
|
|
68129
|
+
if (expanded) applyReportChange(expanded);
|
|
68130
|
+
}
|
|
67704
68131
|
};
|
|
67705
68132
|
const setFilters = (nextFilters) => {
|
|
68133
|
+
const resolved = typeof nextFilters === "function" ? nextFilters(filtersForQueryBuilder) : nextFilters;
|
|
67706
68134
|
const preparedForStack = prepareQueryBuilderFiltersForSet(
|
|
67707
|
-
|
|
68135
|
+
resolved,
|
|
67708
68136
|
queryFilters
|
|
67709
68137
|
);
|
|
67710
68138
|
const nextFiltersNormalizedForConfig = normalizeQueryBuilderFiltersForConfig(preparedForStack);
|
|
@@ -67745,26 +68173,19 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67745
68173
|
});
|
|
67746
68174
|
}
|
|
67747
68175
|
} catch (error) {
|
|
67748
|
-
|
|
67749
|
-
|
|
67750
|
-
|
|
67751
|
-
|
|
67752
|
-
|
|
67753
|
-
|
|
67754
|
-
|
|
67755
|
-
|
|
67756
|
-
|
|
67757
|
-
|
|
67758
|
-
}
|
|
68176
|
+
console.error("[useForm] setFilters swallowed error", {
|
|
68177
|
+
error: error instanceof Error ? error.message : String(error),
|
|
68178
|
+
requestedRules: (resolved?.rules ?? []).map((rule) => ({
|
|
68179
|
+
table: rule?.table,
|
|
68180
|
+
field: rule?.field,
|
|
68181
|
+
operator: rule?.operator,
|
|
68182
|
+
value: rule?.value
|
|
68183
|
+
})),
|
|
68184
|
+
fieldConfigKeys: Object.keys(queryBuilderFieldConfigByName ?? {})
|
|
68185
|
+
});
|
|
67759
68186
|
}
|
|
67760
68187
|
};
|
|
67761
|
-
const
|
|
67762
|
-
reportId: effectiveReportId,
|
|
67763
|
-
committedFilters: filtersForQueryBuilder,
|
|
67764
|
-
queryBuilderProps: filterQueryBuilderProps,
|
|
67765
|
-
setFilters
|
|
67766
|
-
});
|
|
67767
|
-
const saveChanges = (0, import_react62.useCallback)(async () => {
|
|
68188
|
+
const saveChanges = (0, import_react61.useCallback)(async () => {
|
|
67768
68189
|
if (!client) return;
|
|
67769
68190
|
if (!String(dashboardNameForNewReport ?? "").trim()) return;
|
|
67770
68191
|
if (!sourceReport) return;
|
|
@@ -67823,7 +68244,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67823
68244
|
]);
|
|
67824
68245
|
return {
|
|
67825
68246
|
/* ── Chart & table (exceptions: not value/options pairs) ── */
|
|
67826
|
-
chart,
|
|
68247
|
+
chart: chartForUi,
|
|
67827
68248
|
chartLoading,
|
|
67828
68249
|
table,
|
|
67829
68250
|
tableLoading,
|
|
@@ -67842,22 +68263,28 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67842
68263
|
groupRowsByOptions,
|
|
67843
68264
|
groupColumnsBy,
|
|
67844
68265
|
groupColumnsByOptions,
|
|
67845
|
-
|
|
68266
|
+
dateBucket,
|
|
68267
|
+
dateBucketOptions: PIVOT_DATE_BUCKET_OPTIONS,
|
|
68268
|
+
/** Encoded selection per aggregation slot (`'sum:transactions::amount'`, `'count:transactions'`, `''` = placeholder). Update via `setReport({ aggregations: nextStringArray })`. */
|
|
68269
|
+
aggregations: aggregationValues,
|
|
68270
|
+
/** Flat aggregation pick list shared by all slots; always contains every non-empty `aggregations` entry. */
|
|
67846
68271
|
aggregationOptions,
|
|
67847
68272
|
aggregationDescriptionOptions: cleanedAggregations,
|
|
67848
68273
|
sort: cleanedSort,
|
|
67849
68274
|
sortOptions,
|
|
67850
68275
|
chartType,
|
|
67851
68276
|
chartTypeOptions: chartTypes,
|
|
67852
|
-
/**
|
|
67853
|
-
|
|
67854
|
-
/**
|
|
67855
|
-
|
|
68277
|
+
/** Selected tabular columns in display order. */
|
|
68278
|
+
columns: tableColumnValues,
|
|
68279
|
+
/** Pivot table columns only allow label and format changes. */
|
|
68280
|
+
columnStructureEditsLocked: isPivotTableChart,
|
|
68281
|
+
/** Optional rich operations; simple selection updates use `setReport({ columns })`. */
|
|
68282
|
+
columnActions,
|
|
67856
68283
|
/** Schema columns for current datasources — pool for the table column picker. */
|
|
67857
68284
|
columnOptions: tableColumnPickerPoolOptions,
|
|
67858
|
-
xAxis
|
|
68285
|
+
xAxis,
|
|
67859
68286
|
xAxisOptions: normalizedChartXAxisOptions,
|
|
67860
|
-
yAxis
|
|
68287
|
+
yAxis,
|
|
67861
68288
|
yAxisOptions: normalizedChartYAxisOptions,
|
|
67862
68289
|
/** Same strings as `axisSelectFormatLabels` (X/Y share chart format presets). */
|
|
67863
68290
|
xAxisFormatOptions: xAxisFormatOptionLabels,
|
|
@@ -67865,8 +68292,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67865
68292
|
/** Table column format dropdown labels (same set as chart axis formats). */
|
|
67866
68293
|
tableFormatOptions: axisSelectFormatLabels,
|
|
67867
68294
|
showLegend: chartVisibility.showLegend,
|
|
67868
|
-
axisConfig,
|
|
67869
|
-
availableFields,
|
|
67870
68295
|
axisSelectFormatLabels,
|
|
67871
68296
|
/** @deprecated Prefer top-level `xAxis`, `yAxis`, and `showLegend`. */
|
|
67872
68297
|
chartAxes,
|
|
@@ -67880,12 +68305,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67880
68305
|
filters: filtersForQueryBuilder,
|
|
67881
68306
|
filterQueryBuilderProps,
|
|
67882
68307
|
/**
|
|
67883
|
-
*
|
|
67884
|
-
*
|
|
67885
|
-
*
|
|
67886
|
-
* `commitFilterDraft` / `resetFilterDraft` / `seedFilterDraft`.
|
|
68308
|
+
* Filter value pick lists for custom UIs (string unique values + pivot date
|
|
68309
|
+
* buckets). Same string data as `filterQueryBuilderProps.getValues`; not
|
|
68310
|
+
* wired into react-querybuilder unless you use it yourself.
|
|
67887
68311
|
*/
|
|
67888
|
-
|
|
68312
|
+
filterOptions,
|
|
67889
68313
|
/** True while `report-builder-unique-values` runs for filter value options (not chart/table load). */
|
|
67890
68314
|
filterUniqueValuesLoading,
|
|
67891
68315
|
limit,
|
|
@@ -67893,7 +68317,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67893
68317
|
chartTypes,
|
|
67894
68318
|
columnsOptions: tableColumnPickerPoolOptions,
|
|
67895
68319
|
tableColumnOptions: tableColumnPickerPoolOptions,
|
|
67896
|
-
tableColumns,
|
|
67897
68320
|
setReport,
|
|
67898
68321
|
saveChanges,
|
|
67899
68322
|
setFilters,
|
|
@@ -67911,7 +68334,7 @@ function ChatChartCard({
|
|
|
67911
68334
|
ButtonComponent = MemoizedButton
|
|
67912
68335
|
}) {
|
|
67913
68336
|
const {
|
|
67914
|
-
|
|
68337
|
+
columns,
|
|
67915
68338
|
columnOptions,
|
|
67916
68339
|
groupRowsBy,
|
|
67917
68340
|
groupRowsByOptions,
|
|
@@ -67925,20 +68348,10 @@ function ChatChartCard({
|
|
|
67925
68348
|
loading,
|
|
67926
68349
|
setReport
|
|
67927
68350
|
} = useReport(reportId);
|
|
67928
|
-
const
|
|
67929
|
-
|
|
67930
|
-
|
|
67931
|
-
|
|
67932
|
-
const tableName = String(option?.tableName ?? "").trim();
|
|
67933
|
-
const fieldName = String(option?.field ?? "").trim() || String(option?.label ?? "").trim() || value;
|
|
67934
|
-
return {
|
|
67935
|
-
value,
|
|
67936
|
-
label: tableName ? `${tableName}.${fieldName}` : fieldName
|
|
67937
|
-
};
|
|
67938
|
-
}).filter(
|
|
67939
|
-
(option) => Boolean(option)
|
|
67940
|
-
);
|
|
67941
|
-
}, [columnOptions]);
|
|
68351
|
+
const selectedColumnValues = (0, import_react62.useMemo)(
|
|
68352
|
+
() => columns.map((column) => column.value),
|
|
68353
|
+
[columns]
|
|
68354
|
+
);
|
|
67942
68355
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
67943
68356
|
"div",
|
|
67944
68357
|
{
|
|
@@ -67974,7 +68387,7 @@ function ChatChartCard({
|
|
|
67974
68387
|
padding: 16
|
|
67975
68388
|
},
|
|
67976
68389
|
children: [
|
|
67977
|
-
JSON.stringify(
|
|
68390
|
+
JSON.stringify(columns, null, 2),
|
|
67978
68391
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
67979
68392
|
"label",
|
|
67980
68393
|
{
|
|
@@ -67991,13 +68404,24 @@ function ChatChartCard({
|
|
|
67991
68404
|
"select",
|
|
67992
68405
|
{
|
|
67993
68406
|
multiple: true,
|
|
67994
|
-
size: Math.min(10, Math.max(4,
|
|
67995
|
-
value:
|
|
68407
|
+
size: Math.min(10, Math.max(4, columnOptions.length || 4)),
|
|
68408
|
+
value: selectedColumnValues,
|
|
67996
68409
|
onChange: (event) => {
|
|
67997
|
-
const
|
|
67998
|
-
(
|
|
68410
|
+
const selectedByValue = new Map(
|
|
68411
|
+
columns.map((column) => [column.value, column])
|
|
68412
|
+
);
|
|
68413
|
+
const optionByValue = new Map(
|
|
68414
|
+
columnOptions.map((option) => [option.value, option])
|
|
67999
68415
|
);
|
|
68000
|
-
setReport({
|
|
68416
|
+
setReport({
|
|
68417
|
+
columns: Array.from(event.target.selectedOptions).map(
|
|
68418
|
+
(selectedOption) => selectedByValue.get(selectedOption.value) ?? {
|
|
68419
|
+
value: selectedOption.value,
|
|
68420
|
+
label: optionByValue.get(selectedOption.value)?.label ?? selectedOption.value,
|
|
68421
|
+
format: ""
|
|
68422
|
+
}
|
|
68423
|
+
)
|
|
68424
|
+
});
|
|
68001
68425
|
},
|
|
68002
68426
|
style: {
|
|
68003
68427
|
width: 200,
|
|
@@ -68007,7 +68431,7 @@ function ChatChartCard({
|
|
|
68007
68431
|
padding: 8,
|
|
68008
68432
|
background: "#fff"
|
|
68009
68433
|
},
|
|
68010
|
-
children:
|
|
68434
|
+
children: columnOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: option.value, children: option.label }, option.value))
|
|
68011
68435
|
}
|
|
68012
68436
|
)
|
|
68013
68437
|
]
|
|
@@ -68033,28 +68457,27 @@ function ChatChartCard({
|
|
|
68033
68457
|
onChange: (e) => setReport({ groupColumnsBy: e.target.value ?? "" })
|
|
68034
68458
|
}
|
|
68035
68459
|
),
|
|
68036
|
-
|
|
68460
|
+
aggregations.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
68037
68461
|
SelectComponent,
|
|
68038
68462
|
{
|
|
68039
|
-
value
|
|
68040
|
-
label:
|
|
68463
|
+
value,
|
|
68464
|
+
label: `Aggregation ${index + 1}`,
|
|
68041
68465
|
width: 200,
|
|
68042
|
-
options:
|
|
68466
|
+
options: aggregationOptions,
|
|
68043
68467
|
onChange: (e) => setReport({
|
|
68044
|
-
aggregations:
|
|
68468
|
+
aggregations: aggregations.map(
|
|
68469
|
+
(aggregation, i) => i === index ? e.target.value ?? "" : aggregation
|
|
68470
|
+
)
|
|
68045
68471
|
})
|
|
68046
68472
|
},
|
|
68047
|
-
|
|
68473
|
+
`aggregation-${index}`
|
|
68048
68474
|
)),
|
|
68049
68475
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
68050
68476
|
ButtonComponent,
|
|
68051
68477
|
{
|
|
68052
68478
|
label: "Add aggregation",
|
|
68053
68479
|
onClick: () => setReport({
|
|
68054
|
-
aggregations:
|
|
68055
|
-
index: aggregations.length,
|
|
68056
|
-
value: "count transactions"
|
|
68057
|
-
}
|
|
68480
|
+
aggregations: [...aggregations, "count:transactions"]
|
|
68058
68481
|
})
|
|
68059
68482
|
}
|
|
68060
68483
|
),
|
|
@@ -68192,7 +68615,7 @@ function ToolCallBlock({ toolCall }) {
|
|
|
68192
68615
|
);
|
|
68193
68616
|
}
|
|
68194
68617
|
function ToolCallResult({ content }) {
|
|
68195
|
-
const [expanded, setExpanded] = (0,
|
|
68618
|
+
const [expanded, setExpanded] = (0, import_react63.useState)(false);
|
|
68196
68619
|
if (!content) return null;
|
|
68197
68620
|
const isLong = content.length > 300;
|
|
68198
68621
|
const displayed = isLong && !expanded ? content.slice(0, 300) + "..." : content;
|
|
@@ -68244,18 +68667,18 @@ function Chat({
|
|
|
68244
68667
|
agentEndpoint,
|
|
68245
68668
|
suggestions
|
|
68246
68669
|
}) {
|
|
68247
|
-
const [client] = (0,
|
|
68248
|
-
const { getToken } = (0,
|
|
68249
|
-
const { tenants } = (0,
|
|
68250
|
-
const [messages, setMessages] = (0,
|
|
68251
|
-
const [input, setInput] = (0,
|
|
68252
|
-
const [inputError, setInputError] = (0,
|
|
68253
|
-
const [isLoading, setIsLoading] = (0,
|
|
68254
|
-
const [model, setModel] = (0,
|
|
68255
|
-
const containerRef = (0,
|
|
68256
|
-
const textareaRef = (0,
|
|
68257
|
-
const abortControllerRef = (0,
|
|
68258
|
-
(0,
|
|
68670
|
+
const [client] = (0, import_react63.useContext)(ClientContext);
|
|
68671
|
+
const { getToken } = (0, import_react63.useContext)(FetchContext);
|
|
68672
|
+
const { tenants } = (0, import_react63.useContext)(TenantContext);
|
|
68673
|
+
const [messages, setMessages] = (0, import_react63.useState)([]);
|
|
68674
|
+
const [input, setInput] = (0, import_react63.useState)("");
|
|
68675
|
+
const [inputError, setInputError] = (0, import_react63.useState)("");
|
|
68676
|
+
const [isLoading, setIsLoading] = (0, import_react63.useState)(false);
|
|
68677
|
+
const [model, setModel] = (0, import_react63.useState)("gemini-3-flash-preview");
|
|
68678
|
+
const containerRef = (0, import_react63.useRef)(null);
|
|
68679
|
+
const textareaRef = (0, import_react63.useRef)(null);
|
|
68680
|
+
const abortControllerRef = (0, import_react63.useRef)(null);
|
|
68681
|
+
(0, import_react63.useEffect)(() => {
|
|
68259
68682
|
if (!containerRef.current) {
|
|
68260
68683
|
return;
|
|
68261
68684
|
}
|
|
@@ -68267,11 +68690,11 @@ function Chat({
|
|
|
68267
68690
|
setIsLoading(false);
|
|
68268
68691
|
};
|
|
68269
68692
|
const submitDefaultMessage = async (nextMessages, abortController) => {
|
|
68270
|
-
const clientId = client.
|
|
68693
|
+
const clientId = client.id;
|
|
68271
68694
|
let responseBuffer = "";
|
|
68272
68695
|
for await (const chunk of quillStream({
|
|
68273
68696
|
client: {
|
|
68274
|
-
clientId,
|
|
68697
|
+
id: clientId,
|
|
68275
68698
|
queryEndpoint: client.queryEndpoint,
|
|
68276
68699
|
streamEndpoint: client.streamEndpoint,
|
|
68277
68700
|
queryHeaders: client.queryHeaders,
|
|
@@ -68355,12 +68778,12 @@ function Chat({
|
|
|
68355
68778
|
}
|
|
68356
68779
|
};
|
|
68357
68780
|
const submitAgentMessage = async (nextMessages, abortController) => {
|
|
68358
|
-
const clientId = client.
|
|
68781
|
+
const clientId = client.id;
|
|
68359
68782
|
let updatedMessages = [...nextMessages];
|
|
68360
68783
|
for await (const event of quillAgentStream({
|
|
68361
68784
|
endpoint: `${agentEndpoint}/agent/chat`,
|
|
68362
68785
|
messages: updatedMessages,
|
|
68363
|
-
sourceClientId: clientId,
|
|
68786
|
+
sourceClientId: clientId ?? "<unknown>",
|
|
68364
68787
|
getToken,
|
|
68365
68788
|
abortSignal: abortController.signal
|
|
68366
68789
|
})) {
|
|
@@ -68428,7 +68851,7 @@ function Chat({
|
|
|
68428
68851
|
setIsLoading(true);
|
|
68429
68852
|
const abortController = new AbortController();
|
|
68430
68853
|
abortControllerRef.current = abortController;
|
|
68431
|
-
const clientId = client.
|
|
68854
|
+
const clientId = client.id;
|
|
68432
68855
|
if (!clientId) {
|
|
68433
68856
|
setInputError("No client selected.");
|
|
68434
68857
|
setIsLoading(false);
|
|
@@ -68688,6 +69111,162 @@ function Chat({
|
|
|
68688
69111
|
);
|
|
68689
69112
|
}
|
|
68690
69113
|
|
|
69114
|
+
// src/hooks/useReportFilterDraft.ts
|
|
69115
|
+
var import_react64 = require("react");
|
|
69116
|
+
var normalizeOperatorKey = (operator) => String(operator ?? "").trim().toLowerCase().replace(/[_\s]+/g, "");
|
|
69117
|
+
var defaultFilterRuleValueForOperator = (operator) => {
|
|
69118
|
+
const key = normalizeOperatorKey(operator);
|
|
69119
|
+
if (key === "in" || key === "notin") {
|
|
69120
|
+
return [];
|
|
69121
|
+
}
|
|
69122
|
+
return "";
|
|
69123
|
+
};
|
|
69124
|
+
var EMPTY_COMMITTED_FILTERS = {
|
|
69125
|
+
combinator: "and",
|
|
69126
|
+
rules: []
|
|
69127
|
+
};
|
|
69128
|
+
var hashString2 = (input) => {
|
|
69129
|
+
let hash = 2166136261;
|
|
69130
|
+
for (let i = 0; i < input.length; i++) {
|
|
69131
|
+
hash ^= input.charCodeAt(i);
|
|
69132
|
+
hash = Math.imul(hash, 16777619);
|
|
69133
|
+
}
|
|
69134
|
+
return String(hash >>> 0);
|
|
69135
|
+
};
|
|
69136
|
+
var fieldCatalogSignature = (fields) => {
|
|
69137
|
+
const names = fields.map((field) => String(field.name ?? "").trim()).filter(Boolean).sort();
|
|
69138
|
+
return `${names.length}:${hashString2(names.join("\0"))}`;
|
|
69139
|
+
};
|
|
69140
|
+
var committedFiltersSignature = (committed) => {
|
|
69141
|
+
try {
|
|
69142
|
+
return hashString2(
|
|
69143
|
+
JSON.stringify(stripQueryBuilderTransientFields(committed))
|
|
69144
|
+
);
|
|
69145
|
+
} catch {
|
|
69146
|
+
return "unserializable";
|
|
69147
|
+
}
|
|
69148
|
+
};
|
|
69149
|
+
function useReportFilterDraft(args) {
|
|
69150
|
+
const { reportId, committedFilters, queryBuilderProps, setFilters } = args;
|
|
69151
|
+
const committed = queryBuilderFiltersForEditor(
|
|
69152
|
+
isQueryBuilderDisplayGroup(committedFilters) ? committedFilters : EMPTY_COMMITTED_FILTERS
|
|
69153
|
+
);
|
|
69154
|
+
const committedRef = (0, import_react64.useRef)(committed);
|
|
69155
|
+
committedRef.current = committed;
|
|
69156
|
+
const setFiltersRef = (0, import_react64.useRef)(setFilters);
|
|
69157
|
+
setFiltersRef.current = setFilters;
|
|
69158
|
+
const lastNonEmptyFieldsRef = (0, import_react64.useRef)([]);
|
|
69159
|
+
const prevReportIdForFieldsRef = (0, import_react64.useRef)(reportId);
|
|
69160
|
+
if (prevReportIdForFieldsRef.current !== reportId) {
|
|
69161
|
+
prevReportIdForFieldsRef.current = reportId;
|
|
69162
|
+
lastNonEmptyFieldsRef.current = [];
|
|
69163
|
+
}
|
|
69164
|
+
if (queryBuilderProps.fields.length > 0) {
|
|
69165
|
+
lastNonEmptyFieldsRef.current = queryBuilderProps.fields;
|
|
69166
|
+
}
|
|
69167
|
+
const effectiveFields = queryBuilderProps.fields.length > 0 ? queryBuilderProps.fields : lastNonEmptyFieldsRef.current;
|
|
69168
|
+
const committedSignature = (0, import_react64.useMemo)(
|
|
69169
|
+
() => committedFiltersSignature(committed),
|
|
69170
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- `committed` normalizes null to a stable constant
|
|
69171
|
+
[committedFilters]
|
|
69172
|
+
);
|
|
69173
|
+
const fieldsSignature = (0, import_react64.useMemo)(
|
|
69174
|
+
() => fieldCatalogSignature(effectiveFields),
|
|
69175
|
+
[effectiveFields]
|
|
69176
|
+
);
|
|
69177
|
+
const [resetEpoch, setResetEpoch] = (0, import_react64.useState)(0);
|
|
69178
|
+
const [draftQuery, setDraftQuery] = (0, import_react64.useState)(committed);
|
|
69179
|
+
const [hasUnappliedFilterChanges, setHasUnappliedFilterChanges] = (0, import_react64.useState)(false);
|
|
69180
|
+
const draftResetKey = `${reportId}|${committedSignature}|${resetEpoch}`;
|
|
69181
|
+
const prevDraftResetKeyRef = (0, import_react64.useRef)(draftResetKey);
|
|
69182
|
+
if (prevDraftResetKeyRef.current !== draftResetKey) {
|
|
69183
|
+
prevDraftResetKeyRef.current = draftResetKey;
|
|
69184
|
+
setDraftQuery(committed);
|
|
69185
|
+
if (hasUnappliedFilterChanges) setHasUnappliedFilterChanges(false);
|
|
69186
|
+
}
|
|
69187
|
+
const filterDraftKey = `${draftResetKey}|${fieldsSignature}`;
|
|
69188
|
+
const handleQueryChange = (0, import_react64.useCallback)((next) => {
|
|
69189
|
+
if (!isQueryBuilderDisplayGroup(next)) return;
|
|
69190
|
+
const nextGroup = next;
|
|
69191
|
+
setDraftQuery(nextGroup);
|
|
69192
|
+
const nextDirty = areQueryBuilderFilterDraftsDirty(
|
|
69193
|
+
nextGroup,
|
|
69194
|
+
committedRef.current
|
|
69195
|
+
);
|
|
69196
|
+
setHasUnappliedFilterChanges(
|
|
69197
|
+
(prev) => prev === nextDirty ? prev : nextDirty
|
|
69198
|
+
);
|
|
69199
|
+
}, []);
|
|
69200
|
+
const applyFilterDraft = (0, import_react64.useCallback)(() => {
|
|
69201
|
+
setFiltersRef.current(draftQuery);
|
|
69202
|
+
}, [draftQuery]);
|
|
69203
|
+
const resetFilterDraft = (0, import_react64.useCallback)(() => {
|
|
69204
|
+
setDraftQuery(committedRef.current);
|
|
69205
|
+
setHasUnappliedFilterChanges(false);
|
|
69206
|
+
setResetEpoch((epoch) => epoch + 1);
|
|
69207
|
+
}, []);
|
|
69208
|
+
const getDefaultField = (0, import_react64.useCallback)((fields) => {
|
|
69209
|
+
const stringField = fields.find(
|
|
69210
|
+
(field) => field.quillFieldType === "string" && String(field.name ?? "").trim()
|
|
69211
|
+
);
|
|
69212
|
+
return stringField?.name ?? fields[0]?.name ?? "";
|
|
69213
|
+
}, []);
|
|
69214
|
+
const getDefaultValue = (0, import_react64.useCallback)(
|
|
69215
|
+
(rule) => defaultFilterRuleValueForOperator(rule?.operator),
|
|
69216
|
+
[]
|
|
69217
|
+
);
|
|
69218
|
+
const filterDraftQueryBuilderProps = (0, import_react64.useMemo)(
|
|
69219
|
+
() => ({
|
|
69220
|
+
...queryBuilderProps,
|
|
69221
|
+
fields: effectiveFields,
|
|
69222
|
+
// Uncontrolled: react-querybuilder owns the draft; only read at mount,
|
|
69223
|
+
// while state keeps the next mount hydrated from the latest edits.
|
|
69224
|
+
// Empty draft: omit defaultQuery so addRuleToNewGroups seeds a root rule
|
|
69225
|
+
// (RQB ignores auto-add when defaultQuery.rules is []).
|
|
69226
|
+
...draftQuery.rules.length > 0 ? { defaultQuery: draftQuery } : {},
|
|
69227
|
+
onQueryChange: handleQueryChange,
|
|
69228
|
+
addRuleToNewGroups: true,
|
|
69229
|
+
getDefaultField,
|
|
69230
|
+
getDefaultValue
|
|
69231
|
+
}),
|
|
69232
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- filterDraftKey covers draftRef resets
|
|
69233
|
+
[
|
|
69234
|
+
queryBuilderProps,
|
|
69235
|
+
effectiveFields,
|
|
69236
|
+
draftQuery,
|
|
69237
|
+
handleQueryChange,
|
|
69238
|
+
getDefaultField,
|
|
69239
|
+
getDefaultValue,
|
|
69240
|
+
filterDraftKey
|
|
69241
|
+
]
|
|
69242
|
+
);
|
|
69243
|
+
return {
|
|
69244
|
+
filterDraftKey,
|
|
69245
|
+
filterDraftQueryBuilderProps,
|
|
69246
|
+
hasUnappliedFilterChanges,
|
|
69247
|
+
applyFilterDraft,
|
|
69248
|
+
resetFilterDraft
|
|
69249
|
+
};
|
|
69250
|
+
}
|
|
69251
|
+
|
|
69252
|
+
// src/hooks/useReportQueryBuilder.ts
|
|
69253
|
+
function useReportQueryBuilder(args) {
|
|
69254
|
+
const draft = useReportFilterDraft({
|
|
69255
|
+
reportId: args.reportId ?? "",
|
|
69256
|
+
committedFilters: args.filters,
|
|
69257
|
+
queryBuilderProps: args.queryBuilderProps,
|
|
69258
|
+
setFilters: args.onApply
|
|
69259
|
+
});
|
|
69260
|
+
return {
|
|
69261
|
+
key: draft.filterDraftKey,
|
|
69262
|
+
props: draft.filterDraftQueryBuilderProps,
|
|
69263
|
+
hasUnappliedChanges: draft.hasUnappliedFilterChanges,
|
|
69264
|
+
apply: draft.applyFilterDraft,
|
|
69265
|
+
discard: draft.resetFilterDraft,
|
|
69266
|
+
reset: draft.resetFilterDraft
|
|
69267
|
+
};
|
|
69268
|
+
}
|
|
69269
|
+
|
|
68691
69270
|
// src/ReportDetail.tsx
|
|
68692
69271
|
var import_react65 = require("react");
|
|
68693
69272
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
@@ -69540,7 +70119,7 @@ var useVirtualTables = () => {
|
|
|
69540
70119
|
};
|
|
69541
70120
|
};
|
|
69542
70121
|
const handleRefreshSome = async (client, tables) => {
|
|
69543
|
-
if (!client.
|
|
70122
|
+
if (!client.id) return schemaData;
|
|
69544
70123
|
setLoadingTables({
|
|
69545
70124
|
...loadingTables,
|
|
69546
70125
|
...tables.reduce((acc, table) => {
|
|
@@ -69558,7 +70137,7 @@ var useVirtualTables = () => {
|
|
|
69558
70137
|
name: table.name,
|
|
69559
70138
|
customFieldInfo: table.customFieldInfo,
|
|
69560
70139
|
id: table._id,
|
|
69561
|
-
clientId: client.
|
|
70140
|
+
clientId: client.id,
|
|
69562
70141
|
runQueryConfig: { getColumns: true },
|
|
69563
70142
|
databaseType: client.databaseType,
|
|
69564
70143
|
useNewNodeSql: true
|
|
@@ -69706,11 +70285,12 @@ var useChangelogRefresh = () => {
|
|
|
69706
70285
|
reportsDispatch({ type: "DELETE_REPORT", id: reportId });
|
|
69707
70286
|
dashboardDispatch({ type: "REMOVE_DASHBOARD_ITEM", id: reportId });
|
|
69708
70287
|
}
|
|
69709
|
-
const finalDashboardSet = reloadAllDashboards ? new Set(
|
|
69710
|
-
Object.keys(dashboardConfig).filter(
|
|
70288
|
+
const finalDashboardSet = reloadAllDashboards ? /* @__PURE__ */ new Set([
|
|
70289
|
+
...Object.keys(dashboardConfig).filter(
|
|
69711
70290
|
(d) => !dashboardsToRemove.has(d)
|
|
69712
|
-
)
|
|
69713
|
-
|
|
70291
|
+
),
|
|
70292
|
+
...dashboardsToReload
|
|
70293
|
+
]) : dashboardsToReload;
|
|
69714
70294
|
const tasks = [];
|
|
69715
70295
|
const schemaIdsToReload = schemaIds.filter(
|
|
69716
70296
|
(id) => !schemaIdsToRemove.has(id)
|
|
@@ -69818,7 +70398,6 @@ init_constants();
|
|
|
69818
70398
|
Table,
|
|
69819
70399
|
ThemeContext,
|
|
69820
70400
|
areQueryBuilderFilterDraftsDirty,
|
|
69821
|
-
buildSeededFilterQuery,
|
|
69822
70401
|
countFilterRules,
|
|
69823
70402
|
defaultFilterRuleValueForOperator,
|
|
69824
70403
|
downloadCSV,
|
|
@@ -69827,6 +70406,7 @@ init_constants();
|
|
|
69827
70406
|
isQueryBuilderDisplayRule,
|
|
69828
70407
|
normalizeRelativeDateRules,
|
|
69829
70408
|
prepareQueryBuilderFiltersForSet,
|
|
70409
|
+
queryBuilderFiltersForEditor,
|
|
69830
70410
|
quillFetch,
|
|
69831
70411
|
stripQueryBuilderTransientFields,
|
|
69832
70412
|
tableColumnFormatFromUiSelection,
|
|
@@ -69843,6 +70423,7 @@ init_constants();
|
|
|
69843
70423
|
useQuill,
|
|
69844
70424
|
useReport,
|
|
69845
70425
|
useReportBuilder,
|
|
70426
|
+
useReportQueryBuilder,
|
|
69846
70427
|
useReports,
|
|
69847
70428
|
useTenants,
|
|
69848
70429
|
useVirtualTables
|