@eagami/ui 5.94.0 → 5.96.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": "@eagami/ui",
3
- "version": "5.94.0",
3
+ "version": "5.96.0",
4
4
  "description": "Lightweight, accessible, themeable Angular UI component library and icon set built on CSS custom properties",
5
5
  "author": "Michal Wiraszka <michal@eagami.com>",
6
6
  "license": "MIT",
@@ -131,6 +131,8 @@ export interface EagamiMessages {
131
131
  };
132
132
  dataTable: {
133
133
  noData: string;
134
+ selectAllRows: string;
135
+ selectRow: (label: string) => string;
134
136
  };
135
137
  /** Locale numeric formatting rules, used to group numbers even when the
136
138
  * runtime's `Intl` lacks this locale's data (some browsers ship a reduced
@@ -3349,6 +3351,8 @@ export interface DataTableRowContextMenuEvent<T = Record<string, unknown>> {
3349
3351
  */
3350
3352
  readonly event: MouseEvent | KeyboardEvent;
3351
3353
  }
3354
+ /** How many of the rows shown are selected. */
3355
+ type VisibleSelection = 'none' | 'some' | 'all';
3352
3356
  /** Current sort state: which column is sorted and in which direction. */
3353
3357
  export interface DataTableSortState {
3354
3358
  column: string;
@@ -3356,9 +3360,9 @@ export interface DataTableSortState {
3356
3360
  }
3357
3361
  /**
3358
3362
  * Table for tabular data with sortable columns, sticky headers, and density
3359
- * presets. Supports striping, borders, hoverable rows, and custom cell or
3360
- * header templates via `ng-template`. Sort state is exposed as a two-way
3361
- * `model()` binding.
3363
+ * presets. Supports striping, borders, hoverable rows, row selection, and custom
3364
+ * cell or header templates via `ng-template`. Sort and selection state are
3365
+ * exposed as two-way `model()` bindings.
3362
3366
  */
3363
3367
  export declare class DataTableComponent<T = Record<string, unknown>> {
3364
3368
  private readonly i18n;
@@ -3420,7 +3424,19 @@ export declare class DataTableComponent<T = Record<string, unknown>> {
3420
3424
  readonly loading: import("@angular/core").InputSignal<boolean>;
3421
3425
  /** How many placeholder rows to show while `loading`. */
3422
3426
  readonly loadingRowCount: import("@angular/core").InputSignal<number>;
3427
+ /**
3428
+ * Adds a leading checkbox column for selecting rows, headed by a checkbox that
3429
+ * selects or clears every row shown. Needs `trackBy`, whose values key the selection.
3430
+ */
3431
+ readonly selectable: import("@angular/core").InputSignal<boolean>;
3432
+ /** Names a row in its selection checkbox's label; defaults to the row's first column. */
3433
+ readonly rowLabel: import("@angular/core").InputSignal<((row: T) => string) | undefined>;
3423
3434
  readonly sort: import("@angular/core").ModelSignal<DataTableSortState>;
3435
+ /**
3436
+ * The `trackBy` values of the selected rows, two-way bindable via `[(selection)]`.
3437
+ * Rows that leave `data`, such as those on another page, stay selected.
3438
+ */
3439
+ readonly selection: import("@angular/core").ModelSignal<readonly T[keyof T][]>;
3424
3440
  /** Fires whenever the sort column or direction changes via header click. */
3425
3441
  readonly sorted: import("@angular/core").OutputEmitterRef<DataTableSortState>;
3426
3442
  /** Fires with the row's data when a body row is activated by click or Enter/Space while `clickable` is set. */
@@ -3437,6 +3453,14 @@ export declare class DataTableComponent<T = Record<string, unknown>> {
3437
3453
  protected readonly announcedLinkColumn: import("@angular/core").Signal<number>;
3438
3454
  readonly placeholderRows: import("@angular/core").Signal<number[]>;
3439
3455
  private readonly bodyRowCount;
3456
+ protected readonly selectionColumn: import("@angular/core").Signal<boolean>;
3457
+ protected readonly dataColumnOffset: import("@angular/core").Signal<1 | 0>;
3458
+ protected readonly gridColumnCount: import("@angular/core").Signal<number>;
3459
+ private readonly selectedKeys;
3460
+ private readonly visibleKeys;
3461
+ protected readonly visibleSelection: import("@angular/core").Signal<VisibleSelection>;
3462
+ protected readonly noRowsToSelect: import("@angular/core").Signal<boolean>;
3463
+ protected readonly selectAllLabel: import("@angular/core").Signal<string>;
3440
3464
  readonly hostClasses: import("@angular/core").Signal<{
3441
3465
  [x: string]: boolean;
3442
3466
  'ea-data-table--sticky': boolean;
@@ -3463,6 +3487,14 @@ export declare class DataTableComponent<T = Record<string, unknown>> {
3463
3487
  onRowContextMenu(row: T, rowElement: HTMLElement, event: MouseEvent | KeyboardEvent): void;
3464
3488
  private onRowLongPress;
3465
3489
  clearKeyboardRequest(): void;
3490
+ protected isSelected(row: T): boolean;
3491
+ protected rowSelectLabel(row: T): string;
3492
+ protected toggleRow(row: T): void;
3493
+ protected toggleVisibleRows(): void;
3494
+ protected onSelectAllClick(event: MouseEvent): void;
3495
+ protected onRowSelectKey(row: T, event: Event): void;
3496
+ private rowKey;
3497
+ private firstColumnText;
3466
3498
  onCellFocus(row: number, col: number): void;
3467
3499
  onGridKeydown(event: KeyboardEvent): void;
3468
3500
  private focusCell;
@@ -3568,13 +3600,29 @@ export declare class DataTableComponent<T = Record<string, unknown>> {
3568
3600
  "required": false;
3569
3601
  "isSignal": true;
3570
3602
  };
3603
+ "selectable": {
3604
+ "alias": "selectable";
3605
+ "required": false;
3606
+ "isSignal": true;
3607
+ };
3608
+ "rowLabel": {
3609
+ "alias": "rowLabel";
3610
+ "required": false;
3611
+ "isSignal": true;
3612
+ };
3571
3613
  "sort": {
3572
3614
  "alias": "sort";
3573
3615
  "required": false;
3574
3616
  "isSignal": true;
3575
3617
  };
3618
+ "selection": {
3619
+ "alias": "selection";
3620
+ "required": false;
3621
+ "isSignal": true;
3622
+ };
3576
3623
  }, {
3577
3624
  "sort": "sortChange";
3625
+ "selection": "selectionChange";
3578
3626
  "sorted": "sorted";
3579
3627
  "rowActivate": "rowActivate";
3580
3628
  "rowContextMenu": "rowContextMenu";
@@ -9022,7 +9070,9 @@ export type TreeSize = EaSize;
9022
9070
  * keyboard navigation (Arrow keys, Home, End, Enter / Space, and typeahead
9023
9071
  * on node labels). Selection and expansion state are model signals: pass
9024
9072
  * `[selectedId]` / `[expandedIds]` to control them, or bind
9025
- * `[(selectedId)]` / `[(expandedIds)]` for two-way sync.
9073
+ * `[(selectedId)]` / `[(expandedIds)]` for two-way sync. Integrates with
9074
+ * Angular forms via `ControlValueAccessor`, with the selected id as the form
9075
+ * value.
9026
9076
  *
9027
9077
  * The component implements the ARIA `tree` pattern:
9028
9078
  * - The outer `<ul>` carries `role="tree"`
@@ -9030,7 +9080,7 @@ export type TreeSize = EaSize;
9030
9080
  * `aria-setsize`, `aria-expanded` (branches only), and `aria-selected`
9031
9081
  * - Roving tabindex: only the currently-focused node has `tabindex="0"`
9032
9082
  */
9033
- export declare class TreeComponent {
9083
+ export declare class TreeComponent implements ControlValueAccessor {
9034
9084
  private readonly hostEl;
9035
9085
  readonly nodes: import("@angular/core").InputSignal<readonly TreeNode<unknown>[]>;
9036
9086
  readonly size: import("@angular/core").InputSignal<EaSize>;
@@ -9042,6 +9092,10 @@ export declare class TreeComponent {
9042
9092
  /** Optional aria-label for the tree itself. */
9043
9093
  readonly ariaLabel: import("@angular/core").InputSignal<string | undefined>;
9044
9094
  readonly nodeClick: import("@angular/core").OutputEmitterRef<TreeNode<unknown>>;
9095
+ private readonly _formDisabled;
9096
+ private onChange;
9097
+ private onTouched;
9098
+ protected readonly isDisabled: Signal<boolean>;
9045
9099
  private readonly listEl;
9046
9100
  private readonly _focusedId;
9047
9101
  private readonly typeahead;
@@ -9054,10 +9108,15 @@ export declare class TreeComponent {
9054
9108
  protected readonly focusedId: Signal<string>;
9055
9109
  protected readonly hostClasses: Signal<string[]>;
9056
9110
  constructor();
9111
+ writeValue(val: string | null | undefined): void;
9112
+ registerOnChange(fn: (value: string | null) => void): void;
9113
+ registerOnTouched(fn: () => void): void;
9114
+ setDisabledState(isDisabled: boolean): void;
9057
9115
  protected onNodeSelect(node: TreeNode): void;
9058
9116
  protected onNodeToggle(id: string): void;
9059
9117
  protected onKeydown(event: KeyboardEvent): void;
9060
9118
  protected onTreeFocus(event: FocusEvent): void;
9119
+ protected onTreeFocusOut(event: FocusEvent): void;
9061
9120
  private focusNode;
9062
9121
  private findNode;
9063
9122
  private findParentId;