@quillsql/react 2.16.56 → 2.16.58

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
@@ -22575,7 +22575,8 @@ var formatRowsFromReport = (report, xAxisField, xAxisFormat) => {
22575
22575
  return formattedRow;
22576
22576
  });
22577
22577
  };
22578
- function formattedPivotRowsAndColumns(report, dashboardFilters = []) {
22578
+ function formattedPivotRowsAndColumns(report, dashboardFilters = [], options = {}) {
22579
+ const shouldFormatRows = options.formatRows ?? true;
22579
22580
  let columns = report.pivotColumns ?? report.columns;
22580
22581
  let rows = report.pivotRows ?? report.rows;
22581
22582
  if (report.chartType === "table") {
@@ -22591,12 +22592,16 @@ function formattedPivotRowsAndColumns(report, dashboardFilters = []) {
22591
22592
  format: col.format ?? "whole_number"
22592
22593
  };
22593
22594
  }) ?? report.columns;
22594
- rows = formatRowsFromReport({ rows, columns });
22595
+ if (shouldFormatRows) {
22596
+ rows = formatRowsFromReport({ rows, columns });
22597
+ }
22595
22598
  } else if (report.chartType === "metric") {
22596
22599
  columns = report.pivotColumns?.map((col) => {
22597
22600
  return { ...col, format: report.xAxisFormat };
22598
22601
  }) ?? report.columns;
22599
- rows = formatRowsFromReport({ rows, columns });
22602
+ if (shouldFormatRows) {
22603
+ rows = formatRowsFromReport({ rows, columns });
22604
+ }
22600
22605
  }
22601
22606
  const legacyPivotFormat = report.yAxisFields?.[0]?.format;
22602
22607
  const formattedYAxisFields = getYAxisFields(
@@ -22652,7 +22657,7 @@ function convertInternalReportToReport(report, dashboardFilters, eventTracking,
22652
22657
  report.xAxisField,
22653
22658
  report.xAxisFormat
22654
22659
  );
22655
- } else if (report.chartType === "table") {
22660
+ } else if (report.chartType === "table" && initiator !== "useDashboardReport") {
22656
22661
  rows = formatRowsFromReport(report);
22657
22662
  }
22658
22663
  return {
@@ -34150,8 +34155,7 @@ var createCustomBar = (yAxisFields, theme, layout, active = false) => {
34150
34155
  yAxisFields,
34151
34156
  theme,
34152
34157
  layout,
34153
- stroke: active ? theme?.primaryTextColor ?? "#111827" : props.stroke,
34154
- strokeWidth: active ? 1.5 : props.strokeWidth
34158
+ fillOpacity: active ? 0.8 : props.fillOpacity
34155
34159
  }
34156
34160
  );
34157
34161
  };
@@ -34402,24 +34406,27 @@ function BarChart({
34402
34406
  if (!payload || payload.length === 0) {
34403
34407
  return null;
34404
34408
  }
34405
- const activeLabel = label ?? payload[0]?.payload?.[xAxisField] ?? "";
34406
- const payloadItems = payload.map((p) => {
34407
- const rawName = yAxisFields?.find(
34408
- (f) => f.field === p.name?.toString()
34409
- )?.label;
34409
+ const row = payload[0]?.payload ?? {};
34410
+ const activeLabel = label ?? row[xAxisField] ?? "";
34411
+ const payloadItems = sortYAxisFields([
34412
+ ...yAxisFields
34413
+ ]).map((field) => {
34414
+ const rawName = field.label;
34410
34415
  const name2 = rawName ? humanizeChartSeriesTooltipLabel(rawName) : "";
34411
34416
  return {
34412
- ...p,
34413
- color: p.color || "black",
34414
34417
  chartType: "line",
34415
- dataKey: p.dataKey?.toLocaleString() || "",
34418
+ color: getCustomColor(field.field) ?? selectColor(
34419
+ field,
34420
+ colors,
34421
+ stableColorIndex(field.field)
34422
+ ),
34423
+ dataKey: field.field,
34416
34424
  name: snakeAndCamelCaseToTitleCase(
34417
- name2 || p.name?.toString() || ""
34425
+ name2 || field.field
34418
34426
  ),
34419
- payload: p.payload || {},
34420
- type: p.type || "none",
34421
- unit: "string",
34422
- value: p.value || ""
34427
+ payload: row,
34428
+ type: "none",
34429
+ value: row[field.field] ?? ""
34423
34430
  };
34424
34431
  });
34425
34432
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
@@ -34468,9 +34475,7 @@ function BarChart({
34468
34475
  isAnimationActive,
34469
34476
  shape: customBarShape,
34470
34477
  activeBar: customActiveBarShape ?? {
34471
- fillOpacity: 1,
34472
- stroke: theme?.primaryTextColor ?? "#111827",
34473
- strokeWidth: 1.5
34478
+ fillOpacity: 0.8
34474
34479
  },
34475
34480
  style: {
34476
34481
  cursor: onClickChartElement ? "pointer" : void 0
@@ -43595,7 +43600,7 @@ function StaticChart(props) {
43595
43600
  const config = (0, import_react41.useMemo)(() => {
43596
43601
  return report ? {
43597
43602
  ...report,
43598
- ...report.pivot ? formattedPivotRowsAndColumns(report) : {}
43603
+ ...report.pivot ? formattedPivotRowsAndColumns(report, [], { formatRows: false }) : {}
43599
43604
  } : void 0;
43600
43605
  }, [report]);
43601
43606
  if (error) {
@@ -60832,7 +60837,12 @@ function isPivotTableDateBucketRowAxis(chart, xAxisField) {
60832
60837
  if (!rowField || xf !== rowField) return false;
60833
60838
  return isDateType(String(chart.pivot.rowFieldType ?? ""));
60834
60839
  }
60835
- var RESOLVABLE_X_AXIS_DATE_BUCKETS = /* @__PURE__ */ new Set(["year", "month", "day"]);
60840
+ var RESOLVABLE_X_AXIS_DATE_BUCKETS = /* @__PURE__ */ new Set([
60841
+ "year",
60842
+ "month",
60843
+ "week",
60844
+ "day"
60845
+ ]);
60836
60846
  function resolvePivotDateBucketXAxisFormat(chart, xAxisField) {
60837
60847
  if (String(chart?.chartType ?? "").toLowerCase() === "table") return null;
60838
60848
  const dateBucket = String(chart?.pivot?.dateBucket ?? "").trim().toLowerCase();
@@ -63395,6 +63405,7 @@ function useReport(reportIdArg, options = {}) {
63395
63405
  ].map((entry) => String(entry ?? "").trim()).find((entry) => entry.length > 0) ?? "";
63396
63406
  const initialFormState = (0, import_react61.useMemo)(
63397
63407
  () => ({
63408
+ reportName: void 0,
63398
63409
  columns: [],
63399
63410
  queryColumns: [],
63400
63411
  filterStack: [],
@@ -63425,6 +63436,7 @@ function useReport(reportIdArg, options = {}) {
63425
63436
  pivotRefreshVersion
63426
63437
  } = formRuntimeState;
63427
63438
  const {
63439
+ reportName: formReportName,
63428
63440
  columns: displayColumns,
63429
63441
  queryColumns,
63430
63442
  filterStack,
@@ -64469,6 +64481,7 @@ function useReport(reportIdArg, options = {}) {
64469
64481
  updater: (previous) => {
64470
64482
  return {
64471
64483
  ...previous,
64484
+ reportName: void 0,
64472
64485
  schemaDatasourceIds: void 0,
64473
64486
  filterStack: [],
64474
64487
  queryFilters: { combinator: "and", rules: [] },
@@ -64561,6 +64574,7 @@ function useReport(reportIdArg, options = {}) {
64561
64574
  const sourceReportNameForTitle = String(sourceReport?.name ?? "").trim();
64562
64575
  const reportTitleFromTask = String(reportNameQuery.data?.name ?? "").trim();
64563
64576
  const resolvedReportName = reportNameQueryReportId && sourceReportIdForTitle === reportNameQueryReportId && sourceReportNameForTitle ? sourceReportNameForTitle : reportTitleFromTask || sourceReportNameForTitle || "";
64577
+ const displayReportName = formReportName !== void 0 ? formReportName : resolvedReportName;
64564
64578
  (0, import_react61.useEffect)(() => {
64565
64579
  if (reportOverride) return;
64566
64580
  const report = initialLoadQuery.data?.report ?? null;
@@ -64664,12 +64678,15 @@ function useReport(reportIdArg, options = {}) {
64664
64678
  schemaTables: schemaForReportBuilderState
64665
64679
  });
64666
64680
  const sourceDisplayColumns = sourceDisplayColumnsFromSchema.length > 0 ? sourceDisplayColumnsFromSchema : sourceQueryColumns;
64667
- const nextGroupRowsBy = shouldTakePivotGroupsFromSource ? groupRowsBySetViaSetReportRef.current ? prev.groupRowsBy : sourceRowGroupOption : prev.groupRowsBy !== void 0 ? prev.groupRowsBy : groupRowsBySetViaSetReportRef.current ? prev.groupRowsBy : sourceRowGroupOption;
64668
- const nextGroupColumnsBy = shouldTakePivotGroupsFromSource ? groupColumnsBySetViaSetReportRef.current ? prev.groupColumnsBy : sourceColumnGroupOption : prev.groupColumnsBy !== void 0 ? prev.groupColumnsBy : prev.groupRowsBy !== void 0 ? prev.groupColumnsBy : sourceColumnGroupOption;
64681
+ const shouldKeepLocalRowGroup = groupRowsBySetViaSetReportRef.current || groupColumnsBySetViaSetReportRef.current && prev.groupRowsBy !== void 0;
64682
+ const shouldKeepLocalColumnGroup = groupColumnsBySetViaSetReportRef.current || groupRowsBySetViaSetReportRef.current && prev.groupColumnsBy !== void 0;
64683
+ const nextGroupRowsBy = shouldTakePivotGroupsFromSource ? shouldKeepLocalRowGroup ? prev.groupRowsBy : sourceRowGroupOption : prev.groupRowsBy !== void 0 ? prev.groupRowsBy : groupRowsBySetViaSetReportRef.current ? prev.groupRowsBy : sourceRowGroupOption;
64684
+ const nextGroupColumnsBy = shouldTakePivotGroupsFromSource ? shouldKeepLocalColumnGroup ? prev.groupColumnsBy : sourceColumnGroupOption : prev.groupColumnsBy !== void 0 ? prev.groupColumnsBy : prev.groupRowsBy !== void 0 ? prev.groupColumnsBy : sourceColumnGroupOption;
64669
64685
  const sourceDateBucket = sourceReport.pivot?.dateBucket ?? sourceReport.reportBuilderState?.pivot?.dateBucket;
64670
64686
  const nextDateBucket = dateBucketSetViaSetReportRef.current ? prev.dateBucket : sourceDateBucket;
64671
64687
  const nextFromSource = {
64672
64688
  ...prev,
64689
+ reportName: prev.reportName !== void 0 ? prev.reportName : String(sourceReport.name ?? "").trim() || void 0,
64673
64690
  queryColumns: prev.queryColumns.length ? prev.queryColumns : sourceQueryColumns,
64674
64691
  columns: prev.columns.length ? prev.columns : sourceDisplayColumns,
64675
64692
  filterStack: nextFilterStack.length > 0 ? nextFilterStack : prev.filterStack,
@@ -65256,11 +65273,7 @@ function useReport(reportIdArg, options = {}) {
65256
65273
  const report = tableRefreshQuery.data?.report;
65257
65274
  if (tableRefreshQuery.data?.error || !report) return;
65258
65275
  setSourceReport(report);
65259
- }, [
65260
- effectiveReportId,
65261
- tableRefreshQuery.data,
65262
- tableRefreshQueryEnabled
65263
- ]);
65276
+ }, [effectiveReportId, tableRefreshQuery.data, tableRefreshQueryEnabled]);
65264
65277
  const chartTypes = (0, import_react61.useMemo)(() => {
65265
65278
  return getChartTypeOptions2({ pivot: pivotState });
65266
65279
  }, [pivotState]);
@@ -66299,14 +66312,12 @@ function useReport(reportIdArg, options = {}) {
66299
66312
  chartAxisOptionByField.get(resolvedXAxisField)?.format ?? chartAxesBaseChart.xAxisFormat ?? resolvedYAxisFields[0]?.format,
66300
66313
  "string"
66301
66314
  );
66302
- if (defaultFormat === "string") {
66303
- const bucketFormat = resolvePivotDateBucketXAxisFormat(
66304
- chartAxesBaseChart,
66305
- resolvedXAxisField
66306
- );
66307
- if (bucketFormat) {
66308
- defaultFormat = bucketFormat;
66309
- }
66315
+ const bucketFormat = resolvePivotDateBucketXAxisFormat(
66316
+ chartAxesBaseChart,
66317
+ resolvedXAxisField
66318
+ );
66319
+ if (bucketFormat && (defaultFormat === "string" || chartAxesBaseChart.pivot?.dateBucket === "week")) {
66320
+ defaultFormat = bucketFormat;
66310
66321
  }
66311
66322
  if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && chartAxisEdits.xAxisFormat === void 0) {
66312
66323
  defaultFormat = "string";
@@ -67429,6 +67440,9 @@ function useReport(reportIdArg, options = {}) {
67429
67440
  columns: normalizeReportBuilderColumns(prev.columns ?? []),
67430
67441
  queryColumns: normalizeReportBuilderColumns(prev.queryColumns ?? [])
67431
67442
  };
67443
+ if (effectiveNextState.name !== void 0) {
67444
+ next.reportName = String(effectiveNextState.name);
67445
+ }
67432
67446
  if (effectiveNextState.datasources !== void 0) {
67433
67447
  const nextIds = effectiveNextState.datasources.map((tableName) => String(tableName ?? "").trim()).filter(Boolean);
67434
67448
  next.schemaDatasourceIds = nextIds.length > 0 ? nextIds : void 0;
@@ -67918,7 +67932,7 @@ function useReport(reportIdArg, options = {}) {
67918
67932
  report: {
67919
67933
  ...EMPTY_INTERNAL_REPORT,
67920
67934
  ...sourceRest,
67921
- name: String(sourceRest.name ?? "").trim() ? sourceRest.name : effectiveReportBuilderState.tables[0]?.name ? snakeAndCamelCaseToTitleCase(
67935
+ name: String(formReportName ?? "").trim() ? formReportName : String(sourceRest.name ?? "").trim() ? sourceRest.name : effectiveReportBuilderState.tables[0]?.name ? snakeAndCamelCaseToTitleCase(
67922
67936
  String(effectiveReportBuilderState.tables[0].name)
67923
67937
  ) : "New report",
67924
67938
  // Match chart rendering (`chartData`): form `chartType` wins over stale `sourceReport`.
@@ -67954,6 +67968,7 @@ function useReport(reportIdArg, options = {}) {
67954
67968
  effectiveReportBuilderState,
67955
67969
  effectiveReportId,
67956
67970
  eventTracking,
67971
+ formReportName,
67957
67972
  getToken,
67958
67973
  resolvedXAxisField,
67959
67974
  resolvedXAxisFormat,
@@ -67972,8 +67987,8 @@ function useReport(reportIdArg, options = {}) {
67972
67987
  table,
67973
67988
  tableLoading,
67974
67989
  loading,
67975
- /** Report title: matching `sourceReport.name`, else `report-name` task, else empty. */
67976
- name: resolvedReportName,
67990
+ /** Report title: form override, then `sourceReport.name`, else `report-name` task. */
67991
+ name: displayReportName,
67977
67992
  /**
67978
67993
  * Resolved report id: the `reportId` argument when provided, otherwise the id
67979
67994
  * returned from `create-report` after the first datasource selection.
@@ -69077,7 +69092,8 @@ function ReportDetail({
69077
69092
  table,
69078
69093
  tableLoading,
69079
69094
  showLegend,
69080
- hideTableChartOuterBorder = false
69095
+ hideTableChartOuterBorder = false,
69096
+ onClickChartElement
69081
69097
  }) {
69082
69098
  const [theme] = (0, import_react65.useContext)(ThemeContext);
69083
69099
  const surfaceBackground = theme?.backgroundColor ?? "#fff";
@@ -69169,6 +69185,7 @@ function ReportDetail({
69169
69185
  flexShrink: 0
69170
69186
  },
69171
69187
  showLegend,
69188
+ onClickChartElement,
69172
69189
  tableChartWrapperBorders: hideTableChartOuterBorder && isTableChart ? {
69173
69190
  borderRadius: 0,
69174
69191
  borderLeft: "none",
package/dist/index.d.cts CHANGED
@@ -3004,6 +3004,8 @@ type SetReportChartAxesInput = {
3004
3004
  };
3005
3005
  };
3006
3006
  interface SetReportBuilderInput {
3007
+ /** Report display name, persisted by `saveChanges`. */
3008
+ name?: string;
3007
3009
  /** Complete selected column list in display order. */
3008
3010
  columns?: ReportColumnValue[];
3009
3011
  filters?: Filter[];
@@ -3186,7 +3188,7 @@ declare function useReport(reportIdArg?: string, options?: UseReportOptions): {
3186
3188
  table: UseFormTable;
3187
3189
  tableLoading: boolean;
3188
3190
  loading: boolean;
3189
- /** Report title: matching `sourceReport.name`, else `report-name` task, else empty. */
3191
+ /** Report title: form override, then `sourceReport.name`, else `report-name` task. */
3190
3192
  name: string;
3191
3193
  /**
3192
3194
  * Resolved report id: the `reportId` argument when provided, otherwise the id
@@ -3421,8 +3423,10 @@ type ReportDetailProps = {
3421
3423
  showLegend?: boolean;
3422
3424
  /** Strip QuillTable's outer frame when chart type is `table` (cell borders unchanged). */
3423
3425
  hideTableChartOuterBorder?: boolean;
3426
+ /** Forwarded to `ChartDisplay` for chart element click interactions (e.g. drilldowns). */
3427
+ onClickChartElement?: (data: any) => void;
3424
3428
  };
3425
- declare function ReportDetail({ reportTitle, chart, chartLoading, table, tableLoading, showLegend, hideTableChartOuterBorder, }: ReportDetailProps): react_jsx_runtime.JSX.Element;
3429
+ declare function ReportDetail({ reportTitle, chart, chartLoading, table, tableLoading, showLegend, hideTableChartOuterBorder, onClickChartElement, }: ReportDetailProps): react_jsx_runtime.JSX.Element;
3426
3430
 
3427
3431
  declare const quillFormat: ({ value, format, }: {
3428
3432
  value: any;
package/dist/index.d.ts CHANGED
@@ -3004,6 +3004,8 @@ type SetReportChartAxesInput = {
3004
3004
  };
3005
3005
  };
3006
3006
  interface SetReportBuilderInput {
3007
+ /** Report display name, persisted by `saveChanges`. */
3008
+ name?: string;
3007
3009
  /** Complete selected column list in display order. */
3008
3010
  columns?: ReportColumnValue[];
3009
3011
  filters?: Filter[];
@@ -3186,7 +3188,7 @@ declare function useReport(reportIdArg?: string, options?: UseReportOptions): {
3186
3188
  table: UseFormTable;
3187
3189
  tableLoading: boolean;
3188
3190
  loading: boolean;
3189
- /** Report title: matching `sourceReport.name`, else `report-name` task, else empty. */
3191
+ /** Report title: form override, then `sourceReport.name`, else `report-name` task. */
3190
3192
  name: string;
3191
3193
  /**
3192
3194
  * Resolved report id: the `reportId` argument when provided, otherwise the id
@@ -3421,8 +3423,10 @@ type ReportDetailProps = {
3421
3423
  showLegend?: boolean;
3422
3424
  /** Strip QuillTable's outer frame when chart type is `table` (cell borders unchanged). */
3423
3425
  hideTableChartOuterBorder?: boolean;
3426
+ /** Forwarded to `ChartDisplay` for chart element click interactions (e.g. drilldowns). */
3427
+ onClickChartElement?: (data: any) => void;
3424
3428
  };
3425
- declare function ReportDetail({ reportTitle, chart, chartLoading, table, tableLoading, showLegend, hideTableChartOuterBorder, }: ReportDetailProps): react_jsx_runtime.JSX.Element;
3429
+ declare function ReportDetail({ reportTitle, chart, chartLoading, table, tableLoading, showLegend, hideTableChartOuterBorder, onClickChartElement, }: ReportDetailProps): react_jsx_runtime.JSX.Element;
3426
3430
 
3427
3431
  declare const quillFormat: ({ value, format, }: {
3428
3432
  value: any;
package/dist/index.js CHANGED
@@ -22572,7 +22572,8 @@ var formatRowsFromReport = (report, xAxisField, xAxisFormat) => {
22572
22572
  return formattedRow;
22573
22573
  });
22574
22574
  };
22575
- function formattedPivotRowsAndColumns(report, dashboardFilters = []) {
22575
+ function formattedPivotRowsAndColumns(report, dashboardFilters = [], options = {}) {
22576
+ const shouldFormatRows = options.formatRows ?? true;
22576
22577
  let columns = report.pivotColumns ?? report.columns;
22577
22578
  let rows = report.pivotRows ?? report.rows;
22578
22579
  if (report.chartType === "table") {
@@ -22588,12 +22589,16 @@ function formattedPivotRowsAndColumns(report, dashboardFilters = []) {
22588
22589
  format: col.format ?? "whole_number"
22589
22590
  };
22590
22591
  }) ?? report.columns;
22591
- rows = formatRowsFromReport({ rows, columns });
22592
+ if (shouldFormatRows) {
22593
+ rows = formatRowsFromReport({ rows, columns });
22594
+ }
22592
22595
  } else if (report.chartType === "metric") {
22593
22596
  columns = report.pivotColumns?.map((col) => {
22594
22597
  return { ...col, format: report.xAxisFormat };
22595
22598
  }) ?? report.columns;
22596
- rows = formatRowsFromReport({ rows, columns });
22599
+ if (shouldFormatRows) {
22600
+ rows = formatRowsFromReport({ rows, columns });
22601
+ }
22597
22602
  }
22598
22603
  const legacyPivotFormat = report.yAxisFields?.[0]?.format;
22599
22604
  const formattedYAxisFields = getYAxisFields(
@@ -22649,7 +22654,7 @@ function convertInternalReportToReport(report, dashboardFilters, eventTracking,
22649
22654
  report.xAxisField,
22650
22655
  report.xAxisFormat
22651
22656
  );
22652
- } else if (report.chartType === "table") {
22657
+ } else if (report.chartType === "table" && initiator !== "useDashboardReport") {
22653
22658
  rows = formatRowsFromReport(report);
22654
22659
  }
22655
22660
  return {
@@ -34210,8 +34215,7 @@ var createCustomBar = (yAxisFields, theme, layout, active = false) => {
34210
34215
  yAxisFields,
34211
34216
  theme,
34212
34217
  layout,
34213
- stroke: active ? theme?.primaryTextColor ?? "#111827" : props.stroke,
34214
- strokeWidth: active ? 1.5 : props.strokeWidth
34218
+ fillOpacity: active ? 0.8 : props.fillOpacity
34215
34219
  }
34216
34220
  );
34217
34221
  };
@@ -34462,24 +34466,27 @@ function BarChart({
34462
34466
  if (!payload || payload.length === 0) {
34463
34467
  return null;
34464
34468
  }
34465
- const activeLabel = label ?? payload[0]?.payload?.[xAxisField] ?? "";
34466
- const payloadItems = payload.map((p) => {
34467
- const rawName = yAxisFields?.find(
34468
- (f) => f.field === p.name?.toString()
34469
- )?.label;
34469
+ const row = payload[0]?.payload ?? {};
34470
+ const activeLabel = label ?? row[xAxisField] ?? "";
34471
+ const payloadItems = sortYAxisFields([
34472
+ ...yAxisFields
34473
+ ]).map((field) => {
34474
+ const rawName = field.label;
34470
34475
  const name2 = rawName ? humanizeChartSeriesTooltipLabel(rawName) : "";
34471
34476
  return {
34472
- ...p,
34473
- color: p.color || "black",
34474
34477
  chartType: "line",
34475
- dataKey: p.dataKey?.toLocaleString() || "",
34478
+ color: getCustomColor(field.field) ?? selectColor(
34479
+ field,
34480
+ colors,
34481
+ stableColorIndex(field.field)
34482
+ ),
34483
+ dataKey: field.field,
34476
34484
  name: snakeAndCamelCaseToTitleCase(
34477
- name2 || p.name?.toString() || ""
34485
+ name2 || field.field
34478
34486
  ),
34479
- payload: p.payload || {},
34480
- type: p.type || "none",
34481
- unit: "string",
34482
- value: p.value || ""
34487
+ payload: row,
34488
+ type: "none",
34489
+ value: row[field.field] ?? ""
34483
34490
  };
34484
34491
  });
34485
34492
  return /* @__PURE__ */ jsx38(
@@ -34528,9 +34535,7 @@ function BarChart({
34528
34535
  isAnimationActive,
34529
34536
  shape: customBarShape,
34530
34537
  activeBar: customActiveBarShape ?? {
34531
- fillOpacity: 1,
34532
- stroke: theme?.primaryTextColor ?? "#111827",
34533
- strokeWidth: 1.5
34538
+ fillOpacity: 0.8
34534
34539
  },
34535
34540
  style: {
34536
34541
  cursor: onClickChartElement ? "pointer" : void 0
@@ -43698,7 +43703,7 @@ function StaticChart(props) {
43698
43703
  const config = useMemo20(() => {
43699
43704
  return report ? {
43700
43705
  ...report,
43701
- ...report.pivot ? formattedPivotRowsAndColumns(report) : {}
43706
+ ...report.pivot ? formattedPivotRowsAndColumns(report, [], { formatRows: false }) : {}
43702
43707
  } : void 0;
43703
43708
  }, [report]);
43704
43709
  if (error) {
@@ -61044,7 +61049,12 @@ function isPivotTableDateBucketRowAxis(chart, xAxisField) {
61044
61049
  if (!rowField || xf !== rowField) return false;
61045
61050
  return isDateType(String(chart.pivot.rowFieldType ?? ""));
61046
61051
  }
61047
- var RESOLVABLE_X_AXIS_DATE_BUCKETS = /* @__PURE__ */ new Set(["year", "month", "day"]);
61052
+ var RESOLVABLE_X_AXIS_DATE_BUCKETS = /* @__PURE__ */ new Set([
61053
+ "year",
61054
+ "month",
61055
+ "week",
61056
+ "day"
61057
+ ]);
61048
61058
  function resolvePivotDateBucketXAxisFormat(chart, xAxisField) {
61049
61059
  if (String(chart?.chartType ?? "").toLowerCase() === "table") return null;
61050
61060
  const dateBucket = String(chart?.pivot?.dateBucket ?? "").trim().toLowerCase();
@@ -63607,6 +63617,7 @@ function useReport(reportIdArg, options = {}) {
63607
63617
  ].map((entry) => String(entry ?? "").trim()).find((entry) => entry.length > 0) ?? "";
63608
63618
  const initialFormState = useMemo32(
63609
63619
  () => ({
63620
+ reportName: void 0,
63610
63621
  columns: [],
63611
63622
  queryColumns: [],
63612
63623
  filterStack: [],
@@ -63637,6 +63648,7 @@ function useReport(reportIdArg, options = {}) {
63637
63648
  pivotRefreshVersion
63638
63649
  } = formRuntimeState;
63639
63650
  const {
63651
+ reportName: formReportName,
63640
63652
  columns: displayColumns,
63641
63653
  queryColumns,
63642
63654
  filterStack,
@@ -64681,6 +64693,7 @@ function useReport(reportIdArg, options = {}) {
64681
64693
  updater: (previous) => {
64682
64694
  return {
64683
64695
  ...previous,
64696
+ reportName: void 0,
64684
64697
  schemaDatasourceIds: void 0,
64685
64698
  filterStack: [],
64686
64699
  queryFilters: { combinator: "and", rules: [] },
@@ -64773,6 +64786,7 @@ function useReport(reportIdArg, options = {}) {
64773
64786
  const sourceReportNameForTitle = String(sourceReport?.name ?? "").trim();
64774
64787
  const reportTitleFromTask = String(reportNameQuery.data?.name ?? "").trim();
64775
64788
  const resolvedReportName = reportNameQueryReportId && sourceReportIdForTitle === reportNameQueryReportId && sourceReportNameForTitle ? sourceReportNameForTitle : reportTitleFromTask || sourceReportNameForTitle || "";
64789
+ const displayReportName = formReportName !== void 0 ? formReportName : resolvedReportName;
64776
64790
  useEffect31(() => {
64777
64791
  if (reportOverride) return;
64778
64792
  const report = initialLoadQuery.data?.report ?? null;
@@ -64876,12 +64890,15 @@ function useReport(reportIdArg, options = {}) {
64876
64890
  schemaTables: schemaForReportBuilderState
64877
64891
  });
64878
64892
  const sourceDisplayColumns = sourceDisplayColumnsFromSchema.length > 0 ? sourceDisplayColumnsFromSchema : sourceQueryColumns;
64879
- const nextGroupRowsBy = shouldTakePivotGroupsFromSource ? groupRowsBySetViaSetReportRef.current ? prev.groupRowsBy : sourceRowGroupOption : prev.groupRowsBy !== void 0 ? prev.groupRowsBy : groupRowsBySetViaSetReportRef.current ? prev.groupRowsBy : sourceRowGroupOption;
64880
- const nextGroupColumnsBy = shouldTakePivotGroupsFromSource ? groupColumnsBySetViaSetReportRef.current ? prev.groupColumnsBy : sourceColumnGroupOption : prev.groupColumnsBy !== void 0 ? prev.groupColumnsBy : prev.groupRowsBy !== void 0 ? prev.groupColumnsBy : sourceColumnGroupOption;
64893
+ const shouldKeepLocalRowGroup = groupRowsBySetViaSetReportRef.current || groupColumnsBySetViaSetReportRef.current && prev.groupRowsBy !== void 0;
64894
+ const shouldKeepLocalColumnGroup = groupColumnsBySetViaSetReportRef.current || groupRowsBySetViaSetReportRef.current && prev.groupColumnsBy !== void 0;
64895
+ const nextGroupRowsBy = shouldTakePivotGroupsFromSource ? shouldKeepLocalRowGroup ? prev.groupRowsBy : sourceRowGroupOption : prev.groupRowsBy !== void 0 ? prev.groupRowsBy : groupRowsBySetViaSetReportRef.current ? prev.groupRowsBy : sourceRowGroupOption;
64896
+ const nextGroupColumnsBy = shouldTakePivotGroupsFromSource ? shouldKeepLocalColumnGroup ? prev.groupColumnsBy : sourceColumnGroupOption : prev.groupColumnsBy !== void 0 ? prev.groupColumnsBy : prev.groupRowsBy !== void 0 ? prev.groupColumnsBy : sourceColumnGroupOption;
64881
64897
  const sourceDateBucket = sourceReport.pivot?.dateBucket ?? sourceReport.reportBuilderState?.pivot?.dateBucket;
64882
64898
  const nextDateBucket = dateBucketSetViaSetReportRef.current ? prev.dateBucket : sourceDateBucket;
64883
64899
  const nextFromSource = {
64884
64900
  ...prev,
64901
+ reportName: prev.reportName !== void 0 ? prev.reportName : String(sourceReport.name ?? "").trim() || void 0,
64885
64902
  queryColumns: prev.queryColumns.length ? prev.queryColumns : sourceQueryColumns,
64886
64903
  columns: prev.columns.length ? prev.columns : sourceDisplayColumns,
64887
64904
  filterStack: nextFilterStack.length > 0 ? nextFilterStack : prev.filterStack,
@@ -65468,11 +65485,7 @@ function useReport(reportIdArg, options = {}) {
65468
65485
  const report = tableRefreshQuery.data?.report;
65469
65486
  if (tableRefreshQuery.data?.error || !report) return;
65470
65487
  setSourceReport(report);
65471
- }, [
65472
- effectiveReportId,
65473
- tableRefreshQuery.data,
65474
- tableRefreshQueryEnabled
65475
- ]);
65488
+ }, [effectiveReportId, tableRefreshQuery.data, tableRefreshQueryEnabled]);
65476
65489
  const chartTypes = useMemo32(() => {
65477
65490
  return getChartTypeOptions2({ pivot: pivotState });
65478
65491
  }, [pivotState]);
@@ -66511,14 +66524,12 @@ function useReport(reportIdArg, options = {}) {
66511
66524
  chartAxisOptionByField.get(resolvedXAxisField)?.format ?? chartAxesBaseChart.xAxisFormat ?? resolvedYAxisFields[0]?.format,
66512
66525
  "string"
66513
66526
  );
66514
- if (defaultFormat === "string") {
66515
- const bucketFormat = resolvePivotDateBucketXAxisFormat(
66516
- chartAxesBaseChart,
66517
- resolvedXAxisField
66518
- );
66519
- if (bucketFormat) {
66520
- defaultFormat = bucketFormat;
66521
- }
66527
+ const bucketFormat = resolvePivotDateBucketXAxisFormat(
66528
+ chartAxesBaseChart,
66529
+ resolvedXAxisField
66530
+ );
66531
+ if (bucketFormat && (defaultFormat === "string" || chartAxesBaseChart.pivot?.dateBucket === "week")) {
66532
+ defaultFormat = bucketFormat;
66522
66533
  }
66523
66534
  if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && chartAxisEdits.xAxisFormat === void 0) {
66524
66535
  defaultFormat = "string";
@@ -67641,6 +67652,9 @@ function useReport(reportIdArg, options = {}) {
67641
67652
  columns: normalizeReportBuilderColumns(prev.columns ?? []),
67642
67653
  queryColumns: normalizeReportBuilderColumns(prev.queryColumns ?? [])
67643
67654
  };
67655
+ if (effectiveNextState.name !== void 0) {
67656
+ next.reportName = String(effectiveNextState.name);
67657
+ }
67644
67658
  if (effectiveNextState.datasources !== void 0) {
67645
67659
  const nextIds = effectiveNextState.datasources.map((tableName) => String(tableName ?? "").trim()).filter(Boolean);
67646
67660
  next.schemaDatasourceIds = nextIds.length > 0 ? nextIds : void 0;
@@ -68130,7 +68144,7 @@ function useReport(reportIdArg, options = {}) {
68130
68144
  report: {
68131
68145
  ...EMPTY_INTERNAL_REPORT,
68132
68146
  ...sourceRest,
68133
- name: String(sourceRest.name ?? "").trim() ? sourceRest.name : effectiveReportBuilderState.tables[0]?.name ? snakeAndCamelCaseToTitleCase(
68147
+ name: String(formReportName ?? "").trim() ? formReportName : String(sourceRest.name ?? "").trim() ? sourceRest.name : effectiveReportBuilderState.tables[0]?.name ? snakeAndCamelCaseToTitleCase(
68134
68148
  String(effectiveReportBuilderState.tables[0].name)
68135
68149
  ) : "New report",
68136
68150
  // Match chart rendering (`chartData`): form `chartType` wins over stale `sourceReport`.
@@ -68166,6 +68180,7 @@ function useReport(reportIdArg, options = {}) {
68166
68180
  effectiveReportBuilderState,
68167
68181
  effectiveReportId,
68168
68182
  eventTracking,
68183
+ formReportName,
68169
68184
  getToken,
68170
68185
  resolvedXAxisField,
68171
68186
  resolvedXAxisFormat,
@@ -68184,8 +68199,8 @@ function useReport(reportIdArg, options = {}) {
68184
68199
  table,
68185
68200
  tableLoading,
68186
68201
  loading,
68187
- /** Report title: matching `sourceReport.name`, else `report-name` task, else empty. */
68188
- name: resolvedReportName,
68202
+ /** Report title: form override, then `sourceReport.name`, else `report-name` task. */
68203
+ name: displayReportName,
68189
68204
  /**
68190
68205
  * Resolved report id: the `reportId` argument when provided, otherwise the id
68191
68206
  * returned from `create-report` after the first datasource selection.
@@ -69294,7 +69309,8 @@ function ReportDetail({
69294
69309
  table,
69295
69310
  tableLoading,
69296
69311
  showLegend,
69297
- hideTableChartOuterBorder = false
69312
+ hideTableChartOuterBorder = false,
69313
+ onClickChartElement
69298
69314
  }) {
69299
69315
  const [theme] = useContext38(ThemeContext);
69300
69316
  const surfaceBackground = theme?.backgroundColor ?? "#fff";
@@ -69386,6 +69402,7 @@ function ReportDetail({
69386
69402
  flexShrink: 0
69387
69403
  },
69388
69404
  showLegend,
69405
+ onClickChartElement,
69389
69406
  tableChartWrapperBorders: hideTableChartOuterBorder && isTableChart ? {
69390
69407
  borderRadius: 0,
69391
69408
  borderLeft: "none",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.16.56",
3
+ "version": "2.16.58",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {