@quillsql/react 2.16.85 → 2.16.87

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
@@ -67710,7 +67710,13 @@ function useReport(reportIdArg, options = {}) {
67710
67710
  tables: tableScopeForDisplayColumns,
67711
67711
  schemaTables: schemaForReportBuilderState
67712
67712
  });
67713
- const sourceDisplayColumns = sourceDisplayColumnsFromSchema.length > 0 ? sourceDisplayColumnsFromSchema : sourceQueryColumns;
67713
+ const savedDisplayColumns = normalizeReportBuilderColumns(
67714
+ (sourceReport.columns ?? []).map((column) => ({
67715
+ ...column,
67716
+ table: String(column.table ?? "").trim() || resolveColumnTableFromReportMetadata(sourceReport, column.field)
67717
+ }))
67718
+ );
67719
+ const sourceDisplayColumns = savedDisplayColumns.length > 0 ? savedDisplayColumns : sourceDisplayColumnsFromSchema.length > 0 ? sourceDisplayColumnsFromSchema : sourceQueryColumns;
67714
67720
  const shouldKeepLocalRowGroup = groupRowsBySetViaSetReportRef.current || groupColumnsBySetViaSetReportRef.current && prev.groupRowsBy !== void 0;
67715
67721
  const shouldKeepLocalColumnGroup = groupColumnsBySetViaSetReportRef.current || groupRowsBySetViaSetReportRef.current && prev.groupColumnsBy !== void 0;
67716
67722
  const nextGroupRowsBy = shouldTakePivotGroupsFromSource ? shouldKeepLocalRowGroup ? prev.groupRowsBy : sourceRowGroupOption : prev.groupRowsBy !== void 0 ? prev.groupRowsBy : groupRowsBySetViaSetReportRef.current ? prev.groupRowsBy : sourceRowGroupOption;
@@ -69476,6 +69482,10 @@ function useReport(reportIdArg, options = {}) {
69476
69482
  chartAxisOptions,
69477
69483
  resolvedYAxisFields
69478
69484
  ]);
69485
+ const xAxisMetadataField = String(
69486
+ chartAxisEdits.xAxisField ?? chartData?.xAxisField ?? ""
69487
+ ).trim();
69488
+ const xAxisMetadataMatchesResolvedField = !xAxisMetadataField || xAxisMetadataField === resolvedXAxisField;
69479
69489
  const resolvedXAxisFormat = (0, import_react63.useMemo)(() => {
69480
69490
  if (!chartAxesBaseChart) {
69481
69491
  return "string";
@@ -69489,22 +69499,24 @@ function useReport(reportIdArg, options = {}) {
69489
69499
  resolvedXAxisField
69490
69500
  );
69491
69501
  if (bucketFormat) return bucketFormat;
69492
- if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && chartAxisEdits.xAxisFormat === void 0) {
69502
+ if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && (!xAxisMetadataMatchesResolvedField || chartAxisEdits.xAxisFormat === void 0)) {
69493
69503
  defaultFormat = "string";
69494
69504
  }
69495
- return chartAxisEdits.xAxisFormat !== void 0 ? toAxisFormat(chartAxisEdits.xAxisFormat, defaultFormat) : defaultFormat;
69505
+ return xAxisMetadataMatchesResolvedField && chartAxisEdits.xAxisFormat !== void 0 ? toAxisFormat(chartAxisEdits.xAxisFormat, defaultFormat) : defaultFormat;
69496
69506
  }, [
69497
69507
  chartAxesBaseChart,
69498
69508
  chartAxisEdits.xAxisFormat,
69499
69509
  chartAxisOptionByField,
69500
69510
  resolvedXAxisField,
69501
- resolvedYAxisFields
69511
+ resolvedYAxisFields,
69512
+ xAxisMetadataMatchesResolvedField
69502
69513
  ]);
