@tenorlab/react-dashboard 1.3.2 → 1.3.5

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.
@@ -1,23 +1,11 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { default as default_2 } from 'react';
3
3
  import { ForwardRefExoticComponent } from 'react';
4
- import { IChildWidgetConfigEntry } from './interfaces/';
5
- import { IDashboardConfig } from './interfaces/';
6
- import { IDashboardGridPropsBase } from './interfaces/';
7
- import { IDashboardSettingEntry } from './interfaces/';
8
- import { IDashboardWidgetPropsBase } from './interfaces/';
9
- import { IDynamicWidgetCatalogEntryBase } from './interfaces/';
10
4
  import { JSX } from 'react';
11
5
  import { JSX as JSX_2 } from 'react/jsx-runtime';
12
6
  import { ReactNode } from 'react';
13
7
  import { RefAttributes } from 'react';
14
8
  import { StoreApi } from 'zustand';
15
- import { TDashboardUndoStatus } from './interfaces/';
16
- import { TDashboardWidgetCatalogBase } from './interfaces/';
17
- import { TDashboardWidgetKey } from './interfaces/';
18
- import { TUndoHistoryEntry } from './interfaces/';
19
- import { TWidgetFactoryBase } from './interfaces/';
20
- import { TWidgetMetaInfoBase } from './interfaces/';
21
9
  import { UseBoundStore } from 'zustand';
22
10
 
23
11
  export declare function AddIcon({ className }: TIconProps): JSX_2.Element;
@@ -90,10 +78,47 @@ export declare interface IButtonProps {
90
78
  tooltip?: ITooltipProps;
91
79
  }
92
80
 
81
+ declare interface IChildWidgetConfigEntry {
82
+ parentWidgetKey: TDashboardWidgetKey;
83
+ widgetKey: TDashboardWidgetKey;
84
+ }
85
+
86
+ declare interface IDashboardConfig {
87
+ userID: number | string;
88
+ clientAppKey: string;
89
+ dashboardId: string;
90
+ dashboardName: string;
91
+ zoomScale: number;
92
+ responsiveGrid: boolean;
93
+ widgets: TDashboardWidgetKey[];
94
+ childWidgetsConfig: IChildWidgetConfigEntry[];
95
+ cssSettings: IDashboardSettingEntry[];
96
+ _version?: number;
97
+ _stateDescription?: string;
98
+ }
99
+
93
100
  export declare interface IDashboardGridProps extends IDashboardGridPropsBase {
94
101
  children?: ReactNode;
95
102
  }
96
103
 
104
+ declare interface IDashboardGridPropsBase {
105
+ isEditing: boolean;
106
+ zoomScale: number;
107
+ responsiveGrid: boolean;
108
+ }
109
+
110
+ declare interface IDashboardSettingEntry {
111
+ key: string;
112
+ name: string;
113
+ description: string;
114
+ cssProperty: string;
115
+ step: number;
116
+ defaultUnit: string;
117
+ minValue: number;
118
+ defaultValue: string;
119
+ value: string;
120
+ }
121
+
97
122
  export declare interface IDashboardWidget extends JSX.Element {
98
123
  }
99
124
 
@@ -104,9 +129,46 @@ export declare interface IDashboardWidgetProps<TExtraProps = any> extends IDashb
104
129
  selectContainer?: (containerKey?: TDashboardWidgetKey) => void;
105
130
  }
106
131
 
132
+ declare interface IDashboardWidgetPropsBase<TExtraProps = any> {
133
+ index: number;
134
+ maxIndex: number;
135
+ widgetKey: TDashboardWidgetKey;
136
+ parentWidgetKey?: TDashboardWidgetKey;
137
+ isEditing: boolean;
138
+ highlight?: boolean;
139
+ testId?: string;
140
+ title?: string;
141
+ size?: TWidgetSize;
142
+ borderCssClasses?: string;
143
+ backgroundCssClasses?: string;
144
+ hideTitle?: boolean;
145
+ noShadow?: boolean;
146
+ noBorder?: boolean;
147
+ noPadding?: boolean;
148
+ direction?: TWidgetDirection;
149
+ extraProps?: TExtraProps;
150
+ }
151
+
107
152
  export declare interface IDynamicWidgetCatalogEntry extends IDynamicWidgetCatalogEntryBase<TFrameworkElementType, TFrameworkComponentType> {
108
153
  }
109
154
 
