@eagami/ui 5.71.2 → 5.72.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.71.2",
3
+ "version": "5.72.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",
@@ -2967,6 +2967,13 @@ export declare class MenuComponent {
2967
2967
  protected readonly triggerEl: import("@angular/core").WritableSignal<HTMLElement | undefined>;
2968
2968
  protected readonly asContextMenu: import("@angular/core").WritableSignal<boolean>;
2969
2969
  protected readonly anchorPoint: import("@angular/core").WritableSignal<PopoverAnchorPoint | null>;
2970
+ private readonly openedWith;
2971
+ /**
2972
+ * The `contextMenuData` of the `[eaContextMenuTrigger]` host that last opened the
2973
+ * menu, so one menu can act on whichever of many hosts it was opened from. Kept
2974
+ * after the menu closes, and cleared when a trigger button opens it instead.
2975
+ */
2976
+ readonly triggerData: import("@angular/core").Signal<unknown>;
2970
2977
  readonly activeItemId: import("@angular/core").WritableSignal<string | null>;
2971
2978
  constructor();
2972
2979
  /** Toggles the menu open state, anchoring it to the given trigger element. */
@@ -2977,9 +2984,10 @@ export declare class MenuComponent {
2977
2984
  * Opens the menu as the context menu of `anchorEl`: at `point` when given (a
2978
2985
  * pointer position, in viewport coordinates), else at its placement against the
2979
2986
  * anchor. Focuses the first item, closes on any click or context-menu request
2980
- * outside the menu, and hands focus back to wherever it was on close.
2987
+ * outside the menu, and hands focus back to wherever it was on close. `data`
2988
+ * becomes `triggerData()`.
2981
2989
  */
2982
- openAsContextMenu(anchorEl: HTMLElement, point?: PopoverAnchorPoint | null): void;
2990
+ openAsContextMenu(anchorEl: HTMLElement, point?: PopoverAnchorPoint | null, data?: unknown): void;
2983
2991
  private show;
2984
2992
  /**
2985
2993
  * Closes the menu if it is open. Pass `restoreFocus: true` to return focus
@@ -3283,20 +3291,31 @@ export type ContextMenuPosition = 'pointer' | 'anchor';
3283
3291
  export type ContextMenuTarget = MenuComponent | PopoverComponent;
3284
3292
  /**
3285
3293
  * Opens an `<ea-menu>` or `<ea-popover>` as the context menu of its host: on a
3286
- * right-click or long press, or from the keyboard with Shift+F10 or the
3294
+ * right-click or a touch long press, or from the keyboard with Shift+F10 or the
3287
3295
  * context-menu key while focus is on the host or inside it. The browser's own
3288
3296
  * menu is suppressed only when the target opens, so a `null` target, a disabled
3289
3297
  * menu, or a request something inside the host has already handled leaves it be.
3290
3298
  *
3299
+ * The long press is recognised here rather than left to the browser, since iOS
3300
+ * Safari never turns one into a `contextmenu` event. While a target is set, the
3301
+ * host also drops the iOS link and image preview a long press would raise.
3302
+ *
3291
3303
  * A menu opens straight away. A popover's parent drives its `[open]` state, so it
3292
3304
  * emits `openRequested` with the point to bind to `[anchorPoint]` instead; give it
3293
3305
  * `[contextMenu]="true"` so it takes focus and dismisses like a context menu.
3294
3306
  *
3307
+ * One menu can serve many hosts: give each its own `contextMenuData`, and the
3308
+ * menu's `triggerData()` holds the data of whichever host opened it.
3309
+ *
3295
3310
  * @example
3296
3311
  * ```html
3297
- * <article [eaContextMenuTrigger]="actions">Right-click me</article>
3312
+ * @for (file of files; track file.id) {
3313
+ * <article [eaContextMenuTrigger]="actions" [contextMenuData]="file">
3314
+ * {{ file.name }}
3315
+ * </article>
3316
+ * }
3298
3317
  * <ea-menu #actions>
3299
- * <ea-menu-item>Rename</ea-menu-item>
3318
+ * <ea-menu-item (clicked)="rename(actions.triggerData())">Rename</ea-menu-item>
3300
3319
  * </ea-menu>
3301
3320
  * ```
3302
3321
  */
@@ -3309,9 +3328,14 @@ export declare class ContextMenuTriggerDirective {
3309
3328
  * `anchor` opens at the target's placement against the host instead.
3310
3329
  */
3311
3330
  readonly contextMenuPosition: import("@angular/core").InputSignal<ContextMenuPosition>;
3331
+ /** Handed to an `<ea-menu>` target as it opens, where its `triggerData()` reads it back. */
3332
+ readonly contextMenuData: import("@angular/core").InputSignal<unknown>;
3333
+ constructor();
3312
3334
  onContextMenu(event: MouseEvent): void;
3313
3335
  onKeydown(event: KeyboardEvent): void;
3314
3336
  private request;
3337
+ private canOpen;
3338
+ private open;
3315
3339
  static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuTriggerDirective, never>;
3316
3340
  static ɵdir: i0.ɵɵDirectiveDeclaration<ContextMenuTriggerDirective, "[eaContextMenuTrigger]", never, {
3317
3341
  "target": {
@@ -3324,6 +3348,11 @@ export declare class ContextMenuTriggerDirective {
3324
3348
  "required": false;
3325
3349
  "isSignal": true;
3326
3350
  };
3351
+ "contextMenuData": {
3352
+ "alias": "contextMenuData";
3353
+ "required": false;
3354
+ "isSignal": true;
3355
+ };
3327
3356
  }, {}, never, never, true, never>;
3328
3357
  }
3329
3358
  /** Vertical density preset for table rows and header cells. */
@@ -3363,7 +3392,11 @@ export interface DataTableRowContextMenuEvent<T = Record<string, unknown>> {
3363
3392
  readonly rowElement: HTMLElement;
3364
3393
  /** Where to open a menu: the pointer, or below the focused row or cell for a keyboard request. */
3365
3394
  readonly point: PopoverAnchorPoint;
3366
- /** The originating event; call `preventDefault()` on it to suppress the browser's own menu. */
3395
+ /**
3396
+ * The originating event, or a stand-in `contextmenu` event for a touch long press;
3397
+ * call `preventDefault()` on it to claim the request, which also suppresses the
3398
+ * browser's own menu.
3399
+ */
3367
3400
  readonly event: MouseEvent | KeyboardEvent;
3368
3401
  }
3369
3402
  /** Current sort state: which column is sorted and in which direction. */
@@ -3380,6 +3413,7 @@ export interface DataTableSortState {
3380
3413
  export declare class DataTableComponent<T = Record<string, unknown>> {
3381
3414
  private readonly i18n;
3382
3415
  private readonly host;
3416
+ private readonly rowEls;
3383
3417
  private readonly activeCell;
3384
3418
  private static readonly PAGE_JUMP;
3385
3419
  private keyboardRequestPending;
@@ -3475,6 +3509,7 @@ export declare class DataTableComponent<T = Record<string, unknown>> {
3475
3509
  rowTabindex(row: T): number | null;
3476
3510
  onRowActivate(row: T, event?: Event): void;
3477
3511
  onRowContextMenu(row: T, rowElement: HTMLElement, event: MouseEvent | KeyboardEvent): void;
3512
+ private onRowLongPress;
3478
3513
  clearKeyboardRequest(): void;
3479
3514
  onCellFocus(row: number, col: number): void;
3480
3515
  onGridKeydown(event: KeyboardEvent): void;