@tenorlab/react-dashboard 1.4.7 → 1.5.1
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/dist/core.d.ts +209 -16
- package/dist/react-dashboard.d.ts +173 -13
- package/package.json +2 -2
package/dist/core.d.ts
CHANGED
|
@@ -111,11 +111,24 @@ export declare const getNewZoomScaleWithinRange: (currentZoomScale: number, dire
|
|
|
111
111
|
*/
|
|
112
112
|
export declare const getWidgetMetaFromCatalog: <TFrameworkElementType = any, TFrameworkComponentType = any>(widgetKey: TDashboardWidgetKey, widgetsCatalog: TDashboardWidgetCatalogBase<TFrameworkElementType, TFrameworkComponentType>) => TWidgetMetaInfoBase<TFrameworkElementType>;
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* @name IChildWidgetConfigEntry
|
|
116
|
+
* @description Interface for a child widget configuration entry
|
|
117
|
+
* @remarks Used in IDashboardConfig
|
|
118
|
+
* @see IDashboardConfig
|
|
119
|
+
*/
|
|
114
120
|
export declare interface IChildWidgetConfigEntry {
|
|
115
121
|
parentWidgetKey: TDashboardWidgetKey;
|
|
116
122
|
widgetKey: TDashboardWidgetKey;
|
|
117
123
|
}
|
|
118
124
|
|
|
125
|
+
/**
|
|
126
|
+
* @name IDashboardConfig
|
|
127
|
+
* @description Interface for the dashboard configuration
|
|
128
|
+
* @remarks Used to store the dashboard state
|
|
129
|
+
* @see IChildWidgetConfigEntry
|
|
130
|
+
* @see IDashboardSettingEntry
|
|
131
|
+
*/
|
|
119
132
|
export declare interface IDashboardConfig {
|
|
120
133
|
userID: number | string;
|
|
121
134
|
clientAppKey: string;
|
|
@@ -130,12 +143,26 @@ export declare interface IDashboardConfig {
|
|
|
130
143
|
_stateDescription?: string;
|
|
131
144
|
}
|
|
132
145
|
|
|
146
|
+
/**
|
|
147
|
+
* @name IDashboardGridPropsBase
|
|
148
|
+
* @description Base interface for dashboard grid props passed to widgets.
|
|
149
|
+
* @remarks
|
|
150
|
+
* - `zoomScale` represents a uniform zoom applied to the dashboard UI. Default
|
|
151
|
+
* behavior in the runtime clamps this value to a minimum of `0.7` and default
|
|
152
|
+
* is `1` when not explicitly set.
|
|
153
|
+
* - `responsiveGrid` toggles responsive layout behaviors vs fixed grid sizing.
|
|
154
|
+
*/
|
|
133
155
|
export declare interface IDashboardGridPropsBase {
|
|
134
156
|
isEditing: boolean;
|
|
135
157
|
zoomScale: number;
|
|
136
158
|
responsiveGrid: boolean;
|
|
137
159
|
}
|
|
138
160
|
|
|
161
|
+
/**
|
|
162
|
+
* @name IDashboardSettingEntry
|
|
163
|
+
* @description Interface for a dashboard setting entry
|
|
164
|
+
* @see cssSettingsCatalog in dashboard-settings.ts
|
|
165
|
+
*/
|
|
139
166
|
export declare interface IDashboardSettingEntry {
|
|
140
167
|
key: string;
|
|
141
168
|
name: string;
|
|
@@ -148,11 +175,35 @@ export declare interface IDashboardSettingEntry {
|
|
|
148
175
|
value: string;
|
|
149
176
|
}
|
|
150
177
|
|
|
178
|
+
/**
|
|
179
|
+
* @name IDashboardStorageService
|
|
180
|
+
* @description Interface for the dashboard storage service
|
|
181
|
+
* @remarks Used to define the storage service methods
|
|
182
|
+
* @see TGetSavedDashboards
|
|
183
|
+
* @see TSaveDashboards
|
|
184
|
+
* @see IDashboardConfig
|
|
185
|
+
*/
|
|
151
186
|
export declare interface IDashboardStorageService {
|
|
152
187
|
getSavedDashboards: TGetSavedDashboards;
|
|
153
188
|
saveDashboards: TSaveDashboards;
|
|
154
189
|
}
|
|
155
190
|
|
|
191
|
+
/**
|
|
192
|
+
* @name IDashboardWidgetPropsBase
|
|
193
|
+
* @description Props provided to every widget instance rendered by the dashboard.
|
|
194
|
+
* @template TExtraProps - Additional, widget-specific props supplied by the
|
|
195
|
+
* dashboard or integrator via the dynamic loader.
|
|
196
|
+
* @remarks
|
|
197
|
+
* - `index` and `maxIndex` indicate the widget's position and the current
|
|
198
|
+
* maximum index used for ordering (zero-based indexing is typical).
|
|
199
|
+
* - `widgetKey` is the stable `TDashboardWidgetKey` identifying the widget
|
|
200
|
+
* type; `parentWidgetKey` is set for nested/child widgets.
|
|
201
|
+
* - Boolean flags like `hideTitle`, `noShadow`, `noBorder`, `noPadding` are
|
|
202
|
+
* layout/presentation hints; default behavior should be documented by the
|
|
203
|
+
* concrete widget implementation.
|
|
204
|
+
* - `direction` applies to container widgets only.
|
|
205
|
+
* - `extraProps` is merged into the widget props by the `DynamicWidgetLoader`.
|
|
206
|
+
*/
|
|
156
207
|
export declare interface IDashboardWidgetPropsBase<TExtraProps = any> {
|
|
157
208
|
index: number;
|
|
158
209
|
maxIndex: number;
|
|
@@ -174,12 +225,23 @@ export declare interface IDashboardWidgetPropsBase<TExtraProps = any> {
|
|
|
174
225
|
}
|
|
175
226
|
|
|
176
227
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
228
|
+
* @name IDynamicWidgetCatalogEntryBase
|
|
229
|
+
* @description Catalog entry describing how to create or load a widget.
|
|
230
|
+
* @template TFrameworkElementType - Framework-specific element type (icon, element)
|
|
231
|
+
* @template TFrameworkComponentType - Framework-specific component type
|
|
232
|
+
* @remarks
|
|
233
|
+
* - `key` must be unique and stable across versions because it is stored in
|
|
234
|
+
* saved dashboard configurations.
|
|
235
|
+
* - `title` is the display name for catalogs and selection UIs.
|
|
236
|
+
* - `isContainer` indicates a widget that can host children.
|
|
237
|
+
* - `isRemote` marks entries that are expected to be loaded remotely (CDN,
|
|
238
|
+
* external script) and may require extra loading/initialization steps.
|
|
239
|
+
* - `meta` contains presentation metadata (see `TWidgetMetaInfoBase`).
|
|
240
|
+
* - `component` is a direct component reference (preferred for static/core widgets).
|
|
241
|
+
* - `loader` is an async factory used for dynamic/plugin widgets. When both
|
|
242
|
+
* `component` and `loader` are provided, loaders are typically used for
|
|
243
|
+
* dynamic initialization; concrete loaders/components precedence should be
|
|
244
|
+
* defined by the integrator.
|
|
183
245
|
*/
|
|
184
246
|
export declare interface IDynamicWidgetCatalogEntryBase<TFrameworkElementType = any, TFrameworkComponentType = any> {
|
|
185
247
|
key: TDashboardWidgetKey;
|
|
@@ -231,6 +293,11 @@ export declare const removeEmptyContainers: (dashboardConfig: IDashboardConfig)
|
|
|
231
293
|
*/
|
|
232
294
|
export declare const resolveColorFromClass: (classNames: string | string[], property?: "color" | "backgroundColor") => string;
|
|
233
295
|
|
|
296
|
+
/**
|
|
297
|
+
* @name TDashboardUndoStatus
|
|
298
|
+
* @description Type for the dashboard undo/redo status
|
|
299
|
+
* @remarks Used in dashboard undo/redo functionality
|
|
300
|
+
*/
|
|
234
301
|
export declare type TDashboardUndoStatus = {
|
|
235
302
|
isUndoDisabled: boolean;
|
|
236
303
|
isRedoDisabled: boolean;
|
|
@@ -238,64 +305,190 @@ export declare type TDashboardUndoStatus = {
|
|
|
238
305
|
_historyLength?: number;
|
|
239
306
|
};
|
|
240
307
|
|
|
308
|
+
/**
|
|
309
|
+
* @name TDashboardWidgetCatalogBase
|
|
310
|
+
* @description Map of available widgets used by the dashboard at runtime.
|
|
311
|
+
* @template TFrameworkElementType - Framework-specific element type
|
|
312
|
+
* @template TFrameworkComponentType - Framework-specific component type
|
|
313
|
+
* @remarks Keys are `TDashboardWidgetKey` and values are catalog entries. The
|
|
314
|
+
* map is typically treated as a read-only registry; replace the map to update
|
|
315
|
+
* the available widget set rather than mutating entries in-place.
|
|
316
|
+
*/
|
|
241
317
|
export declare type TDashboardWidgetCatalogBase<TFrameworkElementType = any, TFrameworkComponentType = any> = Map<TDashboardWidgetKey, IDynamicWidgetCatalogEntryBase<TFrameworkElementType, TFrameworkComponentType>>;
|
|
242
318
|
|
|
319
|
+
/**
|
|
320
|
+
* @name TDashboardWidgetKey
|
|
321
|
+
* @description Type for the unique key identifying a dashboard widget.
|
|
322
|
+
* @remarks
|
|
323
|
+
* This is a simple alias for `string` to allow flexibility in widget keys.
|
|
324
|
+
* Recommended formats: stable short strings (e.g. `myApp.ChartWidget`),
|
|
325
|
+
* namespaced identifiers or UUIDs. Consumers should avoid empty strings.
|
|
326
|
+
*/
|
|
243
327
|
export declare type TDashboardWidgetKey = string;
|
|
244
328
|
|
|
329
|
+
/**
|
|
330
|
+
* @name TGetDefaultWidgetMetaFromKey
|
|
331
|
+
* @description Function that returns default `TWidgetMetaInfoBase` metadata for a widget key.
|
|
332
|
+
* @remarks Implementations should return a new object (not a shared reference)
|
|
333
|
+
* so callers can safely mutate the result if needed.
|
|
334
|
+
* @see TWidgetMetaInfoBase
|
|
335
|
+
* @see TGetDefaultWidgetMetaFromKeyOptions
|
|
336
|
+
* @returns `TWidgetMetaInfoBase`
|
|
337
|
+
*/
|
|
245
338
|
export declare type TGetDefaultWidgetMetaFromKey = (widgetKey: TDashboardWidgetKey, options?: TGetDefaultWidgetMetaFromKeyOptions) => TWidgetMetaInfoBase<any>;
|
|
246
339
|
|
|
340
|
+
/**
|
|
341
|
+
* @name TGetDefaultWidgetMetaFromKeyOptions
|
|
342
|
+
* @description Optional overrides when generating default widget metadata.
|
|
343
|
+
* @remarks Fields provided here override the generated metadata's `title`
|
|
344
|
+
* and/or `description`.
|
|
345
|
+
*/
|
|
247
346
|
export declare type TGetDefaultWidgetMetaFromKeyOptions = {
|
|
248
347
|
title?: string;
|
|
249
348
|
description?: string;
|
|
250
349
|
};
|
|
251
350
|
|
|
351
|
+
/**
|
|
352
|
+
* @name TGetSavedDashboards
|
|
353
|
+
* @description Function type to get saved dashboards for a user
|
|
354
|
+
* @remarks Used in IDashboardStorageService
|
|
355
|
+
* @see IDashboardConfig
|
|
356
|
+
* @see TDashboardWidgetCatalogBase
|
|
357
|
+
* @return Promise<IDashboardConfig[]>
|
|
358
|
+
*/
|
|
252
359
|
export declare type TGetSavedDashboards = (userID: number | string, clientAppKey: string, widgetCatalog: TDashboardWidgetCatalogBase, defaultDashboardConfig: IDashboardConfig) => Promise<IDashboardConfig[]>;
|
|
253
360
|
|
|
361
|
+
/**
|
|
362
|
+
* @name TManifestEntry
|
|
363
|
+
* @description Entry describing a remote widget manifest or resource.
|
|
364
|
+
* @remarks
|
|
365
|
+
* - `url` should point to the resource or manifest (absolute URLs recommended).
|
|
366
|
+
* - `meta` contains widget metadata (see `TWidgetMetaInfoBase`) describing the
|
|
367
|
+
* remotely loaded widget.
|
|
368
|
+
*/
|
|
254
369
|
export declare type TManifestEntry = {
|
|
255
370
|
url: string;
|
|
256
371
|
meta: TWidgetMetaInfoBase;
|
|
257
372
|
};
|
|
258
373
|
|
|
374
|
+
/**
|
|
375
|
+
* @name TSaveDashboards
|
|
376
|
+
* @description Function type to save dashboards for a user
|
|
377
|
+
* @remarks Used in IDashboardStorageService
|
|
378
|
+
* @see IDashboardConfig
|
|
379
|
+
* @see TDashboardWidgetCatalogBase
|
|
380
|
+
* @return Promise<boolean>
|
|
381
|
+
*/
|
|
259
382
|
export declare type TSaveDashboards = (userID: number | string, clientAppKey: string, dashboardConfigs: IDashboardConfig[], widgetCatalog: TDashboardWidgetCatalogBase) => Promise<boolean>;
|
|
260
383
|
|
|
384
|
+
/**
|
|
385
|
+
* @name TUndoHistoryEntry
|
|
386
|
+
* @description Type for an undo history entry
|
|
387
|
+
* @remarks Used in dashboard undo/redo functionality
|
|
388
|
+
* @see IDashboardConfig
|
|
389
|
+
*/
|
|
261
390
|
export declare type TUndoHistoryEntry = {
|
|
262
391
|
undoIndex: number;
|
|
263
392
|
config: IDashboardConfig;
|
|
264
393
|
};
|
|
265
394
|
|
|
395
|
+
/**
|
|
396
|
+
* @name TWidgetCategory
|
|
397
|
+
* @description Type for widget categories used for grouping and UI filters.
|
|
398
|
+
* @remarks
|
|
399
|
+
* Typical usage: categorizing widgets in a palette, grouping by behavior
|
|
400
|
+
* (for instance `Container` widgets may host child widgets).
|
|
401
|
+
*/
|
|
266
402
|
export declare type TWidgetCategory = 'Widget' | 'Chart' | 'Container';
|
|
267
403
|
|
|
404
|
+
/**
|
|
405
|
+
* @name TWidgetDirection
|
|
406
|
+
* @description Direction for layout flow inside container widgets.
|
|
407
|
+
* @remarks Only meaningful for container-type widgets that arrange children in
|
|
408
|
+
* either `row` or `column` flow.
|
|
409
|
+
*/
|
|
268
410
|
export declare type TWidgetDirection = 'row' | 'column';
|
|
269
411
|
|
|
270
412
|
/**
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
413
|
+
* @name TWidgetFactoryBase
|
|
414
|
+
* @description Async factory used to lazily load a framework component for a widget.
|
|
415
|
+
* @template TFrameworkComponent - Framework-specific component type (e.g., React component)
|
|
416
|
+
* @returns Promise resolving to an object with a `default` export containing the component.
|
|
417
|
+
* @remarks Implementations should throw on unrecoverable load errors so callers
|
|
418
|
+
* can handle fallbacks; returning a stub is also acceptable when documented.
|
|
277
419
|
*/
|
|
278
420
|
export declare type TWidgetFactoryBase<TFrameworkComponent = any> = () => Promise<{
|
|
279
421
|
default: TFrameworkComponent;
|
|
280
422
|
}>;
|
|
281
423
|
|
|
424
|
+
/**
|
|
425
|
+
* @name TWidgetMetaInfoBase
|
|
426
|
+
* @description Base metadata for a widget used by catalogs and tooling.
|
|
427
|
+
* @template TFrameworkElementType - Framework-specific element type (e.g. React element, Vue component)
|
|
428
|
+
* @remarks
|
|
429
|
+
* Fields:
|
|
430
|
+
* - `name` (required): Human readable widget name.
|
|
431
|
+
* - `description` (required): Short description shown in tooltips or catalog lists.
|
|
432
|
+
* - `categories` (required): One or more `TWidgetCategory` values used for grouping.
|
|
433
|
+
* - `noDuplicatedWidgets` (optional): When true, dashboard UI should prevent
|
|
434
|
+
* adding multiple instances of this widget.
|
|
435
|
+
* - `icon` (optional): Framework-specific icon element or component. May be
|
|
436
|
+
* `undefined` when not provided.
|
|
437
|
+
* - `externalDependencies` (required): Array of package identifiers or CDN
|
|
438
|
+
* references (e.g. `react@19.2.3`, `https://cdn.example.com/widget.js`). Use
|
|
439
|
+
* semantic versions or absolute URLs as appropriate.
|
|
440
|
+
*
|
|
441
|
+
* Example:
|
|
442
|
+
* {
|
|
443
|
+
* name: 'Simple Chart',
|
|
444
|
+
* description: 'Displays a time series',
|
|
445
|
+
* categories: ['Chart'],
|
|
446
|
+
* noDuplicatedWidgets: false,
|
|
447
|
+
* icon: undefined,
|
|
448
|
+
* externalDependencies: ['d3@7.0.0']
|
|
449
|
+
* }
|
|
450
|
+
*/
|
|
282
451
|
export declare type TWidgetMetaInfoBase<TFrameworkElementType = any> = {
|
|
283
452
|
name: string;
|
|
284
453
|
description: string;
|
|
285
454
|
categories: TWidgetCategory[];
|
|
286
455
|
noDuplicatedWidgets?: boolean;
|
|
287
|
-
icon
|
|
456
|
+
icon?: TFrameworkElementType | undefined;
|
|
288
457
|
externalDependencies: string[];
|
|
289
458
|
};
|
|
290
459
|
|
|
460
|
+
/**
|
|
461
|
+
* @name TWidgetSize
|
|
462
|
+
* @description Size hint for widgets that can affect layout or styling.
|
|
463
|
+
* @remarks 'default' represents the standard size; 'large' and 'xlarge' are
|
|
464
|
+
* larger variants where the dashboard may allocate more grid cells.
|
|
465
|
+
*/
|
|
291
466
|
export declare type TWidgetSize = 'default' | 'large' | 'xlarge';
|
|
292
467
|
|
|
293
468
|
/**
|
|
294
469
|
* @name useDashboardStorageService
|
|
295
470
|
* @description
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
471
|
+
* LocalStorage-backed implementation of `IDashboardStorageService`.
|
|
472
|
+
*
|
|
473
|
+
* Behavior:
|
|
474
|
+
* - Persists an array of `IDashboardConfig` objects under the key
|
|
475
|
+
* `dashboards_<clientAppKey>_<userID>` in `localStorage`.
|
|
476
|
+
* - `getSavedDashboards` performs lightweight validation and normalization when
|
|
477
|
+
* reading saved data: fills missing `dashboardId`/`dashboardName`, sanitizes
|
|
478
|
+
* CSS settings, filters unknown widget keys, and clamps `zoomScale`.
|
|
479
|
+
* - `saveDashboards` filters invalid widget keys, ensures required metadata
|
|
480
|
+
* (`userID`, `clientAppKey`, `responsiveGrid`, `zoomScale`) and writes the
|
|
481
|
+
* JSON-serialized dashboards to `localStorage`.
|
|
482
|
+
*
|
|
483
|
+
* Notes / limitations:
|
|
484
|
+
* - Uses synchronous browser `localStorage` with limited quota — not suitable
|
|
485
|
+
* for very large datasets or high-frequency writes.
|
|
486
|
+
* - Does not provide server-side persistence or multi-user synchronization. To
|
|
487
|
+
* persist dashboards centrally, implement a custom service that adheres to
|
|
488
|
+
* `IDashboardStorageService` and replace this implementation.
|
|
489
|
+
*
|
|
490
|
+
* @returns An object implementing `IDashboardStorageService` with
|
|
491
|
+
* `getSavedDashboards` and `saveDashboards` methods.
|
|
299
492
|
*/
|
|
300
493
|
export declare const useDashboardStorageService: () => IDashboardStorageService;
|
|
301
494
|
|
|
@@ -78,11 +78,24 @@ export declare interface IButtonProps {
|
|
|
78
78
|
tooltip?: ITooltipProps;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* @name IChildWidgetConfigEntry
|
|
83
|
+
* @description Interface for a child widget configuration entry
|
|
84
|
+
* @remarks Used in IDashboardConfig
|
|
85
|
+
* @see IDashboardConfig
|
|
86
|
+
*/
|
|
81
87
|
export declare interface IChildWidgetConfigEntry {
|
|
82
88
|
parentWidgetKey: TDashboardWidgetKey;
|
|
83
89
|
widgetKey: TDashboardWidgetKey;
|
|
84
90
|
}
|
|
85
91
|
|
|
92
|
+
/**
|
|
93
|
+
* @name IDashboardConfig
|
|
94
|
+
* @description Interface for the dashboard configuration
|
|
95
|
+
* @remarks Used to store the dashboard state
|
|
96
|
+
* @see IChildWidgetConfigEntry
|
|
97
|
+
* @see IDashboardSettingEntry
|
|
98
|
+
*/
|
|
86
99
|
export declare interface IDashboardConfig {
|
|
87
100
|
userID: number | string;
|
|
88
101
|
clientAppKey: string;
|
|
@@ -106,12 +119,26 @@ export declare interface IDashboardGridProps extends IDashboardGridPropsBase {
|
|
|
106
119
|
children?: ReactNode;
|
|
107
120
|
}
|
|
108
121
|
|
|
122
|
+
/**
|
|
123
|
+
* @name IDashboardGridPropsBase
|
|
124
|
+
* @description Base interface for dashboard grid props passed to widgets.
|
|
125
|
+
* @remarks
|
|
126
|
+
* - `zoomScale` represents a uniform zoom applied to the dashboard UI. Default
|
|
127
|
+
* behavior in the runtime clamps this value to a minimum of `0.7` and default
|
|
128
|
+
* is `1` when not explicitly set.
|
|
129
|
+
* - `responsiveGrid` toggles responsive layout behaviors vs fixed grid sizing.
|
|
130
|
+
*/
|
|
109
131
|
export declare interface IDashboardGridPropsBase {
|
|
110
132
|
isEditing: boolean;
|
|
111
133
|
zoomScale: number;
|
|
112
134
|
responsiveGrid: boolean;
|
|
113
135
|
}
|
|
114
136
|
|
|
137
|
+
/**
|
|
138
|
+
* @name IDashboardSettingEntry
|
|
139
|
+
* @description Interface for a dashboard setting entry
|
|
140
|
+
* @see cssSettingsCatalog in dashboard-settings.ts
|
|
141
|
+
*/
|
|
115
142
|
export declare interface IDashboardSettingEntry {
|
|
116
143
|
key: string;
|
|
117
144
|
name: string;
|
|
@@ -124,6 +151,14 @@ export declare interface IDashboardSettingEntry {
|
|
|
124
151
|
value: string;
|
|
125
152
|
}
|
|
126
153
|
|
|
154
|
+
/**
|
|
155
|
+
* @name IDashboardStorageService
|
|
156
|
+
* @description Interface for the dashboard storage service
|
|
157
|
+
* @remarks Used to define the storage service methods
|
|
158
|
+
* @see TGetSavedDashboards
|
|
159
|
+
* @see TSaveDashboards
|
|
160
|
+
* @see IDashboardConfig
|
|
161
|
+
*/
|
|
127
162
|
export declare interface IDashboardStorageService {
|
|
128
163
|
getSavedDashboards: TGetSavedDashboards;
|
|
129
164
|
saveDashboards: TSaveDashboards;
|
|
@@ -150,6 +185,22 @@ export declare interface IDashboardWidgetProps<TExtraProps = any> extends IDashb
|
|
|
150
185
|
selectContainer?: (containerKey?: TDashboardWidgetKey) => void;
|
|
151
186
|
}
|
|
152
187
|
|
|
188
|
+
/**
|
|
189
|
+
* @name IDashboardWidgetPropsBase
|
|
190
|
+
* @description Props provided to every widget instance rendered by the dashboard.
|
|
191
|
+
* @template TExtraProps - Additional, widget-specific props supplied by the
|
|
192
|
+
* dashboard or integrator via the dynamic loader.
|
|
193
|
+
* @remarks
|
|
194
|
+
* - `index` and `maxIndex` indicate the widget's position and the current
|
|
195
|
+
* maximum index used for ordering (zero-based indexing is typical).
|
|
196
|
+
* - `widgetKey` is the stable `TDashboardWidgetKey` identifying the widget
|
|
197
|
+
* type; `parentWidgetKey` is set for nested/child widgets.
|
|
198
|
+
* - Boolean flags like `hideTitle`, `noShadow`, `noBorder`, `noPadding` are
|
|
199
|
+
* layout/presentation hints; default behavior should be documented by the
|
|
200
|
+
* concrete widget implementation.
|
|
201
|
+
* - `direction` applies to container widgets only.
|
|
202
|
+
* - `extraProps` is merged into the widget props by the `DynamicWidgetLoader`.
|
|
203
|
+
*/
|
|
153
204
|
export declare interface IDashboardWidgetPropsBase<TExtraProps = any> {
|
|
154
205
|
index: number;
|
|
155
206
|
maxIndex: number;
|
|
@@ -181,12 +232,23 @@ export declare interface IDynamicWidgetCatalogEntry extends IDynamicWidgetCatalo
|
|
|
181
232
|
}
|
|
182
233
|
|
|
183
234
|
/**
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
235
|
+
* @name IDynamicWidgetCatalogEntryBase
|
|
236
|
+
* @description Catalog entry describing how to create or load a widget.
|
|
237
|
+
* @template TFrameworkElementType - Framework-specific element type (icon, element)
|
|
238
|
+
* @template TFrameworkComponentType - Framework-specific component type
|
|
239
|
+
* @remarks
|
|
240
|
+
* - `key` must be unique and stable across versions because it is stored in
|
|
241
|
+
* saved dashboard configurations.
|
|
242
|
+
* - `title` is the display name for catalogs and selection UIs.
|
|
243
|
+
* - `isContainer` indicates a widget that can host children.
|
|
244
|
+
* - `isRemote` marks entries that are expected to be loaded remotely (CDN,
|
|
245
|
+
* external script) and may require extra loading/initialization steps.
|
|
246
|
+
* - `meta` contains presentation metadata (see `TWidgetMetaInfoBase`).
|
|
247
|
+
* - `component` is a direct component reference (preferred for static/core widgets).
|
|
248
|
+
* - `loader` is an async factory used for dynamic/plugin widgets. When both
|
|
249
|
+
* `component` and `loader` are provided, loaders are typically used for
|
|
250
|
+
* dynamic initialization; concrete loaders/components precedence should be
|
|
251
|
+
* defined by the integrator.
|
|
190
252
|
*/
|
|
191
253
|
export declare interface IDynamicWidgetCatalogEntryBase<TFrameworkElementType = any, TFrameworkComponentType = any> {
|
|
192
254
|
key: TDashboardWidgetKey;
|
|
@@ -297,6 +359,11 @@ declare type TDashboardSlice = {
|
|
|
297
359
|
|
|
298
360
|
export declare type TDashboardUndoService = ReturnType<typeof useDashboardUndoService>;
|
|
299
361
|
|
|
362
|
+
/**
|
|
363
|
+
* @name TDashboardUndoStatus
|
|
364
|
+
* @description Type for the dashboard undo/redo status
|
|
365
|
+
* @remarks Used in dashboard undo/redo functionality
|
|
366
|
+
*/
|
|
300
367
|
export declare type TDashboardUndoStatus = {
|
|
301
368
|
isUndoDisabled: boolean;
|
|
302
369
|
isRedoDisabled: boolean;
|
|
@@ -313,8 +380,25 @@ export declare type TDashboardUndoStatus = {
|
|
|
313
380
|
*/
|
|
314
381
|
export declare type TDashboardWidgetCatalog = TDashboardWidgetCatalogBase<TFrameworkElementType, TFrameworkComponentType>;
|
|
315
382
|
|
|
383
|
+
/**
|
|
384
|
+
* @name TDashboardWidgetCatalogBase
|
|
385
|
+
* @description Map of available widgets used by the dashboard at runtime.
|
|
386
|
+
* @template TFrameworkElementType - Framework-specific element type
|
|
387
|
+
* @template TFrameworkComponentType - Framework-specific component type
|
|
388
|
+
* @remarks Keys are `TDashboardWidgetKey` and values are catalog entries. The
|
|
389
|
+
* map is typically treated as a read-only registry; replace the map to update
|
|
390
|
+
* the available widget set rather than mutating entries in-place.
|
|
391
|
+
*/
|
|
316
392
|
export declare type TDashboardWidgetCatalogBase<TFrameworkElementType = any, TFrameworkComponentType = any> = Map<TDashboardWidgetKey, IDynamicWidgetCatalogEntryBase<TFrameworkElementType, TFrameworkComponentType>>;
|
|
317
393
|
|
|
394
|
+
/**
|
|
395
|
+
* @name TDashboardWidgetKey
|
|
396
|
+
* @description Type for the unique key identifying a dashboard widget.
|
|
397
|
+
* @remarks
|
|
398
|
+
* This is a simple alias for `string` to allow flexibility in widget keys.
|
|
399
|
+
* Recommended formats: stable short strings (e.g. `myApp.ChartWidget`),
|
|
400
|
+
* namespaced identifiers or UUIDs. Consumers should avoid empty strings.
|
|
401
|
+
*/
|
|
318
402
|
export declare type TDashboardWidgetKey = string;
|
|
319
403
|
|
|
320
404
|
declare type TDynamicWidgetLoaderProps<TExtraProps = any> = {
|
|
@@ -349,6 +433,14 @@ declare type TFrameworkComponentType = React.ComponentType<any>;
|
|
|
349
433
|
*/
|
|
350
434
|
declare type TFrameworkElementType = React.ElementType;
|
|
351
435
|
|
|
436
|
+
/**
|
|
437
|
+
* @name TGetSavedDashboards
|
|
438
|
+
* @description Function type to get saved dashboards for a user
|
|
439
|
+
* @remarks Used in IDashboardStorageService
|
|
440
|
+
* @see IDashboardConfig
|
|
441
|
+
* @see TDashboardWidgetCatalogBase
|
|
442
|
+
* @return Promise<IDashboardConfig[]>
|
|
443
|
+
*/
|
|
352
444
|
declare type TGetSavedDashboards = (userID: number | string, clientAppKey: string, widgetCatalog: TDashboardWidgetCatalogBase, defaultDashboardConfig: IDashboardConfig) => Promise<IDashboardConfig[]>;
|
|
353
445
|
|
|
354
446
|
declare type TIconProps = {
|
|
@@ -363,6 +455,14 @@ declare type TListItemChildProps = {
|
|
|
363
455
|
children?: ReactNode;
|
|
364
456
|
};
|
|
365
457
|
|
|
458
|
+
/**
|
|
459
|
+
* @name TManifestEntry
|
|
460
|
+
* @description Entry describing a remote widget manifest or resource.
|
|
461
|
+
* @remarks
|
|
462
|
+
* - `url` should point to the resource or manifest (absolute URLs recommended).
|
|
463
|
+
* - `meta` contains widget metadata (see `TWidgetMetaInfoBase`) describing the
|
|
464
|
+
* remotely loaded widget.
|
|
465
|
+
*/
|
|
366
466
|
export declare type TManifestEntry = {
|
|
367
467
|
url: string;
|
|
368
468
|
meta: TWidgetMetaInfoBase;
|
|
@@ -375,6 +475,14 @@ declare type TProps = {
|
|
|
375
475
|
|
|
376
476
|
declare type TRemoveWidgetResponse = TAddWidgetResponse;
|
|
377
477
|
|
|
478
|
+
/**
|
|
479
|
+
* @name TSaveDashboards
|
|
480
|
+
* @description Function type to save dashboards for a user
|
|
481
|
+
* @remarks Used in IDashboardStorageService
|
|
482
|
+
* @see IDashboardConfig
|
|
483
|
+
* @see TDashboardWidgetCatalogBase
|
|
484
|
+
* @return Promise<boolean>
|
|
485
|
+
*/
|
|
378
486
|
declare type TSaveDashboards = (userID: number | string, clientAppKey: string, dashboardConfigs: IDashboardConfig[], widgetCatalog: TDashboardWidgetCatalogBase) => Promise<boolean>;
|
|
379
487
|
|
|
380
488
|
declare type TSize = 'small' | 'medium';
|
|
@@ -387,13 +495,32 @@ export declare type TStackProps = {
|
|
|
387
495
|
children: React.ReactNode;
|
|
388
496
|
};
|
|
389
497
|
|
|
498
|
+
/**
|
|
499
|
+
* @name TUndoHistoryEntry
|
|
500
|
+
* @description Type for an undo history entry
|
|
501
|
+
* @remarks Used in dashboard undo/redo functionality
|
|
502
|
+
* @see IDashboardConfig
|
|
503
|
+
*/
|
|
390
504
|
export declare type TUndoHistoryEntry = {
|
|
391
505
|
undoIndex: number;
|
|
392
506
|
config: IDashboardConfig;
|
|
393
507
|
};
|
|
394
508
|
|
|
509
|
+
/**
|
|
510
|
+
* @name TWidgetCategory
|
|
511
|
+
* @description Type for widget categories used for grouping and UI filters.
|
|
512
|
+
* @remarks
|
|
513
|
+
* Typical usage: categorizing widgets in a palette, grouping by behavior
|
|
514
|
+
* (for instance `Container` widgets may host child widgets).
|
|
515
|
+
*/
|
|
395
516
|
export declare type TWidgetCategory = 'Widget' | 'Chart' | 'Container';
|
|
396
517
|
|
|
518
|
+
/**
|
|
519
|
+
* @name TWidgetDirection
|
|
520
|
+
* @description Direction for layout flow inside container widgets.
|
|
521
|
+
* @remarks Only meaningful for container-type widgets that arrange children in
|
|
522
|
+
* either `row` or `column` flow.
|
|
523
|
+
*/
|
|
397
524
|
export declare type TWidgetDirection = 'row' | 'column';
|
|
398
525
|
|
|
399
526
|
/**
|
|
@@ -405,12 +532,12 @@ export declare type TWidgetDirection = 'row' | 'column';
|
|
|
405
532
|
export declare type TWidgetFactory = TWidgetFactoryBase<TFrameworkComponentType>;
|
|
406
533
|
|
|
407
534
|
/**
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
*
|
|
535
|
+
* @name TWidgetFactoryBase
|
|
536
|
+
* @description Async factory used to lazily load a framework component for a widget.
|
|
537
|
+
* @template TFrameworkComponent - Framework-specific component type (e.g., React component)
|
|
538
|
+
* @returns Promise resolving to an object with a `default` export containing the component.
|
|
539
|
+
* @remarks Implementations should throw on unrecoverable load errors so callers
|
|
540
|
+
* can handle fallbacks; returning a stub is also acceptable when documented.
|
|
414
541
|
*/
|
|
415
542
|
export declare type TWidgetFactoryBase<TFrameworkComponent = any> = () => Promise<{
|
|
416
543
|
default: TFrameworkComponent;
|
|
@@ -423,12 +550,39 @@ export declare type TWidgetFactoryBase<TFrameworkComponent = any> = () => Promis
|
|
|
423
550
|
*/
|
|
424
551
|
export declare type TWidgetMetaInfo = TWidgetMetaInfoBase<TFrameworkElementType | undefined>;
|
|
425
552
|
|
|
553
|
+
/**
|
|
554
|
+
* @name TWidgetMetaInfoBase
|
|
555
|
+
* @description Base metadata for a widget used by catalogs and tooling.
|
|
556
|
+
* @template TFrameworkElementType - Framework-specific element type (e.g. React element, Vue component)
|
|
557
|
+
* @remarks
|
|
558
|
+
* Fields:
|
|
559
|
+
* - `name` (required): Human readable widget name.
|
|
560
|
+
* - `description` (required): Short description shown in tooltips or catalog lists.
|
|
561
|
+
* - `categories` (required): One or more `TWidgetCategory` values used for grouping.
|
|
562
|
+
* - `noDuplicatedWidgets` (optional): When true, dashboard UI should prevent
|
|
563
|
+
* adding multiple instances of this widget.
|
|
564
|
+
* - `icon` (optional): Framework-specific icon element or component. May be
|
|
565
|
+
* `undefined` when not provided.
|
|
566
|
+
* - `externalDependencies` (required): Array of package identifiers or CDN
|
|
567
|
+
* references (e.g. `react@19.2.3`, `https://cdn.example.com/widget.js`). Use
|
|
568
|
+
* semantic versions or absolute URLs as appropriate.
|
|
569
|
+
*
|
|
570
|
+
* Example:
|
|
571
|
+
* {
|
|
572
|
+
* name: 'Simple Chart',
|
|
573
|
+
* description: 'Displays a time series',
|
|
574
|
+
* categories: ['Chart'],
|
|
575
|
+
* noDuplicatedWidgets: false,
|
|
576
|
+
* icon: undefined,
|
|
577
|
+
* externalDependencies: ['d3@7.0.0']
|
|
578
|
+
* }
|
|
579
|
+
*/
|
|
426
580
|
export declare type TWidgetMetaInfoBase<TFrameworkElementType = any> = {
|
|
427
581
|
name: string;
|
|
428
582
|
description: string;
|
|
429
583
|
categories: TWidgetCategory[];
|
|
430
584
|
noDuplicatedWidgets?: boolean;
|
|
431
|
-
icon
|
|
585
|
+
icon?: TFrameworkElementType | undefined;
|
|
432
586
|
externalDependencies: string[];
|
|
433
587
|
};
|
|
434
588
|
|
|
@@ -445,6 +599,12 @@ export declare type TWidgetsCatalogFlyoutProps = {
|
|
|
445
599
|
onDoneClick: () => any;
|
|
446
600
|
};
|
|
447
601
|
|
|
602
|
+
/**
|
|
603
|
+
* @name TWidgetSize
|
|
604
|
+
* @description Size hint for widgets that can affect layout or styling.
|
|
605
|
+
* @remarks 'default' represents the standard size; 'large' and 'xlarge' are
|
|
606
|
+
* larger variants where the dashboard may allocate more grid cells.
|
|
607
|
+
*/
|
|
448
608
|
export declare type TWidgetSize = 'default' | 'large' | 'xlarge';
|
|
449
609
|
|
|
450
610
|
export declare function UndoIcon({ className }: TIconProps): JSX_2.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenorlab/react-dashboard",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Foundation components for creating user-configurable dashboards in React",
|
|
5
5
|
"author": "Damiano Fusco",
|
|
6
6
|
"type": "module",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"zustand": "^5.0.0 || ^5.0.9"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@tenorlab/dashboard-core": "^1.
|
|
57
|
+
"@tenorlab/dashboard-core": "^1.5.1",
|
|
58
58
|
"@types/node": "^24.10.1",
|
|
59
59
|
"@types/react": "19.2.3",
|
|
60
60
|
"@types/react-dom": "19.2.3",
|