155
+ /**
156
+ * 2. Define the flexible Catalog Entry
157
+ * Definition of a single widget or container in the catalog.
158
+ * It must have EITHER a direct 'component' reference OR a 'loader' function.
159
+ *
160
+ * TFrameworkElementType: see TWidgetMetaInfoBase
161
+ * TFrameworkComponentType: i.e. React.ComponentType<any> (see TWidgetFactoryBase)
162
+ */
163
+ declare interface IDynamicWidgetCatalogEntryBase<TFrameworkElementType = any, TFrameworkComponentType = any> {
164
+ key: TDashboardWidgetKey;
165
+ title: string;
166
+ isContainer?: boolean;
167
+ meta?: TWidgetMetaInfoBase<TFrameworkElementType>;
168
+ component?: TFrameworkComponentType;
169
+ loader?: TWidgetFactoryBase<TFrameworkComponentType>;
170
+ }
171
+
110
172
  /**
111
173
  * Compares two version strings (e.g., "19.2.0" and "19.2.3")
112
174
  * Returns true if the widget version is compatible with the host.
@@ -206,8 +268,19 @@ declare type TDashboardSlice = {
206
268
 
207
269
  export declare type TDashboardUndoService = ReturnType<typeof useDashboardUndoService>;
208
270
 
271
+ declare type TDashboardUndoStatus = {
272
+ isUndoDisabled: boolean;
273
+ isRedoDisabled: boolean;
274
+ _currentIndex?: number;
275
+ _historyLength?: number;
276
+ };
277
+
209
278
  export declare type TDashboardWidgetCatalog = TDashboardWidgetCatalogBase<TFrameworkElementType, TFrameworkComponentType>;
210
279
 
280
+ declare type TDashboardWidgetCatalogBase<TFrameworkElementType = any, TFrameworkComponentType = any> = Map<TDashboardWidgetKey, IDynamicWidgetCatalogEntryBase<TFrameworkElementType, TFrameworkComponentType>>;
281
+
282
+ declare type TDashboardWidgetKey = string;
283
+
211
284
  declare type TDynamicWidgetLoaderProps<TExtraProps = any> = {
212
285
  index: number;
213
286
  maxIndex: number;
@@ -261,10 +334,40 @@ export declare type TStackProps = {
261
334
  children: React.ReactNode;
262
335
  };
263
336
 
337
+ declare type TUndoHistoryEntry = {
338
+ undoIndex: number;
339
+ config: IDashboardConfig;
340
+ };
341
+
342
+ declare type TWidgetCategory = 'Widget' | 'Chart' | 'Container';
343
+
344
+ declare type TWidgetDirection = 'row' | 'column';
345
+
264
346
  export declare type TWidgetFactory = TWidgetFactoryBase<TFrameworkComponentType>;
265
347
 
348
+ /**
349
+ * 1. Define the Async Loader type
350
+ * Type for the function that performs the asynchronous dynamic import.
351
+ * It must return a promise that resolves to the module containing the widget component
352
+ * as its default export (or a named export if you change the loading strategy).
353
+ *
354
+ * TFrameworkComponent could be "React.ComponentType<any>"" or "VueComponent" etc
355
+ */
356
+ declare type TWidgetFactoryBase<TFrameworkComponent = any> = () => Promise<{
357
+ default: TFrameworkComponent;
358
+ }>;
359
+
266
360
  export declare type TWidgetMetaInfo = TWidgetMetaInfoBase<TFrameworkElementType | undefined>;
267
361
 
362
+ declare type TWidgetMetaInfoBase<TFrameworkElementType = any> = {
363
+ name: string;
364
+ description: string;
365
+ categories: TWidgetCategory[];
366
+ noDuplicatedWidgets?: boolean;
367
+ icon: TFrameworkElementType | undefined;
368
+ externalDependencies: string[];
369
+ };
370
+
268
371
  export declare type TWidgetsCatalogFlyoutProps = {
269
372
  targetContainerKey?: TDashboardWidgetKey;
270
373
  widgetsCatalog: TDashboardWidgetCatalog;
@@ -278,6 +381,8 @@ export declare type TWidgetsCatalogFlyoutProps = {
278
381
  onDoneClick: () => any;
279
382
  };
280
383
 
384
+ declare type TWidgetSize = 'default' | 'large' | 'xlarge';
385
+
281
386
  export declare function UndoIcon({ className }: TIconProps): JSX_2.Element;
282
387
 
283
388
  export declare const useDashboardStore: UseBoundStore<StoreApi<TDashboardSlice>>;
@@ -312,10 +417,4 @@ export declare function ZoomInIcon({ className }: TIconProps): JSX_2.Element;
312
417
 
313
418
  export declare function ZoomOutIcon({ className }: TIconProps): JSX_2.Element;
314
419
 
315
-
316
- export * from "./dashboard-settings";
317
- export * from "./interfaces/";
318
- export * from "./storage-service";
319
- export * from "./utils";
320
-
321
420
  export { }