iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 14.6 kB
JavaScript
export const __webpack_ids__=["98815"];export const __webpack_modules__={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(44249),a=i(72621),o=i(1105),d=i(33990),l=i(57243),s=i(15093),r=i(5111);(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:()=>!1},{kind:"field",decorators:[(0,s.Cb)({type:Boolean})],key:"iconTrailing",value:()=>!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 l.dy` <span class="mdc-text-field__icon mdc-text-field__icon--${i}" tabindex="${t?1:-1}"> <slot name="${i}Icon"></slot> </span> `}},{kind:"field",static:!0,key:"styles",value:()=>[d.W,l.iv`.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?l.iv`.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}`:l.iv``]}]}}),o.P)},84097:function(e,t,i){i.a(e,(async function(e,t){try{var n=i(44249),a=i(57243),o=i(15093),d=i(91583),l=i(36522),s=i(58725),r=(i(23334),i(62801),e([s]));s=(r.then?(await r)():r)[0];const c="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:()=>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?a.dy` <h3> ${this.label||this.hass.localize("ui.panel.lovelace.editor.card.generic.entities")+" ("+this.hass.localize("ui.panel.lovelace.editor.card.config.required")+")"} </h3> <ha-sortable handle-selector=".handle" -moved="${this._entityMoved}"> <div class="entities"> ${(0,d.r)(this.entities,(e=>this._getKey(e)),((e,t)=>a.dy` <div class="entity" data-entity-id="${e.entity}"> <div class="handle"> <ha-svg-icon .path="${c}"></ha-svg-icon> </div> <ha-entity-picker .hass="${this.hass}" .value="${e.entity}" .index="${t}" .entityFilter="${this.entityFilter}" -changed="${this._valueChanged}" allow-custom-entity></ha-entity-picker> </div> `))} </div> </ha-sortable> <ha-entity-picker class="add-entity" .hass="${this.hass}" .entityFilter="${this.entityFilter}" -changed="${this._addEntity}"></ha-entity-picker> `: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]={...n[i],entity:t},(0,l.B)(this,"entities-changed",{entities:n})}},{kind:"field",static:!0,key:"styles",value:()=>a.iv`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(e){t(e)}}))},96216:function(e,t,i){i.a(e,(async function(e,n){try{i.r(t),i.d(t,{HuiMapCardEditor:()=>w,mapEntitiesConfigStruct:()=>x});var a=i(44249),o=(i(9359),i(1331),i(31526),i(70104),i(57243)),d=i(15093),l=i(62900),s=i(27486),r=i(36522),c=i(48411),h=i(73850),u=(i(29073),i(55486),i(1888),i(98491),i(11823)),f=i(84097),p=i(35826),g=i(18200),m=i(10991),_=e([f,u]);[f,u]=_.then?(await _)():_;const v="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",x=(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_)()]),y=(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_)()]),k=(0,l.f0)(g.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)(x)),hours_to_show:(0,l.jt)((0,l.Rx)()),geo_location_sources:(0,l.jt)((0,l.IX)(y)),auto_fit:(0,l.jt)((0,l.O7)()),fit_zones:(0,l.jt)((0,l.O7)()),theme_mode:(0,l.jt)((0,l.Z_)())})),b=["auto","light","dark"];let w=(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:()=>(0,s.Z)((e=>[{name:"title",selector:{text:{}}},{name:"",type:"expandable",iconPath:v,title:e("ui.panel.lovelace.editor.card.map.appearance"),schema:[{name:"",type:"grid",schema:[{name:"aspect_ratio",selector:{text:{}}},{name:"default_zoom",default:u.DEFAULT_ZOOM,selector:{number:{mode:"box",min:0}}},{name:"theme_mode",default:"auto",selector:{select:{mode:"dropdown",options:b.map((t=>({value:t,label:e(`ui.panel.lovelace.editor.card.map.theme_modes.${t}`)})))}}},{name:"hours_to_show",default:u.DEFAULT_HOURS_TO_SHOW,selector:{number:{mode:"box",min:0}}}]}]}]))},{kind:"method",key:"setConfig",value:function(e){(0,l.hu)(e,k),this._config||"theme_mode"in e||((e={...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,p.Q)(e.entities):[]}},{kind:"field",key:"_geoSourcesStrings",value:()=>(0,s.Z)((e=>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?o.dy` <ha-form .hass="${this.hass}" .data="${this._config}" .schema="${this._schema(this.hass.localize)}" .computeLabel="${this._computeLabelCallback}" -changed="${this._valueChanged}"></ha-form> <hui-entity-editor .hass="${this.hass}" .entities="${this._configEntities}" .entityFilter="${c.t}" -changed="${this._entitiesValueChanged}"></hui-entity-editor> <h3> ${this.hass.localize("ui.panel.lovelace.editor.card.map.geo_location_sources")} </h3> <ha-selector-select .label="${this.hass.localize("ui.panel.lovelace.editor.card.map.source")}" .required="${!1}" .hass="${this.hass}" .value="${this._geo_location_sources}" -changed="${this._geoSourcesChanged}" .selector="${this._selectSchema(this._possibleGeoSources,this.hass.localize)}"></ha-selector-select> `:o.Ld}},{kind:"field",key:"_selectSchema",value:()=>(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={...this._config,entities:e.detail.entities},this._configEntities=(0,p.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={...this._config},delete this._config.geo_location_sources;else{const e=t.map((e=>this._config.geo_location_sources?.find((t=>"object"==typeof t&&t.source===e))||e));this._config={...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,h.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[m.A,o.iv``]}}]}}),o.oi);n()}catch(e){n(e)}}))},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.8803496d26fcc8f9.js.map