twico-ui 1.36.0 → 1.36.1

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.d.cts CHANGED
@@ -1927,7 +1927,9 @@ interface DatatableProps<T = any> extends Omit<React.HTMLAttributes<HTMLDivEleme
1927
1927
  /** #339: let end-users build their own combined columns at runtime. Adds a **"Combine columns…"** item to
1928
1928
  * each column's ⋮ menu that opens an editor to fold other columns' data into that column (they show in its
1929
1929
  * cell and their own columns hide); layout (inline/stacked) + labels are configurable, and "Uncombine"
1930
- * restores them. The result is the same as a declarative `column.combine` and persists via `stateKey`.
1930
+ * restores them. The result is like a declarative `column.combine` and persists via `stateKey` — except a
1931
+ * runtime combine also applies the source-join value + render over a target's own `valueGetter`/`renderCell`
1932
+ * (so a synthetic getter-backed column can still be a target), which a declarative `combine` defers to (#369).
1931
1933
  * @default false */
1932
1934
  columnCombining?: boolean;
1933
1935
  /** Make all columns editable by default (double-click a cell to edit; per-column `editable` overrides). @default false */
@@ -2179,7 +2181,11 @@ interface DatatableColumn<T = any> {
2179
2181
  * (label-prefixed when `labels`), while the **cell render** additionally applies each source column's
2180
2182
  * `valueFormatter`. The combined value is synthetic, so the column is display-only (never inline-editable).
2181
2183
  * Supplying your own `valueGetter` and/or `renderCell` overrides the derived one(s) independently —
2182
- * override `valueGetter` alone and the cell shows that value (not the source-join). */
2184
+ * override `valueGetter` alone and the cell shows that value (not the source-join). **This precedence is
2185
+ * for a *declarative* `combine` only.** A *runtime* combine the user builds via `columnCombining` (the ⋮ →
2186
+ * "Combine columns…" editor) is an explicit action, so it applies the source-join value + render even when
2187
+ * the target column has its own `valueGetter`/`renderCell` — a synthetic getter-backed column can still be
2188
+ * a combine target (#369). Uncombining restores the column's own value/render. */
2183
2189
  combine?: string[] | { fields: string[]; layout?: "inline" | "stack"; separator?: string; labels?: boolean };
2184
2190
  /** Header label. @default field ("Actions" for actions columns) */
2185
2191
  headerName?: string;
package/dist/index.d.ts CHANGED
@@ -1927,7 +1927,9 @@ interface DatatableProps<T = any> extends Omit<React.HTMLAttributes<HTMLDivEleme
1927
1927
  /** #339: let end-users build their own combined columns at runtime. Adds a **"Combine columns…"** item to
1928
1928
  * each column's ⋮ menu that opens an editor to fold other columns' data into that column (they show in its
1929
1929
  * cell and their own columns hide); layout (inline/stacked) + labels are configurable, and "Uncombine"
1930
- * restores them. The result is the same as a declarative `column.combine` and persists via `stateKey`.
1930
+ * restores them. The result is like a declarative `column.combine` and persists via `stateKey` — except a
1931
+ * runtime combine also applies the source-join value + render over a target's own `valueGetter`/`renderCell`
1932
+ * (so a synthetic getter-backed column can still be a target), which a declarative `combine` defers to (#369).
1931
1933
  * @default false */
1932
1934
  columnCombining?: boolean;
1933
1935
  /** Make all columns editable by default (double-click a cell to edit; per-column `editable` overrides). @default false */
@@ -2179,7 +2181,11 @@ interface DatatableColumn<T = any> {
2179
2181
  * (label-prefixed when `labels`), while the **cell render** additionally applies each source column's
2180
2182
  * `valueFormatter`. The combined value is synthetic, so the column is display-only (never inline-editable).
2181
2183
  * Supplying your own `valueGetter` and/or `renderCell` overrides the derived one(s) independently —
2182
- * override `valueGetter` alone and the cell shows that value (not the source-join). */
2184
+ * override `valueGetter` alone and the cell shows that value (not the source-join). **This precedence is
2185
+ * for a *declarative* `combine` only.** A *runtime* combine the user builds via `columnCombining` (the ⋮ →
2186
+ * "Combine columns…" editor) is an explicit action, so it applies the source-join value + render even when
2187
+ * the target column has its own `valueGetter`/`renderCell` — a synthetic getter-backed column can still be
2188
+ * a combine target (#369). Uncombining restores the column's own value/render. */
2183
2189
  combine?: string[] | { fields: string[]; layout?: "inline" | "stack"; separator?: string; labels?: boolean };
2184
2190
  /** Header label. @default field ("Actions" for actions columns) */
2185
2191
  headerName?: string;
package/dist/index.mjs CHANGED
@@ -9360,7 +9360,7 @@ function Datatable({
9360
9360
  for (const c of columnsProp) if (c && c.field != null) byField[c.field] = c;
9361
9361
  return [DIFF_OP_COLUMN, ...columnsProp.map((c) => {
9362
9362
  const cfg = combineCfg(userCombine[c.field] || c.combine);
9363
- const base = cfg && !c.valueGetter ? { ...c, valueGetter: combineValueGetter(combineSrcCols(cfg, byField), cfg) } : c;
9363
+ const base = cfg && (!!userCombine[c.field] || !c.valueGetter) ? { ...c, valueGetter: combineValueGetter(combineSrcCols(cfg, byField), cfg) } : c;
9364
9364
  return { ...base, renderCell: (val, row) => renderDiffCell(base, val, row) };
9365
9365
  })];
9366
9366
  },
@@ -9411,15 +9411,17 @@ function Datatable({
9411
9411
  const cfg = combineCfg(userCombine[c.field] || c.combine);
9412
9412
  if (!cfg) continue;
9413
9413
  const srcCols = combineSrcCols(cfg, byField);
9414
+ const explicit = !!userCombine[c.field];
9415
+ const useJoin = explicit || !c.valueGetter;
9414
9416
  out[i] = {
9415
9417
  ...c,
9416
9418
  editable: false,
9417
9419
  // the combined value is synthetic — inline editing would write to a phantom field
9418
- valueGetter: c.valueGetter || combineValueGetter(srcCols, cfg),
9419
- // Consumer renderCell wins. If they overrode only valueGetter, fall back to the DEFAULT cell render
9420
- // (renderCell: undefined) so the cell shows THEIR value — keeping display in sync with what
9421
- // sort/filter/search/export use — rather than the auto source-join. Otherwise render the combined cell.
9422
- renderCell: c.renderCell || (c.valueGetter ? void 0 : ((value, row) => renderCombined(srcCols, row, cfg)))
9420
+ valueGetter: useJoin ? combineValueGetter(srcCols, cfg) : c.valueGetter,
9421
+ // In diff mode the diff `columns` memo already wrapped renderCell in renderDiffCell (over the enriched
9422
+ // combined value) — keep that wrapper, or an EXPLICIT combine's `!explicit` short-circuit would strip the
9423
+ // diff arrows / old→new styling (#369 review). Declarative diff already preserved it (c.renderCell truthy).
9424
+ renderCell: isDiff ? c.renderCell : !explicit && c.renderCell || (useJoin ? ((value, row) => renderCombined(srcCols, row, cfg)) : void 0)
9423
9425
  };
9424
9426
  }
9425
9427
  return out;