@quillsql/react 2.16.86 → 2.16.88

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
@@ -69482,6 +69482,10 @@ function useReport(reportIdArg, options = {}) {
69482
69482
  chartAxisOptions,
69483
69483
  resolvedYAxisFields
69484
69484
  ]);
69485
+ const xAxisMetadataField = String(
69486
+ chartAxisEdits.xAxisField ?? chartData?.xAxisField ?? ""
69487
+ ).trim();
69488
+ const xAxisMetadataMatchesResolvedField = !xAxisMetadataField || xAxisMetadataField === resolvedXAxisField;
69485
69489
  const resolvedXAxisFormat = (0, import_react63.useMemo)(() => {
69486
69490
  if (!chartAxesBaseChart) {
69487
69491
  return "string";
@@ -69495,22 +69499,24 @@ function useReport(reportIdArg, options = {}) {
69495
69499
  resolvedXAxisField
69496
69500
  );
69497
69501
  if (bucketFormat) return bucketFormat;
69498
- if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && chartAxisEdits.xAxisFormat === void 0) {
69502
+ if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && (!xAxisMetadataMatchesResolvedField || chartAxisEdits.xAxisFormat === void 0)) {
69499
69503
  defaultFormat = "string";
69500
69504
  }
69501
- return chartAxisEdits.xAxisFormat !== void 0 ? toAxisFormat(chartAxisEdits.xAxisFormat, defaultFormat) : defaultFormat;
69505
+ return xAxisMetadataMatchesResolvedField && chartAxisEdits.xAxisFormat !== void 0 ? toAxisFormat(chartAxisEdits.xAxisFormat, defaultFormat) : defaultFormat;
69502
69506
  }, [
69503
69507
  chartAxesBaseChart,
69504
69508
  chartAxisEdits.xAxisFormat,
69505
69509
  chartAxisOptionByField,
69506
69510
  resolvedXAxisField,
69507
- resolvedYAxisFields
69511
+ resolvedYAxisFields,
69512
+ xAxisMetadataMatchesResolvedField
69508
69513
  ]);
