semaphor 0.0.25 → 0.0.26

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,17 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  /// <reference types="react-grid-layout" />
3
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
4
  import { Draft } from 'immer';
9
5
  import { FC } from 'react';
10
6
  import { FontSpec } from 'chart.js';
11
7
  import { JSX as JSX_2 } from 'react/jsx-runtime';
12
8
  import { Layout } from 'react-grid-layout';
13
- import { Point } from 'chart.js';
14
- import { default as React_2 } from 'react';
15
9
  import { StoreApi } from 'zustand';
16
10
  import { UseBoundStore } from 'zustand';
17
11
 
@@ -21,26 +15,23 @@ declare type Actions = {
21
15
  setCustomCards: (customCards: CustomCard[]) => void;
22
16
  setAuthToken: (authToken: AuthToken) => void;
23
17
  setThemeStyle: (themeStyle: StyleProps) => void;
24
- setIsEditorSaveEvent: (isEditorSaveEvent: boolean) => void;
25
18
  setBookmarkKey: (bookmarkKey: string) => void;
26
19
  setDashboard: (dashboard: TDashboard) => void;
27
20
  setDashboardTheme: (theme: 'light' | 'dark' | 'system') => void;
28
- setDashboardTitle: (title: string) => void;
29
- setDashboardDescription: (description: string) => void;
30
21
  setSheets: (sheets: TSheet[]) => void;
31
- setSheetTitle: (sheetId: string, title: string) => void;
32
- setSheetDescription: (sheetId: string, description: string) => void;
33
22
  setSelectedSheetId: (sheetId: string | null) => void;
34
23
  setSheetLayout: (sheetId: string, layout: ReactGridLayout.Layout[]) => void;
35
- setCards: (sheetId: string, cards: TCard[]) => void;
36
24
  setSelectedCardId: (sheetId: string, cardId: string | null) => void;
37
- setSelectedCard: (card: TCard | null) => void;
25
+ setSelectedFrameId: (frameId: string) => void;
38
26
  setCardTitle: (sheetId: string, cardId: string, title: string) => void;
39
27
  setCardSql: (sheetId: string, cardId: string, sql: string) => void;
40
28
  setCardDescription: (sheetId: string, cardId: string, description: string) => void;
41
- setCardData: (sheetId: string, cardId: string, data: any[]) => void;
42
- addCard: (sheetId: string, card: TCard) => void;
29
+ setFrameCardData: (sheetId: string, cardId: string, data: any[]) => void;
30
+ addFrame: (sheetId: string, frame: TFrame) => void;
31
+ updateFrame: (sheetId: string, frame: TFrame) => void;
43
32
  updateCard: (sheetId: string, card: TCard) => void;
33
+ updateFrameCard?: (sheetId: string, frameId: string, card: TCard) => void;
34
+ removeFrame: (sheetId: string, frameId: string) => void;
44
35
  removeCard: (sheetId: string, card: TCard) => void;
45
36
  setIsDashboardEditing: (editing: boolean) => void;
46
37
  setShowContext: (show: boolean) => void;
@@ -63,9 +54,8 @@ declare type Actions = {
63
54
  setOnEvent: (onEvent: (event: TEvent) => void) => void;
64
55
  getDashboard: () => TDashboard | undefined;
65
56
  getSelectedSheet: () => TSheet | undefined;
66
- getSelectedSheetCards: () => TCard[] | undefined;
67
57
  getCard: (cardId: string) => TCard | undefined;
68
- getSelectedCard: () => TCard | undefined;
58
+ getSelectedFrame: () => TFrame | undefined;
69
59
  getSelectedSheetLayout: () => ReactGridLayout.Layout[] | undefined;
70
60
  handleDataPointClickAction: (card: TCard, dataPoint: any) => void;
71
61
  };
@@ -79,6 +69,7 @@ declare type Actions_2 = {
79
69
  setFilterOnClickField: (field: string) => void;
80
70
  setIsSqlRunning: (isSqlRunning: boolean) => void;
81
71
  setCard: (card: TCard) => void;
72
+ setFrame: (frame: TFrame) => void;
82
73
  setSqlGen: (sqlGen: SqlGen) => void;
83
74
  setSqlGenMeasure: (name: string, calc: AggregateCalc) => void;
84
75
  setSqlGenDimension: (dimension: string) => void;
@@ -99,7 +90,7 @@ declare type Actions_2 = {
99
90
  setOnDatabaseChange: (onDatabaseChange: (databaseName: string) => void) => void;
100
91
  setOnSchemaChange: (onSchemaChange: (schemaName: string) => void) => void;
101
92
  setOnTableChange: (onTableChange: (tableNmae: string) => void) => void;
102
- setOnSave: (onSave: (card: TCard) => void) => void;
93
+ setOnSave: (onSave: (card: TFrame) => void) => void;
103
94
  setOnClose: (onClose: () => void) => void;
104
95
  };
105
96
 
@@ -158,15 +149,6 @@ export declare type CustomCard = CardWithContent | CardWithFooter;
158
149
 
159
150
  export declare function Dashboard(props: DashboardProps): JSX_2.Element;
160
151
 
161
- export declare function DashboardCard({ card, footer, className, ...props }: DashboardCardProps): JSX_2.Element | null;
162
-
163
- declare type DashboardCardProps = {
164
- card: TCard;
165
- footer?: React_2.ReactNode;
166
- showControls?: boolean;
167
- fetchCardData?: boolean;
168
- } & React_2.HTMLAttributes<HTMLDivElement>;
169
-
170
152
  export declare function DashboardPlus({ showControls, showFooter, ...rest }: DashboardPlusProps): JSX_2.Element;
171
153
 
172
154
  declare type DashboardPlusProps = {
@@ -200,6 +182,7 @@ export declare type DashboardStore = {
200
182
  bookmarkKey?: string;
201
183
  dashboard: TDashboard;
202
184
  selectedSheetId?: string | null | undefined;
185
+ selectedFrameId?: string | null;
203
186
  selectedCardId?: string | null;
204
187
  selectedCard?: TCard | null;
205
188
  isDashboardEditing: boolean;
@@ -208,10 +191,9 @@ export declare type DashboardStore = {
208
191
  showDashboardJSON: boolean;
209
192
  showFilters: boolean;
210
193
  filterValues?: TFilterValue[];
211
- isEditorSaveEvent: boolean;
212
194
  onEvent?: (event: TEvent) => void;
213
195
  onSaveFunction?: (dashboard: TDashboard) => void;
214
- onAddCard?: (card: TCard, sheetId: string) => void;
196
+ onAddFrame?: (card: TFrame, sheetId: string) => void;
215
197
  onUpdateCard?: (card: TCard, sheetId: string) => void;
216
198
  onRemoveCard?: (card: TCard, sheetId: string) => void;
217
199
  actions: Actions;
@@ -227,6 +209,7 @@ declare type EditorStore = {
227
209
  isSqlRunning: boolean;
228
210
  actions: Actions_2;
229
211
  sqlGen: SqlGen;
212
+ frame: TFrame;
230
213
  card: TCard;
231
214
  showFilters: boolean;
232
215
  applyFilters: boolean;
@@ -240,7 +223,7 @@ declare type EditorStore = {
240
223
  onDatabaseChange?: (databaseName: string) => void;
241
224
  onTableChange?: (tableName: string) => void;
242
225
  onSchemaChange?: (schemaName: string) => void;
243
- onSave?: (card: TCard) => void;
226
+ onSave?: (card: TFrame) => void;
244
227
  onClose?: () => void;
245
228
  };
246
229
 
@@ -286,11 +269,16 @@ export declare function getColumnDataType(column: TDataColumn): string;
286
269
 
287
270
  export declare function getDashbaordStateWithoutData(dashboardState: TDashboard): {
288
271
  sheets: {
289
- cards: TCard[] | undefined;
272
+ frames: {
273
+ cards: TCard[];
274
+ id: string;
275
+ activeCardId: string;
276
+ }[] | undefined;
290
277
  id: string;
291
278
  title?: string | undefined;
292
279
  description?: string | undefined;
293
280
  layout?: Layout[] | undefined;
281
+ cards?: TCard[] | undefined;
294
282
  }[] | undefined;
295
283
  id: string;
296
284
  title?: string | undefined;
@@ -379,7 +367,6 @@ export declare type TCard = {
379
367
  sql?: string;
380
368
  data?: any[];
381
369
  cfg?: any;
382
- childCards?: any[];
383
370
  customCfg?: any;
384
371
  preferences?: TCardPreferences;
385
372
  lastSelectedDatabase?: string;
@@ -407,8 +394,6 @@ export declare type TCardPreferences = {
407
394
  };
408
395
  };
409
396
 
410
- declare type TChartConfiguration = ChartConfiguration;
411
-
412
397
  declare type TChartType = 'bar' | 'horizontalBar' | 'line' | 'pie' | 'doughnut' | 'radar' | 'polarArea' | 'bubble' | 'scatter' | 'stackedBar' | 'table' | 'kpi' | 'custom';
413
398
 
414
399
  export declare type TDashboard = {
@@ -447,12 +432,19 @@ declare type TFilter = {
447
432
 
448
433
  declare type TFilterValue = FilterForString | FilterForEqual | FilterForCompare | FilterForBetween | FilterForIn | FilterForDate;
449
434
 
435
+ export declare type TFrame = {
436
+ id: string;
437
+ cards: TCard[];
438
+ activeCardId: string;
439
+ };
440
+
450
441
  export declare type TSheet = {
451
442
  id: string;
452
443
  title?: string;
453
444
  description?: string;
454
445
  layout?: ReactGridLayout.Layout[];
455
446
  cards?: TCard[];
447
+ frames?: TFrame[];
456
448
  };
457
449
 
458
450
  /**
@@ -464,7 +456,6 @@ export declare type TStyle = {
464
456
  };
465
457
 
466
458
  export declare function useActions(): {
467
- setDashboardTitle: (title: string) => void;
468
459
  getStyle: () => TStyle | undefined;
469
460
  getDashboard: () => TDashboard | undefined;
470
461
  setOnSaveFunction: (onSaveFunction: (dashboard: TDashboard) => void) => void;
@@ -473,17 +464,6 @@ export declare function useActions(): {
473
464
  setOnRemoveCard: (onRemoveCard: (card: TCard, sheetId: string) => void) => void;
474
465
  };
475
466
 
476
- export declare function useCard(cardId: string): {
477
- data: any;
478
- card: TCard;
479
- isError: boolean;
480
- isLoading: boolean;
481
- isFetching: boolean;
482
- visualKey: number;
483
- handleDatapointClick: (chart: Chart_2<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint | null)[], unknown>, datasetIndex: number, clickIndex: number, value: number) => void;
484
- cfg: TChartConfiguration | undefined;
485
- };
486
-
487
467
  export declare function useDashboard({ id, version, authToken, customStyle, currentTheme, onSave, onEvent, }: UseDashboardProps): {
488
468
  isLoading: boolean;
489
469
  isError: boolean;
@@ -539,7 +519,6 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
539
519
  sql?: string | undefined;
540
520
  data?: any[] | undefined;
541
521
  cfg?: any;
542
- childCards?: any[] | undefined;
543
522
  customCfg?: any;
544
523
  preferences?: {
545
524
  filterOnClick?: boolean | undefined;
@@ -592,7 +571,6 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
592
571
  sql?: string | undefined;
593
572
  data?: any[] | undefined;
594
573
  cfg?: any;
595
- childCards?: any[] | undefined;
596
574
  customCfg?: any;
597
575
  preferences?: {
598
576
  filterOnClick?: boolean | undefined;
@@ -610,6 +588,36 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
610
588
  lastSelectedTable?: string | undefined;
611
589
  refreshInterval?: string | undefined;
612
590
  }[] | undefined;
591
+ frames?: {
592
+ id: string;
593
+ cards: {
594
+ id: string;
595
+ title: string;
596
+ description?: string | undefined;
597
+ connectionId?: string | undefined;
598
+ type: TChartType;
599
+ sql?: string | undefined;
600
+ data?: any[] | undefined;
601
+ cfg?: any;
602
+ customCfg?: any;
603
+ preferences?: {
604
+ filterOnClick?: boolean | undefined;
605
+ filterOnClickField?: string | undefined;
606
+ formatNumber?: {
607
+ format?: string | undefined;
608
+ currency?: string | undefined;
609
+ locale?: string | undefined;
610
+ suffix?: string | undefined;
611
+ enabled?: string | boolean | undefined;
612
+ } | undefined;
613
+ } | undefined;
614
+ lastSelectedDatabase?: string | undefined;
615
+ lastSelectedSchema?: string | undefined;
616
+ lastSelectedTable?: string | undefined;
617
+ refreshInterval?: string | undefined;
618
+ }[];
619
+ activeCardId: string;
620
+ }[] | undefined;
613
621
  }[] | undefined;
614
622
  style?: {
615
623
  default: {
@@ -686,6 +694,7 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
686
694
  })[] | undefined;
687
695
  };
688
696
  selectedSheetId?: string | null | undefined;
697
+ selectedFrameId?: string | null | undefined;
689
698
  selectedCardId?: string | null | undefined;
690
699
  selectedCard?: {
691
700
  id: string;
@@ -696,7 +705,6 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
696
705
  sql?: string | undefined;
697
706
  data?: any[] | undefined;
698
707
  cfg?: any;
699
- childCards?: any[] | undefined;
700
708
  customCfg?: any;
701
709
  preferences?: {
702
710
  filterOnClick?: boolean | undefined;
@@ -768,10 +776,9 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
768
776
  operation: "in" | "not in";
769
777
  values: (string | number)[];
770
778
  })[] | undefined;
771
- isEditorSaveEvent: boolean;
772
779
  onEvent?: ((event: TEvent) => void) | undefined;
773
780
  onSaveFunction?: ((dashboard: TDashboard) => void) | undefined;
774
- onAddCard?: ((card: TCard, sheetId: string) => void) | undefined;
781
+ onAddFrame?: ((card: TFrame, sheetId: string) => void) | undefined;
775
782
  onUpdateCard?: ((card: TCard, sheetId: string) => void) | undefined;
776
783
  onRemoveCard?: ((card: TCard, sheetId: string) => void) | undefined;
777
784
  actions: {
@@ -780,26 +787,23 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
780
787
  setCustomCards: (customCards: CustomCard[]) => void;
781
788
  setAuthToken: (authToken: AuthToken) => void;
782
789
  setThemeStyle: (themeStyle: StyleProps) => void;
783
- setIsEditorSaveEvent: (isEditorSaveEvent: boolean) => void;
784
790
  setBookmarkKey: (bookmarkKey: string) => void;
785
791
  setDashboard: (dashboard: TDashboard) => void;
786
792
  setDashboardTheme: (theme: 'light' | 'dark' | 'system') => void;
787
- setDashboardTitle: (title: string) => void;
788
- setDashboardDescription: (description: string) => void;
789
793
  setSheets: (sheets: TSheet[]) => void;
790
- setSheetTitle: (sheetId: string, title: string) => void;
791
- setSheetDescription: (sheetId: string, description: string) => void;
792
794
  setSelectedSheetId: (sheetId: string | null) => void;
793
795
  setSheetLayout: (sheetId: string, layout: ReactGridLayout.Layout[]) => void;
794
- setCards: (sheetId: string, cards: TCard[]) => void;
795
796
  setSelectedCardId: (sheetId: string, cardId: string | null) => void;
796
- setSelectedCard: (card: TCard | null) => void;
797
+ setSelectedFrameId: (frameId: string) => void;
797
798
  setCardTitle: (sheetId: string, cardId: string, title: string) => void;
798
799
  setCardSql: (sheetId: string, cardId: string, sql: string) => void;
799
800
  setCardDescription: (sheetId: string, cardId: string, description: string) => void;
800
- setCardData: (sheetId: string, cardId: string, data: any[]) => void;
801
- addCard: (sheetId: string, card: TCard) => void;
801
+ setFrameCardData: (sheetId: string, cardId: string, data: any[]) => void;
802
+ addFrame: (sheetId: string, frame: TFrame) => void;
803
+ updateFrame: (sheetId: string, frame: TFrame) => void;
802
804
  updateCard: (sheetId: string, card: TCard) => void;
805
+ updateFrameCard?: ((sheetId: string, frameId: string, card: TCard) => void) | undefined;
806
+ removeFrame: (sheetId: string, frameId: string) => void;
803
807
  removeCard: (sheetId: string, card: TCard) => void;
804
808
  setIsDashboardEditing: (editing: boolean) => void;
805
809
  setShowContext: (show: boolean) => void;
@@ -822,9 +826,8 @@ export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardSto
822
826
  setOnEvent: (onEvent: (event: TEvent) => void) => void;
823
827
  getDashboard: () => TDashboard | undefined;
824
828
  getSelectedSheet: () => TSheet | undefined;
825
- getSelectedSheetCards: () => TCard[] | undefined;
826
829
  getCard: (cardId: string) => TCard | undefined;
827
- getSelectedCard: () => TCard | undefined;
830
+ getSelectedFrame: () => TFrame | undefined;
828
831
  getSelectedSheetLayout: () => ReactGridLayout.Layout[] | undefined;
829
832
  handleDataPointClickAction: (card: TCard, dataPoint: any) => void;
830
833
  };
@@ -871,6 +874,7 @@ export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "
871
874
  setFilterOnClickField: (field: string) => void;
872
875
  setIsSqlRunning: (isSqlRunning: boolean) => void;
873
876
  setCard: (card: TCard) => void;
877
+ setFrame: (frame: TFrame) => void;
874
878
  setSqlGen: (sqlGen: SqlGen) => void;
875
879
  setSqlGenMeasure: (name: string, calc: AggregateCalc) => void;
876
880
  setSqlGenDimension: (dimension: string) => void;
@@ -891,7 +895,7 @@ export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "
891
895
  setOnDatabaseChange: (onDatabaseChange: (databaseName: string) => void) => void;
892
896
  setOnSchemaChange: (onSchemaChange: (schemaName: string) => void) => void;
893
897
  setOnTableChange: (onTableChange: (tableNmae: string) => void) => void;
894
- setOnSave: (onSave: (card: TCard) => void) => void;
898
+ setOnSave: (onSave: (card: TFrame) => void) => void;
895
899
  setOnClose: (onClose: () => void) => void;
896
900
  };
897
901
  sqlGen: {
@@ -901,6 +905,36 @@ export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "
901
905
  }[] | undefined;
902
906
  dimensions?: string[] | undefined;
903
907
  };
908
+ frame: {
909
+ id: string;
910
+ cards: {
911
+ id: string;
912
+ title: string;
913
+ description?: string | undefined;
914
+ connectionId?: string | undefined;
915
+ type: TChartType;
916
+ sql?: string | undefined;
917
+ data?: any[] | undefined;
918
+ cfg?: any;
919
+ customCfg?: any;
920
+ preferences?: {
921
+ filterOnClick?: boolean | undefined;
922
+ filterOnClickField?: string | undefined;
923
+ formatNumber?: {
924
+ format?: string | undefined;
925
+ currency?: string | undefined;
926
+ locale?: string | undefined;
927
+ suffix?: string | undefined;
928
+ enabled?: string | boolean | undefined;
929
+ } | undefined;
930
+ } | undefined;
931
+ lastSelectedDatabase?: string | undefined;
932
+ lastSelectedSchema?: string | undefined;
933
+ lastSelectedTable?: string | undefined;
934
+ refreshInterval?: string | undefined;
935
+ }[];
936
+ activeCardId: string;
937
+ };
904
938
  card: {
905
939
  id: string;
906
940
  title: string;
@@ -910,7 +944,6 @@ export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "
910
944
  sql?: string | undefined;
911
945
  data?: any[] | undefined;
912
946
  cfg?: any;
913
- childCards?: any[] | undefined;
914
947
  customCfg?: any;
915
948
  preferences?: {
916
949
  filterOnClick?: boolean | undefined;
@@ -992,7 +1025,7 @@ export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "
992
1025
  onDatabaseChange?: ((databaseName: string) => void) | undefined;
993
1026
  onTableChange?: ((tableName: string) => void) | undefined;
994
1027
  onSchemaChange?: ((schemaName: string) => void) | undefined;
995
- onSave?: ((card: TCard) => void) | undefined;
1028
+ onSave?: ((card: TFrame) => void) | undefined;
996
1029
  onClose?: (() => void) | undefined;
997
1030
  }) => void), shouldReplace?: boolean | undefined): void;
998
1031
  }>;