@quillsql/react 2.16.56 → 2.16.57
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 +31 -24
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +31 -24
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -22575,7 +22575,8 @@ var formatRowsFromReport = (report, xAxisField, xAxisFormat) => {
|
|
|
22575
22575
|
return formattedRow;
|
|
22576
22576
|
});
|
|
22577
22577
|
};
|
|
22578
|
-
function formattedPivotRowsAndColumns(report, dashboardFilters = []) {
|
|
22578
|
+
function formattedPivotRowsAndColumns(report, dashboardFilters = [], options = {}) {
|
|
22579
|
+
const shouldFormatRows = options.formatRows ?? true;
|
|
22579
22580
|
let columns = report.pivotColumns ?? report.columns;
|
|
22580
22581
|
let rows = report.pivotRows ?? report.rows;
|
|
22581
22582
|
if (report.chartType === "table") {
|
|
@@ -22591,12 +22592,16 @@ function formattedPivotRowsAndColumns(report, dashboardFilters = []) {
|
|
|
22591
22592
|
format: col.format ?? "whole_number"
|
|
22592
22593
|
};
|
|
22593
22594
|
}) ?? report.columns;
|
|
22594
|
-
|
|
22595
|
+
if (shouldFormatRows) {
|
|
22596
|
+
rows = formatRowsFromReport({ rows, columns });
|
|
22597
|
+
}
|
|
22595
22598
|
} else if (report.chartType === "metric") {
|
|
22596
22599
|
columns = report.pivotColumns?.map((col) => {
|
|
22597
22600
|
return { ...col, format: report.xAxisFormat };
|
|
22598
22601
|
}) ?? report.columns;
|
|
22599
|
-
|
|
22602
|
+
if (shouldFormatRows) {
|
|
22603
|
+
rows = formatRowsFromReport({ rows, columns });
|
|
22604
|
+
}
|
|
22600
22605
|
}
|
|
22601
22606
|
const legacyPivotFormat = report.yAxisFields?.[0]?.format;
|
|
22602
22607
|
const formattedYAxisFields = getYAxisFields(
|
|
@@ -22652,7 +22657,7 @@ function convertInternalReportToReport(report, dashboardFilters, eventTracking,
|
|
|
22652
22657
|
report.xAxisField,
|
|
22653
22658
|
report.xAxisFormat
|
|
22654
22659
|
);
|
|
22655
|
-
} else if (report.chartType === "table") {
|
|
22660
|
+
} else if (report.chartType === "table" && initiator !== "useDashboardReport") {
|
|
22656
22661
|
rows = formatRowsFromReport(report);
|
|
22657
22662
|
}
|
|
22658
22663
|
return {
|
|
@@ -34150,8 +34155,7 @@ var createCustomBar = (yAxisFields, theme, layout, active = false) => {
|
|
|
34150
34155
|
yAxisFields,
|
|
34151
34156
|
theme,
|
|
34152
34157
|
layout,
|
|
34153
|
-
|
|
34154
|
-
strokeWidth: active ? 1.5 : props.strokeWidth
|
|
34158
|
+
fillOpacity: active ? 0.8 : props.fillOpacity
|
|
34155
34159
|
}
|
|
34156
34160
|
);
|
|
34157
34161
|
};
|
|
@@ -34402,24 +34406,27 @@ function BarChart({
|
|
|
34402
34406
|
if (!payload || payload.length === 0) {
|
|
34403
34407
|
return null;
|
|
34404
34408
|
}
|
|
34405
|
-
const
|
|
34406
|
-
const
|
|
34407
|
-
|
|
34408
|
-
|
|
34409
|
-
|
|
34409
|
+
const row = payload[0]?.payload ?? {};
|
|
34410
|
+
const activeLabel = label ?? row[xAxisField] ?? "";
|
|
34411
|
+
const payloadItems = sortYAxisFields([
|
|
34412
|
+
...yAxisFields
|
|
34413
|
+
]).map((field) => {
|
|
34414
|
+
const rawName = field.label;
|
|
34410
34415
|
const name2 = rawName ? humanizeChartSeriesTooltipLabel(rawName) : "";
|
|
34411
34416
|
return {
|
|
34412
|
-
...p,
|
|
34413
|
-
color: p.color || "black",
|
|
34414
34417
|
chartType: "line",
|
|
34415
|
-
|
|
34418
|
+
color: getCustomColor(field.field) ?? selectColor(
|
|
34419
|
+
field,
|
|
34420
|
+
colors,
|
|
34421
|
+
stableColorIndex(field.field)
|
|
34422
|
+
),
|
|
34423
|
+
dataKey: field.field,
|
|
34416
34424
|
name: snakeAndCamelCaseToTitleCase(
|
|
34417
|
-
name2 ||
|
|
34425
|
+
name2 || field.field
|
|
34418
34426
|
),
|
|
34419
|
-
payload:
|
|
34420
|
-
type:
|
|
34421
|
-
|
|
34422
|
-
value: p.value || ""
|
|
34427
|
+
payload: row,
|
|
34428
|
+
type: "none",
|
|
34429
|
+
value: row[field.field] ?? ""
|
|
34423
34430
|
};
|
|
34424
34431
|
});
|
|
34425
34432
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
@@ -34468,9 +34475,7 @@ function BarChart({
|
|
|
34468
34475
|
isAnimationActive,
|
|
34469
34476
|
shape: customBarShape,
|
|
34470
34477
|
activeBar: customActiveBarShape ?? {
|
|
34471
|
-
fillOpacity:
|
|
34472
|
-
stroke: theme?.primaryTextColor ?? "#111827",
|
|
34473
|
-
strokeWidth: 1.5
|
|
34478
|
+
fillOpacity: 0.8
|
|
34474
34479
|
},
|
|
34475
34480
|
style: {
|
|
34476
34481
|
cursor: onClickChartElement ? "pointer" : void 0
|
|
@@ -43595,7 +43600,7 @@ function StaticChart(props) {
|
|
|
43595
43600
|
const config = (0, import_react41.useMemo)(() => {
|
|
43596
43601
|
return report ? {
|
|
43597
43602
|
...report,
|
|
43598
|
-
...report.pivot ? formattedPivotRowsAndColumns(report) : {}
|
|
43603
|
+
...report.pivot ? formattedPivotRowsAndColumns(report, [], { formatRows: false }) : {}
|
|
43599
43604
|
} : void 0;
|
|
43600
43605
|
}, [report]);
|
|
43601
43606
|
if (error) {
|
|
@@ -69077,7 +69082,8 @@ function ReportDetail({
|
|
|
69077
69082
|
table,
|
|
69078
69083
|
tableLoading,
|
|
69079
69084
|
showLegend,
|
|
69080
|
-
hideTableChartOuterBorder = false
|
|
69085
|
+
hideTableChartOuterBorder = false,
|
|
69086
|
+
onClickChartElement
|
|
69081
69087
|
}) {
|
|
69082
69088
|
const [theme] = (0, import_react65.useContext)(ThemeContext);
|
|
69083
69089
|
const surfaceBackground = theme?.backgroundColor ?? "#fff";
|
|
@@ -69169,6 +69175,7 @@ function ReportDetail({
|
|
|
69169
69175
|
flexShrink: 0
|
|
69170
69176
|
},
|
|
69171
69177
|
showLegend,
|
|
69178
|
+
onClickChartElement,
|
|
69172
69179
|
tableChartWrapperBorders: hideTableChartOuterBorder && isTableChart ? {
|
|
69173
69180
|
borderRadius: 0,
|
|
69174
69181
|
borderLeft: "none",
|
package/dist/index.d.cts
CHANGED
|
@@ -3421,8 +3421,10 @@ type ReportDetailProps = {
|
|
|
3421
3421
|
showLegend?: boolean;
|
|
3422
3422
|
/** Strip QuillTable's outer frame when chart type is `table` (cell borders unchanged). */
|
|
3423
3423
|
hideTableChartOuterBorder?: boolean;
|
|
3424
|
+
/** Forwarded to `ChartDisplay` for chart element click interactions (e.g. drilldowns). */
|
|
3425
|
+
onClickChartElement?: (data: any) => void;
|
|
3424
3426
|
};
|
|
3425
|
-
declare function ReportDetail({ reportTitle, chart, chartLoading, table, tableLoading, showLegend, hideTableChartOuterBorder, }: ReportDetailProps): react_jsx_runtime.JSX.Element;
|
|
3427
|
+
declare function ReportDetail({ reportTitle, chart, chartLoading, table, tableLoading, showLegend, hideTableChartOuterBorder, onClickChartElement, }: ReportDetailProps): react_jsx_runtime.JSX.Element;
|
|
3426
3428
|
|
|
3427
3429
|
declare const quillFormat: ({ value, format, }: {
|
|
3428
3430
|
value: any;
|
package/dist/index.d.ts
CHANGED
|
@@ -3421,8 +3421,10 @@ type ReportDetailProps = {
|
|
|
3421
3421
|
showLegend?: boolean;
|
|
3422
3422
|
/** Strip QuillTable's outer frame when chart type is `table` (cell borders unchanged). */
|
|
3423
3423
|
hideTableChartOuterBorder?: boolean;
|
|
3424
|
+
/** Forwarded to `ChartDisplay` for chart element click interactions (e.g. drilldowns). */
|
|
3425
|
+
onClickChartElement?: (data: any) => void;
|
|
3424
3426
|
};
|
|
3425
|
-
declare function ReportDetail({ reportTitle, chart, chartLoading, table, tableLoading, showLegend, hideTableChartOuterBorder, }: ReportDetailProps): react_jsx_runtime.JSX.Element;
|
|
3427
|
+
declare function ReportDetail({ reportTitle, chart, chartLoading, table, tableLoading, showLegend, hideTableChartOuterBorder, onClickChartElement, }: ReportDetailProps): react_jsx_runtime.JSX.Element;
|
|
3426
3428
|
|
|
3427
3429
|
declare const quillFormat: ({ value, format, }: {
|
|
3428
3430
|
value: any;
|
package/dist/index.js
CHANGED
|
@@ -22572,7 +22572,8 @@ var formatRowsFromReport = (report, xAxisField, xAxisFormat) => {
|
|
|
22572
22572
|
return formattedRow;
|
|
22573
22573
|
});
|
|
22574
22574
|
};
|
|
22575
|
-
function formattedPivotRowsAndColumns(report, dashboardFilters = []) {
|
|
22575
|
+
function formattedPivotRowsAndColumns(report, dashboardFilters = [], options = {}) {
|
|
22576
|
+
const shouldFormatRows = options.formatRows ?? true;
|
|
22576
22577
|
let columns = report.pivotColumns ?? report.columns;
|
|
22577
22578
|
let rows = report.pivotRows ?? report.rows;
|
|
22578
22579
|
if (report.chartType === "table") {
|
|
@@ -22588,12 +22589,16 @@ function formattedPivotRowsAndColumns(report, dashboardFilters = []) {
|
|
|
22588
22589
|
format: col.format ?? "whole_number"
|
|
22589
22590
|
};
|
|
22590
22591
|
}) ?? report.columns;
|
|
22591
|
-
|
|
22592
|
+
if (shouldFormatRows) {
|
|
22593
|
+
rows = formatRowsFromReport({ rows, columns });
|
|
22594
|
+
}
|
|
22592
22595
|
} else if (report.chartType === "metric") {
|
|
22593
22596
|
columns = report.pivotColumns?.map((col) => {
|
|
22594
22597
|
return { ...col, format: report.xAxisFormat };
|
|
22595
22598
|
}) ?? report.columns;
|
|
22596
|
-
|
|
22599
|
+
if (shouldFormatRows) {
|
|
22600
|
+
rows = formatRowsFromReport({ rows, columns });
|
|
22601
|
+
}
|
|
22597
22602
|
}
|
|
22598
22603
|
const legacyPivotFormat = report.yAxisFields?.[0]?.format;
|
|
22599
22604
|
const formattedYAxisFields = getYAxisFields(
|
|
@@ -22649,7 +22654,7 @@ function convertInternalReportToReport(report, dashboardFilters, eventTracking,
|
|
|
22649
22654
|
report.xAxisField,
|
|
22650
22655
|
report.xAxisFormat
|
|
22651
22656
|
);
|
|
22652
|
-
} else if (report.chartType === "table") {
|
|
22657
|
+
} else if (report.chartType === "table" && initiator !== "useDashboardReport") {
|
|
22653
22658
|
rows = formatRowsFromReport(report);
|
|
22654
22659
|
}
|
|
22655
22660
|
return {
|
|
@@ -34210,8 +34215,7 @@ var createCustomBar = (yAxisFields, theme, layout, active = false) => {
|
|
|
34210
34215
|
yAxisFields,
|
|
34211
34216
|
theme,
|
|
34212
34217
|
layout,
|
|
34213
|
-
|
|
34214
|
-
strokeWidth: active ? 1.5 : props.strokeWidth
|
|
34218
|
+
fillOpacity: active ? 0.8 : props.fillOpacity
|
|
34215
34219
|
}
|
|
34216
34220
|
);
|
|
34217
34221
|
};
|
|
@@ -34462,24 +34466,27 @@ function BarChart({
|
|
|
34462
34466
|
if (!payload || payload.length === 0) {
|
|
34463
34467
|
return null;
|
|
34464
34468
|
}
|
|
34465
|
-
const
|
|
34466
|
-
const
|
|
34467
|
-
|
|
34468
|
-
|
|
34469
|
-
|
|
34469
|
+
const row = payload[0]?.payload ?? {};
|
|
34470
|
+
const activeLabel = label ?? row[xAxisField] ?? "";
|
|
34471
|
+
const payloadItems = sortYAxisFields([
|
|
34472
|
+
...yAxisFields
|
|
34473
|
+
]).map((field) => {
|
|
34474
|
+
const rawName = field.label;
|
|
34470
34475
|
const name2 = rawName ? humanizeChartSeriesTooltipLabel(rawName) : "";
|
|
34471
34476
|
return {
|
|
34472
|
-
...p,
|
|
34473
|
-
color: p.color || "black",
|
|
34474
34477
|
chartType: "line",
|
|
34475
|
-
|
|
34478
|
+
color: getCustomColor(field.field) ?? selectColor(
|
|
34479
|
+
field,
|
|
34480
|
+
colors,
|
|
34481
|
+
stableColorIndex(field.field)
|
|
34482
|
+
),
|
|
34483
|
+
dataKey: field.field,
|
|
34476
34484
|
name: snakeAndCamelCaseToTitleCase(
|
|
34477
|
-
name2 ||
|
|
34485
|
+
name2 || field.field
|
|
34478
34486
|
),
|
|
34479
|
-
payload:
|
|
34480
|
-
type:
|
|
34481
|
-
|
|
34482
|
-
value: p.value || ""
|
|
34487
|
+
payload: row,
|
|
34488
|
+
type: "none",
|
|
34489
|
+
value: row[field.field] ?? ""
|
|
34483
34490
|
};
|
|
34484
34491
|
});
|
|
34485
34492
|
return /* @__PURE__ */ jsx38(
|
|
@@ -34528,9 +34535,7 @@ function BarChart({
|
|
|
34528
34535
|
isAnimationActive,
|
|
34529
34536
|
shape: customBarShape,
|
|
34530
34537
|
activeBar: customActiveBarShape ?? {
|
|
34531
|
-
fillOpacity:
|
|
34532
|
-
stroke: theme?.primaryTextColor ?? "#111827",
|
|
34533
|
-
strokeWidth: 1.5
|
|
34538
|
+
fillOpacity: 0.8
|
|
34534
34539
|
},
|
|
34535
34540
|
style: {
|
|
34536
34541
|
cursor: onClickChartElement ? "pointer" : void 0
|
|
@@ -43698,7 +43703,7 @@ function StaticChart(props) {
|
|
|
43698
43703
|
const config = useMemo20(() => {
|
|
43699
43704
|
return report ? {
|
|
43700
43705
|
...report,
|
|
43701
|
-
...report.pivot ? formattedPivotRowsAndColumns(report) : {}
|
|
43706
|
+
...report.pivot ? formattedPivotRowsAndColumns(report, [], { formatRows: false }) : {}
|
|
43702
43707
|
} : void 0;
|
|
43703
43708
|
}, [report]);
|
|
43704
43709
|
if (error) {
|
|
@@ -69294,7 +69299,8 @@ function ReportDetail({
|
|
|
69294
69299
|
table,
|
|
69295
69300
|
tableLoading,
|
|
69296
69301
|
showLegend,
|
|
69297
|
-
hideTableChartOuterBorder = false
|
|
69302
|
+
hideTableChartOuterBorder = false,
|
|
69303
|
+
onClickChartElement
|
|
69298
69304
|
}) {
|
|
69299
69305
|
const [theme] = useContext38(ThemeContext);
|
|
69300
69306
|
const surfaceBackground = theme?.backgroundColor ?? "#fff";
|
|
@@ -69386,6 +69392,7 @@ function ReportDetail({
|
|
|
69386
69392
|
flexShrink: 0
|
|
69387
69393
|
},
|
|
69388
69394
|
showLegend,
|
|
69395
|
+
onClickChartElement,
|
|
69389
69396
|
tableChartWrapperBorders: hideTableChartOuterBorder && isTableChart ? {
|
|
69390
69397
|
borderRadius: 0,
|
|
69391
69398
|
borderLeft: "none",
|