Skip to content

Commit 430268e

Browse files
authored
Merge pull request #87 from marksie1988/dev
v1.3.1
2 parents cd89f8b + 0782315 commit 430268e

File tree

7 files changed

+414
-343
lines changed

7 files changed

+414
-343
lines changed

dist/atomic-calendar-revive-editor.js

Lines changed: 118 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,120 @@
1-
!customElements.get("ha-switch")&&customElements.get("paper-toggle-button")&&customElements.define("ha-switch",customElements.get("paper-toggle-button"));const e=Object.getPrototypeOf(customElements.get("hui-view")),t=e.prototype.html,o=e.prototype.css;var i=["_blank","_self","_parent","_top"];class a extends e{setConfig(e){this._config={...e}}static get properties(){return{hass:{},_config:{}}}get _name(){return this._config.name||""}get _showColors(){return this._config&&this._config.showColors||!0}get _showLocation(){return this._config&&this._config.showLocation||!0}get _showMonth(){return this._config&&this._config.showMonth||!1}get _showLoader(){return this._config&&this._config.showLoader||!0}get _showDate(){return this._config&&this._config.showDate||!1}get _showDescription(){return this._config&&this._config.showDescription||!1}get _showNoEventsForToday(){return this._config&&this._config.showNoEventsForToday||!1}get _sortByStartTime(){return this._config&&this._config.sortByStartTime||!1}get _disableEventLink(){return this._config&&this._config.disableEventLink||!1}get _disableLocationLink(){return this._config&&this._config.disableLocationLink||!1}get _linkTarget(){return this._config&&this._config.linkTarget||"_blank"}render(){return this.hass?t`
2-
<div class="card-config">
3-
<div>
4-
<span>Editor Version: ${"1.0.0-alpha"}</span>
5-
<paper-input
6-
label="Name"
7-
.value="${this._name}"
8-
.configValue="${"name"}"
9-
@value-changed="${this._valueChanged}"
10-
></paper-input>
1+
const e=(e,t,i,o)=>{o=o||{},i=null==i?{}:i;const s=new Event(t,{bubbles:void 0===o.bubbles||o.bubbles,cancelable:Boolean(o.cancelable),composed:void 0===o.composed||o.composed});return s.detail=i,e.dispatchEvent(s),s};!customElements.get("ha-switch")&&customElements.get("paper-toggle-button")&&customElements.define("ha-switch",customElements.get("paper-toggle-button"));const t=Object.getPrototypeOf(customElements.get("hui-view")),i=t.prototype.html,o=t.prototype.css;var s=["_blank","_self","_parent","_top"];class a extends t{setConfig(e){this._config={...e}}configChanged(e){const t=new Event("config-changed",{bubbles:!0,composed:!0});t.detail={config:e},this.dispatchEvent(t)}static get properties(){return{hass:{},_config:{}}}get _name(){return this._config.name||""}get _Entities(){return!this._config||this._config.entities}get _showColors(){return this._config&&this._config.showColors||!0}get _showLocation(){return this._config&&this._config.showLocation||!0}get _showMonth(){return this._config&&this._config.showMonth||!1}get _showWeekDay(){return this._config&&this._config.showWeekDay||!1}get _showLoader(){return this._config&&this._config.showLoader||!0}get _showDate(){return this._config&&this._config.showDate||!1}get _showDescription(){return this._config&&this._config.showDescription||!1}get _showNoEventsForToday(){return this._config&&this._config.showNoEventsForToday||!1}get _sortByStartTime(){return this._config&&this._config.sortByStartTime||!1}get _disableEventLink(){return this._config&&this._config.disableEventLink||!1}get _disableLocationLink(){return this._config&&this._config.disableLocationLink||!1}get _linkTarget(){return this._config&&this._config.linkTarget||"_blank"}render(){return this.hass?i`
2+
<div class="card-config">
3+
<div>
4+
<span style="color:red;font-weight:bold">Editor Version: ${"1.1.0-alpha"}</span>
5+
<paper-input
6+
label="Name"
7+
.value="${this._name}"
8+
.configValue="${"name"}"
9+
@value-changed="${this._valueChanged}"
10+
></paper-input>
11+
<h3>Entities (Required)</h3>
12+
<span>Entities can only be edited in the Code Editor, im working on it!</span>
1113
12-
<ha-switch
13-
aria-label=${`Toggle Colors ${this._showColors?"off":"on"}`}
14-
.checked=${!1!==this._showColors}
15-
.configValue=${"showColors"}
16-
@change=${this._valueChanged}
17-
>Show Colors</ha-switch
18-
>
19-
<ha-switch
20-
aria-label=${`Toggle Location ${this._showLocation?"off":"on"}`}
21-
.checked=${!1!==this._showLocation}
22-
.configValue=${"showLocation"}
23-
@change=${this._valueChanged}
24-
>Show Location</ha-switch
25-
>
26-
<ha-switch
27-
aria-label=${`Toggle Month ${this._showMonth?"on":"off"}`}
28-
.checked=${!1!==this._showMonth}
29-
.configValue=${"showMonth"}
30-
@change=${this._valueChanged}
31-
>Show Month</ha-switch
32-
>
33-
<ha-switch
34-
aria-label=${`Toggle Loader ${this._showLoader?"off":"on"}`}
35-
.checked=${!1!==this._showLoader}
36-
.configValue=${"showLoader"}
37-
@change=${this._valueChanged}
38-
>Show Loader</ha-switch
39-
>
40-
<ha-switch
41-
aria-label=${`Toggle Date ${this._showDate?"on":"off"}`}
42-
.checked=${!1!==this._showDate}
43-
.configValue=${"showDate"}
44-
@change=${this._valueChanged}
45-
>Show Date</ha-switch
46-
>
47-
<ha-switch
48-
aria-label=${`Toggle Description ${this._showDescription?"on":"off"}`}
49-
.checked=${!1!==this._showDescription}
50-
.configValue=${"showDescription"}
51-
@change=${this._valueChanged}
52-
>Show Description</ha-switch
53-
>
54-
<ha-switch
55-
aria-label=${`Toggle No Events Today ${this._showNoEventsForToday?"on":"off"}`}
56-
.checked=${!1!==this._showNoEventsForToday}
57-
.configValue=${"showNoEventsForToday"}
58-
@change=${this._valueChanged}
59-
>Show 'No Events Today'</ha-switch
60-
>
61-
<ha-switch
62-
aria-label=${`Toggle sort by start time ${this._sortByStartTime?"on":"off"}`}
63-
.checked=${!1!==this._sortByStartTime}
64-
.configValue=${"sortByStartTime"}
65-
@change=${this._valueChanged}
66-
>Sort by Start Time</ha-switch
67-
>
68-
<ha-switch
69-
aria-label=${`Toggle event link ${this._disableEventLink?"on":"off"}`}
70-
.checked=${!1!==this._disableEventLink}
71-
.configValue=${"disableEventLink"}
72-
@change=${this._valueChanged}
73-
>Disable Event Link URL</ha-switch
74-
>
75-
<ha-switch
76-
aria-label=${`Toggle location link ${this._disableLocationLink?"on":"off"}`}
77-
.checked=${!1!==this._disableLocationLink}
78-
.configValue=${"disableLocationLink"}
79-
@change=${this._valueChanged}
80-
>Disable Location Link URL</ha-switch
81-
>
82-
<div class="values">
83-
<paper-dropdown-menu
84-
label="Link Target"
85-
@value-changed=${this._valueChanged}
86-
.configValue=${"linkTarget"}
87-
>
88-
<paper-listbox slot="dropdown-content" .selected=${i.indexOf(this._linkTarget)}>
89-
${i.map(e=>t`
90-
<paper-item>${e}</paper-item>
91-
`)}
92-
</paper-listbox>
93-
</paper-dropdown-menu>
94-
</div>
95-
</div>
14+
<h3>Basic Settings</h3>
15+
<ha-switch
16+
aria-label=${`Toggle Loader ${this._showLoader?"off":"on"}`}
17+
.checked=${!1!==this._showLoader}
18+
.configValue=${"showLoader"}
19+
@change=${this._valueChanged}
20+
>Show Loader</ha-switch
21+
>
22+
<ha-switch
23+
aria-label=${`Toggle Date ${this._showDate?"on":"off"}`}
24+
.checked=${!1!==this._showDate}
25+
.configValue=${"showDate"}
26+
@change=${this._valueChanged}
27+
>Show Date</ha-switch
28+
>
29+
<ha-switch
30+
aria-label=${`Toggle Colors ${this._showColors?"off":"on"}`}
31+
.checked=${!1!==this._showColors}
32+
.configValue=${"showColors"}
33+
@change=${this._valueChanged}
34+
>Show Colors</ha-switch
35+
>
36+
37+
<h3>Event Mode</h3>
38+
<ha-switch
39+
aria-label=${`Toggle Month ${this._showMonth?"on":"off"}`}
40+
.checked=${!1!==this._showMonth}
41+
.configValue=${"showMonth"}
42+
@change=${this._valueChanged}
43+
>Show Month</ha-switch
44+
>
45+
<ha-switch
46+
aria-label=${`Toggle Week Day ${this._showWeekDay?"on":"off"}`}
47+
.checked=${!1!==this._showWeekDay}
48+
.configValue=${"showWeekDay"}
49+
@change=${this._valueChanged}
50+
>Show Week Day</ha-switch
51+
>
52+
<ha-switch
53+
aria-label=${`Toggle Location ${this._showLocation?"off":"on"}`}
54+
.checked=${!1!==this._showLocation}
55+
.configValue=${"showLocation"}
56+
@change=${this._valueChanged}
57+
>Show Location</ha-switch
58+
>
59+
<ha-switch
60+
aria-label=${`Toggle No Events Today ${this._showNoEventsForToday?"on":"off"}`}
61+
.checked=${!1!==this._showNoEventsForToday}
62+
.configValue=${"showNoEventsForToday"}
63+
@change=${this._valueChanged}
64+
>Show 'No Events Today'</ha-switch
65+
>
66+
<ha-switch
67+
aria-label=${`Toggle Description ${this._showDescription?"on":"off"}`}
68+
.checked=${!1!==this._showDescription}
69+
.configValue=${"showDescription"}
70+
@change=${this._valueChanged}
71+
>Show Description</ha-switch
72+
>
73+
<ha-switch
74+
aria-label=${`Toggle sort by start time ${this._sortByStartTime?"on":"off"}`}
75+
.checked=${!1!==this._sortByStartTime}
76+
.configValue=${"sortByStartTime"}
77+
@change=${this._valueChanged}
78+
>Sort by Start Time</ha-switch
79+
>
80+
<ha-switch
81+
aria-label=${`Toggle event link ${this._disableEventLink?"on":"off"}`}
82+
.checked=${!1!==this._disableEventLink}
83+
.configValue=${"disableEventLink"}
84+
@change=${this._valueChanged}
85+
>Disable Event Link URL</ha-switch
86+
>
87+
<ha-switch
88+
aria-label=${`Toggle location link ${this._disableLocationLink?"on":"off"}`}
89+
.checked=${!1!==this._disableLocationLink}
90+
.configValue=${"disableLocationLink"}
91+
@change=${this._valueChanged}
92+
>Disable Location Link URL</ha-switch
93+
>
94+
<div class="values">
95+
<paper-dropdown-menu
96+
label="Link Target"
97+
@value-changed=${this._valueChanged}
98+
.configValue=${"linkTarget"}
99+
>
100+
<paper-listbox slot="dropdown-content" .selected=${s.indexOf(this._linkTarget)}>
101+
${s.map(e=>i`
102+
<paper-item>${e}</paper-item>
103+
`)}
104+
</paper-listbox>
105+
</paper-dropdown-menu>
106+
</div>
96107
</div>
97-
`:t``}_valueChanged(e){if(!this._config||!this.hass)return;const t=e.target;this[`_${t.configValue}`]!==t.value&&(t.configValue&&(""===t.value?delete this._config[t.configValue]:this._config={...this._config,[t.configValue]:void 0!==t.checked?t.checked:t.value}),((e,t,o,i)=>{i=i||{},o=null==o?{}:o;const a=new Event(t,{bubbles:void 0===i.bubbles||i.bubbles,cancelable:Boolean(i.cancelable),composed:void 0===i.composed||i.composed});a.detail=o,e.dispatchEvent(a)})(this,"config-changed",{config:this._config}))}static get styles(){return o`
98-
ha-switch {
99-
padding-top: 16px;
100-
}
101-
.side-by-side {
102-
display: flex;
103-
}
104-
.side-by-side > * {
105-
flex: 1;
106-
padding-right: 4px;
107-
}
108-
`}}customElements.define("atomic-calendar-revive-editor",a);export{a as AtomicCalendarReviveEditor};
108+
</div>
109+
`:i``}_addEntity(t){const i=t.target;if(""===i.value)return;const o=this[`_${i.configValue}`].concat({entity:i.value});i.value="",e(this,"entities-changed",{entities:o})}_valueChanged(t){if(!this._config||!this.hass)return;const i=t.target;this[`_${i.configValue}`]!==i.value&&(i.configValue&&(""===i.value?delete this._config[i.configValue]:this._config={...this._config,[i.configValue]:void 0!==i.checked?i.checked:i.value}),e(this,"config-changed",{config:this._config}))}static get styles(){return o`
110+
ha-switch {
111+
padding-top: 16px;
112+
}
113+
.side-by-side {
114+
display: flex;
115+
}
116+
.side-by-side > * {
117+
flex: 1;
118+
padding-right: 4px;
119+
}
120+
`}}customElements.define("atomic-calendar-revive-editor",a);export{a as AtomicCalendarReviveEditor};

0 commit comments

Comments
 (0)