Sort selectors (#12120)

This commit is contained in:
Erik Montnemery 2022-03-24 11:53:32 +01:00 committed by GitHub
parent 420e8fe1ff
commit 40d878689f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,35 +1,51 @@
export type Selector = export type Selector =
| ActionSelector
| AddonSelector | AddonSelector
| AreaSelector
| AttributeSelector | AttributeSelector
| EntitySelector | BooleanSelector
| ColorRGBSelector
| ColorTempSelector
| DateSelector | DateSelector
| DateTimeSelector | DateTimeSelector
| DeviceSelector | DeviceSelector
| DurationSelector | DurationSelector
| AreaSelector | EntitySelector
| TargetSelector | IconSelector
| LocationSelector
| MediaSelector
| NumberSelector | NumberSelector
| BooleanSelector
| TimeSelector
| ActionSelector
| StringSelector
| ObjectSelector | ObjectSelector
| SelectSelector | SelectSelector
| IconSelector | StringSelector
| MediaSelector | TargetSelector
| ThemeSelector | ThemeSelector
| LocationSelector | TimeSelector;
| ColorTempSelector
| ColorRGBSelector;
export interface EntitySelector { export interface ActionSelector {
entity: { // eslint-disable-next-line @typescript-eslint/ban-types
integration?: string; action: {};
domain?: string | string[]; }
device_class?: string;
multiple?: boolean; export interface AddonSelector {
includeEntities?: string[]; addon: {
excludeEntities?: string[]; name?: string;
slug?: string;
};
}
export interface AreaSelector {
area: {
entity?: {
integration?: EntitySelector["entity"]["integration"];
domain?: EntitySelector["entity"]["domain"];
device_class?: EntitySelector["entity"]["device_class"];
};
device?: {
integration?: DeviceSelector["device"]["integration"];
manufacturer?: DeviceSelector["device"]["manufacturer"];
model?: DeviceSelector["device"]["model"];
};
}; };
} }
@ -39,11 +55,23 @@ export interface AttributeSelector {
}; };
} }
export interface BooleanSelector {
// eslint-disable-next-line @typescript-eslint/ban-types
boolean: {};
}
export interface ColorRGBSelector { export interface ColorRGBSelector {
// eslint-disable-next-line @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/ban-types
color_rgb: {}; color_rgb: {};
} }
export interface ColorTempSelector {
color_temp: {
min_mireds?: number;
max_mireds?: number;
};
}
export interface DateSelector { export interface DateSelector {
// eslint-disable-next-line @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/ban-types
date: {}; date: {};
@ -72,40 +100,49 @@ export interface DurationSelector {
duration: {}; duration: {};
} }
export interface AddonSelector { export interface EntitySelector {
addon: { entity: {
name?: string; integration?: string;
slug?: string; domain?: string | string[];
device_class?: string;
multiple?: boolean;
includeEntities?: string[];
excludeEntities?: string[];
}; };
} }
export interface AreaSelector { export interface IconSelector {
area: { icon: {
entity?: { placeholder?: string;
integration?: EntitySelector["entity"]["integration"]; fallbackPath?: string;
domain?: EntitySelector["entity"]["domain"];
device_class?: EntitySelector["entity"]["device_class"];
};
device?: {
integration?: DeviceSelector["device"]["integration"];
manufacturer?: DeviceSelector["device"]["manufacturer"];
model?: DeviceSelector["device"]["model"];
};
}; };
} }
export interface TargetSelector { export interface LocationSelector {
target: { location: { radius?: boolean; icon?: string };
entity?: { }
integration?: EntitySelector["entity"]["integration"];
domain?: EntitySelector["entity"]["domain"]; export interface LocationSelectorValue {
device_class?: EntitySelector["entity"]["device_class"]; latitude: number;
}; longitude: number;
device?: { radius?: number;
integration?: DeviceSelector["device"]["integration"]; }
manufacturer?: DeviceSelector["device"]["manufacturer"];
model?: DeviceSelector["device"]["model"]; export interface MediaSelector {
}; // eslint-disable-next-line @typescript-eslint/ban-types
media: {};
}
export interface MediaSelectorValue {
entity_id?: string;
media_content_id?: string;
media_content_type?: string;
metadata?: {
title?: string;
thumbnail?: string | null;
media_class?: string;
children_media_class?: string | null;
navigateIds?: { media_content_type: string; media_content_id: string }[];
}; };
} }
@ -119,28 +156,22 @@ export interface NumberSelector {
}; };
} }
export interface ColorTempSelector { export interface ObjectSelector {
color_temp: { // eslint-disable-next-line @typescript-eslint/ban-types
min_mireds?: number; object: {};
max_mireds?: number; }
export interface SelectOption {
value: string;
label: string;
}
export interface SelectSelector {
select: {
options: string[] | SelectOption[];
}; };
} }
export interface BooleanSelector {
// eslint-disable-next-line @typescript-eslint/ban-types
boolean: {};
}
export interface TimeSelector {
// eslint-disable-next-line @typescript-eslint/ban-types
time: {};
}
export interface ActionSelector {
// eslint-disable-next-line @typescript-eslint/ban-types
action: {};
}
export interface StringSelector { export interface StringSelector {
text: { text: {
multiline?: boolean; multiline?: boolean;
@ -162,58 +193,25 @@ export interface StringSelector {
}; };
} }
export interface ObjectSelector { export interface TargetSelector {
// eslint-disable-next-line @typescript-eslint/ban-types target: {
object: {}; entity?: {
} integration?: EntitySelector["entity"]["integration"];
domain?: EntitySelector["entity"]["domain"];
export interface SelectOption { device_class?: EntitySelector["entity"]["device_class"];
value: string; };
label: string; device?: {
} integration?: DeviceSelector["device"]["integration"];
manufacturer?: DeviceSelector["device"]["manufacturer"];
export interface SelectSelector { model?: DeviceSelector["device"]["model"];
select: { };
options: string[] | SelectOption[];
}; };
} }
export interface IconSelector {
icon: {
placeholder?: string;
fallbackPath?: string;
};
}
export interface ThemeSelector { export interface ThemeSelector {
// eslint-disable-next-line @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/ban-types
theme: {}; theme: {};
} }
export interface TimeSelector {
export interface MediaSelector {
// eslint-disable-next-line @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/ban-types
media: {}; time: {};
}
export interface LocationSelector {
location: { radius?: boolean; icon?: string };
}
export interface LocationSelectorValue {
latitude: number;
longitude: number;
radius?: number;
}
export interface MediaSelectorValue {
entity_id?: string;
media_content_id?: string;
media_content_type?: string;
metadata?: {
title?: string;
thumbnail?: string | null;
media_class?: string;
children_media_class?: string | null;
navigateIds?: { media_content_type: string; media_content_id: string }[];
};
} }