Skip to content
This repository was archived by the owner on Sep 18, 2020. It is now read-only.

Commit 8450df1

Browse files
committed
added hardLimit option
1 parent 2775700 commit 8450df1

6 files changed

Lines changed: 36 additions & 10 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ resources:
6060
| highlightToday | boolean | **Optional** | `false` Hightlight's today's events
6161
| hidePastEvents | boolean | **Optional** | `false` Hide events that have passed
6262
| eventsLimit | integer | **Optional** | `99` Maximum number of events to show (shows rest of day after cut off)
63+
| hardLimit | boolean | **Optional** | `false` Overrides `eventsLimit` default of showing rest of day's events even after cutoff
6364
| maxHeight | boolean | **Optional** | `false` Sets max height for card to 500px and overflows the rest
6465
| fullDayEventText | string | **Optional** | `All day` Set custom text for a full day event
6566
| startText | string | **Optional** | `Start` Set custom text for event start time

dist/calendar-card.js

Lines changed: 14 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/calendar-card.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default {
1919
ignoreEventsExpression: '',
2020
ignoreEventsByLocationExpression: '',
2121
maxHeight: false,
22+
hardLimit: false,
2223
fullDayEventText: 'All day',
2324
startText: 'Start',
2425
endText: 'End',

src/event.tools.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ export function groupEventsByDay(events, config) {
3737

3838
// did we max the number of events we want to show during this day?
3939
hasMaxedOutEvents = config.eventsLimit < numberOfEvents;
40+
41+
// if we maxed out events by default we show the rest of the curent day's events
42+
// even if they go over max - but if this config is true then dont goover max no matter what
43+
if (config.hardLimit){
44+
const numberOfEventsOver = numberOfEvents - config.eventsLimit;
45+
group.events = group.events.slice(0, group.events.length - numberOfEventsOver);
46+
}
47+
4048
return group;
4149
}).filter(Boolean); // filter out empty days that we may have maxed out on
4250

src/index-editor.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,17 @@ export default class CalendarCardEditor extends LitElement {
126126
<div class='checkbox-options'>
127127
<paper-checkbox
128128
@checked-changed="${this.checkboxChanged}"
129-
.checked=${this._config.maxHeight}
130-
.configValue="${"maxHeight"}"
131-
>Max Height</paper-checkbox>
129+
.checked=${this._config.showEventOrigin}
130+
.configValue="${"showEventOrigin"}"
131+
>Show Event Origin</paper-checkbox>
132+
</div>
133+
134+
<div class='checkbox-options'>
135+
<paper-checkbox
136+
@checked-changed="${this.checkboxChanged}"
137+
.checked=${this._config.hardLimit}
138+
.configValue="${"hardLimit"}"
139+
>Hard Limit</paper-checkbox>
132140
</div>
133141
134142
<div class='other-options'>

0 commit comments

Comments
 (0)