semaphor 0.0.96 → 0.0.99

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.
@@ -20,6 +20,8 @@ import { UseBoundStore } from 'zustand';
20
20
  import { WritableDraft } from 'immer';
21
21
 
22
22
  declare type Actions = {
23
+ setHandleOpenAssistantProfile: (handleOpenAssistantProfile: () => void) => void;
24
+ setFilterMode: (filterId: string, filterMode: 'include' | 'exclude') => void;
23
25
  setInitStore: () => void;
24
26
  setGlobalStyle: (style: TStyle) => void;
25
27
  setDefaultFilterValues: (filterValues: TFilterValue[] | undefined) => void;
@@ -98,8 +100,10 @@ declare type Actions = {
98
100
  setBaseQueries: (baseQueries: TBaseQuery[]) => void;
99
101
  };
100
102
 
101
- declare type Actions_2 = {
103
+ declare type Actions_2 = TableActions & {
104
+ setEditorFilterMode: (filterColumnName: string, filterMode: 'include' | 'exclude') => void;
102
105
  setLowerIsBetter: (lowerIsBetter: boolean) => void;
106
+ clearEditorFilter: (filterColumn: FilterByColumn) => void;
103
107
  removeEditorFilter: (filterColumn: FilterByColumn) => void;
104
108
  updateEditorFilterValue: (filterColumnName: string, filterValue: FilterValue, clearFilter?: boolean) => void;
105
109
  setTempQueryData: (tempQueryData: {
@@ -193,6 +197,8 @@ export declare type AIScopeTable = {
193
197
  datamodelName: string;
194
198
  };
195
199
 
200
+ export declare type AssistantId = 'dashboard-assistant' | 'editor-assistant';
201
+
196
202
  export declare type AuthToken = {
197
203
  accessToken: string;
198
204
  refreshToken?: string;
@@ -252,8 +258,42 @@ export declare type ColorRange = {
252
258
  color: string;
253
259
  };
254
260
 
261
+ declare interface ColorRange_2 {
262
+ min: number;
263
+ max: number;
264
+ color: string;
265
+ applyTo: 'cell' | 'row';
266
+ }
267
+
255
268
  export declare type ColumnRole = 'groupby' | 'trendby' | 'metric' | 'filter';
256
269
 
270
+ declare interface ColumnSettings {
271
+ type: 'none' | 'text' | 'number' | 'date' | 'badge' | 'link' | 'progress';
272
+ textAlign: 'left' | 'center' | 'right';
273
+ width: string;
274
+ textWrap: 'wrap' | 'nowrap';
275
+ numberFormat: {
276
+ style: 'decimal' | 'currency' | 'percent';
277
+ currency: string;
278
+ locale: string;
279
+ minimumFractionDigits: number;
280
+ maximumFractionDigits: number;
281
+ showDataBar: boolean;
282
+ dataBarColor: string;
283
+ dataBarMinValue?: number;
284
+ dataBarMaxValue?: number;
285
+ };
286
+ dateFormat: {
287
+ format: string;
288
+ useCustomFormat: boolean;
289
+ customFormat: string;
290
+ useRelativeTime: boolean;
291
+ };
292
+ colorRanges: ColorRange_2[];
293
+ }
294
+
295
+ declare type ColumnSettingsMap = Record<string, ColumnSettings>;
296
+
257
297
  export declare type ColumnType = 'string' | 'number' | 'date';
258
298
 
259
299
  declare type ComboBoxOption = {
@@ -274,6 +314,10 @@ export declare type CustomCard = CardWithContent | CardWithFooter;
274
314
 
275
315
  export declare function Dashboard(props: DashboardProps): JSX_2.Element;
276
316
 
317
+ export declare type DashboardEventHandlers = {
318
+ onExportData?: (payload: ExportDataPayload) => void;
319
+ };
320
+
277
321
  declare type DashboardPlusProps = {
278
322
  showControls?: boolean;
279
323
  showFooter?: boolean;
@@ -303,6 +347,7 @@ export declare type DashboardProps = {
303
347
  onFilterValuesChange?: (filterValues: TFilterValue[]) => void;
304
348
  LoadingComponent?: (props: LoadingProps) => React.ReactNode;
305
349
  ErrorComponent?: (props: ErrorProps) => React.ReactNode;
350
+ eventHandlers?: DashboardEventHandlers;
306
351
  /**
307
352
  * Placeholders for the dashboard.
308
353
  */
@@ -314,6 +359,7 @@ export declare type DashboardProps = {
314
359
  };
315
360
 
316
361
  export declare type DashboardStore = {
362
+ handleOpenAssistantProfile?: () => void;
317
363
  isDownloadingPdf?: boolean;
318
364
  isSessionExpired: boolean;
319
365
  authToken?: AuthToken;
@@ -359,7 +405,7 @@ export declare function downloadPdf(): Promise<void>;
359
405
 
360
406
  export declare type DroppableId = 'droppable-group-by' | 'droppable-metric';
361
407
 
362
- declare type EditorStore = {
408
+ export declare type EditorStore = {
363
409
  tempQueryData?: {
364
410
  queryKey: string[];
365
411
  queryData: any;
@@ -410,9 +456,17 @@ export declare type ErrorProps = {
410
456
  message?: string;
411
457
  };
412
458
 
459
+ export declare type ExportDataPayload = {
460
+ cardId: string;
461
+ title: string;
462
+ data: Record<string, any>[];
463
+ sql: string;
464
+ };
465
+
413
466
  export declare interface FilterByColumn extends BaseColumn {
414
467
  role: 'filter';
415
468
  operators?: string[];
469
+ mode?: 'include' | 'exclude';
416
470
  sql?: string;
417
471
  fetchValues?: boolean;
418
472
  fetchLimit?: number;
@@ -620,15 +674,16 @@ export declare interface QueryConfig {
620
674
  pivotColumns?: GroupByColumn[];
621
675
  metricColumns?: MetricColumn[];
622
676
  filterColumns?: FilterByColumn[];
623
- filters?: {
624
- filterColumnName: string;
625
- filterValue: FilterValue;
626
- exclude?: boolean;
627
- }[];
677
+ filters?: QueryFilter[];
628
678
  limit?: number;
629
679
  orderBy?: OrderBy[];
630
680
  }
631
681
 
682
+ export declare type QueryFilter = {
683
+ filterColumnName: string;
684
+ filterValue: FilterValue;
685
+ };
686
+
632
687
  export declare type RangeValue = {
633
688
  gte?: string | number;
634
689
  lte?: string | number;
@@ -728,6 +783,17 @@ export declare type StyleProps = {
728
783
 
729
784
  export declare function Surfboard({ showControls, showFooter, ...rest }: DashboardPlusProps): JSX_2.Element;
730
785
 
786
+ declare interface TableActions {
787
+ updateColumnSettingsMap: (columnSettings: ColumnSettingsMap) => void;
788
+ updateColumnVisibility: (columnId: string, isVisible: boolean) => void;
789
+ updatePageSize: (pageSize: number) => void;
790
+ showAllColumns: () => void;
791
+ hideAllColumns: () => void;
792
+ toggleSelectColumn: (isVisible: boolean) => void;
793
+ initializeColumnVisibility: (columnIds: string[]) => void;
794
+ updateAllColumnVisibility: (visibility: Record<string, boolean>) => void;
795
+ }
796
+
731
797
  export declare type TableConfig = {
732
798
  databaseName: string;
733
799
  schemaName: string;
@@ -735,6 +801,13 @@ export declare type TableConfig = {
735
801
  datamodelId: string;
736
802
  };
737
803
 
804
+ declare type TablePreferences = {
805
+ columnSettingsMap?: ColumnSettingsMap;
806
+ selectColumnVisible?: boolean;
807
+ columnVisibility?: Record<string, boolean>;
808
+ pageSize?: number;
809
+ };
810
+
738
811
  export declare type TBaseQuery = {
739
812
  id: string;
740
813
  name: string;
@@ -792,6 +865,7 @@ export declare type TCardPreferences = {
792
865
  datasetOptions?: TDatasetOptions[];
793
866
  chartOptions?: TChartOptions;
794
867
  columnSettings?: TColumnSetting<DisplayDataType>[];
868
+ tablePrefs?: TablePreferences;
795
869
  allowDownload?: boolean;
796
870
  customVisualCode?: string;
797
871
  textVisualOptions?: {
@@ -849,7 +923,7 @@ export declare type TChartOptions = {
849
923
  };
850
924
  };
851
925
 
852
- declare type TChartType = 'bar' | 'horizontalBar' | 'line' | 'pie' | 'doughnut' | 'radar' | 'polarArea' | 'bubble' | 'scatter' | 'stackedBar' | 'stackedLine' | 'table' | 'kpi' | 'pyramid' | 'range' | 'text' | 'map' | 'funnel' | 'custom';
926
+ declare type TChartType = 'bar' | 'horizontalBar' | 'line' | 'pie' | 'doughnut' | 'radar' | 'polarArea' | 'bubble' | 'scatter' | 'stackedBar' | 'stackedLine' | 'table' | 'kpi' | 'pyramid' | 'tornado' | 'range' | 'text' | 'map' | 'funnel' | 'custom';
853
927
 
854
928
  export declare type TColumnSetting<T extends DisplayDataType> = {
855
929
  columnIdx: number;
@@ -1059,6 +1133,7 @@ export declare function useEditorAside(token?: AuthToken, _connectionQueryKey?:
1059
1133
  handleDatamodelChange: (value: string) => void;
1060
1134
  handleDatabaseChange: (value: string) => void;
1061
1135
  handleSchemaChange: (value: string) => void;
1136
+ handleTableChange: (value: string) => void;
1062
1137
  };
1063
1138
 
1064
1139
  export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "setState"> & {
@@ -15,6 +15,8 @@ export declare type AIScopeTable = {
15
15
  datamodelName: string;
16
16
  };
17
17
 
18
+ export declare type AssistantId = 'dashboard-assistant' | 'editor-assistant';
19
+
18
20
  export declare type AuthToken = {
19
21
  accessToken: string;
20
22
  refreshToken?: string;
@@ -72,6 +74,40 @@ export declare type ColorRange = {
72
74
  color: string;
73
75
  };
74
76
 
77
+ declare interface ColorRange_2 {
78
+ min: number;
79
+ max: number;
80
+ color: string;
81
+ applyTo: 'cell' | 'row';
82
+ }
83
+
84
+ declare interface ColumnSettings {
85
+ type: 'none' | 'text' | 'number' | 'date' | 'badge' | 'link' | 'progress';
86
+ textAlign: 'left' | 'center' | 'right';
87
+ width: string;
88
+ textWrap: 'wrap' | 'nowrap';
89
+ numberFormat: {
90
+ style: 'decimal' | 'currency' | 'percent';
91
+ currency: string;
92
+ locale: string;
93
+ minimumFractionDigits: number;
94
+ maximumFractionDigits: number;
95
+ showDataBar: boolean;
96
+ dataBarColor: string;
97
+ dataBarMinValue?: number;
98
+ dataBarMaxValue?: number;
99
+ };
100
+ dateFormat: {
101
+ format: string;
102
+ useCustomFormat: boolean;
103
+ customFormat: string;
104
+ useRelativeTime: boolean;
105
+ };
106
+ colorRanges: ColorRange_2[];
107
+ }
108
+
109
+ declare type ColumnSettingsMap = Record<string, ColumnSettings>;
110
+
75
111
  declare type ColumnType = 'string' | 'number' | 'date';
76
112
 
77
113
  export declare type ConnectionPolicy = {
@@ -82,6 +118,10 @@ export declare type ConnectionPolicy = {
82
118
 
83
119
  export declare type CustomCard = CardWithContent | CardWithFooter;
84
120
 
121
+ export declare type DashboardEventHandlers = {
122
+ onExportData?: (payload: ExportDataPayload) => void;
123
+ };
124
+
85
125
  declare type DashboardPlusProps = {
86
126
  showControls?: boolean;
87
127
  showFooter?: boolean;
@@ -111,6 +151,7 @@ export declare type DashboardProps = {
111
151
  onFilterValuesChange?: (filterValues: TFilterValue[]) => void;
112
152
  LoadingComponent?: (props: LoadingProps) => React.ReactNode;
113
153
  ErrorComponent?: (props: ErrorProps) => React.ReactNode;
154
+ eventHandlers?: DashboardEventHandlers;
114
155
  /**
115
156
  * Placeholders for the dashboard.
116
157
  */
@@ -144,9 +185,17 @@ export declare type ErrorProps = {
144
185
  message?: string;
145
186
  };
146
187
 
188
+ export declare type ExportDataPayload = {
189
+ cardId: string;
190
+ title: string;
191
+ data: Record<string, any>[];
192
+ sql: string;
193
+ };
194
+
147
195
  declare interface FilterByColumn extends BaseColumn {
148
196
  role: 'filter';
149
197
  operators?: string[];
198
+ mode?: 'include' | 'exclude';
150
199
  sql?: string;
151
200
  fetchValues?: boolean;
152
201
  fetchLimit?: number;
@@ -288,15 +337,16 @@ declare interface QueryConfig {
288
337
  pivotColumns?: GroupByColumn[];
289
338
  metricColumns?: MetricColumn[];
290
339
  filterColumns?: FilterByColumn[];
291
- filters?: {
292
- filterColumnName: string;
293
- filterValue: FilterValue;
294
- exclude?: boolean;
295
- }[];
340
+ filters?: QueryFilter[];
296
341
  limit?: number;
297
342
  orderBy?: OrderBy[];
298
343
  }
299
344
 
345
+ declare type QueryFilter = {
346
+ filterColumnName: string;
347
+ filterValue: FilterValue;
348
+ };
349
+
300
350
  declare type RangeValue = {
301
351
  gte?: string | number;
302
352
  lte?: string | number;
@@ -361,6 +411,13 @@ export declare type StyleProps = {
361
411
 
362
412
  export declare function Surfboard({ showControls, showFooter, ...rest }: DashboardPlusProps): JSX_2.Element;
363
413
 
414
+ declare type TablePreferences = {
415
+ columnSettingsMap?: ColumnSettingsMap;
416
+ selectColumnVisible?: boolean;
417
+ columnVisibility?: Record<string, boolean>;
418
+ pageSize?: number;
419
+ };
420
+
364
421
  export declare type TBaseQuery = {
365
422
  id: string;
366
423
  name: string;
@@ -418,6 +475,7 @@ export declare type TCardPreferences = {
418
475
  datasetOptions?: TDatasetOptions[];
419
476
  chartOptions?: TChartOptions;
420
477
  columnSettings?: TColumnSetting<DisplayDataType>[];
478
+ tablePrefs?: TablePreferences;
421
479
  allowDownload?: boolean;
422
480
  customVisualCode?: string;
423
481
  textVisualOptions?: {
@@ -473,7 +531,7 @@ export declare type TChartOptions = {
473
531
  };
474
532
  };
475
533
 
476
- declare type TChartType = 'bar' | 'horizontalBar' | 'line' | 'pie' | 'doughnut' | 'radar' | 'polarArea' | 'bubble' | 'scatter' | 'stackedBar' | 'stackedLine' | 'table' | 'kpi' | 'pyramid' | 'range' | 'text' | 'map' | 'funnel' | 'custom';
534
+ declare type TChartType = 'bar' | 'horizontalBar' | 'line' | 'pie' | 'doughnut' | 'radar' | 'polarArea' | 'bubble' | 'scatter' | 'stackedBar' | 'stackedLine' | 'table' | 'kpi' | 'pyramid' | 'tornado' | 'range' | 'text' | 'map' | 'funnel' | 'custom';
477
535
 
478
536
  export declare type TColumnSetting<T extends DisplayDataType> = {
479
537
  columnIdx: number;
@@ -14,6 +14,8 @@ export declare type AIScopeTable = {
14
14
  datamodelName: string;
15
15
  };
16
16
 
17
+ export declare type AssistantId = 'dashboard-assistant' | 'editor-assistant';
18
+
17
19
  export declare type AuthToken = {
18
20
  accessToken: string;
19
21
  refreshToken?: string;
@@ -71,6 +73,40 @@ export declare type ColorRange = {
71
73
  color: string;
72
74
  };
73
75
 
76
+ declare interface ColorRange_2 {
77
+ min: number;
78
+ max: number;
79
+ color: string;
80
+ applyTo: 'cell' | 'row';
81
+ }
82
+
83
+ declare interface ColumnSettings {
84
+ type: 'none' | 'text' | 'number' | 'date' | 'badge' | 'link' | 'progress';
85
+ textAlign: 'left' | 'center' | 'right';
86
+ width: string;
87
+ textWrap: 'wrap' | 'nowrap';
88
+ numberFormat: {
89
+ style: 'decimal' | 'currency' | 'percent';
90
+ currency: string;
91
+ locale: string;
92
+ minimumFractionDigits: number;
93
+ maximumFractionDigits: number;
94
+ showDataBar: boolean;
95
+ dataBarColor: string;
96
+ dataBarMinValue?: number;
97
+ dataBarMaxValue?: number;
98
+ };
99
+ dateFormat: {
100
+ format: string;
101
+ useCustomFormat: boolean;
102
+ customFormat: string;
103
+ useRelativeTime: boolean;
104
+ };
105
+ colorRanges: ColorRange_2[];
106
+ }
107
+
108
+ declare type ColumnSettingsMap = Record<string, ColumnSettings>;
109
+
74
110
  declare type ColumnType = 'string' | 'number' | 'date';
75
111
 
76
112
  export declare type ConnectionPolicy = {
@@ -81,6 +117,10 @@ export declare type ConnectionPolicy = {
81
117
 
82
118
  export declare type CustomCard = CardWithContent | CardWithFooter;
83
119
 
120
+ export declare type DashboardEventHandlers = {
121
+ onExportData?: (payload: ExportDataPayload) => void;
122
+ };
123
+
84
124
  export declare type DashboardProps = {
85
125
  id?: string;
86
126
  /**
@@ -105,6 +145,7 @@ export declare type DashboardProps = {
105
145
  onFilterValuesChange?: (filterValues: TFilterValue[]) => void;
106
146
  LoadingComponent?: (props: LoadingProps) => React.ReactNode;
107
147
  ErrorComponent?: (props: ErrorProps) => React.ReactNode;
148
+ eventHandlers?: DashboardEventHandlers;
108
149
  /**
109
150
  * Placeholders for the dashboard.
110
151
  */
@@ -138,9 +179,17 @@ export declare type ErrorProps = {
138
179
  message?: string;
139
180
  };
140
181
 
182
+ export declare type ExportDataPayload = {
183
+ cardId: string;
184
+ title: string;
185
+ data: Record<string, any>[];
186
+ sql: string;
187
+ };
188
+
141
189
  declare interface FilterByColumn extends BaseColumn {
142
190
  role: 'filter';
143
191
  operators?: string[];
192
+ mode?: 'include' | 'exclude';
144
193
  sql?: string;
145
194
  fetchValues?: boolean;
146
195
  fetchLimit?: number;
@@ -282,15 +331,16 @@ declare interface QueryConfig {
282
331
  pivotColumns?: GroupByColumn[];
283
332
  metricColumns?: MetricColumn[];
284
333
  filterColumns?: FilterByColumn[];
285
- filters?: {
286
- filterColumnName: string;
287
- filterValue: FilterValue;
288
- exclude?: boolean;
289
- }[];
334
+ filters?: QueryFilter[];
290
335
  limit?: number;
291
336
  orderBy?: OrderBy[];
292
337
  }
293
338
 
339
+ declare type QueryFilter = {
340
+ filterColumnName: string;
341
+ filterValue: FilterValue;
342
+ };
343
+
294
344
  declare type RangeValue = {
295
345
  gte?: string | number;
296
346
  lte?: string | number;
@@ -353,6 +403,13 @@ export declare type StyleProps = {
353
403
  };
354
404
  };
355
405
 
406
+ declare type TablePreferences = {
407
+ columnSettingsMap?: ColumnSettingsMap;
408
+ selectColumnVisible?: boolean;
409
+ columnVisibility?: Record<string, boolean>;
410
+ pageSize?: number;
411
+ };
412
+
356
413
  export declare type TBaseQuery = {
357
414
  id: string;
358
415
  name: string;
@@ -410,6 +467,7 @@ export declare type TCardPreferences = {
410
467
  datasetOptions?: TDatasetOptions[];
411
468
  chartOptions?: TChartOptions;
412
469
  columnSettings?: TColumnSetting<DisplayDataType>[];
470
+ tablePrefs?: TablePreferences;
413
471
  allowDownload?: boolean;
414
472
  customVisualCode?: string;
415
473
  textVisualOptions?: {
@@ -465,7 +523,7 @@ export declare type TChartOptions = {
465
523
  };
466
524
  };
467
525
 
468
- declare type TChartType = 'bar' | 'horizontalBar' | 'line' | 'pie' | 'doughnut' | 'radar' | 'polarArea' | 'bubble' | 'scatter' | 'stackedBar' | 'stackedLine' | 'table' | 'kpi' | 'pyramid' | 'range' | 'text' | 'map' | 'funnel' | 'custom';
526
+ declare type TChartType = 'bar' | 'horizontalBar' | 'line' | 'pie' | 'doughnut' | 'radar' | 'polarArea' | 'bubble' | 'scatter' | 'stackedBar' | 'stackedLine' | 'table' | 'kpi' | 'pyramid' | 'tornado' | 'range' | 'text' | 'map' | 'funnel' | 'custom';
469
527
 
470
528
  export declare type TColumnSetting<T extends DisplayDataType> = {
471
529
  columnIdx: number;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.0.96",
8
+ "version": "0.0.99",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -67,7 +67,7 @@
67
67
  "@radix-ui/react-scroll-area": "^1.2.2",
68
68
  "@radix-ui/react-select": "^2.1.4",
69
69
  "@radix-ui/react-separator": "^1.1.1",
70
- "@radix-ui/react-slot": "^1.1.1",
70
+ "@radix-ui/react-slot": "^1.2.2",
71
71
  "@radix-ui/react-switch": "^1.1.2",
72
72
  "@radix-ui/react-tabs": "^1.1.2",
73
73
  "@radix-ui/react-toggle": "^1.1.1",