@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.cjs
CHANGED
|
@@ -23802,11 +23802,17 @@ function formattedPivotRowsAndColumns(report, dashboardFilters = [], options = {
|
|
|
23802
23802
|
dashboardFilters
|
|
23803
23803
|
);
|
|
23804
23804
|
const pivotValueColumns = columns?.slice(1) ?? [];
|
|
23805
|
-
const yAxisFields = report.pivot && !report.pivot.columnField && pivotValueColumns.length > 0 ? pivotValueColumns.map((col
|
|
23806
|
-
|
|
23807
|
-
|
|
23808
|
-
|
|
23809
|
-
|
|
23805
|
+
const yAxisFields = report.pivot && !report.pivot.columnField && pivotValueColumns.length > 0 ? pivotValueColumns.map((col) => {
|
|
23806
|
+
const saved = report.yAxisFields?.find(
|
|
23807
|
+
(axis) => axis.field === col.field
|
|
23808
|
+
);
|
|
23809
|
+
const savedLabel = String(saved?.label ?? "").trim();
|
|
23810
|
+
return {
|
|
23811
|
+
field: col.field,
|
|
23812
|
+
label: savedLabel || col.label || col.field,
|
|
23813
|
+
format: saved?.format ?? legacyPivotFormat ?? col.format ?? "whole_number"
|
|
23814
|
+
};
|
|
23815
|
+
}) : formattedYAxisFields?.length > 0 ? formattedYAxisFields : pivotValueColumns.map((col) => ({
|
|
23810
23816
|
field: col.field,
|
|
23811
23817
|
label: col.label ?? col.field,
|
|
23812
23818
|
format: legacyPivotFormat ?? col.format ?? "whole_number"
|
|
@@ -41087,7 +41093,7 @@ function D3Gauge({
|
|
|
41087
41093
|
if (!containerRef.current || !select) return;
|
|
41088
41094
|
const container = containerRef.current;
|
|
41089
41095
|
select(container).select("svg").remove();
|
|
41090
|
-
svgRef.current = select(container).append("svg").attr("width", "100%").attr("height", "100%").attr("preserveAspectRatio", "xMidYMid meet");
|
|
41096
|
+
svgRef.current = select(container).append("svg").attr("width", "100%").attr("height", "100%").attr("preserveAspectRatio", "xMidYMid meet").style("display", "block");
|
|
41091
41097
|
gaugeGroupRef.current = svgRef.current.append("g");
|
|
41092
41098
|
for (let i = 0; i < 3; i++) {
|
|
41093
41099
|
gaugeGroupRef.current.append("path").attr("class", `arc-seg seg${i}`);
|
|
@@ -41222,7 +41228,7 @@ function D3Gauge({
|
|
|
41222
41228
|
"div",
|
|
41223
41229
|
{
|
|
41224
41230
|
ref: containerRef,
|
|
41225
|
-
style: { width: "100%", ...containerStyle },
|
|
41231
|
+
style: { width: "100%", height: "100%", ...containerStyle },
|
|
41226
41232
|
className
|
|
41227
41233
|
}
|
|
41228
41234
|
);
|
|
@@ -49324,10 +49330,10 @@ function InternalChart({
|
|
|
49324
49330
|
config: report,
|
|
49325
49331
|
containerStyle: {
|
|
49326
49332
|
minHeight: 300,
|
|
49327
|
-
width: ["US map", "World map"].includes(report.chartType) ? "70%" :
|
|
49328
|
-
height: ["US map", "World map"].includes(report.chartType) ? "fit-content" :
|
|
49329
|
-
marginLeft:
|
|
49330
|
-
marginRight:
|
|
49333
|
+
width: ["US map", "World map"].includes(report.chartType) ? "70%" : "100%",
|
|
49334
|
+
height: ["US map", "World map"].includes(report.chartType) ? "fit-content" : report.chartType === "gauge" ? 300 : void 0,
|
|
49335
|
+
marginLeft: "auto",
|
|
49336
|
+
marginRight: "auto"
|
|
49331
49337
|
},
|
|
49332
49338
|
reportId: report.id,
|
|
49333
49339
|
colors,
|
|
@@ -62592,9 +62598,6 @@ function getPageOptionsFromPageCount(pageCount) {
|
|
|
62592
62598
|
|
|
62593
62599
|
// src/hooks/useForm.tsx
|
|
62594
62600
|
var INTERNAL_PIVOT_ROW_FIELDS = /* @__PURE__ */ new Set(["__quillRawDate"]);
|
|
62595
|
-
var LEGACY_SINGLE_Y_AXIS_COLUMN_PIVOT_REPORT_IDS = /* @__PURE__ */ new Set([
|
|
62596
|
-
"69b63941ac8df4cda178a38a"
|
|
62597
|
-
]);
|
|
62598
62601
|
var AGGREGATION_OPTION_TYPES = [
|
|
62599
62602
|
"sum",
|
|
62600
62603
|
"average",
|
|
@@ -63399,10 +63402,7 @@ function normalizePivotColumnDisplayValue(value) {
|
|
|
63399
63402
|
if (!normalized) return "-";
|
|
63400
63403
|
return ["undefined", "null"].includes(normalized.toLowerCase()) ? "-" : normalized;
|
|
63401
63404
|
}
|
|
63402
|
-
function
|
|
63403
|
-
return aggregation?.aggregationType === "percentage" ? "percentage" : "whole_number";
|
|
63404
|
-
}
|
|
63405
|
-
function getPivotTableSlotReportColumn(reportColumns, aggregations, rowField, pivotTableColumnKey) {
|
|
63405
|
+
function getPivotTableReportColumn(reportColumns, aggregations, rowField, pivotTableColumnKey) {
|
|
63406
63406
|
const cols = reportColumns ?? [];
|
|
63407
63407
|
if (cols.length === 0) return void 0;
|
|
63408
63408
|
const row = String(rowField ?? "").trim();
|
|
@@ -63480,7 +63480,214 @@ function shouldUsePivotRowFieldAsXAxis(chartType, pivotRowField, rowColumnFormat
|
|
|
63480
63480
|
}
|
|
63481
63481
|
return true;
|
|
63482
63482
|
}
|
|
63483
|
-
function
|
|
63483
|
+
function pivotDisplayFieldKeys(chart) {
|
|
63484
|
+
const rowField = String(chart.pivot?.rowField ?? "").trim();
|
|
63485
|
+
const firstPivotRow = (chart.rows ?? []).find(
|
|
63486
|
+
(row) => Object.keys(row).length > 0
|
|
63487
|
+
);
|
|
63488
|
+
if (!firstPivotRow) return [];
|
|
63489
|
+
const keys = Object.keys(firstPivotRow).filter(
|
|
63490
|
+
(field) => !INTERNAL_PIVOT_ROW_FIELDS.has(field)
|
|
63491
|
+
);
|
|
63492
|
+
if (rowField && keys.includes(rowField)) {
|
|
63493
|
+
return [rowField, ...keys.filter((field) => field !== rowField)];
|
|
63494
|
+
}
|
|
63495
|
+
return keys;
|
|
63496
|
+
}
|
|
63497
|
+
function pivotValueFieldKeys(chart) {
|
|
63498
|
+
const rowKey = pivotRowKey(chart);
|
|
63499
|
+
const rowField = String(chart.pivot?.rowField ?? "").trim();
|
|
63500
|
+
return pivotDisplayFieldKeys(chart).filter(
|
|
63501
|
+
(field) => field !== rowKey && field !== rowField
|
|
63502
|
+
);
|
|
63503
|
+
}
|
|
63504
|
+
function pivotFallbackValueKeys(chart) {
|
|
63505
|
+
return (chart.pivotColumns ?? []).slice(1).map((column) => String(column.field ?? "").trim()).filter(Boolean);
|
|
63506
|
+
}
|
|
63507
|
+
function findSavedYAxisField(saved, field) {
|
|
63508
|
+
return saved.find((axis) => String(axis.field ?? "").trim() === field) ?? (saved.length === 1 ? saved[0] : void 0);
|
|
63509
|
+
}
|
|
63510
|
+
function isPlaceholderAxisLabel(label, field) {
|
|
63511
|
+
const trimmed = String(label ?? "").trim();
|
|
63512
|
+
const fieldTrim = String(field ?? "").trim();
|
|
63513
|
+
if (!trimmed) return true;
|
|
63514
|
+
if (trimmed.toLowerCase() === fieldTrim.toLowerCase()) return true;
|
|
63515
|
+
return trimmed === toTitleCaseLabel(fieldTrim);
|
|
63516
|
+
}
|
|
63517
|
+
function resolvedAxisLabel(savedLabel, field, generatedLabel) {
|
|
63518
|
+
return isPlaceholderAxisLabel(savedLabel, field) ? generatedLabel : savedLabel;
|
|
63519
|
+
}
|
|
63520
|
+
function resolveYAxisFormatForField(field, aggregation, saved, fallback) {
|
|
63521
|
+
const formatByField = new Map(
|
|
63522
|
+
saved.map((axis) => [String(axis.field ?? "").trim(), axis.format])
|
|
63523
|
+
);
|
|
63524
|
+
if (aggregation?.aggregationType === "count") {
|
|
63525
|
+
return formatByField.get(field) ?? formatByField.get("count") ?? saved[0]?.format ?? "whole_number";
|
|
63526
|
+
}
|
|
63527
|
+
if (aggregation?.aggregationType === "percentage") {
|
|
63528
|
+
const savedFormat = formatByField.get(field);
|
|
63529
|
+
if (savedFormat === "percent" || savedFormat === "percentage") {
|
|
63530
|
+
return savedFormat;
|
|
63531
|
+
}
|
|
63532
|
+
return "percentage";
|
|
63533
|
+
}
|
|
63534
|
+
const aggType = aggregation?.aggregationType ? String(aggregation.aggregationType) : void 0;
|
|
63535
|
+
return formatByField.get(field) ?? formatByField.get(trimAggregationSuffix(field, aggType)) ?? (aggregation?.valueField ? formatByField.get(aggregation.valueField) : void 0) ?? fallback;
|
|
63536
|
+
}
|
|
63537
|
+
function aggregationIdentityForField(field, aggregations) {
|
|
63538
|
+
return getAggregationIdentityKey(
|
|
63539
|
+
findAggregationForFieldStrict(field, aggregations)
|
|
63540
|
+
);
|
|
63541
|
+
}
|
|
63542
|
+
function indexByAggregationIdentity(axes, aggregations) {
|
|
63543
|
+
const byIdentity = /* @__PURE__ */ new Map();
|
|
63544
|
+
for (const axis of axes) {
|
|
63545
|
+
const identity = aggregationIdentityForField(axis.field, aggregations);
|
|
63546
|
+
if (identity && !byIdentity.has(identity)) {
|
|
63547
|
+
byIdentity.set(identity, axis);
|
|
63548
|
+
}
|
|
63549
|
+
}
|
|
63550
|
+
return byIdentity;
|
|
63551
|
+
}
|
|
63552
|
+
function matchedValueKeyForAggregation(aggregation, valueKeys, canonicalField) {
|
|
63553
|
+
if (valueKeys.includes(canonicalField)) return canonicalField;
|
|
63554
|
+
return valueKeys.find(
|
|
63555
|
+
(key) => findAggregationForFieldStrict(key, [aggregation])
|
|
63556
|
+
);
|
|
63557
|
+
}
|
|
63558
|
+
function composePivotColumnSeriesLabel(field, aggregation, measureLabel, hasMultipleAggregations) {
|
|
63559
|
+
if (!aggregation) return toTitleCaseLabel(String(field ?? ""));
|
|
63560
|
+
const category = normalizePivotColumnDisplayValue(
|
|
63561
|
+
getPivotColumnValueForSeries(field, aggregation, hasMultipleAggregations)
|
|
63562
|
+
);
|
|
63563
|
+
const isMeasureNamedSeries = Boolean(aggregation.valueField) && category === String(aggregation.valueField ?? "").trim();
|
|
63564
|
+
if (isMeasureNamedSeries) return measureLabel;
|
|
63565
|
+
if (!measureLabel || measureLabel === category) return category;
|
|
63566
|
+
return `${category} \xB7 ${measureLabel}`;
|
|
63567
|
+
}
|
|
63568
|
+
function measureFromAggregation(aggregation, chart, saved, fallback, hasMultipleAggregations, resolveTableLabel) {
|
|
63569
|
+
const canonicalField = getAggregationFieldKey(
|
|
63570
|
+
aggregation,
|
|
63571
|
+
hasMultipleAggregations
|
|
63572
|
+
);
|
|
63573
|
+
if (!canonicalField) return null;
|
|
63574
|
+
const previous = findSavedYAxisField(saved, canonicalField);
|
|
63575
|
+
const savedLabel = String(previous?.label ?? "").trim();
|
|
63576
|
+
const generatedLabel = buildAggregationLabel(
|
|
63577
|
+
aggregation,
|
|
63578
|
+
chart,
|
|
63579
|
+
resolveTableLabel
|
|
63580
|
+
);
|
|
63581
|
+
return {
|
|
63582
|
+
field: canonicalField,
|
|
63583
|
+
label: resolvedAxisLabel(savedLabel, canonicalField, generatedLabel),
|
|
63584
|
+
format: resolveYAxisFormatForField(
|
|
63585
|
+
canonicalField,
|
|
63586
|
+
aggregation,
|
|
63587
|
+
saved,
|
|
63588
|
+
fallback
|
|
63589
|
+
)
|
|
63590
|
+
};
|
|
63591
|
+
}
|
|
63592
|
+
function applyYAxisEdits(measures, edits, aggregations) {
|
|
63593
|
+
if (!edits) return measures;
|
|
63594
|
+
const byField = new Map(
|
|
63595
|
+
measures.map((measure) => [String(measure.field ?? "").trim(), measure])
|
|
63596
|
+
);
|
|
63597
|
+
const byIdentity = indexByAggregationIdentity(measures, aggregations);
|
|
63598
|
+
const next = [];
|
|
63599
|
+
for (const edit of edits) {
|
|
63600
|
+
const field = String(edit.field ?? "").trim();
|
|
63601
|
+
if (!field) continue;
|
|
63602
|
+
const identity = aggregationIdentityForField(field, aggregations);
|
|
63603
|
+
const base = (identity ? byIdentity.get(identity) : void 0) ?? byField.get(field);
|
|
63604
|
+
const label = String(edit.label ?? "").trim();
|
|
63605
|
+
if (!base) {
|
|
63606
|
+
next.push({
|
|
63607
|
+
field,
|
|
63608
|
+
label: label || toTitleCaseLabel(field),
|
|
63609
|
+
format: toAxisFormat(edit.format, "string")
|
|
63610
|
+
});
|
|
63611
|
+
continue;
|
|
63612
|
+
}
|
|
63613
|
+
next.push({
|
|
63614
|
+
field: base.field,
|
|
63615
|
+
label: label || base.label,
|
|
63616
|
+
format: toAxisFormat(edit.format, base.format)
|
|
63617
|
+
});
|
|
63618
|
+
}
|
|
63619
|
+
return next.length > 0 ? next : measures;
|
|
63620
|
+
}
|
|
63621
|
+
function resolveReportYAxis(chart, edits, resolveTableLabel) {
|
|
63622
|
+
const saved = chart.yAxisFields ?? [];
|
|
63623
|
+
if (!chart.pivot) {
|
|
63624
|
+
const measures2 = applyYAxisEdits(saved, edits, []);
|
|
63625
|
+
return { measures: measures2, series: measures2 };
|
|
63626
|
+
}
|
|
63627
|
+
const aggregations = getPivotAggregations(chart);
|
|
63628
|
+
const hasMultipleAggregations = aggregations.length > 1;
|
|
63629
|
+
const columnField = String(chart.pivot?.columnField ?? "").trim();
|
|
63630
|
+
const isAggregationOnlyPivot = !String(chart.pivot?.rowField ?? "").trim() && !columnField;
|
|
63631
|
+
const fallback = saved[0]?.format ?? chart.xAxisFormat ?? "whole_number";
|
|
63632
|
+
const valueKeys = pivotValueFieldKeys(chart);
|
|
63633
|
+
const fallbackKeys = pivotFallbackValueKeys(chart);
|
|
63634
|
+
let measures = aggregations.flatMap((aggregation) => {
|
|
63635
|
+
const measure = measureFromAggregation(
|
|
63636
|
+
aggregation,
|
|
63637
|
+
chart,
|
|
63638
|
+
saved,
|
|
63639
|
+
fallback,
|
|
63640
|
+
hasMultipleAggregations,
|
|
63641
|
+
resolveTableLabel
|
|
63642
|
+
);
|
|
63643
|
+
if (!measure) return [];
|
|
63644
|
+
if (columnField) return [measure];
|
|
63645
|
+
if (valueKeys.length === 0) return [measure];
|
|
63646
|
+
const matchedKey = matchedValueKeyForAggregation(
|
|
63647
|
+
aggregation,
|
|
63648
|
+
valueKeys,
|
|
63649
|
+
measure.field
|
|
63650
|
+
);
|
|
63651
|
+
if (matchedKey) return [{ ...measure, field: matchedKey }];
|
|
63652
|
+
return isAggregationOnlyPivot ? [measure] : [];
|
|
63653
|
+
});
|
|
63654
|
+
if (!columnField && measures.length === 0 && saved.length > 0) {
|
|
63655
|
+
measures = saved;
|
|
63656
|
+
}
|
|
63657
|
+
measures = applyYAxisEdits(measures, edits, aggregations);
|
|
63658
|
+
if (!columnField) {
|
|
63659
|
+
return { measures, series: measures };
|
|
63660
|
+
}
|
|
63661
|
+
const keys = valueKeys.length > 0 ? valueKeys : fallbackKeys;
|
|
63662
|
+
const measureByIdentity = indexByAggregationIdentity(measures, aggregations);
|
|
63663
|
+
const selectedIdentities = new Set(measureByIdentity.keys());
|
|
63664
|
+
const series = keys.flatMap((field) => {
|
|
63665
|
+
const aggregation = findAggregationForFieldStrict(field, aggregations);
|
|
63666
|
+
const identity = getAggregationIdentityKey(aggregation);
|
|
63667
|
+
if (selectedIdentities.size > 0 && identity && !selectedIdentities.has(identity)) {
|
|
63668
|
+
return [];
|
|
63669
|
+
}
|
|
63670
|
+
const measure = (identity ? measureByIdentity.get(identity) : void 0) ?? (measures.length === 1 ? measures[0] : void 0);
|
|
63671
|
+
const measureLabel = String(measure?.label ?? "").trim() || (aggregation ? buildAggregationLabel(aggregation, chart, resolveTableLabel) : toTitleCaseLabel(field));
|
|
63672
|
+
return [
|
|
63673
|
+
{
|
|
63674
|
+
field,
|
|
63675
|
+
label: composePivotColumnSeriesLabel(
|
|
63676
|
+
field,
|
|
63677
|
+
aggregation,
|
|
63678
|
+
measureLabel,
|
|
63679
|
+
hasMultipleAggregations
|
|
63680
|
+
),
|
|
63681
|
+
format: measure?.format ?? resolveYAxisFormatForField(field, aggregation, saved, fallback)
|
|
63682
|
+
}
|
|
63683
|
+
];
|
|
63684
|
+
});
|
|
63685
|
+
if (series.length > 0) {
|
|
63686
|
+
return { measures, series };
|
|
63687
|
+
}
|
|
63688
|
+
return { measures, series: measures };
|
|
63689
|
+
}
|
|
63690
|
+
function normalizePivotChartForDisplay(chart) {
|
|
63484
63691
|
const swapPivotRowsForChartRows = Boolean(chart?.pivot) && Array.isArray(chart?.pivotRows) && chart.pivotRows.length > 0;
|
|
63485
63692
|
const syntheticAggregationOnlyRows = chart && !swapPivotRowsForChartRows ? buildSyntheticAggregationOnlyDisplayRows(chart) : null;
|
|
63486
63693
|
const hasExplicitEmptyGroupedPivot = Boolean(
|
|
@@ -63516,136 +63723,13 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63516
63723
|
String(withResolvedXAxis.chartType ?? "").toLowerCase()
|
|
63517
63724
|
);
|
|
63518
63725
|
const aggregations = getPivotAggregations(withResolvedXAxis);
|
|
63519
|
-
const hasMultipleAggregations = aggregations.length > 1;
|
|
63520
63726
|
const yAxisFallbackFormat = withResolvedXAxis.yAxisFields?.[0]?.format ?? withResolvedXAxis.xAxisFormat ?? "whole_number";
|
|
63521
63727
|
const firstPivotRow = (withResolvedXAxis.rows ?? []).find(
|
|
63522
63728
|
(row) => Object.keys(row).length > 0
|
|
63523
63729
|
);
|
|
63524
|
-
const
|
|
63525
|
-
|
|
63526
|
-
|
|
63527
|
-
const pivotRowFields = firstPivotRow ? (() => {
|
|
63528
|
-
const keys = Object.keys(firstPivotRow).filter(
|
|
63529
|
-
(field) => !INTERNAL_PIVOT_ROW_FIELDS.has(field)
|
|
63530
|
-
);
|
|
63531
|
-
if (pivotRowFieldName && keys.includes(pivotRowFieldName)) {
|
|
63532
|
-
return [
|
|
63533
|
-
pivotRowFieldName,
|
|
63534
|
-
...keys.filter((field) => field !== pivotRowFieldName)
|
|
63535
|
-
];
|
|
63536
|
-
}
|
|
63537
|
-
return keys;
|
|
63538
|
-
})() : [];
|
|
63539
|
-
const pivotValueFields = pivotRowFields.filter(
|
|
63540
|
-
(field) => field !== pivotRowKey(withResolvedXAxis) && field !== withResolvedXAxis.pivot?.rowField
|
|
63541
|
-
);
|
|
63542
|
-
const isAggregationOnlyPivot = !String(withResolvedXAxis.pivot?.rowField ?? "").trim() && !String(withResolvedXAxis.pivot?.columnField ?? "").trim();
|
|
63543
|
-
const yAxisFormatByField = new Map(
|
|
63544
|
-
(withResolvedXAxis.yAxisFields ?? []).map((axis) => [
|
|
63545
|
-
axis.field,
|
|
63546
|
-
axis.format
|
|
63547
|
-
])
|
|
63548
|
-
);
|
|
63549
|
-
const resolveYAxisFormat = (field, aggregation) => {
|
|
63550
|
-
if (aggregation?.aggregationType === "count") {
|
|
63551
|
-
const savedFormat = yAxisFormatByField.get(field) ?? yAxisFormatByField.get("count") ?? withResolvedXAxis.yAxisFields?.find(
|
|
63552
|
-
(axis) => String(axis.field ?? "").trim() === field
|
|
63553
|
-
)?.format ?? withResolvedXAxis.yAxisFields?.[0]?.format;
|
|
63554
|
-
if (savedFormat) return savedFormat;
|
|
63555
|
-
return "whole_number";
|
|
63556
|
-
}
|
|
63557
|
-
if (aggregation?.aggregationType === "percentage") {
|
|
63558
|
-
const savedFormat = yAxisFormatByField.get(field);
|
|
63559
|
-
if (savedFormat === "percent" || savedFormat === "percentage") {
|
|
63560
|
-
return savedFormat;
|
|
63561
|
-
}
|
|
63562
|
-
return "percentage";
|
|
63563
|
-
}
|
|
63564
|
-
const directAxisFormat = yAxisFormatByField.get(field);
|
|
63565
|
-
if (directAxisFormat) return directAxisFormat;
|
|
63566
|
-
const aggType = aggregation?.aggregationType ? String(aggregation.aggregationType) : void 0;
|
|
63567
|
-
const baseField = trimAggregationSuffix(field, aggType);
|
|
63568
|
-
const baseAxisFormat = yAxisFormatByField.get(baseField);
|
|
63569
|
-
if (baseAxisFormat) return baseAxisFormat;
|
|
63570
|
-
if (aggregation?.valueField) {
|
|
63571
|
-
const aggregationValueFieldFormat = yAxisFormatByField.get(
|
|
63572
|
-
aggregation.valueField
|
|
63573
|
-
);
|
|
63574
|
-
if (aggregationValueFieldFormat) return aggregationValueFieldFormat;
|
|
63575
|
-
}
|
|
63576
|
-
return yAxisFallbackFormat;
|
|
63577
|
-
};
|
|
63578
|
-
const resolveAggregationAxisFieldForDisplay = (aggregation, canonicalField) => {
|
|
63579
|
-
if (!canonicalField) return null;
|
|
63580
|
-
if (pivotValueFields.includes(canonicalField)) {
|
|
63581
|
-
return canonicalField;
|
|
63582
|
-
}
|
|
63583
|
-
if (!isAggregationOnlyPivot) {
|
|
63584
|
-
return null;
|
|
63585
|
-
}
|
|
63586
|
-
const matchedPivotKey = pivotValueFields.find(
|
|
63587
|
-
(pf) => findAggregationForFieldStrict(pf, [aggregation])
|
|
63588
|
-
);
|
|
63589
|
-
return matchedPivotKey ?? canonicalField;
|
|
63590
|
-
};
|
|
63591
|
-
const yAxisFromAggregations = !withResolvedXAxis.pivot?.columnField && aggregations.length > 0 ? aggregations.map((aggregation) => {
|
|
63592
|
-
const canonicalField = getAggregationFieldKey(
|
|
63593
|
-
aggregation,
|
|
63594
|
-
hasMultipleAggregations
|
|
63595
|
-
);
|
|
63596
|
-
const field = resolveAggregationAxisFieldForDisplay(
|
|
63597
|
-
aggregation,
|
|
63598
|
-
canonicalField
|
|
63599
|
-
);
|
|
63600
|
-
if (!field) return null;
|
|
63601
|
-
return {
|
|
63602
|
-
field,
|
|
63603
|
-
label: buildAggregationLabel(
|
|
63604
|
-
aggregation,
|
|
63605
|
-
withResolvedXAxis,
|
|
63606
|
-
resolveTableLabel
|
|
63607
|
-
),
|
|
63608
|
-
format: resolveYAxisFormat(field, aggregation)
|
|
63609
|
-
};
|
|
63610
|
-
}).filter((axis) => Boolean(axis)) : [];
|
|
63611
|
-
const mappedValueFields = new Set(
|
|
63612
|
-
yAxisFromAggregations.map((axis) => axis.field)
|
|
63613
|
-
);
|
|
63614
|
-
const yAxisFromPivotRowFields = pivotValueFields.filter((field) => !mappedValueFields.has(field)).map((field) => {
|
|
63615
|
-
const aggregation = findAggregationForFieldStrict(field, aggregations);
|
|
63616
|
-
const cleanedBaseField = aggregation?.aggregationType && hasMultipleAggregations ? trimAggregationSuffix(field, String(aggregation.aggregationType)) : field;
|
|
63617
|
-
const displayBase = aggregation?.valueField && withResolvedXAxis.pivot?.columnField ? trimAggregationSuffix(cleanedBaseField, aggregation.valueField) : cleanedBaseField;
|
|
63618
|
-
const displayBaseField = normalizePivotColumnDisplayValue(displayBase);
|
|
63619
|
-
const aggregationLabel = aggregation ? buildAggregationLabel(
|
|
63620
|
-
aggregation,
|
|
63621
|
-
withResolvedXAxis,
|
|
63622
|
-
resolveTableLabel
|
|
63623
|
-
) : void 0;
|
|
63624
|
-
const isMeasureNamedSeries = Boolean(aggregation?.valueField) && displayBaseField === String(aggregation?.valueField ?? "").trim();
|
|
63625
|
-
let pivotColumnSeriesLabel = displayBaseField;
|
|
63626
|
-
if (withResolvedXAxis.pivot?.columnField && aggregation && aggregationLabel) {
|
|
63627
|
-
if (isMeasureNamedSeries) {
|
|
63628
|
-
pivotColumnSeriesLabel = aggregationLabel;
|
|
63629
|
-
} else if (aggregationLabel !== displayBaseField) {
|
|
63630
|
-
const alreadyCombined = String(displayBaseField).endsWith(` \xB7 ${aggregationLabel}`) || String(displayBaseField).endsWith(` \u2014 ${aggregationLabel}`) || String(displayBaseField).endsWith(` (${aggregationLabel})`);
|
|
63631
|
-
pivotColumnSeriesLabel = alreadyCombined ? displayBaseField : `${displayBaseField} \xB7 ${aggregationLabel}`;
|
|
63632
|
-
}
|
|
63633
|
-
}
|
|
63634
|
-
const label = aggregation ? withResolvedXAxis.pivot?.columnField ? pivotColumnSeriesLabel : aggregationLabel ?? displayBaseField : toTitleCaseLabel(String(field ?? ""));
|
|
63635
|
-
return {
|
|
63636
|
-
field,
|
|
63637
|
-
label,
|
|
63638
|
-
format: resolveYAxisFormat(field, aggregation)
|
|
63639
|
-
};
|
|
63640
|
-
});
|
|
63641
|
-
const supplementalYAxisFromPivotRowFields = yAxisFromAggregations.length > 0 ? yAxisFromPivotRowFields.filter(
|
|
63642
|
-
(axis) => Boolean(findAggregationForFieldStrict(axis.field, aggregations))
|
|
63643
|
-
) : yAxisFromPivotRowFields;
|
|
63644
|
-
const yAxisFields = yAxisFromAggregations.length > 0 ? [...yAxisFromAggregations, ...supplementalYAxisFromPivotRowFields] : supplementalYAxisFromPivotRowFields.length > 0 ? supplementalYAxisFromPivotRowFields : (withResolvedXAxis.pivotColumns ?? []).slice(1).map((column) => ({
|
|
63645
|
-
field: column.field,
|
|
63646
|
-
label: column.label ?? column.field,
|
|
63647
|
-
format: column.format ?? yAxisFallbackFormat
|
|
63648
|
-
}));
|
|
63730
|
+
const pivotRowFields = pivotDisplayFieldKeys(withResolvedXAxis);
|
|
63731
|
+
const pivotValueFields = pivotValueFieldKeys(withResolvedXAxis);
|
|
63732
|
+
const yAxisFields = withResolvedXAxis.yAxisFields ?? [];
|
|
63649
63733
|
const knownColumnsByField = new Map(
|
|
63650
63734
|
[
|
|
63651
63735
|
...withResolvedXAxis.pivotColumns ?? [],
|
|
@@ -63666,21 +63750,21 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63666
63750
|
};
|
|
63667
63751
|
}) : withResolvedXAxis.columns ?? [];
|
|
63668
63752
|
const isPivotTableChart = String(withResolvedXAxis.chartType ?? "").toLowerCase() === "table" && Boolean(withResolvedXAxis.pivot);
|
|
63669
|
-
const
|
|
63753
|
+
const savedPivotTableColumns = isPivotTableChart && Array.isArray(withResolvedXAxis.pivotColumns) && withResolvedXAxis.pivotColumns.length > 0 ? withResolvedXAxis.pivotColumns : withResolvedXAxis.columns;
|
|
63670
63754
|
const pivotTableDisplayColumns = isPivotTableChart && pivotColumnFields.length > 0 ? normalizedPivotColumns.map((col) => {
|
|
63671
|
-
const
|
|
63672
|
-
|
|
63755
|
+
const savedColumn = getPivotTableReportColumn(
|
|
63756
|
+
savedPivotTableColumns,
|
|
63673
63757
|
aggregations,
|
|
63674
63758
|
pivotRowKey(withResolvedXAxis) || withResolvedXAxis.pivot?.rowField,
|
|
63675
63759
|
col.field
|
|
63676
63760
|
);
|
|
63677
|
-
if (!
|
|
63761
|
+
if (!savedColumn) return col;
|
|
63678
63762
|
const next = {
|
|
63679
63763
|
...col,
|
|
63680
|
-
format:
|
|
63764
|
+
format: savedColumn.format ?? col.format
|
|
63681
63765
|
};
|
|
63682
|
-
if (
|
|
63683
|
-
next.inferFormat =
|
|
63766
|
+
if (savedColumn.inferFormat !== void 0) {
|
|
63767
|
+
next.inferFormat = savedColumn.inferFormat;
|
|
63684
63768
|
}
|
|
63685
63769
|
return next;
|
|
63686
63770
|
}) : normalizedPivotColumns;
|
|
@@ -63741,100 +63825,10 @@ function normalizePivotChartForDisplay(chart, resolveTableLabel) {
|
|
|
63741
63825
|
yAxisFields
|
|
63742
63826
|
};
|
|
63743
63827
|
}
|
|
63744
|
-
function
|
|
63745
|
-
const aggregations = getPivotAggregations(report);
|
|
63746
|
-
const hasMultipleAggregations = aggregations.length > 1;
|
|
63747
|
-
return aggregations.map((aggregation) => {
|
|
63748
|
-
const field = getAggregationFieldKey(
|
|
63749
|
-
aggregation,
|
|
63750
|
-
hasMultipleAggregations
|
|
63751
|
-
);
|
|
63752
|
-
if (!field) return null;
|
|
63753
|
-
return {
|
|
63754
|
-
field,
|
|
63755
|
-
label: buildAggregationLabel(aggregation, report, resolveTableLabel),
|
|
63756
|
-
format: getYAxisFormatFromAggregation(aggregation)
|
|
63757
|
-
};
|
|
63758
|
-
}).filter((axis) => Boolean(axis));
|
|
63759
|
-
}
|
|
63760
|
-
function mergePivotColumnAxisFieldsWithMapped(aggregationAxisFields, mapped) {
|
|
63761
|
-
const byField = /* @__PURE__ */ new Map();
|
|
63762
|
-
for (const y of mapped) {
|
|
63763
|
-
const f = String(y.field ?? "").trim();
|
|
63764
|
-
if (f) byField.set(f, y);
|
|
63765
|
-
}
|
|
63766
|
-
return aggregationAxisFields.map((axis) => {
|
|
63767
|
-
const f = String(axis.field ?? "").trim();
|
|
63768
|
-
const mappedAxis = f ? byField.get(f) : void 0;
|
|
63769
|
-
return mappedAxis ?? axis;
|
|
63770
|
-
});
|
|
63771
|
-
}
|
|
63772
|
-
function normalizePivotChartForAxisControls(chart, reportId, resolveTableLabel) {
|
|
63773
|
-
if (!chart?.pivot?.columnField) return chart;
|
|
63774
|
-
const aggregations = getPivotAggregations(chart);
|
|
63775
|
-
if (aggregations.length === 0) return chart;
|
|
63776
|
-
const aggregationAxisFields = buildPivotAggregationAxisFields(
|
|
63777
|
-
chart,
|
|
63778
|
-
resolveTableLabel
|
|
63779
|
-
);
|
|
63780
|
-
if (aggregationAxisFields.length === 0) return chart;
|
|
63781
|
-
const aggregationAxisByIdentity = /* @__PURE__ */ new Map();
|
|
63782
|
-
for (const aggregationAxisField of aggregationAxisFields) {
|
|
63783
|
-
const aggregation = findAggregationForFieldStrict(
|
|
63784
|
-
aggregationAxisField.field,
|
|
63785
|
-
aggregations
|
|
63786
|
-
);
|
|
63787
|
-
const aggregationIdentity = getAggregationIdentityKey(aggregation);
|
|
63788
|
-
if (!aggregationIdentity || aggregationAxisByIdentity.has(aggregationIdentity)) {
|
|
63789
|
-
continue;
|
|
63790
|
-
}
|
|
63791
|
-
aggregationAxisByIdentity.set(aggregationIdentity, aggregationAxisField);
|
|
63792
|
-
}
|
|
63793
|
-
const mappedExistingYAxisFields = [];
|
|
63794
|
-
const seenMappedFields = /* @__PURE__ */ new Set();
|
|
63795
|
-
for (const existingYAxisField of chart.yAxisFields ?? []) {
|
|
63796
|
-
const aggregation = findAggregationForFieldStrict(
|
|
63797
|
-
existingYAxisField.field,
|
|
63798
|
-
aggregations
|
|
63799
|
-
);
|
|
63800
|
-
const aggregationIdentity = getAggregationIdentityKey(aggregation);
|
|
63801
|
-
if (!aggregationIdentity) continue;
|
|
63802
|
-
const mappedAggregationAxis = aggregationAxisByIdentity.get(aggregationIdentity);
|
|
63803
|
-
if (!mappedAggregationAxis) continue;
|
|
63804
|
-
if (seenMappedFields.has(mappedAggregationAxis.field)) continue;
|
|
63805
|
-
seenMappedFields.add(mappedAggregationAxis.field);
|
|
63806
|
-
mappedExistingYAxisFields.push({
|
|
63807
|
-
field: mappedAggregationAxis.field,
|
|
63808
|
-
label: String(existingYAxisField.label ?? "").trim() || mappedAggregationAxis.label,
|
|
63809
|
-
format: toAxisFormat(
|
|
63810
|
-
existingYAxisField.format,
|
|
63811
|
-
mappedAggregationAxis.format
|
|
63812
|
-
)
|
|
63813
|
-
});
|
|
63814
|
-
}
|
|
63815
|
-
let yAxisFields;
|
|
63816
|
-
if (aggregations.length > 1) {
|
|
63817
|
-
const resolvedReportId = String(reportId ?? chart.id ?? "").trim();
|
|
63818
|
-
if (LEGACY_SINGLE_Y_AXIS_COLUMN_PIVOT_REPORT_IDS.has(resolvedReportId)) {
|
|
63819
|
-
yAxisFields = mappedExistingYAxisFields.length > 0 ? mappedExistingYAxisFields : [aggregationAxisFields[0]];
|
|
63820
|
-
} else {
|
|
63821
|
-
yAxisFields = mappedExistingYAxisFields.length === 0 || mappedExistingYAxisFields.length < aggregationAxisFields.length ? mergePivotColumnAxisFieldsWithMapped(
|
|
63822
|
-
aggregationAxisFields,
|
|
63823
|
-
mappedExistingYAxisFields
|
|
63824
|
-
) : mappedExistingYAxisFields;
|
|
63825
|
-
}
|
|
63826
|
-
} else {
|
|
63827
|
-
yAxisFields = mappedExistingYAxisFields.length > 0 ? mappedExistingYAxisFields : [aggregationAxisFields[0]];
|
|
63828
|
-
}
|
|
63829
|
-
return {
|
|
63830
|
-
...chart,
|
|
63831
|
-
yAxisFields
|
|
63832
|
-
};
|
|
63833
|
-
}
|
|
63834
|
-
function buildPivotColumnPivotTableFormattingColumns(pivot, chart, resolveTableLabel) {
|
|
63828
|
+
function buildPivotTableColumns(pivot, chart, resolveTableLabel) {
|
|
63835
63829
|
if (!pivot) return null;
|
|
63836
|
-
const
|
|
63837
|
-
const aggregations = getPivotAggregations(
|
|
63830
|
+
const chartWithPivot = chart ? { ...chart, pivot } : { pivot };
|
|
63831
|
+
const aggregations = getPivotAggregations(chartWithPivot);
|
|
63838
63832
|
if (aggregations.length === 0) return null;
|
|
63839
63833
|
const hasMultipleAggregations = aggregations.length > 1;
|
|
63840
63834
|
const rowField = String(pivot.rowField ?? "").trim();
|
|
@@ -63868,7 +63862,7 @@ function buildPivotColumnPivotTableFormattingColumns(pivot, chart, resolveTableL
|
|
|
63868
63862
|
field: fieldKey,
|
|
63869
63863
|
label: buildAggregationLabel(
|
|
63870
63864
|
aggregation,
|
|
63871
|
-
|
|
63865
|
+
chartWithPivot,
|
|
63872
63866
|
resolveTableLabel
|
|
63873
63867
|
)
|
|
63874
63868
|
});
|
|
@@ -63895,19 +63889,6 @@ function mergePivotColumnSeriesLabelWithUserEdit(normalizedLabel, userRowLabel,
|
|
|
63895
63889
|
}
|
|
63896
63890
|
return user;
|
|
63897
63891
|
}
|
|
63898
|
-
function applySingleResolvedYAxisFormatToPivotDisplay(normalizedPivotYAxisFields, resolvedYAxisFields) {
|
|
63899
|
-
if (resolvedYAxisFields.length !== 1) return normalizedPivotYAxisFields;
|
|
63900
|
-
const only = resolvedYAxisFields[0];
|
|
63901
|
-
return normalizedPivotYAxisFields.map((axis) => ({
|
|
63902
|
-
...axis,
|
|
63903
|
-
label: mergePivotColumnSeriesLabelWithUserEdit(
|
|
63904
|
-
String(axis.label ?? "").trim(),
|
|
63905
|
-
only.label,
|
|
63906
|
-
String(axis.field ?? "").trim() || void 0
|
|
63907
|
-
),
|
|
63908
|
-
format: toAxisFormat(only.format, axis.format)
|
|
63909
|
-
}));
|
|
63910
|
-
}
|
|
63911
63892
|
function mergeChartColumnFormatsFromYAxisFields(columns, yAxisFields) {
|
|
63912
63893
|
if (!columns?.length || !yAxisFields?.length) return columns;
|
|
63913
63894
|
const formatByField = /* @__PURE__ */ new Map();
|
|
@@ -63965,71 +63946,6 @@ function mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
|
63965
63946
|
return { ...c, label: yl };
|
|
63966
63947
|
});
|
|
63967
63948
|
}
|
|
63968
|
-
function mapResolvedPivotYAxisFieldsForDisplay({
|
|
63969
|
-
chart,
|
|
63970
|
-
resolvedYAxisFields
|
|
63971
|
-
}) {
|
|
63972
|
-
if (!chart.pivot?.columnField) return resolvedYAxisFields;
|
|
63973
|
-
const normalizedPivotYAxisFields = chart.yAxisFields ?? [];
|
|
63974
|
-
if (normalizedPivotYAxisFields.length === 0) return resolvedYAxisFields;
|
|
63975
|
-
const aggregations = getPivotAggregations(chart);
|
|
63976
|
-
if (aggregations.length === 0) {
|
|
63977
|
-
return applySingleResolvedYAxisFormatToPivotDisplay(
|
|
63978
|
-
normalizedPivotYAxisFields,
|
|
63979
|
-
resolvedYAxisFields
|
|
63980
|
-
);
|
|
63981
|
-
}
|
|
63982
|
-
const selectedAggregationByIdentity = /* @__PURE__ */ new Map();
|
|
63983
|
-
for (const yAxisField of resolvedYAxisFields ?? []) {
|
|
63984
|
-
const aggregation = findAggregationForFieldStrict(
|
|
63985
|
-
yAxisField.field,
|
|
63986
|
-
aggregations
|
|
63987
|
-
);
|
|
63988
|
-
const aggregationIdentity = getAggregationIdentityKey(aggregation);
|
|
63989
|
-
if (!aggregationIdentity) continue;
|
|
63990
|
-
selectedAggregationByIdentity.set(aggregationIdentity, yAxisField);
|
|
63991
|
-
}
|
|
63992
|
-
if (selectedAggregationByIdentity.size === 0) {
|
|
63993
|
-
return applySingleResolvedYAxisFormatToPivotDisplay(
|
|
63994
|
-
normalizedPivotYAxisFields,
|
|
63995
|
-
resolvedYAxisFields
|
|
63996
|
-
);
|
|
63997
|
-
}
|
|
63998
|
-
const mappedYAxisFields = [];
|
|
63999
|
-
const seenMappedFields = /* @__PURE__ */ new Set();
|
|
64000
|
-
for (const normalizedYAxisField of normalizedPivotYAxisFields) {
|
|
64001
|
-
const aggregation = findAggregationForFieldStrict(
|
|
64002
|
-
normalizedYAxisField.field,
|
|
64003
|
-
aggregations
|
|
64004
|
-
);
|
|
64005
|
-
const aggregationIdentity = getAggregationIdentityKey(aggregation);
|
|
64006
|
-
if (!aggregationIdentity) continue;
|
|
64007
|
-
const selectedAggregationAxis = selectedAggregationByIdentity.get(aggregationIdentity);
|
|
64008
|
-
if (!selectedAggregationAxis) continue;
|
|
64009
|
-
const field = String(normalizedYAxisField.field ?? "").trim();
|
|
64010
|
-
if (!field || seenMappedFields.has(field)) continue;
|
|
64011
|
-
seenMappedFields.add(field);
|
|
64012
|
-
mappedYAxisFields.push({
|
|
64013
|
-
...normalizedYAxisField,
|
|
64014
|
-
label: mergePivotColumnSeriesLabelWithUserEdit(
|
|
64015
|
-
String(normalizedYAxisField.label ?? "").trim(),
|
|
64016
|
-
selectedAggregationAxis.label,
|
|
64017
|
-
field || void 0
|
|
64018
|
-
),
|
|
64019
|
-
format: toAxisFormat(
|
|
64020
|
-
selectedAggregationAxis.format,
|
|
64021
|
-
normalizedYAxisField.format
|
|
64022
|
-
)
|
|
64023
|
-
});
|
|
64024
|
-
}
|
|
64025
|
-
if (mappedYAxisFields.length > 0) {
|
|
64026
|
-
return mappedYAxisFields;
|
|
64027
|
-
}
|
|
64028
|
-
return applySingleResolvedYAxisFormatToPivotDisplay(
|
|
64029
|
-
normalizedPivotYAxisFields,
|
|
64030
|
-
resolvedYAxisFields
|
|
64031
|
-
);
|
|
64032
|
-
}
|
|
64033
63949
|
function encodeColumnOptionValue(table, field) {
|
|
64034
63950
|
if (!table || !table.trim()) return field;
|
|
64035
63951
|
return `${table}_${field}`;
|
|
@@ -66479,7 +66395,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66479
66395
|
(0, import_react63.useEffect)(() => {
|
|
66480
66396
|
setTableColumnsEditedSignature(null);
|
|
66481
66397
|
}, [effectiveReportId]);
|
|
66482
|
-
const [
|
|
66398
|
+
const [axisEdits, setAxisEdits] = (0, import_react63.useState)({});
|
|
66483
66399
|
const [chartVisibilityOverrides, setChartVisibilityOverrides] = (0, import_react63.useState)({});
|
|
66484
66400
|
const [chartSortOverride, setChartSortOverride] = (0, import_react63.useState)(void 0);
|
|
66485
66401
|
const [client] = (0, import_react63.useContext)(ClientContext);
|
|
@@ -66611,7 +66527,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66611
66527
|
}
|
|
66612
66528
|
}, [createdReportBootstrap?.reportId, propReportId]);
|
|
66613
66529
|
(0, import_react63.useEffect)(() => {
|
|
66614
|
-
|
|
66530
|
+
setAxisEdits({});
|
|
66615
66531
|
setChartVisibilityOverrides({});
|
|
66616
66532
|
setChartSortOverride(void 0);
|
|
66617
66533
|
}, [effectiveReportId]);
|
|
@@ -69613,20 +69529,18 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69613
69529
|
chartPivotHydrationEpoch
|
|
69614
69530
|
]);
|
|
69615
69531
|
const baseChart = (0, import_react63.useMemo)(
|
|
69616
|
-
() => normalizePivotChartForDisplay(chartData
|
|
69617
|
-
[chartData
|
|
69532
|
+
() => normalizePivotChartForDisplay(chartData),
|
|
69533
|
+
[chartData]
|
|
69618
69534
|
);
|
|
69619
|
-
const
|
|
69620
|
-
if (!
|
|
69621
|
-
|
|
69622
|
-
|
|
69623
|
-
|
|
69624
|
-
|
|
69625
|
-
|
|
69626
|
-
|
|
69627
|
-
|
|
69628
|
-
return baseChart;
|
|
69629
|
-
}, [baseChart, chartData, effectiveReportId, resolveTableDisplayLabel]);
|
|
69535
|
+
const yAxisResolved = (0, import_react63.useMemo)(() => {
|
|
69536
|
+
if (!baseChart) return { measures: [], series: [] };
|
|
69537
|
+
return resolveReportYAxis(
|
|
69538
|
+
baseChart,
|
|
69539
|
+
axisEdits.yAxisFields,
|
|
69540
|
+
resolveTableDisplayLabel
|
|
69541
|
+
);
|
|
69542
|
+
}, [baseChart, axisEdits.yAxisFields, resolveTableDisplayLabel]);
|
|
69543
|
+
const chartAxesBaseChart = baseChart;
|
|
69630
69544
|
const chartAxisOptions = (0, import_react63.useMemo)(() => {
|
|
69631
69545
|
if (!chartAxesBaseChart) return [];
|
|
69632
69546
|
const optionsByField = /* @__PURE__ */ new Map();
|
|
@@ -69645,7 +69559,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69645
69559
|
for (const column of chartAxesBaseChart.columns ?? []) {
|
|
69646
69560
|
registerOption(column.field, column.label, column.format);
|
|
69647
69561
|
}
|
|
69648
|
-
for (const yAxis2 of
|
|
69562
|
+
for (const yAxis2 of yAxisResolved.measures) {
|
|
69649
69563
|
registerOption(yAxis2.field, yAxis2.label, yAxis2.format);
|
|
69650
69564
|
if (yAxis2.format) {
|
|
69651
69565
|
const existing = optionsByField.get(yAxis2.field);
|
|
@@ -69657,18 +69571,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69657
69571
|
}
|
|
69658
69572
|
}
|
|
69659
69573
|
}
|
|
69660
|
-
if (chartAxesBaseChart.pivot?.columnField) {
|
|
69661
|
-
for (const aggregationAxis of buildPivotAggregationAxisFields(
|
|
69662
|
-
chartAxesBaseChart,
|
|
69663
|
-
resolveTableDisplayLabel
|
|
69664
|
-
)) {
|
|
69665
|
-
registerOption(
|
|
69666
|
-
aggregationAxis.field,
|
|
69667
|
-
aggregationAxis.label,
|
|
69668
|
-
aggregationAxis.format
|
|
69669
|
-
);
|
|
69670
|
-
}
|
|
69671
|
-
}
|
|
69672
69574
|
const xField = String(chartAxesBaseChart.xAxisField ?? "").trim();
|
|
69673
69575
|
const savedXFormat = String(chartAxesBaseChart.xAxisFormat ?? "").trim();
|
|
69674
69576
|
registerOption(
|
|
@@ -69686,7 +69588,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69686
69588
|
}
|
|
69687
69589
|
}
|
|
69688
69590
|
return Array.from(optionsByField.values());
|
|
69689
|
-
}, [chartAxesBaseChart,
|
|
69591
|
+
}, [chartAxesBaseChart, yAxisResolved.measures]);
|
|
69690
69592
|
const chartAxisOptionByField = (0, import_react63.useMemo)(() => {
|
|
69691
69593
|
const optionsByField = /* @__PURE__ */ new Map();
|
|
69692
69594
|
for (const option of chartAxisOptions) {
|
|
@@ -69731,19 +69633,15 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69731
69633
|
const pivot = chartAxesBaseChart.pivot;
|
|
69732
69634
|
const pivotRowField = String(pivot?.rowField ?? "").trim();
|
|
69733
69635
|
if (pivot && !pivotRowField) {
|
|
69734
|
-
const
|
|
69735
|
-
|
|
69736
|
-
resolveTableDisplayLabel
|
|
69737
|
-
);
|
|
69738
|
-
if (aggAxis.length > 0) {
|
|
69739
|
-
const allowed = new Set(aggAxis.map((a) => a.field));
|
|
69636
|
+
const allowed = new Set(yAxisResolved.measures.map((axis) => axis.field));
|
|
69637
|
+
if (allowed.size > 0) {
|
|
69740
69638
|
eligible = eligible.filter((o) => allowed.has(o.value));
|
|
69741
69639
|
}
|
|
69742
69640
|
}
|
|
69743
69641
|
const merged = new Map(
|
|
69744
69642
|
eligible.map((o) => [o.value, o])
|
|
69745
69643
|
);
|
|
69746
|
-
for (const yAxisField of
|
|
69644
|
+
for (const yAxisField of yAxisResolved.measures) {
|
|
69747
69645
|
const field = String(yAxisField?.field ?? "").trim();
|
|
69748
69646
|
if (!field || merged.has(field)) continue;
|
|
69749
69647
|
const opt = chartAxisOptionByField.get(field);
|
|
@@ -69754,8 +69652,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69754
69652
|
chartAxesBaseChart,
|
|
69755
69653
|
chartAxisOptionByField,
|
|
69756
69654
|
chartAxisOptions,
|
|
69757
|
-
|
|
69758
|
-
|
|
69655
|
+
schemaColumnOptions,
|
|
69656
|
+
yAxisResolved.measures
|
|
69759
69657
|
]);
|
|
69760
69658
|
const normalizedChartXAxisOptions = (0, import_react63.useMemo)(() => {
|
|
69761
69659
|
return xAxisOptions.map((option) => ({
|
|
@@ -69771,34 +69669,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69771
69669
|
format: String(option.format ?? "").trim()
|
|
69772
69670
|
}));
|
|
69773
69671
|
}, [yAxisOptions]);
|
|
69774
|
-
const
|
|
69775
|
-
if (
|
|
69776
|
-
|
|
69777
|
-
const field = String(yAxisFieldRaw?.field ?? "").trim();
|
|
69778
|
-
if (!field) return null;
|
|
69779
|
-
const option = chartAxisOptionByField.get(field);
|
|
69780
|
-
if (!option) return null;
|
|
69781
|
-
const rawLabel = String(yAxisFieldRaw?.label ?? "").trim() || option.label;
|
|
69782
|
-
const label = rawLabel === field ? toTitleCaseLabel(field) : rawLabel;
|
|
69783
|
-
const format9 = toAxisFormat(yAxisFieldRaw?.format, option.format);
|
|
69784
|
-
return {
|
|
69785
|
-
field,
|
|
69786
|
-
label,
|
|
69787
|
-
format: format9
|
|
69788
|
-
};
|
|
69789
|
-
};
|
|
69790
|
-
const fallbackYAxisFields = (chartAxesBaseChart.yAxisFields ?? []).map((yAxisField) => normalizeYAxisField(yAxisField)).filter(
|
|
69791
|
-
(yAxisField) => Boolean(yAxisField)
|
|
69792
|
-
);
|
|
69793
|
-
const requestedYAxisFields = Array.isArray(chartAxisEdits.yAxisFields) ? chartAxisEdits.yAxisFields : fallbackYAxisFields;
|
|
69794
|
-
const normalizedRequestedYAxisFields = requestedYAxisFields.map((yAxisField) => normalizeYAxisField(yAxisField)).filter(
|
|
69795
|
-
(yAxisField) => Boolean(yAxisField)
|
|
69796
|
-
);
|
|
69797
|
-
if (normalizedRequestedYAxisFields.length > 0) {
|
|
69798
|
-
return normalizedRequestedYAxisFields;
|
|
69799
|
-
}
|
|
69800
|
-
if (fallbackYAxisFields.length > 0) {
|
|
69801
|
-
return fallbackYAxisFields;
|
|
69672
|
+
const yAxisMeasures = (0, import_react63.useMemo)(() => {
|
|
69673
|
+
if (yAxisResolved.measures.length > 0) {
|
|
69674
|
+
return yAxisResolved.measures;
|
|
69802
69675
|
}
|
|
69803
69676
|
const fallbackOption = chartAxisOptions[0];
|
|
69804
69677
|
if (!fallbackOption) return [];
|
|
@@ -69809,12 +69682,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69809
69682
|
format: fallbackOption.format
|
|
69810
69683
|
}
|
|
69811
69684
|
];
|
|
69812
|
-
}, [
|
|
69813
|
-
chartAxesBaseChart,
|
|
69814
|
-
chartAxisEdits.yAxisFields,
|
|
69815
|
-
chartAxisOptionByField,
|
|
69816
|
-
chartAxisOptions
|
|
69817
|
-
]);
|
|
69685
|
+
}, [chartAxisOptions, yAxisResolved.measures]);
|
|
69818
69686
|
const resolvedXAxisField = (0, import_react63.useMemo)(() => {
|
|
69819
69687
|
if (!chartAxesBaseChart) return "";
|
|
69820
69688
|
const chartType2 = String(chartAxesBaseChart.chartType ?? "").toLowerCase();
|
|
@@ -69829,7 +69697,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69829
69697
|
return pivotRowField;
|
|
69830
69698
|
}
|
|
69831
69699
|
}
|
|
69832
|
-
const requestedXAxisField = String(
|
|
69700
|
+
const requestedXAxisField = String(axisEdits.xAxisField ?? "").trim();
|
|
69833
69701
|
if (requestedXAxisField && chartAxisOptionByField.has(requestedXAxisField)) {
|
|
69834
69702
|
return requestedXAxisField;
|
|
69835
69703
|
}
|
|
@@ -69837,16 +69705,16 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69837
69705
|
if (baseXAxisField && chartAxisOptionByField.has(baseXAxisField)) {
|
|
69838
69706
|
return baseXAxisField;
|
|
69839
69707
|
}
|
|
69840
|
-
return
|
|
69708
|
+
return yAxisMeasures[0]?.field ?? chartAxisOptions[0]?.value ?? "";
|
|
69841
69709
|
}, [
|
|
69842
69710
|
chartAxesBaseChart,
|
|
69843
|
-
|
|
69711
|
+
axisEdits.xAxisField,
|
|
69844
69712
|
chartAxisOptionByField,
|
|
69845
69713
|
chartAxisOptions,
|
|
69846
|
-
|
|
69714
|
+
yAxisMeasures
|
|
69847
69715
|
]);
|
|
69848
69716
|
const xAxisMetadataField = String(
|
|
69849
|
-
|
|
69717
|
+
axisEdits.xAxisField ?? chartData?.xAxisField ?? ""
|
|
69850
69718
|
).trim();
|
|
69851
69719
|
const xAxisMetadataMatchesResolvedField = !xAxisMetadataField || xAxisMetadataField === resolvedXAxisField;
|
|
69852
69720
|
const resolvedXAxisFormat = (0, import_react63.useMemo)(() => {
|
|
@@ -69854,7 +69722,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69854
69722
|
return "string";
|
|
69855
69723
|
}
|
|
69856
69724
|
let defaultFormat = toAxisFormat(
|
|
69857
|
-
chartAxisOptionByField.get(resolvedXAxisField)?.format ?? chartAxesBaseChart.xAxisFormat ??
|
|
69725
|
+
chartAxisOptionByField.get(resolvedXAxisField)?.format ?? chartAxesBaseChart.xAxisFormat ?? yAxisMeasures[0]?.format,
|
|
69858
69726
|
"string"
|
|
69859
69727
|
);
|
|
69860
69728
|
const bucketFormat = resolvePivotDateBucketXAxisFormat(
|
|
@@ -69862,16 +69730,16 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69862
69730
|
resolvedXAxisField
|
|
69863
69731
|
);
|
|
69864
69732
|
if (bucketFormat) return bucketFormat;
|
|
69865
|
-
if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && (!xAxisMetadataMatchesResolvedField ||
|
|
69733
|
+
if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && (!xAxisMetadataMatchesResolvedField || axisEdits.xAxisFormat === void 0)) {
|
|
69866
69734
|
defaultFormat = "string";
|
|
69867
69735
|
}
|
|
69868
|
-
return xAxisMetadataMatchesResolvedField &&
|
|
69736
|
+
return xAxisMetadataMatchesResolvedField && axisEdits.xAxisFormat !== void 0 ? toAxisFormat(axisEdits.xAxisFormat, defaultFormat) : defaultFormat;
|
|
69869
69737
|
}, [
|
|
69870
69738
|
chartAxesBaseChart,
|
|
69871
|
-
|
|
69739
|
+
axisEdits.xAxisFormat,
|
|
69872
69740
|
chartAxisOptionByField,
|
|
69873
69741
|
resolvedXAxisField,
|
|
69874
|
-
|
|
69742
|
+
yAxisMeasures,
|
|
69875
69743
|
xAxisMetadataMatchesResolvedField
|
|
69876
69744
|
]);
|
|
69877
69745
|
const resolvedXAxisLabel = (0, import_react63.useMemo)(() => {
|
|
@@ -69879,13 +69747,13 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69879
69747
|
const defaultXLabel = String(
|
|
69880
69748
|
xAxisMetadataMatchesResolvedField ? chartAxesBaseChart?.xAxisLabel ?? fieldLabel : fieldLabel
|
|
69881
69749
|
).trim();
|
|
69882
|
-
if (xAxisMetadataMatchesResolvedField &&
|
|
69883
|
-
return String(
|
|
69750
|
+
if (xAxisMetadataMatchesResolvedField && axisEdits.xAxisLabel !== void 0) {
|
|
69751
|
+
return String(axisEdits.xAxisLabel).trim();
|
|
69884
69752
|
}
|
|
69885
69753
|
return !defaultXLabel || defaultXLabel === resolvedXAxisField ? toTitleCaseLabel(resolvedXAxisField) : defaultXLabel;
|
|
69886
69754
|
}, [
|
|
69887
69755
|
chartAxesBaseChart?.xAxisLabel,
|
|
69888
|
-
|
|
69756
|
+
axisEdits.xAxisLabel,
|
|
69889
69757
|
chartAxisOptionByField,
|
|
69890
69758
|
resolvedXAxisField,
|
|
69891
69759
|
xAxisMetadataMatchesResolvedField
|
|
@@ -69915,7 +69783,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69915
69783
|
]);
|
|
69916
69784
|
const yAxis = (0, import_react63.useMemo)(
|
|
69917
69785
|
() => ({
|
|
69918
|
-
fields:
|
|
69786
|
+
fields: yAxisMeasures.map((yAxisField) => ({
|
|
69919
69787
|
field: yAxisField.field,
|
|
69920
69788
|
label: String(yAxisField.label ?? "").trim(),
|
|
69921
69789
|
format: axisFormatToSelectLabel(
|
|
@@ -69923,24 +69791,23 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69923
69791
|
)
|
|
69924
69792
|
}))
|
|
69925
69793
|
}),
|
|
69926
|
-
[
|
|
69794
|
+
[yAxisMeasures]
|
|
69927
69795
|
);
|
|
69928
|
-
const
|
|
69929
|
-
if (
|
|
69930
|
-
|
|
69931
|
-
|
|
69932
|
-
|
|
69933
|
-
|
|
69934
|
-
}, [baseChart, resolvedYAxisFields]);
|
|
69796
|
+
const yAxisSeries = (0, import_react63.useMemo)(() => {
|
|
69797
|
+
if (yAxisResolved.series.length > 0) {
|
|
69798
|
+
return yAxisResolved.series;
|
|
69799
|
+
}
|
|
69800
|
+
return yAxisMeasures;
|
|
69801
|
+
}, [yAxisMeasures, yAxisResolved.series]);
|
|
69935
69802
|
const chart = (0, import_react63.useMemo)(() => {
|
|
69936
69803
|
if (!baseChart) return void 0;
|
|
69937
69804
|
let columns2 = mergeChartColumnFormatsFromYAxisFields(
|
|
69938
69805
|
baseChart.columns,
|
|
69939
|
-
|
|
69806
|
+
yAxisSeries
|
|
69940
69807
|
);
|
|
69941
69808
|
if (String(baseChart.chartType ?? "").toLowerCase() === "table" && baseChart.pivot) {
|
|
69942
69809
|
const pivotAggregations2 = getPivotAggregations(baseChart);
|
|
69943
|
-
const hasCustomMeasureLabel =
|
|
69810
|
+
const hasCustomMeasureLabel = yAxisMeasures.some((axis) => {
|
|
69944
69811
|
const aggregation = findAggregationForFieldStrict(
|
|
69945
69812
|
axis.field,
|
|
69946
69813
|
pivotAggregations2
|
|
@@ -69953,7 +69820,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69953
69820
|
if (pivotAggregations2.length > 1 || hasCustomMeasureLabel) {
|
|
69954
69821
|
columns2 = mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
69955
69822
|
columns: columns2 ?? baseChart.columns,
|
|
69956
|
-
yAxisFields:
|
|
69823
|
+
yAxisFields: yAxisSeries,
|
|
69957
69824
|
pivotRowField: pivotRowKey(baseChart),
|
|
69958
69825
|
xAxisLabel: resolvedXAxisLabel
|
|
69959
69826
|
});
|
|
@@ -69980,7 +69847,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69980
69847
|
xAxisField: resolvedXAxisField,
|
|
69981
69848
|
xAxisFormat: resolvedXAxisFormat,
|
|
69982
69849
|
xAxisLabel: resolvedXAxisLabel,
|
|
69983
|
-
yAxisFields:
|
|
69850
|
+
yAxisFields: yAxisSeries,
|
|
69984
69851
|
columns: columns2 ?? baseChart.columns
|
|
69985
69852
|
};
|
|
69986
69853
|
}, [
|
|
@@ -69988,8 +69855,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69988
69855
|
resolvedXAxisField,
|
|
69989
69856
|
resolvedXAxisFormat,
|
|
69990
69857
|
resolvedXAxisLabel,
|
|
69991
|
-
|
|
69992
|
-
|
|
69858
|
+
yAxisMeasures,
|
|
69859
|
+
yAxisSeries
|
|
69993
69860
|
]);
|
|
69994
69861
|
const pivotDateFilterRangeCacheRef = (0, import_react63.useRef)({ key: "", min: null, max: null });
|
|
69995
69862
|
const filterOptions = (0, import_react63.useMemo)(() => {
|
|
@@ -70007,10 +69874,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70007
69874
|
if (rowField && isDateType(String(pivot?.rowFieldType ?? ""))) {
|
|
70008
69875
|
const field = pivot?.rowFieldTable ? `${pivot.rowFieldTable}.${rowField}` : rowField;
|
|
70009
69876
|
const chartBucket = dateBucket || pivot?.dateBucket || "month";
|
|
70010
|
-
const bucket = inBucketDateBucketForField(
|
|
70011
|
-
filtersForQueryBuilder.rules ?? [],
|
|
70012
|
-
field
|
|
70013
|
-
) ?? chartBucket;
|
|
69877
|
+
const bucket = inBucketDateBucketForField(filtersForQueryBuilder.rules ?? [], field) ?? chartBucket;
|
|
70014
69878
|
const cacheKey = `${String(effectiveReportId ?? "")}\0${field}\0${bucket}`;
|
|
70015
69879
|
if (pivotDateFilterRangeCacheRef.current.key !== cacheKey) {
|
|
70016
69880
|
pivotDateFilterRangeCacheRef.current = {
|
|
@@ -70143,8 +70007,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70143
70007
|
[chartForUi, resolvedChartSort]
|
|
70144
70008
|
);
|
|
70145
70009
|
const isPivotTableChart = String(chartType ?? "").toLowerCase() === "table" && Boolean(pivotState);
|
|
70146
|
-
const
|
|
70147
|
-
() => isPivotTableChart ?
|
|
70010
|
+
const pivotTableColumns = (0, import_react63.useMemo)(
|
|
70011
|
+
() => isPivotTableChart ? buildPivotTableColumns(
|
|
70148
70012
|
pivotState,
|
|
70149
70013
|
chart,
|
|
70150
70014
|
resolveTableDisplayLabel
|
|
@@ -70152,7 +70016,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70152
70016
|
[chart, isPivotTableChart, pivotState, resolveTableDisplayLabel]
|
|
70153
70017
|
);
|
|
70154
70018
|
const chartAxes = (0, import_react63.useMemo)(() => {
|
|
70155
|
-
const yAxisItems =
|
|
70019
|
+
const yAxisItems = yAxisMeasures.map(
|
|
70156
70020
|
(yAxisField, index) => ({
|
|
70157
70021
|
id: String(index),
|
|
70158
70022
|
field: yAxisField.field,
|
|
@@ -70160,7 +70024,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70160
70024
|
format: toAxisFormat(yAxisField.format, "string")
|
|
70161
70025
|
})
|
|
70162
70026
|
);
|
|
70163
|
-
const getCurrentYAxisFields = () =>
|
|
70027
|
+
const getCurrentYAxisFields = () => yAxisMeasures.map((yAxisField) => ({
|
|
70164
70028
|
field: yAxisField.field,
|
|
70165
70029
|
label: yAxisField.label,
|
|
70166
70030
|
format: toAxisFormat(yAxisField.format, "string")
|
|
@@ -70172,7 +70036,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70172
70036
|
options: xAxisOptions,
|
|
70173
70037
|
formatOptions: AXIS_FORMAT_OPTIONS,
|
|
70174
70038
|
update: (updates) => {
|
|
70175
|
-
|
|
70039
|
+
setAxisEdits((previousEdits) => {
|
|
70176
70040
|
const nextEdits = { ...previousEdits };
|
|
70177
70041
|
if (updates.field !== void 0) {
|
|
70178
70042
|
const requestedField = String(updates.field ?? "").trim();
|
|
@@ -70229,7 +70093,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70229
70093
|
resolvedXAxisFormat || "string"
|
|
70230
70094
|
)
|
|
70231
70095
|
};
|
|
70232
|
-
|
|
70096
|
+
setAxisEdits((previousEdits) => ({
|
|
70233
70097
|
...previousEdits,
|
|
70234
70098
|
yAxisFields: [...currentYAxisFields, nextYAxisField]
|
|
70235
70099
|
}));
|
|
@@ -70242,7 +70106,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70242
70106
|
if (index < 0 || index >= currentYAxisFields.length) return;
|
|
70243
70107
|
const nextYAxisFields = [...currentYAxisFields];
|
|
70244
70108
|
nextYAxisFields.splice(index, 1);
|
|
70245
|
-
|
|
70109
|
+
setAxisEdits((previousEdits) => ({
|
|
70246
70110
|
...previousEdits,
|
|
70247
70111
|
yAxisFields: nextYAxisFields
|
|
70248
70112
|
}));
|
|
@@ -70255,7 +70119,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70255
70119
|
newIndex
|
|
70256
70120
|
);
|
|
70257
70121
|
if (nextYAxisFields === currentYAxisFields) return;
|
|
70258
|
-
|
|
70122
|
+
setAxisEdits((previousEdits) => ({
|
|
70259
70123
|
...previousEdits,
|
|
70260
70124
|
yAxisFields: nextYAxisFields
|
|
70261
70125
|
}));
|
|
@@ -70284,7 +70148,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70284
70148
|
label: nextLabel,
|
|
70285
70149
|
format: nextFormat
|
|
70286
70150
|
};
|
|
70287
|
-
|
|
70151
|
+
setAxisEdits((previousEdits) => ({
|
|
70288
70152
|
...previousEdits,
|
|
70289
70153
|
yAxisFields: nextYAxisFields
|
|
70290
70154
|
}));
|
|
@@ -70296,7 +70160,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70296
70160
|
chartAxisOptionByField,
|
|
70297
70161
|
resolvedXAxisField,
|
|
70298
70162
|
resolvedXAxisFormat,
|
|
70299
|
-
|
|
70163
|
+
yAxisMeasures,
|
|
70300
70164
|
xAxisOptions,
|
|
70301
70165
|
yAxisOptions
|
|
70302
70166
|
]);
|
|
@@ -70328,7 +70192,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70328
70192
|
includeSelectedSchemaFallback: tableColumnsEditedSignature !== null
|
|
70329
70193
|
});
|
|
70330
70194
|
const pivotRowFieldForTable = pivotRowKey(sourceReport);
|
|
70331
|
-
const pivotRowTableUsesAxisFormat =
|
|
70195
|
+
const pivotRowTableUsesAxisFormat = axisEdits.xAxisFormat !== void 0;
|
|
70332
70196
|
const columns2 = String(chartType ?? "").toLowerCase() === "table" && sourceReport?.pivot && pivotRowFieldForTable && String(resolvedXAxisField ?? "").trim() === pivotRowFieldForTable ? mergedFromReport.map(
|
|
70333
70197
|
(column) => column.field === pivotRowFieldForTable ? {
|
|
70334
70198
|
...column,
|
|
@@ -70338,7 +70202,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70338
70202
|
) : mergedFromReport;
|
|
70339
70203
|
const pivotLabeledColumns = String(chartType ?? "").toLowerCase() === "table" && sourceReport?.pivot ? mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
70340
70204
|
columns: columns2,
|
|
70341
|
-
yAxisFields:
|
|
70205
|
+
yAxisFields: yAxisSeries,
|
|
70342
70206
|
pivotRowField: pivotRowKey(sourceReport),
|
|
70343
70207
|
xAxisLabel: resolvedXAxisLabel
|
|
70344
70208
|
}) ?? columns2 : columns2;
|
|
@@ -70414,14 +70278,14 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70414
70278
|
getPageOptions: () => getPageOptionsFromPageCount(paginationPageCount)
|
|
70415
70279
|
};
|
|
70416
70280
|
}, [
|
|
70417
|
-
|
|
70281
|
+
axisEdits.xAxisFormat,
|
|
70418
70282
|
chartType,
|
|
70419
70283
|
displayColumns,
|
|
70420
70284
|
effectiveReportBuilderTableNames,
|
|
70421
70285
|
resolvedXAxisField,
|
|
70422
70286
|
resolvedXAxisFormat,
|
|
70423
70287
|
resolvedXAxisLabel,
|
|
70424
|
-
|
|
70288
|
+
yAxisSeries,
|
|
70425
70289
|
scopedSchemaColumns,
|
|
70426
70290
|
sourceReport,
|
|
70427
70291
|
tableColumnsEditedSignature,
|
|
@@ -70446,11 +70310,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70446
70310
|
columnsOptions: tableFormattingColumnOptions,
|
|
70447
70311
|
hasTableDrivenColumnOrder
|
|
70448
70312
|
} = (0, import_react63.useMemo)(() => {
|
|
70449
|
-
if (
|
|
70313
|
+
if (pivotTableColumns) {
|
|
70450
70314
|
return getAllColumnOptions({
|
|
70451
70315
|
schemaColumnOptions,
|
|
70452
|
-
tableColumns:
|
|
70453
|
-
selectedColumnIds:
|
|
70316
|
+
tableColumns: pivotTableColumns.tableColumns,
|
|
70317
|
+
selectedColumnIds: pivotTableColumns.selectedColumnIds
|
|
70454
70318
|
});
|
|
70455
70319
|
}
|
|
70456
70320
|
if (isPivotTableChart) {
|
|
@@ -70471,7 +70335,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70471
70335
|
chart?.xAxisLabel,
|
|
70472
70336
|
columns,
|
|
70473
70337
|
isPivotTableChart,
|
|
70474
|
-
|
|
70338
|
+
pivotTableColumns,
|
|
70475
70339
|
schemaColumnOptions,
|
|
70476
70340
|
table.columns
|
|
70477
70341
|
]);
|
|
@@ -70493,8 +70357,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70493
70357
|
[tableDerivedColumnOrder]
|
|
70494
70358
|
);
|
|
70495
70359
|
const activeTableColumnIds = (0, import_react63.useMemo)(() => {
|
|
70496
|
-
if (
|
|
70497
|
-
return
|
|
70360
|
+
if (pivotTableColumns) {
|
|
70361
|
+
return pivotTableColumns.selectedColumnIds;
|
|
70498
70362
|
}
|
|
70499
70363
|
if (isPivotTableChart) {
|
|
70500
70364
|
return [];
|
|
@@ -70522,7 +70386,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70522
70386
|
columns,
|
|
70523
70387
|
hasTableDrivenColumnOrder,
|
|
70524
70388
|
isPivotTableChart,
|
|
70525
|
-
|
|
70389
|
+
pivotTableColumns,
|
|
70526
70390
|
tableDerivedColumnOrder,
|
|
70527
70391
|
tableFormattingColumnOptions
|
|
70528
70392
|
]);
|
|
@@ -70583,44 +70447,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70583
70447
|
});
|
|
70584
70448
|
}
|
|
70585
70449
|
const columnPivotMeasureFormatByAggregationField = /* @__PURE__ */ new Map();
|
|
70586
|
-
if (
|
|
70587
|
-
const
|
|
70588
|
-
|
|
70589
|
-
const
|
|
70590
|
-
|
|
70591
|
-
|
|
70592
|
-
const firstValueColumnFormat = String(
|
|
70593
|
-
(chart.columns ?? []).find(
|
|
70594
|
-
(c) => String(c.field ?? "").trim() !== rowField
|
|
70595
|
-
)?.format ?? ""
|
|
70596
|
-
).trim();
|
|
70597
|
-
for (let aggIdx = 0; aggIdx < aggregations.length; aggIdx++) {
|
|
70598
|
-
const agg = aggregations[aggIdx];
|
|
70599
|
-
const fieldKey = getAggregationFieldKey(agg, hasMultiple);
|
|
70600
|
-
if (!fieldKey) continue;
|
|
70601
|
-
let fmt = "";
|
|
70602
|
-
if (!hasMultiple) {
|
|
70603
|
-
fmt = String(chart.yAxisFields?.[0]?.format ?? "").trim() || firstValueColumnFormat;
|
|
70604
|
-
} else {
|
|
70605
|
-
for (const yAxisField of chart.yAxisFields ?? []) {
|
|
70606
|
-
const wf = String(yAxisField.field ?? "").trim();
|
|
70607
|
-
if (!wf) continue;
|
|
70608
|
-
const matched = findAggregationForFieldStrict(wf, aggregations);
|
|
70609
|
-
if (!matched || getAggregationIdentityKey(matched) !== getAggregationIdentityKey(agg)) {
|
|
70610
|
-
continue;
|
|
70611
|
-
}
|
|
70612
|
-
fmt = String(yAxisField.format ?? "").trim();
|
|
70613
|
-
break;
|
|
70614
|
-
}
|
|
70615
|
-
if (!fmt && sourceReport?.columns?.[aggIdx + 1]) {
|
|
70616
|
-
fmt = String(
|
|
70617
|
-
sourceReport.columns[aggIdx + 1]?.format ?? ""
|
|
70618
|
-
).trim();
|
|
70619
|
-
}
|
|
70620
|
-
}
|
|
70621
|
-
if (fmt) {
|
|
70622
|
-
columnPivotMeasureFormatByAggregationField.set(fieldKey, fmt);
|
|
70623
|
-
}
|
|
70450
|
+
if (pivotTableColumns) {
|
|
70451
|
+
for (const measure of yAxisResolved.measures) {
|
|
70452
|
+
const field = String(measure.field ?? "").trim();
|
|
70453
|
+
const fmt = String(measure.format ?? "").trim();
|
|
70454
|
+
if (field && fmt) {
|
|
70455
|
+
columnPivotMeasureFormatByAggregationField.set(field, fmt);
|
|
70624
70456
|
}
|
|
70625
70457
|
}
|
|
70626
70458
|
}
|
|
@@ -70671,11 +70503,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70671
70503
|
displayColumnById,
|
|
70672
70504
|
isPivotTableChart,
|
|
70673
70505
|
pivotState,
|
|
70674
|
-
|
|
70506
|
+
pivotTableColumns,
|
|
70675
70507
|
resolvedXAxisFormat,
|
|
70676
70508
|
resolvedXAxisLabel,
|
|
70677
|
-
|
|
70678
|
-
|
|
70509
|
+
tableFormatMerge,
|
|
70510
|
+
yAxisResolved.measures
|
|
70679
70511
|
]);
|
|
70680
70512
|
const tableColumnSettingsCoalesceRef = (0, import_react63.useRef)(
|
|
70681
70513
|
/* @__PURE__ */ new Map()
|
|
@@ -70697,8 +70529,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70697
70529
|
const field = String(option?.field ?? "").trim() || columnId;
|
|
70698
70530
|
const tableName = String(option?.tableName ?? "").trim();
|
|
70699
70531
|
const coercedFormat = coerceTableColumnFormatToAxisValue(format9);
|
|
70700
|
-
const
|
|
70701
|
-
const formatLabel =
|
|
70532
|
+
const isPivotDateRow = isPivotTableChart && field === pivotRowFieldForFormat && isDateType(pivotRowFieldType);
|
|
70533
|
+
const formatLabel = isPivotDateRow && coercedFormat === "string" ? "date" : axisFormatToSelectLabel(coercedFormat);
|
|
70702
70534
|
return {
|
|
70703
70535
|
id: columnId,
|
|
70704
70536
|
label: customLabel || defaultLabel,
|
|
@@ -70891,15 +70723,15 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70891
70723
|
chartAxesBaseChart
|
|
70892
70724
|
);
|
|
70893
70725
|
const clickedAgg = findAggregationForFieldStrict(pivotField, aggs);
|
|
70894
|
-
let nextY =
|
|
70726
|
+
let nextY = yAxisMeasures;
|
|
70895
70727
|
if (updates.format !== void 0) {
|
|
70896
70728
|
const axisFormatStr = tableColumnFormatFromUiSelection(
|
|
70897
70729
|
String(updates.format ?? "").trim()
|
|
70898
70730
|
);
|
|
70899
|
-
nextY =
|
|
70731
|
+
nextY = yAxisMeasures.map((y) => {
|
|
70900
70732
|
const yAgg = findAggregationForFieldStrict(y.field, aggs);
|
|
70901
70733
|
const same = clickedAgg && yAgg && getAggregationIdentityKey(clickedAgg) === getAggregationIdentityKey(yAgg);
|
|
70902
|
-
const singleBroadcast = Boolean(clickedAgg) &&
|
|
70734
|
+
const singleBroadcast = Boolean(clickedAgg) && yAxisMeasures.length === 1;
|
|
70903
70735
|
if (same || singleBroadcast) {
|
|
70904
70736
|
return {
|
|
70905
70737
|
...y,
|
|
@@ -70914,9 +70746,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70914
70746
|
nextY = nextY.map((y) => {
|
|
70915
70747
|
const yAgg = findAggregationForFieldStrict(y.field, aggs);
|
|
70916
70748
|
const same = clickedAgg && yAgg && getAggregationIdentityKey(clickedAgg) === getAggregationIdentityKey(yAgg);
|
|
70917
|
-
const singleBroadcast = Boolean(clickedAgg) &&
|
|
70749
|
+
const singleBroadcast = Boolean(clickedAgg) && yAxisMeasures.length === 1;
|
|
70918
70750
|
if (same || singleBroadcast) {
|
|
70919
|
-
const nextLabel2 =
|
|
70751
|
+
const nextLabel2 = yAxisMeasures.length === 1 && pivotModel.columnField ? mergePivotColumnSeriesLabelWithUserEdit(
|
|
70920
70752
|
String(y.label ?? "").trim(),
|
|
70921
70753
|
lab,
|
|
70922
70754
|
String(y.field ?? "").trim() || void 0
|
|
@@ -71029,7 +70861,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71029
70861
|
...effectiveNextState.xAxis !== void 0 ? { xAxis: effectiveNextState.xAxis } : {},
|
|
71030
70862
|
...effectiveNextState.yAxis !== void 0 ? { yAxis: effectiveNextState.yAxis } : {}
|
|
71031
70863
|
};
|
|
71032
|
-
|
|
70864
|
+
setAxisEdits((previousEdits) => {
|
|
71033
70865
|
const nextEdits = { ...previousEdits };
|
|
71034
70866
|
if (cx.xAxis) {
|
|
71035
70867
|
let suppressXAxisLabelFromPayload = false;
|
|
@@ -71642,7 +71474,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71642
71474
|
xAxisField: resolvedXAxisField,
|
|
71643
71475
|
xAxisFormat: resolvedXAxisFormat,
|
|
71644
71476
|
xAxisLabel: resolvedXAxisLabel,
|
|
71645
|
-
yAxisFields:
|
|
71477
|
+
yAxisFields: yAxisMeasures,
|
|
71646
71478
|
showLegend: chartVisibility.showLegend,
|
|
71647
71479
|
chartSort: resolvedChartSort ?? null,
|
|
71648
71480
|
...overrides?.filterMap !== void 0 ? { filterMap: overrides.filterMap } : {},
|
|
@@ -71695,7 +71527,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71695
71527
|
resolvedXAxisField,
|
|
71696
71528
|
resolvedXAxisFormat,
|
|
71697
71529
|
resolvedXAxisLabel,
|
|
71698
|
-
|
|
71530
|
+
yAxisMeasures,
|
|
71699
71531
|
sourceReport,
|
|
71700
71532
|
table.columns,
|
|
71701
71533
|
tenants
|
|
@@ -71730,9 +71562,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71730
71562
|
groupColumnsByOptions,
|
|
71731
71563
|
dateBucket: dateBucketMode === "standard" ? pivotState?.dateBucket : dateBucket,
|
|
71732
71564
|
dateBucketOptions: hasDatePivotRow ? dateBucketMode === "standard" ? STANDARD_PIVOT_DATE_BUCKET_OPTIONS : PIVOT_DATE_BUCKET_OPTIONS : [],
|
|
71733
|
-
/** Encoded selection per aggregation
|
|
71565
|
+
/** Encoded selection per aggregation (`'sum:transactions::amount'`, `'count:transactions'`, `''` = placeholder). Update via `setReport({ aggregations: nextStringArray })`. */
|
|
71734
71566
|
aggregations: aggregationValues,
|
|
71735
|
-
/** Flat aggregation pick list shared by all
|
|
71567
|
+
/** Flat aggregation pick list shared by all aggregations; always contains every non-empty `aggregations` entry. */
|
|
71736
71568
|
aggregationOptions,
|
|
71737
71569
|
aggregationDescriptionOptions: cleanedAggregations,
|
|
71738
71570
|
sort: cleanedSort,
|