@quillsql/react 2.16.67 → 2.16.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +47 -49
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +319 -321
- package/package.json +1 -1
package/dist/index.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
|
{
|
|
@@ -39591,12 +39583,6 @@ function QuillTableDashboardComponent({
|
|
|
39591
39583
|
init_valueFormatter();
|
|
39592
39584
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
39593
39585
|
var MAX_ROWS_FOR_GENERIC_TABLE = 500;
|
|
39594
|
-
function sumByKey(arr, key) {
|
|
39595
|
-
return arr.reduce((acc, cur) => {
|
|
39596
|
-
const val = parseInt(cur[key], 10);
|
|
39597
|
-
return isNaN(val) ? acc : acc + val;
|
|
39598
|
-
}, 0);
|
|
39599
|
-
}
|
|
39600
39586
|
function Chart({
|
|
39601
39587
|
colors,
|
|
39602
39588
|
reportId,
|
|
@@ -40135,6 +40121,22 @@ var ChartDisplay = ({
|
|
|
40135
40121
|
)
|
|
40136
40122
|
};
|
|
40137
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]);
|
|
40138
40140
|
if (loading) {
|
|
40139
40141
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className, style: containerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(LoadingComponent, {}) });
|
|
40140
40142
|
} else if (config && !["metric", "table", "gauge", "US map", "World map"].includes(
|
|
@@ -40153,15 +40155,7 @@ var ChartDisplay = ({
|
|
|
40153
40155
|
{
|
|
40154
40156
|
className,
|
|
40155
40157
|
containerStyle,
|
|
40156
|
-
data:
|
|
40157
|
-
return {
|
|
40158
|
-
...row,
|
|
40159
|
-
count: (
|
|
40160
|
-
// @ts-ignore
|
|
40161
|
-
parseInt(row[config?.yAxisFields[0]?.field]) / sumByKey(config?.rows, config?.yAxisFields[0]?.field)
|
|
40162
|
-
)
|
|
40163
|
-
};
|
|
40164
|
-
}) || [] : config?.rows || [],
|
|
40158
|
+
data: pieData,
|
|
40165
40159
|
category: config?.yAxisFields?.[0]?.field,
|
|
40166
40160
|
index: config?.xAxisField,
|
|
40167
40161
|
colors: chartColors,
|
|
@@ -40170,7 +40164,8 @@ var ChartDisplay = ({
|
|
|
40170
40164
|
onClickChartElement,
|
|
40171
40165
|
onClickLegendElement,
|
|
40172
40166
|
yAxisFields: config?.yAxisFields,
|
|
40173
|
-
showLegend: resolvedShowLegend
|
|
40167
|
+
showLegend: resolvedShowLegend,
|
|
40168
|
+
isAnimationActive
|
|
40174
40169
|
}
|
|
40175
40170
|
);
|
|
40176
40171
|
}
|
|
@@ -40220,7 +40215,8 @@ var ChartDisplay = ({
|
|
|
40220
40215
|
className,
|
|
40221
40216
|
colorMap,
|
|
40222
40217
|
onClickChartElement,
|
|
40223
|
-
scrollable
|
|
40218
|
+
scrollable,
|
|
40219
|
+
showAnimation: isAnimationActive
|
|
40224
40220
|
}
|
|
40225
40221
|
);
|
|
40226
40222
|
}
|
|
@@ -43583,6 +43579,7 @@ function StaticChart(props) {
|
|
|
43583
43579
|
onClickLegendElement,
|
|
43584
43580
|
containerStyle,
|
|
43585
43581
|
showLegend,
|
|
43582
|
+
showAnimation,
|
|
43586
43583
|
className,
|
|
43587
43584
|
hideTableChartOuterBorder = true
|
|
43588
43585
|
} = props;
|
|
@@ -43641,6 +43638,7 @@ function StaticChart(props) {
|
|
|
43641
43638
|
className,
|
|
43642
43639
|
containerStyle: safeContainerStyle,
|
|
43643
43640
|
showLegend,
|
|
43641
|
+
isAnimationActive: showAnimation,
|
|
43644
43642
|
onPageChange: useLocalPivotTablePagination ? void 0 : onPageChange,
|
|
43645
43643
|
tableRowsLoading: useLocalPivotTablePagination ? false : pageLoading,
|
|
43646
43644
|
onSortChange: useLocalPivotTablePagination ? void 0 : onSortChange,
|
package/dist/index.d.cts
CHANGED
|
@@ -2724,6 +2724,7 @@ interface StaticChartBaseProps {
|
|
|
2724
2724
|
showLegend?: boolean;
|
|
2725
2725
|
/** Strip QuillTable's outer frame when chart type is `table` (cell borders unchanged). */
|
|
2726
2726
|
hideTableChartOuterBorder?: boolean;
|
|
2727
|
+
showAnimation?: boolean;
|
|
2727
2728
|
}
|
|
2728
2729
|
type StaticChartProps = (StaticChartBaseProps & {
|
|
2729
2730
|
className: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -2724,6 +2724,7 @@ interface StaticChartBaseProps {
|
|
|
2724
2724
|
showLegend?: boolean;
|
|
2725
2725
|
/** Strip QuillTable's outer frame when chart type is `table` (cell borders unchanged). */
|
|
2726
2726
|
hideTableChartOuterBorder?: boolean;
|
|
2727
|
+
showAnimation?: boolean;
|
|
2727
2728
|
}
|
|
2728
2729
|
type StaticChartProps = (StaticChartBaseProps & {
|
|
2729
2730
|
className: string;
|