@quillsql/react 2.16.68 → 2.16.69
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 +33 -4
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +33 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17269,6 +17269,7 @@ async function generatePivotWithSQL({
|
|
|
17269
17269
|
sort: pivot.sort,
|
|
17270
17270
|
sortDirection: pivot.sortDirection,
|
|
17271
17271
|
sortField: pivot.sortField,
|
|
17272
|
+
sortFieldTable: pivot.sortFieldTable,
|
|
17272
17273
|
sortFieldType: pivot.sortFieldType,
|
|
17273
17274
|
rowLimit: pivot.rowLimit,
|
|
17274
17275
|
dateBucket: resolvedDateBucket
|
|
@@ -59991,12 +59992,13 @@ var QUERY_BUILDER_MULTI_VALUE_OPERATORS = /* @__PURE__ */ new Set(["in", "notin"
|
|
|
59991
59992
|
var TABLE_FORMAT_CACHE_MAX_ENTRIES = 5e3;
|
|
59992
59993
|
var PIVOT_DATE_BUCKET_FORMAT_OPTIONS = ["date"];
|
|
59993
59994
|
var PIVOT_DATE_BUCKET_OPTIONS = [
|
|
59994
|
-
{ label: "
|
|
59995
|
+
{ label: "Dynamic", value: "" },
|
|
59995
59996
|
{ label: "Daily", value: "day" },
|
|
59996
59997
|
{ label: "Weekly", value: "week" },
|
|
59997
59998
|
{ label: "Monthly", value: "month" },
|
|
59998
59999
|
{ label: "Yearly", value: "year" }
|
|
59999
60000
|
];
|
|
60001
|
+
var STANDARD_PIVOT_DATE_BUCKET_OPTIONS = PIVOT_DATE_BUCKET_OPTIONS.slice(1);
|
|
60000
60002
|
var AXIS_FORMAT_OPTIONS = [
|
|
60001
60003
|
{ value: "string", label: "string" },
|
|
60002
60004
|
{ value: "whole_number", label: "whole number" },
|
|
@@ -60474,17 +60476,26 @@ function buildPivotAggregationsWithFieldTables({
|
|
|
60474
60476
|
columnFieldTable
|
|
60475
60477
|
};
|
|
60476
60478
|
}
|
|
60479
|
+
function resolvePivotSortFieldTable(pivot, sortField) {
|
|
60480
|
+
const explicitTable = String(pivot?.sortFieldTable ?? "").trim();
|
|
60481
|
+
if (explicitTable && sortField === pivot?.sortField) return explicitTable;
|
|
60482
|
+
if (sortField === pivot?.rowField) return pivot?.rowFieldTable;
|
|
60483
|
+
if (sortField === pivot?.columnField) return pivot?.columnFieldTable;
|
|
60484
|
+
return void 0;
|
|
60485
|
+
}
|
|
60477
60486
|
function normalizePivotForRefreshComparison(pivot) {
|
|
60478
60487
|
if (pivot == null) return pivot;
|
|
60479
60488
|
const record = pivot;
|
|
60480
60489
|
const {
|
|
60481
60490
|
rowFieldTable: _pivotRowTable,
|
|
60482
60491
|
columnFieldTable: _pivotColumnTable,
|
|
60492
|
+
sortFieldTable: _pivotSortTable,
|
|
60483
60493
|
rowFilter: _rowFilter,
|
|
60484
60494
|
columnFilter: _columnFilter,
|
|
60485
60495
|
aggregations,
|
|
60486
60496
|
...pivotRest
|
|
60487
60497
|
} = record;
|
|
60498
|
+
void _pivotSortTable;
|
|
60488
60499
|
const next = { ...pivotRest };
|
|
60489
60500
|
if (Array.isArray(aggregations)) {
|
|
60490
60501
|
next.aggregations = aggregations.map((entry) => {
|
|
@@ -63286,6 +63297,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63286
63297
|
const { eventTracking } = (0, import_react61.useContext)(EventTrackingContext);
|
|
63287
63298
|
const [draftSessionId, setDraftSessionId] = (0, import_react61.useState)(generateDraftSessionId);
|
|
63288
63299
|
const useInMemoryEngines = options.useInMemoryEngines ?? false;
|
|
63300
|
+
const dateBucketMode = options.dateBucketMode ?? "dynamic";
|
|
63289
63301
|
const restrictFieldOptionsToSelectedDatasources = options.restrictFieldOptionsToSelectedDatasources ?? true;
|
|
63290
63302
|
const reportOverride = options.reportOverride ?? null;
|
|
63291
63303
|
const initialReportBuilderState = options.initialReportBuilderState ?? null;
|
|
@@ -64834,17 +64846,24 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64834
64846
|
rowTableHint,
|
|
64835
64847
|
columnTableHint
|
|
64836
64848
|
});
|
|
64849
|
+
const configuredDateBucket = chartPivotHydratedFromSourceRef.current ? dateBucket : dateBucket ?? priorPivot?.dateBucket;
|
|
64837
64850
|
const built = {
|
|
64838
64851
|
...priorPivot ?? {},
|
|
64839
64852
|
rowField: effectiveRowField,
|
|
64840
64853
|
rowFieldType,
|
|
64841
64854
|
columnField: effectiveColumnField,
|
|
64842
64855
|
columnFieldType,
|
|
64843
|
-
dateBucket:
|
|
64856
|
+
dateBucket: configuredDateBucket,
|
|
64844
64857
|
aggregations,
|
|
64845
64858
|
...rowFieldTable ? { rowFieldTable } : {},
|
|
64846
64859
|
...columnFieldTable ? { columnFieldTable } : {}
|
|
64847
64860
|
};
|
|
64861
|
+
if (dateBucketMode === "standard" && effectiveRowField && isDateType(String(rowFieldType ?? ""))) {
|
|
64862
|
+
built.dateBucket = resolvePivotDateBucket({
|
|
64863
|
+
pivot: built,
|
|
64864
|
+
filters: internalFilters
|
|
64865
|
+
}) ?? "month";
|
|
64866
|
+
}
|
|
64848
64867
|
return built;
|
|
64849
64868
|
}, [
|
|
64850
64869
|
aggregationState,
|
|
@@ -64852,8 +64871,10 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64852
64871
|
appliedAggregationState,
|
|
64853
64872
|
baseReportBuilderTables,
|
|
64854
64873
|
dateBucket,
|
|
64874
|
+
dateBucketMode,
|
|
64855
64875
|
groupColumnsBy,
|
|
64856
64876
|
groupRowsBy,
|
|
64877
|
+
internalFilters,
|
|
64857
64878
|
schemaForReportBuilderState,
|
|
64858
64879
|
sourceReport?.columnInternal,
|
|
64859
64880
|
sourceReport?.columns,
|
|
@@ -65197,6 +65218,10 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65197
65218
|
...pivotState,
|
|
65198
65219
|
sort: Boolean(pivotSort?.sortField),
|
|
65199
65220
|
sortField: pivotSort?.sortField,
|
|
65221
|
+
sortFieldTable: resolvePivotSortFieldTable(
|
|
65222
|
+
pivotState,
|
|
65223
|
+
pivotSort?.sortField
|
|
65224
|
+
),
|
|
65200
65225
|
sortDirection: pivotSort?.sortDirection,
|
|
65201
65226
|
sortFieldType: resolvedSortFieldType,
|
|
65202
65227
|
rowLimit: limit?.value
|
|
@@ -65854,6 +65879,10 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65854
65879
|
...pivotState,
|
|
65855
65880
|
sort: Boolean(pivotSort?.sortField),
|
|
65856
65881
|
sortField: pivotSort?.sortField,
|
|
65882
|
+
sortFieldTable: resolvePivotSortFieldTable(
|
|
65883
|
+
pivotState,
|
|
65884
|
+
pivotSort?.sortField
|
|
65885
|
+
),
|
|
65857
65886
|
sortDirection: pivotSort?.sortDirection,
|
|
65858
65887
|
sortFieldType: resolvedSortFieldType,
|
|
65859
65888
|
rowLimit: limit?.value
|
|
@@ -68156,8 +68185,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68156
68185
|
groupRowsByOptions,
|
|
68157
68186
|
groupColumnsBy,
|
|
68158
68187
|
groupColumnsByOptions,
|
|
68159
|
-
dateBucket,
|
|
68160
|
-
dateBucketOptions: hasDatePivotRow ? PIVOT_DATE_BUCKET_OPTIONS : [],
|
|
68188
|
+
dateBucket: dateBucketMode === "standard" ? pivotState?.dateBucket : dateBucket,
|
|
68189
|
+
dateBucketOptions: hasDatePivotRow ? dateBucketMode === "standard" ? STANDARD_PIVOT_DATE_BUCKET_OPTIONS : PIVOT_DATE_BUCKET_OPTIONS : [],
|
|
68161
68190
|
/** Encoded selection per aggregation slot (`'sum:transactions::amount'`, `'count:transactions'`, `''` = placeholder). Update via `setReport({ aggregations: nextStringArray })`. */
|
|
68162
68191
|
aggregations: aggregationValues,
|
|
68163
68192
|
/** Flat aggregation pick list shared by all slots; always contains every non-empty `aggregations` entry. */
|
package/dist/index.d.cts
CHANGED
|
@@ -558,6 +558,8 @@ interface BasePivot {
|
|
|
558
558
|
sort?: boolean;
|
|
559
559
|
sortDirection?: 'ASC' | 'DESC';
|
|
560
560
|
sortField?: string;
|
|
561
|
+
/** Source table for sortField when it references a pivot dimension. */
|
|
562
|
+
sortFieldTable?: string;
|
|
561
563
|
sortFieldType?: string;
|
|
562
564
|
title?: string;
|
|
563
565
|
triggerButtonText?: string;
|
|
@@ -3053,6 +3055,12 @@ interface UseReportOptions {
|
|
|
3053
3055
|
useInMemoryEngines?: boolean;
|
|
3054
3056
|
reportOverride?: QuillReportInternal | null;
|
|
3055
3057
|
initialReportBuilderState?: ReportBuilderState | null;
|
|
3058
|
+
/**
|
|
3059
|
+
* `dynamic` exposes an empty "Dynamic" selection when the bucket is inferred.
|
|
3060
|
+
* `standard` exposes only concrete buckets and returns the currently resolved
|
|
3061
|
+
* bucket from `useReport().dateBucket`. Defaults to `dynamic`.
|
|
3062
|
+
*/
|
|
3063
|
+
dateBucketMode?: 'dynamic' | 'standard';
|
|
3056
3064
|
/**
|
|
3057
3065
|
* When the report payload has no `dashboardName` and the client has no
|
|
3058
3066
|
* `defaultDashboard`, use this for engine tasks that require a dashboard
|
package/dist/index.d.ts
CHANGED
|
@@ -558,6 +558,8 @@ interface BasePivot {
|
|
|
558
558
|
sort?: boolean;
|
|
559
559
|
sortDirection?: 'ASC' | 'DESC';
|
|
560
560
|
sortField?: string;
|
|
561
|
+
/** Source table for sortField when it references a pivot dimension. */
|
|
562
|
+
sortFieldTable?: string;
|
|
561
563
|
sortFieldType?: string;
|
|
562
564
|
title?: string;
|
|
563
565
|
triggerButtonText?: string;
|
|
@@ -3053,6 +3055,12 @@ interface UseReportOptions {
|
|
|
3053
3055
|
useInMemoryEngines?: boolean;
|
|
3054
3056
|
reportOverride?: QuillReportInternal | null;
|
|
3055
3057
|
initialReportBuilderState?: ReportBuilderState | null;
|
|
3058
|
+
/**
|
|
3059
|
+
* `dynamic` exposes an empty "Dynamic" selection when the bucket is inferred.
|
|
3060
|
+
* `standard` exposes only concrete buckets and returns the currently resolved
|
|
3061
|
+
* bucket from `useReport().dateBucket`. Defaults to `dynamic`.
|
|
3062
|
+
*/
|
|
3063
|
+
dateBucketMode?: 'dynamic' | 'standard';
|
|
3056
3064
|
/**
|
|
3057
3065
|
* When the report payload has no `dashboardName` and the client has no
|
|
3058
3066
|
* `defaultDashboard`, use this for engine tasks that require a dashboard
|
package/dist/index.js
CHANGED
|
@@ -17315,6 +17315,7 @@ async function generatePivotWithSQL({
|
|
|
17315
17315
|
sort: pivot.sort,
|
|
17316
17316
|
sortDirection: pivot.sortDirection,
|
|
17317
17317
|
sortField: pivot.sortField,
|
|
17318
|
+
sortFieldTable: pivot.sortFieldTable,
|
|
17318
17319
|
sortFieldType: pivot.sortFieldType,
|
|
17319
17320
|
rowLimit: pivot.rowLimit,
|
|
17320
17321
|
dateBucket: resolvedDateBucket
|
|
@@ -60203,12 +60204,13 @@ var QUERY_BUILDER_MULTI_VALUE_OPERATORS = /* @__PURE__ */ new Set(["in", "notin"
|
|
|
60203
60204
|
var TABLE_FORMAT_CACHE_MAX_ENTRIES = 5e3;
|
|
60204
60205
|
var PIVOT_DATE_BUCKET_FORMAT_OPTIONS = ["date"];
|
|
60205
60206
|
var PIVOT_DATE_BUCKET_OPTIONS = [
|
|
60206
|
-
{ label: "
|
|
60207
|
+
{ label: "Dynamic", value: "" },
|
|
60207
60208
|
{ label: "Daily", value: "day" },
|
|
60208
60209
|
{ label: "Weekly", value: "week" },
|
|
60209
60210
|
{ label: "Monthly", value: "month" },
|
|
60210
60211
|
{ label: "Yearly", value: "year" }
|
|
60211
60212
|
];
|
|
60213
|
+
var STANDARD_PIVOT_DATE_BUCKET_OPTIONS = PIVOT_DATE_BUCKET_OPTIONS.slice(1);
|
|
60212
60214
|
var AXIS_FORMAT_OPTIONS = [
|
|
60213
60215
|
{ value: "string", label: "string" },
|
|
60214
60216
|
{ value: "whole_number", label: "whole number" },
|
|
@@ -60686,17 +60688,26 @@ function buildPivotAggregationsWithFieldTables({
|
|
|
60686
60688
|
columnFieldTable
|
|
60687
60689
|
};
|
|
60688
60690
|
}
|
|
60691
|
+
function resolvePivotSortFieldTable(pivot, sortField) {
|
|
60692
|
+
const explicitTable = String(pivot?.sortFieldTable ?? "").trim();
|
|
60693
|
+
if (explicitTable && sortField === pivot?.sortField) return explicitTable;
|
|
60694
|
+
if (sortField === pivot?.rowField) return pivot?.rowFieldTable;
|
|
60695
|
+
if (sortField === pivot?.columnField) return pivot?.columnFieldTable;
|
|
60696
|
+
return void 0;
|
|
60697
|
+
}
|
|
60689
60698
|
function normalizePivotForRefreshComparison(pivot) {
|
|
60690
60699
|
if (pivot == null) return pivot;
|
|
60691
60700
|
const record = pivot;
|
|
60692
60701
|
const {
|
|
60693
60702
|
rowFieldTable: _pivotRowTable,
|
|
60694
60703
|
columnFieldTable: _pivotColumnTable,
|
|
60704
|
+
sortFieldTable: _pivotSortTable,
|
|
60695
60705
|
rowFilter: _rowFilter,
|
|
60696
60706
|
columnFilter: _columnFilter,
|
|
60697
60707
|
aggregations,
|
|
60698
60708
|
...pivotRest
|
|
60699
60709
|
} = record;
|
|
60710
|
+
void _pivotSortTable;
|
|
60700
60711
|
const next = { ...pivotRest };
|
|
60701
60712
|
if (Array.isArray(aggregations)) {
|
|
60702
60713
|
next.aggregations = aggregations.map((entry) => {
|
|
@@ -63498,6 +63509,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63498
63509
|
const { eventTracking } = useContext36(EventTrackingContext);
|
|
63499
63510
|
const [draftSessionId, setDraftSessionId] = useState41(generateDraftSessionId);
|
|
63500
63511
|
const useInMemoryEngines = options.useInMemoryEngines ?? false;
|
|
63512
|
+
const dateBucketMode = options.dateBucketMode ?? "dynamic";
|
|
63501
63513
|
const restrictFieldOptionsToSelectedDatasources = options.restrictFieldOptionsToSelectedDatasources ?? true;
|
|
63502
63514
|
const reportOverride = options.reportOverride ?? null;
|
|
63503
63515
|
const initialReportBuilderState = options.initialReportBuilderState ?? null;
|
|
@@ -65046,17 +65058,24 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65046
65058
|
rowTableHint,
|
|
65047
65059
|
columnTableHint
|
|
65048
65060
|
});
|
|
65061
|
+
const configuredDateBucket = chartPivotHydratedFromSourceRef.current ? dateBucket : dateBucket ?? priorPivot?.dateBucket;
|
|
65049
65062
|
const built = {
|
|
65050
65063
|
...priorPivot ?? {},
|
|
65051
65064
|
rowField: effectiveRowField,
|
|
65052
65065
|
rowFieldType,
|
|
65053
65066
|
columnField: effectiveColumnField,
|
|
65054
65067
|
columnFieldType,
|
|
65055
|
-
dateBucket:
|
|
65068
|
+
dateBucket: configuredDateBucket,
|
|
65056
65069
|
aggregations,
|
|
65057
65070
|
...rowFieldTable ? { rowFieldTable } : {},
|
|
65058
65071
|
...columnFieldTable ? { columnFieldTable } : {}
|
|
65059
65072
|
};
|
|
65073
|
+
if (dateBucketMode === "standard" && effectiveRowField && isDateType(String(rowFieldType ?? ""))) {
|
|
65074
|
+
built.dateBucket = resolvePivotDateBucket({
|
|
65075
|
+
pivot: built,
|
|
65076
|
+
filters: internalFilters
|
|
65077
|
+
}) ?? "month";
|
|
65078
|
+
}
|
|
65060
65079
|
return built;
|
|
65061
65080
|
}, [
|
|
65062
65081
|
aggregationState,
|
|
@@ -65064,8 +65083,10 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65064
65083
|
appliedAggregationState,
|
|
65065
65084
|
baseReportBuilderTables,
|
|
65066
65085
|
dateBucket,
|
|
65086
|
+
dateBucketMode,
|
|
65067
65087
|
groupColumnsBy,
|
|
65068
65088
|
groupRowsBy,
|
|
65089
|
+
internalFilters,
|
|
65069
65090
|
schemaForReportBuilderState,
|
|
65070
65091
|
sourceReport?.columnInternal,
|
|
65071
65092
|
sourceReport?.columns,
|
|
@@ -65409,6 +65430,10 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65409
65430
|
...pivotState,
|
|
65410
65431
|
sort: Boolean(pivotSort?.sortField),
|
|
65411
65432
|
sortField: pivotSort?.sortField,
|
|
65433
|
+
sortFieldTable: resolvePivotSortFieldTable(
|
|
65434
|
+
pivotState,
|
|
65435
|
+
pivotSort?.sortField
|
|
65436
|
+
),
|
|
65412
65437
|
sortDirection: pivotSort?.sortDirection,
|
|
65413
65438
|
sortFieldType: resolvedSortFieldType,
|
|
65414
65439
|
rowLimit: limit?.value
|
|
@@ -66066,6 +66091,10 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66066
66091
|
...pivotState,
|
|
66067
66092
|
sort: Boolean(pivotSort?.sortField),
|
|
66068
66093
|
sortField: pivotSort?.sortField,
|
|
66094
|
+
sortFieldTable: resolvePivotSortFieldTable(
|
|
66095
|
+
pivotState,
|
|
66096
|
+
pivotSort?.sortField
|
|
66097
|
+
),
|
|
66069
66098
|
sortDirection: pivotSort?.sortDirection,
|
|
66070
66099
|
sortFieldType: resolvedSortFieldType,
|
|
66071
66100
|
rowLimit: limit?.value
|
|
@@ -68368,8 +68397,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68368
68397
|
groupRowsByOptions,
|
|
68369
68398
|
groupColumnsBy,
|
|
68370
68399
|
groupColumnsByOptions,
|
|
68371
|
-
dateBucket,
|
|
68372
|
-
dateBucketOptions: hasDatePivotRow ? PIVOT_DATE_BUCKET_OPTIONS : [],
|
|
68400
|
+
dateBucket: dateBucketMode === "standard" ? pivotState?.dateBucket : dateBucket,
|
|
68401
|
+
dateBucketOptions: hasDatePivotRow ? dateBucketMode === "standard" ? STANDARD_PIVOT_DATE_BUCKET_OPTIONS : PIVOT_DATE_BUCKET_OPTIONS : [],
|
|
68373
68402
|
/** Encoded selection per aggregation slot (`'sum:transactions::amount'`, `'count:transactions'`, `''` = placeholder). Update via `setReport({ aggregations: nextStringArray })`. */
|
|
68374
68403
|
aggregations: aggregationValues,
|
|
68375
68404
|
/** Flat aggregation pick list shared by all slots; always contains every non-empty `aggregations` entry. */
|