@event-calendar/core 3.0.2 → 3.2.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 +61 -27
- package/index.css +4 -3
- package/index.js +160 -99
- package/package.json +1 -1
- package/src/Buttons.svelte +6 -11
- package/src/Calendar.svelte +14 -5
- package/src/Toolbar.svelte +4 -3
- package/src/lib/date.js +24 -3
- package/src/lib/resources.js +12 -0
- package/src/lib/times.js +2 -3
- package/src/storage/options.js +3 -3
- package/src/storage/state.js +0 -3
- package/src/storage/stores.js +3 -3
- package/src/styles/index.scss +0 -1
- package/src/styles/timeline.scss +4 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ See [demo](https://vkurko.github.io/calendar/) and [changelog](CHANGELOG.md).
|
|
|
4
4
|
|
|
5
5
|
Full-sized drag & drop JavaScript event calendar with resource & timeline views:
|
|
6
6
|
|
|
7
|
-
* Lightweight (
|
|
7
|
+
* Lightweight (35kb [br](https://en.wikipedia.org/wiki/Brotli) compressed)
|
|
8
8
|
* Zero-dependency (pre-built bundle)
|
|
9
9
|
* Used on over 70,000 websites with [Bookly](https://wordpress.org/plugins/bookly-responsive-appointment-booking-tool/)
|
|
10
10
|
|
|
@@ -115,10 +115,10 @@ Inspired by [FullCalendar](https://fullcalendar.io/), implements similar options
|
|
|
115
115
|
- [setOption](#setoption-name-value-)
|
|
116
116
|
</td><td>
|
|
117
117
|
|
|
118
|
-
- [
|
|
118
|
+
- [addEvent](#addevent-event-)
|
|
119
119
|
- [getEventById](#geteventbyid-id-)
|
|
120
|
+
- [getEvents](#getevents)
|
|
120
121
|
- [removeEventById](#removeeventbyid-id-)
|
|
121
|
-
- [addEvent](#addevent-event-)
|
|
122
122
|
- [updateEvent](#updateevent-event-)
|
|
123
123
|
- [refetchEvents](#refetchevents)
|
|
124
124
|
</td><td>
|
|
@@ -126,6 +126,8 @@ Inspired by [FullCalendar](https://fullcalendar.io/), implements similar options
|
|
|
126
126
|
- [dateFromPoint](#datefrompoint-x-y-)
|
|
127
127
|
- [destroy](#destroy)
|
|
128
128
|
- [getView](#getview)
|
|
129
|
+
- [next](#next)
|
|
130
|
+
- [prev](#prev)
|
|
129
131
|
- [unselect](#unselect-1)
|
|
130
132
|
</td></tr>
|
|
131
133
|
</table>
|
|
@@ -202,8 +204,8 @@ import '@event-calendar/core/index.css';
|
|
|
202
204
|
### Pre-built browser ready bundle
|
|
203
205
|
Include the following lines of code in the `<head>` section of your page:
|
|
204
206
|
```html
|
|
205
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.0
|
|
206
|
-
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.0
|
|
207
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.2.0/event-calendar.min.css">
|
|
208
|
+
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.2.0/event-calendar.min.js"></script>
|
|
207
209
|
```
|
|
208
210
|
|
|
209
211
|
<details>
|
|
@@ -292,21 +294,21 @@ When hidden with `false`, all-day events will not be displayed in `timeGrid`/`re
|
|
|
292
294
|
|
|
293
295
|
### buttonText
|
|
294
296
|
- Type `object` or `function`
|
|
295
|
-
- Default `{close: 'Close', dayGridMonth: 'month', listDay: 'list', listMonth: 'list', listWeek: 'list', listYear: 'list',
|
|
297
|
+
- Default `{close: 'Close', dayGridMonth: 'month', listDay: 'list', listMonth: 'list', listWeek: 'list', listYear: 'list', resourceTimeGridDay: 'resources', resourceTimeGridWeek: 'resources', resourceTimelineDay: 'timeline', resourceTimelineMonth: 'timeline', resourceTimelineWeek: 'timeline', timeGridDay: 'day', timeGridWeek: 'week', today: 'today'}`
|
|
296
298
|
> Views override the default value as follows:
|
|
297
299
|
> - dayGridMonth `text => ({...text, next: 'Next month', prev: 'Previous month'})`
|
|
298
300
|
> - listDay `text => ({...text, next: 'Next day', prev: 'Previous day'})`
|
|
299
301
|
> - listMonth `text => ({...text, next: 'Next month', prev: 'Previous month'})`
|
|
300
302
|
> - listWeek `text => ({...text, next: 'Next week', prev: 'Previous week'})`
|
|
301
303
|
> - listYear `text => ({...text, next: 'Next year', prev: 'Previous year'})`
|
|
302
|
-
> - resourceTimelineDay `text => ({...text, next: 'Next day', prev: 'Previous day'})`
|
|
303
|
-
> - resourceTimelineWeek `text => ({...text, next: 'Next week', prev: 'Previous week'})`
|
|
304
304
|
> - resourceTimeGridDay `text => ({...text, next: 'Next day', prev: 'Previous day'})`
|
|
305
305
|
> - resourceTimeGridWeek `text => ({...text, next: 'Next week', prev: 'Previous week'})`
|
|
306
|
+
> - resourceTimelineDay `text => ({...text, next: 'Next day', prev: 'Previous day'})`
|
|
307
|
+
> - resourceTimelineMonth `text => ({...text, next: 'Next month', prev: 'Previous month'})`
|
|
308
|
+
> - resourceTimelineWeek `text => ({...text, next: 'Next week', prev: 'Previous week'})`
|
|
306
309
|
> - timeGridDay `text => ({...text, next: 'Next day', prev: 'Previous day'})`
|
|
307
310
|
> - timeGridWeek `text => ({...text, next: 'Next week', prev: 'Previous week'})`
|
|
308
311
|
|
|
309
|
-
|
|
310
312
|
Text that is displayed in buttons of the header toolbar.
|
|
311
313
|
|
|
312
314
|
This value can be either a plain object with all necessary properties, or a callback function that receives default button text object and should return a new one:
|
|
@@ -361,9 +363,12 @@ Each `customButton` entry accepts the following properties:
|
|
|
361
363
|
<tr>
|
|
362
364
|
<td>
|
|
363
365
|
|
|
364
|
-
`text
|
|
366
|
+
`text`
|
|
367
|
+
</td>
|
|
368
|
+
<td>
|
|
369
|
+
|
|
370
|
+
The text to be display on the button itself. See [Content](#content)
|
|
365
371
|
</td>
|
|
366
|
-
<td>The text to be display on the button itself</td>
|
|
367
372
|
</tr>
|
|
368
373
|
<tr>
|
|
369
374
|
<td>
|
|
@@ -372,6 +377,16 @@ Each `customButton` entry accepts the following properties:
|
|
|
372
377
|
</td>
|
|
373
378
|
<td>A callback function that is called when the button is clicked. Accepts one argument <a href="https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent">mouseEvent</a></td>
|
|
374
379
|
</tr>
|
|
380
|
+
<tr>
|
|
381
|
+
<td>
|
|
382
|
+
|
|
383
|
+
`active`
|
|
384
|
+
</td>
|
|
385
|
+
<td>
|
|
386
|
+
|
|
387
|
+
If `true`, the button will appear pressed/active
|
|
388
|
+
</td>
|
|
389
|
+
</tr>
|
|
375
390
|
</table>
|
|
376
391
|
|
|
377
392
|
### date
|
|
@@ -538,8 +553,6 @@ function (date) {
|
|
|
538
553
|
- Default `{dateStyle: 'long'}`
|
|
539
554
|
> Views override the default value as follows:
|
|
540
555
|
> - dayGridMonth `{weekday: 'long'}`
|
|
541
|
-
> - resourceTimelineDay `{dateStyle: 'long', timeStyle: 'short'}`
|
|
542
|
-
> - resourceTimelineWeek `{dateStyle: 'long', timeStyle: 'short'}`
|
|
543
556
|
|
|
544
557
|
Defines the text that is used inside the `aria-label` attribute in calendar column headings.
|
|
545
558
|
|
|
@@ -565,6 +578,7 @@ function (date) {
|
|
|
565
578
|
- Default `{weekday: 'short', month: 'numeric', day: 'numeric'}`
|
|
566
579
|
> Views override the default value as follows:
|
|
567
580
|
> - dayGridMonth `{weekday: 'short'}`
|
|
581
|
+
> - resourceTimelineMonth `{weekday: 'short', day: 'numeric'}`
|
|
568
582
|
> - timeGridDay `{weekday: 'long'}`
|
|
569
583
|
|
|
570
584
|
Defines the text that is displayed on the calendar’s column headings.
|
|
@@ -614,6 +628,9 @@ function (date) {
|
|
|
614
628
|
- Default `true`
|
|
615
629
|
> Views override the default value as follows:
|
|
616
630
|
> - dayGridMonth `false`
|
|
631
|
+
> - resourceTimelineDay `false`
|
|
632
|
+
> - resourceTimelineMonth `false`
|
|
633
|
+
> - resourceTimelineWeek `false`
|
|
617
634
|
|
|
618
635
|
Determines whether to display an event’s end time.
|
|
619
636
|
|
|
@@ -632,8 +649,9 @@ Determines whether the calendar should automatically scroll during the event dra
|
|
|
632
649
|
> - listDay `{days: 1}`
|
|
633
650
|
> - listMonth `{months: 1}`
|
|
634
651
|
> - listYear `{years: 1}`
|
|
635
|
-
> - resourceTimelineDay `{days: 1}`
|
|
636
652
|
> - resourceTimeGridDay `{days: 1}`
|
|
653
|
+
> - resourceTimelineDay `{days: 1}`
|
|
654
|
+
> - resourceTimelineMonth `{months: 1}`
|
|
637
655
|
> - timeGridDay `{days: 1}`
|
|
638
656
|
|
|
639
657
|
Sets the duration of a view.
|
|
@@ -1691,7 +1709,7 @@ function (isLoading) { }
|
|
|
1691
1709
|
- Type `string`
|
|
1692
1710
|
- Default `undefined`
|
|
1693
1711
|
|
|
1694
|
-
Defines the `locales` parameter for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat) object that the Event Calendar uses to format date and time strings in options such as [dayHeaderFormat](#dayheaderformat), [eventTimeFormat](#eventtimeformat), etc.
|
|
1712
|
+
Defines the `locales` parameter for the native JavaScript [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#locales) object that the Event Calendar uses to format date and time strings in options such as [dayHeaderFormat](#dayheaderformat), [eventTimeFormat](#eventtimeformat), etc.
|
|
1695
1713
|
|
|
1696
1714
|
### longPressDelay
|
|
1697
1715
|
- Type `integer`
|
|
@@ -1990,6 +2008,8 @@ This should be a value that can be parsed into a [Duration](#duration-object) ob
|
|
|
1990
2008
|
### slotDuration
|
|
1991
2009
|
- Type `string`, `integer` or `object`
|
|
1992
2010
|
- Default `'00:30:00'`
|
|
2011
|
+
> Views override the default value as follows:
|
|
2012
|
+
> - resourceTimelineMonth `{days: 1}`
|
|
1993
2013
|
|
|
1994
2014
|
Defines the frequency for displaying time slots.
|
|
1995
2015
|
|
|
@@ -2077,6 +2097,9 @@ Defines the time slot width in pixels in `ResourceTimeline` views. When changing
|
|
|
2077
2097
|
> - listYear `theme => ({...theme, view: 'ec-list ec-year-view'})`
|
|
2078
2098
|
> - resourceTimeGridDay `theme => ({...theme, view: 'ec-time-grid ec-resource-day-view'})`
|
|
2079
2099
|
> - resourceTimeGridWeek `theme => ({...theme, view: 'ec-time-grid ec-resource-week-view'})`
|
|
2100
|
+
> - resourceTimelineDay `theme => ({...theme, view: 'ec-timeline ec-resource-day-view'})`
|
|
2101
|
+
> - resourceTimelineMonth `theme => ({...theme, view: 'ec-timeline ec-resource-month-view'})`
|
|
2102
|
+
> - resourceTimelineWeek `theme => ({...theme, view: 'ec-timeline ec-resource-week-view'})`
|
|
2080
2103
|
> - timeGridDay `theme => ({...theme, view: 'ec-time-grid ec-day-view'})`
|
|
2081
2104
|
> - timeGridWeek `theme => ({...theme, view: 'ec-time-grid ec-week-view'})`
|
|
2082
2105
|
|
|
@@ -2194,7 +2217,7 @@ Clicking on elements that match this CSS selector will prevent the current selec
|
|
|
2194
2217
|
- Type `string`
|
|
2195
2218
|
- Default `'resourceTimeGridWeek'`
|
|
2196
2219
|
|
|
2197
|
-
The view that is displayed in the calendar. Can be `'dayGridMonth'`, `'listDay'`, `'listWeek'`, `'listMonth'`, `'listYear'`, `'
|
|
2220
|
+
The view that is displayed in the calendar. Can be `'dayGridMonth'`, `'listDay'`, `'listWeek'`, `'listMonth'`, `'listYear'`, `'resourceTimeGridDay'`, `'resourceTimeGridWeek'`, `'resourceTimelineDay'`, `'resourceTimelineWeek'`, `'resourceTimelineMonth'`, `'timeGridDay'` or `'timeGridWeek'`.
|
|
2198
2221
|
|
|
2199
2222
|
### viewDidMount
|
|
2200
2223
|
- Type `function`
|
|
@@ -2277,10 +2300,13 @@ This method allows you to set new value to any calendar option.
|
|
|
2277
2300
|
// E.g. Change the current date
|
|
2278
2301
|
ec.setOption('date', new Date());
|
|
2279
2302
|
```
|
|
2280
|
-
### getEvents()
|
|
2281
|
-
- Return value `Event[]` Array of [Event](#event-object) objects
|
|
2282
2303
|
|
|
2283
|
-
|
|
2304
|
+
### addEvent( event )
|
|
2305
|
+
- Parameters
|
|
2306
|
+
- `event` `object` A plain object that will be parsed into an [Event](#event-object) object
|
|
2307
|
+
- Return value [Event](#event-object) object or `null`
|
|
2308
|
+
|
|
2309
|
+
Adds a new event to the calendar.
|
|
2284
2310
|
|
|
2285
2311
|
### getEventById( id )
|
|
2286
2312
|
- Parameters
|
|
@@ -2289,6 +2315,11 @@ Returns an array of events that the calendar has in memory.
|
|
|
2289
2315
|
|
|
2290
2316
|
Returns a single event with the matching `id`.
|
|
2291
2317
|
|
|
2318
|
+
### getEvents()
|
|
2319
|
+
- Return value `Event[]` Array of [Event](#event-object) objects
|
|
2320
|
+
|
|
2321
|
+
Returns an array of events that the calendar has in memory.
|
|
2322
|
+
|
|
2292
2323
|
### removeEventById( id )
|
|
2293
2324
|
- Parameters
|
|
2294
2325
|
- `id` `string|integer` The ID of the event
|
|
@@ -2296,13 +2327,6 @@ Returns a single event with the matching `id`.
|
|
|
2296
2327
|
|
|
2297
2328
|
Removes a single event with the matching `id`.
|
|
2298
2329
|
|
|
2299
|
-
### addEvent( event )
|
|
2300
|
-
- Parameters
|
|
2301
|
-
- `event` `object` A plain object that will be parsed into an [Event](#event-object) object
|
|
2302
|
-
- Return value [Event](#event-object) object or `null`
|
|
2303
|
-
|
|
2304
|
-
Adds a new event to the calendar.
|
|
2305
|
-
|
|
2306
2330
|
### updateEvent( event )
|
|
2307
2331
|
- Parameters
|
|
2308
2332
|
- `event` `object` A plain object or [Event](#event-object) object
|
|
@@ -2369,6 +2393,16 @@ Destroys the calendar, removing all DOM elements, event handlers, and internal d
|
|
|
2369
2393
|
|
|
2370
2394
|
Returns the [View](#view-object) object for the current view.
|
|
2371
2395
|
|
|
2396
|
+
### next()
|
|
2397
|
+
- Return value `EventCalendar` The calendar instance for chaining
|
|
2398
|
+
|
|
2399
|
+
Moves the current calendar date forward by 1 day/week/month (depending on the current view).
|
|
2400
|
+
|
|
2401
|
+
### prev()
|
|
2402
|
+
- Return value `EventCalendar` The calendar instance for chaining
|
|
2403
|
+
|
|
2404
|
+
Moves the current calendar date backward by 1 day/week/month (depending on the current view).
|
|
2405
|
+
|
|
2372
2406
|
### unselect()
|
|
2373
2407
|
- Return value `EventCalendar` The calendar instance for chaining
|
|
2374
2408
|
|
|
@@ -2722,7 +2756,7 @@ Here are all properties that exist in Resource object:
|
|
|
2722
2756
|
</td>
|
|
2723
2757
|
<td>
|
|
2724
2758
|
|
|
2725
|
-
The title of the resource. See [Content](#content)
|
|
2759
|
+
The title of the resource. See [Content](#content)
|
|
2726
2760
|
</td>
|
|
2727
2761
|
</tr>
|
|
2728
2762
|
<tr>
|
package/index.css
CHANGED
|
@@ -112,21 +112,23 @@
|
|
|
112
112
|
}
|
|
113
113
|
.ec-timeline .ec-times {
|
|
114
114
|
display: flex;
|
|
115
|
-
border-
|
|
115
|
+
border-top: 1px solid var(--ec-border-color);
|
|
116
116
|
}
|
|
117
117
|
.ec-timeline .ec-time {
|
|
118
118
|
border-left: 1px solid var(--ec-border-color);
|
|
119
119
|
box-sizing: border-box;
|
|
120
|
+
font-size: 0.95em;
|
|
120
121
|
min-height: 24px;
|
|
121
122
|
overflow: hidden;
|
|
122
123
|
text-overflow: ellipsis;
|
|
123
124
|
}
|
|
124
125
|
.ec-timeline .ec-time, .ec-timeline .ec-line {
|
|
125
|
-
width:
|
|
126
|
+
width: 72px;
|
|
126
127
|
}
|
|
127
128
|
.ec-timeline .ec-events {
|
|
128
129
|
position: relative;
|
|
129
130
|
height: 100%;
|
|
131
|
+
margin: 0;
|
|
130
132
|
}
|
|
131
133
|
.ec-timeline .ec-event {
|
|
132
134
|
position: absolute;
|
|
@@ -356,7 +358,6 @@
|
|
|
356
358
|
.ec-body,
|
|
357
359
|
.ec-days,
|
|
358
360
|
.ec-day,
|
|
359
|
-
.ec-times,
|
|
360
361
|
.ec-day-head {
|
|
361
362
|
border: 1px solid var(--ec-border-color);
|
|
362
363
|
}
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { run_all, is_function,
|
|
1
|
+
import { run_all, is_function, identity, tick, SvelteComponent, init, safe_not_equal, ensure_array_like, empty, insert, noop, detach, destroy_each, component_subscribe, set_store_value, element, text, attr, append, listen, set_data, action_destroyer, transition_in, group_outros, check_outros, transition_out, space, create_component, mount_component, destroy_component, construct_svelte_component, set_style, get_current_component } from 'svelte/internal';
|
|
2
2
|
import { getContext, setContext, beforeUpdate, afterUpdate } from 'svelte';
|
|
3
3
|
import { derived, get, writable, readable } from 'svelte/store';
|
|
4
4
|
|
|
@@ -173,10 +173,31 @@ function copyTime(toDate, fromDate) {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
|
-
* Get duration value in seconds
|
|
176
|
+
* Get duration value in seconds
|
|
177
177
|
*/
|
|
178
|
-
function toSeconds(duration
|
|
179
|
-
return duration
|
|
178
|
+
function toSeconds(duration) {
|
|
179
|
+
return duration.seconds;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Move the date forward (when pressing the next button)
|
|
184
|
+
*/
|
|
185
|
+
function nextDate(date, duration) {
|
|
186
|
+
addDuration(date, duration);
|
|
187
|
+
return date;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Move the date backward (when pressing the prev button)
|
|
192
|
+
*/
|
|
193
|
+
function prevDate(date, duration, hiddenDays) {
|
|
194
|
+
subtractDuration(date, duration);
|
|
195
|
+
if (hiddenDays.length && hiddenDays.length < 7) {
|
|
196
|
+
while (hiddenDays.includes(date.getUTCDay())) {
|
|
197
|
+
subtractDay(date);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return date;
|
|
180
201
|
}
|
|
181
202
|
|
|
182
203
|
/**
|
|
@@ -641,6 +662,18 @@ function createResources(input) {
|
|
|
641
662
|
}));
|
|
642
663
|
}
|
|
643
664
|
|
|
665
|
+
function resourceBackgroundColor(event, resources) {
|
|
666
|
+
return findResource(event, resources)?.eventBackgroundColor;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
function resourceTextColor(event, resources) {
|
|
670
|
+
return findResource(event, resources)?.eventTextColor;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
function findResource(event, resources) {
|
|
674
|
+
return resources.find(resource => event.resourceIds.includes(resource.id));
|
|
675
|
+
}
|
|
676
|
+
|
|
644
677
|
function intl(locale, format) {
|
|
645
678
|
return derived([locale, format], ([$locale, $format]) => {
|
|
646
679
|
let intl = is_function($format)
|
|
@@ -732,7 +765,7 @@ function viewResources(state) {
|
|
|
732
765
|
);
|
|
733
766
|
}
|
|
734
767
|
|
|
735
|
-
function createTimes(date, $slotDuration, $_slotTimeLimits, $_intlSlotLabel
|
|
768
|
+
function createTimes(date, $slotDuration, $_slotTimeLimits, $_intlSlotLabel) {
|
|
736
769
|
date = cloneDate(date);
|
|
737
770
|
let compact = $slotDuration.seconds < 3600;
|
|
738
771
|
let times = [];
|
|
@@ -744,8 +777,7 @@ function createTimes(date, $slotDuration, $_slotTimeLimits, $_intlSlotLabel, $_i
|
|
|
744
777
|
times.push([
|
|
745
778
|
toISOString(date),
|
|
746
779
|
$_intlSlotLabel.format(date),
|
|
747
|
-
times.length && (i || !compact)
|
|
748
|
-
$_intlDayHeaderAL && $_intlDayHeaderAL.format(date)
|
|
780
|
+
times.length && (i || !compact)
|
|
749
781
|
]);
|
|
750
782
|
addDuration(date, $slotDuration);
|
|
751
783
|
i = 1 - i;
|
|
@@ -811,7 +843,7 @@ function createOptions(plugins) {
|
|
|
811
843
|
day: 'numeric'
|
|
812
844
|
},
|
|
813
845
|
dayHeaderAriaLabelFormat: {
|
|
814
|
-
dateStyle: '
|
|
846
|
+
dateStyle: 'full'
|
|
815
847
|
},
|
|
816
848
|
displayEventEnd: true,
|
|
817
849
|
duration: {weeks: 1},
|
|
@@ -860,7 +892,7 @@ function createOptions(plugins) {
|
|
|
860
892
|
},
|
|
861
893
|
slotMaxTime: '24:00:00',
|
|
862
894
|
slotMinTime: '00:00:00',
|
|
863
|
-
slotWidth:
|
|
895
|
+
slotWidth: 72,
|
|
864
896
|
theme: {
|
|
865
897
|
allDay: 'ec-all-day',
|
|
866
898
|
active: 'ec-active',
|
|
@@ -925,7 +957,7 @@ function createParsers(plugins) {
|
|
|
925
957
|
events: createEvents,
|
|
926
958
|
eventSources: createEventSources,
|
|
927
959
|
hiddenDays: days => [...new Set(days)],
|
|
928
|
-
highlightedDates: dates => dates.map(createDate),
|
|
960
|
+
highlightedDates: dates => dates.map(date => setMidnight(createDate(date))),
|
|
929
961
|
resources: createResources,
|
|
930
962
|
scrollTime: createDuration,
|
|
931
963
|
slotDuration: createDuration,
|
|
@@ -982,10 +1014,10 @@ function activeRange(state) {
|
|
|
982
1014
|
|
|
983
1015
|
function currentRange(state) {
|
|
984
1016
|
return derived(
|
|
985
|
-
[state.date, state.duration, state.firstDay
|
|
986
|
-
([$date, $duration, $firstDay
|
|
1017
|
+
[state.date, state.duration, state.firstDay],
|
|
1018
|
+
([$date, $duration, $firstDay]) => {
|
|
987
1019
|
let start = cloneDate($date), end;
|
|
988
|
-
if ($
|
|
1020
|
+
if ($duration.months) {
|
|
989
1021
|
start.setUTCDate(1);
|
|
990
1022
|
} else if ($duration.inWeeks) {
|
|
991
1023
|
// First day of week
|
|
@@ -1181,9 +1213,6 @@ class State {
|
|
|
1181
1213
|
this._viewDates = viewDates(this);
|
|
1182
1214
|
this._view = view(this);
|
|
1183
1215
|
this._viewComponent = writable(undefined);
|
|
1184
|
-
// Resources
|
|
1185
|
-
this._resBgColor = writable(noop);
|
|
1186
|
-
this._resTxtColor = writable(noop);
|
|
1187
1216
|
// Interaction
|
|
1188
1217
|
this._interaction = writable({});
|
|
1189
1218
|
this._iEvents = writable([null, null]); // interaction events: [drag/resize, pointer]
|
|
@@ -1306,7 +1335,7 @@ function validKey(key, state) {
|
|
|
1306
1335
|
return state.hasOwnProperty(key) && key[0] !== '_';
|
|
1307
1336
|
}
|
|
1308
1337
|
|
|
1309
|
-
/* packages/core/src/Buttons.svelte generated by Svelte v4.2.
|
|
1338
|
+
/* packages/core/src/Buttons.svelte generated by Svelte v4.2.18 */
|
|
1310
1339
|
|
|
1311
1340
|
function get_each_context$2(ctx, list, i) {
|
|
1312
1341
|
const child_ctx = ctx.slice();
|
|
@@ -1314,7 +1343,7 @@ function get_each_context$2(ctx, list, i) {
|
|
|
1314
1343
|
return child_ctx;
|
|
1315
1344
|
}
|
|
1316
1345
|
|
|
1317
|
-
// (
|
|
1346
|
+
// (52:27)
|
|
1318
1347
|
function create_if_block_5(ctx) {
|
|
1319
1348
|
let button_1;
|
|
1320
1349
|
let t_value = /*$buttonText*/ ctx[5][/*button*/ ctx[25]] + "";
|
|
@@ -1366,40 +1395,46 @@ function create_if_block_5(ctx) {
|
|
|
1366
1395
|
};
|
|
1367
1396
|
}
|
|
1368
1397
|
|
|
1369
|
-
// (
|
|
1398
|
+
// (46:37)
|
|
1370
1399
|
function create_if_block_4(ctx) {
|
|
1371
1400
|
let button_1;
|
|
1372
|
-
let t_value = /*$customButtons*/ ctx[6][/*button*/ ctx[25]].text + "";
|
|
1373
|
-
let t;
|
|
1374
1401
|
let button_1_class_value;
|
|
1402
|
+
let setContent_action;
|
|
1375
1403
|
let mounted;
|
|
1376
1404
|
let dispose;
|
|
1377
1405
|
|
|
1378
1406
|
return {
|
|
1379
1407
|
c() {
|
|
1380
1408
|
button_1 = element("button");
|
|
1381
|
-
|
|
1382
|
-
attr(button_1, "class", button_1_class_value = "" + (/*$theme*/ ctx[3].button + " ec-" + /*button*/ ctx[25]
|
|
1409
|
+
|
|
1410
|
+
attr(button_1, "class", button_1_class_value = "" + (/*$theme*/ ctx[3].button + " ec-" + /*button*/ ctx[25] + (/*$customButtons*/ ctx[6][/*button*/ ctx[25]].active
|
|
1411
|
+
? ' ' + /*$theme*/ ctx[3].active
|
|
1412
|
+
: '')));
|
|
1383
1413
|
},
|
|
1384
1414
|
m(target, anchor) {
|
|
1385
1415
|
insert(target, button_1, anchor);
|
|
1386
|
-
append(button_1, t);
|
|
1387
1416
|
|
|
1388
1417
|
if (!mounted) {
|
|
1389
|
-
dispose =
|
|
1390
|
-
|
|
1391
|
-
|
|
1418
|
+
dispose = [
|
|
1419
|
+
listen(button_1, "click", function () {
|
|
1420
|
+
if (is_function(/*$customButtons*/ ctx[6][/*button*/ ctx[25]].click)) /*$customButtons*/ ctx[6][/*button*/ ctx[25]].click.apply(this, arguments);
|
|
1421
|
+
}),
|
|
1422
|
+
action_destroyer(setContent_action = setContent.call(null, button_1, /*$customButtons*/ ctx[6][/*button*/ ctx[25]].text))
|
|
1423
|
+
];
|
|
1392
1424
|
|
|
1393
1425
|
mounted = true;
|
|
1394
1426
|
}
|
|
1395
1427
|
},
|
|
1396
1428
|
p(new_ctx, dirty) {
|
|
1397
1429
|
ctx = new_ctx;
|
|
1398
|
-
if (dirty & /*$customButtons, buttons*/ 65 && t_value !== (t_value = /*$customButtons*/ ctx[6][/*button*/ ctx[25]].text + "")) set_data(t, t_value);
|
|
1399
1430
|
|
|
1400
|
-
if (dirty & /*$theme, buttons*/
|
|
1431
|
+
if (dirty & /*$theme, buttons, $customButtons*/ 73 && button_1_class_value !== (button_1_class_value = "" + (/*$theme*/ ctx[3].button + " ec-" + /*button*/ ctx[25] + (/*$customButtons*/ ctx[6][/*button*/ ctx[25]].active
|
|
1432
|
+
? ' ' + /*$theme*/ ctx[3].active
|
|
1433
|
+
: '')))) {
|
|
1401
1434
|
attr(button_1, "class", button_1_class_value);
|
|
1402
1435
|
}
|
|
1436
|
+
|
|
1437
|
+
if (setContent_action && is_function(setContent_action.update) && dirty & /*$customButtons, buttons*/ 65) setContent_action.update.call(null, /*$customButtons*/ ctx[6][/*button*/ ctx[25]].text);
|
|
1403
1438
|
},
|
|
1404
1439
|
d(detaching) {
|
|
1405
1440
|
if (detaching) {
|
|
@@ -1407,12 +1442,12 @@ function create_if_block_4(ctx) {
|
|
|
1407
1442
|
}
|
|
1408
1443
|
|
|
1409
1444
|
mounted = false;
|
|
1410
|
-
dispose
|
|
1445
|
+
run_all(dispose);
|
|
1411
1446
|
}
|
|
1412
1447
|
};
|
|
1413
1448
|
}
|
|
1414
1449
|
|
|
1415
|
-
// (
|
|
1450
|
+
// (40:32)
|
|
1416
1451
|
function create_if_block_3(ctx) {
|
|
1417
1452
|
let button_1;
|
|
1418
1453
|
let t_value = /*$buttonText*/ ctx[5][/*button*/ ctx[25]] + "";
|
|
@@ -1459,7 +1494,7 @@ function create_if_block_3(ctx) {
|
|
|
1459
1494
|
};
|
|
1460
1495
|
}
|
|
1461
1496
|
|
|
1462
|
-
// (
|
|
1497
|
+
// (33:31)
|
|
1463
1498
|
function create_if_block_2(ctx) {
|
|
1464
1499
|
let button_1;
|
|
1465
1500
|
let i;
|
|
@@ -1516,7 +1551,7 @@ function create_if_block_2(ctx) {
|
|
|
1516
1551
|
};
|
|
1517
1552
|
}
|
|
1518
1553
|
|
|
1519
|
-
// (
|
|
1554
|
+
// (26:31)
|
|
1520
1555
|
function create_if_block_1(ctx) {
|
|
1521
1556
|
let button_1;
|
|
1522
1557
|
let i;
|
|
@@ -1573,7 +1608,7 @@ function create_if_block_1(ctx) {
|
|
|
1573
1608
|
};
|
|
1574
1609
|
}
|
|
1575
1610
|
|
|
1576
|
-
// (
|
|
1611
|
+
// (23:4) {#if button == 'title'}
|
|
1577
1612
|
function create_if_block$1(ctx) {
|
|
1578
1613
|
let h2;
|
|
1579
1614
|
let h2_class_value;
|
|
@@ -1612,7 +1647,7 @@ function create_if_block$1(ctx) {
|
|
|
1612
1647
|
};
|
|
1613
1648
|
}
|
|
1614
1649
|
|
|
1615
|
-
// (
|
|
1650
|
+
// (22:0) {#each buttons as button}
|
|
1616
1651
|
function create_each_block$2(ctx) {
|
|
1617
1652
|
let if_block_anchor;
|
|
1618
1653
|
|
|
@@ -1748,19 +1783,11 @@ function instance$3($$self, $$props, $$invalidate) {
|
|
|
1748
1783
|
let today = setMidnight(createDate()), isToday;
|
|
1749
1784
|
|
|
1750
1785
|
function prev() {
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
if ($hiddenDays.length && $hiddenDays.length < 7) {
|
|
1754
|
-
while ($hiddenDays.includes(d.getUTCDay())) {
|
|
1755
|
-
subtractDay(d);
|
|
1756
|
-
}
|
|
1757
|
-
}
|
|
1758
|
-
|
|
1759
|
-
set_store_value(date, $date = d, $date);
|
|
1786
|
+
set_store_value(date, $date = prevDate($date, $duration, $hiddenDays), $date);
|
|
1760
1787
|
}
|
|
1761
1788
|
|
|
1762
1789
|
function next() {
|
|
1763
|
-
set_store_value(date, $date =
|
|
1790
|
+
set_store_value(date, $date = nextDate($date, $duration), $date);
|
|
1764
1791
|
}
|
|
1765
1792
|
|
|
1766
1793
|
const click_handler = () => set_store_value(date, $date = cloneDate(today), $date);
|
|
@@ -1810,7 +1837,7 @@ class Buttons extends SvelteComponent {
|
|
|
1810
1837
|
}
|
|
1811
1838
|
}
|
|
1812
1839
|
|
|
1813
|
-
/* packages/core/src/Toolbar.svelte generated by Svelte v4.2.
|
|
1840
|
+
/* packages/core/src/Toolbar.svelte generated by Svelte v4.2.18 */
|
|
1814
1841
|
|
|
1815
1842
|
function get_each_context$1(ctx, list, i) {
|
|
1816
1843
|
const child_ctx = ctx.slice();
|
|
@@ -1824,7 +1851,7 @@ function get_each_context_1(ctx, list, i) {
|
|
|
1824
1851
|
return child_ctx;
|
|
1825
1852
|
}
|
|
1826
1853
|
|
|
1827
|
-
// (
|
|
1854
|
+
// (29:16) {:else}
|
|
1828
1855
|
function create_else_block(ctx) {
|
|
1829
1856
|
let buttons_1;
|
|
1830
1857
|
let current;
|
|
@@ -1858,7 +1885,7 @@ function create_else_block(ctx) {
|
|
|
1858
1885
|
};
|
|
1859
1886
|
}
|
|
1860
1887
|
|
|
1861
|
-
// (
|
|
1888
|
+
// (25:16) {#if buttons.length > 1}
|
|
1862
1889
|
function create_if_block(ctx) {
|
|
1863
1890
|
let div;
|
|
1864
1891
|
let buttons_1;
|
|
@@ -1905,7 +1932,7 @@ function create_if_block(ctx) {
|
|
|
1905
1932
|
};
|
|
1906
1933
|
}
|
|
1907
1934
|
|
|
1908
|
-
// (
|
|
1935
|
+
// (24:12) {#each sections[key] as buttons}
|
|
1909
1936
|
function create_each_block_1(ctx) {
|
|
1910
1937
|
let current_block_type_index;
|
|
1911
1938
|
let if_block;
|
|
@@ -1978,10 +2005,11 @@ function create_each_block_1(ctx) {
|
|
|
1978
2005
|
};
|
|
1979
2006
|
}
|
|
1980
2007
|
|
|
1981
|
-
// (
|
|
2008
|
+
// (22:4) {#each keys(sections) as key}
|
|
1982
2009
|
function create_each_block$1(ctx) {
|
|
1983
2010
|
let div;
|
|
1984
2011
|
let t;
|
|
2012
|
+
let div_class_value;
|
|
1985
2013
|
let current;
|
|
1986
2014
|
let each_value_1 = ensure_array_like(/*sections*/ ctx[0][/*key*/ ctx[5]]);
|
|
1987
2015
|
let each_blocks = [];
|
|
@@ -2003,6 +2031,7 @@ function create_each_block$1(ctx) {
|
|
|
2003
2031
|
}
|
|
2004
2032
|
|
|
2005
2033
|
t = space();
|
|
2034
|
+
attr(div, "class", div_class_value = "ec-" + /*key*/ ctx[5]);
|
|
2006
2035
|
},
|
|
2007
2036
|
m(target, anchor) {
|
|
2008
2037
|
insert(target, div, anchor);
|
|
@@ -2017,7 +2046,7 @@ function create_each_block$1(ctx) {
|
|
|
2017
2046
|
current = true;
|
|
2018
2047
|
},
|
|
2019
2048
|
p(ctx, dirty) {
|
|
2020
|
-
if (dirty & /*$theme, sections
|
|
2049
|
+
if (dirty & /*$theme, sections*/ 3) {
|
|
2021
2050
|
each_value_1 = ensure_array_like(/*sections*/ ctx[0][/*key*/ ctx[5]]);
|
|
2022
2051
|
let i;
|
|
2023
2052
|
|
|
@@ -2043,6 +2072,10 @@ function create_each_block$1(ctx) {
|
|
|
2043
2072
|
|
|
2044
2073
|
check_outros();
|
|
2045
2074
|
}
|
|
2075
|
+
|
|
2076
|
+
if (!current || dirty & /*sections*/ 1 && div_class_value !== (div_class_value = "ec-" + /*key*/ ctx[5])) {
|
|
2077
|
+
attr(div, "class", div_class_value);
|
|
2078
|
+
}
|
|
2046
2079
|
},
|
|
2047
2080
|
i(local) {
|
|
2048
2081
|
if (current) return;
|
|
@@ -2076,7 +2109,7 @@ function create_fragment$2(ctx) {
|
|
|
2076
2109
|
let nav;
|
|
2077
2110
|
let nav_class_value;
|
|
2078
2111
|
let current;
|
|
2079
|
-
let each_value = ensure_array_like(
|
|
2112
|
+
let each_value = ensure_array_like(keys(/*sections*/ ctx[0]));
|
|
2080
2113
|
let each_blocks = [];
|
|
2081
2114
|
|
|
2082
2115
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
@@ -2109,8 +2142,8 @@ function create_fragment$2(ctx) {
|
|
|
2109
2142
|
current = true;
|
|
2110
2143
|
},
|
|
2111
2144
|
p(ctx, [dirty]) {
|
|
2112
|
-
if (dirty & /*sections,
|
|
2113
|
-
each_value = ensure_array_like(
|
|
2145
|
+
if (dirty & /*sections, $theme*/ 3) {
|
|
2146
|
+
each_value = ensure_array_like(keys(/*sections*/ ctx[0]));
|
|
2114
2147
|
let i;
|
|
2115
2148
|
|
|
2116
2149
|
for (i = 0; i < each_value.length; i += 1) {
|
|
@@ -2179,7 +2212,7 @@ function instance$2($$self, $$props, $$invalidate) {
|
|
|
2179
2212
|
$$self.$$.update = () => {
|
|
2180
2213
|
if ($$self.$$.dirty & /*sections, $headerToolbar*/ 17) {
|
|
2181
2214
|
{
|
|
2182
|
-
for (let key of
|
|
2215
|
+
for (let key of keys(sections)) {
|
|
2183
2216
|
$$invalidate(0, sections[key] = $headerToolbar[key].split(' ').map(group => group.split(',')), sections);
|
|
2184
2217
|
}
|
|
2185
2218
|
}
|
|
@@ -2196,7 +2229,7 @@ class Toolbar extends SvelteComponent {
|
|
|
2196
2229
|
}
|
|
2197
2230
|
}
|
|
2198
2231
|
|
|
2199
|
-
/* packages/core/src/Auxiliary.svelte generated by Svelte v4.2.
|
|
2232
|
+
/* packages/core/src/Auxiliary.svelte generated by Svelte v4.2.18 */
|
|
2200
2233
|
|
|
2201
2234
|
function get_each_context(ctx, list, i) {
|
|
2202
2235
|
const child_ctx = ctx.slice();
|
|
@@ -2404,7 +2437,7 @@ class Auxiliary extends SvelteComponent {
|
|
|
2404
2437
|
}
|
|
2405
2438
|
}
|
|
2406
2439
|
|
|
2407
|
-
/* packages/core/src/Calendar.svelte generated by Svelte v4.2.
|
|
2440
|
+
/* packages/core/src/Calendar.svelte generated by Svelte v4.2.18 */
|
|
2408
2441
|
|
|
2409
2442
|
function create_fragment(ctx) {
|
|
2410
2443
|
let div;
|
|
@@ -2459,7 +2492,7 @@ function create_fragment(ctx) {
|
|
|
2459
2492
|
current = true;
|
|
2460
2493
|
|
|
2461
2494
|
if (!mounted) {
|
|
2462
|
-
dispose = listen(window, "resize", /*recheckScrollable*/ ctx[
|
|
2495
|
+
dispose = listen(window, "resize", /*recheckScrollable*/ ctx[20]);
|
|
2463
2496
|
mounted = true;
|
|
2464
2497
|
}
|
|
2465
2498
|
},
|
|
@@ -2535,6 +2568,9 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
2535
2568
|
let $_scrollable;
|
|
2536
2569
|
let $_queue2;
|
|
2537
2570
|
let $_queue;
|
|
2571
|
+
let $hiddenDays;
|
|
2572
|
+
let $duration;
|
|
2573
|
+
let $date;
|
|
2538
2574
|
let $_interaction;
|
|
2539
2575
|
let $_events;
|
|
2540
2576
|
let $theme;
|
|
@@ -2547,15 +2583,18 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
2547
2583
|
let component = get_current_component();
|
|
2548
2584
|
let state = new State(plugins, options);
|
|
2549
2585
|
setContext('state', state);
|
|
2550
|
-
let { _viewComponent, _bodyEl, _interaction, _iClass, _events, _queue, _queue2, _tasks, _scrollable, height, theme, view } = state;
|
|
2586
|
+
let { _viewComponent, _bodyEl, _interaction, _iClass, _events, _queue, _queue2, _tasks, _scrollable, date, duration, hiddenDays, height, theme, view } = state;
|
|
2551
2587
|
component_subscribe($$self, _viewComponent, value => $$invalidate(5, $_viewComponent = value));
|
|
2552
|
-
component_subscribe($$self, _bodyEl, value => $$invalidate(
|
|
2553
|
-
component_subscribe($$self, _interaction, value => $$invalidate(
|
|
2588
|
+
component_subscribe($$self, _bodyEl, value => $$invalidate(37, $_bodyEl = value));
|
|
2589
|
+
component_subscribe($$self, _interaction, value => $$invalidate(43, $_interaction = value));
|
|
2554
2590
|
component_subscribe($$self, _iClass, value => $$invalidate(2, $_iClass = value));
|
|
2555
|
-
component_subscribe($$self, _events, value => $$invalidate(
|
|
2556
|
-
component_subscribe($$self, _queue, value => $$invalidate(
|
|
2557
|
-
component_subscribe($$self, _queue2, value => $$invalidate(
|
|
2591
|
+
component_subscribe($$self, _events, value => $$invalidate(44, $_events = value));
|
|
2592
|
+
component_subscribe($$self, _queue, value => $$invalidate(39, $_queue = value));
|
|
2593
|
+
component_subscribe($$self, _queue2, value => $$invalidate(38, $_queue2 = value));
|
|
2558
2594
|
component_subscribe($$self, _scrollable, value => $$invalidate(0, $_scrollable = value));
|
|
2595
|
+
component_subscribe($$self, date, value => $$invalidate(42, $date = value));
|
|
2596
|
+
component_subscribe($$self, duration, value => $$invalidate(41, $duration = value));
|
|
2597
|
+
component_subscribe($$self, hiddenDays, value => $$invalidate(40, $hiddenDays = value));
|
|
2559
2598
|
component_subscribe($$self, height, value => $$invalidate(3, $height = value));
|
|
2560
2599
|
component_subscribe($$self, theme, value => $$invalidate(1, $theme = value));
|
|
2561
2600
|
component_subscribe($$self, view, value => $$invalidate(4, $view = value));
|
|
@@ -2626,10 +2665,7 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
2626
2665
|
}
|
|
2627
2666
|
|
|
2628
2667
|
function unselect() {
|
|
2629
|
-
|
|
2630
|
-
$_interaction.action.unselect();
|
|
2631
|
-
}
|
|
2632
|
-
|
|
2668
|
+
$_interaction.action?.unselect();
|
|
2633
2669
|
return this;
|
|
2634
2670
|
}
|
|
2635
2671
|
|
|
@@ -2642,6 +2678,16 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
2642
2678
|
destroy_component(component, true);
|
|
2643
2679
|
}
|
|
2644
2680
|
|
|
2681
|
+
function next() {
|
|
2682
|
+
set_store_value(date, $date = nextDate($date, $duration), $date);
|
|
2683
|
+
return this;
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
function prev() {
|
|
2687
|
+
set_store_value(date, $date = prevDate($date, $duration, $hiddenDays), $date);
|
|
2688
|
+
return this;
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2645
2691
|
beforeUpdate(() => {
|
|
2646
2692
|
flushDebounce($_queue);
|
|
2647
2693
|
});
|
|
@@ -2658,12 +2704,12 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
2658
2704
|
}
|
|
2659
2705
|
|
|
2660
2706
|
$$self.$$set = $$props => {
|
|
2661
|
-
if ('plugins' in $$props) $$invalidate(
|
|
2662
|
-
if ('options' in $$props) $$invalidate(
|
|
2707
|
+
if ('plugins' in $$props) $$invalidate(21, plugins = $$props.plugins);
|
|
2708
|
+
if ('options' in $$props) $$invalidate(22, options = $$props.options);
|
|
2663
2709
|
};
|
|
2664
2710
|
|
|
2665
2711
|
$$self.$$.update = () => {
|
|
2666
|
-
if ($$self.$$.dirty[0] & /*options*/
|
|
2712
|
+
if ($$self.$$.dirty[0] & /*options*/ 4194304) {
|
|
2667
2713
|
for (let [name, value] of diff(options, prevOptions)) {
|
|
2668
2714
|
setOption(name, value);
|
|
2669
2715
|
}
|
|
@@ -2685,6 +2731,9 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
2685
2731
|
_queue,
|
|
2686
2732
|
_queue2,
|
|
2687
2733
|
_scrollable,
|
|
2734
|
+
date,
|
|
2735
|
+
duration,
|
|
2736
|
+
hiddenDays,
|
|
2688
2737
|
height,
|
|
2689
2738
|
theme,
|
|
2690
2739
|
view,
|
|
@@ -2702,7 +2751,9 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
2702
2751
|
getView,
|
|
2703
2752
|
unselect,
|
|
2704
2753
|
dateFromPoint,
|
|
2705
|
-
destroy
|
|
2754
|
+
destroy,
|
|
2755
|
+
next,
|
|
2756
|
+
prev
|
|
2706
2757
|
];
|
|
2707
2758
|
}
|
|
2708
2759
|
|
|
@@ -2717,20 +2768,22 @@ class Calendar extends SvelteComponent {
|
|
|
2717
2768
|
create_fragment,
|
|
2718
2769
|
safe_not_equal,
|
|
2719
2770
|
{
|
|
2720
|
-
plugins:
|
|
2721
|
-
options:
|
|
2722
|
-
setOption:
|
|
2723
|
-
getOption:
|
|
2724
|
-
refetchEvents:
|
|
2725
|
-
getEvents:
|
|
2726
|
-
getEventById:
|
|
2727
|
-
addEvent:
|
|
2728
|
-
updateEvent:
|
|
2729
|
-
removeEventById:
|
|
2730
|
-
getView:
|
|
2731
|
-
unselect:
|
|
2732
|
-
dateFromPoint:
|
|
2733
|
-
destroy:
|
|
2771
|
+
plugins: 21,
|
|
2772
|
+
options: 22,
|
|
2773
|
+
setOption: 23,
|
|
2774
|
+
getOption: 24,
|
|
2775
|
+
refetchEvents: 25,
|
|
2776
|
+
getEvents: 26,
|
|
2777
|
+
getEventById: 27,
|
|
2778
|
+
addEvent: 28,
|
|
2779
|
+
updateEvent: 29,
|
|
2780
|
+
removeEventById: 30,
|
|
2781
|
+
getView: 31,
|
|
2782
|
+
unselect: 32,
|
|
2783
|
+
dateFromPoint: 33,
|
|
2784
|
+
destroy: 34,
|
|
2785
|
+
next: 35,
|
|
2786
|
+
prev: 36
|
|
2734
2787
|
},
|
|
2735
2788
|
null,
|
|
2736
2789
|
[-1, -1]
|
|
@@ -2738,52 +2791,60 @@ class Calendar extends SvelteComponent {
|
|
|
2738
2791
|
}
|
|
2739
2792
|
|
|
2740
2793
|
get setOption() {
|
|
2741
|
-
return this.$$.ctx[
|
|
2794
|
+
return this.$$.ctx[23];
|
|
2742
2795
|
}
|
|
2743
2796
|
|
|
2744
2797
|
get getOption() {
|
|
2745
|
-
return this.$$.ctx[
|
|
2798
|
+
return this.$$.ctx[24];
|
|
2746
2799
|
}
|
|
2747
2800
|
|
|
2748
2801
|
get refetchEvents() {
|
|
2749
|
-
return this.$$.ctx[
|
|
2802
|
+
return this.$$.ctx[25];
|
|
2750
2803
|
}
|
|
2751
2804
|
|
|
2752
2805
|
get getEvents() {
|
|
2753
|
-
return this.$$.ctx[
|
|
2806
|
+
return this.$$.ctx[26];
|
|
2754
2807
|
}
|
|
2755
2808
|
|
|
2756
2809
|
get getEventById() {
|
|
2757
|
-
return this.$$.ctx[
|
|
2810
|
+
return this.$$.ctx[27];
|
|
2758
2811
|
}
|
|
2759
2812
|
|
|
2760
2813
|
get addEvent() {
|
|
2761
|
-
return this.$$.ctx[
|
|
2814
|
+
return this.$$.ctx[28];
|
|
2762
2815
|
}
|
|
2763
2816
|
|
|
2764
2817
|
get updateEvent() {
|
|
2765
|
-
return this.$$.ctx[
|
|
2818
|
+
return this.$$.ctx[29];
|
|
2766
2819
|
}
|
|
2767
2820
|
|
|
2768
2821
|
get removeEventById() {
|
|
2769
|
-
return this.$$.ctx[
|
|
2822
|
+
return this.$$.ctx[30];
|
|
2770
2823
|
}
|
|
2771
2824
|
|
|
2772
2825
|
get getView() {
|
|
2773
|
-
return this.$$.ctx[
|
|
2826
|
+
return this.$$.ctx[31];
|
|
2774
2827
|
}
|
|
2775
2828
|
|
|
2776
2829
|
get unselect() {
|
|
2777
|
-
return this.$$.ctx[
|
|
2830
|
+
return this.$$.ctx[32];
|
|
2778
2831
|
}
|
|
2779
2832
|
|
|
2780
2833
|
get dateFromPoint() {
|
|
2781
|
-
return this.$$.ctx[
|
|
2834
|
+
return this.$$.ctx[33];
|
|
2782
2835
|
}
|
|
2783
2836
|
|
|
2784
2837
|
get destroy() {
|
|
2785
|
-
return this.$$.ctx[
|
|
2838
|
+
return this.$$.ctx[34];
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
get next() {
|
|
2842
|
+
return this.$$.ctx[35];
|
|
2843
|
+
}
|
|
2844
|
+
|
|
2845
|
+
get prev() {
|
|
2846
|
+
return this.$$.ctx[36];
|
|
2786
2847
|
}
|
|
2787
2848
|
}
|
|
2788
2849
|
|
|
2789
|
-
export { DAY_IN_SECONDS, addDay, addDuration, ancestor, assign, bgEvent, btnTextDay, btnTextMonth, btnTextWeek, btnTextYear, ceil, cloneDate, cloneEvent, copyTime, createDate, createDuration, createElement, createEventChunk, createEventClasses, createEventContent, createEventSources, createEvents, createResources, createSlotTimeLimits, createTimes, createView, datesEqual, debounce, Calendar as default, eventIntersects, floor, flushDebounce, getElementWithPayload, getPayload, ghostEvent, hasPayload, hasYScroll, height, helperEvent, intl, intlRange, keyEnter, keys, listView, max, min, nextClosestDay, noTimePart, outsideEvent, pointerEvent, prepareEventChunks, prevClosestDay, previewEvent, rect, repositionEvent, runReposition, setContent, setMidnight, setPayload, sortEventChunks, subtractDay, subtractDuration, symbol, task, themeView, timelineView, toEventWithLocalDates, toISOString, toLocalDate, toSeconds, toViewWithLocalDates, viewResources };
|
|
2850
|
+
export { DAY_IN_SECONDS, addDay, addDuration, ancestor, assign, bgEvent, btnTextDay, btnTextMonth, btnTextWeek, btnTextYear, ceil, cloneDate, cloneEvent, copyTime, createDate, createDuration, createElement, createEventChunk, createEventClasses, createEventContent, createEventSources, createEvents, createResources, createSlotTimeLimits, createTimes, createView, datesEqual, debounce, Calendar as default, eventIntersects, floor, flushDebounce, getElementWithPayload, getPayload, ghostEvent, hasPayload, hasYScroll, height, helperEvent, intl, intlRange, keyEnter, keys, listView, max, min, nextClosestDay, nextDate, noTimePart, outsideEvent, pointerEvent, prepareEventChunks, prevClosestDay, prevDate, previewEvent, rect, repositionEvent, resourceBackgroundColor, resourceTextColor, runReposition, setContent, setMidnight, setPayload, sortEventChunks, subtractDay, subtractDuration, symbol, task, themeView, timelineView, toEventWithLocalDates, toISOString, toLocalDate, toSeconds, toViewWithLocalDates, viewResources };
|
package/package.json
CHANGED
package/src/Buttons.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext} from 'svelte';
|
|
3
|
-
import {createDate, cloneDate,
|
|
3
|
+
import {createDate, cloneDate, setContent, setMidnight, nextDate, prevDate} from './lib.js';
|
|
4
4
|
|
|
5
5
|
export let buttons;
|
|
6
6
|
|
|
@@ -11,17 +11,11 @@
|
|
|
11
11
|
$: isToday = today >= $_currentRange.start && today < $_currentRange.end || null;
|
|
12
12
|
|
|
13
13
|
function prev() {
|
|
14
|
-
|
|
15
|
-
if ($hiddenDays.length && $hiddenDays.length < 7) {
|
|
16
|
-
while ($hiddenDays.includes(d.getUTCDay())) {
|
|
17
|
-
subtractDay(d);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
$date = d;
|
|
14
|
+
$date = prevDate($date, $duration, $hiddenDays);
|
|
21
15
|
}
|
|
22
16
|
|
|
23
17
|
function next() {
|
|
24
|
-
$date =
|
|
18
|
+
$date = nextDate($date, $duration);
|
|
25
19
|
}
|
|
26
20
|
</script>
|
|
27
21
|
|
|
@@ -51,9 +45,10 @@
|
|
|
51
45
|
>{$buttonText[button]}</button>
|
|
52
46
|
{:else if $customButtons[button]}
|
|
53
47
|
<button
|
|
54
|
-
class="{$theme.button} ec-{button}"
|
|
48
|
+
class="{$theme.button} ec-{button}{$customButtons[button].active ? ' ' + $theme.active : ''}"
|
|
55
49
|
on:click={$customButtons[button].click}
|
|
56
|
-
|
|
50
|
+
use:setContent={$customButtons[button].text}
|
|
51
|
+
></button>
|
|
57
52
|
{:else if button != ''}
|
|
58
53
|
<button
|
|
59
54
|
class="{$theme.button}{$view === button ? ' ' + $theme.active : ''} ec-{button}"
|
package/src/Calendar.svelte
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
flushDebounce,
|
|
19
19
|
hasYScroll,
|
|
20
20
|
listView,
|
|
21
|
-
task
|
|
21
|
+
task, prevDate, nextDate
|
|
22
22
|
} from './lib.js';
|
|
23
23
|
|
|
24
24
|
export let plugins = [];
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
let state = new State(plugins, options);
|
|
30
30
|
setContext('state', state);
|
|
31
31
|
|
|
32
|
-
let {_viewComponent, _bodyEl, _interaction, _iClass, _events, _queue, _queue2, _tasks, _scrollable,
|
|
32
|
+
let {_viewComponent, _bodyEl, _interaction, _iClass, _events, _queue, _queue2, _tasks, _scrollable,
|
|
33
|
+
date, duration, hiddenDays, height, theme, view} = state;
|
|
33
34
|
|
|
34
35
|
// Reactively update options that did change
|
|
35
36
|
let prevOptions = {...options};
|
|
@@ -96,9 +97,7 @@
|
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
export function unselect() {
|
|
99
|
-
|
|
100
|
-
$_interaction.action.unselect();
|
|
101
|
-
}
|
|
100
|
+
$_interaction.action?.unselect();
|
|
102
101
|
return this;
|
|
103
102
|
}
|
|
104
103
|
|
|
@@ -111,6 +110,16 @@
|
|
|
111
110
|
destroy_component(component, true);
|
|
112
111
|
}
|
|
113
112
|
|
|
113
|
+
export function next() {
|
|
114
|
+
$date = nextDate($date, $duration);
|
|
115
|
+
return this;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function prev() {
|
|
119
|
+
$date = prevDate($date, $duration, $hiddenDays);
|
|
120
|
+
return this;
|
|
121
|
+
}
|
|
122
|
+
|
|
114
123
|
beforeUpdate(() => {
|
|
115
124
|
flushDebounce($_queue);
|
|
116
125
|
});
|
package/src/Toolbar.svelte
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext} from 'svelte';
|
|
3
|
+
import {keys} from './lib.js';
|
|
3
4
|
import Buttons from './Buttons.svelte';
|
|
4
5
|
|
|
5
6
|
let {headerToolbar, theme} = getContext('state');
|
|
@@ -11,15 +12,15 @@
|
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
$: {
|
|
14
|
-
for (let key of
|
|
15
|
+
for (let key of keys(sections)) {
|
|
15
16
|
sections[key] = $headerToolbar[key].split(' ').map(group => group.split(','));
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
</script>
|
|
19
20
|
|
|
20
21
|
<nav class="{$theme.toolbar}">
|
|
21
|
-
{#each
|
|
22
|
-
<div>
|
|
22
|
+
{#each keys(sections) as key}
|
|
23
|
+
<div class="ec-{key}">
|
|
23
24
|
{#each sections[key] as buttons}
|
|
24
25
|
{#if buttons.length > 1}
|
|
25
26
|
<div class="{$theme.buttonGroup}">
|
package/src/lib/date.js
CHANGED
|
@@ -124,10 +124,31 @@ export function copyTime(toDate, fromDate) {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
|
-
* Get duration value in seconds
|
|
127
|
+
* Get duration value in seconds
|
|
128
128
|
*/
|
|
129
|
-
export function toSeconds(duration
|
|
130
|
-
return duration
|
|
129
|
+
export function toSeconds(duration) {
|
|
130
|
+
return duration.seconds;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Move the date forward (when pressing the next button)
|
|
135
|
+
*/
|
|
136
|
+
export function nextDate(date, duration) {
|
|
137
|
+
addDuration(date, duration);
|
|
138
|
+
return date;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Move the date backward (when pressing the prev button)
|
|
143
|
+
*/
|
|
144
|
+
export function prevDate(date, duration, hiddenDays) {
|
|
145
|
+
subtractDuration(date, duration);
|
|
146
|
+
if (hiddenDays.length && hiddenDays.length < 7) {
|
|
147
|
+
while (hiddenDays.includes(date.getUTCDay())) {
|
|
148
|
+
subtractDay(date);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return date;
|
|
131
152
|
}
|
|
132
153
|
|
|
133
154
|
/**
|
package/src/lib/resources.js
CHANGED
|
@@ -7,3 +7,15 @@ export function createResources(input) {
|
|
|
7
7
|
eventTextColor: resource.eventTextColor
|
|
8
8
|
}));
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
export function resourceBackgroundColor(event, resources) {
|
|
12
|
+
return findResource(event, resources)?.eventBackgroundColor;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function resourceTextColor(event, resources) {
|
|
16
|
+
return findResource(event, resources)?.eventTextColor;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function findResource(event, resources) {
|
|
20
|
+
return resources.find(resource => event.resourceIds.includes(resource.id));
|
|
21
|
+
}
|
package/src/lib/times.js
CHANGED
|
@@ -3,7 +3,7 @@ import {addDuration, cloneDate, createDuration, DAY_IN_SECONDS, toISOString, toS
|
|
|
3
3
|
import {max as maxFn, min as minFn} from './utils.js';
|
|
4
4
|
import {bgEvent} from './events.js';
|
|
5
5
|
|
|
6
|
-
export function createTimes(date, $slotDuration, $_slotTimeLimits, $_intlSlotLabel
|
|
6
|
+
export function createTimes(date, $slotDuration, $_slotTimeLimits, $_intlSlotLabel) {
|
|
7
7
|
date = cloneDate(date);
|
|
8
8
|
let compact = $slotDuration.seconds < 3600;
|
|
9
9
|
let times = [];
|
|
@@ -15,8 +15,7 @@ export function createTimes(date, $slotDuration, $_slotTimeLimits, $_intlSlotLab
|
|
|
15
15
|
times.push([
|
|
16
16
|
toISOString(date),
|
|
17
17
|
$_intlSlotLabel.format(date),
|
|
18
|
-
times.length && (i || !compact)
|
|
19
|
-
$_intlDayHeaderAL && $_intlDayHeaderAL.format(date)
|
|
18
|
+
times.length && (i || !compact)
|
|
20
19
|
]);
|
|
21
20
|
addDuration(date, $slotDuration);
|
|
22
21
|
i = 1 - i;
|
package/src/storage/options.js
CHANGED
|
@@ -25,7 +25,7 @@ export function createOptions(plugins) {
|
|
|
25
25
|
day: 'numeric'
|
|
26
26
|
},
|
|
27
27
|
dayHeaderAriaLabelFormat: {
|
|
28
|
-
dateStyle: '
|
|
28
|
+
dateStyle: 'full'
|
|
29
29
|
},
|
|
30
30
|
displayEventEnd: true,
|
|
31
31
|
duration: {weeks: 1},
|
|
@@ -74,7 +74,7 @@ export function createOptions(plugins) {
|
|
|
74
74
|
},
|
|
75
75
|
slotMaxTime: '24:00:00',
|
|
76
76
|
slotMinTime: '00:00:00',
|
|
77
|
-
slotWidth:
|
|
77
|
+
slotWidth: 72,
|
|
78
78
|
theme: {
|
|
79
79
|
allDay: 'ec-all-day',
|
|
80
80
|
active: 'ec-active',
|
|
@@ -139,7 +139,7 @@ export function createParsers(plugins) {
|
|
|
139
139
|
events: createEvents,
|
|
140
140
|
eventSources: createEventSources,
|
|
141
141
|
hiddenDays: days => [...new Set(days)],
|
|
142
|
-
highlightedDates: dates => dates.map(createDate),
|
|
142
|
+
highlightedDates: dates => dates.map(date => setMidnight(createDate(date))),
|
|
143
143
|
resources: createResources,
|
|
144
144
|
scrollTime: createDuration,
|
|
145
145
|
slotDuration: createDuration,
|
package/src/storage/state.js
CHANGED
|
@@ -54,9 +54,6 @@ export default class {
|
|
|
54
54
|
this._viewDates = viewDates(this);
|
|
55
55
|
this._view = view2(this);
|
|
56
56
|
this._viewComponent = writable(undefined);
|
|
57
|
-
// Resources
|
|
58
|
-
this._resBgColor = writable(noop);
|
|
59
|
-
this._resTxtColor = writable(noop);
|
|
60
57
|
// Interaction
|
|
61
58
|
this._interaction = writable({});
|
|
62
59
|
this._iEvents = writable([null, null]); // interaction events: [drag/resize, pointer]
|
package/src/storage/stores.js
CHANGED
|
@@ -48,10 +48,10 @@ export function activeRange(state) {
|
|
|
48
48
|
|
|
49
49
|
export function currentRange(state) {
|
|
50
50
|
return derived(
|
|
51
|
-
[state.date, state.duration, state.firstDay
|
|
52
|
-
([$date, $duration, $firstDay
|
|
51
|
+
[state.date, state.duration, state.firstDay],
|
|
52
|
+
([$date, $duration, $firstDay]) => {
|
|
53
53
|
let start = cloneDate($date), end;
|
|
54
|
-
if ($
|
|
54
|
+
if ($duration.months) {
|
|
55
55
|
start.setUTCDate(1);
|
|
56
56
|
} else if ($duration.inWeeks) {
|
|
57
57
|
// First day of week
|
package/src/styles/index.scss
CHANGED
package/src/styles/timeline.scss
CHANGED
|
@@ -64,24 +64,26 @@
|
|
|
64
64
|
|
|
65
65
|
.ec-times {
|
|
66
66
|
display: flex;
|
|
67
|
-
border-
|
|
67
|
+
border-top: 1px solid var(--ec-border-color);;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
.ec-time {
|
|
71
71
|
border-left: 1px solid var(--ec-border-color);
|
|
72
72
|
box-sizing: border-box;
|
|
73
|
+
font-size: .95em;
|
|
73
74
|
min-height: 24px;
|
|
74
75
|
overflow: hidden;
|
|
75
76
|
text-overflow: ellipsis;
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
.ec-time, .ec-line {
|
|
79
|
-
width:
|
|
80
|
+
width: 72px;
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
.ec-events {
|
|
83
84
|
position: relative;
|
|
84
85
|
height: 100%;
|
|
86
|
+
margin: 0;
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
.ec-event {
|