@dragonworks/ngx-dashboard-widgets 20.1.2 → 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
@@ -1,6 +1,7 @@
1
1
  # @dragonworks/ngx-dashboard-widgets
2
2
 
3
- Comprehensive widget collection for ngx-dashboard with Material Design 3 compliance and advanced features.
3
+ Example widget collection for ngx-dashboard with Material Design 3 compliance and advanced features.
4
+ You can use these widgets as inspiration or as a base for your own implementations.
4
5
 
5
6
  ## Installation
6
7
 
@@ -13,38 +14,42 @@ npm install @dragonworks/ngx-dashboard-widgets @dragonworks/ngx-dashboard
13
14
  - Angular 20.2.0+
14
15
  - @dragonworks/ngx-dashboard 20.0.0+
15
16
 
16
- ## Included Widgets
17
+ ## Included Example Widgets
17
18
 
18
19
  ### ArrowWidget
20
+
19
21
  - **Directional indicators** with 360° rotation control
20
22
  - **Configurable appearance**: Size, color, rotation angle
21
23
  - **Material Design icons** with currentColor theme support
22
24
  - **Settings dialog** for interactive configuration
23
25
 
24
26
  ### LabelWidget
27
+
25
28
  - **Text display** with rich formatting options
26
29
  - **Responsive sizing** with alignment controls
27
30
  - **Background customization** with theme-aware colors
28
31
  - **Font size controls** with min/max constraints
29
32
 
30
33
  ### ClockWidget
34
+
31
35
  - **Dual-mode display**: Analog and digital formats
32
36
  - **Real-time updates** with automatic timer management
33
37
  - **Configurable formats**: 12h/24h time, seconds display
34
38
  - **Component composition**: Separate analog/digital components
35
- - **MD3 theming** with background toggle
36
39
 
37
40
  ### RadialGaugeWidget
41
+
38
42
  - **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
43
+ - **Responsive text rendering**: SVG-native with BBox scaling
41
44
  - **Theme integration** with MD3 color tokens
42
45
  - **Performance optimized** with signal-based updates
43
46
 
44
47
  ## Components & Utilities
45
48
 
46
49
  ### RadialGaugeComponent
47
- Standalone high-performance SVG gauge component:
50
+
51
+ Standalone SVG gauge component:
52
+
48
53
  - **Dynamic sizing** with ResizeObserver integration
49
54
  - **Mathematical positioning** using computed transforms
50
55
  - **Reference text system** for consistent measurements
@@ -52,7 +57,9 @@ Standalone high-performance SVG gauge component:
52
57
  - **Accessibility features** with ARIA attributes
53
58
 
54
59
  ### ResponsiveTextDirective
55
- Canvas-optimized text sizing directive:
60
+
61
+ Text sizing directive:
62
+
56
63
  - **Automatic font scaling** to fit container
57
64
  - **Performance optimized** with canvas measurement
58
65
  - **Developer-friendly API**: minFontSize/maxFontSize inputs
@@ -63,51 +70,38 @@ Canvas-optimized text sizing directive:
63
70
  ### Basic Widget Registration
64
71
 
65
72
  ```typescript
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
- }
80
-
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);
87
- }
88
- }
73
+ // app.config.ts - Register widgets on startup
74
+ export const appConfig: ApplicationConfig = {
75
+ providers: [
76
+ provideBrowserGlobalErrorListeners(),
77
+ provideZoneChangeDetection({ eventCoalescing: true }),
78
+ provideRouter(routes),
79
+ provideHttpClient(),
80
+ provideEnvironmentInitializer(() => {
81
+ const dashboardService = inject(DashboardService);
82
+ dashboardService.registerWidgetType(ArrowWidgetComponent);
83
+ dashboardService.registerWidgetType(LabelWidgetComponent);
84
+ dashboardService.registerWidgetType(ClockWidgetComponent);
85
+ dashboardService.registerWidgetType(RadialGaugeWidgetComponent);
86
+ dashboardService.registerWidgetType(RealtimeGaugeWidgetComponent);
87
+ dashboardService.registerWidgetType(SparklineWidgetComponent);
88
+ dashboardService.registerWidgetType(SparkbarWidgetComponent);
89
+ }),
90
+ ],
91
+ };
89
92
  ```
90
93
 
91
94
  ### Using RadialGaugeComponent Standalone
92
95
 
