react-semaphor 0.0.72 → 0.0.73
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/react-semaphor.d.ts +73 -1
- package/dist/react-semaphor.js +10554 -10487
- package/dist/react-semaphor.umd.cjs +92 -92
- package/dist/style.css +1 -1
- package/package.json +1 -2
package/dist/react-semaphor.d.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
/// <reference types="react-grid-layout" />
|
|
2
3
|
|
|
4
|
+
import { BubbleDataPoint } from 'chart.js';
|
|
5
|
+
import { Chart as Chart_2 } from 'chart.js';
|
|
6
|
+
import { ChartConfiguration } from 'chart.js';
|
|
7
|
+
import { ChartTypeRegistry } from 'chart.js';
|
|
8
|
+
import { Draft } from 'immer';
|
|
9
|
+
import { FC } from 'react';
|
|
3
10
|
import { FontSpec } from 'chart.js';
|
|
4
11
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
5
12
|
import { Layout } from 'react-grid-layout';
|
|
13
|
+
import { Point } from 'chart.js';
|
|
6
14
|
import { StoreApi } from 'zustand';
|
|
7
15
|
import { UseBoundStore } from 'zustand';
|
|
8
16
|
|
|
9
17
|
declare type Actions = {
|
|
18
|
+
setCustomCards: (customCards: CustomCard[]) => void;
|
|
10
19
|
setAuthToken: (authToken: AuthToken) => void;
|
|
11
20
|
setThemeStyle: (themeStyle: StyleProps) => void;
|
|
12
21
|
setIsEditorSaveEvent: (isEditorSaveEvent: boolean) => void;
|
|
@@ -51,6 +60,7 @@ declare type Actions = {
|
|
|
51
60
|
getDashboard: () => TDashboard | undefined;
|
|
52
61
|
getSelectedSheet: () => TSheet | undefined;
|
|
53
62
|
getSelectedSheetCards: () => TCard[] | undefined;
|
|
63
|
+
getCard: (cardId: string) => TCard | undefined;
|
|
54
64
|
getSelectedCard: () => TCard | undefined;
|
|
55
65
|
getSelectedSheetLayout: () => ReactGridLayout.Layout[] | undefined;
|
|
56
66
|
};
|
|
@@ -112,6 +122,13 @@ export declare type Bookmark = {
|
|
|
112
122
|
|
|
113
123
|
export declare function cleanCard(card: TCard): TCard;
|
|
114
124
|
|
|
125
|
+
export declare type CustomCard = {
|
|
126
|
+
cardId: string;
|
|
127
|
+
component: React.FC<{
|
|
128
|
+
card: TCard;
|
|
129
|
+
}>;
|
|
130
|
+
};
|
|
131
|
+
|
|
115
132
|
export declare function Dashboard(props: DashboardProps): JSX_2.Element;
|
|
116
133
|
|
|
117
134
|
export declare function DashboardPlus({ showControls, showFooter, ...rest }: DashboardPlusProps): JSX_2.Element;
|
|
@@ -127,12 +144,17 @@ export declare type DashboardProps = {
|
|
|
127
144
|
style?: TStyle;
|
|
128
145
|
currentTheme?: 'light' | 'dark' | 'system';
|
|
129
146
|
version?: string;
|
|
147
|
+
customCards?: CustomCard[];
|
|
130
148
|
onEvent?: (event: TEvent) => void;
|
|
131
149
|
onSave?: (dashboard: TDashboard) => void;
|
|
132
150
|
LoadingComponent?: (props: LoadingProps) => React.ReactNode;
|
|
133
151
|
ErrorComponent?: (props: ErrorProps) => React.ReactNode;
|
|
134
152
|
};
|
|
135
153
|
|
|
154
|
+
export declare function DashboardProvider({ children }: {
|
|
155
|
+
children: React.ReactNode;
|
|
156
|
+
}): JSX_2.Element;
|
|
157
|
+
|
|
136
158
|
declare type DashboardStore = {
|
|
137
159
|
authToken?: AuthToken;
|
|
138
160
|
theme?: 'light' | 'dark' | 'system';
|
|
@@ -231,6 +253,7 @@ export declare function getDashbaordStateWithoutData(dashboardState: TDashboard)
|
|
|
231
253
|
description?: string | undefined;
|
|
232
254
|
style?: TStyle | undefined;
|
|
233
255
|
filters?: TFilter[] | undefined;
|
|
256
|
+
customCards?: CustomCard[] | undefined;
|
|
234
257
|
};
|
|
235
258
|
|
|
236
259
|
export declare type LoadingProps = {
|
|
@@ -282,6 +305,7 @@ export declare type TCard = {
|
|
|
282
305
|
sql?: string;
|
|
283
306
|
data?: any[];
|
|
284
307
|
cfg?: any;
|
|
308
|
+
childCards?: any[];
|
|
285
309
|
customCfg?: any;
|
|
286
310
|
preferences?: TCardPreferences;
|
|
287
311
|
lastSelectedDatabase?: string;
|
|
@@ -309,7 +333,9 @@ export declare type TCardPreferences = {
|
|
|
309
333
|
};
|
|
310
334
|
};
|
|
311
335
|
|
|
312
|
-
declare type
|
|
336
|
+
declare type TChartConfiguration = ChartConfiguration;
|
|
337
|
+
|
|
338
|
+
declare type TChartType = 'bar' | 'horizontalBar' | 'line' | 'pie' | 'doughnut' | 'radar' | 'polarArea' | 'bubble' | 'scatter' | 'stackedBar' | 'table' | 'kpi' | 'custom';
|
|
313
339
|
|
|
314
340
|
export declare type TDashboard = {
|
|
315
341
|
id: string;
|
|
@@ -318,6 +344,7 @@ export declare type TDashboard = {
|
|
|
318
344
|
sheets?: TSheet[];
|
|
319
345
|
style?: TStyle;
|
|
320
346
|
filters?: TFilter[];
|
|
347
|
+
customCards?: CustomCard[];
|
|
321
348
|
};
|
|
322
349
|
|
|
323
350
|
declare type TDataColumn = {
|
|
@@ -370,6 +397,34 @@ export declare function useActions(): {
|
|
|
370
397
|
setOnRemoveCard: (onRemoveCard: (card: TCard, sheetId: string) => void) => void;
|
|
371
398
|
};
|
|
372
399
|
|
|
400
|
+
export declare function useCard(cardId: string): {
|
|
401
|
+
data: any;
|
|
402
|
+
isError: boolean;
|
|
403
|
+
isLoading: boolean;
|
|
404
|
+
isFetching: boolean;
|
|
405
|
+
visualKey: number;
|
|
406
|
+
handleDatapointClick: (chart: Chart_2<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint | null)[], unknown>, datasetIndex: number, clickIndex: number, value: number) => void;
|
|
407
|
+
cfg: TChartConfiguration | undefined;
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
export declare function useDashboard({ id, version, authToken, customStyle, currentTheme, onSave, onEvent, customCards, }: UseDashboardProps): {
|
|
411
|
+
isLoading: boolean;
|
|
412
|
+
isError: boolean;
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
export declare const useDashboardActions: () => Actions;
|
|
416
|
+
|
|
417
|
+
declare type UseDashboardProps = {
|
|
418
|
+
id: string;
|
|
419
|
+
version?: string;
|
|
420
|
+
authToken: AuthToken | undefined;
|
|
421
|
+
customStyle?: TStyle;
|
|
422
|
+
currentTheme?: 'light' | 'dark' | 'system';
|
|
423
|
+
onSave?: (dashboard: TDashboard) => void;
|
|
424
|
+
onEvent?: (event: TEvent) => void;
|
|
425
|
+
customCards?: CustomCard[];
|
|
426
|
+
};
|
|
427
|
+
|
|
373
428
|
export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardStore>, "setState"> & {
|
|
374
429
|
setState(nextStateOrUpdater: DashboardStore | Partial<DashboardStore> | ((state: {
|
|
375
430
|
authToken?: {
|
|
@@ -433,6 +488,7 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
|
|
|
433
488
|
sql?: string | undefined;
|
|
434
489
|
data?: any[] | undefined;
|
|
435
490
|
cfg?: any;
|
|
491
|
+
childCards?: any[] | undefined;
|
|
436
492
|
customCfg?: any;
|
|
437
493
|
preferences?: {
|
|
438
494
|
filterOnClick?: boolean | undefined;
|
|
@@ -505,6 +561,12 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
|
|
|
505
561
|
database: string;
|
|
506
562
|
sql: string;
|
|
507
563
|
}[] | undefined;
|
|
564
|
+
customCards?: {
|
|
565
|
+
cardId: string;
|
|
566
|
+
component: FC<{
|
|
567
|
+
card: TCard;
|
|
568
|
+
}>;
|
|
569
|
+
}[] | undefined;
|
|
508
570
|
};
|
|
509
571
|
selectedSheetId?: string | null | undefined;
|
|
510
572
|
selectedCardId?: string | null | undefined;
|
|
@@ -517,6 +579,7 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
|
|
|
517
579
|
sql?: string | undefined;
|
|
518
580
|
data?: any[] | undefined;
|
|
519
581
|
cfg?: any;
|
|
582
|
+
childCards?: any[] | undefined;
|
|
520
583
|
customCfg?: any;
|
|
521
584
|
preferences?: {
|
|
522
585
|
filterOnClick?: boolean | undefined;
|
|
@@ -595,6 +658,7 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
|
|
|
595
658
|
onUpdateCard?: ((card: TCard, sheetId: string) => void) | undefined;
|
|
596
659
|
onRemoveCard?: ((card: TCard, sheetId: string) => void) | undefined;
|
|
597
660
|
actions: {
|
|
661
|
+
setCustomCards: (customCards: CustomCard[]) => void;
|
|
598
662
|
setAuthToken: (authToken: AuthToken) => void;
|
|
599
663
|
setThemeStyle: (themeStyle: StyleProps) => void;
|
|
600
664
|
setIsEditorSaveEvent: (isEditorSaveEvent: boolean) => void;
|
|
@@ -639,12 +703,15 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
|
|
|
639
703
|
getDashboard: () => TDashboard | undefined;
|
|
640
704
|
getSelectedSheet: () => TSheet | undefined;
|
|
641
705
|
getSelectedSheetCards: () => TCard[] | undefined;
|
|
706
|
+
getCard: (cardId: string) => TCard | undefined;
|
|
642
707
|
getSelectedCard: () => TCard | undefined;
|
|
643
708
|
getSelectedSheetLayout: () => ReactGridLayout.Layout[] | undefined;
|
|
644
709
|
};
|
|
645
710
|
}) => void), shouldReplace?: boolean | undefined): void;
|
|
646
711
|
}>;
|
|
647
712
|
|
|
713
|
+
export declare const useEditorActions: () => Actions_2;
|
|
714
|
+
|
|
648
715
|
export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "setState"> & {
|
|
649
716
|
setState(nextStateOrUpdater: EditorStore | Partial<EditorStore> | ((state: {
|
|
650
717
|
isShowingVisual: boolean;
|
|
@@ -698,6 +765,7 @@ export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "
|
|
|
698
765
|
sql?: string | undefined;
|
|
699
766
|
data?: any[] | undefined;
|
|
700
767
|
cfg?: any;
|
|
768
|
+
childCards?: any[] | undefined;
|
|
701
769
|
customCfg?: any;
|
|
702
770
|
preferences?: {
|
|
703
771
|
filterOnClick?: boolean | undefined;
|
|
@@ -784,4 +852,8 @@ export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "
|
|
|
784
852
|
}) => void), shouldReplace?: boolean | undefined): void;
|
|
785
853
|
}>;
|
|
786
854
|
|
|
855
|
+
export declare type WritableDraft<T> = {
|
|
856
|
+
-readonly [K in keyof T]: Draft<T[K]>;
|
|
857
|
+
};
|
|
858
|
+
|
|
787
859
|
export { }
|