iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
5 lines • 6.09 kB
JavaScript
/*! For license information please see 85351.da86940277277a4d.js.LICENSE.txt */
export const __rspack_esm_id=85351;export const __rspack_esm_ids=[85351];export const __webpack_modules__={57237(t,e,o){o.d(e,{d:()=>a});const a=t=>t.stopPropagation()},70947(t,e,o){var a=o(62826),i=o(50759),r=(o(38625),o(5124)),s=o(22441);o(67094);class n extends i.A{renderCheckboxIcon(){return r.qy` <ha-svg-icon id="check" part="checkmark" .path="${this.checked?"M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z":"M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z"}"></ha-svg-icon> `}static get styles(){return[i.A.styles,r.AH`:host{min-height:var(--ha-space-10)}#check{visibility:visible;flex-shrink:0}#icon ::slotted(*){color:var(--ha-color-on-neutral-normal)}:host([variant=danger]) #icon ::slotted(*){color:var(--ha-color-on-danger-quiet)}:host([selected]){font-weight:var(--ha-font-weight-medium);color:var(--primary-color);background-color:var(--ha-color-fill-primary-quiet-resting);--icon-primary-color:var(--primary-color)}:host([selected]:hover){background-color:var(--ha-color-fill-primary-quiet-hover)}`]}constructor(...t){super(...t),this.selected=!1}}(0,a.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],n.prototype,"selected",void 0),n=(0,a.Cg)([(0,s.EM)("ha-dropdown-item")],n)},29823(t,e,o){o.a(t,async function(t,e){try{var a=o(62826),i=o(52254),r=o(5124),s=o(22441),n=t([i]);i=(n.then?(await n)():n)[0];class c extends i.A{get anchorElement(){return this.popup?.anchor}set anchorElement(t){this.popup&&(this.popup.anchor&&"ha-icon-button"===this.popup.anchor.localName&&(this.popup.anchor.selected=!1),this.popup.anchor=t)}getTrigger(){return this.anchorElement?this.anchorElement:super.getTrigger()}async showMenu(){await super.showMenu();const t=this.getTrigger();t&&"ha-icon-button"===t.localName&&(t.selected=!0)}async hideMenu(){const t=this.getTrigger();t&&"ha-icon-button"===t.localName&&(t.selected=!1),await super.hideMenu()}static get styles(){return[i.A.styles,r.AH`:host{font-size:var(--ha-dropdown-font-size, var(--ha-font-size-m));--wa-color-surface-raised:var(
--card-background-color,
var(--ha-dialog-surface-background, var(--mdc-theme-surface, #fff)),
)}#menu{padding:var(--ha-space-1)}wa-popup::part(popup){z-index:200}`]}constructor(...t){super(...t),this.dropdownTag="ha-dropdown",this.dropdownItemTag="ha-dropdown-item"}}(0,a.Cg)([(0,s.MZ)({attribute:!1})],c.prototype,"dropdownTag",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],c.prototype,"dropdownItemTag",void 0),c=(0,a.Cg)([(0,s.EM)("ha-dropdown")],c),e()}catch(t){e(t)}})},8456(t,e,o){o.a(t,async function(t,a){try{o.r(e),o.d(e,{HaFormOptionalActions:()=>g});o(74423),o(18111),o(22489),o(61701),o(45367),o(92731);var i=o(62826),r=o(5124),s=o(22441),n=o(22786),c=o(57237),h=o(18350),p=o(29823),d=(o(70947),o(67094),o(52763)),l=t([h,p,d]);[h,p,d]=l.then?(await l)():l;const u="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",m=[];class g extends r.WF{async focus(){await this.updateComplete,this._form?.focus()}reportValidity(){return!this._form||this._form.reportValidity()}updated(t){if(super.updated(t),t.has("data")){const t=this._displayActions??m,e=this._hiddenActions(this.schema.schema,t);this._displayActions=[...t,...e.filter(t=>t in this.data)]}}render(){const t=this._displayActions??m,e=this._displaySchema(this.schema.schema,this._displayActions??[]),o=this._hiddenActions(this.schema.schema,t),a=new Map(this.computeLabel?this.schema.schema.map(t=>[t.name,t]):[]);return r.qy` ${e.length>0?r.qy` <ha-form .hass="${this.hass}" .data="${this.data}" .schema="${e}" .disabled="${this.disabled}" .computeLabel="${this.computeLabel}" .computeHelper="${this.computeHelper}" .localizeValue="${this.localizeValue}"></ha-form> `:r.s6} ${o.length>0?r.qy` <ha-dropdown -select="${this._handleAddAction}" ="${c.d}"> <ha-button slot="trigger" appearance="filled" size="small"> <ha-svg-icon .path="${u}" slot="start"></ha-svg-icon> ${this.localize?.("ui.components.form-optional-actions.add")||"Add interaction"} </ha-button> ${o.map(t=>{const e=a.get(t);return r.qy` <ha-dropdown-item .value="${t}"> ${this.computeLabel&&e?this.computeLabel(e):t} </ha-dropdown-item> `})} </ha-dropdown> `:r.s6} `}_handleAddAction(t){const e=t.detail.item.value;this._displayActions=[...this._displayActions??[],e]}constructor(...t){super(...t),this.disabled=!1,this._hiddenActions=(0,n.A)((t,e)=>t.map(t=>t.name).filter(t=>!e.includes(t))),this._displaySchema=(0,n.A)((t,e)=>t.filter(t=>e.includes(t.name)))}}g.styles=r.AH`:host{display:flex!important;flex-direction:column;gap:var(--ha-space-6)}:host ha-form{display:block}ha-dropdown{display:inline-block}`,(0,i.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"localize",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"data",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"schema",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],g.prototype,"disabled",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"computeLabel",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"computeHelper",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],g.prototype,"localizeValue",void 0),(0,i.Cg)([(0,s.wk)()],g.prototype,"_displayActions",void 0),(0,i.Cg)([(0,s.P)("ha-form")],g.prototype,"_form",void 0),g=(0,i.Cg)([(0,s.EM)("ha-form-optional_actions")],g),a()}catch(t){a(t)}})},35370(t,e,o){var a=o(26198);t.exports=function(t,e,o){for(var i=0,r=arguments.length>2?o:a(e),s=new t(r);r>i;)s[i]=e[i++];return s}},89429(t){t.exports=function(){}},95010(t,e,o){o.d(e,{q:()=>a,N:()=>i});o(16573),o(78100),o(77936),o(37467),o(44732),o(79577),o(16632),o(34226),o(9486),o(20456);function a(t,e,o){const a=t=>Object.is(t,-0)?0:t;return a(t<e?e:t>o?o:t)}function i(t=""){return`${t}${((t=21)=>{let e="",o=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&o[t]];return e})()}`}}};