@dragonworks/ngx-dashboard 20.0.0
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 +63 -0
- package/fesm2022/dragonworks-ngx-dashboard.mjs +2192 -0
- package/fesm2022/dragonworks-ngx-dashboard.mjs.map +1 -0
- package/index.d.ts +678 -0
- package/package.json +25 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
import * as _dragonworks_ngx_dashboard from '@dragonworks/ngx-dashboard';
|
|
2
|
+
import * as _ngrx_signals from '@ngrx/signals';
|
|
3
|
+
import * as _angular_core from '@angular/core';
|
|
4
|
+
import { Type, ViewContainerRef, ComponentRef, OnChanges, SimpleChanges, ElementRef, InjectionToken } from '@angular/core';
|
|
5
|
+
import { SafeHtml } from '@angular/platform-browser';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Branded type for cell identifiers to ensure type safety when working with grid coordinates.
|
|
9
|
+
* This prevents accidentally mixing up row/column numbers with cell IDs.
|
|
10
|
+
*/
|
|
11
|
+
type CellId = number & {
|
|
12
|
+
__brand: 'CellId';
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Utility functions for working with CellId branded type.
|
|
16
|
+
*/
|
|
17
|
+
declare const CellIdUtils: {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a CellId from row and column coordinates.
|
|
20
|
+
* @param row - The row number (1-based)
|
|
21
|
+
* @param col - The column number (1-based)
|
|
22
|
+
* @returns A branded CellId that encodes both coordinates
|
|
23
|
+
* @throws Error if row or col is less than 1, or if col exceeds MAX_COLUMNS
|
|
24
|
+
*/
|
|
25
|
+
create(row: number, col: number): CellId;
|
|
26
|
+
/**
|
|
27
|
+
* Decodes a CellId back into row and column coordinates.
|
|
28
|
+
* @param cellId - The CellId to decode
|
|
29
|
+
* @returns A tuple of [row, col] coordinates (1-based)
|
|
30
|
+
*/
|
|
31
|
+
decode(cellId: CellId): [number, number];
|
|
32
|
+
/**
|
|
33
|
+
* Gets the row coordinate from a CellId.
|
|
34
|
+
* @param cellId - The CellId to extract row from
|
|
35
|
+
* @returns The row number (1-based)
|
|
36
|
+
*/
|
|
37
|
+
getRow(cellId: CellId): number;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the column coordinate from a CellId.
|
|
40
|
+
* @param cellId - The CellId to extract column from
|
|
41
|
+
* @returns The column number (1-based)
|
|
42
|
+
*/
|
|
43
|
+
getCol(cellId: CellId): number;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a string representation of a CellId for debugging/display purposes.
|
|
46
|
+
* @param cellId - The CellId to convert to string
|
|
47
|
+
* @returns A string in the format "row-col"
|
|
48
|
+
*/
|
|
49
|
+
toString(cellId: CellId): string;
|
|
50
|
+
/**
|
|
51
|
+
* Checks if two CellIds are equal.
|
|
52
|
+
* @param a - First CellId
|
|
53
|
+
* @param b - Second CellId
|
|
54
|
+
* @returns True if the CellIds represent the same cell
|
|
55
|
+
*/
|
|
56
|
+
equals(a: CellId, b: CellId): boolean;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
interface Widget {
|
|
60
|
+
dashboardGetState?(): unknown;
|
|
61
|
+
dashboardSetState?(state?: unknown): void;
|
|
62
|
+
dashboardEditState?(): void;
|
|
63
|
+
}
|
|
64
|
+
interface WidgetMetadata {
|
|
65
|
+
widgetTypeid: string;
|
|
66
|
+
name: string;
|
|
67
|
+
description: string;
|
|
68
|
+
svgIcon: string;
|
|
69
|
+
}
|
|
70
|
+
interface WidgetComponentClass<T extends Widget = Widget> extends Type<T> {
|
|
71
|
+
metadata: WidgetMetadata;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface WidgetFactory<T extends Widget = Widget> {
|
|
75
|
+
widgetTypeid: string;
|
|
76
|
+
name: string;
|
|
77
|
+
description: string;
|
|
78
|
+
svgIcon: string;
|
|
79
|
+
createInstance(container: ViewContainerRef, state?: unknown): ComponentRef<T>;
|
|
80
|
+
}
|
|
81
|
+
declare function createFactoryFromComponent<T extends Widget>(component: WidgetComponentClass<T>): WidgetFactory;
|
|
82
|
+
|
|
83
|
+
interface CellPosition {
|
|
84
|
+
row: number;
|
|
85
|
+
col: number;
|
|
86
|
+
rowSpan: number;
|
|
87
|
+
colSpan: number;
|
|
88
|
+
}
|
|
89
|
+
interface CellComponentPosition extends CellPosition {
|
|
90
|
+
cellId: CellId;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface CellData extends CellPosition {
|
|
94
|
+
cellId: CellId;
|
|
95
|
+
flat?: boolean;
|
|
96
|
+
widgetFactory: WidgetFactory;
|
|
97
|
+
widgetState: unknown;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Data structure for cell display settings
|
|
102
|
+
*/
|
|
103
|
+
interface CellDisplayData {
|
|
104
|
+
id: string;
|
|
105
|
+
flat: boolean | undefined;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Serializable data format for dashboard export/import functionality.
|
|
110
|
+
* This format can be safely converted to/from JSON for persistence.
|
|
111
|
+
* Corresponds to the persistent state from the dashboard store features.
|
|
112
|
+
*/
|
|
113
|
+
interface DashboardDataDto {
|
|
114
|
+
/** Version for future compatibility and migration support */
|
|
115
|
+
version: string;
|
|
116
|
+
/** Unique dashboard identifier managed by the client */
|
|
117
|
+
dashboardId: string;
|
|
118
|
+
/** Grid dimensions */
|
|
119
|
+
rows: number;
|
|
120
|
+
columns: number;
|
|
121
|
+
gutterSize: string;
|
|
122
|
+
/** Array of serializable cell data */
|
|
123
|
+
cells: CellDataDto[];
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Serializable version of CellData that can be safely JSON stringified.
|
|
127
|
+
* Converts non-serializable types (CellId, WidgetFactory) to serializable equivalents.
|
|
128
|
+
*/
|
|
129
|
+
interface CellDataDto {
|
|
130
|
+
/** Grid position */
|
|
131
|
+
row: number;
|
|
132
|
+
col: number;
|
|
133
|
+
/** Cell span */
|
|
134
|
+
rowSpan: number;
|
|
135
|
+
colSpan: number;
|
|
136
|
+
/** Display settings */
|
|
137
|
+
flat?: boolean;
|
|
138
|
+
/** Widget type identifier for factory lookup during import */
|
|
139
|
+
widgetTypeid: string;
|
|
140
|
+
/** Raw widget state (must be JSON serializable) */
|
|
141
|
+
widgetState: unknown;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Creates an empty dashboard configuration with the specified dimensions.
|
|
146
|
+
* This is a convenience function for creating a basic dashboard without any cells.
|
|
147
|
+
*
|
|
148
|
+
* @param dashboardId - Unique identifier for the dashboard (managed by client)
|
|
149
|
+
* @param rows - Number of rows in the dashboard grid
|
|
150
|
+
* @param columns - Number of columns in the dashboard grid
|
|
151
|
+
* @param gutterSize - CSS size for the gutter between cells (default: '0.5em')
|
|
152
|
+
* @returns A DashboardDataDto configured with the specified dimensions and no cells
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* // Create an 8x16 dashboard with default gutter
|
|
156
|
+
* const dashboard = createEmptyDashboard('my-dashboard-1', 8, 16);
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* // Create a 5x10 dashboard with custom gutter
|
|
160
|
+
* const dashboard = createEmptyDashboard('my-dashboard-2', 5, 10, '0.5rem');
|
|
161
|
+
*/
|
|
162
|
+
declare function createEmptyDashboard(dashboardId: string, rows: number, columns: number, gutterSize?: string): DashboardDataDto;
|
|
163
|
+
/**
|
|
164
|
+
* Creates a default dashboard configuration with standard dimensions.
|
|
165
|
+
* This provides a reasonable starting point for most use cases.
|
|
166
|
+
*
|
|
167
|
+
* @param dashboardId - Unique identifier for the dashboard (managed by client)
|
|
168
|
+
* @returns A DashboardDataDto with 8 rows, 16 columns, and 0.5em gutter
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* const dashboard = createDefaultDashboard('my-dashboard-id');
|
|
172
|
+
*/
|
|
173
|
+
declare function createDefaultDashboard(dashboardId: string): DashboardDataDto;
|
|
174
|
+
|
|
175
|
+
type DragData = {
|
|
176
|
+
kind: 'cell';
|
|
177
|
+
content: CellComponentPosition;
|
|
178
|
+
} | {
|
|
179
|
+
kind: 'widget';
|
|
180
|
+
content: WidgetMetadata;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Defines space that should be reserved around the dashboard component
|
|
185
|
+
* when calculating viewport constraints.
|
|
186
|
+
*/
|
|
187
|
+
interface ReservedSpace {
|
|
188
|
+
/** Space reserved at the top (e.g., toolbar height) */
|
|
189
|
+
top: number;
|
|
190
|
+
/** Space reserved on the right (e.g., padding, widget list) */
|
|
191
|
+
right: number;
|
|
192
|
+
/** Space reserved at the bottom (e.g., padding) */
|
|
193
|
+
bottom: number;
|
|
194
|
+
/** Space reserved on the left (e.g., padding) */
|
|
195
|
+
left: number;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Default reserved space when none is specified
|
|
199
|
+
*/
|
|
200
|
+
declare const DEFAULT_RESERVED_SPACE: ReservedSpace;
|
|
201
|
+
|
|
202
|
+
interface ResizeData {
|
|
203
|
+
cellId: CellId;
|
|
204
|
+
originalRowSpan: number;
|
|
205
|
+
originalColSpan: number;
|
|
206
|
+
previewRowSpan: number;
|
|
207
|
+
previewColSpan: number;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
interface ViewportSize {
|
|
211
|
+
width: number;
|
|
212
|
+
height: number;
|
|
213
|
+
}
|
|
214
|
+
interface DashboardConstraints {
|
|
215
|
+
maxWidth: number;
|
|
216
|
+
maxHeight: number;
|
|
217
|
+
constrainedBy: 'width' | 'height' | 'none';
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Internal component-scoped service that provides viewport-aware constraints for a single dashboard.
|
|
221
|
+
* Each dashboard component gets its own instance of this service.
|
|
222
|
+
*
|
|
223
|
+
* This service is NOT part of the public API and should remain internal to the library.
|
|
224
|
+
*/
|
|
225
|
+
declare class DashboardViewportService {
|
|
226
|
+
private readonly platformId;
|
|
227
|
+
private readonly destroyRef;
|
|
228
|
+
private readonly store;
|
|
229
|
+
private readonly viewportSize;
|
|
230
|
+
private readonly reservedSpace;
|
|
231
|
+
private resizeObserver;
|
|
232
|
+
constructor();
|
|
233
|
+
/**
|
|
234
|
+
* Initialize viewport size tracking using ResizeObserver on the window
|
|
235
|
+
*/
|
|
236
|
+
private initializeViewportTracking;
|
|
237
|
+
/**
|
|
238
|
+
* Set reserved space that should be excluded from dashboard calculations
|
|
239
|
+
* (e.g., toolbar height, widget list width, padding)
|
|
240
|
+
*/
|
|
241
|
+
setReservedSpace(space: ReservedSpace): void;
|
|
242
|
+
/**
|
|
243
|
+
* Get current viewport size
|
|
244
|
+
*/
|
|
245
|
+
readonly currentViewportSize: _angular_core.Signal<ViewportSize>;
|
|
246
|
+
/**
|
|
247
|
+
* Get current reserved space
|
|
248
|
+
*/
|
|
249
|
+
readonly currentReservedSpace: _angular_core.Signal<ReservedSpace>;
|
|
250
|
+
/**
|
|
251
|
+
* Calculate available space for dashboard after accounting for reserved areas
|
|
252
|
+
*/
|
|
253
|
+
readonly availableSpace: _angular_core.Signal<ViewportSize>;
|
|
254
|
+
/**
|
|
255
|
+
* Calculate dashboard constraints for this dashboard instance
|
|
256
|
+
*/
|
|
257
|
+
readonly constraints: _angular_core.Signal<DashboardConstraints>;
|
|
258
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DashboardViewportService, never>;
|
|
259
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<DashboardViewportService>;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
declare class DashboardComponent implements OnChanges {
|
|
263
|
+
#private;
|
|
264
|
+
protected readonly store: {
|
|
265
|
+
dashboardId: _angular_core.Signal<string>;
|
|
266
|
+
rows: _angular_core.Signal<number>;
|
|
267
|
+
columns: _angular_core.Signal<number>;
|
|
268
|
+
gutterSize: _angular_core.Signal<string>;
|
|
269
|
+
isEditMode: _angular_core.Signal<boolean>;
|
|
270
|
+
gridCellDimensions: _ngrx_signals.DeepSignal<{
|
|
271
|
+
width: number;
|
|
272
|
+
height: number;
|
|
273
|
+
}>;
|
|
274
|
+
cellsById: _angular_core.Signal<Record<string, _dragonworks_ngx_dashboard.CellData>>;
|
|
275
|
+
resizeData: _angular_core.Signal<ResizeData | null>;
|
|
276
|
+
dragData: _angular_core.Signal<_dragonworks_ngx_dashboard.DragData | null>;
|
|
277
|
+
hoveredDropZone: _angular_core.Signal<{
|
|
278
|
+
row: number;
|
|
279
|
+
col: number;
|
|
280
|
+
} | null>;
|
|
281
|
+
dashboardService: _dragonworks_ngx_dashboard.DashboardService;
|
|
282
|
+
cells: _angular_core.Signal<_dragonworks_ngx_dashboard.CellData[]>;
|
|
283
|
+
highlightedZones: _angular_core.Signal<{
|
|
284
|
+
row: number;
|
|
285
|
+
col: number;
|
|
286
|
+
}[]>;
|
|
287
|
+
highlightMap: _angular_core.Signal<Set<_dragonworks_ngx_dashboard.CellId>>;
|
|
288
|
+
invalidHighlightMap: _angular_core.Signal<Set<_dragonworks_ngx_dashboard.CellId>>;
|
|
289
|
+
isValidPlacement: _angular_core.Signal<boolean>;
|
|
290
|
+
resizePreviewCells: _angular_core.Signal<{
|
|
291
|
+
row: number;
|
|
292
|
+
col: number;
|
|
293
|
+
}[]>;
|
|
294
|
+
resizePreviewMap: _angular_core.Signal<Set<_dragonworks_ngx_dashboard.CellId>>;
|
|
295
|
+
setGridConfig: (config: {
|
|
296
|
+
rows?: number;
|
|
297
|
+
columns?: number;
|
|
298
|
+
gutterSize?: string;
|
|
299
|
+
}) => void;
|
|
300
|
+
setGridCellDimensions: (width: number, height: number) => void;
|
|
301
|
+
toggleEditMode: () => void;
|
|
302
|
+
setEditMode: (isEditMode: boolean) => void;
|
|
303
|
+
addWidget: (cell: _dragonworks_ngx_dashboard.CellData) => void;
|
|
304
|
+
removeWidget: (cellId: _dragonworks_ngx_dashboard.CellId) => void;
|
|
305
|
+
updateWidgetPosition: (cellId: _dragonworks_ngx_dashboard.CellId, row: number, col: number) => void;
|
|
306
|
+
createWidget: (row: number, col: number, widgetFactory: _dragonworks_ngx_dashboard.WidgetFactory, widgetState?: string) => void;
|
|
307
|
+
updateCellSettings: (id: _dragonworks_ngx_dashboard.CellId, flat: boolean) => void;
|
|
308
|
+
updateWidgetSpan: (id: _dragonworks_ngx_dashboard.CellId, rowSpan: number, colSpan: number) => void;
|
|
309
|
+
updateWidgetState: (cellId: _dragonworks_ngx_dashboard.CellId, widgetState: unknown) => void;
|
|
310
|
+
updateAllWidgetStates: (widgetStates: Map<string, unknown>) => void;
|
|
311
|
+
clearDashboard: () => void;
|
|
312
|
+
syncDragState: (dragData: _dragonworks_ngx_dashboard.DragData | null) => void;
|
|
313
|
+
startDrag: (dragData: _dragonworks_ngx_dashboard.DragData) => void;
|
|
314
|
+
endDrag: () => void;
|
|
315
|
+
setHoveredDropZone: (zone: {
|
|
316
|
+
row: number;
|
|
317
|
+
col: number;
|
|
318
|
+
} | null) => void;
|
|
319
|
+
handleDrop: (dragData: _dragonworks_ngx_dashboard.DragData, targetPosition: {
|
|
320
|
+
row: number;
|
|
321
|
+
col: number;
|
|
322
|
+
}) => boolean;
|
|
323
|
+
startResize: (cellId: _dragonworks_ngx_dashboard.CellId) => void;
|
|
324
|
+
updateResizePreview: (direction: "horizontal" | "vertical", delta: number) => void;
|
|
325
|
+
endResize: (apply: boolean) => void;
|
|
326
|
+
exportDashboard: (getCurrentWidgetStates?: () => Map<string, unknown>) => DashboardDataDto;
|
|
327
|
+
loadDashboard: (data: DashboardDataDto) => void;
|
|
328
|
+
initializeFromDto: (dashboardData: DashboardDataDto) => void;
|
|
329
|
+
} & _ngrx_signals.StateSource<{
|
|
330
|
+
dashboardId: string;
|
|
331
|
+
rows: number;
|
|
332
|
+
columns: number;
|
|
333
|
+
gutterSize: string;
|
|
334
|
+
isEditMode: boolean;
|
|
335
|
+
gridCellDimensions: {
|
|
336
|
+
width: number;
|
|
337
|
+
height: number;
|
|
338
|
+
};
|
|
339
|
+
cellsById: Record<string, _dragonworks_ngx_dashboard.CellData>;
|
|
340
|
+
resizeData: ResizeData | null;
|
|
341
|
+
dragData: _dragonworks_ngx_dashboard.DragData | null;
|
|
342
|
+
hoveredDropZone: {
|
|
343
|
+
row: number;
|
|
344
|
+
col: number;
|
|
345
|
+
} | null;
|
|
346
|
+
}>;
|
|
347
|
+
protected readonly viewport: DashboardViewportService;
|
|
348
|
+
dashboardData: _angular_core.InputSignal<DashboardDataDto>;
|
|
349
|
+
editMode: _angular_core.InputSignal<boolean>;
|
|
350
|
+
reservedSpace: _angular_core.InputSignal<ReservedSpace | undefined>;
|
|
351
|
+
cells: _angular_core.Signal<_dragonworks_ngx_dashboard.CellData[]>;
|
|
352
|
+
private dashboardEditor;
|
|
353
|
+
private dashboardViewer;
|
|
354
|
+
constructor();
|
|
355
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
356
|
+
exportDashboard(): DashboardDataDto;
|
|
357
|
+
loadDashboard(data: DashboardDataDto): void;
|
|
358
|
+
getCurrentDashboardData(): DashboardDataDto;
|
|
359
|
+
clearDashboard(): void;
|
|
360
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DashboardComponent, never>;
|
|
361
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DashboardComponent, "ngx-dashboard", never, { "dashboardData": { "alias": "dashboardData"; "required": true; "isSignal": true; }; "editMode": { "alias": "editMode"; "required": false; "isSignal": true; }; "reservedSpace": { "alias": "reservedSpace"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
declare class CellComponent {
|
|
365
|
+
#private;
|
|
366
|
+
id: _angular_core.InputSignal<CellId>;
|
|
367
|
+
widgetFactory: _angular_core.InputSignal<WidgetFactory<Widget> | undefined>;
|
|
368
|
+
widgetState: _angular_core.InputSignal<unknown>;
|
|
369
|
+
isEditMode: _angular_core.InputSignal<boolean>;
|
|
370
|
+
flat: _angular_core.InputSignal<boolean | undefined>;
|
|
371
|
+
row: _angular_core.ModelSignal<number>;
|
|
372
|
+
column: _angular_core.ModelSignal<number>;
|
|
373
|
+
rowSpan: _angular_core.InputSignal<number>;
|
|
374
|
+
colSpan: _angular_core.InputSignal<number>;
|
|
375
|
+
draggable: _angular_core.InputSignal<boolean>;
|
|
376
|
+
dragStart: _angular_core.OutputEmitterRef<DragData>;
|
|
377
|
+
dragEnd: _angular_core.OutputEmitterRef<void>;
|
|
378
|
+
edit: _angular_core.OutputEmitterRef<CellId>;
|
|
379
|
+
delete: _angular_core.OutputEmitterRef<CellId>;
|
|
380
|
+
settings: _angular_core.OutputEmitterRef<{
|
|
381
|
+
id: CellId;
|
|
382
|
+
flat: boolean;
|
|
383
|
+
}>;
|
|
384
|
+
resizeStart: _angular_core.OutputEmitterRef<{
|
|
385
|
+
id: CellId;
|
|
386
|
+
direction: "horizontal" | "vertical";
|
|
387
|
+
}>;
|
|
388
|
+
resizeMove: _angular_core.OutputEmitterRef<{
|
|
389
|
+
id: CellId;
|
|
390
|
+
direction: "horizontal" | "vertical";
|
|
391
|
+
delta: number;
|
|
392
|
+
}>;
|
|
393
|
+
resizeEnd: _angular_core.OutputEmitterRef<{
|
|
394
|
+
id: CellId;
|
|
395
|
+
apply: boolean;
|
|
396
|
+
}>;
|
|
397
|
+
private container;
|
|
398
|
+
isDragging: _angular_core.WritableSignal<boolean>;
|
|
399
|
+
readonly gridRowStyle: _angular_core.Signal<string>;
|
|
400
|
+
readonly gridColumnStyle: _angular_core.Signal<string>;
|
|
401
|
+
isResizing: _angular_core.Signal<boolean>;
|
|
402
|
+
isDragActive: _angular_core.Signal<boolean>;
|
|
403
|
+
resizeData: _angular_core.Signal<ResizeData | null>;
|
|
404
|
+
gridCellDimensions: _ngrx_signals.DeepSignal<{
|
|
405
|
+
width: number;
|
|
406
|
+
height: number;
|
|
407
|
+
}>;
|
|
408
|
+
private resizeDirection;
|
|
409
|
+
private resizeStartPos;
|
|
410
|
+
constructor();
|
|
411
|
+
/**
|
|
412
|
+
* Setup document-level event listeners for resize operations
|
|
413
|
+
* Performance: Only creates listeners when actively resizing (not for every cell)
|
|
414
|
+
* Angular-idiomatic: Uses Renderer2 for dynamic listener management
|
|
415
|
+
*/
|
|
416
|
+
private setupDocumentListeners;
|
|
417
|
+
setPosition(row: number, column: number): void;
|
|
418
|
+
onDragStart(event: DragEvent): void;
|
|
419
|
+
onDragEnd(): void;
|
|
420
|
+
/**
|
|
421
|
+
* Handle context menu events (called from template)
|
|
422
|
+
* Performance: Element-specific event binding, not document-level
|
|
423
|
+
* Angular-idiomatic: Template event binding instead of fromEvent
|
|
424
|
+
*/
|
|
425
|
+
onContextMenu(event: MouseEvent): void;
|
|
426
|
+
canEdit(): boolean;
|
|
427
|
+
onEdit(): void;
|
|
428
|
+
onDelete(): void;
|
|
429
|
+
onSettings(): Promise<void>;
|
|
430
|
+
/**
|
|
431
|
+
* Start resize operation and setup document listeners
|
|
432
|
+
* Performance: Only THIS cell creates document listeners when actively resizing
|
|
433
|
+
* RxJS-free: Uses Renderer2 for dynamic listener management
|
|
434
|
+
*/
|
|
435
|
+
onResizeStart(event: MouseEvent, direction: 'horizontal' | 'vertical'): void;
|
|
436
|
+
/**
|
|
437
|
+
* Handle resize move events (called from document listener)
|
|
438
|
+
* Performance: Only called for the actively resizing cell
|
|
439
|
+
* Bound method: Maintains component context without arrow functions
|
|
440
|
+
*/
|
|
441
|
+
private handleResizeMove;
|
|
442
|
+
/**
|
|
443
|
+
* Handle resize end events (called from document listener)
|
|
444
|
+
* Performance: Cleans up document listeners immediately after resize
|
|
445
|
+
* State cleanup: Resets resize direction to stop further event processing
|
|
446
|
+
*/
|
|
447
|
+
private handleResizeEnd;
|
|
448
|
+
/**
|
|
449
|
+
* Get the current widget state by calling dashboardGetState() on the widget instance.
|
|
450
|
+
* Used during dashboard export to get live widget state instead of stale stored state.
|
|
451
|
+
*/
|
|
452
|
+
getCurrentWidgetState(): unknown | undefined;
|
|
453
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CellComponent, never>;
|
|
454
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CellComponent, "lib-cell", never, { "id": { "alias": "id"; "required": true; "isSignal": true; }; "widgetFactory": { "alias": "widgetFactory"; "required": false; "isSignal": true; }; "widgetState": { "alias": "widgetState"; "required": false; "isSignal": true; }; "isEditMode": { "alias": "isEditMode"; "required": false; "isSignal": true; }; "flat": { "alias": "flat"; "required": false; "isSignal": true; }; "row": { "alias": "row"; "required": true; "isSignal": true; }; "column": { "alias": "column"; "required": true; "isSignal": true; }; "rowSpan": { "alias": "rowSpan"; "required": false; "isSignal": true; }; "colSpan": { "alias": "colSpan"; "required": false; "isSignal": true; }; "draggable": { "alias": "draggable"; "required": false; "isSignal": true; }; }, { "row": "rowChange"; "column": "columnChange"; "dragStart": "dragStart"; "dragEnd": "dragEnd"; "edit": "edit"; "delete": "delete"; "settings": "settings"; "resizeStart": "resizeStart"; "resizeMove": "resizeMove"; "resizeEnd": "resizeEnd"; }, never, never, true, never>;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
declare class DropZoneComponent {
|
|
458
|
+
#private;
|
|
459
|
+
row: _angular_core.InputSignal<number>;
|
|
460
|
+
col: _angular_core.InputSignal<number>;
|
|
461
|
+
index: _angular_core.InputSignal<number>;
|
|
462
|
+
highlight: _angular_core.InputSignal<boolean>;
|
|
463
|
+
highlightInvalid: _angular_core.InputSignal<boolean>;
|
|
464
|
+
highlightResize: _angular_core.InputSignal<boolean>;
|
|
465
|
+
editMode: _angular_core.InputSignal<boolean>;
|
|
466
|
+
dragEnter: _angular_core.OutputEmitterRef<{
|
|
467
|
+
row: number;
|
|
468
|
+
col: number;
|
|
469
|
+
}>;
|
|
470
|
+
dragExit: _angular_core.OutputEmitterRef<void>;
|
|
471
|
+
dragOver: _angular_core.OutputEmitterRef<{
|
|
472
|
+
row: number;
|
|
473
|
+
col: number;
|
|
474
|
+
}>;
|
|
475
|
+
dragDrop: _angular_core.OutputEmitterRef<{
|
|
476
|
+
data: DragData;
|
|
477
|
+
target: {
|
|
478
|
+
row: number;
|
|
479
|
+
col: number;
|
|
480
|
+
};
|
|
481
|
+
}>;
|
|
482
|
+
dropZoneId: _angular_core.Signal<string>;
|
|
483
|
+
dropData: _angular_core.Signal<{
|
|
484
|
+
row: number;
|
|
485
|
+
col: number;
|
|
486
|
+
}>;
|
|
487
|
+
dragData: _angular_core.Signal<DragData | null>;
|
|
488
|
+
dropEffect: _angular_core.Signal<"none" | "copy" | "move">;
|
|
489
|
+
get nativeElement(): HTMLElement;
|
|
490
|
+
onDragEnter(event: DragEvent): void;
|
|
491
|
+
onDragOver(event: DragEvent): void;
|
|
492
|
+
onDragLeave(event: DragEvent): void;
|
|
493
|
+
onDrop(event: DragEvent): void;
|
|
494
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DropZoneComponent, never>;
|
|
495
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DropZoneComponent, "lib-drop-zone", never, { "row": { "alias": "row"; "required": true; "isSignal": true; }; "col": { "alias": "col"; "required": true; "isSignal": true; }; "index": { "alias": "index"; "required": true; "isSignal": true; }; "highlight": { "alias": "highlight"; "required": false; "isSignal": true; }; "highlightInvalid": { "alias": "highlightInvalid"; "required": false; "isSignal": true; }; "highlightResize": { "alias": "highlightResize"; "required": false; "isSignal": true; }; "editMode": { "alias": "editMode"; "required": false; "isSignal": true; }; }, { "dragEnter": "dragEnter"; "dragExit": "dragExit"; "dragOver": "dragOver"; "dragDrop": "dragDrop"; }, never, never, true, never>;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
declare class DashboardEditorComponent {
|
|
499
|
+
#private;
|
|
500
|
+
bottomGridRef: _angular_core.Signal<ElementRef<HTMLDivElement>>;
|
|
501
|
+
dropZones: _angular_core.Signal<readonly DropZoneComponent[]>;
|
|
502
|
+
cellComponents: _angular_core.Signal<readonly CellComponent[]>;
|
|
503
|
+
rows: _angular_core.InputSignal<number>;
|
|
504
|
+
columns: _angular_core.InputSignal<number>;
|
|
505
|
+
gutterSize: _angular_core.InputSignal<string>;
|
|
506
|
+
gutters: _angular_core.Signal<number>;
|
|
507
|
+
cells: _angular_core.Signal<CellData[]>;
|
|
508
|
+
highlightedZones: _angular_core.Signal<{
|
|
509
|
+
row: number;
|
|
510
|
+
col: number;
|
|
511
|
+
}[]>;
|
|
512
|
+
highlightMap: _angular_core.Signal<Set<CellId>>;
|
|
513
|
+
invalidHighlightMap: _angular_core.Signal<Set<CellId>>;
|
|
514
|
+
hoveredDropZone: _angular_core.Signal<{
|
|
515
|
+
row: number;
|
|
516
|
+
col: number;
|
|
517
|
+
} | null>;
|
|
518
|
+
resizePreviewMap: _angular_core.Signal<Set<CellId>>;
|
|
519
|
+
dropzonePositions: _angular_core.Signal<{
|
|
520
|
+
row: number;
|
|
521
|
+
col: number;
|
|
522
|
+
id: string;
|
|
523
|
+
index: number;
|
|
524
|
+
}[]>;
|
|
525
|
+
createCellId(row: number, col: number): CellId;
|
|
526
|
+
constructor();
|
|
527
|
+
addWidget: (cellData: CellData) => void;
|
|
528
|
+
updateCellPosition: (id: CellId, row: number, column: number) => void;
|
|
529
|
+
updateCellSpan: (id: CellId, colSpan: number, rowSpan: number) => void;
|
|
530
|
+
updateCellSettings: (id: CellId, flat: boolean) => void;
|
|
531
|
+
onDragOver: (event: {
|
|
532
|
+
row: number;
|
|
533
|
+
col: number;
|
|
534
|
+
}) => void;
|
|
535
|
+
onDragEnter: (event: {
|
|
536
|
+
row: number;
|
|
537
|
+
col: number;
|
|
538
|
+
}) => void;
|
|
539
|
+
onDragExit: () => void;
|
|
540
|
+
dragEnd: () => void;
|
|
541
|
+
onCellDelete: (id: CellId) => void;
|
|
542
|
+
onCellSettings: (event: {
|
|
543
|
+
id: CellId;
|
|
544
|
+
flat: boolean;
|
|
545
|
+
}) => void;
|
|
546
|
+
onCellResize: (event: {
|
|
547
|
+
id: CellId;
|
|
548
|
+
rowSpan: number;
|
|
549
|
+
colSpan: number;
|
|
550
|
+
}) => void;
|
|
551
|
+
onCellDragStart: (dragData: DragData) => void;
|
|
552
|
+
onCellResizeStart: (event: {
|
|
553
|
+
id: CellId;
|
|
554
|
+
direction: "horizontal" | "vertical";
|
|
555
|
+
}) => void;
|
|
556
|
+
onCellResizeMove: (event: {
|
|
557
|
+
id: CellId;
|
|
558
|
+
direction: "horizontal" | "vertical";
|
|
559
|
+
delta: number;
|
|
560
|
+
}) => void;
|
|
561
|
+
onCellResizeEnd: (event: {
|
|
562
|
+
id: CellId;
|
|
563
|
+
apply: boolean;
|
|
564
|
+
}) => void;
|
|
565
|
+
onDragDrop(event: {
|
|
566
|
+
data: DragData;
|
|
567
|
+
target: {
|
|
568
|
+
row: number;
|
|
569
|
+
col: number;
|
|
570
|
+
};
|
|
571
|
+
}): void;
|
|
572
|
+
/**
|
|
573
|
+
* Get current widget states from all cell components.
|
|
574
|
+
* Used during dashboard export to get live widget states.
|
|
575
|
+
*/
|
|
576
|
+
getCurrentWidgetStates(): Map<string, unknown>;
|
|
577
|
+
/**
|
|
578
|
+
* Export dashboard with live widget states from current component instances.
|
|
579
|
+
* This ensures the most up-to-date widget states are captured.
|
|
580
|
+
*/
|
|
581
|
+
exportDashboard(): _dragonworks_ngx_dashboard.DashboardDataDto;
|
|
582
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DashboardEditorComponent, never>;
|
|
583
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DashboardEditorComponent, "ngx-dashboard-editor", never, { "rows": { "alias": "rows"; "required": true; "isSignal": true; }; "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "gutterSize": { "alias": "gutterSize"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
declare class DashboardViewerComponent {
|
|
587
|
+
#private;
|
|
588
|
+
cellComponents: _angular_core.Signal<readonly CellComponent[]>;
|
|
589
|
+
rows: _angular_core.InputSignal<number>;
|
|
590
|
+
columns: _angular_core.InputSignal<number>;
|
|
591
|
+
gutterSize: _angular_core.InputSignal<string>;
|
|
592
|
+
gutters: _angular_core.Signal<number>;
|
|
593
|
+
cells: _angular_core.Signal<_dragonworks_ngx_dashboard.CellData[]>;
|
|
594
|
+
constructor();
|
|
595
|
+
/**
|
|
596
|
+
* Get current widget states from all cell components.
|
|
597
|
+
* Used during dashboard export to get live widget states.
|
|
598
|
+
*/
|
|
599
|
+
getCurrentWidgetStates(): Map<string, unknown>;
|
|
600
|
+
/**
|
|
601
|
+
* Export dashboard with live widget states from current component instances.
|
|
602
|
+
* This ensures the most up-to-date widget states are captured.
|
|
603
|
+
*/
|
|
604
|
+
exportDashboard(): _dragonworks_ngx_dashboard.DashboardDataDto;
|
|
605
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DashboardViewerComponent, never>;
|
|
606
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DashboardViewerComponent, "ngx-dashboard-viewer", never, { "rows": { "alias": "rows"; "required": true; "isSignal": true; }; "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "gutterSize": { "alias": "gutterSize"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
interface WidgetDisplayItem extends WidgetMetadata {
|
|
610
|
+
safeSvgIcon?: SafeHtml;
|
|
611
|
+
}
|
|
612
|
+
declare class WidgetListComponent {
|
|
613
|
+
#private;
|
|
614
|
+
activeWidget: _angular_core.WritableSignal<string | null>;
|
|
615
|
+
gridCellDimensions: _angular_core.Signal<{
|
|
616
|
+
width: number;
|
|
617
|
+
height: number;
|
|
618
|
+
}>;
|
|
619
|
+
widgets: _angular_core.Signal<{
|
|
620
|
+
safeSvgIcon: SafeHtml;
|
|
621
|
+
widgetTypeid: string;
|
|
622
|
+
name: string;
|
|
623
|
+
description: string;
|
|
624
|
+
svgIcon: string;
|
|
625
|
+
}[]>;
|
|
626
|
+
onDragStart(event: DragEvent, widget: WidgetDisplayItem): void;
|
|
627
|
+
onDragEnd(): void;
|
|
628
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WidgetListComponent, never>;
|
|
629
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WidgetListComponent, "ngx-dashboard-widget-list", never, {}, {}, never, never, true, never>;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
declare class DashboardService {
|
|
633
|
+
#private;
|
|
634
|
+
readonly widgetTypes: _angular_core.Signal<WidgetComponentClass<_dragonworks_ngx_dashboard.Widget>[]>;
|
|
635
|
+
registerWidgetType(widget: WidgetComponentClass): void;
|
|
636
|
+
getFactory(widgetTypeid: string): WidgetFactory;
|
|
637
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DashboardService, never>;
|
|
638
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<DashboardService>;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Abstract provider for cell settings dialogs.
|
|
643
|
+
* Implement this to provide custom dialog solutions.
|
|
644
|
+
*/
|
|
645
|
+
declare abstract class CellSettingsDialogProvider {
|
|
646
|
+
/**
|
|
647
|
+
* Open a settings dialog for the given cell.
|
|
648
|
+
* Returns a promise that resolves to the new settings, or undefined if cancelled.
|
|
649
|
+
*/
|
|
650
|
+
abstract openCellSettings(data: CellDisplayData): Promise<CellDisplayData | undefined>;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Default cell dialog provider that uses Material Design dialogs.
|
|
655
|
+
* Provides a modern, accessible dialog experience for cell settings.
|
|
656
|
+
*/
|
|
657
|
+
declare class DefaultCellSettingsDialogProvider extends CellSettingsDialogProvider {
|
|
658
|
+
private dialog;
|
|
659
|
+
openCellSettings(data: CellDisplayData): Promise<CellDisplayData | undefined>;
|
|
660
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DefaultCellSettingsDialogProvider, never>;
|
|
661
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<DefaultCellSettingsDialogProvider>;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Injection token for the cell dialog provider.
|
|
666
|
+
* Use this to provide your custom dialog implementation.
|
|
667
|
+
*
|
|
668
|
+
* @example
|
|
669
|
+
* ```typescript
|
|
670
|
+
* providers: [
|
|
671
|
+
* { provide: CELL_SETTINGS_DIALOG_PROVIDER, useClass: MyCellSettingsDialogProvider }
|
|
672
|
+
* ]
|
|
673
|
+
* ```
|
|
674
|
+
*/
|
|
675
|
+
declare const CELL_SETTINGS_DIALOG_PROVIDER: InjectionToken<CellSettingsDialogProvider>;
|
|
676
|
+
|
|
677
|
+
export { CELL_SETTINGS_DIALOG_PROVIDER, CellIdUtils, CellSettingsDialogProvider, DEFAULT_RESERVED_SPACE, DashboardComponent, DashboardEditorComponent, DashboardService, DashboardViewerComponent, DefaultCellSettingsDialogProvider, WidgetListComponent, createDefaultDashboard, createEmptyDashboard, createFactoryFromComponent };
|
|
678
|
+
export type { CellComponentPosition, CellData, CellDataDto, CellDisplayData, CellId, CellPosition, DashboardDataDto, DragData, ReservedSpace, Widget, WidgetComponentClass, WidgetFactory, WidgetMetadata };
|