@quillsql/react 2.16.102 → 2.16.104

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
@@ -63922,22 +63922,21 @@ function isPlaceholderAxisLabel(label, field) {
63922
63922
  function resolvedAxisLabel(savedLabel, field, generatedLabel) {
63923
63923
  return isPlaceholderAxisLabel(savedLabel, field) ? generatedLabel : savedLabel;
63924
63924
  }
63925
+ function uniqueAxisFormat(formats) {
63926
+ const values = formats.map((format9) => String(format9 ?? "").trim()).filter(Boolean);
63927
+ if (values.length === 0) return void 0;
63928
+ return values.every((format9) => format9 === values[0]) ? values[0] : void 0;
63929
+ }
63925
63930
  function resolveYAxisFormatForField(field, aggregation, saved, fallback) {
63926
63931
  const formatByField = new Map(
63927
63932
  saved.map((axis) => [String(axis.field ?? "").trim(), axis.format])
63928
63933
  );
63934
+ const savedFormats = uniqueAxisFormat(saved.map((axis) => axis.format));
63929
63935
  if (aggregation?.aggregationType === "count") {
63930
- return formatByField.get(field) ?? formatByField.get("count") ?? saved[0]?.format ?? "whole_number";
63931
- }
63932
- if (aggregation?.aggregationType === "percentage") {
63933
- const savedFormat = formatByField.get(field);
63934
- if (savedFormat === "percent" || savedFormat === "percentage") {
63935
- return savedFormat;
63936
- }
63937
- return "percentage";
63936
+ return formatByField.get(field) ?? formatByField.get("count") ?? savedFormats ?? "whole_number";
63938
63937
  }
63939
63938
  const aggType = aggregation?.aggregationType ? String(aggregation.aggregationType) : void 0;
63940
- return formatByField.get(field) ?? formatByField.get(trimAggregationSuffix(field, aggType)) ?? (aggregation?.valueField ? formatByField.get(aggregation.valueField) : void 0) ?? fallback;
63939
+ return formatByField.get(field) ?? formatByField.get(trimAggregationSuffix(field, aggType)) ?? (aggregation?.valueField ? formatByField.get(aggregation.valueField) : void 0) ?? savedFormats ?? fallback;
63941
63940
  }
63942
63941
  function aggregationIdentityForField(field, aggregations) {
63943
63942
  return getAggregationIdentityKey(
@@ -64008,6 +64007,7 @@ function applyYAxisEdits(measures, edits, aggregations) {
64008
64007
  const base = (identity ? byIdentity.get(identity) : void 0) ?? byField.get(field);
64009
64008
  const label = String(edit.label ?? "").trim();
64010
64009
  if (!base) {
64010
+ if (aggregations.length > 0) continue;
64011
64011
  next.push({
64012
64012
  field,
64013
64013
  label: label || toTitleCaseLabel(field),
@@ -64021,7 +64021,16 @@ function applyYAxisEdits(measures, edits, aggregations) {
64021
64021
  format: toAxisFormat(edit.format, base.format)
64022
64022
  });
64023
64023
  }
64024
- return next.length > 0 ? next : measures;
64024
+ if (next.length > 0) return next;
64025
+ if (aggregations.length > 0 && measures.length === 1 && edits.length === 1 && edits[0]?.format) {
64026
+ return [
64027
+ {
64028
+ ...measures[0],
64029
+ format: toAxisFormat(edits[0].format, measures[0].format)
64030
+ }
64031
+ ];
64032
+ }
64033
+ return measures;
64025
64034
  }
64026
64035
  function resolveReportYAxis(chart, edits, resolveTableLabel) {
64027
64036
  const saved = chart.yAxisFields ?? [];
@@ -64032,7 +64041,6 @@ function resolveReportYAxis(chart, edits, resolveTableLabel) {
64032
64041
  const aggregations = getPivotAggregations(chart);
64033
64042
  const hasMultipleAggregations = aggregations.length > 1;
64034
64043
  const columnField = String(chart.pivot?.columnField ?? "").trim();
64035
- const isAggregationOnlyPivot = !String(chart.pivot?.rowField ?? "").trim() && !columnField;
64036
64044
  const fallback = saved[0]?.format ?? chart.xAxisFormat ?? "whole_number";
64037
64045
  const valueKeys = pivotValueFieldKeys(chart);
64038
64046
  const fallbackKeys = pivotFallbackValueKeys(chart);
@@ -64054,9 +64062,9 @@ function resolveReportYAxis(chart, edits, resolveTableLabel) {
64054
64062
  measure.field
64055
64063
  );
64056
64064
  if (matchedKey) return [{ ...measure, field: matchedKey }];
64057
- return isAggregationOnlyPivot ? [measure] : [];
64065
+ return [measure];
64058
64066
  });
64059
- if (!columnField && measures.length === 0 && saved.length > 0) {
64067
+ if (!columnField && measures.length === 0 && saved.length > 0 && aggregations.length === 0) {
64060
64068
  measures = saved;
64061
64069
  }
64062
64070
  measures = applyYAxisEdits(measures, edits, aggregations);
@@ -64083,7 +64091,12 @@ function resolveReportYAxis(chart, edits, resolveTableLabel) {
64083
64091
  measureLabel,
64084
64092
  hasMultipleAggregations
64085
64093
  ),
64086
- format: measure?.format ?? resolveYAxisFormatForField(field, aggregation, saved, fallback)
64094
+ format: measure?.format ?? resolveYAxisFormatForField(
64095
+ field,
64096
+ aggregation,
64097
+ saved,
64098
+ fallback
64099
+ )
64087
64100
  }
64088
64101
  ];
64089
64102
  });
@@ -64123,7 +64136,11 @@ function normalizePivotChartForDisplay(chart) {
64123
64136
  pivotRowFieldEarly,
64124
64137
  String(rowColumn?.format ?? "")
64125
64138
  ) ? pivotRowFieldEarly : config.xAxisField;
64126
- const withResolvedXAxis = resolvedXAxisField && resolvedXAxisField !== config.xAxisField ? { ...config, xAxisField: resolvedXAxisField } : config;
64139
+ const withResolvedXAxis = resolvedXAxisField && resolvedXAxisField !== config.xAxisField ? {
64140
+ ...config,
64141
+ xAxisField: resolvedXAxisField,
64142
+ xAxisFormat: toAxisFormat(rowColumn?.format, "string")
64143
+ } : config;
64127
64144
  const isMetricOrGauge = ["metric", "gauge"].includes(
64128
64145
  String(withResolvedXAxis.chartType ?? "").toLowerCase()
64129
64146
  );
@@ -70229,10 +70246,12 @@ function useReport(reportIdArg, options = {}) {
70229
70246
  xAxisFormat: resolvedXAxisFormat,
70230
70247
  xAxisLabel: resolvedXAxisLabel,
70231
70248
  yAxisFields: yAxisSeries,
70249
+ showLegend: chartVisibility.showLegend,
70232
70250
  columns: columns2 ?? baseChart.columns
70233
70251
  };
70234
70252
  }, [
70235
70253
  baseChart,
70254
+ chartVisibility.showLegend,
70236
70255
  resolvedXAxisField,
70237
70256
  resolvedXAxisFormat,
70238
70257
  resolvedXAxisLabel,
@@ -71916,13 +71935,22 @@ function useReport(reportIdArg, options = {}) {
71916
71935
  id: savedReportId,
71917
71936
  name: persistedName,
71918
71937
  chartType: resolvedChartType,
71938
+ dashboardName: resolvedDashboardName,
71939
+ section: hasSectionOverride ? overrides.section : sourceRest.section,
71919
71940
  xAxisField: resolvedXAxisField,
71920
71941
  xAxisFormat: resolvedXAxisFormat,
71921
71942
  xAxisLabel: resolvedXAxisLabel,
71922
71943
  yAxisFields: yAxisMeasures,
71944
+ showLegend: chartVisibility.showLegend,
71945
+ chartSort: resolvedChartSort ?? null,
71923
71946
  pivot: effectiveReportBuilderState.pivot ?? null,
71924
71947
  reportBuilderState: effectiveReportBuilderState,
71925
71948
  columns: columnsSelectedForSave,
71949
+ sort: isFlatTable ? effectiveReportBuilderState.sort?.[0] ?? null : sourceRest.sort,
71950
+ filterMap: overrides?.filterMap !== void 0 ? overrides.filterMap : sourceRest.filterMap,
71951
+ dateField: overrides?.dateField !== void 0 ? overrides.dateField : sourceRest.dateField,
71952
+ flags: hasReportFlagsOverride ? overrides.reportFlags : sourceRest.flags,
71953
+ virtualQueries: draftVirtualQueries,
71926
71954
  rows: sourceReport.rows,
71927
71955
  compareRows: sourceReport.compareRows,
71928
71956
  pivotRows: sourceReport.pivotRows,
package/dist/index.d.cts CHANGED
@@ -3363,6 +3363,7 @@ declare function useReport(reportIdArg?: string, options?: UseReportOptions): {
3363
3363
  label: string;
3364
3364
  format: AxisFormat$1;
3365
3365
  }[];
3366
+ showLegend: boolean;
3366
3367
  columns: Column$1[];
3367
3368
  pivotQuery?: string;
3368
3369
  comparisonPivotQuery?: string;
@@ -3391,7 +3392,6 @@ declare function useReport(reportIdArg?: string, options?: UseReportOptions): {
3391
3392
  [key: string]: string;
3392
3393
  }[];
3393
3394
  chartType: string;
3394
- showLegend?: boolean;
3395
3395
  chartSort?: ChartSort;
3396
3396
  dateField?: {
3397
3397
  table: string;
package/dist/index.d.ts CHANGED
@@ -3363,6 +3363,7 @@ declare function useReport(reportIdArg?: string, options?: UseReportOptions): {
3363
3363
  label: string;
3364
3364
  format: AxisFormat$1;
3365
3365
  }[];
3366
+ showLegend: boolean;
3366
3367
  columns: Column$1[];
3367
3368
  pivotQuery?: string;
3368
3369
  comparisonPivotQuery?: string;
@@ -3391,7 +3392,6 @@ declare function useReport(reportIdArg?: string, options?: UseReportOptions): {
3391
3392
  [key: string]: string;
3392
3393
  }[];
3393
3394
  chartType: string;
3394
- showLegend?: boolean;
3395
3395
  chartSort?: ChartSort;
3396
3396
  dateField?: {
3397
3397
  table: string;
package/dist/index.js CHANGED
@@ -64130,22 +64130,21 @@ function isPlaceholderAxisLabel(label, field) {
64130
64130
  function resolvedAxisLabel(savedLabel, field, generatedLabel) {
64131
64131
  return isPlaceholderAxisLabel(savedLabel, field) ? generatedLabel : savedLabel;
64132
64132
  }
64133
+ function uniqueAxisFormat(formats) {
64134
+ const values = formats.map((format9) => String(format9 ?? "").trim()).filter(Boolean);
64135
+ if (values.length === 0) return void 0;
64136
+ return values.every((format9) => format9 === values[0]) ? values[0] : void 0;
64137
+ }
64133
64138
  function resolveYAxisFormatForField(field, aggregation, saved, fallback) {
64134
64139
  const formatByField = new Map(
64135
64140
  saved.map((axis) => [String(axis.field ?? "").trim(), axis.format])
64136
64141
  );
64142
+ const savedFormats = uniqueAxisFormat(saved.map((axis) => axis.format));
64137
64143
  if (aggregation?.aggregationType === "count") {
64138
- return formatByField.get(field) ?? formatByField.get("count") ?? saved[0]?.format ?? "whole_number";
64139
- }
64140
- if (aggregation?.aggregationType === "percentage") {
64141
- const savedFormat = formatByField.get(field);
64142
- if (savedFormat === "percent" || savedFormat === "percentage") {
64143
- return savedFormat;
64144
- }
64145
- return "percentage";
64144
+ return formatByField.get(field) ?? formatByField.get("count") ?? savedFormats ?? "whole_number";
64146
64145
  }
64147
64146
  const aggType = aggregation?.aggregationType ? String(aggregation.aggregationType) : void 0;
64148
- return formatByField.get(field) ?? formatByField.get(trimAggregationSuffix(field, aggType)) ?? (aggregation?.valueField ? formatByField.get(aggregation.valueField) : void 0) ?? fallback;
64147
+ return formatByField.get(field) ?? formatByField.get(trimAggregationSuffix(field, aggType)) ?? (aggregation?.valueField ? formatByField.get(aggregation.valueField) : void 0) ?? savedFormats ?? fallback;
64149
64148
  }
64150
64149
  function aggregationIdentityForField(field, aggregations) {
64151
64150
  return getAggregationIdentityKey(
@@ -64216,6 +64215,7 @@ function applyYAxisEdits(measures, edits, aggregations) {
64216
64215
  const base = (identity ? byIdentity.get(identity) : void 0) ?? byField.get(field);
64217
64216
  const label = String(edit.label ?? "").trim();
64218
64217
  if (!base) {
64218
+ if (aggregations.length > 0) continue;
64219
64219
  next.push({
64220
64220
  field,
64221
64221
  label: label || toTitleCaseLabel(field),
@@ -64229,7 +64229,16 @@ function applyYAxisEdits(measures, edits, aggregations) {
64229
64229
  format: toAxisFormat(edit.format, base.format)
64230
64230
  });
64231
64231
  }
64232
- return next.length > 0 ? next : measures;
64232
+ if (next.length > 0) return next;
64233
+ if (aggregations.length > 0 && measures.length === 1 && edits.length === 1 && edits[0]?.format) {
64234
+ return [
64235
+ {
64236
+ ...measures[0],
64237
+ format: toAxisFormat(edits[0].format, measures[0].format)
64238
+ }
64239
+ ];
64240
+ }
64241
+ return measures;
64233
64242
  }
64234
64243
  function resolveReportYAxis(chart, edits, resolveTableLabel) {
64235
64244
  const saved = chart.yAxisFields ?? [];
@@ -64240,7 +64249,6 @@ function resolveReportYAxis(chart, edits, resolveTableLabel) {
64240
64249
  const aggregations = getPivotAggregations(chart);
64241
64250
  const hasMultipleAggregations = aggregations.length > 1;
64242
64251
  const columnField = String(chart.pivot?.columnField ?? "").trim();
64243
- const isAggregationOnlyPivot = !String(chart.pivot?.rowField ?? "").trim() && !columnField;
64244
64252
  const fallback = saved[0]?.format ?? chart.xAxisFormat ?? "whole_number";
64245
64253
  const valueKeys = pivotValueFieldKeys(chart);
64246
64254
  const fallbackKeys = pivotFallbackValueKeys(chart);
@@ -64262,9 +64270,9 @@ function resolveReportYAxis(chart, edits, resolveTableLabel) {
64262
64270
  measure.field
64263
64271
  );
64264
64272
  if (matchedKey) return [{ ...measure, field: matchedKey }];
64265
- return isAggregationOnlyPivot ? [measure] : [];
64273
+ return [measure];
64266
64274
  });
64267
- if (!columnField && measures.length === 0 && saved.length > 0) {
64275
+ if (!columnField && measures.length === 0 && saved.length > 0 && aggregations.length === 0) {
64268
64276
  measures = saved;
64269
64277
  }
64270
64278
  measures = applyYAxisEdits(measures, edits, aggregations);
@@ -64291,7 +64299,12 @@ function resolveReportYAxis(chart, edits, resolveTableLabel) {
64291
64299
  measureLabel,
64292
64300
  hasMultipleAggregations
64293
64301
  ),
64294
- format: measure?.format ?? resolveYAxisFormatForField(field, aggregation, saved, fallback)
64302
+ format: measure?.format ?? resolveYAxisFormatForField(
64303
+ field,
64304
+ aggregation,
64305
+ saved,
64306
+ fallback
64307
+ )
64295
64308
  }
64296
64309
  ];
64297
64310
  });
@@ -64331,7 +64344,11 @@ function normalizePivotChartForDisplay(chart) {
64331
64344
  pivotRowFieldEarly,
64332
64345
  String(rowColumn?.format ?? "")
64333
64346
  ) ? pivotRowFieldEarly : config.xAxisField;
64334
- const withResolvedXAxis = resolvedXAxisField && resolvedXAxisField !== config.xAxisField ? { ...config, xAxisField: resolvedXAxisField } : config;
64347
+ const withResolvedXAxis = resolvedXAxisField && resolvedXAxisField !== config.xAxisField ? {
64348
+ ...config,
64349
+ xAxisField: resolvedXAxisField,
64350
+ xAxisFormat: toAxisFormat(rowColumn?.format, "string")
64351
+ } : config;
64335
64352
  const isMetricOrGauge = ["metric", "gauge"].includes(
64336
64353
  String(withResolvedXAxis.chartType ?? "").toLowerCase()
64337
64354
  );
@@ -70437,10 +70454,12 @@ function useReport(reportIdArg, options = {}) {
70437
70454
  xAxisFormat: resolvedXAxisFormat,
70438
70455
  xAxisLabel: resolvedXAxisLabel,
70439
70456
  yAxisFields: yAxisSeries,
70457
+ showLegend: chartVisibility.showLegend,
70440
70458
  columns: columns2 ?? baseChart.columns
70441
70459
  };
70442
70460
  }, [
70443
70461
  baseChart,
70462
+ chartVisibility.showLegend,
70444
70463
  resolvedXAxisField,
70445
70464
  resolvedXAxisFormat,
70446
70465
  resolvedXAxisLabel,
@@ -72124,13 +72143,22 @@ function useReport(reportIdArg, options = {}) {
72124
72143
  id: savedReportId,
72125
72144
  name: persistedName,
72126
72145
  chartType: resolvedChartType,
72146
+ dashboardName: resolvedDashboardName,
72147
+ section: hasSectionOverride ? overrides.section : sourceRest.section,
72127
72148
  xAxisField: resolvedXAxisField,
72128
72149
  xAxisFormat: resolvedXAxisFormat,
72129
72150
  xAxisLabel: resolvedXAxisLabel,
72130
72151
  yAxisFields: yAxisMeasures,
72152
+ showLegend: chartVisibility.showLegend,
72153
+ chartSort: resolvedChartSort ?? null,
72131
72154
  pivot: effectiveReportBuilderState.pivot ?? null,
72132
72155
  reportBuilderState: effectiveReportBuilderState,
72133
72156
  columns: columnsSelectedForSave,
72157
+ sort: isFlatTable ? effectiveReportBuilderState.sort?.[0] ?? null : sourceRest.sort,
72158
+ filterMap: overrides?.filterMap !== void 0 ? overrides.filterMap : sourceRest.filterMap,
72159
+ dateField: overrides?.dateField !== void 0 ? overrides.dateField : sourceRest.dateField,
72160
+ flags: hasReportFlagsOverride ? overrides.reportFlags : sourceRest.flags,
72161
+ virtualQueries: draftVirtualQueries,
72134
72162
  rows: sourceReport.rows,
72135
72163
  compareRows: sourceReport.compareRows,
72136
72164
  pivotRows: sourceReport.pivotRows,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.16.102",
3
+ "version": "2.16.104",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {