@quillsql/react 2.16.45 → 2.16.46

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
@@ -15083,7 +15083,7 @@ function getDateString(value, dateRange, dateBucket, databaseType) {
15083
15083
  });
15084
15084
  }
15085
15085
  function isDateField(fieldType) {
15086
- return fieldType === "date" || fieldType === "datetime" || fieldType === "timestamp" || fieldType === "timestamptz" || fieldType === "MMM_yyyy" || fieldType === "MMM_dd" || fieldType === "MMM_dd_yyyy" || fieldType === "MMM_dd_hh:mm_ap_pm" || fieldType === "hh_ap_pm";
15086
+ return fieldType === "date" || fieldType === "datetime" || fieldType === "timestamp" || fieldType === "timestamptz" || fieldType === "yyyy" || fieldType === "MMM_yyyy" || fieldType === "MMM_dd" || fieldType === "MMM_dd_yyyy" || fieldType === "MMM_dd_hh:mm_ap_pm" || fieldType === "hh_ap_pm";
15087
15087
  }
15088
15088
  var import_date_fns5;
15089
15089
  var init_dates = __esm({
@@ -19928,6 +19928,27 @@ function parseData(rows, queryType) {
19928
19928
  return rows;
19929
19929
  }
19930
19930
  }
19931
+ function isQuillFetchDebugEnabled() {
19932
+ if (typeof globalThis !== "undefined") {
19933
+ for (const debugFlag of QUILL_FETCH_DEBUG_FLAGS) {
19934
+ if (globalThis?.[debugFlag] === true) {
19935
+ return true;
19936
+ }
19937
+ }
19938
+ }
19939
+ if (typeof process !== "undefined" && typeof process.env !== "undefined") {
19940
+ const envCandidates = [
19941
+ process?.env?.QUILL_DEBUG_USEFORM_HYDRATION,
19942
+ process?.env?.QUILL_DEBUG_USEFORM_FILTERS,
19943
+ process?.env?.QUILL_DEBUG_DATA_FETCHER
19944
+ ];
19945
+ return envCandidates.some((candidate) => {
19946
+ const normalized = String(candidate ?? "").trim().toLowerCase();
19947
+ return normalized === "1" || normalized === "true";
19948
+ });
19949
+ }
19950
+ return false;
19951
+ }
19931
19952
  async function testSqlViewState(client, referencedTables, getToken) {
19932
19953
  let errorMessage = null;
19933
19954
  await Promise.all(
@@ -20413,7 +20434,7 @@ async function fetchRelevantInfoFromState(reportBuilderState, tables, columns, a
20413
20434
  return { error: error.message };
20414
20435
  }
20415
20436
  }
20416
- var quillFetch, parseFetchResponse;
20437
+ var QUILL_FETCH_DEBUG_FLAGS, quillFetchDebugSeq, logQuillFetchDebug, quillFetch, parseFetchResponse;
20417
20438
  var init_dataFetcher = __esm({
20418
20439
  "src/utils/dataFetcher.tsx"() {
20419
20440
  "use strict";
@@ -20422,6 +20443,16 @@ var init_dataFetcher = __esm({
20422
20443
  init_tableProcessing();
20423
20444
  init_dates();
20424
20445
  init_changelogNotify();
20446
+ QUILL_FETCH_DEBUG_FLAGS = [
20447
+ "__QUILL_DEBUG_USEFORM_HYDRATION__",
20448
+ "__QUILL_DEBUG_USEFORM_FILTERS__",
20449
+ "__QUILL_DEBUG_DATA_FETCHER__"
20450
+ ];
20451
+ quillFetchDebugSeq = 0;
20452
+ logQuillFetchDebug = (label, payload) => {
20453
+ if (!isQuillFetchDebugEnabled()) return;
20454
+ console.log(`[quillFetch-debug] ${label}`, payload);
20455
+ };
20425
20456
  quillFetch = async ({
20426
20457
  client,
20427
20458
  task,
@@ -20432,7 +20463,24 @@ var init_dataFetcher = __esm({
20432
20463
  urlParameters,
20433
20464
  getToken
20434
20465
  }) => {
20466
+ const debugSeq = ++quillFetchDebugSeq;
20467
+ const debugStart = Date.now();
20468
+ logQuillFetchDebug("request", {
20469
+ seq: debugSeq,
20470
+ task,
20471
+ reportId: metadata?.reportId,
20472
+ dashboardItemId: metadata?.dashboardItemId,
20473
+ hasPivot: Boolean(metadata?.pivot),
20474
+ hasReportBuilderState: Boolean(metadata?.reportBuilderState),
20475
+ filtersLength: Array.isArray(metadata?.filters) ? metadata.filters.length : void 0
20476
+ });
20435
20477
  const token = await getToken();
20478
+ logQuillFetchDebug("token-acquired", {
20479
+ seq: debugSeq,
20480
+ task,
20481
+ ms: Date.now() - debugStart,
20482
+ hasToken: Boolean(token)
20483
+ });
20436
20484
  const queryString = urlParameters ?? `task=${task}`;
20437
20485
  const endpoint = client.queryEndpoint ? `${client.queryEndpoint}?${queryString}` : `${QUILL_SERVER}${QUILL_QUERY_ENDPOINT}?${queryString}`;
20438
20486
  try {
@@ -20464,6 +20512,17 @@ var init_dataFetcher = __esm({
20464
20512
  if (task !== "fetch-changelog-list" && Array.isArray(normalizedData?.changelogs)) {
20465
20513
  notifyChangelogs(normalizedData.changelogs);
20466
20514
  }
20515
+ logQuillFetchDebug("response", {
20516
+ seq: debugSeq,
20517
+ task,
20518
+ ms: Date.now() - debugStart,
20519
+ status: result.status,
20520
+ error: result.error,
20521
+ dataError: normalizedData?.error,
20522
+ queryResultRowCounts: Array.isArray(result.queries?.queryResults) ? result.queries.queryResults.map(
20523
+ (qr) => Array.isArray(qr?.rows) ? qr.rows.length : null
20524
+ ) : void 0
20525
+ });
20467
20526
  return {
20468
20527
  data: normalizedData,
20469
20528
  queries: result.queries,
@@ -20472,8 +20531,19 @@ var init_dataFetcher = __esm({
20472
20531
  };
20473
20532
  } catch (e) {
20474
20533
  if (e instanceof Error && e.name === "AbortError") {
20534
+ logQuillFetchDebug("aborted", {
20535
+ seq: debugSeq,
20536
+ task,
20537
+ ms: Date.now() - debugStart
20538
+ });
20475
20539
  throw e;
20476
20540
  }
20541
+ logQuillFetchDebug("threw", {
20542
+ seq: debugSeq,
20543
+ task,
20544
+ ms: Date.now() - debugStart,
20545
+ message: e instanceof Error ? e.message : String(e)
20546
+ });
20477
20547
  if (task !== "set-section-order") {
20478
20548
  console.error("Failed to fetch:", e);
20479
20549
  }
@@ -21498,6 +21568,7 @@ var numberFormatOptions = [
21498
21568
  "percentage"
21499
21569
  ];
21500
21570
  var dateFormatOptions = [
21571
+ "yyyy",
21501
21572
  "MMM_yyyy",
21502
21573
  "MMM_dd",
21503
21574
  "MMM_dd_yyyy",
@@ -21515,6 +21586,7 @@ var NUMBER_OPTIONS = [
21515
21586
  { value: "percent", label: "percentage" }
21516
21587
  ];
21517
21588
  var DATE_OPTIONS = [
21589
+ { value: "yyyy", label: "year" },
21518
21590
  { value: "MMM_yyyy", label: "month" },
21519
21591
  { value: "MMM_dd", label: "day" },
21520
21592
  { value: "MMM_dd_yyyy", label: "day and year" },
@@ -21902,6 +21974,7 @@ function buildPivotOnlyReportFromResponse({
21902
21974
  rows: rawPivotRows,
21903
21975
  fields: rawPivotFields,
21904
21976
  pivot: effectivePivot,
21977
+ ...effectivePivot.dateBucket ? { dateBucket: effectivePivot.dateBucket } : {},
21905
21978
  client,
21906
21979
  rowCount: typeof response?.rowCount === "number" ? response.rowCount : void 0
21907
21980
  });
@@ -58804,7 +58877,9 @@ var filterTreeToQueryEntry = (node) => {
58804
58877
  };
58805
58878
  };
58806
58879
  var queryRuleToInternalFilter = (rule, fieldConfigByName) => {
58807
- const config = fieldConfigByName[rule.field];
58880
+ const ruleTableName = String(rule.table ?? "").trim();
58881
+ const tableQualifiedConfig = ruleTableName && rule.field && !rule.field.includes(".") ? fieldConfigByName[`${ruleTableName}.${rule.field}`] : void 0;
58882
+ const config = tableQualifiedConfig ?? fieldConfigByName[rule.field];
58808
58883
  if (!config?.fieldType) {
58809
58884
  throw new Error(
58810
58885
  `Missing field type config for "${rule.field}". Add it to fieldConfigByName.`
@@ -60643,6 +60718,16 @@ function isPivotTableDateBucketRowAxis(chart, xAxisField) {
60643
60718
  if (!rowField || xf !== rowField) return false;
60644
60719
  return isDateType(String(chart.pivot.rowFieldType ?? ""));
60645
60720
  }
60721
+ var RESOLVABLE_X_AXIS_DATE_BUCKETS = /* @__PURE__ */ new Set(["year", "month", "day"]);
60722
+ function resolvePivotDateBucketXAxisFormat(chart, xAxisField) {
60723
+ if (String(chart?.chartType ?? "").toLowerCase() === "table") return null;
60724
+ const dateBucket = String(chart?.pivot?.dateBucket ?? "").trim().toLowerCase();
60725
+ if (!RESOLVABLE_X_AXIS_DATE_BUCKETS.has(dateBucket)) return null;
60726
+ const rowField = String(chart?.pivot?.rowField ?? "").trim();
60727
+ if (!rowField || String(xAxisField ?? "").trim() !== rowField) return null;
60728
+ if (!isDateType(String(chart?.pivot?.rowFieldType ?? ""))) return null;
60729
+ return getDateFormatFromBucket(dateBucket);
60730
+ }
60646
60731
  function chartDetailRowsMissingPivotRowBucket(chart) {
60647
60732
  if (!chart?.pivot) return false;
60648
60733
  const rowField = String(chart.pivot.rowField ?? "").trim();
@@ -60863,6 +60948,9 @@ function normalizePivotChartForDisplay(chart) {
60863
60948
  withResolvedXAxis.pivot?.rowFieldType ?? ""
60864
60949
  ).trim();
60865
60950
  const pivotDateRowMonthLabelRe = /^[A-Z][a-z]{2} \d{4}$/;
60951
+ const pivotDisplayDateFormat = getDateFormatFromBucket(
60952
+ String(withResolvedXAxis.pivot?.dateBucket ?? "").trim()
60953
+ );
60866
60954
  let displayRows = Array.isArray(
60867
60955
  withResolvedXAxis.rows
60868
60956
  ) ? withResolvedXAxis.rows : [];
@@ -60881,7 +60969,7 @@ function normalizePivotChartForDisplay(chart) {
60881
60969
  }
60882
60970
  const formatted = quillFormat({
60883
60971
  value: raw,
60884
- format: "MMM_yyyy"
60972
+ format: pivotDisplayDateFormat
60885
60973
  });
60886
60974
  if (!formatted || !String(formatted).trim()) {
60887
60975
  return row;
@@ -64598,6 +64686,19 @@ function useReport(reportIdArg, options = {}) {
64598
64686
  resolveCache.set(fieldName, resolved);
64599
64687
  return resolved;
64600
64688
  }
64689
+ if (isUseFormFiltersDebugEnabled()) {
64690
+ console.error(
64691
+ "[useForm-debug] normalizeQueryBuilderFieldNameForConfig ambiguous",
64692
+ {
64693
+ fieldName,
64694
+ candidateKeys: candidates.map(([key]) => key),
64695
+ preferredTableNames: Array.from(preferredTableNames),
64696
+ primaryTableName,
64697
+ effectiveReportBuilderTableNames,
64698
+ baseReportBuilderTableNames
64699
+ }
64700
+ );
64701
+ }
64601
64702
  return fieldName;
64602
64703
  };
64603
64704
  }, [
@@ -64617,7 +64718,9 @@ function useReport(reportIdArg, options = {}) {
64617
64718
  }
64618
64719
  if (entry && typeof entry === "object" && "field" in entry) {
64619
64720
  const previousFieldName = String(entry.field ?? "").trim();
64620
- const nextFieldName = normalizeQueryBuilderFieldNameForConfig(previousFieldName);
64721
+ const ruleTableName = String(entry.table ?? "").trim();
64722
+ const tableQualifiedKey = ruleTableName && previousFieldName && !previousFieldName.includes(".") ? `${ruleTableName}.${previousFieldName}` : "";
64723
+ const nextFieldName = tableQualifiedKey && queryBuilderFieldConfigByName[tableQualifiedKey] ? tableQualifiedKey : normalizeQueryBuilderFieldNameForConfig(previousFieldName);
64621
64724
  if (!nextFieldName || nextFieldName === previousFieldName) {
64622
64725
  return entry;
64623
64726
  }
@@ -64639,7 +64742,7 @@ function useReport(reportIdArg, options = {}) {
64639
64742
  }
64640
64743
  return normalizeGroup(group);
64641
64744
  };
64642
- }, [normalizeQueryBuilderFieldNameForConfig]);
64745
+ }, [normalizeQueryBuilderFieldNameForConfig, queryBuilderFieldConfigByName]);
64643
64746
  const refreshSelectionTables = (0, import_react62.useMemo)(() => {
64644
64747
  return [
64645
64748
  getPivotGroupOptionTable(groupRowsBy),
@@ -65981,6 +66084,15 @@ function useReport(reportIdArg, options = {}) {
65981
66084
  chartAxisOptionByField.get(resolvedXAxisField)?.format ?? chartAxesBaseChart.xAxisFormat ?? resolvedYAxisFields[0]?.format,
65982
66085
  "string"
65983
66086
  );
66087
+ if (defaultFormat === "string") {
66088
+ const bucketFormat = resolvePivotDateBucketXAxisFormat(
66089
+ chartAxesBaseChart,
66090
+ resolvedXAxisField
66091
+ );
66092
+ if (bucketFormat) {
66093
+ defaultFormat = bucketFormat;
66094
+ }
66095
+ }
65984
66096
  if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && chartAxisEdits.xAxisFormat === void 0) {
65985
66097
  defaultFormat = "string";
65986
66098
  }
@@ -67475,6 +67587,17 @@ function useReport(reportIdArg, options = {}) {
67475
67587
  });
67476
67588
  }
67477
67589
  } catch (error) {
67590
+ if (isUseFormFiltersDebugEnabled()) {
67591
+ console.error("[useForm-debug] setFilters swallowed error", {
67592
+ error: error instanceof Error ? error.message : String(error),
67593
+ requestedRules: (nextFilters?.rules ?? []).map((rule) => ({
67594
+ table: rule?.table,
67595
+ field: rule?.field,
67596
+ operator: rule?.operator
67597
+ })),
67598
+ fieldConfigKeys: Object.keys(queryBuilderFieldConfigByName ?? {})
67599
+ });
67600
+ }
67478
67601
  }
67479
67602
  };
67480
67603
  const filterDraft = useReportFilterDraft({
package/dist/index.js CHANGED
@@ -15131,7 +15131,7 @@ function getDateString(value, dateRange, dateBucket, databaseType) {
15131
15131
  });
15132
15132
  }
15133
15133
  function isDateField(fieldType) {
15134
- return fieldType === "date" || fieldType === "datetime" || fieldType === "timestamp" || fieldType === "timestamptz" || fieldType === "MMM_yyyy" || fieldType === "MMM_dd" || fieldType === "MMM_dd_yyyy" || fieldType === "MMM_dd_hh:mm_ap_pm" || fieldType === "hh_ap_pm";
15134
+ return fieldType === "date" || fieldType === "datetime" || fieldType === "timestamp" || fieldType === "timestamptz" || fieldType === "yyyy" || fieldType === "MMM_yyyy" || fieldType === "MMM_dd" || fieldType === "MMM_dd_yyyy" || fieldType === "MMM_dd_hh:mm_ap_pm" || fieldType === "hh_ap_pm";
15135
15135
  }
15136
15136
  var init_dates = __esm({
15137
15137
  "src/utils/dates.ts"() {
@@ -19973,6 +19973,27 @@ function parseData(rows, queryType) {
19973
19973
  return rows;
19974
19974
  }
19975
19975
  }
19976
+ function isQuillFetchDebugEnabled() {
19977
+ if (typeof globalThis !== "undefined") {
19978
+ for (const debugFlag of QUILL_FETCH_DEBUG_FLAGS) {
19979
+ if (globalThis?.[debugFlag] === true) {
19980
+ return true;
19981
+ }
19982
+ }
19983
+ }
19984
+ if (typeof process !== "undefined" && typeof process.env !== "undefined") {
19985
+ const envCandidates = [
19986
+ process?.env?.QUILL_DEBUG_USEFORM_HYDRATION,
19987
+ process?.env?.QUILL_DEBUG_USEFORM_FILTERS,
19988
+ process?.env?.QUILL_DEBUG_DATA_FETCHER
19989
+ ];
19990
+ return envCandidates.some((candidate) => {
19991
+ const normalized = String(candidate ?? "").trim().toLowerCase();
19992
+ return normalized === "1" || normalized === "true";
19993
+ });
19994
+ }
19995
+ return false;
19996
+ }
19976
19997
  async function testSqlViewState(client, referencedTables, getToken) {
19977
19998
  let errorMessage = null;
19978
19999
  await Promise.all(
@@ -20458,7 +20479,7 @@ async function fetchRelevantInfoFromState(reportBuilderState, tables, columns, a
20458
20479
  return { error: error.message };
20459
20480
  }
20460
20481
  }
20461
- var quillFetch, parseFetchResponse;
20482
+ var QUILL_FETCH_DEBUG_FLAGS, quillFetchDebugSeq, logQuillFetchDebug, quillFetch, parseFetchResponse;
20462
20483
  var init_dataFetcher = __esm({
20463
20484
  "src/utils/dataFetcher.tsx"() {
20464
20485
  "use strict";
@@ -20467,6 +20488,16 @@ var init_dataFetcher = __esm({
20467
20488
  init_tableProcessing();
20468
20489
  init_dates();
20469
20490
  init_changelogNotify();
20491
+ QUILL_FETCH_DEBUG_FLAGS = [
20492
+ "__QUILL_DEBUG_USEFORM_HYDRATION__",
20493
+ "__QUILL_DEBUG_USEFORM_FILTERS__",
20494
+ "__QUILL_DEBUG_DATA_FETCHER__"
20495
+ ];
20496
+ quillFetchDebugSeq = 0;
20497
+ logQuillFetchDebug = (label, payload) => {
20498
+ if (!isQuillFetchDebugEnabled()) return;
20499
+ console.log(`[quillFetch-debug] ${label}`, payload);
20500
+ };
20470
20501
  quillFetch = async ({
20471
20502
  client,
20472
20503
  task,
@@ -20477,7 +20508,24 @@ var init_dataFetcher = __esm({
20477
20508
  urlParameters,
20478
20509
  getToken
20479
20510
  }) => {
20511
+ const debugSeq = ++quillFetchDebugSeq;
20512
+ const debugStart = Date.now();
20513
+ logQuillFetchDebug("request", {
20514
+ seq: debugSeq,
20515
+ task,
20516
+ reportId: metadata?.reportId,
20517
+ dashboardItemId: metadata?.dashboardItemId,
20518
+ hasPivot: Boolean(metadata?.pivot),
20519
+ hasReportBuilderState: Boolean(metadata?.reportBuilderState),
20520
+ filtersLength: Array.isArray(metadata?.filters) ? metadata.filters.length : void 0
20521
+ });
20480
20522
  const token = await getToken();
20523
+ logQuillFetchDebug("token-acquired", {
20524
+ seq: debugSeq,
20525
+ task,
20526
+ ms: Date.now() - debugStart,
20527
+ hasToken: Boolean(token)
20528
+ });
20481
20529
  const queryString = urlParameters ?? `task=${task}`;
20482
20530
  const endpoint = client.queryEndpoint ? `${client.queryEndpoint}?${queryString}` : `${QUILL_SERVER}${QUILL_QUERY_ENDPOINT}?${queryString}`;
20483
20531
  try {
@@ -20509,6 +20557,17 @@ var init_dataFetcher = __esm({
20509
20557
  if (task !== "fetch-changelog-list" && Array.isArray(normalizedData?.changelogs)) {
20510
20558
  notifyChangelogs(normalizedData.changelogs);
20511
20559
  }
20560
+ logQuillFetchDebug("response", {
20561
+ seq: debugSeq,
20562
+ task,
20563
+ ms: Date.now() - debugStart,
20564
+ status: result.status,
20565
+ error: result.error,
20566
+ dataError: normalizedData?.error,
20567
+ queryResultRowCounts: Array.isArray(result.queries?.queryResults) ? result.queries.queryResults.map(
20568
+ (qr) => Array.isArray(qr?.rows) ? qr.rows.length : null
20569
+ ) : void 0
20570
+ });
20512
20571
  return {
20513
20572
  data: normalizedData,
20514
20573
  queries: result.queries,
@@ -20517,8 +20576,19 @@ var init_dataFetcher = __esm({
20517
20576
  };
20518
20577
  } catch (e) {
20519
20578
  if (e instanceof Error && e.name === "AbortError") {
20579
+ logQuillFetchDebug("aborted", {
20580
+ seq: debugSeq,
20581
+ task,
20582
+ ms: Date.now() - debugStart
20583
+ });
20520
20584
  throw e;
20521
20585
  }
20586
+ logQuillFetchDebug("threw", {
20587
+ seq: debugSeq,
20588
+ task,
20589
+ ms: Date.now() - debugStart,
20590
+ message: e instanceof Error ? e.message : String(e)
20591
+ });
20522
20592
  if (task !== "set-section-order") {
20523
20593
  console.error("Failed to fetch:", e);
20524
20594
  }
@@ -21496,6 +21566,7 @@ var numberFormatOptions = [
21496
21566
  "percentage"
21497
21567
  ];
21498
21568
  var dateFormatOptions = [
21569
+ "yyyy",
21499
21570
  "MMM_yyyy",
21500
21571
  "MMM_dd",
21501
21572
  "MMM_dd_yyyy",
@@ -21513,6 +21584,7 @@ var NUMBER_OPTIONS = [
21513
21584
  { value: "percent", label: "percentage" }
21514
21585
  ];
21515
21586
  var DATE_OPTIONS = [
21587
+ { value: "yyyy", label: "year" },
21516
21588
  { value: "MMM_yyyy", label: "month" },
21517
21589
  { value: "MMM_dd", label: "day" },
21518
21590
  { value: "MMM_dd_yyyy", label: "day and year" },
@@ -21900,6 +21972,7 @@ function buildPivotOnlyReportFromResponse({
21900
21972
  rows: rawPivotRows,
21901
21973
  fields: rawPivotFields,
21902
21974
  pivot: effectivePivot,
21975
+ ...effectivePivot.dateBucket ? { dateBucket: effectivePivot.dateBucket } : {},
21903
21976
  client,
21904
21977
  rowCount: typeof response?.rowCount === "number" ? response.rowCount : void 0
21905
21978
  });
@@ -59012,7 +59085,9 @@ var filterTreeToQueryEntry = (node) => {
59012
59085
  };
59013
59086
  };
59014
59087
  var queryRuleToInternalFilter = (rule, fieldConfigByName) => {
59015
- const config = fieldConfigByName[rule.field];
59088
+ const ruleTableName = String(rule.table ?? "").trim();
59089
+ const tableQualifiedConfig = ruleTableName && rule.field && !rule.field.includes(".") ? fieldConfigByName[`${ruleTableName}.${rule.field}`] : void 0;
59090
+ const config = tableQualifiedConfig ?? fieldConfigByName[rule.field];
59016
59091
  if (!config?.fieldType) {
59017
59092
  throw new Error(
59018
59093
  `Missing field type config for "${rule.field}". Add it to fieldConfigByName.`
@@ -60851,6 +60926,16 @@ function isPivotTableDateBucketRowAxis(chart, xAxisField) {
60851
60926
  if (!rowField || xf !== rowField) return false;
60852
60927
  return isDateType(String(chart.pivot.rowFieldType ?? ""));
60853
60928
  }
60929
+ var RESOLVABLE_X_AXIS_DATE_BUCKETS = /* @__PURE__ */ new Set(["year", "month", "day"]);
60930
+ function resolvePivotDateBucketXAxisFormat(chart, xAxisField) {
60931
+ if (String(chart?.chartType ?? "").toLowerCase() === "table") return null;
60932
+ const dateBucket = String(chart?.pivot?.dateBucket ?? "").trim().toLowerCase();
60933
+ if (!RESOLVABLE_X_AXIS_DATE_BUCKETS.has(dateBucket)) return null;
60934
+ const rowField = String(chart?.pivot?.rowField ?? "").trim();
60935
+ if (!rowField || String(xAxisField ?? "").trim() !== rowField) return null;
60936
+ if (!isDateType(String(chart?.pivot?.rowFieldType ?? ""))) return null;
60937
+ return getDateFormatFromBucket(dateBucket);
60938
+ }
60854
60939
  function chartDetailRowsMissingPivotRowBucket(chart) {
60855
60940
  if (!chart?.pivot) return false;
60856
60941
  const rowField = String(chart.pivot.rowField ?? "").trim();
@@ -61071,6 +61156,9 @@ function normalizePivotChartForDisplay(chart) {
61071
61156
  withResolvedXAxis.pivot?.rowFieldType ?? ""
61072
61157
  ).trim();
61073
61158
  const pivotDateRowMonthLabelRe = /^[A-Z][a-z]{2} \d{4}$/;
61159
+ const pivotDisplayDateFormat = getDateFormatFromBucket(
61160
+ String(withResolvedXAxis.pivot?.dateBucket ?? "").trim()
61161
+ );
61074
61162
  let displayRows = Array.isArray(
61075
61163
  withResolvedXAxis.rows
61076
61164
  ) ? withResolvedXAxis.rows : [];
@@ -61089,7 +61177,7 @@ function normalizePivotChartForDisplay(chart) {
61089
61177
  }
61090
61178
  const formatted = quillFormat({
61091
61179
  value: raw,
61092
- format: "MMM_yyyy"
61180
+ format: pivotDisplayDateFormat
61093
61181
  });
61094
61182
  if (!formatted || !String(formatted).trim()) {
61095
61183
  return row;
@@ -64806,6 +64894,19 @@ function useReport(reportIdArg, options = {}) {
64806
64894
  resolveCache.set(fieldName, resolved);
64807
64895
  return resolved;
64808
64896
  }
64897
+ if (isUseFormFiltersDebugEnabled()) {
64898
+ console.error(
64899
+ "[useForm-debug] normalizeQueryBuilderFieldNameForConfig ambiguous",
64900
+ {
64901
+ fieldName,
64902
+ candidateKeys: candidates.map(([key]) => key),
64903
+ preferredTableNames: Array.from(preferredTableNames),
64904
+ primaryTableName,
64905
+ effectiveReportBuilderTableNames,
64906
+ baseReportBuilderTableNames
64907
+ }
64908
+ );
64909
+ }
64809
64910
  return fieldName;
64810
64911
  };
64811
64912
  }, [
@@ -64825,7 +64926,9 @@ function useReport(reportIdArg, options = {}) {
64825
64926
  }
64826
64927
  if (entry && typeof entry === "object" && "field" in entry) {
64827
64928
  const previousFieldName = String(entry.field ?? "").trim();
64828
- const nextFieldName = normalizeQueryBuilderFieldNameForConfig(previousFieldName);
64929
+ const ruleTableName = String(entry.table ?? "").trim();
64930
+ const tableQualifiedKey = ruleTableName && previousFieldName && !previousFieldName.includes(".") ? `${ruleTableName}.${previousFieldName}` : "";
64931
+ const nextFieldName = tableQualifiedKey && queryBuilderFieldConfigByName[tableQualifiedKey] ? tableQualifiedKey : normalizeQueryBuilderFieldNameForConfig(previousFieldName);
64829
64932
  if (!nextFieldName || nextFieldName === previousFieldName) {
64830
64933
  return entry;
64831
64934
  }
@@ -64847,7 +64950,7 @@ function useReport(reportIdArg, options = {}) {
64847
64950
  }
64848
64951
  return normalizeGroup(group);
64849
64952
  };
64850
- }, [normalizeQueryBuilderFieldNameForConfig]);
64953
+ }, [normalizeQueryBuilderFieldNameForConfig, queryBuilderFieldConfigByName]);
64851
64954
  const refreshSelectionTables = useMemo33(() => {
64852
64955
  return [
64853
64956
  getPivotGroupOptionTable(groupRowsBy),
@@ -66189,6 +66292,15 @@ function useReport(reportIdArg, options = {}) {
66189
66292
  chartAxisOptionByField.get(resolvedXAxisField)?.format ?? chartAxesBaseChart.xAxisFormat ?? resolvedYAxisFields[0]?.format,
66190
66293
  "string"
66191
66294
  );
66295
+ if (defaultFormat === "string") {
66296
+ const bucketFormat = resolvePivotDateBucketXAxisFormat(
66297
+ chartAxesBaseChart,
66298
+ resolvedXAxisField
66299
+ );
66300
+ if (bucketFormat) {
66301
+ defaultFormat = bucketFormat;
66302
+ }
66303
+ }
66192
66304
  if (isPivotTableDateBucketRowAxis(chartAxesBaseChart, resolvedXAxisField) && chartAxisEdits.xAxisFormat === void 0) {
66193
66305
  defaultFormat = "string";
66194
66306
  }
@@ -67683,6 +67795,17 @@ function useReport(reportIdArg, options = {}) {
67683
67795
  });
67684
67796
  }
67685
67797
  } catch (error) {
67798
+ if (isUseFormFiltersDebugEnabled()) {
67799
+ console.error("[useForm-debug] setFilters swallowed error", {
67800
+ error: error instanceof Error ? error.message : String(error),
67801
+ requestedRules: (nextFilters?.rules ?? []).map((rule) => ({
67802
+ table: rule?.table,
67803
+ field: rule?.field,
67804
+ operator: rule?.operator
67805
+ })),
67806
+ fieldConfigKeys: Object.keys(queryBuilderFieldConfigByName ?? {})
67807
+ });
67808
+ }
67686
67809
  }
67687
67810
  };
67688
67811
  const filterDraft = useReportFilterDraft({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.16.45",
3
+ "version": "2.16.46",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {