@yelingfeng/pandora2 1.0.5 → 1.0.6

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.
@@ -0,0 +1,3 @@
1
+ import type { EChartsOption } from 'echarts';
2
+ import type { IChartConfigType } from '../../types';
3
+ export declare const build: (originData: any, chartConfig?: IChartConfigType) => EChartsOption;
@@ -0,0 +1,81 @@
1
+ import type { IChartConfigType } from '../../types';
2
+ export declare const build: (originData: any, chartConfig?: IChartConfigType) => {
3
+ tooltip: {
4
+ trigger: string;
5
+ axisPointer: {
6
+ type: string;
7
+ };
8
+ confine: boolean;
9
+ formatter(params: any): string;
10
+ };
11
+ grid: {
12
+ top: string;
13
+ left: string;
14
+ right: string;
15
+ bottom: string;
16
+ containLabel: boolean;
17
+ };
18
+ xAxis: {
19
+ show: boolean;
20
+ type: string;
21
+ max: any;
22
+ };
23
+ yAxis: ({
24
+ type: string;
25
+ axisTick: string;
26
+ axisLine: string;
27
+ show: boolean;
28
+ data: any;
29
+ inverse: boolean;
30
+ axisLabel: {
31
+ textStyle: {
32
+ color: string;
33
+ fontSize?: undefined;
34
+ };
35
+ formatter: (val: any, i: number) => string;
36
+ rich: any;
37
+ };
38
+ } | {
39
+ type: string;
40
+ inverse: boolean;
41
+ axisTick: string;
42
+ axisLine: string;
43
+ show: boolean;
44
+ axisLabel: {
45
+ formatter: (val: any, index: number) => any;
46
+ textStyle: {
47
+ color: string;
48
+ fontSize: string;
49
+ };
50
+ rich?: undefined;
51
+ };
52
+ data: any;
53
+ })[];
54
+ series: ({
55
+ name: string;
56
+ type: string;
57
+ zlevel: number;
58
+ itemStyle: {
59
+ normal: {
60
+ color: (params: any) => string;
61
+ barBorderRadius: number;
62
+ };
63
+ };
64
+ barWidth: number;
65
+ data: any;
66
+ barGap?: undefined;
67
+ } | {
68
+ name: string;
69
+ type: string;
70
+ barWidth: number;
71
+ barGap: string;
72
+ data: any;
73
+ itemStyle: {
74
+ normal: {
75
+ color: string;
76
+ barBorderRadius: number;
77
+ };
78
+ };
79
+ zlevel?: undefined;
80
+ })[];
81
+ };
@@ -0,0 +1,2 @@
1
+ declare const result: any;
2
+ export default result;
@@ -0,0 +1,3 @@
1
+ import type { EChartsOption } from 'echarts';
2
+ import type { IChartConfigType } from '../../types';
3
+ export declare const build: (originData: any, chartConfig?: IChartConfigType) => EChartsOption;
@@ -2,15 +2,19 @@
2
2
  * 默认主题 Colors
3
3
  */
4
4
  export declare const COMMON_COLORS: string[];
5
+ export declare const DARK_COLORS: string[];
5
6
  /**
6
7
  * backgroundColor
7
8
  */
8
9
  export declare const BG_COLOR = "#fff";
10
+ export declare const DARK_BG = "#141414";
9
11
  /**
10
12
  * axisLable Color
11
13
  */
12
- export declare const AXIS_LBAEL_COLOR = "#C8E6E8";
13
- export declare const AXIS_LINE_COLOR = "#83D2EE";
14
+ export declare const AXIS_LABEL_COLOR = "#666666";
15
+ export declare const DARK_AXIS_LABEL_COLOR = "#D0D6E5";
16
+ export declare const AXIS_LINE_COLOR = "#666666";
17
+ export declare const DARK_AXIS_LINE_COLOR = "rgba(0, 188, 255, 0.25)";
14
18
  /**
15
19
  * 默认line 类型
16
20
  */
@@ -18,4 +22,10 @@ export declare const DEAULT_LINE_TYPE = "dashed";
18
22
  /**
19
23
  * splitLine color
20
24
  */
21
- export declare const SPLIT_LINE_COLOR = "rgba(61,73,124,1)";
25
+ export declare const SPLIT_LINE_COLOR = "#f4f4f4";
26
+ export declare const DARK_SPLIT_LINE_COLOR = "rgba(38, 46, 64, .5)";
27
+ /**
28
+ * 图例配色
29
+ */
30
+ export declare const LEGEND_LABEL_COLOR = "#1A1A1A";
31
+ export declare const DARK_LEGEND_LABEL_COLOR = "#D0D6E5";
@@ -1,6 +1,6 @@
1
1
  import { type PropType } from 'vue';
