@dragonworks/ngx-dashboard 20.1.0 → 20.1.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.
Files changed (2) hide show
  1. package/README.md +115 -15
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -10,33 +10,133 @@ 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**: Advanced 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**: Modern 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
+ - **Dual-ID Architecture**: Separation of widget identity (WidgetId) from position (CellId)
22
+ - **Provider Pattern**: Extensible dialog and settings providers
20
23
 
21
- ## Usage
24
+ ## Requirements
25
+
26
+ - Angular 20.2.0+
27
+ - Angular Material 20.2.0+
28
+ - Angular CDK 20.2.0+
29
+
30
+ ## Basic Usage
22
31
 
23
32
  ```typescript
24
- import { DashboardComponent, createEmptyDashboard } from "@dragonworks/ngx-dashboard";
25
- import { provideNgxDashboard } from "@dragonworks/ngx-dashboard";
33
+ import { Component } from '@angular/core';
34
+ import { DashboardComponent, createEmptyDashboard } from '@dragonworks/ngx-dashboard';
35
+ import type { DashboardData } from '@dragonworks/ngx-dashboard';
26
36
 
27
37
  @Component({
28
- template: ` <ngx-dashboard [dashboardData]="dashboard" [editMode]="true" (dashboardChange)="onDashboardChange($event)"> </ngx-dashboard> `,
38
+ selector: 'app-dashboard-page',
39
+ standalone: true,
29
40
  imports: [DashboardComponent],
30
- providers: [provideNgxDashboard()],
41
+ template: `
42
+ <ngx-dashboard
43
+ [dashboardData]="dashboard"
44
+ [editMode]="true"
45
+ (dashboardChange)="onDashboardChange($event)">
46
+ </ngx-dashboard>
47
+ `
48
+ })
49
+ export class DashboardPageComponent {
50
+ dashboard = createEmptyDashboard('my-dashboard', 12, 8);
51
+
52
+ onDashboardChange(data: DashboardData) {
53
+ // Handle dashboard updates
54
+ console.log('Dashboard changed:', data);
55
+ }
56
+ }
57
+ ```
58
+
59
+ ## Widget Registration
60
+
61
+ Register custom widgets with the `DashboardService`:
62
+
63
+ ```typescript
64
+ import { Injectable } from '@angular/core';
65
+ import { DashboardService } from '@dragonworks/ngx-dashboard';
66
+ import { MyCustomWidget } from './widgets/my-custom-widget.component';
67
+
68
+ @Injectable({ providedIn: 'root' })
69
+ export class WidgetSetupService {
70
+ constructor(private dashboardService: DashboardService) {
71
+ this.registerWidgets();
72
+ }
73
+
74
+ private registerWidgets() {
75
+ this.dashboardService.registerWidgetType(MyCustomWidget.metadata);
76
+ }
77
+ }
78
+ ```
79
+
80
+ ## Components
81
+
82
+ ### Main Components
83
+
84
+ - `DashboardComponent` - Main dashboard component with automatic mode switching
85
+ - `DashboardEditorComponent` - Editor mode with drag & drop
86
+ - `DashboardViewerComponent` - Viewer mode for presentation
87
+ - `WidgetListComponent` - Widget palette for drag & drop
88
+
89
+ ### Services
90
+
91
+ - `DashboardService` - Widget registration and management
92
+
93
+ ### Models & Utilities
94
+
95
+ - `createEmptyDashboard()` - Create new dashboard configuration
96
+ - `DashboardData` - Dashboard configuration interface
97
+ - `CellData` - Individual cell/widget data
98
+ - `WidgetMetadata` - Widget type definition
99
+
100
+ ## Advanced Features
101
+
102
+ ### Custom Settings Dialog Provider
103
+
104
+ ```typescript
105
+ import { CELL_SETTINGS_DIALOG_PROVIDER, DefaultCellSettingsDialogProvider } from '@dragonworks/ngx-dashboard';
106
+
107
+ @Component({
108
+ providers: [
109
+ {
110
+ provide: CELL_SETTINGS_DIALOG_PROVIDER,
111
+ useClass: DefaultCellSettingsDialogProvider
112
+ }
113
+ ]
31
114
  })
32
- export class MyComponent {
33
- dashboard = createEmptyDashboard("my-dashboard", 12, 8);
115
+ ```
116
+
117
+ ### Widget State Management
118
+
119
+ Widgets can implement optional lifecycle methods:
120
+
121
+ ```typescript
122
+ export interface DashboardWidgetComponent {
123
+ dashboardGetState?(): unknown;
124
+ dashboardSetState?(state: unknown): void;
125
+ dashboardEditState?(): void;
34
126
  }
35
127
  ```
36
128
 
129
+ ## Architecture Highlights
130
+
131
+ - **NgRx Signals Store**: Feature-based state management with normalized widget storage
132
+ - **Signal-based Architecture**: Modern Angular signals throughout
133
+ - **Material Design 3**: Complete MD3 compliance with design tokens
134
+ - **Performance First**: OnPush change detection, computed signals, memoization
135
+ - **TypeScript Strict Mode**: Full type safety (no `any` types in public API)
136
+
37
137
  ## Documentation
38
138
 
39
- See the [main repository](https://github.com/TobyBackstrom/ngx-dashboard) for full documentation and examples.
139
+ See the [main repository](https://github.com/TobyBackstrom/ngx-dashboard) for full documentation, examples, and demo application.
40
140
 
41
141
  ## License
42
142
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dragonworks/ngx-dashboard",
3
- "version": "20.1.0",
3
+ "version": "20.1.2",
4
4
  "description": "Angular library for building drag-and-drop grid dashboards with resizable cells and customizable widgets",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^20.2.0",