UNPKG

iobroker.lovelace

Version:

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

10 lines 16.6 kB
export const __rspack_esm_id=76203;export const __rspack_esm_ids=[76203];export const __webpack_modules__={32656(t,e,a){a.a(t,async function(t,e){try{a(74423);var i=a(62826),s=a(5124),o=a(22441),l=a(63672),r=a(1087),n=a(57237),d=a(26300),h=(a(3449),a(606)),p=a(91485),u=t([d,h,p]);[d,h,p]=u.then?(await u)():u;const c="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";class b extends s.WF{reportValidity(){const t=this._inputs;return!t||[...t].every(t=>t.reportValidity())}render(){return s.qy` ${this.label?s.qy`<label>${this.label}${this.required?" *":""}</label>`:s.s6} <div class="time-input-wrap-wrap"> <div class="time-input-wrap"> ${this.enableDay?s.qy` <ha-input id="day" type="number" inputmode="numeric" .value="${this.days.toFixed()}" .label="${this.placeholderLabels?"":this.dayLabel}" .placeholder="${this.placeholderLabels?this.dayLabel:""}" name="days" @change="${this._valueChanged}" @focusin="${this._onFocus}" without-spin-buttons .required="${this.required}" .autoValidate="${this.autoValidate}" min="0" .disabled="${this.disabled}"> </ha-input> <div class="time-separator">:</div> `:s.s6} <ha-input id="hour" type="number" inputmode="numeric" .value="${this.hours.toFixed()}" .label="${this.placeholderLabels?"":this.hourLabel}" .placeholder="${this.placeholderLabels?this.hourLabel:""}" name="hours" @change="${this._valueChanged}" @focusin="${this._onFocus}" without-spin-buttons .required="${this.required}" .autoValidate="${this.autoValidate}" maxlength="2" max="${(0,l.J)(this._hourMax)}" min="0" .disabled="${this.disabled}"> </ha-input> <div class="time-separator">:</div> <ha-input id="min" type="number" inputmode="numeric" .value="${this._formatValue(this.minutes)}" .label="${this.placeholderLabels?"":this.minLabel}" .placeholder="${this.placeholderLabels?this.minLabel:""}" @change="${this._valueChanged}" @focusin="${this._onFocus}" name="minutes" without-spin-buttons .required="${this.required}" .autoValidate="${this.autoValidate}" maxlength="2" max="59" min="0" .disabled="${this.disabled}"> </ha-input> ${this.enableSecond?s.qy`<div class="time-separator">:</div>`:s.s6} ${this.enableSecond?s.qy`<ha-input id="sec" type="number" inputmode="decimal" step="any" .value="${this._formatValue(this.seconds)}" .label="${this.placeholderLabels?"":this.secLabel}" .placeholder="${this.placeholderLabels?this.secLabel:""}" @change="${this._valueChanged}" @focusin="${this._onFocus}" name="seconds" without-spin-buttons .required="${this.required}" .autoValidate="${this.autoValidate}" max="59" min="0" .disabled="${this.disabled}"> </ha-input> ${this.enableMillisecond?s.qy`<div class="time-separator">:</div>`:s.s6}`:s.s6} ${this.enableMillisecond?s.qy`<ha-input id="millisec" type="number" .value="${this._formatValue(this.milliseconds,3)}" .label="${this.placeholderLabels?"":this.millisecLabel}" .placeholder="${this.placeholderLabels?this.millisecLabel:""}" @change="${this._valueChanged}" @focusin="${this._onFocus}" name="milliseconds" without-spin-buttons .required="${this.required}" .autoValidate="${this.autoValidate}" maxlength="3" max="999" min="0" .disabled="${this.disabled}"> </ha-input>`:s.s6} ${24===this.format?s.s6:s.qy`<ha-select .required="${this.required}" .value="${this.amPm}" .disabled="${this.disabled}" .name="${"amPm"}" @selected="${this._valueChanged}" @wa-after-hide="${n.d}" @wa-hide="${n.d}" .options="${["AM","PM"]}"> </ha-select>`} ${!this.clearable||this.required||this.disabled?s.s6:s.qy`<ha-icon-button label="clear" @click="${this._clearValue}" .path="${c}"></ha-icon-button>`} </div> </div> ${this.helper?s.qy`<ha-input-helper-text .disabled="${this.disabled}">${this.helper}</ha-input-helper-text>`:s.s6} `}_clearValue(){(0,r.r)(this,"value-changed")}_valueChanged(t){const e=t.currentTarget;this[e.name||""]="amPm"===e.name?t.detail.value:Number(e.value);const a={hours:this.hours,minutes:this.minutes,seconds:this.seconds,milliseconds:this.milliseconds};this.enableDay&&(a.days=this.days),12===this.format&&(a.amPm=this.amPm),(0,r.r)(this,"value-changed",{value:a})}_onFocus(t){t.currentTarget.select()}_formatValue(t,e=2){const a=t.toString();return a.includes(".")?a:a.padStart(e,"0")}get _hourMax(){if(!this.noHoursLimit)return 12===this.format?12:23}constructor(...t){super(...t),this.autoValidate=!1,this.required=!1,this.format=12,this.disabled=!1,this.days=0,this.hours=0,this.minutes=0,this.seconds=0,this.milliseconds=0,this.dayLabel="",this.hourLabel="",this.minLabel="",this.secLabel="",this.millisecLabel="",this.enableSecond=!1,this.enableMillisecond=!1,this.enableDay=!1,this.noHoursLimit=!1,this.amPm="AM",this.placeholderLabels=!1}}b.shadowRootOptions={...s.WF.shadowRootOptions,delegatesFocus:!0},b.styles=s.AH`:host([clearable]){position:relative}.time-input-wrap-wrap{display:flex}.time-input-wrap{display:flex;flex:var(--time-input-flex,unset);border-radius:var(--mdc-shape-small,var(--ha-border-radius-sm)) var(--mdc-shape-small,var(--ha-border-radius-sm)) var(--ha-border-radius-square) var(--ha-border-radius-square);overflow:hidden;position:relative;direction:ltr;padding-right:3px}ha-input{height:56px;padding:0;width:60px;flex-grow:1}ha-input:first-child{--text-field-border-top-left-radius:var(--mdc-shape-medium)}ha-input:last-child{--text-field-border-top-right-radius:var(--mdc-shape-medium)}ha-input::part(wa-base){padding:var(--ha-space-1)}ha-input:first-child::part(wa-base){padding-inline-start:var(--ha-space-4)}ha-input:last-child::part(wa-base){padding-inline-end:var(--ha-space-4)}ha-input::part(wa-hint){height:0}ha-input::part(wa-input){text-align:center}.time-separator,ha-icon-button{background-color:var(--ha-color-form-background);color:var(--ha-color-text-secondary);border-bottom:1px solid var(--ha-color-border-neutral-loud);box-sizing:border-box;height:56px;margin-inline-start:calc(var(--ha-space-1) * -1)}.time-separator{width:12px;margin-inline-end:calc(var(--ha-space-1) * -1);display:flex;align-items:center;justify-content:center}:host([clearable]) .mdc-select__anchor{padding-inline-end:var(--select-selected-text-padding-end,12px)}ha-icon-button{position:relative;--ha-icon-button-size:36px;border-start-end-radius:var(--ha-border-radius-sm);--mdc-icon-size:20px;direction:var(--direction);display:flex;align-items:center}ha-select{margin-inline:calc(var(--ha-space-1) * -1)}label{-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);-webkit-font-smoothing:var(--ha-font-smoothing);font-family:var( --mdc-typography-body2-font-family, var(--mdc-typography-font-family, var(--ha-font-family-body)) );font-size:var(--mdc-typography-body2-font-size, var(--ha-font-size-s));line-height:var( --mdc-typography-body2-line-height, var(--ha-line-height-condensed) );font-weight:var(--mdc-typography-body2-font-weight,var(--ha-font-weight-normal));letter-spacing:var( --mdc-typography-body2-letter-spacing, .0178571429em );text-decoration:var(--mdc-typography-body2-text-decoration,inherit);text-transform:var(--mdc-typography-body2-text-transform,inherit);color:var(--mdc-theme-text-primary-on-background,rgba(0,0,0,.87));padding-left:4px;padding-inline-start:4px;padding-inline-end:initial}ha-input-helper-text{padding-top:8px;line-height:var(--ha-line-height-condensed)}`,(0,i.Cg)([(0,o.MZ)()],b.prototype,"label",void 0),(0,i.Cg)([(0,o.MZ)()],b.prototype,"helper",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"auto-validate",type:Boolean})],b.prototype,"autoValidate",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],b.prototype,"required",void 0),(0,i.Cg)([(0,o.MZ)({type:Number})],b.prototype,"format",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],b.prototype,"disabled",void 0),(0,i.Cg)([(0,o.MZ)({type:Number})],b.prototype,"days",void 0),(0,i.Cg)([(0,o.MZ)({type:Number})],b.prototype,"hours",void 0),(0,i.Cg)([(0,o.MZ)({type:Number})],b.prototype,"minutes",void 0),(0,i.Cg)([(0,o.MZ)({type:Number})],b.prototype,"seconds",void 0),(0,i.Cg)([(0,o.MZ)({type:Number})],b.prototype,"milliseconds",void 0),(0,i.Cg)([(0,o.MZ)({type:String,attribute:"day-label"})],b.prototype,"dayLabel",void 0),(0,i.Cg)([(0,o.MZ)({type:String,attribute:"hour-label"})],b.prototype,"hourLabel",void 0),(0,i.Cg)([(0,o.MZ)({type:String,attribute:"min-label"})],b.prototype,"minLabel",void 0),(0,i.Cg)([(0,o.MZ)({type:String,attribute:"sec-label"})],b.prototype,"secLabel",void 0),(0,i.Cg)([(0,o.MZ)({type:String,attribute:"ms-label"})],b.prototype,"millisecLabel",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"enable-second",type:Boolean})],b.prototype,"enableSecond",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"enable-millisecond",type:Boolean})],b.prototype,"enableMillisecond",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"enable-day",type:Boolean})],b.prototype,"enableDay",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"no-hours-limit",type:Boolean})],b.prototype,"noHoursLimit",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],b.prototype,"amPm",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],b.prototype,"clearable",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"placeholder-labels",type:Boolean})],b.prototype,"placeholderLabels",void 0),(0,i.Cg)([(0,o.YG)("ha-input")],b.prototype,"_inputs",void 0),b=(0,i.Cg)([(0,o.EM)("ha-base-time-input")],b),e()}catch(t){e(t)}})},19463(t,e,a){a.a(t,async function(t,e){try{a(74423);var i=a(62826),s=a(5124),o=a(22441),l=a(380),r=a(72487),n=a(1087),d=a(46927),h=(a(67094),a(91485)),p=t([h,r]);[h,r]=p.then?(await p)():p;const u="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",c=()=>Promise.all([a.e(80827),a.e(17481),a.e(90923)]).then(a.bind(a,64080)),b=(t,e)=>{(0,n.r)(t,"show-dialog",{dialogTag:"ha-dialog-date-picker",dialogImport:c,dialogParams:e})};class m extends s.WF{reportValidity(){return this._input?.reportValidity()??!0}render(){return s.qy`<ha-input .label="${this.label??""}" .hint="${this.helper??""}" .disabled="${this.disabled}" readonly="readonly" @click="${this._openDialog}" @keydown="${this._keyDown}" .value="${this.value?(0,r.zB)(new Date(`${this.value.split("T")[0]}T00:00:00`),{...this.locale,time_zone:d.Wj.local},{}):""}" .required="${this.required}"> <ha-svg-icon slot="end" .path="${u}"></ha-svg-icon> </ha-input>`}_openDialog(){this.disabled||b(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,l.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,n.r)(this,"change"),(0,n.r)(this,"value-changed",{value:t}))}constructor(...t){super(...t),this.disabled=!1,this.required=!1,this.canClear=!1}}m.styles=s.AH`:host{min-width:0px}ha-svg-icon{color:var(--secondary-text-color)}`,(0,i.Cg)([(0,o.MZ)({attribute:!1})],m.prototype,"locale",void 0),(0,i.Cg)([(0,o.MZ)()],m.prototype,"value",void 0),(0,i.Cg)([(0,o.MZ)()],m.prototype,"min",void 0),(0,i.Cg)([(0,o.MZ)()],m.prototype,"max",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],m.prototype,"disabled",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],m.prototype,"required",void 0),(0,i.Cg)([(0,o.MZ)()],m.prototype,"label",void 0),(0,i.Cg)([(0,o.MZ)()],m.prototype,"helper",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"can-clear",type:Boolean})],m.prototype,"canClear",void 0),(0,i.Cg)([(0,o.P)("ha-input",!0)],m.prototype,"_input",void 0),m=(0,i.Cg)([(0,o.EM)("ha-date-input")],m),e()}catch(t){e(t)}})},50286(t,e,a){a.a(t,async function(t,e){try{var i=a(62826),s=a(5124),o=a(22441),l=a(69543),r=a(1087),n=a(32656),d=t([n]);n=(d.then?(await d)():d)[0];class h extends s.WF{reportValidity(){return this._input?.reportValidity()??!0}render(){const t=(0,l.J)(this.locale);let e=NaN,a=NaN,i=NaN,o=0;if(this.value){const s=this.value?.split(":")||[];a=s[1]?Number(s[1]):0,i=s[2]?Number(s[2]):0,e=s[0]?Number(s[0]):0,o=e,o&&t&&o>12&&o<24&&(e=o-12),t&&0===o&&(e=12)}return s.qy` <ha-base-time-input .label="${this.label}" .hours="${e}" .minutes="${a}" .seconds="${i}" .format="${t?12:24}" .amPm="${t&&o>=12?"PM":"AM"}" .disabled="${this.disabled}" @value-changed="${this._timeChanged}" .enableSecond="${this.enableSecond}" .required="${this.required}" .clearable="${this.clearable&&void 0!==this.value}" .helper="${this.helper}" .placeholderLabels="${this.placeholderLabels}" .autoValidate="${this.autoValidate}" day-label="dd" hour-label="hh" min-label="mm" sec-label="ss" ms-label="ms"></ha-base-time-input> `}_timeChanged(t){t.stopPropagation();const e=t.detail.value,a=(0,l.J)(this.locale);let i,s=0;if(!(void 0===e||isNaN(e.hours)&&isNaN(e.minutes)&&isNaN(e.seconds))){let t=e.hours||0;e&&a&&(s=t>=12&&t<24?t-12:0===t?12:0,"PM"===e.amPm&&t<12&&(t+=12),"AM"===e.amPm&&12===t&&(t=0)),i=`${t.toString().padStart(2,"0")}:${e.minutes?e.minutes.toString().padStart(2,"0"):"00"}:${e.seconds?e.seconds.toString().padStart(2,"0"):"00"}`}s&&this.updateComplete.then(()=>{const t=this._input;t&&(t.hours=s)}),i!==this.value&&(this.value=i,(0,r.r)(this,"change"),(0,r.r)(this,"value-changed",{value:i}))}constructor(...t){super(...t),this.disabled=!1,this.required=!1,this.autoValidate=!1,this.enableSecond=!1,this.placeholderLabels=!1}}(0,i.Cg)([(0,o.MZ)({attribute:!1})],h.prototype,"locale",void 0),(0,i.Cg)([(0,o.MZ)()],h.prototype,"value",void 0),(0,i.Cg)([(0,o.MZ)()],h.prototype,"label",void 0),(0,i.Cg)([(0,o.MZ)()],h.prototype,"helper",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],h.prototype,"disabled",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],h.prototype,"required",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"auto-validate",type:Boolean})],h.prototype,"autoValidate",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean,attribute:"enable-second"})],h.prototype,"enableSecond",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],h.prototype,"clearable",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"placeholder-labels",type:Boolean})],h.prototype,"placeholderLabels",void 0),(0,i.Cg)([(0,o.P)("ha-base-time-input")],h.prototype,"_input",void 0),h=(0,i.Cg)([(0,o.EM)("ha-time-input")],h),e()}catch(t){e(t)}})},77738(t,e,a){a.d(e,{Bj:()=>n,TB:()=>s,a2:()=>o,fJ:()=>r,ke:()=>l,rv:()=>i});const i=t=>`${t.attributes.year||"1970"}-${String(t.attributes.month||"01").padStart(2,"0")}-${String(t.attributes.day||"01").padStart(2,"0")}T${String(t.attributes.hour||"00").padStart(2,"0")}:${String(t.attributes.minute||"00").padStart(2,"0")}:${String(t.attributes.second||"00").padStart(2,"0")}`,s=(t,e,a=void 0,i=void 0)=>{const s={entity_id:e,time:a,date:i};t.callService("input_datetime","set_datetime",s)},o=t=>t.callWS({type:"input_datetime/list"}),l=(t,e)=>t.callWS({type:"input_datetime/create",...e}),r=(t,e,a)=>t.callWS({type:"input_datetime/update",input_datetime_id:e,...a}),n=(t,e)=>t.callWS({type:"input_datetime/delete",input_datetime_id:e})},15366(t,e,a){a.a(t,async function(t,i){try{a.r(e);var s=a(62826),o=a(5124),l=a(22441),r=a(19463),n=a(50286),d=a(22675),h=a(77738),p=t([r,n]);[r,n]=p.then?(await p)():p;class u extends o.WF{render(){return this.stateObj?o.qy` ${this.stateObj.attributes.has_date?o.qy` <ha-date-input .locale="${this.hass.locale}" .value="${(0,h.rv)(this.stateObj)}" .disabled="${this.stateObj.state===d.Hh}" @value-changed="${this._dateChanged}"> </ha-date-input> `:""} ${this.stateObj.attributes.has_time?o.qy` <ha-time-input .value="${this.stateObj.state===d.HV?"":this.stateObj.attributes.has_date?this.stateObj.state.split(" ")[1]:this.stateObj.state}" .locale="${this.hass.locale}" .disabled="${this.stateObj.state===d.Hh}" @value-changed="${this._timeChanged}" @click="${this._stopEventPropagation}"></ha-time-input> `:""} `:o.s6}_stopEventPropagation(t){t.stopPropagation()}_timeChanged(t){(0,h.TB)(this.hass,this.stateObj.entity_id,t.detail.value,this.stateObj.attributes.has_date?this.stateObj.state.split(" ")[0]:void 0)}_dateChanged(t){(0,h.TB)(this.hass,this.stateObj.entity_id,this.stateObj.attributes.has_time?this.stateObj.state.split(" ")[1]:void 0,t.detail.value)}}u.styles=o.AH`:host{display:flex;align-items:center;justify-content:flex-end;--ha-input-padding-bottom:0;flex-wrap:wrap}ha-date-input{flex:1 1 160px}ha-date-input+ha-time-input{margin-left:var(--ha-space-1);margin-inline-start:var(--ha-space-1);margin-inline-end:initial}`,(0,s.Cg)([(0,l.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,s.Cg)([(0,l.MZ)({attribute:!1})],u.prototype,"stateObj",void 0),u=(0,s.Cg)([(0,l.EM)("more-info-input_datetime")],u),i()}catch(t){i(t)}})}};