@event-calendar/core 4.5.1 → 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 +2 -1
- package/dist/index.js +82 -36
- 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/Body.svelte +2 -2
- package/src/plugins/resource-timeline/Days.svelte +8 -11
- package/src/plugins/resource-timeline/Label.svelte +11 -3
- package/src/plugins/resource-timeline/Sidebar.svelte +10 -3
- package/src/plugins/resource-timeline/index.js +1 -0
- 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/src/styles/timeline.scss +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
|
@@ -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
|
.ec {
|
|
@@ -185,6 +185,7 @@
|
|
|
185
185
|
}
|
|
186
186
|
.ec-timeline .ec-sidebar .ec-resource span {
|
|
187
187
|
padding-top: 8px;
|
|
188
|
+
height: fit-content;
|
|
188
189
|
}
|
|
189
190
|
|
|
190
191
|
.ec-time-grid .ec-body .ec-event {
|
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
|
}
|
|
@@ -5210,9 +5234,10 @@ function Label($$anchor, $$props) {
|
|
|
5210
5234
|
$.push($$props, true);
|
|
5211
5235
|
const [$$stores, $$cleanup] = $.setup_stores();
|
|
5212
5236
|
const $resourceLabelContent = () => $.store_get(resourceLabelContent, "$resourceLabelContent", $$stores);
|
|
5237
|
+
const $_resHs = () => $.store_get(_resHs, "$_resHs", $$stores);
|
|
5213
5238
|
const $resourceLabelDidMount = () => $.store_get(resourceLabelDidMount, "$resourceLabelDidMount", $$stores);
|
|
5214
5239
|
let date = $.prop($$props, "date", 3, void 0);
|
|
5215
|
-
let { resourceLabelContent, resourceLabelDidMount } = getContext("state");
|
|
5240
|
+
let { resourceLabelContent, resourceLabelDidMount, _resHs } = getContext("state");
|
|
5216
5241
|
let el = $.state(void 0);
|
|
5217
5242
|
let content = $.derived(() => {
|
|
5218
5243
|
if ($resourceLabelContent()) {
|
|
@@ -5224,6 +5249,13 @@ function Label($$anchor, $$props) {
|
|
|
5224
5249
|
return $$props.resource.title;
|
|
5225
5250
|
}
|
|
5226
5251
|
});
|
|
5252
|
+
$.user_effect(() => {
|
|
5253
|
+
$.get(content);
|
|
5254
|
+
untrack(() => {
|
|
5255
|
+
$_resHs().set($$props.resource, ceil(height($.get(el)) + 10));
|
|
5256
|
+
$.store_set(_resHs, $_resHs());
|
|
5257
|
+
});
|
|
5258
|
+
});
|
|
5227
5259
|
onMount(() => {
|
|
5228
5260
|
if (isFunction($resourceLabelDidMount())) {
|
|
5229
5261
|
$resourceLabelDidMount()({
|
|
@@ -5316,28 +5348,35 @@ $.delegate(["click"]);
|
|
|
5316
5348
|
var root_1$3 = $.from_html(`<div role="rowheader"><!> <!></div>`);
|
|
5317
5349
|
var root$5 = $.from_html(`<div><div></div> <div></div></div>`);
|
|
5318
5350
|
function Sidebar($$anchor, $$props) {
|
|
5319
|
-
$.push($$props,
|
|
5351
|
+
$.push($$props, true);
|
|
5320
5352
|
const [$$stores, $$cleanup] = $.setup_stores();
|
|
5353
|
+
const $_viewResources = () => $.store_get(_viewResources, "$_viewResources", $$stores);
|
|
5354
|
+
const $_resHs = () => $.store_get(_resHs, "$_resHs", $$stores);
|
|
5321
5355
|
const $_bodyEl = () => $.store_get(_bodyEl, "$_bodyEl", $$stores);
|
|
5322
5356
|
const $theme = () => $.store_get(theme, "$theme", $$stores);
|
|
5323
5357
|
const $_headerHeight = () => $.store_get(_headerHeight, "$_headerHeight", $$stores);
|
|
5324
5358
|
const $_sidebarEl = () => $.store_get(_sidebarEl, "$_sidebarEl", $$stores);
|
|
5325
|
-
const $
|
|
5326
|
-
const $_resHs = () => $.store_get(_resHs, "$_resHs", $$stores);
|
|
5359
|
+
const $_daysHs = () => $.store_get(_daysHs, "$_daysHs", $$stores);
|
|
5327
5360
|
const $_nestedResources = () => $.store_get(_nestedResources, "$_nestedResources", $$stores);
|
|
5328
5361
|
let {
|
|
5329
5362
|
_viewResources,
|
|
5330
5363
|
_headerHeight,
|
|
5331
5364
|
_bodyEl,
|
|
5365
|
+
_daysHs,
|
|
5332
5366
|
_resHs,
|
|
5333
5367
|
_sidebarEl,
|
|
5334
5368
|
_nestedResources,
|
|
5335
5369
|
theme
|
|
5336
5370
|
} = getContext("state");
|
|
5371
|
+
$.user_pre_effect(() => {
|
|
5372
|
+
$_viewResources();
|
|
5373
|
+
untrack(() => {
|
|
5374
|
+
$_resHs().clear();
|
|
5375
|
+
});
|
|
5376
|
+
});
|
|
5337
5377
|
function onwheel(jsEvent) {
|
|
5338
5378
|
$_bodyEl().scrollBy({ top: jsEvent.deltaY < 0 ? -30 : 30 });
|
|
5339
5379
|
}
|
|
5340
|
-
$.init();
|
|
5341
5380
|
var div = root$5();
|
|
5342
5381
|
var div_1 = $.child(div);
|
|
5343
5382
|
var div_2 = $.sibling(div_1, 2);
|
|
@@ -5368,7 +5407,9 @@ function Sidebar($$anchor, $$props) {
|
|
|
5368
5407
|
$.set_class(div_3, 1, $theme().resource);
|
|
5369
5408
|
$.set_style(div_3, `flex-basis: ${$0 ?? ""}px`);
|
|
5370
5409
|
},
|
|
5371
|
-
[
|
|
5410
|
+
[
|
|
5411
|
+
() => max($_daysHs().get($.get(resource)) ?? 0, $_resHs().get($.get(resource)) ?? 0, 34)
|
|
5412
|
+
]
|
|
5372
5413
|
);
|
|
5373
5414
|
$.append($$anchor2, div_3);
|
|
5374
5415
|
});
|
|
@@ -5500,11 +5541,11 @@ function Header($$anchor, $$props) {
|
|
|
5500
5541
|
$.pop();
|
|
5501
5542
|
$$cleanup();
|
|
5502
5543
|
}
|
|
5503
|
-
function prepareEventChunks(chunks, $_viewDates, $_dayTimeLimits, $slotDuration) {
|
|
5544
|
+
function prepareEventChunks(chunks, $_viewDates, $_dayTimeLimits, $slotDuration, $eventOrder) {
|
|
5504
5545
|
let longChunks = {};
|
|
5505
5546
|
let filteredChunks = [];
|
|
5506
5547
|
if (chunks.length) {
|
|
5507
|
-
sortEventChunks(chunks);
|
|
5548
|
+
sortEventChunks(chunks, $eventOrder);
|
|
5508
5549
|
let step = toSeconds($slotDuration);
|
|
5509
5550
|
let prevChunk;
|
|
5510
5551
|
for (let chunk of chunks) {
|
|
@@ -5843,21 +5884,24 @@ function Days($$anchor, $$props) {
|
|
|
5843
5884
|
const $_dayTimeLimits = () => $.store_get(_dayTimeLimits, "$_dayTimeLimits", $$stores);
|
|
5844
5885
|
const $_filteredEvents = () => $.store_get(_filteredEvents, "$_filteredEvents", $$stores);
|
|
5845
5886
|
const $slotDuration = () => $.store_get(slotDuration, "$slotDuration", $$stores);
|
|
5887
|
+
const $eventOrder = () => $.store_get(eventOrder, "$eventOrder", $$stores);
|
|
5846
5888
|
const $_iEvents = () => $.store_get(_iEvents, "$_iEvents", $$stores);
|
|
5847
|
-
const $
|
|
5889
|
+
const $_daysHs = () => $.store_get(_daysHs, "$_daysHs", $$stores);
|
|
5848
5890
|
const $theme = () => $.store_get(theme, "$theme", $$stores);
|
|
5891
|
+
const $_resHs = () => $.store_get(_resHs, "$_resHs", $$stores);
|
|
5849
5892
|
let {
|
|
5850
5893
|
_viewDates,
|
|
5851
5894
|
_filteredEvents,
|
|
5852
5895
|
_iEvents,
|
|
5853
|
-
_resHs,
|
|
5854
5896
|
_dayTimeLimits,
|
|
5897
|
+
_daysHs,
|
|
5898
|
+
_resHs,
|
|
5899
|
+
eventOrder,
|
|
5855
5900
|
slotDuration,
|
|
5856
5901
|
theme,
|
|
5857
5902
|
validRange
|
|
5858
5903
|
} = getContext("state");
|
|
5859
5904
|
let refs = [];
|
|
5860
|
-
let height2 = $.state(0);
|
|
5861
5905
|
let $$d = $.derived(() => {
|
|
5862
5906
|
let start2 = cloneDate(limitToRange($_viewDates()[0], $validRange()));
|
|
5863
5907
|
let end2 = cloneDate(limitToRange($_viewDates().at(-1), $validRange()));
|
|
@@ -5885,24 +5929,23 @@ function Days($$anchor, $$props) {
|
|
|
5885
5929
|
}
|
|
5886
5930
|
}
|
|
5887
5931
|
}
|
|
5888
|
-
[bgChunks2] = prepareEventChunks(bgChunks2, $_viewDates(), $_dayTimeLimits(), $slotDuration());
|
|
5889
|
-
[chunks2, longChunks2] = prepareEventChunks(chunks2, $_viewDates(), $_dayTimeLimits(), $slotDuration());
|
|
5932
|
+
[bgChunks2] = prepareEventChunks(bgChunks2, $_viewDates(), $_dayTimeLimits(), $slotDuration(), $eventOrder());
|
|
5933
|
+
[chunks2, longChunks2] = prepareEventChunks(chunks2, $_viewDates(), $_dayTimeLimits(), $slotDuration(), $eventOrder());
|
|
5890
5934
|
return [chunks2, bgChunks2, longChunks2];
|
|
5891
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]);
|
|
5892
5936
|
let iChunks = $.derived(() => $_iEvents().map((event) => {
|
|
5893
5937
|
let chunk;
|
|
5894
5938
|
if (event && eventIntersects(event, $.get(start), $.get(end), $$props.resource)) {
|
|
5895
5939
|
chunk = createEventChunk(event, $.get(start), $.get(end));
|
|
5896
|
-
[[chunk]] = prepareEventChunks([chunk], $_viewDates(), $_dayTimeLimits(), $slotDuration());
|
|
5940
|
+
[[chunk]] = prepareEventChunks([chunk], $_viewDates(), $_dayTimeLimits(), $slotDuration(), $eventOrder());
|
|
5897
5941
|
} else {
|
|
5898
5942
|
chunk = null;
|
|
5899
5943
|
}
|
|
5900
5944
|
return chunk;
|
|
5901
5945
|
}));
|
|
5902
5946
|
function reposition() {
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
$.store_set(_resHs, $_resHs());
|
|
5947
|
+
$_daysHs().set($$props.resource, ceil(max(...runReposition(refs, $_viewDates()))) + 10);
|
|
5948
|
+
$.store_set(_daysHs, $_daysHs());
|
|
5906
5949
|
}
|
|
5907
5950
|
var div = root$2();
|
|
5908
5951
|
$.each(div, 5, $_viewDates, $.index, ($$anchor2, date, i) => {
|
|
@@ -5938,7 +5981,9 @@ function Days($$anchor, $$props) {
|
|
|
5938
5981
|
$.set_class(div, 1, $theme().days);
|
|
5939
5982
|
$.set_style(div, `flex-basis: ${$0 ?? ""}px`);
|
|
5940
5983
|
},
|
|
5941
|
-
[
|
|
5984
|
+
[
|
|
5985
|
+
() => max($_daysHs().get($$props.resource) ?? 0, $_resHs().get($$props.resource) ?? 0, 34)
|
|
5986
|
+
]
|
|
5942
5987
|
);
|
|
5943
5988
|
$.append($$anchor, div);
|
|
5944
5989
|
var $$pop = $.pop({ reposition });
|
|
@@ -5956,7 +6001,7 @@ function Body($$anchor, $$props) {
|
|
|
5956
6001
|
const $scrollTime = () => $.store_get(scrollTime, "$scrollTime", $$stores);
|
|
5957
6002
|
const $slotDuration = () => $.store_get(slotDuration, "$slotDuration", $$stores);
|
|
5958
6003
|
const $slotWidth = () => $.store_get(slotWidth, "$slotWidth", $$stores);
|
|
5959
|
-
const $
|
|
6004
|
+
const $_daysHs = () => $.store_get(_daysHs, "$_daysHs", $$stores);
|
|
5960
6005
|
const $_viewResources = () => $.store_get(_viewResources, "$_viewResources", $$stores);
|
|
5961
6006
|
const $_filteredEvents = () => $.store_get(_filteredEvents, "$_filteredEvents", $$stores);
|
|
5962
6007
|
const $_headerEl = () => $.store_get(_headerEl, "$_headerEl", $$stores);
|
|
@@ -5974,7 +6019,7 @@ function Body($$anchor, $$props) {
|
|
|
5974
6019
|
_dayTimes,
|
|
5975
6020
|
_dayTimeLimits,
|
|
5976
6021
|
_recheckScrollable,
|
|
5977
|
-
|
|
6022
|
+
_daysHs,
|
|
5978
6023
|
_viewResources,
|
|
5979
6024
|
_viewDates,
|
|
5980
6025
|
scrollTime,
|
|
@@ -5994,7 +6039,7 @@ function Body($$anchor, $$props) {
|
|
|
5994
6039
|
untrack(scrollToTime);
|
|
5995
6040
|
});
|
|
5996
6041
|
function reposition() {
|
|
5997
|
-
$
|
|
6042
|
+
$_daysHs().clear();
|
|
5998
6043
|
runReposition(refs, $_viewResources());
|
|
5999
6044
|
}
|
|
6000
6045
|
$.user_effect(() => {
|
|
@@ -6219,6 +6264,7 @@ const index = {
|
|
|
6219
6264
|
state._headerHeight = writable(0);
|
|
6220
6265
|
state._dayTimeLimits = dayTimeLimits(state);
|
|
6221
6266
|
state._dayTimes = dayTimes(state);
|
|
6267
|
+
state._daysHs = writable(/* @__PURE__ */ new Map());
|
|
6222
6268
|
state._nestedResources = nestedResources(state);
|
|
6223
6269
|
state._resHs = writable(/* @__PURE__ */ new Map());
|
|
6224
6270
|
state._sidebarEl = writable(void 0);
|
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
|
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import Days from './Days.svelte';
|
|
6
6
|
|
|
7
7
|
let {_bodyEl, _bodyHeight, _bodyWidth, _bodyScrollLeft, _headerEl, _filteredEvents, _sidebarEl, _dayTimes, _dayTimeLimits,
|
|
8
|
-
_recheckScrollable,
|
|
8
|
+
_recheckScrollable, _daysHs, _viewResources, _viewDates, scrollTime, slotDuration, slotWidth, theme} = getContext('state');
|
|
9
9
|
|
|
10
10
|
let refs = [];
|
|
11
11
|
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
function reposition() {
|
|
24
|
-
$
|
|
24
|
+
$_daysHs.clear();
|
|
25
25
|
runReposition(refs, $_viewResources);
|
|
26
26
|
}
|
|
27
27
|
$effect(() => {
|
|
@@ -9,12 +9,10 @@
|
|
|
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
|
-
let height = $state(0);
|
|
18
16
|
|
|
19
17
|
let [start, end] = $derived.by(() => {
|
|
20
18
|
let start = cloneDate(limitToRange($_viewDates[0], $validRange));
|
|
@@ -44,8 +42,8 @@
|
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
44
|
}
|
|
47
|
-
[bgChunks] = prepareEventChunks(bgChunks, $_viewDates, $_dayTimeLimits, $slotDuration);
|
|
48
|
-
[chunks, longChunks] = prepareEventChunks(chunks, $_viewDates, $_dayTimeLimits, $slotDuration);
|
|
45
|
+
[bgChunks] = prepareEventChunks(bgChunks, $_viewDates, $_dayTimeLimits, $slotDuration, $eventOrder);
|
|
46
|
+
[chunks, longChunks] = prepareEventChunks(chunks, $_viewDates, $_dayTimeLimits, $slotDuration, $eventOrder);
|
|
49
47
|
return [chunks, bgChunks, longChunks];
|
|
50
48
|
});
|
|
51
49
|
|
|
@@ -53,7 +51,7 @@
|
|
|
53
51
|
let chunk;
|
|
54
52
|
if (event && eventIntersects(event, start, end, resource)) {
|
|
55
53
|
chunk = createEventChunk(event, start, end);
|
|
56
|
-
[[chunk]] = prepareEventChunks([chunk], $_viewDates, $_dayTimeLimits, $slotDuration);
|
|
54
|
+
[[chunk]] = prepareEventChunks([chunk], $_viewDates, $_dayTimeLimits, $slotDuration, $eventOrder);
|
|
57
55
|
} else {
|
|
58
56
|
chunk = null;
|
|
59
57
|
}
|
|
@@ -61,13 +59,12 @@
|
|
|
61
59
|
}));
|
|
62
60
|
|
|
63
61
|
export function reposition() {
|
|
64
|
-
|
|
65
|
-
$
|
|
66
|
-
$_resHs = $_resHs;
|
|
62
|
+
$_daysHs.set(resource, ceil(max(...runReposition(refs, $_viewDates))) + 10);
|
|
63
|
+
$_daysHs = $_daysHs;
|
|
67
64
|
}
|
|
68
65
|
</script>
|
|
69
66
|
|
|
70
|
-
<div class="{$theme.days}" style="flex-basis: {max(
|
|
67
|
+
<div class="{$theme.days}" style="flex-basis: {max($_daysHs.get(resource) ?? 0, $_resHs.get(resource) ?? 0, 34)}px" role="row">
|
|
71
68
|
{#each $_viewDates as date, i}
|
|
72
69
|
<!-- svelte-ignore binding_property_non_reactive -->
|
|
73
70
|
<Day {date} {resource} {chunks} {bgChunks} {longChunks} {iChunks} bind:this={refs[i]}/>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {getContext, onMount} from 'svelte';
|
|
3
|
-
import {setContent, toLocalDate, isFunction} from '#lib';
|
|
2
|
+
import {getContext, onMount, untrack} from 'svelte';
|
|
3
|
+
import {ceil, height, setContent, toLocalDate, isFunction} from '#lib';
|
|
4
4
|
|
|
5
5
|
let {resource, date = undefined} = $props();
|
|
6
6
|
|
|
7
|
-
let {resourceLabelContent, resourceLabelDidMount} = getContext('state');
|
|
7
|
+
let {resourceLabelContent, resourceLabelDidMount, _resHs} = getContext('state');
|
|
8
8
|
|
|
9
9
|
let el = $state();
|
|
10
10
|
// Content
|
|
@@ -21,6 +21,14 @@
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
+
$effect(() => {
|
|
25
|
+
content;
|
|
26
|
+
untrack(() => {
|
|
27
|
+
$_resHs.set(resource, ceil(height(el) + 10));
|
|
28
|
+
$_resHs = $_resHs;
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
24
32
|
onMount(() => {
|
|
25
33
|
if (isFunction($resourceLabelDidMount)) {
|
|
26
34
|
$resourceLabelDidMount({
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {getContext} from 'svelte';
|
|
2
|
+
import {getContext, untrack} from 'svelte';
|
|
3
3
|
import {max} from '#lib';
|
|
4
4
|
import Label from './Label.svelte';
|
|
5
5
|
import Expander from './Expander.svelte';
|
|
6
6
|
|
|
7
|
-
let {_viewResources, _headerHeight, _bodyEl, _resHs, _sidebarEl, _nestedResources, theme} = getContext('state');
|
|
7
|
+
let {_viewResources, _headerHeight, _bodyEl, _daysHs, _resHs, _sidebarEl, _nestedResources, theme} = getContext('state');
|
|
8
|
+
|
|
9
|
+
$effect.pre(() => {
|
|
10
|
+
$_viewResources;
|
|
11
|
+
untrack(() => {
|
|
12
|
+
$_resHs.clear();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
8
15
|
|
|
9
16
|
function onwheel(jsEvent) {
|
|
10
17
|
$_bodyEl.scrollBy({
|
|
@@ -17,7 +24,7 @@
|
|
|
17
24
|
<div class="{$theme.sidebarTitle}" style="flex-basis: {$_headerHeight}px"></div>
|
|
18
25
|
<div class="{$theme.content}" bind:this={$_sidebarEl} {onwheel}>
|
|
19
26
|
{#each $_viewResources as resource}
|
|
20
|
-
<div class="{$theme.resource}" style="flex-basis: {max($_resHs.get(resource) ?? 0, 34)}px" role="rowheader">
|
|
27
|
+
<div class="{$theme.resource}" style="flex-basis: {max($_daysHs.get(resource) ?? 0, $_resHs.get(resource) ?? 0, 34)}px" role="rowheader">
|
|
21
28
|
{#if $_nestedResources}
|
|
22
29
|
<Expander {resource} />
|
|
23
30
|
{/if}
|
|
@@ -58,6 +58,7 @@ export default {
|
|
|
58
58
|
state._headerHeight = writable(0);
|
|
59
59
|
state._dayTimeLimits = dayTimeLimits(state); // flexible time limits per day
|
|
60
60
|
state._dayTimes = dayTimes(state);
|
|
61
|
+
state._daysHs = writable(new Map()); // days row heights
|
|
61
62
|
state._nestedResources = nestedResources(state);
|
|
62
63
|
state._resHs = writable(new Map()); // resource row heights
|
|
63
64
|
state._sidebarEl = writable(undefined);
|
|
@@ -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