@quillsql/react 2.16.72 → 2.16.74

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
@@ -62007,6 +62007,11 @@ function resolveTableColumnDefaultFormat({
62007
62007
  }
62008
62008
  return currentFormat;
62009
62009
  }
62010
+ function resolveTableColumnLabel(fieldRaw, labelRaw) {
62011
+ const field = String(fieldRaw ?? "").trim();
62012
+ const label = String(labelRaw ?? "").trim();
62013
+ return !label || label === field ? toTitleCaseLabel(field) : label;
62014
+ }
62010
62015
  function mergeDisplayAndSourceForTableFormats(args) {
62011
62016
  const {
62012
62017
  effectiveReportBuilderTableNames,
@@ -62060,6 +62065,7 @@ function mergeDisplayAndSourceForTableFormats(args) {
62060
62065
  };
62061
62066
  }).filter((column) => Boolean(column));
62062
62067
  const formatByColumnOptionId = /* @__PURE__ */ new Map();
62068
+ const labelByColumnOptionId = /* @__PURE__ */ new Map();
62063
62069
  let columnsWithTableMeta = [];
62064
62070
  if (normalizedSourceColumns.length > 0 && normalizedDisplayColumns.length > 0) {
62065
62071
  const sourceColumnsByKey = /* @__PURE__ */ new Map();
@@ -62161,21 +62167,27 @@ function mergeDisplayAndSourceForTableFormats(args) {
62161
62167
  const id = encodeColumnOptionValue(selection.table, selection.field);
62162
62168
  if (id) {
62163
62169
  formatByColumnOptionId.set(id, String(merged.format ?? "").trim());
62170
+ labelByColumnOptionId.set(
62171
+ id,
62172
+ resolveTableColumnLabel(merged.field, merged.label)
62173
+ );
62164
62174
  }
62165
62175
  }
62166
62176
  columnsWithTableMeta = selectedColumnsForTable;
62167
62177
  }
62168
62178
  const columns = columnsWithTableMeta.map((column) => {
62169
62179
  const field = column.field;
62170
- const rawLabel = String(column.label ?? "").trim();
62171
- const label = !rawLabel || rawLabel === field ? toTitleCaseLabel(field) : rawLabel;
62172
62180
  return {
62173
- label,
62181
+ label: resolveTableColumnLabel(field, column.label),
62174
62182
  field,
62175
62183
  format: column.format
62176
62184
  };
62177
62185
  });
62178
- return { columns, formatByColumnOptionId };
62186
+ return {
62187
+ columns,
62188
+ formatByColumnOptionId,
62189
+ labelByColumnOptionId
62190
+ };
62179
62191
  }
62180
62192
  function axisFormatToSelectLabel(format9) {
62181
62193
  const raw = String(format9 ?? "").trim();
@@ -66264,14 +66276,16 @@ function useReport(reportIdArg, options = {}) {
66264
66276
  pivotRefreshQueryEnabled,
66265
66277
  effectiveReportId
66266
66278
  ]);
