@quillsql/react 2.16.67 → 2.16.68
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 +47 -49
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +319 -321
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21037,7 +21037,7 @@ import {
|
|
|
21037
21037
|
useContext as useContext21,
|
|
21038
21038
|
useEffect as useEffect19,
|
|
21039
21039
|
useState as useState26,
|
|
21040
|
-
useMemo as
|
|
21040
|
+
useMemo as useMemo20,
|
|
21041
21041
|
useRef as useRef15
|
|
21042
21042
|
} from "react";
|
|
21043
21043
|
|
|
@@ -21046,7 +21046,7 @@ import {
|
|
|
21046
21046
|
useState as useState20,
|
|
21047
21047
|
useEffect as useEffect16,
|
|
21048
21048
|
useContext as useContext17,
|
|
21049
|
-
useMemo as
|
|
21049
|
+
useMemo as useMemo17,
|
|
21050
21050
|
useRef as useRef13
|
|
21051
21051
|
} from "react";
|
|
21052
21052
|
|
|
@@ -28153,12 +28153,10 @@ var useDashboardReportInternal = (reportId, config) => {
|
|
|
28153
28153
|
const { dashboardCustomFilters } = useContext(DashboardFiltersContext);
|
|
28154
28154
|
const reportState = reports[reportId];
|
|
28155
28155
|
const reportDashboardName = reportState?.dashboardName;
|
|
28156
|
+
const reportDashboardFilterState = reportDashboardName ? dashboardFilters[reportDashboardName] : void 0;
|
|
28156
28157
|
const reportDashboardFilters = useMemo2(() => {
|
|
28157
|
-
|
|
28158
|
-
|
|
28159
|
-
(f) => f.filter
|
|
28160
|
-
);
|
|
28161
|
-
}, [dashboardFilters, reportDashboardName]);
|
|
28158
|
+
return Object.values(reportDashboardFilterState ?? {}).map((f) => f.filter);
|
|
28159
|
+
}, [reportDashboardFilterState]);
|
|
28162
28160
|
const {
|
|
28163
28161
|
data: dashboardData,
|
|
28164
28162
|
dashboardFilters: dashboardFiltersInternal,
|
|
@@ -29108,7 +29106,7 @@ var BarList = React2.forwardRef((props, ref) => {
|
|
|
29108
29106
|
var BarList_default = BarList;
|
|
29109
29107
|
|
|
29110
29108
|
// src/components/Chart/PieChart.tsx
|
|
29111
|
-
import React4 from "react";
|
|
29109
|
+
import React4, { useMemo as useMemo4 } from "react";
|
|
29112
29110
|
import { Legend, Pie, PieChart, ResponsiveContainer, Tooltip } from "recharts";
|
|
29113
29111
|
|
|
29114
29112
|
// src/utils/color.ts
|
|
@@ -31801,7 +31799,7 @@ import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
|
31801
31799
|
var defaultValueFormatter = (value) => (value * 1).toFixed(1) + "%";
|
|
31802
31800
|
var parseData2 = (data, colors, categoryKey, valueKey) => {
|
|
31803
31801
|
const maxItems = 20;
|
|
31804
|
-
const slicedData = deepCopy(data
|
|
31802
|
+
const slicedData = deepCopy(data.slice(0, maxItems));
|
|
31805
31803
|
const totalValue = slicedData.reduce(
|
|
31806
31804
|
(acc, dataPoint) => (
|
|
31807
31805
|
// Big(acc)
|
|
@@ -32047,8 +32045,8 @@ var PieChartWrapper = React4.forwardRef(
|
|
|
32047
32045
|
category = "pct_of_the_total",
|
|
32048
32046
|
index = "status",
|
|
32049
32047
|
data,
|
|
32050
|
-
colors
|
|
32051
|
-
colorMap
|
|
32048
|
+
colors,
|
|
32049
|
+
colorMap,
|
|
32052
32050
|
variant = "donut",
|
|
32053
32051
|
valueFormatter: valueFormatter2 = defaultValueFormatter,
|
|
32054
32052
|
className,
|
|
@@ -32058,10 +32056,24 @@ var PieChartWrapper = React4.forwardRef(
|
|
|
32058
32056
|
onClickLegendElement,
|
|
32059
32057
|
yAxisFields,
|
|
32060
32058
|
showLegend = false,
|
|
32059
|
+
showAnimation,
|
|
32060
|
+
isAnimationActive,
|
|
32061
32061
|
...other
|
|
32062
32062
|
} = props;
|
|
32063
32063
|
const isDonut = variant == "donut";
|
|
32064
|
-
|
|
32064
|
+
const chartData = data ?? [];
|
|
32065
|
+
const parsedData = useMemo4(() => {
|
|
32066
|
+
const palette = colorMap?.[category]?.primary ?? colors ?? [];
|
|
32067
|
+
const containsCssVars = palette.some(
|
|
32068
|
+
(color) => typeof color === "string" && color.includes("var(")
|
|
32069
|
+
);
|
|
32070
|
+
const resolvedColors = containsCssVars ? Array.from({ length: chartData.length }).map(
|
|
32071
|
+
(_, idx) => palette[idx % palette.length] ?? palette[palette.length - 1] ?? "#808080"
|
|
32072
|
+
) : palette.length >= chartData.length ? palette.slice(0, chartData.length) : generateArrayFromColor(palette, chartData.length);
|
|
32073
|
+
return parseData2(chartData, resolvedColors, index, category);
|
|
32074
|
+
}, [category, colorMap, colors, chartData, index]);
|
|
32075
|
+
const animationActive = isAnimationActive ?? showAnimation ?? true;
|
|
32076
|
+
if (chartData.length === 0) {
|
|
32065
32077
|
return /* @__PURE__ */ jsx28(
|
|
32066
32078
|
"div",
|
|
32067
32079
|
{
|
|
@@ -32104,28 +32116,11 @@ var PieChartWrapper = React4.forwardRef(
|
|
|
32104
32116
|
height: "100%",
|
|
32105
32117
|
minWidth: 0,
|
|
32106
32118
|
minHeight: 0,
|
|
32107
|
-
initialDimension: { width: 1, height: 1 },
|
|
32108
32119
|
children: /* @__PURE__ */ jsxs20(PieChart, { children: [
|
|
32109
32120
|
/* @__PURE__ */ jsx28(
|
|
32110
32121
|
Pie,
|
|
32111
32122
|
{
|
|
32112
|
-
data:
|
|
32113
|
-
data,
|
|
32114
|
-
(() => {
|
|
32115
|
-
const colorArray = colorMap[category] && colorMap[category]["primary"] && colorMap[category]["primary"] || colors;
|
|
32116
|
-
const containsCssVars = colorArray.some(
|
|
32117
|
-
(color) => typeof color === "string" && color.includes("var(")
|
|
32118
|
-
);
|
|
32119
|
-
if (containsCssVars) {
|
|
32120
|
-
return Array.from({ length: data.length }).map(
|
|
32121
|
-
(_, idx) => colorArray[idx % colorArray.length] ?? colorArray[colorArray.length - 1] ?? "#808080"
|
|
32122
|
-
);
|
|
32123
|
-
}
|
|
32124
|
-
return colorArray.length >= data.length ? colorArray.slice(0, data.length) : generateArrayFromColor(colorArray, data.length);
|
|
32125
|
-
})(),
|
|
32126
|
-
index,
|
|
32127
|
-
category
|
|
32128
|
-
),
|
|
32123
|
+
data: parsedData,
|
|
32129
32124
|
cx: "50%",
|
|
32130
32125
|
cy: "50%",
|
|
32131
32126
|
startAngle: 90,
|
|
@@ -32135,7 +32130,7 @@ var PieChartWrapper = React4.forwardRef(
|
|
|
32135
32130
|
paddingAngle: 0,
|
|
32136
32131
|
dataKey: category,
|
|
32137
32132
|
nameKey: index,
|
|
32138
|
-
isAnimationActive:
|
|
32133
|
+
isAnimationActive: animationActive,
|
|
32139
32134
|
onClick: onClickChartElement,
|
|
32140
32135
|
labelLine: false,
|
|
32141
32136
|
label: false
|
|
@@ -32192,7 +32187,7 @@ var PieChart_default = PieChartWrapper;
|
|
|
32192
32187
|
|
|
32193
32188
|
// src/components/QuillTable.tsx
|
|
32194
32189
|
init_valueFormatter();
|
|
32195
|
-
import { useContext as useContext6, useEffect as useEffect8, useMemo as
|
|
32190
|
+
import { useContext as useContext6, useEffect as useEffect8, useMemo as useMemo5, useState as useState10 } from "react";
|
|
32196
32191
|
import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
32197
32192
|
var NUMERIC_TABLE_FORMATS = /* @__PURE__ */ new Set([
|
|
32198
32193
|
"whole_number",
|
|
@@ -32251,7 +32246,7 @@ function QuillTable({
|
|
|
32251
32246
|
}, [sort]);
|
|
32252
32247
|
const holdFullPageLoader = rows?.length === 0 && isLoading;
|
|
32253
32248
|
const pageCountUnknown = manualPagination && pageCount === -1;
|
|
32254
|
-
const { activeRows, maxPage } =
|
|
32249
|
+
const { activeRows, maxPage } = useMemo5(() => {
|
|
32255
32250
|
const start = currentPage * rowsPerPage;
|
|
32256
32251
|
const end = (currentPage + 1) * rowsPerPage;
|
|
32257
32252
|
const rowList = rows ?? [];
|
|
@@ -33412,7 +33407,7 @@ function hashCode(obj) {
|
|
|
33412
33407
|
}
|
|
33413
33408
|
|
|
33414
33409
|
// src/components/Chart/LineChart.tsx
|
|
33415
|
-
import { useMemo as
|
|
33410
|
+
import { useMemo as useMemo6 } from "react";
|
|
33416
33411
|
|
|
33417
33412
|
// src/components/Chart/CustomReferenceLine.tsx
|
|
33418
33413
|
init_constants();
|
|
@@ -33533,7 +33528,7 @@ function LineChart({
|
|
|
33533
33528
|
referenceLines,
|
|
33534
33529
|
showLegend = false
|
|
33535
33530
|
}) {
|
|
33536
|
-
const formattedData =
|
|
33531
|
+
const formattedData = useMemo6(() => {
|
|
33537
33532
|
if (!data || data.length === 0) {
|
|
33538
33533
|
return createLineForEmptyChart(
|
|
33539
33534
|
yAxisFields,
|
|
@@ -33585,7 +33580,7 @@ function LineChart({
|
|
|
33585
33580
|
if (x.field?.startsWith("comparison_")) return sum + 1;
|
|
33586
33581
|
return sum;
|
|
33587
33582
|
}, 0);
|
|
33588
|
-
const allowDecimals =
|
|
33583
|
+
const allowDecimals = useMemo6(
|
|
33589
33584
|
() => getAllowDecimals(data, yAxisFields, referenceLines),
|
|
33590
33585
|
[data, yAxisFields, referenceLines]
|
|
33591
33586
|
);
|
|
@@ -33596,7 +33591,6 @@ function LineChart({
|
|
|
33596
33591
|
height: "100%",
|
|
33597
33592
|
minWidth: 0,
|
|
33598
33593
|
minHeight: 0,
|
|
33599
|
-
initialDimension: { width: 1, height: 1 },
|
|
33600
33594
|
children: /* @__PURE__ */ jsxs26(
|
|
33601
33595
|
ComposedChart,
|
|
33602
33596
|
{
|
|
@@ -33838,7 +33832,7 @@ import {
|
|
|
33838
33832
|
ResponsiveContainer as ResponsiveContainer3,
|
|
33839
33833
|
Tooltip as Tooltip3
|
|
33840
33834
|
} from "recharts";
|
|
33841
|
-
import { useMemo as
|
|
33835
|
+
import { useMemo as useMemo7 } from "react";
|
|
33842
33836
|
init_textProcessing();
|
|
33843
33837
|
import { jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
33844
33838
|
function RadarChart({
|
|
@@ -33860,7 +33854,7 @@ function RadarChart({
|
|
|
33860
33854
|
dateFilter,
|
|
33861
33855
|
showLegend = false
|
|
33862
33856
|
}) {
|
|
33863
|
-
const formattedData =
|
|
33857
|
+
const formattedData = useMemo7(() => {
|
|
33864
33858
|
if (!data || data.length === 0) {
|
|
33865
33859
|
return [];
|
|
33866
33860
|
}
|
|
@@ -33890,7 +33884,7 @@ function RadarChart({
|
|
|
33890
33884
|
);
|
|
33891
33885
|
}
|
|
33892
33886
|
const getCustomColor = (index, field) => {
|
|
33893
|
-
|
|
33887
|
+
const key = index === 0 ? "comparison" : "primary";
|
|
33894
33888
|
field = field.replace("comparison_", "");
|
|
33895
33889
|
if (colorMap && colorMap[field]) {
|
|
33896
33890
|
return colorMap[field][key];
|
|
@@ -33914,7 +33908,6 @@ function RadarChart({
|
|
|
33914
33908
|
height: "100%",
|
|
33915
33909
|
minWidth: 0,
|
|
33916
33910
|
minHeight: 0,
|
|
33917
|
-
initialDimension: { width: 1, height: 1 },
|
|
33918
33911
|
children: /* @__PURE__ */ jsxs27(
|
|
33919
33912
|
RechartsRadarChart,
|
|
33920
33913
|
{
|
|
@@ -34069,7 +34062,7 @@ import {
|
|
|
34069
34062
|
} from "recharts";
|
|
34070
34063
|
|
|
34071
34064
|
// src/components/Chart/CustomBar.tsx
|
|
34072
|
-
import { memo, useMemo as
|
|
34065
|
+
import { memo, useMemo as useMemo8 } from "react";
|
|
34073
34066
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
34074
34067
|
function isTopMostBarWithValue(yAxisFields, dataKey, payload) {
|
|
34075
34068
|
if (!dataKey || !yAxisFields.length) return false;
|
|
@@ -34131,17 +34124,17 @@ var CustomBar = memo((props) => {
|
|
|
34131
34124
|
}
|
|
34132
34125
|
const sizeBasis = isHorizontalBars ? height : width;
|
|
34133
34126
|
const customCornerRadius = theme?.barChartCornerRadius ?? (theme?.barChartCornerRadiusRatio ? theme?.barChartCornerRadiusRatio * sizeBasis : void 0);
|
|
34134
|
-
const shouldRoundCorners =
|
|
34127
|
+
const shouldRoundCorners = useMemo8(() => {
|
|
34135
34128
|
return customCornerRadius !== void 0 ? customCornerRadius > 0 : isTopMostBarWithValue(yAxisFields, dataKey, payload);
|
|
34136
34129
|
}, [customCornerRadius, yAxisFields, dataKey, payload]);
|
|
34137
|
-
const radius =
|
|
34130
|
+
const radius = useMemo8(() => {
|
|
34138
34131
|
return shouldRoundCorners ? Math.min(
|
|
34139
34132
|
customCornerRadius || sizeBasis * 0.1,
|
|
34140
34133
|
width / 2,
|
|
34141
34134
|
Math.abs(height) / 2
|
|
34142
34135
|
) : 0;
|
|
34143
34136
|
}, [shouldRoundCorners, customCornerRadius, sizeBasis, width, height]);
|
|
34144
|
-
const path =
|
|
34137
|
+
const path = useMemo8(() => {
|
|
34145
34138
|
if (isHorizontalBars) {
|
|
34146
34139
|
const isNegative2 = rawWidth < 0;
|
|
34147
34140
|
return radius > 0 ? createHorizontalRoundedPath(x, y, width, height, radius, !isNegative2) : `M ${x} ${y} h ${isNegative2 ? -width : width} v ${height} h ${isNegative2 ? width : -width} z`;
|
|
@@ -34183,7 +34176,7 @@ var CustomBar_default = CustomBar;
|
|
|
34183
34176
|
// src/components/Chart/BarChart.tsx
|
|
34184
34177
|
init_columnProcessing();
|
|
34185
34178
|
init_textProcessing();
|
|
34186
|
-
import { useMemo as
|
|
34179
|
+
import { useMemo as useMemo9 } from "react";
|
|
34187
34180
|
import { Fragment as Fragment3, jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
34188
34181
|
var CATEGORY_AXIS_WIDTH = 120;
|
|
34189
34182
|
var VALUE_AXIS_WIDTH = 44;
|
|
@@ -34278,11 +34271,11 @@ function BarChart({
|
|
|
34278
34271
|
}
|
|
34279
34272
|
return fields;
|
|
34280
34273
|
};
|
|
34281
|
-
const valueDomain =
|
|
34274
|
+
const valueDomain = useMemo9(
|
|
34282
34275
|
() => stackedMode ? getStackedDomain(data, yAxisFields, comparison) : getDomain(data, yAxisFields, referenceLines),
|
|
34283
34276
|
[stackedMode, data, yAxisFields, referenceLines, comparison]
|
|
34284
34277
|
);
|
|
34285
|
-
const allowDecimals =
|
|
34278
|
+
const allowDecimals = useMemo9(
|
|
34286
34279
|
() => getAllowDecimals(data, yAxisFields, referenceLines),
|
|
34287
34280
|
[data, yAxisFields, referenceLines]
|
|
34288
34281
|
);
|
|
@@ -34300,12 +34293,12 @@ function BarChart({
|
|
|
34300
34293
|
fields: [{ field: xAxisField, format: xAxisFormat }]
|
|
34301
34294
|
})
|
|
34302
34295
|
);
|
|
34303
|
-
const customBarShape =
|
|
34296
|
+
const customBarShape = useMemo9(() => {
|
|
34304
34297
|
if (!theme?.barChartCornerRadius && !theme?.barChartCornerRadiusRatio)
|
|
34305
34298
|
return void 0;
|
|
34306
34299
|
return createCustomBar(sortYAxisFields([...yAxisFields]), theme, layout);
|
|
34307
34300
|
}, [isStacked, yAxisFields, theme, layout]);
|
|
34308
|
-
const customActiveBarShape =
|
|
34301
|
+
const customActiveBarShape = useMemo9(() => {
|
|
34309
34302
|
if (!theme?.barChartCornerRadius && !theme?.barChartCornerRadiusRatio)
|
|
34310
34303
|
return void 0;
|
|
34311
34304
|
return createCustomBar(
|
|
@@ -34350,7 +34343,6 @@ function BarChart({
|
|
|
34350
34343
|
height: "100%",
|
|
34351
34344
|
minWidth: 0,
|
|
34352
34345
|
minHeight: 0,
|
|
34353
|
-
initialDimension: { width: 1, height: 1 },
|
|
34354
34346
|
children: /* @__PURE__ */ jsxs28(
|
|
34355
34347
|
ReChartsBarChart,
|
|
34356
34348
|
{
|
|
@@ -34733,7 +34725,7 @@ init_filterProcessing();
|
|
|
34733
34725
|
|
|
34734
34726
|
// src/components/Dashboard/DashboardFilter.tsx
|
|
34735
34727
|
init_dateRangePickerUtils();
|
|
34736
|
-
import { useMemo as
|
|
34728
|
+
import { useMemo as useMemo13 } from "react";
|
|
34737
34729
|
|
|
34738
34730
|
// src/DateRangePicker/QuillDateRangePicker.tsx
|
|
34739
34731
|
import {
|
|
@@ -34761,7 +34753,7 @@ import {
|
|
|
34761
34753
|
// src/components/QuillSelect.tsx
|
|
34762
34754
|
import {
|
|
34763
34755
|
useContext as useContext8,
|
|
34764
|
-
useMemo as
|
|
34756
|
+
useMemo as useMemo10,
|
|
34765
34757
|
useRef as useRef6,
|
|
34766
34758
|
useState as useState11,
|
|
34767
34759
|
useEffect as useEffect9
|
|
@@ -34791,7 +34783,7 @@ function QuillSelectComponent({
|
|
|
34791
34783
|
},
|
|
34792
34784
|
showModal
|
|
34793
34785
|
);
|
|
34794
|
-
const sortedItems =
|
|
34786
|
+
const sortedItems = useMemo10(() => {
|
|
34795
34787
|
return options.sort((a, b) => {
|
|
34796
34788
|
if (a.value === null) {
|
|
34797
34789
|
return -1;
|
|
@@ -34802,7 +34794,7 @@ function QuillSelectComponent({
|
|
|
34802
34794
|
return 0;
|
|
34803
34795
|
});
|
|
34804
34796
|
}, [options]);
|
|
34805
|
-
const nullLabel =
|
|
34797
|
+
const nullLabel = useMemo10(() => {
|
|
34806
34798
|
return sortedItems.some((item) => item.value === "-") ? "None" : "-";
|
|
34807
34799
|
}, [sortedItems]);
|
|
34808
34800
|
const [popoverPosition, setPopoverPosition] = useState11(void 0);
|
|
@@ -35648,7 +35640,7 @@ function getAnchorEndDate(startDate, endDate) {
|
|
|
35648
35640
|
import React7, {
|
|
35649
35641
|
useContext as useContext10,
|
|
35650
35642
|
useEffect as useEffect11,
|
|
35651
|
-
useMemo as
|
|
35643
|
+
useMemo as useMemo11,
|
|
35652
35644
|
useRef as useRef8,
|
|
35653
35645
|
useState as useState13
|
|
35654
35646
|
} from "react";
|
|
@@ -35684,17 +35676,17 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
35684
35676
|
CheckboxState2[CheckboxState2["UNSELECTED"] = 1] = "UNSELECTED";
|
|
35685
35677
|
CheckboxState2[CheckboxState2["INDETERMINATE"] = 2] = "INDETERMINATE";
|
|
35686
35678
|
})(CheckboxState || (CheckboxState = {}));
|
|
35687
|
-
const optionValues =
|
|
35679
|
+
const optionValues = useMemo11(
|
|
35688
35680
|
() => new Set(options.map((opt) => opt.value ?? "")),
|
|
35689
35681
|
[options]
|
|
35690
35682
|
);
|
|
35691
|
-
const potentialOptions =
|
|
35683
|
+
const potentialOptions = useMemo11(() => {
|
|
35692
35684
|
return value.filter((opt) => !optionValues.has(opt ?? "")).map((opt) => ({
|
|
35693
35685
|
label: opt === "" ? "-" : opt?.toString() ?? "-",
|
|
35694
35686
|
value: opt ?? ""
|
|
35695
35687
|
})).concat(options);
|
|
35696
35688
|
}, [value, options]);
|
|
35697
|
-
const selectedOptionsLabel =
|
|
35689
|
+
const selectedOptionsLabel = useMemo11(() => {
|
|
35698
35690
|
if (!value || !value.length) {
|
|
35699
35691
|
return "Select";
|
|
35700
35692
|
}
|
|
@@ -35787,7 +35779,7 @@ function QuillMultiSelectComponentWithCombo({
|
|
|
35787
35779
|
return 0;
|
|
35788
35780
|
}).slice(0, 20);
|
|
35789
35781
|
}, [potentialOptions, searchQuery]);
|
|
35790
|
-
const nullLabel =
|
|
35782
|
+
const nullLabel = useMemo11(() => {
|
|
35791
35783
|
return filteredItems.some((item) => item.value === "-") ? "None" : "-";
|
|
35792
35784
|
}, [filteredItems]);
|
|
35793
35785
|
const updatePosition = () => {
|
|
@@ -36313,7 +36305,7 @@ var ListboxTextInput = ({
|
|
|
36313
36305
|
// src/components/QuillSelectWithCombo.tsx
|
|
36314
36306
|
import React8, {
|
|
36315
36307
|
useContext as useContext11,
|
|
36316
|
-
useMemo as
|
|
36308
|
+
useMemo as useMemo12,
|
|
36317
36309
|
useRef as useRef9,
|
|
36318
36310
|
useState as useState14
|
|
36319
36311
|
} from "react";
|
|
@@ -36364,10 +36356,10 @@ function QuillSelectComponentWithCombo({
|
|
|
36364
36356
|
return 0;
|
|
36365
36357
|
})?.slice(0, 20) ?? [];
|
|
36366
36358
|
}, [options, searchQuery]);
|
|
36367
|
-
const nullLabel =
|
|
36359
|
+
const nullLabel = useMemo12(() => {
|
|
36368
36360
|
return filteredItems.some((item) => item.value === "-") ? "None" : "-";
|
|
36369
36361
|
}, [filteredItems]);
|
|
36370
|
-
const selectedLabel =
|
|
36362
|
+
const selectedLabel = useMemo12(() => {
|
|
36371
36363
|
const selectedOption = options?.find((elem) => elem.value === value);
|
|
36372
36364
|
return selectedOption && selectedOption.label == "-" ? nullLabel : selectedOption?.label ?? "Select";
|
|
36373
36365
|
}, [value, options, nullLabel]);
|
|
@@ -36635,7 +36627,7 @@ function DashboardFilter2({
|
|
|
36635
36627
|
disabled,
|
|
36636
36628
|
containerStyle
|
|
36637
36629
|
}) {
|
|
36638
|
-
const preset =
|
|
36630
|
+
const preset = useMemo13(() => {
|
|
36639
36631
|
if (
|
|
36640
36632
|
/*'preset' in filter && */
|
|
36641
36633
|
"primaryRange" in filter
|
|
@@ -37289,7 +37281,7 @@ var MetricDisplay = ({
|
|
|
37289
37281
|
};
|
|
37290
37282
|
|
|
37291
37283
|
// src/components/Dashboard/DataLoader.tsx
|
|
37292
|
-
import { useContext as useContext13, useEffect as useEffect12, useMemo as
|
|
37284
|
+
import { useContext as useContext13, useEffect as useEffect12, useMemo as useMemo14, useRef as useRef10, useState as useState15 } from "react";
|
|
37293
37285
|
init_paginationProcessing();
|
|
37294
37286
|
init_tableProcessing();
|
|
37295
37287
|
import equal2 from "fast-deep-equal";
|
|
@@ -37403,7 +37395,7 @@ function DataLoader({
|
|
|
37403
37395
|
const { reportFilters } = useContext13(ReportFiltersContext);
|
|
37404
37396
|
const { getToken } = useContext13(FetchContext);
|
|
37405
37397
|
const { eventTracking } = useContext13(EventTrackingContext);
|
|
37406
|
-
const contextFilters =
|
|
37398
|
+
const contextFilters = useMemo14(() => {
|
|
37407
37399
|
return dashboardName ? Object.values(dashboardFilters[dashboardName] ?? {}).map(
|
|
37408
37400
|
(f) => f.filter
|
|
37409
37401
|
) : Object.values(reportFilters[item.id] ?? {}).map((f) => f.filter);
|
|
@@ -37413,7 +37405,7 @@ function DataLoader({
|
|
|
37413
37405
|
const [error, setError] = useState15(void 0);
|
|
37414
37406
|
const [previousPage, setPreviousPage] = useState15(0);
|
|
37415
37407
|
const [additionalProcessing, setAdditionalProcessing] = useState15(defaultAdditionalProcessing);
|
|
37416
|
-
const chartReport =
|
|
37408
|
+
const chartReport = useMemo14(() => {
|
|
37417
37409
|
const report = (dashboardName ? dashboard : reports)[item.id];
|
|
37418
37410
|
if (report) {
|
|
37419
37411
|
return convertInternalReportToReport(
|
|
@@ -37830,7 +37822,7 @@ var ChartDataLoader = ({
|
|
|
37830
37822
|
const { eventTracking } = useContext13(EventTrackingContext);
|
|
37831
37823
|
const { reportFilters } = useContext13(ReportFiltersContext);
|
|
37832
37824
|
const { tenants, flags } = useContext13(TenantContext);
|
|
37833
|
-
const contextFilters =
|
|
37825
|
+
const contextFilters = useMemo14(() => {
|
|
37834
37826
|
return dashboardName ? Object.values(dashboardFilters[dashboardName] ?? {}).map(
|
|
37835
37827
|
(f) => f.filter
|
|
37836
37828
|
) : Object.values(reportFilters[item.id] ?? {}).map((f) => f.filter);
|
|
@@ -37846,7 +37838,7 @@ var ChartDataLoader = ({
|
|
|
37846
37838
|
const previousCustomFields = useRef10(schemaData.customFields);
|
|
37847
37839
|
const fetchReportAbortController = useRef10(null);
|
|
37848
37840
|
const rowsRequestId = useRef10(0);
|
|
37849
|
-
const chartReport =
|
|
37841
|
+
const chartReport = useMemo14(() => {
|
|
37850
37842
|
const report = dashboardName ? dashboard[item.id] : reports[item.id];
|
|
37851
37843
|
if (!report) {
|
|
37852
37844
|
return constructReportFromItem(item);
|
|
@@ -38120,13 +38112,13 @@ var useReportInternal = (reportId) => {
|
|
|
38120
38112
|
import equal3 from "fast-deep-equal";
|
|
38121
38113
|
|
|
38122
38114
|
// src/components/Chart/MapChart.tsx
|
|
38123
|
-
import { useEffect as useEffect13, useMemo as
|
|
38115
|
+
import { useEffect as useEffect13, useMemo as useMemo16, useRef as useRef11, useState as useState17 } from "react";
|
|
38124
38116
|
init_valueFormatter();
|
|
38125
38117
|
import usStates10m from "us-atlas/states-10m.json";
|
|
38126
38118
|
import worldCountries50m from "world-atlas/countries-50m.json";
|
|
38127
38119
|
|
|
38128
38120
|
// src/utils/simpleMaps.ts
|
|
38129
|
-
import React10, { useContext as useContext15, useMemo as
|
|
38121
|
+
import React10, { useContext as useContext15, useMemo as useMemo15, useState as useState16 } from "react";
|
|
38130
38122
|
var d3GeoModule;
|
|
38131
38123
|
var topojsonClientModule;
|
|
38132
38124
|
var projections = {};
|
|
@@ -38161,7 +38153,7 @@ var requireTopojsonClientModule = () => {
|
|
|
38161
38153
|
};
|
|
38162
38154
|
var MapContext = React10.createContext(void 0);
|
|
38163
38155
|
var MapProvider = ({ width, height, projection, projectionConfig = {}, children }) => {
|
|
38164
|
-
const projectionMemo =
|
|
38156
|
+
const projectionMemo = useMemo15(() => {
|
|
38165
38157
|
if (typeof projection === "function") return projection;
|
|
38166
38158
|
const projectionFactory = projections[String(projection)];
|
|
38167
38159
|
if (!projectionFactory) {
|
|
@@ -38182,11 +38174,11 @@ var MapProvider = ({ width, height, projection, projectionConfig = {}, children
|
|
|
38182
38174
|
}
|
|
38183
38175
|
return proj;
|
|
38184
38176
|
}, [width, height, projection, projectionConfig]);
|
|
38185
|
-
const pathMemo =
|
|
38177
|
+
const pathMemo = useMemo15(() => {
|
|
38186
38178
|
const { geoPath } = requireD3GeoModule();
|
|
38187
38179
|
return geoPath().projection(projectionMemo);
|
|
38188
38180
|
}, [projectionMemo]);
|
|
38189
|
-
const value =
|
|
38181
|
+
const value = useMemo15(() => {
|
|
38190
38182
|
return {
|
|
38191
38183
|
width,
|
|
38192
38184
|
height,
|
|
@@ -38285,12 +38277,12 @@ var ComposableMap = ({
|
|
|
38285
38277
|
};
|
|
38286
38278
|
var Geographies = ({ geography, children, parseGeographies, className = "", ...restProps }) => {
|
|
38287
38279
|
const { path, projection } = useLocalMapContext();
|
|
38288
|
-
const prepared =
|
|
38280
|
+
const prepared = useMemo15(() => {
|
|
38289
38281
|
const raw = getFeatures(geography);
|
|
38290
38282
|
const parsed = parseGeographies ? parseGeographies(raw) : raw;
|
|
38291
38283
|
return prepareFeatures(parsed, path);
|
|
38292
38284
|
}, [geography, parseGeographies, path]);
|
|
38293
|
-
const meshData =
|
|
38285
|
+
const meshData = useMemo15(() => {
|
|
38294
38286
|
return prepareMesh(getMesh(geography), path);
|
|
38295
38287
|
}, [geography, path]);
|
|
38296
38288
|
return React10.createElement(
|
|
@@ -38324,7 +38316,7 @@ var Geography = ({
|
|
|
38324
38316
|
const { path } = useLocalMapContext();
|
|
38325
38317
|
const [isPressed, setPressed] = useState16(false);
|
|
38326
38318
|
const [isFocused, setFocused] = useState16(false);
|
|
38327
|
-
const geographyEventData =
|
|
38319
|
+
const geographyEventData = useMemo15(() => {
|
|
38328
38320
|
const { geoCentroid, geoBounds } = requireD3GeoModule();
|
|
38329
38321
|
const centroid = geography?.geometry ? geoCentroid(geography) : null;
|
|
38330
38322
|
const bounds = geography?.geometry ? geoBounds(geography) : null;
|
|
@@ -38750,7 +38742,7 @@ function USMap({
|
|
|
38750
38742
|
setScaleLog(() => scale.scaleLog);
|
|
38751
38743
|
});
|
|
38752
38744
|
}, []);
|
|
38753
|
-
const colorScale =
|
|
38745
|
+
const colorScale = useMemo16(() => {
|
|
38754
38746
|
if (!scaleLog) return () => "#FFFFFF";
|
|
38755
38747
|
const values = Object.values(mappedData).map((d) => parseFloat(d[measureField])).filter((v) => !isNaN(v));
|
|
38756
38748
|
const minValue = Math.min(...values);
|
|
@@ -38776,7 +38768,7 @@ function USMap({
|
|
|
38776
38768
|
colors,
|
|
38777
38769
|
scaleLog
|
|
38778
38770
|
]);
|
|
38779
|
-
const hoveredValue =
|
|
38771
|
+
const hoveredValue = useMemo16(() => {
|
|
38780
38772
|
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];
|
|
38781
38773
|
}, [hoveredState, mappedData, measureField]);
|
|
38782
38774
|
if (!measureField) {
|
|
@@ -38946,7 +38938,7 @@ function WorldMap({
|
|
|
38946
38938
|
setScaleLog(() => scale.scaleLog);
|
|
38947
38939
|
});
|
|
38948
38940
|
}, []);
|
|
38949
|
-
const colorScale =
|
|
38941
|
+
const colorScale = useMemo16(() => {
|
|
38950
38942
|
if (!scaleLog) return () => "#FFFFFF";
|
|
38951
38943
|
const values = Object.values(mappedData).map((d) => parseFloat(d[measureField])).filter((v) => !isNaN(v));
|
|
38952
38944
|
const minValue = Math.min(...values);
|
|
@@ -38972,7 +38964,7 @@ function WorldMap({
|
|
|
38972
38964
|
colors,
|
|
38973
38965
|
scaleLog
|
|
38974
38966
|
]);
|
|
38975
|
-
const hoveredValue =
|
|
38967
|
+
const hoveredValue = useMemo16(() => {
|
|
38976
38968
|
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];
|
|
38977
38969
|
}, [hoveredCountry, mappedData, measureField]);
|
|
38978
38970
|
if (!measureField) {
|
|
@@ -39687,12 +39679,6 @@ function QuillTableDashboardComponent({
|
|
|
39687
39679
|
init_valueFormatter();
|
|
39688
39680
|
import { Fragment as Fragment6, jsx as jsx50, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
39689
39681
|
var MAX_ROWS_FOR_GENERIC_TABLE = 500;
|
|
39690
|
-
function sumByKey(arr, key) {
|
|
39691
|
-
return arr.reduce((acc, cur) => {
|
|
39692
|
-
const val = parseInt(cur[key], 10);
|
|
39693
|
-
return isNaN(val) ? acc : acc + val;
|
|
39694
|
-
}, 0);
|
|
39695
|
-
}
|
|
39696
39682
|
function Chart({
|
|
39697
39683
|
colors,
|
|
39698
39684
|
reportId,
|
|
@@ -39740,23 +39726,23 @@ function Chart({
|
|
|
39740
39726
|
const { dashboardFilters } = useDashboardInternal(
|
|
39741
39727
|
allReportsById[reportId]?.dashboardName ?? null
|
|
39742
39728
|
);
|
|
39743
|
-
const specificReportFilters =
|
|
39729
|
+
const specificReportFilters = useMemo17(() => {
|
|
39744
39730
|
const reportFilterValues = reportFilters[reportId];
|
|
39745
39731
|
if (reportFilterValues && !hideFilters)
|
|
39746
39732
|
return Object.values(reportFilterValues ?? {}).map((f) => f.filter);
|
|
39747
39733
|
if (allReportsById[reportId]) return dashboardFilters ?? [];
|
|
39748
39734
|
return [];
|
|
39749
39735
|
}, [reportFilters[reportId], allReportsById[reportId], dashboardFilters]);
|
|
39750
|
-
const reportDateFilter =
|
|
39736
|
+
const reportDateFilter = useMemo17(() => {
|
|
39751
39737
|
return specificReportFilters.find((f) => f.filterType === "date_range");
|
|
39752
39738
|
}, [specificReportFilters]);
|
|
39753
|
-
const presetOptions =
|
|
39739
|
+
const presetOptions = useMemo17(() => {
|
|
39754
39740
|
return reportDateFilter ? convertPresetOptionsToSelectableList(
|
|
39755
39741
|
reportDateFilter.presetOptions ?? [],
|
|
39756
39742
|
reportDateFilter.defaultPresetRanges ?? []
|
|
39757
39743
|
) : defaultOptionsV2;
|
|
39758
39744
|
}, [reportDateFilter]);
|
|
39759
|
-
const userFilters =
|
|
39745
|
+
const userFilters = useMemo17(() => {
|
|
39760
39746
|
return filters?.filter((f) => f.filterType !== "date" /* Date */)?.map(convertCustomFilter) ?? dashboardCustomFilters[allReportsById[reportId]?.dashboardName ?? ""];
|
|
39761
39747
|
}, [
|
|
39762
39748
|
filters,
|
|
@@ -39831,32 +39817,32 @@ function Chart({
|
|
|
39831
39817
|
});
|
|
39832
39818
|
}
|
|
39833
39819
|
}, [previousFilters.current]);
|
|
39834
|
-
const dashboardReport =
|
|
39820
|
+
const dashboardReport = useMemo17(
|
|
39835
39821
|
() => allReportsById[reportId],
|
|
39836
39822
|
[reportId, allReportsById]
|
|
39837
39823
|
);
|
|
39838
|
-
const report =
|
|
39824
|
+
const report = useMemo17(() => reports[reportId], [reports, reportId]);
|
|
39839
39825
|
const [loading, setLoading] = useState20(true);
|
|
39840
39826
|
const [theme] = useContext17(ThemeContext);
|
|
39841
|
-
const colorMap =
|
|
39827
|
+
const colorMap = useMemo17(() => {
|
|
39842
39828
|
if (mapColorsToFields && report && theme) {
|
|
39843
39829
|
return mapColorsToFields(report, theme);
|
|
39844
39830
|
}
|
|
39845
39831
|
}, [report, theme]);
|
|
39846
39832
|
const [client, clientLoading] = useContext17(ClientContext);
|
|
39847
|
-
const cloudCacheEnabled =
|
|
39833
|
+
const cloudCacheEnabled = useMemo17(() => {
|
|
39848
39834
|
return !!client?.features?.cloudCache;
|
|
39849
39835
|
}, [client]);
|
|
39850
39836
|
const shouldShowCloudCacheValidationErrors = isAdmin && cloudCacheEnabled;
|
|
39851
|
-
const isMissingDateField =
|
|
39837
|
+
const isMissingDateField = useMemo17(() => {
|
|
39852
39838
|
if (!shouldShowCloudCacheValidationErrors) return false;
|
|
39853
39839
|
return isDateFieldMissingInReport(report);
|
|
39854
39840
|
}, [report, shouldShowCloudCacheValidationErrors]);
|
|
39855
|
-
const usesLimitInQuery =
|
|
39841
|
+
const usesLimitInQuery = useMemo17(() => {
|
|
39856
39842
|
if (!shouldShowCloudCacheValidationErrors) return false;
|
|
39857
39843
|
return reportUsesLimitClause(report);
|
|
39858
39844
|
}, [report, shouldShowCloudCacheValidationErrors]);
|
|
39859
|
-
const missingDashboardFilterFields =
|
|
39845
|
+
const missingDashboardFilterFields = useMemo17(() => {
|
|
39860
39846
|
if (!shouldShowCloudCacheValidationErrors || !report) return [];
|
|
39861
39847
|
return getMissingDashboardFilterFields({
|
|
39862
39848
|
rows: report.rows,
|
|
@@ -40190,24 +40176,24 @@ var ChartDisplay = ({
|
|
|
40190
40176
|
const [theme] = useContext17(ThemeContext);
|
|
40191
40177
|
const { dashboardFilters } = useContext17(DashboardFiltersContext);
|
|
40192
40178
|
const { reportFilters } = useContext17(ReportFiltersContext);
|
|
40193
|
-
const specificDashboardFilters =
|
|
40179
|
+
const specificDashboardFilters = useMemo17(() => {
|
|
40194
40180
|
const dashboardName = config?.dashboardName;
|
|
40195
40181
|
if (!dashboardName) return [];
|
|
40196
40182
|
return Object.values(dashboardFilters[dashboardName] ?? {}).map(
|
|
40197
40183
|
(f) => f.filter
|
|
40198
40184
|
);
|
|
40199
40185
|
}, [dashboardFilters, config?.dashboardName]);
|
|
40200
|
-
const specificReportFilters =
|
|
40186
|
+
const specificReportFilters = useMemo17(() => {
|
|
40201
40187
|
if (!reportId) return [];
|
|
40202
40188
|
return Object.values(reportFilters[reportId] ?? []).map((f) => f.filter);
|
|
40203
40189
|
}, [reportFilters, reportId]);
|
|
40204
|
-
const chartColors =
|
|
40190
|
+
const chartColors = useMemo17(() => {
|
|
40205
40191
|
if (overrideTheme && overrideTheme.chartColors) {
|
|
40206
40192
|
return colors?.length ? colors : overrideTheme && overrideTheme.chartColors && overrideTheme.chartColors.length ? overrideTheme.chartColors : ["#4E80EE", "#E14F62", "#55B5A6", "#E9A23B", "#6466E9", "#55B685"];
|
|
40207
40193
|
}
|
|
40208
40194
|
return colors?.length ? colors : theme && theme.chartColors && theme.chartColors.length ? theme.chartColors : ["#4E80EE", "#E14F62", "#55B5A6", "#E9A23B", "#6466E9", "#55B685"];
|
|
40209
40195
|
}, [colors]);
|
|
40210
|
-
const dateFilter =
|
|
40196
|
+
const dateFilter = useMemo17(() => {
|
|
40211
40197
|
const filters = specificReportFilters.length > 0 ? specificReportFilters : specificDashboardFilters;
|
|
40212
40198
|
if (!hideDateRangeFilter && filters) {
|
|
40213
40199
|
return findAndProcessDateFilter(filters.map((f) => f));
|
|
@@ -40217,7 +40203,7 @@ var ChartDisplay = ({
|
|
|
40217
40203
|
const resolvedShowLegend = showLegend !== void 0 ? showLegend : config?.showLegend ?? false;
|
|
40218
40204
|
const [page, setPage] = useState20(0);
|
|
40219
40205
|
const rowCountForLimit = config?.pivot ? config.pivotRowCount ?? config.pivotRows?.length ?? config.rows?.length : config?.rowCount ?? config?.rows?.length;
|
|
40220
|
-
const tableDisplay =
|
|
40206
|
+
const tableDisplay = useMemo17(() => {
|
|
40221
40207
|
if (!config || config.chartType?.toLowerCase() !== "table") {
|
|
40222
40208
|
return void 0;
|
|
40223
40209
|
}
|
|
@@ -40231,6 +40217,22 @@ var ChartDisplay = ({
|
|
|
40231
40217
|
)
|
|
40232
40218
|
};
|
|
40233
40219
|
}, [config]);
|
|
40220
|
+
const pieData = useMemo17(() => {
|
|
40221
|
+
if (!config || config.chartType?.toLowerCase() !== "pie") return [];
|
|
40222
|
+
if (config.pivot) return config.rows ?? [];
|
|
40223
|
+
const rows = config.rows ?? [];
|
|
40224
|
+
const configuredValueField = config.yAxisFields?.[0]?.field;
|
|
40225
|
+
if (!configuredValueField) return rows;
|
|
40226
|
+
const valueField = configuredValueField;
|
|
40227
|
+
const total = rows.reduce((sum, row) => {
|
|
40228
|
+
const value = parseInt(row[valueField] ?? "", 10);
|
|
40229
|
+
return isNaN(value) ? sum : sum + value;
|
|
40230
|
+
}, 0);
|
|
40231
|
+
return rows.map((row) => ({
|
|
40232
|
+
...row,
|
|
40233
|
+
count: parseInt(row[valueField] ?? "", 10) / total
|
|
40234
|
+
}));
|
|
40235
|
+
}, [config]);
|
|
40234
40236
|
if (loading) {
|
|
40235
40237
|
return /* @__PURE__ */ jsx50("div", { className, style: containerStyle, children: /* @__PURE__ */ jsx50(LoadingComponent, {}) });
|
|
40236
40238
|
} else if (config && !["metric", "table", "gauge", "US map", "World map"].includes(
|
|
@@ -40249,15 +40251,7 @@ var ChartDisplay = ({
|
|
|
40249
40251
|
{
|
|
40250
40252
|
className,
|
|
40251
40253
|
containerStyle,
|
|
40252
|
-
data:
|
|
40253
|
-
return {
|
|
40254
|
-
...row,
|
|
40255
|
-
count: (
|
|
40256
|
-
// @ts-ignore
|
|
40257
|
-
parseInt(row[config?.yAxisFields[0]?.field]) / sumByKey(config?.rows, config?.yAxisFields[0]?.field)
|
|
40258
|
-
)
|
|
40259
|
-
};
|
|
40260
|
-
}) || [] : config?.rows || [],
|
|
40254
|
+
data: pieData,
|
|
40261
40255
|
category: config?.yAxisFields?.[0]?.field,
|
|
40262
40256
|
index: config?.xAxisField,
|
|
40263
40257
|
colors: chartColors,
|
|
@@ -40266,7 +40260,8 @@ var ChartDisplay = ({
|
|
|
40266
40260
|
onClickChartElement,
|
|
40267
40261
|
onClickLegendElement,
|
|
40268
40262
|
yAxisFields: config?.yAxisFields,
|
|
40269
|
-
showLegend: resolvedShowLegend
|
|
40263
|
+
showLegend: resolvedShowLegend,
|
|
40264
|
+
isAnimationActive
|
|
40270
40265
|
}
|
|
40271
40266
|
);
|
|
40272
40267
|
}
|
|
@@ -40316,7 +40311,8 @@ var ChartDisplay = ({
|
|
|
40316
40311
|
className,
|
|
40317
40312
|
colorMap,
|
|
40318
40313
|
onClickChartElement,
|
|
40319
|
-
scrollable
|
|
40314
|
+
scrollable,
|
|
40315
|
+
showAnimation: isAnimationActive
|
|
40320
40316
|
}
|
|
40321
40317
|
);
|
|
40322
40318
|
}
|
|
@@ -40821,7 +40817,7 @@ import {
|
|
|
40821
40817
|
forwardRef as forwardRef2,
|
|
40822
40818
|
useContext as useContext20,
|
|
40823
40819
|
useEffect as useEffect17,
|
|
40824
|
-
useMemo as
|
|
40820
|
+
useMemo as useMemo18,
|
|
40825
40821
|
useRef as useRef14,
|
|
40826
40822
|
useState as useState22
|
|
40827
40823
|
} from "react";
|
|
@@ -41322,7 +41318,7 @@ var FilterPopoverWrapper = ({
|
|
|
41322
41318
|
const [uniqueValues, setUniqueValues] = useState22(void 0);
|
|
41323
41319
|
const [uniqueValuesIsLoading, setUniqueValuesIsLoading] = useState22(false);
|
|
41324
41320
|
const prevFiltersRef = useRef14("");
|
|
41325
|
-
const columnInternals =
|
|
41321
|
+
const columnInternals = useMemo18(() => {
|
|
41326
41322
|
if (!tables) {
|
|
41327
41323
|
return null;
|
|
41328
41324
|
}
|
|
@@ -41406,7 +41402,7 @@ var FilterPopoverWrapper = ({
|
|
|
41406
41402
|
|
|
41407
41403
|
// src/components/ReportBuilder/FilterModal.tsx
|
|
41408
41404
|
init_Filter();
|
|
41409
|
-
import { useState as useState23, useEffect as useEffect18, useMemo as
|
|
41405
|
+
import { useState as useState23, useEffect as useEffect18, useMemo as useMemo19 } from "react";
|
|
41410
41406
|
init_textProcessing();
|
|
41411
41407
|
init_filterProcessing();
|
|
41412
41408
|
import { format as format8, isValid as isValid6, parse as parse4, startOfToday as startOfToday2 } from "date-fns";
|
|
@@ -41448,11 +41444,11 @@ function FilterModal({
|
|
|
41448
41444
|
);
|
|
41449
41445
|
const [filterInitialized, setFilterInitialized] = useState23(false);
|
|
41450
41446
|
const [table, setTable] = useState23(void 0);
|
|
41451
|
-
const memoizedFieldValuesMap =
|
|
41447
|
+
const memoizedFieldValuesMap = useMemo19(
|
|
41452
41448
|
() => fieldValuesMap,
|
|
41453
41449
|
[JSON.stringify(fieldValuesMap)]
|
|
41454
41450
|
);
|
|
41455
|
-
const memoizedFilter =
|
|
41451
|
+
const memoizedFilter = useMemo19(() => filter, [JSON.stringify(filter)]);
|
|
41456
41452
|
useEffect18(() => {
|
|
41457
41453
|
if (!filter) {
|
|
41458
41454
|
onFieldChange(field, fieldOptions, table);
|
|
@@ -42477,7 +42473,7 @@ function DashboardLegacy({
|
|
|
42477
42473
|
}) {
|
|
42478
42474
|
const [userFilters, setUserFilters] = useState26({});
|
|
42479
42475
|
const [selectedSection, setSelectedSection] = useState26("");
|
|
42480
|
-
const dataLoaderUserFilters =
|
|
42476
|
+
const dataLoaderUserFilters = useMemo20(() => {
|
|
42481
42477
|
return (filters?.map((f) => convertCustomFilter(f)) ?? []).concat(
|
|
42482
42478
|
Object.values(userFilters)
|
|
42483
42479
|
);
|
|
@@ -42500,7 +42496,7 @@ function DashboardLegacy({
|
|
|
42500
42496
|
const { getToken } = useContext21(FetchContext);
|
|
42501
42497
|
const { customFilterDispatch } = useContext21(DashboardFiltersContext);
|
|
42502
42498
|
const { eventTracking } = useContext21(EventTrackingContext);
|
|
42503
|
-
const metrics =
|
|
42499
|
+
const metrics = useMemo20(() => {
|
|
42504
42500
|
const map = {};
|
|
42505
42501
|
Object.keys(data?.sections ?? {}).forEach((section) => {
|
|
42506
42502
|
if (!data?.sections?.[section]) return;
|
|
@@ -42528,7 +42524,7 @@ function DashboardLegacy({
|
|
|
42528
42524
|
});
|
|
42529
42525
|
return map;
|
|
42530
42526
|
}, [data?.sections, data?.sectionOrder]);
|
|
42531
|
-
const charts =
|
|
42527
|
+
const charts = useMemo20(() => {
|
|
42532
42528
|
const map = {};
|
|
42533
42529
|
Object.keys(data?.sections ?? {}).forEach((section) => {
|
|
42534
42530
|
if (!data?.sections?.[section]) return;
|
|
@@ -42554,7 +42550,7 @@ function DashboardLegacy({
|
|
|
42554
42550
|
});
|
|
42555
42551
|
return map;
|
|
42556
42552
|
}, [data?.sections, data?.sectionOrder]);
|
|
42557
|
-
const tables =
|
|
42553
|
+
const tables = useMemo20(() => {
|
|
42558
42554
|
const map = {};
|
|
42559
42555
|
Object.keys(data?.sections ?? {}).forEach((section) => {
|
|
42560
42556
|
if (!data?.sections?.[section]) return;
|
|
@@ -42615,7 +42611,7 @@ function DashboardLegacy({
|
|
|
42615
42611
|
filterListAddFilterPopoverIsOpen,
|
|
42616
42612
|
setFilterListAddFilterPopoverIsOpen
|
|
42617
42613
|
] = useState26(false);
|
|
42618
|
-
const presetOptions =
|
|
42614
|
+
const presetOptions = useMemo20(() => {
|
|
42619
42615
|
return populatedDashboardFilters?.[0]?.filterType === "date_range" ? convertPresetOptionsToSelectableList(
|
|
42620
42616
|
populatedDashboardFilters[0].presetOptions ?? [],
|
|
42621
42617
|
populatedDashboardFilters[0].defaultPresetRanges ?? []
|
|
@@ -42632,7 +42628,7 @@ function DashboardLegacy({
|
|
|
42632
42628
|
previousFilters.current = filters;
|
|
42633
42629
|
}
|
|
42634
42630
|
const isInitialLoadOfDashboardRef = useRef15(false);
|
|
42635
|
-
const referencedTables =
|
|
42631
|
+
const referencedTables = useMemo20(() => {
|
|
42636
42632
|
const sections = data?.sections || {};
|
|
42637
42633
|
const tables2 = Object.values(sections).flatMap(
|
|
42638
42634
|
(section) => section.map((chart) => chart.referencedTables)
|
|
@@ -43667,11 +43663,11 @@ function QuillDashboardTemplate({
|
|
|
43667
43663
|
}
|
|
43668
43664
|
|
|
43669
43665
|
// src/Dashboard.tsx
|
|
43670
|
-
import { useContext as useContext22, useMemo as
|
|
43666
|
+
import { useContext as useContext22, useMemo as useMemo22 } from "react";
|
|
43671
43667
|
init_Filter();
|
|
43672
43668
|
|
|
43673
43669
|
// src/StaticChart.tsx
|
|
43674
|
-
import { useMemo as
|
|
43670
|
+
import { useMemo as useMemo21 } from "react";
|
|
43675
43671
|
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
43676
43672
|
var CHART_TYPE_STYLES = {
|
|
43677
43673
|
metric: { height: "100px", width: "200px" },
|
|
@@ -43686,6 +43682,7 @@ function StaticChart(props) {
|
|
|
43686
43682
|
onClickLegendElement,
|
|
43687
43683
|
containerStyle,
|
|
43688
43684
|
showLegend,
|
|
43685
|
+
showAnimation,
|
|
43689
43686
|
className,
|
|
43690
43687
|
hideTableChartOuterBorder = true
|
|
43691
43688
|
} = props;
|
|
@@ -43723,7 +43720,7 @@ function StaticChart(props) {
|
|
|
43723
43720
|
});
|
|
43724
43721
|
};
|
|
43725
43722
|
const useLocalPivotTablePagination = isDashboardPivotTable(report);
|
|
43726
|
-
const config =
|
|
43723
|
+
const config = useMemo21(() => {
|
|
43727
43724
|
return report ? {
|
|
43728
43725
|
...report,
|
|
43729
43726
|
...useLocalPivotTablePagination ? { pagination: void 0 } : {},
|
|
@@ -43744,6 +43741,7 @@ function StaticChart(props) {
|
|
|
43744
43741
|
className,
|
|
43745
43742
|
containerStyle: safeContainerStyle,
|
|
43746
43743
|
showLegend,
|
|
43744
|
+
isAnimationActive: showAnimation,
|
|
43747
43745
|
onPageChange: useLocalPivotTablePagination ? void 0 : onPageChange,
|
|
43748
43746
|
tableRowsLoading: useLocalPivotTablePagination ? false : pageLoading,
|
|
43749
43747
|
onSortChange: useLocalPivotTablePagination ? void 0 : onSortChange,
|
|
@@ -44094,11 +44092,11 @@ function Dashboard({
|
|
|
44094
44092
|
EmptyDashboardComponent
|
|
44095
44093
|
}) {
|
|
44096
44094
|
const [themeFromContext] = useContext22(ThemeContext);
|
|
44097
|
-
const theme =
|
|
44095
|
+
const theme = useMemo22(
|
|
44098
44096
|
() => ({ ...defaultQuillTheme, ...themeFromContext ?? {} }),
|
|
44099
44097
|
[themeFromContext]
|
|
44100
44098
|
);
|
|
44101
|
-
const themedStyles =
|
|
44099
|
+
const themedStyles = useMemo22(() => getThemedStyles(theme), [theme]);
|
|
44102
44100
|
const { sections, sectionOrder, isLoading, filters, applyFilters } = useDashboard(name2);
|
|
44103
44101
|
const toValidDate = (value) => {
|
|
44104
44102
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -44300,11 +44298,11 @@ function DashboardContent({
|
|
|
44300
44298
|
const capitalized = name2.charAt(0).toUpperCase() + name2.slice(1);
|
|
44301
44299
|
return sections[capitalized] ?? [];
|
|
44302
44300
|
};
|
|
44303
|
-
const rootSectionReports =
|
|
44301
|
+
const rootSectionReports = useMemo22(
|
|
44304
44302
|
() => [...getSection("")].sort(sortByOrdering2),
|
|
44305
44303
|
[sections]
|
|
44306
44304
|
);
|
|
44307
|
-
const { chartReports, metricReports, tableReports } =
|
|
44305
|
+
const { chartReports, metricReports, tableReports } = useMemo22(() => {
|
|
44308
44306
|
const metricReports2 = rootSectionReports.filter(
|
|
44309
44307
|
({ chartType }) => chartType === "metric"
|
|
44310
44308
|
);
|
|
@@ -44316,7 +44314,7 @@ function DashboardContent({
|
|
|
44316
44314
|
);
|
|
44317
44315
|
return { chartReports: chartReports2, metricReports: metricReports2, tableReports: tableReports2 };
|
|
44318
44316
|
}, [rootSectionReports]);
|
|
44319
|
-
const orderedNonRootSectionEntries =
|
|
44317
|
+
const orderedNonRootSectionEntries = useMemo22(() => {
|
|
44320
44318
|
const sectionEntries = Object.entries(sections ?? {}).filter(
|
|
44321
44319
|
([sectionName, reports]) => sectionName !== "" && reports.length > 0
|
|
44322
44320
|
);
|
|
@@ -44513,7 +44511,7 @@ var QuillProvider_default = QuillProvider;
|
|
|
44513
44511
|
import {
|
|
44514
44512
|
useContext as useContext23,
|
|
44515
44513
|
useEffect as useEffect20,
|
|
44516
|
-
useMemo as
|
|
44514
|
+
useMemo as useMemo23,
|
|
44517
44515
|
useState as useState27
|
|
44518
44516
|
} from "react";
|
|
44519
44517
|
init_Filter();
|
|
@@ -44533,17 +44531,17 @@ var Table = ({
|
|
|
44533
44531
|
const { eventTracking } = useContext23(EventTrackingContext);
|
|
44534
44532
|
const { allReportsById } = useAllReports();
|
|
44535
44533
|
const [loading, setLoading] = useState27(false);
|
|
44536
|
-
const report =
|
|
44534
|
+
const report = useMemo23(() => {
|
|
44537
44535
|
return props.reportId ? allReportsById[props.reportId] : null;
|
|
44538
44536
|
}, [allReportsById[props.reportId ?? ""]]);
|
|
44539
44537
|
const { reportFilters, customReportFilters, reportFiltersDispatch } = useContext23(ReportFiltersContext);
|
|
44540
44538
|
const { reports, fetchIndividualReport, reportsDispatch } = useContext23(ReportsContext);
|
|
44541
|
-
const specificReportFilters =
|
|
44539
|
+
const specificReportFilters = useMemo23(() => {
|
|
44542
44540
|
return Object.values(
|
|
44543
44541
|
reportFilters[props.reportId ?? ""] ?? (dashboard[report?.dashboardName ?? ""]?.[report?.id ?? ""] ? dashboardFilters[report.dashboardName] : null) ?? {}
|
|
44544
44542
|
).map((f) => f.filter);
|
|
44545
44543
|
}, [reportFilters[props.reportId ?? ""]]);
|
|
44546
|
-
const userFilters =
|
|
44544
|
+
const userFilters = useMemo23(() => {
|
|
44547
44545
|
return (props.filters?.filter((f) => f.filterType !== "date" /* Date */)?.map(convertCustomFilter) ?? []).concat(
|
|
44548
44546
|
customReportFilters[props.reportId ?? ""] ?? dashboardCustomFilters[report?.dashboardName ?? ""] ?? []
|
|
44549
44547
|
);
|
|
@@ -44699,7 +44697,7 @@ import {
|
|
|
44699
44697
|
useContext as useContext30,
|
|
44700
44698
|
useEffect as useEffect25,
|
|
44701
44699
|
useRef as useRef20,
|
|
44702
|
-
useMemo as
|
|
44700
|
+
useMemo as useMemo28,
|
|
44703
44701
|
useCallback as useCallback4
|
|
44704
44702
|
} from "react";
|
|
44705
44703
|
import MonacoEditor from "@monaco-editor/react";
|
|
@@ -44710,7 +44708,7 @@ import {
|
|
|
44710
44708
|
useRef as useRef19,
|
|
44711
44709
|
useState as useState31,
|
|
44712
44710
|
useContext as useContext28,
|
|
44713
|
-
useMemo as
|
|
44711
|
+
useMemo as useMemo27,
|
|
44714
44712
|
useCallback as useCallback3
|
|
44715
44713
|
} from "react";
|
|
44716
44714
|
import {
|
|
@@ -44734,7 +44732,7 @@ import { CSS as DND_CSS } from "@dnd-kit/utilities";
|
|
|
44734
44732
|
import {
|
|
44735
44733
|
useCallback as useCallback2,
|
|
44736
44734
|
useContext as useContext25,
|
|
44737
|
-
useMemo as
|
|
44735
|
+
useMemo as useMemo24,
|
|
44738
44736
|
useState as useState28,
|
|
44739
44737
|
useEffect as useEffect21,
|
|
44740
44738
|
useRef as useRef16
|
|
@@ -45242,13 +45240,13 @@ var PivotModal = ({
|
|
|
45242
45240
|
"bottom"
|
|
45243
45241
|
);
|
|
45244
45242
|
const popoverRef = useRef16(null);
|
|
45245
|
-
const columnsToShow =
|
|
45243
|
+
const columnsToShow = useMemo24(() => {
|
|
45246
45244
|
return (columns || []).reduce((map, col) => {
|
|
45247
45245
|
map[col.field] = col.format;
|
|
45248
45246
|
return map;
|
|
45249
45247
|
}, {});
|
|
45250
45248
|
}, [columns]);
|
|
45251
|
-
const columnTypes =
|
|
45249
|
+
const columnTypes = useMemo24(() => {
|
|
45252
45250
|
return (columns || []).reduce((map, col) => {
|
|
45253
45251
|
map[col.field] = col.jsType;
|
|
45254
45252
|
return map;
|
|
@@ -46981,7 +46979,7 @@ import {
|
|
|
46981
46979
|
useState as useState29,
|
|
46982
46980
|
useEffect as useEffect22,
|
|
46983
46981
|
useContext as useContext26,
|
|
46984
|
-
useMemo as
|
|
46982
|
+
useMemo as useMemo25,
|
|
46985
46983
|
useRef as useRef17,
|
|
46986
46984
|
useLayoutEffect as useLayoutEffect3
|
|
46987
46985
|
} from "react";
|
|
@@ -47105,7 +47103,7 @@ function InternalChart({
|
|
|
47105
47103
|
const { eventTracking } = useContext26(EventTrackingContext);
|
|
47106
47104
|
const [filtersPopoverOpen, setFiltersPopoverOpen] = useState29(false);
|
|
47107
47105
|
const filtersButtonRef = useRef17(null);
|
|
47108
|
-
const currentReportFilters =
|
|
47106
|
+
const currentReportFilters = useMemo25(() => {
|
|
47109
47107
|
const dashFilters = dashboardConfig[report?.dashboardName ?? ""]?.config.filters;
|
|
47110
47108
|
if (!dashFilters)
|
|
47111
47109
|
return Object.values(reportFilters[report?.id ?? TEMP_REPORT_ID] ?? {});
|
|
@@ -47121,12 +47119,12 @@ function InternalChart({
|
|
|
47121
47119
|
}
|
|
47122
47120
|
});
|
|
47123
47121
|
}, [reportFilters, report?.id]);
|
|
47124
|
-
const reportDateFilter =
|
|
47122
|
+
const reportDateFilter = useMemo25(() => {
|
|
47125
47123
|
return Object.values(
|
|
47126
47124
|
reportFilters[report?.id ?? TEMP_REPORT_ID] ?? {}
|
|
47127
47125
|
).find((f) => f.filter.filterType === "date_range")?.filter;
|
|
47128
47126
|
}, [reportFilters, report?.id]);
|
|
47129
|
-
const presetOptions =
|
|
47127
|
+
const presetOptions = useMemo25(() => {
|
|
47130
47128
|
return reportDateFilter ? convertPresetOptionsToSelectableList(
|
|
47131
47129
|
reportDateFilter.presetOptions ?? [],
|
|
47132
47130
|
reportDateFilter.defaultPresetRanges ?? []
|
|
@@ -47173,7 +47171,7 @@ function InternalChart({
|
|
|
47173
47171
|
}
|
|
47174
47172
|
}, [filters]);
|
|
47175
47173
|
const [theme] = useContext26(ThemeContext);
|
|
47176
|
-
const colorMap =
|
|
47174
|
+
const colorMap = useMemo25(() => {
|
|
47177
47175
|
if (mapColorsToFields && report && theme) {
|
|
47178
47176
|
return mapColorsToFields(report, theme);
|
|
47179
47177
|
}
|
|
@@ -47298,7 +47296,7 @@ function InternalChart({
|
|
|
47298
47296
|
const [filtersExpanded, setFiltersExpanded] = useState29(false);
|
|
47299
47297
|
const filtersContainerRef = useRef17(null);
|
|
47300
47298
|
const [visibleFilters, setVisibleFilters] = useState29([]);
|
|
47301
|
-
const filtersOverflowing =
|
|
47299
|
+
const filtersOverflowing = useMemo25(() => {
|
|
47302
47300
|
return visibleFilters.some((visible) => visible);
|
|
47303
47301
|
}, [visibleFilters]);
|
|
47304
47302
|
const measureItems = () => {
|
|
@@ -47561,7 +47559,7 @@ init_dates();
|
|
|
47561
47559
|
// src/components/QuillMultiSelectSectionList.tsx
|
|
47562
47560
|
import React16, {
|
|
47563
47561
|
useContext as useContext27,
|
|
47564
|
-
useMemo as
|
|
47562
|
+
useMemo as useMemo26,
|
|
47565
47563
|
useRef as useRef18,
|
|
47566
47564
|
useState as useState30
|
|
47567
47565
|
} from "react";
|
|
@@ -47635,7 +47633,7 @@ function QuillMultiSelectSectionList({
|
|
|
47635
47633
|
const filteredLength = React16.useMemo(() => {
|
|
47636
47634
|
return Object.values(filteredItems).reduce((a, b) => a + b.length, 0);
|
|
47637
47635
|
}, [filteredItems]);
|
|
47638
|
-
const selectedOptionsLabel =
|
|
47636
|
+
const selectedOptionsLabel = useMemo26(() => {
|
|
47639
47637
|
const valuesLength = Object.values(value).reduce((a, b) => a + b.length, 0);
|
|
47640
47638
|
if (!valuesLength) {
|
|
47641
47639
|
return "Select";
|
|
@@ -48499,11 +48497,11 @@ function ChartBuilder({
|
|
|
48499
48497
|
const { dashboardConfig } = useContext28(DashboardConfigContext);
|
|
48500
48498
|
const { tenants, flags } = useContext28(TenantContext);
|
|
48501
48499
|
const isReportLoading = reportId && !tempReport && reportsLoadingState[reportId];
|
|
48502
|
-
const report =
|
|
48500
|
+
const report = useMemo27(() => {
|
|
48503
48501
|
const resolvedReport = reportId && !tempReport ? allReportsById[reportId] : tempReport;
|
|
48504
48502
|
return resolvedReport;
|
|
48505
48503
|
}, [reportId, tempReport, allReportsById]);
|
|
48506
|
-
const reportFieldsByName =
|
|
48504
|
+
const reportFieldsByName = useMemo27(() => {
|
|
48507
48505
|
const fields = report?.fields;
|
|
48508
48506
|
if (!fields || fields.length === 0) {
|
|
48509
48507
|
return {};
|
|
@@ -48603,7 +48601,7 @@ function ChartBuilder({
|
|
|
48603
48601
|
const modalPadding = 20;
|
|
48604
48602
|
const deleteButtonMargin = -12;
|
|
48605
48603
|
const { dashboardFilters } = useContext28(DashboardFiltersContext);
|
|
48606
|
-
const specificDashboardFilters =
|
|
48604
|
+
const specificDashboardFilters = useMemo27(() => {
|
|
48607
48605
|
return Object.values(
|
|
48608
48606
|
dashboardFilters[report?.dashboardName ?? ""] ?? {}
|
|
48609
48607
|
).map((f) => f.filter);
|
|
@@ -48654,7 +48652,7 @@ function ChartBuilder({
|
|
|
48654
48652
|
const { reportsDispatch } = useContext28(ReportsContext);
|
|
48655
48653
|
const initialFilters = useRef19(reportFilters[report?.id ?? TEMP_REPORT_ID]);
|
|
48656
48654
|
const [reportFiltersLoaded, setReportFiltersLoaded] = useState31(!filtersEnabled);
|
|
48657
|
-
const hasExistingData =
|
|
48655
|
+
const hasExistingData = useMemo27(() => {
|
|
48658
48656
|
return report?.rows && report.rows.length > 0 || report?.pivotRows && report.pivotRows.length > 0;
|
|
48659
48657
|
}, [report?.rows, report?.pivotRows]);
|
|
48660
48658
|
useEffect23(() => {
|
|
@@ -48685,7 +48683,7 @@ function ChartBuilder({
|
|
|
48685
48683
|
}
|
|
48686
48684
|
};
|
|
48687
48685
|
}, []);
|
|
48688
|
-
const currentDashboardFilters =
|
|
48686
|
+
const currentDashboardFilters = useMemo27(() => {
|
|
48689
48687
|
return Object.values(reportFilters[report?.id ?? TEMP_REPORT_ID] ?? {}).map(
|
|
48690
48688
|
(f) => f.filter
|
|
48691
48689
|
);
|
|
@@ -48763,14 +48761,14 @@ function ChartBuilder({
|
|
|
48763
48761
|
const [referencedColumnsWithoutStar, setReferencedColumnsWithoutStar] = useState31({});
|
|
48764
48762
|
const [referencedTablesLoaded, setReferencedTablesLoaded] = useState31(false);
|
|
48765
48763
|
const [filterMap, setFilterMap] = useState31(report?.filterMap ?? {});
|
|
48766
|
-
const canonicalFilterMap =
|
|
48764
|
+
const canonicalFilterMap = useMemo27(() => {
|
|
48767
48765
|
return Object.fromEntries(
|
|
48768
48766
|
Object.entries(filterMap).filter(
|
|
48769
48767
|
(f) => f[1].table !== void 0 && f[1].field !== void 0
|
|
48770
48768
|
)
|
|
48771
48769
|
);
|
|
48772
48770
|
}, [filterMap]);
|
|
48773
|
-
const validFilter =
|
|
48771
|
+
const validFilter = useMemo27(() => {
|
|
48774
48772
|
return specificDashboardFilters.reduce(
|
|
48775
48773
|
(acc, filter) => {
|
|
48776
48774
|
if (filter.filterType === "date_range" || filter.filterType === "tenant" || !referencedTablesLoaded) {
|
|
@@ -48996,12 +48994,12 @@ function ChartBuilder({
|
|
|
48996
48994
|
const [formData, setFormData] = useState31(
|
|
48997
48995
|
formFormDataFromReport(report, destinationSection ?? getCurrentSection())
|
|
48998
48996
|
);
|
|
48999
|
-
const reportCustomFields =
|
|
48997
|
+
const reportCustomFields = useMemo27(() => {
|
|
49000
48998
|
return report?.columnsWithCustomFields?.filter(
|
|
49001
48999
|
(col) => !report?.columns?.some((c) => col.field === c.field)
|
|
49002
49000
|
) ?? [];
|
|
49003
49001
|
}, [report?.columnsWithCustomFields, report?.columns]);
|
|
49004
|
-
const referenceLineQueryResults =
|
|
49002
|
+
const referenceLineQueryResults = useMemo27(() => {
|
|
49005
49003
|
return formData?.referenceLines?.map((line) => {
|
|
49006
49004
|
if (line.label === REFERENCE_LINE) {
|
|
49007
49005
|
return [Number(line.y1) || 0, Number(line.y2) || 0];
|
|
@@ -49015,10 +49013,10 @@ function ChartBuilder({
|
|
|
49015
49013
|
);
|
|
49016
49014
|
});
|
|
49017
49015
|
}, [formData?.referenceLines]);
|
|
49018
|
-
const currentDashboard =
|
|
49016
|
+
const currentDashboard = useMemo27(() => {
|
|
49019
49017
|
return dashboardConfig[formData.dashboardName ?? report?.dashboardName ?? ""]?.config;
|
|
49020
49018
|
}, [dashboardConfig, formData.dashboardName, report?.dashboardName]);
|
|
49021
|
-
const currentDashboardTenants =
|
|
49019
|
+
const currentDashboardTenants = useMemo27(() => {
|
|
49022
49020
|
return currentDashboard?.tenantKeys?.map(
|
|
49023
49021
|
(tenantKey) => client?.allTenantTypes?.find(
|
|
49024
49022
|
(t) => t.tenantField === tenantKey
|
|
@@ -49026,7 +49024,7 @@ function ChartBuilder({
|
|
|
49026
49024
|
) ?? [];
|
|
49027
49025
|
}, [client?.allTenantTypes, currentDashboard?.tenantKeys]);
|
|
49028
49026
|
const dashboardOwner = currentDashboardTenants?.[0];
|
|
49029
|
-
const currentTenantAsFormFlags =
|
|
49027
|
+
const currentTenantAsFormFlags = useMemo27(() => {
|
|
49030
49028
|
if (!tenants || !tenants.length) {
|
|
49031
49029
|
return void 0;
|
|
49032
49030
|
}
|
|
@@ -49037,7 +49035,7 @@ function ChartBuilder({
|
|
|
49037
49035
|
const tenantIds = typeof tenants[0] !== "object" ? tenants : tenants[0]?.tenantIds;
|
|
49038
49036
|
return { [tenantField]: tenantIds };
|
|
49039
49037
|
}, [tenants, dashboardOwner]);
|
|
49040
|
-
const invalidColumns =
|
|
49038
|
+
const invalidColumns = useMemo27(() => {
|
|
49041
49039
|
if (!rows || !rows.length) {
|
|
49042
49040
|
return [];
|
|
49043
49041
|
}
|
|
@@ -49059,7 +49057,7 @@ function ChartBuilder({
|
|
|
49059
49057
|
);
|
|
49060
49058
|
})()
|
|
49061
49059
|
);
|
|
49062
|
-
const reportContainsCustomFields =
|
|
49060
|
+
const reportContainsCustomFields = useMemo27(() => {
|
|
49063
49061
|
const customFieldsMap = schemaData.customFields;
|
|
49064
49062
|
const reportQueryContainsCustomFields = allTables.some((table) => {
|
|
49065
49063
|
const tableColumns = referencedColumnsWithoutStar[table] ?? [];
|
|
@@ -49070,7 +49068,7 @@ function ChartBuilder({
|
|
|
49070
49068
|
});
|
|
49071
49069
|
return reportQueryContainsCustomFields;
|
|
49072
49070
|
}, [allTables, referencedColumnsWithoutStar]);
|
|
49073
|
-
const chartBuilderFormDataContainsCustomFields =
|
|
49071
|
+
const chartBuilderFormDataContainsCustomFields = useMemo27(() => {
|
|
49074
49072
|
const customFields = allTables.map((table) => schemaData.customFields?.[table] ?? []).flat();
|
|
49075
49073
|
const customFieldsMap = schemaData.customFields;
|
|
49076
49074
|
const pivotContainsCustomFields = customFields.some(
|
|
@@ -49103,13 +49101,13 @@ function ChartBuilder({
|
|
|
49103
49101
|
formData.dateField,
|
|
49104
49102
|
canonicalFilterMap
|
|
49105
49103
|
]);
|
|
49106
|
-
const customFieldsInTabularColumns =
|
|
49104
|
+
const customFieldsInTabularColumns = useMemo27(() => {
|
|
49107
49105
|
const customFields = allTables.map((table) => schemaData.customFields?.[table] ?? []).flat();
|
|
49108
49106
|
return formData.columns.some((col) => {
|
|
49109
49107
|
return customFields.some((field) => field.field === col.field);
|
|
49110
49108
|
});
|
|
49111
49109
|
}, [allTables, formData.columns]);
|
|
49112
|
-
const containsCustomFields =
|
|
49110
|
+
const containsCustomFields = useMemo27(() => {
|
|
49113
49111
|
return reportContainsCustomFields || customFieldsInTabularColumns || chartBuilderFormDataContainsCustomFields;
|
|
49114
49112
|
}, [
|
|
49115
49113
|
reportContainsCustomFields,
|
|
@@ -49282,7 +49280,7 @@ function ChartBuilder({
|
|
|
49282
49280
|
handleRunQuery(baseProcessing, currentDashboardFilters);
|
|
49283
49281
|
}
|
|
49284
49282
|
}, [runQueryOnMount, reportFiltersLoaded, filtersEnabled]);
|
|
49285
|
-
const allTenantMap =
|
|
49283
|
+
const allTenantMap = useMemo27(() => {
|
|
49286
49284
|
return client?.allTenantTypes?.reduce(
|
|
49287
49285
|
(acc, tenantType) => {
|
|
49288
49286
|
if (tenantType.scope === "database") {
|
|
@@ -49322,14 +49320,14 @@ function ChartBuilder({
|
|
|
49322
49320
|
},
|
|
49323
49321
|
[columns, selectedPivotTable]
|
|
49324
49322
|
);
|
|
49325
|
-
const pivotCardTable =
|
|
49323
|
+
const pivotCardTable = useMemo27(() => {
|
|
49326
49324
|
return {
|
|
49327
49325
|
pivot: formData.pivot,
|
|
49328
49326
|
rows: selectedPivotTable?.rows ?? [],
|
|
49329
49327
|
columns: selectedPivotTable?.columns ?? []
|
|
49330
49328
|
};
|
|
49331
49329
|
}, [selectedPivotTable, formData.pivot]);
|
|
49332
|
-
const chartData =
|
|
49330
|
+
const chartData = useMemo27(() => {
|
|
49333
49331
|
const data = createReportFromForm(
|
|
49334
49332
|
formData,
|
|
49335
49333
|
report ? { ...report, rowCount } : tempReport,
|
|
@@ -49351,7 +49349,7 @@ function ChartBuilder({
|
|
|
49351
49349
|
rowCount,
|
|
49352
49350
|
currentDashboardFilters
|
|
49353
49351
|
]);
|
|
49354
|
-
const xAxisFormatOptions =
|
|
49352
|
+
const xAxisFormatOptions = useMemo27(() => {
|
|
49355
49353
|
return chartData?.chartType === "gauge" ? [
|
|
49356
49354
|
{ value: "whole_number", label: "whole number" },
|
|
49357
49355
|
{ value: "two_decimal_places", label: "two decimal places" },
|
|
@@ -49415,7 +49413,7 @@ function ChartBuilder({
|
|
|
49415
49413
|
setSelectedPivotTable(void 0);
|
|
49416
49414
|
}
|
|
49417
49415
|
};
|
|
49418
|
-
const formattedRows =
|
|
49416
|
+
const formattedRows = useMemo27(() => {
|
|
49419
49417
|
const shouldUsePivotTableRows = selectedPivotTable && selectedPivotTable.columns && formData.chartType === "table";
|
|
49420
49418
|
if (shouldUsePivotTableRows) {
|
|
49421
49419
|
const columns2 = selectedPivotTable.columns;
|
|
@@ -50102,7 +50100,7 @@ function ChartBuilder({
|
|
|
50102
50100
|
setIsSubmitting(false);
|
|
50103
50101
|
setTriggeredEditChart(false);
|
|
50104
50102
|
};
|
|
50105
|
-
const memoizedTooltipText =
|
|
50103
|
+
const memoizedTooltipText = useMemo27(() => {
|
|
50106
50104
|
const getTooltipText = () => {
|
|
50107
50105
|
if (formData.name === "") {
|
|
50108
50106
|
return "Please enter a name for the chart";
|
|
@@ -52536,7 +52534,7 @@ function SQLEditor({
|
|
|
52536
52534
|
const { getToken, quillFetchWithToken } = useContext30(FetchContext);
|
|
52537
52535
|
const { eventTracking } = useContext30(EventTrackingContext);
|
|
52538
52536
|
const { allReportsById } = useAllReports();
|
|
52539
|
-
const destinationDashboardConfig =
|
|
52537
|
+
const destinationDashboardConfig = useMemo28(() => {
|
|
52540
52538
|
return dashboards?.find((d) => d.name === destinationDashboard);
|
|
52541
52539
|
}, [dashboards, destinationDashboard]);
|
|
52542
52540
|
const [query, setQuery] = useState33(defaultQuery);
|
|
@@ -52544,7 +52542,7 @@ function SQLEditor({
|
|
|
52544
52542
|
const [columns, setColumns] = useState33([]);
|
|
52545
52543
|
const [schemaData] = useContext30(SchemaDataContext);
|
|
52546
52544
|
const { dashboardFilters } = useContext30(DashboardFiltersContext);
|
|
52547
|
-
const specificDashboardFilters =
|
|
52545
|
+
const specificDashboardFilters = useMemo28(() => {
|
|
52548
52546
|
return Object.values(
|
|
52549
52547
|
dashboardFilters[report?.dashboardName ?? destinationDashboard ?? ""] ?? {}
|
|
52550
52548
|
).map((f) => f.filter);
|
|
@@ -52582,7 +52580,7 @@ function SQLEditor({
|
|
|
52582
52580
|
const DEFAULT_ROWS_PER_PAGE = 5;
|
|
52583
52581
|
const ROW_HEIGHT = 37;
|
|
52584
52582
|
const TABLE_TAB_HEIGHT = 75;
|
|
52585
|
-
const filteredSchema =
|
|
52583
|
+
const filteredSchema = useMemo28(() => {
|
|
52586
52584
|
return schemaData.schemaWithCustomFields?.filter((table) => {
|
|
52587
52585
|
return destinationDashboardConfig?.tenantKeys?.[0] === SINGLE_TENANT || !table.ownerTenantFields || table.ownerTenantFields?.length === 0 || table.ownerTenantFields?.includes(
|
|
52588
52586
|
destinationDashboardConfig?.tenantKeys?.[0] ?? ""
|
|
@@ -52657,7 +52655,7 @@ function SQLEditor({
|
|
|
52657
52655
|
};
|
|
52658
52656
|
const [currentPage, setCurrentPage] = useState33(0);
|
|
52659
52657
|
const [currentSort, setCurrentSort] = useState33(void 0);
|
|
52660
|
-
const currentProcessing =
|
|
52658
|
+
const currentProcessing = useMemo28(() => {
|
|
52661
52659
|
return {
|
|
52662
52660
|
page: {
|
|
52663
52661
|
currentPage,
|
|
@@ -52670,7 +52668,7 @@ function SQLEditor({
|
|
|
52670
52668
|
sort: currentSort
|
|
52671
52669
|
};
|
|
52672
52670
|
}, [currentPage, rowsPerPage, currentSort]);
|
|
52673
|
-
const displayedTableData =
|
|
52671
|
+
const displayedTableData = useMemo28(() => {
|
|
52674
52672
|
return filteredSchema?.filter((table) => {
|
|
52675
52673
|
return table.name?.toLowerCase()?.includes(tableSearchQuery.toLowerCase().trim()) || table.columns.some(
|
|
52676
52674
|
(col) => col.field?.toLowerCase()?.includes(tableSearchQuery.toLowerCase().trim())
|
|
@@ -54057,7 +54055,7 @@ import {
|
|
|
54057
54055
|
init_constants();
|
|
54058
54056
|
|
|
54059
54057
|
// src/hooks/useReportBuilder.tsx
|
|
54060
|
-
import { useContext as useContext31, useEffect as useEffect26, useMemo as
|
|
54058
|
+
import { useContext as useContext31, useEffect as useEffect26, useMemo as useMemo29, useState as useState34 } from "react";
|
|
54061
54059
|
init_tableProcessing();
|
|
54062
54060
|
init_ReportBuilder();
|
|
54063
54061
|
init_constants();
|
|
@@ -54086,10 +54084,10 @@ var useReportBuilderInternal = ({
|
|
|
54086
54084
|
} = useDashboardInternal(destinationDashboard);
|
|
54087
54085
|
const { getToken, quillFetchWithToken } = useContext31(FetchContext);
|
|
54088
54086
|
const { eventTracking } = useContext31(EventTrackingContext);
|
|
54089
|
-
const destinationDashboardConfig =
|
|
54087
|
+
const destinationDashboardConfig = useMemo29(() => {
|
|
54090
54088
|
return dashboards?.find((d) => d.name === destinationDashboard);
|
|
54091
54089
|
}, [dashboards, destinationDashboard]);
|
|
54092
|
-
const filteredSchema =
|
|
54090
|
+
const filteredSchema = useMemo29(() => {
|
|
54093
54091
|
return schemaData.schemaWithCustomFields?.filter((table) => {
|
|
54094
54092
|
return destinationDashboardConfig?.tenantKeys?.[0] === SINGLE_TENANT || !table.ownerTenantFields || table.ownerTenantFields?.length === 0 || table.ownerTenantFields?.includes(
|
|
54095
54093
|
destinationDashboardConfig?.tenantKeys?.[0] ?? ""
|
|
@@ -54120,7 +54118,7 @@ var useReportBuilderInternal = ({
|
|
|
54120
54118
|
const [pivot, setPivot] = useState34(null);
|
|
54121
54119
|
const [sort, setSort] = useState34([]);
|
|
54122
54120
|
const [limit, setLimit] = useState34(null);
|
|
54123
|
-
const reportBuilderState =
|
|
54121
|
+
const reportBuilderState = useMemo29(() => {
|
|
54124
54122
|
return {
|
|
54125
54123
|
tables,
|
|
54126
54124
|
columns,
|
|
@@ -54152,7 +54150,7 @@ var useReportBuilderInternal = ({
|
|
|
54152
54150
|
const [pivotData, setPivotData] = useState34(null);
|
|
54153
54151
|
const [numberOfRows, setNumberOfRows] = useState34(0);
|
|
54154
54152
|
const [rowCountIsLoading, setRowCountIsLoading] = useState34(false);
|
|
54155
|
-
const reportColumnsToStateColumns =
|
|
54153
|
+
const reportColumnsToStateColumns = useMemo29(() => {
|
|
54156
54154
|
const positionMap = {};
|
|
54157
54155
|
columns.forEach((column, index) => {
|
|
54158
54156
|
positionMap[column.field] = index;
|
|
@@ -54206,7 +54204,7 @@ var useReportBuilderInternal = ({
|
|
|
54206
54204
|
origin: "ReportBuilder",
|
|
54207
54205
|
loadDescription: "Loading ask AI"
|
|
54208
54206
|
});
|
|
54209
|
-
const isSelectStar =
|
|
54207
|
+
const isSelectStar = useMemo29(() => {
|
|
54210
54208
|
if (tables.length === 1) {
|
|
54211
54209
|
const totalColumnLength = tables.reduce((acc, table) => {
|
|
54212
54210
|
const tableColumns = filteredSchema.find((t) => t.name === table.name)?.columns.length ?? 0;
|
|
@@ -54217,14 +54215,14 @@ var useReportBuilderInternal = ({
|
|
|
54217
54215
|
return false;
|
|
54218
54216
|
}
|
|
54219
54217
|
}, [tables, columns, filteredSchema]);
|
|
54220
|
-
const mssqlSortWarning =
|
|
54218
|
+
const mssqlSortWarning = useMemo29(() => {
|
|
54221
54219
|
if (!client || client?.databaseType !== "mssql") {
|
|
54222
54220
|
return void 0;
|
|
54223
54221
|
} else if (!pivot && !limit) {
|
|
54224
54222
|
return "Please add a limit.";
|
|
54225
54223
|
}
|
|
54226
54224
|
}, [client, limit, pivot]);
|
|
54227
|
-
const foreignKeyMap =
|
|
54225
|
+
const foreignKeyMap = useMemo29(() => {
|
|
54228
54226
|
return getSchemaForeignKeyMapping(filteredSchema);
|
|
54229
54227
|
}, [filteredSchema]);
|
|
54230
54228
|
const clearAllState = (resetStateStack = true) => {
|
|
@@ -55541,7 +55539,7 @@ var useReportBuilder = ({
|
|
|
55541
55539
|
reportBuilder.setAiPrompt(prompt);
|
|
55542
55540
|
await reportBuilder.fetchAstFromPromptHelper(prompt);
|
|
55543
55541
|
};
|
|
55544
|
-
const cleanedSchema =
|
|
55542
|
+
const cleanedSchema = useMemo29(() => {
|
|
55545
55543
|
return reportBuilder.filteredSchema.reduce(
|
|
55546
55544
|
(acc, table) => {
|
|
55547
55545
|
acc[table.name] = table.columns;
|
|
@@ -55550,7 +55548,7 @@ var useReportBuilder = ({
|
|
|
55550
55548
|
{}
|
|
55551
55549
|
);
|
|
55552
55550
|
}, [reportBuilder.filteredSchema]);
|
|
55553
|
-
const cleanedFilterStack =
|
|
55551
|
+
const cleanedFilterStack = useMemo29(() => {
|
|
55554
55552
|
return reportBuilder.filterStack.map((filter) => {
|
|
55555
55553
|
return filter.value ? convertInternalFilterToFilter(filter.value) : null;
|
|
55556
55554
|
}).filter((filter) => filter !== null);
|
|
@@ -55587,7 +55585,7 @@ var useReportBuilder = ({
|
|
|
55587
55585
|
init_ReportBuilder();
|
|
55588
55586
|
|
|
55589
55587
|
// src/components/ReportBuilder/AddColumnModal.tsx
|
|
55590
|
-
import { useState as useState35, useRef as useRef21, useMemo as
|
|
55588
|
+
import { useState as useState35, useRef as useRef21, useMemo as useMemo30, useEffect as useEffect27, useContext as useContext32 } from "react";
|
|
55591
55589
|
import {
|
|
55592
55590
|
DndContext as DndContext2,
|
|
55593
55591
|
closestCenter as closestCenter2,
|
|
@@ -55632,7 +55630,7 @@ function AddColumnModal({
|
|
|
55632
55630
|
const [modalSelectedColumns, setModalSelectedColumns] = useState35(
|
|
55633
55631
|
selectedColumns.map((col) => `${col.table}.${col.field}`)
|
|
55634
55632
|
);
|
|
55635
|
-
const columnOptions =
|
|
55633
|
+
const columnOptions = useMemo30(() => {
|
|
55636
55634
|
return schema.filter((table) => {
|
|
55637
55635
|
if (!primaryTable) return true;
|
|
55638
55636
|
return table.name === primaryTable || foreignKeyMap[primaryTable]?.some(
|
|
@@ -55658,7 +55656,7 @@ function AddColumnModal({
|
|
|
55658
55656
|
}, [schema, primaryTable]);
|
|
55659
55657
|
const [orderedColumnNames, setOrderedColumnNames] = useState35([]);
|
|
55660
55658
|
const isSelectedAllColumns = columnOptions.length === modalSelectedColumns.length;
|
|
55661
|
-
const searchResults =
|
|
55659
|
+
const searchResults = useMemo30(() => {
|
|
55662
55660
|
return orderedColumnNames.filter((column) => {
|
|
55663
55661
|
return columnOptions.includes(column) && (search.length === 0 || column.toLowerCase().includes(search.toLowerCase()) || snakeAndCamelCaseToTitleCase(column).toLowerCase().includes(search.toLowerCase()));
|
|
55664
55662
|
});
|
|
@@ -56034,7 +56032,7 @@ import {
|
|
|
56034
56032
|
sortableKeyboardCoordinates as sortableKeyboardCoordinates3,
|
|
56035
56033
|
verticalListSortingStrategy as verticalListSortingStrategy3
|
|
56036
56034
|
} from "@dnd-kit/sortable";
|
|
56037
|
-
import { useMemo as
|
|
56035
|
+
import { useMemo as useMemo31 } from "react";
|
|
56038
56036
|
import { jsx as jsx73, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
56039
56037
|
function DraggableColumns({
|
|
56040
56038
|
columns,
|
|
@@ -56048,7 +56046,7 @@ function DraggableColumns({
|
|
|
56048
56046
|
coordinateGetter: sortableKeyboardCoordinates3
|
|
56049
56047
|
})
|
|
56050
56048
|
);
|
|
56051
|
-
const columnNames =
|
|
56049
|
+
const columnNames = useMemo31(() => {
|
|
56052
56050
|
return columns.map(
|
|
56053
56051
|
(col) => `${col.table}.${col.alias ?? col.field}`
|
|
56054
56052
|
);
|
|
@@ -58589,7 +58587,7 @@ function ReportBuilder({
|
|
|
58589
58587
|
import {
|
|
58590
58588
|
useContext as useContext35,
|
|
58591
58589
|
useEffect as useEffect30,
|
|
58592
|
-
useMemo as
|
|
58590
|
+
useMemo as useMemo32,
|
|
58593
58591
|
useRef as useRef23,
|
|
58594
58592
|
useState as useState40
|
|
58595
58593
|
} from "react";
|
|
@@ -58644,7 +58642,7 @@ function ChartEditor({
|
|
|
58644
58642
|
const [modalHeight, setModalHeight] = useState40(200);
|
|
58645
58643
|
const { allReportsById } = useAllReports();
|
|
58646
58644
|
const report = allReportsById[reportId];
|
|
58647
|
-
const resolvedDashboard =
|
|
58645
|
+
const resolvedDashboard = useMemo32(
|
|
58648
58646
|
() => destinationDashboard ?? report?.dashboardName ?? null,
|
|
58649
58647
|
[destinationDashboard, report?.dashboardName]
|
|
58650
58648
|
);
|
|
@@ -58656,7 +58654,7 @@ function ChartEditor({
|
|
|
58656
58654
|
const { dashboardFilters } = useContext35(DashboardFiltersContext);
|
|
58657
58655
|
const { eventTracking } = useContext35(EventTrackingContext);
|
|
58658
58656
|
const { reload } = useDashboardInternal(resolvedDashboard);
|
|
58659
|
-
const specificDashboardFilters =
|
|
58657
|
+
const specificDashboardFilters = useMemo32(() => {
|
|
58660
58658
|
if (!report) {
|
|
58661
58659
|
return [];
|
|
58662
58660
|
}
|
|
@@ -58669,7 +58667,7 @@ function ChartEditor({
|
|
|
58669
58667
|
const dateFilter = Object.values(specificDashboardFilters).find(
|
|
58670
58668
|
(filter) => filter.filterType === "date_range"
|
|
58671
58669
|
);
|
|
58672
|
-
const dateRange =
|
|
58670
|
+
const dateRange = useMemo32(() => {
|
|
58673
58671
|
return dateFilter?.startDate ? { start: dateFilter.startDate, end: dateFilter.endDate } : void 0;
|
|
58674
58672
|
}, [dateFilter]);
|
|
58675
58673
|
useEffect30(() => {
|
|
@@ -58820,7 +58818,7 @@ function ChartEditor({
|
|
|
58820
58818
|
import { useContext as useContext37, useEffect as useEffect32, useRef as useRef25, useState as useState42 } from "react";
|
|
58821
58819
|
|
|
58822
58820
|
// src/ChatChartCard.tsx
|
|
58823
|
-
import { useMemo as
|
|
58821
|
+
import { useMemo as useMemo34 } from "react";
|
|
58824
58822
|
|
|
58825
58823
|
// src/hooks/useForm.tsx
|
|
58826
58824
|
init_Filter();
|
|
@@ -58830,7 +58828,7 @@ import {
|
|
|
58830
58828
|
useContext as useContext36,
|
|
58831
58829
|
useEffect as useEffect31,
|
|
58832
58830
|
useLayoutEffect as useLayoutEffect4,
|
|
58833
|
-
useMemo as
|
|
58831
|
+
useMemo as useMemo33,
|
|
58834
58832
|
useReducer as useReducer2,
|
|
58835
58833
|
useRef as useRef24,
|
|
58836
58834
|
useState as useState41
|
|
@@ -63654,7 +63652,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63654
63652
|
clientDefaultDashboardName,
|
|
63655
63653
|
destinationDashboardName
|
|
63656
63654
|
].map((entry) => String(entry ?? "").trim()).find((entry) => entry.length > 0) ?? "";
|
|
63657
|
-
const initialFormState =
|
|
63655
|
+
const initialFormState = useMemo33(
|
|
63658
63656
|
() => ({
|
|
63659
63657
|
reportName: void 0,
|
|
63660
63658
|
columns: [],
|
|
@@ -63704,13 +63702,13 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63704
63702
|
schemaDatasourceIds
|
|
63705
63703
|
} = formState;
|
|
63706
63704
|
const schemaDatasourceIdsKey = schemaDatasourceIds?.map((id) => String(id ?? "").trim()).join("\0") ?? "";
|
|
63707
|
-
const queryColumnsBootstrapKey =
|
|
63705
|
+
const queryColumnsBootstrapKey = useMemo33(
|
|
63708
63706
|
() => queryColumns.map(
|
|
63709
63707
|
(c) => `${String(c.table ?? "").trim()}\0${String(c.field ?? "").trim()}`
|
|
63710
63708
|
).join("\n"),
|
|
63711
63709
|
[queryColumns]
|
|
63712
63710
|
);
|
|
63713
|
-
const dashboardNameForNewReport =
|
|
63711
|
+
const dashboardNameForNewReport = useMemo33(() => {
|
|
63714
63712
|
return [clientDefaultDashboardName, destinationDashboardName].map((entry) => String(entry ?? "").trim()).find((entry) => entry.length > 0) ?? "";
|
|
63715
63713
|
}, [clientDefaultDashboardName, destinationDashboardName]);
|
|
63716
63714
|
const { mutate: createReport } = useMutation({
|
|
@@ -63784,16 +63782,16 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63784
63782
|
);
|
|
63785
63783
|
schemaScopeInitializedForReportIdRef.current = effectiveReportId;
|
|
63786
63784
|
};
|
|
63787
|
-
const internalFilters =
|
|
63785
|
+
const internalFilters = useMemo33(
|
|
63788
63786
|
() => internalFiltersFromFilterStack(filterStack),
|
|
63789
63787
|
[filterStack]
|
|
63790
63788
|
);
|
|
63791
|
-
const customFilters =
|
|
63789
|
+
const customFilters = useMemo33(
|
|
63792
63790
|
() => customFiltersFromFilterStack(filterStack),
|
|
63793
63791
|
[filterStack]
|
|
63794
63792
|
);
|
|
63795
|
-
const reloadKey =
|
|
63796
|
-
const schemaForReportBuilderState =
|
|
63793
|
+
const reloadKey = useMemo33(() => 0, []);
|
|
63794
|
+
const schemaForReportBuilderState = useMemo33(() => {
|
|
63797
63795
|
if (schemaData.schemaWithCustomFields?.length) {
|
|
63798
63796
|
return schemaData.schemaWithCustomFields;
|
|
63799
63797
|
}
|
|
@@ -63816,19 +63814,19 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63816
63814
|
},
|
|
63817
63815
|
[]
|
|
63818
63816
|
);
|
|
63819
|
-
const schemaForeignKeyMap =
|
|
63817
|
+
const schemaForeignKeyMap = useMemo33(
|
|
63820
63818
|
() => getSchemaForeignKeyMapping(schemaForReportBuilderState),
|
|
63821
63819
|
[schemaForReportBuilderState]
|
|
63822
63820
|
);
|
|
63823
63821
|
const reportBuilderBaseTableNamesKey = (sourceReport?.reportBuilderState?.tables ?? []).map((t) => String(t?.name ?? "").trim()).filter(Boolean).join("\0") ?? "";
|
|
63824
|
-
const selectedBaseTableNamesForFieldOptions =
|
|
63822
|
+
const selectedBaseTableNamesForFieldOptions = useMemo33(() => {
|
|
63825
63823
|
const fromPicker = schemaDatasourceIds?.map((id) => String(id ?? "").trim()).filter(Boolean) ?? [];
|
|
63826
63824
|
if (fromPicker.length > 0) {
|
|
63827
63825
|
return fromPicker;
|
|
63828
63826
|
}
|
|
63829
63827
|
return (sourceReport?.reportBuilderState?.tables ?? []).map((t) => String(t?.name ?? "").trim()).filter(Boolean);
|
|
63830
63828
|
}, [schemaDatasourceIdsKey, reportBuilderBaseTableNamesKey]);
|
|
63831
|
-
const fieldOptionsAllowedTableNames =
|
|
63829
|
+
const fieldOptionsAllowedTableNames = useMemo33(() => {
|
|
63832
63830
|
if (!restrictFieldOptionsToSelectedDatasources) {
|
|
63833
63831
|
return null;
|
|
63834
63832
|
}
|
|
@@ -63905,7 +63903,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63905
63903
|
schemaForReportBuilderState,
|
|
63906
63904
|
queryColumnsBootstrapKey
|
|
63907
63905
|
]);
|
|
63908
|
-
const datasourceOptions =
|
|
63906
|
+
const datasourceOptions = useMemo33(() => {
|
|
63909
63907
|
const seen = /* @__PURE__ */ new Set();
|
|
63910
63908
|
const result = [];
|
|
63911
63909
|
for (const table2 of schemaForReportBuilderState) {
|
|
@@ -63916,7 +63914,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63916
63914
|
}
|
|
63917
63915
|
return result;
|
|
63918
63916
|
}, [schemaForReportBuilderState]);
|
|
63919
|
-
const queryBuilderFieldConfigByName =
|
|
63917
|
+
const queryBuilderFieldConfigByName = useMemo33(() => {
|
|
63920
63918
|
const configByName = buildQueryBuilderFieldConfigByName(
|
|
63921
63919
|
schemaForReportBuilderState
|
|
63922
63920
|
);
|
|
@@ -64050,7 +64048,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64050
64048
|
sourceReport?.columns,
|
|
64051
64049
|
sourceReport?.reportBuilderState?.columns
|
|
64052
64050
|
]);
|
|
64053
|
-
const filterUniqueValuesRequest =
|
|
64051
|
+
const filterUniqueValuesRequest = useMemo33(() => {
|
|
64054
64052
|
const dashboardName = resolvedSourceDashboardName;
|
|
64055
64053
|
const reportBuilderStateFromSource = sourceReport?.reportBuilderState;
|
|
64056
64054
|
const isStringReportBuilderColumn = (column) => {
|
|
@@ -64271,13 +64269,13 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64271
64269
|
sourceReport?.reportBuilderState,
|
|
64272
64270
|
resolvedSourceDashboardName
|
|
64273
64271
|
]);
|
|
64274
|
-
const filterUniqueValuesRequestHash =
|
|
64272
|
+
const filterUniqueValuesRequestHash = useMemo33(
|
|
64275
64273
|
() => stableSerializeForQueryKey(
|
|
64276
64274
|
filterUniqueValuesRequestForQueryKey(filterUniqueValuesRequest)
|
|
64277
64275
|
),
|
|
64278
64276
|
[filterUniqueValuesRequest]
|
|
64279
64277
|
);
|
|
64280
|
-
const customFiltersHashForUniqueValues =
|
|
64278
|
+
const customFiltersHashForUniqueValues = useMemo33(
|
|
64281
64279
|
() => stableSerializeForQueryKey(customFilters),
|
|
64282
64280
|
[customFilters]
|
|
64283
64281
|
);
|
|
@@ -64354,7 +64352,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64354
64352
|
enabled: filterUniqueValuesEnabled,
|
|
64355
64353
|
retry: false
|
|
64356
64354
|
});
|
|
64357
|
-
const backendUniqueValuesByFieldName =
|
|
64355
|
+
const backendUniqueValuesByFieldName = useMemo33(() => {
|
|
64358
64356
|
const valuesByField = /* @__PURE__ */ new Map();
|
|
64359
64357
|
const uniqueValuesByColumn = filterUniqueValuesQuery.data?.uniqueValuesByColumn;
|
|
64360
64358
|
if (!uniqueValuesByColumn || typeof uniqueValuesByColumn !== "object") {
|
|
@@ -64387,7 +64385,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64387
64385
|
filterUniqueValuesQuery.data?.uniqueValuesByColumn,
|
|
64388
64386
|
filterUniqueValuesRequest?.stringColumnsByTable
|
|
64389
64387
|
]);
|
|
64390
|
-
const filterValueOptionsByFieldName =
|
|
64388
|
+
const filterValueOptionsByFieldName = useMemo33(() => {
|
|
64391
64389
|
const optionsByField = /* @__PURE__ */ new Map();
|
|
64392
64390
|
const selectedMultiselectByField = collectSelectedStringMultiselectValuesByField(queryFilters);
|
|
64393
64391
|
const collectValuesForField = (fieldName) => {
|
|
@@ -64453,7 +64451,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64453
64451
|
queryBuilderFieldConfigByName,
|
|
64454
64452
|
queryFilters
|
|
64455
64453
|
]);
|
|
64456
|
-
const filterFieldsComputed =
|
|
64454
|
+
const filterFieldsComputed = useMemo33(() => {
|
|
64457
64455
|
const fields = [];
|
|
64458
64456
|
const seen = /* @__PURE__ */ new Set();
|
|
64459
64457
|
const addField = (fieldName, fieldType, tableName, rawFieldName) => {
|
|
@@ -64556,7 +64554,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64556
64554
|
]);
|
|
64557
64555
|
const filterFieldsStableReportIdRef = useRef24("");
|
|
64558
64556
|
const filterFieldsStableCacheRef = useRef24([]);
|
|
64559
|
-
const filterFields =
|
|
64557
|
+
const filterFields = useMemo33(() => {
|
|
64560
64558
|
const rid = String(effectiveReportId ?? "");
|
|
64561
64559
|
if (filterFieldsStableReportIdRef.current !== rid) {
|
|
64562
64560
|
filterFieldsStableReportIdRef.current = rid;
|
|
@@ -64571,14 +64569,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64571
64569
|
}
|
|
64572
64570
|
return filterFieldsComputed;
|
|
64573
64571
|
}, [effectiveReportId, filterFieldsComputed]);
|
|
64574
|
-
const getFilterOperators =
|
|
64572
|
+
const getFilterOperators = useMemo33(
|
|
64575
64573
|
() => (_field, misc) => {
|
|
64576
64574
|
const fieldType = misc?.fieldData?.quillFieldType ?? queryBuilderFieldConfigByName[String(_field ?? "").trim()]?.fieldType ?? "string";
|
|
64577
64575
|
return QUERY_BUILDER_OPERATORS_BY_FIELD_TYPE[fieldType] ?? QUERY_BUILDER_OPERATORS_BY_FIELD_TYPE.string;
|
|
64578
64576
|
},
|
|
64579
64577
|
[queryBuilderFieldConfigByName]
|
|
64580
64578
|
);
|
|
64581
|
-
const getFilterInputType =
|
|
64579
|
+
const getFilterInputType = useMemo33(
|
|
64582
64580
|
() => (_field, operator, misc) => {
|
|
64583
64581
|
const fieldType = misc?.fieldData?.quillFieldType ?? queryBuilderFieldConfigByName[String(_field ?? "").trim()]?.fieldType ?? "string";
|
|
64584
64582
|
if (fieldType === "date" && isRelativeDateQueryBuilderOperator(operator)) {
|
|
@@ -64588,7 +64586,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64588
64586
|
},
|
|
64589
64587
|
[queryBuilderFieldConfigByName]
|
|
64590
64588
|
);
|
|
64591
|
-
const getFilterValueEditorType =
|
|
64589
|
+
const getFilterValueEditorType = useMemo33(
|
|
64592
64590
|
() => (_field, operator, misc) => {
|
|
64593
64591
|
const fieldType = misc?.fieldData?.quillFieldType ?? queryBuilderFieldConfigByName[String(_field ?? "").trim()]?.fieldType;
|
|
64594
64592
|
if (fieldType === "string" && isMultiValueOperator(operator)) {
|
|
@@ -64601,7 +64599,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64601
64599
|
},
|
|
64602
64600
|
[queryBuilderFieldConfigByName]
|
|
64603
64601
|
);
|
|
64604
|
-
const getFilterValues =
|
|
64602
|
+
const getFilterValues = useMemo33(
|
|
64605
64603
|
() => (_field, operator, misc) => {
|
|
64606
64604
|
const fieldName = String(_field ?? "").trim();
|
|
64607
64605
|
if (!fieldName) {
|
|
@@ -64631,7 +64629,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64631
64629
|
},
|
|
64632
64630
|
[filterValueOptionsByFieldName, queryBuilderFieldConfigByName]
|
|
64633
64631
|
);
|
|
64634
|
-
const filterQueryBuilderProps =
|
|
64632
|
+
const filterQueryBuilderProps = useMemo33(
|
|
64635
64633
|
() => ({
|
|
64636
64634
|
fields: filterFields,
|
|
64637
64635
|
listsAsArrays: true,
|
|
@@ -64648,7 +64646,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64648
64646
|
getFilterValues
|
|
64649
64647
|
]
|
|
64650
64648
|
);
|
|
64651
|
-
const filtersForQueryBuilder =
|
|
64649
|
+
const filtersForQueryBuilder = useMemo33(
|
|
64652
64650
|
() => canonicalizeMultiselectStringRulesToOptionValues(
|
|
64653
64651
|
queryFilters,
|
|
64654
64652
|
filterValueOptionsByFieldName,
|
|
@@ -64715,12 +64713,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64715
64713
|
...table2 ? { table: table2 } : {}
|
|
64716
64714
|
};
|
|
64717
64715
|
};
|
|
64718
|
-
const tenantHash =
|
|
64716
|
+
const tenantHash = useMemo33(
|
|
64719
64717
|
() => stableSerializeForQueryKey(tenants),
|
|
64720
64718
|
[tenants]
|
|
64721
64719
|
);
|
|
64722
|
-
const flagHash =
|
|
64723
|
-
const clientHash =
|
|
64720
|
+
const flagHash = useMemo33(() => stableSerializeForQueryKey(flags), [flags]);
|
|
64721
|
+
const clientHash = useMemo33(
|
|
64724
64722
|
() => stableSerializeForQueryKey({
|
|
64725
64723
|
publicKey: client?.publicKey,
|
|
64726
64724
|
clientId: client?.clientId,
|
|
@@ -64728,7 +64726,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64728
64726
|
}),
|
|
64729
64727
|
[client]
|
|
64730
64728
|
);
|
|
64731
|
-
const reloadKeyHash =
|
|
64729
|
+
const reloadKeyHash = useMemo33(
|
|
64732
64730
|
() => stableSerializeForQueryKey(reloadKey),
|
|
64733
64731
|
[reloadKey]
|
|
64734
64732
|
);
|
|
@@ -65006,11 +65004,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65006
65004
|
schemaForReportBuilderState,
|
|
65007
65005
|
sourceReport
|
|
65008
65006
|
]);
|
|
65009
|
-
const appliedAggregationState =
|
|
65007
|
+
const appliedAggregationState = useMemo33(
|
|
65010
65008
|
() => aggregationState.filter(isAppliedAggregation),
|
|
65011
65009
|
[aggregationState]
|
|
65012
65010
|
);
|
|
65013
|
-
const pivotState =
|
|
65011
|
+
const pivotState = useMemo33(() => {
|
|
65014
65012
|
if (!resolvedGroupRowsBy && !resolvedGroupColumnsBy && appliedAggregationState.length === 0) {
|
|
65015
65013
|
return null;
|
|
65016
65014
|
}
|
|
@@ -65088,7 +65086,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65088
65086
|
}
|
|
65089
65087
|
prevPivotStateForColumnExpansionRef.current = pivotState;
|
|
65090
65088
|
}, [pivotState]);
|
|
65091
|
-
const effectiveReportBuilderTables =
|
|
65089
|
+
const effectiveReportBuilderTables = useMemo33(() => {
|
|
65092
65090
|
const explicitBaseFromSchemaPicker = Array.isArray(schemaDatasourceIds) && schemaDatasourceIds.length > 0 ? schemaDatasourceIds.map((tableName) => String(tableName ?? "").trim()).filter(Boolean).map((name2) => ({ name: name2 })) : null;
|
|
65093
65091
|
const baseTablesForMerge = explicitBaseFromSchemaPicker ?? baseReportBuilderTables;
|
|
65094
65092
|
return mergeReportBuilderTables(
|
|
@@ -65112,18 +65110,18 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65112
65110
|
queryColumns,
|
|
65113
65111
|
schemaDatasourceIds
|
|
65114
65112
|
]);
|
|
65115
|
-
const datasources =
|
|
65113
|
+
const datasources = useMemo33(() => {
|
|
65116
65114
|
return effectiveReportBuilderTables.map((table2) => String(table2.name ?? "").trim()).filter((name2) => Boolean(name2));
|
|
65117
65115
|
}, [effectiveReportBuilderTables]);
|
|
65118
|
-
const effectiveReportBuilderTableNames =
|
|
65116
|
+
const effectiveReportBuilderTableNames = useMemo33(
|
|
65119
65117
|
() => effectiveReportBuilderTables.map((table2) => String(table2.name ?? "").trim()).filter((name2) => Boolean(name2)),
|
|
65120
65118
|
[effectiveReportBuilderTables]
|
|
65121
65119
|
);
|
|
65122
|
-
const baseReportBuilderTableNames =
|
|
65120
|
+
const baseReportBuilderTableNames = useMemo33(
|
|
65123
65121
|
() => baseReportBuilderTables.map((table2) => String(table2.name ?? "").trim()).filter((name2) => Boolean(name2)),
|
|
65124
65122
|
[baseReportBuilderTables]
|
|
65125
65123
|
);
|
|
65126
|
-
const normalizeQueryBuilderFieldNameForConfig =
|
|
65124
|
+
const normalizeQueryBuilderFieldNameForConfig = useMemo33(() => {
|
|
65127
65125
|
const configEntries = Object.entries(queryBuilderFieldConfigByName);
|
|
65128
65126
|
const preferredTableNames = /* @__PURE__ */ new Set([
|
|
65129
65127
|
...effectiveReportBuilderTableNames,
|
|
@@ -65172,7 +65170,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65172
65170
|
effectiveReportBuilderTableNames,
|
|
65173
65171
|
queryBuilderFieldConfigByName
|
|
65174
65172
|
]);
|
|
65175
|
-
const normalizeQueryBuilderFiltersForConfig =
|
|
65173
|
+
const normalizeQueryBuilderFiltersForConfig = useMemo33(() => {
|
|
65176
65174
|
const normalizeGroup = (group) => {
|
|
65177
65175
|
const groupRules = Array.isArray(group.rules) ? group.rules : [];
|
|
65178
65176
|
const nextRules = groupRules.map((entry) => {
|
|
@@ -65209,14 +65207,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65209
65207
|
return normalizeGroup(group);
|
|
65210
65208
|
};
|
|
65211
65209
|
}, [normalizeQueryBuilderFieldNameForConfig, queryBuilderFieldConfigByName]);
|
|
65212
|
-
const refreshSelectionTables =
|
|
65210
|
+
const refreshSelectionTables = useMemo33(() => {
|
|
65213
65211
|
return [
|
|
65214
65212
|
getPivotGroupOptionTable(groupRowsBy),
|
|
65215
65213
|
getPivotGroupOptionTable(groupColumnsBy),
|
|
65216
65214
|
...aggregationTablesByIndex
|
|
65217
65215
|
].map((tableName) => String(tableName ?? "").trim()).filter((tableName) => Boolean(tableName));
|
|
65218
65216
|
}, [aggregationTablesByIndex, groupColumnsBy, groupRowsBy]);
|
|
65219
|
-
const refreshSelectionFields =
|
|
65217
|
+
const refreshSelectionFields = useMemo33(() => {
|
|
65220
65218
|
const resolveFieldTableForSelection = (field, tableHint) => {
|
|
65221
65219
|
const fieldName = String(field ?? "").trim();
|
|
65222
65220
|
if (!fieldName) return "";
|
|
@@ -65266,7 +65264,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65266
65264
|
schemaForReportBuilderState,
|
|
65267
65265
|
sourceReport
|
|
65268
65266
|
]);
|
|
65269
|
-
const refreshDecision =
|
|
65267
|
+
const refreshDecision = useMemo33(
|
|
65270
65268
|
() => decideReportBuilderRefresh({
|
|
65271
65269
|
baseTables: baseReportBuilderTables,
|
|
65272
65270
|
baseColumns: baseReportBuilderColumns,
|
|
@@ -65280,7 +65278,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65280
65278
|
refreshSelectionTables
|
|
65281
65279
|
]
|
|
65282
65280
|
);
|
|
65283
|
-
const effectiveReportBuilderColumns =
|
|
65281
|
+
const effectiveReportBuilderColumns = useMemo33(() => {
|
|
65284
65282
|
const columnsFromPivot = [];
|
|
65285
65283
|
const appendPivotColumn = (field, tableHint) => {
|
|
65286
65284
|
const normalizedField = String(field ?? "").trim();
|
|
@@ -65378,7 +65376,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65378
65376
|
queryBuilderFieldConfigByName,
|
|
65379
65377
|
queryFilters
|
|
65380
65378
|
]);
|
|
65381
|
-
const resolvedSortFieldType =
|
|
65379
|
+
const resolvedSortFieldType = useMemo33(() => {
|
|
65382
65380
|
const sortField = pivotSort?.sortField;
|
|
65383
65381
|
if (!sortField || !pivotState) return void 0;
|
|
65384
65382
|
if (sortField === resolvedGroupRowsBy) {
|
|
@@ -65399,7 +65397,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65399
65397
|
resolvedGroupColumnsBy,
|
|
65400
65398
|
resolvedGroupRowsBy
|
|
65401
65399
|
]);
|
|
65402
|
-
const effectiveReportBuilderState =
|
|
65400
|
+
const effectiveReportBuilderState = useMemo33(() => {
|
|
65403
65401
|
if (!sourceReport && effectiveReportBuilderTables.length === 0) {
|
|
65404
65402
|
return void 0;
|
|
65405
65403
|
}
|
|
@@ -65438,7 +65436,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65438
65436
|
resolvedSortFieldType,
|
|
65439
65437
|
sourceReport
|
|
65440
65438
|
]);
|
|
65441
|
-
const effectiveReportBuilderStateHash =
|
|
65439
|
+
const effectiveReportBuilderStateHash = useMemo33(
|
|
65442
65440
|
() => stableSerializeForQueryKey(effectiveReportBuilderState),
|
|
65443
65441
|
[effectiveReportBuilderState]
|
|
65444
65442
|
);
|
|
@@ -65459,7 +65457,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65459
65457
|
activate: false
|
|
65460
65458
|
});
|
|
65461
65459
|
}, [applyPaginationUpdate, effectiveReportBuilderStateHash]);
|
|
65462
|
-
const pivotTableDataReportBuilderState =
|
|
65460
|
+
const pivotTableDataReportBuilderState = useMemo33(() => {
|
|
65463
65461
|
if (!effectiveReportBuilderState?.pivot) {
|
|
65464
65462
|
return void 0;
|
|
65465
65463
|
}
|
|
@@ -65479,11 +65477,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65479
65477
|
limit: null
|
|
65480
65478
|
};
|
|
65481
65479
|
}, [effectiveReportBuilderState, schemaForReportBuilderState]);
|
|
65482
|
-
const pivotTableDataReportBuilderStateHash =
|
|
65480
|
+
const pivotTableDataReportBuilderStateHash = useMemo33(
|
|
65483
65481
|
() => stableSerializeForQueryKey(pivotTableDataReportBuilderState),
|
|
65484
65482
|
[pivotTableDataReportBuilderState]
|
|
65485
65483
|
);
|
|
65486
|
-
const sourceReportMatchesEffectiveReportId =
|
|
65484
|
+
const sourceReportMatchesEffectiveReportId = useMemo33(() => {
|
|
65487
65485
|
const loadTarget = String(effectiveReportId ?? "").trim();
|
|
65488
65486
|
if (!loadTarget || !sourceReport) {
|
|
65489
65487
|
return true;
|
|
@@ -65493,7 +65491,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65493
65491
|
).trim();
|
|
65494
65492
|
return sid === loadTarget;
|
|
65495
65493
|
}, [effectiveReportId, sourceReport]);
|
|
65496
|
-
const shouldSkipRedundantFlatTableReportBuilderQuery =
|
|
65494
|
+
const shouldSkipRedundantFlatTableReportBuilderQuery = useMemo33(() => {
|
|
65497
65495
|
if (!sourceReport || pivotState) {
|
|
65498
65496
|
return false;
|
|
65499
65497
|
}
|
|
@@ -65604,7 +65602,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65604
65602
|
effectiveReportId,
|
|
65605
65603
|
sourceReport?.id
|
|
65606
65604
|
]);
|
|
65607
|
-
const chartTypes =
|
|
65605
|
+
const chartTypes = useMemo33(() => {
|
|
65608
65606
|
return getChartTypeOptions2({ pivot: pivotState });
|
|
65609
65607
|
}, [pivotState]);
|
|
65610
65608
|
const resolvedChartType = chartTypes.find((option) => option.value === chartType)?.value ?? chartTypes.find((option) => option.value === sourceReport?.chartType)?.value ?? chartTypes.find((option) => option.value === DEFAULT_CHART_TYPE)?.value ?? chartTypes[0]?.value ?? DEFAULT_CHART_TYPE;
|
|
@@ -65643,7 +65641,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65643
65641
|
});
|
|
65644
65642
|
}
|
|
65645
65643
|
}, [chartType, chartTypes, sourceReport]);
|
|
65646
|
-
const schemaScopedTableNames =
|
|
65644
|
+
const schemaScopedTableNames = useMemo33(() => {
|
|
65647
65645
|
if (preserveSchemaWideOptions) {
|
|
65648
65646
|
return [];
|
|
65649
65647
|
}
|
|
@@ -65658,7 +65656,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65658
65656
|
preserveSchemaWideOptions,
|
|
65659
65657
|
sourceReport?.reportBuilderState?.tables
|
|
65660
65658
|
]);
|
|
65661
|
-
const joinCompatibleSchemaTableNames =
|
|
65659
|
+
const joinCompatibleSchemaTableNames = useMemo33(() => {
|
|
65662
65660
|
if (schemaScopedTableNames.length === 0) {
|
|
65663
65661
|
return [];
|
|
65664
65662
|
}
|
|
@@ -65667,7 +65665,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65667
65665
|
schemaForeignKeyMap
|
|
65668
65666
|
);
|
|
65669
65667
|
}, [schemaForeignKeyMap, schemaScopedTableNames]);
|
|
65670
|
-
const aggregationFallbackTarget =
|
|
65668
|
+
const aggregationFallbackTarget = useMemo33(() => {
|
|
65671
65669
|
const tableNames = effectiveReportBuilderTables.map((table2) => table2.name).filter((name2) => Boolean(name2));
|
|
65672
65670
|
const referencedTableNames = (sourceReport?.referencedTables ?? []).filter(
|
|
65673
65671
|
(name2) => typeof name2 === "string" && name2.length > 0
|
|
@@ -65675,7 +65673,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65675
65673
|
const tableNamesToUse = tableNames.length ? tableNames : referencedTableNames;
|
|
65676
65674
|
return tableNamesToUse.length > 0 ? tableNamesToUse.join(", ") : "table";
|
|
65677
65675
|
}, [effectiveReportBuilderTables, sourceReport?.referencedTables]);
|
|
65678
|
-
const aggregationFallbackTableName =
|
|
65676
|
+
const aggregationFallbackTableName = useMemo33(() => {
|
|
65679
65677
|
const tableNames = effectiveReportBuilderTables.map((table2) => table2.name).filter((name2) => Boolean(name2));
|
|
65680
65678
|
const referencedTableNames = (sourceReport?.referencedTables ?? []).filter(
|
|
65681
65679
|
(name2) => typeof name2 === "string" && name2.length > 0
|
|
@@ -65683,7 +65681,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65683
65681
|
const tableNamesToUse = tableNames.length ? tableNames : referencedTableNames;
|
|
65684
65682
|
return tableNamesToUse[0] ?? "table";
|
|
65685
65683
|
}, [effectiveReportBuilderTables, sourceReport?.referencedTables]);
|
|
65686
|
-
const cleanedAggregations =
|
|
65684
|
+
const cleanedAggregations = useMemo33(() => {
|
|
65687
65685
|
return aggregationState.filter((aggregation) => Boolean(aggregation?.aggregationType)).map((aggregation, index) => {
|
|
65688
65686
|
const aggregationType = String(aggregation.aggregationType);
|
|
65689
65687
|
const normalizedAggregationType = aggregationType.toLowerCase();
|
|
@@ -65705,7 +65703,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65705
65703
|
aggregationTablesByIndex,
|
|
65706
65704
|
isBoolAggregationField
|
|
65707
65705
|
]);
|
|
65708
|
-
const { aggregationBaseOptions, aggregationOptionTableLookup } =
|
|
65706
|
+
const { aggregationBaseOptions, aggregationOptionTableLookup } = useMemo33(() => {
|
|
65709
65707
|
const joinScoped = fieldOptionsAllowedTableNames ? joinCompatibleSchemaTableNames.filter(
|
|
65710
65708
|
(name2) => fieldOptionsAllowedTableNames.has(name2)
|
|
65711
65709
|
) : joinCompatibleSchemaTableNames;
|
|
@@ -65788,7 +65786,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65788
65786
|
resolvedGroupRowsBy,
|
|
65789
65787
|
schemaForReportBuilderState
|
|
65790
65788
|
]);
|
|
65791
|
-
const { schemaColumnOptions, columnIdentifierLookup } =
|
|
65789
|
+
const { schemaColumnOptions, columnIdentifierLookup } = useMemo33(() => {
|
|
65792
65790
|
const lookup = /* @__PURE__ */ new Map();
|
|
65793
65791
|
const options2 = [];
|
|
65794
65792
|
for (const table2 of schemaData.schemaWithCustomFields) {
|
|
@@ -65815,7 +65813,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65815
65813
|
columnIdentifierLookup: lookup
|
|
65816
65814
|
};
|
|
65817
65815
|
}, [schemaData.schemaWithCustomFields]);
|
|
65818
|
-
const tableColumnPickerPoolOptions =
|
|
65816
|
+
const tableColumnPickerPoolOptions = useMemo33(() => {
|
|
65819
65817
|
const allowed = new Set(
|
|
65820
65818
|
effectiveReportBuilderTableNames.map((name2) => String(name2 ?? "").trim()).filter(Boolean)
|
|
65821
65819
|
);
|
|
@@ -65826,16 +65824,16 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65826
65824
|
(option) => allowed.has(String(option.tableName ?? "").trim())
|
|
65827
65825
|
);
|
|
65828
65826
|
}, [effectiveReportBuilderTableNames, schemaColumnOptions]);
|
|
65829
|
-
const columns =
|
|
65827
|
+
const columns = useMemo33(() => {
|
|
65830
65828
|
return displayColumns.filter((column) => Boolean(column.field)).map((column) => encodeColumnOptionValue(column.table, column.field));
|
|
65831
65829
|
}, [displayColumns]);
|
|
65832
|
-
const selectedColumnOptions =
|
|
65830
|
+
const selectedColumnOptions = useMemo33(() => {
|
|
65833
65831
|
return displayColumns.map((column) => {
|
|
65834
65832
|
const value = column.alias || column.field;
|
|
65835
65833
|
return value ? { label: value, value } : null;
|
|
65836
65834
|
}).filter((option) => option !== null);
|
|
65837
65835
|
}, [displayColumns]);
|
|
65838
|
-
const scopedSchemaColumns =
|
|
65836
|
+
const scopedSchemaColumns = useMemo33(() => {
|
|
65839
65837
|
const tableNames = fieldOptionsAllowedTableNames ? Array.from(fieldOptionsAllowedTableNames) : joinCompatibleSchemaTableNames;
|
|
65840
65838
|
const schemaTables = schemaForReportBuilderState;
|
|
65841
65839
|
const tablesToUse = tableNames.length ? schemaTables.filter((table2) => tableNames.includes(table2.name ?? "")) : schemaTables;
|
|
@@ -65856,7 +65854,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65856
65854
|
joinCompatibleSchemaTableNames,
|
|
65857
65855
|
schemaForReportBuilderState
|
|
65858
65856
|
]);
|
|
65859
|
-
const pivotUniqueValuesByColumn =
|
|
65857
|
+
const pivotUniqueValuesByColumn = useMemo33(() => {
|
|
65860
65858
|
const explicitUniqueValues = sourceReport?.uniqueStringsByColumn ?? sourceReport?.columnUniqueValues ?? sourceReport?.uniqueValues;
|
|
65861
65859
|
if (explicitUniqueValues && typeof explicitUniqueValues === "object" && !Array.isArray(explicitUniqueValues)) {
|
|
65862
65860
|
return explicitUniqueValues;
|
|
@@ -65882,7 +65880,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65882
65880
|
}
|
|
65883
65881
|
return result;
|
|
65884
65882
|
}, [sourceReport]);
|
|
65885
|
-
const possiblePivotFields =
|
|
65883
|
+
const possiblePivotFields = useMemo33(() => {
|
|
65886
65884
|
const options2 = getPossiblePivotFieldOptions(
|
|
65887
65885
|
scopedSchemaColumns,
|
|
65888
65886
|
pivotUniqueValuesByColumn
|
|
@@ -65893,7 +65891,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65893
65891
|
columnFields: options2.columnFields.filter((field) => !isIdColumn(field))
|
|
65894
65892
|
};
|
|
65895
65893
|
}, [scopedSchemaColumns, pivotUniqueValuesByColumn]);
|
|
65896
|
-
const groupRowsByOptions =
|
|
65894
|
+
const groupRowsByOptions = useMemo33(() => {
|
|
65897
65895
|
const allowedFields = new Set(possiblePivotFields.rowFields);
|
|
65898
65896
|
const seenValues = /* @__PURE__ */ new Set();
|
|
65899
65897
|
const options2 = [];
|
|
@@ -65920,7 +65918,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65920
65918
|
}
|
|
65921
65919
|
return options2;
|
|
65922
65920
|
}, [groupRowsBy, possiblePivotFields.rowFields, scopedSchemaColumns]);
|
|
65923
|
-
const groupColumnsByOptions =
|
|
65921
|
+
const groupColumnsByOptions = useMemo33(() => {
|
|
65924
65922
|
const allowedFields = new Set(possiblePivotFields.columnFields);
|
|
65925
65923
|
const seenValues = /* @__PURE__ */ new Set();
|
|
65926
65924
|
const options2 = [];
|
|
@@ -65947,19 +65945,19 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65947
65945
|
}
|
|
65948
65946
|
return options2;
|
|
65949
65947
|
}, [groupColumnsBy, possiblePivotFields.columnFields, scopedSchemaColumns]);
|
|
65950
|
-
const cleanedSort =
|
|
65948
|
+
const cleanedSort = useMemo33(() => {
|
|
65951
65949
|
const activeSort = resolvedGroupRowsBy ? pivotSort : regularSort;
|
|
65952
65950
|
if (!activeSort?.sortField || !activeSort?.sortDirection) {
|
|
65953
65951
|
return "";
|
|
65954
65952
|
}
|
|
65955
65953
|
return toFlatSortValue(activeSort.sortField, activeSort.sortDirection);
|
|
65956
65954
|
}, [pivotSort, regularSort, resolvedGroupRowsBy]);
|
|
65957
|
-
const aggregationSortLabelFallbackTable =
|
|
65955
|
+
const aggregationSortLabelFallbackTable = useMemo33(() => {
|
|
65958
65956
|
const reportBuilderTableName = effectiveReportBuilderTables.map((table2) => String(table2.name ?? "").trim()).find((tableName) => Boolean(tableName));
|
|
65959
65957
|
if (reportBuilderTableName) return reportBuilderTableName;
|
|
65960
65958
|
return (sourceReport?.referencedTables ?? []).map((tableName) => String(tableName ?? "").trim()).find((tableName) => Boolean(tableName));
|
|
65961
65959
|
}, [effectiveReportBuilderTables, sourceReport?.referencedTables]);
|
|
65962
|
-
const sortOptions =
|
|
65960
|
+
const sortOptions = useMemo33(() => {
|
|
65963
65961
|
if (resolvedGroupRowsBy) {
|
|
65964
65962
|
const aggregationSortFields = getPivotAggregationSortFields(
|
|
65965
65963
|
aggregationState,
|
|
@@ -66018,7 +66016,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66018
66016
|
resolvedGroupRowsBy,
|
|
66019
66017
|
selectedColumnOptions
|
|
66020
66018
|
]);
|
|
66021
|
-
const { aggregationValues, aggregationOptions } =
|
|
66019
|
+
const { aggregationValues, aggregationOptions } = useMemo33(() => {
|
|
66022
66020
|
const baseOptions = aggregationBaseOptions.map((option) => ({
|
|
66023
66021
|
value: option.value,
|
|
66024
66022
|
label: option.label
|
|
@@ -66062,7 +66060,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66062
66060
|
aggregationTablesByIndex,
|
|
66063
66061
|
isBoolAggregationField
|
|
66064
66062
|
]);
|
|
66065
|
-
const nextPivot =
|
|
66063
|
+
const nextPivot = useMemo33(() => {
|
|
66066
66064
|
if (!sourceReport) return null;
|
|
66067
66065
|
return pivotState ? {
|
|
66068
66066
|
...pivotState,
|
|
@@ -66073,15 +66071,15 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66073
66071
|
rowLimit: limit?.value
|
|
66074
66072
|
} : null;
|
|
66075
66073
|
}, [sourceReport, pivotState, pivotSort, limit, resolvedSortFieldType]);
|
|
66076
|
-
const nextPivotHash =
|
|
66074
|
+
const nextPivotHash = useMemo33(
|
|
66077
66075
|
() => stableSerializeForQueryKey(nextPivot),
|
|
66078
66076
|
[nextPivot]
|
|
66079
66077
|
);
|
|
66080
|
-
const filterStackHash =
|
|
66078
|
+
const filterStackHash = useMemo33(
|
|
66081
66079
|
() => stableSerializeForQueryKey(filterStack),
|
|
66082
66080
|
[filterStack]
|
|
66083
66081
|
);
|
|
66084
|
-
const shouldSkipPivotRefreshForUnchangedPivot =
|
|
66082
|
+
const shouldSkipPivotRefreshForUnchangedPivot = useMemo33(() => {
|
|
66085
66083
|
if (!sourceReport || !nextPivot) return false;
|
|
66086
66084
|
if (!Array.isArray(sourceReport.rows) || sourceReport.rows.length === 0) {
|
|
66087
66085
|
return false;
|
|
@@ -66119,7 +66117,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66119
66117
|
shouldSkipPivotRefreshForUnchangedPivot,
|
|
66120
66118
|
sourceReport
|
|
66121
66119
|
]);
|
|
66122
|
-
const shouldSkipRedundantPivotTableDataReportBuilderQuery =
|
|
66120
|
+
const shouldSkipRedundantPivotTableDataReportBuilderQuery = useMemo33(() => {
|
|
66123
66121
|
if (!sourceReport || !nextPivot) {
|
|
66124
66122
|
return false;
|
|
66125
66123
|
}
|
|
@@ -66221,7 +66219,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66221
66219
|
});
|
|
66222
66220
|
const tablePageReportBuilderState = pivotTableDataReportBuilderState ?? effectiveReportBuilderState;
|
|
66223
66221
|
const tablePageReportBuilderStateHash = pivotTableDataReportBuilderState ? pivotTableDataReportBuilderStateHash : effectiveReportBuilderStateHash;
|
|
66224
|
-
const tablePaginationSort =
|
|
66222
|
+
const tablePaginationSort = useMemo33(() => {
|
|
66225
66223
|
const sortEntry = tablePageReportBuilderState?.sort?.[0];
|
|
66226
66224
|
const field = String(sortEntry?.field ?? "").trim();
|
|
66227
66225
|
if (!field || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(field)) {
|
|
@@ -66284,7 +66282,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66284
66282
|
const tablePageRows = tablePageQueryEnabled && !tablePageQuery.data?.error && Array.isArray(tablePageQuery.data?.report?.rows) ? tablePageQuery.data.report.rows : void 0;
|
|
66285
66283
|
const tablePageRowCount = tablePageQueryEnabled && typeof tablePageQuery.data?.report?.rowCount === "number" && tablePageQuery.data.report.rowCount > 0 ? tablePageQuery.data.report.rowCount : void 0;
|
|
66286
66284
|
const tablePageFetching = tablePageQueryEnabled && tablePageQuery.isFetching;
|
|
66287
|
-
const paginationTotalRowCount =
|
|
66285
|
+
const paginationTotalRowCount = useMemo33(() => {
|
|
66288
66286
|
if (tablePageRowCount !== void 0) {
|
|
66289
66287
|
return Math.max(tablePageRowCount, baseWindowRowsLength);
|
|
66290
66288
|
}
|
|
@@ -66400,7 +66398,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66400
66398
|
pivotRefreshQueryEnabled,
|
|
66401
66399
|
effectiveReportId
|
|
66402
66400
|
]);
|
|
66403
|
-
const chartData =
|
|
66401
|
+
const chartData = useMemo33(() => {
|
|
66404
66402
|
if (!sourceReport) return void 0;
|
|
66405
66403
|
const rowsForChart = Array.isArray(sourceReport.rows) ? sourceReport.rows : [];
|
|
66406
66404
|
const chartPivotForDisplay = nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
|
|
@@ -66429,18 +66427,18 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66429
66427
|
useInMemoryEngines,
|
|
66430
66428
|
chartPivotHydrationEpoch
|
|
66431
66429
|
]);
|
|
66432
|
-
const baseChart =
|
|
66430
|
+
const baseChart = useMemo33(
|
|
66433
66431
|
() => normalizePivotChartForDisplay(chartData),
|
|
66434
66432
|
[chartData]
|
|
66435
66433
|
);
|
|
66436
|
-
const chartAxesBaseChart =
|
|
66434
|
+
const chartAxesBaseChart = useMemo33(() => {
|
|
66437
66435
|
if (!chartData) return void 0;
|
|
66438
66436
|
if (chartData.pivot?.columnField) {
|
|
66439
66437
|
return normalizePivotChartForAxisControls(chartData, effectiveReportId);
|
|
66440
66438
|
}
|
|
66441
66439
|
return baseChart;
|
|
66442
66440
|
}, [baseChart, chartData, effectiveReportId]);
|
|
66443
|
-
const chartAxisOptions =
|
|
66441
|
+
const chartAxisOptions = useMemo33(() => {
|
|
66444
66442
|
if (!chartAxesBaseChart) return [];
|
|
66445
66443
|
const optionsByField = /* @__PURE__ */ new Map();
|
|
66446
66444
|
const registerOption = (fieldRaw, labelRaw, formatRaw) => {
|
|
@@ -66479,14 +66477,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66479
66477
|
);
|
|
66480
66478
|
return Array.from(optionsByField.values());
|
|
66481
66479
|
}, [chartAxesBaseChart]);
|
|
66482
|
-
const chartAxisOptionByField =
|
|
66480
|
+
const chartAxisOptionByField = useMemo33(() => {
|
|
66483
66481
|
const optionsByField = /* @__PURE__ */ new Map();
|
|
66484
66482
|
for (const option of chartAxisOptions) {
|
|
66485
66483
|
optionsByField.set(option.value, option);
|
|
66486
66484
|
}
|
|
66487
66485
|
return optionsByField;
|
|
66488
66486
|
}, [chartAxisOptions]);
|
|
66489
|
-
const xAxisOptions =
|
|
66487
|
+
const xAxisOptions = useMemo33(() => {
|
|
66490
66488
|
if (!chartAxesBaseChart) return chartAxisOptions;
|
|
66491
66489
|
const pivot = chartAxesBaseChart.pivot;
|
|
66492
66490
|
const pivotRowField = String(pivot?.rowField ?? "").trim();
|
|
@@ -66509,7 +66507,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66509
66507
|
}
|
|
66510
66508
|
return chartAxisOptions;
|
|
66511
66509
|
}, [chartAxesBaseChart, chartAxisOptions, chartAxisOptionByField]);
|
|
66512
|
-
const yAxisOptions =
|
|
66510
|
+
const yAxisOptions = useMemo33(() => {
|
|
66513
66511
|
if (!chartAxesBaseChart) return [];
|
|
66514
66512
|
const keepOption = (option) => {
|
|
66515
66513
|
const col = findSchemaColumnForChartAxisField(
|
|
@@ -66545,21 +66543,21 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66545
66543
|
chartAxisOptions,
|
|
66546
66544
|
schemaColumnOptions
|
|
66547
66545
|
]);
|
|
66548
|
-
const normalizedChartXAxisOptions =
|
|
66546
|
+
const normalizedChartXAxisOptions = useMemo33(() => {
|
|
66549
66547
|
return xAxisOptions.map((option) => ({
|
|
66550
66548
|
value: String(option.value ?? "").trim(),
|
|
66551
66549
|
label: String(option.label ?? option.value ?? "").trim(),
|
|
66552
66550
|
format: String(option.format ?? "").trim()
|
|
66553
66551
|
}));
|
|
66554
66552
|
}, [xAxisOptions]);
|
|
66555
|
-
const normalizedChartYAxisOptions =
|
|
66553
|
+
const normalizedChartYAxisOptions = useMemo33(() => {
|
|
66556
66554
|
return yAxisOptions.map((option) => ({
|
|
66557
66555
|
value: String(option.value ?? "").trim(),
|
|
66558
66556
|
label: String(option.label ?? option.value ?? "").trim(),
|
|
66559
66557
|
format: String(option.format ?? "").trim()
|
|
66560
66558
|
}));
|
|
66561
66559
|
}, [yAxisOptions]);
|
|
66562
|
-
const resolvedYAxisFields =
|
|
66560
|
+
const resolvedYAxisFields = useMemo33(() => {
|
|
66563
66561
|
if (!chartAxesBaseChart) return [];
|
|
66564
66562
|
const normalizeYAxisField = (yAxisFieldRaw) => {
|
|
66565
66563
|
const field = String(yAxisFieldRaw?.field ?? "").trim();
|
|
@@ -66603,7 +66601,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66603
66601
|
chartAxisOptionByField,
|
|
66604
66602
|
chartAxisOptions
|
|
66605
66603
|
]);
|
|
66606
|
-
const resolvedXAxisField =
|
|
66604
|
+
const resolvedXAxisField = useMemo33(() => {
|
|
66607
66605
|
if (!chartAxesBaseChart) return "";
|
|
66608
66606
|
const chartType2 = String(chartAxesBaseChart.chartType ?? "").toLowerCase();
|
|
66609
66607
|
const pivotRowField = String(
|
|
@@ -66635,7 +66633,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66635
66633
|
chartAxisOptions,
|
|
66636
66634
|
resolvedYAxisFields
|
|
66637
66635
|
]);
|
|
66638
|
-
const resolvedXAxisFormat =
|
|
66636
|
+
const resolvedXAxisFormat = useMemo33(() => {
|
|
66639
66637
|
if (!chartAxesBaseChart) {
|
|
66640
66638
|
return "string";
|
|
66641
66639
|
}
|
|
@@ -66661,7 +66659,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66661
66659
|
resolvedXAxisField,
|
|
66662
66660
|
resolvedYAxisFields
|
|
66663
66661
|
]);
|
|
66664
|
-
const resolvedXAxisLabel =
|
|
66662
|
+
const resolvedXAxisLabel = useMemo33(() => {
|
|
66665
66663
|
const defaultXLabel = String(
|
|
66666
66664
|
chartAxesBaseChart?.xAxisLabel ?? chartAxisOptionByField.get(resolvedXAxisField)?.label ?? ""
|
|
66667
66665
|
).trim();
|
|
@@ -66675,13 +66673,13 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66675
66673
|
chartAxisOptionByField,
|
|
66676
66674
|
resolvedXAxisField
|
|
66677
66675
|
]);
|
|
66678
|
-
const chartVisibility =
|
|
66676
|
+
const chartVisibility = useMemo33(
|
|
66679
66677
|
() => ({
|
|
66680
66678
|
showLegend: chartVisibilityOverrides.showLegend ?? Boolean(baseChart?.showLegend ?? false)
|
|
66681
66679
|
}),
|
|
66682
66680
|
[baseChart?.showLegend, chartVisibilityOverrides]
|
|
66683
66681
|
);
|
|
66684
|
-
const xAxis =
|
|
66682
|
+
const xAxis = useMemo33(() => {
|
|
66685
66683
|
const pivotBucketXAxis = isPivotTableDateBucketRowAxis(
|
|
66686
66684
|
chartAxesBaseChart,
|
|
66687
66685
|
resolvedXAxisField
|
|
@@ -66698,7 +66696,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66698
66696
|
resolvedXAxisField,
|
|
66699
66697
|
resolvedXAxisFormat
|
|
66700
66698
|
]);
|
|
66701
|
-
const yAxis =
|
|
66699
|
+
const yAxis = useMemo33(
|
|
66702
66700
|
() => ({
|
|
66703
66701
|
fields: resolvedYAxisFields.map((yAxisField) => ({
|
|
66704
66702
|
field: yAxisField.field,
|
|
@@ -66710,14 +66708,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66710
66708
|
}),
|
|
66711
66709
|
[resolvedYAxisFields]
|
|
66712
66710
|
);
|
|
66713
|
-
const resolvedYAxisFieldsForDisplay =
|
|
66711
|
+
const resolvedYAxisFieldsForDisplay = useMemo33(() => {
|
|
66714
66712
|
if (!baseChart) return resolvedYAxisFields;
|
|
66715
66713
|
return mapResolvedPivotYAxisFieldsForDisplay({
|
|
66716
66714
|
chart: baseChart,
|
|
66717
66715
|
resolvedYAxisFields
|
|
66718
66716
|
});
|
|
66719
66717
|
}, [baseChart, resolvedYAxisFields]);
|
|
66720
|
-
const chart =
|
|
66718
|
+
const chart = useMemo33(() => {
|
|
66721
66719
|
if (!baseChart) return void 0;
|
|
66722
66720
|
let columns2 = mergeChartColumnFormatsFromYAxisFields(
|
|
66723
66721
|
baseChart.columns,
|
|
@@ -66777,7 +66775,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66777
66775
|
resolvedYAxisFieldsForDisplay
|
|
66778
66776
|
]);
|
|
66779
66777
|
const pivotDateFilterRangeCacheRef = useRef24({ key: "", min: null, max: null });
|
|
66780
|
-
const filterOptions =
|
|
66778
|
+
const filterOptions = useMemo33(() => {
|
|
66781
66779
|
const out = [];
|
|
66782
66780
|
for (const [field, values] of filterValueOptionsByFieldName) {
|
|
66783
66781
|
out.push({
|
|
@@ -66839,7 +66837,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66839
66837
|
effectiveReportId,
|
|
66840
66838
|
filterValueOptionsByFieldName
|
|
66841
66839
|
]);
|
|
66842
|
-
const chartForUi =
|
|
66840
|
+
const chartForUi = useMemo33(() => {
|
|
66843
66841
|
if (!chart?.pivot) return chart;
|
|
66844
66842
|
const pivot = chart.pivot;
|
|
66845
66843
|
const qualify = (field, table2) => table2 ? `${table2}.${field}` : field;
|
|
@@ -66915,11 +66913,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66915
66913
|
};
|
|
66916
66914
|
}, [chart, filterOptions, filtersForQueryBuilder]);
|
|
66917
66915
|
const isPivotTableChart = String(chartType ?? "").toLowerCase() === "table" && Boolean(pivotState);
|
|
66918
|
-
const pivotTableColumnControls =
|
|
66916
|
+
const pivotTableColumnControls = useMemo33(
|
|
66919
66917
|
() => isPivotTableChart ? buildPivotColumnPivotTableFormattingColumns(pivotState, chart) : null,
|
|
66920
66918
|
[chart, isPivotTableChart, pivotState]
|
|
66921
66919
|
);
|
|
66922
|
-
const chartAxes =
|
|
66920
|
+
const chartAxes = useMemo33(() => {
|
|
66923
66921
|
const yAxisItems = resolvedYAxisFields.map(
|
|
66924
66922
|
(yAxisField, index) => ({
|
|
66925
66923
|
id: String(index),
|
|
@@ -67069,7 +67067,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67069
67067
|
yAxisOptions
|
|
67070
67068
|
]);
|
|
67071
67069
|
const tableFormatCacheRef = useRef24(/* @__PURE__ */ new Map());
|
|
67072
|
-
const tableFormatMerge =
|
|
67070
|
+
const tableFormatMerge = useMemo33(
|
|
67073
67071
|
() => mergeDisplayAndSourceForTableFormats({
|
|
67074
67072
|
effectiveReportBuilderTableNames,
|
|
67075
67073
|
scopedSchemaColumns,
|
|
@@ -67085,7 +67083,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67085
67083
|
tableColumnsEditedSignature
|
|
67086
67084
|
]
|
|
67087
67085
|
);
|
|
67088
|
-
const table =
|
|
67086
|
+
const table = useMemo33(() => {
|
|
67089
67087
|
const baseWindowRows = Array.isArray(sourceReport?.rows) ? sourceReport.rows : [];
|
|
67090
67088
|
const rawRows = !paginationActive ? baseWindowRows : tablePageRows ?? baseWindowRows.slice(paginationRangeStart, paginationRangeEnd);
|
|
67091
67089
|
const { columns: mergedFromReport } = mergeDisplayAndSourceForTableFormats({
|
|
@@ -67216,7 +67214,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67216
67214
|
const {
|
|
67217
67215
|
columnsOptions: tableFormattingColumnOptions,
|
|
67218
67216
|
hasTableDrivenColumnOrder
|
|
67219
|
-
} =
|
|
67217
|
+
} = useMemo33(() => {
|
|
67220
67218
|
if (pivotTableColumnControls) {
|
|
67221
67219
|
return getAllColumnOptions({
|
|
67222
67220
|
schemaColumnOptions,
|
|
@@ -67246,24 +67244,24 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67246
67244
|
schemaColumnOptions,
|
|
67247
67245
|
table.columns
|
|
67248
67246
|
]);
|
|
67249
|
-
const axisSelectFormatLabels =
|
|
67247
|
+
const axisSelectFormatLabels = useMemo33(
|
|
67250
67248
|
() => AXIS_FORMAT_OPTIONS.map((option) => option.label),
|
|
67251
67249
|
[]
|
|
67252
67250
|
);
|
|
67253
|
-
const xAxisFormatOptionLabels =
|
|
67251
|
+
const xAxisFormatOptionLabels = useMemo33(() => {
|
|
67254
67252
|
if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField)) {
|
|
67255
67253
|
return ["date", ...axisSelectFormatLabels];
|
|
67256
67254
|
}
|
|
67257
67255
|
return axisSelectFormatLabels;
|
|
67258
67256
|
}, [chartAxesBaseChart, resolvedXAxisField, axisSelectFormatLabels]);
|
|
67259
|
-
const tableDerivedColumnOrder =
|
|
67257
|
+
const tableDerivedColumnOrder = useMemo33(() => {
|
|
67260
67258
|
return tableFormattingColumnOptions.map((option) => option.value);
|
|
67261
67259
|
}, [tableFormattingColumnOptions]);
|
|
67262
|
-
const tableDerivedColumnOrderSignature =
|
|
67260
|
+
const tableDerivedColumnOrderSignature = useMemo33(
|
|
67263
67261
|
() => tableDerivedColumnOrder.join("|"),
|
|
67264
67262
|
[tableDerivedColumnOrder]
|
|
67265
67263
|
);
|
|
67266
|
-
const activeTableColumnIds =
|
|
67264
|
+
const activeTableColumnIds = useMemo33(() => {
|
|
67267
67265
|
if (pivotTableColumnControls) {
|
|
67268
67266
|
return pivotTableColumnControls.selectedColumnIds;
|
|
67269
67267
|
}
|
|
@@ -67297,7 +67295,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67297
67295
|
tableDerivedColumnOrder,
|
|
67298
67296
|
tableFormattingColumnOptions
|
|
67299
67297
|
]);
|
|
67300
|
-
const columnOptionById =
|
|
67298
|
+
const columnOptionById = useMemo33(() => {
|
|
67301
67299
|
const map = /* @__PURE__ */ new Map();
|
|
67302
67300
|
for (const option of tableColumnPickerPoolOptions) {
|
|
67303
67301
|
map.set(option.value, option);
|
|
@@ -67309,7 +67307,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67309
67307
|
}
|
|
67310
67308
|
return map;
|
|
67311
67309
|
}, [tableColumnPickerPoolOptions, tableFormattingColumnOptions]);
|
|
67312
|
-
const displayColumnById =
|
|
67310
|
+
const displayColumnById = useMemo33(() => {
|
|
67313
67311
|
const map = /* @__PURE__ */ new Map();
|
|
67314
67312
|
for (const column of displayColumns) {
|
|
67315
67313
|
const field = String(column.field ?? "").trim();
|
|
@@ -67320,7 +67318,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67320
67318
|
}
|
|
67321
67319
|
return map;
|
|
67322
67320
|
}, [displayColumns]);
|
|
67323
|
-
const tableColumnSettingsById =
|
|
67321
|
+
const tableColumnSettingsById = useMemo33(() => {
|
|
67324
67322
|
const map = /* @__PURE__ */ new Map();
|
|
67325
67323
|
const effectiveById = tableFormatMerge.formatByColumnOptionId;
|
|
67326
67324
|
const chartColById = /* @__PURE__ */ new Map();
|
|
@@ -67446,7 +67444,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67446
67444
|
useLayoutEffect4(() => {
|
|
67447
67445
|
tableColumnSettingsCoalesceRef.current = new Map(tableColumnSettingsById);
|
|
67448
67446
|
}, [tableColumnSettingsById]);
|
|
67449
|
-
const tableColumnItems =
|
|
67447
|
+
const tableColumnItems = useMemo33(() => {
|
|
67450
67448
|
const pivotRowFieldForFormat = String(chart?.pivot?.rowField ?? "").trim();
|
|
67451
67449
|
const pivotRowFieldType = String(chart?.pivot?.rowFieldType ?? "").trim();
|
|
67452
67450
|
const items = activeTableColumnIds.map((columnId) => {
|
|
@@ -67482,10 +67480,10 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67482
67480
|
isPivotTableChart,
|
|
67483
67481
|
tableColumnSettingsById
|
|
67484
67482
|
]);
|
|
67485
|
-
const tableColumnById =
|
|
67483
|
+
const tableColumnById = useMemo33(() => {
|
|
67486
67484
|
return new Map(tableColumnItems.map((item) => [item.id, item]));
|
|
67487
67485
|
}, [tableColumnItems]);
|
|
67488
|
-
const tableColumnValues =
|
|
67486
|
+
const tableColumnValues = useMemo33(() => {
|
|
67489
67487
|
const pivotRowFieldForFormat = String(chart?.pivot?.rowField ?? "").trim();
|
|
67490
67488
|
const pivotRowFieldType = String(chart?.pivot?.rowFieldType ?? "").trim();
|
|
67491
67489
|
return tableColumnItems.map((item) => {
|
|
@@ -68455,7 +68453,7 @@ function ChatChartCard({
|
|
|
68455
68453
|
loading,
|
|
68456
68454
|
setReport
|
|
68457
68455
|
} = useReport(reportId);
|
|
68458
|
-
const selectedColumnValues =
|
|
68456
|
+
const selectedColumnValues = useMemo34(
|
|
68459
68457
|
() => columns.map((column) => column.value),
|
|
68460
68458
|
[columns]
|
|
68461
68459
|
);
|
|
@@ -69219,7 +69217,7 @@ function Chat({
|
|
|
69219
69217
|
}
|
|
69220
69218
|
|
|
69221
69219
|
// src/hooks/useReportFilterDraft.ts
|
|
69222
|
-
import { useCallback as useCallback6, useEffect as useEffect33, useMemo as
|
|
69220
|
+
import { useCallback as useCallback6, useEffect as useEffect33, useMemo as useMemo35, useRef as useRef26, useState as useState43 } from "react";
|
|
69223
69221
|
var normalizeOperatorKey = (operator) => String(operator ?? "").trim().toLowerCase().replace(/[_\s]+/g, "");
|
|
69224
69222
|
var defaultFilterRuleValueForOperator = (operator) => {
|
|
69225
69223
|
const key = normalizeOperatorKey(operator);
|
|
@@ -69272,12 +69270,12 @@ function useReportFilterDraft(args) {
|
|
|
69272
69270
|
lastNonEmptyFieldsRef.current = queryBuilderProps.fields;
|
|
69273
69271
|
}
|
|
69274
69272
|
const effectiveFields = queryBuilderProps.fields.length > 0 ? queryBuilderProps.fields : lastNonEmptyFieldsRef.current;
|
|
69275
|
-
const committedSignature =
|
|
69273
|
+
const committedSignature = useMemo35(
|
|
69276
69274
|
() => committedFiltersSignature(committed),
|
|
69277
69275
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- `committed` normalizes null to a stable constant
|
|
69278
69276
|
[committedFilters]
|
|
69279
69277
|
);
|
|
69280
|
-
const fieldsSignature =
|
|
69278
|
+
const fieldsSignature = useMemo35(
|
|
69281
69279
|
() => fieldCatalogSignature(effectiveFields),
|
|
69282
69280
|
[effectiveFields]
|
|
69283
69281
|
);
|
|
@@ -69320,7 +69318,7 @@ function useReportFilterDraft(args) {
|
|
|
69320
69318
|
(rule) => defaultFilterRuleValueForOperator(rule?.operator),
|
|
69321
69319
|
[]
|
|
69322
69320
|
);
|
|
69323
|
-
const filterDraftQueryBuilderProps =
|
|
69321
|
+
const filterDraftQueryBuilderProps = useMemo35(
|
|
69324
69322
|
() => ({
|
|
69325
69323
|
...queryBuilderProps,
|
|
69326
69324
|
fields: effectiveFields,
|
|
@@ -69643,7 +69641,7 @@ var useTenants = (dashboardName) => {
|
|
|
69643
69641
|
};
|
|
69644
69642
|
|
|
69645
69643
|
// src/hooks/useQuill.ts
|
|
69646
|
-
import { useContext as useContext40, useEffect as useEffect35, useMemo as
|
|
69644
|
+
import { useContext as useContext40, useEffect as useEffect35, useMemo as useMemo36, useState as useState45 } from "react";
|
|
69647
69645
|
init_paginationProcessing();
|
|
69648
69646
|
init_tableProcessing();
|
|
69649
69647
|
init_dataProcessing();
|
|
@@ -69651,14 +69649,14 @@ var useQuill = (reportId, pagination) => {
|
|
|
69651
69649
|
const { reports, reportsDispatch, fetchIndividualReport } = useContext40(ReportsContext);
|
|
69652
69650
|
const { allReportsById } = useAllReports();
|
|
69653
69651
|
const { getToken } = useContext40(FetchContext);
|
|
69654
|
-
const dashboardReport =
|
|
69652
|
+
const dashboardReport = useMemo36(() => {
|
|
69655
69653
|
return allReportsById[reportId ?? ""];
|
|
69656
69654
|
}, [allReportsById[reportId ?? ""]]);
|
|
69657
69655
|
const { dashboardFilters, dashboardCustomFilters } = useContext40(
|
|
69658
69656
|
DashboardFiltersContext
|
|
69659
69657
|
);
|
|
69660
69658
|
const { reportFilters, customReportFilters, reportFiltersDispatch } = useContext40(ReportFiltersContext);
|
|
69661
|
-
const specificReportFilters =
|
|
69659
|
+
const specificReportFilters = useMemo36(() => {
|
|
69662
69660
|
if (!reportId) return null;
|
|
69663
69661
|
return Object.values(reportFilters[reportId] ?? []).map((f) => f.filter);
|
|
69664
69662
|
}, [reportFilters, reportId]);
|
|
@@ -69669,7 +69667,7 @@ var useQuill = (reportId, pagination) => {
|
|
|
69669
69667
|
const [loading, setLoading] = useState45(true);
|
|
69670
69668
|
const [error, setError] = useState45(void 0);
|
|
69671
69669
|
const [previousPage, setPreviousPage] = useState45(0);
|
|
69672
|
-
const processedReport =
|
|
69670
|
+
const processedReport = useMemo36(() => {
|
|
69673
69671
|
return reportId && allReportsById[reportId] ? convertInternalReportToReport(
|
|
69674
69672
|
mergeComparisonRange(allReportsById[reportId]),
|
|
69675
69673
|
specificReportFilters ?? [],
|
|
@@ -69866,10 +69864,10 @@ var useQuill = (reportId, pagination) => {
|
|
|
69866
69864
|
|
|
69867
69865
|
// src/hooks/useFormat.ts
|
|
69868
69866
|
init_valueFormatter();
|
|
69869
|
-
import { useMemo as
|
|
69867
|
+
import { useMemo as useMemo37 } from "react";
|
|
69870
69868
|
var useMemoizedRows = (reportId) => {
|
|
69871
69869
|
const { data } = useQuill(reportId);
|
|
69872
|
-
const formattedRows =
|
|
69870
|
+
const formattedRows = useMemo37(() => {
|
|
69873
69871
|
if (!data || !data.rows || !data.columns)
|
|
69874
69872
|
return { rows: [], loading: true };
|
|
69875
69873
|
return {
|