@quillsql/react 2.16.66 → 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 +63 -52
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +335 -324
- 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) {
|
|
@@ -39188,6 +39180,7 @@ function GaugeChart({
|
|
|
39188
39180
|
xAxisField,
|
|
39189
39181
|
xAxisFormat,
|
|
39190
39182
|
containerStyle,
|
|
39183
|
+
className,
|
|
39191
39184
|
colors,
|
|
39192
39185
|
isAnimationActive = true
|
|
39193
39186
|
}) {
|
|
@@ -39201,6 +39194,7 @@ function GaugeChart({
|
|
|
39201
39194
|
percentage: normalizedPercentage,
|
|
39202
39195
|
xAxisFormat,
|
|
39203
39196
|
containerStyle: { ...containerStyle },
|
|
39197
|
+
className,
|
|
39204
39198
|
colors,
|
|
39205
39199
|
isAnimationActive
|
|
39206
39200
|
}
|
|
@@ -39209,6 +39203,7 @@ function GaugeChart({
|
|
|
39209
39203
|
function D3Gauge({
|
|
39210
39204
|
percentage,
|
|
39211
39205
|
containerStyle,
|
|
39206
|
+
className,
|
|
39212
39207
|
xAxisFormat,
|
|
39213
39208
|
colors,
|
|
39214
39209
|
isAnimationActive
|
|
@@ -39377,7 +39372,8 @@ function D3Gauge({
|
|
|
39377
39372
|
"div",
|
|
39378
39373
|
{
|
|
39379
39374
|
ref: containerRef,
|
|
39380
|
-
style: { width: "100%",
|
|
39375
|
+
style: { width: "100%", ...containerStyle },
|
|
39376
|
+
className
|
|
39381
39377
|
}
|
|
39382
39378
|
);
|
|
39383
39379
|
}
|
|
@@ -39683,12 +39679,6 @@ function QuillTableDashboardComponent({
|
|
|
39683
39679
|
init_valueFormatter();
|
|
39684
39680
|
import { Fragment as Fragment6, jsx as jsx50, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
39685
39681
|
var MAX_ROWS_FOR_GENERIC_TABLE = 500;
|
|
39686
|
-
function sumByKey(arr, key) {
|
|
39687
|
-
return arr.reduce((acc, cur) => {
|
|
39688
|
-
const val = parseInt(cur[key], 10);
|
|
39689
|
-
return isNaN(val) ? acc : acc + val;
|
|
39690
|
-
}, 0);
|
|
39691
|
-
}
|
|
39692
39682
|
function Chart({
|
|
39693
39683
|
colors,
|
|
39694
39684
|
reportId,
|
|
@@ -39736,23 +39726,23 @@ function Chart({
|
|
|
39736
39726
|
const { dashboardFilters } = useDashboardInternal(
|
|
39737
39727
|
allReportsById[reportId]?.dashboardName ?? null
|
|
39738
39728
|
);
|
|
39739
|
-
const specificReportFilters =
|
|
39729
|
+
const specificReportFilters = useMemo17(() => {
|
|
39740
39730
|
const reportFilterValues = reportFilters[reportId];
|
|
39741
39731
|
if (reportFilterValues && !hideFilters)
|
|
39742
39732
|
return Object.values(reportFilterValues ?? {}).map((f) => f.filter);
|
|
39743
39733
|
if (allReportsById[reportId]) return dashboardFilters ?? [];
|
|
39744
39734
|
return [];
|
|
39745
39735
|
}, [reportFilters[reportId], allReportsById[reportId], dashboardFilters]);
|
|
39746
|
-
const reportDateFilter =
|
|
39736
|
+
const reportDateFilter = useMemo17(() => {
|
|
39747
39737
|
return specificReportFilters.find((f) => f.filterType === "date_range");
|
|
39748
39738
|
}, [specificReportFilters]);
|
|
39749
|
-
const presetOptions =
|
|
39739
|
+
const presetOptions = useMemo17(() => {
|
|
39750
39740
|
return reportDateFilter ? convertPresetOptionsToSelectableList(
|
|
39751
39741
|
reportDateFilter.presetOptions ?? [],
|
|
39752
39742
|
reportDateFilter.defaultPresetRanges ?? []
|
|
39753
39743
|
) : defaultOptionsV2;
|
|
39754
39744
|
}, [reportDateFilter]);
|
|
39755
|
-
const userFilters =
|
|
39745
|
+
const userFilters = useMemo17(() => {
|
|
39756
39746
|
return filters?.filter((f) => f.filterType !== "date" /* Date */)?.map(convertCustomFilter) ?? dashboardCustomFilters[allReportsById[reportId]?.dashboardName ?? ""];
|
|
39757
39747
|
}, [
|
|
39758
39748
|
filters,
|
|
@@ -39827,32 +39817,32 @@ function Chart({
|
|
|
39827
39817
|
});
|
|
39828
39818
|
}
|
|
39829
39819
|
}, [previousFilters.current]);
|
|
39830
|
-
const dashboardReport =
|
|
39820
|
+
const dashboardReport = useMemo17(
|
|
39831
39821
|
() => allReportsById[reportId],
|
|
39832
39822
|
[reportId, allReportsById]
|
|
39833
39823
|
);
|
|
39834
|
-
const report =
|
|
39824
|
+
const report = useMemo17(() => reports[reportId], [reports, reportId]);
|
|
39835
39825
|
const [loading, setLoading] = useState20(true);
|
|
39836
39826
|
const [theme] = useContext17(ThemeContext);
|
|
39837
|
-
const colorMap =
|
|
39827
|
+
const colorMap = useMemo17(() => {
|
|
39838
39828
|
if (mapColorsToFields && report && theme) {
|
|
39839
39829
|
return mapColorsToFields(report, theme);
|
|
39840
39830
|
}
|
|
39841
39831
|
}, [report, theme]);
|
|
39842
39832
|
const [client, clientLoading] = useContext17(ClientContext);
|
|
39843
|
-
const cloudCacheEnabled =
|
|
39833
|
+
const cloudCacheEnabled = useMemo17(() => {
|
|
39844
39834
|
return !!client?.features?.cloudCache;
|
|
39845
39835
|
}, [client]);
|
|
39846
39836
|
const shouldShowCloudCacheValidationErrors = isAdmin && cloudCacheEnabled;
|
|
39847
|
-
const isMissingDateField =
|
|
39837
|
+
const isMissingDateField = useMemo17(() => {
|
|
39848
39838
|
if (!shouldShowCloudCacheValidationErrors) return false;
|
|
39849
39839
|
return isDateFieldMissingInReport(report);
|
|
39850
39840
|
}, [report, shouldShowCloudCacheValidationErrors]);
|
|
39851
|
-
const usesLimitInQuery =
|
|
39841
|
+
const usesLimitInQuery = useMemo17(() => {
|
|
39852
39842
|
if (!shouldShowCloudCacheValidationErrors) return false;
|
|
39853
39843
|
return reportUsesLimitClause(report);
|
|
39854
39844
|
}, [report, shouldShowCloudCacheValidationErrors]);
|
|
39855
|
-
const missingDashboardFilterFields =
|
|
39845
|
+
const missingDashboardFilterFields = useMemo17(() => {
|
|
39856
39846
|
if (!shouldShowCloudCacheValidationErrors || !report) return [];
|
|
39857
39847
|
return getMissingDashboardFilterFields({
|
|
39858
39848
|
rows: report.rows,
|
|
@@ -40186,24 +40176,24 @@ var ChartDisplay = ({
|
|
|
40186
40176
|
const [theme] = useContext17(ThemeContext);
|
|
40187
40177
|
const { dashboardFilters } = useContext17(DashboardFiltersContext);
|
|
40188
40178
|
const { reportFilters } = useContext17(ReportFiltersContext);
|
|
40189
|
-
const specificDashboardFilters =
|
|
40179
|
+
const specificDashboardFilters = useMemo17(() => {
|
|
40190
40180
|
const dashboardName = config?.dashboardName;
|
|
40191
40181
|
if (!dashboardName) return [];
|
|
40192
40182
|
return Object.values(dashboardFilters[dashboardName] ?? {}).map(
|
|
40193
40183
|
(f) => f.filter
|
|
40194
40184
|
);
|
|
40195
40185
|
}, [dashboardFilters, config?.dashboardName]);
|
|
40196
|
-
const specificReportFilters =
|
|
40186
|
+
const specificReportFilters = useMemo17(() => {
|
|
40197
40187
|
if (!reportId) return [];
|
|
40198
40188
|
return Object.values(reportFilters[reportId] ?? []).map((f) => f.filter);
|
|
40199
40189
|
}, [reportFilters, reportId]);
|
|
40200
|
-
const chartColors =
|
|
40190
|
+
const chartColors = useMemo17(() => {
|
|
40201
40191
|
if (overrideTheme && overrideTheme.chartColors) {
|
|
40202
40192
|
return colors?.length ? colors : overrideTheme && overrideTheme.chartColors && overrideTheme.chartColors.length ? overrideTheme.chartColors : ["#4E80EE", "#E14F62", "#55B5A6", "#E9A23B", "#6466E9", "#55B685"];
|
|
40203
40193
|
}
|
|
40204
40194
|
return colors?.length ? colors : theme && theme.chartColors && theme.chartColors.length ? theme.chartColors : ["#4E80EE", "#E14F62", "#55B5A6", "#E9A23B", "#6466E9", "#55B685"];
|
|
40205
40195
|
}, [colors]);
|
|
40206
|
-
const dateFilter =
|
|
40196
|
+
const dateFilter = useMemo17(() => {
|
|
40207
40197
|
const filters = specificReportFilters.length > 0 ? specificReportFilters : specificDashboardFilters;
|
|
40208
40198
|
if (!hideDateRangeFilter && filters) {
|
|
40209
40199
|
return findAndProcessDateFilter(filters.map((f) => f));
|
|
@@ -40213,7 +40203,7 @@ var ChartDisplay = ({
|
|
|
40213
40203
|
const resolvedShowLegend = showLegend !== void 0 ? showLegend : config?.showLegend ?? false;
|
|
40214
40204
|
const [page, setPage] = useState20(0);
|
|
40215
40205
|
const rowCountForLimit = config?.pivot ? config.pivotRowCount ?? config.pivotRows?.length ?? config.rows?.length : config?.rowCount ?? config?.rows?.length;
|
|
40216
|
-
const tableDisplay =
|
|
40206
|
+
const tableDisplay = useMemo17(() => {
|
|
40217
40207
|
if (!config || config.chartType?.toLowerCase() !== "table") {
|
|
40218
40208
|
return void 0;
|
|
40219
40209
|
}
|
|
@@ -40227,6 +40217,22 @@ var ChartDisplay = ({
|
|
|
40227
40217
|
)
|
|
40228
40218
|
};
|
|
40229
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]);
|
|
40230
40236
|
if (loading) {
|
|
40231
40237
|
return /* @__PURE__ */ jsx50("div", { className, style: containerStyle, children: /* @__PURE__ */ jsx50(LoadingComponent, {}) });
|
|
40232
40238
|
} else if (config && !["metric", "table", "gauge", "US map", "World map"].includes(
|
|
@@ -40245,15 +40251,7 @@ var ChartDisplay = ({
|
|
|
40245
40251
|
{
|
|
40246
40252
|
className,
|
|
40247
40253
|
containerStyle,
|
|
40248
|
-
data:
|
|
40249
|
-
return {
|
|
40250
|
-
...row,
|
|
40251
|
-
count: (
|
|
40252
|
-
// @ts-ignore
|
|
40253
|
-
parseInt(row[config?.yAxisFields[0]?.field]) / sumByKey(config?.rows, config?.yAxisFields[0]?.field)
|
|
40254
|
-
)
|
|
40255
|
-
};
|
|
40256
|
-
}) || [] : config?.rows || [],
|
|
40254
|
+
data: pieData,
|
|
40257
40255
|
category: config?.yAxisFields?.[0]?.field,
|
|
40258
40256
|
index: config?.xAxisField,
|
|
40259
40257
|
colors: chartColors,
|
|
@@ -40262,7 +40260,8 @@ var ChartDisplay = ({
|
|
|
40262
40260
|
onClickChartElement,
|
|
40263
40261
|
onClickLegendElement,
|
|
40264
40262
|
yAxisFields: config?.yAxisFields,
|
|
40265
|
-
showLegend: resolvedShowLegend
|
|
40263
|
+
showLegend: resolvedShowLegend,
|
|
40264
|
+
isAnimationActive
|
|
40266
40265
|
}
|
|
40267
40266
|
);
|
|
40268
40267
|
}
|
|
@@ -40312,7 +40311,8 @@ var ChartDisplay = ({
|
|
|
40312
40311
|
className,
|
|
40313
40312
|
colorMap,
|
|
40314
40313
|
onClickChartElement,
|
|
40315
|
-
scrollable
|
|
40314
|
+
scrollable,
|
|
40315
|
+
showAnimation: isAnimationActive
|
|
40316
40316
|
}
|
|
40317
40317
|
);
|
|
40318
40318
|
}
|
|
@@ -40467,6 +40467,7 @@ var ChartDisplay = ({
|
|
|
40467
40467
|
xAxisField: config?.xAxisField ?? "",
|
|
40468
40468
|
xAxisFormat: config?.xAxisFormat ?? "whole_number",
|
|
40469
40469
|
containerStyle,
|
|
40470
|
+
className,
|
|
40470
40471
|
colors: chartColors,
|
|
40471
40472
|
isAnimationActive
|
|
40472
40473
|
}
|
|
@@ -40816,7 +40817,7 @@ import {
|
|
|
40816
40817
|
forwardRef as forwardRef2,
|
|
40817
40818
|
useContext as useContext20,
|
|
40818
40819
|
useEffect as useEffect17,
|
|
40819
|
-
useMemo as
|
|
40820
|
+
useMemo as useMemo18,
|
|
40820
40821
|
useRef as useRef14,
|
|
40821
40822
|
useState as useState22
|
|
40822
40823
|
} from "react";
|
|
@@ -41317,7 +41318,7 @@ var FilterPopoverWrapper = ({
|
|
|
41317
41318
|
const [uniqueValues, setUniqueValues] = useState22(void 0);
|
|
41318
41319
|
const [uniqueValuesIsLoading, setUniqueValuesIsLoading] = useState22(false);
|
|
41319
41320
|
const prevFiltersRef = useRef14("");
|
|
41320
|
-
const columnInternals =
|
|
41321
|
+
const columnInternals = useMemo18(() => {
|
|
41321
41322
|
if (!tables) {
|
|
41322
41323
|
return null;
|
|
41323
41324
|
}
|
|
@@ -41401,7 +41402,7 @@ var FilterPopoverWrapper = ({
|
|
|
41401
41402
|
|
|
41402
41403
|
// src/components/ReportBuilder/FilterModal.tsx
|
|
41403
41404
|
init_Filter();
|
|
41404
|
-
import { useState as useState23, useEffect as useEffect18, useMemo as
|
|
41405
|
+
import { useState as useState23, useEffect as useEffect18, useMemo as useMemo19 } from "react";
|
|
41405
41406
|
init_textProcessing();
|
|
41406
41407
|
init_filterProcessing();
|
|
41407
41408
|
import { format as format8, isValid as isValid6, parse as parse4, startOfToday as startOfToday2 } from "date-fns";
|
|
@@ -41443,11 +41444,11 @@ function FilterModal({
|
|
|
41443
41444
|
);
|
|
41444
41445
|
const [filterInitialized, setFilterInitialized] = useState23(false);
|
|
41445
41446
|
const [table, setTable] = useState23(void 0);
|
|
41446
|
-
const memoizedFieldValuesMap =
|
|
41447
|
+
const memoizedFieldValuesMap = useMemo19(
|
|
41447
41448
|
() => fieldValuesMap,
|
|
41448
41449
|
[JSON.stringify(fieldValuesMap)]
|
|
41449
41450
|
);
|
|
41450
|
-
const memoizedFilter =
|
|
41451
|
+
const memoizedFilter = useMemo19(() => filter, [JSON.stringify(filter)]);
|
|
41451
41452
|
useEffect18(() => {
|
|
41452
41453
|
if (!filter) {
|
|
41453
41454
|
onFieldChange(field, fieldOptions, table);
|
|
@@ -42472,7 +42473,7 @@ function DashboardLegacy({
|
|
|
42472
42473
|
}) {
|
|
42473
42474
|
const [userFilters, setUserFilters] = useState26({});
|
|
42474
42475
|
const [selectedSection, setSelectedSection] = useState26("");
|
|
42475
|
-
const dataLoaderUserFilters =
|
|
42476
|
+
const dataLoaderUserFilters = useMemo20(() => {
|
|
42476
42477
|
return (filters?.map((f) => convertCustomFilter(f)) ?? []).concat(
|
|
42477
42478
|
Object.values(userFilters)
|
|
42478
42479
|
);
|
|
@@ -42495,7 +42496,7 @@ function DashboardLegacy({
|
|
|
42495
42496
|
const { getToken } = useContext21(FetchContext);
|
|
42496
42497
|
const { customFilterDispatch } = useContext21(DashboardFiltersContext);
|
|
42497
42498
|
const { eventTracking } = useContext21(EventTrackingContext);
|
|
42498
|
-
const metrics =
|
|
42499
|
+
const metrics = useMemo20(() => {
|
|
42499
42500
|
const map = {};
|
|
42500
42501
|
Object.keys(data?.sections ?? {}).forEach((section) => {
|
|
42501
42502
|
if (!data?.sections?.[section]) return;
|
|
@@ -42523,7 +42524,7 @@ function DashboardLegacy({
|
|
|
42523
42524
|
});
|
|
42524
42525
|
return map;
|
|
42525
42526
|
}, [data?.sections, data?.sectionOrder]);
|
|
42526
|
-
const charts =
|
|
42527
|
+
const charts = useMemo20(() => {
|
|
42527
42528
|
const map = {};
|
|
42528
42529
|
Object.keys(data?.sections ?? {}).forEach((section) => {
|
|
42529
42530
|
if (!data?.sections?.[section]) return;
|
|
@@ -42549,7 +42550,7 @@ function DashboardLegacy({
|
|
|
42549
42550
|
});
|
|
42550
42551
|
return map;
|
|
42551
42552
|
}, [data?.sections, data?.sectionOrder]);
|
|
42552
|
-
const tables =
|
|
42553
|
+
const tables = useMemo20(() => {
|
|
42553
42554
|
const map = {};
|
|
42554
42555
|
Object.keys(data?.sections ?? {}).forEach((section) => {
|
|
42555
42556
|
if (!data?.sections?.[section]) return;
|
|
@@ -42610,7 +42611,7 @@ function DashboardLegacy({
|
|
|
42610
42611
|
filterListAddFilterPopoverIsOpen,
|
|
42611
42612
|
setFilterListAddFilterPopoverIsOpen
|
|
42612
42613
|
] = useState26(false);
|
|
42613
|
-
const presetOptions =
|
|
42614
|
+
const presetOptions = useMemo20(() => {
|
|
42614
42615
|
return populatedDashboardFilters?.[0]?.filterType === "date_range" ? convertPresetOptionsToSelectableList(
|
|
42615
42616
|
populatedDashboardFilters[0].presetOptions ?? [],
|
|
42616
42617
|
populatedDashboardFilters[0].defaultPresetRanges ?? []
|
|
@@ -42627,7 +42628,7 @@ function DashboardLegacy({
|
|
|
42627
42628
|
previousFilters.current = filters;
|
|
42628
42629
|
}
|
|
42629
42630
|
const isInitialLoadOfDashboardRef = useRef15(false);
|
|
42630
|
-
const referencedTables =
|
|
42631
|
+
const referencedTables = useMemo20(() => {
|
|
42631
42632
|
const sections = data?.sections || {};
|
|
42632
42633
|
const tables2 = Object.values(sections).flatMap(
|
|
42633
42634
|
(section) => section.map((chart) => chart.referencedTables)
|
|
@@ -43662,11 +43663,11 @@ function QuillDashboardTemplate({
|
|
|
43662
43663
|
}
|
|
43663
43664
|
|
|
43664
43665
|
// src/Dashboard.tsx
|
|
43665
|
-
import { useContext as useContext22, useMemo as
|
|
43666
|
+
import { useContext as useContext22, useMemo as useMemo22 } from "react";
|
|
43666
43667
|
init_Filter();
|
|
43667
43668
|
|
|
43668
43669
|
// src/StaticChart.tsx
|
|
43669
|
-
import { useMemo as
|
|
43670
|
+
import { useMemo as useMemo21 } from "react";
|
|
43670
43671
|
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
43671
43672
|
var CHART_TYPE_STYLES = {
|
|
43672
43673
|
metric: { height: "100px", width: "200px" },
|
|
@@ -43681,7 +43682,9 @@ function StaticChart(props) {
|
|
|
43681
43682
|
onClickLegendElement,
|
|
43682
43683
|
containerStyle,
|
|
43683
43684
|
showLegend,
|
|
43684
|
-
|
|
43685
|
+
showAnimation,
|
|
43686
|
+
className,
|
|
43687
|
+
hideTableChartOuterBorder = true
|
|
43685
43688
|
} = props;
|
|
43686
43689
|
const {
|
|
43687
43690
|
report,
|
|
@@ -43717,7 +43720,7 @@ function StaticChart(props) {
|
|
|
43717
43720
|
});
|
|
43718
43721
|
};
|
|
43719
43722
|
const useLocalPivotTablePagination = isDashboardPivotTable(report);
|
|
43720
|
-
const config =
|
|
43723
|
+
const config = useMemo21(() => {
|
|
43721
43724
|
return report ? {
|
|
43722
43725
|
...report,
|
|
43723
43726
|
...useLocalPivotTablePagination ? { pagination: void 0 } : {},
|
|
@@ -43738,9 +43741,17 @@ function StaticChart(props) {
|
|
|
43738
43741
|
className,
|
|
43739
43742
|
containerStyle: safeContainerStyle,
|
|
43740
43743
|
showLegend,
|
|
43744
|
+
isAnimationActive: showAnimation,
|
|
43741
43745
|
onPageChange: useLocalPivotTablePagination ? void 0 : onPageChange,
|
|
43742
43746
|
tableRowsLoading: useLocalPivotTablePagination ? false : pageLoading,
|
|
43743
|
-
onSortChange: useLocalPivotTablePagination ? void 0 : onSortChange
|
|
43747
|
+
onSortChange: useLocalPivotTablePagination ? void 0 : onSortChange,
|
|
43748
|
+
tableChartWrapperBorders: hideTableChartOuterBorder && report?.chartType === "table" ? {
|
|
43749
|
+
borderRadius: 0,
|
|
43750
|
+
borderLeft: "none",
|
|
43751
|
+
borderRight: "none",
|
|
43752
|
+
borderTop: "none",
|
|
43753
|
+
borderBottom: "none"
|
|
43754
|
+
} : void 0
|
|
43744
43755
|
}
|
|
43745
43756
|
);
|
|
43746
43757
|
}
|
|
@@ -44081,11 +44092,11 @@ function Dashboard({
|
|
|
44081
44092
|
EmptyDashboardComponent
|
|
44082
44093
|
}) {
|
|
44083
44094
|
const [themeFromContext] = useContext22(ThemeContext);
|
|
44084
|
-
const theme =
|
|
44095
|
+
const theme = useMemo22(
|
|
44085
44096
|
() => ({ ...defaultQuillTheme, ...themeFromContext ?? {} }),
|
|
44086
44097
|
[themeFromContext]
|
|
44087
44098
|
);
|
|
44088
|
-
const themedStyles =
|
|
44099
|
+
const themedStyles = useMemo22(() => getThemedStyles(theme), [theme]);
|
|
44089
44100
|
const { sections, sectionOrder, isLoading, filters, applyFilters } = useDashboard(name2);
|
|
44090
44101
|
const toValidDate = (value) => {
|
|
44091
44102
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -44287,11 +44298,11 @@ function DashboardContent({
|
|
|
44287
44298
|
const capitalized = name2.charAt(0).toUpperCase() + name2.slice(1);
|
|
44288
44299
|
return sections[capitalized] ?? [];
|
|
44289
44300
|
};
|
|
44290
|
-
const rootSectionReports =
|
|
44301
|
+
const rootSectionReports = useMemo22(
|
|
44291
44302
|
() => [...getSection("")].sort(sortByOrdering2),
|
|
44292
44303
|
[sections]
|
|
44293
44304
|
);
|
|
44294
|
-
const { chartReports, metricReports, tableReports } =
|
|
44305
|
+
const { chartReports, metricReports, tableReports } = useMemo22(() => {
|
|
44295
44306
|
const metricReports2 = rootSectionReports.filter(
|
|
44296
44307
|
({ chartType }) => chartType === "metric"
|
|
44297
44308
|
);
|
|
@@ -44303,7 +44314,7 @@ function DashboardContent({
|
|
|
44303
44314
|
);
|
|
44304
44315
|
return { chartReports: chartReports2, metricReports: metricReports2, tableReports: tableReports2 };
|
|
44305
44316
|
}, [rootSectionReports]);
|
|
44306
|
-
const orderedNonRootSectionEntries =
|
|
44317
|
+
const orderedNonRootSectionEntries = useMemo22(() => {
|
|
44307
44318
|
const sectionEntries = Object.entries(sections ?? {}).filter(
|
|
44308
44319
|
([sectionName, reports]) => sectionName !== "" && reports.length > 0
|
|
44309
44320
|
);
|
|
@@ -44500,7 +44511,7 @@ var QuillProvider_default = QuillProvider;
|
|
|
44500
44511
|
import {
|
|
44501
44512
|
useContext as useContext23,
|
|
44502
44513
|
useEffect as useEffect20,
|
|
44503
|
-
useMemo as
|
|
44514
|
+
useMemo as useMemo23,
|
|
44504
44515
|
useState as useState27
|
|
44505
44516
|
} from "react";
|
|
44506
44517
|
init_Filter();
|
|
@@ -44520,17 +44531,17 @@ var Table = ({
|
|
|
44520
44531
|
const { eventTracking } = useContext23(EventTrackingContext);
|
|
44521
44532
|
const { allReportsById } = useAllReports();
|
|
44522
44533
|
const [loading, setLoading] = useState27(false);
|
|
44523
|
-
const report =
|
|
44534
|
+
const report = useMemo23(() => {
|
|
44524
44535
|
return props.reportId ? allReportsById[props.reportId] : null;
|
|
44525
44536
|
}, [allReportsById[props.reportId ?? ""]]);
|
|
44526
44537
|
const { reportFilters, customReportFilters, reportFiltersDispatch } = useContext23(ReportFiltersContext);
|
|
44527
44538
|
const { reports, fetchIndividualReport, reportsDispatch } = useContext23(ReportsContext);
|
|
44528
|
-
const specificReportFilters =
|
|
44539
|
+
const specificReportFilters = useMemo23(() => {
|
|
44529
44540
|
return Object.values(
|
|
44530
44541
|
reportFilters[props.reportId ?? ""] ?? (dashboard[report?.dashboardName ?? ""]?.[report?.id ?? ""] ? dashboardFilters[report.dashboardName] : null) ?? {}
|
|
44531
44542
|
).map((f) => f.filter);
|
|
44532
44543
|
}, [reportFilters[props.reportId ?? ""]]);
|
|
44533
|
-
const userFilters =
|
|
44544
|
+
const userFilters = useMemo23(() => {
|
|
44534
44545
|
return (props.filters?.filter((f) => f.filterType !== "date" /* Date */)?.map(convertCustomFilter) ?? []).concat(
|
|
44535
44546
|
customReportFilters[props.reportId ?? ""] ?? dashboardCustomFilters[report?.dashboardName ?? ""] ?? []
|
|
44536
44547
|
);
|
|
@@ -44686,7 +44697,7 @@ import {
|
|
|
44686
44697
|
useContext as useContext30,
|
|
44687
44698
|
useEffect as useEffect25,
|
|
44688
44699
|
useRef as useRef20,
|
|
44689
|
-
useMemo as
|
|
44700
|
+
useMemo as useMemo28,
|
|
44690
44701
|
useCallback as useCallback4
|
|
44691
44702
|
} from "react";
|
|
44692
44703
|
import MonacoEditor from "@monaco-editor/react";
|
|
@@ -44697,7 +44708,7 @@ import {
|
|
|
44697
44708
|
useRef as useRef19,
|
|
44698
44709
|
useState as useState31,
|
|
44699
44710
|
useContext as useContext28,
|
|
44700
|
-
useMemo as
|
|
44711
|
+
useMemo as useMemo27,
|
|
44701
44712
|
useCallback as useCallback3
|
|
44702
44713
|
} from "react";
|
|
44703
44714
|
import {
|
|
@@ -44721,7 +44732,7 @@ import { CSS as DND_CSS } from "@dnd-kit/utilities";
|
|
|
44721
44732
|
import {
|
|
44722
44733
|
useCallback as useCallback2,
|
|
44723
44734
|
useContext as useContext25,
|
|
44724
|
-
useMemo as
|
|
44735
|
+
useMemo as useMemo24,
|
|
44725
44736
|
useState as useState28,
|
|
44726
44737
|
useEffect as useEffect21,
|
|
44727
44738
|
useRef as useRef16
|
|
@@ -45229,13 +45240,13 @@ var PivotModal = ({
|
|
|
45229
45240
|
"bottom"
|
|
45230
45241
|
);
|
|
45231
45242
|
const popoverRef = useRef16(null);
|
|
45232
|
-
const columnsToShow =
|
|
45243
|
+
const columnsToShow = useMemo24(() => {
|
|
45233
45244
|
return (columns || []).reduce((map, col) => {
|
|
45234
45245
|
map[col.field] = col.format;
|
|
45235
45246
|
return map;
|
|
45236
45247
|
}, {});
|
|
45237
45248
|
}, [columns]);
|
|
45238
|
-
const columnTypes =
|
|
45249
|
+
const columnTypes = useMemo24(() => {
|
|
45239
45250
|
return (columns || []).reduce((map, col) => {
|
|
45240
45251
|
map[col.field] = col.jsType;
|
|
45241
45252
|
return map;
|
|
@@ -46968,7 +46979,7 @@ import {
|
|
|
46968
46979
|
useState as useState29,
|
|
46969
46980
|
useEffect as useEffect22,
|
|
46970
46981
|
useContext as useContext26,
|
|
46971
|
-
useMemo as
|
|
46982
|
+
useMemo as useMemo25,
|
|
46972
46983
|
useRef as useRef17,
|
|
46973
46984
|
useLayoutEffect as useLayoutEffect3
|
|
46974
46985
|
} from "react";
|
|
@@ -47092,7 +47103,7 @@ function InternalChart({
|
|
|
47092
47103
|
const { eventTracking } = useContext26(EventTrackingContext);
|
|
47093
47104
|
const [filtersPopoverOpen, setFiltersPopoverOpen] = useState29(false);
|
|
47094
47105
|
const filtersButtonRef = useRef17(null);
|
|
47095
|
-
const currentReportFilters =
|
|
47106
|
+
const currentReportFilters = useMemo25(() => {
|
|
47096
47107
|
const dashFilters = dashboardConfig[report?.dashboardName ?? ""]?.config.filters;
|
|
47097
47108
|
if (!dashFilters)
|
|
47098
47109
|
return Object.values(reportFilters[report?.id ?? TEMP_REPORT_ID] ?? {});
|
|
@@ -47108,12 +47119,12 @@ function InternalChart({
|
|
|
47108
47119
|
}
|
|
47109
47120
|
});
|
|
47110
47121
|
}, [reportFilters, report?.id]);
|
|
47111
|
-
const reportDateFilter =
|
|
47122
|
+
const reportDateFilter = useMemo25(() => {
|
|
47112
47123
|
return Object.values(
|
|
47113
47124
|
reportFilters[report?.id ?? TEMP_REPORT_ID] ?? {}
|
|
47114
47125
|
).find((f) => f.filter.filterType === "date_range")?.filter;
|
|
47115
47126
|
}, [reportFilters, report?.id]);
|
|
47116
|
-
const presetOptions =
|
|
47127
|
+
const presetOptions = useMemo25(() => {
|
|
47117
47128
|
return reportDateFilter ? convertPresetOptionsToSelectableList(
|
|
47118
47129
|
reportDateFilter.presetOptions ?? [],
|
|
47119
47130
|
reportDateFilter.defaultPresetRanges ?? []
|
|
@@ -47160,7 +47171,7 @@ function InternalChart({
|
|
|
47160
47171
|
}
|
|
47161
47172
|
}, [filters]);
|
|
47162
47173
|
const [theme] = useContext26(ThemeContext);
|
|
47163
|
-
const colorMap =
|
|
47174
|
+
const colorMap = useMemo25(() => {
|
|
47164
47175
|
if (mapColorsToFields && report && theme) {
|
|
47165
47176
|
return mapColorsToFields(report, theme);
|
|
47166
47177
|
}
|
|
@@ -47285,7 +47296,7 @@ function InternalChart({
|
|
|
47285
47296
|
const [filtersExpanded, setFiltersExpanded] = useState29(false);
|
|
47286
47297
|
const filtersContainerRef = useRef17(null);
|
|
47287
47298
|
const [visibleFilters, setVisibleFilters] = useState29([]);
|
|
47288
|
-
const filtersOverflowing =
|
|
47299
|
+
const filtersOverflowing = useMemo25(() => {
|
|
47289
47300
|
return visibleFilters.some((visible) => visible);
|
|
47290
47301
|
}, [visibleFilters]);
|
|
47291
47302
|
const measureItems = () => {
|
|
@@ -47548,7 +47559,7 @@ init_dates();
|
|
|
47548
47559
|
// src/components/QuillMultiSelectSectionList.tsx
|
|
47549
47560
|
import React16, {
|
|
47550
47561
|
useContext as useContext27,
|
|
47551
|
-
useMemo as
|
|
47562
|
+
useMemo as useMemo26,
|
|
47552
47563
|
useRef as useRef18,
|
|
47553
47564
|
useState as useState30
|
|
47554
47565
|
} from "react";
|
|
@@ -47622,7 +47633,7 @@ function QuillMultiSelectSectionList({
|
|
|
47622
47633
|
const filteredLength = React16.useMemo(() => {
|
|
47623
47634
|
return Object.values(filteredItems).reduce((a, b) => a + b.length, 0);
|
|
47624
47635
|
}, [filteredItems]);
|
|
47625
|
-
const selectedOptionsLabel =
|
|
47636
|
+
const selectedOptionsLabel = useMemo26(() => {
|
|
47626
47637
|
const valuesLength = Object.values(value).reduce((a, b) => a + b.length, 0);
|
|
47627
47638
|
if (!valuesLength) {
|
|
47628
47639
|
return "Select";
|
|
@@ -48486,11 +48497,11 @@ function ChartBuilder({
|
|
|
48486
48497
|
const { dashboardConfig } = useContext28(DashboardConfigContext);
|
|
48487
48498
|
const { tenants, flags } = useContext28(TenantContext);
|
|
48488
48499
|
const isReportLoading = reportId && !tempReport && reportsLoadingState[reportId];
|
|
48489
|
-
const report =
|
|
48500
|
+
const report = useMemo27(() => {
|
|
48490
48501
|
const resolvedReport = reportId && !tempReport ? allReportsById[reportId] : tempReport;
|
|
48491
48502
|
return resolvedReport;
|
|
48492
48503
|
}, [reportId, tempReport, allReportsById]);
|
|
48493
|
-
const reportFieldsByName =
|
|
48504
|
+
const reportFieldsByName = useMemo27(() => {
|
|
48494
48505
|
const fields = report?.fields;
|
|
48495
48506
|
if (!fields || fields.length === 0) {
|
|
48496
48507
|
return {};
|
|
@@ -48590,7 +48601,7 @@ function ChartBuilder({
|
|
|
48590
48601
|
const modalPadding = 20;
|
|
48591
48602
|
const deleteButtonMargin = -12;
|
|
48592
48603
|
const { dashboardFilters } = useContext28(DashboardFiltersContext);
|
|
48593
|
-
const specificDashboardFilters =
|
|
48604
|
+
const specificDashboardFilters = useMemo27(() => {
|
|
48594
48605
|
return Object.values(
|
|
48595
48606
|
dashboardFilters[report?.dashboardName ?? ""] ?? {}
|
|
48596
48607
|
).map((f) => f.filter);
|
|
@@ -48641,7 +48652,7 @@ function ChartBuilder({
|
|
|
48641
48652
|
const { reportsDispatch } = useContext28(ReportsContext);
|
|
48642
48653
|
const initialFilters = useRef19(reportFilters[report?.id ?? TEMP_REPORT_ID]);
|
|
48643
48654
|
const [reportFiltersLoaded, setReportFiltersLoaded] = useState31(!filtersEnabled);
|
|
48644
|
-
const hasExistingData =
|
|
48655
|
+
const hasExistingData = useMemo27(() => {
|
|
48645
48656
|
return report?.rows && report.rows.length > 0 || report?.pivotRows && report.pivotRows.length > 0;
|
|
48646
48657
|
}, [report?.rows, report?.pivotRows]);
|
|
48647
48658
|
useEffect23(() => {
|
|
@@ -48672,7 +48683,7 @@ function ChartBuilder({
|
|
|
48672
48683
|
}
|
|
48673
48684
|
};
|
|
48674
48685
|
}, []);
|
|
48675
|
-
const currentDashboardFilters =
|
|
48686
|
+
const currentDashboardFilters = useMemo27(() => {
|
|
48676
48687
|
return Object.values(reportFilters[report?.id ?? TEMP_REPORT_ID] ?? {}).map(
|
|
48677
48688
|
(f) => f.filter
|
|
48678
48689
|
);
|
|
@@ -48750,14 +48761,14 @@ function ChartBuilder({
|
|
|
48750
48761
|
const [referencedColumnsWithoutStar, setReferencedColumnsWithoutStar] = useState31({});
|
|
48751
48762
|
const [referencedTablesLoaded, setReferencedTablesLoaded] = useState31(false);
|
|
48752
48763
|
const [filterMap, setFilterMap] = useState31(report?.filterMap ?? {});
|
|
48753
|
-
const canonicalFilterMap =
|
|
48764
|
+
const canonicalFilterMap = useMemo27(() => {
|
|
48754
48765
|
return Object.fromEntries(
|
|
48755
48766
|
Object.entries(filterMap).filter(
|
|
48756
48767
|
(f) => f[1].table !== void 0 && f[1].field !== void 0
|
|
48757
48768
|
)
|
|
48758
48769
|
);
|
|
48759
48770
|
}, [filterMap]);
|
|
48760
|
-
const validFilter =
|
|
48771
|
+
const validFilter = useMemo27(() => {
|
|
48761
48772
|
return specificDashboardFilters.reduce(
|
|
48762
48773
|
(acc, filter) => {
|
|
48763
48774
|
if (filter.filterType === "date_range" || filter.filterType === "tenant" || !referencedTablesLoaded) {
|
|
@@ -48983,12 +48994,12 @@ function ChartBuilder({
|
|
|
48983
48994
|
const [formData, setFormData] = useState31(
|
|
48984
48995
|
formFormDataFromReport(report, destinationSection ?? getCurrentSection())
|
|
48985
48996
|
);
|
|
48986
|
-
const reportCustomFields =
|
|
48997
|
+
const reportCustomFields = useMemo27(() => {
|
|
48987
48998
|
return report?.columnsWithCustomFields?.filter(
|
|
48988
48999
|
(col) => !report?.columns?.some((c) => col.field === c.field)
|
|
48989
49000
|
) ?? [];
|
|
48990
49001
|
}, [report?.columnsWithCustomFields, report?.columns]);
|
|
48991
|
-
const referenceLineQueryResults =
|
|
49002
|
+
const referenceLineQueryResults = useMemo27(() => {
|
|
48992
49003
|
return formData?.referenceLines?.map((line) => {
|
|
48993
49004
|
if (line.label === REFERENCE_LINE) {
|
|
48994
49005
|
return [Number(line.y1) || 0, Number(line.y2) || 0];
|
|
@@ -49002,10 +49013,10 @@ function ChartBuilder({
|
|
|
49002
49013
|
);
|
|
49003
49014
|
});
|
|
49004
49015
|
}, [formData?.referenceLines]);
|
|
49005
|
-
const currentDashboard =
|
|
49016
|
+
const currentDashboard = useMemo27(() => {
|
|
49006
49017
|
return dashboardConfig[formData.dashboardName ?? report?.dashboardName ?? ""]?.config;
|
|
49007
49018
|
}, [dashboardConfig, formData.dashboardName, report?.dashboardName]);
|
|
49008
|
-
const currentDashboardTenants =
|
|
49019
|
+
const currentDashboardTenants = useMemo27(() => {
|
|
49009
49020
|
return currentDashboard?.tenantKeys?.map(
|
|
49010
49021
|
(tenantKey) => client?.allTenantTypes?.find(
|
|
49011
49022
|
(t) => t.tenantField === tenantKey
|
|
@@ -49013,7 +49024,7 @@ function ChartBuilder({
|
|
|
49013
49024
|
) ?? [];
|
|
49014
49025
|
}, [client?.allTenantTypes, currentDashboard?.tenantKeys]);
|
|
49015
49026
|
const dashboardOwner = currentDashboardTenants?.[0];
|
|
49016
|
-
const currentTenantAsFormFlags =
|
|
49027
|
+
const currentTenantAsFormFlags = useMemo27(() => {
|
|
49017
49028
|
if (!tenants || !tenants.length) {
|
|
49018
49029
|
return void 0;
|
|
49019
49030
|
}
|
|
@@ -49024,7 +49035,7 @@ function ChartBuilder({
|
|
|
49024
49035
|
const tenantIds = typeof tenants[0] !== "object" ? tenants : tenants[0]?.tenantIds;
|
|
49025
49036
|
return { [tenantField]: tenantIds };
|
|
49026
49037
|
}, [tenants, dashboardOwner]);
|
|
49027
|
-
const invalidColumns =
|
|
49038
|
+
const invalidColumns = useMemo27(() => {
|
|
49028
49039
|
if (!rows || !rows.length) {
|
|
49029
49040
|
return [];
|
|
49030
49041
|
}
|
|
@@ -49046,7 +49057,7 @@ function ChartBuilder({
|
|
|
49046
49057
|
);
|
|
49047
49058
|
})()
|
|
49048
49059
|
);
|
|
49049
|
-
const reportContainsCustomFields =
|
|
49060
|
+
const reportContainsCustomFields = useMemo27(() => {
|
|
49050
49061
|
const customFieldsMap = schemaData.customFields;
|
|
49051
49062
|
const reportQueryContainsCustomFields = allTables.some((table) => {
|
|
49052
49063
|
const tableColumns = referencedColumnsWithoutStar[table] ?? [];
|
|
@@ -49057,7 +49068,7 @@ function ChartBuilder({
|
|
|
49057
49068
|
});
|
|
49058
49069
|
return reportQueryContainsCustomFields;
|
|
49059
49070
|
}, [allTables, referencedColumnsWithoutStar]);
|
|
49060
|
-
const chartBuilderFormDataContainsCustomFields =
|
|
49071
|
+
const chartBuilderFormDataContainsCustomFields = useMemo27(() => {
|
|
49061
49072
|
const customFields = allTables.map((table) => schemaData.customFields?.[table] ?? []).flat();
|
|
49062
49073
|
const customFieldsMap = schemaData.customFields;
|
|
49063
49074
|
const pivotContainsCustomFields = customFields.some(
|
|
@@ -49090,13 +49101,13 @@ function ChartBuilder({
|
|
|
49090
49101
|
formData.dateField,
|
|
49091
49102
|
canonicalFilterMap
|
|
49092
49103
|
]);
|
|
49093
|
-
const customFieldsInTabularColumns =
|
|
49104
|
+
const customFieldsInTabularColumns = useMemo27(() => {
|
|
49094
49105
|
const customFields = allTables.map((table) => schemaData.customFields?.[table] ?? []).flat();
|
|
49095
49106
|
return formData.columns.some((col) => {
|
|
49096
49107
|
return customFields.some((field) => field.field === col.field);
|
|
49097
49108
|
});
|
|
49098
49109
|
}, [allTables, formData.columns]);
|
|
49099
|
-
const containsCustomFields =
|
|
49110
|
+
const containsCustomFields = useMemo27(() => {
|
|
49100
49111
|
return reportContainsCustomFields || customFieldsInTabularColumns || chartBuilderFormDataContainsCustomFields;
|
|
49101
49112
|
}, [
|
|
49102
49113
|
reportContainsCustomFields,
|
|
@@ -49269,7 +49280,7 @@ function ChartBuilder({
|
|
|
49269
49280
|
handleRunQuery(baseProcessing, currentDashboardFilters);
|
|
49270
49281
|
}
|
|
49271
49282
|
}, [runQueryOnMount, reportFiltersLoaded, filtersEnabled]);
|
|
49272
|
-
const allTenantMap =
|
|
49283
|
+
const allTenantMap = useMemo27(() => {
|
|
49273
49284
|
return client?.allTenantTypes?.reduce(
|
|
49274
49285
|
(acc, tenantType) => {
|
|
49275
49286
|
if (tenantType.scope === "database") {
|
|
@@ -49309,14 +49320,14 @@ function ChartBuilder({
|
|
|
49309
49320
|
},
|
|
49310
49321
|
[columns, selectedPivotTable]
|
|
49311
49322
|
);
|
|
49312
|
-
const pivotCardTable =
|
|
49323
|
+
const pivotCardTable = useMemo27(() => {
|
|
49313
49324
|
return {
|
|
49314
49325
|
pivot: formData.pivot,
|
|
49315
49326
|
rows: selectedPivotTable?.rows ?? [],
|
|
49316
49327
|
columns: selectedPivotTable?.columns ?? []
|
|
49317
49328
|
};
|
|
49318
49329
|
}, [selectedPivotTable, formData.pivot]);
|
|
49319
|
-
const chartData =
|
|
49330
|
+
const chartData = useMemo27(() => {
|
|
49320
49331
|
const data = createReportFromForm(
|
|
49321
49332
|
formData,
|
|
49322
49333
|
report ? { ...report, rowCount } : tempReport,
|
|
@@ -49338,7 +49349,7 @@ function ChartBuilder({
|
|
|
49338
49349
|
rowCount,
|
|
49339
49350
|
currentDashboardFilters
|
|
49340
49351
|
]);
|
|
49341
|
-
const xAxisFormatOptions =
|
|
49352
|
+
const xAxisFormatOptions = useMemo27(() => {
|
|
49342
49353
|
return chartData?.chartType === "gauge" ? [
|
|
49343
49354
|
{ value: "whole_number", label: "whole number" },
|
|
49344
49355
|
{ value: "two_decimal_places", label: "two decimal places" },
|
|
@@ -49402,7 +49413,7 @@ function ChartBuilder({
|
|
|
49402
49413
|
setSelectedPivotTable(void 0);
|
|
49403
49414
|
}
|
|
49404
49415
|
};
|
|
49405
|
-
const formattedRows =
|
|
49416
|
+
const formattedRows = useMemo27(() => {
|
|
49406
49417
|
const shouldUsePivotTableRows = selectedPivotTable && selectedPivotTable.columns && formData.chartType === "table";
|
|
49407
49418
|
if (shouldUsePivotTableRows) {
|
|
49408
49419
|
const columns2 = selectedPivotTable.columns;
|
|
@@ -50089,7 +50100,7 @@ function ChartBuilder({
|
|
|
50089
50100
|
setIsSubmitting(false);
|
|
50090
50101
|
setTriggeredEditChart(false);
|
|
50091
50102
|
};
|
|
50092
|
-
const memoizedTooltipText =
|
|
50103
|
+
const memoizedTooltipText = useMemo27(() => {
|
|
50093
50104
|
const getTooltipText = () => {
|
|
50094
50105
|
if (formData.name === "") {
|
|
50095
50106
|
return "Please enter a name for the chart";
|
|
@@ -52523,7 +52534,7 @@ function SQLEditor({
|
|
|
52523
52534
|
const { getToken, quillFetchWithToken } = useContext30(FetchContext);
|
|
52524
52535
|
const { eventTracking } = useContext30(EventTrackingContext);
|
|
52525
52536
|
const { allReportsById } = useAllReports();
|
|
52526
|
-
const destinationDashboardConfig =
|
|
52537
|
+
const destinationDashboardConfig = useMemo28(() => {
|
|
52527
52538
|
return dashboards?.find((d) => d.name === destinationDashboard);
|
|
52528
52539
|
}, [dashboards, destinationDashboard]);
|
|
52529
52540
|
const [query, setQuery] = useState33(defaultQuery);
|
|
@@ -52531,7 +52542,7 @@ function SQLEditor({
|
|
|
52531
52542
|
const [columns, setColumns] = useState33([]);
|
|
52532
52543
|
const [schemaData] = useContext30(SchemaDataContext);
|
|
52533
52544
|
const { dashboardFilters } = useContext30(DashboardFiltersContext);
|
|
52534
|
-
const specificDashboardFilters =
|
|
52545
|
+
const specificDashboardFilters = useMemo28(() => {
|
|
52535
52546
|
return Object.values(
|
|
52536
52547
|
dashboardFilters[report?.dashboardName ?? destinationDashboard ?? ""] ?? {}
|
|
52537
52548
|
).map((f) => f.filter);
|
|
@@ -52569,7 +52580,7 @@ function SQLEditor({
|
|
|
52569
52580
|
const DEFAULT_ROWS_PER_PAGE = 5;
|
|
52570
52581
|
const ROW_HEIGHT = 37;
|
|
52571
52582
|
const TABLE_TAB_HEIGHT = 75;
|
|
52572
|
-
const filteredSchema =
|
|
52583
|
+
const filteredSchema = useMemo28(() => {
|
|
52573
52584
|
return schemaData.schemaWithCustomFields?.filter((table) => {
|
|
52574
52585
|
return destinationDashboardConfig?.tenantKeys?.[0] === SINGLE_TENANT || !table.ownerTenantFields || table.ownerTenantFields?.length === 0 || table.ownerTenantFields?.includes(
|
|
52575
52586
|
destinationDashboardConfig?.tenantKeys?.[0] ?? ""
|
|
@@ -52644,7 +52655,7 @@ function SQLEditor({
|
|
|
52644
52655
|
};
|
|
52645
52656
|
const [currentPage, setCurrentPage] = useState33(0);
|
|
52646
52657
|
const [currentSort, setCurrentSort] = useState33(void 0);
|
|
52647
|
-
const currentProcessing =
|
|
52658
|
+
const currentProcessing = useMemo28(() => {
|
|
52648
52659
|
return {
|
|
52649
52660
|
page: {
|
|
52650
52661
|
currentPage,
|
|
@@ -52657,7 +52668,7 @@ function SQLEditor({
|
|
|
52657
52668
|
sort: currentSort
|
|
52658
52669
|
};
|
|
52659
52670
|
}, [currentPage, rowsPerPage, currentSort]);
|
|
52660
|
-
const displayedTableData =
|
|
52671
|
+
const displayedTableData = useMemo28(() => {
|
|
52661
52672
|
return filteredSchema?.filter((table) => {
|
|
52662
52673
|
return table.name?.toLowerCase()?.includes(tableSearchQuery.toLowerCase().trim()) || table.columns.some(
|
|
52663
52674
|
(col) => col.field?.toLowerCase()?.includes(tableSearchQuery.toLowerCase().trim())
|
|
@@ -54044,7 +54055,7 @@ import {
|
|
|
54044
54055
|
init_constants();
|
|
54045
54056
|
|
|
54046
54057
|
// src/hooks/useReportBuilder.tsx
|
|
54047
|
-
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";
|
|
54048
54059
|
init_tableProcessing();
|
|
54049
54060
|
init_ReportBuilder();
|
|
54050
54061
|
init_constants();
|
|
@@ -54073,10 +54084,10 @@ var useReportBuilderInternal = ({
|
|
|
54073
54084
|
} = useDashboardInternal(destinationDashboard);
|
|
54074
54085
|
const { getToken, quillFetchWithToken } = useContext31(FetchContext);
|
|
54075
54086
|
const { eventTracking } = useContext31(EventTrackingContext);
|
|
54076
|
-
const destinationDashboardConfig =
|
|
54087
|
+
const destinationDashboardConfig = useMemo29(() => {
|
|
54077
54088
|
return dashboards?.find((d) => d.name === destinationDashboard);
|
|
54078
54089
|
}, [dashboards, destinationDashboard]);
|
|
54079
|
-
const filteredSchema =
|
|
54090
|
+
const filteredSchema = useMemo29(() => {
|
|
54080
54091
|
return schemaData.schemaWithCustomFields?.filter((table) => {
|
|
54081
54092
|
return destinationDashboardConfig?.tenantKeys?.[0] === SINGLE_TENANT || !table.ownerTenantFields || table.ownerTenantFields?.length === 0 || table.ownerTenantFields?.includes(
|
|
54082
54093
|
destinationDashboardConfig?.tenantKeys?.[0] ?? ""
|
|
@@ -54107,7 +54118,7 @@ var useReportBuilderInternal = ({
|
|
|
54107
54118
|
const [pivot, setPivot] = useState34(null);
|
|
54108
54119
|
const [sort, setSort] = useState34([]);
|
|
54109
54120
|
const [limit, setLimit] = useState34(null);
|
|
54110
|
-
const reportBuilderState =
|
|
54121
|
+
const reportBuilderState = useMemo29(() => {
|
|
54111
54122
|
return {
|
|
54112
54123
|
tables,
|
|
54113
54124
|
columns,
|
|
@@ -54139,7 +54150,7 @@ var useReportBuilderInternal = ({
|
|
|
54139
54150
|
const [pivotData, setPivotData] = useState34(null);
|
|
54140
54151
|
const [numberOfRows, setNumberOfRows] = useState34(0);
|
|
54141
54152
|
const [rowCountIsLoading, setRowCountIsLoading] = useState34(false);
|
|
54142
|
-
const reportColumnsToStateColumns =
|
|
54153
|
+
const reportColumnsToStateColumns = useMemo29(() => {
|
|
54143
54154
|
const positionMap = {};
|
|
54144
54155
|
columns.forEach((column, index) => {
|
|
54145
54156
|
positionMap[column.field] = index;
|
|
@@ -54193,7 +54204,7 @@ var useReportBuilderInternal = ({
|
|
|
54193
54204
|
origin: "ReportBuilder",
|
|
54194
54205
|
loadDescription: "Loading ask AI"
|
|
54195
54206
|
});
|
|
54196
|
-
const isSelectStar =
|
|
54207
|
+
const isSelectStar = useMemo29(() => {
|
|
54197
54208
|
if (tables.length === 1) {
|
|
54198
54209
|
const totalColumnLength = tables.reduce((acc, table) => {
|
|
54199
54210
|
const tableColumns = filteredSchema.find((t) => t.name === table.name)?.columns.length ?? 0;
|
|
@@ -54204,14 +54215,14 @@ var useReportBuilderInternal = ({
|
|
|
54204
54215
|
return false;
|
|
54205
54216
|
}
|
|
54206
54217
|
}, [tables, columns, filteredSchema]);
|
|
54207
|
-
const mssqlSortWarning =
|
|
54218
|
+
const mssqlSortWarning = useMemo29(() => {
|
|
54208
54219
|
if (!client || client?.databaseType !== "mssql") {
|
|
54209
54220
|
return void 0;
|
|
54210
54221
|
} else if (!pivot && !limit) {
|
|
54211
54222
|
return "Please add a limit.";
|
|
54212
54223
|
}
|
|
54213
54224
|
}, [client, limit, pivot]);
|
|
54214
|
-
const foreignKeyMap =
|
|
54225
|
+
const foreignKeyMap = useMemo29(() => {
|
|
54215
54226
|
return getSchemaForeignKeyMapping(filteredSchema);
|
|
54216
54227
|
}, [filteredSchema]);
|
|
54217
54228
|
const clearAllState = (resetStateStack = true) => {
|
|
@@ -55528,7 +55539,7 @@ var useReportBuilder = ({
|
|
|
55528
55539
|
reportBuilder.setAiPrompt(prompt);
|
|
55529
55540
|
await reportBuilder.fetchAstFromPromptHelper(prompt);
|
|
55530
55541
|
};
|
|
55531
|
-
const cleanedSchema =
|
|
55542
|
+
const cleanedSchema = useMemo29(() => {
|
|
55532
55543
|
return reportBuilder.filteredSchema.reduce(
|
|
55533
55544
|
(acc, table) => {
|
|
55534
55545
|
acc[table.name] = table.columns;
|
|
@@ -55537,7 +55548,7 @@ var useReportBuilder = ({
|
|
|
55537
55548
|
{}
|
|
55538
55549
|
);
|
|
55539
55550
|
}, [reportBuilder.filteredSchema]);
|
|
55540
|
-
const cleanedFilterStack =
|
|
55551
|
+
const cleanedFilterStack = useMemo29(() => {
|
|
55541
55552
|
return reportBuilder.filterStack.map((filter) => {
|
|
55542
55553
|
return filter.value ? convertInternalFilterToFilter(filter.value) : null;
|
|
55543
55554
|
}).filter((filter) => filter !== null);
|
|
@@ -55574,7 +55585,7 @@ var useReportBuilder = ({
|
|
|
55574
55585
|
init_ReportBuilder();
|
|
55575
55586
|
|
|
55576
55587
|
// src/components/ReportBuilder/AddColumnModal.tsx
|
|
55577
|
-
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";
|
|
55578
55589
|
import {
|
|
55579
55590
|
DndContext as DndContext2,
|
|
55580
55591
|
closestCenter as closestCenter2,
|
|
@@ -55619,7 +55630,7 @@ function AddColumnModal({
|
|
|
55619
55630
|
const [modalSelectedColumns, setModalSelectedColumns] = useState35(
|
|
55620
55631
|
selectedColumns.map((col) => `${col.table}.${col.field}`)
|
|
55621
55632
|
);
|
|
55622
|
-
const columnOptions =
|
|
55633
|
+
const columnOptions = useMemo30(() => {
|
|
55623
55634
|
return schema.filter((table) => {
|
|
55624
55635
|
if (!primaryTable) return true;
|
|
55625
55636
|
return table.name === primaryTable || foreignKeyMap[primaryTable]?.some(
|
|
@@ -55645,7 +55656,7 @@ function AddColumnModal({
|
|
|
55645
55656
|
}, [schema, primaryTable]);
|
|
55646
55657
|
const [orderedColumnNames, setOrderedColumnNames] = useState35([]);
|
|
55647
55658
|
const isSelectedAllColumns = columnOptions.length === modalSelectedColumns.length;
|
|
55648
|
-
const searchResults =
|
|
55659
|
+
const searchResults = useMemo30(() => {
|
|
55649
55660
|
return orderedColumnNames.filter((column) => {
|
|
55650
55661
|
return columnOptions.includes(column) && (search.length === 0 || column.toLowerCase().includes(search.toLowerCase()) || snakeAndCamelCaseToTitleCase(column).toLowerCase().includes(search.toLowerCase()));
|
|
55651
55662
|
});
|
|
@@ -56021,7 +56032,7 @@ import {
|
|
|
56021
56032
|
sortableKeyboardCoordinates as sortableKeyboardCoordinates3,
|
|
56022
56033
|
verticalListSortingStrategy as verticalListSortingStrategy3
|
|
56023
56034
|
} from "@dnd-kit/sortable";
|
|
56024
|
-
import { useMemo as
|
|
56035
|
+
import { useMemo as useMemo31 } from "react";
|
|
56025
56036
|
import { jsx as jsx73, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
56026
56037
|
function DraggableColumns({
|
|
56027
56038
|
columns,
|
|
@@ -56035,7 +56046,7 @@ function DraggableColumns({
|
|
|
56035
56046
|
coordinateGetter: sortableKeyboardCoordinates3
|
|
56036
56047
|
})
|
|
56037
56048
|
);
|
|
56038
|
-
const columnNames =
|
|
56049
|
+
const columnNames = useMemo31(() => {
|
|
56039
56050
|
return columns.map(
|
|
56040
56051
|
(col) => `${col.table}.${col.alias ?? col.field}`
|
|
56041
56052
|
);
|
|
@@ -58576,7 +58587,7 @@ function ReportBuilder({
|
|
|
58576
58587
|
import {
|
|
58577
58588
|
useContext as useContext35,
|
|
58578
58589
|
useEffect as useEffect30,
|
|
58579
|
-
useMemo as
|
|
58590
|
+
useMemo as useMemo32,
|
|
58580
58591
|
useRef as useRef23,
|
|
58581
58592
|
useState as useState40
|
|
58582
58593
|
} from "react";
|
|
@@ -58631,7 +58642,7 @@ function ChartEditor({
|
|
|
58631
58642
|
const [modalHeight, setModalHeight] = useState40(200);
|
|
58632
58643
|
const { allReportsById } = useAllReports();
|
|
58633
58644
|
const report = allReportsById[reportId];
|
|
58634
|
-
const resolvedDashboard =
|
|
58645
|
+
const resolvedDashboard = useMemo32(
|
|
58635
58646
|
() => destinationDashboard ?? report?.dashboardName ?? null,
|
|
58636
58647
|
[destinationDashboard, report?.dashboardName]
|
|
58637
58648
|
);
|
|
@@ -58643,7 +58654,7 @@ function ChartEditor({
|
|
|
58643
58654
|
const { dashboardFilters } = useContext35(DashboardFiltersContext);
|
|
58644
58655
|
const { eventTracking } = useContext35(EventTrackingContext);
|
|
58645
58656
|
const { reload } = useDashboardInternal(resolvedDashboard);
|
|
58646
|
-
const specificDashboardFilters =
|
|
58657
|
+
const specificDashboardFilters = useMemo32(() => {
|
|
58647
58658
|
if (!report) {
|
|
58648
58659
|
return [];
|
|
58649
58660
|
}
|
|
@@ -58656,7 +58667,7 @@ function ChartEditor({
|
|
|
58656
58667
|
const dateFilter = Object.values(specificDashboardFilters).find(
|
|
58657
58668
|
(filter) => filter.filterType === "date_range"
|
|
58658
58669
|
);
|
|
58659
|
-
const dateRange =
|
|
58670
|
+
const dateRange = useMemo32(() => {
|
|
58660
58671
|
return dateFilter?.startDate ? { start: dateFilter.startDate, end: dateFilter.endDate } : void 0;
|
|
58661
58672
|
}, [dateFilter]);
|
|
58662
58673
|
useEffect30(() => {
|
|
@@ -58807,7 +58818,7 @@ function ChartEditor({
|
|
|
58807
58818
|
import { useContext as useContext37, useEffect as useEffect32, useRef as useRef25, useState as useState42 } from "react";
|
|
58808
58819
|
|
|
58809
58820
|
// src/ChatChartCard.tsx
|
|
58810
|
-
import { useMemo as
|
|
58821
|
+
import { useMemo as useMemo34 } from "react";
|
|
58811
58822
|
|
|
58812
58823
|
// src/hooks/useForm.tsx
|
|
58813
58824
|
init_Filter();
|
|
@@ -58817,7 +58828,7 @@ import {
|
|
|
58817
58828
|
useContext as useContext36,
|
|
58818
58829
|
useEffect as useEffect31,
|
|
58819
58830
|
useLayoutEffect as useLayoutEffect4,
|
|
58820
|
-
useMemo as
|
|
58831
|
+
useMemo as useMemo33,
|
|
58821
58832
|
useReducer as useReducer2,
|
|
58822
58833
|
useRef as useRef24,
|
|
58823
58834
|
useState as useState41
|
|
@@ -63641,7 +63652,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63641
63652
|
clientDefaultDashboardName,
|
|
63642
63653
|
destinationDashboardName
|
|
63643
63654
|
].map((entry) => String(entry ?? "").trim()).find((entry) => entry.length > 0) ?? "";
|
|
63644
|
-
const initialFormState =
|
|
63655
|
+
const initialFormState = useMemo33(
|
|
63645
63656
|
() => ({
|
|
63646
63657
|
reportName: void 0,
|
|
63647
63658
|
columns: [],
|
|
@@ -63691,13 +63702,13 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63691
63702
|
schemaDatasourceIds
|
|
63692
63703
|
} = formState;
|
|
63693
63704
|
const schemaDatasourceIdsKey = schemaDatasourceIds?.map((id) => String(id ?? "").trim()).join("\0") ?? "";
|
|
63694
|
-
const queryColumnsBootstrapKey =
|
|
63705
|
+
const queryColumnsBootstrapKey = useMemo33(
|
|
63695
63706
|
() => queryColumns.map(
|
|
63696
63707
|
(c) => `${String(c.table ?? "").trim()}\0${String(c.field ?? "").trim()}`
|
|
63697
63708
|
).join("\n"),
|
|
63698
63709
|
[queryColumns]
|
|
63699
63710
|
);
|
|
63700
|
-
const dashboardNameForNewReport =
|
|
63711
|
+
const dashboardNameForNewReport = useMemo33(() => {
|
|
63701
63712
|
return [clientDefaultDashboardName, destinationDashboardName].map((entry) => String(entry ?? "").trim()).find((entry) => entry.length > 0) ?? "";
|
|
63702
63713
|
}, [clientDefaultDashboardName, destinationDashboardName]);
|
|
63703
63714
|
const { mutate: createReport } = useMutation({
|
|
@@ -63771,16 +63782,16 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63771
63782
|
);
|
|
63772
63783
|
schemaScopeInitializedForReportIdRef.current = effectiveReportId;
|
|
63773
63784
|
};
|
|
63774
|
-
const internalFilters =
|
|
63785
|
+
const internalFilters = useMemo33(
|
|
63775
63786
|
() => internalFiltersFromFilterStack(filterStack),
|
|
63776
63787
|
[filterStack]
|
|
63777
63788
|
);
|
|
63778
|
-
const customFilters =
|
|
63789
|
+
const customFilters = useMemo33(
|
|
63779
63790
|
() => customFiltersFromFilterStack(filterStack),
|
|
63780
63791
|
[filterStack]
|
|
63781
63792
|
);
|
|
63782
|
-
const reloadKey =
|
|
63783
|
-
const schemaForReportBuilderState =
|
|
63793
|
+
const reloadKey = useMemo33(() => 0, []);
|
|
63794
|
+
const schemaForReportBuilderState = useMemo33(() => {
|
|
63784
63795
|
if (schemaData.schemaWithCustomFields?.length) {
|
|
63785
63796
|
return schemaData.schemaWithCustomFields;
|
|
63786
63797
|
}
|
|
@@ -63803,19 +63814,19 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63803
63814
|
},
|
|
63804
63815
|
[]
|
|
63805
63816
|
);
|
|
63806
|
-
const schemaForeignKeyMap =
|
|
63817
|
+
const schemaForeignKeyMap = useMemo33(
|
|
63807
63818
|
() => getSchemaForeignKeyMapping(schemaForReportBuilderState),
|
|
63808
63819
|
[schemaForReportBuilderState]
|
|
63809
63820
|
);
|
|
63810
63821
|
const reportBuilderBaseTableNamesKey = (sourceReport?.reportBuilderState?.tables ?? []).map((t) => String(t?.name ?? "").trim()).filter(Boolean).join("\0") ?? "";
|
|
63811
|
-
const selectedBaseTableNamesForFieldOptions =
|
|
63822
|
+
const selectedBaseTableNamesForFieldOptions = useMemo33(() => {
|
|
63812
63823
|
const fromPicker = schemaDatasourceIds?.map((id) => String(id ?? "").trim()).filter(Boolean) ?? [];
|
|
63813
63824
|
if (fromPicker.length > 0) {
|
|
63814
63825
|
return fromPicker;
|
|
63815
63826
|
}
|
|
63816
63827
|
return (sourceReport?.reportBuilderState?.tables ?? []).map((t) => String(t?.name ?? "").trim()).filter(Boolean);
|
|
63817
63828
|
}, [schemaDatasourceIdsKey, reportBuilderBaseTableNamesKey]);
|
|
63818
|
-
const fieldOptionsAllowedTableNames =
|
|
63829
|
+
const fieldOptionsAllowedTableNames = useMemo33(() => {
|
|
63819
63830
|
if (!restrictFieldOptionsToSelectedDatasources) {
|
|
63820
63831
|
return null;
|
|
63821
63832
|
}
|
|
@@ -63892,7 +63903,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63892
63903
|
schemaForReportBuilderState,
|
|
63893
63904
|
queryColumnsBootstrapKey
|
|
63894
63905
|
]);
|
|
63895
|
-
const datasourceOptions =
|
|
63906
|
+
const datasourceOptions = useMemo33(() => {
|
|
63896
63907
|
const seen = /* @__PURE__ */ new Set();
|
|
63897
63908
|
const result = [];
|
|
63898
63909
|
for (const table2 of schemaForReportBuilderState) {
|
|
@@ -63903,7 +63914,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63903
63914
|
}
|
|
63904
63915
|
return result;
|
|
63905
63916
|
}, [schemaForReportBuilderState]);
|
|
63906
|
-
const queryBuilderFieldConfigByName =
|
|
63917
|
+
const queryBuilderFieldConfigByName = useMemo33(() => {
|
|
63907
63918
|
const configByName = buildQueryBuilderFieldConfigByName(
|
|
63908
63919
|
schemaForReportBuilderState
|
|
63909
63920
|
);
|
|
@@ -64037,7 +64048,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64037
64048
|
sourceReport?.columns,
|
|
64038
64049
|
sourceReport?.reportBuilderState?.columns
|
|
64039
64050
|
]);
|
|
64040
|
-
const filterUniqueValuesRequest =
|
|
64051
|
+
const filterUniqueValuesRequest = useMemo33(() => {
|
|
64041
64052
|
const dashboardName = resolvedSourceDashboardName;
|
|
64042
64053
|
const reportBuilderStateFromSource = sourceReport?.reportBuilderState;
|
|
64043
64054
|
const isStringReportBuilderColumn = (column) => {
|
|
@@ -64258,13 +64269,13 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64258
64269
|
sourceReport?.reportBuilderState,
|
|
64259
64270
|
resolvedSourceDashboardName
|
|
64260
64271
|
]);
|
|
64261
|
-
const filterUniqueValuesRequestHash =
|
|
64272
|
+
const filterUniqueValuesRequestHash = useMemo33(
|
|
64262
64273
|
() => stableSerializeForQueryKey(
|
|
64263
64274
|
filterUniqueValuesRequestForQueryKey(filterUniqueValuesRequest)
|
|
64264
64275
|
),
|
|
64265
64276
|
[filterUniqueValuesRequest]
|
|
64266
64277
|
);
|
|
64267
|
-
const customFiltersHashForUniqueValues =
|
|
64278
|
+
const customFiltersHashForUniqueValues = useMemo33(
|
|
64268
64279
|
() => stableSerializeForQueryKey(customFilters),
|
|
64269
64280
|
[customFilters]
|
|
64270
64281
|
);
|
|
@@ -64341,7 +64352,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64341
64352
|
enabled: filterUniqueValuesEnabled,
|
|
64342
64353
|
retry: false
|
|
64343
64354
|
});
|
|
64344
|
-
const backendUniqueValuesByFieldName =
|
|
64355
|
+
const backendUniqueValuesByFieldName = useMemo33(() => {
|
|
64345
64356
|
const valuesByField = /* @__PURE__ */ new Map();
|
|
64346
64357
|
const uniqueValuesByColumn = filterUniqueValuesQuery.data?.uniqueValuesByColumn;
|
|
64347
64358
|
if (!uniqueValuesByColumn || typeof uniqueValuesByColumn !== "object") {
|
|
@@ -64374,7 +64385,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64374
64385
|
filterUniqueValuesQuery.data?.uniqueValuesByColumn,
|
|
64375
64386
|
filterUniqueValuesRequest?.stringColumnsByTable
|
|
64376
64387
|
]);
|
|
64377
|
-
const filterValueOptionsByFieldName =
|
|
64388
|
+
const filterValueOptionsByFieldName = useMemo33(() => {
|
|
64378
64389
|
const optionsByField = /* @__PURE__ */ new Map();
|
|
64379
64390
|
const selectedMultiselectByField = collectSelectedStringMultiselectValuesByField(queryFilters);
|
|
64380
64391
|
const collectValuesForField = (fieldName) => {
|
|
@@ -64440,7 +64451,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64440
64451
|
queryBuilderFieldConfigByName,
|
|
64441
64452
|
queryFilters
|
|
64442
64453
|
]);
|
|
64443
|
-
const filterFieldsComputed =
|
|
64454
|
+
const filterFieldsComputed = useMemo33(() => {
|
|
64444
64455
|
const fields = [];
|
|
64445
64456
|
const seen = /* @__PURE__ */ new Set();
|
|
64446
64457
|
const addField = (fieldName, fieldType, tableName, rawFieldName) => {
|
|
@@ -64543,7 +64554,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64543
64554
|
]);
|
|
64544
64555
|
const filterFieldsStableReportIdRef = useRef24("");
|
|
64545
64556
|
const filterFieldsStableCacheRef = useRef24([]);
|
|
64546
|
-
const filterFields =
|
|
64557
|
+
const filterFields = useMemo33(() => {
|
|
64547
64558
|
const rid = String(effectiveReportId ?? "");
|
|
64548
64559
|
if (filterFieldsStableReportIdRef.current !== rid) {
|
|
64549
64560
|
filterFieldsStableReportIdRef.current = rid;
|
|
@@ -64558,14 +64569,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64558
64569
|
}
|
|
64559
64570
|
return filterFieldsComputed;
|
|
64560
64571
|
}, [effectiveReportId, filterFieldsComputed]);
|
|
64561
|
-
const getFilterOperators =
|
|
64572
|
+
const getFilterOperators = useMemo33(
|
|
64562
64573
|
() => (_field, misc) => {
|
|
64563
64574
|
const fieldType = misc?.fieldData?.quillFieldType ?? queryBuilderFieldConfigByName[String(_field ?? "").trim()]?.fieldType ?? "string";
|
|
64564
64575
|
return QUERY_BUILDER_OPERATORS_BY_FIELD_TYPE[fieldType] ?? QUERY_BUILDER_OPERATORS_BY_FIELD_TYPE.string;
|
|
64565
64576
|
},
|
|
64566
64577
|
[queryBuilderFieldConfigByName]
|
|
64567
64578
|
);
|
|
64568
|
-
const getFilterInputType =
|
|
64579
|
+
const getFilterInputType = useMemo33(
|
|
64569
64580
|
() => (_field, operator, misc) => {
|
|
64570
64581
|
const fieldType = misc?.fieldData?.quillFieldType ?? queryBuilderFieldConfigByName[String(_field ?? "").trim()]?.fieldType ?? "string";
|
|
64571
64582
|
if (fieldType === "date" && isRelativeDateQueryBuilderOperator(operator)) {
|
|
@@ -64575,7 +64586,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64575
64586
|
},
|
|
64576
64587
|
[queryBuilderFieldConfigByName]
|
|
64577
64588
|
);
|
|
64578
|
-
const getFilterValueEditorType =
|
|
64589
|
+
const getFilterValueEditorType = useMemo33(
|
|
64579
64590
|
() => (_field, operator, misc) => {
|
|
64580
64591
|
const fieldType = misc?.fieldData?.quillFieldType ?? queryBuilderFieldConfigByName[String(_field ?? "").trim()]?.fieldType;
|
|
64581
64592
|
if (fieldType === "string" && isMultiValueOperator(operator)) {
|
|
@@ -64588,7 +64599,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64588
64599
|
},
|
|
64589
64600
|
[queryBuilderFieldConfigByName]
|
|
64590
64601
|
);
|
|
64591
|
-
const getFilterValues =
|
|
64602
|
+
const getFilterValues = useMemo33(
|
|
64592
64603
|
() => (_field, operator, misc) => {
|
|
64593
64604
|
const fieldName = String(_field ?? "").trim();
|
|
64594
64605
|
if (!fieldName) {
|
|
@@ -64618,7 +64629,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64618
64629
|
},
|
|
64619
64630
|
[filterValueOptionsByFieldName, queryBuilderFieldConfigByName]
|
|
64620
64631
|
);
|
|
64621
|
-
const filterQueryBuilderProps =
|
|
64632
|
+
const filterQueryBuilderProps = useMemo33(
|
|
64622
64633
|
() => ({
|
|
64623
64634
|
fields: filterFields,
|
|
64624
64635
|
listsAsArrays: true,
|
|
@@ -64635,7 +64646,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64635
64646
|
getFilterValues
|
|
64636
64647
|
]
|
|
64637
64648
|
);
|
|
64638
|
-
const filtersForQueryBuilder =
|
|
64649
|
+
const filtersForQueryBuilder = useMemo33(
|
|
64639
64650
|
() => canonicalizeMultiselectStringRulesToOptionValues(
|
|
64640
64651
|
queryFilters,
|
|
64641
64652
|
filterValueOptionsByFieldName,
|
|
@@ -64702,12 +64713,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64702
64713
|
...table2 ? { table: table2 } : {}
|
|
64703
64714
|
};
|
|
64704
64715
|
};
|
|
64705
|
-
const tenantHash =
|
|
64716
|
+
const tenantHash = useMemo33(
|
|
64706
64717
|
() => stableSerializeForQueryKey(tenants),
|
|
64707
64718
|
[tenants]
|
|
64708
64719
|
);
|
|
64709
|
-
const flagHash =
|
|
64710
|
-
const clientHash =
|
|
64720
|
+
const flagHash = useMemo33(() => stableSerializeForQueryKey(flags), [flags]);
|
|
64721
|
+
const clientHash = useMemo33(
|
|
64711
64722
|
() => stableSerializeForQueryKey({
|
|
64712
64723
|
publicKey: client?.publicKey,
|
|
64713
64724
|
clientId: client?.clientId,
|
|
@@ -64715,7 +64726,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64715
64726
|
}),
|
|
64716
64727
|
[client]
|
|
64717
64728
|
);
|
|
64718
|
-
const reloadKeyHash =
|
|
64729
|
+
const reloadKeyHash = useMemo33(
|
|
64719
64730
|
() => stableSerializeForQueryKey(reloadKey),
|
|
64720
64731
|
[reloadKey]
|
|
64721
64732
|
);
|
|
@@ -64993,11 +65004,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64993
65004
|
schemaForReportBuilderState,
|
|
64994
65005
|
sourceReport
|
|
64995
65006
|
]);
|
|
64996
|
-
const appliedAggregationState =
|
|
65007
|
+
const appliedAggregationState = useMemo33(
|
|
64997
65008
|
() => aggregationState.filter(isAppliedAggregation),
|
|
64998
65009
|
[aggregationState]
|
|
64999
65010
|
);
|
|
65000
|
-
const pivotState =
|
|
65011
|
+
const pivotState = useMemo33(() => {
|
|
65001
65012
|
if (!resolvedGroupRowsBy && !resolvedGroupColumnsBy && appliedAggregationState.length === 0) {
|
|
65002
65013
|
return null;
|
|
65003
65014
|
}
|
|
@@ -65075,7 +65086,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65075
65086
|
}
|
|
65076
65087
|
prevPivotStateForColumnExpansionRef.current = pivotState;
|
|
65077
65088
|
}, [pivotState]);
|
|
65078
|
-
const effectiveReportBuilderTables =
|
|
65089
|
+
const effectiveReportBuilderTables = useMemo33(() => {
|
|
65079
65090
|
const explicitBaseFromSchemaPicker = Array.isArray(schemaDatasourceIds) && schemaDatasourceIds.length > 0 ? schemaDatasourceIds.map((tableName) => String(tableName ?? "").trim()).filter(Boolean).map((name2) => ({ name: name2 })) : null;
|
|
65080
65091
|
const baseTablesForMerge = explicitBaseFromSchemaPicker ?? baseReportBuilderTables;
|
|
65081
65092
|
return mergeReportBuilderTables(
|
|
@@ -65099,18 +65110,18 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65099
65110
|
queryColumns,
|
|
65100
65111
|
schemaDatasourceIds
|
|
65101
65112
|
]);
|
|
65102
|
-
const datasources =
|
|
65113
|
+
const datasources = useMemo33(() => {
|
|
65103
65114
|
return effectiveReportBuilderTables.map((table2) => String(table2.name ?? "").trim()).filter((name2) => Boolean(name2));
|
|
65104
65115
|
}, [effectiveReportBuilderTables]);
|
|
65105
|
-
const effectiveReportBuilderTableNames =
|
|
65116
|
+
const effectiveReportBuilderTableNames = useMemo33(
|
|
65106
65117
|
() => effectiveReportBuilderTables.map((table2) => String(table2.name ?? "").trim()).filter((name2) => Boolean(name2)),
|
|
65107
65118
|
[effectiveReportBuilderTables]
|
|
65108
65119
|
);
|
|
65109
|
-
const baseReportBuilderTableNames =
|
|
65120
|
+
const baseReportBuilderTableNames = useMemo33(
|
|
65110
65121
|
() => baseReportBuilderTables.map((table2) => String(table2.name ?? "").trim()).filter((name2) => Boolean(name2)),
|
|
65111
65122
|
[baseReportBuilderTables]
|
|
65112
65123
|
);
|
|
65113
|
-
const normalizeQueryBuilderFieldNameForConfig =
|
|
65124
|
+
const normalizeQueryBuilderFieldNameForConfig = useMemo33(() => {
|
|
65114
65125
|
const configEntries = Object.entries(queryBuilderFieldConfigByName);
|
|
65115
65126
|
const preferredTableNames = /* @__PURE__ */ new Set([
|
|
65116
65127
|
...effectiveReportBuilderTableNames,
|
|
@@ -65159,7 +65170,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65159
65170
|
effectiveReportBuilderTableNames,
|
|
65160
65171
|
queryBuilderFieldConfigByName
|
|
65161
65172
|
]);
|
|
65162
|
-
const normalizeQueryBuilderFiltersForConfig =
|
|
65173
|
+
const normalizeQueryBuilderFiltersForConfig = useMemo33(() => {
|
|
65163
65174
|
const normalizeGroup = (group) => {
|
|
65164
65175
|
const groupRules = Array.isArray(group.rules) ? group.rules : [];
|
|
65165
65176
|
const nextRules = groupRules.map((entry) => {
|
|
@@ -65196,14 +65207,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65196
65207
|
return normalizeGroup(group);
|
|
65197
65208
|
};
|
|
65198
65209
|
}, [normalizeQueryBuilderFieldNameForConfig, queryBuilderFieldConfigByName]);
|
|
65199
|
-
const refreshSelectionTables =
|
|
65210
|
+
const refreshSelectionTables = useMemo33(() => {
|
|
65200
65211
|
return [
|
|
65201
65212
|
getPivotGroupOptionTable(groupRowsBy),
|
|
65202
65213
|
getPivotGroupOptionTable(groupColumnsBy),
|
|
65203
65214
|
...aggregationTablesByIndex
|
|
65204
65215
|
].map((tableName) => String(tableName ?? "").trim()).filter((tableName) => Boolean(tableName));
|
|
65205
65216
|
}, [aggregationTablesByIndex, groupColumnsBy, groupRowsBy]);
|
|
65206
|
-
const refreshSelectionFields =
|
|
65217
|
+
const refreshSelectionFields = useMemo33(() => {
|
|
65207
65218
|
const resolveFieldTableForSelection = (field, tableHint) => {
|
|
65208
65219
|
const fieldName = String(field ?? "").trim();
|
|
65209
65220
|
if (!fieldName) return "";
|
|
@@ -65253,7 +65264,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65253
65264
|
schemaForReportBuilderState,
|
|
65254
65265
|
sourceReport
|
|
65255
65266
|
]);
|
|
65256
|
-
const refreshDecision =
|
|
65267
|
+
const refreshDecision = useMemo33(
|
|
65257
65268
|
() => decideReportBuilderRefresh({
|
|
65258
65269
|
baseTables: baseReportBuilderTables,
|
|
65259
65270
|
baseColumns: baseReportBuilderColumns,
|
|
@@ -65267,7 +65278,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65267
65278
|
refreshSelectionTables
|
|
65268
65279
|
]
|
|
65269
65280
|
);
|
|
65270
|
-
const effectiveReportBuilderColumns =
|
|
65281
|
+
const effectiveReportBuilderColumns = useMemo33(() => {
|
|
65271
65282
|
const columnsFromPivot = [];
|
|
65272
65283
|
const appendPivotColumn = (field, tableHint) => {
|
|
65273
65284
|
const normalizedField = String(field ?? "").trim();
|
|
@@ -65365,7 +65376,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65365
65376
|
queryBuilderFieldConfigByName,
|
|
65366
65377
|
queryFilters
|
|
65367
65378
|
]);
|
|
65368
|
-
const resolvedSortFieldType =
|
|
65379
|
+
const resolvedSortFieldType = useMemo33(() => {
|
|
65369
65380
|
const sortField = pivotSort?.sortField;
|
|
65370
65381
|
if (!sortField || !pivotState) return void 0;
|
|
65371
65382
|
if (sortField === resolvedGroupRowsBy) {
|
|
@@ -65386,7 +65397,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65386
65397
|
resolvedGroupColumnsBy,
|
|
65387
65398
|
resolvedGroupRowsBy
|
|
65388
65399
|
]);
|
|
65389
|
-
const effectiveReportBuilderState =
|
|
65400
|
+
const effectiveReportBuilderState = useMemo33(() => {
|
|
65390
65401
|
if (!sourceReport && effectiveReportBuilderTables.length === 0) {
|
|
65391
65402
|
return void 0;
|
|
65392
65403
|
}
|
|
@@ -65425,7 +65436,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65425
65436
|
resolvedSortFieldType,
|
|
65426
65437
|
sourceReport
|
|
65427
65438
|
]);
|
|
65428
|
-
const effectiveReportBuilderStateHash =
|
|
65439
|
+
const effectiveReportBuilderStateHash = useMemo33(
|
|
65429
65440
|
() => stableSerializeForQueryKey(effectiveReportBuilderState),
|
|
65430
65441
|
[effectiveReportBuilderState]
|
|
65431
65442
|
);
|
|
@@ -65446,7 +65457,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65446
65457
|
activate: false
|
|
65447
65458
|
});
|
|
65448
65459
|
}, [applyPaginationUpdate, effectiveReportBuilderStateHash]);
|
|
65449
|
-
const pivotTableDataReportBuilderState =
|
|
65460
|
+
const pivotTableDataReportBuilderState = useMemo33(() => {
|
|
65450
65461
|
if (!effectiveReportBuilderState?.pivot) {
|
|
65451
65462
|
return void 0;
|
|
65452
65463
|
}
|
|
@@ -65466,11 +65477,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65466
65477
|
limit: null
|
|
65467
65478
|
};
|
|
65468
65479
|
}, [effectiveReportBuilderState, schemaForReportBuilderState]);
|
|
65469
|
-
const pivotTableDataReportBuilderStateHash =
|
|
65480
|
+
const pivotTableDataReportBuilderStateHash = useMemo33(
|
|
65470
65481
|
() => stableSerializeForQueryKey(pivotTableDataReportBuilderState),
|
|
65471
65482
|
[pivotTableDataReportBuilderState]
|
|
65472
65483
|
);
|
|
65473
|
-
const sourceReportMatchesEffectiveReportId =
|
|
65484
|
+
const sourceReportMatchesEffectiveReportId = useMemo33(() => {
|
|
65474
65485
|
const loadTarget = String(effectiveReportId ?? "").trim();
|
|
65475
65486
|
if (!loadTarget || !sourceReport) {
|
|
65476
65487
|
return true;
|
|
@@ -65480,7 +65491,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65480
65491
|
).trim();
|
|
65481
65492
|
return sid === loadTarget;
|
|
65482
65493
|
}, [effectiveReportId, sourceReport]);
|
|
65483
|
-
const shouldSkipRedundantFlatTableReportBuilderQuery =
|
|
65494
|
+
const shouldSkipRedundantFlatTableReportBuilderQuery = useMemo33(() => {
|
|
65484
65495
|
if (!sourceReport || pivotState) {
|
|
65485
65496
|
return false;
|
|
65486
65497
|
}
|
|
@@ -65591,7 +65602,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65591
65602
|
effectiveReportId,
|
|
65592
65603
|
sourceReport?.id
|
|
65593
65604
|
]);
|
|
65594
|
-
const chartTypes =
|
|
65605
|
+
const chartTypes = useMemo33(() => {
|
|
65595
65606
|
return getChartTypeOptions2({ pivot: pivotState });
|
|
65596
65607
|
}, [pivotState]);
|
|
65597
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;
|
|
@@ -65630,7 +65641,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65630
65641
|
});
|
|
65631
65642
|
}
|
|
65632
65643
|
}, [chartType, chartTypes, sourceReport]);
|
|
65633
|
-
const schemaScopedTableNames =
|
|
65644
|
+
const schemaScopedTableNames = useMemo33(() => {
|
|
65634
65645
|
if (preserveSchemaWideOptions) {
|
|
65635
65646
|
return [];
|
|
65636
65647
|
}
|
|
@@ -65645,7 +65656,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65645
65656
|
preserveSchemaWideOptions,
|
|
65646
65657
|
sourceReport?.reportBuilderState?.tables
|
|
65647
65658
|
]);
|
|
65648
|
-
const joinCompatibleSchemaTableNames =
|
|
65659
|
+
const joinCompatibleSchemaTableNames = useMemo33(() => {
|
|
65649
65660
|
if (schemaScopedTableNames.length === 0) {
|
|
65650
65661
|
return [];
|
|
65651
65662
|
}
|
|
@@ -65654,7 +65665,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65654
65665
|
schemaForeignKeyMap
|
|
65655
65666
|
);
|
|
65656
65667
|
}, [schemaForeignKeyMap, schemaScopedTableNames]);
|
|
65657
|
-
const aggregationFallbackTarget =
|
|
65668
|
+
const aggregationFallbackTarget = useMemo33(() => {
|
|
65658
65669
|
const tableNames = effectiveReportBuilderTables.map((table2) => table2.name).filter((name2) => Boolean(name2));
|
|
65659
65670
|
const referencedTableNames = (sourceReport?.referencedTables ?? []).filter(
|
|
65660
65671
|
(name2) => typeof name2 === "string" && name2.length > 0
|
|
@@ -65662,7 +65673,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65662
65673
|
const tableNamesToUse = tableNames.length ? tableNames : referencedTableNames;
|
|
65663
65674
|
return tableNamesToUse.length > 0 ? tableNamesToUse.join(", ") : "table";
|
|
65664
65675
|
}, [effectiveReportBuilderTables, sourceReport?.referencedTables]);
|
|
65665
|
-
const aggregationFallbackTableName =
|
|
65676
|
+
const aggregationFallbackTableName = useMemo33(() => {
|
|
65666
65677
|
const tableNames = effectiveReportBuilderTables.map((table2) => table2.name).filter((name2) => Boolean(name2));
|
|
65667
65678
|
const referencedTableNames = (sourceReport?.referencedTables ?? []).filter(
|
|
65668
65679
|
(name2) => typeof name2 === "string" && name2.length > 0
|
|
@@ -65670,7 +65681,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65670
65681
|
const tableNamesToUse = tableNames.length ? tableNames : referencedTableNames;
|
|
65671
65682
|
return tableNamesToUse[0] ?? "table";
|
|
65672
65683
|
}, [effectiveReportBuilderTables, sourceReport?.referencedTables]);
|
|
65673
|
-
const cleanedAggregations =
|
|
65684
|
+
const cleanedAggregations = useMemo33(() => {
|
|
65674
65685
|
return aggregationState.filter((aggregation) => Boolean(aggregation?.aggregationType)).map((aggregation, index) => {
|
|
65675
65686
|
const aggregationType = String(aggregation.aggregationType);
|
|
65676
65687
|
const normalizedAggregationType = aggregationType.toLowerCase();
|
|
@@ -65692,7 +65703,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65692
65703
|
aggregationTablesByIndex,
|
|
65693
65704
|
isBoolAggregationField
|
|
65694
65705
|
]);
|
|
65695
|
-
const { aggregationBaseOptions, aggregationOptionTableLookup } =
|
|
65706
|
+
const { aggregationBaseOptions, aggregationOptionTableLookup } = useMemo33(() => {
|
|
65696
65707
|
const joinScoped = fieldOptionsAllowedTableNames ? joinCompatibleSchemaTableNames.filter(
|
|
65697
65708
|
(name2) => fieldOptionsAllowedTableNames.has(name2)
|
|
65698
65709
|
) : joinCompatibleSchemaTableNames;
|
|
@@ -65775,7 +65786,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65775
65786
|
resolvedGroupRowsBy,
|
|
65776
65787
|
schemaForReportBuilderState
|
|
65777
65788
|
]);
|
|
65778
|
-
const { schemaColumnOptions, columnIdentifierLookup } =
|
|
65789
|
+
const { schemaColumnOptions, columnIdentifierLookup } = useMemo33(() => {
|
|
65779
65790
|
const lookup = /* @__PURE__ */ new Map();
|
|
65780
65791
|
const options2 = [];
|
|
65781
65792
|
for (const table2 of schemaData.schemaWithCustomFields) {
|
|
@@ -65802,7 +65813,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65802
65813
|
columnIdentifierLookup: lookup
|
|
65803
65814
|
};
|
|
65804
65815
|
}, [schemaData.schemaWithCustomFields]);
|
|
65805
|
-
const tableColumnPickerPoolOptions =
|
|
65816
|
+
const tableColumnPickerPoolOptions = useMemo33(() => {
|
|
65806
65817
|
const allowed = new Set(
|
|
65807
65818
|
effectiveReportBuilderTableNames.map((name2) => String(name2 ?? "").trim()).filter(Boolean)
|
|
65808
65819
|
);
|
|
@@ -65813,16 +65824,16 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65813
65824
|
(option) => allowed.has(String(option.tableName ?? "").trim())
|
|
65814
65825
|
);
|
|
65815
65826
|
}, [effectiveReportBuilderTableNames, schemaColumnOptions]);
|
|
65816
|
-
const columns =
|
|
65827
|
+
const columns = useMemo33(() => {
|
|
65817
65828
|
return displayColumns.filter((column) => Boolean(column.field)).map((column) => encodeColumnOptionValue(column.table, column.field));
|
|
65818
65829
|
}, [displayColumns]);
|
|
65819
|
-
const selectedColumnOptions =
|
|
65830
|
+
const selectedColumnOptions = useMemo33(() => {
|
|
65820
65831
|
return displayColumns.map((column) => {
|
|
65821
65832
|
const value = column.alias || column.field;
|
|
65822
65833
|
return value ? { label: value, value } : null;
|
|
65823
65834
|
}).filter((option) => option !== null);
|
|
65824
65835
|
}, [displayColumns]);
|
|
65825
|
-
const scopedSchemaColumns =
|
|
65836
|
+
const scopedSchemaColumns = useMemo33(() => {
|
|
65826
65837
|
const tableNames = fieldOptionsAllowedTableNames ? Array.from(fieldOptionsAllowedTableNames) : joinCompatibleSchemaTableNames;
|
|
65827
65838
|
const schemaTables = schemaForReportBuilderState;
|
|
65828
65839
|
const tablesToUse = tableNames.length ? schemaTables.filter((table2) => tableNames.includes(table2.name ?? "")) : schemaTables;
|
|
@@ -65843,7 +65854,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65843
65854
|
joinCompatibleSchemaTableNames,
|
|
65844
65855
|
schemaForReportBuilderState
|
|
65845
65856
|
]);
|
|
65846
|
-
const pivotUniqueValuesByColumn =
|
|
65857
|
+
const pivotUniqueValuesByColumn = useMemo33(() => {
|
|
65847
65858
|
const explicitUniqueValues = sourceReport?.uniqueStringsByColumn ?? sourceReport?.columnUniqueValues ?? sourceReport?.uniqueValues;
|
|
65848
65859
|
if (explicitUniqueValues && typeof explicitUniqueValues === "object" && !Array.isArray(explicitUniqueValues)) {
|
|
65849
65860
|
return explicitUniqueValues;
|
|
@@ -65869,7 +65880,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65869
65880
|
}
|
|
65870
65881
|
return result;
|
|
65871
65882
|
}, [sourceReport]);
|
|
65872
|
-
const possiblePivotFields =
|
|
65883
|
+
const possiblePivotFields = useMemo33(() => {
|
|
65873
65884
|
const options2 = getPossiblePivotFieldOptions(
|
|
65874
65885
|
scopedSchemaColumns,
|
|
65875
65886
|
pivotUniqueValuesByColumn
|
|
@@ -65880,7 +65891,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65880
65891
|
columnFields: options2.columnFields.filter((field) => !isIdColumn(field))
|
|
65881
65892
|
};
|
|
65882
65893
|
}, [scopedSchemaColumns, pivotUniqueValuesByColumn]);
|
|
65883
|
-
const groupRowsByOptions =
|
|
65894
|
+
const groupRowsByOptions = useMemo33(() => {
|
|
65884
65895
|
const allowedFields = new Set(possiblePivotFields.rowFields);
|
|
65885
65896
|
const seenValues = /* @__PURE__ */ new Set();
|
|
65886
65897
|
const options2 = [];
|
|
@@ -65907,7 +65918,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65907
65918
|
}
|
|
65908
65919
|
return options2;
|
|
65909
65920
|
}, [groupRowsBy, possiblePivotFields.rowFields, scopedSchemaColumns]);
|
|
65910
|
-
const groupColumnsByOptions =
|
|
65921
|
+
const groupColumnsByOptions = useMemo33(() => {
|
|
65911
65922
|
const allowedFields = new Set(possiblePivotFields.columnFields);
|
|
65912
65923
|
const seenValues = /* @__PURE__ */ new Set();
|
|
65913
65924
|
const options2 = [];
|
|
@@ -65934,19 +65945,19 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65934
65945
|
}
|
|
65935
65946
|
return options2;
|
|
65936
65947
|
}, [groupColumnsBy, possiblePivotFields.columnFields, scopedSchemaColumns]);
|
|
65937
|
-
const cleanedSort =
|
|
65948
|
+
const cleanedSort = useMemo33(() => {
|
|
65938
65949
|
const activeSort = resolvedGroupRowsBy ? pivotSort : regularSort;
|
|
65939
65950
|
if (!activeSort?.sortField || !activeSort?.sortDirection) {
|
|
65940
65951
|
return "";
|
|
65941
65952
|
}
|
|
65942
65953
|
return toFlatSortValue(activeSort.sortField, activeSort.sortDirection);
|
|
65943
65954
|
}, [pivotSort, regularSort, resolvedGroupRowsBy]);
|
|
65944
|
-
const aggregationSortLabelFallbackTable =
|
|
65955
|
+
const aggregationSortLabelFallbackTable = useMemo33(() => {
|
|
65945
65956
|
const reportBuilderTableName = effectiveReportBuilderTables.map((table2) => String(table2.name ?? "").trim()).find((tableName) => Boolean(tableName));
|
|
65946
65957
|
if (reportBuilderTableName) return reportBuilderTableName;
|
|
65947
65958
|
return (sourceReport?.referencedTables ?? []).map((tableName) => String(tableName ?? "").trim()).find((tableName) => Boolean(tableName));
|
|
65948
65959
|
}, [effectiveReportBuilderTables, sourceReport?.referencedTables]);
|
|
65949
|
-
const sortOptions =
|
|
65960
|
+
const sortOptions = useMemo33(() => {
|
|
65950
65961
|
if (resolvedGroupRowsBy) {
|
|
65951
65962
|
const aggregationSortFields = getPivotAggregationSortFields(
|
|
65952
65963
|
aggregationState,
|
|
@@ -66005,7 +66016,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66005
66016
|
resolvedGroupRowsBy,
|
|
66006
66017
|
selectedColumnOptions
|
|
66007
66018
|
]);
|
|
66008
|
-
const { aggregationValues, aggregationOptions } =
|
|
66019
|
+
const { aggregationValues, aggregationOptions } = useMemo33(() => {
|
|
66009
66020
|
const baseOptions = aggregationBaseOptions.map((option) => ({
|
|
66010
66021
|
value: option.value,
|
|
66011
66022
|
label: option.label
|
|
@@ -66049,7 +66060,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66049
66060
|
aggregationTablesByIndex,
|
|
66050
66061
|
isBoolAggregationField
|
|
66051
66062
|
]);
|
|
66052
|
-
const nextPivot =
|
|
66063
|
+
const nextPivot = useMemo33(() => {
|
|
66053
66064
|
if (!sourceReport) return null;
|
|
66054
66065
|
return pivotState ? {
|
|
66055
66066
|
...pivotState,
|
|
@@ -66060,15 +66071,15 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66060
66071
|
rowLimit: limit?.value
|
|
66061
66072
|
} : null;
|
|
66062
66073
|
}, [sourceReport, pivotState, pivotSort, limit, resolvedSortFieldType]);
|
|
66063
|
-
const nextPivotHash =
|
|
66074
|
+
const nextPivotHash = useMemo33(
|
|
66064
66075
|
() => stableSerializeForQueryKey(nextPivot),
|
|
66065
66076
|
[nextPivot]
|
|
66066
66077
|
);
|
|
66067
|
-
const filterStackHash =
|
|
66078
|
+
const filterStackHash = useMemo33(
|
|
66068
66079
|
() => stableSerializeForQueryKey(filterStack),
|
|
66069
66080
|
[filterStack]
|
|
66070
66081
|
);
|
|
66071
|
-
const shouldSkipPivotRefreshForUnchangedPivot =
|
|
66082
|
+
const shouldSkipPivotRefreshForUnchangedPivot = useMemo33(() => {
|
|
66072
66083
|
if (!sourceReport || !nextPivot) return false;
|
|
66073
66084
|
if (!Array.isArray(sourceReport.rows) || sourceReport.rows.length === 0) {
|
|
66074
66085
|
return false;
|
|
@@ -66106,7 +66117,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66106
66117
|
shouldSkipPivotRefreshForUnchangedPivot,
|
|
66107
66118
|
sourceReport
|
|
66108
66119
|
]);
|
|
66109
|
-
const shouldSkipRedundantPivotTableDataReportBuilderQuery =
|
|
66120
|
+
const shouldSkipRedundantPivotTableDataReportBuilderQuery = useMemo33(() => {
|
|
66110
66121
|
if (!sourceReport || !nextPivot) {
|
|
66111
66122
|
return false;
|
|
66112
66123
|
}
|
|
@@ -66208,7 +66219,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66208
66219
|
});
|
|
66209
66220
|
const tablePageReportBuilderState = pivotTableDataReportBuilderState ?? effectiveReportBuilderState;
|
|
66210
66221
|
const tablePageReportBuilderStateHash = pivotTableDataReportBuilderState ? pivotTableDataReportBuilderStateHash : effectiveReportBuilderStateHash;
|
|
66211
|
-
const tablePaginationSort =
|
|
66222
|
+
const tablePaginationSort = useMemo33(() => {
|
|
66212
66223
|
const sortEntry = tablePageReportBuilderState?.sort?.[0];
|
|
66213
66224
|
const field = String(sortEntry?.field ?? "").trim();
|
|
66214
66225
|
if (!field || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(field)) {
|
|
@@ -66271,7 +66282,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66271
66282
|
const tablePageRows = tablePageQueryEnabled && !tablePageQuery.data?.error && Array.isArray(tablePageQuery.data?.report?.rows) ? tablePageQuery.data.report.rows : void 0;
|
|
66272
66283
|
const tablePageRowCount = tablePageQueryEnabled && typeof tablePageQuery.data?.report?.rowCount === "number" && tablePageQuery.data.report.rowCount > 0 ? tablePageQuery.data.report.rowCount : void 0;
|
|
66273
66284
|
const tablePageFetching = tablePageQueryEnabled && tablePageQuery.isFetching;
|
|
66274
|
-
const paginationTotalRowCount =
|
|
66285
|
+
const paginationTotalRowCount = useMemo33(() => {
|
|
66275
66286
|
if (tablePageRowCount !== void 0) {
|
|
66276
66287
|
return Math.max(tablePageRowCount, baseWindowRowsLength);
|
|
66277
66288
|
}
|
|
@@ -66387,7 +66398,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66387
66398
|
pivotRefreshQueryEnabled,
|
|
66388
66399
|
effectiveReportId
|
|
66389
66400
|
]);
|
|
66390
|
-
const chartData =
|
|
66401
|
+
const chartData = useMemo33(() => {
|
|
66391
66402
|
if (!sourceReport) return void 0;
|
|
66392
66403
|
const rowsForChart = Array.isArray(sourceReport.rows) ? sourceReport.rows : [];
|
|
66393
66404
|
const chartPivotForDisplay = nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
|
|
@@ -66416,18 +66427,18 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66416
66427
|
useInMemoryEngines,
|
|
66417
66428
|
chartPivotHydrationEpoch
|
|
66418
66429
|
]);
|
|
66419
|
-
const baseChart =
|
|
66430
|
+
const baseChart = useMemo33(
|
|
66420
66431
|
() => normalizePivotChartForDisplay(chartData),
|
|
66421
66432
|
[chartData]
|
|
66422
66433
|
);
|
|
66423
|
-
const chartAxesBaseChart =
|
|
66434
|
+
const chartAxesBaseChart = useMemo33(() => {
|
|
66424
66435
|
if (!chartData) return void 0;
|
|
66425
66436
|
if (chartData.pivot?.columnField) {
|
|
66426
66437
|
return normalizePivotChartForAxisControls(chartData, effectiveReportId);
|
|
66427
66438
|
}
|
|
66428
66439
|
return baseChart;
|
|
66429
66440
|
}, [baseChart, chartData, effectiveReportId]);
|
|
66430
|
-
const chartAxisOptions =
|
|
66441
|
+
const chartAxisOptions = useMemo33(() => {
|
|
66431
66442
|
if (!chartAxesBaseChart) return [];
|
|
66432
66443
|
const optionsByField = /* @__PURE__ */ new Map();
|
|
66433
66444
|
const registerOption = (fieldRaw, labelRaw, formatRaw) => {
|
|
@@ -66466,14 +66477,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66466
66477
|
);
|
|
66467
66478
|
return Array.from(optionsByField.values());
|
|
66468
66479
|
}, [chartAxesBaseChart]);
|
|
66469
|
-
const chartAxisOptionByField =
|
|
66480
|
+
const chartAxisOptionByField = useMemo33(() => {
|
|
66470
66481
|
const optionsByField = /* @__PURE__ */ new Map();
|
|
66471
66482
|
for (const option of chartAxisOptions) {
|
|
66472
66483
|
optionsByField.set(option.value, option);
|
|
66473
66484
|
}
|
|
66474
66485
|
return optionsByField;
|
|
66475
66486
|
}, [chartAxisOptions]);
|
|
66476
|
-
const xAxisOptions =
|
|
66487
|
+
const xAxisOptions = useMemo33(() => {
|
|
66477
66488
|
if (!chartAxesBaseChart) return chartAxisOptions;
|
|
66478
66489
|
const pivot = chartAxesBaseChart.pivot;
|
|
66479
66490
|
const pivotRowField = String(pivot?.rowField ?? "").trim();
|
|
@@ -66496,7 +66507,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66496
66507
|
}
|
|
66497
66508
|
return chartAxisOptions;
|
|
66498
66509
|
}, [chartAxesBaseChart, chartAxisOptions, chartAxisOptionByField]);
|
|
66499
|
-
const yAxisOptions =
|
|
66510
|
+
const yAxisOptions = useMemo33(() => {
|
|
66500
66511
|
if (!chartAxesBaseChart) return [];
|
|
66501
66512
|
const keepOption = (option) => {
|
|
66502
66513
|
const col = findSchemaColumnForChartAxisField(
|
|
@@ -66532,21 +66543,21 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66532
66543
|
chartAxisOptions,
|
|
66533
66544
|
schemaColumnOptions
|
|
66534
66545
|
]);
|
|
66535
|
-
const normalizedChartXAxisOptions =
|
|
66546
|
+
const normalizedChartXAxisOptions = useMemo33(() => {
|
|
66536
66547
|
return xAxisOptions.map((option) => ({
|
|
66537
66548
|
value: String(option.value ?? "").trim(),
|
|
66538
66549
|
label: String(option.label ?? option.value ?? "").trim(),
|
|
66539
66550
|
format: String(option.format ?? "").trim()
|
|
66540
66551
|
}));
|
|
66541
66552
|
}, [xAxisOptions]);
|
|
66542
|
-
const normalizedChartYAxisOptions =
|
|
66553
|
+
const normalizedChartYAxisOptions = useMemo33(() => {
|
|
66543
66554
|
return yAxisOptions.map((option) => ({
|
|
66544
66555
|
value: String(option.value ?? "").trim(),
|
|
66545
66556
|
label: String(option.label ?? option.value ?? "").trim(),
|
|
66546
66557
|
format: String(option.format ?? "").trim()
|
|
66547
66558
|
}));
|
|
66548
66559
|
}, [yAxisOptions]);
|
|
66549
|
-
const resolvedYAxisFields =
|
|
66560
|
+
const resolvedYAxisFields = useMemo33(() => {
|
|
66550
66561
|
if (!chartAxesBaseChart) return [];
|
|
66551
66562
|
const normalizeYAxisField = (yAxisFieldRaw) => {
|
|
66552
66563
|
const field = String(yAxisFieldRaw?.field ?? "").trim();
|
|
@@ -66590,7 +66601,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66590
66601
|
chartAxisOptionByField,
|
|
66591
66602
|
chartAxisOptions
|
|
66592
66603
|
]);
|
|
66593
|
-
const resolvedXAxisField =
|
|
66604
|
+
const resolvedXAxisField = useMemo33(() => {
|
|
66594
66605
|
if (!chartAxesBaseChart) return "";
|
|
66595
66606
|
const chartType2 = String(chartAxesBaseChart.chartType ?? "").toLowerCase();
|
|
66596
66607
|
const pivotRowField = String(
|
|
@@ -66622,7 +66633,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66622
66633
|
chartAxisOptions,
|
|
66623
66634
|
resolvedYAxisFields
|
|
66624
66635
|
]);
|
|
66625
|
-
const resolvedXAxisFormat =
|
|
66636
|
+
const resolvedXAxisFormat = useMemo33(() => {
|
|
66626
66637
|
if (!chartAxesBaseChart) {
|
|
66627
66638
|
return "string";
|
|
66628
66639
|
}
|
|
@@ -66648,7 +66659,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66648
66659
|
resolvedXAxisField,
|
|
66649
66660
|
resolvedYAxisFields
|
|
66650
66661
|
]);
|
|
66651
|
-
const resolvedXAxisLabel =
|
|
66662
|
+
const resolvedXAxisLabel = useMemo33(() => {
|
|
66652
66663
|
const defaultXLabel = String(
|
|
66653
66664
|
chartAxesBaseChart?.xAxisLabel ?? chartAxisOptionByField.get(resolvedXAxisField)?.label ?? ""
|
|
66654
66665
|
).trim();
|
|
@@ -66662,13 +66673,13 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66662
66673
|
chartAxisOptionByField,
|
|
66663
66674
|
resolvedXAxisField
|
|
66664
66675
|
]);
|
|
66665
|
-
const chartVisibility =
|
|
66676
|
+
const chartVisibility = useMemo33(
|
|
66666
66677
|
() => ({
|
|
66667
66678
|
showLegend: chartVisibilityOverrides.showLegend ?? Boolean(baseChart?.showLegend ?? false)
|
|
66668
66679
|
}),
|
|
66669
66680
|
[baseChart?.showLegend, chartVisibilityOverrides]
|
|
66670
66681
|
);
|
|
66671
|
-
const xAxis =
|
|
66682
|
+
const xAxis = useMemo33(() => {
|
|
66672
66683
|
const pivotBucketXAxis = isPivotTableDateBucketRowAxis(
|
|
66673
66684
|
chartAxesBaseChart,
|
|
66674
66685
|
resolvedXAxisField
|
|
@@ -66685,7 +66696,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66685
66696
|
resolvedXAxisField,
|
|
66686
66697
|
resolvedXAxisFormat
|
|
66687
66698
|
]);
|
|
66688
|
-
const yAxis =
|
|
66699
|
+
const yAxis = useMemo33(
|
|
66689
66700
|
() => ({
|
|
66690
66701
|
fields: resolvedYAxisFields.map((yAxisField) => ({
|
|
66691
66702
|
field: yAxisField.field,
|
|
@@ -66697,14 +66708,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66697
66708
|
}),
|
|
66698
66709
|
[resolvedYAxisFields]
|
|
66699
66710
|
);
|
|
66700
|
-
const resolvedYAxisFieldsForDisplay =
|
|
66711
|
+
const resolvedYAxisFieldsForDisplay = useMemo33(() => {
|
|
66701
66712
|
if (!baseChart) return resolvedYAxisFields;
|
|
66702
66713
|
return mapResolvedPivotYAxisFieldsForDisplay({
|
|
66703
66714
|
chart: baseChart,
|
|
66704
66715
|
resolvedYAxisFields
|
|
66705
66716
|
});
|
|
66706
66717
|
}, [baseChart, resolvedYAxisFields]);
|
|
66707
|
-
const chart =
|
|
66718
|
+
const chart = useMemo33(() => {
|
|
66708
66719
|
if (!baseChart) return void 0;
|
|
66709
66720
|
let columns2 = mergeChartColumnFormatsFromYAxisFields(
|
|
66710
66721
|
baseChart.columns,
|
|
@@ -66764,7 +66775,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66764
66775
|
resolvedYAxisFieldsForDisplay
|
|
66765
66776
|
]);
|
|
66766
66777
|
const pivotDateFilterRangeCacheRef = useRef24({ key: "", min: null, max: null });
|
|
66767
|
-
const filterOptions =
|
|
66778
|
+
const filterOptions = useMemo33(() => {
|
|
66768
66779
|
const out = [];
|
|
66769
66780
|
for (const [field, values] of filterValueOptionsByFieldName) {
|
|
66770
66781
|
out.push({
|
|
@@ -66826,7 +66837,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66826
66837
|
effectiveReportId,
|
|
66827
66838
|
filterValueOptionsByFieldName
|
|
66828
66839
|
]);
|
|
66829
|
-
const chartForUi =
|
|
66840
|
+
const chartForUi = useMemo33(() => {
|
|
66830
66841
|
if (!chart?.pivot) return chart;
|
|
66831
66842
|
const pivot = chart.pivot;
|
|
66832
66843
|
const qualify = (field, table2) => table2 ? `${table2}.${field}` : field;
|
|
@@ -66902,11 +66913,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66902
66913
|
};
|
|
66903
66914
|
}, [chart, filterOptions, filtersForQueryBuilder]);
|
|
66904
66915
|
const isPivotTableChart = String(chartType ?? "").toLowerCase() === "table" && Boolean(pivotState);
|
|
66905
|
-
const pivotTableColumnControls =
|
|
66916
|
+
const pivotTableColumnControls = useMemo33(
|
|
66906
66917
|
() => isPivotTableChart ? buildPivotColumnPivotTableFormattingColumns(pivotState, chart) : null,
|
|
66907
66918
|
[chart, isPivotTableChart, pivotState]
|
|
66908
66919
|
);
|
|
66909
|
-
const chartAxes =
|
|
66920
|
+
const chartAxes = useMemo33(() => {
|
|
66910
66921
|
const yAxisItems = resolvedYAxisFields.map(
|
|
66911
66922
|
(yAxisField, index) => ({
|
|
66912
66923
|
id: String(index),
|
|
@@ -67056,7 +67067,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67056
67067
|
yAxisOptions
|
|
67057
67068
|
]);
|
|
67058
67069
|
const tableFormatCacheRef = useRef24(/* @__PURE__ */ new Map());
|
|
67059
|
-
const tableFormatMerge =
|
|
67070
|
+
const tableFormatMerge = useMemo33(
|
|
67060
67071
|
() => mergeDisplayAndSourceForTableFormats({
|
|
67061
67072
|
effectiveReportBuilderTableNames,
|
|
67062
67073
|
scopedSchemaColumns,
|
|
@@ -67072,7 +67083,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67072
67083
|
tableColumnsEditedSignature
|
|
67073
67084
|
]
|
|
67074
67085
|
);
|
|
67075
|
-
const table =
|
|
67086
|
+
const table = useMemo33(() => {
|
|
67076
67087
|
const baseWindowRows = Array.isArray(sourceReport?.rows) ? sourceReport.rows : [];
|
|
67077
67088
|
const rawRows = !paginationActive ? baseWindowRows : tablePageRows ?? baseWindowRows.slice(paginationRangeStart, paginationRangeEnd);
|
|
67078
67089
|
const { columns: mergedFromReport } = mergeDisplayAndSourceForTableFormats({
|
|
@@ -67203,7 +67214,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67203
67214
|
const {
|
|
67204
67215
|
columnsOptions: tableFormattingColumnOptions,
|
|
67205
67216
|
hasTableDrivenColumnOrder
|
|
67206
|
-
} =
|
|
67217
|
+
} = useMemo33(() => {
|
|
67207
67218
|
if (pivotTableColumnControls) {
|
|
67208
67219
|
return getAllColumnOptions({
|
|
67209
67220
|
schemaColumnOptions,
|
|
@@ -67233,24 +67244,24 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67233
67244
|
schemaColumnOptions,
|
|
67234
67245
|
table.columns
|
|
67235
67246
|
]);
|
|
67236
|
-
const axisSelectFormatLabels =
|
|
67247
|
+
const axisSelectFormatLabels = useMemo33(
|
|
67237
67248
|
() => AXIS_FORMAT_OPTIONS.map((option) => option.label),
|
|
67238
67249
|
[]
|
|
67239
67250
|
);
|
|
67240
|
-
const xAxisFormatOptionLabels =
|
|
67251
|
+
const xAxisFormatOptionLabels = useMemo33(() => {
|
|
67241
67252
|
if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField)) {
|
|
67242
67253
|
return ["date", ...axisSelectFormatLabels];
|
|
67243
67254
|
}
|
|
67244
67255
|
return axisSelectFormatLabels;
|
|
67245
67256
|
}, [chartAxesBaseChart, resolvedXAxisField, axisSelectFormatLabels]);
|
|
67246
|
-
const tableDerivedColumnOrder =
|
|
67257
|
+
const tableDerivedColumnOrder = useMemo33(() => {
|
|
67247
67258
|
return tableFormattingColumnOptions.map((option) => option.value);
|
|
67248
67259
|
}, [tableFormattingColumnOptions]);
|
|
67249
|
-
const tableDerivedColumnOrderSignature =
|
|
67260
|
+
const tableDerivedColumnOrderSignature = useMemo33(
|
|
67250
67261
|
() => tableDerivedColumnOrder.join("|"),
|
|
67251
67262
|
[tableDerivedColumnOrder]
|
|
67252
67263
|
);
|
|
67253
|
-
const activeTableColumnIds =
|
|
67264
|
+
const activeTableColumnIds = useMemo33(() => {
|
|
67254
67265
|
if (pivotTableColumnControls) {
|
|
67255
67266
|
return pivotTableColumnControls.selectedColumnIds;
|
|
67256
67267
|
}
|
|
@@ -67284,7 +67295,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67284
67295
|
tableDerivedColumnOrder,
|
|
67285
67296
|
tableFormattingColumnOptions
|
|
67286
67297
|
]);
|
|
67287
|
-
const columnOptionById =
|
|
67298
|
+
const columnOptionById = useMemo33(() => {
|
|
67288
67299
|
const map = /* @__PURE__ */ new Map();
|
|
67289
67300
|
for (const option of tableColumnPickerPoolOptions) {
|
|
67290
67301
|
map.set(option.value, option);
|
|
@@ -67296,7 +67307,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67296
67307
|
}
|
|
67297
67308
|
return map;
|
|
67298
67309
|
}, [tableColumnPickerPoolOptions, tableFormattingColumnOptions]);
|
|
67299
|
-
const displayColumnById =
|
|
67310
|
+
const displayColumnById = useMemo33(() => {
|
|
67300
67311
|
const map = /* @__PURE__ */ new Map();
|
|
67301
67312
|
for (const column of displayColumns) {
|
|
67302
67313
|
const field = String(column.field ?? "").trim();
|
|
@@ -67307,7 +67318,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67307
67318
|
}
|
|
67308
67319
|
return map;
|
|
67309
67320
|
}, [displayColumns]);
|
|
67310
|
-
const tableColumnSettingsById =
|
|
67321
|
+
const tableColumnSettingsById = useMemo33(() => {
|
|
67311
67322
|
const map = /* @__PURE__ */ new Map();
|
|
67312
67323
|
const effectiveById = tableFormatMerge.formatByColumnOptionId;
|
|
67313
67324
|
const chartColById = /* @__PURE__ */ new Map();
|
|
@@ -67433,7 +67444,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67433
67444
|
useLayoutEffect4(() => {
|
|
67434
67445
|
tableColumnSettingsCoalesceRef.current = new Map(tableColumnSettingsById);
|
|
67435
67446
|
}, [tableColumnSettingsById]);
|
|
67436
|
-
const tableColumnItems =
|
|
67447
|
+
const tableColumnItems = useMemo33(() => {
|
|
67437
67448
|
const pivotRowFieldForFormat = String(chart?.pivot?.rowField ?? "").trim();
|
|
67438
67449
|
const pivotRowFieldType = String(chart?.pivot?.rowFieldType ?? "").trim();
|
|
67439
67450
|
const items = activeTableColumnIds.map((columnId) => {
|
|
@@ -67469,10 +67480,10 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67469
67480
|
isPivotTableChart,
|
|
67470
67481
|
tableColumnSettingsById
|
|
67471
67482
|
]);
|
|
67472
|
-
const tableColumnById =
|
|
67483
|
+
const tableColumnById = useMemo33(() => {
|
|
67473
67484
|
return new Map(tableColumnItems.map((item) => [item.id, item]));
|
|
67474
67485
|
}, [tableColumnItems]);
|
|
67475
|
-
const tableColumnValues =
|
|
67486
|
+
const tableColumnValues = useMemo33(() => {
|
|
67476
67487
|
const pivotRowFieldForFormat = String(chart?.pivot?.rowField ?? "").trim();
|
|
67477
67488
|
const pivotRowFieldType = String(chart?.pivot?.rowFieldType ?? "").trim();
|
|
67478
67489
|
return tableColumnItems.map((item) => {
|
|
@@ -68442,7 +68453,7 @@ function ChatChartCard({
|
|
|
68442
68453
|
loading,
|
|
68443
68454
|
setReport
|
|
68444
68455
|
} = useReport(reportId);
|
|
68445
|
-
const selectedColumnValues =
|
|
68456
|
+
const selectedColumnValues = useMemo34(
|
|
68446
68457
|
() => columns.map((column) => column.value),
|
|
68447
68458
|
[columns]
|
|
68448
68459
|
);
|
|
@@ -69206,7 +69217,7 @@ function Chat({
|
|
|
69206
69217
|
}
|
|
69207
69218
|
|
|
69208
69219
|
// src/hooks/useReportFilterDraft.ts
|
|
69209
|
-
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";
|
|
69210
69221
|
var normalizeOperatorKey = (operator) => String(operator ?? "").trim().toLowerCase().replace(/[_\s]+/g, "");
|
|
69211
69222
|
var defaultFilterRuleValueForOperator = (operator) => {
|
|
69212
69223
|
const key = normalizeOperatorKey(operator);
|
|
@@ -69259,12 +69270,12 @@ function useReportFilterDraft(args) {
|
|
|
69259
69270
|
lastNonEmptyFieldsRef.current = queryBuilderProps.fields;
|
|
69260
69271
|
}
|
|
69261
69272
|
const effectiveFields = queryBuilderProps.fields.length > 0 ? queryBuilderProps.fields : lastNonEmptyFieldsRef.current;
|
|
69262
|
-
const committedSignature =
|
|
69273
|
+
const committedSignature = useMemo35(
|
|
69263
69274
|
() => committedFiltersSignature(committed),
|
|
69264
69275
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- `committed` normalizes null to a stable constant
|
|
69265
69276
|
[committedFilters]
|
|
69266
69277
|
);
|
|
69267
|
-
const fieldsSignature =
|
|
69278
|
+
const fieldsSignature = useMemo35(
|
|
69268
69279
|
() => fieldCatalogSignature(effectiveFields),
|
|
69269
69280
|
[effectiveFields]
|
|
69270
69281
|
);
|
|
@@ -69307,7 +69318,7 @@ function useReportFilterDraft(args) {
|
|
|
69307
69318
|
(rule) => defaultFilterRuleValueForOperator(rule?.operator),
|
|
69308
69319
|
[]
|
|
69309
69320
|
);
|
|
69310
|
-
const filterDraftQueryBuilderProps =
|
|
69321
|
+
const filterDraftQueryBuilderProps = useMemo35(
|
|
69311
69322
|
() => ({
|
|
69312
69323
|
...queryBuilderProps,
|
|
69313
69324
|
fields: effectiveFields,
|
|
@@ -69630,7 +69641,7 @@ var useTenants = (dashboardName) => {
|
|
|
69630
69641
|
};
|
|
69631
69642
|
|
|
69632
69643
|
// src/hooks/useQuill.ts
|
|
69633
|
-
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";
|
|
69634
69645
|
init_paginationProcessing();
|
|
69635
69646
|
init_tableProcessing();
|
|
69636
69647
|
init_dataProcessing();
|
|
@@ -69638,14 +69649,14 @@ var useQuill = (reportId, pagination) => {
|
|
|
69638
69649
|
const { reports, reportsDispatch, fetchIndividualReport } = useContext40(ReportsContext);
|
|
69639
69650
|
const { allReportsById } = useAllReports();
|
|
69640
69651
|
const { getToken } = useContext40(FetchContext);
|
|
69641
|
-
const dashboardReport =
|
|
69652
|
+
const dashboardReport = useMemo36(() => {
|
|
69642
69653
|
return allReportsById[reportId ?? ""];
|
|
69643
69654
|
}, [allReportsById[reportId ?? ""]]);
|
|
69644
69655
|
const { dashboardFilters, dashboardCustomFilters } = useContext40(
|
|
69645
69656
|
DashboardFiltersContext
|
|
69646
69657
|
);
|
|
69647
69658
|
const { reportFilters, customReportFilters, reportFiltersDispatch } = useContext40(ReportFiltersContext);
|
|
69648
|
-
const specificReportFilters =
|
|
69659
|
+
const specificReportFilters = useMemo36(() => {
|
|
69649
69660
|
if (!reportId) return null;
|
|
69650
69661
|
return Object.values(reportFilters[reportId] ?? []).map((f) => f.filter);
|
|
69651
69662
|
}, [reportFilters, reportId]);
|
|
@@ -69656,7 +69667,7 @@ var useQuill = (reportId, pagination) => {
|
|
|
69656
69667
|
const [loading, setLoading] = useState45(true);
|
|
69657
69668
|
const [error, setError] = useState45(void 0);
|
|
69658
69669
|
const [previousPage, setPreviousPage] = useState45(0);
|
|
69659
|
-
const processedReport =
|
|
69670
|
+
const processedReport = useMemo36(() => {
|
|
69660
69671
|
return reportId && allReportsById[reportId] ? convertInternalReportToReport(
|
|
69661
69672
|
mergeComparisonRange(allReportsById[reportId]),
|
|
69662
69673
|
specificReportFilters ?? [],
|
|
@@ -69853,10 +69864,10 @@ var useQuill = (reportId, pagination) => {
|
|
|
69853
69864
|
|
|
69854
69865
|
// src/hooks/useFormat.ts
|
|
69855
69866
|
init_valueFormatter();
|
|
69856
|
-
import { useMemo as
|
|
69867
|
+
import { useMemo as useMemo37 } from "react";
|
|
69857
69868
|
var useMemoizedRows = (reportId) => {
|
|
69858
69869
|
const { data } = useQuill(reportId);
|
|
69859
|
-
const formattedRows =
|
|
69870
|
+
const formattedRows = useMemo37(() => {
|
|
69860
69871
|
if (!data || !data.rows || !data.columns)
|
|
69861
69872
|
return { rows: [], loading: true };
|
|
69862
69873
|
return {
|