@quillsql/react 2.16.53 → 2.16.55

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 CHANGED
@@ -369,8 +369,9 @@ var init_valueFormatter = __esm({
369
369
  return _getUTCDateHelper(value, "dd MMM yyyy");
370
370
  };
371
371
  format_MMM_d_MMM_d = (value, dateRange, databaseType) => {
372
- const utcDate = (0, import_date_fns.parseISO)(value.split("T")[0]);
373
- if (!(0, import_date_fns.isValid)(utcDate)) return "Invalid date";
372
+ const input = String(value);
373
+ const utcDate = (0, import_date_fns.parseISO)(input.split("T")[0] ?? "");
374
+ if (!(0, import_date_fns.isValid)(utcDate)) return input;
374
375
  let weekStartsOn = 1;
375
376
  if (databaseType && ["mssql"].includes(databaseType)) {
376
377
  weekStartsOn = 0;
@@ -32867,7 +32868,7 @@ var format_hh_ap_pm2 = (value) => _getUTCDateHelper2(value, "hh:mm aa");
32867
32868
  var format_MMM_dd_yyyy2 = (value) => _getUTCDateHelper2(value, "dd MMM yyyy");
32868
32869
  var format_MMM_dd_MMM_dd = (value) => {
32869
32870
  const utcDate = (0, import_date_fns_tz4.utcToZonedTime)(new Date(value), "UTC");
32870
- if (!(0, import_date_fns11.isValid)(utcDate)) return "Invalid date";
32871
+ if (!(0, import_date_fns11.isValid)(utcDate)) return String(value);
32871
32872
  const monday = (0, import_date_fns11.startOfWeek)(utcDate, { weekStartsOn: 1 });
32872
32873
  const sunday = (0, import_date_fns11.endOfWeek)(utcDate, { weekStartsOn: 1 });
32873
32874
  if ((0, import_date_fns11.format)(monday, "MMM") === (0, import_date_fns11.format)(sunday, "MMM")) {
@@ -60774,7 +60775,7 @@ function buildAggregationLabel(aggregation, report) {
60774
60775
  return report?.pivot?.columnField ? "Count" : `Count ${snakeAndCamelCaseToTitleCase(tableNames[0] ?? "table")}`;
60775
60776
  }
60776
60777
  const rawTarget = aggregation.valueField ?? (tableNames.length > 0 ? tableNames.join(", ") : "table");
60777
- const target = report ? aggregation.valueField ? resolveValueFieldDisplayLabel(report, aggregation.valueField) : rawTarget : rawTarget;
60778
+ const target = aggregation.valueField && report ? resolveValueFieldDisplayLabel(report, aggregation.valueField) : toTitleCaseLabel(rawTarget);
60778
60779
  if (String(aggregationType).toLowerCase() === "percentage") {
60779
60780
  const valueField2 = String(
60780
60781
  aggregation.valueField2 ?? ""
@@ -61924,6 +61925,20 @@ function coerceTableColumnFormatToAxisValue(raw) {
61924
61925
  if (byLabel) return byLabel.value;
61925
61926
  return t;
61926
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
+ }
61927
61942
  function mergeDisplayAndSourceForTableFormats(args) {
61928
61943
  const {
61929
61944
  effectiveReportBuilderTableNames,
@@ -62047,10 +62062,26 @@ function mergeDisplayAndSourceForTableFormats(args) {
62047
62062
  ).trim()}`;
62048
62063
  if (!seenKey || seenColumnsByTableAndField.has(seenKey)) continue;
62049
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";
62050
62076
  const merged = {
62051
62077
  ...matchedColumn,
62052
62078
  ...selection.alias ? { label: selection.alias } : {},
62053
- ...selection.format ? { format: selection.format } : {}
62079
+ format: resolveTableColumnDefaultFormat({
62080
+ selectedFormat: selection.format,
62081
+ sourceFormat: matchedColumn.format,
62082
+ isDateColumn,
62083
+ preserveStringFormat: isPivotDateBucketString
62084
+ })
62054
62085
  };
62055
62086
  selectedColumnsForTable.push(merged);
62056
62087
  const id = encodeColumnOptionValue(selection.table, selection.field);
@@ -62123,6 +62154,7 @@ var CHART_TYPES2 = [
62123
62154
  "US map",
62124
62155
  "World map"
62125
62156
  ];
62157
+ var DEFAULT_CHART_TYPE = "table";
62126
62158
  function getChartTypeOptions2(formData) {
62127
62159
  const viableCharts = CHART_TYPES2;
62128
62160
  if (formData.pivot && !formData.pivot.rowField) {
@@ -64748,6 +64780,7 @@ function useReport(reportIdArg, options = {}) {
64748
64780
  effectiveReportId,
64749
64781
  chartPivotHydrationEpoch
64750
64782
  ]);
64783
+ const hasDatePivotRow = Boolean(String(pivotState?.rowField ?? "").trim()) && isDateType(String(pivotState?.rowFieldType ?? ""));
64751
64784
  (0, import_react61.useEffect)(() => {
64752
64785
  const previous = prevPivotStateForColumnExpansionRef.current;
64753
64786
  if (previous && !pivotState) {
@@ -65231,6 +65264,7 @@ function useReport(reportIdArg, options = {}) {
65231
65264
  const chartTypes = (0, import_react61.useMemo)(() => {
65232
65265
  return getChartTypeOptions2({ pivot: pivotState });
65233
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;
65234
65268
  (0, import_react61.useEffect)(() => {
65235
65269
  if (!sourceReport) {
65236
65270
  return;
@@ -66067,7 +66101,8 @@ function useReport(reportIdArg, options = {}) {
66067
66101
  const registerOption = (fieldRaw, labelRaw, formatRaw) => {
66068
66102
  const field = String(fieldRaw ?? "").trim();
66069
66103
  if (!field || optionsByField.has(field)) return;
66070
- const label = String(labelRaw ?? "").trim() || field;
66104
+ const rawLabel = String(labelRaw ?? "").trim();
66105
+ const label = !rawLabel || rawLabel === field ? toTitleCaseLabel(field) : rawLabel;
66071
66106
  const format9 = toAxisFormat(formatRaw, "string");
66072
66107
  optionsByField.set(field, {
66073
66108
  value: field,
@@ -66186,7 +66221,8 @@ function useReport(reportIdArg, options = {}) {
66186
66221
  if (!field) return null;
66187
66222
  const option = chartAxisOptionByField.get(field);
66188
66223
  if (!option) return null;
66189
- const label = String(yAxisFieldRaw?.label ?? "").trim() || option.label;
66224
+ const rawLabel = String(yAxisFieldRaw?.label ?? "").trim() || option.label;
66225
+ const label = rawLabel === field ? toTitleCaseLabel(field) : rawLabel;
66190
66226
  const format9 = toAxisFormat(yAxisFieldRaw?.format, option.format);
66191
66227
  return {
66192
66228
  field,
@@ -66289,7 +66325,7 @@ function useReport(reportIdArg, options = {}) {
66289
66325
  if (chartAxisEdits.xAxisLabel !== void 0) {
66290
66326
  return String(chartAxisEdits.xAxisLabel).trim();
66291
66327
  }
66292
- return defaultXLabel;
66328
+ return !defaultXLabel || defaultXLabel === resolvedXAxisField ? toTitleCaseLabel(resolvedXAxisField) : defaultXLabel;
66293
66329
  }, [
66294
66330
  chartAxesBaseChart?.xAxisLabel,
66295
66331
  chartAxisEdits.xAxisLabel,
@@ -67722,7 +67758,7 @@ function useReport(reportIdArg, options = {}) {
67722
67758
  if (effectiveNextState.limit !== void 0)
67723
67759
  next.limit = effectiveNextState.limit;
67724
67760
  if (effectiveNextState.chartType !== void 0)
67725
- next.chartType = effectiveNextState.chartType || void 0;
67761
+ next.chartType = effectiveNextState.chartType;
67726
67762
  const normalizedNext = processPivotState(next, {
67727
67763
  nextState: effectiveNextState,
67728
67764
  promoteColumnToRow: false,
@@ -67884,7 +67920,7 @@ function useReport(reportIdArg, options = {}) {
67884
67920
  String(effectiveReportBuilderState.tables[0].name)
67885
67921
  ) : "New report",
67886
67922
  // Match chart rendering (`chartData`): form `chartType` wins over stale `sourceReport`.
67887
- chartType: chartType ?? sourceRest.chartType ?? "table",
67923
+ chartType: resolvedChartType,
67888
67924
  dashboardName: dashboardNameForNewReport,
67889
67925
  reportBuilderState: effectiveReportBuilderState,
67890
67926
  pivot: effectiveReportBuilderState.pivot ?? null,
@@ -67906,7 +67942,6 @@ function useReport(reportIdArg, options = {}) {
67906
67942
  });
67907
67943
  return resp;
67908
67944
  }, [
67909
- chartType,
67910
67945
  client,
67911
67946
  dashboardNameForNewReport,
67912
67947
  draftSessionId,
@@ -67917,6 +67952,7 @@ function useReport(reportIdArg, options = {}) {
67917
67952
  resolvedXAxisField,
67918
67953
  resolvedXAxisFormat,
67919
67954
  resolvedXAxisLabel,
67955
+ resolvedChartType,
67920
67956
  resolvedYAxisFields,
67921
67957
  sourceReport,
67922
67958
  setDraftSessionId,
@@ -67944,7 +67980,7 @@ function useReport(reportIdArg, options = {}) {
67944
67980
  groupColumnsBy,
67945
67981
  groupColumnsByOptions,
67946
67982
  dateBucket,
67947
- dateBucketOptions: PIVOT_DATE_BUCKET_OPTIONS,
67983
+ dateBucketOptions: hasDatePivotRow ? PIVOT_DATE_BUCKET_OPTIONS : [],
67948
67984
  /** Encoded selection per aggregation slot (`'sum:transactions::amount'`, `'count:transactions'`, `''` = placeholder). Update via `setReport({ aggregations: nextStringArray })`. */
67949
67985
  aggregations: aggregationValues,
67950
67986
  /** Flat aggregation pick list shared by all slots; always contains every non-empty `aggregations` entry. */
@@ -67952,7 +67988,7 @@ function useReport(reportIdArg, options = {}) {
67952
67988
  aggregationDescriptionOptions: cleanedAggregations,
67953
67989
  sort: cleanedSort,
67954
67990
  sortOptions,
67955
- chartType,
67991
+ chartType: resolvedChartType,
67956
67992
  chartTypeOptions: chartTypes,
67957
67993
  /** Selected tabular columns in display order. */
67958
67994
  columns: tableColumnValues,
@@ -68168,7 +68204,7 @@ function ChatChartCard({
68168
68204
  label: "Chart type",
68169
68205
  width: 200,
68170
68206
  options: chartTypeOptions,
68171
- onChange: (e) => setReport({ chartType: e.target.value ?? "" })
68207
+ onChange: (e) => setReport({ chartType: e.target.value })
68172
68208
  }
68173
68209
  )
68174
68210
  ]
@@ -68858,12 +68894,10 @@ function useReportFilterDraft(args) {
68858
68894
  const [draftQuery, setDraftQuery] = (0, import_react64.useState)(committed);
68859
68895
  const [hasUnappliedFilterChanges, setHasUnappliedFilterChanges] = (0, import_react64.useState)(false);
68860
68896
  const draftResetKey = `${reportId}|${committedSignature}|${resetEpoch}`;
68861
- const prevDraftResetKeyRef = (0, import_react64.useRef)(draftResetKey);
68862
- if (prevDraftResetKeyRef.current !== draftResetKey) {
68863
- prevDraftResetKeyRef.current = draftResetKey;
68864
- setDraftQuery(committed);
68865
- if (hasUnappliedFilterChanges) setHasUnappliedFilterChanges(false);
68866
- }
68897
+ (0, import_react64.useEffect)(() => {
68898
+ setDraftQuery(committedRef.current);
68899
+ setHasUnappliedFilterChanges(false);
68900
+ }, [draftResetKey]);
68867
68901
  const filterDraftKey = `${draftResetKey}|${fieldsSignature}`;
68868
68902
  const handleQueryChange = (0, import_react64.useCallback)((next) => {
68869
68903
  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?: string;
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: string | undefined;
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?: string;
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: string | undefined;
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
@@ -383,8 +383,9 @@ var init_valueFormatter = __esm({
383
383
  return _getUTCDateHelper(value, "dd MMM yyyy");
384
384
  };
385
385
  format_MMM_d_MMM_d = (value, dateRange, databaseType) => {
386
- const utcDate = parseISO(value.split("T")[0]);
387
- if (!isValid(utcDate)) return "Invalid date";
386
+ const input = String(value);
387
+ const utcDate = parseISO(input.split("T")[0] ?? "");
388
+ if (!isValid(utcDate)) return input;
388
389
  let weekStartsOn = 1;
389
390
  if (databaseType && ["mssql"].includes(databaseType)) {
390
391
  weekStartsOn = 0;
@@ -32909,7 +32910,7 @@ var format_hh_ap_pm2 = (value) => _getUTCDateHelper2(value, "hh:mm aa");
32909
32910
  var format_MMM_dd_yyyy2 = (value) => _getUTCDateHelper2(value, "dd MMM yyyy");
32910
32911
  var format_MMM_dd_MMM_dd = (value) => {
32911
32912
  const utcDate = utcToZonedTime4(new Date(value), "UTC");
32912
- if (!isValid5(utcDate)) return "Invalid date";
32913
+ if (!isValid5(utcDate)) return String(value);
32913
32914
  const monday = startOfWeek5(utcDate, { weekStartsOn: 1 });
32914
32915
  const sunday = endOfWeek2(utcDate, { weekStartsOn: 1 });
32915
32916
  if (format5(monday, "MMM") === format5(sunday, "MMM")) {
@@ -60986,7 +60987,7 @@ function buildAggregationLabel(aggregation, report) {
60986
60987
  return report?.pivot?.columnField ? "Count" : `Count ${snakeAndCamelCaseToTitleCase(tableNames[0] ?? "table")}`;
60987
60988
  }
60988
60989
  const rawTarget = aggregation.valueField ?? (tableNames.length > 0 ? tableNames.join(", ") : "table");
60989
- const target = report ? aggregation.valueField ? resolveValueFieldDisplayLabel(report, aggregation.valueField) : rawTarget : rawTarget;
60990
+ const target = aggregation.valueField && report ? resolveValueFieldDisplayLabel(report, aggregation.valueField) : toTitleCaseLabel(rawTarget);
60990
60991
  if (String(aggregationType).toLowerCase() === "percentage") {
60991
60992
  const valueField2 = String(
60992
60993
  aggregation.valueField2 ?? ""
@@ -62136,6 +62137,20 @@ function coerceTableColumnFormatToAxisValue(raw) {
62136
62137
  if (byLabel) return byLabel.value;
62137
62138
  return t;
62138
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
+ }
62139
62154
  function mergeDisplayAndSourceForTableFormats(args) {
62140
62155
  const {
62141
62156
  effectiveReportBuilderTableNames,
@@ -62259,10 +62274,26 @@ function mergeDisplayAndSourceForTableFormats(args) {
62259
62274
  ).trim()}`;
62260
62275
  if (!seenKey || seenColumnsByTableAndField.has(seenKey)) continue;
62261
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";
62262
62288
  const merged = {
62263
62289
  ...matchedColumn,
62264
62290
  ...selection.alias ? { label: selection.alias } : {},
62265
- ...selection.format ? { format: selection.format } : {}
62291
+ format: resolveTableColumnDefaultFormat({
62292
+ selectedFormat: selection.format,
62293
+ sourceFormat: matchedColumn.format,
62294
+ isDateColumn,
62295
+ preserveStringFormat: isPivotDateBucketString
62296
+ })
62266
62297
  };
62267
62298
  selectedColumnsForTable.push(merged);
62268
62299
  const id = encodeColumnOptionValue(selection.table, selection.field);
@@ -62335,6 +62366,7 @@ var CHART_TYPES2 = [
62335
62366
  "US map",
62336
62367
  "World map"
62337
62368
  ];
62369
+ var DEFAULT_CHART_TYPE = "table";
62338
62370
  function getChartTypeOptions2(formData) {
62339
62371
  const viableCharts = CHART_TYPES2;
62340
62372
  if (formData.pivot && !formData.pivot.rowField) {
@@ -64960,6 +64992,7 @@ function useReport(reportIdArg, options = {}) {
64960
64992
  effectiveReportId,
64961
64993
  chartPivotHydrationEpoch
64962
64994
  ]);
64995
+ const hasDatePivotRow = Boolean(String(pivotState?.rowField ?? "").trim()) && isDateType(String(pivotState?.rowFieldType ?? ""));
64963
64996
  useEffect31(() => {
64964
64997
  const previous = prevPivotStateForColumnExpansionRef.current;
64965
64998
  if (previous && !pivotState) {
@@ -65443,6 +65476,7 @@ function useReport(reportIdArg, options = {}) {
65443
65476
  const chartTypes = useMemo32(() => {
65444
65477
  return getChartTypeOptions2({ pivot: pivotState });
65445
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;
65446
65480
  useEffect31(() => {
65447
65481
  if (!sourceReport) {
65448
65482
  return;
@@ -66279,7 +66313,8 @@ function useReport(reportIdArg, options = {}) {
66279
66313
  const registerOption = (fieldRaw, labelRaw, formatRaw) => {
66280
66314
  const field = String(fieldRaw ?? "").trim();
66281
66315
  if (!field || optionsByField.has(field)) return;
66282
- const label = String(labelRaw ?? "").trim() || field;
66316
+ const rawLabel = String(labelRaw ?? "").trim();
66317
+ const label = !rawLabel || rawLabel === field ? toTitleCaseLabel(field) : rawLabel;
66283
66318
  const format9 = toAxisFormat(formatRaw, "string");
66284
66319
  optionsByField.set(field, {
66285
66320
  value: field,
@@ -66398,7 +66433,8 @@ function useReport(reportIdArg, options = {}) {
66398
66433
  if (!field) return null;
66399
66434
  const option = chartAxisOptionByField.get(field);
66400
66435
  if (!option) return null;
66401
- const label = String(yAxisFieldRaw?.label ?? "").trim() || option.label;
66436
+ const rawLabel = String(yAxisFieldRaw?.label ?? "").trim() || option.label;
66437
+ const label = rawLabel === field ? toTitleCaseLabel(field) : rawLabel;
66402
66438
  const format9 = toAxisFormat(yAxisFieldRaw?.format, option.format);
66403
66439
  return {
66404
66440
  field,
@@ -66501,7 +66537,7 @@ function useReport(reportIdArg, options = {}) {
66501
66537
  if (chartAxisEdits.xAxisLabel !== void 0) {
66502
66538
  return String(chartAxisEdits.xAxisLabel).trim();
66503
66539
  }
66504
- return defaultXLabel;
66540
+ return !defaultXLabel || defaultXLabel === resolvedXAxisField ? toTitleCaseLabel(resolvedXAxisField) : defaultXLabel;
66505
66541
  }, [
66506
66542
  chartAxesBaseChart?.xAxisLabel,
66507
66543
  chartAxisEdits.xAxisLabel,
@@ -67934,7 +67970,7 @@ function useReport(reportIdArg, options = {}) {
67934
67970
  if (effectiveNextState.limit !== void 0)
67935
67971
  next.limit = effectiveNextState.limit;
67936
67972
  if (effectiveNextState.chartType !== void 0)
67937
- next.chartType = effectiveNextState.chartType || void 0;
67973
+ next.chartType = effectiveNextState.chartType;
67938
67974
  const normalizedNext = processPivotState(next, {
67939
67975
  nextState: effectiveNextState,
67940
67976
  promoteColumnToRow: false,
@@ -68096,7 +68132,7 @@ function useReport(reportIdArg, options = {}) {
68096
68132
  String(effectiveReportBuilderState.tables[0].name)
68097
68133
  ) : "New report",
68098
68134
  // Match chart rendering (`chartData`): form `chartType` wins over stale `sourceReport`.
68099
- chartType: chartType ?? sourceRest.chartType ?? "table",
68135
+ chartType: resolvedChartType,
68100
68136
  dashboardName: dashboardNameForNewReport,
68101
68137
  reportBuilderState: effectiveReportBuilderState,
68102
68138
  pivot: effectiveReportBuilderState.pivot ?? null,
@@ -68118,7 +68154,6 @@ function useReport(reportIdArg, options = {}) {
68118
68154
  });
68119
68155
  return resp;
68120
68156
  }, [
68121
- chartType,
68122
68157
  client,
68123
68158
  dashboardNameForNewReport,
68124
68159
  draftSessionId,
@@ -68129,6 +68164,7 @@ function useReport(reportIdArg, options = {}) {
68129
68164
  resolvedXAxisField,
68130
68165
  resolvedXAxisFormat,
68131
68166
  resolvedXAxisLabel,
68167
+ resolvedChartType,
68132
68168
  resolvedYAxisFields,
68133
68169
  sourceReport,
68134
68170
  setDraftSessionId,
@@ -68156,7 +68192,7 @@ function useReport(reportIdArg, options = {}) {
68156
68192
  groupColumnsBy,
68157
68193
  groupColumnsByOptions,
68158
68194
  dateBucket,
68159
- dateBucketOptions: PIVOT_DATE_BUCKET_OPTIONS,
68195
+ dateBucketOptions: hasDatePivotRow ? PIVOT_DATE_BUCKET_OPTIONS : [],
68160
68196
  /** Encoded selection per aggregation slot (`'sum:transactions::amount'`, `'count:transactions'`, `''` = placeholder). Update via `setReport({ aggregations: nextStringArray })`. */
68161
68197
  aggregations: aggregationValues,
68162
68198
  /** Flat aggregation pick list shared by all slots; always contains every non-empty `aggregations` entry. */
@@ -68164,7 +68200,7 @@ function useReport(reportIdArg, options = {}) {
68164
68200
  aggregationDescriptionOptions: cleanedAggregations,
68165
68201
  sort: cleanedSort,
68166
68202
  sortOptions,
68167
- chartType,
68203
+ chartType: resolvedChartType,
68168
68204
  chartTypeOptions: chartTypes,
68169
68205
  /** Selected tabular columns in display order. */
68170
68206
  columns: tableColumnValues,
@@ -68380,7 +68416,7 @@ function ChatChartCard({
68380
68416
  label: "Chart type",
68381
68417
  width: 200,
68382
68418
  options: chartTypeOptions,
68383
- onChange: (e) => setReport({ chartType: e.target.value ?? "" })
68419
+ onChange: (e) => setReport({ chartType: e.target.value })
68384
68420
  }
68385
68421
  )
68386
68422
  ]
@@ -69004,7 +69040,7 @@ function Chat({
69004
69040
  }
69005
69041
 
69006
69042
  // src/hooks/useReportFilterDraft.ts
69007
- import { useCallback as useCallback6, useMemo as useMemo34, useRef as useRef26, useState as useState43 } from "react";
69043
+ import { useCallback as useCallback6, useEffect as useEffect33, useMemo as useMemo34, useRef as useRef26, useState as useState43 } from "react";
69008
69044
  var normalizeOperatorKey = (operator) => String(operator ?? "").trim().toLowerCase().replace(/[_\s]+/g, "");
69009
69045
  var defaultFilterRuleValueForOperator = (operator) => {
69010
69046
  const key = normalizeOperatorKey(operator);
@@ -69070,12 +69106,10 @@ function useReportFilterDraft(args) {
69070
69106
  const [draftQuery, setDraftQuery] = useState43(committed);
69071
69107
  const [hasUnappliedFilterChanges, setHasUnappliedFilterChanges] = useState43(false);
69072
69108
  const draftResetKey = `${reportId}|${committedSignature}|${resetEpoch}`;
69073
- const prevDraftResetKeyRef = useRef26(draftResetKey);
69074
- if (prevDraftResetKeyRef.current !== draftResetKey) {
69075
- prevDraftResetKeyRef.current = draftResetKey;
69076
- setDraftQuery(committed);
69077
- if (hasUnappliedFilterChanges) setHasUnappliedFilterChanges(false);
69078
- }
69109
+ useEffect33(() => {
69110
+ setDraftQuery(committedRef.current);
69111
+ setHasUnappliedFilterChanges(false);
69112
+ }, [draftResetKey]);
69079
69113
  const filterDraftKey = `${draftResetKey}|${fieldsSignature}`;
69080
69114
  const handleQueryChange = useCallback6((next) => {
69081
69115
  if (!isQueryBuilderDisplayGroup(next)) return;
@@ -69390,7 +69424,7 @@ function ReportDetail({
69390
69424
  init_valueFormatter();
69391
69425
 
69392
69426
  // src/hooks/useTenants.ts
69393
- import { useContext as useContext39, useEffect as useEffect33 } from "react";
69427
+ import { useContext as useContext39, useEffect as useEffect34 } from "react";
69394
69428
  var useTenants = (dashboardName) => {
69395
69429
  const {
69396
69430
  tenants,
@@ -69404,12 +69438,12 @@ var useTenants = (dashboardName) => {
69404
69438
  getMappedTenantsForDashboard,
69405
69439
  getViewerTenantsByOwner
69406
69440
  } = useContext39(TenantContext);
69407
- useEffect33(() => {
69441
+ useEffect34(() => {
69408
69442
  if (dashboardName) {
69409
69443
  fetchViewerTenantsForDashboard(dashboardName);
69410
69444
  }
69411
69445
  }, [dashboardName, fetchViewerTenantsForDashboard]);
69412
- useEffect33(() => {
69446
+ useEffect34(() => {
69413
69447
  if (dashboardName) {
69414
69448
  fetchMappedTenantsForDashboard(dashboardName);
69415
69449
  }
@@ -69428,7 +69462,7 @@ var useTenants = (dashboardName) => {
69428
69462
  };
69429
69463
 
69430
69464
  // src/hooks/useQuill.ts
69431
- import { useContext as useContext40, useEffect as useEffect34, useMemo as useMemo35, useState as useState45 } from "react";
69465
+ import { useContext as useContext40, useEffect as useEffect35, useMemo as useMemo35, useState as useState45 } from "react";
69432
69466
  init_paginationProcessing();
69433
69467
  init_tableProcessing();
69434
69468
  init_dataProcessing();
@@ -69611,7 +69645,7 @@ var useQuill = (reportId, pagination) => {
69611
69645
  setLoading(false);
69612
69646
  }
69613
69647
  };
69614
- useEffect34(() => {
69648
+ useEffect35(() => {
69615
69649
  if (isClientLoading) return;
69616
69650
  if (reportId && specificReportFilters) {
69617
69651
  fetchReportHelper(reportId, {
@@ -69678,7 +69712,7 @@ var useMemoizedRows = (reportId) => {
69678
69712
  };
69679
69713
 
69680
69714
  // src/hooks/useAskQuill.tsx
69681
- import { useContext as useContext41, useEffect as useEffect35, useState as useState46 } from "react";
69715
+ import { useContext as useContext41, useEffect as useEffect36, useState as useState46 } from "react";
69682
69716
  init_astProcessing();
69683
69717
  init_astFilterProcessing();
69684
69718
  init_pivotProcessing();
@@ -69924,7 +69958,7 @@ var useAskQuill = (dashboardName) => {
69924
69958
  });
69925
69959
  setLoading(false);
69926
69960
  };
69927
- useEffect35(() => {
69961
+ useEffect36(() => {
69928
69962
  setAsk(() => askHelper);
69929
69963
  }, [schemaData.schema]);
69930
69964
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.16.53",
3
+ "version": "2.16.55",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {