@quillsql/react 2.16.71 → 2.16.73
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 +89 -30
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +89 -30
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -47955,6 +47955,14 @@ var CHART_TYPES = [
|
|
|
47955
47955
|
"US map",
|
|
47956
47956
|
"World map"
|
|
47957
47957
|
];
|
|
47958
|
+
var SINGLE_AGGREGATION_CHART_TYPES = [
|
|
47959
|
+
"stacked",
|
|
47960
|
+
"stacked bar",
|
|
47961
|
+
"bar",
|
|
47962
|
+
"pie",
|
|
47963
|
+
"gauge",
|
|
47964
|
+
"metric"
|
|
47965
|
+
];
|
|
47958
47966
|
var CHART_TO_LABELS = {
|
|
47959
47967
|
column: { xAxisLabel: "X-Axis", yAxisLabel: "Y-Axis" },
|
|
47960
47968
|
line: { xAxisLabel: "X-Axis", yAxisLabel: "Y-Axis" },
|
|
@@ -48161,7 +48169,10 @@ function getPivotMetricOptions(pivot, selectedPivotTable, chartType) {
|
|
|
48161
48169
|
}
|
|
48162
48170
|
}
|
|
48163
48171
|
function getChartTypeOptions(formData, dashboard) {
|
|
48164
|
-
|
|
48172
|
+
const hasMultipleAggregations = (formData.pivot?.aggregations?.length ?? 0) > 1;
|
|
48173
|
+
let viableCharts = CHART_TYPES.filter(
|
|
48174
|
+
(chartType) => !(hasMultipleAggregations && SINGLE_AGGREGATION_CHART_TYPES.includes(chartType))
|
|
48175
|
+
);
|
|
48165
48176
|
if (dashboard && dashboard.dateFilter && dashboard.dateFilter.comparison) {
|
|
48166
48177
|
viableCharts = viableCharts.filter(
|
|
48167
48178
|
(chart) => ![
|
|
@@ -49686,18 +49697,23 @@ function ChartBuilder({
|
|
|
49686
49697
|
(col) => col.field === pivot.rowField
|
|
49687
49698
|
);
|
|
49688
49699
|
}) : void 0;
|
|
49689
|
-
|
|
49690
|
-
...
|
|
49700
|
+
const updatedFormData = {
|
|
49701
|
+
...formData,
|
|
49691
49702
|
...newPivotFormData,
|
|
49692
|
-
...keepOldChartType && { chartType:
|
|
49693
|
-
dateField: dateField ? { table: dateField.name, field: pivot.rowField } :
|
|
49694
|
-
}
|
|
49695
|
-
|
|
49696
|
-
|
|
49697
|
-
|
|
49698
|
-
dashboardConfig[formData.dashboardName || ""]
|
|
49699
|
-
)
|
|
49703
|
+
...keepOldChartType && { chartType: formData.chartType },
|
|
49704
|
+
dateField: dateField ? { table: dateField.name, field: pivot.rowField } : formData.dateField
|
|
49705
|
+
};
|
|
49706
|
+
const chartTypeOptions = getChartTypeOptions(
|
|
49707
|
+
updatedFormData,
|
|
49708
|
+
dashboardConfig[formData.dashboardName || ""]
|
|
49700
49709
|
);
|
|
49710
|
+
if (!chartTypeOptions.some(
|
|
49711
|
+
(option) => option.value === updatedFormData.chartType
|
|
49712
|
+
)) {
|
|
49713
|
+
updatedFormData.chartType = chartTypeOptions[0]?.value ?? "table";
|
|
49714
|
+
}
|
|
49715
|
+
setFormData(updatedFormData);
|
|
49716
|
+
setChartTypes(chartTypeOptions);
|
|
49701
49717
|
};
|
|
49702
49718
|
const handleDeletePivot = () => {
|
|
49703
49719
|
if (!formData.pivot) {
|
|
@@ -61745,13 +61761,7 @@ function mergeReportBuilderTables(baseTables, tableNamesToInclude, foreignKeyMap
|
|
|
61745
61761
|
if (attachedTableCount > 0) {
|
|
61746
61762
|
continue;
|
|
61747
61763
|
}
|
|
61748
|
-
|
|
61749
|
-
if (!nextTableName) {
|
|
61750
|
-
break;
|
|
61751
|
-
}
|
|
61752
|
-
attachedTables.push(
|
|
61753
|
-
baseTableByName.get(nextTableName) ?? { name: nextTableName }
|
|
61754
|
-
);
|
|
61764
|
+
break;
|
|
61755
61765
|
}
|
|
61756
61766
|
return attachedTables;
|
|
61757
61767
|
}
|
|
@@ -61997,6 +62007,11 @@ function resolveTableColumnDefaultFormat({
|
|
|
61997
62007
|
}
|
|
61998
62008
|
return currentFormat;
|
|
61999
62009
|
}
|
|
62010
|
+
function resolveTableColumnLabel(fieldRaw, labelRaw) {
|
|
62011
|
+
const field = String(fieldRaw ?? "").trim();
|
|
62012
|
+
const label = String(labelRaw ?? "").trim();
|
|
62013
|
+
return !label || label === field ? toTitleCaseLabel(field) : label;
|
|
62014
|
+
}
|
|
62000
62015
|
function mergeDisplayAndSourceForTableFormats(args) {
|
|
62001
62016
|
const {
|
|
62002
62017
|
effectiveReportBuilderTableNames,
|
|
@@ -62050,6 +62065,7 @@ function mergeDisplayAndSourceForTableFormats(args) {
|
|
|
62050
62065
|
};
|
|
62051
62066
|
}).filter((column) => Boolean(column));
|
|
62052
62067
|
const formatByColumnOptionId = /* @__PURE__ */ new Map();
|
|
62068
|
+
const labelByColumnOptionId = /* @__PURE__ */ new Map();
|
|
62053
62069
|
let columnsWithTableMeta = [];
|
|
62054
62070
|
if (normalizedSourceColumns.length > 0 && normalizedDisplayColumns.length > 0) {
|
|
62055
62071
|
const sourceColumnsByKey = /* @__PURE__ */ new Map();
|
|
@@ -62151,21 +62167,27 @@ function mergeDisplayAndSourceForTableFormats(args) {
|
|
|
62151
62167
|
const id = encodeColumnOptionValue(selection.table, selection.field);
|
|
62152
62168
|
if (id) {
|
|
62153
62169
|
formatByColumnOptionId.set(id, String(merged.format ?? "").trim());
|
|
62170
|
+
labelByColumnOptionId.set(
|
|
62171
|
+
id,
|
|
62172
|
+
resolveTableColumnLabel(merged.field, merged.label)
|
|
62173
|
+
);
|
|
62154
62174
|
}
|
|
62155
62175
|
}
|
|
62156
62176
|
columnsWithTableMeta = selectedColumnsForTable;
|
|
62157
62177
|
}
|
|
62158
62178
|
const columns = columnsWithTableMeta.map((column) => {
|
|
62159
62179
|
const field = column.field;
|
|
62160
|
-
const rawLabel = String(column.label ?? "").trim();
|
|
62161
|
-
const label = !rawLabel || rawLabel === field ? toTitleCaseLabel(field) : rawLabel;
|
|
62162
62180
|
return {
|
|
62163
|
-
label,
|
|
62181
|
+
label: resolveTableColumnLabel(field, column.label),
|
|
62164
62182
|
field,
|
|
62165
62183
|
format: column.format
|
|
62166
62184
|
};
|
|
62167
62185
|
});
|
|
62168
|
-
return {
|
|
62186
|
+
return {
|
|
62187
|
+
columns,
|
|
62188
|
+
formatByColumnOptionId,
|
|
62189
|
+
labelByColumnOptionId
|
|
62190
|
+
};
|
|
62169
62191
|
}
|
|
62170
62192
|
function axisFormatToSelectLabel(format9) {
|
|
62171
62193
|
const raw = String(format9 ?? "").trim();
|
|
@@ -62220,9 +62242,20 @@ var CHART_TYPES2 = [
|
|
|
62220
62242
|
"US map",
|
|
62221
62243
|
"World map"
|
|
62222
62244
|
];
|
|
62245
|
+
var SINGLE_AGGREGATION_CHART_TYPES2 = [
|
|
62246
|
+
"stacked",
|
|
62247
|
+
"stacked bar",
|
|
62248
|
+
"bar",
|
|
62249
|
+
"pie",
|
|
62250
|
+
"gauge",
|
|
62251
|
+
"metric"
|
|
62252
|
+
];
|
|
62223
62253
|
var DEFAULT_CHART_TYPE = "table";
|
|
62224
62254
|
function getChartTypeOptions2(formData) {
|
|
62225
|
-
const
|
|
62255
|
+
const hasMultipleAggregations = (formData.pivot?.aggregations?.length ?? 0) > 1;
|
|
62256
|
+
const viableCharts = CHART_TYPES2.filter(
|
|
62257
|
+
(chartType) => !(hasMultipleAggregations && SINGLE_AGGREGATION_CHART_TYPES2.includes(chartType))
|
|
62258
|
+
);
|
|
62226
62259
|
if (formData.pivot && !formData.pivot.rowField) {
|
|
62227
62260
|
return viableCharts.filter((elem) => ["table", "metric", "gauge"].includes(elem)).map((elem) => ({ label: elem, value: elem }));
|
|
62228
62261
|
}
|
|
@@ -63724,16 +63757,28 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63724
63757
|
queryColumnsBootstrapKey
|
|
63725
63758
|
]);
|
|
63726
63759
|
const datasourceOptions = (0, import_react61.useMemo)(() => {
|
|
63760
|
+
const tableNames = new Set(
|
|
63761
|
+
schemaForReportBuilderState.map((table2) => String(table2.name ?? "").trim()).filter(Boolean)
|
|
63762
|
+
);
|
|
63727
63763
|
const seen = /* @__PURE__ */ new Set();
|
|
63728
63764
|
const result = [];
|
|
63729
63765
|
for (const table2 of schemaForReportBuilderState) {
|
|
63730
63766
|
const name2 = String(table2.name ?? "").trim();
|
|
63731
63767
|
if (!name2 || seen.has(name2)) continue;
|
|
63732
63768
|
seen.add(name2);
|
|
63733
|
-
result.push({
|
|
63769
|
+
result.push({
|
|
63770
|
+
value: name2,
|
|
63771
|
+
label: toTitleCaseLabel(name2),
|
|
63772
|
+
joinOptions: getJoinCompatibleTableNames(
|
|
63773
|
+
[name2],
|
|
63774
|
+
schemaForeignKeyMap
|
|
63775
|
+
).filter(
|
|
63776
|
+
(candidate) => candidate !== name2 && tableNames.has(candidate)
|
|
63777
|
+
)
|
|
63778
|
+
});
|
|
63734
63779
|
}
|
|
63735
63780
|
return result;
|
|
63736
|
-
}, [schemaForReportBuilderState]);
|
|
63781
|
+
}, [schemaForReportBuilderState, schemaForeignKeyMap]);
|
|
63737
63782
|
const queryBuilderFieldConfigByName = (0, import_react61.useMemo)(() => {
|
|
63738
63783
|
const configByName = buildQueryBuilderFieldConfigByName(
|
|
63739
63784
|
schemaForReportBuilderState
|
|
@@ -66234,7 +66279,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66234
66279
|
const chartData = (0, import_react61.useMemo)(() => {
|
|
66235
66280
|
if (!sourceReport) return void 0;
|
|
66236
66281
|
const rowsForChart = Array.isArray(sourceReport.rows) ? sourceReport.rows : [];
|
|
66237
|
-
const
|
|
66282
|
+
const settledPivot = sourceReport.pivot ?? null;
|
|
66283
|
+
const settledSourceRowField = String(
|
|
66284
|
+
sourceReport.pivotResultSourceRowField ?? settledPivot?.rowField ?? ""
|
|
66285
|
+
).trim();
|
|
66286
|
+
const pendingPivotChangesDimensions = pendingPivotRefresh && Boolean(nextPivot) && (settledSourceRowField !== String(nextPivot?.rowField ?? "").trim() || String(settledPivot?.rowFieldTable ?? "").trim() !== String(nextPivot?.rowFieldTable ?? "").trim() || String(settledPivot?.columnField ?? "").trim() !== String(nextPivot?.columnField ?? "").trim() || String(settledPivot?.columnFieldTable ?? "").trim() !== String(nextPivot?.columnFieldTable ?? "").trim());
|
|
66287
|
+
const chartPivot = pendingPivotChangesDimensions ? sourceReport.pivot ?? null : nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
|
|
66238
66288
|
const chartPivotForDisplay = chartPivot && sourceReport.pivotResultRowField && sourceReport.pivotResultSourceRowField === chartPivot.rowField ? {
|
|
66239
66289
|
...chartPivot,
|
|
66240
66290
|
rowField: sourceReport.pivotResultRowField
|
|
@@ -66260,6 +66310,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66260
66310
|
sourceReport,
|
|
66261
66311
|
chartType,
|
|
66262
66312
|
nextPivot,
|
|
66313
|
+
pendingPivotRefresh,
|
|
66263
66314
|
effectiveReportBuilderState,
|
|
66264
66315
|
useInMemoryEngines,
|
|
66265
66316
|
chartPivotHydrationEpoch
|
|
@@ -67250,11 +67301,18 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67250
67301
|
selectedColumn?.format ?? chartFallback?.format ?? ""
|
|
67251
67302
|
).trim();
|
|
67252
67303
|
const isRowPivotCol = isPivotTableChart && Boolean(pivotRowFieldForSettings) && optionField === pivotRowFieldForSettings && Boolean(rowAxisLabel);
|
|
67304
|
+
const selectedLabel = String(selectedColumn?.alias ?? "").trim();
|
|
67305
|
+
const pivotLabel = String(
|
|
67306
|
+
isRowPivotCol ? rowAxisLabel : chartFallback?.label ?? ""
|
|
67307
|
+
).trim();
|
|
67308
|
+
const persistedTableLabel = String(
|
|
67309
|
+
tableFormatMerge.labelByColumnOptionId.get(columnId) ?? tableFormatMerge.columns.find(
|
|
67310
|
+
(column) => column.field === optionField
|
|
67311
|
+
)?.label ?? ""
|
|
67312
|
+
).trim();
|
|
67253
67313
|
const resolvedColFormat = isRowPivotCol ? String(resolvedXAxisFormat ?? "").trim() || effectiveFromId || mergeByFieldFormat || fromDisplay || String(chartFallback?.format ?? "").trim() || "string" : fromDisplay || effectiveFromId || mergeByFieldFormat;
|
|
67254
67314
|
map.set(columnId, {
|
|
67255
|
-
label:
|
|
67256
|
-
selectedColumn?.alias ?? (isRowPivotCol ? rowAxisLabel : chartFallback?.label) ?? ""
|
|
67257
|
-
).trim(),
|
|
67315
|
+
label: selectedLabel || pivotLabel || (!isPivotTableChart ? persistedTableLabel : ""),
|
|
67258
67316
|
format: resolvedColFormat
|
|
67259
67317
|
});
|
|
67260
67318
|
}
|
|
@@ -68132,6 +68190,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68132
68190
|
...sourceRest
|
|
68133
68191
|
} = sourceReport;
|
|
68134
68192
|
const isFlatTable = String(resolvedChartType).toLowerCase() === "table" && !effectiveReportBuilderState.pivot;
|
|
68193
|
+
const isPivotTable = String(resolvedChartType).toLowerCase() === "table" && Boolean(effectiveReportBuilderState.pivot);
|
|
68135
68194
|
const resp = await saveReport({
|
|
68136
68195
|
report: {
|
|
68137
68196
|
...EMPTY_INTERNAL_REPORT,
|
|
@@ -68142,8 +68201,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68142
68201
|
// Match chart rendering (`chartData`): form `chartType` wins over stale `sourceReport`.
|
|
68143
68202
|
chartType: resolvedChartType,
|
|
68144
68203
|
dashboardName: dashboardNameForNewReport,
|
|
68204
|
+
...!isPivotTable ? { columns: table.columns } : {},
|
|
68145
68205
|
...isFlatTable ? {
|
|
68146
|
-
columns: table.columns,
|
|
68147
68206
|
sort: effectiveReportBuilderState.sort?.[0] ?? null
|
|
68148
68207
|
} : {},
|
|
68149
68208
|
reportBuilderState: effectiveReportBuilderState,
|
package/dist/index.d.cts
CHANGED
|
@@ -2802,6 +2802,9 @@ type SelectOption = {
|
|
|
2802
2802
|
label: string;
|
|
2803
2803
|
value: string;
|
|
2804
2804
|
};
|
|
2805
|
+
type DatasourceOption = SelectOption & {
|
|
2806
|
+
joinOptions: string[];
|
|
2807
|
+
};
|
|
2805
2808
|
type PivotDateBucket = NonNullable<Pivot['dateBucket']>;
|
|
2806
2809
|
type UseFormTableRow = Record<string, unknown>;
|
|
2807
2810
|
type UseFormTableColumn = {
|
|
@@ -3215,7 +3218,7 @@ declare function useReport(reportIdArg?: string, options?: UseReportOptions): {
|
|
|
3215
3218
|
*/
|
|
3216
3219
|
reportId: string | undefined;
|
|
3217
3220
|
datasources: string[];
|
|
3218
|
-
datasourceOptions:
|
|
3221
|
+
datasourceOptions: DatasourceOption[];
|
|
3219
3222
|
groupRowsBy: string | undefined;
|
|
3220
3223
|
groupRowsByOptions: SelectOption[];
|
|
3221
3224
|
groupColumnsBy: string | undefined;
|
|
@@ -4475,4 +4478,4 @@ interface ReportTableProps {
|
|
|
4475
4478
|
}
|
|
4476
4479
|
declare const ReportTable: ({ reportBuilder, TableComponent, }: ReportTableProps) => react_jsx_runtime.JSX.Element;
|
|
4477
4480
|
|
|
4478
|
-
export { ALL_TENANTS, AddColumns, AddFilters, AddLimit, AddPivot, AddSort, type AxisFormat$1 as AxisFormat, type BarChartInteraction, type ButtonComponentProps, Calculation, type ChangelogEntry, Chart, ChartDisplay, ChartEditor, type ChartEditorProps, type ChartProps, type ChartType, type ChartTypeOption, Chat, type ChatModelId, type ChatProps, type CheckboxComponentProps, type ColorMapType, type Column$1 as Column, type ColumnActions, type ColumnSelectionOption, type ContainerComponentProps, DEFAULT_PAGE_SIZE, DEFAULT_USE_REPORT_ROWS_PER_REQUEST, Dashboard, type DashboardDateFilter, type DashboardFilter, DashboardFilterType, DashboardLegacy, type DashboardLegacyProps, type DashboardMultiFilter, type DashboardProps, type DashboardSectionComponentProps, type DashboardSingleFilter, type DashboardTenantFilter, DateOperator, type DateRange, type DateRangePickerComponentProps, type DateRangePickerOption, type DeleteButtonComponentProps, type DraggableColumnComponentProps, type EventBreadcrumb, type EventContext, type EventError, type EventMetadata, type EventTracking, type EventUser, type Filter, type FilterDraftQueryBuilderProps, type FilterFieldOptions, type FilterPopoverComponentProps, FilterType, type HeaderComponentProps, type HeaderProps, type InternalDashboardDateFilter, type InternalDashboardTenantFilter, type InternalFilter, type LabelComponentProps, type LimitPopoverComponentProps, type ModalComponentProps, NullOperator, NumberOperator, type OnChangeFn, type Option, type PaginationState, type Pivot, type PivotAggregation, type PivotDateBucket, type PivotDimensionFilter, type PopoverComponentProps, type QueryBuilderDisplayGroup, type QueryBuilderDisplayRule, type QuillCustomInterval, type QuillCustomRelativeInterval, type QuillCustomRepeatingInterval, type QuillCustomStaticInterval, type QuillFetchOptions, type QuillPreviousMonthInterval, type QuillPreviousQuarterInterval, QuillProvider, type QuillProviderProps, type QuillReport, type QuillReportProps, type QuillResults, type QuillTheme, type QuillWeekInterval, ReportBuilder$1 as ReportBuilder, type ReportBuilderColumn, type ReportBuilderLimit, type ReportBuilderProps, type ReportBuilderSort, type ReportBuilderState, type ReportColumnInput, type ReportColumnValue, ReportDetail, type ReportDetailProps, type ReportDetailTable, ReportTable, type ReportXAxisValue, type ReportYAxisFieldValue, type ReportYAxisValue, SINGLE_TENANT, SQLEditor, type SQLEditorProps, SaveReport, SchemaListComponent, type SelectColumnComponentProps, type SelectComponentProps, type SetFiltersInput, type SetReportBuilderInput, type SetReportChartAxesInput, type SidebarComponentProps, type SidebarHeadingComponentProps, type SortPopoverComponentProps, StaticChart, type StaticChartProps, StringOperator, Table, type TableComponentProps, type TableProps, type TabsComponentProps, type TextComponentProps, type TextInputComponentProps, ThemeContext, type Updater, type UseDashboardReload, type UseFormQueryBuilderField, type UseFormQueryBuilderProps, type UseReportFilterDraft, type UseReportQueryBuilder, areQueryBuilderFilterDraftsDirty, countFilterRules, defaultFilterRuleValueForOperator, downloadCSV, quillFormat as format, isQueryBuilderDisplayGroup, isQueryBuilderDisplayRule, normalizeRelativeDateRules, prepareQueryBuilderFiltersForSet, queryBuilderFiltersForEditor, quillFetch, stripQueryBuilderTransientFields, tableColumnFormatFromUiSelection, useAllReports, useAskQuill, useChangelogRefresh, useDashboard, useDashboardInternal, useDashboardReport, useDashboardReports, useDashboards, useExport, useMemoizedRows, useQuill, useReport, useReportBuilder, useReportQueryBuilder, useReports, useTenants, useVirtualTables };
|
|
4481
|
+
export { ALL_TENANTS, AddColumns, AddFilters, AddLimit, AddPivot, AddSort, type AxisFormat$1 as AxisFormat, type BarChartInteraction, type ButtonComponentProps, Calculation, type ChangelogEntry, Chart, ChartDisplay, ChartEditor, type ChartEditorProps, type ChartProps, type ChartType, type ChartTypeOption, Chat, type ChatModelId, type ChatProps, type CheckboxComponentProps, type ColorMapType, type Column$1 as Column, type ColumnActions, type ColumnSelectionOption, type ContainerComponentProps, DEFAULT_PAGE_SIZE, DEFAULT_USE_REPORT_ROWS_PER_REQUEST, Dashboard, type DashboardDateFilter, type DashboardFilter, DashboardFilterType, DashboardLegacy, type DashboardLegacyProps, type DashboardMultiFilter, type DashboardProps, type DashboardSectionComponentProps, type DashboardSingleFilter, type DashboardTenantFilter, type DatasourceOption, DateOperator, type DateRange, type DateRangePickerComponentProps, type DateRangePickerOption, type DeleteButtonComponentProps, type DraggableColumnComponentProps, type EventBreadcrumb, type EventContext, type EventError, type EventMetadata, type EventTracking, type EventUser, type Filter, type FilterDraftQueryBuilderProps, type FilterFieldOptions, type FilterPopoverComponentProps, FilterType, type HeaderComponentProps, type HeaderProps, type InternalDashboardDateFilter, type InternalDashboardTenantFilter, type InternalFilter, type LabelComponentProps, type LimitPopoverComponentProps, type ModalComponentProps, NullOperator, NumberOperator, type OnChangeFn, type Option, type PaginationState, type Pivot, type PivotAggregation, type PivotDateBucket, type PivotDimensionFilter, type PopoverComponentProps, type QueryBuilderDisplayGroup, type QueryBuilderDisplayRule, type QuillCustomInterval, type QuillCustomRelativeInterval, type QuillCustomRepeatingInterval, type QuillCustomStaticInterval, type QuillFetchOptions, type QuillPreviousMonthInterval, type QuillPreviousQuarterInterval, QuillProvider, type QuillProviderProps, type QuillReport, type QuillReportProps, type QuillResults, type QuillTheme, type QuillWeekInterval, ReportBuilder$1 as ReportBuilder, type ReportBuilderColumn, type ReportBuilderLimit, type ReportBuilderProps, type ReportBuilderSort, type ReportBuilderState, type ReportColumnInput, type ReportColumnValue, ReportDetail, type ReportDetailProps, type ReportDetailTable, ReportTable, type ReportXAxisValue, type ReportYAxisFieldValue, type ReportYAxisValue, SINGLE_TENANT, SQLEditor, type SQLEditorProps, SaveReport, SchemaListComponent, type SelectColumnComponentProps, type SelectComponentProps, type SetFiltersInput, type SetReportBuilderInput, type SetReportChartAxesInput, type SidebarComponentProps, type SidebarHeadingComponentProps, type SortPopoverComponentProps, StaticChart, type StaticChartProps, StringOperator, Table, type TableComponentProps, type TableProps, type TabsComponentProps, type TextComponentProps, type TextInputComponentProps, ThemeContext, type Updater, type UseDashboardReload, type UseFormQueryBuilderField, type UseFormQueryBuilderProps, type UseReportFilterDraft, type UseReportQueryBuilder, areQueryBuilderFilterDraftsDirty, countFilterRules, defaultFilterRuleValueForOperator, downloadCSV, quillFormat as format, isQueryBuilderDisplayGroup, isQueryBuilderDisplayRule, normalizeRelativeDateRules, prepareQueryBuilderFiltersForSet, queryBuilderFiltersForEditor, quillFetch, stripQueryBuilderTransientFields, tableColumnFormatFromUiSelection, useAllReports, useAskQuill, useChangelogRefresh, useDashboard, useDashboardInternal, useDashboardReport, useDashboardReports, useDashboards, useExport, useMemoizedRows, useQuill, useReport, useReportBuilder, useReportQueryBuilder, useReports, useTenants, useVirtualTables };
|
package/dist/index.d.ts
CHANGED
|
@@ -2802,6 +2802,9 @@ type SelectOption = {
|
|
|
2802
2802
|
label: string;
|
|
2803
2803
|
value: string;
|
|
2804
2804
|
};
|
|
2805
|
+
type DatasourceOption = SelectOption & {
|
|
2806
|
+
joinOptions: string[];
|
|
2807
|
+
};
|
|
2805
2808
|
type PivotDateBucket = NonNullable<Pivot['dateBucket']>;
|
|
2806
2809
|
type UseFormTableRow = Record<string, unknown>;
|
|
2807
2810
|
type UseFormTableColumn = {
|
|
@@ -3215,7 +3218,7 @@ declare function useReport(reportIdArg?: string, options?: UseReportOptions): {
|
|
|
3215
3218
|
*/
|
|
3216
3219
|
reportId: string | undefined;
|
|
3217
3220
|
datasources: string[];
|
|
3218
|
-
datasourceOptions:
|
|
3221
|
+
datasourceOptions: DatasourceOption[];
|
|
3219
3222
|
groupRowsBy: string | undefined;
|
|
3220
3223
|
groupRowsByOptions: SelectOption[];
|
|
3221
3224
|
groupColumnsBy: string | undefined;
|
|
@@ -4475,4 +4478,4 @@ interface ReportTableProps {
|
|
|
4475
4478
|
}
|
|
4476
4479
|
declare const ReportTable: ({ reportBuilder, TableComponent, }: ReportTableProps) => react_jsx_runtime.JSX.Element;
|
|
4477
4480
|
|
|
4478
|
-
export { ALL_TENANTS, AddColumns, AddFilters, AddLimit, AddPivot, AddSort, type AxisFormat$1 as AxisFormat, type BarChartInteraction, type ButtonComponentProps, Calculation, type ChangelogEntry, Chart, ChartDisplay, ChartEditor, type ChartEditorProps, type ChartProps, type ChartType, type ChartTypeOption, Chat, type ChatModelId, type ChatProps, type CheckboxComponentProps, type ColorMapType, type Column$1 as Column, type ColumnActions, type ColumnSelectionOption, type ContainerComponentProps, DEFAULT_PAGE_SIZE, DEFAULT_USE_REPORT_ROWS_PER_REQUEST, Dashboard, type DashboardDateFilter, type DashboardFilter, DashboardFilterType, DashboardLegacy, type DashboardLegacyProps, type DashboardMultiFilter, type DashboardProps, type DashboardSectionComponentProps, type DashboardSingleFilter, type DashboardTenantFilter, DateOperator, type DateRange, type DateRangePickerComponentProps, type DateRangePickerOption, type DeleteButtonComponentProps, type DraggableColumnComponentProps, type EventBreadcrumb, type EventContext, type EventError, type EventMetadata, type EventTracking, type EventUser, type Filter, type FilterDraftQueryBuilderProps, type FilterFieldOptions, type FilterPopoverComponentProps, FilterType, type HeaderComponentProps, type HeaderProps, type InternalDashboardDateFilter, type InternalDashboardTenantFilter, type InternalFilter, type LabelComponentProps, type LimitPopoverComponentProps, type ModalComponentProps, NullOperator, NumberOperator, type OnChangeFn, type Option, type PaginationState, type Pivot, type PivotAggregation, type PivotDateBucket, type PivotDimensionFilter, type PopoverComponentProps, type QueryBuilderDisplayGroup, type QueryBuilderDisplayRule, type QuillCustomInterval, type QuillCustomRelativeInterval, type QuillCustomRepeatingInterval, type QuillCustomStaticInterval, type QuillFetchOptions, type QuillPreviousMonthInterval, type QuillPreviousQuarterInterval, QuillProvider, type QuillProviderProps, type QuillReport, type QuillReportProps, type QuillResults, type QuillTheme, type QuillWeekInterval, ReportBuilder$1 as ReportBuilder, type ReportBuilderColumn, type ReportBuilderLimit, type ReportBuilderProps, type ReportBuilderSort, type ReportBuilderState, type ReportColumnInput, type ReportColumnValue, ReportDetail, type ReportDetailProps, type ReportDetailTable, ReportTable, type ReportXAxisValue, type ReportYAxisFieldValue, type ReportYAxisValue, SINGLE_TENANT, SQLEditor, type SQLEditorProps, SaveReport, SchemaListComponent, type SelectColumnComponentProps, type SelectComponentProps, type SetFiltersInput, type SetReportBuilderInput, type SetReportChartAxesInput, type SidebarComponentProps, type SidebarHeadingComponentProps, type SortPopoverComponentProps, StaticChart, type StaticChartProps, StringOperator, Table, type TableComponentProps, type TableProps, type TabsComponentProps, type TextComponentProps, type TextInputComponentProps, ThemeContext, type Updater, type UseDashboardReload, type UseFormQueryBuilderField, type UseFormQueryBuilderProps, type UseReportFilterDraft, type UseReportQueryBuilder, areQueryBuilderFilterDraftsDirty, countFilterRules, defaultFilterRuleValueForOperator, downloadCSV, quillFormat as format, isQueryBuilderDisplayGroup, isQueryBuilderDisplayRule, normalizeRelativeDateRules, prepareQueryBuilderFiltersForSet, queryBuilderFiltersForEditor, quillFetch, stripQueryBuilderTransientFields, tableColumnFormatFromUiSelection, useAllReports, useAskQuill, useChangelogRefresh, useDashboard, useDashboardInternal, useDashboardReport, useDashboardReports, useDashboards, useExport, useMemoizedRows, useQuill, useReport, useReportBuilder, useReportQueryBuilder, useReports, useTenants, useVirtualTables };
|
|
4481
|
+
export { ALL_TENANTS, AddColumns, AddFilters, AddLimit, AddPivot, AddSort, type AxisFormat$1 as AxisFormat, type BarChartInteraction, type ButtonComponentProps, Calculation, type ChangelogEntry, Chart, ChartDisplay, ChartEditor, type ChartEditorProps, type ChartProps, type ChartType, type ChartTypeOption, Chat, type ChatModelId, type ChatProps, type CheckboxComponentProps, type ColorMapType, type Column$1 as Column, type ColumnActions, type ColumnSelectionOption, type ContainerComponentProps, DEFAULT_PAGE_SIZE, DEFAULT_USE_REPORT_ROWS_PER_REQUEST, Dashboard, type DashboardDateFilter, type DashboardFilter, DashboardFilterType, DashboardLegacy, type DashboardLegacyProps, type DashboardMultiFilter, type DashboardProps, type DashboardSectionComponentProps, type DashboardSingleFilter, type DashboardTenantFilter, type DatasourceOption, DateOperator, type DateRange, type DateRangePickerComponentProps, type DateRangePickerOption, type DeleteButtonComponentProps, type DraggableColumnComponentProps, type EventBreadcrumb, type EventContext, type EventError, type EventMetadata, type EventTracking, type EventUser, type Filter, type FilterDraftQueryBuilderProps, type FilterFieldOptions, type FilterPopoverComponentProps, FilterType, type HeaderComponentProps, type HeaderProps, type InternalDashboardDateFilter, type InternalDashboardTenantFilter, type InternalFilter, type LabelComponentProps, type LimitPopoverComponentProps, type ModalComponentProps, NullOperator, NumberOperator, type OnChangeFn, type Option, type PaginationState, type Pivot, type PivotAggregation, type PivotDateBucket, type PivotDimensionFilter, type PopoverComponentProps, type QueryBuilderDisplayGroup, type QueryBuilderDisplayRule, type QuillCustomInterval, type QuillCustomRelativeInterval, type QuillCustomRepeatingInterval, type QuillCustomStaticInterval, type QuillFetchOptions, type QuillPreviousMonthInterval, type QuillPreviousQuarterInterval, QuillProvider, type QuillProviderProps, type QuillReport, type QuillReportProps, type QuillResults, type QuillTheme, type QuillWeekInterval, ReportBuilder$1 as ReportBuilder, type ReportBuilderColumn, type ReportBuilderLimit, type ReportBuilderProps, type ReportBuilderSort, type ReportBuilderState, type ReportColumnInput, type ReportColumnValue, ReportDetail, type ReportDetailProps, type ReportDetailTable, ReportTable, type ReportXAxisValue, type ReportYAxisFieldValue, type ReportYAxisValue, SINGLE_TENANT, SQLEditor, type SQLEditorProps, SaveReport, SchemaListComponent, type SelectColumnComponentProps, type SelectComponentProps, type SetFiltersInput, type SetReportBuilderInput, type SetReportChartAxesInput, type SidebarComponentProps, type SidebarHeadingComponentProps, type SortPopoverComponentProps, StaticChart, type StaticChartProps, StringOperator, Table, type TableComponentProps, type TableProps, type TabsComponentProps, type TextComponentProps, type TextInputComponentProps, ThemeContext, type Updater, type UseDashboardReload, type UseFormQueryBuilderField, type UseFormQueryBuilderProps, type UseReportFilterDraft, type UseReportQueryBuilder, areQueryBuilderFilterDraftsDirty, countFilterRules, defaultFilterRuleValueForOperator, downloadCSV, quillFormat as format, isQueryBuilderDisplayGroup, isQueryBuilderDisplayRule, normalizeRelativeDateRules, prepareQueryBuilderFiltersForSet, queryBuilderFiltersForEditor, quillFetch, stripQueryBuilderTransientFields, tableColumnFormatFromUiSelection, useAllReports, useAskQuill, useChangelogRefresh, useDashboard, useDashboardInternal, useDashboardReport, useDashboardReports, useDashboards, useExport, useMemoizedRows, useQuill, useReport, useReportBuilder, useReportQueryBuilder, useReports, useTenants, useVirtualTables };
|
package/dist/index.js
CHANGED
|
@@ -48117,6 +48117,14 @@ var CHART_TYPES = [
|
|
|
48117
48117
|
"US map",
|
|
48118
48118
|
"World map"
|
|
48119
48119
|
];
|
|
48120
|
+
var SINGLE_AGGREGATION_CHART_TYPES = [
|
|
48121
|
+
"stacked",
|
|
48122
|
+
"stacked bar",
|
|
48123
|
+
"bar",
|
|
48124
|
+
"pie",
|
|
48125
|
+
"gauge",
|
|
48126
|
+
"metric"
|
|
48127
|
+
];
|
|
48120
48128
|
var CHART_TO_LABELS = {
|
|
48121
48129
|
column: { xAxisLabel: "X-Axis", yAxisLabel: "Y-Axis" },
|
|
48122
48130
|
line: { xAxisLabel: "X-Axis", yAxisLabel: "Y-Axis" },
|
|
@@ -48323,7 +48331,10 @@ function getPivotMetricOptions(pivot, selectedPivotTable, chartType) {
|
|
|
48323
48331
|
}
|
|
48324
48332
|
}
|
|
48325
48333
|
function getChartTypeOptions(formData, dashboard) {
|
|
48326
|
-
|
|
48334
|
+
const hasMultipleAggregations = (formData.pivot?.aggregations?.length ?? 0) > 1;
|
|
48335
|
+
let viableCharts = CHART_TYPES.filter(
|
|
48336
|
+
(chartType) => !(hasMultipleAggregations && SINGLE_AGGREGATION_CHART_TYPES.includes(chartType))
|
|
48337
|
+
);
|
|
48327
48338
|
if (dashboard && dashboard.dateFilter && dashboard.dateFilter.comparison) {
|
|
48328
48339
|
viableCharts = viableCharts.filter(
|
|
48329
48340
|
(chart) => ![
|
|
@@ -49848,18 +49859,23 @@ function ChartBuilder({
|
|
|
49848
49859
|
(col) => col.field === pivot.rowField
|
|
49849
49860
|
);
|
|
49850
49861
|
}) : void 0;
|
|
49851
|
-
|
|
49852
|
-
...
|
|
49862
|
+
const updatedFormData = {
|
|
49863
|
+
...formData,
|
|
49853
49864
|
...newPivotFormData,
|
|
49854
|
-
...keepOldChartType && { chartType:
|
|
49855
|
-
dateField: dateField ? { table: dateField.name, field: pivot.rowField } :
|
|
49856
|
-
}
|
|
49857
|
-
|
|
49858
|
-
|
|
49859
|
-
|
|
49860
|
-
dashboardConfig[formData.dashboardName || ""]
|
|
49861
|
-
)
|
|
49865
|
+
...keepOldChartType && { chartType: formData.chartType },
|
|
49866
|
+
dateField: dateField ? { table: dateField.name, field: pivot.rowField } : formData.dateField
|
|
49867
|
+
};
|
|
49868
|
+
const chartTypeOptions = getChartTypeOptions(
|
|
49869
|
+
updatedFormData,
|
|
49870
|
+
dashboardConfig[formData.dashboardName || ""]
|
|
49862
49871
|
);
|
|
49872
|
+
if (!chartTypeOptions.some(
|
|
49873
|
+
(option) => option.value === updatedFormData.chartType
|
|
49874
|
+
)) {
|
|
49875
|
+
updatedFormData.chartType = chartTypeOptions[0]?.value ?? "table";
|
|
49876
|
+
}
|
|
49877
|
+
setFormData(updatedFormData);
|
|
49878
|
+
setChartTypes(chartTypeOptions);
|
|
49863
49879
|
};
|
|
49864
49880
|
const handleDeletePivot = () => {
|
|
49865
49881
|
if (!formData.pivot) {
|
|
@@ -61957,13 +61973,7 @@ function mergeReportBuilderTables(baseTables, tableNamesToInclude, foreignKeyMap
|
|
|
61957
61973
|
if (attachedTableCount > 0) {
|
|
61958
61974
|
continue;
|
|
61959
61975
|
}
|
|
61960
|
-
|
|
61961
|
-
if (!nextTableName) {
|
|
61962
|
-
break;
|
|
61963
|
-
}
|
|
61964
|
-
attachedTables.push(
|
|
61965
|
-
baseTableByName.get(nextTableName) ?? { name: nextTableName }
|
|
61966
|
-
);
|
|
61976
|
+
break;
|
|
61967
61977
|
}
|
|
61968
61978
|
return attachedTables;
|
|
61969
61979
|
}
|
|
@@ -62209,6 +62219,11 @@ function resolveTableColumnDefaultFormat({
|
|
|
62209
62219
|
}
|
|
62210
62220
|
return currentFormat;
|
|
62211
62221
|
}
|
|
62222
|
+
function resolveTableColumnLabel(fieldRaw, labelRaw) {
|
|
62223
|
+
const field = String(fieldRaw ?? "").trim();
|
|
62224
|
+
const label = String(labelRaw ?? "").trim();
|
|
62225
|
+
return !label || label === field ? toTitleCaseLabel(field) : label;
|
|
62226
|
+
}
|
|
62212
62227
|
function mergeDisplayAndSourceForTableFormats(args) {
|
|
62213
62228
|
const {
|
|
62214
62229
|
effectiveReportBuilderTableNames,
|
|
@@ -62262,6 +62277,7 @@ function mergeDisplayAndSourceForTableFormats(args) {
|
|
|
62262
62277
|
};
|
|
62263
62278
|
}).filter((column) => Boolean(column));
|
|
62264
62279
|
const formatByColumnOptionId = /* @__PURE__ */ new Map();
|
|
62280
|
+
const labelByColumnOptionId = /* @__PURE__ */ new Map();
|
|
62265
62281
|
let columnsWithTableMeta = [];
|
|
62266
62282
|
if (normalizedSourceColumns.length > 0 && normalizedDisplayColumns.length > 0) {
|
|
62267
62283
|
const sourceColumnsByKey = /* @__PURE__ */ new Map();
|
|
@@ -62363,21 +62379,27 @@ function mergeDisplayAndSourceForTableFormats(args) {
|
|
|
62363
62379
|
const id = encodeColumnOptionValue(selection.table, selection.field);
|
|
62364
62380
|
if (id) {
|
|
62365
62381
|
formatByColumnOptionId.set(id, String(merged.format ?? "").trim());
|
|
62382
|
+
labelByColumnOptionId.set(
|
|
62383
|
+
id,
|
|
62384
|
+
resolveTableColumnLabel(merged.field, merged.label)
|
|
62385
|
+
);
|
|
62366
62386
|
}
|
|
62367
62387
|
}
|
|
62368
62388
|
columnsWithTableMeta = selectedColumnsForTable;
|
|
62369
62389
|
}
|
|
62370
62390
|
const columns = columnsWithTableMeta.map((column) => {
|
|
62371
62391
|
const field = column.field;
|
|
62372
|
-
const rawLabel = String(column.label ?? "").trim();
|
|
62373
|
-
const label = !rawLabel || rawLabel === field ? toTitleCaseLabel(field) : rawLabel;
|
|
62374
62392
|
return {
|
|
62375
|
-
label,
|
|
62393
|
+
label: resolveTableColumnLabel(field, column.label),
|
|
62376
62394
|
field,
|
|
62377
62395
|
format: column.format
|
|
62378
62396
|
};
|
|
62379
62397
|
});
|
|
62380
|
-
return {
|
|
62398
|
+
return {
|
|
62399
|
+
columns,
|
|
62400
|
+
formatByColumnOptionId,
|
|
62401
|
+
labelByColumnOptionId
|
|
62402
|
+
};
|
|
62381
62403
|
}
|
|
62382
62404
|
function axisFormatToSelectLabel(format9) {
|
|
62383
62405
|
const raw = String(format9 ?? "").trim();
|
|
@@ -62432,9 +62454,20 @@ var CHART_TYPES2 = [
|
|
|
62432
62454
|
"US map",
|
|
62433
62455
|
"World map"
|
|
62434
62456
|
];
|
|
62457
|
+
var SINGLE_AGGREGATION_CHART_TYPES2 = [
|
|
62458
|
+
"stacked",
|
|
62459
|
+
"stacked bar",
|
|
62460
|
+
"bar",
|
|
62461
|
+
"pie",
|
|
62462
|
+
"gauge",
|
|
62463
|
+
"metric"
|
|
62464
|
+
];
|
|
62435
62465
|
var DEFAULT_CHART_TYPE = "table";
|
|
62436
62466
|
function getChartTypeOptions2(formData) {
|
|
62437
|
-
const
|
|
62467
|
+
const hasMultipleAggregations = (formData.pivot?.aggregations?.length ?? 0) > 1;
|
|
62468
|
+
const viableCharts = CHART_TYPES2.filter(
|
|
62469
|
+
(chartType) => !(hasMultipleAggregations && SINGLE_AGGREGATION_CHART_TYPES2.includes(chartType))
|
|
62470
|
+
);
|
|
62438
62471
|
if (formData.pivot && !formData.pivot.rowField) {
|
|
62439
62472
|
return viableCharts.filter((elem) => ["table", "metric", "gauge"].includes(elem)).map((elem) => ({ label: elem, value: elem }));
|
|
62440
62473
|
}
|
|
@@ -63936,16 +63969,28 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63936
63969
|
queryColumnsBootstrapKey
|
|
63937
63970
|
]);
|
|
63938
63971
|
const datasourceOptions = useMemo33(() => {
|
|
63972
|
+
const tableNames = new Set(
|
|
63973
|
+
schemaForReportBuilderState.map((table2) => String(table2.name ?? "").trim()).filter(Boolean)
|
|
63974
|
+
);
|
|
63939
63975
|
const seen = /* @__PURE__ */ new Set();
|
|
63940
63976
|
const result = [];
|
|
63941
63977
|
for (const table2 of schemaForReportBuilderState) {
|
|
63942
63978
|
const name2 = String(table2.name ?? "").trim();
|
|
63943
63979
|
if (!name2 || seen.has(name2)) continue;
|
|
63944
63980
|
seen.add(name2);
|
|
63945
|
-
result.push({
|
|
63981
|
+
result.push({
|
|
63982
|
+
value: name2,
|
|
63983
|
+
label: toTitleCaseLabel(name2),
|
|
63984
|
+
joinOptions: getJoinCompatibleTableNames(
|
|
63985
|
+
[name2],
|
|
63986
|
+
schemaForeignKeyMap
|
|
63987
|
+
).filter(
|
|
63988
|
+
(candidate) => candidate !== name2 && tableNames.has(candidate)
|
|
63989
|
+
)
|
|
63990
|
+
});
|
|
63946
63991
|
}
|
|
63947
63992
|
return result;
|
|
63948
|
-
}, [schemaForReportBuilderState]);
|
|
63993
|
+
}, [schemaForReportBuilderState, schemaForeignKeyMap]);
|
|
63949
63994
|
const queryBuilderFieldConfigByName = useMemo33(() => {
|
|
63950
63995
|
const configByName = buildQueryBuilderFieldConfigByName(
|
|
63951
63996
|
schemaForReportBuilderState
|
|
@@ -66446,7 +66491,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66446
66491
|
const chartData = useMemo33(() => {
|
|
66447
66492
|
if (!sourceReport) return void 0;
|
|
66448
66493
|
const rowsForChart = Array.isArray(sourceReport.rows) ? sourceReport.rows : [];
|
|
66449
|
-
const
|
|
66494
|
+
const settledPivot = sourceReport.pivot ?? null;
|
|
66495
|
+
const settledSourceRowField = String(
|
|
66496
|
+
sourceReport.pivotResultSourceRowField ?? settledPivot?.rowField ?? ""
|
|
66497
|
+
).trim();
|
|
66498
|
+
const pendingPivotChangesDimensions = pendingPivotRefresh && Boolean(nextPivot) && (settledSourceRowField !== String(nextPivot?.rowField ?? "").trim() || String(settledPivot?.rowFieldTable ?? "").trim() !== String(nextPivot?.rowFieldTable ?? "").trim() || String(settledPivot?.columnField ?? "").trim() !== String(nextPivot?.columnField ?? "").trim() || String(settledPivot?.columnFieldTable ?? "").trim() !== String(nextPivot?.columnFieldTable ?? "").trim());
|
|
66499
|
+
const chartPivot = pendingPivotChangesDimensions ? sourceReport.pivot ?? null : nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
|
|
66450
66500
|
const chartPivotForDisplay = chartPivot && sourceReport.pivotResultRowField && sourceReport.pivotResultSourceRowField === chartPivot.rowField ? {
|
|
66451
66501
|
...chartPivot,
|
|
66452
66502
|
rowField: sourceReport.pivotResultRowField
|
|
@@ -66472,6 +66522,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66472
66522
|
sourceReport,
|
|
66473
66523
|
chartType,
|
|
66474
66524
|
nextPivot,
|
|
66525
|
+
pendingPivotRefresh,
|
|
66475
66526
|
effectiveReportBuilderState,
|
|
66476
66527
|
useInMemoryEngines,
|
|
66477
66528
|
chartPivotHydrationEpoch
|
|
@@ -67462,11 +67513,18 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67462
67513
|
selectedColumn?.format ?? chartFallback?.format ?? ""
|
|
67463
67514
|
).trim();
|
|
67464
67515
|
const isRowPivotCol = isPivotTableChart && Boolean(pivotRowFieldForSettings) && optionField === pivotRowFieldForSettings && Boolean(rowAxisLabel);
|
|
67516
|
+
const selectedLabel = String(selectedColumn?.alias ?? "").trim();
|
|
67517
|
+
const pivotLabel = String(
|
|
67518
|
+
isRowPivotCol ? rowAxisLabel : chartFallback?.label ?? ""
|
|
67519
|
+
).trim();
|
|
67520
|
+
const persistedTableLabel = String(
|
|
67521
|
+
tableFormatMerge.labelByColumnOptionId.get(columnId) ?? tableFormatMerge.columns.find(
|
|
67522
|
+
(column) => column.field === optionField
|
|
67523
|
+
)?.label ?? ""
|
|
67524
|
+
).trim();
|
|
67465
67525
|
const resolvedColFormat = isRowPivotCol ? String(resolvedXAxisFormat ?? "").trim() || effectiveFromId || mergeByFieldFormat || fromDisplay || String(chartFallback?.format ?? "").trim() || "string" : fromDisplay || effectiveFromId || mergeByFieldFormat;
|
|
67466
67526
|
map.set(columnId, {
|
|
67467
|
-
label:
|
|
67468
|
-
selectedColumn?.alias ?? (isRowPivotCol ? rowAxisLabel : chartFallback?.label) ?? ""
|
|
67469
|
-
).trim(),
|
|
67527
|
+
label: selectedLabel || pivotLabel || (!isPivotTableChart ? persistedTableLabel : ""),
|
|
67470
67528
|
format: resolvedColFormat
|
|
67471
67529
|
});
|
|
67472
67530
|
}
|
|
@@ -68344,6 +68402,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68344
68402
|
...sourceRest
|
|
68345
68403
|
} = sourceReport;
|
|
68346
68404
|
const isFlatTable = String(resolvedChartType).toLowerCase() === "table" && !effectiveReportBuilderState.pivot;
|
|
68405
|
+
const isPivotTable = String(resolvedChartType).toLowerCase() === "table" && Boolean(effectiveReportBuilderState.pivot);
|
|
68347
68406
|
const resp = await saveReport({
|
|
68348
68407
|
report: {
|
|
68349
68408
|
...EMPTY_INTERNAL_REPORT,
|
|
@@ -68354,8 +68413,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68354
68413
|
// Match chart rendering (`chartData`): form `chartType` wins over stale `sourceReport`.
|
|
68355
68414
|
chartType: resolvedChartType,
|
|
68356
68415
|
dashboardName: dashboardNameForNewReport,
|
|
68416
|
+
...!isPivotTable ? { columns: table.columns } : {},
|
|
68357
68417
|
...isFlatTable ? {
|
|
68358
|
-
columns: table.columns,
|
|
68359
68418
|
sort: effectiveReportBuilderState.sort?.[0] ?? null
|
|
68360
68419
|
} : {},
|
|
68361
68420
|
reportBuilderState: effectiveReportBuilderState,
|