twico-ui 1.34.0 → 1.36.0

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
@@ -2050,8 +2050,26 @@ interface DatatableProps<T = any> extends Omit<React.HTMLAttributes<HTMLDivEleme
2050
2050
  renderRowDetail?: (row: T) => React.ReactNode;
2051
2051
  /** Controlled set of expanded row keys (values from `rowKey`). Omit for uncontrolled (internal) expansion. */
2052
2052
  expandedRowIds?: Array<string | number>;
2053
- /** Fires with the next full array of expanded row keys whenever a row is expanded or collapsed. */
2053
+ /** Fires with the next full array of expanded row keys whenever a row is expanded or collapsed.
2054
+ * Shared by `renderRowDetail` (#350) and the row-tree (#359). */
2054
2055
  onExpandedRowsChange?: (ids: Array<string | number>) => void;
2056
+ /** #359 (server-mode lazy row-tree): draw the same leading chevron on a parent DATA row (independent of
2057
+ * `renderRowDetail`). Expanding reveals CHILD data rows in the SAME columns rather than a detail panel.
2058
+ * In **server mode** the grid does not fetch children — the expanded key set is folded into the
2059
+ * `onServerChange` query (`expanded`), so the host returns the parent + its children inline (and sets
2060
+ * `rowCount` to the flattened visible count; a collapsed parent counts as one row). Uses the shared
2061
+ * `expandedRowIds`/`onExpandedRowsChange`. Tree rows need stable unique keys (via `rowKey`/`id`). Carries
2062
+ * the #350 limits: not yet supported with `virtualized`, pivot, or `rowGrouping`, and no chevron on a
2063
+ * pinned (sticky) row. */
2064
+ getRowCanExpand?: (row: T) => boolean;
2065
+ /** #359: 0-based nesting depth, used only for the tree indent on the first data cell (0 = top-level parent).
2066
+ * In server mode supply it from the host-flattened rows; in client mode it's derived from the `getSubRows`
2067
+ * splice when omitted. @default 0 */
2068
+ getRowDepth?: (row: T) => number;
2069
+ /** #359 (client mode): children for an expanded parent, spliced in as first-class rows (same columns)
2070
+ * immediately after it. Ignored in `serverMode` (the host returns children inline). Children are rendered
2071
+ * after pagination, so they don't consume the parent's page budget and aren't independently sorted/filtered. */
2072
+ getSubRows?: (row: T) => T[];
2055
2073
  }
2056
2074
 
2057
2075
  /** String-column filter operators (Datatable server mode). */
@@ -2092,6 +2110,10 @@ interface DatatableQuery {
2092
2110
  /** `field`s of the columns currently hidden via the Columns menu. Always populated in
2093
2111
  * `onServerChange`; optional for the same reason as `visibleColumns`. */
2094
2112
  hiddenColumns?: string[];
2113
+ /** #359 (server-mode lazy row-tree): keys of the currently-expanded parent rows. Always populated in
2114
+ * `onServerChange` when `getRowCanExpand` is used — the host fetches those parents' children and returns
2115
+ * them inline (a collapsed parent is one row). Optional on a hand-built query. */
2116
+ expanded?: Array<string | number>;
2095
2117
  }
2096
2118
 
2097
2119
  /**
@@ -2161,6 +2183,13 @@ interface DatatableColumn<T = any> {
2161
2183
  combine?: string[] | { fields: string[]; layout?: "inline" | "stack"; separator?: string; labels?: boolean };
2162
2184
  /** Header label. @default field ("Actions" for actions columns) */
2163
2185
  headerName?: string;
2186
+ /** #367: fully custom column-header renderer — the header analogue of `renderCell`, mirroring MUI
2187
+ * DataGrid's `renderHeader`. Receives the resolved column and returns the node rendered inside the
2188
+ * header cell (e.g. a label + a trailing (i) `Tooltip`) in place of `headerName`. `headerName` stays
2189
+ * the plain-text label used for quick-search, the Columns menu, CSV/Excel export, aggregation, and the
2190
+ * a11y sort/resize labels, so a custom header never breaks those string consumers — keep it set to that
2191
+ * label. (A non-string `headerName` also no longer throws in the Columns menu.) */
2192
+ renderHeader?: (args: { column: DatatableColumn<T> }) => React.ReactNode;
2164
2193
  /** Data type. "actions" renders per-row action buttons via getActions. @default "string" */
2165
2194
  type?: "string" | "number" | "actions";
