-
Notifications
You must be signed in to change notification settings - Fork 77
/
types-config.ts
137 lines (129 loc) 路 3.57 KB
/
types-config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
export interface ChartCardExternalConfig {
type: 'custom:apexcharts-card';
config_templates?: string[];
color_list?: string[];
locale?: string;
experimental?: {
color_threshold?: boolean;
disable_config_validation?: boolean;
hidden_by_default?: boolean;
};
chart_type?: 'line' | 'scatter' | 'pie' | 'donut' | 'radialBar';
update_interval?: string;
update_delay?: string;
all_series_config?: ChartCardAllSeriesExternalConfig;
series: ChartCardSeriesExternalConfig[];
graph_span?: string;
span?: ChartCardSpanExtConfig;
y_axis_precision?: number;
now?: {
show?: boolean;
color?: string;
label?: string;
};
show?: {
loading?: boolean;
};
cache?: boolean;
stacked?: boolean;
layout?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
apex_config?: any;
header?: ChartCardHeaderExternalConfig;
// Support to define style (card-mod or picture-entity)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
style?: any;
}
export interface ChartCardSpanExtConfig {
start?: 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
end?: 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
offset?: string;
}
export interface ChartCardAllSeriesExternalConfig {
attribute?: string;
name?: string;
type?: 'line' | 'column' | 'area';
color?: string;
opacity?: number;
curve?: 'smooth' | 'straight' | 'stepline';
stroke_width?: number;
extend_to_end?: boolean;
unit?: string;
invert?: boolean;
data_generator?: string;
float_precision?: number;
min?: number;
max?: number;
offset?: string;
fill_raw?: GroupByFill;
show?: {
as_duration?: ChartCardPrettyTime;
legend_value?: boolean;
in_header?: boolean | 'raw';
in_chart?: boolean;
datalabels?: boolean | 'total';
hidden_by_default?: boolean;
extremas?: boolean;
};
group_by?: {
duration?: string;
func?: GroupByFunc;
fill?: GroupByFill;
};
transform?: string;
color_threshold?: ChartCardColorThreshold[];
}
// Need to duplicate because of https://github.com/gristlabs/ts-interface-checker/issues/35
// export interface ChartCardSeriesExternalConfig extends ChartCardAllSeriesExternalConfig {
// entity: string;
// }
export interface ChartCardSeriesExternalConfig {
entity: string;
attribute?: string;
name?: string;
type?: 'line' | 'column' | 'area';
color?: string;
opacity?: number;
curve?: 'smooth' | 'straight' | 'stepline';
stroke_width?: number;
extend_to_end?: boolean;
unit?: string;
invert?: boolean;
data_generator?: string;
float_precision?: number;
min?: number;
max?: number;
offset?: string;
fill_raw?: GroupByFill;
show?: {
as_duration?: ChartCardPrettyTime;
legend_value?: boolean;
in_header?: boolean | 'raw';
in_chart?: boolean;
datalabels?: boolean | 'total';
hidden_by_default?: boolean;
extremas?: boolean;
};
group_by?: {
duration?: string;
func?: GroupByFunc;
fill?: GroupByFill;
};
transform?: string;
color_threshold?: ChartCardColorThreshold[];
}
export type ChartCardPrettyTime = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
export type GroupByFill = 'null' | 'last' | 'zero';
export type GroupByFunc = 'raw' | 'avg' | 'min' | 'max' | 'last' | 'first' | 'sum' | 'median' | 'delta' | 'diff';
export interface ChartCardHeaderExternalConfig {
show?: boolean;
floating?: boolean;
title?: string;
show_states?: boolean;
colorize_states?: boolean;
}
export interface ChartCardColorThreshold {
value: number;
color?: string;
opacity?: number;
}