@quillsql/react 2.16.4 → 2.16.5

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
@@ -19405,19 +19405,19 @@ var require_pluralize = __commonJS({
19405
19405
  // src/Dashboard.tsx
19406
19406
  import {
19407
19407
  useContext as useContext20,
19408
- useEffect as useEffect18,
19409
- useState as useState23,
19408
+ useEffect as useEffect19,
19409
+ useState as useState24,
19410
19410
  useMemo as useMemo16,
19411
- useRef as useRef13
19411
+ useRef as useRef14
19412
19412
  } from "react";
19413
19413
 
19414
19414
  // src/Chart.tsx
19415
19415
  import {
19416
- useState as useState17,
19417
- useEffect as useEffect15,
19416
+ useState as useState18,
19417
+ useEffect as useEffect16,
19418
19418
  useContext as useContext16,
19419
19419
  useMemo as useMemo13,
19420
- useRef as useRef11
19420
+ useRef as useRef12
19421
19421
  } from "react";
19422
19422
 
19423
19423
  // src/utils/csv.ts
@@ -25559,15 +25559,15 @@ var PieChart_default = PieChartWrapper;
25559
25559
 
25560
25560
  // src/components/QuillTable.tsx
25561
25561
  init_valueFormatter();
25562
- import { useContext as useContext5, useEffect as useEffect7, useState as useState8 } from "react";
25562
+ import { useContext as useContext5, useEffect as useEffect8, useState as useState9 } from "react";
25563
25563
 
25564
25564
  // src/components/UiComponents.tsx
25565
25565
  import {
25566
25566
  forwardRef,
25567
25567
  useContext as useContext4,
25568
- useEffect as useEffect6,
25569
- useRef as useRef3,
25570
- useState as useState7
25568
+ useEffect as useEffect7,
25569
+ useRef as useRef4,
25570
+ useState as useState8
25571
25571
  } from "react";
25572
25572
 
25573
25573
  // src/assets/ArrowDownHeadIcon.tsx
@@ -25819,6 +25819,146 @@ import { useEffect as useEffect4, useState as useState5 } from "react";
25819
25819
  // src/hooks/useSelectOnKeyDown.tsx
25820
25820
  import { useEffect as useEffect5, useState as useState6 } from "react";
25821
25821
 
25822
+ // src/hooks/useResponsiveFirstChildWidth.ts
25823
+ import {
25824
+ useEffect as useEffect6,
25825
+ useLayoutEffect,
25826
+ useRef as useRef3,
25827
+ useState as useState7
25828
+ } from "react";
25829
+ var DEFAULT_MIN_WIDTH = 0;
25830
+ var parseNumericValue = (value) => {
25831
+ if (!value) {
25832
+ return 0;
25833
+ }
25834
+ const parsed = parseFloat(value);
25835
+ return Number.isFinite(parsed) ? parsed : 0;
25836
+ };
25837
+ var getHorizontalGap = (element, explicitGap) => {
25838
+ if (typeof explicitGap === "number") {
25839
+ return explicitGap;
25840
+ }
25841
+ const computedStyle = window.getComputedStyle(element);
25842
+ const columnGap = parseNumericValue(computedStyle.columnGap);
25843
+ if (columnGap > 0) {
25844
+ return columnGap;
25845
+ }
25846
+ const genericGap = parseNumericValue(computedStyle.gap);
25847
+ return genericGap;
25848
+ };
25849
+ var calculateFirstChildWidth = (element, options) => {
25850
+ const { gap, minWidth, maxWidth } = options;
25851
+ const computedStyle = window.getComputedStyle(element);
25852
+ const horizontalPadding = parseNumericValue(computedStyle.paddingLeft) + parseNumericValue(computedStyle.paddingRight);
25853
+ const availableWidth = Math.max(
25854
+ 0,
25855
+ element.clientWidth - horizontalPadding
25856
+ );
25857
+ const children = Array.from(element.children);
25858
+ if (!children.length) {
25859
+ return Math.max(minWidth ?? DEFAULT_MIN_WIDTH, 0);
25860
+ }
25861
+ const siblings = children.slice(1);
25862
+ const gapCount = Math.max(children.length - 1, 0);
25863
+ const effectiveGap = getHorizontalGap(element, gap) * gapCount;
25864
+ let siblingsWidth = 0;
25865
+ siblings.forEach((child) => {
25866
+ const rect = child.getBoundingClientRect();
25867
+ const childStyle = window.getComputedStyle(child);
25868
+ siblingsWidth += rect.width + parseNumericValue(childStyle.marginLeft) + parseNumericValue(childStyle.marginRight);
25869
+ });
25870
+ const rawWidth = Math.max(0, availableWidth - siblingsWidth - effectiveGap);
25871
+ const min2 = Math.max(minWidth ?? DEFAULT_MIN_WIDTH, 0);
25872
+ const max2 = typeof maxWidth === "number" && Number.isFinite(maxWidth) ? Math.max(maxWidth, min2) : void 0;
25873
+ const clampedWidth = max2 !== void 0 ? Math.min(Math.max(rawWidth, min2), max2) : Math.max(rawWidth, min2);
25874
+ return Math.floor(clampedWidth);
25875
+ };
25876
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect6;
25877
+ var useResponsiveFirstChildWidth = (containerRef, options = {}) => {
25878
+ const {
25879
+ gap,
25880
+ initialWidth = -1,
25881
+ minWidth = DEFAULT_MIN_WIDTH,
25882
+ maxWidth
25883
+ } = options;
25884
+ const [width, setWidth] = useState7(initialWidth);
25885
+ const previousWidthRef = useRef3(initialWidth);
25886
+ useIsomorphicLayoutEffect(() => {
25887
+ const element = containerRef?.current ?? null;
25888
+ if (!element || typeof window === "undefined") {
25889
+ return;
25890
+ }
25891
+ let frameId = null;
25892
+ const updateWidth = () => {
25893
+ if (!element.isConnected) {
25894
+ return;
25895
+ }
25896
+ const nextWidth = calculateFirstChildWidth(element, {
25897
+ gap,
25898
+ minWidth,
25899
+ maxWidth
25900
+ });
25901
+ if (frameId !== null) {
25902
+ cancelAnimationFrame(frameId);
25903
+ }
25904
+ frameId = window.requestAnimationFrame(() => {
25905
+ frameId = null;
25906
+ if (Math.abs(previousWidthRef.current - nextWidth) > 0.5) {
25907
+ previousWidthRef.current = nextWidth;
25908
+ setWidth(nextWidth);
25909
+ }
25910
+ });
25911
+ };
25912
+ if (typeof ResizeObserver === "undefined") {
25913
+ updateWidth();
25914
+ const handleResize = () => updateWidth();
25915
+ window.addEventListener("resize", handleResize);
25916
+ return () => {
25917
+ if (frameId !== null) {
25918
+ cancelAnimationFrame(frameId);
25919
+ }
25920
+ window.removeEventListener("resize", handleResize);
25921
+ };
25922
+ }
25923
+ const resizeObserver = new ResizeObserver(() => {
25924
+ updateWidth();
25925
+ });
25926
+ const observeChildren = () => {
25927
+ resizeObserver.observe(element);
25928
+ Array.from(element.children).forEach((child) => {
25929
+ resizeObserver.observe(child);
25930
+ });
25931
+ };
25932
+ observeChildren();
25933
+ updateWidth();
25934
+ const mutationObserver = new MutationObserver((mutations) => {
25935
+ mutations.forEach((mutation) => {
25936
+ mutation.addedNodes.forEach((node) => {
25937
+ if (node instanceof HTMLElement) {
25938
+ resizeObserver.observe(node);
25939
+ }
25940
+ });
25941
+ mutation.removedNodes.forEach((node) => {
25942
+ if (node instanceof HTMLElement) {
25943
+ resizeObserver.unobserve(node);
25944
+ }
25945
+ });
25946
+ });
25947
+ updateWidth();
25948
+ });
25949
+ mutationObserver.observe(element, { childList: true });
25950
+ return () => {
25951
+ if (frameId !== null) {
25952
+ cancelAnimationFrame(frameId);
25953
+ }
25954
+ resizeObserver.disconnect();
25955
+ mutationObserver.disconnect();
25956
+ };
25957
+ }, [containerRef?.current, gap, minWidth, maxWidth]);
25958
+ return width;
25959
+ };
25960
+ var useResponsiveFirstChildWidth_default = useResponsiveFirstChildWidth;
25961
+
25822
25962
  // src/components/UiComponents.tsx
25823
25963
  import { createPortal } from "react-dom";
25824
25964
 
@@ -25850,14 +25990,19 @@ var QuillTextInput = forwardRef(
25850
25990
  disabled
25851
25991
  }, ref) => {
25852
25992
  const [theme] = useContext4(ThemeContext);
25993
+ const isNumericWidth = typeof width === "number";
25994
+ const resolvedWidth = typeof width === "string" ? width : isNumericWidth ? width : "100%";
25853
25995
  return /* @__PURE__ */ jsxs18(
25854
25996
  "label",
25855
25997
  {
25856
25998
  style: {
25857
25999
  position: "relative",
25858
26000
  borderRadius: "6px",
25859
- width,
25860
- minWidth: width
26001
+ display: "flex",
26002
+ flexDirection: "column",
26003
+ width: resolvedWidth,
26004
+ minWidth: isNumericWidth ? width : 0,
26005
+ flex: isNumericWidth ? "0 0 auto" : "1 1 auto"
25861
26006
  },
25862
26007
  children: [
25863
26008
  label && /* @__PURE__ */ jsx26(
@@ -25879,6 +26024,7 @@ var QuillTextInput = forwardRef(
25879
26024
  ref,
25880
26025
  style: {
25881
26026
  display: "flex",
26027
+ flex: "1 1 auto",
25882
26028
  height: 40,
25883
26029
  minHeight: 40,
25884
26030
  maxHeight: 40,
@@ -25890,8 +26036,8 @@ var QuillTextInput = forwardRef(
25890
26036
  backgroundColor: theme?.backgroundColor,
25891
26037
  color: theme?.primaryTextColor,
25892
26038
  fontFamily: theme?.fontFamily,
25893
- width,
25894
- minWidth: width
26039
+ width: "100%",
26040
+ minWidth: 0
25895
26041
  },
25896
26042
  id: id2,
25897
26043
  value,
@@ -26261,10 +26407,10 @@ var MemoizedPopover = ({
26261
26407
  titlePaddingLeft = 0
26262
26408
  }) => {
26263
26409
  const [theme] = useContext4(ThemeContext);
26264
- const [rightAlignment, setRightAlignment] = useState7("auto");
26265
- const modalRef = useRef3(null);
26266
- const popoverRef = useRef3(null);
26267
- useEffect6(() => {
26410
+ const [rightAlignment, setRightAlignment] = useState8("auto");
26411
+ const modalRef = useRef4(null);
26412
+ const popoverRef = useRef4(null);
26413
+ useEffect7(() => {
26268
26414
  const listener = (event) => {
26269
26415
  const target = event.target;
26270
26416
  if (modalRef.current?.contains(target) || target.closest("[data-portal-ignore]") || ignoredRefs?.some(
@@ -26283,7 +26429,7 @@ var MemoizedPopover = ({
26283
26429
  document.removeEventListener("mousedown", listener);
26284
26430
  };
26285
26431
  }, [isOpen, ignoredRefs, setIsOpen, modalRef]);
26286
- useEffect6(() => {
26432
+ useEffect7(() => {
26287
26433
  updatePopoverPosition();
26288
26434
  window.addEventListener("resize", updatePopoverPosition);
26289
26435
  return () => {
@@ -26679,10 +26825,10 @@ var QuillModalComponent = ({
26679
26825
  title
26680
26826
  }) => {
26681
26827
  const [theme] = useContext4(ThemeContext);
26682
- const [rightAlignment, setRightAlignment] = useState7("auto");
26683
- const modalRef = useRef3(null);
26684
- const popoverRef = useRef3(null);
26685
- useEffect6(() => {
26828
+ const [rightAlignment, setRightAlignment] = useState8("auto");
26829
+ const modalRef = useRef4(null);
26830
+ const popoverRef = useRef4(null);
26831
+ useEffect7(() => {
26686
26832
  const listener = (event) => {
26687
26833
  if (modalRef?.current && !modalRef?.current?.contains(event.target)) {
26688
26834
  if (setIsOpen) setIsOpen(false);
@@ -26697,7 +26843,7 @@ var QuillModalComponent = ({
26697
26843
  document.removeEventListener("mousedown", listener);
26698
26844
  };
26699
26845
  }, [modalRef, setIsOpen, isOpen]);
26700
- useEffect6(() => {
26846
+ useEffect7(() => {
26701
26847
  updatePopoverPosition();
26702
26848
  window.addEventListener("resize", updatePopoverPosition);
26703
26849
  return () => {
@@ -26994,9 +27140,9 @@ var OverflowContainer = ({
26994
27140
  children,
26995
27141
  style: style2
26996
27142
  }) => {
26997
- const containerRef = useRef3(null);
26998
- const [showTopShadow, setShowTopShadow] = useState7(false);
26999
- const [showBottomShadow, setShowBottomShadow] = useState7(false);
27143
+ const containerRef = useRef4(null);
27144
+ const [showTopShadow, setShowTopShadow] = useState8(false);
27145
+ const [showBottomShadow, setShowBottomShadow] = useState8(false);
27000
27146
  const checkOverflow = () => {
27001
27147
  const container = containerRef.current;
27002
27148
  if (container) {
@@ -27007,7 +27153,7 @@ var OverflowContainer = ({
27007
27153
  );
27008
27154
  }
27009
27155
  };
27010
- useEffect6(() => {
27156
+ useEffect7(() => {
27011
27157
  const container = containerRef.current;
27012
27158
  if (container) {
27013
27159
  checkOverflow();
@@ -27161,10 +27307,10 @@ var QuillToolTipPortal = ({
27161
27307
  mirror = false
27162
27308
  }) => {
27163
27309
  const [theme] = useContext4(ThemeContext);
27164
- const [isOpen, setIsOpen] = useState7(false);
27165
- const tooltipRef = useRef3(null);
27166
- const triggerRef = useRef3(null);
27167
- const [tooltipPosition, setTooltipPosition] = useState7(void 0);
27310
+ const [isOpen, setIsOpen] = useState8(false);
27311
+ const tooltipRef = useRef4(null);
27312
+ const triggerRef = useRef4(null);
27313
+ const [tooltipPosition, setTooltipPosition] = useState8(void 0);
27168
27314
  const updatePosition = () => {
27169
27315
  if (triggerRef.current && tooltipRef.current) {
27170
27316
  const rect = triggerRef.current.getBoundingClientRect();
@@ -27189,7 +27335,7 @@ var QuillToolTipPortal = ({
27189
27335
  setTooltipPosition({ top, left });
27190
27336
  }
27191
27337
  };
27192
- useEffect6(() => {
27338
+ useEffect7(() => {
27193
27339
  if (isOpen) {
27194
27340
  const timer2 = setTimeout(() => {
27195
27341
  updatePosition();
@@ -27332,10 +27478,10 @@ var QuillPortal = ({
27332
27478
  showModal,
27333
27479
  setShowModal
27334
27480
  }) => {
27335
- const modalRef = useRef3(null);
27336
- const [popoverPosition, setPopoverPosition] = useState7(void 0);
27337
- const [z, setZ] = useState7(10);
27338
- const scrollableParentRef = useRef3(document.body);
27481
+ const modalRef = useRef4(null);
27482
+ const [popoverPosition, setPopoverPosition] = useState8(void 0);
27483
+ const [z, setZ] = useState8(10);
27484
+ const scrollableParentRef = useRef4(document.body);
27339
27485
  const updatePosition = () => {
27340
27486
  if (anchorRef.current) {
27341
27487
  requestAnimationFrame(() => {
@@ -27353,7 +27499,7 @@ var QuillPortal = ({
27353
27499
  });
27354
27500
  }
27355
27501
  };
27356
- useEffect6(() => {
27502
+ useEffect7(() => {
27357
27503
  let resizeObserver;
27358
27504
  let mutationObserver;
27359
27505
  if (showModal && anchorRef.current) {
@@ -27450,18 +27596,18 @@ function QuillTable({
27450
27596
  hideLabels,
27451
27597
  disableSort
27452
27598
  }) {
27453
- const [activeRows, setActiveRows] = useState8([]);
27454
- const [maxPage, setMaxPage] = useState8(1);
27455
- const [sortColumn, setSortColumn] = useState8(sort?.field || "");
27456
- const [sortDirection, setSortDirection] = useState8(sort?.direction || "desc");
27599
+ const [activeRows, setActiveRows] = useState9([]);
27600
+ const [maxPage, setMaxPage] = useState9(1);
27601
+ const [sortColumn, setSortColumn] = useState9(sort?.field || "");
27602
+ const [sortDirection, setSortDirection] = useState9(sort?.direction || "desc");
27457
27603
  const [theme] = useContext5(ThemeContext);
27458
- const [isPaginating, setIsPaginating] = useState8(true);
27459
- const [initialLoad, setInitialLoad] = useState8(true);
27460
- useEffect7(() => {
27604
+ const [isPaginating, setIsPaginating] = useState9(true);
27605
+ const [initialLoad, setInitialLoad] = useState9(true);
27606
+ useEffect8(() => {
27461
27607
  setSortColumn(sort?.field || "");
27462
27608
  setSortDirection(sort?.direction || "desc");
27463
27609
  }, [sort]);
27464
- useEffect7(() => {
27610
+ useEffect8(() => {
27465
27611
  if (rows?.length === 0 && isLoading) {
27466
27612
  return;
27467
27613
  }
@@ -27493,7 +27639,7 @@ function QuillTable({
27493
27639
  rowCount,
27494
27640
  isLoading
27495
27641
  ]);
27496
- useEffect7(() => {
27642
+ useEffect8(() => {
27497
27643
  if (rows.length <= currentPage * rowsPerPage) {
27498
27644
  onPageChange && onPageChange(0);
27499
27645
  setMaxPage(1);
@@ -29459,9 +29605,9 @@ import { useMemo as useMemo10 } from "react";
29459
29605
  // src/DateRangePicker/QuillDateRangePicker.tsx
29460
29606
  import {
29461
29607
  useContext as useContext9,
29462
- useEffect as useEffect9,
29463
- useRef as useRef5,
29464
- useState as useState10
29608
+ useEffect as useEffect10,
29609
+ useRef as useRef6,
29610
+ useState as useState11
29465
29611
  } from "react";
29466
29612
  import {
29467
29613
  startOfMonth as startOfMonth2,
@@ -29482,9 +29628,9 @@ import {
29482
29628
  import {
29483
29629
  useContext as useContext8,
29484
29630
  useMemo as useMemo7,
29485
- useRef as useRef4,
29486
- useState as useState9,
29487
- useEffect as useEffect8
29631
+ useRef as useRef5,
29632
+ useState as useState10,
29633
+ useEffect as useEffect9
29488
29634
  } from "react";
29489
29635
  import { createPortal as createPortal2 } from "react-dom";
29490
29636
  import { jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
@@ -29499,9 +29645,9 @@ function QuillSelectComponent({
29499
29645
  hideEmptyOption
29500
29646
  }) {
29501
29647
  const [theme] = useContext8(ThemeContext);
29502
- const [showModal, setShowModal] = useState9(false);
29503
- const modalRef = useRef4(null);
29504
- const buttonRef = useRef4(null);
29648
+ const [showModal, setShowModal] = useState10(false);
29649
+ const modalRef = useRef5(null);
29650
+ const buttonRef = useRef5(null);
29505
29651
  useOnClickOutside_default(
29506
29652
  modalRef,
29507
29653
  (event) => {
@@ -29524,9 +29670,9 @@ function QuillSelectComponent({
29524
29670
  const nullLabel = useMemo7(() => {
29525
29671
  return sortedItems.some((item) => item.value === "-") ? "None" : "-";
29526
29672
  }, [sortedItems]);
29527
- const [popoverPosition, setPopoverPosition] = useState9(void 0);
29528
- const [z, setZ] = useState9(10);
29529
- const scrollableParentRef = useRef4(document.body);
29673
+ const [popoverPosition, setPopoverPosition] = useState10(void 0);
29674
+ const [z, setZ] = useState10(10);
29675
+ const scrollableParentRef = useRef5(document.body);
29530
29676
  const updatePosition = () => {
29531
29677
  if (buttonRef.current) {
29532
29678
  requestAnimationFrame(() => {
@@ -29544,7 +29690,7 @@ function QuillSelectComponent({
29544
29690
  });
29545
29691
  }
29546
29692
  };
29547
- useEffect8(() => {
29693
+ useEffect9(() => {
29548
29694
  let resizeObserver;
29549
29695
  let mutationObserver;
29550
29696
  if (showModal && buttonRef.current) {
@@ -29825,23 +29971,23 @@ function QuillDateRangePicker({
29825
29971
  }) {
29826
29972
  const [theme] = useContext9(ThemeContext);
29827
29973
  const [client] = useContext9(ClientContext);
29828
- const [anchorStartDate, setAnchorStartDate] = useState10(
29974
+ const [anchorStartDate, setAnchorStartDate] = useState11(
29829
29975
  getAnchorStartDate(dateRange.startDate, dateRange.endDate)
29830
29976
  );
29831
- const [anchorEndDate, setAnchorEndDate] = useState10(
29977
+ const [anchorEndDate, setAnchorEndDate] = useState11(
29832
29978
  getAnchorEndDate(dateRange.startDate, dateRange.endDate)
29833
29979
  );
29834
- const [localStartDate, setLocalStartDate] = useState10(
29980
+ const [localStartDate, setLocalStartDate] = useState11(
29835
29981
  dateRange.startDate
29836
29982
  );
29837
- const [localEndDate, setLocalEndDate] = useState10(
29983
+ const [localEndDate, setLocalEndDate] = useState11(
29838
29984
  dateRange.endDate
29839
29985
  );
29840
- const [localPreset, setLocalPreset] = useState10(preset);
29841
- const [showModal, setShowModal] = useState10(false);
29842
- const buttonRef = useRef5(null);
29843
- const modalRef = useRef5(null);
29844
- useEffect9(() => {
29986
+ const [localPreset, setLocalPreset] = useState11(preset);
29987
+ const [showModal, setShowModal] = useState11(false);
29988
+ const buttonRef = useRef6(null);
29989
+ const modalRef = useRef6(null);
29990
+ useEffect10(() => {
29845
29991
  setLocalEndDate(dateRange.endDate);
29846
29992
  setLocalStartDate(dateRange.startDate);
29847
29993
  setLocalPreset(preset || "");
@@ -30354,10 +30500,10 @@ function getAnchorEndDate(startDate, endDate) {
30354
30500
  // src/components/QuillMultiSelectWithCombo.tsx
30355
30501
  import React7, {
30356
30502
  useContext as useContext10,
30357
- useEffect as useEffect10,
30503
+ useEffect as useEffect11,
30358
30504
  useMemo as useMemo8,
30359
- useRef as useRef6,
30360
- useState as useState11
30505
+ useRef as useRef7,
30506
+ useState as useState12
30361
30507
  } from "react";
30362
30508
  import { createPortal as createPortal3 } from "react-dom";
30363
30509
  import { Fragment as Fragment4, jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
@@ -30374,17 +30520,17 @@ function QuillMultiSelectComponentWithCombo({
30374
30520
  style: style2
30375
30521
  }) {
30376
30522
  const [theme] = useContext10(ThemeContext);
30377
- const [selectedOptions, setSelectedOptions] = useState11([]);
30378
- const [showModal, setShowModal] = useState11(false);
30379
- const modalRef = useRef6(null);
30380
- const buttonRef = useRef6(null);
30381
- const debounceTimeoutId = useRef6(null);
30523
+ const [selectedOptions, setSelectedOptions] = useState12([]);
30524
+ const [showModal, setShowModal] = useState12(false);
30525
+ const modalRef = useRef7(null);
30526
+ const buttonRef = useRef7(null);
30527
+ const debounceTimeoutId = useRef7(null);
30382
30528
  const [searchQuery, setSearchQuery] = React7.useState("");
30383
- const [exceedsLimit, setExceedsLimit] = useState11(false);
30384
- const [popoverPosition, setPopoverPosition] = useState11(void 0);
30385
- const [z, setZ] = useState11(10);
30386
- const scrollableParentRef = useRef6(document.body);
30387
- const selectAllRef = useRef6(null);
30529
+ const [exceedsLimit, setExceedsLimit] = useState12(false);
30530
+ const [popoverPosition, setPopoverPosition] = useState12(void 0);
30531
+ const [z, setZ] = useState12(10);
30532
+ const scrollableParentRef = useRef7(document.body);
30533
+ const selectAllRef = useRef7(null);
30388
30534
  let CheckboxState;
30389
30535
  ((CheckboxState2) => {
30390
30536
  CheckboxState2[CheckboxState2["SELECTED"] = 0] = "SELECTED";
@@ -30418,7 +30564,7 @@ function QuillMultiSelectComponentWithCombo({
30418
30564
  (elem) => elem.label ?? "-"
30419
30565
  ).join(", ");
30420
30566
  }, [options, value]);
30421
- const [selectAllCheckboxState, setSelectAllCheckboxState] = useState11(
30567
+ const [selectAllCheckboxState, setSelectAllCheckboxState] = useState12(
30422
30568
  (() => {
30423
30569
  if (value.length === 0) {
30424
30570
  return 1 /* UNSELECTED */;
@@ -30429,12 +30575,12 @@ function QuillMultiSelectComponentWithCombo({
30429
30575
  return 2 /* INDETERMINATE */;
30430
30576
  })()
30431
30577
  );
30432
- useEffect10(() => {
30578
+ useEffect11(() => {
30433
30579
  if (selectAllRef.current) {
30434
30580
  selectAllRef.current.indeterminate = selectAllCheckboxState === 2 /* INDETERMINATE */;
30435
30581
  }
30436
30582
  }, [selectAllCheckboxState, showModal]);
30437
- useEffect10(() => {
30583
+ useEffect11(() => {
30438
30584
  if (options.length > 0 && options?.[0]?.value === "EXCEEDS_LIMIT") {
30439
30585
  setExceedsLimit(true);
30440
30586
  } else {
@@ -30449,7 +30595,7 @@ function QuillMultiSelectComponentWithCombo({
30449
30595
  },
30450
30596
  showModal
30451
30597
  );
30452
- useEffect10(() => {
30598
+ useEffect11(() => {
30453
30599
  if (!value) {
30454
30600
  setSelectedOptions([]);
30455
30601
  } else {
@@ -30514,7 +30660,7 @@ function QuillMultiSelectComponentWithCombo({
30514
30660
  });
30515
30661
  }
30516
30662
  };
30517
- useEffect10(() => {
30663
+ useEffect11(() => {
30518
30664
  let resizeObserver;
30519
30665
  let mutationObserver;
30520
30666
  if (showModal && buttonRef.current) {
@@ -31021,8 +31167,8 @@ var ListboxTextInput = ({
31021
31167
  import React8, {
31022
31168
  useContext as useContext11,
31023
31169
  useMemo as useMemo9,
31024
- useRef as useRef7,
31025
- useState as useState12
31170
+ useRef as useRef8,
31171
+ useState as useState13
31026
31172
  } from "react";
31027
31173
  import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
31028
31174
  function QuillSelectComponentWithCombo({
@@ -31036,9 +31182,9 @@ function QuillSelectComponentWithCombo({
31036
31182
  disabled
31037
31183
  }) {
31038
31184
  const [theme] = useContext11(ThemeContext);
31039
- const [showModal, setShowModal] = useState12(false);
31040
- const modalRef = useRef7(null);
31041
- const buttonRef = useRef7(null);
31185
+ const [showModal, setShowModal] = useState13(false);
31186
+ const modalRef = useRef8(null);
31187
+ const buttonRef = useRef8(null);
31042
31188
  const [searchQuery, setSearchQuery] = React8.useState("");
31043
31189
  const filteredItems = React8.useMemo(() => {
31044
31190
  if (searchQuery === "") {
@@ -31826,7 +31972,7 @@ var MetricDisplay = ({
31826
31972
  };
31827
31973
 
31828
31974
  // src/components/Dashboard/DataLoader.tsx
31829
- import { useContext as useContext13, useEffect as useEffect11, useMemo as useMemo11, useRef as useRef8, useState as useState13 } from "react";
31975
+ import { useContext as useContext13, useEffect as useEffect12, useMemo as useMemo11, useRef as useRef9, useState as useState14 } from "react";
31830
31976
  init_paginationProcessing();
31831
31977
  init_tableProcessing();
31832
31978
  import equal2 from "fast-deep-equal";
@@ -31945,10 +32091,10 @@ function DataLoader({
31945
32091
  ) : Object.values(reportFilters[item.id] ?? {}).map((f) => f.filter);
31946
32092
  }, [dashboardFilters, reportFilters, dashboardName, item.id]);
31947
32093
  const [schemaData] = useContext13(SchemaDataContext);
31948
- const [loading, setLoading] = useState13(true);
31949
- const [error, setError] = useState13(void 0);
31950
- const [previousPage, setPreviousPage] = useState13(0);
31951
- const [additionalProcessing, setAdditionalProcessing] = useState13(defaultAdditionalProcessing);
32094
+ const [loading, setLoading] = useState14(true);
32095
+ const [error, setError] = useState14(void 0);
32096
+ const [previousPage, setPreviousPage] = useState14(0);
32097
+ const [additionalProcessing, setAdditionalProcessing] = useState14(defaultAdditionalProcessing);
31952
32098
  const chartReport = useMemo11(() => {
31953
32099
  const report = (dashboardName ? dashboard : reports)[item.id];
31954
32100
  if (report) {
@@ -31965,17 +32111,17 @@ function DataLoader({
31965
32111
  reportFilters,
31966
32112
  dashboardFilters
31967
32113
  ]);
31968
- const previousFilters = useRef8(filters);
31969
- const previousUserFilters = useRef8(userFilters);
31970
- const previousTenants = useRef8(tenants);
31971
- const previousCustomFields = useRef8(schemaData.customFields);
31972
- const [rowCountIsLoading, setRowCountIsLoading] = useState13(false);
31973
- const rowsRequestId = useRef8(0);
31974
- const rowsAbortController = useRef8(null);
31975
- const rowCountRequestId = useRef8(0);
31976
- const rowCountAbortController = useRef8(null);
31977
- const updateTableRowsRequestId = useRef8(0);
31978
- const updateTableRowsAbortController = useRef8(null);
32114
+ const previousFilters = useRef9(filters);
32115
+ const previousUserFilters = useRef9(userFilters);
32116
+ const previousTenants = useRef9(tenants);
32117
+ const previousCustomFields = useRef9(schemaData.customFields);
32118
+ const [rowCountIsLoading, setRowCountIsLoading] = useState14(false);
32119
+ const rowsRequestId = useRef9(0);
32120
+ const rowsAbortController = useRef9(null);
32121
+ const rowCountRequestId = useRef9(0);
32122
+ const rowCountAbortController = useRef9(null);
32123
+ const updateTableRowsRequestId = useRef9(0);
32124
+ const updateTableRowsAbortController = useRef9(null);
31979
32125
  const fetchRowCount = async (processing) => {
31980
32126
  if (!client || !filters) {
31981
32127
  if (!rowCountAbortController.current) return;
@@ -32242,7 +32388,7 @@ function DataLoader({
32242
32388
  }
32243
32389
  }
32244
32390
  };
32245
- useEffect11(() => {
32391
+ useEffect12(() => {
32246
32392
  if (schemaData.isSchemaLoading || filterValuesEquivalent(
32247
32393
  previousFilters.current ?? contextFilters,
32248
32394
  filters
@@ -32272,7 +32418,7 @@ function DataLoader({
32272
32418
  schemaData.customFields,
32273
32419
  schemaData.isSchemaLoading
32274
32420
  ]);
32275
- useEffect11(() => {
32421
+ useEffect12(() => {
32276
32422
  const tempReport = (dashboardName ? dashboard : reports)[item.id];
32277
32423
  if (tempReport?.triggerReload) {
32278
32424
  fetchReportHelper(additionalProcessing);
@@ -32315,17 +32461,17 @@ var ChartDataLoader = ({
32315
32461
  (f) => f.filter
32316
32462
  ) : Object.values(reportFilters[item.id] ?? {}).map((f) => f.filter);
32317
32463
  }, [dashboardFilters, reportFilters, dashboardName, item.id]);
32318
- const [loading, setLoading] = useState13(true);
32319
- const [error, setError] = useState13(void 0);
32464
+ const [loading, setLoading] = useState14(true);
32465
+ const [error, setError] = useState14(void 0);
32320
32466
  const [client] = useContext13(ClientContext);
32321
32467
  const [schemaData] = useContext13(SchemaDataContext);
32322
- const previousFilters = useRef8(filters);
32323
- const previousUserFilters = useRef8(userFilters);
32324
- const previousDateBucket = useRef8(dateBucket);
32325
- const previousTenants = useRef8(tenants);
32326
- const previousCustomFields = useRef8(schemaData.customFields);
32327
- const fetchReportAbortController = useRef8(null);
32328
- const rowsRequestId = useRef8(0);
32468
+ const previousFilters = useRef9(filters);
32469
+ const previousUserFilters = useRef9(userFilters);
32470
+ const previousDateBucket = useRef9(dateBucket);
32471
+ const previousTenants = useRef9(tenants);
32472
+ const previousCustomFields = useRef9(schemaData.customFields);
32473
+ const fetchReportAbortController = useRef9(null);
32474
+ const rowsRequestId = useRef9(0);
32329
32475
  const chartReport = useMemo11(() => {
32330
32476
  const report = dashboardName ? dashboard[item.id] : reports[item.id];
32331
32477
  if (!report) {
@@ -32438,7 +32584,7 @@ var ChartDataLoader = ({
32438
32584
  }
32439
32585
  }
32440
32586
  };
32441
- useEffect11(() => {
32587
+ useEffect12(() => {
32442
32588
  if (!filters) {
32443
32589
  return;
32444
32590
  }
@@ -32473,7 +32619,7 @@ var ChartDataLoader = ({
32473
32619
  schemaData.customFields,
32474
32620
  schemaData.isSchemaLoading
32475
32621
  ]);
32476
- useEffect11(() => {
32622
+ useEffect12(() => {
32477
32623
  const tempReport = (dashboardName ? dashboard : reports)[item.id];
32478
32624
  if (tempReport && tempReport.triggerReload) {
32479
32625
  fetchReportHelper();
@@ -32555,7 +32701,7 @@ import {
32555
32701
  Geography,
32556
32702
  useMapContext
32557
32703
  } from "react-simple-maps";
32558
- import { useEffect as useEffect12, useMemo as useMemo12, useRef as useRef9, useState as useState14 } from "react";
32704
+ import { useEffect as useEffect13, useMemo as useMemo12, useRef as useRef10, useState as useState15 } from "react";
32559
32705
  init_valueFormatter();
32560
32706
  import { jsx as jsx45, jsxs as jsxs34 } from "react/jsx-runtime";
32561
32707
  var statesUrl = "https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json";
@@ -32882,18 +33028,18 @@ function USMap({
32882
33028
  className,
32883
33029
  containerStyle
32884
33030
  }) {
32885
- const containerRef = useRef9(null);
32886
- const [hoveredState, setHoveredState] = useState14(
33031
+ const containerRef = useRef10(null);
33032
+ const [hoveredState, setHoveredState] = useState15(
32887
33033
  void 0
32888
33034
  );
32889
- const [hoveredCoords, setHoveredCoords] = useState14(void 0);
33035
+ const [hoveredCoords, setHoveredCoords] = useState15(void 0);
32890
33036
  const mappedData = data.reduce((acc, curr) => {
32891
33037
  acc[curr[xAxisField]?.toString()] = curr;
32892
33038
  return acc;
32893
33039
  }, {});
32894
33040
  const measureField = yAxisFields[0]?.field ?? xAxisField;
32895
- const [scaleLog, setScaleLog] = useState14(null);
32896
- useEffect12(() => {
33041
+ const [scaleLog, setScaleLog] = useState15(null);
33042
+ useEffect13(() => {
32897
33043
  import("d3-scale").then((scale) => {
32898
33044
  setScaleLog(() => scale.scaleLog);
32899
33045
  });
@@ -33073,18 +33219,18 @@ function WorldMap({
33073
33219
  className,
33074
33220
  containerStyle
33075
33221
  }) {
33076
- const containerRef = useRef9(null);
33077
- const [hoveredCountry, setHoveredCountry] = useState14(
33222
+ const containerRef = useRef10(null);
33223
+ const [hoveredCountry, setHoveredCountry] = useState15(
33078
33224
  void 0
33079
33225
  );
33080
- const [hoveredCoords, setHoveredCoords] = useState14(void 0);
33226
+ const [hoveredCoords, setHoveredCoords] = useState15(void 0);
33081
33227
  const mappedData = data.reduce((acc, curr) => {
33082
33228
  acc[curr[xAxisField]?.toString()] = curr;
33083
33229
  return acc;
33084
33230
  }, {});
33085
33231
  const measureField = yAxisFields[0]?.field ?? xAxisField;
33086
- const [scaleLog, setScaleLog] = useState14(null);
33087
- useEffect12(() => {
33232
+ const [scaleLog, setScaleLog] = useState15(null);
33233
+ useEffect13(() => {
33088
33234
  import("d3-scale").then((scale) => {
33089
33235
  setScaleLog(() => scale.scaleLog);
33090
33236
  });
@@ -33266,8 +33412,8 @@ function MapLayout({
33266
33412
  regionNames
33267
33413
  }) {
33268
33414
  const { projection } = useMapContext();
33269
- const [geoCentroid, setGeoCentroid] = useState14(null);
33270
- useEffect12(() => {
33415
+ const [geoCentroid, setGeoCentroid] = useState15(null);
33416
+ useEffect13(() => {
33271
33417
  import("d3-geo").then((geo) => {
33272
33418
  setGeoCentroid(() => geo.geoCentroid);
33273
33419
  });
@@ -33319,7 +33465,7 @@ function MapLayout({
33319
33465
  }
33320
33466
 
33321
33467
  // src/components/Chart/GaugeChart.tsx
33322
- import { useEffect as useEffect13, useRef as useRef10, useState as useState15 } from "react";
33468
+ import { useEffect as useEffect14, useRef as useRef11, useState as useState16 } from "react";
33323
33469
 
33324
33470
  // ../../node_modules/d3-transition/src/selection/index.js
33325
33471
  import { selection as selection3 } from "d3-selection";
@@ -34593,20 +34739,20 @@ function D3Gauge({
34593
34739
  colors,
34594
34740
  isAnimationActive
34595
34741
  }) {
34596
- const containerRef = useRef10(null);
34597
- const svgRef = useRef10(null);
34598
- const gaugeGroupRef = useRef10(null);
34599
- const needleRef = useRef10(null);
34600
- const needleOutlineRef = useRef10(null);
34601
- const textRef = useRef10(null);
34602
- const previousPercentageRef = useRef10(0);
34603
- const firstMountRef = useRef10(true);
34742
+ const containerRef = useRef11(null);
34743
+ const svgRef = useRef11(null);
34744
+ const gaugeGroupRef = useRef11(null);
34745
+ const needleRef = useRef11(null);
34746
+ const needleOutlineRef = useRef11(null);
34747
+ const textRef = useRef11(null);
34748
+ const previousPercentageRef = useRef11(0);
34749
+ const firstMountRef = useRef11(true);
34604
34750
  const startAngle = -(3 * Math.PI) / 4;
34605
34751
  const totalAngle = 3 * Math.PI / 2;
34606
- const [arc, setArc] = useState15(null);
34607
- const [interpolate, setInterpolate] = useState15(null);
34608
- const [select, setSelect] = useState15(null);
34609
- useEffect13(() => {
34752
+ const [arc, setArc] = useState16(null);
34753
+ const [interpolate, setInterpolate] = useState16(null);
34754
+ const [select, setSelect] = useState16(null);
34755
+ useEffect14(() => {
34610
34756
  import("d3-shape").then(({ arc: arc2 }) => {
34611
34757
  setArc(() => arc2);
34612
34758
  });
@@ -34617,7 +34763,7 @@ function D3Gauge({
34617
34763
  setSelect(() => select2);
34618
34764
  });
34619
34765
  }, []);
34620
- useEffect13(() => {
34766
+ useEffect14(() => {
34621
34767
  if (!containerRef.current || !select) return;
34622
34768
  const container = containerRef.current;
34623
34769
  select(container).select("svg").remove();
@@ -34634,7 +34780,7 @@ function D3Gauge({
34634
34780
  svgRef.current = null;
34635
34781
  };
34636
34782
  }, [colors, select]);
34637
- useEffect13(() => {
34783
+ useEffect14(() => {
34638
34784
  if (!containerRef.current || !svgRef.current || !gaugeGroupRef.current || !needleRef.current || !needleOutlineRef.current || !textRef.current || !arc || !interpolate || !select)
34639
34785
  return;
34640
34786
  const rect = containerRef.current.getBoundingClientRect();
@@ -34734,7 +34880,7 @@ function D3Gauge({
34734
34880
  arc,
34735
34881
  interpolate
34736
34882
  ]);
34737
- useEffect13(() => {
34883
+ useEffect14(() => {
34738
34884
  if (!containerRef.current) return;
34739
34885
  const observer = new ResizeObserver(() => {
34740
34886
  previousPercentageRef.current = percentage;
@@ -34753,7 +34899,7 @@ function D3Gauge({
34753
34899
 
34754
34900
  // src/components/QuillComponentTables.tsx
34755
34901
  init_paginationProcessing();
34756
- import { useState as useState16, useEffect as useEffect14, useContext as useContext15 } from "react";
34902
+ import { useState as useState17, useEffect as useEffect15, useContext as useContext15 } from "react";
34757
34903
  import { jsx as jsx47, jsxs as jsxs35 } from "react/jsx-runtime";
34758
34904
  var QuillTableSQLEditorComponent = ({
34759
34905
  rows,
@@ -34769,8 +34915,8 @@ var QuillTableSQLEditorComponent = ({
34769
34915
  setCurrentPage,
34770
34916
  hideLabels
34771
34917
  }) => {
34772
- const [sort, setSort] = useState16({ field: "", direction: "" });
34773
- const [page, setPage] = useState16(0);
34918
+ const [sort, setSort] = useState17({ field: "", direction: "" });
34919
+ const [page, setPage] = useState17(0);
34774
34920
  return /* @__PURE__ */ jsx47(
34775
34921
  QuillTable,
34776
34922
  {
@@ -34812,9 +34958,9 @@ var QuillTableReportBuilderComponent = ({
34812
34958
  setCurrentPage,
34813
34959
  disableSort
34814
34960
  }) => {
34815
- const [sort, setSort] = useState16({ field: "", direction: "" });
34816
- const [page, setPage] = useState16(0);
34817
- useEffect14(() => {
34961
+ const [sort, setSort] = useState17({ field: "", direction: "" });
34962
+ const [page, setPage] = useState17(0);
34963
+ useEffect15(() => {
34818
34964
  if (disableSort) {
34819
34965
  setSort({ field: "", direction: "" });
34820
34966
  }
@@ -34858,15 +35004,15 @@ var QuillTableComponent = ({
34858
35004
  currentPage,
34859
35005
  hideLabels
34860
35006
  }) => {
34861
- const [sort, setSort] = useState16({ field: "", direction: "" });
34862
- const [page, setPage] = useState16(0);
34863
- const [initialLoad, setInitialLoad] = useState16(true);
34864
- useEffect14(() => {
35007
+ const [sort, setSort] = useState17({ field: "", direction: "" });
35008
+ const [page, setPage] = useState17(0);
35009
+ const [initialLoad, setInitialLoad] = useState17(true);
35010
+ useEffect15(() => {
34865
35011
  if (initialLoad && !isLoading) {
34866
35012
  setInitialLoad(false);
34867
35013
  }
34868
35014
  }, [isLoading]);
34869
- useEffect14(() => {
35015
+ useEffect15(() => {
34870
35016
  setPage(currentPage || 0);
34871
35017
  }, [currentPage]);
34872
35018
  if (initialLoad) {
@@ -34920,15 +35066,15 @@ function QuillTableDashboardComponent({
34920
35066
  hideName
34921
35067
  }) {
34922
35068
  const [theme] = useContext15(ThemeContext);
34923
- const [initialLoad, setInitialLoad] = useState16(true);
35069
+ const [initialLoad, setInitialLoad] = useState17(true);
34924
35070
  const { downloadCSV: downloadCSV2 } = useExport(report?.id);
34925
- const [page, setPage] = useState16(0);
34926
- useEffect14(() => {
35071
+ const [page, setPage] = useState17(0);
35072
+ useEffect15(() => {
34927
35073
  if (!isLoading) {
34928
35074
  setInitialLoad(false);
34929
35075
  }
34930
35076
  }, [isLoading]);
34931
- useEffect14(() => {
35077
+ useEffect15(() => {
34932
35078
  if (rowCountIsLoading) {
34933
35079
  setPage(0);
34934
35080
  }
@@ -35102,12 +35248,12 @@ function Chart({
35102
35248
  filters,
35103
35249
  dashboardCustomFilters[allReportsById[reportId]?.dashboardName ?? ""]
35104
35250
  ]);
35105
- const previousFilters = useRef11(void 0);
35251
+ const previousFilters = useRef12(void 0);
35106
35252
  if (!equal3(previousFilters.current, filters)) {
35107
35253
  previousFilters.current = filters;
35108
35254
  }
35109
- const [filterValues, setFilterValues] = useState17({});
35110
- useEffect15(() => {
35255
+ const [filterValues, setFilterValues] = useState18({});
35256
+ useEffect16(() => {
35111
35257
  setFilterValues(
35112
35258
  Object.values(reportFilters[reportId] ?? {}).reduce((acc, f) => {
35113
35259
  acc[f.filter.label] = f.filter.filterType === "string" ? f.filter.stringFilterType === "multiselect" ? { values: f.filter.values, operator: "IN" } : { selectedValue: f.filter.selectedValue } : f.filter.filterType === "date_range" ? {
@@ -35122,7 +35268,7 @@ function Chart({
35122
35268
  }, {})
35123
35269
  );
35124
35270
  }, [reportFilters[reportId]]);
35125
- useEffect15(() => {
35271
+ useEffect16(() => {
35126
35272
  if (equal3(customReportFilters[reportId] ?? [], filters ?? [])) {
35127
35273
  return;
35128
35274
  }
@@ -35138,7 +35284,7 @@ function Chart({
35138
35284
  });
35139
35285
  };
35140
35286
  }, [filters]);
35141
- useEffect15(() => {
35287
+ useEffect16(() => {
35142
35288
  if (reportDateFilter) {
35143
35289
  const customDateFilter = previousFilters.current?.find(
35144
35290
  (f) => f.filterType === "date" /* Date */
@@ -35176,7 +35322,7 @@ function Chart({
35176
35322
  [reportId, allReportsById]
35177
35323
  );
35178
35324
  const report = useMemo13(() => reports[reportId], [reports, reportId]);
35179
- const [loading, setLoading] = useState17(true);
35325
+ const [loading, setLoading] = useState18(true);
35180
35326
  const [theme] = useContext16(ThemeContext);
35181
35327
  const colorMap = useMemo13(() => {
35182
35328
  if (mapColorsToFields && report && theme) {
@@ -35184,7 +35330,7 @@ function Chart({
35184
35330
  }
35185
35331
  }, [report, theme]);
35186
35332
  const [client, clientLoading] = useContext16(ClientContext);
35187
- const [error, setError] = useState17(void 0);
35333
+ const [error, setError] = useState18(void 0);
35188
35334
  const updateFilter = (filter, value, comparison) => {
35189
35335
  let filterValue = {};
35190
35336
  if (filter.filterType === "string" /* String */) {
@@ -35294,7 +35440,7 @@ function Chart({
35294
35440
  setLoading(false);
35295
35441
  }
35296
35442
  };
35297
- useEffect15(() => {
35443
+ useEffect16(() => {
35298
35444
  if (reportId === void 0 || reportId === "" || clientLoading || isDashboardsLoading) {
35299
35445
  return;
35300
35446
  }
@@ -35511,7 +35657,7 @@ var ChartDisplay = ({
35511
35657
  }
35512
35658
  return void 0;
35513
35659
  }, [config, specificReportFilters, specificDashboardFilters]);
35514
- const [page, setPage] = useState17(0);
35660
+ const [page, setPage] = useState18(0);
35515
35661
  if (loading) {
35516
35662
  return /* @__PURE__ */ jsx48("div", { className, style: containerStyle, children: /* @__PURE__ */ jsx48(LoadingComponent, {}) });
35517
35663
  } else if (config && !["metric", "table", "gauge", "US map", "World map"].includes(
@@ -35955,7 +36101,7 @@ function QuillChartComponent({
35955
36101
  }
35956
36102
 
35957
36103
  // src/components/Dashboard/TemplateChartComponent.tsx
35958
- import { useState as useState18 } from "react";
36104
+ import { useState as useState19 } from "react";
35959
36105
  import { jsx as jsx51 } from "react/jsx-runtime";
35960
36106
  function QuillTemplateChartComponent({
35961
36107
  report,
@@ -35963,7 +36109,7 @@ function QuillTemplateChartComponent({
35963
36109
  children,
35964
36110
  isLoading
35965
36111
  }) {
35966
- const [isSelected, setIsSelected] = useState18(false);
36112
+ const [isSelected, setIsSelected] = useState19(false);
35967
36113
  return /* @__PURE__ */ jsx51(
35968
36114
  "div",
35969
36115
  {
@@ -36050,10 +36196,10 @@ init_filterProcessing();
36050
36196
  import {
36051
36197
  forwardRef as forwardRef2,
36052
36198
  useContext as useContext19,
36053
- useEffect as useEffect16,
36199
+ useEffect as useEffect17,
36054
36200
  useMemo as useMemo14,
36055
- useRef as useRef12,
36056
- useState as useState19
36201
+ useRef as useRef13,
36202
+ useState as useState20
36057
36203
  } from "react";
36058
36204
  init_util();
36059
36205
  init_tableProcessing();
@@ -36548,10 +36694,10 @@ var FilterPopoverWrapper = ({
36548
36694
  }) => {
36549
36695
  const { tenants } = useContext19(TenantContext);
36550
36696
  const { eventTracking } = useContext19(EventTrackingContext);
36551
- const [isOpen, setIsOpen] = useState19(false);
36552
- const [uniqueValues, setUniqueValues] = useState19(void 0);
36553
- const [uniqueValuesIsLoading, setUniqueValuesIsLoading] = useState19(false);
36554
- const prevFiltersRef = useRef12("");
36697
+ const [isOpen, setIsOpen] = useState20(false);
36698
+ const [uniqueValues, setUniqueValues] = useState20(void 0);
36699
+ const [uniqueValuesIsLoading, setUniqueValuesIsLoading] = useState20(false);
36700
+ const prevFiltersRef = useRef13("");
36555
36701
  const columnInternals = useMemo14(() => {
36556
36702
  if (!tables) {
36557
36703
  return null;
@@ -36566,7 +36712,7 @@ var FilterPopoverWrapper = ({
36566
36712
  });
36567
36713
  return relevantColumns;
36568
36714
  }, [schema, tables]);
36569
- useEffect16(() => {
36715
+ useEffect17(() => {
36570
36716
  const currentFiltersString = JSON.stringify(priorFilters);
36571
36717
  if (currentFiltersString !== prevFiltersRef.current) {
36572
36718
  prevFiltersRef.current = currentFiltersString;
@@ -36636,7 +36782,7 @@ var FilterPopoverWrapper = ({
36636
36782
 
36637
36783
  // src/components/ReportBuilder/FilterModal.tsx
36638
36784
  init_Filter();
36639
- import { useState as useState20, useEffect as useEffect17, useMemo as useMemo15 } from "react";
36785
+ import { useState as useState21, useEffect as useEffect18, useMemo as useMemo15 } from "react";
36640
36786
  init_textProcessing();
36641
36787
  init_filterProcessing();
36642
36788
  import { format as format8, isValid as isValid5, parse as parse4, startOfToday as startOfToday2 } from "date-fns";
@@ -36658,32 +36804,32 @@ function FilterModal({
36658
36804
  MultiSelectComponent,
36659
36805
  reportBuilderColumns
36660
36806
  }) {
36661
- const [field, setField] = useState20("");
36662
- const [fieldOptions, setFieldOptions] = useState20([]);
36663
- const [fieldValues, setFieldValues] = useState20([]);
36664
- const [type, setType] = useState20(null);
36665
- const [value, setValue] = useState20(void 0);
36666
- const [selectedOptions, setSelectedOptions] = useState20([]);
36667
- const [operator, setOperator] = useState20(
36807
+ const [field, setField] = useState21("");
36808
+ const [fieldOptions, setFieldOptions] = useState21([]);
36809
+ const [fieldValues, setFieldValues] = useState21([]);
36810
+ const [type, setType] = useState21(null);
36811
+ const [value, setValue] = useState21(void 0);
36812
+ const [selectedOptions, setSelectedOptions] = useState21([]);
36813
+ const [operator, setOperator] = useState21(
36668
36814
  void 0
36669
36815
  );
36670
- const [operatorOptions, setOperatorOptions] = useState20([]);
36671
- const [unit, setUnit] = useState20("");
36672
- const [unitOptions, setUnitOptions] = useState20([]);
36673
- const [startDate, setStartDate] = useState20(
36816
+ const [operatorOptions, setOperatorOptions] = useState21([]);
36817
+ const [unit, setUnit] = useState21("");
36818
+ const [unitOptions, setUnitOptions] = useState21([]);
36819
+ const [startDate, setStartDate] = useState21(
36674
36820
  startOfToday2().toISOString().substring(0, 10)
36675
36821
  );
36676
- const [endDate, setEndDate] = useState20(
36822
+ const [endDate, setEndDate] = useState21(
36677
36823
  startOfToday2().toISOString().substring(0, 10)
36678
36824
  );
36679
- const [filterInitialized, setFilterInitialized] = useState20(false);
36680
- const [table, setTable] = useState20(void 0);
36825
+ const [filterInitialized, setFilterInitialized] = useState21(false);
36826
+ const [table, setTable] = useState21(void 0);
36681
36827
  const memoizedFieldValuesMap = useMemo15(
36682
36828
  () => fieldValuesMap,
36683
36829
  [JSON.stringify(fieldValuesMap)]
36684
36830
  );
36685
36831
  const memoizedFilter = useMemo15(() => filter, [JSON.stringify(filter)]);
36686
- useEffect17(() => {
36832
+ useEffect18(() => {
36687
36833
  if (!filter) {
36688
36834
  onFieldChange(field, fieldOptions, table);
36689
36835
  }
@@ -36728,7 +36874,7 @@ function FilterModal({
36728
36874
  ],
36729
36875
  [FieldType.Null]: [NullOperator.IsNotNull, NullOperator.IsNull]
36730
36876
  };
36731
- useEffect17(() => {
36877
+ useEffect18(() => {
36732
36878
  if (filter) {
36733
36879
  setField(filter.field);
36734
36880
  setTable(filter.table);
@@ -36756,7 +36902,7 @@ function FilterModal({
36756
36902
  }
36757
36903
  }
36758
36904
  }, [memoizedFilter]);
36759
- useEffect17(() => {
36905
+ useEffect18(() => {
36760
36906
  if (schema) {
36761
36907
  const fo = schema.flatMap((table2) => {
36762
36908
  if (tables && !tables.includes(table2.name)) {
@@ -37438,7 +37584,7 @@ function FilterModal({
37438
37584
  }
37439
37585
 
37440
37586
  // src/components/Dashboard/TemplateMetricComponent.tsx
37441
- import { useState as useState21 } from "react";
37587
+ import { useState as useState22 } from "react";
37442
37588
  import { jsx as jsx55 } from "react/jsx-runtime";
37443
37589
  function QuillTemplateMetricComponent({
37444
37590
  report,
@@ -37446,7 +37592,7 @@ function QuillTemplateMetricComponent({
37446
37592
  children,
37447
37593
  isLoading
37448
37594
  }) {
37449
- const [isSelected, setIsSelected] = useState21(false);
37595
+ const [isSelected, setIsSelected] = useState22(false);
37450
37596
  return /* @__PURE__ */ jsx55(
37451
37597
  "div",
37452
37598
  {
@@ -37475,7 +37621,7 @@ function QuillTemplateMetricComponent({
37475
37621
  }
37476
37622
 
37477
37623
  // src/components/Dashboard/TemplateTableComponent.tsx
37478
- import { useState as useState22 } from "react";
37624
+ import { useState as useState23 } from "react";
37479
37625
  import { jsx as jsx56 } from "react/jsx-runtime";
37480
37626
  function QuillTemplateTableComponent({
37481
37627
  report,
@@ -37486,7 +37632,7 @@ function QuillTemplateTableComponent({
37486
37632
  onPageChange,
37487
37633
  onSortChange
37488
37634
  }) {
37489
- const [isSelected, setIsSelected] = useState22(false);
37635
+ const [isSelected, setIsSelected] = useState23(false);
37490
37636
  return /* @__PURE__ */ jsx56(
37491
37637
  "div",
37492
37638
  {
@@ -37701,14 +37847,14 @@ function Dashboard({
37701
37847
  templateDashboardName,
37702
37848
  pagination = { rowsPerPage: 10, rowsPerRequest: 50 }
37703
37849
  }) {
37704
- const [userFilters, setUserFilters] = useState23({});
37705
- const [selectedSection, setSelectedSection] = useState23("");
37850
+ const [userFilters, setUserFilters] = useState24({});
37851
+ const [selectedSection, setSelectedSection] = useState24("");
37706
37852
  const dataLoaderUserFilters = useMemo16(() => {
37707
37853
  return (filters?.map((f) => convertCustomFilter(f)) ?? []).concat(
37708
37854
  Object.values(userFilters)
37709
37855
  );
37710
37856
  }, [filters, userFilters]);
37711
- useEffect18(() => {
37857
+ useEffect19(() => {
37712
37858
  onUserFiltersUpdated?.(Object.values(userFilters));
37713
37859
  }, [userFilters]);
37714
37860
  const {
@@ -37806,8 +37952,8 @@ function Dashboard({
37806
37952
  });
37807
37953
  return map;
37808
37954
  }, [data?.sections, data?.sectionOrder]);
37809
- const mounted = useRef13(false);
37810
- useEffect18(() => {
37955
+ const mounted = useRef14(false);
37956
+ useEffect19(() => {
37811
37957
  if (!mounted.current) {
37812
37958
  mounted.current = true;
37813
37959
  return;
@@ -37819,7 +37965,7 @@ function Dashboard({
37819
37965
  filters: populatedDashboardFilters ?? []
37820
37966
  });
37821
37967
  }, [filters, userFilters]);
37822
- useEffect18(() => {
37968
+ useEffect19(() => {
37823
37969
  customFilterDispatch({
37824
37970
  type: "ADD_CUSTOM_DASHBOARD_FILTERS",
37825
37971
  dashboardName: name2,
@@ -37833,31 +37979,31 @@ function Dashboard({
37833
37979
  const { dispatch: dashboardFiltersDispatch } = useContext20(
37834
37980
  DashboardFiltersContext
37835
37981
  );
37836
- const [fieldValuesMap, setFieldValuesMap] = useState23({});
37837
- const [fieldValuesIsLoaded, setFieldValuesIsLoaded] = useState23(false);
37838
- const [addFilterPopoverIsOpen, setAddFilterPopoverIsOpen] = useState23(false);
37839
- const [filterListIsOpen, setFilterListIsOpen] = useState23(false);
37982
+ const [fieldValuesMap, setFieldValuesMap] = useState24({});
37983
+ const [fieldValuesIsLoaded, setFieldValuesIsLoaded] = useState24(false);
37984
+ const [addFilterPopoverIsOpen, setAddFilterPopoverIsOpen] = useState24(false);
37985
+ const [filterListIsOpen, setFilterListIsOpen] = useState24(false);
37840
37986
  const [
37841
37987
  filterListAddFilterPopoverIsOpen,
37842
37988
  setFilterListAddFilterPopoverIsOpen
37843
- ] = useState23(false);
37989
+ ] = useState24(false);
37844
37990
  const presetOptions = useMemo16(() => {
37845
37991
  return populatedDashboardFilters?.[0]?.filterType === "date_range" ? convertPresetOptionsToSelectableList(
37846
37992
  populatedDashboardFilters[0].presetOptions ?? [],
37847
37993
  populatedDashboardFilters[0].defaultPresetRanges ?? []
37848
37994
  ) : defaultOptionsV2;
37849
37995
  }, [populatedDashboardFilters]);
37850
- const [filterValues, setFilterValues] = useState23({});
37851
- const prevNameRef = useRef13(name2);
37852
- const prevFlagsRef = useRef13(flags);
37853
- const prevClientRef = useRef13(client?.publicKey ?? "");
37854
- const addFilterPopoverButtonRef = useRef13(null);
37855
- const viewFiltersPopoverButtonRef = useRef13(null);
37856
- const previousFilters = useRef13(filters);
37996
+ const [filterValues, setFilterValues] = useState24({});
37997
+ const prevNameRef = useRef14(name2);
37998
+ const prevFlagsRef = useRef14(flags);
37999
+ const prevClientRef = useRef14(client?.publicKey ?? "");
38000
+ const addFilterPopoverButtonRef = useRef14(null);
38001
+ const viewFiltersPopoverButtonRef = useRef14(null);
38002
+ const previousFilters = useRef14(filters);
37857
38003
  if (!equal4(previousFilters.current, filters)) {
37858
38004
  previousFilters.current = filters;
37859
38005
  }
37860
- const isInitialLoadOfDashboardRef = useRef13(false);
38006
+ const isInitialLoadOfDashboardRef = useRef14(false);
37861
38007
  const referencedTables = useMemo16(() => {
37862
38008
  const sections = data?.sections || {};
37863
38009
  const tables2 = Object.values(sections).flatMap(
@@ -37865,7 +38011,7 @@ function Dashboard({
37865
38011
  ).flat();
37866
38012
  return Array.from(new Set(tables2));
37867
38013
  }, [data?.sections]);
37868
- useEffect18(() => {
38014
+ useEffect19(() => {
37869
38015
  if (prevNameRef.current === name2 && Object.values(data?.sections ?? {}).flat().length) {
37870
38016
  return;
37871
38017
  }
@@ -37885,8 +38031,8 @@ function Dashboard({
37885
38031
  prevFlagsRef.current = flags;
37886
38032
  });
37887
38033
  }, [name2, isClientLoading]);
37888
- const tenantMounted = useRef13(false);
37889
- useEffect18(() => {
38034
+ const tenantMounted = useRef14(false);
38035
+ useEffect19(() => {
37890
38036
  if (!tenantMounted.current) {
37891
38037
  tenantMounted.current = true;
37892
38038
  return;
@@ -37905,7 +38051,7 @@ function Dashboard({
37905
38051
  isInitialLoadOfDashboardRef.current = false;
37906
38052
  });
37907
38053
  }, [flags]);
37908
- useEffect18(() => {
38054
+ useEffect19(() => {
37909
38055
  if (prevClientRef.current === client?.publicKey) {
37910
38056
  return;
37911
38057
  }
@@ -37920,7 +38066,7 @@ function Dashboard({
37920
38066
  isInitialLoadOfDashboardRef.current = false;
37921
38067
  });
37922
38068
  }, [client?.publicKey]);
37923
- useEffect18(() => {
38069
+ useEffect19(() => {
37924
38070
  setFilterValues(
37925
38071
  Object.values(populatedDashboardFilters ?? {}).reduce((acc, f) => {
37926
38072
  acc[f.label] = f.filterType === "string" ? f.stringFilterType === "multiselect" ? { values: f.values, operator: "IN" } : { selectedValue: f.selectedValue } : f.filterType === "date_range" ? {
@@ -37935,7 +38081,7 @@ function Dashboard({
37935
38081
  }, {})
37936
38082
  );
37937
38083
  }, [populatedDashboardFilters]);
37938
- useEffect18(() => {
38084
+ useEffect19(() => {
37939
38085
  const dashboardDateFilter = populatedDashboardFilters?.find(
37940
38086
  (f) => f.filterType === "date_range"
37941
38087
  );
@@ -37972,7 +38118,7 @@ function Dashboard({
37972
38118
  });
37973
38119
  }
37974
38120
  }, [previousFilters.current]);
37975
- useEffect18(() => {
38121
+ useEffect19(() => {
37976
38122
  const fetchData = async () => {
37977
38123
  setFieldValuesIsLoaded(false);
37978
38124
  const newFieldValues = {};
@@ -38133,7 +38279,7 @@ function Dashboard({
38133
38279
  [filter.field]: filter
38134
38280
  }));
38135
38281
  };
38136
- useEffect18(() => {
38282
+ useEffect19(() => {
38137
38283
  if (onChangeLoading && isLoading) {
38138
38284
  onChangeLoading(isLoading);
38139
38285
  }
@@ -38778,10 +38924,10 @@ function QuillDashboardTemplate({
38778
38924
  const { dashboardConfig, dashboardConfigDispatch } = useContext20(
38779
38925
  DashboardConfigContext
38780
38926
  );
38781
- const [addItemModalIsOpen, setAddItemModalIsOpen] = useState23(false);
38782
- const [selectedTemplates, setSelectedTemplates] = useState23([]);
38783
- const [selectingTemplate, setSelectingTemplate] = useState23(false);
38784
- const [submittingTemplate, setSubmittingTemplate] = useState23(false);
38927
+ const [addItemModalIsOpen, setAddItemModalIsOpen] = useState24(false);
38928
+ const [selectedTemplates, setSelectedTemplates] = useState24([]);
38929
+ const [selectingTemplate, setSelectingTemplate] = useState24(false);
38930
+ const [submittingTemplate, setSubmittingTemplate] = useState24(false);
38785
38931
  const templateSections = data?.sections;
38786
38932
  const onSubmitTemplates = async () => {
38787
38933
  setSubmittingTemplate(true);
@@ -38926,9 +39072,9 @@ var QuillProvider_default = QuillProvider;
38926
39072
  // src/Table.tsx
38927
39073
  import {
38928
39074
  useContext as useContext21,
38929
- useEffect as useEffect19,
39075
+ useEffect as useEffect20,
38930
39076
  useMemo as useMemo17,
38931
- useState as useState24
39077
+ useState as useState25
38932
39078
  } from "react";
38933
39079
  init_Filter();
38934
39080
  init_paginationProcessing();
@@ -38946,7 +39092,7 @@ var Table = ({
38946
39092
  const [schemaData] = useContext21(SchemaDataContext);
38947
39093
  const { eventTracking } = useContext21(EventTrackingContext);
38948
39094
  const { allReportsById } = useAllReports();
38949
- const [loading, setLoading] = useState24(false);
39095
+ const [loading, setLoading] = useState25(false);
38950
39096
  const report = useMemo17(() => {
38951
39097
  return props.reportId ? allReportsById[props.reportId] : null;
38952
39098
  }, [allReportsById[props.reportId ?? ""]]);
@@ -38999,7 +39145,7 @@ var Table = ({
38999
39145
  setLoading(false);
39000
39146
  }
39001
39147
  };
39002
- useEffect19(() => {
39148
+ useEffect20(() => {
39003
39149
  if (props.reportId === void 0 || props.reportId === "" || clientLoading) {
39004
39150
  return;
39005
39151
  }
@@ -39033,7 +39179,7 @@ var Table = ({
39033
39179
  clientLoading,
39034
39180
  !reports[props.reportId ?? ""]
39035
39181
  ]);
39036
- const [page, setPage] = useState24(0);
39182
+ const [page, setPage] = useState25(0);
39037
39183
  if ("rows" in data && "columns" in data) {
39038
39184
  return /* @__PURE__ */ jsx59(
39039
39185
  QuillTable,
@@ -39094,10 +39240,10 @@ var Table_default = Table;
39094
39240
 
39095
39241
  // src/SQLEditor.tsx
39096
39242
  import {
39097
- useState as useState30,
39243
+ useState as useState31,
39098
39244
  useContext as useContext28,
39099
- useEffect as useEffect24,
39100
- useRef as useRef18,
39245
+ useEffect as useEffect25,
39246
+ useRef as useRef19,
39101
39247
  useMemo as useMemo22,
39102
39248
  useCallback as useCallback3
39103
39249
  } from "react";
@@ -39105,9 +39251,9 @@ import MonacoEditor from "@monaco-editor/react";
39105
39251
 
39106
39252
  // src/ChartBuilder.tsx
39107
39253
  import {
39108
- useEffect as useEffect22,
39109
- useRef as useRef17,
39110
- useState as useState28,
39254
+ useEffect as useEffect23,
39255
+ useRef as useRef18,
39256
+ useState as useState29,
39111
39257
  useContext as useContext26,
39112
39258
  useMemo as useMemo21
39113
39259
  } from "react";
@@ -39133,9 +39279,9 @@ import {
39133
39279
  useCallback as useCallback2,
39134
39280
  useContext as useContext23,
39135
39281
  useMemo as useMemo18,
39136
- useState as useState25,
39137
- useEffect as useEffect20,
39138
- useRef as useRef14
39282
+ useState as useState26,
39283
+ useEffect as useEffect21,
39284
+ useRef as useRef15
39139
39285
  } from "react";
39140
39286
 
39141
39287
  // src/internals/ReportBuilder/PivotList.tsx
@@ -39599,44 +39745,44 @@ var PivotModal = ({
39599
39745
  reportBuilderState
39600
39746
  }) => {
39601
39747
  const { getToken, quillFetchWithToken } = useContext23(FetchContext);
39602
- const [isLoading, setIsLoading] = useState25(false);
39603
- const [previewLoading, setPreviewLoading] = useState25(false);
39604
- const [selectedPivotType, setSelectedPivotType] = useState25("recommended");
39605
- const [errors, setErrors] = useState25([]);
39748
+ const [isLoading, setIsLoading] = useState26(false);
39749
+ const [previewLoading, setPreviewLoading] = useState26(false);
39750
+ const [selectedPivotType, setSelectedPivotType] = useState26("recommended");
39751
+ const [errors, setErrors] = useState26([]);
39606
39752
  const [client] = useContext23(ClientContext);
39607
39753
  const [schemaData] = useContext23(SchemaDataContext);
39608
39754
  const { tenants } = useContext23(TenantContext);
39609
39755
  const { eventTracking } = useContext23(EventTrackingContext);
39610
- const rowFieldRef = useRef14(null);
39611
- const colFieldRef = useRef14(null);
39612
- const [pivotCardWidth, setPivotCardWidth] = useState25(420);
39613
- const [samplePivotTable, setSamplePivotTable] = useState25(null);
39614
- const [hasNoRecommendedPivots, sethasNoRecommendedPivots] = useState25(false);
39615
- const [isFetchingPivots, setIsFetchingPivots] = useState25(false);
39616
- const [allowedColumnFields, setAllowedColumnFields] = useState25([]);
39617
- const [allowedRowFields, setAllowedRowFields] = useState25([]);
39618
- const [allowedValueFields, setAllowedValueFields] = useState25([]);
39619
- const [uniqueValues, setUniqueValues] = useState25(initialUniqueValues);
39620
- const buttonRef = useRef14(null);
39621
- const [dateRanges, setDateRanges] = useState25({});
39622
- const [pivotError, setPivotError] = useState25("");
39623
- const [limitInput, setLimitInput] = useState25(
39756
+ const rowFieldRef = useRef15(null);
39757
+ const colFieldRef = useRef15(null);
39758
+ const [pivotCardWidth, setPivotCardWidth] = useState26(420);
39759
+ const [samplePivotTable, setSamplePivotTable] = useState26(null);
39760
+ const [hasNoRecommendedPivots, sethasNoRecommendedPivots] = useState26(false);
39761
+ const [isFetchingPivots, setIsFetchingPivots] = useState26(false);
39762
+ const [allowedColumnFields, setAllowedColumnFields] = useState26([]);
39763
+ const [allowedRowFields, setAllowedRowFields] = useState26([]);
39764
+ const [allowedValueFields, setAllowedValueFields] = useState26([]);
39765
+ const [uniqueValues, setUniqueValues] = useState26(initialUniqueValues);
39766
+ const buttonRef = useRef15(null);
39767
+ const [dateRanges, setDateRanges] = useState26({});
39768
+ const [pivotError, setPivotError] = useState26("");
39769
+ const [limitInput, setLimitInput] = useState26(
39624
39770
  pivotLimit?.toString() ?? "100"
39625
39771
  );
39626
- const [sortFieldInput, setSortFieldInput] = useState25(
39772
+ const [sortFieldInput, setSortFieldInput] = useState26(
39627
39773
  pivotSort?.sortField ?? ""
39628
39774
  );
39629
- const [sortDirectionInput, setSortDirectionInput] = useState25(
39775
+ const [sortDirectionInput, setSortDirectionInput] = useState26(
39630
39776
  pivotSort?.sortDirection ?? "ASC"
39631
39777
  );
39632
- const [showLimitInput, setShowLimitInput] = useState25(!!pivotLimit);
39633
- const [showSortInput, setShowSortInput] = useState25(!!pivotSort);
39634
- const [availableHeight, setAvailableHeight] = useState25(0);
39635
- const [pivotModalTopHeight, setPivotModalTopHeight] = useState25(450);
39636
- const [popoverPosition, setPopoverPosition] = useState25(
39778
+ const [showLimitInput, setShowLimitInput] = useState26(!!pivotLimit);
39779
+ const [showSortInput, setShowSortInput] = useState26(!!pivotSort);
39780
+ const [availableHeight, setAvailableHeight] = useState26(0);
39781
+ const [pivotModalTopHeight, setPivotModalTopHeight] = useState26(450);
39782
+ const [popoverPosition, setPopoverPosition] = useState26(
39637
39783
  "bottom"
39638
39784
  );
39639
- const popoverRef = useRef14(null);
39785
+ const popoverRef = useRef15(null);
39640
39786
  const getDistinctValues = async (fetchDistinct) => {
39641
39787
  if (!client) {
39642
39788
  return {
@@ -39723,7 +39869,7 @@ var PivotModal = ({
39723
39869
  setDateRanges(dateRangeByColumn || {});
39724
39870
  }
39725
39871
  };
39726
- useEffect20(() => {
39872
+ useEffect21(() => {
39727
39873
  const calculatePivotCardSize = () => {
39728
39874
  if (rowFieldRef.current && colFieldRef.current) {
39729
39875
  const rowFieldSize = rowFieldRef.current?.getBoundingClientRect();
@@ -39744,7 +39890,7 @@ var PivotModal = ({
39744
39890
  }, 500);
39745
39891
  }
39746
39892
  }, [showUpdatePivot, isOpen]);
39747
- useEffect20(() => {
39893
+ useEffect21(() => {
39748
39894
  const fetchPivotData = async () => {
39749
39895
  if (pivotRowField && data && columns && pivotAggregations?.every((p) => p?.valueField && p?.aggregationType)) {
39750
39896
  const pivot = {
@@ -39890,7 +40036,7 @@ var PivotModal = ({
39890
40036
  };
39891
40037
  fetchPivotData();
39892
40038
  }, [initialSelectedPivotTable]);
39893
- useEffect20(() => {
40039
+ useEffect21(() => {
39894
40040
  if (pivotRowField && data && columns) {
39895
40041
  getDistinctValues();
39896
40042
  getAllDateRangesByColumn();
@@ -39898,7 +40044,7 @@ var PivotModal = ({
39898
40044
  getDistinctValues();
39899
40045
  }
39900
40046
  }, [initialSelectedPivotTable, columns, data, pivotRowField]);
39901
- useEffect20(() => {
40047
+ useEffect21(() => {
39902
40048
  setAllowedFields(initialUniqueValues || {});
39903
40049
  setUniqueValues(initialUniqueValues);
39904
40050
  }, [initialUniqueValues, columns]);
@@ -39921,8 +40067,8 @@ var PivotModal = ({
39921
40067
  return map;
39922
40068
  }, {});
39923
40069
  }, [columns]);
39924
- const [selectedPivotTable, setSelectedPivotTable] = useState25(null);
39925
- useEffect20(() => {
40070
+ const [selectedPivotTable, setSelectedPivotTable] = useState26(null);
40071
+ useEffect21(() => {
39926
40072
  const fetchPivotTables = async () => {
39927
40073
  if (selectedPivotIndex === -1) {
39928
40074
  return null;
@@ -39974,8 +40120,8 @@ var PivotModal = ({
39974
40120
  };
39975
40121
  fetchPivotTables();
39976
40122
  }, [selectedPivotIndex, data, dateRange, createdPivots]);
39977
- const previousUniqueValuesRef = useRef14();
39978
- useEffect20(() => {
40123
+ const previousUniqueValuesRef = useRef15();
40124
+ useEffect21(() => {
39979
40125
  if (!uniqueValuesIsLoading && !equal5(uniqueValues, previousUniqueValuesRef.current)) {
39980
40126
  previousUniqueValuesRef.current = uniqueValues;
39981
40127
  setRecommendedPivotTables([]);
@@ -40450,11 +40596,11 @@ var PivotModal = ({
40450
40596
  }
40451
40597
  }, 500);
40452
40598
  };
40453
- const [recommendedPivotTables, setRecommendedPivotTables] = useState25(
40599
+ const [recommendedPivotTables, setRecommendedPivotTables] = useState26(
40454
40600
  []
40455
40601
  );
40456
- const [createdPivotTables, setCreatedPivotTables] = useState25([]);
40457
- useEffect20(() => {
40602
+ const [createdPivotTables, setCreatedPivotTables] = useState26([]);
40603
+ useEffect21(() => {
40458
40604
  const fetchPivotTables = async () => {
40459
40605
  const pts = await Promise.all(
40460
40606
  createdPivots.map(async (p) => {
@@ -40527,7 +40673,7 @@ var PivotModal = ({
40527
40673
  setPopoverPosition("bottom");
40528
40674
  }
40529
40675
  };
40530
- useEffect20(() => {
40676
+ useEffect21(() => {
40531
40677
  handleResize();
40532
40678
  window.addEventListener("resize", handleResize);
40533
40679
  const parentElement = parentRef?.current;
@@ -41353,12 +41499,12 @@ var validateReport = (formData, dashboardData, defaultDateFilter, allTables) =>
41353
41499
 
41354
41500
  // src/components/Chart/InternalChart.tsx
41355
41501
  import {
41356
- useState as useState26,
41357
- useEffect as useEffect21,
41502
+ useState as useState27,
41503
+ useEffect as useEffect22,
41358
41504
  useContext as useContext24,
41359
41505
  useMemo as useMemo19,
41360
- useRef as useRef15,
41361
- useLayoutEffect
41506
+ useRef as useRef16,
41507
+ useLayoutEffect as useLayoutEffect2
41362
41508
  } from "react";
41363
41509
  import { differenceInHours as differenceInHours2 } from "date-fns";
41364
41510
  init_Filter();
@@ -41503,8 +41649,8 @@ function InternalChart({
41503
41649
  reportDateFilter.defaultPresetRanges ?? []
41504
41650
  ) : defaultOptionsV2;
41505
41651
  }, [reportDateFilter]);
41506
- const [filterValues, setFilterValues] = useState26({});
41507
- useEffect21(() => {
41652
+ const [filterValues, setFilterValues] = useState27({});
41653
+ useEffect22(() => {
41508
41654
  if (reportDateFilter) {
41509
41655
  const customDateFilter = filters?.find(
41510
41656
  (f) => f.filterType === "date" /* Date */
@@ -41612,9 +41758,9 @@ function InternalChart({
41612
41758
  }));
41613
41759
  onDashboardFilterChange(filter.label, filterValue);
41614
41760
  };
41615
- const [filtersExpanded, setFiltersExpanded] = useState26(false);
41616
- const filtersContainerRef = useRef15(null);
41617
- const [visibleFilters, setVisibleFilters] = useState26([]);
41761
+ const [filtersExpanded, setFiltersExpanded] = useState27(false);
41762
+ const filtersContainerRef = useRef16(null);
41763
+ const [visibleFilters, setVisibleFilters] = useState27([]);
41618
41764
  const filtersOverflowing = useMemo19(() => {
41619
41765
  return visibleFilters.some((visible) => visible);
41620
41766
  }, [visibleFilters]);
@@ -41630,7 +41776,7 @@ function InternalChart({
41630
41776
  });
41631
41777
  setVisibleFilters(newVisibleItems);
41632
41778
  };
41633
- useLayoutEffect(() => {
41779
+ useLayoutEffect2(() => {
41634
41780
  requestAnimationFrame(() => measureItems());
41635
41781
  const handleResize = () => {
41636
41782
  measureItems();
@@ -41912,8 +42058,8 @@ init_dates();
41912
42058
  import React13, {
41913
42059
  useContext as useContext25,
41914
42060
  useMemo as useMemo20,
41915
- useRef as useRef16,
41916
- useState as useState27
42061
+ useRef as useRef17,
42062
+ useState as useState28
41917
42063
  } from "react";
41918
42064
  import { Fragment as Fragment12, jsx as jsx64, jsxs as jsxs46 } from "react/jsx-runtime";
41919
42065
  function QuillMultiSelectSectionList({
@@ -41931,10 +42077,10 @@ function QuillMultiSelectSectionList({
41931
42077
  owner
41932
42078
  }) {
41933
42079
  const [theme] = useContext25(ThemeContext);
41934
- const [showModal, setShowModal] = useState27(false);
41935
- const modalRef = useRef16(null);
41936
- const buttonRef = useRef16(null);
41937
- const debounceTimeoutId = useRef16(null);
42080
+ const [showModal, setShowModal] = useState28(false);
42081
+ const modalRef = useRef17(null);
42082
+ const buttonRef = useRef17(null);
42083
+ const debounceTimeoutId = useRef17(null);
41938
42084
  const [searchQuery, setSearchQuery] = React13.useState("");
41939
42085
  useOnClickOutside_default(
41940
42086
  modalRef,
@@ -42716,18 +42862,18 @@ function createReportFromForm(formData, report, eventTracking, selectedPivotTabl
42716
42862
  return newReport;
42717
42863
  }
42718
42864
  function ChartBuilderWithModal(props) {
42719
- const parentRef = useRef17(null);
42720
- const [modalWidth, setModalWidth] = useState28(200);
42721
- const [modalHeight, setModalHeight] = useState28(200);
42865
+ const parentRef = useRef18(null);
42866
+ const [modalWidth, setModalWidth] = useState29(200);
42867
+ const [modalHeight, setModalHeight] = useState29(200);
42722
42868
  const { isOpen, setIsOpen, title, isHorizontalView } = props;
42723
42869
  const Modal = props.ModalComponent ?? MemoizedModal;
42724
42870
  const { dashboardReports: dashboard } = useDashboardReports(
42725
42871
  props.destinationDashboard
42726
42872
  );
42727
- const [filtersEnabledState, setFiltersEnabledState] = useState28(
42873
+ const [filtersEnabledState, setFiltersEnabledState] = useState29(
42728
42874
  !!props.reportId
42729
42875
  );
42730
- useEffect22(() => {
42876
+ useEffect23(() => {
42731
42877
  function handleResize() {
42732
42878
  const screenSize = window.innerWidth;
42733
42879
  if (screenSize >= 1200) {
@@ -42846,19 +42992,19 @@ function ChartBuilder({
42846
42992
  const resolvedReport = reportId && !tempReport ? allReportsById[reportId] : tempReport;
42847
42993
  return resolvedReport;
42848
42994
  }, [reportId, tempReport, allReportsById]);
42849
- const [windowWidth, setWindowWidth] = useState28(1200);
42850
- const [rows, setRows] = useState28(report?.rows ?? []);
42851
- const [itemQuery, setItemQuery] = useState28(report?.itemQuery);
42852
- const [rowCount, setRowCount] = useState28(report?.rowCount ?? 0);
42853
- const [maxPage, setMaxPage] = useState28(0);
42854
- const [isLoading, setIsLoading] = useState28(false);
42855
- const [rowCountIsLoading, setRowCountIsLoading] = useState28(false);
42856
- const [isSubmitting, setIsSubmitting] = useState28(false);
42857
- const MIN_FORM_WIDTH = 710;
42858
- const [pivotCardWidth, setPivotCardWidth] = useState28(MIN_FORM_WIDTH);
42859
- const [formWidth, setFormWidth] = useState28(MIN_FORM_WIDTH);
42860
- const inputRef = useRef17(null);
42861
- const selectRef = useRef17(null);
42995
+ const [windowWidth, setWindowWidth] = useState29(1200);
42996
+ const [rows, setRows] = useState29(report?.rows ?? []);
42997
+ const [itemQuery, setItemQuery] = useState29(report?.itemQuery);
42998
+ const [rowCount, setRowCount] = useState29(report?.rowCount ?? 0);
42999
+ const [maxPage, setMaxPage] = useState29(0);
43000
+ const [isLoading, setIsLoading] = useState29(false);
43001
+ const [rowCountIsLoading, setRowCountIsLoading] = useState29(false);
43002
+ const [isSubmitting, setIsSubmitting] = useState29(false);
43003
+ const MIN_FORM_WIDTH = 700;
43004
+ const [pivotCardWidth, setPivotCardWidth] = useState29(MIN_FORM_WIDTH);
43005
+ const [formWidth, setFormWidth] = useState29(MIN_FORM_WIDTH);
43006
+ const inputRef = useRef18(null);
43007
+ const selectRef = useRef18(null);
42862
43008
  const processColumns = (columns2) => {
42863
43009
  if (schemaData.schemaWithCustomFields) {
42864
43010
  const newProcessedColumns = columns2?.map((col) => {
@@ -42888,12 +43034,12 @@ function ChartBuilder({
42888
43034
  }
42889
43035
  return columns2;
42890
43036
  };
42891
- const [processedColumns, setProcessedColumns] = useState28(
43037
+ const [processedColumns, setProcessedColumns] = useState29(
42892
43038
  processColumns(report?.columnInternal ?? [])
42893
43039
  );
42894
- const [currentPage, setCurrentPage] = useState28(0);
42895
- const parentRef = useRef17(null);
42896
- const deleteRef = useRef17(null);
43040
+ const [currentPage, setCurrentPage] = useState29(0);
43041
+ const parentRef = useRef18(null);
43042
+ const deleteRef = useRef18(null);
42897
43043
  const modalPadding = 20;
42898
43044
  const deleteButtonMargin = -12;
42899
43045
  const { dashboardFilters } = useContext26(DashboardFiltersContext);
@@ -42915,7 +43061,7 @@ function ChartBuilder({
42915
43061
  setFilterIssues([]);
42916
43062
  }
42917
43063
  };
42918
- useEffect22(() => {
43064
+ useEffect23(() => {
42919
43065
  const handleResize = () => {
42920
43066
  setWindowWidth(window.innerWidth);
42921
43067
  if (inputRef.current && selectRef.current) {
@@ -42938,7 +43084,7 @@ function ChartBuilder({
42938
43084
  window.removeEventListener("resize", handleResize);
42939
43085
  };
42940
43086
  }, [isOpen]);
42941
- const [dashboardOptions, setDashboardOptions] = useState28([]);
43087
+ const [dashboardOptions, setDashboardOptions] = useState29([]);
42942
43088
  const {
42943
43089
  reportFilters,
42944
43090
  loadFiltersForReport,
@@ -42946,9 +43092,9 @@ function ChartBuilder({
42946
43092
  abortLoadingFilters
42947
43093
  } = useContext26(ReportFiltersContext);
42948
43094
  const { reportsDispatch } = useContext26(ReportsContext);
42949
- const initialFilters = useRef17(reportFilters[report?.id ?? TEMP_REPORT_ID]);
42950
- const [reportFiltersLoaded, setReportFiltersLoaded] = useState28(!filtersEnabled);
42951
- useEffect22(() => {
43095
+ const initialFilters = useRef18(reportFilters[report?.id ?? TEMP_REPORT_ID]);
43096
+ const [reportFiltersLoaded, setReportFiltersLoaded] = useState29(!filtersEnabled);
43097
+ useEffect23(() => {
42952
43098
  if (!reportFilters[report?.id ?? TEMP_REPORT_ID]) {
42953
43099
  loadFiltersForReport(
42954
43100
  report?.id ?? TEMP_REPORT_ID,
@@ -42981,20 +43127,20 @@ function ChartBuilder({
42981
43127
  (f) => f.filter
42982
43128
  );
42983
43129
  }, [reportFilters, report?.id]);
42984
- const [showFilterModal, setShowFilterModal] = useState28(false);
42985
- const [filterIssues, setFilterIssues] = useState28([]);
42986
- const [showPivotPopover, setShowPivotPopover] = useState28(false);
42987
- const [isEdittingPivot, setIsEdittingPivot] = useState28(false);
42988
- const [selectedPivotIndex, setSelectedPivotIndex] = useState28(-1);
42989
- const [tableName, setTableName] = useState28(void 0);
42990
- const [includeCustomFields, setIncludeCustomFields] = useState28(
43130
+ const [showFilterModal, setShowFilterModal] = useState29(false);
43131
+ const [filterIssues, setFilterIssues] = useState29([]);
43132
+ const [showPivotPopover, setShowPivotPopover] = useState29(false);
43133
+ const [isEdittingPivot, setIsEdittingPivot] = useState29(false);
43134
+ const [selectedPivotIndex, setSelectedPivotIndex] = useState29(-1);
43135
+ const [tableName, setTableName] = useState29(void 0);
43136
+ const [includeCustomFields, setIncludeCustomFields] = useState29(
42991
43137
  report ? !!report.includeCustomFields : !!client?.featureFlags?.customFieldsEnabled
42992
43138
  );
42993
43139
  const selectedTable = schemaData.schema?.find(
42994
43140
  (t) => t.displayName === tableName
42995
43141
  );
42996
- const [pivotPopUpTitle, setPivotPopUpTitle] = useState28("Add pivot");
42997
- const [pivotError, setPivotError] = useState28(void 0);
43142
+ const [pivotPopUpTitle, setPivotPopUpTitle] = useState29("Add pivot");
43143
+ const [pivotError, setPivotError] = useState29(void 0);
42998
43144
  const pivotData = report?.pivotRows && report?.pivotColumns ? {
42999
43145
  rows: report.pivotRows,
43000
43146
  columns: report.pivotColumns,
@@ -43005,19 +43151,19 @@ function ChartBuilder({
43005
43151
  const columns = report?.columnInternal ?? [];
43006
43152
  const destinationDashboardName = report?.dashboardName || destinationDashboard;
43007
43153
  const query = report?.queryString;
43008
- const [loadingFormData, setLoadingFormData] = useState28(false);
43009
- const [triggeredEditChart, setTriggeredEditChart] = useState28(false);
43010
- const [createdPivots, setCreatedPivots] = useState28(
43154
+ const [loadingFormData, setLoadingFormData] = useState29(false);
43155
+ const [triggeredEditChart, setTriggeredEditChart] = useState29(false);
43156
+ const [createdPivots, setCreatedPivots] = useState29(
43011
43157
  report?.pivot ? [report.pivot] : cp
43012
43158
  );
43013
- const [recommendedPivots, setRecommendedPivots] = useState28(rp);
43014
- const [pivotRowField, setPivotRowField] = useState28(
43159
+ const [recommendedPivots, setRecommendedPivots] = useState29(rp);
43160
+ const [pivotRowField, setPivotRowField] = useState29(
43015
43161
  report?.pivot?.rowField
43016
43162
  );
43017
- const [pivotColumnField, setPivotColumnField] = useState28(
43163
+ const [pivotColumnField, setPivotColumnField] = useState29(
43018
43164
  report?.pivot?.columnField
43019
43165
  );
43020
- const [pivotAggregations, setPivotAggregations] = useState28(
43166
+ const [pivotAggregations, setPivotAggregations] = useState29(
43021
43167
  report?.pivot?.aggregations ?? [
43022
43168
  {
43023
43169
  valueField: report?.pivot?.valueField,
@@ -43026,10 +43172,10 @@ function ChartBuilder({
43026
43172
  }
43027
43173
  ]
43028
43174
  );
43029
- const [pivotLimit, setPivotLimit] = useState28(
43175
+ const [pivotLimit, setPivotLimit] = useState29(
43030
43176
  report?.pivot?.rowLimit
43031
43177
  );
43032
- const [pivotSort, setPivotSort] = useState28(
43178
+ const [pivotSort, setPivotSort] = useState29(
43033
43179
  report?.pivot?.sort && report?.pivot?.sortDirection && report?.pivot?.sortField ? {
43034
43180
  sortField: report.pivot.sortField,
43035
43181
  sortDirection: report.pivot.sortDirection
@@ -43042,16 +43188,17 @@ function ChartBuilder({
43042
43188
  rowsPerRequest: report?.chartType === "table" ? 50 : 500
43043
43189
  }
43044
43190
  };
43045
- const [currentProcessing, setCurrentProcessing] = useState28(baseProcessing);
43046
- const [customTenantAccess, setCustomTenantAccess] = useState28(
43191
+ const [currentProcessing, setCurrentProcessing] = useState29(baseProcessing);
43192
+ const [customTenantAccess, setCustomTenantAccess] = useState29(
43047
43193
  report?.flags === null ? false : !!Object.values(report?.flags ?? {}).length
43048
43194
  );
43049
- const [dateFieldOptions, setDateFieldOptions] = useState28([]);
43050
- const [allTables, setAllTables] = useState28([]);
43051
- const [customFieldTableRef, setCustomFieldTableRef] = useState28(false);
43052
- const [referencedColumns, setReferencedColumns] = useState28({});
43053
- const [referencedColumnsWithoutStar, setReferencedColumnsWithoutStar] = useState28({});
43054
- const [filterMap, setFilterMap] = useState28(report?.filterMap ?? {});
43195
+ const [dateFieldOptions, setDateFieldOptions] = useState29([]);
43196
+ const [allTables, setAllTables] = useState29([]);
43197
+ const [customFieldTableRef, setCustomFieldTableRef] = useState29(false);
43198
+ const [referencedColumns, setReferencedColumns] = useState29({});
43199
+ const [referencedColumnsWithoutStar, setReferencedColumnsWithoutStar] = useState29({});
43200
+ const [referencedTablesLoaded, setReferencedTablesLoaded] = useState29(false);
43201
+ const [filterMap, setFilterMap] = useState29(report?.filterMap ?? {});
43055
43202
  const canonicalFilterMap = useMemo21(() => {
43056
43203
  return Object.fromEntries(
43057
43204
  Object.entries(filterMap).filter(
@@ -43062,7 +43209,7 @@ function ChartBuilder({
43062
43209
  const validFilter = useMemo21(() => {
43063
43210
  return specificDashboardFilters.reduce(
43064
43211
  (acc, filter) => {
43065
- if (filter.filterType === "date_range" || filter.filterType === "tenant") {
43212
+ if (filter.filterType === "date_range" || filter.filterType === "tenant" || !referencedTablesLoaded) {
43066
43213
  acc[filter.label] = true;
43067
43214
  return acc;
43068
43215
  }
@@ -43077,8 +43224,8 @@ function ChartBuilder({
43077
43224
  },
43078
43225
  {}
43079
43226
  );
43080
- }, [specificDashboardFilters, filterMap, allTables]);
43081
- const [formFlags, setFormFlags] = useState28(
43227
+ }, [specificDashboardFilters, filterMap, allTables, referencedTablesLoaded]);
43228
+ const [formFlags, setFormFlags] = useState29(
43082
43229
  report?.flags ? Object.fromEntries(
43083
43230
  Object.entries(report.flags).map(([key, value]) => {
43084
43231
  if (value === ALL_TENANTS) {
@@ -43095,7 +43242,7 @@ function ChartBuilder({
43095
43242
  })
43096
43243
  ) : void 0
43097
43244
  );
43098
- const [defaultDateField, setDefaultDateField] = useState28({
43245
+ const [defaultDateField, setDefaultDateField] = useState29({
43099
43246
  table: dateFieldOptions[0]?.name || "",
43100
43247
  field: dateFieldOptions[0]?.columns[0]?.field || ""
43101
43248
  });
@@ -43274,7 +43421,7 @@ function ChartBuilder({
43274
43421
  }
43275
43422
  return chartBuilderData;
43276
43423
  };
43277
- const [formData, setFormData] = useState28(
43424
+ const [formData, setFormData] = useState29(
43278
43425
  formFormDataFromReport(report, destinationSection ?? getCurrentSection())
43279
43426
  );
43280
43427
  const reportCustomFields = useMemo21(() => {
@@ -43328,7 +43475,7 @@ function ChartBuilder({
43328
43475
  const columnsObservedInRows = rows[0] ? Object.keys(rows[0]) : [];
43329
43476
  return columns.filter((col) => !columnsObservedInRows.includes(col.field));
43330
43477
  }, [rows]);
43331
- const [chartTypes, setChartTypes] = useState28(
43478
+ const [chartTypes, setChartTypes] = useState29(
43332
43479
  (() => {
43333
43480
  const data = formFormDataFromReport(
43334
43481
  report,
@@ -43397,12 +43544,12 @@ function ChartBuilder({
43397
43544
  customFieldsInTabularColumns,
43398
43545
  chartBuilderFormDataContainsCustomFields
43399
43546
  ]);
43400
- useEffect22(() => {
43547
+ useEffect23(() => {
43401
43548
  if (!loadingFormData && triggeredEditChart) {
43402
43549
  editChart();
43403
43550
  }
43404
43551
  }, [loadingFormData]);
43405
- useEffect22(() => {
43552
+ useEffect23(() => {
43406
43553
  async function getFormData() {
43407
43554
  if (!client) {
43408
43555
  return;
@@ -43443,6 +43590,7 @@ function ChartBuilder({
43443
43590
  setLoadingFormData(false);
43444
43591
  return;
43445
43592
  }
43593
+ setReferencedTablesLoaded(false);
43446
43594
  const result = await getReferencedTables(
43447
43595
  client,
43448
43596
  curSchemaData,
@@ -43520,12 +43668,13 @@ function ChartBuilder({
43520
43668
  curFormData.dateField ?? dateField,
43521
43669
  tableNames
43522
43670
  );
43671
+ setReferencedTablesLoaded(true);
43523
43672
  setLoadingFormData(false);
43524
43673
  }
43525
43674
  getFormData();
43526
43675
  }, []);
43527
- const ranMountQuery = useRef17(false);
43528
- useEffect22(() => {
43676
+ const ranMountQuery = useRef18(false);
43677
+ useEffect23(() => {
43529
43678
  if (runQueryOnMount && reportFiltersLoaded && filtersEnabled && !ranMountQuery.current) {
43530
43679
  ranMountQuery.current = true;
43531
43680
  handleRunQuery(baseProcessing, currentDashboardFilters);
@@ -43550,7 +43699,7 @@ function ChartBuilder({
43550
43699
  {}
43551
43700
  ) ?? {};
43552
43701
  }, [client?.allTenantTypes]);
43553
- const [selectedPivotTable, setSelectedPivotTable] = useState28(pivotData);
43702
+ const [selectedPivotTable, setSelectedPivotTable] = useState29(pivotData);
43554
43703
  const pivotCardTable = useMemo21(() => {
43555
43704
  return {
43556
43705
  pivot: formData.pivot,
@@ -43735,8 +43884,8 @@ function ChartBuilder({
43735
43884
  handleRunQuery(baseProcessing, updatedFilters);
43736
43885
  });
43737
43886
  };
43738
- const filtersEnabledRef = useRef17(filtersEnabled);
43739
- useEffect22(() => {
43887
+ const filtersEnabledRef = useRef18(filtersEnabled);
43888
+ useEffect23(() => {
43740
43889
  if (filtersEnabledRef.current !== filtersEnabled) {
43741
43890
  filtersEnabledRef.current = filtersEnabled;
43742
43891
  setCurrentPage(0);
@@ -45479,16 +45628,22 @@ function ChartBuilder({
45479
45628
  )
45480
45629
  }
45481
45630
  ),
45482
- (!formData.dateField?.table || !formData.dateField?.field) && /* @__PURE__ */ jsx65("div", { style: { marginBottom: 8, marginTop: "auto" }, children: /* @__PURE__ */ jsx65(
45483
- ExclamationFilledIcon_default,
45631
+ referencedTablesLoaded && (!formData.dateField?.table || !formData.dateField?.field) && /* @__PURE__ */ jsx65(
45632
+ "div",
45484
45633
  {
45485
- height: 28,
45486
- width: 28,
45487
- style: {
45488
- color: "#dc143c"
45489
- }
45634
+ style: { marginBottom: 8, marginTop: "auto" },
45635
+ children: /* @__PURE__ */ jsx65(
45636
+ ExclamationFilledIcon_default,
45637
+ {
45638
+ height: 28,
45639
+ width: 28,
45640
+ style: {
45641
+ color: "#dc143c"
45642
+ }
45643
+ }
45644
+ )
45490
45645
  }
45491
- ) })
45646
+ )
45492
45647
  ] }),
45493
45648
  specificDashboardFilters.length > 0 && /* @__PURE__ */ jsx65(
45494
45649
  "div",
@@ -45559,10 +45714,13 @@ function ChartBuilder({
45559
45714
  hideEmptyOption: true
45560
45715
  }
45561
45716
  ),
45562
- !validFilter[filter.label] && /* @__PURE__ */ jsx65(
45717
+ referencedTablesLoaded && !validFilter[filter.label] && /* @__PURE__ */ jsx65(
45563
45718
  "div",
45564
45719
  {
45565
- style: { marginBottom: 8, marginTop: "auto" },
45720
+ style: {
45721
+ marginBottom: 8,
45722
+ marginTop: "auto"
45723
+ },
45566
45724
  children: /* @__PURE__ */ jsx65(
45567
45725
  ExclamationFilledIcon_default,
45568
45726
  {
@@ -45851,21 +46009,6 @@ function DashboardFilterModal({
45851
46009
  );
45852
46010
  }
45853
46011
 
45854
- // src/utils/width.ts
45855
- var updateFirstChildWidth = (containerRef, setState, options = { gap: 0 }) => {
45856
- if (containerRef.current) {
45857
- const element = containerRef.current;
45858
- const totalWidth = element.getBoundingClientRect().width;
45859
- const gapWidth = options.gap * (element.childElementCount - 1);
45860
- let siblingsWidth = 0;
45861
- const children = Array.from(containerRef.current.children);
45862
- for (let i = 1; i < children.length; i++) {
45863
- siblingsWidth += children[i].getBoundingClientRect().width;
45864
- }
45865
- setState(totalWidth - siblingsWidth - gapWidth);
45866
- }
45867
- };
45868
-
45869
46012
  // src/SQLEditor.tsx
45870
46013
  init_tableProcessing();
45871
46014
  init_queryConstructor();
@@ -46209,7 +46352,7 @@ init_astProcessing();
46209
46352
  init_constants();
46210
46353
 
46211
46354
  // src/hooks/useLongLoading.tsx
46212
- import { useContext as useContext27, useEffect as useEffect23, useState as useState29 } from "react";
46355
+ import { useContext as useContext27, useEffect as useEffect24, useState as useState30 } from "react";
46213
46356
  function useLongLoading(isLoading, meta) {
46214
46357
  const {
46215
46358
  origin,
@@ -46217,10 +46360,10 @@ function useLongLoading(isLoading, meta) {
46217
46360
  abnormalLoadTime = 15e3,
46218
46361
  loadDescription
46219
46362
  } = meta;
46220
- const [isLongLoading, setIsLongLoading] = useState29(false);
46221
- const [isAbnormalLoading, setIsAbnormalLoading] = useState29(false);
46363
+ const [isLongLoading, setIsLongLoading] = useState30(false);
46364
+ const [isAbnormalLoading, setIsAbnormalLoading] = useState30(false);
46222
46365
  const { eventTracking } = useContext27(EventTrackingContext);
46223
- useEffect23(() => {
46366
+ useEffect24(() => {
46224
46367
  let longTimer = null;
46225
46368
  let abnormalTimer = null;
46226
46369
  if (isLoading) {
@@ -46382,7 +46525,7 @@ function SQLEditor({
46382
46525
  onDiscardChanges,
46383
46526
  onSaveChanges,
46384
46527
  onCloseChartBuilder,
46385
- isChartBuilderEnabled = false,
46528
+ isChartBuilderEnabled = true,
46386
46529
  isAdminEnabled = false,
46387
46530
  chartBuilderOptions,
46388
46531
  chartBuilderTitle,
@@ -46402,7 +46545,14 @@ function SQLEditor({
46402
46545
  onRequestAddVirtualTable
46403
46546
  }) {
46404
46547
  const computedButtonLabel = addToDashboardButtonLabel === "Add to dashboard" ? reportId || report?.id ? "Save changes" : "Add to dashboard" : addToDashboardButtonLabel;
46405
- const [sqlPrompt, setSqlPrompt] = useState30("");
46548
+ const [sqlPrompt, setSqlPrompt] = useState31("");
46549
+ const sqlPromptFormRef = useRef19(null);
46550
+ const sqlPromptInputWidth = useResponsiveFirstChildWidth_default(sqlPromptFormRef, {
46551
+ gap: 12,
46552
+ initialWidth: 320,
46553
+ minWidth: 160
46554
+ });
46555
+ const normalizedSqlPromptWidth = sqlPromptInputWidth > 0 ? sqlPromptInputWidth : 160;
46406
46556
  const [client] = useContext28(ClientContext);
46407
46557
  const [theme] = useContext28(ThemeContext);
46408
46558
  const { tenants, flags } = useContext28(TenantContext);
@@ -46418,9 +46568,9 @@ function SQLEditor({
46418
46568
  const destinationDashboardConfig = useMemo22(() => {
46419
46569
  return dashboards?.find((d) => d.name === destinationDashboard);
46420
46570
  }, [dashboards, destinationDashboard]);
46421
- const [query, setQuery] = useState30(defaultQuery);
46422
- const [rows, setRows] = useState30([]);
46423
- const [columns, setColumns] = useState30([]);
46571
+ const [query, setQuery] = useState31(defaultQuery);
46572
+ const [rows, setRows] = useState31([]);
46573
+ const [columns, setColumns] = useState31([]);
46424
46574
  const [schemaData] = useContext28(SchemaDataContext);
46425
46575
  const { dashboardFilters } = useContext28(DashboardFiltersContext);
46426
46576
  const specificDashboardFilters = useMemo22(() => {
@@ -46428,37 +46578,32 @@ function SQLEditor({
46428
46578
  dashboardFilters[report?.dashboardName ?? destinationDashboard ?? ""] ?? {}
46429
46579
  ).map((f) => f.filter);
46430
46580
  }, [dashboardFilters, destinationDashboard]);
46431
- const [errorMessage, setErrorMessage] = useState30("");
46432
- const [sqlResponseLoading, setSqlResponseLoading] = useState30(false);
46581
+ const [errorMessage, setErrorMessage] = useState31("");
46582
+ const [sqlResponseLoading, setSqlResponseLoading] = useState31(false);
46433
46583
  useLongLoading(sqlResponseLoading, {
46434
46584
  origin: "SQLEditor",
46435
46585
  loadDescription: "Loading SQL response"
46436
46586
  });
46437
- const [sqlQueryLoading, setSqlQueryLoading] = useState30(false);
46587
+ const [sqlQueryLoading, setSqlQueryLoading] = useState31(false);
46438
46588
  useLongLoading(sqlQueryLoading, {
46439
46589
  origin: "SQLEditor",
46440
46590
  loadDescription: "Loading SQL query"
46441
46591
  });
46442
- const [isChartBuilderOpen, setIsChartBuilderOpen] = useState30(false);
46443
- const [displayTable, setDisplayTable] = useState30(false);
46444
- const [formattedRows, setFormattedRows] = useState30([]);
46445
- const formRef = useRef18(null);
46446
- const sidebarRef = useRef18(null);
46447
- const [searchBarWidth, setSearchBarWidth] = useState30(200);
46448
- const [showSearchBar, setShowSearchBar] = useState30(false);
46449
- const [filterBarWidth, setFilterBarWidth] = useState30(200);
46450
- const [rowCount, setRowCount] = useState30(void 0);
46451
- const [rowCountIsLoading, setRowCountIsLoading] = useState30(false);
46452
- const [maxPage, setMaxPage] = useState30(1);
46453
- const [tableSearchQuery, setTableSearchQuery] = useState30("");
46454
- const [lastSuccessfulQuery, setLastSuccessfulQuery] = useState30("");
46455
- const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = useState30(false);
46456
- const [tempReport, setTempReport] = useState30({
46592
+ const [isChartBuilderOpen, setIsChartBuilderOpen] = useState31(false);
46593
+ const [displayTable, setDisplayTable] = useState31(false);
46594
+ const [formattedRows, setFormattedRows] = useState31([]);
46595
+ const [rowCount, setRowCount] = useState31(void 0);
46596
+ const [rowCountIsLoading, setRowCountIsLoading] = useState31(false);
46597
+ const [maxPage, setMaxPage] = useState31(1);
46598
+ const [tableSearchQuery, setTableSearchQuery] = useState31("");
46599
+ const [lastSuccessfulQuery, setLastSuccessfulQuery] = useState31("");
46600
+ const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = useState31(false);
46601
+ const [tempReport, setTempReport] = useState31({
46457
46602
  ...EMPTY_INTERNAL_REPORT,
46458
46603
  ...report
46459
46604
  });
46460
- const tableRef = useRef18(null);
46461
- const [cachedHeight, setCachedHeight] = useState30(0);
46605
+ const tableRef = useRef19(null);
46606
+ const [cachedHeight, setCachedHeight] = useState31(0);
46462
46607
  const DEFAULT_ROWS_PER_PAGE = 5;
46463
46608
  const ROW_HEIGHT = 37;
46464
46609
  const TABLE_TAB_HEIGHT = 75;
@@ -46472,17 +46617,17 @@ function SQLEditor({
46472
46617
  schemaData.schemaWithCustomFields,
46473
46618
  destinationDashboardConfig?.tenantKeys
46474
46619
  ]);
46475
- useEffect24(() => {
46620
+ useEffect25(() => {
46476
46621
  if (tableRef.current) {
46477
46622
  setCachedHeight(tableRef.current.clientHeight);
46478
46623
  }
46479
46624
  }, [tableRef.current?.clientHeight]);
46480
- useEffect24(() => {
46625
+ useEffect25(() => {
46481
46626
  if (!data && !dashboardIsLoading) {
46482
46627
  reload();
46483
46628
  }
46484
46629
  }, [data, dashboardIsLoading]);
46485
- useEffect24(() => {
46630
+ useEffect25(() => {
46486
46631
  const loadReport = async () => {
46487
46632
  let reportToLoad;
46488
46633
  if (!client) {
@@ -46535,8 +46680,8 @@ function SQLEditor({
46535
46680
  rowsPerPage * 10
46536
46681
  )
46537
46682
  };
46538
- const [currentPage, setCurrentPage] = useState30(0);
46539
- const [currentSort, setCurrentSort] = useState30(void 0);
46683
+ const [currentPage, setCurrentPage] = useState31(0);
46684
+ const [currentSort, setCurrentSort] = useState31(void 0);
46540
46685
  const currentProcessing = useMemo22(() => {
46541
46686
  return {
46542
46687
  page: {
@@ -46557,29 +46702,14 @@ function SQLEditor({
46557
46702
  );
46558
46703
  }) ?? [];
46559
46704
  }, [tableSearchQuery, schemaData.schemaWithCustomFields]);
46560
- useEffect24(() => {
46561
- function handleResize() {
46562
- updateFirstChildWidth(formRef, setSearchBarWidth, { gap: 12 });
46563
- updateFirstChildWidth(sidebarRef, setFilterBarWidth, { gap: 12 });
46564
- setShowSearchBar(true);
46565
- }
46566
- (async () => {
46567
- await new Promise((resolve) => setTimeout(resolve, 30));
46568
- handleResize();
46569
- })();
46570
- window.addEventListener("resize", handleResize);
46571
- return () => {
46572
- window.removeEventListener("resize", handleResize);
46573
- };
46574
- }, []);
46575
- useEffect24(() => {
46705
+ useEffect25(() => {
46576
46706
  if (client) {
46577
46707
  setRows([]);
46578
46708
  setColumns([]);
46579
46709
  setDisplayTable(false);
46580
46710
  }
46581
46711
  }, [client?.publicKey]);
46582
- useEffect24(() => {
46712
+ useEffect25(() => {
46583
46713
  if (isChartBuilderOpen === false) {
46584
46714
  onCloseChartBuilder && onCloseChartBuilder();
46585
46715
  }
@@ -46840,7 +46970,7 @@ function SQLEditor({
46840
46970
  }
46841
46971
  return getTablesHelper(getSelectFromAST(resp.ast), dbTables, skipStar);
46842
46972
  };
46843
- useEffect24(() => {
46973
+ useEffect25(() => {
46844
46974
  if (onChangeQuery) {
46845
46975
  onChangeQuery(query || "");
46846
46976
  }
@@ -46897,7 +47027,11 @@ function SQLEditor({
46897
47027
  style: {
46898
47028
  paddingTop: 16,
46899
47029
  paddingLeft: "20px",
46900
- paddingRight: "30px"
47030
+ paddingRight: "30px",
47031
+ width: "100%",
47032
+ maxWidth: 350,
47033
+ minWidth: 250,
47034
+ boxSizing: "border-box"
46901
47035
  },
46902
47036
  children: /* @__PURE__ */ jsx66(
46903
47037
  TextInputComponent,
@@ -46908,7 +47042,7 @@ function SQLEditor({
46908
47042
  },
46909
47043
  value: tableSearchQuery,
46910
47044
  id: "edit-name",
46911
- width: filterBarWidth
47045
+ width: "100%"
46912
47046
  }
46913
47047
  )
46914
47048
  }
@@ -46928,7 +47062,7 @@ function SQLEditor({
46928
47062
  ]
46929
47063
  }
46930
47064
  ),
46931
- /* @__PURE__ */ jsxs48(
47065
+ /* @__PURE__ */ jsx66(
46932
47066
  "div",
46933
47067
  {
46934
47068
  style: {
@@ -46940,391 +47074,385 @@ function SQLEditor({
46940
47074
  height: "100%",
46941
47075
  overflowX: "hidden"
46942
47076
  },
46943
- children: [
46944
- /* @__PURE__ */ jsx66(
46945
- "div",
46946
- {
46947
- style: {
46948
- display: "flex",
46949
- flexDirection: "column",
46950
- overflow: addToDashboardButtonLabel === "Add to dashboard" ? "visible" : "auto",
46951
- height: "100%"
46952
- },
46953
- children: /* @__PURE__ */ jsxs48(OverflowContainer, { children: [
46954
- /* @__PURE__ */ jsxs48(
46955
- "form",
46956
- {
46957
- ref: formRef,
46958
- onSubmit: (e) => {
46959
- e.preventDefault();
46960
- if (sqlPrompt.trim().length > 500) {
46961
- return;
46962
- }
46963
- debounceRunSqlPrompt();
46964
- },
46965
- style: {
46966
- display: "flex",
46967
- visibility: showSearchBar ? "visible" : "hidden",
46968
- flexDirection: "row",
46969
- gap: 12,
46970
- paddingTop: 16,
46971
- paddingBottom: 16
46972
- },
46973
- children: [
46974
- /* @__PURE__ */ jsx66(
46975
- TextInputComponent,
46976
- {
46977
- id: "ai-search",
46978
- value: sqlPrompt,
46979
- width: searchBarWidth,
46980
- onChange: (e) => setSqlPrompt(e.target.value),
46981
- placeholder: "Ask a question..."
46982
- }
46983
- ),
46984
- /* @__PURE__ */ jsx66(
46985
- QuillToolTip,
46986
- {
46987
- text: "Prompt must be less than 500 characters",
46988
- enabled: sqlPrompt.trim().length > 500,
46989
- displayBelow: true,
46990
- textStyle: {
46991
- maxWidth: "77px",
46992
- whiteSpace: "normal"
46993
- },
46994
- children: /* @__PURE__ */ jsx66(
46995
- ButtonComponent,
46996
- {
46997
- onClick: debounceRunSqlPrompt,
46998
- label: "Ask AI",
46999
- isLoading: sqlResponseLoading,
47000
- disabled: sqlPrompt.trim().length > 500
47001
- }
47002
- )
47003
- }
47004
- )
47005
- ]
47006
- }
47007
- ),
47008
- /* @__PURE__ */ jsx66(
47009
- "div",
47010
- {
47011
- style: {
47012
- minHeight: "max(210px, 20vh)",
47013
- maxHeight: "30%",
47014
- height: "20vh"
47015
- },
47016
- children: /* @__PURE__ */ jsx66(
47017
- SQLEditorComponent,
47077
+ children: /* @__PURE__ */ jsx66(
47078
+ "div",
47079
+ {
47080
+ style: {
47081
+ display: "flex",
47082
+ flexDirection: "column",
47083
+ overflow: addToDashboardButtonLabel === "Add to dashboard" ? "visible" : "auto",
47084
+ height: "100%"
47085
+ },
47086
+ children: /* @__PURE__ */ jsxs48(OverflowContainer, { children: [
47087
+ /* @__PURE__ */ jsxs48(
47088
+ "form",
47089
+ {
47090
+ ref: sqlPromptFormRef,
47091
+ onSubmit: (e) => {
47092
+ e.preventDefault();
47093
+ if (sqlPrompt.trim().length > 500) {
47094
+ return;
47095
+ }
47096
+ debounceRunSqlPrompt();
47097
+ },
47098
+ style: {
47099
+ display: "flex",
47100
+ flexDirection: "row",
47101
+ gap: 12,
47102
+ paddingTop: 16,
47103
+ paddingBottom: 16,
47104
+ flexWrap: "wrap",
47105
+ alignItems: "stretch",
47106
+ visibility: normalizedSqlPromptWidth > 0 ? "visible" : "hidden"
47107
+ },
47108
+ children: [
47109
+ /* @__PURE__ */ jsx66(
47110
+ TextInputComponent,
47018
47111
  {
47019
- query: query || "",
47020
- schema: filteredSchema,
47021
- databaseType: client?.databaseType ?? "postgresql",
47022
- clientName: client?.publicKey || "",
47023
- setQuery,
47024
- handleRunQuery: () => {
47025
- handleRunQuery(currentProcessing, true);
47026
- },
47027
- handleFixWithAI,
47028
- isNewQueryEnabled,
47029
- runQueryOnMount,
47030
- handleClearQuery,
47031
- theme,
47032
- defineEditorTheme,
47033
- setEditorTheme,
47034
- setEditorMounted: () => {
47035
- },
47036
- ButtonComponent,
47037
- SecondaryButtonComponent,
47038
- loading: sqlResponseLoading && schemaData.isSchemaLoading && dashboardIsLoading,
47039
- LoadingComponent
47112
+ id: "ai-search",
47113
+ value: sqlPrompt,
47114
+ width: normalizedSqlPromptWidth,
47115
+ onChange: (e) => setSqlPrompt(e.target.value),
47116
+ placeholder: "Ask a question..."
47040
47117
  }
47041
- )
47042
- }
47043
- ),
47044
- /* @__PURE__ */ jsx66(
47045
- "div",
47046
- {
47047
- style: {
47048
- display: "flex",
47049
- flexDirection: "row",
47050
- width: "100%",
47051
- justifyContent: addToDashboardButtonLabel === "Add to dashboard" ? "flex-end" : "flex-start"
47052
- },
47053
- children: /* @__PURE__ */ jsx66(
47054
- "div",
47118
+ ),
47119
+ /* @__PURE__ */ jsx66(
47120
+ QuillToolTip,
47055
47121
  {
47056
- style: {
47057
- display: "flex",
47058
- flexDirection: "row",
47059
- alignItems: "center",
47060
- height: 70
47122
+ text: "Prompt must be less than 500 characters",
47123
+ enabled: sqlPrompt.trim().length > 500,
47124
+ displayBelow: true,
47125
+ textStyle: {
47126
+ maxWidth: "77px",
47127
+ whiteSpace: "normal"
47061
47128
  },
47062
- children: /* @__PURE__ */ jsxs48("div", { style: { display: "flex", gap: 12 }, children: [
47063
- computedButtonLabel === "Add to dashboard" ? /* @__PURE__ */ jsx66(
47064
- SecondaryButtonComponent,
47065
- {
47066
- onClick: () => {
47067
- handleRunQuery(
47068
- {
47069
- page: pagination,
47070
- sort: void 0
47071
- },
47072
- true,
47073
- false,
47074
- true
47075
- );
47076
- },
47077
- label: "Run query"
47078
- }
47079
- ) : /* @__PURE__ */ jsx66(
47080
- ButtonComponent,
47081
- {
47082
- onClick: () => {
47083
- handleRunQuery(
47084
- {
47085
- page: pagination,
47086
- sort: void 0
47087
- },
47088
- true,
47089
- false,
47090
- true
47091
- );
47092
- },
47093
- label: "Run query"
47094
- }
47095
- ),
47096
- isAdminEnabled && !report && /* @__PURE__ */ jsx66(
47097
- SecondaryButtonComponent,
47098
- {
47099
- disabled: !!errorMessage || !(lastSuccessfulQuery === query) || !query,
47100
- onClick: async () => {
47101
- const isSelectStar = isSimpleSelectStarQuery(
47102
- query ?? ""
47103
- );
47104
- let tables = [];
47105
- let customFieldColumns = [];
47106
- if (client && isSelectStar && schemaData.customFields) {
47107
- const { referencedTablesAndColumns } = await getReferencedTables(
47108
- client,
47109
- query ?? "",
47110
- schemaData.schemaWithCustomFields,
47111
- isSelectStar
47112
- );
47113
- tables = referencedTablesAndColumns.map(
47114
- (ref) => ref.name
47115
- );
47116
- customFieldColumns = tables.map((table) => {
47117
- return (schemaData.customFields?.[table] ?? []).map((field) => field.field);
47118
- }).flat();
47119
- }
47120
- setTempReport({
47121
- ...tempReport,
47122
- id: TEMP_REPORT_ID,
47123
- rows,
47124
- columns: isSelectStar ? (
47125
- // so Automatic Custom Fields can be applied
47126
- columns.filter(
47127
- (col) => {
47128
- return !customFieldColumns.includes(
47129
- col.field
47130
- );
47131
- }
47132
- )
47133
- ) : columns,
47134
- includeCustomFields: isSelectStar,
47135
- columnInternal: columns,
47136
- rowCount: rowCount ?? 0,
47137
- queryString: query ?? "",
47138
- chartType: "table",
47139
- dashboardName: destinationDashboard
47140
- });
47141
- setIsSaveQueryModalOpen(true);
47142
- },
47143
- label: "Save query"
47144
- }
47145
- ),
47146
- isNewQueryEnabled && /* @__PURE__ */ jsx66(
47147
- SecondaryButtonComponent,
47148
- {
47149
- onClick: handleClearQuery,
47150
- label: "Clear query"
47151
- }
47152
- ),
47153
- computedButtonLabel === "Add to dashboard" && /* @__PURE__ */ jsx66(
47154
- ButtonComponent,
47155
- {
47156
- onClick: async () => {
47157
- onSaveChanges && onSaveChanges();
47158
- const isSelectStar = isSimpleSelectStarQuery(
47159
- query ?? ""
47160
- );
47161
- let tables = [];
47162
- let customFieldColumns = [];
47163
- if (client && isSelectStar && schemaData.customFields) {
47164
- const { referencedTablesAndColumns } = await getReferencedTables(
47165
- client,
47166
- query ?? "",
47167
- filteredSchema,
47168
- isSelectStar
47169
- );
47170
- tables = referencedTablesAndColumns.map(
47171
- (ref) => ref.name
47172
- );
47173
- customFieldColumns = tables.map((table) => {
47174
- return (schemaData.customFields?.[table] ?? []).map((field) => field.field);
47175
- }).flat();
47176
- }
47177
- const newTempReport = {
47178
- ...tempReport,
47179
- id: reportId || report?.id || TEMP_REPORT_ID,
47180
- rows,
47181
- columns: isSelectStar ? (
47182
- // so Automatic Custom Fields can be applied
47183
- columns.filter(
47184
- (col) => {
47185
- return !customFieldColumns.includes(
47186
- col.field
47187
- );
47188
- }
47189
- )
47190
- ) : columns,
47191
- includeCustomFields: isSelectStar,
47192
- columnInternal: columns,
47193
- rowCount: rowCount ?? 0,
47194
- queryString: query ?? "",
47195
- dashboardName: report?.dashboardName ?? destinationDashboard
47196
- };
47197
- setTempReport(newTempReport);
47198
- setIsChartBuilderOpen(true);
47199
- },
47200
- label: computedButtonLabel,
47201
- disabled: !!errorMessage || !(lastSuccessfulQuery === query) || !query,
47202
- tooltipText: !!errorMessage || !(lastSuccessfulQuery === query) ? "Please run a query" : ""
47203
- }
47204
- )
47205
- ] })
47129
+ children: /* @__PURE__ */ jsx66(
47130
+ ButtonComponent,
47131
+ {
47132
+ onClick: debounceRunSqlPrompt,
47133
+ label: "Ask AI",
47134
+ isLoading: sqlResponseLoading,
47135
+ disabled: sqlPrompt.trim().length > 500
47136
+ }
47137
+ )
47206
47138
  }
47207
47139
  )
47208
- }
47209
- ),
47210
- /* @__PURE__ */ jsxs48(
47211
- "div",
47212
- {
47213
- style: {
47214
- display: "flex",
47215
- flexDirection: "column",
47216
- // height: '100%',
47217
- padding: 0,
47218
- margin: 0,
47219
- border: "none",
47220
- outline: "none"
47221
- },
47222
- children: [
47223
- errorMessage && /* @__PURE__ */ jsx66(
47140
+ ]
47141
+ }
47142
+ ),
47143
+ /* @__PURE__ */ jsx66(
47144
+ "div",
47145
+ {
47146
+ style: {
47147
+ minHeight: "max(210px, 20vh)",
47148
+ maxHeight: "30%",
47149
+ height: "20vh"
47150
+ },
47151
+ children: /* @__PURE__ */ jsx66(
47152
+ SQLEditorComponent,
47153
+ {
47154
+ query: query || "",
47155
+ schema: filteredSchema,
47156
+ databaseType: client?.databaseType ?? "postgresql",
47157
+ clientName: client?.publicKey || "",
47158
+ setQuery,
47159
+ handleRunQuery: () => {
47160
+ handleRunQuery(currentProcessing, true);
47161
+ },
47162
+ handleFixWithAI,
47163
+ isNewQueryEnabled,
47164
+ runQueryOnMount,
47165
+ handleClearQuery,
47166
+ theme,
47167
+ defineEditorTheme,
47168
+ setEditorTheme,
47169
+ setEditorMounted: () => {
47170
+ },
47171
+ ButtonComponent,
47172
+ SecondaryButtonComponent,
47173
+ loading: sqlResponseLoading && schemaData.isSchemaLoading && dashboardIsLoading,
47174
+ LoadingComponent
47175
+ }
47176
+ )
47177
+ }
47178
+ ),
47179
+ /* @__PURE__ */ jsx66(
47180
+ "div",
47181
+ {
47182
+ style: {
47183
+ display: "flex",
47184
+ flexDirection: "row",
47185
+ width: "100%",
47186
+ justifyContent: addToDashboardButtonLabel === "Add to dashboard" ? "flex-end" : "flex-start"
47187
+ },
47188
+ children: /* @__PURE__ */ jsx66(
47189
+ "div",
47190
+ {
47191
+ style: {
47192
+ display: "flex",
47193
+ flexDirection: "row",
47194
+ alignItems: "center",
47195
+ height: 70
47196
+ },
47197
+ children: /* @__PURE__ */ jsxs48(
47224
47198
  "div",
47225
47199
  {
47226
47200
  style: {
47227
- fontFamily: theme?.fontFamily,
47228
- color: theme?.primaryTextColor,
47229
- fontSize: 15,
47230
- fontWeight: "400",
47231
- width: "100%"
47201
+ display: "flex",
47202
+ gap: 12
47232
47203
  },
47233
- children: /* @__PURE__ */ jsxs48(
47234
- "div",
47235
- {
47236
- style: {
47237
- display: "flex",
47238
- flexDirection: "row",
47239
- justifyContent: "space-between",
47240
- gap: 12,
47241
- background: "rgba(0,0,0,0.02)",
47242
- // TODO: change color
47243
- color: theme?.primaryTextColor,
47244
- fontFamily: theme?.fontFamily,
47245
- borderRadius: 6,
47246
- padding: 20,
47247
- marginBottom: 15,
47248
- width: "100%",
47249
- alignItems: "center"
47250
- },
47251
- children: [
47252
- errorMessage,
47253
- errorMessage !== "No data found" && errorMessage !== "No query found" && /* @__PURE__ */ jsx66(
47254
- SecondaryButtonComponent,
47204
+ children: [
47205
+ computedButtonLabel === "Add to dashboard" ? /* @__PURE__ */ jsx66(
47206
+ SecondaryButtonComponent,
47207
+ {
47208
+ onClick: () => {
47209
+ handleRunQuery(
47210
+ {
47211
+ page: pagination,
47212
+ sort: void 0
47213
+ },
47214
+ true,
47215
+ false,
47216
+ true
47217
+ );
47218
+ },
47219
+ label: "Run query"
47220
+ }
47221
+ ) : /* @__PURE__ */ jsx66(
47222
+ SecondaryButtonComponent,
47223
+ {
47224
+ onClick: () => {
47225
+ handleRunQuery(
47226
+ {
47227
+ page: pagination,
47228
+ sort: void 0
47229
+ },
47230
+ true,
47231
+ false,
47232
+ true
47233
+ );
47234
+ },
47235
+ label: "Run query"
47236
+ }
47237
+ ),
47238
+ isChartBuilderEnabled && /* @__PURE__ */ jsx66(
47239
+ "div",
47240
+ {
47241
+ style: {
47242
+ display: "flex",
47243
+ flexDirection: "row",
47244
+ alignItems: "center",
47245
+ justifyContent: "flex-end",
47246
+ width: "100%"
47247
+ },
47248
+ children: computedButtonLabel !== "Add to dashboard" ? /* @__PURE__ */ jsx66(
47249
+ ButtonComponent,
47255
47250
  {
47256
- onClick: handleFixWithAI,
47257
- label: "Fix with AI"
47251
+ onClick: async () => {
47252
+ onSaveChanges && onSaveChanges();
47253
+ setIsChartBuilderOpen(true);
47254
+ },
47255
+ label: computedButtonLabel,
47256
+ disabled: !!errorMessage || !(lastSuccessfulQuery === query)
47257
+ }
47258
+ ) : /* @__PURE__ */ jsx66(
47259
+ ButtonComponent,
47260
+ {
47261
+ onClick: async () => {
47262
+ onSaveChanges && onSaveChanges();
47263
+ const isSelectStar = isSimpleSelectStarQuery(query ?? "");
47264
+ let tables = [];
47265
+ let customFieldColumns = [];
47266
+ if (client && isSelectStar && schemaData.customFields) {
47267
+ const { referencedTablesAndColumns } = await getReferencedTables(
47268
+ client,
47269
+ query ?? "",
47270
+ filteredSchema,
47271
+ isSelectStar
47272
+ );
47273
+ tables = referencedTablesAndColumns.map(
47274
+ (ref) => ref.name
47275
+ );
47276
+ customFieldColumns = tables.map((table) => {
47277
+ return (schemaData.customFields?.[table] ?? []).map((field) => field.field);
47278
+ }).flat();
47279
+ }
47280
+ const newTempReport = {
47281
+ ...tempReport,
47282
+ id: reportId || report?.id || TEMP_REPORT_ID,
47283
+ rows,
47284
+ columns: isSelectStar ? (
47285
+ // so Automatic Custom Fields can be applied
47286
+ columns.filter(
47287
+ (col) => {
47288
+ return !customFieldColumns.includes(
47289
+ col.field
47290
+ );
47291
+ }
47292
+ )
47293
+ ) : columns,
47294
+ includeCustomFields: isSelectStar,
47295
+ columnInternal: columns,
47296
+ rowCount: rowCount ?? 0,
47297
+ queryString: query ?? "",
47298
+ dashboardName: report?.dashboardName ?? destinationDashboard
47299
+ };
47300
+ setTempReport(newTempReport);
47301
+ setIsChartBuilderOpen(true);
47302
+ },
47303
+ label: computedButtonLabel,
47304
+ disabled: !!errorMessage || !(lastSuccessfulQuery === query) || !query,
47305
+ tooltipText: !!errorMessage || !(lastSuccessfulQuery === query) ? "Please run a query" : ""
47258
47306
  }
47259
47307
  )
47260
- ]
47261
- }
47262
- )
47263
- }
47264
- ),
47265
- errorMessage || !displayTable ? null : /* @__PURE__ */ jsx66("div", { ref: tableRef, children: /* @__PURE__ */ jsx66(
47266
- TableComponent,
47267
- {
47268
- isLoading: sqlQueryLoading,
47269
- rows: formattedRows,
47270
- columns,
47271
- rowCount,
47272
- rowsPerPage,
47273
- rowCountIsLoading,
47274
- onPageChange,
47275
- onSortChange,
47276
- containerStyle: {
47277
- height: "calc(100vh - max(210px, 20vh) - 310px)",
47278
- minHeight: `calc(${DEFAULT_ROWS_PER_PAGE} * ${ROW_HEIGHT}px + ${TABLE_TAB_HEIGHT}px)`,
47279
- // at least 10 rows tall
47280
- maxHeight: "calc(100vh - max(210px, 20vh) - 310px)"
47281
- },
47282
- currentPage,
47283
- setCurrentPage
47308
+ }
47309
+ ),
47310
+ isAdminEnabled && !report && /* @__PURE__ */ jsx66(
47311
+ SecondaryButtonComponent,
47312
+ {
47313
+ disabled: !!errorMessage || !(lastSuccessfulQuery === query) || !query,
47314
+ onClick: async () => {
47315
+ const isSelectStar = isSimpleSelectStarQuery(
47316
+ query ?? ""
47317
+ );
47318
+ let tables = [];
47319
+ let customFieldColumns = [];
47320
+ if (client && isSelectStar && schemaData.customFields) {
47321
+ const { referencedTablesAndColumns } = await getReferencedTables(
47322
+ client,
47323
+ query ?? "",
47324
+ schemaData.schemaWithCustomFields,
47325
+ isSelectStar
47326
+ );
47327
+ tables = referencedTablesAndColumns.map(
47328
+ (ref) => ref.name
47329
+ );
47330
+ customFieldColumns = tables.map((table) => {
47331
+ return (schemaData.customFields?.[table] ?? []).map((field) => field.field);
47332
+ }).flat();
47333
+ }
47334
+ setTempReport({
47335
+ ...tempReport,
47336
+ id: TEMP_REPORT_ID,
47337
+ rows,
47338
+ columns: isSelectStar ? (
47339
+ // so Automatic Custom Fields can be applied
47340
+ columns.filter(
47341
+ (col) => {
47342
+ return !customFieldColumns.includes(
47343
+ col.field
47344
+ );
47345
+ }
47346
+ )
47347
+ ) : columns,
47348
+ includeCustomFields: isSelectStar,
47349
+ columnInternal: columns,
47350
+ rowCount: rowCount ?? 0,
47351
+ queryString: query ?? "",
47352
+ chartType: "table",
47353
+ dashboardName: destinationDashboard
47354
+ });
47355
+ setIsSaveQueryModalOpen(true);
47356
+ },
47357
+ label: "Save query"
47358
+ }
47359
+ ),
47360
+ isNewQueryEnabled && /* @__PURE__ */ jsx66(
47361
+ SecondaryButtonComponent,
47362
+ {
47363
+ onClick: handleClearQuery,
47364
+ label: "Clear query"
47365
+ }
47366
+ )
47367
+ ]
47284
47368
  }
47285
- ) })
47286
- ]
47287
- }
47288
- )
47289
- ] })
47290
- }
47291
- ),
47292
- isChartBuilderEnabled && /* @__PURE__ */ jsxs48(
47293
- "div",
47294
- {
47295
- style: {
47296
- display: "flex",
47297
- flexDirection: "row",
47298
- alignItems: "center",
47299
- justifyContent: "flex-end",
47300
- width: "100%",
47301
- gap: 12,
47302
- marginTop: 15,
47303
- marginBottom: 5
47304
- },
47305
- children: [
47306
- onDiscardChanges && /* @__PURE__ */ jsx66(
47307
- SecondaryButtonComponent,
47308
- {
47309
- onClick: onDiscardChanges,
47310
- label: "Discard changes"
47311
- }
47312
- ),
47313
- computedButtonLabel !== "Add to dashboard" && /* @__PURE__ */ jsx66(
47314
- ButtonComponent,
47315
- {
47316
- onClick: async () => {
47317
- onSaveChanges && onSaveChanges();
47318
- setIsChartBuilderOpen(true);
47319
- },
47320
- label: computedButtonLabel,
47321
- disabled: !!errorMessage || !(lastSuccessfulQuery === query)
47322
- }
47323
- )
47324
- ]
47325
- }
47326
- )
47327
- ]
47369
+ )
47370
+ }
47371
+ )
47372
+ }
47373
+ ),
47374
+ /* @__PURE__ */ jsxs48(
47375
+ "div",
47376
+ {
47377
+ style: {
47378
+ display: "flex",
47379
+ flexDirection: "column",
47380
+ // height: '100%',
47381
+ padding: 0,
47382
+ margin: 0,
47383
+ border: "none",
47384
+ outline: "none"
47385
+ },
47386
+ children: [
47387
+ errorMessage && /* @__PURE__ */ jsx66(
47388
+ "div",
47389
+ {
47390
+ style: {
47391
+ fontFamily: theme?.fontFamily,
47392
+ color: theme?.primaryTextColor,
47393
+ fontSize: 15,
47394
+ fontWeight: "400",
47395
+ width: "100%"
47396
+ },
47397
+ children: /* @__PURE__ */ jsxs48(
47398
+ "div",
47399
+ {
47400
+ style: {
47401
+ display: "flex",
47402
+ flexDirection: "row",
47403
+ justifyContent: "space-between",
47404
+ gap: 12,
47405
+ background: "rgba(0,0,0,0.02)",
47406
+ // TODO: change color
47407
+ color: theme?.primaryTextColor,
47408
+ fontFamily: theme?.fontFamily,
47409
+ borderRadius: 6,
47410
+ padding: 20,
47411
+ marginBottom: 15,
47412
+ width: "100%",
47413
+ alignItems: "center"
47414
+ },
47415
+ children: [
47416
+ errorMessage,
47417
+ errorMessage !== "No data found" && errorMessage !== "No query found" && /* @__PURE__ */ jsx66(
47418
+ SecondaryButtonComponent,
47419
+ {
47420
+ onClick: handleFixWithAI,
47421
+ label: "Fix with AI"
47422
+ }
47423
+ )
47424
+ ]
47425
+ }
47426
+ )
47427
+ }
47428
+ ),
47429
+ errorMessage || !displayTable ? null : /* @__PURE__ */ jsx66("div", { ref: tableRef, children: /* @__PURE__ */ jsx66(
47430
+ TableComponent,
47431
+ {
47432
+ isLoading: sqlQueryLoading,
47433
+ rows: formattedRows,
47434
+ columns,
47435
+ rowCount,
47436
+ rowsPerPage,
47437
+ rowCountIsLoading,
47438
+ onPageChange,
47439
+ onSortChange,
47440
+ containerStyle: {
47441
+ height: "calc(100vh - max(210px, 20vh) - 310px)",
47442
+ minHeight: `calc(${DEFAULT_ROWS_PER_PAGE} * ${ROW_HEIGHT}px + ${TABLE_TAB_HEIGHT}px)`,
47443
+ // at least 10 rows tall
47444
+ maxHeight: "calc(100vh - max(210px, 20vh) - 310px)"
47445
+ },
47446
+ currentPage,
47447
+ setCurrentPage
47448
+ }
47449
+ ) })
47450
+ ]
47451
+ }
47452
+ )
47453
+ ] })
47454
+ }
47455
+ )
47328
47456
  }
47329
47457
  )
47330
47458
  ]
@@ -47468,10 +47596,10 @@ var SQLEditorComponent = ({
47468
47596
  loading,
47469
47597
  LoadingComponent = QuillLoadingComponent
47470
47598
  }) => {
47471
- const [editorKey, setEditorKey] = useState30(0);
47599
+ const [editorKey, setEditorKey] = useState31(0);
47472
47600
  const { eventTracking } = useContext28(EventTrackingContext);
47473
- const currentProvider = useRef18(null);
47474
- useEffect24(() => {
47601
+ const currentProvider = useRef19(null);
47602
+ useEffect25(() => {
47475
47603
  if (currentProvider.current) {
47476
47604
  currentProvider.current.dispose();
47477
47605
  if (schema && schema.length !== 0) {
@@ -47712,7 +47840,7 @@ function SchemaItem({
47712
47840
  index,
47713
47841
  onClick
47714
47842
  }) {
47715
- const [isOpen, setIsOpen] = useState30(index === 0);
47843
+ const [isOpen, setIsOpen] = useState31(index === 0);
47716
47844
  const schemaContainerStyle = {
47717
47845
  display: "flex",
47718
47846
  flexDirection: "column"
@@ -47941,14 +48069,14 @@ function SchemaItem({
47941
48069
  // src/ReportBuilder.tsx
47942
48070
  import {
47943
48071
  useContext as useContext32,
47944
- useEffect as useEffect28,
47945
- useRef as useRef20,
47946
- useState as useState36
48072
+ useEffect as useEffect29,
48073
+ useRef as useRef21,
48074
+ useState as useState37
47947
48075
  } from "react";
47948
48076
  init_constants();
47949
48077
 
47950
48078
  // src/hooks/useReportBuilder.tsx
47951
- import { useContext as useContext29, useEffect as useEffect25, useMemo as useMemo23, useState as useState31 } from "react";
48079
+ import { useContext as useContext29, useEffect as useEffect26, useMemo as useMemo23, useState as useState32 } from "react";
47952
48080
  init_tableProcessing();
47953
48081
  init_ReportBuilder();
47954
48082
  init_constants();
@@ -47999,18 +48127,18 @@ var useReportBuilderInternal = ({
47999
48127
  rowsPerPage: _rowsPerPage,
48000
48128
  rowsPerRequest: _rowsPerRequest
48001
48129
  };
48002
- const [openPopover, setOpenPopover] = useState31(null);
48003
- const [aiPrompt, setAiPrompt] = useState31("");
48004
- const [reportBuilderLoading, setReportBuilderLoading] = useState31(false);
48005
- const [tableLoading, setTableLoading] = useState31(false);
48006
- const [errorMessage, setErrorMessage] = useState31("");
48007
- const [unresolvedReportMessage, setUnresolvedReportMessage] = useState31("");
48008
- const [tables, setTables] = useState31([]);
48009
- const [columns, setColumns] = useState31([]);
48010
- const [filterStack, setFilterStack] = useState31([]);
48011
- const [pivot, setPivot] = useState31(null);
48012
- const [sort, setSort] = useState31([]);
48013
- const [limit, setLimit] = useState31(null);
48130
+ const [openPopover, setOpenPopover] = useState32(null);
48131
+ const [aiPrompt, setAiPrompt] = useState32("");
48132
+ const [reportBuilderLoading, setReportBuilderLoading] = useState32(false);
48133
+ const [tableLoading, setTableLoading] = useState32(false);
48134
+ const [errorMessage, setErrorMessage] = useState32("");
48135
+ const [unresolvedReportMessage, setUnresolvedReportMessage] = useState32("");
48136
+ const [tables, setTables] = useState32([]);
48137
+ const [columns, setColumns] = useState32([]);
48138
+ const [filterStack, setFilterStack] = useState32([]);
48139
+ const [pivot, setPivot] = useState32(null);
48140
+ const [sort, setSort] = useState32([]);
48141
+ const [limit, setLimit] = useState32(null);
48014
48142
  const reportBuilderState = useMemo23(() => {
48015
48143
  return {
48016
48144
  tables,
@@ -48021,28 +48149,28 @@ var useReportBuilderInternal = ({
48021
48149
  limit
48022
48150
  };
48023
48151
  }, [columns, filterStack, limit, pivot, sort, tables]);
48024
- const [stateStack, setStateStack] = useState31([]);
48025
- const [poppedStateStack, setPoppedStateStack] = useState31([]);
48026
- const [unfilteredUniqueValues, setUnfilteredUniqueValues] = useState31({});
48027
- const [unfilteredUniqueValuesIsLoading, setUnfilteredUniqueValuesIsLoading] = useState31(false);
48028
- const [filteredUniqueValues, setFilteredUniqueValues] = useState31(null);
48029
- const [filteredUniqueValuesIsLoading, setFilteredUniqueValuesIsLoading] = useState31(false);
48030
- const [columnUniqueValues, setColumnUniqueValues] = useState31({});
48031
- const [dateRanges, setDateRanges] = useState31(null);
48032
- const [tempReport, setTempReport] = useState31({
48152
+ const [stateStack, setStateStack] = useState32([]);
48153
+ const [poppedStateStack, setPoppedStateStack] = useState32([]);
48154
+ const [unfilteredUniqueValues, setUnfilteredUniqueValues] = useState32({});
48155
+ const [unfilteredUniqueValuesIsLoading, setUnfilteredUniqueValuesIsLoading] = useState32(false);
48156
+ const [filteredUniqueValues, setFilteredUniqueValues] = useState32(null);
48157
+ const [filteredUniqueValuesIsLoading, setFilteredUniqueValuesIsLoading] = useState32(false);
48158
+ const [columnUniqueValues, setColumnUniqueValues] = useState32({});
48159
+ const [dateRanges, setDateRanges] = useState32(null);
48160
+ const [tempReport, setTempReport] = useState32({
48033
48161
  ...EMPTY_INTERNAL_REPORT,
48034
48162
  pagination: REPORT_BUILDER_PAGINATION
48035
48163
  });
48036
- const [currentProcessing, setCurrentProcessing] = useState31({
48164
+ const [currentProcessing, setCurrentProcessing] = useState32({
48037
48165
  page: REPORT_BUILDER_PAGINATION
48038
48166
  });
48039
- const [previousPage, setPreviousPage] = useState31(0);
48040
- const [reportColumns, setReportColumns] = useState31([]);
48041
- const [reportRows, setReportRows] = useState31([]);
48042
- const [formattedRows, setFormattedRows] = useState31([]);
48043
- const [pivotData, setPivotData] = useState31(null);
48044
- const [numberOfRows, setNumberOfRows] = useState31(0);
48045
- const [rowCountIsLoading, setRowCountIsLoading] = useState31(false);
48167
+ const [previousPage, setPreviousPage] = useState32(0);
48168
+ const [reportColumns, setReportColumns] = useState32([]);
48169
+ const [reportRows, setReportRows] = useState32([]);
48170
+ const [formattedRows, setFormattedRows] = useState32([]);
48171
+ const [pivotData, setPivotData] = useState32(null);
48172
+ const [numberOfRows, setNumberOfRows] = useState32(0);
48173
+ const [rowCountIsLoading, setRowCountIsLoading] = useState32(false);
48046
48174
  const reportColumnsToStateColumns = useMemo23(() => {
48047
48175
  const positionMap = {};
48048
48176
  columns.forEach((column, index) => {
@@ -48061,28 +48189,28 @@ var useReportBuilderInternal = ({
48061
48189
  }
48062
48190
  });
48063
48191
  }, [columns, reportColumns]);
48064
- const [pivotRowField, setPivotRowField] = useState31(
48192
+ const [pivotRowField, setPivotRowField] = useState32(
48065
48193
  void 0
48066
48194
  );
48067
- const [pivotColumnField, setPivotColumnField] = useState31(
48195
+ const [pivotColumnField, setPivotColumnField] = useState32(
48068
48196
  void 0
48069
48197
  );
48070
- const [pivotAggregations, setPivotAggregations] = useState31([]);
48071
- const [pivotLimit, setPivotLimit] = useState31(void 0);
48072
- const [pivotSort, setPivotSort] = useState31(void 0);
48073
- const [pivotHint, setPivotHint] = useState31("");
48074
- const [pivotError, setPivotError] = useState31("");
48075
- const [createdPivots, setCreatedPivots] = useState31([]);
48076
- const [recommendedPivots, setRecommendedPivots] = useState31([]);
48077
- const [pivotPopUpTitle, setPivotPopUpTitle] = useState31("Add pivot");
48078
- const [showPivotPopover, setShowPivotPopover] = useState31(false);
48079
- const [isEditingPivot, setIsEditingPivot] = useState31(false);
48080
- const [selectedPivotIndex, setSelectedPivotIndex] = useState31(-1);
48198
+ const [pivotAggregations, setPivotAggregations] = useState32([]);
48199
+ const [pivotLimit, setPivotLimit] = useState32(void 0);
48200
+ const [pivotSort, setPivotSort] = useState32(void 0);
48201
+ const [pivotHint, setPivotHint] = useState32("");
48202
+ const [pivotError, setPivotError] = useState32("");
48203
+ const [createdPivots, setCreatedPivots] = useState32([]);
48204
+ const [recommendedPivots, setRecommendedPivots] = useState32([]);
48205
+ const [pivotPopUpTitle, setPivotPopUpTitle] = useState32("Add pivot");
48206
+ const [showPivotPopover, setShowPivotPopover] = useState32(false);
48207
+ const [isEditingPivot, setIsEditingPivot] = useState32(false);
48208
+ const [selectedPivotIndex, setSelectedPivotIndex] = useState32(-1);
48081
48209
  const [
48082
48210
  pivotRecommendationsEnabledState,
48083
48211
  setPivotRecommendationsEnabledState
48084
- ] = useState31(pivotRecommendationsEnabled);
48085
- const [askAILoading, setAskAILoading] = useState31(false);
48212
+ ] = useState32(pivotRecommendationsEnabled);
48213
+ const [askAILoading, setAskAILoading] = useState32(false);
48086
48214
  const loading = reportBuilderLoading || tableLoading;
48087
48215
  useLongLoading(reportBuilderLoading, {
48088
48216
  origin: "ReportBuilder",
@@ -49166,7 +49294,7 @@ var useReportBuilderInternal = ({
49166
49294
  flags: tempReport?.flags
49167
49295
  });
49168
49296
  };
49169
- useEffect25(() => {
49297
+ useEffect26(() => {
49170
49298
  if (!client) {
49171
49299
  return;
49172
49300
  }
@@ -49179,7 +49307,7 @@ var useReportBuilderInternal = ({
49179
49307
  clearAllState();
49180
49308
  }
49181
49309
  }, [client]);
49182
- useEffect25(() => {
49310
+ useEffect26(() => {
49183
49311
  const loadChart = async () => {
49184
49312
  let report;
49185
49313
  if (!client) {
@@ -49236,7 +49364,7 @@ var useReportBuilderInternal = ({
49236
49364
  loadChart();
49237
49365
  }
49238
49366
  }, [allReportsById[reportId || ""], client]);
49239
- useEffect25(() => {
49367
+ useEffect26(() => {
49240
49368
  if (initialTableName) {
49241
49369
  const tableColumns = filteredSchema.find((table) => {
49242
49370
  return table.name === initialTableName;
@@ -49256,7 +49384,7 @@ var useReportBuilderInternal = ({
49256
49384
  }
49257
49385
  }
49258
49386
  }, [filteredSchema, initialTableName]);
49259
- useEffect25(() => {
49387
+ useEffect26(() => {
49260
49388
  if (!data && !dashboardIsLoading) {
49261
49389
  reload();
49262
49390
  }
@@ -49464,7 +49592,7 @@ var useReportBuilder = ({
49464
49592
  init_ReportBuilder();
49465
49593
 
49466
49594
  // src/components/ReportBuilder/AddColumnModal.tsx
49467
- import { useState as useState32, useRef as useRef19, useMemo as useMemo24, useEffect as useEffect26, useContext as useContext30 } from "react";
49595
+ import { useState as useState33, useRef as useRef20, useMemo as useMemo24, useEffect as useEffect27, useContext as useContext30 } from "react";
49468
49596
  import {
49469
49597
  DndContext as DndContext2,
49470
49598
  closestCenter as closestCenter2,
@@ -49499,14 +49627,14 @@ function AddColumnModal({
49499
49627
  LoadingComponent = QuillLoadingComponent,
49500
49628
  onRequestAddVirtualTable
49501
49629
  }) {
49502
- const [primaryTable, setPrimaryTable] = useState32(
49630
+ const [primaryTable, setPrimaryTable] = useState33(
49503
49631
  selectedTables[0]?.name
49504
49632
  );
49505
49633
  const [theme] = useContext30(ThemeContext);
49506
- const [search, setSearch] = useState32("");
49507
- const [initialLoad, setInitialLoad] = useState32(true);
49508
- const textInputContainerRef = useRef19(null);
49509
- const [modalSelectedColumns, setModalSelectedColumns] = useState32(
49634
+ const [search, setSearch] = useState33("");
49635
+ const [initialLoad, setInitialLoad] = useState33(true);
49636
+ const textInputContainerRef = useRef20(null);
49637
+ const [modalSelectedColumns, setModalSelectedColumns] = useState33(
49510
49638
  selectedColumns.map((col) => `${col.table}.${col.field}`)
49511
49639
  );
49512
49640
  const columnOptions = useMemo24(() => {
@@ -49533,20 +49661,20 @@ function AddColumnModal({
49533
49661
  })
49534
49662
  );
49535
49663
  }, [schema, primaryTable]);
49536
- const [orderedColumnNames, setOrderedColumnNames] = useState32([]);
49664
+ const [orderedColumnNames, setOrderedColumnNames] = useState33([]);
49537
49665
  const isSelectedAllColumns = columnOptions.length === modalSelectedColumns.length;
49538
49666
  const searchResults = useMemo24(() => {
49539
49667
  return orderedColumnNames.filter((column) => {
49540
49668
  return columnOptions.includes(column) && (search.length === 0 || column.toLowerCase().includes(search.toLowerCase()) || snakeAndCamelCaseToTitleCase(column).toLowerCase().includes(search.toLowerCase()));
49541
49669
  });
49542
49670
  }, [search, columnOptions, orderedColumnNames]);
49543
- useEffect26(() => {
49671
+ useEffect27(() => {
49544
49672
  const remainingColumns = columnOptions.filter(
49545
49673
  (col) => !modalSelectedColumns.includes(col)
49546
49674
  );
49547
49675
  setOrderedColumnNames([...modalSelectedColumns, ...remainingColumns]);
49548
49676
  }, [columnOptions]);
49549
- useEffect26(() => {
49677
+ useEffect27(() => {
49550
49678
  if (!schemaLoading && initialLoad) {
49551
49679
  setTimeout(() => setInitialLoad(false), 200);
49552
49680
  }
@@ -50429,7 +50557,7 @@ var AddFilters = ({
50429
50557
  };
50430
50558
 
50431
50559
  // src/internals/ReportBuilder/PivotForm.tsx
50432
- import { useContext as useContext31, useEffect as useEffect27, useState as useState33 } from "react";
50560
+ import { useContext as useContext31, useEffect as useEffect28, useState as useState34 } from "react";
50433
50561
  init_textProcessing();
50434
50562
  init_pivotProcessing();
50435
50563
  import { jsx as jsx73, jsxs as jsxs53 } from "react/jsx-runtime";
@@ -50458,22 +50586,22 @@ function PivotForm({
50458
50586
  isLoading,
50459
50587
  pivotHint
50460
50588
  }) {
50461
- const [allowedColumnFields, setAllowedColumnFields] = useState33([]);
50462
- const [allowedRowFields, setAllowedRowFields] = useState33([]);
50463
- const [allowedValueFields, setAllowedValueFields] = useState33([]);
50589
+ const [allowedColumnFields, setAllowedColumnFields] = useState34([]);
50590
+ const [allowedRowFields, setAllowedRowFields] = useState34([]);
50591
+ const [allowedValueFields, setAllowedValueFields] = useState34([]);
50464
50592
  const [theme] = useContext31(ThemeContext);
50465
- const [limitInput, setLimitInput] = useState33(
50593
+ const [limitInput, setLimitInput] = useState34(
50466
50594
  pivotLimit?.toString() ?? ""
50467
50595
  );
50468
- const [sortFieldInput, setSortFieldInput] = useState33(
50596
+ const [sortFieldInput, setSortFieldInput] = useState34(
50469
50597
  pivotSort?.sortField ?? ""
50470
50598
  );
50471
- const [sortDirectionInput, setSortDirectionInput] = useState33(
50599
+ const [sortDirectionInput, setSortDirectionInput] = useState34(
50472
50600
  pivotSort?.sortDirection ?? ""
50473
50601
  );
50474
- const [showLimitInput, setShowLimitInput] = useState33(!!pivotLimit);
50475
- const [showSortInput, setShowSortInput] = useState33(!!pivotSort);
50476
- useEffect27(() => {
50602
+ const [showLimitInput, setShowLimitInput] = useState34(!!pivotLimit);
50603
+ const [showSortInput, setShowSortInput] = useState34(!!pivotSort);
50604
+ useEffect28(() => {
50477
50605
  if (uniqueValues) {
50478
50606
  const possibleColumns = getPossiblePivotFieldOptions(
50479
50607
  columns,
@@ -50484,12 +50612,12 @@ function PivotForm({
50484
50612
  setAllowedValueFields(possibleColumns.valueFields);
50485
50613
  }
50486
50614
  }, [columns, uniqueValues]);
50487
- useEffect27(() => {
50615
+ useEffect28(() => {
50488
50616
  setSortFieldInput(pivotSort?.sortField ?? "");
50489
50617
  setSortDirectionInput(pivotSort?.sortDirection ?? "");
50490
50618
  setShowSortInput(!!pivotSort);
50491
50619
  }, [pivotSort]);
50492
- useEffect27(() => {
50620
+ useEffect28(() => {
50493
50621
  setLimitInput(pivotLimit?.toString() ?? "");
50494
50622
  setShowLimitInput(!!pivotLimit);
50495
50623
  }, [pivotLimit]);
@@ -51101,7 +51229,7 @@ var AddPivot = ({
51101
51229
  };
51102
51230
 
51103
51231
  // src/components/ReportBuilder/AddLimitPopover.tsx
51104
- import { useState as useState34 } from "react";
51232
+ import { useState as useState35 } from "react";
51105
51233
  import { Fragment as Fragment14, jsx as jsx75, jsxs as jsxs55 } from "react/jsx-runtime";
51106
51234
  var LimitSentence = ({
51107
51235
  limit,
@@ -51116,7 +51244,7 @@ var LimitSentence = ({
51116
51244
  SecondaryButton = MemoizedSecondaryButton,
51117
51245
  disabled = false
51118
51246
  }) => {
51119
- const [isOpen, setIsOpen] = useState34(false);
51247
+ const [isOpen, setIsOpen] = useState35(false);
51120
51248
  const handleClickDelete = () => {
51121
51249
  setOpenPopover(null);
51122
51250
  handleDelete();
@@ -51158,7 +51286,7 @@ var AddLimitPopover = ({
51158
51286
  Button = MemoizedButton,
51159
51287
  SecondaryButton = MemoizedSecondaryButton
51160
51288
  }) => {
51161
- const [limit, setLimit] = useState34(initialLimit.toString());
51289
+ const [limit, setLimit] = useState35(initialLimit.toString());
51162
51290
  const MAX_LIMIT = 2147483647;
51163
51291
  return /* @__PURE__ */ jsxs55("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
51164
51292
  /* @__PURE__ */ jsx75(
@@ -51399,7 +51527,7 @@ var AddLimit = ({
51399
51527
  };
51400
51528
 
51401
51529
  // src/components/ReportBuilder/AddSortPopover.tsx
51402
- import { useState as useState35 } from "react";
51530
+ import { useState as useState36 } from "react";
51403
51531
  init_textProcessing();
51404
51532
  import { Fragment as Fragment15, jsx as jsx77, jsxs as jsxs57 } from "react/jsx-runtime";
51405
51533
  var SORT_VALUE_TO_LABEL = {
@@ -51423,7 +51551,7 @@ var SortSentence = ({
51423
51551
  SecondaryButton = MemoizedSecondaryButton,
51424
51552
  disabled = false
51425
51553
  }) => {
51426
- const [isOpen, setIsOpen] = useState35(false);
51554
+ const [isOpen, setIsOpen] = useState36(false);
51427
51555
  const handleSetIsOpen = (isOpen2) => {
51428
51556
  setIsOpen(isOpen2);
51429
51557
  };
@@ -51475,8 +51603,8 @@ var AddSortPopover = ({
51475
51603
  Button = MemoizedButton,
51476
51604
  SecondaryButton = MemoizedSecondaryButton
51477
51605
  }) => {
51478
- const [sortColumn, setSortColumn] = useState35(column || "");
51479
- const [sortDirection, setSortDirection] = useState35(
51606
+ const [sortColumn, setSortColumn] = useState36(column || "");
51607
+ const [sortDirection, setSortDirection] = useState36(
51480
51608
  direction || "ASC"
51481
51609
  );
51482
51610
  return /* @__PURE__ */ jsxs57("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
@@ -51957,12 +52085,11 @@ function ReportBuilder({
51957
52085
  const [theme] = useContext32(ThemeContext);
51958
52086
  const [client] = useContext32(ClientContext);
51959
52087
  const { getToken } = useContext32(FetchContext);
51960
- const parentRef = useRef20(null);
51961
- const askAIContainerRef = useRef20(null);
51962
- const [askAIInputWidth, setAskAIInputWidth] = useState36(-1);
51963
- const [isCopying, setIsCopying] = useState36(false);
51964
- const [isChartBuilderOpen, setIsChartBuilderOpen] = useState36(false);
51965
- const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = useState36(false);
52088
+ const parentRef = useRef21(null);
52089
+ const askAIFormRef = useRef21(null);
52090
+ const [isCopying, setIsCopying] = useState37(false);
52091
+ const [isChartBuilderOpen, setIsChartBuilderOpen] = useState37(false);
52092
+ const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = useState37(false);
51966
52093
  const reportBuilder = useReportBuilderInternal({
51967
52094
  reportId,
51968
52095
  initialTableName,
@@ -52002,6 +52129,12 @@ function ReportBuilder({
52002
52129
  onSaveQuery,
52003
52130
  onSaveReport
52004
52131
  } = reportBuilder;
52132
+ const askAIInputWidth = useResponsiveFirstChildWidth_default(askAIFormRef, {
52133
+ gap: 12,
52134
+ initialWidth: 320,
52135
+ minWidth: 160
52136
+ });
52137
+ const normalizedAskAIInputWidth = askAIInputWidth > 0 ? askAIInputWidth : 160;
52005
52138
  const copySQLToClipboard = async () => {
52006
52139
  let query = "";
52007
52140
  if (pivot && pivotData) {
@@ -52024,17 +52157,7 @@ function ReportBuilder({
52024
52157
  setTimeout(() => setIsCopying(false), 800);
52025
52158
  }
52026
52159
  };
52027
- useEffect28(() => {
52028
- function handleResize() {
52029
- updateFirstChildWidth(askAIContainerRef, setAskAIInputWidth, { gap: 12 });
52030
- }
52031
- handleResize();
52032
- window.addEventListener("resize", handleResize);
52033
- return () => {
52034
- window.removeEventListener("resize", handleResize);
52035
- };
52036
- }, []);
52037
- useEffect28(() => {
52160
+ useEffect29(() => {
52038
52161
  if (isChartBuilderOpen === false) {
52039
52162
  onCloseChartBuilder && onCloseChartBuilder();
52040
52163
  }
@@ -52152,10 +52275,10 @@ function ReportBuilder({
52152
52275
  /* @__PURE__ */ jsx81("div", { style: { width: "100%", minHeight: "30vh" } })
52153
52276
  ] }),
52154
52277
  /* @__PURE__ */ jsxs60(ContainerComponent, { children: [
52155
- isAIEnabled && /* @__PURE__ */ jsx81(
52278
+ isAIEnabled && /* @__PURE__ */ jsxs60(
52156
52279
  "form",
52157
52280
  {
52158
- ref: askAIContainerRef,
52281
+ ref: askAIFormRef,
52159
52282
  onSubmit: (event) => {
52160
52283
  event.preventDefault();
52161
52284
  },
@@ -52163,15 +52286,17 @@ function ReportBuilder({
52163
52286
  display: "flex",
52164
52287
  flexDirection: "row",
52165
52288
  gap: 12,
52166
- visibility: askAIInputWidth === -1 ? "hidden" : "visible"
52289
+ flexWrap: "wrap",
52290
+ alignItems: "stretch",
52291
+ visibility: normalizedAskAIInputWidth > 0 ? "visible" : "hidden"
52167
52292
  },
52168
- children: /* @__PURE__ */ jsxs60(Fragment16, { children: [
52293
+ children: [
52169
52294
  /* @__PURE__ */ jsx81(
52170
52295
  TextInputComponent,
52171
52296
  {
52172
52297
  id: "ask_ai_input_bar",
52173
52298
  value: aiPrompt,
52174
- width: askAIInputWidth,
52299
+ width: normalizedAskAIInputWidth,
52175
52300
  onChange: (e) => setAiPrompt(e.target.value),
52176
52301
  placeholder: "Ask a question..."
52177
52302
  }
@@ -52209,7 +52334,7 @@ function ReportBuilder({
52209
52334
  disabled: columns.length === 0 || loading
52210
52335
  }
52211
52336
  )
52212
- ] })
52337
+ ]
52213
52338
  }
52214
52339
  ),
52215
52340
  columns.length > 0 && /* @__PURE__ */ jsx81(
@@ -52466,10 +52591,10 @@ function ReportBuilder({
52466
52591
  // src/ChartEditor.tsx
52467
52592
  import {
52468
52593
  useContext as useContext33,
52469
- useEffect as useEffect29,
52594
+ useEffect as useEffect30,
52470
52595
  useMemo as useMemo26,
52471
- useRef as useRef21,
52472
- useState as useState37
52596
+ useRef as useRef22,
52597
+ useState as useState38
52473
52598
  } from "react";
52474
52599
  import { jsx as jsx82 } from "react/jsx-runtime";
52475
52600
  function ChartEditor({
@@ -52517,9 +52642,9 @@ function ChartEditor({
52517
52642
  onClickChartElement,
52518
52643
  onClickChartError
52519
52644
  }) {
52520
- const parentRef = useRef21(null);
52521
- const [modalWidth, setModalWidth] = useState37(200);
52522
- const [modalHeight, setModalHeight] = useState37(200);
52645
+ const parentRef = useRef22(null);
52646
+ const [modalWidth, setModalWidth] = useState38(200);
52647
+ const [modalHeight, setModalHeight] = useState38(200);
52523
52648
  const { addReport } = useDashboardReports(destinationDashboard);
52524
52649
  const { allReportsById } = useAllReports();
52525
52650
  const { tenants, flags } = useContext33(TenantContext);
@@ -52537,15 +52662,15 @@ function ChartEditor({
52537
52662
  (f) => f.filter
52538
52663
  );
52539
52664
  }, [dashboardFilters]);
52540
- const [filtersEnabled, setFiltersEnabled] = useState37(true);
52541
- const [chartBuilderKey, setChartBuilderKey] = useState37(0);
52665
+ const [filtersEnabled, setFiltersEnabled] = useState38(true);
52666
+ const [chartBuilderKey, setChartBuilderKey] = useState38(0);
52542
52667
  const dateFilter = Object.values(specificDashboardFilters).find(
52543
52668
  (filter) => filter.filterType === "date_range"
52544
52669
  );
52545
52670
  const dateRange = useMemo26(() => {
52546
52671
  return dateFilter?.startDate ? { start: dateFilter.startDate, end: dateFilter.endDate } : void 0;
52547
52672
  }, [dateFilter]);
52548
- useEffect29(() => {
52673
+ useEffect30(() => {
52549
52674
  function handleResize() {
52550
52675
  const screenSize = window.innerWidth;
52551
52676
  if (screenSize >= 1200) {
@@ -52593,7 +52718,7 @@ function ChartEditor({
52593
52718
  }
52594
52719
  addReport(report2);
52595
52720
  };
52596
- useEffect29(() => {
52721
+ useEffect30(() => {
52597
52722
  if (!isClientLoading && !report) {
52598
52723
  fetchReportHelper();
52599
52724
  }
@@ -52741,7 +52866,7 @@ function StaticChart({
52741
52866
  init_valueFormatter();
52742
52867
 
52743
52868
  // src/hooks/useTenants.ts
52744
- import { useContext as useContext34, useEffect as useEffect30 } from "react";
52869
+ import { useContext as useContext34, useEffect as useEffect31 } from "react";
52745
52870
  var useTenants = (dashboardName) => {
52746
52871
  const {
52747
52872
  tenants,
@@ -52755,12 +52880,12 @@ var useTenants = (dashboardName) => {
52755
52880
  getMappedTenantsForDashboard,
52756
52881
  getViewerTenantsByOwner
52757
52882
  } = useContext34(TenantContext);
52758
- useEffect30(() => {
52883
+ useEffect31(() => {
52759
52884
  if (dashboardName) {
52760
52885
  fetchViewerTenantsForDashboard(dashboardName);
52761
52886
  }
52762
52887
  }, [dashboardName, fetchViewerTenantsForDashboard]);
52763
- useEffect30(() => {
52888
+ useEffect31(() => {
52764
52889
  if (dashboardName) {
52765
52890
  fetchMappedTenantsForDashboard(dashboardName);
52766
52891
  }
@@ -52779,7 +52904,7 @@ var useTenants = (dashboardName) => {
52779
52904
  };
52780
52905
 
52781
52906
  // src/hooks/useQuill.ts
52782
- import { useContext as useContext35, useEffect as useEffect31, useMemo as useMemo27, useState as useState38 } from "react";
52907
+ import { useContext as useContext35, useEffect as useEffect32, useMemo as useMemo27, useState as useState39 } from "react";
52783
52908
  init_paginationProcessing();
52784
52909
  init_tableProcessing();
52785
52910
  init_dataProcessing();
@@ -52802,9 +52927,9 @@ var useQuill = (reportId, pagination) => {
52802
52927
  const [client, isClientLoading] = useContext35(ClientContext);
52803
52928
  const { tenants } = useContext35(TenantContext);
52804
52929
  const { eventTracking } = useContext35(EventTrackingContext);
52805
- const [loading, setLoading] = useState38(true);
52806
- const [error, setError] = useState38(void 0);
52807
- const [previousPage, setPreviousPage] = useState38(0);
52930
+ const [loading, setLoading] = useState39(true);
52931
+ const [error, setError] = useState39(void 0);
52932
+ const [previousPage, setPreviousPage] = useState39(0);
52808
52933
  const processedReport = useMemo27(() => {
52809
52934
  return reportId && allReportsById[reportId] ? convertInternalReportToReport(
52810
52935
  mergeComparisonRange(allReportsById[reportId]),
@@ -52813,7 +52938,7 @@ var useQuill = (reportId, pagination) => {
52813
52938
  "useQuill"
52814
52939
  ) : void 0;
52815
52940
  }, [reportId, reportId && allReportsById[reportId], specificReportFilters]);
52816
- const [additionalProcessing, setAdditionProcessing] = useState38(
52941
+ const [additionalProcessing, setAdditionProcessing] = useState39(
52817
52942
  pagination ? {
52818
52943
  page: pagination
52819
52944
  } : void 0
@@ -52962,7 +53087,7 @@ var useQuill = (reportId, pagination) => {
52962
53087
  setLoading(false);
52963
53088
  }
52964
53089
  };
52965
- useEffect31(() => {
53090
+ useEffect32(() => {
52966
53091
  if (isClientLoading) return;
52967
53092
  if (reportId && specificReportFilters) {
52968
53093
  fetchReportHelper(reportId, {
@@ -53029,7 +53154,7 @@ var useMemoizedRows = (reportId) => {
53029
53154
  };
53030
53155
 
53031
53156
  // src/hooks/useAskQuill.tsx
53032
- import { useContext as useContext36, useEffect as useEffect32, useState as useState39 } from "react";
53157
+ import { useContext as useContext36, useEffect as useEffect33, useState as useState40 } from "react";
53033
53158
  init_astProcessing();
53034
53159
  init_astFilterProcessing();
53035
53160
  init_pivotProcessing();
@@ -53062,8 +53187,8 @@ var useAskQuill = (dashboardName) => {
53062
53187
  const { tenants } = useContext36(TenantContext);
53063
53188
  const { getToken } = useContext36(FetchContext);
53064
53189
  const { eventTracking } = useContext36(EventTrackingContext);
53065
- const [astInfo, setAstInfo] = useState39(void 0);
53066
- const [data, setData] = useState39({
53190
+ const [astInfo, setAstInfo] = useState40(void 0);
53191
+ const [data, setData] = useState40({
53067
53192
  rows: [],
53068
53193
  columns: [],
53069
53194
  pivot: null,
@@ -53073,9 +53198,9 @@ var useAskQuill = (dashboardName) => {
53073
53198
  pivotColumnFields: [],
53074
53199
  pivotValueFields: []
53075
53200
  });
53076
- const [loading, setLoading] = useState39(false);
53077
- const [error, setError] = useState39(void 0);
53078
- const [ask, setAsk] = useState39(
53201
+ const [loading, setLoading] = useState40(false);
53202
+ const [error, setError] = useState40(void 0);
53203
+ const [ask, setAsk] = useState40(
53079
53204
  async () => void 0
53080
53205
  );
53081
53206
  const askHelper = async (query) => {
@@ -53275,7 +53400,7 @@ var useAskQuill = (dashboardName) => {
53275
53400
  });
53276
53401
  setLoading(false);
53277
53402
  };
53278
- useEffect32(() => {
53403
+ useEffect33(() => {
53279
53404
  setAsk(() => askHelper);
53280
53405
  }, [schemaData.schema]);
53281
53406
  return {
@@ -53289,13 +53414,13 @@ var useAskQuill = (dashboardName) => {
53289
53414
  };
53290
53415
 
53291
53416
  // src/hooks/useVirtualTables.tsx
53292
- import { useContext as useContext37, useState as useState40 } from "react";
53417
+ import { useContext as useContext37, useState as useState41 } from "react";
53293
53418
  var useVirtualTables = () => {
53294
53419
  const [schemaData, setSchemaData] = useContext37(SchemaDataContext);
53295
53420
  const { tenants } = useContext37(TenantContext);
53296
53421
  const { getToken, quillFetchWithToken } = useContext37(FetchContext);
53297
53422
  const { eventTracking } = useContext37(EventTrackingContext);
53298
- const [loadingTables, setLoadingTables] = useState40({});
53423
+ const [loadingTables, setLoadingTables] = useState41({});
53299
53424
  const handleReload = async (client, caller) => {
53300
53425
  setSchemaData({ ...schemaData, isSchemaLoading: true });
53301
53426
  setLoadingTables(