@quillsql/react 2.16.3 → 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 +1389 -1252
- package/dist/index.d.cts +3 -10
- package/dist/index.d.ts +3 -10
- package/dist/index.js +1146 -1004
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17152,7 +17152,6 @@ var init_astProcessing = __esm({
|
|
|
17152
17152
|
}
|
|
17153
17153
|
if (numRetries === MAX_RETRIES) {
|
|
17154
17154
|
console.error("[Error]: Max retries exceeded.");
|
|
17155
|
-
console.info(`%c[Prompt]: ${aiPrompt}`, "color: dimgray");
|
|
17156
17155
|
throw new Error(
|
|
17157
17156
|
"Error: Couldn't process your request, please re-word your prompt."
|
|
17158
17157
|
);
|
|
@@ -19416,10 +19415,10 @@ __export(index_exports, {
|
|
|
19416
19415
|
module.exports = __toCommonJS(index_exports);
|
|
19417
19416
|
|
|
19418
19417
|
// src/Dashboard.tsx
|
|
19419
|
-
var
|
|
19418
|
+
var import_react38 = require("react");
|
|
19420
19419
|
|
|
19421
19420
|
// src/Chart.tsx
|
|
19422
|
-
var
|
|
19421
|
+
var import_react30 = require("react");
|
|
19423
19422
|
|
|
19424
19423
|
// src/utils/csv.ts
|
|
19425
19424
|
init_valueFormatter();
|
|
@@ -20390,11 +20389,13 @@ async function saveReport({
|
|
|
20390
20389
|
rows: void 0,
|
|
20391
20390
|
compareRows: void 0,
|
|
20392
20391
|
dashboardItemId,
|
|
20392
|
+
...dashboardItemId ? { reportId: dashboardItemId } : {},
|
|
20393
20393
|
// Remove useNewNodeSql since backend will handle conversion
|
|
20394
20394
|
clientId: publicKey,
|
|
20395
20395
|
tenants,
|
|
20396
20396
|
// Only include adminMode for 'create' task, not 'create-report'
|
|
20397
|
-
...isCreateTask && { adminMode }
|
|
20397
|
+
...isCreateTask && { adminMode },
|
|
20398
|
+
section: report.section
|
|
20398
20399
|
},
|
|
20399
20400
|
getToken
|
|
20400
20401
|
});
|
|
@@ -25543,11 +25544,11 @@ var PieChartWrapper = import_react5.default.forwardRef(
|
|
|
25543
25544
|
var PieChart_default = PieChartWrapper;
|
|
25544
25545
|
|
|
25545
25546
|
// src/components/QuillTable.tsx
|
|
25546
|
-
var
|
|
25547
|
+
var import_react13 = require("react");
|
|
25547
25548
|
init_valueFormatter();
|
|
25548
25549
|
|
|
25549
25550
|
// src/components/UiComponents.tsx
|
|
25550
|
-
var
|
|
25551
|
+
var import_react12 = require("react");
|
|
25551
25552
|
|
|
25552
25553
|
// src/assets/ArrowDownHeadIcon.tsx
|
|
25553
25554
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
@@ -25798,6 +25799,141 @@ var import_react9 = require("react");
|
|
|
25798
25799
|
// src/hooks/useSelectOnKeyDown.tsx
|
|
25799
25800
|
var import_react10 = require("react");
|
|
25800
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
|
+
|
|
25801
25937
|
// src/components/UiComponents.tsx
|
|
25802
25938
|
var import_react_dom2 = require("react-dom");
|
|
25803
25939
|
|
|
@@ -25818,7 +25954,7 @@ var getScrollableParent = (element) => {
|
|
|
25818
25954
|
|
|
25819
25955
|
// src/components/UiComponents.tsx
|
|
25820
25956
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
25821
|
-
var QuillTextInput = (0,
|
|
25957
|
+
var QuillTextInput = (0, import_react12.forwardRef)(
|
|
25822
25958
|
({
|
|
25823
25959
|
id: id2,
|
|
25824
25960
|
value,
|
|
@@ -25828,15 +25964,20 @@ var QuillTextInput = (0, import_react11.forwardRef)(
|
|
|
25828
25964
|
onChange,
|
|
25829
25965
|
disabled
|
|
25830
25966
|
}, ref) => {
|
|
25831
|
-
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%";
|
|
25832
25970
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
25833
25971
|
"label",
|
|
25834
25972
|
{
|
|
25835
25973
|
style: {
|
|
25836
25974
|
position: "relative",
|
|
25837
25975
|
borderRadius: "6px",
|
|
25838
|
-
|
|
25839
|
-
|
|
25976
|
+
display: "flex",
|
|
25977
|
+
flexDirection: "column",
|
|
25978
|
+
width: resolvedWidth,
|
|
25979
|
+
minWidth: isNumericWidth ? width : 0,
|
|
25980
|
+
flex: isNumericWidth ? "0 0 auto" : "1 1 auto"
|
|
25840
25981
|
},
|
|
25841
25982
|
children: [
|
|
25842
25983
|
label && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
@@ -25858,6 +25999,7 @@ var QuillTextInput = (0, import_react11.forwardRef)(
|
|
|
25858
25999
|
ref,
|
|
25859
26000
|
style: {
|
|
25860
26001
|
display: "flex",
|
|
26002
|
+
flex: "1 1 auto",
|
|
25861
26003
|
height: 40,
|
|
25862
26004
|
minHeight: 40,
|
|
25863
26005
|
maxHeight: 40,
|
|
@@ -25869,8 +26011,8 @@ var QuillTextInput = (0, import_react11.forwardRef)(
|
|
|
25869
26011
|
backgroundColor: theme?.backgroundColor,
|
|
25870
26012
|
color: theme?.primaryTextColor,
|
|
25871
26013
|
fontFamily: theme?.fontFamily,
|
|
25872
|
-
width,
|
|
25873
|
-
minWidth:
|
|
26014
|
+
width: "100%",
|
|
26015
|
+
minWidth: 0
|
|
25874
26016
|
},
|
|
25875
26017
|
id: id2,
|
|
25876
26018
|
value,
|
|
@@ -25892,7 +26034,7 @@ var MemoizedButton = ({
|
|
|
25892
26034
|
tooltipText,
|
|
25893
26035
|
isLoading
|
|
25894
26036
|
}) => {
|
|
25895
|
-
const [theme] = (0,
|
|
26037
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
25896
26038
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
25897
26039
|
QuillToolTipPortal,
|
|
25898
26040
|
{
|
|
@@ -25965,7 +26107,7 @@ var MemoizedSecondaryButton = ({
|
|
|
25965
26107
|
tooltipText,
|
|
25966
26108
|
width
|
|
25967
26109
|
}) => {
|
|
25968
|
-
const [theme] = (0,
|
|
26110
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
25969
26111
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
25970
26112
|
QuillToolTip,
|
|
25971
26113
|
{
|
|
@@ -26039,7 +26181,7 @@ var MemoizedSecondaryButton = ({
|
|
|
26039
26181
|
);
|
|
26040
26182
|
};
|
|
26041
26183
|
var MemoizedHeader = ({ label }) => {
|
|
26042
|
-
const [theme] = (0,
|
|
26184
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26043
26185
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
26044
26186
|
"h1",
|
|
26045
26187
|
{
|
|
@@ -26057,7 +26199,7 @@ var MemoizedHeader = ({ label }) => {
|
|
|
26057
26199
|
);
|
|
26058
26200
|
};
|
|
26059
26201
|
var MemoizedSubHeader = ({ label }) => {
|
|
26060
|
-
const [theme] = (0,
|
|
26202
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26061
26203
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
26062
26204
|
"h2",
|
|
26063
26205
|
{
|
|
@@ -26076,7 +26218,7 @@ var MemoizedSubHeader = ({ label }) => {
|
|
|
26076
26218
|
);
|
|
26077
26219
|
};
|
|
26078
26220
|
var MemoizedLabel = ({ label }) => {
|
|
26079
|
-
const [theme] = (0,
|
|
26221
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26080
26222
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
26081
26223
|
"h1",
|
|
26082
26224
|
{
|
|
@@ -26099,7 +26241,7 @@ var MemoizedCheckbox = ({
|
|
|
26099
26241
|
containerStyle,
|
|
26100
26242
|
disabled
|
|
26101
26243
|
}) => {
|
|
26102
|
-
const [theme] = (0,
|
|
26244
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26103
26245
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
26104
26246
|
"label",
|
|
26105
26247
|
{
|
|
@@ -26208,7 +26350,7 @@ var QuillTabs = ({
|
|
|
26208
26350
|
}
|
|
26209
26351
|
);
|
|
26210
26352
|
var MemoizedText = ({ label }) => {
|
|
26211
|
-
const [theme] = (0,
|
|
26353
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26212
26354
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
26213
26355
|
"p",
|
|
26214
26356
|
{
|
|
@@ -26239,11 +26381,11 @@ var MemoizedPopover = ({
|
|
|
26239
26381
|
horizontalPadding = 20,
|
|
26240
26382
|
titlePaddingLeft = 0
|
|
26241
26383
|
}) => {
|
|
26242
|
-
const [theme] = (0,
|
|
26243
|
-
const [rightAlignment, setRightAlignment] = (0,
|
|
26244
|
-
const modalRef = (0,
|
|
26245
|
-
const popoverRef = (0,
|
|
26246
|
-
(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)(() => {
|
|
26247
26389
|
const listener = (event) => {
|
|
26248
26390
|
const target = event.target;
|
|
26249
26391
|
if (modalRef.current?.contains(target) || target.closest("[data-portal-ignore]") || ignoredRefs?.some(
|
|
@@ -26262,7 +26404,7 @@ var MemoizedPopover = ({
|
|
|
26262
26404
|
document.removeEventListener("mousedown", listener);
|
|
26263
26405
|
};
|
|
26264
26406
|
}, [isOpen, ignoredRefs, setIsOpen, modalRef]);
|
|
26265
|
-
(0,
|
|
26407
|
+
(0, import_react12.useEffect)(() => {
|
|
26266
26408
|
updatePopoverPosition();
|
|
26267
26409
|
window.addEventListener("resize", updatePopoverPosition);
|
|
26268
26410
|
return () => {
|
|
@@ -26337,7 +26479,7 @@ function MemoizedModal({
|
|
|
26337
26479
|
width,
|
|
26338
26480
|
height
|
|
26339
26481
|
}) {
|
|
26340
|
-
const [theme] = (0,
|
|
26482
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26341
26483
|
if (!isOpen) {
|
|
26342
26484
|
return null;
|
|
26343
26485
|
}
|
|
@@ -26657,11 +26799,11 @@ var QuillModalComponent = ({
|
|
|
26657
26799
|
triggerLabel,
|
|
26658
26800
|
title
|
|
26659
26801
|
}) => {
|
|
26660
|
-
const [theme] = (0,
|
|
26661
|
-
const [rightAlignment, setRightAlignment] = (0,
|
|
26662
|
-
const modalRef = (0,
|
|
26663
|
-
const popoverRef = (0,
|
|
26664
|
-
(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)(() => {
|
|
26665
26807
|
const listener = (event) => {
|
|
26666
26808
|
if (modalRef?.current && !modalRef?.current?.contains(event.target)) {
|
|
26667
26809
|
if (setIsOpen) setIsOpen(false);
|
|
@@ -26676,7 +26818,7 @@ var QuillModalComponent = ({
|
|
|
26676
26818
|
document.removeEventListener("mousedown", listener);
|
|
26677
26819
|
};
|
|
26678
26820
|
}, [modalRef, setIsOpen, isOpen]);
|
|
26679
|
-
(0,
|
|
26821
|
+
(0, import_react12.useEffect)(() => {
|
|
26680
26822
|
updatePopoverPosition();
|
|
26681
26823
|
window.addEventListener("resize", updatePopoverPosition);
|
|
26682
26824
|
return () => {
|
|
@@ -26841,7 +26983,7 @@ var QuillErrorMessageComponent = ({
|
|
|
26841
26983
|
errorMessage,
|
|
26842
26984
|
containerStyle
|
|
26843
26985
|
}) => {
|
|
26844
|
-
const [theme] = (0,
|
|
26986
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26845
26987
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
26846
26988
|
"div",
|
|
26847
26989
|
{
|
|
@@ -26890,11 +27032,11 @@ var QuillErrorMessageComponent = ({
|
|
|
26890
27032
|
);
|
|
26891
27033
|
};
|
|
26892
27034
|
var QuillColumnSearchEmptyState = () => {
|
|
26893
|
-
const [theme] = (0,
|
|
27035
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26894
27036
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: { fontFamily: theme?.fontFamily }, children: "No results found" });
|
|
26895
27037
|
};
|
|
26896
27038
|
var QuillLoadingComponent = () => {
|
|
26897
|
-
const [theme] = (0,
|
|
27039
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
26898
27040
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
26899
27041
|
"div",
|
|
26900
27042
|
{
|
|
@@ -26973,9 +27115,9 @@ var OverflowContainer = ({
|
|
|
26973
27115
|
children,
|
|
26974
27116
|
style: style2
|
|
26975
27117
|
}) => {
|
|
26976
|
-
const containerRef = (0,
|
|
26977
|
-
const [showTopShadow, setShowTopShadow] = (0,
|
|
26978
|
-
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);
|
|
26979
27121
|
const checkOverflow = () => {
|
|
26980
27122
|
const container = containerRef.current;
|
|
26981
27123
|
if (container) {
|
|
@@ -26986,7 +27128,7 @@ var OverflowContainer = ({
|
|
|
26986
27128
|
);
|
|
26987
27129
|
}
|
|
26988
27130
|
};
|
|
26989
|
-
(0,
|
|
27131
|
+
(0, import_react12.useEffect)(() => {
|
|
26990
27132
|
const container = containerRef.current;
|
|
26991
27133
|
if (container) {
|
|
26992
27134
|
checkOverflow();
|
|
@@ -27064,7 +27206,7 @@ var QuillToolTip = ({
|
|
|
27064
27206
|
textStyle = {},
|
|
27065
27207
|
displayBelow = false
|
|
27066
27208
|
}) => {
|
|
27067
|
-
const [theme] = (0,
|
|
27209
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
27068
27210
|
return enabled ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "tooltip-container", style: { ...containerStyle }, children: [
|
|
27069
27211
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("style", { children: `
|
|
27070
27212
|
.tooltip-container {
|
|
@@ -27139,11 +27281,11 @@ var QuillToolTipPortal = ({
|
|
|
27139
27281
|
textStyle = {},
|
|
27140
27282
|
mirror = false
|
|
27141
27283
|
}) => {
|
|
27142
|
-
const [theme] = (0,
|
|
27143
|
-
const [isOpen, setIsOpen] = (0,
|
|
27144
|
-
const tooltipRef = (0,
|
|
27145
|
-
const triggerRef = (0,
|
|
27146
|
-
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);
|
|
27147
27289
|
const updatePosition = () => {
|
|
27148
27290
|
if (triggerRef.current && tooltipRef.current) {
|
|
27149
27291
|
const rect = triggerRef.current.getBoundingClientRect();
|
|
@@ -27168,7 +27310,7 @@ var QuillToolTipPortal = ({
|
|
|
27168
27310
|
setTooltipPosition({ top, left });
|
|
27169
27311
|
}
|
|
27170
27312
|
};
|
|
27171
|
-
(0,
|
|
27313
|
+
(0, import_react12.useEffect)(() => {
|
|
27172
27314
|
if (isOpen) {
|
|
27173
27315
|
const timer2 = setTimeout(() => {
|
|
27174
27316
|
updatePosition();
|
|
@@ -27272,7 +27414,7 @@ var QuillChartBuilderCheckboxComponent = ({
|
|
|
27272
27414
|
disabled,
|
|
27273
27415
|
containerStyle
|
|
27274
27416
|
}) => {
|
|
27275
|
-
const [theme] = (0,
|
|
27417
|
+
const [theme] = (0, import_react12.useContext)(ThemeContext);
|
|
27276
27418
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
27277
27419
|
"div",
|
|
27278
27420
|
{
|
|
@@ -27311,10 +27453,10 @@ var QuillPortal = ({
|
|
|
27311
27453
|
showModal,
|
|
27312
27454
|
setShowModal
|
|
27313
27455
|
}) => {
|
|
27314
|
-
const modalRef = (0,
|
|
27315
|
-
const [popoverPosition, setPopoverPosition] = (0,
|
|
27316
|
-
const [z, setZ] = (0,
|
|
27317
|
-
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);
|
|
27318
27460
|
const updatePosition = () => {
|
|
27319
27461
|
if (anchorRef.current) {
|
|
27320
27462
|
requestAnimationFrame(() => {
|
|
@@ -27332,7 +27474,7 @@ var QuillPortal = ({
|
|
|
27332
27474
|
});
|
|
27333
27475
|
}
|
|
27334
27476
|
};
|
|
27335
|
-
(0,
|
|
27477
|
+
(0, import_react12.useEffect)(() => {
|
|
27336
27478
|
let resizeObserver;
|
|
27337
27479
|
let mutationObserver;
|
|
27338
27480
|
if (showModal && anchorRef.current) {
|
|
@@ -27429,18 +27571,18 @@ function QuillTable({
|
|
|
27429
27571
|
hideLabels,
|
|
27430
27572
|
disableSort
|
|
27431
27573
|
}) {
|
|
27432
|
-
const [activeRows, setActiveRows] = (0,
|
|
27433
|
-
const [maxPage, setMaxPage] = (0,
|
|
27434
|
-
const [sortColumn, setSortColumn] = (0,
|
|
27435
|
-
const [sortDirection, setSortDirection] = (0,
|
|
27436
|
-
const [theme] = (0,
|
|
27437
|
-
const [isPaginating, setIsPaginating] = (0,
|
|
27438
|
-
const [initialLoad, setInitialLoad] = (0,
|
|
27439
|
-
(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)(() => {
|
|
27440
27582
|
setSortColumn(sort?.field || "");
|
|
27441
27583
|
setSortDirection(sort?.direction || "desc");
|
|
27442
27584
|
}, [sort]);
|
|
27443
|
-
(0,
|
|
27585
|
+
(0, import_react13.useEffect)(() => {
|
|
27444
27586
|
if (rows?.length === 0 && isLoading) {
|
|
27445
27587
|
return;
|
|
27446
27588
|
}
|
|
@@ -27472,7 +27614,7 @@ function QuillTable({
|
|
|
27472
27614
|
rowCount,
|
|
27473
27615
|
isLoading
|
|
27474
27616
|
]);
|
|
27475
|
-
(0,
|
|
27617
|
+
(0, import_react13.useEffect)(() => {
|
|
27476
27618
|
if (rows.length <= currentPage * rowsPerPage) {
|
|
27477
27619
|
onPageChange && onPageChange(0);
|
|
27478
27620
|
setMaxPage(1);
|
|
@@ -28503,7 +28645,7 @@ function hashCode(obj) {
|
|
|
28503
28645
|
}
|
|
28504
28646
|
|
|
28505
28647
|
// src/components/Chart/LineChart.tsx
|
|
28506
|
-
var
|
|
28648
|
+
var import_react15 = require("react");
|
|
28507
28649
|
|
|
28508
28650
|
// src/components/Chart/CustomReferenceLine.tsx
|
|
28509
28651
|
init_constants();
|
|
@@ -28580,11 +28722,11 @@ function CustomReferenceLine({
|
|
|
28580
28722
|
}
|
|
28581
28723
|
|
|
28582
28724
|
// src/components/Chart/CustomLegend.tsx
|
|
28583
|
-
var
|
|
28725
|
+
var import_react14 = require("react");
|
|
28584
28726
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
28585
28727
|
var RenderLegend = (props) => {
|
|
28586
28728
|
const { payload } = props;
|
|
28587
|
-
const [theme] = (0,
|
|
28729
|
+
const [theme] = (0, import_react14.useContext)(ThemeContext);
|
|
28588
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)(
|
|
28589
28731
|
"div",
|
|
28590
28732
|
{
|
|
@@ -28670,7 +28812,7 @@ function LineChart({
|
|
|
28670
28812
|
referenceLines,
|
|
28671
28813
|
showLegend = false
|
|
28672
28814
|
}) {
|
|
28673
|
-
const formattedData = (0,
|
|
28815
|
+
const formattedData = (0, import_react15.useMemo)(() => {
|
|
28674
28816
|
if (!data || data.length === 0) {
|
|
28675
28817
|
return createLineForEmptyChart(
|
|
28676
28818
|
yAxisFields,
|
|
@@ -28960,7 +29102,7 @@ var import_recharts3 = require("recharts");
|
|
|
28960
29102
|
init_valueFormatter();
|
|
28961
29103
|
|
|
28962
29104
|
// src/components/Chart/CustomBar.tsx
|
|
28963
|
-
var
|
|
29105
|
+
var import_react16 = require("react");
|
|
28964
29106
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
28965
29107
|
function isTopMostBarWithValue(yAxisFields, dataKey, payload) {
|
|
28966
29108
|
if (!dataKey || !yAxisFields.length) return false;
|
|
@@ -28981,7 +29123,7 @@ function createRoundedPath(x, y, width, height, radius, roundTop) {
|
|
|
28981
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();
|
|
28982
29124
|
}
|
|
28983
29125
|
}
|
|
28984
|
-
var CustomBar = (0,
|
|
29126
|
+
var CustomBar = (0, import_react16.memo)((props) => {
|
|
28985
29127
|
const {
|
|
28986
29128
|
x,
|
|
28987
29129
|
y,
|
|
@@ -28997,10 +29139,10 @@ var CustomBar = (0, import_react15.memo)((props) => {
|
|
|
28997
29139
|
return null;
|
|
28998
29140
|
}
|
|
28999
29141
|
const customCornerRadius = theme?.barChartCornerRadius ?? (theme?.barChartCornerRadiusRatio ? theme?.barChartCornerRadiusRatio * width : void 0);
|
|
29000
|
-
const shouldRoundCorners = (0,
|
|
29142
|
+
const shouldRoundCorners = (0, import_react16.useMemo)(() => {
|
|
29001
29143
|
return customCornerRadius !== void 0 ? customCornerRadius > 0 : isTopMostBarWithValue(yAxisFields, dataKey, payload);
|
|
29002
29144
|
}, [customCornerRadius, yAxisFields, dataKey, payload]);
|
|
29003
|
-
const radius = (0,
|
|
29145
|
+
const radius = (0, import_react16.useMemo)(() => {
|
|
29004
29146
|
return shouldRoundCorners ? Math.min(
|
|
29005
29147
|
customCornerRadius || width * 0.1,
|
|
29006
29148
|
width / 2,
|
|
@@ -29011,7 +29153,7 @@ var CustomBar = (0, import_react15.memo)((props) => {
|
|
|
29011
29153
|
const absHeight = Math.abs(height);
|
|
29012
29154
|
const startY = isNegative ? y : y;
|
|
29013
29155
|
const endY = isNegative ? y + height : y + height;
|
|
29014
|
-
const path = (0,
|
|
29156
|
+
const path = (0, import_react16.useMemo)(() => {
|
|
29015
29157
|
if (isNegative) {
|
|
29016
29158
|
return radius > 0 ? createRoundedPath(x, startY, width, absHeight, radius, false) : `M ${x} ${startY} h ${width} v ${height} h -${width} z`;
|
|
29017
29159
|
} else {
|
|
@@ -29024,7 +29166,7 @@ CustomBar.displayName = "CustomBar";
|
|
|
29024
29166
|
var CustomBar_default = CustomBar;
|
|
29025
29167
|
|
|
29026
29168
|
// src/components/Chart/BarChart.tsx
|
|
29027
|
-
var
|
|
29169
|
+
var import_react17 = require("react");
|
|
29028
29170
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
29029
29171
|
var createCustomBar = (yAxisFields, theme) => {
|
|
29030
29172
|
return (props) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CustomBar_default, { ...props, yAxisFields, theme });
|
|
@@ -29069,7 +29211,7 @@ function BarChart({
|
|
|
29069
29211
|
}
|
|
29070
29212
|
return fields;
|
|
29071
29213
|
};
|
|
29072
|
-
const customBarShape = (0,
|
|
29214
|
+
const customBarShape = (0, import_react17.useMemo)(() => {
|
|
29073
29215
|
if (!theme?.barChartCornerRadius && !theme?.barChartCornerRadiusRatio)
|
|
29074
29216
|
return void 0;
|
|
29075
29217
|
return createCustomBar(sortYAxisFields([...yAxisFields]), theme);
|
|
@@ -29290,13 +29432,13 @@ function BarChart({
|
|
|
29290
29432
|
}
|
|
29291
29433
|
|
|
29292
29434
|
// src/components/Chart/ChartError.tsx
|
|
29293
|
-
var
|
|
29435
|
+
var import_react18 = require("react");
|
|
29294
29436
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
29295
29437
|
function ChartError({
|
|
29296
29438
|
errorMessage = "Failed to fetch data.",
|
|
29297
29439
|
containerStyle
|
|
29298
29440
|
}) {
|
|
29299
|
-
const [theme] = (0,
|
|
29441
|
+
const [theme] = (0, import_react18.useContext)(ThemeContext);
|
|
29300
29442
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
29301
29443
|
"div",
|
|
29302
29444
|
{
|
|
@@ -29345,7 +29487,7 @@ function QuillChartErrorWithAction({
|
|
|
29345
29487
|
onClick,
|
|
29346
29488
|
ButtonComponent = MemoizedButton
|
|
29347
29489
|
}) {
|
|
29348
|
-
const [theme] = (0,
|
|
29490
|
+
const [theme] = (0, import_react18.useContext)(ThemeContext);
|
|
29349
29491
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
29350
29492
|
"div",
|
|
29351
29493
|
{
|
|
@@ -29412,15 +29554,15 @@ init_Filter();
|
|
|
29412
29554
|
init_filterProcessing();
|
|
29413
29555
|
|
|
29414
29556
|
// src/components/Dashboard/DashboardFilter.tsx
|
|
29415
|
-
var
|
|
29557
|
+
var import_react23 = require("react");
|
|
29416
29558
|
init_dateRangePickerUtils();
|
|
29417
29559
|
|
|
29418
29560
|
// src/DateRangePicker/QuillDateRangePicker.tsx
|
|
29419
|
-
var
|
|
29561
|
+
var import_react20 = require("react");
|
|
29420
29562
|
var import_date_fns11 = require("date-fns");
|
|
29421
29563
|
|
|
29422
29564
|
// src/components/QuillSelect.tsx
|
|
29423
|
-
var
|
|
29565
|
+
var import_react19 = require("react");
|
|
29424
29566
|
var import_react_dom3 = require("react-dom");
|
|
29425
29567
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
29426
29568
|
function QuillSelectComponent({
|
|
@@ -29433,10 +29575,10 @@ function QuillSelectComponent({
|
|
|
29433
29575
|
disabled,
|
|
29434
29576
|
hideEmptyOption
|
|
29435
29577
|
}) {
|
|
29436
|
-
const [theme] = (0,
|
|
29437
|
-
const [showModal, setShowModal] = (0,
|
|
29438
|
-
const modalRef = (0,
|
|
29439
|
-
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);
|
|
29440
29582
|
useOnClickOutside_default(
|
|
29441
29583
|
modalRef,
|
|
29442
29584
|
(event) => {
|
|
@@ -29445,7 +29587,7 @@ function QuillSelectComponent({
|
|
|
29445
29587
|
},
|
|
29446
29588
|
showModal
|
|
29447
29589
|
);
|
|
29448
|
-
const sortedItems = (0,
|
|
29590
|
+
const sortedItems = (0, import_react19.useMemo)(() => {
|
|
29449
29591
|
return options.sort((a, b) => {
|
|
29450
29592
|
if (a.value === null) {
|
|
29451
29593
|
return -1;
|
|
@@ -29456,12 +29598,12 @@ function QuillSelectComponent({
|
|
|
29456
29598
|
return 0;
|
|
29457
29599
|
});
|
|
29458
29600
|
}, [options]);
|
|
29459
|
-
const nullLabel = (0,
|
|
29601
|
+
const nullLabel = (0, import_react19.useMemo)(() => {
|
|
29460
29602
|
return sortedItems.some((item) => item.value === "-") ? "None" : "-";
|
|
29461
29603
|
}, [sortedItems]);
|
|
29462
|
-
const [popoverPosition, setPopoverPosition] = (0,
|
|
29463
|
-
const [z, setZ] = (0,
|
|
29464
|
-
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);
|
|
29465
29607
|
const updatePosition = () => {
|
|
29466
29608
|
if (buttonRef.current) {
|
|
29467
29609
|
requestAnimationFrame(() => {
|
|
@@ -29479,7 +29621,7 @@ function QuillSelectComponent({
|
|
|
29479
29621
|
});
|
|
29480
29622
|
}
|
|
29481
29623
|
};
|
|
29482
|
-
(0,
|
|
29624
|
+
(0, import_react19.useEffect)(() => {
|
|
29483
29625
|
let resizeObserver;
|
|
29484
29626
|
let mutationObserver;
|
|
29485
29627
|
if (showModal && buttonRef.current) {
|
|
@@ -29758,25 +29900,25 @@ function QuillDateRangePicker({
|
|
|
29758
29900
|
hidePreset,
|
|
29759
29901
|
disabled
|
|
29760
29902
|
}) {
|
|
29761
|
-
const [theme] = (0,
|
|
29762
|
-
const [client] = (0,
|
|
29763
|
-
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)(
|
|
29764
29906
|
getAnchorStartDate(dateRange.startDate, dateRange.endDate)
|
|
29765
29907
|
);
|
|
29766
|
-
const [anchorEndDate, setAnchorEndDate] = (0,
|
|
29908
|
+
const [anchorEndDate, setAnchorEndDate] = (0, import_react20.useState)(
|
|
29767
29909
|
getAnchorEndDate(dateRange.startDate, dateRange.endDate)
|
|
29768
29910
|
);
|
|
29769
|
-
const [localStartDate, setLocalStartDate] = (0,
|
|
29911
|
+
const [localStartDate, setLocalStartDate] = (0, import_react20.useState)(
|
|
29770
29912
|
dateRange.startDate
|
|
29771
29913
|
);
|
|
29772
|
-
const [localEndDate, setLocalEndDate] = (0,
|
|
29914
|
+
const [localEndDate, setLocalEndDate] = (0, import_react20.useState)(
|
|
29773
29915
|
dateRange.endDate
|
|
29774
29916
|
);
|
|
29775
|
-
const [localPreset, setLocalPreset] = (0,
|
|
29776
|
-
const [showModal, setShowModal] = (0,
|
|
29777
|
-
const buttonRef = (0,
|
|
29778
|
-
const modalRef = (0,
|
|
29779
|
-
(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)(() => {
|
|
29780
29922
|
setLocalEndDate(dateRange.endDate);
|
|
29781
29923
|
setLocalStartDate(dateRange.startDate);
|
|
29782
29924
|
setLocalPreset(preset || "");
|
|
@@ -30287,7 +30429,7 @@ function getAnchorEndDate(startDate, endDate) {
|
|
|
30287
30429
|
}
|
|
30288
30430
|
|
|
30289
30431
|
// src/components/QuillMultiSelectWithCombo.tsx
|
|
30290
|
-
var
|
|
30432
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
30291
30433
|
var import_react_dom4 = require("react-dom");
|
|
30292
30434
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
30293
30435
|
function QuillMultiSelectComponentWithCombo({
|
|
@@ -30302,35 +30444,35 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30302
30444
|
allSelectedLabel,
|
|
30303
30445
|
style: style2
|
|
30304
30446
|
}) {
|
|
30305
|
-
const [theme] = (0,
|
|
30306
|
-
const [selectedOptions, setSelectedOptions] = (0,
|
|
30307
|
-
const [showModal, setShowModal] = (0,
|
|
30308
|
-
const modalRef = (0,
|
|
30309
|
-
const buttonRef = (0,
|
|
30310
|
-
const debounceTimeoutId = (0,
|
|
30311
|
-
const [searchQuery, setSearchQuery] =
|
|
30312
|
-
const [exceedsLimit, setExceedsLimit] = (0,
|
|
30313
|
-
const [popoverPosition, setPopoverPosition] = (0,
|
|
30314
|
-
const [z, setZ] = (0,
|
|
30315
|
-
const scrollableParentRef = (0,
|
|
30316
|
-
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);
|
|
30317
30459
|
let CheckboxState;
|
|
30318
30460
|
((CheckboxState2) => {
|
|
30319
30461
|
CheckboxState2[CheckboxState2["SELECTED"] = 0] = "SELECTED";
|
|
30320
30462
|
CheckboxState2[CheckboxState2["UNSELECTED"] = 1] = "UNSELECTED";
|
|
30321
30463
|
CheckboxState2[CheckboxState2["INDETERMINATE"] = 2] = "INDETERMINATE";
|
|
30322
30464
|
})(CheckboxState || (CheckboxState = {}));
|
|
30323
|
-
const optionValues = (0,
|
|
30465
|
+
const optionValues = (0, import_react21.useMemo)(
|
|
30324
30466
|
() => new Set(options.map((opt) => opt.value ?? "")),
|
|
30325
30467
|
[options]
|
|
30326
30468
|
);
|
|
30327
|
-
const potentialOptions = (0,
|
|
30469
|
+
const potentialOptions = (0, import_react21.useMemo)(() => {
|
|
30328
30470
|
return value.filter((opt) => !optionValues.has(opt ?? "")).map((opt) => ({
|
|
30329
30471
|
label: opt === "" ? "-" : opt?.toString() ?? "-",
|
|
30330
30472
|
value: opt ?? ""
|
|
30331
30473
|
})).concat(options);
|
|
30332
30474
|
}, [value, options]);
|
|
30333
|
-
const selectedOptionsLabel = (0,
|
|
30475
|
+
const selectedOptionsLabel = (0, import_react21.useMemo)(() => {
|
|
30334
30476
|
if (!value || !value.length) {
|
|
30335
30477
|
return "Select";
|
|
30336
30478
|
}
|
|
@@ -30347,7 +30489,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30347
30489
|
(elem) => elem.label ?? "-"
|
|
30348
30490
|
).join(", ");
|
|
30349
30491
|
}, [options, value]);
|
|
30350
|
-
const [selectAllCheckboxState, setSelectAllCheckboxState] = (0,
|
|
30492
|
+
const [selectAllCheckboxState, setSelectAllCheckboxState] = (0, import_react21.useState)(
|
|
30351
30493
|
(() => {
|
|
30352
30494
|
if (value.length === 0) {
|
|
30353
30495
|
return 1 /* UNSELECTED */;
|
|
@@ -30358,12 +30500,12 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30358
30500
|
return 2 /* INDETERMINATE */;
|
|
30359
30501
|
})()
|
|
30360
30502
|
);
|
|
30361
|
-
(0,
|
|
30503
|
+
(0, import_react21.useEffect)(() => {
|
|
30362
30504
|
if (selectAllRef.current) {
|
|
30363
30505
|
selectAllRef.current.indeterminate = selectAllCheckboxState === 2 /* INDETERMINATE */;
|
|
30364
30506
|
}
|
|
30365
30507
|
}, [selectAllCheckboxState, showModal]);
|
|
30366
|
-
(0,
|
|
30508
|
+
(0, import_react21.useEffect)(() => {
|
|
30367
30509
|
if (options.length > 0 && options?.[0]?.value === "EXCEEDS_LIMIT") {
|
|
30368
30510
|
setExceedsLimit(true);
|
|
30369
30511
|
} else {
|
|
@@ -30378,7 +30520,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30378
30520
|
},
|
|
30379
30521
|
showModal
|
|
30380
30522
|
);
|
|
30381
|
-
(0,
|
|
30523
|
+
(0, import_react21.useEffect)(() => {
|
|
30382
30524
|
if (!value) {
|
|
30383
30525
|
setSelectedOptions([]);
|
|
30384
30526
|
} else {
|
|
@@ -30393,7 +30535,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30393
30535
|
onChange(updatedChangeEvent);
|
|
30394
30536
|
}, 200);
|
|
30395
30537
|
};
|
|
30396
|
-
const filteredItems =
|
|
30538
|
+
const filteredItems = import_react21.default.useMemo(() => {
|
|
30397
30539
|
if (searchQuery === "") {
|
|
30398
30540
|
return potentialOptions.sort((a, b) => {
|
|
30399
30541
|
if (a.value === null) {
|
|
@@ -30423,7 +30565,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30423
30565
|
return 0;
|
|
30424
30566
|
}).slice(0, 20);
|
|
30425
30567
|
}, [potentialOptions, searchQuery]);
|
|
30426
|
-
const nullLabel = (0,
|
|
30568
|
+
const nullLabel = (0, import_react21.useMemo)(() => {
|
|
30427
30569
|
return filteredItems.some((item) => item.value === "-") ? "None" : "-";
|
|
30428
30570
|
}, [filteredItems]);
|
|
30429
30571
|
const updatePosition = () => {
|
|
@@ -30443,7 +30585,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
30443
30585
|
});
|
|
30444
30586
|
}
|
|
30445
30587
|
};
|
|
30446
|
-
(0,
|
|
30588
|
+
(0, import_react21.useEffect)(() => {
|
|
30447
30589
|
let resizeObserver;
|
|
30448
30590
|
let mutationObserver;
|
|
30449
30591
|
if (showModal && buttonRef.current) {
|
|
@@ -30877,7 +31019,7 @@ var ListboxTextInput = ({
|
|
|
30877
31019
|
onChange,
|
|
30878
31020
|
placeholder
|
|
30879
31021
|
}) => {
|
|
30880
|
-
const [theme] = (0,
|
|
31022
|
+
const [theme] = (0, import_react21.useContext)(ThemeContext);
|
|
30881
31023
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
30882
31024
|
"div",
|
|
30883
31025
|
{
|
|
@@ -30947,7 +31089,7 @@ var ListboxTextInput = ({
|
|
|
30947
31089
|
};
|
|
30948
31090
|
|
|
30949
31091
|
// src/components/QuillSelectWithCombo.tsx
|
|
30950
|
-
var
|
|
31092
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
30951
31093
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
30952
31094
|
function QuillSelectComponentWithCombo({
|
|
30953
31095
|
options,
|
|
@@ -30959,12 +31101,12 @@ function QuillSelectComponentWithCombo({
|
|
|
30959
31101
|
hideEmptyOption,
|
|
30960
31102
|
disabled
|
|
30961
31103
|
}) {
|
|
30962
|
-
const [theme] = (0,
|
|
30963
|
-
const [showModal, setShowModal] = (0,
|
|
30964
|
-
const modalRef = (0,
|
|
30965
|
-
const buttonRef = (0,
|
|
30966
|
-
const [searchQuery, setSearchQuery] =
|
|
30967
|
-
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(() => {
|
|
30968
31110
|
if (searchQuery === "") {
|
|
30969
31111
|
return options?.sort((a, b) => {
|
|
30970
31112
|
if (a.value === null) {
|
|
@@ -30994,10 +31136,10 @@ function QuillSelectComponentWithCombo({
|
|
|
30994
31136
|
return 0;
|
|
30995
31137
|
})?.slice(0, 20) ?? [];
|
|
30996
31138
|
}, [options, searchQuery]);
|
|
30997
|
-
const nullLabel = (0,
|
|
31139
|
+
const nullLabel = (0, import_react22.useMemo)(() => {
|
|
30998
31140
|
return filteredItems.some((item) => item.value === "-") ? "None" : "-";
|
|
30999
31141
|
}, [filteredItems]);
|
|
31000
|
-
const selectedLabel = (0,
|
|
31142
|
+
const selectedLabel = (0, import_react22.useMemo)(() => {
|
|
31001
31143
|
const selectedOption = options?.find((elem) => elem.value === value);
|
|
31002
31144
|
return selectedOption && selectedOption.label == "-" ? nullLabel : selectedOption?.label ?? "Select";
|
|
31003
31145
|
}, [value, options, nullLabel]);
|
|
@@ -31265,7 +31407,7 @@ function DashboardFilter2({
|
|
|
31265
31407
|
disabled,
|
|
31266
31408
|
containerStyle
|
|
31267
31409
|
}) {
|
|
31268
|
-
const preset = (0,
|
|
31410
|
+
const preset = (0, import_react23.useMemo)(() => {
|
|
31269
31411
|
if (
|
|
31270
31412
|
/*'preset' in filter && */
|
|
31271
31413
|
"primaryRange" in filter
|
|
@@ -31466,7 +31608,7 @@ function DashboardFilter2({
|
|
|
31466
31608
|
init_paginationProcessing();
|
|
31467
31609
|
|
|
31468
31610
|
// src/components/Dashboard/MetricComponent.tsx
|
|
31469
|
-
var
|
|
31611
|
+
var import_react24 = require("react");
|
|
31470
31612
|
init_dateRangePickerUtils();
|
|
31471
31613
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
31472
31614
|
function QuillMetricComponent({
|
|
@@ -31476,7 +31618,7 @@ function QuillMetricComponent({
|
|
|
31476
31618
|
isLoading,
|
|
31477
31619
|
children
|
|
31478
31620
|
}) {
|
|
31479
|
-
const [theme] = (0,
|
|
31621
|
+
const [theme] = (0, import_react24.useContext)(ThemeContext);
|
|
31480
31622
|
const dateFilter = report?.filtersApplied?.find(
|
|
31481
31623
|
(filter) => filter.filterType === "date_range"
|
|
31482
31624
|
);
|
|
@@ -31750,7 +31892,7 @@ var MetricDisplay = ({
|
|
|
31750
31892
|
};
|
|
31751
31893
|
|
|
31752
31894
|
// src/components/Dashboard/DataLoader.tsx
|
|
31753
|
-
var
|
|
31895
|
+
var import_react25 = require("react");
|
|
31754
31896
|
init_paginationProcessing();
|
|
31755
31897
|
init_tableProcessing();
|
|
31756
31898
|
var import_fast_deep_equal2 = __toESM(require("fast-deep-equal"), 1);
|
|
@@ -31851,29 +31993,29 @@ function DataLoader({
|
|
|
31851
31993
|
dashboardName,
|
|
31852
31994
|
propagateChanges
|
|
31853
31995
|
}) {
|
|
31854
|
-
const [client] = (0,
|
|
31996
|
+
const [client] = (0, import_react25.useContext)(ClientContext);
|
|
31855
31997
|
const {
|
|
31856
31998
|
dashboardReports: dashboard,
|
|
31857
31999
|
addReport,
|
|
31858
32000
|
updateReport
|
|
31859
32001
|
} = useDashboardReports(dashboardName);
|
|
31860
|
-
const { dashboardFilters } = (0,
|
|
31861
|
-
const { tenants, flags } = (0,
|
|
31862
|
-
const { reports, reportsDispatch, fetchIndividualReport } = (0,
|
|
31863
|
-
const { reportFilters } = (0,
|
|
31864
|
-
const { getToken } = (0,
|
|
31865
|
-
const { eventTracking } = (0,
|
|
31866
|
-
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)(() => {
|
|
31867
32009
|
return dashboardName ? Object.values(dashboardFilters[dashboardName] ?? {}).map(
|
|
31868
32010
|
(f) => f.filter
|
|
31869
32011
|
) : Object.values(reportFilters[item.id] ?? {}).map((f) => f.filter);
|
|
31870
32012
|
}, [dashboardFilters, reportFilters, dashboardName, item.id]);
|
|
31871
|
-
const [schemaData] = (0,
|
|
31872
|
-
const [loading, setLoading] = (0,
|
|
31873
|
-
const [error, setError] = (0,
|
|
31874
|
-
const [previousPage, setPreviousPage] = (0,
|
|
31875
|
-
const [additionalProcessing, setAdditionalProcessing] = (0,
|
|
31876
|
-
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)(() => {
|
|
31877
32019
|
const report = (dashboardName ? dashboard : reports)[item.id];
|
|
31878
32020
|
if (report) {
|
|
31879
32021
|
return convertInternalReportToReport(
|
|
@@ -31889,17 +32031,17 @@ function DataLoader({
|
|
|
31889
32031
|
reportFilters,
|
|
31890
32032
|
dashboardFilters
|
|
31891
32033
|
]);
|
|
31892
|
-
const previousFilters = (0,
|
|
31893
|
-
const previousUserFilters = (0,
|
|
31894
|
-
const previousTenants = (0,
|
|
31895
|
-
const previousCustomFields = (0,
|
|
31896
|
-
const [rowCountIsLoading, setRowCountIsLoading] = (0,
|
|
31897
|
-
const rowsRequestId = (0,
|
|
31898
|
-
const rowsAbortController = (0,
|
|
31899
|
-
const rowCountRequestId = (0,
|
|
31900
|
-
const rowCountAbortController = (0,
|
|
31901
|
-
const updateTableRowsRequestId = (0,
|
|
31902
|
-
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);
|
|
31903
32045
|
const fetchRowCount = async (processing) => {
|
|
31904
32046
|
if (!client || !filters) {
|
|
31905
32047
|
if (!rowCountAbortController.current) return;
|
|
@@ -32166,7 +32308,7 @@ function DataLoader({
|
|
|
32166
32308
|
}
|
|
32167
32309
|
}
|
|
32168
32310
|
};
|
|
32169
|
-
(0,
|
|
32311
|
+
(0, import_react25.useEffect)(() => {
|
|
32170
32312
|
if (schemaData.isSchemaLoading || filterValuesEquivalent(
|
|
32171
32313
|
previousFilters.current ?? contextFilters,
|
|
32172
32314
|
filters
|
|
@@ -32196,7 +32338,7 @@ function DataLoader({
|
|
|
32196
32338
|
schemaData.customFields,
|
|
32197
32339
|
schemaData.isSchemaLoading
|
|
32198
32340
|
]);
|
|
32199
|
-
(0,
|
|
32341
|
+
(0, import_react25.useEffect)(() => {
|
|
32200
32342
|
const tempReport = (dashboardName ? dashboard : reports)[item.id];
|
|
32201
32343
|
if (tempReport?.triggerReload) {
|
|
32202
32344
|
fetchReportHelper(additionalProcessing);
|
|
@@ -32228,29 +32370,29 @@ var ChartDataLoader = ({
|
|
|
32228
32370
|
propagateChanges
|
|
32229
32371
|
}) => {
|
|
32230
32372
|
const { dashboardReports: dashboard, addReport } = useDashboardReports(dashboardName);
|
|
32231
|
-
const { dashboardFilters } = (0,
|
|
32232
|
-
const { reports, fetchIndividualReport } = (0,
|
|
32233
|
-
const { getToken } = (0,
|
|
32234
|
-
const { eventTracking } = (0,
|
|
32235
|
-
const { reportFilters } = (0,
|
|
32236
|
-
const { tenants, flags } = (0,
|
|
32237
|
-
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)(() => {
|
|
32238
32380
|
return dashboardName ? Object.values(dashboardFilters[dashboardName] ?? {}).map(
|
|
32239
32381
|
(f) => f.filter
|
|
32240
32382
|
) : Object.values(reportFilters[item.id] ?? {}).map((f) => f.filter);
|
|
32241
32383
|
}, [dashboardFilters, reportFilters, dashboardName, item.id]);
|
|
32242
|
-
const [loading, setLoading] = (0,
|
|
32243
|
-
const [error, setError] = (0,
|
|
32244
|
-
const [client] = (0,
|
|
32245
|
-
const [schemaData] = (0,
|
|
32246
|
-
const previousFilters = (0,
|
|
32247
|
-
const previousUserFilters = (0,
|
|
32248
|
-
const previousDateBucket = (0,
|
|
32249
|
-
const previousTenants = (0,
|
|
32250
|
-
const previousCustomFields = (0,
|
|
32251
|
-
const fetchReportAbortController = (0,
|
|
32252
|
-
const rowsRequestId = (0,
|
|
32253
|
-
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)(() => {
|
|
32254
32396
|
const report = dashboardName ? dashboard[item.id] : reports[item.id];
|
|
32255
32397
|
if (!report) {
|
|
32256
32398
|
return constructReportFromItem(item);
|
|
@@ -32362,7 +32504,7 @@ var ChartDataLoader = ({
|
|
|
32362
32504
|
}
|
|
32363
32505
|
}
|
|
32364
32506
|
};
|
|
32365
|
-
(0,
|
|
32507
|
+
(0, import_react25.useEffect)(() => {
|
|
32366
32508
|
if (!filters) {
|
|
32367
32509
|
return;
|
|
32368
32510
|
}
|
|
@@ -32397,7 +32539,7 @@ var ChartDataLoader = ({
|
|
|
32397
32539
|
schemaData.customFields,
|
|
32398
32540
|
schemaData.isSchemaLoading
|
|
32399
32541
|
]);
|
|
32400
|
-
(0,
|
|
32542
|
+
(0, import_react25.useEffect)(() => {
|
|
32401
32543
|
const tempReport = (dashboardName ? dashboard : reports)[item.id];
|
|
32402
32544
|
if (tempReport && tempReport.triggerReload) {
|
|
32403
32545
|
fetchReportHelper();
|
|
@@ -32420,9 +32562,9 @@ var ChartDataLoader = ({
|
|
|
32420
32562
|
init_dateRangePickerUtils();
|
|
32421
32563
|
|
|
32422
32564
|
// src/hooks/useReport.ts
|
|
32423
|
-
var
|
|
32565
|
+
var import_react26 = require("react");
|
|
32424
32566
|
var useReports = () => {
|
|
32425
|
-
const [dashboard, dispatch2] = (0,
|
|
32567
|
+
const [dashboard, dispatch2] = (0, import_react26.useContext)(DashboardContext);
|
|
32426
32568
|
const reloadFilteredReports = (predicate) => {
|
|
32427
32569
|
for (const dashboardName of Object.keys(dashboard)) {
|
|
32428
32570
|
for (const id2 of Object.keys(dashboard[dashboardName])) {
|
|
@@ -32442,7 +32584,7 @@ var useReports = () => {
|
|
|
32442
32584
|
};
|
|
32443
32585
|
};
|
|
32444
32586
|
var useReportInternal = (reportId) => {
|
|
32445
|
-
const { loadFiltersForReport } = (0,
|
|
32587
|
+
const { loadFiltersForReport } = (0, import_react26.useContext)(ReportFiltersContext);
|
|
32446
32588
|
const { allReportsById } = useAllReports();
|
|
32447
32589
|
const reload = async (overrideFilters, customFilters = [], initiator = "Chart") => {
|
|
32448
32590
|
const dateFilter = overrideFilters.filters.find(
|
|
@@ -32474,7 +32616,7 @@ var import_fast_deep_equal3 = __toESM(require("fast-deep-equal"), 1);
|
|
|
32474
32616
|
|
|
32475
32617
|
// src/components/Chart/MapChart.tsx
|
|
32476
32618
|
var import_react_simple_maps = require("react-simple-maps");
|
|
32477
|
-
var
|
|
32619
|
+
var import_react27 = require("react");
|
|
32478
32620
|
init_valueFormatter();
|
|
32479
32621
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
32480
32622
|
var statesUrl = "https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json";
|
|
@@ -32801,23 +32943,23 @@ function USMap({
|
|
|
32801
32943
|
className,
|
|
32802
32944
|
containerStyle
|
|
32803
32945
|
}) {
|
|
32804
|
-
const containerRef = (0,
|
|
32805
|
-
const [hoveredState, setHoveredState] = (0,
|
|
32946
|
+
const containerRef = (0, import_react27.useRef)(null);
|
|
32947
|
+
const [hoveredState, setHoveredState] = (0, import_react27.useState)(
|
|
32806
32948
|
void 0
|
|
32807
32949
|
);
|
|
32808
|
-
const [hoveredCoords, setHoveredCoords] = (0,
|
|
32950
|
+
const [hoveredCoords, setHoveredCoords] = (0, import_react27.useState)(void 0);
|
|
32809
32951
|
const mappedData = data.reduce((acc, curr) => {
|
|
32810
32952
|
acc[curr[xAxisField]?.toString()] = curr;
|
|
32811
32953
|
return acc;
|
|
32812
32954
|
}, {});
|
|
32813
32955
|
const measureField = yAxisFields[0]?.field ?? xAxisField;
|
|
32814
|
-
const [scaleLog, setScaleLog] = (0,
|
|
32815
|
-
(0,
|
|
32956
|
+
const [scaleLog, setScaleLog] = (0, import_react27.useState)(null);
|
|
32957
|
+
(0, import_react27.useEffect)(() => {
|
|
32816
32958
|
import("d3-scale").then((scale) => {
|
|
32817
32959
|
setScaleLog(() => scale.scaleLog);
|
|
32818
32960
|
});
|
|
32819
32961
|
}, []);
|
|
32820
|
-
const colorScale = (0,
|
|
32962
|
+
const colorScale = (0, import_react27.useMemo)(() => {
|
|
32821
32963
|
if (!scaleLog) return () => "#FFFFFF";
|
|
32822
32964
|
const values = Object.values(mappedData).map((d) => parseFloat(d[measureField])).filter((v) => !isNaN(v));
|
|
32823
32965
|
const minValue = Math.min(...values);
|
|
@@ -32843,7 +32985,7 @@ function USMap({
|
|
|
32843
32985
|
colors,
|
|
32844
32986
|
scaleLog
|
|
32845
32987
|
]);
|
|
32846
|
-
const hoveredValue = (0,
|
|
32988
|
+
const hoveredValue = (0, import_react27.useMemo)(() => {
|
|
32847
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];
|
|
32848
32990
|
}, [hoveredState, mappedData, measureField]);
|
|
32849
32991
|
if (!measureField) {
|
|
@@ -32992,23 +33134,23 @@ function WorldMap({
|
|
|
32992
33134
|
className,
|
|
32993
33135
|
containerStyle
|
|
32994
33136
|
}) {
|
|
32995
|
-
const containerRef = (0,
|
|
32996
|
-
const [hoveredCountry, setHoveredCountry] = (0,
|
|
33137
|
+
const containerRef = (0, import_react27.useRef)(null);
|
|
33138
|
+
const [hoveredCountry, setHoveredCountry] = (0, import_react27.useState)(
|
|
32997
33139
|
void 0
|
|
32998
33140
|
);
|
|
32999
|
-
const [hoveredCoords, setHoveredCoords] = (0,
|
|
33141
|
+
const [hoveredCoords, setHoveredCoords] = (0, import_react27.useState)(void 0);
|
|
33000
33142
|
const mappedData = data.reduce((acc, curr) => {
|
|
33001
33143
|
acc[curr[xAxisField]?.toString()] = curr;
|
|
33002
33144
|
return acc;
|
|
33003
33145
|
}, {});
|
|
33004
33146
|
const measureField = yAxisFields[0]?.field ?? xAxisField;
|
|
33005
|
-
const [scaleLog, setScaleLog] = (0,
|
|
33006
|
-
(0,
|
|
33147
|
+
const [scaleLog, setScaleLog] = (0, import_react27.useState)(null);
|
|
33148
|
+
(0, import_react27.useEffect)(() => {
|
|
33007
33149
|
import("d3-scale").then((scale) => {
|
|
33008
33150
|
setScaleLog(() => scale.scaleLog);
|
|
33009
33151
|
});
|
|
33010
33152
|
}, []);
|
|
33011
|
-
const colorScale = (0,
|
|
33153
|
+
const colorScale = (0, import_react27.useMemo)(() => {
|
|
33012
33154
|
if (!scaleLog) return () => "#FFFFFF";
|
|
33013
33155
|
const values = Object.values(mappedData).map((d) => parseFloat(d[measureField])).filter((v) => !isNaN(v));
|
|
33014
33156
|
const minValue = Math.min(...values);
|
|
@@ -33034,7 +33176,7 @@ function WorldMap({
|
|
|
33034
33176
|
colors,
|
|
33035
33177
|
scaleLog
|
|
33036
33178
|
]);
|
|
33037
|
-
const hoveredValue = (0,
|
|
33179
|
+
const hoveredValue = (0, import_react27.useMemo)(() => {
|
|
33038
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];
|
|
33039
33181
|
}, [hoveredCountry, mappedData, measureField]);
|
|
33040
33182
|
if (!measureField) {
|
|
@@ -33185,8 +33327,8 @@ function MapLayout({
|
|
|
33185
33327
|
regionNames
|
|
33186
33328
|
}) {
|
|
33187
33329
|
const { projection } = (0, import_react_simple_maps.useMapContext)();
|
|
33188
|
-
const [geoCentroid, setGeoCentroid] = (0,
|
|
33189
|
-
(0,
|
|
33330
|
+
const [geoCentroid, setGeoCentroid] = (0, import_react27.useState)(null);
|
|
33331
|
+
(0, import_react27.useEffect)(() => {
|
|
33190
33332
|
import("d3-geo").then((geo) => {
|
|
33191
33333
|
setGeoCentroid(() => geo.geoCentroid);
|
|
33192
33334
|
});
|
|
@@ -33238,7 +33380,7 @@ function MapLayout({
|
|
|
33238
33380
|
}
|
|
33239
33381
|
|
|
33240
33382
|
// src/components/Chart/GaugeChart.tsx
|
|
33241
|
-
var
|
|
33383
|
+
var import_react28 = require("react");
|
|
33242
33384
|
|
|
33243
33385
|
// ../../node_modules/d3-transition/src/selection/index.js
|
|
33244
33386
|
var import_d3_selection9 = require("d3-selection");
|
|
@@ -34512,20 +34654,20 @@ function D3Gauge({
|
|
|
34512
34654
|
colors,
|
|
34513
34655
|
isAnimationActive
|
|
34514
34656
|
}) {
|
|
34515
|
-
const containerRef = (0,
|
|
34516
|
-
const svgRef = (0,
|
|
34517
|
-
const gaugeGroupRef = (0,
|
|
34518
|
-
const needleRef = (0,
|
|
34519
|
-
const needleOutlineRef = (0,
|
|
34520
|
-
const textRef = (0,
|
|
34521
|
-
const previousPercentageRef = (0,
|
|
34522
|
-
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);
|
|
34523
34665
|
const startAngle = -(3 * Math.PI) / 4;
|
|
34524
34666
|
const totalAngle = 3 * Math.PI / 2;
|
|
34525
|
-
const [arc, setArc] = (0,
|
|
34526
|
-
const [interpolate, setInterpolate] = (0,
|
|
34527
|
-
const [select, setSelect] = (0,
|
|
34528
|
-
(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)(() => {
|
|
34529
34671
|
import("d3-shape").then(({ arc: arc2 }) => {
|
|
34530
34672
|
setArc(() => arc2);
|
|
34531
34673
|
});
|
|
@@ -34536,7 +34678,7 @@ function D3Gauge({
|
|
|
34536
34678
|
setSelect(() => select2);
|
|
34537
34679
|
});
|
|
34538
34680
|
}, []);
|
|
34539
|
-
(0,
|
|
34681
|
+
(0, import_react28.useEffect)(() => {
|
|
34540
34682
|
if (!containerRef.current || !select) return;
|
|
34541
34683
|
const container = containerRef.current;
|
|
34542
34684
|
select(container).select("svg").remove();
|
|
@@ -34553,7 +34695,7 @@ function D3Gauge({
|
|
|
34553
34695
|
svgRef.current = null;
|
|
34554
34696
|
};
|
|
34555
34697
|
}, [colors, select]);
|
|
34556
|
-
(0,
|
|
34698
|
+
(0, import_react28.useEffect)(() => {
|
|
34557
34699
|
if (!containerRef.current || !svgRef.current || !gaugeGroupRef.current || !needleRef.current || !needleOutlineRef.current || !textRef.current || !arc || !interpolate || !select)
|
|
34558
34700
|
return;
|
|
34559
34701
|
const rect = containerRef.current.getBoundingClientRect();
|
|
@@ -34653,7 +34795,7 @@ function D3Gauge({
|
|
|
34653
34795
|
arc,
|
|
34654
34796
|
interpolate
|
|
34655
34797
|
]);
|
|
34656
|
-
(0,
|
|
34798
|
+
(0, import_react28.useEffect)(() => {
|
|
34657
34799
|
if (!containerRef.current) return;
|
|
34658
34800
|
const observer = new ResizeObserver(() => {
|
|
34659
34801
|
previousPercentageRef.current = percentage;
|
|
@@ -34671,7 +34813,7 @@ function D3Gauge({
|
|
|
34671
34813
|
}
|
|
34672
34814
|
|
|
34673
34815
|
// src/components/QuillComponentTables.tsx
|
|
34674
|
-
var
|
|
34816
|
+
var import_react29 = require("react");
|
|
34675
34817
|
init_paginationProcessing();
|
|
34676
34818
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
34677
34819
|
var QuillTableSQLEditorComponent = ({
|
|
@@ -34688,8 +34830,8 @@ var QuillTableSQLEditorComponent = ({
|
|
|
34688
34830
|
setCurrentPage,
|
|
34689
34831
|
hideLabels
|
|
34690
34832
|
}) => {
|
|
34691
|
-
const [sort, setSort] = (0,
|
|
34692
|
-
const [page, setPage] = (0,
|
|
34833
|
+
const [sort, setSort] = (0, import_react29.useState)({ field: "", direction: "" });
|
|
34834
|
+
const [page, setPage] = (0, import_react29.useState)(0);
|
|
34693
34835
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
34694
34836
|
QuillTable,
|
|
34695
34837
|
{
|
|
@@ -34731,9 +34873,9 @@ var QuillTableReportBuilderComponent = ({
|
|
|
34731
34873
|
setCurrentPage,
|
|
34732
34874
|
disableSort
|
|
34733
34875
|
}) => {
|
|
34734
|
-
const [sort, setSort] = (0,
|
|
34735
|
-
const [page, setPage] = (0,
|
|
34736
|
-
(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)(() => {
|
|
34737
34879
|
if (disableSort) {
|
|
34738
34880
|
setSort({ field: "", direction: "" });
|
|
34739
34881
|
}
|
|
@@ -34777,15 +34919,15 @@ var QuillTableComponent = ({
|
|
|
34777
34919
|
currentPage,
|
|
34778
34920
|
hideLabels
|
|
34779
34921
|
}) => {
|
|
34780
|
-
const [sort, setSort] = (0,
|
|
34781
|
-
const [page, setPage] = (0,
|
|
34782
|
-
const [initialLoad, setInitialLoad] = (0,
|
|
34783
|
-
(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)(() => {
|
|
34784
34926
|
if (initialLoad && !isLoading) {
|
|
34785
34927
|
setInitialLoad(false);
|
|
34786
34928
|
}
|
|
34787
34929
|
}, [isLoading]);
|
|
34788
|
-
(0,
|
|
34930
|
+
(0, import_react29.useEffect)(() => {
|
|
34789
34931
|
setPage(currentPage || 0);
|
|
34790
34932
|
}, [currentPage]);
|
|
34791
34933
|
if (initialLoad) {
|
|
@@ -34838,16 +34980,16 @@ function QuillTableDashboardComponent({
|
|
|
34838
34980
|
onSortChange,
|
|
34839
34981
|
hideName
|
|
34840
34982
|
}) {
|
|
34841
|
-
const [theme] = (0,
|
|
34842
|
-
const [initialLoad, setInitialLoad] = (0,
|
|
34983
|
+
const [theme] = (0, import_react29.useContext)(ThemeContext);
|
|
34984
|
+
const [initialLoad, setInitialLoad] = (0, import_react29.useState)(true);
|
|
34843
34985
|
const { downloadCSV: downloadCSV2 } = useExport(report?.id);
|
|
34844
|
-
const [page, setPage] = (0,
|
|
34845
|
-
(0,
|
|
34986
|
+
const [page, setPage] = (0, import_react29.useState)(0);
|
|
34987
|
+
(0, import_react29.useEffect)(() => {
|
|
34846
34988
|
if (!isLoading) {
|
|
34847
34989
|
setInitialLoad(false);
|
|
34848
34990
|
}
|
|
34849
34991
|
}, [isLoading]);
|
|
34850
|
-
(0,
|
|
34992
|
+
(0, import_react29.useEffect)(() => {
|
|
34851
34993
|
if (rowCountIsLoading) {
|
|
34852
34994
|
setPage(0);
|
|
34853
34995
|
}
|
|
@@ -34983,50 +35125,50 @@ function Chart({
|
|
|
34983
35125
|
dateBucket,
|
|
34984
35126
|
propagateChanges
|
|
34985
35127
|
}) {
|
|
34986
|
-
const [schemaData] = (0,
|
|
35128
|
+
const [schemaData] = (0, import_react30.useContext)(SchemaDataContext);
|
|
34987
35129
|
const { reload } = useReportInternal(reportId);
|
|
34988
|
-
const { reports, reportsDispatch, fetchIndividualReport } = (0,
|
|
35130
|
+
const { reports, reportsDispatch, fetchIndividualReport } = (0, import_react30.useContext)(ReportsContext);
|
|
34989
35131
|
const {
|
|
34990
35132
|
reportFiltersDispatch,
|
|
34991
35133
|
reportFilters,
|
|
34992
35134
|
customReportFiltersDispatch,
|
|
34993
35135
|
customReportFilters
|
|
34994
|
-
} = (0,
|
|
34995
|
-
const { eventTracking } = (0,
|
|
34996
|
-
const { isLoading: isDashboardsLoading } = (0,
|
|
34997
|
-
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);
|
|
34998
35140
|
const { allReportsById } = useAllReports();
|
|
34999
35141
|
const { dashboardFilters } = useDashboardInternal(
|
|
35000
35142
|
allReportsById[reportId]?.dashboardName ?? null
|
|
35001
35143
|
);
|
|
35002
|
-
const specificReportFilters = (0,
|
|
35144
|
+
const specificReportFilters = (0, import_react30.useMemo)(() => {
|
|
35003
35145
|
const reportFilterValues = reportFilters[reportId];
|
|
35004
35146
|
if (reportFilterValues && !hideFilters)
|
|
35005
35147
|
return Object.values(reportFilterValues ?? {}).map((f) => f.filter);
|
|
35006
35148
|
if (allReportsById[reportId]) return dashboardFilters ?? [];
|
|
35007
35149
|
return [];
|
|
35008
35150
|
}, [reportFilters[reportId], allReportsById[reportId], dashboardFilters]);
|
|
35009
|
-
const reportDateFilter = (0,
|
|
35151
|
+
const reportDateFilter = (0, import_react30.useMemo)(() => {
|
|
35010
35152
|
return specificReportFilters.find((f) => f.filterType === "date_range");
|
|
35011
35153
|
}, [specificReportFilters]);
|
|
35012
|
-
const presetOptions = (0,
|
|
35154
|
+
const presetOptions = (0, import_react30.useMemo)(() => {
|
|
35013
35155
|
return reportDateFilter ? convertPresetOptionsToSelectableList(
|
|
35014
35156
|
reportDateFilter.presetOptions ?? [],
|
|
35015
35157
|
reportDateFilter.defaultPresetRanges ?? []
|
|
35016
35158
|
) : defaultOptionsV2;
|
|
35017
35159
|
}, [reportDateFilter]);
|
|
35018
|
-
const userFilters = (0,
|
|
35160
|
+
const userFilters = (0, import_react30.useMemo)(() => {
|
|
35019
35161
|
return filters?.filter((f) => f.filterType !== "date" /* Date */)?.map(convertCustomFilter) ?? dashboardCustomFilters[allReportsById[reportId]?.dashboardName ?? ""];
|
|
35020
35162
|
}, [
|
|
35021
35163
|
filters,
|
|
35022
35164
|
dashboardCustomFilters[allReportsById[reportId]?.dashboardName ?? ""]
|
|
35023
35165
|
]);
|
|
35024
|
-
const previousFilters = (0,
|
|
35166
|
+
const previousFilters = (0, import_react30.useRef)(void 0);
|
|
35025
35167
|
if (!(0, import_fast_deep_equal3.default)(previousFilters.current, filters)) {
|
|
35026
35168
|
previousFilters.current = filters;
|
|
35027
35169
|
}
|
|
35028
|
-
const [filterValues, setFilterValues] = (0,
|
|
35029
|
-
(0,
|
|
35170
|
+
const [filterValues, setFilterValues] = (0, import_react30.useState)({});
|
|
35171
|
+
(0, import_react30.useEffect)(() => {
|
|
35030
35172
|
setFilterValues(
|
|
35031
35173
|
Object.values(reportFilters[reportId] ?? {}).reduce((acc, f) => {
|
|
35032
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" ? {
|
|
@@ -35041,7 +35183,7 @@ function Chart({
|
|
|
35041
35183
|
}, {})
|
|
35042
35184
|
);
|
|
35043
35185
|
}, [reportFilters[reportId]]);
|
|
35044
|
-
(0,
|
|
35186
|
+
(0, import_react30.useEffect)(() => {
|
|
35045
35187
|
if ((0, import_fast_deep_equal3.default)(customReportFilters[reportId] ?? [], filters ?? [])) {
|
|
35046
35188
|
return;
|
|
35047
35189
|
}
|
|
@@ -35057,7 +35199,7 @@ function Chart({
|
|
|
35057
35199
|
});
|
|
35058
35200
|
};
|
|
35059
35201
|
}, [filters]);
|
|
35060
|
-
(0,
|
|
35202
|
+
(0, import_react30.useEffect)(() => {
|
|
35061
35203
|
if (reportDateFilter) {
|
|
35062
35204
|
const customDateFilter = previousFilters.current?.find(
|
|
35063
35205
|
(f) => f.filterType === "date" /* Date */
|
|
@@ -35090,20 +35232,20 @@ function Chart({
|
|
|
35090
35232
|
});
|
|
35091
35233
|
}
|
|
35092
35234
|
}, [previousFilters.current]);
|
|
35093
|
-
const dashboardReport = (0,
|
|
35235
|
+
const dashboardReport = (0, import_react30.useMemo)(
|
|
35094
35236
|
() => allReportsById[reportId],
|
|
35095
35237
|
[reportId, allReportsById]
|
|
35096
35238
|
);
|
|
35097
|
-
const report = (0,
|
|
35098
|
-
const [loading, setLoading] = (0,
|
|
35099
|
-
const [theme] = (0,
|
|
35100
|
-
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)(() => {
|
|
35101
35243
|
if (mapColorsToFields && report && theme) {
|
|
35102
35244
|
return mapColorsToFields(report, theme);
|
|
35103
35245
|
}
|
|
35104
35246
|
}, [report, theme]);
|
|
35105
|
-
const [client, clientLoading] = (0,
|
|
35106
|
-
const [error, setError] = (0,
|
|
35247
|
+
const [client, clientLoading] = (0, import_react30.useContext)(ClientContext);
|
|
35248
|
+
const [error, setError] = (0, import_react30.useState)(void 0);
|
|
35107
35249
|
const updateFilter = (filter, value, comparison) => {
|
|
35108
35250
|
let filterValue = {};
|
|
35109
35251
|
if (filter.filterType === "string" /* String */) {
|
|
@@ -35213,7 +35355,7 @@ function Chart({
|
|
|
35213
35355
|
setLoading(false);
|
|
35214
35356
|
}
|
|
35215
35357
|
};
|
|
35216
|
-
(0,
|
|
35358
|
+
(0, import_react30.useEffect)(() => {
|
|
35217
35359
|
if (reportId === void 0 || reportId === "" || clientLoading || isDashboardsLoading) {
|
|
35218
35360
|
return;
|
|
35219
35361
|
}
|
|
@@ -35401,11 +35543,11 @@ var ChartDisplay = ({
|
|
|
35401
35543
|
tableRowsLoading = false
|
|
35402
35544
|
}) => {
|
|
35403
35545
|
const { downloadCSV: downloadCSV2 } = useExport(reportId);
|
|
35404
|
-
const [theme] = (0,
|
|
35405
|
-
const { reports } = (0,
|
|
35406
|
-
const { dashboardFilters } = (0,
|
|
35407
|
-
const { reportFilters } = (0,
|
|
35408
|
-
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)(() => {
|
|
35409
35551
|
if (!reportId) return [];
|
|
35410
35552
|
const dashboardName = reports[reportId]?.dashboardName || config?.dashboardName;
|
|
35411
35553
|
if (!dashboardName) return [];
|
|
@@ -35413,24 +35555,24 @@ var ChartDisplay = ({
|
|
|
35413
35555
|
(f) => f.filter
|
|
35414
35556
|
);
|
|
35415
35557
|
}, [dashboardFilters, reportId, reports]);
|
|
35416
|
-
const specificReportFilters = (0,
|
|
35558
|
+
const specificReportFilters = (0, import_react30.useMemo)(() => {
|
|
35417
35559
|
if (!reportId) return [];
|
|
35418
35560
|
return Object.values(reportFilters[reportId] ?? []).map((f) => f.filter);
|
|
35419
35561
|
}, [reportFilters, reportId]);
|
|
35420
|
-
const chartColors = (0,
|
|
35562
|
+
const chartColors = (0, import_react30.useMemo)(() => {
|
|
35421
35563
|
if (overrideTheme && overrideTheme.chartColors) {
|
|
35422
35564
|
return colors?.length ? colors : overrideTheme && overrideTheme.chartColors && overrideTheme.chartColors.length ? overrideTheme.chartColors : ["#4E80EE", "#E14F62", "#55B5A6", "#E9A23B", "#6466E9", "#55B685"];
|
|
35423
35565
|
}
|
|
35424
35566
|
return colors?.length ? colors : theme && theme.chartColors && theme.chartColors.length ? theme.chartColors : ["#4E80EE", "#E14F62", "#55B5A6", "#E9A23B", "#6466E9", "#55B685"];
|
|
35425
35567
|
}, [colors]);
|
|
35426
|
-
const dateFilter = (0,
|
|
35568
|
+
const dateFilter = (0, import_react30.useMemo)(() => {
|
|
35427
35569
|
const filters = specificReportFilters.length > 0 ? specificReportFilters : specificDashboardFilters;
|
|
35428
35570
|
if (!hideDateRangeFilter && filters) {
|
|
35429
35571
|
return findAndProcessDateFilter(filters.map((f) => f));
|
|
35430
35572
|
}
|
|
35431
35573
|
return void 0;
|
|
35432
35574
|
}, [config, specificReportFilters, specificDashboardFilters]);
|
|
35433
|
-
const [page, setPage] = (0,
|
|
35575
|
+
const [page, setPage] = (0, import_react30.useState)(0);
|
|
35434
35576
|
if (loading) {
|
|
35435
35577
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className, style: containerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(LoadingComponent, {}) });
|
|
35436
35578
|
} else if (config && !["metric", "table", "gauge", "US map", "World map"].includes(
|
|
@@ -35748,7 +35890,7 @@ function DashboardSectionContainer({
|
|
|
35748
35890
|
}
|
|
35749
35891
|
|
|
35750
35892
|
// src/components/Dashboard/ChartComponent.tsx
|
|
35751
|
-
var
|
|
35893
|
+
var import_react31 = require("react");
|
|
35752
35894
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
35753
35895
|
function QuillChartComponent({
|
|
35754
35896
|
report,
|
|
@@ -35757,7 +35899,7 @@ function QuillChartComponent({
|
|
|
35757
35899
|
children,
|
|
35758
35900
|
isLoading
|
|
35759
35901
|
}) {
|
|
35760
|
-
const [theme] = (0,
|
|
35902
|
+
const [theme] = (0, import_react31.useContext)(ThemeContext);
|
|
35761
35903
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
35762
35904
|
"div",
|
|
35763
35905
|
{
|
|
@@ -35874,7 +36016,7 @@ function QuillChartComponent({
|
|
|
35874
36016
|
}
|
|
35875
36017
|
|
|
35876
36018
|
// src/components/Dashboard/TemplateChartComponent.tsx
|
|
35877
|
-
var
|
|
36019
|
+
var import_react32 = require("react");
|
|
35878
36020
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
35879
36021
|
function QuillTemplateChartComponent({
|
|
35880
36022
|
report,
|
|
@@ -35882,7 +36024,7 @@ function QuillTemplateChartComponent({
|
|
|
35882
36024
|
children,
|
|
35883
36025
|
isLoading
|
|
35884
36026
|
}) {
|
|
35885
|
-
const [isSelected, setIsSelected] = (0,
|
|
36027
|
+
const [isSelected, setIsSelected] = (0, import_react32.useState)(false);
|
|
35886
36028
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
35887
36029
|
"div",
|
|
35888
36030
|
{
|
|
@@ -35911,13 +36053,13 @@ function QuillTemplateChartComponent({
|
|
|
35911
36053
|
}
|
|
35912
36054
|
|
|
35913
36055
|
// src/components/Dashboard/DashboardSection.tsx
|
|
35914
|
-
var
|
|
36056
|
+
var import_react33 = require("react");
|
|
35915
36057
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
35916
36058
|
function DashboardSection({
|
|
35917
36059
|
section,
|
|
35918
36060
|
children
|
|
35919
36061
|
}) {
|
|
35920
|
-
const [theme] = (0,
|
|
36062
|
+
const [theme] = (0, import_react33.useContext)(ThemeContext);
|
|
35921
36063
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
35922
36064
|
section && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { style: { display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
35923
36065
|
"h1",
|
|
@@ -35966,12 +36108,12 @@ init_tableProcessing();
|
|
|
35966
36108
|
init_filterProcessing();
|
|
35967
36109
|
|
|
35968
36110
|
// src/components/ReportBuilder/ui.tsx
|
|
35969
|
-
var
|
|
36111
|
+
var import_react34 = require("react");
|
|
35970
36112
|
init_util();
|
|
35971
36113
|
init_tableProcessing();
|
|
35972
36114
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
35973
36115
|
var QuillSecondaryButton = ({ children, ...props }) => {
|
|
35974
|
-
const [theme] = (0,
|
|
36116
|
+
const [theme] = (0, import_react34.useContext)(ThemeContext);
|
|
35975
36117
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
35976
36118
|
"button",
|
|
35977
36119
|
{
|
|
@@ -35997,9 +36139,9 @@ var QuillSecondaryButton = ({ children, ...props }) => {
|
|
|
35997
36139
|
}
|
|
35998
36140
|
);
|
|
35999
36141
|
};
|
|
36000
|
-
var QuillTag = (0,
|
|
36142
|
+
var QuillTag = (0, import_react34.forwardRef)(
|
|
36001
36143
|
({ label, onClick, children, onClickDelete, hideDelete = false }, forwardedRef) => {
|
|
36002
|
-
const [theme] = (0,
|
|
36144
|
+
const [theme] = (0, import_react34.useContext)(ThemeContext);
|
|
36003
36145
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
36004
36146
|
"div",
|
|
36005
36147
|
{
|
|
@@ -36080,7 +36222,7 @@ var QuillTag = (0, import_react33.forwardRef)(
|
|
|
36080
36222
|
var QuillSidebarHeading = ({
|
|
36081
36223
|
label
|
|
36082
36224
|
}) => {
|
|
36083
|
-
const [theme] = (0,
|
|
36225
|
+
const [theme] = (0, import_react34.useContext)(ThemeContext);
|
|
36084
36226
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
36085
36227
|
"h1",
|
|
36086
36228
|
{
|
|
@@ -36235,7 +36377,7 @@ var QuillSelectColumn = ({
|
|
|
36235
36377
|
setSelected,
|
|
36236
36378
|
DragHandle
|
|
36237
36379
|
}) => {
|
|
36238
|
-
const [theme] = (0,
|
|
36380
|
+
const [theme] = (0, import_react34.useContext)(ThemeContext);
|
|
36239
36381
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
36240
36382
|
"div",
|
|
36241
36383
|
{
|
|
@@ -36274,7 +36416,7 @@ var QuillDraggableColumn = ({
|
|
|
36274
36416
|
DragHandle,
|
|
36275
36417
|
deleteDisabled
|
|
36276
36418
|
}) => {
|
|
36277
|
-
const [theme] = (0,
|
|
36419
|
+
const [theme] = (0, import_react34.useContext)(ThemeContext);
|
|
36278
36420
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
36279
36421
|
"div",
|
|
36280
36422
|
{
|
|
@@ -36458,13 +36600,13 @@ var FilterPopoverWrapper = ({
|
|
|
36458
36600
|
getToken,
|
|
36459
36601
|
reportBuilderColumns
|
|
36460
36602
|
}) => {
|
|
36461
|
-
const { tenants } = (0,
|
|
36462
|
-
const { eventTracking } = (0,
|
|
36463
|
-
const [isOpen, setIsOpen] = (0,
|
|
36464
|
-
const [uniqueValues, setUniqueValues] = (0,
|
|
36465
|
-
const [uniqueValuesIsLoading, setUniqueValuesIsLoading] = (0,
|
|
36466
|
-
const prevFiltersRef = (0,
|
|
36467
|
-
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)(() => {
|
|
36468
36610
|
if (!tables) {
|
|
36469
36611
|
return null;
|
|
36470
36612
|
}
|
|
@@ -36478,7 +36620,7 @@ var FilterPopoverWrapper = ({
|
|
|
36478
36620
|
});
|
|
36479
36621
|
return relevantColumns;
|
|
36480
36622
|
}, [schema, tables]);
|
|
36481
|
-
(0,
|
|
36623
|
+
(0, import_react34.useEffect)(() => {
|
|
36482
36624
|
const currentFiltersString = JSON.stringify(priorFilters);
|
|
36483
36625
|
if (currentFiltersString !== prevFiltersRef.current) {
|
|
36484
36626
|
prevFiltersRef.current = currentFiltersString;
|
|
@@ -36547,7 +36689,7 @@ var FilterPopoverWrapper = ({
|
|
|
36547
36689
|
};
|
|
36548
36690
|
|
|
36549
36691
|
// src/components/ReportBuilder/FilterModal.tsx
|
|
36550
|
-
var
|
|
36692
|
+
var import_react35 = require("react");
|
|
36551
36693
|
init_Filter();
|
|
36552
36694
|
var import_date_fns13 = require("date-fns");
|
|
36553
36695
|
init_textProcessing();
|
|
@@ -36570,32 +36712,32 @@ function FilterModal({
|
|
|
36570
36712
|
MultiSelectComponent,
|
|
36571
36713
|
reportBuilderColumns
|
|
36572
36714
|
}) {
|
|
36573
|
-
const [field, setField] = (0,
|
|
36574
|
-
const [fieldOptions, setFieldOptions] = (0,
|
|
36575
|
-
const [fieldValues, setFieldValues] = (0,
|
|
36576
|
-
const [type, setType] = (0,
|
|
36577
|
-
const [value, setValue] = (0,
|
|
36578
|
-
const [selectedOptions, setSelectedOptions] = (0,
|
|
36579
|
-
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)(
|
|
36580
36722
|
void 0
|
|
36581
36723
|
);
|
|
36582
|
-
const [operatorOptions, setOperatorOptions] = (0,
|
|
36583
|
-
const [unit, setUnit] = (0,
|
|
36584
|
-
const [unitOptions, setUnitOptions] = (0,
|
|
36585
|
-
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)(
|
|
36586
36728
|
(0, import_date_fns13.startOfToday)().toISOString().substring(0, 10)
|
|
36587
36729
|
);
|
|
36588
|
-
const [endDate, setEndDate] = (0,
|
|
36730
|
+
const [endDate, setEndDate] = (0, import_react35.useState)(
|
|
36589
36731
|
(0, import_date_fns13.startOfToday)().toISOString().substring(0, 10)
|
|
36590
36732
|
);
|
|
36591
|
-
const [filterInitialized, setFilterInitialized] = (0,
|
|
36592
|
-
const [table, setTable] = (0,
|
|
36593
|
-
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)(
|
|
36594
36736
|
() => fieldValuesMap,
|
|
36595
36737
|
[JSON.stringify(fieldValuesMap)]
|
|
36596
36738
|
);
|
|
36597
|
-
const memoizedFilter = (0,
|
|
36598
|
-
(0,
|
|
36739
|
+
const memoizedFilter = (0, import_react35.useMemo)(() => filter, [JSON.stringify(filter)]);
|
|
36740
|
+
(0, import_react35.useEffect)(() => {
|
|
36599
36741
|
if (!filter) {
|
|
36600
36742
|
onFieldChange(field, fieldOptions, table);
|
|
36601
36743
|
}
|
|
@@ -36640,7 +36782,7 @@ function FilterModal({
|
|
|
36640
36782
|
],
|
|
36641
36783
|
[FieldType.Null]: [NullOperator.IsNotNull, NullOperator.IsNull]
|
|
36642
36784
|
};
|
|
36643
|
-
(0,
|
|
36785
|
+
(0, import_react35.useEffect)(() => {
|
|
36644
36786
|
if (filter) {
|
|
36645
36787
|
setField(filter.field);
|
|
36646
36788
|
setTable(filter.table);
|
|
@@ -36668,7 +36810,7 @@ function FilterModal({
|
|
|
36668
36810
|
}
|
|
36669
36811
|
}
|
|
36670
36812
|
}, [memoizedFilter]);
|
|
36671
|
-
(0,
|
|
36813
|
+
(0, import_react35.useEffect)(() => {
|
|
36672
36814
|
if (schema) {
|
|
36673
36815
|
const fo = schema.flatMap((table2) => {
|
|
36674
36816
|
if (tables && !tables.includes(table2.name)) {
|
|
@@ -37350,7 +37492,7 @@ function FilterModal({
|
|
|
37350
37492
|
}
|
|
37351
37493
|
|
|
37352
37494
|
// src/components/Dashboard/TemplateMetricComponent.tsx
|
|
37353
|
-
var
|
|
37495
|
+
var import_react36 = require("react");
|
|
37354
37496
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
37355
37497
|
function QuillTemplateMetricComponent({
|
|
37356
37498
|
report,
|
|
@@ -37358,7 +37500,7 @@ function QuillTemplateMetricComponent({
|
|
|
37358
37500
|
children,
|
|
37359
37501
|
isLoading
|
|
37360
37502
|
}) {
|
|
37361
|
-
const [isSelected, setIsSelected] = (0,
|
|
37503
|
+
const [isSelected, setIsSelected] = (0, import_react36.useState)(false);
|
|
37362
37504
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
37363
37505
|
"div",
|
|
37364
37506
|
{
|
|
@@ -37387,7 +37529,7 @@ function QuillTemplateMetricComponent({
|
|
|
37387
37529
|
}
|
|
37388
37530
|
|
|
37389
37531
|
// src/components/Dashboard/TemplateTableComponent.tsx
|
|
37390
|
-
var
|
|
37532
|
+
var import_react37 = require("react");
|
|
37391
37533
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
37392
37534
|
function QuillTemplateTableComponent({
|
|
37393
37535
|
report,
|
|
@@ -37398,7 +37540,7 @@ function QuillTemplateTableComponent({
|
|
|
37398
37540
|
onPageChange,
|
|
37399
37541
|
onSortChange
|
|
37400
37542
|
}) {
|
|
37401
|
-
const [isSelected, setIsSelected] = (0,
|
|
37543
|
+
const [isSelected, setIsSelected] = (0, import_react37.useState)(false);
|
|
37402
37544
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
37403
37545
|
"div",
|
|
37404
37546
|
{
|
|
@@ -37613,14 +37755,14 @@ function Dashboard({
|
|
|
37613
37755
|
templateDashboardName,
|
|
37614
37756
|
pagination = { rowsPerPage: 10, rowsPerRequest: 50 }
|
|
37615
37757
|
}) {
|
|
37616
|
-
const [userFilters, setUserFilters] = (0,
|
|
37617
|
-
const [selectedSection, setSelectedSection] = (0,
|
|
37618
|
-
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)(() => {
|
|
37619
37761
|
return (filters?.map((f) => convertCustomFilter(f)) ?? []).concat(
|
|
37620
37762
|
Object.values(userFilters)
|
|
37621
37763
|
);
|
|
37622
37764
|
}, [filters, userFilters]);
|
|
37623
|
-
(0,
|
|
37765
|
+
(0, import_react38.useEffect)(() => {
|
|
37624
37766
|
onUserFiltersUpdated?.(Object.values(userFilters));
|
|
37625
37767
|
}, [userFilters]);
|
|
37626
37768
|
const {
|
|
@@ -37635,10 +37777,10 @@ function Dashboard({
|
|
|
37635
37777
|
Object.values(userFilters) ?? []
|
|
37636
37778
|
)
|
|
37637
37779
|
);
|
|
37638
|
-
const { getToken } = (0,
|
|
37639
|
-
const { customFilterDispatch } = (0,
|
|
37640
|
-
const { eventTracking } = (0,
|
|
37641
|
-
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)(() => {
|
|
37642
37784
|
const map = {};
|
|
37643
37785
|
Object.keys(data?.sections ?? {}).forEach((section) => {
|
|
37644
37786
|
if (!data?.sections?.[section]) return;
|
|
@@ -37666,7 +37808,7 @@ function Dashboard({
|
|
|
37666
37808
|
});
|
|
37667
37809
|
return map;
|
|
37668
37810
|
}, [data?.sections, data?.sectionOrder]);
|
|
37669
|
-
const charts = (0,
|
|
37811
|
+
const charts = (0, import_react38.useMemo)(() => {
|
|
37670
37812
|
const map = {};
|
|
37671
37813
|
Object.keys(data?.sections ?? {}).forEach((section) => {
|
|
37672
37814
|
if (!data?.sections?.[section]) return;
|
|
@@ -37692,7 +37834,7 @@ function Dashboard({
|
|
|
37692
37834
|
});
|
|
37693
37835
|
return map;
|
|
37694
37836
|
}, [data?.sections, data?.sectionOrder]);
|
|
37695
|
-
const tables = (0,
|
|
37837
|
+
const tables = (0, import_react38.useMemo)(() => {
|
|
37696
37838
|
const map = {};
|
|
37697
37839
|
Object.keys(data?.sections ?? {}).forEach((section) => {
|
|
37698
37840
|
if (!data?.sections?.[section]) return;
|
|
@@ -37718,8 +37860,8 @@ function Dashboard({
|
|
|
37718
37860
|
});
|
|
37719
37861
|
return map;
|
|
37720
37862
|
}, [data?.sections, data?.sectionOrder]);
|
|
37721
|
-
const mounted = (0,
|
|
37722
|
-
(0,
|
|
37863
|
+
const mounted = (0, import_react38.useRef)(false);
|
|
37864
|
+
(0, import_react38.useEffect)(() => {
|
|
37723
37865
|
if (!mounted.current) {
|
|
37724
37866
|
mounted.current = true;
|
|
37725
37867
|
return;
|
|
@@ -37731,53 +37873,53 @@ function Dashboard({
|
|
|
37731
37873
|
filters: populatedDashboardFilters ?? []
|
|
37732
37874
|
});
|
|
37733
37875
|
}, [filters, userFilters]);
|
|
37734
|
-
(0,
|
|
37876
|
+
(0, import_react38.useEffect)(() => {
|
|
37735
37877
|
customFilterDispatch({
|
|
37736
37878
|
type: "ADD_CUSTOM_DASHBOARD_FILTERS",
|
|
37737
37879
|
dashboardName: name2,
|
|
37738
37880
|
data: dataLoaderUserFilters
|
|
37739
37881
|
});
|
|
37740
37882
|
}, [dataLoaderUserFilters]);
|
|
37741
|
-
const [client, isClientLoading] = (0,
|
|
37742
|
-
const { tenants, flags } = (0,
|
|
37743
|
-
const [theme] = (0,
|
|
37744
|
-
const [schemaData] = (0,
|
|
37745
|
-
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)(
|
|
37746
37888
|
DashboardFiltersContext
|
|
37747
37889
|
);
|
|
37748
|
-
const [fieldValuesMap, setFieldValuesMap] = (0,
|
|
37749
|
-
const [fieldValuesIsLoaded, setFieldValuesIsLoaded] = (0,
|
|
37750
|
-
const [addFilterPopoverIsOpen, setAddFilterPopoverIsOpen] = (0,
|
|
37751
|
-
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);
|
|
37752
37894
|
const [
|
|
37753
37895
|
filterListAddFilterPopoverIsOpen,
|
|
37754
37896
|
setFilterListAddFilterPopoverIsOpen
|
|
37755
|
-
] = (0,
|
|
37756
|
-
const presetOptions = (0,
|
|
37897
|
+
] = (0, import_react38.useState)(false);
|
|
37898
|
+
const presetOptions = (0, import_react38.useMemo)(() => {
|
|
37757
37899
|
return populatedDashboardFilters?.[0]?.filterType === "date_range" ? convertPresetOptionsToSelectableList(
|
|
37758
37900
|
populatedDashboardFilters[0].presetOptions ?? [],
|
|
37759
37901
|
populatedDashboardFilters[0].defaultPresetRanges ?? []
|
|
37760
37902
|
) : defaultOptionsV2;
|
|
37761
37903
|
}, [populatedDashboardFilters]);
|
|
37762
|
-
const [filterValues, setFilterValues] = (0,
|
|
37763
|
-
const prevNameRef = (0,
|
|
37764
|
-
const prevFlagsRef = (0,
|
|
37765
|
-
const prevClientRef = (0,
|
|
37766
|
-
const addFilterPopoverButtonRef = (0,
|
|
37767
|
-
const viewFiltersPopoverButtonRef = (0,
|
|
37768
|
-
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);
|
|
37769
37911
|
if (!(0, import_fast_deep_equal4.default)(previousFilters.current, filters)) {
|
|
37770
37912
|
previousFilters.current = filters;
|
|
37771
37913
|
}
|
|
37772
|
-
const isInitialLoadOfDashboardRef = (0,
|
|
37773
|
-
const referencedTables = (0,
|
|
37914
|
+
const isInitialLoadOfDashboardRef = (0, import_react38.useRef)(false);
|
|
37915
|
+
const referencedTables = (0, import_react38.useMemo)(() => {
|
|
37774
37916
|
const sections = data?.sections || {};
|
|
37775
37917
|
const tables2 = Object.values(sections).flatMap(
|
|
37776
37918
|
(section) => section.map((chart) => chart.referencedTables)
|
|
37777
37919
|
).flat();
|
|
37778
37920
|
return Array.from(new Set(tables2));
|
|
37779
37921
|
}, [data?.sections]);
|
|
37780
|
-
(0,
|
|
37922
|
+
(0, import_react38.useEffect)(() => {
|
|
37781
37923
|
if (prevNameRef.current === name2 && Object.values(data?.sections ?? {}).flat().length) {
|
|
37782
37924
|
return;
|
|
37783
37925
|
}
|
|
@@ -37797,8 +37939,8 @@ function Dashboard({
|
|
|
37797
37939
|
prevFlagsRef.current = flags;
|
|
37798
37940
|
});
|
|
37799
37941
|
}, [name2, isClientLoading]);
|
|
37800
|
-
const tenantMounted = (0,
|
|
37801
|
-
(0,
|
|
37942
|
+
const tenantMounted = (0, import_react38.useRef)(false);
|
|
37943
|
+
(0, import_react38.useEffect)(() => {
|
|
37802
37944
|
if (!tenantMounted.current) {
|
|
37803
37945
|
tenantMounted.current = true;
|
|
37804
37946
|
return;
|
|
@@ -37817,7 +37959,7 @@ function Dashboard({
|
|
|
37817
37959
|
isInitialLoadOfDashboardRef.current = false;
|
|
37818
37960
|
});
|
|
37819
37961
|
}, [flags]);
|
|
37820
|
-
(0,
|
|
37962
|
+
(0, import_react38.useEffect)(() => {
|
|
37821
37963
|
if (prevClientRef.current === client?.publicKey) {
|
|
37822
37964
|
return;
|
|
37823
37965
|
}
|
|
@@ -37832,7 +37974,7 @@ function Dashboard({
|
|
|
37832
37974
|
isInitialLoadOfDashboardRef.current = false;
|
|
37833
37975
|
});
|
|
37834
37976
|
}, [client?.publicKey]);
|
|
37835
|
-
(0,
|
|
37977
|
+
(0, import_react38.useEffect)(() => {
|
|
37836
37978
|
setFilterValues(
|
|
37837
37979
|
Object.values(populatedDashboardFilters ?? {}).reduce((acc, f) => {
|
|
37838
37980
|
acc[f.label] = f.filterType === "string" ? f.stringFilterType === "multiselect" ? { values: f.values, operator: "IN" } : { selectedValue: f.selectedValue } : f.filterType === "date_range" ? {
|
|
@@ -37847,7 +37989,7 @@ function Dashboard({
|
|
|
37847
37989
|
}, {})
|
|
37848
37990
|
);
|
|
37849
37991
|
}, [populatedDashboardFilters]);
|
|
37850
|
-
(0,
|
|
37992
|
+
(0, import_react38.useEffect)(() => {
|
|
37851
37993
|
const dashboardDateFilter = populatedDashboardFilters?.find(
|
|
37852
37994
|
(f) => f.filterType === "date_range"
|
|
37853
37995
|
);
|
|
@@ -37884,7 +38026,7 @@ function Dashboard({
|
|
|
37884
38026
|
});
|
|
37885
38027
|
}
|
|
37886
38028
|
}, [previousFilters.current]);
|
|
37887
|
-
(0,
|
|
38029
|
+
(0, import_react38.useEffect)(() => {
|
|
37888
38030
|
const fetchData = async () => {
|
|
37889
38031
|
setFieldValuesIsLoaded(false);
|
|
37890
38032
|
const newFieldValues = {};
|
|
@@ -38045,7 +38187,7 @@ function Dashboard({
|
|
|
38045
38187
|
[filter.field]: filter
|
|
38046
38188
|
}));
|
|
38047
38189
|
};
|
|
38048
|
-
(0,
|
|
38190
|
+
(0, import_react38.useEffect)(() => {
|
|
38049
38191
|
if (onChangeLoading && isLoading) {
|
|
38050
38192
|
onChangeLoading(isLoading);
|
|
38051
38193
|
}
|
|
@@ -38685,15 +38827,15 @@ function QuillDashboardTemplate({
|
|
|
38685
38827
|
ButtonComponent
|
|
38686
38828
|
}) {
|
|
38687
38829
|
const { isLoading, data } = useDashboardInternal(name2 ?? "");
|
|
38688
|
-
const { getToken } = (0,
|
|
38689
|
-
const { eventTracking } = (0,
|
|
38690
|
-
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)(
|
|
38691
38833
|
DashboardConfigContext
|
|
38692
38834
|
);
|
|
38693
|
-
const [addItemModalIsOpen, setAddItemModalIsOpen] = (0,
|
|
38694
|
-
const [selectedTemplates, setSelectedTemplates] = (0,
|
|
38695
|
-
const [selectingTemplate, setSelectingTemplate] = (0,
|
|
38696
|
-
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);
|
|
38697
38839
|
const templateSections = data?.sections;
|
|
38698
38840
|
const onSubmitTemplates = async () => {
|
|
38699
38841
|
setSubmittingTemplate(true);
|
|
@@ -38836,7 +38978,7 @@ var QuillProvider = ({
|
|
|
38836
38978
|
var QuillProvider_default = QuillProvider;
|
|
38837
38979
|
|
|
38838
38980
|
// src/Table.tsx
|
|
38839
|
-
var
|
|
38981
|
+
var import_react39 = require("react");
|
|
38840
38982
|
init_Filter();
|
|
38841
38983
|
init_paginationProcessing();
|
|
38842
38984
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
@@ -38845,26 +38987,26 @@ var Table = ({
|
|
|
38845
38987
|
...props
|
|
38846
38988
|
}) => {
|
|
38847
38989
|
const data = props;
|
|
38848
|
-
const [dashboard] = (0,
|
|
38849
|
-
const { dashboardFilters, dashboardCustomFilters } = (0,
|
|
38990
|
+
const [dashboard] = (0, import_react39.useContext)(DashboardContext);
|
|
38991
|
+
const { dashboardFilters, dashboardCustomFilters } = (0, import_react39.useContext)(
|
|
38850
38992
|
DashboardFiltersContext
|
|
38851
38993
|
);
|
|
38852
|
-
const [client, clientLoading] = (0,
|
|
38853
|
-
const [schemaData] = (0,
|
|
38854
|
-
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);
|
|
38855
38997
|
const { allReportsById } = useAllReports();
|
|
38856
|
-
const [loading, setLoading] = (0,
|
|
38857
|
-
const report = (0,
|
|
38998
|
+
const [loading, setLoading] = (0, import_react39.useState)(false);
|
|
38999
|
+
const report = (0, import_react39.useMemo)(() => {
|
|
38858
39000
|
return props.reportId ? allReportsById[props.reportId] : null;
|
|
38859
39001
|
}, [allReportsById[props.reportId ?? ""]]);
|
|
38860
|
-
const { reportFilters, customReportFilters, reportFiltersDispatch } = (0,
|
|
38861
|
-
const { reports, fetchIndividualReport, reportsDispatch } = (0,
|
|
38862
|
-
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)(() => {
|
|
38863
39005
|
return Object.values(
|
|
38864
39006
|
reportFilters[props.reportId ?? ""] ?? (dashboard[report?.dashboardName ?? ""]?.[report?.id ?? ""] ? dashboardFilters[report.dashboardName] : null) ?? {}
|
|
38865
39007
|
).map((f) => f.filter);
|
|
38866
39008
|
}, [reportFilters[props.reportId ?? ""]]);
|
|
38867
|
-
const userFilters = (0,
|
|
39009
|
+
const userFilters = (0, import_react39.useMemo)(() => {
|
|
38868
39010
|
return (props.filters?.filter((f) => f.filterType !== "date" /* Date */)?.map(convertCustomFilter) ?? []).concat(
|
|
38869
39011
|
customReportFilters[props.reportId ?? ""] ?? dashboardCustomFilters[report?.dashboardName ?? ""] ?? []
|
|
38870
39012
|
);
|
|
@@ -38906,7 +39048,7 @@ var Table = ({
|
|
|
38906
39048
|
setLoading(false);
|
|
38907
39049
|
}
|
|
38908
39050
|
};
|
|
38909
|
-
(0,
|
|
39051
|
+
(0, import_react39.useEffect)(() => {
|
|
38910
39052
|
if (props.reportId === void 0 || props.reportId === "" || clientLoading) {
|
|
38911
39053
|
return;
|
|
38912
39054
|
}
|
|
@@ -38940,7 +39082,7 @@ var Table = ({
|
|
|
38940
39082
|
clientLoading,
|
|
38941
39083
|
!reports[props.reportId ?? ""]
|
|
38942
39084
|
]);
|
|
38943
|
-
const [page, setPage] = (0,
|
|
39085
|
+
const [page, setPage] = (0, import_react39.useState)(0);
|
|
38944
39086
|
if ("rows" in data && "columns" in data) {
|
|
38945
39087
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
38946
39088
|
QuillTable,
|
|
@@ -39000,28 +39142,27 @@ var Table = ({
|
|
|
39000
39142
|
var Table_default = Table;
|
|
39001
39143
|
|
|
39002
39144
|
// src/SQLEditor.tsx
|
|
39003
|
-
var
|
|
39004
|
-
var
|
|
39005
|
-
var import_react46 = __toESM(require("@monaco-editor/react"), 1);
|
|
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,31 +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,
|
|
42701
|
-
|
|
42839
|
+
const { dashboardConfig } = (0, import_react44.useContext)(DashboardConfigContext);
|
|
42840
|
+
const { tenants, flags } = (0, import_react44.useContext)(TenantContext);
|
|
42841
|
+
const report = (0, import_react44.useMemo)(() => {
|
|
42842
|
+
const resolvedReport = reportId && !tempReport ? allReportsById[reportId] : tempReport;
|
|
42843
|
+
return resolvedReport;
|
|
42702
42844
|
}, [reportId, tempReport, allReportsById]);
|
|
42703
|
-
const [windowWidth, setWindowWidth] = (0,
|
|
42704
|
-
const [rows, setRows] = (0,
|
|
42705
|
-
const [itemQuery, setItemQuery] = (0,
|
|
42706
|
-
const [rowCount, setRowCount] = (0,
|
|
42707
|
-
const [maxPage, setMaxPage] = (0,
|
|
42708
|
-
const [isLoading, setIsLoading] = (0,
|
|
42709
|
-
const [rowCountIsLoading, setRowCountIsLoading] = (0,
|
|
42710
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
42711
|
-
const
|
|
42712
|
-
const [
|
|
42713
|
-
const
|
|
42714
|
-
const
|
|
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);
|
|
42715
42858
|
const processColumns = (columns2) => {
|
|
42716
42859
|
if (schemaData.schemaWithCustomFields) {
|
|
42717
42860
|
const newProcessedColumns = columns2?.map((col) => {
|
|
@@ -42741,16 +42884,16 @@ function ChartBuilder({
|
|
|
42741
42884
|
}
|
|
42742
42885
|
return columns2;
|
|
42743
42886
|
};
|
|
42744
|
-
const [processedColumns, setProcessedColumns] = (0,
|
|
42887
|
+
const [processedColumns, setProcessedColumns] = (0, import_react44.useState)(
|
|
42745
42888
|
processColumns(report?.columnInternal ?? [])
|
|
42746
42889
|
);
|
|
42747
|
-
const [currentPage, setCurrentPage] = (0,
|
|
42748
|
-
const parentRef = (0,
|
|
42749
|
-
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);
|
|
42750
42893
|
const modalPadding = 20;
|
|
42751
42894
|
const deleteButtonMargin = -12;
|
|
42752
|
-
const { dashboardFilters } = (0,
|
|
42753
|
-
const specificDashboardFilters = (0,
|
|
42895
|
+
const { dashboardFilters } = (0, import_react44.useContext)(DashboardFiltersContext);
|
|
42896
|
+
const specificDashboardFilters = (0, import_react44.useMemo)(() => {
|
|
42754
42897
|
return Object.values(
|
|
42755
42898
|
dashboardFilters[report?.dashboardName ?? ""] ?? {}
|
|
42756
42899
|
).map((f) => f.filter);
|
|
@@ -42768,7 +42911,7 @@ function ChartBuilder({
|
|
|
42768
42911
|
setFilterIssues([]);
|
|
42769
42912
|
}
|
|
42770
42913
|
};
|
|
42771
|
-
(0,
|
|
42914
|
+
(0, import_react44.useEffect)(() => {
|
|
42772
42915
|
const handleResize = () => {
|
|
42773
42916
|
setWindowWidth(window.innerWidth);
|
|
42774
42917
|
if (inputRef.current && selectRef.current) {
|
|
@@ -42779,10 +42922,10 @@ function ChartBuilder({
|
|
|
42779
42922
|
const spaceBetween = selectSize.left - inputSize.right;
|
|
42780
42923
|
const gap = showDash ? (spaceBetween - selectWidth) / 2 : spaceBetween;
|
|
42781
42924
|
const width = inputSize.width + 2 * gap + 2 * selectWidth;
|
|
42782
|
-
setPivotCardWidth(width);
|
|
42925
|
+
setPivotCardWidth(Math.max(width, MIN_FORM_WIDTH));
|
|
42783
42926
|
const deleteSize = deleteRef.current?.getBoundingClientRect();
|
|
42784
42927
|
const deleteWidth = deleteSize?.width ?? 0;
|
|
42785
|
-
setFormWidth(width + deleteWidth);
|
|
42928
|
+
setFormWidth(Math.max(width + deleteWidth, MIN_FORM_WIDTH));
|
|
42786
42929
|
}
|
|
42787
42930
|
};
|
|
42788
42931
|
handleResize();
|
|
@@ -42791,17 +42934,17 @@ function ChartBuilder({
|
|
|
42791
42934
|
window.removeEventListener("resize", handleResize);
|
|
42792
42935
|
};
|
|
42793
42936
|
}, [isOpen]);
|
|
42794
|
-
const [dashboardOptions, setDashboardOptions] = (0,
|
|
42937
|
+
const [dashboardOptions, setDashboardOptions] = (0, import_react44.useState)([]);
|
|
42795
42938
|
const {
|
|
42796
42939
|
reportFilters,
|
|
42797
42940
|
loadFiltersForReport,
|
|
42798
42941
|
reportFiltersDispatch,
|
|
42799
42942
|
abortLoadingFilters
|
|
42800
|
-
} = (0,
|
|
42801
|
-
const { reportsDispatch } = (0,
|
|
42802
|
-
const initialFilters = (0,
|
|
42803
|
-
const [reportFiltersLoaded, setReportFiltersLoaded] = (0,
|
|
42804
|
-
(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)(() => {
|
|
42805
42948
|
if (!reportFilters[report?.id ?? TEMP_REPORT_ID]) {
|
|
42806
42949
|
loadFiltersForReport(
|
|
42807
42950
|
report?.id ?? TEMP_REPORT_ID,
|
|
@@ -42829,25 +42972,25 @@ function ChartBuilder({
|
|
|
42829
42972
|
}
|
|
42830
42973
|
};
|
|
42831
42974
|
}, []);
|
|
42832
|
-
const currentDashboardFilters = (0,
|
|
42975
|
+
const currentDashboardFilters = (0, import_react44.useMemo)(() => {
|
|
42833
42976
|
return Object.values(reportFilters[report?.id ?? TEMP_REPORT_ID] ?? {}).map(
|
|
42834
42977
|
(f) => f.filter
|
|
42835
42978
|
);
|
|
42836
42979
|
}, [reportFilters, report?.id]);
|
|
42837
|
-
const [showFilterModal, setShowFilterModal] = (0,
|
|
42838
|
-
const [filterIssues, setFilterIssues] = (0,
|
|
42839
|
-
const [showPivotPopover, setShowPivotPopover] = (0,
|
|
42840
|
-
const [isEdittingPivot, setIsEdittingPivot] = (0,
|
|
42841
|
-
const [selectedPivotIndex, setSelectedPivotIndex] = (0,
|
|
42842
|
-
const [tableName, setTableName] = (0,
|
|
42843
|
-
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)(
|
|
42844
42987
|
report ? !!report.includeCustomFields : !!client?.featureFlags?.customFieldsEnabled
|
|
42845
42988
|
);
|
|
42846
42989
|
const selectedTable = schemaData.schema?.find(
|
|
42847
42990
|
(t) => t.displayName === tableName
|
|
42848
42991
|
);
|
|
42849
|
-
const [pivotPopUpTitle, setPivotPopUpTitle] = (0,
|
|
42850
|
-
const [pivotError, setPivotError] = (0,
|
|
42992
|
+
const [pivotPopUpTitle, setPivotPopUpTitle] = (0, import_react44.useState)("Add pivot");
|
|
42993
|
+
const [pivotError, setPivotError] = (0, import_react44.useState)(void 0);
|
|
42851
42994
|
const pivotData = report?.pivotRows && report?.pivotColumns ? {
|
|
42852
42995
|
rows: report.pivotRows,
|
|
42853
42996
|
columns: report.pivotColumns,
|
|
@@ -42858,19 +43001,19 @@ function ChartBuilder({
|
|
|
42858
43001
|
const columns = report?.columnInternal ?? [];
|
|
42859
43002
|
const destinationDashboardName = report?.dashboardName || destinationDashboard;
|
|
42860
43003
|
const query = report?.queryString;
|
|
42861
|
-
const [loadingFormData, setLoadingFormData] = (0,
|
|
42862
|
-
const [triggeredEditChart, setTriggeredEditChart] = (0,
|
|
42863
|
-
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)(
|
|
42864
43007
|
report?.pivot ? [report.pivot] : cp
|
|
42865
43008
|
);
|
|
42866
|
-
const [recommendedPivots, setRecommendedPivots] = (0,
|
|
42867
|
-
const [pivotRowField, setPivotRowField] = (0,
|
|
43009
|
+
const [recommendedPivots, setRecommendedPivots] = (0, import_react44.useState)(rp);
|
|
43010
|
+
const [pivotRowField, setPivotRowField] = (0, import_react44.useState)(
|
|
42868
43011
|
report?.pivot?.rowField
|
|
42869
43012
|
);
|
|
42870
|
-
const [pivotColumnField, setPivotColumnField] = (0,
|
|
43013
|
+
const [pivotColumnField, setPivotColumnField] = (0, import_react44.useState)(
|
|
42871
43014
|
report?.pivot?.columnField
|
|
42872
43015
|
);
|
|
42873
|
-
const [pivotAggregations, setPivotAggregations] = (0,
|
|
43016
|
+
const [pivotAggregations, setPivotAggregations] = (0, import_react44.useState)(
|
|
42874
43017
|
report?.pivot?.aggregations ?? [
|
|
42875
43018
|
{
|
|
42876
43019
|
valueField: report?.pivot?.valueField,
|
|
@@ -42879,10 +43022,10 @@ function ChartBuilder({
|
|
|
42879
43022
|
}
|
|
42880
43023
|
]
|
|
42881
43024
|
);
|
|
42882
|
-
const [pivotLimit, setPivotLimit] = (0,
|
|
43025
|
+
const [pivotLimit, setPivotLimit] = (0, import_react44.useState)(
|
|
42883
43026
|
report?.pivot?.rowLimit
|
|
42884
43027
|
);
|
|
42885
|
-
const [pivotSort, setPivotSort] = (0,
|
|
43028
|
+
const [pivotSort, setPivotSort] = (0, import_react44.useState)(
|
|
42886
43029
|
report?.pivot?.sort && report?.pivot?.sortDirection && report?.pivot?.sortField ? {
|
|
42887
43030
|
sortField: report.pivot.sortField,
|
|
42888
43031
|
sortDirection: report.pivot.sortDirection
|
|
@@ -42895,27 +43038,28 @@ function ChartBuilder({
|
|
|
42895
43038
|
rowsPerRequest: report?.chartType === "table" ? 50 : 500
|
|
42896
43039
|
}
|
|
42897
43040
|
};
|
|
42898
|
-
const [currentProcessing, setCurrentProcessing] = (0,
|
|
42899
|
-
const [customTenantAccess, setCustomTenantAccess] = (0,
|
|
43041
|
+
const [currentProcessing, setCurrentProcessing] = (0, import_react44.useState)(baseProcessing);
|
|
43042
|
+
const [customTenantAccess, setCustomTenantAccess] = (0, import_react44.useState)(
|
|
42900
43043
|
report?.flags === null ? false : !!Object.values(report?.flags ?? {}).length
|
|
42901
43044
|
);
|
|
42902
|
-
const [dateFieldOptions, setDateFieldOptions] = (0,
|
|
42903
|
-
const [allTables, setAllTables] = (0,
|
|
42904
|
-
const [customFieldTableRef, setCustomFieldTableRef] = (0,
|
|
42905
|
-
const [referencedColumns, setReferencedColumns] = (0,
|
|
42906
|
-
const [referencedColumnsWithoutStar, setReferencedColumnsWithoutStar] = (0,
|
|
42907
|
-
const [
|
|
42908
|
-
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)(() => {
|
|
42909
43053
|
return Object.fromEntries(
|
|
42910
43054
|
Object.entries(filterMap).filter(
|
|
42911
43055
|
(f) => f[1].table !== void 0 && f[1].field !== void 0
|
|
42912
43056
|
)
|
|
42913
43057
|
);
|
|
42914
43058
|
}, [filterMap]);
|
|
42915
|
-
const validFilter = (0,
|
|
43059
|
+
const validFilter = (0, import_react44.useMemo)(() => {
|
|
42916
43060
|
return specificDashboardFilters.reduce(
|
|
42917
43061
|
(acc, filter) => {
|
|
42918
|
-
if (filter.filterType === "date_range" || filter.filterType === "tenant") {
|
|
43062
|
+
if (filter.filterType === "date_range" || filter.filterType === "tenant" || !referencedTablesLoaded) {
|
|
42919
43063
|
acc[filter.label] = true;
|
|
42920
43064
|
return acc;
|
|
42921
43065
|
}
|
|
@@ -42930,8 +43074,8 @@ function ChartBuilder({
|
|
|
42930
43074
|
},
|
|
42931
43075
|
{}
|
|
42932
43076
|
);
|
|
42933
|
-
}, [specificDashboardFilters, filterMap, allTables]);
|
|
42934
|
-
const [formFlags, setFormFlags] = (0,
|
|
43077
|
+
}, [specificDashboardFilters, filterMap, allTables, referencedTablesLoaded]);
|
|
43078
|
+
const [formFlags, setFormFlags] = (0, import_react44.useState)(
|
|
42935
43079
|
report?.flags ? Object.fromEntries(
|
|
42936
43080
|
Object.entries(report.flags).map(([key, value]) => {
|
|
42937
43081
|
if (value === ALL_TENANTS) {
|
|
@@ -42948,7 +43092,7 @@ function ChartBuilder({
|
|
|
42948
43092
|
})
|
|
42949
43093
|
) : void 0
|
|
42950
43094
|
);
|
|
42951
|
-
const [defaultDateField, setDefaultDateField] = (0,
|
|
43095
|
+
const [defaultDateField, setDefaultDateField] = (0, import_react44.useState)({
|
|
42952
43096
|
table: dateFieldOptions[0]?.name || "",
|
|
42953
43097
|
field: dateFieldOptions[0]?.columns[0]?.field || ""
|
|
42954
43098
|
});
|
|
@@ -43047,23 +43191,40 @@ function ChartBuilder({
|
|
|
43047
43191
|
return result;
|
|
43048
43192
|
};
|
|
43049
43193
|
const getReferencedTables = async (client2, dbTables, sqlQuery, reportBuilderState2, skipStar) => {
|
|
43050
|
-
const
|
|
43051
|
-
|
|
43052
|
-
|
|
43053
|
-
|
|
43054
|
-
|
|
43055
|
-
|
|
43056
|
-
|
|
43057
|
-
|
|
43058
|
-
|
|
43059
|
-
|
|
43060
|
-
|
|
43194
|
+
const metadata = reportBuilderState2 ? {
|
|
43195
|
+
reportBuilderState: reportBuilderState2,
|
|
43196
|
+
clientId: client2.clientId,
|
|
43197
|
+
useNewNodeSql: true
|
|
43198
|
+
} : {
|
|
43199
|
+
query: sqlQuery,
|
|
43200
|
+
clientId: client2.clientId,
|
|
43201
|
+
useNewNodeSql: true
|
|
43202
|
+
};
|
|
43203
|
+
try {
|
|
43204
|
+
const { data: resp } = await quillFetchWithToken({
|
|
43205
|
+
client: client2,
|
|
43206
|
+
task: "astify",
|
|
43207
|
+
metadata
|
|
43208
|
+
});
|
|
43209
|
+
if (resp.success === false) {
|
|
43210
|
+
return getTablesHelper(getSelectFromAST({}), dbTables, skipStar);
|
|
43061
43211
|
}
|
|
43062
|
-
|
|
43063
|
-
|
|
43064
|
-
|
|
43212
|
+
return getTablesHelper(getSelectFromAST(resp.ast), dbTables, skipStar);
|
|
43213
|
+
} catch (error) {
|
|
43214
|
+
console.error(
|
|
43215
|
+
"[ChartBuilder#getReferencedTables] Failed to fetch referenced tables",
|
|
43216
|
+
{
|
|
43217
|
+
error,
|
|
43218
|
+
hasReportBuilderState: !!reportBuilderState2,
|
|
43219
|
+
hasSqlQuery: !!sqlQuery,
|
|
43220
|
+
skipStar: !!skipStar
|
|
43221
|
+
}
|
|
43222
|
+
);
|
|
43223
|
+
return {
|
|
43224
|
+
referencedTablesAndColumns: [],
|
|
43225
|
+
dateFields: []
|
|
43226
|
+
};
|
|
43065
43227
|
}
|
|
43066
|
-
return getTablesHelper(getSelectFromAST(resp.ast), dbTables, skipStar);
|
|
43067
43228
|
};
|
|
43068
43229
|
const getCurrentSection = () => {
|
|
43069
43230
|
let id2 = report?.id ?? "";
|
|
@@ -43110,15 +43271,15 @@ function ChartBuilder({
|
|
|
43110
43271
|
}
|
|
43111
43272
|
return chartBuilderData;
|
|
43112
43273
|
};
|
|
43113
|
-
const [formData, setFormData] = (0,
|
|
43274
|
+
const [formData, setFormData] = (0, import_react44.useState)(
|
|
43114
43275
|
formFormDataFromReport(report, destinationSection ?? getCurrentSection())
|
|
43115
43276
|
);
|
|
43116
|
-
const reportCustomFields = (0,
|
|
43277
|
+
const reportCustomFields = (0, import_react44.useMemo)(() => {
|
|
43117
43278
|
return report?.columnsWithCustomFields?.filter(
|
|
43118
43279
|
(col) => !report?.columns?.some((c) => col.field === c.field)
|
|
43119
43280
|
) ?? [];
|
|
43120
43281
|
}, [report?.columnsWithCustomFields, report?.columns]);
|
|
43121
|
-
const referenceLineQueryResults = (0,
|
|
43282
|
+
const referenceLineQueryResults = (0, import_react44.useMemo)(() => {
|
|
43122
43283
|
return formData?.referenceLines?.map((line) => {
|
|
43123
43284
|
if (line.label === REFERENCE_LINE) {
|
|
43124
43285
|
return [Number(line.y1) || 0, Number(line.y2) || 0];
|
|
@@ -43132,10 +43293,10 @@ function ChartBuilder({
|
|
|
43132
43293
|
);
|
|
43133
43294
|
});
|
|
43134
43295
|
}, [formData?.referenceLines]);
|
|
43135
|
-
const currentDashboard = (0,
|
|
43296
|
+
const currentDashboard = (0, import_react44.useMemo)(() => {
|
|
43136
43297
|
return dashboardConfig[formData.dashboardName ?? report?.dashboardName ?? ""]?.config;
|
|
43137
43298
|
}, [dashboardConfig, formData.dashboardName, report?.dashboardName]);
|
|
43138
|
-
const currentDashboardTenants = (0,
|
|
43299
|
+
const currentDashboardTenants = (0, import_react44.useMemo)(() => {
|
|
43139
43300
|
return currentDashboard?.tenantKeys?.map(
|
|
43140
43301
|
(tenantKey) => client?.allTenantTypes?.find(
|
|
43141
43302
|
(t) => t.tenantField === tenantKey
|
|
@@ -43143,7 +43304,7 @@ function ChartBuilder({
|
|
|
43143
43304
|
) ?? [];
|
|
43144
43305
|
}, [client?.allTenantTypes, currentDashboard?.tenantKeys]);
|
|
43145
43306
|
const dashboardOwner = currentDashboardTenants?.[0];
|
|
43146
|
-
const currentTenantAsFormFlags = (0,
|
|
43307
|
+
const currentTenantAsFormFlags = (0, import_react44.useMemo)(() => {
|
|
43147
43308
|
if (!tenants || !tenants.length) {
|
|
43148
43309
|
return void 0;
|
|
43149
43310
|
}
|
|
@@ -43154,7 +43315,7 @@ function ChartBuilder({
|
|
|
43154
43315
|
const tenantIds = typeof tenants[0] !== "object" ? tenants : tenants[0]?.tenantIds;
|
|
43155
43316
|
return { [tenantField]: tenantIds };
|
|
43156
43317
|
}, [tenants, dashboardOwner]);
|
|
43157
|
-
const invalidColumns = (0,
|
|
43318
|
+
const invalidColumns = (0, import_react44.useMemo)(() => {
|
|
43158
43319
|
if (!rows || !rows.length) {
|
|
43159
43320
|
return [];
|
|
43160
43321
|
}
|
|
@@ -43164,7 +43325,7 @@ function ChartBuilder({
|
|
|
43164
43325
|
const columnsObservedInRows = rows[0] ? Object.keys(rows[0]) : [];
|
|
43165
43326
|
return columns.filter((col) => !columnsObservedInRows.includes(col.field));
|
|
43166
43327
|
}, [rows]);
|
|
43167
|
-
const [chartTypes, setChartTypes] = (0,
|
|
43328
|
+
const [chartTypes, setChartTypes] = (0, import_react44.useState)(
|
|
43168
43329
|
(() => {
|
|
43169
43330
|
const data = formFormDataFromReport(
|
|
43170
43331
|
report,
|
|
@@ -43176,7 +43337,7 @@ function ChartBuilder({
|
|
|
43176
43337
|
);
|
|
43177
43338
|
})()
|
|
43178
43339
|
);
|
|
43179
|
-
const reportContainsCustomFields = (0,
|
|
43340
|
+
const reportContainsCustomFields = (0, import_react44.useMemo)(() => {
|
|
43180
43341
|
const customFieldsMap = schemaData.customFields;
|
|
43181
43342
|
const reportQueryContainsCustomFields = allTables.some((table) => {
|
|
43182
43343
|
const tableColumns = referencedColumnsWithoutStar[table] ?? [];
|
|
@@ -43187,7 +43348,7 @@ function ChartBuilder({
|
|
|
43187
43348
|
});
|
|
43188
43349
|
return reportQueryContainsCustomFields;
|
|
43189
43350
|
}, [allTables, referencedColumnsWithoutStar]);
|
|
43190
|
-
const chartBuilderFormDataContainsCustomFields = (0,
|
|
43351
|
+
const chartBuilderFormDataContainsCustomFields = (0, import_react44.useMemo)(() => {
|
|
43191
43352
|
const customFields = allTables.map((table) => schemaData.customFields?.[table] ?? []).flat();
|
|
43192
43353
|
const customFieldsMap = schemaData.customFields;
|
|
43193
43354
|
const pivotContainsCustomFields = customFields.some(
|
|
@@ -43220,25 +43381,25 @@ function ChartBuilder({
|
|
|
43220
43381
|
formData.dateField,
|
|
43221
43382
|
canonicalFilterMap
|
|
43222
43383
|
]);
|
|
43223
|
-
const customFieldsInTabularColumns = (0,
|
|
43384
|
+
const customFieldsInTabularColumns = (0, import_react44.useMemo)(() => {
|
|
43224
43385
|
const customFields = allTables.map((table) => schemaData.customFields?.[table] ?? []).flat();
|
|
43225
43386
|
return formData.columns.some((col) => {
|
|
43226
43387
|
return customFields.some((field) => field.field === col.field);
|
|
43227
43388
|
});
|
|
43228
43389
|
}, [allTables, formData.columns]);
|
|
43229
|
-
const containsCustomFields = (0,
|
|
43390
|
+
const containsCustomFields = (0, import_react44.useMemo)(() => {
|
|
43230
43391
|
return reportContainsCustomFields || customFieldsInTabularColumns || chartBuilderFormDataContainsCustomFields;
|
|
43231
43392
|
}, [
|
|
43232
43393
|
reportContainsCustomFields,
|
|
43233
43394
|
customFieldsInTabularColumns,
|
|
43234
43395
|
chartBuilderFormDataContainsCustomFields
|
|
43235
43396
|
]);
|
|
43236
|
-
(0,
|
|
43397
|
+
(0, import_react44.useEffect)(() => {
|
|
43237
43398
|
if (!loadingFormData && triggeredEditChart) {
|
|
43238
43399
|
editChart();
|
|
43239
43400
|
}
|
|
43240
43401
|
}, [loadingFormData]);
|
|
43241
|
-
(0,
|
|
43402
|
+
(0, import_react44.useEffect)(() => {
|
|
43242
43403
|
async function getFormData() {
|
|
43243
43404
|
if (!client) {
|
|
43244
43405
|
return;
|
|
@@ -43279,6 +43440,7 @@ function ChartBuilder({
|
|
|
43279
43440
|
setLoadingFormData(false);
|
|
43280
43441
|
return;
|
|
43281
43442
|
}
|
|
43443
|
+
setReferencedTablesLoaded(false);
|
|
43282
43444
|
const result = await getReferencedTables(
|
|
43283
43445
|
client,
|
|
43284
43446
|
curSchemaData,
|
|
@@ -43356,18 +43518,19 @@ function ChartBuilder({
|
|
|
43356
43518
|
curFormData.dateField ?? dateField,
|
|
43357
43519
|
tableNames
|
|
43358
43520
|
);
|
|
43521
|
+
setReferencedTablesLoaded(true);
|
|
43359
43522
|
setLoadingFormData(false);
|
|
43360
43523
|
}
|
|
43361
43524
|
getFormData();
|
|
43362
43525
|
}, []);
|
|
43363
|
-
const ranMountQuery = (0,
|
|
43364
|
-
(0,
|
|
43526
|
+
const ranMountQuery = (0, import_react44.useRef)(false);
|
|
43527
|
+
(0, import_react44.useEffect)(() => {
|
|
43365
43528
|
if (runQueryOnMount && reportFiltersLoaded && filtersEnabled && !ranMountQuery.current) {
|
|
43366
43529
|
ranMountQuery.current = true;
|
|
43367
43530
|
handleRunQuery(baseProcessing, currentDashboardFilters);
|
|
43368
43531
|
}
|
|
43369
43532
|
}, [runQueryOnMount, reportFiltersLoaded, filtersEnabled]);
|
|
43370
|
-
const allTenantMap = (0,
|
|
43533
|
+
const allTenantMap = (0, import_react44.useMemo)(() => {
|
|
43371
43534
|
return client?.allTenantTypes?.reduce(
|
|
43372
43535
|
(acc, tenantType) => {
|
|
43373
43536
|
if (tenantType.scope === "database") {
|
|
@@ -43386,15 +43549,15 @@ function ChartBuilder({
|
|
|
43386
43549
|
{}
|
|
43387
43550
|
) ?? {};
|
|
43388
43551
|
}, [client?.allTenantTypes]);
|
|
43389
|
-
const [selectedPivotTable, setSelectedPivotTable] = (0,
|
|
43390
|
-
const pivotCardTable = (0,
|
|
43552
|
+
const [selectedPivotTable, setSelectedPivotTable] = (0, import_react44.useState)(pivotData);
|
|
43553
|
+
const pivotCardTable = (0, import_react44.useMemo)(() => {
|
|
43391
43554
|
return {
|
|
43392
43555
|
pivot: formData.pivot,
|
|
43393
43556
|
rows: selectedPivotTable?.rows ?? [],
|
|
43394
43557
|
columns: selectedPivotTable?.columns ?? []
|
|
43395
43558
|
};
|
|
43396
43559
|
}, [selectedPivotTable, formData.pivot]);
|
|
43397
|
-
const chartData = (0,
|
|
43560
|
+
const chartData = (0, import_react44.useMemo)(() => {
|
|
43398
43561
|
const data = createReportFromForm(
|
|
43399
43562
|
formData,
|
|
43400
43563
|
report ? { ...report, rowCount } : tempReport,
|
|
@@ -43416,7 +43579,7 @@ function ChartBuilder({
|
|
|
43416
43579
|
rowCount,
|
|
43417
43580
|
currentDashboardFilters
|
|
43418
43581
|
]);
|
|
43419
|
-
const xAxisFormatOptions = (0,
|
|
43582
|
+
const xAxisFormatOptions = (0, import_react44.useMemo)(() => {
|
|
43420
43583
|
return chartData?.chartType === "gauge" ? [
|
|
43421
43584
|
{ value: "whole_number", label: "whole number" },
|
|
43422
43585
|
{ value: "two_decimal_places", label: "two decimal places" },
|
|
@@ -43476,7 +43639,7 @@ function ChartBuilder({
|
|
|
43476
43639
|
setSelectedPivotTable(void 0);
|
|
43477
43640
|
}
|
|
43478
43641
|
};
|
|
43479
|
-
const formattedRows = (0,
|
|
43642
|
+
const formattedRows = (0, import_react44.useMemo)(() => {
|
|
43480
43643
|
if (selectedPivotTable && selectedPivotTable.columns && formData.chartType === "table") {
|
|
43481
43644
|
const columns2 = selectedPivotTable.columns;
|
|
43482
43645
|
columns2.forEach((col, index) => {
|
|
@@ -43571,8 +43734,8 @@ function ChartBuilder({
|
|
|
43571
43734
|
handleRunQuery(baseProcessing, updatedFilters);
|
|
43572
43735
|
});
|
|
43573
43736
|
};
|
|
43574
|
-
const filtersEnabledRef = (0,
|
|
43575
|
-
(0,
|
|
43737
|
+
const filtersEnabledRef = (0, import_react44.useRef)(filtersEnabled);
|
|
43738
|
+
(0, import_react44.useEffect)(() => {
|
|
43576
43739
|
if (filtersEnabledRef.current !== filtersEnabled) {
|
|
43577
43740
|
filtersEnabledRef.current = filtersEnabled;
|
|
43578
43741
|
setCurrentPage(0);
|
|
@@ -44053,7 +44216,7 @@ function ChartBuilder({
|
|
|
44053
44216
|
return;
|
|
44054
44217
|
}
|
|
44055
44218
|
let dashboardItemId = reportId ? reportId : void 0;
|
|
44056
|
-
if (report && !isAdmin && formData.template) {
|
|
44219
|
+
if (report && !isAdmin && formData.template && !isEditingMode) {
|
|
44057
44220
|
dashboardItemId = void 0;
|
|
44058
44221
|
}
|
|
44059
44222
|
const newReport = {
|
|
@@ -44134,7 +44297,7 @@ function ChartBuilder({
|
|
|
44134
44297
|
setIsSubmitting(false);
|
|
44135
44298
|
setTriggeredEditChart(false);
|
|
44136
44299
|
};
|
|
44137
|
-
const memoizedTooltipText = (0,
|
|
44300
|
+
const memoizedTooltipText = (0, import_react44.useMemo)(() => {
|
|
44138
44301
|
const getTooltipText = () => {
|
|
44139
44302
|
if (formData.name === "") {
|
|
44140
44303
|
return "Please enter a name for the chart";
|
|
@@ -45315,16 +45478,22 @@ function ChartBuilder({
|
|
|
45315
45478
|
)
|
|
45316
45479
|
}
|
|
45317
45480
|
),
|
|
45318
|
-
(!formData.dateField?.table || !formData.dateField?.field) && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
45319
|
-
|
|
45481
|
+
referencedTablesLoaded && (!formData.dateField?.table || !formData.dateField?.field) && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
45482
|
+
"div",
|
|
45320
45483
|
{
|
|
45321
|
-
|
|
45322
|
-
|
|
45323
|
-
|
|
45324
|
-
|
|
45325
|
-
|
|
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
|
+
)
|
|
45326
45495
|
}
|
|
45327
|
-
)
|
|
45496
|
+
)
|
|
45328
45497
|
] }),
|
|
45329
45498
|
specificDashboardFilters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
45330
45499
|
"div",
|
|
@@ -45395,10 +45564,13 @@ function ChartBuilder({
|
|
|
45395
45564
|
hideEmptyOption: true
|
|
45396
45565
|
}
|
|
45397
45566
|
),
|
|
45398
|
-
!validFilter[filter.label] && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
45567
|
+
referencedTablesLoaded && !validFilter[filter.label] && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
45399
45568
|
"div",
|
|
45400
45569
|
{
|
|
45401
|
-
style: {
|
|
45570
|
+
style: {
|
|
45571
|
+
marginBottom: 8,
|
|
45572
|
+
marginTop: "auto"
|
|
45573
|
+
},
|
|
45402
45574
|
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
45403
45575
|
ExclamationFilledIcon_default,
|
|
45404
45576
|
{
|
|
@@ -45687,21 +45859,6 @@ function DashboardFilterModal({
|
|
|
45687
45859
|
);
|
|
45688
45860
|
}
|
|
45689
45861
|
|
|
45690
|
-
// src/utils/width.ts
|
|
45691
|
-
var updateFirstChildWidth = (containerRef, setState, options = { gap: 0 }) => {
|
|
45692
|
-
if (containerRef.current) {
|
|
45693
|
-
const element = containerRef.current;
|
|
45694
|
-
const totalWidth = element.getBoundingClientRect().width;
|
|
45695
|
-
const gapWidth = options.gap * (element.childElementCount - 1);
|
|
45696
|
-
let siblingsWidth = 0;
|
|
45697
|
-
const children = Array.from(containerRef.current.children);
|
|
45698
|
-
for (let i = 1; i < children.length; i++) {
|
|
45699
|
-
siblingsWidth += children[i].getBoundingClientRect().width;
|
|
45700
|
-
}
|
|
45701
|
-
setState(totalWidth - siblingsWidth - gapWidth);
|
|
45702
|
-
}
|
|
45703
|
-
};
|
|
45704
|
-
|
|
45705
45862
|
// src/SQLEditor.tsx
|
|
45706
45863
|
init_tableProcessing();
|
|
45707
45864
|
init_queryConstructor();
|
|
@@ -46045,7 +46202,7 @@ init_astProcessing();
|
|
|
46045
46202
|
init_constants();
|
|
46046
46203
|
|
|
46047
46204
|
// src/hooks/useLongLoading.tsx
|
|
46048
|
-
var
|
|
46205
|
+
var import_react45 = require("react");
|
|
46049
46206
|
function useLongLoading(isLoading, meta) {
|
|
46050
46207
|
const {
|
|
46051
46208
|
origin,
|
|
@@ -46053,10 +46210,10 @@ function useLongLoading(isLoading, meta) {
|
|
|
46053
46210
|
abnormalLoadTime = 15e3,
|
|
46054
46211
|
loadDescription
|
|
46055
46212
|
} = meta;
|
|
46056
|
-
const [isLongLoading, setIsLongLoading] = (0,
|
|
46057
|
-
const [isAbnormalLoading, setIsAbnormalLoading] = (0,
|
|
46058
|
-
const { eventTracking } = (0,
|
|
46059
|
-
(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)(() => {
|
|
46060
46217
|
let longTimer = null;
|
|
46061
46218
|
let abnormalTimer = null;
|
|
46062
46219
|
if (isLoading) {
|
|
@@ -46218,7 +46375,7 @@ function SQLEditor({
|
|
|
46218
46375
|
onDiscardChanges,
|
|
46219
46376
|
onSaveChanges,
|
|
46220
46377
|
onCloseChartBuilder,
|
|
46221
|
-
isChartBuilderEnabled =
|
|
46378
|
+
isChartBuilderEnabled = true,
|
|
46222
46379
|
isAdminEnabled = false,
|
|
46223
46380
|
chartBuilderOptions,
|
|
46224
46381
|
chartBuilderTitle,
|
|
@@ -46237,67 +46394,70 @@ function SQLEditor({
|
|
|
46237
46394
|
onClickChartElement,
|
|
46238
46395
|
onRequestAddVirtualTable
|
|
46239
46396
|
}) {
|
|
46240
|
-
const
|
|
46241
|
-
const [
|
|
46242
|
-
const
|
|
46243
|
-
const
|
|
46397
|
+
const computedButtonLabel = addToDashboardButtonLabel === "Add to dashboard" ? reportId || report?.id ? "Save changes" : "Add to dashboard" : addToDashboardButtonLabel;
|
|
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);
|
|
46244
46409
|
const { dashboards } = useDashboards();
|
|
46245
46410
|
const {
|
|
46246
46411
|
data,
|
|
46247
46412
|
isLoading: dashboardIsLoading,
|
|
46248
46413
|
reload
|
|
46249
46414
|
} = useDashboardInternal(destinationDashboard);
|
|
46250
|
-
const { getToken, quillFetchWithToken } = (0,
|
|
46251
|
-
const { eventTracking } = (0,
|
|
46415
|
+
const { getToken, quillFetchWithToken } = (0, import_react46.useContext)(FetchContext);
|
|
46416
|
+
const { eventTracking } = (0, import_react46.useContext)(EventTrackingContext);
|
|
46252
46417
|
const { allReportsById } = useAllReports();
|
|
46253
|
-
const destinationDashboardConfig = (0,
|
|
46418
|
+
const destinationDashboardConfig = (0, import_react46.useMemo)(() => {
|
|
46254
46419
|
return dashboards?.find((d) => d.name === destinationDashboard);
|
|
46255
46420
|
}, [dashboards, destinationDashboard]);
|
|
46256
|
-
const [query, setQuery] = (0,
|
|
46257
|
-
const [rows, setRows] = (0,
|
|
46258
|
-
const [columns, setColumns] = (0,
|
|
46259
|
-
const [schemaData] = (0,
|
|
46260
|
-
const { dashboardFilters } = (0,
|
|
46261
|
-
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)(() => {
|
|
46262
46427
|
return Object.values(
|
|
46263
46428
|
dashboardFilters[report?.dashboardName ?? destinationDashboard ?? ""] ?? {}
|
|
46264
46429
|
).map((f) => f.filter);
|
|
46265
46430
|
}, [dashboardFilters, destinationDashboard]);
|
|
46266
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
46267
|
-
const [sqlResponseLoading, setSqlResponseLoading] = (0,
|
|
46431
|
+
const [errorMessage, setErrorMessage] = (0, import_react46.useState)("");
|
|
46432
|
+
const [sqlResponseLoading, setSqlResponseLoading] = (0, import_react46.useState)(false);
|
|
46268
46433
|
useLongLoading(sqlResponseLoading, {
|
|
46269
46434
|
origin: "SQLEditor",
|
|
46270
46435
|
loadDescription: "Loading SQL response"
|
|
46271
46436
|
});
|
|
46272
|
-
const [sqlQueryLoading, setSqlQueryLoading] = (0,
|
|
46437
|
+
const [sqlQueryLoading, setSqlQueryLoading] = (0, import_react46.useState)(false);
|
|
46273
46438
|
useLongLoading(sqlQueryLoading, {
|
|
46274
46439
|
origin: "SQLEditor",
|
|
46275
46440
|
loadDescription: "Loading SQL query"
|
|
46276
46441
|
});
|
|
46277
|
-
const [isChartBuilderOpen, setIsChartBuilderOpen] = (0,
|
|
46278
|
-
const [displayTable, setDisplayTable] = (0,
|
|
46279
|
-
const [formattedRows, setFormattedRows] = (0,
|
|
46280
|
-
const
|
|
46281
|
-
const
|
|
46282
|
-
const [
|
|
46283
|
-
const [
|
|
46284
|
-
const [
|
|
46285
|
-
const [
|
|
46286
|
-
const [
|
|
46287
|
-
const [maxPage, setMaxPage] = (0, import_react45.useState)(1);
|
|
46288
|
-
const [tableSearchQuery, setTableSearchQuery] = (0, import_react45.useState)("");
|
|
46289
|
-
const [lastSuccessfulQuery, setLastSuccessfulQuery] = (0, import_react45.useState)("");
|
|
46290
|
-
const [isSaveQueryModalOpen, setIsSaveQueryModalOpen] = (0, import_react45.useState)(false);
|
|
46291
|
-
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)({
|
|
46292
46452
|
...EMPTY_INTERNAL_REPORT,
|
|
46293
46453
|
...report
|
|
46294
46454
|
});
|
|
46295
|
-
const tableRef = (0,
|
|
46296
|
-
const [cachedHeight, setCachedHeight] = (0,
|
|
46455
|
+
const tableRef = (0, import_react46.useRef)(null);
|
|
46456
|
+
const [cachedHeight, setCachedHeight] = (0, import_react46.useState)(0);
|
|
46297
46457
|
const DEFAULT_ROWS_PER_PAGE = 5;
|
|
46298
46458
|
const ROW_HEIGHT = 37;
|
|
46299
46459
|
const TABLE_TAB_HEIGHT = 75;
|
|
46300
|
-
const filteredSchema = (0,
|
|
46460
|
+
const filteredSchema = (0, import_react46.useMemo)(() => {
|
|
46301
46461
|
return schemaData.schemaWithCustomFields?.filter((table) => {
|
|
46302
46462
|
return destinationDashboardConfig?.tenantKeys?.[0] === SINGLE_TENANT || !table.ownerTenantFields || table.ownerTenantFields?.length === 0 || table.ownerTenantFields?.includes(
|
|
46303
46463
|
destinationDashboardConfig?.tenantKeys?.[0] ?? ""
|
|
@@ -46307,17 +46467,17 @@ function SQLEditor({
|
|
|
46307
46467
|
schemaData.schemaWithCustomFields,
|
|
46308
46468
|
destinationDashboardConfig?.tenantKeys
|
|
46309
46469
|
]);
|
|
46310
|
-
(0,
|
|
46470
|
+
(0, import_react46.useEffect)(() => {
|
|
46311
46471
|
if (tableRef.current) {
|
|
46312
46472
|
setCachedHeight(tableRef.current.clientHeight);
|
|
46313
46473
|
}
|
|
46314
46474
|
}, [tableRef.current?.clientHeight]);
|
|
46315
|
-
(0,
|
|
46475
|
+
(0, import_react46.useEffect)(() => {
|
|
46316
46476
|
if (!data && !dashboardIsLoading) {
|
|
46317
46477
|
reload();
|
|
46318
46478
|
}
|
|
46319
46479
|
}, [data, dashboardIsLoading]);
|
|
46320
|
-
(0,
|
|
46480
|
+
(0, import_react46.useEffect)(() => {
|
|
46321
46481
|
const loadReport = async () => {
|
|
46322
46482
|
let reportToLoad;
|
|
46323
46483
|
if (!client) {
|
|
@@ -46370,9 +46530,9 @@ function SQLEditor({
|
|
|
46370
46530
|
rowsPerPage * 10
|
|
46371
46531
|
)
|
|
46372
46532
|
};
|
|
46373
|
-
const [currentPage, setCurrentPage] = (0,
|
|
46374
|
-
const [currentSort, setCurrentSort] = (0,
|
|
46375
|
-
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)(() => {
|
|
46376
46536
|
return {
|
|
46377
46537
|
page: {
|
|
46378
46538
|
currentPage,
|
|
@@ -46385,41 +46545,26 @@ function SQLEditor({
|
|
|
46385
46545
|
sort: currentSort
|
|
46386
46546
|
};
|
|
46387
46547
|
}, [currentPage, rowsPerPage, currentSort]);
|
|
46388
|
-
const displayedTableData = (0,
|
|
46548
|
+
const displayedTableData = (0, import_react46.useMemo)(() => {
|
|
46389
46549
|
return filteredSchema?.filter((table) => {
|
|
46390
46550
|
return table.name?.toLowerCase()?.includes(tableSearchQuery.toLowerCase().trim()) || table.columns.some(
|
|
46391
46551
|
(col) => col.field?.toLowerCase()?.includes(tableSearchQuery.toLowerCase().trim())
|
|
46392
46552
|
);
|
|
46393
46553
|
}) ?? [];
|
|
46394
46554
|
}, [tableSearchQuery, schemaData.schemaWithCustomFields]);
|
|
46395
|
-
(0,
|
|
46396
|
-
function handleResize() {
|
|
46397
|
-
updateFirstChildWidth(formRef, setSearchBarWidth, { gap: 12 });
|
|
46398
|
-
updateFirstChildWidth(sidebarRef, setFilterBarWidth, { gap: 12 });
|
|
46399
|
-
setShowSearchBar(true);
|
|
46400
|
-
}
|
|
46401
|
-
(async () => {
|
|
46402
|
-
await new Promise((resolve) => setTimeout(resolve, 30));
|
|
46403
|
-
handleResize();
|
|
46404
|
-
})();
|
|
46405
|
-
window.addEventListener("resize", handleResize);
|
|
46406
|
-
return () => {
|
|
46407
|
-
window.removeEventListener("resize", handleResize);
|
|
46408
|
-
};
|
|
46409
|
-
}, []);
|
|
46410
|
-
(0, import_react45.useEffect)(() => {
|
|
46555
|
+
(0, import_react46.useEffect)(() => {
|
|
46411
46556
|
if (client) {
|
|
46412
46557
|
setRows([]);
|
|
46413
46558
|
setColumns([]);
|
|
46414
46559
|
setDisplayTable(false);
|
|
46415
46560
|
}
|
|
46416
46561
|
}, [client?.publicKey]);
|
|
46417
|
-
(0,
|
|
46562
|
+
(0, import_react46.useEffect)(() => {
|
|
46418
46563
|
if (isChartBuilderOpen === false) {
|
|
46419
46564
|
onCloseChartBuilder && onCloseChartBuilder();
|
|
46420
46565
|
}
|
|
46421
46566
|
}, [isChartBuilderOpen]);
|
|
46422
|
-
const handleRunSqlPrompt = (0,
|
|
46567
|
+
const handleRunSqlPrompt = (0, import_react46.useCallback)(async () => {
|
|
46423
46568
|
if (!client || sqlResponseLoading) {
|
|
46424
46569
|
return;
|
|
46425
46570
|
}
|
|
@@ -46438,7 +46583,7 @@ function SQLEditor({
|
|
|
46438
46583
|
setQuery(resp.message);
|
|
46439
46584
|
setSqlResponseLoading(false);
|
|
46440
46585
|
}, [sqlPrompt, sqlResponseLoading]);
|
|
46441
|
-
const debounceRunSqlPrompt = (0,
|
|
46586
|
+
const debounceRunSqlPrompt = (0, import_react46.useCallback)(
|
|
46442
46587
|
createDebounce(handleRunSqlPrompt, 500),
|
|
46443
46588
|
[handleRunSqlPrompt]
|
|
46444
46589
|
);
|
|
@@ -46560,25 +46705,35 @@ function SQLEditor({
|
|
|
46560
46705
|
onChangeFields(tableInfo.columns);
|
|
46561
46706
|
}
|
|
46562
46707
|
const formData = report ? report : createInitialFormData(tableInfo.columns);
|
|
46563
|
-
const
|
|
46708
|
+
const baseReport = reportId ? tempReport : {
|
|
46564
46709
|
...tempReport,
|
|
46565
|
-
...formData
|
|
46710
|
+
...formData
|
|
46711
|
+
};
|
|
46712
|
+
const newReport = {
|
|
46713
|
+
...baseReport,
|
|
46714
|
+
// In edit mode, preserve critical fields that shouldn't be overwritten
|
|
46715
|
+
...reportId && tempReport.name ? { name: tempReport.name } : {},
|
|
46566
46716
|
itemQuery: tableInfo.itemQuery,
|
|
46567
46717
|
rowCount: tableInfo.rowCount ?? tableInfo.rows.length,
|
|
46568
46718
|
rows: tempRows,
|
|
46569
46719
|
columns: tableInfo.columns,
|
|
46570
|
-
referencedTables: tableInfo.referencedTables
|
|
46720
|
+
referencedTables: tableInfo.referencedTables,
|
|
46721
|
+
queryString: query ?? tempReport.queryString ?? ""
|
|
46571
46722
|
};
|
|
46572
|
-
|
|
46573
|
-
|
|
46574
|
-
|
|
46575
|
-
|
|
46576
|
-
|
|
46577
|
-
|
|
46578
|
-
|
|
46579
|
-
|
|
46580
|
-
|
|
46581
|
-
|
|
46723
|
+
if (reportId) {
|
|
46724
|
+
setTempReport(newReport);
|
|
46725
|
+
} else {
|
|
46726
|
+
const cleaned = await cleanDashboardItem({
|
|
46727
|
+
item: newReport,
|
|
46728
|
+
dashboardFilters: newReport.filtersApplied,
|
|
46729
|
+
client,
|
|
46730
|
+
customFields: schemaData.customFields,
|
|
46731
|
+
getToken,
|
|
46732
|
+
tenants,
|
|
46733
|
+
eventTracking
|
|
46734
|
+
});
|
|
46735
|
+
setTempReport(cleaned);
|
|
46736
|
+
}
|
|
46582
46737
|
setLastSuccessfulQuery(query);
|
|
46583
46738
|
} catch (e) {
|
|
46584
46739
|
eventTracking?.logError?.({
|
|
@@ -46665,7 +46820,7 @@ function SQLEditor({
|
|
|
46665
46820
|
}
|
|
46666
46821
|
return getTablesHelper(getSelectFromAST(resp.ast), dbTables, skipStar);
|
|
46667
46822
|
};
|
|
46668
|
-
(0,
|
|
46823
|
+
(0, import_react46.useEffect)(() => {
|
|
46669
46824
|
if (onChangeQuery) {
|
|
46670
46825
|
onChangeQuery(query || "");
|
|
46671
46826
|
}
|
|
@@ -46722,7 +46877,11 @@ function SQLEditor({
|
|
|
46722
46877
|
style: {
|
|
46723
46878
|
paddingTop: 16,
|
|
46724
46879
|
paddingLeft: "20px",
|
|
46725
|
-
paddingRight: "30px"
|
|
46880
|
+
paddingRight: "30px",
|
|
46881
|
+
width: "100%",
|
|
46882
|
+
maxWidth: 350,
|
|
46883
|
+
minWidth: 250,
|
|
46884
|
+
boxSizing: "border-box"
|
|
46726
46885
|
},
|
|
46727
46886
|
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46728
46887
|
TextInputComponent,
|
|
@@ -46733,7 +46892,7 @@ function SQLEditor({
|
|
|
46733
46892
|
},
|
|
46734
46893
|
value: tableSearchQuery,
|
|
46735
46894
|
id: "edit-name",
|
|
46736
|
-
width:
|
|
46895
|
+
width: "100%"
|
|
46737
46896
|
}
|
|
46738
46897
|
)
|
|
46739
46898
|
}
|
|
@@ -46753,7 +46912,7 @@ function SQLEditor({
|
|
|
46753
46912
|
]
|
|
46754
46913
|
}
|
|
46755
46914
|
),
|
|
46756
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.
|
|
46915
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46757
46916
|
"div",
|
|
46758
46917
|
{
|
|
46759
46918
|
style: {
|
|
@@ -46765,404 +46924,385 @@ function SQLEditor({
|
|
|
46765
46924
|
height: "100%",
|
|
46766
46925
|
overflowX: "hidden"
|
|
46767
46926
|
},
|
|
46768
|
-
children:
|
|
46769
|
-
|
|
46770
|
-
|
|
46771
|
-
{
|
|
46772
|
-
|
|
46773
|
-
|
|
46774
|
-
|
|
46775
|
-
|
|
46776
|
-
|
|
46777
|
-
|
|
46778
|
-
|
|
46779
|
-
|
|
46780
|
-
|
|
46781
|
-
|
|
46782
|
-
|
|
46783
|
-
|
|
46784
|
-
|
|
46785
|
-
|
|
46786
|
-
|
|
46787
|
-
|
|
46788
|
-
|
|
46789
|
-
|
|
46790
|
-
|
|
46791
|
-
|
|
46792
|
-
|
|
46793
|
-
|
|
46794
|
-
|
|
46795
|
-
|
|
46796
|
-
|
|
46797
|
-
|
|
46798
|
-
|
|
46799
|
-
|
|
46800
|
-
|
|
46801
|
-
|
|
46802
|
-
id: "ai-search",
|
|
46803
|
-
value: sqlPrompt,
|
|
46804
|
-
width: searchBarWidth,
|
|
46805
|
-
onChange: (e) => setSqlPrompt(e.target.value),
|
|
46806
|
-
placeholder: "Ask a question..."
|
|
46807
|
-
}
|
|
46808
|
-
),
|
|
46809
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46810
|
-
QuillToolTip,
|
|
46811
|
-
{
|
|
46812
|
-
text: "Prompt must be less than 500 characters",
|
|
46813
|
-
enabled: sqlPrompt.trim().length > 500,
|
|
46814
|
-
displayBelow: true,
|
|
46815
|
-
textStyle: {
|
|
46816
|
-
maxWidth: "77px",
|
|
46817
|
-
whiteSpace: "normal"
|
|
46818
|
-
},
|
|
46819
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46820
|
-
ButtonComponent,
|
|
46821
|
-
{
|
|
46822
|
-
onClick: debounceRunSqlPrompt,
|
|
46823
|
-
label: "Ask AI",
|
|
46824
|
-
isLoading: sqlResponseLoading,
|
|
46825
|
-
disabled: sqlPrompt.trim().length > 500
|
|
46826
|
-
}
|
|
46827
|
-
)
|
|
46828
|
-
}
|
|
46829
|
-
)
|
|
46830
|
-
]
|
|
46831
|
-
}
|
|
46832
|
-
),
|
|
46833
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46834
|
-
"div",
|
|
46835
|
-
{
|
|
46836
|
-
style: {
|
|
46837
|
-
minHeight: "max(210px, 20vh)",
|
|
46838
|
-
maxHeight: "30%",
|
|
46839
|
-
height: "20vh"
|
|
46840
|
-
},
|
|
46841
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46842
|
-
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,
|
|
46843
46961
|
{
|
|
46844
|
-
|
|
46845
|
-
|
|
46846
|
-
|
|
46847
|
-
|
|
46848
|
-
|
|
46849
|
-
handleRunQuery: () => {
|
|
46850
|
-
handleRunQuery(currentProcessing, true);
|
|
46851
|
-
},
|
|
46852
|
-
handleFixWithAI,
|
|
46853
|
-
isNewQueryEnabled,
|
|
46854
|
-
runQueryOnMount,
|
|
46855
|
-
handleClearQuery,
|
|
46856
|
-
theme,
|
|
46857
|
-
defineEditorTheme,
|
|
46858
|
-
setEditorTheme,
|
|
46859
|
-
setEditorMounted: () => {
|
|
46860
|
-
},
|
|
46861
|
-
ButtonComponent,
|
|
46862
|
-
SecondaryButtonComponent,
|
|
46863
|
-
loading: sqlResponseLoading && schemaData.isSchemaLoading && dashboardIsLoading,
|
|
46864
|
-
LoadingComponent
|
|
46962
|
+
id: "ai-search",
|
|
46963
|
+
value: sqlPrompt,
|
|
46964
|
+
width: normalizedSqlPromptWidth,
|
|
46965
|
+
onChange: (e) => setSqlPrompt(e.target.value),
|
|
46966
|
+
placeholder: "Ask a question..."
|
|
46865
46967
|
}
|
|
46866
|
-
)
|
|
46867
|
-
|
|
46868
|
-
|
|
46869
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46870
|
-
"div",
|
|
46871
|
-
{
|
|
46872
|
-
style: {
|
|
46873
|
-
display: "flex",
|
|
46874
|
-
flexDirection: "row",
|
|
46875
|
-
width: "100%",
|
|
46876
|
-
justifyContent: addToDashboardButtonLabel === "Add to dashboard" ? "flex-end" : "flex-start"
|
|
46877
|
-
},
|
|
46878
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46879
|
-
"div",
|
|
46968
|
+
),
|
|
46969
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46970
|
+
QuillToolTip,
|
|
46880
46971
|
{
|
|
46881
|
-
|
|
46882
|
-
|
|
46883
|
-
|
|
46884
|
-
|
|
46885
|
-
|
|
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"
|
|
46886
46978
|
},
|
|
46887
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime66.
|
|
46888
|
-
|
|
46889
|
-
|
|
46890
|
-
|
|
46891
|
-
|
|
46892
|
-
|
|
46893
|
-
|
|
46894
|
-
|
|
46895
|
-
|
|
46896
|
-
},
|
|
46897
|
-
true,
|
|
46898
|
-
false,
|
|
46899
|
-
true
|
|
46900
|
-
);
|
|
46901
|
-
},
|
|
46902
|
-
label: "Run query"
|
|
46903
|
-
}
|
|
46904
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46905
|
-
ButtonComponent,
|
|
46906
|
-
{
|
|
46907
|
-
onClick: () => {
|
|
46908
|
-
handleRunQuery(
|
|
46909
|
-
{
|
|
46910
|
-
page: pagination,
|
|
46911
|
-
sort: void 0
|
|
46912
|
-
},
|
|
46913
|
-
true,
|
|
46914
|
-
false,
|
|
46915
|
-
true
|
|
46916
|
-
);
|
|
46917
|
-
},
|
|
46918
|
-
label: "Run query"
|
|
46919
|
-
}
|
|
46920
|
-
),
|
|
46921
|
-
isAdminEnabled && !report && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46922
|
-
SecondaryButtonComponent,
|
|
46923
|
-
{
|
|
46924
|
-
disabled: !!errorMessage || !(lastSuccessfulQuery === query) || !query,
|
|
46925
|
-
onClick: async () => {
|
|
46926
|
-
const isSelectStar = isSimpleSelectStarQuery(
|
|
46927
|
-
query ?? ""
|
|
46928
|
-
);
|
|
46929
|
-
let tables = [];
|
|
46930
|
-
let customFieldColumns = [];
|
|
46931
|
-
if (client && isSelectStar && schemaData.customFields) {
|
|
46932
|
-
const { referencedTablesAndColumns } = await getReferencedTables(
|
|
46933
|
-
client,
|
|
46934
|
-
query ?? "",
|
|
46935
|
-
schemaData.schemaWithCustomFields,
|
|
46936
|
-
isSelectStar
|
|
46937
|
-
);
|
|
46938
|
-
tables = referencedTablesAndColumns.map(
|
|
46939
|
-
(ref) => ref.name
|
|
46940
|
-
);
|
|
46941
|
-
customFieldColumns = tables.map((table) => {
|
|
46942
|
-
return (schemaData.customFields?.[table] ?? []).map((field) => field.field);
|
|
46943
|
-
}).flat();
|
|
46944
|
-
}
|
|
46945
|
-
setTempReport({
|
|
46946
|
-
...tempReport,
|
|
46947
|
-
id: TEMP_REPORT_ID,
|
|
46948
|
-
rows,
|
|
46949
|
-
columns: isSelectStar ? (
|
|
46950
|
-
// so Automatic Custom Fields can be applied
|
|
46951
|
-
columns.filter(
|
|
46952
|
-
(col) => {
|
|
46953
|
-
return !customFieldColumns.includes(
|
|
46954
|
-
col.field
|
|
46955
|
-
);
|
|
46956
|
-
}
|
|
46957
|
-
)
|
|
46958
|
-
) : columns,
|
|
46959
|
-
includeCustomFields: isSelectStar,
|
|
46960
|
-
columnInternal: columns,
|
|
46961
|
-
rowCount: rowCount ?? 0,
|
|
46962
|
-
queryString: query ?? "",
|
|
46963
|
-
chartType: "table",
|
|
46964
|
-
dashboardName: destinationDashboard
|
|
46965
|
-
});
|
|
46966
|
-
setIsSaveQueryModalOpen(true);
|
|
46967
|
-
},
|
|
46968
|
-
label: "Save query"
|
|
46969
|
-
}
|
|
46970
|
-
),
|
|
46971
|
-
isNewQueryEnabled && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46972
|
-
SecondaryButtonComponent,
|
|
46973
|
-
{
|
|
46974
|
-
onClick: handleClearQuery,
|
|
46975
|
-
label: "Clear query"
|
|
46976
|
-
}
|
|
46977
|
-
),
|
|
46978
|
-
addToDashboardButtonLabel === "Add to dashboard" && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
46979
|
-
ButtonComponent,
|
|
46980
|
-
{
|
|
46981
|
-
onClick: async () => {
|
|
46982
|
-
onSaveChanges && onSaveChanges();
|
|
46983
|
-
const isSelectStar = isSimpleSelectStarQuery(
|
|
46984
|
-
query ?? ""
|
|
46985
|
-
);
|
|
46986
|
-
let tables = [];
|
|
46987
|
-
let customFieldColumns = [];
|
|
46988
|
-
if (client && isSelectStar && schemaData.customFields) {
|
|
46989
|
-
const { referencedTablesAndColumns } = await getReferencedTables(
|
|
46990
|
-
client,
|
|
46991
|
-
query ?? "",
|
|
46992
|
-
filteredSchema,
|
|
46993
|
-
isSelectStar
|
|
46994
|
-
);
|
|
46995
|
-
tables = referencedTablesAndColumns.map(
|
|
46996
|
-
(ref) => ref.name
|
|
46997
|
-
);
|
|
46998
|
-
customFieldColumns = tables.map((table) => {
|
|
46999
|
-
return (schemaData.customFields?.[table] ?? []).map((field) => field.field);
|
|
47000
|
-
}).flat();
|
|
47001
|
-
}
|
|
47002
|
-
setTempReport({
|
|
47003
|
-
...tempReport,
|
|
47004
|
-
id: TEMP_REPORT_ID,
|
|
47005
|
-
rows,
|
|
47006
|
-
columns: isSelectStar ? (
|
|
47007
|
-
// so Automatic Custom Fields can be applied
|
|
47008
|
-
columns.filter(
|
|
47009
|
-
(col) => {
|
|
47010
|
-
return !customFieldColumns.includes(
|
|
47011
|
-
col.field
|
|
47012
|
-
);
|
|
47013
|
-
}
|
|
47014
|
-
)
|
|
47015
|
-
) : columns,
|
|
47016
|
-
includeCustomFields: isSelectStar,
|
|
47017
|
-
columnInternal: columns,
|
|
47018
|
-
rowCount: rowCount ?? 0,
|
|
47019
|
-
queryString: query ?? "",
|
|
47020
|
-
dashboardName: report?.dashboardName ?? destinationDashboard
|
|
47021
|
-
});
|
|
47022
|
-
setIsChartBuilderOpen(true);
|
|
47023
|
-
},
|
|
47024
|
-
label: addToDashboardButtonLabel,
|
|
47025
|
-
disabled: !!errorMessage || !(lastSuccessfulQuery === query) || !query,
|
|
47026
|
-
tooltipText: !!errorMessage || !(lastSuccessfulQuery === query) ? "Please run a query" : ""
|
|
47027
|
-
}
|
|
47028
|
-
)
|
|
47029
|
-
] })
|
|
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
|
+
)
|
|
47030
46988
|
}
|
|
47031
46989
|
)
|
|
47032
|
-
|
|
47033
|
-
|
|
47034
|
-
|
|
47035
|
-
|
|
47036
|
-
|
|
47037
|
-
|
|
47038
|
-
|
|
47039
|
-
|
|
47040
|
-
|
|
47041
|
-
|
|
47042
|
-
|
|
47043
|
-
|
|
47044
|
-
|
|
47045
|
-
|
|
47046
|
-
|
|
47047
|
-
|
|
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)(
|
|
47048
47048
|
"div",
|
|
47049
47049
|
{
|
|
47050
47050
|
style: {
|
|
47051
|
-
|
|
47052
|
-
|
|
47053
|
-
fontSize: 15,
|
|
47054
|
-
fontWeight: "400",
|
|
47055
|
-
width: "100%"
|
|
47051
|
+
display: "flex",
|
|
47052
|
+
gap: 12
|
|
47056
47053
|
},
|
|
47057
|
-
children:
|
|
47058
|
-
"
|
|
47059
|
-
|
|
47060
|
-
|
|
47061
|
-
|
|
47062
|
-
|
|
47063
|
-
|
|
47064
|
-
|
|
47065
|
-
|
|
47066
|
-
|
|
47067
|
-
|
|
47068
|
-
|
|
47069
|
-
|
|
47070
|
-
|
|
47071
|
-
|
|
47072
|
-
|
|
47073
|
-
|
|
47074
|
-
|
|
47075
|
-
|
|
47076
|
-
|
|
47077
|
-
|
|
47078
|
-
|
|
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,
|
|
47079
47110
|
{
|
|
47080
|
-
onClick:
|
|
47081
|
-
|
|
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" : ""
|
|
47082
47156
|
}
|
|
47083
47157
|
)
|
|
47084
|
-
|
|
47085
|
-
|
|
47086
|
-
|
|
47087
|
-
|
|
47088
|
-
|
|
47089
|
-
|
|
47090
|
-
|
|
47091
|
-
|
|
47092
|
-
|
|
47093
|
-
|
|
47094
|
-
|
|
47095
|
-
|
|
47096
|
-
|
|
47097
|
-
|
|
47098
|
-
|
|
47099
|
-
|
|
47100
|
-
|
|
47101
|
-
|
|
47102
|
-
|
|
47103
|
-
|
|
47104
|
-
|
|
47105
|
-
|
|
47106
|
-
|
|
47107
|
-
|
|
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
|
+
]
|
|
47108
47218
|
}
|
|
47109
|
-
)
|
|
47110
|
-
|
|
47111
|
-
|
|
47112
|
-
|
|
47113
|
-
|
|
47114
|
-
|
|
47115
|
-
|
|
47116
|
-
|
|
47117
|
-
|
|
47118
|
-
|
|
47119
|
-
|
|
47120
|
-
|
|
47121
|
-
|
|
47122
|
-
|
|
47123
|
-
|
|
47124
|
-
|
|
47125
|
-
|
|
47126
|
-
|
|
47127
|
-
|
|
47128
|
-
|
|
47129
|
-
|
|
47130
|
-
|
|
47131
|
-
|
|
47132
|
-
|
|
47133
|
-
|
|
47134
|
-
|
|
47135
|
-
|
|
47136
|
-
|
|
47137
|
-
|
|
47138
|
-
|
|
47139
|
-
|
|
47140
|
-
|
|
47141
|
-
|
|
47142
|
-
|
|
47143
|
-
|
|
47144
|
-
|
|
47145
|
-
|
|
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,
|
|
47146
47284
|
columns,
|
|
47147
|
-
|
|
47148
|
-
|
|
47149
|
-
|
|
47150
|
-
|
|
47151
|
-
|
|
47152
|
-
|
|
47153
|
-
|
|
47154
|
-
|
|
47155
|
-
|
|
47156
|
-
|
|
47157
|
-
|
|
47158
|
-
|
|
47159
|
-
|
|
47160
|
-
|
|
47161
|
-
|
|
47162
|
-
|
|
47163
|
-
|
|
47164
|
-
|
|
47165
|
-
|
|
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
|
+
)
|
|
47166
47306
|
}
|
|
47167
47307
|
)
|
|
47168
47308
|
]
|
|
@@ -47207,7 +47347,7 @@ function SQLEditor({
|
|
|
47207
47347
|
destinationSection,
|
|
47208
47348
|
isAdmin: isAdminEnabled,
|
|
47209
47349
|
title: chartBuilderTitle,
|
|
47210
|
-
buttonLabel:
|
|
47350
|
+
buttonLabel: computedButtonLabel,
|
|
47211
47351
|
tempReport,
|
|
47212
47352
|
reportId: reportId || report?.id,
|
|
47213
47353
|
organizationName,
|
|
@@ -47306,10 +47446,10 @@ var SQLEditorComponent = ({
|
|
|
47306
47446
|
loading,
|
|
47307
47447
|
LoadingComponent = QuillLoadingComponent
|
|
47308
47448
|
}) => {
|
|
47309
|
-
const [editorKey, setEditorKey] = (0,
|
|
47310
|
-
const { eventTracking } = (0,
|
|
47311
|
-
const currentProvider = (0,
|
|
47312
|
-
(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)(() => {
|
|
47313
47453
|
if (currentProvider.current) {
|
|
47314
47454
|
currentProvider.current.dispose();
|
|
47315
47455
|
if (schema && schema.length !== 0) {
|
|
@@ -47353,7 +47493,7 @@ var SQLEditorComponent = ({
|
|
|
47353
47493
|
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(LoadingComponent, {})
|
|
47354
47494
|
}
|
|
47355
47495
|
) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
47356
|
-
|
|
47496
|
+
import_react47.default,
|
|
47357
47497
|
{
|
|
47358
47498
|
height: "100%",
|
|
47359
47499
|
width: "100%",
|
|
@@ -47550,7 +47690,7 @@ function SchemaItem({
|
|
|
47550
47690
|
index,
|
|
47551
47691
|
onClick
|
|
47552
47692
|
}) {
|
|
47553
|
-
const [isOpen, setIsOpen] = (0,
|
|
47693
|
+
const [isOpen, setIsOpen] = (0, import_react46.useState)(index === 0);
|
|
47554
47694
|
const schemaContainerStyle = {
|
|
47555
47695
|
display: "flex",
|
|
47556
47696
|
flexDirection: "column"
|
|
@@ -47777,11 +47917,11 @@ function SchemaItem({
|
|
|
47777
47917
|
}
|
|
47778
47918
|
|
|
47779
47919
|
// src/ReportBuilder.tsx
|
|
47780
|
-
var
|
|
47920
|
+
var import_react54 = require("react");
|
|
47781
47921
|
init_constants();
|
|
47782
47922
|
|
|
47783
47923
|
// src/hooks/useReportBuilder.tsx
|
|
47784
|
-
var
|
|
47924
|
+
var import_react48 = require("react");
|
|
47785
47925
|
init_tableProcessing();
|
|
47786
47926
|
init_ReportBuilder();
|
|
47787
47927
|
init_constants();
|
|
@@ -47801,19 +47941,19 @@ var useReportBuilderInternal = ({
|
|
|
47801
47941
|
rowsPerRequest
|
|
47802
47942
|
}) => {
|
|
47803
47943
|
const { allReportsById } = useAllReports();
|
|
47804
|
-
const [schemaData] = (0,
|
|
47944
|
+
const [schemaData] = (0, import_react48.useContext)(SchemaDataContext);
|
|
47805
47945
|
const { dashboards } = useDashboards();
|
|
47806
47946
|
const {
|
|
47807
47947
|
data,
|
|
47808
47948
|
isLoading: dashboardIsLoading,
|
|
47809
47949
|
reload
|
|
47810
47950
|
} = useDashboardInternal(destinationDashboard);
|
|
47811
|
-
const { getToken } = (0,
|
|
47812
|
-
const { eventTracking } = (0,
|
|
47813
|
-
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)(() => {
|
|
47814
47954
|
return dashboards?.find((d) => d.name === destinationDashboard);
|
|
47815
47955
|
}, [dashboards, destinationDashboard]);
|
|
47816
|
-
const filteredSchema = (0,
|
|
47956
|
+
const filteredSchema = (0, import_react48.useMemo)(() => {
|
|
47817
47957
|
return schemaData.schemaWithCustomFields?.filter((table) => {
|
|
47818
47958
|
return destinationDashboardConfig?.tenantKeys?.[0] === SINGLE_TENANT || !table.ownerTenantFields || table.ownerTenantFields?.length === 0 || table.ownerTenantFields?.includes(
|
|
47819
47959
|
destinationDashboardConfig?.tenantKeys?.[0] ?? ""
|
|
@@ -47823,8 +47963,8 @@ var useReportBuilderInternal = ({
|
|
|
47823
47963
|
schemaData.schemaWithCustomFields,
|
|
47824
47964
|
destinationDashboardConfig?.tenantKeys
|
|
47825
47965
|
]);
|
|
47826
|
-
const { tenants } = (0,
|
|
47827
|
-
const [client] = (0,
|
|
47966
|
+
const { tenants } = (0, import_react48.useContext)(TenantContext);
|
|
47967
|
+
const [client] = (0, import_react48.useContext)(ClientContext);
|
|
47828
47968
|
const _rowsPerRequest = rowsPerRequest ?? 100;
|
|
47829
47969
|
const _rowsPerPage = Math.min(rowsPerPage ?? 20, _rowsPerRequest);
|
|
47830
47970
|
const REPORT_BUILDER_PAGINATION = {
|
|
@@ -47832,19 +47972,19 @@ var useReportBuilderInternal = ({
|
|
|
47832
47972
|
rowsPerPage: _rowsPerPage,
|
|
47833
47973
|
rowsPerRequest: _rowsPerRequest
|
|
47834
47974
|
};
|
|
47835
|
-
const [openPopover, setOpenPopover] = (0,
|
|
47836
|
-
const [aiPrompt, setAiPrompt] = (0,
|
|
47837
|
-
const [reportBuilderLoading, setReportBuilderLoading] = (0,
|
|
47838
|
-
const [tableLoading, setTableLoading] = (0,
|
|
47839
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
47840
|
-
const [unresolvedReportMessage, setUnresolvedReportMessage] = (0,
|
|
47841
|
-
const [tables, setTables] = (0,
|
|
47842
|
-
const [columns, setColumns] = (0,
|
|
47843
|
-
const [filterStack, setFilterStack] = (0,
|
|
47844
|
-
const [pivot, setPivot] = (0,
|
|
47845
|
-
const [sort, setSort] = (0,
|
|
47846
|
-
const [limit, setLimit] = (0,
|
|
47847
|
-
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)(() => {
|
|
47848
47988
|
return {
|
|
47849
47989
|
tables,
|
|
47850
47990
|
columns,
|
|
@@ -47854,29 +47994,29 @@ var useReportBuilderInternal = ({
|
|
|
47854
47994
|
limit
|
|
47855
47995
|
};
|
|
47856
47996
|
}, [columns, filterStack, limit, pivot, sort, tables]);
|
|
47857
|
-
const [stateStack, setStateStack] = (0,
|
|
47858
|
-
const [poppedStateStack, setPoppedStateStack] = (0,
|
|
47859
|
-
const [unfilteredUniqueValues, setUnfilteredUniqueValues] = (0,
|
|
47860
|
-
const [unfilteredUniqueValuesIsLoading, setUnfilteredUniqueValuesIsLoading] = (0,
|
|
47861
|
-
const [filteredUniqueValues, setFilteredUniqueValues] = (0,
|
|
47862
|
-
const [filteredUniqueValuesIsLoading, setFilteredUniqueValuesIsLoading] = (0,
|
|
47863
|
-
const [columnUniqueValues, setColumnUniqueValues] = (0,
|
|
47864
|
-
const [dateRanges, setDateRanges] = (0,
|
|
47865
|
-
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)({
|
|
47866
48006
|
...EMPTY_INTERNAL_REPORT,
|
|
47867
48007
|
pagination: REPORT_BUILDER_PAGINATION
|
|
47868
48008
|
});
|
|
47869
|
-
const [currentProcessing, setCurrentProcessing] = (0,
|
|
48009
|
+
const [currentProcessing, setCurrentProcessing] = (0, import_react48.useState)({
|
|
47870
48010
|
page: REPORT_BUILDER_PAGINATION
|
|
47871
48011
|
});
|
|
47872
|
-
const [previousPage, setPreviousPage] = (0,
|
|
47873
|
-
const [reportColumns, setReportColumns] = (0,
|
|
47874
|
-
const [reportRows, setReportRows] = (0,
|
|
47875
|
-
const [formattedRows, setFormattedRows] = (0,
|
|
47876
|
-
const [pivotData, setPivotData] = (0,
|
|
47877
|
-
const [numberOfRows, setNumberOfRows] = (0,
|
|
47878
|
-
const [rowCountIsLoading, setRowCountIsLoading] = (0,
|
|
47879
|
-
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)(() => {
|
|
47880
48020
|
const positionMap = {};
|
|
47881
48021
|
columns.forEach((column, index) => {
|
|
47882
48022
|
positionMap[column.field] = index;
|
|
@@ -47894,28 +48034,28 @@ var useReportBuilderInternal = ({
|
|
|
47894
48034
|
}
|
|
47895
48035
|
});
|
|
47896
48036
|
}, [columns, reportColumns]);
|
|
47897
|
-
const [pivotRowField, setPivotRowField] = (0,
|
|
48037
|
+
const [pivotRowField, setPivotRowField] = (0, import_react48.useState)(
|
|
47898
48038
|
void 0
|
|
47899
48039
|
);
|
|
47900
|
-
const [pivotColumnField, setPivotColumnField] = (0,
|
|
48040
|
+
const [pivotColumnField, setPivotColumnField] = (0, import_react48.useState)(
|
|
47901
48041
|
void 0
|
|
47902
48042
|
);
|
|
47903
|
-
const [pivotAggregations, setPivotAggregations] = (0,
|
|
47904
|
-
const [pivotLimit, setPivotLimit] = (0,
|
|
47905
|
-
const [pivotSort, setPivotSort] = (0,
|
|
47906
|
-
const [pivotHint, setPivotHint] = (0,
|
|
47907
|
-
const [pivotError, setPivotError] = (0,
|
|
47908
|
-
const [createdPivots, setCreatedPivots] = (0,
|
|
47909
|
-
const [recommendedPivots, setRecommendedPivots] = (0,
|
|
47910
|
-
const [pivotPopUpTitle, setPivotPopUpTitle] = (0,
|
|
47911
|
-
const [showPivotPopover, setShowPivotPopover] = (0,
|
|
47912
|
-
const [isEditingPivot, setIsEditingPivot] = (0,
|
|
47913
|
-
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);
|
|
47914
48054
|
const [
|
|
47915
48055
|
pivotRecommendationsEnabledState,
|
|
47916
48056
|
setPivotRecommendationsEnabledState
|
|
47917
|
-
] = (0,
|
|
47918
|
-
const [askAILoading, setAskAILoading] = (0,
|
|
48057
|
+
] = (0, import_react48.useState)(pivotRecommendationsEnabled);
|
|
48058
|
+
const [askAILoading, setAskAILoading] = (0, import_react48.useState)(false);
|
|
47919
48059
|
const loading = reportBuilderLoading || tableLoading;
|
|
47920
48060
|
useLongLoading(reportBuilderLoading, {
|
|
47921
48061
|
origin: "ReportBuilder",
|
|
@@ -47929,7 +48069,7 @@ var useReportBuilderInternal = ({
|
|
|
47929
48069
|
origin: "ReportBuilder",
|
|
47930
48070
|
loadDescription: "Loading ask AI"
|
|
47931
48071
|
});
|
|
47932
|
-
const isSelectStar = (0,
|
|
48072
|
+
const isSelectStar = (0, import_react48.useMemo)(() => {
|
|
47933
48073
|
if (tables.length === 1) {
|
|
47934
48074
|
const totalColumnLength = tables.reduce((acc, table) => {
|
|
47935
48075
|
const tableColumns = filteredSchema.find((t) => t.name === table.name)?.columns.length ?? 0;
|
|
@@ -47940,14 +48080,14 @@ var useReportBuilderInternal = ({
|
|
|
47940
48080
|
return false;
|
|
47941
48081
|
}
|
|
47942
48082
|
}, [tables, columns, filteredSchema]);
|
|
47943
|
-
const mssqlSortWarning = (0,
|
|
48083
|
+
const mssqlSortWarning = (0, import_react48.useMemo)(() => {
|
|
47944
48084
|
if (!client || client?.databaseType !== "mssql") {
|
|
47945
48085
|
return void 0;
|
|
47946
48086
|
} else if (!pivot && !limit) {
|
|
47947
48087
|
return "Please add a limit.";
|
|
47948
48088
|
}
|
|
47949
48089
|
}, [client, limit, pivot]);
|
|
47950
|
-
const foreignKeyMap = (0,
|
|
48090
|
+
const foreignKeyMap = (0, import_react48.useMemo)(() => {
|
|
47951
48091
|
return getSchemaForeignKeyMapping(filteredSchema);
|
|
47952
48092
|
}, [filteredSchema]);
|
|
47953
48093
|
const clearAllState = (resetStateStack = true) => {
|
|
@@ -48999,7 +49139,7 @@ var useReportBuilderInternal = ({
|
|
|
48999
49139
|
flags: tempReport?.flags
|
|
49000
49140
|
});
|
|
49001
49141
|
};
|
|
49002
|
-
(0,
|
|
49142
|
+
(0, import_react48.useEffect)(() => {
|
|
49003
49143
|
if (!client) {
|
|
49004
49144
|
return;
|
|
49005
49145
|
}
|
|
@@ -49012,7 +49152,7 @@ var useReportBuilderInternal = ({
|
|
|
49012
49152
|
clearAllState();
|
|
49013
49153
|
}
|
|
49014
49154
|
}, [client]);
|
|
49015
|
-
(0,
|
|
49155
|
+
(0, import_react48.useEffect)(() => {
|
|
49016
49156
|
const loadChart = async () => {
|
|
49017
49157
|
let report;
|
|
49018
49158
|
if (!client) {
|
|
@@ -49069,7 +49209,7 @@ var useReportBuilderInternal = ({
|
|
|
49069
49209
|
loadChart();
|
|
49070
49210
|
}
|
|
49071
49211
|
}, [allReportsById[reportId || ""], client]);
|
|
49072
|
-
(0,
|
|
49212
|
+
(0, import_react48.useEffect)(() => {
|
|
49073
49213
|
if (initialTableName) {
|
|
49074
49214
|
const tableColumns = filteredSchema.find((table) => {
|
|
49075
49215
|
return table.name === initialTableName;
|
|
@@ -49089,7 +49229,7 @@ var useReportBuilderInternal = ({
|
|
|
49089
49229
|
}
|
|
49090
49230
|
}
|
|
49091
49231
|
}, [filteredSchema, initialTableName]);
|
|
49092
|
-
(0,
|
|
49232
|
+
(0, import_react48.useEffect)(() => {
|
|
49093
49233
|
if (!data && !dashboardIsLoading) {
|
|
49094
49234
|
reload();
|
|
49095
49235
|
}
|
|
@@ -49251,7 +49391,7 @@ var useReportBuilder = ({
|
|
|
49251
49391
|
reportBuilder.setAiPrompt(prompt);
|
|
49252
49392
|
await reportBuilder.fetchAstFromPromptHelper(prompt);
|
|
49253
49393
|
};
|
|
49254
|
-
const cleanedSchema = (0,
|
|
49394
|
+
const cleanedSchema = (0, import_react48.useMemo)(() => {
|
|
49255
49395
|
return reportBuilder.filteredSchema.reduce(
|
|
49256
49396
|
(acc, table) => {
|
|
49257
49397
|
acc[table.name] = table.columns;
|
|
@@ -49260,7 +49400,7 @@ var useReportBuilder = ({
|
|
|
49260
49400
|
{}
|
|
49261
49401
|
);
|
|
49262
49402
|
}, [reportBuilder.filteredSchema]);
|
|
49263
|
-
const cleanedFilterStack = (0,
|
|
49403
|
+
const cleanedFilterStack = (0, import_react48.useMemo)(() => {
|
|
49264
49404
|
return reportBuilder.filterStack.map((filter) => {
|
|
49265
49405
|
return filter.value ? convertInternalFilterToFilter(filter.value) : null;
|
|
49266
49406
|
}).filter((filter) => filter !== null);
|
|
@@ -49297,7 +49437,7 @@ var useReportBuilder = ({
|
|
|
49297
49437
|
init_ReportBuilder();
|
|
49298
49438
|
|
|
49299
49439
|
// src/components/ReportBuilder/AddColumnModal.tsx
|
|
49300
|
-
var
|
|
49440
|
+
var import_react49 = require("react");
|
|
49301
49441
|
var import_core2 = require("@dnd-kit/core");
|
|
49302
49442
|
var import_sortable2 = require("@dnd-kit/sortable");
|
|
49303
49443
|
var import_utilities2 = require("@dnd-kit/utilities");
|
|
@@ -49319,17 +49459,17 @@ function AddColumnModal({
|
|
|
49319
49459
|
LoadingComponent = QuillLoadingComponent,
|
|
49320
49460
|
onRequestAddVirtualTable
|
|
49321
49461
|
}) {
|
|
49322
|
-
const [primaryTable, setPrimaryTable] = (0,
|
|
49462
|
+
const [primaryTable, setPrimaryTable] = (0, import_react49.useState)(
|
|
49323
49463
|
selectedTables[0]?.name
|
|
49324
49464
|
);
|
|
49325
|
-
const [theme] = (0,
|
|
49326
|
-
const [search, setSearch] = (0,
|
|
49327
|
-
const [initialLoad, setInitialLoad] = (0,
|
|
49328
|
-
const textInputContainerRef = (0,
|
|
49329
|
-
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)(
|
|
49330
49470
|
selectedColumns.map((col) => `${col.table}.${col.field}`)
|
|
49331
49471
|
);
|
|
49332
|
-
const columnOptions = (0,
|
|
49472
|
+
const columnOptions = (0, import_react49.useMemo)(() => {
|
|
49333
49473
|
return schema.filter((table) => {
|
|
49334
49474
|
if (!primaryTable) return true;
|
|
49335
49475
|
return table.name === primaryTable || foreignKeyMap[primaryTable]?.some(
|
|
@@ -49353,20 +49493,20 @@ function AddColumnModal({
|
|
|
49353
49493
|
})
|
|
49354
49494
|
);
|
|
49355
49495
|
}, [schema, primaryTable]);
|
|
49356
|
-
const [orderedColumnNames, setOrderedColumnNames] = (0,
|
|
49496
|
+
const [orderedColumnNames, setOrderedColumnNames] = (0, import_react49.useState)([]);
|
|
49357
49497
|
const isSelectedAllColumns = columnOptions.length === modalSelectedColumns.length;
|
|
49358
|
-
const searchResults = (0,
|
|
49498
|
+
const searchResults = (0, import_react49.useMemo)(() => {
|
|
49359
49499
|
return orderedColumnNames.filter((column) => {
|
|
49360
49500
|
return columnOptions.includes(column) && (search.length === 0 || column.toLowerCase().includes(search.toLowerCase()) || snakeAndCamelCaseToTitleCase(column).toLowerCase().includes(search.toLowerCase()));
|
|
49361
49501
|
});
|
|
49362
49502
|
}, [search, columnOptions, orderedColumnNames]);
|
|
49363
|
-
(0,
|
|
49503
|
+
(0, import_react49.useEffect)(() => {
|
|
49364
49504
|
const remainingColumns = columnOptions.filter(
|
|
49365
49505
|
(col) => !modalSelectedColumns.includes(col)
|
|
49366
49506
|
);
|
|
49367
49507
|
setOrderedColumnNames([...modalSelectedColumns, ...remainingColumns]);
|
|
49368
49508
|
}, [columnOptions]);
|
|
49369
|
-
(0,
|
|
49509
|
+
(0, import_react49.useEffect)(() => {
|
|
49370
49510
|
if (!schemaLoading && initialLoad) {
|
|
49371
49511
|
setTimeout(() => setInitialLoad(false), 200);
|
|
49372
49512
|
}
|
|
@@ -49718,7 +49858,7 @@ function DraggableItem({
|
|
|
49718
49858
|
|
|
49719
49859
|
// src/components/ReportBuilder/DraggableColumns.tsx
|
|
49720
49860
|
var import_sortable4 = require("@dnd-kit/sortable");
|
|
49721
|
-
var
|
|
49861
|
+
var import_react50 = require("react");
|
|
49722
49862
|
init_textProcessing();
|
|
49723
49863
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
49724
49864
|
function DraggableColumns({
|
|
@@ -49733,7 +49873,7 @@ function DraggableColumns({
|
|
|
49733
49873
|
coordinateGetter: import_sortable4.sortableKeyboardCoordinates
|
|
49734
49874
|
})
|
|
49735
49875
|
);
|
|
49736
|
-
const columnNames = (0,
|
|
49876
|
+
const columnNames = (0, import_react50.useMemo)(() => {
|
|
49737
49877
|
return columns.map(
|
|
49738
49878
|
(col) => `${col.table}.${col.alias ?? col.field}`
|
|
49739
49879
|
);
|
|
@@ -50237,7 +50377,7 @@ var AddFilters = ({
|
|
|
50237
50377
|
};
|
|
50238
50378
|
|
|
50239
50379
|
// src/internals/ReportBuilder/PivotForm.tsx
|
|
50240
|
-
var
|
|
50380
|
+
var import_react51 = require("react");
|
|
50241
50381
|
init_textProcessing();
|
|
50242
50382
|
init_pivotProcessing();
|
|
50243
50383
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
@@ -50266,22 +50406,22 @@ function PivotForm({
|
|
|
50266
50406
|
isLoading,
|
|
50267
50407
|
pivotHint
|
|
50268
50408
|
}) {
|
|
50269
|
-
const [allowedColumnFields, setAllowedColumnFields] = (0,
|
|
50270
|
-
const [allowedRowFields, setAllowedRowFields] = (0,
|
|
50271
|
-
const [allowedValueFields, setAllowedValueFields] = (0,
|
|
50272
|
-
const [theme] = (0,
|
|
50273
|
-
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)(
|
|
50274
50414
|
pivotLimit?.toString() ?? ""
|
|
50275
50415
|
);
|
|
50276
|
-
const [sortFieldInput, setSortFieldInput] = (0,
|
|
50416
|
+
const [sortFieldInput, setSortFieldInput] = (0, import_react51.useState)(
|
|
50277
50417
|
pivotSort?.sortField ?? ""
|
|
50278
50418
|
);
|
|
50279
|
-
const [sortDirectionInput, setSortDirectionInput] = (0,
|
|
50419
|
+
const [sortDirectionInput, setSortDirectionInput] = (0, import_react51.useState)(
|
|
50280
50420
|
pivotSort?.sortDirection ?? ""
|
|
50281
50421
|
);
|
|
50282
|
-
const [showLimitInput, setShowLimitInput] = (0,
|
|
50283
|
-
const [showSortInput, setShowSortInput] = (0,
|
|
50284
|
-
(0,
|
|
50422
|
+
const [showLimitInput, setShowLimitInput] = (0, import_react51.useState)(!!pivotLimit);
|
|
50423
|
+
const [showSortInput, setShowSortInput] = (0, import_react51.useState)(!!pivotSort);
|
|
50424
|
+
(0, import_react51.useEffect)(() => {
|
|
50285
50425
|
if (uniqueValues) {
|
|
50286
50426
|
const possibleColumns = getPossiblePivotFieldOptions(
|
|
50287
50427
|
columns,
|
|
@@ -50292,12 +50432,12 @@ function PivotForm({
|
|
|
50292
50432
|
setAllowedValueFields(possibleColumns.valueFields);
|
|
50293
50433
|
}
|
|
50294
50434
|
}, [columns, uniqueValues]);
|
|
50295
|
-
(0,
|
|
50435
|
+
(0, import_react51.useEffect)(() => {
|
|
50296
50436
|
setSortFieldInput(pivotSort?.sortField ?? "");
|
|
50297
50437
|
setSortDirectionInput(pivotSort?.sortDirection ?? "");
|
|
50298
50438
|
setShowSortInput(!!pivotSort);
|
|
50299
50439
|
}, [pivotSort]);
|
|
50300
|
-
(0,
|
|
50440
|
+
(0, import_react51.useEffect)(() => {
|
|
50301
50441
|
setLimitInput(pivotLimit?.toString() ?? "");
|
|
50302
50442
|
setShowLimitInput(!!pivotLimit);
|
|
50303
50443
|
}, [pivotLimit]);
|
|
@@ -50909,7 +51049,7 @@ var AddPivot = ({
|
|
|
50909
51049
|
};
|
|
50910
51050
|
|
|
50911
51051
|
// src/components/ReportBuilder/AddLimitPopover.tsx
|
|
50912
|
-
var
|
|
51052
|
+
var import_react52 = require("react");
|
|
50913
51053
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
50914
51054
|
var LimitSentence = ({
|
|
50915
51055
|
limit,
|
|
@@ -50924,7 +51064,7 @@ var LimitSentence = ({
|
|
|
50924
51064
|
SecondaryButton = MemoizedSecondaryButton,
|
|
50925
51065
|
disabled = false
|
|
50926
51066
|
}) => {
|
|
50927
|
-
const [isOpen, setIsOpen] = (0,
|
|
51067
|
+
const [isOpen, setIsOpen] = (0, import_react52.useState)(false);
|
|
50928
51068
|
const handleClickDelete = () => {
|
|
50929
51069
|
setOpenPopover(null);
|
|
50930
51070
|
handleDelete();
|
|
@@ -50966,7 +51106,7 @@ var AddLimitPopover = ({
|
|
|
50966
51106
|
Button = MemoizedButton,
|
|
50967
51107
|
SecondaryButton = MemoizedSecondaryButton
|
|
50968
51108
|
}) => {
|
|
50969
|
-
const [limit, setLimit] = (0,
|
|
51109
|
+
const [limit, setLimit] = (0, import_react52.useState)(initialLimit.toString());
|
|
50970
51110
|
const MAX_LIMIT = 2147483647;
|
|
50971
51111
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
50972
51112
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
@@ -51207,7 +51347,7 @@ var AddLimit = ({
|
|
|
51207
51347
|
};
|
|
51208
51348
|
|
|
51209
51349
|
// src/components/ReportBuilder/AddSortPopover.tsx
|
|
51210
|
-
var
|
|
51350
|
+
var import_react53 = require("react");
|
|
51211
51351
|
init_textProcessing();
|
|
51212
51352
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
51213
51353
|
var SORT_VALUE_TO_LABEL = {
|
|
@@ -51231,7 +51371,7 @@ var SortSentence = ({
|
|
|
51231
51371
|
SecondaryButton = MemoizedSecondaryButton,
|
|
51232
51372
|
disabled = false
|
|
51233
51373
|
}) => {
|
|
51234
|
-
const [isOpen, setIsOpen] = (0,
|
|
51374
|
+
const [isOpen, setIsOpen] = (0, import_react53.useState)(false);
|
|
51235
51375
|
const handleSetIsOpen = (isOpen2) => {
|
|
51236
51376
|
setIsOpen(isOpen2);
|
|
51237
51377
|
};
|
|
@@ -51283,8 +51423,8 @@ var AddSortPopover = ({
|
|
|
51283
51423
|
Button = MemoizedButton,
|
|
51284
51424
|
SecondaryButton = MemoizedSecondaryButton
|
|
51285
51425
|
}) => {
|
|
51286
|
-
const [sortColumn, setSortColumn] = (0,
|
|
51287
|
-
const [sortDirection, setSortDirection] = (0,
|
|
51426
|
+
const [sortColumn, setSortColumn] = (0, import_react53.useState)(column || "");
|
|
51427
|
+
const [sortDirection, setSortDirection] = (0, import_react53.useState)(
|
|
51288
51428
|
direction || "ASC"
|
|
51289
51429
|
);
|
|
51290
51430
|
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
@@ -51762,15 +51902,14 @@ function ReportBuilder({
|
|
|
51762
51902
|
onRequestAddVirtualTable,
|
|
51763
51903
|
submitButtonLabel
|
|
51764
51904
|
}) {
|
|
51765
|
-
const [theme] = (0,
|
|
51766
|
-
const [client] = (0,
|
|
51767
|
-
const { getToken } = (0,
|
|
51768
|
-
const parentRef = (0,
|
|
51769
|
-
const
|
|
51770
|
-
const [
|
|
51771
|
-
const [
|
|
51772
|
-
const [
|
|
51773
|
-
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);
|
|
51774
51913
|
const reportBuilder = useReportBuilderInternal({
|
|
51775
51914
|
reportId,
|
|
51776
51915
|
initialTableName,
|
|
@@ -51810,6 +51949,12 @@ function ReportBuilder({
|
|
|
51810
51949
|
onSaveQuery,
|
|
51811
51950
|
onSaveReport
|
|
51812
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;
|
|
51813
51958
|
const copySQLToClipboard = async () => {
|
|
51814
51959
|
let query = "";
|
|
51815
51960
|
if (pivot && pivotData) {
|
|
@@ -51832,17 +51977,7 @@ function ReportBuilder({
|
|
|
51832
51977
|
setTimeout(() => setIsCopying(false), 800);
|
|
51833
51978
|
}
|
|
51834
51979
|
};
|
|
51835
|
-
(0,
|
|
51836
|
-
function handleResize() {
|
|
51837
|
-
updateFirstChildWidth(askAIContainerRef, setAskAIInputWidth, { gap: 12 });
|
|
51838
|
-
}
|
|
51839
|
-
handleResize();
|
|
51840
|
-
window.addEventListener("resize", handleResize);
|
|
51841
|
-
return () => {
|
|
51842
|
-
window.removeEventListener("resize", handleResize);
|
|
51843
|
-
};
|
|
51844
|
-
}, []);
|
|
51845
|
-
(0, import_react53.useEffect)(() => {
|
|
51980
|
+
(0, import_react54.useEffect)(() => {
|
|
51846
51981
|
if (isChartBuilderOpen === false) {
|
|
51847
51982
|
onCloseChartBuilder && onCloseChartBuilder();
|
|
51848
51983
|
}
|
|
@@ -51960,10 +52095,10 @@ function ReportBuilder({
|
|
|
51960
52095
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { style: { width: "100%", minHeight: "30vh" } })
|
|
51961
52096
|
] }),
|
|
51962
52097
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(ContainerComponent, { children: [
|
|
51963
|
-
isAIEnabled && /* @__PURE__ */ (0, import_jsx_runtime81.
|
|
52098
|
+
isAIEnabled && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
51964
52099
|
"form",
|
|
51965
52100
|
{
|
|
51966
|
-
ref:
|
|
52101
|
+
ref: askAIFormRef,
|
|
51967
52102
|
onSubmit: (event) => {
|
|
51968
52103
|
event.preventDefault();
|
|
51969
52104
|
},
|
|
@@ -51971,15 +52106,17 @@ function ReportBuilder({
|
|
|
51971
52106
|
display: "flex",
|
|
51972
52107
|
flexDirection: "row",
|
|
51973
52108
|
gap: 12,
|
|
51974
|
-
|
|
52109
|
+
flexWrap: "wrap",
|
|
52110
|
+
alignItems: "stretch",
|
|
52111
|
+
visibility: normalizedAskAIInputWidth > 0 ? "visible" : "hidden"
|
|
51975
52112
|
},
|
|
51976
|
-
children:
|
|
52113
|
+
children: [
|
|
51977
52114
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
51978
52115
|
TextInputComponent,
|
|
51979
52116
|
{
|
|
51980
52117
|
id: "ask_ai_input_bar",
|
|
51981
52118
|
value: aiPrompt,
|
|
51982
|
-
width:
|
|
52119
|
+
width: normalizedAskAIInputWidth,
|
|
51983
52120
|
onChange: (e) => setAiPrompt(e.target.value),
|
|
51984
52121
|
placeholder: "Ask a question..."
|
|
51985
52122
|
}
|
|
@@ -52017,7 +52154,7 @@ function ReportBuilder({
|
|
|
52017
52154
|
disabled: columns.length === 0 || loading
|
|
52018
52155
|
}
|
|
52019
52156
|
)
|
|
52020
|
-
]
|
|
52157
|
+
]
|
|
52021
52158
|
}
|
|
52022
52159
|
),
|
|
52023
52160
|
columns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
@@ -52272,7 +52409,7 @@ function ReportBuilder({
|
|
|
52272
52409
|
}
|
|
52273
52410
|
|
|
52274
52411
|
// src/ChartEditor.tsx
|
|
52275
|
-
var
|
|
52412
|
+
var import_react55 = require("react");
|
|
52276
52413
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
52277
52414
|
function ChartEditor({
|
|
52278
52415
|
isOpen,
|
|
@@ -52319,19 +52456,19 @@ function ChartEditor({
|
|
|
52319
52456
|
onClickChartElement,
|
|
52320
52457
|
onClickChartError
|
|
52321
52458
|
}) {
|
|
52322
|
-
const parentRef = (0,
|
|
52323
|
-
const [modalWidth, setModalWidth] = (0,
|
|
52324
|
-
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);
|
|
52325
52462
|
const { addReport } = useDashboardReports(destinationDashboard);
|
|
52326
52463
|
const { allReportsById } = useAllReports();
|
|
52327
|
-
const { tenants, flags } = (0,
|
|
52328
|
-
const { getToken } = (0,
|
|
52464
|
+
const { tenants, flags } = (0, import_react55.useContext)(TenantContext);
|
|
52465
|
+
const { getToken } = (0, import_react55.useContext)(FetchContext);
|
|
52329
52466
|
const report = allReportsById[reportId];
|
|
52330
|
-
const [client, isClientLoading] = (0,
|
|
52331
|
-
const [schemaData] = (0,
|
|
52332
|
-
const { dashboardFilters } = (0,
|
|
52333
|
-
const { eventTracking } = (0,
|
|
52334
|
-
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)(() => {
|
|
52335
52472
|
if (!report) {
|
|
52336
52473
|
return [];
|
|
52337
52474
|
}
|
|
@@ -52339,15 +52476,15 @@ function ChartEditor({
|
|
|
52339
52476
|
(f) => f.filter
|
|
52340
52477
|
);
|
|
52341
52478
|
}, [dashboardFilters]);
|
|
52342
|
-
const [filtersEnabled, setFiltersEnabled] = (0,
|
|
52343
|
-
const [chartBuilderKey, setChartBuilderKey] = (0,
|
|
52479
|
+
const [filtersEnabled, setFiltersEnabled] = (0, import_react55.useState)(true);
|
|
52480
|
+
const [chartBuilderKey, setChartBuilderKey] = (0, import_react55.useState)(0);
|
|
52344
52481
|
const dateFilter = Object.values(specificDashboardFilters).find(
|
|
52345
52482
|
(filter) => filter.filterType === "date_range"
|
|
52346
52483
|
);
|
|
52347
|
-
const dateRange = (0,
|
|
52484
|
+
const dateRange = (0, import_react55.useMemo)(() => {
|
|
52348
52485
|
return dateFilter?.startDate ? { start: dateFilter.startDate, end: dateFilter.endDate } : void 0;
|
|
52349
52486
|
}, [dateFilter]);
|
|
52350
|
-
(0,
|
|
52487
|
+
(0, import_react55.useEffect)(() => {
|
|
52351
52488
|
function handleResize() {
|
|
52352
52489
|
const screenSize = window.innerWidth;
|
|
52353
52490
|
if (screenSize >= 1200) {
|
|
@@ -52395,7 +52532,7 @@ function ChartEditor({
|
|
|
52395
52532
|
}
|
|
52396
52533
|
addReport(report2);
|
|
52397
52534
|
};
|
|
52398
|
-
(0,
|
|
52535
|
+
(0, import_react55.useEffect)(() => {
|
|
52399
52536
|
if (!isClientLoading && !report) {
|
|
52400
52537
|
fetchReportHelper();
|
|
52401
52538
|
}
|
|
@@ -52543,7 +52680,7 @@ function StaticChart({
|
|
|
52543
52680
|
init_valueFormatter();
|
|
52544
52681
|
|
|
52545
52682
|
// src/hooks/useTenants.ts
|
|
52546
|
-
var
|
|
52683
|
+
var import_react56 = require("react");
|
|
52547
52684
|
var useTenants = (dashboardName) => {
|
|
52548
52685
|
const {
|
|
52549
52686
|
tenants,
|
|
@@ -52556,13 +52693,13 @@ var useTenants = (dashboardName) => {
|
|
|
52556
52693
|
fetchMappedTenantsForDashboard,
|
|
52557
52694
|
getMappedTenantsForDashboard,
|
|
52558
52695
|
getViewerTenantsByOwner
|
|
52559
|
-
} = (0,
|
|
52560
|
-
(0,
|
|
52696
|
+
} = (0, import_react56.useContext)(TenantContext);
|
|
52697
|
+
(0, import_react56.useEffect)(() => {
|
|
52561
52698
|
if (dashboardName) {
|
|
52562
52699
|
fetchViewerTenantsForDashboard(dashboardName);
|
|
52563
52700
|
}
|
|
52564
52701
|
}, [dashboardName, fetchViewerTenantsForDashboard]);
|
|
52565
|
-
(0,
|
|
52702
|
+
(0, import_react56.useEffect)(() => {
|
|
52566
52703
|
if (dashboardName) {
|
|
52567
52704
|
fetchMappedTenantsForDashboard(dashboardName);
|
|
52568
52705
|
}
|
|
@@ -52581,33 +52718,33 @@ var useTenants = (dashboardName) => {
|
|
|
52581
52718
|
};
|
|
52582
52719
|
|
|
52583
52720
|
// src/hooks/useQuill.ts
|
|
52584
|
-
var
|
|
52721
|
+
var import_react57 = require("react");
|
|
52585
52722
|
init_paginationProcessing();
|
|
52586
52723
|
init_tableProcessing();
|
|
52587
52724
|
init_dataProcessing();
|
|
52588
52725
|
var useQuill = (reportId, pagination) => {
|
|
52589
|
-
const { reports, reportsDispatch, fetchIndividualReport } = (0,
|
|
52726
|
+
const { reports, reportsDispatch, fetchIndividualReport } = (0, import_react57.useContext)(ReportsContext);
|
|
52590
52727
|
const { allReportsById } = useAllReports();
|
|
52591
|
-
const { getToken } = (0,
|
|
52592
|
-
const dashboardReport = (0,
|
|
52728
|
+
const { getToken } = (0, import_react57.useContext)(FetchContext);
|
|
52729
|
+
const dashboardReport = (0, import_react57.useMemo)(() => {
|
|
52593
52730
|
return allReportsById[reportId ?? ""];
|
|
52594
52731
|
}, [allReportsById[reportId ?? ""]]);
|
|
52595
|
-
const { dashboardFilters, dashboardCustomFilters } = (0,
|
|
52732
|
+
const { dashboardFilters, dashboardCustomFilters } = (0, import_react57.useContext)(
|
|
52596
52733
|
DashboardFiltersContext
|
|
52597
52734
|
);
|
|
52598
|
-
const { reportFilters, customReportFilters, reportFiltersDispatch } = (0,
|
|
52599
|
-
const specificReportFilters = (0,
|
|
52735
|
+
const { reportFilters, customReportFilters, reportFiltersDispatch } = (0, import_react57.useContext)(ReportFiltersContext);
|
|
52736
|
+
const specificReportFilters = (0, import_react57.useMemo)(() => {
|
|
52600
52737
|
if (!reportId) return null;
|
|
52601
52738
|
return Object.values(reportFilters[reportId] ?? []).map((f) => f.filter);
|
|
52602
52739
|
}, [reportFilters, reportId]);
|
|
52603
|
-
const [schemaData] = (0,
|
|
52604
|
-
const [client, isClientLoading] = (0,
|
|
52605
|
-
const { tenants } = (0,
|
|
52606
|
-
const { eventTracking } = (0,
|
|
52607
|
-
const [loading, setLoading] = (0,
|
|
52608
|
-
const [error, setError] = (0,
|
|
52609
|
-
const [previousPage, setPreviousPage] = (0,
|
|
52610
|
-
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)(() => {
|
|
52611
52748
|
return reportId && allReportsById[reportId] ? convertInternalReportToReport(
|
|
52612
52749
|
mergeComparisonRange(allReportsById[reportId]),
|
|
52613
52750
|
specificReportFilters ?? [],
|
|
@@ -52615,7 +52752,7 @@ var useQuill = (reportId, pagination) => {
|
|
|
52615
52752
|
"useQuill"
|
|
52616
52753
|
) : void 0;
|
|
52617
52754
|
}, [reportId, reportId && allReportsById[reportId], specificReportFilters]);
|
|
52618
|
-
const [additionalProcessing, setAdditionProcessing] = (0,
|
|
52755
|
+
const [additionalProcessing, setAdditionProcessing] = (0, import_react57.useState)(
|
|
52619
52756
|
pagination ? {
|
|
52620
52757
|
page: pagination
|
|
52621
52758
|
} : void 0
|
|
@@ -52764,7 +52901,7 @@ var useQuill = (reportId, pagination) => {
|
|
|
52764
52901
|
setLoading(false);
|
|
52765
52902
|
}
|
|
52766
52903
|
};
|
|
52767
|
-
(0,
|
|
52904
|
+
(0, import_react57.useEffect)(() => {
|
|
52768
52905
|
if (isClientLoading) return;
|
|
52769
52906
|
if (reportId && specificReportFilters) {
|
|
52770
52907
|
fetchReportHelper(reportId, {
|
|
@@ -52804,10 +52941,10 @@ var useQuill = (reportId, pagination) => {
|
|
|
52804
52941
|
|
|
52805
52942
|
// src/hooks/useFormat.ts
|
|
52806
52943
|
init_valueFormatter();
|
|
52807
|
-
var
|
|
52944
|
+
var import_react58 = require("react");
|
|
52808
52945
|
var useMemoizedRows = (reportId) => {
|
|
52809
52946
|
const { data } = useQuill(reportId);
|
|
52810
|
-
const formattedRows = (0,
|
|
52947
|
+
const formattedRows = (0, import_react58.useMemo)(() => {
|
|
52811
52948
|
if (!data || !data.rows || !data.columns)
|
|
52812
52949
|
return { rows: [], loading: true };
|
|
52813
52950
|
return {
|
|
@@ -52831,7 +52968,7 @@ var useMemoizedRows = (reportId) => {
|
|
|
52831
52968
|
};
|
|
52832
52969
|
|
|
52833
52970
|
// src/hooks/useAskQuill.tsx
|
|
52834
|
-
var
|
|
52971
|
+
var import_react59 = require("react");
|
|
52835
52972
|
init_astProcessing();
|
|
52836
52973
|
init_astFilterProcessing();
|
|
52837
52974
|
init_pivotProcessing();
|
|
@@ -52859,13 +52996,13 @@ function convertColumnInternalToAskQuillColumn(columns) {
|
|
|
52859
52996
|
});
|
|
52860
52997
|
}
|
|
52861
52998
|
var useAskQuill = (dashboardName) => {
|
|
52862
|
-
const [client] = (0,
|
|
52863
|
-
const [schemaData] = (0,
|
|
52864
|
-
const { tenants } = (0,
|
|
52865
|
-
const { getToken } = (0,
|
|
52866
|
-
const { eventTracking } = (0,
|
|
52867
|
-
const [astInfo, setAstInfo] = (0,
|
|
52868
|
-
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)({
|
|
52869
53006
|
rows: [],
|
|
52870
53007
|
columns: [],
|
|
52871
53008
|
pivot: null,
|
|
@@ -52875,9 +53012,9 @@ var useAskQuill = (dashboardName) => {
|
|
|
52875
53012
|
pivotColumnFields: [],
|
|
52876
53013
|
pivotValueFields: []
|
|
52877
53014
|
});
|
|
52878
|
-
const [loading, setLoading] = (0,
|
|
52879
|
-
const [error, setError] = (0,
|
|
52880
|
-
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)(
|
|
52881
53018
|
async () => void 0
|
|
52882
53019
|
);
|
|
52883
53020
|
const askHelper = async (query) => {
|
|
@@ -53077,7 +53214,7 @@ var useAskQuill = (dashboardName) => {
|
|
|
53077
53214
|
});
|
|
53078
53215
|
setLoading(false);
|
|
53079
53216
|
};
|
|
53080
|
-
(0,
|
|
53217
|
+
(0, import_react59.useEffect)(() => {
|
|
53081
53218
|
setAsk(() => askHelper);
|
|
53082
53219
|
}, [schemaData.schema]);
|
|
53083
53220
|
return {
|
|
@@ -53091,13 +53228,13 @@ var useAskQuill = (dashboardName) => {
|
|
|
53091
53228
|
};
|
|
53092
53229
|
|
|
53093
53230
|
// src/hooks/useVirtualTables.tsx
|
|
53094
|
-
var
|
|
53231
|
+
var import_react60 = require("react");
|
|
53095
53232
|
var useVirtualTables = () => {
|
|
53096
|
-
const [schemaData, setSchemaData] = (0,
|
|
53097
|
-
const { tenants } = (0,
|
|
53098
|
-
const { getToken, quillFetchWithToken } = (0,
|
|
53099
|
-
const { eventTracking } = (0,
|
|
53100
|
-
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)({});
|
|
53101
53238
|
const handleReload = async (client, caller) => {
|
|
53102
53239
|
setSchemaData({ ...schemaData, isSchemaLoading: true });
|
|
53103
53240
|
setLoadingTables(
|