2166
2195
  /** Filter operators + value comparison for this column, **decoupled from the edit `type`** (#270).
package/dist/index.d.ts CHANGED
@@ -2050,8 +2050,26 @@ interface DatatableProps<T = any> extends Omit<React.HTMLAttributes<HTMLDivEleme
2050
2050
  renderRowDetail?: (row: T) => React.ReactNode;
2051
2051
  /** Controlled set of expanded row keys (values from `rowKey`). Omit for uncontrolled (internal) expansion. */
2052
2052
  expandedRowIds?: Array<string | number>;
2053
- /** Fires with the next full array of expanded row keys whenever a row is expanded or collapsed. */
2053
+ /** Fires with the next full array of expanded row keys whenever a row is expanded or collapsed.
2054
+ * Shared by `renderRowDetail` (#350) and the row-tree (#359). */
2054
2055
  onExpandedRowsChange?: (ids: Array<string | number>) => void;
2056
+ /** #359 (server-mode lazy row-tree): draw the same leading chevron on a parent DATA row (independent of
2057
+ * `renderRowDetail`). Expanding reveals CHILD data rows in the SAME columns rather than a detail panel.
2058
+ * In **server mode** the grid does not fetch children — the expanded key set is folded into the
2059
+ * `onServerChange` query (`expanded`), so the host returns the parent + its children inline (and sets
2060
+ * `rowCount` to the flattened visible count; a collapsed parent counts as one row). Uses the shared
2061
+ * `expandedRowIds`/`onExpandedRowsChange`. Tree rows need stable unique keys (via `rowKey`/`id`). Carries
2062
+ * the #350 limits: not yet supported with `virtualized`, pivot, or `rowGrouping`, and no chevron on a
2063
+ * pinned (sticky) row. */
2064
+ getRowCanExpand?: (row: T) => boolean;
2065
+ /** #359: 0-based nesting depth, used only for the tree indent on the first data cell (0 = top-level parent).
2066
+ * In server mode supply it from the host-flattened rows; in client mode it's derived from the `getSubRows`
2067
+ * splice when omitted. @default 0 */
2068
+ getRowDepth?: (row: T) => number;
2069
+ /** #359 (client mode): children for an expanded parent, spliced in as first-class rows (same columns)
2070
+ * immediately after it. Ignored in `serverMode` (the host returns children inline). Children are rendered
2071
+ * after pagination, so they don't consume the parent's page budget and aren't independently sorted/filtered. */
2072
+ getSubRows?: (row: T) => T[];
2055
2073
  }
2056
2074
 
2057
2075
  /** String-column filter operators (Datatable server mode). */
@@ -2092,6 +2110,10 @@ interface DatatableQuery {
2092
2110
  /** `field`s of the columns currently hidden via the Columns menu. Always populated in
2093
2111
  * `onServerChange`; optional for the same reason as `visibleColumns`. */
2094
2112
  hiddenColumns?: string[];
2113
+ /** #359 (server-mode lazy row-tree): keys of the currently-expanded parent rows. Always populated in
2114
+ * `onServerChange` when `getRowCanExpand` is used — the host fetches those parents' children and returns
2115
+ * them inline (a collapsed parent is one row). Optional on a hand-built query. */
2116
+ expanded?: Array<string | number>;
2095
2117
  }
2096
2118
 
2097
2119
  /**
@@ -2161,6 +2183,13 @@ interface DatatableColumn<T = any> {
2161
2183
  combine?: string[] | { fields: string[]; layout?: "inline" | "stack"; separator?: string; labels?: boolean };
2162
2184
  /** Header label. @default field ("Actions" for actions columns) */
2163
2185
  headerName?: string;
2186
+ /** #367: fully custom column-header renderer — the header analogue of `renderCell`, mirroring MUI
2187
+ * DataGrid's `renderHeader`. Receives the resolved column and returns the node rendered inside the
2188
+ * header cell (e.g. a label + a trailing (i) `Tooltip`) in place of `headerName`. `headerName` stays
2189
+ * the plain-text label used for quick-search, the Columns menu, CSV/Excel export, aggregation, and the
2190
+ * a11y sort/resize labels, so a custom header never breaks those string consumers — keep it set to that
2191
+ * label. (A non-string `headerName` also no longer throws in the Columns menu.) */
2192
+ renderHeader?: (args: { column: DatatableColumn<T> }) => React.ReactNode;
2164
2193
  /** Data type. "actions" renders per-row action buttons via getActions. @default "string" */
2165
2194
  type?: "string" | "number" | "actions";
2166
2195
  /** Filter operators + value comparison for this column, **decoupled from the edit `type`** (#270).