UNPKG

iobroker.lovelace

Version:

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

384 lines (342 loc) 32.5 kB
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[7529],{42657:(e,t,r)=>{"use strict";r(53918),r(25230);var i=r(50424),n=r(55358),o=r(92483),a=r(47181);r(52039);function s(){s=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var n=t.placement;if(t.kind===i&&("static"===n||"prototype"===n)){var o="static"===n?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],n={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,n)}),this),e.forEach((function(e){if(!d(e))return r.push(e);var t=this.decorateElement(e,n);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var o=this.decorateConstructor(r,t);return i.push.apply(i,o.finishers),o.finishers=i,o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],n=e.decorators,o=n.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,n[o])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var d=0;d<c.length;d++)this.addElementPlacement(c[d],t);r.push.apply(r,c)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){for(var r=[],i=t.length-1;i>=0;i--){var n=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[i])(n)||n);if(void 0!==o.finisher&&r.push(o.finisher),void 0!==o.elements){e=o.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].key+")")}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){var t;if(void 0!==e)return(t=e,function(e){if(Array.isArray(e))return e}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var r=f(e.key),i=String(e.placement);if("static"!==i&&"prototype"!==i&&"own"!==i)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+i+'"');var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},n)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(n,"get","The property descriptor of a field descriptor"),this.disallowProperty(n,"set","The property descriptor of a field descriptor"),this.disallowProperty(n,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:u(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var r=u(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);if(void 0!==i){if("function"!=typeof i)throw new TypeError("Finishers must return a constructor.");e=i}}return e},disallowProperty:function(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function l(e){var t,r=f(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var i={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(i.decorators=e.decorators),"field"===e.kind&&(i.initializer=e.value),i}function c(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function d(e){return e.decorators&&e.decorators.length}function h(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function u(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function f(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}!function(e,t,r,i){var n=s();if(i)for(var o=0;o<i.length;o++)n=i[o](n);var a=t((function(e){n.initializeInstanceElements(e,u.elements)}),r),u=n.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},i=0;i<e.length;i++){var n,o=e[i];if("method"===o.kind&&(n=t.find(r)))if(h(o.descriptor)||h(n.descriptor)){if(d(o)||d(n))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");n.descriptor=o.descriptor}else{if(d(o)){if(d(n))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");n.decorators=o.decorators}c(o,n)}else t.push(o)}return t}(a.d.map(l)),e);n.initializeClassElements(a.F,u.elements),n.runClassFinishers(a.F,u.finishers)}([(0,n.Mo)("ha-button-toggle-group")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"buttons",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"active",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"fullWidth",value:()=>!1},{kind:"method",key:"render",value:function(){return i.dy` <div> ${this.buttons.map((e=>e.iconPath?i.dy`<mwc-icon-button .label=${e.label} .value=${e.value} ?active=${this.active===e.value} @click=${this._handleClick} > <ha-svg-icon .path=${e.iconPath}></ha-svg-icon> </mwc-icon-button>`:i.dy`<mwc-button style=${(0,o.V)({width:this.fullWidth?100/this.buttons.length+"%":"initial"})} .value=${e.value} ?active=${this.active===e.value} @click=${this._handleClick} >${e.label}</mwc-button >`))} </div> `}},{kind:"method",key:"_handleClick",value:function(e){this.active=e.currentTarget.value,(0,a.B)(this,"value-changed",{value:this.active})}},{kind:"get",static:!0,key:"styles",value:function(){return i.iv` div { display: flex; --mdc-icon-button-size: var(--button-toggle-size, 36px); --mdc-icon-size: var(--button-toggle-icon-size, 20px); } mwc-icon-button, mwc-button { border: 1px solid var(--primary-color); border-right-width: 0px; position: relative; cursor: pointer; } mwc-icon-button::before, mwc-button::before { top: 0; left: 0; width: 100%; height: 100%; position: absolute; background-color: currentColor; opacity: 0; pointer-events: none; content: ""; transition: opacity 15ms linear, background-color 15ms linear; } mwc-icon-button[active]::before, mwc-button[active]::before { opacity: var(--mdc-icon-button-ripple-opacity, 0.12); } mwc-icon-button:first-child, mwc-button:first-child { border-radius: 4px 0 0 4px; } mwc-icon-button:last-child, mwc-button:last-child { border-radius: 0 4px 4px 0; border-right-width: 1px; } mwc-icon-button:only-child, mwc-button:only-child { border-radius: 4px; border-right-width: 1px; } `}}]}}),i.oi)},51144:(e,t,r)=>{"use strict";r.d(t,{G:()=>a,t:()=>l});var i=r(49706);if(2143==r.j)var n=r(58831);if(2143==r.j)var o=r(91741);const a=async(e,t,r,i)=>{const n=encodeURI(`?start=${t.toISOString()}&end=${r.toISOString()}`),o=[],a=[];i.forEach((t=>{a.push(e.callApi("GET",`calendars/${t.entity_id}${n}`))}));return(await Promise.all(a)).forEach(((e,t)=>{const r=i[t];e.forEach((e=>{const t=s(e.start);if(!t)return;const i={start:t,end:s(e.end),title:e.summary,summary:e.summary,backgroundColor:r.backgroundColor,borderColor:r.backgroundColor,calendar:r.entity_id};o.push(i)}))})),o},s=e=>"string"==typeof e?e:e.dateTime?e.dateTime:e.date?e.date:void 0,l=e=>Object.keys(e.states).filter((e=>"calendar"===(0,n.M)(e))).sort().map(((t,r)=>({entity_id:t,name:(0,o.C)(e.states[t]),backgroundColor:`#${i.AZ[r%i.AZ.length]}`})))},2471:(e,t,r)=>{"use strict";var i=r(43924),n=r(98868),o=r(78541),a=r(82387),s=r(61716),l=r(13692),c=r(53842),d=r(7623),h=(r(53918),r(68546)),u=r(50424),f=r(55358),p=r(14516),m=r(47181),v=(r(42657),r(10983),r(11654));function y(){y=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var n=t.placement;if(t.kind===i&&("static"===n||"prototype"===n)){var o="static"===n?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],n={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,n)}),this),e.forEach((function(e){if(!w(e))return r.push(e);var t=this.decorateElement(e,n);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var o=this.decorateConstructor(r,t);return i.push.apply(i,o.finishers),o.finishers=i,o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],n=e.decorators,o=n.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,n[o])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var d=0;d<c.length;d++)this.addElementPlacement(c[d],t);r.push.apply(r,c)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){for(var r=[],i=t.length-1;i>=0;i--){var n=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[i])(n)||n);if(void 0!==o.finisher&&r.push(o.finisher),void 0!==o.elements){e=o.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].key+")")}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){var t;if(void 0!==e)return(t=e,function(e){if(Array.isArray(e))return e}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return C(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?C(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var r=x(e.key),i=String(e.placement);if("static"!==i&&"prototype"!==i&&"own"!==i)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+i+'"');var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},n)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(n,"get","The property descriptor of a field descriptor"),this.disallowProperty(n,"set","The property descriptor of a field descriptor"),this.disallowProperty(n,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:E(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var r=E(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);if(void 0!==i){if("function"!=typeof i)throw new TypeError("Finishers must return a constructor.");e=i}}return e},disallowProperty:function(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function b(e){var t,r=x(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var i={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(i.decorators=e.decorators),"field"===e.kind&&(i.initializer=e.value),i}function g(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function w(e){return e.decorators&&e.decorators.length}function k(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function E(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function x(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function P(e,t,r){return(P="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=D(e)););return e}(e,t);if(i){var n=Object.getOwnPropertyDescriptor(i,t);return n.get?n.get.call(r):n.value}})(e,t,r||e)}function D(e){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}const _={headerToolbar:!1,plugins:[a.ZP,c.Z,l.ZP],initialView:"dayGridMonth",dayMaxEventRows:!0,height:"parent",eventDisplay:"list-item",locales:o.Z,views:{list:{visibleRange:e=>{const t=new Date(e.valueOf()),r=new Date(e.valueOf());return r.setDate(r.getDate()+7),{start:t,end:r}}}}},$=[{label:"Month View",value:"dayGridMonth",iconPath:h.SI1},{label:"Week View",value:"dayGridWeek",iconPath:h.KXE},{label:"Day View",value:"dayGridDay",iconPath:h.r3U},{label:"List View",value:"list",iconPath:h.uay}];let S=function(e,t,r,i){var n=y();if(i)for(var o=0;o<i.length;o++)n=i[o](n);var a=t((function(e){n.initializeInstanceElements(e,s.elements)}),r),s=n.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},i=0;i<e.length;i++){var n,o=e[i];if("method"===o.kind&&(n=t.find(r)))if(k(o.descriptor)||k(n.descriptor)){if(w(o)||w(n))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");n.descriptor=o.descriptor}else{if(w(o)){if(w(n))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");n.decorators=o.decorators}g(o,n)}else t.push(o)}return t}(a.d.map(b)),e);return n.initializeClassElements(a.F,s.elements),n.runClassFinishers(a.F,s.finishers)}(null,(function(e,t){class r extends t{constructor(...t){super(...t),e(this)}}return{F:r,d:[{kind:"field",key:"hass",value:void 0},{kind:"field",decorators:[(0,f.Cb)({type:Boolean,reflect:!0})],key:"narrow",value:()=>!1},{kind:"field",decorators:[(0,f.Cb)({attribute:!1})],key:"events",value:()=>[]},{kind:"field",decorators:[(0,f.Cb)({attribute:!1})],key:"views",value:()=>["dayGridMonth","dayGridWeek","dayGridDay"]},{kind:"field",decorators:[(0,f.Cb)()],key:"initialView",value:()=>"dayGridMonth"},{kind:"field",key:"calendar",value:void 0},{kind:"field",decorators:[(0,f.SB)()],key:"_activeView",value(){return this.initialView}},{kind:"method",key:"updateSize",value:function(){var e;null===(e=this.calendar)||void 0===e||e.updateSize()}},{kind:"method",key:"render",value:function(){const e=this._viewToggleButtons(this.views);return u.dy` ${this.calendar?u.dy` <div class="header"> ${this.narrow?u.dy` <div class="controls"> <h1>${this.calendar.view.title}</h1> <div> <ha-icon-button label=${this.hass.localize("ui.common.previous")} icon="hass:chevron-left" class="prev" @click=${this._handlePrev} > </ha-icon-button> <ha-icon-button label=${this.hass.localize("ui.common.next")} icon="hass:chevron-right" class="next" @click=${this._handleNext} > </ha-icon-button> </div> </div> <div class="controls"> <mwc-button outlined class="today" @click=${this._handleToday} >${this.hass.localize("ui.components.calendar.today")}</mwc-button > <ha-button-toggle-group .buttons=${e} .active=${this._activeView} @value-changed=${this._handleView} ></ha-button-toggle-group> </div> `:u.dy` <div class="navigation"> <mwc-button outlined class="today" @click=${this._handleToday} >${this.hass.localize("ui.components.calendar.today")}</mwc-button > <ha-icon-button label=${this.hass.localize("ui.common.previous")} icon="hass:chevron-left" class="prev" @click=${this._handlePrev} > </ha-icon-button> <ha-icon-button label=${this.hass.localize("ui.common.next")} icon="hass:chevron-right" class="next" @click=${this._handleNext} > </ha-icon-button> </div> <h1>${this.calendar.view.title}</h1> <ha-button-toggle-group .buttons=${e} .active=${this._activeView} @value-changed=${this._handleView} ></ha-button-toggle-group> `} </div> `:""} <div id="calendar"></div> `}},{kind:"method",key:"willUpdate",value:function(e){if(P(D(r.prototype),"willUpdate",this).call(this,e),!this.calendar)return;e.has("events")&&(this.calendar.removeAllEventSources(),this.calendar.addEventSource(this.events)),e.has("views")&&!this.views.includes(this._activeView)&&(this._activeView=this.initialView&&this.views.includes(this.initialView)?this.initialView:this.views[0],this.calendar.changeView(this._activeView),this._fireViewChanged());const t=e.get("hass");t&&t.language!==this.hass.language&&this.calendar.setOption("locale",this.hass.language)}},{kind:"method",key:"firstUpdated",value:function(){const e={..._,locale:this.hass.language,initialView:this.initialView};e.dateClick=e=>this._handleDateClick(e),e.eventClick=e=>this._handleEventClick(e),this.calendar=new n.faS(this.shadowRoot.getElementById("calendar"),e),this.calendar.render(),this._fireViewChanged()}},{kind:"method",key:"_handleEventClick",value:function(e){"dayGridMonth"===e.view.type&&(this._activeView="dayGridDay",this.calendar.changeView("dayGridDay"),this.calendar.gotoDate(e.event.startStr))}},{kind:"method",key:"_handleDateClick",value:function(e){"dayGridMonth"===e.view.type&&(this._activeView="dayGridDay",this.calendar.changeView("dayGridDay"),this.calendar.gotoDate(e.dateStr))}},{kind:"method",key:"_handleNext",value:function(){this.calendar.next(),this._fireViewChanged()}},{kind:"method",key:"_handlePrev",value:function(){this.calendar.prev(),this._fireViewChanged()}},{kind:"method",key:"_handleToday",value:function(){this.calendar.today(),this._fireViewChanged()}},{kind:"method",key:"_handleView",value:function(e){this._activeView=e.detail.value,this.calendar.changeView(this._activeView),this._fireViewChanged()}},{kind:"method",key:"_fireViewChanged",value:function(){(0,m.B)(this,"view-changed",{start:this.calendar.view.activeStart,end:this.calendar.view.activeEnd,view:this.calendar.view.type})}},{kind:"field",key:"_viewToggleButtons",value:()=>(0,p.Z)((e=>$.filter((t=>e.includes(t.value)))))},{kind:"get",static:!0,key:"styles",value:function(){return[v.Qx,u.iv` ${(0,u.$m)(i.Z)} ${(0,u.$m)(s.Z)} ${(0,u.$m)(d.Z)} :host { display: flex; flex-direction: column; --fc-theme-standard-border-color: var(--divider-color); } .header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 8px; } :host([narrow]) .header { padding-right: 8px; padding-left: 8px; flex-direction: column; align-items: flex-start; justify-content: initial; } .navigation { display: flex; align-items: center; flex-grow: 0; } a { color: var(--primary-text-color); } .controls { display: flex; justify-content: space-between; align-items: center; width: 100%; } .today { margin-right: 20px; } .prev, .next { --mdc-icon-button-size: 32px; } ha-button-toggle-group { color: var(--primary-color); } #calendar { flex-grow: 1; background-color: var( --ha-card-background, var(--card-background-color, white) ); min-height: 400px; --fc-neutral-bg-color: var( --ha-card-background, var(--card-background-color, white) ); --fc-list-event-hover-bg-color: var( --ha-card-background, var(--card-background-color, white) ); --fc-theme-standard-border-color: var(--divider-color); --fc-border-color: var(--divider-color); } a { color: inherit !important; } .fc-theme-standard .fc-scrollgrid { border: 1px solid var(--divider-color); } .fc-scrollgrid-section-header td { border: none; } th.fc-col-header-cell.fc-day { color: var(--secondary-text-color); font-size: 11px; font-weight: 400; text-transform: uppercase; } .fc-daygrid-dot-event:hover { background-color: inherit; } .fc-daygrid-day-top { text-align: center; padding-top: 5px; justify-content: center; } table.fc-scrollgrid-sync-table tbody tr:first-child .fc-daygrid-day-top { padding-top: 0; } a.fc-daygrid-day-number { float: none !important; font-size: 12px; } .fc .fc-daygrid-day-number { padding: 3px !important; } .fc .fc-daygrid-day.fc-day-today { background: inherit; } td.fc-day-today .fc-daygrid-day-top { padding-top: 4px; } td.fc-day-today .fc-daygrid-day-number { height: 24px; color: var(--text-primary-color) !important; background-color: var(--primary-color); border-radius: 50%; display: inline-block; text-align: center; white-space: nowrap; width: max-content; min-width: 24px; line-height: 140%; } .fc-daygrid-day-events { margin-top: 4px; } .fc-event { border-radius: 4px; line-height: 1.7; } .fc-daygrid-block-event .fc-event-main { padding: 0 1px; } .fc-day-past .fc-daygrid-day-events { opacity: 0.5; } .fc-icon-x:before { font-family: var(--material-font-family); content: "X"; } .fc-popover { background-color: var(--primary-background-color) !important; } .fc-popover-header { background-color: var(--secondary-background-color) !important; } .fc-theme-standard .fc-list-day-frame { background-color: transparent; } .fc-list.fc-view, .fc-list-event.fc-event td { border: none; } .fc-list-day.fc-day th { border-bottom: none; border-top: 1px solid var(--fc-theme-standard-border-color, #ddd) !important; } .fc-list-day-text { font-size: 16px; font-weight: 400; } .fc-list-day-side-text { font-weight: 400; font-size: 16px; color: var(--primary-color); } .fc-list-table td, .fc-list-day-frame { padding-top: 12px; padding-bottom: 12px; } :host([narrow]) .fc-dayGridMonth-view .fc-daygrid-dot-event .fc-event-time, :host([narrow]) .fc-dayGridMonth-view .fc-daygrid-dot-event .fc-event-title, :host([narrow]) .fc-dayGridMonth-view .fc-daygrid-day-bottom { display: none; } :host([narrow]) .fc .fc-dayGridMonth-view .fc-daygrid-event-harness-abs { visibility: visible !important; position: static; } :host([narrow]) .fc-dayGridMonth-view .fc-daygrid-day-events { display: flex; min-height: 2em !important; justify-content: center; flex-wrap: wrap; max-height: 2em; height: 2em; overflow: hidden; } :host([narrow]) .fc-dayGridMonth-view .fc-scrollgrid-sync-table { overflow: hidden; } .fc-scroller::-webkit-scrollbar { width: 0.4rem; height: 0.4rem; } .fc-scroller::-webkit-scrollbar-thumb { -webkit-border-radius: 4px; border-radius: 4px; background: var(--scrollbar-thumb-color); } .fc-scroller { overflow-y: auto; scrollbar-color: var(--scrollbar-thumb-color) transparent; scrollbar-width: thin; } `]}}]}}),u.oi);window.customElements.define("ha-full-calendar",S)}}]); //# sourceMappingURL=chunk.434b208cb5975935faf6.js.map