@quillsql/react 2.16.96 → 2.16.97
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 +334 -502
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +334 -502
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -23784,11 +23784,17 @@ function formattedPivotRowsAndColumns(report, dashboardFilters = [], options = {
|
|
|
23784
23784
|
dashboardFilters
|
|
23785
23785
|
);
|
|
23786
23786
|
const pivotValueColumns = columns?.slice(1) ?? [];
|
|
23787
|
-
const yAxisFields = report.pivot && !report.pivot.columnField && pivotValueColumns.length > 0 ? pivotValueColumns.map((col
|
|
23788
|
-
|
|
23789
|
-
|
|
23790
|
-
|
|
23791
|
-
|
|
23787
|
+
const yAxisFields = report.pivot && !report.pivot.columnField && pivotValueColumns.length > 0 ? pivotValueColumns.map((col) => {
|
|
23788
|
+
const saved = report.yAxisFields?.find(
|
|
23789
|
+
(axis) => axis.field === col.field
|
|
23790
|
+
);
|
|
23791
|
+
const savedLabel = String(saved?.label ?? "").trim();
|
|
23792
|
+
return {
|
|
23793
|
+
field: col.field,
|
|
23794
|
+
label: savedLabel || col.label || col.field,
|
|
23795
|
+
format: saved?.format ?? legacyPivotFormat ?? col.format ?? "whole_number"
|
|
23796
|
+
};
|
|
23797
|
+
}) : formattedYAxisFields?.length > 0 ? formattedYAxisFields : pivotValueColumns.map((col) => ({
|
|
23792
23798
|
field: col.field,
|
|
23793
23799
|
label: col.label ?? col.field,
|
|
23794
23800
|
format: legacyPivotFormat ?? col.format ?? "whole_number"
|
|
@@ -41174,7 +41180,7 @@ function D3Gauge({
|
|
|
41174
41180
|
if (!containerRef.current || !select) return;
|
|
41175
41181
|
const container = containerRef.current;
|
|
41176
41182
|
select(container).select("svg").remove();
|
|
41177
|
-
svgRef.current = select(container).append("svg").attr("width", "100%").attr("height", "100%").attr("preserveAspectRatio", "xMidYMid meet");
|
|
41183
|
+
svgRef.current = select(container).append("svg").attr("width", "100%").attr("height", "100%").attr("preserveAspectRatio", "xMidYMid meet").style("display", "block");
|
|
41178
41184
|
gaugeGroupRef.current = svgRef.current.append("g");
|
|
41179
41185
|
for (let i = 0; i < 3; i++) {
|
|
41180
41186
|
gaugeGroupRef.current.append("path").attr("class", `arc-seg seg${i}`);
|
|
@@ -41309,7 +41315,7 @@ function D3Gauge({
|
|
|
41309
41315
|
"div",
|
|
41310
41316
|
{
|
|
41311
41317
|
ref: containerRef,
|
|
41312
|
-
style: { width: "100%", ...containerStyle },
|
|
41318
|
+
style: { width: "100%", height: "100%", ...containerStyle },
|
|
41313
41319
|
className
|
|
41314
41320
|
}
|
|
41315
41321
|
);
|
|
@@ -49472,10 +49478,10 @@ function InternalChart({
|
|
|
49472
49478
|
config: report,
|
|
49473
49479
|
containerStyle: {
|
|
49474
49480
|
minHeight: 300,
|
|
49475
|
-
width: ["US map", "World map"].includes(report.chartType) ? "70%" :
|
|
49476
|
-
height: ["US map", "World map"].includes(report.chartType) ? "fit-content" :
|
|
49477
|
-
marginLeft:
|
|
49478
|
-
marginRight:
|
|
49481
|
+
width: ["US map", "World map"].includes(report.chartType) ? "70%" : "100%",
|
|
49482
|
+
height: ["US map", "World map"].includes(report.chartType) ? "fit-content" : report.chartType === "gauge" ? 300 : void 0,
|
|
49483
|
+
marginLeft: "auto",
|
|
49484
|
+
marginRight: "auto"
|
|
49479
49485
|
},
|
|
49480
49486
|
reportId: report.id,
|
|
49481
49487
|
colors,
|
|
@@ -62800,9 +62806,6 @@ function getPageOptionsFromPageCount(pageCount) {
|
|
|
62800
62806
|
|
|
62801
62807
|
// src/hooks/useForm.tsx
|
|
62802
62808
|
var INTERNAL_PIVOT_ROW_FIELDS = /* @__PURE__ */ new Set(["__quillRawDate"]);
|
|
62803
|
-
var LEGACY_SINGLE_Y_AXIS_COLUMN_PIVOT_REPORT_IDS = /* @__PURE__ */ new Set([
|
|
62804
|
-
"69b63941ac8df4cda178a38a"
|
|
62805
|
-
]);
|
|
62806
62809
|
var AGGREGATION_OPTION_TYPES = [
|
|
62807
62810
|
"sum",
|
|
62808
62811
|
"average",
|
|
@@ -63607,10 +63610,7 @@ function normalizePivotColumnDisplayValue(value) {
|
|
|
63607
63610
|
if (!normalized) return "-";
|
|
63608
63611
|
return ["undefined", "null"].includes(normalized.toLowerCase()) ? "-" : normalized;
|
|
63609
63612
|
}
|
|
63610
|
-
function
|
|
63611
|
-
return aggregation?.aggregationType === "percentage" ? "percentage" : "whole_number";
|
|
63612
|
-
}
|
|
63613
|
-
function getPivotTableSlotReportColumn(reportColumns, aggregations, rowField, pivotTableColumnKey) {
|
|
63613
|
+
function getPivotTableReportColumn(reportColumns, aggregations, rowField, pivotTableColumnKey) {
|
|
63614
63614
|
const cols = reportColumns ?? [];
|
|
63615
63615
|
if (cols.length === 0) return void 0;
|
|
63616
63616
|
const row = String(rowField ?? "").trim();
|
|
@@ -63688,7 +63688,214 @@ function shouldUsePivotRowFieldAsXAxis(chartType, pivotRowField, rowColumnFormat
|
|
|
63688
63688
|
}
|
|
63689
63689
|
return true;
|
|
63690
63690
|
}
|
|
63691
|
-
function
|
|
63691
|
+
function pivotDisplayFieldKeys(chart) {
|
|
63692
|
+
const rowField = String(chart.pivot?.rowField ?? "").trim();
|
|
63693
|
+
const firstPivotRow = (chart.rows ?? []).find(
|
|
63694
|
+
(row) => Object.keys(row).length > 0
|
|
63695
|
+
);
|
|
63696
|
+
if (!firstPivotRow) return [];
|
|
63697
|
+
const keys = Object.keys(firstPivotRow).filter(
|
|
63698
|
+
(field) => !INTERNAL_PIVOT_ROW_FIELDS.has(field)
|
|
63699
|
+
);
|
|
63700
|
+
if (rowField && keys.includes(rowField)) {
|
|
63701
|
+
return [rowField, ...keys.filter((field) => field !== rowField)];
|
|
63702
|
+
}
|
|
63703
|
+
return keys;
|
|
63704
|
+
}
|
|
63705
|
+
function pivotValueFieldKeys(chart) {
|
|
63706
|
+
const rowKey = pivotRowKey(chart);
|
|
63707
|
+
const rowField = String(chart.pivot?.rowField ?? "").trim();
|
|
63708
|
+
return pivotDisplayFieldKeys(chart).filter(
|
|
63709
|
+
(field) => field !== rowKey && field !== rowField
|
|
63710
|
+
);
|
|
63711
|
+
}
|
|
63712
|
+
function pivotFallbackValueKeys(chart) {
|
|
63713
|
+
return (chart.pivotColumns ?? []).slice(1).map((column) => String(column.field ?? "").trim()).filter(Boolean);
|
|
63714
|
+
}
|
|
63715
|
+
function findSavedYAxisField(saved, field) {
|
|
63716
|
+
return saved.find((axis) => String(axis.field ?? "").trim() === field) ?? (saved.length === 1 ? saved[0] : void 0);
|
|
63717
|
+
}
|
|
63718
|
+
function isPlaceholderAxisLabel(label, field) {
|
|
63719
|
+
const trimmed = String(label ?? "").trim();
|
|
63720
|
+
const fieldTrim = String(field ?? "").trim();
|
|
63721
|
+
if (!trimmed) return true;
|
|
63722
|
+
if (trimmed.toLowerCase() === fieldTrim.toLowerCase()) return true;
|
|
63723
|
+
return trimmed === toTitleCaseLabel(fieldTrim);
|
|
63724
|
+
}
|
|
63725
|
+
function resolvedAxisLabel(savedLabel, field, generatedLabel) {
|
|
63726
|
+
return isPlaceholderAxisLabel(savedLabel, field) ? generatedLabel : savedLabel;
|
|
63727
|
+
}
|
|
63728
|
+
function resolveYAxisFormatForField(field, aggregation, saved, fallback) {
|
|
63729
|
+
const formatByField = new Map(
|
|
63730
|
+
saved.map((axis) => [String(axis.field ?? "").trim(), axis.format])
|
|
63731
|
+
);
|
|
63732
|
+
if (aggregation?.aggregationType === "count") {
|
|
63733
|
+
return formatByField.get(field) ?? formatByField.get("count") ?? saved[0]?.format ?? "whole_number";
|
|
63734
|
+
}
|
|
63735
|
+
if (aggregation?.aggregationType === "percentage") {
|
|
63736
|
+
const savedFormat = formatByField.get(field);
|
|
63737
|
+
if (savedFormat === "percent" || savedFormat === "percentage") {
|
|
63738
|
+
return savedFormat;
|
|
63739
|
+
}
|
|
63740
|
+
return "percentage";
|
|
63741
|
+
}
|
|
63742
|
+
const aggType = aggregation?.aggregationType ? String(aggregation.aggregationType) : void 0;
|
|
63743
|
+
return formatByField.get(field) ?? formatByField.get(trimAggregationSuffix(field, aggType)) ?? (aggregation?.valueField ? formatByField.get(aggregation.valueField) : void 0) ?? fallback;
|
|
63744
|
+
}
|
|
63745
|
+
function aggregationIdentityForField(field, aggregations) {
|
|
63746
|
+
return getAggregationIdentityKey(
|
|
63747
|
+
findAggregationForFieldStrict(field, aggregations)
|
|
63748
|
+
);
|
|
63749
|
+
}
|
|
63750
|
+
function indexByAggregationIdentity(axes, aggregations) {
|
|
63751
|
+
const byIdentity = /* @__PURE__ */ new Map();
|
|
63752
|
+
for (const axis of axes) {
|
|
63753
|
+
const identity = aggregationIdentityForField(axis.field, aggregations);
|
|
63754
|
+
if (identity && !byIdentity.has(identity)) {
|
|
63755
|
+
byIdentity.set(identity, axis);
|
|
63756
|
+
}
|
|
63757
|
+
}
|
|
63758
|
+
return byIdentity;
|
|
63759
|
+
}
|
|
63760
|
+
function matchedValueKeyForAggregation(aggregation, valueKeys, canonicalField) {
|
|
63761
|
+
if (valueKeys.includes(canonicalField)) return canonicalField;
|
|
63762
|
+
return valueKeys.find(
|
|
63763
|
+
(key) => findAggregationForFieldStrict(key, [aggregation])
|
|
63764
|
+
);
|
|
63765
|
+
}
|
|
63766
|
+
function composePivotColumnSeriesLabel(field, aggregation, measureLabel, hasMultipleAggregations) {
|
|
63767
|
+
if (!aggregation) return toTitleCaseLabel(String(field ?? ""));
|
|
63768
|
+
const category = normalizePivotColumnDisplayValue(
|
|
63769
|
+
getPivotColumnValueForSeries(field, aggregation, hasMultipleAggregations)
|
|
63770
|
+
);
|
|
63771
|
+
const isMeasureNamedSeries = Boolean(aggregation.valueField) && category === String(aggregation.valueField ?? "").trim();
|
|
63772
|
+
if (isMeasureNamedSeries) return measureLabel;
|
|
63773
|
+
if (!measureLabel || measureLabel === category) return category;
|
|
63774
|
+
return `${category} \xB7 ${measureLabel}`;
|
|
63775
|
+
}
|
|
63776
|
+
function measureFromAggregation(aggregation, chart, saved, fallback, hasMultipleAggregations, resolveTableLabel) {
|
|
63777
|
+
const canonicalField = getAggregationFieldKey(
|
|
63778
|
+
aggregation,
|
|
63779
|
+
hasMultipleAggregations
|
|
63780
|
+
);
|
|
63781
|
+
if (!canonicalField) return null;
|
|
63782
|
+
const previous = findSavedYAxisField(saved, canonicalField);
|
|
63783
|
+
const savedLabel = String(previous?.label ?? "").trim();
|
|
63784
|
+
const generatedLabel = buildAggregationLabel(
|
|
63785
|
+
aggregation,
|
|
63786
|
+
chart,
|
|
63787
|
+
resolveTableLabel
|
|
63788
|
+
);
|
|
63789
|
+
return {
|
|
63790
|
+
field: canonicalField,
|
|
63791
|
+
label: resolvedAxisLabel(savedLabel, canonicalField, generatedLabel),
|
|
63792
|
+
format: resolveYAxisFormatForField(
|
|
63793
|
+
canonicalField,
|
|
63794
|
+
aggregation,
|
|
63795
|
+
saved,
|
|
63796
|
+
fallback
|
|
63797
|
+
)
|
|
63798
|
+
};
|
|
63799
|
+
}
|
|
63800
|
+
function applyYAxisEdits(measures, edits, aggregations) {
|
|
63801
|
+
if (!edits) return measures;
|
|
63802
|
+
const byField = new Map(
|
|
63803
|
+
measures.map((measure) => [String(measure.field ?? "").trim(), measure])
|
|
63804
|
+
);
|
|
63805
|
+
const byIdentity = indexByAggregationIdentity(measures, aggregations);
|
|
63806
|
+
const next = [];
|
|
63807
|
+
for (const edit of edits) {
|
|
63808
|
+
const field = String(edit.field ?? "").trim();
|
|
63809
|
+
if (!field) continue;
|
|
63810
|
+
const identity = aggregationIdentityForField(field, aggregations);
|
|
63811
|
+
const base = (identity ? byIdentity.get(identity) : void 0) ?? byField.get(field);
|
|
63812
|
+
const label = String(edit.label ?? "").trim();
|
|
63813
|
+
if (!base) {
|
|
63814
|
+
next.push({
|
|
63815
|
+
field,
|
|
63816
|
+
label: label || toTitleCaseLabel(field),
|
|
63817
|
+
format: toAxisFormat(edit.format, "string")
|
|
63818
|
+
});
|
|
63819
|
+
continue;
|
|
63820
|
+
}
|
|
63821
|
+
next.push({
|
|
63822
|
+
field: base.field,
|
|
63823
|
+
label: label || base.label,
|
|
63824
|
+
format: toAxisFormat(edit.format, base.format)
|
|
63825
|
+
});
|
|
63826
|
+
}
|
|
63827
|
+
return next.length > 0 ? next : measures;
|
|
63828
|
+
}
|
|
63829
|
+
function resolveReportYAxis(chart, edits, resolveTableLabel) {
|
|
63830
|
+
const saved = chart.yAxisFields ?? [];
|
|
63831
|
+
if (!chart.pivot) {
|
|
63832
|
+
const measures2 = applyYAxisEdits(saved, edits, []);
|
|
63833
|
+
return { measures: measures2, series: measures2 };
|
|
63834
|
+
}
|
|
63835
|
+
const aggregations = getPivotAggregations(chart);
|
|
63836
|
+
const hasMultipleAggregations = aggregations.length > 1;
|
|
63837
|
+
const columnField = String(chart.pivot?.columnField ?? "").trim();
|
|
63838
|
+
const isAggregationOnlyPivot = !String(chart.pivot?.rowField ?? "").trim() && !columnField;
|
|
63839
|
+
const fallback = saved[0]?.format ?? chart.xAxisFormat ?? "whole_number";
|
|
63840
|
+
const valueKeys = pivotValueFieldKeys(chart);
|
|
63841
|
+
const fallbackKeys = pivotFallbackValueKeys(chart);
|
|
63842
|
+
let measures = aggregations.flatMap((aggregation) => {
|
|
63843
|
+
const measure = measureFromAggregation(
|
|
63844
|
+
aggregation,
|
|
63845
|
+
chart,
|
|
63846
|
+
saved,
|
|
63847
|
+
fallback,
|
|
63848
|
+
hasMultipleAggregations,
|
|
63849
|
+
resolveTableLabel
|
|
63850
|
+
);
|
|
63851
|
+
if (!measure) return [];
|
|
63852
|
+
if (columnField) return [measure];
|
|
63853
|
+
if (valueKeys.length === 0) return [measure];
|
|
63854
|
+
const matchedKey = matchedValueKeyForAggregation(
|
|
63855
|
+
aggregation,
|
|
63856
|
+
valueKeys,
|
|
63857
|
+
measure.field
|
|
63858
|
+
);
|
|
63859
|
+
if (matchedKey) return [{ ...measure, field: matchedKey }];
|
|
63860
|
+
return isAggregationOnlyPivot ? [measure] : [];
|
|
63861
|
+
});
|
|
63862
|
+
if (!columnField && measures.length === 0 && saved.length > 0) {
|
|
63863
|
+
measures = saved;
|
|
63864
|
+
}
|
|
63865
|
+
measures = applyYAxisEdits(measures, edits, aggregations);
|
|
63866
|
+
if (!columnField) {
|
|
63867
|
+
return { measures, series: measures };
|
|
63868
|
+
}
|
|
63869
|
+
const keys = valueKeys.length > 0 ? valueKeys : fallbackKeys;
|
|
63870
|
+
const measureByIdentity = indexByAggregationIdentity(measures, aggregations);
|
|
63871
|
+
const selectedIdentities = new Set(measureByIdentity.keys());
|
|
63872
|
+
const series = keys.flatMap((field) => {
|
|
63873
|
+
const aggregation = findAggregationForFieldStrict(field, aggregations);
|
|
63874
|
+
const identity = getAggregationIdentityKey(aggregation);
|
|
63875
|
+
if (selectedIdentities.size > 0 && identity && !selectedIdentities.has(identity)) {
|
|
63876
|
+
return [];
|
|
63877
|
+
}
|
|
63878
|
+
const measure = (identity ? measureByIdentity.get(identity) : void 0) ?? (measures.length === 1 ? measures[0] : void 0);
|
|
63879
|
+
const measureLabel = String(measure?.label ?? "").trim() || (aggregation ? buildAggregationLabel(aggregation, chart, resolveTableLabel) : toTitleCaseLabel(field));
|
|
63880
|
+
return [
|
|
63881
|
+
{
|
|
63882
|
+
field,
|
|
63883
|
+
label: composePivotColumnSeriesLabel(
|
|
63884
|
+
field,
|
|
63885
|
+
aggregation,
|
|
63886
|
+
measureLabel,
|
|
63887
|
+
hasMultipleAggregations
|
|
63888
|
+
),
|
|
63889
|
+
format: measure?.format ?? resolveYAxisFormatForField(field, aggregation, saved, fallback)
|
|
63890
|
+
}
|
|
63891
|
+
];
|
|
63892
|
+
});
|
|
63893
|
+
if (series.length > 0) {
|
|
63894
|
+
return { measures, series };
|
|
63895
|
+
}
|
|
63896
|
+
return { measures, series: measures };
|
|
63897
|
+
}
|
|
63898
|
+
function normalizePivotChartForDisplay(chart) {
|
|
63692
63899
|
const swapPivotRowsForChartRows = Boolean(chart?.pivot) && Array.isArray(chart?.pivotRows) && chart.pivotRows.length > 0;
|
|
63693
63900
|
const syntheticAggregationOnlyRows = chart && !swapPivotRowsForChartRows ? buildSyntheticAggregationOnlyDisplayRows(chart) : null;
|
|
63694
63901
|
const hasExplicitEmptyGroupedPivot = Boolean(
|
|
@@ -63724,136 +63931,13 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63724
63931
|
String(withResolvedXAxis.chartType ?? "").toLowerCase()
|
|
63725
63932
|
);
|
|
63726
63933
|
const aggregations = getPivotAggregations(withResolvedXAxis);
|
|
63727
|
-
const hasMultipleAggregations = aggregations.length > 1;
|
|
63728
63934
|
const yAxisFallbackFormat = withResolvedXAxis.yAxisFields?.[0]?.format ?? withResolvedXAxis.xAxisFormat ?? "whole_number";
|
|
63729
63935
|
const firstPivotRow = (withResolvedXAxis.rows ?? []).find(
|
|
63730
63936
|
(row) => Object.keys(row).length > 0
|
|
63731
63937
|
);
|
|
63732
|
-
const
|
|
63733
|
-
|
|
63734
|
-
|
|
63735
|
-
const pivotRowFields = firstPivotRow ? (() => {
|
|
63736
|
-
const keys = Object.keys(firstPivotRow).filter(
|
|
63737
|
-
(field) => !INTERNAL_PIVOT_ROW_FIELDS.has(field)
|
|
63738
|
-
);
|
|
63739
|
-
if (pivotRowFieldName && keys.includes(pivotRowFieldName)) {
|
|
63740
|
-
return [
|
|
63741
|
-
pivotRowFieldName,
|
|
63742
|
-
...keys.filter((field) => field !== pivotRowFieldName)
|
|
63743
|
-
];
|
|
63744
|
-
}
|
|
63745
|
-
return keys;
|
|
63746
|
-
})() : [];
|
|
63747
|
-
const pivotValueFields = pivotRowFields.filter(
|
|
63748
|
-
(field) => field !== pivotRowKey(withResolvedXAxis) && field !== withResolvedXAxis.pivot?.rowField
|
|
63749
|
-
);
|
|
63750
|
-
const isAggregationOnlyPivot = !String(withResolvedXAxis.pivot?.rowField ?? "").trim() && !String(withResolvedXAxis.pivot?.columnField ?? "").trim();
|
|
63751
|
-
const yAxisFormatByField = new Map(
|
|
63752
|
-
(withResolvedXAxis.yAxisFields ?? []).map((axis) => [
|
|
63753
|
-
axis.field,
|
|
63754
|
-
axis.format
|
|
63755
|
-
])
|
|
63756
|
-
);
|
|
63757
|
-
const resolveYAxisFormat = (field, aggregation) => {
|
|
63758
|
-
if (aggregation?.aggregationType === "count") {
|
|
63759
|
-
const savedFormat = yAxisFormatByField.get(field) ?? yAxisFormatByField.get("count") ?? withResolvedXAxis.yAxisFields?.find(
|
|
63760
|
-
(axis) => String(axis.field ?? "").trim() === field
|
|
63761
|
-
)?.format ?? withResolvedXAxis.yAxisFields?.[0]?.format;
|
|
63762
|
-
if (savedFormat) return savedFormat;
|
|
63763
|
-
return "whole_number";
|
|
63764
|
-
}
|
|
63765
|
-
if (aggregation?.aggregationType === "percentage") {
|
|
63766
|
-
const savedFormat = yAxisFormatByField.get(field);
|
|
63767
|
-
if (savedFormat === "percent" || savedFormat === "percentage") {
|
|
63768
|
-
return savedFormat;
|
|
63769
|
-
}
|
|
63770
|
-
return "percentage";
|
|
63771
|
-
}
|
|
63772
|
-
const directAxisFormat = yAxisFormatByField.get(field);
|
|
63773
|
-
if (directAxisFormat) return directAxisFormat;
|
|
63774
|
-
const aggType = aggregation?.aggregationType ? String(aggregation.aggregationType) : void 0;
|
|
63775
|
-
const baseField = trimAggregationSuffix(field, aggType);
|
|
63776
|
-
const baseAxisFormat = yAxisFormatByField.get(baseField);
|
|
63777
|
-
if (baseAxisFormat) return baseAxisFormat;
|
|
63778
|
-
if (aggregation?.valueField) {
|
|
63779
|
-
const aggregationValueFieldFormat = yAxisFormatByField.get(
|
|
63780
|
-
aggregation.valueField
|
|
63781
|
-
);
|
|
63782
|
-
if (aggregationValueFieldFormat) return aggregationValueFieldFormat;
|
|
63783
|
-
}
|
|
63784
|
-
return yAxisFallbackFormat;
|
|
63785
|
-
};
|
|
63786
|
-
const resolveAggregationAxisFieldForDisplay = (aggregation, canonicalField) => {
|
|
63787
|
-
if (!canonicalField) return null;
|
|
63788
|
-
if (pivotValueFields.includes(canonicalField)) {
|
|
63789
|
-
return canonicalField;
|
|
63790
|
-
}
|
|
63791
|
-
if (!isAggregationOnlyPivot) {
|
|
63792
|
-
return null;
|
|
63793
|
-
}
|
|
63794
|
-
const matchedPivotKey = pivotValueFields.find(
|
|
63795
|
-
(pf) => findAggregationForFieldStrict(pf, [aggregation])
|
|
63796
|
-
);
|
|
63797
|
-
return matchedPivotKey ?? canonicalField;
|
|
63798
|
-
};
|
|
63799
|
-
const yAxisFromAggregations = !withResolvedXAxis.pivot?.columnField && aggregations.length > 0 ? aggregations.map((aggregation) => {
|
|
63800
|
-
const canonicalField = getAggregationFieldKey(
|
|
63801
|
-
aggregation,
|
|
63802
|
-
hasMultipleAggregations
|
|
63803
|
-
);
|
|
63804
|
-
const field = resolveAggregationAxisFieldForDisplay(
|
|
63805
|
-
aggregation,
|
|
63806
|
-
canonicalField
|
|
63807
|
-
);
|
|
63808
|
-
if (!field) return null;
|
|
63809
|
-
return {
|
|
63810
|
-
field,
|
|
63811
|
-
label: buildAggregationLabel(
|
|
63812
|
-
aggregation,
|
|
63813
|
-
withResolvedXAxis,
|
|
63814
|
-
resolveTableLabel
|
|
63815
|
-
),
|
|
63816
|
-
format: resolveYAxisFormat(field, aggregation)
|
|
63817
|
-
};
|
|
63818
|
-
}).filter((axis) => Boolean(axis)) : [];
|
|
63819
|
-
const mappedValueFields = new Set(
|
|
63820
|
-
yAxisFromAggregations.map((axis) => axis.field)
|
|
63821
|
-
);
|
|
63822
|
-
const yAxisFromPivotRowFields = pivotValueFields.filter((field) => !mappedValueFields.has(field)).map((field) => {
|
|
63823
|
-
const aggregation = findAggregationForFieldStrict(field, aggregations);
|
|
63824
|
-
const cleanedBaseField = aggregation?.aggregationType && hasMultipleAggregations ? trimAggregationSuffix(field, String(aggregation.aggregationType)) : field;
|
|
63825
|
-
const displayBase = aggregation?.valueField && withResolvedXAxis.pivot?.columnField ? trimAggregationSuffix(cleanedBaseField, aggregation.valueField) : cleanedBaseField;
|
|
63826
|
-
const displayBaseField = normalizePivotColumnDisplayValue(displayBase);
|
|
63827
|
-
const aggregationLabel = aggregation ? buildAggregationLabel(
|
|
63828
|
-
aggregation,
|
|
63829
|
-
withResolvedXAxis,
|
|
63830
|
-
resolveTableLabel
|
|
63831
|
-
) : void 0;
|
|
63832
|
-
const isMeasureNamedSeries = Boolean(aggregation?.valueField) && displayBaseField === String(aggregation?.valueField ?? "").trim();
|
|
63833
|
-
let pivotColumnSeriesLabel = displayBaseField;
|
|
63834
|
-
if (withResolvedXAxis.pivot?.columnField && aggregation && aggregationLabel) {
|
|
63835
|
-
if (isMeasureNamedSeries) {
|
|
63836
|
-
pivotColumnSeriesLabel = aggregationLabel;
|
|
63837
|
-
} else if (aggregationLabel !== displayBaseField) {
|
|
63838
|
-
const alreadyCombined = String(displayBaseField).endsWith(` \xB7 ${aggregationLabel}`) || String(displayBaseField).endsWith(` \u2014 ${aggregationLabel}`) || String(displayBaseField).endsWith(` (${aggregationLabel})`);
|
|
63839
|
-
pivotColumnSeriesLabel = alreadyCombined ? displayBaseField : `${displayBaseField} \xB7 ${aggregationLabel}`;
|
|
63840
|
-
}
|
|
63841
|
-
}
|
|
63842
|
-
const label = aggregation ? withResolvedXAxis.pivot?.columnField ? pivotColumnSeriesLabel : aggregationLabel ?? displayBaseField : toTitleCaseLabel(String(field ?? ""));
|
|
63843
|
-
return {
|
|
63844
|
-
field,
|
|
63845
|
-
label,
|
|
63846
|
-
format: resolveYAxisFormat(field, aggregation)
|
|
63847
|
-
};
|
|
63848
|
-
});
|
|
63849
|
-
const supplementalYAxisFromPivotRowFields = yAxisFromAggregations.length > 0 ? yAxisFromPivotRowFields.filter(
|
|
63850
|
-
(axis) => Boolean(findAggregationForFieldStrict(axis.field, aggregations))
|
|
63851
|
-
) : yAxisFromPivotRowFields;
|
|
63852
|
-
const yAxisFields = yAxisFromAggregations.length > 0 ? [...yAxisFromAggregations, ...supplementalYAxisFromPivotRowFields] : supplementalYAxisFromPivotRowFields.length > 0 ? supplementalYAxisFromPivotRowFields : (withResolvedXAxis.pivotColumns ?? []).slice(1).map((column) => ({
|
|
63853
|
-
field: column.field,
|
|
63854
|
-
label: column.label ?? column.field,
|
|
63855
|
-
format: column.format ?? yAxisFallbackFormat
|
|
63856
|
-
}));
|
|
63938
|
+
const pivotRowFields = pivotDisplayFieldKeys(withResolvedXAxis);
|
|
63939
|
+
const pivotValueFields = pivotValueFieldKeys(withResolvedXAxis);
|
|
63940
|
+
const yAxisFields = withResolvedXAxis.yAxisFields ?? [];
|
|
63857
63941
|
const knownColumnsByField = new Map(
|
|
63858
63942
|
[
|
|
63859
63943
|
...withResolvedXAxis.pivotColumns ?? [],
|
|
@@ -63874,21 +63958,21 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63874
63958
|
};
|
|
63875
63959
|
}) : withResolvedXAxis.columns ?? [];
|
|
63876
63960
|
const isPivotTableChart = String(withResolvedXAxis.chartType ?? "").toLowerCase() === "table" && Boolean(withResolvedXAxis.pivot);
|
|
63877
|
-
const
|
|
63961
|
+
const savedPivotTableColumns = isPivotTableChart && Array.isArray(withResolvedXAxis.pivotColumns) && withResolvedXAxis.pivotColumns.length > 0 ? withResolvedXAxis.pivotColumns : withResolvedXAxis.columns;
|
|
63878
63962
|
const pivotTableDisplayColumns = isPivotTableChart && pivotColumnFields.length > 0 ? normalizedPivotColumns.map((col) => {
|
|
63879
|
-
const
|
|
63880
|
-
|
|
63963
|
+
const savedColumn = getPivotTableReportColumn(
|
|
63964
|
+
savedPivotTableColumns,
|
|
63881
63965
|
aggregations,
|
|
63882
63966
|
pivotRowKey(withResolvedXAxis) || withResolvedXAxis.pivot?.rowField,
|
|
63883
63967
|
col.field
|
|
63884
63968
|
);
|
|
63885
|
-
if (!
|
|
63969
|
+
if (!savedColumn) return col;
|
|
63886
63970
|
const next = {
|
|
63887
63971
|
...col,
|
|
63888
|
-
format:
|
|
63972
|
+
format: savedColumn.format ?? col.format
|
|
63889
63973
|
};
|
|
63890
|
-
if (
|
|
63891
|
-
next.inferFormat =
|
|
63974
|
+
if (savedColumn.inferFormat !== void 0) {
|
|
63975
|
+
next.inferFormat = savedColumn.inferFormat;
|
|
63892
63976
|
}
|
|
63893
63977
|
return next;
|
|
63894
63978
|
}) : normalizedPivotColumns;
|
|
@@ -63949,100 +64033,10 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63949
64033
|
yAxisFields
|
|
63950
64034
|
};
|
|
63951
64035
|
}
|
|
63952
|
-
function
|
|
63953
|
-
const aggregations = getPivotAggregations(report);
|
|
63954
|
-
const hasMultipleAggregations = aggregations.length > 1;
|
|
63955
|
-
return aggregations.map((aggregation) => {
|
|
63956
|
-
const field = getAggregationFieldKey(
|
|
63957
|
-
aggregation,
|
|
63958
|
-
hasMultipleAggregations
|
|
63959
|
-
);
|
|
63960
|
-
if (!field) return null;
|
|
63961
|
-
return {
|
|
63962
|
-
field,
|
|
63963
|
-
label: buildAggregationLabel(aggregation, report, resolveTableLabel),
|
|
63964
|
-
format: getYAxisFormatFromAggregation(aggregation)
|
|
63965
|
-
};
|
|
63966
|
-
}).filter((axis) => Boolean(axis));
|
|
63967
|
-
}
|
|
63968
|
-
function mergePivotColumnAxisFieldsWithMapped(aggregationAxisFields, mapped) {
|
|
63969
|
-
const byField = /* @__PURE__ */ new Map();
|
|
63970
|
-
for (const y of mapped) {
|
|
63971
|
-
const f = String(y.field ?? "").trim();
|
|
63972
|
-
if (f) byField.set(f, y);
|
|
63973
|
-
}
|
|
63974
|
-
return aggregationAxisFields.map((axis) => {
|
|
63975
|
-
const f = String(axis.field ?? "").trim();
|
|
63976
|
-
const mappedAxis = f ? byField.get(f) : void 0;
|
|
63977
|
-
return mappedAxis ?? axis;
|
|
63978
|
-
});
|
|
63979
|
-
}
|
|
63980
|
-
function normalizePivotChartForAxisControls(chart, reportId, resolveTableLabel) {
|
|
63981
|
-
if (!chart?.pivot?.columnField) return chart;
|
|
63982
|
-
const aggregations = getPivotAggregations(chart);
|
|
63983
|
-
if (aggregations.length === 0) return chart;
|
|
63984
|
-
const aggregationAxisFields = buildPivotAggregationAxisFields(
|
|
63985
|
-
chart,
|
|
63986
|
-
resolveTableLabel
|
|
63987
|
-
);
|
|
63988
|
-
if (aggregationAxisFields.length === 0) return chart;
|
|
63989
|
-
const aggregationAxisByIdentity = /* @__PURE__ */ new Map();
|
|
63990
|
-
for (const aggregationAxisField of aggregationAxisFields) {
|
|
63991
|
-
const aggregation = findAggregationForFieldStrict(
|
|
63992
|
-
aggregationAxisField.field,
|
|
63993
|
-
aggregations
|
|
63994
|
-
);
|
|
63995
|
-
const aggregationIdentity = getAggregationIdentityKey(aggregation);
|
|
63996
|
-
if (!aggregationIdentity || aggregationAxisByIdentity.has(aggregationIdentity)) {
|
|
63997
|
-
continue;
|
|
63998
|
-
}
|
|
63999
|
-
aggregationAxisByIdentity.set(aggregationIdentity, aggregationAxisField);
|
|
64000
|
-
}
|
|
64001
|
-
const mappedExistingYAxisFields = [];
|
|
64002
|
-
const seenMappedFields = /* @__PURE__ */ new Set();
|
|
64003
|
-
for (const existingYAxisField of chart.yAxisFields ?? []) {
|
|
64004
|
-
const aggregation = findAggregationForFieldStrict(
|
|
64005
|
-
existingYAxisField.field,
|
|
64006
|
-
aggregations
|
|
64007
|
-
);
|
|
64008
|
-
const aggregationIdentity = getAggregationIdentityKey(aggregation);
|
|
64009
|
-
if (!aggregationIdentity) continue;
|
|
64010
|
-
const mappedAggregationAxis = aggregationAxisByIdentity.get(aggregationIdentity);
|
|
64011
|
-
if (!mappedAggregationAxis) continue;
|
|
64012
|
-
if (seenMappedFields.has(mappedAggregationAxis.field)) continue;
|
|
64013
|
-
seenMappedFields.add(mappedAggregationAxis.field);
|
|
64014
|
-
mappedExistingYAxisFields.push({
|
|
64015
|
-
field: mappedAggregationAxis.field,
|
|
64016
|
-
label: String(existingYAxisField.label ?? "").trim() || mappedAggregationAxis.label,
|
|
64017
|
-
format: toAxisFormat(
|
|
64018
|
-
existingYAxisField.format,
|
|
64019
|
-
mappedAggregationAxis.format
|
|
64020
|
-
)
|
|
64021
|
-
});
|
|
64022
|
-
}
|
|
64023
|
-
let yAxisFields;
|
|
64024
|
-
if (aggregations.length > 1) {
|
|
64025
|
-
const resolvedReportId = String(reportId ?? chart.id ?? "").trim();
|
|
64026
|
-
if (LEGACY_SINGLE_Y_AXIS_COLUMN_PIVOT_REPORT_IDS.has(resolvedReportId)) {
|
|
64027
|
-
yAxisFields = mappedExistingYAxisFields.length > 0 ? mappedExistingYAxisFields : [aggregationAxisFields[0]];
|
|
64028
|
-
} else {
|
|
64029
|
-
yAxisFields = mappedExistingYAxisFields.length === 0 || mappedExistingYAxisFields.length < aggregationAxisFields.length ? mergePivotColumnAxisFieldsWithMapped(
|
|
64030
|
-
aggregationAxisFields,
|
|
64031
|
-
mappedExistingYAxisFields
|
|
64032
|
-
) : mappedExistingYAxisFields;
|
|
64033
|
-
}
|
|
64034
|
-
} else {
|
|
64035
|
-
yAxisFields = mappedExistingYAxisFields.length > 0 ? mappedExistingYAxisFields : [aggregationAxisFields[0]];
|
|
64036
|
-
}
|
|
64037
|
-
return {
|
|
64038
|
-
...chart,
|
|
64039
|
-
yAxisFields
|
|
64040
|
-
};
|
|
64041
|
-
}
|
|
64042
|
-
function buildPivotColumnPivotTableFormattingColumns(pivot, chart, resolveTableLabel) {
|
|
64036
|
+
function buildPivotTableColumns(pivot, chart, resolveTableLabel) {
|
|
64043
64037
|
if (!pivot) return null;
|
|
64044
|
-
const
|
|
64045
|
-
const aggregations = getPivotAggregations(
|
|
64038
|
+
const chartWithPivot = chart ? { ...chart, pivot } : { pivot };
|
|
64039
|
+
const aggregations = getPivotAggregations(chartWithPivot);
|
|
64046
64040
|
if (aggregations.length === 0) return null;
|
|
64047
64041
|
const hasMultipleAggregations = aggregations.length > 1;
|
|
64048
64042
|
const rowField = String(pivot.rowField ?? "").trim();
|
|
@@ -64076,7 +64070,7 @@ function buildPivotColumnPivotTableFormattingColumns(pivot, chart, resolveTableL
|
|
|
64076
64070
|
field: fieldKey,
|
|
64077
64071
|
label: buildAggregationLabel(
|
|
64078
64072
|
aggregation,
|
|
64079
|
-
|
|
64073
|
+
chartWithPivot,
|
|
64080
64074
|
resolveTableLabel
|
|
64081
64075
|
)
|
|
64082
64076
|
});
|
|
@@ -64103,19 +64097,6 @@ function mergePivotColumnSeriesLabelWithUserEdit(normalizedLabel, userRowLabel,
|
|
|
64103
64097
|
}
|
|
64104
64098
|
return user;
|
|
64105
64099
|
}
|
|
64106
|
-
function applySingleResolvedYAxisFormatToPivotDisplay(normalizedPivotYAxisFields, resolvedYAxisFields) {
|
|
64107
|
-
if (resolvedYAxisFields.length !== 1) return normalizedPivotYAxisFields;
|
|
64108
|
-
const only = resolvedYAxisFields[0];
|
|
64109
|
-
return normalizedPivotYAxisFields.map((axis) => ({
|
|
64110
|
-
...axis,
|
|
64111
|
-
label: mergePivotColumnSeriesLabelWithUserEdit(
|
|
64112
|
-
String(axis.label ?? "").trim(),
|
|
64113
|
-
only.label,
|
|
64114
|
-
String(axis.field ?? "").trim() || void 0
|
|
64115
|
-
),
|
|
64116
|
-
format: toAxisFormat(only.format, axis.format)
|
|
64117
|
-
}));
|
|
64118
|
-
}
|
|
64119
64100
|
function mergeChartColumnFormatsFromYAxisFields(columns, yAxisFields) {
|
|
64120
64101
|
if (!columns?.length || !yAxisFields?.length) return columns;
|
|
64121
64102
|
const formatByField = /* @__PURE__ */ new Map();
|
|
@@ -64173,71 +64154,6 @@ function mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
|
64173
64154
|
return { ...c, label: yl };
|
|
64174
64155
|
});
|
|
64175
64156
|
}
|
|
64176
|
-
function mapResolvedPivotYAxisFieldsForDisplay({
|
|
64177
|
-
chart,
|
|
64178
|
-
resolvedYAxisFields
|
|
64179
|
-
}) {
|
|
64180
|
-
if (!chart.pivot?.columnField) return resolvedYAxisFields;
|
|
64181
|
-
const normalizedPivotYAxisFields = chart.yAxisFields ?? [];
|
|
64182
|
-
if (normalizedPivotYAxisFields.length === 0) return resolvedYAxisFields;
|
|
64183
|
-
const aggregations = getPivotAggregations(chart);
|
|
64184
|
-
if (aggregations.length === 0) {
|
|
64185
|
-
return applySingleResolvedYAxisFormatToPivotDisplay(
|
|
64186
|
-
normalizedPivotYAxisFields,
|
|
64187
|
-
resolvedYAxisFields
|
|
64188
|
-
);
|
|
64189
|
-
}
|
|
64190
|
-
const selectedAggregationByIdentity = /* @__PURE__ */ new Map();
|
|
64191
|
-
for (const yAxisField of resolvedYAxisFields ?? []) {
|
|
64192
|
-
const aggregation = findAggregationForFieldStrict(
|
|
64193
|
-
yAxisField.field,
|
|
64194
|
-
aggregations
|
|
64195
|
-
);
|
|
64196
|
-
const aggregationIdentity = getAggregationIdentityKey(aggregation);
|
|
64197
|
-
if (!aggregationIdentity) continue;
|
|
64198
|
-
selectedAggregationByIdentity.set(aggregationIdentity, yAxisField);
|
|
64199
|
-
}
|
|
64200
|
-
if (selectedAggregationByIdentity.size === 0) {
|
|
64201
|
-
return applySingleResolvedYAxisFormatToPivotDisplay(
|
|
64202
|
-
normalizedPivotYAxisFields,
|
|
64203
|
-
resolvedYAxisFields
|
|
64204
|
-
);
|
|
64205
|
-
}
|
|
64206
|
-
const mappedYAxisFields = [];
|
|
64207
|
-
const seenMappedFields = /* @__PURE__ */ new Set();
|
|
64208
|
-
for (const normalizedYAxisField of normalizedPivotYAxisFields) {
|
|
64209
|
-
const aggregation = findAggregationForFieldStrict(
|
|
64210
|
-
normalizedYAxisField.field,
|
|
64211
|
-
aggregations
|
|
64212
|
-
);
|
|
64213
|
-
const aggregationIdentity = getAggregationIdentityKey(aggregation);
|
|
64214
|
-
if (!aggregationIdentity) continue;
|
|
64215
|
-
const selectedAggregationAxis = selectedAggregationByIdentity.get(aggregationIdentity);
|
|
64216
|
-
if (!selectedAggregationAxis) continue;
|
|
64217
|
-
const field = String(normalizedYAxisField.field ?? "").trim();
|
|
64218
|
-
if (!field || seenMappedFields.has(field)) continue;
|
|
64219
|
-
seenMappedFields.add(field);
|
|
64220
|
-
mappedYAxisFields.push({
|
|
64221
|
-
...normalizedYAxisField,
|
|
64222
|
-
label: mergePivotColumnSeriesLabelWithUserEdit(
|
|
64223
|
-
String(normalizedYAxisField.label ?? "").trim(),
|
|
64224
|
-
selectedAggregationAxis.label,
|
|
64225
|
-
field || void 0
|
|
64226
|
-
),
|
|
64227
|
-
format: toAxisFormat(
|
|
64228
|
-
selectedAggregationAxis.format,
|
|
64229
|
-
normalizedYAxisField.format
|
|
64230
|
-
)
|
|
64231
|
-
});
|
|
64232
|
-
}
|
|
64233
|
-
if (mappedYAxisFields.length > 0) {
|
|
64234
|
-
return mappedYAxisFields;
|
|
64235
|
-
}
|
|
64236
|
-
return applySingleResolvedYAxisFormatToPivotDisplay(
|
|
64237
|
-
normalizedPivotYAxisFields,
|
|
64238
|
-
resolvedYAxisFields
|
|
64239
|
-
);
|
|
64240
|
-
}
|
|
64241
64157
|
function encodeColumnOptionValue(table, field) {
|
|
64242
64158
|
if (!table || !table.trim()) return field;
|
|
64243
64159
|
return `${table}_${field}`;
|
|
@@ -66687,7 +66603,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66687
66603
|
useEffect33(() => {
|
|
66688
66604
|
setTableColumnsEditedSignature(null);
|
|
66689
66605
|
}, [effectiveReportId]);
|
|
66690
|
-
const [
|
|
66606
|
+
const [axisEdits, setAxisEdits] = useState42({});
|
|
66691
66607
|
const [chartVisibilityOverrides, setChartVisibilityOverrides] = useState42({});
|
|
66692
66608
|
const [chartSortOverride, setChartSortOverride] = useState42(void 0);
|
|
66693
66609
|
const [client] = useContext37(ClientContext);
|
|
@@ -66819,7 +66735,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66819
66735
|
}
|
|
66820
66736
|
}, [createdReportBootstrap?.reportId, propReportId]);
|
|
66821
66737
|
useEffect33(() => {
|
|
66822
|
-
|
|
66738
|
+
setAxisEdits({});
|
|
66823
66739
|
setChartVisibilityOverrides({});
|
|
66824
66740
|
setChartSortOverride(void 0);
|
|
66825
66741
|
}, [effectiveReportId]);
|
|
@@ -69821,20 +69737,18 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69821
69737
|
chartPivotHydrationEpoch
|
|
69822
69738
|
]);
|
|
69823
69739
|
const baseChart = useMemo33(
|
|
69824
|
-
() => normalizePivotChartForDisplay(chartData
|
|
69825
|
-
[chartData
|
|
69740
|
+
() => normalizePivotChartForDisplay(chartData),
|
|
69741
|
+
[chartData]
|
|
69826
69742
|
);
|
|
69827
|
-
const
|
|
69828
|
-
if (!
|
|
69829
|
-
|
|
69830
|
-
|
|
69831
|
-
|
|
69832
|
-
|
|
69833
|
-
|
|
69834
|
-
|
|
69835
|
-
|
|
69836
|
-
return baseChart;
|
|
69837
|
-
}, [baseChart, chartData, effectiveReportId, resolveTableDisplayLabel]);
|
|
69743
|
+
const yAxisResolved = useMemo33(() => {
|
|
69744
|
+
if (!baseChart) return { measures: [], series: [] };
|
|
69745
|
+
return resolveReportYAxis(
|
|
69746
|
+
baseChart,
|
|
69747
|
+
axisEdits.yAxisFields,
|
|
69748
|
+
resolveTableDisplayLabel
|
|
69749
|
+
);
|
|
69750
|
+
}, [baseChart, axisEdits.yAxisFields, resolveTableDisplayLabel]);
|
|
69751
|
+
const chartAxesBaseChart = baseChart;
|
|
69838
69752
|
const chartAxisOptions = useMemo33(() => {
|
|
69839
69753
|
if (!chartAxesBaseChart) return [];
|
|
69840
69754
|
const optionsByField = /* @__PURE__ */ new Map();
|
|
@@ -69853,7 +69767,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69853
69767
|
for (const column of chartAxesBaseChart.columns ?? []) {
|
|
69854
69768
|
registerOption(column.field, column.label, column.format);
|
|
69855
69769
|
}
|
|
69856
|
-
for (const yAxis2 of
|
|
69770
|
+
for (const yAxis2 of yAxisResolved.measures) {
|
|
69857
69771
|
registerOption(yAxis2.field, yAxis2.label, yAxis2.format);
|
|
69858
69772
|
if (yAxis2.format) {
|
|
69859
69773
|
const existing = optionsByField.get(yAxis2.field);
|
|
@@ -69865,18 +69779,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69865
69779
|
}
|
|
69866
69780
|
}
|
|
69867
69781
|
}
|
|
69868
|
-
if (chartAxesBaseChart.pivot?.columnField) {
|
|
69869
|
-
for (const aggregationAxis of buildPivotAggregationAxisFields(
|
|
69870
|
-
chartAxesBaseChart,
|
|
69871
|
-
resolveTableDisplayLabel
|
|
69872
|
-
)) {
|
|
69873
|
-
registerOption(
|
|
69874
|
-
aggregationAxis.field,
|
|
69875
|
-
aggregationAxis.label,
|
|
69876
|
-
aggregationAxis.format
|
|
69877
|
-
);
|
|
69878
|
-
}
|
|
69879
|
-
}
|
|
69880
69782
|
const xField = String(chartAxesBaseChart.xAxisField ?? "").trim();
|
|
69881
69783
|
const savedXFormat = String(chartAxesBaseChart.xAxisFormat ?? "").trim();
|
|
69882
69784
|
registerOption(
|
|
@@ -69894,7 +69796,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69894
69796
|
}
|
|
69895
69797
|
}
|
|
69896
69798
|
return Array.from(optionsByField.values());
|
|
69897
|
-
}, [chartAxesBaseChart,
|
|
69799
|
+
}, [chartAxesBaseChart, yAxisResolved.measures]);
|
|
69898
69800
|
const chartAxisOptionByField = useMemo33(() => {
|
|
69899
69801
|
const optionsByField = /* @__PURE__ */ new Map();
|
|
69900
69802
|
for (const option of chartAxisOptions) {
|
|
@@ -69939,19 +69841,15 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69939
69841
|
const pivot = chartAxesBaseChart.pivot;
|
|
69940
69842
|
const pivotRowField = String(pivot?.rowField ?? "").trim();
|
|
69941
69843
|
if (pivot && !pivotRowField) {
|
|
69942
|
-
const
|
|
69943
|
-
|
|
69944
|
-
resolveTableDisplayLabel
|
|
69945
|
-
);
|
|
69946
|
-
if (aggAxis.length > 0) {
|
|
69947
|
-
const allowed = new Set(aggAxis.map((a) => a.field));
|
|
69844
|
+
const allowed = new Set(yAxisResolved.measures.map((axis) => axis.field));
|
|
69845
|
+
if (allowed.size > 0) {
|
|
69948
69846
|
eligible = eligible.filter((o) => allowed.has(o.value));
|
|
69949
69847
|
}
|
|
69950
69848
|
}
|
|
69951
69849
|
const merged = new Map(
|
|
69952
69850
|
eligible.map((o) => [o.value, o])
|
|
69953
69851
|
);
|
|
69954
|
-
for (const yAxisField of
|
|
69852
|
+
for (const yAxisField of yAxisResolved.measures) {
|
|
69955
69853
|
const field = String(yAxisField?.field ?? "").trim();
|
|
69956
69854
|
if (!field || merged.has(field)) continue;
|
|
69957
69855
|
const opt = chartAxisOptionByField.get(field);
|
|
@@ -69962,8 +69860,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69962
69860
|
chartAxesBaseChart,
|
|
69963
69861
|
chartAxisOptionByField,
|
|
69964
69862
|
chartAxisOptions,
|
|
69965
|
-
|
|
69966
|
-
|
|
69863
|
+
schemaColumnOptions,
|
|
69864
|
+
yAxisResolved.measures
|
|
69967
69865
|
]);
|
|
69968
69866
|
const normalizedChartXAxisOptions = useMemo33(() => {
|
|
69969
69867
|
return xAxisOptions.map((option) => ({
|
|
@@ -69979,34 +69877,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69979
69877
|
format: String(option.format ?? "").trim()
|
|
69980
69878
|
}));
|
|
69981
69879
|
}, [yAxisOptions]);
|
|
69982
|
-
const
|
|
69983
|
-
if (
|
|
69984
|
-
|
|
69985
|
-
const field = String(yAxisFieldRaw?.field ?? "").trim();
|
|
69986
|
-
if (!field) return null;
|
|
69987
|
-
const option = chartAxisOptionByField.get(field);
|
|
69988
|
-
if (!option) return null;
|
|
69989
|
-
const rawLabel = String(yAxisFieldRaw?.label ?? "").trim() || option.label;
|
|
69990
|
-
const label = rawLabel === field ? toTitleCaseLabel(field) : rawLabel;
|
|
69991
|
-
const format9 = toAxisFormat(yAxisFieldRaw?.format, option.format);
|
|
69992
|
-
return {
|
|
69993
|
-
field,
|
|
69994
|
-
label,
|
|
69995
|
-
format: format9
|
|
69996
|
-
};
|
|
69997
|
-
};
|
|
69998
|
-
const fallbackYAxisFields = (chartAxesBaseChart.yAxisFields ?? []).map((yAxisField) => normalizeYAxisField(yAxisField)).filter(
|
|
69999
|
-
(yAxisField) => Boolean(yAxisField)
|
|
70000
|
-
);
|
|
70001
|
-
const requestedYAxisFields = Array.isArray(chartAxisEdits.yAxisFields) ? chartAxisEdits.yAxisFields : fallbackYAxisFields;
|
|
70002
|
-
const normalizedRequestedYAxisFields = requestedYAxisFields.map((yAxisField) => normalizeYAxisField(yAxisField)).filter(
|
|
70003
|
-
(yAxisField) => Boolean(yAxisField)
|
|
70004
|
-
);
|
|
70005
|
-
if (normalizedRequestedYAxisFields.length > 0) {
|
|
70006
|
-
return normalizedRequestedYAxisFields;
|
|
70007
|
-
}
|
|
70008
|
-
if (fallbackYAxisFields.length > 0) {
|
|
70009
|
-
return fallbackYAxisFields;
|
|
69880
|
+
const yAxisMeasures = useMemo33(() => {
|
|
69881
|
+
if (yAxisResolved.measures.length > 0) {
|
|
69882
|
+
return yAxisResolved.measures;
|
|
70010
69883
|
}
|
|
70011
69884
|
const fallbackOption = chartAxisOptions[0];
|
|
70012
69885
|
if (!fallbackOption) return [];
|
|
@@ -70017,12 +69890,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70017
69890
|
format: fallbackOption.format
|
|
70018
69891
|
}
|
|
70019
69892
|
];
|
|
70020
|
-
}, [
|
|
70021
|
-
chartAxesBaseChart,
|
|
70022
|
-
chartAxisEdits.yAxisFields,
|
|
70023
|
-
chartAxisOptionByField,
|
|
70024
|
-
chartAxisOptions
|
|
70025
|
-
]);
|
|
69893
|
+
}, [chartAxisOptions, yAxisResolved.measures]);
|
|
70026
69894
|
const resolvedXAxisField = useMemo33(() => {
|
|
70027
69895
|
if (!chartAxesBaseChart) return "";
|
|
70028
69896
|
const chartType2 = String(chartAxesBaseChart.chartType ?? "").toLowerCase();
|
|
@@ -70037,7 +69905,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70037
69905
|
return pivotRowField;
|
|
70038
69906
|
}
|
|
70039
69907
|
}
|
|
70040
|
-
const requestedXAxisField = String(
|
|
69908
|
+
const requestedXAxisField = String(axisEdits.xAxisField ?? "").trim();
|
|
70041
69909
|
if (requestedXAxisField && chartAxisOptionByField.has(requestedXAxisField)) {
|
|
70042
69910
|
return requestedXAxisField;
|
|
70043
69911
|
}
|
|
@@ -70045,16 +69913,16 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70045
69913
|
if (baseXAxisField && chartAxisOptionByField.has(baseXAxisField)) {
|
|
70046
69914
|
return baseXAxisField;
|
|
70047
69915
|
}
|
|
70048
|
-
return
|
|
69916
|
+
return yAxisMeasures[0]?.field ?? chartAxisOptions[0]?.value ?? "";
|
|
70049
69917
|
}, [
|
|
70050
69918
|
chartAxesBaseChart,
|
|
70051
|
-
|
|
69919
|
+
axisEdits.xAxisField,
|
|
70052
69920
|
chartAxisOptionByField,
|
|
70053
69921
|
chartAxisOptions,
|
|
70054
|
-
|
|
69922
|
+
yAxisMeasures
|
|
70055
69923
|
]);
|
|
70056
69924
|
const xAxisMetadataField = String(
|
|
70057
|
-
|
|
69925
|
+
axisEdits.xAxisField ?? chartData?.xAxisField ?? ""
|
|
70058
69926
|
).trim();
|
|
70059
69927
|
const xAxisMetadataMatchesResolvedField = !xAxisMetadataField || xAxisMetadataField === resolvedXAxisField;
|
|
70060
69928
|
const resolvedXAxisFormat = useMemo33(() => {
|
|
@@ -70062,7 +69930,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70062
69930
|
return "string";
|
|
70063
69931
|
}
|
|
70064
69932
|
let defaultFormat = toAxisFormat(
|
|
70065
|
-
chartAxisOptionByField.get(resolvedXAxisField)?.format ?? chartAxesBaseChart.xAxisFormat ??
|
|
69933
|
+
chartAxisOptionByField.get(resolvedXAxisField)?.format ?? chartAxesBaseChart.xAxisFormat ?? yAxisMeasures[0]?.format,
|
|
70066
69934
|
"string"
|
|
70067
69935
|
);
|
|
70068
69936
|
const bucketFormat = resolvePivotDateBucketXAxisFormat(
|
|
@@ -70070,16 +69938,16 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70070
69938
|
resolvedXAxisField
|
|
70071
69939
|
);
|
|
70072
69940
|
if (bucketFormat) return bucketFormat;
|
|
70073
|
-
if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && (!xAxisMetadataMatchesResolvedField ||
|
|
69941
|
+
if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && (!xAxisMetadataMatchesResolvedField || axisEdits.xAxisFormat === void 0)) {
|
|
70074
69942
|
defaultFormat = "string";
|
|
70075
69943
|
}
|
|
70076
|
-
return xAxisMetadataMatchesResolvedField &&
|
|
69944
|
+
return xAxisMetadataMatchesResolvedField && axisEdits.xAxisFormat !== void 0 ? toAxisFormat(axisEdits.xAxisFormat, defaultFormat) : defaultFormat;
|
|
70077
69945
|
}, [
|
|
70078
69946
|
chartAxesBaseChart,
|
|
70079
|
-
|
|
69947
|
+
axisEdits.xAxisFormat,
|
|
70080
69948
|
chartAxisOptionByField,
|
|
70081
69949
|
resolvedXAxisField,
|
|
70082
|
-
|
|
69950
|
+
yAxisMeasures,
|
|
70083
69951
|
xAxisMetadataMatchesResolvedField
|
|
70084
69952
|
]);
|
|
70085
69953
|
const resolvedXAxisLabel = useMemo33(() => {
|
|
@@ -70087,13 +69955,13 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70087
69955
|
const defaultXLabel = String(
|
|
70088
69956
|
xAxisMetadataMatchesResolvedField ? chartAxesBaseChart?.xAxisLabel ?? fieldLabel : fieldLabel
|
|
70089
69957
|
).trim();
|
|
70090
|
-
if (xAxisMetadataMatchesResolvedField &&
|
|
70091
|
-
return String(
|
|
69958
|
+
if (xAxisMetadataMatchesResolvedField && axisEdits.xAxisLabel !== void 0) {
|
|
69959
|
+
return String(axisEdits.xAxisLabel).trim();
|
|
70092
69960
|
}
|
|
70093
69961
|
return !defaultXLabel || defaultXLabel === resolvedXAxisField ? toTitleCaseLabel(resolvedXAxisField) : defaultXLabel;
|
|
70094
69962
|
}, [
|
|
70095
69963
|
chartAxesBaseChart?.xAxisLabel,
|
|
70096
|
-
|
|
69964
|
+
axisEdits.xAxisLabel,
|
|
70097
69965
|
chartAxisOptionByField,
|
|
70098
69966
|
resolvedXAxisField,
|
|
70099
69967
|
xAxisMetadataMatchesResolvedField
|
|
@@ -70123,7 +69991,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70123
69991
|
]);
|
|
70124
69992
|
const yAxis = useMemo33(
|
|
70125
69993
|
() => ({
|
|
70126
|
-
fields:
|
|
69994
|
+
fields: yAxisMeasures.map((yAxisField) => ({
|
|
70127
69995
|
field: yAxisField.field,
|
|
70128
69996
|
label: String(yAxisField.label ?? "").trim(),
|
|
70129
69997
|
format: axisFormatToSelectLabel(
|
|
@@ -70131,24 +69999,23 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70131
69999
|
)
|
|
70132
70000
|
}))
|
|
70133
70001
|
}),
|
|
70134
|
-
[
|
|
70002
|
+
[yAxisMeasures]
|
|
70135
70003
|
);
|
|
70136
|
-
const
|
|
70137
|
-
if (
|
|
70138
|
-
|
|
70139
|
-
|
|
70140
|
-
|
|
70141
|
-
|
|
70142
|
-
}, [baseChart, resolvedYAxisFields]);
|
|
70004
|
+
const yAxisSeries = useMemo33(() => {
|
|
70005
|
+
if (yAxisResolved.series.length > 0) {
|
|
70006
|
+
return yAxisResolved.series;
|
|
70007
|
+
}
|
|
70008
|
+
return yAxisMeasures;
|
|
70009
|
+
}, [yAxisMeasures, yAxisResolved.series]);
|
|
70143
70010
|
const chart = useMemo33(() => {
|
|
70144
70011
|
if (!baseChart) return void 0;
|
|
70145
70012
|
let columns2 = mergeChartColumnFormatsFromYAxisFields(
|
|
70146
70013
|
baseChart.columns,
|
|
70147
|
-
|
|
70014
|
+
yAxisSeries
|
|
70148
70015
|
);
|
|
70149
70016
|
if (String(baseChart.chartType ?? "").toLowerCase() === "table" && baseChart.pivot) {
|
|
70150
70017
|
const pivotAggregations2 = getPivotAggregations(baseChart);
|
|
70151
|
-
const hasCustomMeasureLabel =
|
|
70018
|
+
const hasCustomMeasureLabel = yAxisMeasures.some((axis) => {
|
|
70152
70019
|
const aggregation = findAggregationForFieldStrict(
|
|
70153
70020
|
axis.field,
|
|
70154
70021
|
pivotAggregations2
|
|
@@ -70161,7 +70028,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70161
70028
|
if (pivotAggregations2.length > 1 || hasCustomMeasureLabel) {
|
|
70162
70029
|
columns2 = mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
70163
70030
|
columns: columns2 ?? baseChart.columns,
|
|
70164
|
-
yAxisFields:
|
|
70031
|
+
yAxisFields: yAxisSeries,
|
|
70165
70032
|
pivotRowField: pivotRowKey(baseChart),
|
|
70166
70033
|
xAxisLabel: resolvedXAxisLabel
|
|
70167
70034
|
});
|
|
@@ -70188,7 +70055,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70188
70055
|
xAxisField: resolvedXAxisField,
|
|
70189
70056
|
xAxisFormat: resolvedXAxisFormat,
|
|
70190
70057
|
xAxisLabel: resolvedXAxisLabel,
|
|
70191
|
-
yAxisFields:
|
|
70058
|
+
yAxisFields: yAxisSeries,
|
|
70192
70059
|
columns: columns2 ?? baseChart.columns
|
|
70193
70060
|
};
|
|
70194
70061
|
}, [
|
|
@@ -70196,8 +70063,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70196
70063
|
resolvedXAxisField,
|
|
70197
70064
|
resolvedXAxisFormat,
|
|
70198
70065
|
resolvedXAxisLabel,
|
|
70199
|
-
|
|
70200
|
-
|
|
70066
|
+
yAxisMeasures,
|
|
70067
|
+
yAxisSeries
|
|
70201
70068
|
]);
|
|
70202
70069
|
const pivotDateFilterRangeCacheRef = useRef24({ key: "", min: null, max: null });
|
|
70203
70070
|
const filterOptions = useMemo33(() => {
|
|
@@ -70215,10 +70082,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70215
70082
|
if (rowField && isDateType(String(pivot?.rowFieldType ?? ""))) {
|
|
70216
70083
|
const field = pivot?.rowFieldTable ? `${pivot.rowFieldTable}.${rowField}` : rowField;
|
|
70217
70084
|
const chartBucket = dateBucket || pivot?.dateBucket || "month";
|
|
70218
|
-
const bucket = inBucketDateBucketForField(
|
|
70219
|
-
filtersForQueryBuilder.rules ?? [],
|
|
70220
|
-
field
|
|
70221
|
-
) ?? chartBucket;
|
|
70085
|
+
const bucket = inBucketDateBucketForField(filtersForQueryBuilder.rules ?? [], field) ?? chartBucket;
|
|
70222
70086
|
const cacheKey = `${String(effectiveReportId ?? "")}\0${field}\0${bucket}`;
|
|
70223
70087
|
if (pivotDateFilterRangeCacheRef.current.key !== cacheKey) {
|
|
70224
70088
|
pivotDateFilterRangeCacheRef.current = {
|
|
@@ -70351,8 +70215,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70351
70215
|
[chartForUi, resolvedChartSort]
|
|
70352
70216
|
);
|
|
70353
70217
|
const isPivotTableChart = String(chartType ?? "").toLowerCase() === "table" && Boolean(pivotState);
|
|
70354
|
-
const
|
|
70355
|
-
() => isPivotTableChart ?
|
|
70218
|
+
const pivotTableColumns = useMemo33(
|
|
70219
|
+
() => isPivotTableChart ? buildPivotTableColumns(
|
|
70356
70220
|
pivotState,
|
|
70357
70221
|
chart,
|
|
70358
70222
|
resolveTableDisplayLabel
|
|
@@ -70360,7 +70224,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70360
70224
|
[chart, isPivotTableChart, pivotState, resolveTableDisplayLabel]
|
|
70361
70225
|
);
|
|
70362
70226
|
const chartAxes = useMemo33(() => {
|
|
70363
|
-
const yAxisItems =
|
|
70227
|
+
const yAxisItems = yAxisMeasures.map(
|
|
70364
70228
|
(yAxisField, index) => ({
|
|
70365
70229
|
id: String(index),
|
|
70366
70230
|
field: yAxisField.field,
|
|
@@ -70368,7 +70232,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70368
70232
|
format: toAxisFormat(yAxisField.format, "string")
|
|
70369
70233
|
})
|
|
70370
70234
|
);
|
|
70371
|
-
const getCurrentYAxisFields = () =>
|
|
70235
|
+
const getCurrentYAxisFields = () => yAxisMeasures.map((yAxisField) => ({
|
|
70372
70236
|
field: yAxisField.field,
|
|
70373
70237
|
label: yAxisField.label,
|
|
70374
70238
|
format: toAxisFormat(yAxisField.format, "string")
|
|
@@ -70380,7 +70244,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70380
70244
|
options: xAxisOptions,
|
|
70381
70245
|
formatOptions: AXIS_FORMAT_OPTIONS,
|
|
70382
70246
|
update: (updates) => {
|
|
70383
|
-
|
|
70247
|
+
setAxisEdits((previousEdits) => {
|
|
70384
70248
|
const nextEdits = { ...previousEdits };
|
|
70385
70249
|
if (updates.field !== void 0) {
|
|
70386
70250
|
const requestedField = String(updates.field ?? "").trim();
|
|
@@ -70437,7 +70301,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70437
70301
|
resolvedXAxisFormat || "string"
|
|
70438
70302
|
)
|
|
70439
70303
|
};
|
|
70440
|
-
|
|
70304
|
+
setAxisEdits((previousEdits) => ({
|
|
70441
70305
|
...previousEdits,
|
|
70442
70306
|
yAxisFields: [...currentYAxisFields, nextYAxisField]
|
|
70443
70307
|
}));
|
|
@@ -70450,7 +70314,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70450
70314
|
if (index < 0 || index >= currentYAxisFields.length) return;
|
|
70451
70315
|
const nextYAxisFields = [...currentYAxisFields];
|
|
70452
70316
|
nextYAxisFields.splice(index, 1);
|
|
70453
|
-
|
|
70317
|
+
setAxisEdits((previousEdits) => ({
|
|
70454
70318
|
...previousEdits,
|
|
70455
70319
|
yAxisFields: nextYAxisFields
|
|
70456
70320
|
}));
|
|
@@ -70463,7 +70327,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70463
70327
|
newIndex
|
|
70464
70328
|
);
|
|
70465
70329
|
if (nextYAxisFields === currentYAxisFields) return;
|
|
70466
|
-
|
|
70330
|
+
setAxisEdits((previousEdits) => ({
|
|
70467
70331
|
...previousEdits,
|
|
70468
70332
|
yAxisFields: nextYAxisFields
|
|
70469
70333
|
}));
|
|
@@ -70492,7 +70356,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70492
70356
|
label: nextLabel,
|
|
70493
70357
|
format: nextFormat
|
|
70494
70358
|
};
|
|
70495
|
-
|
|
70359
|
+
setAxisEdits((previousEdits) => ({
|
|
70496
70360
|
...previousEdits,
|
|
70497
70361
|
yAxisFields: nextYAxisFields
|
|
70498
70362
|
}));
|
|
@@ -70504,7 +70368,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70504
70368
|
chartAxisOptionByField,
|
|
70505
70369
|
resolvedXAxisField,
|
|
70506
70370
|
resolvedXAxisFormat,
|
|
70507
|
-
|
|
70371
|
+
yAxisMeasures,
|
|
70508
70372
|
xAxisOptions,
|
|
70509
70373
|
yAxisOptions
|
|
70510
70374
|
]);
|
|
@@ -70536,7 +70400,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70536
70400
|
includeSelectedSchemaFallback: tableColumnsEditedSignature !== null
|
|
70537
70401
|
});
|
|
70538
70402
|
const pivotRowFieldForTable = pivotRowKey(sourceReport);
|
|
70539
|
-
const pivotRowTableUsesAxisFormat =
|
|
70403
|
+
const pivotRowTableUsesAxisFormat = axisEdits.xAxisFormat !== void 0;
|
|
70540
70404
|
const columns2 = String(chartType ?? "").toLowerCase() === "table" && sourceReport?.pivot && pivotRowFieldForTable && String(resolvedXAxisField ?? "").trim() === pivotRowFieldForTable ? mergedFromReport.map(
|
|
70541
70405
|
(column) => column.field === pivotRowFieldForTable ? {
|
|
70542
70406
|
...column,
|
|
@@ -70546,7 +70410,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70546
70410
|
) : mergedFromReport;
|
|
70547
70411
|
const pivotLabeledColumns = String(chartType ?? "").toLowerCase() === "table" && sourceReport?.pivot ? mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
70548
70412
|
columns: columns2,
|
|
70549
|
-
yAxisFields:
|
|
70413
|
+
yAxisFields: yAxisSeries,
|
|
70550
70414
|
pivotRowField: pivotRowKey(sourceReport),
|
|
70551
70415
|
xAxisLabel: resolvedXAxisLabel
|
|
70552
70416
|
}) ?? columns2 : columns2;
|
|
@@ -70622,14 +70486,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70622
70486
|
getPageOptions: () => getPageOptionsFromPageCount(paginationPageCount)
|
|
70623
70487
|
};
|
|
70624
70488
|
}, [
|
|
70625
|
-
|
|
70489
|
+
axisEdits.xAxisFormat,
|
|
70626
70490
|
chartType,
|
|
70627
70491
|
displayColumns,
|
|
70628
70492
|
effectiveReportBuilderTableNames,
|
|
70629
70493
|
resolvedXAxisField,
|
|
70630
70494
|
resolvedXAxisFormat,
|
|
70631
70495
|
resolvedXAxisLabel,
|
|
70632
|
-
|
|
70496
|
+
yAxisSeries,
|
|
70633
70497
|
scopedSchemaColumns,
|
|
70634
70498
|
sourceReport,
|
|
70635
70499
|
tableColumnsEditedSignature,
|
|
@@ -70654,11 +70518,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70654
70518
|
columnsOptions: tableFormattingColumnOptions,
|
|
70655
70519
|
hasTableDrivenColumnOrder
|
|
70656
70520
|
} = useMemo33(() => {
|
|
70657
|
-
if (
|
|
70521
|
+
if (pivotTableColumns) {
|
|
70658
70522
|
return getAllColumnOptions({
|
|
70659
70523
|
schemaColumnOptions,
|
|
70660
|
-
tableColumns:
|
|
70661
|
-
selectedColumnIds:
|
|
70524
|
+
tableColumns: pivotTableColumns.tableColumns,
|
|
70525
|
+
selectedColumnIds: pivotTableColumns.selectedColumnIds
|
|
70662
70526
|
});
|
|
70663
70527
|
}
|
|
70664
70528
|
if (isPivotTableChart) {
|
|
@@ -70679,7 +70543,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70679
70543
|
chart?.xAxisLabel,
|
|
70680
70544
|
columns,
|
|
70681
70545
|
isPivotTableChart,
|
|
70682
|
-
|
|
70546
|
+
pivotTableColumns,
|
|
70683
70547
|
schemaColumnOptions,
|
|
70684
70548
|
table.columns
|
|
70685
70549
|
]);
|
|
@@ -70701,8 +70565,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70701
70565
|
[tableDerivedColumnOrder]
|
|
70702
70566
|
);
|
|
70703
70567
|
const activeTableColumnIds = useMemo33(() => {
|
|
70704
|
-
if (
|
|
70705
|
-
return
|
|
70568
|
+
if (pivotTableColumns) {
|
|
70569
|
+
return pivotTableColumns.selectedColumnIds;
|
|
70706
70570
|
}
|
|
70707
70571
|
if (isPivotTableChart) {
|
|
70708
70572
|
return [];
|
|
@@ -70730,7 +70594,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70730
70594
|
columns,
|
|
70731
70595
|
hasTableDrivenColumnOrder,
|
|
70732
70596
|
isPivotTableChart,
|
|
70733
|
-
|
|
70597
|
+
pivotTableColumns,
|
|
70734
70598
|
tableDerivedColumnOrder,
|
|
70735
70599
|
tableFormattingColumnOptions
|
|
70736
70600
|
]);
|
|
@@ -70791,44 +70655,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70791
70655
|
});
|
|
70792
70656
|
}
|
|
70793
70657
|
const columnPivotMeasureFormatByAggregationField = /* @__PURE__ */ new Map();
|
|
70794
|
-
if (
|
|
70795
|
-
const
|
|
70796
|
-
|
|
70797
|
-
const
|
|
70798
|
-
|
|
70799
|
-
|
|
70800
|
-
const firstValueColumnFormat = String(
|
|
70801
|
-
(chart.columns ?? []).find(
|
|
70802
|
-
(c) => String(c.field ?? "").trim() !== rowField
|
|
70803
|
-
)?.format ?? ""
|
|
70804
|
-
).trim();
|
|
70805
|
-
for (let aggIdx = 0; aggIdx < aggregations.length; aggIdx++) {
|
|
70806
|
-
const agg = aggregations[aggIdx];
|
|
70807
|
-
const fieldKey = getAggregationFieldKey(agg, hasMultiple);
|
|
70808
|
-
if (!fieldKey) continue;
|
|
70809
|
-
let fmt = "";
|
|
70810
|
-
if (!hasMultiple) {
|
|
70811
|
-
fmt = String(chart.yAxisFields?.[0]?.format ?? "").trim() || firstValueColumnFormat;
|
|
70812
|
-
} else {
|
|
70813
|
-
for (const yAxisField of chart.yAxisFields ?? []) {
|
|
70814
|
-
const wf = String(yAxisField.field ?? "").trim();
|
|
70815
|
-
if (!wf) continue;
|
|
70816
|
-
const matched = findAggregationForFieldStrict(wf, aggregations);
|
|
70817
|
-
if (!matched || getAggregationIdentityKey(matched) !== getAggregationIdentityKey(agg)) {
|
|
70818
|
-
continue;
|
|
70819
|
-
}
|
|
70820
|
-
fmt = String(yAxisField.format ?? "").trim();
|
|
70821
|
-
break;
|
|
70822
|
-
}
|
|
70823
|
-
if (!fmt && sourceReport?.columns?.[aggIdx + 1]) {
|
|
70824
|
-
fmt = String(
|
|
70825
|
-
sourceReport.columns[aggIdx + 1]?.format ?? ""
|
|
70826
|
-
).trim();
|
|
70827
|
-
}
|
|
70828
|
-
}
|
|
70829
|
-
if (fmt) {
|
|
70830
|
-
columnPivotMeasureFormatByAggregationField.set(fieldKey, fmt);
|
|
70831
|
-
}
|
|
70658
|
+
if (pivotTableColumns) {
|
|
70659
|
+
for (const measure of yAxisResolved.measures) {
|
|
70660
|
+
const field = String(measure.field ?? "").trim();
|
|
70661
|
+
const fmt = String(measure.format ?? "").trim();
|
|
70662
|
+
if (field && fmt) {
|
|
70663
|
+
columnPivotMeasureFormatByAggregationField.set(field, fmt);
|
|
70832
70664
|
}
|
|
70833
70665
|
}
|
|
70834
70666
|
}
|
|
@@ -70879,11 +70711,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70879
70711
|
displayColumnById,
|
|
70880
70712
|
isPivotTableChart,
|
|
70881
70713
|
pivotState,
|
|
70882
|
-
|
|
70714
|
+
pivotTableColumns,
|
|
70883
70715
|
resolvedXAxisFormat,
|
|
70884
70716
|
resolvedXAxisLabel,
|
|
70885
|
-
|
|
70886
|
-
|
|
70717
|
+
tableFormatMerge,
|
|
70718
|
+
yAxisResolved.measures
|
|
70887
70719
|
]);
|
|
70888
70720
|
const tableColumnSettingsCoalesceRef = useRef24(
|
|
70889
70721
|
/* @__PURE__ */ new Map()
|
|
@@ -70905,8 +70737,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70905
70737
|
const field = String(option?.field ?? "").trim() || columnId;
|
|
70906
70738
|
const tableName = String(option?.tableName ?? "").trim();
|
|
70907
70739
|
const coercedFormat = coerceTableColumnFormatToAxisValue(format9);
|
|
70908
|
-
const
|
|
70909
|
-
const formatLabel =
|
|
70740
|
+
const isPivotDateRow = isPivotTableChart && field === pivotRowFieldForFormat && isDateType(pivotRowFieldType);
|
|
70741
|
+
const formatLabel = isPivotDateRow && coercedFormat === "string" ? "date" : axisFormatToSelectLabel(coercedFormat);
|
|
70910
70742
|
return {
|
|
70911
70743
|
id: columnId,
|
|
70912
70744
|
label: customLabel || defaultLabel,
|
|
@@ -71099,15 +70931,15 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71099
70931
|
chartAxesBaseChart
|
|
71100
70932
|
);
|
|
71101
70933
|
const clickedAgg = findAggregationForFieldStrict(pivotField, aggs);
|
|
71102
|
-
let nextY =
|
|
70934
|
+
let nextY = yAxisMeasures;
|
|
71103
70935
|
if (updates.format !== void 0) {
|
|
71104
70936
|
const axisFormatStr = tableColumnFormatFromUiSelection(
|
|
71105
70937
|
String(updates.format ?? "").trim()
|
|
71106
70938
|
);
|
|
71107
|
-
nextY =
|
|
70939
|
+
nextY = yAxisMeasures.map((y) => {
|
|
71108
70940
|
const yAgg = findAggregationForFieldStrict(y.field, aggs);
|
|
71109
70941
|
const same = clickedAgg && yAgg && getAggregationIdentityKey(clickedAgg) === getAggregationIdentityKey(yAgg);
|
|
71110
|
-
const singleBroadcast = Boolean(clickedAgg) &&
|
|
70942
|
+
const singleBroadcast = Boolean(clickedAgg) && yAxisMeasures.length === 1;
|
|
71111
70943
|
if (same || singleBroadcast) {
|
|
71112
70944
|
return {
|
|
71113
70945
|
...y,
|
|
@@ -71122,9 +70954,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71122
70954
|
nextY = nextY.map((y) => {
|
|
71123
70955
|
const yAgg = findAggregationForFieldStrict(y.field, aggs);
|
|
71124
70956
|
const same = clickedAgg && yAgg && getAggregationIdentityKey(clickedAgg) === getAggregationIdentityKey(yAgg);
|
|
71125
|
-
const singleBroadcast = Boolean(clickedAgg) &&
|
|
70957
|
+
const singleBroadcast = Boolean(clickedAgg) && yAxisMeasures.length === 1;
|
|
71126
70958
|
if (same || singleBroadcast) {
|
|
71127
|
-
const nextLabel2 =
|
|
70959
|
+
const nextLabel2 = yAxisMeasures.length === 1 && pivotModel.columnField ? mergePivotColumnSeriesLabelWithUserEdit(
|
|
71128
70960
|
String(y.label ?? "").trim(),
|
|
71129
70961
|
lab,
|
|
71130
70962
|
String(y.field ?? "").trim() || void 0
|
|
@@ -71237,7 +71069,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71237
71069
|
...effectiveNextState.xAxis !== void 0 ? { xAxis: effectiveNextState.xAxis } : {},
|
|
71238
71070
|
...effectiveNextState.yAxis !== void 0 ? { yAxis: effectiveNextState.yAxis } : {}
|
|
71239
71071
|
};
|
|
71240
|
-
|
|
71072
|
+
setAxisEdits((previousEdits) => {
|
|
71241
71073
|
const nextEdits = { ...previousEdits };
|
|
71242
71074
|
if (cx.xAxis) {
|
|
71243
71075
|
let suppressXAxisLabelFromPayload = false;
|
|
@@ -71850,7 +71682,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71850
71682
|
xAxisField: resolvedXAxisField,
|
|
71851
71683
|
xAxisFormat: resolvedXAxisFormat,
|
|
71852
71684
|
xAxisLabel: resolvedXAxisLabel,
|
|
71853
|
-
yAxisFields:
|
|
71685
|
+
yAxisFields: yAxisMeasures,
|
|
71854
71686
|
showLegend: chartVisibility.showLegend,
|
|
71855
71687
|
chartSort: resolvedChartSort ?? null,
|
|
71856
71688
|
...overrides?.filterMap !== void 0 ? { filterMap: overrides.filterMap } : {},
|
|
@@ -71903,7 +71735,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71903
71735
|
resolvedXAxisField,
|
|
71904
71736
|
resolvedXAxisFormat,
|
|
71905
71737
|
resolvedXAxisLabel,
|
|
71906
|
-
|
|
71738
|
+
yAxisMeasures,
|
|
71907
71739
|
sourceReport,
|
|
71908
71740
|
table.columns,
|
|
71909
71741
|
tenants
|
|
@@ -71938,9 +71770,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71938
71770
|
groupColumnsByOptions,
|
|
71939
71771
|
dateBucket: dateBucketMode === "standard" ? pivotState?.dateBucket : dateBucket,
|
|
71940
71772
|
dateBucketOptions: hasDatePivotRow ? dateBucketMode === "standard" ? STANDARD_PIVOT_DATE_BUCKET_OPTIONS : PIVOT_DATE_BUCKET_OPTIONS : [],
|
|
71941
|
-
/** Encoded selection per aggregation
|
|
71773
|
+
/** Encoded selection per aggregation (`'sum:transactions::amount'`, `'count:transactions'`, `''` = placeholder). Update via `setReport({ aggregations: nextStringArray })`. */
|
|
71942
71774
|
aggregations: aggregationValues,
|
|
71943
|
-
/** Flat aggregation pick list shared by all
|
|
71775
|
+
/** Flat aggregation pick list shared by all aggregations; always contains every non-empty `aggregations` entry. */
|
|
71944
71776
|
aggregationOptions,
|
|
71945
71777
|
aggregationDescriptionOptions: cleanedAggregations,
|
|
71946
71778
|
sort: cleanedSort,
|