@kouji-ui/core 0.9.2 → 0.11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kouji-ui/core",
3
- "version": "0.9.2",
3
+ "version": "0.11.0",
4
4
  "description": "Headless Angular UI primitives — signal-driven directives with WCAG 2.1 AAA semantics, no CDK, and a handful of opt-in global stylesheets.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -12141,6 +12141,25 @@ declare class KjTable<TData extends RowData = unknown> {
12141
12141
  * row index. Mirrors TanStack's `getRowId` option.
12142
12142
  */
12143
12143
  kjGetRowId: _angular_core.InputSignal<((row: TData, index: number) => string) | undefined>;
12144
+ /**
12145
+ * Tree rows: returns a row's children (TanStack `getSubRows`). Children are
12146
+ * real table rows with the same columns, shown under their parent while it
12147
+ * is expanded. `undefined` (default) keeps the table flat.
12148
+ */
12149
+ kjGetSubRows: _angular_core.InputSignal<((row: TData, index: number) => readonly TData[] | undefined) | undefined>;
12150
+ /**
12151
+ * Tree rows: whether selecting a parent also selects its children
12152
+ * (TanStack `enableSubRowSelection`). Defaults to `false` — every row is
12153
+ * selected on its own.
12154
+ */
12155
+ kjSelectSubRows: _angular_core.InputSignalWithTransform<boolean, unknown>;
12156
+ /**
12157
+ * Tree rows: whether parents start expanded. Applies to every parent with
12158
+ * no explicit expanded state — on first render, to rows loaded later, and
12159
+ * again after {@link resetExpansion} (an infinite table's request change).
12160
+ * Defaults to `false`.
12161
+ */
12162
+ kjDefaultExpanded: _angular_core.InputSignalWithTransform<boolean, unknown>;
12144
12163
  private readonly _state;
12145
12164
  /**
12146
12165
  * The full table state as a single deep signal. Call `state()` for the
@@ -12169,6 +12188,46 @@ declare class KjTable<TData extends RowData = unknown> {
12169
12188
  readonly rowCount: _angular_core.Signal<number | null>;
12170
12189
  readonly manualPagination: _angular_core.Signal<boolean>;
12171
12190
  setRowCount(n: number | null): void;
12191
+ /**
12192
+ * Server-side infinite mode. When on, `kjTableData` is index-aligned with
12193
+ * the server's result set and may hold holes (`undefined` / `null`) for
12194
+ * rows that are not loaded yet: the holes are dropped before the rows reach
12195
+ * TanStack, and {@link sourceIndex} maps each loaded row back to its
12196
+ * position in the full result set. Sorting, filtering and pagination are
12197
+ * left to the server (TanStack's `manual*` flags), so a header click only
12198
+ * changes `state.sorting()` — feed it into your loader's request.
12199
+ */
12200
+ private readonly _infinite;
12201
+ /** Whether server-side infinite mode is on — see {@link setInfinite}. */
12202
+ readonly infinite: _angular_core.Signal<boolean>;
12203
+ /**
12204
+ * Turn server-side infinite mode on or off.
12205
+ * @param on `true` while the data is a sparse window of a server result set.
12206
+ */
12207
+ setInfinite(on: boolean): void;
12208
+ /**
12209
+ * Whether a tree parent with no explicit entry in `state.expanded` is open.
12210
+ * Starts at `kjDefaultExpanded`; {@link expandAll} / {@link collapseAll}
12211
+ * flip it so rows loaded later follow the last bulk action.
12212
+ */
12213
+ private readonly _expandDefault;
12214
+ /**
12215
+ * `state.expanded` as TanStack sees it. Open-by-default with no exceptions
12216
+ * is handed over as `true`: TanStack skips expansion altogether for an
12217
+ * empty record, and `getIsRowExpanded` still keeps leaf rows closed.
12218
+ */
12219
+ private readonly tanstackExpanded;
12220
+ /** Whether a row is expanded: its explicit state, else the tree default for parents. */
12221
+ private isRowExpanded;
12222
+ /** Rows handed to TanStack plus, in infinite mode, their positions in the full result set. */
12223
+ private readonly compacted;
12224
+ /**
12225
+ * In infinite mode, the result-set position of each loaded top-level row,
12226
+ * indexed by its TanStack `row.index`; `null` otherwise.
12227
+ */
12228
+ readonly sourceIndex: _angular_core.Signal<readonly number[] | null>;
12229
+ /** Position of a top-level row in the full result set (its `row.index` outside infinite mode). */
12230
+ private sourceIndexOf;
12172
12231
  /**
12173
12232
  * Apply a TanStack updater (value or function) to a single state slice.
12174
12233
  *
@@ -12192,6 +12251,32 @@ declare class KjTable<TData extends RowData = unknown> {
12192
12251
  private readonly boundColumns;
12193
12252
  /** The TanStack table instance. Access rows, headers, and state here. */
