@event-calendar/core 4.5.2 → 4.6.0
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 +49 -3
- package/dist/index.css +1 -1
- package/dist/index.js +46 -20
- package/package.json +1 -1
- package/src/lib/events.js +21 -5
- package/src/plugins/day-grid/Week.svelte +5 -5
- package/src/plugins/list/Day.svelte +2 -2
- package/src/plugins/resource-timeline/Days.svelte +5 -6
- package/src/plugins/resource-timeline/lib.js +2 -2
- package/src/plugins/time-grid/Day.svelte +2 -2
- package/src/plugins/time-grid/all-day/Day.svelte +1 -1
- package/src/plugins/time-grid/all-day/Week.svelte +6 -5
- package/src/plugins/time-grid/utils.js +2 -2
- package/src/storage/options.js +1 -0
package/README.md
CHANGED
|
@@ -66,13 +66,14 @@ Inspired by [FullCalendar](https://fullcalendar.io/), it implements similar opti
|
|
|
66
66
|
- [eventDragStart](#eventdragstart)
|
|
67
67
|
- [eventDragStop](#eventdragstop)
|
|
68
68
|
- [eventDrop](#eventdrop)
|
|
69
|
+
- [eventDurationEditable](#eventdurationeditable)
|
|
69
70
|
</td><td>
|
|
70
71
|
|
|
71
|
-
- [eventDurationEditable](#eventdurationeditable)
|
|
72
72
|
- [eventFilter](#eventfilter)
|
|
73
73
|
- [eventLongPressDelay](#eventlongpressdelay)
|
|
74
74
|
- [eventMouseEnter](#eventmouseenter)
|
|
75
75
|
- [eventMouseLeave](#eventmouseleave)
|
|
76
|
+
- [eventOrder](#eventorder)
|
|
76
77
|
- [eventResizableFromStart](#eventresizablefromstart)
|
|
77
78
|
- [eventResize](#eventresize)
|
|
78
79
|
- [eventResizeStart](#eventresizestart)
|
|
@@ -243,8 +244,8 @@ This bundle contains a version of the calendar that includes all plugins and is
|
|
|
243
244
|
|
|
244
245
|
The first step is to include the following lines of code in the `<head>` section of your page:
|
|
245
246
|
```html
|
|
246
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.
|
|
247
|
-
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.
|
|
247
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.6.0/dist/event-calendar.min.css">
|
|
248
|
+
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.6.0/dist/event-calendar.min.js"></script>
|
|
248
249
|
```
|
|
249
250
|
|
|
250
251
|
<details>
|
|
@@ -1286,6 +1287,51 @@ The current [View](#view-object) object
|
|
|
1286
1287
|
</tr>
|
|
1287
1288
|
</table>
|
|
1288
1289
|
|
|
1290
|
+
### eventOrder
|
|
1291
|
+
- Type `function`
|
|
1292
|
+
- Default `undefined`
|
|
1293
|
+
|
|
1294
|
+
A function that determines the order in which events that visually intersect in the current view are displayed.
|
|
1295
|
+
|
|
1296
|
+
When `eventOrder` is not specified, events are ordered by start time with all-day events appearing first.
|
|
1297
|
+
|
|
1298
|
+
```js
|
|
1299
|
+
function (a, b) {
|
|
1300
|
+
// Return a negative value if 'a' should come before 'b'
|
|
1301
|
+
// Return a positive value if 'a' should come after 'b'
|
|
1302
|
+
// Return zero if 'a' and 'b' are equal
|
|
1303
|
+
}
|
|
1304
|
+
```
|
|
1305
|
+
|
|
1306
|
+
`a` and `b` are objects (so called `event chunks`) with the following properties:
|
|
1307
|
+
|
|
1308
|
+
<table>
|
|
1309
|
+
<tr>
|
|
1310
|
+
<td>
|
|
1311
|
+
|
|
1312
|
+
`start`
|
|
1313
|
+
</td>
|
|
1314
|
+
<td>JavaScript Date object holding the event chunk’s start time</td>
|
|
1315
|
+
</tr>
|
|
1316
|
+
<tr>
|
|
1317
|
+
<td>
|
|
1318
|
+
|
|
1319
|
+
`end`
|
|
1320
|
+
</td>
|
|
1321
|
+
<td>JavaScript Date object holding the event chunk’s end time</td>
|
|
1322
|
+
</tr>
|
|
1323
|
+
<tr>
|
|
1324
|
+
<td>
|
|
1325
|
+
|
|
1326
|
+
`event`
|
|
1327
|
+
</td>
|
|
1328
|
+
<td>
|
|
1329
|
+
|
|
1330
|
+
The [Event](#event-object) object associated with this chunk
|
|
1331
|
+
</td>
|
|
1332
|
+
</tr>
|
|
1333
|
+
</table>
|
|
1334
|
+
|
|
1289
1335
|
### eventResizableFromStart
|
|
1290
1336
|
- Type `boolean`
|
|
1291
1337
|
- Default `false`
|
package/dist/index.css
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* EventCalendar v4.
|
|
2
|
+
* EventCalendar v4.6.0
|
|
3
3
|
* https://github.com/vkurko/calendar
|
|
4
4
|
*/
|
|
5
5
|
import { tick, getContext, untrack, setContext, onMount, mount, unmount } from "svelte";
|
|
@@ -395,8 +395,23 @@ function createEventChunk(event, start, end) {
|
|
|
395
395
|
chunk.zeroDuration = datesEqual(chunk.start, chunk.end);
|
|
396
396
|
return chunk;
|
|
397
397
|
}
|
|
398
|
-
function sortEventChunks(chunks) {
|
|
399
|
-
|
|
398
|
+
function sortEventChunks(chunks, eventOrder) {
|
|
399
|
+
if (isFunction(eventOrder)) {
|
|
400
|
+
chunks.sort((a, b) => eventOrder(
|
|
401
|
+
_toChunkWithLocalDates(a),
|
|
402
|
+
_toChunkWithLocalDates(b)
|
|
403
|
+
));
|
|
404
|
+
} else {
|
|
405
|
+
chunks.sort((a, b) => a.start - b.start || b.event.allDay - a.event.allDay);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
function _toChunkWithLocalDates(chunk) {
|
|
409
|
+
return {
|
|
410
|
+
...chunk,
|
|
411
|
+
start: toLocalDate(chunk.start),
|
|
412
|
+
end: toLocalDate(chunk.end),
|
|
413
|
+
event: toEventWithLocalDates(chunk.event)
|
|
414
|
+
};
|
|
400
415
|
}
|
|
401
416
|
function createEventContent(chunk, displayEventEnd, eventContent, theme, _intlEventTime, _view) {
|
|
402
417
|
let timeText = _intlEventTime.formatRange(
|
|
@@ -466,10 +481,10 @@ function _cloneEvent(event, dateFn) {
|
|
|
466
481
|
event.end = dateFn(event.end);
|
|
467
482
|
return event;
|
|
468
483
|
}
|
|
469
|
-
function prepareEventChunks$1(chunks, hiddenDays) {
|
|
484
|
+
function prepareEventChunks$1(chunks, hiddenDays, eventOrder) {
|
|
470
485
|
let longChunks = {};
|
|
471
486
|
if (chunks.length) {
|
|
472
|
-
sortEventChunks(chunks);
|
|
487
|
+
sortEventChunks(chunks, eventOrder);
|
|
473
488
|
let prevChunk;
|
|
474
489
|
for (let chunk of chunks) {
|
|
475
490
|
let dates = [];
|
|
@@ -831,6 +846,7 @@ function createOptions(plugins) {
|
|
|
831
846
|
// ec option
|
|
832
847
|
eventMouseEnter: void 0,
|
|
833
848
|
eventMouseLeave: void 0,
|
|
849
|
+
eventOrder: void 0,
|
|
834
850
|
eventSources: [],
|
|
835
851
|
eventTextColor: void 0,
|
|
836
852
|
eventTimeFormat: {
|
|
@@ -2613,12 +2629,14 @@ function Week$1($$anchor, $$props) {
|
|
|
2613
2629
|
const $filterEventsWithResources = () => $.store_get(filterEventsWithResources, "$filterEventsWithResources", $$stores);
|
|
2614
2630
|
const $resources = () => $.store_get(resources, "$resources", $$stores);
|
|
2615
2631
|
const $hiddenDays = () => $.store_get(hiddenDays, "$hiddenDays", $$stores);
|
|
2632
|
+
const $eventOrder = () => $.store_get(eventOrder, "$eventOrder", $$stores);
|
|
2616
2633
|
const $_iEvents = () => $.store_get(_iEvents, "$_iEvents", $$stores);
|
|
2617
2634
|
const $theme = () => $.store_get(theme, "$theme", $$stores);
|
|
2618
2635
|
let {
|
|
2619
2636
|
_filteredEvents,
|
|
2620
2637
|
_iEvents,
|
|
2621
2638
|
resources,
|
|
2639
|
+
eventOrder,
|
|
2622
2640
|
filterEventsWithResources,
|
|
2623
2641
|
hiddenDays,
|
|
2624
2642
|
theme,
|
|
@@ -2642,15 +2660,15 @@ function Week$1($$anchor, $$props) {
|
|
|
2642
2660
|
}
|
|
2643
2661
|
}
|
|
2644
2662
|
}
|
|
2645
|
-
prepareEventChunks$1(bgChunks2, $hiddenDays());
|
|
2646
|
-
let longChunks2 = prepareEventChunks$1(chunks2, $hiddenDays());
|
|
2663
|
+
prepareEventChunks$1(bgChunks2, $hiddenDays(), $eventOrder());
|
|
2664
|
+
let longChunks2 = prepareEventChunks$1(chunks2, $hiddenDays(), $eventOrder());
|
|
2647
2665
|
return [chunks2, bgChunks2, longChunks2];
|
|
2648
2666
|
}), $$array = $.derived(() => $.to_array($.get($$d), 3)), chunks = $.derived(() => $.get($$array)[0]), bgChunks = $.derived(() => $.get($$array)[1]), longChunks = $.derived(() => $.get($$array)[2]);
|
|
2649
2667
|
let iChunks = $.derived(() => $_iEvents().map((event) => {
|
|
2650
2668
|
let chunk;
|
|
2651
2669
|
if (event && eventIntersects(event, $.get(start), $.get(end))) {
|
|
2652
2670
|
chunk = createEventChunk(event, $.get(start), $.get(end));
|
|
2653
|
-
prepareEventChunks$1([chunk], $hiddenDays());
|
|
2671
|
+
prepareEventChunks$1([chunk], $hiddenDays(), $eventOrder());
|
|
2654
2672
|
} else {
|
|
2655
2673
|
chunk = null;
|
|
2656
2674
|
}
|
|
@@ -3743,6 +3761,7 @@ function Day$3($$anchor, $$props) {
|
|
|
3743
3761
|
const $_filteredEvents = () => $.store_get(_filteredEvents, "$_filteredEvents", $$stores);
|
|
3744
3762
|
const $filterEventsWithResources = () => $.store_get(filterEventsWithResources, "$filterEventsWithResources", $$stores);
|
|
3745
3763
|
const $resources = () => $.store_get(resources, "$resources", $$stores);
|
|
3764
|
+
const $eventOrder = () => $.store_get(eventOrder, "$eventOrder", $$stores);
|
|
3746
3765
|
const $theme = () => $.store_get(theme, "$theme", $$stores);
|
|
3747
3766
|
const $_interaction = () => $.store_get(_interaction, "$_interaction", $$stores);
|
|
3748
3767
|
const $_intlListDay = () => $.store_get(_intlListDay, "$_intlListDay", $$stores);
|
|
@@ -3754,6 +3773,7 @@ function Day$3($$anchor, $$props) {
|
|
|
3754
3773
|
_intlListDaySide,
|
|
3755
3774
|
_today,
|
|
3756
3775
|
resources,
|
|
3776
|
+
eventOrder,
|
|
3757
3777
|
filterEventsWithResources,
|
|
3758
3778
|
highlightedDates,
|
|
3759
3779
|
theme,
|
|
@@ -3775,7 +3795,7 @@ function Day$3($$anchor, $$props) {
|
|
|
3775
3795
|
chunks2.push(chunk);
|
|
3776
3796
|
}
|
|
3777
3797
|
}
|
|
3778
|
-
sortEventChunks(chunks2);
|
|
3798
|
+
sortEventChunks(chunks2, $eventOrder());
|
|
3779
3799
|
}
|
|
3780
3800
|
return chunks2;
|
|
3781
3801
|
});
|
|
@@ -3979,11 +3999,11 @@ function slotTimeLimits(state) {
|
|
|
3979
3999
|
(args) => createSlotTimeLimits(...args)
|
|
3980
4000
|
);
|
|
3981
4001
|
}
|
|
3982
|
-
function groupEventChunks(chunks) {
|
|
4002
|
+
function groupEventChunks(chunks, $eventOrder) {
|
|
3983
4003
|
if (!chunks.length) {
|
|
3984
4004
|
return;
|
|
3985
4005
|
}
|
|
3986
|
-
sortEventChunks(chunks);
|
|
4006
|
+
sortEventChunks(chunks, $eventOrder);
|
|
3987
4007
|
let group = {
|
|
3988
4008
|
columns: [],
|
|
3989
4009
|
end: chunks[0].end
|
|
@@ -4247,6 +4267,7 @@ function Day$2($$anchor, $$props) {
|
|
|
4247
4267
|
const $filterEventsWithResources = () => $.store_get(filterEventsWithResources, "$filterEventsWithResources", $$stores);
|
|
4248
4268
|
const $resources = () => $.store_get(resources, "$resources", $$stores);
|
|
4249
4269
|
const $_filteredEvents = () => $.store_get(_filteredEvents, "$_filteredEvents", $$stores);
|
|
4270
|
+
const $eventOrder = () => $.store_get(eventOrder, "$eventOrder", $$stores);
|
|
4250
4271
|
const $_iEvents = () => $.store_get(_iEvents, "$_iEvents", $$stores);
|
|
4251
4272
|
const $slotDuration = () => $.store_get(slotDuration, "$slotDuration", $$stores);
|
|
4252
4273
|
const $slotHeight = () => $.store_get(slotHeight, "$slotHeight", $$stores);
|
|
@@ -4262,6 +4283,7 @@ function Day$2($$anchor, $$props) {
|
|
|
4262
4283
|
slotDuration,
|
|
4263
4284
|
slotHeight,
|
|
4264
4285
|
filterEventsWithResources,
|
|
4286
|
+
eventOrder,
|
|
4265
4287
|
theme,
|
|
4266
4288
|
resources,
|
|
4267
4289
|
validRange,
|
|
@@ -4294,7 +4316,7 @@ function Day$2($$anchor, $$props) {
|
|
|
4294
4316
|
}
|
|
4295
4317
|
}
|
|
4296
4318
|
}
|
|
4297
|
-
groupEventChunks(chunks2);
|
|
4319
|
+
groupEventChunks(chunks2, $eventOrder());
|
|
4298
4320
|
return [chunks2, bgChunks2];
|
|
4299
4321
|
}), $$array = $.derived(() => $.to_array($.get($$d), 2)), chunks = $.derived(() => $.get($$array)[0]), bgChunks = $.derived(() => $.get($$array)[1]);
|
|
4300
4322
|
let iChunks = $.derived(() => {
|
|
@@ -4600,11 +4622,13 @@ function Week($$anchor, $$props) {
|
|
|
4600
4622
|
const $resources = () => $.store_get(resources, "$resources", $$stores);
|
|
4601
4623
|
const $_filteredEvents = () => $.store_get(_filteredEvents, "$_filteredEvents", $$stores);
|
|
4602
4624
|
const $hiddenDays = () => $.store_get(hiddenDays, "$hiddenDays", $$stores);
|
|
4625
|
+
const $eventOrder = () => $.store_get(eventOrder, "$eventOrder", $$stores);
|
|
4603
4626
|
const $_iEvents = () => $.store_get(_iEvents, "$_iEvents", $$stores);
|
|
4604
4627
|
let resource = $.prop($$props, "resource", 3, void 0);
|
|
4605
4628
|
let {
|
|
4606
4629
|
_filteredEvents,
|
|
4607
4630
|
_iEvents,
|
|
4631
|
+
eventOrder,
|
|
4608
4632
|
hiddenDays,
|
|
4609
4633
|
resources,
|
|
4610
4634
|
filterEventsWithResources,
|
|
@@ -4627,8 +4651,8 @@ function Week($$anchor, $$props) {
|
|
|
4627
4651
|
}
|
|
4628
4652
|
}
|
|
4629
4653
|
}
|
|
4630
|
-
prepareEventChunks$1(bgChunks2, $hiddenDays());
|
|
4631
|
-
let longChunks2 = prepareEventChunks$1(chunks2, $hiddenDays());
|
|
4654
|
+
prepareEventChunks$1(bgChunks2, $hiddenDays(), $eventOrder());
|
|
4655
|
+
let longChunks2 = prepareEventChunks$1(chunks2, $hiddenDays(), $eventOrder());
|
|
4632
4656
|
return [chunks2, bgChunks2, longChunks2];
|
|
4633
4657
|
}), $$array = $.derived(() => $.to_array($.get($$d), 3)), chunks = $.derived(() => $.get($$array)[0]), bgChunks = $.derived(() => $.get($$array)[1]), longChunks = $.derived(() => $.get($$array)[2]);
|
|
4634
4658
|
function reposition() {
|
|
@@ -4642,7 +4666,7 @@ function Week($$anchor, $$props) {
|
|
|
4642
4666
|
let chunk;
|
|
4643
4667
|
if (event && event.allDay && eventIntersects(event, $.get(start), $.get(end), resource())) {
|
|
4644
4668
|
chunk = createEventChunk(event, $.get(start), $.get(end));
|
|
4645
|
-
prepareEventChunks$1([chunk], $hiddenDays());
|
|
4669
|
+
prepareEventChunks$1([chunk], $hiddenDays(), $eventOrder());
|
|
4646
4670
|
} else {
|
|
4647
4671
|
chunk = null;
|
|
4648
4672
|
}
|
|
@@ -5517,11 +5541,11 @@ function Header($$anchor, $$props) {
|
|
|
5517
5541
|
$.pop();
|
|
5518
5542
|
$$cleanup();
|
|
5519
5543
|
}
|
|
5520
|
-
function prepareEventChunks(chunks, $_viewDates, $_dayTimeLimits, $slotDuration) {
|
|
5544
|
+
function prepareEventChunks(chunks, $_viewDates, $_dayTimeLimits, $slotDuration, $eventOrder) {
|
|
5521
5545
|
let longChunks = {};
|
|
5522
5546
|
let filteredChunks = [];
|
|
5523
5547
|
if (chunks.length) {
|
|
5524
|
-
sortEventChunks(chunks);
|
|
5548
|
+
sortEventChunks(chunks, $eventOrder);
|
|
5525
5549
|
let step = toSeconds($slotDuration);
|
|
5526
5550
|
let prevChunk;
|
|
5527
5551
|
for (let chunk of chunks) {
|
|
@@ -5860,6 +5884,7 @@ function Days($$anchor, $$props) {
|
|
|
5860
5884
|
const $_dayTimeLimits = () => $.store_get(_dayTimeLimits, "$_dayTimeLimits", $$stores);
|
|
5861
5885
|
const $_filteredEvents = () => $.store_get(_filteredEvents, "$_filteredEvents", $$stores);
|
|
5862
5886
|
const $slotDuration = () => $.store_get(slotDuration, "$slotDuration", $$stores);
|
|
5887
|
+
const $eventOrder = () => $.store_get(eventOrder, "$eventOrder", $$stores);
|
|
5863
5888
|
const $_iEvents = () => $.store_get(_iEvents, "$_iEvents", $$stores);
|
|
5864
5889
|
const $_daysHs = () => $.store_get(_daysHs, "$_daysHs", $$stores);
|
|
5865
5890
|
const $theme = () => $.store_get(theme, "$theme", $$stores);
|
|
@@ -5871,6 +5896,7 @@ function Days($$anchor, $$props) {
|
|
|
5871
5896
|
_dayTimeLimits,
|
|
5872
5897
|
_daysHs,
|
|
5873
5898
|
_resHs,
|
|
5899
|
+
eventOrder,
|
|
5874
5900
|
slotDuration,
|
|
5875
5901
|
theme,
|
|
5876
5902
|
validRange
|
|
@@ -5903,15 +5929,15 @@ function Days($$anchor, $$props) {
|
|
|
5903
5929
|
}
|
|
5904
5930
|
}
|
|
5905
5931
|
}
|
|
5906
|
-
[bgChunks2] = prepareEventChunks(bgChunks2, $_viewDates(), $_dayTimeLimits(), $slotDuration());
|
|
5907
|
-
[chunks2, longChunks2] = prepareEventChunks(chunks2, $_viewDates(), $_dayTimeLimits(), $slotDuration());
|
|
5932
|
+
[bgChunks2] = prepareEventChunks(bgChunks2, $_viewDates(), $_dayTimeLimits(), $slotDuration(), $eventOrder());
|
|
5933
|
+
[chunks2, longChunks2] = prepareEventChunks(chunks2, $_viewDates(), $_dayTimeLimits(), $slotDuration(), $eventOrder());
|
|
5908
5934
|
return [chunks2, bgChunks2, longChunks2];
|
|
5909
5935
|
}), $$array_3 = $.derived(() => $.to_array($.get($$d_1), 3)), chunks = $.derived(() => $.get($$array_3)[0]), bgChunks = $.derived(() => $.get($$array_3)[1]), longChunks = $.derived(() => $.get($$array_3)[2]);
|
|
5910
5936
|
let iChunks = $.derived(() => $_iEvents().map((event) => {
|
|
5911
5937
|
let chunk;
|
|
5912
5938
|
if (event && eventIntersects(event, $.get(start), $.get(end), $$props.resource)) {
|
|
5913
5939
|
chunk = createEventChunk(event, $.get(start), $.get(end));
|
|
5914
|
-
[[chunk]] = prepareEventChunks([chunk], $_viewDates(), $_dayTimeLimits(), $slotDuration());
|
|
5940
|
+
[[chunk]] = prepareEventChunks([chunk], $_viewDates(), $_dayTimeLimits(), $slotDuration(), $eventOrder());
|
|
5915
5941
|
} else {
|
|
5916
5942
|
chunk = null;
|
|
5917
5943
|
}
|
package/package.json
CHANGED
package/src/lib/events.js
CHANGED
|
@@ -66,9 +66,25 @@ export function createEventChunk(event, start, end) {
|
|
|
66
66
|
return chunk;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
export function sortEventChunks(chunks) {
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
export function sortEventChunks(chunks, eventOrder) {
|
|
70
|
+
if (isFunction(eventOrder)) {
|
|
71
|
+
chunks.sort((a, b) => eventOrder(
|
|
72
|
+
_toChunkWithLocalDates(a),
|
|
73
|
+
_toChunkWithLocalDates(b)
|
|
74
|
+
));
|
|
75
|
+
} else {
|
|
76
|
+
// Sort by start date (all-day events always on top)
|
|
77
|
+
chunks.sort((a, b) => a.start - b.start || b.event.allDay - a.event.allDay);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function _toChunkWithLocalDates(chunk) {
|
|
82
|
+
return {
|
|
83
|
+
...chunk,
|
|
84
|
+
start: toLocalDate(chunk.start),
|
|
85
|
+
end: toLocalDate(chunk.end),
|
|
86
|
+
event: toEventWithLocalDates(chunk.event)
|
|
87
|
+
};
|
|
72
88
|
}
|
|
73
89
|
|
|
74
90
|
export function createEventContent(chunk, displayEventEnd, eventContent, theme, _intlEventTime, _view) {
|
|
@@ -156,11 +172,11 @@ function _cloneEvent(event, dateFn) {
|
|
|
156
172
|
/**
|
|
157
173
|
* Prepare event chunks for month view and all-day slot in week view
|
|
158
174
|
*/
|
|
159
|
-
export function prepareEventChunks(chunks, hiddenDays) {
|
|
175
|
+
export function prepareEventChunks(chunks, hiddenDays, eventOrder) {
|
|
160
176
|
let longChunks = {};
|
|
161
177
|
|
|
162
178
|
if (chunks.length) {
|
|
163
|
-
sortEventChunks(chunks);
|
|
179
|
+
sortEventChunks(chunks, eventOrder);
|
|
164
180
|
|
|
165
181
|
let prevChunk;
|
|
166
182
|
for (let chunk of chunks) {
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
let {dates} = $props();
|
|
10
10
|
|
|
11
|
-
let {_filteredEvents, _iEvents,
|
|
12
|
-
|
|
11
|
+
let {_filteredEvents, _iEvents, resources, eventOrder, filterEventsWithResources, hiddenDays, theme,
|
|
12
|
+
validRange} = getContext('state');
|
|
13
13
|
|
|
14
14
|
let refs = [];
|
|
15
15
|
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
prepareEventChunks(bgChunks, $hiddenDays);
|
|
35
|
-
let longChunks = prepareEventChunks(chunks, $hiddenDays);
|
|
34
|
+
prepareEventChunks(bgChunks, $hiddenDays, $eventOrder);
|
|
35
|
+
let longChunks = prepareEventChunks(chunks, $hiddenDays, $eventOrder);
|
|
36
36
|
return [chunks, bgChunks, longChunks];
|
|
37
37
|
});
|
|
38
38
|
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
let chunk;
|
|
41
41
|
if (event && eventIntersects(event, start, end)) {
|
|
42
42
|
chunk = createEventChunk(event, start, end);
|
|
43
|
-
prepareEventChunks([chunk], $hiddenDays);
|
|
43
|
+
prepareEventChunks([chunk], $hiddenDays, $eventOrder);
|
|
44
44
|
} else {
|
|
45
45
|
chunk = null;
|
|
46
46
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
let {date} = $props();
|
|
10
10
|
|
|
11
11
|
let {_filteredEvents, _interaction, _intlListDay, _intlListDaySide, _today,
|
|
12
|
-
resources, filterEventsWithResources, highlightedDates, theme, validRange} = getContext('state');
|
|
12
|
+
resources, eventOrder, filterEventsWithResources, highlightedDates, theme, validRange} = getContext('state');
|
|
13
13
|
|
|
14
14
|
let el = $state();
|
|
15
15
|
let isToday = $derived(datesEqual(date, $_today));
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
chunks.push(chunk);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
sortEventChunks(chunks);
|
|
31
|
+
sortEventChunks(chunks, $eventOrder);
|
|
32
32
|
}
|
|
33
33
|
return chunks;
|
|
34
34
|
});
|
|
@@ -9,9 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
let {resource} = $props();
|
|
11
11
|
|
|
12
|
-
let {
|
|
13
|
-
|
|
14
|
-
} = getContext('state');
|
|
12
|
+
let {_viewDates, _filteredEvents, _iEvents, _dayTimeLimits, _daysHs, _resHs,
|
|
13
|
+
eventOrder, slotDuration, theme, validRange} = getContext('state');
|
|
15
14
|
|
|
16
15
|
let refs = [];
|
|
17
16
|
|
|
@@ -43,8 +42,8 @@
|
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
|
-
[bgChunks] = prepareEventChunks(bgChunks, $_viewDates, $_dayTimeLimits, $slotDuration);
|
|
47
|
-
[chunks, longChunks] = prepareEventChunks(chunks, $_viewDates, $_dayTimeLimits, $slotDuration);
|
|
45
|
+
[bgChunks] = prepareEventChunks(bgChunks, $_viewDates, $_dayTimeLimits, $slotDuration, $eventOrder);
|
|
46
|
+
[chunks, longChunks] = prepareEventChunks(chunks, $_viewDates, $_dayTimeLimits, $slotDuration, $eventOrder);
|
|
48
47
|
return [chunks, bgChunks, longChunks];
|
|
49
48
|
});
|
|
50
49
|
|
|
@@ -52,7 +51,7 @@
|
|
|
52
51
|
let chunk;
|
|
53
52
|
if (event && eventIntersects(event, start, end, resource)) {
|
|
54
53
|
chunk = createEventChunk(event, start, end);
|
|
55
|
-
[[chunk]] = prepareEventChunks([chunk], $_viewDates, $_dayTimeLimits, $slotDuration);
|
|
54
|
+
[[chunk]] = prepareEventChunks([chunk], $_viewDates, $_dayTimeLimits, $slotDuration, $eventOrder);
|
|
56
55
|
} else {
|
|
57
56
|
chunk = null;
|
|
58
57
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {addDay, addDuration, cloneDate, createDuration, datesEqual, sortEventChunks, toSeconds} from '#lib';
|
|
2
2
|
|
|
3
|
-
export function prepareEventChunks(chunks, $_viewDates, $_dayTimeLimits, $slotDuration) {
|
|
3
|
+
export function prepareEventChunks(chunks, $_viewDates, $_dayTimeLimits, $slotDuration, $eventOrder) {
|
|
4
4
|
let longChunks = {};
|
|
5
5
|
let filteredChunks = [];
|
|
6
6
|
|
|
7
7
|
if (chunks.length) {
|
|
8
|
-
sortEventChunks(chunks);
|
|
8
|
+
sortEventChunks(chunks, $eventOrder);
|
|
9
9
|
|
|
10
10
|
let step = toSeconds($slotDuration);
|
|
11
11
|
let prevChunk;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
let {date, resource = undefined} = $props();
|
|
12
12
|
|
|
13
13
|
let {_filteredEvents, _iEvents, highlightedDates, nowIndicator, slotDuration, slotHeight, filterEventsWithResources,
|
|
14
|
-
theme, resources, validRange, _interaction, _today, _slotTimeLimits} = getContext('state');
|
|
14
|
+
eventOrder, theme, resources, validRange, _interaction, _today, _slotTimeLimits} = getContext('state');
|
|
15
15
|
|
|
16
16
|
let el = $state();
|
|
17
17
|
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
groupEventChunks(chunks);
|
|
42
|
+
groupEventChunks(chunks, $eventOrder);
|
|
43
43
|
return [chunks, bgChunks];
|
|
44
44
|
});
|
|
45
45
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext, onMount} from 'svelte';
|
|
3
|
-
import {datesEqual, outsideRange, runReposition, setPayload} from '
|
|
3
|
+
import {datesEqual, outsideRange, runReposition, setPayload} from '#lib';
|
|
4
4
|
import Event from './Event.svelte';
|
|
5
5
|
|
|
6
6
|
let {date, chunks, bgChunks, longChunks, iChunks = [], resource = undefined} = $props();
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
import {getContext, untrack} from 'svelte';
|
|
3
3
|
import {
|
|
4
4
|
addDay, bgEvent, cloneDate, createEventChunk, eventIntersects, limitToRange, prepareEventChunks, runReposition
|
|
5
|
-
} from '
|
|
5
|
+
} from '#lib';
|
|
6
6
|
import Day from './Day.svelte';
|
|
7
7
|
|
|
8
8
|
let {dates, resource = undefined} = $props();
|
|
9
9
|
|
|
10
|
-
let {_filteredEvents, _iEvents, hiddenDays, resources, filterEventsWithResources,
|
|
10
|
+
let {_filteredEvents, _iEvents, eventOrder, hiddenDays, resources, filterEventsWithResources,
|
|
11
|
+
validRange} = getContext('state');
|
|
11
12
|
|
|
12
13
|
let refs = [];
|
|
13
14
|
|
|
@@ -31,8 +32,8 @@
|
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
prepareEventChunks(bgChunks, $hiddenDays);
|
|
35
|
-
let longChunks = prepareEventChunks(chunks, $hiddenDays);
|
|
35
|
+
prepareEventChunks(bgChunks, $hiddenDays, $eventOrder);
|
|
36
|
+
let longChunks = prepareEventChunks(chunks, $hiddenDays, $eventOrder);
|
|
36
37
|
return [chunks, bgChunks, longChunks];
|
|
37
38
|
});
|
|
38
39
|
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
let chunk;
|
|
49
50
|
if (event && event.allDay && eventIntersects(event, start, end, resource)) {
|
|
50
51
|
chunk = createEventChunk(event, start, end);
|
|
51
|
-
prepareEventChunks([chunk], $hiddenDays);
|
|
52
|
+
prepareEventChunks([chunk], $hiddenDays, $eventOrder);
|
|
52
53
|
} else {
|
|
53
54
|
chunk = null;
|
|
54
55
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {isFunction, sortEventChunks} from '#lib';
|
|
2
2
|
|
|
3
|
-
export function groupEventChunks(chunks) {
|
|
3
|
+
export function groupEventChunks(chunks, $eventOrder) {
|
|
4
4
|
if (!chunks.length) {
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
sortEventChunks(chunks);
|
|
8
|
+
sortEventChunks(chunks, $eventOrder);
|
|
9
9
|
|
|
10
10
|
// Group
|
|
11
11
|
let group = {
|
package/src/storage/options.js
CHANGED