@lukfel/ng-scaffold 22.2.3 → 22.3.2

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/README.md CHANGED
@@ -453,7 +453,8 @@ In addition to the scaffold components provided by default by the the `ScaffoldC
453
453
 
454
454
  ### List
455
455
  A standalone Material Design inspired list and table hybrid component for displaying structured
456
- collections of items. It supports avatars, titles, subtitles, actions, selections and dragging —
456
+ collections of items. It supports avatars, titles, subtitles, actions, menus, selections and
457
+ dragging —
457
458
  making it ideal for dashboards, inventories, and administrative views.
458
459
 
459
460
  ```ts
@@ -461,7 +462,7 @@ import { ListComponent } from '@lukfel/ng-scaffold';
461
462
  ```
462
463
 
463
464
  ```ts
464
- import { Button, ListConfig, ListHeader, ListItem } from '@lukfel/ng-scaffold';
465
+ import { ListConfig, ListHeader, ListItem, MenuButton } from '@lukfel/ng-scaffold';
465
466
 
466
467
  public listConfig = signal<ListConfig>({ // (Optional) list config
467
468
  enableSelection: true,
@@ -484,9 +485,17 @@ public listItems = signal<ListItem[]>([
484
485
  { id: 2, matIcon: 'person', title: 'Item 3', subtitle: 'I have no edit buton', hiddenButtonIds: ['edit'] },
485
486
  ]);
486
487
 
487
- public listButtons = signal<Button[]>([ // (Optional) list buttons
488
+ public listButtons = signal<MenuButton[]>([ // (Optional) list buttons
488
489
  { id: 'edit', matIcon: 'edit' },
489
- { id: 'delete', matIcon: 'delete', cssClass: 'warn' }
490
+ { id: 'delete', matIcon: 'delete', cssClass: 'warn' },
491
+ { // A button with menuButtons opens a menu
492
+ id: 'more',
493
+ matIcon: 'more_vert',
494
+ menuButtons: [
495
+ { id: 'share', matIcon: 'share', label: 'Share' },
496
+ { id: 'archive', matIcon: 'archive', label: 'Archive' }
497
+ ]
498
+ }
490
499
  ]);
491
500
 
492
501
  // (Optional) Handle sort events
@@ -505,7 +514,7 @@ public onListSelectionChange(items: ListItem[]): void {
505
514
  }
506
515
 
507
516
  public onListButtonClick(event: { buttonId: string, item: ListItem }): void {
508
- // handle button click
517
+ // handle button click, menu entries report their own id here too
509
518
  }
510
519
 
511
520
  public onListItemClick(item: ListItem): void {
@@ -614,14 +623,30 @@ icons, optional actions, and links.
614
623
  import { NotificationComponent } from '@lukfel/ng-scaffold';
615
624
  ```
616
625
 
626
+ ```ts
627
+ import { NotificationConfig } from '@lukfel/ng-scaffold';
628
+
629
+ public notificationConfig = signal<NotificationConfig>({
630
+ color: 'accent',
631
+ matIcon: 'info',
632
+ message: 'This is an info notification with action.',
633
+ static: true,
634
+ button: {
635
+ id: 'notification',
636
+ label: 'ACTION',
637
+ matIcon: 'auto_awesome'
638
+ }
639
+ });
640
+
641
+ public onNotificationClick(): void {
642
+ // handle notification click
643
+ }
644
+ ```
645
+
617
646
  ```html
618
647
  <lf-notification
619
- [static]="true"
620
- color="accent"
621
- message="This is an info notification with action."
622
- matIcon="info"
623
- action="Action"
624
- (clickEvent)="onNotificationClick()"></lf-notification>
648
+ [notificationConfig]="notificationConfig()"
649
+ (buttonClickEvent)="onNotificationClick()"></lf-notification>
625
650
  ```
626
651
 
627
652