@fullcalendar/scrollgrid 7.0.0-beta.1 → 7.0.0-beta.4

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/index.cjs CHANGED
@@ -13,7 +13,7 @@ var premiumCommonPlugin__default = /*#__PURE__*/_interopDefaultLegacy(premiumCom
13
13
 
14
14
  var index = index_cjs.createPlugin({
15
15
  name: '@fullcalendar/scrollgrid',
16
- premiumReleaseDate: '2024-10-09',
16
+ premiumReleaseDate: '2025-01-09',
17
17
  deps: [premiumCommonPlugin__default["default"]],
18
18
  scrollerSyncerClass: internalCommon.ScrollerSyncer
19
19
  });
package/index.global.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- FullCalendar ScrollGrid Plugin v7.0.0-beta.1
2
+ FullCalendar ScrollGrid Plugin v7.0.0-beta.4
3
3
  Docs & License: https://fullcalendar.io/docs/premium
4
4
  (c) 2024 Adam Shaw
5
5
  */
@@ -12,7 +12,7 @@ FullCalendar.ScrollGrid = (function (exports, core, premiumCommonPlugin, interna
12
12
 
13
13
  /*
14
14
  Fires:
15
- - scrollEnd: (x, y) => void
15
+ - scrollEnd: ({ x, y, isUser }) => void
16
16
  */
17
17
  class ScrollerSyncer {
18
18
  constructor(isHorizontal = false) {
@@ -64,9 +64,9 @@ FullCalendar.ScrollGrid = (function (exports, core, premiumCommonPlugin, interna
64
64
  }
65
65
  bindScroller(scroller) {
66
66
  let { isHorizontal } = this;
67
- const onScroll = (isWheel, isTouch) => {
67
+ const onScroll = (isUser) => {
68
68
  if (!this.isPaused) {
69
- if (!this.masterScroller || (this.masterScroller !== scroller && (isWheel || isTouch))) {
69
+ if (!this.masterScroller || (this.masterScroller !== scroller && isUser)) {
70
70
  this.assignMaster(scroller);
71
71
  }
72
72
  if (this.masterScroller === scroller) { // dealing with current
@@ -84,10 +84,30 @@ FullCalendar.ScrollGrid = (function (exports, core, premiumCommonPlugin, interna
84
84
  }
85
85
  }
86
86
  };
87
- const onScrollEnd = () => {
87
+ const onScrollEnd = (isUser) => {
88
88
  if (this.masterScroller === scroller) {
89
89
  this.masterScroller = null;
90
- this.emitter.trigger('scrollEnd', this.x, this.y);
90
+ const { x, y } = this; // new values
91
+ let isMoved = false;
92
+ if (this.isHorizontal) {
93
+ if (x !== this.prevX) {
94
+ this.prevX = x;
95
+ isMoved = true;
96
+ }
97
+ }
98
+ else {
99
+ if (y !== this.prevY) {
100
+ this.prevY = y;
101
+ isMoved = true;
102
+ }
103
+ }
104
+ if (isMoved) {
105
+ this.emitter.trigger('scrollEnd', {
106
+ x,
107
+ y,
108
+ isUser,
109
+ });
110
+ }
91
111
  }
92
112
  };
93
113
  scroller.listener.emitter.on('scroll', onScroll);
@@ -109,7 +129,7 @@ FullCalendar.ScrollGrid = (function (exports, core, premiumCommonPlugin, interna
109
129
 
110
130
  var plugin = core.createPlugin({
111
131
  name: '@fullcalendar/scrollgrid',
112
- premiumReleaseDate: '2024-10-09',
132
+ premiumReleaseDate: '2025-01-09',
113
133
  deps: [premiumCommonPlugin__default["default"]],
114
134
  scrollerSyncerClass: ScrollerSyncer
115
135
  });
@@ -1,6 +1,6 @@
1
1
  /*!
2
- FullCalendar ScrollGrid Plugin v7.0.0-beta.1
2
+ FullCalendar ScrollGrid Plugin v7.0.0-beta.4
3
3
  Docs & License: https://fullcalendar.io/docs/premium
4
4
  (c) 2024 Adam Shaw
5
5
  */
6
- FullCalendar.ScrollGrid=function(r,s,l,e){"use strict";function t(r){return r&&r.__esModule?r:{default:r}}var o=t(l);class i{constructor(r=!1){this.isHorizontal=r,this.emitter=new e.Emitter,this.scrollers=[],this.destroyFuncs=[],this.isPaused=!1}handleChildren(r){if(!e.isArraysEqual(this.scrollers,r)){this.destroy();for(const s of r)s&&(this.destroyFuncs.push(this.bindScroller(s)),this.scrollers.push(s))}}destroy(){for(let r of this.destroyFuncs)r();this.destroyFuncs=[],this.scrollers=[]}get x(){const{scrollers:r,masterScroller:s}=this;return(s||r[0]).x}get y(){const{scrollers:r,masterScroller:s}=this;return(s||r[0]).y}scrollTo(r){this.isPaused=!0;const{scrollers:s}=this;for(let l of s)l.scrollTo(r);this.isPaused=!1}addScrollEndListener(r){this.emitter.on("scrollEnd",r)}removeScrollEndListener(r){this.emitter.off("scrollEnd",r)}bindScroller(r){let{isHorizontal:s}=this;const l=(l,e)=>{if(!this.isPaused&&((!this.masterScroller||this.masterScroller!==r&&(l||e))&&this.assignMaster(r),this.masterScroller===r))for(let l of this.scrollers)l!==r&&(s?l.scrollTo({x:r.x}):l.scrollTo({y:r.y}))},e=()=>{this.masterScroller===r&&(this.masterScroller=null,this.emitter.trigger("scrollEnd",this.x,this.y))};return r.listener.emitter.on("scroll",l),r.listener.emitter.on("scrollEnd",e),()=>{r.listener.emitter.off("scroll",l),r.listener.emitter.off("scrollEnd",e)}}assignMaster(r){this.masterScroller=r;for(let s of this.scrollers)s!==r&&s.endScroll()}}var n=s.createPlugin({name:"@fullcalendar/scrollgrid",premiumReleaseDate:"2024-10-09",deps:[o.default],scrollerSyncerClass:i}),c={__proto__:null,ScrollerSyncer:i};return s.globalPlugins.push(n),r.Internal=c,r.default=n,Object.defineProperty(r,"__esModule",{value:!0}),r}({},FullCalendar,FullCalendar.PremiumCommon,FullCalendar.Internal);
6
+ FullCalendar.ScrollGrid=function(r,s,e,l){"use strict";function t(r){return r&&r.__esModule?r:{default:r}}var o=t(e);class i{constructor(r=!1){this.isHorizontal=r,this.emitter=new l.Emitter,this.scrollers=[],this.destroyFuncs=[],this.isPaused=!1}handleChildren(r){if(!l.isArraysEqual(this.scrollers,r)){this.destroy();for(const s of r)s&&(this.destroyFuncs.push(this.bindScroller(s)),this.scrollers.push(s))}}destroy(){for(let r of this.destroyFuncs)r();this.destroyFuncs=[],this.scrollers=[]}get x(){const{scrollers:r,masterScroller:s}=this;return(s||r[0]).x}get y(){const{scrollers:r,masterScroller:s}=this;return(s||r[0]).y}scrollTo(r){this.isPaused=!0;const{scrollers:s}=this;for(let e of s)e.scrollTo(r);this.isPaused=!1}addScrollEndListener(r){this.emitter.on("scrollEnd",r)}removeScrollEndListener(r){this.emitter.off("scrollEnd",r)}bindScroller(r){let{isHorizontal:s}=this;const e=e=>{if(!this.isPaused&&((!this.masterScroller||this.masterScroller!==r&&e)&&this.assignMaster(r),this.masterScroller===r))for(let e of this.scrollers)e!==r&&(s?e.scrollTo({x:r.x}):e.scrollTo({y:r.y}))},l=s=>{if(this.masterScroller===r){this.masterScroller=null;const{x:r,y:e}=this;let l=!1;this.isHorizontal?r!==this.prevX&&(this.prevX=r,l=!0):e!==this.prevY&&(this.prevY=e,l=!0),l&&this.emitter.trigger("scrollEnd",{x:r,y:e,isUser:s})}};return r.listener.emitter.on("scroll",e),r.listener.emitter.on("scrollEnd",l),()=>{r.listener.emitter.off("scroll",e),r.listener.emitter.off("scrollEnd",l)}}assignMaster(r){this.masterScroller=r;for(let s of this.scrollers)s!==r&&s.endScroll()}}var n=s.createPlugin({name:"@fullcalendar/scrollgrid",premiumReleaseDate:"2025-01-09",deps:[o.default],scrollerSyncerClass:i}),c={__proto__:null,ScrollerSyncer:i};return s.globalPlugins.push(n),r.Internal=c,r.default=n,Object.defineProperty(r,"__esModule",{value:!0}),r}({},FullCalendar,FullCalendar.PremiumCommon,FullCalendar.Internal);
package/index.js CHANGED
@@ -5,7 +5,7 @@ import '@fullcalendar/core/internal.js';
5
5
 
6
6
  var index = createPlugin({
7
7
  name: '@fullcalendar/scrollgrid',
8
- premiumReleaseDate: '2024-10-09',
8
+ premiumReleaseDate: '2025-01-09',
9
9
  deps: [premiumCommonPlugin],
10
10
  scrollerSyncerClass: ScrollerSyncer
11
11
  });
package/internal.cjs CHANGED
@@ -6,7 +6,7 @@ var internal_cjs = require('@fullcalendar/core/internal.cjs');
6
6
 
7
7
  /*
8
8
  Fires:
9
- - scrollEnd: (x, y) => void
9
+ - scrollEnd: ({ x, y, isUser }) => void
10
10
  */
11
11
  class ScrollerSyncer {
12
12
  constructor(isHorizontal = false) {
@@ -58,9 +58,9 @@ class ScrollerSyncer {
58
58
  }
59
59
  bindScroller(scroller) {
60
60
  let { isHorizontal } = this;
61
- const onScroll = (isWheel, isTouch) => {
61
+ const onScroll = (isUser) => {
62
62
  if (!this.isPaused) {
63
- if (!this.masterScroller || (this.masterScroller !== scroller && (isWheel || isTouch))) {
63
+ if (!this.masterScroller || (this.masterScroller !== scroller && isUser)) {
64
64
  this.assignMaster(scroller);
65
65
  }
66
66
  if (this.masterScroller === scroller) { // dealing with current
@@ -78,10 +78,30 @@ class ScrollerSyncer {
78
78
  }
79
79
  }
80
80
  };
81
- const onScrollEnd = () => {
81
+ const onScrollEnd = (isUser) => {
82
82
  if (this.masterScroller === scroller) {
83
83
  this.masterScroller = null;
84
- this.emitter.trigger('scrollEnd', this.x, this.y);
84
+ const { x, y } = this; // new values
85
+ let isMoved = false;
86
+ if (this.isHorizontal) {
87
+ if (x !== this.prevX) {
88
+ this.prevX = x;
89
+ isMoved = true;
90
+ }
91
+ }
92
+ else {
93
+ if (y !== this.prevY) {
94
+ this.prevY = y;
95
+ isMoved = true;
96
+ }
97
+ }
98
+ if (isMoved) {
99
+ this.emitter.trigger('scrollEnd', {
100
+ x,
101
+ y,
102
+ isUser,
103
+ });
104
+ }
85
105
  }
86
106
  };
87
107
  scroller.listener.emitter.on('scroll', onScroll);
package/internal.d.ts CHANGED
@@ -7,6 +7,8 @@ declare class ScrollerSyncer implements ScrollerSyncerInterface {
7
7
  private destroyFuncs;
8
8
  private masterScroller;
9
9
  private isPaused;
10
+ private prevX;
11
+ private prevY;
10
12
  constructor(isHorizontal?: boolean);
11
13
  handleChildren(scrollers: Scroller[]): void;
12
14
  destroy(): void;
@@ -16,8 +18,16 @@ declare class ScrollerSyncer implements ScrollerSyncerInterface {
16
18
  x?: number;
17
19
  y?: number;
18
20
  }): void;
19
- addScrollEndListener(handler: (x: number, y: number) => void): void;
20
- removeScrollEndListener(handler: (x: number, y: number) => void): void;
21
+ addScrollEndListener(handler: (arg: {
22
+ x: number;
23
+ y: number;
24
+ isUser: boolean;
25
+ }) => void): void;
26
+ removeScrollEndListener(handler: (arg: {
27
+ x: number;
28
+ y: number;
29
+ isUser: boolean;
30
+ }) => void): void;
21
31
  bindScroller(scroller: Scroller): () => void;
22
32
  assignMaster(masterScroller: Scroller): void;
23
33
  }
package/internal.js CHANGED
@@ -2,7 +2,7 @@ import { Emitter, isArraysEqual } from '@fullcalendar/core/internal.js';
2
2
 
3
3
  /*
4
4
  Fires:
5
- - scrollEnd: (x, y) => void
5
+ - scrollEnd: ({ x, y, isUser }) => void
6
6
  */
7
7
  class ScrollerSyncer {
8
8
  constructor(isHorizontal = false) {
@@ -54,9 +54,9 @@ class ScrollerSyncer {
54
54
  }
55
55
  bindScroller(scroller) {
56
56
  let { isHorizontal } = this;
57
- const onScroll = (isWheel, isTouch) => {
57
+ const onScroll = (isUser) => {
58
58
  if (!this.isPaused) {
59
- if (!this.masterScroller || (this.masterScroller !== scroller && (isWheel || isTouch))) {
59
+ if (!this.masterScroller || (this.masterScroller !== scroller && isUser)) {
60
60
  this.assignMaster(scroller);
61
61
  }
62
62
  if (this.masterScroller === scroller) { // dealing with current
@@ -74,10 +74,30 @@ class ScrollerSyncer {
74
74
  }
75
75
  }
76
76
  };
77
- const onScrollEnd = () => {
77
+ const onScrollEnd = (isUser) => {
78
78
  if (this.masterScroller === scroller) {
79
79
  this.masterScroller = null;
80
- this.emitter.trigger('scrollEnd', this.x, this.y);
80
+ const { x, y } = this; // new values
81
+ let isMoved = false;
82
+ if (this.isHorizontal) {
83
+ if (x !== this.prevX) {
84
+ this.prevX = x;
85
+ isMoved = true;
86
+ }
87
+ }
88
+ else {
89
+ if (y !== this.prevY) {
90
+ this.prevY = y;
91
+ isMoved = true;
92
+ }
93
+ }
94
+ if (isMoved) {
95
+ this.emitter.trigger('scrollEnd', {
96
+ x,
97
+ y,
98
+ isUser,
99
+ });
100
+ }
81
101
  }
82
102
  };
83
103
  scroller.listener.emitter.on('scroll', onScroll);
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@fullcalendar/scrollgrid",
3
- "version": "7.0.0-beta.1",
3
+ "version": "7.0.0-beta.4",
4
4
  "title": "FullCalendar ScrollGrid Plugin",
5
5
  "description": "Tabular data chunked into scrollable panes",
6
6
  "dependencies": {
7
- "@fullcalendar/premium-common": "7.0.0-beta.1"
7
+ "@fullcalendar/premium-common": "7.0.0-beta.4"
8
8
  },
9
9
  "peerDependencies": {
10
- "@fullcalendar/core": "7.0.0-beta.1"
10
+ "@fullcalendar/core": "7.0.0-beta.4"
11
11
  },
12
12
  "type": "module",
13
13
  "keywords": [