@databrainhq/plugin 0.9.48 → 0.10.1
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 +57 -1
- package/dist/components/Loader/index.d.ts +2 -0
- package/dist/components/MetricList/components/MetricCards/MetricCard.d.ts +4 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/containers/Dashboard/Dashboard.d.ts +10 -5
- package/dist/containers/Dashboard/DashboardProvider.d.ts +2 -1
- package/dist/containers/Metric/EmbeddedMetric.d.ts +8 -0
- package/dist/containers/Metric/index.d.ts +19 -0
- package/dist/containers/PluginProvider.d.ts +7 -0
- package/dist/containers/index.d.ts +2 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useEmbeddedDashboard.d.ts +5 -1
- package/dist/hooks/useEmbeddedMetric.d.ts +19 -0
- package/dist/hooks/useMetricCard.d.ts +1 -1
- package/dist/index.es.js +15413 -15235
- package/dist/index.umd.js +232 -216
- package/dist/style.css +1 -1
- package/dist/utils/generated/graphql.d.ts +64 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,12 +12,68 @@ npm install @databrainhq/plugin
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
+
Integrating Dashboard
|
|
16
|
+
|
|
15
17
|
```tsx
|
|
16
18
|
import { Dashboard } from '@databrainhq/plugin';
|
|
17
19
|
import '@databrainhq/plugin/dist/style.css';
|
|
18
20
|
|
|
19
21
|
const Example = () => {
|
|
20
|
-
return
|
|
22
|
+
return (
|
|
23
|
+
<Dashboard
|
|
24
|
+
token="Your Guest Token"
|
|
25
|
+
dashboardId="Your Dashboard Id"
|
|
26
|
+
options={{
|
|
27
|
+
disableMetricCreation: false,
|
|
28
|
+
disableMetricUpdation: false,
|
|
29
|
+
disableMetricDeletion: false,
|
|
30
|
+
disableLayoutCustomization: false,
|
|
31
|
+
chartColors: [
|
|
32
|
+
'violet',
|
|
33
|
+
'indigo',
|
|
34
|
+
'blue',
|
|
35
|
+
'green',
|
|
36
|
+
'yellow',
|
|
37
|
+
'orange',
|
|
38
|
+
'red',
|
|
39
|
+
'pink',
|
|
40
|
+
'gray',
|
|
41
|
+
],
|
|
42
|
+
}}
|
|
43
|
+
theme={YOUR_THEME}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Integrating Metric
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { Metric } from '@databrainhq/plugin';
|
|
53
|
+
import '@databrainhq/plugin/dist/style.css';
|
|
54
|
+
|
|
55
|
+
const Example = () => {
|
|
56
|
+
return (
|
|
57
|
+
<Metric
|
|
58
|
+
token="Your Guest Token"
|
|
59
|
+
metricId="Your Metric Id"
|
|
60
|
+
width="500px"
|
|
61
|
+
height="300px"
|
|
62
|
+
chartRendererType="canvas"
|
|
63
|
+
chartColors={[
|
|
64
|
+
'violet',
|
|
65
|
+
'indigo',
|
|
66
|
+
'blue',
|
|
67
|
+
'green',
|
|
68
|
+
'yellow',
|
|
69
|
+
'orange',
|
|
70
|
+
'red',
|
|
71
|
+
'pink',
|
|
72
|
+
'gray',
|
|
73
|
+
]}
|
|
74
|
+
theme={YOUR_THEME}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
21
77
|
};
|
|
22
78
|
```
|
|
23
79
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { ExternalMetrics } from '@/utils/generated/graphql';
|
|
3
3
|
import { ClientType } from '@/types/app';
|
|
4
4
|
import { FilterFieldType } from '@/components/FilterField';
|
|
@@ -19,5 +19,7 @@ export type MetricCardProps = {
|
|
|
19
19
|
renderHeaderName?: (name: string) => JSX.Element;
|
|
20
20
|
onArchive?: (metricId: string) => void;
|
|
21
21
|
isDisableCardClick?: boolean;
|
|
22
|
+
chartRendererType?: 'svg' | 'canvas';
|
|
23
|
+
isDisableMorePopup?: boolean;
|
|
22
24
|
};
|
|
23
|
-
export declare const MetricCard:
|
|
25
|
+
export declare const MetricCard: ({ globalFilters, metricItem, onMaximize, client, colors, param, companyTenancyType, renderHeaderName, isDisableCardClick, onArchive, chartRendererType, isDisableMorePopup, }: MetricCardProps) => JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { ThemeType } from '@/utils/theme';
|
|
3
3
|
export interface DashboardProps {
|
|
4
4
|
token: string;
|
|
5
|
+
dashboardId?: string;
|
|
5
6
|
options?: {
|
|
6
7
|
headerVariant?: 'static' | 'floating';
|
|
7
8
|
disableMetricCreation?: boolean;
|
|
@@ -12,7 +13,11 @@ export interface DashboardProps {
|
|
|
12
13
|
};
|
|
13
14
|
theme?: ThemeType;
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
/**
|
|
17
|
+
* @name Dashboard - A react component to display the dashboard.
|
|
18
|
+
* @prop {string} token - A client based guest token.
|
|
19
|
+
* @prop {string} dashboardId (optional) - A dashboard id (one which you have provided at the time of creating it) of the dashboard you want to see.
|
|
20
|
+
* @prop {object} options (optional) - Additional options like access permissions e.g. metric creation, updation, archiving and layout customization.
|
|
21
|
+
* @prop {object} theme (optional) - A theme object to customize the theme.
|
|
22
|
+
*/
|
|
23
|
+
export declare const Dashboard: React.MemoExoticComponent<({ token, options, theme, dashboardId }: DashboardProps) => JSX.Element>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
type DashboardProviderProps = PropsWithChildren & {
|
|
3
3
|
token: string;
|
|
4
|
+
dashboardId?: string;
|
|
4
5
|
};
|
|
5
|
-
declare const DashboardProvider: ({ token, children }: DashboardProviderProps) => JSX.Element;
|
|
6
|
+
declare const DashboardProvider: ({ token, dashboardId, children, }: DashboardProviderProps) => JSX.Element;
|
|
6
7
|
export default DashboardProvider;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface EmbeddedMetricProps {
|
|
3
|
+
token: string;
|
|
4
|
+
chartColors?: string[];
|
|
5
|
+
metricId: string;
|
|
6
|
+
chartRendererType?: 'svg' | 'canvas';
|
|
7
|
+
}
|
|
8
|
+
export declare const EmbeddedMetric: React.MemoExoticComponent<({ token, chartColors, metricId, chartRendererType, }: EmbeddedMetricProps) => JSX.Element>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { EmbeddedMetricProps } from './EmbeddedMetric';
|
|
3
|
+
import { ThemeType } from '@/utils/theme';
|
|
4
|
+
export interface MetricProps extends EmbeddedMetricProps {
|
|
5
|
+
theme?: ThemeType;
|
|
6
|
+
width?: string;
|
|
7
|
+
height?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @name Metric - A react component to display a single metric card.
|
|
11
|
+
* @prop {string} token - A client based guest token.
|
|
12
|
+
* @prop {string} metricId - A metric id (one which you have provided at the time of it's creation) of the metric you want to display.
|
|
13
|
+
* @prop {array} chartColors (optional) - An array of colors to be used to visualize the chart.
|
|
14
|
+
* @prop {string} chartRendererType (optional) - Whether to display chart as svg or canvas. In case of low end devices or in general svg is better and in case of frequent data changes or high size data visualization canvas is better. Defaults to canvas.
|
|
15
|
+
* @prop {string} width (optional) - The width of the metric card e.g. 500px, 75vw, 50%, 4rem, 3em, etc. Defaults to 100%.
|
|
16
|
+
* @prop {string} height (optional) - The height of the metric card e.g. 500px, 75vh, 50%, 4rem, 3em, etc. Defaults to 100%.
|
|
17
|
+
* @prop {object} theme (optional) - Theme config object to apply to the UI.
|
|
18
|
+
*/
|
|
19
|
+
export declare const Metric: React.MemoExoticComponent<({ theme, width, height, ...metricProps }: MetricProps) => JSX.Element>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { ThemeType } from '@/utils';
|
|
3
|
+
type PluginProviderProps = PropsWithChildren & {
|
|
4
|
+
theme?: ThemeType;
|
|
5
|
+
};
|
|
6
|
+
export declare const PluginProvider: ({ children, theme }: PluginProviderProps) => JSX.Element;
|
|
7
|
+
export {};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export declare const useEmbeddedDashboard: (token
|
|
1
|
+
export declare const useEmbeddedDashboard: ({ token, dashboardId, }: {
|
|
2
|
+
token: string;
|
|
3
|
+
dashboardId?: string | undefined;
|
|
4
|
+
}) => {
|
|
2
5
|
isLoading: boolean;
|
|
3
6
|
data: {
|
|
4
7
|
clientId: string | undefined;
|
|
@@ -36,6 +39,7 @@ export declare const useEmbeddedDashboard: (token: string) => {
|
|
|
36
39
|
rlsConditions: any;
|
|
37
40
|
clickActions: any;
|
|
38
41
|
drillDownSettings?: any;
|
|
42
|
+
datasetMetricSettings?: any;
|
|
39
43
|
companyIntegration: {
|
|
40
44
|
__typename?: "companyIntegrations" | undefined;
|
|
41
45
|
name: string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ExternalMetrics } from '@/utils/generated/graphql';
|
|
2
|
+
export interface UseEmbeddedMetricProps {
|
|
3
|
+
token: string;
|
|
4
|
+
metricId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const useEmbeddedMetric: ({ token, metricId, }: UseEmbeddedMetricProps) => {
|
|
7
|
+
externalMetric: ExternalMetrics | undefined;
|
|
8
|
+
sharingSettingsId: string;
|
|
9
|
+
adminColors: string[] | null;
|
|
10
|
+
companyId: string;
|
|
11
|
+
clientId: string;
|
|
12
|
+
rlsSettings: {
|
|
13
|
+
metricId: string;
|
|
14
|
+
values: Record<string, any>;
|
|
15
|
+
} | undefined;
|
|
16
|
+
tenancyLevel: any;
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
errorMsg: string | undefined;
|
|
19
|
+
};
|
|
@@ -31,8 +31,8 @@ export declare const useMetricCard: ({ metric, globalFilters, rlsFilters, client
|
|
|
31
31
|
chartParams: any;
|
|
32
32
|
isQueryLoading: boolean;
|
|
33
33
|
setLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
34
|
-
groupedData: Record<string, any>[];
|
|
35
34
|
drilledLevel: number;
|
|
35
|
+
dimensions: any;
|
|
36
36
|
rlsConditions: RlsCondition[];
|
|
37
37
|
};
|
|
38
38
|
export {};
|