Skip to content

Commit e921a93

Browse files
oyejorgevkurko
authored andcommitted
v4.4.0
Added eventFilter option
1 parent 05434a2 commit e921a93

File tree

17 files changed

+216
-28
lines changed

17 files changed

+216
-28
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# Event Calendar changelog
1+
# EventCalendar changelog
2+
3+
## 4.4.0
4+
June 5, 2025
5+
* Added `eventFilter` option ([500](https://github.com/vkurko/calendar/pull/500))
26

37
## 4.3.1
48
June 3, 2025

README.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Inspired by [FullCalendar](https://fullcalendar.io/), it implements similar opti
5454
</td><td>
5555

5656
- [eventDurationEditable](#eventdurationeditable)
57+
- [eventFilter](#eventfilter)
5758
- [eventLongPressDelay](#eventlongpressdelay)
5859
- [eventMouseEnter](#eventmouseenter)
5960
- [eventMouseLeave](#eventmouseleave)
@@ -227,8 +228,8 @@ This bundle contains a version of the calendar that includes all plugins and is
227228

228229
The first step is to include the following lines of code in the `<head>` section of your page:
229230
```html
230-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.3.1/dist/event-calendar.min.css">
231-
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.3.1/dist/event-calendar.min.js"></script>
231+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.4.0/dist/event-calendar.min.css">
232+
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.4.0/dist/event-calendar.min.js"></script>
232233
```
233234

234235
<details>
@@ -1115,6 +1116,58 @@ The current [View](#view-object) object
11151116

11161117
Determines whether calendar events can be resized.
11171118

1119+
### eventFilter
1120+
- Type `function`
1121+
- Default `undefined`
1122+
1123+
A function for filtering the array of events before displaying them in the calendar. It allows, for example, to display only specific events for each view.
1124+
1125+
```js
1126+
function (info) {
1127+
// return true to keep the event, false to exclude it
1128+
}
1129+
```
1130+
`info` is an object with the following properties:
1131+
<table>
1132+
<tr>
1133+
<td>
1134+
1135+
`event`
1136+
</td>
1137+
<td>
1138+
1139+
The current [Event](#event-object) object being processed in the array
1140+
</td>
1141+
</tr>
1142+
<tr>
1143+
<td>
1144+
1145+
`index`
1146+
</td>
1147+
<td>The index of the current event being processed in the array</td>
1148+
</tr>
1149+
<tr>
1150+
<td>
1151+
1152+
`events`
1153+
</td>
1154+
<td>
1155+
1156+
The array of all events `eventFilter` was called upon
1157+
</td>
1158+
</tr>
1159+
<tr>
1160+
<td>
1161+
1162+
`view`
1163+
</td>
1164+
<td>
1165+
1166+
The current [View](#view-object) object
1167+
</td>
1168+
</tr>
1169+
</table>
1170+
11181171
### eventLongPressDelay
11191172
- Type `integer`
11201173
- Default `undefined`

docs/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<link rel="manifest" href="site.webmanifest">
1313
<link rel="stylesheet" href="global.css?20231021">
1414

15-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.3.1/dist/event-calendar.min.css">
16-
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.3.1/dist/event-calendar.min.js"></script>
15+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.4.0/dist/event-calendar.min.css">
16+
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.4.0/dist/event-calendar.min.js"></script>
1717

1818
<style>
1919
.ec-timeline .ec-time, .ec-timeline .ec-line {

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "event-calendar",
33
"private": true,
4-
"version": "4.3.1",
4+
"version": "4.4.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

packages/build/README.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Inspired by [FullCalendar](https://fullcalendar.io/), it implements similar opti
5454
</td><td>
5555

5656
- [eventDurationEditable](#eventdurationeditable)
57+
- [eventFilter](#eventfilter)
5758
- [eventLongPressDelay](#eventlongpressdelay)
5859
- [eventMouseEnter](#eventmouseenter)
5960
- [eventMouseLeave](#eventmouseleave)
@@ -227,8 +228,8 @@ This bundle contains a version of the calendar that includes all plugins and is
227228

228229
The first step is to include the following lines of code in the `<head>` section of your page:
229230
```html
230-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.3.1/dist/event-calendar.min.css">
231-
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.3.1/dist/event-calendar.min.js"></script>
231+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.4.0/dist/event-calendar.min.css">
232+
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.4.0/dist/event-calendar.min.js"></script>
232233
```
233234

234235
<details>
@@ -1115,6 +1116,58 @@ The current [View](#view-object) object
11151116

11161117
Determines whether calendar events can be resized.
11171118

1119+
### eventFilter
1120+
- Type `function`
1121+
- Default `undefined`
1122+
1123+
A function for filtering the array of events before displaying them in the calendar. It allows, for example, to display only specific events for each view.
1124+
1125+
```js
1126+
function (info) {
1127+
// return true to keep the event, false to exclude it
1128+
}
1129+
```
1130+
`info` is an object with the following properties:
1131+
<table>
1132+
<tr>
1133+
<td>
1134+
1135+
`event`
1136+
</td>
1137+
<td>
1138+
1139+
The current [Event](#event-object) object being processed in the array
1140+
</td>
1141+
</tr>
1142+
<tr>
1143+
<td>
1144+
1145+
`index`
1146+
</td>
1147+
<td>The index of the current event being processed in the array</td>
1148+
</tr>
1149+
<tr>
1150+
<td>
1151+
1152+
`events`
1153+
</td>
1154+
<td>
1155+
1156+
The array of all events `eventFilter` was called upon
1157+
</td>
1158+
</tr>
1159+
<tr>
1160+
<td>
1161+
1162+
`view`
1163+
</td>
1164+
<td>
1165+
1166+
The current [View](#view-object) object
1167+
</td>
1168+
</tr>
1169+
</table>
1170+
11181171
### eventLongPressDelay
11191172
- Type `integer`
11201173
- Default `undefined`

packages/build/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@event-calendar/build",
3-
"version": "4.3.1",
3+
"version": "4.4.0",
44
"title": "Event Calendar",
55
"description": "Full-sized drag & drop event calendar with resource & timeline views",
66
"keywords": [

packages/core/README.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Inspired by [FullCalendar](https://fullcalendar.io/), it implements similar opti
5454
</td><td>
5555

5656
- [eventDurationEditable](#eventdurationeditable)
57+
- [eventFilter](#eventfilter)
5758
- [eventLongPressDelay](#eventlongpressdelay)
5859
- [eventMouseEnter](#eventmouseenter)
5960
- [eventMouseLeave](#eventmouseleave)
@@ -227,8 +228,8 @@ This bundle contains a version of the calendar that includes all plugins and is
227228

228229
The first step is to include the following lines of code in the `<head>` section of your page:
229230
```html
230-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.3.1/dist/event-calendar.min.css">
231-
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.3.1/dist/event-calendar.min.js"></script>
231+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.4.0/dist/event-calendar.min.css">
232+
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.4.0/dist/event-calendar.min.js"></script>
232233
```
233234

234235
<details>
@@ -1115,6 +1116,58 @@ The current [View](#view-object) object
11151116

11161117
Determines whether calendar events can be resized.
11171118

1119+
### eventFilter
1120+
- Type `function`
1121+
- Default `undefined`
1122+
1123+
A function for filtering the array of events before displaying them in the calendar. It allows, for example, to display only specific events for each view.
1124+
1125+
```js
1126+
function (info) {
1127+
// return true to keep the event, false to exclude it
1128+
}
1129+
```
1130+
`info` is an object with the following properties:
1131+
<table>
1132+
<tr>
1133+
<td>
1134+
1135+
`event`
1136+
</td>
1137+
<td>
1138+
1139+
The current [Event](#event-object) object being processed in the array
1140+
</td>
1141+
</tr>
1142+
<tr>
1143+
<td>
1144+
1145+
`index`
1146+
</td>
1147+
<td>The index of the current event being processed in the array</td>
1148+
</tr>
1149+
<tr>
1150+
<td>
1151+
1152+
`events`
1153+
</td>
1154+
<td>
1155+
1156+
The array of all events `eventFilter` was called upon
1157+
</td>
1158+
</tr>
1159+
<tr>
1160+
<td>
1161+
1162+
`view`
1163+
</td>
1164+
<td>
1165+
1166+
The current [View](#view-object) object
1167+
</td>
1168+
</tr>
1169+
</table>
1170+
11181171
### eventLongPressDelay
11191172
- Type `integer`
11201173
- Default `undefined`

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@event-calendar/core",
3-
"version": "4.3.1",
3+
"version": "4.4.0",
44
"title": "Event Calendar Core package",
55
"description": "Full-sized drag & drop event calendar with resource & timeline views",
66
"keywords": [

packages/core/src/plugins/day-grid/Week.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
99
let {dates} = $props();
1010
11-
let {_events, _iEvents,
12-
resources, filterEventsWithResources, hiddenDays, theme, validRange} = getContext('state');
11+
let {_filteredEvents, _iEvents,
12+
resources, filterEventsWithResources, hiddenDays, theme, validRange } = getContext('state');
1313
1414
let refs = [];
1515
@@ -19,7 +19,7 @@
1919
let [chunks, bgChunks, longChunks] = $derived.by(() => {
2020
let chunks = [];
2121
let bgChunks = [];
22-
for (let event of $_events) {
22+
for (let event of $_filteredEvents) {
2323
if (eventIntersects(event, start, end, $filterEventsWithResources ? $resources : undefined)) {
2424
let chunk = createEventChunk(event, start, end);
2525
if (bgEvent(event.display)) {

0 commit comments

Comments
 (0)