2
2
  import type { AutoresizeProp, LoadingOptions, OriginData, Theme } from '../types';
3
- import type { ChartTypes, SubChartType } from '../types/chart';
3
+ import type { ChartTypes, IChartConfigType, SubChartType } from '../types/chart';
4
4
  export declare const defaultProps: {
5
5
  data: {
6
6
  type: PropType<OriginData<any>[]>;
@@ -14,6 +14,10 @@ export declare const defaultProps: {
14
14
  default: () => void;
15
15
  };
16
16
  chartConfig: {
17
+ type: PropType<IChartConfigType>;
18
+ default: () => {};
19
+ };
20
+ bizConfig: {
17
21
  type: PropType<Record<string, any>>;
18
22
  default: () => {};
19
23
  };
@@ -10,5 +10,5 @@ export declare const transformOriginDataToSeries: (data: any, chartName: ChartTy
10
10
  * 转化饼图数据 生成 echarts Series 对象
11
11
  */
12
12
  export declare const transformPieDataToSeries: (data: any, colors: any) => any;
13
- export declare const transformGroupDataToSeries: (data: any, chartName: ChartTypes) => any;
13
+ export declare const transformGroupDataToSeries: (data: any, chartName: ChartTypes, cfg?: Record<string, any>) => any;
14
14
  export declare const transformRankBarData: (data: any) => any;
@@ -32,3 +32,51 @@ export declare const getNormalSeriesObj: (originData: any[], chartName: ChartTyp
32
32
  export declare const getCategory: (originData: any[]) => {
33
33
  name: string;
34
34
  }[];
35
+ export declare const normalizeXAxis: (xAxis: any) => string[];
36
+ export declare const buildSeries: (groups: any[], xAxisData: string[], afv: any) => {
37
+ series: {
38
+ name: string;
39
+ data: number[];
40
+ }[];
41
+ unitForAxis: string;
42
+ yRange: null;
43
+ };
44
+ export declare const buildYAxis: (axisLabel: any, axisLine: any, splitLine: any, unit: string, yRange: [number, number] | null) => {
45
+ min?: number | undefined;
46
+ max?: number | undefined;
47
+ type: string;
48
+ axisLabel: any;
49
+ axisLine: any;
50
+ splitLine: any;
51
+ axisTick: {
52
+ show: boolean;
53
+ };
54
+ };
55
+ export declare const buildBarXAxis: (data: string[], axisLabel: any, axisLine: any, splitLine: any) => {
56
+ type: string;
57
+ data: string[];
58
+ axisLabel: any;
59
+ axisLine: any;
60
+ splitLine: any;
61
+ axisTick: {
62
+ show: boolean;
63
+ };
64
+ };
65
+ export declare const buildLineXAxis: (data: string[], axisLabel: any, axisLine: any, splitLine: any) => {
66
+ type: string;
67
+ boundaryGap: boolean;
68
+ data: string[];
69
+ axisLabel: any;
70
+ axisLine: any;
71
+ splitLine: any;
72
+ axisTick: {
73
+ show: boolean;
74
+ };
75
+ };
76
+ export declare const buildTooltip: (tooltipCfg: any, unit: string, themeMode: 'light' | 'dark') => {
77
+ trigger: string;
78
+ textStyle: {
79
+ color: string;
80
+ };
81
+ extraCssText: string;
82
+ } | undefined;
@@ -1,3 +1,5 @@
1
+ import { type AutoFormatArrayOptions } from './formatter';
2
+ import { type AxisLabelType, type AxisLineType, type BaseLineType, type DataZoomType } from './props';
1
3
  export declare enum ChartTypeEnum {
2
4
  Bar = "bar",
3
5
  Pie = "pie",
@@ -16,4 +18,61 @@ export type ChartTypes = IChartType[keyof IChartType];
16
18
  /**
17
19
  * 二级图表
18
20
  */
19
- export type SubChartType = 'pie01' | 'pie02' | 'pie03' | 'bar01' | 'bar02';
21
+ export type SubChartType = 'pie01' | 'pie02' | 'pie03' | 'horiRankBar' | 'basicBar';
22
+ /**
23
+ * 自动格式化视图
24
+ */
25
+ export interface IChartConfigType {
26
+ themeMode?: 'light' | 'dark';
27
+ colors?: string[];
28
+ smooth?: boolean;
29
+ step?: boolean;
30
+ legend?: Record<string, any>;
31
+ axisLabel?: AxisLabelType;
32
+ axisLine?: AxisLineType;
33
+ splitLine?: BaseLineType;
34
+ tooltip?: Record<string, any>;
35
+ dataZoom?: DataZoomType;
36
+ bar?: BarConfig;
37
+ autoFormatView?: AutoFormatArrayOptions;
38
+ }
39
+ export interface BarLabelConfig {
40
+ minWidth?: number;
41
+ maxWidth?: number;
42
+ charWidth?: number;
43
+ }
44
+ export interface BarRankItemStyle {
45
+ backgroundColor?: string;
46
+ borderColor?: string;
47
+ color?: string;
48
+ width?: number;
49
+ height?: number;
50
+ fontSize?: number;
51
+ }
52
+ export interface BarRankConfig {
53
+ topCount?: number;
54
+ topColors?: BarRankItemStyle[];
55
+ backgroundColor?: string;
56
+ color?: string;
57
+ width?: number;
58
+ height?: number;
59
+ fontSize?: number;
60
+ }
61
+ export interface BarRightLabelConfig {
62
+ prefix?: string;
63
+ suffix?: string;
64
+ formatter?: (args: {
65
+ rawValue: number;
66
+ value: number;
67
+ name: string;
68
+ index: number;
69
+ }) => string;
70
+ }
71
+ export interface BarConfig {
72
+ color?: string;
73
+ backgroundColor?: string;
74
+ topColors?: string[];
75
+ label?: BarLabelConfig;
76
+ rank?: BarRankConfig;
77
+ rightLabel?: BarRightLabelConfig;
78
+ }
@@ -0,0 +1,4 @@
1
+ declare module 'echarts/theme/dark' {
2
+ const theme: any
3
+ export default theme
4
+ }
@@ -0,0 +1,30 @@
1
+ export type FormatMode = 'array';
2
+ export declare const RATE_UNITS: readonly ["Kbps", "Mbps", "Gbps", "Tbps"];
3
+ export type RateUnit = typeof RATE_UNITS[number];
4
+ export interface RateResult {
5
+ label: string;
6
+ unit: RateUnit | '';
7
+ }
8
+ export interface NumberUnit {
9
+ value: number;
10
+ symbol: string;
11
+ }
12
+ export interface NumberResult {
13
+ label: string;
14
+ unit: string;
15
+ }
16
+ export type ArrayFormatType = 'flow' | 'num' | 'percent' | 'custom' | 'rate';
17
+ export interface AutoFormatArrayOptions<T = any> {
18
+ key?: keyof T;
19
+ type?: ArrayFormatType;
20
+ decimalPlaces?: number;
21
+ showUnitLabel?: boolean;
22
+ unitName?: string;
23
+ }
24
+ export interface ArrayResult<T = any> {
25
+ data: T[];
26
+ unit: string;
27
+ yAxisRange: [number, number];
28
+ }
29
+ export type AutoFormatOptions<T = any> = AutoFormatArrayOptions<T>;
30
+ export type AutoFormatReturn<T = any> = ArrayResult<T>;
@@ -1,5 +1,7 @@
1
1
  import { init, type ECElementEvent, type ElementEvent, type SetOptionOpts } from 'echarts/core';
2
2
  import { Ref } from 'vue';
3
+ import { type IChartConfigType } from './chart';
4
+ export type { IChartConfigType } from './chart';
3
5
  export type Injection<T> = T | null | Ref<T | null> | {
4
6
  value: T | null;
5
7
  };
@@ -66,7 +68,7 @@ export type AutoresizeProp = boolean | {
66
68
  export interface ChartsProps {
67
69
  data?: any[];
68
70
  options?: ChartsOption;
69
- chartConfig?: Record<string, any>;
71
+ chartConfig?: IChartConfigType;
70
72
  theme?: Theme;
71
73
  chartType?: string;
72
74
  subChartType?: string;
@@ -92,4 +94,3 @@ export type UseChartsReturnType = [
92
94
  (instance: ChartsActionType) => void,
93
95
  ChartsActionType
94
96
  ];
95
- export {};
@@ -0,0 +1,7 @@
1
+ import { ArrayResult, AutoFormatOptions } from '../types/formatter';
2
+ export interface NumberUnit {
3
+ value: number;
4
+ symbol: string;
5
+ }
6
+ export declare function autoFormat(input: any, options: AutoFormatOptions<any>): ArrayResult<any>;
7
+ export declare function formatNumberValueOnly(input: number | string, decimalPlaces?: number): string;
@@ -1,7 +1,8 @@
1
1
  import { EChartsOption } from 'echarts';
2
+ import type { IChartConfigType } from '../types/chart';
2
3
  import { ChartTypes, SubChartType } from '../types/chart';
3
4
  /**
4
5
  * echarts 构建 封装
5
6
  * build
6
7
  */
7
- export declare const build: (data: any, chartType: ChartTypes, subChartType: SubChartType, chartConfig?: Record<string, any>) => EChartsOption;
8
+ export declare const build: (data: any, chartType: ChartTypes, subChartType: SubChartType, chartConfig?: IChartConfigType) => EChartsOption;
@@ -3,7 +3,7 @@ import { AxisLabelType, AxisLineType, BaseLineType, DataZoomType } from '../type
3
3
  * @param opt
4
4
  * @returns
5
5
  */
6
- export declare function getSplitLineOpt(opt: BaseLineType): {
6
+ export declare function getSplitLineOpt(opt: BaseLineType, mode?: 'light' | 'dark'): {
7
7
  xAxis: {
8
8
  show: boolean;
9
9
  lineStyle: {
@@ -24,7 +24,7 @@ export declare function getSplitLineOpt(opt: BaseLineType): {
24
24
  * @param opt
25
25
  * @returns
26
26
  */
27
- export declare function getAxisLineOpt(opt: AxisLineType): {
27
+ export declare function getAxisLineOpt(opt: AxisLineType, mode?: 'light' | 'dark'): {
28
28
  xAxis: {
29
29
  show: boolean;
30
30
  symbol: string | any[];
@@ -49,7 +49,7 @@ export declare function getAxisLineOpt(opt: AxisLineType): {
49
49
  * @param opt
50
50
  * @returns
51
51
  */
52
- export declare function getAxisLabelOpt(opt: AxisLabelType): {
52
+ export declare function getAxisLabelOpt(opt: AxisLabelType, mode?: 'light' | 'dark'): {
53
53
  xAxis: {
54
54
  show: boolean;
55
55
  textStyle: {
@@ -57,7 +57,6 @@ export declare function getAxisLabelOpt(opt: AxisLabelType): {
57
57
  };
58
58
  rotate: number;
59
59
  interval: string;
60
- formatter: string | import("../types/props").Fn;
61
60
  };
62
61
  yAxis: {
63
62
  show: boolean;
@@ -71,7 +70,7 @@ export declare function getAxisLabelOpt(opt: AxisLabelType): {
71
70
  * @param opt
72
71
  * @returns
73
72
  */
74
- export declare const getDataZoomOpt: (opt: DataZoomType) => {
73
+ export declare const getDataZoomOpt: (opt: DataZoomType, mode?: 'light' | 'dark') => {
75
74
  show: boolean | undefined;
76
75
  backgroundColor: string;
77
76
  borderColor: string;
@@ -80,8 +79,8 @@ export declare const getDataZoomOpt: (opt: DataZoomType) => {
80
79
  radiusAxisIndex: number;
81
80
  bottom: number;
82
81
  brushSelect: boolean;
83
- startValue: number | undefined;
84
- endValue: number;
82
+ start: number | undefined;
83
+ end: number;
85
84
  handleIcon: string;
86
85
  handleSize: string;
87
86
  fillerColor: string;
@@ -93,8 +92,40 @@ export declare const getDataZoomOpt: (opt: DataZoomType) => {
93
92
  textStyle: {
94
93
  color: string;
95
94
  };
96
- }[];
97
- export declare const defaultThemeOpt: () => {
95
+ }[] | ({
96
+ type: string;
97
+ start: number | undefined;
98
+ end: number;
99
+ xAxisIndex: number;
100
+ show?: undefined;
101
+ rangeMode?: undefined;
102
+ height?: undefined;
103
+ } | {
104
+ show: boolean | undefined;
105
+ type: string;
106
+ start: number | undefined;
107
+ rangeMode: string;
108
+ end: number;
109
+ height: number;
110
+ xAxisIndex: number;
111
+ })[];
112
+ export declare const getLegendOpt: (mode?: 'light' | 'dark', legendCfg?: Record<string, any>, legendData?: any[]) => {
113
+ show: boolean;
114
+ type: string;
115
+ data: any[];
116
+ icon: string;
117
+ align: string;
118
+ top: number;
119
+ itemWidth: number;
120
+ itemHeight: number;
121
+ itemGap: number;
122
+ textStyle: {
123
+ fontSize: number;
124
+ color: string;
125
+ };
126
+ pageIconColor: string;
127
+ } & Record<string, any>;
128
+ export declare const defaultThemeOpt: (mode?: 'light' | 'dark') => {
98
129
  color: string[];
99
130
  backgroundColor: string;
100
131
  };
@@ -0,0 +1,7 @@
1
+ export declare const getTooltip: (opt?: Record<string, any>, mode?: 'light' | 'dark') => {
2
+ trigger: string;
3
+ textStyle: {
4
+ color: string;
5
+ };
6
+ extraCssText: string;
7
+ };