UNPKG

iobroker.lovelace

Version:

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

2 lines 15.2 kB
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["98815"],{48411:function(e,t,i){i.d(t,{t:()=>n});const n=e=>"latitude"in e.attributes&&"longitude"in e.attributes},83166:function(e,t,i){var n=i(61701),a=i(72621),o=(i(71695),i(47021),i(1105)),d=i(33990),l=i(57243),s=i(50778),r=i(5111);let c,u,h,f,p=e=>e;(0,n.Z)([(0,s.Mo)("ha-textfield")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"invalid",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:"error-message"})],key:"errorMessage",value:void 0},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"icon",value(){return!1}},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"iconTrailing",value(){return!1}},{kind:"field",decorators:[(0,s.Cb)()],key:"autocomplete",value:void 0},{kind:"field",decorators:[(0,s.Cb)()],key:"autocorrect",value:void 0},{kind:"field",decorators:[(0,s.Cb)({attribute:"input-spellcheck"})],key:"inputSpellcheck",value:void 0},{kind:"field",decorators:[(0,s.IO)("input")],key:"formElement",value:void 0},{kind:"method",key:"updated",value:function(e){(0,a.Z)(i,"updated",this,3)([e]),(e.has("invalid")||e.has("errorMessage"))&&(this.setCustomValidity(this.invalid?this.errorMessage||this.validationMessage||"Invalid":""),(this.invalid||this.validateOnInitialRender||e.has("invalid")&&void 0!==e.get("invalid"))&&this.reportValidity()),e.has("autocomplete")&&(this.autocomplete?this.formElement.setAttribute("autocomplete",this.autocomplete):this.formElement.removeAttribute("autocomplete")),e.has("autocorrect")&&(this.autocorrect?this.formElement.setAttribute("autocorrect",this.autocorrect):this.formElement.removeAttribute("autocorrect")),e.has("inputSpellcheck")&&(this.inputSpellcheck?this.formElement.setAttribute("spellcheck",this.inputSpellcheck):this.formElement.removeAttribute("spellcheck"))}},{kind:"method",key:"renderIcon",value:function(e,t=!1){const i=t?"trailing":"leading";return(0,l.dy)(c||(c=p` <span class="mdc-text-field__icon mdc-text-field__icon--${0}" tabindex="${0}"> <slot name="${0}Icon"></slot> </span> `),i,t?1:-1,i)}},{kind:"field",static:!0,key:"styles",value(){return[d.W,(0,l.iv)(u||(u=p`.mdc-text-field__input{width:var(--ha-textfield-input-width,100%)}.mdc-text-field:not(.mdc-text-field--with-leading-icon){padding:var(--text-field-padding,0px 16px)}.mdc-text-field__affix--suffix{padding-left:var(--text-field-suffix-padding-left,12px);padding-right:var(--text-field-suffix-padding-right,0px);padding-inline-start:var(--text-field-suffix-padding-left,12px);padding-inline-end:var(--text-field-suffix-padding-right,0px);direction:ltr}.mdc-text-field--with-leading-icon{padding-inline-start:var(--text-field-suffix-padding-left,0px);padding-inline-end:var(--text-field-suffix-padding-right,16px);direction:var(--direction)}.mdc-text-field--with-leading-icon.mdc-text-field--with-trailing-icon{padding-left:var(--text-field-suffix-padding-left,0px);padding-right:var(--text-field-suffix-padding-right,0px);padding-inline-start:var(--text-field-suffix-padding-left,0px);padding-inline-end:var(--text-field-suffix-padding-right,0px)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__affix--suffix{color:var(--secondary-text-color)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__icon{color:var(--secondary-text-color)}.mdc-text-field__icon--leading{margin-inline-start:16px;margin-inline-end:8px;direction:var(--direction)}.mdc-text-field__icon--trailing{padding:var(--textfield-icon-trailing-padding,12px)}.mdc-floating-label:not(.mdc-floating-label--float-above){text-overflow:ellipsis;width:inherit;padding-right:30px;padding-inline-end:30px;padding-inline-start:initial;box-sizing:border-box;direction:var(--direction)}input{text-align:var(--text-field-text-align,start)}input[type=color]{height:20px}::-ms-reveal{display:none}:host([no-spinner]) input::-webkit-inner-spin-button,:host([no-spinner]) input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=color]::-webkit-color-swatch-wrapper{padding:0}:host([no-spinner]) input[type=number]{-moz-appearance:textfield}.mdc-text-field__ripple{overflow:hidden}.mdc-text-field{overflow:var(--text-field-overflow)}.mdc-floating-label{inset-inline-start:16px!important;inset-inline-end:initial!important;transform-origin:var(--float-start);direction:var(--direction);text-align:var(--float-start)}.mdc-text-field--with-leading-icon.mdc-text-field--filled .mdc-floating-label{max-width:calc(100% - 48px - var(--text-field-suffix-padding-left,0px));inset-inline-start:calc(48px + var(--text-field-suffix-padding-left,0px))!important;inset-inline-end:initial!important;direction:var(--direction)}.mdc-text-field__input[type=number]{direction:var(--direction)}.mdc-text-field__affix--prefix{padding-right:var(--text-field-prefix-padding-right,2px);padding-inline-end:var(--text-field-prefix-padding-right,2px);padding-inline-start:initial}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__affix--prefix{color:var(--mdc-text-field-label-ink-color)}#helper-text ha-markdown{display:inline-block}`)),"rtl"===r.E.document.dir?(0,l.iv)(h||(h=p`.mdc-floating-label,.mdc-text-field--with-leading-icon,.mdc-text-field--with-leading-icon.mdc-text-field--filled .mdc-floating-label,.mdc-text-field__icon--leading,.mdc-text-field__input[type=number]{direction:rtl;--direction:rtl}`)):(0,l.iv)(f||(f=p``))]}}]}}),o.P)},84097:function(e,t,i){i.a(e,(async function(e,t){try{var n=i(61701),a=(i(71695),i(19423),i(40251),i(11740),i(46692),i(47021),i(57243)),o=i(50778),d=i(91583),l=i(36522),s=i(58725),r=(i(23334),i(62801),e([s]));s=(r.then?(await r)():r)[0];let c,u,h,f=e=>e;const p="M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z";(0,n.Z)([(0,o.Mo)("hui-entity-editor")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"entities",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,o.Cb)()],key:"label",value:void 0},{kind:"field",key:"_entityKeys",value(){return new WeakMap}},{kind:"method",key:"_getKey",value:function(e){return this._entityKeys.has(e)||this._entityKeys.set(e,Math.random().toString()),this._entityKeys.get(e)}},{kind:"method",key:"render",value:function(){return this.entities?(0,a.dy)(c||(c=f` <h3> ${0} </h3> <ha-sortable handle-selector=".handle" @item-moved="${0}"> <div class="entities"> ${0} </div> </ha-sortable> <ha-entity-picker class="add-entity" .hass="${0}" .entityFilter="${0}" @value-changed="${0}"></ha-entity-picker> `),this.label||this.hass.localize("ui.panel.lovelace.editor.card.generic.entities")+" ("+this.hass.localize("ui.panel.lovelace.editor.card.config.required")+")",this._entityMoved,(0,d.r)(this.entities,(e=>this._getKey(e)),((e,t)=>(0,a.dy)(u||(u=f` <div class="entity" data-entity-id="${0}"> <div class="handle"> <ha-svg-icon .path="${0}"></ha-svg-icon> </div> <ha-entity-picker .hass="${0}" .value="${0}" .index="${0}" .entityFilter="${0}" @value-changed="${0}" allow-custom-entity></ha-entity-picker> </div> `),e.entity,p,this.hass,e.entity,t,this.entityFilter,this._valueChanged))),this.hass,this.entityFilter,this._addEntity):a.Ld}},{kind:"method",key:"_addEntity",value:async function(e){const t=e.detail.value;if(""===t)return;const i=this.entities.concat({entity:t});e.target.value="",(0,l.B)(this,"entities-changed",{entities:i})}},{kind:"method",key:"_entityMoved",value:function(e){e.stopPropagation();const{oldIndex:t,newIndex:i}=e.detail,n=this.entities.concat();n.splice(i,0,n.splice(t,1)[0]),(0,l.B)(this,"entities-changed",{entities:n})}},{kind:"method",key:"_valueChanged",value:function(e){const t=e.detail.value,i=e.target.index,n=this.entities.concat();""===t||void 0===t?n.splice(i,1):n[i]=Object.assign(Object.assign({},n[i]),{},{entity:t}),(0,l.B)(this,"entities-changed",{entities:n})}},{kind:"field",static:!0,key:"styles",value(){return(0,a.iv)(h||(h=f`ha-entity-picker{margin-top:8px}.add-entity{display:block;margin-left:31px;margin-inline-start:31px;margin-inline-end:initial;direction:var(--direction)}.entity{display:flex;align-items:center}.entity .handle{padding-right:8px;cursor:move;cursor:grab;padding-inline-end:8px;padding-inline-start:initial;direction:var(--direction)}.entity .handle>*{pointer-events:none}.entity ha-entity-picker{flex-grow:1}`))}}]}}),a.oi);t()}catch(c){t(c)}}))},96216:function(e,t,i){i.a(e,(async function(e,n){try{i.r(t),i.d(t,{HuiMapCardEditor:()=>M,mapEntitiesConfigStruct:()=>w});var a=i(61701),o=(i(71695),i(9359),i(1331),i(31526),i(70104),i(19423),i(47021),i(57243)),d=i(50778),l=i(62900),s=i(27486),r=i(36522),c=i(48411),u=i(73850),h=(i(29073),i(55486),i(1888),i(98491)),f=i(11823),p=i(84097),g=i(35826),m=i(18200),v=i(10991),_=e([h,p,f]);[h,p,f]=_.then?(await _)():_;let x,y,k=e=>e;const b="M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z",w=(0,l.G0)([(0,l.Ry)({entity:(0,l.Z_)(),label_mode:(0,l.jt)((0,l.Z_)()),attribute:(0,l.jt)((0,l.Z_)()),focus:(0,l.jt)((0,l.O7)()),name:(0,l.jt)((0,l.Z_)())}),(0,l.Z_)()]),$=(0,l.G0)([(0,l.Ry)({source:(0,l.Z_)(),label_mode:(0,l.jt)((0,l.Z_)()),attribute:(0,l.jt)((0,l.Z_)()),focus:(0,l.jt)((0,l.O7)())}),(0,l.Z_)()]),j=(0,l.f0)(m.I,(0,l.Ry)({title:(0,l.jt)((0,l.Z_)()),aspect_ratio:(0,l.jt)((0,l.Z_)()),default_zoom:(0,l.jt)((0,l.Rx)()),dark_mode:(0,l.jt)((0,l.O7)()),entities:(0,l.jt)((0,l.IX)(w)),hours_to_show:(0,l.jt)((0,l.Rx)()),geo_location_sources:(0,l.jt)((0,l.IX)($)),auto_fit:(0,l.jt)((0,l.O7)()),fit_zones:(0,l.jt)((0,l.O7)()),theme_mode:(0,l.jt)((0,l.Z_)())})),C=["auto","light","dark"];let M=(0,a.Z)([(0,d.Mo)("hui-map-card-editor")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_config",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_configEntities",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_possibleGeoSources",value:void 0},{kind:"field",key:"_schema",value(){return(0,s.Z)((e=>[{name:"title",selector:{text:{}}},{name:"",type:"expandable",iconPath:b,title:e("ui.panel.lovelace.editor.card.map.appearance"),schema:[{name:"",type:"grid",schema:[{name:"aspect_ratio",selector:{text:{}}},{name:"default_zoom",default:f.DEFAULT_ZOOM,selector:{number:{mode:"box",min:0}}},{name:"theme_mode",default:"auto",selector:{select:{mode:"dropdown",options:C.map((t=>({value:t,label:e(`ui.panel.lovelace.editor.card.map.theme_modes.${t}`)})))}}},{name:"hours_to_show",default:f.DEFAULT_HOURS_TO_SHOW,selector:{number:{mode:"box",min:0}}}]}]}]))}},{kind:"method",key:"setConfig",value:function(e){(0,l.hu)(e,j),this._config||"theme_mode"in e||((e=Object.assign({},e)).dark_mode?e.theme_mode="dark":e.theme_mode="auto",delete e.dark_mode,(0,r.B)(this,"config-changed",{config:e})),this._config=e,this._configEntities=e.entities?(0,g.Q)(e.entities):[]}},{kind:"field",key:"_geoSourcesStrings",value(){return(0,s.Z)((e=>null==e?void 0:e.map((e=>"string"==typeof e?e:e.source))))}},{kind:"get",key:"_geo_location_sources",value:function(){return this._geoSourcesStrings(this._config.geo_location_sources)||[]}},{kind:"method",key:"render",value:function(){return this.hass&&this._config?(0,o.dy)(x||(x=k` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" @value-changed="${0}"></ha-form> <hui-entity-editor .hass="${0}" .entities="${0}" .entityFilter="${0}" @entities-changed="${0}"></hui-entity-editor> <h3> ${0} </h3> <ha-selector-select .label="${0}" .required="${0}" .hass="${0}" .value="${0}" @value-changed="${0}" .selector="${0}"></ha-selector-select> `),this.hass,this._config,this._schema(this.hass.localize),this._computeLabelCallback,this._valueChanged,this.hass,this._configEntities,c.t,this._entitiesValueChanged,this.hass.localize("ui.panel.lovelace.editor.card.map.geo_location_sources"),this.hass.localize("ui.panel.lovelace.editor.card.map.source"),!1,this.hass,this._geo_location_sources,this._geoSourcesChanged,this._selectSchema(this._possibleGeoSources,this.hass.localize)):o.Ld}},{kind:"field",key:"_selectSchema",value(){return(0,s.Z)(((e,t)=>({select:{sort:!0,multiple:!0,custom_value:!0,options:e.length?e:[{value:"",label:t("ui.panel.lovelace.editor.card.map.no_geo_location_sources")}]}})))}},{kind:"method",key:"_entitiesValueChanged",value:function(e){e.detail&&e.detail.entities&&(this._config=Object.assign(Object.assign({},this._config),{},{entities:e.detail.entities}),this._configEntities=(0,g.Q)(this._config.entities||[]),(0,r.B)(this,"config-changed",{config:this._config}))}},{kind:"method",key:"_geoSourcesChanged",value:function(e){if(!this._config||!this.hass)return;const t=e.detail.value;if(this._geo_location_sources!==t){if(""===t)this._config=Object.assign({},this._config),delete this._config.geo_location_sources;else{const e=t.map((e=>{var t;return(null===(t=this._config.geo_location_sources)||void 0===t?void 0:t.find((t=>"object"==typeof t&&t.source===e)))||e}));this._config=Object.assign(Object.assign({},this._config),{},{geo_location_sources:e})}(0,r.B)(this,"config-changed",{config:this._config})}}},{kind:"method",key:"_valueChanged",value:function(e){(0,r.B)(this,"config-changed",{config:e.detail.value})}},{kind:"method",key:"willUpdate",value:function(){if(this.hass&&!this._possibleGeoSources){const e={};Object.entries(this.hass.states).forEach((([t,i])=>{"geo_location"===(0,u.M)(t)&&i.attributes.source&&(e[i.attributes.source]=i.attributes.attribution)})),this._possibleGeoSources=Object.entries(e).map((([e,t])=>({value:e,label:t||e})))}}},{kind:"field",key:"_computeLabelCallback",value(){return e=>{switch(e.name){case"theme_mode":case"default_zoom":return this.hass.localize(`ui.panel.lovelace.editor.card.map.${e.name}`);default:return this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)}}}},{kind:"get",static:!0,key:"styles",value:function(){return[v.A,(0,o.iv)(y||(y=k``))]}}]}}),o.oi);n()}catch(x){n(x)}}))},35826:function(e,t,i){i.d(t,{Q:()=>n});i(9359),i(70104);function n(e){return e.map((e=>"string"==typeof e?{entity:e}:e))}},18200:function(e,t,i){i.d(t,{I:()=>a});var n=i(62900);const a=(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=98815.97241ebd79262b7f.js.map