@@ -60,7 +60,7 @@ import * as pjson from '../package.json';
60
60
import { deepEqual } from './deep-equal' ;
61
61
62
62
let helpers = ( window as any ) . cardHelpers ;
63
- const helperPromise = new Promise ( async resolve => {
63
+ const helperPromise = new Promise ( async ( resolve ) => {
64
64
if ( helpers ) resolve ( ) ;
65
65
if ( ( window as any ) . loadCardHelpers ) {
66
66
helpers = await ( window as any ) . loadCardHelpers ( ) ;
@@ -104,7 +104,7 @@ class ButtonCard extends LitElement {
104
104
105
105
public set hass ( hass : HomeAssistant ) {
106
106
this . _hass = hass ;
107
- Object . keys ( this . _cards ) . forEach ( element => {
107
+ Object . keys ( this . _cards ) . forEach ( ( element ) => {
108
108
const el = this . _cards [ element ] ;
109
109
el . hass = this . _hass ;
110
110
} ) ;
@@ -174,9 +174,7 @@ class ButtonCard extends LitElement {
174
174
error : e . toString ( ) ,
175
175
origConfig : this . _config ,
176
176
} ) ;
177
- return html `
178
- ${ errorCard }
179
- ` ;
177
+ return html ` ${ errorCard } ` ;
180
178
}
181
179
}
182
180
@@ -244,12 +242,12 @@ class ButtonCard extends LitElement {
244
242
if ( ! this . _config ! . state ) {
245
243
return undefined ;
246
244
}
247
- const hasTemplate = this . _config ! . state . find ( elt => elt . operator === 'template' ) ;
245
+ const hasTemplate = this . _config ! . state . find ( ( elt ) => elt . operator === 'template' ) ;
248
246
if ( ! state && ! hasTemplate ) {
249
247
return undefined ;
250
248
}
251
249
let def : StateConfig | undefined ;
252
- const retval = this . _config ! . state . find ( elt => {
250
+ const retval = this . _config ! . state . find ( ( elt ) => {
253
251
if ( elt . operator ) {
254
252
switch ( elt . operator ) {
255
253
case '==' :
@@ -318,7 +316,7 @@ class ButtonCard extends LitElement {
318
316
if ( [ 'number' , 'boolean' ] . includes ( typeof value ) ) return value ;
319
317
if ( ! value ) return value ;
320
318
if ( [ 'object' ] . includes ( typeof value ) ) {
321
- Object . keys ( value ) . forEach ( key => {
319
+ Object . keys ( value ) . forEach ( ( key ) => {
322
320
value [ key ] = this . _getTemplateOrValue ( state , value [ key ] ) ;
323
321
} ) ;
324
322
return value ;
@@ -448,7 +446,7 @@ class ButtonCard extends LitElement {
448
446
...configStateStyle ,
449
447
} ;
450
448
}
451
- Object . keys ( style ) . forEach ( key => {
449
+ Object . keys ( style ) . forEach ( ( key ) => {
452
450
style [ key ] = this . _getTemplateOrValue ( state , style [ key ] ) ;
453
451
} ) ;
454
452
return style ;
@@ -476,7 +474,7 @@ class ButtonCard extends LitElement {
476
474
...configStateStyle ,
477
475
} ;
478
476
}
479
- Object . keys ( style ) . forEach ( key => {
477
+ Object . keys ( style ) . forEach ( ( key ) => {
480
478
style [ key ] = this . _getTemplateOrValue ( state , style [ key ] ) ;
481
479
} ) ;
482
480
return style ;
@@ -578,7 +576,7 @@ class ButtonCard extends LitElement {
578
576
const fields : any = { } ;
579
577
const cards : any = { } ;
580
578
if ( this . _config ! . custom_fields ) {
581
- Object . keys ( this . _config ! . custom_fields ) . forEach ( key => {
579
+ Object . keys ( this . _config ! . custom_fields ) . forEach ( ( key ) => {
582
580
const value = this . _config ! . custom_fields ! [ key ] ;
583
581
if ( ! ( value as CustomFieldCard ) . card ) {
584
582
fields [ key ] = this . _getTemplateOrValue ( state , value ) ;
@@ -588,7 +586,7 @@ class ButtonCard extends LitElement {
588
586
} ) ;
589
587
}
590
588
if ( configState && configState . custom_fields ) {
591
- Object . keys ( configState . custom_fields ) . forEach ( key => {
589
+ Object . keys ( configState . custom_fields ) . forEach ( ( key ) => {
592
590
const value = configState ! . custom_fields ! [ key ] ;
593
591
if ( ! ( value as CustomFieldCard ) ! . card ) {
594
592
fields [ key ] = this . _getTemplateOrValue ( state , value ) ;
@@ -597,7 +595,7 @@ class ButtonCard extends LitElement {
597
595
}
598
596
} ) ;
599
597
}
600
- Object . keys ( fields ) . forEach ( key => {
598
+ Object . keys ( fields ) . forEach ( ( key ) => {
601
599
if ( fields [ key ] != undefined ) {
602
600
const customStyle : StyleInfo = {
603
601
...this . _buildCustomStyleGeneric ( state , configState , key ) ,
@@ -611,7 +609,7 @@ class ButtonCard extends LitElement {
611
609
` ;
612
610
}
613
611
} ) ;
614
- Object . keys ( cards ) . forEach ( key => {
612
+ Object . keys ( cards ) . forEach ( ( key ) => {
615
613
if ( cards [ key ] != undefined ) {
616
614
const customStyle : StyleInfo = {
617
615
...this . _buildCustomStyleGeneric ( state , configState , key ) ,
@@ -935,7 +933,7 @@ class ButtonCard extends LitElement {
935
933
let result : any = { } ;
936
934
let mergedStateConfig : StateConfig [ ] | undefined ;
937
935
const tpls = tpl && Array . isArray ( tpl ) ? tpl : [ tpl ] ;
938
- tpls ?. forEach ( template => {
936
+ tpls ?. forEach ( ( template ) => {
939
937
if ( ! ( ll . config . button_card_templates && ll . config . button_card_templates [ template ] ) )
940
938
throw new Error ( `Button-card template '${ template } ' is missing!` ) ;
941
939
const res = this . _configFromLLTemplates ( ll , ll . config . button_card_templates [ template ] ) ;
@@ -1014,7 +1012,7 @@ class ButtonCard extends LitElement {
1014
1012
const entitiesRxp = new RegExp ( / s t a t e s \[ \s * ( ' | \\ " ) ( [ a - z A - Z 0 - 9 _ ] + \. [ a - z A - Z 0 - 9 _ ] + ) \1\s * \] / , 'gm' ) ;
1015
1013
const entitiesRxp2 = new RegExp ( / s t a t e s \[ \s * ( ' | \\ " ) ( [ a - z A - Z 0 - 9 _ ] + \. [ a - z A - Z 0 - 9 _ ] + ) \1\s * \] / , 'm' ) ;
1016
1014
const matched = jsonConfig . match ( entitiesRxp ) ;
1017
- matched ?. forEach ( match => {
1015
+ matched ?. forEach ( ( match ) => {
1018
1016
const res = match . match ( entitiesRxp2 ) ;
1019
1017
if ( res && ! this . _entities . includes ( res [ 2 ] ) ) this . _entities . push ( res [ 2 ] ) ;
1020
1018
} ) ;
@@ -1031,7 +1029,7 @@ class ButtonCard extends LitElement {
1031
1029
1032
1030
private _loopGroup ( entityList : string [ ] | undefined ) : void {
1033
1031
if ( entityList ) {
1034
- entityList . forEach ( childEntity => {
1032
+ entityList . forEach ( ( childEntity ) => {
1035
1033
if ( this . _hass ?. states [ childEntity ] ) {
1036
1034
if ( computeDomain ( childEntity ) === 'group' && this . _hass . states [ childEntity ] . attributes ?. entity_id ) {
1037
1035
this . _loopGroup ( this . _hass . states [ childEntity ] . attributes . entity_id ) ;
@@ -1047,7 +1045,7 @@ class ButtonCard extends LitElement {
1047
1045
1048
1046
private _expandTriggerGroups ( ) : void {
1049
1047
if ( this . _hass && this . _config ?. group_expand && this . _entities ) {
1050
- this . _entities . forEach ( entity => {
1048
+ this . _entities . forEach ( ( entity ) => {
1051
1049
if ( computeDomain ( entity ) === 'group' ) {
1052
1050
this . _loopGroup ( this . _hass ?. states [ entity ] . attributes ?. entity_id ) ;
1053
1051
}
@@ -1068,7 +1066,7 @@ class ButtonCard extends LitElement {
1068
1066
if ( ! configEval ) {
1069
1067
return configEval ;
1070
1068
}
1071
- Object . keys ( configEval ) . forEach ( key => {
1069
+ Object . keys ( configEval ) . forEach ( ( key ) => {
1072
1070
if ( typeof configEval [ key ] === 'object' ) {
1073
1071
configEval [ key ] = __evalObject ( configEval [ key ] ) ;
1074
1072
} else {
@@ -1092,19 +1090,19 @@ class ButtonCard extends LitElement {
1092
1090
// backward compatibility
1093
1091
@eventOptions ( { passive : true } )
1094
1092
private handleRippleActivate ( evt ?: Event ) : void {
1095
- this . _ripple . then ( r => r && r . startPress && this . _rippleHandlers . startPress ( evt ) ) ;
1093
+ this . _ripple . then ( ( r ) => r && r . startPress && this . _rippleHandlers . startPress ( evt ) ) ;
1096
1094
}
1097
1095
1098
1096
private handleRippleDeactivate ( ) : void {
1099
- this . _ripple . then ( r => r && r . endPress && this . _rippleHandlers . endPress ( ) ) ;
1097
+ this . _ripple . then ( ( r ) => r && r . endPress && this . _rippleHandlers . endPress ( ) ) ;
1100
1098
}
1101
1099
1102
1100
private handleRippleFocus ( ) : void {
1103
- this . _ripple . then ( r => r && r . startFocus && this . _rippleHandlers . startFocus ( ) ) ;
1101
+ this . _ripple . then ( ( r ) => r && r . startFocus && this . _rippleHandlers . startFocus ( ) ) ;
1104
1102
}
1105
1103
1106
1104
private handleRippleBlur ( ) : void {
1107
- this . _ripple . then ( r => r && r . endFocus && this . _rippleHandlers . endFocus ( ) ) ;
1105
+ this . _ripple . then ( ( r ) => r && r . endFocus && this . _rippleHandlers . endFocus ( ) ) ;
1108
1106
}
1109
1107
1110
1108
private _handleAction ( ev : any ) : void {
@@ -1157,7 +1155,7 @@ class ButtonCard extends LitElement {
1157
1155
if ( this . _config ! . lock ! . exemptions ) {
1158
1156
if ( ! this . _hass ! . user . name || ! this . _hass ! . user . id ) return ;
1159
1157
let matched = false ;
1160
- this . _config ! . lock ! . exemptions . forEach ( e => {
1158
+ this . _config ! . lock ! . exemptions . forEach ( ( e ) => {
1161
1159
if (
1162
1160
( ! matched && ( e as ExemptionUserConfig ) . user === this . _hass ! . user . id ) ||
1163
1161
( e as ExemptionUsernameConfig ) . username === this . _hass ! . user . name
0 commit comments