69509
69514
  const resolvedXAxisLabel = (0, import_react63.useMemo)(() => {
69515
+ const fieldLabel = chartAxisOptionByField.get(resolvedXAxisField)?.label ?? "";
69510
69516
  const defaultXLabel = String(
69511
- chartAxesBaseChart?.xAxisLabel ?? chartAxisOptionByField.get(resolvedXAxisField)?.label ?? ""
69517
+ xAxisMetadataMatchesResolvedField ? chartAxesBaseChart?.xAxisLabel ?? fieldLabel : fieldLabel
69512
69518
  ).trim();
69513
- if (chartAxisEdits.xAxisLabel !== void 0) {
69519
+ if (xAxisMetadataMatchesResolvedField && chartAxisEdits.xAxisLabel !== void 0) {
69514
69520
  return String(chartAxisEdits.xAxisLabel).trim();
69515
69521
  }
69516
69522
  return !defaultXLabel || defaultXLabel === resolvedXAxisField ? toTitleCaseLabel(resolvedXAxisField) : defaultXLabel;
@@ -69518,7 +69524,8 @@ function useReport(reportIdArg, options = {}) {
69518
69524
  chartAxesBaseChart?.xAxisLabel,
69519
69525
  chartAxisEdits.xAxisLabel,
69520
69526
  chartAxisOptionByField,
69521
- resolvedXAxisField
69527
+ resolvedXAxisField,
69528
+ xAxisMetadataMatchesResolvedField
69522
69529
  ]);
69523
69530
  const chartVisibility = (0, import_react63.useMemo)(
69524
69531
  () => ({
@@ -70422,7 +70429,7 @@ function useReport(reportIdArg, options = {}) {
70422
70429
  pivotField && rowField && pivotField === rowField
70423
70430
  );
70424
70431
  if (isPivotRowColumn) {
70425
- const xAxisPatch = {};
70432
+ const xAxisPatch = { field: rowField };
70426
70433
  if (updates.format !== void 0) {
70427
70434
  const rawFmt = String(updates.format ?? "").trim();
70428
70435
  const rowIsDateType = isDateType(
@@ -70433,7 +70440,8 @@ function useReport(reportIdArg, options = {}) {
70433
70440
  if (updates.label !== void 0) {
70434
70441
  xAxisPatch.label = String(updates.label ?? "").trim();
70435
70442
  }
70436
- if (Object.keys(xAxisPatch).length === 0) return null;
70443
+ if (updates.format === void 0 && updates.label === void 0)
70444
+ return null;
70437
70445
  return { chartAxes: { xAxis: xAxisPatch } };
70438
70446
  }
70439
70447
  const aggs = getPivotAggregations(
@@ -71147,7 +71155,7 @@ function useReport(reportIdArg, options = {}) {
71147
71155
  dashboardName: resolvedDashboardName,
71148
71156
  ...isAdmin ? { adminMode: true } : {},
71149
71157
  ...hasSectionOverride ? { section: overrides.section } : {},
71150
- ...!isPivotTable ? { columns: table.columns } : {},
71158
+ columns: isPivotTable ? chart?.columns ?? sourceReport.columns : table.columns,
71151
71159
  ...isFlatTable ? {
71152
71160
  sort: effectiveReportBuilderState.sort?.[0] ?? null
71153
71161
  } : {},
@@ -71190,6 +71198,7 @@ function useReport(reportIdArg, options = {}) {
71190
71198
  },
71191
71199
  [
71192
71200
  cacheCab,
71201
+ chart?.columns,
71193
71202
  chartVisibility.showLegend,
71194
71203
  client,
71195
71204
  dashboardNameForNewReport,
package/dist/index.js CHANGED
@@ -69690,6 +69690,10 @@ function useReport(reportIdArg, options = {}) {
69690
69690
  chartAxisOptions,
69691
69691
  resolvedYAxisFields
69692
69692
  ]);
69693
+ const xAxisMetadataField = String(
69694
+ chartAxisEdits.xAxisField ?? chartData?.xAxisField ?? ""
69695
+ ).trim();
69696
+ const xAxisMetadataMatchesResolvedField = !xAxisMetadataField || xAxisMetadataField === resolvedXAxisField;
69693
69697
  const resolvedXAxisFormat = useMemo33(() => {
69694
69698
  if (!chartAxesBaseChart) {
69695
69699
  return "string";
@@ -69703,22 +69707,24 @@ function useReport(reportIdArg, options = {}) {
69703
69707
  resolvedXAxisField
69704
69708
  );
69705
69709
  if (bucketFormat) return bucketFormat;
69706
- if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && chartAxisEdits.xAxisFormat === void 0) {
69710
+ if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && (!xAxisMetadataMatchesResolvedField || chartAxisEdits.xAxisFormat === void 0)) {
69707
69711
  defaultFormat = "string";
69708
69712
  }
69709
- return chartAxisEdits.xAxisFormat !== void 0 ? toAxisFormat(chartAxisEdits.xAxisFormat, defaultFormat) : defaultFormat;
69713
+ return xAxisMetadataMatchesResolvedField && chartAxisEdits.xAxisFormat !== void 0 ? toAxisFormat(chartAxisEdits.xAxisFormat, defaultFormat) : defaultFormat;
69710
69714
  }, [
69711
69715
  chartAxesBaseChart,
69712
69716
  chartAxisEdits.xAxisFormat,
69713
69717
  chartAxisOptionByField,
69714
69718
  resolvedXAxisField,
69715
- resolvedYAxisFields
69719
+ resolvedYAxisFields,
69720
+ xAxisMetadataMatchesResolvedField
69716
69721
  ]);
69717
69722
  const resolvedXAxisLabel = useMemo33(() => {
69723
+ const fieldLabel = chartAxisOptionByField.get(resolvedXAxisField)?.label ?? "";
69718
69724
  const defaultXLabel = String(
69719
- chartAxesBaseChart?.xAxisLabel ?? chartAxisOptionByField.get(resolvedXAxisField)?.label ?? ""
69725
+ xAxisMetadataMatchesResolvedField ? chartAxesBaseChart?.xAxisLabel ?? fieldLabel : fieldLabel
69720
69726
  ).trim();
69721
- if (chartAxisEdits.xAxisLabel !== void 0) {
69727
+ if (xAxisMetadataMatchesResolvedField && chartAxisEdits.xAxisLabel !== void 0) {
69722
69728
  return String(chartAxisEdits.xAxisLabel).trim();
69723
69729
  }
69724
69730
  return !defaultXLabel || defaultXLabel === resolvedXAxisField ? toTitleCaseLabel(resolvedXAxisField) : defaultXLabel;
@@ -69726,7 +69732,8 @@ function useReport(reportIdArg, options = {}) {
69726
69732
  chartAxesBaseChart?.xAxisLabel,
69727
69733
  chartAxisEdits.xAxisLabel,
69728
69734
  chartAxisOptionByField,
69729
- resolvedXAxisField
69735
+ resolvedXAxisField,
69736
+ xAxisMetadataMatchesResolvedField
69730
69737
  ]);
69731
69738
  const chartVisibility = useMemo33(
69732
69739
  () => ({
@@ -70630,7 +70637,7 @@ function useReport(reportIdArg, options = {}) {
70630
70637
  pivotField && rowField && pivotField === rowField
70631
70638
  );
70632
70639
  if (isPivotRowColumn) {
70633
- const xAxisPatch = {};
70640
+ const xAxisPatch = { field: rowField };
70634
70641
  if (updates.format !== void 0) {
70635
70642
  const rawFmt = String(updates.format ?? "").trim();
70636
70643
  const rowIsDateType = isDateType(
@@ -70641,7 +70648,8 @@ function useReport(reportIdArg, options = {}) {
70641
70648
  if (updates.label !== void 0) {
70642
70649
  xAxisPatch.label = String(updates.label ?? "").trim();
70643
70650
  }
70644
- if (Object.keys(xAxisPatch).length === 0) return null;
70651
+ if (updates.format === void 0 && updates.label === void 0)
70652
+ return null;
70645
70653
  return { chartAxes: { xAxis: xAxisPatch } };
70646
70654
  }
70647
70655
  const aggs = getPivotAggregations(
@@ -71355,7 +71363,7 @@ function useReport(reportIdArg, options = {}) {
71355
71363
  dashboardName: resolvedDashboardName,
71356
71364
  ...isAdmin ? { adminMode: true } : {},
71357
71365
  ...hasSectionOverride ? { section: overrides.section } : {},
71358
- ...!isPivotTable ? { columns: table.columns } : {},
71366
+ columns: isPivotTable ? chart?.columns ?? sourceReport.columns : table.columns,
71359
71367
  ...isFlatTable ? {
71360
71368
  sort: effectiveReportBuilderState.sort?.[0] ?? null
71361
71369
  } : {},
@@ -71398,6 +71406,7 @@ function useReport(reportIdArg, options = {}) {
71398
71406
  },
71399
71407
  [
71400
71408
  cacheCab,
71409
+ chart?.columns,
71401
71410
  chartVisibility.showLegend,
71402
71411
  client,
71403
71412
  dashboardNameForNewReport,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.16.86",
3
+ "version": "2.16.88",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {