@devtable/dashboard 8.30.0 → 8.32.0

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 (32) hide show
  1. package/dist/dashboard.es.js +13750 -12275
  2. package/dist/dashboard.umd.js +98 -83
  3. package/dist/plugins/hooks/use-tab-state.d.ts +5 -0
  4. package/dist/plugins/viz-components/cartesian/index.d.ts +1 -1
  5. package/dist/plugins/viz-components/cartesian/triggers/index.d.ts +1 -0
  6. package/dist/plugins/viz-components/horizontal-bar-chart/editors/reference-lines/index.d.ts +11 -0
  7. package/dist/plugins/viz-components/horizontal-bar-chart/editors/reference-lines/reference-line.d.ts +19 -0
  8. package/dist/plugins/viz-components/horizontal-bar-chart/editors/series/fields.bar.d.ts +10 -0
  9. package/dist/plugins/viz-components/horizontal-bar-chart/editors/series/index.d.ts +10 -0
  10. package/dist/plugins/viz-components/horizontal-bar-chart/editors/series/series-item.d.ts +17 -0
  11. package/dist/plugins/viz-components/horizontal-bar-chart/editors/x-axes/index.d.ts +9 -0
  12. package/dist/plugins/viz-components/horizontal-bar-chart/editors/x-axes/x-axis.d.ts +10 -0
  13. package/dist/plugins/viz-components/horizontal-bar-chart/editors/y-axis/index.d.ts +11 -0
  14. package/dist/plugins/viz-components/horizontal-bar-chart/index.d.ts +2 -0
  15. package/dist/plugins/viz-components/horizontal-bar-chart/option/grid.d.ts +8 -0
  16. package/dist/plugins/viz-components/horizontal-bar-chart/option/index.d.ts +72 -0
  17. package/dist/plugins/viz-components/horizontal-bar-chart/option/legend.d.ts +2 -0
  18. package/dist/plugins/viz-components/horizontal-bar-chart/option/series/data.d.ts +21 -0
  19. package/dist/plugins/viz-components/horizontal-bar-chart/option/series/index.d.ts +4 -0
  20. package/dist/plugins/viz-components/horizontal-bar-chart/option/series/reference_lines.d.ts +32 -0
  21. package/dist/plugins/viz-components/horizontal-bar-chart/option/series/series_items.d.ts +4 -0
  22. package/dist/plugins/viz-components/horizontal-bar-chart/option/series/types.d.ts +1 -0
  23. package/dist/plugins/viz-components/horizontal-bar-chart/option/tooltip.d.ts +10 -0
  24. package/dist/plugins/viz-components/horizontal-bar-chart/option/utils/label-formatter.d.ts +2 -0
  25. package/dist/plugins/viz-components/horizontal-bar-chart/option/utils/types.d.ts +9 -0
  26. package/dist/plugins/viz-components/horizontal-bar-chart/option/utils/variables.d.ts +3 -0
  27. package/dist/plugins/viz-components/horizontal-bar-chart/option/x-axis.d.ts +31 -0
  28. package/dist/plugins/viz-components/horizontal-bar-chart/option/y-axis.d.ts +23 -0
  29. package/dist/plugins/viz-components/horizontal-bar-chart/type.d.ts +68 -0
  30. package/dist/plugins/viz-components/horizontal-bar-chart/viz-horizontal-bar-chart-editor.d.ts +3 -0
  31. package/dist/plugins/viz-components/horizontal-bar-chart/viz-horizontal-bar-chart.d.ts +3 -0
  32. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare function useTabState(initialTab: string | null): {
3
+ tab: string | null;
4
+ setTab: import("react").Dispatch<import("react").SetStateAction<string | null>>;
5
+ };
@@ -1,7 +1,7 @@
1
1
  import { VersionBasedMigrator } from '~/plugins/plugin-data-migrator';
2
2
  import { VizComponent } from '~/types/plugin';
3
3
  export declare class VizCartesianMigrator extends VersionBasedMigrator {
4
- readonly VERSION = 12;
4
+ readonly VERSION = 13;
5
5
  configVersions(): void;
6
6
  }
7
7
  export declare const CartesianVizComponent: VizComponent;
