@databrainhq/plugin 0.12.11 → 0.12.13

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;
@@ -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,6 +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 { MetricFilterOptionsType, RlsCondition } from '@/types';
5
6
  export type MetricCardProps = {
6
7
  globalFilters?: {
7
8
  tableName: string;
@@ -23,5 +24,8 @@ export type MetricCardProps = {
23
24
  chartRendererType?: 'svg' | 'canvas';
24
25
  isDisableMorePopup?: boolean;
25
26
  isInternalApp?: boolean;
27
+ setCrossDashboardFilters?: React.Dispatch<React.SetStateAction<RlsCondition[]>>;
28
+ crossDashboardFilters?: RlsCondition[];
29
+ metricFilterOptions?: MetricFilterOptionsType;
26
30
  };
27
- export declare const MetricCard: ({ globalFilters, metricItem, onMaximize, client, colors, param, companyTenancyType, renderHeaderName, isDisableCardClick, onArchive, chartRendererType, isDisableMorePopup, appFilters, isInternalApp, }: MetricCardProps) => React.JSX.Element;
31
+ export declare const MetricCard: ({ globalFilters, metricItem, onMaximize, client, colors, param, companyTenancyType, renderHeaderName, isDisableCardClick, onArchive, chartRendererType, isDisableMorePopup, appFilters, isInternalApp, setCrossDashboardFilters, crossDashboardFilters, metricFilterOptions }: MetricCardProps) => React.JSX.Element;
@@ -4,6 +4,7 @@ export interface ModalProps extends PropsWithChildren {
4
4
  onClose: () => void;
5
5
  headerTitle?: string;
6
6
  customHeader?: JSX.Element;
7
+ enableFullScreenButton?: boolean;
7
8
  icon?: any;
8
9
  }
9
10
  export declare const Modal: React.FC<ModalProps>;
@@ -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 {};
@@ -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,6 @@ export interface EmbeddedMetricProps {
8
9
  onMinimize?: () => void;
9
10
  isHideChartSettings?: boolean;
10
11
  isHideTablePreview?: boolean;
12
+ metricFilterOptions?: MetricFilterOptionsType;
11
13
  }
12
- export declare const EmbeddedMetric: React.MemoExoticComponent<({ token, chartColors, metricId, chartRendererType, variant, onMinimize, isHideChartSettings, isHideTablePreview, }: EmbeddedMetricProps) => React.JSX.Element>;
14
+ export declare const EmbeddedMetric: React.MemoExoticComponent<({ token, chartColors, metricId, chartRendererType, variant, onMinimize, isHideChartSettings, isHideTablePreview, 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.
@@ -26,6 +27,7 @@ export interface MetricProps extends HTMLAttributes<HTMLElement> {
26
27
  height?: number;
27
28
  className?: string;
28
29
  style?: React.CSSProperties;
30
+ metricFilterOptions?: MetricFilterOptionsType;
29
31
  }
30
32
  /**
31
33
  * @name Metric - A react component to display a single metric card.
@@ -34,6 +36,7 @@ export interface MetricProps extends HTMLAttributes<HTMLElement> {
34
36
  * @prop {boolean} isHideChartSettings - Whether to hide the chart settings in full screen view.
35
37
  * @prop {boolean} isHideTablePreview - Whether to hide the table preview in full screen view.
36
38
  * @prop {string} variant (optional) - The variant to render the metric it can be card (fullscreen included) or fullscreen.
39
+ * @prop {object} metricFilterOptions (optional) - An optional metric filter options to be displayed in the metric filters.
37
40
  * @prop {function} onMinimize (optional) - An optional callback when minimize button is clicked.
38
41
  * @prop {array} chartColors (optional) - An array of colors to be used to visualize the chart.
39
42
  * @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 +46,4 @@ export interface MetricProps extends HTMLAttributes<HTMLElement> {
43
46
  * @prop {object} style (optional) - The usual css style prop to provide inline styles.
44
47
  * @prop {object} theme (optional) - Theme config object to apply to the UI.
45
48
  */
46
- export declare const Metric: React.MemoExoticComponent<({ theme, width, height, style, className, ...metricProps }: MetricProps) => React.JSX.Element>;
49
+ 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>;
@@ -16,8 +16,11 @@ type UseMetricCardProps = {
16
16
  datasetSettings?: DatasetSettings;
17
17
  setDatasetSettings?: React.Dispatch<React.SetStateAction<DatasetSettings>>;
18
18
  isInternalApp?: boolean;
19
+ setCrossDashboardFilters?: React.Dispatch<React.SetStateAction<RlsCondition[]>>;
20
+ crossDashboardFilters?: RlsCondition[];
21
+ metricFilterOptions?: MetricFilterOptionsType;
19
22
  };
20
- export declare const useMetricCard: ({ metric, globalFilters, rlsFilters, clientId, chartSettings, setChartSettings, tenancyLevel, isInternalApp, appFilters, }: UseMetricCardProps) => {
23
+ export declare const useMetricCard: ({ metric, globalFilters, rlsFilters, clientId, chartSettings, setChartSettings, tenancyLevel, isInternalApp, appFilters, setCrossDashboardFilters, crossDashboardFilters, metricFilterOptions, }: UseMetricCardProps) => {
21
24
  onDrillDown: (params: any) => void;
22
25
  handleChartClick: (params: any) => void;
23
26
  dataDb: Record<string, any>[];
@@ -46,6 +46,7 @@ export type LegendSettings = {
46
46
  position?: string;
47
47
  truncateLegend?: boolean;
48
48
  truncateLegendValue?: number;
49
+ legendShape?: string;
49
50
  };
50
51
  export type MarginSettings = {
51
52
  marginTop?: number;
@@ -84,6 +85,18 @@ export type CustomSettings = {
84
85
  zoomAxis?: 'x' | 'y' | 'xy' | 'none';
85
86
  zoomOnMouseWheel?: boolean;
86
87
  };
88
+ showDynamicBehaviour?: boolean;
89
+ enableRoseType?: boolean;
90
+ roseType?: string;
91
+ selectedMode?: string;
92
+ selectedOffset?: number;
93
+ gradients?: {
94
+ startColor: string;
95
+ endColor: string;
96
+ offset1: number;
97
+ offset2: number;
98
+ direction: string;
99
+ }[];
87
100
  };
88
101
  export type TableSettings = {
89
102
  contentAlignment?: string;
@@ -127,6 +140,19 @@ export type LabelSettings = {
127
140
  position?: string;
128
141
  truncateLabel?: boolean;
129
142
  truncateLabelValue?: number;
143
+ showLabelLine?: boolean;
144
+ XAxisStyle?: {
145
+ size?: number;
146
+ family?: string;
147
+ weight?: number;
148
+ color?: string;
149
+ };
150
+ YAxisStyle?: {
151
+ size?: number;
152
+ family?: string;
153
+ weight?: number;
154
+ color?: string;
155
+ };
130
156
  };
131
157
  export type AxisSettings = {
132
158
  axis?: string;
@@ -260,6 +286,8 @@ export type DateOptionType = {
260
286
  count: number;
261
287
  endDate?: Date;
262
288
  startDate?: Date;
289
+ minDate?: Date;
290
+ maxDate?: Date;
263
291
  };
264
292
  export type RlsCondition = {
265
293
  name: string;
@@ -305,3 +333,15 @@ export type ConditionalFormattingParam = {
305
333
  styles: any;
306
334
  }[];
307
335
  };
336
+ export type DateTypeOptionType = {
337
+ range: 'Last' | 'This' | 'Custom';
338
+ time?: 'Day' | 'Week' | 'Month' | 'Quarter' | 'Year';
339
+ name: string;
340
+ count?: number;
341
+ minDate?: Date;
342
+ maxDate?: Date;
343
+ };
344
+ export type MetricFilterOptionsType = Record<string, {
345
+ options: string[] | number[] | DateTypeOptionType[];
346
+ defaultOption?: string | number;
347
+ }>;
@@ -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;