@event-calendar/core 3.4.0 → 3.5.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 CHANGED
@@ -61,6 +61,7 @@ Inspired by [FullCalendar](https://fullcalendar.io/), implements similar options
61
61
  - [eventStartEditable](#eventstarteditable)
62
62
  - [eventTextColor](#eventtextcolor)
63
63
  - [eventTimeFormat](#eventtimeformat)
64
+ - [filterEventsWithResources](#filtereventswithresources)
64
65
  - [filterResourcesWithEvents](#filterresourceswithevents)
65
66
  - [firstDay](#firstday)
66
67
  - [flexibleSlotTimeLimits](#flexibleslottimelimits)
@@ -204,8 +205,8 @@ import '@event-calendar/core/index.css';
204
205
  ### Pre-built browser ready bundle
205
206
  Include the following lines of code in the `<head>` section of your page:
206
207
  ```html
207
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.4.0/event-calendar.min.css">
208
- <script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.4.0/event-calendar.min.js"></script>
208
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.5.0/event-calendar.min.css">
209
+ <script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@3.5.0/event-calendar.min.js"></script>
209
210
  ```
210
211
 
211
212
  <details>
@@ -1506,6 +1507,12 @@ Sets the default text color for events on the calendar.
1506
1507
 
1507
1508
  You can use any of the CSS color formats such `'#f00'`, `'#ff0000'`, `'rgb(255,0,0)'`, or `'red'`.
1508
1509
 
1510
+ ### filterEventsWithResources
1511
+ - Type `boolean`
1512
+ - Default `false`
1513
+
1514
+ Determines whether events that do not belong to the current array of [resources](#resources) should be hidden in `dayGrid`/`timeGrid`/`list` views.
1515
+
1509
1516
  ### filterResourcesWithEvents
1510
1517
  - Type `boolean`
1511
1518
  - Default `false`
@@ -2815,6 +2822,16 @@ The title of the resource. See [Content](#content)
2815
2822
  </td>
2816
2823
  <td>Default text color for this resource's events</td>
2817
2824
  </tr>
2825
+ <tr>
2826
+ <td>
2827
+
2828
+ `extendedProps`
2829
+ </td>
2830
+ <td>
2831
+
2832
+ A plain object holding miscellaneous properties specified during parsing in the explicitly given `extendedProps` field
2833
+ </td>
2834
+ </tr>
2818
2835
  </table>
2819
2836
 
2820
2837
  ### Parsing resource from a plain object
@@ -2862,6 +2879,16 @@ Here are all admissible fields for the resource’s input object:
2862
2879
  `string` Sets the default text color for this resource's events just like the calendar-wide [eventTextColor](#eventtextcolor) option. Default `undefined`
2863
2880
  </td>
2864
2881
  </tr>
2882
+ <tr>
2883
+ <td>
2884
+
2885
+ `extendedProps`
2886
+ </td>
2887
+ <td>
2888
+
2889
+ `object` A plain object with any miscellaneous properties. It will be directly transferred to the `extendedProps` property of the Resource object. Default `{}`
2890
+ </td>
2891
+ </tr>
2865
2892
  </table>
2866
2893
 
2867
2894
  ## View object
package/index.js CHANGED
@@ -613,17 +613,24 @@ function runReposition(refs, data) {
613
613
  }
614
614
 
615
615
  /**
616
- * Check whether the event intersects with the given date range and resource
616
+ * Check whether the event intersects with the given date range and resources
617
617
  * @param event
618
618
  * @param start
619
619
  * @param end
620
- * @param [resource]
620
+ * @param resources
621
621
  * @return boolean
622
622
  */
623
- function eventIntersects(event, start, end, resource) {
624
- return event.start < end && event.end > start && (
625
- resource === undefined || event.resourceIds.includes(resource.id)
626
- );
623
+ function eventIntersects(event, start, end, resources) {
624
+ if (event.start < end && event.end > start) {
625
+ if (resources) {
626
+ if (!isArray(resources)) {
627
+ resources = [resources];
628
+ }
629
+ return resources.some(resource => event.resourceIds.includes(resource.id));
630
+ }
631
+ return true;
632
+ }
633
+ return false;
627
634
  }
628
635
 
629
636
  function helperEvent(display) {
@@ -679,7 +686,8 @@ function createResources(input) {
679
686
  id: String(resource.id),
680
687
  title: resource.title || '',
681
688
  eventBackgroundColor: resource.eventBackgroundColor,
682
- eventTextColor: resource.eventTextColor
689
+ eventTextColor: resource.eventTextColor,
690
+ extendedProps: resource.extendedProps ?? {}
683
691
  }));
684
692
  }
685
693
 
@@ -884,6 +892,7 @@ function createOptions(plugins) {
884
892
  hour: 'numeric',
885
893
  minute: '2-digit'
886
894
  },
895
+ filterEventsWithResources: false,
887
896
  filterResourcesWithEvents: false,
888
897
  firstDay: 0,
889
898
  flexibleSlotTimeLimits: false, // ec option
@@ -1356,7 +1365,7 @@ function validKey(key, state) {
1356
1365
  return state.hasOwnProperty(key) && key[0] !== '_';
1357
1366
  }
1358
1367
 
1359
- /* packages/core/src/Buttons.svelte generated by Svelte v4.2.18 */
1368
+ /* packages/core/src/Buttons.svelte generated by Svelte v4.2.19 */
1360
1369
 
1361
1370
  function get_each_context$2(ctx, list, i) {
1362
1371
  const child_ctx = ctx.slice();
@@ -1858,7 +1867,7 @@ class Buttons extends SvelteComponent {
1858
1867
  }
1859
1868
  }
1860
1869
 
1861
- /* packages/core/src/Toolbar.svelte generated by Svelte v4.2.18 */
1870
+ /* packages/core/src/Toolbar.svelte generated by Svelte v4.2.19 */
1862
1871
 
1863
1872
  function get_each_context$1(ctx, list, i) {
1864
1873
  const child_ctx = ctx.slice();
@@ -2250,7 +2259,7 @@ class Toolbar extends SvelteComponent {
2250
2259
  }
2251
2260
  }
2252
2261
 
2253
- /* packages/core/src/Auxiliary.svelte generated by Svelte v4.2.18 */
2262
+ /* packages/core/src/Auxiliary.svelte generated by Svelte v4.2.19 */
2254
2263
 
2255
2264
  function get_each_context(ctx, list, i) {
2256
2265
  const child_ctx = ctx.slice();
@@ -2458,7 +2467,7 @@ class Auxiliary extends SvelteComponent {
2458
2467
  }
2459
2468
  }
2460
2469
 
2461
- /* packages/core/src/Calendar.svelte generated by Svelte v4.2.18 */
2470
+ /* packages/core/src/Calendar.svelte generated by Svelte v4.2.19 */
2462
2471
 
2463
2472
  function create_fragment(ctx) {
2464
2473
  let div;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@event-calendar/core",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "title": "Event Calendar Core package",
5
5
  "description": "Full-sized drag & drop event calendar with resource & timeline views",
6
6
  "keywords": [
@@ -28,6 +28,6 @@
28
28
  "./package.json": "./package.json"
29
29
  },
30
30
  "dependencies": {
31
- "svelte": "^4.2.16"
31
+ "svelte": "^4.2.19"
32
32
  }
33
33
  }
package/src/lib/events.js CHANGED
@@ -245,17 +245,24 @@ export function runReposition(refs, data) {
245
245
  }
246
246
 
247
247
  /**
248
- * Check whether the event intersects with the given date range and resource
248
+ * Check whether the event intersects with the given date range and resources
249
249
  * @param event
250
250
  * @param start
251
251
  * @param end
252
- * @param [resource]
252
+ * @param resources
253
253
  * @return boolean
254
254
  */
255
- export function eventIntersects(event, start, end, resource) {
256
- return event.start < end && event.end > start && (
257
- resource === undefined || event.resourceIds.includes(resource.id)
258
- );
255
+ export function eventIntersects(event, start, end, resources) {
256
+ if (event.start < end && event.end > start) {
257
+ if (resources) {
258
+ if (!isArray(resources)) {
259
+ resources = [resources];
260
+ }
261
+ return resources.some(resource => event.resourceIds.includes(resource.id));
262
+ }
263
+ return true;
264
+ }
265
+ return false;
259
266
  }
260
267
 
261
268
  export function helperEvent(display) {
@@ -3,7 +3,8 @@ export function createResources(input) {
3
3
  id: String(resource.id),
4
4
  title: resource.title || '',
5
5
  eventBackgroundColor: resource.eventBackgroundColor,
6
- eventTextColor: resource.eventTextColor
6
+ eventTextColor: resource.eventTextColor,
7
+ extendedProps: resource.extendedProps ?? {}
7
8
  }));
8
9
  }
9
10
 
@@ -45,6 +45,7 @@ export function createOptions(plugins) {
45
45
  hour: 'numeric',
46
46
  minute: '2-digit'
47
47
  },
48
+ filterEventsWithResources: false,
48
49
  filterResourcesWithEvents: false,
49
50
  firstDay: 0,
50
51
  flexibleSlotTimeLimits: false, // ec option