react-semaphor 0.0.417 → 0.0.418

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.
@@ -96,6 +96,28 @@ declare type Actions = {
96
96
  };
97
97
 
98
98
  declare type Actions_2 = {
99
+ setTempQueryData: (tempQueryData: {
100
+ queryKey: string[];
101
+ queryData: any;
102
+ }) => void;
103
+ clearQueryConfig: () => void;
104
+ setIsDevMode: (isDevMode: boolean) => void;
105
+ setGroupByColumns: (groupByColumns: GroupByColumn[]) => void;
106
+ setMetricColumns: (metricColumns: MetricColumn[]) => void;
107
+ removeColumnFromGroupBy: (columnId: string) => void;
108
+ removeColumnFromMetricColumns: (columnId: string) => void;
109
+ addColumnToGroupBy: (column: GroupByColumn) => void;
110
+ addColumnToMetricColumns: (column: MetricColumn) => void;
111
+ setTrendByColumns: (trendByColumns: TrendByColumn[]) => void;
112
+ addColumnToTrendByColumns: (column: TrendByColumn) => void;
113
+ removeColumnFromTrendByColumns: (columnId: string) => void;
114
+ setFilterColumns: (filterColumns: FilterByColumn[]) => void;
115
+ addColumnToFilterColumns: (column: FilterByColumn) => void;
116
+ removeColumnFromFilterColumns: (columnId: string) => void;
117
+ updateMetricColumn: (columnId: string, column: MetricColumn) => void;
118
+ updateGroupByColumn: (columnId: string, column: GroupByColumn) => void;
119
+ updateTrendByColumn: (columnId: string, column: TrendByColumn) => void;
120
+ updateFilterColumn: (columnId: string, column: FilterByColumn) => void;
99
121
  setCurrentAssitantScope: (currentAssitantScope: AIScopeTable[]) => void;
100
122
  setChartGrid: (chartGrid: 'xy' | 'x' | 'y' | 'none') => void;
101
123
  setLegendOptions: (legendOptions: TLegendOptions) => void;
@@ -139,7 +161,6 @@ declare type Actions_2 = {
139
161
  setSelectedDatabaseName: (databaseName: string) => void;
140
162
  setSelectedSchemaName: (schemaName: string) => void;
141
163
  setSelectedTableName: (tableName: string) => void;
142
- setCurrentColumns: (columns: TDataColumn[]) => void;
143
164
  setOnConnectionChange: (onConnectionChange: (connectionId: string) => void) => void;
144
165
  setOnDatabaseChange: (onDatabaseChange: (databaseName: string) => void) => void;
145
166
  setOnSchemaChange: (onSchemaChange: (schemaName: string) => void) => void;
@@ -150,6 +171,8 @@ declare type Actions_2 = {
150
171
 
151
172
  export declare type AggregateCalc = 'AVG' | 'MIN' | 'MAX' | 'SUM' | 'COUNT' | 'COUNT_DISTINCT';
152
173
 
174
+ export declare type AggregateFunction = 'SUM' | 'AVG' | 'COUNT' | 'MAX' | 'MIN' | 'DISTINCT';
175
+
153
176
  export declare type AIScopeTable = {
154
177
  connectionId: string;
155
178
  connectionType: string;
@@ -165,6 +188,14 @@ export declare type AuthToken = {
165
188
  refreshToken?: string;
166
189
  };
167
190
 
191
+ export declare interface BaseColumn {
192
+ id: string;
193
+ name: string;
194
+ label?: string;
195
+ type: ColumnType;
196
+ table?: string;
197
+ }
198
+
168
199
  declare type BaseCustomCard = {
169
200
  cardId: string;
170
201
  replaceDefault?: boolean;
@@ -211,6 +242,10 @@ export declare type ColorRange = {
211
242
  color: string;
212
243
  };
213
244
 
245
+ export declare type ColumnRole = 'groupby' | 'trendby' | 'metric' | 'filter';
246
+
247
+ export declare type ColumnType = 'string' | 'number' | 'date';
248
+
214
249
  export declare type ConnectionPolicy = {
215
250
  connectionId?: string;
216
251
  name: string;
@@ -306,7 +341,14 @@ export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'n
306
341
 
307
342
  export declare function downloadPdf(): Promise<void>;
308
343
 
344
+ export declare type DroppableId = 'droppable-group-by' | 'droppable-metric';
345
+
309
346
  declare type EditorStore = {
347
+ tempQueryData?: {
348
+ queryKey: string[];
349
+ queryData: any;
350
+ };
351
+ isDevMode: boolean;
310
352
  isShowingVisual: boolean;
311
353
  showAIDialog: boolean;
312
354
  userInputForAI: string;
@@ -329,7 +371,6 @@ declare type EditorStore = {
329
371
  selectedDatabaseName?: string;
330
372
  selectedSchemaName?: string;
331
373
  selectedTableName?: string;
332
- currentColumns?: TDataColumn[];
333
374
  currentAssitantScope?: AIScopeTable[];
334
375
  onConnectionChange?: (connectionId: string) => void;
335
376
  onDatamodelChange?: (datamodelId: string) => void;
@@ -351,6 +392,11 @@ export declare type ErrorProps = {
351
392
  message?: string;
352
393
  };
353
394
 
395
+ export declare interface FilterByColumn extends BaseColumn {
396
+ role: 'filter';
397
+ operators?: string[];
398
+ }
399
+
354
400
  declare type FilterForBetween = BaseFilter & {
355
401
  operation: 'between' | 'not between';
356
402
  values: [number, number];
@@ -388,6 +434,13 @@ declare type FilterOnClick = {
388
434
  columnIndex: number;
389
435
  };
390
436
 
437
+ export declare type FilterValue = string | number | (string | number)[] | {
438
+ gte?: string | number;
439
+ lte?: string | number;
440
+ lt?: string | number;
441
+ gt?: string | number;
442
+ };
443
+
391
444
  export declare function fmt(str: string): string;
392
445
 
393
446
  export declare function getColumnDataType(column: TDataColumn): string;
@@ -453,6 +506,10 @@ export declare function getQualifiedTableName({ schemaName, tableName, connectio
453
506
 
454
507
  export declare function getSql(config: SqlGen, schemaName: string, tableName: string, modelName: string, connectionType: string, databaseName: string): string | undefined;
455
508
 
509
+ export declare interface GroupByColumn extends BaseColumn {
510
+ role: 'groupby';
511
+ }
512
+
456
513
  export declare type HtmlOptions = {
457
514
  html: string;
458
515
  };
@@ -479,6 +536,11 @@ export declare type LoadingProps = {
479
536
  message?: string;
480
537
  };
481
538
 
539
+ export declare interface MetricColumn extends BaseColumn {
540
+ role: 'metric';
541
+ aggregate: AggregateFunction;
542
+ }
543
+
482
544
  declare type NoneOptions = {};
483
545
 
484
546
  export declare type NumberAxisFormat = {
@@ -520,6 +582,18 @@ export declare type Placeholders = {
520
582
  SessionExpired?: React.ReactNode;
521
583
  };
522
584
 
585
+ export declare type QueryColumn = GroupByColumn | TrendByColumn | MetricColumn | FilterByColumn;
586
+
587
+ export declare interface QueryConfig {
588
+ groupByColumns?: GroupByColumn[];
589
+ trendByColumns?: TrendByColumn[];
590
+ metricColumns?: MetricColumn[];
591
+ filterColumns?: FilterByColumn[];
592
+ filters?: Record<string, FilterValue>;
593
+ limit?: number;
594
+ orderBy?: string[];
595
+ }
596
+
523
597
  export declare function resolveDatamodelName(datamodelName: string): string;
524
598
 
525
599
  export declare const resolveDataType: (value: any) => string;
@@ -528,7 +602,7 @@ export declare function ScheduleDashboard({ triggerButtonClassName, }: {
528
602
  triggerButtonClassName?: string;
529
603
  }): JSX_2.Element;
530
604
 
531
- export declare function SelectComponent({ title, items, value, isLoading, isError, refetch, connectionTooltip, onChange, showNone, className, disabled, type, }: SelectProps): JSX_2.Element;
605
+ export declare function SelectComponent({ title, items, value, isLoading, isError, refetch, onChange, showNone, className, disabled, type, }: SelectProps): JSX_2.Element;
532
606
 
533
607
  declare type SelectProps = {
534
608
  title: string;
@@ -610,6 +684,13 @@ export declare type StyleProps = {
610
684
 
611
685
  export declare function Surfboard({ showControls, showFooter, ...rest }: DashboardPlusProps): JSX_2.Element;
612
686
 
687
+ export declare type TableConfig = {
688
+ databaseName: string;
689
+ schemaName: string;
690
+ tableName: string;
691
+ datamodelId: string;
692
+ };
693
+
613
694
  export declare type TBaseQuery = {
614
695
  id: string;
615
696
  name: string;
@@ -631,6 +712,7 @@ export declare type TCard = {
631
712
  type: TChartType;
632
713
  sql?: string;
633
714
  python?: string;
715
+ queryConfig?: QueryConfig;
634
716
  customCfg?: any;
635
717
  preferences?: TCardPreferences;
636
718
  customCardPreferences?: TCustomCardPreferences;
@@ -831,6 +913,10 @@ export declare type TLens = {
831
913
  shared?: boolean;
832
914
  };
833
915
 
916
+ export declare interface TrendByColumn extends BaseColumn {
917
+ role: 'trendby';
918
+ }
919
+
834
920
  export declare type TSelectedRecord = {
835
921
  id: number | string;
836
922
  value: string;
@@ -3,6 +3,8 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
3
3
 
4
4
  export declare type AggregateCalc = 'AVG' | 'MIN' | 'MAX' | 'SUM' | 'COUNT' | 'COUNT_DISTINCT';
5
5
 
6
+ declare type AggregateFunction = 'SUM' | 'AVG' | 'COUNT' | 'MAX' | 'MIN' | 'DISTINCT';
7
+
6
8
  export declare type AIScopeTable = {
7
9
  connectionId: string;
8
10
  connectionType: string;
@@ -18,6 +20,14 @@ export declare type AuthToken = {
18
20
  refreshToken?: string;
19
21
  };
20
22
 
23
+ declare interface BaseColumn {
24
+ id: string;
25
+ name: string;
26
+ label?: string;
27
+ type: ColumnType;
28
+ table?: string;
29
+ }
30
+
21
31
  declare type BaseCustomCard = {
22
32
  cardId: string;
23
33
  replaceDefault?: boolean;
@@ -62,6 +72,8 @@ export declare type ColorRange = {
62
72
  color: string;
63
73
  };
64
74
 
75
+ declare type ColumnType = 'string' | 'number' | 'date';
76
+
65
77
  export declare type ConnectionPolicy = {
66
78
  connectionId?: string;
67
79
  name: string;
@@ -117,6 +129,8 @@ export declare type DateOptions = {
117
129
 
118
130
  export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'none';
119
131
 
132
+ export declare type DroppableId = 'droppable-group-by' | 'droppable-metric';
133
+
120
134
  export declare type EmailSettings = {
121
135
  companyName: string;
122
136
  dashboardUrl: string;
@@ -128,6 +142,11 @@ export declare type ErrorProps = {
128
142
  message?: string;
129
143
  };
130
144
 
145
+ declare interface FilterByColumn extends BaseColumn {
146
+ role: 'filter';
147
+ operators?: string[];
148
+ }
149
+
131
150
  declare type FilterForBetween = BaseFilter & {
132
151
  operation: 'between' | 'not between';
133
152
  values: [number, number];
@@ -165,6 +184,13 @@ declare type FilterOnClick = {
165
184
  columnIndex: number;
166
185
  };
167
186
 
187
+ declare type FilterValue = string | number | (string | number)[] | {
188
+ gte?: string | number;
189
+ lte?: string | number;
190
+ lt?: string | number;
191
+ gt?: string | number;
192
+ };
193
+
168
194
  export declare type GetDashboardResponse = {
169
195
  dashboard: TDashboard;
170
196
  lenses: TLens[];
@@ -179,6 +205,10 @@ export declare type GetPluginsResponse = {
179
205
  }[];
180
206
  };
181
207
 
208
+ declare interface GroupByColumn extends BaseColumn {
209
+ role: 'groupby';
210
+ }
211
+
182
212
  export declare type HtmlOptions = {
183
213
  html: string;
184
214
  };
@@ -193,6 +223,11 @@ export declare type LoadingProps = {
193
223
  message?: string;
194
224
  };
195
225
 
226
+ declare interface MetricColumn extends BaseColumn {
227
+ role: 'metric';
228
+ aggregate: AggregateFunction;
229
+ }
230
+
196
231
  declare type NoneOptions = {};
197
232
 
198
233
  export declare type NumberAxisFormat = {
@@ -234,6 +269,16 @@ export declare type Placeholders = {
234
269
  SessionExpired?: React.ReactNode;
235
270
  };
236
271
 
272
+ declare interface QueryConfig {
273
+ groupByColumns?: GroupByColumn[];
274
+ trendByColumns?: TrendByColumn[];
275
+ metricColumns?: MetricColumn[];
276
+ filterColumns?: FilterByColumn[];
277
+ filters?: Record<string, FilterValue>;
278
+ limit?: number;
279
+ orderBy?: string[];
280
+ }
281
+
237
282
  export declare type SqlGen = {
238
283
  measures?: {
239
284
  name: string;
@@ -310,6 +355,7 @@ export declare type TCard = {
310
355
  type: TChartType;
311
356
  sql?: string;
312
357
  python?: string;
358
+ queryConfig?: QueryConfig;
313
359
  customCfg?: any;
314
360
  preferences?: TCardPreferences;
315
361
  customCardPreferences?: TCustomCardPreferences;
@@ -508,6 +554,10 @@ export declare type TLens = {
508
554
  shared?: boolean;
509
555
  };
510
556
 
557
+ declare interface TrendByColumn extends BaseColumn {
558
+ role: 'trendby';
559
+ }
560
+
511
561
  export declare type TSheet = {
512
562
  id: string;
513
563
  title?: string;
@@ -2,6 +2,8 @@ import { FontSpec } from 'chart.js';
2
2
 
3
3
  export declare type AggregateCalc = 'AVG' | 'MIN' | 'MAX' | 'SUM' | 'COUNT' | 'COUNT_DISTINCT';
4
4
 
5
+ declare type AggregateFunction = 'SUM' | 'AVG' | 'COUNT' | 'MAX' | 'MIN' | 'DISTINCT';
6
+
5
7
  export declare type AIScopeTable = {
6
8
  connectionId: string;
7
9
  connectionType: string;
@@ -17,6 +19,14 @@ export declare type AuthToken = {
17
19
  refreshToken?: string;
18
20
  };
19
21
 
22
+ declare interface BaseColumn {
23
+ id: string;
24
+ name: string;
25
+ label?: string;
26
+ type: ColumnType;
27
+ table?: string;
28
+ }
29
+
20
30
  declare type BaseCustomCard = {
21
31
  cardId: string;
22
32
  replaceDefault?: boolean;
@@ -61,6 +71,8 @@ export declare type ColorRange = {
61
71
  color: string;
62
72
  };
63
73
 
74
+ declare type ColumnType = 'string' | 'number' | 'date';
75
+
64
76
  export declare type ConnectionPolicy = {
65
77
  connectionId?: string;
66
78
  name: string;
@@ -111,6 +123,8 @@ export declare type DateOptions = {
111
123
 
112
124
  export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'none';
113
125
 
126
+ export declare type DroppableId = 'droppable-group-by' | 'droppable-metric';
127
+
114
128
  export declare type EmailSettings = {
115
129
  companyName: string;
116
130
  dashboardUrl: string;
@@ -122,6 +136,11 @@ export declare type ErrorProps = {
122
136
  message?: string;
123
137
  };
124
138
 
139
+ declare interface FilterByColumn extends BaseColumn {
140
+ role: 'filter';
141
+ operators?: string[];
142
+ }
143
+
125
144
  declare type FilterForBetween = BaseFilter & {
126
145
  operation: 'between' | 'not between';
127
146
  values: [number, number];
@@ -159,6 +178,13 @@ declare type FilterOnClick = {
159
178
  columnIndex: number;
160
179
  };
161
180
 
181
+ declare type FilterValue = string | number | (string | number)[] | {
182
+ gte?: string | number;
183
+ lte?: string | number;
184
+ lt?: string | number;
185
+ gt?: string | number;
186
+ };
187
+
162
188
  export declare type GetDashboardResponse = {
163
189
  dashboard: TDashboard;
164
190
  lenses: TLens[];
@@ -173,6 +199,10 @@ export declare type GetPluginsResponse = {
173
199
  }[];
174
200
  };
175
201
 
202
+ declare interface GroupByColumn extends BaseColumn {
203
+ role: 'groupby';
204
+ }
205
+
176
206
  export declare type HtmlOptions = {
177
207
  html: string;
178
208
  };
@@ -187,6 +217,11 @@ export declare type LoadingProps = {
187
217
  message?: string;
188
218
  };
189
219
 
220
+ declare interface MetricColumn extends BaseColumn {
221
+ role: 'metric';
222
+ aggregate: AggregateFunction;
223
+ }
224
+
190
225
  declare type NoneOptions = {};
191
226
 
192
227
  export declare type NumberAxisFormat = {
@@ -228,6 +263,16 @@ export declare type Placeholders = {
228
263
  SessionExpired?: React.ReactNode;
229
264
  };
230
265
 
266
+ declare interface QueryConfig {
267
+ groupByColumns?: GroupByColumn[];
268
+ trendByColumns?: TrendByColumn[];
269
+ metricColumns?: MetricColumn[];
270
+ filterColumns?: FilterByColumn[];
271
+ filters?: Record<string, FilterValue>;
272
+ limit?: number;
273
+ orderBy?: string[];
274
+ }
275
+
231
276
  export declare type SqlGen = {
232
277
  measures?: {
233
278
  name: string;
@@ -302,6 +347,7 @@ export declare type TCard = {
302
347
  type: TChartType;
303
348
  sql?: string;
304
349
  python?: string;
350
+ queryConfig?: QueryConfig;
305
351
  customCfg?: any;
306
352
  preferences?: TCardPreferences;
307
353
  customCardPreferences?: TCustomCardPreferences;
@@ -500,6 +546,10 @@ export declare type TLens = {
500
546
  shared?: boolean;
501
547
  };
502
548
 
549
+ declare interface TrendByColumn extends BaseColumn {
550
+ role: 'trendby';
551
+ }
552
+
503
553
  export declare type TSheet = {
504
554
  id: string;
505
555
  title?: string;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.0.417",
8
+ "version": "0.0.418",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -47,6 +47,9 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@ai-sdk/react": "^1.1.18",
50
+ "@dnd-kit/core": "^6.3.1",
51
+ "@dnd-kit/sortable": "^10.0.0",
52
+ "@dnd-kit/utilities": "^3.2.2",
50
53
  "@headlessui/react": "^2.2.0",
51
54
  "@monaco-editor/react": "^4.7.0-rc.0",
52
55
  "@r2wc/react-to-web-component": "^2.0.4",