@databrainhq/plugin 0.13.0-beta.0 → 0.13.0-beta.2

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.
Files changed (45) hide show
  1. package/dist/components/Accordion/index.d.ts +1 -0
  2. package/dist/components/Alert/index.d.ts +3 -2
  3. package/dist/components/ChartSettingsPopup/components/ChartConfigure/index.d.ts +2 -1
  4. package/dist/components/DraggableItem/index.d.ts +7 -0
  5. package/dist/components/ExternalMetricForm/index.d.ts +1 -0
  6. package/dist/components/FilterDropDown/index.d.ts +8 -4
  7. package/dist/components/GlobalFilters/Filters.d.ts +2 -1
  8. package/dist/components/GlobalFilters/HorizontalFilters.d.ts +2 -1
  9. package/dist/components/GlobalFilters/index.d.ts +3 -1
  10. package/dist/components/Icons/Logos/index.d.ts +2 -0
  11. package/dist/components/InputField/index.d.ts +3 -3
  12. package/dist/components/List/index.d.ts +2 -1
  13. package/dist/components/MetricCreation/components/Dataset/index.d.ts +1 -1
  14. package/dist/components/MetricCreation/components/Header/index.d.ts +1 -1
  15. package/dist/components/MetricCreation/components/MetricOutput/MetricOutput.d.ts +1 -1
  16. package/dist/components/MetricCreation/components/MetricOutput/components/ChartTab/index.d.ts +2 -1
  17. package/dist/components/MetricCreation/components/MetricOutput/components/TableTab/index.d.ts +1 -2
  18. package/dist/components/MetricCreation/components/Panels/ChartAppearancePanel.d.ts +18 -0
  19. package/dist/components/MetricCreation/components/Panels/FiltersPanel.d.ts +20 -0
  20. package/dist/components/MetricCreation/components/Panels/SortPanel.d.ts +15 -0
  21. package/dist/components/MetricFilterDropDown/index.d.ts +3 -1
  22. package/dist/components/Table/index.d.ts +2 -1
  23. package/dist/consts/api.d.ts +2 -0
  24. package/dist/consts/app.d.ts +1 -0
  25. package/dist/consts/metricOptions.d.ts +67 -5
  26. package/dist/containers/index.d.ts +3 -0
  27. package/dist/helpers/areArraysEqual.d.ts +1 -0
  28. package/dist/helpers/generateTimeRangeWhereClause.d.ts +3 -1
  29. package/dist/helpers/index.d.ts +2 -0
  30. package/dist/hooks/useDatasetMetric.d.ts +50 -0
  31. package/dist/hooks/useDrag.d.ts +9 -0
  32. package/dist/hooks/useDragAndDropState.d.ts +8 -0
  33. package/dist/hooks/useDrop.d.ts +14 -0
  34. package/dist/hooks/useMetricConfig.d.ts +57 -0
  35. package/dist/index.d.ts +7 -0
  36. package/dist/queries/externalDashboard.mutation.d.ts +7 -1
  37. package/dist/queries/metric.mutation.d.ts +1 -1
  38. package/dist/types/app.d.ts +20 -3
  39. package/dist/types/dragAndDropProps.d.ts +42 -0
  40. package/dist/types/index.d.ts +1 -0
  41. package/dist/types/metricCreate.d.ts +213 -2
  42. package/dist/types/queryTypes.d.ts +10 -0
  43. package/dist/webcomponents.es.js +60321 -52728
  44. package/dist/webcomponents.umd.js +207 -211
  45. package/package.json +1 -1
