@quillsql/react 2.16.4 → 2.16.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1348 -1249
- package/dist/index.d.cts +3 -10
- package/dist/index.d.ts +3 -10
- package/dist/index.js +1105 -1001
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18981,7 +18981,9 @@ var init_dataFetcher = __esm({
|
|
|
18981
18981
|
if (e instanceof Error && e.name === "AbortError") {
|
|
18982
18982
|
throw e;
|
|
18983
18983
|
}
|
|
18984
|
-
|
|
18984
|
+
if (task !== "set-section-order") {
|
|
18985
|
+
console.error("Failed to fetch:", e);
|
|
18986
|
+
}
|
|
18985
18987
|
return { error: "Failed to fetch data" };
|
|
18986
18988
|
}
|
|
18987
18989
|
};
|
|
@@ -19405,19 +19407,19 @@ var require_pluralize = __commonJS({
|
|
|
19405
19407
|
// src/Dashboard.tsx
|
|
19406
19408
|
import {
|
|
19407
19409
|
useContext as useContext20,
|
|
19408
|
-
useEffect as
|
|
19409
|
-
useState as
|
|
19410
|
+
useEffect as useEffect19,
|
|
19411
|
+
useState as useState24,
|
|
19410
19412
|
useMemo as useMemo16,
|
|
19411
|
-
useRef as
|
|
19413
|
+
useRef as useRef14
|
|
19412
19414
|
} from "react";
|
|
19413
19415
|
|
|
19414
19416
|
// src/Chart.tsx
|
|
19415
19417
|
import {
|
|
19416
|
-
useState as
|
|
19417
|
-
useEffect as
|
|
19418
|
+
useState as useState18,
|
|
19419
|
+
useEffect as useEffect16,
|
|
19418
19420
|
useContext as useContext16,
|
|
19419
19421
|
useMemo as useMemo13,
|
|
19420
|
-
useRef as
|
|
19422
|
+
useRef as useRef12
|
|
19421
19423
|
} from "react";
|
|
19422
19424
|
|
|
19423
19425
|
// src/utils/csv.ts
|
|
@@ -22290,28 +22292,16 @@ var ContextProvider = ({
|
|
|
22290
22292
|
dashboardName,
|
|
22291
22293
|
sectionOrder: newSectionOrder
|
|
22292
22294
|
};
|
|
22293
|
-
|
|
22294
|
-
|
|
22295
|
-
|
|
22296
|
-
|
|
22297
|
-
|
|
22298
|
-
|
|
22299
|
-
|
|
22300
|
-
|
|
22301
|
-
|
|
22302
|
-
|
|
22303
|
-
type: "bug",
|
|
22304
|
-
// TODO: determine type
|
|
22305
|
-
severity: "high",
|
|
22306
|
-
message: "Error setting section order",
|
|
22307
|
-
errorMessage: e.message,
|
|
22308
|
-
errorStack: e.stack,
|
|
22309
|
-
errorData: {
|
|
22310
|
-
caller: "Context",
|
|
22311
|
-
function: "loadDashboard"
|
|
22312
|
-
}
|
|
22313
|
-
});
|
|
22314
|
-
}
|
|
22295
|
+
void quillFetch({
|
|
22296
|
+
client,
|
|
22297
|
+
task: "set-section-order",
|
|
22298
|
+
metadata: body,
|
|
22299
|
+
getToken: getAuthorizationToken
|
|
22300
|
+
}).catch((error) => {
|
|
22301
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
22302
|
+
return;
|
|
22303
|
+
}
|
|
22304
|
+
});
|
|
22315
22305
|
}
|
|
22316
22306
|
}
|
|
22317
22307
|
}
|
|
@@ -23173,12 +23163,11 @@ var useDashboardInternal = (dashboardName, customFilters) => {
|
|
|
23173
23163
|
dashboardName,
|
|
23174
23164
|
sectionOrder
|
|
23175
23165
|
};
|
|
23176
|
-
|
|
23177
|
-
|
|
23178
|
-
|
|
23179
|
-
|
|
23180
|
-
|
|
23181
|
-
});
|
|
23166
|
+
void quillFetchWithToken({
|
|
23167
|
+
client,
|
|
23168
|
+
task: "set-section-order",
|
|
23169
|
+
metadata: body
|
|
23170
|
+
}).then((response) => {
|
|
23182
23171
|
Object.entries(response?.data?.newIds ?? {}).forEach(
|
|
23183
23172
|
([section, newId2]) => {
|
|
23184
23173
|
dashboardConfigDispatch({
|
|
@@ -23200,21 +23189,11 @@ var useDashboardInternal = (dashboardName, customFilters) => {
|
|
|
23200
23189
|
});
|
|
23201
23190
|
}
|
|
23202
23191
|
);
|
|
23203
|
-
}
|
|
23204
|
-
|
|
23205
|
-
|
|
23206
|
-
|
|
23207
|
-
|
|
23208
|
-
severity: "high",
|
|
23209
|
-
message: "Error setting section order",
|
|
23210
|
-
errorMessage: e.message,
|
|
23211
|
-
errorStack: e.stack,
|
|
23212
|
-
errorData: {
|
|
23213
|
-
caller: "useDashboard",
|
|
23214
|
-
function: "setSectionOrder"
|
|
23215
|
-
}
|
|
23216
|
-
});
|
|
23217
|
-
}
|
|
23192
|
+
}).catch((error) => {
|
|
23193
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
23194
|
+
return;
|
|
23195
|
+
}
|
|
23196
|
+
});
|
|
23218
23197
|
}
|
|
23219
23198
|
};
|
|
23220
23199
|
function isDashboardFilterLoading(filterName) {
|
|
@@ -25559,15 +25538,15 @@ var PieChart_default = PieChartWrapper;
|
|
|
25559
25538
|
|
|
25560
25539
|
// src/components/QuillTable.tsx
|
|
25561
25540
|
init_valueFormatter();
|
|
25562
|
-
import { useContext as useContext5, useEffect as
|
|
25541
|
+
import { useContext as useContext5, useEffect as useEffect8, useState as useState9 } from "react";
|
|
25563
25542
|
|
|
25564
25543
|
// src/components/UiComponents.tsx
|
|
25565
25544
|
import {
|
|
25566
25545
|
forwardRef,
|
|
25567
25546
|
useContext as useContext4,
|
|
25568
|
-
useEffect as
|
|
25569
|
-
useRef as
|
|
25570
|
-
useState as
|
|
25547
|
+
useEffect as useEffect7,
|
|
25548
|
+
useRef as useRef4,
|
|
25549
|
+
useState as useState8
|
|
25571
25550
|
} from "react";
|
|
25572
25551
|
|
|
25573
25552
|
// src/assets/ArrowDownHeadIcon.tsx
|
|
@@ -25819,6 +25798,146 @@ import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
|
25819
25798
|
// src/hooks/useSelectOnKeyDown.tsx
|
|
25820
25799
|
import { useEffect as useEffect5, useState as useState6 } from "react";
|
|
25821
25800
|
|
|
25801
|
+
// src/hooks/useResponsiveFirstChildWidth.ts
|
|
25802
|
+
import {
|
|
25803
|
+
useEffect as useEffect6,
|
|
25804
|
+
useLayoutEffect,
|
|
25805
|
+
useRef as useRef3,
|
|
25806
|
+
useState as useState7
|
|
25807
|
+
} from "react";
|
|
25808
|
+
var DEFAULT_MIN_WIDTH = 0;
|
|
25809
|
+
var parseNumericValue = (value) => {
|
|
25810
|
+
if (!value) {
|
|
25811
|
+
return 0;
|
|
25812
|
+
}
|
|
25813
|
+
const parsed = parseFloat(value);
|
|
25814
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
25815
|
+
};
|
|
25816
|
+
var getHorizontalGap = (element, explicitGap) => {
|
|
25817
|
+
if (typeof explicitGap === "number") {
|
|
25818
|
+
return explicitGap;
|
|
25819
|
+
}
|
|
25820
|
+
const computedStyle = window.getComputedStyle(element);
|
|
25821
|
+
const columnGap = parseNumericValue(computedStyle.columnGap);
|
|
25822
|
+
if (columnGap > 0) {
|
|
25823
|
+
return columnGap;
|
|
25824
|
+
}
|
|
25825
|
+
const genericGap = parseNumericValue(computedStyle.gap);
|
|
25826
|
+
return genericGap;
|
|
25827
|
+
};
|
|
25828
|
+
var calculateFirstChildWidth = (element, options) => {
|
|
25829
|
+
const { gap, minWidth, maxWidth } = options;
|
|
25830
|
+
const computedStyle = window.getComputedStyle(element);
|
|
25831
|
+
const horizontalPadding = parseNumericValue(computedStyle.paddingLeft) + parseNumericValue(computedStyle.paddingRight);
|
|
25832
|
+
const availableWidth = Math.max(
|
|
25833
|
+
0,
|
|
25834
|
+
element.clientWidth - horizontalPadding
|
|
25835
|
+
);
|
|
25836
|
+
const children = Array.from(element.children);
|
|
25837
|
+
if (!children.length) {
|
|
25838
|
+
return Math.max(minWidth ?? DEFAULT_MIN_WIDTH, 0);
|
|
25839
|
+
}
|
|
25840
|
+
const siblings = children.slice(1);
|
|
25841
|
+
const gapCount = Math.max(children.length - 1, 0);
|
|
25842
|
+
const effectiveGap = getHorizontalGap(element, gap) * gapCount;
|
|
25843
|
+
let siblingsWidth = 0;
|
|
25844
|
+
siblings.forEach((child) => {
|
|
25845
|
+
const rect = child.getBoundingClientRect();
|
|
25846
|
+
const childStyle = window.getComputedStyle(child);
|
|
25847
|
+
siblingsWidth += rect.width + parseNumericValue(childStyle.marginLeft) + parseNumericValue(childStyle.marginRight);
|
|
25848
|
+
});
|
|
25849
|
+
const rawWidth = Math.max(0, availableWidth - siblingsWidth - effectiveGap);
|
|
25850
|
+
const min2 = Math.max(minWidth ?? DEFAULT_MIN_WIDTH, 0);
|
|
25851
|
+
const max2 = typeof maxWidth === "number" && Number.isFinite(maxWidth) ? Math.max(maxWidth, min2) : void 0;
|
|
25852
|
+
const clampedWidth = max2 !== void 0 ? Math.min(Math.max(rawWidth, min2), max2) : Math.max(rawWidth, min2);
|
|
25853
|
+
return Math.floor(clampedWidth);
|
|
25854
|
+
};
|
|
25855
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect6;
|
|
25856
|
+
var useResponsiveFirstChildWidth = (containerRef, options = {}) => {
|
|
25857
|
+
const {
|
|
25858
|
+
gap,
|
|
25859
|
+
initialWidth = -1,
|
|
25860
|
+
minWidth = DEFAULT_MIN_WIDTH,
|
|
25861
|
+
maxWidth
|
|
25862
|
+
} = options;
|
|
25863
|
+
const [width, setWidth] = useState7(initialWidth);
|
|
25864
|
+
const previousWidthRef = useRef3(initialWidth);
|
|
25865
|
+
useIsomorphicLayoutEffect(() => {
|
|
25866
|
+
const element = containerRef?.current ?? null;
|
|
25867
|
+
if (!element || typeof window === "undefined") {
|
|
25868
|
+
return;
|
|
25869
|
+
}
|
|
25870
|
+
let frameId = null;
|
|
25871
|
+
const updateWidth = () => {
|
|
25872
|
+
if (!element.isConnected) {
|
|
25873
|
+
return;
|
|
25874
|
+
}
|
|
25875
|
+
const nextWidth = calculateFirstChildWidth(element, {
|
|
25876
|
+
gap,
|
|
25877
|
+
minWidth,
|
|
25878
|
+
maxWidth
|
|
25879
|
+
});
|
|
25880
|
+
if (frameId !== null) {
|
|
25881
|
+
cancelAnimationFrame(frameId);
|
|
25882
|
+
}
|
|
25883
|
+
frameId = window.requestAnimationFrame(() => {
|
|
25884
|
+
frameId = null;
|
|
25885
|
+
if (Math.abs(previousWidthRef.current - nextWidth) > 0.5) {
|
|
25886
|
+
previousWidthRef.current = nextWidth;
|
|
25887
|
+
setWidth(nextWidth);
|
|
25888
|
+
}
|
|
25889
|
+
});
|
|
25890
|
+
};
|
|
25891
|
+
if (typeof ResizeObserver === "undefined") {
|
|
25892
|
+
updateWidth();
|
|
25893
|
+
const handleResize = () => updateWidth();
|
|
25894
|
+
window.addEventListener("resize", handleResize);
|
|
25895
|
+
return () => {
|
|
25896
|
+
if (frameId !== null) {
|
|
25897
|
+
cancelAnimationFrame(frameId);
|
|
25898
|
+
}
|
|
25899
|
+
window.removeEventListener("resize", handleResize);
|
|
25900
|
+
};
|
|
25901
|
+
}
|
|
25902
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
25903
|
+
updateWidth();
|
|
25904
|
+
});
|
|
25905
|
+
const observeChildren = () => {
|
|
25906
|
+
resizeObserver.observe(element);
|
|
25907
|
+
Array.from(element.children).forEach((child) => {
|
|
25908
|
+
resizeObserver.observe(child);
|
|
25909
|
+
});
|
|
25910
|
+
};
|
|
25911
|
+
observeChildren();
|
|
25912
|
+
updateWidth();
|
|
25913
|
+
const mutationObserver = new MutationObserver((mutations) => {
|
|
25914
|
+
mutations.forEach((mutation) => {
|
|
25915
|
+
mutation.addedNodes.forEach((node) => {
|
|
25916
|
+
if (node instanceof HTMLElement) {
|
|
25917
|
+
resizeObserver.observe(node);
|
|
25918
|
+
}
|
|
25919
|
+
});
|
|
25920
|
+
mutation.removedNodes.forEach((node) => {
|
|
25921
|
+
if (node instanceof HTMLElement) {
|
|
25922
|
+
resizeObserver.unobserve(node);
|
|
25923
|
+
}
|
|
25924
|
+
});
|
|
25925
|
+
});
|
|
25926
|
+
updateWidth();
|
|
25927
|
+
});
|
|
25928
|
+
mutationObserver.observe(element, { childList: true });
|
|
25929
|
+
return () => {
|
|
25930
|
+
if (frameId !== null) {
|
|
25931
|
+
cancelAnimationFrame(frameId);
|
|
25932
|
+
}
|
|
25933
|
+
resizeObserver.disconnect();
|
|
25934
|
+
mutationObserver.disconnect();
|
|
25935
|
+
};
|
|
25936
|
+
}, [containerRef?.current, gap, minWidth, maxWidth]);
|
|
25937
|
+
return width;
|
|
25938
|
+
};
|
|
25939
|
+
var useResponsiveFirstChildWidth_default = useResponsiveFirstChildWidth;
|
|
25940
|
+
|
|
25822
25941
|
// src/components/UiComponents.tsx
|
|
25823
25942
|
import { createPortal } from "react-dom";
|
|
25824
25943
|
|
|
@@ -25850,14 +25969,19 @@ var QuillTextInput = forwardRef(
|
|
|
25850
25969
|
disabled
|
|
25851
25970
|
}, ref) => {
|
|
25852
25971
|
const [theme] = useContext4(ThemeContext);
|
|
25972
|
+
const isNumericWidth = typeof width === "number";
|
|
25973
|
+
const resolvedWidth = typeof width === "string" ? width : isNumericWidth ? width : "100%";
|
|
25853
25974
|
return /* @__PURE__ */ jsxs18(
|
|
25854
25975
|
"label",
|
|
25855
25976
|
{
|
|
25856
25977
|
style: {
|
|
25857
25978
|
position: "relative",
|
|
25858
25979
|
borderRadius: "6px",
|
|
25859
|
-
|
|
25860
|
-
|
|
25980
|
+
display: "flex",
|
|
25981
|
+
flexDirection: "column",
|
|
25982
|
+
width: resolvedWidth,
|
|
25983
|
+
minWidth: isNumericWidth ? width : 0,
|
|
25984
|
+
flex: isNumericWidth ? "0 0 auto" : "1 1 auto"
|
|
25861
25985
|
},
|
|
25862
25986
|
children: [
|
|
25863
25987
|
label && /* @__PURE__ */ jsx26(
|
|
@@ -25879,6 +26003,7 @@ var QuillTextInput = forwardRef(
|
|
|
25879
26003
|
ref,
|
|
25880
26004
|
style: {
|
|
25881
26005
|
display: "flex",
|
|
26006
|
+
flex: "1 1 auto",
|
|
25882
26007
|
height: 40,
|
|
25883
26008
|
minHeight: 40,
|
|
25884
26009
|
maxHeight: 40,
|
|
@@ -25890,8 +26015,8 @@ var QuillTextInput = forwardRef(
|
|
|
25890
26015
|
backgroundColor: theme?.backgroundColor,
|
|
25891
26016
|
color: theme?.primaryTextColor,
|
|
25892
26017
|
fontFamily: theme?.fontFamily,
|
|
25893
|
-
width,
|
|
25894
|
-
minWidth:
|
|
26018
|
+
width: "100%",
|
|
26019
|
+
minWidth: 0
|
|
25895
26020
|
},
|
|
25896
26021
|
id: id2,
|
|
25897
26022
|
value,
|
|
@@ -26261,10 +26386,10 @@ var MemoizedPopover = ({
|
|
|
26261
26386
|
titlePaddingLeft = 0
|
|
26262
26387
|
}) => {
|
|
26263
26388
|
const [theme] = useContext4(ThemeContext);
|
|
26264
|
-
const [rightAlignment, setRightAlignment] =
|
|
26265
|
-
const modalRef =
|
|
26266
|
-
const popoverRef =
|
|
26267
|
-
|
|
26389
|
+
const [rightAlignment, setRightAlignment] = useState8("auto");
|
|
26390
|
+
const modalRef = useRef4(null);
|
|
26391
|
+
const popoverRef = useRef4(null);
|
|
26392
|
+
useEffect7(() => {
|
|
26268
26393
|
const listener = (event) => {
|
|
26269
26394
|
const target = event.target;
|
|
26270
26395
|
if (modalRef.current?.contains(target) || target.closest("[data-portal-ignore]") || ignoredRefs?.some(
|
|
@@ -26283,7 +26408,7 @@ var MemoizedPopover = ({
|
|
|
26283
26408
|
document.removeEventListener("mousedown", listener);
|
|
26284
26409
|
};
|
|
26285
26410
|
}, [isOpen, ignoredRefs, setIsOpen, modalRef]);
|
|
26286
|
-
|
|
26411
|
+
useEffect7(() => {
|
|
26287
26412
|
updatePopoverPosition();
|
|
26288
26413
|
window.addEventListener("resize", updatePopoverPosition);
|
|
26289
26414
|
return () => {
|
|
@@ -26679,10 +26804,10 @@ var QuillModalComponent = ({
|
|
|
26679
26804
|
title
|
|
26680
26805
|
}) => {
|
|
26681
26806
|
const [theme] = useContext4(ThemeContext);
|
|
26682
|
-
const [rightAlignment, setRightAlignment] =
|
|
26683
|
-
const modalRef =
|
|
26684
|
-
const popoverRef =
|
|
26685
|
-
|
|
26807
|
+
const [rightAlignment, setRightAlignment] = useState8("auto");
|
|
26808
|
+
const modalRef = useRef4(null);
|
|
26809
|
+
const popoverRef = useRef4(null);
|
|
26810
|
+
useEffect7(() => {
|
|
26686
26811
|
const listener = (event) => {
|
|
26687
26812
|
if (modalRef?.current && !modalRef?.current?.contains(event.target)) {
|
|
26688
26813
|
if (setIsOpen) setIsOpen(false);
|
|
@@ -26697,7 +26822,7 @@ var QuillModalComponent = ({
|
|
|
26697
26822
|
document.removeEventListener("mousedown", listener);
|
|
26698
26823
|
};
|
|
26699
26824
|
}, [modalRef, setIsOpen, isOpen]);
|
|
26700
|
-
|
|
26825
|
+
useEffect7(() => {
|
|
26701
26826
|
updatePopoverPosition();
|
|
26702
26827
|
window.addEventListener("resize", updatePopoverPosition);
|
|
26703
26828
|
return () => {
|
|
@@ -26994,9 +27119,9 @@ var OverflowContainer = ({
|
|
|
26994
27119
|
children,
|
|
26995
27120
|
style: style2
|
|
26996
27121
|
}) => {
|
|
26997
|
-
const containerRef =
|
|
26998
|
-
const [showTopShadow, setShowTopShadow] =
|
|
26999
|
-
const [showBottomShadow, setShowBottomShadow] =
|
|
27122
|
+
const containerRef = useRef4(null);
|
|
27123
|
+
const [showTopShadow, setShowTopShadow] = useState8(false);
|
|
27124
|
+
const [showBottomShadow, setShowBottomShadow] = useState8(false);
|
|
27000
27125
|
const checkOverflow = () => {
|
|
27001
27126
|
const container = containerRef.current;
|
|
27002
27127
|
if (container) {
|
|
@@ -27007,7 +27132,7 @@ var OverflowContainer = ({
|
|
|
27007
27132
|
);
|
|
27008
27133
|
}
|
|
27009
27134
|
};
|
|
27010
|
-
|
|
27135
|
+
useEffect7(() => {
|
|
27011
27136
|
const container = containerRef.current;
|
|
27012
27137
|
if (container) {
|
|
27013
27138
|
checkOverflow();
|
|
@@ -27161,10 +27286,10 @@ var QuillToolTipPortal = ({
|
|
|
27161
27286
|
mirror = false
|
|
27162
27287
|
}) => {
|
|
27163
27288
|
const [theme] = useContext4(ThemeContext);
|
|
27164
|
-
const [isOpen, setIsOpen] =
|
|
27165
|
-
const tooltipRef =
|
|
27166
|
-
const triggerRef =
|
|
27167
|
-
const [tooltipPosition, setTooltipPosition] =
|
|
27289
|
+
const [isOpen, setIsOpen] = useState8(false);
|
|
27290
|
+
const tooltipRef = useRef4(null);
|
|
27291
|
+
const triggerRef = useRef4(null);
|
|
27292
|
+
const [tooltipPosition, setTooltipPosition] = useState8(void 0);
|
|
27168
27293
|
const updatePosition = () => {
|
|
27169
27294
|
if (triggerRef.current && tooltipRef.current) {
|
|
27170
27295
|
const rect = triggerRef.current.getBoundingClientRect();
|
|
@@ -27189,7 +27314,7 @@ var QuillToolTipPortal = ({
|
|
|
27189
27314
|
setTooltipPosition({ top, left });
|
|
27190
27315
|
}
|
|
27191
27316
|
};
|
|
27192
|
-
|
|
27317
|
+
useEffect7(() => {
|
|
27193
27318
|
if (isOpen) {
|
|
27194
27319
|
const timer2 = setTimeout(() => {
|
|
27195
27320
|
updatePosition();
|
|
@@ -27332,10 +27457,10 @@ var QuillPortal = ({
|
|
|
27332
27457
|
showModal,
|
|
27333
27458
|
setShowModal
|
|
27334
27459
|
}) => {
|
|
27335
|
-
const modalRef =
|
|
27336
|
-
const [popoverPosition, setPopoverPosition] =
|
|
27337
|
-
const [z, setZ] =
|
|
27338
|
-
const scrollableParentRef =
|
|
27460
|
+
const modalRef = useRef4(null);
|
|
27461
|
+
const [popoverPosition, setPopoverPosition] = useState8(void 0);
|
|
27462
|
+
const [z, setZ] = useState8(10);
|
|
27463
|
+
const scrollableParentRef = useRef4(document.body);
|
|
27339
27464
|
const updatePosition = () => {
|
|
27340
27465
|
if (anchorRef.current) {
|
|
27341
27466
|
requestAnimationFrame(() => {
|
|
@@ -27353,7 +27478,7 @@ var QuillPortal = ({
|
|
|
27353
27478
|
});
|
|
27354
27479
|
}
|
|
27355
27480
|
};
|
|
27356
|
-
|
|
27481
|
+
useEffect7(() => {
|
|
27357
27482
|
let resizeObserver;
|
|
27358
27483
|
let mutationObserver;
|
|
27359
27484
|
if (showModal && anchorRef.current) {
|
|
@@ -27450,18 +27575,18 @@ function QuillTable({
|
|
|
27450
27575
|
hideLabels,
|
|
27451
27576
|
disableSort
|
|
27452
27577
|
}) {
|
|
27453
|
-
const [activeRows, setActiveRows] =
|
|
27454
|
-
const [maxPage, setMaxPage] =
|
|
27455
|
-
const [sortColumn, setSortColumn] =
|
|
27456
|
-
const [sortDirection, setSortDirection] =
|
|
27578
|
+
const [activeRows, setActiveRows] = useState9([]);
|
|
27579
|
+
const [maxPage, setMaxPage] = useState9(1);
|
|
27580
|
+
const [sortColumn, setSortColumn] = useState9(sort?.field || "");
|
|
27581
|
+
const [sortDirection, setSortDirection] = useState9(sort?.direction || "desc");
|
|
27457
27582
|
const [theme] = useContext5(ThemeContext);
|
|
27458
|
-
const [isPaginating, setIsPaginating] =
|
|
27459
|
-
const [initialLoad, setInitialLoad] =
|
|
27460
|
-
|
|
27583
|
+
const [isPaginating, setIsPaginating] = useState9(true);
|
|
27584
|
+
const [initialLoad, setInitialLoad] = useState9(true);
|
|
27585
|
+
useEffect8(() => {
|
|
27461
27586
|
setSortColumn(sort?.field || "");
|
|
27462
27587
|
setSortDirection(sort?.direction || "desc");
|
|
27463
27588
|
}, [sort]);
|
|
27464
|
-
|
|
27589
|
+
useEffect8(() => {
|
|
27465
27590
|
if (rows?.length === 0 && isLoading) {
|
|
27466
27591
|
return;
|
|
27467
27592
|
}
|
|
@@ -27493,7 +27618,7 @@ function QuillTable({
|
|
|
27493
27618
|
rowCount,
|
|
27494
27619
|
isLoading
|
|
27495
27620
|
]);
|
|
27496
|
-
|
|
27621
|
+
useEffect8(() => {
|
|
27497
27622
|
if (rows.length <= currentPage * rowsPerPage) {
|
|
27498
27623
|
onPageChange && onPageChange(0);
|
|
27499
27624
|
setMaxPage(1);
|
|
@@ -29459,9 +29584,9 @@ import { useMemo as useMemo10 } from "react";
|
|
|
29459
29584
|
// src/DateRangePicker/QuillDateRangePicker.tsx
|
|
29460
29585
|
import {
|
|
29461
29586
|
useContext as useContext9,
|
|
29462
|
-
useEffect as
|
|
29463
|
-
useRef as
|
|
29464
|
-
useState as
|
|
29587
|
+
useEffect as useEffect10,
|
|
29588
|
+
useRef as useRef6,
|
|
29589
|
+
useState as useState11
|
|
29465
29590
|
} from "react";
|
|
29466
29591
|
import {
|
|
29467
29592
|
startOfMonth as startOfMonth2,
|
|
@@ -29482,9 +29607,9 @@ import {
|
|
|
29482
29607
|
import {
|
|
29483
29608
|
useContext as useContext8,
|
|
29484
29609
|
useMemo as useMemo7,
|
|
29485
|
-
useRef as
|
|
29486
|
-
useState as
|
|
29487
|
-
useEffect as
|
|
29610
|
+
useRef as useRef5,
|
|
29611
|
+
useState as useState10,
|
|
29612
|
+
useEffect as useEffect9
|
|
29488
29613
|
} from "react";
|
|
29489
29614
|
import { createPortal as createPortal2 } from "react-dom";
|
|
29490
29615
|
import { jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
@@ -29499,9 +29624,9 @@ function QuillSelectComponent({
|
|
|
29499
29624
|
hideEmptyOption
|
|
29500
29625
|
}) {
|
|
29501
29626
|
const [theme] = useContext8(ThemeContext);
|
|
29502
|
-
const [showModal, setShowModal] =
|
|
29503
|
-
const modalRef =
|
|
29504
|
-
const buttonRef =
|
|
29627
|
+
const [showModal, setShowModal] = useState10(false);
|
|
29628
|
+
const modalRef = useRef5(null);
|
|
29629
|
+
const buttonRef = useRef5(null);
|
|
29505
29630
|
useOnClickOutside_default(
|
|
29506
29631
|
modalRef,
|
|
29507
29632
|
(event) => {
|
|
@@ -29524,9 +29649,9 @@ function QuillSelectComponent({
|
|
|
29524
29649
|
const nullLabel = useMemo7(() => {
|
|
29525
29650
|
return sortedItems.some((item) => item.value === "-") ? "None" : "-";
|
|
29526
29651
|
}, [sortedItems]);
|
|
29527
|
-
const [popoverPosition, setPopoverPosition] =
|
|
29528
|
-
const [z, setZ] =
|
|
29529
|
-
const scrollableParentRef =
|
|
29652
|
+
const [popoverPosition, setPopoverPosition] = useState10(void 0);
|
|
29653
|
+
const [z, setZ] = useState10(10);
|
|
29654
|
+
const scrollableParentRef = useRef5(document.body);
|
|
29530
29655
|
const updatePosition = () => {
|
|
29531
29656
|
if (buttonRef.current) {
|
|
29532
29657
|
requestAnimationFrame(() => {
|
|
@@ -29544,7 +29669,7 @@ function QuillSelectComponent({
|
|
|
29544
29669
|
});
|
|
29545
29670
|
}
|
|
29546
29671
|
};
|
|
29547
|
-
|
|
29672
|
+
useEffect9(() => {
|
|
29548
29673
|
let resizeObserver;
|
|
29549
29674
|
let mutationObserver;
|
|
29550
29675
|
if (showModal && buttonRef.current) {
|
|
@@ -29825,23 +29950,23 @@ function QuillDateRangePicker({
|
|
|
29825
29950
|
}) {
|
|
29826
29951
|
const [theme] = useContext9(ThemeContext);
|
|
29827
29952
|
const [client] = useContext9(ClientContext);
|
|
29828
|
-
const [anchorStartDate, setAnchorStartDate] =
|
|
29953
|
+
const [anchorStartDate, setAnchorStartDate] = useState11(
|
|
29829
29954
|
getAnchorStartDate(dateRange.startDate, dateRange.endDate)
|
|
29830
29955
|
);
|
|
29831
|
-
const [anchorEndDate, setAnchorEndDate] =
|
|
29956
|
+
const [anchorEndDate, setAnchorEndDate] = useState11(
|
|
29832
29957
|
getAnchorEndDate(dateRange.startDate, dateRange.endDate)
|
|
29833
29958
|
);
|
|
29834
|
-
const [localStartDate, setLocalStartDate] =
|
|
29959
|
+
const [localStartDate, setLocalStartDate] = useState11(
|
|
29835
29960
|
dateRange.startDate
|
|
29836
29961
|
);
|
|
29837
|
-
const [localEndDate, setLocalEndDate] =
|
|
29962
|
+
const [localEndDate, setLocalEndDate] = useState11(
|
|
29838
29963
|
dateRange.endDate
|
|
29839
29964
|
);
|
|
29840
|
-
const [localPreset, setLocalPreset] =
|
|
29841
|
-
const [showModal, setShowModal] =
|
|
29842
|
-
const buttonRef =
|
|
29843
|
-
const modalRef =
|
|
29844
|
-
|
|
29965
|
+
const [localPreset, setLocalPreset] = useState11(preset);
|
|
29966
|
+
const [showModal, setShowModal] = useState11(false);
|
|
29967
|
+
const buttonRef = useRef6(null);
|
|
29968
|
+
const modalRef = useRef6(null);
|
|
29969
|
+
useEffect10(() => {
|
|
29845
29970
|
setLocalEndDate(dateRange.endDate);
|
|
29846
29971
|
setLocalStartDate(dateRange.startDate);
|
|
29847
29972
|
setLocalPreset(preset || "");
|
|
@@ -30354,10 +30479,10 @@ function getAnchorEndDate(startDate, endDate) {
|
|
|
30354
30479
|
// src/components/QuillMultiSelectWithCombo.tsx
|
|
30355
30480
|
import React7, {
|
|
30356
30481
|
useContext as useContext10,
|
|
30357
|
-
useEffect as
|
|
30482
|
+
useEffect as useEffect11,
|
|
30358
30483
|
useMemo as useMemo8,
|
|
30359
|
-
useRef as
|
|
30360
|
-
useState as
|
|
30484
|
+
useRef as useRef7,
|
|
30485
|
+
useState as useState12
|
|
30361
30486
|
} from "react";
|
|
30362
30487
|
import { createPortal as createPortal3 } from "react-dom";
|
|
30363
30488
|
import { Fragment as Fragment4, jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
@@ -30374,17 +30499,17 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30374
30499
|
style: style2
|
|
30375
30500
|
}) {
|
|
30376
30501
|
const [theme] = useContext10(ThemeContext);
|
|
30377
|
-
const [selectedOptions, setSelectedOptions] =
|
|
30378
|
-
const [showModal, setShowModal] =
|
|
30379
|
-
const modalRef =
|
|
30380
|
-
const buttonRef =
|
|
30381
|
-
const debounceTimeoutId =
|
|
30502
|
+
const [selectedOptions, setSelectedOptions] = useState12([]);
|
|
30503
|
+
const [showModal, setShowModal] = useState12(false);
|
|
30504
|
+
const modalRef = useRef7(null);
|
|
30505
|
+
const buttonRef = useRef7(null);
|
|
30506
|
+
const debounceTimeoutId = useRef7(null);
|
|
30382
30507
|
const [searchQuery, setSearchQuery] = React7.useState("");
|
|
30383
|
-
const [exceedsLimit, setExceedsLimit] =
|
|
30384
|
-
const [popoverPosition, setPopoverPosition] =
|
|
30385
|
-
const [z, setZ] =
|
|
30386
|
-
const scrollableParentRef =
|
|
30387
|
-
const selectAllRef =
|
|
30508
|
+
const [exceedsLimit, setExceedsLimit] = useState12(false);
|
|
30509
|
+
const [popoverPosition, setPopoverPosition] = useState12(void 0);
|
|
30510
|
+
const [z, setZ] = useState12(10);
|
|
30511
|
+
const scrollableParentRef = useRef7(document.body);
|
|
30512
|
+
const selectAllRef = useRef7(null);
|
|
30388
30513
|
let CheckboxState;
|
|
30389
30514
|
((CheckboxState2) => {
|
|
30390
30515
|
CheckboxState2[CheckboxState2["SELECTED"] = 0] = "SELECTED";
|
|
@@ -30418,7 +30543,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30418
30543
|
(elem) => elem.label ?? "-"
|
|
30419
30544
|
).join(", ");
|
|
30420
30545
|
}, [options, value]);
|
|
30421
|
-
const [selectAllCheckboxState, setSelectAllCheckboxState] =
|
|
30546
|
+
const [selectAllCheckboxState, setSelectAllCheckboxState] = useState12(
|
|
30422
30547
|
(() => {
|
|
30423
30548
|
if (value.length === 0) {
|
|
30424
30549
|
return 1 /* UNSELECTED */;
|
|
@@ -30429,12 +30554,12 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30429
30554
|
return 2 /* INDETERMINATE */;
|
|
30430
30555
|
})()
|
|
30431
30556
|
);
|
|
30432
|
-
|
|
30557
|
+
useEffect11(() => {
|
|
30433
30558
|
if (selectAllRef.current) {
|
|
30434
30559
|
selectAllRef.current.indeterminate = selectAllCheckboxState === 2 /* INDETERMINATE */;
|
|
30435
30560
|
}
|
|
30436
30561
|
}, [selectAllCheckboxState, showModal]);
|
|
30437
|
-
|
|
30562
|
+
useEffect11(() => {
|
|
30438
30563
|
if (options.length > 0 && options?.[0]?.value === "EXCEEDS_LIMIT") {
|
|
30439
30564
|
setExceedsLimit(true);
|
|
30440
30565
|
} else {
|
|
@@ -30449,7 +30574,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30449
30574
|
},
|
|
30450
30575
|
showModal
|
|
30451
30576
|
);
|
|
30452
|
-
|
|
30577
|
+
useEffect11(() => {
|
|
30453
30578
|
if (!value) {
|
|
30454
30579
|
setSelectedOptions([]);
|
|
30455
30580
|
} else {
|
|
@@ -30514,7 +30639,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30514
30639
|
});
|
|
30515
30640
|
}
|
|
30516
30641
|
};
|
|
30517
|
-
|
|
30642
|
+
useEffect11(() => {
|
|
30518
30643
|
let resizeObserver;
|
|
30519
30644
|
let mutationObserver;
|
|
30520
30645
|
if (showModal && buttonRef.current) {
|
|
@@ -31021,8 +31146,8 @@ var ListboxTextInput = ({
|
|
|
31021
31146
|
import React8, {
|
|
31022
31147
|
useContext as useContext11,
|
|
31023
31148
|
useMemo as useMemo9,
|
|
31024
|
-
useRef as
|
|
31025
|
-
useState as
|
|
31149
|
+
useRef as useRef8,
|
|
31150
|
+
useState as useState13
|
|
31026
31151
|
} from "react";
|
|
31027
31152
|
import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
31028
31153
|
function QuillSelectComponentWithCombo({
|
|
@@ -31036,9 +31161,9 @@ function QuillSelectComponentWithCombo({
|
|
|
31036
31161
|
disabled
|
|
31037
31162
|
}) {
|
|
31038
31163
|
const [theme] = useContext11(ThemeContext);
|
|
31039
|
-
const [showModal, setShowModal] =
|
|
31040
|
-
const modalRef =
|
|
31041
|
-
const buttonRef =
|
|
31164
|
+
const [showModal, setShowModal] = useState13(false);
|
|
31165
|
+
const modalRef = useRef8(null);
|
|
31166
|
+
const buttonRef = useRef8(null);
|
|
31042
31167
|
const [searchQuery, setSearchQuery] = React8.useState("");
|
|
31043
31168
|
const filteredItems = React8.useMemo(() => {
|
|
31044
31169
|
if (searchQuery === "") {
|
|
@@ -31826,7 +31951,7 @@ var MetricDisplay = ({
|
|
|
31826
31951
|
};
|
|
31827
31952
|
|
|
31828
31953
|
// src/components/Dashboard/DataLoader.tsx
|
|
31829
|
-
import { useContext as useContext13, useEffect as
|
|
31954
|
+
import { useContext as useContext13, useEffect as useEffect12, useMemo as useMemo11, useRef as useRef9, useState as useState14 } from "react";
|
|
31830
31955
|
init_paginationProcessing();
|
|
31831
31956
|
init_tableProcessing();
|
|
31832
31957
|
import equal2 from "fast-deep-equal";
|
|
@@ -31945,10 +32070,10 @@ function DataLoader({
|
|
|
31945
32070
|
) : Object.values(reportFilters[item.id] ?? {}).map((f) => f.filter);
|
|
31946
32071
|
}, [dashboardFilters, reportFilters, dashboardName, item.id]);
|
|
31947
32072
|
const [schemaData] = useContext13(SchemaDataContext);
|
|
31948
|
-
const [loading, setLoading] =
|
|
31949
|
-
const [error, setError] =
|
|
31950
|
-
const [previousPage, setPreviousPage] =
|
|
31951
|
-
const [additionalProcessing, setAdditionalProcessing] =
|
|
32073
|
+
const [loading, setLoading] = useState14(true);
|
|
32074
|
+
const [error, setError] = useState14(void 0);
|
|
32075
|
+
const [previousPage, setPreviousPage] = useState14(0);
|
|
32076
|
+
const [additionalProcessing, setAdditionalProcessing] = useState14(defaultAdditionalProcessing);
|
|
31952
32077
|
const chartReport = useMemo11(() => {
|
|
31953
32078
|
const report = (dashboardName ? dashboard : reports)[item.id];
|
|
31954
32079
|
if (report) {
|
|
@@ -31965,17 +32090,17 @@ function DataLoader({
|
|
|
31965
32090
|
reportFilters,
|
|
31966
32091
|
dashboardFilters
|
|
31967
32092
|
]);
|
|
31968
|
-
const previousFilters =
|
|
31969
|
-
const previousUserFilters =
|
|
31970
|
-
const previousTenants =
|
|
31971
|
-
const previousCustomFields =
|
|
31972
|
-
const [rowCountIsLoading, setRowCountIsLoading] =
|
|
31973
|
-
const rowsRequestId =
|
|
31974
|
-
const rowsAbortController =
|
|
31975
|
-
const rowCountRequestId =
|
|
31976
|
-
const rowCountAbortController =
|
|
31977
|
-
const updateTableRowsRequestId =
|
|
31978
|
-
const updateTableRowsAbortController =
|
|
32093
|
+
const previousFilters = useRef9(filters);
|
|
32094
|
+
const previousUserFilters = useRef9(userFilters);
|
|
32095
|
+
const previousTenants = useRef9(tenants);
|
|
32096
|
+
const previousCustomFields = useRef9(schemaData.customFields);
|
|
32097
|
+
const [rowCountIsLoading, setRowCountIsLoading] = useState14(false);
|
|
32098
|
+
const rowsRequestId = useRef9(0);
|
|
32099
|
+
const rowsAbortController = useRef9(null);
|
|
32100
|
+
const rowCountRequestId = useRef9(0);
|
|
32101
|
+
const rowCountAbortController = useRef9(null);
|
|
32102
|
+
const updateTableRowsRequestId = useRef9(0);
|
|
32103
|
+
const updateTableRowsAbortController = useRef9(null);
|
|
31979
32104
|
const fetchRowCount = async (processing) => {
|
|
31980
32105
|
if (!client || !filters) {
|
|
31981
32106
|
if (!rowCountAbortController.current) return;
|
|
@@ -32242,7 +32367,7 @@ function DataLoader({
|
|
|
32242
32367
|
}
|
|
32243
32368
|
}
|
|
32244
32369
|
};
|
|
32245
|
-
|
|
32370
|
+
useEffect12(() => {
|
|
32246
32371
|
if (schemaData.isSchemaLoading || filterValuesEquivalent(
|
|
32247
32372
|
previousFilters.current ?? contextFilters,
|
|
32248
32373
|
filters
|
|
@@ -32272,7 +32397,7 @@ function DataLoader({
|
|
|
32272
32397
|
schemaData.customFields,
|
|
32273
32398
|
schemaData.isSchemaLoading
|
|
32274
32399
|
]);
|
|
32275
|
-
|
|
32400
|
+
useEffect12(() => {
|
|
32276
32401
|
const tempReport = (dashboardName ? dashboard : reports)[item.id];
|
|
32277
32402
|
if (tempReport?.triggerReload) {
|
|
32278
32403
|
fetchReportHelper(additionalProcessing);
|
|
@@ -32315,17 +32440,17 @@ var ChartDataLoader = ({
|
|
|
32315
32440
|
(f) => f.filter
|
|
32316
32441
|
) : Object.values(reportFilters[item.id] ?? {}).map((f) => f.filter);
|
|
32317
32442
|
}, [dashboardFilters, reportFilters, dashboardName, item.id]);
|
|
32318
|
-
const [loading, setLoading] =
|
|
32319
|
-
const [error, setError] =
|
|
32443
|
+
const [loading, setLoading] = useState14(true);
|
|
32444
|
+
const [error, setError] = useState14(void 0);
|
|
32320
32445
|
const [client] = useContext13(ClientContext);
|
|
32321
32446
|
const [schemaData] = useContext13(SchemaDataContext);
|
|
32322
|
-
const previousFilters =
|
|
32323
|
-
const previousUserFilters =
|
|
32324
|
-
const previousDateBucket =
|
|
32325
|
-
const previousTenants =
|
|
32326
|
-
const previousCustomFields =
|
|
32327
|
-
const fetchReportAbortController =
|
|
32328
|
-
const rowsRequestId =
|
|
32447
|
+
const previousFilters = useRef9(filters);
|
|
32448
|
+
const previousUserFilters = useRef9(userFilters);
|
|
32449
|
+
const previousDateBucket = useRef9(dateBucket);
|
|
32450
|
+
const previousTenants = useRef9(tenants);
|
|
32451
|
+
const previousCustomFields = useRef9(schemaData.customFields);
|
|
32452
|
+
const fetchReportAbortController = useRef9(null);
|
|
32453
|
+
const rowsRequestId = useRef9(0);
|
|
32329
32454
|
const chartReport = useMemo11(() => {
|
|
32330
32455
|
const report = dashboardName ? dashboard[item.id] : reports[item.id];
|
|
32331
32456
|
if (!report) {
|
|
@@ -32438,7 +32563,7 @@ var ChartDataLoader = ({
|
|
|
32438
32563
|
}
|
|
32439
32564
|
}
|
|
32440
32565
|
};
|
|
32441
|
-
|
|
32566
|
+
useEffect12(() => {
|
|
32442
32567
|
if (!filters) {
|
|
32443
32568
|
return;
|
|
32444
32569
|
}
|
|
@@ -32473,7 +32598,7 @@ var ChartDataLoader = ({
|
|
|
32473
32598
|
schemaData.customFields,
|
|
32474
32599
|
schemaData.isSchemaLoading
|
|
32475
32600
|
]);
|
|
32476
|
-
|
|
32601
|
+
useEffect12(() => {
|
|
32477
32602
|
const tempReport = (dashboardName ? dashboard : reports)[item.id];
|
|
32478
32603
|
if (tempReport && tempReport.triggerReload) {
|
|
32479
32604
|
fetchReportHelper();
|
|
@@ -32555,7 +32680,7 @@ import {
|
|
|
32555
32680
|
Geography,
|
|
32556
32681
|
useMapContext
|
|
32557
32682
|
} from "react-simple-maps";
|
|
32558
|
-
import { useEffect as
|
|
32683
|
+
import { useEffect as useEffect13, useMemo as useMemo12, useRef as useRef10, useState as useState15 } from "react";
|
|
32559
32684
|
init_valueFormatter();
|
|
32560
32685
|
import { jsx as jsx45, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
32561
32686
|
var statesUrl = "https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json";
|
|
@@ -32882,18 +33007,18 @@ function USMap({
|
|
|
32882
33007
|
className,
|
|
32883
33008
|
containerStyle
|
|
32884
33009
|
}) {
|
|
32885
|
-
const containerRef =
|
|
32886
|
-
const [hoveredState, setHoveredState] =
|
|
33010
|
+
const containerRef = useRef10(null);
|
|
33011
|
+
const [hoveredState, setHoveredState] = useState15(
|
|
32887
33012
|
void 0
|
|
32888
33013
|
);
|
|
32889
|
-
const [hoveredCoords, setHoveredCoords] =
|
|
33014
|
+
const [hoveredCoords, setHoveredCoords] = useState15(void 0);
|
|
32890
33015
|
const mappedData = data.reduce((acc, curr) => {
|
|
32891
33016
|
acc[curr[xAxisField]?.toString()] = curr;
|
|
32892
33017
|
return acc;
|
|
32893
33018
|
}, {});
|
|
32894
33019
|
const measureField = yAxisFields[0]?.field ?? xAxisField;
|
|
32895
|
-
const [scaleLog, setScaleLog] =
|
|
32896
|
-
|
|
33020
|
+
const [scaleLog, setScaleLog] = useState15(null);
|
|
33021
|
+
useEffect13(() => {
|
|
32897
33022
|
import("d3-scale").then((scale) => {
|
|
32898
33023
|
setScaleLog(() => scale.scaleLog);
|
|
32899
33024
|
});
|
|
@@ -33073,18 +33198,18 @@ function WorldMap({
|
|
|
33073
33198
|
className,
|
|
33074
33199
|
containerStyle
|
|
33075
33200
|
}) {
|
|
33076
|
-
const containerRef =
|
|
33077
|
-
const [hoveredCountry, setHoveredCountry] =
|
|
33201
|
+
const containerRef = useRef10(null);
|
|
33202
|
+
const [hoveredCountry, setHoveredCountry] = useState15(
|
|
33078
33203
|
void 0
|
|
33079
33204
|
);
|
|
33080
|
-
const [hoveredCoords, setHoveredCoords] =
|
|
33205
|
+
const [hoveredCoords, setHoveredCoords] = useState15(void 0);
|
|
33081
33206
|
const mappedData = data.reduce((acc, curr) => {
|
|
33082
33207
|
acc[curr[xAxisField]?.toString()] = curr;
|
|
33083
33208
|
return acc;
|
|
33084
33209
|
}, {});
|
|
33085
33210
|
const measureField = yAxisFields[0]?.field ?? xAxisField;
|
|
33086
|
-
const [scaleLog, setScaleLog] =
|
|
33087
|
-
|
|
33211
|
+
const [scaleLog, setScaleLog] = useState15(null);
|
|
33212
|
+
useEffect13(() => {
|
|
33088
33213
|
import("d3-scale").then((scale) => {
|
|
33089
33214
|
setScaleLog(() => scale.scaleLog);
|
|
33090
33215
|
});
|
|
@@ -33266,8 +33391,8 @@ function MapLayout({
|
|
|
33266
33391
|
regionNames
|
|
33267
33392
|
}) {
|
|
33268
33393
|
const { projection } = useMapContext();
|
|
33269
|
-
const [geoCentroid, setGeoCentroid] =
|
|
33270
|
-
|
|
33394
|
+
const [geoCentroid, setGeoCentroid] = useState15(null);
|
|
33395
|
+
useEffect13(() => {
|
|
33271
33396
|
import("d3-geo").then((geo) => {
|
|
33272
33397
|
setGeoCentroid(() => geo.geoCentroid);
|
|
33273
33398
|
});
|
|
@@ -33319,7 +33444,7 @@ function MapLayout({
|
|
|
33319
33444
|
}
|
|
33320
33445
|
|
|
33321
33446
|
// src/components/Chart/GaugeChart.tsx
|
|
33322
|
-
import { useEffect as
|
|
33447
|
+
import { useEffect as useEffect14, useRef as useRef11, useState as useState16 } from "react";
|
|
33323
33448
|
|
|
33324
33449
|
// ../../node_modules/d3-transition/src/selection/index.js
|
|
33325
33450
|
import { selection as selection3 } from "d3-selection";
|
|
@@ -34593,20 +34718,20 @@ function D3Gauge({
|
|
|
34593
34718
|
colors,
|
|
34594
34719
|
isAnimationActive
|
|
34595
34720
|
}) {
|
|
34596
|
-
const containerRef =
|
|
34597
|
-
const svgRef =
|
|
34598
|
-
const gaugeGroupRef =
|
|
34599
|
-
const needleRef =
|
|
34600
|
-
const needleOutlineRef =
|
|
34601
|
-
const textRef =
|
|
34602
|
-
const previousPercentageRef =
|
|
34603
|
-
const firstMountRef =
|
|
34721
|
+
const containerRef = useRef11(null);
|
|
34722
|
+
const svgRef = useRef11(null);
|
|
34723
|
+
const gaugeGroupRef = useRef11(null);
|
|
34724
|
+
const needleRef = useRef11(null);
|
|
34725
|
+
const needleOutlineRef = useRef11(null);
|
|
34726
|
+
const textRef = useRef11(null);
|
|
34727
|
+
const previousPercentageRef = useRef11(0);
|
|
34728
|
+
const firstMountRef = useRef11(true);
|
|
34604
34729
|
const startAngle = -(3 * Math.PI) / 4;
|
|
34605
34730
|
const totalAngle = 3 * Math.PI / 2;
|
|
34606
|
-
const [arc, setArc] =
|
|
34607
|
-
const [interpolate, setInterpolate] =
|
|
34608
|
-
const [select, setSelect] =
|
|
34609
|
-
|
|
34731
|
+
const [arc, setArc] = useState16(null);
|
|
34732
|
+
const [interpolate, setInterpolate] = useState16(null);
|
|
34733
|
+
const [select, setSelect] = useState16(null);
|
|
34734
|
+
useEffect14(() => {
|
|
34610
34735
|
import("d3-shape").then(({ arc: arc2 }) => {
|
|
34611
34736
|
setArc(() => arc2);
|
|
34612
34737
|
});
|
|
@@ -34617,7 +34742,7 @@ function D3Gauge({
|
|
|
34617
34742
|
setSelect(() => select2);
|
|
34618
34743
|
});
|
|
34619
34744
|
}, []);
|
|
34620
|
-
|
|
34745
|
+
useEffect14(() => {
|
|
34621
34746
|
if (!containerRef.current || !select) return;
|
|
34622
34747
|
const container = containerRef.current;
|
|
34623
34748
|
select(container).select("svg").remove();
|
|
@@ -34634,7 +34759,7 @@ function D3Gauge({
|
|
|
34634
34759
|
svgRef.current = null;
|
|
34635
34760
|
};
|
|
34636
34761
|
}, [colors, select]);
|
|
34637
|
-
|
|
34762
|
+
useEffect14(() => {
|
|
34638
34763
|
if (!containerRef.current || !svgRef.current || !gaugeGroupRef.current || !needleRef.current || !needleOutlineRef.current || !textRef.current || !arc || !interpolate || !select)
|
|
34639
34764
|
return;
|
|
34640
34765
|
const rect = containerRef.current.getBoundingClientRect();
|
|
@@ -34734,7 +34859,7 @@ function D3Gauge({
|
|
|
34734
34859
|
arc,
|
|
34735
34860
|
interpolate
|
|
34736
34861
|
]);
|
|
34737
|
-
|
|
34862
|
+
useEffect14(() => {
|
|
34738
34863
|
if (!containerRef.current) return;
|
|
34739
34864
|
const observer = new ResizeObserver(() => {
|
|
34740
34865
|
previousPercentageRef.current = percentage;
|
|
@@ -34753,7 +34878,7 @@ function D3Gauge({
|
|
|
34753
34878
|
|
|
34754
34879
|
// src/components/QuillComponentTables.tsx
|
|
34755
34880
|
init_paginationProcessing();
|
|
34756
|
-
import { useState as
|
|
34881
|
+
import { useState as useState17, useEffect as useEffect15, useContext as useContext15 } from "react";
|
|
34757
34882
|
import { jsx as jsx47, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
34758
34883
|
var QuillTableSQLEditorComponent = ({
|
|
34759
34884
|
rows,
|
|
@@ -34769,8 +34894,8 @@ var QuillTableSQLEditorComponent = ({
|
|
|
34769
34894
|
setCurrentPage,
|
|
34770
34895
|
hideLabels
|
|
34771
34896
|
}) => {
|
|
34772
|
-
const [sort, setSort] =
|
|
34773
|
-
const [page, setPage] =
|
|
34897
|
+
const [sort, setSort] = useState17({ field: "", direction: "" });
|
|
34898
|
+
const [page, setPage] = useState17(0);
|
|
34774
34899
|
return /* @__PURE__ */ jsx47(
|
|
34775
34900
|
QuillTable,
|
|
34776
34901
|
{
|
|
@@ -34812,9 +34937,9 @@ var QuillTableReportBuilderComponent = ({
|
|
|
34812
34937
|
setCurrentPage,
|
|
34813
34938
|
disableSort
|
|
34814
34939
|
}) => {
|
|
34815
|
-
const [sort, setSort] =
|
|
34816
|
-
const [page, setPage] =
|
|
34817
|
-
|
|
34940
|
+
const [sort, setSort] = useState17({ field: "", direction: "" });
|
|
34941
|
+
const [page, setPage] = useState17(0);
|
|
34942
|
+
useEffect15(() => {
|
|
34818
34943
|
if (disableSort) {
|
|
34819
34944
|
setSort({ field: "", direction: "" });
|
|
34820
34945
|
}
|
|
@@ -34858,15 +34983,15 @@ var QuillTableComponent = ({
|
|
|
34858
34983
|
currentPage,
|
|
34859
34984
|
hideLabels
|
|
34860
34985
|
}) => {
|
|
34861
|
-
const [sort, setSort] =
|
|
34862
|
-
const [page, setPage] =
|
|
34863
|
-
const [initialLoad, setInitialLoad] =
|
|
34864
|
-
|
|
34986
|
+
const [sort, setSort] = useState17({ field: "", direction: "" });
|
|
34987
|
+
const [page, setPage] = useState17(0);
|
|
34988
|
+
const [initialLoad, setInitialLoad] = useState17(true);
|
|
34989
|
+
useEffect15(() => {
|
|
34865
34990
|
if (initialLoad && !isLoading) {
|
|
34866
34991
|
setInitialLoad(false);
|
|
34867
34992
|
}
|
|
34868
34993
|
}, [isLoading]);
|
|
34869
|
-
|
|
34994
|
+
useEffect15(() => {
|
|
34870
34995
|
setPage(currentPage || 0);
|
|
34871
34996
|
}, [currentPage]);
|
|
34872
34997
|
if (initialLoad) {
|
|
@@ -34920,15 +35045,15 @@ function QuillTableDashboardComponent({
|
|
|
34920
35045
|
hideName
|
|
34921
35046
|
}) {
|
|
34922
35047
|
const [theme] = useContext15(ThemeContext);
|
|
34923
|
-
const [initialLoad, setInitialLoad] =
|
|
35048
|
+
const [initialLoad, setInitialLoad] = useState17(true);
|
|
34924
35049
|
const { downloadCSV: downloadCSV2 } = useExport(report?.id);
|
|
34925
|
-
const [page, setPage] =
|
|
34926
|
-
|
|
35050
|
+
const [page, setPage] = useState17(0);
|
|
35051
|
+
useEffect15(() => {
|
|
34927
35052
|
if (!isLoading) {
|
|
34928
35053
|
setInitialLoad(false);
|
|
34929
35054
|
}
|
|
34930
35055
|
}, [isLoading]);
|
|
34931
|
-
|
|
35056
|
+
useEffect15(() => {
|
|
34932
35057
|
if (rowCountIsLoading) {
|
|
34933
35058
|
setPage(0);
|
|
34934
35059
|
}
|
|
@@ -35102,12 +35227,12 @@ function Chart({
|
|
|
35102
35227
|
filters,
|
|
35103
35228
|
dashboardCustomFilters[allReportsById[reportId]?.dashboardName ?? ""]
|
|
35104
35229
|
]);
|
|
35105
|
-
const previousFilters =
|
|
35230
|
+
const previousFilters = useRef12(void 0);
|
|
35106
35231
|
if (!equal3(previousFilters.current, filters)) {
|
|
35107
35232
|
previousFilters.current = filters;
|
|
35108
35233
|
}
|
|
35109
|
-
const [filterValues, setFilterValues] =
|
|
35110
|
-
|
|
35234
|
+
const [filterValues, setFilterValues] = useState18({});
|
|
35235
|
+
useEffect16(() => {
|
|
35111
35236
|
setFilterValues(
|
|
35112
35237
|
Object.values(reportFilters[reportId] ?? {}).reduce((acc, f) => {
|
|
35113
35238
|
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 +35247,7 @@ function Chart({
|
|
|
35122
35247
|
}, {})
|
|
35123
35248
|
);
|
|
35124
35249
|
}, [reportFilters[reportId]]);
|
|
35125
|
-
|
|
35250
|
+
useEffect16(() => {
|
|
35126
35251
|
if (equal3(customReportFilters[reportId] ?? [], filters ?? [])) {
|
|
35127
35252
|
return;
|
|
35128
35253
|
}
|
|
@@ -35138,7 +35263,7 @@ function Chart({
|
|
|
35138
35263
|
});
|
|
35139
35264
|
};
|
|
35140
35265
|
}, [filters]);
|
|
35141
|
-
|
|
35266
|
+
useEffect16(() => {
|
|
35142
35267
|
if (reportDateFilter) {
|
|
35143
35268
|
const customDateFilter = previousFilters.current?.find(
|
|
35144
35269
|
(f) => f.filterType === "date" /* Date */
|
|
@@ -35176,7 +35301,7 @@ function Chart({
|
|
|
35176
35301
|
[reportId, allReportsById]
|
|
35177
35302
|
);
|
|
35178
35303
|
const report = useMemo13(() => reports[reportId], [reports, reportId]);
|
|
35179
|
-
const [loading, setLoading] =
|
|
35304
|
+
const [loading, setLoading] = useState18(true);
|
|
35180
35305
|
const [theme] = useContext16(ThemeContext);
|
|
35181
35306
|
const colorMap = useMemo13(() => {
|
|
35182
35307
|
if (mapColorsToFields && report && theme) {
|
|
@@ -35184,7 +35309,7 @@ function Chart({
|
|
|
35184
35309
|
}
|
|
35185
35310
|
}, [report, theme]);
|
|
35186
35311
|
const [client, clientLoading] = useContext16(ClientContext);
|
|
35187
|
-
const [error, setError] =
|
|
35312
|
+
const [error, setError] = useState18(void 0);
|
|
35188
35313
|
const updateFilter = (filter, value, comparison) => {
|
|
35189
35314
|
let filterValue = {};
|
|
35190
35315
|
if (filter.filterType === "string" /* String */) {
|
|
@@ -35294,7 +35419,7 @@ function Chart({
|
|
|
35294
35419
|
setLoading(false);
|
|
35295
35420
|
}
|
|
35296
35421
|
};
|
|
35297
|
-
|
|
35422
|
+
useEffect16(() => {
|
|
35298
35423
|
if (reportId === void 0 || reportId === "" || clientLoading || isDashboardsLoading) {
|
|
35299
35424
|
return;
|
|
35300
35425
|
}
|
|
@@ -35511,7 +35636,7 @@ var ChartDisplay = ({
|
|
|
35511
35636
|
}
|
|
35512
35637
|
return void 0;
|
|
35513
35638
|
}, [config, specificReportFilters, specificDashboardFilters]);
|
|
35514
|
-
const [page, setPage] =
|
|
35639
|
+
const [page, setPage] = useState18(0);
|
|
35515
35640
|
if (loading) {
|
|
35516
35641
|
return /* @__PURE__ */ jsx48("div", { className, style: containerStyle, children: /* @__PURE__ */ jsx48(LoadingComponent, {}) });
|
|
35517
35642
|
} else if (config && !["metric", "table", "gauge", "US map", "World map"].includes(
|
|
@@ -35955,7 +36080,7 @@ function QuillChartComponent({
|
|
|
35955
36080
|
}
|
|
35956
36081
|
|
|
35957
36082
|
// src/components/Dashboard/TemplateChartComponent.tsx
|
|
35958
|
-
import { useState as
|
|
36083
|
+
import { useState as useState19 } from "react";
|
|
35959
36084
|
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
35960
36085
|
function QuillTemplateChartComponent({
|
|
35961
36086
|
report,
|
|
@@ -35963,7 +36088,7 @@ function QuillTemplateChartComponent({
|
|
|
35963
36088
|
children,
|
|
35964
36089
|
isLoading
|
|
35965
36090
|
}) {
|
|
35966
|
-
const [isSelected, setIsSelected] =
|
|
36091
|
+
const [isSelected, setIsSelected] = useState19(false);
|
|
35967
36092
|
return /* @__PURE__ */ jsx51(
|
|
35968
36093
|
"div",
|
|
35969
36094
|
{
|
|
@@ -36050,10 +36175,10 @@ init_filterProcessing();
|
|
|
36050
36175
|
import {
|
|
36051
36176
|
forwardRef as forwardRef2,
|
|
36052
36177
|
useContext as useContext19,
|
|
36053
|
-
useEffect as
|
|
36178
|
+
useEffect as useEffect17,
|
|
36054
36179
|
useMemo as useMemo14,
|
|
36055
|
-
useRef as
|
|
36056
|
-
useState as
|
|
36180
|
+
useRef as useRef13,
|
|
36181
|
+
useState as useState20
|
|
36057
36182
|
} from "react";
|
|
36058
36183
|
init_util();
|
|
36059
36184
|
init_tableProcessing();
|
|
@@ -36548,10 +36673,10 @@ var FilterPopoverWrapper = ({
|
|
|
36548
36673
|
}) => {
|
|
36549
36674
|
const { tenants } = useContext19(TenantContext);
|
|
36550
36675
|
const { eventTracking } = useContext19(EventTrackingContext);
|
|
36551
|
-
const [isOpen, setIsOpen] =
|
|
36552
|
-
const [uniqueValues, setUniqueValues] =
|
|
36553
|
-
const [uniqueValuesIsLoading, setUniqueValuesIsLoading] =
|
|
36554
|
-
const prevFiltersRef =
|
|
36676
|
+
const [isOpen, setIsOpen] = useState20(false);
|
|
36677
|
+
const [uniqueValues, setUniqueValues] = useState20(void 0);
|
|
36678
|
+
const [uniqueValuesIsLoading, setUniqueValuesIsLoading] = useState20(false);
|
|
36679
|
+
const prevFiltersRef = useRef13("");
|
|
36555
36680
|
const columnInternals = useMemo14(() => {
|
|
36556
36681
|
if (!tables) {
|
|
36557
36682
|
return null;
|
|
@@ -36566,7 +36691,7 @@ var FilterPopoverWrapper = ({
|
|
|
36566
36691
|
});
|
|
36567
36692
|
return relevantColumns;
|
|
36568
36693
|
}, [schema, tables]);
|
|
36569
|
-
|
|
36694
|
+
useEffect17(() => {
|
|
36570
36695
|
const currentFiltersString = JSON.stringify(priorFilters);
|
|
36571
36696
|
if (currentFiltersString !== prevFiltersRef.current) {
|
|
36572
36697
|
prevFiltersRef.current = currentFiltersString;
|
|
@@ -36636,7 +36761,7 @@ var FilterPopoverWrapper = ({
|
|
|
36636
36761
|
|
|
36637
36762
|
// src/components/ReportBuilder/FilterModal.tsx
|
|
36638
36763
|
init_Filter();
|
|
36639
|
-
import { useState as
|
|
36764
|
+
import { useState as useState21, useEffect as useEffect18, useMemo as useMemo15 } from "react";
|
|
36640
36765
|
init_textProcessing();
|
|
36641
36766
|
init_filterProcessing();
|
|
36642
36767
|
import { format as format8, isValid as isValid5, parse as parse4, startOfToday as startOfToday2 } from "date-fns";
|
|
@@ -36658,32 +36783,32 @@ function FilterModal({
|
|
|
36658
36783
|
MultiSelectComponent,
|
|
36659
36784
|
reportBuilderColumns
|
|
36660
36785
|
}) {
|
|
36661
|
-
const [field, setField] =
|
|
36662
|
-
const [fieldOptions, setFieldOptions] =
|
|
36663
|
-
const [fieldValues, setFieldValues] =
|
|
36664
|
-
const [type, setType] =
|
|
36665
|
-
const [value, setValue] =
|
|
36666
|
-
const [selectedOptions, setSelectedOptions] =
|
|
36667
|
-
const [operator, setOperator] =
|
|
36786
|
+
const [field, setField] = useState21("");
|
|
36787
|
+
const [fieldOptions, setFieldOptions] = useState21([]);
|
|
36788
|
+
const [fieldValues, setFieldValues] = useState21([]);
|
|
36789
|
+
const [type, setType] = useState21(null);
|
|
36790
|
+
const [value, setValue] = useState21(void 0);
|
|
36791
|
+
const [selectedOptions, setSelectedOptions] = useState21([]);
|
|
36792
|
+
const [operator, setOperator] = useState21(
|
|
36668
36793
|
void 0
|
|
36669
36794
|
);
|
|
36670
|
-
const [operatorOptions, setOperatorOptions] =
|
|
36671
|
-
const [unit, setUnit] =
|
|
36672
|
-
const [unitOptions, setUnitOptions] =
|
|
36673
|
-
const [startDate, setStartDate] =
|
|
36795
|
+
const [operatorOptions, setOperatorOptions] = useState21([]);
|
|
36796
|
+
const [unit, setUnit] = useState21("");
|
|
36797
|
+
const [unitOptions, setUnitOptions] = useState21([]);
|
|
36798
|
+
const [startDate, setStartDate] = useState21(
|
|
36674
36799
|
startOfToday2().toISOString().substring(0, 10)
|
|
36675
36800
|
);
|
|
36676
|
-
const [endDate, setEndDate] =
|
|
36801
|
+
const [endDate, setEndDate] = useState21(
|
|
36677
36802
|
startOfToday2().toISOString().substring(0, 10)
|
|
36678
36803
|
);
|
|
36679
|
-
const [filterInitialized, setFilterInitialized] =
|
|
36680
|
-
const [table, setTable] =
|
|
36804
|
+
const [filterInitialized, setFilterInitialized] = useState21(false);
|
|
36805
|
+
const [table, setTable] = useState21(void 0);
|
|
36681
36806
|
const memoizedFieldValuesMap = useMemo15(
|
|
36682
36807
|
() => fieldValuesMap,
|
|
36683
36808
|
[JSON.stringify(fieldValuesMap)]
|
|
36684
36809
|
);
|
|
36685
36810
|
const memoizedFilter = useMemo15(() => filter, [JSON.stringify(filter)]);
|
|
36686
|
-
|
|
36811
|
+
useEffect18(() => {
|
|
36687
36812
|
if (!filter) {
|
|
36688
36813
|
onFieldChange(field, fieldOptions, table);
|
|
36689
36814
|
}
|
|
@@ -36728,7 +36853,7 @@ function FilterModal({
|
|
|
36728
36853
|
],
|
|
36729
36854
|
[FieldType.Null]: [NullOperator.IsNotNull, NullOperator.IsNull]
|
|
36730
36855
|
};
|
|
36731
|
-
|
|
36856
|
+
useEffect18(() => {
|
|
36732
36857
|
if (filter) {
|
|
36733
36858
|
setField(filter.field);
|
|
36734
36859
|
setTable(filter.table);
|
|
@@ -36756,7 +36881,7 @@ function FilterModal({
|
|
|
36756
36881
|
}
|
|
36757
36882
|
}
|
|
36758
36883
|
}, [memoizedFilter]);
|
|
36759
|
-
|
|
36884
|
+
useEffect18(() => {
|
|
36760
36885
|
if (schema) {
|
|
36761
36886
|
const fo = schema.flatMap((table2) => {
|
|
36762
36887
|
if (tables && !tables.includes(table2.name)) {
|
|
@@ -37438,7 +37563,7 @@ function FilterModal({
|
|
|
37438
37563
|
}
|
|
37439
37564
|
|
|
37440
37565
|
// src/components/Dashboard/TemplateMetricComponent.tsx
|
|
37441
|
-
import { useState as
|
|
37566
|
+
import { useState as useState22 } from "react";
|
|
37442
37567
|
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
37443
37568
|
function QuillTemplateMetricComponent({
|
|
37444
37569
|
report,
|
|
@@ -37446,7 +37571,7 @@ function QuillTemplateMetricComponent({
|
|
|
37446
37571
|
children,
|
|
37447
37572
|
isLoading
|
|
37448
37573
|
}) {
|
|
37449
|
-
const [isSelected, setIsSelected] =
|
|
37574
|
+
const [isSelected, setIsSelected] = useState22(false);
|
|
37450
37575
|
return /* @__PURE__ */ jsx55(
|
|
37451
37576
|
"div",
|
|
37452
37577
|
{
|
|
@@ -37475,7 +37600,7 @@ function QuillTemplateMetricComponent({
|
|
|
37475
37600
|
}
|
|
37476
37601
|
|
|
37477
37602
|
// src/components/Dashboard/TemplateTableComponent.tsx
|
|
37478
|
-
import { useState as
|
|
37603
|
+
import { useState as useState23 } from "react";
|
|
37479
37604
|
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
37480
37605
|
function QuillTemplateTableComponent({
|
|
37481
37606
|
report,
|
|
@@ -37486,7 +37611,7 @@ function QuillTemplateTableComponent({
|
|
|
37486
37611
|
onPageChange,
|
|
37487
37612
|
onSortChange
|
|
37488
37613
|
}) {
|
|
37489
|
-
const [isSelected, setIsSelected] =
|
|
37614
|
+
const [isSelected, setIsSelected] = useState23(false);
|
|
37490
37615
|
return /* @__PURE__ */ jsx56(
|
|
37491
37616
|
"div",
|
|
37492
37617
|
{
|
|
@@ -37701,14 +37826,14 @@ function Dashboard({
|
|
|
37701
37826
|
templateDashboardName,
|
|
37702
37827
|
pagination = { rowsPerPage: 10, rowsPerRequest: 50 }
|
|
37703
37828
|
}) {
|
|
37704
|
-
const [userFilters, setUserFilters] =
|
|
37705
|
-
const [selectedSection, setSelectedSection] =
|
|
37829
|
+
const [userFilters, setUserFilters] = useState24({});
|
|
37830
|
+
const [selectedSection, setSelectedSection] = useState24("");
|
|
37706
37831
|
const dataLoaderUserFilters = useMemo16(() => {
|
|
37707
37832
|
return (filters?.map((f) => convertCustomFilter(f)) ?? []).concat(
|
|
37708
37833
|
Object.values(userFilters)
|
|
37709
37834
|
);
|
|
37710
37835
|
}, [filters, userFilters]);
|
|
37711
|
-
|
|
37836
|
+
useEffect19(() => {
|
|
37712
37837
|
onUserFiltersUpdated?.(Object.values(userFilters));
|
|
37713
37838
|
}, [userFilters]);
|
|
37714
37839
|
const {
|
|
@@ -37806,8 +37931,8 @@ function Dashboard({
|
|
|
37806
37931
|
});
|
|
37807
37932
|
return map;
|
|
37808
37933
|
}, [data?.sections, data?.sectionOrder]);
|
|
37809
|
-
const mounted =
|
|
37810
|
-
|
|
37934
|
+
const mounted = useRef14(false);
|
|
37935
|
+
useEffect19(() => {
|
|
37811
37936
|
if (!mounted.current) {
|
|
37812
37937
|
mounted.current = true;
|
|
37813
37938
|
return;
|
|
@@ -37819,7 +37944,7 @@ function Dashboard({
|
|
|
37819
37944
|
filters: populatedDashboardFilters ?? []
|
|
37820
37945
|
});
|
|
37821
37946
|
}, [filters, userFilters]);
|
|
37822
|
-
|
|
37947
|
+
useEffect19(() => {
|
|
37823
37948
|
customFilterDispatch({
|
|
37824
37949
|
type: "ADD_CUSTOM_DASHBOARD_FILTERS",
|
|
37825
37950
|
dashboardName: name2,
|
|
@@ -37833,31 +37958,31 @@ function Dashboard({
|
|
|
37833
37958
|
const { dispatch: dashboardFiltersDispatch } = useContext20(
|
|
37834
37959
|
DashboardFiltersContext
|
|
37835
37960
|
);
|
|
37836
|
-
const [fieldValuesMap, setFieldValuesMap] =
|
|
37837
|
-
const [fieldValuesIsLoaded, setFieldValuesIsLoaded] =
|
|
37838
|
-
const [addFilterPopoverIsOpen, setAddFilterPopoverIsOpen] =
|
|
37839
|
-
const [filterListIsOpen, setFilterListIsOpen] =
|
|
37961
|
+
const [fieldValuesMap, setFieldValuesMap] = useState24({});
|
|
37962
|
+
const [fieldValuesIsLoaded, setFieldValuesIsLoaded] = useState24(false);
|
|
37963
|
+
const [addFilterPopoverIsOpen, setAddFilterPopoverIsOpen] = useState24(false);
|
|
37964
|
+
const [filterListIsOpen, setFilterListIsOpen] = useState24(false);
|
|
37840
37965
|
const [
|
|
37841
37966
|
filterListAddFilterPopoverIsOpen,
|
|
37842
37967
|
setFilterListAddFilterPopoverIsOpen
|
|
37843
|
-
] =
|
|
37968
|
+
] = useState24(false);
|
|
37844
37969
|
const presetOptions = useMemo16(() => {
|
|
37845
37970
|
return populatedDashboardFilters?.[0]?.filterType === "date_range" ? convertPresetOptionsToSelectableList(
|
|
37846
37971
|
populatedDashboardFilters[0].presetOptions ?? [],
|
|
37847
37972
|
populatedDashboardFilters[0].defaultPresetRanges ?? []
|
|
37848
37973
|
) : defaultOptionsV2;
|
|
37849
37974
|
}, [populatedDashboardFilters]);
|
|
37850
|
-
const [filterValues, setFilterValues] =
|
|
37851
|
-
const prevNameRef =
|
|
37852
|
-
const prevFlagsRef =
|
|
37853
|
-
const prevClientRef =
|
|
37854
|
-
const addFilterPopoverButtonRef =
|
|
37855
|
-
const viewFiltersPopoverButtonRef =
|
|
37856
|
-
const previousFilters =
|
|
37975
|
+
const [filterValues, setFilterValues] = useState24({});
|
|
37976
|
+
const prevNameRef = useRef14(name2);
|
|
37977
|
+
const prevFlagsRef = useRef14(flags);
|
|
37978
|
+
const prevClientRef = useRef14(client?.publicKey ?? "");
|
|
37979
|
+
const addFilterPopoverButtonRef = useRef14(null);
|
|
37980
|
+
const viewFiltersPopoverButtonRef = useRef14(null);
|
|
37981
|
+
const previousFilters = useRef14(filters);
|
|
37857
37982
|
if (!equal4(previousFilters.current, filters)) {
|
|
37858
37983
|
previousFilters.current = filters;
|
|
37859
37984
|
}
|
|
37860
|
-
const isInitialLoadOfDashboardRef =
|
|
37985
|
+
const isInitialLoadOfDashboardRef = useRef14(false);
|
|
37861
37986
|
const referencedTables = useMemo16(() => {
|
|
37862
37987
|
const sections = data?.sections || {};
|
|
37863
37988
|
const tables2 = Object.values(sections).flatMap(
|
|
@@ -37865,7 +37990,7 @@ function Dashboard({
|
|
|
37865
37990
|
).flat();
|
|
37866
37991
|
return Array.from(new Set(tables2));
|
|
37867
37992
|
}, [data?.sections]);
|
|
37868
|
-
|
|
37993
|
+
useEffect19(() => {
|
|
37869
37994
|
if (prevNameRef.current === name2 && Object.values(data?.sections ?? {}).flat().length) {
|
|
37870
37995
|
return;
|
|
37871
37996
|
}
|
|
@@ -37885,8 +38010,8 @@ function Dashboard({
|
|
|
37885
38010
|
prevFlagsRef.current = flags;
|
|
37886
38011
|
});
|
|
37887
38012
|
}, [name2, isClientLoading]);
|
|
37888
|
-
const tenantMounted =
|
|
37889
|
-
|
|
38013
|
+
const tenantMounted = useRef14(false);
|
|
38014
|
+
useEffect19(() => {
|
|
37890
38015
|
if (!tenantMounted.current) {
|
|
37891
38016
|
tenantMounted.current = true;
|
|
37892
38017
|
return;
|
|
@@ -37905,7 +38030,7 @@ function Dashboard({
|
|
|
37905
38030
|
isInitialLoadOfDashboardRef.current = false;
|
|
37906
38031
|
});
|
|
37907
38032
|
}, [flags]);
|
|
37908
|
-
|
|
38033
|
+
useEffect19(() => {
|
|
37909
38034
|
if (prevClientRef.current === client?.publicKey) {
|
|
37910
38035
|
return;
|
|
37911
38036
|
}
|
|
@@ -37920,7 +38045,7 @@ function Dashboard({
|
|
|
37920
38045
|
isInitialLoadOfDashboardRef.current = false;
|
|
37921
38046
|
});
|
|
37922
38047
|
}, [client?.publicKey]);
|
|
37923
|
-
|
|
38048
|
+
useEffect19(() => {
|
|
37924
38049
|
setFilterValues(
|
|
37925
38050
|
Object.values(populatedDashboardFilters ?? {}).reduce((acc, f) => {
|
|
37926
38051
|
acc[f.label] = f.filterType === "string" ? f.stringFilterType === "multiselect" ? { values: f.values, operator: "IN" } : { selectedValue: f.selectedValue } : f.filterType === "date_range" ? {
|
|
@@ -37935,7 +38060,7 @@ function Dashboard({
|
|
|
37935
38060
|
}, {})
|
|
37936
38061
|
);
|
|
37937
38062
|
}, [populatedDashboardFilters]);
|
|
37938
|
-
|
|
38063
|
+
useEffect19(() => {
|
|
37939
38064
|
const dashboardDateFilter = populatedDashboardFilters?.find(
|
|
37940
38065
|
(f) => f.filterType === "date_range"
|
|
37941
38066
|
);
|
|
@@ -37972,7 +38097,7 @@ function Dashboard({
|
|
|
37972
38097
|
});
|
|
37973
38098
|
}
|
|
37974
38099
|
}, [previousFilters.current]);
|
|
37975
|
-
|
|
38100
|
+
useEffect19(() => {
|
|
37976
38101
|
const fetchData = async () => {
|
|
37977
38102
|
setFieldValuesIsLoaded(false);
|
|
37978
38103
|
const newFieldValues = {};
|
|
@@ -38133,7 +38258,7 @@ function Dashboard({
|
|
|
38133
38258
|
[filter.field]: filter
|
|
38134
38259
|
}));
|
|
38135
38260
|
};
|
|
38136
|
-
|
|
38261
|
+
useEffect19(() => {
|
|
38137
38262
|
if (onChangeLoading && isLoading) {
|
|
38138
38263
|
onChangeLoading(isLoading);
|
|
38139
38264
|
}
|
|
@@ -38778,10 +38903,10 @@ function QuillDashboardTemplate({
|
|
|
38778
38903
|
const { dashboardConfig, dashboardConfigDispatch } = useContext20(
|
|
38779
38904
|
DashboardConfigContext
|
|
38780
38905
|
);
|
|
38781
|
-
const [addItemModalIsOpen, setAddItemModalIsOpen] =
|
|
38782
|
-
const [selectedTemplates, setSelectedTemplates] =
|
|
38783
|
-
const [selectingTemplate, setSelectingTemplate] =
|
|
38784
|
-
const [submittingTemplate, setSubmittingTemplate] =
|
|
38906
|
+
const [addItemModalIsOpen, setAddItemModalIsOpen] = useState24(false);
|
|
38907
|
+
const [selectedTemplates, setSelectedTemplates] = useState24([]);
|
|
38908
|
+
const [selectingTemplate, setSelectingTemplate] = useState24(false);
|
|
38909
|
+
const [submittingTemplate, setSubmittingTemplate] = useState24(false);
|
|
38785
38910
|
const templateSections = data?.sections;
|
|
38786
38911
|
const onSubmitTemplates = async () => {
|
|
38787
38912
|
setSubmittingTemplate(true);
|
|
@@ -38926,9 +39051,9 @@ var QuillProvider_default = QuillProvider;
|
|
|
38926
39051
|
// src/Table.tsx
|
|
38927
39052
|
import {
|
|
38928
39053
|
useContext as useContext21,
|
|
38929
|
-
useEffect as
|
|
39054
|
+
useEffect as useEffect20,
|
|
38930
39055
|
useMemo as useMemo17,
|
|
38931
|
-
useState as
|
|
39056
|
+
useState as useState25
|
|
38932
39057
|
} from "react";
|
|
38933
39058
|
init_Filter();
|
|
38934
39059
|
init_paginationProcessing();
|
|
@@ -38946,7 +39071,7 @@ var Table = ({
|
|
|
38946
39071
|
const [schemaData] = useContext21(SchemaDataContext);
|
|
38947
39072
|
const { eventTracking } = useContext21(EventTrackingContext);
|
|
38948
39073
|
const { allReportsById } = useAllReports();
|
|
38949
|
-
const [loading, setLoading] =
|
|
39074
|
+
const [loading, setLoading] = useState25(false);
|
|
38950
39075
|
const report = useMemo17(() => {
|
|
38951
39076
|
return props.reportId ? allReportsById[props.reportId] : null;
|
|
38952
39077
|
}, [allReportsById[props.reportId ?? ""]]);
|
|
@@ -38999,7 +39124,7 @@ var Table = ({
|
|
|
38999
39124
|
setLoading(false);
|
|
39000
39125
|
}
|
|
39001
39126
|
};
|
|
39002
|
-
|
|
39127
|
+
useEffect20(() => {
|
|
39003
39128
|
if (props.reportId === void 0 || props.reportId === "" || clientLoading) {
|
|
39004
39129
|
return;
|
|
39005
39130
|
}
|
|
@@ -39033,7 +39158,7 @@ var Table = ({
|
|
|
39033
39158
|
clientLoading,
|
|
39034
39159
|
!reports[props.reportId ?? ""]
|
|
39035
39160
|
]);
|
|
39036
|
-
const [page, setPage] =
|
|
39161
|
+
const [page, setPage] = useState25(0);
|
|
39037
39162
|
if ("rows" in data && "columns" in data) {
|
|
39038
39163
|
return /* @__PURE__ */ jsx59(
|
|
39039
39164
|
QuillTable,
|
|
@@ -39094,10 +39219,10 @@ var Table_default = Table;
|
|
|
39094
39219
|
|
|
39095
39220
|
// src/SQLEditor.tsx
|
|
39096
39221
|
import {
|
|
39097
|
-
useState as
|
|
39222
|
+
useState as useState31,
|
|
39098
39223
|
useContext as useContext28,
|
|
39099
|
-
useEffect as
|
|
39100
|
-
useRef as
|
|
39224
|
+
useEffect as useEffect25,
|
|
39225
|
+
useRef as useRef19,
|
|
39101
39226
|
useMemo as useMemo22,
|
|
39102
39227
|
useCallback as useCallback3
|
|
39103
39228
|
} from "react";
|
|
@@ -39105,9 +39230,9 @@ import MonacoEditor from "@monaco-editor/react";
|
|
|
39105
39230
|
|
|
39106
39231
|
// src/ChartBuilder.tsx
|
|
39107
39232
|
import {
|
|
39108
|
-
useEffect as
|
|
39109
|
-
useRef as
|
|
39110
|
-
useState as
|
|
39233
|
+
useEffect as useEffect23,
|
|
39234
|
+
useRef as useRef18,
|
|
39235
|
+
useState as useState29,
|
|
39111
39236
|
useContext as useContext26,
|
|
39112
39237
|
useMemo as useMemo21
|
|
39113
39238
|
} from "react";
|
|
@@ -39133,9 +39258,9 @@ import {
|
|
|
39133
39258
|
useCallback as useCallback2,
|
|
39134
39259
|
useContext as useContext23,
|
|
39135
39260
|
useMemo as useMemo18,
|
|
39136
|
-
useState as
|
|
39137
|
-
useEffect as
|
|
39138
|
-
useRef as
|
|
39261
|
+
useState as useState26,
|
|
39262
|
+
useEffect as useEffect21,
|
|
39263
|
+
useRef as useRef15
|
|
39139
39264
|
} from "react";
|
|
39140
39265
|
|
|
39141
39266
|
// src/internals/ReportBuilder/PivotList.tsx
|
|
@@ -39599,44 +39724,44 @@ var PivotModal = ({
|
|
|
39599
39724
|
reportBuilderState
|
|
39600
39725
|
}) => {
|
|
39601
39726
|
const { getToken, quillFetchWithToken } = useContext23(FetchContext);
|
|
39602
|
-
const [isLoading, setIsLoading] =
|
|
39603
|
-
const [previewLoading, setPreviewLoading] =
|
|
39604
|
-
const [selectedPivotType, setSelectedPivotType] =
|
|
39605
|
-
const [errors, setErrors] =
|
|
39727
|
+
const [isLoading, setIsLoading] = useState26(false);
|
|
39728
|
+
const [previewLoading, setPreviewLoading] = useState26(false);
|
|
39729
|
+
const [selectedPivotType, setSelectedPivotType] = useState26("recommended");
|
|
39730
|
+
const [errors, setErrors] = useState26([]);
|
|
39606
39731
|
const [client] = useContext23(ClientContext);
|
|
39607
39732
|
const [schemaData] = useContext23(SchemaDataContext);
|
|
39608
39733
|
const { tenants } = useContext23(TenantContext);
|
|
39609
39734
|
const { eventTracking } = useContext23(EventTrackingContext);
|
|
39610
|
-
const rowFieldRef =
|
|
39611
|
-
const colFieldRef =
|
|
39612
|
-
const [pivotCardWidth, setPivotCardWidth] =
|
|
39613
|
-
const [samplePivotTable, setSamplePivotTable] =
|
|
39614
|
-
const [hasNoRecommendedPivots, sethasNoRecommendedPivots] =
|
|
39615
|
-
const [isFetchingPivots, setIsFetchingPivots] =
|
|
39616
|
-
const [allowedColumnFields, setAllowedColumnFields] =
|
|
39617
|
-
const [allowedRowFields, setAllowedRowFields] =
|
|
39618
|
-
const [allowedValueFields, setAllowedValueFields] =
|
|
39619
|
-
const [uniqueValues, setUniqueValues] =
|
|
39620
|
-
const buttonRef =
|
|
39621
|
-
const [dateRanges, setDateRanges] =
|
|
39622
|
-
const [pivotError, setPivotError] =
|
|
39623
|
-
const [limitInput, setLimitInput] =
|
|
39735
|
+
const rowFieldRef = useRef15(null);
|
|
39736
|
+
const colFieldRef = useRef15(null);
|
|
39737
|
+
const [pivotCardWidth, setPivotCardWidth] = useState26(420);
|
|
39738
|
+
const [samplePivotTable, setSamplePivotTable] = useState26(null);
|
|
39739
|
+
const [hasNoRecommendedPivots, sethasNoRecommendedPivots] = useState26(false);
|
|
39740
|
+
const [isFetchingPivots, setIsFetchingPivots] = useState26(false);
|
|
39741
|
+
const [allowedColumnFields, setAllowedColumnFields] = useState26([]);
|
|
39742
|
+
const [allowedRowFields, setAllowedRowFields] = useState26([]);
|
|
39743
|
+
const [allowedValueFields, setAllowedValueFields] = useState26([]);
|
|
39744
|
+
const [uniqueValues, setUniqueValues] = useState26(initialUniqueValues);
|
|
39745
|
+
const buttonRef = useRef15(null);
|
|
39746
|
+
const [dateRanges, setDateRanges] = useState26({});
|
|
39747
|
+
const [pivotError, setPivotError] = useState26("");
|
|
39748
|
+
const [limitInput, setLimitInput] = useState26(
|
|
39624
39749
|
pivotLimit?.toString() ?? "100"
|
|
39625
39750
|
);
|
|
39626
|
-
const [sortFieldInput, setSortFieldInput] =
|
|
39751
|
+
const [sortFieldInput, setSortFieldInput] = useState26(
|
|
39627
39752
|
pivotSort?.sortField ?? ""
|
|
39628
39753
|
);
|
|
39629
|
-
const [sortDirectionInput, setSortDirectionInput] =
|
|
39754
|
+
const [sortDirectionInput, setSortDirectionInput] = useState26(
|
|
39630
39755
|
pivotSort?.sortDirection ?? "ASC"
|
|
39631
39756
|
);
|
|
39632
|
-
const [showLimitInput, setShowLimitInput] =
|
|
39633
|
-
const [showSortInput, setShowSortInput] =
|
|
39634
|
-
const [availableHeight, setAvailableHeight] =
|
|
39635
|
-
const [pivotModalTopHeight, setPivotModalTopHeight] =
|
|
39636
|
-
const [popoverPosition, setPopoverPosition] =
|
|
39757
|
+
const [showLimitInput, setShowLimitInput] = useState26(!!pivotLimit);
|
|
39758
|
+
const [showSortInput, setShowSortInput] = useState26(!!pivotSort);
|
|
39759
|
+
const [availableHeight, setAvailableHeight] = useState26(0);
|
|
39760
|
+
const [pivotModalTopHeight, setPivotModalTopHeight] = useState26(450);
|
|
39761
|
+
const [popoverPosition, setPopoverPosition] = useState26(
|
|
39637
39762
|
"bottom"
|
|
39638
39763
|
);
|
|
39639
|
-
const popoverRef =
|
|
39764
|
+
const popoverRef = useRef15(null);
|
|
39640
39765
|
const getDistinctValues = async (fetchDistinct) => {
|
|
39641
39766
|
if (!client) {
|
|
39642
39767
|
return {
|
|
@@ -39723,7 +39848,7 @@ var PivotModal = ({
|
|
|
39723
39848
|
setDateRanges(dateRangeByColumn || {});
|
|
39724
39849
|
}
|
|
39725
39850
|
};
|
|
39726
|
-
|
|
39851
|
+
useEffect21(() => {
|
|
39727
39852
|
const calculatePivotCardSize = () => {
|
|
39728
39853
|
if (rowFieldRef.current && colFieldRef.current) {
|
|
39729
39854
|
const rowFieldSize = rowFieldRef.current?.getBoundingClientRect();
|
|
@@ -39744,7 +39869,7 @@ var PivotModal = ({
|
|
|
39744
39869
|
}, 500);
|
|
39745
39870
|
}
|
|
39746
39871
|
}, [showUpdatePivot, isOpen]);
|
|
39747
|
-
|
|
39872
|
+
useEffect21(() => {
|
|
39748
39873
|
const fetchPivotData = async () => {
|
|
39749
39874
|
if (pivotRowField && data && columns && pivotAggregations?.every((p) => p?.valueField && p?.aggregationType)) {
|
|
39750
39875
|
const pivot = {
|
|
@@ -39890,7 +40015,7 @@ var PivotModal = ({
|
|
|
39890
40015
|
};
|
|
39891
40016
|
fetchPivotData();
|
|
39892
40017
|
}, [initialSelectedPivotTable]);
|
|
39893
|
-
|
|
40018
|
+
useEffect21(() => {
|
|
39894
40019
|
if (pivotRowField && data && columns) {
|
|
39895
40020
|
getDistinctValues();
|
|
39896
40021
|
getAllDateRangesByColumn();
|
|
@@ -39898,7 +40023,7 @@ var PivotModal = ({
|
|
|
39898
40023
|
getDistinctValues();
|
|
39899
40024
|
}
|
|
39900
40025
|
}, [initialSelectedPivotTable, columns, data, pivotRowField]);
|
|
39901
|
-
|
|
40026
|
+
useEffect21(() => {
|
|
39902
40027
|
setAllowedFields(initialUniqueValues || {});
|
|
39903
40028
|
setUniqueValues(initialUniqueValues);
|
|
39904
40029
|
}, [initialUniqueValues, columns]);
|
|
@@ -39921,8 +40046,8 @@ var PivotModal = ({
|
|
|
39921
40046
|
return map;
|
|
39922
40047
|
}, {});
|
|
39923
40048
|
}, [columns]);
|
|
39924
|
-
const [selectedPivotTable, setSelectedPivotTable] =
|
|
39925
|
-
|
|
40049
|
+
const [selectedPivotTable, setSelectedPivotTable] = useState26(null);
|
|
40050
|
+
useEffect21(() => {
|
|
39926
40051
|
const fetchPivotTables = async () => {
|
|
39927
40052
|
if (selectedPivotIndex === -1) {
|
|
39928
40053
|
return null;
|
|
@@ -39974,8 +40099,8 @@ var PivotModal = ({
|
|
|
39974
40099
|
};
|
|
39975
40100
|
fetchPivotTables();
|
|
39976
40101
|
}, [selectedPivotIndex, data, dateRange, createdPivots]);
|
|
39977
|
-
const previousUniqueValuesRef =
|
|
39978
|
-
|
|
40102
|
+
const previousUniqueValuesRef = useRef15();
|
|
40103
|
+
useEffect21(() => {
|
|
39979
40104
|
if (!uniqueValuesIsLoading && !equal5(uniqueValues, previousUniqueValuesRef.current)) {
|
|
39980
40105
|
previousUniqueValuesRef.current = uniqueValues;
|
|
39981
40106
|
setRecommendedPivotTables([]);
|
|
@@ -40450,11 +40575,11 @@ var PivotModal = ({
|
|
|
40450
40575
|
}
|
|
40451
40576
|
}, 500);
|
|
40452
40577
|
};
|
|
40453
|
-
const [recommendedPivotTables, setRecommendedPivotTables] =
|
|
40578
|
+
const [recommendedPivotTables, setRecommendedPivotTables] = useState26(
|
|
40454
40579
|
[]
|
|
40455
40580
|
);
|
|
40456
|
-
const [createdPivotTables, setCreatedPivotTables] =
|
|
40457
|
-
|
|
40581
|
+
const [createdPivotTables, setCreatedPivotTables] = useState26([]);
|
|
40582
|
+
useEffect21(() => {
|
|
40458
40583
|
const fetchPivotTables = async () => {
|
|
40459
40584
|
const pts = await Promise.all(
|
|
40460
40585
|
createdPivots.map(async (p) => {
|
|
@@ -40527,7 +40652,7 @@ var PivotModal = ({
|
|
|
40527
40652
|
setPopoverPosition("bottom");
|
|
40528
40653
|
}
|
|
40529
40654
|
};
|
|
40530
|
-
|
|
40655
|
+
useEffect21(() => {
|
|
40531
40656
|
handleResize();
|
|
40532
40657
|
window.addEventListener("resize", handleResize);
|
|
40533
40658
|
const parentElement = parentRef?.current;
|
|
@@ -41353,12 +41478,12 @@ var validateReport = (formData, dashboardData, defaultDateFilter, allTables) =>
|
|
|
41353
41478
|
|
|
41354
41479
|
// src/components/Chart/InternalChart.tsx
|
|
41355
41480
|
import {
|
|
41356
|
-
useState as
|
|
41357
|
-
useEffect as
|
|
41481
|
+
useState as useState27,
|
|
41482
|
+
useEffect as useEffect22,
|
|
41358
41483
|
useContext as useContext24,
|
|
41359
41484
|
useMemo as useMemo19,
|
|
41360
|
-
useRef as
|
|
41361
|
-
useLayoutEffect
|
|
41485
|
+
useRef as useRef16,
|
|
41486
|
+
useLayoutEffect as useLayoutEffect2
|
|
41362
41487
|
} from "react";
|
|
41363
41488
|
import { differenceInHours as differenceInHours2 } from "date-fns";
|
|
41364
41489
|
init_Filter();
|
|
@@ -41503,8 +41628,8 @@ function InternalChart({
|
|
|
41503
41628
|
reportDateFilter.defaultPresetRanges ?? []
|
|
41504
41629
|
) : defaultOptionsV2;
|
|
41505
41630
|
}, [reportDateFilter]);
|
|
41506
|
-
const [filterValues, setFilterValues] =
|
|
41507
|
-
|
|
41631
|
+
const [filterValues, setFilterValues] = useState27({});
|
|
41632
|
+
useEffect22(() => {
|
|
41508
41633
|
if (reportDateFilter) {
|
|
41509
41634
|
const customDateFilter = filters?.find(
|
|
41510
41635
|
(f) => f.filterType === "date" /* Date */
|
|
@@ -41612,9 +41737,9 @@ function InternalChart({
|
|
|
41612
41737
|
}));
|
|
41613
41738
|
onDashboardFilterChange(filter.label, filterValue);
|
|
41614
41739
|
};
|
|
41615
|
-
const [filtersExpanded, setFiltersExpanded] =
|
|
41616
|
-
const filtersContainerRef =
|
|
41617
|
-
const [visibleFilters, setVisibleFilters] =
|
|
41740
|
+
const [filtersExpanded, setFiltersExpanded] = useState27(false);
|
|
41741
|
+
const filtersContainerRef = useRef16(null);
|
|
41742
|
+
const [visibleFilters, setVisibleFilters] = useState27([]);
|
|
41618
41743
|
const filtersOverflowing = useMemo19(() => {
|
|
41619
41744
|
return visibleFilters.some((visible) => visible);
|
|
41620
41745
|
}, [visibleFilters]);
|
|
@@ -41630,7 +41755,7 @@ function InternalChart({
|
|
|
41630
41755
|
});
|
|
41631
41756
|
setVisibleFilters(newVisibleItems);
|
|
41632
41757
|
};
|
|
41633
|
-
|
|
41758
|
+
useLayoutEffect2(() => {
|
|
41634
41759
|
requestAnimationFrame(() => measureItems());
|
|
41635
41760
|
const handleResize = () => {
|
|
41636
41761
|
measureItems();
|
|
@@ -41912,8 +42037,8 @@ init_dates();
|
|
|
41912
42037
|
import React13, {
|
|
41913
42038
|
useContext as useContext25,
|
|
41914
42039
|
useMemo as useMemo20,
|
|
41915
|
-
useRef as
|
|
41916
|
-
useState as
|
|
42040
|
+
useRef as useRef17,
|
|
42041
|
+
useState as useState28
|
|
41917
42042
|
} from "react";
|
|
41918
42043
|
import { Fragment as Fragment12, jsx as jsx64, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
41919
42044
|
function QuillMultiSelectSectionList({
|
|
@@ -41931,10 +42056,10 @@ function QuillMultiSelectSectionList({
|
|
|
41931
42056
|
owner
|
|
41932
42057
|
}) {
|
|
41933
42058
|
const [theme] = useContext25(ThemeContext);
|
|
41934
|
-
const [showModal, setShowModal] =
|
|
41935
|
-
const modalRef =
|
|
41936
|
-
const buttonRef =
|
|
41937
|
-
const debounceTimeoutId =
|
|
42059
|
+
const [showModal, setShowModal] = useState28(false);
|
|
42060
|
+
const modalRef = useRef17(null);
|
|
42061
|
+
const buttonRef = useRef17(null);
|
|
42062
|
+
const debounceTimeoutId = useRef17(null);
|
|
41938
42063
|
const [searchQuery, setSearchQuery] = React13.useState("");
|
|
41939
42064
|
useOnClickOutside_default(
|
|
41940
42065
|
modalRef,
|
|
@@ -42716,18 +42841,18 @@ function createReportFromForm(formData, report, eventTracking, selectedPivotTabl
|
|
|
42716
42841
|
return newReport;
|
|
42717
42842
|
}
|
|
42718
42843
|
function ChartBuilderWithModal(props) {
|
|
42719
|
-
const parentRef =
|
|
42720
|
-
const [modalWidth, setModalWidth] =
|
|
42721
|
-
const [modalHeight, setModalHeight] =
|
|
42844
|
+
const parentRef = useRef18(null);
|
|
42845
|
+
const [modalWidth, setModalWidth] = useState29(200);
|
|
42846
|
+
const [modalHeight, setModalHeight] = useState29(200);
|
|
42722
42847
|
const { isOpen, setIsOpen, title, isHorizontalView } = props;
|
|
42723
42848
|
const Modal = props.ModalComponent ?? MemoizedModal;
|
|
42724
42849
|
const { dashboardReports: dashboard } = useDashboardReports(
|
|
42725
42850
|
props.destinationDashboard
|
|
42726
42851
|
);
|
|
42727
|
-
const [filtersEnabledState, setFiltersEnabledState] =
|
|
42852
|
+
const [filtersEnabledState, setFiltersEnabledState] = useState29(
|
|
42728
42853
|
!!props.reportId
|
|
42729
42854
|
);
|
|
42730
|
-
|
|
42855
|
+
useEffect23(() => {
|
|
42731
42856
|
function handleResize() {
|
|
42732
42857
|
const screenSize = window.innerWidth;
|
|
42733
42858
|
if (screenSize >= 1200) {
|
|
@@ -42846,19 +42971,19 @@ function ChartBuilder({
|
|
|
42846
42971
|
const resolvedReport = reportId && !tempReport ? allReportsById[reportId] : tempReport;
|
|
42847
42972
|
return resolvedReport;
|
|
42848
42973
|
}, [reportId, tempReport, allReportsById]);
|
|
42849
|
-
const [windowWidth, setWindowWidth] =
|
|
42850
|
-
const [rows, setRows] =
|
|
42851
|
-
const [itemQuery, setItemQuery] =
|
|
42852
|
-
const [rowCount, setRowCount] =
|
|
42853
|
-
const [maxPage, setMaxPage] =
|
|
42854
|
-
const [isLoading, setIsLoading] =
|
|
42855
|
-
const [rowCountIsLoading, setRowCountIsLoading] =
|
|
42856
|
-
const [isSubmitting, setIsSubmitting] =
|
|
42857
|
-
const MIN_FORM_WIDTH =
|
|
42858
|
-
const [pivotCardWidth, setPivotCardWidth] =
|
|
42859
|
-
const [formWidth, setFormWidth] =
|
|
42860
|
-
const inputRef =
|
|
42861
|
-
const selectRef =
|
|
42974
|
+
const [windowWidth, setWindowWidth] = useState29(1200);
|
|
42975
|
+
const [rows, setRows] = useState29(report?.rows ?? []);
|
|
42976
|
+
const [itemQuery, setItemQuery] = useState29(report?.itemQuery);
|
|
42977
|
+
const [rowCount, setRowCount] = useState29(report?.rowCount ?? 0);
|
|
42978
|
+
const [maxPage, setMaxPage] = useState29(0);
|
|
42979
|
+
const [isLoading, setIsLoading] = useState29(false);
|
|
42980
|
+
const [rowCountIsLoading, setRowCountIsLoading] = useState29(false);
|
|
42981
|
+
const [isSubmitting, setIsSubmitting] = useState29(false);
|
|
42982
|
+
const MIN_FORM_WIDTH = 700;
|
|
42983
|
+
const [pivotCardWidth, setPivotCardWidth] = useState29(MIN_FORM_WIDTH);
|
|
42984
|
+
const [formWidth, setFormWidth] = useState29(MIN_FORM_WIDTH);
|
|
42985
|
+
const inputRef = useRef18(null);
|
|
42986
|
+
const selectRef = useRef18(null);
|
|
42862
42987
|
const processColumns = (columns2) => {
|
|
42863
42988
|
if (schemaData.schemaWithCustomFields) {
|
|
42864
42989
|
const newProcessedColumns = columns2?.map((col) => {
|
|
@@ -42888,12 +43013,12 @@ function ChartBuilder({
|
|
|
42888
43013
|
}
|
|
42889
43014
|
return columns2;
|
|
42890
43015
|
};
|
|
42891
|
-
const [processedColumns, setProcessedColumns] =
|
|
43016
|
+
const [processedColumns, setProcessedColumns] = useState29(
|
|
42892
43017
|
processColumns(report?.columnInternal ?? [])
|
|
42893
43018
|
);
|
|
42894
|
-
const [currentPage, setCurrentPage] =
|
|
42895
|
-
const parentRef =
|
|
42896
|
-
const deleteRef =
|
|
43019
|
+
const [currentPage, setCurrentPage] = useState29(0);
|
|
43020
|
+
const parentRef = useRef18(null);
|
|
43021
|
+
const deleteRef = useRef18(null);
|
|
42897
43022
|
const modalPadding = 20;
|
|
42898
43023
|
const deleteButtonMargin = -12;
|
|
42899
43024
|
const { dashboardFilters } = useContext26(DashboardFiltersContext);
|
|
@@ -42915,7 +43040,7 @@ function ChartBuilder({
|
|
|
42915
43040
|
setFilterIssues([]);
|
|
42916
43041
|
}
|
|
42917
43042
|
};
|
|
42918
|
-
|
|
43043
|
+
useEffect23(() => {
|
|
42919
43044
|
const handleResize = () => {
|
|
42920
43045
|
setWindowWidth(window.innerWidth);
|
|
42921
43046
|
if (inputRef.current && selectRef.current) {
|
|
@@ -42938,7 +43063,7 @@ function ChartBuilder({
|
|
|
42938
43063
|
window.removeEventListener("resize", handleResize);
|
|
42939
43064
|
};
|
|
42940
43065
|
}, [isOpen]);
|
|
42941
|
-
const [dashboardOptions, setDashboardOptions] =
|
|
43066
|
+
const [dashboardOptions, setDashboardOptions] = useState29([]);
|
|
42942
43067
|
const {
|
|
42943
43068
|
reportFilters,
|
|
42944
43069
|
loadFiltersForReport,
|
|
@@ -42946,9 +43071,9 @@ function ChartBuilder({
|
|
|
42946
43071
|
abortLoadingFilters
|
|
42947
43072
|
} = useContext26(ReportFiltersContext);
|
|
42948
43073
|
const { reportsDispatch } = useContext26(ReportsContext);
|
|
42949
|
-
const initialFilters =
|
|
42950
|
-
const [reportFiltersLoaded, setReportFiltersLoaded] =
|
|
42951
|
-
|
|
43074
|
+
const initialFilters = useRef18(reportFilters[report?.id ?? TEMP_REPORT_ID]);
|
|
43075
|
+
const [reportFiltersLoaded, setReportFiltersLoaded] = useState29(!filtersEnabled);
|
|
43076
|
+
useEffect23(() => {
|
|
42952
43077
|
if (!reportFilters[report?.id ?? TEMP_REPORT_ID]) {
|
|
42953
43078
|
loadFiltersForReport(
|
|
42954
43079
|
report?.id ?? TEMP_REPORT_ID,
|
|
@@ -42981,20 +43106,20 @@ function ChartBuilder({
|
|
|
42981
43106
|
(f) => f.filter
|
|
42982
43107
|
);
|
|
42983
43108
|
}, [reportFilters, report?.id]);
|
|
42984
|
-
const [showFilterModal, setShowFilterModal] =
|
|
42985
|
-
const [filterIssues, setFilterIssues] =
|
|
42986
|
-
const [showPivotPopover, setShowPivotPopover] =
|
|
42987
|
-
const [isEdittingPivot, setIsEdittingPivot] =
|
|
42988
|
-
const [selectedPivotIndex, setSelectedPivotIndex] =
|
|
42989
|
-
const [tableName, setTableName] =
|
|
42990
|
-
const [includeCustomFields, setIncludeCustomFields] =
|
|
43109
|
+
const [showFilterModal, setShowFilterModal] = useState29(false);
|
|
43110
|
+
const [filterIssues, setFilterIssues] = useState29([]);
|
|
43111
|
+
const [showPivotPopover, setShowPivotPopover] = useState29(false);
|
|
43112
|
+
const [isEdittingPivot, setIsEdittingPivot] = useState29(false);
|
|
43113
|
+
const [selectedPivotIndex, setSelectedPivotIndex] = useState29(-1);
|
|
43114
|
+
const [tableName, setTableName] = useState29(void 0);
|
|
43115
|
+
const [includeCustomFields, setIncludeCustomFields] = useState29(
|
|
42991
43116
|
report ? !!report.includeCustomFields : !!client?.featureFlags?.customFieldsEnabled
|
|
42992
43117
|
);
|
|
42993
43118
|
const selectedTable = schemaData.schema?.find(
|
|
42994
43119
|
(t) => t.displayName === tableName
|
|
42995
43120
|
);
|
|
42996
|
-
const [pivotPopUpTitle, setPivotPopUpTitle] =
|
|
42997
|
-
const [pivotError, setPivotError] =
|
|
43121
|
+
const [pivotPopUpTitle, setPivotPopUpTitle] = useState29("Add pivot");
|
|
43122
|
+
const [pivotError, setPivotError] = useState29(void 0);
|
|
42998
43123
|
const pivotData = report?.pivotRows && report?.pivotColumns ? {
|
|
42999
43124
|
rows: report.pivotRows,
|
|
43000
43125
|
columns: report.pivotColumns,
|
|
@@ -43005,19 +43130,19 @@ function ChartBuilder({
|
|
|
43005
43130
|
const columns = report?.columnInternal ?? [];
|
|
43006
43131
|
const destinationDashboardName = report?.dashboardName || destinationDashboard;
|
|
43007
43132
|
const query = report?.queryString;
|
|
43008
|
-
const [loadingFormData, setLoadingFormData] =
|
|
43009
|
-
const [triggeredEditChart, setTriggeredEditChart] =
|
|
43010
|
-
const [createdPivots, setCreatedPivots] =
|
|
43133
|
+
const [loadingFormData, setLoadingFormData] = useState29(false);
|
|
43134
|
+
const [triggeredEditChart, setTriggeredEditChart] = useState29(false);
|
|
43135
|
+
const [createdPivots, setCreatedPivots] = useState29(
|
|
43011
43136
|
report?.pivot ? [report.pivot] : cp
|
|
43012
43137
|
);
|
|
43013
|
-
const [recommendedPivots, setRecommendedPivots] =
|
|
43014
|
-
const [pivotRowField, setPivotRowField] =
|
|
43138
|
+
const [recommendedPivots, setRecommendedPivots] = useState29(rp);
|
|
43139
|
+
const [pivotRowField, setPivotRowField] = useState29(
|
|
43015
43140
|
report?.pivot?.rowField
|
|
43016
43141
|
);
|
|
43017
|
-
const [pivotColumnField, setPivotColumnField] =
|
|
43142
|
+
const [pivotColumnField, setPivotColumnField] = useState29(
|
|
43018
43143
|
report?.pivot?.columnField
|
|
43019
43144
|
);
|
|
43020
|
-
const [pivotAggregations, setPivotAggregations] =
|
|
43145
|
+
const [pivotAggregations, setPivotAggregations] = useState29(
|
|
43021
43146
|
report?.pivot?.aggregations ?? [
|
|
43022
43147
|
{
|
|
43023
43148
|
valueField: report?.pivot?.valueField,
|
|
@@ -43026,10 +43151,10 @@ function ChartBuilder({
|
|
|
43026
43151
|
}
|
|
43027
43152
|
]
|
|
43028
43153
|
);
|
|
43029
|
-
const [pivotLimit, setPivotLimit] =
|
|
43154
|
+
const [pivotLimit, setPivotLimit] = useState29(
|
|
43030
43155
|
report?.pivot?.rowLimit
|
|
43031
43156
|
);
|
|
43032
|
-
const [pivotSort, setPivotSort] =
|
|
43157
|
+
const [pivotSort, setPivotSort] = useState29(
|
|
43033
43158
|
report?.pivot?.sort && report?.pivot?.sortDirection && report?.pivot?.sortField ? {
|
|
43034
43159
|
sortField: report.pivot.sortField,
|
|
43035
43160
|
sortDirection: report.pivot.sortDirection
|
|
@@ -43042,16 +43167,17 @@ function ChartBuilder({
|
|
|
43042
43167
|
rowsPerRequest: report?.chartType === "table" ? 50 : 500
|
|
43043
43168
|
}
|
|
43044
43169
|
};
|
|
43045
|
-
const [currentProcessing, setCurrentProcessing] =
|
|
43046
|
-
const [customTenantAccess, setCustomTenantAccess] =
|
|
43170
|
+
const [currentProcessing, setCurrentProcessing] = useState29(baseProcessing);
|
|
43171
|
+
const [customTenantAccess, setCustomTenantAccess] = useState29(
|
|
43047
43172
|
report?.flags === null ? false : !!Object.values(report?.flags ?? {}).length
|
|
43048
43173
|
);
|
|
43049
|
-
const [dateFieldOptions, setDateFieldOptions] =
|
|
43050
|
-
const [allTables, setAllTables] =
|
|
43051
|
-
const [customFieldTableRef, setCustomFieldTableRef] =
|
|
43052
|
-
const [referencedColumns, setReferencedColumns] =
|
|
43053
|
-
const [referencedColumnsWithoutStar, setReferencedColumnsWithoutStar] =
|
|
43054
|
-
const [
|
|
43174
|
+
const [dateFieldOptions, setDateFieldOptions] = useState29([]);
|
|
43175
|
+
const [allTables, setAllTables] = useState29([]);
|
|
43176
|
+
const [customFieldTableRef, setCustomFieldTableRef] = useState29(false);
|
|
43177
|
+
const [referencedColumns, setReferencedColumns] = useState29({});
|
|
43178
|
+
const [referencedColumnsWithoutStar, setReferencedColumnsWithoutStar] = useState29({});
|
|
43179
|
+
const [referencedTablesLoaded, setReferencedTablesLoaded] = useState29(false);
|
|
43180
|
+
const [filterMap, setFilterMap] = useState29(report?.filterMap ?? {});
|
|
43055
43181
|
const canonicalFilterMap = useMemo21(() => {
|
|
43056
43182
|
return Object.fromEntries(
|
|
43057
43183
|
Object.entries(filterMap).filter(
|
|
@@ -43062,7 +43188,7 @@ function ChartBuilder({
|
|
|
43062
43188
|
const validFilter = useMemo21(() => {
|
|
43063
43189
|
return specificDashboardFilters.reduce(
|
|
43064
43190
|
(acc, filter) => {
|
|
43065
|
-
if (filter.filterType === "date_range" || filter.filterType === "tenant") {
|
|
43191
|
+
if (filter.filterType === "date_range" || filter.filterType === "tenant" || !referencedTablesLoaded) {
|
|
43066
43192
|
acc[filter.label] = true;
|
|
43067
43193
|
return acc;
|
|
43068
43194
|
}
|
|
@@ -43077,8 +43203,8 @@ function ChartBuilder({
|
|
|
43077
43203
|
},
|
|
43078
43204
|
{}
|
|
43079
43205
|
);
|
|
43080
|
-
}, [specificDashboardFilters, filterMap, allTables]);
|
|
43081
|
-
const [formFlags, setFormFlags] =
|
|
43206
|
+
}, [specificDashboardFilters, filterMap, allTables, referencedTablesLoaded]);
|
|
43207
|
+
const [formFlags, setFormFlags] = useState29(
|
|
43082
43208
|
report?.flags ? Object.fromEntries(
|
|
43083
43209
|
Object.entries(report.flags).map(([key, value]) => {
|
|
43084
43210
|
if (value === ALL_TENANTS) {
|
|
@@ -43095,7 +43221,7 @@ function ChartBuilder({
|
|
|
43095
43221
|
})
|
|
43096
43222
|
) : void 0
|
|
43097
43223
|
);
|
|
43098
|
-
const [defaultDateField, setDefaultDateField] =
|
|
43224
|
+
const [defaultDateField, setDefaultDateField] = useState29({
|
|
43099
43225
|
table: dateFieldOptions[0]?.name || "",
|
|
43100
43226
|
field: dateFieldOptions[0]?.columns[0]?.field || ""
|
|
43101
43227
|
});
|
|
@@ -43274,7 +43400,7 @@ function ChartBuilder({
|
|
|
43274
43400
|
}
|
|
43275
43401
|
return chartBuilderData;
|
|
43276
43402
|
};
|
|
43277
|
-
const [formData, setFormData] =
|
|
43403
|
+
const [formData, setFormData] = useState29(
|
|
43278
43404
|
formFormDataFromReport(report, destinationSection ?? getCurrentSection())
|
|
43279
43405
|
);
|
|
43280
43406
|
const reportCustomFields = useMemo21(() => {
|
|
@@ -43328,7 +43454,7 @@ function ChartBuilder({
|
|
|
43328
43454
|
const columnsObservedInRows = rows[0] ? Object.keys(rows[0]) : [];
|
|
43329
43455
|
return columns.filter((col) => !columnsObservedInRows.includes(col.field));
|
|
43330
43456
|
}, [rows]);
|
|
43331
|
-
const [chartTypes, setChartTypes] =
|
|
43457
|
+
const [chartTypes, setChartTypes] = useState29(
|
|
43332
43458
|
(() => {
|
|
43333
43459
|
const data = formFormDataFromReport(
|
|
43334
43460
|
report,
|
|
@@ -43397,12 +43523,12 @@ function ChartBuilder({
|
|
|
43397
43523
|
customFieldsInTabularColumns,
|
|
43398
43524
|
chartBuilderFormDataContainsCustomFields
|
|
43399
43525
|
]);
|
|
43400
|
-
|
|
43526
|
+
useEffect23(() => {
|
|
43401
43527
|
if (!loadingFormData && triggeredEditChart) {
|
|
43402
43528
|
editChart();
|
|
43403
43529
|
}
|
|
43404
43530
|
}, [loadingFormData]);
|
|
43405
|
-
|
|
43531
|
+
useEffect23(() => {
|
|
43406
43532
|
async function getFormData() {
|
|
43407
43533
|
if (!client) {
|
|
43408
43534
|
return;
|
|
@@ -43443,6 +43569,7 @@ function ChartBuilder({
|
|
|
43443
43569
|
setLoadingFormData(false);
|
|
43444
43570
|
return;
|
|
43445
43571
|
}
|
|
43572
|
+
setReferencedTablesLoaded(false);
|
|
43446
43573
|
const result = await getReferencedTables(
|
|
43447
43574
|
client,
|
|
43448
43575
|
curSchemaData,
|
|
@@ -43520,12 +43647,13 @@ function ChartBuilder({
|
|
|
43520
43647
|
curFormData.dateField ?? dateField,
|
|
43521
43648
|
tableNames
|
|
43522
43649
|
);
|
|
43650
|
+
setReferencedTablesLoaded(true);
|
|
43523
43651
|
setLoadingFormData(false);
|
|
43524
43652
|
}
|
|
43525
43653
|
getFormData();
|
|
43526
43654
|
}, []);
|
|
43527
|
-
const ranMountQuery =
|
|
43528
|
-
|
|
43655
|
+
const ranMountQuery = useRef18(false);
|
|
43656
|
+
useEffect23(() => {
|
|
43529
43657
|
if (runQueryOnMount && reportFiltersLoaded && filtersEnabled && !ranMountQuery.current) {
|
|
43530
43658
|
ranMountQuery.current = true;
|
|
43531
43659
|
handleRunQuery(baseProcessing, currentDashboardFilters);
|
|
@@ -43550,7 +43678,7 @@ function ChartBuilder({
|
|
|
43550
43678
|
{}
|
|
43551
43679
|
) ?? {};
|
|
43552
43680
|
}, [client?.allTenantTypes]);
|
|
43553
|
-
const [selectedPivotTable, setSelectedPivotTable] =
|
|
43681
|
+
const [selectedPivotTable, setSelectedPivotTable] = useState29(pivotData);
|
|
43554
43682
|
const pivotCardTable = useMemo21(() => {
|
|
43555
43683
|
return {
|
|
43556
43684
|
pivot: formData.pivot,
|
|
@@ -43735,8 +43863,8 @@ function ChartBuilder({
|
|
|
43735
43863
|
handleRunQuery(baseProcessing, updatedFilters);
|
|
43736
43864
|
});
|
|
43737
43865
|
};
|
|
43738
|
-
const filtersEnabledRef =
|
|
43739
|
-
|
|
43866
|
+
const filtersEnabledRef = useRef18(filtersEnabled);
|
|
43867
|
+
useEffect23(() => {
|
|
43740
43868
|
if (filtersEnabledRef.current !== filtersEnabled) {
|
|
43741
43869
|
filtersEnabledRef.current = filtersEnabled;
|
|
43742
43870
|
setCurrentPage(0);
|
|
@@ -45479,16 +45607,22 @@ function ChartBuilder({
|
|
|
45479
45607
|
)
|
|
45480
45608
|
}
|
|
45481
45609
|
),
|
|
45482
|
-
(!formData.dateField?.table || !formData.dateField?.field) && /* @__PURE__ */ jsx65(
|
|
45483
|
-
|
|
45610
|
+
referencedTablesLoaded && (!formData.dateField?.table || !formData.dateField?.field) && /* @__PURE__ */ jsx65(
|
|
45611
|
+
"div",
|
|
45484
45612
|
{
|
|
45485
|
-
|
|
45486
|
-
|
|
45487
|
-
|
|
45488
|
-
|
|
45489
|
-
|
|
45613
|
+
style: { marginBottom: 8, marginTop: "auto" },
|
|
45614
|
+
children: /* @__PURE__ */ jsx65(
|
|
45615
|
+
ExclamationFilledIcon_default,
|
|
45616
|
+
{
|
|
45617
|
+
height: 28,
|
|
45618
|
+
width: 28,
|
|
45619
|
+
style: {
|
|
45620
|
+
color: "#dc143c"
|
|
45621
|
+
}
|
|
45622
|
+
}
|
|
45623
|
+
)
|
|
45490
45624
|
}
|
|
45491
|
-
)
|
|
45625
|
+
)
|
|
45492
45626
|
] }),
|
|
45493
45627
|
specificDashboardFilters.length > 0 && /* @__PURE__ */ jsx65(
|
|
45494
45628
|
"div",
|
|
@@ -45559,10 +45693,13 @@ function ChartBuilder({
|
|
|
45559
45693
|
hideEmptyOption: true
|
|
45560
45694
|
}
|
|
45561
45695
|
),
|
|
45562
|
-
!validFilter[filter.label] && /* @__PURE__ */ jsx65(
|
|
45696
|
+
referencedTablesLoaded && !validFilter[filter.label] && /* @__PURE__ */ jsx65(
|
|
45563
45697
|
"div",
|
|
45564
45698
|
{
|
|
45565
|
-
style: {
|
|
45699
|
+
style: {
|
|
45700
|
+
marginBottom: 8,
|
|
45701
|
+
marginTop: "auto"
|
|
45702
|
+
},
|
|
45566
45703
|
children: /* @__PURE__ */ jsx65(
|
|
45567
45704
|
ExclamationFilledIcon_default,
|
|
45568
45705
|
{
|
|
@@ -45851,21 +45988,6 @@ function DashboardFilterModal({
|
|
|
45851
45988
|
);
|
|
45852
45989
|
}
|
|
45853
45990
|
|
|
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
45991
|
// src/SQLEditor.tsx
|
|
45870
45992
|
init_tableProcessing();
|
|
45871
45993
|
init_queryConstructor();
|
|
@@ -46209,7 +46331,7 @@ init_astProcessing();
|
|
|
46209
46331
|
init_constants();
|
|
46210
46332
|
|
|
46211
46333
|
// src/hooks/useLongLoading.tsx
|
|
46212
|
-
import { useContext as useContext27, useEffect as
|
|
46334
|
+
import { useContext as useContext27, useEffect as useEffect24, useState as useState30 } from "react";
|
|
46213
46335
|
function useLongLoading(isLoading, meta) {
|
|
46214
46336
|
const {
|
|
46215
46337
|
origin,
|
|
@@ -46217,10 +46339,10 @@ function useLongLoading(isLoading, meta) {
|
|
|
46217
46339
|
abnormalLoadTime = 15e3,
|
|
46218
46340
|
loadDescription
|
|
46219
46341
|
} = meta;
|
|
46220
|
-
const [isLongLoading, setIsLongLoading] =
|
|
46221
|
-
const [isAbnormalLoading, setIsAbnormalLoading] =
|
|
46342
|
+
const [isLongLoading, setIsLongLoading] = useState30(false);
|
|
46343
|
+
const [isAbnormalLoading, setIsAbnormalLoading] = useState30(false);
|
|
46222
46344
|
const { eventTracking } = useContext27(EventTrackingContext);
|
|
46223
|
-
|
|
46345
|
+
useEffect24(() => {
|
|
46224
46346
|
let longTimer = null;
|
|
46225
46347
|
let abnormalTimer = null;
|
|
46226
46348
|
if (isLoading) {
|
|
@@ -46382,7 +46504,7 @@ function SQLEditor({
|
|
|
46382
46504
|
onDiscardChanges,
|
|
46383
46505
|
onSaveChanges,
|
|
46384
46506
|
onCloseChartBuilder,
|
|
46385
|
-
isChartBuilderEnabled =
|
|
46507
|
+
isChartBuilderEnabled = true,
|
|
46386
46508
|
isAdminEnabled = false,
|
|
46387
46509
|
chartBuilderOptions,
|
|
46388
46510
|
chartBuilderTitle,
|
|
@@ -46402,7 +46524,14 @@ function SQLEditor({
|
|
|
46402
46524
|
onRequestAddVirtualTable
|
|
46403
46525
|
}) {
|
|
46404
46526
|
const computedButtonLabel = addToDashboardButtonLabel === "Add to dashboard" ? reportId || report?.id ? "Save changes" : "Add to dashboard" : addToDashboardButtonLabel;
|
|
46405
|
-
const [sqlPrompt, setSqlPrompt] =
|
|
46527
|
+
const [sqlPrompt, setSqlPrompt] = useState31("");
|
|
46528
|
+
const sqlPromptFormRef = useRef19(null);
|
|
46529
|
+
const sqlPromptInputWidth = useResponsiveFirstChildWidth_default(sqlPromptFormRef, {
|
|
46530
|
+
gap: 12,
|
|
46531
|
+
initialWidth: 320,
|
|
46532
|
+
minWidth: 160
|
|
46533
|
+
});
|
|
46534
|
+
const normalizedSqlPromptWidth = sqlPromptInputWidth > 0 ? sqlPromptInputWidth : 160;
|
|
46406
46535
|
const [client] = useContext28(ClientContext);
|
|
46407
46536
|
const [theme] = useContext28(ThemeContext);
|
|
46408
46537
|
const { tenants, flags } = useContext28(TenantContext);
|
|
@@ -46418,9 +46547,9 @@ function SQLEditor({
|
|
|
46418
46547
|
const destinationDashboardConfig = useMemo22(() => {
|
|
46419
46548
|
return dashboards?.find((d) => d.name === destinationDashboard);
|
|
46420
46549
|
}, [dashboards, destinationDashboard]);
|
|
46421
|
-
const [query, setQuery] =
|
|
46422
|
-
const [rows, setRows] =
|
|
46423
|
-
const [columns, setColumns] =
|
|
46550
|
+
const [query, setQuery] = useState31(defaultQuery);
|
|
46551
|
+
const [rows, setRows] = useState31([]);
|
|
46552
|
+
const [columns, setColumns] = useState31([]);
|
|
46424
46553
|
const [schemaData] = useContext28(SchemaDataContext);
|
|
46425
46554
|
const { dashboardFilters } = useContext28(DashboardFiltersContext);
|
|
46426
46555
|
const specificDashboardFilters = useMemo22(() => {
|
|
@@ -46428,37 +46557,32 @@ function SQLEditor({
|
|
|
46428
46557
|
dashboardFilters[report?.dashboardName ?? destinationDashboard ?? ""] ?? {}
|
|
46429
46558
|
).map((f) => f.filter);
|
|
46430
46559
|
}, [dashboardFilters, destinationDashboard]);
|
|
46431
|
-
const [errorMessage, setErrorMessage] =
|
|
46432
|
-
const [sqlResponseLoading, setSqlResponseLoading] =
|
|
46560
|
+
const [errorMessage, setErrorMessage] = useState31("");
|
|
46561
|
+
const [sqlResponseLoading, setSqlResponseLoading] = useState31(false);
|
|
46433
46562
|
useLongLoading(sqlResponseLoading, {
|
|
46434
46563
|
origin: "SQLEditor",
|
|
46435
46564
|
loadDescription: "Loading SQL response"
|
|
46436
46565
|
});
|
|
46437
|
-
const [sqlQueryLoading, setSqlQueryLoading] =
|
|
46566
|
+
const [sqlQueryLoading, setSqlQueryLoading] = useState31(false);
|
|
46438
46567
|
useLongLoading(sqlQueryLoading, {
|
|
46439
46568
|
origin: "SQLEditor",
|
|
46440
46569
|
loadDescription: "Loading SQL query"
|
|
46441
46570
|
});
|
|
46442
|
-
const [isChartBuilderOpen, setIsChartBuilderOpen] =
|
|
46443
|
-
const [displayTable, setDisplayTable] =
|
|
46444
|
-
const [formattedRows, setFormattedRows] =
|
|
46445
|
-
const
|
|
46446
|
-
const
|
|
46447
|
-
const [
|
|
46448
|
-
const [
|
|
46449
|
-
const [
|
|
46450
|
-
const [
|
|
46451
|
-
const [
|
|
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({
|
|
46571
|
+
const [isChartBuilderOpen, setIsChartBuilderOpen] = useState31(false);
|
|
46572
|
+
const [displayTable, setDisplayTable] = useState31(false);
|
|
46573
|
+
const [formattedRows, setFormattedRows] = useState31([]);
|
|
46574
|
+
const [rowCount, setRowCount] = useState31(void 0);
|
|
46575
|
+
const [rowCountIsLoading, setRowCountIsLoading] = useState31(false);
|
|
46576
|
+
const [maxPage, setMaxPage] = useState31(1);
|
|
46577
|
+
const [tableSearchQuery, setTableSearchQuery] = useState31("");
|
|
46578
|
+
const [lastSuccessfulQuery, setLastSuccessfulQuery] = useState31("");
|
|
46579
|
+
const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = useState31(false);
|
|
46580
|
+
const [tempReport, setTempReport] = useState31({
|
|
46457
46581
|
...EMPTY_INTERNAL_REPORT,
|
|
46458
46582
|
...report
|
|
46459
46583
|
});
|
|
46460
|
-
const tableRef =
|
|
46461
|
-
const [cachedHeight, setCachedHeight] =
|
|
46584
|
+
const tableRef = useRef19(null);
|
|
46585
|
+
const [cachedHeight, setCachedHeight] = useState31(0);
|
|
46462
46586
|
const DEFAULT_ROWS_PER_PAGE = 5;
|
|
46463
46587
|
const ROW_HEIGHT = 37;
|
|
46464
46588
|
const TABLE_TAB_HEIGHT = 75;
|
|
@@ -46472,17 +46596,17 @@ function SQLEditor({
|
|
|
46472
46596
|
schemaData.schemaWithCustomFields,
|
|
46473
46597
|
destinationDashboardConfig?.tenantKeys
|
|
46474
46598
|
]);
|
|
46475
|
-
|
|
46599
|
+
useEffect25(() => {
|
|
46476
46600
|
if (tableRef.current) {
|
|
46477
46601
|
setCachedHeight(tableRef.current.clientHeight);
|
|
46478
46602
|
}
|
|
46479
46603
|
}, [tableRef.current?.clientHeight]);
|
|
46480
|
-
|
|
46604
|
+
useEffect25(() => {
|
|
46481
46605
|
if (!data && !dashboardIsLoading) {
|
|
46482
46606
|
reload();
|
|
46483
46607
|
}
|
|
46484
46608
|
}, [data, dashboardIsLoading]);
|
|
46485
|
-
|
|
46609
|
+
useEffect25(() => {
|
|
46486
46610
|
const loadReport = async () => {
|
|
46487
46611
|
let reportToLoad;
|
|
46488
46612
|
if (!client) {
|
|
@@ -46535,8 +46659,8 @@ function SQLEditor({
|
|
|
46535
46659
|
rowsPerPage * 10
|
|
46536
46660
|
)
|
|
46537
46661
|
};
|
|
46538
|
-
const [currentPage, setCurrentPage] =
|
|
46539
|
-
const [currentSort, setCurrentSort] =
|
|
46662
|
+
const [currentPage, setCurrentPage] = useState31(0);
|
|
46663
|
+
const [currentSort, setCurrentSort] = useState31(void 0);
|
|
46540
46664
|
const currentProcessing = useMemo22(() => {
|
|
46541
46665
|
return {
|
|
46542
46666
|
page: {
|
|
@@ -46557,29 +46681,14 @@ function SQLEditor({
|
|
|
46557
46681
|
);
|
|
46558
46682
|
}) ?? [];
|
|
46559
46683
|
}, [tableSearchQuery, schemaData.schemaWithCustomFields]);
|
|
46560
|
-
|
|
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(() => {
|
|
46684
|
+
useEffect25(() => {
|
|
46576
46685
|
if (client) {
|
|
46577
46686
|
setRows([]);
|
|
46578
46687
|
setColumns([]);
|
|
46579
46688
|
setDisplayTable(false);
|
|
46580
46689
|
}
|
|
46581
46690
|
}, [client?.publicKey]);
|
|
46582
|
-
|
|
46691
|
+
useEffect25(() => {
|
|
46583
46692
|
if (isChartBuilderOpen === false) {
|
|
46584
46693
|
onCloseChartBuilder && onCloseChartBuilder();
|
|
46585
46694
|
}
|
|
@@ -46840,7 +46949,7 @@ function SQLEditor({
|
|
|
46840
46949
|
}
|
|
46841
46950
|
return getTablesHelper(getSelectFromAST(resp.ast), dbTables, skipStar);
|
|
46842
46951
|
};
|
|
46843
|
-
|
|
46952
|
+
useEffect25(() => {
|
|
46844
46953
|
if (onChangeQuery) {
|
|
46845
46954
|
onChangeQuery(query || "");
|
|
46846
46955
|
}
|
|
@@ -46897,7 +47006,11 @@ function SQLEditor({
|
|
|
46897
47006
|
style: {
|
|
46898
47007
|
paddingTop: 16,
|
|
46899
47008
|
paddingLeft: "20px",
|
|
46900
|
-
paddingRight: "30px"
|
|
47009
|
+
paddingRight: "30px",
|
|
47010
|
+
width: "100%",
|
|
47011
|
+
maxWidth: 350,
|
|
47012
|
+
minWidth: 250,
|
|
47013
|
+
boxSizing: "border-box"
|
|
46901
47014
|
},
|
|
46902
47015
|
children: /* @__PURE__ */ jsx66(
|
|
46903
47016
|
TextInputComponent,
|
|
@@ -46908,7 +47021,7 @@ function SQLEditor({
|
|
|
46908
47021
|
},
|
|
46909
47022
|
value: tableSearchQuery,
|
|
46910
47023
|
id: "edit-name",
|
|
46911
|
-
width:
|
|
47024
|
+
width: "100%"
|
|
46912
47025
|
}
|
|
46913
47026
|
)
|
|
46914
47027
|
}
|
|
@@ -46928,7 +47041,7 @@ function SQLEditor({
|
|
|
46928
47041
|
]
|
|
46929
47042
|
}
|
|
46930
47043
|
),
|
|
46931
|
-
/* @__PURE__ */
|
|
47044
|
+
/* @__PURE__ */ jsx66(
|
|
46932
47045
|
"div",
|
|
46933
47046
|
{
|
|
46934
47047
|
style: {
|
|
@@ -46940,391 +47053,385 @@ function SQLEditor({
|
|
|
46940
47053
|
height: "100%",
|
|
46941
47054
|
overflowX: "hidden"
|
|
46942
47055
|
},
|
|
46943
|
-
children:
|
|
46944
|
-
|
|
46945
|
-
|
|
46946
|
-
{
|
|
46947
|
-
|
|
46948
|
-
|
|
46949
|
-
|
|
46950
|
-
|
|
46951
|
-
|
|
46952
|
-
|
|
46953
|
-
|
|
46954
|
-
|
|
46955
|
-
|
|
46956
|
-
|
|
46957
|
-
|
|
46958
|
-
|
|
46959
|
-
|
|
46960
|
-
|
|
46961
|
-
|
|
46962
|
-
|
|
46963
|
-
|
|
46964
|
-
|
|
46965
|
-
|
|
46966
|
-
|
|
46967
|
-
|
|
46968
|
-
|
|
46969
|
-
|
|
46970
|
-
|
|
46971
|
-
|
|
46972
|
-
|
|
46973
|
-
|
|
46974
|
-
|
|
46975
|
-
|
|
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,
|
|
47056
|
+
children: /* @__PURE__ */ jsx66(
|
|
47057
|
+
"div",
|
|
47058
|
+
{
|
|
47059
|
+
style: {
|
|
47060
|
+
display: "flex",
|
|
47061
|
+
flexDirection: "column",
|
|
47062
|
+
overflow: addToDashboardButtonLabel === "Add to dashboard" ? "visible" : "auto",
|
|
47063
|
+
height: "100%"
|
|
47064
|
+
},
|
|
47065
|
+
children: /* @__PURE__ */ jsxs48(OverflowContainer, { children: [
|
|
47066
|
+
/* @__PURE__ */ jsxs48(
|
|
47067
|
+
"form",
|
|
47068
|
+
{
|
|
47069
|
+
ref: sqlPromptFormRef,
|
|
47070
|
+
onSubmit: (e) => {
|
|
47071
|
+
e.preventDefault();
|
|
47072
|
+
if (sqlPrompt.trim().length > 500) {
|
|
47073
|
+
return;
|
|
47074
|
+
}
|
|
47075
|
+
debounceRunSqlPrompt();
|
|
47076
|
+
},
|
|
47077
|
+
style: {
|
|
47078
|
+
display: "flex",
|
|
47079
|
+
flexDirection: "row",
|
|
47080
|
+
gap: 12,
|
|
47081
|
+
paddingTop: 16,
|
|
47082
|
+
paddingBottom: 16,
|
|
47083
|
+
flexWrap: "wrap",
|
|
47084
|
+
alignItems: "stretch",
|
|
47085
|
+
visibility: normalizedSqlPromptWidth > 0 ? "visible" : "hidden"
|
|
47086
|
+
},
|
|
47087
|
+
children: [
|
|
47088
|
+
/* @__PURE__ */ jsx66(
|
|
47089
|
+
TextInputComponent,
|
|
47018
47090
|
{
|
|
47019
|
-
|
|
47020
|
-
|
|
47021
|
-
|
|
47022
|
-
|
|
47023
|
-
|
|
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
|
|
47091
|
+
id: "ai-search",
|
|
47092
|
+
value: sqlPrompt,
|
|
47093
|
+
width: normalizedSqlPromptWidth,
|
|
47094
|
+
onChange: (e) => setSqlPrompt(e.target.value),
|
|
47095
|
+
placeholder: "Ask a question..."
|
|
47040
47096
|
}
|
|
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",
|
|
47097
|
+
),
|
|
47098
|
+
/* @__PURE__ */ jsx66(
|
|
47099
|
+
QuillToolTip,
|
|
47055
47100
|
{
|
|
47056
|
-
|
|
47057
|
-
|
|
47058
|
-
|
|
47059
|
-
|
|
47060
|
-
|
|
47101
|
+
text: "Prompt must be less than 500 characters",
|
|
47102
|
+
enabled: sqlPrompt.trim().length > 500,
|
|
47103
|
+
displayBelow: true,
|
|
47104
|
+
textStyle: {
|
|
47105
|
+
maxWidth: "77px",
|
|
47106
|
+
whiteSpace: "normal"
|
|
47061
47107
|
},
|
|
47062
|
-
children: /* @__PURE__ */
|
|
47063
|
-
|
|
47064
|
-
|
|
47065
|
-
|
|
47066
|
-
|
|
47067
|
-
|
|
47068
|
-
|
|
47069
|
-
|
|
47070
|
-
|
|
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
|
-
] })
|
|
47108
|
+
children: /* @__PURE__ */ jsx66(
|
|
47109
|
+
ButtonComponent,
|
|
47110
|
+
{
|
|
47111
|
+
onClick: debounceRunSqlPrompt,
|
|
47112
|
+
label: "Ask AI",
|
|
47113
|
+
isLoading: sqlResponseLoading,
|
|
47114
|
+
disabled: sqlPrompt.trim().length > 500
|
|
47115
|
+
}
|
|
47116
|
+
)
|
|
47206
47117
|
}
|
|
47207
47118
|
)
|
|
47208
|
-
|
|
47209
|
-
|
|
47210
|
-
|
|
47211
|
-
|
|
47212
|
-
|
|
47213
|
-
|
|
47214
|
-
|
|
47215
|
-
|
|
47216
|
-
|
|
47217
|
-
|
|
47218
|
-
|
|
47219
|
-
|
|
47220
|
-
|
|
47221
|
-
|
|
47222
|
-
|
|
47223
|
-
|
|
47119
|
+
]
|
|
47120
|
+
}
|
|
47121
|
+
),
|
|
47122
|
+
/* @__PURE__ */ jsx66(
|
|
47123
|
+
"div",
|
|
47124
|
+
{
|
|
47125
|
+
style: {
|
|
47126
|
+
minHeight: "max(210px, 20vh)",
|
|
47127
|
+
maxHeight: "30%",
|
|
47128
|
+
height: "20vh"
|
|
47129
|
+
},
|
|
47130
|
+
children: /* @__PURE__ */ jsx66(
|
|
47131
|
+
SQLEditorComponent,
|
|
47132
|
+
{
|
|
47133
|
+
query: query || "",
|
|
47134
|
+
schema: filteredSchema,
|
|
47135
|
+
databaseType: client?.databaseType ?? "postgresql",
|
|
47136
|
+
clientName: client?.publicKey || "",
|
|
47137
|
+
setQuery,
|
|
47138
|
+
handleRunQuery: () => {
|
|
47139
|
+
handleRunQuery(currentProcessing, true);
|
|
47140
|
+
},
|
|
47141
|
+
handleFixWithAI,
|
|
47142
|
+
isNewQueryEnabled,
|
|
47143
|
+
runQueryOnMount,
|
|
47144
|
+
handleClearQuery,
|
|
47145
|
+
theme,
|
|
47146
|
+
defineEditorTheme,
|
|
47147
|
+
setEditorTheme,
|
|
47148
|
+
setEditorMounted: () => {
|
|
47149
|
+
},
|
|
47150
|
+
ButtonComponent,
|
|
47151
|
+
SecondaryButtonComponent,
|
|
47152
|
+
loading: sqlResponseLoading && schemaData.isSchemaLoading && dashboardIsLoading,
|
|
47153
|
+
LoadingComponent
|
|
47154
|
+
}
|
|
47155
|
+
)
|
|
47156
|
+
}
|
|
47157
|
+
),
|
|
47158
|
+
/* @__PURE__ */ jsx66(
|
|
47159
|
+
"div",
|
|
47160
|
+
{
|
|
47161
|
+
style: {
|
|
47162
|
+
display: "flex",
|
|
47163
|
+
flexDirection: "row",
|
|
47164
|
+
width: "100%",
|
|
47165
|
+
justifyContent: addToDashboardButtonLabel === "Add to dashboard" ? "flex-end" : "flex-start"
|
|
47166
|
+
},
|
|
47167
|
+
children: /* @__PURE__ */ jsx66(
|
|
47168
|
+
"div",
|
|
47169
|
+
{
|
|
47170
|
+
style: {
|
|
47171
|
+
display: "flex",
|
|
47172
|
+
flexDirection: "row",
|
|
47173
|
+
alignItems: "center",
|
|
47174
|
+
height: 70
|
|
47175
|
+
},
|
|
47176
|
+
children: /* @__PURE__ */ jsxs48(
|
|
47224
47177
|
"div",
|
|
47225
47178
|
{
|
|
47226
47179
|
style: {
|
|
47227
|
-
|
|
47228
|
-
|
|
47229
|
-
fontSize: 15,
|
|
47230
|
-
fontWeight: "400",
|
|
47231
|
-
width: "100%"
|
|
47180
|
+
display: "flex",
|
|
47181
|
+
gap: 12
|
|
47232
47182
|
},
|
|
47233
|
-
children:
|
|
47234
|
-
"
|
|
47235
|
-
|
|
47236
|
-
|
|
47237
|
-
|
|
47238
|
-
|
|
47239
|
-
|
|
47240
|
-
|
|
47241
|
-
|
|
47242
|
-
|
|
47243
|
-
|
|
47244
|
-
|
|
47245
|
-
|
|
47246
|
-
|
|
47247
|
-
|
|
47248
|
-
|
|
47249
|
-
|
|
47250
|
-
|
|
47251
|
-
|
|
47252
|
-
|
|
47253
|
-
|
|
47254
|
-
|
|
47183
|
+
children: [
|
|
47184
|
+
computedButtonLabel === "Add to dashboard" ? /* @__PURE__ */ jsx66(
|
|
47185
|
+
SecondaryButtonComponent,
|
|
47186
|
+
{
|
|
47187
|
+
onClick: () => {
|
|
47188
|
+
handleRunQuery(
|
|
47189
|
+
{
|
|
47190
|
+
page: pagination,
|
|
47191
|
+
sort: void 0
|
|
47192
|
+
},
|
|
47193
|
+
true,
|
|
47194
|
+
false,
|
|
47195
|
+
true
|
|
47196
|
+
);
|
|
47197
|
+
},
|
|
47198
|
+
label: "Run query"
|
|
47199
|
+
}
|
|
47200
|
+
) : /* @__PURE__ */ jsx66(
|
|
47201
|
+
SecondaryButtonComponent,
|
|
47202
|
+
{
|
|
47203
|
+
onClick: () => {
|
|
47204
|
+
handleRunQuery(
|
|
47205
|
+
{
|
|
47206
|
+
page: pagination,
|
|
47207
|
+
sort: void 0
|
|
47208
|
+
},
|
|
47209
|
+
true,
|
|
47210
|
+
false,
|
|
47211
|
+
true
|
|
47212
|
+
);
|
|
47213
|
+
},
|
|
47214
|
+
label: "Run query"
|
|
47215
|
+
}
|
|
47216
|
+
),
|
|
47217
|
+
isChartBuilderEnabled && /* @__PURE__ */ jsx66(
|
|
47218
|
+
"div",
|
|
47219
|
+
{
|
|
47220
|
+
style: {
|
|
47221
|
+
display: "flex",
|
|
47222
|
+
flexDirection: "row",
|
|
47223
|
+
alignItems: "center",
|
|
47224
|
+
justifyContent: "flex-end",
|
|
47225
|
+
width: "100%"
|
|
47226
|
+
},
|
|
47227
|
+
children: computedButtonLabel !== "Add to dashboard" ? /* @__PURE__ */ jsx66(
|
|
47228
|
+
ButtonComponent,
|
|
47255
47229
|
{
|
|
47256
|
-
onClick:
|
|
47257
|
-
|
|
47230
|
+
onClick: async () => {
|
|
47231
|
+
onSaveChanges && onSaveChanges();
|
|
47232
|
+
setIsChartBuilderOpen(true);
|
|
47233
|
+
},
|
|
47234
|
+
label: computedButtonLabel,
|
|
47235
|
+
disabled: !!errorMessage || !(lastSuccessfulQuery === query)
|
|
47236
|
+
}
|
|
47237
|
+
) : /* @__PURE__ */ jsx66(
|
|
47238
|
+
ButtonComponent,
|
|
47239
|
+
{
|
|
47240
|
+
onClick: async () => {
|
|
47241
|
+
onSaveChanges && onSaveChanges();
|
|
47242
|
+
const isSelectStar = isSimpleSelectStarQuery(query ?? "");
|
|
47243
|
+
let tables = [];
|
|
47244
|
+
let customFieldColumns = [];
|
|
47245
|
+
if (client && isSelectStar && schemaData.customFields) {
|
|
47246
|
+
const { referencedTablesAndColumns } = await getReferencedTables(
|
|
47247
|
+
client,
|
|
47248
|
+
query ?? "",
|
|
47249
|
+
filteredSchema,
|
|
47250
|
+
isSelectStar
|
|
47251
|
+
);
|
|
47252
|
+
tables = referencedTablesAndColumns.map(
|
|
47253
|
+
(ref) => ref.name
|
|
47254
|
+
);
|
|
47255
|
+
customFieldColumns = tables.map((table) => {
|
|
47256
|
+
return (schemaData.customFields?.[table] ?? []).map((field) => field.field);
|
|
47257
|
+
}).flat();
|
|
47258
|
+
}
|
|
47259
|
+
const newTempReport = {
|
|
47260
|
+
...tempReport,
|
|
47261
|
+
id: reportId || report?.id || TEMP_REPORT_ID,
|
|
47262
|
+
rows,
|
|
47263
|
+
columns: isSelectStar ? (
|
|
47264
|
+
// so Automatic Custom Fields can be applied
|
|
47265
|
+
columns.filter(
|
|
47266
|
+
(col) => {
|
|
47267
|
+
return !customFieldColumns.includes(
|
|
47268
|
+
col.field
|
|
47269
|
+
);
|
|
47270
|
+
}
|
|
47271
|
+
)
|
|
47272
|
+
) : columns,
|
|
47273
|
+
includeCustomFields: isSelectStar,
|
|
47274
|
+
columnInternal: columns,
|
|
47275
|
+
rowCount: rowCount ?? 0,
|
|
47276
|
+
queryString: query ?? "",
|
|
47277
|
+
dashboardName: report?.dashboardName ?? destinationDashboard
|
|
47278
|
+
};
|
|
47279
|
+
setTempReport(newTempReport);
|
|
47280
|
+
setIsChartBuilderOpen(true);
|
|
47281
|
+
},
|
|
47282
|
+
label: computedButtonLabel,
|
|
47283
|
+
disabled: !!errorMessage || !(lastSuccessfulQuery === query) || !query,
|
|
47284
|
+
tooltipText: !!errorMessage || !(lastSuccessfulQuery === query) ? "Please run a query" : ""
|
|
47258
47285
|
}
|
|
47259
47286
|
)
|
|
47260
|
-
|
|
47261
|
-
|
|
47262
|
-
|
|
47263
|
-
|
|
47264
|
-
|
|
47265
|
-
|
|
47266
|
-
|
|
47267
|
-
|
|
47268
|
-
|
|
47269
|
-
|
|
47270
|
-
|
|
47271
|
-
|
|
47272
|
-
|
|
47273
|
-
|
|
47274
|
-
|
|
47275
|
-
|
|
47276
|
-
|
|
47277
|
-
|
|
47278
|
-
|
|
47279
|
-
|
|
47280
|
-
|
|
47281
|
-
|
|
47282
|
-
|
|
47283
|
-
|
|
47287
|
+
}
|
|
47288
|
+
),
|
|
47289
|
+
isAdminEnabled && !report && /* @__PURE__ */ jsx66(
|
|
47290
|
+
SecondaryButtonComponent,
|
|
47291
|
+
{
|
|
47292
|
+
disabled: !!errorMessage || !(lastSuccessfulQuery === query) || !query,
|
|
47293
|
+
onClick: async () => {
|
|
47294
|
+
const isSelectStar = isSimpleSelectStarQuery(
|
|
47295
|
+
query ?? ""
|
|
47296
|
+
);
|
|
47297
|
+
let tables = [];
|
|
47298
|
+
let customFieldColumns = [];
|
|
47299
|
+
if (client && isSelectStar && schemaData.customFields) {
|
|
47300
|
+
const { referencedTablesAndColumns } = await getReferencedTables(
|
|
47301
|
+
client,
|
|
47302
|
+
query ?? "",
|
|
47303
|
+
schemaData.schemaWithCustomFields,
|
|
47304
|
+
isSelectStar
|
|
47305
|
+
);
|
|
47306
|
+
tables = referencedTablesAndColumns.map(
|
|
47307
|
+
(ref) => ref.name
|
|
47308
|
+
);
|
|
47309
|
+
customFieldColumns = tables.map((table) => {
|
|
47310
|
+
return (schemaData.customFields?.[table] ?? []).map((field) => field.field);
|
|
47311
|
+
}).flat();
|
|
47312
|
+
}
|
|
47313
|
+
setTempReport({
|
|
47314
|
+
...tempReport,
|
|
47315
|
+
id: TEMP_REPORT_ID,
|
|
47316
|
+
rows,
|
|
47317
|
+
columns: isSelectStar ? (
|
|
47318
|
+
// so Automatic Custom Fields can be applied
|
|
47319
|
+
columns.filter(
|
|
47320
|
+
(col) => {
|
|
47321
|
+
return !customFieldColumns.includes(
|
|
47322
|
+
col.field
|
|
47323
|
+
);
|
|
47324
|
+
}
|
|
47325
|
+
)
|
|
47326
|
+
) : columns,
|
|
47327
|
+
includeCustomFields: isSelectStar,
|
|
47328
|
+
columnInternal: columns,
|
|
47329
|
+
rowCount: rowCount ?? 0,
|
|
47330
|
+
queryString: query ?? "",
|
|
47331
|
+
chartType: "table",
|
|
47332
|
+
dashboardName: destinationDashboard
|
|
47333
|
+
});
|
|
47334
|
+
setIsSaveQueryModalOpen(true);
|
|
47335
|
+
},
|
|
47336
|
+
label: "Save query"
|
|
47337
|
+
}
|
|
47338
|
+
),
|
|
47339
|
+
isNewQueryEnabled && /* @__PURE__ */ jsx66(
|
|
47340
|
+
SecondaryButtonComponent,
|
|
47341
|
+
{
|
|
47342
|
+
onClick: handleClearQuery,
|
|
47343
|
+
label: "Clear query"
|
|
47344
|
+
}
|
|
47345
|
+
)
|
|
47346
|
+
]
|
|
47284
47347
|
}
|
|
47285
|
-
)
|
|
47286
|
-
|
|
47287
|
-
|
|
47288
|
-
|
|
47289
|
-
|
|
47290
|
-
|
|
47291
|
-
|
|
47292
|
-
|
|
47293
|
-
|
|
47294
|
-
|
|
47295
|
-
|
|
47296
|
-
|
|
47297
|
-
|
|
47298
|
-
|
|
47299
|
-
|
|
47300
|
-
|
|
47301
|
-
|
|
47302
|
-
|
|
47303
|
-
|
|
47304
|
-
|
|
47305
|
-
|
|
47306
|
-
|
|
47307
|
-
|
|
47308
|
-
|
|
47309
|
-
|
|
47310
|
-
|
|
47311
|
-
|
|
47312
|
-
|
|
47313
|
-
|
|
47314
|
-
|
|
47315
|
-
|
|
47316
|
-
|
|
47317
|
-
|
|
47318
|
-
|
|
47319
|
-
|
|
47320
|
-
|
|
47321
|
-
|
|
47322
|
-
|
|
47323
|
-
|
|
47324
|
-
|
|
47325
|
-
|
|
47326
|
-
|
|
47327
|
-
|
|
47348
|
+
)
|
|
47349
|
+
}
|
|
47350
|
+
)
|
|
47351
|
+
}
|
|
47352
|
+
),
|
|
47353
|
+
/* @__PURE__ */ jsxs48(
|
|
47354
|
+
"div",
|
|
47355
|
+
{
|
|
47356
|
+
style: {
|
|
47357
|
+
display: "flex",
|
|
47358
|
+
flexDirection: "column",
|
|
47359
|
+
// height: '100%',
|
|
47360
|
+
padding: 0,
|
|
47361
|
+
margin: 0,
|
|
47362
|
+
border: "none",
|
|
47363
|
+
outline: "none"
|
|
47364
|
+
},
|
|
47365
|
+
children: [
|
|
47366
|
+
errorMessage && /* @__PURE__ */ jsx66(
|
|
47367
|
+
"div",
|
|
47368
|
+
{
|
|
47369
|
+
style: {
|
|
47370
|
+
fontFamily: theme?.fontFamily,
|
|
47371
|
+
color: theme?.primaryTextColor,
|
|
47372
|
+
fontSize: 15,
|
|
47373
|
+
fontWeight: "400",
|
|
47374
|
+
width: "100%"
|
|
47375
|
+
},
|
|
47376
|
+
children: /* @__PURE__ */ jsxs48(
|
|
47377
|
+
"div",
|
|
47378
|
+
{
|
|
47379
|
+
style: {
|
|
47380
|
+
display: "flex",
|
|
47381
|
+
flexDirection: "row",
|
|
47382
|
+
justifyContent: "space-between",
|
|
47383
|
+
gap: 12,
|
|
47384
|
+
background: "rgba(0,0,0,0.02)",
|
|
47385
|
+
// TODO: change color
|
|
47386
|
+
color: theme?.primaryTextColor,
|
|
47387
|
+
fontFamily: theme?.fontFamily,
|
|
47388
|
+
borderRadius: 6,
|
|
47389
|
+
padding: 20,
|
|
47390
|
+
marginBottom: 15,
|
|
47391
|
+
width: "100%",
|
|
47392
|
+
alignItems: "center"
|
|
47393
|
+
},
|
|
47394
|
+
children: [
|
|
47395
|
+
errorMessage,
|
|
47396
|
+
errorMessage !== "No data found" && errorMessage !== "No query found" && /* @__PURE__ */ jsx66(
|
|
47397
|
+
SecondaryButtonComponent,
|
|
47398
|
+
{
|
|
47399
|
+
onClick: handleFixWithAI,
|
|
47400
|
+
label: "Fix with AI"
|
|
47401
|
+
}
|
|
47402
|
+
)
|
|
47403
|
+
]
|
|
47404
|
+
}
|
|
47405
|
+
)
|
|
47406
|
+
}
|
|
47407
|
+
),
|
|
47408
|
+
errorMessage || !displayTable ? null : /* @__PURE__ */ jsx66("div", { ref: tableRef, children: /* @__PURE__ */ jsx66(
|
|
47409
|
+
TableComponent,
|
|
47410
|
+
{
|
|
47411
|
+
isLoading: sqlQueryLoading,
|
|
47412
|
+
rows: formattedRows,
|
|
47413
|
+
columns,
|
|
47414
|
+
rowCount,
|
|
47415
|
+
rowsPerPage,
|
|
47416
|
+
rowCountIsLoading,
|
|
47417
|
+
onPageChange,
|
|
47418
|
+
onSortChange,
|
|
47419
|
+
containerStyle: {
|
|
47420
|
+
height: "calc(100vh - max(210px, 20vh) - 310px)",
|
|
47421
|
+
minHeight: `calc(${DEFAULT_ROWS_PER_PAGE} * ${ROW_HEIGHT}px + ${TABLE_TAB_HEIGHT}px)`,
|
|
47422
|
+
// at least 10 rows tall
|
|
47423
|
+
maxHeight: "calc(100vh - max(210px, 20vh) - 310px)"
|
|
47424
|
+
},
|
|
47425
|
+
currentPage,
|
|
47426
|
+
setCurrentPage
|
|
47427
|
+
}
|
|
47428
|
+
) })
|
|
47429
|
+
]
|
|
47430
|
+
}
|
|
47431
|
+
)
|
|
47432
|
+
] })
|
|
47433
|
+
}
|
|
47434
|
+
)
|
|
47328
47435
|
}
|
|
47329
47436
|
)
|
|
47330
47437
|
]
|
|
@@ -47468,10 +47575,10 @@ var SQLEditorComponent = ({
|
|
|
47468
47575
|
loading,
|
|
47469
47576
|
LoadingComponent = QuillLoadingComponent
|
|
47470
47577
|
}) => {
|
|
47471
|
-
const [editorKey, setEditorKey] =
|
|
47578
|
+
const [editorKey, setEditorKey] = useState31(0);
|
|
47472
47579
|
const { eventTracking } = useContext28(EventTrackingContext);
|
|
47473
|
-
const currentProvider =
|
|
47474
|
-
|
|
47580
|
+
const currentProvider = useRef19(null);
|
|
47581
|
+
useEffect25(() => {
|
|
47475
47582
|
if (currentProvider.current) {
|
|
47476
47583
|
currentProvider.current.dispose();
|
|
47477
47584
|
if (schema && schema.length !== 0) {
|
|
@@ -47712,7 +47819,7 @@ function SchemaItem({
|
|
|
47712
47819
|
index,
|
|
47713
47820
|
onClick
|
|
47714
47821
|
}) {
|
|
47715
|
-
const [isOpen, setIsOpen] =
|
|
47822
|
+
const [isOpen, setIsOpen] = useState31(index === 0);
|
|
47716
47823
|
const schemaContainerStyle = {
|
|
47717
47824
|
display: "flex",
|
|
47718
47825
|
flexDirection: "column"
|
|
@@ -47941,14 +48048,14 @@ function SchemaItem({
|
|
|
47941
48048
|
// src/ReportBuilder.tsx
|
|
47942
48049
|
import {
|
|
47943
48050
|
useContext as useContext32,
|
|
47944
|
-
useEffect as
|
|
47945
|
-
useRef as
|
|
47946
|
-
useState as
|
|
48051
|
+
useEffect as useEffect29,
|
|
48052
|
+
useRef as useRef21,
|
|
48053
|
+
useState as useState37
|
|
47947
48054
|
} from "react";
|
|
47948
48055
|
init_constants();
|
|
47949
48056
|
|
|
47950
48057
|
// src/hooks/useReportBuilder.tsx
|
|
47951
|
-
import { useContext as useContext29, useEffect as
|
|
48058
|
+
import { useContext as useContext29, useEffect as useEffect26, useMemo as useMemo23, useState as useState32 } from "react";
|
|
47952
48059
|
init_tableProcessing();
|
|
47953
48060
|
init_ReportBuilder();
|
|
47954
48061
|
init_constants();
|
|
@@ -47999,18 +48106,18 @@ var useReportBuilderInternal = ({
|
|
|
47999
48106
|
rowsPerPage: _rowsPerPage,
|
|
48000
48107
|
rowsPerRequest: _rowsPerRequest
|
|
48001
48108
|
};
|
|
48002
|
-
const [openPopover, setOpenPopover] =
|
|
48003
|
-
const [aiPrompt, setAiPrompt] =
|
|
48004
|
-
const [reportBuilderLoading, setReportBuilderLoading] =
|
|
48005
|
-
const [tableLoading, setTableLoading] =
|
|
48006
|
-
const [errorMessage, setErrorMessage] =
|
|
48007
|
-
const [unresolvedReportMessage, setUnresolvedReportMessage] =
|
|
48008
|
-
const [tables, setTables] =
|
|
48009
|
-
const [columns, setColumns] =
|
|
48010
|
-
const [filterStack, setFilterStack] =
|
|
48011
|
-
const [pivot, setPivot] =
|
|
48012
|
-
const [sort, setSort] =
|
|
48013
|
-
const [limit, setLimit] =
|
|
48109
|
+
const [openPopover, setOpenPopover] = useState32(null);
|
|
48110
|
+
const [aiPrompt, setAiPrompt] = useState32("");
|
|
48111
|
+
const [reportBuilderLoading, setReportBuilderLoading] = useState32(false);
|
|
48112
|
+
const [tableLoading, setTableLoading] = useState32(false);
|
|
48113
|
+
const [errorMessage, setErrorMessage] = useState32("");
|
|
48114
|
+
const [unresolvedReportMessage, setUnresolvedReportMessage] = useState32("");
|
|
48115
|
+
const [tables, setTables] = useState32([]);
|
|
48116
|
+
const [columns, setColumns] = useState32([]);
|
|
48117
|
+
const [filterStack, setFilterStack] = useState32([]);
|
|
48118
|
+
const [pivot, setPivot] = useState32(null);
|
|
48119
|
+
const [sort, setSort] = useState32([]);
|
|
48120
|
+
const [limit, setLimit] = useState32(null);
|
|
48014
48121
|
const reportBuilderState = useMemo23(() => {
|
|
48015
48122
|
return {
|
|
48016
48123
|
tables,
|
|
@@ -48021,28 +48128,28 @@ var useReportBuilderInternal = ({
|
|
|
48021
48128
|
limit
|
|
48022
48129
|
};
|
|
48023
48130
|
}, [columns, filterStack, limit, pivot, sort, tables]);
|
|
48024
|
-
const [stateStack, setStateStack] =
|
|
48025
|
-
const [poppedStateStack, setPoppedStateStack] =
|
|
48026
|
-
const [unfilteredUniqueValues, setUnfilteredUniqueValues] =
|
|
48027
|
-
const [unfilteredUniqueValuesIsLoading, setUnfilteredUniqueValuesIsLoading] =
|
|
48028
|
-
const [filteredUniqueValues, setFilteredUniqueValues] =
|
|
48029
|
-
const [filteredUniqueValuesIsLoading, setFilteredUniqueValuesIsLoading] =
|
|
48030
|
-
const [columnUniqueValues, setColumnUniqueValues] =
|
|
48031
|
-
const [dateRanges, setDateRanges] =
|
|
48032
|
-
const [tempReport, setTempReport] =
|
|
48131
|
+
const [stateStack, setStateStack] = useState32([]);
|
|
48132
|
+
const [poppedStateStack, setPoppedStateStack] = useState32([]);
|
|
48133
|
+
const [unfilteredUniqueValues, setUnfilteredUniqueValues] = useState32({});
|
|
48134
|
+
const [unfilteredUniqueValuesIsLoading, setUnfilteredUniqueValuesIsLoading] = useState32(false);
|
|
48135
|
+
const [filteredUniqueValues, setFilteredUniqueValues] = useState32(null);
|
|
48136
|
+
const [filteredUniqueValuesIsLoading, setFilteredUniqueValuesIsLoading] = useState32(false);
|
|
48137
|
+
const [columnUniqueValues, setColumnUniqueValues] = useState32({});
|
|
48138
|
+
const [dateRanges, setDateRanges] = useState32(null);
|
|
48139
|
+
const [tempReport, setTempReport] = useState32({
|
|
48033
48140
|
...EMPTY_INTERNAL_REPORT,
|
|
48034
48141
|
pagination: REPORT_BUILDER_PAGINATION
|
|
48035
48142
|
});
|
|
48036
|
-
const [currentProcessing, setCurrentProcessing] =
|
|
48143
|
+
const [currentProcessing, setCurrentProcessing] = useState32({
|
|
48037
48144
|
page: REPORT_BUILDER_PAGINATION
|
|
48038
48145
|
});
|
|
48039
|
-
const [previousPage, setPreviousPage] =
|
|
48040
|
-
const [reportColumns, setReportColumns] =
|
|
48041
|
-
const [reportRows, setReportRows] =
|
|
48042
|
-
const [formattedRows, setFormattedRows] =
|
|
48043
|
-
const [pivotData, setPivotData] =
|
|
48044
|
-
const [numberOfRows, setNumberOfRows] =
|
|
48045
|
-
const [rowCountIsLoading, setRowCountIsLoading] =
|
|
48146
|
+
const [previousPage, setPreviousPage] = useState32(0);
|
|
48147
|
+
const [reportColumns, setReportColumns] = useState32([]);
|
|
48148
|
+
const [reportRows, setReportRows] = useState32([]);
|
|
48149
|
+
const [formattedRows, setFormattedRows] = useState32([]);
|
|
48150
|
+
const [pivotData, setPivotData] = useState32(null);
|
|
48151
|
+
const [numberOfRows, setNumberOfRows] = useState32(0);
|
|
48152
|
+
const [rowCountIsLoading, setRowCountIsLoading] = useState32(false);
|
|
48046
48153
|
const reportColumnsToStateColumns = useMemo23(() => {
|
|
48047
48154
|
const positionMap = {};
|
|
48048
48155
|
columns.forEach((column, index) => {
|
|
@@ -48061,28 +48168,28 @@ var useReportBuilderInternal = ({
|
|
|
48061
48168
|
}
|
|
48062
48169
|
});
|
|
48063
48170
|
}, [columns, reportColumns]);
|
|
48064
|
-
const [pivotRowField, setPivotRowField] =
|
|
48171
|
+
const [pivotRowField, setPivotRowField] = useState32(
|
|
48065
48172
|
void 0
|
|
48066
48173
|
);
|
|
48067
|
-
const [pivotColumnField, setPivotColumnField] =
|
|
48174
|
+
const [pivotColumnField, setPivotColumnField] = useState32(
|
|
48068
48175
|
void 0
|
|
48069
48176
|
);
|
|
48070
|
-
const [pivotAggregations, setPivotAggregations] =
|
|
48071
|
-
const [pivotLimit, setPivotLimit] =
|
|
48072
|
-
const [pivotSort, setPivotSort] =
|
|
48073
|
-
const [pivotHint, setPivotHint] =
|
|
48074
|
-
const [pivotError, setPivotError] =
|
|
48075
|
-
const [createdPivots, setCreatedPivots] =
|
|
48076
|
-
const [recommendedPivots, setRecommendedPivots] =
|
|
48077
|
-
const [pivotPopUpTitle, setPivotPopUpTitle] =
|
|
48078
|
-
const [showPivotPopover, setShowPivotPopover] =
|
|
48079
|
-
const [isEditingPivot, setIsEditingPivot] =
|
|
48080
|
-
const [selectedPivotIndex, setSelectedPivotIndex] =
|
|
48177
|
+
const [pivotAggregations, setPivotAggregations] = useState32([]);
|
|
48178
|
+
const [pivotLimit, setPivotLimit] = useState32(void 0);
|
|
48179
|
+
const [pivotSort, setPivotSort] = useState32(void 0);
|
|
48180
|
+
const [pivotHint, setPivotHint] = useState32("");
|
|
48181
|
+
const [pivotError, setPivotError] = useState32("");
|
|
48182
|
+
const [createdPivots, setCreatedPivots] = useState32([]);
|
|
48183
|
+
const [recommendedPivots, setRecommendedPivots] = useState32([]);
|
|
48184
|
+
const [pivotPopUpTitle, setPivotPopUpTitle] = useState32("Add pivot");
|
|
48185
|
+
const [showPivotPopover, setShowPivotPopover] = useState32(false);
|
|
48186
|
+
const [isEditingPivot, setIsEditingPivot] = useState32(false);
|
|
48187
|
+
const [selectedPivotIndex, setSelectedPivotIndex] = useState32(-1);
|
|
48081
48188
|
const [
|
|
48082
48189
|
pivotRecommendationsEnabledState,
|
|
48083
48190
|
setPivotRecommendationsEnabledState
|
|
48084
|
-
] =
|
|
48085
|
-
const [askAILoading, setAskAILoading] =
|
|
48191
|
+
] = useState32(pivotRecommendationsEnabled);
|
|
48192
|
+
const [askAILoading, setAskAILoading] = useState32(false);
|
|
48086
48193
|
const loading = reportBuilderLoading || tableLoading;
|
|
48087
48194
|
useLongLoading(reportBuilderLoading, {
|
|
48088
48195
|
origin: "ReportBuilder",
|
|
@@ -49166,7 +49273,7 @@ var useReportBuilderInternal = ({
|
|
|
49166
49273
|
flags: tempReport?.flags
|
|
49167
49274
|
});
|
|
49168
49275
|
};
|
|
49169
|
-
|
|
49276
|
+
useEffect26(() => {
|
|
49170
49277
|
if (!client) {
|
|
49171
49278
|
return;
|
|
49172
49279
|
}
|
|
@@ -49179,7 +49286,7 @@ var useReportBuilderInternal = ({
|
|
|
49179
49286
|
clearAllState();
|
|
49180
49287
|
}
|
|
49181
49288
|
}, [client]);
|
|
49182
|
-
|
|
49289
|
+
useEffect26(() => {
|
|
49183
49290
|
const loadChart = async () => {
|
|
49184
49291
|
let report;
|
|
49185
49292
|
if (!client) {
|
|
@@ -49236,7 +49343,7 @@ var useReportBuilderInternal = ({
|
|
|
49236
49343
|
loadChart();
|
|
49237
49344
|
}
|
|
49238
49345
|
}, [allReportsById[reportId || ""], client]);
|
|
49239
|
-
|
|
49346
|
+
useEffect26(() => {
|
|
49240
49347
|
if (initialTableName) {
|
|
49241
49348
|
const tableColumns = filteredSchema.find((table) => {
|
|
49242
49349
|
return table.name === initialTableName;
|
|
@@ -49256,7 +49363,7 @@ var useReportBuilderInternal = ({
|
|
|
49256
49363
|
}
|
|
49257
49364
|
}
|
|
49258
49365
|
}, [filteredSchema, initialTableName]);
|
|
49259
|
-
|
|
49366
|
+
useEffect26(() => {
|
|
49260
49367
|
if (!data && !dashboardIsLoading) {
|
|
49261
49368
|
reload();
|
|
49262
49369
|
}
|
|
@@ -49464,7 +49571,7 @@ var useReportBuilder = ({
|
|
|
49464
49571
|
init_ReportBuilder();
|
|
49465
49572
|
|
|
49466
49573
|
// src/components/ReportBuilder/AddColumnModal.tsx
|
|
49467
|
-
import { useState as
|
|
49574
|
+
import { useState as useState33, useRef as useRef20, useMemo as useMemo24, useEffect as useEffect27, useContext as useContext30 } from "react";
|
|
49468
49575
|
import {
|
|
49469
49576
|
DndContext as DndContext2,
|
|
49470
49577
|
closestCenter as closestCenter2,
|
|
@@ -49499,14 +49606,14 @@ function AddColumnModal({
|
|
|
49499
49606
|
LoadingComponent = QuillLoadingComponent,
|
|
49500
49607
|
onRequestAddVirtualTable
|
|
49501
49608
|
}) {
|
|
49502
|
-
const [primaryTable, setPrimaryTable] =
|
|
49609
|
+
const [primaryTable, setPrimaryTable] = useState33(
|
|
49503
49610
|
selectedTables[0]?.name
|
|
49504
49611
|
);
|
|
49505
49612
|
const [theme] = useContext30(ThemeContext);
|
|
49506
|
-
const [search, setSearch] =
|
|
49507
|
-
const [initialLoad, setInitialLoad] =
|
|
49508
|
-
const textInputContainerRef =
|
|
49509
|
-
const [modalSelectedColumns, setModalSelectedColumns] =
|
|
49613
|
+
const [search, setSearch] = useState33("");
|
|
49614
|
+
const [initialLoad, setInitialLoad] = useState33(true);
|
|
49615
|
+
const textInputContainerRef = useRef20(null);
|
|
49616
|
+
const [modalSelectedColumns, setModalSelectedColumns] = useState33(
|
|
49510
49617
|
selectedColumns.map((col) => `${col.table}.${col.field}`)
|
|
49511
49618
|
);
|
|
49512
49619
|
const columnOptions = useMemo24(() => {
|
|
@@ -49533,20 +49640,20 @@ function AddColumnModal({
|
|
|
49533
49640
|
})
|
|
49534
49641
|
);
|
|
49535
49642
|
}, [schema, primaryTable]);
|
|
49536
|
-
const [orderedColumnNames, setOrderedColumnNames] =
|
|
49643
|
+
const [orderedColumnNames, setOrderedColumnNames] = useState33([]);
|
|
49537
49644
|
const isSelectedAllColumns = columnOptions.length === modalSelectedColumns.length;
|
|
49538
49645
|
const searchResults = useMemo24(() => {
|
|
49539
49646
|
return orderedColumnNames.filter((column) => {
|
|
49540
49647
|
return columnOptions.includes(column) && (search.length === 0 || column.toLowerCase().includes(search.toLowerCase()) || snakeAndCamelCaseToTitleCase(column).toLowerCase().includes(search.toLowerCase()));
|
|
49541
49648
|
});
|
|
49542
49649
|
}, [search, columnOptions, orderedColumnNames]);
|
|
49543
|
-
|
|
49650
|
+
useEffect27(() => {
|
|
49544
49651
|
const remainingColumns = columnOptions.filter(
|
|
49545
49652
|
(col) => !modalSelectedColumns.includes(col)
|
|
49546
49653
|
);
|
|
49547
49654
|
setOrderedColumnNames([...modalSelectedColumns, ...remainingColumns]);
|
|
49548
49655
|
}, [columnOptions]);
|
|
49549
|
-
|
|
49656
|
+
useEffect27(() => {
|
|
49550
49657
|
if (!schemaLoading && initialLoad) {
|
|
49551
49658
|
setTimeout(() => setInitialLoad(false), 200);
|
|
49552
49659
|
}
|
|
@@ -50429,7 +50536,7 @@ var AddFilters = ({
|
|
|
50429
50536
|
};
|
|
50430
50537
|
|
|
50431
50538
|
// src/internals/ReportBuilder/PivotForm.tsx
|
|
50432
|
-
import { useContext as useContext31, useEffect as
|
|
50539
|
+
import { useContext as useContext31, useEffect as useEffect28, useState as useState34 } from "react";
|
|
50433
50540
|
init_textProcessing();
|
|
50434
50541
|
init_pivotProcessing();
|
|
50435
50542
|
import { jsx as jsx73, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
@@ -50458,22 +50565,22 @@ function PivotForm({
|
|
|
50458
50565
|
isLoading,
|
|
50459
50566
|
pivotHint
|
|
50460
50567
|
}) {
|
|
50461
|
-
const [allowedColumnFields, setAllowedColumnFields] =
|
|
50462
|
-
const [allowedRowFields, setAllowedRowFields] =
|
|
50463
|
-
const [allowedValueFields, setAllowedValueFields] =
|
|
50568
|
+
const [allowedColumnFields, setAllowedColumnFields] = useState34([]);
|
|
50569
|
+
const [allowedRowFields, setAllowedRowFields] = useState34([]);
|
|
50570
|
+
const [allowedValueFields, setAllowedValueFields] = useState34([]);
|
|
50464
50571
|
const [theme] = useContext31(ThemeContext);
|
|
50465
|
-
const [limitInput, setLimitInput] =
|
|
50572
|
+
const [limitInput, setLimitInput] = useState34(
|
|
50466
50573
|
pivotLimit?.toString() ?? ""
|
|
50467
50574
|
);
|
|
50468
|
-
const [sortFieldInput, setSortFieldInput] =
|
|
50575
|
+
const [sortFieldInput, setSortFieldInput] = useState34(
|
|
50469
50576
|
pivotSort?.sortField ?? ""
|
|
50470
50577
|
);
|
|
50471
|
-
const [sortDirectionInput, setSortDirectionInput] =
|
|
50578
|
+
const [sortDirectionInput, setSortDirectionInput] = useState34(
|
|
50472
50579
|
pivotSort?.sortDirection ?? ""
|
|
50473
50580
|
);
|
|
50474
|
-
const [showLimitInput, setShowLimitInput] =
|
|
50475
|
-
const [showSortInput, setShowSortInput] =
|
|
50476
|
-
|
|
50581
|
+
const [showLimitInput, setShowLimitInput] = useState34(!!pivotLimit);
|
|
50582
|
+
const [showSortInput, setShowSortInput] = useState34(!!pivotSort);
|
|
50583
|
+
useEffect28(() => {
|
|
50477
50584
|
if (uniqueValues) {
|
|
50478
50585
|
const possibleColumns = getPossiblePivotFieldOptions(
|
|
50479
50586
|
columns,
|
|
@@ -50484,12 +50591,12 @@ function PivotForm({
|
|
|
50484
50591
|
setAllowedValueFields(possibleColumns.valueFields);
|
|
50485
50592
|
}
|
|
50486
50593
|
}, [columns, uniqueValues]);
|
|
50487
|
-
|
|
50594
|
+
useEffect28(() => {
|
|
50488
50595
|
setSortFieldInput(pivotSort?.sortField ?? "");
|
|
50489
50596
|
setSortDirectionInput(pivotSort?.sortDirection ?? "");
|
|
50490
50597
|
setShowSortInput(!!pivotSort);
|
|
50491
50598
|
}, [pivotSort]);
|
|
50492
|
-
|
|
50599
|
+
useEffect28(() => {
|
|
50493
50600
|
setLimitInput(pivotLimit?.toString() ?? "");
|
|
50494
50601
|
setShowLimitInput(!!pivotLimit);
|
|
50495
50602
|
}, [pivotLimit]);
|
|
@@ -51101,7 +51208,7 @@ var AddPivot = ({
|
|
|
51101
51208
|
};
|
|
51102
51209
|
|
|
51103
51210
|
// src/components/ReportBuilder/AddLimitPopover.tsx
|
|
51104
|
-
import { useState as
|
|
51211
|
+
import { useState as useState35 } from "react";
|
|
51105
51212
|
import { Fragment as Fragment14, jsx as jsx75, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
51106
51213
|
var LimitSentence = ({
|
|
51107
51214
|
limit,
|
|
@@ -51116,7 +51223,7 @@ var LimitSentence = ({
|
|
|
51116
51223
|
SecondaryButton = MemoizedSecondaryButton,
|
|
51117
51224
|
disabled = false
|
|
51118
51225
|
}) => {
|
|
51119
|
-
const [isOpen, setIsOpen] =
|
|
51226
|
+
const [isOpen, setIsOpen] = useState35(false);
|
|
51120
51227
|
const handleClickDelete = () => {
|
|
51121
51228
|
setOpenPopover(null);
|
|
51122
51229
|
handleDelete();
|
|
@@ -51158,7 +51265,7 @@ var AddLimitPopover = ({
|
|
|
51158
51265
|
Button = MemoizedButton,
|
|
51159
51266
|
SecondaryButton = MemoizedSecondaryButton
|
|
51160
51267
|
}) => {
|
|
51161
|
-
const [limit, setLimit] =
|
|
51268
|
+
const [limit, setLimit] = useState35(initialLimit.toString());
|
|
51162
51269
|
const MAX_LIMIT = 2147483647;
|
|
51163
51270
|
return /* @__PURE__ */ jsxs55("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
51164
51271
|
/* @__PURE__ */ jsx75(
|
|
@@ -51399,7 +51506,7 @@ var AddLimit = ({
|
|
|
51399
51506
|
};
|
|
51400
51507
|
|
|
51401
51508
|
// src/components/ReportBuilder/AddSortPopover.tsx
|
|
51402
|
-
import { useState as
|
|
51509
|
+
import { useState as useState36 } from "react";
|
|
51403
51510
|
init_textProcessing();
|
|
51404
51511
|
import { Fragment as Fragment15, jsx as jsx77, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
51405
51512
|
var SORT_VALUE_TO_LABEL = {
|
|
@@ -51423,7 +51530,7 @@ var SortSentence = ({
|
|
|
51423
51530
|
SecondaryButton = MemoizedSecondaryButton,
|
|
51424
51531
|
disabled = false
|
|
51425
51532
|
}) => {
|
|
51426
|
-
const [isOpen, setIsOpen] =
|
|
51533
|
+
const [isOpen, setIsOpen] = useState36(false);
|
|
51427
51534
|
const handleSetIsOpen = (isOpen2) => {
|
|
51428
51535
|
setIsOpen(isOpen2);
|
|
51429
51536
|
};
|
|
@@ -51475,8 +51582,8 @@ var AddSortPopover = ({
|
|
|
51475
51582
|
Button = MemoizedButton,
|
|
51476
51583
|
SecondaryButton = MemoizedSecondaryButton
|
|
51477
51584
|
}) => {
|
|
51478
|
-
const [sortColumn, setSortColumn] =
|
|
51479
|
-
const [sortDirection, setSortDirection] =
|
|
51585
|
+
const [sortColumn, setSortColumn] = useState36(column || "");
|
|
51586
|
+
const [sortDirection, setSortDirection] = useState36(
|
|
51480
51587
|
direction || "ASC"
|
|
51481
51588
|
);
|
|
51482
51589
|
return /* @__PURE__ */ jsxs57("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
@@ -51957,12 +52064,11 @@ function ReportBuilder({
|
|
|
51957
52064
|
const [theme] = useContext32(ThemeContext);
|
|
51958
52065
|
const [client] = useContext32(ClientContext);
|
|
51959
52066
|
const { getToken } = useContext32(FetchContext);
|
|
51960
|
-
const parentRef =
|
|
51961
|
-
const
|
|
51962
|
-
const [
|
|
51963
|
-
const [
|
|
51964
|
-
const [
|
|
51965
|
-
const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = useState36(false);
|
|
52067
|
+
const parentRef = useRef21(null);
|
|
52068
|
+
const askAIFormRef = useRef21(null);
|
|
52069
|
+
const [isCopying, setIsCopying] = useState37(false);
|
|
52070
|
+
const [isChartBuilderOpen, setIsChartBuilderOpen] = useState37(false);
|
|
52071
|
+
const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = useState37(false);
|
|
51966
52072
|
const reportBuilder = useReportBuilderInternal({
|
|
51967
52073
|
reportId,
|
|
51968
52074
|
initialTableName,
|
|
@@ -52002,6 +52108,12 @@ function ReportBuilder({
|
|
|
52002
52108
|
onSaveQuery,
|
|
52003
52109
|
onSaveReport
|
|
52004
52110
|
} = reportBuilder;
|
|
52111
|
+
const askAIInputWidth = useResponsiveFirstChildWidth_default(askAIFormRef, {
|
|
52112
|
+
gap: 12,
|
|
52113
|
+
initialWidth: 320,
|
|
52114
|
+
minWidth: 160
|
|
52115
|
+
});
|
|
52116
|
+
const normalizedAskAIInputWidth = askAIInputWidth > 0 ? askAIInputWidth : 160;
|
|
52005
52117
|
const copySQLToClipboard = async () => {
|
|
52006
52118
|
let query = "";
|
|
52007
52119
|
if (pivot && pivotData) {
|
|
@@ -52024,17 +52136,7 @@ function ReportBuilder({
|
|
|
52024
52136
|
setTimeout(() => setIsCopying(false), 800);
|
|
52025
52137
|
}
|
|
52026
52138
|
};
|
|
52027
|
-
|
|
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(() => {
|
|
52139
|
+
useEffect29(() => {
|
|
52038
52140
|
if (isChartBuilderOpen === false) {
|
|
52039
52141
|
onCloseChartBuilder && onCloseChartBuilder();
|
|
52040
52142
|
}
|
|
@@ -52152,10 +52254,10 @@ function ReportBuilder({
|
|
|
52152
52254
|
/* @__PURE__ */ jsx81("div", { style: { width: "100%", minHeight: "30vh" } })
|
|
52153
52255
|
] }),
|
|
52154
52256
|
/* @__PURE__ */ jsxs60(ContainerComponent, { children: [
|
|
52155
|
-
isAIEnabled && /* @__PURE__ */
|
|
52257
|
+
isAIEnabled && /* @__PURE__ */ jsxs60(
|
|
52156
52258
|
"form",
|
|
52157
52259
|
{
|
|
52158
|
-
ref:
|
|
52260
|
+
ref: askAIFormRef,
|
|
52159
52261
|
onSubmit: (event) => {
|
|
52160
52262
|
event.preventDefault();
|
|
52161
52263
|
},
|
|
@@ -52163,15 +52265,17 @@ function ReportBuilder({
|
|
|
52163
52265
|
display: "flex",
|
|
52164
52266
|
flexDirection: "row",
|
|
52165
52267
|
gap: 12,
|
|
52166
|
-
|
|
52268
|
+
flexWrap: "wrap",
|
|
52269
|
+
alignItems: "stretch",
|
|
52270
|
+
visibility: normalizedAskAIInputWidth > 0 ? "visible" : "hidden"
|
|
52167
52271
|
},
|
|
52168
|
-
children:
|
|
52272
|
+
children: [
|
|
52169
52273
|
/* @__PURE__ */ jsx81(
|
|
52170
52274
|
TextInputComponent,
|
|
52171
52275
|
{
|
|
52172
52276
|
id: "ask_ai_input_bar",
|
|
52173
52277
|
value: aiPrompt,
|
|
52174
|
-
width:
|
|
52278
|
+
width: normalizedAskAIInputWidth,
|
|
52175
52279
|
onChange: (e) => setAiPrompt(e.target.value),
|
|
52176
52280
|
placeholder: "Ask a question..."
|
|
52177
52281
|
}
|
|
@@ -52209,7 +52313,7 @@ function ReportBuilder({
|
|
|
52209
52313
|
disabled: columns.length === 0 || loading
|
|
52210
52314
|
}
|
|
52211
52315
|
)
|
|
52212
|
-
]
|
|
52316
|
+
]
|
|
52213
52317
|
}
|
|
52214
52318
|
),
|
|
52215
52319
|
columns.length > 0 && /* @__PURE__ */ jsx81(
|
|
@@ -52466,10 +52570,10 @@ function ReportBuilder({
|
|
|
52466
52570
|
// src/ChartEditor.tsx
|
|
52467
52571
|
import {
|
|
52468
52572
|
useContext as useContext33,
|
|
52469
|
-
useEffect as
|
|
52573
|
+
useEffect as useEffect30,
|
|
52470
52574
|
useMemo as useMemo26,
|
|
52471
|
-
useRef as
|
|
52472
|
-
useState as
|
|
52575
|
+
useRef as useRef22,
|
|
52576
|
+
useState as useState38
|
|
52473
52577
|
} from "react";
|
|
52474
52578
|
import { jsx as jsx82 } from "react/jsx-runtime";
|
|
52475
52579
|
function ChartEditor({
|
|
@@ -52517,9 +52621,9 @@ function ChartEditor({
|
|
|
52517
52621
|
onClickChartElement,
|
|
52518
52622
|
onClickChartError
|
|
52519
52623
|
}) {
|
|
52520
|
-
const parentRef =
|
|
52521
|
-
const [modalWidth, setModalWidth] =
|
|
52522
|
-
const [modalHeight, setModalHeight] =
|
|
52624
|
+
const parentRef = useRef22(null);
|
|
52625
|
+
const [modalWidth, setModalWidth] = useState38(200);
|
|
52626
|
+
const [modalHeight, setModalHeight] = useState38(200);
|
|
52523
52627
|
const { addReport } = useDashboardReports(destinationDashboard);
|
|
52524
52628
|
const { allReportsById } = useAllReports();
|
|
52525
52629
|
const { tenants, flags } = useContext33(TenantContext);
|
|
@@ -52537,15 +52641,15 @@ function ChartEditor({
|
|
|
52537
52641
|
(f) => f.filter
|
|
52538
52642
|
);
|
|
52539
52643
|
}, [dashboardFilters]);
|
|
52540
|
-
const [filtersEnabled, setFiltersEnabled] =
|
|
52541
|
-
const [chartBuilderKey, setChartBuilderKey] =
|
|
52644
|
+
const [filtersEnabled, setFiltersEnabled] = useState38(true);
|
|
52645
|
+
const [chartBuilderKey, setChartBuilderKey] = useState38(0);
|
|
52542
52646
|
const dateFilter = Object.values(specificDashboardFilters).find(
|
|
52543
52647
|
(filter) => filter.filterType === "date_range"
|
|
52544
52648
|
);
|
|
52545
52649
|
const dateRange = useMemo26(() => {
|
|
52546
52650
|
return dateFilter?.startDate ? { start: dateFilter.startDate, end: dateFilter.endDate } : void 0;
|
|
52547
52651
|
}, [dateFilter]);
|
|
52548
|
-
|
|
52652
|
+
useEffect30(() => {
|
|
52549
52653
|
function handleResize() {
|
|
52550
52654
|
const screenSize = window.innerWidth;
|
|
52551
52655
|
if (screenSize >= 1200) {
|
|
@@ -52593,7 +52697,7 @@ function ChartEditor({
|
|
|
52593
52697
|
}
|
|
52594
52698
|
addReport(report2);
|
|
52595
52699
|
};
|
|
52596
|
-
|
|
52700
|
+
useEffect30(() => {
|
|
52597
52701
|
if (!isClientLoading && !report) {
|
|
52598
52702
|
fetchReportHelper();
|
|
52599
52703
|
}
|
|
@@ -52741,7 +52845,7 @@ function StaticChart({
|
|
|
52741
52845
|
init_valueFormatter();
|
|
52742
52846
|
|
|
52743
52847
|
// src/hooks/useTenants.ts
|
|
52744
|
-
import { useContext as useContext34, useEffect as
|
|
52848
|
+
import { useContext as useContext34, useEffect as useEffect31 } from "react";
|
|
52745
52849
|
var useTenants = (dashboardName) => {
|
|
52746
52850
|
const {
|
|
52747
52851
|
tenants,
|
|
@@ -52755,12 +52859,12 @@ var useTenants = (dashboardName) => {
|
|
|
52755
52859
|
getMappedTenantsForDashboard,
|
|
52756
52860
|
getViewerTenantsByOwner
|
|
52757
52861
|
} = useContext34(TenantContext);
|
|
52758
|
-
|
|
52862
|
+
useEffect31(() => {
|
|
52759
52863
|
if (dashboardName) {
|
|
52760
52864
|
fetchViewerTenantsForDashboard(dashboardName);
|
|
52761
52865
|
}
|
|
52762
52866
|
}, [dashboardName, fetchViewerTenantsForDashboard]);
|
|
52763
|
-
|
|
52867
|
+
useEffect31(() => {
|
|
52764
52868
|
if (dashboardName) {
|
|
52765
52869
|
fetchMappedTenantsForDashboard(dashboardName);
|
|
52766
52870
|
}
|
|
@@ -52779,7 +52883,7 @@ var useTenants = (dashboardName) => {
|
|
|
52779
52883
|
};
|
|
52780
52884
|
|
|
52781
52885
|
// src/hooks/useQuill.ts
|
|
52782
|
-
import { useContext as useContext35, useEffect as
|
|
52886
|
+
import { useContext as useContext35, useEffect as useEffect32, useMemo as useMemo27, useState as useState39 } from "react";
|
|
52783
52887
|
init_paginationProcessing();
|
|
52784
52888
|
init_tableProcessing();
|
|
52785
52889
|
init_dataProcessing();
|
|
@@ -52802,9 +52906,9 @@ var useQuill = (reportId, pagination) => {
|
|
|
52802
52906
|
const [client, isClientLoading] = useContext35(ClientContext);
|
|
52803
52907
|
const { tenants } = useContext35(TenantContext);
|
|
52804
52908
|
const { eventTracking } = useContext35(EventTrackingContext);
|
|
52805
|
-
const [loading, setLoading] =
|
|
52806
|
-
const [error, setError] =
|
|
52807
|
-
const [previousPage, setPreviousPage] =
|
|
52909
|
+
const [loading, setLoading] = useState39(true);
|
|
52910
|
+
const [error, setError] = useState39(void 0);
|
|
52911
|
+
const [previousPage, setPreviousPage] = useState39(0);
|
|
52808
52912
|
const processedReport = useMemo27(() => {
|
|
52809
52913
|
return reportId && allReportsById[reportId] ? convertInternalReportToReport(
|
|
52810
52914
|
mergeComparisonRange(allReportsById[reportId]),
|
|
@@ -52813,7 +52917,7 @@ var useQuill = (reportId, pagination) => {
|
|
|
52813
52917
|
"useQuill"
|
|
52814
52918
|
) : void 0;
|
|
52815
52919
|
}, [reportId, reportId && allReportsById[reportId], specificReportFilters]);
|
|
52816
|
-
const [additionalProcessing, setAdditionProcessing] =
|
|
52920
|
+
const [additionalProcessing, setAdditionProcessing] = useState39(
|
|
52817
52921
|
pagination ? {
|
|
52818
52922
|
page: pagination
|
|
52819
52923
|
} : void 0
|
|
@@ -52962,7 +53066,7 @@ var useQuill = (reportId, pagination) => {
|
|
|
52962
53066
|
setLoading(false);
|
|
52963
53067
|
}
|
|
52964
53068
|
};
|
|
52965
|
-
|
|
53069
|
+
useEffect32(() => {
|
|
52966
53070
|
if (isClientLoading) return;
|
|
52967
53071
|
if (reportId && specificReportFilters) {
|
|
52968
53072
|
fetchReportHelper(reportId, {
|
|
@@ -53029,7 +53133,7 @@ var useMemoizedRows = (reportId) => {
|
|
|
53029
53133
|
};
|
|
53030
53134
|
|
|
53031
53135
|
// src/hooks/useAskQuill.tsx
|
|
53032
|
-
import { useContext as useContext36, useEffect as
|
|
53136
|
+
import { useContext as useContext36, useEffect as useEffect33, useState as useState40 } from "react";
|
|
53033
53137
|
init_astProcessing();
|
|
53034
53138
|
init_astFilterProcessing();
|
|
53035
53139
|
init_pivotProcessing();
|
|
@@ -53062,8 +53166,8 @@ var useAskQuill = (dashboardName) => {
|
|
|
53062
53166
|
const { tenants } = useContext36(TenantContext);
|
|
53063
53167
|
const { getToken } = useContext36(FetchContext);
|
|
53064
53168
|
const { eventTracking } = useContext36(EventTrackingContext);
|
|
53065
|
-
const [astInfo, setAstInfo] =
|
|
53066
|
-
const [data, setData] =
|
|
53169
|
+
const [astInfo, setAstInfo] = useState40(void 0);
|
|
53170
|
+
const [data, setData] = useState40({
|
|
53067
53171
|
rows: [],
|
|
53068
53172
|
columns: [],
|
|
53069
53173
|
pivot: null,
|
|
@@ -53073,9 +53177,9 @@ var useAskQuill = (dashboardName) => {
|
|
|
53073
53177
|
pivotColumnFields: [],
|
|
53074
53178
|
pivotValueFields: []
|
|
53075
53179
|
});
|
|
53076
|
-
const [loading, setLoading] =
|
|
53077
|
-
const [error, setError] =
|
|
53078
|
-
const [ask, setAsk] =
|
|
53180
|
+
const [loading, setLoading] = useState40(false);
|
|
53181
|
+
const [error, setError] = useState40(void 0);
|
|
53182
|
+
const [ask, setAsk] = useState40(
|
|
53079
53183
|
async () => void 0
|
|
53080
53184
|
);
|
|
53081
53185
|
const askHelper = async (query) => {
|
|
@@ -53275,7 +53379,7 @@ var useAskQuill = (dashboardName) => {
|
|
|
53275
53379
|
});
|
|
53276
53380
|
setLoading(false);
|
|
53277
53381
|
};
|
|
53278
|
-
|
|
53382
|
+
useEffect33(() => {
|
|
53279
53383
|
setAsk(() => askHelper);
|
|
53280
53384
|
}, [schemaData.schema]);
|
|
53281
53385
|
return {
|
|
@@ -53289,13 +53393,13 @@ var useAskQuill = (dashboardName) => {
|
|
|
53289
53393
|
};
|
|
53290
53394
|
|
|
53291
53395
|
// src/hooks/useVirtualTables.tsx
|
|
53292
|
-
import { useContext as useContext37, useState as
|
|
53396
|
+
import { useContext as useContext37, useState as useState41 } from "react";
|
|
53293
53397
|
var useVirtualTables = () => {
|
|
53294
53398
|
const [schemaData, setSchemaData] = useContext37(SchemaDataContext);
|
|
53295
53399
|
const { tenants } = useContext37(TenantContext);
|
|
53296
53400
|
const { getToken, quillFetchWithToken } = useContext37(FetchContext);
|
|
53297
53401
|
const { eventTracking } = useContext37(EventTrackingContext);
|
|
53298
|
-
const [loadingTables, setLoadingTables] =
|
|
53402
|
+
const [loadingTables, setLoadingTables] = useState41({});
|
|
53299
53403
|
const handleReload = async (client, caller) => {
|
|
53300
53404
|
setSchemaData({ ...schemaData, isSchemaLoading: true });
|
|
53301
53405
|
setLoadingTables(
|