@dragonworks/ngx-dashboard 20.1.1 → 20.1.3

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
@@ -10,33 +10,101 @@ npm install @dragonworks/ngx-dashboard
10
10
 
11
11
  ## Features
12
12
 
13
- - Grid-based drag and drop with collision detection
14
- - Resizable cells with boundary constraints
15
- - Editor and viewer modes
16
- - NgRx Signals state management
17
- - Context menu with Material Design
18
- - Extensible widget system
19
- - 100% OnPush change detection
13
+ - **Grid-based Drag & Drop**: Collision detection and boundary constraints
14
+ - **Resizable Cells**: Dynamic resizing with minimum size constraints
15
+ - **Dual-Mode Display**: Editor mode for configuration, viewer mode for presentation
16
+ - **NgRx Signals State Management**: Reactive state with normalized widget storage
17
+ - **Material Design 3 Integration**: Full MD3 compliance with theme tokens
18
+ - **Context Menu System**: Right-click operations with Material menu
19
+ - **Extensible Widget System**: Factory pattern for custom widget types
20
+ - **Performance Optimized**: 100% OnPush change detection strategy
21
+ - **Provider Pattern**: Extensible dialog and settings providers
20
22
 
21
- ## Usage
23
+ ## Requirements
24
+
25
+ - Angular 20.2.0+
26
+ - Angular Material 20.2.0+
27
+ - Angular CDK 20.2.0+
28
+
29
+ ## Basic Usage
22
30
 
23
31
  ```typescript
32
+ import { Component } from "@angular/core";
24
33
  import { DashboardComponent, createEmptyDashboard } from "@dragonworks/ngx-dashboard";
25
- import { provideNgxDashboard } from "@dragonworks/ngx-dashboard";
34
+ import type { DashboardData } from "@dragonworks/ngx-dashboard";
26
35
 
27
36
  @Component({
28
- template: ` <ngx-dashboard [dashboardData]="dashboard" [editMode]="true" (dashboardChange)="onDashboardChange($event)"> </ngx-dashboard> `,
37
+ selector: "app-dashboard-page",
38
+ standalone: true,
29
39
  imports: [DashboardComponent],
30
- providers: [provideNgxDashboard()],
40
+ template: ` <ngx-dashboard [dashboardData]="dashboard" [editMode]="true" (dashboardChange)="onDashboardChange($event)"> </ngx-dashboard> `,
31
41
  })
32
- export class MyComponent {
42
+ export class DashboardPageComponent {
33
43
  dashboard = createEmptyDashboard("my-dashboard", 12, 8);
44
+
45
+ onDashboardChange(data: DashboardData) {
46
+ // Handle dashboard updates
47
+ console.log("Dashboard changed:", data);
48
+ }
49
+ }
50
+ ```
51
+
52
+ ## Widget Registration
53
+
54
+ Register custom widgets with the `DashboardService`:
55
+
56
+ ```typescript
57
+ import { Injectable } from "@angular/core";
58
+ import { DashboardService } from "@dragonworks/ngx-dashboard";
59
+ import { MyCustomWidget } from "./widgets/my-custom-widget.component";
60
+
61
+ @Injectable({ providedIn: "root" })
62
+ export class WidgetSetupService {
63
+ constructor(private dashboardService: DashboardService) {
64
+ this.registerWidgets();
65
+ }
66
+
67
+ private registerWidgets() {
68
+ this.dashboardService.registerWidgetType(MyCustomWidget.metadata);
69
+ }
70
+ }
71
+ ```
72
+
73
+ ## Components
74
+
75
+ ### Main Components
76
+
77
+ - `DashboardComponent` - Main dashboard component with automatic mode switching
78
+ - `DashboardEditorComponent` - Editor mode with drag & drop
79
+ - `DashboardViewerComponent` - Viewer mode for presentation
80
+ - `WidgetListComponent` - Widget palette for drag & drop
81
+
82
+ ### Services
83
+
84
+ - `DashboardService` - Widget registration and management
85
+
86
+ ### Models & Utilities
87
+
88
+ - `createEmptyDashboard()` - Create new dashboard configuration
89
+ - `DashboardData` - Dashboard configuration interface
90
+ - `CellData` - Individual cell/widget data
91
+ - `WidgetMetadata` - Widget type definition
92
+
93
+ ### Widget State Management
94
+
95
+ Widgets can implement optional lifecycle methods:
96
+
97
+ ```typescript
98
+ export interface DashboardWidgetComponent {
99
+ dashboardGetState?(): unknown;
100
+ dashboardSetState?(state: unknown): void;
101
+ dashboardEditState?(): void;
34
102
  }
35
103
  ```
36
104
 
37
105
  ## Documentation
38
106
 
39
- See the [main repository](https://github.com/TobyBackstrom/ngx-dashboard) for full documentation and examples.
107
+ See the [main repository](https://github.com/TobyBackstrom/ngx-dashboard) for full documentation, examples, and demo application.
40
108
 
41
109
  ## License
42
110
 
@@ -2246,5 +2246,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImpor
2246
2246
  * Generated bundle index. Do not edit.
2247
2247
  */
2248
2248
 
2249
- export { CELL_SETTINGS_DIALOG_PROVIDER, CellIdUtils, CellSettingsDialogProvider, DEFAULT_RESERVED_SPACE, DashboardComponent, DashboardEditorComponent, DashboardService, DashboardViewerComponent, DefaultCellSettingsDialogProvider, WidgetIdUtils, WidgetListComponent, createDefaultDashboard, createEmptyDashboard, createFactoryFromComponent };
2249
+ export { CELL_SETTINGS_DIALOG_PROVIDER, CellSettingsDialogProvider, DashboardComponent, DashboardService, DefaultCellSettingsDialogProvider, WidgetListComponent, createDefaultDashboard, createEmptyDashboard };
2250
2250
  //# sourceMappingURL=dragonworks-ngx-dashboard.mjs.map