UNPKG

iobroker.lovelace

Version:

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

1 lines 3.75 kB
export const __rspack_esm_id=17418;export const __rspack_esm_ids=[17418];export const __webpack_modules__={19463(t,e,a){a.a(t,async function(t,e){try{a(74423);var i=a(62826),o=a(5124),s=a(22441),n=a(380),h=a(72487),r=a(1087),l=a(46927),d=(a(67094),a(91485)),c=t([d,h]);[d,h]=c.then?(await c)():c;const p="M19,19H5V8H19M16,1V3H8V1H6V3H5C3.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,3H18V1M17,12H12V17H17V12Z",u=()=>Promise.all([a.e(80827),a.e(17481),a.e(90923)]).then(a.bind(a,64080)),g=(t,e)=>{(0,r.r)(t,"show-dialog",{dialogTag:"ha-dialog-date-picker",dialogImport:u,dialogParams:e})};class v extends o.WF{reportValidity(){return this._input?.reportValidity()??!0}render(){return o.qy`<ha-input .label="${this.label??""}" .hint="${this.helper??""}" .disabled="${this.disabled}" readonly="readonly" @click="${this._openDialog}" @keydown="${this._keyDown}" .value="${this.value?(0,h.zB)(new Date(`${this.value.split("T")[0]}T00:00:00`),{...this.locale,time_zone:l.Wj.local},{}):""}" .required="${this.required}"> <ha-svg-icon slot="end" .path="${p}"></ha-svg-icon> </ha-input>`}_openDialog(){this.disabled||g(this,{min:this.min||"1970-01-01",max:this.max,value:this.value,canClear:this.canClear,onChange:t=>this._valueChanged(t),locale:this.locale.language,firstWeekday:(0,n.P)(this.locale)})}_keyDown(t){if(["Space","Enter"].includes(t.code))return t.preventDefault(),t.stopPropagation(),void this._openDialog();this.canClear&&["Backspace","Delete"].includes(t.key)&&this._valueChanged(void 0)}_valueChanged(t){this.value!==t&&(this.value=t,(0,r.r)(this,"change"),(0,r.r)(this,"value-changed",{value:t}))}constructor(...t){super(...t),this.disabled=!1,this.required=!1,this.canClear=!1}}v.styles=o.AH`:host{min-width:0px}ha-svg-icon{color:var(--secondary-text-color)}`,(0,i.Cg)([(0,s.MZ)({attribute:!1})],v.prototype,"locale",void 0),(0,i.Cg)([(0,s.MZ)()],v.prototype,"value",void 0),(0,i.Cg)([(0,s.MZ)()],v.prototype,"min",void 0),(0,i.Cg)([(0,s.MZ)()],v.prototype,"max",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],v.prototype,"disabled",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],v.prototype,"required",void 0),(0,i.Cg)([(0,s.MZ)()],v.prototype,"label",void 0),(0,i.Cg)([(0,s.MZ)()],v.prototype,"helper",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"can-clear",type:Boolean})],v.prototype,"canClear",void 0),(0,i.Cg)([(0,s.P)("ha-input",!0)],v.prototype,"_input",void 0),v=(0,i.Cg)([(0,s.EM)("ha-date-input")],v),e()}catch(t){e(t)}})},32786(t,e,a){a.d(e,{M:()=>i});const i=(t,e,a=void 0)=>{const i={entity_id:e,date:a};t.callService("date","set_value",i)}},75473(t,e,a){a.a(t,async function(t,i){try{a.r(e);var o=a(62826),s=a(5124),n=a(22441),h=a(19463),r=a(32786),l=a(22675),d=a(784),c=a(79757),p=a(85979),u=t([h,c,p]);[h,c,p]=u.then?(await u)():u;class g extends s.WF{setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}shouldUpdate(t){return(0,d.LX)(this,t)}render(){if(!this._config||!this.hass)return s.s6;const t=this.hass.states[this._config.entity];if(!t)return s.qy` <hui-warning .hass="${this.hass}"> ${(0,p.j)(this.hass,this._config.entity)} </hui-warning> `;const e=t.state===l.Hh;return s.qy` <hui-generic-entity-row .hass="${this.hass}" .config="${this._config}"> <ha-date-input .locale="${this.hass.locale}" .disabled="${e}" .value="${t.state===l.Hh||t.state===l.HV?void 0:t.state}" @value-changed="${this._dateChanged}"> </ha-date-input> </hui-generic-entity-row> `}_dateChanged(t){t.detail.value&&(0,r.M)(this.hass,this._config.entity,t.detail.value)}}g.styles=s.AH`ha-date-input{max-width:50%}`,(0,o.Cg)([(0,n.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,o.Cg)([(0,n.wk)()],g.prototype,"_config",void 0),g=(0,o.Cg)([(0,n.EM)("hui-date-entity-row")],g),i()}catch(t){i(t)}})}};