@event-calendar/core 5.1.1 → 5.1.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 +14 -2
- package/dist/index.css +1 -1
- package/dist/index.js +29 -18
- package/package.json +1 -1
- package/src/Calendar.svelte +3 -1
- package/src/storage/effects.js +1 -1
- package/src/storage/options.svelte.js +6 -5
- package/src/storage/state.svelte.js +1 -1
package/README.md
CHANGED
|
@@ -246,8 +246,8 @@ This bundle contains a version of the calendar that includes all plugins and is
|
|
|
246
246
|
|
|
247
247
|
The first step is to include the following lines of code in the `<head>` section of your page:
|
|
248
248
|
```html
|
|
249
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@5.1.
|
|
250
|
-
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@5.1.
|
|
249
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@5.1.3/dist/event-calendar.min.css">
|
|
250
|
+
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@5.1.3/dist/event-calendar.min.js"></script>
|
|
251
251
|
```
|
|
252
252
|
|
|
253
253
|
<details>
|
|
@@ -2490,6 +2490,18 @@ The mounted [View](#view-object) object
|
|
|
2490
2490
|
|
|
2491
2491
|
You can specify options that apply only to specific views. To do so provide separate options objects within the `views` option, keyed by the name of the view.
|
|
2492
2492
|
|
|
2493
|
+
If you want to create a custom view, you can use the `type` property to inherit options from a standard view.
|
|
2494
|
+
|
|
2495
|
+
```js
|
|
2496
|
+
views: {
|
|
2497
|
+
resourceTimelineThreeDays: {
|
|
2498
|
+
type: 'resourceTimelineDay',
|
|
2499
|
+
duration: {days: 3}
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
```
|
|
2503
|
+
|
|
2504
|
+
|
|
2493
2505
|
### weekNumberContent
|
|
2494
2506
|
- Type `Content` or `function`
|
|
2495
2507
|
- Default `undefined`
|
package/dist/index.css
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* EventCalendar v5.1.
|
|
2
|
+
* EventCalendar v5.1.3
|
|
3
3
|
* https://github.com/vkurko/calendar
|
|
4
4
|
*/
|
|
5
5
|
import { untrack, getAbortSignal, tick, getContext, setContext, onMount, mount, unmount } from "svelte";
|
|
@@ -845,8 +845,8 @@ function optionsState(mainState, plugins, userOptions) {
|
|
|
845
845
|
let parsers = createParsers(plugins);
|
|
846
846
|
defOptions = parseOptions(defOptions, parsers);
|
|
847
847
|
userOptions = parseOptions(userOptions, parsers);
|
|
848
|
-
let
|
|
849
|
-
let
|
|
848
|
+
let defViewsOptions = extractOption(defOptions, "views") ?? {};
|
|
849
|
+
let userViewsOptions = extractOption(userOptions, "views") ?? {};
|
|
850
850
|
let options = new SvelteMap();
|
|
851
851
|
setOptions(options, defOptions);
|
|
852
852
|
let setters = {};
|
|
@@ -855,10 +855,11 @@ function optionsState(mainState, plugins, userOptions) {
|
|
|
855
855
|
if (userOptions.view) {
|
|
856
856
|
options.set("view", userOptions.view);
|
|
857
857
|
}
|
|
858
|
-
let views = /* @__PURE__ */ new Set([...keys(
|
|
858
|
+
let views = /* @__PURE__ */ new Set([...keys(defViewsOptions), ...keys(userViewsOptions)]);
|
|
859
859
|
for (let view2 of views) {
|
|
860
|
-
let
|
|
861
|
-
let
|
|
860
|
+
let userViewOptions = userViewsOptions[view2] ?? {};
|
|
861
|
+
let defOpts = mergeOpts(defOptions, defViewsOptions[view2] ?? defViewsOptions[userViewOptions.type] ?? {});
|
|
862
|
+
let opts = mergeOpts(defOpts, userOptions, userViewOptions);
|
|
862
863
|
let component = extractOption(opts, "component");
|
|
863
864
|
delete opts.view;
|
|
864
865
|
for (let key of keys(opts)) {
|
|
@@ -1012,7 +1013,7 @@ function loadEvents(mainState) {
|
|
|
1012
1013
|
}
|
|
1013
1014
|
++fetching;
|
|
1014
1015
|
}
|
|
1015
|
-
|
|
1016
|
+
assign(fetchedRange, activeRange2);
|
|
1016
1017
|
}
|
|
1017
1018
|
});
|
|
1018
1019
|
};
|
|
@@ -1201,7 +1202,7 @@ class State {
|
|
|
1201
1202
|
return $.get(this.#fetchedRange);
|
|
1202
1203
|
}
|
|
1203
1204
|
set fetchedRange(value) {
|
|
1204
|
-
$.set(this.#fetchedRange, value
|
|
1205
|
+
$.set(this.#fetchedRange, value);
|
|
1205
1206
|
}
|
|
1206
1207
|
#events;
|
|
1207
1208
|
get events() {
|
|
@@ -1337,7 +1338,7 @@ class State {
|
|
|
1337
1338
|
this.#auxComponents = $.state($.proxy([]));
|
|
1338
1339
|
this.#currentRange = $.derived(currentRange(this));
|
|
1339
1340
|
this.#activeRange = $.derived(activeRange(this));
|
|
1340
|
-
this.#fetchedRange = $.state(
|
|
1341
|
+
this.#fetchedRange = $.state({ start: void 0, end: void 0 });
|
|
1341
1342
|
this.#events = $.state([]);
|
|
1342
1343
|
this.#filteredEvents = $.derived(filteredEvents(this));
|
|
1343
1344
|
this.#mainEl = $.state();
|
|
@@ -1768,17 +1769,27 @@ function Calendar($$anchor, $$props) {
|
|
|
1768
1769
|
var node = $.child(div);
|
|
1769
1770
|
Toolbar(node, {});
|
|
1770
1771
|
var node_1 = $.sibling(node, 2);
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1772
|
+
{
|
|
1773
|
+
var consequent = ($$anchor2) => {
|
|
1774
|
+
var fragment = $.comment();
|
|
1775
|
+
var node_2 = $.first_child(fragment);
|
|
1776
|
+
$.component(node_2, () => $.get(View2), ($$anchor3, View_12) => {
|
|
1777
|
+
View_12($$anchor3, {});
|
|
1778
|
+
});
|
|
1779
|
+
$.append($$anchor2, fragment);
|
|
1780
|
+
};
|
|
1781
|
+
$.if(node_1, ($$render) => {
|
|
1782
|
+
if ($.get(View2)) $$render(consequent);
|
|
1783
|
+
});
|
|
1784
|
+
}
|
|
1785
|
+
var node_3 = $.sibling(node_1, 2);
|
|
1786
|
+
$.each(node_3, 17, () => $.get(auxComponents), $.index, ($$anchor2, AuxComponent) => {
|
|
1787
|
+
var fragment_1 = $.comment();
|
|
1788
|
+
var node_4 = $.first_child(fragment_1);
|
|
1789
|
+
$.component(node_4, () => $.get(AuxComponent), ($$anchor3, AuxComponent_1) => {
|
|
1779
1790
|
AuxComponent_1($$anchor3, {});
|
|
1780
1791
|
});
|
|
1781
|
-
$.append($$anchor2,
|
|
1792
|
+
$.append($$anchor2, fragment_1);
|
|
1782
1793
|
});
|
|
1783
1794
|
$.reset(div);
|
|
1784
1795
|
$.template_effect(
|
package/package.json
CHANGED
package/src/Calendar.svelte
CHANGED
|
@@ -131,7 +131,9 @@
|
|
|
131
131
|
role="{features.includes('list') ? 'list' : 'table'}"
|
|
132
132
|
>
|
|
133
133
|
<Toolbar/>
|
|
134
|
-
|
|
134
|
+
{#if View} <!-- temporary fix for https://github.com/sveltejs/kit/issues/15109 -->
|
|
135
|
+
<View/>
|
|
136
|
+
{/if}
|
|
135
137
|
{#each auxComponents as AuxComponent}
|
|
136
138
|
<AuxComponent/>
|
|
137
139
|
{/each}
|
package/src/storage/effects.js
CHANGED
|
@@ -139,8 +139,8 @@ export function optionsState(mainState, plugins, userOptions) {
|
|
|
139
139
|
userOptions = parseOptions(userOptions, parsers);
|
|
140
140
|
|
|
141
141
|
// Extract view-specific options
|
|
142
|
-
let
|
|
143
|
-
let
|
|
142
|
+
let defViewsOptions = extractOption(defOptions, 'views') ?? {};
|
|
143
|
+
let userViewsOptions = extractOption(userOptions, 'views') ?? {};
|
|
144
144
|
|
|
145
145
|
// Create options state
|
|
146
146
|
let options = new SvelteMap();
|
|
@@ -155,10 +155,11 @@ export function optionsState(mainState, plugins, userOptions) {
|
|
|
155
155
|
options.set('view', userOptions.view);
|
|
156
156
|
}
|
|
157
157
|
// Set options for each view
|
|
158
|
-
let views = new Set([...keys(
|
|
158
|
+
let views = new Set([...keys(defViewsOptions), ...keys(userViewsOptions)]);
|
|
159
159
|
for (let view of views) {
|
|
160
|
-
let
|
|
161
|
-
let
|
|
160
|
+
let userViewOptions = userViewsOptions[view] ?? {};
|
|
161
|
+
let defOpts = mergeOpts(defOptions, defViewsOptions[view] ?? defViewsOptions[userViewOptions.type] ?? {});
|
|
162
|
+
let opts = mergeOpts(defOpts, userOptions, userViewOptions);
|
|
162
163
|
let component = extractOption(opts, 'component');
|
|
163
164
|
// View has been set
|
|
164
165
|
delete opts.view;
|
|
@@ -18,7 +18,7 @@ export default class State {
|
|
|
18
18
|
this.auxComponents = $state([]);
|
|
19
19
|
this.currentRange = $derived.by(currentRange(this));
|
|
20
20
|
this.activeRange = $derived.by(activeRange(this));
|
|
21
|
-
this.fetchedRange = $state({start: undefined, end: undefined});
|
|
21
|
+
this.fetchedRange = $state.raw({start: undefined, end: undefined});
|
|
22
22
|
this.events = $state.raw([]);
|
|
23
23
|
this.filteredEvents = $derived.by(filteredEvents(this));
|
|
24
24
|
this.mainEl = $state();
|