@fullcalendar/scrollgrid 5.11.3 → 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/main.global.js DELETED
@@ -1,1038 +0,0 @@
1
- /*!
2
- FullCalendar Scheduler v5.11.3
3
- Docs & License: https://fullcalendar.io/scheduler
4
- (c) 2022 Adam Shaw
5
- */
6
- var FullCalendarScrollGrid = (function (exports, common, premiumCommonPlugin) {
7
- 'use strict';
8
-
9
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
-
11
- var premiumCommonPlugin__default = /*#__PURE__*/_interopDefaultLegacy(premiumCommonPlugin);
12
-
13
- /*! *****************************************************************************
14
- Copyright (c) Microsoft Corporation.
15
-
16
- Permission to use, copy, modify, and/or distribute this software for any
17
- purpose with or without fee is hereby granted.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
20
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
21
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
22
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
23
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25
- PERFORMANCE OF THIS SOFTWARE.
26
- ***************************************************************************** */
27
- /* global Reflect, Promise */
28
-
29
- var extendStatics = function(d, b) {
30
- extendStatics = Object.setPrototypeOf ||
31
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
32
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
33
- return extendStatics(d, b);
34
- };
35
-
36
- function __extends(d, b) {
37
- if (typeof b !== "function" && b !== null)
38
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
39
- extendStatics(d, b);
40
- function __() { this.constructor = d; }
41
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
42
- }
43
-
44
- var __assign = function() {
45
- __assign = Object.assign || function __assign(t) {
46
- for (var s, i = 1, n = arguments.length; i < n; i++) {
47
- s = arguments[i];
48
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
49
- }
50
- return t;
51
- };
52
- return __assign.apply(this, arguments);
53
- };
54
-
55
- function __spreadArray(to, from, pack) {
56
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
57
- if (ar || !(i in from)) {
58
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
59
- ar[i] = from[i];
60
- }
61
- }
62
- return to.concat(ar || from);
63
- }
64
-
65
- var WHEEL_EVENT_NAMES = 'wheel mousewheel DomMouseScroll MozMousePixelScroll'.split(' ');
66
- /*
67
- ALSO, with the ability to disable touch
68
- */
69
- var ScrollListener = /** @class */ (function () {
70
- function ScrollListener(el) {
71
- var _this = this;
72
- this.el = el;
73
- this.emitter = new common.Emitter();
74
- this.isScrolling = false;
75
- this.isTouching = false; // user currently has finger down?
76
- this.isRecentlyWheeled = false;
77
- this.isRecentlyScrolled = false;
78
- this.wheelWaiter = new common.DelayedRunner(this._handleWheelWaited.bind(this));
79
- this.scrollWaiter = new common.DelayedRunner(this._handleScrollWaited.bind(this));
80
- // Handlers
81
- // ----------------------------------------------------------------------------------------------
82
- this.handleScroll = function () {
83
- _this.startScroll();
84
- _this.emitter.trigger('scroll', _this.isRecentlyWheeled, _this.isTouching);
85
- _this.isRecentlyScrolled = true;
86
- _this.scrollWaiter.request(500);
87
- };
88
- // will fire *before* the scroll event is fired (might not cause a scroll)
89
- this.handleWheel = function () {
90
- _this.isRecentlyWheeled = true;
91
- _this.wheelWaiter.request(500);
92
- };
93
- // will fire *before* the scroll event is fired (might not cause a scroll)
94
- this.handleTouchStart = function () {
95
- _this.isTouching = true;
96
- };
97
- this.handleTouchEnd = function () {
98
- _this.isTouching = false;
99
- // if the user ended their touch, and the scroll area wasn't moving,
100
- // we consider this to be the end of the scroll.
101
- if (!_this.isRecentlyScrolled) {
102
- _this.endScroll(); // won't fire if already ended
103
- }
104
- };
105
- el.addEventListener('scroll', this.handleScroll);
106
- el.addEventListener('touchstart', this.handleTouchStart, { passive: true });
107
- el.addEventListener('touchend', this.handleTouchEnd);
108
- for (var _i = 0, WHEEL_EVENT_NAMES_1 = WHEEL_EVENT_NAMES; _i < WHEEL_EVENT_NAMES_1.length; _i++) {
109
- var eventName = WHEEL_EVENT_NAMES_1[_i];
110
- el.addEventListener(eventName, this.handleWheel);
111
- }
112
- }
113
- ScrollListener.prototype.destroy = function () {
114
- var el = this.el;
115
- el.removeEventListener('scroll', this.handleScroll);
116
- el.removeEventListener('touchstart', this.handleTouchStart, { passive: true });
117
- el.removeEventListener('touchend', this.handleTouchEnd);
118
- for (var _i = 0, WHEEL_EVENT_NAMES_2 = WHEEL_EVENT_NAMES; _i < WHEEL_EVENT_NAMES_2.length; _i++) {
119
- var eventName = WHEEL_EVENT_NAMES_2[_i];
120
- el.removeEventListener(eventName, this.handleWheel);
121
- }
122
- };
123
- // Start / Stop
124
- // ----------------------------------------------------------------------------------------------
125
- ScrollListener.prototype.startScroll = function () {
126
- if (!this.isScrolling) {
127
- this.isScrolling = true;
128
- this.emitter.trigger('scrollStart', this.isRecentlyWheeled, this.isTouching);
129
- }
130
- };
131
- ScrollListener.prototype.endScroll = function () {
132
- if (this.isScrolling) {
133
- this.emitter.trigger('scrollEnd');
134
- this.isScrolling = false;
135
- this.isRecentlyScrolled = true;
136
- this.isRecentlyWheeled = false;
137
- this.scrollWaiter.clear();
138
- this.wheelWaiter.clear();
139
- }
140
- };
141
- ScrollListener.prototype._handleScrollWaited = function () {
142
- this.isRecentlyScrolled = false;
143
- // only end the scroll if not currently touching.
144
- // if touching, the scrolling will end later, on touchend.
145
- if (!this.isTouching) {
146
- this.endScroll(); // won't fire if already ended
147
- }
148
- };
149
- ScrollListener.prototype._handleWheelWaited = function () {
150
- this.isRecentlyWheeled = false;
151
- };
152
- return ScrollListener;
153
- }());
154
-
155
- // TODO: assume the el has no borders?
156
- function getScrollCanvasOrigin(scrollEl) {
157
- var rect = scrollEl.getBoundingClientRect();
158
- var edges = common.computeEdges(scrollEl); // TODO: pass in isRtl?
159
- return {
160
- left: rect.left + edges.borderLeft + edges.scrollbarLeft - getScrollFromLeftEdge(scrollEl),
161
- top: rect.top + edges.borderTop - scrollEl.scrollTop,
162
- };
163
- }
164
- function getScrollFromLeftEdge(el) {
165
- var scrollLeft = el.scrollLeft;
166
- var computedStyles = window.getComputedStyle(el); // TODO: pass in isRtl instead?
167
- if (computedStyles.direction === 'rtl') {
168
- switch (getRtlScrollSystem()) {
169
- case 'negative':
170
- scrollLeft *= -1; // convert to 'reverse'. fall through...
171
- case 'reverse': // scrollLeft is distance between scrollframe's right edge scrollcanvas's right edge
172
- scrollLeft = el.scrollWidth - scrollLeft - el.clientWidth;
173
- }
174
- }
175
- return scrollLeft;
176
- }
177
- function setScrollFromLeftEdge(el, scrollLeft) {
178
- var computedStyles = window.getComputedStyle(el); // TODO: pass in isRtl instead?
179
- if (computedStyles.direction === 'rtl') {
180
- switch (getRtlScrollSystem()) {
181
- case 'reverse':
182
- scrollLeft = el.scrollWidth - scrollLeft;
183
- break;
184
- case 'negative':
185
- scrollLeft = -(el.scrollWidth - scrollLeft);
186
- break;
187
- }
188
- }
189
- el.scrollLeft = scrollLeft;
190
- }
191
- // Horizontal Scroll System Detection
192
- // ----------------------------------------------------------------------------------------------
193
- var _rtlScrollSystem;
194
- function getRtlScrollSystem() {
195
- return _rtlScrollSystem || (_rtlScrollSystem = detectRtlScrollSystem());
196
- }
197
- function detectRtlScrollSystem() {
198
- var el = document.createElement('div');
199
- el.style.position = 'absolute';
200
- el.style.top = '-1000px';
201
- el.style.width = '1px';
202
- el.style.height = '1px';
203
- el.style.overflow = 'scroll';
204
- el.style.direction = 'rtl';
205
- el.style.fontSize = '100px';
206
- el.innerHTML = 'A';
207
- document.body.appendChild(el);
208
- var system;
209
- if (el.scrollLeft > 0) {
210
- system = 'positive'; // scroll is a positive number from the left edge
211
- }
212
- else {
213
- el.scrollLeft = 1;
214
- if (el.scrollLeft > 0) {
215
- system = 'reverse'; // scroll is a positive number from the right edge
216
- }
217
- else {
218
- system = 'negative'; // scroll is a negative number from the right edge
219
- }
220
- }
221
- common.removeElement(el);
222
- return system;
223
- }
224
-
225
- var IS_MS_EDGE = typeof navigator !== 'undefined' && /Edge/.test(navigator.userAgent); // TODO: what about Chromeum-based Edge?
226
- var STICKY_SELECTOR = '.fc-sticky';
227
- /*
228
- useful beyond the native position:sticky for these reasons:
229
- - support in IE11
230
- - nice centering support
231
-
232
- REQUIREMENT: fc-sticky elements, if the fc-sticky className is taken away, should NOT have relative or absolute positioning.
233
- 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.
234
-
235
- TODO: don't query text-align:center. isn't compatible with flexbox centering. instead, check natural X coord within parent container
236
- */
237
- var StickyScrolling = /** @class */ (function () {
238
- function StickyScrolling(scrollEl, isRtl) {
239
- var _this = this;
240
- this.scrollEl = scrollEl;
241
- this.isRtl = isRtl;
242
- this.usingRelative = null;
243
- this.updateSize = function () {
244
- var scrollEl = _this.scrollEl;
245
- var els = common.findElements(scrollEl, STICKY_SELECTOR);
246
- var elGeoms = _this.queryElGeoms(els);
247
- var viewportWidth = scrollEl.clientWidth;
248
- var viewportHeight = scrollEl.clientHeight;
249
- if (_this.usingRelative) {
250
- var elDestinations = _this.computeElDestinations(elGeoms, viewportWidth); // read before prepPositioning
251
- assignRelativePositions(els, elGeoms, elDestinations, viewportWidth, viewportHeight);
252
- }
253
- else {
254
- assignStickyPositions(els, elGeoms, viewportWidth);
255
- }
256
- };
257
- this.usingRelative =
258
- !getStickySupported() || // IE11
259
- // https://stackoverflow.com/questions/56835658/in-microsoft-edge-sticky-positioning-doesnt-work-when-combined-with-dir-rtl
260
- (IS_MS_EDGE && isRtl);
261
- if (this.usingRelative) {
262
- this.listener = new ScrollListener(scrollEl);
263
- this.listener.emitter.on('scrollEnd', this.updateSize);
264
- }
265
- }
266
- StickyScrolling.prototype.destroy = function () {
267
- if (this.listener) {
268
- this.listener.destroy();
269
- }
270
- };
271
- StickyScrolling.prototype.queryElGeoms = function (els) {
272
- var _a = this, scrollEl = _a.scrollEl, isRtl = _a.isRtl;
273
- var canvasOrigin = getScrollCanvasOrigin(scrollEl);
274
- var elGeoms = [];
275
- for (var _i = 0, els_1 = els; _i < els_1.length; _i++) {
276
- var el = els_1[_i];
277
- var parentBound = common.translateRect(common.computeInnerRect(el.parentNode, true, true), // weird way to call this!!!
278
- -canvasOrigin.left, -canvasOrigin.top);
279
- var elRect = el.getBoundingClientRect();
280
- var computedStyles = window.getComputedStyle(el);
281
- var textAlign = window.getComputedStyle(el.parentNode).textAlign; // ask the parent
282
- var naturalBound = null;
283
- if (textAlign === 'start') {
284
- textAlign = isRtl ? 'right' : 'left';
285
- }
286
- else if (textAlign === 'end') {
287
- textAlign = isRtl ? 'left' : 'right';
288
- }
289
- if (computedStyles.position !== 'sticky') {
290
- naturalBound = common.translateRect(elRect, -canvasOrigin.left - (parseFloat(computedStyles.left) || 0), // could be 'auto'
291
- -canvasOrigin.top - (parseFloat(computedStyles.top) || 0));
292
- }
293
- elGeoms.push({
294
- parentBound: parentBound,
295
- naturalBound: naturalBound,
296
- elWidth: elRect.width,
297
- elHeight: elRect.height,
298
- textAlign: textAlign,
299
- });
300
- }
301
- return elGeoms;
302
- };
303
- // only for IE
304
- StickyScrolling.prototype.computeElDestinations = function (elGeoms, viewportWidth) {
305
- var scrollEl = this.scrollEl;
306
- var viewportTop = scrollEl.scrollTop;
307
- var viewportLeft = getScrollFromLeftEdge(scrollEl);
308
- var viewportRight = viewportLeft + viewportWidth;
309
- return elGeoms.map(function (elGeom) {
310
- var elWidth = elGeom.elWidth, elHeight = elGeom.elHeight, parentBound = elGeom.parentBound, naturalBound = elGeom.naturalBound;
311
- var destLeft; // relative to canvas topleft
312
- var destTop; // "
313
- switch (elGeom.textAlign) {
314
- case 'left':
315
- destLeft = viewportLeft;
316
- break;
317
- case 'right':
318
- destLeft = viewportRight - elWidth;
319
- break;
320
- case 'center':
321
- destLeft = (viewportLeft + viewportRight) / 2 - elWidth / 2; /// noooo, use half-width insteadddddddd
322
- break;
323
- }
324
- destLeft = Math.min(destLeft, parentBound.right - elWidth);
325
- destLeft = Math.max(destLeft, parentBound.left);
326
- destTop = viewportTop;
327
- destTop = Math.min(destTop, parentBound.bottom - elHeight);
328
- destTop = Math.max(destTop, naturalBound.top); // better to use natural top for upper bound
329
- return { left: destLeft, top: destTop };
330
- });
331
- };
332
- return StickyScrolling;
333
- }());
334
- function assignRelativePositions(els, elGeoms, elDestinations, viewportWidth, viewportHeight) {
335
- els.forEach(function (el, i) {
336
- var _a = elGeoms[i], naturalBound = _a.naturalBound, parentBound = _a.parentBound;
337
- var parentWidth = parentBound.right - parentBound.left;
338
- var parentHeight = parentBound.bottom - parentBound.bottom;
339
- var left;
340
- var top;
341
- if (parentWidth > viewportWidth ||
342
- parentHeight > viewportHeight) {
343
- left = elDestinations[i].left - naturalBound.left;
344
- top = elDestinations[i].top - naturalBound.top;
345
- }
346
- else { // if parent container can be completely in view, we don't need stickiness
347
- left = '';
348
- top = '';
349
- }
350
- common.applyStyle(el, {
351
- position: 'relative',
352
- left: left,
353
- right: -left,
354
- top: top,
355
- });
356
- });
357
- }
358
- function assignStickyPositions(els, elGeoms, viewportWidth) {
359
- els.forEach(function (el, i) {
360
- var _a = elGeoms[i], textAlign = _a.textAlign, elWidth = _a.elWidth, parentBound = _a.parentBound;
361
- var parentWidth = parentBound.right - parentBound.left;
362
- var left;
363
- if (textAlign === 'center' &&
364
- parentWidth > viewportWidth) {
365
- left = (viewportWidth - elWidth) / 2;
366
- }
367
- else { // if parent container can be completely in view, we don't need stickiness
368
- left = '';
369
- }
370
- common.applyStyle(el, {
371
- left: left,
372
- right: left,
373
- top: 0,
374
- });
375
- });
376
- }
377
- var _isStickySupported;
378
- function getStickySupported() {
379
- if (_isStickySupported == null) {
380
- _isStickySupported = computeStickySupported();
381
- }
382
- return _isStickySupported;
383
- }
384
- function computeStickySupported() {
385
- var el = document.createElement('div');
386
- el.style.position = 'sticky';
387
- document.body.appendChild(el);
388
- var val = window.getComputedStyle(el).position;
389
- common.removeElement(el);
390
- return val === 'sticky';
391
- }
392
-
393
- var ClippedScroller = /** @class */ (function (_super) {
394
- __extends(ClippedScroller, _super);
395
- function ClippedScroller() {
396
- var _this = _super !== null && _super.apply(this, arguments) || this;
397
- _this.elRef = common.createRef();
398
- _this.state = {
399
- xScrollbarWidth: 0,
400
- yScrollbarWidth: 0,
401
- };
402
- _this.handleScroller = function (scroller) {
403
- _this.scroller = scroller;
404
- common.setRef(_this.props.scrollerRef, scroller);
405
- };
406
- _this.handleSizing = function () {
407
- var props = _this.props;
408
- if (props.overflowY === 'scroll-hidden') {
409
- _this.setState({ yScrollbarWidth: _this.scroller.getYScrollbarWidth() });
410
- }
411
- if (props.overflowX === 'scroll-hidden') {
412
- _this.setState({ xScrollbarWidth: _this.scroller.getXScrollbarWidth() });
413
- }
414
- };
415
- return _this;
416
- }
417
- ClippedScroller.prototype.render = function () {
418
- var _a = this, props = _a.props, state = _a.state, context = _a.context;
419
- var isScrollbarOnLeft = context.isRtl && common.getIsRtlScrollbarOnLeft();
420
- var overcomeLeft = 0;
421
- var overcomeRight = 0;
422
- var overcomeBottom = 0;
423
- if (props.overflowX === 'scroll-hidden') {
424
- overcomeBottom = state.xScrollbarWidth;
425
- }
426
- if (props.overflowY === 'scroll-hidden') {
427
- if (state.yScrollbarWidth != null) {
428
- if (isScrollbarOnLeft) {
429
- overcomeLeft = state.yScrollbarWidth;
430
- }
431
- else {
432
- overcomeRight = state.yScrollbarWidth;
433
- }
434
- }
435
- }
436
- return (common.createElement("div", { ref: this.elRef, className: 'fc-scroller-harness' + (props.liquid ? ' fc-scroller-harness-liquid' : '') },
437
- common.createElement(common.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'
438
- ? (props.maxHeight + (props.overflowX === 'scroll-hidden' ? state.xScrollbarWidth : 0))
439
- : '', liquid: props.liquid, liquidIsAbsolute: true }, props.children)));
440
- };
441
- ClippedScroller.prototype.componentDidMount = function () {
442
- this.handleSizing();
443
- this.context.addResizeHandler(this.handleSizing);
444
- };
445
- ClippedScroller.prototype.componentDidUpdate = function (prevProps) {
446
- if (!common.isPropsEqual(prevProps, this.props)) { // an external change?
447
- this.handleSizing();
448
- }
449
- };
450
- ClippedScroller.prototype.componentWillUnmount = function () {
451
- this.context.removeResizeHandler(this.handleSizing);
452
- };
453
- ClippedScroller.prototype.needsXScrolling = function () {
454
- return this.scroller.needsXScrolling();
455
- };
456
- ClippedScroller.prototype.needsYScrolling = function () {
457
- return this.scroller.needsYScrolling();
458
- };
459
- return ClippedScroller;
460
- }(common.BaseComponent));
461
-
462
- var ScrollSyncer = /** @class */ (function () {
463
- function ScrollSyncer(isVertical, scrollEls) {
464
- var _this = this;
465
- this.isVertical = isVertical;
466
- this.scrollEls = scrollEls;
467
- this.isPaused = false;
468
- this.scrollListeners = scrollEls.map(function (el) { return _this.bindScroller(el); });
469
- }
470
- ScrollSyncer.prototype.destroy = function () {
471
- for (var _i = 0, _a = this.scrollListeners; _i < _a.length; _i++) {
472
- var scrollListener = _a[_i];
473
- scrollListener.destroy();
474
- }
475
- };
476
- ScrollSyncer.prototype.bindScroller = function (el) {
477
- var _this = this;
478
- var _a = this, scrollEls = _a.scrollEls, isVertical = _a.isVertical;
479
- var scrollListener = new ScrollListener(el);
480
- var onScroll = function (isWheel, isTouch) {
481
- if (!_this.isPaused) {
482
- if (!_this.masterEl || (_this.masterEl !== el && (isWheel || isTouch))) {
483
- _this.assignMaster(el);
484
- }
485
- if (_this.masterEl === el) { // dealing with current
486
- for (var _i = 0, scrollEls_1 = scrollEls; _i < scrollEls_1.length; _i++) {
487
- var otherEl = scrollEls_1[_i];
488
- if (otherEl !== el) {
489
- if (isVertical) {
490
- otherEl.scrollTop = el.scrollTop;
491
- }
492
- else {
493
- otherEl.scrollLeft = el.scrollLeft;
494
- }
495
- }
496
- }
497
- }
498
- }
499
- };
500
- var onScrollEnd = function () {
501
- if (_this.masterEl === el) {
502
- _this.masterEl = null;
503
- }
504
- };
505
- scrollListener.emitter.on('scroll', onScroll);
506
- scrollListener.emitter.on('scrollEnd', onScrollEnd);
507
- return scrollListener;
508
- };
509
- ScrollSyncer.prototype.assignMaster = function (el) {
510
- this.masterEl = el;
511
- for (var _i = 0, _a = this.scrollListeners; _i < _a.length; _i++) {
512
- var scrollListener = _a[_i];
513
- if (scrollListener.el !== el) {
514
- scrollListener.endScroll(); // to prevent residual scrolls from reclaiming master
515
- }
516
- }
517
- };
518
- /*
519
- will normalize the scrollLeft value
520
- */
521
- ScrollSyncer.prototype.forceScrollLeft = function (scrollLeft) {
522
- this.isPaused = true;
523
- for (var _i = 0, _a = this.scrollListeners; _i < _a.length; _i++) {
524
- var listener = _a[_i];
525
- setScrollFromLeftEdge(listener.el, scrollLeft);
526
- }
527
- this.isPaused = false;
528
- };
529
- ScrollSyncer.prototype.forceScrollTop = function (top) {
530
- this.isPaused = true;
531
- for (var _i = 0, _a = this.scrollListeners; _i < _a.length; _i++) {
532
- var listener = _a[_i];
533
- listener.el.scrollTop = top;
534
- }
535
- this.isPaused = false;
536
- };
537
- return ScrollSyncer;
538
- }());
539
-
540
- /*
541
- TODO: make <ScrollGridSection> subcomponent
542
- NOTE: doesn't support collapsibleWidth (which is sortof a hack anyway)
543
- */
544
- var ScrollGrid = /** @class */ (function (_super) {
545
- __extends(ScrollGrid, _super);
546
- function ScrollGrid() {
547
- var _this = _super !== null && _super.apply(this, arguments) || this;
548
- _this.compileColGroupStats = common.memoizeArraylike(compileColGroupStat, isColGroupStatsEqual);
549
- _this.renderMicroColGroups = common.memoizeArraylike(common.renderMicroColGroup); // yucky to memoize VNodes, but much more efficient for consumers
550
- _this.clippedScrollerRefs = new common.RefMap();
551
- // doesn't hold non-scrolling els used just for padding
552
- _this.scrollerElRefs = new common.RefMap(_this._handleScrollerEl.bind(_this));
553
- _this.chunkElRefs = new common.RefMap(_this._handleChunkEl.bind(_this));
554
- _this.stickyScrollings = [];
555
- _this.scrollSyncersBySection = {};
556
- _this.scrollSyncersByColumn = {};
557
- // for row-height-syncing
558
- _this.rowUnstableMap = new Map(); // no need to groom. always self-cancels
559
- _this.rowInnerMaxHeightMap = new Map();
560
- _this.anyRowHeightsChanged = false;
561
- _this.recentSizingCnt = 0;
562
- _this.state = {
563
- shrinkWidths: [],
564
- forceYScrollbars: false,
565
- forceXScrollbars: false,
566
- scrollerClientWidths: {},
567
- scrollerClientHeights: {},
568
- sectionRowMaxHeights: [],
569
- };
570
- _this.handleSizing = function (isForcedResize, sectionRowMaxHeightsChanged) {
571
- if (!_this.allowSizing()) {
572
- return;
573
- }
574
- if (!sectionRowMaxHeightsChanged) { // something else changed, probably external
575
- _this.anyRowHeightsChanged = true;
576
- }
577
- var otherState = {};
578
- // if reacting to self-change of sectionRowMaxHeightsChanged, or not stable, don't do anything
579
- if (isForcedResize || (!sectionRowMaxHeightsChanged && !_this.rowUnstableMap.size)) {
580
- otherState.sectionRowMaxHeights = _this.computeSectionRowMaxHeights();
581
- }
582
- _this.setState(__assign(__assign({ shrinkWidths: _this.computeShrinkWidths() }, _this.computeScrollerDims()), otherState), function () {
583
- if (!_this.rowUnstableMap.size) {
584
- _this.updateStickyScrolling(); // needs to happen AFTER final positioning committed to DOM
585
- }
586
- });
587
- };
588
- _this.handleRowHeightChange = function (rowEl, isStable) {
589
- var _a = _this, rowUnstableMap = _a.rowUnstableMap, rowInnerMaxHeightMap = _a.rowInnerMaxHeightMap;
590
- if (!isStable) {
591
- rowUnstableMap.set(rowEl, true);
592
- }
593
- else {
594
- rowUnstableMap.delete(rowEl);
595
- var innerMaxHeight = getRowInnerMaxHeight(rowEl);
596
- if (!rowInnerMaxHeightMap.has(rowEl) || rowInnerMaxHeightMap.get(rowEl) !== innerMaxHeight) {
597
- rowInnerMaxHeightMap.set(rowEl, innerMaxHeight);
598
- _this.anyRowHeightsChanged = true;
599
- }
600
- if (!rowUnstableMap.size && _this.anyRowHeightsChanged) {
601
- _this.anyRowHeightsChanged = false;
602
- _this.setState({
603
- sectionRowMaxHeights: _this.computeSectionRowMaxHeights(),
604
- });
605
- }
606
- }
607
- };
608
- return _this;
609
- }
610
- ScrollGrid.prototype.render = function () {
611
- var _a = this, props = _a.props, state = _a.state, context = _a.context;
612
- var shrinkWidths = state.shrinkWidths;
613
- var colGroupStats = this.compileColGroupStats(props.colGroups.map(function (colGroup) { return [colGroup]; }));
614
- var microColGroupNodes = this.renderMicroColGroups(colGroupStats.map(function (stat, i) { return [stat.cols, shrinkWidths[i]]; }));
615
- var classNames = common.getScrollGridClassNames(props.liquid, context);
616
- var _b = this.getDims(); _b[0]; _b[1];
617
- // TODO: make DRY
618
- var sectionConfigs = props.sections;
619
- var configCnt = sectionConfigs.length;
620
- var configI = 0;
621
- var currentConfig;
622
- var headSectionNodes = [];
623
- var bodySectionNodes = [];
624
- var footSectionNodes = [];
625
- while (configI < configCnt && (currentConfig = sectionConfigs[configI]).type === 'header') {
626
- headSectionNodes.push(this.renderSection(currentConfig, configI, colGroupStats, microColGroupNodes, state.sectionRowMaxHeights, true));
627
- configI += 1;
628
- }
629
- while (configI < configCnt && (currentConfig = sectionConfigs[configI]).type === 'body') {
630
- bodySectionNodes.push(this.renderSection(currentConfig, configI, colGroupStats, microColGroupNodes, state.sectionRowMaxHeights, false));
631
- configI += 1;
632
- }
633
- while (configI < configCnt && (currentConfig = sectionConfigs[configI]).type === 'footer') {
634
- footSectionNodes.push(this.renderSection(currentConfig, configI, colGroupStats, microColGroupNodes, state.sectionRowMaxHeights, true));
635
- configI += 1;
636
- }
637
- var isBuggy = !common.getCanVGrowWithinCell(); // see NOTE in SimpleScrollGrid
638
- var roleAttrs = { role: 'rowgroup' };
639
- return common.createElement('table', {
640
- ref: props.elRef,
641
- role: 'grid',
642
- className: classNames.join(' '),
643
- }, renderMacroColGroup(colGroupStats, shrinkWidths), Boolean(!isBuggy && headSectionNodes.length) && common.createElement.apply(void 0, __spreadArray(['thead', roleAttrs], headSectionNodes)), Boolean(!isBuggy && bodySectionNodes.length) && common.createElement.apply(void 0, __spreadArray(['tbody', roleAttrs], bodySectionNodes)), Boolean(!isBuggy && footSectionNodes.length) && common.createElement.apply(void 0, __spreadArray(['tfoot', roleAttrs], footSectionNodes)), isBuggy && common.createElement.apply(void 0, __spreadArray(__spreadArray(__spreadArray(['tbody', roleAttrs], headSectionNodes), bodySectionNodes), footSectionNodes)));
644
- };
645
- ScrollGrid.prototype.renderSection = function (sectionConfig, sectionIndex, colGroupStats, microColGroupNodes, sectionRowMaxHeights, isHeader) {
646
- var _this = this;
647
- if ('outerContent' in sectionConfig) {
648
- return (common.createElement(common.Fragment, { key: sectionConfig.key }, sectionConfig.outerContent));
649
- }
650
- return (common.createElement("tr", { key: sectionConfig.key, role: "presentation", className: common.getSectionClassNames(sectionConfig, this.props.liquid).join(' ') }, sectionConfig.chunks.map(function (chunkConfig, i) { return _this.renderChunk(sectionConfig, sectionIndex, colGroupStats[i], microColGroupNodes[i], chunkConfig, i, (sectionRowMaxHeights[sectionIndex] || [])[i] || [], isHeader); })));
651
- };
652
- ScrollGrid.prototype.renderChunk = function (sectionConfig, sectionIndex, colGroupStat, microColGroupNode, chunkConfig, chunkIndex, rowHeights, isHeader) {
653
- if ('outerContent' in chunkConfig) {
654
- return (common.createElement(common.Fragment, { key: chunkConfig.key }, chunkConfig.outerContent));
655
- }
656
- var state = this.state;
657
- var scrollerClientWidths = state.scrollerClientWidths, scrollerClientHeights = state.scrollerClientHeights;
658
- var _a = this.getDims(), sectionCnt = _a[0], chunksPerSection = _a[1];
659
- var index = sectionIndex * chunksPerSection + chunkIndex;
660
- var sideScrollIndex = (!this.context.isRtl || common.getIsRtlScrollbarOnLeft()) ? chunksPerSection - 1 : 0;
661
- var isVScrollSide = chunkIndex === sideScrollIndex;
662
- var isLastSection = sectionIndex === sectionCnt - 1;
663
- var forceXScrollbars = isLastSection && state.forceXScrollbars; // NOOOO can result in `null`
664
- var forceYScrollbars = isVScrollSide && state.forceYScrollbars; // NOOOO can result in `null`
665
- var allowXScrolling = colGroupStat && colGroupStat.allowXScrolling; // rename?
666
- var allowYScrolling = common.getAllowYScrolling(this.props, sectionConfig); // rename? do in section func?
667
- var chunkVGrow = common.getSectionHasLiquidHeight(this.props, sectionConfig); // do in section func?
668
- var expandRows = sectionConfig.expandRows && chunkVGrow;
669
- var tableMinWidth = (colGroupStat && colGroupStat.totalColMinWidth) || '';
670
- var content = common.renderChunkContent(sectionConfig, chunkConfig, {
671
- tableColGroupNode: microColGroupNode,
672
- tableMinWidth: tableMinWidth,
673
- clientWidth: scrollerClientWidths[index] !== undefined ? scrollerClientWidths[index] : null,
674
- clientHeight: scrollerClientHeights[index] !== undefined ? scrollerClientHeights[index] : null,
675
- expandRows: expandRows,
676
- syncRowHeights: Boolean(sectionConfig.syncRowHeights),
677
- rowSyncHeights: rowHeights,
678
- reportRowHeightChange: this.handleRowHeightChange,
679
- }, isHeader);
680
- var overflowX = forceXScrollbars ? (isLastSection ? 'scroll' : 'scroll-hidden') :
681
- !allowXScrolling ? 'hidden' :
682
- (isLastSection ? 'auto' : 'scroll-hidden');
683
- var overflowY = forceYScrollbars ? (isVScrollSide ? 'scroll' : 'scroll-hidden') :
684
- !allowYScrolling ? 'hidden' :
685
- (isVScrollSide ? 'auto' : 'scroll-hidden');
686
- // it *could* be possible to reduce DOM wrappers by only doing a ClippedScroller when allowXScrolling or allowYScrolling,
687
- // but if these values were to change, the inner components would be unmounted/remounted because of the parent change.
688
- content = (common.createElement(ClippedScroller, { ref: this.clippedScrollerRefs.createRef(index), scrollerElRef: this.scrollerElRefs.createRef(index), overflowX: overflowX, overflowY: overflowY, liquid: chunkVGrow, maxHeight: sectionConfig.maxHeight }, content));
689
- return common.createElement(isHeader ? 'th' : 'td', {
690
- key: chunkConfig.key,
691
- ref: this.chunkElRefs.createRef(index),
692
- role: 'presentation',
693
- }, content);
694
- };
695
- ScrollGrid.prototype.componentDidMount = function () {
696
- this.getStickyScrolling = common.memoizeArraylike(initStickyScrolling, null, destroyStickyScrolling);
697
- this.getScrollSyncersBySection = common.memoizeHashlike(initScrollSyncer.bind(this, true), null, destroyScrollSyncer);
698
- this.getScrollSyncersByColumn = common.memoizeHashlike(initScrollSyncer.bind(this, false), null, destroyScrollSyncer);
699
- this.updateScrollSyncers();
700
- this.handleSizing(false);
701
- this.context.addResizeHandler(this.handleSizing);
702
- };
703
- ScrollGrid.prototype.componentDidUpdate = function (prevProps, prevState) {
704
- this.updateScrollSyncers();
705
- // TODO: need better solution when state contains non-sizing things
706
- this.handleSizing(false, prevState.sectionRowMaxHeights !== this.state.sectionRowMaxHeights);
707
- };
708
- ScrollGrid.prototype.componentWillUnmount = function () {
709
- this.context.removeResizeHandler(this.handleSizing);
710
- this.destroyStickyScrolling();
711
- this.destroyScrollSyncers();
712
- };
713
- ScrollGrid.prototype.allowSizing = function () {
714
- var now = new Date();
715
- if (!this.lastSizingDate ||
716
- now.valueOf() > this.lastSizingDate.valueOf() + common.config.SCROLLGRID_RESIZE_INTERVAL) {
717
- this.lastSizingDate = now;
718
- this.recentSizingCnt = 0;
719
- return true;
720
- }
721
- return (this.recentSizingCnt += 1) <= 10;
722
- };
723
- ScrollGrid.prototype.computeShrinkWidths = function () {
724
- var _this = this;
725
- var colGroupStats = this.compileColGroupStats(this.props.colGroups.map(function (colGroup) { return [colGroup]; }));
726
- var _a = this.getDims(), sectionCnt = _a[0], chunksPerSection = _a[1];
727
- var cnt = sectionCnt * chunksPerSection;
728
- var shrinkWidths = [];
729
- colGroupStats.forEach(function (colGroupStat, i) {
730
- if (colGroupStat.hasShrinkCol) {
731
- var chunkEls = _this.chunkElRefs.collect(i, cnt, chunksPerSection); // in one col
732
- shrinkWidths[i] = common.computeShrinkWidth(chunkEls);
733
- }
734
- });
735
- return shrinkWidths;
736
- };
737
- // has the side effect of grooming rowInnerMaxHeightMap
738
- // TODO: somehow short-circuit if there are no new height changes
739
- ScrollGrid.prototype.computeSectionRowMaxHeights = function () {
740
- var newHeightMap = new Map();
741
- var _a = this.getDims(), sectionCnt = _a[0], chunksPerSection = _a[1];
742
- var sectionRowMaxHeights = [];
743
- for (var sectionI = 0; sectionI < sectionCnt; sectionI += 1) {
744
- var sectionConfig = this.props.sections[sectionI];
745
- var assignableHeights = []; // chunk, row
746
- if (sectionConfig && sectionConfig.syncRowHeights) {
747
- var rowHeightsByChunk = [];
748
- for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) {
749
- var index = sectionI * chunksPerSection + chunkI;
750
- var rowHeights = [];
751
- var chunkEl = this.chunkElRefs.currentMap[index];
752
- if (chunkEl) {
753
- rowHeights = common.findElements(chunkEl, '.fc-scrollgrid-sync-table tr').map(function (rowEl) {
754
- var max = getRowInnerMaxHeight(rowEl);
755
- newHeightMap.set(rowEl, max);
756
- return max;
757
- });
758
- }
759
- else {
760
- rowHeights = [];
761
- }
762
- rowHeightsByChunk.push(rowHeights);
763
- }
764
- var rowCnt = rowHeightsByChunk[0].length;
765
- var isEqualRowCnt = true;
766
- for (var chunkI = 1; chunkI < chunksPerSection; chunkI += 1) {
767
- var isOuterContent = sectionConfig.chunks[chunkI] && sectionConfig.chunks[chunkI].outerContent !== undefined; // can be null
768
- if (!isOuterContent && rowHeightsByChunk[chunkI].length !== rowCnt) { // skip outer content
769
- isEqualRowCnt = false;
770
- break;
771
- }
772
- }
773
- if (!isEqualRowCnt) {
774
- var chunkHeightSums = [];
775
- for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) {
776
- chunkHeightSums.push(sumNumbers(rowHeightsByChunk[chunkI]) + rowHeightsByChunk[chunkI].length);
777
- }
778
- var maxTotalSum = Math.max.apply(Math, chunkHeightSums);
779
- for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) {
780
- var rowInChunkCnt = rowHeightsByChunk[chunkI].length;
781
- var rowInChunkTotalHeight = maxTotalSum - rowInChunkCnt; // subtract border
782
- // height of non-first row. we do this to avoid rounding, because it's unreliable within a table
783
- var rowInChunkHeightOthers = Math.floor(rowInChunkTotalHeight / rowInChunkCnt);
784
- // whatever is leftover goes to the first row
785
- var rowInChunkHeightFirst = rowInChunkTotalHeight - rowInChunkHeightOthers * (rowInChunkCnt - 1);
786
- var rowInChunkHeights = [];
787
- var row = 0;
788
- if (row < rowInChunkCnt) {
789
- rowInChunkHeights.push(rowInChunkHeightFirst);
790
- row += 1;
791
- }
792
- while (row < rowInChunkCnt) {
793
- rowInChunkHeights.push(rowInChunkHeightOthers);
794
- row += 1;
795
- }
796
- assignableHeights.push(rowInChunkHeights);
797
- }
798
- }
799
- else {
800
- for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) {
801
- assignableHeights.push([]);
802
- }
803
- for (var row = 0; row < rowCnt; row += 1) {
804
- var rowHeightsAcrossChunks = [];
805
- for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) {
806
- var h = rowHeightsByChunk[chunkI][row];
807
- if (h != null) { // protect against outerContent
808
- rowHeightsAcrossChunks.push(h);
809
- }
810
- }
811
- var maxHeight = Math.max.apply(Math, rowHeightsAcrossChunks);
812
- for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) {
813
- assignableHeights[chunkI].push(maxHeight);
814
- }
815
- }
816
- }
817
- }
818
- sectionRowMaxHeights.push(assignableHeights);
819
- }
820
- this.rowInnerMaxHeightMap = newHeightMap;
821
- return sectionRowMaxHeights;
822
- };
823
- ScrollGrid.prototype.computeScrollerDims = function () {
824
- var scrollbarWidth = common.getScrollbarWidths();
825
- var _a = this.getDims(), sectionCnt = _a[0], chunksPerSection = _a[1];
826
- var sideScrollI = (!this.context.isRtl || common.getIsRtlScrollbarOnLeft()) ? chunksPerSection - 1 : 0;
827
- var lastSectionI = sectionCnt - 1;
828
- var currentScrollers = this.clippedScrollerRefs.currentMap;
829
- var scrollerEls = this.scrollerElRefs.currentMap;
830
- var forceYScrollbars = false;
831
- var forceXScrollbars = false;
832
- var scrollerClientWidths = {};
833
- var scrollerClientHeights = {};
834
- for (var sectionI = 0; sectionI < sectionCnt; sectionI += 1) { // along edge
835
- var index = sectionI * chunksPerSection + sideScrollI;
836
- var scroller = currentScrollers[index];
837
- if (scroller && scroller.needsYScrolling()) {
838
- forceYScrollbars = true;
839
- break;
840
- }
841
- }
842
- for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) { // along last row
843
- var index = lastSectionI * chunksPerSection + chunkI;
844
- var scroller = currentScrollers[index];
845
- if (scroller && scroller.needsXScrolling()) {
846
- forceXScrollbars = true;
847
- break;
848
- }
849
- }
850
- for (var sectionI = 0; sectionI < sectionCnt; sectionI += 1) {
851
- for (var chunkI = 0; chunkI < chunksPerSection; chunkI += 1) {
852
- var index = sectionI * chunksPerSection + chunkI;
853
- var scrollerEl = scrollerEls[index];
854
- if (scrollerEl) {
855
- // TODO: weird way to get this. need harness b/c doesn't include table borders
856
- var harnessEl = scrollerEl.parentNode;
857
- scrollerClientWidths[index] = Math.floor(harnessEl.getBoundingClientRect().width - ((chunkI === sideScrollI && forceYScrollbars)
858
- ? scrollbarWidth.y // use global because scroller might not have scrollbars yet but will need them in future
859
- : 0));
860
- scrollerClientHeights[index] = Math.floor(harnessEl.getBoundingClientRect().height - ((sectionI === lastSectionI && forceXScrollbars)
861
- ? scrollbarWidth.x // use global because scroller might not have scrollbars yet but will need them in future
862
- : 0));
863
- }
864
- }
865
- }
866
- return { forceYScrollbars: forceYScrollbars, forceXScrollbars: forceXScrollbars, scrollerClientWidths: scrollerClientWidths, scrollerClientHeights: scrollerClientHeights };
867
- };
868
- ScrollGrid.prototype.updateStickyScrolling = function () {
869
- var isRtl = this.context.isRtl;
870
- var argsByKey = this.scrollerElRefs.getAll().map(function (scrollEl) { return [scrollEl, isRtl]; });
871
- var stickyScrollings = this.getStickyScrolling(argsByKey);
872
- stickyScrollings.forEach(function (stickyScrolling) { return stickyScrolling.updateSize(); });
873
- this.stickyScrollings = stickyScrollings;
874
- };
875
- ScrollGrid.prototype.destroyStickyScrolling = function () {
876
- this.stickyScrollings.forEach(destroyStickyScrolling);
877
- };
878
- ScrollGrid.prototype.updateScrollSyncers = function () {
879
- var _a = this.getDims(), sectionCnt = _a[0], chunksPerSection = _a[1];
880
- var cnt = sectionCnt * chunksPerSection;
881
- var scrollElsBySection = {};
882
- var scrollElsByColumn = {};
883
- var scrollElMap = this.scrollerElRefs.currentMap;
884
- for (var sectionI = 0; sectionI < sectionCnt; sectionI += 1) {
885
- var startIndex = sectionI * chunksPerSection;
886
- var endIndex = startIndex + chunksPerSection;
887
- scrollElsBySection[sectionI] = common.collectFromHash(scrollElMap, startIndex, endIndex, 1); // use the filtered
888
- }
889
- for (var col = 0; col < chunksPerSection; col += 1) {
890
- scrollElsByColumn[col] = this.scrollerElRefs.collect(col, cnt, chunksPerSection); // DON'T use the filtered
891
- }
892
- this.scrollSyncersBySection = this.getScrollSyncersBySection(scrollElsBySection);
893
- this.scrollSyncersByColumn = this.getScrollSyncersByColumn(scrollElsByColumn);
894
- };
895
- ScrollGrid.prototype.destroyScrollSyncers = function () {
896
- common.mapHash(this.scrollSyncersBySection, destroyScrollSyncer);
897
- common.mapHash(this.scrollSyncersByColumn, destroyScrollSyncer);
898
- };
899
- ScrollGrid.prototype.getChunkConfigByIndex = function (index) {
900
- var chunksPerSection = this.getDims()[1];
901
- var sectionI = Math.floor(index / chunksPerSection);
902
- var chunkI = index % chunksPerSection;
903
- var sectionConfig = this.props.sections[sectionI];
904
- return sectionConfig && sectionConfig.chunks[chunkI];
905
- };
906
- ScrollGrid.prototype.forceScrollLeft = function (col, scrollLeft) {
907
- var scrollSyncer = this.scrollSyncersByColumn[col];
908
- if (scrollSyncer) {
909
- scrollSyncer.forceScrollLeft(scrollLeft);
910
- }
911
- };
912
- ScrollGrid.prototype.forceScrollTop = function (sectionI, scrollTop) {
913
- var scrollSyncer = this.scrollSyncersBySection[sectionI];
914
- if (scrollSyncer) {
915
- scrollSyncer.forceScrollTop(scrollTop);
916
- }
917
- };
918
- ScrollGrid.prototype._handleChunkEl = function (chunkEl, key) {
919
- var chunkConfig = this.getChunkConfigByIndex(parseInt(key, 10));
920
- if (chunkConfig) { // null if section disappeared. bad, b/c won't null-set the elRef
921
- common.setRef(chunkConfig.elRef, chunkEl);
922
- }
923
- };
924
- ScrollGrid.prototype._handleScrollerEl = function (scrollerEl, key) {
925
- var chunkConfig = this.getChunkConfigByIndex(parseInt(key, 10));
926
- if (chunkConfig) { // null if section disappeared. bad, b/c won't null-set the elRef
927
- common.setRef(chunkConfig.scrollerElRef, scrollerEl);
928
- }
929
- };
930
- ScrollGrid.prototype.getDims = function () {
931
- var sectionCnt = this.props.sections.length;
932
- var chunksPerSection = sectionCnt ? this.props.sections[0].chunks.length : 0;
933
- return [sectionCnt, chunksPerSection];
934
- };
935
- return ScrollGrid;
936
- }(common.BaseComponent));
937
- ScrollGrid.addStateEquality({
938
- shrinkWidths: common.isArraysEqual,
939
- scrollerClientWidths: common.isPropsEqual,
940
- scrollerClientHeights: common.isPropsEqual,
941
- });
942
- function sumNumbers(numbers) {
943
- var sum = 0;
944
- for (var _i = 0, numbers_1 = numbers; _i < numbers_1.length; _i++) {
945
- var n = numbers_1[_i];
946
- sum += n;
947
- }
948
- return sum;
949
- }
950
- function getRowInnerMaxHeight(rowEl) {
951
- var innerHeights = common.findElements(rowEl, '.fc-scrollgrid-sync-inner').map(getElHeight);
952
- if (innerHeights.length) {
953
- return Math.max.apply(Math, innerHeights);
954
- }
955
- return 0;
956
- }
957
- function getElHeight(el) {
958
- return el.offsetHeight; // better to deal with integers, for rounding, for PureComponent
959
- }
960
- function renderMacroColGroup(colGroupStats, shrinkWidths) {
961
- var children = colGroupStats.map(function (colGroupStat, i) {
962
- var width = colGroupStat.width;
963
- if (width === 'shrink') {
964
- width = colGroupStat.totalColWidth + common.sanitizeShrinkWidth(shrinkWidths[i]) + 1; // +1 for border :(
965
- }
966
- return ( // eslint-disable-next-line react/jsx-key
967
- common.createElement("col", { style: { width: width } }));
968
- });
969
- return common.createElement.apply(void 0, __spreadArray(['colgroup', {}], children));
970
- }
971
- function compileColGroupStat(colGroupConfig) {
972
- var totalColWidth = sumColProp(colGroupConfig.cols, 'width'); // excludes "shrink"
973
- var totalColMinWidth = sumColProp(colGroupConfig.cols, 'minWidth');
974
- var hasShrinkCol = common.hasShrinkWidth(colGroupConfig.cols);
975
- var allowXScrolling = colGroupConfig.width !== 'shrink' && Boolean(totalColWidth || totalColMinWidth || hasShrinkCol);
976
- return {
977
- hasShrinkCol: hasShrinkCol,
978
- totalColWidth: totalColWidth,
979
- totalColMinWidth: totalColMinWidth,
980
- allowXScrolling: allowXScrolling,
981
- cols: colGroupConfig.cols,
982
- width: colGroupConfig.width,
983
- };
984
- }
985
- function sumColProp(cols, propName) {
986
- var total = 0;
987
- for (var _i = 0, cols_1 = cols; _i < cols_1.length; _i++) {
988
- var col = cols_1[_i];
989
- var val = col[propName];
990
- if (typeof val === 'number') {
991
- total += val * (col.span || 1);
992
- }
993
- }
994
- return total;
995
- }
996
- var COL_GROUP_STAT_EQUALITY = {
997
- cols: common.isColPropsEqual,
998
- };
999
- function isColGroupStatsEqual(stat0, stat1) {
1000
- return common.compareObjs(stat0, stat1, COL_GROUP_STAT_EQUALITY);
1001
- }
1002
- // for memoizers...
1003
- function initScrollSyncer(isVertical) {
1004
- var scrollEls = [];
1005
- for (var _i = 1; _i < arguments.length; _i++) {
1006
- scrollEls[_i - 1] = arguments[_i];
1007
- }
1008
- return new ScrollSyncer(isVertical, scrollEls);
1009
- }
1010
- function destroyScrollSyncer(scrollSyncer) {
1011
- scrollSyncer.destroy();
1012
- }
1013
- function initStickyScrolling(scrollEl, isRtl) {
1014
- return new StickyScrolling(scrollEl, isRtl);
1015
- }
1016
- function destroyStickyScrolling(stickyScrolling) {
1017
- stickyScrolling.destroy();
1018
- }
1019
-
1020
- var plugin = common.createPlugin({
1021
- deps: [
1022
- premiumCommonPlugin__default['default'],
1023
- ],
1024
- scrollGridImpl: ScrollGrid,
1025
- });
1026
- common.config.SCROLLGRID_RESIZE_INTERVAL = 500;
1027
-
1028
- common.globalPlugins.push(plugin);
1029
-
1030
- exports.ScrollGrid = ScrollGrid;
1031
- exports.default = plugin;
1032
- exports.setScrollFromLeftEdge = setScrollFromLeftEdge;
1033
-
1034
- Object.defineProperty(exports, '__esModule', { value: true });
1035
-
1036
- return exports;
1037
-
1038
- }({}, FullCalendar, FullCalendarPremiumCommon));