@quillsql/react 2.16.95 → 2.16.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +41 -11
- package/dist/index.js +41 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -65618,8 +65618,7 @@ async function fetchReportBuilderStateByReportId({
|
|
|
65618
65618
|
if (!state || typeof state !== "object") {
|
|
65619
65619
|
return null;
|
|
65620
65620
|
}
|
|
65621
|
-
|
|
65622
|
-
return parsedState;
|
|
65621
|
+
return state;
|
|
65623
65622
|
} catch (error) {
|
|
65624
65623
|
if (error instanceof Error && error.name === "AbortError") {
|
|
65625
65624
|
throw error;
|
|
@@ -65658,10 +65657,11 @@ function applyFetchedReportBuilderState(result, fetchedReportBuilderState) {
|
|
|
65658
65657
|
}).filter(
|
|
65659
65658
|
(table) => Boolean(table)
|
|
65660
65659
|
);
|
|
65660
|
+
const keptExistingRules = existingRules.rules.length > 0;
|
|
65661
65661
|
const mergedState = {
|
|
65662
65662
|
tables: mergedTables,
|
|
65663
65663
|
columns: existingColumns.length > 0 ? existingColumns : fetchedColumns,
|
|
65664
|
-
rules:
|
|
65664
|
+
rules: keptExistingRules ? existingRules : fetchedRules,
|
|
65665
65665
|
pivot: existingState?.pivot ?? fetchedReportBuilderState.pivot ?? null,
|
|
65666
65666
|
sort: existingSort.length > 0 ? existingSort : fetchedSort,
|
|
65667
65667
|
limit: existingState?.limit ?? fetchedReportBuilderState.limit ?? null
|
|
@@ -67899,6 +67899,24 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67899
67899
|
initialDataUpdatedAt: () => findCachedDashboardReportQuery(queryClient, effectiveReportId)?.state.dataUpdatedAt,
|
|
67900
67900
|
staleTime: DASHBOARD_REPORT_STALE_TIME_MS
|
|
67901
67901
|
});
|
|
67902
|
+
const reportBuilderStateQuery = (0, import_react_query3.useQuery)({
|
|
67903
|
+
queryKey: ["useReport", "report-builder-state", effectiveReportId],
|
|
67904
|
+
queryFn: createUseFormQueryFn((signal) => {
|
|
67905
|
+
if (!client) {
|
|
67906
|
+
return Promise.resolve(null);
|
|
67907
|
+
}
|
|
67908
|
+
return fetchReportBuilderStateByReportId({
|
|
67909
|
+
reportId: effectiveReportId,
|
|
67910
|
+
client,
|
|
67911
|
+
getToken,
|
|
67912
|
+
draftSessionId: draftSessionId || void 0,
|
|
67913
|
+
tenants,
|
|
67914
|
+
abortSignal: signal
|
|
67915
|
+
});
|
|
67916
|
+
}),
|
|
67917
|
+
enabled: Boolean(effectiveReportId) && Boolean(client) && !reportOverride,
|
|
67918
|
+
staleTime: 0
|
|
67919
|
+
});
|
|
67902
67920
|
const reportNameQueryReportId = String(effectiveReportId ?? "").trim();
|
|
67903
67921
|
const reportNameQuery = (0, import_react_query3.useQuery)({
|
|
67904
67922
|
queryKey: createUseFormReportNameQueryKey({
|
|
@@ -67929,10 +67947,21 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67929
67947
|
const displayReportName = formReportName !== void 0 ? formReportName : resolvedReportName;
|
|
67930
67948
|
(0, import_react63.useEffect)(() => {
|
|
67931
67949
|
if (reportOverride) return;
|
|
67932
|
-
const report =
|
|
67950
|
+
const report = applyFetchedReportBuilderState(
|
|
67951
|
+
initialLoadQuery.data ?? { report: null },
|
|
67952
|
+
reportBuilderStateQuery.data ?? null
|
|
67953
|
+
).report ?? null;
|
|
67933
67954
|
initializeSchemaScopeForReport(report);
|
|
67934
67955
|
setSourceReport(report);
|
|
67935
|
-
}, [
|
|
67956
|
+
}, [
|
|
67957
|
+
initialLoadQuery.data,
|
|
67958
|
+
initialLoadQuery.fetchStatus,
|
|
67959
|
+
initialLoadQuery.isFetching,
|
|
67960
|
+
initialLoadQuery.isPending,
|
|
67961
|
+
reportBuilderStateQuery.data,
|
|
67962
|
+
reportOverride,
|
|
67963
|
+
effectiveReportId
|
|
67964
|
+
]);
|
|
67936
67965
|
(0, import_react63.useEffect)(() => {
|
|
67937
67966
|
if (!sourceReport) {
|
|
67938
67967
|
return;
|
|
@@ -70712,7 +70741,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70712
70741
|
isPivotTableChart,
|
|
70713
70742
|
tableColumnItems
|
|
70714
70743
|
]);
|
|
70715
|
-
const initialLoadInProgress = !reportOverride && Boolean(effectiveReportId) && (!client || initialLoadQuery.isPending || initialLoadQuery.isFetching);
|
|
70744
|
+
const initialLoadInProgress = !reportOverride && Boolean(effectiveReportId) && (!client || initialLoadQuery.isPending || initialLoadQuery.isFetching || reportBuilderStateQuery.isPending || reportBuilderStateQuery.isFetching);
|
|
70716
70745
|
const filterUniqueValuesLoading = filterUniqueValuesEnabled && (filterUniqueValuesQuery.isPending || filterUniqueValuesQuery.isFetching);
|
|
70717
70746
|
const chartLoading = initialLoadInProgress || pendingPivotRefresh || (Boolean(nextPivot) ? pivotRefreshQuery.isFetching : tableRefreshQuery.isFetching);
|
|
70718
70747
|
const awaitingPivotDetailRows = Boolean(nextPivot || sourceReport?.pivot) && !reportOverride && Boolean(sourceReport) && sourceReportMatchesEffectiveReportId && (!Array.isArray(sourceReport?.rows) || sourceReport.rows.length === 0) && pivotTableDataRefreshQuery.status !== "error";
|
|
@@ -71540,7 +71569,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71540
71569
|
};
|
|
71541
71570
|
const saveChanges = (0, import_react63.useCallback)(
|
|
71542
71571
|
async (overrides) => {
|
|
71543
|
-
if (!client || !sourceReport || !effectiveReportBuilderState)
|
|
71572
|
+
if (!client || !sourceReport || !effectiveReportBuilderState) {
|
|
71573
|
+
return;
|
|
71574
|
+
}
|
|
71544
71575
|
const sourceRest = {
|
|
71545
71576
|
...sourceReport
|
|
71546
71577
|
};
|
|
@@ -72646,10 +72677,9 @@ function useReportFilterDraft(args) {
|
|
|
72646
72677
|
);
|
|
72647
72678
|
return stringField?.name ?? fields[0]?.name ?? "";
|
|
72648
72679
|
}, []);
|
|
72649
|
-
const getDefaultValue = (0, import_react66.useCallback)(
|
|
72650
|
-
|
|
72651
|
-
|
|
72652
|
-
);
|
|
72680
|
+
const getDefaultValue = (0, import_react66.useCallback)((rule) => {
|
|
72681
|
+
return defaultFilterRuleValueForOperator(rule?.operator);
|
|
72682
|
+
}, []);
|
|
72653
72683
|
const filterDraftQueryBuilderProps = (0, import_react66.useMemo)(
|
|
72654
72684
|
() => ({
|
|
72655
72685
|
...queryBuilderProps,
|
package/dist/index.js
CHANGED
|
@@ -65826,8 +65826,7 @@ async function fetchReportBuilderStateByReportId({
|
|
|
65826
65826
|
if (!state || typeof state !== "object") {
|
|
65827
65827
|
return null;
|
|
65828
65828
|
}
|
|
65829
|
-
|
|
65830
|
-
return parsedState;
|
|
65829
|
+
return state;
|
|
65831
65830
|
} catch (error) {
|
|
65832
65831
|
if (error instanceof Error && error.name === "AbortError") {
|
|
65833
65832
|
throw error;
|
|
@@ -65866,10 +65865,11 @@ function applyFetchedReportBuilderState(result, fetchedReportBuilderState) {
|
|
|
65866
65865
|
}).filter(
|
|
65867
65866
|
(table) => Boolean(table)
|
|
65868
65867
|
);
|
|
65868
|
+
const keptExistingRules = existingRules.rules.length > 0;
|
|
65869
65869
|
const mergedState = {
|
|
65870
65870
|
tables: mergedTables,
|
|
65871
65871
|
columns: existingColumns.length > 0 ? existingColumns : fetchedColumns,
|
|
65872
|
-
rules:
|
|
65872
|
+
rules: keptExistingRules ? existingRules : fetchedRules,
|
|
65873
65873
|
pivot: existingState?.pivot ?? fetchedReportBuilderState.pivot ?? null,
|
|
65874
65874
|
sort: existingSort.length > 0 ? existingSort : fetchedSort,
|
|
65875
65875
|
limit: existingState?.limit ?? fetchedReportBuilderState.limit ?? null
|
|
@@ -68107,6 +68107,24 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68107
68107
|
initialDataUpdatedAt: () => findCachedDashboardReportQuery(queryClient, effectiveReportId)?.state.dataUpdatedAt,
|
|
68108
68108
|
staleTime: DASHBOARD_REPORT_STALE_TIME_MS
|
|
68109
68109
|
});
|
|
68110
|
+
const reportBuilderStateQuery = useQuery({
|
|
68111
|
+
queryKey: ["useReport", "report-builder-state", effectiveReportId],
|
|
68112
|
+
queryFn: createUseFormQueryFn((signal) => {
|
|
68113
|
+
if (!client) {
|
|
68114
|
+
return Promise.resolve(null);
|
|
68115
|
+
}
|
|
68116
|
+
return fetchReportBuilderStateByReportId({
|
|
68117
|
+
reportId: effectiveReportId,
|
|
68118
|
+
client,
|
|
68119
|
+
getToken,
|
|
68120
|
+
draftSessionId: draftSessionId || void 0,
|
|
68121
|
+
tenants,
|
|
68122
|
+
abortSignal: signal
|
|
68123
|
+
});
|
|
68124
|
+
}),
|
|
68125
|
+
enabled: Boolean(effectiveReportId) && Boolean(client) && !reportOverride,
|
|
68126
|
+
staleTime: 0
|
|
68127
|
+
});
|
|
68110
68128
|
const reportNameQueryReportId = String(effectiveReportId ?? "").trim();
|
|
68111
68129
|
const reportNameQuery = useQuery({
|
|
68112
68130
|
queryKey: createUseFormReportNameQueryKey({
|
|
@@ -68137,10 +68155,21 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68137
68155
|
const displayReportName = formReportName !== void 0 ? formReportName : resolvedReportName;
|
|
68138
68156
|
useEffect33(() => {
|
|
68139
68157
|
if (reportOverride) return;
|
|
68140
|
-
const report =
|
|
68158
|
+
const report = applyFetchedReportBuilderState(
|
|
68159
|
+
initialLoadQuery.data ?? { report: null },
|
|
68160
|
+
reportBuilderStateQuery.data ?? null
|
|
68161
|
+
).report ?? null;
|
|
68141
68162
|
initializeSchemaScopeForReport(report);
|
|
68142
68163
|
setSourceReport(report);
|
|
68143
|
-
}, [
|
|
68164
|
+
}, [
|
|
68165
|
+
initialLoadQuery.data,
|
|
68166
|
+
initialLoadQuery.fetchStatus,
|
|
68167
|
+
initialLoadQuery.isFetching,
|
|
68168
|
+
initialLoadQuery.isPending,
|
|
68169
|
+
reportBuilderStateQuery.data,
|
|
68170
|
+
reportOverride,
|
|
68171
|
+
effectiveReportId
|
|
68172
|
+
]);
|
|
68144
68173
|
useEffect33(() => {
|
|
68145
68174
|
if (!sourceReport) {
|
|
68146
68175
|
return;
|
|
@@ -70920,7 +70949,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70920
70949
|
isPivotTableChart,
|
|
70921
70950
|
tableColumnItems
|
|
70922
70951
|
]);
|
|
70923
|
-
const initialLoadInProgress = !reportOverride && Boolean(effectiveReportId) && (!client || initialLoadQuery.isPending || initialLoadQuery.isFetching);
|
|
70952
|
+
const initialLoadInProgress = !reportOverride && Boolean(effectiveReportId) && (!client || initialLoadQuery.isPending || initialLoadQuery.isFetching || reportBuilderStateQuery.isPending || reportBuilderStateQuery.isFetching);
|
|
70924
70953
|
const filterUniqueValuesLoading = filterUniqueValuesEnabled && (filterUniqueValuesQuery.isPending || filterUniqueValuesQuery.isFetching);
|
|
70925
70954
|
const chartLoading = initialLoadInProgress || pendingPivotRefresh || (Boolean(nextPivot) ? pivotRefreshQuery.isFetching : tableRefreshQuery.isFetching);
|
|
70926
70955
|
const awaitingPivotDetailRows = Boolean(nextPivot || sourceReport?.pivot) && !reportOverride && Boolean(sourceReport) && sourceReportMatchesEffectiveReportId && (!Array.isArray(sourceReport?.rows) || sourceReport.rows.length === 0) && pivotTableDataRefreshQuery.status !== "error";
|
|
@@ -71748,7 +71777,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71748
71777
|
};
|
|
71749
71778
|
const saveChanges = useCallback5(
|
|
71750
71779
|
async (overrides) => {
|
|
71751
|
-
if (!client || !sourceReport || !effectiveReportBuilderState)
|
|
71780
|
+
if (!client || !sourceReport || !effectiveReportBuilderState) {
|
|
71781
|
+
return;
|
|
71782
|
+
}
|
|
71752
71783
|
const sourceRest = {
|
|
71753
71784
|
...sourceReport
|
|
71754
71785
|
};
|
|
@@ -72854,10 +72885,9 @@ function useReportFilterDraft(args) {
|
|
|
72854
72885
|
);
|
|
72855
72886
|
return stringField?.name ?? fields[0]?.name ?? "";
|
|
72856
72887
|
}, []);
|
|
72857
|
-
const getDefaultValue = useCallback6(
|
|
72858
|
-
|
|
72859
|
-
|
|
72860
|
-
);
|
|
72888
|
+
const getDefaultValue = useCallback6((rule) => {
|
|
72889
|
+
return defaultFilterRuleValueForOperator(rule?.operator);
|
|
72890
|
+
}, []);
|
|
72861
72891
|
const filterDraftQueryBuilderProps = useMemo35(
|
|
72862
72892
|
() => ({
|
|
72863
72893
|
...queryBuilderProps,
|