@lukfel/ng-scaffold 21.1.42 → 21.1.44

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
@@ -67,12 +67,14 @@ import { ScaffoldService } from '@lukfel/ng-scaffold';
67
67
 
68
68
  export class AppComponent {
69
69
 
70
- public scaffoldConfig: ScaffoldConfig = {
70
+ private scaffoldService = inject(ScaffoldService);
71
+
72
+ private scaffoldConfig: ScaffoldConfig = {
71
73
  // Create your own config or generate it at https://lukfel.github.io/ng-scaffold
72
74
  headerConfig: { enable: true, title: 'Scaffold works!' }
73
75
  };
74
76
 
75
- constructor(private scaffoldService: ScaffoldService) {
77
+ constructor() {
76
78
  this.scaffoldService.scaffoldConfig = this.scaffoldConfig;
77
79
  }
78
80
  }
@@ -212,7 +214,10 @@ There are two ways to listen to scaffold user events (button clicks, input chang
212
214
  ### (Recommended) Option 1 – Subscribe to Event Observables
213
215
  Subscribe to the event Observables and listen to changes
214
216
  ```ts
215
- constructor(private scaffoldService: ScaffoldService, private router: Router) {
217
+ private scaffoldService = inject(ScaffoldService);
218
+ private router = inject(Router);
219
+
220
+ constructor() {
216
221
  // Listen to click events (header menu and navbar buttons - click)
217
222
  this.scaffoldService.buttonClickEventValue$.subscribe((id: string) => {
218
223
  this.router.navigate([id]);
@@ -284,7 +289,7 @@ import { Logger } from '@lukfel/ng-scaffold';
284
289
 
285
290
  export class AppComponent {
286
291
 
287
- constructor(private logger: Logger) {}
292
+ private logger = inject(Logger);
288
293
 
289
294
  // Generic api call with logging
290
295
  public apiCallWithLogging(): void {
@@ -305,7 +310,7 @@ import { SnackbarService } from '@lukfel/ng-scaffold';
305
310
 
306
311
  export class AppComponent {
307
312
 
308
- constructor(private snackbarService: SnackbarService) {}
313
+ private snackbarService = inject(SnackbarService);
309
314
 
310
315
  // Generic api call with snackbar response
311
316
  public apiCallWithSnackbarResponse(): void {
@@ -326,7 +331,7 @@ import { DialogService } from '@lukfel/ng-scaffold';
326
331
 
327
332
  export class AppComponent {
328
333
 
329
- constructor(private dialogService: DialogService) {}
334
+ private dialogService = inject(DialogService);
330
335
 
331
336
  // Generic api call with a subsequent confirmation dialog
332
337
  public apiCallWithDialogConfirmation(): void {
@@ -352,7 +357,9 @@ import { BreakpointService } from '@lukfel/ng-scaffold';
352
357
 
353
358
  export class AppComponent {
354
359
 
355
- constructor(private breakpointService: BreakpointService) {
360
+ private breakpointService = inject(BreakpointService);
361
+
362
+ constructor() {
356
363
  this.breakpointService.breakpoint$.subscribe((result: BreakpointState) => {
357
364
  // Check which breakpoint is active
358
365
  if (result.breakpoints[Breakpoints.XSmall]) {
@@ -379,8 +386,10 @@ import { ThemeService } from '@lukfel/ng-scaffold';
379
386
 
380
387
  export class AppComponent {
381
388
 
389
+ private themeService = inject(ThemeService);
390
+
382
391
  constructor(private themeService: ThemeService) {
383
- this.themeService.setTheme('my-theme2', true); // the second parameter allows to persists the theme in the LocalStorage (using the built in LocalStorageService)
392
+ this.themeService.setTheme('my-theme2', true); // set theme and store in local storage (using the built in LocalStorageService)
384
393
  }
385
394
  }
386
395
  ```
@@ -394,7 +403,9 @@ In addition to the scaffold components provided by default by the the `ScaffoldC
394
403
  * **Note:** Standalone components must be imported manually and are not part of the `ScaffoldComponent` import
395
404
 
396
405
  ### List
397
- A standalone Material Design inspired list and table hybrid component for displaying structured collections of items. It supports avatars, titles, subtitles, actions, selections and dragging — making it ideal for dashboards, inventories, and administrative views.
406
+ A standalone Material Design inspired list and table hybrid component for displaying structured
407
+ collections of items. It supports avatars, titles, subtitles, actions, selections and dragging —
408
+ making it ideal for dashboards, inventories, and administrative views.
398
409
 
399
410
  ```ts
400
411
  import { ListComponent } from '@lukfel/ng-scaffold';
@@ -403,31 +414,31 @@ import { ListComponent } from '@lukfel/ng-scaffold';
403
414
  ```ts
404
415
  import { Button, ListConfig, ListHeader, ListItem } from '@lukfel/ng-scaffold';
405
416
 
406
- public listConfig: ListConfig = { // (Optional) list config
417
+ public listConfig = signal<ListConfig>({ // (Optional) list config
407
418
  enableSelection: true,
408
419
  enableDragging: true,
409
420
  initialSortToken: 'title',
410
421
  initialSortAsc: true,
411
422
  showDividers: true
412
- }
423
+ });
413
424
 
414
- public listHeader: ListHeader = { // (Optional) list header
425
+ public listHeader = signal<ListHeader>({ // (Optional) list header
415
426
  matIcon: 'sort',
416
427
  items: [
417
428
  { title: 'Items', sortToken: 'title' }
418
429
  ]
419
- };
430
+ });
420
431
 
421
- public listItems: ListItem[] = [
432
+ public listItems = signal<ListItem[]>([
422
433
  { id: 1, svgIcon: 'logo', title: 'Item 2', subtitle: 'I am disabled', disabled: true },
423
434
  { id: 0, avatar: 'assets/img/logos/ic_launcher-web.png', title: 'Item 1', subtitle: 'I am clickable', clickable: true },
424
435
  { id: 2, matIcon: 'person', title: 'Item 3', subtitle: 'I have no edit buton', hiddenButtonIds: ['edit'] },
425
- ];
436
+ ]);
426
437
 
427
- public buttons: Button[] = [ // (Optional) list buttons
438
+ public buttons = signal<Button[]>([ // (Optional) list buttons
428
439
  { id: 'edit', matIcon: 'edit' },
429
440
  { id: 'delete', matIcon: 'delete', cssClass: 'warn' }
430
- ];
441
+ ]);
431
442
 
432
443
  // (Optional) Handle sort events
433
444
  public onListSortChange(event: { sortToken: string, sortAsc: boolean }): void {
@@ -455,10 +466,10 @@ public onListItemClick(item: ListItem): void {
455
466
 
456
467
  ```html
457
468
  <lf-list
458
- [config]="listConfig"
459
- [header]="listHeader"
460
- [items]="listItems"
461
- [buttons]="listButtons"
469
+ [config]="listConfig()"
470
+ [header]="listHeader()"
471
+ [items]="listItems()"
472
+ [buttons]="listButtons()"
462
473
  (sortChangeEvent)="onListSortChange($event)"
463
474
  (selectionChangeEvent)="onListSelectionChange()"
464
475
  (buttonClickEvent)="onListButtonClick($event)"
@@ -466,7 +477,9 @@ public onListItemClick(item: ListItem): void {
466
477
  ```
467
478
 
468
479
  ### File-Upload
469
- A standalone Material Design styled button for selecting and uploading files. It wraps a hidden native file input and exposes a simple, customizable interface with built-in icon, tooltip, and state management.
480
+ A standalone Material Design styled button for selecting and uploading files. It wraps a hidden
481
+ native file input and exposes a simple, customizable interface with built-in icon, tooltip, and
482
+ state management.
470
483
 
471
484
  ```ts
472
485
  import { FileUploadComponent } from '@lukfel/ng-scaffold';
@@ -488,7 +501,9 @@ public onFileChange(file: File): void {
488
501
  ```
489
502
 
490
503
  ### Color-Picker
491
- A standalone Material Design styled button for picking colors. It wraps a hidden native color input and exposes a simple, customizable interface with built-in icon, tooltip, and state management.
504
+ A standalone Material Design styled button for picking colors. It wraps a hidden native color
505
+ input and exposes a simple, customizable interface with built-in icon, tooltip, and state
506
+ management.
492
507
 
493
508
  ```ts
494
509
  import { ColorPickerComponent } from '@lukfel/ng-scaffold';
@@ -509,7 +524,9 @@ public onColorChange(color: string): void {
509
524
  ```
510
525
 
511
526
  ### Placeholder
512
- A versatile UI component designed to display an informative placeholder or empty state when no data is available. It provides a structured layout for an icon, heading, message, and optional action — helping guide users toward the next step.
527
+ A standalone UI component designed to display an informative placeholder or empty state when no
528
+ data is available. It provides a structured layout for an icon, heading, message, and optional
529
+ action — helping guide users toward the next step.
513
530
 
514
531
  ```ts
515
532
  import { PlaceholderComponent } from '@lukfel/ng-scaffold';
@@ -518,7 +535,7 @@ import { PlaceholderComponent } from '@lukfel/ng-scaffold';
518
535
  ```ts
519
536
  import { PlaceholderConfig } from '@lukfel/ng-scaffold';
520
537
 
521
- public placeholderConfig: PlaceholderConfig = {
538
+ public placeholderConfig = signal<PlaceholderConfig>({
522
539
  matIcon: 'widgets',
523
540
  title: 'Title',
524
541
  message: 'This is a placeholder message.',
@@ -526,7 +543,7 @@ public placeholderConfig: PlaceholderConfig = {
526
543
  id: 'placeholder',
527
544
  label: 'ACTION'
528
545
  }
529
- }
546
+ });
530
547
 
531
548
  public onPlaceholderButtonClick(): void {
532
549
  // handle placeholder click
@@ -535,10 +552,29 @@ public onPlaceholderButtonClick(): void {
535
552
 
536
553
  ```html
537
554
  <lf-placeholder
538
- [placeholderConfig]="placeholderConfig"
555
+ [placeholderConfig]="placeholderConfig()"
539
556
  (buttonClickEvent)="onPlaceholderButtonClick()"></lf-placeholder>
540
557
  ```
541
558
 
559
+ ### Notification
560
+ A standalone standalone Material Design inspired notification component for displaying transient
561
+ messages to users. It supports different severity levels (primary, accent, warn), optional
562
+ icons, optional actions, and links.
563
+
564
+ ```ts
565
+ import { NotificationComponent } from '@lukfel/ng-scaffold';
566
+ ```
567
+
568
+ ```html
569
+ <lf-notification
570
+ [static]="true"
571
+ color="accent"
572
+ message="This is an info notification with action."
573
+ matIcon="info"
574
+ action="Action"
575
+ (clickEvent)="onNotificationClick()"></lf-notification>
576
+ ```
577
+
542
578
 
543
579
 
544
580
 
@@ -548,8 +584,7 @@ Intercept HTTP Calls and automatically show a loading spinner.
548
584
  * **Note:** The loading spinner can also be manually shown by udpating the value for `scaffoldConfig.loading` in the `ScaffoldService`
549
585
 
550
586
  ```ts
551
- import { ScaffoldLoadingInterceptor, ScaffoldComponent } from '@lukfel/ng-scaffold';
552
- import { isDevMode } from '@angular/core';
587
+ import { ScaffoldLoadingInterceptor } from '@lukfel/ng-scaffold';
553
588
 
554
589
  ...
555
590
  providers: [