20240410-21:12
This commit is contained in:
@@ -3333,6 +3333,7 @@ const Ts={},Os=He(class extends Ye{constructor(t){if(super(t),t.type!==Be&&t.typ
|
||||
@closed=${t=>t.stopPropagation()}
|
||||
.value=${null!=t?t:""}
|
||||
naturalMenuWidth
|
||||
fixedMenuPosition
|
||||
>
|
||||
${e.map((t=>Y`
|
||||
<mwc-list-item .value=${t}>
|
||||
@@ -3392,7 +3393,7 @@ const Ts={},Os=He(class extends Ye{constructor(t){if(super(t),t.type!==Be&&t.typ
|
||||
flex: 1;
|
||||
--mdc-theme-primary: rgb(var(--rgb-state-entity));
|
||||
}
|
||||
`]}};bm=n([pt(pm)],bm);const ym=`${Nl}-template-card`,xm=`${ym}-editor`;Pl({type:ym,name:"Mushroom Template Card",description:"Card for custom rendering with templates"});const wm=["icon","icon_color","badge_color","badge_icon","primary","secondary","picture"];let km=class extends jl{constructor(){super(...arguments),this._templateResults={},this._unsubRenderTemplates=new Map,this._inGrid=!1}static async getConfigElement(){return await Promise.resolve().then((function(){return Cp})),document.createElement(xm)}static async getStubConfig(t){return{type:`custom:${ym}`,primary:"Hello, {{user}}",secondary:"How are you?",icon:"mdi:home"}}getCardSize(){let t=1;if(!this._config)return t;return"vertical"===$l(this._config).layout&&(t+=1),t}getGridSize(){const{grid_columns:t,grid_rows:e}=this.getLayoutOptions();return[t,e]}getLayoutOptions(){this._inGrid=!0;const t={grid_columns:2,grid_rows:1};if(!this._config)return t;const e=$l(this._config);return"vertical"===e.layout&&(t.grid_rows+=1),"horizontal"===e.layout&&(t.grid_columns=4),t}setConfig(t){wm.forEach((e=>{var i,o;(null===(i=this._config)||void 0===i?void 0:i[e])===t[e]&&(null===(o=this._config)||void 0===o?void 0:o.entity)==t.entity||this._tryDisconnectKey(e)})),this._config=Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)}connectedCallback(){super.connectedCallback(),this._tryConnect()}disconnectedCallback(){this._tryDisconnect()}_handleAction(t){Ge(this,this.hass,this._config,t.detail.action)}isTemplate(t){var e;const i=null===(e=this._config)||void 0===e?void 0:e[t];return null==i?void 0:i.includes("{")}getValue(t){var e,i,o;return this.isTemplate(t)?null===(i=null===(e=this._templateResults[t])||void 0===e?void 0:e.result)||void 0===i?void 0:i.toString():null===(o=this._config)||void 0===o?void 0:o[t]}render(){if(!this._config||!this.hass)return G;const t=this.getValue("icon"),e=this.getValue("icon_color"),i=this.getValue("badge_icon"),o=this.getValue("badge_color"),n=this.getValue("primary"),r=this.getValue("secondary"),a=this.getValue("picture"),l=this._config.multiline_secondary,s=Ie(this.hass),c=$l({fill_container:this._config.fill_container,layout:this._config.layout,icon_type:Boolean(a)?"entity-picture":Boolean(t)?"icon":"none",primary_info:Boolean(n)?"name":"none",secondary_info:Boolean(r)?"state":"none"}),d=fs(t);return Y`
|
||||
`]}};bm=n([pt(pm)],bm);const ym=`${Nl}-template-card`,xm=`${ym}-editor`;Pl({type:ym,name:"Mushroom Template Card",description:"Card for custom rendering with templates"});const wm=["icon","icon_color","badge_color","badge_icon","primary","secondary","picture"];let km=class extends jl{constructor(){super(...arguments),this._templateResults={},this._unsubRenderTemplates=new Map,this._inGrid=!1}static async getConfigElement(){return await Promise.resolve().then((function(){return Cp})),document.createElement(xm)}static async getStubConfig(t){return{type:`custom:${ym}`,primary:"Hello, {{user}}",secondary:"How are you?",icon:"mdi:home"}}getCardSize(){let t=1;if(!this._config)return t;return"vertical"===$l(this._config).layout&&(t+=1),t}getGridSize(){const{grid_columns:t,grid_rows:e}=this.getLayoutOptions();return[t,e]}getLayoutOptions(){var t;this._inGrid=!0;const e={grid_columns:2,grid_rows:1};if(!this._config)return e;const i=$l(this._config);return"vertical"===i.layout&&(e.grid_rows+=1),"horizontal"===i.layout&&(e.grid_columns=4),(null===(t=this._config)||void 0===t?void 0:t.multiline_secondary)&&(e.grid_rows=void 0),e}setConfig(t){wm.forEach((e=>{var i,o;(null===(i=this._config)||void 0===i?void 0:i[e])===t[e]&&(null===(o=this._config)||void 0===o?void 0:o.entity)==t.entity||this._tryDisconnectKey(e)})),this._config=Object.assign({tap_action:{action:"toggle"},hold_action:{action:"more-info"}},t)}connectedCallback(){super.connectedCallback(),this._tryConnect()}disconnectedCallback(){this._tryDisconnect()}_handleAction(t){Ge(this,this.hass,this._config,t.detail.action)}isTemplate(t){var e;const i=null===(e=this._config)||void 0===e?void 0:e[t];return null==i?void 0:i.includes("{")}getValue(t){var e,i,o;return this.isTemplate(t)?null===(i=null===(e=this._templateResults[t])||void 0===e?void 0:e.result)||void 0===i?void 0:i.toString():null===(o=this._config)||void 0===o?void 0:o[t]}render(){if(!this._config||!this.hass)return G;const t=this.getValue("icon"),e=this.getValue("icon_color"),i=this.getValue("badge_icon"),o=this.getValue("badge_color"),n=this.getValue("primary"),r=this.getValue("secondary"),a=this.getValue("picture"),l=this._config.multiline_secondary,s=Ie(this.hass),c=$l({fill_container:this._config.fill_container,layout:this._config.layout,icon_type:Boolean(a)?"entity-picture":Boolean(t)?"icon":"none",primary_info:Boolean(n)?"name":"none",secondary_info:Boolean(r)?"state":"none"}),d=fs(t);return Y`
|
||||
<ha-card class=${Zr({"fill-container":c.fill_container})}>
|
||||
<mushroom-card .appearance=${c} ?rtl=${s}>
|
||||
<mushroom-state-item
|
||||
@@ -3660,7 +3661,7 @@ const Ts={},Os=He(class extends Ye{constructor(t){if(super(t),t.type!==Be&&t.typ
|
||||
mushroom-vacuum-commands-control {
|
||||
flex: 1;
|
||||
}
|
||||
`]}};Um=n([pt(jm)],Um),console.info("%c🍄 Mushroom 🍄 - 3.5.2","color: #ef5350; font-weight: 700;");const Hm=Ce({tap_action:$e(ni),hold_action:$e(ni),double_tap_action:$e(ni)}),Ym=t=>[{name:"tap_action",selector:{"ui-action":{actions:t}}},{name:"hold_action",selector:{"ui-action":{actions:t}}},{name:"double_tap_action",selector:{"ui-action":{actions:t}}}],Wm=Ce({layout:$e(Se([we("horizontal"),we("vertical"),we("default")])),fill_container:$e(ye()),primary_info:$e(xe(ol)),secondary_info:$e(xe(ol)),icon_type:$e(xe(nl))}),Xm=[{type:"grid",name:"",schema:[{name:"layout",selector:{mush_layout:{}}},{name:"fill_container",selector:{boolean:{}}}]},{type:"grid",name:"",schema:[{name:"primary_info",selector:{mush_info:{}}},{name:"secondary_info",selector:{mush_info:{}}},{name:"icon_type",selector:{mush_icon_type:{}}}]}],Gm=["icon_color","layout","fill_container","primary_info","secondary_info","icon_type","content_info","use_entity_picture","collapsible_controls","icon_animation"],Km=Ce({entity:$e(Ee()),name:$e(Ee()),icon:$e(Ee())}),qm=Ce({index:$e(ke()),view_index:$e(ke()),view_layout:ve(),type:Ee()}),Zm=fe(qm,fe(Km,Wm,Hm),Ce({states:$e(be()),show_keypad:$e(ye())})),Jm=["more-info","navigate","url","call-service","assist","none"],Qm=["armed_home","armed_away","armed_night","armed_vacation","armed_custom_bypass"],tp=["show_keypad"],ep=Tt((t=>[{name:"entity",selector:{entity:{domain:Vl}}},{name:"name",selector:{text:{}}},{name:"icon",selector:{icon:{}},context:{icon_entity:"entity"}},...Xm,{type:"multi_select",name:"states",options:Qm.map((e=>[e,t(`ui.card.alarm_control_panel.${e.replace("armed","arm")}`)]))},{name:"show_keypad",selector:{boolean:{}}},...Ym(Jm)]));let ip=class extends jl{constructor(){super(...arguments),this._computeLabel=t=>{const e=Oo(this.hass);return Gm.includes(t.name)?e(`editor.card.generic.${t.name}`):tp.includes(t.name)?e(`editor.card.alarm_control_panel.${t.name}`):"states"===t.name?this.hass.localize("ui.panel.lovelace.editor.card.alarm-panel.available_states"):this.hass.localize(`ui.panel.lovelace.editor.card.generic.${t.name}`)}}connectedCallback(){super.connectedCallback(),vs()}setConfig(t){me(t,Zm),this._config=t}render(){if(!this.hass||!this._config)return G;const t=ep(this.hass.localize);return Y`
|
||||
`]}};Um=n([pt(jm)],Um),console.info("%c🍄 Mushroom 🍄 - 3.5.4","color: #ef5350; font-weight: 700;");const Hm=Ce({tap_action:$e(ni),hold_action:$e(ni),double_tap_action:$e(ni)}),Ym=t=>[{name:"tap_action",selector:{"ui-action":{actions:t}}},{name:"hold_action",selector:{"ui-action":{actions:t}}},{name:"double_tap_action",selector:{"ui-action":{actions:t}}}],Wm=Ce({layout:$e(Se([we("horizontal"),we("vertical"),we("default")])),fill_container:$e(ye()),primary_info:$e(xe(ol)),secondary_info:$e(xe(ol)),icon_type:$e(xe(nl))}),Xm=[{type:"grid",name:"",schema:[{name:"layout",selector:{mush_layout:{}}},{name:"fill_container",selector:{boolean:{}}}]},{type:"grid",name:"",schema:[{name:"primary_info",selector:{mush_info:{}}},{name:"secondary_info",selector:{mush_info:{}}},{name:"icon_type",selector:{mush_icon_type:{}}}]}],Gm=["icon_color","layout","fill_container","primary_info","secondary_info","icon_type","content_info","use_entity_picture","collapsible_controls","icon_animation"],Km=Ce({entity:$e(Ee()),name:$e(Ee()),icon:$e(Ee())}),qm=Ce({index:$e(ke()),view_index:$e(ke()),view_layout:ve(),type:Ee(),layout_options:ve()}),Zm=fe(qm,fe(Km,Wm,Hm),Ce({states:$e(be()),show_keypad:$e(ye())})),Jm=["more-info","navigate","url","call-service","assist","none"],Qm=["armed_home","armed_away","armed_night","armed_vacation","armed_custom_bypass"],tp=["show_keypad"],ep=Tt((t=>[{name:"entity",selector:{entity:{domain:Vl}}},{name:"name",selector:{text:{}}},{name:"icon",selector:{icon:{}},context:{icon_entity:"entity"}},...Xm,{type:"multi_select",name:"states",options:Qm.map((e=>[e,t(`ui.card.alarm_control_panel.${e.replace("armed","arm")}`)]))},{name:"show_keypad",selector:{boolean:{}}},...Ym(Jm)]));let ip=class extends jl{constructor(){super(...arguments),this._computeLabel=t=>{const e=Oo(this.hass);return Gm.includes(t.name)?e(`editor.card.generic.${t.name}`):tp.includes(t.name)?e(`editor.card.alarm_control_panel.${t.name}`):"states"===t.name?this.hass.localize("ui.panel.lovelace.editor.card.alarm-panel.available_states"):this.hass.localize(`ui.panel.lovelace.editor.card.generic.${t.name}`)}}connectedCallback(){super.connectedCallback(),vs()}setConfig(t){me(t,Zm),this._config=t}render(){if(!this.hass||!this._config)return G;const t=ep(this.hass.localize);return Y`
|
||||
<ha-form
|
||||
.hass=${this.hass}
|
||||
.data=${this._config}
|
||||
|
||||
Reference in New Issue
Block a user