@event-calendar/core 5.2.2 → 5.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.css +1 -1
- package/dist/index.js +17 -10
- package/package.json +1 -1
- package/src/Buttons.svelte +1 -1
- package/src/Calendar.svelte +1 -1
- package/src/lib/date.js +10 -3
- package/src/plugins/resource-timeline/Event.svelte +1 -1
- package/src/plugins/resource-timeline/lib.js +1 -1
- package/src/storage/derived.js +6 -3
package/README.md
CHANGED
|
@@ -247,8 +247,8 @@ This bundle contains a version of the calendar that includes all plugins and is
|
|
|
247
247
|
|
|
248
248
|
The first step is to include the following lines of code in the `<head>` section of your page:
|
|
249
249
|
```html
|
|
250
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@5.2.
|
|
251
|
-
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@5.2.
|
|
250
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@5.2.3/dist/event-calendar.min.css">
|
|
251
|
+
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@5.2.3/dist/event-calendar.min.js"></script>
|
|
252
252
|
```
|
|
253
253
|
|
|
254
254
|
<details>
|
package/dist/index.css
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* EventCalendar v5.2.
|
|
2
|
+
* EventCalendar v5.2.3
|
|
3
3
|
* https://github.com/vkurko/calendar
|
|
4
4
|
*/
|
|
5
5
|
import { untrack, getAbortSignal, tick, getContext, setContext, onMount, mount, unmount } from "svelte";
|
|
@@ -219,18 +219,22 @@ function copyTime(toDate, fromDate) {
|
|
|
219
219
|
function toSeconds(duration) {
|
|
220
220
|
return duration.seconds;
|
|
221
221
|
}
|
|
222
|
-
function nextDate(date, duration) {
|
|
222
|
+
function nextDate(date, duration, hiddenDays) {
|
|
223
223
|
addDuration(date, duration);
|
|
224
|
+
_skipHiddenDays(date, hiddenDays, addDay);
|
|
224
225
|
return date;
|
|
225
226
|
}
|
|
226
227
|
function prevDate(date, duration, hiddenDays) {
|
|
227
228
|
subtractDuration(date, duration);
|
|
229
|
+
_skipHiddenDays(date, hiddenDays, subtractDay);
|
|
230
|
+
return date;
|
|
231
|
+
}
|
|
232
|
+
function _skipHiddenDays(date, hiddenDays, dateFn) {
|
|
228
233
|
if (hiddenDays.length && hiddenDays.length < 7) {
|
|
229
234
|
while (hiddenDays.includes(date.getUTCDay())) {
|
|
230
|
-
|
|
235
|
+
dateFn(date);
|
|
231
236
|
}
|
|
232
237
|
}
|
|
233
|
-
return date;
|
|
234
238
|
}
|
|
235
239
|
function getWeekNumber(date, firstDay) {
|
|
236
240
|
date = cloneDate(date);
|
|
@@ -1175,9 +1179,12 @@ function viewDates(mainState) {
|
|
|
1175
1179
|
addDay(date);
|
|
1176
1180
|
}
|
|
1177
1181
|
if (!dates.length && hiddenDays.length && hiddenDays.length < 7) {
|
|
1178
|
-
while (hiddenDays.includes(
|
|
1179
|
-
|
|
1182
|
+
while (hiddenDays.includes(date.getUTCDay())) {
|
|
1183
|
+
addDay(date);
|
|
1180
1184
|
}
|
|
1185
|
+
tick().then(() => {
|
|
1186
|
+
mainState.setOption("date", date);
|
|
1187
|
+
});
|
|
1181
1188
|
}
|
|
1182
1189
|
});
|
|
1183
1190
|
return dates;
|
|
@@ -1462,7 +1469,7 @@ function Buttons($$anchor, $$props) {
|
|
|
1462
1469
|
mainState.setOption("date", prevDate(cloneDate($.get(date)), $.get(duration), $.get(hiddenDays)));
|
|
1463
1470
|
}
|
|
1464
1471
|
function next() {
|
|
1465
|
-
mainState.setOption("date", nextDate(cloneDate($.get(date)), $.get(duration)));
|
|
1472
|
+
mainState.setOption("date", nextDate(cloneDate($.get(date)), $.get(duration), $.get(hiddenDays)));
|
|
1466
1473
|
}
|
|
1467
1474
|
function setToday() {
|
|
1468
1475
|
mainState.setOption("date", cloneDate($.get(today)));
|
|
@@ -1776,7 +1783,7 @@ function Calendar($$anchor, $$props) {
|
|
|
1776
1783
|
return null;
|
|
1777
1784
|
}
|
|
1778
1785
|
function next() {
|
|
1779
|
-
mainState.setOption("date", nextDate(cloneDate($.get(date)), $.get(duration)));
|
|
1786
|
+
mainState.setOption("date", nextDate(cloneDate($.get(date)), $.get(duration), $.get(hiddenDays)));
|
|
1780
1787
|
return this;
|
|
1781
1788
|
}
|
|
1782
1789
|
function prev() {
|
|
@@ -5112,7 +5119,7 @@ function prepareChunks(chunks) {
|
|
|
5112
5119
|
}
|
|
5113
5120
|
}
|
|
5114
5121
|
function repositionEvent(chunk, height2, monthView2) {
|
|
5115
|
-
let top =
|
|
5122
|
+
let top = 1;
|
|
5116
5123
|
let bottom = top + height2;
|
|
5117
5124
|
let dayChunks = chunk.day;
|
|
5118
5125
|
dayChunks.sort((a, b) => (a.top ?? Number.POSITIVE_INFINITY) - (b.top ?? Number.POSITIVE_INFINITY));
|
|
@@ -5382,7 +5389,7 @@ function Event($$anchor, $$props) {
|
|
|
5382
5389
|
let $$d = $.derived(() => getContext("state")), slotDuration = $.derived(() => $.get($$d).options.slotDuration), slotWidth = $.derived(() => $.get($$d).options.slotWidth);
|
|
5383
5390
|
let $$d_1 = $.derived(() => getContext("view-state")), monthView2 = $.derived(() => $.get($$d_1).monthView);
|
|
5384
5391
|
let el = $.state(void 0);
|
|
5385
|
-
let margin = $.state(
|
|
5392
|
+
let margin = $.state(1);
|
|
5386
5393
|
let event = $.derived(() => $$props.chunk.event);
|
|
5387
5394
|
let styles = $.derived(() => (style) => {
|
|
5388
5395
|
style["grid-column"] = `${$$props.chunk.gridColumn} / span ${$$props.chunk.dates.length}`;
|
package/package.json
CHANGED
package/src/Buttons.svelte
CHANGED
package/src/Calendar.svelte
CHANGED
package/src/lib/date.js
CHANGED
|
@@ -135,8 +135,10 @@ export function toSeconds(duration) {
|
|
|
135
135
|
/**
|
|
136
136
|
* Move the date forward (when pressing the next button)
|
|
137
137
|
*/
|
|
138
|
-
export function nextDate(date, duration) {
|
|
138
|
+
export function nextDate(date, duration, hiddenDays) {
|
|
139
139
|
addDuration(date, duration);
|
|
140
|
+
_skipHiddenDays(date, hiddenDays, addDay);
|
|
141
|
+
|
|
140
142
|
return date;
|
|
141
143
|
}
|
|
142
144
|
|
|
@@ -145,12 +147,17 @@ export function nextDate(date, duration) {
|
|
|
145
147
|
*/
|
|
146
148
|
export function prevDate(date, duration, hiddenDays) {
|
|
147
149
|
subtractDuration(date, duration);
|
|
150
|
+
_skipHiddenDays(date, hiddenDays, subtractDay);
|
|
151
|
+
|
|
152
|
+
return date;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function _skipHiddenDays(date, hiddenDays, dateFn) {
|
|
148
156
|
if (hiddenDays.length && hiddenDays.length < 7) {
|
|
149
157
|
while (hiddenDays.includes(date.getUTCDay())) {
|
|
150
|
-
|
|
158
|
+
dateFn(date);
|
|
151
159
|
}
|
|
152
160
|
}
|
|
153
|
-
return date;
|
|
154
161
|
}
|
|
155
162
|
|
|
156
163
|
/**
|
|
@@ -68,7 +68,7 @@ export function prepareChunks(chunks) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export function repositionEvent(chunk, height, monthView) {
|
|
71
|
-
let top =
|
|
71
|
+
let top = 1;
|
|
72
72
|
let bottom = top + height;
|
|
73
73
|
let dayChunks = chunk.day;
|
|
74
74
|
dayChunks.sort((a, b) => (a.top ?? Number.POSITIVE_INFINITY) - (b.top ?? Number.POSITIVE_INFINITY));
|
package/src/storage/derived.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {untrack} from 'svelte';
|
|
1
|
+
import {tick, untrack} from 'svelte';
|
|
2
2
|
import {
|
|
3
3
|
addDay, addDuration, cloneDate, createView, isFunction, prevClosestDay, subtractDay,
|
|
4
4
|
toEventWithLocalDates, toViewWithLocalDates
|
|
@@ -101,9 +101,12 @@ export function viewDates(mainState) {
|
|
|
101
101
|
}
|
|
102
102
|
if (!dates.length && hiddenDays.length && hiddenDays.length < 7) {
|
|
103
103
|
// Try to move the date
|
|
104
|
-
while (hiddenDays.includes(
|
|
105
|
-
|
|
104
|
+
while (hiddenDays.includes(date.getUTCDay())) {
|
|
105
|
+
addDay(date);
|
|
106
106
|
}
|
|
107
|
+
tick().then(() => {
|
|
108
|
+
mainState.setOption('date', date);
|
|
109
|
+
});
|
|
107
110
|
}
|
|
108
111
|
});
|
|
109
112
|
|