@quillsql/react 2.16.60 → 2.16.62

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 CHANGED
@@ -26905,6 +26905,16 @@ init_dataFetcher();
26905
26905
  init_tableProcessing();
26906
26906
  init_paginationProcessing();
26907
26907
  init_inMemoryPivotEngine();
26908
+
26909
+ // src/utils/dashboardPagination.ts
26910
+ function isDashboardPivotTable(report) {
26911
+ return String(report?.chartType ?? "").toLowerCase() === "table" && Boolean(report?.pivot);
26912
+ }
26913
+ function getDashboardReportProcessing(report, serverPagination) {
26914
+ return isDashboardPivotTable(report) ? {} : serverPagination;
26915
+ }
26916
+
26917
+ // src/hooks/useDashboard.ts
26908
26918
  var useDashboardInternal = (dashboardName, customFilters) => {
26909
26919
  const [dashboard] = (0, import_react2.useContext)(DashboardContext);
26910
26920
  const {
@@ -27828,8 +27838,10 @@ var useDashboard = (dashboardName, config) => {
27828
27838
  const additionalProcessing = {
27829
27839
  page: pagination
27830
27840
  };
27831
- const useLocalPivotTablePagination = String(reportInfo.chartType ?? "").toLowerCase() === "table" && Boolean(reportInfo.pivot);
27832
- const reportAdditionalProcessing = useLocalPivotTablePagination ? void 0 : additionalProcessing;
27841
+ const reportAdditionalProcessing = getDashboardReportProcessing(
27842
+ reportInfo,
27843
+ additionalProcessing
27844
+ );
27833
27845
  const usePivotTask = !cacheEnabled && !!reportInfo.pivot;
27834
27846
  const allFilters = dashboardFilters2.concat(customFilters).concat(customReportFiltersArray);
27835
27847
  const applyInMemoryPivotIfNeeded = (report2) => {
@@ -43600,7 +43612,7 @@ function StaticChart(props) {
43600
43612
  direction: sort.direction
43601
43613
  });
43602
43614
  };
43603
- const useLocalPivotTablePagination = String(report?.chartType ?? "").toLowerCase() === "table" && Boolean(report?.pivot);
43615
+ const useLocalPivotTablePagination = isDashboardPivotTable(report);
43604
43616
  const config = (0, import_react41.useMemo)(() => {
43605
43617
  return report ? {
43606
43618
  ...report,
@@ -66400,12 +66412,41 @@ function useReport(reportIdArg, options = {}) {
66400
66412
  resolvedYAxisFieldsForDisplay
66401
66413
  );
66402
66414
  if (String(baseChart.chartType ?? "").toLowerCase() === "table" && baseChart.pivot) {
66403
- columns2 = mergePivotTableDisplayColumnLabelsFromYAxis({
66404
- columns: columns2 ?? baseChart.columns,
66405
- yAxisFields: resolvedYAxisFieldsForDisplay,
66406
- pivotRowField: String(baseChart.pivot.rowField ?? ""),
66407
- xAxisLabel: resolvedXAxisLabel
66415
+ const pivotAggregations = getPivotAggregations(baseChart);
66416
+ const hasCustomMeasureLabel = resolvedYAxisFields.some((axis) => {
66417
+ const aggregation = findAggregationForFieldStrict(
66418
+ axis.field,
66419
+ pivotAggregations
66420
+ );
66421
+ if (!aggregation) return false;
66422
+ const label = String(axis.label ?? "").trim();
66423
+ const defaultLabel = buildAggregationLabel(aggregation, baseChart);
66424
+ return Boolean(label) && label !== defaultLabel;
66408
66425
  });
66426
+ if (pivotAggregations.length > 1 || hasCustomMeasureLabel) {
66427
+ columns2 = mergePivotTableDisplayColumnLabelsFromYAxis({
66428
+ columns: columns2 ?? baseChart.columns,
66429
+ yAxisFields: resolvedYAxisFieldsForDisplay,
66430
+ pivotRowField: String(baseChart.pivot.rowField ?? ""),
66431
+ xAxisLabel: resolvedXAxisLabel
66432
+ });
66433
+ } else {
66434
+ const pivotRowField = String(baseChart.pivot.rowField ?? "").trim();
66435
+ const pivotLabelByField = new Map(
66436
+ (baseChart.pivotColumns ?? []).map((column) => [
66437
+ String(column.field ?? "").trim(),
66438
+ String(column.label ?? "").trim()
66439
+ ])
66440
+ );
66441
+ columns2 = (columns2 ?? baseChart.columns)?.map((column) => {
66442
+ const field = String(column.field ?? "").trim();
66443
+ const rowLabel = field === pivotRowField ? String(resolvedXAxisLabel).trim() : "";
66444
+ return {
66445
+ ...column,
66446
+ label: rowLabel || pivotLabelByField.get(field) || column.label || field
66447
+ };
66448
+ });
66449
+ }
66409
66450
  }
66410
66451
  return {
66411
66452
  ...baseChart,
@@ -66420,6 +66461,7 @@ function useReport(reportIdArg, options = {}) {
66420
66461
  resolvedXAxisField,
66421
66462
  resolvedXAxisFormat,
66422
66463
  resolvedXAxisLabel,
66464
+ resolvedYAxisFields,
66423
66465
  resolvedYAxisFieldsForDisplay
66424
66466
  ]);
66425
66467
  const pivotDateFilterRangeCacheRef = (0, import_react61.useRef)({ key: "", min: null, max: null });
package/dist/index.js CHANGED
@@ -26926,6 +26926,16 @@ init_dataFetcher();
26926
26926
  init_tableProcessing();
26927
26927
  init_paginationProcessing();
26928
26928
  init_inMemoryPivotEngine();
26929
+
26930
+ // src/utils/dashboardPagination.ts
26931
+ function isDashboardPivotTable(report) {
26932
+ return String(report?.chartType ?? "").toLowerCase() === "table" && Boolean(report?.pivot);
26933
+ }
26934
+ function getDashboardReportProcessing(report, serverPagination) {
26935
+ return isDashboardPivotTable(report) ? {} : serverPagination;
26936
+ }
26937
+
26938
+ // src/hooks/useDashboard.ts
26929
26939
  var useDashboardInternal = (dashboardName, customFilters) => {
26930
26940
  const [dashboard] = useContext(DashboardContext);
26931
26941
  const {
@@ -27849,8 +27859,10 @@ var useDashboard = (dashboardName, config) => {
27849
27859
  const additionalProcessing = {
27850
27860
  page: pagination
27851
27861
  };
27852
- const useLocalPivotTablePagination = String(reportInfo.chartType ?? "").toLowerCase() === "table" && Boolean(reportInfo.pivot);
27853
- const reportAdditionalProcessing = useLocalPivotTablePagination ? void 0 : additionalProcessing;
27862
+ const reportAdditionalProcessing = getDashboardReportProcessing(
27863
+ reportInfo,
27864
+ additionalProcessing
27865
+ );
27854
27866
  const usePivotTask = !cacheEnabled && !!reportInfo.pivot;
27855
27867
  const allFilters = dashboardFilters2.concat(customFilters).concat(customReportFiltersArray);
27856
27868
  const applyInMemoryPivotIfNeeded = (report2) => {
@@ -43703,7 +43715,7 @@ function StaticChart(props) {
43703
43715
  direction: sort.direction
43704
43716
  });
43705
43717
  };
43706
- const useLocalPivotTablePagination = String(report?.chartType ?? "").toLowerCase() === "table" && Boolean(report?.pivot);
43718
+ const useLocalPivotTablePagination = isDashboardPivotTable(report);
43707
43719
  const config = useMemo20(() => {
43708
43720
  return report ? {
43709
43721
  ...report,
@@ -66612,12 +66624,41 @@ function useReport(reportIdArg, options = {}) {
66612
66624
  resolvedYAxisFieldsForDisplay
66613
66625
  );
66614
66626
  if (String(baseChart.chartType ?? "").toLowerCase() === "table" && baseChart.pivot) {
66615
- columns2 = mergePivotTableDisplayColumnLabelsFromYAxis({
66616
- columns: columns2 ?? baseChart.columns,
66617
- yAxisFields: resolvedYAxisFieldsForDisplay,
66618
- pivotRowField: String(baseChart.pivot.rowField ?? ""),
66619
- xAxisLabel: resolvedXAxisLabel
66627
+ const pivotAggregations = getPivotAggregations(baseChart);
66628
+ const hasCustomMeasureLabel = resolvedYAxisFields.some((axis) => {
66629
+ const aggregation = findAggregationForFieldStrict(
66630
+ axis.field,
66631
+ pivotAggregations
66632
+ );
66633
+ if (!aggregation) return false;
66634
+ const label = String(axis.label ?? "").trim();
66635
+ const defaultLabel = buildAggregationLabel(aggregation, baseChart);
66636
+ return Boolean(label) && label !== defaultLabel;
66620
66637
  });
66638
+ if (pivotAggregations.length > 1 || hasCustomMeasureLabel) {
66639
+ columns2 = mergePivotTableDisplayColumnLabelsFromYAxis({
66640
+ columns: columns2 ?? baseChart.columns,
66641
+ yAxisFields: resolvedYAxisFieldsForDisplay,
66642
+ pivotRowField: String(baseChart.pivot.rowField ?? ""),
66643
+ xAxisLabel: resolvedXAxisLabel
66644
+ });
66645
+ } else {
66646
+ const pivotRowField = String(baseChart.pivot.rowField ?? "").trim();
66647
+ const pivotLabelByField = new Map(
66648
+ (baseChart.pivotColumns ?? []).map((column) => [
66649
+ String(column.field ?? "").trim(),
66650
+ String(column.label ?? "").trim()
66651
+ ])
66652
+ );
66653
+ columns2 = (columns2 ?? baseChart.columns)?.map((column) => {
66654
+ const field = String(column.field ?? "").trim();
66655
+ const rowLabel = field === pivotRowField ? String(resolvedXAxisLabel).trim() : "";
66656
+ return {
66657
+ ...column,
66658
+ label: rowLabel || pivotLabelByField.get(field) || column.label || field
66659
+ };
66660
+ });
66661
+ }
66621
66662
  }
66622
66663
  return {
66623
66664
  ...baseChart,
@@ -66632,6 +66673,7 @@ function useReport(reportIdArg, options = {}) {
66632
66673
  resolvedXAxisField,
66633
66674
  resolvedXAxisFormat,
66634
66675
  resolvedXAxisLabel,
66676
+ resolvedYAxisFields,
66635
66677
  resolvedYAxisFieldsForDisplay
66636
66678
  ]);
66637
66679
  const pivotDateFilterRangeCacheRef = useRef24({ key: "", min: null, max: null });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.16.60",
3
+ "version": "2.16.62",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {