@quillsql/react 2.16.43 → 2.16.45
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 +484 -34
- package/dist/index.d.cts +112 -6
- package/dist/index.d.ts +112 -6
- package/dist/index.js +483 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15024,6 +15024,9 @@ function resolvePivotDateBucket({
|
|
|
15024
15024
|
if (override) {
|
|
15025
15025
|
return override;
|
|
15026
15026
|
}
|
|
15027
|
+
if (pivot?.dateBucket) {
|
|
15028
|
+
return pivot.dateBucket;
|
|
15029
|
+
}
|
|
15027
15030
|
const inferred = inferDateBucketFromFilters(
|
|
15028
15031
|
pivot ?? {},
|
|
15029
15032
|
filters ?? []
|
|
@@ -19541,6 +19544,8 @@ var init_tableProcessing = __esm({
|
|
|
19541
19544
|
pivot,
|
|
19542
19545
|
getPivotRowCount = true,
|
|
19543
19546
|
comparisonQuery,
|
|
19547
|
+
reportId,
|
|
19548
|
+
dateBucket,
|
|
19544
19549
|
getToken,
|
|
19545
19550
|
eventTracking
|
|
19546
19551
|
}) => {
|
|
@@ -19552,9 +19557,26 @@ var init_tableProcessing = __esm({
|
|
|
19552
19557
|
let referencedTables = void 0;
|
|
19553
19558
|
try {
|
|
19554
19559
|
if (pivot) {
|
|
19560
|
+
const dateFilter = filters?.find(
|
|
19561
|
+
(filter) => filter.filterType === "date_range" || filter.operator === "BETWEEN"
|
|
19562
|
+
);
|
|
19563
|
+
const normalizedDateFilter = dateFilter?.operator === "BETWEEN" ? {
|
|
19564
|
+
...dateFilter,
|
|
19565
|
+
startDate: dateFilter.value?.[0],
|
|
19566
|
+
endDate: dateFilter.value?.[1]
|
|
19567
|
+
} : dateFilter;
|
|
19568
|
+
const resolvedDateBucket = resolvePivotDateBucket({
|
|
19569
|
+
pivot,
|
|
19570
|
+
filters,
|
|
19571
|
+
override: dateBucket
|
|
19572
|
+
});
|
|
19555
19573
|
const pivotData = await generatePivotWithSQL({
|
|
19556
19574
|
pivot,
|
|
19575
|
+
report: reportId ? { id: reportId } : void 0,
|
|
19557
19576
|
client,
|
|
19577
|
+
dateBucket: resolvedDateBucket,
|
|
19578
|
+
dateFilter: normalizedDateFilter,
|
|
19579
|
+
dashboardFilters: filters,
|
|
19558
19580
|
pivotQuery: query,
|
|
19559
19581
|
comparisonPivotQuery: comparisonQuery,
|
|
19560
19582
|
additionalProcessing: processing,
|
|
@@ -19692,6 +19714,7 @@ var init_tableProcessing = __esm({
|
|
|
19692
19714
|
pivotQuery,
|
|
19693
19715
|
comparisonPivotQuery,
|
|
19694
19716
|
getPivotRowCount = true,
|
|
19717
|
+
dateBucket,
|
|
19695
19718
|
getToken,
|
|
19696
19719
|
eventTracking
|
|
19697
19720
|
}) => {
|
|
@@ -19705,6 +19728,8 @@ var init_tableProcessing = __esm({
|
|
|
19705
19728
|
customFields,
|
|
19706
19729
|
filters,
|
|
19707
19730
|
pivot,
|
|
19731
|
+
reportId,
|
|
19732
|
+
dateBucket,
|
|
19708
19733
|
getPivotRowCount,
|
|
19709
19734
|
getToken,
|
|
19710
19735
|
eventTracking
|
|
@@ -21267,6 +21292,7 @@ async function cleanDashboardItem({
|
|
|
21267
21292
|
dateField: item.dateField,
|
|
21268
21293
|
pivot: pivotError ? void 0 : item.pivot ? {
|
|
21269
21294
|
...item.pivot,
|
|
21295
|
+
dateBucket: dateBucket ?? item.pivot.dateBucket,
|
|
21270
21296
|
aggregations: item.pivot.aggregations ?? [
|
|
21271
21297
|
{
|
|
21272
21298
|
valueField: item.pivot.valueField,
|
|
@@ -21693,7 +21719,8 @@ function coalescePivotsForPivotTemplateMetadata(hookPivot, rbsPivot) {
|
|
|
21693
21719
|
columnFieldType: hookPivot.columnFieldType ?? rbsPivot.columnFieldType,
|
|
21694
21720
|
rowFieldTable: rowField ? hookPivot.rowFieldTable ?? rbsPivot.rowFieldTable : void 0,
|
|
21695
21721
|
columnFieldTable: columnField ? hookPivot.columnFieldTable ?? rbsPivot.columnFieldTable : void 0,
|
|
21696
|
-
aggregations: aggregations ?? hookPivot.aggregations ?? rbsPivot.aggregations
|
|
21722
|
+
aggregations: aggregations ?? hookPivot.aggregations ?? rbsPivot.aggregations,
|
|
21723
|
+
dateBucket: hookPivot.dateBucket ?? rbsPivot.dateBucket
|
|
21697
21724
|
};
|
|
21698
21725
|
}
|
|
21699
21726
|
function shapePivotForPivotTemplateMetadata(pivot) {
|
|
@@ -21781,6 +21808,7 @@ function createPivotTemplateMetadata({
|
|
|
21781
21808
|
}) {
|
|
21782
21809
|
const { normalizedPivot, normalizedReportBuilderState } = preparePivotLayersForPivotTemplate(pivot, reportBuilderState);
|
|
21783
21810
|
const normalizedAdditionalProcessing = normalizeLegacyAdditionalProcessingSort(additionalProcessing);
|
|
21811
|
+
const resolvedDateBucket = normalizedPivot?.dateBucket ?? normalizedReportBuilderState?.pivot?.dateBucket;
|
|
21784
21812
|
return {
|
|
21785
21813
|
reportId,
|
|
21786
21814
|
dashboardItemId: reportId,
|
|
@@ -21794,7 +21822,8 @@ function createPivotTemplateMetadata({
|
|
|
21794
21822
|
flags,
|
|
21795
21823
|
overwriteCache,
|
|
21796
21824
|
pivot: normalizedPivot ?? void 0,
|
|
21797
|
-
reportBuilderState: normalizedReportBuilderState ?? void 0
|
|
21825
|
+
reportBuilderState: normalizedReportBuilderState ?? void 0,
|
|
21826
|
+
...resolvedDateBucket ? { dateBucket: resolvedDateBucket } : {}
|
|
21798
21827
|
};
|
|
21799
21828
|
}
|
|
21800
21829
|
async function requestPivotTemplateTask({
|
|
@@ -22158,6 +22187,11 @@ async function fetchReport({
|
|
|
22158
22187
|
pivotForRequest = prepared.normalizedPivot ?? void 0;
|
|
22159
22188
|
reportBuilderStateForRequest = prepared.normalizedReportBuilderState;
|
|
22160
22189
|
}
|
|
22190
|
+
const resolvedDateBucket = usePivotTask ? resolvePivotDateBucket({
|
|
22191
|
+
pivot: pivotForRequest ?? void 0,
|
|
22192
|
+
filters,
|
|
22193
|
+
override: dateBucket
|
|
22194
|
+
}) : void 0;
|
|
22161
22195
|
const fetchResp = await quillFetch({
|
|
22162
22196
|
client,
|
|
22163
22197
|
task,
|
|
@@ -22177,7 +22211,8 @@ async function fetchReport({
|
|
|
22177
22211
|
flags,
|
|
22178
22212
|
overwriteCache,
|
|
22179
22213
|
pivot: pivotForRequest,
|
|
22180
|
-
reportBuilderState: reportBuilderStateForRequest
|
|
22214
|
+
reportBuilderState: reportBuilderStateForRequest,
|
|
22215
|
+
...resolvedDateBucket ? { dateBucket: resolvedDateBucket } : {}
|
|
22181
22216
|
},
|
|
22182
22217
|
abortSignal,
|
|
22183
22218
|
getToken
|
|
@@ -32046,6 +32081,10 @@ function QuillTable({
|
|
|
32046
32081
|
downloadCSV: downloadCSV2,
|
|
32047
32082
|
onPageChange,
|
|
32048
32083
|
onSortChange,
|
|
32084
|
+
manualPagination = false,
|
|
32085
|
+
pageCount,
|
|
32086
|
+
canNextPage,
|
|
32087
|
+
canPreviousPage,
|
|
32049
32088
|
hideLabels,
|
|
32050
32089
|
disableSort,
|
|
32051
32090
|
headerBackgroundColor,
|
|
@@ -32064,10 +32103,19 @@ function QuillTable({
|
|
|
32064
32103
|
setSortDirection(sort?.direction || "desc");
|
|
32065
32104
|
}, [sort]);
|
|
32066
32105
|
const holdFullPageLoader = rows?.length === 0 && isLoading;
|
|
32106
|
+
const pageCountUnknown = manualPagination && pageCount === -1;
|
|
32067
32107
|
const { activeRows, maxPage } = useMemo4(() => {
|
|
32068
32108
|
const start = currentPage * rowsPerPage;
|
|
32069
32109
|
const end = (currentPage + 1) * rowsPerPage;
|
|
32070
32110
|
const rowList = rows ?? [];
|
|
32111
|
+
if (manualPagination) {
|
|
32112
|
+
const total = rowCount ?? rowList.length;
|
|
32113
|
+
const resolvedPageCount = pageCount !== void 0 && pageCount >= 0 ? pageCount : total > 0 ? Math.ceil(total / rowsPerPage) : rowList.length > 0 ? 1 : 0;
|
|
32114
|
+
return {
|
|
32115
|
+
maxPage: Math.max(resolvedPageCount, 1),
|
|
32116
|
+
activeRows: rowList
|
|
32117
|
+
};
|
|
32118
|
+
}
|
|
32071
32119
|
if (rowCount && onSortChange && rowCount !== rowList.length) {
|
|
32072
32120
|
return {
|
|
32073
32121
|
maxPage: Math.ceil(rowCount / rowsPerPage),
|
|
@@ -32087,6 +32135,8 @@ function QuillTable({
|
|
|
32087
32135
|
};
|
|
32088
32136
|
}, [
|
|
32089
32137
|
currentPage,
|
|
32138
|
+
manualPagination,
|
|
32139
|
+
pageCount,
|
|
32090
32140
|
rows,
|
|
32091
32141
|
rowsPerPage,
|
|
32092
32142
|
rowCount,
|
|
@@ -32096,21 +32146,30 @@ function QuillTable({
|
|
|
32096
32146
|
overrideInMemortSort
|
|
32097
32147
|
]);
|
|
32098
32148
|
useEffect8(() => {
|
|
32149
|
+
if (manualPagination) {
|
|
32150
|
+
return;
|
|
32151
|
+
}
|
|
32099
32152
|
if (currentPage > 0 && rows.length <= currentPage * rowsPerPage) {
|
|
32100
32153
|
onPageChange?.(0);
|
|
32101
32154
|
}
|
|
32102
|
-
}, [rows, currentPage, rowsPerPage, onPageChange]);
|
|
32155
|
+
}, [manualPagination, rows, currentPage, rowsPerPage, onPageChange]);
|
|
32103
32156
|
const increasePage = () => {
|
|
32104
|
-
if (
|
|
32157
|
+
if (canNextPage === false) {
|
|
32105
32158
|
return;
|
|
32106
32159
|
}
|
|
32107
|
-
|
|
32160
|
+
if (canNextPage !== true && !pageCountUnknown && !rowCountIsLoading && currentPage + 1 >= maxPage) {
|
|
32161
|
+
return;
|
|
32162
|
+
}
|
|
32163
|
+
onPageChange?.(currentPage + 1);
|
|
32108
32164
|
};
|
|
32109
32165
|
const decreasePage = () => {
|
|
32166
|
+
if (canPreviousPage === false) {
|
|
32167
|
+
return;
|
|
32168
|
+
}
|
|
32110
32169
|
if (currentPage === 0) {
|
|
32111
32170
|
return;
|
|
32112
32171
|
}
|
|
32113
|
-
onPageChange
|
|
32172
|
+
onPageChange?.(currentPage - 1);
|
|
32114
32173
|
};
|
|
32115
32174
|
const toggleSort = (column) => {
|
|
32116
32175
|
if (disableSort) {
|
|
@@ -32492,7 +32551,7 @@ function QuillTable({
|
|
|
32492
32551
|
children: [
|
|
32493
32552
|
currentPage + 1,
|
|
32494
32553
|
" of ",
|
|
32495
|
-
rowCountIsLoading && maxPage > 1 ? "many" : maxPage
|
|
32554
|
+
pageCountUnknown || rowCountIsLoading && maxPage > 1 ? "many" : maxPage
|
|
32496
32555
|
]
|
|
32497
32556
|
}
|
|
32498
32557
|
),
|
|
@@ -37243,6 +37302,7 @@ function DataLoader({
|
|
|
37243
37302
|
pivot: chartReport.pivot || item.pivot,
|
|
37244
37303
|
pivotQuery,
|
|
37245
37304
|
comparisonPivotQuery,
|
|
37305
|
+
dateBucket: chartReport.pivot?.dateBucket ?? item.pivot?.dateBucket,
|
|
37246
37306
|
getPivotRowCount: false,
|
|
37247
37307
|
getToken,
|
|
37248
37308
|
eventTracking
|
|
@@ -44284,8 +44344,10 @@ var Table = ({
|
|
|
44284
44344
|
clientLoading,
|
|
44285
44345
|
!reports[props.reportId ?? ""]
|
|
44286
44346
|
]);
|
|
44287
|
-
const [
|
|
44347
|
+
const [internalPage, setInternalPage] = useState27(0);
|
|
44288
44348
|
if ("rows" in data && "columns" in data) {
|
|
44349
|
+
const currentPage = data.currentPage ?? internalPage;
|
|
44350
|
+
const onPageChange = data.onPageChange ?? setInternalPage;
|
|
44289
44351
|
return /* @__PURE__ */ jsx63(
|
|
44290
44352
|
QuillTable,
|
|
44291
44353
|
{
|
|
@@ -44302,8 +44364,16 @@ var Table = ({
|
|
|
44302
44364
|
LoadingComponent: data.LoadingComponent,
|
|
44303
44365
|
isLoading: data.isLoading || loading,
|
|
44304
44366
|
downloadCSV: data.downloadCSV,
|
|
44305
|
-
currentPage
|
|
44306
|
-
|
|
44367
|
+
currentPage,
|
|
44368
|
+
rowsPerPage: data.rowsPerPage,
|
|
44369
|
+
rowCount: data.rowCount,
|
|
44370
|
+
rowCountIsLoading: data.rowCountIsLoading,
|
|
44371
|
+
onPageChange,
|
|
44372
|
+
manualPagination: data.manualPagination,
|
|
44373
|
+
pageCount: data.pageCount,
|
|
44374
|
+
canNextPage: data.canNextPage,
|
|
44375
|
+
canPreviousPage: data.canPreviousPage,
|
|
44376
|
+
disableSort: data.disableSort
|
|
44307
44377
|
}
|
|
44308
44378
|
);
|
|
44309
44379
|
}
|
|
@@ -44338,7 +44408,7 @@ var Table = ({
|
|
|
44338
44408
|
error,
|
|
44339
44409
|
rowCount: rowCount ?? data2?.rowCount ?? data2?.rows?.length ?? 0,
|
|
44340
44410
|
rowCountIsLoading,
|
|
44341
|
-
onPageChange: (
|
|
44411
|
+
onPageChange: (page) => onPageChange(page),
|
|
44342
44412
|
onSortChange: (sort) => onSortChange(sort),
|
|
44343
44413
|
hideName: true
|
|
44344
44414
|
}
|
|
@@ -58490,7 +58560,7 @@ import {
|
|
|
58490
58560
|
useRef as useRef25,
|
|
58491
58561
|
useState as useState42
|
|
58492
58562
|
} from "react";
|
|
58493
|
-
import { useQuery } from "@tanstack/react-query";
|
|
58563
|
+
import { keepPreviousData, useQuery } from "@tanstack/react-query";
|
|
58494
58564
|
init_util();
|
|
58495
58565
|
init_columnType();
|
|
58496
58566
|
init_columnProcessing();
|
|
@@ -59830,6 +59900,19 @@ function createUseFormPivotTableDataRefreshQueryKey(input) {
|
|
|
59830
59900
|
input.clientHash
|
|
59831
59901
|
];
|
|
59832
59902
|
}
|
|
59903
|
+
function createUseFormTablePageQueryKey(input) {
|
|
59904
|
+
return [
|
|
59905
|
+
"useReport",
|
|
59906
|
+
"table-page",
|
|
59907
|
+
input.reportId,
|
|
59908
|
+
input.pageIndex,
|
|
59909
|
+
input.pageSize,
|
|
59910
|
+
input.sortHash,
|
|
59911
|
+
input.reportBuilderStateHash,
|
|
59912
|
+
input.tenantHash,
|
|
59913
|
+
input.clientHash
|
|
59914
|
+
];
|
|
59915
|
+
}
|
|
59833
59916
|
function createUseFormReportNameQueryKey(input) {
|
|
59834
59917
|
return [
|
|
59835
59918
|
"useReport",
|
|
@@ -59842,6 +59925,51 @@ function createUseFormQueryFn(loader) {
|
|
|
59842
59925
|
return async () => loader();
|
|
59843
59926
|
}
|
|
59844
59927
|
|
|
59928
|
+
// src/hooks/useForm.pagination.ts
|
|
59929
|
+
var DEFAULT_PAGE_INDEX = 0;
|
|
59930
|
+
var DEFAULT_PAGE_SIZE = 10;
|
|
59931
|
+
var DEFAULT_USE_REPORT_ROWS_PER_REQUEST = DEFAULT_PAGE_SIZE * 10;
|
|
59932
|
+
function getDefaultPaginationState() {
|
|
59933
|
+
return { pageIndex: DEFAULT_PAGE_INDEX, pageSize: DEFAULT_PAGE_SIZE };
|
|
59934
|
+
}
|
|
59935
|
+
function functionalUpdate(updater, input) {
|
|
59936
|
+
return typeof updater === "function" ? updater(input) : updater;
|
|
59937
|
+
}
|
|
59938
|
+
function clampPageIndex(pageIndex, pageCount) {
|
|
59939
|
+
const maxPageIndex = pageCount === -1 ? Number.MAX_SAFE_INTEGER : Math.max(0, pageCount - 1);
|
|
59940
|
+
return Math.max(0, Math.min(pageIndex, maxPageIndex));
|
|
59941
|
+
}
|
|
59942
|
+
function paginationStateAfterPageSizeChange(old, nextPageSizeRaw) {
|
|
59943
|
+
const pageSize = Math.max(1, nextPageSizeRaw);
|
|
59944
|
+
const topRowIndex = old.pageSize * old.pageIndex;
|
|
59945
|
+
const pageIndex = Math.floor(topRowIndex / pageSize);
|
|
59946
|
+
return { pageIndex, pageSize };
|
|
59947
|
+
}
|
|
59948
|
+
function getPageCountFromRowCount(rowCount, pageSize) {
|
|
59949
|
+
if (rowCount === void 0) {
|
|
59950
|
+
return -1;
|
|
59951
|
+
}
|
|
59952
|
+
return Math.ceil(Math.max(0, rowCount) / Math.max(1, pageSize));
|
|
59953
|
+
}
|
|
59954
|
+
function getCanPreviousPageFromState(pageIndex) {
|
|
59955
|
+
return pageIndex > 0;
|
|
59956
|
+
}
|
|
59957
|
+
function getCanNextPageFromState(pageIndex, pageCount) {
|
|
59958
|
+
if (pageCount === -1) {
|
|
59959
|
+
return true;
|
|
59960
|
+
}
|
|
59961
|
+
if (pageCount === 0) {
|
|
59962
|
+
return false;
|
|
59963
|
+
}
|
|
59964
|
+
return pageIndex < pageCount - 1;
|
|
59965
|
+
}
|
|
59966
|
+
function getPageOptionsFromPageCount(pageCount) {
|
|
59967
|
+
if (!pageCount || pageCount <= 0) {
|
|
59968
|
+
return [];
|
|
59969
|
+
}
|
|
59970
|
+
return Array.from({ length: pageCount }, (_, index) => index);
|
|
59971
|
+
}
|
|
59972
|
+
|
|
59845
59973
|
// src/hooks/useForm.tsx
|
|
59846
59974
|
var INTERNAL_PIVOT_ROW_FIELDS = /* @__PURE__ */ new Set(["__quillRawDate"]);
|
|
59847
59975
|
var LEGACY_SINGLE_Y_AXIS_COLUMN_PIVOT_REPORT_IDS = /* @__PURE__ */ new Set([
|
|
@@ -60737,6 +60865,17 @@ function chartDetailRowsMissingPivotRowBucket(chart) {
|
|
|
60737
60865
|
const v = first[rowField];
|
|
60738
60866
|
return v === void 0 || v === null;
|
|
60739
60867
|
}
|
|
60868
|
+
function shouldUsePivotRowFieldAsXAxis(chartType, pivotRowField, rowColumnFormat) {
|
|
60869
|
+
const rowField = String(pivotRowField ?? "").trim();
|
|
60870
|
+
if (!rowField) return false;
|
|
60871
|
+
const isMetricOrGauge = ["metric", "gauge"].includes(
|
|
60872
|
+
String(chartType ?? "").toLowerCase()
|
|
60873
|
+
);
|
|
60874
|
+
if (isMetricOrGauge && !NUMBER_FORMAT_TYPES.includes(String(rowColumnFormat ?? "").trim())) {
|
|
60875
|
+
return false;
|
|
60876
|
+
}
|
|
60877
|
+
return true;
|
|
60878
|
+
}
|
|
60740
60879
|
function normalizePivotChartForDisplay(chart) {
|
|
60741
60880
|
const swapPivotRowsForChartRows = Boolean(chart?.pivot) && Array.isArray(chart?.pivotRows) && chart.pivotRows.length > 0;
|
|
60742
60881
|
const syntheticAggregationOnlyRows = chart && !swapPivotRowsForChartRows ? buildSyntheticAggregationOnlyDisplayRows(chart) : null;
|
|
@@ -60765,8 +60904,19 @@ function normalizePivotChartForDisplay(chart) {
|
|
|
60765
60904
|
stillUsingDetailRows: Boolean(config.pivot) && !swapPivotRowsForChartRows && Array.isArray(config.rows) && config.rows.length > 0
|
|
60766
60905
|
});
|
|
60767
60906
|
if (!config.pivot) return config;
|
|
60768
|
-
const
|
|
60907
|
+
const pivotRowFieldEarly = String(config.pivot?.rowField ?? "").trim();
|
|
60908
|
+
const rowColumn = (config.pivotColumns ?? config.columns ?? []).find(
|
|
60909
|
+
(col) => String(col.field ?? "").trim() === pivotRowFieldEarly
|
|
60910
|
+
);
|
|
60911
|
+
const resolvedXAxisField = shouldUsePivotRowFieldAsXAxis(
|
|
60912
|
+
config.chartType,
|
|
60913
|
+
pivotRowFieldEarly,
|
|
60914
|
+
String(rowColumn?.format ?? "")
|
|
60915
|
+
) ? pivotRowFieldEarly : config.xAxisField;
|
|
60769
60916
|
const withResolvedXAxis = resolvedXAxisField && resolvedXAxisField !== config.xAxisField ? { ...config, xAxisField: resolvedXAxisField } : config;
|
|
60917
|
+
const isMetricOrGauge = ["metric", "gauge"].includes(
|
|
60918
|
+
String(withResolvedXAxis.chartType ?? "").toLowerCase()
|
|
60919
|
+
);
|
|
60770
60920
|
const aggregations = getPivotAggregations(withResolvedXAxis);
|
|
60771
60921
|
const hasMultipleAggregations = aggregations.length > 1;
|
|
60772
60922
|
const yAxisFallbackFormat = withResolvedXAxis.yAxisFields?.[0]?.format ?? withResolvedXAxis.xAxisFormat ?? "whole_number";
|
|
@@ -60879,7 +61029,7 @@ function normalizePivotChartForDisplay(chart) {
|
|
|
60879
61029
|
const normalizedPivotColumns = pivotColumnFields.length > 0 ? pivotColumnFields.map((field) => {
|
|
60880
61030
|
const knownColumn = knownColumnsByField.get(field);
|
|
60881
61031
|
const yAxis = yAxisFields.find((axis) => axis.field === field);
|
|
60882
|
-
const format9 = yAxis?.format ?? knownColumn?.format ?? (field === withResolvedXAxis.pivot?.rowField ? withResolvedXAxis.xAxisFormat ?? "string" : yAxisFallbackFormat);
|
|
61032
|
+
const format9 = yAxis?.format ?? knownColumn?.format ?? (field === withResolvedXAxis.pivot?.rowField ? isMetricOrGauge ? "string" : withResolvedXAxis.xAxisFormat ?? "string" : yAxisFallbackFormat);
|
|
60883
61033
|
return {
|
|
60884
61034
|
field,
|
|
60885
61035
|
label: yAxis?.label ?? knownColumn?.label ?? field,
|
|
@@ -60887,9 +61037,10 @@ function normalizePivotChartForDisplay(chart) {
|
|
|
60887
61037
|
};
|
|
60888
61038
|
}) : withResolvedXAxis.columns ?? [];
|
|
60889
61039
|
const isPivotTableChart = String(withResolvedXAxis.chartType ?? "").toLowerCase() === "table" && Boolean(withResolvedXAxis.pivot);
|
|
61040
|
+
const pivotTableSlotColumns = isPivotTableChart && Array.isArray(withResolvedXAxis.pivotColumns) && withResolvedXAxis.pivotColumns.length > 0 ? withResolvedXAxis.pivotColumns : withResolvedXAxis.columns;
|
|
60890
61041
|
const pivotTableDisplayColumns = isPivotTableChart && pivotColumnFields.length > 0 ? normalizedPivotColumns.map((col) => {
|
|
60891
61042
|
const slotCol = getPivotTableSlotReportColumn(
|
|
60892
|
-
|
|
61043
|
+
pivotTableSlotColumns,
|
|
60893
61044
|
aggregations,
|
|
60894
61045
|
withResolvedXAxis.pivot?.rowField,
|
|
60895
61046
|
col.field
|
|
@@ -60904,9 +61055,6 @@ function normalizePivotChartForDisplay(chart) {
|
|
|
60904
61055
|
}
|
|
60905
61056
|
return next;
|
|
60906
61057
|
}) : normalizedPivotColumns;
|
|
60907
|
-
const isMetricOrGauge = ["metric", "gauge"].includes(
|
|
60908
|
-
String(withResolvedXAxis.chartType ?? "").toLowerCase()
|
|
60909
|
-
);
|
|
60910
61058
|
const hasXAxisValueInPivotRows = Boolean(firstPivotRow) && Boolean(withResolvedXAxis.xAxisField) && Object.prototype.hasOwnProperty.call(
|
|
60911
61059
|
firstPivotRow,
|
|
60912
61060
|
String(withResolvedXAxis.xAxisField)
|
|
@@ -62376,7 +62524,12 @@ async function loadViaInMemoryEngines({
|
|
|
62376
62524
|
draftSessionId
|
|
62377
62525
|
}) {
|
|
62378
62526
|
const requestedTask = allowReportTaskBootstrap ? "report" : "item";
|
|
62379
|
-
const additionalProcessing = allowReportTaskBootstrap ? {
|
|
62527
|
+
const additionalProcessing = allowReportTaskBootstrap ? {
|
|
62528
|
+
page: {
|
|
62529
|
+
...DEFAULT_PAGINATION,
|
|
62530
|
+
rowsPerRequest: DEFAULT_USE_REPORT_ROWS_PER_REQUEST
|
|
62531
|
+
}
|
|
62532
|
+
} : {};
|
|
62380
62533
|
const { report, error } = await fetchReport({
|
|
62381
62534
|
reportId,
|
|
62382
62535
|
client,
|
|
@@ -62800,7 +62953,9 @@ async function loadViaReportBuilderState({
|
|
|
62800
62953
|
customFields,
|
|
62801
62954
|
dashboardName,
|
|
62802
62955
|
report,
|
|
62803
|
-
draftSessionId
|
|
62956
|
+
draftSessionId,
|
|
62957
|
+
pagination,
|
|
62958
|
+
paginationSort
|
|
62804
62959
|
}) {
|
|
62805
62960
|
const baseReport = {
|
|
62806
62961
|
...EMPTY_INTERNAL_REPORT,
|
|
@@ -62821,8 +62976,18 @@ async function loadViaReportBuilderState({
|
|
|
62821
62976
|
// refresh queries are not blocked on `report-builder-unique-values`.
|
|
62822
62977
|
skipUniqueValues: true,
|
|
62823
62978
|
previousRelevant: previousRelevantWhenSkippingInlineUniqueFetch(report),
|
|
62824
|
-
processing: {
|
|
62825
|
-
page: {
|
|
62979
|
+
processing: pagination ? {
|
|
62980
|
+
page: {
|
|
62981
|
+
page: pagination.pageIndex,
|
|
62982
|
+
rowsPerPage: pagination.pageSize,
|
|
62983
|
+
rowsPerRequest: pagination.pageSize
|
|
62984
|
+
},
|
|
62985
|
+
...paginationSort?.field ? { sort: paginationSort } : {}
|
|
62986
|
+
} : {
|
|
62987
|
+
page: {
|
|
62988
|
+
...DEFAULT_PAGINATION,
|
|
62989
|
+
rowsPerRequest: DEFAULT_USE_REPORT_ROWS_PER_REQUEST
|
|
62990
|
+
}
|
|
62826
62991
|
},
|
|
62827
62992
|
dashboardName,
|
|
62828
62993
|
getToken,
|
|
@@ -63019,6 +63184,98 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63019
63184
|
const destinationDashboardName = String(
|
|
63020
63185
|
options.destinationDashboardName ?? ""
|
|
63021
63186
|
).trim();
|
|
63187
|
+
const controlledPagination = options.state?.pagination;
|
|
63188
|
+
const initialPaginationRef = useRef25({
|
|
63189
|
+
...getDefaultPaginationState(),
|
|
63190
|
+
...options.initialState?.pagination ?? {}
|
|
63191
|
+
});
|
|
63192
|
+
const [internalPagination, setInternalPagination] = useState42(
|
|
63193
|
+
initialPaginationRef.current
|
|
63194
|
+
);
|
|
63195
|
+
const [paginationInteracted, setPaginationInteracted] = useState42(
|
|
63196
|
+
() => Boolean(
|
|
63197
|
+
options.state?.pagination || options.initialState?.pagination || options.onPaginationChange
|
|
63198
|
+
)
|
|
63199
|
+
);
|
|
63200
|
+
const pagination = controlledPagination ?? internalPagination;
|
|
63201
|
+
const paginationActive = paginationInteracted || Boolean(controlledPagination);
|
|
63202
|
+
const paginationRef = useRef25(pagination);
|
|
63203
|
+
paginationRef.current = pagination;
|
|
63204
|
+
const onPaginationChangeRef = useRef25(options.onPaginationChange);
|
|
63205
|
+
onPaginationChangeRef.current = options.onPaginationChange;
|
|
63206
|
+
const controlledPaginationRef = useRef25(Boolean(controlledPagination));
|
|
63207
|
+
controlledPaginationRef.current = Boolean(controlledPagination);
|
|
63208
|
+
const autoResetPageIndexRef = useRef25(true);
|
|
63209
|
+
autoResetPageIndexRef.current = options.autoResetPageIndex ?? true;
|
|
63210
|
+
const paginationPageCountRef = useRef25(-1);
|
|
63211
|
+
const applyPaginationUpdate = useCallback6(
|
|
63212
|
+
(updater, { activate = true } = {}) => {
|
|
63213
|
+
if (activate) {
|
|
63214
|
+
setPaginationInteracted(true);
|
|
63215
|
+
}
|
|
63216
|
+
onPaginationChangeRef.current?.(updater);
|
|
63217
|
+
if (!controlledPaginationRef.current) {
|
|
63218
|
+
setInternalPagination((old) => functionalUpdate(updater, old));
|
|
63219
|
+
}
|
|
63220
|
+
},
|
|
63221
|
+
[]
|
|
63222
|
+
);
|
|
63223
|
+
const setPagination = useCallback6(
|
|
63224
|
+
(updater) => applyPaginationUpdate(updater),
|
|
63225
|
+
[applyPaginationUpdate]
|
|
63226
|
+
);
|
|
63227
|
+
const setPageIndex = useCallback6(
|
|
63228
|
+
(updater) => applyPaginationUpdate((old) => ({
|
|
63229
|
+
...old,
|
|
63230
|
+
pageIndex: clampPageIndex(
|
|
63231
|
+
functionalUpdate(updater, old.pageIndex),
|
|
63232
|
+
paginationPageCountRef.current
|
|
63233
|
+
)
|
|
63234
|
+
})),
|
|
63235
|
+
[applyPaginationUpdate]
|
|
63236
|
+
);
|
|
63237
|
+
const setPageSize = useCallback6(
|
|
63238
|
+
(updater) => applyPaginationUpdate(
|
|
63239
|
+
(old) => paginationStateAfterPageSizeChange(
|
|
63240
|
+
old,
|
|
63241
|
+
functionalUpdate(updater, old.pageSize)
|
|
63242
|
+
)
|
|
63243
|
+
),
|
|
63244
|
+
[applyPaginationUpdate]
|
|
63245
|
+
);
|
|
63246
|
+
const resetPagination = useCallback6(
|
|
63247
|
+
(defaultState) => applyPaginationUpdate(
|
|
63248
|
+
defaultState ? getDefaultPaginationState() : initialPaginationRef.current
|
|
63249
|
+
),
|
|
63250
|
+
[applyPaginationUpdate]
|
|
63251
|
+
);
|
|
63252
|
+
const resetPageIndex = useCallback6(
|
|
63253
|
+
(defaultState) => {
|
|
63254
|
+
const target = defaultState ? 0 : initialPaginationRef.current.pageIndex;
|
|
63255
|
+
setPageIndex(target);
|
|
63256
|
+
},
|
|
63257
|
+
[setPageIndex]
|
|
63258
|
+
);
|
|
63259
|
+
const resetPageSize = useCallback6(
|
|
63260
|
+
(defaultState) => {
|
|
63261
|
+
const target = defaultState ? getDefaultPaginationState().pageSize : initialPaginationRef.current.pageSize;
|
|
63262
|
+
setPageSize(target);
|
|
63263
|
+
},
|
|
63264
|
+
[setPageSize]
|
|
63265
|
+
);
|
|
63266
|
+
const nextPage = useCallback6(
|
|
63267
|
+
() => setPageIndex((old) => old + 1),
|
|
63268
|
+
[setPageIndex]
|
|
63269
|
+
);
|
|
63270
|
+
const previousPage = useCallback6(
|
|
63271
|
+
() => setPageIndex((old) => old - 1),
|
|
63272
|
+
[setPageIndex]
|
|
63273
|
+
);
|
|
63274
|
+
const firstPage = useCallback6(() => setPageIndex(0), [setPageIndex]);
|
|
63275
|
+
const lastPage = useCallback6(
|
|
63276
|
+
() => setPageIndex(paginationPageCountRef.current - 1),
|
|
63277
|
+
[setPageIndex]
|
|
63278
|
+
);
|
|
63022
63279
|
const chartPivotHydratedFromSourceRef = useRef25(false);
|
|
63023
63280
|
const lastPivotHydrateCompletedSourceIdRef = useRef25(null);
|
|
63024
63281
|
const groupRowsBySetViaSetReportRef = useRef25(false);
|
|
@@ -64800,7 +65057,10 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64800
65057
|
direction: regularSort.sortDirection
|
|
64801
65058
|
}
|
|
64802
65059
|
] : [],
|
|
64803
|
-
limit
|
|
65060
|
+
// The user's limit caps the query (SQL LIMIT inside the base CTE); the
|
|
65061
|
+
// server row count respects it, so pagination sees `min(total, limit)`.
|
|
65062
|
+
// No hardcoded cap — page fetches window rows via additionalProcessing.
|
|
65063
|
+
limit: pivotState ? null : limit?.value ? { value: limit.value } : null
|
|
64804
65064
|
};
|
|
64805
65065
|
}, [
|
|
64806
65066
|
effectiveReportBuilderColumns,
|
|
@@ -64817,6 +65077,23 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64817
65077
|
() => stableSerializeForQueryKey(effectiveReportBuilderState),
|
|
64818
65078
|
[effectiveReportBuilderState]
|
|
64819
65079
|
);
|
|
65080
|
+
const prevPaginationResetStateHashRef = useRef25(null);
|
|
65081
|
+
useEffect31(() => {
|
|
65082
|
+
const prevHash = prevPaginationResetStateHashRef.current;
|
|
65083
|
+
prevPaginationResetStateHashRef.current = effectiveReportBuilderStateHash;
|
|
65084
|
+
if (prevHash === null || prevHash === effectiveReportBuilderStateHash) {
|
|
65085
|
+
return;
|
|
65086
|
+
}
|
|
65087
|
+
if (!autoResetPageIndexRef.current) {
|
|
65088
|
+
return;
|
|
65089
|
+
}
|
|
65090
|
+
if (paginationRef.current.pageIndex === 0) {
|
|
65091
|
+
return;
|
|
65092
|
+
}
|
|
65093
|
+
applyPaginationUpdate((old) => ({ ...old, pageIndex: 0 }), {
|
|
65094
|
+
activate: false
|
|
65095
|
+
});
|
|
65096
|
+
}, [applyPaginationUpdate, effectiveReportBuilderStateHash]);
|
|
64820
65097
|
const pivotTableDataReportBuilderState = useMemo33(() => {
|
|
64821
65098
|
if (!effectiveReportBuilderState?.pivot) {
|
|
64822
65099
|
return void 0;
|
|
@@ -65486,6 +65763,93 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65486
65763
|
enabled: pivotTableDataRefreshQueryEnabled,
|
|
65487
65764
|
retry: false
|
|
65488
65765
|
});
|
|
65766
|
+
const tablePageReportBuilderState = pivotTableDataReportBuilderState ?? effectiveReportBuilderState;
|
|
65767
|
+
const tablePageReportBuilderStateHash = pivotTableDataReportBuilderState ? pivotTableDataReportBuilderStateHash : effectiveReportBuilderStateHash;
|
|
65768
|
+
const tablePaginationSort = useMemo33(() => {
|
|
65769
|
+
const sortEntry = tablePageReportBuilderState?.sort?.[0];
|
|
65770
|
+
const field = String(sortEntry?.field ?? "").trim();
|
|
65771
|
+
if (!field || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(field)) {
|
|
65772
|
+
return void 0;
|
|
65773
|
+
}
|
|
65774
|
+
const isOutputColumn = (tablePageReportBuilderState?.columns ?? []).some(
|
|
65775
|
+
(column) => String(column?.field ?? "").trim() === field
|
|
65776
|
+
);
|
|
65777
|
+
if (!isOutputColumn) {
|
|
65778
|
+
return void 0;
|
|
65779
|
+
}
|
|
65780
|
+
const direction = String(sortEntry?.direction ?? "ASC").toUpperCase() === "DESC" ? "DESC" : "ASC";
|
|
65781
|
+
return { field, direction };
|
|
65782
|
+
}, [tablePageReportBuilderState]);
|
|
65783
|
+
const baseWindowRowsLength = Array.isArray(sourceReport?.rows) ? sourceReport.rows.length : 0;
|
|
65784
|
+
const sourceReportRowCount = typeof sourceReport?.rowCount === "number" ? sourceReport.rowCount : void 0;
|
|
65785
|
+
const trustedSourceRowCount = sourceReportRowCount !== void 0 && (sourceReportRowCount > 0 || baseWindowRowsLength === 0) && sourceReportRowCount >= baseWindowRowsLength ? sourceReportRowCount : void 0;
|
|
65786
|
+
const paginationRangeStart = pagination.pageIndex * pagination.pageSize;
|
|
65787
|
+
const paginationRangeEnd = paginationRangeStart + pagination.pageSize;
|
|
65788
|
+
const pageWithinBaseWindow = paginationRangeEnd <= baseWindowRowsLength || trustedSourceRowCount !== void 0 && trustedSourceRowCount <= baseWindowRowsLength;
|
|
65789
|
+
const tablePageQueryEnabled = paginationActive && !pageWithinBaseWindow && !reportOverride && !useInMemoryEngines && Boolean(client) && Boolean(sourceReport) && Boolean(tablePageReportBuilderState) && sourceReportMatchesEffectiveReportId && !pendingPivotRefresh;
|
|
65790
|
+
const tablePageQuery = useQuery({
|
|
65791
|
+
queryKey: createUseFormTablePageQueryKey({
|
|
65792
|
+
reportId: effectiveReportId,
|
|
65793
|
+
pageIndex: pagination.pageIndex,
|
|
65794
|
+
pageSize: pagination.pageSize,
|
|
65795
|
+
sortHash: stableSerializeForQueryKey(tablePaginationSort ?? null),
|
|
65796
|
+
reportBuilderStateHash: tablePageReportBuilderStateHash,
|
|
65797
|
+
tenantHash,
|
|
65798
|
+
clientHash
|
|
65799
|
+
}),
|
|
65800
|
+
queryFn: createUseFormQueryFn(async () => {
|
|
65801
|
+
if (!tablePageReportBuilderState || !sourceReport || !client) {
|
|
65802
|
+
return { report: null, error: "Missing table page prerequisites" };
|
|
65803
|
+
}
|
|
65804
|
+
return loadViaReportBuilderState({
|
|
65805
|
+
reportId: effectiveReportId,
|
|
65806
|
+
reportBuilderState: tablePageReportBuilderState,
|
|
65807
|
+
client,
|
|
65808
|
+
getToken,
|
|
65809
|
+
tenants,
|
|
65810
|
+
schema: schemaForReportBuilderState,
|
|
65811
|
+
customFields: schemaData.customFields,
|
|
65812
|
+
dashboardName: resolvedSourceDashboardName,
|
|
65813
|
+
report: sourceReport,
|
|
65814
|
+
draftSessionId: draftSessionId || void 0,
|
|
65815
|
+
pagination: {
|
|
65816
|
+
pageIndex: pagination.pageIndex,
|
|
65817
|
+
pageSize: pagination.pageSize
|
|
65818
|
+
},
|
|
65819
|
+
paginationSort: tablePaginationSort
|
|
65820
|
+
});
|
|
65821
|
+
}),
|
|
65822
|
+
enabled: tablePageQueryEnabled,
|
|
65823
|
+
retry: false,
|
|
65824
|
+
// Keep showing the previous page's rows while the next page loads.
|
|
65825
|
+
placeholderData: keepPreviousData
|
|
65826
|
+
});
|
|
65827
|
+
const tablePageRows = tablePageQueryEnabled && !tablePageQuery.data?.error && Array.isArray(tablePageQuery.data?.report?.rows) ? tablePageQuery.data.report.rows : void 0;
|
|
65828
|
+
const tablePageRowCount = tablePageQueryEnabled && typeof tablePageQuery.data?.report?.rowCount === "number" && tablePageQuery.data.report.rowCount > 0 ? tablePageQuery.data.report.rowCount : void 0;
|
|
65829
|
+
const tablePageFetching = tablePageQueryEnabled && tablePageQuery.isFetching;
|
|
65830
|
+
const paginationTotalRowCount = useMemo33(() => {
|
|
65831
|
+
if (tablePageRowCount !== void 0) {
|
|
65832
|
+
return Math.max(tablePageRowCount, baseWindowRowsLength);
|
|
65833
|
+
}
|
|
65834
|
+
if (trustedSourceRowCount !== void 0) {
|
|
65835
|
+
return trustedSourceRowCount;
|
|
65836
|
+
}
|
|
65837
|
+
if (useInMemoryEngines || Boolean(reportOverride)) {
|
|
65838
|
+
return baseWindowRowsLength;
|
|
65839
|
+
}
|
|
65840
|
+
return void 0;
|
|
65841
|
+
}, [
|
|
65842
|
+
tablePageRowCount,
|
|
65843
|
+
trustedSourceRowCount,
|
|
65844
|
+
baseWindowRowsLength,
|
|
65845
|
+
useInMemoryEngines,
|
|
65846
|
+
reportOverride
|
|
65847
|
+
]);
|
|
65848
|
+
const paginationPageCount = getPageCountFromRowCount(
|
|
65849
|
+
paginationTotalRowCount,
|
|
65850
|
+
pagination.pageSize
|
|
65851
|
+
);
|
|
65852
|
+
paginationPageCountRef.current = paginationPageCount;
|
|
65489
65853
|
useEffect31(() => {
|
|
65490
65854
|
if (!pivotTableDataRefreshQueryEnabled) return;
|
|
65491
65855
|
if (pivotTableDataRefreshQuery.status !== "success" && pivotTableDataRefreshQuery.status !== "error") {
|
|
@@ -65787,11 +66151,19 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65787
66151
|
]);
|
|
65788
66152
|
const resolvedXAxisField = useMemo33(() => {
|
|
65789
66153
|
if (!chartAxesBaseChart) return "";
|
|
66154
|
+
const chartType2 = String(chartAxesBaseChart.chartType ?? "").toLowerCase();
|
|
65790
66155
|
const pivotRowField = String(
|
|
65791
66156
|
chartAxesBaseChart.pivot?.rowField ?? ""
|
|
65792
66157
|
).trim();
|
|
65793
66158
|
if (pivotRowField) {
|
|
65794
|
-
|
|
66159
|
+
const rowColumn = (chartAxesBaseChart.pivotColumns ?? chartAxesBaseChart.columns ?? []).find((col) => String(col.field ?? "").trim() === pivotRowField);
|
|
66160
|
+
if (shouldUsePivotRowFieldAsXAxis(
|
|
66161
|
+
chartType2,
|
|
66162
|
+
pivotRowField,
|
|
66163
|
+
String(rowColumn?.format ?? "")
|
|
66164
|
+
)) {
|
|
66165
|
+
return pivotRowField;
|
|
66166
|
+
}
|
|
65795
66167
|
}
|
|
65796
66168
|
const requestedXAxisField = String(chartAxisEdits.xAxisField ?? "").trim();
|
|
65797
66169
|
if (requestedXAxisField && chartAxisOptionByField.has(requestedXAxisField)) {
|
|
@@ -66114,7 +66486,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66114
66486
|
]
|
|
66115
66487
|
);
|
|
66116
66488
|
const table = useMemo33(() => {
|
|
66117
|
-
const
|
|
66489
|
+
const baseWindowRows = Array.isArray(sourceReport?.rows) ? sourceReport.rows : [];
|
|
66490
|
+
const rawRows = !paginationActive ? baseWindowRows : tablePageRows ?? baseWindowRows.slice(paginationRangeStart, paginationRangeEnd);
|
|
66118
66491
|
const { columns: mergedFromReport } = mergeDisplayAndSourceForTableFormats({
|
|
66119
66492
|
effectiveReportBuilderTableNames,
|
|
66120
66493
|
scopedSchemaColumns,
|
|
@@ -66132,8 +66505,24 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66132
66505
|
format: pivotRowTableUsesAxisFormat ? String(resolvedXAxisFormat ?? column.format) : column.format
|
|
66133
66506
|
} : column
|
|
66134
66507
|
) : mergedFromReport;
|
|
66508
|
+
const pivotLabeledColumns = String(chartType ?? "").toLowerCase() === "table" && sourceReport?.pivot ? mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
66509
|
+
columns: columns2,
|
|
66510
|
+
yAxisFields: resolvedYAxisFieldsForDisplay,
|
|
66511
|
+
pivotRowField: String(sourceReport.pivot.rowField ?? ""),
|
|
66512
|
+
xAxisLabel: resolvedXAxisLabel
|
|
66513
|
+
}) ?? columns2 : columns2;
|
|
66514
|
+
const tableColumnsWithPivotDisplayLabels = pivotLabeledColumns.map(
|
|
66515
|
+
(column) => ({
|
|
66516
|
+
label: String(column.label ?? "").trim() || String(column.field ?? ""),
|
|
66517
|
+
field: String(column.field ?? "").trim(),
|
|
66518
|
+
format: String(column.format ?? "string").trim() || "string"
|
|
66519
|
+
})
|
|
66520
|
+
);
|
|
66135
66521
|
const formatByField = new Map(
|
|
66136
|
-
|
|
66522
|
+
tableColumnsWithPivotDisplayLabels.map((column) => [
|
|
66523
|
+
column.field,
|
|
66524
|
+
column.format
|
|
66525
|
+
])
|
|
66137
66526
|
);
|
|
66138
66527
|
const isCacheableValue = (value) => {
|
|
66139
66528
|
return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint";
|
|
@@ -66161,20 +66550,37 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66161
66550
|
cache.set(cacheKey, formatted);
|
|
66162
66551
|
return formatted;
|
|
66163
66552
|
};
|
|
66164
|
-
const formattedRows =
|
|
66553
|
+
const formattedRows = tableColumnsWithPivotDisplayLabels.length === 0 ? rawRows : rawRows.map((rawRow) => {
|
|
66165
66554
|
const out = { ...rawRow };
|
|
66166
|
-
for (const col of
|
|
66555
|
+
for (const col of tableColumnsWithPivotDisplayLabels) {
|
|
66167
66556
|
out[col.field] = formatCellValue(col.field, rawRow[col.field]);
|
|
66168
66557
|
}
|
|
66169
66558
|
return out;
|
|
66170
66559
|
});
|
|
66171
66560
|
const getFormattedCellValue = (row, field) => String(row?.[field] ?? "");
|
|
66172
66561
|
return {
|
|
66173
|
-
columns:
|
|
66562
|
+
columns: tableColumnsWithPivotDisplayLabels,
|
|
66174
66563
|
rows: formattedRows,
|
|
66175
66564
|
getColumnFormat,
|
|
66176
66565
|
formatCellValue,
|
|
66177
|
-
getFormattedCellValue
|
|
66566
|
+
getFormattedCellValue,
|
|
66567
|
+
// TanStack Table–style pagination API.
|
|
66568
|
+
pagination,
|
|
66569
|
+
setPagination,
|
|
66570
|
+
setPageIndex,
|
|
66571
|
+
setPageSize,
|
|
66572
|
+
resetPagination,
|
|
66573
|
+
resetPageIndex,
|
|
66574
|
+
resetPageSize,
|
|
66575
|
+
nextPage,
|
|
66576
|
+
previousPage,
|
|
66577
|
+
firstPage,
|
|
66578
|
+
lastPage,
|
|
66579
|
+
getCanNextPage: () => getCanNextPageFromState(pagination.pageIndex, paginationPageCount),
|
|
66580
|
+
getCanPreviousPage: () => getCanPreviousPageFromState(pagination.pageIndex),
|
|
66581
|
+
getPageCount: () => paginationPageCount,
|
|
66582
|
+
getRowCount: () => paginationTotalRowCount ?? baseWindowRows.length,
|
|
66583
|
+
getPageOptions: () => getPageOptionsFromPageCount(paginationPageCount)
|
|
66178
66584
|
};
|
|
66179
66585
|
}, [
|
|
66180
66586
|
chartAxisEdits.xAxisFormat,
|
|
@@ -66184,8 +66590,26 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66184
66590
|
resolvedXAxisField,
|
|
66185
66591
|
resolvedXAxisFormat,
|
|
66186
66592
|
resolvedXAxisLabel,
|
|
66593
|
+
resolvedYAxisFieldsForDisplay,
|
|
66187
66594
|
scopedSchemaColumns,
|
|
66188
|
-
sourceReport
|
|
66595
|
+
sourceReport,
|
|
66596
|
+
pagination,
|
|
66597
|
+
paginationActive,
|
|
66598
|
+
paginationPageCount,
|
|
66599
|
+
paginationRangeEnd,
|
|
66600
|
+
paginationRangeStart,
|
|
66601
|
+
paginationTotalRowCount,
|
|
66602
|
+
tablePageRows,
|
|
66603
|
+
setPagination,
|
|
66604
|
+
setPageIndex,
|
|
66605
|
+
setPageSize,
|
|
66606
|
+
resetPagination,
|
|
66607
|
+
resetPageIndex,
|
|
66608
|
+
resetPageSize,
|
|
66609
|
+
nextPage,
|
|
66610
|
+
previousPage,
|
|
66611
|
+
firstPage,
|
|
66612
|
+
lastPage
|
|
66189
66613
|
]);
|
|
66190
66614
|
const {
|
|
66191
66615
|
columnsOptions: tableFormattingColumnOptions,
|
|
@@ -66497,7 +66921,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66497
66921
|
const initialLoadInProgress = !reportOverride && Boolean(effectiveReportId) && (!client || initialLoadQuery.isPending || initialLoadQuery.isFetching);
|
|
66498
66922
|
const filterUniqueValuesLoading = filterUniqueValuesEnabled && (filterUniqueValuesQuery.isPending || filterUniqueValuesQuery.isFetching);
|
|
66499
66923
|
const chartLoading = initialLoadInProgress || (Boolean(nextPivot) ? pivotRefreshQuery.isFetching : tableRefreshQuery.isFetching);
|
|
66500
|
-
const tableLoading = initialLoadInProgress || (Boolean(nextPivot) ? pivotTableDataRefreshQuery.isFetching : tableRefreshQuery.isFetching);
|
|
66924
|
+
const tableLoading = initialLoadInProgress || tablePageFetching || (Boolean(nextPivot) ? pivotTableDataRefreshQuery.isFetching : tableRefreshQuery.isFetching);
|
|
66501
66925
|
const loading = chartLoading || tableLoading;
|
|
66502
66926
|
const buildSetReportColumnsFromIds = (nextColumnIds, settingsById) => {
|
|
66503
66927
|
const normalizedNextIds = nextColumnIds.map((columnId) => String(columnId ?? "").trim()).filter(Boolean);
|
|
@@ -68255,6 +68679,23 @@ var styles2 = {
|
|
|
68255
68679
|
boxSizing: "border-box"
|
|
68256
68680
|
}
|
|
68257
68681
|
};
|
|
68682
|
+
function getTablePaginationBindings(table) {
|
|
68683
|
+
if (!table?.pagination || typeof table.setPageIndex !== "function") {
|
|
68684
|
+
return {};
|
|
68685
|
+
}
|
|
68686
|
+
const { pageIndex, pageSize } = table.pagination;
|
|
68687
|
+
return {
|
|
68688
|
+
manualPagination: true,
|
|
68689
|
+
currentPage: pageIndex,
|
|
68690
|
+
rowsPerPage: pageSize,
|
|
68691
|
+
rowCount: table.getRowCount?.() ?? table.rows?.length ?? 0,
|
|
68692
|
+
pageCount: table.getPageCount?.(),
|
|
68693
|
+
canNextPage: table.getCanNextPage?.(),
|
|
68694
|
+
canPreviousPage: table.getCanPreviousPage?.(),
|
|
68695
|
+
onPageChange: (page) => table.setPageIndex?.(page),
|
|
68696
|
+
disableSort: true
|
|
68697
|
+
};
|
|
68698
|
+
}
|
|
68258
68699
|
function chartTypeFromConfig(chart) {
|
|
68259
68700
|
return String(chart?.chartType ?? "").trim().toLowerCase();
|
|
68260
68701
|
}
|
|
@@ -68305,6 +68746,7 @@ function ReportDetail({
|
|
|
68305
68746
|
borderBottom: "none"
|
|
68306
68747
|
} : void 0;
|
|
68307
68748
|
const trimmedTitle = String(reportTitle ?? "").trim();
|
|
68749
|
+
const tablePagination = getTablePaginationBindings(table);
|
|
68308
68750
|
return /* @__PURE__ */ jsxs66(
|
|
68309
68751
|
"div",
|
|
68310
68752
|
{
|
|
@@ -68336,6 +68778,7 @@ function ReportDetail({
|
|
|
68336
68778
|
columns: Array.isArray(table?.columns) ? table.columns : [],
|
|
68337
68779
|
rows: Array.isArray(table?.rows) ? table.rows : [],
|
|
68338
68780
|
isLoading: chartLoading || tableLoading,
|
|
68781
|
+
rowCountIsLoading: tableLoading,
|
|
68339
68782
|
hideCSVDownloadButton: true,
|
|
68340
68783
|
containerStyle: {
|
|
68341
68784
|
width: "100%",
|
|
@@ -68344,7 +68787,8 @@ function ReportDetail({
|
|
|
68344
68787
|
padding: 0,
|
|
68345
68788
|
margin: 0
|
|
68346
68789
|
},
|
|
68347
|
-
...tableChartSlotBorders
|
|
68790
|
+
...tableChartSlotBorders,
|
|
68791
|
+
...tablePagination
|
|
68348
68792
|
}
|
|
68349
68793
|
) : /* @__PURE__ */ jsx89(
|
|
68350
68794
|
ChartDisplay,
|
|
@@ -68384,9 +68828,11 @@ function ReportDetail({
|
|
|
68384
68828
|
columns: Array.isArray(table?.columns) ? table.columns : [],
|
|
68385
68829
|
rows: Array.isArray(table?.rows) ? table.rows : [],
|
|
68386
68830
|
isLoading: tableLoading,
|
|
68831
|
+
rowCountIsLoading: tableLoading,
|
|
68387
68832
|
hideCSVDownloadButton: true,
|
|
68388
68833
|
containerStyle: quillTableFramelessStyle,
|
|
68389
|
-
...quillTableFramelessBorders
|
|
68834
|
+
...quillTableFramelessBorders,
|
|
68835
|
+
...tablePagination
|
|
68390
68836
|
}
|
|
68391
68837
|
)
|
|
68392
68838
|
}
|
|
@@ -69281,6 +69727,8 @@ export {
|
|
|
69281
69727
|
ChartDisplay,
|
|
69282
69728
|
ChartEditor,
|
|
69283
69729
|
Chat,
|
|
69730
|
+
DEFAULT_PAGE_SIZE,
|
|
69731
|
+
DEFAULT_USE_REPORT_ROWS_PER_REQUEST,
|
|
69284
69732
|
Dashboard,
|
|
69285
69733
|
DashboardFilterType,
|
|
69286
69734
|
DashboardLegacy,
|