@databrainhq/plugin 0.12.12 → 0.12.14

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.
@@ -14,6 +14,8 @@ type Props = {
14
14
  };
15
15
  isDateReset?: boolean;
16
16
  variant?: 'floatingLabel';
17
+ minDate?: Date;
18
+ maxDate?: Date;
17
19
  };
18
20
  export declare const DateRangePicker: React.FC<Props>;
19
21
  export default DateRangePicker;
@@ -25,5 +25,7 @@ export type ExternalMetricListProps = {
25
25
  sharingSettingsId?: string;
26
26
  isHideChartSettings?: boolean;
27
27
  isHideTablePreview?: boolean;
28
+ enableDownloadCsv?: boolean;
29
+ enableEmailCsv?: boolean;
28
30
  };
29
31
  export declare const ExternalMetricList: React.FC<ExternalMetricListProps>;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ExternalMetrics } from '@/types/queryTypes';
3
+ import { MetricFilterOptionsType } from '@/types';
3
4
  export type FullScreenViewProps = {
4
5
  metric: ExternalMetrics;
5
6
  colors?: string[];
@@ -8,6 +9,7 @@ export type FullScreenViewProps = {
8
9
  filterValues: Record<string, string>;
9
10
  };
10
11
  appFilters?: any;
12
+ metricFilterOptions?: MetricFilterOptionsType;
11
13
  onMinimize: () => void;
12
14
  clientId: string;
13
15
  tenancyLevel: string;
@@ -21,4 +23,4 @@ export type FullScreenViewProps = {
21
23
  isHideChartSettings?: boolean;
22
24
  isHideTablePreview?: boolean;
23
25
  };
24
- export declare const FullScreenView: ({ metric, colors, rlsFilters, onMinimize, clientId, tenancyLevel, companyId, externalDashboardId, userProvidedDashboardId, isAllowedToUpdateMetrics, sharingSettingsId, appFilters, isInternalApp, isShowChartConfigTab, isHideChartSettings, isHideTablePreview, }: FullScreenViewProps) => React.JSX.Element;
26
+ export declare const FullScreenView: ({ metric, colors, rlsFilters, metricFilterOptions, onMinimize, clientId, tenancyLevel, companyId, externalDashboardId, userProvidedDashboardId, isAllowedToUpdateMetrics, sharingSettingsId, appFilters, isInternalApp, isShowChartConfigTab, isHideChartSettings, isHideTablePreview, }: FullScreenViewProps) => React.JSX.Element;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { ExternalMetrics } from '@/types/queryTypes';
3
3
  import { ClientType } from '@/types/app';
4
4
  import { FilterFieldType } from '@/components/FilterField';
5
- import { RlsCondition } from '@/types';
5
+ import { MetricFilterOptionsType, RlsCondition } from '@/types';
6
6
  export type MetricCardProps = {
7
7
  globalFilters?: {
8
8
  tableName: string;
@@ -26,5 +26,8 @@ export type MetricCardProps = {
26
26
  isInternalApp?: boolean;
27
27
  setCrossDashboardFilters?: React.Dispatch<React.SetStateAction<RlsCondition[]>>;
28
28
  crossDashboardFilters?: RlsCondition[];
29
+ metricFilterOptions?: MetricFilterOptionsType;
30
+ onDownloadRawCsv?: (filterValues?: Record<string, any>) => void;
31
+ enableDownloadCsv?: boolean;
29
32
  };
30
- export declare const MetricCard: ({ globalFilters, metricItem, onMaximize, client, colors, param, companyTenancyType, renderHeaderName, isDisableCardClick, onArchive, chartRendererType, isDisableMorePopup, appFilters, isInternalApp, setCrossDashboardFilters, crossDashboardFilters, }: MetricCardProps) => React.JSX.Element;
33
+ export declare const MetricCard: ({ globalFilters, metricItem, onMaximize, client, colors, param, companyTenancyType, renderHeaderName, isDisableCardClick, onArchive, chartRendererType, isDisableMorePopup, appFilters, isInternalApp, setCrossDashboardFilters, crossDashboardFilters, metricFilterOptions, onDownloadRawCsv, enableDownloadCsv, }: MetricCardProps) => React.JSX.Element;
@@ -20,7 +20,9 @@ type Props = {
20
20
  totalRecords: number;
21
21
  };
22
22
  setChartSettings?: (value: React.SetStateAction<ChartSettingsType>) => void;
23
- isFullScreen?: boolean;
23
+ isInfiniteScroll?: boolean;
24
+ onLoadMore?: () => void;
25
+ hasMoreData?: boolean;
24
26
  };
25
- export declare const Table: ({ data, isLoading, error, tableSettings, tableName, className, onColumnSizingChange, onChartReady, onChangePage, isExternalChart, isEnableNextBtn, isEnablePrevBtn, paginationInfo, setChartSettings, isFullScreen, }: Props) => React.JSX.Element;
27
+ export declare const Table: ({ data, isLoading, error, tableSettings, tableName, className, onColumnSizingChange, onChartReady, onChangePage, isExternalChart, isEnableNextBtn, isEnablePrevBtn, paginationInfo, setChartSettings, isInfiniteScroll, onLoadMore, hasMoreData, }: Props) => React.JSX.Element;
26
28
  export {};
@@ -21,6 +21,7 @@ export declare const CHART_TYPES: {
21
21
  table: string;
22
22
  timeSeries: string;
23
23
  pivot: string;
24
+ rose: string;
24
25
  };
25
26
  export declare const timeStamp: {
26
27
  month: string;
@@ -26,6 +26,8 @@ export interface DashboardProps extends HTMLAttributes<HTMLElement> {
26
26
  theme?: ThemeType;
27
27
  isHideChartSettings?: boolean;
28
28
  isHideTablePreview?: boolean;
29
+ enableDownloadCsv?: boolean;
30
+ enableEmailCsv?: boolean;
29
31
  }
30
32
  /**
31
33
  * @name Dashboard - A react component to display the dashboard.
@@ -33,7 +35,9 @@ export interface DashboardProps extends HTMLAttributes<HTMLElement> {
33
35
  * @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.
34
36
  * @prop {object} options (optional) - Additional options like access permissions e.g. metric creation, updation, archiving and layout customization.
35
37
  * @prop {boolean} isHideChartSettings (optional) - Whether to hide chart settings in full screen view.
36
- * @prop {boolean} isHideTablePreview (optional) - Whether to hide table preview in full screen view.
38
+ * @prop {boolean} isHideChartSettings (optional) - Whether to hide chart settings in full screen view.
39
+ * @prop {boolean} enableDownloadCsv (optional) - Whether to show download csv option in metric card.
40
+ * @prop {boolean} enableEmailCsv (optional) - Whether to show email csv option in metric card.
37
41
  * @prop {object} theme (optional) - A theme object to customize the theme.
38
42
  */
39
- export declare const Dashboard: ({ token, options, theme, dashboardId, isHideChartSettings, isHideTablePreview, }: DashboardProps) => React.JSX.Element;
43
+ export declare const Dashboard: ({ token, options, theme, dashboardId, isHideChartSettings, isHideTablePreview, enableDownloadCsv, enableEmailCsv, }: DashboardProps) => React.JSX.Element;
@@ -9,6 +9,8 @@ export interface EmbeddedDashboardProps {
9
9
  chartColors?: string[];
10
10
  isHideChartSettings?: boolean;
11
11
  isHideTablePreview?: boolean;
12
+ enableDownloadCsv?: boolean;
13
+ enableEmailCsv?: boolean;
12
14
  };
13
15
  theme?: ThemeType;
14
16
  }
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { MetricFilterOptionsType } from '@/types';
2
3
  export interface EmbeddedMetricProps {
3
4
  token: string;
4
5
  chartColors?: string[];
@@ -8,5 +9,8 @@ export interface EmbeddedMetricProps {
8
9
  onMinimize?: () => void;
9
10
  isHideChartSettings?: boolean;
10
11
  isHideTablePreview?: boolean;
12
+ enableDownloadCsv?: boolean;
13
+ enableEmailCsv?: boolean;
14
+ metricFilterOptions?: MetricFilterOptionsType;
11
15
  }
12
- export declare const EmbeddedMetric: React.MemoExoticComponent<({ token, chartColors, metricId, chartRendererType, variant, onMinimize, isHideChartSettings, isHideTablePreview, }: EmbeddedMetricProps) => React.JSX.Element>;
16
+ export declare const EmbeddedMetric: React.MemoExoticComponent<({ token, chartColors, metricId, chartRendererType, variant, onMinimize, isHideChartSettings, isHideTablePreview, enableDownloadCsv, enableEmailCsv, metricFilterOptions, }: EmbeddedMetricProps) => React.JSX.Element>;
@@ -1,5 +1,6 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
- import { ThemeType } from '@/utils/theme';
2
+ import { ThemeType } from '@/utils';
3
+ import { MetricFilterOptionsType } from '@/types';
3
4
  /**
4
5
  * token - The client based guest token (required).
5
6
  * metricId - The id of the dashboard you want to see.
@@ -19,6 +20,8 @@ export interface MetricProps extends HTMLAttributes<HTMLElement> {
19
20
  variant?: 'card' | 'fullscreen';
20
21
  isHideChartSettings?: boolean;
21
22
  isHideTablePreview?: boolean;
23
+ enableDownloadCsv?: boolean;
24
+ enableEmailCsv?: boolean;
22
25
  onMinimize?: () => void;
23
26
  chartRendererType?: 'svg' | 'canvas';
24
27
  theme?: ThemeType;
@@ -26,6 +29,7 @@ export interface MetricProps extends HTMLAttributes<HTMLElement> {
26
29
  height?: number;
27
30
  className?: string;
28
31
  style?: React.CSSProperties;
32
+ metricFilterOptions?: MetricFilterOptionsType;
29
33
  }
30
34
  /**
31
35
  * @name Metric - A react component to display a single metric card.
@@ -33,7 +37,10 @@ export interface MetricProps extends HTMLAttributes<HTMLElement> {
33
37
  * @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.
34
38
  * @prop {boolean} isHideChartSettings - Whether to hide the chart settings in full screen view.
35
39
  * @prop {boolean} isHideTablePreview - Whether to hide the table preview in full screen view.
40
+ * @prop {boolean} enableDownloadCsv (optional) - Whether to show download csv option in metric card.
41
+ * @prop {boolean} enableEmailCsv (optional) - Whether to show email csv option in metric card.
36
42
  * @prop {string} variant (optional) - The variant to render the metric it can be card (fullscreen included) or fullscreen.
43
+ * @prop {object} metricFilterOptions (optional) - An optional metric filter options to be displayed in the metric filters.
37
44
  * @prop {function} onMinimize (optional) - An optional callback when minimize button is clicked.
38
45
  * @prop {array} chartColors (optional) - An array of colors to be used to visualize the chart.
39
46
  * @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.
@@ -43,4 +50,4 @@ export interface MetricProps extends HTMLAttributes<HTMLElement> {
43
50
  * @prop {object} style (optional) - The usual css style prop to provide inline styles.
44
51
  * @prop {object} theme (optional) - Theme config object to apply to the UI.
45
52
  */
46
- export declare const Metric: React.MemoExoticComponent<({ theme, width, height, style, className, ...metricProps }: MetricProps) => React.JSX.Element>;
53
+ export declare const Metric: React.MemoExoticComponent<({ theme, width, height, style, className, metricFilterOptions, ...metricProps }: MetricProps) => React.JSX.Element>;
@@ -0,0 +1,13 @@
1
+ import { MetricFilterOptionsType, RlsCondition } from '@/types';
2
+ /**
3
+ * @name getValidRlsConditionOptions - Filters out invalid options and return valid options and value;
4
+ * @param {RlsCondition} rlsCondition (required) - A metric filter object.
5
+ * @param {MetricFilterOptionsType} filterOptions (required) - Metric filter options prop object.
6
+ * @returns value - A valid value or undefined.
7
+ * @returns options - A valid options or undefined.
8
+ * @returns 'undefined' - If not a valid props or options or value.
9
+ */
10
+ export declare const getValidRlsConditionOptions: (rlsCondition: RlsCondition, filterOptions: MetricFilterOptionsType) => {
11
+ value: string;
12
+ options: string[] | number[] | import("@/types").DateTypeOptionType[];
13
+ } | undefined;
@@ -2,3 +2,4 @@ export * from './getModifiedQuery';
2
2
  export * from './getTimeFilterValue';
3
3
  export * from './groupArray';
4
4
  export * from './groupBy';
5
+ export * from './getValidRlsConditionOptions';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ChartSettingsType, FloatingDropDownOption, RlsCondition, DatasetSettings } from '@/types';
2
+ import { ChartSettingsType, FloatingDropDownOption, RlsCondition, DatasetSettings, MetricFilterOptionsType } from '@/types';
3
3
  import { MetricCardProps } from '@/components';
4
4
  type UseMetricCardProps = {
5
5
  metric: Record<string, any>;
@@ -18,8 +18,9 @@ type UseMetricCardProps = {
18
18
  isInternalApp?: boolean;
19
19
  setCrossDashboardFilters?: React.Dispatch<React.SetStateAction<RlsCondition[]>>;
20
20
  crossDashboardFilters?: RlsCondition[];
21
+ metricFilterOptions?: MetricFilterOptionsType;
21
22
  };
22
- export declare const useMetricCard: ({ metric, globalFilters, rlsFilters, clientId, chartSettings, setChartSettings, tenancyLevel, isInternalApp, appFilters, setCrossDashboardFilters, crossDashboardFilters, }: UseMetricCardProps) => {
23
+ export declare const useMetricCard: ({ metric, globalFilters, rlsFilters, clientId, chartSettings, setChartSettings, tenancyLevel, isInternalApp, appFilters, setCrossDashboardFilters, crossDashboardFilters, metricFilterOptions, }: UseMetricCardProps) => {
23
24
  onDrillDown: (params: any) => void;
24
25
  handleChartClick: (params: any) => void;
25
26
  dataDb: Record<string, any>[];
@@ -85,6 +85,33 @@ export type CustomSettings = {
85
85
  zoomAxis?: 'x' | 'y' | 'xy' | 'none';
86
86
  zoomOnMouseWheel?: boolean;
87
87
  };
88
+ showDynamicBehaviour?: boolean;
89
+ roseType?: string;
90
+ selectedMode?: string;
91
+ selectedOffset?: number;
92
+ gradients?: {
93
+ startColor: string;
94
+ endColor: string;
95
+ offset1: number;
96
+ offset2: number;
97
+ direction: string;
98
+ }[];
99
+ isShowBarGradient?: boolean;
100
+ barGradient?: {
101
+ startColor?: string;
102
+ endColor?: string;
103
+ offset1?: number;
104
+ offset2?: number;
105
+ direction?: string;
106
+ };
107
+ enableBackgroundGradient?: boolean;
108
+ backgroundGradient?: {
109
+ startColor?: string;
110
+ endColor?: string;
111
+ offset1?: number;
112
+ offset2?: number;
113
+ direction?: string;
114
+ };
88
115
  };
89
116
  export type TableSettings = {
90
117
  contentAlignment?: string;
@@ -128,6 +155,19 @@ export type LabelSettings = {
128
155
  position?: string;
129
156
  truncateLabel?: boolean;
130
157
  truncateLabelValue?: number;
158
+ showLabelLine?: boolean;
159
+ XAxisStyle?: {
160
+ size?: number;
161
+ family?: string;
162
+ weight?: number;
163
+ color?: string;
164
+ };
165
+ YAxisStyle?: {
166
+ size?: number;
167
+ family?: string;
168
+ weight?: number;
169
+ color?: string;
170
+ };
131
171
  };
132
172
  export type AxisSettings = {
133
173
  axis?: string;
@@ -261,6 +301,8 @@ export type DateOptionType = {
261
301
  count: number;
262
302
  endDate?: Date;
263
303
  startDate?: Date;
304
+ minDate?: Date;
305
+ maxDate?: Date;
264
306
  };
265
307
  export type RlsCondition = {
266
308
  name: string;
@@ -306,3 +348,15 @@ export type ConditionalFormattingParam = {
306
348
  styles: any;
307
349
  }[];
308
350
  };
351
+ export type DateTypeOptionType = {
352
+ range: 'Last' | 'This' | 'Custom';
353
+ time?: 'Day' | 'Week' | 'Month' | 'Quarter' | 'Year';
354
+ name: string;
355
+ count?: number;
356
+ minDate?: Date;
357
+ maxDate?: Date;
358
+ };
359
+ export type MetricFilterOptionsType = Record<string, {
360
+ options: string[] | number[] | DateTypeOptionType[];
361
+ defaultOption?: string | number;
362
+ }>;
@@ -0,0 +1 @@
1
+ export declare const getValidJson: (json: string) => any;
@@ -4,3 +4,4 @@ export * from './colors';
4
4
  export * from './getFormattedDataType';
5
5
  export * from './arrayToCsvString';
6
6
  export * from './popoverPosition';
7
+ export * from './getValidJson';
@@ -1,7 +1,7 @@
1
1
  import { DashboardProps } from './containers/Dashboard';
2
2
  import { Chart, ChartProps } from './components';
3
3
  import { MetricProps } from './containers/Metric';
4
- export type { CustomSettings, TableSettings, MarginSettings, AxisSettings, LegendSettings, LabelSettings, BackgroundSettings, PivotSettingsType, GaugeSettingsType, ChartSettingsType, TimeSeriesSettingsType, } from '@/types';
4
+ export type { CustomSettings, TableSettings, MarginSettings, AxisSettings, LegendSettings, LabelSettings, BackgroundSettings, PivotSettingsType, GaugeSettingsType, ChartSettingsType, TimeSeriesSettingsType, MetricFilterOptionsType, DateTypeOptionType, } from '@/types';
5
5
  export declare namespace JSX {
6
6
  interface IntrinsicElements {
7
7
  Tag: any;