@eagami/ui 5.95.0 → 5.97.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.97.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
@@ -153,6 +155,12 @@ export interface EagamiMessages {
153
155
  nextMonth: string;
154
156
  nextYear: string;
155
157
  today: string;
158
+ rangePlaceholder: string;
159
+ rangeDialogLabel: string;
160
+ clearRange: string;
161
+ rangeStartDay: (day: number) => string;
162
+ rangeEndDay: (day: number) => string;
163
+ chooseEndDate: string;
156
164
  /** Abbreviated weekday names, Sunday first (index 0), for the calendar
157
165
  * header. Bundled so the calendar localizes even when the runtime's
158
166
  * `Intl` lacks this locale's date data. */
@@ -3349,6 +3357,8 @@ export interface DataTableRowContextMenuEvent<T = Record<string, unknown>> {
3349
3357
  */
3350
3358
  readonly event: MouseEvent | KeyboardEvent;
3351
3359
  }
3360
+ /** How many of the rows shown are selected. */
3361
+ type VisibleSelection = 'none' | 'some' | 'all';
3352
3362
  /** Current sort state: which column is sorted and in which direction. */
3353
3363
  export interface DataTableSortState {
3354
3364
  column: string;
@@ -3356,9 +3366,9 @@ export interface DataTableSortState {
3356
3366
  }
3357
3367
  /**
3358
3368
  * 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.
3369
+ * presets. Supports striping, borders, hoverable rows, row selection, and custom
3370
+ * cell or header templates via `ng-template`. Sort and selection state are
3371
+ * exposed as two-way `model()` bindings.
3362
3372
  */
3363
3373
  export declare class DataTableComponent<T = Record<string, unknown>> {
3364
3374
  private readonly i18n;
@@ -3420,7 +3430,19 @@ export declare class DataTableComponent<T = Record<string, unknown>> {
3420
3430
  readonly loading: import("@angular/core").InputSignal<boolean>;
3421
3431
  /** How many placeholder rows to show while `loading`. */
3422
3432
  readonly loadingRowCount: import("@angular/core").InputSignal<number>;
3433
+ /**
3434
+ * Adds a leading checkbox column for selecting rows, headed by a checkbox that
3435
+ * selects or clears every row shown. Needs `trackBy`, whose values key the selection.
3436
+ */
3437
+ readonly selectable: import("@angular/core").InputSignal<boolean>;
3438
+ /** Names a row in its selection checkbox's label; defaults to the row's first column. */
3439
+ readonly rowLabel: import("@angular/core").InputSignal<((row: T) => string) | undefined>;
3423
3440
  readonly sort: import("@angular/core").ModelSignal<DataTableSortState>;
3441
+ /**
3442
+ * The `trackBy` values of the selected rows, two-way bindable via `[(selection)]`.
3443
+ * Rows that leave `data`, such as those on another page, stay selected.
3444
+ */
3445
+ readonly selection: import("@angular/core").ModelSignal<readonly T[keyof T][]>;
3424
3446
  /** Fires whenever the sort column or direction changes via header click. */
3425
3447
  readonly sorted: import("@angular/core").OutputEmitterRef<DataTableSortState>;
3426
3448
  /** Fires with the row's data when a body row is activated by click or Enter/Space while `clickable` is set. */
@@ -3437,6 +3459,14 @@ export declare class DataTableComponent<T = Record<string, unknown>> {
3437
3459
  protected readonly announcedLinkColumn: import("@angular/core").Signal<number>;
3438
3460
  readonly placeholderRows: import("@angular/core").Signal<number[]>;
3439
3461
  private readonly bodyRowCount;
3462
+ protected readonly selectionColumn: import("@angular/core").Signal<boolean>;
3463
+ protected readonly dataColumnOffset: import("@angular/core").Signal<1 | 0>;
3464
+ protected readonly gridColumnCount: import("@angular/core").Signal<number>;
3465
+ private readonly selectedKeys;
3466
+ private readonly visibleKeys;
3467
+ protected readonly visibleSelection: import("@angular/core").Signal<VisibleSelection>;
3468
+ protected readonly noRowsToSelect: import("@angular/core").Signal<boolean>;
3469
+ protected readonly selectAllLabel: import("@angular/core").Signal<string>;
3440
3470
  readonly hostClasses: import("@angular/core").Signal<{
3441
3471
  [x: string]: boolean;
3442
3472
  'ea-data-table--sticky': boolean;
@@ -3463,6 +3493,14 @@ export declare class DataTableComponent<T = Record<string, unknown>> {
3463
3493
  onRowContextMenu(row: T, rowElement: HTMLElement, event: MouseEvent | KeyboardEvent): void;
3464
3494
  private onRowLongPress;
3465
3495
  clearKeyboardRequest(): void;
3496
+ protected isSelected(row: T): boolean;
3497
+ protected rowSelectLabel(row: T): string;
3498
+ protected toggleRow(row: T): void;
3499
+ protected toggleVisibleRows(): void;
3500
+ protected onSelectAllClick(event: MouseEvent): void;
3501
+ protected onRowSelectKey(row: T, event: Event): void;
3502
+ private rowKey;
3503
+ private firstColumnText;
3466
3504
  onCellFocus(row: number, col: number): void;
3467
3505
  onGridKeydown(event: KeyboardEvent): void;
3468
3506
  private focusCell;
@@ -3568,13 +3606,29 @@ export declare class DataTableComponent<T = Record<string, unknown>> {
3568
3606
  "required": false;
3569
3607
  "isSignal": true;
3570
3608
  };
3609
+ "selectable": {
3610
+ "alias": "selectable";
3611
+ "required": false;
3612
+ "isSignal": true;
3613
+ };
3614
+ "rowLabel": {
3615
+ "alias": "rowLabel";
3616
+ "required": false;
3617
+ "isSignal": true;
3618
+ };
3571
3619
  "sort": {
3572
3620
  "alias": "sort";
3573
3621
  "required": false;
3574
3622
  "isSignal": true;
3575
3623
  };
3624
+ "selection": {
3625
+ "alias": "selection";
3626
+ "required": false;
3627
+ "isSignal": true;
3628
+ };
3576
3629
  }, {
3577
3630
  "sort": "sortChange";
3631
+ "selection": "selectionChange";
3578
3632
  "sorted": "sorted";
3579
3633
  "rowActivate": "rowActivate";
3580
3634
  "rowContextMenu": "rowContextMenu";
@@ -3706,12 +3760,20 @@ export interface DatePickerDateRange {
3706
3760
  start: Date;
3707
3761
  end: Date;
3708
3762
  }
3763
+ /** Whether a pick selects one date or a start and end date. */
3764
+ export type DatePickerMode = 'single' | 'range';
3765
+ /** Value reported to Angular forms: a `Date` in `single` mode, a `DatePickerDateRange` in `range` mode. */
3766
+ export type DatePickerControlValue = Date | DatePickerDateRange | null;
3709
3767
  interface CalendarDay {
3710
3768
  date: Date;
3711
3769
  day: number;
3712
3770
  isCurrentMonth: boolean;
3713
3771
  isToday: boolean;
3714
3772
  isSelected: boolean;
3773
+ isRangeStart: boolean;
3774
+ isRangeEnd: boolean;
3775
+ /** Strictly between the ends of the highlighted range. */
3776
+ isInRange: boolean;
3715
3777
  isDisabled: boolean;
3716
3778
  isFocused: boolean;
3717
3779
  }
@@ -3721,8 +3783,9 @@ interface CalendarDay {
3721
3783
  * or with a month name) and is rewritten in the configured `format` on commit.
3722
3784
  * Supports `min`/`max` bounds, disabled weekdays and dates, configurable week
3723
3785
  * start, locale-aware formatting via `Intl.DateTimeFormat`, and full keyboard
3724
- * navigation (arrows, PageUp/PageDown, Home/End, Enter, Escape). Integrates
3725
- * with Angular forms via `ControlValueAccessor`.
3786
+ * navigation (arrows, PageUp/PageDown, Home/End, Enter, Escape). In `range`
3787
+ * mode two picks set a start and end date, and the range is typed as two dates
3788
+ * joined by an en dash. Integrates with Angular forms via `ControlValueAccessor`.
3726
3789
  */
3727
3790
  export declare class DatePickerComponent extends LabelledFieldControlBase implements ControlValueAccessor {
3728
3791
  protected readonly fieldEl: import("@angular/core").Signal<ElementRef<HTMLElement> | undefined>;
@@ -3750,9 +3813,15 @@ export declare class DatePickerComponent extends LabelledFieldControlBase implem
3750
3813
  readonly weekStartsOn: import("@angular/core").InputSignal<DatePickerWeekStart>;
3751
3814
  readonly locale: import("@angular/core").InputSignal<string | undefined>;
3752
3815
  readonly id: import("@angular/core").InputSignal<string>;
3816
+ /** Picks one date, or a start and end date in `range` mode, where only the two ends need to be available days. */
3817
+ readonly mode: import("@angular/core").InputSignal<DatePickerMode>;
3753
3818
  readonly value: import("@angular/core").ModelSignal<Date | null>;
3819
+ /** Selected start and end dates in `range` mode, two-way bindable via `[(range)]`. */
3820
+ readonly range: import("@angular/core").ModelSignal<DatePickerDateRange | null>;
3754
3821
  /** Fires when the selected date changes, including when cleared. */
3755
3822
  readonly changed: import("@angular/core").OutputEmitterRef<Date | null>;
3823
+ /** Fires in `range` mode when the selected range changes, including when cleared. */
3824
+ readonly rangeChanged: import("@angular/core").OutputEmitterRef<DatePickerDateRange | null>;
3756
3825
  readonly isOpen: import("@angular/core").WritableSignal<boolean>;
3757
3826
  readonly viewYear: import("@angular/core").WritableSignal<number>;
3758
3827
  readonly viewMonth: import("@angular/core").WritableSignal<number>;
@@ -3761,6 +3830,8 @@ export declare class DatePickerComponent extends LabelledFieldControlBase implem
3761
3830
  private readonly isFocused;
3762
3831
  /** Entry in progress, held verbatim until it is committed or abandoned. */
3763
3832
  private readonly draft;
3833
+ protected readonly rangeAnchor: import("@angular/core").WritableSignal<Date | null>;
3834
+ private readonly hoveredDate;
3764
3835
  private onChange;
3765
3836
  private onTouched;
3766
3837
  readonly isDisabled: import("@angular/core").Signal<boolean>;
@@ -3782,8 +3853,12 @@ export declare class DatePickerComponent extends LabelledFieldControlBase implem
3782
3853
  private readonly intlLocalizesEffectiveLocale;
3783
3854
  /** Placeholder text, empty unless a `placeholder` is given. */
3784
3855
  readonly resolvedPlaceholder: import("@angular/core").Signal<string>;
3856
+ protected readonly isRange: import("@angular/core").Signal<boolean>;
3857
+ protected readonly hasValue: import("@angular/core").Signal<boolean>;
3785
3858
  /** Accessible name when neither `label` nor `aria-labelledby` is given. */
3786
3859
  protected readonly fallbackLabel: import("@angular/core").Signal<string>;
3860
+ protected readonly dialogLabel: import("@angular/core").Signal<string>;
3861
+ protected readonly clearLabel: import("@angular/core").Signal<string>;
3787
3862
  readonly dialogId: import("@angular/core").Signal<string>;
3788
3863
  readonly fieldClasses: import("@angular/core").Signal<{
3789
3864
  'ea-date-picker__field--focused': boolean;
@@ -3799,9 +3874,11 @@ export declare class DatePickerComponent extends LabelledFieldControlBase implem
3799
3874
  readonly inputText: import("@angular/core").Signal<string>;
3800
3875
  readonly monthYearLabel: import("@angular/core").Signal<string>;
3801
3876
  readonly weekdayLabels: import("@angular/core").Signal<string[]>;
3877
+ /** Committed range, or the one being picked: from the anchor to the hovered or focused day. */
3878
+ private readonly highlightedRange;
3802
3879
  readonly weeks: import("@angular/core").Signal<CalendarDay[][]>;
3803
- writeValue(val: DatePickerValue): void;
3804
- registerOnChange(fn: (value: Date | null) => void): void;
3880
+ writeValue(val: DatePickerValue | DatePickerDateRange): void;
3881
+ registerOnChange(fn: (value: DatePickerControlValue) => void): void;
3805
3882
  registerOnTouched(fn: () => void): void;
3806
3883
  setDisabledState(isDisabled: boolean): void;
3807
3884
  /** Toggles the calendar popover between open and closed. */
@@ -3814,8 +3891,12 @@ export declare class DatePickerComponent extends LabelledFieldControlBase implem
3814
3891
  /** Moves keyboard focus to the date field. */
3815
3892
  focus(): void;
3816
3893
  selectDay(day: CalendarDay): void;
3817
- /** Clears the selected date and emits `changed` with `null`. */
3894
+ protected onDayHover(day: CalendarDay): void;
3895
+ protected rangeDayLabel(day: CalendarDay): string | null;
3896
+ protected onGridLeave(): void;
3897
+ /** Clears the selected date, or range in `range` mode, and emits `changed` or `rangeChanged` with `null`. */
3818
3898
  clear(event: Event): void;
3899
+ private pick;
3819
3900
  goToPrevMonth(): void;
3820
3901
  goToNextMonth(): void;
3821
3902
  goToPrevYear(): void;
@@ -3833,14 +3914,21 @@ export declare class DatePickerComponent extends LabelledFieldControlBase implem
3833
3914
  protected onInputBlur(): void;
3834
3915
  protected handleInputKeydown(event: KeyboardEvent): void;
3835
3916
  private commitDraft;
3917
+ private commitRangeEntry;
3918
+ private parseEntry;
3919
+ private applyRange;
3836
3920
  private applyValue;
3837
3921
  private isUnavailable;
3838
3922
  private covers;
3839
3923
  handleGridKeydown(event: KeyboardEvent): void;
3840
3924
  /** Called by `<ea-popover>` when the user clicks outside the picker. */
3841
3925
  onPopoverCloseRequested(): void;
3926
+ private formatDate;
3842
3927
  private formatOptions;
3843
3928
  private toDate;
3929
+ private isDateRange;
3930
+ private toRange;
3931
+ private orderRange;
3844
3932
  private startOfDay;
3845
3933
  private isSameDay;
3846
3934
  private addDays;
@@ -3917,14 +4005,26 @@ export declare class DatePickerComponent extends LabelledFieldControlBase implem
3917
4005
  "required": false;
3918
4006
  "isSignal": true;
3919
4007
  };
4008
+ "mode": {
4009
+ "alias": "mode";
4010
+ "required": false;
4011
+ "isSignal": true;
4012
+ };
3920
4013
  "value": {
3921
4014
  "alias": "value";
3922
4015
  "required": false;
3923
4016
  "isSignal": true;
3924
4017
  };
4018
+ "range": {
4019
+ "alias": "range";
4020
+ "required": false;
4021
+ "isSignal": true;
4022
+ };
3925
4023
  }, {
3926
4024
  "value": "valueChange";
4025
+ "range": "rangeChange";
3927
4026
  "changed": "changed";
4027
+ "rangeChanged": "rangeChanged";
3928
4028
  }, never, never, true, never>;
3929
4029
  }
3930
4030
  /** Width preset of the dialog panel. */