@event-calendar/core 5.0.4 → 5.0.5
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/dist/index.css +5 -7
- package/dist/index.js +56 -19
- package/package.json +1 -1
- package/src/plugins/day-grid/View.svelte +14 -3
- package/src/plugins/interaction/Action.svelte +4 -1
- package/src/plugins/resource-timeline/View.svelte +24 -5
- package/src/plugins/time-grid/View.svelte +22 -3
- package/src/storage/state.js +1 -0
- package/src/storage/stores.js +3 -18
- package/src/styles/index.css +1 -1
- package/src/styles/sidebar.css +2 -4
- package/src/styles/slots.css +1 -1
package/dist/index.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* EventCalendar v5.0.
|
|
2
|
+
* EventCalendar v5.0.5
|
|
3
3
|
* https://github.com/vkurko/calendar
|
|
4
4
|
*/
|
|
5
5
|
.ec {
|
|
@@ -276,14 +276,12 @@
|
|
|
276
276
|
inset-inline-start: 0;
|
|
277
277
|
z-index: 1;
|
|
278
278
|
background-color: var(--ec-bg-color);
|
|
279
|
-
border-
|
|
280
|
-
border-width: 1px;
|
|
281
|
-
border-inline-end-style: solid;
|
|
279
|
+
border-inline-end: 1px solid var(--ec-border-color);
|
|
282
280
|
text-align: end;
|
|
283
281
|
overflow: clip;
|
|
284
282
|
|
|
285
283
|
.ec-header & {
|
|
286
|
-
border-block-end
|
|
284
|
+
border-block-end: 1px solid var(--ec-border-color);
|
|
287
285
|
padding-block: .375rem;
|
|
288
286
|
}
|
|
289
287
|
|
|
@@ -344,7 +342,7 @@
|
|
|
344
342
|
.ec-time-grid & {
|
|
345
343
|
block-size: calc(var(--ec-slot-height) * var(--ec-slot-label-periodicity));
|
|
346
344
|
position: relative;
|
|
347
|
-
inset-block-start: -.
|
|
345
|
+
inset-block-start: -.5lh;
|
|
348
346
|
}
|
|
349
347
|
|
|
350
348
|
.ec-timeline & {
|
|
@@ -653,7 +651,7 @@
|
|
|
653
651
|
|
|
654
652
|
.ec-timeline & {
|
|
655
653
|
grid-template-columns: max-content repeat(var(--ec-grid-cols), min-content);
|
|
656
|
-
grid-template-rows: max-content
|
|
654
|
+
grid-template-rows: max-content var(--ec-grid-rows);
|
|
657
655
|
flex-grow: 1;
|
|
658
656
|
}
|
|
659
657
|
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* EventCalendar v5.0.
|
|
2
|
+
* EventCalendar v5.0.5
|
|
3
3
|
* https://github.com/vkurko/calendar
|
|
4
4
|
*/
|
|
5
5
|
import { tick, getContext, untrack, setContext, onMount, mount, unmount } from "svelte";
|
|
@@ -888,21 +888,9 @@ function dayGrid(state) {
|
|
|
888
888
|
}
|
|
889
889
|
function activeRange(state) {
|
|
890
890
|
return derived(
|
|
891
|
-
[state._currentRange, state.
|
|
892
|
-
([$_currentRange, $
|
|
893
|
-
|
|
894
|
-
let end = cloneDate($_currentRange.end);
|
|
895
|
-
if ($_dayGrid) {
|
|
896
|
-
prevClosestDay(start, $firstDay);
|
|
897
|
-
nextClosestDay(end, $firstDay);
|
|
898
|
-
} else if ($slotMaxTime.days || $slotMaxTime.seconds > DAY_IN_SECONDS) {
|
|
899
|
-
addDuration(subtractDay(end), $slotMaxTime);
|
|
900
|
-
let start2 = subtractDay(cloneDate(end));
|
|
901
|
-
if (start2 < start) {
|
|
902
|
-
start = start2;
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
return { start, end };
|
|
891
|
+
[state._currentRange, state._activeRangeExt],
|
|
892
|
+
([$_currentRange, $_activeRangeExt]) => {
|
|
893
|
+
return $_activeRangeExt({ start: cloneDate($_currentRange.start), end: cloneDate($_currentRange.end) });
|
|
906
894
|
}
|
|
907
895
|
);
|
|
908
896
|
}
|
|
@@ -1094,6 +1082,7 @@ class State {
|
|
|
1094
1082
|
this._auxiliary = writable([]);
|
|
1095
1083
|
this._dayGrid = dayGrid(this);
|
|
1096
1084
|
this._currentRange = currentRange(this);
|
|
1085
|
+
this._activeRangeExt = writable(identity);
|
|
1097
1086
|
this._activeRange = activeRange(this);
|
|
1098
1087
|
this._fetchedRange = writable({ start: void 0, end: void 0 });
|
|
1099
1088
|
this._events = events(this);
|
|
@@ -2486,6 +2475,7 @@ function View$3($$anchor, $$props) {
|
|
|
2486
2475
|
const $highlightedDates = () => $.store_get(highlightedDates, "$highlightedDates", $$stores);
|
|
2487
2476
|
const $_filteredEvents = () => $.store_get(_filteredEvents, "$_filteredEvents", $$stores);
|
|
2488
2477
|
const $_iEvents = () => $.store_get(_iEvents, "$_iEvents", $$stores);
|
|
2478
|
+
const $firstDay = () => $.store_get(firstDay, "$firstDay", $$stores);
|
|
2489
2479
|
const $_hiddenChunks = () => $.store_get(_hiddenChunks, "$_hiddenChunks", $$stores);
|
|
2490
2480
|
const $_mainEl = () => $.store_get(_mainEl, "$_mainEl", $$stores);
|
|
2491
2481
|
const $theme = () => $.store_get(theme, "$theme", $$stores);
|
|
@@ -2495,6 +2485,7 @@ function View$3($$anchor, $$props) {
|
|
|
2495
2485
|
const $_popupDay = () => $.store_get(_popupDay, "$_popupDay", $$stores);
|
|
2496
2486
|
const [$$stores, $$cleanup] = $.setup_stores();
|
|
2497
2487
|
let {
|
|
2488
|
+
_activeRangeExt,
|
|
2498
2489
|
_mainEl,
|
|
2499
2490
|
_colsCount,
|
|
2500
2491
|
_filteredEvents,
|
|
@@ -2505,6 +2496,7 @@ function View$3($$anchor, $$props) {
|
|
|
2505
2496
|
_popupDay,
|
|
2506
2497
|
_viewDates,
|
|
2507
2498
|
dayMaxEvents,
|
|
2499
|
+
firstDay,
|
|
2508
2500
|
highlightedDates,
|
|
2509
2501
|
theme,
|
|
2510
2502
|
validRange
|
|
@@ -2513,6 +2505,15 @@ function View$3($$anchor, $$props) {
|
|
|
2513
2505
|
let grid = $.derived(() => createGrid$3($_viewDates(), $_colsCount(), $validRange(), $highlightedDates()));
|
|
2514
2506
|
let $$d = $.derived(() => createEventChunks$2($_filteredEvents(), $.get(grid))), chunks = $.derived(() => $.get($$d).chunks), bgChunks = $.derived(() => $.get($$d).bgChunks);
|
|
2515
2507
|
let iChunks = $.derived(() => createIEventChunks$2($_iEvents(), $.get(grid)));
|
|
2508
|
+
$.user_pre_effect(() => {
|
|
2509
|
+
$.store_set(_activeRangeExt, ({ start, end }) => ({
|
|
2510
|
+
start: prevClosestDay(start, $firstDay()),
|
|
2511
|
+
end: nextClosestDay(end, $firstDay())
|
|
2512
|
+
}));
|
|
2513
|
+
return () => {
|
|
2514
|
+
$.store_set(_activeRangeExt, identity);
|
|
2515
|
+
};
|
|
2516
|
+
});
|
|
2516
2517
|
let refs = [];
|
|
2517
2518
|
function reposition() {
|
|
2518
2519
|
$.store_set(_hiddenChunks, {});
|
|
@@ -3107,7 +3108,7 @@ function Action($$anchor, $$props) {
|
|
|
3107
3108
|
return findPayload(dayEl.previousElementSibling);
|
|
3108
3109
|
}
|
|
3109
3110
|
} else {
|
|
3110
|
-
if (selecting() && payload.resource && !$_iEvents()[0].resourceIds.includes(payload.resource.id) && !timelineView($view())) {
|
|
3111
|
+
if ((selecting() || resizing()) && payload.resource && !$_iEvents()[0].resourceIds.includes(payload.resource.id) && !timelineView($view())) {
|
|
3111
3112
|
if (toX > fromX) {
|
|
3112
3113
|
return findPayload(dayEl.previousElementSibling);
|
|
3113
3114
|
} else {
|
|
@@ -4307,6 +4308,7 @@ function View$1($$anchor, $$props) {
|
|
|
4307
4308
|
const $highlightedDates = () => $.store_get(highlightedDates, "$highlightedDates", $$stores);
|
|
4308
4309
|
const $_filteredEvents = () => $.store_get(_filteredEvents, "$_filteredEvents", $$stores);
|
|
4309
4310
|
const $_iEvents = () => $.store_get(_iEvents, "$_iEvents", $$stores);
|
|
4311
|
+
const $slotMaxTime = () => $.store_get(slotMaxTime, "$slotMaxTime", $$stores);
|
|
4310
4312
|
const $scrollTime = () => $.store_get(scrollTime, "$scrollTime", $$stores);
|
|
4311
4313
|
const $_mainEl = () => $.store_get(_mainEl, "$_mainEl", $$stores);
|
|
4312
4314
|
const $slotDuration = () => $.store_get(slotDuration, "$slotDuration", $$stores);
|
|
@@ -4320,6 +4322,7 @@ function View$1($$anchor, $$props) {
|
|
|
4320
4322
|
const $showNowIndicator = () => $.store_get(showNowIndicator, "$showNowIndicator", $$stores);
|
|
4321
4323
|
const [$$stores, $$cleanup] = $.setup_stores();
|
|
4322
4324
|
let {
|
|
4325
|
+
_activeRangeExt,
|
|
4323
4326
|
_mainEl,
|
|
4324
4327
|
_filteredEvents,
|
|
4325
4328
|
_iEvents,
|
|
@@ -4336,6 +4339,7 @@ function View$1($$anchor, $$props) {
|
|
|
4336
4339
|
scrollTime,
|
|
4337
4340
|
slotHeight,
|
|
4338
4341
|
slotDuration,
|
|
4342
|
+
slotMaxTime,
|
|
4339
4343
|
theme,
|
|
4340
4344
|
validRange
|
|
4341
4345
|
} = getContext("state");
|
|
@@ -4344,6 +4348,21 @@ function View$1($$anchor, $$props) {
|
|
|
4344
4348
|
let grid = $.derived(() => $$props.createGridFn?.() ?? createGrid$1($_viewDates(), $_slotTimeLimits(), $validRange(), $highlightedDates()));
|
|
4345
4349
|
let $$d = $.derived(() => createEventChunks$1($_filteredEvents(), $.get(grid))), chunks = $.derived(() => $.get($$d).chunks), bgChunks = $.derived(() => $.get($$d).bgChunks), allDayChunks = $.derived(() => $.get($$d).allDayChunks), allDayBgChunks = $.derived(() => $.get($$d).allDayBgChunks);
|
|
4346
4350
|
let $$d_1 = $.derived(() => createIEventChunks$1($_iEvents(), $.get(grid))), iChunks = $.derived(() => $.get($$d_1).iChunks), allDayIChunks = $.derived(() => $.get($$d_1).allDayIChunks);
|
|
4351
|
+
$.user_pre_effect(() => {
|
|
4352
|
+
$.store_set(_activeRangeExt, ({ start, end }) => {
|
|
4353
|
+
if ($slotMaxTime().days || $slotMaxTime().seconds > DAY_IN_SECONDS) {
|
|
4354
|
+
addDuration(subtractDay(end), $slotMaxTime());
|
|
4355
|
+
let start2 = subtractDay(cloneDate(end));
|
|
4356
|
+
if (start2 < start) {
|
|
4357
|
+
start = start2;
|
|
4358
|
+
}
|
|
4359
|
+
}
|
|
4360
|
+
return { start, end };
|
|
4361
|
+
});
|
|
4362
|
+
return () => {
|
|
4363
|
+
$.store_set(_activeRangeExt, identity);
|
|
4364
|
+
};
|
|
4365
|
+
});
|
|
4347
4366
|
$.user_effect(() => {
|
|
4348
4367
|
$_viewDates();
|
|
4349
4368
|
$scrollTime();
|
|
@@ -5313,6 +5332,7 @@ function View($$anchor, $$props) {
|
|
|
5313
5332
|
const $highlightedDates = () => $.store_get(highlightedDates, "$highlightedDates", $$stores);
|
|
5314
5333
|
const $_filteredEvents = () => $.store_get(_filteredEvents, "$_filteredEvents", $$stores);
|
|
5315
5334
|
const $_iEvents = () => $.store_get(_iEvents, "$_iEvents", $$stores);
|
|
5335
|
+
const $slotMaxTime = () => $.store_get(slotMaxTime, "$slotMaxTime", $$stores);
|
|
5316
5336
|
const $scrollTime = () => $.store_get(scrollTime, "$scrollTime", $$stores);
|
|
5317
5337
|
const $_monthView = () => $.store_get(_monthView, "$_monthView", $$stores);
|
|
5318
5338
|
const $_today = () => $.store_get(_today, "$_today", $$stores);
|
|
@@ -5329,6 +5349,7 @@ function View($$anchor, $$props) {
|
|
|
5329
5349
|
const $nowIndicator = () => $.store_get(nowIndicator, "$nowIndicator", $$stores);
|
|
5330
5350
|
const [$$stores, $$cleanup] = $.setup_stores();
|
|
5331
5351
|
let {
|
|
5352
|
+
_activeRangeExt,
|
|
5332
5353
|
_daySlots,
|
|
5333
5354
|
_dayTimeLimits,
|
|
5334
5355
|
_filteredEvents,
|
|
@@ -5347,6 +5368,7 @@ function View($$anchor, $$props) {
|
|
|
5347
5368
|
scrollTime,
|
|
5348
5369
|
slotDuration,
|
|
5349
5370
|
slotHeight,
|
|
5371
|
+
slotMaxTime,
|
|
5350
5372
|
slotWidth,
|
|
5351
5373
|
theme,
|
|
5352
5374
|
validRange
|
|
@@ -5355,6 +5377,21 @@ function View($$anchor, $$props) {
|
|
|
5355
5377
|
let grid = $.derived(() => createGrid($_viewDates(), $_viewResources(), $_dayTimeLimits(), $validRange(), $highlightedDates()));
|
|
5356
5378
|
let $$d = $.derived(() => createEventChunks($_filteredEvents(), $.get(grid))), chunks = $.derived(() => $.get($$d).chunks), bgChunks = $.derived(() => $.get($$d).bgChunks);
|
|
5357
5379
|
let iChunks = $.derived(() => createIEventChunks($_iEvents(), $.get(grid)));
|
|
5380
|
+
$.user_pre_effect(() => {
|
|
5381
|
+
$.store_set(_activeRangeExt, ({ start, end }) => {
|
|
5382
|
+
if ($slotMaxTime().days || $slotMaxTime().seconds > DAY_IN_SECONDS) {
|
|
5383
|
+
addDuration(subtractDay(end), $slotMaxTime());
|
|
5384
|
+
let start2 = subtractDay(cloneDate(end));
|
|
5385
|
+
if (start2 < start) {
|
|
5386
|
+
start = start2;
|
|
5387
|
+
}
|
|
5388
|
+
}
|
|
5389
|
+
return { start, end };
|
|
5390
|
+
});
|
|
5391
|
+
return () => {
|
|
5392
|
+
$.store_set(_activeRangeExt, identity);
|
|
5393
|
+
};
|
|
5394
|
+
});
|
|
5358
5395
|
$.user_effect(() => {
|
|
5359
5396
|
$_viewDates();
|
|
5360
5397
|
$scrollTime();
|
|
@@ -5375,7 +5412,7 @@ function View($$anchor, $$props) {
|
|
|
5375
5412
|
scrollLeft += toSeconds(slotTimeLimits2.max) - toSeconds(slotTimeLimits2.min);
|
|
5376
5413
|
}
|
|
5377
5414
|
}
|
|
5378
|
-
$.store_mutate(_mainEl, $.untrack($_mainEl).scrollLeft = scrollLeft / toSeconds($slotDuration()) * $slotWidth() * (
|
|
5415
|
+
$.store_mutate(_mainEl, $.untrack($_mainEl).scrollLeft = scrollLeft / toSeconds($slotDuration()) * $slotWidth() * (isRtl() ? -1 : 1), $.untrack($_mainEl));
|
|
5379
5416
|
}
|
|
5380
5417
|
let refs = [];
|
|
5381
5418
|
function reposition() {
|
|
@@ -5569,7 +5606,7 @@ function View($$anchor, $$props) {
|
|
|
5569
5606
|
$.set_class(section, 1, $theme().main);
|
|
5570
5607
|
styles = $.set_style(section, "", styles, {
|
|
5571
5608
|
"--ec-grid-cols": $.get(grid)[0].length,
|
|
5572
|
-
"--ec-grid-rows": $.get(grid).length,
|
|
5609
|
+
"--ec-grid-rows": `${$.get(grid).length > 1 ? `repeat(${$.get(grid).length - 1}, auto)` : ""} minmax(auto, 1fr)`,
|
|
5573
5610
|
"--ec-col-width": $columnWidth() ?? "minmax(4em, 1fr)",
|
|
5574
5611
|
"--ec-slot-label-periodicity": $_slotLabelPeriodicity(),
|
|
5575
5612
|
"--ec-slot-height": `${$slotHeight() ?? ""}px`,
|
package/package.json
CHANGED
|
@@ -1,19 +1,30 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext} from 'svelte';
|
|
3
|
-
import {contentFrom, resizeObserver, runReposition} from '#lib';
|
|
3
|
+
import {contentFrom, identity, nextClosestDay, prevClosestDay, resizeObserver, runReposition} from '#lib';
|
|
4
4
|
import Day from './Day.svelte';
|
|
5
5
|
import Event from './Event.svelte';
|
|
6
6
|
import Popup from './Popup.svelte';
|
|
7
7
|
import {createEventChunks, createIEventChunks, createGrid} from './lib.js';
|
|
8
8
|
|
|
9
|
-
let {_mainEl, _colsCount, _filteredEvents, _hiddenChunks, _iEvents, _intlDayHeader,
|
|
10
|
-
_viewDates, dayMaxEvents, highlightedDates, theme,
|
|
9
|
+
let {_activeRangeExt, _mainEl, _colsCount, _filteredEvents, _hiddenChunks, _iEvents, _intlDayHeader,
|
|
10
|
+
_intlDayHeaderAL, _popupDay, _viewDates, dayMaxEvents, firstDay, highlightedDates, theme,
|
|
11
|
+
validRange} = getContext('state');
|
|
11
12
|
|
|
12
13
|
let gridEl = $state();
|
|
13
14
|
let grid = $derived(createGrid($_viewDates, $_colsCount, $validRange, $highlightedDates));
|
|
14
15
|
let {chunks, bgChunks} = $derived(createEventChunks($_filteredEvents, grid));
|
|
15
16
|
let iChunks = $derived(createIEventChunks($_iEvents, grid));
|
|
16
17
|
|
|
18
|
+
$effect.pre(() => {
|
|
19
|
+
$_activeRangeExt = ({start, end}) => ({
|
|
20
|
+
start: prevClosestDay(start, $firstDay),
|
|
21
|
+
end: nextClosestDay(end, $firstDay)
|
|
22
|
+
});
|
|
23
|
+
return () => {
|
|
24
|
+
$_activeRangeExt = identity;
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
|
|
17
28
|
// Events reposition
|
|
18
29
|
let refs = [];
|
|
19
30
|
function reposition() {
|
|
@@ -417,7 +417,10 @@
|
|
|
417
417
|
return findPayload(dayEl.previousElementSibling);
|
|
418
418
|
}
|
|
419
419
|
} else {
|
|
420
|
-
if (
|
|
420
|
+
if (
|
|
421
|
+
(selecting() || resizing()) &&
|
|
422
|
+
payload.resource && !$_iEvents[0].resourceIds.includes(payload.resource.id) && !timelineView($view)
|
|
423
|
+
) {
|
|
421
424
|
if (toX > fromX) {
|
|
422
425
|
return findPayload(dayEl.previousElementSibling);
|
|
423
426
|
} else {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext, tick} from 'svelte';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
max, resizeObserver, runReposition, contentFrom, toSeconds, datesEqual, min, isRtl, DAY_IN_SECONDS, addDuration,
|
|
5
|
+
subtractDay, cloneDate, identity
|
|
6
|
+
} from "#lib";
|
|
4
7
|
import {createGrid, createEventChunks, createIEventChunks, getSlotTimeLimits} from './lib.js';
|
|
5
8
|
import {ColHead, DayHeader} from '#components';
|
|
6
9
|
import Day from './Day.svelte';
|
|
@@ -9,9 +12,9 @@
|
|
|
9
12
|
import Expander from './Expander.svelte';
|
|
10
13
|
import NowIndicator from './NowIndicator.svelte';
|
|
11
14
|
|
|
12
|
-
let {_daySlots, _dayTimeLimits, _filteredEvents, _iEvents, _mainEl, _monthView, _nestedResources, _sidebarWidth,
|
|
15
|
+
let {_activeRangeExt, _daySlots, _dayTimeLimits, _filteredEvents, _iEvents, _mainEl, _monthView, _nestedResources, _sidebarWidth,
|
|
13
16
|
_slotLabelPeriodicity, _today, _viewResources, _viewDates, columnWidth, highlightedDates, nowIndicator, scrollTime,
|
|
14
|
-
slotDuration, slotHeight, slotWidth, theme, validRange} = getContext('state');
|
|
17
|
+
slotDuration, slotHeight, slotMaxTime, slotWidth, theme, validRange} = getContext('state');
|
|
15
18
|
|
|
16
19
|
let headerHeight = $state(0);
|
|
17
20
|
|
|
@@ -19,6 +22,22 @@
|
|
|
19
22
|
let {chunks, bgChunks} = $derived(createEventChunks($_filteredEvents, grid));
|
|
20
23
|
let iChunks = $derived(createIEventChunks($_iEvents, grid));
|
|
21
24
|
|
|
25
|
+
$effect.pre(() => {
|
|
26
|
+
$_activeRangeExt = ({start, end}) => {
|
|
27
|
+
if ($slotMaxTime.days || $slotMaxTime.seconds > DAY_IN_SECONDS) {
|
|
28
|
+
addDuration(subtractDay(end), $slotMaxTime);
|
|
29
|
+
let start2 = subtractDay(cloneDate(end));
|
|
30
|
+
if (start2 < start) {
|
|
31
|
+
start = start2;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return {start, end};
|
|
35
|
+
};
|
|
36
|
+
return () => {
|
|
37
|
+
$_activeRangeExt = identity;
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
|
|
22
41
|
// Handle scrollTime
|
|
23
42
|
$effect(() => {
|
|
24
43
|
$_viewDates;
|
|
@@ -43,7 +62,7 @@
|
|
|
43
62
|
scrollLeft += toSeconds(slotTimeLimits.max) - toSeconds(slotTimeLimits.min);
|
|
44
63
|
}
|
|
45
64
|
}
|
|
46
|
-
$_mainEl.scrollLeft = scrollLeft / toSeconds($slotDuration) * $slotWidth * (
|
|
65
|
+
$_mainEl.scrollLeft = scrollLeft / toSeconds($slotDuration) * $slotWidth * (isRtl() ? -1 : 1);
|
|
47
66
|
}
|
|
48
67
|
|
|
49
68
|
// Events reposition
|
|
@@ -58,7 +77,7 @@
|
|
|
58
77
|
bind:this={$_mainEl}
|
|
59
78
|
class="{$theme.main}"
|
|
60
79
|
style:--ec-grid-cols="{grid[0].length}"
|
|
61
|
-
style:--ec-grid-rows="{grid.length}"
|
|
80
|
+
style:--ec-grid-rows="{grid.length > 1 ? `repeat(${grid.length - 1}, auto)` : ''} minmax(auto, 1fr)"
|
|
62
81
|
style:--ec-col-width="{$columnWidth ?? 'minmax(4em, 1fr)'}"
|
|
63
82
|
style:--ec-slot-label-periodicity="{$_slotLabelPeriodicity}"
|
|
64
83
|
style:--ec-slot-height="{$slotHeight}px"
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext, tick} from 'svelte';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
addDuration, cloneDate, contentFrom, DAY_IN_SECONDS, identity, resizeObserver, runReposition, subtractDay,
|
|
5
|
+
toSeconds
|
|
6
|
+
} from '#lib';
|
|
4
7
|
import {createAllDayContent, createGrid, createEventChunks, createIEventChunks} from './lib.js';
|
|
5
8
|
import {ColHead, DayHeader} from '#components';
|
|
6
9
|
import Day from './Day.svelte';
|
|
@@ -10,9 +13,9 @@
|
|
|
10
13
|
|
|
11
14
|
let {header, nowIndicator, createGridFn} = $props();
|
|
12
15
|
|
|
13
|
-
let {_mainEl, _filteredEvents, _iEvents, _sidebarWidth, _slotLabelPeriodicity, _slotTimeLimits, _slots,
|
|
16
|
+
let {_activeRangeExt, _mainEl, _filteredEvents, _iEvents, _sidebarWidth, _slotLabelPeriodicity, _slotTimeLimits, _slots,
|
|
14
17
|
_viewDates, allDayContent, allDaySlot, columnWidth, highlightedDates, nowIndicator: showNowIndicator,
|
|
15
|
-
scrollTime, slotHeight, slotDuration, theme, validRange} = getContext('state');
|
|
18
|
+
scrollTime, slotHeight, slotDuration, slotMaxTime, theme, validRange} = getContext('state');
|
|
16
19
|
|
|
17
20
|
let headerHeight = $state(0);
|
|
18
21
|
let allDayText = $derived(createAllDayContent($allDayContent));
|
|
@@ -21,6 +24,22 @@
|
|
|
21
24
|
let {chunks, bgChunks, allDayChunks, allDayBgChunks} = $derived(createEventChunks($_filteredEvents, grid));
|
|
22
25
|
let {iChunks, allDayIChunks} = $derived(createIEventChunks($_iEvents, grid));
|
|
23
26
|
|
|
27
|
+
$effect.pre(() => {
|
|
28
|
+
$_activeRangeExt = ({start, end}) => {
|
|
29
|
+
if ($slotMaxTime.days || $slotMaxTime.seconds > DAY_IN_SECONDS) {
|
|
30
|
+
addDuration(subtractDay(end), $slotMaxTime);
|
|
31
|
+
let start2 = subtractDay(cloneDate(end));
|
|
32
|
+
if (start2 < start) {
|
|
33
|
+
start = start2;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return {start, end};
|
|
37
|
+
};
|
|
38
|
+
return () => {
|
|
39
|
+
$_activeRangeExt = identity;
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
24
43
|
// Handle scrollTime
|
|
25
44
|
$effect(() => {
|
|
26
45
|
$_viewDates;
|
package/src/storage/state.js
CHANGED
|
@@ -27,6 +27,7 @@ export default class {
|
|
|
27
27
|
this._auxiliary = writable([]); // auxiliary components
|
|
28
28
|
this._dayGrid = dayGrid(this);
|
|
29
29
|
this._currentRange = currentRange(this);
|
|
30
|
+
this._activeRangeExt = writable(identity);
|
|
30
31
|
this._activeRange = activeRange(this);
|
|
31
32
|
this._fetchedRange = writable({start: undefined, end: undefined});
|
|
32
33
|
this._events = events(this);
|
package/src/storage/stores.js
CHANGED
|
@@ -11,24 +11,9 @@ export function dayGrid(state) {
|
|
|
11
11
|
|
|
12
12
|
export function activeRange(state) {
|
|
13
13
|
return derived(
|
|
14
|
-
[state._currentRange, state.
|
|
15
|
-
([$_currentRange, $
|
|
16
|
-
|
|
17
|
-
let end = cloneDate($_currentRange.end);
|
|
18
|
-
|
|
19
|
-
if ($_dayGrid) {
|
|
20
|
-
// First day of week
|
|
21
|
-
prevClosestDay(start, $firstDay);
|
|
22
|
-
nextClosestDay(end, $firstDay);
|
|
23
|
-
} else if ($slotMaxTime.days || $slotMaxTime.seconds > DAY_IN_SECONDS) {
|
|
24
|
-
addDuration(subtractDay(end), $slotMaxTime);
|
|
25
|
-
let start2 = subtractDay(cloneDate(end));
|
|
26
|
-
if (start2 < start) {
|
|
27
|
-
start = start2;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return {start, end};
|
|
14
|
+
[state._currentRange, state._activeRangeExt],
|
|
15
|
+
([$_currentRange, $_activeRangeExt]) => {
|
|
16
|
+
return $_activeRangeExt({start: cloneDate($_currentRange.start), end: cloneDate($_currentRange.end)});
|
|
32
17
|
}
|
|
33
18
|
);
|
|
34
19
|
}
|
package/src/styles/index.css
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
.ec-timeline & {
|
|
39
39
|
grid-template-columns: max-content repeat(var(--ec-grid-cols), min-content);
|
|
40
|
-
grid-template-rows: max-content
|
|
40
|
+
grid-template-rows: max-content var(--ec-grid-rows);
|
|
41
41
|
flex-grow: 1;
|
|
42
42
|
}
|
|
43
43
|
|
package/src/styles/sidebar.css
CHANGED
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
inset-inline-start: 0;
|
|
4
4
|
z-index: 1;
|
|
5
5
|
background-color: var(--ec-bg-color);
|
|
6
|
-
border-
|
|
7
|
-
border-width: 1px;
|
|
8
|
-
border-inline-end-style: solid;
|
|
6
|
+
border-inline-end: 1px solid var(--ec-border-color);
|
|
9
7
|
text-align: end;
|
|
10
8
|
overflow: clip;
|
|
11
9
|
|
|
12
10
|
.ec-header & {
|
|
13
|
-
border-block-end
|
|
11
|
+
border-block-end: 1px solid var(--ec-border-color);
|
|
14
12
|
padding-block: .375rem;
|
|
15
13
|
}
|
|
16
14
|
|