| 47 | |
| 48 | @customElement("ha-area-controls-picker") |
| 49 | export class HaAreaControlsPicker extends LitElement { |
| 50 | @property({ attribute: false }) public hass!: HomeAssistant; |
| 51 | |
| 52 | @property({ attribute: "area-id" }) public areaId!: string; |
| 53 | |
| 54 | @property({ type: Array, attribute: "exclude-entities" }) |
| 55 | public excludeEntities?: string[]; |
| 56 | |
| 57 | @property() public value?: string; |
| 58 | |
| 59 | @property({ type: Array, attribute: "exclude-values" }) |
| 60 | public excludeValues?: string[]; |
| 61 | |
| 62 | @property() public label?: string; |
| 63 | |
| 64 | @property() public placeholder?: string; |
| 65 | |
| 66 | @property() public helper?: string; |
| 67 | |
| 68 | @property({ type: Boolean }) public disabled = false; |
| 69 | |
| 70 | @property({ type: Boolean }) public required = false; |
| 71 | |
| 72 | @property({ attribute: "add-button-label" }) public addButtonLabel?: string; |
| 73 | |
| 74 | private _domainSearchKeys: FuseWeightedKey[] = [ |
| 75 | { |
| 76 | name: "primary", |
| 77 | weight: 10, |
| 78 | }, |
| 79 | ]; |
| 80 | |
| 81 | private _entitySearchKeys: FuseWeightedKey[] = [ |
| 82 | { |
| 83 | name: "primary", |
| 84 | weight: 10, |
| 85 | }, |
| 86 | { |
| 87 | name: "secondary", |
| 88 | weight: 5, |
| 89 | }, |
| 90 | { |
| 91 | name: "id", |
| 92 | weight: 3, |
| 93 | }, |
| 94 | ]; |
| 95 | |
| 96 | private _createFuseIndex = ( |
| 97 | items: AreaControlPickerItem[], |
| 98 | keys: FuseWeightedKey[] |
| 99 | ) => Fuse.createIndex(keys, items); |
| 100 | |
| 101 | private _domainFuseIndex = memoizeOne((items: AreaControlPickerItem[]) => |
| 102 | this._createFuseIndex(items, this._domainSearchKeys) |
| 103 | ); |
| 104 | |
| 105 | private _entityFuseIndex = memoizeOne((items: AreaControlPickerItem[]) => |
| 106 | this._createFuseIndex(items, this._entitySearchKeys) |
nothing calls this directly
no test coverage detected
searching dependent graphs…