UNPKG

iobroker.lovelace

Version:

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

10 lines 16.2 kB
export const __rspack_esm_id=95366;export const __rspack_esm_ids=[95366];export const __webpack_modules__={32656(e,t,a){a.a(e,async function(e,t){try{a(74423);var i=a(62826),o=a(5124),s=a(22441),l=a(63672),r=a(1087),n=a(57237),d=a(26300),h=(a(3449),a(606)),p=a(91485),u=e([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 o.WF{reportValidity(){const e=this._inputs;return!e||[...e].every(e=>e.reportValidity())}render(){return o.qy` ${this.label?o.qy`<label>${this.label}${this.required?" *":""}</label>`:o.s6} <div class="time-input-wrap-wrap"> <div class="time-input-wrap"> ${this.enableDay?o.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> `:o.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?o.qy`<div class="time-separator">:</div>`:o.s6} ${this.enableSecond?o.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?o.qy`<div class="time-separator">:</div>`:o.s6}`:o.s6} ${this.enableMillisecond?o.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>`:o.s6} ${24===this.format?o.s6:o.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?o.s6:o.qy`<ha-icon-button label="clear" @click="${this._clearValue}" .path="${c}"></ha-icon-button>`} </div> </div> ${this.helper?o.qy`<ha-input-helper-text .disabled="${this.disabled}">${this.helper}</ha-input-helper-text>`:o.s6} `}_clearValue(){(0,r.r)(this,"value-changed")}_valueChanged(e){const t=e.currentTarget;this[t.name||""]="amPm"===t.name?e.detail.value:Number(t.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(e){e.currentTarget.select()}_formatValue(e,t=2){const a=e.toString();return a.includes(".")?a:a.padStart(t,"0")}get _hourMax(){if(!this.noHoursLimit)return 12===this.format?12:23}constructor(...e){super(...e),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={...o.WF.shadowRootOptions,delegatesFocus:!0},b.styles=o.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,s.MZ)()],b.prototype,"label",void 0),(0,i.Cg)([(0,s.MZ)()],b.prototype,"helper",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"auto-validate",type:Boolean})],b.prototype,"autoValidate",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],b.prototype,"required",void 0),(0,i.Cg)([(0,s.MZ)({type:Number})],b.prototype,"format",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],b.prototype,"disabled",void 0),(0,i.Cg)([(0,s.MZ)({type:Number})],b.prototype,"days",void 0),(0,i.Cg)([(0,s.MZ)({type:Number})],b.prototype,"hours",void 0),(0,i.Cg)([(0,s.MZ)({type:Number})],b.prototype,"minutes",void 0),(0,i.Cg)([(0,s.MZ)({type:Number})],b.prototype,"seconds",void 0),(0,i.Cg)([(0,s.MZ)({type:Number})],b.prototype,"milliseconds",void 0),(0,i.Cg)([(0,s.MZ)({type:String,attribute:"day-label"})],b.prototype,"dayLabel",void 0),(0,i.Cg)([(0,s.MZ)({type:String,attribute:"hour-label"})],b.prototype,"hourLabel",void 0),(0,i.Cg)([(0,s.MZ)({type:String,attribute:"min-label"})],b.prototype,"minLabel",void 0),(0,i.Cg)([(0,s.MZ)({type:String,attribute:"sec-label"})],b.prototype,"secLabel",void 0),(0,i.Cg)([(0,s.MZ)({type:String,attribute:"ms-label"})],b.prototype,"millisecLabel",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"enable-second",type:Boolean})],b.prototype,"enableSecond",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"enable-millisecond",type:Boolean})],b.prototype,"enableMillisecond",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"enable-day",type:Boolean})],b.prototype,"enableDay",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"no-hours-limit",type:Boolean})],b.prototype,"noHoursLimit",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],b.prototype,"amPm",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],b.prototype,"clearable",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"placeholder-labels",type:Boolean})],b.prototype,"placeholderLabels",void 0),(0,i.Cg)([(0,s.YG)("ha-input")],b.prototype,"_inputs",void 0),b=(0,i.Cg)([(0,s.EM)("ha-base-time-input")],b),t()}catch(e){t(e)}})},19463(e,t,a){a.a(e,async function(e,t){try{a(74423);var i=a(62826),o=a(5124),s=a(22441),l=a(380),r=a(72487),n=a(1087),d=a(46927),h=(a(67094),a(91485)),p=e([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=(e,t)=>{(0,n.r)(e,"show-dialog",{dialogTag:"ha-dialog-date-picker",dialogImport:c,dialogParams:t})};class m 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,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:e=>this._valueChanged(e),locale:this.locale.language,firstWeekday:(0,l.P)(this.locale)})}_keyDown(e){if(["Space","Enter"].includes(e.code))return e.preventDefault(),e.stopPropagation(),void this._openDialog();this.canClear&&["Backspace","Delete"].includes(e.key)&&this._valueChanged(void 0)}_valueChanged(e){this.value!==e&&(this.value=e,(0,n.r)(this,"change"),(0,n.r)(this,"value-changed",{value:e}))}constructor(...e){super(...e),this.disabled=!1,this.required=!1,this.canClear=!1}}m.styles=o.AH`:host{min-width:0px}ha-svg-icon{color:var(--secondary-text-color)}`,(0,i.Cg)([(0,s.MZ)({attribute:!1})],m.prototype,"locale",void 0),(0,i.Cg)([(0,s.MZ)()],m.prototype,"value",void 0),(0,i.Cg)([(0,s.MZ)()],m.prototype,"min",void 0),(0,i.Cg)([(0,s.MZ)()],m.prototype,"max",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],m.prototype,"disabled",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],m.prototype,"required",void 0),(0,i.Cg)([(0,s.MZ)()],m.prototype,"label",void 0),(0,i.Cg)([(0,s.MZ)()],m.prototype,"helper",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"can-clear",type:Boolean})],m.prototype,"canClear",void 0),(0,i.Cg)([(0,s.P)("ha-input",!0)],m.prototype,"_input",void 0),m=(0,i.Cg)([(0,s.EM)("ha-date-input")],m),t()}catch(e){t(e)}})},39045(e,t,a){a.a(e,async function(e,i){try{a.r(t),a.d(t,{HaDateTimeSelector:()=>p});var o=a(62826),s=a(5124),l=a(22441),r=a(1087),n=a(19463),d=a(50286),h=(a(3449),e([n,d]));[n,d]=h.then?(await h)():h;class p extends s.WF{reportValidity(){return this._dateInput.reportValidity()&&this._timeInput.reportValidity()}render(){const e="string"==typeof this.value?this.value.split(" "):void 0;return s.qy` <div class="input"> <ha-date-input .label="${this.label}" .locale="${this.hass.locale}" .disabled="${this.disabled}" .required="${this.required}" .value="${e?.[0]}" @value-changed="${this._valueChanged}"> </ha-date-input> <ha-time-input enable-second .value="${e?.[1]||"00:00:00"}" .locale="${this.hass.locale}" .disabled="${this.disabled}" .required="${this.required}" @value-changed="${this._valueChanged}"></ha-time-input> </div> ${this.helper?s.qy`<ha-input-helper-text .disabled="${this.disabled}">${this.helper}</ha-input-helper-text>`:""} `}_valueChanged(e){e.stopPropagation(),this._dateInput.value&&this._timeInput.value&&(0,r.r)(this,"value-changed",{value:`${this._dateInput.value} ${this._timeInput.value}`})}constructor(...e){super(...e),this.disabled=!1,this.required=!0}}p.styles=s.AH`.input{display:flex;align-items:center;flex-direction:row}ha-date-input{min-width:150px;margin-right:4px;margin-inline-end:4px;margin-inline-start:initial}`,(0,o.Cg)([(0,l.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,o.Cg)([(0,l.MZ)({attribute:!1})],p.prototype,"selector",void 0),(0,o.Cg)([(0,l.MZ)()],p.prototype,"value",void 0),(0,o.Cg)([(0,l.MZ)()],p.prototype,"label",void 0),(0,o.Cg)([(0,l.MZ)()],p.prototype,"helper",void 0),(0,o.Cg)([(0,l.MZ)({type:Boolean,reflect:!0})],p.prototype,"disabled",void 0),(0,o.Cg)([(0,l.MZ)({type:Boolean})],p.prototype,"required",void 0),(0,o.Cg)([(0,l.P)("ha-date-input")],p.prototype,"_dateInput",void 0),(0,o.Cg)([(0,l.P)("ha-time-input")],p.prototype,"_timeInput",void 0),p=(0,o.Cg)([(0,l.EM)("ha-selector-datetime")],p),i()}catch(e){i(e)}})},50286(e,t,a){a.a(e,async function(e,t){try{var i=a(62826),o=a(5124),s=a(22441),l=a(69543),r=a(1087),n=a(32656),d=e([n]);n=(d.then?(await d)():d)[0];class h extends o.WF{reportValidity(){return this._input?.reportValidity()??!0}render(){const e=(0,l.J)(this.locale);let t=NaN,a=NaN,i=NaN,s=0;if(this.value){const o=this.value?.split(":")||[];a=o[1]?Number(o[1]):0,i=o[2]?Number(o[2]):0,t=o[0]?Number(o[0]):0,s=t,s&&e&&s>12&&s<24&&(t=s-12),e&&0===s&&(t=12)}return o.qy` <ha-base-time-input .label="${this.label}" .hours="${t}" .minutes="${a}" .seconds="${i}" .format="${e?12:24}" .amPm="${e&&s>=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(e){e.stopPropagation();const t=e.detail.value,a=(0,l.J)(this.locale);let i,o=0;if(!(void 0===t||isNaN(t.hours)&&isNaN(t.minutes)&&isNaN(t.seconds))){let e=t.hours||0;t&&a&&(o=e>=12&&e<24?e-12:0===e?12:0,"PM"===t.amPm&&e<12&&(e+=12),"AM"===t.amPm&&12===e&&(e=0)),i=`${e.toString().padStart(2,"0")}:${t.minutes?t.minutes.toString().padStart(2,"0"):"00"}:${t.seconds?t.seconds.toString().padStart(2,"0"):"00"}`}o&&this.updateComplete.then(()=>{const e=this._input;e&&(e.hours=o)}),i!==this.value&&(this.value=i,(0,r.r)(this,"change"),(0,r.r)(this,"value-changed",{value:i}))}constructor(...e){super(...e),this.disabled=!1,this.required=!1,this.autoValidate=!1,this.enableSecond=!1,this.placeholderLabels=!1}}(0,i.Cg)([(0,s.MZ)({attribute:!1})],h.prototype,"locale",void 0),(0,i.Cg)([(0,s.MZ)()],h.prototype,"value",void 0),(0,i.Cg)([(0,s.MZ)()],h.prototype,"label",void 0),(0,i.Cg)([(0,s.MZ)()],h.prototype,"helper",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],h.prototype,"disabled",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],h.prototype,"required",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"auto-validate",type:Boolean})],h.prototype,"autoValidate",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,attribute:"enable-second"})],h.prototype,"enableSecond",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],h.prototype,"clearable",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"placeholder-labels",type:Boolean})],h.prototype,"placeholderLabels",void 0),(0,i.Cg)([(0,s.P)("ha-base-time-input")],h.prototype,"_input",void 0),h=(0,i.Cg)([(0,s.EM)("ha-time-input")],h),t()}catch(e){t(e)}})}};