@@ -63,6 +63,7 @@ export type CustomSettings = {
63
63
  barWidth?: number;
64
64
  barRadius?: number[];
65
65
  xRotation?: number;
66
+ customRotation?: number;
66
67
  hideXAxisLabels?: boolean;
67
68
  hideYAxisLabels?: boolean;
68
69
  fontSize?: number;
@@ -142,9 +143,9 @@ export type CustomSettings = {
142
143
  showStackLabels?: boolean;
143
144
  coloredBars?: boolean;
144
145
  };
145
- export type Colors = 'primary' | 'primary-dark' | 'secondary' | 'secondary-dark' | 'alert' | 'alert-dark' | 'alert-light' | 'success' | 'success-dark' | 'success-light' | 'warning' | 'warning-dark' | 'info' | 'info-light' | 'white' | 'gray' | 'gray-dark' | 'light' | 'dark';
146
- export type IconType = 'undo' | 'redo' | 'maximize' | 'minimize' | 'fullscreen' | 'download' | 'archive' | 'format' | 'company' | 'profile' | 'users' | 'bar-chart' | 'bar-chart-2' | 'kebab-menu-horizontal' | 'kebab-menu-vertical' | 'paint-brush' | 'funnel' | 'funnel-simple' | 'cross' | 'columns' | 'gear' | 'presentation-chart' | 'chevron-down' | 'plus' | 'info' | 'arrow-down' | 'arrow-up' | 'arrow-left' | 'arrow-right' | 'double-arrow-left' | 'double-arrow-right' | 'expand-arrows' | 'eye' | 'eye-slash' | 'database' | 'magnifying-glass' | 'pencil-simple-line' | 'pencil-simple' | 'file-sql' | 'code' | 'sign-out' | 'save' | 'delete' | 'align-space-even' | 'align-bottom' | 'align-left' | 'align-right' | 'align-top' | 'trend-up' | 'trend-up-chart' | 'caret-down-fill' | 'caret-up-fill' | 'caret-up-down' | 'pie-chart' | 'table-view' | 'task-done-file' | 'right-angle' | 'text-rotation-angle-up' | 'text-rotation-none' | 'text-rotation-up' | 'preview-file' | 'share' | 'image' | 'text' | 'color-palette' | 'shuffle' | 'table' | 'chart' | 'calendar' | 'horizontal-rule' | 'short-text' | 'subheader' | 'copy' | 'timer' | 'link' | 'not-found' | 'bar-chart-horizontal' | 'line-chart' | 'line-chart-trend-up' | 'globe' | 'map' | 'leaderboard' | 'radar' | 'scale' | 'scatter-plot' | 'tree' | 'donut-chart' | 'scatter-chart' | 'waterfall-chart' | 'area-chart' | 'bubble-chart' | 'candlestick-chart';
147
- export type LogoType = 'redshift' | 'postgres' | 'mysql' | 'mongodb' | 'bigquery' | 'snowflake' | 'microsoft' | 'google' | 'elasticsearch' | 'redis';
146
+ export type Colors = 'primary' | 'primary-dark' | 'secondary' | 'secondary-dark' | 'alert' | 'alert-dark' | 'alert-light' | 'success' | 'success-dark' | 'success-light' | 'warning' | 'warning-dark' | 'info' | 'info-light' | 'white' | 'gray' | 'gray-dark' | 'light' | 'dark' | 'infoAlert';
147
+ export type IconType = 'undo' | 'redo' | 'maximize' | 'minimize' | 'fullscreen' | 'download' | 'archive' | 'format' | 'company' | 'profile' | 'users' | 'bar-chart' | 'bar-chart-2' | 'kebab-menu-horizontal' | 'kebab-menu-vertical' | 'paint-brush' | 'funnel' | 'funnel-simple' | 'cross' | 'columns' | 'gear' | 'presentation-chart' | 'chevron-down' | 'plus' | 'info' | 'arrow-down' | 'arrow-up' | 'arrow-left' | 'arrow-right' | 'double-arrow-left' | 'double-arrow-right' | 'expand-arrows' | 'eye' | 'eye-slash' | 'database' | 'magnifying-glass' | 'pencil-simple-line' | 'pencil-simple' | 'file-sql' | 'code' | 'sign-out' | 'save' | 'delete' | 'align-space-even' | 'align-bottom' | 'align-left' | 'align-right' | 'align-top' | 'trend-up' | 'trend-up-chart' | 'caret-down-fill' | 'caret-up-fill' | 'caret-up-down' | 'pie-chart' | 'table-view' | 'task-done-file' | 'right-angle' | 'text-rotation-angle-up' | 'text-rotation-none' | 'text-rotation-up' | 'preview-file' | 'share' | 'image' | 'text' | 'color-palette' | 'shuffle' | 'table' | 'chart' | 'calendar' | 'horizontal-rule' | 'short-text' | 'subheader' | 'copy' | 'timer' | 'link' | 'not-found' | 'bar-chart-horizontal' | 'line-chart' | 'line-chart-trend-up' | 'globe' | 'map' | 'leaderboard' | 'radar' | 'scale' | 'scatter-plot' | 'tree' | 'donut-chart' | 'scatter-chart' | 'waterfall-chart' | 'area-chart' | 'bubble-chart' | 'candlestick-chart' | 'string' | 'boolean' | 'date' | 'number' | 'unknown' | 'array' | 'right-join' | 'left-join' | 'outer-join' | 'right-full-join' | 'left-full-join' | 'inner-join';
148
+ export type LogoType = 'redshift' | 'postgres' | 'mysql' | 'mongodb' | 'bigquery' | 'snowflake' | 'microsoft' | 'google' | 'elasticsearch' | 'redis' | 'databrick' | 'clickhouse';
148
149
  export type IconSizes = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
149
150
  export type IconConfig = {
150
151
  size: IconSizes;
@@ -180,6 +181,7 @@ export type TableSettings = {
180
181
  defaultRowSize?: string;
181
182
  columnSizing?: ColumnSizingState;
182
183
  isServerSidePagination?: boolean;
184
+ isSortAlphabetically?: boolean;
183
185
  conditionalFormatting?: {
184
186
  columnName: string;
185
187
  rules: {
@@ -196,6 +198,7 @@ export type TableSettings = {
196
198
  badgeSeparator?: string;
197
199
  listColumns?: string[];
198
200
  listSeparator?: string;
201
+ stackColAlias?: string;
199
202
  };
200
203
  export type BackgroundSettings = {
201
204
  show?: boolean;
@@ -339,6 +342,9 @@ export type FloatingDropDownOption = {
339
342
  subValue?: string;
340
343
  icon?: string;
341
344
  columnList?: any;
345
+ labelType?: string;
346
+ aggregate?: string;
347
+ alias?: string;
342
348
  };
343
349
  export type FilterType = {
344
350
  tableName: string;
@@ -398,6 +404,12 @@ export type RlsCondition = {
398
404
  optionColumnName?: string;
399
405
  optionTableName?: string;
400
406
  filterType?: string;
407
+ applyOnColumns?: {
408
+ columnName: FloatingDropDownOption;
409
+ logicalOperator: FloatingDropDownOption;
410
+ comparisonOperator: FloatingDropDownOption;
411
+ }[];
412
+ comparisonOperator?: FloatingDropDownOption;
401
413
  };
402
414
  export type MetricData = {
403
415
  id: string;
@@ -439,3 +451,8 @@ export type MetricFilterOptionsType = Record<string, {
439
451
  options: string[] | number[] | DateTypeOptionType[];
440
452
  defaultOption?: string | number;
441
453
  }>;
454
+ export type FilterClausesType = (column: string) => {
455
+ as: string;
456
+ columnName: string;
457
+ value: string | string[];
458
+ }[];
@@ -0,0 +1,42 @@
1
+ export type UseDragProps = {
2
+ identifier: {
3
+ id: string;
4
+ type?: string;
5
+ };
6
+ data?: any;
7
+ modifiers?: Record<string, any>;
8
+ events?: {
9
+ onDragStart?: (event: DragEvent, data: DndStateProp) => void;
10
+ onDragEnd?: (event: DragEvent, data: DndStateProp) => void;
11
+ };
12
+ CustomDragPreview?: any;
13
+ };
14
+ export type UseDropProps = {
15
+ identifier: {
16
+ id: string;
17
+ accepts?: string[];
18
+ };
19
+ events?: {
20
+ onDragOver?: (event: DragEvent, data: DndStateProp) => void;
21
+ onDragEnter?: (event: DragEvent, data: DndStateProp) => void;
22
+ onDragLeave?: (event: DragEvent, data: DndStateProp) => void;
23
+ onDrop?: (event: DragEvent, data: DndStateProp) => void;
24
+ };
25
+ modifiers?: {
26
+ sorting?: {
27
+ isEnabled: boolean;
28
+ sortingType: 'vertical' | 'horizontal';
29
+ list?: any[];
30
+ setList?: any;
31
+ };
32
+ };
33
+ };
34
+ export type DndStateProp = {
35
+ active: (UseDragProps & {
36
+ DragNodeRef: any;
37
+ }) | null;
38
+ over: (UseDropProps & {
39
+ setDropNodeRef: any;
40
+ }) | null;
41
+ DragPreviewCreateRoot?: any;
42
+ };
@@ -1,2 +1,3 @@
1
1
  export * from './app';
2
2
  export * from './metricCreate';
3
+ export * from './dragAndDropProps';
@@ -21,7 +21,7 @@ export type EmbeddedMetricCreationProps = {
21
21
  workspaceId: string;
22
22
  };
23
23
  export type HeaderProps = {
24
- Heading: string;
24
+ heading: string;
25
25
  setShowMetricCreateModal: React.Dispatch<React.SetStateAction<boolean>>;
26
26
  isDisableSaveBtn: boolean;
27
27
  setShowSaveMetricModal: React.Dispatch<React.SetStateAction<boolean>>;
@@ -30,7 +30,18 @@ export type DatasetProps = {
30
30
  setselectTable: React.Dispatch<React.SetStateAction<FloatingDropDownOption>>;
31
31
  selectTable: FloatingDropDownOption;
32
32
  tableList: FloatingDropDownOption[];
33
- columnList: ColumnData[];
33
+ columnList: FloatingDropDownOption[];
34
+ column: FloatingDropDownOption;
35
+ setColumn: React.Dispatch<React.SetStateAction<FloatingDropDownOption[]>>;
36
+ onChangeTableSelection: (table: string) => void;
37
+ metrics: {
38
+ value: string;
39
+ label: string;
40
+ }[];
41
+ setMetrics: React.Dispatch<React.SetStateAction<{
42
+ value: string;
43
+ label: string;
44
+ }[]>>;
34
45
  };
35
46
  export type MetricsValue = {
36
47
  value: string;
@@ -78,11 +89,37 @@ export type MetricOutputProps = {
78
89
  isEnableGauge: boolean;
79
90
  groupbyList: any[];
80
91
  hasNumberKeys: boolean;
92
+ metrics: FloatingDropDownOption[];
93
+ dimensions: FloatingDropDownOption[];
94
+ createdCols: FloatingDropDownOption[];
95
+ configuration: DatasetMetricCreationConfiguration;
96
+ setCreatedCols: React.Dispatch<React.SetStateAction<FloatingDropDownOption[]>>;
97
+ createdMetrics: FloatingDropDownOption[];
98
+ setCreatedMetrics: React.Dispatch<React.SetStateAction<FloatingDropDownOption[]>>;
99
+ functionOptions: (col: any) => {
100
+ value: string;
101
+ label: string;
102
+ }[];
103
+ onGenerateChart: ({ param, metricParams, dimensionParams, createdDimensionParams, createdMetricParams, }: {
104
+ param?: DatasetMetricCreationConfiguration | undefined;
105
+ metricParams?: FloatingDropDownOption[] | undefined;
106
+ dimensionParams?: FloatingDropDownOption[] | undefined;
107
+ createdMetricParams?: FloatingDropDownOption[] | undefined;
108
+ createdDimensionParams?: FloatingDropDownOption[] | undefined;
109
+ }) => void;
81
110
  setQuery?: React.Dispatch<React.SetStateAction<string>>;
82
111
  setData?: React.Dispatch<React.SetStateAction<any[] | undefined>>;
83
112
  setLoading?: React.Dispatch<React.SetStateAction<boolean>>;
84
113
  setError?: React.Dispatch<React.SetStateAction<string>>;
114
+ isEnableSingleDimension?: boolean;
115
+ isEnableSingleMetrics?: boolean;
85
116
  destinationId?: string;
117
+ outputHeaderProps: {
118
+ setShowChartCustomProperties: React.Dispatch<React.SetStateAction<boolean>>;
119
+ setShowChartType: React.Dispatch<React.SetStateAction<boolean>>;
120
+ setShowSortPanel: React.Dispatch<React.SetStateAction<boolean>>;
121
+ setShowFilters: React.Dispatch<React.SetStateAction<boolean>>;
122
+ };
86
123
  dbName?: string;
87
124
  previewTableDataList: any[] | undefined;
88
125
  enableQueryTab?: boolean;
@@ -98,6 +135,11 @@ export type MetricOutputProps = {
98
135
  setChartSettings: React.Dispatch<React.SetStateAction<ChartSettingsType>>;
99
136
  isDisableSqlBtn: boolean;
100
137
  setShowSqlModal: React.Dispatch<React.SetStateAction<boolean>>;
138
+ setMetrics: React.Dispatch<React.SetStateAction<{
139
+ value: string;
140
+ label: string;
141
+ }[]>>;
142
+ setColumn: React.Dispatch<React.SetStateAction<FloatingDropDownOption[]>>;
101
143
  };
102
144
  export type CompanyIntegration = {
103
145
  id: string;
@@ -129,4 +171,173 @@ export type ComparisonLagSettings = {
129
171
  timeGrain: FloatingDropDownOption;
130
172
  periodLag: number;
131
173
  };
174
+ export type CreatedNewColumn = {
175
+ columnName: FloatingDropDownOption;
176
+ function: FloatingDropDownOption;
177
+ alias: string;
178
+ };
179
+ export type SelectedJoin = {
180
+ tableName: FloatingDropDownOption;
181
+ conditions: {
182
+ firstOperand: FloatingDropDownOption;
183
+ secondOperand: FloatingDropDownOption;
184
+ operator: FloatingDropDownOption;
185
+ }[];
186
+ joinType: FloatingDropDownOption;
187
+ };
188
+ export type CreateNewFilter = {
189
+ tableName: FloatingDropDownOption;
190
+ columnName: FloatingDropDownOption;
191
+ operator: FloatingDropDownOption;
192
+ value: {
193
+ stringValue?: string;
194
+ numberValue?: number;
195
+ stringArray?: string[];
196
+ numberArray?: number[];
197
+ timeValue?: {
198
+ startDate: string;
199
+ endDate: string;
200
+ timeFilter: string;
201
+ };
202
+ };
203
+ relationOperator?: FloatingDropDownOption;
204
+ type: 'custom' | 'default' | 'client';
205
+ sql: string;
206
+ name: string;
207
+ isSaved?: boolean;
208
+ };
209
+ export type CreateNewSort = {
210
+ columnName: FloatingDropDownOption;
211
+ method: FloatingDropDownOption;
212
+ tableName: FloatingDropDownOption;
213
+ };
214
+ export type GetFilterDropDownType = ({ datatype, operator, }: {
215
+ datatype: string;
216
+ operator: string;
217
+ }) => 'TIME_FILTER' | 'MULTI_FILTER_DROPDOWN' | 'INPUT_NUMBER_FIELD' | 'FILTER_DROPDOWN';
218
+ export type JoinCondition = {
219
+ firstOperand: {
220
+ parentAlias: string;
221
+ columnName: string;
222
+ };
223
+ secondOperand: {
224
+ parentAlias: string;
225
+ columnName: string;
226
+ };
227
+ operator?: string;
228
+ };
229
+ export type Join = {
230
+ conditions: JoinCondition[];
231
+ name: string;
232
+ alias: string;
233
+ schema: string;
234
+ joinType?: string;
235
+ };
236
+ export type Table = {
237
+ name: string;
238
+ alias: string;
239
+ schema: string;
240
+ id: string;
241
+ joins: Join[];
242
+ };
243
+ export type Aggregate = {
244
+ method: string;
245
+ columnName: string;
246
+ alias: string;
247
+ parentAlias: string;
248
+ type: 'custom' | 'default';
249
+ dataType: string;
250
+ };
251
+ export type Dimension = {
252
+ columnName: string;
253
+ alias: string;
254
+ parentAlias: string;
255
+ timeGrain?: string;
256
+ type: 'custom' | 'default';
257
+ dataType: string;
258
+ helperFunction?: string;
259
+ };
260
+ export type Filter = {
261
+ method: string;
262
+ columnName: string;
263
+ alias: string;
264
+ parentAlias: string;
265
+ value: string | number | string[] | number[] | {
266
+ startDate: string;
267
+ endDate: string;
268
+ timeFilter: string;
269
+ };
270
+ type: 'custom' | 'default' | 'agr' | 'dimension' | 'time' | 'client' | 'rls_filter';
271
+ dataType: string;
272
+ relationOperator?: 'AND' | 'OR';
273
+ };
274
+ export type Order = {
275
+ method: string;
276
+ name: string;
277
+ };
278
+ export type Forcast = {
279
+ isEnable: boolean;
280
+ forecastPeriods: number;
281
+ modelName: string;
282
+ confidenceInterval: number;
283
+ timeColumnName: string;
284
+ measureColumnName: string;
285
+ timeGrain: string;
286
+ yearlySeasonality: boolean;
287
+ weeklySeasonality: boolean;
288
+ dailySeasonality: boolean;
289
+ orderP: number;
290
+ orderD: number;
291
+ orderQ: number;
292
+ trend: {
293
+ value: string;
294
+ label: string;
295
+ };
296
+ growth: string;
297
+ };
298
+ export type GroupByColumn = {
299
+ columnName: string;
300
+ alias: string;
301
+ parentAlias: string;
302
+ timeGrain?: string;
303
+ helperFunction?: string;
304
+ type: 'custom' | 'default';
305
+ dataType: string;
306
+ };
307
+ export type TableType = string;
308
+ export type DatasetMetricCreationConfiguration = {
309
+ table: Table;
310
+ aggregates: Aggregate[];
311
+ dimensions: Dimension[];
312
+ filters: Filter[];
313
+ orders: Order[];
314
+ limit: string;
315
+ isEnableDrill: boolean;
316
+ forecast?: Forcast;
317
+ rlsValues?: Record<string, string | number>;
318
+ groupByColumnList?: GroupByColumn[];
319
+ };
320
+ export type ConfigType = {
321
+ clientId: string;
322
+ companyId: string;
323
+ isLiveMode: boolean;
324
+ externalDashboardId: string;
325
+ userProvidedDashboardId: string;
326
+ chartColors: string[] | undefined;
327
+ isShowMetricCreateModal: boolean;
328
+ setShowMetricCreateModal: React.Dispatch<React.SetStateAction<boolean>>;
329
+ metric: ExternalMetrics | undefined;
330
+ metricData: Record<string, any>[] | undefined;
331
+ };
332
+ export type DatasetConfig = {
333
+ clientSubsetData: any;
334
+ clientId: string;
335
+ setError: React.Dispatch<React.SetStateAction<string>>;
336
+ setLoading: React.Dispatch<React.SetStateAction<boolean>>;
337
+ setData: React.Dispatch<React.SetStateAction<any[] | undefined>>;
338
+ setQuery: React.Dispatch<React.SetStateAction<string>>;
339
+ setGroupByList: React.Dispatch<React.SetStateAction<string[]>>;
340
+ chart: string;
341
+ setChartSettings: React.Dispatch<React.SetStateAction<ChartSettingsType>>;
342
+ };
132
343
  export {};
@@ -1,3 +1,4 @@
1
+ import { DatasetMetricCreationConfiguration } from './metricCreate';
1
2
  export type UseDashboardDataQueryInputType = {
2
3
  token: string;
3
4
  dashboardId?: string;
@@ -60,6 +61,10 @@ export type UseMetricColumnMutationInputType = {
60
61
  columnName?: string;
61
62
  wId?: string;
62
63
  filter?: Record<string, any>;
64
+ customTable?: {
65
+ query: string;
66
+ alias: string;
67
+ };
63
68
  };
64
69
  export type UseMetricUnderlyingDataMutationInputType = {
65
70
  columnName?: string;
@@ -164,6 +169,11 @@ export type UseGenerateMetricMutationInputType = {
164
169
  integrationName?: string;
165
170
  integrationId?: string;
166
171
  };
172
+ export type UseDatatsetMetricMutationInputType = {
173
+ cId: string;
174
+ configuration: DatasetMetricCreationConfiguration;
175
+ id: string;
176
+ };
167
177
  export type UseCreateMetricMutationInputType = {
168
178
  chartOptions?: any;
169
179
  companyId?: string;