@quillsql/react 2.16.4 → 2.16.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1325 -1205
- package/dist/index.d.cts +3 -10
- package/dist/index.d.ts +3 -10
- package/dist/index.js +1082 -957
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -19415,10 +19415,10 @@ __export(index_exports, {
|
|
|
19415
19415
|
module.exports = __toCommonJS(index_exports);
|
|
19416
19416
|
|
|
19417
19417
|
// src/Dashboard.tsx
|
|
19418
|
-
var
|
|
19418
|
+
var import_react38 = require("react");
|
|
19419
19419
|
|
|
19420
19420
|
// src/Chart.tsx
|
|
19421
|
-
var
|
|
19421
|
+
var import_react30 = require("react");
|
|
19422
19422
|
|
|
19423
19423
|
// src/utils/csv.ts
|
|
19424
19424
|
init_valueFormatter();
|
|
@@ -25544,11 +25544,11 @@ var PieChartWrapper = import_react5.default.forwardRef(
|
|
|
25544
25544
|
var PieChart_default = PieChartWrapper;
|
|
25545
25545
|
|
|
25546
25546
|
// src/components/QuillTable.tsx
|
|
25547
|
-
var
|
|
25547
|
+
var import_react13 = require("react");
|
|
25548
25548
|
init_valueFormatter();
|
|
25549
25549
|
|
|
25550
25550
|
// src/components/UiComponents.tsx
|
|
25551
|
-
var
|
|
25551
|
+
var import_react12 = require("react");
|
|
25552
25552
|
|
|
25553
25553
|
// src/assets/ArrowDownHeadIcon.tsx
|
|
25554
25554
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
@@ -25799,6 +25799,141 @@ var import_react9 = require("react");
|
|
|
25799
25799
|
// src/hooks/useSelectOnKeyDown.tsx
|
|
25800
25800
|
var import_react10 = require("react");
|
|
25801
25801
|
|
|
25802
|
+
// src/hooks/useResponsiveFirstChildWidth.ts
|
|
25803
|
+
var import_react11 = require("react");
|
|
25804
|
+
var DEFAULT_MIN_WIDTH = 0;
|
|
25805
|
+
var parseNumericValue = (value) => {
|
|
25806
|
+
if (!value) {
|
|
25807
|
+
return 0;
|
|
25808
|
+
}
|
|
25809
|
+
const parsed = parseFloat(value);
|
|
25810
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
25811
|
+
};
|
|
25812
|
+
var getHorizontalGap = (element, explicitGap) => {
|
|
25813
|
+
if (typeof explicitGap === "number") {
|
|
25814
|
+
return explicitGap;
|
|
25815
|
+
}
|
|
25816
|
+
const computedStyle = window.getComputedStyle(element);
|
|
25817
|
+
const columnGap = parseNumericValue(computedStyle.columnGap);
|
|
25818
|
+
if (columnGap > 0) {
|
|
25819
|
+
return columnGap;
|
|
25820
|
+
}
|
|
25821
|
+
const genericGap = parseNumericValue(computedStyle.gap);
|
|
25822
|
+
return genericGap;
|
|
25823
|
+
};
|
|
25824
|
+
var calculateFirstChildWidth = (element, options) => {
|
|
25825
|
+
const { gap, minWidth, maxWidth } = options;
|
|
25826
|
+
const computedStyle = window.getComputedStyle(element);
|
|
25827
|
+
const horizontalPadding = parseNumericValue(computedStyle.paddingLeft) + parseNumericValue(computedStyle.paddingRight);
|
|
25828
|
+
const availableWidth = Math.max(
|
|
25829
|
+
0,
|
|
25830
|
+
element.clientWidth - horizontalPadding
|
|
25831
|
+
);
|
|
25832
|
+
const children = Array.from(element.children);
|
|
25833
|
+
if (!children.length) {
|
|
25834
|
+
return Math.max(minWidth ?? DEFAULT_MIN_WIDTH, 0);
|
|
25835
|
+
}
|
|
25836
|
+
const siblings = children.slice(1);
|
|
25837
|
+
const gapCount = Math.max(children.length - 1, 0);
|
|
25838
|
+
const effectiveGap = getHorizontalGap(element, gap) * gapCount;
|
|
25839
|
+
let siblingsWidth = 0;
|
|
25840
|
+
siblings.forEach((child) => {
|
|
25841
|
+
const rect = child.getBoundingClientRect();
|
|
25842
|
+
const childStyle = window.getComputedStyle(child);
|
|
25843
|
+
siblingsWidth += rect.width + parseNumericValue(childStyle.marginLeft) + parseNumericValue(childStyle.marginRight);
|
|
25844
|
+
});
|
|
25845
|
+
const rawWidth = Math.max(0, availableWidth - siblingsWidth - effectiveGap);
|
|
25846
|
+
const min2 = Math.max(minWidth ?? DEFAULT_MIN_WIDTH, 0);
|
|
25847
|
+
const max2 = typeof maxWidth === "number" && Number.isFinite(maxWidth) ? Math.max(maxWidth, min2) : void 0;
|
|
25848
|
+
const clampedWidth = max2 !== void 0 ? Math.min(Math.max(rawWidth, min2), max2) : Math.max(rawWidth, min2);
|
|
25849
|
+
return Math.floor(clampedWidth);
|
|
25850
|
+
};
|
|
25851
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react11.useLayoutEffect : import_react11.useEffect;
|
|
25852
|
+
var useResponsiveFirstChildWidth = (containerRef, options = {}) => {
|
|
25853
|
+
const {
|
|
25854
|
+
gap,
|
|
25855
|
+
initialWidth = -1,
|
|
25856
|
+
minWidth = DEFAULT_MIN_WIDTH,
|
|
25857
|
+
maxWidth
|
|
25858
|
+
} = options;
|
|
25859
|
+
const [width, setWidth] = (0, import_react11.useState)(initialWidth);
|
|
25860
|
+
const previousWidthRef = (0, import_react11.useRef)(initialWidth);
|
|
25861
|
+
useIsomorphicLayoutEffect(() => {
|
|
25862
|
+
const element = containerRef?.current ?? null;
|
|
25863
|
+
if (!element || typeof window === "undefined") {
|
|
25864
|
+
return;
|
|
25865
|
+
}
|
|
25866
|
+
let frameId = null;
|
|
25867
|
+
const updateWidth = () => {
|
|
25868
|
+
if (!element.isConnected) {
|
|
25869
|
+
return;
|
|
25870
|
+
}
|
|
25871
|
+
const nextWidth = calculateFirstChildWidth(element, {
|
|
25872
|
+
gap,
|
|
25873
|
+
minWidth,
|
|
25874
|
+
maxWidth
|
|
25875
|
+
});
|
|
25876
|
+
if (frameId !== null) {
|
|
25877
|
+
cancelAnimationFrame(frameId);
|
|
25878
|
+
}
|
|
25879
|
+
frameId = window.requestAnimationFrame(() => {
|
|
25880
|
+
frameId = null;
|
|
25881
|
+
if (Math.abs(previousWidthRef.current - nextWidth) > 0.5) {
|
|
25882
|
+
previousWidthRef.current = nextWidth;
|
|
25883
|
+
setWidth(nextWidth);
|
|
25884
|
+
}
|
|
25885
|
+
});
|
|
25886
|
+
};
|
|
25887
|
+
if (typeof ResizeObserver === "undefined") {
|
|
25888
|
+
updateWidth();
|
|
25889
|
+
const handleResize = () => updateWidth();
|
|
25890
|
+
window.addEventListener("resize", handleResize);
|
|
25891
|
+
return () => {
|
|
25892
|
+
if (frameId !== null) {
|
|
25893
|
+
cancelAnimationFrame(frameId);
|
|
25894
|
+
}
|
|
25895
|
+
window.removeEventListener("resize", handleResize);
|
|
25896
|
+
};
|
|
25897
|
+
}
|
|
25898
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
25899
|
+
updateWidth();
|
|
25900
|
+
});
|
|
25901
|
+
const observeChildren = () => {
|
|
25902
|
+
resizeObserver.observe(element);
|
|
25903
|
+
Array.from(element.children).forEach((child) => {
|
|
25904
|
+
resizeObserver.observe(child);
|
|
25905
|
+
});
|
|
25906
|
+
};
|
|
25907
|
+
observeChildren();
|
|
25908
|
+
updateWidth();
|
|
25909
|
+
const mutationObserver = new MutationObserver((mutations) => {
|
|
25910
|
+
mutations.forEach((mutation) => {
|
|
25911
|
+
mutation.addedNodes.forEach((node) => {
|
|
25912
|
+
if (node instanceof HTMLElement) {
|
|
25913
|
+
resizeObserver.observe(node);
|
|
25914
|
+
}
|
|
25915
|
+
});
|
|
25916
|
+
mutation.removedNodes.forEach((node) => {
|
|
25917
|
+
if (node instanceof HTMLElement) {
|
|
25918
|
+
resizeObserver.unobserve(node);
|
|
25919
|
+
}
|
|
25920
|
+
});
|
|
25921
|
+
});
|
|
25922
|
+
updateWidth();
|
|
25923
|
+
});
|
|
25924
|
+
mutationObserver.observe(element, { childList: true });
|
|
25925
|
+
return () => {
|
|
25926
|
+
if (frameId !== null) {
|
|
25927
|
+
cancelAnimationFrame(frameId);
|
|
25928
|
+
}
|
|
25929
|
+
resizeObserver.disconnect();
|
|
25930
|
+
mutationObserver.disconnect();
|
|
25931
|
+
};
|
|
25932
|
+
}, [containerRef?.current, gap, minWidth, maxWidth]);
|
|
25933
|
+
return width;
|
|
25934
|
+
};
|
|
25935
|
+
var useResponsiveFirstChildWidth_default = useResponsiveFirstChildWidth;
|
|
25936
|
+
|
|
25802
25937
|
// src/components/UiComponents.tsx
|
|
25803
25938
|
var import_react_dom2 = require("react-dom");
|
|
25804
25939
|
|
|
@@ -25819,7 +25954,7 @@ var getScrollableParent = (element) => {
|
|
|
25819
25954
|
|
|
25820
25955
|
// src/components/UiComponents.tsx
|
|
25821
25956
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
25822
|
-
var QuillTextInput = (0,
|
|
25957
|
+
var QuillTextInput = (0, import_react12.forwardRef)(
|
|
25823
25958
|
({
|
|
25824
25959
|
id: id2,
|
|
25825
25960
|
value,
|
|
@@ -25829,15 +25964,20 @@ var QuillTextInput = (0, import_react11.forwardRef)(
|
|
|
25829
25964
|
onChange,
|
|
25830
25965
|
disabled
|
|
25831
25966
|
}, ref) => {
|
|
25832
|
-
const [theme] = (0,
|
|
25967
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
25968
|
+
const isNumericWidth = typeof width === "number";
|
|
25969
|
+
const resolvedWidth = typeof width === "string" ? width : isNumericWidth ? width : "100%";
|
|
25833
25970
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
25834
25971
|
"label",
|
|
25835
25972
|
{
|
|
25836
25973
|
style: {
|
|
25837
25974
|
position: "relative",
|
|
25838
25975
|
borderRadius: "6px",
|
|
25839
|
-
|
|
25840
|
-
|
|
25976
|
+
display: "flex",
|
|
25977
|
+
flexDirection: "column",
|
|
25978
|
+
width: resolvedWidth,
|
|
25979
|
+
minWidth: isNumericWidth ? width : 0,
|
|
25980
|
+
flex: isNumericWidth ? "0 0 auto" : "1 1 auto"
|
|
25841
25981
|
},
|
|
25842
25982
|
children: [
|
|
25843
25983
|
label && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
@@ -25859,6 +25999,7 @@ var QuillTextInput = (0, import_react11.forwardRef)(
|
|
|
25859
25999
|
ref,
|
|
25860
26000
|
style: {
|
|
25861
26001
|
display: "flex",
|
|
26002
|
+
flex: "1 1 auto",
|
|
25862
26003
|
height: 40,
|
|
25863
26004
|
minHeight: 40,
|
|
25864
26005
|
maxHeight: 40,
|
|
@@ -25870,8 +26011,8 @@ var QuillTextInput = (0, import_react11.forwardRef)(
|
|
|
25870
26011
|
backgroundColor: theme?.backgroundColor,
|
|
25871
26012
|
color: theme?.primaryTextColor,
|
|
25872
26013
|
fontFamily: theme?.fontFamily,
|
|
25873
|
-
width,
|
|
25874
|
-
minWidth:
|
|
26014
|
+
width: "100%",
|
|
26015
|
+
minWidth: 0
|
|
25875
26016
|
},
|
|
25876
26017
|
id: id2,
|
|
25877
26018
|
value,
|
|
@@ -25893,7 +26034,7 @@ var MemoizedButton = ({
|
|
|
25893
26034
|
tooltipText,
|
|
25894
26035
|
isLoading
|
|
25895
26036
|
}) => {
|
|
25896
|
-
const [theme] = (0,
|
|
26037
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
25897
26038
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
25898
26039
|
QuillToolTipPortal,
|
|
25899
26040
|
{
|
|
@@ -25966,7 +26107,7 @@ var MemoizedSecondaryButton = ({
|
|
|
25966
26107
|
tooltipText,
|
|
25967
26108
|
width
|
|
25968
26109
|
}) => {
|
|
25969
|
-
const [theme] = (0,
|
|
26110
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
25970
26111
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
25971
26112
|
QuillToolTip,
|
|
25972
26113
|
{
|
|
@@ -26040,7 +26181,7 @@ var MemoizedSecondaryButton = ({
|
|
|
26040
26181
|
);
|
|
26041
26182
|
};
|
|
26042
26183
|
var MemoizedHeader = ({ label }) => {
|
|
26043
|
-
const [theme] = (0,
|
|
26184
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26044
26185
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
26045
26186
|
"h1",
|
|
26046
26187
|
{
|
|
@@ -26058,7 +26199,7 @@ var MemoizedHeader = ({ label }) => {
|
|
|
26058
26199
|
);
|
|
26059
26200
|
};
|
|
26060
26201
|
var MemoizedSubHeader = ({ label }) => {
|
|
26061
|
-
const [theme] = (0,
|
|
26202
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26062
26203
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
26063
26204
|
"h2",
|
|
26064
26205
|
{
|
|
@@ -26077,7 +26218,7 @@ var MemoizedSubHeader = ({ label }) => {
|
|
|
26077
26218
|
);
|
|
26078
26219
|
};
|
|
26079
26220
|
var MemoizedLabel = ({ label }) => {
|
|
26080
|
-
const [theme] = (0,
|
|
26221
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26081
26222
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
26082
26223
|
"h1",
|
|
26083
26224
|
{
|
|
@@ -26100,7 +26241,7 @@ var MemoizedCheckbox = ({
|
|
|
26100
26241
|
containerStyle,
|
|
26101
26242
|
disabled
|
|
26102
26243
|
}) => {
|
|
26103
|
-
const [theme] = (0,
|
|
26244
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26104
26245
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
26105
26246
|
"label",
|
|
26106
26247
|
{
|
|
@@ -26209,7 +26350,7 @@ var QuillTabs = ({
|
|
|
26209
26350
|
}
|
|
26210
26351
|
);
|
|
26211
26352
|
var MemoizedText = ({ label }) => {
|
|
26212
|
-
const [theme] = (0,
|
|
26353
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26213
26354
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
26214
26355
|
"p",
|
|
26215
26356
|
{
|
|
@@ -26240,11 +26381,11 @@ var MemoizedPopover = ({
|
|
|
26240
26381
|
horizontalPadding = 20,
|
|
26241
26382
|
titlePaddingLeft = 0
|
|
26242
26383
|
}) => {
|
|
26243
|
-
const [theme] = (0,
|
|
26244
|
-
const [rightAlignment, setRightAlignment] = (0,
|
|
26245
|
-
const modalRef = (0,
|
|
26246
|
-
const popoverRef = (0,
|
|
26247
|
-
(0,
|
|
26384
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26385
|
+
const [rightAlignment, setRightAlignment] = (0, import_react12.useState)("auto");
|
|
26386
|
+
const modalRef = (0, import_react12.useRef)(null);
|
|
26387
|
+
const popoverRef = (0, import_react12.useRef)(null);
|
|
26388
|
+
(0, import_react12.useEffect)(() => {
|
|
26248
26389
|
const listener = (event) => {
|
|
26249
26390
|
const target = event.target;
|
|
26250
26391
|
if (modalRef.current?.contains(target) || target.closest("[data-portal-ignore]") || ignoredRefs?.some(
|
|
@@ -26263,7 +26404,7 @@ var MemoizedPopover = ({
|
|
|
26263
26404
|
document.removeEventListener("mousedown", listener);
|
|
26264
26405
|
};
|
|
26265
26406
|
}, [isOpen, ignoredRefs, setIsOpen, modalRef]);
|
|
26266
|
-
(0,
|
|
26407
|
+
(0, import_react12.useEffect)(() => {
|
|
26267
26408
|
updatePopoverPosition();
|
|
26268
26409
|
window.addEventListener("resize", updatePopoverPosition);
|
|
26269
26410
|
return () => {
|
|
@@ -26338,7 +26479,7 @@ function MemoizedModal({
|
|
|
26338
26479
|
width,
|
|
26339
26480
|
height
|
|
26340
26481
|
}) {
|
|
26341
|
-
const [theme] = (0,
|
|
26482
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26342
26483
|
if (!isOpen) {
|
|
26343
26484
|
return null;
|
|
26344
26485
|
}
|
|
@@ -26658,11 +26799,11 @@ var QuillModalComponent = ({
|
|
|
26658
26799
|
triggerLabel,
|
|
26659
26800
|
title
|
|
26660
26801
|
}) => {
|
|
26661
|
-
const [theme] = (0,
|
|
26662
|
-
const [rightAlignment, setRightAlignment] = (0,
|
|
26663
|
-
const modalRef = (0,
|
|
26664
|
-
const popoverRef = (0,
|
|
26665
|
-
(0,
|
|
26802
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26803
|
+
const [rightAlignment, setRightAlignment] = (0, import_react12.useState)("auto");
|
|
26804
|
+
const modalRef = (0, import_react12.useRef)(null);
|
|
26805
|
+
const popoverRef = (0, import_react12.useRef)(null);
|
|
26806
|
+
(0, import_react12.useEffect)(() => {
|
|
26666
26807
|
const listener = (event) => {
|
|
26667
26808
|
if (modalRef?.current && !modalRef?.current?.contains(event.target)) {
|
|
26668
26809
|
if (setIsOpen) setIsOpen(false);
|
|
@@ -26677,7 +26818,7 @@ var QuillModalComponent = ({
|
|
|
26677
26818
|
document.removeEventListener("mousedown", listener);
|
|
26678
26819
|
};
|
|
26679
26820
|
}, [modalRef, setIsOpen, isOpen]);
|
|
26680
|
-
(0,
|
|
26821
|
+
(0, import_react12.useEffect)(() => {
|
|
26681
26822
|
updatePopoverPosition();
|
|
26682
26823
|
window.addEventListener("resize", updatePopoverPosition);
|
|
26683
26824
|
return () => {
|
|
@@ -26842,7 +26983,7 @@ var QuillErrorMessageComponent = ({
|
|
|
26842
26983
|
errorMessage,
|
|
26843
26984
|
containerStyle
|
|
26844
26985
|
}) => {
|
|
26845
|
-
const [theme] = (0,
|
|
26986
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26846
26987
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
26847
26988
|
"div",
|
|
26848
26989
|
{
|
|
@@ -26891,11 +27032,11 @@ var QuillErrorMessageComponent = ({
|
|
|
26891
27032
|
);
|
|
26892
27033
|
};
|
|
26893
27034
|
var QuillColumnSearchEmptyState = () => {
|
|
26894
|
-
const [theme] = (0,
|
|
27035
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26895
27036
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { fontFamily: theme?.fontFamily }, children: "No results found" });
|
|
26896
27037
|
};
|
|
26897
27038
|
var QuillLoadingComponent = () => {
|
|
26898
|
-
const [theme] = (0,
|
|
27039
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26899
27040
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
26900
27041
|
"div",
|
|
26901
27042
|
{
|
|
@@ -26974,9 +27115,9 @@ var OverflowContainer = ({
|
|
|
26974
27115
|
children,
|
|
26975
27116
|
style: style2
|
|
26976
27117
|
}) => {
|
|
26977
|
-
const containerRef = (0,
|
|
26978
|
-
const [showTopShadow, setShowTopShadow] = (0,
|
|
26979
|
-
const [showBottomShadow, setShowBottomShadow] = (0,
|
|
27118
|
+
const containerRef = (0, import_react12.useRef)(null);
|
|
27119
|
+
const [showTopShadow, setShowTopShadow] = (0, import_react12.useState)(false);
|
|
27120
|
+
const [showBottomShadow, setShowBottomShadow] = (0, import_react12.useState)(false);
|
|
26980
27121
|
const checkOverflow = () => {
|
|
26981
27122
|
const container = containerRef.current;
|
|
26982
27123
|
if (container) {
|
|
@@ -26987,7 +27128,7 @@ var OverflowContainer = ({
|
|
|
26987
27128
|
);
|
|
26988
27129
|
}
|
|
26989
27130
|
};
|
|
26990
|
-
(0,
|
|
27131
|
+
(0, import_react12.useEffect)(() => {
|
|
26991
27132
|
const container = containerRef.current;
|
|
26992
27133
|
if (container) {
|
|
26993
27134
|
checkOverflow();
|
|
@@ -27065,7 +27206,7 @@ var QuillToolTip = ({
|
|
|
27065
27206
|
textStyle = {},
|
|
27066
27207
|
displayBelow = false
|
|
27067
27208
|
}) => {
|
|
27068
|
-
const [theme] = (0,
|
|
27209
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
27069
27210
|
return enabled ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "tooltip-container", style: { ...containerStyle }, children: [
|
|
27070
27211
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("style", { children: `
|
|
27071
27212
|
.tooltip-container {
|
|
@@ -27140,11 +27281,11 @@ var QuillToolTipPortal = ({
|
|
|
27140
27281
|
textStyle = {},
|
|
27141
27282
|
mirror = false
|
|
27142
27283
|
}) => {
|
|
27143
|
-
const [theme] = (0,
|
|
27144
|
-
const [isOpen, setIsOpen] = (0,
|
|
27145
|
-
const tooltipRef = (0,
|
|
27146
|
-
const triggerRef = (0,
|
|
27147
|
-
const [tooltipPosition, setTooltipPosition] = (0,
|
|
27284
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
27285
|
+
const [isOpen, setIsOpen] = (0, import_react12.useState)(false);
|
|
27286
|
+
const tooltipRef = (0, import_react12.useRef)(null);
|
|
27287
|
+
const triggerRef = (0, import_react12.useRef)(null);
|
|
27288
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react12.useState)(void 0);
|
|
27148
27289
|
const updatePosition = () => {
|
|
27149
27290
|
if (triggerRef.current && tooltipRef.current) {
|
|
27150
27291
|
const rect = triggerRef.current.getBoundingClientRect();
|
|
@@ -27169,7 +27310,7 @@ var QuillToolTipPortal = ({
|
|
|
27169
27310
|
setTooltipPosition({ top, left });
|
|
27170
27311
|
}
|
|
27171
27312
|
};
|
|
27172
|
-
(0,
|
|
27313
|
+
(0, import_react12.useEffect)(() => {
|
|
27173
27314
|
if (isOpen) {
|
|
27174
27315
|
const timer2 = setTimeout(() => {
|
|
27175
27316
|
updatePosition();
|
|
@@ -27273,7 +27414,7 @@ var QuillChartBuilderCheckboxComponent = ({
|
|
|
27273
27414
|
disabled,
|
|
27274
27415
|
containerStyle
|
|
27275
27416
|
}) => {
|
|
27276
|
-
const [theme] = (0,
|
|
27417
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
27277
27418
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
27278
27419
|
"div",
|
|
27279
27420
|
{
|
|
@@ -27312,10 +27453,10 @@ var QuillPortal = ({
|
|
|
27312
27453
|
showModal,
|
|
27313
27454
|
setShowModal
|
|
27314
27455
|
}) => {
|
|
27315
|
-
const modalRef = (0,
|
|
27316
|
-
const [popoverPosition, setPopoverPosition] = (0,
|
|
27317
|
-
const [z, setZ] = (0,
|
|
27318
|
-
const scrollableParentRef = (0,
|
|
27456
|
+
const modalRef = (0, import_react12.useRef)(null);
|
|
27457
|
+
const [popoverPosition, setPopoverPosition] = (0, import_react12.useState)(void 0);
|
|
27458
|
+
const [z, setZ] = (0, import_react12.useState)(10);
|
|
27459
|
+
const scrollableParentRef = (0, import_react12.useRef)(document.body);
|
|
27319
27460
|
const updatePosition = () => {
|
|
27320
27461
|
if (anchorRef.current) {
|
|
27321
27462
|
requestAnimationFrame(() => {
|
|
@@ -27333,7 +27474,7 @@ var QuillPortal = ({
|
|
|
27333
27474
|
});
|
|
27334
27475
|
}
|
|
27335
27476
|
};
|
|
27336
|
-
(0,
|
|
27477
|
+
(0, import_react12.useEffect)(() => {
|
|
27337
27478
|
let resizeObserver;
|
|
27338
27479
|
let mutationObserver;
|
|
27339
27480
|
if (showModal && anchorRef.current) {
|
|
@@ -27430,18 +27571,18 @@ function QuillTable({
|
|
|
27430
27571
|
hideLabels,
|
|
27431
27572
|
disableSort
|
|
27432
27573
|
}) {
|
|
27433
|
-
const [activeRows, setActiveRows] = (0,
|
|
27434
|
-
const [maxPage, setMaxPage] = (0,
|
|
27435
|
-
const [sortColumn, setSortColumn] = (0,
|
|
27436
|
-
const [sortDirection, setSortDirection] = (0,
|
|
27437
|
-
const [theme] = (0,
|
|
27438
|
-
const [isPaginating, setIsPaginating] = (0,
|
|
27439
|
-
const [initialLoad, setInitialLoad] = (0,
|
|
27440
|
-
(0,
|
|
27574
|
+
const [activeRows, setActiveRows] = (0, import_react13.useState)([]);
|
|
27575
|
+
const [maxPage, setMaxPage] = (0, import_react13.useState)(1);
|
|
27576
|
+
const [sortColumn, setSortColumn] = (0, import_react13.useState)(sort?.field || "");
|
|
27577
|
+
const [sortDirection, setSortDirection] = (0, import_react13.useState)(sort?.direction || "desc");
|
|
27578
|
+
const [theme] = (0, import_react13.useContext)(ThemeContext);
|
|
27579
|
+
const [isPaginating, setIsPaginating] = (0, import_react13.useState)(true);
|
|
27580
|
+
const [initialLoad, setInitialLoad] = (0, import_react13.useState)(true);
|
|
27581
|
+
(0, import_react13.useEffect)(() => {
|
|
27441
27582
|
setSortColumn(sort?.field || "");
|
|
27442
27583
|
setSortDirection(sort?.direction || "desc");
|
|
27443
27584
|
}, [sort]);
|
|
27444
|
-
(0,
|
|
27585
|
+
(0, import_react13.useEffect)(() => {
|
|
27445
27586
|
if (rows?.length === 0 && isLoading) {
|
|
27446
27587
|
return;
|
|
27447
27588
|
}
|
|
@@ -27473,7 +27614,7 @@ function QuillTable({
|
|
|
27473
27614
|
rowCount,
|
|
27474
27615
|
isLoading
|
|
27475
27616
|
]);
|
|
27476
|
-
(0,
|
|
27617
|
+
(0, import_react13.useEffect)(() => {
|
|
27477
27618
|
if (rows.length <= currentPage * rowsPerPage) {
|
|
27478
27619
|
onPageChange && onPageChange(0);
|
|
27479
27620
|
setMaxPage(1);
|
|
@@ -28504,7 +28645,7 @@ function hashCode(obj) {
|
|
|
28504
28645
|
}
|
|
28505
28646
|
|
|
28506
28647
|
// src/components/Chart/LineChart.tsx
|
|
28507
|
-
var
|
|
28648
|
+
var import_react15 = require("react");
|
|
28508
28649
|
|
|
28509
28650
|
// src/components/Chart/CustomReferenceLine.tsx
|
|
28510
28651
|
init_constants();
|
|
@@ -28581,11 +28722,11 @@ function CustomReferenceLine({
|
|
|
28581
28722
|
}
|
|
28582
28723
|
|
|
28583
28724
|
// src/components/Chart/CustomLegend.tsx
|
|
28584
|
-
var
|
|
28725
|
+
var import_react14 = require("react");
|
|
28585
28726
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
28586
28727
|
var RenderLegend = (props) => {
|
|
28587
28728
|
const { payload } = props;
|
|
28588
|
-
const [theme] = (0,
|
|
28729
|
+
const [theme] = (0, import_react14.useContext)(ThemeContext);
|
|
28589
28730
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { style: { display: "flex", justifyContent: "flex-start" }, children: payload.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
28590
28731
|
"div",
|
|
28591
28732
|
{
|
|
@@ -28671,7 +28812,7 @@ function LineChart({
|
|
|
28671
28812
|
referenceLines,
|
|
28672
28813
|
showLegend = false
|
|
28673
28814
|
}) {
|
|
28674
|
-
const formattedData = (0,
|
|
28815
|
+
const formattedData = (0, import_react15.useMemo)(() => {
|
|
28675
28816
|
if (!data || data.length === 0) {
|
|
28676
28817
|
return createLineForEmptyChart(
|
|
28677
28818
|
yAxisFields,
|
|
@@ -28961,7 +29102,7 @@ var import_recharts3 = require("recharts");
|
|
|
28961
29102
|
init_valueFormatter();
|
|
28962
29103
|
|
|
28963
29104
|
// src/components/Chart/CustomBar.tsx
|
|
28964
|
-
var
|
|
29105
|
+
var import_react16 = require("react");
|
|
28965
29106
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
28966
29107
|
function isTopMostBarWithValue(yAxisFields, dataKey, payload) {
|
|
28967
29108
|
if (!dataKey || !yAxisFields.length) return false;
|
|
@@ -28982,7 +29123,7 @@ function createRoundedPath(x, y, width, height, radius, roundTop) {
|
|
|
28982
29123
|
return `M ${x} ${y} h ${width} v ${height - r} q 0 ${r} -${r} ${r} h -${width + 2 * r} q -${r} 0 -${r} -${r} v -${height - r} z`.replace(/\s+/g, " ").trim();
|
|
28983
29124
|
}
|
|
28984
29125
|
}
|
|
28985
|
-
var CustomBar = (0,
|
|
29126
|
+
var CustomBar = (0, import_react16.memo)((props) => {
|
|
28986
29127
|
const {
|
|
28987
29128
|
x,
|
|
28988
29129
|
y,
|
|
@@ -28998,10 +29139,10 @@ var CustomBar = (0, import_react15.memo)((props) => {
|
|
|
28998
29139
|
return null;
|
|
28999
29140
|
}
|
|
29000
29141
|
const customCornerRadius = theme?.barChartCornerRadius ?? (theme?.barChartCornerRadiusRatio ? theme?.barChartCornerRadiusRatio * width : void 0);
|
|
29001
|
-
const shouldRoundCorners = (0,
|
|
29142
|
+
const shouldRoundCorners = (0, import_react16.useMemo)(() => {
|
|
29002
29143
|
return customCornerRadius !== void 0 ? customCornerRadius > 0 : isTopMostBarWithValue(yAxisFields, dataKey, payload);
|
|
29003
29144
|
}, [customCornerRadius, yAxisFields, dataKey, payload]);
|
|
29004
|
-
const radius = (0,
|
|
29145
|
+
const radius = (0, import_react16.useMemo)(() => {
|
|
29005
29146
|
return shouldRoundCorners ? Math.min(
|
|
29006
29147
|
customCornerRadius || width * 0.1,
|
|
29007
29148
|
width / 2,
|
|
@@ -29012,7 +29153,7 @@ var CustomBar = (0, import_react15.memo)((props) => {
|
|
|
29012
29153
|
const absHeight = Math.abs(height);
|
|
29013
29154
|
const startY = isNegative ? y : y;
|
|
29014
29155
|
const endY = isNegative ? y + height : y + height;
|
|
29015
|
-
const path = (0,
|
|
29156
|
+
const path = (0, import_react16.useMemo)(() => {
|
|
29016
29157
|
if (isNegative) {
|
|
29017
29158
|
return radius > 0 ? createRoundedPath(x, startY, width, absHeight, radius, false) : `M ${x} ${startY} h ${width} v ${height} h -${width} z`;
|
|
29018
29159
|
} else {
|
|
@@ -29025,7 +29166,7 @@ CustomBar.displayName = "CustomBar";
|
|
|
29025
29166
|
var CustomBar_default = CustomBar;
|
|
29026
29167
|
|
|
29027
29168
|
// src/components/Chart/BarChart.tsx
|
|
29028
|
-
var
|
|
29169
|
+
var import_react17 = require("react");
|
|
29029
29170
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
29030
29171
|
var createCustomBar = (yAxisFields, theme) => {
|
|
29031
29172
|
return (props) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CustomBar_default, { ...props, yAxisFields, theme });
|
|
@@ -29070,7 +29211,7 @@ function BarChart({
|
|
|
29070
29211
|
}
|
|
29071
29212
|
return fields;
|
|
29072
29213
|
};
|
|
29073
|
-
const customBarShape = (0,
|
|
29214
|
+
const customBarShape = (0, import_react17.useMemo)(() => {
|
|
29074
29215
|
if (!theme?.barChartCornerRadius && !theme?.barChartCornerRadiusRatio)
|
|
29075
29216
|
return void 0;
|
|
29076
29217
|
return createCustomBar(sortYAxisFields([...yAxisFields]), theme);
|
|
@@ -29291,13 +29432,13 @@ function BarChart({
|
|
|
29291
29432
|
}
|
|
29292
29433
|
|
|
29293
29434
|
// src/components/Chart/ChartError.tsx
|
|
29294
|
-
var
|
|
29435
|
+
var import_react18 = require("react");
|
|
29295
29436
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
29296
29437
|
function ChartError({
|
|
29297
29438
|
errorMessage = "Failed to fetch data.",
|
|
29298
29439
|
containerStyle
|
|
29299
29440
|
}) {
|
|
29300
|
-
const [theme] = (0,
|
|
29441
|
+
const [theme] = (0, import_react18.useContext)(ThemeContext);
|
|
29301
29442
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
29302
29443
|
"div",
|
|
29303
29444
|
{
|
|
@@ -29346,7 +29487,7 @@ function QuillChartErrorWithAction({
|
|
|
29346
29487
|
onClick,
|
|
29347
29488
|
ButtonComponent = MemoizedButton
|
|
29348
29489
|
}) {
|
|
29349
|
-
const [theme] = (0,
|
|
29490
|
+
const [theme] = (0, import_react18.useContext)(ThemeContext);
|
|
29350
29491
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
29351
29492
|
"div",
|
|
29352
29493
|
{
|
|
@@ -29413,15 +29554,15 @@ init_Filter();
|
|
|
29413
29554
|
init_filterProcessing();
|
|
29414
29555
|
|
|
29415
29556
|
// src/components/Dashboard/DashboardFilter.tsx
|
|
29416
|
-
var
|
|
29557
|
+
var import_react23 = require("react");
|
|
29417
29558
|
init_dateRangePickerUtils();
|
|
29418
29559
|
|
|
29419
29560
|
// src/DateRangePicker/QuillDateRangePicker.tsx
|
|
29420
|
-
var
|
|
29561
|
+
var import_react20 = require("react");
|
|
29421
29562
|
var import_date_fns11 = require("date-fns");
|
|
29422
29563
|
|
|
29423
29564
|
// src/components/QuillSelect.tsx
|
|
29424
|
-
var
|
|
29565
|
+
var import_react19 = require("react");
|
|
29425
29566
|
var import_react_dom3 = require("react-dom");
|
|
29426
29567
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
29427
29568
|
function QuillSelectComponent({
|
|
@@ -29434,10 +29575,10 @@ function QuillSelectComponent({
|
|
|
29434
29575
|
disabled,
|
|
29435
29576
|
hideEmptyOption
|
|
29436
29577
|
}) {
|
|
29437
|
-
const [theme] = (0,
|
|
29438
|
-
const [showModal, setShowModal] = (0,
|
|
29439
|
-
const modalRef = (0,
|
|
29440
|
-
const buttonRef = (0,
|
|
29578
|
+
const [theme] = (0, import_react19.useContext)(ThemeContext);
|
|
29579
|
+
const [showModal, setShowModal] = (0, import_react19.useState)(false);
|
|
29580
|
+
const modalRef = (0, import_react19.useRef)(null);
|
|
29581
|
+
const buttonRef = (0, import_react19.useRef)(null);
|
|
29441
29582
|
useOnClickOutside_default(
|
|
29442
29583
|
modalRef,
|
|
29443
29584
|
(event) => {
|
|
@@ -29446,7 +29587,7 @@ function QuillSelectComponent({
|
|
|
29446
29587
|
},
|
|
29447
29588
|
showModal
|
|
29448
29589
|
);
|
|
29449
|
-
const sortedItems = (0,
|
|
29590
|
+
const sortedItems = (0, import_react19.useMemo)(() => {
|
|
29450
29591
|
return options.sort((a, b) => {
|
|
29451
29592
|
if (a.value === null) {
|
|
29452
29593
|
return -1;
|
|
@@ -29457,12 +29598,12 @@ function QuillSelectComponent({
|
|
|
29457
29598
|
return 0;
|
|
29458
29599
|
});
|
|
29459
29600
|
}, [options]);
|
|
29460
|
-
const nullLabel = (0,
|
|
29601
|
+
const nullLabel = (0, import_react19.useMemo)(() => {
|
|
29461
29602
|
return sortedItems.some((item) => item.value === "-") ? "None" : "-";
|
|
29462
29603
|
}, [sortedItems]);
|
|
29463
|
-
const [popoverPosition, setPopoverPosition] = (0,
|
|
29464
|
-
const [z, setZ] = (0,
|
|
29465
|
-
const scrollableParentRef = (0,
|
|
29604
|
+
const [popoverPosition, setPopoverPosition] = (0, import_react19.useState)(void 0);
|
|
29605
|
+
const [z, setZ] = (0, import_react19.useState)(10);
|
|
29606
|
+
const scrollableParentRef = (0, import_react19.useRef)(document.body);
|
|
29466
29607
|
const updatePosition = () => {
|
|
29467
29608
|
if (buttonRef.current) {
|
|
29468
29609
|
requestAnimationFrame(() => {
|
|
@@ -29480,7 +29621,7 @@ function QuillSelectComponent({
|
|
|
29480
29621
|
});
|
|
29481
29622
|
}
|
|
29482
29623
|
};
|
|
29483
|
-
(0,
|
|
29624
|
+
(0, import_react19.useEffect)(() => {
|
|
29484
29625
|
let resizeObserver;
|
|
29485
29626
|
let mutationObserver;
|
|
29486
29627
|
if (showModal && buttonRef.current) {
|
|
@@ -29759,25 +29900,25 @@ function QuillDateRangePicker({
|
|
|
29759
29900
|
hidePreset,
|
|
29760
29901
|
disabled
|
|
29761
29902
|
}) {
|
|
29762
|
-
const [theme] = (0,
|
|
29763
|
-
const [client] = (0,
|
|
29764
|
-
const [anchorStartDate, setAnchorStartDate] = (0,
|
|
29903
|
+
const [theme] = (0, import_react20.useContext)(ThemeContext);
|
|
29904
|
+
const [client] = (0, import_react20.useContext)(ClientContext);
|
|
29905
|
+
const [anchorStartDate, setAnchorStartDate] = (0, import_react20.useState)(
|
|
29765
29906
|
getAnchorStartDate(dateRange.startDate, dateRange.endDate)
|
|
29766
29907
|
);
|
|
29767
|
-
const [anchorEndDate, setAnchorEndDate] = (0,
|
|
29908
|
+
const [anchorEndDate, setAnchorEndDate] = (0, import_react20.useState)(
|
|
29768
29909
|
getAnchorEndDate(dateRange.startDate, dateRange.endDate)
|
|
29769
29910
|
);
|
|
29770
|
-
const [localStartDate, setLocalStartDate] = (0,
|
|
29911
|
+
const [localStartDate, setLocalStartDate] = (0, import_react20.useState)(
|
|
29771
29912
|
dateRange.startDate
|
|
29772
29913
|
);
|
|
29773
|
-
const [localEndDate, setLocalEndDate] = (0,
|
|
29914
|
+
const [localEndDate, setLocalEndDate] = (0, import_react20.useState)(
|
|
29774
29915
|
dateRange.endDate
|
|
29775
29916
|
);
|
|
29776
|
-
const [localPreset, setLocalPreset] = (0,
|
|
29777
|
-
const [showModal, setShowModal] = (0,
|
|
29778
|
-
const buttonRef = (0,
|
|
29779
|
-
const modalRef = (0,
|
|
29780
|
-
(0,
|
|
29917
|
+
const [localPreset, setLocalPreset] = (0, import_react20.useState)(preset);
|
|
29918
|
+
const [showModal, setShowModal] = (0, import_react20.useState)(false);
|
|
29919
|
+
const buttonRef = (0, import_react20.useRef)(null);
|
|
29920
|
+
const modalRef = (0, import_react20.useRef)(null);
|
|
29921
|
+
(0, import_react20.useEffect)(() => {
|
|
29781
29922
|
setLocalEndDate(dateRange.endDate);
|
|
29782
29923
|
setLocalStartDate(dateRange.startDate);
|
|
29783
29924
|
setLocalPreset(preset || "");
|
|
@@ -30288,7 +30429,7 @@ function getAnchorEndDate(startDate, endDate) {
|
|
|
30288
30429
|
}
|
|
30289
30430
|
|
|
30290
30431
|
// src/components/QuillMultiSelectWithCombo.tsx
|
|
30291
|
-
var
|
|
30432
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
30292
30433
|
var import_react_dom4 = require("react-dom");
|
|
30293
30434
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
30294
30435
|
function QuillMultiSelectComponentWithCombo({
|
|
@@ -30303,35 +30444,35 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30303
30444
|
allSelectedLabel,
|
|
30304
30445
|
style: style2
|
|
30305
30446
|
}) {
|
|
30306
|
-
const [theme] = (0,
|
|
30307
|
-
const [selectedOptions, setSelectedOptions] = (0,
|
|
30308
|
-
const [showModal, setShowModal] = (0,
|
|
30309
|
-
const modalRef = (0,
|
|
30310
|
-
const buttonRef = (0,
|
|
30311
|
-
const debounceTimeoutId = (0,
|
|
30312
|
-
const [searchQuery, setSearchQuery] =
|
|
30313
|
-
const [exceedsLimit, setExceedsLimit] = (0,
|
|
30314
|
-
const [popoverPosition, setPopoverPosition] = (0,
|
|
30315
|
-
const [z, setZ] = (0,
|
|
30316
|
-
const scrollableParentRef = (0,
|
|
30317
|
-
const selectAllRef = (0,
|
|
30447
|
+
const [theme] = (0, import_react21.useContext)(ThemeContext);
|
|
30448
|
+
const [selectedOptions, setSelectedOptions] = (0, import_react21.useState)([]);
|
|
30449
|
+
const [showModal, setShowModal] = (0, import_react21.useState)(false);
|
|
30450
|
+
const modalRef = (0, import_react21.useRef)(null);
|
|
30451
|
+
const buttonRef = (0, import_react21.useRef)(null);
|
|
30452
|
+
const debounceTimeoutId = (0, import_react21.useRef)(null);
|
|
30453
|
+
const [searchQuery, setSearchQuery] = import_react21.default.useState("");
|
|
30454
|
+
const [exceedsLimit, setExceedsLimit] = (0, import_react21.useState)(false);
|
|
30455
|
+
const [popoverPosition, setPopoverPosition] = (0, import_react21.useState)(void 0);
|
|
30456
|
+
const [z, setZ] = (0, import_react21.useState)(10);
|
|
30457
|
+
const scrollableParentRef = (0, import_react21.useRef)(document.body);
|
|
30458
|
+
const selectAllRef = (0, import_react21.useRef)(null);
|
|
30318
30459
|
let CheckboxState;
|
|
30319
30460
|
((CheckboxState2) => {
|
|
30320
30461
|
CheckboxState2[CheckboxState2["SELECTED"] = 0] = "SELECTED";
|
|
30321
30462
|
CheckboxState2[CheckboxState2["UNSELECTED"] = 1] = "UNSELECTED";
|
|
30322
30463
|
CheckboxState2[CheckboxState2["INDETERMINATE"] = 2] = "INDETERMINATE";
|
|
30323
30464
|
})(CheckboxState || (CheckboxState = {}));
|
|
30324
|
-
const optionValues = (0,
|
|
30465
|
+
const optionValues = (0, import_react21.useMemo)(
|
|
30325
30466
|
() => new Set(options.map((opt) => opt.value ?? "")),
|
|
30326
30467
|
[options]
|
|
30327
30468
|
);
|
|
30328
|
-
const potentialOptions = (0,
|
|
30469
|
+
const potentialOptions = (0, import_react21.useMemo)(() => {
|
|
30329
30470
|
return value.filter((opt) => !optionValues.has(opt ?? "")).map((opt) => ({
|
|
30330
30471
|
label: opt === "" ? "-" : opt?.toString() ?? "-",
|
|
30331
30472
|
value: opt ?? ""
|
|
30332
30473
|
})).concat(options);
|
|
30333
30474
|
}, [value, options]);
|
|
30334
|
-
const selectedOptionsLabel = (0,
|
|
30475
|
+
const selectedOptionsLabel = (0, import_react21.useMemo)(() => {
|
|
30335
30476
|
if (!value || !value.length) {
|
|
30336
30477
|
return "Select";
|
|
30337
30478
|
}
|
|
@@ -30348,7 +30489,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30348
30489
|
(elem) => elem.label ?? "-"
|
|
30349
30490
|
).join(", ");
|
|
30350
30491
|
}, [options, value]);
|
|
30351
|
-
const [selectAllCheckboxState, setSelectAllCheckboxState] = (0,
|
|
30492
|
+
const [selectAllCheckboxState, setSelectAllCheckboxState] = (0, import_react21.useState)(
|
|
30352
30493
|
(() => {
|
|
30353
30494
|
if (value.length === 0) {
|
|
30354
30495
|
return 1 /* UNSELECTED */;
|
|
@@ -30359,12 +30500,12 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30359
30500
|
return 2 /* INDETERMINATE */;
|
|
30360
30501
|
})()
|
|
30361
30502
|
);
|
|
30362
|
-
(0,
|
|
30503
|
+
(0, import_react21.useEffect)(() => {
|
|
30363
30504
|
if (selectAllRef.current) {
|
|
30364
30505
|
selectAllRef.current.indeterminate = selectAllCheckboxState === 2 /* INDETERMINATE */;
|
|
30365
30506
|
}
|
|
30366
30507
|
}, [selectAllCheckboxState, showModal]);
|
|
30367
|
-
(0,
|
|
30508
|
+
(0, import_react21.useEffect)(() => {
|
|
30368
30509
|
if (options.length > 0 && options?.[0]?.value === "EXCEEDS_LIMIT") {
|
|
30369
30510
|
setExceedsLimit(true);
|
|
30370
30511
|
} else {
|
|
@@ -30379,7 +30520,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30379
30520
|
},
|
|
30380
30521
|
showModal
|
|
30381
30522
|
);
|
|
30382
|
-
(0,
|
|
30523
|
+
(0, import_react21.useEffect)(() => {
|
|
30383
30524
|
if (!value) {
|
|
30384
30525
|
setSelectedOptions([]);
|
|
30385
30526
|
} else {
|
|
@@ -30394,7 +30535,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30394
30535
|
onChange(updatedChangeEvent);
|
|
30395
30536
|
}, 200);
|
|
30396
30537
|
};
|
|
30397
|
-
const filteredItems =
|
|
30538
|
+
const filteredItems = import_react21.default.useMemo(() => {
|
|
30398
30539
|
if (searchQuery === "") {
|
|
30399
30540
|
return potentialOptions.sort((a, b) => {
|
|
30400
30541
|
if (a.value === null) {
|
|
@@ -30424,7 +30565,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30424
30565
|
return 0;
|
|
30425
30566
|
}).slice(0, 20);
|
|
30426
30567
|
}, [potentialOptions, searchQuery]);
|
|
30427
|
-
const nullLabel = (0,
|
|
30568
|
+
const nullLabel = (0, import_react21.useMemo)(() => {
|
|
30428
30569
|
return filteredItems.some((item) => item.value === "-") ? "None" : "-";
|
|
30429
30570
|
}, [filteredItems]);
|
|
30430
30571
|
const updatePosition = () => {
|
|
@@ -30444,7 +30585,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30444
30585
|
});
|
|
30445
30586
|
}
|
|
30446
30587
|
};
|
|
30447
|
-
(0,
|
|
30588
|
+
(0, import_react21.useEffect)(() => {
|
|
30448
30589
|
let resizeObserver;
|
|
30449
30590
|
let mutationObserver;
|
|
30450
30591
|
if (showModal && buttonRef.current) {
|
|
@@ -30878,7 +31019,7 @@ var ListboxTextInput = ({
|
|
|
30878
31019
|
onChange,
|
|
30879
31020
|
placeholder
|
|
30880
31021
|
}) => {
|
|
30881
|
-
const [theme] = (0,
|
|
31022
|
+
const [theme] = (0, import_react21.useContext)(ThemeContext);
|
|
30882
31023
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
30883
31024
|
"div",
|
|
30884
31025
|
{
|
|
@@ -30948,7 +31089,7 @@ var ListboxTextInput = ({
|
|
|
30948
31089
|
};
|
|
30949
31090
|
|
|
30950
31091
|
// src/components/QuillSelectWithCombo.tsx
|
|
30951
|
-
var
|
|
31092
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
30952
31093
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
30953
31094
|
function QuillSelectComponentWithCombo({
|
|
30954
31095
|
options,
|
|
@@ -30960,12 +31101,12 @@ function QuillSelectComponentWithCombo({
|
|
|
30960
31101
|
hideEmptyOption,
|
|
30961
31102
|
disabled
|
|
30962
31103
|
}) {
|
|
30963
|
-
const [theme] = (0,
|
|
30964
|
-
const [showModal, setShowModal] = (0,
|
|
30965
|
-
const modalRef = (0,
|
|
30966
|
-
const buttonRef = (0,
|
|
30967
|
-
const [searchQuery, setSearchQuery] =
|
|
30968
|
-
const filteredItems =
|
|
31104
|
+
const [theme] = (0, import_react22.useContext)(ThemeContext);
|
|
31105
|
+
const [showModal, setShowModal] = (0, import_react22.useState)(false);
|
|
31106
|
+
const modalRef = (0, import_react22.useRef)(null);
|
|
31107
|
+
const buttonRef = (0, import_react22.useRef)(null);
|
|
31108
|
+
const [searchQuery, setSearchQuery] = import_react22.default.useState("");
|
|
31109
|
+
const filteredItems = import_react22.default.useMemo(() => {
|
|
30969
31110
|
if (searchQuery === "") {
|
|
30970
31111
|
return options?.sort((a, b) => {
|
|
30971
31112
|
if (a.value === null) {
|
|
@@ -30995,10 +31136,10 @@ function QuillSelectComponentWithCombo({
|
|
|
30995
31136
|
return 0;
|
|
30996
31137
|
})?.slice(0, 20) ?? [];
|
|
30997
31138
|
}, [options, searchQuery]);
|
|
30998
|
-
const nullLabel = (0,
|
|
31139
|
+
const nullLabel = (0, import_react22.useMemo)(() => {
|
|
30999
31140
|
return filteredItems.some((item) => item.value === "-") ? "None" : "-";
|
|
31000
31141
|
}, [filteredItems]);
|
|
31001
|
-
const selectedLabel = (0,
|
|
31142
|
+
const selectedLabel = (0, import_react22.useMemo)(() => {
|
|
31002
31143
|
const selectedOption = options?.find((elem) => elem.value === value);
|
|
31003
31144
|
return selectedOption && selectedOption.label == "-" ? nullLabel : selectedOption?.label ?? "Select";
|
|
31004
31145
|
}, [value, options, nullLabel]);
|
|
@@ -31266,7 +31407,7 @@ function DashboardFilter2({
|
|
|
31266
31407
|
disabled,
|
|
31267
31408
|
containerStyle
|
|
31268
31409
|
}) {
|
|
31269
|
-
const preset = (0,
|
|
31410
|
+
const preset = (0, import_react23.useMemo)(() => {
|
|
31270
31411
|
if (
|
|
31271
31412
|
/*'preset' in filter && */
|
|
31272
31413
|
"primaryRange" in filter
|
|
@@ -31467,7 +31608,7 @@ function DashboardFilter2({
|
|
|
31467
31608
|
init_paginationProcessing();
|
|
31468
31609
|
|
|
31469
31610
|
// src/components/Dashboard/MetricComponent.tsx
|
|
31470
|
-
var
|
|
31611
|
+
var import_react24 = require("react");
|
|
31471
31612
|
init_dateRangePickerUtils();
|
|
31472
31613
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
31473
31614
|
function QuillMetricComponent({
|
|
@@ -31477,7 +31618,7 @@ function QuillMetricComponent({
|
|
|
31477
31618
|
isLoading,
|
|
31478
31619
|
children
|
|
31479
31620
|
}) {
|
|
31480
|
-
const [theme] = (0,
|
|
31621
|
+
const [theme] = (0, import_react24.useContext)(ThemeContext);
|
|
31481
31622
|
const dateFilter = report?.filtersApplied?.find(
|
|
31482
31623
|
(filter) => filter.filterType === "date_range"
|
|
31483
31624
|
);
|
|
@@ -31751,7 +31892,7 @@ var MetricDisplay = ({
|
|
|
31751
31892
|
};
|
|
31752
31893
|
|
|
31753
31894
|
// src/components/Dashboard/DataLoader.tsx
|
|
31754
|
-
var
|
|
31895
|
+
var import_react25 = require("react");
|
|
31755
31896
|
init_paginationProcessing();
|
|
31756
31897
|
init_tableProcessing();
|
|
31757
31898
|
var import_fast_deep_equal2 = __toESM(require("fast-deep-equal"), 1);
|
|
@@ -31852,29 +31993,29 @@ function DataLoader({
|
|
|
31852
31993
|
dashboardName,
|
|
31853
31994
|
propagateChanges
|
|
31854
31995
|
}) {
|
|
31855
|
-
const [client] = (0,
|
|
31996
|
+
const [client] = (0, import_react25.useContext)(ClientContext);
|
|
31856
31997
|
const {
|
|
31857
31998
|
dashboardReports: dashboard,
|
|
31858
31999
|
addReport,
|
|
31859
32000
|
updateReport
|
|
31860
32001
|
} = useDashboardReports(dashboardName);
|
|
31861
|
-
const { dashboardFilters } = (0,
|
|
31862
|
-
const { tenants, flags } = (0,
|
|
31863
|
-
const { reports, reportsDispatch, fetchIndividualReport } = (0,
|
|
31864
|
-
const { reportFilters } = (0,
|
|
31865
|
-
const { getToken } = (0,
|
|
31866
|
-
const { eventTracking } = (0,
|
|
31867
|
-
const contextFilters = (0,
|
|
32002
|
+
const { dashboardFilters } = (0, import_react25.useContext)(DashboardFiltersContext);
|
|
32003
|
+
const { tenants, flags } = (0, import_react25.useContext)(TenantContext);
|
|
32004
|
+
const { reports, reportsDispatch, fetchIndividualReport } = (0, import_react25.useContext)(ReportsContext);
|
|
32005
|
+
const { reportFilters } = (0, import_react25.useContext)(ReportFiltersContext);
|
|
32006
|
+
const { getToken } = (0, import_react25.useContext)(FetchContext);
|
|
32007
|
+
const { eventTracking } = (0, import_react25.useContext)(EventTrackingContext);
|
|
32008
|
+
const contextFilters = (0, import_react25.useMemo)(() => {
|
|
31868
32009
|
return dashboardName ? Object.values(dashboardFilters[dashboardName] ?? {}).map(
|
|
31869
32010
|
(f) => f.filter
|
|
31870
32011
|
) : Object.values(reportFilters[item.id] ?? {}).map((f) => f.filter);
|
|
31871
32012
|
}, [dashboardFilters, reportFilters, dashboardName, item.id]);
|
|
31872
|
-
const [schemaData] = (0,
|
|
31873
|
-
const [loading, setLoading] = (0,
|
|
31874
|
-
const [error, setError] = (0,
|
|
31875
|
-
const [previousPage, setPreviousPage] = (0,
|
|
31876
|
-
const [additionalProcessing, setAdditionalProcessing] = (0,
|
|
31877
|
-
const chartReport = (0,
|
|
32013
|
+
const [schemaData] = (0, import_react25.useContext)(SchemaDataContext);
|
|
32014
|
+
const [loading, setLoading] = (0, import_react25.useState)(true);
|
|
32015
|
+
const [error, setError] = (0, import_react25.useState)(void 0);
|
|
32016
|
+
const [previousPage, setPreviousPage] = (0, import_react25.useState)(0);
|
|
32017
|
+
const [additionalProcessing, setAdditionalProcessing] = (0, import_react25.useState)(defaultAdditionalProcessing);
|
|
32018
|
+
const chartReport = (0, import_react25.useMemo)(() => {
|
|
31878
32019
|
const report = (dashboardName ? dashboard : reports)[item.id];
|
|
31879
32020
|
if (report) {
|
|
31880
32021
|
return convertInternalReportToReport(
|
|
@@ -31890,17 +32031,17 @@ function DataLoader({
|
|
|
31890
32031
|
reportFilters,
|
|
31891
32032
|
dashboardFilters
|
|
31892
32033
|
]);
|
|
31893
|
-
const previousFilters = (0,
|
|
31894
|
-
const previousUserFilters = (0,
|
|
31895
|
-
const previousTenants = (0,
|
|
31896
|
-
const previousCustomFields = (0,
|
|
31897
|
-
const [rowCountIsLoading, setRowCountIsLoading] = (0,
|
|
31898
|
-
const rowsRequestId = (0,
|
|
31899
|
-
const rowsAbortController = (0,
|
|
31900
|
-
const rowCountRequestId = (0,
|
|
31901
|
-
const rowCountAbortController = (0,
|
|
31902
|
-
const updateTableRowsRequestId = (0,
|
|
31903
|
-
const updateTableRowsAbortController = (0,
|
|
32034
|
+
const previousFilters = (0, import_react25.useRef)(filters);
|
|
32035
|
+
const previousUserFilters = (0, import_react25.useRef)(userFilters);
|
|
32036
|
+
const previousTenants = (0, import_react25.useRef)(tenants);
|
|
32037
|
+
const previousCustomFields = (0, import_react25.useRef)(schemaData.customFields);
|
|
32038
|
+
const [rowCountIsLoading, setRowCountIsLoading] = (0, import_react25.useState)(false);
|
|
32039
|
+
const rowsRequestId = (0, import_react25.useRef)(0);
|
|
32040
|
+
const rowsAbortController = (0, import_react25.useRef)(null);
|
|
32041
|
+
const rowCountRequestId = (0, import_react25.useRef)(0);
|
|
32042
|
+
const rowCountAbortController = (0, import_react25.useRef)(null);
|
|
32043
|
+
const updateTableRowsRequestId = (0, import_react25.useRef)(0);
|
|
32044
|
+
const updateTableRowsAbortController = (0, import_react25.useRef)(null);
|
|
31904
32045
|
const fetchRowCount = async (processing) => {
|
|
31905
32046
|
if (!client || !filters) {
|
|
31906
32047
|
if (!rowCountAbortController.current) return;
|
|
@@ -32167,7 +32308,7 @@ function DataLoader({
|
|
|
32167
32308
|
}
|
|
32168
32309
|
}
|
|
32169
32310
|
};
|
|
32170
|
-
(0,
|
|
32311
|
+
(0, import_react25.useEffect)(() => {
|
|
32171
32312
|
if (schemaData.isSchemaLoading || filterValuesEquivalent(
|
|
32172
32313
|
previousFilters.current ?? contextFilters,
|
|
32173
32314
|
filters
|
|
@@ -32197,7 +32338,7 @@ function DataLoader({
|
|
|
32197
32338
|
schemaData.customFields,
|
|
32198
32339
|
schemaData.isSchemaLoading
|
|
32199
32340
|
]);
|
|
32200
|
-
(0,
|
|
32341
|
+
(0, import_react25.useEffect)(() => {
|
|
32201
32342
|
const tempReport = (dashboardName ? dashboard : reports)[item.id];
|
|
32202
32343
|
if (tempReport?.triggerReload) {
|
|
32203
32344
|
fetchReportHelper(additionalProcessing);
|
|
@@ -32229,29 +32370,29 @@ var ChartDataLoader = ({
|
|
|
32229
32370
|
propagateChanges
|
|
32230
32371
|
}) => {
|
|
32231
32372
|
const { dashboardReports: dashboard, addReport } = useDashboardReports(dashboardName);
|
|
32232
|
-
const { dashboardFilters } = (0,
|
|
32233
|
-
const { reports, fetchIndividualReport } = (0,
|
|
32234
|
-
const { getToken } = (0,
|
|
32235
|
-
const { eventTracking } = (0,
|
|
32236
|
-
const { reportFilters } = (0,
|
|
32237
|
-
const { tenants, flags } = (0,
|
|
32238
|
-
const contextFilters = (0,
|
|
32373
|
+
const { dashboardFilters } = (0, import_react25.useContext)(DashboardFiltersContext);
|
|
32374
|
+
const { reports, fetchIndividualReport } = (0, import_react25.useContext)(ReportsContext);
|
|
32375
|
+
const { getToken } = (0, import_react25.useContext)(FetchContext);
|
|
32376
|
+
const { eventTracking } = (0, import_react25.useContext)(EventTrackingContext);
|
|
32377
|
+
const { reportFilters } = (0, import_react25.useContext)(ReportFiltersContext);
|
|
32378
|
+
const { tenants, flags } = (0, import_react25.useContext)(TenantContext);
|
|
32379
|
+
const contextFilters = (0, import_react25.useMemo)(() => {
|
|
32239
32380
|
return dashboardName ? Object.values(dashboardFilters[dashboardName] ?? {}).map(
|
|
32240
32381
|
(f) => f.filter
|
|
32241
32382
|
) : Object.values(reportFilters[item.id] ?? {}).map((f) => f.filter);
|
|
32242
32383
|
}, [dashboardFilters, reportFilters, dashboardName, item.id]);
|
|
32243
|
-
const [loading, setLoading] = (0,
|
|
32244
|
-
const [error, setError] = (0,
|
|
32245
|
-
const [client] = (0,
|
|
32246
|
-
const [schemaData] = (0,
|
|
32247
|
-
const previousFilters = (0,
|
|
32248
|
-
const previousUserFilters = (0,
|
|
32249
|
-
const previousDateBucket = (0,
|
|
32250
|
-
const previousTenants = (0,
|
|
32251
|
-
const previousCustomFields = (0,
|
|
32252
|
-
const fetchReportAbortController = (0,
|
|
32253
|
-
const rowsRequestId = (0,
|
|
32254
|
-
const chartReport = (0,
|
|
32384
|
+
const [loading, setLoading] = (0, import_react25.useState)(true);
|
|
32385
|
+
const [error, setError] = (0, import_react25.useState)(void 0);
|
|
32386
|
+
const [client] = (0, import_react25.useContext)(ClientContext);
|
|
32387
|
+
const [schemaData] = (0, import_react25.useContext)(SchemaDataContext);
|
|
32388
|
+
const previousFilters = (0, import_react25.useRef)(filters);
|
|
32389
|
+
const previousUserFilters = (0, import_react25.useRef)(userFilters);
|
|
32390
|
+
const previousDateBucket = (0, import_react25.useRef)(dateBucket);
|
|
32391
|
+
const previousTenants = (0, import_react25.useRef)(tenants);
|
|
32392
|
+
const previousCustomFields = (0, import_react25.useRef)(schemaData.customFields);
|
|
32393
|
+
const fetchReportAbortController = (0, import_react25.useRef)(null);
|
|
32394
|
+
const rowsRequestId = (0, import_react25.useRef)(0);
|
|
32395
|
+
const chartReport = (0, import_react25.useMemo)(() => {
|
|
32255
32396
|
const report = dashboardName ? dashboard[item.id] : reports[item.id];
|
|
32256
32397
|
if (!report) {
|
|
32257
32398
|
return constructReportFromItem(item);
|
|
@@ -32363,7 +32504,7 @@ var ChartDataLoader = ({
|
|
|
32363
32504
|
}
|
|
32364
32505
|
}
|
|
32365
32506
|
};
|
|
32366
|
-
(0,
|
|
32507
|
+
(0, import_react25.useEffect)(() => {
|
|
32367
32508
|
if (!filters) {
|
|
32368
32509
|
return;
|
|
32369
32510
|
}
|
|
@@ -32398,7 +32539,7 @@ var ChartDataLoader = ({
|
|
|
32398
32539
|
schemaData.customFields,
|
|
32399
32540
|
schemaData.isSchemaLoading
|
|
32400
32541
|
]);
|
|
32401
|
-
(0,
|
|
32542
|
+
(0, import_react25.useEffect)(() => {
|
|
32402
32543
|
const tempReport = (dashboardName ? dashboard : reports)[item.id];
|
|
32403
32544
|
if (tempReport && tempReport.triggerReload) {
|
|
32404
32545
|
fetchReportHelper();
|
|
@@ -32421,9 +32562,9 @@ var ChartDataLoader = ({
|
|
|
32421
32562
|
init_dateRangePickerUtils();
|
|
32422
32563
|
|
|
32423
32564
|
// src/hooks/useReport.ts
|
|
32424
|
-
var
|
|
32565
|
+
var import_react26 = require("react");
|
|
32425
32566
|
var useReports = () => {
|
|
32426
|
-
const [dashboard, dispatch2] = (0,
|
|
32567
|
+
const [dashboard, dispatch2] = (0, import_react26.useContext)(DashboardContext);
|
|
32427
32568
|
const reloadFilteredReports = (predicate) => {
|
|
32428
32569
|
for (const dashboardName of Object.keys(dashboard)) {
|
|
32429
32570
|
for (const id2 of Object.keys(dashboard[dashboardName])) {
|
|
@@ -32443,7 +32584,7 @@ var useReports = () => {
|
|
|
32443
32584
|
};
|
|
32444
32585
|
};
|
|
32445
32586
|
var useReportInternal = (reportId) => {
|
|
32446
|
-
const { loadFiltersForReport } = (0,
|
|
32587
|
+
const { loadFiltersForReport } = (0, import_react26.useContext)(ReportFiltersContext);
|
|
32447
32588
|
const { allReportsById } = useAllReports();
|
|
32448
32589
|
const reload = async (overrideFilters, customFilters = [], initiator = "Chart") => {
|
|
32449
32590
|
const dateFilter = overrideFilters.filters.find(
|
|
@@ -32475,7 +32616,7 @@ var import_fast_deep_equal3 = __toESM(require("fast-deep-equal"), 1);
|
|
|
32475
32616
|
|
|
32476
32617
|
// src/components/Chart/MapChart.tsx
|
|
32477
32618
|
var import_react_simple_maps = require("react-simple-maps");
|
|
32478
|
-
var
|
|
32619
|
+
var import_react27 = require("react");
|
|
32479
32620
|
init_valueFormatter();
|
|
32480
32621
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
32481
32622
|
var statesUrl = "https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json";
|
|
@@ -32802,23 +32943,23 @@ function USMap({
|
|
|
32802
32943
|
className,
|
|
32803
32944
|
containerStyle
|
|
32804
32945
|
}) {
|
|
32805
|
-
const containerRef = (0,
|
|
32806
|
-
const [hoveredState, setHoveredState] = (0,
|
|
32946
|
+
const containerRef = (0, import_react27.useRef)(null);
|
|
32947
|
+
const [hoveredState, setHoveredState] = (0, import_react27.useState)(
|
|
32807
32948
|
void 0
|
|
32808
32949
|
);
|
|
32809
|
-
const [hoveredCoords, setHoveredCoords] = (0,
|
|
32950
|
+
const [hoveredCoords, setHoveredCoords] = (0, import_react27.useState)(void 0);
|
|
32810
32951
|
const mappedData = data.reduce((acc, curr) => {
|
|
32811
32952
|
acc[curr[xAxisField]?.toString()] = curr;
|
|
32812
32953
|
return acc;
|
|
32813
32954
|
}, {});
|
|
32814
32955
|
const measureField = yAxisFields[0]?.field ?? xAxisField;
|
|
32815
|
-
const [scaleLog, setScaleLog] = (0,
|
|
32816
|
-
(0,
|
|
32956
|
+
const [scaleLog, setScaleLog] = (0, import_react27.useState)(null);
|
|
32957
|
+
(0, import_react27.useEffect)(() => {
|
|
32817
32958
|
import("d3-scale").then((scale) => {
|
|
32818
32959
|
setScaleLog(() => scale.scaleLog);
|
|
32819
32960
|
});
|
|
32820
32961
|
}, []);
|
|
32821
|
-
const colorScale = (0,
|
|
32962
|
+
const colorScale = (0, import_react27.useMemo)(() => {
|
|
32822
32963
|
if (!scaleLog) return () => "#FFFFFF";
|
|
32823
32964
|
const values = Object.values(mappedData).map((d) => parseFloat(d[measureField])).filter((v) => !isNaN(v));
|
|
32824
32965
|
const minValue = Math.min(...values);
|
|
@@ -32844,7 +32985,7 @@ function USMap({
|
|
|
32844
32985
|
colors,
|
|
32845
32986
|
scaleLog
|
|
32846
32987
|
]);
|
|
32847
|
-
const hoveredValue = (0,
|
|
32988
|
+
const hoveredValue = (0, import_react27.useMemo)(() => {
|
|
32848
32989
|
return !hoveredState ? void 0 : mappedData[fipsToNames[hoveredState]?.abbreviation ?? ""]?.[measureField] ?? mappedData[fipsToNames[hoveredState]?.name ?? ""]?.[measureField] ?? mappedData[fipsToNames[hoveredState]?.abbreviation?.toLowerCase() ?? ""]?.[measureField] ?? mappedData[fipsToNames[hoveredState]?.name?.toLowerCase() ?? ""]?.[measureField];
|
|
32849
32990
|
}, [hoveredState, mappedData, measureField]);
|
|
32850
32991
|
if (!measureField) {
|
|
@@ -32993,23 +33134,23 @@ function WorldMap({
|
|
|
32993
33134
|
className,
|
|
32994
33135
|
containerStyle
|
|
32995
33136
|
}) {
|
|
32996
|
-
const containerRef = (0,
|
|
32997
|
-
const [hoveredCountry, setHoveredCountry] = (0,
|
|
33137
|
+
const containerRef = (0, import_react27.useRef)(null);
|
|
33138
|
+
const [hoveredCountry, setHoveredCountry] = (0, import_react27.useState)(
|
|
32998
33139
|
void 0
|
|
32999
33140
|
);
|
|
33000
|
-
const [hoveredCoords, setHoveredCoords] = (0,
|
|
33141
|
+
const [hoveredCoords, setHoveredCoords] = (0, import_react27.useState)(void 0);
|
|
33001
33142
|
const mappedData = data.reduce((acc, curr) => {
|
|
33002
33143
|
acc[curr[xAxisField]?.toString()] = curr;
|
|
33003
33144
|
return acc;
|
|
33004
33145
|
}, {});
|
|
33005
33146
|
const measureField = yAxisFields[0]?.field ?? xAxisField;
|
|
33006
|
-
const [scaleLog, setScaleLog] = (0,
|
|
33007
|
-
(0,
|
|
33147
|
+
const [scaleLog, setScaleLog] = (0, import_react27.useState)(null);
|
|
33148
|
+
(0, import_react27.useEffect)(() => {
|
|
33008
33149
|
import("d3-scale").then((scale) => {
|
|
33009
33150
|
setScaleLog(() => scale.scaleLog);
|
|
33010
33151
|
});
|
|
33011
33152
|
}, []);
|
|
33012
|
-
const colorScale = (0,
|
|
33153
|
+
const colorScale = (0, import_react27.useMemo)(() => {
|
|
33013
33154
|
if (!scaleLog) return () => "#FFFFFF";
|
|
33014
33155
|
const values = Object.values(mappedData).map((d) => parseFloat(d[measureField])).filter((v) => !isNaN(v));
|
|
33015
33156
|
const minValue = Math.min(...values);
|
|
@@ -33035,7 +33176,7 @@ function WorldMap({
|
|
|
33035
33176
|
colors,
|
|
33036
33177
|
scaleLog
|
|
33037
33178
|
]);
|
|
33038
|
-
const hoveredValue = (0,
|
|
33179
|
+
const hoveredValue = (0, import_react27.useMemo)(() => {
|
|
33039
33180
|
return !hoveredCountry ? void 0 : mappedData[isoToNames[hoveredCountry]?.abbreviation ?? ""]?.[measureField] ?? mappedData[isoToNames[hoveredCountry]?.name ?? ""]?.[measureField] ?? mappedData[isoToNames[hoveredCountry]?.abbreviation?.toLowerCase() ?? ""]?.[measureField] ?? mappedData[isoToNames[hoveredCountry]?.name?.toLowerCase() ?? ""]?.[measureField];
|
|
33040
33181
|
}, [hoveredCountry, mappedData, measureField]);
|
|
33041
33182
|
if (!measureField) {
|
|
@@ -33186,8 +33327,8 @@ function MapLayout({
|
|
|
33186
33327
|
regionNames
|
|
33187
33328
|
}) {
|
|
33188
33329
|
const { projection } = (0, import_react_simple_maps.useMapContext)();
|
|
33189
|
-
const [geoCentroid, setGeoCentroid] = (0,
|
|
33190
|
-
(0,
|
|
33330
|
+
const [geoCentroid, setGeoCentroid] = (0, import_react27.useState)(null);
|
|
33331
|
+
(0, import_react27.useEffect)(() => {
|
|
33191
33332
|
import("d3-geo").then((geo) => {
|
|
33192
33333
|
setGeoCentroid(() => geo.geoCentroid);
|
|
33193
33334
|
});
|
|
@@ -33239,7 +33380,7 @@ function MapLayout({
|
|
|
33239
33380
|
}
|
|
33240
33381
|
|
|
33241
33382
|
// src/components/Chart/GaugeChart.tsx
|
|
33242
|
-
var
|
|
33383
|
+
var import_react28 = require("react");
|
|
33243
33384
|
|
|
33244
33385
|
// ../../node_modules/d3-transition/src/selection/index.js
|
|
33245
33386
|
var import_d3_selection9 = require("d3-selection");
|
|
@@ -34513,20 +34654,20 @@ function D3Gauge({
|
|
|
34513
34654
|
colors,
|
|
34514
34655
|
isAnimationActive
|
|
34515
34656
|
}) {
|
|
34516
|
-
const containerRef = (0,
|
|
34517
|
-
const svgRef = (0,
|
|
34518
|
-
const gaugeGroupRef = (0,
|
|
34519
|
-
const needleRef = (0,
|
|
34520
|
-
const needleOutlineRef = (0,
|
|
34521
|
-
const textRef = (0,
|
|
34522
|
-
const previousPercentageRef = (0,
|
|
34523
|
-
const firstMountRef = (0,
|
|
34657
|
+
const containerRef = (0, import_react28.useRef)(null);
|
|
34658
|
+
const svgRef = (0, import_react28.useRef)(null);
|
|
34659
|
+
const gaugeGroupRef = (0, import_react28.useRef)(null);
|
|
34660
|
+
const needleRef = (0, import_react28.useRef)(null);
|
|
34661
|
+
const needleOutlineRef = (0, import_react28.useRef)(null);
|
|
34662
|
+
const textRef = (0, import_react28.useRef)(null);
|
|
34663
|
+
const previousPercentageRef = (0, import_react28.useRef)(0);
|
|
34664
|
+
const firstMountRef = (0, import_react28.useRef)(true);
|
|
34524
34665
|
const startAngle = -(3 * Math.PI) / 4;
|
|
34525
34666
|
const totalAngle = 3 * Math.PI / 2;
|
|
34526
|
-
const [arc, setArc] = (0,
|
|
34527
|
-
const [interpolate, setInterpolate] = (0,
|
|
34528
|
-
const [select, setSelect] = (0,
|
|
34529
|
-
(0,
|
|
34667
|
+
const [arc, setArc] = (0, import_react28.useState)(null);
|
|
34668
|
+
const [interpolate, setInterpolate] = (0, import_react28.useState)(null);
|
|
34669
|
+
const [select, setSelect] = (0, import_react28.useState)(null);
|
|
34670
|
+
(0, import_react28.useEffect)(() => {
|
|
34530
34671
|
import("d3-shape").then(({ arc: arc2 }) => {
|
|
34531
34672
|
setArc(() => arc2);
|
|
34532
34673
|
});
|
|
@@ -34537,7 +34678,7 @@ function D3Gauge({
|
|
|
34537
34678
|
setSelect(() => select2);
|
|
34538
34679
|
});
|
|
34539
34680
|
}, []);
|
|
34540
|
-
(0,
|
|
34681
|
+
(0, import_react28.useEffect)(() => {
|
|
34541
34682
|
if (!containerRef.current || !select) return;
|
|
34542
34683
|
const container = containerRef.current;
|
|
34543
34684
|
select(container).select("svg").remove();
|
|
@@ -34554,7 +34695,7 @@ function D3Gauge({
|
|
|
34554
34695
|
svgRef.current = null;
|
|
34555
34696
|
};
|
|
34556
34697
|
}, [colors, select]);
|
|
34557
|
-
(0,
|
|
34698
|
+
(0, import_react28.useEffect)(() => {
|
|
34558
34699
|
if (!containerRef.current || !svgRef.current || !gaugeGroupRef.current || !needleRef.current || !needleOutlineRef.current || !textRef.current || !arc || !interpolate || !select)
|
|
34559
34700
|
return;
|
|
34560
34701
|
const rect = containerRef.current.getBoundingClientRect();
|
|
@@ -34654,7 +34795,7 @@ function D3Gauge({
|
|
|
34654
34795
|
arc,
|
|
34655
34796
|
interpolate
|
|
34656
34797
|
]);
|
|
34657
|
-
(0,
|
|
34798
|
+
(0, import_react28.useEffect)(() => {
|
|
34658
34799
|
if (!containerRef.current) return;
|
|
34659
34800
|
const observer = new ResizeObserver(() => {
|
|
34660
34801
|
previousPercentageRef.current = percentage;
|
|
@@ -34672,7 +34813,7 @@ function D3Gauge({
|
|
|
34672
34813
|
}
|
|
34673
34814
|
|
|
34674
34815
|
// src/components/QuillComponentTables.tsx
|
|
34675
|
-
var
|
|
34816
|
+
var import_react29 = require("react");
|
|
34676
34817
|
init_paginationProcessing();
|
|
34677
34818
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
34678
34819
|
var QuillTableSQLEditorComponent = ({
|
|
@@ -34689,8 +34830,8 @@ var QuillTableSQLEditorComponent = ({
|
|
|
34689
34830
|
setCurrentPage,
|
|
34690
34831
|
hideLabels
|
|
34691
34832
|
}) => {
|
|
34692
|
-
const [sort, setSort] = (0,
|
|
34693
|
-
const [page, setPage] = (0,
|
|
34833
|
+
const [sort, setSort] = (0, import_react29.useState)({ field: "", direction: "" });
|
|
34834
|
+
const [page, setPage] = (0, import_react29.useState)(0);
|
|
34694
34835
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
34695
34836
|
QuillTable,
|
|
34696
34837
|
{
|
|
@@ -34732,9 +34873,9 @@ var QuillTableReportBuilderComponent = ({
|
|
|
34732
34873
|
setCurrentPage,
|
|
34733
34874
|
disableSort
|
|
34734
34875
|
}) => {
|
|
34735
|
-
const [sort, setSort] = (0,
|
|
34736
|
-
const [page, setPage] = (0,
|
|
34737
|
-
(0,
|
|
34876
|
+
const [sort, setSort] = (0, import_react29.useState)({ field: "", direction: "" });
|
|
34877
|
+
const [page, setPage] = (0, import_react29.useState)(0);
|
|
34878
|
+
(0, import_react29.useEffect)(() => {
|
|
34738
34879
|
if (disableSort) {
|
|
34739
34880
|
setSort({ field: "", direction: "" });
|
|
34740
34881
|
}
|
|
@@ -34778,15 +34919,15 @@ var QuillTableComponent = ({
|
|
|
34778
34919
|
currentPage,
|
|
34779
34920
|
hideLabels
|
|
34780
34921
|
}) => {
|
|
34781
|
-
const [sort, setSort] = (0,
|
|
34782
|
-
const [page, setPage] = (0,
|
|
34783
|
-
const [initialLoad, setInitialLoad] = (0,
|
|
34784
|
-
(0,
|
|
34922
|
+
const [sort, setSort] = (0, import_react29.useState)({ field: "", direction: "" });
|
|
34923
|
+
const [page, setPage] = (0, import_react29.useState)(0);
|
|
34924
|
+
const [initialLoad, setInitialLoad] = (0, import_react29.useState)(true);
|
|
34925
|
+
(0, import_react29.useEffect)(() => {
|
|
34785
34926
|
if (initialLoad && !isLoading) {
|
|
34786
34927
|
setInitialLoad(false);
|
|
34787
34928
|
}
|
|
34788
34929
|
}, [isLoading]);
|
|
34789
|
-
(0,
|
|
34930
|
+
(0, import_react29.useEffect)(() => {
|
|
34790
34931
|
setPage(currentPage || 0);
|
|
34791
34932
|
}, [currentPage]);
|
|
34792
34933
|
if (initialLoad) {
|
|
@@ -34839,16 +34980,16 @@ function QuillTableDashboardComponent({
|
|
|
34839
34980
|
onSortChange,
|
|
34840
34981
|
hideName
|
|
34841
34982
|
}) {
|
|
34842
|
-
const [theme] = (0,
|
|
34843
|
-
const [initialLoad, setInitialLoad] = (0,
|
|
34983
|
+
const [theme] = (0, import_react29.useContext)(ThemeContext);
|
|
34984
|
+
const [initialLoad, setInitialLoad] = (0, import_react29.useState)(true);
|
|
34844
34985
|
const { downloadCSV: downloadCSV2 } = useExport(report?.id);
|
|
34845
|
-
const [page, setPage] = (0,
|
|
34846
|
-
(0,
|
|
34986
|
+
const [page, setPage] = (0, import_react29.useState)(0);
|
|
34987
|
+
(0, import_react29.useEffect)(() => {
|
|
34847
34988
|
if (!isLoading) {
|
|
34848
34989
|
setInitialLoad(false);
|
|
34849
34990
|
}
|
|
34850
34991
|
}, [isLoading]);
|
|
34851
|
-
(0,
|
|
34992
|
+
(0, import_react29.useEffect)(() => {
|
|
34852
34993
|
if (rowCountIsLoading) {
|
|
34853
34994
|
setPage(0);
|
|
34854
34995
|
}
|
|
@@ -34984,50 +35125,50 @@ function Chart({
|
|
|
34984
35125
|
dateBucket,
|
|
34985
35126
|
propagateChanges
|
|
34986
35127
|
}) {
|
|
34987
|
-
const [schemaData] = (0,
|
|
35128
|
+
const [schemaData] = (0, import_react30.useContext)(SchemaDataContext);
|
|
34988
35129
|
const { reload } = useReportInternal(reportId);
|
|
34989
|
-
const { reports, reportsDispatch, fetchIndividualReport } = (0,
|
|
35130
|
+
const { reports, reportsDispatch, fetchIndividualReport } = (0, import_react30.useContext)(ReportsContext);
|
|
34990
35131
|
const {
|
|
34991
35132
|
reportFiltersDispatch,
|
|
34992
35133
|
reportFilters,
|
|
34993
35134
|
customReportFiltersDispatch,
|
|
34994
35135
|
customReportFilters
|
|
34995
|
-
} = (0,
|
|
34996
|
-
const { eventTracking } = (0,
|
|
34997
|
-
const { isLoading: isDashboardsLoading } = (0,
|
|
34998
|
-
const { dashboardCustomFilters } = (0,
|
|
35136
|
+
} = (0, import_react30.useContext)(ReportFiltersContext);
|
|
35137
|
+
const { eventTracking } = (0, import_react30.useContext)(EventTrackingContext);
|
|
35138
|
+
const { isLoading: isDashboardsLoading } = (0, import_react30.useContext)(DashboardConfigContext);
|
|
35139
|
+
const { dashboardCustomFilters } = (0, import_react30.useContext)(DashboardFiltersContext);
|
|
34999
35140
|
const { allReportsById } = useAllReports();
|
|
35000
35141
|
const { dashboardFilters } = useDashboardInternal(
|
|
35001
35142
|
allReportsById[reportId]?.dashboardName ?? null
|
|
35002
35143
|
);
|
|
35003
|
-
const specificReportFilters = (0,
|
|
35144
|
+
const specificReportFilters = (0, import_react30.useMemo)(() => {
|
|
35004
35145
|
const reportFilterValues = reportFilters[reportId];
|
|
35005
35146
|
if (reportFilterValues && !hideFilters)
|
|
35006
35147
|
return Object.values(reportFilterValues ?? {}).map((f) => f.filter);
|
|
35007
35148
|
if (allReportsById[reportId]) return dashboardFilters ?? [];
|
|
35008
35149
|
return [];
|
|
35009
35150
|
}, [reportFilters[reportId], allReportsById[reportId], dashboardFilters]);
|
|
35010
|
-
const reportDateFilter = (0,
|
|
35151
|
+
const reportDateFilter = (0, import_react30.useMemo)(() => {
|
|
35011
35152
|
return specificReportFilters.find((f) => f.filterType === "date_range");
|
|
35012
35153
|
}, [specificReportFilters]);
|
|
35013
|
-
const presetOptions = (0,
|
|
35154
|
+
const presetOptions = (0, import_react30.useMemo)(() => {
|
|
35014
35155
|
return reportDateFilter ? convertPresetOptionsToSelectableList(
|
|
35015
35156
|
reportDateFilter.presetOptions ?? [],
|
|
35016
35157
|
reportDateFilter.defaultPresetRanges ?? []
|
|
35017
35158
|
) : defaultOptionsV2;
|
|
35018
35159
|
}, [reportDateFilter]);
|
|
35019
|
-
const userFilters = (0,
|
|
35160
|
+
const userFilters = (0, import_react30.useMemo)(() => {
|
|
35020
35161
|
return filters?.filter((f) => f.filterType !== "date" /* Date */)?.map(convertCustomFilter) ?? dashboardCustomFilters[allReportsById[reportId]?.dashboardName ?? ""];
|
|
35021
35162
|
}, [
|
|
35022
35163
|
filters,
|
|
35023
35164
|
dashboardCustomFilters[allReportsById[reportId]?.dashboardName ?? ""]
|
|
35024
35165
|
]);
|
|
35025
|
-
const previousFilters = (0,
|
|
35166
|
+
const previousFilters = (0, import_react30.useRef)(void 0);
|
|
35026
35167
|
if (!(0, import_fast_deep_equal3.default)(previousFilters.current, filters)) {
|
|
35027
35168
|
previousFilters.current = filters;
|
|
35028
35169
|
}
|
|
35029
|
-
const [filterValues, setFilterValues] = (0,
|
|
35030
|
-
(0,
|
|
35170
|
+
const [filterValues, setFilterValues] = (0, import_react30.useState)({});
|
|
35171
|
+
(0, import_react30.useEffect)(() => {
|
|
35031
35172
|
setFilterValues(
|
|
35032
35173
|
Object.values(reportFilters[reportId] ?? {}).reduce((acc, f) => {
|
|
35033
35174
|
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" ? {
|
|
@@ -35042,7 +35183,7 @@ function Chart({
|
|
|
35042
35183
|
}, {})
|
|
35043
35184
|
);
|
|
35044
35185
|
}, [reportFilters[reportId]]);
|
|
35045
|
-
(0,
|
|
35186
|
+
(0, import_react30.useEffect)(() => {
|
|
35046
35187
|
if ((0, import_fast_deep_equal3.default)(customReportFilters[reportId] ?? [], filters ?? [])) {
|
|
35047
35188
|
return;
|
|
35048
35189
|
}
|
|
@@ -35058,7 +35199,7 @@ function Chart({
|
|
|
35058
35199
|
});
|
|
35059
35200
|
};
|
|
35060
35201
|
}, [filters]);
|
|
35061
|
-
(0,
|
|
35202
|
+
(0, import_react30.useEffect)(() => {
|
|
35062
35203
|
if (reportDateFilter) {
|
|
35063
35204
|
const customDateFilter = previousFilters.current?.find(
|
|
35064
35205
|
(f) => f.filterType === "date" /* Date */
|
|
@@ -35091,20 +35232,20 @@ function Chart({
|
|
|
35091
35232
|
});
|
|
35092
35233
|
}
|
|
35093
35234
|
}, [previousFilters.current]);
|
|
35094
|
-
const dashboardReport = (0,
|
|
35235
|
+
const dashboardReport = (0, import_react30.useMemo)(
|
|
35095
35236
|
() => allReportsById[reportId],
|
|
35096
35237
|
[reportId, allReportsById]
|
|
35097
35238
|
);
|
|
35098
|
-
const report = (0,
|
|
35099
|
-
const [loading, setLoading] = (0,
|
|
35100
|
-
const [theme] = (0,
|
|
35101
|
-
const colorMap = (0,
|
|
35239
|
+
const report = (0, import_react30.useMemo)(() => reports[reportId], [reports, reportId]);
|
|
35240
|
+
const [loading, setLoading] = (0, import_react30.useState)(true);
|
|
35241
|
+
const [theme] = (0, import_react30.useContext)(ThemeContext);
|
|
35242
|
+
const colorMap = (0, import_react30.useMemo)(() => {
|
|
35102
35243
|
if (mapColorsToFields && report && theme) {
|
|
35103
35244
|
return mapColorsToFields(report, theme);
|
|
35104
35245
|
}
|
|
35105
35246
|
}, [report, theme]);
|
|
35106
|
-
const [client, clientLoading] = (0,
|
|
35107
|
-
const [error, setError] = (0,
|
|
35247
|
+
const [client, clientLoading] = (0, import_react30.useContext)(ClientContext);
|
|
35248
|
+
const [error, setError] = (0, import_react30.useState)(void 0);
|
|
35108
35249
|
const updateFilter = (filter, value, comparison) => {
|
|
35109
35250
|
let filterValue = {};
|
|
35110
35251
|
if (filter.filterType === "string" /* String */) {
|
|
@@ -35214,7 +35355,7 @@ function Chart({
|
|
|
35214
35355
|
setLoading(false);
|
|
35215
35356
|
}
|
|
35216
35357
|
};
|
|
35217
|
-
(0,
|
|
35358
|
+
(0, import_react30.useEffect)(() => {
|
|
35218
35359
|
if (reportId === void 0 || reportId === "" || clientLoading || isDashboardsLoading) {
|
|
35219
35360
|
return;
|
|
35220
35361
|
}
|
|
@@ -35402,11 +35543,11 @@ var ChartDisplay = ({
|
|
|
35402
35543
|
tableRowsLoading = false
|
|
35403
35544
|
}) => {
|
|
35404
35545
|
const { downloadCSV: downloadCSV2 } = useExport(reportId);
|
|
35405
|
-
const [theme] = (0,
|
|
35406
|
-
const { reports } = (0,
|
|
35407
|
-
const { dashboardFilters } = (0,
|
|
35408
|
-
const { reportFilters } = (0,
|
|
35409
|
-
const specificDashboardFilters = (0,
|
|
35546
|
+
const [theme] = (0, import_react30.useContext)(ThemeContext);
|
|
35547
|
+
const { reports } = (0, import_react30.useContext)(ReportsContext);
|
|
35548
|
+
const { dashboardFilters } = (0, import_react30.useContext)(DashboardFiltersContext);
|
|
35549
|
+
const { reportFilters } = (0, import_react30.useContext)(ReportFiltersContext);
|
|
35550
|
+
const specificDashboardFilters = (0, import_react30.useMemo)(() => {
|
|
35410
35551
|
if (!reportId) return [];
|
|
35411
35552
|
const dashboardName = reports[reportId]?.dashboardName || config?.dashboardName;
|
|
35412
35553
|
if (!dashboardName) return [];
|
|
@@ -35414,24 +35555,24 @@ var ChartDisplay = ({
|
|
|
35414
35555
|
(f) => f.filter
|
|
35415
35556
|
);
|
|
35416
35557
|
}, [dashboardFilters, reportId, reports]);
|
|
35417
|
-
const specificReportFilters = (0,
|
|
35558
|
+
const specificReportFilters = (0, import_react30.useMemo)(() => {
|
|
35418
35559
|
if (!reportId) return [];
|
|
35419
35560
|
return Object.values(reportFilters[reportId] ?? []).map((f) => f.filter);
|
|
35420
35561
|
}, [reportFilters, reportId]);
|
|
35421
|
-
const chartColors = (0,
|
|
35562
|
+
const chartColors = (0, import_react30.useMemo)(() => {
|
|
35422
35563
|
if (overrideTheme && overrideTheme.chartColors) {
|
|
35423
35564
|
return colors?.length ? colors : overrideTheme && overrideTheme.chartColors && overrideTheme.chartColors.length ? overrideTheme.chartColors : ["#4E80EE", "#E14F62", "#55B5A6", "#E9A23B", "#6466E9", "#55B685"];
|
|
35424
35565
|
}
|
|
35425
35566
|
return colors?.length ? colors : theme && theme.chartColors && theme.chartColors.length ? theme.chartColors : ["#4E80EE", "#E14F62", "#55B5A6", "#E9A23B", "#6466E9", "#55B685"];
|
|
35426
35567
|
}, [colors]);
|
|
35427
|
-
const dateFilter = (0,
|
|
35568
|
+
const dateFilter = (0, import_react30.useMemo)(() => {
|
|
35428
35569
|
const filters = specificReportFilters.length > 0 ? specificReportFilters : specificDashboardFilters;
|
|
35429
35570
|
if (!hideDateRangeFilter && filters) {
|
|
35430
35571
|
return findAndProcessDateFilter(filters.map((f) => f));
|
|
35431
35572
|
}
|
|
35432
35573
|
return void 0;
|
|
35433
35574
|
}, [config, specificReportFilters, specificDashboardFilters]);
|
|
35434
|
-
const [page, setPage] = (0,
|
|
35575
|
+
const [page, setPage] = (0, import_react30.useState)(0);
|
|
35435
35576
|
if (loading) {
|
|
35436
35577
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className, style: containerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(LoadingComponent, {}) });
|
|
35437
35578
|
} else if (config && !["metric", "table", "gauge", "US map", "World map"].includes(
|
|
@@ -35749,7 +35890,7 @@ function DashboardSectionContainer({
|
|
|
35749
35890
|
}
|
|
35750
35891
|
|
|
35751
35892
|
// src/components/Dashboard/ChartComponent.tsx
|
|
35752
|
-
var
|
|
35893
|
+
var import_react31 = require("react");
|
|
35753
35894
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
35754
35895
|
function QuillChartComponent({
|
|
35755
35896
|
report,
|
|
@@ -35758,7 +35899,7 @@ function QuillChartComponent({
|
|
|
35758
35899
|
children,
|
|
35759
35900
|
isLoading
|
|
35760
35901
|
}) {
|
|
35761
|
-
const [theme] = (0,
|
|
35902
|
+
const [theme] = (0, import_react31.useContext)(ThemeContext);
|
|
35762
35903
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
35763
35904
|
"div",
|
|
35764
35905
|
{
|
|
@@ -35875,7 +36016,7 @@ function QuillChartComponent({
|
|
|
35875
36016
|
}
|
|
35876
36017
|
|
|
35877
36018
|
// src/components/Dashboard/TemplateChartComponent.tsx
|
|
35878
|
-
var
|
|
36019
|
+
var import_react32 = require("react");
|
|
35879
36020
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
35880
36021
|
function QuillTemplateChartComponent({
|
|
35881
36022
|
report,
|
|
@@ -35883,7 +36024,7 @@ function QuillTemplateChartComponent({
|
|
|
35883
36024
|
children,
|
|
35884
36025
|
isLoading
|
|
35885
36026
|
}) {
|
|
35886
|
-
const [isSelected, setIsSelected] = (0,
|
|
36027
|
+
const [isSelected, setIsSelected] = (0, import_react32.useState)(false);
|
|
35887
36028
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
35888
36029
|
"div",
|
|
35889
36030
|
{
|
|
@@ -35912,13 +36053,13 @@ function QuillTemplateChartComponent({
|
|
|
35912
36053
|
}
|
|
35913
36054
|
|
|
35914
36055
|
// src/components/Dashboard/DashboardSection.tsx
|
|
35915
|
-
var
|
|
36056
|
+
var import_react33 = require("react");
|
|
35916
36057
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
35917
36058
|
function DashboardSection({
|
|
35918
36059
|
section,
|
|
35919
36060
|
children
|
|
35920
36061
|
}) {
|
|
35921
|
-
const [theme] = (0,
|
|
36062
|
+
const [theme] = (0, import_react33.useContext)(ThemeContext);
|
|
35922
36063
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
35923
36064
|
section && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { style: { display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
35924
36065
|
"h1",
|
|
@@ -35967,12 +36108,12 @@ init_tableProcessing();
|
|
|
35967
36108
|
init_filterProcessing();
|
|
35968
36109
|
|
|
35969
36110
|
// src/components/ReportBuilder/ui.tsx
|
|
35970
|
-
var
|
|
36111
|
+
var import_react34 = require("react");
|
|
35971
36112
|
init_util();
|
|
35972
36113
|
init_tableProcessing();
|
|
35973
36114
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
35974
36115
|
var QuillSecondaryButton = ({ children, ...props }) => {
|
|
35975
|
-
const [theme] = (0,
|
|
36116
|
+
const [theme] = (0, import_react34.useContext)(ThemeContext);
|
|
35976
36117
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
35977
36118
|
"button",
|
|
35978
36119
|
{
|
|
@@ -35998,9 +36139,9 @@ var QuillSecondaryButton = ({ children, ...props }) => {
|
|
|
35998
36139
|
}
|
|
35999
36140
|
);
|
|
36000
36141
|
};
|
|
36001
|
-
var QuillTag = (0,
|
|
36142
|
+
var QuillTag = (0, import_react34.forwardRef)(
|
|
36002
36143
|
({ label, onClick, children, onClickDelete, hideDelete = false }, forwardedRef) => {
|
|
36003
|
-
const [theme] = (0,
|
|
36144
|
+
const [theme] = (0, import_react34.useContext)(ThemeContext);
|
|
36004
36145
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
36005
36146
|
"div",
|
|
36006
36147
|
{
|
|
@@ -36081,7 +36222,7 @@ var QuillTag = (0, import_react33.forwardRef)(
|
|
|
36081
36222
|
var QuillSidebarHeading = ({
|
|
36082
36223
|
label
|
|
36083
36224
|
}) => {
|
|
36084
|
-
const [theme] = (0,
|
|
36225
|
+
const [theme] = (0, import_react34.useContext)(ThemeContext);
|
|
36085
36226
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
36086
36227
|
"h1",
|
|
36087
36228
|
{
|
|
@@ -36236,7 +36377,7 @@ var QuillSelectColumn = ({
|
|
|
36236
36377
|
setSelected,
|
|
36237
36378
|
DragHandle
|
|
36238
36379
|
}) => {
|
|
36239
|
-
const [theme] = (0,
|
|
36380
|
+
const [theme] = (0, import_react34.useContext)(ThemeContext);
|
|
36240
36381
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
36241
36382
|
"div",
|
|
36242
36383
|
{
|
|
@@ -36275,7 +36416,7 @@ var QuillDraggableColumn = ({
|
|
|
36275
36416
|
DragHandle,
|
|
36276
36417
|
deleteDisabled
|
|
36277
36418
|
}) => {
|
|
36278
|
-
const [theme] = (0,
|
|
36419
|
+
const [theme] = (0, import_react34.useContext)(ThemeContext);
|
|
36279
36420
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
36280
36421
|
"div",
|
|
36281
36422
|
{
|
|
@@ -36459,13 +36600,13 @@ var FilterPopoverWrapper = ({
|
|
|
36459
36600
|
getToken,
|
|
36460
36601
|
reportBuilderColumns
|
|
36461
36602
|
}) => {
|
|
36462
|
-
const { tenants } = (0,
|
|
36463
|
-
const { eventTracking } = (0,
|
|
36464
|
-
const [isOpen, setIsOpen] = (0,
|
|
36465
|
-
const [uniqueValues, setUniqueValues] = (0,
|
|
36466
|
-
const [uniqueValuesIsLoading, setUniqueValuesIsLoading] = (0,
|
|
36467
|
-
const prevFiltersRef = (0,
|
|
36468
|
-
const columnInternals = (0,
|
|
36603
|
+
const { tenants } = (0, import_react34.useContext)(TenantContext);
|
|
36604
|
+
const { eventTracking } = (0, import_react34.useContext)(EventTrackingContext);
|
|
36605
|
+
const [isOpen, setIsOpen] = (0, import_react34.useState)(false);
|
|
36606
|
+
const [uniqueValues, setUniqueValues] = (0, import_react34.useState)(void 0);
|
|
36607
|
+
const [uniqueValuesIsLoading, setUniqueValuesIsLoading] = (0, import_react34.useState)(false);
|
|
36608
|
+
const prevFiltersRef = (0, import_react34.useRef)("");
|
|
36609
|
+
const columnInternals = (0, import_react34.useMemo)(() => {
|
|
36469
36610
|
if (!tables) {
|
|
36470
36611
|
return null;
|
|
36471
36612
|
}
|
|
@@ -36479,7 +36620,7 @@ var FilterPopoverWrapper = ({
|
|
|
36479
36620
|
});
|
|
36480
36621
|
return relevantColumns;
|
|
36481
36622
|
}, [schema, tables]);
|
|
36482
|
-
(0,
|
|
36623
|
+
(0, import_react34.useEffect)(() => {
|
|
36483
36624
|
const currentFiltersString = JSON.stringify(priorFilters);
|
|
36484
36625
|
if (currentFiltersString !== prevFiltersRef.current) {
|
|
36485
36626
|
prevFiltersRef.current = currentFiltersString;
|
|
@@ -36548,7 +36689,7 @@ var FilterPopoverWrapper = ({
|
|
|
36548
36689
|
};
|
|
36549
36690
|
|
|
36550
36691
|
// src/components/ReportBuilder/FilterModal.tsx
|
|
36551
|
-
var
|
|
36692
|
+
var import_react35 = require("react");
|
|
36552
36693
|
init_Filter();
|
|
36553
36694
|
var import_date_fns13 = require("date-fns");
|
|
36554
36695
|
init_textProcessing();
|
|
@@ -36571,32 +36712,32 @@ function FilterModal({
|
|
|
36571
36712
|
MultiSelectComponent,
|
|
36572
36713
|
reportBuilderColumns
|
|
36573
36714
|
}) {
|
|
36574
|
-
const [field, setField] = (0,
|
|
36575
|
-
const [fieldOptions, setFieldOptions] = (0,
|
|
36576
|
-
const [fieldValues, setFieldValues] = (0,
|
|
36577
|
-
const [type, setType] = (0,
|
|
36578
|
-
const [value, setValue] = (0,
|
|
36579
|
-
const [selectedOptions, setSelectedOptions] = (0,
|
|
36580
|
-
const [operator, setOperator] = (0,
|
|
36715
|
+
const [field, setField] = (0, import_react35.useState)("");
|
|
36716
|
+
const [fieldOptions, setFieldOptions] = (0, import_react35.useState)([]);
|
|
36717
|
+
const [fieldValues, setFieldValues] = (0, import_react35.useState)([]);
|
|
36718
|
+
const [type, setType] = (0, import_react35.useState)(null);
|
|
36719
|
+
const [value, setValue] = (0, import_react35.useState)(void 0);
|
|
36720
|
+
const [selectedOptions, setSelectedOptions] = (0, import_react35.useState)([]);
|
|
36721
|
+
const [operator, setOperator] = (0, import_react35.useState)(
|
|
36581
36722
|
void 0
|
|
36582
36723
|
);
|
|
36583
|
-
const [operatorOptions, setOperatorOptions] = (0,
|
|
36584
|
-
const [unit, setUnit] = (0,
|
|
36585
|
-
const [unitOptions, setUnitOptions] = (0,
|
|
36586
|
-
const [startDate, setStartDate] = (0,
|
|
36724
|
+
const [operatorOptions, setOperatorOptions] = (0, import_react35.useState)([]);
|
|
36725
|
+
const [unit, setUnit] = (0, import_react35.useState)("");
|
|
36726
|
+
const [unitOptions, setUnitOptions] = (0, import_react35.useState)([]);
|
|
36727
|
+
const [startDate, setStartDate] = (0, import_react35.useState)(
|
|
36587
36728
|
(0, import_date_fns13.startOfToday)().toISOString().substring(0, 10)
|
|
36588
36729
|
);
|
|
36589
|
-
const [endDate, setEndDate] = (0,
|
|
36730
|
+
const [endDate, setEndDate] = (0, import_react35.useState)(
|
|
36590
36731
|
(0, import_date_fns13.startOfToday)().toISOString().substring(0, 10)
|
|
36591
36732
|
);
|
|
36592
|
-
const [filterInitialized, setFilterInitialized] = (0,
|
|
36593
|
-
const [table, setTable] = (0,
|
|
36594
|
-
const memoizedFieldValuesMap = (0,
|
|
36733
|
+
const [filterInitialized, setFilterInitialized] = (0, import_react35.useState)(false);
|
|
36734
|
+
const [table, setTable] = (0, import_react35.useState)(void 0);
|
|
36735
|
+
const memoizedFieldValuesMap = (0, import_react35.useMemo)(
|
|
36595
36736
|
() => fieldValuesMap,
|
|
36596
36737
|
[JSON.stringify(fieldValuesMap)]
|
|
36597
36738
|
);
|
|
36598
|
-
const memoizedFilter = (0,
|
|
36599
|
-
(0,
|
|
36739
|
+
const memoizedFilter = (0, import_react35.useMemo)(() => filter, [JSON.stringify(filter)]);
|
|
36740
|
+
(0, import_react35.useEffect)(() => {
|
|
36600
36741
|
if (!filter) {
|
|
36601
36742
|
onFieldChange(field, fieldOptions, table);
|
|
36602
36743
|
}
|
|
@@ -36641,7 +36782,7 @@ function FilterModal({
|
|
|
36641
36782
|
],
|
|
36642
36783
|
[FieldType.Null]: [NullOperator.IsNotNull, NullOperator.IsNull]
|
|
36643
36784
|
};
|
|
36644
|
-
(0,
|
|
36785
|
+
(0, import_react35.useEffect)(() => {
|
|
36645
36786
|
if (filter) {
|
|
36646
36787
|
setField(filter.field);
|
|
36647
36788
|
setTable(filter.table);
|
|
@@ -36669,7 +36810,7 @@ function FilterModal({
|
|
|
36669
36810
|
}
|
|
36670
36811
|
}
|
|
36671
36812
|
}, [memoizedFilter]);
|
|
36672
|
-
(0,
|
|
36813
|
+
(0, import_react35.useEffect)(() => {
|
|
36673
36814
|
if (schema) {
|
|
36674
36815
|
const fo = schema.flatMap((table2) => {
|
|
36675
36816
|
if (tables && !tables.includes(table2.name)) {
|
|
@@ -37351,7 +37492,7 @@ function FilterModal({
|
|
|
37351
37492
|
}
|
|
37352
37493
|
|
|
37353
37494
|
// src/components/Dashboard/TemplateMetricComponent.tsx
|
|
37354
|
-
var
|
|
37495
|
+
var import_react36 = require("react");
|
|
37355
37496
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
37356
37497
|
function QuillTemplateMetricComponent({
|
|
37357
37498
|
report,
|
|
@@ -37359,7 +37500,7 @@ function QuillTemplateMetricComponent({
|
|
|
37359
37500
|
children,
|
|
37360
37501
|
isLoading
|
|
37361
37502
|
}) {
|
|
37362
|
-
const [isSelected, setIsSelected] = (0,
|
|
37503
|
+
const [isSelected, setIsSelected] = (0, import_react36.useState)(false);
|
|
37363
37504
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
37364
37505
|
"div",
|
|
37365
37506
|
{
|
|
@@ -37388,7 +37529,7 @@ function QuillTemplateMetricComponent({
|
|
|
37388
37529
|
}
|
|
37389
37530
|
|
|
37390
37531
|
// src/components/Dashboard/TemplateTableComponent.tsx
|
|
37391
|
-
var
|
|
37532
|
+
var import_react37 = require("react");
|
|
37392
37533
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
37393
37534
|
function QuillTemplateTableComponent({
|
|
37394
37535
|
report,
|
|
@@ -37399,7 +37540,7 @@ function QuillTemplateTableComponent({
|
|
|
37399
37540
|
onPageChange,
|
|
37400
37541
|
onSortChange
|
|
37401
37542
|
}) {
|
|
37402
|
-
const [isSelected, setIsSelected] = (0,
|
|
37543
|
+
const [isSelected, setIsSelected] = (0, import_react37.useState)(false);
|
|
37403
37544
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
37404
37545
|
"div",
|
|
37405
37546
|
{
|
|
@@ -37614,14 +37755,14 @@ function Dashboard({
|
|
|
37614
37755
|
templateDashboardName,
|
|
37615
37756
|
pagination = { rowsPerPage: 10, rowsPerRequest: 50 }
|
|
37616
37757
|
}) {
|
|
37617
|
-
const [userFilters, setUserFilters] = (0,
|
|
37618
|
-
const [selectedSection, setSelectedSection] = (0,
|
|
37619
|
-
const dataLoaderUserFilters = (0,
|
|
37758
|
+
const [userFilters, setUserFilters] = (0, import_react38.useState)({});
|
|
37759
|
+
const [selectedSection, setSelectedSection] = (0, import_react38.useState)("");
|
|
37760
|
+
const dataLoaderUserFilters = (0, import_react38.useMemo)(() => {
|
|
37620
37761
|
return (filters?.map((f) => convertCustomFilter(f)) ?? []).concat(
|
|
37621
37762
|
Object.values(userFilters)
|
|
37622
37763
|
);
|
|
37623
37764
|
}, [filters, userFilters]);
|
|
37624
|
-
(0,
|
|
37765
|
+
(0, import_react38.useEffect)(() => {
|
|
37625
37766
|
onUserFiltersUpdated?.(Object.values(userFilters));
|
|
37626
37767
|
}, [userFilters]);
|
|
37627
37768
|
const {
|
|
@@ -37636,10 +37777,10 @@ function Dashboard({
|
|
|
37636
37777
|
Object.values(userFilters) ?? []
|
|
37637
37778
|
)
|
|
37638
37779
|
);
|
|
37639
|
-
const { getToken } = (0,
|
|
37640
|
-
const { customFilterDispatch } = (0,
|
|
37641
|
-
const { eventTracking } = (0,
|
|
37642
|
-
const metrics = (0,
|
|
37780
|
+
const { getToken } = (0, import_react38.useContext)(FetchContext);
|
|
37781
|
+
const { customFilterDispatch } = (0, import_react38.useContext)(DashboardFiltersContext);
|
|
37782
|
+
const { eventTracking } = (0, import_react38.useContext)(EventTrackingContext);
|
|
37783
|
+
const metrics = (0, import_react38.useMemo)(() => {
|
|
37643
37784
|
const map = {};
|
|
37644
37785
|
Object.keys(data?.sections ?? {}).forEach((section) => {
|
|
37645
37786
|
if (!data?.sections?.[section]) return;
|
|
@@ -37667,7 +37808,7 @@ function Dashboard({
|
|
|
37667
37808
|
});
|
|
37668
37809
|
return map;
|
|
37669
37810
|
}, [data?.sections, data?.sectionOrder]);
|
|
37670
|
-
const charts = (0,
|
|
37811
|
+
const charts = (0, import_react38.useMemo)(() => {
|
|
37671
37812
|
const map = {};
|
|
37672
37813
|
Object.keys(data?.sections ?? {}).forEach((section) => {
|
|
37673
37814
|
if (!data?.sections?.[section]) return;
|
|
@@ -37693,7 +37834,7 @@ function Dashboard({
|
|
|
37693
37834
|
});
|
|
37694
37835
|
return map;
|
|
37695
37836
|
}, [data?.sections, data?.sectionOrder]);
|
|
37696
|
-
const tables = (0,
|
|
37837
|
+
const tables = (0, import_react38.useMemo)(() => {
|
|
37697
37838
|
const map = {};
|
|
37698
37839
|
Object.keys(data?.sections ?? {}).forEach((section) => {
|
|
37699
37840
|
if (!data?.sections?.[section]) return;
|
|
@@ -37719,8 +37860,8 @@ function Dashboard({
|
|
|
37719
37860
|
});
|
|
37720
37861
|
return map;
|
|
37721
37862
|
}, [data?.sections, data?.sectionOrder]);
|
|
37722
|
-
const mounted = (0,
|
|
37723
|
-
(0,
|
|
37863
|
+
const mounted = (0, import_react38.useRef)(false);
|
|
37864
|
+
(0, import_react38.useEffect)(() => {
|
|
37724
37865
|
if (!mounted.current) {
|
|
37725
37866
|
mounted.current = true;
|
|
37726
37867
|
return;
|
|
@@ -37732,53 +37873,53 @@ function Dashboard({
|
|
|
37732
37873
|
filters: populatedDashboardFilters ?? []
|
|
37733
37874
|
});
|
|
37734
37875
|
}, [filters, userFilters]);
|
|
37735
|
-
(0,
|
|
37876
|
+
(0, import_react38.useEffect)(() => {
|
|
37736
37877
|
customFilterDispatch({
|
|
37737
37878
|
type: "ADD_CUSTOM_DASHBOARD_FILTERS",
|
|
37738
37879
|
dashboardName: name2,
|
|
37739
37880
|
data: dataLoaderUserFilters
|
|
37740
37881
|
});
|
|
37741
37882
|
}, [dataLoaderUserFilters]);
|
|
37742
|
-
const [client, isClientLoading] = (0,
|
|
37743
|
-
const { tenants, flags } = (0,
|
|
37744
|
-
const [theme] = (0,
|
|
37745
|
-
const [schemaData] = (0,
|
|
37746
|
-
const { dispatch: dashboardFiltersDispatch } = (0,
|
|
37883
|
+
const [client, isClientLoading] = (0, import_react38.useContext)(ClientContext);
|
|
37884
|
+
const { tenants, flags } = (0, import_react38.useContext)(TenantContext);
|
|
37885
|
+
const [theme] = (0, import_react38.useContext)(ThemeContext);
|
|
37886
|
+
const [schemaData] = (0, import_react38.useContext)(SchemaDataContext);
|
|
37887
|
+
const { dispatch: dashboardFiltersDispatch } = (0, import_react38.useContext)(
|
|
37747
37888
|
DashboardFiltersContext
|
|
37748
37889
|
);
|
|
37749
|
-
const [fieldValuesMap, setFieldValuesMap] = (0,
|
|
37750
|
-
const [fieldValuesIsLoaded, setFieldValuesIsLoaded] = (0,
|
|
37751
|
-
const [addFilterPopoverIsOpen, setAddFilterPopoverIsOpen] = (0,
|
|
37752
|
-
const [filterListIsOpen, setFilterListIsOpen] = (0,
|
|
37890
|
+
const [fieldValuesMap, setFieldValuesMap] = (0, import_react38.useState)({});
|
|
37891
|
+
const [fieldValuesIsLoaded, setFieldValuesIsLoaded] = (0, import_react38.useState)(false);
|
|
37892
|
+
const [addFilterPopoverIsOpen, setAddFilterPopoverIsOpen] = (0, import_react38.useState)(false);
|
|
37893
|
+
const [filterListIsOpen, setFilterListIsOpen] = (0, import_react38.useState)(false);
|
|
37753
37894
|
const [
|
|
37754
37895
|
filterListAddFilterPopoverIsOpen,
|
|
37755
37896
|
setFilterListAddFilterPopoverIsOpen
|
|
37756
|
-
] = (0,
|
|
37757
|
-
const presetOptions = (0,
|
|
37897
|
+
] = (0, import_react38.useState)(false);
|
|
37898
|
+
const presetOptions = (0, import_react38.useMemo)(() => {
|
|
37758
37899
|
return populatedDashboardFilters?.[0]?.filterType === "date_range" ? convertPresetOptionsToSelectableList(
|
|
37759
37900
|
populatedDashboardFilters[0].presetOptions ?? [],
|
|
37760
37901
|
populatedDashboardFilters[0].defaultPresetRanges ?? []
|
|
37761
37902
|
) : defaultOptionsV2;
|
|
37762
37903
|
}, [populatedDashboardFilters]);
|
|
37763
|
-
const [filterValues, setFilterValues] = (0,
|
|
37764
|
-
const prevNameRef = (0,
|
|
37765
|
-
const prevFlagsRef = (0,
|
|
37766
|
-
const prevClientRef = (0,
|
|
37767
|
-
const addFilterPopoverButtonRef = (0,
|
|
37768
|
-
const viewFiltersPopoverButtonRef = (0,
|
|
37769
|
-
const previousFilters = (0,
|
|
37904
|
+
const [filterValues, setFilterValues] = (0, import_react38.useState)({});
|
|
37905
|
+
const prevNameRef = (0, import_react38.useRef)(name2);
|
|
37906
|
+
const prevFlagsRef = (0, import_react38.useRef)(flags);
|
|
37907
|
+
const prevClientRef = (0, import_react38.useRef)(client?.publicKey ?? "");
|
|
37908
|
+
const addFilterPopoverButtonRef = (0, import_react38.useRef)(null);
|
|
37909
|
+
const viewFiltersPopoverButtonRef = (0, import_react38.useRef)(null);
|
|
37910
|
+
const previousFilters = (0, import_react38.useRef)(filters);
|
|
37770
37911
|
if (!(0, import_fast_deep_equal4.default)(previousFilters.current, filters)) {
|
|
37771
37912
|
previousFilters.current = filters;
|
|
37772
37913
|
}
|
|
37773
|
-
const isInitialLoadOfDashboardRef = (0,
|
|
37774
|
-
const referencedTables = (0,
|
|
37914
|
+
const isInitialLoadOfDashboardRef = (0, import_react38.useRef)(false);
|
|
37915
|
+
const referencedTables = (0, import_react38.useMemo)(() => {
|
|
37775
37916
|
const sections = data?.sections || {};
|
|
37776
37917
|
const tables2 = Object.values(sections).flatMap(
|
|
37777
37918
|
(section) => section.map((chart) => chart.referencedTables)
|
|
37778
37919
|
).flat();
|
|
37779
37920
|
return Array.from(new Set(tables2));
|
|
37780
37921
|
}, [data?.sections]);
|
|
37781
|
-
(0,
|
|
37922
|
+
(0, import_react38.useEffect)(() => {
|
|
37782
37923
|
if (prevNameRef.current === name2 && Object.values(data?.sections ?? {}).flat().length) {
|
|
37783
37924
|
return;
|
|
37784
37925
|
}
|
|
@@ -37798,8 +37939,8 @@ function Dashboard({
|
|
|
37798
37939
|
prevFlagsRef.current = flags;
|
|
37799
37940
|
});
|
|
37800
37941
|
}, [name2, isClientLoading]);
|
|
37801
|
-
const tenantMounted = (0,
|
|
37802
|
-
(0,
|
|
37942
|
+
const tenantMounted = (0, import_react38.useRef)(false);
|
|
37943
|
+
(0, import_react38.useEffect)(() => {
|
|
37803
37944
|
if (!tenantMounted.current) {
|
|
37804
37945
|
tenantMounted.current = true;
|
|
37805
37946
|
return;
|
|
@@ -37818,7 +37959,7 @@ function Dashboard({
|
|
|
37818
37959
|
isInitialLoadOfDashboardRef.current = false;
|
|
37819
37960
|
});
|
|
37820
37961
|
}, [flags]);
|
|
37821
|
-
(0,
|
|
37962
|
+
(0, import_react38.useEffect)(() => {
|
|
37822
37963
|
if (prevClientRef.current === client?.publicKey) {
|
|
37823
37964
|
return;
|
|
37824
37965
|
}
|
|
@@ -37833,7 +37974,7 @@ function Dashboard({
|
|
|
37833
37974
|
isInitialLoadOfDashboardRef.current = false;
|
|
37834
37975
|
});
|
|
37835
37976
|
}, [client?.publicKey]);
|
|
37836
|
-
(0,
|
|
37977
|
+
(0, import_react38.useEffect)(() => {
|
|
37837
37978
|
setFilterValues(
|
|
37838
37979
|
Object.values(populatedDashboardFilters ?? {}).reduce((acc, f) => {
|
|
37839
37980
|
acc[f.label] = f.filterType === "string" ? f.stringFilterType === "multiselect" ? { values: f.values, operator: "IN" } : { selectedValue: f.selectedValue } : f.filterType === "date_range" ? {
|
|
@@ -37848,7 +37989,7 @@ function Dashboard({
|
|
|
37848
37989
|
}, {})
|
|
37849
37990
|
);
|
|
37850
37991
|
}, [populatedDashboardFilters]);
|
|
37851
|
-
(0,
|
|
37992
|
+
(0, import_react38.useEffect)(() => {
|
|
37852
37993
|
const dashboardDateFilter = populatedDashboardFilters?.find(
|
|
37853
37994
|
(f) => f.filterType === "date_range"
|
|
37854
37995
|
);
|
|
@@ -37885,7 +38026,7 @@ function Dashboard({
|
|
|
37885
38026
|
});
|
|
37886
38027
|
}
|
|
37887
38028
|
}, [previousFilters.current]);
|
|
37888
|
-
(0,
|
|
38029
|
+
(0, import_react38.useEffect)(() => {
|
|
37889
38030
|
const fetchData = async () => {
|
|
37890
38031
|
setFieldValuesIsLoaded(false);
|
|
37891
38032
|
const newFieldValues = {};
|
|
@@ -38046,7 +38187,7 @@ function Dashboard({
|
|
|
38046
38187
|
[filter.field]: filter
|
|
38047
38188
|
}));
|
|
38048
38189
|
};
|
|
38049
|
-
(0,
|
|
38190
|
+
(0, import_react38.useEffect)(() => {
|
|
38050
38191
|
if (onChangeLoading && isLoading) {
|
|
38051
38192
|
onChangeLoading(isLoading);
|
|
38052
38193
|
}
|
|
@@ -38686,15 +38827,15 @@ function QuillDashboardTemplate({
|
|
|
38686
38827
|
ButtonComponent
|
|
38687
38828
|
}) {
|
|
38688
38829
|
const { isLoading, data } = useDashboardInternal(name2 ?? "");
|
|
38689
|
-
const { getToken } = (0,
|
|
38690
|
-
const { eventTracking } = (0,
|
|
38691
|
-
const { dashboardConfig, dashboardConfigDispatch } = (0,
|
|
38830
|
+
const { getToken } = (0, import_react38.useContext)(FetchContext);
|
|
38831
|
+
const { eventTracking } = (0, import_react38.useContext)(EventTrackingContext);
|
|
38832
|
+
const { dashboardConfig, dashboardConfigDispatch } = (0, import_react38.useContext)(
|
|
38692
38833
|
DashboardConfigContext
|
|
38693
38834
|
);
|
|
38694
|
-
const [addItemModalIsOpen, setAddItemModalIsOpen] = (0,
|
|
38695
|
-
const [selectedTemplates, setSelectedTemplates] = (0,
|
|
38696
|
-
const [selectingTemplate, setSelectingTemplate] = (0,
|
|
38697
|
-
const [submittingTemplate, setSubmittingTemplate] = (0,
|
|
38835
|
+
const [addItemModalIsOpen, setAddItemModalIsOpen] = (0, import_react38.useState)(false);
|
|
38836
|
+
const [selectedTemplates, setSelectedTemplates] = (0, import_react38.useState)([]);
|
|
38837
|
+
const [selectingTemplate, setSelectingTemplate] = (0, import_react38.useState)(false);
|
|
38838
|
+
const [submittingTemplate, setSubmittingTemplate] = (0, import_react38.useState)(false);
|
|
38698
38839
|
const templateSections = data?.sections;
|
|
38699
38840
|
const onSubmitTemplates = async () => {
|
|
38700
38841
|
setSubmittingTemplate(true);
|
|
@@ -38837,7 +38978,7 @@ var QuillProvider = ({
|
|
|
38837
38978
|
var QuillProvider_default = QuillProvider;
|
|
38838
38979
|
|
|
38839
38980
|
// src/Table.tsx
|
|
38840
|
-
var
|
|
38981
|
+
var import_react39 = require("react");
|
|
38841
38982
|
init_Filter();
|
|
38842
38983
|
init_paginationProcessing();
|
|
38843
38984
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
@@ -38846,26 +38987,26 @@ var Table = ({
|
|
|
38846
38987
|
...props
|
|
38847
38988
|
}) => {
|
|
38848
38989
|
const data = props;
|
|
38849
|
-
const [dashboard] = (0,
|
|
38850
|
-
const { dashboardFilters, dashboardCustomFilters } = (0,
|
|
38990
|
+
const [dashboard] = (0, import_react39.useContext)(DashboardContext);
|
|
38991
|
+
const { dashboardFilters, dashboardCustomFilters } = (0, import_react39.useContext)(
|
|
38851
38992
|
DashboardFiltersContext
|
|
38852
38993
|
);
|
|
38853
|
-
const [client, clientLoading] = (0,
|
|
38854
|
-
const [schemaData] = (0,
|
|
38855
|
-
const { eventTracking } = (0,
|
|
38994
|
+
const [client, clientLoading] = (0, import_react39.useContext)(ClientContext);
|
|
38995
|
+
const [schemaData] = (0, import_react39.useContext)(SchemaDataContext);
|
|
38996
|
+
const { eventTracking } = (0, import_react39.useContext)(EventTrackingContext);
|
|
38856
38997
|
const { allReportsById } = useAllReports();
|
|
38857
|
-
const [loading, setLoading] = (0,
|
|
38858
|
-
const report = (0,
|
|
38998
|
+
const [loading, setLoading] = (0, import_react39.useState)(false);
|
|
38999
|
+
const report = (0, import_react39.useMemo)(() => {
|
|
38859
39000
|
return props.reportId ? allReportsById[props.reportId] : null;
|
|
38860
39001
|
}, [allReportsById[props.reportId ?? ""]]);
|
|
38861
|
-
const { reportFilters, customReportFilters, reportFiltersDispatch } = (0,
|
|
38862
|
-
const { reports, fetchIndividualReport, reportsDispatch } = (0,
|
|
38863
|
-
const specificReportFilters = (0,
|
|
39002
|
+
const { reportFilters, customReportFilters, reportFiltersDispatch } = (0, import_react39.useContext)(ReportFiltersContext);
|
|
39003
|
+
const { reports, fetchIndividualReport, reportsDispatch } = (0, import_react39.useContext)(ReportsContext);
|
|
39004
|
+
const specificReportFilters = (0, import_react39.useMemo)(() => {
|
|
38864
39005
|
return Object.values(
|
|
38865
39006
|
reportFilters[props.reportId ?? ""] ?? (dashboard[report?.dashboardName ?? ""]?.[report?.id ?? ""] ? dashboardFilters[report.dashboardName] : null) ?? {}
|
|
38866
39007
|
).map((f) => f.filter);
|
|
38867
39008
|
}, [reportFilters[props.reportId ?? ""]]);
|
|
38868
|
-
const userFilters = (0,
|
|
39009
|
+
const userFilters = (0, import_react39.useMemo)(() => {
|
|
38869
39010
|
return (props.filters?.filter((f) => f.filterType !== "date" /* Date */)?.map(convertCustomFilter) ?? []).concat(
|
|
38870
39011
|
customReportFilters[props.reportId ?? ""] ?? dashboardCustomFilters[report?.dashboardName ?? ""] ?? []
|
|
38871
39012
|
);
|
|
@@ -38907,7 +39048,7 @@ var Table = ({
|
|
|
38907
39048
|
setLoading(false);
|
|
38908
39049
|
}
|
|
38909
39050
|
};
|
|
38910
|
-
(0,
|
|
39051
|
+
(0, import_react39.useEffect)(() => {
|
|
38911
39052
|
if (props.reportId === void 0 || props.reportId === "" || clientLoading) {
|
|
38912
39053
|
return;
|
|
38913
39054
|
}
|
|
@@ -38941,7 +39082,7 @@ var Table = ({
|
|
|
38941
39082
|
clientLoading,
|
|
38942
39083
|
!reports[props.reportId ?? ""]
|
|
38943
39084
|
]);
|
|
38944
|
-
const [page, setPage] = (0,
|
|
39085
|
+
const [page, setPage] = (0, import_react39.useState)(0);
|
|
38945
39086
|
if ("rows" in data && "columns" in data) {
|
|
38946
39087
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
38947
39088
|
QuillTable,
|
|
@@ -39001,27 +39142,27 @@ var Table = ({
|
|
|
39001
39142
|
var Table_default = Table;
|
|
39002
39143
|
|
|
39003
39144
|
// src/SQLEditor.tsx
|
|
39004
|
-
var
|
|
39005
|
-
var
|
|
39145
|
+
var import_react46 = require("react");
|
|
39146
|
+
var import_react47 = __toESM(require("@monaco-editor/react"), 1);
|
|
39006
39147
|
|
|
39007
39148
|
// src/ChartBuilder.tsx
|
|
39008
|
-
var
|
|
39149
|
+
var import_react44 = require("react");
|
|
39009
39150
|
var import_core = require("@dnd-kit/core");
|
|
39010
39151
|
var import_sortable = require("@dnd-kit/sortable");
|
|
39011
39152
|
var import_utilities = require("@dnd-kit/utilities");
|
|
39012
39153
|
|
|
39013
39154
|
// src/internals/ReportBuilder/PivotModal.tsx
|
|
39014
|
-
var
|
|
39155
|
+
var import_react41 = require("react");
|
|
39015
39156
|
|
|
39016
39157
|
// src/internals/ReportBuilder/PivotList.tsx
|
|
39017
39158
|
init_valueFormatter();
|
|
39018
39159
|
init_textProcessing();
|
|
39019
39160
|
|
|
39020
39161
|
// src/components/QuillCard.tsx
|
|
39021
|
-
var
|
|
39162
|
+
var import_react40 = require("react");
|
|
39022
39163
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
39023
39164
|
function QuillCard({ children, onClick, onDelete }) {
|
|
39024
|
-
const [theme] = (0,
|
|
39165
|
+
const [theme] = (0, import_react40.useContext)(ThemeContext);
|
|
39025
39166
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
39026
39167
|
"div",
|
|
39027
39168
|
{
|
|
@@ -39465,45 +39606,45 @@ var PivotModal = ({
|
|
|
39465
39606
|
heightAdjustment = 0,
|
|
39466
39607
|
reportBuilderState
|
|
39467
39608
|
}) => {
|
|
39468
|
-
const { getToken, quillFetchWithToken } = (0,
|
|
39469
|
-
const [isLoading, setIsLoading] = (0,
|
|
39470
|
-
const [previewLoading, setPreviewLoading] = (0,
|
|
39471
|
-
const [selectedPivotType, setSelectedPivotType] = (0,
|
|
39472
|
-
const [errors, setErrors] = (0,
|
|
39473
|
-
const [client] = (0,
|
|
39474
|
-
const [schemaData] = (0,
|
|
39475
|
-
const { tenants } = (0,
|
|
39476
|
-
const { eventTracking } = (0,
|
|
39477
|
-
const rowFieldRef = (0,
|
|
39478
|
-
const colFieldRef = (0,
|
|
39479
|
-
const [pivotCardWidth, setPivotCardWidth] = (0,
|
|
39480
|
-
const [samplePivotTable, setSamplePivotTable] = (0,
|
|
39481
|
-
const [hasNoRecommendedPivots, sethasNoRecommendedPivots] = (0,
|
|
39482
|
-
const [isFetchingPivots, setIsFetchingPivots] = (0,
|
|
39483
|
-
const [allowedColumnFields, setAllowedColumnFields] = (0,
|
|
39484
|
-
const [allowedRowFields, setAllowedRowFields] = (0,
|
|
39485
|
-
const [allowedValueFields, setAllowedValueFields] = (0,
|
|
39486
|
-
const [uniqueValues, setUniqueValues] = (0,
|
|
39487
|
-
const buttonRef = (0,
|
|
39488
|
-
const [dateRanges, setDateRanges] = (0,
|
|
39489
|
-
const [pivotError, setPivotError] = (0,
|
|
39490
|
-
const [limitInput, setLimitInput] = (0,
|
|
39609
|
+
const { getToken, quillFetchWithToken } = (0, import_react41.useContext)(FetchContext);
|
|
39610
|
+
const [isLoading, setIsLoading] = (0, import_react41.useState)(false);
|
|
39611
|
+
const [previewLoading, setPreviewLoading] = (0, import_react41.useState)(false);
|
|
39612
|
+
const [selectedPivotType, setSelectedPivotType] = (0, import_react41.useState)("recommended");
|
|
39613
|
+
const [errors, setErrors] = (0, import_react41.useState)([]);
|
|
39614
|
+
const [client] = (0, import_react41.useContext)(ClientContext);
|
|
39615
|
+
const [schemaData] = (0, import_react41.useContext)(SchemaDataContext);
|
|
39616
|
+
const { tenants } = (0, import_react41.useContext)(TenantContext);
|
|
39617
|
+
const { eventTracking } = (0, import_react41.useContext)(EventTrackingContext);
|
|
39618
|
+
const rowFieldRef = (0, import_react41.useRef)(null);
|
|
39619
|
+
const colFieldRef = (0, import_react41.useRef)(null);
|
|
39620
|
+
const [pivotCardWidth, setPivotCardWidth] = (0, import_react41.useState)(420);
|
|
39621
|
+
const [samplePivotTable, setSamplePivotTable] = (0, import_react41.useState)(null);
|
|
39622
|
+
const [hasNoRecommendedPivots, sethasNoRecommendedPivots] = (0, import_react41.useState)(false);
|
|
39623
|
+
const [isFetchingPivots, setIsFetchingPivots] = (0, import_react41.useState)(false);
|
|
39624
|
+
const [allowedColumnFields, setAllowedColumnFields] = (0, import_react41.useState)([]);
|
|
39625
|
+
const [allowedRowFields, setAllowedRowFields] = (0, import_react41.useState)([]);
|
|
39626
|
+
const [allowedValueFields, setAllowedValueFields] = (0, import_react41.useState)([]);
|
|
39627
|
+
const [uniqueValues, setUniqueValues] = (0, import_react41.useState)(initialUniqueValues);
|
|
39628
|
+
const buttonRef = (0, import_react41.useRef)(null);
|
|
39629
|
+
const [dateRanges, setDateRanges] = (0, import_react41.useState)({});
|
|
39630
|
+
const [pivotError, setPivotError] = (0, import_react41.useState)("");
|
|
39631
|
+
const [limitInput, setLimitInput] = (0, import_react41.useState)(
|
|
39491
39632
|
pivotLimit?.toString() ?? "100"
|
|
39492
39633
|
);
|
|
39493
|
-
const [sortFieldInput, setSortFieldInput] = (0,
|
|
39634
|
+
const [sortFieldInput, setSortFieldInput] = (0, import_react41.useState)(
|
|
39494
39635
|
pivotSort?.sortField ?? ""
|
|
39495
39636
|
);
|
|
39496
|
-
const [sortDirectionInput, setSortDirectionInput] = (0,
|
|
39637
|
+
const [sortDirectionInput, setSortDirectionInput] = (0, import_react41.useState)(
|
|
39497
39638
|
pivotSort?.sortDirection ?? "ASC"
|
|
39498
39639
|
);
|
|
39499
|
-
const [showLimitInput, setShowLimitInput] = (0,
|
|
39500
|
-
const [showSortInput, setShowSortInput] = (0,
|
|
39501
|
-
const [availableHeight, setAvailableHeight] = (0,
|
|
39502
|
-
const [pivotModalTopHeight, setPivotModalTopHeight] = (0,
|
|
39503
|
-
const [popoverPosition, setPopoverPosition] = (0,
|
|
39640
|
+
const [showLimitInput, setShowLimitInput] = (0, import_react41.useState)(!!pivotLimit);
|
|
39641
|
+
const [showSortInput, setShowSortInput] = (0, import_react41.useState)(!!pivotSort);
|
|
39642
|
+
const [availableHeight, setAvailableHeight] = (0, import_react41.useState)(0);
|
|
39643
|
+
const [pivotModalTopHeight, setPivotModalTopHeight] = (0, import_react41.useState)(450);
|
|
39644
|
+
const [popoverPosition, setPopoverPosition] = (0, import_react41.useState)(
|
|
39504
39645
|
"bottom"
|
|
39505
39646
|
);
|
|
39506
|
-
const popoverRef = (0,
|
|
39647
|
+
const popoverRef = (0, import_react41.useRef)(null);
|
|
39507
39648
|
const getDistinctValues = async (fetchDistinct) => {
|
|
39508
39649
|
if (!client) {
|
|
39509
39650
|
return {
|
|
@@ -39590,7 +39731,7 @@ var PivotModal = ({
|
|
|
39590
39731
|
setDateRanges(dateRangeByColumn || {});
|
|
39591
39732
|
}
|
|
39592
39733
|
};
|
|
39593
|
-
(0,
|
|
39734
|
+
(0, import_react41.useEffect)(() => {
|
|
39594
39735
|
const calculatePivotCardSize = () => {
|
|
39595
39736
|
if (rowFieldRef.current && colFieldRef.current) {
|
|
39596
39737
|
const rowFieldSize = rowFieldRef.current?.getBoundingClientRect();
|
|
@@ -39611,7 +39752,7 @@ var PivotModal = ({
|
|
|
39611
39752
|
}, 500);
|
|
39612
39753
|
}
|
|
39613
39754
|
}, [showUpdatePivot, isOpen]);
|
|
39614
|
-
(0,
|
|
39755
|
+
(0, import_react41.useEffect)(() => {
|
|
39615
39756
|
const fetchPivotData = async () => {
|
|
39616
39757
|
if (pivotRowField && data && columns && pivotAggregations?.every((p) => p?.valueField && p?.aggregationType)) {
|
|
39617
39758
|
const pivot = {
|
|
@@ -39757,7 +39898,7 @@ var PivotModal = ({
|
|
|
39757
39898
|
};
|
|
39758
39899
|
fetchPivotData();
|
|
39759
39900
|
}, [initialSelectedPivotTable]);
|
|
39760
|
-
(0,
|
|
39901
|
+
(0, import_react41.useEffect)(() => {
|
|
39761
39902
|
if (pivotRowField && data && columns) {
|
|
39762
39903
|
getDistinctValues();
|
|
39763
39904
|
getAllDateRangesByColumn();
|
|
@@ -39765,7 +39906,7 @@ var PivotModal = ({
|
|
|
39765
39906
|
getDistinctValues();
|
|
39766
39907
|
}
|
|
39767
39908
|
}, [initialSelectedPivotTable, columns, data, pivotRowField]);
|
|
39768
|
-
(0,
|
|
39909
|
+
(0, import_react41.useEffect)(() => {
|
|
39769
39910
|
setAllowedFields(initialUniqueValues || {});
|
|
39770
39911
|
setUniqueValues(initialUniqueValues);
|
|
39771
39912
|
}, [initialUniqueValues, columns]);
|
|
@@ -39776,20 +39917,20 @@ var PivotModal = ({
|
|
|
39776
39917
|
setAllowedValueFields(possibleColumns.valueFields);
|
|
39777
39918
|
return possibleColumns;
|
|
39778
39919
|
};
|
|
39779
|
-
const columnsToShow = (0,
|
|
39920
|
+
const columnsToShow = (0, import_react41.useMemo)(() => {
|
|
39780
39921
|
return (columns || []).reduce((map, col) => {
|
|
39781
39922
|
map[col.field] = col.format;
|
|
39782
39923
|
return map;
|
|
39783
39924
|
}, {});
|
|
39784
39925
|
}, [columns]);
|
|
39785
|
-
const columnTypes = (0,
|
|
39926
|
+
const columnTypes = (0, import_react41.useMemo)(() => {
|
|
39786
39927
|
return (columns || []).reduce((map, col) => {
|
|
39787
39928
|
map[col.field] = col.jsType;
|
|
39788
39929
|
return map;
|
|
39789
39930
|
}, {});
|
|
39790
39931
|
}, [columns]);
|
|
39791
|
-
const [selectedPivotTable, setSelectedPivotTable] = (0,
|
|
39792
|
-
(0,
|
|
39932
|
+
const [selectedPivotTable, setSelectedPivotTable] = (0, import_react41.useState)(null);
|
|
39933
|
+
(0, import_react41.useEffect)(() => {
|
|
39793
39934
|
const fetchPivotTables = async () => {
|
|
39794
39935
|
if (selectedPivotIndex === -1) {
|
|
39795
39936
|
return null;
|
|
@@ -39841,8 +39982,8 @@ var PivotModal = ({
|
|
|
39841
39982
|
};
|
|
39842
39983
|
fetchPivotTables();
|
|
39843
39984
|
}, [selectedPivotIndex, data, dateRange, createdPivots]);
|
|
39844
|
-
const previousUniqueValuesRef = (0,
|
|
39845
|
-
(0,
|
|
39985
|
+
const previousUniqueValuesRef = (0, import_react41.useRef)();
|
|
39986
|
+
(0, import_react41.useEffect)(() => {
|
|
39846
39987
|
if (!uniqueValuesIsLoading && !(0, import_fast_deep_equal5.default)(uniqueValues, previousUniqueValuesRef.current)) {
|
|
39847
39988
|
previousUniqueValuesRef.current = uniqueValues;
|
|
39848
39989
|
setRecommendedPivotTables([]);
|
|
@@ -39879,7 +40020,7 @@ var PivotModal = ({
|
|
|
39879
40020
|
setIsOpen(false);
|
|
39880
40021
|
setPopUpTitle("Add pivot");
|
|
39881
40022
|
};
|
|
39882
|
-
const onCommitPivot = (0,
|
|
40023
|
+
const onCommitPivot = (0, import_react41.useCallback)(() => {
|
|
39883
40024
|
const errors2 = [];
|
|
39884
40025
|
if ((pivotAggregations?.length ?? 0) === 0) {
|
|
39885
40026
|
errors2.push("You must have at least one aggregation");
|
|
@@ -40021,7 +40162,7 @@ var PivotModal = ({
|
|
|
40021
40162
|
const onEditRecommendedPivot = (pivot) => {
|
|
40022
40163
|
onEditPivot(pivot, null);
|
|
40023
40164
|
};
|
|
40024
|
-
const refreshPivots = (0,
|
|
40165
|
+
const refreshPivots = (0, import_react41.useCallback)(async () => {
|
|
40025
40166
|
if (!client) {
|
|
40026
40167
|
return;
|
|
40027
40168
|
}
|
|
@@ -40317,11 +40458,11 @@ var PivotModal = ({
|
|
|
40317
40458
|
}
|
|
40318
40459
|
}, 500);
|
|
40319
40460
|
};
|
|
40320
|
-
const [recommendedPivotTables, setRecommendedPivotTables] = (0,
|
|
40461
|
+
const [recommendedPivotTables, setRecommendedPivotTables] = (0, import_react41.useState)(
|
|
40321
40462
|
[]
|
|
40322
40463
|
);
|
|
40323
|
-
const [createdPivotTables, setCreatedPivotTables] = (0,
|
|
40324
|
-
(0,
|
|
40464
|
+
const [createdPivotTables, setCreatedPivotTables] = (0, import_react41.useState)([]);
|
|
40465
|
+
(0, import_react41.useEffect)(() => {
|
|
40325
40466
|
const fetchPivotTables = async () => {
|
|
40326
40467
|
const pts = await Promise.all(
|
|
40327
40468
|
createdPivots.map(async (p) => {
|
|
@@ -40394,7 +40535,7 @@ var PivotModal = ({
|
|
|
40394
40535
|
setPopoverPosition("bottom");
|
|
40395
40536
|
}
|
|
40396
40537
|
};
|
|
40397
|
-
(0,
|
|
40538
|
+
(0, import_react41.useEffect)(() => {
|
|
40398
40539
|
handleResize();
|
|
40399
40540
|
window.addEventListener("resize", handleResize);
|
|
40400
40541
|
const parentElement = parentRef?.current;
|
|
@@ -41219,7 +41360,7 @@ var validateReport = (formData, dashboardData, defaultDateFilter, allTables) =>
|
|
|
41219
41360
|
};
|
|
41220
41361
|
|
|
41221
41362
|
// src/components/Chart/InternalChart.tsx
|
|
41222
|
-
var
|
|
41363
|
+
var import_react42 = require("react");
|
|
41223
41364
|
var import_date_fns15 = require("date-fns");
|
|
41224
41365
|
init_Filter();
|
|
41225
41366
|
init_filterProcessing();
|
|
@@ -41333,10 +41474,10 @@ function InternalChart({
|
|
|
41333
41474
|
filterToggleDisabled,
|
|
41334
41475
|
layoutChanged
|
|
41335
41476
|
}) {
|
|
41336
|
-
const { reportFilters } = (0,
|
|
41337
|
-
const { dashboardConfig } = (0,
|
|
41338
|
-
const { eventTracking } = (0,
|
|
41339
|
-
const currentReportFilters = (0,
|
|
41477
|
+
const { reportFilters } = (0, import_react42.useContext)(ReportFiltersContext);
|
|
41478
|
+
const { dashboardConfig } = (0, import_react42.useContext)(DashboardConfigContext);
|
|
41479
|
+
const { eventTracking } = (0, import_react42.useContext)(EventTrackingContext);
|
|
41480
|
+
const currentReportFilters = (0, import_react42.useMemo)(() => {
|
|
41340
41481
|
const dashFilters = dashboardConfig[report?.dashboardName ?? ""]?.config.filters;
|
|
41341
41482
|
if (!dashFilters)
|
|
41342
41483
|
return Object.values(reportFilters[report?.id ?? TEMP_REPORT_ID] ?? {});
|
|
@@ -41352,19 +41493,19 @@ function InternalChart({
|
|
|
41352
41493
|
}
|
|
41353
41494
|
});
|
|
41354
41495
|
}, [reportFilters, report?.id]);
|
|
41355
|
-
const reportDateFilter = (0,
|
|
41496
|
+
const reportDateFilter = (0, import_react42.useMemo)(() => {
|
|
41356
41497
|
return Object.values(
|
|
41357
41498
|
reportFilters[report?.id ?? TEMP_REPORT_ID] ?? {}
|
|
41358
41499
|
).find((f) => f.filter.filterType === "date_range")?.filter;
|
|
41359
41500
|
}, [reportFilters, report?.id]);
|
|
41360
|
-
const presetOptions = (0,
|
|
41501
|
+
const presetOptions = (0, import_react42.useMemo)(() => {
|
|
41361
41502
|
return reportDateFilter ? convertPresetOptionsToSelectableList(
|
|
41362
41503
|
reportDateFilter.presetOptions ?? [],
|
|
41363
41504
|
reportDateFilter.defaultPresetRanges ?? []
|
|
41364
41505
|
) : defaultOptionsV2;
|
|
41365
41506
|
}, [reportDateFilter]);
|
|
41366
|
-
const [filterValues, setFilterValues] = (0,
|
|
41367
|
-
(0,
|
|
41507
|
+
const [filterValues, setFilterValues] = (0, import_react42.useState)({});
|
|
41508
|
+
(0, import_react42.useEffect)(() => {
|
|
41368
41509
|
if (reportDateFilter) {
|
|
41369
41510
|
const customDateFilter = filters?.find(
|
|
41370
41511
|
(f) => f.filterType === "date" /* Date */
|
|
@@ -41389,8 +41530,8 @@ function InternalChart({
|
|
|
41389
41530
|
}));
|
|
41390
41531
|
}
|
|
41391
41532
|
}, [filters]);
|
|
41392
|
-
const [theme] = (0,
|
|
41393
|
-
const colorMap = (0,
|
|
41533
|
+
const [theme] = (0, import_react42.useContext)(ThemeContext);
|
|
41534
|
+
const colorMap = (0, import_react42.useMemo)(() => {
|
|
41394
41535
|
if (mapColorsToFields && report && theme) {
|
|
41395
41536
|
return mapColorsToFields(report, theme);
|
|
41396
41537
|
}
|
|
@@ -41472,10 +41613,10 @@ function InternalChart({
|
|
|
41472
41613
|
}));
|
|
41473
41614
|
onDashboardFilterChange(filter.label, filterValue);
|
|
41474
41615
|
};
|
|
41475
|
-
const [filtersExpanded, setFiltersExpanded] = (0,
|
|
41476
|
-
const filtersContainerRef = (0,
|
|
41477
|
-
const [visibleFilters, setVisibleFilters] = (0,
|
|
41478
|
-
const filtersOverflowing = (0,
|
|
41616
|
+
const [filtersExpanded, setFiltersExpanded] = (0, import_react42.useState)(false);
|
|
41617
|
+
const filtersContainerRef = (0, import_react42.useRef)(null);
|
|
41618
|
+
const [visibleFilters, setVisibleFilters] = (0, import_react42.useState)([]);
|
|
41619
|
+
const filtersOverflowing = (0, import_react42.useMemo)(() => {
|
|
41479
41620
|
return visibleFilters.some((visible) => visible);
|
|
41480
41621
|
}, [visibleFilters]);
|
|
41481
41622
|
const measureItems = () => {
|
|
@@ -41490,7 +41631,7 @@ function InternalChart({
|
|
|
41490
41631
|
});
|
|
41491
41632
|
setVisibleFilters(newVisibleItems);
|
|
41492
41633
|
};
|
|
41493
|
-
(0,
|
|
41634
|
+
(0, import_react42.useLayoutEffect)(() => {
|
|
41494
41635
|
requestAnimationFrame(() => measureItems());
|
|
41495
41636
|
const handleResize = () => {
|
|
41496
41637
|
measureItems();
|
|
@@ -41769,7 +41910,7 @@ init_dataFetcher();
|
|
|
41769
41910
|
init_dates();
|
|
41770
41911
|
|
|
41771
41912
|
// src/components/QuillMultiSelectSectionList.tsx
|
|
41772
|
-
var
|
|
41913
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
41773
41914
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
41774
41915
|
function QuillMultiSelectSectionList({
|
|
41775
41916
|
options,
|
|
@@ -41785,12 +41926,12 @@ function QuillMultiSelectSectionList({
|
|
|
41785
41926
|
style: style2,
|
|
41786
41927
|
owner
|
|
41787
41928
|
}) {
|
|
41788
|
-
const [theme] = (0,
|
|
41789
|
-
const [showModal, setShowModal] = (0,
|
|
41790
|
-
const modalRef = (0,
|
|
41791
|
-
const buttonRef = (0,
|
|
41792
|
-
const debounceTimeoutId = (0,
|
|
41793
|
-
const [searchQuery, setSearchQuery] =
|
|
41929
|
+
const [theme] = (0, import_react43.useContext)(ThemeContext);
|
|
41930
|
+
const [showModal, setShowModal] = (0, import_react43.useState)(false);
|
|
41931
|
+
const modalRef = (0, import_react43.useRef)(null);
|
|
41932
|
+
const buttonRef = (0, import_react43.useRef)(null);
|
|
41933
|
+
const debounceTimeoutId = (0, import_react43.useRef)(null);
|
|
41934
|
+
const [searchQuery, setSearchQuery] = import_react43.default.useState("");
|
|
41794
41935
|
useOnClickOutside_default(
|
|
41795
41936
|
modalRef,
|
|
41796
41937
|
(event) => {
|
|
@@ -41807,10 +41948,10 @@ function QuillMultiSelectSectionList({
|
|
|
41807
41948
|
onChange(updatedChangeEvent);
|
|
41808
41949
|
}, 200);
|
|
41809
41950
|
};
|
|
41810
|
-
const optionsLength =
|
|
41951
|
+
const optionsLength = import_react43.default.useMemo(() => {
|
|
41811
41952
|
return Object.values(options).reduce((a, b) => a + b.length, 0);
|
|
41812
41953
|
}, [options]);
|
|
41813
|
-
const filteredItems =
|
|
41954
|
+
const filteredItems = import_react43.default.useMemo(() => {
|
|
41814
41955
|
const uuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/;
|
|
41815
41956
|
const sample = Object.values(options).find((arr) => arr.length > 0)?.[0];
|
|
41816
41957
|
if (!sample) {
|
|
@@ -41837,10 +41978,10 @@ function QuillMultiSelectSectionList({
|
|
|
41837
41978
|
Object.entries(filteredOptions).filter(([, value2]) => !!value2?.length).sort(([key]) => key === owner ? -1 : 1)
|
|
41838
41979
|
);
|
|
41839
41980
|
}, [options, searchQuery]);
|
|
41840
|
-
const filteredLength =
|
|
41981
|
+
const filteredLength = import_react43.default.useMemo(() => {
|
|
41841
41982
|
return Object.values(filteredItems).reduce((a, b) => a + b.length, 0);
|
|
41842
41983
|
}, [filteredItems]);
|
|
41843
|
-
const selectedOptionsLabel = (0,
|
|
41984
|
+
const selectedOptionsLabel = (0, import_react43.useMemo)(() => {
|
|
41844
41985
|
const valuesLength = Object.values(value).reduce((a, b) => a + b.length, 0);
|
|
41845
41986
|
if (!valuesLength) {
|
|
41846
41987
|
return "Select";
|
|
@@ -42222,7 +42363,7 @@ var ListboxTextInput2 = ({
|
|
|
42222
42363
|
onChange,
|
|
42223
42364
|
placeholder
|
|
42224
42365
|
}) => {
|
|
42225
|
-
const [theme] = (0,
|
|
42366
|
+
const [theme] = (0, import_react43.useContext)(ThemeContext);
|
|
42226
42367
|
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
42227
42368
|
"div",
|
|
42228
42369
|
{
|
|
@@ -42571,18 +42712,18 @@ function createReportFromForm(formData, report, eventTracking, selectedPivotTabl
|
|
|
42571
42712
|
return newReport;
|
|
42572
42713
|
}
|
|
42573
42714
|
function ChartBuilderWithModal(props) {
|
|
42574
|
-
const parentRef = (0,
|
|
42575
|
-
const [modalWidth, setModalWidth] = (0,
|
|
42576
|
-
const [modalHeight, setModalHeight] = (0,
|
|
42715
|
+
const parentRef = (0, import_react44.useRef)(null);
|
|
42716
|
+
const [modalWidth, setModalWidth] = (0, import_react44.useState)(200);
|
|
42717
|
+
const [modalHeight, setModalHeight] = (0, import_react44.useState)(200);
|
|
42577
42718
|
const { isOpen, setIsOpen, title, isHorizontalView } = props;
|
|
42578
42719
|
const Modal = props.ModalComponent ?? MemoizedModal;
|
|
42579
42720
|
const { dashboardReports: dashboard } = useDashboardReports(
|
|
42580
42721
|
props.destinationDashboard
|
|
42581
42722
|
);
|
|
42582
|
-
const [filtersEnabledState, setFiltersEnabledState] = (0,
|
|
42723
|
+
const [filtersEnabledState, setFiltersEnabledState] = (0, import_react44.useState)(
|
|
42583
42724
|
!!props.reportId
|
|
42584
42725
|
);
|
|
42585
|
-
(0,
|
|
42726
|
+
(0, import_react44.useEffect)(() => {
|
|
42586
42727
|
function handleResize() {
|
|
42587
42728
|
const screenSize = window.innerWidth;
|
|
42588
42729
|
if (screenSize >= 1200) {
|
|
@@ -42687,33 +42828,33 @@ function ChartBuilder({
|
|
|
42687
42828
|
disableSort = true,
|
|
42688
42829
|
runQueryOnMount = false
|
|
42689
42830
|
}) {
|
|
42690
|
-
const [client] = (0,
|
|
42691
|
-
const [theme] = (0,
|
|
42692
|
-
const [schemaData] = (0,
|
|
42693
|
-
const { getToken, quillFetchWithToken } = (0,
|
|
42694
|
-
const { eventTracking } = (0,
|
|
42831
|
+
const [client] = (0, import_react44.useContext)(ClientContext);
|
|
42832
|
+
const [theme] = (0, import_react44.useContext)(ThemeContext);
|
|
42833
|
+
const [schemaData] = (0, import_react44.useContext)(SchemaDataContext);
|
|
42834
|
+
const { getToken, quillFetchWithToken } = (0, import_react44.useContext)(FetchContext);
|
|
42835
|
+
const { eventTracking } = (0, import_react44.useContext)(EventTrackingContext);
|
|
42695
42836
|
const { addReport } = useDashboardReports(destinationDashboard);
|
|
42696
42837
|
const { reload: reloadDashboard } = useDashboardInternal(destinationDashboard);
|
|
42697
42838
|
const { allReportsById } = useAllReports();
|
|
42698
|
-
const { dashboardConfig } = (0,
|
|
42699
|
-
const { tenants, flags } = (0,
|
|
42700
|
-
const report = (0,
|
|
42839
|
+
const { dashboardConfig } = (0, import_react44.useContext)(DashboardConfigContext);
|
|
42840
|
+
const { tenants, flags } = (0, import_react44.useContext)(TenantContext);
|
|
42841
|
+
const report = (0, import_react44.useMemo)(() => {
|
|
42701
42842
|
const resolvedReport = reportId && !tempReport ? allReportsById[reportId] : tempReport;
|
|
42702
42843
|
return resolvedReport;
|
|
42703
42844
|
}, [reportId, tempReport, allReportsById]);
|
|
42704
|
-
const [windowWidth, setWindowWidth] = (0,
|
|
42705
|
-
const [rows, setRows] = (0,
|
|
42706
|
-
const [itemQuery, setItemQuery] = (0,
|
|
42707
|
-
const [rowCount, setRowCount] = (0,
|
|
42708
|
-
const [maxPage, setMaxPage] = (0,
|
|
42709
|
-
const [isLoading, setIsLoading] = (0,
|
|
42710
|
-
const [rowCountIsLoading, setRowCountIsLoading] = (0,
|
|
42711
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
42712
|
-
const MIN_FORM_WIDTH =
|
|
42713
|
-
const [pivotCardWidth, setPivotCardWidth] = (0,
|
|
42714
|
-
const [formWidth, setFormWidth] = (0,
|
|
42715
|
-
const inputRef = (0,
|
|
42716
|
-
const selectRef = (0,
|
|
42845
|
+
const [windowWidth, setWindowWidth] = (0, import_react44.useState)(1200);
|
|
42846
|
+
const [rows, setRows] = (0, import_react44.useState)(report?.rows ?? []);
|
|
42847
|
+
const [itemQuery, setItemQuery] = (0, import_react44.useState)(report?.itemQuery);
|
|
42848
|
+
const [rowCount, setRowCount] = (0, import_react44.useState)(report?.rowCount ?? 0);
|
|
42849
|
+
const [maxPage, setMaxPage] = (0, import_react44.useState)(0);
|
|
42850
|
+
const [isLoading, setIsLoading] = (0, import_react44.useState)(false);
|
|
42851
|
+
const [rowCountIsLoading, setRowCountIsLoading] = (0, import_react44.useState)(false);
|
|
42852
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react44.useState)(false);
|
|
42853
|
+
const MIN_FORM_WIDTH = 700;
|
|
42854
|
+
const [pivotCardWidth, setPivotCardWidth] = (0, import_react44.useState)(MIN_FORM_WIDTH);
|
|
42855
|
+
const [formWidth, setFormWidth] = (0, import_react44.useState)(MIN_FORM_WIDTH);
|
|
42856
|
+
const inputRef = (0, import_react44.useRef)(null);
|
|
42857
|
+
const selectRef = (0, import_react44.useRef)(null);
|
|
42717
42858
|
const processColumns = (columns2) => {
|
|
42718
42859
|
if (schemaData.schemaWithCustomFields) {
|
|
42719
42860
|
const newProcessedColumns = columns2?.map((col) => {
|
|
@@ -42743,16 +42884,16 @@ function ChartBuilder({
|
|
|
42743
42884
|
}
|
|
42744
42885
|
return columns2;
|
|
42745
42886
|
};
|
|
42746
|
-
const [processedColumns, setProcessedColumns] = (0,
|
|
42887
|
+
const [processedColumns, setProcessedColumns] = (0, import_react44.useState)(
|
|
42747
42888
|
processColumns(report?.columnInternal ?? [])
|
|
42748
42889
|
);
|
|
42749
|
-
const [currentPage, setCurrentPage] = (0,
|
|
42750
|
-
const parentRef = (0,
|
|
42751
|
-
const deleteRef = (0,
|
|
42890
|
+
const [currentPage, setCurrentPage] = (0, import_react44.useState)(0);
|
|
42891
|
+
const parentRef = (0, import_react44.useRef)(null);
|
|
42892
|
+
const deleteRef = (0, import_react44.useRef)(null);
|
|
42752
42893
|
const modalPadding = 20;
|
|
42753
42894
|
const deleteButtonMargin = -12;
|
|
42754
|
-
const { dashboardFilters } = (0,
|
|
42755
|
-
const specificDashboardFilters = (0,
|
|
42895
|
+
const { dashboardFilters } = (0, import_react44.useContext)(DashboardFiltersContext);
|
|
42896
|
+
const specificDashboardFilters = (0, import_react44.useMemo)(() => {
|
|
42756
42897
|
return Object.values(
|
|
42757
42898
|
dashboardFilters[report?.dashboardName ?? ""] ?? {}
|
|
42758
42899
|
).map((f) => f.filter);
|
|
@@ -42770,7 +42911,7 @@ function ChartBuilder({
|
|
|
42770
42911
|
setFilterIssues([]);
|
|
42771
42912
|
}
|
|
42772
42913
|
};
|
|
42773
|
-
(0,
|
|
42914
|
+
(0, import_react44.useEffect)(() => {
|
|
42774
42915
|
const handleResize = () => {
|
|
42775
42916
|
setWindowWidth(window.innerWidth);
|
|
42776
42917
|
if (inputRef.current && selectRef.current) {
|
|
@@ -42793,17 +42934,17 @@ function ChartBuilder({
|
|
|
42793
42934
|
window.removeEventListener("resize", handleResize);
|
|
42794
42935
|
};
|
|
42795
42936
|
}, [isOpen]);
|
|
42796
|
-
const [dashboardOptions, setDashboardOptions] = (0,
|
|
42937
|
+
const [dashboardOptions, setDashboardOptions] = (0, import_react44.useState)([]);
|
|
42797
42938
|
const {
|
|
42798
42939
|
reportFilters,
|
|
42799
42940
|
loadFiltersForReport,
|
|
42800
42941
|
reportFiltersDispatch,
|
|
42801
42942
|
abortLoadingFilters
|
|
42802
|
-
} = (0,
|
|
42803
|
-
const { reportsDispatch } = (0,
|
|
42804
|
-
const initialFilters = (0,
|
|
42805
|
-
const [reportFiltersLoaded, setReportFiltersLoaded] = (0,
|
|
42806
|
-
(0,
|
|
42943
|
+
} = (0, import_react44.useContext)(ReportFiltersContext);
|
|
42944
|
+
const { reportsDispatch } = (0, import_react44.useContext)(ReportsContext);
|
|
42945
|
+
const initialFilters = (0, import_react44.useRef)(reportFilters[report?.id ?? TEMP_REPORT_ID]);
|
|
42946
|
+
const [reportFiltersLoaded, setReportFiltersLoaded] = (0, import_react44.useState)(!filtersEnabled);
|
|
42947
|
+
(0, import_react44.useEffect)(() => {
|
|
42807
42948
|
if (!reportFilters[report?.id ?? TEMP_REPORT_ID]) {
|
|
42808
42949
|
loadFiltersForReport(
|
|
42809
42950
|
report?.id ?? TEMP_REPORT_ID,
|
|
@@ -42831,25 +42972,25 @@ function ChartBuilder({
|
|
|
42831
42972
|
}
|
|
42832
42973
|
};
|
|
42833
42974
|
}, []);
|
|
42834
|
-
const currentDashboardFilters = (0,
|
|
42975
|
+
const currentDashboardFilters = (0, import_react44.useMemo)(() => {
|
|
42835
42976
|
return Object.values(reportFilters[report?.id ?? TEMP_REPORT_ID] ?? {}).map(
|
|
42836
42977
|
(f) => f.filter
|
|
42837
42978
|
);
|
|
42838
42979
|
}, [reportFilters, report?.id]);
|
|
42839
|
-
const [showFilterModal, setShowFilterModal] = (0,
|
|
42840
|
-
const [filterIssues, setFilterIssues] = (0,
|
|
42841
|
-
const [showPivotPopover, setShowPivotPopover] = (0,
|
|
42842
|
-
const [isEdittingPivot, setIsEdittingPivot] = (0,
|
|
42843
|
-
const [selectedPivotIndex, setSelectedPivotIndex] = (0,
|
|
42844
|
-
const [tableName, setTableName] = (0,
|
|
42845
|
-
const [includeCustomFields, setIncludeCustomFields] = (0,
|
|
42980
|
+
const [showFilterModal, setShowFilterModal] = (0, import_react44.useState)(false);
|
|
42981
|
+
const [filterIssues, setFilterIssues] = (0, import_react44.useState)([]);
|
|
42982
|
+
const [showPivotPopover, setShowPivotPopover] = (0, import_react44.useState)(false);
|
|
42983
|
+
const [isEdittingPivot, setIsEdittingPivot] = (0, import_react44.useState)(false);
|
|
42984
|
+
const [selectedPivotIndex, setSelectedPivotIndex] = (0, import_react44.useState)(-1);
|
|
42985
|
+
const [tableName, setTableName] = (0, import_react44.useState)(void 0);
|
|
42986
|
+
const [includeCustomFields, setIncludeCustomFields] = (0, import_react44.useState)(
|
|
42846
42987
|
report ? !!report.includeCustomFields : !!client?.featureFlags?.customFieldsEnabled
|
|
42847
42988
|
);
|
|
42848
42989
|
const selectedTable = schemaData.schema?.find(
|
|
42849
42990
|
(t) => t.displayName === tableName
|
|
42850
42991
|
);
|
|
42851
|
-
const [pivotPopUpTitle, setPivotPopUpTitle] = (0,
|
|
42852
|
-
const [pivotError, setPivotError] = (0,
|
|
42992
|
+
const [pivotPopUpTitle, setPivotPopUpTitle] = (0, import_react44.useState)("Add pivot");
|
|
42993
|
+
const [pivotError, setPivotError] = (0, import_react44.useState)(void 0);
|
|
42853
42994
|
const pivotData = report?.pivotRows && report?.pivotColumns ? {
|
|
42854
42995
|
rows: report.pivotRows,
|
|
42855
42996
|
columns: report.pivotColumns,
|
|
@@ -42860,19 +43001,19 @@ function ChartBuilder({
|
|
|
42860
43001
|
const columns = report?.columnInternal ?? [];
|
|
42861
43002
|
const destinationDashboardName = report?.dashboardName || destinationDashboard;
|
|
42862
43003
|
const query = report?.queryString;
|
|
42863
|
-
const [loadingFormData, setLoadingFormData] = (0,
|
|
42864
|
-
const [triggeredEditChart, setTriggeredEditChart] = (0,
|
|
42865
|
-
const [createdPivots, setCreatedPivots] = (0,
|
|
43004
|
+
const [loadingFormData, setLoadingFormData] = (0, import_react44.useState)(false);
|
|
43005
|
+
const [triggeredEditChart, setTriggeredEditChart] = (0, import_react44.useState)(false);
|
|
43006
|
+
const [createdPivots, setCreatedPivots] = (0, import_react44.useState)(
|
|
42866
43007
|
report?.pivot ? [report.pivot] : cp
|
|
42867
43008
|
);
|
|
42868
|
-
const [recommendedPivots, setRecommendedPivots] = (0,
|
|
42869
|
-
const [pivotRowField, setPivotRowField] = (0,
|
|
43009
|
+
const [recommendedPivots, setRecommendedPivots] = (0, import_react44.useState)(rp);
|
|
43010
|
+
const [pivotRowField, setPivotRowField] = (0, import_react44.useState)(
|
|
42870
43011
|
report?.pivot?.rowField
|
|
42871
43012
|
);
|
|
42872
|
-
const [pivotColumnField, setPivotColumnField] = (0,
|
|
43013
|
+
const [pivotColumnField, setPivotColumnField] = (0, import_react44.useState)(
|
|
42873
43014
|
report?.pivot?.columnField
|
|
42874
43015
|
);
|
|
42875
|
-
const [pivotAggregations, setPivotAggregations] = (0,
|
|
43016
|
+
const [pivotAggregations, setPivotAggregations] = (0, import_react44.useState)(
|
|
42876
43017
|
report?.pivot?.aggregations ?? [
|
|
42877
43018
|
{
|
|
42878
43019
|
valueField: report?.pivot?.valueField,
|
|
@@ -42881,10 +43022,10 @@ function ChartBuilder({
|
|
|
42881
43022
|
}
|
|
42882
43023
|
]
|
|
42883
43024
|
);
|
|
42884
|
-
const [pivotLimit, setPivotLimit] = (0,
|
|
43025
|
+
const [pivotLimit, setPivotLimit] = (0, import_react44.useState)(
|
|
42885
43026
|
report?.pivot?.rowLimit
|
|
42886
43027
|
);
|
|
42887
|
-
const [pivotSort, setPivotSort] = (0,
|
|
43028
|
+
const [pivotSort, setPivotSort] = (0, import_react44.useState)(
|
|
42888
43029
|
report?.pivot?.sort && report?.pivot?.sortDirection && report?.pivot?.sortField ? {
|
|
42889
43030
|
sortField: report.pivot.sortField,
|
|
42890
43031
|
sortDirection: report.pivot.sortDirection
|
|
@@ -42897,27 +43038,28 @@ function ChartBuilder({
|
|
|
42897
43038
|
rowsPerRequest: report?.chartType === "table" ? 50 : 500
|
|
42898
43039
|
}
|
|
42899
43040
|
};
|
|
42900
|
-
const [currentProcessing, setCurrentProcessing] = (0,
|
|
42901
|
-
const [customTenantAccess, setCustomTenantAccess] = (0,
|
|
43041
|
+
const [currentProcessing, setCurrentProcessing] = (0, import_react44.useState)(baseProcessing);
|
|
43042
|
+
const [customTenantAccess, setCustomTenantAccess] = (0, import_react44.useState)(
|
|
42902
43043
|
report?.flags === null ? false : !!Object.values(report?.flags ?? {}).length
|
|
42903
43044
|
);
|
|
42904
|
-
const [dateFieldOptions, setDateFieldOptions] = (0,
|
|
42905
|
-
const [allTables, setAllTables] = (0,
|
|
42906
|
-
const [customFieldTableRef, setCustomFieldTableRef] = (0,
|
|
42907
|
-
const [referencedColumns, setReferencedColumns] = (0,
|
|
42908
|
-
const [referencedColumnsWithoutStar, setReferencedColumnsWithoutStar] = (0,
|
|
42909
|
-
const [
|
|
42910
|
-
const
|
|
43045
|
+
const [dateFieldOptions, setDateFieldOptions] = (0, import_react44.useState)([]);
|
|
43046
|
+
const [allTables, setAllTables] = (0, import_react44.useState)([]);
|
|
43047
|
+
const [customFieldTableRef, setCustomFieldTableRef] = (0, import_react44.useState)(false);
|
|
43048
|
+
const [referencedColumns, setReferencedColumns] = (0, import_react44.useState)({});
|
|
43049
|
+
const [referencedColumnsWithoutStar, setReferencedColumnsWithoutStar] = (0, import_react44.useState)({});
|
|
43050
|
+
const [referencedTablesLoaded, setReferencedTablesLoaded] = (0, import_react44.useState)(false);
|
|
43051
|
+
const [filterMap, setFilterMap] = (0, import_react44.useState)(report?.filterMap ?? {});
|
|
43052
|
+
const canonicalFilterMap = (0, import_react44.useMemo)(() => {
|
|
42911
43053
|
return Object.fromEntries(
|
|
42912
43054
|
Object.entries(filterMap).filter(
|
|
42913
43055
|
(f) => f[1].table !== void 0 && f[1].field !== void 0
|
|
42914
43056
|
)
|
|
42915
43057
|
);
|
|
42916
43058
|
}, [filterMap]);
|
|
42917
|
-
const validFilter = (0,
|
|
43059
|
+
const validFilter = (0, import_react44.useMemo)(() => {
|
|
42918
43060
|
return specificDashboardFilters.reduce(
|
|
42919
43061
|
(acc, filter) => {
|
|
42920
|
-
if (filter.filterType === "date_range" || filter.filterType === "tenant") {
|
|
43062
|
+
if (filter.filterType === "date_range" || filter.filterType === "tenant" || !referencedTablesLoaded) {
|
|
42921
43063
|
acc[filter.label] = true;
|
|
42922
43064
|
return acc;
|
|
42923
43065
|
}
|
|
@@ -42932,8 +43074,8 @@ function ChartBuilder({
|
|
|
42932
43074
|
},
|
|
42933
43075
|
{}
|
|
42934
43076
|
);
|
|
42935
|
-
}, [specificDashboardFilters, filterMap, allTables]);
|
|
42936
|
-
const [formFlags, setFormFlags] = (0,
|
|
43077
|
+
}, [specificDashboardFilters, filterMap, allTables, referencedTablesLoaded]);
|
|
43078
|
+
const [formFlags, setFormFlags] = (0, import_react44.useState)(
|
|
42937
43079
|
report?.flags ? Object.fromEntries(
|
|
42938
43080
|
Object.entries(report.flags).map(([key, value]) => {
|
|
42939
43081
|
if (value === ALL_TENANTS) {
|
|
@@ -42950,7 +43092,7 @@ function ChartBuilder({
|
|
|
42950
43092
|
})
|
|
42951
43093
|
) : void 0
|
|
42952
43094
|
);
|
|
42953
|
-
const [defaultDateField, setDefaultDateField] = (0,
|
|
43095
|
+
const [defaultDateField, setDefaultDateField] = (0, import_react44.useState)({
|
|
42954
43096
|
table: dateFieldOptions[0]?.name || "",
|
|
42955
43097
|
field: dateFieldOptions[0]?.columns[0]?.field || ""
|
|
42956
43098
|
});
|
|
@@ -43129,15 +43271,15 @@ function ChartBuilder({
|
|
|
43129
43271
|
}
|
|
43130
43272
|
return chartBuilderData;
|
|
43131
43273
|
};
|
|
43132
|
-
const [formData, setFormData] = (0,
|
|
43274
|
+
const [formData, setFormData] = (0, import_react44.useState)(
|
|
43133
43275
|
formFormDataFromReport(report, destinationSection ?? getCurrentSection())
|
|
43134
43276
|
);
|
|
43135
|
-
const reportCustomFields = (0,
|
|
43277
|
+
const reportCustomFields = (0, import_react44.useMemo)(() => {
|
|
43136
43278
|
return report?.columnsWithCustomFields?.filter(
|
|
43137
43279
|
(col) => !report?.columns?.some((c) => col.field === c.field)
|
|
43138
43280
|
) ?? [];
|
|
43139
43281
|
}, [report?.columnsWithCustomFields, report?.columns]);
|
|
43140
|
-
const referenceLineQueryResults = (0,
|
|
43282
|
+
const referenceLineQueryResults = (0, import_react44.useMemo)(() => {
|
|
43141
43283
|
return formData?.referenceLines?.map((line) => {
|
|
43142
43284
|
if (line.label === REFERENCE_LINE) {
|
|
43143
43285
|
return [Number(line.y1) || 0, Number(line.y2) || 0];
|
|
@@ -43151,10 +43293,10 @@ function ChartBuilder({
|
|
|
43151
43293
|
);
|
|
43152
43294
|
});
|
|
43153
43295
|
}, [formData?.referenceLines]);
|
|
43154
|
-
const currentDashboard = (0,
|
|
43296
|
+
const currentDashboard = (0, import_react44.useMemo)(() => {
|
|
43155
43297
|
return dashboardConfig[formData.dashboardName ?? report?.dashboardName ?? ""]?.config;
|
|
43156
43298
|
}, [dashboardConfig, formData.dashboardName, report?.dashboardName]);
|
|
43157
|
-
const currentDashboardTenants = (0,
|
|
43299
|
+
const currentDashboardTenants = (0, import_react44.useMemo)(() => {
|
|
43158
43300
|
return currentDashboard?.tenantKeys?.map(
|
|
43159
43301
|
(tenantKey) => client?.allTenantTypes?.find(
|
|
43160
43302
|
(t) => t.tenantField === tenantKey
|
|
@@ -43162,7 +43304,7 @@ function ChartBuilder({
|
|
|
43162
43304
|
) ?? [];
|
|
43163
43305
|
}, [client?.allTenantTypes, currentDashboard?.tenantKeys]);
|
|
43164
43306
|
const dashboardOwner = currentDashboardTenants?.[0];
|
|
43165
|
-
const currentTenantAsFormFlags = (0,
|
|
43307
|
+
const currentTenantAsFormFlags = (0, import_react44.useMemo)(() => {
|
|
43166
43308
|
if (!tenants || !tenants.length) {
|
|
43167
43309
|
return void 0;
|
|
43168
43310
|
}
|
|
@@ -43173,7 +43315,7 @@ function ChartBuilder({
|
|
|
43173
43315
|
const tenantIds = typeof tenants[0] !== "object" ? tenants : tenants[0]?.tenantIds;
|
|
43174
43316
|
return { [tenantField]: tenantIds };
|
|
43175
43317
|
}, [tenants, dashboardOwner]);
|
|
43176
|
-
const invalidColumns = (0,
|
|
43318
|
+
const invalidColumns = (0, import_react44.useMemo)(() => {
|
|
43177
43319
|
if (!rows || !rows.length) {
|
|
43178
43320
|
return [];
|
|
43179
43321
|
}
|
|
@@ -43183,7 +43325,7 @@ function ChartBuilder({
|
|
|
43183
43325
|
const columnsObservedInRows = rows[0] ? Object.keys(rows[0]) : [];
|
|
43184
43326
|
return columns.filter((col) => !columnsObservedInRows.includes(col.field));
|
|
43185
43327
|
}, [rows]);
|
|
43186
|
-
const [chartTypes, setChartTypes] = (0,
|
|
43328
|
+
const [chartTypes, setChartTypes] = (0, import_react44.useState)(
|
|
43187
43329
|
(() => {
|
|
43188
43330
|
const data = formFormDataFromReport(
|
|
43189
43331
|
report,
|
|
@@ -43195,7 +43337,7 @@ function ChartBuilder({
|
|
|
43195
43337
|
);
|
|
43196
43338
|
})()
|
|
43197
43339
|
);
|
|
43198
|
-
const reportContainsCustomFields = (0,
|
|
43340
|
+
const reportContainsCustomFields = (0, import_react44.useMemo)(() => {
|
|
43199
43341
|
const customFieldsMap = schemaData.customFields;
|
|
43200
43342
|
const reportQueryContainsCustomFields = allTables.some((table) => {
|
|
43201
43343
|
const tableColumns = referencedColumnsWithoutStar[table] ?? [];
|
|
@@ -43206,7 +43348,7 @@ function ChartBuilder({
|
|
|
43206
43348
|
});
|
|
43207
43349
|
return reportQueryContainsCustomFields;
|
|
43208
43350
|
}, [allTables, referencedColumnsWithoutStar]);
|
|
43209
|
-
const chartBuilderFormDataContainsCustomFields = (0,
|
|
43351
|
+
const chartBuilderFormDataContainsCustomFields = (0, import_react44.useMemo)(() => {
|
|
43210
43352
|
const customFields = allTables.map((table) => schemaData.customFields?.[table] ?? []).flat();
|
|
43211
43353
|
const customFieldsMap = schemaData.customFields;
|
|
43212
43354
|
const pivotContainsCustomFields = customFields.some(
|
|
@@ -43239,25 +43381,25 @@ function ChartBuilder({
|
|
|
43239
43381
|
formData.dateField,
|
|
43240
43382
|
canonicalFilterMap
|
|
43241
43383
|
]);
|
|
43242
|
-
const customFieldsInTabularColumns = (0,
|
|
43384
|
+
const customFieldsInTabularColumns = (0, import_react44.useMemo)(() => {
|
|
43243
43385
|
const customFields = allTables.map((table) => schemaData.customFields?.[table] ?? []).flat();
|
|
43244
43386
|
return formData.columns.some((col) => {
|
|
43245
43387
|
return customFields.some((field) => field.field === col.field);
|
|
43246
43388
|
});
|
|
43247
43389
|
}, [allTables, formData.columns]);
|
|
43248
|
-
const containsCustomFields = (0,
|
|
43390
|
+
const containsCustomFields = (0, import_react44.useMemo)(() => {
|
|
43249
43391
|
return reportContainsCustomFields || customFieldsInTabularColumns || chartBuilderFormDataContainsCustomFields;
|
|
43250
43392
|
}, [
|
|
43251
43393
|
reportContainsCustomFields,
|
|
43252
43394
|
customFieldsInTabularColumns,
|
|
43253
43395
|
chartBuilderFormDataContainsCustomFields
|
|
43254
43396
|
]);
|
|
43255
|
-
(0,
|
|
43397
|
+
(0, import_react44.useEffect)(() => {
|
|
43256
43398
|
if (!loadingFormData && triggeredEditChart) {
|
|
43257
43399
|
editChart();
|
|
43258
43400
|
}
|
|
43259
43401
|
}, [loadingFormData]);
|
|
43260
|
-
(0,
|
|
43402
|
+
(0, import_react44.useEffect)(() => {
|
|
43261
43403
|
async function getFormData() {
|
|
43262
43404
|
if (!client) {
|
|
43263
43405
|
return;
|
|
@@ -43298,6 +43440,7 @@ function ChartBuilder({
|
|
|
43298
43440
|
setLoadingFormData(false);
|
|
43299
43441
|
return;
|
|
43300
43442
|
}
|
|
43443
|
+
setReferencedTablesLoaded(false);
|
|
43301
43444
|
const result = await getReferencedTables(
|
|
43302
43445
|
client,
|
|
43303
43446
|
curSchemaData,
|
|
@@ -43375,18 +43518,19 @@ function ChartBuilder({
|
|
|
43375
43518
|
curFormData.dateField ?? dateField,
|
|
43376
43519
|
tableNames
|
|
43377
43520
|
);
|
|
43521
|
+
setReferencedTablesLoaded(true);
|
|
43378
43522
|
setLoadingFormData(false);
|
|
43379
43523
|
}
|
|
43380
43524
|
getFormData();
|
|
43381
43525
|
}, []);
|
|
43382
|
-
const ranMountQuery = (0,
|
|
43383
|
-
(0,
|
|
43526
|
+
const ranMountQuery = (0, import_react44.useRef)(false);
|
|
43527
|
+
(0, import_react44.useEffect)(() => {
|
|
43384
43528
|
if (runQueryOnMount && reportFiltersLoaded && filtersEnabled && !ranMountQuery.current) {
|
|
43385
43529
|
ranMountQuery.current = true;
|
|
43386
43530
|
handleRunQuery(baseProcessing, currentDashboardFilters);
|
|
43387
43531
|
}
|
|
43388
43532
|
}, [runQueryOnMount, reportFiltersLoaded, filtersEnabled]);
|
|
43389
|
-
const allTenantMap = (0,
|
|
43533
|
+
const allTenantMap = (0, import_react44.useMemo)(() => {
|
|
43390
43534
|
return client?.allTenantTypes?.reduce(
|
|
43391
43535
|
(acc, tenantType) => {
|
|
43392
43536
|
if (tenantType.scope === "database") {
|
|
@@ -43405,15 +43549,15 @@ function ChartBuilder({
|
|
|
43405
43549
|
{}
|
|
43406
43550
|
) ?? {};
|
|
43407
43551
|
}, [client?.allTenantTypes]);
|
|
43408
|
-
const [selectedPivotTable, setSelectedPivotTable] = (0,
|
|
43409
|
-
const pivotCardTable = (0,
|
|
43552
|
+
const [selectedPivotTable, setSelectedPivotTable] = (0, import_react44.useState)(pivotData);
|
|
43553
|
+
const pivotCardTable = (0, import_react44.useMemo)(() => {
|
|
43410
43554
|
return {
|
|
43411
43555
|
pivot: formData.pivot,
|
|
43412
43556
|
rows: selectedPivotTable?.rows ?? [],
|
|
43413
43557
|
columns: selectedPivotTable?.columns ?? []
|
|
43414
43558
|
};
|
|
43415
43559
|
}, [selectedPivotTable, formData.pivot]);
|
|
43416
|
-
const chartData = (0,
|
|
43560
|
+
const chartData = (0, import_react44.useMemo)(() => {
|
|
43417
43561
|
const data = createReportFromForm(
|
|
43418
43562
|
formData,
|
|
43419
43563
|
report ? { ...report, rowCount } : tempReport,
|
|
@@ -43435,7 +43579,7 @@ function ChartBuilder({
|
|
|
43435
43579
|
rowCount,
|
|
43436
43580
|
currentDashboardFilters
|
|
43437
43581
|
]);
|
|
43438
|
-
const xAxisFormatOptions = (0,
|
|
43582
|
+
const xAxisFormatOptions = (0, import_react44.useMemo)(() => {
|
|
43439
43583
|
return chartData?.chartType === "gauge" ? [
|
|
43440
43584
|
{ value: "whole_number", label: "whole number" },
|
|
43441
43585
|
{ value: "two_decimal_places", label: "two decimal places" },
|
|
@@ -43495,7 +43639,7 @@ function ChartBuilder({
|
|
|
43495
43639
|
setSelectedPivotTable(void 0);
|
|
43496
43640
|
}
|
|
43497
43641
|
};
|
|
43498
|
-
const formattedRows = (0,
|
|
43642
|
+
const formattedRows = (0, import_react44.useMemo)(() => {
|
|
43499
43643
|
if (selectedPivotTable && selectedPivotTable.columns && formData.chartType === "table") {
|
|
43500
43644
|
const columns2 = selectedPivotTable.columns;
|
|
43501
43645
|
columns2.forEach((col, index) => {
|
|
@@ -43590,8 +43734,8 @@ function ChartBuilder({
|
|
|
43590
43734
|
handleRunQuery(baseProcessing, updatedFilters);
|
|
43591
43735
|
});
|
|
43592
43736
|
};
|
|
43593
|
-
const filtersEnabledRef = (0,
|
|
43594
|
-
(0,
|
|
43737
|
+
const filtersEnabledRef = (0, import_react44.useRef)(filtersEnabled);
|
|
43738
|
+
(0, import_react44.useEffect)(() => {
|
|
43595
43739
|
if (filtersEnabledRef.current !== filtersEnabled) {
|
|
43596
43740
|
filtersEnabledRef.current = filtersEnabled;
|
|
43597
43741
|
setCurrentPage(0);
|
|
@@ -44153,7 +44297,7 @@ function ChartBuilder({
|
|
|
44153
44297
|
setIsSubmitting(false);
|
|
44154
44298
|
setTriggeredEditChart(false);
|
|
44155
44299
|
};
|
|
44156
|
-
const memoizedTooltipText = (0,
|
|
44300
|
+
const memoizedTooltipText = (0, import_react44.useMemo)(() => {
|
|
44157
44301
|
const getTooltipText = () => {
|
|
44158
44302
|
if (formData.name === "") {
|
|
44159
44303
|
return "Please enter a name for the chart";
|
|
@@ -45334,16 +45478,22 @@ function ChartBuilder({
|
|
|
45334
45478
|
)
|
|
45335
45479
|
}
|
|
45336
45480
|
),
|
|
45337
|
-
(!formData.dateField?.table || !formData.dateField?.field) && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
45338
|
-
|
|
45481
|
+
referencedTablesLoaded && (!formData.dateField?.table || !formData.dateField?.field) && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
45482
|
+
"div",
|
|
45339
45483
|
{
|
|
45340
|
-
|
|
45341
|
-
|
|
45342
|
-
|
|
45343
|
-
|
|
45344
|
-
|
|
45484
|
+
style: { marginBottom: 8, marginTop: "auto" },
|
|
45485
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
45486
|
+
ExclamationFilledIcon_default,
|
|
45487
|
+
{
|
|
45488
|
+
height: 28,
|
|
45489
|
+
width: 28,
|
|
45490
|
+
style: {
|
|
45491
|
+
color: "#dc143c"
|
|
45492
|
+
}
|
|
45493
|
+
}
|
|
45494
|
+
)
|
|
45345
45495
|
}
|
|
45346
|
-
)
|
|
45496
|
+
)
|
|
45347
45497
|
] }),
|
|
45348
45498
|
specificDashboardFilters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
45349
45499
|
"div",
|
|
@@ -45414,10 +45564,13 @@ function ChartBuilder({
|
|
|
45414
45564
|
hideEmptyOption: true
|
|
45415
45565
|
}
|
|
45416
45566
|
),
|
|
45417
|
-
!validFilter[filter.label] && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
45567
|
+
referencedTablesLoaded && !validFilter[filter.label] && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
45418
45568
|
"div",
|
|
45419
45569
|
{
|
|
45420
|
-
style: {
|
|
45570
|
+
style: {
|
|
45571
|
+
marginBottom: 8,
|
|
45572
|
+
marginTop: "auto"
|
|
45573
|
+
},
|
|
45421
45574
|
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
45422
45575
|
ExclamationFilledIcon_default,
|
|
45423
45576
|
{
|
|
@@ -45706,21 +45859,6 @@ function DashboardFilterModal({
|
|
|
45706
45859
|
);
|
|
45707
45860
|
}
|
|
45708
45861
|
|
|
45709
|
-
// src/utils/width.ts
|
|
45710
|
-
var updateFirstChildWidth = (containerRef, setState, options = { gap: 0 }) => {
|
|
45711
|
-
if (containerRef.current) {
|
|
45712
|
-
const element = containerRef.current;
|
|
45713
|
-
const totalWidth = element.getBoundingClientRect().width;
|
|
45714
|
-
const gapWidth = options.gap * (element.childElementCount - 1);
|
|
45715
|
-
let siblingsWidth = 0;
|
|
45716
|
-
const children = Array.from(containerRef.current.children);
|
|
45717
|
-
for (let i = 1; i < children.length; i++) {
|
|
45718
|
-
siblingsWidth += children[i].getBoundingClientRect().width;
|
|
45719
|
-
}
|
|
45720
|
-
setState(totalWidth - siblingsWidth - gapWidth);
|
|
45721
|
-
}
|
|
45722
|
-
};
|
|
45723
|
-
|
|
45724
45862
|
// src/SQLEditor.tsx
|
|
45725
45863
|
init_tableProcessing();
|
|
45726
45864
|
init_queryConstructor();
|
|
@@ -46064,7 +46202,7 @@ init_astProcessing();
|
|
|
46064
46202
|
init_constants();
|
|
46065
46203
|
|
|
46066
46204
|
// src/hooks/useLongLoading.tsx
|
|
46067
|
-
var
|
|
46205
|
+
var import_react45 = require("react");
|
|
46068
46206
|
function useLongLoading(isLoading, meta) {
|
|
46069
46207
|
const {
|
|
46070
46208
|
origin,
|
|
@@ -46072,10 +46210,10 @@ function useLongLoading(isLoading, meta) {
|
|
|
46072
46210
|
abnormalLoadTime = 15e3,
|
|
46073
46211
|
loadDescription
|
|
46074
46212
|
} = meta;
|
|
46075
|
-
const [isLongLoading, setIsLongLoading] = (0,
|
|
46076
|
-
const [isAbnormalLoading, setIsAbnormalLoading] = (0,
|
|
46077
|
-
const { eventTracking } = (0,
|
|
46078
|
-
(0,
|
|
46213
|
+
const [isLongLoading, setIsLongLoading] = (0, import_react45.useState)(false);
|
|
46214
|
+
const [isAbnormalLoading, setIsAbnormalLoading] = (0, import_react45.useState)(false);
|
|
46215
|
+
const { eventTracking } = (0, import_react45.useContext)(EventTrackingContext);
|
|
46216
|
+
(0, import_react45.useEffect)(() => {
|
|
46079
46217
|
let longTimer = null;
|
|
46080
46218
|
let abnormalTimer = null;
|
|
46081
46219
|
if (isLoading) {
|
|
@@ -46237,7 +46375,7 @@ function SQLEditor({
|
|
|
46237
46375
|
onDiscardChanges,
|
|
46238
46376
|
onSaveChanges,
|
|
46239
46377
|
onCloseChartBuilder,
|
|
46240
|
-
isChartBuilderEnabled =
|
|
46378
|
+
isChartBuilderEnabled = true,
|
|
46241
46379
|
isAdminEnabled = false,
|
|
46242
46380
|
chartBuilderOptions,
|
|
46243
46381
|
chartBuilderTitle,
|
|
@@ -46257,67 +46395,69 @@ function SQLEditor({
|
|
|
46257
46395
|
onRequestAddVirtualTable
|
|
46258
46396
|
}) {
|
|
46259
46397
|
const computedButtonLabel = addToDashboardButtonLabel === "Add to dashboard" ? reportId || report?.id ? "Save changes" : "Add to dashboard" : addToDashboardButtonLabel;
|
|
46260
|
-
const [sqlPrompt, setSqlPrompt] = (0,
|
|
46261
|
-
const
|
|
46262
|
-
const
|
|
46263
|
-
|
|
46398
|
+
const [sqlPrompt, setSqlPrompt] = (0, import_react46.useState)("");
|
|
46399
|
+
const sqlPromptFormRef = (0, import_react46.useRef)(null);
|
|
46400
|
+
const sqlPromptInputWidth = useResponsiveFirstChildWidth_default(sqlPromptFormRef, {
|
|
46401
|
+
gap: 12,
|
|
46402
|
+
initialWidth: 320,
|
|
46403
|
+
minWidth: 160
|
|
46404
|
+
});
|
|
46405
|
+
const normalizedSqlPromptWidth = sqlPromptInputWidth > 0 ? sqlPromptInputWidth : 160;
|
|
46406
|
+
const [client] = (0, import_react46.useContext)(ClientContext);
|
|
46407
|
+
const [theme] = (0, import_react46.useContext)(ThemeContext);
|
|
46408
|
+
const { tenants, flags } = (0, import_react46.useContext)(TenantContext);
|
|
46264
46409
|
const { dashboards } = useDashboards();
|
|
46265
46410
|
const {
|
|
46266
46411
|
data,
|
|
46267
46412
|
isLoading: dashboardIsLoading,
|
|
46268
46413
|
reload
|
|
46269
46414
|
} = useDashboardInternal(destinationDashboard);
|
|
46270
|
-
const { getToken, quillFetchWithToken } = (0,
|
|
46271
|
-
const { eventTracking } = (0,
|
|
46415
|
+
const { getToken, quillFetchWithToken } = (0, import_react46.useContext)(FetchContext);
|
|
46416
|
+
const { eventTracking } = (0, import_react46.useContext)(EventTrackingContext);
|
|
46272
46417
|
const { allReportsById } = useAllReports();
|
|
46273
|
-
const destinationDashboardConfig = (0,
|
|
46418
|
+
const destinationDashboardConfig = (0, import_react46.useMemo)(() => {
|
|
46274
46419
|
return dashboards?.find((d) => d.name === destinationDashboard);
|
|
46275
46420
|
}, [dashboards, destinationDashboard]);
|
|
46276
|
-
const [query, setQuery] = (0,
|
|
46277
|
-
const [rows, setRows] = (0,
|
|
46278
|
-
const [columns, setColumns] = (0,
|
|
46279
|
-
const [schemaData] = (0,
|
|
46280
|
-
const { dashboardFilters } = (0,
|
|
46281
|
-
const specificDashboardFilters = (0,
|
|
46421
|
+
const [query, setQuery] = (0, import_react46.useState)(defaultQuery);
|
|
46422
|
+
const [rows, setRows] = (0, import_react46.useState)([]);
|
|
46423
|
+
const [columns, setColumns] = (0, import_react46.useState)([]);
|
|
46424
|
+
const [schemaData] = (0, import_react46.useContext)(SchemaDataContext);
|
|
46425
|
+
const { dashboardFilters } = (0, import_react46.useContext)(DashboardFiltersContext);
|
|
46426
|
+
const specificDashboardFilters = (0, import_react46.useMemo)(() => {
|
|
46282
46427
|
return Object.values(
|
|
46283
46428
|
dashboardFilters[report?.dashboardName ?? destinationDashboard ?? ""] ?? {}
|
|
46284
46429
|
).map((f) => f.filter);
|
|
46285
46430
|
}, [dashboardFilters, destinationDashboard]);
|
|
46286
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
46287
|
-
const [sqlResponseLoading, setSqlResponseLoading] = (0,
|
|
46431
|
+
const [errorMessage, setErrorMessage] = (0, import_react46.useState)("");
|
|
46432
|
+
const [sqlResponseLoading, setSqlResponseLoading] = (0, import_react46.useState)(false);
|
|
46288
46433
|
useLongLoading(sqlResponseLoading, {
|
|
46289
46434
|
origin: "SQLEditor",
|
|
46290
46435
|
loadDescription: "Loading SQL response"
|
|
46291
46436
|
});
|
|
46292
|
-
const [sqlQueryLoading, setSqlQueryLoading] = (0,
|
|
46437
|
+
const [sqlQueryLoading, setSqlQueryLoading] = (0, import_react46.useState)(false);
|
|
46293
46438
|
useLongLoading(sqlQueryLoading, {
|
|
46294
46439
|
origin: "SQLEditor",
|
|
46295
46440
|
loadDescription: "Loading SQL query"
|
|
46296
46441
|
});
|
|
46297
|
-
const [isChartBuilderOpen, setIsChartBuilderOpen] = (0,
|
|
46298
|
-
const [displayTable, setDisplayTable] = (0,
|
|
46299
|
-
const [formattedRows, setFormattedRows] = (0,
|
|
46300
|
-
const
|
|
46301
|
-
const
|
|
46302
|
-
const [
|
|
46303
|
-
const [
|
|
46304
|
-
const [
|
|
46305
|
-
const [
|
|
46306
|
-
const [
|
|
46307
|
-
const [maxPage, setMaxPage] = (0, import_react45.useState)(1);
|
|
46308
|
-
const [tableSearchQuery, setTableSearchQuery] = (0, import_react45.useState)("");
|
|
46309
|
-
const [lastSuccessfulQuery, setLastSuccessfulQuery] = (0, import_react45.useState)("");
|
|
46310
|
-
const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = (0, import_react45.useState)(false);
|
|
46311
|
-
const [tempReport, setTempReport] = (0, import_react45.useState)({
|
|
46442
|
+
const [isChartBuilderOpen, setIsChartBuilderOpen] = (0, import_react46.useState)(false);
|
|
46443
|
+
const [displayTable, setDisplayTable] = (0, import_react46.useState)(false);
|
|
46444
|
+
const [formattedRows, setFormattedRows] = (0, import_react46.useState)([]);
|
|
46445
|
+
const [rowCount, setRowCount] = (0, import_react46.useState)(void 0);
|
|
46446
|
+
const [rowCountIsLoading, setRowCountIsLoading] = (0, import_react46.useState)(false);
|
|
46447
|
+
const [maxPage, setMaxPage] = (0, import_react46.useState)(1);
|
|
46448
|
+
const [tableSearchQuery, setTableSearchQuery] = (0, import_react46.useState)("");
|
|
46449
|
+
const [lastSuccessfulQuery, setLastSuccessfulQuery] = (0, import_react46.useState)("");
|
|
46450
|
+
const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = (0, import_react46.useState)(false);
|
|
46451
|
+
const [tempReport, setTempReport] = (0, import_react46.useState)({
|
|
46312
46452
|
...EMPTY_INTERNAL_REPORT,
|
|
46313
46453
|
...report
|
|
46314
46454
|
});
|
|
46315
|
-
const tableRef = (0,
|
|
46316
|
-
const [cachedHeight, setCachedHeight] = (0,
|
|
46455
|
+
const tableRef = (0, import_react46.useRef)(null);
|
|
46456
|
+
const [cachedHeight, setCachedHeight] = (0, import_react46.useState)(0);
|
|
46317
46457
|
const DEFAULT_ROWS_PER_PAGE = 5;
|
|
46318
46458
|
const ROW_HEIGHT = 37;
|
|
46319
46459
|
const TABLE_TAB_HEIGHT = 75;
|
|
46320
|
-
const filteredSchema = (0,
|
|
46460
|
+
const filteredSchema = (0, import_react46.useMemo)(() => {
|
|
46321
46461
|
return schemaData.schemaWithCustomFields?.filter((table) => {
|
|
46322
46462
|
return destinationDashboardConfig?.tenantKeys?.[0] === SINGLE_TENANT || !table.ownerTenantFields || table.ownerTenantFields?.length === 0 || table.ownerTenantFields?.includes(
|
|
46323
46463
|
destinationDashboardConfig?.tenantKeys?.[0] ?? ""
|
|
@@ -46327,17 +46467,17 @@ function SQLEditor({
|
|
|
46327
46467
|
schemaData.schemaWithCustomFields,
|
|
46328
46468
|
destinationDashboardConfig?.tenantKeys
|
|
46329
46469
|
]);
|
|
46330
|
-
(0,
|
|
46470
|
+
(0, import_react46.useEffect)(() => {
|
|
46331
46471
|
if (tableRef.current) {
|
|
46332
46472
|
setCachedHeight(tableRef.current.clientHeight);
|
|
46333
46473
|
}
|
|
46334
46474
|
}, [tableRef.current?.clientHeight]);
|
|
46335
|
-
(0,
|
|
46475
|
+
(0, import_react46.useEffect)(() => {
|
|
46336
46476
|
if (!data && !dashboardIsLoading) {
|
|
46337
46477
|
reload();
|
|
46338
46478
|
}
|
|
46339
46479
|
}, [data, dashboardIsLoading]);
|
|
46340
|
-
(0,
|
|
46480
|
+
(0, import_react46.useEffect)(() => {
|
|
46341
46481
|
const loadReport = async () => {
|
|
46342
46482
|
let reportToLoad;
|
|
46343
46483
|
if (!client) {
|
|
@@ -46390,9 +46530,9 @@ function SQLEditor({
|
|
|
46390
46530
|
rowsPerPage * 10
|
|
46391
46531
|
)
|
|
46392
46532
|
};
|
|
46393
|
-
const [currentPage, setCurrentPage] = (0,
|
|
46394
|
-
const [currentSort, setCurrentSort] = (0,
|
|
46395
|
-
const currentProcessing = (0,
|
|
46533
|
+
const [currentPage, setCurrentPage] = (0, import_react46.useState)(0);
|
|
46534
|
+
const [currentSort, setCurrentSort] = (0, import_react46.useState)(void 0);
|
|
46535
|
+
const currentProcessing = (0, import_react46.useMemo)(() => {
|
|
46396
46536
|
return {
|
|
46397
46537
|
page: {
|
|
46398
46538
|
currentPage,
|
|
@@ -46405,41 +46545,26 @@ function SQLEditor({
|
|
|
46405
46545
|
sort: currentSort
|
|
46406
46546
|
};
|
|
46407
46547
|
}, [currentPage, rowsPerPage, currentSort]);
|
|
46408
|
-
const displayedTableData = (0,
|
|
46548
|
+
const displayedTableData = (0, import_react46.useMemo)(() => {
|
|
46409
46549
|
return filteredSchema?.filter((table) => {
|
|
46410
46550
|
return table.name?.toLowerCase()?.includes(tableSearchQuery.toLowerCase().trim()) || table.columns.some(
|
|
46411
46551
|
(col) => col.field?.toLowerCase()?.includes(tableSearchQuery.toLowerCase().trim())
|
|
46412
46552
|
);
|
|
46413
46553
|
}) ?? [];
|
|
46414
46554
|
}, [tableSearchQuery, schemaData.schemaWithCustomFields]);
|
|
46415
|
-
(0,
|
|
46416
|
-
function handleResize() {
|
|
46417
|
-
updateFirstChildWidth(formRef, setSearchBarWidth, { gap: 12 });
|
|
46418
|
-
updateFirstChildWidth(sidebarRef, setFilterBarWidth, { gap: 12 });
|
|
46419
|
-
setShowSearchBar(true);
|
|
46420
|
-
}
|
|
46421
|
-
(async () => {
|
|
46422
|
-
await new Promise((resolve) => setTimeout(resolve, 30));
|
|
46423
|
-
handleResize();
|
|
46424
|
-
})();
|
|
46425
|
-
window.addEventListener("resize", handleResize);
|
|
46426
|
-
return () => {
|
|
46427
|
-
window.removeEventListener("resize", handleResize);
|
|
46428
|
-
};
|
|
46429
|
-
}, []);
|
|
46430
|
-
(0, import_react45.useEffect)(() => {
|
|
46555
|
+
(0, import_react46.useEffect)(() => {
|
|
46431
46556
|
if (client) {
|
|
46432
46557
|
setRows([]);
|
|
46433
46558
|
setColumns([]);
|
|
46434
46559
|
setDisplayTable(false);
|
|
46435
46560
|
}
|
|
46436
46561
|
}, [client?.publicKey]);
|
|
46437
|
-
(0,
|
|
46562
|
+
(0, import_react46.useEffect)(() => {
|
|
46438
46563
|
if (isChartBuilderOpen === false) {
|
|
46439
46564
|
onCloseChartBuilder && onCloseChartBuilder();
|
|
46440
46565
|
}
|
|
46441
46566
|
}, [isChartBuilderOpen]);
|
|
46442
|
-
const handleRunSqlPrompt = (0,
|
|
46567
|
+
const handleRunSqlPrompt = (0, import_react46.useCallback)(async () => {
|
|
46443
46568
|
if (!client || sqlResponseLoading) {
|
|
46444
46569
|
return;
|
|
46445
46570
|
}
|
|
@@ -46458,7 +46583,7 @@ function SQLEditor({
|
|
|
46458
46583
|
setQuery(resp.message);
|
|
46459
46584
|
setSqlResponseLoading(false);
|
|
46460
46585
|
}, [sqlPrompt, sqlResponseLoading]);
|
|
46461
|
-
const debounceRunSqlPrompt = (0,
|
|
46586
|
+
const debounceRunSqlPrompt = (0, import_react46.useCallback)(
|
|
46462
46587
|
createDebounce(handleRunSqlPrompt, 500),
|
|
46463
46588
|
[handleRunSqlPrompt]
|
|
46464
46589
|
);
|
|
@@ -46695,7 +46820,7 @@ function SQLEditor({
|
|
|
46695
46820
|
}
|
|
46696
46821
|
return getTablesHelper(getSelectFromAST(resp.ast), dbTables, skipStar);
|
|
46697
46822
|
};
|
|
46698
|
-
(0,
|
|
46823
|
+
(0, import_react46.useEffect)(() => {
|
|
46699
46824
|
if (onChangeQuery) {
|
|
46700
46825
|
onChangeQuery(query || "");
|
|
46701
46826
|
}
|
|
@@ -46752,7 +46877,11 @@ function SQLEditor({
|
|
|
46752
46877
|
style: {
|
|
46753
46878
|
paddingTop: 16,
|
|
46754
46879
|
paddingLeft: "20px",
|
|
46755
|
-
paddingRight: "30px"
|
|
46880
|
+
paddingRight: "30px",
|
|
46881
|
+
width: "100%",
|
|
46882
|
+
maxWidth: 350,
|
|
46883
|
+
minWidth: 250,
|
|
46884
|
+
boxSizing: "border-box"
|
|
46756
46885
|
},
|
|
46757
46886
|
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46758
46887
|
TextInputComponent,
|
|
@@ -46763,7 +46892,7 @@ function SQLEditor({
|
|
|
46763
46892
|
},
|
|
46764
46893
|
value: tableSearchQuery,
|
|
46765
46894
|
id: "edit-name",
|
|
46766
|
-
width:
|
|
46895
|
+
width: "100%"
|
|
46767
46896
|
}
|
|
46768
46897
|
)
|
|
46769
46898
|
}
|
|
@@ -46783,7 +46912,7 @@ function SQLEditor({
|
|
|
46783
46912
|
]
|
|
46784
46913
|
}
|
|
46785
46914
|
),
|
|
46786
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.
|
|
46915
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46787
46916
|
"div",
|
|
46788
46917
|
{
|
|
46789
46918
|
style: {
|
|
@@ -46795,391 +46924,385 @@ function SQLEditor({
|
|
|
46795
46924
|
height: "100%",
|
|
46796
46925
|
overflowX: "hidden"
|
|
46797
46926
|
},
|
|
46798
|
-
children:
|
|
46799
|
-
|
|
46800
|
-
|
|
46801
|
-
{
|
|
46802
|
-
|
|
46803
|
-
|
|
46804
|
-
|
|
46805
|
-
|
|
46806
|
-
|
|
46807
|
-
|
|
46808
|
-
|
|
46809
|
-
|
|
46810
|
-
|
|
46811
|
-
|
|
46812
|
-
|
|
46813
|
-
|
|
46814
|
-
|
|
46815
|
-
|
|
46816
|
-
|
|
46817
|
-
|
|
46818
|
-
|
|
46819
|
-
|
|
46820
|
-
|
|
46821
|
-
|
|
46822
|
-
|
|
46823
|
-
|
|
46824
|
-
|
|
46825
|
-
|
|
46826
|
-
|
|
46827
|
-
|
|
46828
|
-
|
|
46829
|
-
|
|
46830
|
-
|
|
46831
|
-
|
|
46832
|
-
id: "ai-search",
|
|
46833
|
-
value: sqlPrompt,
|
|
46834
|
-
width: searchBarWidth,
|
|
46835
|
-
onChange: (e) => setSqlPrompt(e.target.value),
|
|
46836
|
-
placeholder: "Ask a question..."
|
|
46837
|
-
}
|
|
46838
|
-
),
|
|
46839
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46840
|
-
QuillToolTip,
|
|
46841
|
-
{
|
|
46842
|
-
text: "Prompt must be less than 500 characters",
|
|
46843
|
-
enabled: sqlPrompt.trim().length > 500,
|
|
46844
|
-
displayBelow: true,
|
|
46845
|
-
textStyle: {
|
|
46846
|
-
maxWidth: "77px",
|
|
46847
|
-
whiteSpace: "normal"
|
|
46848
|
-
},
|
|
46849
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46850
|
-
ButtonComponent,
|
|
46851
|
-
{
|
|
46852
|
-
onClick: debounceRunSqlPrompt,
|
|
46853
|
-
label: "Ask AI",
|
|
46854
|
-
isLoading: sqlResponseLoading,
|
|
46855
|
-
disabled: sqlPrompt.trim().length > 500
|
|
46856
|
-
}
|
|
46857
|
-
)
|
|
46858
|
-
}
|
|
46859
|
-
)
|
|
46860
|
-
]
|
|
46861
|
-
}
|
|
46862
|
-
),
|
|
46863
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46864
|
-
"div",
|
|
46865
|
-
{
|
|
46866
|
-
style: {
|
|
46867
|
-
minHeight: "max(210px, 20vh)",
|
|
46868
|
-
maxHeight: "30%",
|
|
46869
|
-
height: "20vh"
|
|
46870
|
-
},
|
|
46871
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46872
|
-
SQLEditorComponent,
|
|
46927
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46928
|
+
"div",
|
|
46929
|
+
{
|
|
46930
|
+
style: {
|
|
46931
|
+
display: "flex",
|
|
46932
|
+
flexDirection: "column",
|
|
46933
|
+
overflow: addToDashboardButtonLabel === "Add to dashboard" ? "visible" : "auto",
|
|
46934
|
+
height: "100%"
|
|
46935
|
+
},
|
|
46936
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(OverflowContainer, { children: [
|
|
46937
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
46938
|
+
"form",
|
|
46939
|
+
{
|
|
46940
|
+
ref: sqlPromptFormRef,
|
|
46941
|
+
onSubmit: (e) => {
|
|
46942
|
+
e.preventDefault();
|
|
46943
|
+
if (sqlPrompt.trim().length > 500) {
|
|
46944
|
+
return;
|
|
46945
|
+
}
|
|
46946
|
+
debounceRunSqlPrompt();
|
|
46947
|
+
},
|
|
46948
|
+
style: {
|
|
46949
|
+
display: "flex",
|
|
46950
|
+
flexDirection: "row",
|
|
46951
|
+
gap: 12,
|
|
46952
|
+
paddingTop: 16,
|
|
46953
|
+
paddingBottom: 16,
|
|
46954
|
+
flexWrap: "wrap",
|
|
46955
|
+
alignItems: "stretch",
|
|
46956
|
+
visibility: normalizedSqlPromptWidth > 0 ? "visible" : "hidden"
|
|
46957
|
+
},
|
|
46958
|
+
children: [
|
|
46959
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46960
|
+
TextInputComponent,
|
|
46873
46961
|
{
|
|
46874
|
-
|
|
46875
|
-
|
|
46876
|
-
|
|
46877
|
-
|
|
46878
|
-
|
|
46879
|
-
handleRunQuery: () => {
|
|
46880
|
-
handleRunQuery(currentProcessing, true);
|
|
46881
|
-
},
|
|
46882
|
-
handleFixWithAI,
|
|
46883
|
-
isNewQueryEnabled,
|
|
46884
|
-
runQueryOnMount,
|
|
46885
|
-
handleClearQuery,
|
|
46886
|
-
theme,
|
|
46887
|
-
defineEditorTheme,
|
|
46888
|
-
setEditorTheme,
|
|
46889
|
-
setEditorMounted: () => {
|
|
46890
|
-
},
|
|
46891
|
-
ButtonComponent,
|
|
46892
|
-
SecondaryButtonComponent,
|
|
46893
|
-
loading: sqlResponseLoading && schemaData.isSchemaLoading && dashboardIsLoading,
|
|
46894
|
-
LoadingComponent
|
|
46962
|
+
id: "ai-search",
|
|
46963
|
+
value: sqlPrompt,
|
|
46964
|
+
width: normalizedSqlPromptWidth,
|
|
46965
|
+
onChange: (e) => setSqlPrompt(e.target.value),
|
|
46966
|
+
placeholder: "Ask a question..."
|
|
46895
46967
|
}
|
|
46896
|
-
)
|
|
46897
|
-
|
|
46898
|
-
|
|
46899
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46900
|
-
"div",
|
|
46901
|
-
{
|
|
46902
|
-
style: {
|
|
46903
|
-
display: "flex",
|
|
46904
|
-
flexDirection: "row",
|
|
46905
|
-
width: "100%",
|
|
46906
|
-
justifyContent: addToDashboardButtonLabel === "Add to dashboard" ? "flex-end" : "flex-start"
|
|
46907
|
-
},
|
|
46908
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46909
|
-
"div",
|
|
46968
|
+
),
|
|
46969
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46970
|
+
QuillToolTip,
|
|
46910
46971
|
{
|
|
46911
|
-
|
|
46912
|
-
|
|
46913
|
-
|
|
46914
|
-
|
|
46915
|
-
|
|
46972
|
+
text: "Prompt must be less than 500 characters",
|
|
46973
|
+
enabled: sqlPrompt.trim().length > 500,
|
|
46974
|
+
displayBelow: true,
|
|
46975
|
+
textStyle: {
|
|
46976
|
+
maxWidth: "77px",
|
|
46977
|
+
whiteSpace: "normal"
|
|
46916
46978
|
},
|
|
46917
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime66.
|
|
46918
|
-
|
|
46919
|
-
|
|
46920
|
-
|
|
46921
|
-
|
|
46922
|
-
|
|
46923
|
-
|
|
46924
|
-
|
|
46925
|
-
|
|
46926
|
-
},
|
|
46927
|
-
true,
|
|
46928
|
-
false,
|
|
46929
|
-
true
|
|
46930
|
-
);
|
|
46931
|
-
},
|
|
46932
|
-
label: "Run query"
|
|
46933
|
-
}
|
|
46934
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46935
|
-
ButtonComponent,
|
|
46936
|
-
{
|
|
46937
|
-
onClick: () => {
|
|
46938
|
-
handleRunQuery(
|
|
46939
|
-
{
|
|
46940
|
-
page: pagination,
|
|
46941
|
-
sort: void 0
|
|
46942
|
-
},
|
|
46943
|
-
true,
|
|
46944
|
-
false,
|
|
46945
|
-
true
|
|
46946
|
-
);
|
|
46947
|
-
},
|
|
46948
|
-
label: "Run query"
|
|
46949
|
-
}
|
|
46950
|
-
),
|
|
46951
|
-
isAdminEnabled && !report && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46952
|
-
SecondaryButtonComponent,
|
|
46953
|
-
{
|
|
46954
|
-
disabled: !!errorMessage || !(lastSuccessfulQuery === query) || !query,
|
|
46955
|
-
onClick: async () => {
|
|
46956
|
-
const isSelectStar = isSimpleSelectStarQuery(
|
|
46957
|
-
query ?? ""
|
|
46958
|
-
);
|
|
46959
|
-
let tables = [];
|
|
46960
|
-
let customFieldColumns = [];
|
|
46961
|
-
if (client && isSelectStar && schemaData.customFields) {
|
|
46962
|
-
const { referencedTablesAndColumns } = await getReferencedTables(
|
|
46963
|
-
client,
|
|
46964
|
-
query ?? "",
|
|
46965
|
-
schemaData.schemaWithCustomFields,
|
|
46966
|
-
isSelectStar
|
|
46967
|
-
);
|
|
46968
|
-
tables = referencedTablesAndColumns.map(
|
|
46969
|
-
(ref) => ref.name
|
|
46970
|
-
);
|
|
46971
|
-
customFieldColumns = tables.map((table) => {
|
|
46972
|
-
return (schemaData.customFields?.[table] ?? []).map((field) => field.field);
|
|
46973
|
-
}).flat();
|
|
46974
|
-
}
|
|
46975
|
-
setTempReport({
|
|
46976
|
-
...tempReport,
|
|
46977
|
-
id: TEMP_REPORT_ID,
|
|
46978
|
-
rows,
|
|
46979
|
-
columns: isSelectStar ? (
|
|
46980
|
-
// so Automatic Custom Fields can be applied
|
|
46981
|
-
columns.filter(
|
|
46982
|
-
(col) => {
|
|
46983
|
-
return !customFieldColumns.includes(
|
|
46984
|
-
col.field
|
|
46985
|
-
);
|
|
46986
|
-
}
|
|
46987
|
-
)
|
|
46988
|
-
) : columns,
|
|
46989
|
-
includeCustomFields: isSelectStar,
|
|
46990
|
-
columnInternal: columns,
|
|
46991
|
-
rowCount: rowCount ?? 0,
|
|
46992
|
-
queryString: query ?? "",
|
|
46993
|
-
chartType: "table",
|
|
46994
|
-
dashboardName: destinationDashboard
|
|
46995
|
-
});
|
|
46996
|
-
setIsSaveQueryModalOpen(true);
|
|
46997
|
-
},
|
|
46998
|
-
label: "Save query"
|
|
46999
|
-
}
|
|
47000
|
-
),
|
|
47001
|
-
isNewQueryEnabled && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47002
|
-
SecondaryButtonComponent,
|
|
47003
|
-
{
|
|
47004
|
-
onClick: handleClearQuery,
|
|
47005
|
-
label: "Clear query"
|
|
47006
|
-
}
|
|
47007
|
-
),
|
|
47008
|
-
computedButtonLabel === "Add to dashboard" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47009
|
-
ButtonComponent,
|
|
47010
|
-
{
|
|
47011
|
-
onClick: async () => {
|
|
47012
|
-
onSaveChanges && onSaveChanges();
|
|
47013
|
-
const isSelectStar = isSimpleSelectStarQuery(
|
|
47014
|
-
query ?? ""
|
|
47015
|
-
);
|
|
47016
|
-
let tables = [];
|
|
47017
|
-
let customFieldColumns = [];
|
|
47018
|
-
if (client && isSelectStar && schemaData.customFields) {
|
|
47019
|
-
const { referencedTablesAndColumns } = await getReferencedTables(
|
|
47020
|
-
client,
|
|
47021
|
-
query ?? "",
|
|
47022
|
-
filteredSchema,
|
|
47023
|
-
isSelectStar
|
|
47024
|
-
);
|
|
47025
|
-
tables = referencedTablesAndColumns.map(
|
|
47026
|
-
(ref) => ref.name
|
|
47027
|
-
);
|
|
47028
|
-
customFieldColumns = tables.map((table) => {
|
|
47029
|
-
return (schemaData.customFields?.[table] ?? []).map((field) => field.field);
|
|
47030
|
-
}).flat();
|
|
47031
|
-
}
|
|
47032
|
-
const newTempReport = {
|
|
47033
|
-
...tempReport,
|
|
47034
|
-
id: reportId || report?.id || TEMP_REPORT_ID,
|
|
47035
|
-
rows,
|
|
47036
|
-
columns: isSelectStar ? (
|
|
47037
|
-
// so Automatic Custom Fields can be applied
|
|
47038
|
-
columns.filter(
|
|
47039
|
-
(col) => {
|
|
47040
|
-
return !customFieldColumns.includes(
|
|
47041
|
-
col.field
|
|
47042
|
-
);
|
|
47043
|
-
}
|
|
47044
|
-
)
|
|
47045
|
-
) : columns,
|
|
47046
|
-
includeCustomFields: isSelectStar,
|
|
47047
|
-
columnInternal: columns,
|
|
47048
|
-
rowCount: rowCount ?? 0,
|
|
47049
|
-
queryString: query ?? "",
|
|
47050
|
-
dashboardName: report?.dashboardName ?? destinationDashboard
|
|
47051
|
-
};
|
|
47052
|
-
setTempReport(newTempReport);
|
|
47053
|
-
setIsChartBuilderOpen(true);
|
|
47054
|
-
},
|
|
47055
|
-
label: computedButtonLabel,
|
|
47056
|
-
disabled: !!errorMessage || !(lastSuccessfulQuery === query) || !query,
|
|
47057
|
-
tooltipText: !!errorMessage || !(lastSuccessfulQuery === query) ? "Please run a query" : ""
|
|
47058
|
-
}
|
|
47059
|
-
)
|
|
47060
|
-
] })
|
|
46979
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46980
|
+
ButtonComponent,
|
|
46981
|
+
{
|
|
46982
|
+
onClick: debounceRunSqlPrompt,
|
|
46983
|
+
label: "Ask AI",
|
|
46984
|
+
isLoading: sqlResponseLoading,
|
|
46985
|
+
disabled: sqlPrompt.trim().length > 500
|
|
46986
|
+
}
|
|
46987
|
+
)
|
|
47061
46988
|
}
|
|
47062
46989
|
)
|
|
47063
|
-
|
|
47064
|
-
|
|
47065
|
-
|
|
47066
|
-
|
|
47067
|
-
|
|
47068
|
-
|
|
47069
|
-
|
|
47070
|
-
|
|
47071
|
-
|
|
47072
|
-
|
|
47073
|
-
|
|
47074
|
-
|
|
47075
|
-
|
|
47076
|
-
|
|
47077
|
-
|
|
47078
|
-
|
|
46990
|
+
]
|
|
46991
|
+
}
|
|
46992
|
+
),
|
|
46993
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46994
|
+
"div",
|
|
46995
|
+
{
|
|
46996
|
+
style: {
|
|
46997
|
+
minHeight: "max(210px, 20vh)",
|
|
46998
|
+
maxHeight: "30%",
|
|
46999
|
+
height: "20vh"
|
|
47000
|
+
},
|
|
47001
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47002
|
+
SQLEditorComponent,
|
|
47003
|
+
{
|
|
47004
|
+
query: query || "",
|
|
47005
|
+
schema: filteredSchema,
|
|
47006
|
+
databaseType: client?.databaseType ?? "postgresql",
|
|
47007
|
+
clientName: client?.publicKey || "",
|
|
47008
|
+
setQuery,
|
|
47009
|
+
handleRunQuery: () => {
|
|
47010
|
+
handleRunQuery(currentProcessing, true);
|
|
47011
|
+
},
|
|
47012
|
+
handleFixWithAI,
|
|
47013
|
+
isNewQueryEnabled,
|
|
47014
|
+
runQueryOnMount,
|
|
47015
|
+
handleClearQuery,
|
|
47016
|
+
theme,
|
|
47017
|
+
defineEditorTheme,
|
|
47018
|
+
setEditorTheme,
|
|
47019
|
+
setEditorMounted: () => {
|
|
47020
|
+
},
|
|
47021
|
+
ButtonComponent,
|
|
47022
|
+
SecondaryButtonComponent,
|
|
47023
|
+
loading: sqlResponseLoading && schemaData.isSchemaLoading && dashboardIsLoading,
|
|
47024
|
+
LoadingComponent
|
|
47025
|
+
}
|
|
47026
|
+
)
|
|
47027
|
+
}
|
|
47028
|
+
),
|
|
47029
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47030
|
+
"div",
|
|
47031
|
+
{
|
|
47032
|
+
style: {
|
|
47033
|
+
display: "flex",
|
|
47034
|
+
flexDirection: "row",
|
|
47035
|
+
width: "100%",
|
|
47036
|
+
justifyContent: addToDashboardButtonLabel === "Add to dashboard" ? "flex-end" : "flex-start"
|
|
47037
|
+
},
|
|
47038
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47039
|
+
"div",
|
|
47040
|
+
{
|
|
47041
|
+
style: {
|
|
47042
|
+
display: "flex",
|
|
47043
|
+
flexDirection: "row",
|
|
47044
|
+
alignItems: "center",
|
|
47045
|
+
height: 70
|
|
47046
|
+
},
|
|
47047
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
47079
47048
|
"div",
|
|
47080
47049
|
{
|
|
47081
47050
|
style: {
|
|
47082
|
-
|
|
47083
|
-
|
|
47084
|
-
fontSize: 15,
|
|
47085
|
-
fontWeight: "400",
|
|
47086
|
-
width: "100%"
|
|
47051
|
+
display: "flex",
|
|
47052
|
+
gap: 12
|
|
47087
47053
|
},
|
|
47088
|
-
children:
|
|
47089
|
-
"
|
|
47090
|
-
|
|
47091
|
-
|
|
47092
|
-
|
|
47093
|
-
|
|
47094
|
-
|
|
47095
|
-
|
|
47096
|
-
|
|
47097
|
-
|
|
47098
|
-
|
|
47099
|
-
|
|
47100
|
-
|
|
47101
|
-
|
|
47102
|
-
|
|
47103
|
-
|
|
47104
|
-
|
|
47105
|
-
|
|
47106
|
-
|
|
47107
|
-
|
|
47108
|
-
|
|
47109
|
-
|
|
47054
|
+
children: [
|
|
47055
|
+
computedButtonLabel === "Add to dashboard" ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47056
|
+
SecondaryButtonComponent,
|
|
47057
|
+
{
|
|
47058
|
+
onClick: () => {
|
|
47059
|
+
handleRunQuery(
|
|
47060
|
+
{
|
|
47061
|
+
page: pagination,
|
|
47062
|
+
sort: void 0
|
|
47063
|
+
},
|
|
47064
|
+
true,
|
|
47065
|
+
false,
|
|
47066
|
+
true
|
|
47067
|
+
);
|
|
47068
|
+
},
|
|
47069
|
+
label: "Run query"
|
|
47070
|
+
}
|
|
47071
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47072
|
+
SecondaryButtonComponent,
|
|
47073
|
+
{
|
|
47074
|
+
onClick: () => {
|
|
47075
|
+
handleRunQuery(
|
|
47076
|
+
{
|
|
47077
|
+
page: pagination,
|
|
47078
|
+
sort: void 0
|
|
47079
|
+
},
|
|
47080
|
+
true,
|
|
47081
|
+
false,
|
|
47082
|
+
true
|
|
47083
|
+
);
|
|
47084
|
+
},
|
|
47085
|
+
label: "Run query"
|
|
47086
|
+
}
|
|
47087
|
+
),
|
|
47088
|
+
isChartBuilderEnabled && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47089
|
+
"div",
|
|
47090
|
+
{
|
|
47091
|
+
style: {
|
|
47092
|
+
display: "flex",
|
|
47093
|
+
flexDirection: "row",
|
|
47094
|
+
alignItems: "center",
|
|
47095
|
+
justifyContent: "flex-end",
|
|
47096
|
+
width: "100%"
|
|
47097
|
+
},
|
|
47098
|
+
children: computedButtonLabel !== "Add to dashboard" ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47099
|
+
ButtonComponent,
|
|
47100
|
+
{
|
|
47101
|
+
onClick: async () => {
|
|
47102
|
+
onSaveChanges && onSaveChanges();
|
|
47103
|
+
setIsChartBuilderOpen(true);
|
|
47104
|
+
},
|
|
47105
|
+
label: computedButtonLabel,
|
|
47106
|
+
disabled: !!errorMessage || !(lastSuccessfulQuery === query)
|
|
47107
|
+
}
|
|
47108
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47109
|
+
ButtonComponent,
|
|
47110
47110
|
{
|
|
47111
|
-
onClick:
|
|
47112
|
-
|
|
47111
|
+
onClick: async () => {
|
|
47112
|
+
onSaveChanges && onSaveChanges();
|
|
47113
|
+
const isSelectStar = isSimpleSelectStarQuery(query ?? "");
|
|
47114
|
+
let tables = [];
|
|
47115
|
+
let customFieldColumns = [];
|
|
47116
|
+
if (client && isSelectStar && schemaData.customFields) {
|
|
47117
|
+
const { referencedTablesAndColumns } = await getReferencedTables(
|
|
47118
|
+
client,
|
|
47119
|
+
query ?? "",
|
|
47120
|
+
filteredSchema,
|
|
47121
|
+
isSelectStar
|
|
47122
|
+
);
|
|
47123
|
+
tables = referencedTablesAndColumns.map(
|
|
47124
|
+
(ref) => ref.name
|
|
47125
|
+
);
|
|
47126
|
+
customFieldColumns = tables.map((table) => {
|
|
47127
|
+
return (schemaData.customFields?.[table] ?? []).map((field) => field.field);
|
|
47128
|
+
}).flat();
|
|
47129
|
+
}
|
|
47130
|
+
const newTempReport = {
|
|
47131
|
+
...tempReport,
|
|
47132
|
+
id: reportId || report?.id || TEMP_REPORT_ID,
|
|
47133
|
+
rows,
|
|
47134
|
+
columns: isSelectStar ? (
|
|
47135
|
+
// so Automatic Custom Fields can be applied
|
|
47136
|
+
columns.filter(
|
|
47137
|
+
(col) => {
|
|
47138
|
+
return !customFieldColumns.includes(
|
|
47139
|
+
col.field
|
|
47140
|
+
);
|
|
47141
|
+
}
|
|
47142
|
+
)
|
|
47143
|
+
) : columns,
|
|
47144
|
+
includeCustomFields: isSelectStar,
|
|
47145
|
+
columnInternal: columns,
|
|
47146
|
+
rowCount: rowCount ?? 0,
|
|
47147
|
+
queryString: query ?? "",
|
|
47148
|
+
dashboardName: report?.dashboardName ?? destinationDashboard
|
|
47149
|
+
};
|
|
47150
|
+
setTempReport(newTempReport);
|
|
47151
|
+
setIsChartBuilderOpen(true);
|
|
47152
|
+
},
|
|
47153
|
+
label: computedButtonLabel,
|
|
47154
|
+
disabled: !!errorMessage || !(lastSuccessfulQuery === query) || !query,
|
|
47155
|
+
tooltipText: !!errorMessage || !(lastSuccessfulQuery === query) ? "Please run a query" : ""
|
|
47113
47156
|
}
|
|
47114
47157
|
)
|
|
47115
|
-
|
|
47116
|
-
|
|
47117
|
-
|
|
47118
|
-
|
|
47119
|
-
|
|
47120
|
-
|
|
47121
|
-
|
|
47122
|
-
|
|
47123
|
-
|
|
47124
|
-
|
|
47125
|
-
|
|
47126
|
-
|
|
47127
|
-
|
|
47128
|
-
|
|
47129
|
-
|
|
47130
|
-
|
|
47131
|
-
|
|
47132
|
-
|
|
47133
|
-
|
|
47134
|
-
|
|
47135
|
-
|
|
47136
|
-
|
|
47137
|
-
|
|
47138
|
-
|
|
47158
|
+
}
|
|
47159
|
+
),
|
|
47160
|
+
isAdminEnabled && !report && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47161
|
+
SecondaryButtonComponent,
|
|
47162
|
+
{
|
|
47163
|
+
disabled: !!errorMessage || !(lastSuccessfulQuery === query) || !query,
|
|
47164
|
+
onClick: async () => {
|
|
47165
|
+
const isSelectStar = isSimpleSelectStarQuery(
|
|
47166
|
+
query ?? ""
|
|
47167
|
+
);
|
|
47168
|
+
let tables = [];
|
|
47169
|
+
let customFieldColumns = [];
|
|
47170
|
+
if (client && isSelectStar && schemaData.customFields) {
|
|
47171
|
+
const { referencedTablesAndColumns } = await getReferencedTables(
|
|
47172
|
+
client,
|
|
47173
|
+
query ?? "",
|
|
47174
|
+
schemaData.schemaWithCustomFields,
|
|
47175
|
+
isSelectStar
|
|
47176
|
+
);
|
|
47177
|
+
tables = referencedTablesAndColumns.map(
|
|
47178
|
+
(ref) => ref.name
|
|
47179
|
+
);
|
|
47180
|
+
customFieldColumns = tables.map((table) => {
|
|
47181
|
+
return (schemaData.customFields?.[table] ?? []).map((field) => field.field);
|
|
47182
|
+
}).flat();
|
|
47183
|
+
}
|
|
47184
|
+
setTempReport({
|
|
47185
|
+
...tempReport,
|
|
47186
|
+
id: TEMP_REPORT_ID,
|
|
47187
|
+
rows,
|
|
47188
|
+
columns: isSelectStar ? (
|
|
47189
|
+
// so Automatic Custom Fields can be applied
|
|
47190
|
+
columns.filter(
|
|
47191
|
+
(col) => {
|
|
47192
|
+
return !customFieldColumns.includes(
|
|
47193
|
+
col.field
|
|
47194
|
+
);
|
|
47195
|
+
}
|
|
47196
|
+
)
|
|
47197
|
+
) : columns,
|
|
47198
|
+
includeCustomFields: isSelectStar,
|
|
47199
|
+
columnInternal: columns,
|
|
47200
|
+
rowCount: rowCount ?? 0,
|
|
47201
|
+
queryString: query ?? "",
|
|
47202
|
+
chartType: "table",
|
|
47203
|
+
dashboardName: destinationDashboard
|
|
47204
|
+
});
|
|
47205
|
+
setIsSaveQueryModalOpen(true);
|
|
47206
|
+
},
|
|
47207
|
+
label: "Save query"
|
|
47208
|
+
}
|
|
47209
|
+
),
|
|
47210
|
+
isNewQueryEnabled && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47211
|
+
SecondaryButtonComponent,
|
|
47212
|
+
{
|
|
47213
|
+
onClick: handleClearQuery,
|
|
47214
|
+
label: "Clear query"
|
|
47215
|
+
}
|
|
47216
|
+
)
|
|
47217
|
+
]
|
|
47139
47218
|
}
|
|
47140
|
-
)
|
|
47141
|
-
|
|
47142
|
-
|
|
47143
|
-
|
|
47144
|
-
|
|
47145
|
-
|
|
47146
|
-
|
|
47147
|
-
|
|
47148
|
-
|
|
47149
|
-
|
|
47150
|
-
|
|
47151
|
-
|
|
47152
|
-
|
|
47153
|
-
|
|
47154
|
-
|
|
47155
|
-
|
|
47156
|
-
|
|
47157
|
-
|
|
47158
|
-
|
|
47159
|
-
|
|
47160
|
-
|
|
47161
|
-
|
|
47162
|
-
|
|
47163
|
-
|
|
47164
|
-
|
|
47165
|
-
|
|
47166
|
-
|
|
47167
|
-
|
|
47168
|
-
|
|
47169
|
-
|
|
47170
|
-
|
|
47171
|
-
|
|
47172
|
-
|
|
47173
|
-
|
|
47174
|
-
|
|
47175
|
-
|
|
47176
|
-
|
|
47177
|
-
|
|
47178
|
-
|
|
47179
|
-
|
|
47180
|
-
|
|
47181
|
-
|
|
47182
|
-
|
|
47219
|
+
)
|
|
47220
|
+
}
|
|
47221
|
+
)
|
|
47222
|
+
}
|
|
47223
|
+
),
|
|
47224
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
47225
|
+
"div",
|
|
47226
|
+
{
|
|
47227
|
+
style: {
|
|
47228
|
+
display: "flex",
|
|
47229
|
+
flexDirection: "column",
|
|
47230
|
+
// height: '100%',
|
|
47231
|
+
padding: 0,
|
|
47232
|
+
margin: 0,
|
|
47233
|
+
border: "none",
|
|
47234
|
+
outline: "none"
|
|
47235
|
+
},
|
|
47236
|
+
children: [
|
|
47237
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47238
|
+
"div",
|
|
47239
|
+
{
|
|
47240
|
+
style: {
|
|
47241
|
+
fontFamily: theme?.fontFamily,
|
|
47242
|
+
color: theme?.primaryTextColor,
|
|
47243
|
+
fontSize: 15,
|
|
47244
|
+
fontWeight: "400",
|
|
47245
|
+
width: "100%"
|
|
47246
|
+
},
|
|
47247
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
47248
|
+
"div",
|
|
47249
|
+
{
|
|
47250
|
+
style: {
|
|
47251
|
+
display: "flex",
|
|
47252
|
+
flexDirection: "row",
|
|
47253
|
+
justifyContent: "space-between",
|
|
47254
|
+
gap: 12,
|
|
47255
|
+
background: "rgba(0,0,0,0.02)",
|
|
47256
|
+
// TODO: change color
|
|
47257
|
+
color: theme?.primaryTextColor,
|
|
47258
|
+
fontFamily: theme?.fontFamily,
|
|
47259
|
+
borderRadius: 6,
|
|
47260
|
+
padding: 20,
|
|
47261
|
+
marginBottom: 15,
|
|
47262
|
+
width: "100%",
|
|
47263
|
+
alignItems: "center"
|
|
47264
|
+
},
|
|
47265
|
+
children: [
|
|
47266
|
+
errorMessage,
|
|
47267
|
+
errorMessage !== "No data found" && errorMessage !== "No query found" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47268
|
+
SecondaryButtonComponent,
|
|
47269
|
+
{
|
|
47270
|
+
onClick: handleFixWithAI,
|
|
47271
|
+
label: "Fix with AI"
|
|
47272
|
+
}
|
|
47273
|
+
)
|
|
47274
|
+
]
|
|
47275
|
+
}
|
|
47276
|
+
)
|
|
47277
|
+
}
|
|
47278
|
+
),
|
|
47279
|
+
errorMessage || !displayTable ? null : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { ref: tableRef, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47280
|
+
TableComponent,
|
|
47281
|
+
{
|
|
47282
|
+
isLoading: sqlQueryLoading,
|
|
47283
|
+
rows: formattedRows,
|
|
47284
|
+
columns,
|
|
47285
|
+
rowCount,
|
|
47286
|
+
rowsPerPage,
|
|
47287
|
+
rowCountIsLoading,
|
|
47288
|
+
onPageChange,
|
|
47289
|
+
onSortChange,
|
|
47290
|
+
containerStyle: {
|
|
47291
|
+
height: "calc(100vh - max(210px, 20vh) - 310px)",
|
|
47292
|
+
minHeight: `calc(${DEFAULT_ROWS_PER_PAGE} * ${ROW_HEIGHT}px + ${TABLE_TAB_HEIGHT}px)`,
|
|
47293
|
+
// at least 10 rows tall
|
|
47294
|
+
maxHeight: "calc(100vh - max(210px, 20vh) - 310px)"
|
|
47295
|
+
},
|
|
47296
|
+
currentPage,
|
|
47297
|
+
setCurrentPage
|
|
47298
|
+
}
|
|
47299
|
+
) })
|
|
47300
|
+
]
|
|
47301
|
+
}
|
|
47302
|
+
)
|
|
47303
|
+
] })
|
|
47304
|
+
}
|
|
47305
|
+
)
|
|
47183
47306
|
}
|
|
47184
47307
|
)
|
|
47185
47308
|
]
|
|
@@ -47323,10 +47446,10 @@ var SQLEditorComponent = ({
|
|
|
47323
47446
|
loading,
|
|
47324
47447
|
LoadingComponent = QuillLoadingComponent
|
|
47325
47448
|
}) => {
|
|
47326
|
-
const [editorKey, setEditorKey] = (0,
|
|
47327
|
-
const { eventTracking } = (0,
|
|
47328
|
-
const currentProvider = (0,
|
|
47329
|
-
(0,
|
|
47449
|
+
const [editorKey, setEditorKey] = (0, import_react46.useState)(0);
|
|
47450
|
+
const { eventTracking } = (0, import_react46.useContext)(EventTrackingContext);
|
|
47451
|
+
const currentProvider = (0, import_react46.useRef)(null);
|
|
47452
|
+
(0, import_react46.useEffect)(() => {
|
|
47330
47453
|
if (currentProvider.current) {
|
|
47331
47454
|
currentProvider.current.dispose();
|
|
47332
47455
|
if (schema && schema.length !== 0) {
|
|
@@ -47370,7 +47493,7 @@ var SQLEditorComponent = ({
|
|
|
47370
47493
|
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(LoadingComponent, {})
|
|
47371
47494
|
}
|
|
47372
47495
|
) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47373
|
-
|
|
47496
|
+
import_react47.default,
|
|
47374
47497
|
{
|
|
47375
47498
|
height: "100%",
|
|
47376
47499
|
width: "100%",
|
|
@@ -47567,7 +47690,7 @@ function SchemaItem({
|
|
|
47567
47690
|
index,
|
|
47568
47691
|
onClick
|
|
47569
47692
|
}) {
|
|
47570
|
-
const [isOpen, setIsOpen] = (0,
|
|
47693
|
+
const [isOpen, setIsOpen] = (0, import_react46.useState)(index === 0);
|
|
47571
47694
|
const schemaContainerStyle = {
|
|
47572
47695
|
display: "flex",
|
|
47573
47696
|
flexDirection: "column"
|
|
@@ -47794,11 +47917,11 @@ function SchemaItem({
|
|
|
47794
47917
|
}
|
|
47795
47918
|
|
|
47796
47919
|
// src/ReportBuilder.tsx
|
|
47797
|
-
var
|
|
47920
|
+
var import_react54 = require("react");
|
|
47798
47921
|
init_constants();
|
|
47799
47922
|
|
|
47800
47923
|
// src/hooks/useReportBuilder.tsx
|
|
47801
|
-
var
|
|
47924
|
+
var import_react48 = require("react");
|
|
47802
47925
|
init_tableProcessing();
|
|
47803
47926
|
init_ReportBuilder();
|
|
47804
47927
|
init_constants();
|
|
@@ -47818,19 +47941,19 @@ var useReportBuilderInternal = ({
|
|
|
47818
47941
|
rowsPerRequest
|
|
47819
47942
|
}) => {
|
|
47820
47943
|
const { allReportsById } = useAllReports();
|
|
47821
|
-
const [schemaData] = (0,
|
|
47944
|
+
const [schemaData] = (0, import_react48.useContext)(SchemaDataContext);
|
|
47822
47945
|
const { dashboards } = useDashboards();
|
|
47823
47946
|
const {
|
|
47824
47947
|
data,
|
|
47825
47948
|
isLoading: dashboardIsLoading,
|
|
47826
47949
|
reload
|
|
47827
47950
|
} = useDashboardInternal(destinationDashboard);
|
|
47828
|
-
const { getToken } = (0,
|
|
47829
|
-
const { eventTracking } = (0,
|
|
47830
|
-
const destinationDashboardConfig = (0,
|
|
47951
|
+
const { getToken } = (0, import_react48.useContext)(FetchContext);
|
|
47952
|
+
const { eventTracking } = (0, import_react48.useContext)(EventTrackingContext);
|
|
47953
|
+
const destinationDashboardConfig = (0, import_react48.useMemo)(() => {
|
|
47831
47954
|
return dashboards?.find((d) => d.name === destinationDashboard);
|
|
47832
47955
|
}, [dashboards, destinationDashboard]);
|
|
47833
|
-
const filteredSchema = (0,
|
|
47956
|
+
const filteredSchema = (0, import_react48.useMemo)(() => {
|
|
47834
47957
|
return schemaData.schemaWithCustomFields?.filter((table) => {
|
|
47835
47958
|
return destinationDashboardConfig?.tenantKeys?.[0] === SINGLE_TENANT || !table.ownerTenantFields || table.ownerTenantFields?.length === 0 || table.ownerTenantFields?.includes(
|
|
47836
47959
|
destinationDashboardConfig?.tenantKeys?.[0] ?? ""
|
|
@@ -47840,8 +47963,8 @@ var useReportBuilderInternal = ({
|
|
|
47840
47963
|
schemaData.schemaWithCustomFields,
|
|
47841
47964
|
destinationDashboardConfig?.tenantKeys
|
|
47842
47965
|
]);
|
|
47843
|
-
const { tenants } = (0,
|
|
47844
|
-
const [client] = (0,
|
|
47966
|
+
const { tenants } = (0, import_react48.useContext)(TenantContext);
|
|
47967
|
+
const [client] = (0, import_react48.useContext)(ClientContext);
|
|
47845
47968
|
const _rowsPerRequest = rowsPerRequest ?? 100;
|
|
47846
47969
|
const _rowsPerPage = Math.min(rowsPerPage ?? 20, _rowsPerRequest);
|
|
47847
47970
|
const REPORT_BUILDER_PAGINATION = {
|
|
@@ -47849,19 +47972,19 @@ var useReportBuilderInternal = ({
|
|
|
47849
47972
|
rowsPerPage: _rowsPerPage,
|
|
47850
47973
|
rowsPerRequest: _rowsPerRequest
|
|
47851
47974
|
};
|
|
47852
|
-
const [openPopover, setOpenPopover] = (0,
|
|
47853
|
-
const [aiPrompt, setAiPrompt] = (0,
|
|
47854
|
-
const [reportBuilderLoading, setReportBuilderLoading] = (0,
|
|
47855
|
-
const [tableLoading, setTableLoading] = (0,
|
|
47856
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
47857
|
-
const [unresolvedReportMessage, setUnresolvedReportMessage] = (0,
|
|
47858
|
-
const [tables, setTables] = (0,
|
|
47859
|
-
const [columns, setColumns] = (0,
|
|
47860
|
-
const [filterStack, setFilterStack] = (0,
|
|
47861
|
-
const [pivot, setPivot] = (0,
|
|
47862
|
-
const [sort, setSort] = (0,
|
|
47863
|
-
const [limit, setLimit] = (0,
|
|
47864
|
-
const reportBuilderState = (0,
|
|
47975
|
+
const [openPopover, setOpenPopover] = (0, import_react48.useState)(null);
|
|
47976
|
+
const [aiPrompt, setAiPrompt] = (0, import_react48.useState)("");
|
|
47977
|
+
const [reportBuilderLoading, setReportBuilderLoading] = (0, import_react48.useState)(false);
|
|
47978
|
+
const [tableLoading, setTableLoading] = (0, import_react48.useState)(false);
|
|
47979
|
+
const [errorMessage, setErrorMessage] = (0, import_react48.useState)("");
|
|
47980
|
+
const [unresolvedReportMessage, setUnresolvedReportMessage] = (0, import_react48.useState)("");
|
|
47981
|
+
const [tables, setTables] = (0, import_react48.useState)([]);
|
|
47982
|
+
const [columns, setColumns] = (0, import_react48.useState)([]);
|
|
47983
|
+
const [filterStack, setFilterStack] = (0, import_react48.useState)([]);
|
|
47984
|
+
const [pivot, setPivot] = (0, import_react48.useState)(null);
|
|
47985
|
+
const [sort, setSort] = (0, import_react48.useState)([]);
|
|
47986
|
+
const [limit, setLimit] = (0, import_react48.useState)(null);
|
|
47987
|
+
const reportBuilderState = (0, import_react48.useMemo)(() => {
|
|
47865
47988
|
return {
|
|
47866
47989
|
tables,
|
|
47867
47990
|
columns,
|
|
@@ -47871,29 +47994,29 @@ var useReportBuilderInternal = ({
|
|
|
47871
47994
|
limit
|
|
47872
47995
|
};
|
|
47873
47996
|
}, [columns, filterStack, limit, pivot, sort, tables]);
|
|
47874
|
-
const [stateStack, setStateStack] = (0,
|
|
47875
|
-
const [poppedStateStack, setPoppedStateStack] = (0,
|
|
47876
|
-
const [unfilteredUniqueValues, setUnfilteredUniqueValues] = (0,
|
|
47877
|
-
const [unfilteredUniqueValuesIsLoading, setUnfilteredUniqueValuesIsLoading] = (0,
|
|
47878
|
-
const [filteredUniqueValues, setFilteredUniqueValues] = (0,
|
|
47879
|
-
const [filteredUniqueValuesIsLoading, setFilteredUniqueValuesIsLoading] = (0,
|
|
47880
|
-
const [columnUniqueValues, setColumnUniqueValues] = (0,
|
|
47881
|
-
const [dateRanges, setDateRanges] = (0,
|
|
47882
|
-
const [tempReport, setTempReport] = (0,
|
|
47997
|
+
const [stateStack, setStateStack] = (0, import_react48.useState)([]);
|
|
47998
|
+
const [poppedStateStack, setPoppedStateStack] = (0, import_react48.useState)([]);
|
|
47999
|
+
const [unfilteredUniqueValues, setUnfilteredUniqueValues] = (0, import_react48.useState)({});
|
|
48000
|
+
const [unfilteredUniqueValuesIsLoading, setUnfilteredUniqueValuesIsLoading] = (0, import_react48.useState)(false);
|
|
48001
|
+
const [filteredUniqueValues, setFilteredUniqueValues] = (0, import_react48.useState)(null);
|
|
48002
|
+
const [filteredUniqueValuesIsLoading, setFilteredUniqueValuesIsLoading] = (0, import_react48.useState)(false);
|
|
48003
|
+
const [columnUniqueValues, setColumnUniqueValues] = (0, import_react48.useState)({});
|
|
48004
|
+
const [dateRanges, setDateRanges] = (0, import_react48.useState)(null);
|
|
48005
|
+
const [tempReport, setTempReport] = (0, import_react48.useState)({
|
|
47883
48006
|
...EMPTY_INTERNAL_REPORT,
|
|
47884
48007
|
pagination: REPORT_BUILDER_PAGINATION
|
|
47885
48008
|
});
|
|
47886
|
-
const [currentProcessing, setCurrentProcessing] = (0,
|
|
48009
|
+
const [currentProcessing, setCurrentProcessing] = (0, import_react48.useState)({
|
|
47887
48010
|
page: REPORT_BUILDER_PAGINATION
|
|
47888
48011
|
});
|
|
47889
|
-
const [previousPage, setPreviousPage] = (0,
|
|
47890
|
-
const [reportColumns, setReportColumns] = (0,
|
|
47891
|
-
const [reportRows, setReportRows] = (0,
|
|
47892
|
-
const [formattedRows, setFormattedRows] = (0,
|
|
47893
|
-
const [pivotData, setPivotData] = (0,
|
|
47894
|
-
const [numberOfRows, setNumberOfRows] = (0,
|
|
47895
|
-
const [rowCountIsLoading, setRowCountIsLoading] = (0,
|
|
47896
|
-
const reportColumnsToStateColumns = (0,
|
|
48012
|
+
const [previousPage, setPreviousPage] = (0, import_react48.useState)(0);
|
|
48013
|
+
const [reportColumns, setReportColumns] = (0, import_react48.useState)([]);
|
|
48014
|
+
const [reportRows, setReportRows] = (0, import_react48.useState)([]);
|
|
48015
|
+
const [formattedRows, setFormattedRows] = (0, import_react48.useState)([]);
|
|
48016
|
+
const [pivotData, setPivotData] = (0, import_react48.useState)(null);
|
|
48017
|
+
const [numberOfRows, setNumberOfRows] = (0, import_react48.useState)(0);
|
|
48018
|
+
const [rowCountIsLoading, setRowCountIsLoading] = (0, import_react48.useState)(false);
|
|
48019
|
+
const reportColumnsToStateColumns = (0, import_react48.useMemo)(() => {
|
|
47897
48020
|
const positionMap = {};
|
|
47898
48021
|
columns.forEach((column, index) => {
|
|
47899
48022
|
positionMap[column.field] = index;
|
|
@@ -47911,28 +48034,28 @@ var useReportBuilderInternal = ({
|
|
|
47911
48034
|
}
|
|
47912
48035
|
});
|
|
47913
48036
|
}, [columns, reportColumns]);
|
|
47914
|
-
const [pivotRowField, setPivotRowField] = (0,
|
|
48037
|
+
const [pivotRowField, setPivotRowField] = (0, import_react48.useState)(
|
|
47915
48038
|
void 0
|
|
47916
48039
|
);
|
|
47917
|
-
const [pivotColumnField, setPivotColumnField] = (0,
|
|
48040
|
+
const [pivotColumnField, setPivotColumnField] = (0, import_react48.useState)(
|
|
47918
48041
|
void 0
|
|
47919
48042
|
);
|
|
47920
|
-
const [pivotAggregations, setPivotAggregations] = (0,
|
|
47921
|
-
const [pivotLimit, setPivotLimit] = (0,
|
|
47922
|
-
const [pivotSort, setPivotSort] = (0,
|
|
47923
|
-
const [pivotHint, setPivotHint] = (0,
|
|
47924
|
-
const [pivotError, setPivotError] = (0,
|
|
47925
|
-
const [createdPivots, setCreatedPivots] = (0,
|
|
47926
|
-
const [recommendedPivots, setRecommendedPivots] = (0,
|
|
47927
|
-
const [pivotPopUpTitle, setPivotPopUpTitle] = (0,
|
|
47928
|
-
const [showPivotPopover, setShowPivotPopover] = (0,
|
|
47929
|
-
const [isEditingPivot, setIsEditingPivot] = (0,
|
|
47930
|
-
const [selectedPivotIndex, setSelectedPivotIndex] = (0,
|
|
48043
|
+
const [pivotAggregations, setPivotAggregations] = (0, import_react48.useState)([]);
|
|
48044
|
+
const [pivotLimit, setPivotLimit] = (0, import_react48.useState)(void 0);
|
|
48045
|
+
const [pivotSort, setPivotSort] = (0, import_react48.useState)(void 0);
|
|
48046
|
+
const [pivotHint, setPivotHint] = (0, import_react48.useState)("");
|
|
48047
|
+
const [pivotError, setPivotError] = (0, import_react48.useState)("");
|
|
48048
|
+
const [createdPivots, setCreatedPivots] = (0, import_react48.useState)([]);
|
|
48049
|
+
const [recommendedPivots, setRecommendedPivots] = (0, import_react48.useState)([]);
|
|
48050
|
+
const [pivotPopUpTitle, setPivotPopUpTitle] = (0, import_react48.useState)("Add pivot");
|
|
48051
|
+
const [showPivotPopover, setShowPivotPopover] = (0, import_react48.useState)(false);
|
|
48052
|
+
const [isEditingPivot, setIsEditingPivot] = (0, import_react48.useState)(false);
|
|
48053
|
+
const [selectedPivotIndex, setSelectedPivotIndex] = (0, import_react48.useState)(-1);
|
|
47931
48054
|
const [
|
|
47932
48055
|
pivotRecommendationsEnabledState,
|
|
47933
48056
|
setPivotRecommendationsEnabledState
|
|
47934
|
-
] = (0,
|
|
47935
|
-
const [askAILoading, setAskAILoading] = (0,
|
|
48057
|
+
] = (0, import_react48.useState)(pivotRecommendationsEnabled);
|
|
48058
|
+
const [askAILoading, setAskAILoading] = (0, import_react48.useState)(false);
|
|
47936
48059
|
const loading = reportBuilderLoading || tableLoading;
|
|
47937
48060
|
useLongLoading(reportBuilderLoading, {
|
|
47938
48061
|
origin: "ReportBuilder",
|
|
@@ -47946,7 +48069,7 @@ var useReportBuilderInternal = ({
|
|
|
47946
48069
|
origin: "ReportBuilder",
|
|
47947
48070
|
loadDescription: "Loading ask AI"
|
|
47948
48071
|
});
|
|
47949
|
-
const isSelectStar = (0,
|
|
48072
|
+
const isSelectStar = (0, import_react48.useMemo)(() => {
|
|
47950
48073
|
if (tables.length === 1) {
|
|
47951
48074
|
const totalColumnLength = tables.reduce((acc, table) => {
|
|
47952
48075
|
const tableColumns = filteredSchema.find((t) => t.name === table.name)?.columns.length ?? 0;
|
|
@@ -47957,14 +48080,14 @@ var useReportBuilderInternal = ({
|
|
|
47957
48080
|
return false;
|
|
47958
48081
|
}
|
|
47959
48082
|
}, [tables, columns, filteredSchema]);
|
|
47960
|
-
const mssqlSortWarning = (0,
|
|
48083
|
+
const mssqlSortWarning = (0, import_react48.useMemo)(() => {
|
|
47961
48084
|
if (!client || client?.databaseType !== "mssql") {
|
|
47962
48085
|
return void 0;
|
|
47963
48086
|
} else if (!pivot && !limit) {
|
|
47964
48087
|
return "Please add a limit.";
|
|
47965
48088
|
}
|
|
47966
48089
|
}, [client, limit, pivot]);
|
|
47967
|
-
const foreignKeyMap = (0,
|
|
48090
|
+
const foreignKeyMap = (0, import_react48.useMemo)(() => {
|
|
47968
48091
|
return getSchemaForeignKeyMapping(filteredSchema);
|
|
47969
48092
|
}, [filteredSchema]);
|
|
47970
48093
|
const clearAllState = (resetStateStack = true) => {
|
|
@@ -49016,7 +49139,7 @@ var useReportBuilderInternal = ({
|
|
|
49016
49139
|
flags: tempReport?.flags
|
|
49017
49140
|
});
|
|
49018
49141
|
};
|
|
49019
|
-
(0,
|
|
49142
|
+
(0, import_react48.useEffect)(() => {
|
|
49020
49143
|
if (!client) {
|
|
49021
49144
|
return;
|
|
49022
49145
|
}
|
|
@@ -49029,7 +49152,7 @@ var useReportBuilderInternal = ({
|
|
|
49029
49152
|
clearAllState();
|
|
49030
49153
|
}
|
|
49031
49154
|
}, [client]);
|
|
49032
|
-
(0,
|
|
49155
|
+
(0, import_react48.useEffect)(() => {
|
|
49033
49156
|
const loadChart = async () => {
|
|
49034
49157
|
let report;
|
|
49035
49158
|
if (!client) {
|
|
@@ -49086,7 +49209,7 @@ var useReportBuilderInternal = ({
|
|
|
49086
49209
|
loadChart();
|
|
49087
49210
|
}
|
|
49088
49211
|
}, [allReportsById[reportId || ""], client]);
|
|
49089
|
-
(0,
|
|
49212
|
+
(0, import_react48.useEffect)(() => {
|
|
49090
49213
|
if (initialTableName) {
|
|
49091
49214
|
const tableColumns = filteredSchema.find((table) => {
|
|
49092
49215
|
return table.name === initialTableName;
|
|
@@ -49106,7 +49229,7 @@ var useReportBuilderInternal = ({
|
|
|
49106
49229
|
}
|
|
49107
49230
|
}
|
|
49108
49231
|
}, [filteredSchema, initialTableName]);
|
|
49109
|
-
(0,
|
|
49232
|
+
(0, import_react48.useEffect)(() => {
|
|
49110
49233
|
if (!data && !dashboardIsLoading) {
|
|
49111
49234
|
reload();
|
|
49112
49235
|
}
|
|
@@ -49268,7 +49391,7 @@ var useReportBuilder = ({
|
|
|
49268
49391
|
reportBuilder.setAiPrompt(prompt);
|
|
49269
49392
|
await reportBuilder.fetchAstFromPromptHelper(prompt);
|
|
49270
49393
|
};
|
|
49271
|
-
const cleanedSchema = (0,
|
|
49394
|
+
const cleanedSchema = (0, import_react48.useMemo)(() => {
|
|
49272
49395
|
return reportBuilder.filteredSchema.reduce(
|
|
49273
49396
|
(acc, table) => {
|
|
49274
49397
|
acc[table.name] = table.columns;
|
|
@@ -49277,7 +49400,7 @@ var useReportBuilder = ({
|
|
|
49277
49400
|
{}
|
|
49278
49401
|
);
|
|
49279
49402
|
}, [reportBuilder.filteredSchema]);
|
|
49280
|
-
const cleanedFilterStack = (0,
|
|
49403
|
+
const cleanedFilterStack = (0, import_react48.useMemo)(() => {
|
|
49281
49404
|
return reportBuilder.filterStack.map((filter) => {
|
|
49282
49405
|
return filter.value ? convertInternalFilterToFilter(filter.value) : null;
|
|
49283
49406
|
}).filter((filter) => filter !== null);
|
|
@@ -49314,7 +49437,7 @@ var useReportBuilder = ({
|
|
|
49314
49437
|
init_ReportBuilder();
|
|
49315
49438
|
|
|
49316
49439
|
// src/components/ReportBuilder/AddColumnModal.tsx
|
|
49317
|
-
var
|
|
49440
|
+
var import_react49 = require("react");
|
|
49318
49441
|
var import_core2 = require("@dnd-kit/core");
|
|
49319
49442
|
var import_sortable2 = require("@dnd-kit/sortable");
|
|
49320
49443
|
var import_utilities2 = require("@dnd-kit/utilities");
|
|
@@ -49336,17 +49459,17 @@ function AddColumnModal({
|
|
|
49336
49459
|
LoadingComponent = QuillLoadingComponent,
|
|
49337
49460
|
onRequestAddVirtualTable
|
|
49338
49461
|
}) {
|
|
49339
|
-
const [primaryTable, setPrimaryTable] = (0,
|
|
49462
|
+
const [primaryTable, setPrimaryTable] = (0, import_react49.useState)(
|
|
49340
49463
|
selectedTables[0]?.name
|
|
49341
49464
|
);
|
|
49342
|
-
const [theme] = (0,
|
|
49343
|
-
const [search, setSearch] = (0,
|
|
49344
|
-
const [initialLoad, setInitialLoad] = (0,
|
|
49345
|
-
const textInputContainerRef = (0,
|
|
49346
|
-
const [modalSelectedColumns, setModalSelectedColumns] = (0,
|
|
49465
|
+
const [theme] = (0, import_react49.useContext)(ThemeContext);
|
|
49466
|
+
const [search, setSearch] = (0, import_react49.useState)("");
|
|
49467
|
+
const [initialLoad, setInitialLoad] = (0, import_react49.useState)(true);
|
|
49468
|
+
const textInputContainerRef = (0, import_react49.useRef)(null);
|
|
49469
|
+
const [modalSelectedColumns, setModalSelectedColumns] = (0, import_react49.useState)(
|
|
49347
49470
|
selectedColumns.map((col) => `${col.table}.${col.field}`)
|
|
49348
49471
|
);
|
|
49349
|
-
const columnOptions = (0,
|
|
49472
|
+
const columnOptions = (0, import_react49.useMemo)(() => {
|
|
49350
49473
|
return schema.filter((table) => {
|
|
49351
49474
|
if (!primaryTable) return true;
|
|
49352
49475
|
return table.name === primaryTable || foreignKeyMap[primaryTable]?.some(
|
|
@@ -49370,20 +49493,20 @@ function AddColumnModal({
|
|
|
49370
49493
|
})
|
|
49371
49494
|
);
|
|
49372
49495
|
}, [schema, primaryTable]);
|
|
49373
|
-
const [orderedColumnNames, setOrderedColumnNames] = (0,
|
|
49496
|
+
const [orderedColumnNames, setOrderedColumnNames] = (0, import_react49.useState)([]);
|
|
49374
49497
|
const isSelectedAllColumns = columnOptions.length === modalSelectedColumns.length;
|
|
49375
|
-
const searchResults = (0,
|
|
49498
|
+
const searchResults = (0, import_react49.useMemo)(() => {
|
|
49376
49499
|
return orderedColumnNames.filter((column) => {
|
|
49377
49500
|
return columnOptions.includes(column) && (search.length === 0 || column.toLowerCase().includes(search.toLowerCase()) || snakeAndCamelCaseToTitleCase(column).toLowerCase().includes(search.toLowerCase()));
|
|
49378
49501
|
});
|
|
49379
49502
|
}, [search, columnOptions, orderedColumnNames]);
|
|
49380
|
-
(0,
|
|
49503
|
+
(0, import_react49.useEffect)(() => {
|
|
49381
49504
|
const remainingColumns = columnOptions.filter(
|
|
49382
49505
|
(col) => !modalSelectedColumns.includes(col)
|
|
49383
49506
|
);
|
|
49384
49507
|
setOrderedColumnNames([...modalSelectedColumns, ...remainingColumns]);
|
|
49385
49508
|
}, [columnOptions]);
|
|
49386
|
-
(0,
|
|
49509
|
+
(0, import_react49.useEffect)(() => {
|
|
49387
49510
|
if (!schemaLoading && initialLoad) {
|
|
49388
49511
|
setTimeout(() => setInitialLoad(false), 200);
|
|
49389
49512
|
}
|
|
@@ -49735,7 +49858,7 @@ function DraggableItem({
|
|
|
49735
49858
|
|
|
49736
49859
|
// src/components/ReportBuilder/DraggableColumns.tsx
|
|
49737
49860
|
var import_sortable4 = require("@dnd-kit/sortable");
|
|
49738
|
-
var
|
|
49861
|
+
var import_react50 = require("react");
|
|
49739
49862
|
init_textProcessing();
|
|
49740
49863
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
49741
49864
|
function DraggableColumns({
|
|
@@ -49750,7 +49873,7 @@ function DraggableColumns({
|
|
|
49750
49873
|
coordinateGetter: import_sortable4.sortableKeyboardCoordinates
|
|
49751
49874
|
})
|
|
49752
49875
|
);
|
|
49753
|
-
const columnNames = (0,
|
|
49876
|
+
const columnNames = (0, import_react50.useMemo)(() => {
|
|
49754
49877
|
return columns.map(
|
|
49755
49878
|
(col) => `${col.table}.${col.alias ?? col.field}`
|
|
49756
49879
|
);
|
|
@@ -50254,7 +50377,7 @@ var AddFilters = ({
|
|
|
50254
50377
|
};
|
|
50255
50378
|
|
|
50256
50379
|
// src/internals/ReportBuilder/PivotForm.tsx
|
|
50257
|
-
var
|
|
50380
|
+
var import_react51 = require("react");
|
|
50258
50381
|
init_textProcessing();
|
|
50259
50382
|
init_pivotProcessing();
|
|
50260
50383
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
@@ -50283,22 +50406,22 @@ function PivotForm({
|
|
|
50283
50406
|
isLoading,
|
|
50284
50407
|
pivotHint
|
|
50285
50408
|
}) {
|
|
50286
|
-
const [allowedColumnFields, setAllowedColumnFields] = (0,
|
|
50287
|
-
const [allowedRowFields, setAllowedRowFields] = (0,
|
|
50288
|
-
const [allowedValueFields, setAllowedValueFields] = (0,
|
|
50289
|
-
const [theme] = (0,
|
|
50290
|
-
const [limitInput, setLimitInput] = (0,
|
|
50409
|
+
const [allowedColumnFields, setAllowedColumnFields] = (0, import_react51.useState)([]);
|
|
50410
|
+
const [allowedRowFields, setAllowedRowFields] = (0, import_react51.useState)([]);
|
|
50411
|
+
const [allowedValueFields, setAllowedValueFields] = (0, import_react51.useState)([]);
|
|
50412
|
+
const [theme] = (0, import_react51.useContext)(ThemeContext);
|
|
50413
|
+
const [limitInput, setLimitInput] = (0, import_react51.useState)(
|
|
50291
50414
|
pivotLimit?.toString() ?? ""
|
|
50292
50415
|
);
|
|
50293
|
-
const [sortFieldInput, setSortFieldInput] = (0,
|
|
50416
|
+
const [sortFieldInput, setSortFieldInput] = (0, import_react51.useState)(
|
|
50294
50417
|
pivotSort?.sortField ?? ""
|
|
50295
50418
|
);
|
|
50296
|
-
const [sortDirectionInput, setSortDirectionInput] = (0,
|
|
50419
|
+
const [sortDirectionInput, setSortDirectionInput] = (0, import_react51.useState)(
|
|
50297
50420
|
pivotSort?.sortDirection ?? ""
|
|
50298
50421
|
);
|
|
50299
|
-
const [showLimitInput, setShowLimitInput] = (0,
|
|
50300
|
-
const [showSortInput, setShowSortInput] = (0,
|
|
50301
|
-
(0,
|
|
50422
|
+
const [showLimitInput, setShowLimitInput] = (0, import_react51.useState)(!!pivotLimit);
|
|
50423
|
+
const [showSortInput, setShowSortInput] = (0, import_react51.useState)(!!pivotSort);
|
|
50424
|
+
(0, import_react51.useEffect)(() => {
|
|
50302
50425
|
if (uniqueValues) {
|
|
50303
50426
|
const possibleColumns = getPossiblePivotFieldOptions(
|
|
50304
50427
|
columns,
|
|
@@ -50309,12 +50432,12 @@ function PivotForm({
|
|
|
50309
50432
|
setAllowedValueFields(possibleColumns.valueFields);
|
|
50310
50433
|
}
|
|
50311
50434
|
}, [columns, uniqueValues]);
|
|
50312
|
-
(0,
|
|
50435
|
+
(0, import_react51.useEffect)(() => {
|
|
50313
50436
|
setSortFieldInput(pivotSort?.sortField ?? "");
|
|
50314
50437
|
setSortDirectionInput(pivotSort?.sortDirection ?? "");
|
|
50315
50438
|
setShowSortInput(!!pivotSort);
|
|
50316
50439
|
}, [pivotSort]);
|
|
50317
|
-
(0,
|
|
50440
|
+
(0, import_react51.useEffect)(() => {
|
|
50318
50441
|
setLimitInput(pivotLimit?.toString() ?? "");
|
|
50319
50442
|
setShowLimitInput(!!pivotLimit);
|
|
50320
50443
|
}, [pivotLimit]);
|
|
@@ -50926,7 +51049,7 @@ var AddPivot = ({
|
|
|
50926
51049
|
};
|
|
50927
51050
|
|
|
50928
51051
|
// src/components/ReportBuilder/AddLimitPopover.tsx
|
|
50929
|
-
var
|
|
51052
|
+
var import_react52 = require("react");
|
|
50930
51053
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
50931
51054
|
var LimitSentence = ({
|
|
50932
51055
|
limit,
|
|
@@ -50941,7 +51064,7 @@ var LimitSentence = ({
|
|
|
50941
51064
|
SecondaryButton = MemoizedSecondaryButton,
|
|
50942
51065
|
disabled = false
|
|
50943
51066
|
}) => {
|
|
50944
|
-
const [isOpen, setIsOpen] = (0,
|
|
51067
|
+
const [isOpen, setIsOpen] = (0, import_react52.useState)(false);
|
|
50945
51068
|
const handleClickDelete = () => {
|
|
50946
51069
|
setOpenPopover(null);
|
|
50947
51070
|
handleDelete();
|
|
@@ -50983,7 +51106,7 @@ var AddLimitPopover = ({
|
|
|
50983
51106
|
Button = MemoizedButton,
|
|
50984
51107
|
SecondaryButton = MemoizedSecondaryButton
|
|
50985
51108
|
}) => {
|
|
50986
|
-
const [limit, setLimit] = (0,
|
|
51109
|
+
const [limit, setLimit] = (0, import_react52.useState)(initialLimit.toString());
|
|
50987
51110
|
const MAX_LIMIT = 2147483647;
|
|
50988
51111
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
50989
51112
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
@@ -51224,7 +51347,7 @@ var AddLimit = ({
|
|
|
51224
51347
|
};
|
|
51225
51348
|
|
|
51226
51349
|
// src/components/ReportBuilder/AddSortPopover.tsx
|
|
51227
|
-
var
|
|
51350
|
+
var import_react53 = require("react");
|
|
51228
51351
|
init_textProcessing();
|
|
51229
51352
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
51230
51353
|
var SORT_VALUE_TO_LABEL = {
|
|
@@ -51248,7 +51371,7 @@ var SortSentence = ({
|
|
|
51248
51371
|
SecondaryButton = MemoizedSecondaryButton,
|
|
51249
51372
|
disabled = false
|
|
51250
51373
|
}) => {
|
|
51251
|
-
const [isOpen, setIsOpen] = (0,
|
|
51374
|
+
const [isOpen, setIsOpen] = (0, import_react53.useState)(false);
|
|
51252
51375
|
const handleSetIsOpen = (isOpen2) => {
|
|
51253
51376
|
setIsOpen(isOpen2);
|
|
51254
51377
|
};
|
|
@@ -51300,8 +51423,8 @@ var AddSortPopover = ({
|
|
|
51300
51423
|
Button = MemoizedButton,
|
|
51301
51424
|
SecondaryButton = MemoizedSecondaryButton
|
|
51302
51425
|
}) => {
|
|
51303
|
-
const [sortColumn, setSortColumn] = (0,
|
|
51304
|
-
const [sortDirection, setSortDirection] = (0,
|
|
51426
|
+
const [sortColumn, setSortColumn] = (0, import_react53.useState)(column || "");
|
|
51427
|
+
const [sortDirection, setSortDirection] = (0, import_react53.useState)(
|
|
51305
51428
|
direction || "ASC"
|
|
51306
51429
|
);
|
|
51307
51430
|
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
@@ -51779,15 +51902,14 @@ function ReportBuilder({
|
|
|
51779
51902
|
onRequestAddVirtualTable,
|
|
51780
51903
|
submitButtonLabel
|
|
51781
51904
|
}) {
|
|
51782
|
-
const [theme] = (0,
|
|
51783
|
-
const [client] = (0,
|
|
51784
|
-
const { getToken } = (0,
|
|
51785
|
-
const parentRef = (0,
|
|
51786
|
-
const
|
|
51787
|
-
const [
|
|
51788
|
-
const [
|
|
51789
|
-
const [
|
|
51790
|
-
const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = (0, import_react53.useState)(false);
|
|
51905
|
+
const [theme] = (0, import_react54.useContext)(ThemeContext);
|
|
51906
|
+
const [client] = (0, import_react54.useContext)(ClientContext);
|
|
51907
|
+
const { getToken } = (0, import_react54.useContext)(FetchContext);
|
|
51908
|
+
const parentRef = (0, import_react54.useRef)(null);
|
|
51909
|
+
const askAIFormRef = (0, import_react54.useRef)(null);
|
|
51910
|
+
const [isCopying, setIsCopying] = (0, import_react54.useState)(false);
|
|
51911
|
+
const [isChartBuilderOpen, setIsChartBuilderOpen] = (0, import_react54.useState)(false);
|
|
51912
|
+
const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = (0, import_react54.useState)(false);
|
|
51791
51913
|
const reportBuilder = useReportBuilderInternal({
|
|
51792
51914
|
reportId,
|
|
51793
51915
|
initialTableName,
|
|
@@ -51827,6 +51949,12 @@ function ReportBuilder({
|
|
|
51827
51949
|
onSaveQuery,
|
|
51828
51950
|
onSaveReport
|
|
51829
51951
|
} = reportBuilder;
|
|
51952
|
+
const askAIInputWidth = useResponsiveFirstChildWidth_default(askAIFormRef, {
|
|
51953
|
+
gap: 12,
|
|
51954
|
+
initialWidth: 320,
|
|
51955
|
+
minWidth: 160
|
|
51956
|
+
});
|
|
51957
|
+
const normalizedAskAIInputWidth = askAIInputWidth > 0 ? askAIInputWidth : 160;
|
|
51830
51958
|
const copySQLToClipboard = async () => {
|
|
51831
51959
|
let query = "";
|
|
51832
51960
|
if (pivot && pivotData) {
|
|
@@ -51849,17 +51977,7 @@ function ReportBuilder({
|
|
|
51849
51977
|
setTimeout(() => setIsCopying(false), 800);
|
|
51850
51978
|
}
|
|
51851
51979
|
};
|
|
51852
|
-
(0,
|
|
51853
|
-
function handleResize() {
|
|
51854
|
-
updateFirstChildWidth(askAIContainerRef, setAskAIInputWidth, { gap: 12 });
|
|
51855
|
-
}
|
|
51856
|
-
handleResize();
|
|
51857
|
-
window.addEventListener("resize", handleResize);
|
|
51858
|
-
return () => {
|
|
51859
|
-
window.removeEventListener("resize", handleResize);
|
|
51860
|
-
};
|
|
51861
|
-
}, []);
|
|
51862
|
-
(0, import_react53.useEffect)(() => {
|
|
51980
|
+
(0, import_react54.useEffect)(() => {
|
|
51863
51981
|
if (isChartBuilderOpen === false) {
|
|
51864
51982
|
onCloseChartBuilder && onCloseChartBuilder();
|
|
51865
51983
|
}
|
|
@@ -51977,10 +52095,10 @@ function ReportBuilder({
|
|
|
51977
52095
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { style: { width: "100%", minHeight: "30vh" } })
|
|
51978
52096
|
] }),
|
|
51979
52097
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(ContainerComponent, { children: [
|
|
51980
|
-
isAIEnabled && /* @__PURE__ */ (0, import_jsx_runtime81.
|
|
52098
|
+
isAIEnabled && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
51981
52099
|
"form",
|
|
51982
52100
|
{
|
|
51983
|
-
ref:
|
|
52101
|
+
ref: askAIFormRef,
|
|
51984
52102
|
onSubmit: (event) => {
|
|
51985
52103
|
event.preventDefault();
|
|
51986
52104
|
},
|
|
@@ -51988,15 +52106,17 @@ function ReportBuilder({
|
|
|
51988
52106
|
display: "flex",
|
|
51989
52107
|
flexDirection: "row",
|
|
51990
52108
|
gap: 12,
|
|
51991
|
-
|
|
52109
|
+
flexWrap: "wrap",
|
|
52110
|
+
alignItems: "stretch",
|
|
52111
|
+
visibility: normalizedAskAIInputWidth > 0 ? "visible" : "hidden"
|
|
51992
52112
|
},
|
|
51993
|
-
children:
|
|
52113
|
+
children: [
|
|
51994
52114
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
51995
52115
|
TextInputComponent,
|
|
51996
52116
|
{
|
|
51997
52117
|
id: "ask_ai_input_bar",
|
|
51998
52118
|
value: aiPrompt,
|
|
51999
|
-
width:
|
|
52119
|
+
width: normalizedAskAIInputWidth,
|
|
52000
52120
|
onChange: (e) => setAiPrompt(e.target.value),
|
|
52001
52121
|
placeholder: "Ask a question..."
|
|
52002
52122
|
}
|
|
@@ -52034,7 +52154,7 @@ function ReportBuilder({
|
|
|
52034
52154
|
disabled: columns.length === 0 || loading
|
|
52035
52155
|
}
|
|
52036
52156
|
)
|
|
52037
|
-
]
|
|
52157
|
+
]
|
|
52038
52158
|
}
|
|
52039
52159
|
),
|
|
52040
52160
|
columns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
@@ -52289,7 +52409,7 @@ function ReportBuilder({
|
|
|
52289
52409
|
}
|
|
52290
52410
|
|
|
52291
52411
|
// src/ChartEditor.tsx
|
|
52292
|
-
var
|
|
52412
|
+
var import_react55 = require("react");
|
|
52293
52413
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
52294
52414
|
function ChartEditor({
|
|
52295
52415
|
isOpen,
|
|
@@ -52336,19 +52456,19 @@ function ChartEditor({
|
|
|
52336
52456
|
onClickChartElement,
|
|
52337
52457
|
onClickChartError
|
|
52338
52458
|
}) {
|
|
52339
|
-
const parentRef = (0,
|
|
52340
|
-
const [modalWidth, setModalWidth] = (0,
|
|
52341
|
-
const [modalHeight, setModalHeight] = (0,
|
|
52459
|
+
const parentRef = (0, import_react55.useRef)(null);
|
|
52460
|
+
const [modalWidth, setModalWidth] = (0, import_react55.useState)(200);
|
|
52461
|
+
const [modalHeight, setModalHeight] = (0, import_react55.useState)(200);
|
|
52342
52462
|
const { addReport } = useDashboardReports(destinationDashboard);
|
|
52343
52463
|
const { allReportsById } = useAllReports();
|
|
52344
|
-
const { tenants, flags } = (0,
|
|
52345
|
-
const { getToken } = (0,
|
|
52464
|
+
const { tenants, flags } = (0, import_react55.useContext)(TenantContext);
|
|
52465
|
+
const { getToken } = (0, import_react55.useContext)(FetchContext);
|
|
52346
52466
|
const report = allReportsById[reportId];
|
|
52347
|
-
const [client, isClientLoading] = (0,
|
|
52348
|
-
const [schemaData] = (0,
|
|
52349
|
-
const { dashboardFilters } = (0,
|
|
52350
|
-
const { eventTracking } = (0,
|
|
52351
|
-
const specificDashboardFilters = (0,
|
|
52467
|
+
const [client, isClientLoading] = (0, import_react55.useContext)(ClientContext);
|
|
52468
|
+
const [schemaData] = (0, import_react55.useContext)(SchemaDataContext);
|
|
52469
|
+
const { dashboardFilters } = (0, import_react55.useContext)(DashboardFiltersContext);
|
|
52470
|
+
const { eventTracking } = (0, import_react55.useContext)(EventTrackingContext);
|
|
52471
|
+
const specificDashboardFilters = (0, import_react55.useMemo)(() => {
|
|
52352
52472
|
if (!report) {
|
|
52353
52473
|
return [];
|
|
52354
52474
|
}
|
|
@@ -52356,15 +52476,15 @@ function ChartEditor({
|
|
|
52356
52476
|
(f) => f.filter
|
|
52357
52477
|
);
|
|
52358
52478
|
}, [dashboardFilters]);
|
|
52359
|
-
const [filtersEnabled, setFiltersEnabled] = (0,
|
|
52360
|
-
const [chartBuilderKey, setChartBuilderKey] = (0,
|
|
52479
|
+
const [filtersEnabled, setFiltersEnabled] = (0, import_react55.useState)(true);
|
|
52480
|
+
const [chartBuilderKey, setChartBuilderKey] = (0, import_react55.useState)(0);
|
|
52361
52481
|
const dateFilter = Object.values(specificDashboardFilters).find(
|
|
52362
52482
|
(filter) => filter.filterType === "date_range"
|
|
52363
52483
|
);
|
|
52364
|
-
const dateRange = (0,
|
|
52484
|
+
const dateRange = (0, import_react55.useMemo)(() => {
|
|
52365
52485
|
return dateFilter?.startDate ? { start: dateFilter.startDate, end: dateFilter.endDate } : void 0;
|
|
52366
52486
|
}, [dateFilter]);
|
|
52367
|
-
(0,
|
|
52487
|
+
(0, import_react55.useEffect)(() => {
|
|
52368
52488
|
function handleResize() {
|
|
52369
52489
|
const screenSize = window.innerWidth;
|
|
52370
52490
|
if (screenSize >= 1200) {
|
|
@@ -52412,7 +52532,7 @@ function ChartEditor({
|
|
|
52412
52532
|
}
|
|
52413
52533
|
addReport(report2);
|
|
52414
52534
|
};
|
|
52415
|
-
(0,
|
|
52535
|
+
(0, import_react55.useEffect)(() => {
|
|
52416
52536
|
if (!isClientLoading && !report) {
|
|
52417
52537
|
fetchReportHelper();
|
|
52418
52538
|
}
|
|
@@ -52560,7 +52680,7 @@ function StaticChart({
|
|
|
52560
52680
|
init_valueFormatter();
|
|
52561
52681
|
|
|
52562
52682
|
// src/hooks/useTenants.ts
|
|
52563
|
-
var
|
|
52683
|
+
var import_react56 = require("react");
|
|
52564
52684
|
var useTenants = (dashboardName) => {
|
|
52565
52685
|
const {
|
|
52566
52686
|
tenants,
|
|
@@ -52573,13 +52693,13 @@ var useTenants = (dashboardName) => {
|
|
|
52573
52693
|
fetchMappedTenantsForDashboard,
|
|
52574
52694
|
getMappedTenantsForDashboard,
|
|
52575
52695
|
getViewerTenantsByOwner
|
|
52576
|
-
} = (0,
|
|
52577
|
-
(0,
|
|
52696
|
+
} = (0, import_react56.useContext)(TenantContext);
|
|
52697
|
+
(0, import_react56.useEffect)(() => {
|
|
52578
52698
|
if (dashboardName) {
|
|
52579
52699
|
fetchViewerTenantsForDashboard(dashboardName);
|
|
52580
52700
|
}
|
|
52581
52701
|
}, [dashboardName, fetchViewerTenantsForDashboard]);
|
|
52582
|
-
(0,
|
|
52702
|
+
(0, import_react56.useEffect)(() => {
|
|
52583
52703
|
if (dashboardName) {
|
|
52584
52704
|
fetchMappedTenantsForDashboard(dashboardName);
|
|
52585
52705
|
}
|
|
@@ -52598,33 +52718,33 @@ var useTenants = (dashboardName) => {
|
|
|
52598
52718
|
};
|
|
52599
52719
|
|
|
52600
52720
|
// src/hooks/useQuill.ts
|
|
52601
|
-
var
|
|
52721
|
+
var import_react57 = require("react");
|
|
52602
52722
|
init_paginationProcessing();
|
|
52603
52723
|
init_tableProcessing();
|
|
52604
52724
|
init_dataProcessing();
|
|
52605
52725
|
var useQuill = (reportId, pagination) => {
|
|
52606
|
-
const { reports, reportsDispatch, fetchIndividualReport } = (0,
|
|
52726
|
+
const { reports, reportsDispatch, fetchIndividualReport } = (0, import_react57.useContext)(ReportsContext);
|
|
52607
52727
|
const { allReportsById } = useAllReports();
|
|
52608
|
-
const { getToken } = (0,
|
|
52609
|
-
const dashboardReport = (0,
|
|
52728
|
+
const { getToken } = (0, import_react57.useContext)(FetchContext);
|
|
52729
|
+
const dashboardReport = (0, import_react57.useMemo)(() => {
|
|
52610
52730
|
return allReportsById[reportId ?? ""];
|
|
52611
52731
|
}, [allReportsById[reportId ?? ""]]);
|
|
52612
|
-
const { dashboardFilters, dashboardCustomFilters } = (0,
|
|
52732
|
+
const { dashboardFilters, dashboardCustomFilters } = (0, import_react57.useContext)(
|
|
52613
52733
|
DashboardFiltersContext
|
|
52614
52734
|
);
|
|
52615
|
-
const { reportFilters, customReportFilters, reportFiltersDispatch } = (0,
|
|
52616
|
-
const specificReportFilters = (0,
|
|
52735
|
+
const { reportFilters, customReportFilters, reportFiltersDispatch } = (0, import_react57.useContext)(ReportFiltersContext);
|
|
52736
|
+
const specificReportFilters = (0, import_react57.useMemo)(() => {
|
|
52617
52737
|
if (!reportId) return null;
|
|
52618
52738
|
return Object.values(reportFilters[reportId] ?? []).map((f) => f.filter);
|
|
52619
52739
|
}, [reportFilters, reportId]);
|
|
52620
|
-
const [schemaData] = (0,
|
|
52621
|
-
const [client, isClientLoading] = (0,
|
|
52622
|
-
const { tenants } = (0,
|
|
52623
|
-
const { eventTracking } = (0,
|
|
52624
|
-
const [loading, setLoading] = (0,
|
|
52625
|
-
const [error, setError] = (0,
|
|
52626
|
-
const [previousPage, setPreviousPage] = (0,
|
|
52627
|
-
const processedReport = (0,
|
|
52740
|
+
const [schemaData] = (0, import_react57.useContext)(SchemaDataContext);
|
|
52741
|
+
const [client, isClientLoading] = (0, import_react57.useContext)(ClientContext);
|
|
52742
|
+
const { tenants } = (0, import_react57.useContext)(TenantContext);
|
|
52743
|
+
const { eventTracking } = (0, import_react57.useContext)(EventTrackingContext);
|
|
52744
|
+
const [loading, setLoading] = (0, import_react57.useState)(true);
|
|
52745
|
+
const [error, setError] = (0, import_react57.useState)(void 0);
|
|
52746
|
+
const [previousPage, setPreviousPage] = (0, import_react57.useState)(0);
|
|
52747
|
+
const processedReport = (0, import_react57.useMemo)(() => {
|
|
52628
52748
|
return reportId && allReportsById[reportId] ? convertInternalReportToReport(
|
|
52629
52749
|
mergeComparisonRange(allReportsById[reportId]),
|
|
52630
52750
|
specificReportFilters ?? [],
|
|
@@ -52632,7 +52752,7 @@ var useQuill = (reportId, pagination) => {
|
|
|
52632
52752
|
"useQuill"
|
|
52633
52753
|
) : void 0;
|
|
52634
52754
|
}, [reportId, reportId && allReportsById[reportId], specificReportFilters]);
|
|
52635
|
-
const [additionalProcessing, setAdditionProcessing] = (0,
|
|
52755
|
+
const [additionalProcessing, setAdditionProcessing] = (0, import_react57.useState)(
|
|
52636
52756
|
pagination ? {
|
|
52637
52757
|
page: pagination
|
|
52638
52758
|
} : void 0
|
|
@@ -52781,7 +52901,7 @@ var useQuill = (reportId, pagination) => {
|
|
|
52781
52901
|
setLoading(false);
|
|
52782
52902
|
}
|
|
52783
52903
|
};
|
|
52784
|
-
(0,
|
|
52904
|
+
(0, import_react57.useEffect)(() => {
|
|
52785
52905
|
if (isClientLoading) return;
|
|
52786
52906
|
if (reportId && specificReportFilters) {
|
|
52787
52907
|
fetchReportHelper(reportId, {
|
|
@@ -52821,10 +52941,10 @@ var useQuill = (reportId, pagination) => {
|
|
|
52821
52941
|
|
|
52822
52942
|
// src/hooks/useFormat.ts
|
|
52823
52943
|
init_valueFormatter();
|
|
52824
|
-
var
|
|
52944
|
+
var import_react58 = require("react");
|
|
52825
52945
|
var useMemoizedRows = (reportId) => {
|
|
52826
52946
|
const { data } = useQuill(reportId);
|
|
52827
|
-
const formattedRows = (0,
|
|
52947
|
+
const formattedRows = (0, import_react58.useMemo)(() => {
|
|
52828
52948
|
if (!data || !data.rows || !data.columns)
|
|
52829
52949
|
return { rows: [], loading: true };
|
|
52830
52950
|
return {
|
|
@@ -52848,7 +52968,7 @@ var useMemoizedRows = (reportId) => {
|
|
|
52848
52968
|
};
|
|
52849
52969
|
|
|
52850
52970
|
// src/hooks/useAskQuill.tsx
|
|
52851
|
-
var
|
|
52971
|
+
var import_react59 = require("react");
|
|
52852
52972
|
init_astProcessing();
|
|
52853
52973
|
init_astFilterProcessing();
|
|
52854
52974
|
init_pivotProcessing();
|
|
@@ -52876,13 +52996,13 @@ function convertColumnInternalToAskQuillColumn(columns) {
|
|
|
52876
52996
|
});
|
|
52877
52997
|
}
|
|
52878
52998
|
var useAskQuill = (dashboardName) => {
|
|
52879
|
-
const [client] = (0,
|
|
52880
|
-
const [schemaData] = (0,
|
|
52881
|
-
const { tenants } = (0,
|
|
52882
|
-
const { getToken } = (0,
|
|
52883
|
-
const { eventTracking } = (0,
|
|
52884
|
-
const [astInfo, setAstInfo] = (0,
|
|
52885
|
-
const [data, setData] = (0,
|
|
52999
|
+
const [client] = (0, import_react59.useContext)(ClientContext);
|
|
53000
|
+
const [schemaData] = (0, import_react59.useContext)(SchemaDataContext);
|
|
53001
|
+
const { tenants } = (0, import_react59.useContext)(TenantContext);
|
|
53002
|
+
const { getToken } = (0, import_react59.useContext)(FetchContext);
|
|
53003
|
+
const { eventTracking } = (0, import_react59.useContext)(EventTrackingContext);
|
|
53004
|
+
const [astInfo, setAstInfo] = (0, import_react59.useState)(void 0);
|
|
53005
|
+
const [data, setData] = (0, import_react59.useState)({
|
|
52886
53006
|
rows: [],
|
|
52887
53007
|
columns: [],
|
|
52888
53008
|
pivot: null,
|
|
@@ -52892,9 +53012,9 @@ var useAskQuill = (dashboardName) => {
|
|
|
52892
53012
|
pivotColumnFields: [],
|
|
52893
53013
|
pivotValueFields: []
|
|
52894
53014
|
});
|
|
52895
|
-
const [loading, setLoading] = (0,
|
|
52896
|
-
const [error, setError] = (0,
|
|
52897
|
-
const [ask, setAsk] = (0,
|
|
53015
|
+
const [loading, setLoading] = (0, import_react59.useState)(false);
|
|
53016
|
+
const [error, setError] = (0, import_react59.useState)(void 0);
|
|
53017
|
+
const [ask, setAsk] = (0, import_react59.useState)(
|
|
52898
53018
|
async () => void 0
|
|
52899
53019
|
);
|
|
52900
53020
|
const askHelper = async (query) => {
|
|
@@ -53094,7 +53214,7 @@ var useAskQuill = (dashboardName) => {
|
|
|
53094
53214
|
});
|
|
53095
53215
|
setLoading(false);
|
|
53096
53216
|
};
|
|
53097
|
-
(0,
|
|
53217
|
+
(0, import_react59.useEffect)(() => {
|
|
53098
53218
|
setAsk(() => askHelper);
|
|
53099
53219
|
}, [schemaData.schema]);
|
|
53100
53220
|
return {
|
|
@@ -53108,13 +53228,13 @@ var useAskQuill = (dashboardName) => {
|
|
|
53108
53228
|
};
|
|
53109
53229
|
|
|
53110
53230
|
// src/hooks/useVirtualTables.tsx
|
|
53111
|
-
var
|
|
53231
|
+
var import_react60 = require("react");
|
|
53112
53232
|
var useVirtualTables = () => {
|
|
53113
|
-
const [schemaData, setSchemaData] = (0,
|
|
53114
|
-
const { tenants } = (0,
|
|
53115
|
-
const { getToken, quillFetchWithToken } = (0,
|
|
53116
|
-
const { eventTracking } = (0,
|
|
53117
|
-
const [loadingTables, setLoadingTables] = (0,
|
|
53233
|
+
const [schemaData, setSchemaData] = (0, import_react60.useContext)(SchemaDataContext);
|
|
53234
|
+
const { tenants } = (0, import_react60.useContext)(TenantContext);
|
|
53235
|
+
const { getToken, quillFetchWithToken } = (0, import_react60.useContext)(FetchContext);
|
|
53236
|
+
const { eventTracking } = (0, import_react60.useContext)(EventTrackingContext);
|
|
53237
|
+
const [loadingTables, setLoadingTables] = (0, import_react60.useState)({});
|
|
53118
53238
|
const handleReload = async (client, caller) => {
|
|
53119
53239
|
setSchemaData({ ...schemaData, isSchemaLoading: true });
|
|
53120
53240
|
setLoadingTables(
|