UNPKG

iobroker.lovelace

Version:

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

1 lines 2.55 kB
export const __rspack_esm_id=57218;export const __rspack_esm_ids=[57218];export const __webpack_modules__={72281(t,e,a){a.a(t,async function(t,i){try{a.r(e),a.d(e,{HuiButtonCardFeatureEditor:()=>g});var s=a(62826),o=a(5124),n=a(22441),c=a(22786),h=a(1087),r=a(71727),l=(a(11382),a(52763)),d=a(67431),p=(a(67094),a(84025)),_=t([l,d]);[l,d]=_.then?(await _)():_;const u="M21 2H3C1.9 2 1 2.9 1 4V20C1 21.1 1.9 22 3 22H21C22.1 22 23 21.1 23 20V4C23 2.9 22.1 2 21 2M21 20H3V6H21V20M16.6 8C18.1 9.3 19 11.1 19 13C19 14.9 18.1 16.7 16.6 18L15 17.4C16.3 16.4 17 14.7 17 13S16.3 9.6 15 8.6L16.6 8M7.4 8L9 8.6C7.7 9.6 7 11.3 7 13S7.7 16.4 9 17.4L7.4 18C5.9 16.7 5 14.9 5 13S5.9 9.3 7.4 8M12.1 12L13.5 10H15L12.8 13L14.1 16H12.8L12 14L10.6 16H9L11.3 12.9L10 10H11.3L12.1 12Z";class g extends o.WF{setConfig(t){this._config=t}render(){if(!this.hass||!this._config)return o.s6;let t;if(this.context?.entity_id){"script"===(0,r.m)(this.context.entity_id)&&(0,p.TP)(this.hass,this.context.entity_id)&&(t={action:this.context.entity_id,data:this._config.data})}return o.qy` <ha-form .hass="${this.hass}" .data="${this._config}" .schema="${this._schema(this.hass.localize)}" .computeLabel="${this._computeLabel}" @value-changed="${this._valueChanged}"></ha-form> ${t?o.qy`<ha-expansion-panel outlined expanded .header="${this.hass.localize("ui.components.service-control.script_variables")}" .secondary="${this.hass.localize("ui.common.optional")}" no-collapse> <ha-svg-icon slot="leading-icon" .path="${u}"></ha-svg-icon> <ha-service-control hide-picker hide-description .hass="${this.hass}" .value="${t}" .narrow="${!1}" @value-changed="${this._scriptFieldVariablesChanged}"></ha-service-control></ha-expansion-panel>`:o.s6} `}_scriptFieldVariablesChanged(t){(0,h.r)(this,"config-changed",{config:{...this._config||{},data:t.detail.value.data}})}_valueChanged(t){t.stopPropagation(),(0,h.r)(this,"config-changed",{config:{...this._config||{},...t.detail.value}})}constructor(...t){super(...t),this._schema=(0,c.A)(t=>[{name:"action_name",default:t("ui.card.button.press"),selector:{text:{}}}]),this._computeLabel=t=>"action_name"===t.name?this.hass.localize("ui.common.name"):this.hass.localize(`ui.panel.lovelace.editor.card.generic.${t.name}`)}}g.styles=o.AH`ha-expansion-panel{margin-top:16px}`,(0,s.Cg)([(0,n.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],g.prototype,"context",void 0),(0,s.Cg)([(0,n.wk)()],g.prototype,"_config",void 0),g=(0,s.Cg)([(0,n.EM)("hui-button-card-feature-editor")],g),i()}catch(t){i(t)}})}};