66279
+ const settledPivotForChart = sourceReport?.pivot ?? null;
66280
+ const settledSourceRowFieldForChart = String(
66281
+ sourceReport?.pivotResultSourceRowField ?? settledPivotForChart?.rowField ?? ""
66282
+ ).trim();
66283
+ const pendingPivotChangesDimensions = Boolean(
66284
+ sourceReport && pendingPivotRefresh && nextPivot && (settledSourceRowFieldForChart !== String(nextPivot.rowField ?? "").trim() || String(settledPivotForChart?.rowFieldTable ?? "").trim() !== String(nextPivot.rowFieldTable ?? "").trim() || String(settledPivotForChart?.columnField ?? "").trim() !== String(nextPivot.columnField ?? "").trim() || String(settledPivotForChart?.columnFieldTable ?? "").trim() !== String(nextPivot.columnFieldTable ?? "").trim())
66285
+ );
66267
66286
  const chartData = (0, import_react61.useMemo)(() => {
66268
66287
  if (!sourceReport) return void 0;
66269
66288
  const rowsForChart = Array.isArray(sourceReport.rows) ? sourceReport.rows : [];
66270
- const settledPivot = sourceReport.pivot ?? null;
66271
- const settledSourceRowField = String(
66272
- sourceReport.pivotResultSourceRowField ?? settledPivot?.rowField ?? ""
66273
- ).trim();
66274
- const pendingPivotChangesDimensions = pendingPivotRefresh && Boolean(nextPivot) && (settledSourceRowField !== String(nextPivot?.rowField ?? "").trim() || String(settledPivot?.rowFieldTable ?? "").trim() !== String(nextPivot?.rowFieldTable ?? "").trim() || String(settledPivot?.columnField ?? "").trim() !== String(nextPivot?.columnField ?? "").trim() || String(settledPivot?.columnFieldTable ?? "").trim() !== String(nextPivot?.columnFieldTable ?? "").trim());
66275
66289
  const chartPivot = pendingPivotChangesDimensions ? sourceReport.pivot ?? null : nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
66276
66290
  const chartPivotForDisplay = chartPivot && sourceReport.pivotResultRowField && sourceReport.pivotResultSourceRowField === chartPivot.rowField ? {
66277
66291
  ...chartPivot,
@@ -66298,7 +66312,7 @@ function useReport(reportIdArg, options = {}) {
66298
66312
  sourceReport,
66299
66313
  chartType,
66300
66314
  nextPivot,
66301
- pendingPivotRefresh,
66315
+ pendingPivotChangesDimensions,
66302
66316
  effectiveReportBuilderState,
66303
66317
  useInMemoryEngines,
66304
66318
  chartPivotHydrationEpoch
@@ -67197,6 +67211,12 @@ function useReport(reportIdArg, options = {}) {
67197
67211
  const tableColumnSettingsById = (0, import_react61.useMemo)(() => {
67198
67212
  const map = /* @__PURE__ */ new Map();
67199
67213
  const effectiveById = tableFormatMerge.formatByColumnOptionId;
67214
+ const mergedColumnByField = /* @__PURE__ */ new Map();
67215
+ for (const column of tableFormatMerge.columns) {
67216
+ if (!mergedColumnByField.has(column.field)) {
67217
+ mergedColumnByField.set(column.field, column);
67218
+ }
67219
+ }
67200
67220
  const chartColById = /* @__PURE__ */ new Map();
67201
67221
  if (isPivotTableChart && chart?.columns?.length) {
67202
67222
  for (const c of chart.columns) {
@@ -67277,9 +67297,8 @@ function useReport(reportIdArg, options = {}) {
67277
67297
  optionField
67278
67298
  );
67279
67299
  const effectiveFromId = effectiveById.get(columnId) ?? (encodedForMerge !== columnId ? effectiveById.get(encodedForMerge) : void 0) ?? "";
67280
- const mergeByFieldFormat = String(
67281
- tableFormatMerge.columns.find((c) => c.field === optionField)?.format ?? ""
67282
- ).trim();
67300
+ const mergedByField = mergedColumnByField.get(optionField);
67301
+ const mergeByFieldFormat = String(mergedByField?.format ?? "").trim();
67283
67302
  const columnPivotMeasureFormat = columnPivotMeasureFormatByAggregationField.get(optionField) ?? columnPivotMeasureFormatByAggregationField.get(columnId);
67284
67303
  const chartFallback = isPivotTableChart ? chartColById.get(columnId) ?? chartColById.get(encodedForMerge) ?? yAxisByField.get(optionField) ?? (columnPivotMeasureFormat ? {
67285
67304
  label: "",
@@ -67289,11 +67308,16 @@ function useReport(reportIdArg, options = {}) {
67289
67308
  selectedColumn?.format ?? chartFallback?.format ?? ""
67290
67309
  ).trim();
67291
67310
  const isRowPivotCol = isPivotTableChart && Boolean(pivotRowFieldForSettings) && optionField === pivotRowFieldForSettings && Boolean(rowAxisLabel);
67311
+ const selectedLabel = String(selectedColumn?.alias ?? "").trim();
67312
+ const pivotLabel = String(
67313
+ isRowPivotCol ? rowAxisLabel : chartFallback?.label ?? ""
67314
+ ).trim();
67315
+ const persistedTableLabel = String(
67316
+ tableFormatMerge.labelByColumnOptionId.get(columnId) ?? mergedByField?.label ?? ""
67317
+ ).trim();
67292
67318
  const resolvedColFormat = isRowPivotCol ? String(resolvedXAxisFormat ?? "").trim() || effectiveFromId || mergeByFieldFormat || fromDisplay || String(chartFallback?.format ?? "").trim() || "string" : fromDisplay || effectiveFromId || mergeByFieldFormat;
67293
67319
  map.set(columnId, {
67294
- label: String(
67295
- selectedColumn?.alias ?? (isRowPivotCol ? rowAxisLabel : chartFallback?.label) ?? ""
67296
- ).trim(),
67320
+ label: selectedLabel || pivotLabel || (!isPivotTableChart ? persistedTableLabel : ""),
67297
67321
  format: resolvedColFormat
67298
67322
  });
67299
67323
  }
package/dist/index.js CHANGED
@@ -62219,6 +62219,11 @@ function resolveTableColumnDefaultFormat({
62219
62219
  }
62220
62220
  return currentFormat;
62221
62221
  }
62222
+ function resolveTableColumnLabel(fieldRaw, labelRaw) {
62223
+ const field = String(fieldRaw ?? "").trim();
62224
+ const label = String(labelRaw ?? "").trim();
62225
+ return !label || label === field ? toTitleCaseLabel(field) : label;
62226
+ }
62222
62227
  function mergeDisplayAndSourceForTableFormats(args) {
62223
62228
  const {
62224
62229
  effectiveReportBuilderTableNames,
@@ -62272,6 +62277,7 @@ function mergeDisplayAndSourceForTableFormats(args) {
62272
62277
  };
62273
62278
  }).filter((column) => Boolean(column));
62274
62279
  const formatByColumnOptionId = /* @__PURE__ */ new Map();
62280
+ const labelByColumnOptionId = /* @__PURE__ */ new Map();
62275
62281
  let columnsWithTableMeta = [];
62276
62282
  if (normalizedSourceColumns.length > 0 && normalizedDisplayColumns.length > 0) {
62277
62283
  const sourceColumnsByKey = /* @__PURE__ */ new Map();
@@ -62373,21 +62379,27 @@ function mergeDisplayAndSourceForTableFormats(args) {
62373
62379
  const id = encodeColumnOptionValue(selection.table, selection.field);
62374
62380
  if (id) {
62375
62381
  formatByColumnOptionId.set(id, String(merged.format ?? "").trim());
62382
+ labelByColumnOptionId.set(
62383
+ id,
62384
+ resolveTableColumnLabel(merged.field, merged.label)
62385
+ );
62376
62386
  }
62377
62387
  }
62378
62388
  columnsWithTableMeta = selectedColumnsForTable;
62379
62389
  }
62380
62390
  const columns = columnsWithTableMeta.map((column) => {
62381
62391
  const field = column.field;
62382
- const rawLabel = String(column.label ?? "").trim();
62383
- const label = !rawLabel || rawLabel === field ? toTitleCaseLabel(field) : rawLabel;
62384
62392
  return {
62385
- label,
62393
+ label: resolveTableColumnLabel(field, column.label),
62386
62394
  field,
62387
62395
  format: column.format
62388
62396
  };
62389
62397
  });
62390
- return { columns, formatByColumnOptionId };
62398
+ return {
62399
+ columns,
62400
+ formatByColumnOptionId,
62401
+ labelByColumnOptionId
62402
+ };
62391
62403
  }
62392
62404
  function axisFormatToSelectLabel(format9) {
62393
62405
  const raw = String(format9 ?? "").trim();
@@ -66476,14 +66488,16 @@ function useReport(reportIdArg, options = {}) {
66476
66488
  pivotRefreshQueryEnabled,
66477
66489
  effectiveReportId
66478
66490
  ]);
66491
+ const settledPivotForChart = sourceReport?.pivot ?? null;
66492
+ const settledSourceRowFieldForChart = String(
66493
+ sourceReport?.pivotResultSourceRowField ?? settledPivotForChart?.rowField ?? ""
66494
+ ).trim();
66495
+ const pendingPivotChangesDimensions = Boolean(
66496
+ sourceReport && pendingPivotRefresh && nextPivot && (settledSourceRowFieldForChart !== String(nextPivot.rowField ?? "").trim() || String(settledPivotForChart?.rowFieldTable ?? "").trim() !== String(nextPivot.rowFieldTable ?? "").trim() || String(settledPivotForChart?.columnField ?? "").trim() !== String(nextPivot.columnField ?? "").trim() || String(settledPivotForChart?.columnFieldTable ?? "").trim() !== String(nextPivot.columnFieldTable ?? "").trim())
66497
+ );
66479
66498
  const chartData = useMemo33(() => {
66480
66499
  if (!sourceReport) return void 0;
66481
66500
  const rowsForChart = Array.isArray(sourceReport.rows) ? sourceReport.rows : [];
66482
- const settledPivot = sourceReport.pivot ?? null;
66483
- const settledSourceRowField = String(
66484
- sourceReport.pivotResultSourceRowField ?? settledPivot?.rowField ?? ""
66485
- ).trim();
66486
- const pendingPivotChangesDimensions = pendingPivotRefresh && Boolean(nextPivot) && (settledSourceRowField !== String(nextPivot?.rowField ?? "").trim() || String(settledPivot?.rowFieldTable ?? "").trim() !== String(nextPivot?.rowFieldTable ?? "").trim() || String(settledPivot?.columnField ?? "").trim() !== String(nextPivot?.columnField ?? "").trim() || String(settledPivot?.columnFieldTable ?? "").trim() !== String(nextPivot?.columnFieldTable ?? "").trim());
66487
66501
  const chartPivot = pendingPivotChangesDimensions ? sourceReport.pivot ?? null : nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
66488
66502
  const chartPivotForDisplay = chartPivot && sourceReport.pivotResultRowField && sourceReport.pivotResultSourceRowField === chartPivot.rowField ? {
66489
66503
  ...chartPivot,
@@ -66510,7 +66524,7 @@ function useReport(reportIdArg, options = {}) {
66510
66524
  sourceReport,
66511
66525
  chartType,
66512
66526
  nextPivot,
66513
- pendingPivotRefresh,
66527
+ pendingPivotChangesDimensions,
66514
66528
  effectiveReportBuilderState,
66515
66529
  useInMemoryEngines,
66516
66530
  chartPivotHydrationEpoch
@@ -67409,6 +67423,12 @@ function useReport(reportIdArg, options = {}) {
67409
67423
  const tableColumnSettingsById = useMemo33(() => {
67410
67424
  const map = /* @__PURE__ */ new Map();
67411
67425
  const effectiveById = tableFormatMerge.formatByColumnOptionId;
67426
+ const mergedColumnByField = /* @__PURE__ */ new Map();
67427
+ for (const column of tableFormatMerge.columns) {
67428
+ if (!mergedColumnByField.has(column.field)) {
67429
+ mergedColumnByField.set(column.field, column);
67430
+ }
67431
+ }
67412
67432
  const chartColById = /* @__PURE__ */ new Map();
67413
67433
  if (isPivotTableChart && chart?.columns?.length) {
67414
67434
  for (const c of chart.columns) {
@@ -67489,9 +67509,8 @@ function useReport(reportIdArg, options = {}) {
67489
67509
  optionField
67490
67510
  );
67491
67511
  const effectiveFromId = effectiveById.get(columnId) ?? (encodedForMerge !== columnId ? effectiveById.get(encodedForMerge) : void 0) ?? "";
67492
- const mergeByFieldFormat = String(
67493
- tableFormatMerge.columns.find((c) => c.field === optionField)?.format ?? ""
67494
- ).trim();
67512
+ const mergedByField = mergedColumnByField.get(optionField);
67513
+ const mergeByFieldFormat = String(mergedByField?.format ?? "").trim();
67495
67514
  const columnPivotMeasureFormat = columnPivotMeasureFormatByAggregationField.get(optionField) ?? columnPivotMeasureFormatByAggregationField.get(columnId);
67496
67515
  const chartFallback = isPivotTableChart ? chartColById.get(columnId) ?? chartColById.get(encodedForMerge) ?? yAxisByField.get(optionField) ?? (columnPivotMeasureFormat ? {
67497
67516
  label: "",
@@ -67501,11 +67520,16 @@ function useReport(reportIdArg, options = {}) {
67501
67520
  selectedColumn?.format ?? chartFallback?.format ?? ""
67502
67521
  ).trim();
67503
67522
  const isRowPivotCol = isPivotTableChart && Boolean(pivotRowFieldForSettings) && optionField === pivotRowFieldForSettings && Boolean(rowAxisLabel);
67523
+ const selectedLabel = String(selectedColumn?.alias ?? "").trim();
67524
+ const pivotLabel = String(
67525
+ isRowPivotCol ? rowAxisLabel : chartFallback?.label ?? ""
67526
+ ).trim();
67527
+ const persistedTableLabel = String(
67528
+ tableFormatMerge.labelByColumnOptionId.get(columnId) ?? mergedByField?.label ?? ""
67529
+ ).trim();
67504
67530
  const resolvedColFormat = isRowPivotCol ? String(resolvedXAxisFormat ?? "").trim() || effectiveFromId || mergeByFieldFormat || fromDisplay || String(chartFallback?.format ?? "").trim() || "string" : fromDisplay || effectiveFromId || mergeByFieldFormat;
67505
67531
  map.set(columnId, {
67506
- label: String(
67507
- selectedColumn?.alias ?? (isRowPivotCol ? rowAxisLabel : chartFallback?.label) ?? ""
67508
- ).trim(),
67532
+ label: selectedLabel || pivotLabel || (!isPivotTableChart ? persistedTableLabel : ""),
67509
67533
  format: resolvedColFormat
67510
67534
  });
67511
67535
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.16.72",
3
+ "version": "2.16.74",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {