@quillsql/react 2.16.97 → 2.16.99
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 +49 -81
- package/dist/index.js +49 -81
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -63505,7 +63505,7 @@ function pivotFallbackValueKeys(chart) {
|
|
|
63505
63505
|
return (chart.pivotColumns ?? []).slice(1).map((column) => String(column.field ?? "").trim()).filter(Boolean);
|
|
63506
63506
|
}
|
|
63507
63507
|
function findSavedYAxisField(saved, field) {
|
|
63508
|
-
return saved.find((axis) => String(axis.field ?? "").trim() === field)
|
|
63508
|
+
return saved.find((axis) => String(axis.field ?? "").trim() === field);
|
|
63509
63509
|
}
|
|
63510
63510
|
function isPlaceholderAxisLabel(label, field) {
|
|
63511
63511
|
const trimmed = String(label ?? "").trim();
|
|
@@ -63889,6 +63889,19 @@ function mergePivotColumnSeriesLabelWithUserEdit(normalizedLabel, userRowLabel,
|
|
|
63889
63889
|
}
|
|
63890
63890
|
return user;
|
|
63891
63891
|
}
|
|
63892
|
+
function applySingleResolvedYAxisFormatToPivotDisplay(normalizedPivotYAxisFields, resolvedYAxisFields) {
|
|
63893
|
+
if (resolvedYAxisFields.length !== 1) return normalizedPivotYAxisFields;
|
|
63894
|
+
const only = resolvedYAxisFields[0];
|
|
63895
|
+
return normalizedPivotYAxisFields.map((axis) => ({
|
|
63896
|
+
...axis,
|
|
63897
|
+
label: mergePivotColumnSeriesLabelWithUserEdit(
|
|
63898
|
+
String(axis.label ?? "").trim(),
|
|
63899
|
+
only.label,
|
|
63900
|
+
String(axis.field ?? "").trim() || void 0
|
|
63901
|
+
),
|
|
63902
|
+
format: toAxisFormat(only.format, axis.format)
|
|
63903
|
+
}));
|
|
63904
|
+
}
|
|
63892
63905
|
function mergeChartColumnFormatsFromYAxisFields(columns, yAxisFields) {
|
|
63893
63906
|
if (!columns?.length || !yAxisFields?.length) return columns;
|
|
63894
63907
|
const formatByField = /* @__PURE__ */ new Map();
|
|
@@ -63910,10 +63923,6 @@ function mergeChartColumnFormatsFromYAxisFields(columns, yAxisFields) {
|
|
|
63910
63923
|
return { ...col, format: nextFormat };
|
|
63911
63924
|
});
|
|
63912
63925
|
}
|
|
63913
|
-
function looksLikeCustomPivotTableMeasureLabel(label) {
|
|
63914
|
-
const l = String(label ?? "").trim();
|
|
63915
|
-
return l.includes(" \xB7 ") || l.includes(" \u2014 ") || /\([^)]+\)/.test(l);
|
|
63916
|
-
}
|
|
63917
63926
|
function mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
63918
63927
|
columns,
|
|
63919
63928
|
yAxisFields,
|
|
@@ -63923,16 +63932,11 @@ function mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
|
63923
63932
|
if (!columns?.length) return columns;
|
|
63924
63933
|
const row = String(pivotRowField ?? "").trim();
|
|
63925
63934
|
const xLab = String(xAxisLabel ?? "").trim();
|
|
63926
|
-
const yList = (yAxisFields ?? []).map((y) => ({
|
|
63927
|
-
field: String(y.field ?? "").trim(),
|
|
63928
|
-
label: String(y.label ?? "").trim()
|
|
63929
|
-
}));
|
|
63930
|
-
const valueLabels = yList.map((y) => y.label).filter((l) => l.length > 0);
|
|
63931
|
-
const distinct = new Set(valueLabels);
|
|
63932
|
-
const anyCustom = valueLabels.some(looksLikeCustomPivotTableMeasureLabel);
|
|
63933
|
-
const shouldMergeValueLabels = distinct.size > 1 || anyCustom;
|
|
63934
63935
|
const labelByField = new Map(
|
|
63935
|
-
|
|
63936
|
+
(yAxisFields ?? []).map((y) => ({
|
|
63937
|
+
field: String(y.field ?? "").trim(),
|
|
63938
|
+
label: String(y.label ?? "").trim()
|
|
63939
|
+
})).filter((y) => y.field && y.label).map((y) => [y.field, y.label])
|
|
63936
63940
|
);
|
|
63937
63941
|
return columns.map((c) => {
|
|
63938
63942
|
const f = String(c.field ?? "").trim();
|
|
@@ -63940,7 +63944,6 @@ function mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
|
63940
63944
|
if (row && f === row && xLab && xLab !== row) {
|
|
63941
63945
|
return { ...c, label: xLab };
|
|
63942
63946
|
}
|
|
63943
|
-
if (!shouldMergeValueLabels) return c;
|
|
63944
63947
|
const yl = labelByField.get(f);
|
|
63945
63948
|
if (!yl || String(c.label ?? "").trim() === yl) return c;
|
|
63946
63949
|
return { ...c, label: yl };
|
|
@@ -63950,18 +63953,6 @@ function encodeColumnOptionValue(table, field) {
|
|
|
63950
63953
|
if (!table || !table.trim()) return field;
|
|
63951
63954
|
return `${table}_${field}`;
|
|
63952
63955
|
}
|
|
63953
|
-
function isNumericishColumnType(type) {
|
|
63954
|
-
const t = String(type ?? "").toLowerCase();
|
|
63955
|
-
return t === "number" || t === "integer" || t === "float" || t === "decimal" || t === "bigint" || t === "double" || t === "whole_number";
|
|
63956
|
-
}
|
|
63957
|
-
function findSchemaColumnForChartAxisField(chartField, schemaOptions) {
|
|
63958
|
-
const f = String(chartField ?? "").trim();
|
|
63959
|
-
if (!f) return void 0;
|
|
63960
|
-
for (const opt of schemaOptions) {
|
|
63961
|
-
if (opt.value === f || opt.field === f) return opt;
|
|
63962
|
-
}
|
|
63963
|
-
return void 0;
|
|
63964
|
-
}
|
|
63965
63956
|
function getAllColumnOptions({
|
|
63966
63957
|
schemaColumnOptions,
|
|
63967
63958
|
tableColumns,
|
|
@@ -69619,42 +69610,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69619
69610
|
}
|
|
69620
69611
|
return chartAxisOptions;
|
|
69621
69612
|
}, [chartAxesBaseChart, chartAxisOptions, chartAxisOptionByField]);
|
|
69622
|
-
const yAxisOptions = (0, import_react63.useMemo)(() => {
|
|
69623
|
-
if (!chartAxesBaseChart) return [];
|
|
69624
|
-
const keepOption = (option) => {
|
|
69625
|
-
const col = findSchemaColumnForChartAxisField(
|
|
69626
|
-
option.value,
|
|
69627
|
-
schemaColumnOptions
|
|
69628
|
-
);
|
|
69629
|
-
if (!col) return true;
|
|
69630
|
-
return isNumericishColumnType(col.type);
|
|
69631
|
-
};
|
|
69632
|
-
let eligible = chartAxisOptions.filter(keepOption);
|
|
69633
|
-
const pivot = chartAxesBaseChart.pivot;
|
|
69634
|
-
const pivotRowField = String(pivot?.rowField ?? "").trim();
|
|
69635
|
-
if (pivot && !pivotRowField) {
|
|
69636
|
-
const allowed = new Set(yAxisResolved.measures.map((axis) => axis.field));
|
|
69637
|
-
if (allowed.size > 0) {
|
|
69638
|
-
eligible = eligible.filter((o) => allowed.has(o.value));
|
|
69639
|
-
}
|
|
69640
|
-
}
|
|
69641
|
-
const merged = new Map(
|
|
69642
|
-
eligible.map((o) => [o.value, o])
|
|
69643
|
-
);
|
|
69644
|
-
for (const yAxisField of yAxisResolved.measures) {
|
|
69645
|
-
const field = String(yAxisField?.field ?? "").trim();
|
|
69646
|
-
if (!field || merged.has(field)) continue;
|
|
69647
|
-
const opt = chartAxisOptionByField.get(field);
|
|
69648
|
-
if (opt) merged.set(field, opt);
|
|
69649
|
-
}
|
|
69650
|
-
return Array.from(merged.values());
|
|
69651
|
-
}, [
|
|
69652
|
-
chartAxesBaseChart,
|
|
69653
|
-
chartAxisOptionByField,
|
|
69654
|
-
chartAxisOptions,
|
|
69655
|
-
schemaColumnOptions,
|
|
69656
|
-
yAxisResolved.measures
|
|
69657
|
-
]);
|
|
69658
69613
|
const normalizedChartXAxisOptions = (0, import_react63.useMemo)(() => {
|
|
69659
69614
|
return xAxisOptions.map((option) => ({
|
|
69660
69615
|
value: String(option.value ?? "").trim(),
|
|
@@ -69662,13 +69617,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69662
69617
|
format: String(option.format ?? "").trim()
|
|
69663
69618
|
}));
|
|
69664
69619
|
}, [xAxisOptions]);
|
|
69665
|
-
const normalizedChartYAxisOptions = (0, import_react63.useMemo)(() => {
|
|
69666
|
-
return yAxisOptions.map((option) => ({
|
|
69667
|
-
value: String(option.value ?? "").trim(),
|
|
69668
|
-
label: String(option.label ?? option.value ?? "").trim(),
|
|
69669
|
-
format: String(option.format ?? "").trim()
|
|
69670
|
-
}));
|
|
69671
|
-
}, [yAxisOptions]);
|
|
69672
69620
|
const yAxisMeasures = (0, import_react63.useMemo)(() => {
|
|
69673
69621
|
if (yAxisResolved.measures.length > 0) {
|
|
69674
69622
|
return yAxisResolved.measures;
|
|
@@ -69683,6 +69631,21 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69683
69631
|
}
|
|
69684
69632
|
];
|
|
69685
69633
|
}, [chartAxisOptions, yAxisResolved.measures]);
|
|
69634
|
+
const yAxisOptions = (0, import_react63.useMemo)(
|
|
69635
|
+
() => yAxisMeasures.map((measure) => ({
|
|
69636
|
+
value: measure.field,
|
|
69637
|
+
label: measure.label,
|
|
69638
|
+
format: toAxisFormat(measure.format, "string")
|
|
69639
|
+
})),
|
|
69640
|
+
[yAxisMeasures]
|
|
69641
|
+
);
|
|
69642
|
+
const normalizedChartYAxisOptions = (0, import_react63.useMemo)(() => {
|
|
69643
|
+
return yAxisOptions.map((option) => ({
|
|
69644
|
+
value: String(option.value ?? "").trim(),
|
|
69645
|
+
label: String(option.label ?? option.value ?? "").trim(),
|
|
69646
|
+
format: String(option.format ?? "").trim()
|
|
69647
|
+
}));
|
|
69648
|
+
}, [yAxisOptions]);
|
|
69686
69649
|
const resolvedXAxisField = (0, import_react63.useMemo)(() => {
|
|
69687
69650
|
if (!chartAxesBaseChart) return "";
|
|
69688
69651
|
const chartType2 = String(chartAxesBaseChart.chartType ?? "").toLowerCase();
|
|
@@ -69795,10 +69758,16 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69795
69758
|
);
|
|
69796
69759
|
const yAxisSeries = (0, import_react63.useMemo)(() => {
|
|
69797
69760
|
if (yAxisResolved.series.length > 0) {
|
|
69761
|
+
if (yAxisResolved.measures.length === 1 && yAxisResolved.series !== yAxisResolved.measures) {
|
|
69762
|
+
return applySingleResolvedYAxisFormatToPivotDisplay(
|
|
69763
|
+
yAxisResolved.series,
|
|
69764
|
+
yAxisResolved.measures
|
|
69765
|
+
);
|
|
69766
|
+
}
|
|
69798
69767
|
return yAxisResolved.series;
|
|
69799
69768
|
}
|
|
69800
69769
|
return yAxisMeasures;
|
|
69801
|
-
}, [yAxisMeasures, yAxisResolved.series]);
|
|
69770
|
+
}, [yAxisMeasures, yAxisResolved.measures, yAxisResolved.series]);
|
|
69802
69771
|
const chart = (0, import_react63.useMemo)(() => {
|
|
69803
69772
|
if (!baseChart) return void 0;
|
|
69804
69773
|
let columns2 = mergeChartColumnFormatsFromYAxisFields(
|
|
@@ -69820,7 +69789,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69820
69789
|
if (pivotAggregations2.length > 1 || hasCustomMeasureLabel) {
|
|
69821
69790
|
columns2 = mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
69822
69791
|
columns: columns2 ?? baseChart.columns,
|
|
69823
|
-
yAxisFields: yAxisSeries,
|
|
69792
|
+
yAxisFields: [...yAxisMeasures, ...yAxisSeries],
|
|
69824
69793
|
pivotRowField: pivotRowKey(baseChart),
|
|
69825
69794
|
xAxisLabel: resolvedXAxisLabel
|
|
69826
69795
|
});
|
|
@@ -70202,7 +70171,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70202
70171
|
) : mergedFromReport;
|
|
70203
70172
|
const pivotLabeledColumns = String(chartType ?? "").toLowerCase() === "table" && sourceReport?.pivot ? mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
70204
70173
|
columns: columns2,
|
|
70205
|
-
yAxisFields: yAxisSeries,
|
|
70174
|
+
yAxisFields: [...yAxisMeasures, ...yAxisSeries],
|
|
70206
70175
|
pivotRowField: pivotRowKey(sourceReport),
|
|
70207
70176
|
xAxisLabel: resolvedXAxisLabel
|
|
70208
70177
|
}) ?? columns2 : columns2;
|
|
@@ -70285,6 +70254,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70285
70254
|
resolvedXAxisField,
|
|
70286
70255
|
resolvedXAxisFormat,
|
|
70287
70256
|
resolvedXAxisLabel,
|
|
70257
|
+
yAxisMeasures,
|
|
70288
70258
|
yAxisSeries,
|
|
70289
70259
|
scopedSchemaColumns,
|
|
70290
70260
|
sourceReport,
|
|
@@ -70438,7 +70408,10 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70438
70408
|
}
|
|
70439
70409
|
}
|
|
70440
70410
|
const yAxisByField = /* @__PURE__ */ new Map();
|
|
70441
|
-
for (const yAxisField of
|
|
70411
|
+
for (const yAxisField of [
|
|
70412
|
+
...chart?.yAxisFields ?? [],
|
|
70413
|
+
...yAxisResolved.measures
|
|
70414
|
+
]) {
|
|
70442
70415
|
const f = String(yAxisField.field ?? "").trim();
|
|
70443
70416
|
if (!f || yAxisByField.has(f)) continue;
|
|
70444
70417
|
yAxisByField.set(f, {
|
|
@@ -70488,7 +70461,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70488
70461
|
).trim();
|
|
70489
70462
|
const resolvedColFormat = isRowPivotCol ? String(resolvedXAxisFormat ?? "").trim() || effectiveFromId || mergeByFieldFormat || fromDisplay || String(chartFallback?.format ?? "").trim() || "string" : fromDisplay || effectiveFromId || mergeByFieldFormat;
|
|
70490
70463
|
map.set(columnId, {
|
|
70491
|
-
label:
|
|
70464
|
+
label: isPivotTableChart ? pivotLabel || selectedLabel : selectedLabel || pivotLabel || persistedTableLabel,
|
|
70492
70465
|
format: resolvedColFormat
|
|
70493
70466
|
});
|
|
70494
70467
|
}
|
|
@@ -70748,12 +70721,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70748
70721
|
const same = clickedAgg && yAgg && getAggregationIdentityKey(clickedAgg) === getAggregationIdentityKey(yAgg);
|
|
70749
70722
|
const singleBroadcast = Boolean(clickedAgg) && yAxisMeasures.length === 1;
|
|
70750
70723
|
if (same || singleBroadcast) {
|
|
70751
|
-
|
|
70752
|
-
String(y.label ?? "").trim(),
|
|
70753
|
-
lab,
|
|
70754
|
-
String(y.field ?? "").trim() || void 0
|
|
70755
|
-
) : lab;
|
|
70756
|
-
return { ...y, label: nextLabel2 };
|
|
70724
|
+
return { ...y, label: lab };
|
|
70757
70725
|
}
|
|
70758
70726
|
return y;
|
|
70759
70727
|
});
|
package/dist/index.js
CHANGED
|
@@ -63713,7 +63713,7 @@ function pivotFallbackValueKeys(chart) {
|
|
|
63713
63713
|
return (chart.pivotColumns ?? []).slice(1).map((column) => String(column.field ?? "").trim()).filter(Boolean);
|
|
63714
63714
|
}
|
|
63715
63715
|
function findSavedYAxisField(saved, field) {
|
|
63716
|
-
return saved.find((axis) => String(axis.field ?? "").trim() === field)
|
|
63716
|
+
return saved.find((axis) => String(axis.field ?? "").trim() === field);
|
|
63717
63717
|
}
|
|
63718
63718
|
function isPlaceholderAxisLabel(label, field) {
|
|
63719
63719
|
const trimmed = String(label ?? "").trim();
|
|
@@ -64097,6 +64097,19 @@ function mergePivotColumnSeriesLabelWithUserEdit(normalizedLabel, userRowLabel,
|
|
|
64097
64097
|
}
|
|
64098
64098
|
return user;
|
|
64099
64099
|
}
|
|
64100
|
+
function applySingleResolvedYAxisFormatToPivotDisplay(normalizedPivotYAxisFields, resolvedYAxisFields) {
|
|
64101
|
+
if (resolvedYAxisFields.length !== 1) return normalizedPivotYAxisFields;
|
|
64102
|
+
const only = resolvedYAxisFields[0];
|
|
64103
|
+
return normalizedPivotYAxisFields.map((axis) => ({
|
|
64104
|
+
...axis,
|
|
64105
|
+
label: mergePivotColumnSeriesLabelWithUserEdit(
|
|
64106
|
+
String(axis.label ?? "").trim(),
|
|
64107
|
+
only.label,
|
|
64108
|
+
String(axis.field ?? "").trim() || void 0
|
|
64109
|
+
),
|
|
64110
|
+
format: toAxisFormat(only.format, axis.format)
|
|
64111
|
+
}));
|
|
64112
|
+
}
|
|
64100
64113
|
function mergeChartColumnFormatsFromYAxisFields(columns, yAxisFields) {
|
|
64101
64114
|
if (!columns?.length || !yAxisFields?.length) return columns;
|
|
64102
64115
|
const formatByField = /* @__PURE__ */ new Map();
|
|
@@ -64118,10 +64131,6 @@ function mergeChartColumnFormatsFromYAxisFields(columns, yAxisFields) {
|
|
|
64118
64131
|
return { ...col, format: nextFormat };
|
|
64119
64132
|
});
|
|
64120
64133
|
}
|
|
64121
|
-
function looksLikeCustomPivotTableMeasureLabel(label) {
|
|
64122
|
-
const l = String(label ?? "").trim();
|
|
64123
|
-
return l.includes(" \xB7 ") || l.includes(" \u2014 ") || /\([^)]+\)/.test(l);
|
|
64124
|
-
}
|
|
64125
64134
|
function mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
64126
64135
|
columns,
|
|
64127
64136
|
yAxisFields,
|
|
@@ -64131,16 +64140,11 @@ function mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
|
64131
64140
|
if (!columns?.length) return columns;
|
|
64132
64141
|
const row = String(pivotRowField ?? "").trim();
|
|
64133
64142
|
const xLab = String(xAxisLabel ?? "").trim();
|
|
64134
|
-
const yList = (yAxisFields ?? []).map((y) => ({
|
|
64135
|
-
field: String(y.field ?? "").trim(),
|
|
64136
|
-
label: String(y.label ?? "").trim()
|
|
64137
|
-
}));
|
|
64138
|
-
const valueLabels = yList.map((y) => y.label).filter((l) => l.length > 0);
|
|
64139
|
-
const distinct = new Set(valueLabels);
|
|
64140
|
-
const anyCustom = valueLabels.some(looksLikeCustomPivotTableMeasureLabel);
|
|
64141
|
-
const shouldMergeValueLabels = distinct.size > 1 || anyCustom;
|
|
64142
64143
|
const labelByField = new Map(
|
|
64143
|
-
|
|
64144
|
+
(yAxisFields ?? []).map((y) => ({
|
|
64145
|
+
field: String(y.field ?? "").trim(),
|
|
64146
|
+
label: String(y.label ?? "").trim()
|
|
64147
|
+
})).filter((y) => y.field && y.label).map((y) => [y.field, y.label])
|
|
64144
64148
|
);
|
|
64145
64149
|
return columns.map((c) => {
|
|
64146
64150
|
const f = String(c.field ?? "").trim();
|
|
@@ -64148,7 +64152,6 @@ function mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
|
64148
64152
|
if (row && f === row && xLab && xLab !== row) {
|
|
64149
64153
|
return { ...c, label: xLab };
|
|
64150
64154
|
}
|
|
64151
|
-
if (!shouldMergeValueLabels) return c;
|
|
64152
64155
|
const yl = labelByField.get(f);
|
|
64153
64156
|
if (!yl || String(c.label ?? "").trim() === yl) return c;
|
|
64154
64157
|
return { ...c, label: yl };
|
|
@@ -64158,18 +64161,6 @@ function encodeColumnOptionValue(table, field) {
|
|
|
64158
64161
|
if (!table || !table.trim()) return field;
|
|
64159
64162
|
return `${table}_${field}`;
|
|
64160
64163
|
}
|
|
64161
|
-
function isNumericishColumnType(type) {
|
|
64162
|
-
const t = String(type ?? "").toLowerCase();
|
|
64163
|
-
return t === "number" || t === "integer" || t === "float" || t === "decimal" || t === "bigint" || t === "double" || t === "whole_number";
|
|
64164
|
-
}
|
|
64165
|
-
function findSchemaColumnForChartAxisField(chartField, schemaOptions) {
|
|
64166
|
-
const f = String(chartField ?? "").trim();
|
|
64167
|
-
if (!f) return void 0;
|
|
64168
|
-
for (const opt of schemaOptions) {
|
|
64169
|
-
if (opt.value === f || opt.field === f) return opt;
|
|
64170
|
-
}
|
|
64171
|
-
return void 0;
|
|
64172
|
-
}
|
|
64173
64164
|
function getAllColumnOptions({
|
|
64174
64165
|
schemaColumnOptions,
|
|
64175
64166
|
tableColumns,
|
|
@@ -69827,42 +69818,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69827
69818
|
}
|
|
69828
69819
|
return chartAxisOptions;
|
|
69829
69820
|
}, [chartAxesBaseChart, chartAxisOptions, chartAxisOptionByField]);
|
|
69830
|
-
const yAxisOptions = useMemo33(() => {
|
|
69831
|
-
if (!chartAxesBaseChart) return [];
|
|
69832
|
-
const keepOption = (option) => {
|
|
69833
|
-
const col = findSchemaColumnForChartAxisField(
|
|
69834
|
-
option.value,
|
|
69835
|
-
schemaColumnOptions
|
|
69836
|
-
);
|
|
69837
|
-
if (!col) return true;
|
|
69838
|
-
return isNumericishColumnType(col.type);
|
|
69839
|
-
};
|
|
69840
|
-
let eligible = chartAxisOptions.filter(keepOption);
|
|
69841
|
-
const pivot = chartAxesBaseChart.pivot;
|
|
69842
|
-
const pivotRowField = String(pivot?.rowField ?? "").trim();
|
|
69843
|
-
if (pivot && !pivotRowField) {
|
|
69844
|
-
const allowed = new Set(yAxisResolved.measures.map((axis) => axis.field));
|
|
69845
|
-
if (allowed.size > 0) {
|
|
69846
|
-
eligible = eligible.filter((o) => allowed.has(o.value));
|
|
69847
|
-
}
|
|
69848
|
-
}
|
|
69849
|
-
const merged = new Map(
|
|
69850
|
-
eligible.map((o) => [o.value, o])
|
|
69851
|
-
);
|
|
69852
|
-
for (const yAxisField of yAxisResolved.measures) {
|
|
69853
|
-
const field = String(yAxisField?.field ?? "").trim();
|
|
69854
|
-
if (!field || merged.has(field)) continue;
|
|
69855
|
-
const opt = chartAxisOptionByField.get(field);
|
|
69856
|
-
if (opt) merged.set(field, opt);
|
|
69857
|
-
}
|
|
69858
|
-
return Array.from(merged.values());
|
|
69859
|
-
}, [
|
|
69860
|
-
chartAxesBaseChart,
|
|
69861
|
-
chartAxisOptionByField,
|
|
69862
|
-
chartAxisOptions,
|
|
69863
|
-
schemaColumnOptions,
|
|
69864
|
-
yAxisResolved.measures
|
|
69865
|
-
]);
|
|
69866
69821
|
const normalizedChartXAxisOptions = useMemo33(() => {
|
|
69867
69822
|
return xAxisOptions.map((option) => ({
|
|
69868
69823
|
value: String(option.value ?? "").trim(),
|
|
@@ -69870,13 +69825,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69870
69825
|
format: String(option.format ?? "").trim()
|
|
69871
69826
|
}));
|
|
69872
69827
|
}, [xAxisOptions]);
|
|
69873
|
-
const normalizedChartYAxisOptions = useMemo33(() => {
|
|
69874
|
-
return yAxisOptions.map((option) => ({
|
|
69875
|
-
value: String(option.value ?? "").trim(),
|
|
69876
|
-
label: String(option.label ?? option.value ?? "").trim(),
|
|
69877
|
-
format: String(option.format ?? "").trim()
|
|
69878
|
-
}));
|
|
69879
|
-
}, [yAxisOptions]);
|
|
69880
69828
|
const yAxisMeasures = useMemo33(() => {
|
|
69881
69829
|
if (yAxisResolved.measures.length > 0) {
|
|
69882
69830
|
return yAxisResolved.measures;
|
|
@@ -69891,6 +69839,21 @@ function useReport(reportIdArg, options = {}) {
|
|
|
69891
69839
|
}
|
|
69892
69840
|
];
|
|
69893
69841
|
}, [chartAxisOptions, yAxisResolved.measures]);
|
|
69842
|
+
const yAxisOptions = useMemo33(
|
|
69843
|
+
() => yAxisMeasures.map((measure) => ({
|
|
69844
|
+
value: measure.field,
|
|
69845
|
+
label: measure.label,
|
|
69846
|
+
format: toAxisFormat(measure.format, "string")
|
|
69847
|
+
})),
|
|
69848
|
+
[yAxisMeasures]
|
|
69849
|
+
);
|
|
69850
|
+
const normalizedChartYAxisOptions = useMemo33(() => {
|
|
69851
|
+
return yAxisOptions.map((option) => ({
|
|
69852
|
+
value: String(option.value ?? "").trim(),
|
|
69853
|
+
label: String(option.label ?? option.value ?? "").trim(),
|
|
69854
|
+
format: String(option.format ?? "").trim()
|
|
69855
|
+
}));
|
|
69856
|
+
}, [yAxisOptions]);
|
|
69894
69857
|
const resolvedXAxisField = useMemo33(() => {
|
|
69895
69858
|
if (!chartAxesBaseChart) return "";
|
|
69896
69859
|
const chartType2 = String(chartAxesBaseChart.chartType ?? "").toLowerCase();
|
|
@@ -70003,10 +69966,16 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70003
69966
|
);
|
|
70004
69967
|
const yAxisSeries = useMemo33(() => {
|
|
70005
69968
|
if (yAxisResolved.series.length > 0) {
|
|
69969
|
+
if (yAxisResolved.measures.length === 1 && yAxisResolved.series !== yAxisResolved.measures) {
|
|
69970
|
+
return applySingleResolvedYAxisFormatToPivotDisplay(
|
|
69971
|
+
yAxisResolved.series,
|
|
69972
|
+
yAxisResolved.measures
|
|
69973
|
+
);
|
|
69974
|
+
}
|
|
70006
69975
|
return yAxisResolved.series;
|
|
70007
69976
|
}
|
|
70008
69977
|
return yAxisMeasures;
|
|
70009
|
-
}, [yAxisMeasures, yAxisResolved.series]);
|
|
69978
|
+
}, [yAxisMeasures, yAxisResolved.measures, yAxisResolved.series]);
|
|
70010
69979
|
const chart = useMemo33(() => {
|
|
70011
69980
|
if (!baseChart) return void 0;
|
|
70012
69981
|
let columns2 = mergeChartColumnFormatsFromYAxisFields(
|
|
@@ -70028,7 +69997,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70028
69997
|
if (pivotAggregations2.length > 1 || hasCustomMeasureLabel) {
|
|
70029
69998
|
columns2 = mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
70030
69999
|
columns: columns2 ?? baseChart.columns,
|
|
70031
|
-
yAxisFields: yAxisSeries,
|
|
70000
|
+
yAxisFields: [...yAxisMeasures, ...yAxisSeries],
|
|
70032
70001
|
pivotRowField: pivotRowKey(baseChart),
|
|
70033
70002
|
xAxisLabel: resolvedXAxisLabel
|
|
70034
70003
|
});
|
|
@@ -70410,7 +70379,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70410
70379
|
) : mergedFromReport;
|
|
70411
70380
|
const pivotLabeledColumns = String(chartType ?? "").toLowerCase() === "table" && sourceReport?.pivot ? mergePivotTableDisplayColumnLabelsFromYAxis({
|
|
70412
70381
|
columns: columns2,
|
|
70413
|
-
yAxisFields: yAxisSeries,
|
|
70382
|
+
yAxisFields: [...yAxisMeasures, ...yAxisSeries],
|
|
70414
70383
|
pivotRowField: pivotRowKey(sourceReport),
|
|
70415
70384
|
xAxisLabel: resolvedXAxisLabel
|
|
70416
70385
|
}) ?? columns2 : columns2;
|
|
@@ -70493,6 +70462,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70493
70462
|
resolvedXAxisField,
|
|
70494
70463
|
resolvedXAxisFormat,
|
|
70495
70464
|
resolvedXAxisLabel,
|
|
70465
|
+
yAxisMeasures,
|
|
70496
70466
|
yAxisSeries,
|
|
70497
70467
|
scopedSchemaColumns,
|
|
70498
70468
|
sourceReport,
|
|
@@ -70646,7 +70616,10 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70646
70616
|
}
|
|
70647
70617
|
}
|
|
70648
70618
|
const yAxisByField = /* @__PURE__ */ new Map();
|
|
70649
|
-
for (const yAxisField of
|
|
70619
|
+
for (const yAxisField of [
|
|
70620
|
+
...chart?.yAxisFields ?? [],
|
|
70621
|
+
...yAxisResolved.measures
|
|
70622
|
+
]) {
|
|
70650
70623
|
const f = String(yAxisField.field ?? "").trim();
|
|
70651
70624
|
if (!f || yAxisByField.has(f)) continue;
|
|
70652
70625
|
yAxisByField.set(f, {
|
|
@@ -70696,7 +70669,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70696
70669
|
).trim();
|
|
70697
70670
|
const resolvedColFormat = isRowPivotCol ? String(resolvedXAxisFormat ?? "").trim() || effectiveFromId || mergeByFieldFormat || fromDisplay || String(chartFallback?.format ?? "").trim() || "string" : fromDisplay || effectiveFromId || mergeByFieldFormat;
|
|
70698
70671
|
map.set(columnId, {
|
|
70699
|
-
label:
|
|
70672
|
+
label: isPivotTableChart ? pivotLabel || selectedLabel : selectedLabel || pivotLabel || persistedTableLabel,
|
|
70700
70673
|
format: resolvedColFormat
|
|
70701
70674
|
});
|
|
70702
70675
|
}
|
|
@@ -70956,12 +70929,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
70956
70929
|
const same = clickedAgg && yAgg && getAggregationIdentityKey(clickedAgg) === getAggregationIdentityKey(yAgg);
|
|
70957
70930
|
const singleBroadcast = Boolean(clickedAgg) && yAxisMeasures.length === 1;
|
|
70958
70931
|
if (same || singleBroadcast) {
|
|
70959
|
-
|
|
70960
|
-
String(y.label ?? "").trim(),
|
|
70961
|
-
lab,
|
|
70962
|
-
String(y.field ?? "").trim() || void 0
|
|
70963
|
-
) : lab;
|
|
70964
|
-
return { ...y, label: nextLabel2 };
|
|
70932
|
+
return { ...y, label: lab };
|
|
70965
70933
|
}
|
|
70966
70934
|
return y;
|
|
70967
70935
|
});
|