@quillsql/react 2.16.61 → 2.16.63

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
@@ -61638,7 +61638,7 @@ function mergeReportBuilderTables(baseTables, tableNamesToInclude, foreignKeyMap
61638
61638
  return void 0;
61639
61639
  }
61640
61640
  return {
61641
- type: "JOIN" /* JOIN */,
61641
+ type: "LEFT JOIN" /* LEFT */,
61642
61642
  condition: {
61643
61643
  operator: "=",
61644
61644
  left: {
@@ -61680,7 +61680,7 @@ function mergeReportBuilderTables(baseTables, tableNamesToInclude, foreignKeyMap
61680
61680
  }
61681
61681
  return void 0;
61682
61682
  };
61683
- const preferredPrimaryTableName = normalizedIncludedTableNames[0] ?? dedupedBaseTables.map((table) => String(table.name ?? "").trim()).find(Boolean) ?? "";
61683
+ const preferredPrimaryTableName = dedupedBaseTables.map((table) => String(table.name ?? "").trim()).find(Boolean) ?? normalizedIncludedTableNames[0] ?? "";
61684
61684
  const initialTableName = preferredPrimaryTableName || allTableNames[0] || "";
61685
61685
  if (!initialTableName) {
61686
61686
  return [];
@@ -66412,12 +66412,41 @@ function useReport(reportIdArg, options = {}) {
66412
66412
  resolvedYAxisFieldsForDisplay
66413
66413
  );
66414
66414
  if (String(baseChart.chartType ?? "").toLowerCase() === "table" && baseChart.pivot) {
66415
- columns2 = mergePivotTableDisplayColumnLabelsFromYAxis({
66416
- columns: columns2 ?? baseChart.columns,
66417
- yAxisFields: resolvedYAxisFieldsForDisplay,
66418
- pivotRowField: String(baseChart.pivot.rowField ?? ""),
66419
- 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;
66420
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
+ }
66421
66450
  }
66422
66451
  return {
66423
66452
  ...baseChart,
@@ -66432,6 +66461,7 @@ function useReport(reportIdArg, options = {}) {
66432
66461
  resolvedXAxisField,
66433
66462
  resolvedXAxisFormat,
66434
66463
  resolvedXAxisLabel,
66464
+ resolvedYAxisFields,
66435
66465
  resolvedYAxisFieldsForDisplay
66436
66466
  ]);
66437
66467
  const pivotDateFilterRangeCacheRef = (0, import_react61.useRef)({ key: "", min: null, max: null });
package/dist/index.js CHANGED
@@ -61850,7 +61850,7 @@ function mergeReportBuilderTables(baseTables, tableNamesToInclude, foreignKeyMap
61850
61850
  return void 0;
61851
61851
  }
61852
61852
  return {
61853
- type: "JOIN" /* JOIN */,
61853
+ type: "LEFT JOIN" /* LEFT */,
61854
61854
  condition: {
61855
61855
  operator: "=",
61856
61856
  left: {
@@ -61892,7 +61892,7 @@ function mergeReportBuilderTables(baseTables, tableNamesToInclude, foreignKeyMap
61892
61892
  }
61893
61893
  return void 0;
61894
61894
  };
61895
- const preferredPrimaryTableName = normalizedIncludedTableNames[0] ?? dedupedBaseTables.map((table) => String(table.name ?? "").trim()).find(Boolean) ?? "";
61895
+ const preferredPrimaryTableName = dedupedBaseTables.map((table) => String(table.name ?? "").trim()).find(Boolean) ?? normalizedIncludedTableNames[0] ?? "";
61896
61896
  const initialTableName = preferredPrimaryTableName || allTableNames[0] || "";
61897
61897
  if (!initialTableName) {
61898
61898
  return [];
@@ -66624,12 +66624,41 @@ function useReport(reportIdArg, options = {}) {
66624
66624
  resolvedYAxisFieldsForDisplay
66625
66625
  );
66626
66626
  if (String(baseChart.chartType ?? "").toLowerCase() === "table" && baseChart.pivot) {
66627
- columns2 = mergePivotTableDisplayColumnLabelsFromYAxis({
66628
- columns: columns2 ?? baseChart.columns,
66629
- yAxisFields: resolvedYAxisFieldsForDisplay,
66630
- pivotRowField: String(baseChart.pivot.rowField ?? ""),
66631
- 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;
66632
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
+ }
66633
66662
  }
66634
66663
  return {
66635
66664
  ...baseChart,
@@ -66644,6 +66673,7 @@ function useReport(reportIdArg, options = {}) {
66644
66673
  resolvedXAxisField,
66645
66674
  resolvedXAxisFormat,
66646
66675
  resolvedXAxisLabel,
66676
+ resolvedYAxisFields,
66647
66677
  resolvedYAxisFieldsForDisplay
66648
66678
  ]);
66649
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.61",
3
+ "version": "2.16.63",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {