@quillsql/react 2.16.90 → 2.16.92
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 +61 -43
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +61 -43
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -18641,6 +18641,19 @@ function replaceBigQuerySpecialCharacters(column) {
|
|
|
18641
18641
|
function processColumnReference(column, databaseType, fallbackOnNull, isColumnFieldAlias, isValueFieldAlias) {
|
|
18642
18642
|
switch (databaseType.toLowerCase()) {
|
|
18643
18643
|
case "postgresql":
|
|
18644
|
+
case "redshift": {
|
|
18645
|
+
if (column === "") {
|
|
18646
|
+
return fallbackOnNull ? `"${fallbackOnNull}"` : `"_"`;
|
|
18647
|
+
}
|
|
18648
|
+
if (isColumnFieldAlias) {
|
|
18649
|
+
return `"${column.replaceAll('"', "")}"`;
|
|
18650
|
+
}
|
|
18651
|
+
const columnParts = column.split(".");
|
|
18652
|
+
if (columnParts.length > 1) {
|
|
18653
|
+
return `"` + columnParts.map((part) => part.replaceAll('"', "")).join('"."') + `"`;
|
|
18654
|
+
}
|
|
18655
|
+
return `"${column.replaceAll('"', "")}"`;
|
|
18656
|
+
}
|
|
18644
18657
|
case "clickhouse": {
|
|
18645
18658
|
if (column === "") {
|
|
18646
18659
|
return fallbackOnNull ? `"${fallbackOnNull}"` : `"_"`;
|
|
@@ -18755,6 +18768,8 @@ function generateDistinctQuery(stringFields, query, databaseType) {
|
|
|
18755
18768
|
return generateDistinctQueryBigQuery(stringFields, query);
|
|
18756
18769
|
case "postgresql":
|
|
18757
18770
|
return generateDistinctQueryPostgres(stringFields, query);
|
|
18771
|
+
case "redshift":
|
|
18772
|
+
return generateDistinctQueryRedshift(stringFields, query);
|
|
18758
18773
|
case "snowflake":
|
|
18759
18774
|
return generateDistinctQuerySnowflake(stringFields, query);
|
|
18760
18775
|
case "mssql":
|
|
@@ -18801,6 +18816,13 @@ function generateDistinctQueryPostgres(stringFields, query) {
|
|
|
18801
18816
|
const distinctQuery = distinctQueries.join(" UNION ALL ");
|
|
18802
18817
|
return `WITH querytable AS (${query.replace(";", "")}) ` + distinctQuery;
|
|
18803
18818
|
}
|
|
18819
|
+
function generateDistinctQueryRedshift(stringFields, query) {
|
|
18820
|
+
const distinctQueries = stringFields.map((field) => {
|
|
18821
|
+
return `SELECT '${field}' AS "field", LISTAGG(DISTINCT "${field}") AS "string_values" FROM querytable`;
|
|
18822
|
+
});
|
|
18823
|
+
const distinctQuery = distinctQueries.join(" UNION ALL ");
|
|
18824
|
+
return `WITH querytable AS (${query.replace(";", "")}) ` + distinctQuery;
|
|
18825
|
+
}
|
|
18804
18826
|
function generateDistinctQuerySnowflake(stringFields, query) {
|
|
18805
18827
|
const distinctQueries = stringFields.map((field) => {
|
|
18806
18828
|
return `SELECT '${field}' AS "field", ARRAY_AGG(DISTINCT "${field}") AS "string_values" FROM querytable`;
|
|
@@ -18842,7 +18864,7 @@ function generateMinMaxDateRangeQueries(columnFields, query, databaseType) {
|
|
|
18842
18864
|
const min2 = "MIN";
|
|
18843
18865
|
const cast = databaseType.toLowerCase() === "snowflake" ? "::TIMESTAMP_TZ" : "";
|
|
18844
18866
|
const distinctQueries = columnFields.map((field) => {
|
|
18845
|
-
const wrappedField = ["postgresql", "clickhouse"].includes(
|
|
18867
|
+
const wrappedField = ["postgresql", "redshift", "clickhouse"].includes(
|
|
18846
18868
|
databaseType.toLowerCase()
|
|
18847
18869
|
) ? processColumnReference(field, databaseType) : field;
|
|
18848
18870
|
return `SELECT '${field}' AS ${processColumnReference("field", databaseType)}, ${min2}(${wrappedField})${cast} AS ${processColumnReference("min_range", databaseType)}, ${max2}(${wrappedField})${cast} AS ${processColumnReference("max_range", databaseType)} FROM querytable`;
|
|
@@ -53707,6 +53729,7 @@ function generateSuggestionsByDatasource(monaco, range, databaseType) {
|
|
|
53707
53729
|
switch (databaseType.toLowerCase()) {
|
|
53708
53730
|
case "snowflake":
|
|
53709
53731
|
case "postgresql":
|
|
53732
|
+
case "redshift":
|
|
53710
53733
|
return [
|
|
53711
53734
|
...POSTGRES_DATASOURCE_SUGGESTIONS(monaco, range),
|
|
53712
53735
|
...GENERIC_DATASOURCE_SUGGESTIONS(monaco, range)
|
|
@@ -65875,6 +65898,19 @@ async function loadViaReportBuilderState({
|
|
|
65875
65898
|
dashboardName: report?.dashboardName ?? dashboardName,
|
|
65876
65899
|
name: report?.name ?? reportId
|
|
65877
65900
|
};
|
|
65901
|
+
const processing = pagination ? {
|
|
65902
|
+
page: {
|
|
65903
|
+
page: pagination.pageIndex,
|
|
65904
|
+
rowsPerPage: pagination.pageSize,
|
|
65905
|
+
rowsPerRequest: pagination.pageSize
|
|
65906
|
+
},
|
|
65907
|
+
...paginationSort?.field ? { sort: paginationSort } : {}
|
|
65908
|
+
} : {
|
|
65909
|
+
page: {
|
|
65910
|
+
...DEFAULT_PAGINATION,
|
|
65911
|
+
rowsPerRequest: DEFAULT_USE_REPORT_ROWS_PER_REQUEST
|
|
65912
|
+
}
|
|
65913
|
+
};
|
|
65878
65914
|
const reportBuilderInfo = await fetchReportBuilderDataFromState({
|
|
65879
65915
|
reportBuilderState,
|
|
65880
65916
|
schema,
|
|
@@ -65889,19 +65925,7 @@ async function loadViaReportBuilderState({
|
|
|
65889
65925
|
skipRowCount: rowsOnly,
|
|
65890
65926
|
rowCountOnly,
|
|
65891
65927
|
previousRelevant: previousRelevantWhenSkippingInlineUniqueFetch(report),
|
|
65892
|
-
processing
|
|
65893
|
-
page: {
|
|
65894
|
-
page: pagination.pageIndex,
|
|
65895
|
-
rowsPerPage: pagination.pageSize,
|
|
65896
|
-
rowsPerRequest: pagination.pageSize
|
|
65897
|
-
},
|
|
65898
|
-
...paginationSort?.field ? { sort: paginationSort } : {}
|
|
65899
|
-
} : {
|
|
65900
|
-
page: {
|
|
65901
|
-
...DEFAULT_PAGINATION,
|
|
65902
|
-
rowsPerRequest: DEFAULT_USE_REPORT_ROWS_PER_REQUEST
|
|
65903
|
-
}
|
|
65904
|
-
},
|
|
65928
|
+
processing,
|
|
65905
65929
|
dashboardName,
|
|
65906
65930
|
getToken,
|
|
65907
65931
|
eventTracking: null,
|
|
@@ -66534,9 +66558,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66534
66558
|
}, [schemaForReportBuilderState, schemaForeignKeyMap]);
|
|
66535
66559
|
const reportBuilderBaseTableNamesKey = (sourceReport?.reportBuilderState?.tables ?? []).map((t) => String(t?.name ?? "").trim()).filter(Boolean).join("\0") ?? "";
|
|
66536
66560
|
const selectedBaseTableNamesForFieldOptions = (0, import_react63.useMemo)(() => {
|
|
66537
|
-
|
|
66538
|
-
|
|
66539
|
-
return fromPicker;
|
|
66561
|
+
if (Array.isArray(schemaDatasourceIds)) {
|
|
66562
|
+
return schemaDatasourceIds.map((id) => String(id ?? "").trim()).filter(Boolean);
|
|
66540
66563
|
}
|
|
66541
66564
|
return (sourceReport?.reportBuilderState?.tables ?? []).map((t) => String(t?.name ?? "").trim()).filter(Boolean);
|
|
66542
66565
|
}, [schemaDatasourceIdsKey, reportBuilderBaseTableNamesKey]);
|
|
@@ -67886,7 +67909,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67886
67909
|
prevPivotStateForColumnExpansionRef.current = pivotState;
|
|
67887
67910
|
}, [pivotState]);
|
|
67888
67911
|
const effectiveReportBuilderTables = (0, import_react63.useMemo)(() => {
|
|
67889
|
-
const explicitBaseFromSchemaPicker = Array.isArray(schemaDatasourceIds)
|
|
67912
|
+
const explicitBaseFromSchemaPicker = Array.isArray(schemaDatasourceIds) ? schemaDatasourceIds.map((tableName) => String(tableName ?? "").trim()).filter(Boolean).map((name2) => ({ name: name2 })) : null;
|
|
67890
67913
|
const baseTablesForMerge = explicitBaseFromSchemaPicker ?? baseReportBuilderTables;
|
|
67891
67914
|
return mergeReportBuilderTables(
|
|
67892
67915
|
baseTablesForMerge,
|
|
@@ -67920,6 +67943,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67920
67943
|
() => baseReportBuilderTables.map((table2) => String(table2.name ?? "").trim()).filter((name2) => Boolean(name2)),
|
|
67921
67944
|
[baseReportBuilderTables]
|
|
67922
67945
|
);
|
|
67946
|
+
const datasourcePickerValues = (0, import_react63.useMemo)(() => {
|
|
67947
|
+
if (Array.isArray(schemaDatasourceIds)) {
|
|
67948
|
+
return schemaDatasourceIds.map((tableName) => String(tableName ?? "").trim()).filter((name2) => Boolean(name2));
|
|
67949
|
+
}
|
|
67950
|
+
return baseReportBuilderTableNames;
|
|
67951
|
+
}, [baseReportBuilderTableNames, schemaDatasourceIdsKey]);
|
|
67923
67952
|
const normalizeQueryBuilderFieldNameForConfig = (0, import_react63.useMemo)(() => {
|
|
67924
67953
|
const configEntries = Object.entries(queryBuilderFieldConfigByName);
|
|
67925
67954
|
const preferredTableNames = /* @__PURE__ */ new Set([
|
|
@@ -68957,31 +68986,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68957
68986
|
shouldSkipPivotRefreshForUnchangedPivot,
|
|
68958
68987
|
sourceReport
|
|
68959
68988
|
]);
|
|
68960
|
-
const shouldSkipRedundantPivotTableDataReportBuilderQuery = (0, import_react63.useMemo)(() => {
|
|
68961
|
-
if (!sourceReport || !nextPivot) {
|
|
68962
|
-
return false;
|
|
68963
|
-
}
|
|
68964
|
-
if (tableRefreshVersion !== 0 || pivotRefreshVersion !== 0) {
|
|
68965
|
-
return false;
|
|
68966
|
-
}
|
|
68967
|
-
if (!Array.isArray(sourceReport.rows) || sourceReport.rows.length === 0) {
|
|
68968
|
-
return false;
|
|
68969
|
-
}
|
|
68970
|
-
if (refreshDecision.shouldRefresh) {
|
|
68971
|
-
return false;
|
|
68972
|
-
}
|
|
68973
|
-
const sourceRules = sourceReport.reportBuilderState?.rules ?? EMPTY_QUERY_FILTERS;
|
|
68974
|
-
return stableSerializeForQueryKey(queryFilters) === stableSerializeForQueryKey(sourceRules);
|
|
68975
|
-
}, [
|
|
68976
|
-
sourceReport,
|
|
68977
|
-
nextPivot,
|
|
68978
|
-
tableRefreshVersion,
|
|
68979
|
-
pivotRefreshVersion,
|
|
68980
|
-
refreshDecision.shouldRefresh,
|
|
68981
|
-
queryFilters
|
|
68982
|
-
]);
|
|
68983
68989
|
const pivotRefreshQueryEnabled = !reportOverride && pendingPivotRefresh && !shouldSkipPivotRefreshForUnchangedPivot && Boolean(sourceReport) && Boolean(client) && Boolean(effectiveReportBuilderState) && Boolean(nextPivot) && sourceReportMatchesEffectiveReportId;
|
|
68984
|
-
const pivotTableDataRefreshQueryEnabled = !reportOverride && Boolean(sourceReport) && Boolean(client) && Boolean(nextPivot) && Boolean(pivotTableDataReportBuilderState) && !pendingPivotRefresh && sourceReportMatchesEffectiveReportId
|
|
68990
|
+
const pivotTableDataRefreshQueryEnabled = !reportOverride && Boolean(sourceReport) && Boolean(client) && Boolean(nextPivot) && Boolean(pivotTableDataReportBuilderState) && !pendingPivotRefresh && sourceReportMatchesEffectiveReportId;
|
|
68985
68991
|
const pivotRefreshQuery = (0, import_react_query3.useQuery)({
|
|
68986
68992
|
queryKey: createUseFormPivotRefreshQueryKey({
|
|
68987
68993
|
reportId: effectiveReportId,
|
|
@@ -70716,7 +70722,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70716
70722
|
}
|
|
70717
70723
|
if (effectiveNextState.datasources !== void 0) {
|
|
70718
70724
|
const nextIds = effectiveNextState.datasources.map((tableName) => String(tableName ?? "").trim()).filter(Boolean);
|
|
70719
|
-
next.schemaDatasourceIds = nextIds
|
|
70725
|
+
next.schemaDatasourceIds = nextIds;
|
|
70720
70726
|
if (nextIds.length > 0) {
|
|
70721
70727
|
pruneFormStateToExplicitDatasourceTables(next, nextIds, {
|
|
70722
70728
|
sourceReport,
|
|
@@ -70769,6 +70775,15 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70769
70775
|
}
|
|
70770
70776
|
}
|
|
70771
70777
|
}
|
|
70778
|
+
} else {
|
|
70779
|
+
next.queryColumns = [];
|
|
70780
|
+
next.groupRowsBy = void 0;
|
|
70781
|
+
next.groupColumnsBy = void 0;
|
|
70782
|
+
next.aggregationState = [];
|
|
70783
|
+
next.aggregationTablesByIndex = [];
|
|
70784
|
+
next.pivotSort = void 0;
|
|
70785
|
+
next.regularSort = void 0;
|
|
70786
|
+
next.queryFilters = { combinator: "and", rules: [] };
|
|
70772
70787
|
}
|
|
70773
70788
|
}
|
|
70774
70789
|
if (effectiveNextState.columns !== void 0) {
|
|
@@ -70789,6 +70804,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70789
70804
|
if (replacesDatasourceTableScope) {
|
|
70790
70805
|
next.queryColumns = normalizedDisplayColumns;
|
|
70791
70806
|
next.schemaDatasourceIds = [...requestedDisplayTableNames];
|
|
70807
|
+
} else if (effectiveNextState.datasources !== void 0 && normalizedDisplayColumns.length === 0) {
|
|
70808
|
+
next.queryColumns = [];
|
|
70792
70809
|
} else {
|
|
70793
70810
|
next.queryColumns = mergeReportBuilderColumns(
|
|
70794
70811
|
next.queryColumns,
|
|
@@ -71296,6 +71313,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71296
71313
|
reportId: effectiveReportId || void 0,
|
|
71297
71314
|
/* ── Selected value + pick list (same naming pattern throughout) ── */
|
|
71298
71315
|
datasources,
|
|
71316
|
+
datasourcePickerValues,
|
|
71299
71317
|
datasourceOptions,
|
|
71300
71318
|
groupRowsBy,
|
|
71301
71319
|
groupRowsByOptions,
|
package/dist/index.d.cts
CHANGED
|
@@ -3275,7 +3275,8 @@ interface SetReportBuilderInput {
|
|
|
3275
3275
|
chartAxes?: SetReportChartAxesInput;
|
|
3276
3276
|
/**
|
|
3277
3277
|
* Schema table names for datasource / multi-table picker UIs.
|
|
3278
|
-
*
|
|
3278
|
+
* An empty array clears the picker selection; omit or pass `undefined` via
|
|
3279
|
+
* report switches to fall back to saved report base tables.
|
|
3279
3280
|
*/
|
|
3280
3281
|
datasources?: string[];
|
|
3281
3282
|
}
|
|
@@ -3451,6 +3452,7 @@ declare function useReport(reportIdArg?: string, options?: UseReportOptions): {
|
|
|
3451
3452
|
*/
|
|
3452
3453
|
reportId: string | undefined;
|
|
3453
3454
|
datasources: string[];
|
|
3455
|
+
datasourcePickerValues: string[];
|
|
3454
3456
|
datasourceOptions: DatasourceOption[];
|
|
3455
3457
|
groupRowsBy: string | undefined;
|
|
3456
3458
|
groupRowsByOptions: SelectOption[];
|
package/dist/index.d.ts
CHANGED
|
@@ -3275,7 +3275,8 @@ interface SetReportBuilderInput {
|
|
|
3275
3275
|
chartAxes?: SetReportChartAxesInput;
|
|
3276
3276
|
/**
|
|
3277
3277
|
* Schema table names for datasource / multi-table picker UIs.
|
|
3278
|
-
*
|
|
3278
|
+
* An empty array clears the picker selection; omit or pass `undefined` via
|
|
3279
|
+
* report switches to fall back to saved report base tables.
|
|
3279
3280
|
*/
|
|
3280
3281
|
datasources?: string[];
|
|
3281
3282
|
}
|
|
@@ -3451,6 +3452,7 @@ declare function useReport(reportIdArg?: string, options?: UseReportOptions): {
|
|
|
3451
3452
|
*/
|
|
3452
3453
|
reportId: string | undefined;
|
|
3453
3454
|
datasources: string[];
|
|
3455
|
+
datasourcePickerValues: string[];
|
|
3454
3456
|
datasourceOptions: DatasourceOption[];
|
|
3455
3457
|
groupRowsBy: string | undefined;
|
|
3456
3458
|
groupRowsByOptions: SelectOption[];
|
package/dist/index.js
CHANGED
|
@@ -18687,6 +18687,19 @@ function replaceBigQuerySpecialCharacters(column) {
|
|
|
18687
18687
|
function processColumnReference(column, databaseType, fallbackOnNull, isColumnFieldAlias, isValueFieldAlias) {
|
|
18688
18688
|
switch (databaseType.toLowerCase()) {
|
|
18689
18689
|
case "postgresql":
|
|
18690
|
+
case "redshift": {
|
|
18691
|
+
if (column === "") {
|
|
18692
|
+
return fallbackOnNull ? `"${fallbackOnNull}"` : `"_"`;
|
|
18693
|
+
}
|
|
18694
|
+
if (isColumnFieldAlias) {
|
|
18695
|
+
return `"${column.replaceAll('"', "")}"`;
|
|
18696
|
+
}
|
|
18697
|
+
const columnParts = column.split(".");
|
|
18698
|
+
if (columnParts.length > 1) {
|
|
18699
|
+
return `"` + columnParts.map((part) => part.replaceAll('"', "")).join('"."') + `"`;
|
|
18700
|
+
}
|
|
18701
|
+
return `"${column.replaceAll('"', "")}"`;
|
|
18702
|
+
}
|
|
18690
18703
|
case "clickhouse": {
|
|
18691
18704
|
if (column === "") {
|
|
18692
18705
|
return fallbackOnNull ? `"${fallbackOnNull}"` : `"_"`;
|
|
@@ -18801,6 +18814,8 @@ function generateDistinctQuery(stringFields, query, databaseType) {
|
|
|
18801
18814
|
return generateDistinctQueryBigQuery(stringFields, query);
|
|
18802
18815
|
case "postgresql":
|
|
18803
18816
|
return generateDistinctQueryPostgres(stringFields, query);
|
|
18817
|
+
case "redshift":
|
|
18818
|
+
return generateDistinctQueryRedshift(stringFields, query);
|
|
18804
18819
|
case "snowflake":
|
|
18805
18820
|
return generateDistinctQuerySnowflake(stringFields, query);
|
|
18806
18821
|
case "mssql":
|
|
@@ -18847,6 +18862,13 @@ function generateDistinctQueryPostgres(stringFields, query) {
|
|
|
18847
18862
|
const distinctQuery = distinctQueries.join(" UNION ALL ");
|
|
18848
18863
|
return `WITH querytable AS (${query.replace(";", "")}) ` + distinctQuery;
|
|
18849
18864
|
}
|
|
18865
|
+
function generateDistinctQueryRedshift(stringFields, query) {
|
|
18866
|
+
const distinctQueries = stringFields.map((field) => {
|
|
18867
|
+
return `SELECT '${field}' AS "field", LISTAGG(DISTINCT "${field}") AS "string_values" FROM querytable`;
|
|
18868
|
+
});
|
|
18869
|
+
const distinctQuery = distinctQueries.join(" UNION ALL ");
|
|
18870
|
+
return `WITH querytable AS (${query.replace(";", "")}) ` + distinctQuery;
|
|
18871
|
+
}
|
|
18850
18872
|
function generateDistinctQuerySnowflake(stringFields, query) {
|
|
18851
18873
|
const distinctQueries = stringFields.map((field) => {
|
|
18852
18874
|
return `SELECT '${field}' AS "field", ARRAY_AGG(DISTINCT "${field}") AS "string_values" FROM querytable`;
|
|
@@ -18888,7 +18910,7 @@ function generateMinMaxDateRangeQueries(columnFields, query, databaseType) {
|
|
|
18888
18910
|
const min2 = "MIN";
|
|
18889
18911
|
const cast = databaseType.toLowerCase() === "snowflake" ? "::TIMESTAMP_TZ" : "";
|
|
18890
18912
|
const distinctQueries = columnFields.map((field) => {
|
|
18891
|
-
const wrappedField = ["postgresql", "clickhouse"].includes(
|
|
18913
|
+
const wrappedField = ["postgresql", "redshift", "clickhouse"].includes(
|
|
18892
18914
|
databaseType.toLowerCase()
|
|
18893
18915
|
) ? processColumnReference(field, databaseType) : field;
|
|
18894
18916
|
return `SELECT '${field}' AS ${processColumnReference("field", databaseType)}, ${min2}(${wrappedField})${cast} AS ${processColumnReference("min_range", databaseType)}, ${max2}(${wrappedField})${cast} AS ${processColumnReference("max_range", databaseType)} FROM querytable`;
|
|
@@ -53860,6 +53882,7 @@ function generateSuggestionsByDatasource(monaco, range, databaseType) {
|
|
|
53860
53882
|
switch (databaseType.toLowerCase()) {
|
|
53861
53883
|
case "snowflake":
|
|
53862
53884
|
case "postgresql":
|
|
53885
|
+
case "redshift":
|
|
53863
53886
|
return [
|
|
53864
53887
|
...POSTGRES_DATASOURCE_SUGGESTIONS(monaco, range),
|
|
53865
53888
|
...GENERIC_DATASOURCE_SUGGESTIONS(monaco, range)
|
|
@@ -66083,6 +66106,19 @@ async function loadViaReportBuilderState({
|
|
|
66083
66106
|
dashboardName: report?.dashboardName ?? dashboardName,
|
|
66084
66107
|
name: report?.name ?? reportId
|
|
66085
66108
|
};
|
|
66109
|
+
const processing = pagination ? {
|
|
66110
|
+
page: {
|
|
66111
|
+
page: pagination.pageIndex,
|
|
66112
|
+
rowsPerPage: pagination.pageSize,
|
|
66113
|
+
rowsPerRequest: pagination.pageSize
|
|
66114
|
+
},
|
|
66115
|
+
...paginationSort?.field ? { sort: paginationSort } : {}
|
|
66116
|
+
} : {
|
|
66117
|
+
page: {
|
|
66118
|
+
...DEFAULT_PAGINATION,
|
|
66119
|
+
rowsPerRequest: DEFAULT_USE_REPORT_ROWS_PER_REQUEST
|
|
66120
|
+
}
|
|
66121
|
+
};
|
|
66086
66122
|
const reportBuilderInfo = await fetchReportBuilderDataFromState({
|
|
66087
66123
|
reportBuilderState,
|
|
66088
66124
|
schema,
|
|
@@ -66097,19 +66133,7 @@ async function loadViaReportBuilderState({
|
|
|
66097
66133
|
skipRowCount: rowsOnly,
|
|
66098
66134
|
rowCountOnly,
|
|
66099
66135
|
previousRelevant: previousRelevantWhenSkippingInlineUniqueFetch(report),
|
|
66100
|
-
processing
|
|
66101
|
-
page: {
|
|
66102
|
-
page: pagination.pageIndex,
|
|
66103
|
-
rowsPerPage: pagination.pageSize,
|
|
66104
|
-
rowsPerRequest: pagination.pageSize
|
|
66105
|
-
},
|
|
66106
|
-
...paginationSort?.field ? { sort: paginationSort } : {}
|
|
66107
|
-
} : {
|
|
66108
|
-
page: {
|
|
66109
|
-
...DEFAULT_PAGINATION,
|
|
66110
|
-
rowsPerRequest: DEFAULT_USE_REPORT_ROWS_PER_REQUEST
|
|
66111
|
-
}
|
|
66112
|
-
},
|
|
66136
|
+
processing,
|
|
66113
66137
|
dashboardName,
|
|
66114
66138
|
getToken,
|
|
66115
66139
|
eventTracking: null,
|
|
@@ -66742,9 +66766,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66742
66766
|
}, [schemaForReportBuilderState, schemaForeignKeyMap]);
|
|
66743
66767
|
const reportBuilderBaseTableNamesKey = (sourceReport?.reportBuilderState?.tables ?? []).map((t) => String(t?.name ?? "").trim()).filter(Boolean).join("\0") ?? "";
|
|
66744
66768
|
const selectedBaseTableNamesForFieldOptions = useMemo33(() => {
|
|
66745
|
-
|
|
66746
|
-
|
|
66747
|
-
return fromPicker;
|
|
66769
|
+
if (Array.isArray(schemaDatasourceIds)) {
|
|
66770
|
+
return schemaDatasourceIds.map((id) => String(id ?? "").trim()).filter(Boolean);
|
|
66748
66771
|
}
|
|
66749
66772
|
return (sourceReport?.reportBuilderState?.tables ?? []).map((t) => String(t?.name ?? "").trim()).filter(Boolean);
|
|
66750
66773
|
}, [schemaDatasourceIdsKey, reportBuilderBaseTableNamesKey]);
|
|
@@ -68094,7 +68117,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68094
68117
|
prevPivotStateForColumnExpansionRef.current = pivotState;
|
|
68095
68118
|
}, [pivotState]);
|
|
68096
68119
|
const effectiveReportBuilderTables = useMemo33(() => {
|
|
68097
|
-
const explicitBaseFromSchemaPicker = Array.isArray(schemaDatasourceIds)
|
|
68120
|
+
const explicitBaseFromSchemaPicker = Array.isArray(schemaDatasourceIds) ? schemaDatasourceIds.map((tableName) => String(tableName ?? "").trim()).filter(Boolean).map((name2) => ({ name: name2 })) : null;
|
|
68098
68121
|
const baseTablesForMerge = explicitBaseFromSchemaPicker ?? baseReportBuilderTables;
|
|
68099
68122
|
return mergeReportBuilderTables(
|
|
68100
68123
|
baseTablesForMerge,
|
|
@@ -68128,6 +68151,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68128
68151
|
() => baseReportBuilderTables.map((table2) => String(table2.name ?? "").trim()).filter((name2) => Boolean(name2)),
|
|
68129
68152
|
[baseReportBuilderTables]
|
|
68130
68153
|
);
|
|
68154
|
+
const datasourcePickerValues = useMemo33(() => {
|
|
68155
|
+
if (Array.isArray(schemaDatasourceIds)) {
|
|
68156
|
+
return schemaDatasourceIds.map((tableName) => String(tableName ?? "").trim()).filter((name2) => Boolean(name2));
|
|
68157
|
+
}
|
|
68158
|
+
return baseReportBuilderTableNames;
|
|
68159
|
+
}, [baseReportBuilderTableNames, schemaDatasourceIdsKey]);
|
|
68131
68160
|
const normalizeQueryBuilderFieldNameForConfig = useMemo33(() => {
|
|
68132
68161
|
const configEntries = Object.entries(queryBuilderFieldConfigByName);
|
|
68133
68162
|
const preferredTableNames = /* @__PURE__ */ new Set([
|
|
@@ -69165,31 +69194,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69165
69194
|
shouldSkipPivotRefreshForUnchangedPivot,
|
|
69166
69195
|
sourceReport
|
|
69167
69196
|
]);
|
|
69168
|
-
const shouldSkipRedundantPivotTableDataReportBuilderQuery = useMemo33(() => {
|
|
69169
|
-
if (!sourceReport || !nextPivot) {
|
|
69170
|
-
return false;
|
|
69171
|
-
}
|
|
69172
|
-
if (tableRefreshVersion !== 0 || pivotRefreshVersion !== 0) {
|
|
69173
|
-
return false;
|
|
69174
|
-
}
|
|
69175
|
-
if (!Array.isArray(sourceReport.rows) || sourceReport.rows.length === 0) {
|
|
69176
|
-
return false;
|
|
69177
|
-
}
|
|
69178
|
-
if (refreshDecision.shouldRefresh) {
|
|
69179
|
-
return false;
|
|
69180
|
-
}
|
|
69181
|
-
const sourceRules = sourceReport.reportBuilderState?.rules ?? EMPTY_QUERY_FILTERS;
|
|
69182
|
-
return stableSerializeForQueryKey(queryFilters) === stableSerializeForQueryKey(sourceRules);
|
|
69183
|
-
}, [
|
|
69184
|
-
sourceReport,
|
|
69185
|
-
nextPivot,
|
|
69186
|
-
tableRefreshVersion,
|
|
69187
|
-
pivotRefreshVersion,
|
|
69188
|
-
refreshDecision.shouldRefresh,
|
|
69189
|
-
queryFilters
|
|
69190
|
-
]);
|
|
69191
69197
|
const pivotRefreshQueryEnabled = !reportOverride && pendingPivotRefresh && !shouldSkipPivotRefreshForUnchangedPivot && Boolean(sourceReport) && Boolean(client) && Boolean(effectiveReportBuilderState) && Boolean(nextPivot) && sourceReportMatchesEffectiveReportId;
|
|
69192
|
-
const pivotTableDataRefreshQueryEnabled = !reportOverride && Boolean(sourceReport) && Boolean(client) && Boolean(nextPivot) && Boolean(pivotTableDataReportBuilderState) && !pendingPivotRefresh && sourceReportMatchesEffectiveReportId
|
|
69198
|
+
const pivotTableDataRefreshQueryEnabled = !reportOverride && Boolean(sourceReport) && Boolean(client) && Boolean(nextPivot) && Boolean(pivotTableDataReportBuilderState) && !pendingPivotRefresh && sourceReportMatchesEffectiveReportId;
|
|
69193
69199
|
const pivotRefreshQuery = useQuery({
|
|
69194
69200
|
queryKey: createUseFormPivotRefreshQueryKey({
|
|
69195
69201
|
reportId: effectiveReportId,
|
|
@@ -70924,7 +70930,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70924
70930
|
}
|
|
70925
70931
|
if (effectiveNextState.datasources !== void 0) {
|
|
70926
70932
|
const nextIds = effectiveNextState.datasources.map((tableName) => String(tableName ?? "").trim()).filter(Boolean);
|
|
70927
|
-
next.schemaDatasourceIds = nextIds
|
|
70933
|
+
next.schemaDatasourceIds = nextIds;
|
|
70928
70934
|
if (nextIds.length > 0) {
|
|
70929
70935
|
pruneFormStateToExplicitDatasourceTables(next, nextIds, {
|
|
70930
70936
|
sourceReport,
|
|
@@ -70977,6 +70983,15 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70977
70983
|
}
|
|
70978
70984
|
}
|
|
70979
70985
|
}
|
|
70986
|
+
} else {
|
|
70987
|
+
next.queryColumns = [];
|
|
70988
|
+
next.groupRowsBy = void 0;
|
|
70989
|
+
next.groupColumnsBy = void 0;
|
|
70990
|
+
next.aggregationState = [];
|
|
70991
|
+
next.aggregationTablesByIndex = [];
|
|
70992
|
+
next.pivotSort = void 0;
|
|
70993
|
+
next.regularSort = void 0;
|
|
70994
|
+
next.queryFilters = { combinator: "and", rules: [] };
|
|
70980
70995
|
}
|
|
70981
70996
|
}
|
|
70982
70997
|
if (effectiveNextState.columns !== void 0) {
|
|
@@ -70997,6 +71012,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70997
71012
|
if (replacesDatasourceTableScope) {
|
|
70998
71013
|
next.queryColumns = normalizedDisplayColumns;
|
|
70999
71014
|
next.schemaDatasourceIds = [...requestedDisplayTableNames];
|
|
71015
|
+
} else if (effectiveNextState.datasources !== void 0 && normalizedDisplayColumns.length === 0) {
|
|
71016
|
+
next.queryColumns = [];
|
|
71000
71017
|
} else {
|
|
71001
71018
|
next.queryColumns = mergeReportBuilderColumns(
|
|
71002
71019
|
next.queryColumns,
|
|
@@ -71504,6 +71521,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71504
71521
|
reportId: effectiveReportId || void 0,
|
|
71505
71522
|
/* ── Selected value + pick list (same naming pattern throughout) ── */
|
|
71506
71523
|
datasources,
|
|
71524
|
+
datasourcePickerValues,
|
|
71507
71525
|
datasourceOptions,
|
|
71508
71526
|
groupRowsBy,
|
|
71509
71527
|
groupRowsByOptions,
|