-
Notifications
You must be signed in to change notification settings - Fork 76
/
types-config.ts
216 lines (198 loc) 路 5.77 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
export interface ChartCardExternalConfig {
type: 'custom:apexcharts-card';
config_templates?: string[] | string;
color_list?: string[];
locale?: string;
experimental?: {
color_threshold?: boolean;
disable_config_validation?: boolean;
hidden_by_default?: boolean;
brush?: boolean;
};
hours_12?: boolean;
chart_type?: ChartCardChartType;
update_interval?: string;
update_delay?: string;
all_series_config?: ChartCardAllSeriesExternalConfig;
series: ChartCardSeriesExternalConfig[];
graph_span?: string;
span?: ChartCardSpanExtConfig;
now?: {
show?: boolean;
color?: string;
label?: string;
};
show?: {
loading?: boolean;
last_updated?: 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/card-mod-v3.0 or picture-entity)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
style?: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
card_mod?: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
view_layout?: any;
index?: number;
view_index?: number;
brush?: ChartCardBrushExtConfig;
yaxis?: ChartCardYAxisExternal[];
}
export type ChartCardChartType = 'line' | 'scatter' | 'pie' | 'donut' | 'radialBar';
export interface ChartCardBrushExtConfig {
selection_span?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
apex_config?: any;
}
export interface ChartCardSpanExtConfig {
start?: ChartCardStartEnd;
end?: ChartCardStartEnd;
offset?: string;
}
export type ChartCardStartEnd = 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year' | 'isoWeek';
export interface ChartCardAllSeriesExternalConfig {
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?: ChartCardSeriesShowConfigExt;
group_by?: {
duration?: string;
func?: GroupByFunc;
fill?: GroupByFill;
start_with_last?: boolean;
};
transform?: string;
color_threshold?: ChartCardColorThreshold[];
yaxis_id?: string;
header_actions?: ActionsConfig;
}
export interface ActionsConfig {
tap_action?: ActionConfig;
hold_action?: ActionConfig;
double_tap_action?: ActionConfig;
entity?: string;
}
export interface ChartCardSeriesShowConfigExt {
as_duration?: ChartCardPrettyTime;
legend_value?: boolean;
in_header?: boolean | 'raw' | 'before_now' | 'after_now';
name_in_header?: boolean;
header_color_threshold?: boolean;
in_chart?: boolean;
datalabels?: boolean | 'total' | 'percent';
hidden_by_default?: boolean;
extremas?: boolean | 'time' | 'min' | 'max' | 'min+time' | 'max+time';
in_brush?: boolean;
offset_in_name?: boolean;
}
export interface ChartCardSeriesExternalConfig extends ChartCardAllSeriesExternalConfig {
entity: string;
}
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;
standard_format?: boolean;
disable_actions?: boolean;
}
export interface ChartCardColorThreshold {
value: number;
color?: string;
opacity?: number;
}
export interface ChartCardYAxisExternal {
id?: string;
show?: boolean;
opposite?: boolean;
min?: 'auto' | number | string;
max?: 'auto' | number | string;
align_to?: number;
decimals?: number;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
apex_config?: any;
}
export interface ToggleMenuActionConfig extends BaseActionConfig {
action: 'toggle-menu';
haptic?: HapticType;
}
export interface ToggleActionConfig extends BaseActionConfig {
action: 'toggle';
haptic?: HapticType;
}
export interface CallServiceActionConfig extends BaseActionConfig {
action: 'call-service';
service: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
service_data?: any;
haptic?: HapticType;
}
export interface NavigateActionConfig extends BaseActionConfig {
action: 'navigate';
navigation_path: string;
haptic?: HapticType;
}
export interface UrlActionConfig extends BaseActionConfig {
action: 'url';
url_path: string;
haptic?: HapticType;
}
export interface MoreInfoActionConfig extends BaseActionConfig {
action: 'more-info';
entity?: string;
haptic?: HapticType;
}
export interface NoActionConfig extends BaseActionConfig {
action: 'none';
haptic?: HapticType;
}
export interface CustomActionConfig extends BaseActionConfig {
action: 'fire-dom-event';
haptic?: HapticType;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
browser_mod?: any;
}
export interface BaseActionConfig {
confirmation?: ConfirmationRestrictionConfig;
}
export interface ConfirmationRestrictionConfig {
text?: string;
exemptions?: RestrictionConfig[];
}
export interface RestrictionConfig {
user: string;
}
export declare type HapticType = 'success' | 'warning' | 'failure' | 'light' | 'medium' | 'heavy' | 'selection';
export declare type ActionConfig =
| ToggleActionConfig
| CallServiceActionConfig
| NavigateActionConfig
| UrlActionConfig
| MoreInfoActionConfig
| NoActionConfig
| CustomActionConfig
| ToggleMenuActionConfig;