@databrainhq/plugin 0.15.15 → 0.15.17-uat

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.
package/README.md CHANGED
@@ -1,233 +1,233 @@
1
- # @databrainhq/plugin
2
-
3
- > Databrain app ui web component plugin.
4
-
5
- [![NPM](https://img.shields.io/npm/v/@databrainhq/plugin.svg)](https://www.npmjs.com/package/@databrainhq/plugin) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
6
-
7
- ## Install
8
-
9
- ```bash
10
- npm install @databrainhq/plugin
11
- ```
12
-
13
- ## Usage
14
-
15
- React/Solidjs
16
-
17
- Import in main/index/App
18
- ```tsx
19
- import '@databrainhq/plugin/web';
20
- ```
21
- Then use it anywhere in your app
22
-
23
- Integrating Dashboard
24
-
25
- ```tsx
26
- const Example = () => {
27
- return (
28
- <dbn-dashboard
29
- token="Your Guest Token"
30
- dashboardId="Your Dashboard Id"
31
- options={{
32
- disableMetricCreation: false,
33
- disableMetricUpdation: false,
34
- disableMetricDeletion: false,
35
- disableLayoutCustomization: false,
36
- chartColors: [
37
- 'violet',
38
- 'indigo',
39
- 'blue',
40
- 'green',
41
- 'yellow',
42
- 'orange',
43
- 'red',
44
- 'pink',
45
- 'gray',
46
- ],
47
- }}
48
- theme={YOUR_THEME}
49
- />
50
- );
51
- };
52
- ```
53
-
54
- Integrating Metric
55
-
56
- ```tsx
57
- const Example = () => {
58
- return (
59
- <Metric
60
- token="Your Guest Token"
61
- metricId="Your Metric Id"
62
- width="500px"
63
- height="300px"
64
- chartRendererType="canvas"
65
- chartColors={[
66
- 'violet',
67
- 'indigo',
68
- 'blue',
69
- 'green',
70
- 'yellow',
71
- 'orange',
72
- 'red',
73
- 'pink',
74
- 'gray',
75
- ]}
76
- theme={YOUR_THEME}
77
- />
78
- );
79
- };
80
- ```
81
-
82
- Vue
83
-
84
- Import in main/index/App
85
- ```vue
86
- <script setup lang="ts">
87
- import '@databrainhq/plugin/web';
88
- </script>
89
- ```
90
- Then use it anywhere in your app
91
-
92
- Integrating Dashboard
93
-
94
- ```vue
95
- <script setup lang="ts">
96
- // your component logic
97
- </script>
98
- <template>
99
- <dbn-dashboard
100
- :token="/*YOUR GUEST TOKEN*/"
101
- :options="/*YOUR ACCESS PERMISSION OPTIONS*/"
102
- :theme="/*YOUR THEME*/"
103
- :dashboardId="/*YOUR DASHBORD ID*/"
104
- ></dbn-dashboard>
105
- </template>
106
- ```
107
-
108
- Integrating Metric
109
-
110
- ```vue
111
- <script setup lang="ts">
112
- // your component logic
113
- </script>
114
- <template>
115
- <dbn-metric
116
- :token="/*YOUR GUEST TOKEN*/"
117
- chartRendererType="canvas"
118
- :theme="/*YOUR THEME*/"
119
- :dashboardId="/*YOUR DASHBORD ID*/"
120
- width="500"
121
- height="400"
122
- :style="/* YOUR STYLEs */"
123
- className="YOUR CLASS"
124
- ></dbn-metric>
125
- </template>
126
- ```
127
-
128
- Svelte
129
-
130
- Import in main/index/App
131
-
132
- ```svelte
133
- <script lang="ts">
134
- import '@databrainhq/plugin/web';
135
- </script>
136
- ```
137
-
138
- Then use it anywhere in your app
139
-
140
- Integrating Dashboard
141
-
142
- ```svelte
143
- <script lang="ts">
144
- // your component logic
145
- </script>
146
- <main>
147
- <dbn-dashboard
148
- token={/*YOUR GUEST TOKEN*/}
149
- options={/*YOUR ACCESS PERMISSION OPTIONS*/}
150
- theme={/*YOUR THEME*/}
151
- dashboardId={/*YOUR DASHBORD ID*/}
152
- ></dbn-dashboard>
153
- </main>
154
- ```
155
-
156
- Integrating Metric
157
-
158
- ```svelte
159
- <script lang="ts">
160
- // your component logic
161
- </script>
162
- <main>
163
- <dbn-metric
164
- token={/*YOUR GUEST TOKEN*/}
165
- chartRendererType="canvas"
166
- theme={/*YOUR THEME*/}
167
- dashboardId="/*YOUR DASHBORD ID*/"
168
- width="500"
169
- height="400"
170
- style={/* YOUR STYLEs */}
171
- className="YOUR CLASS"
172
- ></dbn-metric>
173
- </main>
174
- ```
175
-
176
- Angular
177
-
178
- Add suport for custom elements/web components in app.module.ts
179
-
180
- ```ts
181
- // app.module.ts
182
- import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
183
- import { BrowserModule } from '@angular/platform-browser';
184
-
185
- import { AppComponent } from './app.component';
186
-
187
- @NgModule({
188
- declarations: [AppComponent],
189
- imports: [BrowserModule],
190
- providers: [],
191
- bootstrap: [AppComponent],
192
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
193
- })
194
-
195
- export class AppModule {}
196
- ```
197
- Import in app.component.ts
198
-
199
- ```ts
200
- import '@databrainhq/plugin/web';
201
- ```
202
-
203
- Then use it anywhere in your app
204
-
205
- Integrating Dashboard
206
-
207
- ```html
208
- <dbn-dashboard
209
- token="YOUR GUEST TOKEN"
210
- options="YOUR ACCESS PERMISSION OPTIONS"
211
- theme="YOUR THEME"
212
- dashboardId="YOUR DASHBORD ID"
213
- ></dbn-dashboard>
214
- ```
215
-
216
- Integrating Metric
217
-
218
- ```html
219
- <dbn-metric
220
- token="YOUR GUEST TOKEN"
221
- chartRendererType="canvas"
222
- theme="YOUR THEME"
223
- dashboardId="YOUR DASHBORD ID"
224
- width="500"
225
- height="400"
226
- style="YOUR STYLE"
227
- className="YOUR CLASS"
228
- ></dbn-metric>
229
- ```
230
-
231
- ## License
232
-
233
- MIT © [databrainhq](https://github.com/databrainhq)
1
+ # @databrainhq/plugin
2
+
3
+ > Databrain app ui web component plugin.
4
+
5
+ [![NPM](https://img.shields.io/npm/v/@databrainhq/plugin.svg)](https://www.npmjs.com/package/@databrainhq/plugin) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @databrainhq/plugin
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ React/Solidjs
16
+
17
+ Import in main/index/App
18
+ ```tsx
19
+ import '@databrainhq/plugin/web';
20
+ ```
21
+ Then use it anywhere in your app
22
+
23
+ Integrating Dashboard
24
+
25
+ ```tsx
26
+ const Example = () => {
27
+ return (
28
+ <dbn-dashboard
29
+ token="Your Guest Token"
30
+ dashboardId="Your Dashboard Id"
31
+ options={{
32
+ disableMetricCreation: false,
33
+ disableMetricUpdation: false,
34
+ disableMetricDeletion: false,
35
+ disableLayoutCustomization: false,
36
+ chartColors: [
37
+ 'violet',
38
+ 'indigo',
39
+ 'blue',
40
+ 'green',
41
+ 'yellow',
42
+ 'orange',
43
+ 'red',
44
+ 'pink',
45
+ 'gray',
46
+ ],
47
+ }}
48
+ theme={YOUR_THEME}
49
+ />
50
+ );
51
+ };
52
+ ```
53
+
54
+ Integrating Metric
55
+
56
+ ```tsx
57
+ const Example = () => {
58
+ return (
59
+ <Metric
60
+ token="Your Guest Token"
61
+ metricId="Your Metric Id"
62
+ width="500px"
63
+ height="300px"
64
+ chartRendererType="canvas"
65
+ chartColors={[
66
+ 'violet',
67
+ 'indigo',
68
+ 'blue',
69
+ 'green',
70
+ 'yellow',
71
+ 'orange',
72
+ 'red',
73
+ 'pink',
74
+ 'gray',
75
+ ]}
76
+ theme={YOUR_THEME}
77
+ />
78
+ );
79
+ };
80
+ ```
81
+
82
+ Vue
83
+
84
+ Import in main/index/App
85
+ ```vue
86
+ <script setup lang="ts">
87
+ import '@databrainhq/plugin/web';
88
+ </script>
89
+ ```
90
+ Then use it anywhere in your app
91
+
92
+ Integrating Dashboard
93
+
94
+ ```vue
95
+ <script setup lang="ts">
96
+ // your component logic
97
+ </script>
98
+ <template>
99
+ <dbn-dashboard
100
+ :token="/*YOUR GUEST TOKEN*/"
101
+ :options="/*YOUR ACCESS PERMISSION OPTIONS*/"
102
+ :theme="/*YOUR THEME*/"
103
+ :dashboardId="/*YOUR DASHBORD ID*/"
104
+ ></dbn-dashboard>
105
+ </template>
106
+ ```
107
+
108
+ Integrating Metric
109
+
110
+ ```vue
111
+ <script setup lang="ts">
112
+ // your component logic
113
+ </script>
114
+ <template>
115
+ <dbn-metric
116
+ :token="/*YOUR GUEST TOKEN*/"
117
+ chartRendererType="canvas"
118
+ :theme="/*YOUR THEME*/"
119
+ :dashboardId="/*YOUR DASHBORD ID*/"
120
+ width="500"
121
+ height="400"
122
+ :style="/* YOUR STYLEs */"
123
+ className="YOUR CLASS"
124
+ ></dbn-metric>
125
+ </template>
126
+ ```
127
+
128
+ Svelte
129
+
130
+ Import in main/index/App
131
+
132
+ ```svelte
133
+ <script lang="ts">
134
+ import '@databrainhq/plugin/web';
135
+ </script>
136
+ ```
137
+
138
+ Then use it anywhere in your app
139
+
140
+ Integrating Dashboard
141
+
142
+ ```svelte
143
+ <script lang="ts">
144
+ // your component logic
145
+ </script>
146
+ <main>
147
+ <dbn-dashboard
148
+ token={/*YOUR GUEST TOKEN*/}
149
+ options={/*YOUR ACCESS PERMISSION OPTIONS*/}
150
+ theme={/*YOUR THEME*/}
151
+ dashboardId={/*YOUR DASHBORD ID*/}
152
+ ></dbn-dashboard>
153
+ </main>
154
+ ```
155
+
156
+ Integrating Metric
157
+
158
+ ```svelte
159
+ <script lang="ts">
160
+ // your component logic
161
+ </script>
162
+ <main>
163
+ <dbn-metric
164
+ token={/*YOUR GUEST TOKEN*/}
165
+ chartRendererType="canvas"
166
+ theme={/*YOUR THEME*/}
167
+ dashboardId="/*YOUR DASHBORD ID*/"
168
+ width="500"
169
+ height="400"
170
+ style={/* YOUR STYLEs */}
171
+ className="YOUR CLASS"
172
+ ></dbn-metric>
173
+ </main>
174
+ ```
175
+
176
+ Angular
177
+
178
+ Add suport for custom elements/web components in app.module.ts
179
+
180
+ ```ts
181
+ // app.module.ts
182
+ import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
183
+ import { BrowserModule } from '@angular/platform-browser';
184
+
185
+ import { AppComponent } from './app.component';
186
+
187
+ @NgModule({
188
+ declarations: [AppComponent],
189
+ imports: [BrowserModule],
190
+ providers: [],
191
+ bootstrap: [AppComponent],
192
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
193
+ })
194
+
195
+ export class AppModule {}
196
+ ```
197
+ Import in app.component.ts
198
+
199
+ ```ts
200
+ import '@databrainhq/plugin/web';
201
+ ```
202
+
203
+ Then use it anywhere in your app
204
+
205
+ Integrating Dashboard
206
+
207
+ ```html
208
+ <dbn-dashboard
209
+ token="YOUR GUEST TOKEN"
210
+ options="YOUR ACCESS PERMISSION OPTIONS"
211
+ theme="YOUR THEME"
212
+ dashboardId="YOUR DASHBORD ID"
213
+ ></dbn-dashboard>
214
+ ```
215
+
216
+ Integrating Metric
217
+
218
+ ```html
219
+ <dbn-metric
220
+ token="YOUR GUEST TOKEN"
221
+ chartRendererType="canvas"
222
+ theme="YOUR THEME"
223
+ dashboardId="YOUR DASHBORD ID"
224
+ width="500"
225
+ height="400"
226
+ style="YOUR STYLE"
227
+ className="YOUR CLASS"
228
+ ></dbn-metric>
229
+ ```
230
+
231
+ ## License
232
+
233
+ MIT © [databrainhq](https://github.com/databrainhq)
@@ -22,6 +22,7 @@ export type SingleValueChartProps = {
22
22
  truncateValue?: number;
23
23
  upVariant?: string;
24
24
  downVariant?: string;
25
+ metricCardColor?: string;
25
26
  };
26
27
  value: string | number;
27
28
  hideBorder?: boolean;
@@ -19,6 +19,7 @@ export type ChartProps = {
19
19
  isSortReversed?: boolean;
20
20
  chartHeight?: number;
21
21
  chartAppearance?: ChartAppearanceType;
22
+ metricCardColor?: string;
22
23
  };
23
24
  /**
24
25
  * @name Chart - The metric visualization component.
@@ -30,4 +31,4 @@ export type ChartProps = {
30
31
  * @prop colors (optional) - the admin provided chart color palettes.
31
32
  * @returns JSX - chart visaulization content.
32
33
  */
33
- export declare const Chart: React.MemoExoticComponent<({ chartOptions, data, events, colors, config, className, isShowFullScreen, isShowFullScreenEnabled, sortOrder, onMaximize, onDrillPivotTable, pivotDrillState, isPythonMode, seriesName, isSortReversed, chartHeight, chartAppearance, }: ChartProps) => React.JSX.Element>;
34
+ export declare const Chart: React.MemoExoticComponent<({ chartOptions, data, events, colors, config, className, isShowFullScreen, isShowFullScreenEnabled, sortOrder, onMaximize, onDrillPivotTable, pivotDrillState, isPythonMode, seriesName, isSortReversed, chartHeight, chartAppearance, metricCardColor, }: ChartProps) => React.JSX.Element>;
@@ -58,5 +58,6 @@ export type ExternalMetricListProps = {
58
58
  };
59
59
  isShadowDisableOnHover?: boolean;
60
60
  noDataImg?: string;
61
+ metricCardColor?: string;
61
62
  };
62
63
  export declare const ExternalMetricList: React.FC<ExternalMetricListProps>;
@@ -75,5 +75,6 @@ export type MetricCardProps = {
75
75
  isShadowDisableOnHover?: boolean;
76
76
  isAllowedToSeeUnderlyingData?: boolean;
77
77
  noDataImg?: string;
78
+ metricCardColor?: string;
78
79
  };
79
- export declare const MetricCard: ({ globalFilters: globalFilterList, metricItem, onMaximize, client, colors, param, companyTenancyType, renderHeaderName, isDisableCardClick, onArchive, chartRendererType, isDisableMorePopup, appFilters, isInternalApp, setCrossDashboardFilters, crossDashboardFilters, metricFilterOptions, onDownloadRawCsv, enableDownloadCsv, enableMultiMetricFilters, disableActions, metricFilterPosition, isAllClient, dropdownTheme, optionsIcon, downloadMetrics, onDownload, appearanceOptions, isFrontendApp, guestToken, encryptedClient, workspaceId, clientColumnType, isDisableCardTitle, chartHeight, isEditLayoutEnabled, isTourActive, hideDatePickerOptions, chartAppearance, isDisableMetricLoader, isShadowDisableOnHover, isAllowedToSeeUnderlyingData, noDataImg, }: MetricCardProps) => React.JSX.Element;
80
+ export declare const MetricCard: ({ globalFilters: globalFilterList, metricItem, onMaximize, client, colors, param, companyTenancyType, renderHeaderName, isDisableCardClick, onArchive, chartRendererType, isDisableMorePopup, appFilters, isInternalApp, setCrossDashboardFilters, crossDashboardFilters, metricFilterOptions, onDownloadRawCsv, enableDownloadCsv, enableMultiMetricFilters, disableActions, metricFilterPosition, isAllClient, dropdownTheme, optionsIcon, downloadMetrics, onDownload, appearanceOptions, isFrontendApp, guestToken, encryptedClient, workspaceId, clientColumnType, isDisableCardTitle, chartHeight, isEditLayoutEnabled, isTourActive, hideDatePickerOptions, chartAppearance, isDisableMetricLoader, isShadowDisableOnHover, isAllowedToSeeUnderlyingData, noDataImg, metricCardColor, }: MetricCardProps) => React.JSX.Element;
@@ -36,4 +36,4 @@ export type MultiSelectDropdownProps = Omit<MultiSelectAccordianDropdownProps, '
36
36
  isSelectAllOn?: boolean;
37
37
  };
38
38
  export declare const MultiSelectAccordianDropdown: ({ label, labelVariant, selectedOption, onChange, button, options, isDisabled, icon, buttonWidth, menuWidth, isSearchEnabled, searchIcon, closeControl, searchPlaceholder, radius, }: MultiSelectAccordianDropdownProps) => React.JSX.Element;
39
- export declare const MultiSelectDropdown: ({ id, label, labelVariant, selectedOption: selectedOption_temp, onChange, button, options, isDisabled, icon, buttonWidth, menuWidth, isSearchEnabled, searchIcon, closeControl, searchPlaceholder, isShowSelectedOptions, radius, isFilter, dataTestTitle, isAutoSelectOption, isLoadingData, error, menuZIndex, isSelectAllEnabled, isSelectAllOn, }: MultiSelectDropdownProps) => React.JSX.Element;
39
+ export declare const MultiSelectDropdown: ({ id, label, labelVariant, selectedOption, onChange, button, options, isDisabled, icon, buttonWidth, menuWidth, isSearchEnabled, searchIcon, closeControl, searchPlaceholder, isShowSelectedOptions, radius, isFilter, dataTestTitle, isAutoSelectOption, isLoadingData, error, menuZIndex, isSelectAllEnabled, isSelectAllOn, }: MultiSelectDropdownProps) => React.JSX.Element;
@@ -202,3 +202,4 @@ export declare const keywordToIgnoreRegExp: RegExp;
202
202
  export declare const DEFAULT_SEARCH_STATE: SearchState;
203
203
  export declare const DEFAULT_SEARCH_CHAT: SearchStateChatType;
204
204
  export declare const decimalTypes: string[];
205
+ export declare const switchAxisCharts: string[];
@@ -16,3 +16,4 @@ export declare const setChartFields: ({ chartType, chartDimensions, chartMetrics
16
16
  export declare const getDatabaseName: (name: string) => "bigquery" | "mysql" | "postgresql";
17
17
  export declare const getWordCount: (text: string) => number;
18
18
  export declare const generateRandomId: (length?: number) => string;
19
+ export declare const enableSaveToDashboardButton: (chartType: ChartSettingsType['chartType'], dimensions: SelectedColumn[], metrics: SelectedColumn[]) => number;
@@ -110,6 +110,7 @@ export type CustomSettings = {
110
110
  customUppperLimit?: number;
111
111
  customLowerLimit?: number;
112
112
  isEnableInterchange?: boolean;
113
+ isEnableDashedLine?: boolean;
113
114
  comparisonBadgeColor?: {
114
115
  up?: string;
115
116
  down?: string;
@@ -443,6 +444,11 @@ export type ChartSettingsType = {
443
444
  comboBarList: string[];
444
445
  isGroupXAxis?: boolean;
445
446
  isEnableComparisonFilter?: boolean;
447
+ enduserMeasureAndDimensions?: {
448
+ isEnabled?: boolean;
449
+ measures?: FloatingDropDownOption[];
450
+ dimensions?: FloatingDropDownOption[];
451
+ };
446
452
  };
447
453
  export type SelectedColumns = {
448
454
  column: string;
@@ -749,6 +755,7 @@ export type AdminThemeOptionsType = {
749
755
  selectBoxVariant?: 'floating' | 'static';
750
756
  selectBoxBorderRadius?: string;
751
757
  selectBoxTextColor?: string;
758
+ metricCardColor?: string;
752
759
  };
753
760
  cardDescription: {
754
761
  fontSize?: string;
@@ -68,6 +68,10 @@ export type UseMetricQueryQueryInputType = {
68
68
  };
69
69
  chartSeriesField?: string;
70
70
  comparisonCount?: number;
71
+ dynamicXAxis?: {
72
+ isEnable: boolean;
73
+ xaxis: string;
74
+ };
71
75
  };
72
76
  export type UseMetricQueryQueryOutputType = {
73
77
  data?: any | null;
@@ -33,9 +33,10 @@ export type GetChartOptionsParams = {
33
33
  chartHeight?: number;
34
34
  chartAppearance?: ChartAppearanceType;
35
35
  chartRef?: React.MutableRefObject<any>;
36
+ metricCardColor?: string;
36
37
  };
37
38
  export declare const getLegendData: ({ chartOptions, data, }: {
38
39
  chartOptions: ChartSettingsType;
39
40
  data: Record<string, any>[];
40
41
  }) => any;
41
- export declare const getChartOptions: ({ chartOptions, data, colors, isPythonMode, geoJsonData, chartHeight, chartAppearance, chartRef, }: GetChartOptionsParams) => Record<string, any>;
42
+ export declare const getChartOptions: ({ chartOptions, data, colors, isPythonMode, geoJsonData, chartHeight, chartAppearance, chartRef, metricCardColor, }: GetChartOptionsParams) => Record<string, any>;
@@ -20,5 +20,6 @@ export type GetNoAxisChartOptionsParams = {
20
20
  chartHeight?: number;
21
21
  chartAppearance?: ChartAppearanceType;
22
22
  chartRef?: React.MutableRefObject<any>;
23
+ metricCardColor?: string;
23
24
  };
24
- export declare const getNoAxisChartOptions: ({ chartOptions, data, colors, datasets, funnelData, labels, singleValueData, geoJsonData, mapColors, progressData, barGradient, labelFormatSettings, bgColors, chartHeight, chartAppearance, chartRef, }: GetNoAxisChartOptionsParams) => Record<string, any>;
25
+ export declare const getNoAxisChartOptions: ({ chartOptions, data, colors, datasets, funnelData, labels, singleValueData, geoJsonData, mapColors, progressData, barGradient, labelFormatSettings, bgColors, chartHeight, chartAppearance, chartRef, metricCardColor, }: GetNoAxisChartOptionsParams) => Record<string, any>;