UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

2 lines 2.47 kB
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["17497"],{23006:function(e,t,a){a.r(t),a.d(t,{HuiMarkdownCardEditor:()=>_});var n=a(61701),i=(a(71695),a(19423),a(19134),a(97003),a(47021),a(57243)),s=a(50778),o=a(27486),l=a(62900),c=a(36522),r=(a(29073),a(18200));let d,u=e=>e;const h=(0,l.f0)(r.I,(0,l.Ry)({text_only:(0,l.jt)((0,l.O7)()),title:(0,l.jt)((0,l.Z_)()),content:(0,l.Z_)()}));let _=(0,n.Z)([(0,s.Mo)("hui-markdown-card-editor")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_config",value:void 0},{kind:"method",key:"setConfig",value:function(e){(0,l.hu)(e,h),this._config=e}},{kind:"field",key:"_schema",value(){return(0,o.Z)(((e,t)=>[{name:"style",required:!0,selector:{select:{mode:"box",options:["card","text-only"].map((t=>({label:e(`ui.panel.lovelace.editor.card.markdown.style_options.${t}`),image:{src:`/static/images/form/markdown_${t.replace("-","_")}.svg`,src_dark:`/static/images/form/markdown_${t.replace("-","_")}_dark.svg`,flip_rtl:!0},value:t})))}}},...t?[]:[{name:"title",selector:{text:{}}}],{name:"content",required:!0,selector:{template:{}}}]))}},{kind:"method",key:"render",value:function(){if(!this.hass||!this._config)return i.Ld;const e=Object.assign(Object.assign({},this._config),{},{style:this._config.text_only?"text-only":"card"}),t=this._schema(this.hass.localize,this._config.text_only||!1);return(0,i.dy)(d||(d=u` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" @value-changed="${0}"></ha-form> `),this.hass,e,t,this._computeLabelCallback,this._valueChanged)}},{kind:"method",key:"_valueChanged",value:function(e){const t=Object.assign({},e.detail.value);"text-only"===t.style?t.text_only=!0:delete t.text_only,delete t.style,(0,c.B)(this,"config-changed",{config:t})}},{kind:"field",key:"_computeLabelCallback",value(){return e=>{switch(e.name){case"style":case"content":return this.hass.localize(`ui.panel.lovelace.editor.card.markdown.${e.name}`);default:return this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)}}}}]}}),i.oi)},18200:function(e,t,a){a.d(t,{I:()=>i});var n=a(62900);const i=(0,n.Ry)({type:(0,n.Z_)(),view_layout:(0,n.Yj)(),layout_options:(0,n.Yj)(),grid_options:(0,n.Yj)(),visibility:(0,n.Yj)()})}}]); //# sourceMappingURL=17497.8702004c57c685a5.js.map