@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.cjs
CHANGED
|
@@ -28132,12 +28132,10 @@ var useDashboardReportInternal = (reportId, config) => {
|
|
|
28132
28132
|
const { dashboardCustomFilters } = (0, import_react2.useContext)(DashboardFiltersContext);
|
|
28133
28133
|
const reportState = reports[reportId];
|
|
28134
28134
|
const reportDashboardName = reportState?.dashboardName;
|
|
28135
|
+
const reportDashboardFilterState = reportDashboardName ? dashboardFilters[reportDashboardName] : void 0;
|
|
28135
28136
|
const reportDashboardFilters = (0, import_react2.useMemo)(() => {
|
|
28136
|
-
|
|
28137
|
-
|
|
28138
|
-
(f) => f.filter
|
|
28139
|
-
);
|
|
28140
|
-
}, [dashboardFilters, reportDashboardName]);
|
|
28137
|
+
return Object.values(reportDashboardFilterState ?? {}).map((f) => f.filter);
|
|
28138
|
+
}, [reportDashboardFilterState]);
|
|
28141
28139
|
const {
|
|
28142
28140
|
data: dashboardData,
|
|
28143
28141
|
dashboardFilters: dashboardFiltersInternal,
|
|
@@ -31769,7 +31767,7 @@ var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
|
31769
31767
|
var defaultValueFormatter = (value) => (value * 1).toFixed(1) + "%";
|
|
31770
31768
|
var parseData2 = (data, colors, categoryKey, valueKey) => {
|
|
31771
31769
|
const maxItems = 20;
|
|
31772
|
-
const slicedData = deepCopy(data
|
|
31770
|
+
const slicedData = deepCopy(data.slice(0, maxItems));
|
|
31773
31771
|
const totalValue = slicedData.reduce(
|
|
31774
31772
|
(acc, dataPoint) => (
|
|
31775
31773
|
// Big(acc)
|
|
@@ -32015,8 +32013,8 @@ var PieChartWrapper = import_react13.default.forwardRef(
|
|
|
32015
32013
|
category = "pct_of_the_total",
|
|
32016
32014
|
index = "status",
|
|
32017
32015
|
data,
|
|
32018
|
-
colors
|
|
32019
|
-
colorMap
|
|
32016
|
+
colors,
|
|
32017
|
+
colorMap,
|
|
32020
32018
|
variant = "donut",
|
|
32021
32019
|
valueFormatter: valueFormatter2 = defaultValueFormatter,
|
|
32022
32020
|
className,
|
|
@@ -32026,10 +32024,24 @@ var PieChartWrapper = import_react13.default.forwardRef(
|
|
|
32026
32024
|
onClickLegendElement,
|
|
32027
32025
|
yAxisFields,
|
|
32028
32026
|
showLegend = false,
|
|
32027
|
+
showAnimation,
|
|
32028
|
+
isAnimationActive,
|
|
32029
32029
|
...other
|
|
32030
32030
|
} = props;
|
|
32031
32031
|
const isDonut = variant == "donut";
|
|
32032
|
-
|
|
32032
|
+
const chartData = data ?? [];
|
|
32033
|
+
const parsedData = (0, import_react13.useMemo)(() => {
|
|
32034
|
+
const palette = colorMap?.[category]?.primary ?? colors ?? [];
|
|
32035
|
+
const containsCssVars = palette.some(
|
|
32036
|
+
(color) => typeof color === "string" && color.includes("var(")
|
|
32037
|
+
);
|
|
32038
|
+
const resolvedColors = containsCssVars ? Array.from({ length: chartData.length }).map(
|
|
32039
|
+
(_, idx) => palette[idx % palette.length] ?? palette[palette.length - 1] ?? "#808080"
|
|
32040
|
+
) : palette.length >= chartData.length ? palette.slice(0, chartData.length) : generateArrayFromColor(palette, chartData.length);
|
|
32041
|
+
return parseData2(chartData, resolvedColors, index, category);
|
|
32042
|
+
}, [category, colorMap, colors, chartData, index]);
|
|
32043
|
+
const animationActive = isAnimationActive ?? showAnimation ?? true;
|
|
32044
|
+
if (chartData.length === 0) {
|
|
32033
32045
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
32034
32046
|
"div",
|
|
32035
32047
|
{
|
|
@@ -32072,28 +32084,11 @@ var PieChartWrapper = import_react13.default.forwardRef(
|
|
|
32072
32084
|
height: "100%",
|
|
32073
32085
|
minWidth: 0,
|
|
32074
32086
|
minHeight: 0,
|
|
32075
|
-
initialDimension: { width: 1, height: 1 },
|
|
32076
32087
|
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_recharts.PieChart, { children: [
|
|
32077
32088
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
32078
32089
|
import_recharts.Pie,
|
|
32079
32090
|
{
|
|
32080
|
-
data:
|
|
32081
|
-
data,
|
|
32082
|
-
(() => {
|
|
32083
|
-
const colorArray = colorMap[category] && colorMap[category]["primary"] && colorMap[category]["primary"] || colors;
|
|
32084
|
-
const containsCssVars = colorArray.some(
|
|
32085
|
-
(color) => typeof color === "string" && color.includes("var(")
|
|
32086
|
-
);
|
|
32087
|
-
if (containsCssVars) {
|
|
32088
|
-
return Array.from({ length: data.length }).map(
|
|
32089
|
-
(_, idx) => colorArray[idx % colorArray.length] ?? colorArray[colorArray.length - 1] ?? "#808080"
|
|
32090
|
-
);
|
|
32091
|
-
}
|
|
32092
|
-
return colorArray.length >= data.length ? colorArray.slice(0, data.length) : generateArrayFromColor(colorArray, data.length);
|
|
32093
|
-
})(),
|
|
32094
|
-
index,
|
|
32095
|
-
category
|
|
32096
|
-
),
|
|
32091
|
+
data: parsedData,
|
|
32097
32092
|
cx: "50%",
|
|
32098
32093
|
cy: "50%",
|
|
32099
32094
|
startAngle: 90,
|
|
@@ -32103,7 +32098,7 @@ var PieChartWrapper = import_react13.default.forwardRef(
|
|
|
32103
32098
|
paddingAngle: 0,
|
|
32104
32099
|
dataKey: category,
|
|
32105
32100
|
nameKey: index,
|
|
32106
|
-
isAnimationActive:
|
|
32101
|
+
isAnimationActive: animationActive,
|
|
32107
32102
|
onClick: onClickChartElement,
|
|
32108
32103
|
labelLine: false,
|
|
32109
32104
|
label: false
|
|
@@ -33554,7 +33549,6 @@ function LineChart({
|
|
|
33554
33549
|
height: "100%",
|
|
33555
33550
|
minWidth: 0,
|
|
33556
33551
|
minHeight: 0,
|
|
33557
|
-
initialDimension: { width: 1, height: 1 },
|
|
33558
33552
|
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
33559
33553
|
import_recharts2.ComposedChart,
|
|
33560
33554
|
{
|
|
@@ -33840,7 +33834,7 @@ function RadarChart({
|
|
|
33840
33834
|
);
|
|
33841
33835
|
}
|
|
33842
33836
|
const getCustomColor = (index, field) => {
|
|
33843
|
-
|
|
33837
|
+
const key = index === 0 ? "comparison" : "primary";
|
|
33844
33838
|
field = field.replace("comparison_", "");
|
|
33845
33839
|
if (colorMap && colorMap[field]) {
|
|
33846
33840
|
return colorMap[field][key];
|
|
@@ -33864,7 +33858,6 @@ function RadarChart({
|
|
|
33864
33858
|
height: "100%",
|
|
33865
33859
|
minWidth: 0,
|
|
33866
33860
|
minHeight: 0,
|
|
33867
|
-
initialDimension: { width: 1, height: 1 },
|
|
33868
33861
|
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
33869
33862
|
import_recharts3.RadarChart,
|
|
33870
33863
|
{
|
|
@@ -34290,7 +34283,6 @@ function BarChart({
|
|
|
34290
34283
|
height: "100%",
|
|
34291
34284
|
minWidth: 0,
|
|
34292
34285
|
minHeight: 0,
|
|
34293
|
-
initialDimension: { width: 1, height: 1 },
|
|
34294
34286
|
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
34295
34287
|
import_recharts4.BarChart,
|
|
34296
34288
|
{
|
|
@@ -39092,6 +39084,7 @@ function GaugeChart({
|
|
|
39092
39084
|
xAxisField,
|
|
39093
39085
|
xAxisFormat,
|
|
39094
39086
|
containerStyle,
|
|
39087
|
+
className,
|
|
39095
39088
|
colors,
|
|
39096
39089
|
isAnimationActive = true
|
|
39097
39090
|
}) {
|
|
@@ -39105,6 +39098,7 @@ function GaugeChart({
|
|
|
39105
39098
|
percentage: normalizedPercentage,
|
|
39106
39099
|
xAxisFormat,
|
|
39107
39100
|
containerStyle: { ...containerStyle },
|
|
39101
|
+
className,
|
|
39108
39102
|
colors,
|
|
39109
39103
|
isAnimationActive
|
|
39110
39104
|
}
|
|
@@ -39113,6 +39107,7 @@ function GaugeChart({
|
|
|
39113
39107
|
function D3Gauge({
|
|
39114
39108
|
percentage,
|
|
39115
39109
|
containerStyle,
|
|
39110
|
+
className,
|
|
39116
39111
|
xAxisFormat,
|
|
39117
39112
|
colors,
|
|
39118
39113
|
isAnimationActive
|
|
@@ -39281,7 +39276,8 @@ function D3Gauge({
|
|
|
39281
39276
|
"div",
|
|
39282
39277
|
{
|
|
39283
39278
|
ref: containerRef,
|
|
39284
|
-
style: { width: "100%",
|
|
39279
|
+
style: { width: "100%", ...containerStyle },
|
|
39280
|
+
className
|
|
39285
39281
|
}
|
|
39286
39282
|
);
|
|
39287
39283
|
}
|
|
@@ -39587,12 +39583,6 @@ function QuillTableDashboardComponent({
|
|
|
39587
39583
|
init_valueFormatter();
|
|
39588
39584
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
39589
39585
|
var MAX_ROWS_FOR_GENERIC_TABLE = 500;
|
|
39590
|
-
function sumByKey(arr, key) {
|
|
39591
|
-
return arr.reduce((acc, cur) => {
|
|
39592
|
-
const val = parseInt(cur[key], 10);
|
|
39593
|
-
return isNaN(val) ? acc : acc + val;
|
|
39594
|
-
}, 0);
|
|
39595
|
-
}
|
|
39596
39586
|
function Chart({
|
|
39597
39587
|
colors,
|
|
39598
39588
|
reportId,
|
|
@@ -40131,6 +40121,22 @@ var ChartDisplay = ({
|
|
|
40131
40121
|
)
|
|
40132
40122
|
};
|
|
40133
40123
|
}, [config]);
|
|
40124
|
+
const pieData = (0, import_react32.useMemo)(() => {
|
|
40125
|
+
if (!config || config.chartType?.toLowerCase() !== "pie") return [];
|
|
40126
|
+
if (config.pivot) return config.rows ?? [];
|
|
40127
|
+
const rows = config.rows ?? [];
|
|
40128
|
+
const configuredValueField = config.yAxisFields?.[0]?.field;
|
|
40129
|
+
if (!configuredValueField) return rows;
|
|
40130
|
+
const valueField = configuredValueField;
|
|
40131
|
+
const total = rows.reduce((sum, row) => {
|
|
40132
|
+
const value = parseInt(row[valueField] ?? "", 10);
|
|
40133
|
+
return isNaN(value) ? sum : sum + value;
|
|
40134
|
+
}, 0);
|
|
40135
|
+
return rows.map((row) => ({
|
|
40136
|
+
...row,
|
|
40137
|
+
count: parseInt(row[valueField] ?? "", 10) / total
|
|
40138
|
+
}));
|
|
40139
|
+
}, [config]);
|
|
40134
40140
|
if (loading) {
|
|
40135
40141
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className, style: containerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(LoadingComponent, {}) });
|
|
40136
40142
|
} else if (config && !["metric", "table", "gauge", "US map", "World map"].includes(
|
|
@@ -40149,15 +40155,7 @@ var ChartDisplay = ({
|
|
|
40149
40155
|
{
|
|
40150
40156
|
className,
|
|
40151
40157
|
containerStyle,
|
|
40152
|
-
data:
|
|
40153
|
-
return {
|
|
40154
|
-
...row,
|
|
40155
|
-
count: (
|
|
40156
|
-
// @ts-ignore
|
|
40157
|
-
parseInt(row[config?.yAxisFields[0]?.field]) / sumByKey(config?.rows, config?.yAxisFields[0]?.field)
|
|
40158
|
-
)
|
|
40159
|
-
};
|
|
40160
|
-
}) || [] : config?.rows || [],
|
|
40158
|
+
data: pieData,
|
|
40161
40159
|
category: config?.yAxisFields?.[0]?.field,
|
|
40162
40160
|
index: config?.xAxisField,
|
|
40163
40161
|
colors: chartColors,
|
|
@@ -40166,7 +40164,8 @@ var ChartDisplay = ({
|
|
|
40166
40164
|
onClickChartElement,
|
|
40167
40165
|
onClickLegendElement,
|
|
40168
40166
|
yAxisFields: config?.yAxisFields,
|
|
40169
|
-
showLegend: resolvedShowLegend
|
|
40167
|
+
showLegend: resolvedShowLegend,
|
|
40168
|
+
isAnimationActive
|
|
40170
40169
|
}
|
|
40171
40170
|
);
|
|
40172
40171
|
}
|
|
@@ -40216,7 +40215,8 @@ var ChartDisplay = ({
|
|
|
40216
40215
|
className,
|
|
40217
40216
|
colorMap,
|
|
40218
40217
|
onClickChartElement,
|
|
40219
|
-
scrollable
|
|
40218
|
+
scrollable,
|
|
40219
|
+
showAnimation: isAnimationActive
|
|
40220
40220
|
}
|
|
40221
40221
|
);
|
|
40222
40222
|
}
|
|
@@ -40371,6 +40371,7 @@ var ChartDisplay = ({
|
|
|
40371
40371
|
xAxisField: config?.xAxisField ?? "",
|
|
40372
40372
|
xAxisFormat: config?.xAxisFormat ?? "whole_number",
|
|
40373
40373
|
containerStyle,
|
|
40374
|
+
className,
|
|
40374
40375
|
colors: chartColors,
|
|
40375
40376
|
isAnimationActive
|
|
40376
40377
|
}
|
|
@@ -43578,7 +43579,9 @@ function StaticChart(props) {
|
|
|
43578
43579
|
onClickLegendElement,
|
|
43579
43580
|
containerStyle,
|
|
43580
43581
|
showLegend,
|
|
43581
|
-
|
|
43582
|
+
showAnimation,
|
|
43583
|
+
className,
|
|
43584
|
+
hideTableChartOuterBorder = true
|
|
43582
43585
|
} = props;
|
|
43583
43586
|
const {
|
|
43584
43587
|
report,
|
|
@@ -43635,9 +43638,17 @@ function StaticChart(props) {
|
|
|
43635
43638
|
className,
|
|
43636
43639
|
containerStyle: safeContainerStyle,
|
|
43637
43640
|
showLegend,
|
|
43641
|
+
isAnimationActive: showAnimation,
|
|
43638
43642
|
onPageChange: useLocalPivotTablePagination ? void 0 : onPageChange,
|
|
43639
43643
|
tableRowsLoading: useLocalPivotTablePagination ? false : pageLoading,
|
|
43640
|
-
onSortChange: useLocalPivotTablePagination ? void 0 : onSortChange
|
|
43644
|
+
onSortChange: useLocalPivotTablePagination ? void 0 : onSortChange,
|
|
43645
|
+
tableChartWrapperBorders: hideTableChartOuterBorder && report?.chartType === "table" ? {
|
|
43646
|
+
borderRadius: 0,
|
|
43647
|
+
borderLeft: "none",
|
|
43648
|
+
borderRight: "none",
|
|
43649
|
+
borderTop: "none",
|
|
43650
|
+
borderBottom: "none"
|
|
43651
|
+
} : void 0
|
|
43641
43652
|
}
|
|
43642
43653
|
);
|
|
43643
43654
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -2722,6 +2722,9 @@ interface StaticChartBaseProps {
|
|
|
2722
2722
|
onClickChartElement?: (data: any) => void;
|
|
2723
2723
|
onClickLegendElement?: (data: any) => void;
|
|
2724
2724
|
showLegend?: boolean;
|
|
2725
|
+
/** Strip QuillTable's outer frame when chart type is `table` (cell borders unchanged). */
|
|
2726
|
+
hideTableChartOuterBorder?: boolean;
|
|
2727
|
+
showAnimation?: boolean;
|
|
2725
2728
|
}
|
|
2726
2729
|
type StaticChartProps = (StaticChartBaseProps & {
|
|
2727
2730
|
className: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -2722,6 +2722,9 @@ interface StaticChartBaseProps {
|
|
|
2722
2722
|
onClickChartElement?: (data: any) => void;
|
|
2723
2723
|
onClickLegendElement?: (data: any) => void;
|
|
2724
2724
|
showLegend?: boolean;
|
|
2725
|
+
/** Strip QuillTable's outer frame when chart type is `table` (cell borders unchanged). */
|
|
2726
|
+
hideTableChartOuterBorder?: boolean;
|
|
2727
|
+
showAnimation?: boolean;
|
|
2725
2728
|
}
|
|
2726
2729
|
type StaticChartProps = (StaticChartBaseProps & {
|
|
2727
2730
|
className: string;
|