@fullcalendar/scrollgrid 6.0.0-beta.1 → 6.0.0-beta.2
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/LICENSE.md +5 -5
- package/index.cjs +22 -0
- package/index.d.ts +7 -0
- package/{main.global.js → index.global.js} +164 -261
- package/index.global.min.js +6 -0
- package/index.js +14 -0
- package/{main.cjs.js → internal.cjs} +148 -267
- package/{main.d.ts → internal.d.ts} +4 -13
- package/{main.js → internal.js} +95 -210
- package/package.json +42 -18
- package/main.global.min.js +0 -6
- package/main.js.map +0 -1
|
@@ -1,105 +1,19 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar
|
|
3
|
-
Docs & License: https://fullcalendar.io/
|
|
2
|
+
FullCalendar ScrollGrid Plugin v6.0.0-beta.2
|
|
3
|
+
Docs & License: https://fullcalendar.io/premium
|
|
4
4
|
(c) 2022 Adam Shaw
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
FullCalendar.ScrollGrid = (function (exports, internal$1, core, premiumCommonPlugin, preact) {
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
function
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
10
10
|
|
|
11
|
-
var premiumCommonPlugin__default = /*#__PURE__*/
|
|
12
|
-
|
|
13
|
-
const WHEEL_EVENT_NAMES = 'wheel mousewheel DomMouseScroll MozMousePixelScroll'.split(' ');
|
|
14
|
-
/*
|
|
15
|
-
ALSO, with the ability to disable touch
|
|
16
|
-
*/
|
|
17
|
-
class ScrollListener {
|
|
18
|
-
constructor(el) {
|
|
19
|
-
this.el = el;
|
|
20
|
-
this.emitter = new common.Emitter();
|
|
21
|
-
this.isScrolling = false;
|
|
22
|
-
this.isTouching = false; // user currently has finger down?
|
|
23
|
-
this.isRecentlyWheeled = false;
|
|
24
|
-
this.isRecentlyScrolled = false;
|
|
25
|
-
this.wheelWaiter = new common.DelayedRunner(this._handleWheelWaited.bind(this));
|
|
26
|
-
this.scrollWaiter = new common.DelayedRunner(this._handleScrollWaited.bind(this));
|
|
27
|
-
// Handlers
|
|
28
|
-
// ----------------------------------------------------------------------------------------------
|
|
29
|
-
this.handleScroll = () => {
|
|
30
|
-
this.startScroll();
|
|
31
|
-
this.emitter.trigger('scroll', this.isRecentlyWheeled, this.isTouching);
|
|
32
|
-
this.isRecentlyScrolled = true;
|
|
33
|
-
this.scrollWaiter.request(500);
|
|
34
|
-
};
|
|
35
|
-
// will fire *before* the scroll event is fired (might not cause a scroll)
|
|
36
|
-
this.handleWheel = () => {
|
|
37
|
-
this.isRecentlyWheeled = true;
|
|
38
|
-
this.wheelWaiter.request(500);
|
|
39
|
-
};
|
|
40
|
-
// will fire *before* the scroll event is fired (might not cause a scroll)
|
|
41
|
-
this.handleTouchStart = () => {
|
|
42
|
-
this.isTouching = true;
|
|
43
|
-
};
|
|
44
|
-
this.handleTouchEnd = () => {
|
|
45
|
-
this.isTouching = false;
|
|
46
|
-
// if the user ended their touch, and the scroll area wasn't moving,
|
|
47
|
-
// we consider this to be the end of the scroll.
|
|
48
|
-
if (!this.isRecentlyScrolled) {
|
|
49
|
-
this.endScroll(); // won't fire if already ended
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
el.addEventListener('scroll', this.handleScroll);
|
|
53
|
-
el.addEventListener('touchstart', this.handleTouchStart, { passive: true });
|
|
54
|
-
el.addEventListener('touchend', this.handleTouchEnd);
|
|
55
|
-
for (let eventName of WHEEL_EVENT_NAMES) {
|
|
56
|
-
el.addEventListener(eventName, this.handleWheel);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
destroy() {
|
|
60
|
-
let { el } = this;
|
|
61
|
-
el.removeEventListener('scroll', this.handleScroll);
|
|
62
|
-
el.removeEventListener('touchstart', this.handleTouchStart, { passive: true });
|
|
63
|
-
el.removeEventListener('touchend', this.handleTouchEnd);
|
|
64
|
-
for (let eventName of WHEEL_EVENT_NAMES) {
|
|
65
|
-
el.removeEventListener(eventName, this.handleWheel);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// Start / Stop
|
|
69
|
-
// ----------------------------------------------------------------------------------------------
|
|
70
|
-
startScroll() {
|
|
71
|
-
if (!this.isScrolling) {
|
|
72
|
-
this.isScrolling = true;
|
|
73
|
-
this.emitter.trigger('scrollStart', this.isRecentlyWheeled, this.isTouching);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
endScroll() {
|
|
77
|
-
if (this.isScrolling) {
|
|
78
|
-
this.emitter.trigger('scrollEnd');
|
|
79
|
-
this.isScrolling = false;
|
|
80
|
-
this.isRecentlyScrolled = true;
|
|
81
|
-
this.isRecentlyWheeled = false;
|
|
82
|
-
this.scrollWaiter.clear();
|
|
83
|
-
this.wheelWaiter.clear();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
_handleScrollWaited() {
|
|
87
|
-
this.isRecentlyScrolled = false;
|
|
88
|
-
// only end the scroll if not currently touching.
|
|
89
|
-
// if touching, the scrolling will end later, on touchend.
|
|
90
|
-
if (!this.isTouching) {
|
|
91
|
-
this.endScroll(); // won't fire if already ended
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
_handleWheelWaited() {
|
|
95
|
-
this.isRecentlyWheeled = false;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
11
|
+
var premiumCommonPlugin__default = /*#__PURE__*/_interopDefault(premiumCommonPlugin);
|
|
98
12
|
|
|
99
13
|
// TODO: assume the el has no borders?
|
|
100
14
|
function getScrollCanvasOrigin(scrollEl) {
|
|
101
15
|
let rect = scrollEl.getBoundingClientRect();
|
|
102
|
-
let edges =
|
|
16
|
+
let edges = internal$1.computeEdges(scrollEl); // TODO: pass in isRtl?
|
|
103
17
|
return {
|
|
104
18
|
left: rect.left + edges.borderLeft + edges.scrollbarLeft - getScrollFromLeftEdge(scrollEl),
|
|
105
19
|
top: rect.top + edges.borderTop - scrollEl.scrollTop,
|
|
@@ -162,16 +76,13 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
162
76
|
system = 'negative'; // scroll is a negative number from the right edge
|
|
163
77
|
}
|
|
164
78
|
}
|
|
165
|
-
|
|
79
|
+
internal$1.removeElement(el);
|
|
166
80
|
return system;
|
|
167
81
|
}
|
|
168
82
|
|
|
169
|
-
const IS_MS_EDGE = typeof navigator !== 'undefined' && /Edge/.test(navigator.userAgent); // TODO: what about Chromeum-based Edge?
|
|
170
83
|
const STICKY_SELECTOR = '.fc-sticky';
|
|
171
84
|
/*
|
|
172
|
-
|
|
173
|
-
- support in IE11
|
|
174
|
-
- nice centering support
|
|
85
|
+
Goes beyond mere position:sticky, allows horizontal centering
|
|
175
86
|
|
|
176
87
|
REQUIREMENT: fc-sticky elements, if the fc-sticky className is taken away, should NOT have relative or absolute positioning.
|
|
177
88
|
This is because we attach the coords with JS, and the VDOM might take away the fc-sticky class but doesn't know kill the positioning.
|
|
@@ -182,41 +93,20 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
182
93
|
constructor(scrollEl, isRtl) {
|
|
183
94
|
this.scrollEl = scrollEl;
|
|
184
95
|
this.isRtl = isRtl;
|
|
185
|
-
this.usingRelative = null;
|
|
186
96
|
this.updateSize = () => {
|
|
187
97
|
let { scrollEl } = this;
|
|
188
|
-
let els =
|
|
98
|
+
let els = internal$1.findElements(scrollEl, STICKY_SELECTOR);
|
|
189
99
|
let elGeoms = this.queryElGeoms(els);
|
|
190
100
|
let viewportWidth = scrollEl.clientWidth;
|
|
191
|
-
|
|
192
|
-
if (this.usingRelative) {
|
|
193
|
-
let elDestinations = this.computeElDestinations(elGeoms, viewportWidth); // read before prepPositioning
|
|
194
|
-
assignRelativePositions(els, elGeoms, elDestinations, viewportWidth, viewportHeight);
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
assignStickyPositions(els, elGeoms, viewportWidth);
|
|
198
|
-
}
|
|
101
|
+
assignStickyPositions(els, elGeoms, viewportWidth);
|
|
199
102
|
};
|
|
200
|
-
this.usingRelative =
|
|
201
|
-
!getStickySupported() || // IE11
|
|
202
|
-
// https://stackoverflow.com/questions/56835658/in-microsoft-edge-sticky-positioning-doesnt-work-when-combined-with-dir-rtl
|
|
203
|
-
(IS_MS_EDGE && isRtl);
|
|
204
|
-
if (this.usingRelative) {
|
|
205
|
-
this.listener = new ScrollListener(scrollEl);
|
|
206
|
-
this.listener.emitter.on('scrollEnd', this.updateSize);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
destroy() {
|
|
210
|
-
if (this.listener) {
|
|
211
|
-
this.listener.destroy();
|
|
212
|
-
}
|
|
213
103
|
}
|
|
214
104
|
queryElGeoms(els) {
|
|
215
105
|
let { scrollEl, isRtl } = this;
|
|
216
106
|
let canvasOrigin = getScrollCanvasOrigin(scrollEl);
|
|
217
107
|
let elGeoms = [];
|
|
218
108
|
for (let el of els) {
|
|
219
|
-
let parentBound =
|
|
109
|
+
let parentBound = internal$1.translateRect(internal$1.computeInnerRect(el.parentNode, true, true), // weird way to call this!!!
|
|
220
110
|
-canvasOrigin.left, -canvasOrigin.top);
|
|
221
111
|
let elRect = el.getBoundingClientRect();
|
|
222
112
|
let computedStyles = window.getComputedStyle(el);
|
|
@@ -229,7 +119,7 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
229
119
|
textAlign = isRtl ? 'left' : 'right';
|
|
230
120
|
}
|
|
231
121
|
if (computedStyles.position !== 'sticky') {
|
|
232
|
-
naturalBound =
|
|
122
|
+
naturalBound = internal$1.translateRect(elRect, -canvasOrigin.left - (parseFloat(computedStyles.left) || 0), // could be 'auto'
|
|
233
123
|
-canvasOrigin.top - (parseFloat(computedStyles.top) || 0));
|
|
234
124
|
}
|
|
235
125
|
elGeoms.push({
|
|
@@ -242,59 +132,6 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
242
132
|
}
|
|
243
133
|
return elGeoms;
|
|
244
134
|
}
|
|
245
|
-
// only for IE
|
|
246
|
-
computeElDestinations(elGeoms, viewportWidth) {
|
|
247
|
-
let { scrollEl } = this;
|
|
248
|
-
let viewportTop = scrollEl.scrollTop;
|
|
249
|
-
let viewportLeft = getScrollFromLeftEdge(scrollEl);
|
|
250
|
-
let viewportRight = viewportLeft + viewportWidth;
|
|
251
|
-
return elGeoms.map((elGeom) => {
|
|
252
|
-
let { elWidth, elHeight, parentBound, naturalBound } = elGeom;
|
|
253
|
-
let destLeft; // relative to canvas topleft
|
|
254
|
-
let destTop; // "
|
|
255
|
-
switch (elGeom.textAlign) {
|
|
256
|
-
case 'left':
|
|
257
|
-
destLeft = viewportLeft;
|
|
258
|
-
break;
|
|
259
|
-
case 'right':
|
|
260
|
-
destLeft = viewportRight - elWidth;
|
|
261
|
-
break;
|
|
262
|
-
case 'center':
|
|
263
|
-
destLeft = (viewportLeft + viewportRight) / 2 - elWidth / 2; /// noooo, use half-width insteadddddddd
|
|
264
|
-
break;
|
|
265
|
-
}
|
|
266
|
-
destLeft = Math.min(destLeft, parentBound.right - elWidth);
|
|
267
|
-
destLeft = Math.max(destLeft, parentBound.left);
|
|
268
|
-
destTop = viewportTop;
|
|
269
|
-
destTop = Math.min(destTop, parentBound.bottom - elHeight);
|
|
270
|
-
destTop = Math.max(destTop, naturalBound.top); // better to use natural top for upper bound
|
|
271
|
-
return { left: destLeft, top: destTop };
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
function assignRelativePositions(els, elGeoms, elDestinations, viewportWidth, viewportHeight) {
|
|
276
|
-
els.forEach((el, i) => {
|
|
277
|
-
let { naturalBound, parentBound } = elGeoms[i];
|
|
278
|
-
let parentWidth = parentBound.right - parentBound.left;
|
|
279
|
-
let parentHeight = parentBound.bottom - parentBound.bottom;
|
|
280
|
-
let left;
|
|
281
|
-
let top;
|
|
282
|
-
if (parentWidth > viewportWidth ||
|
|
283
|
-
parentHeight > viewportHeight) {
|
|
284
|
-
left = elDestinations[i].left - naturalBound.left;
|
|
285
|
-
top = elDestinations[i].top - naturalBound.top;
|
|
286
|
-
}
|
|
287
|
-
else { // if parent container can be completely in view, we don't need stickiness
|
|
288
|
-
left = '';
|
|
289
|
-
top = '';
|
|
290
|
-
}
|
|
291
|
-
common.applyStyle(el, {
|
|
292
|
-
position: 'relative',
|
|
293
|
-
left,
|
|
294
|
-
right: -left,
|
|
295
|
-
top,
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
135
|
}
|
|
299
136
|
function assignStickyPositions(els, elGeoms, viewportWidth) {
|
|
300
137
|
els.forEach((el, i) => {
|
|
@@ -308,40 +145,25 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
308
145
|
else { // if parent container can be completely in view, we don't need stickiness
|
|
309
146
|
left = '';
|
|
310
147
|
}
|
|
311
|
-
|
|
148
|
+
internal$1.applyStyle(el, {
|
|
312
149
|
left,
|
|
313
150
|
right: left,
|
|
314
151
|
top: 0,
|
|
315
152
|
});
|
|
316
153
|
});
|
|
317
154
|
}
|
|
318
|
-
let _isStickySupported;
|
|
319
|
-
function getStickySupported() {
|
|
320
|
-
if (_isStickySupported == null) {
|
|
321
|
-
_isStickySupported = computeStickySupported();
|
|
322
|
-
}
|
|
323
|
-
return _isStickySupported;
|
|
324
|
-
}
|
|
325
|
-
function computeStickySupported() {
|
|
326
|
-
let el = document.createElement('div');
|
|
327
|
-
el.style.position = 'sticky';
|
|
328
|
-
document.body.appendChild(el);
|
|
329
|
-
let val = window.getComputedStyle(el).position;
|
|
330
|
-
common.removeElement(el);
|
|
331
|
-
return val === 'sticky';
|
|
332
|
-
}
|
|
333
155
|
|
|
334
|
-
class ClippedScroller extends
|
|
156
|
+
class ClippedScroller extends internal$1.BaseComponent {
|
|
335
157
|
constructor() {
|
|
336
158
|
super(...arguments);
|
|
337
|
-
this.elRef =
|
|
159
|
+
this.elRef = preact.createRef();
|
|
338
160
|
this.state = {
|
|
339
161
|
xScrollbarWidth: 0,
|
|
340
162
|
yScrollbarWidth: 0,
|
|
341
163
|
};
|
|
342
164
|
this.handleScroller = (scroller) => {
|
|
343
165
|
this.scroller = scroller;
|
|
344
|
-
|
|
166
|
+
internal$1.setRef(this.props.scrollerRef, scroller);
|
|
345
167
|
};
|
|
346
168
|
this.handleSizing = () => {
|
|
347
169
|
let { props } = this;
|
|
@@ -355,7 +177,7 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
355
177
|
}
|
|
356
178
|
render() {
|
|
357
179
|
let { props, state, context } = this;
|
|
358
|
-
let isScrollbarOnLeft = context.isRtl &&
|
|
180
|
+
let isScrollbarOnLeft = context.isRtl && internal$1.getIsRtlScrollbarOnLeft();
|
|
359
181
|
let overcomeLeft = 0;
|
|
360
182
|
let overcomeRight = 0;
|
|
361
183
|
let overcomeBottom = 0;
|
|
@@ -372,8 +194,8 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
372
194
|
}
|
|
373
195
|
}
|
|
374
196
|
}
|
|
375
|
-
return (
|
|
376
|
-
|
|
197
|
+
return (preact.createElement("div", { ref: this.elRef, className: 'fc-scroller-harness' + (props.liquid ? ' fc-scroller-harness-liquid' : '') },
|
|
198
|
+
preact.createElement(internal$1.Scroller, { ref: this.handleScroller, elRef: this.props.scrollerElRef, overflowX: props.overflowX === 'scroll-hidden' ? 'scroll' : props.overflowX, overflowY: props.overflowY === 'scroll-hidden' ? 'scroll' : props.overflowY, overcomeLeft: overcomeLeft, overcomeRight: overcomeRight, overcomeBottom: overcomeBottom, maxHeight: typeof props.maxHeight === 'number'
|
|
377
199
|
? (props.maxHeight + (props.overflowX === 'scroll-hidden' ? state.xScrollbarWidth : 0))
|
|
378
200
|
: '', liquid: props.liquid, liquidIsAbsolute: true }, props.children)));
|
|
379
201
|
}
|
|
@@ -382,7 +204,7 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
382
204
|
this.context.addResizeHandler(this.handleSizing);
|
|
383
205
|
}
|
|
384
206
|
componentDidUpdate(prevProps) {
|
|
385
|
-
if (!
|
|
207
|
+
if (!internal$1.isPropsEqual(prevProps, this.props)) { // an external change?
|
|
386
208
|
this.handleSizing();
|
|
387
209
|
}
|
|
388
210
|
}
|
|
@@ -397,6 +219,92 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
397
219
|
}
|
|
398
220
|
}
|
|
399
221
|
|
|
222
|
+
const WHEEL_EVENT_NAMES = 'wheel mousewheel DomMouseScroll MozMousePixelScroll'.split(' ');
|
|
223
|
+
/*
|
|
224
|
+
ALSO, with the ability to disable touch
|
|
225
|
+
*/
|
|
226
|
+
class ScrollListener {
|
|
227
|
+
constructor(el) {
|
|
228
|
+
this.el = el;
|
|
229
|
+
this.emitter = new internal$1.Emitter();
|
|
230
|
+
this.isScrolling = false;
|
|
231
|
+
this.isTouching = false; // user currently has finger down?
|
|
232
|
+
this.isRecentlyWheeled = false;
|
|
233
|
+
this.isRecentlyScrolled = false;
|
|
234
|
+
this.wheelWaiter = new internal$1.DelayedRunner(this._handleWheelWaited.bind(this));
|
|
235
|
+
this.scrollWaiter = new internal$1.DelayedRunner(this._handleScrollWaited.bind(this));
|
|
236
|
+
// Handlers
|
|
237
|
+
// ----------------------------------------------------------------------------------------------
|
|
238
|
+
this.handleScroll = () => {
|
|
239
|
+
this.startScroll();
|
|
240
|
+
this.emitter.trigger('scroll', this.isRecentlyWheeled, this.isTouching);
|
|
241
|
+
this.isRecentlyScrolled = true;
|
|
242
|
+
this.scrollWaiter.request(500);
|
|
243
|
+
};
|
|
244
|
+
// will fire *before* the scroll event is fired (might not cause a scroll)
|
|
245
|
+
this.handleWheel = () => {
|
|
246
|
+
this.isRecentlyWheeled = true;
|
|
247
|
+
this.wheelWaiter.request(500);
|
|
248
|
+
};
|
|
249
|
+
// will fire *before* the scroll event is fired (might not cause a scroll)
|
|
250
|
+
this.handleTouchStart = () => {
|
|
251
|
+
this.isTouching = true;
|
|
252
|
+
};
|
|
253
|
+
this.handleTouchEnd = () => {
|
|
254
|
+
this.isTouching = false;
|
|
255
|
+
// if the user ended their touch, and the scroll area wasn't moving,
|
|
256
|
+
// we consider this to be the end of the scroll.
|
|
257
|
+
if (!this.isRecentlyScrolled) {
|
|
258
|
+
this.endScroll(); // won't fire if already ended
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
el.addEventListener('scroll', this.handleScroll);
|
|
262
|
+
el.addEventListener('touchstart', this.handleTouchStart, { passive: true });
|
|
263
|
+
el.addEventListener('touchend', this.handleTouchEnd);
|
|
264
|
+
for (let eventName of WHEEL_EVENT_NAMES) {
|
|
265
|
+
el.addEventListener(eventName, this.handleWheel);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
destroy() {
|
|
269
|
+
let { el } = this;
|
|
270
|
+
el.removeEventListener('scroll', this.handleScroll);
|
|
271
|
+
el.removeEventListener('touchstart', this.handleTouchStart, { passive: true });
|
|
272
|
+
el.removeEventListener('touchend', this.handleTouchEnd);
|
|
273
|
+
for (let eventName of WHEEL_EVENT_NAMES) {
|
|
274
|
+
el.removeEventListener(eventName, this.handleWheel);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
// Start / Stop
|
|
278
|
+
// ----------------------------------------------------------------------------------------------
|
|
279
|
+
startScroll() {
|
|
280
|
+
if (!this.isScrolling) {
|
|
281
|
+
this.isScrolling = true;
|
|
282
|
+
this.emitter.trigger('scrollStart', this.isRecentlyWheeled, this.isTouching);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
endScroll() {
|
|
286
|
+
if (this.isScrolling) {
|
|
287
|
+
this.emitter.trigger('scrollEnd');
|
|
288
|
+
this.isScrolling = false;
|
|
289
|
+
this.isRecentlyScrolled = true;
|
|
290
|
+
this.isRecentlyWheeled = false;
|
|
291
|
+
this.scrollWaiter.clear();
|
|
292
|
+
this.wheelWaiter.clear();
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
_handleScrollWaited() {
|
|
296
|
+
this.isRecentlyScrolled = false;
|
|
297
|
+
// only end the scroll if not currently touching.
|
|
298
|
+
// if touching, the scrolling will end later, on touchend.
|
|
299
|
+
if (!this.isTouching) {
|
|
300
|
+
this.endScroll(); // won't fire if already ended
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
_handleWheelWaited() {
|
|
304
|
+
this.isRecentlyWheeled = false;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
400
308
|
class ScrollSyncer {
|
|
401
309
|
constructor(isVertical, scrollEls) {
|
|
402
310
|
this.isVertical = isVertical;
|
|
@@ -467,20 +375,20 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
467
375
|
}
|
|
468
376
|
}
|
|
469
377
|
|
|
378
|
+
internal$1.config.SCROLLGRID_RESIZE_INTERVAL = 500;
|
|
470
379
|
/*
|
|
471
380
|
TODO: make <ScrollGridSection> subcomponent
|
|
472
381
|
NOTE: doesn't support collapsibleWidth (which is sortof a hack anyway)
|
|
473
382
|
*/
|
|
474
|
-
class ScrollGrid extends
|
|
383
|
+
class ScrollGrid extends internal$1.BaseComponent {
|
|
475
384
|
constructor() {
|
|
476
385
|
super(...arguments);
|
|
477
|
-
this.compileColGroupStats =
|
|
478
|
-
this.renderMicroColGroups =
|
|
479
|
-
this.clippedScrollerRefs = new
|
|
386
|
+
this.compileColGroupStats = internal$1.memoizeArraylike(compileColGroupStat, isColGroupStatsEqual);
|
|
387
|
+
this.renderMicroColGroups = internal$1.memoizeArraylike(internal$1.renderMicroColGroup); // yucky to memoize VNodes, but much more efficient for consumers
|
|
388
|
+
this.clippedScrollerRefs = new internal$1.RefMap();
|
|
480
389
|
// doesn't hold non-scrolling els used just for padding
|
|
481
|
-
this.scrollerElRefs = new
|
|
482
|
-
this.chunkElRefs = new
|
|
483
|
-
this.stickyScrollings = [];
|
|
390
|
+
this.scrollerElRefs = new internal$1.RefMap(this._handleScrollerEl.bind(this));
|
|
391
|
+
this.chunkElRefs = new internal$1.RefMap(this._handleChunkEl.bind(this));
|
|
484
392
|
this.scrollSyncersBySection = {};
|
|
485
393
|
this.scrollSyncersByColumn = {};
|
|
486
394
|
// for row-height-syncing
|
|
@@ -540,7 +448,7 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
540
448
|
let { shrinkWidths } = state;
|
|
541
449
|
let colGroupStats = this.compileColGroupStats(props.colGroups.map((colGroup) => [colGroup]));
|
|
542
450
|
let microColGroupNodes = this.renderMicroColGroups(colGroupStats.map((stat, i) => [stat.cols, shrinkWidths[i]]));
|
|
543
|
-
let classNames =
|
|
451
|
+
let classNames = internal$1.getScrollGridClassNames(props.liquid, context);
|
|
544
452
|
this.getDims();
|
|
545
453
|
// TODO: make DRY
|
|
546
454
|
let sectionConfigs = props.sections;
|
|
@@ -562,39 +470,39 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
562
470
|
footSectionNodes.push(this.renderSection(currentConfig, configI, colGroupStats, microColGroupNodes, state.sectionRowMaxHeights, true));
|
|
563
471
|
configI += 1;
|
|
564
472
|
}
|
|
565
|
-
const isBuggy = !
|
|
473
|
+
const isBuggy = !internal$1.getCanVGrowWithinCell(); // see NOTE in SimpleScrollGrid
|
|
566
474
|
const roleAttrs = { role: 'rowgroup' };
|
|
567
|
-
return
|
|
475
|
+
return preact.createElement('table', {
|
|
568
476
|
ref: props.elRef,
|
|
569
477
|
role: 'grid',
|
|
570
478
|
className: classNames.join(' '),
|
|
571
|
-
}, renderMacroColGroup(colGroupStats, shrinkWidths), Boolean(!isBuggy && headSectionNodes.length) &&
|
|
479
|
+
}, renderMacroColGroup(colGroupStats, shrinkWidths), Boolean(!isBuggy && headSectionNodes.length) && preact.createElement('thead', roleAttrs, ...headSectionNodes), Boolean(!isBuggy && bodySectionNodes.length) && preact.createElement('tbody', roleAttrs, ...bodySectionNodes), Boolean(!isBuggy && footSectionNodes.length) && preact.createElement('tfoot', roleAttrs, ...footSectionNodes), isBuggy && preact.createElement('tbody', roleAttrs, ...headSectionNodes, ...bodySectionNodes, ...footSectionNodes));
|
|
572
480
|
}
|
|
573
481
|
renderSection(sectionConfig, sectionIndex, colGroupStats, microColGroupNodes, sectionRowMaxHeights, isHeader) {
|
|
574
482
|
if ('outerContent' in sectionConfig) {
|
|
575
|
-
return (
|
|
483
|
+
return (preact.createElement(preact.Fragment, { key: sectionConfig.key }, sectionConfig.outerContent));
|
|
576
484
|
}
|
|
577
|
-
return (
|
|
485
|
+
return (preact.createElement("tr", { key: sectionConfig.key, role: "presentation", className: internal$1.getSectionClassNames(sectionConfig, this.props.liquid).join(' ') }, sectionConfig.chunks.map((chunkConfig, i) => this.renderChunk(sectionConfig, sectionIndex, colGroupStats[i], microColGroupNodes[i], chunkConfig, i, (sectionRowMaxHeights[sectionIndex] || [])[i] || [], isHeader))));
|
|
578
486
|
}
|
|
579
487
|
renderChunk(sectionConfig, sectionIndex, colGroupStat, microColGroupNode, chunkConfig, chunkIndex, rowHeights, isHeader) {
|
|
580
488
|
if ('outerContent' in chunkConfig) {
|
|
581
|
-
return (
|
|
489
|
+
return (preact.createElement(preact.Fragment, { key: chunkConfig.key }, chunkConfig.outerContent));
|
|
582
490
|
}
|
|
583
491
|
let { state } = this;
|
|
584
492
|
let { scrollerClientWidths, scrollerClientHeights } = state;
|
|
585
493
|
let [sectionCnt, chunksPerSection] = this.getDims();
|
|
586
494
|
let index = sectionIndex * chunksPerSection + chunkIndex;
|
|
587
|
-
let sideScrollIndex = (!this.context.isRtl ||
|
|
495
|
+
let sideScrollIndex = (!this.context.isRtl || internal$1.getIsRtlScrollbarOnLeft()) ? chunksPerSection - 1 : 0;
|
|
588
496
|
let isVScrollSide = chunkIndex === sideScrollIndex;
|
|
589
497
|
let isLastSection = sectionIndex === sectionCnt - 1;
|
|
590
498
|
let forceXScrollbars = isLastSection && state.forceXScrollbars; // NOOOO can result in `null`
|
|
591
499
|
let forceYScrollbars = isVScrollSide && state.forceYScrollbars; // NOOOO can result in `null`
|
|
592
500
|
let allowXScrolling = colGroupStat && colGroupStat.allowXScrolling; // rename?
|
|
593
|
-
let allowYScrolling =
|
|
594
|
-
let chunkVGrow =
|
|
501
|
+
let allowYScrolling = internal$1.getAllowYScrolling(this.props, sectionConfig); // rename? do in section func?
|
|
502
|
+
let chunkVGrow = internal$1.getSectionHasLiquidHeight(this.props, sectionConfig); // do in section func?
|
|
595
503
|
let expandRows = sectionConfig.expandRows && chunkVGrow;
|
|
596
504
|
let tableMinWidth = (colGroupStat && colGroupStat.totalColMinWidth) || '';
|
|
597
|
-
let content =
|
|
505
|
+
let content = internal$1.renderChunkContent(sectionConfig, chunkConfig, {
|
|
598
506
|
tableColGroupNode: microColGroupNode,
|
|
599
507
|
tableMinWidth,
|
|
600
508
|
clientWidth: scrollerClientWidths[index] !== undefined ? scrollerClientWidths[index] : null,
|
|
@@ -612,17 +520,17 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
612
520
|
(isVScrollSide ? 'auto' : 'scroll-hidden');
|
|
613
521
|
// it *could* be possible to reduce DOM wrappers by only doing a ClippedScroller when allowXScrolling or allowYScrolling,
|
|
614
522
|
// but if these values were to change, the inner components would be unmounted/remounted because of the parent change.
|
|
615
|
-
content = (
|
|
616
|
-
return
|
|
523
|
+
content = (preact.createElement(ClippedScroller, { ref: this.clippedScrollerRefs.createRef(index), scrollerElRef: this.scrollerElRefs.createRef(index), overflowX: overflowX, overflowY: overflowY, liquid: chunkVGrow, maxHeight: sectionConfig.maxHeight }, content));
|
|
524
|
+
return preact.createElement(isHeader ? 'th' : 'td', {
|
|
617
525
|
key: chunkConfig.key,
|
|
618
526
|
ref: this.chunkElRefs.createRef(index),
|
|
619
527
|
role: 'presentation',
|
|
620
528
|
}, content);
|
|
621
529
|
}
|
|
622
530
|
componentDidMount() {
|
|
623
|
-
this.getStickyScrolling =
|
|
624
|
-
this.getScrollSyncersBySection =
|
|
625
|
-
this.getScrollSyncersByColumn =
|
|
531
|
+
this.getStickyScrolling = internal$1.memoizeArraylike(initStickyScrolling);
|
|
532
|
+
this.getScrollSyncersBySection = internal$1.memoizeHashlike(initScrollSyncer.bind(this, true), null, destroyScrollSyncer);
|
|
533
|
+
this.getScrollSyncersByColumn = internal$1.memoizeHashlike(initScrollSyncer.bind(this, false), null, destroyScrollSyncer);
|
|
626
534
|
this.updateScrollSyncers();
|
|
627
535
|
this.handleSizing(false);
|
|
628
536
|
this.context.addResizeHandler(this.handleSizing);
|
|
@@ -634,13 +542,12 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
634
542
|
}
|
|
635
543
|
componentWillUnmount() {
|
|
636
544
|
this.context.removeResizeHandler(this.handleSizing);
|
|
637
|
-
this.destroyStickyScrolling();
|
|
638
545
|
this.destroyScrollSyncers();
|
|
639
546
|
}
|
|
640
547
|
allowSizing() {
|
|
641
548
|
let now = new Date();
|
|
642
549
|
if (!this.lastSizingDate ||
|
|
643
|
-
now.valueOf() > this.lastSizingDate.valueOf() +
|
|
550
|
+
now.valueOf() > this.lastSizingDate.valueOf() + internal$1.config.SCROLLGRID_RESIZE_INTERVAL) {
|
|
644
551
|
this.lastSizingDate = now;
|
|
645
552
|
this.recentSizingCnt = 0;
|
|
646
553
|
return true;
|
|
@@ -655,7 +562,7 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
655
562
|
colGroupStats.forEach((colGroupStat, i) => {
|
|
656
563
|
if (colGroupStat.hasShrinkCol) {
|
|
657
564
|
let chunkEls = this.chunkElRefs.collect(i, cnt, chunksPerSection); // in one col
|
|
658
|
-
shrinkWidths[i] =
|
|
565
|
+
shrinkWidths[i] = internal$1.computeShrinkWidth(chunkEls);
|
|
659
566
|
}
|
|
660
567
|
});
|
|
661
568
|
return shrinkWidths;
|
|
@@ -676,7 +583,7 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
676
583
|
let rowHeights = [];
|
|
677
584
|
let chunkEl = this.chunkElRefs.currentMap[index];
|
|
678
585
|
if (chunkEl) {
|
|
679
|
-
rowHeights =
|
|
586
|
+
rowHeights = internal$1.findElements(chunkEl, '.fc-scrollgrid-sync-table tr').map((rowEl) => {
|
|
680
587
|
let max = getRowInnerMaxHeight(rowEl);
|
|
681
588
|
newHeightMap.set(rowEl, max);
|
|
682
589
|
return max;
|
|
@@ -747,9 +654,9 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
747
654
|
return sectionRowMaxHeights;
|
|
748
655
|
}
|
|
749
656
|
computeScrollerDims() {
|
|
750
|
-
let scrollbarWidth =
|
|
657
|
+
let scrollbarWidth = internal$1.getScrollbarWidths();
|
|
751
658
|
let [sectionCnt, chunksPerSection] = this.getDims();
|
|
752
|
-
let sideScrollI = (!this.context.isRtl ||
|
|
659
|
+
let sideScrollI = (!this.context.isRtl || internal$1.getIsRtlScrollbarOnLeft()) ? chunksPerSection - 1 : 0;
|
|
753
660
|
let lastSectionI = sectionCnt - 1;
|
|
754
661
|
let currentScrollers = this.clippedScrollerRefs.currentMap;
|
|
755
662
|
let scrollerEls = this.scrollerElRefs.currentMap;
|
|
@@ -794,12 +701,8 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
794
701
|
updateStickyScrolling() {
|
|
795
702
|
let { isRtl } = this.context;
|
|
796
703
|
let argsByKey = this.scrollerElRefs.getAll().map((scrollEl) => [scrollEl, isRtl]);
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
this.stickyScrollings = stickyScrollings;
|
|
800
|
-
}
|
|
801
|
-
destroyStickyScrolling() {
|
|
802
|
-
this.stickyScrollings.forEach(destroyStickyScrolling);
|
|
704
|
+
this.getStickyScrolling(argsByKey)
|
|
705
|
+
.forEach((stickyScrolling) => stickyScrolling.updateSize());
|
|
803
706
|
}
|
|
804
707
|
updateScrollSyncers() {
|
|
805
708
|
let [sectionCnt, chunksPerSection] = this.getDims();
|
|
@@ -810,7 +713,7 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
810
713
|
for (let sectionI = 0; sectionI < sectionCnt; sectionI += 1) {
|
|
811
714
|
let startIndex = sectionI * chunksPerSection;
|
|
812
715
|
let endIndex = startIndex + chunksPerSection;
|
|
813
|
-
scrollElsBySection[sectionI] =
|
|
716
|
+
scrollElsBySection[sectionI] = internal$1.collectFromHash(scrollElMap, startIndex, endIndex, 1); // use the filtered
|
|
814
717
|
}
|
|
815
718
|
for (let col = 0; col < chunksPerSection; col += 1) {
|
|
816
719
|
scrollElsByColumn[col] = this.scrollerElRefs.collect(col, cnt, chunksPerSection); // DON'T use the filtered
|
|
@@ -819,8 +722,8 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
819
722
|
this.scrollSyncersByColumn = this.getScrollSyncersByColumn(scrollElsByColumn);
|
|
820
723
|
}
|
|
821
724
|
destroyScrollSyncers() {
|
|
822
|
-
|
|
823
|
-
|
|
725
|
+
internal$1.mapHash(this.scrollSyncersBySection, destroyScrollSyncer);
|
|
726
|
+
internal$1.mapHash(this.scrollSyncersByColumn, destroyScrollSyncer);
|
|
824
727
|
}
|
|
825
728
|
getChunkConfigByIndex(index) {
|
|
826
729
|
let chunksPerSection = this.getDims()[1];
|
|
@@ -844,13 +747,13 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
844
747
|
_handleChunkEl(chunkEl, key) {
|
|
845
748
|
let chunkConfig = this.getChunkConfigByIndex(parseInt(key, 10));
|
|
846
749
|
if (chunkConfig) { // null if section disappeared. bad, b/c won't null-set the elRef
|
|
847
|
-
|
|
750
|
+
internal$1.setRef(chunkConfig.elRef, chunkEl);
|
|
848
751
|
}
|
|
849
752
|
}
|
|
850
753
|
_handleScrollerEl(scrollerEl, key) {
|
|
851
754
|
let chunkConfig = this.getChunkConfigByIndex(parseInt(key, 10));
|
|
852
755
|
if (chunkConfig) { // null if section disappeared. bad, b/c won't null-set the elRef
|
|
853
|
-
|
|
756
|
+
internal$1.setRef(chunkConfig.scrollerElRef, scrollerEl);
|
|
854
757
|
}
|
|
855
758
|
}
|
|
856
759
|
getDims() {
|
|
@@ -860,9 +763,9 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
860
763
|
}
|
|
861
764
|
}
|
|
862
765
|
ScrollGrid.addStateEquality({
|
|
863
|
-
shrinkWidths:
|
|
864
|
-
scrollerClientWidths:
|
|
865
|
-
scrollerClientHeights:
|
|
766
|
+
shrinkWidths: internal$1.isArraysEqual,
|
|
767
|
+
scrollerClientWidths: internal$1.isPropsEqual,
|
|
768
|
+
scrollerClientHeights: internal$1.isPropsEqual,
|
|
866
769
|
});
|
|
867
770
|
function sumNumbers(numbers) {
|
|
868
771
|
let sum = 0;
|
|
@@ -872,7 +775,7 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
872
775
|
return sum;
|
|
873
776
|
}
|
|
874
777
|
function getRowInnerMaxHeight(rowEl) {
|
|
875
|
-
let innerHeights =
|
|
778
|
+
let innerHeights = internal$1.findElements(rowEl, '.fc-scrollgrid-sync-inner').map(getElHeight);
|
|
876
779
|
if (innerHeights.length) {
|
|
877
780
|
return Math.max(...innerHeights);
|
|
878
781
|
}
|
|
@@ -885,17 +788,17 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
885
788
|
let children = colGroupStats.map((colGroupStat, i) => {
|
|
886
789
|
let width = colGroupStat.width;
|
|
887
790
|
if (width === 'shrink') {
|
|
888
|
-
width = colGroupStat.totalColWidth +
|
|
791
|
+
width = colGroupStat.totalColWidth + internal$1.sanitizeShrinkWidth(shrinkWidths[i]) + 1; // +1 for border :(
|
|
889
792
|
}
|
|
890
793
|
return ( // eslint-disable-next-line react/jsx-key
|
|
891
|
-
|
|
794
|
+
preact.createElement("col", { style: { width } }));
|
|
892
795
|
});
|
|
893
|
-
return
|
|
796
|
+
return preact.createElement('colgroup', {}, ...children);
|
|
894
797
|
}
|
|
895
798
|
function compileColGroupStat(colGroupConfig) {
|
|
896
799
|
let totalColWidth = sumColProp(colGroupConfig.cols, 'width'); // excludes "shrink"
|
|
897
800
|
let totalColMinWidth = sumColProp(colGroupConfig.cols, 'minWidth');
|
|
898
|
-
let hasShrinkCol =
|
|
801
|
+
let hasShrinkCol = internal$1.hasShrinkWidth(colGroupConfig.cols);
|
|
899
802
|
let allowXScrolling = colGroupConfig.width !== 'shrink' && Boolean(totalColWidth || totalColMinWidth || hasShrinkCol);
|
|
900
803
|
return {
|
|
901
804
|
hasShrinkCol,
|
|
@@ -917,10 +820,10 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
917
820
|
return total;
|
|
918
821
|
}
|
|
919
822
|
const COL_GROUP_STAT_EQUALITY = {
|
|
920
|
-
cols:
|
|
823
|
+
cols: internal$1.isColPropsEqual,
|
|
921
824
|
};
|
|
922
825
|
function isColGroupStatsEqual(stat0, stat1) {
|
|
923
|
-
return
|
|
826
|
+
return internal$1.compareObjs(stat0, stat1, COL_GROUP_STAT_EQUALITY);
|
|
924
827
|
}
|
|
925
828
|
// for memoizers...
|
|
926
829
|
function initScrollSyncer(isVertical, ...scrollEls) {
|
|
@@ -932,26 +835,26 @@ var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
|
|
|
932
835
|
function initStickyScrolling(scrollEl, isRtl) {
|
|
933
836
|
return new StickyScrolling(scrollEl, isRtl);
|
|
934
837
|
}
|
|
935
|
-
function destroyStickyScrolling(stickyScrolling) {
|
|
936
|
-
stickyScrolling.destroy();
|
|
937
|
-
}
|
|
938
838
|
|
|
939
|
-
var plugin =
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
],
|
|
839
|
+
var plugin = core.createPlugin({
|
|
840
|
+
name: '@fullcalendar/scrollgrid',
|
|
841
|
+
premiumReleaseDate: '2022-11-22',
|
|
842
|
+
deps: [premiumCommonPlugin__default["default"]],
|
|
943
843
|
scrollGridImpl: ScrollGrid,
|
|
944
844
|
});
|
|
945
|
-
common.config.SCROLLGRID_RESIZE_INTERVAL = 500;
|
|
946
845
|
|
|
947
|
-
|
|
846
|
+
var internal = {
|
|
847
|
+
__proto__: null,
|
|
848
|
+
ScrollGrid: ScrollGrid
|
|
849
|
+
};
|
|
850
|
+
|
|
851
|
+
internal$1.globalPlugins.push(plugin);
|
|
948
852
|
|
|
949
|
-
exports.
|
|
950
|
-
exports
|
|
951
|
-
exports.setScrollFromLeftEdge = setScrollFromLeftEdge;
|
|
853
|
+
exports.Internal = internal;
|
|
854
|
+
exports["default"] = plugin;
|
|
952
855
|
|
|
953
856
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
954
857
|
|
|
955
858
|
return exports;
|
|
956
859
|
|
|
957
|
-
}({}, FullCalendar,
|
|
860
|
+
})({}, FullCalendar.Internal, FullCalendar, FullCalendar.PremiumCommon, FullCalendar.Preact);
|