@lukfel/ng-scaffold 21.1.40 → 21.1.43
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 +33 -25
- package/fesm2022/{lukfel-ng-scaffold-confirm-dialog.component-CPAkFqh1.mjs → lukfel-ng-scaffold-confirm-dialog.component-CMryk2MU.mjs} +3 -3
- package/fesm2022/{lukfel-ng-scaffold-confirm-dialog.component-CPAkFqh1.mjs.map → lukfel-ng-scaffold-confirm-dialog.component-CMryk2MU.mjs.map} +1 -1
- package/fesm2022/lukfel-ng-scaffold.mjs +58 -59
- package/fesm2022/lukfel-ng-scaffold.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/add-component.js +6 -6
- package/schematics/ng-add/add-component.js.map +1 -1
- package/schematics/ng-add/add-config.js +2 -2
- package/schematics/ng-add/add-config.js.map +1 -1
- package/schematics/ng-add/add-styles.js +1 -1
package/README.md
CHANGED
|
@@ -67,12 +67,14 @@ import { ScaffoldService } from '@lukfel/ng-scaffold';
|
|
|
67
67
|
|
|
68
68
|
export class AppComponent {
|
|
69
69
|
|
|
70
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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); //
|
|
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
|
```
|
|
@@ -403,31 +412,31 @@ import { ListComponent } from '@lukfel/ng-scaffold';
|
|
|
403
412
|
```ts
|
|
404
413
|
import { Button, ListConfig, ListHeader, ListItem } from '@lukfel/ng-scaffold';
|
|
405
414
|
|
|
406
|
-
public listConfig
|
|
415
|
+
public listConfig = signal<ListConfig>({ // (Optional) list config
|
|
407
416
|
enableSelection: true,
|
|
408
417
|
enableDragging: true,
|
|
409
418
|
initialSortToken: 'title',
|
|
410
419
|
initialSortAsc: true,
|
|
411
420
|
showDividers: true
|
|
412
|
-
}
|
|
421
|
+
});
|
|
413
422
|
|
|
414
|
-
public listHeader
|
|
423
|
+
public listHeader = signal<ListHeader>({ // (Optional) list header
|
|
415
424
|
matIcon: 'sort',
|
|
416
425
|
items: [
|
|
417
426
|
{ title: 'Items', sortToken: 'title' }
|
|
418
427
|
]
|
|
419
|
-
};
|
|
428
|
+
});
|
|
420
429
|
|
|
421
|
-
public listItems
|
|
430
|
+
public listItems = signal<ListItem[]>([
|
|
422
431
|
{ id: 1, svgIcon: 'logo', title: 'Item 2', subtitle: 'I am disabled', disabled: true },
|
|
423
432
|
{ id: 0, avatar: 'assets/img/logos/ic_launcher-web.png', title: 'Item 1', subtitle: 'I am clickable', clickable: true },
|
|
424
433
|
{ id: 2, matIcon: 'person', title: 'Item 3', subtitle: 'I have no edit buton', hiddenButtonIds: ['edit'] },
|
|
425
|
-
];
|
|
434
|
+
]);
|
|
426
435
|
|
|
427
|
-
public buttons
|
|
436
|
+
public buttons = signal<Button[]>([ // (Optional) list buttons
|
|
428
437
|
{ id: 'edit', matIcon: 'edit' },
|
|
429
438
|
{ id: 'delete', matIcon: 'delete', cssClass: 'warn' }
|
|
430
|
-
];
|
|
439
|
+
]);
|
|
431
440
|
|
|
432
441
|
// (Optional) Handle sort events
|
|
433
442
|
public onListSortChange(event: { sortToken: string, sortAsc: boolean }): void {
|
|
@@ -455,10 +464,10 @@ public onListItemClick(item: ListItem): void {
|
|
|
455
464
|
|
|
456
465
|
```html
|
|
457
466
|
<lf-list
|
|
458
|
-
[config]="listConfig"
|
|
459
|
-
[header]="listHeader"
|
|
460
|
-
[items]="listItems"
|
|
461
|
-
[buttons]="listButtons"
|
|
467
|
+
[config]="listConfig()"
|
|
468
|
+
[header]="listHeader()"
|
|
469
|
+
[items]="listItems()"
|
|
470
|
+
[buttons]="listButtons()"
|
|
462
471
|
(sortChangeEvent)="onListSortChange($event)"
|
|
463
472
|
(selectionChangeEvent)="onListSelectionChange()"
|
|
464
473
|
(buttonClickEvent)="onListButtonClick($event)"
|
|
@@ -518,7 +527,7 @@ import { PlaceholderComponent } from '@lukfel/ng-scaffold';
|
|
|
518
527
|
```ts
|
|
519
528
|
import { PlaceholderConfig } from '@lukfel/ng-scaffold';
|
|
520
529
|
|
|
521
|
-
public placeholderConfig
|
|
530
|
+
public placeholderConfig = signal<PlaceholderConfig>({
|
|
522
531
|
matIcon: 'widgets',
|
|
523
532
|
title: 'Title',
|
|
524
533
|
message: 'This is a placeholder message.',
|
|
@@ -526,7 +535,7 @@ public placeholderConfig: PlaceholderConfig = {
|
|
|
526
535
|
id: 'placeholder',
|
|
527
536
|
label: 'ACTION'
|
|
528
537
|
}
|
|
529
|
-
}
|
|
538
|
+
});
|
|
530
539
|
|
|
531
540
|
public onPlaceholderButtonClick(): void {
|
|
532
541
|
// handle placeholder click
|
|
@@ -535,7 +544,7 @@ public onPlaceholderButtonClick(): void {
|
|
|
535
544
|
|
|
536
545
|
```html
|
|
537
546
|
<lf-placeholder
|
|
538
|
-
[placeholderConfig]="placeholderConfig"
|
|
547
|
+
[placeholderConfig]="placeholderConfig()"
|
|
539
548
|
(buttonClickEvent)="onPlaceholderButtonClick()"></lf-placeholder>
|
|
540
549
|
```
|
|
541
550
|
|
|
@@ -548,8 +557,7 @@ Intercept HTTP Calls and automatically show a loading spinner.
|
|
|
548
557
|
* **Note:** The loading spinner can also be manually shown by udpating the value for `scaffoldConfig.loading` in the `ScaffoldService`
|
|
549
558
|
|
|
550
559
|
```ts
|
|
551
|
-
import { ScaffoldLoadingInterceptor
|
|
552
|
-
import { isDevMode } from '@angular/core';
|
|
560
|
+
import { ScaffoldLoadingInterceptor } from '@lukfel/ng-scaffold';
|
|
553
561
|
|
|
554
562
|
...
|
|
555
563
|
providers: [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, signal, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import * as
|
|
3
|
+
import * as i1$1 from '@angular/material/button';
|
|
4
4
|
import { MatButtonModule } from '@angular/material/button';
|
|
5
5
|
import * as i1 from '@angular/material/dialog';
|
|
6
6
|
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
@@ -11,7 +11,7 @@ class ConfirmDialogComponent {
|
|
|
11
11
|
this.config = signal(this.data, ...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
12
12
|
}
|
|
13
13
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ConfirmDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
14
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: ConfirmDialogComponent, isStandalone: true, selector: "lf-confirm-dialog", ngImport: i0, template: "@if (config(); as config) {\r\n @if (config.title) {\r\n <h2 mat-dialog-title>{{ config.title }}</h2>\r\n }\r\n\r\n <mat-dialog-content>\r\n @if (config.message) {\r\n <p>{{ config.message }}</p>\r\n }\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions align=\"end\">\r\n @if (config.closeLabel) {\r\n <button mat-button [mat-dialog-close]=\"false\">\r\n {{ config.closeLabel }}\r\n </button>\r\n }\r\n @if (config.confirmLabel) {\r\n <button mat-button color=\"primary\" [mat-dialog-close]=\"true\">\r\n {{ config.confirmLabel }}\r\n </button>\r\n }\r\n </mat-dialog-actions>\r\n}\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type:
|
|
14
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: ConfirmDialogComponent, isStandalone: true, selector: "lf-confirm-dialog", ngImport: i0, template: "@if (config(); as config) {\r\n @if (config.title) {\r\n <h2 mat-dialog-title>{{ config.title }}</h2>\r\n }\r\n\r\n <mat-dialog-content>\r\n @if (config.message) {\r\n <p>{{ config.message }}</p>\r\n }\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions align=\"end\">\r\n @if (config.closeLabel) {\r\n <button mat-button [mat-dialog-close]=\"false\">\r\n {{ config.closeLabel }}\r\n </button>\r\n }\r\n @if (config.confirmLabel) {\r\n <button mat-button color=\"primary\" [mat-dialog-close]=\"true\">\r\n {{ config.confirmLabel }}\r\n </button>\r\n }\r\n </mat-dialog-actions>\r\n}\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
15
15
|
}
|
|
16
16
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: ConfirmDialogComponent, decorators: [{
|
|
17
17
|
type: Component,
|
|
@@ -22,4 +22,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
|
|
|
22
22
|
}] });
|
|
23
23
|
|
|
24
24
|
export { ConfirmDialogComponent };
|
|
25
|
-
//# sourceMappingURL=lukfel-ng-scaffold-confirm-dialog.component-
|
|
25
|
+
//# sourceMappingURL=lukfel-ng-scaffold-confirm-dialog.component-CMryk2MU.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lukfel-ng-scaffold-confirm-dialog.component-
|
|
1
|
+
{"version":3,"file":"lukfel-ng-scaffold-confirm-dialog.component-CMryk2MU.mjs","sources":["../../../projects/ng-scaffold/src/lib/shared/components/dialogs/confirm-dialog/confirm-dialog.component.ts","../../../projects/ng-scaffold/src/lib/shared/components/dialogs/confirm-dialog/confirm-dialog.component.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, inject, signal } from '@angular/core';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';\r\nimport { ConfirmDialogConfig } from '../../../../models';\r\n\r\n@Component({\r\n selector: 'lf-confirm-dialog',\r\n templateUrl: './confirm-dialog.component.html',\r\n styleUrls: ['./confirm-dialog.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n standalone: true,\r\n imports: [\r\n MatDialogModule,\r\n MatButtonModule\r\n ]\r\n})\r\nexport class ConfirmDialogComponent {\r\n \r\n private data = inject<ConfirmDialogConfig>(MAT_DIALOG_DATA);\r\n public config = signal<ConfirmDialogConfig>(this.data);\r\n\r\n}\r\n","@if (config(); as config) {\r\n @if (config.title) {\r\n <h2 mat-dialog-title>{{ config.title }}</h2>\r\n }\r\n\r\n <mat-dialog-content>\r\n @if (config.message) {\r\n <p>{{ config.message }}</p>\r\n }\r\n </mat-dialog-content>\r\n\r\n <mat-dialog-actions align=\"end\">\r\n @if (config.closeLabel) {\r\n <button mat-button [mat-dialog-close]=\"false\">\r\n {{ config.closeLabel }}\r\n </button>\r\n }\r\n @if (config.confirmLabel) {\r\n <button mat-button color=\"primary\" [mat-dialog-close]=\"true\">\r\n {{ config.confirmLabel }}\r\n </button>\r\n }\r\n </mat-dialog-actions>\r\n}\r\n"],"names":["i2"],"mappings":";;;;;;;MAgBa,sBAAsB,CAAA;AAXnC,IAAA,WAAA,GAAA;AAaW,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAsB,eAAe,CAAC;AACpD,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAsB,IAAI,CAAC,IAAI,kDAAC;AAExD,IAAA;8GALY,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAtB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,sBAAsB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EChBnC,gpBAwBA,EAAA,MAAA,EAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EDZI,eAAe,+nBACf,eAAe,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAAA,IAAA,CAAA,SAAA,EAAA,QAAA,EAAA,iOAAA,EAAA,MAAA,EAAA,CAAA,WAAA,CAAA,EAAA,QAAA,EAAA,CAAA,WAAA,EAAA,WAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAGN,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAXlC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,mBAAmB,mBAGZ,uBAAuB,CAAC,MAAM,EAAA,UAAA,EACnC,IAAI,EAAA,OAAA,EACP;wBACP,eAAe;wBACf;AACD,qBAAA,EAAA,QAAA,EAAA,gpBAAA,EAAA;;;;;"}
|