69503
69514
  const resolvedXAxisLabel = (0, import_react63.useMemo)(() => {
69515
+ const fieldLabel = chartAxisOptionByField.get(resolvedXAxisField)?.label ?? "";
69504
69516
  const defaultXLabel = String(
69505
- chartAxesBaseChart?.xAxisLabel ?? chartAxisOptionByField.get(resolvedXAxisField)?.label ?? ""
69517
+ xAxisMetadataMatchesResolvedField ? chartAxesBaseChart?.xAxisLabel ?? fieldLabel : fieldLabel
69506
69518
  ).trim();
69507
- if (chartAxisEdits.xAxisLabel !== void 0) {
69519
+ if (xAxisMetadataMatchesResolvedField && chartAxisEdits.xAxisLabel !== void 0) {
69508
69520
  return String(chartAxisEdits.xAxisLabel).trim();
69509
69521
  }
69510
69522
  return !defaultXLabel || defaultXLabel === resolvedXAxisField ? toTitleCaseLabel(resolvedXAxisField) : defaultXLabel;
@@ -69512,7 +69524,8 @@ function useReport(reportIdArg, options = {}) {
69512
69524
  chartAxesBaseChart?.xAxisLabel,
69513
69525
  chartAxisEdits.xAxisLabel,
69514
69526
  chartAxisOptionByField,
69515
- resolvedXAxisField
69527
+ resolvedXAxisField,
69528
+ xAxisMetadataMatchesResolvedField
69516
69529
  ]);
69517
69530
  const chartVisibility = (0, import_react63.useMemo)(
69518
69531
  () => ({
@@ -70416,7 +70429,7 @@ function useReport(reportIdArg, options = {}) {
70416
70429
  pivotField && rowField && pivotField === rowField
70417
70430
  );
70418
70431
  if (isPivotRowColumn) {
70419
- const xAxisPatch = {};
70432
+ const xAxisPatch = { field: rowField };
70420
70433
  if (updates.format !== void 0) {
70421
70434
  const rawFmt = String(updates.format ?? "").trim();
70422
70435
  const rowIsDateType = isDateType(
@@ -70427,7 +70440,8 @@ function useReport(reportIdArg, options = {}) {
70427
70440
  if (updates.label !== void 0) {
70428
70441
  xAxisPatch.label = String(updates.label ?? "").trim();
70429
70442
  }
70430
- if (Object.keys(xAxisPatch).length === 0) return null;
70443
+ if (updates.format === void 0 && updates.label === void 0)
70444
+ return null;
70431
70445
  return { chartAxes: { xAxis: xAxisPatch } };
70432
70446
  }
70433
70447
  const aggs = getPivotAggregations(
package/dist/index.js CHANGED
@@ -67918,7 +67918,13 @@ function useReport(reportIdArg, options = {}) {
67918
67918
  tables: tableScopeForDisplayColumns,
67919
67919
  schemaTables: schemaForReportBuilderState
67920
67920
  });
67921
- const sourceDisplayColumns = sourceDisplayColumnsFromSchema.length > 0 ? sourceDisplayColumnsFromSchema : sourceQueryColumns;
67921
+ const savedDisplayColumns = normalizeReportBuilderColumns(
67922
+ (sourceReport.columns ?? []).map((column) => ({
67923
+ ...column,
67924
+ table: String(column.table ?? "").trim() || resolveColumnTableFromReportMetadata(sourceReport, column.field)
67925
+ }))
67926
+ );
67927
+ const sourceDisplayColumns = savedDisplayColumns.length > 0 ? savedDisplayColumns : sourceDisplayColumnsFromSchema.length > 0 ? sourceDisplayColumnsFromSchema : sourceQueryColumns;
67922
67928
  const shouldKeepLocalRowGroup = groupRowsBySetViaSetReportRef.current || groupColumnsBySetViaSetReportRef.current && prev.groupRowsBy !== void 0;
67923
67929
  const shouldKeepLocalColumnGroup = groupColumnsBySetViaSetReportRef.current || groupRowsBySetViaSetReportRef.current && prev.groupColumnsBy !== void 0;
67924
67930
  const nextGroupRowsBy = shouldTakePivotGroupsFromSource ? shouldKeepLocalRowGroup ? prev.groupRowsBy : sourceRowGroupOption : prev.groupRowsBy !== void 0 ? prev.groupRowsBy : groupRowsBySetViaSetReportRef.current ? prev.groupRowsBy : sourceRowGroupOption;
@@ -69684,6 +69690,10 @@ function useReport(reportIdArg, options = {}) {
69684
69690
  chartAxisOptions,
69685
69691
  resolvedYAxisFields
69686
69692
  ]);
69693
+ const xAxisMetadataField = String(
69694
+ chartAxisEdits.xAxisField ?? chartData?.xAxisField ?? ""
69695
+ ).trim();
69696
+ const xAxisMetadataMatchesResolvedField = !xAxisMetadataField || xAxisMetadataField === resolvedXAxisField;
69687
69697
  const resolvedXAxisFormat = useMemo33(() => {
69688
69698
  if (!chartAxesBaseChart) {
69689
69699
  return "string";
@@ -69697,22 +69707,24 @@ function useReport(reportIdArg, options = {}) {
69697
69707
  resolvedXAxisField
69698
69708
  );
69699
69709
  if (bucketFormat) return bucketFormat;
69700
- if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && chartAxisEdits.xAxisFormat === void 0) {
69710
+ if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && (!xAxisMetadataMatchesResolvedField || chartAxisEdits.xAxisFormat === void 0)) {
69701
69711
  defaultFormat = "string";
69702
69712
  }
69703
- return chartAxisEdits.xAxisFormat !== void 0 ? toAxisFormat(chartAxisEdits.xAxisFormat, defaultFormat) : defaultFormat;
69713
+ return xAxisMetadataMatchesResolvedField && chartAxisEdits.xAxisFormat !== void 0 ? toAxisFormat(chartAxisEdits.xAxisFormat, defaultFormat) : defaultFormat;
69704
69714
  }, [
69705
69715
  chartAxesBaseChart,
69706
69716
  chartAxisEdits.xAxisFormat,
69707
69717
  chartAxisOptionByField,
69708
69718
  resolvedXAxisField,
69709
- resolvedYAxisFields
69719
+ resolvedYAxisFields,
69720
+ xAxisMetadataMatchesResolvedField
69710
69721
  ]);
69711
69722
  const resolvedXAxisLabel = useMemo33(() => {
69723
+ const fieldLabel = chartAxisOptionByField.get(resolvedXAxisField)?.label ?? "";
69712
69724
  const defaultXLabel = String(
69713
- chartAxesBaseChart?.xAxisLabel ?? chartAxisOptionByField.get(resolvedXAxisField)?.label ?? ""
69725
+ xAxisMetadataMatchesResolvedField ? chartAxesBaseChart?.xAxisLabel ?? fieldLabel : fieldLabel
69714
69726
  ).trim();
69715
- if (chartAxisEdits.xAxisLabel !== void 0) {
69727
+ if (xAxisMetadataMatchesResolvedField && chartAxisEdits.xAxisLabel !== void 0) {
69716
69728
  return String(chartAxisEdits.xAxisLabel).trim();
69717
69729
  }
69718
69730
  return !defaultXLabel || defaultXLabel === resolvedXAxisField ? toTitleCaseLabel(resolvedXAxisField) : defaultXLabel;
@@ -69720,7 +69732,8 @@ function useReport(reportIdArg, options = {}) {
69720
69732
  chartAxesBaseChart?.xAxisLabel,
69721
69733
  chartAxisEdits.xAxisLabel,
69722
69734
  chartAxisOptionByField,
69723
- resolvedXAxisField
69735
+ resolvedXAxisField,
69736
+ xAxisMetadataMatchesResolvedField
69724
69737
  ]);
69725
69738
  const chartVisibility = useMemo33(
69726
69739
  () => ({
@@ -70624,7 +70637,7 @@ function useReport(reportIdArg, options = {}) {
70624
70637
  pivotField && rowField && pivotField === rowField
70625
70638
  );
70626
70639
  if (isPivotRowColumn) {
70627
- const xAxisPatch = {};
70640
+ const xAxisPatch = { field: rowField };
70628
70641
  if (updates.format !== void 0) {
70629
70642
  const rawFmt = String(updates.format ?? "").trim();
70630
70643
  const rowIsDateType = isDateType(
@@ -70635,7 +70648,8 @@ function useReport(reportIdArg, options = {}) {
70635
70648
  if (updates.label !== void 0) {
70636
70649
  xAxisPatch.label = String(updates.label ?? "").trim();
70637
70650
  }
70638
- if (Object.keys(xAxisPatch).length === 0) return null;
70651
+ if (updates.format === void 0 && updates.label === void 0)
70652
+ return null;
70639
70653
  return { chartAxes: { xAxis: xAxisPatch } };
70640
70654
  }
70641
70655
  const aggs = getPivotAggregations(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.16.85",
3
+ "version": "2.16.87",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {