@quillsql/react 2.16.54 → 2.16.56
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 +58 -18
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +66 -26
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -60775,7 +60775,7 @@ function buildAggregationLabel(aggregation, report) {
|
|
|
60775
60775
|
return report?.pivot?.columnField ? "Count" : `Count ${snakeAndCamelCaseToTitleCase(tableNames[0] ?? "table")}`;
|
|
60776
60776
|
}
|
|
60777
60777
|
const rawTarget = aggregation.valueField ?? (tableNames.length > 0 ? tableNames.join(", ") : "table");
|
|
60778
|
-
const target =
|
|
60778
|
+
const target = aggregation.valueField && report ? resolveValueFieldDisplayLabel(report, aggregation.valueField) : toTitleCaseLabel(rawTarget);
|
|
60779
60779
|
if (String(aggregationType).toLowerCase() === "percentage") {
|
|
60780
60780
|
const valueField2 = String(
|
|
60781
60781
|
aggregation.valueField2 ?? ""
|
|
@@ -61925,6 +61925,20 @@ function coerceTableColumnFormatToAxisValue(raw) {
|
|
|
61925
61925
|
if (byLabel) return byLabel.value;
|
|
61926
61926
|
return t;
|
|
61927
61927
|
}
|
|
61928
|
+
function resolveTableColumnDefaultFormat({
|
|
61929
|
+
selectedFormat,
|
|
61930
|
+
sourceFormat,
|
|
61931
|
+
isDateColumn,
|
|
61932
|
+
preserveStringFormat = false
|
|
61933
|
+
}) {
|
|
61934
|
+
const explicitFormat = String(selectedFormat ?? "").trim();
|
|
61935
|
+
if (explicitFormat) return explicitFormat;
|
|
61936
|
+
const currentFormat = String(sourceFormat ?? "").trim() || "string";
|
|
61937
|
+
if (isDateColumn && currentFormat === "string" && !preserveStringFormat) {
|
|
61938
|
+
return "MMM_dd_yyyy";
|
|
61939
|
+
}
|
|
61940
|
+
return currentFormat;
|
|
61941
|
+
}
|
|
61928
61942
|
function mergeDisplayAndSourceForTableFormats(args) {
|
|
61929
61943
|
const {
|
|
61930
61944
|
effectiveReportBuilderTableNames,
|
|
@@ -62048,10 +62062,26 @@ function mergeDisplayAndSourceForTableFormats(args) {
|
|
|
62048
62062
|
).trim()}`;
|
|
62049
62063
|
if (!seenKey || seenColumnsByTableAndField.has(seenKey)) continue;
|
|
62050
62064
|
seenColumnsByTableAndField.add(seenKey);
|
|
62065
|
+
const matchedTable = String(
|
|
62066
|
+
selection.table || matchedColumn.table || ""
|
|
62067
|
+
).trim();
|
|
62068
|
+
const schemaColumn = scopedSchemaColumns.find((column) => {
|
|
62069
|
+
const sameField = String(column.field ?? "").trim() === matchedColumn.field;
|
|
62070
|
+
const sameTable = !matchedTable || String(column.table ?? "").trim() === matchedTable;
|
|
62071
|
+
return sameField && sameTable;
|
|
62072
|
+
});
|
|
62073
|
+
const isDateColumn = isDateType(String(schemaColumn?.fieldType ?? "").trim()) || String(schemaColumn?.jsType ?? "").trim().toLowerCase() === "date";
|
|
62074
|
+
const pivotRowField = String(sourceReport?.pivot?.rowField ?? "").trim();
|
|
62075
|
+
const isPivotDateBucketString = isDateColumn && matchedColumn.field === pivotRowField && String(sourceReport?.xAxisFormat ?? "").trim() === "string";
|
|
62051
62076
|
const merged = {
|
|
62052
62077
|
...matchedColumn,
|
|
62053
62078
|
...selection.alias ? { label: selection.alias } : {},
|
|
62054
|
-
|
|
62079
|
+
format: resolveTableColumnDefaultFormat({
|
|
62080
|
+
selectedFormat: selection.format,
|
|
62081
|
+
sourceFormat: matchedColumn.format,
|
|
62082
|
+
isDateColumn,
|
|
62083
|
+
preserveStringFormat: isPivotDateBucketString
|
|
62084
|
+
})
|
|
62055
62085
|
};
|
|
62056
62086
|
selectedColumnsForTable.push(merged);
|
|
62057
62087
|
const id = encodeColumnOptionValue(selection.table, selection.field);
|
|
@@ -62124,6 +62154,7 @@ var CHART_TYPES2 = [
|
|
|
62124
62154
|
"US map",
|
|
62125
62155
|
"World map"
|
|
62126
62156
|
];
|
|
62157
|
+
var DEFAULT_CHART_TYPE = "table";
|
|
62127
62158
|
function getChartTypeOptions2(formData) {
|
|
62128
62159
|
const viableCharts = CHART_TYPES2;
|
|
62129
62160
|
if (formData.pivot && !formData.pivot.rowField) {
|
|
@@ -64749,6 +64780,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64749
64780
|
effectiveReportId,
|
|
64750
64781
|
chartPivotHydrationEpoch
|
|
64751
64782
|
]);
|
|
64783
|
+
const hasDatePivotRow = Boolean(String(pivotState?.rowField ?? "").trim()) && isDateType(String(pivotState?.rowFieldType ?? ""));
|
|
64752
64784
|
(0, import_react61.useEffect)(() => {
|
|
64753
64785
|
const previous = prevPivotStateForColumnExpansionRef.current;
|
|
64754
64786
|
if (previous && !pivotState) {
|
|
@@ -65232,6 +65264,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65232
65264
|
const chartTypes = (0, import_react61.useMemo)(() => {
|
|
65233
65265
|
return getChartTypeOptions2({ pivot: pivotState });
|
|
65234
65266
|
}, [pivotState]);
|
|
65267
|
+
const resolvedChartType = chartTypes.find((option) => option.value === chartType)?.value ?? chartTypes.find((option) => option.value === sourceReport?.chartType)?.value ?? chartTypes.find((option) => option.value === DEFAULT_CHART_TYPE)?.value ?? chartTypes[0]?.value ?? DEFAULT_CHART_TYPE;
|
|
65235
65268
|
(0, import_react61.useEffect)(() => {
|
|
65236
65269
|
if (!sourceReport) {
|
|
65237
65270
|
return;
|
|
@@ -65949,8 +65982,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65949
65982
|
return {
|
|
65950
65983
|
...previousReport,
|
|
65951
65984
|
...report,
|
|
65985
|
+
// Keep chart axis metadata from the pivot load; detail fetch is flat
|
|
65986
|
+
// (`pivot: null`) and must supply wide `columns` for the detail table.
|
|
65952
65987
|
xAxisFormat: previousReport.xAxisFormat,
|
|
65953
|
-
columns: previousReport.columns,
|
|
65954
65988
|
yAxisFields: previousReport.yAxisFields,
|
|
65955
65989
|
pivot: previousReport.pivot,
|
|
65956
65990
|
pivotRows: previousReport.pivotRows,
|
|
@@ -66068,7 +66102,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66068
66102
|
const registerOption = (fieldRaw, labelRaw, formatRaw) => {
|
|
66069
66103
|
const field = String(fieldRaw ?? "").trim();
|
|
66070
66104
|
if (!field || optionsByField.has(field)) return;
|
|
66071
|
-
const
|
|
66105
|
+
const rawLabel = String(labelRaw ?? "").trim();
|
|
66106
|
+
const label = !rawLabel || rawLabel === field ? toTitleCaseLabel(field) : rawLabel;
|
|
66072
66107
|
const format9 = toAxisFormat(formatRaw, "string");
|
|
66073
66108
|
optionsByField.set(field, {
|
|
66074
66109
|
value: field,
|
|
@@ -66187,7 +66222,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66187
66222
|
if (!field) return null;
|
|
66188
66223
|
const option = chartAxisOptionByField.get(field);
|
|
66189
66224
|
if (!option) return null;
|
|
66190
|
-
const
|
|
66225
|
+
const rawLabel = String(yAxisFieldRaw?.label ?? "").trim() || option.label;
|
|
66226
|
+
const label = rawLabel === field ? toTitleCaseLabel(field) : rawLabel;
|
|
66191
66227
|
const format9 = toAxisFormat(yAxisFieldRaw?.format, option.format);
|
|
66192
66228
|
return {
|
|
66193
66229
|
field,
|
|
@@ -66290,7 +66326,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66290
66326
|
if (chartAxisEdits.xAxisLabel !== void 0) {
|
|
66291
66327
|
return String(chartAxisEdits.xAxisLabel).trim();
|
|
66292
66328
|
}
|
|
66293
|
-
return defaultXLabel;
|
|
66329
|
+
return !defaultXLabel || defaultXLabel === resolvedXAxisField ? toTitleCaseLabel(resolvedXAxisField) : defaultXLabel;
|
|
66294
66330
|
}, [
|
|
66295
66331
|
chartAxesBaseChart?.xAxisLabel,
|
|
66296
66332
|
chartAxisEdits.xAxisLabel,
|
|
@@ -67723,7 +67759,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67723
67759
|
if (effectiveNextState.limit !== void 0)
|
|
67724
67760
|
next.limit = effectiveNextState.limit;
|
|
67725
67761
|
if (effectiveNextState.chartType !== void 0)
|
|
67726
|
-
next.chartType = effectiveNextState.chartType
|
|
67762
|
+
next.chartType = effectiveNextState.chartType;
|
|
67727
67763
|
const normalizedNext = processPivotState(next, {
|
|
67728
67764
|
nextState: effectiveNextState,
|
|
67729
67765
|
promoteColumnToRow: false,
|
|
@@ -67877,6 +67913,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67877
67913
|
adminMode: _omitAdminMode,
|
|
67878
67914
|
...sourceRest
|
|
67879
67915
|
} = sourceReport;
|
|
67916
|
+
const isFlatTable = String(resolvedChartType).toLowerCase() === "table" && !effectiveReportBuilderState.pivot;
|
|
67880
67917
|
const resp = await saveReport({
|
|
67881
67918
|
report: {
|
|
67882
67919
|
...EMPTY_INTERNAL_REPORT,
|
|
@@ -67885,8 +67922,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67885
67922
|
String(effectiveReportBuilderState.tables[0].name)
|
|
67886
67923
|
) : "New report",
|
|
67887
67924
|
// Match chart rendering (`chartData`): form `chartType` wins over stale `sourceReport`.
|
|
67888
|
-
chartType:
|
|
67925
|
+
chartType: resolvedChartType,
|
|
67889
67926
|
dashboardName: dashboardNameForNewReport,
|
|
67927
|
+
...isFlatTable ? {
|
|
67928
|
+
columns: table.columns,
|
|
67929
|
+
sort: effectiveReportBuilderState.sort?.[0] ?? null
|
|
67930
|
+
} : {},
|
|
67890
67931
|
reportBuilderState: effectiveReportBuilderState,
|
|
67891
67932
|
pivot: effectiveReportBuilderState.pivot ?? null,
|
|
67892
67933
|
// Axis control state (measures / aggregation fields). Do not use
|
|
@@ -67907,7 +67948,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67907
67948
|
});
|
|
67908
67949
|
return resp;
|
|
67909
67950
|
}, [
|
|
67910
|
-
chartType,
|
|
67911
67951
|
client,
|
|
67912
67952
|
dashboardNameForNewReport,
|
|
67913
67953
|
draftSessionId,
|
|
@@ -67918,9 +67958,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67918
67958
|
resolvedXAxisField,
|
|
67919
67959
|
resolvedXAxisFormat,
|
|
67920
67960
|
resolvedXAxisLabel,
|
|
67961
|
+
resolvedChartType,
|
|
67921
67962
|
resolvedYAxisFields,
|
|
67922
67963
|
sourceReport,
|
|
67923
67964
|
setDraftSessionId,
|
|
67965
|
+
table.columns,
|
|
67924
67966
|
tenants
|
|
67925
67967
|
]);
|
|
67926
67968
|
return {
|
|
@@ -67945,7 +67987,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67945
67987
|
groupColumnsBy,
|
|
67946
67988
|
groupColumnsByOptions,
|
|
67947
67989
|
dateBucket,
|
|
67948
|
-
dateBucketOptions: PIVOT_DATE_BUCKET_OPTIONS,
|
|
67990
|
+
dateBucketOptions: hasDatePivotRow ? PIVOT_DATE_BUCKET_OPTIONS : [],
|
|
67949
67991
|
/** Encoded selection per aggregation slot (`'sum:transactions::amount'`, `'count:transactions'`, `''` = placeholder). Update via `setReport({ aggregations: nextStringArray })`. */
|
|
67950
67992
|
aggregations: aggregationValues,
|
|
67951
67993
|
/** Flat aggregation pick list shared by all slots; always contains every non-empty `aggregations` entry. */
|
|
@@ -67953,7 +67995,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67953
67995
|
aggregationDescriptionOptions: cleanedAggregations,
|
|
67954
67996
|
sort: cleanedSort,
|
|
67955
67997
|
sortOptions,
|
|
67956
|
-
chartType,
|
|
67998
|
+
chartType: resolvedChartType,
|
|
67957
67999
|
chartTypeOptions: chartTypes,
|
|
67958
68000
|
/** Selected tabular columns in display order. */
|
|
67959
68001
|
columns: tableColumnValues,
|
|
@@ -68169,7 +68211,7 @@ function ChatChartCard({
|
|
|
68169
68211
|
label: "Chart type",
|
|
68170
68212
|
width: 200,
|
|
68171
68213
|
options: chartTypeOptions,
|
|
68172
|
-
onChange: (e) => setReport({ chartType: e.target.value
|
|
68214
|
+
onChange: (e) => setReport({ chartType: e.target.value })
|
|
68173
68215
|
}
|
|
68174
68216
|
)
|
|
68175
68217
|
]
|
|
@@ -68859,12 +68901,10 @@ function useReportFilterDraft(args) {
|
|
|
68859
68901
|
const [draftQuery, setDraftQuery] = (0, import_react64.useState)(committed);
|
|
68860
68902
|
const [hasUnappliedFilterChanges, setHasUnappliedFilterChanges] = (0, import_react64.useState)(false);
|
|
68861
68903
|
const draftResetKey = `${reportId}|${committedSignature}|${resetEpoch}`;
|
|
68862
|
-
|
|
68863
|
-
|
|
68864
|
-
|
|
68865
|
-
|
|
68866
|
-
if (hasUnappliedFilterChanges) setHasUnappliedFilterChanges(false);
|
|
68867
|
-
}
|
|
68904
|
+
(0, import_react64.useEffect)(() => {
|
|
68905
|
+
setDraftQuery(committedRef.current);
|
|
68906
|
+
setHasUnappliedFilterChanges(false);
|
|
68907
|
+
}, [draftResetKey]);
|
|
68868
68908
|
const filterDraftKey = `${draftResetKey}|${fieldsSignature}`;
|
|
68869
68909
|
const handleQueryChange = (0, import_react64.useCallback)((next) => {
|
|
68870
68910
|
if (!isQueryBuilderDisplayGroup(next)) return;
|
package/dist/index.d.cts
CHANGED
|
@@ -2982,6 +2982,12 @@ type FilterFieldOptions = {
|
|
|
2982
2982
|
type SetFiltersInput = QueryBuilderRuleGroup | ((prev: QueryBuilderRuleGroup) => QueryBuilderRuleGroup);
|
|
2983
2983
|
/** Maps table column format dropdown values to persisted report column `format` (used by `columnActions.update`). */
|
|
2984
2984
|
declare function tableColumnFormatFromUiSelection(raw: string): string;
|
|
2985
|
+
declare const CHART_TYPES: readonly ["column", "stacked", "line", "table", "metric", "gauge", "bar", "pie", "US map", "World map"];
|
|
2986
|
+
type ChartType = (typeof CHART_TYPES)[number];
|
|
2987
|
+
type ChartTypeOption = {
|
|
2988
|
+
label: string;
|
|
2989
|
+
value: ChartType;
|
|
2990
|
+
};
|
|
2985
2991
|
type SetReportChartAxesInput = {
|
|
2986
2992
|
xAxis?: Partial<{
|
|
2987
2993
|
field: string;
|
|
@@ -3023,7 +3029,7 @@ interface SetReportBuilderInput {
|
|
|
3023
3029
|
aggregations?: string[] | AggregationStateItem[] | string;
|
|
3024
3030
|
sort?: ReportBuilderSort[] | string;
|
|
3025
3031
|
limit?: ReportBuilderLimit | null;
|
|
3026
|
-
chartType?:
|
|
3032
|
+
chartType?: ChartType;
|
|
3027
3033
|
/** When set, updates chart legend visibility (same source as `showLegend` from `useReport`). */
|
|
3028
3034
|
showLegend?: boolean;
|
|
3029
3035
|
/** Update the X-axis value returned by `useReport`. */
|
|
@@ -3208,11 +3214,8 @@ declare function useReport(reportIdArg?: string, options?: UseReportOptions): {
|
|
|
3208
3214
|
label: string;
|
|
3209
3215
|
value: string;
|
|
3210
3216
|
}[];
|
|
3211
|
-
chartType:
|
|
3212
|
-
chartTypeOptions:
|
|
3213
|
-
label: string;
|
|
3214
|
-
value: string;
|
|
3215
|
-
}[];
|
|
3217
|
+
chartType: "table" | "column" | "metric" | "gauge" | "stacked" | "line" | "bar" | "pie" | "US map" | "World map";
|
|
3218
|
+
chartTypeOptions: ChartTypeOption[];
|
|
3216
3219
|
/** Selected tabular columns in display order. */
|
|
3217
3220
|
columns: ReportColumnValue[];
|
|
3218
3221
|
/** Pivot table columns only allow label and format changes. */
|
|
@@ -3267,10 +3270,7 @@ declare function useReport(reportIdArg?: string, options?: UseReportOptions): {
|
|
|
3267
3270
|
/** True while `report-builder-unique-values` runs for filter value options (not chart/table load). */
|
|
3268
3271
|
filterUniqueValuesLoading: boolean;
|
|
3269
3272
|
limit: ReportBuilderLimit | null;
|
|
3270
|
-
chartTypes:
|
|
3271
|
-
label: string;
|
|
3272
|
-
value: string;
|
|
3273
|
-
}[];
|
|
3273
|
+
chartTypes: ChartTypeOption[];
|
|
3274
3274
|
columnsOptions: ColumnSelectionOption[];
|
|
3275
3275
|
tableColumnOptions: ColumnSelectionOption[];
|
|
3276
3276
|
setReport: (nextState: SetReportBuilderInput) => void;
|
|
@@ -4452,4 +4452,4 @@ interface ReportTableProps {
|
|
|
4452
4452
|
}
|
|
4453
4453
|
declare const ReportTable: ({ reportBuilder, TableComponent, }: ReportTableProps) => react_jsx_runtime.JSX.Element;
|
|
4454
4454
|
|
|
4455
|
-
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, 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 };
|
|
4455
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -2982,6 +2982,12 @@ type FilterFieldOptions = {
|
|
|
2982
2982
|
type SetFiltersInput = QueryBuilderRuleGroup | ((prev: QueryBuilderRuleGroup) => QueryBuilderRuleGroup);
|
|
2983
2983
|
/** Maps table column format dropdown values to persisted report column `format` (used by `columnActions.update`). */
|
|
2984
2984
|
declare function tableColumnFormatFromUiSelection(raw: string): string;
|
|
2985
|
+
declare const CHART_TYPES: readonly ["column", "stacked", "line", "table", "metric", "gauge", "bar", "pie", "US map", "World map"];
|
|
2986
|
+
type ChartType = (typeof CHART_TYPES)[number];
|
|
2987
|
+
type ChartTypeOption = {
|
|
2988
|
+
label: string;
|
|
2989
|
+
value: ChartType;
|
|
2990
|
+
};
|
|
2985
2991
|
type SetReportChartAxesInput = {
|
|
2986
2992
|
xAxis?: Partial<{
|
|
2987
2993
|
field: string;
|
|
@@ -3023,7 +3029,7 @@ interface SetReportBuilderInput {
|
|
|
3023
3029
|
aggregations?: string[] | AggregationStateItem[] | string;
|
|
3024
3030
|
sort?: ReportBuilderSort[] | string;
|
|
3025
3031
|
limit?: ReportBuilderLimit | null;
|
|
3026
|
-
chartType?:
|
|
3032
|
+
chartType?: ChartType;
|
|
3027
3033
|
/** When set, updates chart legend visibility (same source as `showLegend` from `useReport`). */
|
|
3028
3034
|
showLegend?: boolean;
|
|
3029
3035
|
/** Update the X-axis value returned by `useReport`. */
|
|
@@ -3208,11 +3214,8 @@ declare function useReport(reportIdArg?: string, options?: UseReportOptions): {
|
|
|
3208
3214
|
label: string;
|
|
3209
3215
|
value: string;
|
|
3210
3216
|
}[];
|
|
3211
|
-
chartType:
|
|
3212
|
-
chartTypeOptions:
|
|
3213
|
-
label: string;
|
|
3214
|
-
value: string;
|
|
3215
|
-
}[];
|
|
3217
|
+
chartType: "table" | "column" | "metric" | "gauge" | "stacked" | "line" | "bar" | "pie" | "US map" | "World map";
|
|
3218
|
+
chartTypeOptions: ChartTypeOption[];
|
|
3216
3219
|
/** Selected tabular columns in display order. */
|
|
3217
3220
|
columns: ReportColumnValue[];
|
|
3218
3221
|
/** Pivot table columns only allow label and format changes. */
|
|
@@ -3267,10 +3270,7 @@ declare function useReport(reportIdArg?: string, options?: UseReportOptions): {
|
|
|
3267
3270
|
/** True while `report-builder-unique-values` runs for filter value options (not chart/table load). */
|
|
3268
3271
|
filterUniqueValuesLoading: boolean;
|
|
3269
3272
|
limit: ReportBuilderLimit | null;
|
|
3270
|
-
chartTypes:
|
|
3271
|
-
label: string;
|
|
3272
|
-
value: string;
|
|
3273
|
-
}[];
|
|
3273
|
+
chartTypes: ChartTypeOption[];
|
|
3274
3274
|
columnsOptions: ColumnSelectionOption[];
|
|
3275
3275
|
tableColumnOptions: ColumnSelectionOption[];
|
|
3276
3276
|
setReport: (nextState: SetReportBuilderInput) => void;
|
|
@@ -4452,4 +4452,4 @@ interface ReportTableProps {
|
|
|
4452
4452
|
}
|
|
4453
4453
|
declare const ReportTable: ({ reportBuilder, TableComponent, }: ReportTableProps) => react_jsx_runtime.JSX.Element;
|
|
4454
4454
|
|
|
4455
|
-
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, 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 };
|
|
4455
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -60987,7 +60987,7 @@ function buildAggregationLabel(aggregation, report) {
|
|
|
60987
60987
|
return report?.pivot?.columnField ? "Count" : `Count ${snakeAndCamelCaseToTitleCase(tableNames[0] ?? "table")}`;
|
|
60988
60988
|
}
|
|
60989
60989
|
const rawTarget = aggregation.valueField ?? (tableNames.length > 0 ? tableNames.join(", ") : "table");
|
|
60990
|
-
const target =
|
|
60990
|
+
const target = aggregation.valueField && report ? resolveValueFieldDisplayLabel(report, aggregation.valueField) : toTitleCaseLabel(rawTarget);
|
|
60991
60991
|
if (String(aggregationType).toLowerCase() === "percentage") {
|
|
60992
60992
|
const valueField2 = String(
|
|
60993
60993
|
aggregation.valueField2 ?? ""
|
|
@@ -62137,6 +62137,20 @@ function coerceTableColumnFormatToAxisValue(raw) {
|
|
|
62137
62137
|
if (byLabel) return byLabel.value;
|
|
62138
62138
|
return t;
|
|
62139
62139
|
}
|
|
62140
|
+
function resolveTableColumnDefaultFormat({
|
|
62141
|
+
selectedFormat,
|
|
62142
|
+
sourceFormat,
|
|
62143
|
+
isDateColumn,
|
|
62144
|
+
preserveStringFormat = false
|
|
62145
|
+
}) {
|
|
62146
|
+
const explicitFormat = String(selectedFormat ?? "").trim();
|
|
62147
|
+
if (explicitFormat) return explicitFormat;
|
|
62148
|
+
const currentFormat = String(sourceFormat ?? "").trim() || "string";
|
|
62149
|
+
if (isDateColumn && currentFormat === "string" && !preserveStringFormat) {
|
|
62150
|
+
return "MMM_dd_yyyy";
|
|
62151
|
+
}
|
|
62152
|
+
return currentFormat;
|
|
62153
|
+
}
|
|
62140
62154
|
function mergeDisplayAndSourceForTableFormats(args) {
|
|
62141
62155
|
const {
|
|
62142
62156
|
effectiveReportBuilderTableNames,
|
|
@@ -62260,10 +62274,26 @@ function mergeDisplayAndSourceForTableFormats(args) {
|
|
|
62260
62274
|
).trim()}`;
|
|
62261
62275
|
if (!seenKey || seenColumnsByTableAndField.has(seenKey)) continue;
|
|
62262
62276
|
seenColumnsByTableAndField.add(seenKey);
|
|
62277
|
+
const matchedTable = String(
|
|
62278
|
+
selection.table || matchedColumn.table || ""
|
|
62279
|
+
).trim();
|
|
62280
|
+
const schemaColumn = scopedSchemaColumns.find((column) => {
|
|
62281
|
+
const sameField = String(column.field ?? "").trim() === matchedColumn.field;
|
|
62282
|
+
const sameTable = !matchedTable || String(column.table ?? "").trim() === matchedTable;
|
|
62283
|
+
return sameField && sameTable;
|
|
62284
|
+
});
|
|
62285
|
+
const isDateColumn = isDateType(String(schemaColumn?.fieldType ?? "").trim()) || String(schemaColumn?.jsType ?? "").trim().toLowerCase() === "date";
|
|
62286
|
+
const pivotRowField = String(sourceReport?.pivot?.rowField ?? "").trim();
|
|
62287
|
+
const isPivotDateBucketString = isDateColumn && matchedColumn.field === pivotRowField && String(sourceReport?.xAxisFormat ?? "").trim() === "string";
|
|
62263
62288
|
const merged = {
|
|
62264
62289
|
...matchedColumn,
|
|
62265
62290
|
...selection.alias ? { label: selection.alias } : {},
|
|
62266
|
-
|
|
62291
|
+
format: resolveTableColumnDefaultFormat({
|
|
62292
|
+
selectedFormat: selection.format,
|
|
62293
|
+
sourceFormat: matchedColumn.format,
|
|
62294
|
+
isDateColumn,
|
|
62295
|
+
preserveStringFormat: isPivotDateBucketString
|
|
62296
|
+
})
|
|
62267
62297
|
};
|
|
62268
62298
|
selectedColumnsForTable.push(merged);
|
|
62269
62299
|
const id = encodeColumnOptionValue(selection.table, selection.field);
|
|
@@ -62336,6 +62366,7 @@ var CHART_TYPES2 = [
|
|
|
62336
62366
|
"US map",
|
|
62337
62367
|
"World map"
|
|
62338
62368
|
];
|
|
62369
|
+
var DEFAULT_CHART_TYPE = "table";
|
|
62339
62370
|
function getChartTypeOptions2(formData) {
|
|
62340
62371
|
const viableCharts = CHART_TYPES2;
|
|
62341
62372
|
if (formData.pivot && !formData.pivot.rowField) {
|
|
@@ -64961,6 +64992,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64961
64992
|
effectiveReportId,
|
|
64962
64993
|
chartPivotHydrationEpoch
|
|
64963
64994
|
]);
|
|
64995
|
+
const hasDatePivotRow = Boolean(String(pivotState?.rowField ?? "").trim()) && isDateType(String(pivotState?.rowFieldType ?? ""));
|
|
64964
64996
|
useEffect31(() => {
|
|
64965
64997
|
const previous = prevPivotStateForColumnExpansionRef.current;
|
|
64966
64998
|
if (previous && !pivotState) {
|
|
@@ -65444,6 +65476,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65444
65476
|
const chartTypes = useMemo32(() => {
|
|
65445
65477
|
return getChartTypeOptions2({ pivot: pivotState });
|
|
65446
65478
|
}, [pivotState]);
|
|
65479
|
+
const resolvedChartType = chartTypes.find((option) => option.value === chartType)?.value ?? chartTypes.find((option) => option.value === sourceReport?.chartType)?.value ?? chartTypes.find((option) => option.value === DEFAULT_CHART_TYPE)?.value ?? chartTypes[0]?.value ?? DEFAULT_CHART_TYPE;
|
|
65447
65480
|
useEffect31(() => {
|
|
65448
65481
|
if (!sourceReport) {
|
|
65449
65482
|
return;
|
|
@@ -66161,8 +66194,9 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66161
66194
|
return {
|
|
66162
66195
|
...previousReport,
|
|
66163
66196
|
...report,
|
|
66197
|
+
// Keep chart axis metadata from the pivot load; detail fetch is flat
|
|
66198
|
+
// (`pivot: null`) and must supply wide `columns` for the detail table.
|
|
66164
66199
|
xAxisFormat: previousReport.xAxisFormat,
|
|
66165
|
-
columns: previousReport.columns,
|
|
66166
66200
|
yAxisFields: previousReport.yAxisFields,
|
|
66167
66201
|
pivot: previousReport.pivot,
|
|
66168
66202
|
pivotRows: previousReport.pivotRows,
|
|
@@ -66280,7 +66314,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66280
66314
|
const registerOption = (fieldRaw, labelRaw, formatRaw) => {
|
|
66281
66315
|
const field = String(fieldRaw ?? "").trim();
|
|
66282
66316
|
if (!field || optionsByField.has(field)) return;
|
|
66283
|
-
const
|
|
66317
|
+
const rawLabel = String(labelRaw ?? "").trim();
|
|
66318
|
+
const label = !rawLabel || rawLabel === field ? toTitleCaseLabel(field) : rawLabel;
|
|
66284
66319
|
const format9 = toAxisFormat(formatRaw, "string");
|
|
66285
66320
|
optionsByField.set(field, {
|
|
66286
66321
|
value: field,
|
|
@@ -66399,7 +66434,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66399
66434
|
if (!field) return null;
|
|
66400
66435
|
const option = chartAxisOptionByField.get(field);
|
|
66401
66436
|
if (!option) return null;
|
|
66402
|
-
const
|
|
66437
|
+
const rawLabel = String(yAxisFieldRaw?.label ?? "").trim() || option.label;
|
|
66438
|
+
const label = rawLabel === field ? toTitleCaseLabel(field) : rawLabel;
|
|
66403
66439
|
const format9 = toAxisFormat(yAxisFieldRaw?.format, option.format);
|
|
66404
66440
|
return {
|
|
66405
66441
|
field,
|
|
@@ -66502,7 +66538,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66502
66538
|
if (chartAxisEdits.xAxisLabel !== void 0) {
|
|
66503
66539
|
return String(chartAxisEdits.xAxisLabel).trim();
|
|
66504
66540
|
}
|
|
66505
|
-
return defaultXLabel;
|
|
66541
|
+
return !defaultXLabel || defaultXLabel === resolvedXAxisField ? toTitleCaseLabel(resolvedXAxisField) : defaultXLabel;
|
|
66506
66542
|
}, [
|
|
66507
66543
|
chartAxesBaseChart?.xAxisLabel,
|
|
66508
66544
|
chartAxisEdits.xAxisLabel,
|
|
@@ -67935,7 +67971,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67935
67971
|
if (effectiveNextState.limit !== void 0)
|
|
67936
67972
|
next.limit = effectiveNextState.limit;
|
|
67937
67973
|
if (effectiveNextState.chartType !== void 0)
|
|
67938
|
-
next.chartType = effectiveNextState.chartType
|
|
67974
|
+
next.chartType = effectiveNextState.chartType;
|
|
67939
67975
|
const normalizedNext = processPivotState(next, {
|
|
67940
67976
|
nextState: effectiveNextState,
|
|
67941
67977
|
promoteColumnToRow: false,
|
|
@@ -68089,6 +68125,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68089
68125
|
adminMode: _omitAdminMode,
|
|
68090
68126
|
...sourceRest
|
|
68091
68127
|
} = sourceReport;
|
|
68128
|
+
const isFlatTable = String(resolvedChartType).toLowerCase() === "table" && !effectiveReportBuilderState.pivot;
|
|
68092
68129
|
const resp = await saveReport({
|
|
68093
68130
|
report: {
|
|
68094
68131
|
...EMPTY_INTERNAL_REPORT,
|
|
@@ -68097,8 +68134,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68097
68134
|
String(effectiveReportBuilderState.tables[0].name)
|
|
68098
68135
|
) : "New report",
|
|
68099
68136
|
// Match chart rendering (`chartData`): form `chartType` wins over stale `sourceReport`.
|
|
68100
|
-
chartType:
|
|
68137
|
+
chartType: resolvedChartType,
|
|
68101
68138
|
dashboardName: dashboardNameForNewReport,
|
|
68139
|
+
...isFlatTable ? {
|
|
68140
|
+
columns: table.columns,
|
|
68141
|
+
sort: effectiveReportBuilderState.sort?.[0] ?? null
|
|
68142
|
+
} : {},
|
|
68102
68143
|
reportBuilderState: effectiveReportBuilderState,
|
|
68103
68144
|
pivot: effectiveReportBuilderState.pivot ?? null,
|
|
68104
68145
|
// Axis control state (measures / aggregation fields). Do not use
|
|
@@ -68119,7 +68160,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68119
68160
|
});
|
|
68120
68161
|
return resp;
|
|
68121
68162
|
}, [
|
|
68122
|
-
chartType,
|
|
68123
68163
|
client,
|
|
68124
68164
|
dashboardNameForNewReport,
|
|
68125
68165
|
draftSessionId,
|
|
@@ -68130,9 +68170,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68130
68170
|
resolvedXAxisField,
|
|
68131
68171
|
resolvedXAxisFormat,
|
|
68132
68172
|
resolvedXAxisLabel,
|
|
68173
|
+
resolvedChartType,
|
|
68133
68174
|
resolvedYAxisFields,
|
|
68134
68175
|
sourceReport,
|
|
68135
68176
|
setDraftSessionId,
|
|
68177
|
+
table.columns,
|
|
68136
68178
|
tenants
|
|
68137
68179
|
]);
|
|
68138
68180
|
return {
|
|
@@ -68157,7 +68199,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68157
68199
|
groupColumnsBy,
|
|
68158
68200
|
groupColumnsByOptions,
|
|
68159
68201
|
dateBucket,
|
|
68160
|
-
dateBucketOptions: PIVOT_DATE_BUCKET_OPTIONS,
|
|
68202
|
+
dateBucketOptions: hasDatePivotRow ? PIVOT_DATE_BUCKET_OPTIONS : [],
|
|
68161
68203
|
/** Encoded selection per aggregation slot (`'sum:transactions::amount'`, `'count:transactions'`, `''` = placeholder). Update via `setReport({ aggregations: nextStringArray })`. */
|
|
68162
68204
|
aggregations: aggregationValues,
|
|
68163
68205
|
/** Flat aggregation pick list shared by all slots; always contains every non-empty `aggregations` entry. */
|
|
@@ -68165,7 +68207,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68165
68207
|
aggregationDescriptionOptions: cleanedAggregations,
|
|
68166
68208
|
sort: cleanedSort,
|
|
68167
68209
|
sortOptions,
|
|
68168
|
-
chartType,
|
|
68210
|
+
chartType: resolvedChartType,
|
|
68169
68211
|
chartTypeOptions: chartTypes,
|
|
68170
68212
|
/** Selected tabular columns in display order. */
|
|
68171
68213
|
columns: tableColumnValues,
|
|
@@ -68381,7 +68423,7 @@ function ChatChartCard({
|
|
|
68381
68423
|
label: "Chart type",
|
|
68382
68424
|
width: 200,
|
|
68383
68425
|
options: chartTypeOptions,
|
|
68384
|
-
onChange: (e) => setReport({ chartType: e.target.value
|
|
68426
|
+
onChange: (e) => setReport({ chartType: e.target.value })
|
|
68385
68427
|
}
|
|
68386
68428
|
)
|
|
68387
68429
|
]
|
|
@@ -69005,7 +69047,7 @@ function Chat({
|
|
|
69005
69047
|
}
|
|
69006
69048
|
|
|
69007
69049
|
// src/hooks/useReportFilterDraft.ts
|
|
69008
|
-
import { useCallback as useCallback6, useMemo as useMemo34, useRef as useRef26, useState as useState43 } from "react";
|
|
69050
|
+
import { useCallback as useCallback6, useEffect as useEffect33, useMemo as useMemo34, useRef as useRef26, useState as useState43 } from "react";
|
|
69009
69051
|
var normalizeOperatorKey = (operator) => String(operator ?? "").trim().toLowerCase().replace(/[_\s]+/g, "");
|
|
69010
69052
|
var defaultFilterRuleValueForOperator = (operator) => {
|
|
69011
69053
|
const key = normalizeOperatorKey(operator);
|
|
@@ -69071,12 +69113,10 @@ function useReportFilterDraft(args) {
|
|
|
69071
69113
|
const [draftQuery, setDraftQuery] = useState43(committed);
|
|
69072
69114
|
const [hasUnappliedFilterChanges, setHasUnappliedFilterChanges] = useState43(false);
|
|
69073
69115
|
const draftResetKey = `${reportId}|${committedSignature}|${resetEpoch}`;
|
|
69074
|
-
|
|
69075
|
-
|
|
69076
|
-
|
|
69077
|
-
|
|
69078
|
-
if (hasUnappliedFilterChanges) setHasUnappliedFilterChanges(false);
|
|
69079
|
-
}
|
|
69116
|
+
useEffect33(() => {
|
|
69117
|
+
setDraftQuery(committedRef.current);
|
|
69118
|
+
setHasUnappliedFilterChanges(false);
|
|
69119
|
+
}, [draftResetKey]);
|
|
69080
69120
|
const filterDraftKey = `${draftResetKey}|${fieldsSignature}`;
|
|
69081
69121
|
const handleQueryChange = useCallback6((next) => {
|
|
69082
69122
|
if (!isQueryBuilderDisplayGroup(next)) return;
|
|
@@ -69391,7 +69431,7 @@ function ReportDetail({
|
|
|
69391
69431
|
init_valueFormatter();
|
|
69392
69432
|
|
|
69393
69433
|
// src/hooks/useTenants.ts
|
|
69394
|
-
import { useContext as useContext39, useEffect as
|
|
69434
|
+
import { useContext as useContext39, useEffect as useEffect34 } from "react";
|
|
69395
69435
|
var useTenants = (dashboardName) => {
|
|
69396
69436
|
const {
|
|
69397
69437
|
tenants,
|
|
@@ -69405,12 +69445,12 @@ var useTenants = (dashboardName) => {
|
|
|
69405
69445
|
getMappedTenantsForDashboard,
|
|
69406
69446
|
getViewerTenantsByOwner
|
|
69407
69447
|
} = useContext39(TenantContext);
|
|
69408
|
-
|
|
69448
|
+
useEffect34(() => {
|
|
69409
69449
|
if (dashboardName) {
|
|
69410
69450
|
fetchViewerTenantsForDashboard(dashboardName);
|
|
69411
69451
|
}
|
|
69412
69452
|
}, [dashboardName, fetchViewerTenantsForDashboard]);
|
|
69413
|
-
|
|
69453
|
+
useEffect34(() => {
|
|
69414
69454
|
if (dashboardName) {
|
|
69415
69455
|
fetchMappedTenantsForDashboard(dashboardName);
|
|
69416
69456
|
}
|
|
@@ -69429,7 +69469,7 @@ var useTenants = (dashboardName) => {
|
|
|
69429
69469
|
};
|
|
69430
69470
|
|
|
69431
69471
|
// src/hooks/useQuill.ts
|
|
69432
|
-
import { useContext as useContext40, useEffect as
|
|
69472
|
+
import { useContext as useContext40, useEffect as useEffect35, useMemo as useMemo35, useState as useState45 } from "react";
|
|
69433
69473
|
init_paginationProcessing();
|
|
69434
69474
|
init_tableProcessing();
|
|
69435
69475
|
init_dataProcessing();
|
|
@@ -69612,7 +69652,7 @@ var useQuill = (reportId, pagination) => {
|
|
|
69612
69652
|
setLoading(false);
|
|
69613
69653
|
}
|
|
69614
69654
|
};
|
|
69615
|
-
|
|
69655
|
+
useEffect35(() => {
|
|
69616
69656
|
if (isClientLoading) return;
|
|
69617
69657
|
if (reportId && specificReportFilters) {
|
|
69618
69658
|
fetchReportHelper(reportId, {
|
|
@@ -69679,7 +69719,7 @@ var useMemoizedRows = (reportId) => {
|
|
|
69679
69719
|
};
|
|
69680
69720
|
|
|
69681
69721
|
// src/hooks/useAskQuill.tsx
|
|
69682
|
-
import { useContext as useContext41, useEffect as
|
|
69722
|
+
import { useContext as useContext41, useEffect as useEffect36, useState as useState46 } from "react";
|
|
69683
69723
|
init_astProcessing();
|
|
69684
69724
|
init_astFilterProcessing();
|
|
69685
69725
|
init_pivotProcessing();
|
|
@@ -69925,7 +69965,7 @@ var useAskQuill = (dashboardName) => {
|
|
|
69925
69965
|
});
|
|
69926
69966
|
setLoading(false);
|
|
69927
69967
|
};
|
|
69928
|
-
|
|
69968
|
+
useEffect36(() => {
|
|
69929
69969
|
setAsk(() => askHelper);
|
|
69930
69970
|
}, [schemaData.schema]);
|
|
69931
69971
|
return {
|