@dragonworks/ngx-dashboard-widgets 20.1.1 → 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.
- package/README.md +180 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @dragonworks/ngx-dashboard-widgets
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Comprehensive widget collection for ngx-dashboard with Material Design 3 compliance and advanced features.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -8,50 +8,208 @@ Widget collection for ngx-dashboard with Material Design 3 compliance.
|
|
|
8
8
|
npm install @dragonworks/ngx-dashboard-widgets @dragonworks/ngx-dashboard
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
- Angular 20.2.0+
|
|
14
|
+
- @dragonworks/ngx-dashboard 20.0.0+
|
|
15
|
+
|
|
11
16
|
## Included Widgets
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
- **
|
|
18
|
+
### ArrowWidget
|
|
19
|
+
- **Directional indicators** with 360° rotation control
|
|
20
|
+
- **Configurable appearance**: Size, color, rotation angle
|
|
21
|
+
- **Material Design icons** with currentColor theme support
|
|
22
|
+
- **Settings dialog** for interactive configuration
|
|
23
|
+
|
|
24
|
+
### LabelWidget
|
|
25
|
+
- **Text display** with rich formatting options
|
|
26
|
+
- **Responsive sizing** with alignment controls
|
|
27
|
+
- **Background customization** with theme-aware colors
|
|
28
|
+
- **Font size controls** with min/max constraints
|
|
29
|
+
|
|
30
|
+
### ClockWidget
|
|
31
|
+
- **Dual-mode display**: Analog and digital formats
|
|
32
|
+
- **Real-time updates** with automatic timer management
|
|
33
|
+
- **Configurable formats**: 12h/24h time, seconds display
|
|
34
|
+
- **Component composition**: Separate analog/digital components
|
|
35
|
+
- **MD3 theming** with background toggle
|
|
36
|
+
|
|
37
|
+
### RadialGaugeWidget
|
|
38
|
+
- **Semi-circular gauge** for value visualization
|
|
39
|
+
- **Dual-mode system**: Passive (SVG icon) and active (component) display
|
|
40
|
+
- **Sophisticated text rendering**: SVG-native with BBox scaling
|
|
41
|
+
- **Theme integration** with MD3 color tokens
|
|
42
|
+
- **Performance optimized** with signal-based updates
|
|
43
|
+
|
|
44
|
+
## Components & Utilities
|
|
45
|
+
|
|
46
|
+
### RadialGaugeComponent
|
|
47
|
+
Standalone high-performance SVG gauge component:
|
|
48
|
+
- **Dynamic sizing** with ResizeObserver integration
|
|
49
|
+
- **Mathematical positioning** using computed transforms
|
|
50
|
+
- **Reference text system** for consistent measurements
|
|
51
|
+
- **Configurable display**: Value labels, legends, colors
|
|
52
|
+
- **Accessibility features** with ARIA attributes
|
|
53
|
+
|
|
54
|
+
### ResponsiveTextDirective
|
|
55
|
+
Canvas-optimized text sizing directive:
|
|
56
|
+
- **Automatic font scaling** to fit container
|
|
57
|
+
- **Performance optimized** with canvas measurement
|
|
58
|
+
- **Developer-friendly API**: minFontSize/maxFontSize inputs
|
|
59
|
+
- **Ellipsis-free design** for clean appearance
|
|
17
60
|
|
|
18
61
|
## Usage
|
|
19
62
|
|
|
63
|
+
### Basic Widget Registration
|
|
64
|
+
|
|
20
65
|
```typescript
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
66
|
+
import { Injectable } from '@angular/core';
|
|
67
|
+
import { DashboardService } from '@dragonworks/ngx-dashboard';
|
|
68
|
+
import {
|
|
69
|
+
ArrowWidgetComponent,
|
|
70
|
+
LabelWidgetComponent,
|
|
71
|
+
ClockWidgetComponent,
|
|
72
|
+
RadialGaugeWidgetComponent
|
|
73
|
+
} from '@dragonworks/ngx-dashboard-widgets';
|
|
74
|
+
|
|
75
|
+
@Injectable({ providedIn: 'root' })
|
|
76
|
+
export class WidgetRegistrationService {
|
|
77
|
+
constructor(private dashboardService: DashboardService) {
|
|
78
|
+
this.registerWidgets();
|
|
79
|
+
}
|
|
23
80
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
dashboardService.registerWidgetType(
|
|
81
|
+
private registerWidgets() {
|
|
82
|
+
// Register all widgets
|
|
83
|
+
this.dashboardService.registerWidgetType(ArrowWidgetComponent.metadata);
|
|
84
|
+
this.dashboardService.registerWidgetType(LabelWidgetComponent.metadata);
|
|
85
|
+
this.dashboardService.registerWidgetType(ClockWidgetComponent.metadata);
|
|
86
|
+
this.dashboardService.registerWidgetType(RadialGaugeWidgetComponent.metadata);
|
|
28
87
|
}
|
|
29
88
|
}
|
|
30
89
|
```
|
|
31
90
|
|
|
91
|
+
### Using RadialGaugeComponent Standalone
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { Component } from '@angular/core';
|
|
95
|
+
import { RadialGaugeComponent } from '@dragonworks/ngx-dashboard-widgets';
|
|
96
|
+
|
|
97
|
+
@Component({
|
|
98
|
+
selector: 'app-metrics',
|
|
99
|
+
standalone: true,
|
|
100
|
+
imports: [RadialGaugeComponent],
|
|
101
|
+
template: `
|
|
102
|
+
<ngx-dashboard-radial-gauge
|
|
103
|
+
[value]="cpuUsage"
|
|
104
|
+
[minValue]="0"
|
|
105
|
+
[maxValue]="100"
|
|
106
|
+
[label]="'CPU Usage'"
|
|
107
|
+
[unit]="'%'"
|
|
108
|
+
[showValueLabel]="true">
|
|
109
|
+
</ngx-dashboard-radial-gauge>
|
|
110
|
+
`
|
|
111
|
+
})
|
|
112
|
+
export class MetricsComponent {
|
|
113
|
+
cpuUsage = 75;
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Using ResponsiveText Directive
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
import { Component } from '@angular/core';
|
|
121
|
+
import { ResponsiveTextDirective } from '@dragonworks/ngx-dashboard-widgets';
|
|
122
|
+
|
|
123
|
+
@Component({
|
|
124
|
+
selector: 'app-display',
|
|
125
|
+
standalone: true,
|
|
126
|
+
imports: [ResponsiveTextDirective],
|
|
127
|
+
template: `
|
|
128
|
+
<div class="container">
|
|
129
|
+
<span
|
|
130
|
+
ngxDashboardResponsiveText
|
|
131
|
+
[minFontSize]="12"
|
|
132
|
+
[maxFontSize]="48">
|
|
133
|
+
Responsive Text
|
|
134
|
+
</span>
|
|
135
|
+
</div>
|
|
136
|
+
`
|
|
137
|
+
})
|
|
138
|
+
export class DisplayComponent {}
|
|
139
|
+
```
|
|
140
|
+
|
|
32
141
|
## Creating Custom Widgets
|
|
33
142
|
|
|
34
143
|
```typescript
|
|
144
|
+
import { Component, signal } from '@angular/core';
|
|
145
|
+
import { Widget, WidgetMetadata } from '@dragonworks/ngx-dashboard';
|
|
146
|
+
|
|
147
|
+
interface MyWidgetState {
|
|
148
|
+
text: string;
|
|
149
|
+
color: string;
|
|
150
|
+
}
|
|
151
|
+
|
|
35
152
|
@Component({
|
|
36
|
-
selector:
|
|
37
|
-
template: `<div>{{ state?.text }}</div>`,
|
|
153
|
+
selector: 'my-custom-widget',
|
|
38
154
|
standalone: true,
|
|
155
|
+
template: `
|
|
156
|
+
<div [style.color]="state().color">
|
|
157
|
+
{{ state().text }}
|
|
158
|
+
</div>
|
|
159
|
+
`,
|
|
160
|
+
styleUrl: './my-custom-widget.component.scss'
|
|
39
161
|
})
|
|
40
|
-
export class
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
iconName: "star",
|
|
47
|
-
description: "Custom widget example",
|
|
162
|
+
export class MyCustomWidgetComponent implements Widget {
|
|
163
|
+
static readonly metadata: WidgetMetadata = {
|
|
164
|
+
widgetTypeid: '@myapp/my-custom-widget',
|
|
165
|
+
name: 'My Custom Widget',
|
|
166
|
+
description: 'A custom widget example',
|
|
167
|
+
svgIcon: '<svg>...</svg>' // Your SVG icon
|
|
48
168
|
};
|
|
169
|
+
|
|
170
|
+
state = signal<MyWidgetState>({
|
|
171
|
+
text: 'Hello World',
|
|
172
|
+
color: 'var(--mat-sys-primary)'
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// Optional: Implement widget lifecycle methods
|
|
176
|
+
dashboardGetState(): MyWidgetState {
|
|
177
|
+
return this.state();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
dashboardSetState(state?: unknown): void {
|
|
181
|
+
if (state) {
|
|
182
|
+
this.state.set(state as MyWidgetState);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
dashboardEditState(): void {
|
|
187
|
+
// Open settings dialog
|
|
188
|
+
}
|
|
49
189
|
}
|
|
50
190
|
```
|
|
51
191
|
|
|
192
|
+
## Architecture Highlights
|
|
193
|
+
|
|
194
|
+
- **Material Design 3**: Full compliance with MD3 design tokens and theming
|
|
195
|
+
- **Signal-based Architecture**: Modern Angular signals throughout
|
|
196
|
+
- **Component Composition**: Reusable sub-components for complex widgets
|
|
197
|
+
- **Performance Optimized**: OnPush change detection, canvas measurements
|
|
198
|
+
- **TypeScript Strict**: Full type safety with no `any` types
|
|
199
|
+
- **Standalone Components**: All components are standalone (Angular 20+)
|
|
200
|
+
- **Theme Integration**: Seamless light/dark mode support
|
|
201
|
+
|
|
202
|
+
## Design Patterns
|
|
203
|
+
|
|
204
|
+
- **Dual-Mode Display**: Widgets support passive (icon) and active (component) modes
|
|
205
|
+
- **Settings Dialogs**: Each widget includes MD3-compliant configuration dialogs
|
|
206
|
+
- **Responsive Sizing**: All widgets adapt to container dimensions
|
|
207
|
+
- **State Management**: Signal-based state with proper lifecycle handling
|
|
208
|
+
- **SVG Rendering**: High-quality vector graphics with currentColor support
|
|
209
|
+
|
|
52
210
|
## Documentation
|
|
53
211
|
|
|
54
|
-
See the [main repository](https://github.com/TobyBackstrom/ngx-dashboard) for
|
|
212
|
+
See the [main repository](https://github.com/TobyBackstrom/ngx-dashboard) for complete documentation, examples, and demo application.
|
|
55
213
|
|
|
56
214
|
## License
|
|
57
215
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dragonworks/ngx-dashboard-widgets",
|
|
3
|
-
"version": "20.1.
|
|
3
|
+
"version": "20.1.2",
|
|
4
4
|
"description": "Widget collection for ngx-dashboard with Material Design 3 compliance including arrow, label, clock widgets and responsive text directive",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/common": "^20.2.0",
|