iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
15 lines • 16.7 kB
JavaScript
export const __rspack_esm_id=58938;export const __rspack_esm_ids=[58938];export const __webpack_modules__={77090(t,e,i){i.d(e,{s:()=>a});const a=t=>!(!t.detail.selected||"property"!==t.detail.source)&&(t.currentTarget.selected=!1,!0)},14693(t,e,i){i.a(t,async function(t,a){try{i.d(e,{r:()=>v});var o=i(62826),s=i(35211),n=i(5124),r=i(22441),l=i(71769),d=i(22792),h=i(99611),p=(i(76538),i(26300)),c=i(72554),m=t([h,p,c]);[h,p,c]=m.then?(await m)():m;const u="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",g="(max-width: 870px), (max-height: 500px)";class v extends n.WF{connectedCallback(){super.connectedCallback(),this._unsubMediaQuery=(0,l.m)(g,t=>{this._modeSet&&!this.allowModeChange||(this.mode=t?"bottom-sheet":"dialog",this._modeSet=!0)})}get _defaultAriaLabelledBy(){return this.ariaLabelledBy||(void 0!==this.headerTitle?"ha-dialog-title":void 0)}_renderCloseButton(t){return this.hideCloseButton?n.qy`<span slot="${t}"></span>`:n.qy` <slot name="headerNavigationIcon" slot="${t}"> <ha-icon-button data-dialog="close" .label="${this._i18n?.localize?.("ui.common.close")??"Close"}" .path="${u}"></ha-icon-button> </slot> `}_renderHeaderContent(){return n.qy` <ha-dialog-header .subtitlePosition="${this.headerSubtitlePosition}"> ${this._renderCloseButton("navigationIcon")} ${void 0!==this.headerTitle?n.qy`<span slot="title" class="title" id="ha-dialog-title"> ${this.headerTitle} </span>`:n.qy`<slot name="headerTitle" slot="title"></slot>`} ${void 0!==this.headerSubtitle?n.qy`<span slot="subtitle">${this.headerSubtitle}</span>`:n.qy`<slot name="headerSubtitle" slot="subtitle"></slot>`} <slot name="headerActionItems" slot="actionItems"></slot> </ha-dialog-header> `}disconnectedCallback(){super.disconnectedCallback(),this._unsubMediaQuery?.(),this._unsubMediaQuery=void 0,this._modeSet=!1}render(){return"bottom-sheet"===this.mode?n.qy` <ha-bottom-sheet .ariaLabelledBy="${this._defaultAriaLabelledBy}" .ariaDescribedBy="${this.ariaDescribedBy}" .flexContent="${this.flexContent}" .open="${this.open}" .preventScrimClose="${this.preventScrimClose}"> ${this.withoutHeader?n.s6:n.qy` <slot name="header" slot="header">${this._renderHeaderContent()}</slot> `} <slot></slot> <slot name="footer" slot="footer"></slot> </ha-bottom-sheet> `:n.qy` <ha-dialog .open="${this.open}" .type="${this.type}" .width="${this.width}" .preventScrimClose="${this.preventScrimClose}" .ariaLabelledBy="${this.ariaLabelledBy}" .ariaDescribedBy="${this.ariaDescribedBy}" .headerTitle="${this.headerTitle}" .headerSubtitle="${this.headerSubtitle}" .headerSubtitlePosition="${this.headerSubtitlePosition}" .flexContent="${this.flexContent}" .withoutHeader="${this.withoutHeader}"> ${this._renderCloseButton("headerNavigationIcon")} <slot name="headerTitle" slot="headerTitle"></slot> <slot name="headerSubtitle" slot="headerSubtitle"></slot> <slot name="headerActionItems" slot="headerActionItems"></slot> <slot></slot> <slot name="footer" slot="footer"></slot> </ha-dialog> `}static get styles(){return[n.AH`ha-bottom-sheet{--ha-bottom-sheet-border-radius:var(--ha-border-radius-2xl);--ha-bottom-sheet-surface-background:var(
--ha-dialog-surface-background,
var(--card-background-color, var(--ha-color-surface-default))
);--ha-bottom-sheet-padding:0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left);--ha-bottom-sheet-content-padding:var(
--dialog-content-padding,
0 var(--ha-space-6) var(--ha-space-6) var(--ha-space-6)
)}`]}constructor(...t){super(...t),this.open=!1,this.type="standard",this.width="medium",this.preventScrimClose=!1,this.headerSubtitlePosition="below",this.allowModeChange=!1,this.withoutHeader=!1,this.hideCloseButton=!1,this.flexContent=!1,this.mode="dialog",this._modeSet=!1}}(0,o.Cg)([(0,r.MZ)({attribute:"aria-labelledby"})],v.prototype,"ariaLabelledBy",void 0),(0,o.Cg)([(0,r.MZ)({attribute:"aria-describedby"})],v.prototype,"ariaDescribedBy",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],v.prototype,"open",void 0),(0,o.Cg)([(0,r.MZ)({reflect:!0})],v.prototype,"type",void 0),(0,o.Cg)([(0,r.MZ)({type:String,reflect:!0,attribute:"width"})],v.prototype,"width",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],v.prototype,"preventScrimClose",void 0),(0,o.Cg)([(0,r.MZ)({attribute:"header-title"})],v.prototype,"headerTitle",void 0),(0,o.Cg)([(0,r.MZ)({attribute:"header-subtitle"})],v.prototype,"headerSubtitle",void 0),(0,o.Cg)([(0,r.MZ)({type:String,attribute:"header-subtitle-position"})],v.prototype,"headerSubtitlePosition",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean,attribute:"allow-mode-change"})],v.prototype,"allowModeChange",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean,attribute:"without-header"})],v.prototype,"withoutHeader",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean,attribute:"hide-close-button"})],v.prototype,"hideCloseButton",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],v.prototype,"flexContent",void 0),(0,o.Cg)([(0,r.wk)()],v.prototype,"mode",void 0),(0,o.Cg)([(0,r.wk)(),(0,s.Fg)({context:d.D5,subscribe:!0})],v.prototype,"_i18n",void 0),v=(0,o.Cg)([(0,r.EM)("ha-adaptive-dialog")],v),a()}catch(t){a(t)}})},43661(t,e,i){i.r(e),i.d(e,{HaIconNext:()=>r});var a=i(62826),o=i(22441),s=i(63091),n=i(67094);class r extends n.HaSvgIcon{constructor(...t){super(...t),this.path="rtl"===s.G.document.dir?"M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z":"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"}}(0,a.Cg)([(0,o.MZ)()],r.prototype,"path",void 0),r=(0,a.Cg)([(0,o.EM)("ha-icon-next")],r)},28732(t,e,i){var a=i(62826),o=i(27686),s=i(7731),n=i(5124),r=i(22441);class l extends o.J{renderRipple(){return this.noninteractive?"":super.renderRipple()}static get styles(){return[s.R,n.AH`:host{padding-left:var(--mdc-list-side-padding-left,var(--mdc-list-side-padding,20px));padding-inline-start:var(--mdc-list-side-padding-left,var(--mdc-list-side-padding,20px));padding-right:var(--mdc-list-side-padding-right,var(--mdc-list-side-padding,20px));padding-inline-end:var(--mdc-list-side-padding-right,var(--mdc-list-side-padding,20px))}:host([graphic=avatar]:not([twoLine])),:host([graphic=icon]:not([twoLine])){height:48px}span.material-icons:first-of-type{margin-inline-start:0px!important;margin-inline-end:var(--mdc-list-item-graphic-margin,16px)!important;direction:var(--direction)!important}span.material-icons:last-of-type{margin-inline-start:auto!important;margin-inline-end:0px!important;direction:var(--direction)!important}.mdc-deprecated-list-item__meta{display:var(--mdc-list-item-meta-display);align-items:center;flex-shrink:0}:host([graphic=icon]:not([twoline])) .mdc-deprecated-list-item__graphic{margin-inline-end:var(--mdc-list-item-graphic-margin,20px)!important}:host([multiline-secondary]){height:auto}:host([multiline-secondary]) .mdc-deprecated-list-item__text{padding:8px 0}:host([multiline-secondary]) .mdc-deprecated-list-item__secondary-text{text-overflow:initial;white-space:normal;overflow:auto;display:inline-block;margin-top:10px}:host([multiline-secondary]) .mdc-deprecated-list-item__primary-text{margin-top:10px}:host([multiline-secondary]) .mdc-deprecated-list-item__secondary-text::before{display:none}:host([multiline-secondary]) .mdc-deprecated-list-item__primary-text::before{display:none}:host([disabled]){color:var(--disabled-text-color)}:host([noninteractive]){pointer-events:unset}`,"rtl"===document.dir?n.AH`span.material-icons:first-of-type,span.material-icons:last-of-type{direction:rtl!important;--direction:rtl}`:n.AH``]}}l=(0,a.Cg)([(0,r.EM)("ha-list-item")],l)},67505(t,e,i){var a=i(62826),o=i(5124),s=i(22441),n=i(93421);i(67094);class r extends o.WF{render(){return this._localize?o.qy` <ha-svg-icon .path="${"M12,2A7,7 0 0,1 19,9C19,11.38 17.81,13.47 16,14.74V17A1,1 0 0,1 15,18H9A1,1 0 0,1 8,17V14.74C6.19,13.47 5,11.38 5,9A7,7 0 0,1 12,2M9,21V20H15V21A1,1 0 0,1 14,22H10A1,1 0 0,1 9,21M12,4A5,5 0 0,0 7,9C7,11.05 8.23,12.81 10,13.58V16H14V13.58C15.77,12.81 17,11.05 17,9A5,5 0 0,0 12,4Z"}"></ha-svg-icon> <span class="prefix">${this._localize("ui.panel.config.tips.tip")}</span> <span class="text"><slot></slot></span> `:o.s6}}r.styles=o.AH`:host{display:block;text-align:center}.text{direction:var(--direction);margin-left:2px;margin-inline-start:2px;margin-inline-end:initial;color:var(--secondary-text-color)}.prefix{font-weight:var(--ha-font-weight-medium)}`,(0,a.Cg)([(0,s.wk)(),(0,n.IW)()],r.prototype,"_localize",void 0),r=(0,a.Cg)([(0,s.EM)("ha-tip")],r)},35891(t,e,i){i.d(e,{Bs:()=>n,Jp:()=>o,Tk:()=>s,Xg:()=>a,oz:()=>l,x1:()=>r});i(74423);const a=(t,e)=>t.callWS({type:"blueprint/list",domain:e}),o=(t,e)=>t.callWS({type:"blueprint/import",url:e}),s=(t,e,i,a,o,s)=>t.callWS({type:"blueprint/save",domain:e,path:i,yaml:a,source_url:o,allow_override:s}),n=(t,e,i)=>t.callWS({type:"blueprint/delete",domain:e,path:i}),r=t=>{const e=t.metadata.source_url;return e?e.includes("github.com/home-assistant")?"homeassistant":"community":"local"},l=(t,e,i,a)=>t.callWS({type:"blueprint/substitute",domain:e,path:i,input:a})},59502(t,e,i){i.a(t,async function(t,a){try{i.r(e);i(18111),i(22489),i(61701);var o=i(62826),s=i(78648),n=i(5124),r=i(22441),l=i(22786),d=i(1087),h=i(77090),p=i(52220),c=i(14693),m=(i(43661),i(8630),i(28732),i(65829)),u=(i(67505),i(36866)),g=i(88249),v=i(35891),y=i(84025),_=i(59653),b=i(53580),C=i(14503),f=i(36918),x=t([c,m,u]);[c,m,u]=x.then?(await x)():x;const $="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z",w="M14.06,9L15,9.94L5.92,19H5V18.08L14.06,9M17.66,3C17.41,3 17.15,3.1 16.96,3.29L15.13,5.12L18.88,8.87L20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18.17,3.09 17.92,3 17.66,3M14.06,6.19L3,17.25V21H6.75L17.81,9.94L14.06,6.19Z",M="M16.36,14C16.44,13.34 16.5,12.68 16.5,12C16.5,11.32 16.44,10.66 16.36,10H19.74C19.9,10.64 20,11.31 20,12C20,12.69 19.9,13.36 19.74,14M14.59,19.56C15.19,18.45 15.65,17.25 15.97,16H18.92C17.96,17.65 16.43,18.93 14.59,19.56M14.34,14H9.66C9.56,13.34 9.5,12.68 9.5,12C9.5,11.32 9.56,10.65 9.66,10H14.34C14.43,10.65 14.5,11.32 14.5,12C14.5,12.68 14.43,13.34 14.34,14M12,19.96C11.17,18.76 10.5,17.43 10.09,16H13.91C13.5,17.43 12.83,18.76 12,19.96M8,8H5.08C6.03,6.34 7.57,5.06 9.4,4.44C8.8,5.55 8.35,6.75 8,8M5.08,16H8C8.35,17.25 8.8,18.45 9.4,19.56C7.57,18.93 6.03,17.65 5.08,16M4.26,14C4.1,13.36 4,12.69 4,12C4,11.31 4.1,10.64 4.26,10H7.64C7.56,10.66 7.5,11.32 7.5,12C7.5,12.68 7.56,13.34 7.64,14M12,4.03C12.83,5.23 13.5,6.57 13.91,8H10.09C10.5,6.57 11.17,5.23 12,4.03M18.92,8H15.97C15.65,6.75 15.19,5.55 14.59,4.44C16.43,5.07 17.96,6.34 18.92,8M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",L={local:"M13,9V3.5L18.5,9M6,2C4.89,2 4,2.89 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2H6Z",community:"M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z",homeassistant:b.mdiHomeAssistant},H=[{name:"name",weight:10},{name:"description",weight:7},{name:"author",weight:5},{name:"sourceType",weight:3}];class A extends n.WF{showDialog(t){this._params=t,this._open=!0,this._mode=t?.mode||"automation",this._filter="",this.blueprints=void 0,this._loadingBlueprints=!0,(0,v.Xg)(this.hass,this._mode).then(t=>{this.blueprints=t}).finally(()=>{this._loadingBlueprints=!1})}closeDialog(){this._open=!1}_dialogClosed(){this._params=void 0,this.blueprints=void 0,this._loadingBlueprints=!1,this._filter="",(0,d.r)(this,"dialog-closed",{dialog:this.localName})}render(){if(!this._params)return n.s6;const t=this._processedBlueprints(this.blueprints),e=this._filteredBlueprints(t,this._filter);return n.qy` <ha-adaptive-dialog .open="${this._open}" flexcontent header-title="${this.hass.localize(`ui.panel.config.${this._mode}.dialog_new.header`)}" ="${this._dialogClosed}"> <div class="content-wrapper"> ${t.length>5?n.qy`<ha-input-search appearance="outlined" autofocus .value="${this._filter}" .placeholder="${this.hass.localize("ui.common.search")}" ="${this._handleSearchChange}"></ha-input-search>`:n.s6} <ha-list> <ha-list-item hasmeta twoline graphic="icon" -selected="${this._blank}"> <ha-svg-icon slot="graphic" .path="${w}"></ha-svg-icon> ${this.hass.localize(`ui.panel.config.${this._mode}.dialog_new.create_empty`)} <span slot="secondary"> ${this.hass.localize(`ui.panel.config.${this._mode}.dialog_new.create_empty_description`)} </span> <ha-icon-next slot="meta"></ha-icon-next> </ha-list-item> </ha-list> <div class="blueprints-container"> <div class="blueprints-list ha-scrollbar"> ${this._loadingBlueprints?n.qy`<div class="spinner"> <ha-spinner></ha-spinner> </div>`:n.qy` <ha-list> ${e.map(t=>n.qy` <ha-list-item hasmeta twoline graphic="icon" -selected="${this._blueprint}" .path="${t.path}"> <ha-svg-icon slot="graphic" .path="${L[t.sourceType]}"></ha-svg-icon> ${t.name} <span slot="secondary"> ${t.author?this.hass.localize(`ui.panel.config.${this._mode}.dialog_new.blueprint_source.author`,{author:t.author}):this.hass.localize(`ui.panel.config.${this._mode}.dialog_new.blueprint_source.${t.sourceType}`)} </span> <ha-icon-next slot="meta"></ha-icon-next> </ha-list-item> `)} </ha-list> ${0===t.length?n.qy` <a href="${(0,f.o)(this.hass,"/get-blueprints")}" target="_blank" rel="noreferrer noopener" class="item"> <ha-list-item hasmeta twoline graphic="icon"> <ha-svg-icon slot="graphic" .path="${M}"></ha-svg-icon> ${this.hass.localize(`ui.panel.config.${this._mode}.dialog_new.create_blueprint`)} <span slot="secondary"> ${this.hass.localize(`ui.panel.config.${this._mode}.dialog_new.create_blueprint_description`)} </span> <ha-svg-icon slot="meta" path="${$}"></ha-svg-icon> </ha-list-item> </a> `:0===e.length?n.qy` <div class="empty-search"> ${this.hass.localize(`ui.panel.config.${this._mode}.dialog_new.no_blueprints_match_search`)} </div> `:n.s6} ${t.length>0?n.qy` <ha-tip> <a href="${(0,f.o)(this.hass,"/get-blueprints")}" target="_blank" rel="noreferrer noopener"> ${this.hass.localize(`ui.panel.config.${this._mode}.dialog_new.discover_blueprint_tip`)} </a> </ha-tip> `:n.s6} `} </div> </div> </div> </ha-adaptive-dialog> `}_handleSearchChange(t){this._filter=t.target.value??""}async _blueprint(t){if(!(0,h.s)(t))return;const e=t.currentTarget.path;"script"===this._mode?(0,y.AM)({use_blueprint:{path:e}}):(0,g.mX)({use_blueprint:{path:e}})}async _blank(t){(0,h.s)(t)&&("script"===this._mode?(0,y.AM)():(0,g.mX)())}static get styles(){return[C.RF,C.nA,n.AH`ha-adaptive-dialog{--dialog-content-padding:0;--ha-dialog-min-height:min(
720px,
calc(
100dvh - max(
var(--safe-area-inset-bottom),
var(--ha-space-4)
) - max(var(--safe-area-inset-top), var(--ha-space-4))
)
);--ha-dialog-max-height:var(--ha-dialog-min-height)}:host{--ha-bottom-sheet-height:min(85vh, 85dvh);--ha-bottom-sheet-max-height:min(85vh, 85dvh)} all and (min-width:550px){ha-adaptive-dialog{--mdc-dialog-min-width:500px}}.content-wrapper{display:flex;flex-direction:column;min-height:0;height:100%}.blueprints-container{display:flex;flex-direction:column;flex:1;min-height:0;border-top:1px solid var(--divider-color)}ha-input-search{padding:0 var(--ha-space-3)}.blueprints-list{overflow-y:auto;min-height:0;padding-bottom:var(--ha-space-2)}.spinner{display:flex;justify-content:center;padding:var(--ha-space-8) 0}ha-icon-next{width:24px}ha-tip{margin:var(--ha-space-2) var(--ha-space-4)}.empty-search{color:var(--secondary-text-color);padding:var(--ha-space-4)}a.item{text-decoration:unset}`]}constructor(...t){super(...t),this._open=!1,this._mode="automation",this._loadingBlueprints=!1,this._filter="",this._processedBlueprints=(0,l.A)(t=>{if(!t)return[];return Object.entries(t).filter(t=>!("error"in t[1])).map(([t,e])=>{const i=(0,v.x1)(e);return{...e.metadata,sourceType:i,path:t}}).sort((t,e)=>(0,p.xL)(t.name,e.name,this.hass.locale.language))}),this._blueprintFuseIndex=(0,l.A)(t=>s.A.createIndex(H,t)),this._filteredBlueprints=(0,l.A)((t,e)=>(0,_.C)(t,e,H,this._blueprintFuseIndex(t)))}}(0,o.Cg)([(0,r.MZ)({attribute:!1})],A.prototype,"hass",void 0),(0,o.Cg)([(0,r.wk)()],A.prototype,"_open",void 0),(0,o.Cg)([(0,r.wk)()],A.prototype,"_params",void 0),(0,o.Cg)([(0,r.wk)()],A.prototype,"_mode",void 0),(0,o.Cg)([(0,r.wk)()],A.prototype,"blueprints",void 0),(0,o.Cg)([(0,r.wk)()],A.prototype,"_loadingBlueprints",void 0),(0,o.Cg)([(0,r.wk)()],A.prototype,"_filter",void 0),A=(0,o.Cg)([(0,r.EM)("ha-dialog-new-automation")],A),a()}catch(t){a(t)}})}};