@quillsql/react 2.15.6 → 2.15.8

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.js CHANGED
@@ -386,14 +386,14 @@ var require_pluralize = __commonJS({
386
386
  import {
387
387
  useContext as useContext20,
388
388
  useEffect as useEffect18,
389
- useState as useState22,
389
+ useState as useState23,
390
390
  useMemo as useMemo16,
391
391
  useRef as useRef13
392
392
  } from "react";
393
393
 
394
394
  // src/Chart.tsx
395
395
  import {
396
- useState as useState16,
396
+ useState as useState17,
397
397
  useEffect as useEffect15,
398
398
  useContext as useContext16,
399
399
  useMemo as useMemo13,
@@ -812,7 +812,7 @@ var downloadCSV = (data) => {
812
812
  };
813
813
 
814
814
  // src/hooks/useExport.tsx
815
- import { useContext as useContext2, useMemo as useMemo3, useState as useState2 } from "react";
815
+ import { useContext as useContext2, useMemo as useMemo3, useState as useState3 } from "react";
816
816
 
817
817
  // src/utils/constants.ts
818
818
  var MAX_PIVOT_UNIQUE_VALUES = 250;
@@ -19029,6 +19029,10 @@ async function cleanDashboardItem({
19029
19029
  let pivotTable;
19030
19030
  let pivotError;
19031
19031
  try {
19032
+ const shouldPaginatePivotAsTable = item.chartType === "table";
19033
+ const pivotChartProcessing = {
19034
+ page: DEFAULT_PAGINATION
19035
+ };
19032
19036
  pivotTable = await getPivotTable(
19033
19037
  {
19034
19038
  ...item,
@@ -19051,7 +19055,7 @@ async function cleanDashboardItem({
19051
19055
  client,
19052
19056
  eventTracking,
19053
19057
  dateBucket,
19054
- additionalProcessing,
19058
+ shouldPaginatePivotAsTable ? additionalProcessing : pivotChartProcessing,
19055
19059
  tenants,
19056
19060
  customFields
19057
19061
  );
@@ -20513,6 +20517,8 @@ function extractAllReportValuesFromQuillInternalReport(reportInternal) {
20513
20517
  name: reportInternal.name,
20514
20518
  dashboardName: reportInternal.dashboardName,
20515
20519
  // section: reportInternal.section,
20520
+ pagination: reportInternal.pagination,
20521
+ sort: reportInternal.sort,
20516
20522
  rows: reportInternal.rows,
20517
20523
  columns: reportInternal.columns,
20518
20524
  chartType: reportInternal.chartType,
@@ -23070,7 +23076,7 @@ import { flushSync } from "react-dom";
23070
23076
  import jsPDF from "jspdf";
23071
23077
 
23072
23078
  // src/hooks/useDashboard.ts
23073
- import { useContext, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2 } from "react";
23079
+ import { useContext, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
23074
23080
  var useDashboardInternal = (dashboardName, customFilters) => {
23075
23081
  const [dashboard] = useContext(DashboardContext);
23076
23082
  const {
@@ -23657,7 +23663,7 @@ var useDashboards = () => {
23657
23663
  deleteDashboard
23658
23664
  };
23659
23665
  };
23660
- var useDashboard = (dashboardName) => {
23666
+ var useDashboard = (dashboardName, config) => {
23661
23667
  const { data, dashboardFilters, reload, isLoading } = useDashboardInternal(dashboardName);
23662
23668
  const { customFilterDispatch } = useContext(DashboardFiltersContext);
23663
23669
  const { reportsDispatch, reportsLoadingStateDispatch } = useContext(ReportsContext);
@@ -23698,7 +23704,7 @@ var useDashboard = (dashboardName) => {
23698
23704
  useEffect2(() => {
23699
23705
  if (!fetchedInitialReports.current && data) {
23700
23706
  fetchedInitialReports.current = true;
23701
- fetchReports([], dashboardFilters ?? []);
23707
+ fetchReports([], dashboardFilters ?? [], config?.pageSize);
23702
23708
  }
23703
23709
  }, [fetchedInitialReports, data, dashboardFilters]);
23704
23710
  const applyDashboardFilters = (filtersToUpdate) => {
@@ -23805,24 +23811,35 @@ var useDashboard = (dashboardName) => {
23805
23811
  }
23806
23812
  return [];
23807
23813
  };
23808
- const fetchReports = async (customFilters, dashboardFilters2) => {
23814
+ const fetchReports = async (customFilters, dashboardFilters2, pageSize) => {
23809
23815
  if (!client || !sections) return;
23810
- const allReportIds = Object.values(sections).flatMap(
23811
- (reports) => reports.map((report) => report.id)
23812
- );
23816
+ const allReports = Object.values(sections).flat();
23813
23817
  await Promise.all(
23814
- allReportIds.map(async (reportId) => {
23818
+ allReports.map(async (reportInfo) => {
23819
+ const reportId = reportInfo.id;
23815
23820
  reportsLoadingStateDispatch({
23816
23821
  type: "SET_REPORT_LOADING",
23817
23822
  id: reportId,
23818
23823
  data: true
23819
23824
  });
23820
23825
  const customReportFiltersArray = await waitForCustomFilters(reportId);
23826
+ let rowsPerRequest = pageSize || 600;
23827
+ if (!pageSize && (reportInfo.chartType === "table" || reportInfo.chartType === "metric")) {
23828
+ rowsPerRequest = 10;
23829
+ }
23830
+ const pagination = {
23831
+ rowsPerRequest,
23832
+ rowsPerPage: rowsPerRequest
23833
+ };
23834
+ const additionalProcessing = {
23835
+ page: pagination
23836
+ };
23821
23837
  const { report, error } = await fetchReport({
23822
23838
  reportId,
23823
23839
  client,
23824
23840
  tenants,
23825
23841
  flags,
23842
+ additionalProcessing,
23826
23843
  filters: dashboardFilters2.concat(customFilters).concat(customReportFiltersArray),
23827
23844
  getToken,
23828
23845
  eventTracking
@@ -23834,7 +23851,10 @@ var useDashboard = (dashboardName) => {
23834
23851
  reportsDispatch({
23835
23852
  type: "UPDATE_REPORT",
23836
23853
  id: reportId,
23837
- data: report
23854
+ data: {
23855
+ ...report,
23856
+ pagination
23857
+ }
23838
23858
  });
23839
23859
  reportsLoadingStateDispatch({
23840
23860
  type: "SET_REPORT_LOADING",
@@ -23852,7 +23872,7 @@ var useDashboard = (dashboardName) => {
23852
23872
  applyFilters
23853
23873
  };
23854
23874
  };
23855
- var useDashboardReport = (reportId, config) => {
23875
+ var useDashboardReportInternal = (reportId, config) => {
23856
23876
  const {
23857
23877
  reports,
23858
23878
  reportsLoadingState,
@@ -23864,13 +23884,15 @@ var useDashboardReport = (reportId, config) => {
23864
23884
  const [client] = useContext(ClientContext);
23865
23885
  const { getToken } = useContext(FetchContext);
23866
23886
  const { eventTracking } = useContext(EventTrackingContext);
23867
- const { customReportFiltersDispatch } = useContext(ReportFiltersContext);
23887
+ const { customReportFilters, customReportFiltersDispatch } = useContext(ReportFiltersContext);
23868
23888
  const { dashboardCustomFilters } = useContext(DashboardFiltersContext);
23869
23889
  const {
23870
23890
  data: dashboardData,
23871
23891
  dashboardFilters: dashboardFiltersInternal,
23872
23892
  reload: reloadDashboard
23873
23893
  } = useDashboardInternal(reports[reportId]?.dashboardName ?? null);
23894
+ const [pageLoading, setPageLoading] = useState2(false);
23895
+ const [maxPage, setMaxPage] = useState2(0);
23874
23896
  useEffect2(() => {
23875
23897
  if (config?.initialFilters) {
23876
23898
  customReportFiltersDispatch({
@@ -23908,11 +23930,16 @@ var useDashboardReport = (reportId, config) => {
23908
23930
  const dashboardFiltersArray = dashboardFiltersInternal ?? [];
23909
23931
  const dashboardCustomFiltersArray = dashboardCustomFilters[processedReport?.dashboardName ?? ""] ?? [];
23910
23932
  const requestFilters = filters.map(convertCustomFilter).concat(dashboardCustomFiltersArray).concat(dashboardFiltersArray);
23933
+ const pagination = processedReport?.pagination;
23934
+ const additionalProcessing = {
23935
+ page: pagination
23936
+ };
23911
23937
  const { report, error } = await fetchReport({
23912
23938
  reportId,
23913
23939
  client,
23914
23940
  tenants,
23915
23941
  flags,
23942
+ additionalProcessing,
23916
23943
  filters: requestFilters,
23917
23944
  getToken,
23918
23945
  eventTracking
@@ -23968,11 +23995,138 @@ var useDashboardReport = (reportId, config) => {
23968
23995
  });
23969
23996
  }
23970
23997
  };
23998
+ const updateReportTableRows = async (processing, appendRows) => {
23999
+ if (!client) {
24000
+ return;
24001
+ }
24002
+ setPageLoading(true);
24003
+ const dashboardFiltersArray = dashboardFiltersInternal ?? [];
24004
+ const dashboardCustomFiltersArray = dashboardCustomFilters[processedReport?.dashboardName ?? ""] ?? [];
24005
+ const reportCustomFiltersArray = customReportFilters[reportId] ?? [];
24006
+ const filters = reportCustomFiltersArray.concat(dashboardFiltersArray).concat(dashboardCustomFiltersArray);
24007
+ const pivot = processedReport?.pivot;
24008
+ const pivotQuery = reports[reportId]?.pivotQuery;
24009
+ const { rows } = await fetchResultsByReport({
24010
+ reportId,
24011
+ client,
24012
+ tenants,
24013
+ processing,
24014
+ filters,
24015
+ getToken,
24016
+ eventTracking,
24017
+ pivot,
24018
+ pivotQuery
24019
+ });
24020
+ if (pivot && pivotQuery) {
24021
+ const currRows = reports[reportId]?.pivotRows || [];
24022
+ const updatedRows = appendRows ? [...currRows, ...rows] : rows;
24023
+ reportsDispatch({
24024
+ type: "UPDATE_REPORT",
24025
+ id: reportId,
24026
+ data: {
24027
+ pivotRows: updatedRows,
24028
+ pagination: processing.page,
24029
+ sort: processing.sort
24030
+ }
24031
+ });
24032
+ } else {
24033
+ const currRows = reports[reportId]?.rows || [];
24034
+ const updatedRows = appendRows ? [...currRows, ...rows] : rows;
24035
+ reportsDispatch({
24036
+ type: "UPDATE_REPORT",
24037
+ id: reportId,
24038
+ data: {
24039
+ rows: updatedRows,
24040
+ pagination: processing.page,
24041
+ sort: processing.sort
24042
+ }
24043
+ });
24044
+ }
24045
+ setMaxPage(processing.page?.page || 0);
24046
+ setPageLoading(false);
24047
+ };
24048
+ const handleNextPage = async () => {
24049
+ if (!processedReport?.pagination) {
24050
+ return;
24051
+ }
24052
+ const currPage = processedReport.pagination.page || 0;
24053
+ const updatedPage = {
24054
+ ...processedReport.pagination,
24055
+ page: currPage + 1
24056
+ };
24057
+ if (shouldFetchMore(updatedPage, currPage + 1, maxPage)) {
24058
+ const sort = processedReport?.sort;
24059
+ updateReportTableRows({ page: updatedPage, sort }, true);
24060
+ } else {
24061
+ reportsDispatch({
24062
+ type: "UPDATE_REPORT",
24063
+ id: reportId,
24064
+ data: {
24065
+ pagination: updatedPage
24066
+ }
24067
+ });
24068
+ }
24069
+ };
24070
+ const handlePrevPage = async () => {
24071
+ if (!processedReport?.pagination) {
24072
+ return;
24073
+ }
24074
+ const currPage = processedReport.pagination.page || 0;
24075
+ const updatedPage = {
24076
+ ...processedReport.pagination,
24077
+ page: currPage - 1
24078
+ };
24079
+ reportsDispatch({
24080
+ type: "UPDATE_REPORT",
24081
+ id: reportId,
24082
+ data: {
24083
+ pagination: updatedPage
24084
+ }
24085
+ });
24086
+ };
24087
+ const handleSort = async (sort) => {
24088
+ const currSort = processedReport?.sort;
24089
+ const currPagination = processedReport?.pagination;
24090
+ const newPagination = currPagination ? { ...currPagination, page: 0 } : void 0;
24091
+ if (currSort?.field !== sort.field || currSort?.direction?.toLowerCase() !== sort?.direction?.toLowerCase()) {
24092
+ updateReportTableRows({ page: newPagination, sort }, false);
24093
+ }
24094
+ };
23971
24095
  return {
23972
24096
  report: reportsLoadingState[reportId] ? null : processedReport,
23973
24097
  loading: !!reportsLoadingState[reportId],
23974
24098
  applyFilters: setReportFilters,
23975
- deleteReport
24099
+ deleteReport,
24100
+ pageNumber: processedReport?.pagination?.page || 0,
24101
+ pageLoading,
24102
+ nextPage: handleNextPage,
24103
+ prevPage: handlePrevPage,
24104
+ sortRows: handleSort
24105
+ };
24106
+ };
24107
+ var useDashboardReport = (reportId, config) => {
24108
+ const { report, loading, applyFilters, deleteReport, nextPage } = useDashboardReportInternal(reportId, config);
24109
+ const fetchingRef = useRef2(false);
24110
+ const fetchNextPage = async () => {
24111
+ if (fetchingRef.current) {
24112
+ return;
24113
+ }
24114
+ try {
24115
+ fetchingRef.current = true;
24116
+ await nextPage();
24117
+ } catch (error) {
24118
+ console.error("Error fetching page:", error.message);
24119
+ } finally {
24120
+ fetchingRef.current = false;
24121
+ }
24122
+ };
24123
+ return {
24124
+ report,
24125
+ isLoading: loading || fetchingRef.current,
24126
+ loading: loading || fetchingRef.current,
24127
+ applyFilters,
24128
+ deleteReport,
24129
+ fetchNextPage
23976
24130
  };
23977
24131
  };
23978
24132
 
@@ -24054,8 +24208,8 @@ var useExport = (reportId, {
24054
24208
  return Object.values(reportFilters[reportId] ?? []).map((f) => f.filter);
24055
24209
  }, [reportFilters, reportId]);
24056
24210
  const [client] = useContext2(ClientContext);
24057
- const [isCSVLoading, setIsCSVLoading] = useState2(false);
24058
- const [isPDFLoading, setIsPDFLoading] = useState2(false);
24211
+ const [isCSVLoading, setIsCSVLoading] = useState3(false);
24212
+ const [isPDFLoading, setIsPDFLoading] = useState3(false);
24059
24213
  if (!reportId || !client) {
24060
24214
  return {
24061
24215
  downloadCSV: async () => {
@@ -25425,7 +25579,7 @@ var PieChartWrapper = React3.forwardRef(
25425
25579
  var PieChart_default = PieChartWrapper;
25426
25580
 
25427
25581
  // src/components/QuillTable.tsx
25428
- import { useContext as useContext5, useEffect as useEffect7, useState as useState7 } from "react";
25582
+ import { useContext as useContext5, useEffect as useEffect7, useState as useState8 } from "react";
25429
25583
 
25430
25584
  // src/components/UiComponents.tsx
25431
25585
  import {
@@ -25433,7 +25587,7 @@ import {
25433
25587
  useContext as useContext4,
25434
25588
  useEffect as useEffect6,
25435
25589
  useRef as useRef3,
25436
- useState as useState6
25590
+ useState as useState7
25437
25591
  } from "react";
25438
25592
 
25439
25593
  // src/assets/ArrowDownHeadIcon.tsx
@@ -25634,7 +25788,7 @@ function ChartSkeleton({
25634
25788
  }
25635
25789
 
25636
25790
  // src/hooks/useInternalState.tsx
25637
- import { useState as useState3 } from "react";
25791
+ import { useState as useState4 } from "react";
25638
25792
 
25639
25793
  // src/hooks/useOnClickOutside.tsx
25640
25794
  import { useEffect as useEffect3 } from "react";
@@ -25680,10 +25834,10 @@ var createsStackingContext = (computedStyle) => {
25680
25834
  var useOnClickOutside_default = useOnClickOutside;
25681
25835
 
25682
25836
  // src/hooks/useOnWindowResize.tsx
25683
- import { useEffect as useEffect4, useState as useState4 } from "react";
25837
+ import { useEffect as useEffect4, useState as useState5 } from "react";
25684
25838
 
25685
25839
  // src/hooks/useSelectOnKeyDown.tsx
25686
- import { useEffect as useEffect5, useState as useState5 } from "react";
25840
+ import { useEffect as useEffect5, useState as useState6 } from "react";
25687
25841
 
25688
25842
  // src/components/UiComponents.tsx
25689
25843
  import { createPortal } from "react-dom";
@@ -26127,7 +26281,7 @@ var MemoizedPopover = ({
26127
26281
  titlePaddingLeft = 0
26128
26282
  }) => {
26129
26283
  const [theme] = useContext4(ThemeContext);
26130
- const [rightAlignment, setRightAlignment] = useState6("auto");
26284
+ const [rightAlignment, setRightAlignment] = useState7("auto");
26131
26285
  const modalRef = useRef3(null);
26132
26286
  const popoverRef = useRef3(null);
26133
26287
  useEffect6(() => {
@@ -26545,7 +26699,7 @@ var QuillModalComponent = ({
26545
26699
  title
26546
26700
  }) => {
26547
26701
  const [theme] = useContext4(ThemeContext);
26548
- const [rightAlignment, setRightAlignment] = useState6("auto");
26702
+ const [rightAlignment, setRightAlignment] = useState7("auto");
26549
26703
  const modalRef = useRef3(null);
26550
26704
  const popoverRef = useRef3(null);
26551
26705
  useEffect6(() => {
@@ -26861,8 +27015,8 @@ var OverflowContainer = ({
26861
27015
  style: style2
26862
27016
  }) => {
26863
27017
  const containerRef = useRef3(null);
26864
- const [showTopShadow, setShowTopShadow] = useState6(false);
26865
- const [showBottomShadow, setShowBottomShadow] = useState6(false);
27018
+ const [showTopShadow, setShowTopShadow] = useState7(false);
27019
+ const [showBottomShadow, setShowBottomShadow] = useState7(false);
26866
27020
  const checkOverflow = () => {
26867
27021
  const container = containerRef.current;
26868
27022
  if (container) {
@@ -27027,10 +27181,10 @@ var QuillToolTipPortal = ({
27027
27181
  mirror = false
27028
27182
  }) => {
27029
27183
  const [theme] = useContext4(ThemeContext);
27030
- const [isOpen, setIsOpen] = useState6(false);
27184
+ const [isOpen, setIsOpen] = useState7(false);
27031
27185
  const tooltipRef = useRef3(null);
27032
27186
  const triggerRef = useRef3(null);
27033
- const [tooltipPosition, setTooltipPosition] = useState6(void 0);
27187
+ const [tooltipPosition, setTooltipPosition] = useState7(void 0);
27034
27188
  const updatePosition = () => {
27035
27189
  if (triggerRef.current && tooltipRef.current) {
27036
27190
  const rect = triggerRef.current.getBoundingClientRect();
@@ -27199,8 +27353,8 @@ var QuillPortal = ({
27199
27353
  setShowModal
27200
27354
  }) => {
27201
27355
  const modalRef = useRef3(null);
27202
- const [popoverPosition, setPopoverPosition] = useState6(void 0);
27203
- const [z, setZ] = useState6(10);
27356
+ const [popoverPosition, setPopoverPosition] = useState7(void 0);
27357
+ const [z, setZ] = useState7(10);
27204
27358
  const scrollableParentRef = useRef3(document.body);
27205
27359
  const updatePosition = () => {
27206
27360
  if (anchorRef.current) {
@@ -27316,13 +27470,13 @@ function QuillTable({
27316
27470
  hideLabels,
27317
27471
  disableSort
27318
27472
  }) {
27319
- const [activeRows, setActiveRows] = useState7([]);
27320
- const [maxPage, setMaxPage] = useState7(1);
27321
- const [sortColumn, setSortColumn] = useState7(sort?.field || "");
27322
- const [sortDirection, setSortDirection] = useState7(sort?.direction || "desc");
27473
+ const [activeRows, setActiveRows] = useState8([]);
27474
+ const [maxPage, setMaxPage] = useState8(1);
27475
+ const [sortColumn, setSortColumn] = useState8(sort?.field || "");
27476
+ const [sortDirection, setSortDirection] = useState8(sort?.direction || "desc");
27323
27477
  const [theme] = useContext5(ThemeContext);
27324
- const [isPaginating, setIsPaginating] = useState7(true);
27325
- const [initialLoad, setInitialLoad] = useState7(true);
27478
+ const [isPaginating, setIsPaginating] = useState8(true);
27479
+ const [initialLoad, setInitialLoad] = useState8(true);
27326
27480
  useEffect7(() => {
27327
27481
  setSortColumn(sort?.field || "");
27328
27482
  setSortDirection(sort?.direction || "desc");
@@ -29318,7 +29472,7 @@ import {
29318
29472
  useContext as useContext9,
29319
29473
  useEffect as useEffect9,
29320
29474
  useRef as useRef5,
29321
- useState as useState9
29475
+ useState as useState10
29322
29476
  } from "react";
29323
29477
  import {
29324
29478
  startOfMonth as startOfMonth2,
@@ -29340,7 +29494,7 @@ import {
29340
29494
  useContext as useContext8,
29341
29495
  useMemo as useMemo7,
29342
29496
  useRef as useRef4,
29343
- useState as useState8,
29497
+ useState as useState9,
29344
29498
  useEffect as useEffect8
29345
29499
  } from "react";
29346
29500
  import { createPortal as createPortal2 } from "react-dom";
@@ -29356,7 +29510,7 @@ function QuillSelectComponent({
29356
29510
  hideEmptyOption
29357
29511
  }) {
29358
29512
  const [theme] = useContext8(ThemeContext);
29359
- const [showModal, setShowModal] = useState8(false);
29513
+ const [showModal, setShowModal] = useState9(false);
29360
29514
  const modalRef = useRef4(null);
29361
29515
  const buttonRef = useRef4(null);
29362
29516
  useOnClickOutside_default(
@@ -29381,8 +29535,8 @@ function QuillSelectComponent({
29381
29535
  const nullLabel = useMemo7(() => {
29382
29536
  return sortedItems.some((item) => item.value === "-") ? "None" : "-";
29383
29537
  }, [sortedItems]);
29384
- const [popoverPosition, setPopoverPosition] = useState8(void 0);
29385
- const [z, setZ] = useState8(10);
29538
+ const [popoverPosition, setPopoverPosition] = useState9(void 0);
29539
+ const [z, setZ] = useState9(10);
29386
29540
  const scrollableParentRef = useRef4(document.body);
29387
29541
  const updatePosition = () => {
29388
29542
  if (buttonRef.current) {
@@ -29682,20 +29836,20 @@ function QuillDateRangePicker({
29682
29836
  }) {
29683
29837
  const [theme] = useContext9(ThemeContext);
29684
29838
  const [client] = useContext9(ClientContext);
29685
- const [anchorStartDate, setAnchorStartDate] = useState9(
29839
+ const [anchorStartDate, setAnchorStartDate] = useState10(
29686
29840
  getAnchorStartDate(dateRange.startDate, dateRange.endDate)
29687
29841
  );
29688
- const [anchorEndDate, setAnchorEndDate] = useState9(
29842
+ const [anchorEndDate, setAnchorEndDate] = useState10(
29689
29843
  getAnchorEndDate(dateRange.startDate, dateRange.endDate)
29690
29844
  );
29691
- const [localStartDate, setLocalStartDate] = useState9(
29845
+ const [localStartDate, setLocalStartDate] = useState10(
29692
29846
  dateRange.startDate
29693
29847
  );
29694
- const [localEndDate, setLocalEndDate] = useState9(
29848
+ const [localEndDate, setLocalEndDate] = useState10(
29695
29849
  dateRange.endDate
29696
29850
  );
29697
- const [localPreset, setLocalPreset] = useState9(preset);
29698
- const [showModal, setShowModal] = useState9(false);
29851
+ const [localPreset, setLocalPreset] = useState10(preset);
29852
+ const [showModal, setShowModal] = useState10(false);
29699
29853
  const buttonRef = useRef5(null);
29700
29854
  const modalRef = useRef5(null);
29701
29855
  useEffect9(() => {
@@ -30214,7 +30368,7 @@ import React7, {
30214
30368
  useEffect as useEffect10,
30215
30369
  useMemo as useMemo8,
30216
30370
  useRef as useRef6,
30217
- useState as useState10
30371
+ useState as useState11
30218
30372
  } from "react";
30219
30373
  import { createPortal as createPortal3 } from "react-dom";
30220
30374
  import { Fragment as Fragment4, jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
@@ -30231,15 +30385,15 @@ function QuillMultiSelectComponentWithCombo({
30231
30385
  style: style2
30232
30386
  }) {
30233
30387
  const [theme] = useContext10(ThemeContext);
30234
- const [selectedOptions, setSelectedOptions] = useState10([]);
30235
- const [showModal, setShowModal] = useState10(false);
30388
+ const [selectedOptions, setSelectedOptions] = useState11([]);
30389
+ const [showModal, setShowModal] = useState11(false);
30236
30390
  const modalRef = useRef6(null);
30237
30391
  const buttonRef = useRef6(null);
30238
30392
  const debounceTimeoutId = useRef6(null);
30239
30393
  const [searchQuery, setSearchQuery] = React7.useState("");
30240
- const [exceedsLimit, setExceedsLimit] = useState10(false);
30241
- const [popoverPosition, setPopoverPosition] = useState10(void 0);
30242
- const [z, setZ] = useState10(10);
30394
+ const [exceedsLimit, setExceedsLimit] = useState11(false);
30395
+ const [popoverPosition, setPopoverPosition] = useState11(void 0);
30396
+ const [z, setZ] = useState11(10);
30243
30397
  const scrollableParentRef = useRef6(document.body);
30244
30398
  const selectAllRef = useRef6(null);
30245
30399
  let CheckboxState;
@@ -30275,7 +30429,7 @@ function QuillMultiSelectComponentWithCombo({
30275
30429
  (elem) => elem.label ?? "-"
30276
30430
  ).join(", ");
30277
30431
  }, [options, value]);
30278
- const [selectAllCheckboxState, setSelectAllCheckboxState] = useState10(
30432
+ const [selectAllCheckboxState, setSelectAllCheckboxState] = useState11(
30279
30433
  (() => {
30280
30434
  if (value.length === 0) {
30281
30435
  return 1 /* UNSELECTED */;
@@ -30879,7 +31033,7 @@ import React8, {
30879
31033
  useContext as useContext11,
30880
31034
  useMemo as useMemo9,
30881
31035
  useRef as useRef7,
30882
- useState as useState11
31036
+ useState as useState12
30883
31037
  } from "react";
30884
31038
  import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
30885
31039
  function QuillSelectComponentWithCombo({
@@ -30893,7 +31047,7 @@ function QuillSelectComponentWithCombo({
30893
31047
  disabled
30894
31048
  }) {
30895
31049
  const [theme] = useContext11(ThemeContext);
30896
- const [showModal, setShowModal] = useState11(false);
31050
+ const [showModal, setShowModal] = useState12(false);
30897
31051
  const modalRef = useRef7(null);
30898
31052
  const buttonRef = useRef7(null);
30899
31053
  const [searchQuery, setSearchQuery] = React8.useState("");
@@ -31649,7 +31803,7 @@ var MetricDisplay = ({
31649
31803
  };
31650
31804
 
31651
31805
  // src/components/Dashboard/DataLoader.tsx
31652
- import { useContext as useContext13, useEffect as useEffect11, useMemo as useMemo11, useRef as useRef8, useState as useState12 } from "react";
31806
+ import { useContext as useContext13, useEffect as useEffect11, useMemo as useMemo11, useRef as useRef8, useState as useState13 } from "react";
31653
31807
  import equal2 from "fast-deep-equal";
31654
31808
  import { Fragment as Fragment5, jsx as jsx44 } from "react/jsx-runtime";
31655
31809
  var constructReportFromItem = (item) => {
@@ -31766,10 +31920,10 @@ function DataLoader({
31766
31920
  ) : Object.values(reportFilters[item.id] ?? {}).map((f) => f.filter);
31767
31921
  }, [dashboardFilters, reportFilters, dashboardName, item.id]);
31768
31922
  const [schemaData] = useContext13(SchemaDataContext);
31769
- const [loading, setLoading] = useState12(true);
31770
- const [error, setError] = useState12(void 0);
31771
- const [previousPage, setPreviousPage] = useState12(0);
31772
- const [additionalProcessing, setAdditionalProcessing] = useState12(defaultAdditionalProcessing);
31923
+ const [loading, setLoading] = useState13(true);
31924
+ const [error, setError] = useState13(void 0);
31925
+ const [previousPage, setPreviousPage] = useState13(0);
31926
+ const [additionalProcessing, setAdditionalProcessing] = useState13(defaultAdditionalProcessing);
31773
31927
  const chartReport = useMemo11(() => {
31774
31928
  const report = (dashboardName ? dashboard : reports)[item.id];
31775
31929
  if (report) {
@@ -31790,7 +31944,7 @@ function DataLoader({
31790
31944
  const previousUserFilters = useRef8(userFilters);
31791
31945
  const previousTenants = useRef8(tenants);
31792
31946
  const previousCustomFields = useRef8(schemaData.customFields);
31793
- const [rowCountIsLoading, setRowCountIsLoading] = useState12(false);
31947
+ const [rowCountIsLoading, setRowCountIsLoading] = useState13(false);
31794
31948
  const rowsRequestId = useRef8(0);
31795
31949
  const rowsAbortController = useRef8(null);
31796
31950
  const rowCountRequestId = useRef8(0);
@@ -32136,8 +32290,8 @@ var ChartDataLoader = ({
32136
32290
  (f) => f.filter
32137
32291
  ) : Object.values(reportFilters[item.id] ?? {}).map((f) => f.filter);
32138
32292
  }, [dashboardFilters, reportFilters, dashboardName, item.id]);
32139
- const [loading, setLoading] = useState12(true);
32140
- const [error, setError] = useState12(void 0);
32293
+ const [loading, setLoading] = useState13(true);
32294
+ const [error, setError] = useState13(void 0);
32141
32295
  const [client] = useContext13(ClientContext);
32142
32296
  const [schemaData] = useContext13(SchemaDataContext);
32143
32297
  const previousFilters = useRef8(filters);
@@ -32373,7 +32527,7 @@ import {
32373
32527
  Geography,
32374
32528
  useMapContext
32375
32529
  } from "react-simple-maps";
32376
- import { useEffect as useEffect12, useMemo as useMemo12, useRef as useRef9, useState as useState13 } from "react";
32530
+ import { useEffect as useEffect12, useMemo as useMemo12, useRef as useRef9, useState as useState14 } from "react";
32377
32531
  import { jsx as jsx45, jsxs as jsxs34 } from "react/jsx-runtime";
32378
32532
  var statesUrl = "https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json";
32379
32533
  var countriesUrl = "https://cdn.jsdelivr.net/npm/world-atlas@2/countries-50m.json";
@@ -32700,16 +32854,16 @@ function USMap({
32700
32854
  containerStyle
32701
32855
  }) {
32702
32856
  const containerRef = useRef9(null);
32703
- const [hoveredState, setHoveredState] = useState13(
32857
+ const [hoveredState, setHoveredState] = useState14(
32704
32858
  void 0
32705
32859
  );
32706
- const [hoveredCoords, setHoveredCoords] = useState13(void 0);
32860
+ const [hoveredCoords, setHoveredCoords] = useState14(void 0);
32707
32861
  const mappedData = data.reduce((acc, curr) => {
32708
32862
  acc[curr[xAxisField]?.toString()] = curr;
32709
32863
  return acc;
32710
32864
  }, {});
32711
32865
  const measureField = yAxisFields[0].field;
32712
- const [scaleLog, setScaleLog] = useState13(null);
32866
+ const [scaleLog, setScaleLog] = useState14(null);
32713
32867
  useEffect12(() => {
32714
32868
  import("d3-scale").then((scale) => {
32715
32869
  setScaleLog(() => scale.scaleLog);
@@ -32868,16 +33022,16 @@ function WorldMap({
32868
33022
  containerStyle
32869
33023
  }) {
32870
33024
  const containerRef = useRef9(null);
32871
- const [hoveredCountry, setHoveredCountry] = useState13(
33025
+ const [hoveredCountry, setHoveredCountry] = useState14(
32872
33026
  void 0
32873
33027
  );
32874
- const [hoveredCoords, setHoveredCoords] = useState13(void 0);
33028
+ const [hoveredCoords, setHoveredCoords] = useState14(void 0);
32875
33029
  const mappedData = data.reduce((acc, curr) => {
32876
33030
  acc[curr[xAxisField]?.toString()] = curr;
32877
33031
  return acc;
32878
33032
  }, {});
32879
33033
  const measureField = yAxisFields[0].field;
32880
- const [scaleLog, setScaleLog] = useState13(null);
33034
+ const [scaleLog, setScaleLog] = useState14(null);
32881
33035
  useEffect12(() => {
32882
33036
  import("d3-scale").then((scale) => {
32883
33037
  setScaleLog(() => scale.scaleLog);
@@ -33037,7 +33191,7 @@ function MapLayout({
33037
33191
  regionNames
33038
33192
  }) {
33039
33193
  const { projection } = useMapContext();
33040
- const [geoCentroid, setGeoCentroid] = useState13(null);
33194
+ const [geoCentroid, setGeoCentroid] = useState14(null);
33041
33195
  useEffect12(() => {
33042
33196
  import("d3-geo").then((geo) => {
33043
33197
  setGeoCentroid(() => geo.geoCentroid);
@@ -33090,7 +33244,7 @@ function MapLayout({
33090
33244
  }
33091
33245
 
33092
33246
  // src/components/Chart/GaugeChart.tsx
33093
- import { useEffect as useEffect13, useRef as useRef10, useState as useState14 } from "react";
33247
+ import { useEffect as useEffect13, useRef as useRef10, useState as useState15 } from "react";
33094
33248
 
33095
33249
  // ../../node_modules/d3-transition/src/selection/index.js
33096
33250
  import { selection as selection3 } from "d3-selection";
@@ -34374,9 +34528,9 @@ function D3Gauge({
34374
34528
  const firstMountRef = useRef10(true);
34375
34529
  const startAngle = -(3 * Math.PI) / 4;
34376
34530
  const totalAngle = 3 * Math.PI / 2;
34377
- const [arc, setArc] = useState14(null);
34378
- const [interpolate, setInterpolate] = useState14(null);
34379
- const [select, setSelect] = useState14(null);
34531
+ const [arc, setArc] = useState15(null);
34532
+ const [interpolate, setInterpolate] = useState15(null);
34533
+ const [select, setSelect] = useState15(null);
34380
34534
  useEffect13(() => {
34381
34535
  import("d3-shape").then(({ arc: arc2 }) => {
34382
34536
  setArc(() => arc2);
@@ -34523,7 +34677,7 @@ function D3Gauge({
34523
34677
  }
34524
34678
 
34525
34679
  // src/components/QuillComponentTables.tsx
34526
- import { useState as useState15, useEffect as useEffect14, useContext as useContext15 } from "react";
34680
+ import { useState as useState16, useEffect as useEffect14, useContext as useContext15 } from "react";
34527
34681
  import { jsx as jsx47, jsxs as jsxs35 } from "react/jsx-runtime";
34528
34682
  var QuillTableSQLEditorComponent = ({
34529
34683
  rows,
@@ -34539,8 +34693,8 @@ var QuillTableSQLEditorComponent = ({
34539
34693
  setCurrentPage,
34540
34694
  hideLabels
34541
34695
  }) => {
34542
- const [sort, setSort] = useState15({ field: "", direction: "" });
34543
- const [page, setPage] = useState15(0);
34696
+ const [sort, setSort] = useState16({ field: "", direction: "" });
34697
+ const [page, setPage] = useState16(0);
34544
34698
  return /* @__PURE__ */ jsx47(
34545
34699
  QuillTable,
34546
34700
  {
@@ -34582,8 +34736,8 @@ var QuillTableReportBuilderComponent = ({
34582
34736
  setCurrentPage,
34583
34737
  disableSort
34584
34738
  }) => {
34585
- const [sort, setSort] = useState15({ field: "", direction: "" });
34586
- const [page, setPage] = useState15(0);
34739
+ const [sort, setSort] = useState16({ field: "", direction: "" });
34740
+ const [page, setPage] = useState16(0);
34587
34741
  useEffect14(() => {
34588
34742
  if (disableSort) {
34589
34743
  setSort({ field: "", direction: "" });
@@ -34628,9 +34782,9 @@ var QuillTableComponent = ({
34628
34782
  currentPage,
34629
34783
  hideLabels
34630
34784
  }) => {
34631
- const [sort, setSort] = useState15({ field: "", direction: "" });
34632
- const [page, setPage] = useState15(0);
34633
- const [initialLoad, setInitialLoad] = useState15(true);
34785
+ const [sort, setSort] = useState16({ field: "", direction: "" });
34786
+ const [page, setPage] = useState16(0);
34787
+ const [initialLoad, setInitialLoad] = useState16(true);
34634
34788
  useEffect14(() => {
34635
34789
  if (initialLoad && !isLoading) {
34636
34790
  setInitialLoad(false);
@@ -34690,9 +34844,9 @@ function QuillTableDashboardComponent({
34690
34844
  hideName
34691
34845
  }) {
34692
34846
  const [theme] = useContext15(ThemeContext);
34693
- const [initialLoad, setInitialLoad] = useState15(true);
34847
+ const [initialLoad, setInitialLoad] = useState16(true);
34694
34848
  const { downloadCSV: downloadCSV2 } = useExport(report?.id);
34695
- const [page, setPage] = useState15(0);
34849
+ const [page, setPage] = useState16(0);
34696
34850
  useEffect14(() => {
34697
34851
  if (!isLoading) {
34698
34852
  setInitialLoad(false);
@@ -34876,7 +35030,7 @@ function Chart({
34876
35030
  if (!equal3(previousFilters.current, filters)) {
34877
35031
  previousFilters.current = filters;
34878
35032
  }
34879
- const [filterValues, setFilterValues] = useState16({});
35033
+ const [filterValues, setFilterValues] = useState17({});
34880
35034
  useEffect15(() => {
34881
35035
  setFilterValues(
34882
35036
  Object.values(reportFilters[reportId] ?? {}).reduce((acc, f) => {
@@ -34946,7 +35100,7 @@ function Chart({
34946
35100
  [reportId, allReportsById]
34947
35101
  );
34948
35102
  const report = useMemo13(() => reports[reportId], [reports, reportId]);
34949
- const [loading, setLoading] = useState16(true);
35103
+ const [loading, setLoading] = useState17(true);
34950
35104
  const [theme] = useContext16(ThemeContext);
34951
35105
  const colorMap = useMemo13(() => {
34952
35106
  if (mapColorsToFields && report && theme) {
@@ -34954,7 +35108,7 @@ function Chart({
34954
35108
  }
34955
35109
  }, [report, theme]);
34956
35110
  const [client, clientLoading] = useContext16(ClientContext);
34957
- const [error, setError] = useState16(void 0);
35111
+ const [error, setError] = useState17(void 0);
34958
35112
  const updateFilter = (filter, value, comparison) => {
34959
35113
  let filterValue = {};
34960
35114
  if (filter.filterType === "string" /* String */) {
@@ -35244,7 +35398,8 @@ var ChartDisplay = ({
35244
35398
  onClickChartElement,
35245
35399
  overrideTheme,
35246
35400
  referenceLines,
35247
- showLegend = false
35401
+ showLegend = false,
35402
+ tableRowsLoading = false
35248
35403
  }) => {
35249
35404
  const { downloadCSV: downloadCSV2 } = useExport(reportId);
35250
35405
  const [theme] = useContext16(ThemeContext);
@@ -35276,7 +35431,7 @@ var ChartDisplay = ({
35276
35431
  }
35277
35432
  return void 0;
35278
35433
  }, [config, specificReportFilters, specificDashboardFilters]);
35279
- const [page, setPage] = useState16(0);
35434
+ const [page, setPage] = useState17(0);
35280
35435
  if (loading) {
35281
35436
  return /* @__PURE__ */ jsx48("div", { className, style: containerStyle, children: /* @__PURE__ */ jsx48(LoadingComponent, {}) });
35282
35437
  } else if (config && !["metric", "table", "gauge", "US map", "World map"].includes(
@@ -35339,7 +35494,8 @@ var ChartDisplay = ({
35339
35494
  },
35340
35495
  onSortChange: (sort) => {
35341
35496
  onSortChange && onSortChange(sort);
35342
- }
35497
+ },
35498
+ isLoading: tableRowsLoading
35343
35499
  }
35344
35500
  );
35345
35501
  }
@@ -35702,7 +35858,7 @@ function QuillChartComponent({
35702
35858
  }
35703
35859
 
35704
35860
  // src/components/Dashboard/TemplateChartComponent.tsx
35705
- import { useState as useState17 } from "react";
35861
+ import { useState as useState18 } from "react";
35706
35862
  import { jsx as jsx51 } from "react/jsx-runtime";
35707
35863
  function QuillTemplateChartComponent({
35708
35864
  report,
@@ -35710,7 +35866,7 @@ function QuillTemplateChartComponent({
35710
35866
  children,
35711
35867
  isLoading
35712
35868
  }) {
35713
- const [isSelected, setIsSelected] = useState17(false);
35869
+ const [isSelected, setIsSelected] = useState18(false);
35714
35870
  return /* @__PURE__ */ jsx51(
35715
35871
  "div",
35716
35872
  {
@@ -35795,7 +35951,7 @@ import {
35795
35951
  useEffect as useEffect16,
35796
35952
  useMemo as useMemo14,
35797
35953
  useRef as useRef12,
35798
- useState as useState18
35954
+ useState as useState19
35799
35955
  } from "react";
35800
35956
  import { Fragment as Fragment8, jsx as jsx53, jsxs as jsxs39 } from "react/jsx-runtime";
35801
35957
  var QuillSecondaryButton = ({ children, ...props }) => {
@@ -36288,9 +36444,9 @@ var FilterPopoverWrapper = ({
36288
36444
  }) => {
36289
36445
  const { tenants } = useContext19(TenantContext);
36290
36446
  const { eventTracking } = useContext19(EventTrackingContext);
36291
- const [isOpen, setIsOpen] = useState18(false);
36292
- const [uniqueValues, setUniqueValues] = useState18(void 0);
36293
- const [uniqueValuesIsLoading, setUniqueValuesIsLoading] = useState18(false);
36447
+ const [isOpen, setIsOpen] = useState19(false);
36448
+ const [uniqueValues, setUniqueValues] = useState19(void 0);
36449
+ const [uniqueValuesIsLoading, setUniqueValuesIsLoading] = useState19(false);
36294
36450
  const prevFiltersRef = useRef12("");
36295
36451
  const columnInternals = useMemo14(() => {
36296
36452
  if (!tables) {
@@ -36385,7 +36541,7 @@ var FilterPopoverWrapper = ({
36385
36541
  };
36386
36542
 
36387
36543
  // src/components/ReportBuilder/FilterModal.tsx
36388
- import { useState as useState19, useEffect as useEffect17, useMemo as useMemo15 } from "react";
36544
+ import { useState as useState20, useEffect as useEffect17, useMemo as useMemo15 } from "react";
36389
36545
  import { format as format8, isValid as isValid5, parse as parse4, startOfToday as startOfToday2 } from "date-fns";
36390
36546
  import { Fragment as Fragment9, jsx as jsx54, jsxs as jsxs40 } from "react/jsx-runtime";
36391
36547
  function FilterModal({
@@ -36405,26 +36561,26 @@ function FilterModal({
36405
36561
  MultiSelectComponent,
36406
36562
  reportBuilderColumns
36407
36563
  }) {
36408
- const [field, setField] = useState19("");
36409
- const [fieldOptions, setFieldOptions] = useState19([]);
36410
- const [fieldValues, setFieldValues] = useState19([]);
36411
- const [type, setType] = useState19(null);
36412
- const [value, setValue] = useState19(void 0);
36413
- const [selectedOptions, setSelectedOptions] = useState19([]);
36414
- const [operator, setOperator] = useState19(
36564
+ const [field, setField] = useState20("");
36565
+ const [fieldOptions, setFieldOptions] = useState20([]);
36566
+ const [fieldValues, setFieldValues] = useState20([]);
36567
+ const [type, setType] = useState20(null);
36568
+ const [value, setValue] = useState20(void 0);
36569
+ const [selectedOptions, setSelectedOptions] = useState20([]);
36570
+ const [operator, setOperator] = useState20(
36415
36571
  void 0
36416
36572
  );
36417
- const [operatorOptions, setOperatorOptions] = useState19([]);
36418
- const [unit, setUnit] = useState19("");
36419
- const [unitOptions, setUnitOptions] = useState19([]);
36420
- const [startDate, setStartDate] = useState19(
36573
+ const [operatorOptions, setOperatorOptions] = useState20([]);
36574
+ const [unit, setUnit] = useState20("");
36575
+ const [unitOptions, setUnitOptions] = useState20([]);
36576
+ const [startDate, setStartDate] = useState20(
36421
36577
  startOfToday2().toISOString().substring(0, 10)
36422
36578
  );
36423
- const [endDate, setEndDate] = useState19(
36579
+ const [endDate, setEndDate] = useState20(
36424
36580
  startOfToday2().toISOString().substring(0, 10)
36425
36581
  );
36426
- const [filterInitialized, setFilterInitialized] = useState19(false);
36427
- const [table, setTable] = useState19(void 0);
36582
+ const [filterInitialized, setFilterInitialized] = useState20(false);
36583
+ const [table, setTable] = useState20(void 0);
36428
36584
  const memoizedFieldValuesMap = useMemo15(
36429
36585
  () => fieldValuesMap,
36430
36586
  [JSON.stringify(fieldValuesMap)]
@@ -37185,7 +37341,7 @@ function FilterModal({
37185
37341
  }
37186
37342
 
37187
37343
  // src/components/Dashboard/TemplateMetricComponent.tsx
37188
- import { useState as useState20 } from "react";
37344
+ import { useState as useState21 } from "react";
37189
37345
  import { jsx as jsx55 } from "react/jsx-runtime";
37190
37346
  function QuillTemplateMetricComponent({
37191
37347
  report,
@@ -37193,7 +37349,7 @@ function QuillTemplateMetricComponent({
37193
37349
  children,
37194
37350
  isLoading
37195
37351
  }) {
37196
- const [isSelected, setIsSelected] = useState20(false);
37352
+ const [isSelected, setIsSelected] = useState21(false);
37197
37353
  return /* @__PURE__ */ jsx55(
37198
37354
  "div",
37199
37355
  {
@@ -37222,7 +37378,7 @@ function QuillTemplateMetricComponent({
37222
37378
  }
37223
37379
 
37224
37380
  // src/components/Dashboard/TemplateTableComponent.tsx
37225
- import { useState as useState21 } from "react";
37381
+ import { useState as useState22 } from "react";
37226
37382
  import { jsx as jsx56 } from "react/jsx-runtime";
37227
37383
  function QuillTemplateTableComponent({
37228
37384
  report,
@@ -37233,7 +37389,7 @@ function QuillTemplateTableComponent({
37233
37389
  onPageChange,
37234
37390
  onSortChange
37235
37391
  }) {
37236
- const [isSelected, setIsSelected] = useState21(false);
37392
+ const [isSelected, setIsSelected] = useState22(false);
37237
37393
  return /* @__PURE__ */ jsx56(
37238
37394
  "div",
37239
37395
  {
@@ -37445,8 +37601,8 @@ function Dashboard({
37445
37601
  templateDashboardName,
37446
37602
  pagination = { rowsPerPage: 10, rowsPerRequest: 50 }
37447
37603
  }) {
37448
- const [userFilters, setUserFilters] = useState22({});
37449
- const [selectedSection, setSelectedSection] = useState22("");
37604
+ const [userFilters, setUserFilters] = useState23({});
37605
+ const [selectedSection, setSelectedSection] = useState23("");
37450
37606
  const dataLoaderUserFilters = useMemo16(() => {
37451
37607
  return (filters?.map((f) => convertCustomFilter(f)) ?? []).concat(
37452
37608
  Object.values(userFilters)
@@ -37577,21 +37733,21 @@ function Dashboard({
37577
37733
  const { dispatch: dashboardFiltersDispatch } = useContext20(
37578
37734
  DashboardFiltersContext
37579
37735
  );
37580
- const [fieldValuesMap, setFieldValuesMap] = useState22({});
37581
- const [fieldValuesIsLoaded, setFieldValuesIsLoaded] = useState22(false);
37582
- const [addFilterPopoverIsOpen, setAddFilterPopoverIsOpen] = useState22(false);
37583
- const [filterListIsOpen, setFilterListIsOpen] = useState22(false);
37736
+ const [fieldValuesMap, setFieldValuesMap] = useState23({});
37737
+ const [fieldValuesIsLoaded, setFieldValuesIsLoaded] = useState23(false);
37738
+ const [addFilterPopoverIsOpen, setAddFilterPopoverIsOpen] = useState23(false);
37739
+ const [filterListIsOpen, setFilterListIsOpen] = useState23(false);
37584
37740
  const [
37585
37741
  filterListAddFilterPopoverIsOpen,
37586
37742
  setFilterListAddFilterPopoverIsOpen
37587
- ] = useState22(false);
37743
+ ] = useState23(false);
37588
37744
  const presetOptions = useMemo16(() => {
37589
37745
  return populatedDashboardFilters?.[0]?.filterType === "date_range" ? convertPresetOptionsToSelectableList(
37590
37746
  populatedDashboardFilters[0].presetOptions ?? [],
37591
37747
  populatedDashboardFilters[0].defaultPresetRanges ?? []
37592
37748
  ) : defaultOptionsV2;
37593
37749
  }, [populatedDashboardFilters]);
37594
- const [filterValues, setFilterValues] = useState22({});
37750
+ const [filterValues, setFilterValues] = useState23({});
37595
37751
  const prevNameRef = useRef13(name2);
37596
37752
  const prevFlagsRef = useRef13(flags);
37597
37753
  const prevClientRef = useRef13(client?.publicKey ?? "");
@@ -38490,10 +38646,10 @@ function QuillDashboardTemplate({
38490
38646
  const { dashboardConfig, dashboardConfigDispatch } = useContext20(
38491
38647
  DashboardConfigContext
38492
38648
  );
38493
- const [addItemModalIsOpen, setAddItemModalIsOpen] = useState22(false);
38494
- const [selectedTemplates, setSelectedTemplates] = useState22([]);
38495
- const [selectingTemplate, setSelectingTemplate] = useState22(false);
38496
- const [submittingTemplate, setSubmittingTemplate] = useState22(false);
38649
+ const [addItemModalIsOpen, setAddItemModalIsOpen] = useState23(false);
38650
+ const [selectedTemplates, setSelectedTemplates] = useState23([]);
38651
+ const [selectingTemplate, setSelectingTemplate] = useState23(false);
38652
+ const [submittingTemplate, setSubmittingTemplate] = useState23(false);
38497
38653
  const templateSections = data?.sections;
38498
38654
  const onSubmitTemplates = async () => {
38499
38655
  setSubmittingTemplate(true);
@@ -38639,7 +38795,7 @@ import {
38639
38795
  useContext as useContext21,
38640
38796
  useEffect as useEffect19,
38641
38797
  useMemo as useMemo17,
38642
- useState as useState23
38798
+ useState as useState24
38643
38799
  } from "react";
38644
38800
  import { jsx as jsx59 } from "react/jsx-runtime";
38645
38801
  var Table = ({
@@ -38655,7 +38811,7 @@ var Table = ({
38655
38811
  const [schemaData] = useContext21(SchemaDataContext);
38656
38812
  const { eventTracking } = useContext21(EventTrackingContext);
38657
38813
  const { allReportsById } = useAllReports();
38658
- const [loading, setLoading] = useState23(false);
38814
+ const [loading, setLoading] = useState24(false);
38659
38815
  const report = useMemo17(() => {
38660
38816
  return props.reportId ? allReportsById[props.reportId] : null;
38661
38817
  }, [allReportsById[props.reportId ?? ""]]);
@@ -38742,7 +38898,7 @@ var Table = ({
38742
38898
  clientLoading,
38743
38899
  !reports[props.reportId ?? ""]
38744
38900
  ]);
38745
- const [page, setPage] = useState23(0);
38901
+ const [page, setPage] = useState24(0);
38746
38902
  if ("rows" in data && "columns" in data) {
38747
38903
  return /* @__PURE__ */ jsx59(
38748
38904
  QuillTable,
@@ -38803,7 +38959,7 @@ var Table_default = Table;
38803
38959
 
38804
38960
  // src/SQLEditor.tsx
38805
38961
  import {
38806
- useState as useState29,
38962
+ useState as useState30,
38807
38963
  useContext as useContext28,
38808
38964
  useEffect as useEffect24,
38809
38965
  useRef as useRef18,
@@ -38816,7 +38972,7 @@ import MonacoEditor from "@monaco-editor/react";
38816
38972
  import {
38817
38973
  useEffect as useEffect22,
38818
38974
  useRef as useRef17,
38819
- useState as useState27,
38975
+ useState as useState28,
38820
38976
  useContext as useContext26,
38821
38977
  useMemo as useMemo21
38822
38978
  } from "react";
@@ -38826,7 +38982,7 @@ import {
38826
38982
  useCallback as useCallback2,
38827
38983
  useContext as useContext23,
38828
38984
  useMemo as useMemo18,
38829
- useState as useState24,
38985
+ useState as useState25,
38830
38986
  useEffect as useEffect20,
38831
38987
  useRef as useRef14
38832
38988
  } from "react";
@@ -39280,41 +39436,41 @@ var PivotModal = ({
39280
39436
  heightAdjustment = 0
39281
39437
  }) => {
39282
39438
  const { getToken, quillFetchWithToken } = useContext23(FetchContext);
39283
- const [isLoading, setIsLoading] = useState24(false);
39284
- const [previewLoading, setPreviewLoading] = useState24(false);
39285
- const [selectedPivotType, setSelectedPivotType] = useState24("recommended");
39286
- const [errors, setErrors] = useState24([]);
39439
+ const [isLoading, setIsLoading] = useState25(false);
39440
+ const [previewLoading, setPreviewLoading] = useState25(false);
39441
+ const [selectedPivotType, setSelectedPivotType] = useState25("recommended");
39442
+ const [errors, setErrors] = useState25([]);
39287
39443
  const [client] = useContext23(ClientContext);
39288
39444
  const [schemaData] = useContext23(SchemaDataContext);
39289
39445
  const { tenants } = useContext23(TenantContext);
39290
39446
  const { eventTracking } = useContext23(EventTrackingContext);
39291
39447
  const rowFieldRef = useRef14(null);
39292
39448
  const colFieldRef = useRef14(null);
39293
- const [pivotCardWidth, setPivotCardWidth] = useState24(420);
39294
- const [samplePivotTable, setSamplePivotTable] = useState24(null);
39295
- const [hasNoRecommendedPivots, sethasNoRecommendedPivots] = useState24(false);
39296
- const [isFetchingPivots, setIsFetchingPivots] = useState24(false);
39297
- const [allowedColumnFields, setAllowedColumnFields] = useState24([]);
39298
- const [allowedRowFields, setAllowedRowFields] = useState24([]);
39299
- const [allowedValueFields, setAllowedValueFields] = useState24([]);
39300
- const [uniqueValues, setUniqueValues] = useState24(initialUniqueValues);
39449
+ const [pivotCardWidth, setPivotCardWidth] = useState25(420);
39450
+ const [samplePivotTable, setSamplePivotTable] = useState25(null);
39451
+ const [hasNoRecommendedPivots, sethasNoRecommendedPivots] = useState25(false);
39452
+ const [isFetchingPivots, setIsFetchingPivots] = useState25(false);
39453
+ const [allowedColumnFields, setAllowedColumnFields] = useState25([]);
39454
+ const [allowedRowFields, setAllowedRowFields] = useState25([]);
39455
+ const [allowedValueFields, setAllowedValueFields] = useState25([]);
39456
+ const [uniqueValues, setUniqueValues] = useState25(initialUniqueValues);
39301
39457
  const buttonRef = useRef14(null);
39302
- const [dateRanges, setDateRanges] = useState24({});
39303
- const [pivotError, setPivotError] = useState24("");
39304
- const [limitInput, setLimitInput] = useState24(
39458
+ const [dateRanges, setDateRanges] = useState25({});
39459
+ const [pivotError, setPivotError] = useState25("");
39460
+ const [limitInput, setLimitInput] = useState25(
39305
39461
  pivotLimit?.toString() ?? "100"
39306
39462
  );
39307
- const [sortFieldInput, setSortFieldInput] = useState24(
39463
+ const [sortFieldInput, setSortFieldInput] = useState25(
39308
39464
  pivotSort?.sortField ?? ""
39309
39465
  );
39310
- const [sortDirectionInput, setSortDirectionInput] = useState24(
39466
+ const [sortDirectionInput, setSortDirectionInput] = useState25(
39311
39467
  pivotSort?.sortDirection ?? "ASC"
39312
39468
  );
39313
- const [showLimitInput, setShowLimitInput] = useState24(!!pivotLimit);
39314
- const [showSortInput, setShowSortInput] = useState24(!!pivotSort);
39315
- const [availableHeight, setAvailableHeight] = useState24(0);
39316
- const [pivotModalTopHeight, setPivotModalTopHeight] = useState24(450);
39317
- const [popoverPosition, setPopoverPosition] = useState24(
39469
+ const [showLimitInput, setShowLimitInput] = useState25(!!pivotLimit);
39470
+ const [showSortInput, setShowSortInput] = useState25(!!pivotSort);
39471
+ const [availableHeight, setAvailableHeight] = useState25(0);
39472
+ const [pivotModalTopHeight, setPivotModalTopHeight] = useState25(450);
39473
+ const [popoverPosition, setPopoverPosition] = useState25(
39318
39474
  "bottom"
39319
39475
  );
39320
39476
  const popoverRef = useRef14(null);
@@ -39592,7 +39748,7 @@ var PivotModal = ({
39592
39748
  return map;
39593
39749
  }, {});
39594
39750
  }, [columns]);
39595
- const [selectedPivotTable, setSelectedPivotTable] = useState24(null);
39751
+ const [selectedPivotTable, setSelectedPivotTable] = useState25(null);
39596
39752
  useEffect20(() => {
39597
39753
  const fetchPivotTables = async () => {
39598
39754
  if (selectedPivotIndex === -1) {
@@ -40100,10 +40256,10 @@ var PivotModal = ({
40100
40256
  }
40101
40257
  }, 500);
40102
40258
  };
40103
- const [recommendedPivotTables, setRecommendedPivotTables] = useState24(
40259
+ const [recommendedPivotTables, setRecommendedPivotTables] = useState25(
40104
40260
  []
40105
40261
  );
40106
- const [createdPivotTables, setCreatedPivotTables] = useState24([]);
40262
+ const [createdPivotTables, setCreatedPivotTables] = useState25([]);
40107
40263
  useEffect20(() => {
40108
40264
  const fetchPivotTables = async () => {
40109
40265
  const pts = await Promise.all(
@@ -40988,7 +41144,7 @@ var validateReport = (formData, dashboardData, defaultDateFilter, allTables) =>
40988
41144
 
40989
41145
  // src/components/Chart/InternalChart.tsx
40990
41146
  import {
40991
- useState as useState25,
41147
+ useState as useState26,
40992
41148
  useEffect as useEffect21,
40993
41149
  useContext as useContext24,
40994
41150
  useMemo as useMemo19,
@@ -41135,7 +41291,7 @@ function InternalChart({
41135
41291
  reportDateFilter.defaultPresetRanges ?? []
41136
41292
  ) : defaultOptionsV2;
41137
41293
  }, [reportDateFilter]);
41138
- const [filterValues, setFilterValues] = useState25({});
41294
+ const [filterValues, setFilterValues] = useState26({});
41139
41295
  useEffect21(() => {
41140
41296
  if (reportDateFilter) {
41141
41297
  const customDateFilter = filters?.find(
@@ -41244,9 +41400,9 @@ function InternalChart({
41244
41400
  }));
41245
41401
  onDashboardFilterChange(filter.label, filterValue);
41246
41402
  };
41247
- const [filtersExpanded, setFiltersExpanded] = useState25(false);
41403
+ const [filtersExpanded, setFiltersExpanded] = useState26(false);
41248
41404
  const filtersContainerRef = useRef15(null);
41249
- const [visibleFilters, setVisibleFilters] = useState25([]);
41405
+ const [visibleFilters, setVisibleFilters] = useState26([]);
41250
41406
  const filtersOverflowing = useMemo19(() => {
41251
41407
  return visibleFilters.some((visible) => visible);
41252
41408
  }, [visibleFilters]);
@@ -41539,7 +41695,7 @@ import React13, {
41539
41695
  useContext as useContext25,
41540
41696
  useMemo as useMemo20,
41541
41697
  useRef as useRef16,
41542
- useState as useState26
41698
+ useState as useState27
41543
41699
  } from "react";
41544
41700
  import { Fragment as Fragment12, jsx as jsx64, jsxs as jsxs46 } from "react/jsx-runtime";
41545
41701
  function QuillMultiSelectSectionList({
@@ -41557,7 +41713,7 @@ function QuillMultiSelectSectionList({
41557
41713
  owner
41558
41714
  }) {
41559
41715
  const [theme] = useContext25(ThemeContext);
41560
- const [showModal, setShowModal] = useState26(false);
41716
+ const [showModal, setShowModal] = useState27(false);
41561
41717
  const modalRef = useRef16(null);
41562
41718
  const buttonRef = useRef16(null);
41563
41719
  const debounceTimeoutId = useRef16(null);
@@ -42173,14 +42329,14 @@ function createReportFromForm(formData, report, eventTracking, selectedPivotTabl
42173
42329
  }
42174
42330
  function ChartBuilderWithModal(props) {
42175
42331
  const parentRef = useRef17(null);
42176
- const [modalWidth, setModalWidth] = useState27(200);
42177
- const [modalHeight, setModalHeight] = useState27(200);
42332
+ const [modalWidth, setModalWidth] = useState28(200);
42333
+ const [modalHeight, setModalHeight] = useState28(200);
42178
42334
  const { isOpen, setIsOpen, title, isHorizontalView } = props;
42179
42335
  const Modal = props.ModalComponent ?? MemoizedModal;
42180
42336
  const { dashboardReports: dashboard } = useDashboardReports(
42181
42337
  props.destinationDashboard
42182
42338
  );
42183
- const [filtersEnabledState, setFiltersEnabledState] = useState27(
42339
+ const [filtersEnabledState, setFiltersEnabledState] = useState28(
42184
42340
  !!props.reportId
42185
42341
  );
42186
42342
  useEffect22(() => {
@@ -42295,16 +42451,16 @@ function ChartBuilder({
42295
42451
  const report = useMemo21(() => {
42296
42452
  return reportId && !tempReport ? allReportsById[reportId] : tempReport;
42297
42453
  }, [reportId]);
42298
- const [windowWidth, setWindowWidth] = useState27(1200);
42299
- const [rows, setRows] = useState27(report?.rows ?? []);
42300
- const [itemQuery, setItemQuery] = useState27(report?.itemQuery);
42301
- const [rowCount, setRowCount] = useState27(report?.rowCount ?? 0);
42302
- const [maxPage, setMaxPage] = useState27(0);
42303
- const [isLoading, setIsLoading] = useState27(false);
42304
- const [rowCountIsLoading, setRowCountIsLoading] = useState27(false);
42305
- const [isSubmitting, setIsSubmitting] = useState27(false);
42306
- const [pivotCardWidth, setPivotCardWidth] = useState27(665);
42307
- const [formWidth, setFormWidth] = useState27(665);
42454
+ const [windowWidth, setWindowWidth] = useState28(1200);
42455
+ const [rows, setRows] = useState28(report?.rows ?? []);
42456
+ const [itemQuery, setItemQuery] = useState28(report?.itemQuery);
42457
+ const [rowCount, setRowCount] = useState28(report?.rowCount ?? 0);
42458
+ const [maxPage, setMaxPage] = useState28(0);
42459
+ const [isLoading, setIsLoading] = useState28(false);
42460
+ const [rowCountIsLoading, setRowCountIsLoading] = useState28(false);
42461
+ const [isSubmitting, setIsSubmitting] = useState28(false);
42462
+ const [pivotCardWidth, setPivotCardWidth] = useState28(665);
42463
+ const [formWidth, setFormWidth] = useState28(665);
42308
42464
  const inputRef = useRef17(null);
42309
42465
  const selectRef = useRef17(null);
42310
42466
  const processColumns = (columns2) => {
@@ -42336,10 +42492,10 @@ function ChartBuilder({
42336
42492
  }
42337
42493
  return columns2;
42338
42494
  };
42339
- const [processedColumns, setProcessedColumns] = useState27(
42495
+ const [processedColumns, setProcessedColumns] = useState28(
42340
42496
  processColumns(report?.columnInternal ?? [])
42341
42497
  );
42342
- const [currentPage, setCurrentPage] = useState27(0);
42498
+ const [currentPage, setCurrentPage] = useState28(0);
42343
42499
  const parentRef = useRef17(null);
42344
42500
  const deleteRef = useRef17(null);
42345
42501
  const modalPadding = 20;
@@ -42386,7 +42542,7 @@ function ChartBuilder({
42386
42542
  window.removeEventListener("resize", handleResize);
42387
42543
  };
42388
42544
  }, [isOpen]);
42389
- const [dashboardOptions, setDashboardOptions] = useState27([]);
42545
+ const [dashboardOptions, setDashboardOptions] = useState28([]);
42390
42546
  const {
42391
42547
  reportFilters,
42392
42548
  loadFiltersForReport,
@@ -42395,7 +42551,7 @@ function ChartBuilder({
42395
42551
  } = useContext26(ReportFiltersContext);
42396
42552
  const { reportsDispatch } = useContext26(ReportsContext);
42397
42553
  const initialFilters = useRef17(reportFilters[report?.id ?? TEMP_REPORT_ID]);
42398
- const [reportFiltersLoaded, setReportFiltersLoaded] = useState27(!filtersEnabled);
42554
+ const [reportFiltersLoaded, setReportFiltersLoaded] = useState28(!filtersEnabled);
42399
42555
  useEffect22(() => {
42400
42556
  if (!reportFilters[report?.id ?? TEMP_REPORT_ID]) {
42401
42557
  loadFiltersForReport(
@@ -42429,20 +42585,20 @@ function ChartBuilder({
42429
42585
  (f) => f.filter
42430
42586
  );
42431
42587
  }, [reportFilters, report?.id]);
42432
- const [showFilterModal, setShowFilterModal] = useState27(false);
42433
- const [filterIssues, setFilterIssues] = useState27([]);
42434
- const [showPivotPopover, setShowPivotPopover] = useState27(false);
42435
- const [isEdittingPivot, setIsEdittingPivot] = useState27(false);
42436
- const [selectedPivotIndex, setSelectedPivotIndex] = useState27(-1);
42437
- const [tableName, setTableName] = useState27(void 0);
42438
- const [includeCustomFields, setIncludeCustomFields] = useState27(
42588
+ const [showFilterModal, setShowFilterModal] = useState28(false);
42589
+ const [filterIssues, setFilterIssues] = useState28([]);
42590
+ const [showPivotPopover, setShowPivotPopover] = useState28(false);
42591
+ const [isEdittingPivot, setIsEdittingPivot] = useState28(false);
42592
+ const [selectedPivotIndex, setSelectedPivotIndex] = useState28(-1);
42593
+ const [tableName, setTableName] = useState28(void 0);
42594
+ const [includeCustomFields, setIncludeCustomFields] = useState28(
42439
42595
  report ? !!report.includeCustomFields : !!client?.featureFlags?.customFieldsEnabled
42440
42596
  );
42441
42597
  const selectedTable = schemaData.schema?.find(
42442
42598
  (t) => t.displayName === tableName
42443
42599
  );
42444
- const [pivotPopUpTitle, setPivotPopUpTitle] = useState27("Add pivot");
42445
- const [pivotError, setPivotError] = useState27(void 0);
42600
+ const [pivotPopUpTitle, setPivotPopUpTitle] = useState28("Add pivot");
42601
+ const [pivotError, setPivotError] = useState28(void 0);
42446
42602
  const pivotData = report?.pivotRows && report?.pivotColumns ? {
42447
42603
  rows: report.pivotRows,
42448
42604
  columns: report.pivotColumns,
@@ -42453,19 +42609,19 @@ function ChartBuilder({
42453
42609
  const columns = report?.columnInternal ?? [];
42454
42610
  const destinationDashboardName = report?.dashboardName || destinationDashboard;
42455
42611
  const query = report?.queryString;
42456
- const [loadingFormData, setLoadingFormData] = useState27(false);
42457
- const [triggeredEditChart, setTriggeredEditChart] = useState27(false);
42458
- const [createdPivots, setCreatedPivots] = useState27(
42612
+ const [loadingFormData, setLoadingFormData] = useState28(false);
42613
+ const [triggeredEditChart, setTriggeredEditChart] = useState28(false);
42614
+ const [createdPivots, setCreatedPivots] = useState28(
42459
42615
  report?.pivot ? [report.pivot] : cp
42460
42616
  );
42461
- const [recommendedPivots, setRecommendedPivots] = useState27(rp);
42462
- const [pivotRowField, setPivotRowField] = useState27(
42617
+ const [recommendedPivots, setRecommendedPivots] = useState28(rp);
42618
+ const [pivotRowField, setPivotRowField] = useState28(
42463
42619
  report?.pivot?.rowField
42464
42620
  );
42465
- const [pivotColumnField, setPivotColumnField] = useState27(
42621
+ const [pivotColumnField, setPivotColumnField] = useState28(
42466
42622
  report?.pivot?.columnField
42467
42623
  );
42468
- const [pivotAggregations, setPivotAggregations] = useState27(
42624
+ const [pivotAggregations, setPivotAggregations] = useState28(
42469
42625
  report?.pivot?.aggregations ?? [
42470
42626
  {
42471
42627
  valueField: report?.pivot?.valueField,
@@ -42474,10 +42630,10 @@ function ChartBuilder({
42474
42630
  }
42475
42631
  ]
42476
42632
  );
42477
- const [pivotLimit, setPivotLimit] = useState27(
42633
+ const [pivotLimit, setPivotLimit] = useState28(
42478
42634
  report?.pivot?.rowLimit
42479
42635
  );
42480
- const [pivotSort, setPivotSort] = useState27(
42636
+ const [pivotSort, setPivotSort] = useState28(
42481
42637
  report?.pivot?.sort && report?.pivot?.sortDirection && report?.pivot?.sortField ? {
42482
42638
  sortField: report.pivot.sortField,
42483
42639
  sortDirection: report.pivot.sortDirection
@@ -42490,16 +42646,16 @@ function ChartBuilder({
42490
42646
  rowsPerRequest: report?.chartType === "table" ? 50 : 500
42491
42647
  }
42492
42648
  };
42493
- const [currentProcessing, setCurrentProcessing] = useState27(baseProcessing);
42494
- const [customTenantAccess, setCustomTenantAccess] = useState27(
42649
+ const [currentProcessing, setCurrentProcessing] = useState28(baseProcessing);
42650
+ const [customTenantAccess, setCustomTenantAccess] = useState28(
42495
42651
  !!Object.values(report?.flags ?? {}).length
42496
42652
  );
42497
- const [dateFieldOptions, setDateFieldOptions] = useState27([]);
42498
- const [allTables, setAllTables] = useState27([]);
42499
- const [customFieldTableRef, setCustomFieldTableRef] = useState27(false);
42500
- const [referencedColumns, setReferencedColumns] = useState27({});
42501
- const [referencedColumnsWithoutStar, setReferencedColumnsWithoutStar] = useState27({});
42502
- const [filterMap, setFilterMap] = useState27(report?.filterMap ?? {});
42653
+ const [dateFieldOptions, setDateFieldOptions] = useState28([]);
42654
+ const [allTables, setAllTables] = useState28([]);
42655
+ const [customFieldTableRef, setCustomFieldTableRef] = useState28(false);
42656
+ const [referencedColumns, setReferencedColumns] = useState28({});
42657
+ const [referencedColumnsWithoutStar, setReferencedColumnsWithoutStar] = useState28({});
42658
+ const [filterMap, setFilterMap] = useState28(report?.filterMap ?? {});
42503
42659
  const canonicalFilterMap = useMemo21(() => {
42504
42660
  return Object.fromEntries(
42505
42661
  Object.entries(filterMap).filter(
@@ -42526,7 +42682,7 @@ function ChartBuilder({
42526
42682
  {}
42527
42683
  );
42528
42684
  }, [specificDashboardFilters, filterMap, allTables]);
42529
- const [formFlags, setFormFlags] = useState27(
42685
+ const [formFlags, setFormFlags] = useState28(
42530
42686
  report?.flags ? Object.fromEntries(
42531
42687
  Object.entries(report.flags).map(([key, value]) => {
42532
42688
  if (value === ALL_TENANTS) {
@@ -42543,7 +42699,7 @@ function ChartBuilder({
42543
42699
  })
42544
42700
  ) : void 0
42545
42701
  );
42546
- const [defaultDateField, setDefaultDateField] = useState27({
42702
+ const [defaultDateField, setDefaultDateField] = useState28({
42547
42703
  table: dateFieldOptions[0]?.name || "",
42548
42704
  field: dateFieldOptions[0]?.columns[0]?.field || ""
42549
42705
  });
@@ -42701,7 +42857,7 @@ function ChartBuilder({
42701
42857
  }
42702
42858
  return chartBuilderData;
42703
42859
  };
42704
- const [formData, setFormData] = useState27(
42860
+ const [formData, setFormData] = useState28(
42705
42861
  formFormDataFromReport(report, destinationSection ?? getCurrentSection())
42706
42862
  );
42707
42863
  const reportCustomFields = useMemo21(() => {
@@ -42755,7 +42911,7 @@ function ChartBuilder({
42755
42911
  const columnsObservedInRows = rows[0] ? Object.keys(rows[0]) : [];
42756
42912
  return columns.filter((col) => !columnsObservedInRows.includes(col.field));
42757
42913
  }, [rows]);
42758
- const [chartTypes, setChartTypes] = useState27(
42914
+ const [chartTypes, setChartTypes] = useState28(
42759
42915
  (() => {
42760
42916
  const data = formFormDataFromReport(
42761
42917
  report,
@@ -42971,7 +43127,7 @@ function ChartBuilder({
42971
43127
  {}
42972
43128
  ) ?? {};
42973
43129
  }, [client?.allTenantTypes]);
42974
- const [selectedPivotTable, setSelectedPivotTable] = useState27(pivotData);
43130
+ const [selectedPivotTable, setSelectedPivotTable] = useState28(pivotData);
42975
43131
  const pivotCardTable = useMemo21(() => {
42976
43132
  return {
42977
43133
  pivot: formData.pivot,
@@ -45593,7 +45749,7 @@ var createDebounce = (func, delay) => {
45593
45749
  };
45594
45750
 
45595
45751
  // src/hooks/useLongLoading.tsx
45596
- import { useContext as useContext27, useEffect as useEffect23, useState as useState28 } from "react";
45752
+ import { useContext as useContext27, useEffect as useEffect23, useState as useState29 } from "react";
45597
45753
  function useLongLoading(isLoading, meta) {
45598
45754
  const {
45599
45755
  origin,
@@ -45601,8 +45757,8 @@ function useLongLoading(isLoading, meta) {
45601
45757
  abnormalLoadTime = 15e3,
45602
45758
  loadDescription
45603
45759
  } = meta;
45604
- const [isLongLoading, setIsLongLoading] = useState28(false);
45605
- const [isAbnormalLoading, setIsAbnormalLoading] = useState28(false);
45760
+ const [isLongLoading, setIsLongLoading] = useState29(false);
45761
+ const [isAbnormalLoading, setIsAbnormalLoading] = useState29(false);
45606
45762
  const { eventTracking } = useContext27(EventTrackingContext);
45607
45763
  useEffect23(() => {
45608
45764
  let longTimer = null;
@@ -45780,7 +45936,7 @@ function SQLEditor({
45780
45936
  onClickChartElement,
45781
45937
  onRequestAddVirtualTable
45782
45938
  }) {
45783
- const [sqlPrompt, setSqlPrompt] = useState29("");
45939
+ const [sqlPrompt, setSqlPrompt] = useState30("");
45784
45940
  const [client] = useContext28(ClientContext);
45785
45941
  const [theme] = useContext28(ThemeContext);
45786
45942
  const { tenants } = useContext28(TenantContext);
@@ -45795,9 +45951,9 @@ function SQLEditor({
45795
45951
  const destinationDashboardConfig = useMemo22(() => {
45796
45952
  return dashboards?.find((d) => d.name === destinationDashboard);
45797
45953
  }, [dashboards, destinationDashboard]);
45798
- const [query, setQuery] = useState29(defaultQuery);
45799
- const [rows, setRows] = useState29([]);
45800
- const [columns, setColumns] = useState29([]);
45954
+ const [query, setQuery] = useState30(defaultQuery);
45955
+ const [rows, setRows] = useState30([]);
45956
+ const [columns, setColumns] = useState30([]);
45801
45957
  const [schemaData] = useContext28(SchemaDataContext);
45802
45958
  const { dashboardFilters } = useContext28(DashboardFiltersContext);
45803
45959
  const specificDashboardFilters = useMemo22(() => {
@@ -45805,37 +45961,37 @@ function SQLEditor({
45805
45961
  dashboardFilters[report?.dashboardName ?? destinationDashboard ?? ""] ?? {}
45806
45962
  ).map((f) => f.filter);
45807
45963
  }, [dashboardFilters, destinationDashboard]);
45808
- const [errorMessage, setErrorMessage] = useState29("");
45809
- const [sqlResponseLoading, setSqlResponseLoading] = useState29(false);
45964
+ const [errorMessage, setErrorMessage] = useState30("");
45965
+ const [sqlResponseLoading, setSqlResponseLoading] = useState30(false);
45810
45966
  useLongLoading(sqlResponseLoading, {
45811
45967
  origin: "SQLEditor",
45812
45968
  loadDescription: "Loading SQL response"
45813
45969
  });
45814
- const [sqlQueryLoading, setSqlQueryLoading] = useState29(false);
45970
+ const [sqlQueryLoading, setSqlQueryLoading] = useState30(false);
45815
45971
  useLongLoading(sqlQueryLoading, {
45816
45972
  origin: "SQLEditor",
45817
45973
  loadDescription: "Loading SQL query"
45818
45974
  });
45819
- const [isChartBuilderOpen, setIsChartBuilderOpen] = useState29(false);
45820
- const [displayTable, setDisplayTable] = useState29(false);
45821
- const [formattedRows, setFormattedRows] = useState29([]);
45975
+ const [isChartBuilderOpen, setIsChartBuilderOpen] = useState30(false);
45976
+ const [displayTable, setDisplayTable] = useState30(false);
45977
+ const [formattedRows, setFormattedRows] = useState30([]);
45822
45978
  const formRef = useRef18(null);
45823
45979
  const sidebarRef = useRef18(null);
45824
- const [searchBarWidth, setSearchBarWidth] = useState29(200);
45825
- const [showSearchBar, setShowSearchBar] = useState29(false);
45826
- const [filterBarWidth, setFilterBarWidth] = useState29(200);
45827
- const [rowCount, setRowCount] = useState29(void 0);
45828
- const [rowCountIsLoading, setRowCountIsLoading] = useState29(false);
45829
- const [maxPage, setMaxPage] = useState29(1);
45830
- const [tableSearchQuery, setTableSearchQuery] = useState29("");
45831
- const [lastSuccessfulQuery, setLastSuccessfulQuery] = useState29("");
45832
- const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = useState29(false);
45833
- const [tempReport, setTempReport] = useState29({
45980
+ const [searchBarWidth, setSearchBarWidth] = useState30(200);
45981
+ const [showSearchBar, setShowSearchBar] = useState30(false);
45982
+ const [filterBarWidth, setFilterBarWidth] = useState30(200);
45983
+ const [rowCount, setRowCount] = useState30(void 0);
45984
+ const [rowCountIsLoading, setRowCountIsLoading] = useState30(false);
45985
+ const [maxPage, setMaxPage] = useState30(1);
45986
+ const [tableSearchQuery, setTableSearchQuery] = useState30("");
45987
+ const [lastSuccessfulQuery, setLastSuccessfulQuery] = useState30("");
45988
+ const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = useState30(false);
45989
+ const [tempReport, setTempReport] = useState30({
45834
45990
  ...EMPTY_INTERNAL_REPORT,
45835
45991
  ...report
45836
45992
  });
45837
45993
  const tableRef = useRef18(null);
45838
- const [cachedHeight, setCachedHeight] = useState29(0);
45994
+ const [cachedHeight, setCachedHeight] = useState30(0);
45839
45995
  const DEFAULT_ROWS_PER_PAGE = 5;
45840
45996
  const ROW_HEIGHT = 37;
45841
45997
  const TABLE_TAB_HEIGHT = 75;
@@ -45872,8 +46028,8 @@ function SQLEditor({
45872
46028
  rowsPerPage * 10
45873
46029
  )
45874
46030
  };
45875
- const [currentPage, setCurrentPage] = useState29(0);
45876
- const [currentSort, setCurrentSort] = useState29(void 0);
46031
+ const [currentPage, setCurrentPage] = useState30(0);
46032
+ const [currentSort, setCurrentSort] = useState30(void 0);
45877
46033
  const currentProcessing = useMemo22(() => {
45878
46034
  return {
45879
46035
  page: {
@@ -46777,7 +46933,7 @@ var SQLEditorComponent = ({
46777
46933
  loading,
46778
46934
  LoadingComponent = QuillLoadingComponent
46779
46935
  }) => {
46780
- const [editorKey, setEditorKey] = useState29(0);
46936
+ const [editorKey, setEditorKey] = useState30(0);
46781
46937
  const { eventTracking } = useContext28(EventTrackingContext);
46782
46938
  const currentProvider = useRef18(null);
46783
46939
  useEffect24(() => {
@@ -47021,7 +47177,7 @@ function SchemaItem({
47021
47177
  index,
47022
47178
  onClick
47023
47179
  }) {
47024
- const [isOpen, setIsOpen] = useState29(index === 0);
47180
+ const [isOpen, setIsOpen] = useState30(index === 0);
47025
47181
  const schemaContainerStyle = {
47026
47182
  display: "flex",
47027
47183
  flexDirection: "column"
@@ -47252,11 +47408,11 @@ import {
47252
47408
  useContext as useContext32,
47253
47409
  useEffect as useEffect28,
47254
47410
  useRef as useRef20,
47255
- useState as useState35
47411
+ useState as useState36
47256
47412
  } from "react";
47257
47413
 
47258
47414
  // src/hooks/useReportBuilder.tsx
47259
- import { useContext as useContext29, useEffect as useEffect25, useMemo as useMemo23, useState as useState30 } from "react";
47415
+ import { useContext as useContext29, useEffect as useEffect25, useMemo as useMemo23, useState as useState31 } from "react";
47260
47416
  var useReportBuilderInternal = ({
47261
47417
  reportId,
47262
47418
  initialTableName,
@@ -47298,18 +47454,18 @@ var useReportBuilderInternal = ({
47298
47454
  rowsPerPage: _rowsPerPage,
47299
47455
  rowsPerRequest: _rowsPerRequest
47300
47456
  };
47301
- const [openPopover, setOpenPopover] = useState30(null);
47302
- const [aiPrompt, setAiPrompt] = useState30("");
47303
- const [reportBuilderLoading, setReportBuilderLoading] = useState30(false);
47304
- const [tableLoading, setTableLoading] = useState30(false);
47305
- const [errorMessage, setErrorMessage] = useState30("");
47306
- const [unresolvedReportMessage, setUnresolvedReportMessage] = useState30("");
47307
- const [tables, setTables] = useState30([]);
47308
- const [columns, setColumns] = useState30([]);
47309
- const [filterStack, setFilterStack] = useState30([]);
47310
- const [pivot, setPivot] = useState30(null);
47311
- const [sort, setSort] = useState30([]);
47312
- const [limit, setLimit] = useState30(null);
47457
+ const [openPopover, setOpenPopover] = useState31(null);
47458
+ const [aiPrompt, setAiPrompt] = useState31("");
47459
+ const [reportBuilderLoading, setReportBuilderLoading] = useState31(false);
47460
+ const [tableLoading, setTableLoading] = useState31(false);
47461
+ const [errorMessage, setErrorMessage] = useState31("");
47462
+ const [unresolvedReportMessage, setUnresolvedReportMessage] = useState31("");
47463
+ const [tables, setTables] = useState31([]);
47464
+ const [columns, setColumns] = useState31([]);
47465
+ const [filterStack, setFilterStack] = useState31([]);
47466
+ const [pivot, setPivot] = useState31(null);
47467
+ const [sort, setSort] = useState31([]);
47468
+ const [limit, setLimit] = useState31(null);
47313
47469
  const reportBuilderState = useMemo23(() => {
47314
47470
  return {
47315
47471
  tables,
@@ -47320,30 +47476,30 @@ var useReportBuilderInternal = ({
47320
47476
  limit
47321
47477
  };
47322
47478
  }, [columns, filterStack, limit, pivot, sort, tables]);
47323
- const [stateStack, setStateStack] = useState30([]);
47324
- const [poppedStateStack, setPoppedStateStack] = useState30([]);
47325
- const [activeQuery, setActiveQuery] = useState30("");
47326
- const [queryOutOfSync, setQueryOutOfSync] = useState30(false);
47327
- const [unfilteredUniqueValues, setUnfilteredUniqueValues] = useState30({});
47328
- const [unfilteredUniqueValuesIsLoading, setUnfilteredUniqueValuesIsLoading] = useState30(false);
47329
- const [filteredUniqueValues, setFilteredUniqueValues] = useState30(null);
47330
- const [filteredUniqueValuesIsLoading, setFilteredUniqueValuesIsLoading] = useState30(false);
47331
- const [columnUniqueValues, setColumnUniqueValues] = useState30({});
47332
- const [dateRanges, setDateRanges] = useState30(null);
47333
- const [tempReport, setTempReport] = useState30({
47479
+ const [stateStack, setStateStack] = useState31([]);
47480
+ const [poppedStateStack, setPoppedStateStack] = useState31([]);
47481
+ const [activeQuery, setActiveQuery] = useState31("");
47482
+ const [queryOutOfSync, setQueryOutOfSync] = useState31(false);
47483
+ const [unfilteredUniqueValues, setUnfilteredUniqueValues] = useState31({});
47484
+ const [unfilteredUniqueValuesIsLoading, setUnfilteredUniqueValuesIsLoading] = useState31(false);
47485
+ const [filteredUniqueValues, setFilteredUniqueValues] = useState31(null);
47486
+ const [filteredUniqueValuesIsLoading, setFilteredUniqueValuesIsLoading] = useState31(false);
47487
+ const [columnUniqueValues, setColumnUniqueValues] = useState31({});
47488
+ const [dateRanges, setDateRanges] = useState31(null);
47489
+ const [tempReport, setTempReport] = useState31({
47334
47490
  ...EMPTY_INTERNAL_REPORT,
47335
47491
  pagination: REPORT_BUILDER_PAGINATION
47336
47492
  });
47337
- const [currentProcessing, setCurrentProcessing] = useState30({
47493
+ const [currentProcessing, setCurrentProcessing] = useState31({
47338
47494
  page: REPORT_BUILDER_PAGINATION
47339
47495
  });
47340
- const [previousPage, setPreviousPage] = useState30(0);
47341
- const [reportColumns, setReportColumns] = useState30([]);
47342
- const [reportRows, setReportRows] = useState30([]);
47343
- const [formattedRows, setFormattedRows] = useState30([]);
47344
- const [pivotData, setPivotData] = useState30(null);
47345
- const [numberOfRows, setNumberOfRows] = useState30(0);
47346
- const [rowCountIsLoading, setRowCountIsLoading] = useState30(false);
47496
+ const [previousPage, setPreviousPage] = useState31(0);
47497
+ const [reportColumns, setReportColumns] = useState31([]);
47498
+ const [reportRows, setReportRows] = useState31([]);
47499
+ const [formattedRows, setFormattedRows] = useState31([]);
47500
+ const [pivotData, setPivotData] = useState31(null);
47501
+ const [numberOfRows, setNumberOfRows] = useState31(0);
47502
+ const [rowCountIsLoading, setRowCountIsLoading] = useState31(false);
47347
47503
  const reportColumnsToStateColumns = useMemo23(() => {
47348
47504
  const positionMap = {};
47349
47505
  columns.forEach((column, index) => {
@@ -47362,28 +47518,28 @@ var useReportBuilderInternal = ({
47362
47518
  }
47363
47519
  });
47364
47520
  }, [columns, reportColumns]);
47365
- const [pivotRowField, setPivotRowField] = useState30(
47521
+ const [pivotRowField, setPivotRowField] = useState31(
47366
47522
  void 0
47367
47523
  );
47368
- const [pivotColumnField, setPivotColumnField] = useState30(
47524
+ const [pivotColumnField, setPivotColumnField] = useState31(
47369
47525
  void 0
47370
47526
  );
47371
- const [pivotAggregations, setPivotAggregations] = useState30([]);
47372
- const [pivotLimit, setPivotLimit] = useState30(void 0);
47373
- const [pivotSort, setPivotSort] = useState30(void 0);
47374
- const [pivotHint, setPivotHint] = useState30("");
47375
- const [pivotError, setPivotError] = useState30("");
47376
- const [createdPivots, setCreatedPivots] = useState30([]);
47377
- const [recommendedPivots, setRecommendedPivots] = useState30([]);
47378
- const [pivotPopUpTitle, setPivotPopUpTitle] = useState30("Add pivot");
47379
- const [showPivotPopover, setShowPivotPopover] = useState30(false);
47380
- const [isEditingPivot, setIsEditingPivot] = useState30(false);
47381
- const [selectedPivotIndex, setSelectedPivotIndex] = useState30(-1);
47527
+ const [pivotAggregations, setPivotAggregations] = useState31([]);
47528
+ const [pivotLimit, setPivotLimit] = useState31(void 0);
47529
+ const [pivotSort, setPivotSort] = useState31(void 0);
47530
+ const [pivotHint, setPivotHint] = useState31("");
47531
+ const [pivotError, setPivotError] = useState31("");
47532
+ const [createdPivots, setCreatedPivots] = useState31([]);
47533
+ const [recommendedPivots, setRecommendedPivots] = useState31([]);
47534
+ const [pivotPopUpTitle, setPivotPopUpTitle] = useState31("Add pivot");
47535
+ const [showPivotPopover, setShowPivotPopover] = useState31(false);
47536
+ const [isEditingPivot, setIsEditingPivot] = useState31(false);
47537
+ const [selectedPivotIndex, setSelectedPivotIndex] = useState31(-1);
47382
47538
  const [
47383
47539
  pivotRecommendationsEnabledState,
47384
47540
  setPivotRecommendationsEnabledState
47385
- ] = useState30(pivotRecommendationsEnabled);
47386
- const [askAILoading, setAskAILoading] = useState30(false);
47541
+ ] = useState31(pivotRecommendationsEnabled);
47542
+ const [askAILoading, setAskAILoading] = useState31(false);
47387
47543
  const loading = reportBuilderLoading || tableLoading;
47388
47544
  useLongLoading(reportBuilderLoading, {
47389
47545
  origin: "ReportBuilder",
@@ -48766,7 +48922,7 @@ var useReportBuilder = ({
48766
48922
  };
48767
48923
 
48768
48924
  // src/components/ReportBuilder/AddColumnModal.tsx
48769
- import { useState as useState31, useRef as useRef19, useMemo as useMemo24, useEffect as useEffect26, useContext as useContext30 } from "react";
48925
+ import { useState as useState32, useRef as useRef19, useMemo as useMemo24, useEffect as useEffect26, useContext as useContext30 } from "react";
48770
48926
  import {
48771
48927
  DndContext,
48772
48928
  closestCenter,
@@ -48799,14 +48955,14 @@ function AddColumnModal({
48799
48955
  LoadingComponent = QuillLoadingComponent,
48800
48956
  onRequestAddVirtualTable
48801
48957
  }) {
48802
- const [primaryTable, setPrimaryTable] = useState31(
48958
+ const [primaryTable, setPrimaryTable] = useState32(
48803
48959
  selectedTables[0]?.name
48804
48960
  );
48805
48961
  const [theme] = useContext30(ThemeContext);
48806
- const [search, setSearch] = useState31("");
48807
- const [initialLoad, setInitialLoad] = useState31(true);
48962
+ const [search, setSearch] = useState32("");
48963
+ const [initialLoad, setInitialLoad] = useState32(true);
48808
48964
  const textInputContainerRef = useRef19(null);
48809
- const [modalSelectedColumns, setModalSelectedColumns] = useState31(
48965
+ const [modalSelectedColumns, setModalSelectedColumns] = useState32(
48810
48966
  selectedColumns.map((col) => `${col.table}.${col.field}`)
48811
48967
  );
48812
48968
  const columnOptions = useMemo24(() => {
@@ -48833,7 +48989,7 @@ function AddColumnModal({
48833
48989
  })
48834
48990
  );
48835
48991
  }, [schema, primaryTable]);
48836
- const [orderedColumnNames, setOrderedColumnNames] = useState31([]);
48992
+ const [orderedColumnNames, setOrderedColumnNames] = useState32([]);
48837
48993
  const isSelectedAllColumns = columnOptions.length === modalSelectedColumns.length;
48838
48994
  const searchResults = useMemo24(() => {
48839
48995
  return orderedColumnNames.filter((column) => {
@@ -49725,7 +49881,7 @@ var AddFilters = ({
49725
49881
  };
49726
49882
 
49727
49883
  // src/internals/ReportBuilder/PivotForm.tsx
49728
- import { useContext as useContext31, useEffect as useEffect27, useState as useState32 } from "react";
49884
+ import { useContext as useContext31, useEffect as useEffect27, useState as useState33 } from "react";
49729
49885
  import { jsx as jsx73, jsxs as jsxs53 } from "react/jsx-runtime";
49730
49886
  function PivotForm({
49731
49887
  pivotRowField,
@@ -49752,21 +49908,21 @@ function PivotForm({
49752
49908
  isLoading,
49753
49909
  pivotHint
49754
49910
  }) {
49755
- const [allowedColumnFields, setAllowedColumnFields] = useState32([]);
49756
- const [allowedRowFields, setAllowedRowFields] = useState32([]);
49757
- const [allowedValueFields, setAllowedValueFields] = useState32([]);
49911
+ const [allowedColumnFields, setAllowedColumnFields] = useState33([]);
49912
+ const [allowedRowFields, setAllowedRowFields] = useState33([]);
49913
+ const [allowedValueFields, setAllowedValueFields] = useState33([]);
49758
49914
  const [theme] = useContext31(ThemeContext);
49759
- const [limitInput, setLimitInput] = useState32(
49915
+ const [limitInput, setLimitInput] = useState33(
49760
49916
  pivotLimit?.toString() ?? ""
49761
49917
  );
49762
- const [sortFieldInput, setSortFieldInput] = useState32(
49918
+ const [sortFieldInput, setSortFieldInput] = useState33(
49763
49919
  pivotSort?.sortField ?? ""
49764
49920
  );
49765
- const [sortDirectionInput, setSortDirectionInput] = useState32(
49921
+ const [sortDirectionInput, setSortDirectionInput] = useState33(
49766
49922
  pivotSort?.sortDirection ?? ""
49767
49923
  );
49768
- const [showLimitInput, setShowLimitInput] = useState32(!!pivotLimit);
49769
- const [showSortInput, setShowSortInput] = useState32(!!pivotSort);
49924
+ const [showLimitInput, setShowLimitInput] = useState33(!!pivotLimit);
49925
+ const [showSortInput, setShowSortInput] = useState33(!!pivotSort);
49770
49926
  useEffect27(() => {
49771
49927
  if (uniqueValues) {
49772
49928
  const possibleColumns = getPossiblePivotFieldOptions(
@@ -50395,7 +50551,7 @@ var AddPivot = ({
50395
50551
  };
50396
50552
 
50397
50553
  // src/components/ReportBuilder/AddLimitPopover.tsx
50398
- import { useState as useState33 } from "react";
50554
+ import { useState as useState34 } from "react";
50399
50555
  import { Fragment as Fragment14, jsx as jsx75, jsxs as jsxs55 } from "react/jsx-runtime";
50400
50556
  var LimitSentence = ({
50401
50557
  limit,
@@ -50410,7 +50566,7 @@ var LimitSentence = ({
50410
50566
  SecondaryButton = MemoizedSecondaryButton,
50411
50567
  disabled = false
50412
50568
  }) => {
50413
- const [isOpen, setIsOpen] = useState33(false);
50569
+ const [isOpen, setIsOpen] = useState34(false);
50414
50570
  const handleClickDelete = () => {
50415
50571
  setOpenPopover(null);
50416
50572
  handleDelete();
@@ -50452,7 +50608,7 @@ var AddLimitPopover = ({
50452
50608
  Button = MemoizedButton,
50453
50609
  SecondaryButton = MemoizedSecondaryButton
50454
50610
  }) => {
50455
- const [limit, setLimit] = useState33(initialLimit.toString());
50611
+ const [limit, setLimit] = useState34(initialLimit.toString());
50456
50612
  const MAX_LIMIT = 2147483647;
50457
50613
  return /* @__PURE__ */ jsxs55("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
50458
50614
  /* @__PURE__ */ jsx75(
@@ -50693,7 +50849,7 @@ var AddLimit = ({
50693
50849
  };
50694
50850
 
50695
50851
  // src/components/ReportBuilder/AddSortPopover.tsx
50696
- import { useState as useState34 } from "react";
50852
+ import { useState as useState35 } from "react";
50697
50853
  import { Fragment as Fragment15, jsx as jsx77, jsxs as jsxs57 } from "react/jsx-runtime";
50698
50854
  var SORT_VALUE_TO_LABEL = {
50699
50855
  ASC: "ascending",
@@ -50716,7 +50872,7 @@ var SortSentence = ({
50716
50872
  SecondaryButton = MemoizedSecondaryButton,
50717
50873
  disabled = false
50718
50874
  }) => {
50719
- const [isOpen, setIsOpen] = useState34(false);
50875
+ const [isOpen, setIsOpen] = useState35(false);
50720
50876
  const handleSetIsOpen = (isOpen2) => {
50721
50877
  setIsOpen(isOpen2);
50722
50878
  };
@@ -50768,8 +50924,8 @@ var AddSortPopover = ({
50768
50924
  Button = MemoizedButton,
50769
50925
  SecondaryButton = MemoizedSecondaryButton
50770
50926
  }) => {
50771
- const [sortColumn, setSortColumn] = useState34(column || "");
50772
- const [sortDirection, setSortDirection] = useState34(
50927
+ const [sortColumn, setSortColumn] = useState35(column || "");
50928
+ const [sortDirection, setSortDirection] = useState35(
50773
50929
  direction || "ASC"
50774
50930
  );
50775
50931
  return /* @__PURE__ */ jsxs57("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
@@ -51222,10 +51378,10 @@ function ReportBuilder({
51222
51378
  const [theme] = useContext32(ThemeContext);
51223
51379
  const parentRef = useRef20(null);
51224
51380
  const askAIContainerRef = useRef20(null);
51225
- const [askAIInputWidth, setAskAIInputWidth] = useState35(-1);
51226
- const [isCopying, setIsCopying] = useState35(false);
51227
- const [isChartBuilderOpen, setIsChartBuilderOpen] = useState35(false);
51228
- const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = useState35(false);
51381
+ const [askAIInputWidth, setAskAIInputWidth] = useState36(-1);
51382
+ const [isCopying, setIsCopying] = useState36(false);
51383
+ const [isChartBuilderOpen, setIsChartBuilderOpen] = useState36(false);
51384
+ const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = useState36(false);
51229
51385
  const reportBuilder = useReportBuilderInternal({
51230
51386
  reportId,
51231
51387
  initialTableName,
@@ -51714,7 +51870,7 @@ import {
51714
51870
  useEffect as useEffect29,
51715
51871
  useMemo as useMemo26,
51716
51872
  useRef as useRef21,
51717
- useState as useState36
51873
+ useState as useState37
51718
51874
  } from "react";
51719
51875
  import { jsx as jsx82 } from "react/jsx-runtime";
51720
51876
  function ChartEditor({
@@ -51757,8 +51913,8 @@ function ChartEditor({
51757
51913
  onClickChartError
51758
51914
  }) {
51759
51915
  const parentRef = useRef21(null);
51760
- const [modalWidth, setModalWidth] = useState36(200);
51761
- const [modalHeight, setModalHeight] = useState36(200);
51916
+ const [modalWidth, setModalWidth] = useState37(200);
51917
+ const [modalHeight, setModalHeight] = useState37(200);
51762
51918
  const { addReport } = useDashboardReports(destinationDashboard);
51763
51919
  const { allReportsById } = useAllReports();
51764
51920
  const { tenants, flags } = useContext33(TenantContext);
@@ -51776,8 +51932,8 @@ function ChartEditor({
51776
51932
  (f) => f.filter
51777
51933
  );
51778
51934
  }, [dashboardFilters]);
51779
- const [filtersEnabled, setFiltersEnabled] = useState36(true);
51780
- const [chartBuilderKey, setChartBuilderKey] = useState36(0);
51935
+ const [filtersEnabled, setFiltersEnabled] = useState37(true);
51936
+ const [chartBuilderKey, setChartBuilderKey] = useState37(0);
51781
51937
  const dateFilter = Object.values(specificDashboardFilters).find(
51782
51938
  (filter) => filter.filterType === "date_range"
51783
51939
  );
@@ -51914,11 +52070,32 @@ function StaticChart({
51914
52070
  containerStyle,
51915
52071
  showLegend = false
51916
52072
  }) {
51917
- const { report, loading } = useDashboardReport(reportId);
52073
+ const {
52074
+ report,
52075
+ loading,
52076
+ pageNumber,
52077
+ pageLoading,
52078
+ nextPage,
52079
+ prevPage,
52080
+ sortRows
52081
+ } = useDashboardReportInternal(reportId);
51918
52082
  const mergedStyle = {
51919
52083
  ...report?.chartType ? CHART_TYPE_STYLES[report.chartType] || DEFAULT_STYLE : DEFAULT_STYLE,
51920
52084
  ...containerStyle
51921
52085
  };
52086
+ const onPageChange = (page) => {
52087
+ if (page == pageNumber - 1) {
52088
+ prevPage();
52089
+ } else if (page == pageNumber + 1) {
52090
+ nextPage();
52091
+ }
52092
+ };
52093
+ const onSortChange = (sort) => {
52094
+ sortRows({
52095
+ field: sort.field,
52096
+ direction: sort.direction
52097
+ });
52098
+ };
51922
52099
  return /* @__PURE__ */ jsx83(
51923
52100
  ChartDisplay,
51924
52101
  {
@@ -51930,7 +52107,10 @@ function StaticChart({
51930
52107
  onClickChartElement,
51931
52108
  loading,
51932
52109
  containerStyle: mergedStyle,
51933
- showLegend
52110
+ showLegend,
52111
+ onPageChange,
52112
+ tableRowsLoading: pageLoading,
52113
+ onSortChange
51934
52114
  }
51935
52115
  );
51936
52116
  }
@@ -51974,7 +52154,7 @@ var useTenants = (dashboardName) => {
51974
52154
  };
51975
52155
 
51976
52156
  // src/hooks/useQuill.ts
51977
- import { useContext as useContext35, useEffect as useEffect31, useMemo as useMemo27, useState as useState37 } from "react";
52157
+ import { useContext as useContext35, useEffect as useEffect31, useMemo as useMemo27, useState as useState38 } from "react";
51978
52158
  var useQuill = (reportId, pagination) => {
51979
52159
  const { reports, reportsDispatch, fetchIndividualReport } = useContext35(ReportsContext);
51980
52160
  const { allReportsById } = useAllReports();
@@ -51994,9 +52174,9 @@ var useQuill = (reportId, pagination) => {
51994
52174
  const [client, isClientLoading] = useContext35(ClientContext);
51995
52175
  const { tenants } = useContext35(TenantContext);
51996
52176
  const { eventTracking } = useContext35(EventTrackingContext);
51997
- const [loading, setLoading] = useState37(true);
51998
- const [error, setError] = useState37(void 0);
51999
- const [previousPage, setPreviousPage] = useState37(0);
52177
+ const [loading, setLoading] = useState38(true);
52178
+ const [error, setError] = useState38(void 0);
52179
+ const [previousPage, setPreviousPage] = useState38(0);
52000
52180
  const processedReport = useMemo27(() => {
52001
52181
  return reportId && allReportsById[reportId] ? convertInternalReportToReport(
52002
52182
  mergeComparisonRange(allReportsById[reportId]),
@@ -52005,7 +52185,7 @@ var useQuill = (reportId, pagination) => {
52005
52185
  "useQuill"
52006
52186
  ) : void 0;
52007
52187
  }, [reportId, reportId && allReportsById[reportId], specificReportFilters]);
52008
- const [additionalProcessing, setAdditionProcessing] = useState37(
52188
+ const [additionalProcessing, setAdditionProcessing] = useState38(
52009
52189
  pagination ? {
52010
52190
  page: pagination
52011
52191
  } : void 0
@@ -52220,7 +52400,7 @@ var useMemoizedRows = (reportId) => {
52220
52400
  };
52221
52401
 
52222
52402
  // src/hooks/useAskQuill.tsx
52223
- import { useContext as useContext36, useEffect as useEffect32, useState as useState38 } from "react";
52403
+ import { useContext as useContext36, useEffect as useEffect32, useState as useState39 } from "react";
52224
52404
  function convertColumnInternalToAskQuillColumn(columns) {
52225
52405
  return columns.map((column) => {
52226
52406
  let convertedFieldType = FieldType.String;
@@ -52249,8 +52429,8 @@ var useAskQuill = (dashboardName) => {
52249
52429
  const { tenants } = useContext36(TenantContext);
52250
52430
  const { getToken } = useContext36(FetchContext);
52251
52431
  const { eventTracking } = useContext36(EventTrackingContext);
52252
- const [astInfo, setAstInfo] = useState38(void 0);
52253
- const [data, setData] = useState38({
52432
+ const [astInfo, setAstInfo] = useState39(void 0);
52433
+ const [data, setData] = useState39({
52254
52434
  rows: [],
52255
52435
  columns: [],
52256
52436
  pivot: null,
@@ -52260,9 +52440,9 @@ var useAskQuill = (dashboardName) => {
52260
52440
  pivotColumnFields: [],
52261
52441
  pivotValueFields: []
52262
52442
  });
52263
- const [loading, setLoading] = useState38(false);
52264
- const [error, setError] = useState38(void 0);
52265
- const [ask, setAsk] = useState38(
52443
+ const [loading, setLoading] = useState39(false);
52444
+ const [error, setError] = useState39(void 0);
52445
+ const [ask, setAsk] = useState39(
52266
52446
  async () => void 0
52267
52447
  );
52268
52448
  const askHelper = async (query) => {
@@ -52476,13 +52656,13 @@ var useAskQuill = (dashboardName) => {
52476
52656
  };
52477
52657
 
52478
52658
  // src/hooks/useVirtualTables.tsx
52479
- import { useContext as useContext37, useState as useState39 } from "react";
52659
+ import { useContext as useContext37, useState as useState40 } from "react";
52480
52660
  var useVirtualTables = () => {
52481
52661
  const [schemaData, setSchemaData] = useContext37(SchemaDataContext);
52482
52662
  const { tenants } = useContext37(TenantContext);
52483
52663
  const { getToken, quillFetchWithToken } = useContext37(FetchContext);
52484
52664
  const { eventTracking } = useContext37(EventTrackingContext);
52485
- const [loadingTables, setLoadingTables] = useState39({});
52665
+ const [loadingTables, setLoadingTables] = useState40({});
52486
52666
  const handleReload = async (client, caller) => {
52487
52667
  setSchemaData({ ...schemaData, isSchemaLoading: true });
52488
52668
  setLoadingTables(