semaphor 0.0.97 → 0.0.100

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.
@@ -100,7 +100,7 @@ declare type Actions = {
100
100
  setBaseQueries: (baseQueries: TBaseQuery[]) => void;
101
101
  };
102
102
 
103
- declare type Actions_2 = {
103
+ declare type Actions_2 = TableActions & {
104
104
  setEditorFilterMode: (filterColumnName: string, filterMode: 'include' | 'exclude') => void;
105
105
  setLowerIsBetter: (lowerIsBetter: boolean) => void;
106
106
  clearEditorFilter: (filterColumn: FilterByColumn) => void;
@@ -258,8 +258,42 @@ export declare type ColorRange = {
258
258
  color: string;
259
259
  };
260
260
 
261
+ declare interface ColorRange_2 {
262
+ min: number;
263
+ max: number;
264
+ color: string;
265
+ applyTo: 'cell' | 'row';
266
+ }
267
+
261
268
  export declare type ColumnRole = 'groupby' | 'trendby' | 'metric' | 'filter';
262
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
+
263
297
  export declare type ColumnType = 'string' | 'number' | 'date';
264
298
 
265
299
  declare type ComboBoxOption = {
@@ -280,6 +314,10 @@ export declare type CustomCard = CardWithContent | CardWithFooter;
280
314
 
281
315
  export declare function Dashboard(props: DashboardProps): JSX_2.Element;
282
316
 
317
+ export declare type DashboardEventHandlers = {
318
+ onExportData?: (payload: ExportDataPayload) => void;
319
+ };
320
+
283
321
  declare type DashboardPlusProps = {
284
322
  showControls?: boolean;
285
323
  showFooter?: boolean;
@@ -309,6 +347,7 @@ export declare type DashboardProps = {
309
347
  onFilterValuesChange?: (filterValues: TFilterValue[]) => void;
310
348
  LoadingComponent?: (props: LoadingProps) => React.ReactNode;
311
349
  ErrorComponent?: (props: ErrorProps) => React.ReactNode;
350
+ eventHandlers?: DashboardEventHandlers;
312
351
  /**
313
352
  * Placeholders for the dashboard.
314
353
  */
@@ -366,7 +405,7 @@ export declare function downloadPdf(): Promise<void>;
366
405
 
367
406
  export declare type DroppableId = 'droppable-group-by' | 'droppable-metric';
368
407
 
369
- declare type EditorStore = {
408
+ export declare type EditorStore = {
370
409
  tempQueryData?: {
371
410
  queryKey: string[];
372
411
  queryData: any;
@@ -417,6 +456,13 @@ export declare type ErrorProps = {
417
456
  message?: string;
418
457
  };
419
458
 
459
+ export declare type ExportDataPayload = {
460
+ cardId: string;
461
+ title: string;
462
+ data: Record<string, any>[];
463
+ sql: string;
464
+ };
465
+
420
466
  export declare interface FilterByColumn extends BaseColumn {
421
467
  role: 'filter';
422
468
  operators?: string[];
@@ -737,6 +783,17 @@ export declare type StyleProps = {
737
783
 
738
784
  export declare function Surfboard({ showControls, showFooter, ...rest }: DashboardPlusProps): JSX_2.Element;
739
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
+
740
797
  export declare type TableConfig = {
741
798
  databaseName: string;
742
799
  schemaName: string;
@@ -744,6 +801,13 @@ export declare type TableConfig = {
744
801
  datamodelId: string;
745
802
  };
746
803
 
804
+ declare type TablePreferences = {
805
+ columnSettingsMap?: ColumnSettingsMap;
806
+ selectColumnVisible?: boolean;
807
+ columnVisibility?: Record<string, boolean>;
808
+ pageSize?: number;
809
+ };
810
+
747
811
  export declare type TBaseQuery = {
748
812
  id: string;
749
813
  name: string;
@@ -801,6 +865,7 @@ export declare type TCardPreferences = {
801
865
  datasetOptions?: TDatasetOptions[];
802
866
  chartOptions?: TChartOptions;
803
867
  columnSettings?: TColumnSetting<DisplayDataType>[];
868
+ tablePrefs?: TablePreferences;
804
869
  allowDownload?: boolean;
805
870
  customVisualCode?: string;
806
871
  textVisualOptions?: {
@@ -1068,6 +1133,7 @@ export declare function useEditorAside(token?: AuthToken, _connectionQueryKey?:
1068
1133
  handleDatamodelChange: (value: string) => void;
1069
1134
  handleDatabaseChange: (value: string) => void;
1070
1135
  handleSchemaChange: (value: string) => void;
1136
+ handleTableChange: (value: string) => void;
1071
1137
  };
1072
1138
 
1073
1139
  export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "setState"> & {
@@ -74,6 +74,40 @@ export declare type ColorRange = {
74
74
  color: string;
75
75
  };
76
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
+
77
111
  declare type ColumnType = 'string' | 'number' | 'date';
78
112
 
79
113
  export declare type ConnectionPolicy = {
@@ -84,6 +118,10 @@ export declare type ConnectionPolicy = {
84
118
 
85
119
  export declare type CustomCard = CardWithContent | CardWithFooter;
86
120
 
121
+ export declare type DashboardEventHandlers = {
122
+ onExportData?: (payload: ExportDataPayload) => void;
123
+ };
124
+
87
125
  declare type DashboardPlusProps = {
88
126
  showControls?: boolean;
89
127
  showFooter?: boolean;
@@ -113,6 +151,7 @@ export declare type DashboardProps = {
113
151
  onFilterValuesChange?: (filterValues: TFilterValue[]) => void;
114
152
  LoadingComponent?: (props: LoadingProps) => React.ReactNode;
115
153
  ErrorComponent?: (props: ErrorProps) => React.ReactNode;
154
+ eventHandlers?: DashboardEventHandlers;
116
155
  /**
117
156
  * Placeholders for the dashboard.
118
157
  */
@@ -146,6 +185,13 @@ export declare type ErrorProps = {
146
185
  message?: string;
147
186
  };
148
187
 
188
+ export declare type ExportDataPayload = {
189
+ cardId: string;
190
+ title: string;
191
+ data: Record<string, any>[];
192
+ sql: string;
193
+ };
194
+
149
195
  declare interface FilterByColumn extends BaseColumn {
150
196
  role: 'filter';
151
197
  operators?: string[];
@@ -365,6 +411,13 @@ export declare type StyleProps = {
365
411
 
366
412
  export declare function Surfboard({ showControls, showFooter, ...rest }: DashboardPlusProps): JSX_2.Element;
367
413
 
414
+ declare type TablePreferences = {
415
+ columnSettingsMap?: ColumnSettingsMap;
416
+ selectColumnVisible?: boolean;
417
+ columnVisibility?: Record<string, boolean>;
418
+ pageSize?: number;
419
+ };
420
+
368
421
  export declare type TBaseQuery = {
369
422
  id: string;
370
423
  name: string;
@@ -422,6 +475,7 @@ export declare type TCardPreferences = {
422
475
  datasetOptions?: TDatasetOptions[];
423
476
  chartOptions?: TChartOptions;
424
477
  columnSettings?: TColumnSetting<DisplayDataType>[];
478
+ tablePrefs?: TablePreferences;
425
479
  allowDownload?: boolean;
426
480
  customVisualCode?: string;
427
481
  textVisualOptions?: {
@@ -73,6 +73,40 @@ export declare type ColorRange = {
73
73
  color: string;
74
74
  };
75
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
+
76
110
  declare type ColumnType = 'string' | 'number' | 'date';
77
111
 
78
112
  export declare type ConnectionPolicy = {
@@ -83,6 +117,10 @@ export declare type ConnectionPolicy = {
83
117
 
84
118
  export declare type CustomCard = CardWithContent | CardWithFooter;
85
119
 
120
+ export declare type DashboardEventHandlers = {
121
+ onExportData?: (payload: ExportDataPayload) => void;
122
+ };
123
+
86
124
  export declare type DashboardProps = {
87
125
  id?: string;
88
126
  /**
@@ -107,6 +145,7 @@ export declare type DashboardProps = {
107
145
  onFilterValuesChange?: (filterValues: TFilterValue[]) => void;
108
146
  LoadingComponent?: (props: LoadingProps) => React.ReactNode;
109
147
  ErrorComponent?: (props: ErrorProps) => React.ReactNode;
148
+ eventHandlers?: DashboardEventHandlers;
110
149
  /**
111
150
  * Placeholders for the dashboard.
112
151
  */
@@ -140,6 +179,13 @@ export declare type ErrorProps = {
140
179
  message?: string;
141
180
  };
142
181
 
182
+ export declare type ExportDataPayload = {
183
+ cardId: string;
184
+ title: string;
185
+ data: Record<string, any>[];
186
+ sql: string;
187
+ };
188
+
143
189
  declare interface FilterByColumn extends BaseColumn {
144
190
  role: 'filter';
145
191
  operators?: string[];
@@ -357,6 +403,13 @@ export declare type StyleProps = {
357
403
  };
358
404
  };
359
405
 
406
+ declare type TablePreferences = {
407
+ columnSettingsMap?: ColumnSettingsMap;
408
+ selectColumnVisible?: boolean;
409
+ columnVisibility?: Record<string, boolean>;
410
+ pageSize?: number;
411
+ };
412
+
360
413
  export declare type TBaseQuery = {
361
414
  id: string;
362
415
  name: string;
@@ -414,6 +467,7 @@ export declare type TCardPreferences = {
414
467
  datasetOptions?: TDatasetOptions[];
415
468
  chartOptions?: TChartOptions;
416
469
  columnSettings?: TColumnSetting<DisplayDataType>[];
470
+ tablePrefs?: TablePreferences;
417
471
  allowDownload?: boolean;
418
472
  customVisualCode?: string;
419
473
  textVisualOptions?: {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.0.97",
8
+ "version": "0.0.100",
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",