93
96
  ```typescript
94
- import { Component } from '@angular/core';
95
- import { RadialGaugeComponent } from '@dragonworks/ngx-dashboard-widgets';
97
+ import { Component } from "@angular/core";
98
+ import { RadialGaugeComponent } from "@dragonworks/ngx-dashboard-widgets";
96
99
 
97
100
  @Component({
98
- selector: 'app-metrics',
101
+ selector: "app-metrics",
99
102
  standalone: true,
100
103
  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
- `
104
+ template: ` <ngx-dashboard-radial-gauge [value]="cpuUsage" [minValue]="0" [maxValue]="100" [label]="'CPU Usage'" [unit]="'%'" [showValueLabel]="true"> </ngx-dashboard-radial-gauge> `,
111
105
  })
112
106
  export class MetricsComponent {
113
107
  cpuUsage = 75;
@@ -117,23 +111,18 @@ export class MetricsComponent {
117
111
  ### Using ResponsiveText Directive
118
112
 
119
113
  ```typescript
120
- import { Component } from '@angular/core';
121
- import { ResponsiveTextDirective } from '@dragonworks/ngx-dashboard-widgets';
114
+ import { Component } from "@angular/core";
115
+ import { ResponsiveTextDirective } from "@dragonworks/ngx-dashboard-widgets";
122
116
 
123
117
  @Component({
124
- selector: 'app-display',
118
+ selector: "app-display",
125
119
  standalone: true,
126
120
  imports: [ResponsiveTextDirective],
127
121
  template: `
128
122
  <div class="container">
129
- <span
130
- ngxDashboardResponsiveText
131
- [minFontSize]="12"
132
- [maxFontSize]="48">
133
- Responsive Text
134
- </span>
123
+ <span ngxDashboardResponsiveText [minFontSize]="12" [maxFontSize]="48"> Responsive Text </span>
135
124
  </div>
136
- `
125
+ `,
137
126
  })
138
127
  export class DisplayComponent {}
139
128
  ```
@@ -141,8 +130,8 @@ export class DisplayComponent {}
141
130
  ## Creating Custom Widgets
142
131
 
143
132
  ```typescript
144
- import { Component, signal } from '@angular/core';
145
- import { Widget, WidgetMetadata } from '@dragonworks/ngx-dashboard';
133
+ import { Component, signal } from "@angular/core";
134
+ import { Widget, WidgetMetadata } from "@dragonworks/ngx-dashboard";
146
135
 
147
136
  interface MyWidgetState {
148
137
  text: string;
@@ -150,29 +139,29 @@ interface MyWidgetState {
150
139
  }
151
140
 
152
141
  @Component({
153
- selector: 'my-custom-widget',
142
+ selector: "my-custom-widget",
154
143
  standalone: true,
155
144
  template: `
156
145
  <div [style.color]="state().color">
157
146
  {{ state().text }}
158
147
  </div>
159
148
  `,
160
- styleUrl: './my-custom-widget.component.scss'
149
+ styleUrl: "./my-custom-widget.component.scss",
161
150
  })
162
151
  export class MyCustomWidgetComponent implements Widget {
163
152
  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
153
+ widgetTypeid: "@myapp/my-custom-widget",
154
+ name: "My Custom Widget",
155
+ description: "A custom widget example",
156
+ svgIcon: "<svg>...</svg>", // Your SVG icon
168
157
  };
169
158
 
170
159
  state = signal<MyWidgetState>({
171
- text: 'Hello World',
172
- color: 'var(--mat-sys-primary)'
160
+ text: "Hello World",
161
+ color: "var(--mat-sys-primary)",
173
162
  });
174
163
 
175
- // Optional: Implement widget lifecycle methods
164
+ // Optional: Implement widget state methods
176
165
  dashboardGetState(): MyWidgetState {
177
166
  return this.state();
178
167
  }
@@ -189,23 +178,12 @@ export class MyCustomWidgetComponent implements Widget {
189
178
  }
190
179
  ```
191
180
 
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
181
  ## Design Patterns
203
182
 
204
- - **Dual-Mode Display**: Widgets support passive (icon) and active (component) modes
205
183
  - **Settings Dialogs**: Each widget includes MD3-compliant configuration dialogs
206
184
  - **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
185
+ - **State Management**: Signal-based state with lifecycle handling
186
+ - **SVG Rendering**: Vector graphics with currentColor support
209
187
 
210
188
  ## Documentation
211
189
 
@@ -2242,6 +2242,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImpor
2242
2242
  /*
2243
2243
  * Public API Surface of ngx-dashboard-widgets
2244
2244
  */
2245
+ // Widget Components
2245
2246
 
2246
2247
  /**
2247
2248
  * Generated bundle index. Do not edit.