12194
12253
  readonly table: () => Table<TData>;
12254
+ constructor();
12255
+ /**
12256
+ * Whether every loaded parent row is expanded (`false` when no row has
12257
+ * children). Rows of an infinite table that are not loaded yet do not count.
12258
+ */
12259
+ readonly isAllExpanded: _angular_core.Signal<boolean>;
12260
+ /**
12261
+ * Whether a row is expanded — its own choice, else `kjDefaultExpanded`
12262
+ * (or the last expand-all / collapse-all) for parents.
12263
+ * @param row The row.
12264
+ */
12265
+ getRowExpanded(row: Row<TData>): boolean;
12266
+ /**
12267
+ * Expand or collapse one row. Unlike TanStack's `row.toggleExpanded()`, the
12268
+ * choice is stored explicitly, so it holds against `kjDefaultExpanded`.
12269
+ * @param row The row.
12270
+ * @param expanded The new state; omitted, the current one flips.
12271
+ * @returns The row's new expanded state.
12272
+ */
12273
+ setRowExpanded(row: Row<TData>, expanded?: boolean): boolean;
12274
+ /** Expand every parent row, including the ones loaded later. */
12275
+ expandAll(): void;
12276
+ /** Collapse every parent row, including the ones loaded later. */
12277
+ collapseAll(): void;
12278
+ /** Forget per-row expansion and go back to `kjDefaultExpanded` — e.g. when the rows are replaced. */
12279
+ resetExpansion(): void;
12195
12280
  /** Merge a partial state. Unspecified slices are left untouched. */
12196
12281
  setState(partial: Partial<KjTableState>): void;
12197
12282
  /** Reset every slice back to the directive's default state. */
@@ -12212,7 +12297,7 @@ declare class KjTable<TData extends RowData = unknown> {
12212
12297
  */
12213
12298
  get columnApi(): KjColumnApi<TData>;
12214
12299
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<KjTable<any>, never>;
12215
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<KjTable<any>, "[kjTable]", ["kjTable"], { "kjTable": { "alias": "kjTable"; "required": true; "isSignal": true; }; "kjTableData": { "alias": "kjTableData"; "required": false; "isSignal": true; }; "kjGetRowId": { "alias": "kjGetRowId"; "required": false; "isSignal": true; }; }, { "kjTableData": "kjTableDataChange"; }, never, never, true, never>;
12300
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<KjTable<any>, "[kjTable]", ["kjTable"], { "kjTable": { "alias": "kjTable"; "required": true; "isSignal": true; }; "kjTableData": { "alias": "kjTableData"; "required": false; "isSignal": true; }; "kjGetRowId": { "alias": "kjGetRowId"; "required": false; "isSignal": true; }; "kjGetSubRows": { "alias": "kjGetSubRows"; "required": false; "isSignal": true; }; "kjSelectSubRows": { "alias": "kjSelectSubRows"; "required": false; "isSignal": true; }; "kjDefaultExpanded": { "alias": "kjDefaultExpanded"; "required": false; "isSignal": true; }; }, { "kjTableData": "kjTableDataChange"; }, never, never, true, never>;
12216
12301
  }
12217
12302
 
12218
12303
  /** Sort direction for table columns. */
@@ -12302,13 +12387,19 @@ declare class KjTableSort {
12302
12387
  declare class KjTableRow<TData extends RowData = unknown> {
12303
12388
  /** TanStack row instance — pass from getRowModel().rows. */
12304
12389
  kjRow: _angular_core.InputSignal<_tanstack_angular_table.Row<TData>>;
12390
+ /**
12391
+ * Overrides the 1-based `aria-rowindex` — for rows whose place in the grid
12392
+ * is not their `row.index`, like the children of a tree row. `null`
12393
+ * (default) derives it from the row.
12394
+ */
12395
+ kjAriaRowIndex: _angular_core.InputSignal<number | null>;
12305
12396
  private readonly table;
12306
12397
  /** 1-based ARIA index — accounts for header row(s). */
12307
12398
  readonly ariaRowIndex: _angular_core.Signal<number>;
12308
12399
  readonly isSelectable: _angular_core.Signal<boolean>;
12309
12400
  readonly isSelected: _angular_core.Signal<boolean>;
12310
12401
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<KjTableRow<any>, never>;
12311
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<KjTableRow<any>, "[kjTableRow]", never, { "kjRow": { "alias": "kjRow"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
12402
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<KjTableRow<any>, "[kjTableRow]", never, { "kjRow": { "alias": "kjRow"; "required": true; "isSignal": true; }; "kjAriaRowIndex": { "alias": "kjAriaRowIndex"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
12312
12403
  }
12313
12404
 
12314
12405
  /**