@@ -0,0 +1 @@
1
+ export { ClickEchartSeries } from './click-echart';
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { Control, UseFormWatch } from 'react-hook-form';
3
+ import { ITemplateVariable } from '~/utils/template';
4
+ import { IHorizontalBarChartConf } from '../../type';
5
+ interface IReferenceLinesField {
6
+ control: Control<IHorizontalBarChartConf, $TSFixMe>;
7
+ watch: UseFormWatch<IHorizontalBarChartConf>;
8
+ variables: ITemplateVariable[];
9
+ }
10
+ export declare function ReferenceLinesField({ control, watch, variables }: IReferenceLinesField): JSX.Element;
11
+ export {};
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import { Control, UseFieldArrayRemove, UseFormWatch } from 'react-hook-form';
3
+ import { IHorizontalBarChartConf } from '../../type';
4
+ interface IReferenceLineField {
5
+ control: Control<IHorizontalBarChartConf, $TSFixMe>;
6
+ index: number;
7
+ watch: UseFormWatch<IHorizontalBarChartConf>;
8
+ remove: UseFieldArrayRemove;
9
+ variableOptions: {
10
+ label: string;
11
+ value: string;
12
+ }[];
13
+ xAxisOptions: {
14
+ label: string;
15
+ value: string;
16
+ }[];
17
+ }
18
+ export declare function ReferenceLineField({ control, index, remove, watch, variableOptions, xAxisOptions, }: IReferenceLineField): JSX.Element;
19
+ export {};
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { Control } from 'react-hook-form';
3
+ import { IHorizontalBarChartConf, IHorizontalBarChartSeriesItem } from '../../type';
4
+ interface IBarFields {
5
+ control: Control<IHorizontalBarChartConf, $TSFixMe>;
6
+ index: number;
7
+ seriesItem: IHorizontalBarChartSeriesItem;
8
+ }
9
+ export declare function BarFields({ control, index, seriesItem }: IBarFields): JSX.Element;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { Control, UseFormWatch } from 'react-hook-form';
3
+ import { IHorizontalBarChartConf } from '../../type';
4
+ interface ISeriesField {
5
+ control: Control<IHorizontalBarChartConf, $TSFixMe>;
6
+ watch: UseFormWatch<IHorizontalBarChartConf>;
7
+ data: $TSFixMe[];
8
+ }
9
+ export declare function SeriesField({ control, watch, data }: ISeriesField): JSX.Element;
10
+ export {};
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { Control, UseFieldArrayRemove } from 'react-hook-form';
3
+ import { AnyObject } from '~/types';
4
+ import { IHorizontalBarChartConf, IHorizontalBarChartSeriesItem } from '../../type';
5
+ interface ISeriesItemField {
6
+ control: Control<IHorizontalBarChartConf, $TSFixMe>;
7
+ index: number;
8
+ remove: UseFieldArrayRemove;
9
+ seriesItem: IHorizontalBarChartSeriesItem;
10
+ xAxisOptions: {
11
+ label: string;
12
+ value: string;
13
+ }[];
14
+ data: AnyObject[];
15
+ }
16
+ export declare function SeriesItemField({ control, index, remove, seriesItem, xAxisOptions, data }: ISeriesItemField): JSX.Element;
17
+ export {};
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { Control, UseFormWatch } from 'react-hook-form';
3
+ import { IHorizontalBarChartConf } from '../../type';
4
+ interface IXAxesField {
5
+ control: Control<IHorizontalBarChartConf, $TSFixMe>;
6
+ watch: UseFormWatch<IHorizontalBarChartConf>;
7
+ }
8
+ export declare function XAxesField({ control, watch }: IXAxesField): JSX.Element;
9
+ export {};
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { Control, UseFieldArrayRemove } from 'react-hook-form';
3
+ import { IHorizontalBarChartConf } from '../../type';
4
+ interface IXAxisField {
5
+ control: Control<IHorizontalBarChartConf, $TSFixMe>;
6
+ index: number;
7
+ remove: UseFieldArrayRemove;
8
+ }
9
+ export declare function XAxisField({ control, index, remove }: IXAxisField): JSX.Element;
10
+ export {};
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { Control, UseFormWatch } from 'react-hook-form';
3
+ import { AnyObject } from '~/types';
4
+ import { IHorizontalBarChartConf } from '../../type';
5
+ interface IYAxisField {
6
+ control: Control<IHorizontalBarChartConf, $TSFixMe>;
7
+ watch: UseFormWatch<IHorizontalBarChartConf>;
8
+ data: AnyObject[];
9
+ }
10
+ export declare function YAxisField({ data, control, watch }: IYAxisField): JSX.Element;
11
+ export {};
@@ -0,0 +1,2 @@
1
+ import { VizComponent } from '../../../types/plugin';
2
+ export declare const HorizontalBarChartVizComponent: VizComponent;
@@ -0,0 +1,8 @@
1
+ import { IHorizontalBarChartConf } from '../type';
2
+ export declare function getGrid(conf: IHorizontalBarChartConf): {
3
+ top: number;
4
+ right: number;
5
+ bottom: number;
6
+ left: number;
7
+ containLabel: boolean;
8
+ };
@@ -0,0 +1,72 @@
1
+ import { ITemplateVariable } from '~/utils/template';
2
+ import { IHorizontalBarChartConf } from '../type';
3
+ export declare function getOption(conf: IHorizontalBarChartConf, data: $TSFixMe[], variables: ITemplateVariable[]): {
4
+ xAxis: {
5
+ type: string;
6
+ min: string | undefined;
7
+ max: string | undefined;
8
+ position: "bottom" | "top";
9
+ axisLabel: {
10
+ show: boolean;
11
+ margin: number;
12
+ formatter: (p: any) => string;
13
+ };
14
+ axisLine: {
15
+ show: boolean;
16
+ };
17
+ axisTick: {
18
+ show: boolean;
19
+ };
20
+ splitLine: {
21
+ show: boolean;
22
+ };
23
+ nameTextStyle: {
24
+ fontWeight: string;
25
+ };
26
+ nameLocation: string;
27
+ nameGap: number;
28
+ id: string;
29
+ name: string;
30
+ data_key: string;
31
+ label_formatter: import("../../../../panel/settings/common/numbro-format-selector").TNumbroFormat;
32
+ show: boolean;
33
+ }[];
34
+ yAxis: {
35
+ data: any[];
36
+ name: string;
37
+ nameLocation: string;
38
+ nameTextStyle: {
39
+ align: string;
40
+ fontWeight: string;
41
+ };
42
+ id: string;
43
+ axisTick: {
44
+ show: boolean;
45
+ alignWithLabel: boolean;
46
+ };
47
+ type: string;
48
+ axisLabel: {
49
+ formatter: (value: string | number, index: number) => any;
50
+ width: number;
51
+ overflow: "truncate" | "break" | "breakAll";
52
+ ellipsis: "...";
53
+ };
54
+ z: number;
55
+ }[];
56
+ series: any[];
57
+ tooltip: {
58
+ trigger: string;
59
+ axisPointer: {
60
+ type: string;
61
+ };
62
+ formatter: (params: import("echarts/types/dist/shared").CallbackDataParams[]) => string;
63
+ };
64
+ grid: {
65
+ top: number;
66
+ right: number;
67
+ bottom: number;
68
+ left: number;
69
+ containLabel: boolean;
70
+ };
71
+ legend: Record<string, any>;
72
+ };
@@ -0,0 +1,2 @@
1
+ import { IEchartsSeriesItem } from './utils/types';
2
+ export declare function getLegend(series: IEchartsSeriesItem[]): Record<string, any>;
@@ -0,0 +1,21 @@
1
+ import _ from 'lodash';
2
+ import { AnyObject } from '~/types';
3
+ import { AggregationType } from '~/utils/aggregation';
4
+ import { DataTemplateType } from './types';
5
+ interface IMakeOneSeriesData {
6
+ dataTemplate: DataTemplateType[];
7
+ data: AnyObject[];
8
+ aggregation_on_value?: AggregationType;
9
+ name_data_key: string;
10
+ value_data_key: string;
11
+ valueTypedXAxis: boolean;
12
+ }
13
+ export declare function makeOneSeriesData({ dataTemplate, data, aggregation_on_value, name_data_key, value_data_key, valueTypedXAxis, }: IMakeOneSeriesData): any[];
14
+ interface IMakeGroupedSeriesData {
15
+ group_by_key: string;
16
+ data: AnyObject[];
17
+ name_data_key: string;
18
+ value_data_key: string;
19
+ }
20
+ export declare function makeGroupedSeriesData({ group_by_key, data, value_data_key, name_data_key }: IMakeGroupedSeriesData): _.Dictionary<AnyObject[]>;
21
+ export {};
@@ -0,0 +1,4 @@
1
+ import { AnyObject } from '~/types';
2
+ import { ITemplateVariable } from '~/utils/template';
3
+ import { IHorizontalBarChartConf } from '../../type';
4
+ export declare function getSeries(conf: IHorizontalBarChartConf, xAxisData: string[], valueTypedXAxis: boolean, data: AnyObject[], labelFormatters: Record<string, $TSFixMe>, variables: ITemplateVariable[], variableValueMap: Record<string, string | number>): any[];
@@ -0,0 +1,32 @@
1
+ import { AnyObject } from '~/types';
2
+ import { ITemplateVariable } from '~/utils/template';
3
+ import { IHorizontalBarChartReferenceLine } from '../../type';
4
+ export declare function getReferenceLines(reference_lines: IHorizontalBarChartReferenceLine[], variables: ITemplateVariable[], variableValueMap: Record<string, string | number>, data: AnyObject[]): {
5
+ name: string;
6
+ type: string;
7
+ hide_in_legend: boolean;
8
+ xAxisIndex: string;
9
+ data: never[];
10
+ lineStyle: {
11
+ type: "dashed" | "dotted" | "solid";
12
+ width: number;
13
+ color: string;
14
+ };
15
+ markLine: {
16
+ data: {
17
+ [x: string]: string | number;
18
+ name: string;
19
+ }[];
20
+ silent: boolean;
21
+ symbol: string[];
22
+ lineStyle: {
23
+ type: "dashed" | "dotted" | "solid";
24
+ width: number;
25
+ color: string;
26
+ };
27
+ label: {
28
+ formatter: () => string;
29
+ position: string;
30
+ };
31
+ };
32
+ }[];
@@ -0,0 +1,4 @@
1
+ import { AnyObject } from '~/types';
2
+ import { IHorizontalBarChartConf, IHorizontalBarChartSeriesItem } from '../../type';
3
+ import { DataTemplateType } from './types';
4
+ export declare function getSeriesItemOrItems({ y_axis }: IHorizontalBarChartConf, { data_key, xAxisIndex, label_position, name, group_by_key, aggregation_on_value, stack, color, hide_in_legend, invisible, ...rest }: IHorizontalBarChartSeriesItem, dataTemplate: DataTemplateType[], valueTypedXAxis: boolean, data: AnyObject[], variableValueMap: Record<string, string | number>, labelFormatters: Record<string, $TSFixMe>): any;
@@ -0,0 +1 @@
1
+ export declare type DataTemplateType = [string, 0];
@@ -0,0 +1,10 @@
1
+ import { CallbackDataParams } from 'echarts/types/dist/shared';
2
+ import { IHorizontalBarChartConf } from '../type';
3
+ import { IEchartsSeriesItem } from './utils/types';
4
+ export declare function getTooltip(conf: IHorizontalBarChartConf, series: IEchartsSeriesItem[], labelFormatters: Record<string, (p: $TSFixMe) => string>): {
5
+ trigger: string;
6
+ axisPointer: {
7
+ type: string;
8
+ };
9
+ formatter: (params: CallbackDataParams[]) => string;
10
+ };
@@ -0,0 +1,2 @@
1
+ import { IHorizontalBarChartConf } from '../../type';
2
+ export declare function getLabelFormatters(conf: IHorizontalBarChartConf): Record<string, (params: $TSFixMe) => string>;
@@ -0,0 +1,9 @@
1
+ export declare type TEchartsSeriesType = 'bar' | 'scatter';
2
+ export interface IEchartsSeriesItem {
3
+ name: string;
4
+ color?: string;
5
+ type: TEchartsSeriesType;
6
+ hide_in_legend: boolean;
7
+ xAxisIndex: number;
8
+ yAxisIndex: number;
9
+ }
@@ -0,0 +1,3 @@
1
+ import { AnyObject } from '~/types';
2
+ import { ITemplateVariable } from '~/utils/template';
3
+ export declare function getVariableValueMap(data: AnyObject[], variables: ITemplateVariable[]): Record<string, string | number>;
@@ -0,0 +1,31 @@
1
+ import { IHorizontalBarChartConf } from '../type';
2
+ export declare function getXAxes(conf: IHorizontalBarChartConf, labelFormatters: Record<string, (p: $TSFixMe) => string>): {
3
+ type: string;
4
+ min: string | undefined;
5
+ max: string | undefined;
6
+ position: "bottom" | "top";
7
+ axisLabel: {
8
+ show: boolean;
9
+ margin: number;
10
+ formatter: (p: $TSFixMe) => string;
11
+ };
12
+ axisLine: {
13
+ show: boolean;
14
+ };
15
+ axisTick: {
16
+ show: boolean;
17
+ };
18
+ splitLine: {
19
+ show: boolean;
20
+ };
21
+ nameTextStyle: {
22
+ fontWeight: string;
23
+ };
24
+ nameLocation: string;
25
+ nameGap: number;
26
+ id: string;
27
+ name: string;
28
+ data_key: string;
29
+ label_formatter: import("../../../../panel/settings/common/numbro-format-selector").TNumbroFormat;
30
+ show: boolean;
31
+ }[];
@@ -0,0 +1,23 @@
1
+ import { IHorizontalBarChartConf } from '../type';
2
+ export declare function getYAxes(conf: IHorizontalBarChartConf, yAxisData: $TSFixMe[]): {
3
+ data: any[];
4
+ name: string;
5
+ nameLocation: string;
6
+ nameTextStyle: {
7
+ align: string;
8
+ fontWeight: string;
9
+ };
10
+ id: string;
11
+ axisTick: {
12
+ show: boolean;
13
+ alignWithLabel: boolean;
14
+ };
15
+ type: string;
16
+ axisLabel: {
17
+ formatter: (value: string | number, index: number) => any;
18
+ width: number;
19
+ overflow: "truncate" | "break" | "breakAll";
20
+ ellipsis: "...";
21
+ };
22
+ z: number;
23
+ }[];
@@ -0,0 +1,68 @@
1
+ import { TNumbroFormat } from '~/panel/settings/common/numbro-format-selector';
2
+ import { IAxisLabelOverflow } from '~/plugins/common-echarts-fields/axis-label-overflow';
3
+ import { IEchartsTooltipMetric } from '~/plugins/common-echarts-fields/tooltip-metric';
4
+ import { AggregationType } from '~/utils/aggregation';
5
+ import { IXAxisLabelFormatter } from '../cartesian/panel/x-axis/x-axis-label-formatter/types';
6
+ export interface IHorizontalBarChartReferenceLine {
7
+ id: string;
8
+ name: string;
9
+ template: string;
10
+ lineStyle: {
11
+ type: 'solid' | 'dashed' | 'dotted';
12
+ width: number;
13
+ color: string;
14
+ };
15
+ xAxisIndex: string;
16
+ orientation: 'horizontal' | 'vertical';
17
+ variable_key: string;
18
+ show_in_legend: boolean;
19
+ }
20
+ export interface IHorizontalBarChartSeriesItem {
21
+ id: string;
22
+ type: 'bar';
23
+ name: string;
24
+ stack: string;
25
+ color?: string;
26
+ barGap?: '0%' | '-100%';
27
+ data_key: string;
28
+ barWidth: string;
29
+ xAxisIndex: string;
30
+ barMinWidth: string;
31
+ barMaxWidth: string;
32
+ group_by_key: string;
33
+ hide_in_legend: boolean;
34
+ invisible: boolean;
35
+ label_position?: string;
36
+ aggregation_on_value?: AggregationType;
37
+ }
38
+ export interface IHorizontalBarChartXAxis {
39
+ id: string;
40
+ min: string;
41
+ max: string;
42
+ name: string;
43
+ data_key: string;
44
+ position: 'top' | 'bottom';
45
+ label_formatter: TNumbroFormat;
46
+ show: boolean;
47
+ }
48
+ export interface IHorizontalBarChartConf {
49
+ x_axes: IHorizontalBarChartXAxis[];
50
+ y_axis: {
51
+ name: string;
52
+ data_key: string;
53
+ axisLabel: {
54
+ overflow: IAxisLabelOverflow;
55
+ formatter: IXAxisLabelFormatter;
56
+ };
57
+ nameAlignment: 'left' | 'center' | 'right';
58
+ };
59
+ series: IHorizontalBarChartSeriesItem[];
60
+ tooltip: {
61
+ metrics: IEchartsTooltipMetric[];
62
+ };
63
+ reference_lines: IHorizontalBarChartReferenceLine[];
64
+ }
65
+ export declare const DEFAULT_CONFIG: IHorizontalBarChartConf;
66
+ export declare function getNewXAxis(): IHorizontalBarChartXAxis;
67
+ export declare function getNewSeriesItem(): IHorizontalBarChartSeriesItem;
68
+ export declare function getNewReferenceLine(): IHorizontalBarChartReferenceLine;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { VizConfigProps } from '../../../types/plugin';
3
+ export declare function VizHorizontalBarChartEditor({ context }: VizConfigProps): JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { VizViewProps } from '~/types/plugin';
3
+ export declare function VizHorizontalBarChart({ context, instance }: VizViewProps): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtable/dashboard",
3
- "version": "8.30.0",
3
+ "version": "8.32.0",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public",