@eagami/ui 5.95.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.95.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";