@quillsql/react 2.16.70 → 2.16.72
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 +71 -31
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +71 -31
- 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
|
}
|
|
@@ -62092,6 +62102,12 @@ function mergeDisplayAndSourceForTableFormats(args) {
|
|
|
62092
62102
|
for (const candidateKey of candidateKeys) {
|
|
62093
62103
|
const candidates = sourceColumnsByKey.get(candidateKey) ?? [];
|
|
62094
62104
|
if (candidates.length === 0) continue;
|
|
62105
|
+
const exactFieldMatch = candidates.find(
|
|
62106
|
+
(candidate) => String(candidate.field ?? "").trim() === candidateKey
|
|
62107
|
+
);
|
|
62108
|
+
if (exactFieldMatch) {
|
|
62109
|
+
return exactFieldMatch;
|
|
62110
|
+
}
|
|
62095
62111
|
if (selection.table) {
|
|
62096
62112
|
const tableMatch = candidates.find((candidate) => {
|
|
62097
62113
|
return String(candidate.table ?? "").trim() === selection.table;
|
|
@@ -62214,9 +62230,20 @@ var CHART_TYPES2 = [
|
|
|
62214
62230
|
"US map",
|
|
62215
62231
|
"World map"
|
|
62216
62232
|
];
|
|
62233
|
+
var SINGLE_AGGREGATION_CHART_TYPES2 = [
|
|
62234
|
+
"stacked",
|
|
62235
|
+
"stacked bar",
|
|
62236
|
+
"bar",
|
|
62237
|
+
"pie",
|
|
62238
|
+
"gauge",
|
|
62239
|
+
"metric"
|
|
62240
|
+
];
|
|
62217
62241
|
var DEFAULT_CHART_TYPE = "table";
|
|
62218
62242
|
function getChartTypeOptions2(formData) {
|
|
62219
|
-
const
|
|
62243
|
+
const hasMultipleAggregations = (formData.pivot?.aggregations?.length ?? 0) > 1;
|
|
62244
|
+
const viableCharts = CHART_TYPES2.filter(
|
|
62245
|
+
(chartType) => !(hasMultipleAggregations && SINGLE_AGGREGATION_CHART_TYPES2.includes(chartType))
|
|
62246
|
+
);
|
|
62220
62247
|
if (formData.pivot && !formData.pivot.rowField) {
|
|
62221
62248
|
return viableCharts.filter((elem) => ["table", "metric", "gauge"].includes(elem)).map((elem) => ({ label: elem, value: elem }));
|
|
62222
62249
|
}
|
|
@@ -63718,16 +63745,28 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63718
63745
|
queryColumnsBootstrapKey
|
|
63719
63746
|
]);
|
|
63720
63747
|
const datasourceOptions = (0, import_react61.useMemo)(() => {
|
|
63748
|
+
const tableNames = new Set(
|
|
63749
|
+
schemaForReportBuilderState.map((table2) => String(table2.name ?? "").trim()).filter(Boolean)
|
|
63750
|
+
);
|
|
63721
63751
|
const seen = /* @__PURE__ */ new Set();
|
|
63722
63752
|
const result = [];
|
|
63723
63753
|
for (const table2 of schemaForReportBuilderState) {
|
|
63724
63754
|
const name2 = String(table2.name ?? "").trim();
|
|
63725
63755
|
if (!name2 || seen.has(name2)) continue;
|
|
63726
63756
|
seen.add(name2);
|
|
63727
|
-
result.push({
|
|
63757
|
+
result.push({
|
|
63758
|
+
value: name2,
|
|
63759
|
+
label: toTitleCaseLabel(name2),
|
|
63760
|
+
joinOptions: getJoinCompatibleTableNames(
|
|
63761
|
+
[name2],
|
|
63762
|
+
schemaForeignKeyMap
|
|
63763
|
+
).filter(
|
|
63764
|
+
(candidate) => candidate !== name2 && tableNames.has(candidate)
|
|
63765
|
+
)
|
|
63766
|
+
});
|
|
63728
63767
|
}
|
|
63729
63768
|
return result;
|
|
63730
|
-
}, [schemaForReportBuilderState]);
|
|
63769
|
+
}, [schemaForReportBuilderState, schemaForeignKeyMap]);
|
|
63731
63770
|
const queryBuilderFieldConfigByName = (0, import_react61.useMemo)(() => {
|
|
63732
63771
|
const configByName = buildQueryBuilderFieldConfigByName(
|
|
63733
63772
|
schemaForReportBuilderState
|
|
@@ -64599,9 +64638,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64599
64638
|
reportId: effectiveReportId,
|
|
64600
64639
|
draftSessionId,
|
|
64601
64640
|
useInMemoryEngines,
|
|
64602
|
-
hasInitialReportBuilderState: Boolean(
|
|
64603
|
-
initialReportBuilderStateForLoad
|
|
64604
|
-
),
|
|
64641
|
+
hasInitialReportBuilderState: Boolean(initialReportBuilderStateForLoad),
|
|
64605
64642
|
reloadKeyHash,
|
|
64606
64643
|
tenantHash,
|
|
64607
64644
|
flagHash,
|
|
@@ -65424,11 +65461,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65424
65461
|
}
|
|
65425
65462
|
return { ...currentReport, rowCount: countReport.rowCount };
|
|
65426
65463
|
});
|
|
65427
|
-
}, [
|
|
65428
|
-
createdBootstrapRowCountQuery.data,
|
|
65429
|
-
effectiveReportId,
|
|
65430
|
-
sourceReport?.id
|
|
65431
|
-
]);
|
|
65464
|
+
}, [createdBootstrapRowCountQuery.data, effectiveReportId, sourceReport?.id]);
|
|
65432
65465
|
const chartTypes = (0, import_react61.useMemo)(() => {
|
|
65433
65466
|
return getChartTypeOptions2({ pivot: pivotState });
|
|
65434
65467
|
}, [pivotState]);
|
|
@@ -66234,7 +66267,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66234
66267
|
const chartData = (0, import_react61.useMemo)(() => {
|
|
66235
66268
|
if (!sourceReport) return void 0;
|
|
66236
66269
|
const rowsForChart = Array.isArray(sourceReport.rows) ? sourceReport.rows : [];
|
|
66237
|
-
const
|
|
66270
|
+
const settledPivot = sourceReport.pivot ?? null;
|
|
66271
|
+
const settledSourceRowField = String(
|
|
66272
|
+
sourceReport.pivotResultSourceRowField ?? settledPivot?.rowField ?? ""
|
|
66273
|
+
).trim();
|
|
66274
|
+
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());
|
|
66275
|
+
const chartPivot = pendingPivotChangesDimensions ? sourceReport.pivot ?? null : nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
|
|
66238
66276
|
const chartPivotForDisplay = chartPivot && sourceReport.pivotResultRowField && sourceReport.pivotResultSourceRowField === chartPivot.rowField ? {
|
|
66239
66277
|
...chartPivot,
|
|
66240
66278
|
rowField: sourceReport.pivotResultRowField
|
|
@@ -66260,6 +66298,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66260
66298
|
sourceReport,
|
|
66261
66299
|
chartType,
|
|
66262
66300
|
nextPivot,
|
|
66301
|
+
pendingPivotRefresh,
|
|
66263
66302
|
effectiveReportBuilderState,
|
|
66264
66303
|
useInMemoryEngines,
|
|
66265
66304
|
chartPivotHydrationEpoch
|
|
@@ -68132,6 +68171,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68132
68171
|
...sourceRest
|
|
68133
68172
|
} = sourceReport;
|
|
68134
68173
|
const isFlatTable = String(resolvedChartType).toLowerCase() === "table" && !effectiveReportBuilderState.pivot;
|
|
68174
|
+
const isPivotTable = String(resolvedChartType).toLowerCase() === "table" && Boolean(effectiveReportBuilderState.pivot);
|
|
68135
68175
|
const resp = await saveReport({
|
|
68136
68176
|
report: {
|
|
68137
68177
|
...EMPTY_INTERNAL_REPORT,
|
|
@@ -68142,8 +68182,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68142
68182
|
// Match chart rendering (`chartData`): form `chartType` wins over stale `sourceReport`.
|
|
68143
68183
|
chartType: resolvedChartType,
|
|
68144
68184
|
dashboardName: dashboardNameForNewReport,
|
|
68185
|
+
...!isPivotTable ? { columns: table.columns } : {},
|
|
68145
68186
|
...isFlatTable ? {
|
|
68146
|
-
columns: table.columns,
|
|
68147
68187
|
sort: effectiveReportBuilderState.sort?.[0] ?? null
|
|
68148
68188
|
} : {},
|
|
68149
68189
|
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
|
}
|
|
@@ -62304,6 +62314,12 @@ function mergeDisplayAndSourceForTableFormats(args) {
|
|
|
62304
62314
|
for (const candidateKey of candidateKeys) {
|
|
62305
62315
|
const candidates = sourceColumnsByKey.get(candidateKey) ?? [];
|
|
62306
62316
|
if (candidates.length === 0) continue;
|
|
62317
|
+
const exactFieldMatch = candidates.find(
|
|
62318
|
+
(candidate) => String(candidate.field ?? "").trim() === candidateKey
|
|
62319
|
+
);
|
|
62320
|
+
if (exactFieldMatch) {
|
|
62321
|
+
return exactFieldMatch;
|
|
62322
|
+
}
|
|
62307
62323
|
if (selection.table) {
|
|
62308
62324
|
const tableMatch = candidates.find((candidate) => {
|
|
62309
62325
|
return String(candidate.table ?? "").trim() === selection.table;
|
|
@@ -62426,9 +62442,20 @@ var CHART_TYPES2 = [
|
|
|
62426
62442
|
"US map",
|
|
62427
62443
|
"World map"
|
|
62428
62444
|
];
|
|
62445
|
+
var SINGLE_AGGREGATION_CHART_TYPES2 = [
|
|
62446
|
+
"stacked",
|
|
62447
|
+
"stacked bar",
|
|
62448
|
+
"bar",
|
|
62449
|
+
"pie",
|
|
62450
|
+
"gauge",
|
|
62451
|
+
"metric"
|
|
62452
|
+
];
|
|
62429
62453
|
var DEFAULT_CHART_TYPE = "table";
|
|
62430
62454
|
function getChartTypeOptions2(formData) {
|
|
62431
|
-
const
|
|
62455
|
+
const hasMultipleAggregations = (formData.pivot?.aggregations?.length ?? 0) > 1;
|
|
62456
|
+
const viableCharts = CHART_TYPES2.filter(
|
|
62457
|
+
(chartType) => !(hasMultipleAggregations && SINGLE_AGGREGATION_CHART_TYPES2.includes(chartType))
|
|
62458
|
+
);
|
|
62432
62459
|
if (formData.pivot && !formData.pivot.rowField) {
|
|
62433
62460
|
return viableCharts.filter((elem) => ["table", "metric", "gauge"].includes(elem)).map((elem) => ({ label: elem, value: elem }));
|
|
62434
62461
|
}
|
|
@@ -63930,16 +63957,28 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63930
63957
|
queryColumnsBootstrapKey
|
|
63931
63958
|
]);
|
|
63932
63959
|
const datasourceOptions = useMemo33(() => {
|
|
63960
|
+
const tableNames = new Set(
|
|
63961
|
+
schemaForReportBuilderState.map((table2) => String(table2.name ?? "").trim()).filter(Boolean)
|
|
63962
|
+
);
|
|
63933
63963
|
const seen = /* @__PURE__ */ new Set();
|
|
63934
63964
|
const result = [];
|
|
63935
63965
|
for (const table2 of schemaForReportBuilderState) {
|
|
63936
63966
|
const name2 = String(table2.name ?? "").trim();
|
|
63937
63967
|
if (!name2 || seen.has(name2)) continue;
|
|
63938
63968
|
seen.add(name2);
|
|
63939
|
-
result.push({
|
|
63969
|
+
result.push({
|
|
63970
|
+
value: name2,
|
|
63971
|
+
label: toTitleCaseLabel(name2),
|
|
63972
|
+
joinOptions: getJoinCompatibleTableNames(
|
|
63973
|
+
[name2],
|
|
63974
|
+
schemaForeignKeyMap
|
|
63975
|
+
).filter(
|
|
63976
|
+
(candidate) => candidate !== name2 && tableNames.has(candidate)
|
|
63977
|
+
)
|
|
63978
|
+
});
|
|
63940
63979
|
}
|
|
63941
63980
|
return result;
|
|
63942
|
-
}, [schemaForReportBuilderState]);
|
|
63981
|
+
}, [schemaForReportBuilderState, schemaForeignKeyMap]);
|
|
63943
63982
|
const queryBuilderFieldConfigByName = useMemo33(() => {
|
|
63944
63983
|
const configByName = buildQueryBuilderFieldConfigByName(
|
|
63945
63984
|
schemaForReportBuilderState
|
|
@@ -64811,9 +64850,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
64811
64850
|
reportId: effectiveReportId,
|
|
64812
64851
|
draftSessionId,
|
|
64813
64852
|
useInMemoryEngines,
|
|
64814
|
-
hasInitialReportBuilderState: Boolean(
|
|
64815
|
-
initialReportBuilderStateForLoad
|
|
64816
|
-
),
|
|
64853
|
+
hasInitialReportBuilderState: Boolean(initialReportBuilderStateForLoad),
|
|
64817
64854
|
reloadKeyHash,
|
|
64818
64855
|
tenantHash,
|
|
64819
64856
|
flagHash,
|
|
@@ -65636,11 +65673,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
65636
65673
|
}
|
|
65637
65674
|
return { ...currentReport, rowCount: countReport.rowCount };
|
|
65638
65675
|
});
|
|
65639
|
-
}, [
|
|
65640
|
-
createdBootstrapRowCountQuery.data,
|
|
65641
|
-
effectiveReportId,
|
|
65642
|
-
sourceReport?.id
|
|
65643
|
-
]);
|
|
65676
|
+
}, [createdBootstrapRowCountQuery.data, effectiveReportId, sourceReport?.id]);
|
|
65644
65677
|
const chartTypes = useMemo33(() => {
|
|
65645
65678
|
return getChartTypeOptions2({ pivot: pivotState });
|
|
65646
65679
|
}, [pivotState]);
|
|
@@ -66446,7 +66479,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66446
66479
|
const chartData = useMemo33(() => {
|
|
66447
66480
|
if (!sourceReport) return void 0;
|
|
66448
66481
|
const rowsForChart = Array.isArray(sourceReport.rows) ? sourceReport.rows : [];
|
|
66449
|
-
const
|
|
66482
|
+
const settledPivot = sourceReport.pivot ?? null;
|
|
66483
|
+
const settledSourceRowField = String(
|
|
66484
|
+
sourceReport.pivotResultSourceRowField ?? settledPivot?.rowField ?? ""
|
|
66485
|
+
).trim();
|
|
66486
|
+
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());
|
|
66487
|
+
const chartPivot = pendingPivotChangesDimensions ? sourceReport.pivot ?? null : nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
|
|
66450
66488
|
const chartPivotForDisplay = chartPivot && sourceReport.pivotResultRowField && sourceReport.pivotResultSourceRowField === chartPivot.rowField ? {
|
|
66451
66489
|
...chartPivot,
|
|
66452
66490
|
rowField: sourceReport.pivotResultRowField
|
|
@@ -66472,6 +66510,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66472
66510
|
sourceReport,
|
|
66473
66511
|
chartType,
|
|
66474
66512
|
nextPivot,
|
|
66513
|
+
pendingPivotRefresh,
|
|
66475
66514
|
effectiveReportBuilderState,
|
|
66476
66515
|
useInMemoryEngines,
|
|
66477
66516
|
chartPivotHydrationEpoch
|
|
@@ -68344,6 +68383,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68344
68383
|
...sourceRest
|
|
68345
68384
|
} = sourceReport;
|
|
68346
68385
|
const isFlatTable = String(resolvedChartType).toLowerCase() === "table" && !effectiveReportBuilderState.pivot;
|
|
68386
|
+
const isPivotTable = String(resolvedChartType).toLowerCase() === "table" && Boolean(effectiveReportBuilderState.pivot);
|
|
68347
68387
|
const resp = await saveReport({
|
|
68348
68388
|
report: {
|
|
68349
68389
|
...EMPTY_INTERNAL_REPORT,
|
|
@@ -68354,8 +68394,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
68354
68394
|
// Match chart rendering (`chartData`): form `chartType` wins over stale `sourceReport`.
|
|
68355
68395
|
chartType: resolvedChartType,
|
|
68356
68396
|
dashboardName: dashboardNameForNewReport,
|
|
68397
|
+
...!isPivotTable ? { columns: table.columns } : {},
|
|
68357
68398
|
...isFlatTable ? {
|
|
68358
|
-
columns: table.columns,
|
|
68359
68399
|
sort: effectiveReportBuilderState.sort?.[0] ?? null
|
|
68360
68400
|
} : {},
|
|
68361
68401
|
reportBuilderState: effectiveReportBuilderState,
|