vendor: 5,218 bytes, lines 1-149
1/*! 2 * FullCalendar v3.9.0 3 * Docs & License: https://fullcalendar.io/ 4 * (c) 2018 Adam Shaw 5 */ 6(function webpackUniversalModuleDefinition(root, factory) { 7 if(typeof exports === 'object' && typeof module === 'object') 8 module.exports = factory(require("moment"), require("jquery")); 9 else if(typeof define === 'function' && define.amd) 10 define(["moment", "jquery"], factory); 11 else if(typeof exports === 'object') 12 exports["FullCalendar"] = factory(require("moment"), require("jquery")); 13 else 14 root["FullCalendar"] = factory(root["moment"], root["jQuery"]); 15})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_3__) { 16return /******/ (function(modules) { // webpackBootstrap 17/******/ // The module cache 18/******/ var installedModules = {}; 19/******/ 20/******/ // The require function 21/******/ function __webpack_require__(moduleId) { 22/******/ 23/******/ // Check if module is in cache 24/******/ if(installedModules[moduleId]) { 25/******/ return installedModules[moduleId].exports; 26/******/ } 27/******/ // Create a new module (and put it into the cache) 28/******/ var module = installedModules[moduleId] = { 29/******/ i: moduleId, 30/******/ l: false, 31/******/ exports: {} 32/******/ }; 33/******/ 34/******/ // Execute the module function 35/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 36/******/ 37/******/ // Flag the module as loaded 38/******/ module.l = true; 39/******/ 40/******/ // Return the exports of the module 41/******/ return module.exports; 42/******/ } 43/******/ 44/******/ 45/******/ // expose the modules object (__webpack_modules__) 46/******/ __webpack_require__.m = modules; 47/******/ 48/******/ // expose the module cache 49/******/ __webpack_require__.c = installedModules; 50/******/ 51/******/ // define getter function for harmony exports 52/******/ __webpack_require__.d = function(exports, name, getter) { 53/******/ if(!__webpack_require__.o(exports, name)) { 54/******/ Object.defineProperty(exports, name, { 55/******/ configurable: false, 56/******/ enumerable: true, 57/******/ get: getter 58/******/ }); 59/******/ } 60/******/ }; 61/******/ 62/******/ // getDefaultExport function for compatibility with non-harmony modules 63/******/ __webpack_require__.n = function(module) { 64/******/ var getter = module && module.__esModule ? 65/******/ function getDefault() { return module['default']; } : 66/******/ function getModuleExports() { return module; }; 67/******/ __webpack_require__.d(getter, 'a', getter); 68/******/ return getter; 69/******/ }; 70/******/ 71/******/ // Object.prototype.hasOwnProperty.call 72/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 73/******/ 74/******/ // __webpack_public_path__ 75/******/ __webpack_require__.p = ""; 76/******/ 77/******/ // Load entry module and return exports 78/******/ return __webpack_require__(__webpack_require__.s = 236); 79/******/ }) 80/************************************************************************/ 81/******/ ([ 82/* 0 */ 83/***/ (function(module, exports) { 84 85module.exports = __WEBPACK_EXTERNAL_MODULE_0__; 86 87/***/ }), 88/* 1 */, 89/* 2 */ 90/***/ (function(module, exports) { 91 92/* 93derived from: 94https://github.com/Microsoft/tslib/blob/v1.6.0/tslib.js 95 96only include the helpers we need, to keep down filesize 97*/ 98var extendStatics = Object.setPrototypeOf || 99 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 100 function (d, b) { for (var p in b) 101 if (b.hasOwnProperty(p)) 102 d[p] = b[p]; }; 103exports.__extends = function (d, b) { 104 extendStatics(d, b); 105 function __() { this.constructor = d; } 106 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 107}; 108 109 110/***/ }), 111/* 3 */ 112/***/ (function(module, exports) { 113 114module.exports = __WEBPACK_EXTERNAL_MODULE_3__; 115 116/***/ }), 117/* 4 */ 118/***/ (function(module, exports, __webpack_require__) { 119 120Object.defineProperty(exports, "__esModule", { value: true }); 121var moment = __webpack_require__(0); 122var $ = __webpack_require__(3); 123/* FullCalendar-specific DOM Utilities 124----------------------------------------------------------------------------------------------------------------------*/ 125// Given the scrollbar widths of some other container, create borders/margins on rowEls in order to match the left 126// and right space that was offset by the scrollbars. A 1-pixel border first, then margin beyond that. 127function compensateScroll(rowEls, scrollbarWidths) { 128 if (scrollbarWidths.left) { 129 rowEls.css({ 130 'border-left-width': 1, 131 'margin-left': scrollbarWidths.left - 1 132 }); 133 } 134 if (scrollbarWidths.right) { 135 rowEls.css({ 136 'border-right-width': 1, 137 'margin-right': scrollbarWidths.right - 1 138 }); 139 } 140} 141exports.compensateScroll = compensateScroll; 142// Undoes compensateScroll and restores all borders/margins 143function uncompensateScroll(rowEls) { 144 rowEls.css({ 145 'margin-left': '', 146 'margin-right': '', 147 'border-left-width': '', 148 'border-right-width': '' 149 });
150} 151exports.uncompensateScroll = uncompensateScroll; 152// Make the mouse cursor express that an event is not allowed in the current area 153function disableCursor() { 154 $('body').addClass('fc-not-allowed'); 155} 156exports.disableCursor = disableCursor; 157// Returns the mouse cursor to its original look 158function enableCursor() { 159 $('body').removeClass('fc-not-allowed'); 160} 161exports.enableCursor = enableCursor; 162// Given a total available height to fill, have `els` (essentially child rows) expand to accomodate. 163// By default, all elements that are shorter than the recommended height are expanded uniformly, not considering 164// any other els that are already too tall. if `shouldRedistribute` is on, it considers these tall rows and 165// reduces the available height. 166function distributeHeight(els, availableHeight, shouldRedistribute) { 167 // *FLOORING NOTE*: we floor in certain places because zoom can give inaccurate floating-point dimensions, 168 // and it is better to be shorter than taller, to avoid creating unnecessary scrollbars. 169 var minOffset1 = Math.floor(availableHeight / els.length); // for non-last element 170 var minOffset2 = Math.floor(availableHeight - minOffset1 * (els.length - 1)); // for last element *FLOORING NOTE* 171 var flexEls = []; // elements that are allowed to expand. array of DOM nodes 172 var flexOffsets = []; // amount of vertical space it takes up 173 var flexHeights = []; // actual css height 174 var usedHeight = 0; 175 undistributeHeight(els); // give all elements their natural height 176 // find elements that are below the recommended height (expandable). 177 // important to query for heights in a single first pass (to avoid reflow oscillation). 178 els.each(function (i, el) { 179 var minOffset = i === els.length - 1 ? minOffset2 : minOffset1; 180 var naturalOffset = $(el).outerHeight(true); 181 if (naturalOffset < minOffset) { 182 flexEls.push(el); 183 flexOffsets.push(naturalOffset); 184 flexHeights.push($(el).height()); 185 } 186 else { 187 // this element stretches past recommended height (non-expandable). mark the space as occupied. 188 usedHeight += naturalOffset; 189 } 190 }); 191 // readjust the recommended height to only consider the height available to non-maxed-out rows. 192 if (shouldRedistribute) { 193 availableHeight -= usedHeight; 194 minOffset1 = Math.floor(availableHeight / flexEls.length); 195 minOffset2 = Math.floor(availableHeight - minOffset1 * (flexEls.length - 1)); // *FLOORING NOTE* 196 } 197 // assign heights to all expandable elements 198 $(flexEls).each(function (i, el) { 199 var minOffset = i === flexEls.length - 1 ? minOffset2 : minOffset1; 200 var naturalOffset = flexOffsets[i]; 201 var naturalHeight = flexHeights[i]; 202 var newHeight = minOffset - (naturalOffset - naturalHeight); // subtract the margin/padding 203 if (naturalOffset < minOffset) { 204 $(el).height(newHeight); 205 } 206 }); 207} 208exports.distributeHeight = distributeHeight; 209// Undoes distrubuteHeight, restoring all els to their natural height 210function undistributeHeight(els) { 211 els.height(''); 212} 213exports.undistributeHeight = undistributeHeight; 214// Given `els`, a jQuery set of <td> cells, find the cell with the largest natural width and set the widths of all the 215// cells to be that width. 216// PREREQUISITE: if you want a cell to take up width, it needs to have a single inner element w/ display:inline 217function matchCellWidths(els) { 218 var maxInnerWidth = 0; 219 els.find('> *').each(function (i, innerEl) { 220 var innerWidth = $(innerEl).outerWidth(); 221 if (innerWidth > maxInnerWidth) { 222 maxInnerWidth = innerWidth; 223 } 224 }); 225 maxInnerWidth++; // sometimes not accurate of width the text needs to stay on one line. insurance 226 els.width(maxInnerWidth); 227 return maxInnerWidth; 228} 229exports.matchCellWidths = matchCellWidths; 230// Given one element that resides inside another, 231// Subtracts the height of the inner element from the outer element.
232function subtractInnerElHeight(outerEl, innerEl) { 233 var both = outerEl.add(innerEl); 234 var diff; 235 // effin' IE8/9/10/11 sometimes returns 0 for dimensions. this weird hack was the only thing that worked 236 both.css({ 237 position: 'relative', 238 left: -1 // ensure reflow in case the el was already relative. negative is less likely to cause new scroll 239 }); 240 diff = outerEl.outerHeight() - innerEl.outerHeight(); // grab the dimensions 241 both.css({ position: '', left: '' }); // undo hack 242 return diff; 243} 244exports.subtractInnerElHeight = subtractInnerElHeight; 245/* Element Geom Utilities 246----------------------------------------------------------------------------------------------------------------------*/ 247// borrowed from https://github.com/jquery/jquery-ui/blob/1.11.0/ui/core.js#L51 248function getScrollParent(el) { 249 var position = el.css('position'); 250 var scrollParent = el.parents().filter(function () { 251 var parent = $(this); 252 return (/(auto|scroll)/).test(parent.css('overflow') + parent.css('overflow-y') + parent.css('overflow-x')); 253 }).eq(0); 254 return position === 'fixed' || !scrollParent.length ? $(el[0].ownerDocument || document) : scrollParent; 255} 256exports.getScrollParent = getScrollParent; 257// Queries the outer bounding area of a jQuery element. 258// Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive). 259// Origin is optional. 260function getOuterRect(el, origin) { 261 var offset = el.offset(); 262 var left = offset.left - (origin ? origin.left : 0); 263 var top = offset.top - (origin ? origin.top : 0); 264 return { 265 left: left, 266 right: left + el.outerWidth(), 267 top: top, 268 bottom: top + el.outerHeight() 269 }; 270} 271exports.getOuterRect = getOuterRect; 272// Queries the area within the margin/border/scrollbars of a jQuery element. Does not go within the padding. 273// Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive). 274// Origin is optional. 275// WARNING: given element can't have borders 276// NOTE: should use clientLeft/clientTop, but very unreliable cross-browser. 277function getClientRect(el, origin) { 278 var offset = el.offset(); 279 var scrollbarWidths = getScrollbarWidths(el); 280 var left = offset.left + getCssFloat(el, 'border-left-width') + scrollbarWidths.left - (origin ? origin.left : 0); 281 var top = offset.top + getCssFloat(el, 'border-top-width') + scrollbarWidths.top - (origin ? origin.top : 0); 282 return { 283 left: left, 284 right: left + el[0].clientWidth, 285 top: top, 286 bottom: top + el[0].clientHeight // clientHeight includes padding but NOT scrollbars 287 }; 288} 289exports.getClientRect = getClientRect; 290// Queries the area within the margin/border/padding of a jQuery element. Assumed not to have scrollbars. 291// Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive). 292// Origin is optional. 293function getContentRect(el, origin) { 294 var offset = el.offset(); // just outside of border, margin not included 295 var left = offset.left + getCssFloat(el, 'border-left-width') + getCssFloat(el, 'padding-left') - 296 (origin ? origin.left : 0); 297 var top = offset.top + getCssFloat(el, 'border-top-width') + getCssFloat(el, 'padding-top') - 298 (origin ? origin.top : 0); 299 return { 300 left: left, 301 right: left + el.width(), 302 top: top, 303 bottom: top + el.height() 304 }; 305} 306exports.getContentRect = getContentRect; 307// Returns the computed left/right/top/bottom scrollbar widths for the given jQuery element. 308// WARNING: given element can't have borders (which will cause offsetWidth/offsetHeight to be larger). 309// NOTE: should use clientLeft/clientTop, but very unreliable cross-browser. 310function getScrollbarWidths(el) { 311 var leftRightWidth = el[0].offsetWidth - el[0].clientWidth; 312 var bottomWidth = el[0].offsetHeight - el[0].clientHeight; 313 var widths; 314 leftRightWidth = sanitizeScrollbarWidth(leftRightWidth);
315 bottomWidth = sanitizeScrollbarWidth(bottomWidth); 316 widths = { left: 0, right: 0, top: 0, bottom: bottomWidth }; 317 if (getIsLeftRtlScrollbars() && el.css('direction') === 'rtl') { 318 widths.left = leftRightWidth; 319 } 320 else { 321 widths.right = leftRightWidth; 322 } 323 return widths; 324} 325exports.getScrollbarWidths = getScrollbarWidths; 326// The scrollbar width computations in getScrollbarWidths are sometimes flawed when it comes to 327// retina displays, rounding, and IE11. Massage them into a usable value. 328function sanitizeScrollbarWidth(width) { 329 width = Math.max(0, width); // no negatives 330 width = Math.round(width); 331 return width; 332} 333// Logic for determining if, when the element is right-to-left, the scrollbar appears on the left side 334var _isLeftRtlScrollbars = null; 335function getIsLeftRtlScrollbars() { 336 if (_isLeftRtlScrollbars === null) { 337 _isLeftRtlScrollbars = computeIsLeftRtlScrollbars(); 338 } 339 return _isLeftRtlScrollbars; 340} 341function computeIsLeftRtlScrollbars() { 342 var el = $('<div><div/></div>') 343 .css({ 344 position: 'absolute', 345 top: -1000, 346 left: 0, 347 border: 0, 348 padding: 0, 349 overflow: 'scroll', 350 direction: 'rtl' 351 }) 352 .appendTo('body'); 353 var innerEl = el.children(); 354 var res = innerEl.offset().left > el.offset().left; // is the inner div shifted to accommodate a left scrollbar? 355 el.remove(); 356 return res; 357} 358// Retrieves a jQuery element's computed CSS value as a floating-point number. 359// If the queried value is non-numeric (ex: IE can return "medium" for border width), will just return zero. 360function getCssFloat(el, prop) { 361 return parseFloat(el.css(prop)) || 0; 362} 363/* Mouse / Touch Utilities 364----------------------------------------------------------------------------------------------------------------------*/ 365// Returns a boolean whether this was a left mouse click and no ctrl key (which means right click on Mac) 366function isPrimaryMouseButton(ev) { 367 return ev.which === 1 && !ev.ctrlKey; 368} 369exports.isPrimaryMouseButton = isPrimaryMouseButton; 370function getEvX(ev) { 371 var touches = ev.originalEvent.touches; 372 // on mobile FF, pageX for touch events is present, but incorrect, 373 // so, look at touch coordinates first. 374 if (touches && touches.length) { 375 return touches[0].pageX; 376 } 377 return ev.pageX; 378} 379exports.getEvX = getEvX; 380function getEvY(ev) { 381 var touches = ev.originalEvent.touches; 382 // on mobile FF, pageX for touch events is present, but incorrect, 383 // so, look at touch coordinates first. 384 if (touches && touches.length) { 385 return touches[0].pageY; 386 } 387 return ev.pageY; 388} 389exports.getEvY = getEvY; 390function getEvIsTouch(ev) { 391 return /^touch/.test(ev.type); 392} 393exports.getEvIsTouch = getEvIsTouch; 394function preventSelection(el) { 395 el.addClass('fc-unselectable') 396 .on('selectstart', preventDefault); 397} 398exports.preventSelection = preventSelection; 399function allowSelection(el) { 400 el.removeClass('fc-unselectable') 401 .off('selectstart', preventDefault); 402} 403exports.allowSelection = allowSelection; 404// Stops a mouse/touch event from doing it's native browser action 405function preventDefault(ev) { 406 ev.preventDefault(); 407} 408exports.preventDefault = preventDefault; 409/* General Geometry Utils 410----------------------------------------------------------------------------------------------------------------------*/ 411// Returns a new rectangle that is the intersection of the two rectangles. If they don't intersect, returns false 412function intersectRects(rect1, rect2) { 413 var res = { 414 left: Math.max(rect1.left, rect2.left), 415 right: Math.min(rect1.right, rect2.right), 416 top: Math.max(rect1.top, rect2.top), 417 bottom: Math.min(rect1.bottom, rect2.bottom) 418 }; 419 if (res.left < res.right && res.top < res.bottom) { 420 return res; 421 } 422 return false; 423} 424exports.intersectRects = intersectRects; 425// Returns a new point that will have been moved to reside within the given rectangle 426function constrainPoint(point, rect) { 427 return { 428 left: Math.min(Math.max(point.left, rect.left), rect.right),
429 top: Math.min(Math.max(point.top, rect.top), rect.bottom) 430 }; 431} 432exports.constrainPoint = constrainPoint; 433// Returns a point that is the center of the given rectangle 434function getRectCenter(rect) { 435 return { 436 left: (rect.left + rect.right) / 2, 437 top: (rect.top + rect.bottom) / 2 438 }; 439} 440exports.getRectCenter = getRectCenter; 441// Subtracts point2's coordinates from point1's coordinates, returning a delta 442function diffPoints(point1, point2) { 443 return { 444 left: point1.left - point2.left, 445 top: point1.top - point2.top 446 }; 447} 448exports.diffPoints = diffPoints; 449/* Object Ordering by Field 450----------------------------------------------------------------------------------------------------------------------*/ 451function parseFieldSpecs(input) { 452 var specs = []; 453 var tokens = []; 454 var i; 455 var token; 456 if (typeof input === 'string') { 457 tokens = input.split(/\s*,\s*/); 458 } 459 else if (typeof input === 'function') { 460 tokens = [input]; 461 } 462 else if ($.isArray(input)) { 463 tokens = input; 464 } 465 for (i = 0; i < tokens.length; i++) { 466 token = tokens[i]; 467 if (typeof token === 'string') { 468 specs.push(token.charAt(0) === '-' ? 469 { field: token.substring(1), order: -1 } : 470 { field: token, order: 1 }); 471 } 472 else if (typeof token === 'function') { 473 specs.push({ func: token }); 474 } 475 } 476 return specs; 477} 478exports.parseFieldSpecs = parseFieldSpecs; 479function compareByFieldSpecs(obj1, obj2, fieldSpecs, obj1fallback, obj2fallback) { 480 var i; 481 var cmp; 482 for (i = 0; i < fieldSpecs.length; i++) { 483 cmp = compareByFieldSpec(obj1, obj2, fieldSpecs[i], obj1fallback, obj2fallback); 484 if (cmp) { 485 return cmp; 486 } 487 } 488 return 0; 489} 490exports.compareByFieldSpecs = compareByFieldSpecs; 491function compareByFieldSpec(obj1, obj2, fieldSpec, obj1fallback, obj2fallback) { 492 if (fieldSpec.func) { 493 return fieldSpec.func(obj1, obj2); 494 } 495 var val1 = obj1[fieldSpec.field]; 496 var val2 = obj2[fieldSpec.field]; 497 if (val1 == null && obj1fallback) { 498 val1 = obj1fallback[fieldSpec.field]; 499 } 500 if (val2 == null && obj2fallback) { 501 val2 = obj2fallback[fieldSpec.field]; 502 } 503 return flexibleCompare(val1, val2) * (fieldSpec.order || 1); 504} 505exports.compareByFieldSpec = compareByFieldSpec; 506function flexibleCompare(a, b) { 507 if (!a && !b) { 508 return 0; 509 } 510 if (b == null) { 511 return -1; 512 } 513 if (a == null) { 514 return 1; 515 } 516 if ($.type(a) === 'string' || $.type(b) === 'string') { 517 return String(a).localeCompare(String(b)); 518 } 519 return a - b; 520} 521exports.flexibleCompare = flexibleCompare; 522/* Date Utilities 523----------------------------------------------------------------------------------------------------------------------*/ 524exports.dayIDs = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; 525exports.unitsDesc = ['year', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
525 // descending 526// Diffs the two moments into a Duration where full-days are recorded first, then the remaining time. 527// Moments will have their timezones normalized. 528function diffDayTime(a, b) { 529 return moment.duration({ 530 days: a.clone().stripTime().diff(b.clone().stripTime(), 'days'), 531 ms: a.time() - b.time() // time-of-day from day start. disregards timezone 532 }); 533} 534exports.diffDayTime = diffDayTime; 535// Diffs the two moments via their start-of-day (regardless of timezone). Produces whole-day durations. 536function diffDay(a, b) { 537 return moment.duration({ 538 days: a.clone().stripTime().diff(b.clone().stripTime(), 'days') 539 }); 540} 541exports.diffDay = diffDay; 542// Diffs two moments, producing a duration, made of a whole-unit-increment of the given unit. Uses rounding. 543function diffByUnit(a, b, unit) { 544 return moment.duration(Math.round(a.diff(b, unit, true)), // returnFloat=true 545 unit); 546} 547exports.diffByUnit = diffByUnit; 548// Computes the unit name of the largest whole-unit period of time. 549// For example, 48 hours will be "days" whereas 49 hours will be "hours". 550// Accepts start/end, a range object, or an original duration object. 551function computeGreatestUnit(start, end) { 552 var i; 553 var unit; 554 var val; 555 for (i = 0; i < exports.unitsDesc.length; i++) { 556 unit = exports.unitsDesc[i]; 557 val = computeRangeAs(unit, start, end); 558 if (val >= 1 && isInt(val)) { 559 break; 560 } 561 } 562 return unit; // will be "milliseconds" if nothing else matches 563} 564exports.computeGreatestUnit = computeGreatestUnit; 565// like computeGreatestUnit, but has special abilities to interpret the source input for clues 566function computeDurationGreatestUnit(duration, durationInput) { 567 var unit = computeGreatestUnit(duration); 568 // prevent days:7 from being interpreted as a week 569 if (unit === 'week' && typeof durationInput === 'object' && durationInput.days) { 570 unit = 'day'; 571 } 572 return unit; 573} 574exports.computeDurationGreatestUnit = computeDurationGreatestUnit; 575// Computes the number of units (like "hours") in the given range. 576// Range can be a {start,end} object, separate start/end args, or a Duration. 577// Results are based on Moment's .as() and .diff() methods, so results can depend on internal handling 578// of month-diffing logic (which tends to vary from version to version). 579function computeRangeAs(unit, start, end) { 580 if (end != null) { 581 return end.diff(start, unit, true); 582 } 583 else if (moment.isDuration(start)) { 584 return start.as(unit); 585 } 586 else { 587 return start.end.diff(start.start, unit, true); 588 } 589} 590// Intelligently divides a range (specified by a start/end params) by a duration 591function divideRangeByDuration(start, end, dur) { 592 var months; 593 if (durationHasTime(dur)) { 594 return (end - start) / dur; 595 } 596 months = dur.asMonths(); 597 if (Math.abs(months) >= 1 && isInt(months)) { 598 return end.diff(start, 'months', true) / months; 599 } 600 return end.diff(start, 'days', true) / dur.asDays(); 601} 602exports.divideRangeByDuration = divideRangeByDuration; 603// Intelligently divides one duration by another 604function divideDurationByDuration(dur1, dur2) { 605 var months1; 606 var months2; 607 if (durationHasTime(dur1) || durationHasTime(dur2)) { 608 return dur1 / dur2; 609 } 610 months1 = dur1.asMonths(); 611 months2 = dur2.asMonths(); 612 if (Math.abs(months1) >= 1 && isInt(months1) && 613 Math.abs(months2) >= 1 && isInt(months2)) { 614 return months1 / months2; 615 } 616 return dur1.asDays() / dur2.asDays(); 617} 618exports.divideDurationByDuration = divideDurationByDuration; 619// Intelligently multiplies a duration by a number 620function multiplyDuration(dur, n) { 621 var months; 622 if (durationHasTime(dur)) { 623 return moment.duration(dur * n); 624 } 625 months = dur.asMonths(); 626 if (Math.abs(months) >= 1 && isInt(months)) { 627 return moment.duration({ months: months * n }); 628 } 629 return moment.duration({ days: dur.asDays() * n }); 630} 631exports.multiplyDuration = multiplyDuration; 632// Returns a boolean about whether the given duration has any time parts (hours/minutes/seconds/ms) 633function durationHasTime(dur) { 634 return Boolean(dur.hours() || dur.minutes() || dur.seconds() || dur.milliseconds()); 635} 636exports.durationHasTime = durationHasTime; 637function isNativeDate(input) { 638 return Object.prototype.toString.call(input) === '[object Date]' || input instanceof Date; 639} 640exports.isNativeDate = isNativeDate; 641// Returns a boolean about whether the given input is a time string, like "06:40:00" or "06:00"
642function isTimeString(str) { 643 return typeof str === 'string' && 644 /^\d+\:\d+(?:\:\d+\.?(?:\d{3})?)?$/.test(str); 645} 646exports.isTimeString = isTimeString; 647/* Logging and Debug 648----------------------------------------------------------------------------------------------------------------------*/ 649function log() { 650 var args = []; 651 for (var _i = 0; _i < arguments.length; _i++) { 652 args[_i] = arguments[_i]; 653 } 654 var console = window.console; 655 if (console && console.log) { 656 return console.log.apply(console, args); 657 } 658} 659exports.log = log; 660function warn() { 661 var args = []; 662 for (var _i = 0; _i < arguments.length; _i++) { 663 args[_i] = arguments[_i]; 664 } 665 var console = window.console; 666 if (console && console.warn) { 667 return console.warn.apply(console, args); 668 } 669 else { 670 return log.apply(null, args); 671 } 672} 673exports.warn = warn; 674/* General Utilities 675----------------------------------------------------------------------------------------------------------------------*/ 676var hasOwnPropMethod = {}.hasOwnProperty; 677// Merges an array of objects into a single object. 678// The second argument allows for an array of property names who's object values will be merged together. 679function mergeProps(propObjs, complexProps) { 680 var dest = {}; 681 var i; 682 var name; 683 var complexObjs; 684 var j; 685 var val; 686 var props; 687 if (complexProps) { 688 for (i = 0; i < complexProps.length; i++) { 689 name = complexProps[i]; 690 complexObjs = []; 691 // collect the trailing object values, stopping when a non-object is discovered 692 for (j = propObjs.length - 1; j >= 0; j--) { 693 val = propObjs[j][name]; 694 if (typeof val === 'object') { 695 complexObjs.unshift(val); 696 } 697 else if (val !== undefined) { 698 dest[name] = val; // if there were no objects, this value will be used 699 break; 700 } 701 } 702 // if the trailing values were objects, use the merged value 703 if (complexObjs.length) { 704 dest[name] = mergeProps(complexObjs); 705 } 706 } 707 } 708 // copy values into the destination, going from last to first 709 for (i = propObjs.length - 1; i >= 0; i--) { 710 props = propObjs[i]; 711 for (name in props) { 712 if (!(name in dest)) { 713 dest[name] = props[name]; 714 } 715 } 716 } 717 return dest; 718} 719exports.mergeProps = mergeProps; 720function copyOwnProps(src, dest) { 721 for (var name_1 in src) { 722 if (hasOwnProp(src, name_1)) { 723 dest[name_1] = src[name_1]; 724 } 725 } 726} 727exports.copyOwnProps = copyOwnProps; 728function hasOwnProp(obj, name) { 729 return hasOwnPropMethod.call(obj, name); 730} 731exports.hasOwnProp = hasOwnProp; 732function applyAll(functions, thisObj, args) { 733 if ($.isFunction(functions)) { 734 functions = [functions]; 735 } 736 if (functions) { 737 var i = void 0; 738 var ret = void 0; 739 for (i = 0; i < functions.length; i++) { 740 ret = functions[i].apply(thisObj, args) || ret; 741 } 742 return ret; 743 } 744} 745exports.applyAll = applyAll; 746function removeMatching(array, testFunc) { 747 var removeCnt = 0; 748 var i = 0; 749 while (i < array.length) { 750 if (testFunc(array[i])) { 751 array.splice(i, 1); 752 removeCnt++; 753 } 754 else { 755 i++; 756 } 757 } 758 return removeCnt; 759} 760exports.removeMatching = removeMatching; 761function removeExact(array, exactVal) { 762 var removeCnt = 0; 763 var i = 0; 764 while (i < array.length) { 765 if (array[i] === exactVal) { 766 array.splice(i, 1); 767 removeCnt++; 768 } 769 else { 770 i++; 771 } 772 } 773 return removeCnt; 774} 775exports.removeExact = removeExact; 776function isArraysEqual(a0, a1) { 777 var len = a0.length; 778 var i; 779 if (len == null || len !== a1.length) { 780 return false; 781 } 782 for (i = 0; i < len; i++) { 783 if (a0[i] !== a1[i]) { 784 return false; 785 } 786 } 787 return true; 788} 789exports.isArraysEqual = isArraysEqual; 790function firstDefined() { 791 var args = []; 792 for (var _i = 0; _i < arguments.length; _i++) { 793 args[_i] = arguments[_i]; 794 } 795 for (var i = 0; i < args.length; i++) { 796 if (args[i] !== undefined) { 797 return args[i];
798 } 799 } 800} 801exports.firstDefined = firstDefined; 802function htmlEscape(s) { 803 return (s + '').replace(/&/g, '&') 804 .replace(/</g, '<') 805 .replace(/>/g, '>') 806 .replace(/'/g, ''') 807 .replace(/"/g, '"') 808 .replace(/\n/g, '<br />'); 809} 810exports.htmlEscape = htmlEscape; 811function stripHtmlEntities(text) { 812 return text.replace(/&.*?;/g, ''); 813} 814exports.stripHtmlEntities = stripHtmlEntities; 815// Given a hash of CSS properties, returns a string of CSS. 816// Uses property names as-is (no camel-case conversion). Will not make statements for null/undefined values. 817function cssToStr(cssProps) { 818 var statements = []; 819 $.each(cssProps, function (name, val) { 820 if (val != null) { 821 statements.push(name + ':' + val); 822 } 823 }); 824 return statements.join(';'); 825} 826exports.cssToStr = cssToStr; 827// Given an object hash of HTML attribute names to values, 828// generates a string that can be injected between < > in HTML 829function attrsToStr(attrs) { 830 var parts = []; 831 $.each(attrs, function (name, val) { 832 if (val != null) { 833 parts.push(name + '="' + htmlEscape(val) + '"'); 834 } 835 }); 836 return parts.join(' '); 837} 838exports.attrsToStr = attrsToStr; 839function capitaliseFirstLetter(str) { 840 return str.charAt(0).toUpperCase() + str.slice(1); 841} 842exports.capitaliseFirstLetter = capitaliseFirstLetter; 843function compareNumbers(a, b) { 844 return a - b; 845} 846exports.compareNumbers = compareNumbers; 847function isInt(n) { 848 return n % 1 === 0; 849} 850exports.isInt = isInt; 851// Returns a method bound to the given object context. 852// Just like one of the jQuery.proxy signatures, but without the undesired behavior of treating the same method with 853// different contexts as identical when binding/unbinding events. 854function proxy(obj, methodName) { 855 var method = obj[methodName]; 856 return function () { 857 return method.apply(obj, arguments); 858 }; 859} 860exports.proxy = proxy; 861// Returns a function, that, as long as it continues to be invoked, will not 862// be triggered. The function will be called after it stops being called for 863// N milliseconds. If `immediate` is passed, trigger the function on the 864// leading edge, instead of the trailing. 865// https://github.com/jashkenas/underscore/blob/1.6.0/underscore.js#L714 866function debounce(func, wait, immediate) { 867 if (immediate === void 0) { immediate = false; } 868 var timeout; 869 var args; 870 var context; 871 var timestamp; 872 var result; 873 var later = function () { 874 var last = +new Date() - timestamp; 875 if (last < wait) { 876 timeout = setTimeout(later, wait - last); 877 } 878 else { 879 timeout = null; 880 if (!immediate) { 881 result = func.apply(context, args); 882 context = args = null; 883 } 884 } 885 }; 886 return function () { 887 context = this; 888 args = arguments; 889 timestamp = +new Date(); 890 var callNow = immediate && !timeout; 891 if (!timeout) { 892 timeout = setTimeout(later, wait); 893 } 894 if (callNow) { 895 result = func.apply(context, args); 896 context = args = null; 897 } 898 return result; 899 }; 900} 901exports.debounce = debounce; 902 903 904/***/ }), 905/* 5 */ 906/***/ (function(module, exports, __webpack_require__) { 907 908Object.defineProperty(exports, "__esModule", { value: true }); 909var moment = __webpack_require__(0); 910var moment_ext_1 = __webpack_require__(10); 911var UnzonedRange = /** @class */ (function () { 912 function UnzonedRange(startInput, endInput) { 913 // TODO: move these into footprint. 914 // Especially, doesn't make sense for null startMs/endMs. 915 this.isStart = true; 916 this.isEnd = true; 917 if (moment.isMoment(startInput)) { 918 startInput = startInput.clone().stripZone(); 919 } 920 if (moment.isMoment(endInput)) { 921 endInput = endInput.clone().stripZone(); 922 } 923 if (startInput) { 924 this.startMs = startInput.valueOf(); 925 } 926 if (endInput) { 927 this.endMs = endInput.valueOf(); 928 } 929 } 930 /* 931 SIDEEFFECT: will mutate eventRanges. 932 Will return a new array result.
933 Only works for non-open-ended ranges. 934 */ 935 UnzonedRange.invertRanges = function (ranges, constraintRange) { 936 var invertedRanges = []; 937 var startMs = constraintRange.startMs; // the end of the previous range. the start of the new range 938 var i; 939 var dateRange; 940 // ranges need to be in order. required for our date-walking algorithm 941 ranges.sort(compareUnzonedRanges); 942 for (i = 0; i < ranges.length; i++) { 943 dateRange = ranges[i]; 944 // add the span of time before the event (if there is any) 945 if (dateRange.startMs > startMs) { 946 invertedRanges.push(new UnzonedRange(startMs, dateRange.startMs)); 947 } 948 if (dateRange.endMs > startMs) { 949 startMs = dateRange.endMs; 950 } 951 } 952 // add the span of time after the last event (if there is any) 953 if (startMs < constraintRange.endMs) { 954 invertedRanges.push(new UnzonedRange(startMs, constraintRange.endMs)); 955 } 956 return invertedRanges; 957 }; 958 UnzonedRange.prototype.intersect = function (otherRange) { 959 var startMs = this.startMs; 960 var endMs = this.endMs; 961 var newRange = null; 962 if (otherRange.startMs != null) { 963 if (startMs == null) { 964 startMs = otherRange.startMs; 965 } 966 else { 967 startMs = Math.max(startMs, otherRange.startMs); 968 } 969 } 970 if (otherRange.endMs != null) { 971 if (endMs == null) { 972 endMs = otherRange.endMs; 973 } 974 else { 975 endMs = Math.min(endMs, otherRange.endMs); 976 } 977 } 978 if (startMs == null || endMs == null || startMs < endMs) { 979 newRange = new UnzonedRange(startMs, endMs); 980 newRange.isStart = this.isStart && startMs === this.startMs; 981 newRange.isEnd = this.isEnd && endMs === this.endMs; 982 } 983 return newRange; 984 }; 985 UnzonedRange.prototype.intersectsWith = function (otherRange) { 986 return (this.endMs == null || otherRange.startMs == null || this.endMs > otherRange.startMs) && 987 (this.startMs == null || otherRange.endMs == null || this.startMs < otherRange.endMs); 988 }; 989 UnzonedRange.prototype.containsRange = function (innerRange) { 990 return (this.startMs == null || (innerRange.startMs != null && innerRange.startMs >= this.startMs)) && 991 (this.endMs == null || (innerRange.endMs != null && innerRange.endMs <= this.endMs)); 992 }; 993 // `date` can be a moment, a Date, or a millisecond time. 994 UnzonedRange.prototype.containsDate = function (date) { 995 var ms = date.valueOf(); 996 return (this.startMs == null || ms >= this.startMs) && 997 (this.endMs == null || ms < this.endMs); 998 }; 999 // If the given date is not within the given range, move it inside. 1000 // (If it's past the end, make it one millisecond before the end). 1001 // `date` can be a moment, a Date, or a millisecond time. 1002 // Returns a MS-time. 1003 UnzonedRange.prototype.constrainDate = function (date) { 1004 var ms = date.valueOf(); 1005 if (this.startMs != null && ms < this.startMs) { 1006 ms = this.startMs; 1007 } 1008 if (this.endMs != null && ms >= this.endMs) { 1009 ms = this.endMs - 1; 1010 } 1011 return ms; 1012 }; 1013 UnzonedRange.prototype.equals = function (otherRange) { 1014 return this.startMs === otherRange.startMs && this.endMs === otherRange.endMs; 1015 }; 1016 UnzonedRange.prototype.clone = function () { 1017 var range = new UnzonedRange(this.startMs, this.endMs); 1018 range.isStart = this.isStart; 1019 range.isEnd = this.isEnd; 1020 return range; 1021 }; 1022 // Returns an ambig-zoned moment from startMs. 1023 // BEWARE: returned moment is not localized. 1024 // Formatting and start-of-week will be default. 1025 UnzonedRange.prototype.getStart = function () { 1026 if (this.startMs != null) { 1027 return moment_ext_1.default.utc(this.startMs).stripZone(); 1028 } 1029 return null; 1030 }; 1031 // Returns an ambig-zoned moment from startMs. 1032 // BEWARE: returned moment is not localized. 1033 // Formatting and start-of-week will be default. 1034 UnzonedRange.prototype.getEnd = function () { 1035 if (this.endMs != null) { 1036 return moment_ext_1.default.utc(this.endMs).stripZone(); 1037 } 1038 return null; 1039 }; 1040 UnzonedRange.prototype.as = function (unit) { 1041 return moment.utc(this.endMs).diff(moment.utc(this.startMs), unit, true); 1042 }; 1043 return UnzonedRange; 1044}()); 1045exports.default = UnzonedRange; 1046/* 1047Only works for non-open-ended ranges. 1048*/ 1049function compareUnzonedRanges(range1, range2) { 1050 return range1.startMs - range2.startMs; // earlier ranges go first 1051} 1052 1053 1054/***/ }), 1055/* 6 */ 1056/***/ (function(module, exports, __webpack_require__) { 1057 1058Object.defineProperty(exports, "__esModule", { value: true });
1059var tslib_1 = __webpack_require__(2); 1060var $ = __webpack_require__(3); 1061var ParsableModelMixin_1 = __webpack_require__(208); 1062var Class_1 = __webpack_require__(33); 1063var EventDefParser_1 = __webpack_require__(49); 1064var EventSource = /** @class */ (function (_super) { 1065 tslib_1.__extends(EventSource, _super); 1066 // can we do away with calendar? at least for the abstract? 1067 // useful for buildEventDef 1068 function EventSource(calendar) { 1069 var _this = _super.call(this) || this; 1070 _this.calendar = calendar; 1071 _this.className = []; 1072 _this.uid = String(EventSource.uuid++); 1073 return _this; 1074 } 1075 /* 1076 rawInput can be any data type! 1077 */ 1078 EventSource.parse = function (rawInput, calendar) { 1079 var source = new this(calendar); 1080 if (typeof rawInput === 'object') { 1081 if (source.applyProps(rawInput)) { 1082 return source; 1083 } 1084 } 1085 return false; 1086 }; 1087 EventSource.normalizeId = function (id) { 1088 if (id) { 1089 return String(id); 1090 } 1091 return null; 1092 }; 1093 EventSource.prototype.fetch = function (start, end, timezone) { 1094 // subclasses must implement. must return a promise. 1095 }; 1096 EventSource.prototype.removeEventDefsById = function (eventDefId) { 1097 // optional for subclasses to implement 1098 }; 1099 EventSource.prototype.removeAllEventDefs = function () { 1100 // optional for subclasses to implement 1101 }; 1102 /* 1103 For compairing/matching 1104 */ 1105 EventSource.prototype.getPrimitive = function (otherSource) { 1106 // subclasses must implement 1107 }; 1108 EventSource.prototype.parseEventDefs = function (rawEventDefs) { 1109 var i; 1110 var eventDef; 1111 var eventDefs = []; 1112 for (i = 0; i < rawEventDefs.length; i++) { 1113 eventDef = this.parseEventDef(rawEventDefs[i]); 1114 if (eventDef) { 1115 eventDefs.push(eventDef); 1116 } 1117 } 1118 return eventDefs; 1119 }; 1120 EventSource.prototype.parseEventDef = function (rawInput) { 1121 var calendarTransform = this.calendar.opt('eventDataTransform'); 1122 var sourceTransform = this.eventDataTransform; 1123 if (calendarTransform) { 1124 rawInput = calendarTransform(rawInput, this.calendar); 1125 } 1126 if (sourceTransform) { 1127 rawInput = sourceTransform(rawInput, this.calendar); 1128 } 1129 return EventDefParser_1.default.parse(rawInput, this); 1130 }; 1131 EventSource.prototype.applyManualStandardProps = function (rawProps) { 1132 if (rawProps.id != null) { 1133 this.id = EventSource.normalizeId(rawProps.id); 1134 } 1135 // TODO: converge with EventDef 1136 if ($.isArray(rawProps.className)) { 1137 this.className = rawProps.className; 1138 } 1139 else if (typeof rawProps.className === 'string') { 1140 this.className = rawProps.className.split(/\s+/); 1141 } 1142 return true; 1143 }; 1144 EventSource.uuid = 0; 1145 EventSource.defineStandardProps = ParsableModelMixin_1.default.defineStandardProps; 1146 EventSource.copyVerbatimStandardProps = ParsableModelMixin_1.default.copyVerbatimStandardProps; 1147 return EventSource; 1148}(Class_1.default)); 1149exports.default = EventSource; 1150ParsableModelMixin_1.default.mixInto(EventSource); 1151// Parsing 1152// --------------------------------------------------------------------------------------------------------------------- 1153EventSource.defineStandardProps({ 1154 // manually process... 1155 id: false, 1156 className: false, 1157 // automatically transfer... 1158 color: true, 1159 backgroundColor: true, 1160 borderColor: true, 1161 textColor: true, 1162 editable: true, 1163 startEditable: true, 1164 durationEditable: true, 1165 rendering: true, 1166 overlap: true, 1167 constraint: true, 1168 allDayDefault: true, 1169 eventDataTransform: true 1170}); 1171 1172 1173/***/ }), 1174/* 7 */ 1175/***/ (function(module, exports, __webpack_require__) { 1176 1177/* 1178Utility methods for easily listening to events on another object, 1179and more importantly, easily unlistening from them. 1180 1181USAGE: 1182 import { default as ListenerMixin, ListenerInterface } from './ListenerMixin' 1183in class: 1184 listenTo: ListenerInterface['listenTo'] 1185 stopListeningTo: ListenerInterface['stopListeningTo'] 1186after class: 1187 ListenerMixin.mixInto(TheClass) 1188*/ 1189Object.defineProperty(exports, "__esModule", { value: true });
1190var tslib_1 = __webpack_require__(2); 1191var $ = __webpack_require__(3); 1192var Mixin_1 = __webpack_require__(14); 1193var guid = 0; 1194var ListenerMixin = /** @class */ (function (_super) { 1195 tslib_1.__extends(ListenerMixin, _super); 1196 function ListenerMixin() { 1197 return _super !== null && _super.apply(this, arguments) || this; 1198 } 1199 /* 1200 Given an `other` object that has on/off methods, bind the given `callback` to an event by the given name. 1201 The `callback` will be called with the `this` context of the object that .listenTo is being called on. 1202 Can be called: 1203 .listenTo(other, eventName, callback) 1204 OR 1205 .listenTo(other, { 1206 eventName1: callback1, 1207 eventName2: callback2 1208 }) 1209 */ 1210 ListenerMixin.prototype.listenTo = function (other, arg, callback) { 1211 if (typeof arg === 'object') { 1212 for (var eventName in arg) { 1213 if (arg.hasOwnProperty(eventName)) { 1214 this.listenTo(other, eventName, arg[eventName]); 1215 } 1216 } 1217 } 1218 else if (typeof arg === 'string') { 1219 other.on(arg + '.' + this.getListenerNamespace(), // use event namespacing to identify this object 1220 $.proxy(callback, this) // always use `this` context 1221 // the usually-undesired jQuery guid behavior doesn't matter, 1222 // because we always unbind via namespace 1223 ); 1224 } 1225 }; 1226 /* 1227 Causes the current object to stop listening to events on the `other` object. 1228 `eventName` is optional. If omitted, will stop listening to ALL events on `other`. 1229 */ 1230 ListenerMixin.prototype.stopListeningTo = function (other, eventName) { 1231 other.off((eventName || '') + '.' + this.getListenerNamespace()); 1232 }; 1233 /* 1234 Returns a string, unique to this object, to be used for event namespacing 1235 */ 1236 ListenerMixin.prototype.getListenerNamespace = function () { 1237 if (this.listenerId == null) { 1238 this.listenerId = guid++; 1239 } 1240 return '_listener' + this.listenerId; 1241 }; 1242 return ListenerMixin; 1243}(Mixin_1.default)); 1244exports.default = ListenerMixin; 1245 1246 1247/***/ }), 1248/* 8 */, 1249/* 9 */, 1250/* 10 */ 1251/***/ (function(module, exports, __webpack_require__) { 1252 1253Object.defineProperty(exports, "__esModule", { value: true }); 1254var moment = __webpack_require__(0); 1255var $ = __webpack_require__(3); 1256var util_1 = __webpack_require__(4); 1257var ambigDateOfMonthRegex = /^\s*\d{4}-\d\d$/; 1258var ambigTimeOrZoneRegex = /^\s*\d{4}-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?)?$/; 1259var newMomentProto = moment.fn; // where we will attach our new methods 1260exports.newMomentProto = newMomentProto; 1261var oldMomentProto = $.extend({}, newMomentProto); // copy of original moment methods 1262exports.oldMomentProto = oldMomentProto; 1263// tell momentjs to transfer these properties upon clone 1264var momentProperties = moment.momentProperties; 1265momentProperties.push('_fullCalendar'); 1266momentProperties.push('_ambigTime'); 1267momentProperties.push('_ambigZone'); 1268/* 1269Call this if you want Moment's original format method to be used 1270*/ 1271function oldMomentFormat(mom, formatStr) { 1272 return oldMomentProto.format.call(mom, formatStr); // oldMomentProto defined in moment-ext.js 1273} 1274exports.oldMomentFormat = oldMomentFormat; 1275// Creating 1276// ------------------------------------------------------------------------------------------------- 1277// Creates a new moment, similar to the vanilla moment(...) constructor, but with 1278// extra features (ambiguous time, enhanced formatting). When given an existing moment, 1279// it will function as a clone (and retain the zone of the moment). Anything else will 1280// result in a moment in the local zone. 1281var momentExt = function () { 1282 return makeMoment(arguments); 1283}; 1284exports.default = momentExt; 1285// Sames as momentExt, but forces the resulting moment to be in the UTC timezone. 1286momentExt.utc = function () { 1287 var mom = makeMoment(arguments, true); 1288 // Force it into UTC because makeMoment doesn't guarantee it 1289 // (if given a pre-existing moment for example) 1290 if (mom.hasTime()) { 1291 mom.utc(); 1292 } 1293 return mom; 1294}; 1295// Same as momentExt, but when given an ISO8601 string, the timezone offset is preserved. 1296// ISO8601 strings with no timezone offset will become ambiguously zoned. 1297momentExt.parseZone = function () { 1298 return makeMoment(arguments, true, true); 1299}; 1300// Builds an enhanced moment from args. When given an existing moment, it clones. When given a 1301// native Date, or called with no arguments (the current time), the resulting moment will be local. 1302// Anything else needs to be "parsed" (a string or an array), and will be affected by: 1303// parseAsUTC - if there is no zone information, should we parse the input in UTC?
1304// parseZone - if there is zone information, should we force the zone of the moment? 1305function makeMoment(args, parseAsUTC, parseZone) { 1306 if (parseAsUTC === void 0) { parseAsUTC = false; } 1307 if (parseZone === void 0) { parseZone = false; } 1308 var input = args[0]; 1309 var isSingleString = args.length === 1 && typeof input === 'string'; 1310 var isAmbigTime; 1311 var isAmbigZone; 1312 var ambigMatch; 1313 var mom; 1314 if (moment.isMoment(input) || util_1.isNativeDate(input) || input === undefined) { 1315 mom = moment.apply(null, args); 1316 } 1317 else { 1318 isAmbigTime = false; 1319 isAmbigZone = false; 1320 if (isSingleString) { 1321 if (ambigDateOfMonthRegex.test(input)) { 1322 // accept strings like '2014-05', but convert to the first of the month 1323 input += '-01'; 1324 args = [input]; // for when we pass it on to moment's constructor 1325 isAmbigTime = true; 1326 isAmbigZone = true; 1327 } 1328 else if ((ambigMatch = ambigTimeOrZoneRegex.exec(input))) { 1329 isAmbigTime = !ambigMatch[5]; // no time part? 1330 isAmbigZone = true; 1331 } 1332 } 1333 else if ($.isArray(input)) { 1334 // arrays have no timezone information, so assume ambiguous zone 1335 isAmbigZone = true; 1336 } 1337 // otherwise, probably a string with a format 1338 if (parseAsUTC || isAmbigTime) { 1339 mom = moment.utc.apply(moment, args); 1340 } 1341 else { 1342 mom = moment.apply(null, args); 1343 } 1344 if (isAmbigTime) { 1345 mom._ambigTime = true; 1346 mom._ambigZone = true; // ambiguous time always means ambiguous zone 1347 } 1348 else if (parseZone) { 1349 if (isAmbigZone) { 1350 mom._ambigZone = true; 1351 } 1352 else if (isSingleString) { 1353 mom.utcOffset(input); // if not a valid zone, will assign UTC 1354 } 1355 } 1356 } 1357 mom._fullCalendar = true; // flag for extended functionality 1358 return mom; 1359} 1360// Week Number 1361// ------------------------------------------------------------------------------------------------- 1362// Returns the week number, considering the locale's custom week number calcuation 1363// `weeks` is an alias for `week` 1364newMomentProto.week = newMomentProto.weeks = function (input) { 1365 var weekCalc = this._locale._fullCalendar_weekCalc; 1366 if (input == null && typeof weekCalc === 'function') { 1367 return weekCalc(this); 1368 } 1369 else if (weekCalc === 'ISO') { 1370 return oldMomentProto.isoWeek.apply(this, arguments); // ISO getter/setter 1371 } 1372 return oldMomentProto.week.apply(this, arguments); // local getter/setter 1373}; 1374// Time-of-day 1375// ------------------------------------------------------------------------------------------------- 1376// GETTER 1377// Returns a Duration with the hours/minutes/seconds/ms values of the moment. 1378// If the moment has an ambiguous time, a duration of 00:00 will be returned. 1379// 1380// SETTER 1381// You can supply a Duration, a Moment, or a Duration-like argument. 1382// When setting the time, and the moment has an ambiguous time, it then becomes unambiguous. 1383newMomentProto.time = function (time) { 1384 // Fallback to the original method (if there is one) if this moment wasn't created via FullCalendar. 1385 // `time` is a generic enough method name where this precaution is necessary to avoid collisions w/ other plugins. 1386 if (!this._fullCalendar) { 1387 return oldMomentProto.time.apply(this, arguments); 1388 } 1389 if (time == null) { 1390 return moment.duration({ 1391 hours: this.hours(), 1392 minutes: this.minutes(), 1393 seconds: this.seconds(), 1394 milliseconds: this.milliseconds() 1395 }); 1396 } 1397 else { 1398 this._ambigTime = false; // mark that the moment now has a time 1399 if (!moment.isDuration(time) && !moment.isMoment(time)) { 1400 time = moment.duration(time); 1401 } 1402 // The day value should cause overflow (so 24 hours becomes 00:00:00 of next day). 1403 // Only for Duration times, not Moment times. 1404 var dayHours = 0; 1405 if (moment.isDuration(time)) { 1406 dayHours = Math.floor(time.asDays()) * 24; 1407 } 1408 // We need to set the individual fields. 1409 // Can't use startOf('day') then add duration. In case of DST at start of day. 1410 return this.hours(dayHours + time.hours()) 1411 .minutes(time.minutes()) 1412 .seconds(time.seconds()) 1413 .milliseconds(time.milliseconds()); 1414 } 1415}; 1416// Converts the moment to UTC, stripping out its time-of-day and timezone offset, 1417// but preserving its YMD. A moment with a stripped time will display no time 1418// nor timezone offset when .format() is called. 1419newMomentProto.stripTime = function () { 1420 if (!this._ambigTime) { 1421 this.utc(true); // keepLocalTime=true (for keeping *date* value) 1422 // set time to zero 1423 this.set({ 1424 hours: 0, 1425 minutes: 0, 1426 seconds: 0, 1427 ms: 0 1428 }); 1429 // Mark the time as ambiguous. This needs to happen after the .utc() call, which might call .utcOffset(), 1430 // which clears all ambig flags. 1431 this._ambigTime = true; 1432 this._ambigZone = true; // if ambiguous time, also ambiguous timezone offset 1433 } 1434 return this; // for chaining 1435};
1436// Returns if the moment has a non-ambiguous time (boolean) 1437newMomentProto.hasTime = function () { 1438 return !this._ambigTime; 1439}; 1440// Timezone 1441// ------------------------------------------------------------------------------------------------- 1442// Converts the moment to UTC, stripping out its timezone offset, but preserving its 1443// YMD and time-of-day. A moment with a stripped timezone offset will display no 1444// timezone offset when .format() is called. 1445newMomentProto.stripZone = function () { 1446 var wasAmbigTime; 1447 if (!this._ambigZone) { 1448 wasAmbigTime = this._ambigTime; 1449 this.utc(true); // keepLocalTime=true (for keeping date and time values) 1450 // the above call to .utc()/.utcOffset() unfortunately might clear the ambig flags, so restore 1451 this._ambigTime = wasAmbigTime || false; 1452 // Mark the zone as ambiguous. This needs to happen after the .utc() call, which might call .utcOffset(), 1453 // which clears the ambig flags. 1454 this._ambigZone = true; 1455 } 1456 return this; // for chaining 1457}; 1458// Returns of the moment has a non-ambiguous timezone offset (boolean) 1459newMomentProto.hasZone = function () { 1460 return !this._ambigZone; 1461}; 1462// implicitly marks a zone 1463newMomentProto.local = function (keepLocalTime) { 1464 // for when converting from ambiguously-zoned to local, 1465 // keep the time values when converting from UTC -> local 1466 oldMomentProto.local.call(this, this._ambigZone || keepLocalTime); 1467 // ensure non-ambiguous 1468 // this probably already happened via local() -> utcOffset(), but don't rely on Moment's internals 1469 this._ambigTime = false; 1470 this._ambigZone = false; 1471 return this; // for chaining 1472}; 1473// implicitly marks a zone 1474newMomentProto.utc = function (keepLocalTime) { 1475 oldMomentProto.utc.call(this, keepLocalTime); 1476 // ensure non-ambiguous 1477 // this probably already happened via utc() -> utcOffset(), but don't rely on Moment's internals 1478 this._ambigTime = false; 1479 this._ambigZone = false; 1480 return this; 1481}; 1482// implicitly marks a zone (will probably get called upon .utc() and .local()) 1483newMomentProto.utcOffset = function (tzo) { 1484 if (tzo != null) { 1485 // these assignments needs to happen before the original zone method is called. 1486 // I forget why, something to do with a browser crash. 1487 this._ambigTime = false; 1488 this._ambigZone = false; 1489 } 1490 return oldMomentProto.utcOffset.apply(this, arguments); 1491}; 1492 1493 1494/***/ }), 1495/* 11 */ 1496/***/ (function(module, exports, __webpack_require__) { 1497 1498/* 1499USAGE: 1500 import { default as EmitterMixin, EmitterInterface } from './EmitterMixin' 1501in class: 1502 on: EmitterInterface['on'] 1503 one: EmitterInterface['one'] 1504 off: EmitterInterface['off'] 1505 trigger: EmitterInterface['trigger'] 1506 triggerWith: EmitterInterface['triggerWith'] 1507 hasHandlers: EmitterInterface['hasHandlers'] 1508after class: 1509 EmitterMixin.mixInto(TheClass) 1510*/ 1511Object.defineProperty(exports, "__esModule", { value: true }); 1512var tslib_1 = __webpack_require__(2); 1513var $ = __webpack_require__(3); 1514var Mixin_1 = __webpack_require__(14); 1515var EmitterMixin = /** @class */ (function (_super) { 1516 tslib_1.__extends(EmitterMixin, _super); 1517 function EmitterMixin() { 1518 return _super !== null && _super.apply(this, arguments) || this; 1519 } 1520 // jQuery-ification via $(this) allows a non-DOM object to have 1521 // the same event handling capabilities (including namespaces). 1522 EmitterMixin.prototype.on = function (types, handler) { 1523 $(this).on(types, this._prepareIntercept(handler)); 1524 return this; // for chaining 1525 }; 1526 EmitterMixin.prototype.one = function (types, handler) { 1527 $(this).one(types, this._prepareIntercept(handler)); 1528 return this; // for chaining 1529 }; 1530 EmitterMixin.prototype._prepareIntercept = function (handler) { 1531 // handlers are always called with an "event" object as their first param. 1532 // sneak the `this` context and arguments into the extra parameter object 1533 // and forward them on to the original handler. 1534 var intercept = function (ev, extra) { 1535 return handler.apply(extra.context || this, extra.args || []); 1536 }; 1537 // mimick jQuery's internal "proxy" system (risky, I know) 1538 // causing all functions with the same .guid to appear to be the same. 1539 // https://github.com/jquery/jquery/blob/2.2.4/src/core.js#L448 1540 // this is needed for calling .off with the original non-intercept handler. 1541 if (!handler.guid) { 1542 handler.guid = $.guid++; 1543 } 1544 intercept.guid = handler.guid; 1545 return intercept; 1546 }; 1547 EmitterMixin.prototype.off = function (types, handler) { 1548 $(this).off(types, handler); 1549 return this; // for chaining 1550 }; 1551 EmitterMixin.prototype.trigger = function (types) { 1552 var args = []; 1553 for (var _i = 1; _i < arguments.length; _i++) { 1554 args[_i - 1] = arguments[_i]; 1555 } 1556 // pass in "extra" info to the intercept 1557 $(this).triggerHandler(types, { args: args }); 1558 return this; // for chaining 1559 }; 1560 EmitterMixin.prototype.triggerWith = function (types, context, args
1560) { 1561 // `triggerHandler` is less reliant on the DOM compared to `trigger`. 1562 // pass in "extra" info to the intercept. 1563 $(this).triggerHandler(types, { context: context, args: args }); 1564 return this; // for chaining 1565 }; 1566 EmitterMixin.prototype.hasHandlers = function (type) { 1567 var hash = $._data(this, 'events'); // http://blog.jquery.com/2012/08/09/jquery-1-8-released/ 1568 return hash && hash[type] && hash[type].length > 0; 1569 }; 1570 return EmitterMixin; 1571}(Mixin_1.default)); 1572exports.default = EmitterMixin; 1573 1574 1575/***/ }), 1576/* 12 */ 1577/***/ (function(module, exports) { 1578 1579Object.defineProperty(exports, "__esModule", { value: true }); 1580/* 1581Meant to be immutable 1582*/ 1583var ComponentFootprint = /** @class */ (function () { 1584 function ComponentFootprint(unzonedRange, isAllDay) { 1585 this.isAllDay = false; // component can choose to ignore this 1586 this.unzonedRange = unzonedRange; 1587 this.isAllDay = isAllDay; 1588 } 1589 /* 1590 Only works for non-open-ended ranges. 1591 */ 1592 ComponentFootprint.prototype.toLegacy = function (calendar) { 1593 return { 1594 start: calendar.msToMoment(this.unzonedRange.startMs, this.isAllDay), 1595 end: calendar.msToMoment(this.unzonedRange.endMs, this.isAllDay) 1596 }; 1597 }; 1598 return ComponentFootprint; 1599}()); 1600exports.default = ComponentFootprint; 1601 1602 1603/***/ }), 1604/* 13 */ 1605/***/ (function(module, exports, __webpack_require__) { 1606 1607Object.defineProperty(exports, "__esModule", { value: true }); 1608var tslib_1 = __webpack_require__(2); 1609var EventDef_1 = __webpack_require__(34); 1610var EventInstance_1 = __webpack_require__(209); 1611var EventDateProfile_1 = __webpack_require__(17); 1612var SingleEventDef = /** @class */ (function (_super) { 1613 tslib_1.__extends(SingleEventDef, _super); 1614 function SingleEventDef() { 1615 return _super !== null && _super.apply(this, arguments) || this; 1616 } 1617 /* 1618 Will receive start/end params, but will be ignored. 1619 */ 1620 SingleEventDef.prototype.buildInstances = function () { 1621 return [this.buildInstance()]; 1622 }; 1623 SingleEventDef.prototype.buildInstance = function () { 1624 return new EventInstance_1.default(this, // definition 1625 this.dateProfile); 1626 }; 1627 SingleEventDef.prototype.isAllDay = function () { 1628 return this.dateProfile.isAllDay(); 1629 }; 1630 SingleEventDef.prototype.clone = function () { 1631 var def = _super.prototype.clone.call(this); 1632 def.dateProfile = this.dateProfile; 1633 return def; 1634 }; 1635 SingleEventDef.prototype.rezone = function () { 1636 var calendar = this.source.calendar; 1637 var dateProfile = this.dateProfile; 1638 this.dateProfile = new EventDateProfile_1.default(calendar.moment(dateProfile.start), dateProfile.end ? calendar.moment(dateProfile.end) : null, calendar); 1639 }; 1640 /* 1641 NOTE: if super-method fails, should still attempt to apply 1642 */ 1643 SingleEventDef.prototype.applyManualStandardProps = function (rawProps) { 1644 var superSuccess = _super.prototype.applyManualStandardProps.call(this, rawProps); 1645 var dateProfile = EventDateProfile_1.default.parse(rawProps, this.source); // returns null on failure 1646 if (dateProfile) { 1647 this.dateProfile = dateProfile; 1648 // make sure `date` shows up in the legacy event objects as-is 1649 if (rawProps.date != null) { 1650 this.miscProps.date = rawProps.date; 1651 } 1652 return superSuccess; 1653 } 1654 else { 1655 return false; 1656 } 1657 }; 1658 return SingleEventDef; 1659}(EventDef_1.default)); 1660exports.default = SingleEventDef; 1661// Parsing 1662// --------------------------------------------------------------------------------------------------------------------- 1663SingleEventDef.defineStandardProps({ 1664 start: false, 1665 date: false, 1666 end: false, 1667 allDay: false 1668}); 1669 1670 1671/***/ }), 1672/* 14 */ 1673/***/ (function(module, exports) { 1674 1675Object.defineProperty(exports, "__esModule", { value: true }); 1676var Mixin = /** @class */ (function () { 1677 function Mixin() { 1678 } 1679 Mixin.mixInto = function (destClass) { 1680 var _this = this; 1681 Object.getOwnPropertyNames(this.prototype).forEach(function (name) { 1682 if (!destClass.prototype[name]) { 1683 destClass.prototype[name] = _this.prototype[name]; 1684 } 1685 }); 1686 }; 1687 /* 1688 will override existing methods 1689 TODO: remove! not used anymore 1690 */ 1691 Mixin.mixOver = function (destClass) { 1692 var _this = this; 1693 Object.getOwnPropertyNames(this.prototype).forEach(function (name) { 1694 destClass.prototype[name] = _this.prototype[name]; 1695 }); 1696 }; 1697 return Mixin; 1698}()); 1699exports.default = Mixin; 1700 1701 1702/***/ }), 1703/* 15 */
1704/***/ (function(module, exports) { 1705 1706Object.defineProperty(exports, "__esModule", { value: true }); 1707var Interaction = /** @class */ (function () { 1708 function Interaction(component) { 1709 this.view = component._getView(); 1710 this.component = component; 1711 } 1712 Interaction.prototype.opt = function (name) { 1713 return this.view.opt(name); 1714 }; 1715 Interaction.prototype.end = function () { 1716 // subclasses can implement 1717 }; 1718 return Interaction; 1719}()); 1720exports.default = Interaction; 1721 1722 1723/***/ }), 1724/* 16 */ 1725/***/ (function(module, exports, __webpack_require__) { 1726 1727Object.defineProperty(exports, "__esModule", { value: true }); 1728exports.version = '3.9.0'; 1729// When introducing internal API incompatibilities (where fullcalendar plugins would break), 1730// the minor version of the calendar should be upped (ex: 2.7.2 -> 2.8.0) 1731// and the below integer should be incremented. 1732exports.internalApiVersion = 12; 1733var util_1 = __webpack_require__(4); 1734exports.applyAll = util_1.applyAll; 1735exports.debounce = util_1.debounce; 1736exports.isInt = util_1.isInt; 1737exports.htmlEscape = util_1.htmlEscape; 1738exports.cssToStr = util_1.cssToStr; 1739exports.proxy = util_1.proxy; 1740exports.capitaliseFirstLetter = util_1.capitaliseFirstLetter; 1741exports.getOuterRect = util_1.getOuterRect; 1742exports.getClientRect = util_1.getClientRect; 1743exports.getContentRect = util_1.getContentRect; 1744exports.getScrollbarWidths = util_1.getScrollbarWidths; 1745exports.preventDefault = util_1.preventDefault; 1746exports.parseFieldSpecs = util_1.parseFieldSpecs; 1747exports.compareByFieldSpecs = util_1.compareByFieldSpecs; 1748exports.compareByFieldSpec = util_1.compareByFieldSpec; 1749exports.flexibleCompare = util_1.flexibleCompare; 1750exports.computeGreatestUnit = util_1.computeGreatestUnit; 1751exports.divideRangeByDuration = util_1.divideRangeByDuration; 1752exports.divideDurationByDuration = util_1.divideDurationByDuration; 1753exports.multiplyDuration = util_1.multiplyDuration; 1754exports.durationHasTime = util_1.durationHasTime; 1755exports.log = util_1.log; 1756exports.warn = util_1.warn; 1757exports.removeExact = util_1.removeExact; 1758exports.intersectRects = util_1.intersectRects; 1759var date_formatting_1 = __webpack_require__(47); 1760exports.formatDate = date_formatting_1.formatDate; 1761exports.formatRange = date_formatting_1.formatRange; 1762exports.queryMostGranularFormatUnit = date_formatting_1.queryMostGranularFormatUnit; 1763var locale_1 = __webpack_require__(31); 1764exports.datepickerLocale = locale_1.datepickerLocale; 1765exports.locale = locale_1.locale; 1766var moment_ext_1 = __webpack_require__(10); 1767exports.moment = moment_ext_1.default; 1768var EmitterMixin_1 = __webpack_require__(11); 1769exports.EmitterMixin = EmitterMixin_1.default; 1770var ListenerMixin_1 = __webpack_require__(7); 1771exports.ListenerMixin = ListenerMixin_1.default; 1772var Model_1 = __webpack_require__(48); 1773exports.Model = Model_1.default; 1774var Constraints_1 = __webpack_require__(207); 1775exports.Constraints = Constraints_1.default; 1776var UnzonedRange_1 = __webpack_require__(5); 1777exports.UnzonedRange = UnzonedRange_1.default; 1778var ComponentFootprint_1 = __webpack_require__(12); 1779exports.ComponentFootprint = ComponentFootprint_1.default; 1780var BusinessHourGenerator_1 = __webpack_require__(212); 1781exports.BusinessHourGenerator = BusinessHourGenerator_1.default; 1782var EventDef_1 = __webpack_require__(34); 1783exports.EventDef = EventDef_1.default; 1784var EventDefMutation_1 = __webpack_require__(37); 1785exports.EventDefMutation = EventDefMutation_1.default; 1786var EventSourceParser_1 = __webpack_require__(38); 1787exports.EventSourceParser = EventSourceParser_1.default; 1788var EventSource_1 = __webpack_require__(6); 1789exports.EventSource = EventSource_1.default; 1790var ThemeRegistry_1 = __webpack_require__(51); 1791exports.defineThemeSystem = ThemeRegistry_1.defineThemeSystem; 1792var EventInstanceGroup_1 = __webpack_require__(18); 1793exports.EventInstanceGroup = EventInstanceGroup_1.default; 1794var ArrayEventSource_1 = __webpack_require__(52); 1795exports.ArrayEventSource = ArrayEventSource_1.default; 1796var FuncEventSource_1 = __webpack_require__(215); 1797exports.FuncEventSource = FuncEventSource_1.default; 1798var JsonFeedEventSource_1 = __webpack_require__(216); 1799exports.JsonFeedEventSource = JsonFeedEventSource_1.default; 1800var EventFootprint_1 = __webpack_require__(36); 1801exports.EventFootprint = EventFootprint_1.default; 1802var Class_1 = __webpack_require__(33); 1803exports.Class = Class_1.default; 1804var Mixin_1 = __webpack_require__(14); 1805exports.Mixin = Mixin_1.default;
1806var CoordCache_1 = __webpack_require__(53); 1807exports.CoordCache = CoordCache_1.default; 1808var DragListener_1 = __webpack_require__(54); 1809exports.DragListener = DragListener_1.default; 1810var Promise_1 = __webpack_require__(20); 1811exports.Promise = Promise_1.default; 1812var TaskQueue_1 = __webpack_require__(217); 1813exports.TaskQueue = TaskQueue_1.default; 1814var RenderQueue_1 = __webpack_require__(218); 1815exports.RenderQueue = RenderQueue_1.default; 1816var Scroller_1 = __webpack_require__(39); 1817exports.Scroller = Scroller_1.default; 1818var Theme_1 = __webpack_require__(19); 1819exports.Theme = Theme_1.default; 1820var DateComponent_1 = __webpack_require__(219); 1821exports.DateComponent = DateComponent_1.default; 1822var InteractiveDateComponent_1 = __webpack_require__(40); 1823exports.InteractiveDateComponent = InteractiveDateComponent_1.default; 1824var Calendar_1 = __webpack_require__(220); 1825exports.Calendar = Calendar_1.default; 1826var View_1 = __webpack_require__(41); 1827exports.View = View_1.default; 1828var ViewRegistry_1 = __webpack_require__(22); 1829exports.defineView = ViewRegistry_1.defineView; 1830exports.getViewConfig = ViewRegistry_1.getViewConfig; 1831var DayTableMixin_1 = __webpack_require__(55); 1832exports.DayTableMixin = DayTableMixin_1.default; 1833var BusinessHourRenderer_1 = __webpack_require__(56); 1834exports.BusinessHourRenderer = BusinessHourRenderer_1.default; 1835var EventRenderer_1 = __webpack_require__(42); 1836exports.EventRenderer = EventRenderer_1.default; 1837var FillRenderer_1 = __webpack_require__(57); 1838exports.FillRenderer = FillRenderer_1.default; 1839var HelperRenderer_1 = __webpack_require__(58); 1840exports.HelperRenderer = HelperRenderer_1.default; 1841var ExternalDropping_1 = __webpack_require__(222); 1842exports.ExternalDropping = ExternalDropping_1.default; 1843var EventResizing_1 = __webpack_require__(223); 1844exports.EventResizing = EventResizing_1.default; 1845var EventPointing_1 = __webpack_require__(59); 1846exports.EventPointing = EventPointing_1.default; 1847var EventDragging_1 = __webpack_require__(224); 1848exports.EventDragging = EventDragging_1.default; 1849var DateSelecting_1 = __webpack_require__(225); 1850exports.DateSelecting = DateSelecting_1.default; 1851var StandardInteractionsMixin_1 = __webpack_require__(60); 1852exports.StandardInteractionsMixin = StandardInteractionsMixin_1.default; 1853var AgendaView_1 = __webpack_require__(226); 1854exports.AgendaView = AgendaView_1.default; 1855var TimeGrid_1 = __webpack_require__(227); 1856exports.TimeGrid = TimeGrid_1.default; 1857var DayGrid_1 = __webpack_require__(61); 1858exports.DayGrid = DayGrid_1.default; 1859var BasicView_1 = __webpack_require__(62); 1860exports.BasicView = BasicView_1.default; 1861var MonthView_1 = __webpack_require__(229); 1862exports.MonthView = MonthView_1.default; 1863var ListView_1 = __webpack_require__(230); 1864exports.ListView = ListView_1.default; 1865 1866 1867/***/ }), 1868/* 17 */ 1869/***/ (function(module, exports, __webpack_require__) { 1870 1871Object.defineProperty(exports, "__esModule", { value: true }); 1872var UnzonedRange_1 = __webpack_require__(5); 1873/* 1874Meant to be immutable 1875*/ 1876var EventDateProfile = /** @class */ (function () { 1877 function EventDateProfile(start, end, calendar) { 1878 this.start = start; 1879 this.end = end || null; 1880 this.unzonedRange = this.buildUnzonedRange(calendar); 1881 } 1882 /* 1883 Needs an EventSource object 1884 */ 1885 EventDateProfile.parse = function (rawProps, source) { 1886 var startInput = rawProps.start || rawProps.date; 1887 var endInput = rawProps.end; 1888 if (!startInput) { 1889 return false; 1890 } 1891 var calendar = source.calendar; 1892 var start = calendar.moment(startInput); 1893 var end = endInput ? calendar.moment(endInput) : null; 1894 var forcedAllDay = rawProps.allDay; 1895 var forceEventDuration = calendar.opt('forceEventDuration'); 1896 if (!start.isValid()) { 1897 return false; 1898 } 1899 if (end && (!end.isValid() || !end.isAfter(start))) { 1900 end = null; 1901 } 1902 if (forcedAllDay == null) { 1903 forcedAllDay = source.allDayDefault; 1904 if (forcedAllDay == null) { 1905 forcedAllDay = calendar.opt('allDayDefault'); 1906 } 1907 } 1908 if (forcedAllDay === true) { 1909 start.stripTime(); 1910 if (end) { 1911 end.stripTime(); 1912 } 1913 } 1914 else if (forcedAllDay === false) { 1915 if (!start.hasTime()) { 1916 start.time(0); 1917 } 1918 if (end && !end.hasTime()) { 1919 end.time(0); 1920 } 1921 } 1922 if (!end && forceEventDuration) { 1923 end = calendar.getDefaultEventEnd(!start.hasTime(), start); 1924 } 1925 return new EventDateProfile(start, end, calendar); 1926 }; 1927 EventDateProfile.isStandardProp = function (propName) { 1928 return propName === 'start' || propName === 'date' || propName === 'end' || propName === 'allDay'; 1929 }; 1930 EventDateProfile.prototype.isAllDay = function () { 1931 return !(this.start.hasTime() || (this.end && this.end.hasTime())); 1932 }; 1933 /* 1934 Needs a Calendar object 1935 */ 1936 EventDateProfile.prototype.buildUnzonedRange = function (calendar) { 1937 var startMs = this.start.clone().stripZone().valueOf(); 1938 var endMs = this.getEnd(calendar).stripZone().valueOf(); 1939 return new UnzonedRange_1.default(startMs, endMs); 1940 }; 1941 /* 1942 Needs a Calendar object 1943 */ 1944 EventDateProfile.prototype.getEnd = function (calendar) { 1945 return this.end ? 1946 this.end.clone() : 1947 // derive the end from the start and allDay. compute allDay if necessary 1948 calendar.getDefaultEventEnd(this.isAllDay(), this.start); 1949 }; 1950 return EventDateProfile; 1951}()); 1952exports.default = EventDateProfile; 1953 1954 1955/***/ }), 1956/* 18 */ 1957/***/ (function(module, exports, __webpack_require__) { 1958 1959Object.defineProperty(exports, "__esModule", { value: true });
1960var UnzonedRange_1 = __webpack_require__(5); 1961var util_1 = __webpack_require__(35); 1962var EventRange_1 = __webpack_require__(211); 1963/* 1964It's expected that there will be at least one EventInstance, 1965OR that an explicitEventDef is assigned. 1966*/ 1967var EventInstanceGroup = /** @class */ (function () { 1968 function EventInstanceGroup(eventInstances) { 1969 this.eventInstances = eventInstances || []; 1970 } 1971 EventInstanceGroup.prototype.getAllEventRanges = function (constraintRange) { 1972 if (constraintRange) { 1973 return this.sliceNormalRenderRanges(constraintRange); 1974 } 1975 else { 1976 return this.eventInstances.map(util_1.eventInstanceToEventRange); 1977 } 1978 }; 1979 EventInstanceGroup.prototype.sliceRenderRanges = function (constraintRange) { 1980 if (this.isInverse()) { 1981 return this.sliceInverseRenderRanges(constraintRange); 1982 } 1983 else { 1984 return this.sliceNormalRenderRanges(constraintRange); 1985 } 1986 }; 1987 EventInstanceGroup.prototype.sliceNormalRenderRanges = function (constraintRange) { 1988 var eventInstances = this.eventInstances; 1989 var i; 1990 var eventInstance; 1991 var slicedRange; 1992 var slicedEventRanges = []; 1993 for (i = 0; i < eventInstances.length; i++) { 1994 eventInstance = eventInstances[i]; 1995 slicedRange = eventInstance.dateProfile.unzonedRange.intersect(constraintRange); 1996 if (slicedRange) { 1997 slicedEventRanges.push(new EventRange_1.default(slicedRange, eventInstance.def, eventInstance)); 1998 } 1999 } 2000 return slicedEventRanges; 2001 }; 2002 EventInstanceGroup.prototype.sliceInverseRenderRanges = function (constraintRange) { 2003 var unzonedRanges = this.eventInstances.map(util_1.eventInstanceToUnzonedRange); 2004 var ownerDef = this.getEventDef(); 2005 unzonedRanges = UnzonedRange_1.default.invertRanges(unzonedRanges, constraintRange); 2006 return unzonedRanges.map(function (unzonedRange) { 2007 return new EventRange_1.default(unzonedRange, ownerDef); // don't give an EventInstance 2008 }); 2009 }; 2010 EventInstanceGroup.prototype.isInverse = function () { 2011 return this.getEventDef().hasInverseRendering(); 2012 }; 2013 EventInstanceGroup.prototype.getEventDef = function () { 2014 return this.explicitEventDef || this.eventInstances[0].def; 2015 }; 2016 return EventInstanceGroup; 2017}()); 2018exports.default = EventInstanceGroup; 2019 2020 2021/***/ }), 2022/* 19 */ 2023/***/ (function(module, exports, __webpack_require__) { 2024 2025Object.defineProperty(exports, "__esModule", { value: true }); 2026var $ = __webpack_require__(3); 2027var Theme = /** @class */ (function () { 2028 function Theme(optionsManager) { 2029 this.optionsManager = optionsManager; 2030 this.processIconOverride(); 2031 } 2032 Theme.prototype.processIconOverride = function () { 2033 if (this.iconOverrideOption) { 2034 this.setIconOverride(this.optionsManager.get(this.iconOverrideOption)); 2035 } 2036 }; 2037 Theme.prototype.setIconOverride = function (iconOverrideHash) { 2038 var iconClassesCopy; 2039 var buttonName; 2040 if ($.isPlainObject(iconOverrideHash)) { 2041 iconClassesCopy = $.extend({}, this.iconClasses); 2042 for (buttonName in iconOverrideHash) { 2043 iconClassesCopy[buttonName] = this.applyIconOverridePrefix(iconOverrideHash[buttonName]); 2044 } 2045 this.iconClasses = iconClassesCopy; 2046 } 2047 else if (iconOverrideHash === false) { 2048 this.iconClasses = {}; 2049 } 2050 }; 2051 Theme.prototype.applyIconOverridePrefix = function (className) { 2052 var prefix = this.iconOverridePrefix; 2053 if (prefix && className.indexOf(prefix) !== 0) { 2054 className = prefix + className; 2055 } 2056 return className; 2057 }; 2058 Theme.prototype.getClass = function (key) { 2059 return this.classes[key] || ''; 2060 }; 2061 Theme.prototype.getIconClass = function (buttonName) { 2062 var className = this.iconClasses[buttonName]; 2063 if (className) { 2064 return this.baseIconClass + ' ' + className; 2065 } 2066 return ''; 2067 }; 2068 Theme.prototype.getCustomButtonIconClass = function (customButtonProps) { 2069 var className; 2070 if (this.iconOverrideCustomButtonOption) { 2071 className = customButtonProps[this.iconOverrideCustomButtonOption]; 2072 if (className) { 2073 return this.baseIconClass + ' ' + this.applyIconOverridePrefix(className); 2074 } 2075 } 2076 return ''; 2077 }; 2078 return Theme; 2079}()); 2080exports.default = Theme; 2081Theme.prototype.classes = {}; 2082Theme.prototype.iconClasses = {}; 2083Theme.prototype.baseIconClass = ''; 2084Theme.prototype.iconOverridePrefix = ''; 2085 2086 2087/***/ }), 2088/* 20 */ 2089/***/ (function(module, exports, __webpack_require__) { 2090 2091Object.defineProperty(exports, "__esModule", { value: true });
2092var $ = __webpack_require__(3); 2093var PromiseStub = { 2094 construct: function (executor) { 2095 var deferred = $.Deferred(); 2096 var promise = deferred.promise(); 2097 if (typeof executor === 'function') { 2098 executor(function (val) { 2099 deferred.resolve(val); 2100 attachImmediatelyResolvingThen(promise, val); 2101 }, function () { 2102 deferred.reject(); 2103 attachImmediatelyRejectingThen(promise); 2104 }); 2105 } 2106 return promise; 2107 }, 2108 resolve: function (val) { 2109 var deferred = $.Deferred().resolve(val); 2110 var promise = deferred.promise(); 2111 attachImmediatelyResolvingThen(promise, val); 2112 return promise; 2113 }, 2114 reject: function () { 2115 var deferred = $.Deferred().reject(); 2116 var promise = deferred.promise(); 2117 attachImmediatelyRejectingThen(promise); 2118 return promise; 2119 } 2120}; 2121exports.default = PromiseStub; 2122function attachImmediatelyResolvingThen(promise, val) { 2123 promise.then = function (onResolve) { 2124 if (typeof onResolve === 'function') { 2125 return PromiseStub.resolve(onResolve(val)); 2126 } 2127 return promise; 2128 }; 2129} 2130function attachImmediatelyRejectingThen(promise) { 2131 promise.then = function (onResolve, onReject) { 2132 if (typeof onReject === 'function') { 2133 onReject(); 2134 } 2135 return promise; 2136 }; 2137} 2138 2139 2140/***/ }), 2141/* 21 */ 2142/***/ (function(module, exports, __webpack_require__) { 2143 2144Object.defineProperty(exports, "__esModule", { value: true }); 2145var $ = __webpack_require__(3); 2146var exportHooks = __webpack_require__(16); 2147var EmitterMixin_1 = __webpack_require__(11); 2148var ListenerMixin_1 = __webpack_require__(7); 2149exportHooks.touchMouseIgnoreWait = 500; 2150var globalEmitter = null; 2151var neededCount = 0; 2152/* 2153Listens to document and window-level user-interaction events, like touch events and mouse events, 2154and fires these events as-is to whoever is observing a GlobalEmitter. 2155Best when used as a singleton via GlobalEmitter.get() 2156 2157Normalizes mouse/touch events. For examples: 2158- ignores the the simulated mouse events that happen after a quick tap: mousemove+mousedown+mouseup+click 2159- compensates for various buggy scenarios where a touchend does not fire 2160*/ 2161var GlobalEmitter = /** @class */ (function () { 2162 function GlobalEmitter() { 2163 this.isTouching = false; 2164 this.mouseIgnoreDepth = 0; 2165 } 2166 // gets the singleton 2167 GlobalEmitter.get = function () { 2168 if (!globalEmitter) { 2169 globalEmitter = new GlobalEmitter(); 2170 globalEmitter.bind(); 2171 } 2172 return globalEmitter; 2173 }; 2174 // called when an object knows it will need a GlobalEmitter in the near future. 2175 GlobalEmitter.needed = function () { 2176 GlobalEmitter.get(); // ensures globalEmitter 2177 neededCount++; 2178 }; 2179 // called when the object that originally called needed() doesn't need a GlobalEmitter anymore. 2180 GlobalEmitter.unneeded = function () { 2181 neededCount--; 2182 if (!neededCount) { 2183 globalEmitter.unbind(); 2184 globalEmitter = null; 2185 } 2186 }; 2187 GlobalEmitter.prototype.bind = function () { 2188 var _this = this; 2189 this.listenTo($(document), { 2190 touchstart: this.handleTouchStart, 2191 touchcancel: this.handleTouchCancel, 2192 touchend: this.handleTouchEnd, 2193 mousedown: this.handleMouseDown, 2194 mousemove: this.handleMouseMove, 2195 mouseup: this.handleMouseUp, 2196 click: this.handleClick, 2197 selectstart: this.handleSelectStart, 2198 contextmenu: this.handleContextMenu 2199 }); 2200 // because we need to call preventDefault 2201 // because https://www.chromestatus.com/features/5093566007214080 2202 // TODO: investigate performance because this is a global handler 2203 window.addEventListener('touchmove', this.handleTouchMoveProxy = function (ev) { 2204 _this.handleTouchMove($.Event(ev)); 2205 }, { passive: false } // allows preventDefault() 2206 ); 2207 // attach a handler to get called when ANY scroll action happens on the page. 2208 // this was impossible to do with normal on/off because 'scroll' doesn't bubble. 2209 // http://stackoverflow.com/a/32954565/96342 2210 window.addEventListener('scroll', this.handleScrollProxy = function (ev) { 2211 _this.handleScroll($.Event(ev)); 2212 }, true // useCapture 2213 ); 2214 }; 2215 GlobalEmitter.prototype.unbind = function () { 2216 this.stopListeningTo($(document)); 2217 window.removeEventListener('touchmove', this.handleTouchMoveProxy); 2218 window.removeEventListener('scroll', this.handleScrollProxy, true // useCapture 2219 ); 2220 }; 2221 // Touch Handlers 2222 // ----------------------------------------------------------------------------------------------------------------- 2223 GlobalEmitter.prototype.handleTouchStart = function (ev) { 2224 // if a previous touch interaction never ended with a touchend, then implicitly end it, 2225 // but since a new touch interaction is about to begin, don't start the mouse ignore period. 2226 this.stopTouch(ev, true);
2226 // skipMouseIgnore=true 2227 this.isTouching = true; 2228 this.trigger('touchstart', ev); 2229 }; 2230 GlobalEmitter.prototype.handleTouchMove = function (ev) { 2231 if (this.isTouching) { 2232 this.trigger('touchmove', ev); 2233 } 2234 }; 2235 GlobalEmitter.prototype.handleTouchCancel = function (ev) { 2236 if (this.isTouching) { 2237 this.trigger('touchcancel', ev); 2238 // Have touchcancel fire an artificial touchend. That way, handlers won't need to listen to both. 2239 // If touchend fires later, it won't have any effect b/c isTouching will be false. 2240 this.stopTouch(ev); 2241 } 2242 }; 2243 GlobalEmitter.prototype.handleTouchEnd = function (ev) { 2244 this.stopTouch(ev); 2245 }; 2246 // Mouse Handlers 2247 // ----------------------------------------------------------------------------------------------------------------- 2248 GlobalEmitter.prototype.handleMouseDown = function (ev) { 2249 if (!this.shouldIgnoreMouse()) { 2250 this.trigger('mousedown', ev); 2251 } 2252 }; 2253 GlobalEmitter.prototype.handleMouseMove = function (ev) { 2254 if (!this.shouldIgnoreMouse()) { 2255 this.trigger('mousemove', ev); 2256 } 2257 }; 2258 GlobalEmitter.prototype.handleMouseUp = function (ev) { 2259 if (!this.shouldIgnoreMouse()) { 2260 this.trigger('mouseup', ev); 2261 } 2262 }; 2263 GlobalEmitter.prototype.handleClick = function (ev) { 2264 if (!this.shouldIgnoreMouse()) { 2265 this.trigger('click', ev); 2266 } 2267 }; 2268 // Misc Handlers 2269 // ----------------------------------------------------------------------------------------------------------------- 2270 GlobalEmitter.prototype.handleSelectStart = function (ev) { 2271 this.trigger('selectstart', ev); 2272 }; 2273 GlobalEmitter.prototype.handleContextMenu = function (ev) { 2274 this.trigger('contextmenu', ev); 2275 }; 2276 GlobalEmitter.prototype.handleScroll = function (ev) { 2277 this.trigger('scroll', ev); 2278 }; 2279 // Utils 2280 // ----------------------------------------------------------------------------------------------------------------- 2281 GlobalEmitter.prototype.stopTouch = function (ev, skipMouseIgnore) { 2282 if (skipMouseIgnore === void 0) { skipMouseIgnore = false; } 2283 if (this.isTouching) { 2284 this.isTouching = false; 2285 this.trigger('touchend', ev); 2286 if (!skipMouseIgnore) { 2287 this.startTouchMouseIgnore(); 2288 } 2289 } 2290 }; 2291 GlobalEmitter.prototype.startTouchMouseIgnore = function () { 2292 var _this = this; 2293 var wait = exportHooks.touchMouseIgnoreWait; 2294 if (wait) { 2295 this.mouseIgnoreDepth++; 2296 setTimeout(function () { 2297 _this.mouseIgnoreDepth--; 2298 }, wait); 2299 } 2300 }; 2301 GlobalEmitter.prototype.shouldIgnoreMouse = function () { 2302 return this.isTouching || Boolean(this.mouseIgnoreDepth); 2303 }; 2304 return GlobalEmitter; 2305}()); 2306exports.default = GlobalEmitter; 2307ListenerMixin_1.default.mixInto(GlobalEmitter); 2308EmitterMixin_1.default.mixInto(GlobalEmitter); 2309 2310 2311/***/ }), 2312/* 22 */ 2313/***/ (function(module, exports, __webpack_require__) { 2314 2315Object.defineProperty(exports, "__esModule", { value: true }); 2316var exportHooks = __webpack_require__(16); 2317exports.viewHash = {}; 2318exportHooks.views = exports.viewHash; 2319function defineView(viewName, viewConfig) { 2320 exports.viewHash[viewName] = viewConfig; 2321} 2322exports.defineView = defineView; 2323function getViewConfig(viewName) { 2324 return exports.viewHash[viewName]; 2325} 2326exports.getViewConfig = getViewConfig; 2327 2328 2329/***/ }), 2330/* 23 */ 2331/***/ (function(module, exports, __webpack_require__) { 2332 2333Object.defineProperty(exports, "__esModule", { value: true }); 2334var tslib_1 = __webpack_require__(2); 2335var util_1 = __webpack_require__(4); 2336var DragListener_1 = __webpack_require__(54); 2337/* Tracks mouse movements over a component and raises events about which hit the mouse is over. 2338------------------------------------------------------------------------------------------------------------------------ 2339options: 2340- subjectEl 2341- subjectCenter 2342*/ 2343var HitDragListener = /** @class */ (function (_super) { 2344 tslib_1.__extends(HitDragListener, _super); 2345 function HitDragListener(component, options) { 2346 var _this = _super.call(this, options) || this; 2347 _this.component = component; 2348 return _this; 2349 } 2350 // Called when drag listening starts (but a real drag has not necessarily began). 2351 // ev might be undefined if dragging was started manually. 2352 HitDragListener.prototype.handleInteractionStart = function (ev) { 2353 var subjectEl = this.subjectEl; 2354 var subjectRect; 2355 var origPoint; 2356 var point; 2357 this.component.hitsNeeded(); 2358 this.computeScrollBounds(); // for autoscroll 2359 if (ev) { 2360 origPoint = { left: util_1.getEvX(ev), top: util_1.getEvY(ev) }; 2361 point = origPoint;
2362 // constrain the point to bounds of the element being dragged 2363 if (subjectEl) { 2364 subjectRect = util_1.getOuterRect(subjectEl); // used for centering as well 2365 point = util_1.constrainPoint(point, subjectRect); 2366 } 2367 this.origHit = this.queryHit(point.left, point.top); 2368 // treat the center of the subject as the collision point? 2369 if (subjectEl && this.options.subjectCenter) { 2370 // only consider the area the subject overlaps the hit. best for large subjects. 2371 // TODO: skip this if hit didn't supply left/right/top/bottom 2372 if (this.origHit) { 2373 subjectRect = util_1.intersectRects(this.origHit, subjectRect) || 2374 subjectRect; // in case there is no intersection 2375 } 2376 point = util_1.getRectCenter(subjectRect); 2377 } 2378 this.coordAdjust = util_1.diffPoints(point, origPoint); // point - origPoint 2379 } 2380 else { 2381 this.origHit = null; 2382 this.coordAdjust = null; 2383 } 2384 // call the super-method. do it after origHit has been computed 2385 _super.prototype.handleInteractionStart.call(this, ev); 2386 }; 2387 // Called when the actual drag has started 2388 HitDragListener.prototype.handleDragStart = function (ev) { 2389 var hit; 2390 _super.prototype.handleDragStart.call(this, ev); 2391 // might be different from this.origHit if the min-distance is large 2392 hit = this.queryHit(util_1.getEvX(ev), util_1.getEvY(ev)); 2393 // report the initial hit the mouse is over 2394 // especially important if no min-distance and drag starts immediately 2395 if (hit) { 2396 this.handleHitOver(hit); 2397 } 2398 }; 2399 // Called when the drag moves 2400 HitDragListener.prototype.handleDrag = function (dx, dy, ev) { 2401 var hit; 2402 _super.prototype.handleDrag.call(this, dx, dy, ev); 2403 hit = this.queryHit(util_1.getEvX(ev), util_1.getEvY(ev)); 2404 if (!isHitsEqual(hit, this.hit)) { 2405 if (this.hit) { 2406 this.handleHitOut(); 2407 } 2408 if (hit) { 2409 this.handleHitOver(hit); 2410 } 2411 } 2412 }; 2413 // Called when dragging has been stopped 2414 HitDragListener.prototype.handleDragEnd = function (ev) { 2415 this.handleHitDone(); 2416 _super.prototype.handleDragEnd.call(this, ev); 2417 }; 2418 // Called when a the mouse has just moved over a new hit 2419 HitDragListener.prototype.handleHitOver = function (hit) { 2420 var isOrig = isHitsEqual(hit, this.origHit); 2421 this.hit = hit; 2422 this.trigger('hitOver', this.hit, isOrig, this.origHit); 2423 }; 2424 // Called when the mouse has just moved out of a hit 2425 HitDragListener.prototype.handleHitOut = function () { 2426 if (this.hit) { 2427 this.trigger('hitOut', this.hit); 2428 this.handleHitDone(); 2429 this.hit = null; 2430 } 2431 }; 2432 // Called after a hitOut. Also called before a dragStop 2433 HitDragListener.prototype.handleHitDone = function () { 2434 if (this.hit) { 2435 this.trigger('hitDone', this.hit); 2436 } 2437 }; 2438 // Called when the interaction ends, whether there was a real drag or not 2439 HitDragListener.prototype.handleInteractionEnd = function (ev, isCancelled) { 2440 _super.prototype.handleInteractionEnd.call(this, ev, isCancelled); 2441 this.origHit = null; 2442 this.hit = null; 2443 this.component.hitsNotNeeded(); 2444 }; 2445 // Called when scrolling has stopped, whether through auto scroll, or the user scrolling 2446 HitDragListener.prototype.handleScrollEnd = function () { 2447 _super.prototype.handleScrollEnd.call(this); 2448 // hits' absolute positions will be in new places after a user's scroll. 2449 // HACK for recomputing. 2450 if (this.isDragging) { 2451 this.component.releaseHits(); 2452 this.component.prepareHits(); 2453 } 2454 }; 2455 // Gets the hit underneath the coordinates for the given mouse event 2456 HitDragListener.prototype.queryHit = function (left, top) { 2457 if (this.coordAdjust) { 2458 left += this.coordAdjust.left; 2459 top += this.coordAdjust.top; 2460 } 2461 return this.component.queryHit(left, top); 2462 }; 2463 return HitDragListener; 2464}(DragListener_1.default)); 2465exports.default = HitDragListener; 2466// Returns `true` if the hits are identically equal. `false` otherwise. Must be from the same component. 2467// Two null values will be considered equal, as two "out of the component" states are the same. 2468function isHitsEqual(hit0, hit1) { 2469 if (!hit0 && !hit1) { 2470 return true; 2471 } 2472 if (hit0 && hit1) { 2473 return hit0.component === hit1.component && 2474 isHitPropsWithin(hit0, hit1) && 2475 isHitPropsWithin(hit1, hit0); // ensures all props are identical 2476 } 2477 return false; 2478} 2479// Returns true if all of subHit's non-standard properties are within superHit 2480function isHitPropsWithin(subHit, superHit) { 2481 for (var propName in subHit) { 2482 if (!/^(component|left|right|top|bottom)$/.test(propName)) { 2483 if (subHit[propName] !== superHit[propName]) { 2484 return false; 2485 } 2486 } 2487 } 2488 return true; 2489} 2490 2491 2492/***/ }), 2493/* 24 */, 2494/* 25 */, 2495/* 26 */, 2496/* 27 */, 2497/* 28 */, 2498/* 29 */, 2499/* 30 */, 2500/* 31 */ 2501/***/ (function(module, exports, __webpack_require__) { 2502 2503Object.defineProperty(exports, "__esModule", { value: true });
2504var $ = __webpack_require__(3); 2505var moment = __webpack_require__(0); 2506var exportHooks = __webpack_require__(16); 2507var options_1 = __webpack_require__(32); 2508var util_1 = __webpack_require__(4); 2509exports.localeOptionHash = {}; 2510exportHooks.locales = exports.localeOptionHash; 2511// NOTE: can't guarantee any of these computations will run because not every locale has datepicker 2512// configs, so make sure there are English fallbacks for these in the defaults file. 2513var dpComputableOptions = { 2514 buttonText: function (dpOptions) { 2515 return { 2516 // the translations sometimes wrongly contain HTML entities 2517 prev: util_1.stripHtmlEntities(dpOptions.prevText), 2518 next: util_1.stripHtmlEntities(dpOptions.nextText), 2519 today: util_1.stripHtmlEntities(dpOptions.currentText) 2520 }; 2521 }, 2522 // Produces format strings like "MMMM YYYY" -> "September 2014" 2523 monthYearFormat: function (dpOptions) { 2524 return dpOptions.showMonthAfterYear ? 2525 'YYYY[' + dpOptions.yearSuffix + '] MMMM' : 2526 'MMMM YYYY[' + dpOptions.yearSuffix + ']'; 2527 } 2528}; 2529var momComputableOptions = { 2530 // Produces format strings like "ddd M/D" -> "Fri 9/15" 2531 dayOfMonthFormat: function (momOptions, fcOptions) { 2532 var format = momOptions.longDateFormat('l'); // for the format like "M/D/YYYY" 2533 // strip the year off the edge, as well as other misc non-whitespace chars 2534 format = format.replace(/^Y+[^\w\s]*|[^\w\s]*Y+$/g, ''); 2535 if (fcOptions.isRTL) { 2536 format += ' ddd'; // for RTL, add day-of-week to end 2537 } 2538 else { 2539 format = 'ddd ' + format; // for LTR, add day-of-week to beginning 2540 } 2541 return format; 2542 }, 2543 // Produces format strings like "h:mma" -> "6:00pm" 2544 mediumTimeFormat: function (momOptions) { 2545 return momOptions.longDateFormat('LT') 2546 .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand 2547 }, 2548 // Produces format strings like "h(:mm)a" -> "6pm" / "6:30pm" 2549 smallTimeFormat: function (momOptions) { 2550 return momOptions.longDateFormat('LT') 2551 .replace(':mm', '(:mm)') 2552 .replace(/(\Wmm)$/, '($1)') // like above, but for foreign locales 2553 .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand 2554 }, 2555 // Produces format strings like "h(:mm)t" -> "6p" / "6:30p" 2556 extraSmallTimeFormat: function (momOptions) { 2557 return momOptions.longDateFormat('LT') 2558 .replace(':mm', '(:mm)') 2559 .replace(/(\Wmm)$/, '($1)') // like above, but for foreign locales 2560 .replace(/\s*a$/i, 't'); // convert to AM/PM/am/pm to lowercase one-letter. remove any spaces beforehand 2561 }, 2562 // Produces format strings like "ha" / "H" -> "6pm" / "18" 2563 hourFormat: function (momOptions) { 2564 return momOptions.longDateFormat('LT') 2565 .replace(':mm', '') 2566 .replace(/(\Wmm)$/, '') // like above, but for foreign locales 2567 .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand 2568 }, 2569 // Produces format strings like "h:mm" -> "6:30" (with no AM/PM) 2570 noMeridiemTimeFormat: function (momOptions) { 2571 return momOptions.longDateFormat('LT') 2572 .replace(/\s*a$/i, ''); // remove trailing AM/PM 2573 } 2574}; 2575// options that should be computed off live calendar options (considers override options) 2576// TODO: best place for this? related to locale? 2577// TODO: flipping text based on isRTL is a bad idea because the CSS `direction` might want to handle it 2578var instanceComputableOptions = { 2579 // Produces format strings for results like "Mo 16" 2580 smallDayDateFormat: function (options) { 2581 return options.isRTL ? 2582 'D dd' : 2583 'dd D'; 2584 }, 2585 // Produces format strings for results like "Wk 5" 2586 weekFormat: function (options) { 2587 return options.isRTL ? 2588 'w[ ' + options.weekNumberTitle + ']' : 2589 '[' + options.weekNumberTitle + ' ]w'; 2590 },
2591 // Produces format strings for results like "Wk5" 2592 smallWeekFormat: function (options) { 2593 return options.isRTL ? 2594 'w[' + options.weekNumberTitle + ']' : 2595 '[' + options.weekNumberTitle + ']w'; 2596 } 2597}; 2598// TODO: make these computable properties in optionsManager 2599function populateInstanceComputableOptions(options) { 2600 $.each(instanceComputableOptions, function (name, func) { 2601 if (options[name] == null) { 2602 options[name] = func(options); 2603 } 2604 }); 2605} 2606exports.populateInstanceComputableOptions = populateInstanceComputableOptions; 2607// Initialize jQuery UI datepicker translations while using some of the translations 2608// Will set this as the default locales for datepicker. 2609function datepickerLocale(localeCode, dpLocaleCode, dpOptions) { 2610 // get the FullCalendar internal option hash for this locale. create if necessary 2611 var fcOptions = exports.localeOptionHash[localeCode] || (exports.localeOptionHash[localeCode] = {}); 2612 // transfer some simple options from datepicker to fc 2613 fcOptions.isRTL = dpOptions.isRTL; 2614 fcOptions.weekNumberTitle = dpOptions.weekHeader; 2615 // compute some more complex options from datepicker 2616 $.each(dpComputableOptions, function (name, func) { 2617 fcOptions[name] = func(dpOptions); 2618 }); 2619 var jqDatePicker = $.datepicker; 2620 // is jQuery UI Datepicker is on the page? 2621 if (jqDatePicker) { 2622 // Register the locale data. 2623 // FullCalendar and MomentJS use locale codes like "pt-br" but Datepicker 2624 // does it like "pt-BR" or if it doesn't have the locale, maybe just "pt". 2625 // Make an alias so the locale can be referenced either way. 2626 jqDatePicker.regional[dpLocaleCode] = 2627 jqDatePicker.regional[localeCode] = // alias 2628 dpOptions; 2629 // Alias 'en' to the default locale data. Do this every time. 2630 jqDatePicker.regional.en = jqDatePicker.regional['']; 2631 // Set as Datepicker's global defaults. 2632 jqDatePicker.setDefaults(dpOptions); 2633 } 2634} 2635exports.datepickerLocale = datepickerLocale; 2636// Sets FullCalendar-specific translations. Will set the locales as the global default. 2637function locale(localeCode, newFcOptions) { 2638 var fcOptions; 2639 var momOptions; 2640 // get the FullCalendar internal option hash for this locale. create if necessary 2641 fcOptions = exports.localeOptionHash[localeCode] || (exports.localeOptionHash[localeCode] = {}); 2642 // provided new options for this locales? merge them in 2643 if (newFcOptions) { 2644 fcOptions = exports.localeOptionHash[localeCode] = options_1.mergeOptions([fcOptions, newFcOptions]); 2645 } 2646 // compute locale options that weren't defined. 2647 // always do this. newFcOptions can be undefined when initializing from i18n file, 2648 // so no way to tell if this is an initialization or a default-setting. 2649 momOptions = getMomentLocaleData(localeCode); // will fall back to en 2650 $.each(momComputableOptions, function (name, func) { 2651 if (fcOptions[name] == null) { 2652 fcOptions[name] = (func)(momOptions, fcOptions); 2653 } 2654 }); 2655 // set it as the default locale for FullCalendar 2656 options_1.globalDefaults.locale = localeCode; 2657} 2658exports.locale = locale; 2659// Returns moment's internal locale data. If doesn't exist, returns English. 2660function getMomentLocaleData(localeCode) { 2661 return moment.localeData(localeCode) || moment.localeData('en'); 2662} 2663exports.getMomentLocaleData = getMomentLocaleData; 2664// Initialize English by forcing computation of moment-derived options. 2665// Also, sets it as the default. 2666locale('en', options_1.englishDefaults); 2667 2668 2669/***/ }), 2670/* 32 */ 2671/***/ (function(module, exports, __webpack_require__) { 2672 2673Object.defineProperty(exports, "__esModule", { value: true }); 2674var util_1 = __webpack_require__(4); 2675exports.globalDefaults = { 2676 titleRangeSeparator: ' \u2013 ', 2677 monthYearFormat: 'MMMM YYYY', 2678 defaultTimedEventDuration: '02:00:00', 2679 defaultAllDayEventDuration: { days: 1 }, 2680 forceEventDuration: false, 2681 nextDayThreshold: '09:00:00', 2682 // display 2683 columnHeader: true, 2684 defaultView: 'month', 2685 aspectRatio: 1.35, 2686 header: { 2687 left: 'title',
2688 center: '', 2689 right: 'today prev,next' 2690 }, 2691 weekends: true, 2692 weekNumbers: false, 2693 weekNumberTitle: 'W', 2694 weekNumberCalculation: 'local', 2695 // editable: false, 2696 // nowIndicator: false, 2697 scrollTime: '06:00:00', 2698 minTime: '00:00:00', 2699 maxTime: '24:00:00', 2700 showNonCurrentDates: true, 2701 // event ajax 2702 lazyFetching: true, 2703 startParam: 'start', 2704 endParam: 'end', 2705 timezoneParam: 'timezone', 2706 timezone: false, 2707 // allDayDefault: undefined, 2708 // locale 2709 locale: null, 2710 isRTL: false, 2711 buttonText: { 2712 prev: 'prev', 2713 next: 'next', 2714 prevYear: 'prev year', 2715 nextYear: 'next year', 2716 year: 'year', 2717 today: 'today', 2718 month: 'month', 2719 week: 'week', 2720 day: 'day' 2721 }, 2722 // buttonIcons: null, 2723 allDayText: 'all-day', 2724 // allows setting a min-height to the event segment to prevent short events overlapping each other 2725 agendaEventMinHeight: 0, 2726 // jquery-ui theming 2727 theme: false, 2728 // themeButtonIcons: null, 2729 // eventResizableFromStart: false, 2730 dragOpacity: .75, 2731 dragRevertDuration: 500, 2732 dragScroll: true, 2733 // selectable: false, 2734 unselectAuto: true, 2735 // selectMinDistance: 0, 2736 dropAccept: '*', 2737 eventOrder: 'title', 2738 // eventRenderWait: null, 2739 eventLimit: false, 2740 eventLimitText: 'more', 2741 eventLimitClick: 'popover', 2742 dayPopoverFormat: 'LL', 2743 handleWindowResize: true, 2744 windowResizeDelay: 100, 2745 longPressDelay: 1000 2746}; 2747exports.englishDefaults = { 2748 dayPopoverFormat: 'dddd, MMMM D' 2749}; 2750exports.rtlDefaults = { 2751 header: { 2752 left: 'next,prev today', 2753 center: '', 2754 right: 'title' 2755 }, 2756 buttonIcons: { 2757 prev: 'right-single-arrow', 2758 next: 'left-single-arrow', 2759 prevYear: 'right-double-arrow', 2760 nextYear: 'left-double-arrow' 2761 }, 2762 themeButtonIcons: { 2763 prev: 'circle-triangle-e', 2764 next: 'circle-triangle-w', 2765 nextYear: 'seek-prev', 2766 prevYear: 'seek-next' 2767 } 2768}; 2769var complexOptions = [ 2770 'header', 2771 'footer', 2772 'buttonText', 2773 'buttonIcons', 2774 'themeButtonIcons' 2775]; 2776// Merges an array of option objects into a single object 2777function mergeOptions(optionObjs) { 2778 return util_1.mergeProps(optionObjs, complexOptions); 2779} 2780exports.mergeOptions = mergeOptions; 2781 2782 2783/***/ }), 2784/* 33 */ 2785/***/ (function(module, exports, __webpack_require__) { 2786 2787Object.defineProperty(exports, "__esModule", { value: true }); 2788var tslib_1 = __webpack_require__(2); 2789var util_1 = __webpack_require__(4); 2790// Class that all other classes will inherit from 2791var Class = /** @class */ (function () { 2792 function Class() { 2793 } 2794 // Called on a class to create a subclass. 2795 // LIMITATION: cannot provide a constructor! 2796 Class.extend = function (members) { 2797 var SubClass = /** @class */ (function (_super) { 2798 tslib_1.__extends(SubClass, _super); 2799 function SubClass() { 2800 return _super !== null && _super.apply(this, arguments) || this; 2801 } 2802 return SubClass; 2803 }(this)); 2804 util_1.copyOwnProps(members, SubClass.prototype); 2805 return SubClass; 2806 }; 2807 // Adds new member variables/methods to the class's prototype. 2808 // Can be called with another class, or a plain object hash containing new members. 2809 Class.mixin = function (members) { 2810 util_1.copyOwnProps(members, this.prototype); 2811 }; 2812 return Class; 2813}()); 2814exports.default = Class; 2815 2816 2817/***/ }), 2818/* 34 */ 2819/***/ (function(module, exports, __webpack_require__) { 2820 2821Object.defineProperty(exports, "__esModule", { value: true }); 2822var $ = __webpack_require__(3); 2823var ParsableModelMixin_1 = __webpack_require__(208); 2824var EventDef = /** @class */ (function () { 2825 function EventDef(source) { 2826 this.source = source; 2827 this.className = []; 2828 this.miscProps = {}; 2829 } 2830 EventDef.parse = function (rawInput, source) { 2831 var def = new this(source); 2832 if (def.applyProps(rawInput)) { 2833 return def; 2834 } 2835 return false; 2836 }; 2837 EventDef.normalizeId = function (id) { 2838 return String(id); 2839 }; 2840 EventDef.generateId = function () { 2841 return '_fc' + (EventDef.uuid++); 2842 }; 2843 EventDef.prototype.clone = function () { 2844 var copy = new this.constructor(this.source); 2845 copy.id = this.id; 2846 copy.rawId = this.rawId; 2847 copy.uid = this.uid; // not really unique anymore :( 2848 EventDef.copyVerbatimStandardProps(this, copy); 2849 copy.className = this.className.slice(); // copy 2850 copy.miscProps = $.extend({}, this.miscProps); 2851 return copy; 2852 }; 2853 EventDef.prototype.hasInverseRendering = function () { 2854 return this.getRendering() === 'inverse-background'; 2855 }; 2856 EventDef.prototype.hasBgRendering = function () { 2857 var rendering = this.getRendering(); 2858 return rendering === 'inverse-background' || rendering === 'background'; 2859 }; 2860 EventDef.prototype.getRendering = function () { 2861 if (this.rendering != null) { 2862 return this.rendering; 2863 } 2864 return this.source.rendering; 2865 }; 2866 EventDef.prototype.getConstraint = function () { 2867 if (this.constraint != null) { 2868 return this.constraint; 2869 } 2870 if (this.source.constraint != null) { 2871 return this.source.constraint; 2872 } 2873 return this.source.calendar.opt('eventConstraint'); // what about View option? 2874 }; 2875 EventDef.prototype.getOverlap = function () { 2876 if (this.overlap != null) { 2877 return this.overlap; 2878 } 2879 if (this.source.overlap != null) { 2880 return this.source.overlap; 2881 } 2882 return this.source.calendar.opt('eventOverlap'); // what about View option? 2883 }; 2884 EventDef.prototype.isStartExplicitlyEditable = function () { 2885 if (this.startEditable != null) { 2886 return this.startEditable; 2887 } 2888 return this.source.startEditable; 2889 }; 2890 EventDef.prototype.isDurationExplicitlyEditable = function () { 2891 if (this.durationEditable != null) { 2892 return this.durationEditable; 2893 } 2894 return this.source.durationEditable; 2895 }; 2896 EventDef.prototype.isExplicitlyEditable = function () { 2897 if (this.editable != null) { 2898 return this.editable; 2899 } 2900 return this.source.editable; 2901 }; 2902 EventDef.prototype.toLegacy = function () { 2903 var obj = $.extend({}, this.miscProps); 2904 obj._id = this.uid; 2905 obj.source = this.source; 2906 obj.className = this.className.slice(); // copy 2907 obj.allDay = this.isAllDay(); 2908 if (this.rawId != null) { 2909 obj.id = this.rawId; 2910 } 2911 EventDef.copyVerbatimStandardProps(this, obj); 2912 return obj;
2913 }; 2914 EventDef.prototype.applyManualStandardProps = function (rawProps) { 2915 if (rawProps.id != null) { 2916 this.id = EventDef.normalizeId((this.rawId = rawProps.id)); 2917 } 2918 else { 2919 this.id = EventDef.generateId(); 2920 } 2921 if (rawProps._id != null) { 2922 this.uid = String(rawProps._id); 2923 } 2924 else { 2925 this.uid = EventDef.generateId(); 2926 } 2927 // TODO: converge with EventSource 2928 if ($.isArray(rawProps.className)) { 2929 this.className = rawProps.className; 2930 } 2931 if (typeof rawProps.className === 'string') { 2932 this.className = rawProps.className.split(/\s+/); 2933 } 2934 return true; 2935 }; 2936 EventDef.prototype.applyMiscProps = function (rawProps) { 2937 $.extend(this.miscProps, rawProps); 2938 }; 2939 EventDef.uuid = 0; 2940 EventDef.defineStandardProps = ParsableModelMixin_1.default.defineStandardProps; 2941 EventDef.copyVerbatimStandardProps = ParsableModelMixin_1.default.copyVerbatimStandardProps; 2942 return EventDef; 2943}()); 2944exports.default = EventDef; 2945ParsableModelMixin_1.default.mixInto(EventDef); 2946EventDef.defineStandardProps({ 2947 // not automatically assigned (`false`) 2948 _id: false, 2949 id: false, 2950 className: false, 2951 source: false, 2952 // automatically assigned (`true`) 2953 title: true, 2954 url: true, 2955 rendering: true, 2956 constraint: true, 2957 overlap: true, 2958 editable: true, 2959 startEditable: true, 2960 durationEditable: true, 2961 color: true, 2962 backgroundColor: true, 2963 borderColor: true, 2964 textColor: true 2965}); 2966 2967 2968/***/ }), 2969/* 35 */ 2970/***/ (function(module, exports, __webpack_require__) { 2971 2972Object.defineProperty(exports, "__esModule", { value: true }); 2973var EventRange_1 = __webpack_require__(211); 2974var EventFootprint_1 = __webpack_require__(36); 2975var ComponentFootprint_1 = __webpack_require__(12); 2976function eventDefsToEventInstances(eventDefs, unzonedRange) { 2977 var eventInstances = []; 2978 var i; 2979 for (i = 0; i < eventDefs.length; i++) { 2980 eventInstances.push.apply(eventInstances, // append 2981 eventDefs[i].buildInstances(unzonedRange)); 2982 } 2983 return eventInstances; 2984} 2985exports.eventDefsToEventInstances = eventDefsToEventInstances; 2986function eventInstanceToEventRange(eventInstance) { 2987 return new EventRange_1.default(eventInstance.dateProfile.unzonedRange, eventInstance.def, eventInstance); 2988} 2989exports.eventInstanceToEventRange = eventInstanceToEventRange; 2990function eventRangeToEventFootprint(eventRange) { 2991 return new EventFootprint_1.default(new ComponentFootprint_1.default(eventRange.unzonedRange, eventRange.eventDef.isAllDay()), eventRange.eventDef, eventRange.eventInstance // might not exist 2992 ); 2993} 2994exports.eventRangeToEventFootprint = eventRangeToEventFootprint; 2995function eventInstanceToUnzonedRange(eventInstance) { 2996 return eventInstance.dateProfile.unzonedRange; 2997} 2998exports.eventInstanceToUnzonedRange = eventInstanceToUnzonedRange; 2999function eventFootprintToComponentFootprint(eventFootprint) { 3000 return eventFootprint.componentFootprint; 3001} 3002exports.eventFootprintToComponentFootprint = eventFootprintToComponentFootprint; 3003 3004 3005/***/ }), 3006/* 36 */ 3007/***/ (function(module, exports) { 3008 3009Object.defineProperty(exports, "__esModule", { value: true }); 3010var EventFootprint = /** @class */ (function () { 3011 function EventFootprint(componentFootprint, eventDef, eventInstance) { 3012 this.componentFootprint = componentFootprint; 3013 this.eventDef = eventDef; 3014 if (eventInstance) { 3015 this.eventInstance = eventInstance; 3016 } 3017 } 3018 EventFootprint.prototype.getEventLegacy = function () { 3019 return (this.eventInstance || this.eventDef).toLegacy(); 3020 }; 3021 return EventFootprint; 3022}()); 3023exports.default = EventFootprint; 3024 3025 3026/***/ }), 3027/* 37 */ 3028/***/ (function(module, exports, __webpack_require__) { 3029 3030Object.defineProperty(exports, "__esModule", { value: true }); 3031var util_1 = __webpack_require__(4); 3032var EventDateProfile_1 = __webpack_require__(17); 3033var EventDef_1 = __webpack_require__(34); 3034var EventDefDateMutation_1 = __webpack_require__(50); 3035var SingleEventDef_1 = __webpack_require__(13); 3036var EventDefMutation = /** @class */ (function () { 3037 function EventDefMutation() { 3038 } 3039 EventDefMutation.createFromRawProps = function (eventInstance, rawProps, largeUnit) { 3040 var eventDef = eventInstance.def; 3041 var dateProps = {}; 3042 var standardProps = {}; 3043 var miscProps = {}; 3044 var verbatimStandardProps = {}; 3045 var eventDefId = null; 3046 var className = null; 3047 var propName; 3048 var dateProfile; 3049 var dateMutation; 3050 var defMutation; 3051 for (propName in rawProps) { 3052 if (EventDateProfile_1.default.isStandardProp(propName)) { 3053 dateProps[propName] = rawProps[propName]; 3054 } 3055 else if (eventDef.isStandardProp(propName)) { 3056 standardProps[propName] = rawProps[propName]; 3057 } 3058 else if (eventDef.miscProps[propName] !== rawProps[propName]) { 3059 miscProps[propName] = rawProps[propName]; 3060 } 3061 } 3062 dateProfile = EventDateProfile_1.default.parse(dateProps, eventDef.source); 3063 if (dateProfile) { 3064 dateMutation = EventDefDateMutation_1.default.createFromDiff(eventInstance.dateProfile, dateProfile, largeUnit); 3065 } 3066 if (standardProps.id !== eventDef.id) { 3067 eventDefId = standardProps.id; // only apply if there's a change 3068 } 3069 if (!util_1.isArraysEqual(standardProps.className, eventDef.className)) { 3070 className = standardProps.className; // only apply if there's a change 3071 } 3072 EventDef_1.default.copyVerbatimStandardProps(standardProps, // src 3073 verbatimStandardProps // dest 3074 ); 3075 defMutation = new EventDefMutation(); 3076 defMutation.eventDefId = eventDefId; 3077 defMutation.className = className; 3078 defMutation.verbatimStandardProps = verbatimStandardProps; 3079 defMutation.miscProps = miscProps; 3080 if (dateMutation) { 3081 defMutation.dateMutation = dateMutation; 3082 } 3083 return defMutation; 3084 }; 3085 /* 3086 eventDef assumed to be a SingleEventDef. 3087 returns an undo function. 3088 */ 3089 EventDefMutation.prototype.mutateSingle = function (eventDef) { 3090 var origDateProfile; 3091 if (this.dateMutation) { 3092 origDateProfile = eventDef.dateProfile; 3093 eventDef.dateProfile = this.dateMutation.buildNewDateProfile(origDateProfile, eventDef.source.calendar); 3094 } 3095 // can't undo 3096 // TODO: more DRY with EventDef::applyManualStandardProps 3097 if (this.eventDefId != null) { 3098 eventDef.id = EventDef_1.default.normalizeId((eventDef.rawId = this.eventDefId)); 3099 } 3100 // can't undo 3101 // TODO: more DRY with EventDef::applyManualStandardProps 3102 if (this.className) { 3103 eventDef.className = this.className; 3104 } 3105 // can't undo 3106 if (this.verbatimStandardProps) { 3107 SingleEventDef_1.default.copyVerbatimStandardProps(this.verbatimStandardProps, // src 3108 eventDef // dest 3109 ); 3110 } 3111 // can't undo 3112 if (this.miscProps) { 3113 eventDef.applyMiscProps(this.miscProps); 3114 } 3115 if (origDateProfile) { 3116 return function () { 3117 eventDef.dateProfile = origDateProfile; 3118 }; 3119 } 3120 else { 3121 return function () { }; 3122 } 3123 }; 3124 EventDefMutation.prototype.setDateMutation = function (dateMutation) { 3125 if (dateMutation && !dateMutation.isEmpty()) { 3126 this.dateMutation = dateMutation; 3127 } 3128 else { 3129 this.dateMutation = null; 3130 } 3131 }; 3132 EventDefMutation.prototype.isEmpty = function () { 3133 return !this.dateMutation; 3134 }; 3135 return EventDefMutation; 3136}()); 3137exports.default = EventDefMutation; 3138 3139 3140/***/ }), 3141/* 38 */
3142/***/ (function(module, exports) { 3143 3144Object.defineProperty(exports, "__esModule", { value: true }); 3145exports.default = { 3146 sourceClasses: [], 3147 registerClass: function (EventSourceClass) { 3148 this.sourceClasses.unshift(EventSourceClass); // give highest priority 3149 }, 3150 parse: function (rawInput, calendar) { 3151 var sourceClasses = this.sourceClasses; 3152 var i; 3153 var eventSource; 3154 for (i = 0; i < sourceClasses.length; i++) { 3155 eventSource = sourceClasses[i].parse(rawInput, calendar); 3156 if (eventSource) { 3157 return eventSource; 3158 } 3159 } 3160 } 3161}; 3162 3163 3164/***/ }), 3165/* 39 */ 3166/***/ (function(module, exports, __webpack_require__) { 3167 3168Object.defineProperty(exports, "__esModule", { value: true }); 3169var tslib_1 = __webpack_require__(2); 3170var $ = __webpack_require__(3); 3171var util_1 = __webpack_require__(4); 3172var Class_1 = __webpack_require__(33); 3173/* 3174Embodies a div that has potential scrollbars 3175*/ 3176var Scroller = /** @class */ (function (_super) { 3177 tslib_1.__extends(Scroller, _super); 3178 function Scroller(options) { 3179 var _this = _super.call(this) || this; 3180 options = options || {}; 3181 return _this; 3182 } 3183 Scroller.prototype.render = function () { 3184 this.el = this.renderEl(); 3185 this.applyOverflow(); 3186 }; 3187 Scroller.prototype.renderEl = function () { 3188 return (this.scrollEl = $('<div class="fc-scroller"></div>')); 3189 }; 3190 // sets to natural height, unlocks overflow 3191 Scroller.prototype.clear = function () { 3192 this.setHeight('auto'); 3193 this.applyOverflow(); 3194 }; 3195 Scroller.prototype.destroy = function () { 3196 this.el.remove(); 3197 }; 3198 // Overflow 3199 // ----------------------------------------------------------------------------------------------------------------- 3200 Scroller.prototype.applyOverflow = function () { 3201 this.scrollEl.css({ 3202 }); 3203 }; 3204 // Causes any 'auto' overflow values to resolves to 'scroll' or 'hidden'. 3205 // Useful for preserving scrollbar widths regardless of future resizes. 3206 // Can pass in scrollbarWidths for optimization. 3207 Scroller.prototype.lockOverflow = function (scrollbarWidths) { 3208 var overflowX = this.overflowX; 3209 var overflowY = this.overflowY;
3210 scrollbarWidths = scrollbarWidths || this.getScrollbarWidths(); 3211 if (overflowX === 'auto') { 3212 overflowX = (scrollbarWidths.top || scrollbarWidths.bottom || // horizontal scrollbars? 3213 // OR scrolling pane with massless scrollbars? 3214 this.scrollEl[0].scrollWidth - 1 > this.scrollEl[0].clientWidth) ? 'scroll' : 'hidden'; 3215 } 3216 if (overflowY === 'auto') { 3217 overflowY = (scrollbarWidths.left || scrollbarWidths.right || // vertical scrollbars? 3218 // OR scrolling pane with massless scrollbars? 3219 this.scrollEl[0].scrollHeight - 1 > this.scrollEl[0].clientHeight) ? 'scroll' : 'hidden'; 3220 } 3221 this.scrollEl.css({ 'overflow-x': overflowX, 'overflow-y': overflowY }); 3222 }; 3223 // Getters / Setters 3224 // ----------------------------------------------------------------------------------------------------------------- 3225 Scroller.prototype.setHeight = function (height) { 3226 this.scrollEl.height(height); 3227 }; 3228 Scroller.prototype.getScrollTop = function () { 3229 return this.scrollEl.scrollTop(); 3230 }; 3231 Scroller.prototype.setScrollTop = function (top) { 3232 this.scrollEl.scrollTop(top); 3233 }; 3234 Scroller.prototype.getClientWidth = function () { 3235 return this.scrollEl[0].clientWidth; 3236 }; 3237 Scroller.prototype.getClientHeight = function () { 3238 return this.scrollEl[0].clientHeight; 3239 }; 3240 Scroller.prototype.getScrollbarWidths = function () { 3241 return util_1.getScrollbarWidths(this.scrollEl); 3242 }; 3243 return Scroller; 3244}(Class_1.default)); 3245exports.default = Scroller; 3246 3247 3248/***/ }), 3249/* 40 */ 3250/***/ (function(module, exports, __webpack_require__) { 3251 3252Object.defineProperty(exports, "__esModule", { value: true }); 3253var tslib_1 = __webpack_require__(2); 3254var $ = __webpack_require__(3); 3255var util_1 = __webpack_require__(4); 3256var DateComponent_1 = __webpack_require__(219); 3257var GlobalEmitter_1 = __webpack_require__(21); 3258var InteractiveDateComponent = /** @class */ (function (_super) { 3259 tslib_1.__extends(InteractiveDateComponent, _super); 3260 function InteractiveDateComponent(_view, _options) { 3261 var _this = _super.call(this, _view, _options) || this; 3262 // self-config, overridable by subclasses 3263 _this.segSelector = '.fc-event-container > *'; // what constitutes an event element? 3264 if (_this.dateSelectingClass) { 3265 _this.dateClicking = new _this.dateClickingClass(_this); 3266 } 3267 if (_this.dateSelectingClass) { 3268 _this.dateSelecting = new _this.dateSelectingClass(_this); 3269 } 3270 if (_this.eventPointingClass) { 3271 _this.eventPointing = new _this.eventPointingClass(_this); 3272 } 3273 if (_this.eventDraggingClass && _this.eventPointing) { 3274 _this.eventDragging = new _this.eventDraggingClass(_this, _this.eventPointing); 3275 } 3276 if (_this.eventResizingClass && _this.eventPointing) { 3277 _this.eventResizing = new _this.eventResizingClass(_this, _this.eventPointing); 3278 } 3279 if (_this.externalDroppingClass) { 3280 _this.externalDropping = new _this.externalDroppingClass(_this); 3281 } 3282 return _this; 3283 } 3284 // Sets the container element that the view should render inside of, does global DOM-related initializations, 3285 // and renders all the non-date-related content inside. 3286 InteractiveDateComponent.prototype.setElement = function (el) { 3287 _super.prototype.setElement.call(this, el); 3288 if (this.dateClicking) { 3289 this.dateClicking.bindToEl(el); 3290 } 3291 if (this.dateSelecting) { 3292 this.dateSelecting.bindToEl(el); 3293 } 3294 this.bindAllSegHandlersToEl(el); 3295 }; 3296 InteractiveDateComponent.prototype.removeElement = function () { 3297 this.endInteractions(); 3298 _super.prototype.removeElement.call(this); 3299 }; 3300 InteractiveDateComponent.prototype.executeEventUnrender = function () { 3301 this.endInteractions(); 3302 _super.prototype.executeEventUnrender.call(this); 3303 }; 3304 InteractiveDateComponent.prototype.bindGlobalHandlers = function () { 3305 _super.prototype.bindGlobalHandlers.call(this); 3306 if (this.externalDropping) { 3307 this.externalDropping.bindToDocument(); 3308 } 3309 }; 3310 InteractiveDateComponent.prototype.unbindGlobalHandlers = function () { 3311 _super.prototype.unbindGlobalHandlers.call(this); 3312 if (this.externalDropping) { 3313 this.externalDropping.unbindFromDocument(); 3314 } 3315 }; 3316 InteractiveDateComponent.prototype.bindDateHandlerToEl = function (el, name, handler) { 3317 var _this = this; 3318 // attach a handler to the grid's root element. 3319 // jQuery will take care of unregistering them when removeElement gets called. 3320 this.el.on(name, function (ev) { 3321 if (!$(ev.target).is(_this.segSelector + ':not(.fc-helper),' + // directly on an event element 3322 _this.segSelector + ':not(.fc-helper) *,' + // within an event element 3323 '.fc-more,' + // a "more.." link 3324 'a[data-goto]' // a clickable nav link 3325 )) { 3326 return handler.call(_this, ev); 3327 } 3328 }); 3329 }; 3330 InteractiveDateComponent.prototype.bindAllSegHandlersToEl = function (el) { 3331 [ 3332 this.eventPointing, 3333 this.eventDragging, 3334 this.eventResizing 3335 ].forEach(function (eventInteraction) { 3336 if (eventInteraction) { 3337 eventInteraction.bindToEl(el); 3338 } 3339 }); 3340 }; 3341 InteractiveDateComponent.prototype.bindSegHandlerToEl = function (el, name, handler) { 3342 var _this = this; 3343 el.on(name, this.segSelector, function (ev) { 3344 var segEl = $(ev.currentTarget); 3345 if (!segEl.is('.fc-helper')) { 3346 var seg = segEl.data('fc-seg'); // grab segment data. put there by View::renderEventsPayload 3347 if (seg && !_this.shouldIgnoreEventPointing()) { 3348 return handler.call(_this, seg, ev); // context will be the Grid 3349 } 3350 } 3351 }); 3352 }; 3353 InteractiveDateComponent.prototype.shouldIgnoreMouse = function () { 3354 // HACK 3355 // This will still work even though bindDateHandlerToEl doesn't use GlobalEmitter. 3356 return GlobalEmitter_1.default.get().shouldIgnoreMouse(); 3357 }; 3358 InteractiveDateComponent.prototype.shouldIgnoreTouch = function () { 3359 var view = this._getView(); 3360 // On iOS (and Android?) when a new selection is initiated overtop another selection, 3361 // the touchend never fires because the elements gets removed mid-touch-interaction (my theory). 3362 // HACK: simply don't allow this to happen. 3363 // ALSO: prevent selection when an *event* is already raised. 3364 return view.isSelected || view.selectedEvent; 3365 }; 3366 InteractiveDateComponent.prototype.shouldIgnoreEventPointing = function () { 3367 // only call the handlers if there is not a drag/resize in progress 3368 return (this.eventDragging && this.eventDragging.isDragging) || 3369 (this.eventResizing && this.eventResizing.isResizing); 3370 }; 3371 InteractiveDateComponent.prototype.canStartSelection = function (seg, ev) { 3372 return util_1.getEvIsTouch(ev) && 3373 !this.canStartResize(seg, ev) && 3374 (this.isEventDefDraggable(seg.footprint.eventDef) || 3375 this.isEventDefResizable(seg.footprint.eventDef)); 3376 }; 3377 InteractiveDateComponent.prototype.canStartDrag = function (seg, ev) { 3378 return !this.canStartResize(seg, ev) && 3379 this.isEventDefDraggable(seg.footprint.eventDef); 3380 }; 3381 InteractiveDateComponent.prototype.canStartResize = function (seg, ev) { 3382 var view = this._getView(); 3383 var eventDef = seg.footprint.eventDef; 3384 return (!util_1.getEvIsTouch(ev) || view.isEventDefSelected(eventDef)) && 3385 this.isEventDefResizable(eventDef) && 3386 $(ev.target).is('.fc-resizer'); 3387 }; 3388 // Kills all in-progress dragging. 3389 // Useful for when public API methods that result in re-rendering are invoked during a drag. 3390 // Also useful for when touch devices misbehave and don't fire their touchend. 3391 InteractiveDateComponent.prototype.endInteractions = function () { 3392 [ 3393 this.dateClicking, 3394 this.dateSelecting, 3395 this.eventPointing, 3396 this.eventDragging, 3397 this.eventResizing 3398 ].forEach(function (interaction) { 3399 if (interaction) { 3400 interaction.end(); 3401 } 3402 }); 3403 }; 3404 // Event Drag-n-Drop 3405 // --------------------------------------------------------------------------------------------------------------- 3406 // Computes if the given event is allowed to be dragged by the user 3407 InteractiveDateComponent.prototype.isEventDefDraggable = function (eventDef) { 3408 return this.isEventDefStartEditable(eventDef); 3409 }; 3410 InteractiveDateComponent.prototype.isEventDefStartEditable = function (eventDef) { 3411 var isEditable = eventDef.isStartExplicitlyEditable(); 3412 if (isEditable == null) { 3413 isEditable = this.opt('eventStartEditable'); 3414 if (isEditable == null) { 3415 isEditable = this.isEventDefGenerallyEditable(eventDef); 3416 } 3417 } 3418 return isEditable; 3419 }; 3420 InteractiveDateComponent.prototype.isEventDefGenerallyEditable = function (eventDef) { 3421 var isEditable = eventDef.isExplicitlyEditable(); 3422 if (isEditable == null) { 3423 isEditable = this.opt('editable'); 3424 } 3425 return isEditable; 3426 }; 3427 // Event Resizing 3428 // --------------------------------------------------------------------------------------------------------------- 3429 // Computes if the given event is allowed to be resized from its starting edge 3430 InteractiveDateComponent.prototype.isEventDefResizableFromStart = function (eventDef) { 3431 return this.opt('eventResizableFromStart') && this.isEventDefResizable(eventDef); 3432 }; 3433 // Computes if the given event is allowed to be resized from its ending edge 3434 InteractiveDateComponent.prototype.isEventDefResizableFromEnd = function (eventDef) { 3435 return this.isEventDefResizable(eventDef); 3436 }; 3437 // Computes if the given event is allowed to be resized by the user at all 3438 InteractiveDateComponent.prototype.isEventDefResizable = function (eventDef) { 3439 var isResizable = eventDef.isDurationExplicitlyEditable(); 3440 if (isResizable == null) { 3441 isResizable = this.opt('eventDurationEditable'); 3442 if (isResizable == null) { 3443 isResizable = this.isEventDefGenerallyEditable(eventDef); 3444 } 3445 } 3446 return isResizable; 3447 }; 3448 // Event Mutation / Constraints 3449 // --------------------------------------------------------------------------------------------------------------- 3450 // Diffs the two dates, returning a duration, based on granularity of the grid 3451 // TODO: port isTimeScale into this system? 3452 InteractiveDateComponent.prototype.diffDates = function (a, b) { 3453 if (this.largeUnit) { 3454 return util_1.diffByUnit(a, b, this.largeUnit); 3455 } 3456 else { 3457 return util_1.diffDayTime(a, b); 3458 } 3459 }; 3460 // is it allowed, in relation to the view's validRange? 3461 // NOTE: very similar to isExternalInstanceGroupAllowed 3462 InteractiveDateComponent.prototype.isEventInstanceGroupAllowed = function (eventInstanceGroup) { 3463 var view = this._getView(); 3464 var dateProfile = this.dateProfile; 3465 var eventFootprints = this.eventRangesToEventFootprints(eventInstanceGroup.getAllEventRanges()); 3466 var i; 3467 for (i = 0; i < eventFootprints.length; i++) { 3468 // TODO: just use getAllEventRanges directly 3469 if (!dateProfile.validUnzonedRange.containsRange(eventFootprints[i].componentFootprint.unzonedRange)) { 3470 return false; 3471 } 3472 } 3473 return view.calendar.constraints.isEventInstanceGroupAllowed(eventInstanceGroup); 3474 }; 3475 // NOTE: very similar to isEventInstanceGroupAllowed 3476 // when it's a completely anonymous external drag, no event. 3477 InteractiveDateComponent.prototype.isExternalInstanceGroupAllowed = function (eventInstanceGroup) { 3478 var view = this._getView(); 3479 var dateProfile = this.dateProfile; 3480 var eventFootprints = this.eventRangesToEventFootprints(eventInstanceGroup.getAllEventRanges()); 3481 var i; 3482 for (i = 0; i < eventFootprints.length; i++) { 3483 if (!dateProfile.validUnzonedRange.containsRange(eventFootprints[i].componentFootprint.unzonedRange)) { 3484 return false; 3485 } 3486 } 3487 for (i = 0; i < eventFootprints.length; i++) { 3488 // treat it as a selection 3489 // TODO: pass in eventInstanceGroup instead 3490 // because we don't want calendar's constraint system to depend on a component's 3491 // determination of footprints. 3492 if (!view.calendar.constraints.isSelectionFootprintAllowed(eventFootprints[i].componentFootprint)) { 3493 return false; 3494 } 3495 } 3496 return true; 3497 }; 3498 return InteractiveDateComponent; 3499}(DateComponent_1.default)); 3500exports.default = InteractiveDateComponent; 3501 3502 3503/***/ }), 3504/* 41 */ 3505/***/ (function(module, exports, __webpack_require__) { 3506 3507Object.defineProperty(exports, "__esModule", { value: true });
3508var tslib_1 = __webpack_require__(2); 3509var $ = __webpack_require__(3); 3510var moment = __webpack_require__(0); 3511var util_1 = __webpack_require__(4); 3512var RenderQueue_1 = __webpack_require__(218); 3513var DateProfileGenerator_1 = __webpack_require__(221); 3514var InteractiveDateComponent_1 = __webpack_require__(40); 3515var GlobalEmitter_1 = __webpack_require__(21); 3516var UnzonedRange_1 = __webpack_require__(5); 3517/* An abstract class from which other views inherit from 3518----------------------------------------------------------------------------------------------------------------------*/ 3519var View = /** @class */ (function (_super) { 3520 tslib_1.__extends(View, _super); 3521 function View(calendar, viewSpec) { 3522 var _this = _super.call(this, null, viewSpec.options) || this; 3523 _this.batchRenderDepth = 0; 3524 _this.isSelected = false; // boolean whether a range of time is user-selected or not 3525 _this.calendar = calendar; 3526 _this.viewSpec = viewSpec; 3527 // shortcuts 3528 _this.type = viewSpec.type; 3529 // .name is deprecated 3530 _this.name = _this.type; 3531 _this.initRenderQueue(); 3532 _this.initHiddenDays(); 3533 _this.dateProfileGenerator = new _this.dateProfileGeneratorClass(_this); 3534 _this.bindBaseRenderHandlers(); 3535 _this.eventOrderSpecs = util_1.parseFieldSpecs(_this.opt('eventOrder')); 3536 // legacy 3537 if (_this['initialize']) { 3538 _this['initialize'](); 3539 } 3540 return _this; 3541 } 3542 View.prototype._getView = function () { 3543 return this; 3544 }; 3545 // Retrieves an option with the given name 3546 View.prototype.opt = function (name) { 3547 return this.options[name]; 3548 }; 3549 /* Render Queue 3550 ------------------------------------------------------------------------------------------------------------------*/ 3551 View.prototype.initRenderQueue = function () { 3552 this.renderQueue = new RenderQueue_1.default({ 3553 event: this.opt('eventRenderWait') 3554 }); 3555 this.renderQueue.on('start', this.onRenderQueueStart.bind(this)); 3556 this.renderQueue.on('stop', this.onRenderQueueStop.bind(this)); 3557 this.on('before:change', this.startBatchRender); 3558 this.on('change', this.stopBatchRender); 3559 }; 3560 View.prototype.onRenderQueueStart = function () { 3561 this.calendar.freezeContentHeight(); 3562 this.addScroll(this.queryScroll()); 3563 }; 3564 View.prototype.onRenderQueueStop = function () { 3565 if (this.calendar.updateViewSize()) { 3566 this.popScroll(); 3567 } 3568 this.calendar.thawContentHeight(); 3569 }; 3570 View.prototype.startBatchRender = function () { 3571 if (!(this.batchRenderDepth++)) { 3572 this.renderQueue.pause(); 3573 } 3574 }; 3575 View.prototype.stopBatchRender = function () { 3576 if (!(--this.batchRenderDepth)) { 3577 this.renderQueue.resume(); 3578 } 3579 }; 3580 View.prototype.requestRender = function (func, namespace, actionType) { 3581 this.renderQueue.queue(func, namespace, actionType); 3582 }; 3583 // given func will auto-bind to `this` 3584 View.prototype.whenSizeUpdated = function (func) { 3585 if (this.renderQueue.isRunning) { 3586 this.renderQueue.one('stop', func.bind(this)); 3587 } 3588 else { 3589 func.call(this); 3590 } 3591 }; 3592 /* Title and Date Formatting 3593 ------------------------------------------------------------------------------------------------------------------*/ 3594 // Computes what the title at the top of the calendar should be for this view 3595 View.prototype.computeTitle = function (dateProfile) { 3596 var unzonedRange; 3597 // for views that span a large unit of time, show the proper interval, ignoring stray days before and after 3598 if (/^(year|month)$/.test(dateProfile.currentRangeUnit)) { 3599 unzonedRange = dateProfile.currentUnzonedRange; 3600 } 3601 else { 3602 unzonedRange = dateProfile.activeUnzonedRange; 3603 } 3604 return this.formatRange({ 3605 start: this.calendar.msToMoment(unzonedRange.startMs, dateProfile.isRangeAllDay), 3606 end: this.calendar.msToMoment(unzonedRange.endMs, dateProfile.isRangeAllDay) 3607 }, dateProfile.isRangeAllDay, this.opt('titleFormat') || this.computeTitleFormat(dateProfile), this.opt('titleRangeSeparator')); 3608 };
3609 // Generates the format string that should be used to generate the title for the current date range. 3610 // Attempts to compute the most appropriate format if not explicitly specified with `titleFormat`. 3611 View.prototype.computeTitleFormat = function (dateProfile) { 3612 var currentRangeUnit = dateProfile.currentRangeUnit; 3613 if (currentRangeUnit === 'year') { 3614 return 'YYYY'; 3615 } 3616 else if (currentRangeUnit === 'month') { 3617 return this.opt('monthYearFormat'); // like "September 2014" 3618 } 3619 else if (dateProfile.currentUnzonedRange.as('days') > 1) { 3620 return 'll'; // multi-day range. shorter, like "Sep 9 - 10 2014" 3621 } 3622 else { 3623 return 'LL'; // one day. longer, like "September 9 2014" 3624 } 3625 }; 3626 // Date Setting/Unsetting 3627 // ----------------------------------------------------------------------------------------------------------------- 3628 View.prototype.setDate = function (date) { 3629 var currentDateProfile = this.get('dateProfile'); 3630 var newDateProfile = this.dateProfileGenerator.build(date, undefined, true); // forceToValid=true 3631 if (!currentDateProfile || 3632 !currentDateProfile.activeUnzonedRange.equals(newDateProfile.activeUnzonedRange)) { 3633 this.set('dateProfile', newDateProfile); 3634 } 3635 }; 3636 View.prototype.unsetDate = function () { 3637 this.unset('dateProfile'); 3638 }; 3639 // Event Data 3640 // ----------------------------------------------------------------------------------------------------------------- 3641 View.prototype.fetchInitialEvents = function (dateProfile) { 3642 var calendar = this.calendar; 3643 var forceAllDay = dateProfile.isRangeAllDay && !this.usesMinMaxTime; 3644 return calendar.requestEvents(calendar.msToMoment(dateProfile.activeUnzonedRange.startMs, forceAllDay), calendar.msToMoment(dateProfile.activeUnzonedRange.endMs, forceAllDay)); 3645 }; 3646 View.prototype.bindEventChanges = function () { 3647 this.listenTo(this.calendar, 'eventsReset', this.resetEvents); // TODO: make this a real event 3648 }; 3649 View.prototype.unbindEventChanges = function () { 3650 this.stopListeningTo(this.calendar, 'eventsReset'); 3651 }; 3652 View.prototype.setEvents = function (eventsPayload) { 3653 this.set('currentEvents', eventsPayload); 3654 this.set('hasEvents', true); 3655 }; 3656 View.prototype.unsetEvents = function () { 3657 this.unset('currentEvents'); 3658 this.unset('hasEvents'); 3659 }; 3660 View.prototype.resetEvents = function (eventsPayload) { 3661 this.startBatchRender(); 3662 this.unsetEvents(); 3663 this.setEvents(eventsPayload); 3664 this.stopBatchRender(); 3665 }; 3666 // Date High-level Rendering 3667 // ----------------------------------------------------------------------------------------------------------------- 3668 View.prototype.requestDateRender = function (dateProfile) { 3669 var _this = this; 3670 this.requestRender(function () { 3671 _this.executeDateRender(dateProfile); 3672 }, 'date', 'init'); 3673 }; 3674 View.prototype.requestDateUnrender = function () { 3675 var _this = this; 3676 this.requestRender(function () { 3677 _this.executeDateUnrender(); 3678 }, 'date', 'destroy'); 3679 }; 3680 // if dateProfile not specified, uses current 3681 View.prototype.executeDateRender = function (dateProfile) { 3682 _super.prototype.executeDateRender.call(this, dateProfile); 3683 if (this['render']) { 3684 this['render'](); // TODO: deprecate 3685 } 3686 this.trigger('datesRendered'); 3687 this.addScroll({ isDateInit: true }); 3688 this.startNowIndicator(); // shouldn't render yet because updateSize will be called soon 3689 }; 3690 View.prototype.executeDateUnrender = function () { 3691 this.unselect(); 3692 this.stopNowIndicator(); 3693 this.trigger('before:datesUnrendered'); 3694 if (this['destroy']) { 3695 this['destroy'](); // TODO: deprecate 3696 } 3697 _super.prototype.executeDateUnrender.call(this); 3698 }; 3699 // "Base" rendering 3700 // -----------------------------------------------------------------------------------------------------------------
3701 View.prototype.bindBaseRenderHandlers = function () { 3702 var _this = this; 3703 this.on('datesRendered', function () { 3704 _this.whenSizeUpdated(_this.triggerViewRender); 3705 }); 3706 this.on('before:datesUnrendered', function () { 3707 _this.triggerViewDestroy(); 3708 }); 3709 }; 3710 View.prototype.triggerViewRender = function () { 3711 this.publiclyTrigger('viewRender', { 3712 context: this, 3713 args: [this, this.el] 3714 }); 3715 }; 3716 View.prototype.triggerViewDestroy = function () { 3717 this.publiclyTrigger('viewDestroy', { 3718 context: this, 3719 args: [this, this.el] 3720 }); 3721 }; 3722 // Event High-level Rendering 3723 // ----------------------------------------------------------------------------------------------------------------- 3724 View.prototype.requestEventsRender = function (eventsPayload) { 3725 var _this = this; 3726 this.requestRender(function () { 3727 _this.executeEventRender(eventsPayload); 3728 _this.whenSizeUpdated(_this.triggerAfterEventsRendered); 3729 }, 'event', 'init'); 3730 }; 3731 View.prototype.requestEventsUnrender = function () { 3732 var _this = this; 3733 this.requestRender(function () { 3734 _this.triggerBeforeEventsDestroyed(); 3735 _this.executeEventUnrender(); 3736 }, 'event', 'destroy'); 3737 }; 3738 // Business Hour High-level Rendering 3739 // ----------------------------------------------------------------------------------------------------------------- 3740 View.prototype.requestBusinessHoursRender = function (businessHourGenerator) { 3741 var _this = this; 3742 this.requestRender(function () { 3743 _this.renderBusinessHours(businessHourGenerator); 3744 }, 'businessHours', 'init'); 3745 }; 3746 View.prototype.requestBusinessHoursUnrender = function () { 3747 var _this = this; 3748 this.requestRender(function () { 3749 _this.unrenderBusinessHours(); 3750 }, 'businessHours', 'destroy'); 3751 }; 3752 // Misc view rendering utils 3753 // ----------------------------------------------------------------------------------------------------------------- 3754 // Binds DOM handlers to elements that reside outside the view container, such as the document 3755 View.prototype.bindGlobalHandlers = function () { 3756 _super.prototype.bindGlobalHandlers.call(this); 3757 this.listenTo(GlobalEmitter_1.default.get(), { 3758 touchstart: this.processUnselect, 3759 mousedown: this.handleDocumentMousedown 3760 }); 3761 }; 3762 // Unbinds DOM handlers from elements that reside outside the view container 3763 View.prototype.unbindGlobalHandlers = function () { 3764 _super.prototype.unbindGlobalHandlers.call(this); 3765 this.stopListeningTo(GlobalEmitter_1.default.get()); 3766 }; 3767 /* Now Indicator 3768 ------------------------------------------------------------------------------------------------------------------*/ 3769 // Immediately render the current time indicator and begins re-rendering it at an interval, 3770 // which is defined by this.getNowIndicatorUnit(). 3771 // TODO: somehow do this for the current whole day's background too 3772 View.prototype.startNowIndicator = function () { 3773 var _this = this; 3774 var unit; 3775 var update; 3776 var delay; // ms wait value 3777 if (this.opt('nowIndicator')) { 3778 unit = this.getNowIndicatorUnit(); 3779 if (unit) { 3780 update = util_1.proxy(this, 'updateNowIndicator'); // bind to `this` 3781 this.initialNowDate = this.calendar.getNow(); 3782 this.initialNowQueriedMs = new Date().valueOf(); 3783 // wait until the beginning of the next interval 3784 delay = this.initialNowDate.clone().startOf(unit).add(1, unit).valueOf() - this.initialNowDate.valueOf(); 3785 this.nowIndicatorTimeoutID = setTimeout(function () { 3786 _this.nowIndicatorTimeoutID = null; 3787 update();
3788 delay = +moment.duration(1, unit); 3789 delay = Math.max(100, delay); // prevent too frequent 3790 _this.nowIndicatorIntervalID = setInterval(update, delay); // update every interval 3791 }, delay); 3792 } 3793 // rendering will be initiated in updateSize 3794 } 3795 }; 3796 // rerenders the now indicator, computing the new current time from the amount of time that has passed 3797 // since the initial getNow call. 3798 View.prototype.updateNowIndicator = function () { 3799 if (this.isDatesRendered && 3800 this.initialNowDate // activated before? 3801 ) { 3802 this.unrenderNowIndicator(); // won't unrender if unnecessary 3803 this.renderNowIndicator(this.initialNowDate.clone().add(new Date().valueOf() - this.initialNowQueriedMs) // add ms 3804 ); 3805 this.isNowIndicatorRendered = true; 3806 } 3807 }; 3808 // Immediately unrenders the view's current time indicator and stops any re-rendering timers. 3809 // Won't cause side effects if indicator isn't rendered. 3810 View.prototype.stopNowIndicator = function () { 3811 if (this.isNowIndicatorRendered) { 3812 if (this.nowIndicatorTimeoutID) { 3813 clearTimeout(this.nowIndicatorTimeoutID); 3814 this.nowIndicatorTimeoutID = null; 3815 } 3816 if (this.nowIndicatorIntervalID) { 3817 clearInterval(this.nowIndicatorIntervalID); 3818 this.nowIndicatorIntervalID = null; 3819 } 3820 this.unrenderNowIndicator(); 3821 this.isNowIndicatorRendered = false; 3822 } 3823 }; 3824 /* Dimensions 3825 ------------------------------------------------------------------------------------------------------------------*/ 3826 View.prototype.updateSize = function (totalHeight, isAuto, isResize) { 3827 if (this['setHeight']) { 3828 this['setHeight'](totalHeight, isAuto); 3829 } 3830 else { 3831 _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize); 3832 } 3833 this.updateNowIndicator(); 3834 }; 3835 /* Scroller 3836 ------------------------------------------------------------------------------------------------------------------*/ 3837 View.prototype.addScroll = function (scroll) { 3838 var queuedScroll = this.queuedScroll || (this.queuedScroll = {}); 3839 $.extend(queuedScroll, scroll); 3840 }; 3841 View.prototype.popScroll = function () { 3842 this.applyQueuedScroll(); 3843 this.queuedScroll = null; 3844 }; 3845 View.prototype.applyQueuedScroll = function () { 3846 if (this.queuedScroll) { 3847 this.applyScroll(this.queuedScroll); 3848 } 3849 }; 3850 View.prototype.queryScroll = function () { 3851 var scroll = {}; 3852 if (this.isDatesRendered) { 3853 $.extend(scroll, this.queryDateScroll()); 3854 } 3855 return scroll; 3856 }; 3857 View.prototype.applyScroll = function (scroll) { 3858 if (scroll.isDateInit && this.isDatesRendered) { 3859 $.extend(scroll, this.computeInitialDateScroll()); 3860 } 3861 if (this.isDatesRendered) { 3862 this.applyDateScroll(scroll); 3863 } 3864 }; 3865 View.prototype.computeInitialDateScroll = function () { 3866 return {}; // subclasses must implement 3867 }; 3868 View.prototype.queryDateScroll = function () { 3869 return {}; // subclasses must implement 3870 }; 3871 View.prototype.applyDateScroll = function (scroll) { 3872 // subclasses must implement 3873 }; 3874 /* Event Drag-n-Drop 3875 ------------------------------------------------------------------------------------------------------------------*/ 3876 View.prototype.reportEventDrop = function (eventInstance, eventMutation, el, ev) { 3877 var eventManager = this.calendar.eventManager; 3878 var undoFunc = eventManager.mutateEventsWithId(eventInstance.def.id, eventMutation); 3879 var dateMutation = eventMutation.dateMutation; 3880 // update the EventInstance, for handlers 3881 if (dateMutation) { 3882 eventInstance.dateProfile = dateMutation.buildNewDateProfile(eventInstance.dateProfile, this.calendar); 3883 } 3884 this.triggerEventDrop(eventInstance, 3885 // a drop doesn't necessarily mean a date mutation (ex: resource change) 3886 (dateMutation && dateMutation.dateDelta) || moment.duration(), undoFunc, el, ev); 3887 }; 3888 // Triggers event-drop handlers that have subscribed via the API 3889 View.prototype.triggerEventDrop = function (eventInstance, dateDelta, undoFunc, el, ev) { 3890 this.publiclyTrigger('eventDrop', { 3891 context: el[0], 3892 args: [ 3893 eventInstance.toLegacy(), 3894 dateDelta, 3895 undoFunc, 3896 ev, 3897 {}, 3898 this 3899 ] 3900 }); 3901 }; 3902 /* External Element Drag-n-Drop 3903 ------------------------------------------------------------------------------------------------------------------*/ 3904 // Must be called when an external element, via jQuery UI, has been dropped onto the calendar. 3905 // `meta` is the parsed data that has been embedded into the dragging event. 3906 // `dropLocation` is an object that contains the new zoned start/end/allDay values for the event. 3907 View.prototype.reportExternalDrop = function (singleEventDef, isEvent, isSticky, el, ev, ui) { 3908 if (isEvent) { 3909 this.calendar.eventManager.addEventDef(singleEventDef, isSticky); 3910 } 3911 this.triggerExternalDrop(singleEventDef, isEvent, el, ev, ui); 3912 }; 3913 // Triggers external-drop handlers that have subscribed via the API 3914 View.prototype.triggerExternalDrop = function (singleEventDef, isEvent, el, ev, ui) { 3915 // trigger 'drop' regardless of whether element represents an event 3916 this.publiclyTrigger('drop', { 3917 context: el[0], 3918 args: [ 3919 singleEventDef.dateProfile.start.clone(), 3920 ev, 3921 ui, 3922 this 3923 ] 3924 }); 3925 if (isEvent) { 3926 // signal an external event landed 3927 this.publiclyTrigger('eventReceive', { 3928 context: this, 3929 args: [ 3930 singleEventDef.buildInstance().toLegacy(), 3931 this 3932 ] 3933 }); 3934 } 3935 }; 3936 /* Event Resizing 3937 ------------------------------------------------------------------------------------------------------------------*/ 3938 // Must be called when an event in the view has been resized to a new length 3939 View.prototype.reportEventResize = function (eventInstance, eventMutation, el, ev) { 3940 var eventManager = this.calendar.eventManager;
3941 var undoFunc = eventManager.mutateEventsWithId(eventInstance.def.id, eventMutation); 3942 // update the EventInstance, for handlers 3943 eventInstance.dateProfile = eventMutation.dateMutation.buildNewDateProfile(eventInstance.dateProfile, this.calendar); 3944 this.triggerEventResize(eventInstance, eventMutation.dateMutation.endDelta, undoFunc, el, ev); 3945 }; 3946 // Triggers event-resize handlers that have subscribed via the API 3947 View.prototype.triggerEventResize = function (eventInstance, durationDelta, undoFunc, el, ev) { 3948 this.publiclyTrigger('eventResize', { 3949 context: el[0], 3950 args: [ 3951 eventInstance.toLegacy(), 3952 durationDelta, 3953 undoFunc, 3954 ev, 3955 {}, 3956 this 3957 ] 3958 }); 3959 }; 3960 /* Selection (time range) 3961 ------------------------------------------------------------------------------------------------------------------*/ 3962 // Selects a date span on the view. `start` and `end` are both Moments. 3963 // `ev` is the native mouse event that begin the interaction. 3964 View.prototype.select = function (footprint, ev) { 3965 this.unselect(ev); 3966 this.renderSelectionFootprint(footprint); 3967 this.reportSelection(footprint, ev); 3968 }; 3969 View.prototype.renderSelectionFootprint = function (footprint) { 3970 if (this['renderSelection']) { 3971 this['renderSelection'](footprint.toLegacy(this.calendar)); 3972 } 3973 else { 3974 _super.prototype.renderSelectionFootprint.call(this, footprint); 3975 } 3976 }; 3977 // Called when a new selection is made. Updates internal state and triggers handlers. 3978 View.prototype.reportSelection = function (footprint, ev) { 3979 this.isSelected = true; 3980 this.triggerSelect(footprint, ev); 3981 }; 3982 // Triggers handlers to 'select' 3983 View.prototype.triggerSelect = function (footprint, ev) { 3984 var dateProfile = this.calendar.footprintToDateProfile(footprint); // abuse of "Event"DateProfile? 3985 this.publiclyTrigger('select', { 3986 context: this, 3987 args: [ 3988 dateProfile.start, 3989 dateProfile.end, 3990 ev, 3991 this 3992 ] 3993 }); 3994 }; 3995 // Undoes a selection. updates in the internal state and triggers handlers. 3996 // `ev` is the native mouse event that began the interaction. 3997 View.prototype.unselect = function (ev) { 3998 if (this.isSelected) { 3999 this.isSelected = false; 4000 if (this['destroySelection']) { 4001 this['destroySelection'](); // TODO: deprecate 4002 } 4003 this.unrenderSelection(); 4004 this.publiclyTrigger('unselect', { 4005 context: this, 4006 args: [ev, this] 4007 }); 4008 } 4009 }; 4010 /* Event Selection 4011 ------------------------------------------------------------------------------------------------------------------*/ 4012 View.prototype.selectEventInstance = function (eventInstance) { 4013 if (!this.selectedEventInstance || 4014 this.selectedEventInstance !== eventInstance) { 4015 this.unselectEventInstance(); 4016 this.getEventSegs().forEach(function (seg) { 4017 if (seg.footprint.eventInstance === eventInstance && 4018 seg.el // necessary? 4019 ) { 4020 seg.el.addClass('fc-selected'); 4021 } 4022 }); 4023 this.selectedEventInstance = eventInstance; 4024 } 4025 }; 4026 View.prototype.unselectEventInstance = function () { 4027 if (this.selectedEventInstance) { 4028 this.getEventSegs().forEach(function (seg) { 4029 if (seg.el) { 4030 seg.el.removeClass('fc-selected'); 4031 } 4032 }); 4033 this.selectedEventInstance = null; 4034 } 4035 }; 4036 View.prototype.isEventDefSelected = function (eventDef) { 4037 // event references might change on refetchEvents(), while selectedEventInstance doesn't, 4038 // so compare IDs 4039 return this.selectedEventInstance && this.selectedEventInstance.def.id === eventDef.id; 4040 }; 4041 /* Mouse / Touch Unselecting (time range & event unselection) 4042 ------------------------------------------------------------------------------------------------------------------*/ 4043 // TODO: move consistently to down/start or up/end? 4044 // TODO: don't kill previous selection if touch scrolling 4045 View.prototype.handleDocumentMousedown = function (ev) { 4046 if (util_1.isPrimaryMouseButton(ev)) { 4047 this.processUnselect(ev); 4048 } 4049 }; 4050 View.prototype.processUnselect = function (ev) { 4051 this.processRangeUnselect(ev); 4052 this.processEventUnselect(ev); 4053 }; 4054 View.prototype.processRangeUnselect = function (ev) { 4055 var ignore;
4056 // is there a time-range selection? 4057 if (this.isSelected && this.opt('unselectAuto')) { 4058 // only unselect if the clicked element is not identical to or inside of an 'unselectCancel' element 4059 ignore = this.opt('unselectCancel'); 4060 if (!ignore || !$(ev.target).closest(ignore).length) { 4061 this.unselect(ev); 4062 } 4063 } 4064 }; 4065 View.prototype.processEventUnselect = function (ev) { 4066 if (this.selectedEventInstance) { 4067 if (!$(ev.target).closest('.fc-selected').length) { 4068 this.unselectEventInstance(); 4069 } 4070 } 4071 }; 4072 /* Triggers 4073 ------------------------------------------------------------------------------------------------------------------*/ 4074 View.prototype.triggerBaseRendered = function () { 4075 this.publiclyTrigger('viewRender', { 4076 context: this, 4077 args: [this, this.el] 4078 }); 4079 }; 4080 View.prototype.triggerBaseUnrendered = function () { 4081 this.publiclyTrigger('viewDestroy', { 4082 context: this, 4083 args: [this, this.el] 4084 }); 4085 }; 4086 // Triggers handlers to 'dayClick' 4087 // Span has start/end of the clicked area. Only the start is useful. 4088 View.prototype.triggerDayClick = function (footprint, dayEl, ev) { 4089 var dateProfile = this.calendar.footprintToDateProfile(footprint); // abuse of "Event"DateProfile? 4090 this.publiclyTrigger('dayClick', { 4091 context: dayEl, 4092 args: [dateProfile.start, ev, this] 4093 }); 4094 }; 4095 /* Date Utils 4096 ------------------------------------------------------------------------------------------------------------------*/ 4097 // For DateComponent::getDayClasses 4098 View.prototype.isDateInOtherMonth = function (date, dateProfile) { 4099 return false; 4100 }; 4101 // Arguments after name will be forwarded to a hypothetical function value 4102 // WARNING: passed-in arguments will be given to generator functions as-is and can cause side-effects. 4103 // Always clone your objects if you fear mutation. 4104 View.prototype.getUnzonedRangeOption = function (name) { 4105 var val = this.opt(name); 4106 if (typeof val === 'function') { 4107 val = val.apply(null, Array.prototype.slice.call(arguments, 1)); 4108 } 4109 if (val) { 4110 return this.calendar.parseUnzonedRange(val); 4111 } 4112 }; 4113 /* Hidden Days 4114 ------------------------------------------------------------------------------------------------------------------*/ 4115 // Initializes internal variables related to calculating hidden days-of-week 4116 View.prototype.initHiddenDays = function () { 4117 var hiddenDays = this.opt('hiddenDays') || []; // array of day-of-week indices that are hidden 4118 var isHiddenDayHash = []; // is the day-of-week hidden? (hash with day-of-week-index -> bool) 4119 var dayCnt = 0; 4120 var i; 4121 if (this.opt('weekends') === false) { 4122 hiddenDays.push(0, 6); // 0=sunday, 6=saturday 4123 } 4124 for (i = 0; i < 7; i++) { 4125 if (!(isHiddenDayHash[i] = $.inArray(i, hiddenDays) !== -1)) { 4126 dayCnt++; 4127 } 4128 } 4129 if (!dayCnt) { 4130 throw new Error('invalid hiddenDays'); // all days were hidden? bad. 4131 } 4132 this.isHiddenDayHash = isHiddenDayHash; 4133 }; 4134 // Remove days from the beginning and end of the range that are computed as hidden. 4135 // If the whole range is trimmed off, returns null 4136 View.prototype.trimHiddenDays = function (inputUnzonedRange) { 4137 var start = inputUnzonedRange.getStart(); 4138 var end = inputUnzonedRange.getEnd(); 4139 if (start) { 4140 start = this.skipHiddenDays(start); 4141 } 4142 if (end) { 4143 end = this.skipHiddenDays(end, -1, true); 4144 } 4145 if (start === null || end === null || start < end) { 4146 return new UnzonedRange_1.default(start, end); 4147 } 4148 return null; 4149 }; 4150 // Is the current day hidden? 4151 // `day` is a day-of-week index (0-6), or a Moment
4152 View.prototype.isHiddenDay = function (day) { 4153 if (moment.isMoment(day)) { 4154 day = day.day(); 4155 } 4156 return this.isHiddenDayHash[day]; 4157 }; 4158 // Incrementing the current day until it is no longer a hidden day, returning a copy. 4159 // DOES NOT CONSIDER validUnzonedRange! 4160 // If the initial value of `date` is not a hidden day, don't do anything. 4161 // Pass `isExclusive` as `true` if you are dealing with an end date. 4162 // `inc` defaults to `1` (increment one day forward each time) 4163 View.prototype.skipHiddenDays = function (date, inc, isExclusive) { 4164 if (inc === void 0) { inc = 1; } 4165 if (isExclusive === void 0) { isExclusive = false; } 4166 var out = date.clone(); 4167 while (this.isHiddenDayHash[(out.day() + (isExclusive ? inc : 0) + 7) % 7]) { 4168 out.add(inc, 'days'); 4169 } 4170 return out; 4171 }; 4172 return View; 4173}(InteractiveDateComponent_1.default)); 4174exports.default = View; 4175View.prototype.usesMinMaxTime = false; 4176View.prototype.dateProfileGeneratorClass = DateProfileGenerator_1.default; 4177View.watch('displayingDates', ['isInDom', 'dateProfile'], function (deps) { 4178 this.requestDateRender(deps.dateProfile); 4179}, function () { 4180 this.requestDateUnrender(); 4181}); 4182View.watch('displayingBusinessHours', ['displayingDates', 'businessHourGenerator'], function (deps) { 4183 this.requestBusinessHoursRender(deps.businessHourGenerator); 4184}, function () { 4185 this.requestBusinessHoursUnrender(); 4186}); 4187View.watch('initialEvents', ['dateProfile'], function (deps) { 4188 return this.fetchInitialEvents(deps.dateProfile); 4189}); 4190View.watch('bindingEvents', ['initialEvents'], function (deps) { 4191 this.setEvents(deps.initialEvents); 4192 this.bindEventChanges(); 4193}, function () { 4194 this.unbindEventChanges(); 4195 this.unsetEvents(); 4196}); 4197View.watch('displayingEvents', ['displayingDates', 'hasEvents'], function () { 4198 this.requestEventsRender(this.get('currentEvents')); 4199}, function () { 4200 this.requestEventsUnrender(); 4201}); 4202View.watch('title', ['dateProfile'], function (deps) { 4203 return (this.title = this.computeTitle(deps.dateProfile)); // assign to View for legacy reasons 4204}); 4205View.watch('legacyDateProps', ['dateProfile'], function (deps) { 4206 var calendar = this.calendar; 4207 var dateProfile = deps.dateProfile; 4208 // DEPRECATED, but we need to keep it updated... 4209 this.start = calendar.msToMoment(dateProfile.activeUnzonedRange.startMs, dateProfile.isRangeAllDay); 4210 this.end = calendar.msToMoment(dateProfile.activeUnzonedRange.endMs, dateProfile.isRangeAllDay); 4211 this.intervalStart = calendar.msToMoment(dateProfile.currentUnzonedRange.startMs, dateProfile.isRangeAllDay); 4212 this.intervalEnd = calendar.msToMoment(dateProfile.currentUnzonedRange.endMs, dateProfile.isRangeAllDay); 4213}); 4214 4215 4216/***/ }), 4217/* 42 */ 4218/***/ (function(module, exports, __webpack_require__) { 4219 4220Object.defineProperty(exports, "__esModule", { value: true }); 4221var $ = __webpack_require__(3); 4222var util_1 = __webpack_require__(4); 4223var EventRenderer = /** @class */ (function () { 4224 function EventRenderer(component, fillRenderer) { 4225 this.view = component._getView(); 4226 this.component = component; 4227 this.fillRenderer = fillRenderer; 4228 } 4229 EventRenderer.prototype.opt = function (name) { 4230 return this.view.opt(name); 4231 }; 4232 // Updates values that rely on options and also relate to range 4233 EventRenderer.prototype.rangeUpdated = function () { 4234 var displayEventTime; 4235 var displayEventEnd; 4236 this.eventTimeFormat = 4237 this.opt('eventTimeFormat') || 4238 this.opt('timeFormat') || // deprecated 4239 this.computeEventTimeFormat(); 4240 displayEventTime = this.opt('displayEventTime'); 4241 if (displayEventTime == null) { 4242 displayEventTime = this.computeDisplayEventTime(); // might be based off of range 4243 } 4244 displayEventEnd = this.opt('displayEventEnd'); 4245 if (displayEventEnd == null) { 4246 displayEventEnd = this.computeDisplayEventEnd(); // might be based off of range 4247 } 4248 this.displayEventTime = displayEventTime; 4249 this.displayEventEnd = displayEventEnd; 4250 }; 4251 EventRenderer.prototype.render = function (eventsPayload) { 4252 var dateProfile = this.component._getDateProfile(); 4253 var eventDefId; 4254 var instanceGroup; 4255 var eventRanges;
4256 var bgRanges = []; 4257 var fgRanges = []; 4258 for (eventDefId in eventsPayload) { 4259 instanceGroup = eventsPayload[eventDefId]; 4260 eventRanges = instanceGroup.sliceRenderRanges(dateProfile.activeUnzonedRange); 4261 if (instanceGroup.getEventDef().hasBgRendering()) { 4262 bgRanges.push.apply(bgRanges, eventRanges); 4263 } 4264 else { 4265 fgRanges.push.apply(fgRanges, eventRanges); 4266 } 4267 } 4268 this.renderBgRanges(bgRanges); 4269 this.renderFgRanges(fgRanges); 4270 }; 4271 EventRenderer.prototype.unrender = function () { 4272 this.unrenderBgRanges(); 4273 this.unrenderFgRanges(); 4274 }; 4275 EventRenderer.prototype.renderFgRanges = function (eventRanges) { 4276 var eventFootprints = this.component.eventRangesToEventFootprints(eventRanges); 4277 var segs = this.component.eventFootprintsToSegs(eventFootprints); 4278 // render an `.el` on each seg 4279 // returns a subset of the segs. segs that were actually rendered 4280 segs = this.renderFgSegEls(segs); 4281 if (this.renderFgSegs(segs) !== false) { 4282 this.fgSegs = segs; 4283 } 4284 }; 4285 EventRenderer.prototype.unrenderFgRanges = function () { 4286 this.unrenderFgSegs(this.fgSegs || []); 4287 this.fgSegs = null; 4288 }; 4289 EventRenderer.prototype.renderBgRanges = function (eventRanges) { 4290 var eventFootprints = this.component.eventRangesToEventFootprints(eventRanges); 4291 var segs = this.component.eventFootprintsToSegs(eventFootprints); 4292 if (this.renderBgSegs(segs) !== false) { 4293 this.bgSegs = segs; 4294 } 4295 }; 4296 EventRenderer.prototype.unrenderBgRanges = function () { 4297 this.unrenderBgSegs(); 4298 this.bgSegs = null; 4299 }; 4300 EventRenderer.prototype.getSegs = function () { 4301 return (this.bgSegs || []).concat(this.fgSegs || []); 4302 }; 4303 // Renders foreground event segments onto the grid 4304 EventRenderer.prototype.renderFgSegs = function (segs) { 4305 // subclasses must implement 4306 // segs already has rendered els, and has been filtered. 4307 return false; // signal failure if not implemented 4308 }; 4309 // Unrenders all currently rendered foreground segments 4310 EventRenderer.prototype.unrenderFgSegs = function (segs) { 4311 // subclasses must implement 4312 }; 4313 EventRenderer.prototype.renderBgSegs = function (segs) { 4314 var _this = this; 4315 if (this.fillRenderer) { 4316 this.fillRenderer.renderSegs('bgEvent', segs, { 4317 getClasses: function (seg) { 4318 return _this.getBgClasses(seg.footprint.eventDef); 4319 }, 4320 getCss: function (seg) { 4321 return { 4322 'background-color': _this.getBgColor(seg.footprint.eventDef) 4323 }; 4324 }, 4325 filterEl: function (seg, el) { 4326 return _this.filterEventRenderEl(seg.footprint, el); 4327 } 4328 }); 4329 } 4330 else { 4331 return false; // signal failure if no fillRenderer 4332 } 4333 }; 4334 EventRenderer.prototype.unrenderBgSegs = function () { 4335 if (this.fillRenderer) { 4336 this.fillRenderer.unrender('bgEvent'); 4337 } 4338 }; 4339 // Renders and assigns an `el` property for each foreground event segment. 4340 // Only returns segments that successfully rendered. 4341 EventRenderer.prototype.renderFgSegEls = function (segs, disableResizing) { 4342 var _this = this; 4343 if (disableResizing === void 0) { disableResizing = false; } 4344 var hasEventRenderHandlers = this.view.hasPublicHandlers('eventRender'); 4345 var html = ''; 4346 var renderedSegs = []; 4347 var i; 4348 if (segs.length) { 4349 // build a large concatenation of event segment HTML 4350 for (i = 0; i < segs.length; i++) { 4351 this.beforeFgSegHtml(segs[i]); 4352 html += this.fgSegHtml(segs[i], disableResizing); 4353 } 4354 // Grab individual elements from the combined HTML string. Use each as the default rendering. 4355 // Then, compute the 'el' for each segment. An el might be null if the eventRender callback returned false. 4356 $(html).each(function (i, node) { 4357 var seg = segs[i]; 4358 var el = $(node); 4359 if (hasEventRenderHandlers) { 4360 el = _this.filterEventRenderEl(seg.footprint, el); 4361 } 4362 if (el) { 4363 el.data('fc-seg', seg); // used by handlers 4364 seg.el = el; 4365 renderedSegs.push(seg); 4366 } 4367 }); 4368 } 4369 return renderedSegs; 4370 }; 4371 EventRenderer.prototype.beforeFgSegHtml = function (seg) { 4372 }; 4373 // Generates the HTML for the default rendering of a foreground event segment. Used by renderFgSegEls() 4374 EventRenderer.prototype.fgSegHtml = function (seg, disableResizing) { 4375 // subclasses should implement 4376 }; 4377 // Generic utility for generating the HTML classNames for an event segment's element 4378 EventRenderer.prototype.getSegClasses = function (seg, isDraggable, isResizable) { 4379 var classes = [ 4380 'fc-event', 4381 seg.isStart ? 'fc-start' : 'fc-not-start', 4382 seg.isEnd ? 'fc-end' : 'fc-not-end' 4383 ].concat(this.getClasses(seg.footprint.eventDef)); 4384 if (isDraggable) { 4385 classes.push('fc-draggable'); 4386 } 4387 if (isResizable) { 4388 classes.push('fc-resizable'); 4389 } 4390 // event is currently selected? attach a className. 4391 if (this.view.isEventDefSelected(seg.footprint.eventDef)) { 4392 classes.push('fc-selected'); 4393 } 4394 return classes; 4395 }; 4396 // Given an event and the default element used for rendering, returns the element that should actually be used. 4397 // Basically runs events and elements through the eventRender hook. 4398 EventRenderer.prototype.filterEventRenderEl = function (eventFootprint, el) { 4399 var legacy = eventFootprint.getEventLegacy(); 4400 var custom = this.view.publiclyTrigger('eventRender', { 4401 context: legacy, 4402 args: [legacy, el, this.view] 4403 }); 4404 if (custom === false) { 4405 el = null; 4406 } 4407 else if (custom && custom !== true) { 4408 el = $(custom); 4409 } 4410 return el; 4411 }; 4412 // Compute the text that should be displayed on an event's element. 4413 // `range` can be the Event object itself, or something range-like, with at least a `start`. 4414 // If event times are disabled, or the event has no time, will return a blank string. 4415 // If not specified, formatStr will default to the eventTimeFormat setting, 4416 // and displayEnd will default to the displayEventEnd setting. 4417 EventRenderer.prototype.getTimeText = function (eventFootprint, formatStr, displayEnd) { 4418 return this._getTimeText(eventFootprint.eventInstance.dateProfile.start, eventFootprint.eventInstance.dateProfile.end, eventFootprint.componentFootprint.isAllDay, formatStr, displayEnd); 4419 }; 4420 EventRenderer.prototype._getTimeText = function (start, end, isAllDay, formatStr, displayEnd) { 4421 if (formatStr == null) { 4422 formatStr = this.eventTimeFormat; 4423 } 4424 if (displayEnd == null) { 4425 displayEnd = this.displayEventEnd; 4426 } 4427 if (this.displayEventTime && !isAllDay) { 4428 if (displayEnd && end) { 4429 return this.view.formatRange({ start: start, end: end }, false, // allDay 4430 formatStr); 4431 } 4432 else { 4433 return start.format(formatStr); 4434 } 4435 } 4436 return ''; 4437 }; 4438 EventRenderer.prototype.computeEventTimeFormat = function () { 4439 return this.opt('smallTimeFormat'); 4440 }; 4441 EventRenderer.prototype.computeDisplayEventTime = function () { 4442 return true; 4443 }; 4444 EventRenderer.prototype.computeDisplayEventEnd = function () { 4445 return true; 4446 }; 4447 EventRenderer.prototype.getBgClasses = function (eventDef) { 4448 var classNames = this.getClasses(eventDef); 4449 classNames.push('fc-bgevent'); 4450 return classNames; 4451 }; 4452 EventRenderer.prototype.getClasses = function (eventDef) {
4453 var objs = this.getStylingObjs(eventDef); 4454 var i; 4455 var classNames = []; 4456 for (i = 0; i < objs.length; i++) { 4457 classNames.push.apply(// append 4458 classNames, objs[i].eventClassName || objs[i].className || []); 4459 } 4460 return classNames; 4461 }; 4462 // Utility for generating event skin-related CSS properties 4463 EventRenderer.prototype.getSkinCss = function (eventDef) { 4464 return { 4465 'background-color': this.getBgColor(eventDef), 4466 'border-color': this.getBorderColor(eventDef), 4467 color: this.getTextColor(eventDef) 4468 }; 4469 }; 4470 // Queries for caller-specified color, then falls back to default 4471 EventRenderer.prototype.getBgColor = function (eventDef) { 4472 var objs = this.getStylingObjs(eventDef); 4473 var i; 4474 var val; 4475 for (i = 0; i < objs.length && !val; i++) { 4476 val = objs[i].eventBackgroundColor || objs[i].eventColor || 4477 objs[i].backgroundColor || objs[i].color; 4478 } 4479 if (!val) { 4480 val = this.opt('eventBackgroundColor') || this.opt('eventColor'); 4481 } 4482 return val; 4483 }; 4484 // Queries for caller-specified color, then falls back to default 4485 EventRenderer.prototype.getBorderColor = function (eventDef) { 4486 var objs = this.getStylingObjs(eventDef); 4487 var i; 4488 var val; 4489 for (i = 0; i < objs.length && !val; i++) { 4490 val = objs[i].eventBorderColor || objs[i].eventColor || 4491 objs[i].borderColor || objs[i].color; 4492 } 4493 if (!val) { 4494 val = this.opt('eventBorderColor') || this.opt('eventColor'); 4495 } 4496 return val; 4497 }; 4498 // Queries for caller-specified color, then falls back to default 4499 EventRenderer.prototype.getTextColor = function (eventDef) { 4500 var objs = this.getStylingObjs(eventDef); 4501 var i; 4502 var val; 4503 for (i = 0; i < objs.length && !val; i++) { 4504 val = objs[i].eventTextColor || 4505 objs[i].textColor; 4506 } 4507 if (!val) { 4508 val = this.opt('eventTextColor'); 4509 } 4510 return val; 4511 }; 4512 EventRenderer.prototype.getStylingObjs = function (eventDef) { 4513 var objs = this.getFallbackStylingObjs(eventDef); 4514 objs.unshift(eventDef); 4515 return objs; 4516 }; 4517 EventRenderer.prototype.getFallbackStylingObjs = function (eventDef) { 4518 return [eventDef.source]; 4519 }; 4520 EventRenderer.prototype.sortEventSegs = function (segs) { 4521 segs.sort(util_1.proxy(this, 'compareEventSegs')); 4522 }; 4523 // A cmp function for determining which segments should take visual priority 4524 EventRenderer.prototype.compareEventSegs = function (seg1, seg2) { 4525 var f1 = seg1.footprint; 4526 var f2 = seg2.footprint; 4527 var cf1 = f1.componentFootprint; 4528 var cf2 = f2.componentFootprint; 4529 var r1 = cf1.unzonedRange; 4530 var r2 = cf2.unzonedRange; 4531 return r1.startMs - r2.startMs || // earlier events go first 4532 (r2.endMs - r2.startMs) - (r1.endMs - r1.startMs) || // tie? longer events go first 4533 cf2.isAllDay - cf1.isAllDay || // tie? put all-day events first (booleans cast to 0/1) 4534 util_1.compareByFieldSpecs(f1.eventDef, f2.eventDef, this.view.eventOrderSpecs, f1.eventDef.miscProps, f2.eventDef.miscProps); 4535 }; 4536 return EventRenderer; 4537}()); 4538exports.default = EventRenderer; 4539 4540 4541/***/ }), 4542/* 43 */, 4543/* 44 */, 4544/* 45 */, 4545/* 46 */, 4546/* 47 */ 4547/***/ (function(module, exports, __webpack_require__) { 4548 4549Object.defineProperty(exports, "__esModule", { value: true }); 4550var moment_ext_1 = __webpack_require__(10); 4551// Plugin 4552// ------------------------------------------------------------------------------------------------- 4553moment_ext_1.newMomentProto.format = function () { 4554 if (this._fullCalendar && arguments[0]) { 4555 return formatDate(this, arguments[0]); // our extended formatting 4556 } 4557 if (this._ambigTime) { 4558 return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD'); 4559 } 4560 if (this._ambigZone) { 4561 return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD[T]HH:mm:ss'); 4562 } 4563 if (this._fullCalendar) { 4564 // moment.format() doesn't ensure english, but we want to. 4565 return moment_ext_1.oldMomentFormat(englishMoment(this)); 4566 } 4567 return moment_ext_1.oldMomentProto.format.apply(this, arguments); 4568}; 4569moment_ext_1.newMomentProto.toISOString = function () { 4570 if (this._ambigTime) { 4571 return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD'); 4572 } 4573 if (this._ambigZone) { 4574 return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD[T]HH:mm:ss'); 4575 } 4576 if (this._fullCalendar) { 4577 // depending on browser, moment might not output english. ensure english. 4578 // https://github.com/moment/moment/blob/2.18.1/src/lib/moment/format.js#L22 4579 return moment_ext_1.oldMomentProto.toISOString.apply(englishMoment(this), arguments); 4580 } 4581 return moment_ext_1.oldMomentProto.toISOString.apply(this, arguments); 4582}; 4583function englishMoment(mom) { 4584 if (mom.locale() !== 'en') { 4585 return mom.clone().locale('en'); 4586 } 4587 return mom; 4588} 4589// Config 4590// --------------------------------------------------------------------------------------------------------------------- 4591/* 4592Inserted between chunks in the fake ("intermediate") formatting string. 4593Important that it passes as whitespace (\s) because moment often identifies non-standalone months 4594via a regexp with an \s. 4595*/ 4596var PART_SEPARATOR = '\u000b'; // vertical tab 4597/* 4598Inserted as the first character of a literal-text chunk to indicate that the literal text is not actually literal text, 4599but rather, a "special" token that has custom rendering (see specialTokens map). 4600*/ 4601var SPECIAL_TOKEN_MARKER = '\u001f'; // information separator 1 4602/* 4603Inserted at the beginning and end of a span of text that must have non-zero numeric characters. 4604Handling of these markers is done in a post-processing step at the very end of text rendering. 4605*/ 4606var MAYBE_MARKER = '\u001e'; // information separator 2 4607var MAYBE_REGEXP = new RegExp(MAYBE_MARKER + '([^' + MAYBE_MARKER + ']*)' + MAYBE_MARKER, 'g'); // must be global 4608/* 4609Addition formatting tokens we want recognized 4610*/ 4611var specialTokens = { 4612 t: function (date) { 4613 return moment_ext_1.oldMomentFormat(date, 'a').charAt(0);
4614 }, 4615 T: function (date) { 4616 return moment_ext_1.oldMomentFormat(date, 'A').charAt(0); 4617 } 4618}; 4619/* 4620The first characters of formatting tokens for units that are 1 day or larger. 4621`value` is for ranking relative size (lower means bigger). 4622`unit` is a normalized unit, used for comparing moments. 4623*/ 4624var largeTokenMap = { 4625 Y: { value: 1, unit: 'year' }, 4626 M: { value: 2, unit: 'month' }, 4627 W: { value: 3, unit: 'week' }, 4628 w: { value: 3, unit: 'week' }, 4629 D: { value: 4, unit: 'day' }, 4630 d: { value: 4, unit: 'day' } // day of week 4631}; 4632// Single Date Formatting 4633// --------------------------------------------------------------------------------------------------------------------- 4634/* 4635Formats `date` with a Moment formatting string, but allow our non-zero areas and special token 4636*/ 4637function formatDate(date, formatStr) { 4638 return renderFakeFormatString(getParsedFormatString(formatStr).fakeFormatString, date); 4639} 4640exports.formatDate = formatDate; 4641// Date Range Formatting 4642// ------------------------------------------------------------------------------------------------- 4643// TODO: make it work with timezone offset 4644/* 4645Using a formatting string meant for a single date, generate a range string, like 4646"Sep 2 - 9 2013", that intelligently inserts a separator where the dates differ. 4647If the dates are the same as far as the format string is concerned, just return a single 4648rendering of one date, without any separator. 4649*/ 4650function formatRange(date1, date2, formatStr, separator, isRTL) { 4651 var localeData; 4652 date1 = moment_ext_1.default.parseZone(date1); 4653 date2 = moment_ext_1.default.parseZone(date2); 4654 localeData = date1.localeData(); 4655 // Expand localized format strings, like "LL" -> "MMMM D YYYY". 4656 // BTW, this is not important for `formatDate` because it is impossible to put custom tokens 4657 // or non-zero areas in Moment's localized format strings. 4658 formatStr = localeData.longDateFormat(formatStr) || formatStr; 4659 return renderParsedFormat(getParsedFormatString(formatStr), date1, date2, separator || ' - ', isRTL); 4660} 4661exports.formatRange = formatRange; 4662/* 4663Renders a range with an already-parsed format string. 4664*/ 4665function renderParsedFormat(parsedFormat, date1, date2, separator, isRTL) { 4666 var sameUnits = parsedFormat.sameUnits; 4667 var unzonedDate1 = date1.clone().stripZone(); // for same-unit comparisons 4668 var unzonedDate2 = date2.clone().stripZone(); // " 4669 var renderedParts1 = renderFakeFormatStringParts(parsedFormat.fakeFormatString, date1); 4670 var renderedParts2 = renderFakeFormatStringParts(parsedFormat.fakeFormatString, date2); 4671 var leftI; 4672 var leftStr = ''; 4673 var rightI; 4674 var rightStr = ''; 4675 var middleI; 4676 var middleStr1 = ''; 4677 var middleStr2 = ''; 4678 var middleStr = ''; 4679 // Start at the leftmost side of the formatting string and continue until you hit a token 4680 // that is not the same between dates. 4681 for (leftI = 0; leftI < sameUnits.length && (!sameUnits[leftI] || unzonedDate1.isSame(unzonedDate2, sameUnits[leftI])); leftI++) { 4682 leftStr += renderedParts1[leftI]; 4683 } 4684 // Similarly, start at the rightmost side of the formatting string and move left 4685 for (rightI = sameUnits.length - 1; rightI > leftI && (!sameUnits[rightI] || unzonedDate1.isSame(unzonedDate2, sameUnits[rightI])); rightI--) { 4686 // If current chunk is on the boundary of unique date-content, and is a special-case 4687 // date-formatting postfix character, then don't consume it. Consider it unique date-content. 4688 // TODO: make configurable 4689 if (rightI - 1 === leftI && renderedParts1[rightI] === '.') { 4690 break; 4691 } 4692 rightStr = renderedParts1[rightI] + rightStr; 4693 } 4694 // The area in the middle is different for both of the dates. 4695 // Collect them distinctly so we can jam them together later. 4696 for (middleI = leftI; middleI <= rightI; middleI++) { 4697 middleStr1 += renderedParts1[middleI]; 4698 middleStr2 += renderedParts2[middleI]; 4699 } 4700 if (middleStr1 || middleStr2) { 4701 if (isRTL) { 4702 middleStr = middleStr2 + separator + middleStr1;
4703 } 4704 else { 4705 middleStr = middleStr1 + separator + middleStr2; 4706 } 4707 } 4708 return processMaybeMarkers(leftStr + middleStr + rightStr); 4709} 4710// Format String Parsing 4711// --------------------------------------------------------------------------------------------------------------------- 4712var parsedFormatStrCache = {}; 4713/* 4714Returns a parsed format string, leveraging a cache. 4715*/ 4716function getParsedFormatString(formatStr) { 4717 return parsedFormatStrCache[formatStr] || 4718 (parsedFormatStrCache[formatStr] = parseFormatString(formatStr)); 4719} 4720/* 4721Parses a format string into the following: 4722- fakeFormatString: a momentJS formatting string, littered with special control characters that get post-processed. 4723- sameUnits: for every part in fakeFormatString, if the part is a token, the value will be a unit string (like "day"), 4724 that indicates how similar a range's start & end must be in order to share the same formatted text. 4725 If not a token, then the value is null. 4726 Always a flat array (not nested liked "chunks"). 4727*/ 4728function parseFormatString(formatStr) { 4729 var chunks = chunkFormatString(formatStr); 4730 return { 4731 fakeFormatString: buildFakeFormatString(chunks), 4732 sameUnits: buildSameUnits(chunks) 4733 }; 4734} 4735/* 4736Break the formatting string into an array of chunks. 4737A 'maybe' chunk will have nested chunks. 4738*/ 4739function chunkFormatString(formatStr) { 4740 var chunks = []; 4741 var match; 4742 // TODO: more descrimination 4743 // \4 is a backreference to the first character of a multi-character set.
4744 var chunker = /\[([^\]]*)\]|\(([^\)]*)\)|(LTS|LT|(\w)\4*o?)|([^\w\[\(]+)/g; 4745 while ((match = chunker.exec(formatStr))) { 4746 if (match[1]) { 4747 chunks.push.apply(chunks, // append 4748 splitStringLiteral(match[1])); 4749 } 4750 else if (match[2]) { 4751 chunks.push({ maybe: chunkFormatString(match[2]) }); 4752 } 4753 else if (match[3]) { 4754 chunks.push({ token: match[3] }); 4755 } 4756 else if (match[5]) { 4757 chunks.push.apply(chunks, // append 4758 splitStringLiteral(match[5])); 4759 } 4760 } 4761 return chunks; 4762} 4763/* 4764Potentially splits a literal-text string into multiple parts. For special cases. 4765*/ 4766function splitStringLiteral(s) { 4767 if (s === '. ') { 4768 return ['.', ' ']; // for locales with periods bound to the end of each year/month/date 4769 } 4770 else { 4771 return [s]; 4772 } 4773} 4774/* 4775Given chunks parsed from a real format string, generate a fake (aka "intermediate") format string with special control 4776characters that will eventually be given to moment for formatting, and then post-processed. 4777*/ 4778function buildFakeFormatString(chunks) { 4779 var parts = []; 4780 var i; 4781 var chunk; 4782 for (i = 0; i < chunks.length; i++) { 4783 chunk = chunks[i]; 4784 if (typeof chunk === 'string') { 4785 parts.push('[' + chunk + ']'); 4786 } 4787 else if (chunk.token) { 4788 if (chunk.token in specialTokens) { 4789 parts.push(SPECIAL_TOKEN_MARKER + // useful during post-processing 4790 '[' + chunk.token + ']' // preserve as literal text 4791 ); 4792 } 4793 else { 4794 parts.push(chunk.token); // unprotected text implies a format string 4795 } 4796 } 4797 else if (chunk.maybe) { 4798 parts.push(MAYBE_MARKER + // useful during post-processing 4799 buildFakeFormatString(chunk.maybe) + 4800 MAYBE_MARKER); 4801 } 4802 } 4803 return parts.join(PART_SEPARATOR); 4804} 4805/* 4806Given parsed chunks from a real formatting string, generates an array of unit strings (like "day") that indicate 4807in which regard two dates must be similar in order to share range formatting text. 4808The `chunks` can be nested (because of "maybe" chunks), however, the returned array will be flat. 4809*/ 4810function buildSameUnits(chunks) { 4811 var units = []; 4812 var i; 4813 var chunk; 4814 var tokenInfo; 4815 for (i = 0; i < chunks.length; i++) { 4816 chunk = chunks[i]; 4817 if (chunk.token) { 4818 tokenInfo = largeTokenMap[chunk.token.charAt(0)]; 4819 units.push(tokenInfo ? tokenInfo.unit : 'second'); // default to a very strict same-second 4820 } 4821 else if (chunk.maybe) { 4822 units.push.apply(units, // append 4823 buildSameUnits(chunk.maybe)); 4824 } 4825 else { 4826 units.push(null); 4827 } 4828 } 4829 return units; 4830} 4831// Rendering to text 4832// --------------------------------------------------------------------------------------------------------------------- 4833/* 4834Formats a date with a fake format string, post-processes the control characters, then returns. 4835*/ 4836function renderFakeFormatString(fakeFormatString, date) { 4837 return processMaybeMarkers(renderFakeFormatStringParts(fakeFormatString, date).join('')); 4838} 4839/* 4840Formats a date into parts that will have been post-processed, EXCEPT for the "maybe" markers. 4841*/ 4842function renderFakeFormatStringParts(fakeFormatString, date) { 4843 var parts = []; 4844 var fakeRender = moment_ext_1.oldMomentFormat(date, fakeFormatString); 4845 var fakeParts = fakeRender.split(PART_SEPARATOR); 4846 var i; 4847 var fakePart; 4848 for (i = 0; i < fakeParts.length; i++) { 4849 fakePart = fakeParts[i]; 4850 if (fakePart.charAt(0) === SPECIAL_TOKEN_MARKER) { 4851 parts.push( 4852 // the literal string IS the token's name. 4853 // call special token's registered function. 4854 specialTokens[fakePart.substring(1)](date)); 4855 } 4856 else { 4857 parts.push(fakePart); 4858 } 4859 } 4860 return parts; 4861} 4862/* 4863Accepts an almost-finally-formatted string and processes the "maybe" control characters, returning a new string. 4864*/ 4865function processMaybeMarkers(s) { 4866 return s.replace(MAYBE_REGEXP, function (m0, m1) { 4867 if (m1.match(/[1-9]/)) { 4868 return m1; 4869 } 4870 else { 4871 return ''; 4872 } 4873 });
4874} 4875// Misc Utils 4876// ------------------------------------------------------------------------------------------------- 4877/* 4878Returns a unit string, either 'year', 'month', 'day', or null for the most granular formatting token in the string. 4879*/ 4880function queryMostGranularFormatUnit(formatStr) { 4881 var chunks = chunkFormatString(formatStr); 4882 var i; 4883 var chunk; 4884 var candidate; 4885 var best; 4886 for (i = 0; i < chunks.length; i++) { 4887 chunk = chunks[i]; 4888 if (chunk.token) { 4889 candidate = largeTokenMap[chunk.token.charAt(0)]; 4890 if (candidate) { 4891 if (!best || candidate.value > best.value) { 4892 best = candidate; 4893 } 4894 } 4895 } 4896 } 4897 if (best) { 4898 return best.unit; 4899 } 4900 return null; 4901} 4902exports.queryMostGranularFormatUnit = queryMostGranularFormatUnit; 4903 4904 4905/***/ }), 4906/* 48 */ 4907/***/ (function(module, exports, __webpack_require__) { 4908 4909Object.defineProperty(exports, "__esModule", { value: true }); 4910var tslib_1 = __webpack_require__(2); 4911var Class_1 = __webpack_require__(33); 4912var EmitterMixin_1 = __webpack_require__(11); 4913var ListenerMixin_1 = __webpack_require__(7); 4914var Model = /** @class */ (function (_super) { 4915 tslib_1.__extends(Model, _super); 4916 function Model() { 4917 var _this = _super.call(this) || this; 4918 _this._watchers = {}; 4919 _this._props = {}; 4920 _this.applyGlobalWatchers(); 4921 _this.constructed(); 4922 return _this; 4923 } 4924 Model.watch = function (name) { 4925 var args = []; 4926 for (var _i = 1; _i < arguments.length; _i++) { 4927 args[_i - 1] = arguments[_i]; 4928 } 4929 // subclasses should make a masked-copy of the superclass's map 4930 // TODO: write test 4931 if (!this.prototype.hasOwnProperty('_globalWatchArgs')) { 4932 this.prototype._globalWatchArgs = Object.create(this.prototype._globalWatchArgs); 4933 } 4934 this.prototype._globalWatchArgs[name] = args; 4935 }; 4936 Model.prototype.constructed = function () { 4937 // useful for monkeypatching. TODO: BaseClass? 4938 }; 4939 Model.prototype.applyGlobalWatchers = function () { 4940 var map = this._globalWatchArgs; 4941 var name; 4942 for (name in map) { 4943 this.watch.apply(this, [name].concat(map[name])); 4944 } 4945 }; 4946 Model.prototype.has = function (name) { 4947 return name in this._props; 4948 }; 4949 Model.prototype.get = function (name) { 4950 if (name === undefined) { 4951 return this._props; 4952 } 4953 return this._props[name]; 4954 }; 4955 Model.prototype.set = function (name, val) { 4956 var newProps; 4957 if (typeof name === 'string') { 4958 newProps = {}; 4959 newProps[name] = val === undefined ? null : val; 4960 } 4961 else { 4962 newProps = name; 4963 } 4964 this.setProps(newProps); 4965 }; 4966 Model.prototype.reset = function (newProps) { 4967 var oldProps = this._props; 4968 var changeset = {}; // will have undefined's to signal unsets 4969 var name; 4970 for (name in oldProps) { 4971 changeset[name] = undefined; 4972 } 4973 for (name in newProps) { 4974 changeset[name] = newProps[name]; 4975 } 4976 this.setProps(changeset); 4977 }; 4978 Model.prototype.unset = function (name) { 4979 var newProps = {}; 4980 var names; 4981 var i; 4982 if (typeof name === 'string') { 4983 names = [name]; 4984 } 4985 else { 4986 names = name; 4987 } 4988 for (i = 0; i < names.length; i++) { 4989 newProps[names[i]] = undefined; 4990 } 4991 this.setProps(newProps); 4992 }; 4993 Model.prototype.setProps = function (newProps) { 4994 var changedProps = {}; 4995 var changedCnt = 0; 4996 var name; 4997 var val; 4998 for (name in newProps) { 4999 val = newProps[name]; 5000 // a change in value? 5001 // if an object, don't check equality, because might have been mutated internally. 5002 // TODO: eventually enforce immutability. 5003 if (typeof val === 'object' || 5004 val !== this._props[name]) { 5005 changedProps[name] = val; 5006 changedCnt++; 5007 } 5008 } 5009 if (changedCnt) { 5010 this.trigger('before:batchChange', changedProps); 5011 for (name in changedProps) { 5012 val = changedProps[name]; 5013 this.trigger('before:change', name, val); 5014 this.trigger('before:change:' + name, val); 5015 } 5016 for (name in changedProps) { 5017 val = changedProps[name]; 5018 if (val === undefined) { 5019 delete this._props[name]; 5020 } 5021 else { 5022 this._props[name] = val; 5023 } 5024 this.trigger('change:' + name, val); 5025 this.trigger('change', name, val); 5026 } 5027 this.trigger('batchChange', changedProps); 5028 } 5029 }; 5030 Model.prototype.watch = function (name, depList, startFunc, stopFunc) { 5031 var _this = this; 5032 this.unwatch(name); 5033 this._watchers[name] = this._watchDeps(depList, function (deps) { 5034 var res = startFunc.call(_this, deps); 5035 if (res && res.then) { 5036 _this.unset(name); // put in an unset state while resolving 5037 res.then(function (val) { 5038 _this.set(name, val); 5039 }); 5040 } 5041 else { 5042 _this.set(name, res); 5043 } 5044 }, function (deps) { 5045 _this.unset(name); 5046 if (stopFunc) { 5047 stopFunc.call(_this, deps); 5048 } 5049 }); 5050 }; 5051 Model.prototype.unwatch = function (name) { 5052 var watcher = this._watchers[name]; 5053 if (watcher) { 5054 delete this._watchers[name]; 5055 watcher.teardown(); 5056 } 5057 }; 5058 Model.prototype._watchDeps = function (depList, startFunc, stopFunc) { 5059 var _this = this; 5060 var queuedChangeCnt = 0; 5061 var depCnt = depList.length; 5062 var satisfyCnt = 0; 5063 var values = {}; // what's passed as the `deps` arguments 5064 var bindTuples = []; // array of [ eventName, handlerFunc ] arrays 5065 var isCallingStop = false; 5066 var onBeforeDepChange = function (depName, val, isOptional) { 5067 queuedChangeCnt++; 5068 if (queuedChangeCnt === 1) { 5069 if (satisfyCnt === depCnt) { 5070 isCallingStop = true; 5071 stopFunc(values); 5072 isCallingStop = false; 5073 } 5074 } 5075 }; 5076 var onDepChange = function (depName, val, isOptional) { 5077 if (val === undefined) { 5078 // required dependency that was previously set? 5079 if (!isOptional && values[depName] !== undefined) { 5080 satisfyCnt--; 5081 } 5082 delete values[depName]; 5083 } 5084 else { 5085 // required dependency that was previously unset? 5086 if (!isOptional && values[depName] === undefined) { 5087 satisfyCnt++; 5088 } 5089 values[depName] = val; 5090 } 5091 queuedChangeCnt--; 5092 if (!queuedChangeCnt) { 5093 // now finally satisfied or satisfied all along? 5094 if (satisfyCnt === depCnt) { 5095 // if the stopFunc initiated another value change, ignore it. 5096 // it will be processed by another change event anyway. 5097 if (!isCallingStop) { 5098 startFunc(values); 5099 } 5100 } 5101 } 5102 }; 5103 // intercept for .on() that remembers handlers 5104 var bind = function (eventName, handler) { 5105 _this.on(eventName, handler); 5106 bindTuples.push([eventName, handler]); 5107 }; 5108 // listen to dependency changes 5109 depList.forEach(function (depName) { 5110 var isOptional = false; 5111 if (depName.charAt(0) === '?') { 5112 depName = depName.substring(1); 5113 isOptional = true; 5114 } 5115 bind('before:change:' + depName, function (val) { 5116 onBeforeDepChange(depName, val, isOptional); 5117 }); 5118 bind('change:' + depName, function (val) { 5119 onDepChange(depName, val, isOptional); 5120 }); 5121 }); 5122 // process current dependency values 5123 depList.forEach(function (depName) { 5124 var isOptional = false; 5125 if (depName.charAt(0) === '?') { 5126 depName = depName.substring(1); 5127 isOptional = true; 5128 } 5129 if (_this.has(depName)) { 5130 values[depName] = _this.get(depName); 5131 satisfyCnt++; 5132 } 5133 else if (isOptional) { 5134 satisfyCnt++; 5135 } 5136 }); 5137 // initially satisfied 5138 if (satisfyCnt === depCnt) { 5139 startFunc(values); 5140 } 5141 return { 5142 teardown: function () { 5143 // remove all handlers 5144 for (var i = 0; i < bindTuples.length; i++) { 5145 _this.off(bindTuples[i][0], bindTuples[i][1]); 5146 } 5147 bindTuples = null; 5148 // was satisfied, so call stopFunc 5149 if (satisfyCnt === depCnt) { 5150 stopFunc(); 5151 } 5152 }, 5153 flash: function () { 5154 if (satisfyCnt === depCnt) { 5155 stopFunc(); 5156 startFunc(values); 5157 } 5158 } 5159 }; 5160 }; 5161 Model.prototype.flash = function (name) { 5162 var watcher = this._watchers[name]; 5163 if (watcher) { 5164 watcher.flash(); 5165 } 5166 }; 5167 return Model; 5168}(Class_1.default)); 5169exports.default = Model; 5170Model.prototype._globalWatchArgs = {}; // mutation protection in Model.watch 5171EmitterMixin_1.default.mixInto(Model); 5172ListenerMixin_1.default.mixInto(Model); 5173 5174 5175/***/ }), 5176/* 49 */ 5177/***/ (function(module, exports, __webpack_require__) { 5178 5179Object.defineProperty(exports, "__esModule", { value: true });
5180var moment = __webpack_require__(0); 5181var util_1 = __webpack_require__(4); 5182var SingleEventDef_1 = __webpack_require__(13); 5183var RecurringEventDef_1 = __webpack_require__(210); 5184exports.default = { 5185 parse: function (eventInput, source) { 5186 if (util_1.isTimeString(eventInput.start) || moment.isDuration(eventInput.start) || 5187 util_1.isTimeString(eventInput.end) || moment.isDuration(eventInput.end)) { 5188 return RecurringEventDef_1.default.parse(eventInput, source); 5189 } 5190 else { 5191 return SingleEventDef_1.default.parse(eventInput, source); 5192 } 5193 } 5194}; 5195 5196 5197/***/ }), 5198/* 50 */ 5199/***/ (function(module, exports, __webpack_require__) { 5200 5201Object.defineProperty(exports, "__esModule", { value: true }); 5202var util_1 = __webpack_require__(4); 5203var EventDateProfile_1 = __webpack_require__(17); 5204var EventDefDateMutation = /** @class */ (function () { 5205 function EventDefDateMutation() { 5206 this.clearEnd = false; 5207 this.forceTimed = false; 5208 this.forceAllDay = false; 5209 } 5210 EventDefDateMutation.createFromDiff = function (dateProfile0, dateProfile1, largeUnit) { 5211 var clearEnd = dateProfile0.end && !dateProfile1.end; 5212 var forceTimed = dateProfile0.isAllDay() && !dateProfile1.isAllDay(); 5213 var forceAllDay = !dateProfile0.isAllDay() && dateProfile1.isAllDay(); 5214 var dateDelta; 5215 var endDiff; 5216 var endDelta; 5217 var mutation; 5218 // subtracts the dates in the appropriate way, returning a duration 5219 function subtractDates(date1, date0) { 5220 if (largeUnit) { 5221 return util_1.diffByUnit(date1, date0, largeUnit); // poorly named 5222 } 5223 else if (dateProfile1.isAllDay()) { 5224 return util_1.diffDay(date1, date0); // poorly named 5225 } 5226 else { 5227 return util_1.diffDayTime(date1, date0); // poorly named 5228 } 5229 } 5230 dateDelta = subtractDates(dateProfile1.start, dateProfile0.start); 5231 if (dateProfile1.end) { 5232 // use unzonedRanges because dateProfile0.end might be null 5233 endDiff = subtractDates(dateProfile1.unzonedRange.getEnd(), dateProfile0.unzonedRange.getEnd()); 5234 endDelta = endDiff.subtract(dateDelta); 5235 } 5236 mutation = new EventDefDateMutation(); 5237 mutation.clearEnd = clearEnd; 5238 mutation.forceTimed = forceTimed; 5239 mutation.forceAllDay = forceAllDay; 5240 mutation.setDateDelta(dateDelta); 5241 mutation.setEndDelta(endDelta); 5242 return mutation; 5243 }; 5244 /* 5245 returns an undo function. 5246 */ 5247 EventDefDateMutation.prototype.buildNewDateProfile = function (eventDateProfile, calendar) { 5248 var start = eventDateProfile.start.clone(); 5249 var end = null; 5250 var shouldRezone = false; 5251 if (eventDateProfile.end && !this.clearEnd) { 5252 end = eventDateProfile.end.clone(); 5253 } 5254 else if (this.endDelta && !end) { 5255 end = calendar.getDefaultEventEnd(eventDateProfile.isAllDay(), start); 5256 } 5257 if (this.forceTimed) { 5258 shouldRezone = true; 5259 if (!start.hasTime()) { 5260 start.time(0); 5261 } 5262 if (end && !end.hasTime()) { 5263 end.time(0); 5264 } 5265 } 5266 else if (this.forceAllDay) { 5267 if (start.hasTime()) { 5268 start.stripTime(); 5269 } 5270 if (end && end.hasTime()) { 5271 end.stripTime(); 5272 } 5273 } 5274 if (this.dateDelta) { 5275 shouldRezone = true; 5276 start.add(this.dateDelta); 5277 if (end) { 5278 end.add(this.dateDelta); 5279 } 5280 } 5281 // do this before adding startDelta to start, so we can work off of start 5282 if (this.endDelta) { 5283 shouldRezone = true; 5284 end.add(this.endDelta); 5285 } 5286 if (this.startDelta) { 5287 shouldRezone = true; 5288 start.add(this.startDelta); 5289 } 5290 if (shouldRezone) { 5291 start = calendar.applyTimezone(start); 5292 if (end) { 5293 end = calendar.applyTimezone(end); 5294 } 5295 } 5296 // TODO: okay to access calendar option?
5297 if (!end && calendar.opt('forceEventDuration')) { 5298 end = calendar.getDefaultEventEnd(eventDateProfile.isAllDay(), start); 5299 } 5300 return new EventDateProfile_1.default(start, end, calendar); 5301 }; 5302 EventDefDateMutation.prototype.setDateDelta = function (dateDelta) { 5303 if (dateDelta && dateDelta.valueOf()) { 5304 this.dateDelta = dateDelta; 5305 } 5306 else { 5307 this.dateDelta = null; 5308 } 5309 }; 5310 EventDefDateMutation.prototype.setStartDelta = function (startDelta) { 5311 if (startDelta && startDelta.valueOf()) { 5312 this.startDelta = startDelta; 5313 } 5314 else { 5315 this.startDelta = null; 5316 } 5317 }; 5318 EventDefDateMutation.prototype.setEndDelta = function (endDelta) { 5319 if (endDelta && endDelta.valueOf()) { 5320 this.endDelta = endDelta; 5321 } 5322 else { 5323 this.endDelta = null; 5324 } 5325 }; 5326 EventDefDateMutation.prototype.isEmpty = function () { 5327 return !this.clearEnd && !this.forceTimed && !this.forceAllDay && 5328 !this.dateDelta && !this.startDelta && !this.endDelta; 5329 }; 5330 return EventDefDateMutation; 5331}()); 5332exports.default = EventDefDateMutation; 5333 5334 5335/***/ }), 5336/* 51 */ 5337/***/ (function(module, exports, __webpack_require__) { 5338 5339Object.defineProperty(exports, "__esModule", { value: true }); 5340var StandardTheme_1 = __webpack_require__(213); 5341var JqueryUiTheme_1 = __webpack_require__(214); 5342var themeClassHash = {}; 5343function defineThemeSystem(themeName, themeClass) { 5344 themeClassHash[themeName] = themeClass; 5345} 5346exports.defineThemeSystem = defineThemeSystem; 5347function getThemeSystemClass(themeSetting) { 5348 if (!themeSetting) { 5349 return StandardTheme_1.default; 5350 } 5351 else if (themeSetting === true) { 5352 return JqueryUiTheme_1.default; 5353 } 5354 else { 5355 return themeClassHash[themeSetting]; 5356 } 5357} 5358exports.getThemeSystemClass = getThemeSystemClass; 5359 5360 5361/***/ }), 5362/* 52 */ 5363/***/ (function(module, exports, __webpack_require__) { 5364 5365Object.defineProperty(exports, "__esModule", { value: true }); 5366var tslib_1 = __webpack_require__(2); 5367var $ = __webpack_require__(3); 5368var util_1 = __webpack_require__(4); 5369var Promise_1 = __webpack_require__(20); 5370var EventSource_1 = __webpack_require__(6); 5371var SingleEventDef_1 = __webpack_require__(13); 5372var ArrayEventSource = /** @class */ (function (_super) { 5373 tslib_1.__extends(ArrayEventSource, _super); 5374 function ArrayEventSource(calendar) { 5375 var _this = _super.call(this, calendar) || this; 5376 _this.eventDefs = []; // for if setRawEventDefs is never called 5377 return _this; 5378 } 5379 ArrayEventSource.parse = function (rawInput, calendar) { 5380 var rawProps; 5381 // normalize raw input 5382 if ($.isArray(rawInput.events)) { 5383 rawProps = rawInput; 5384 } 5385 else if ($.isArray(rawInput)) { 5386 rawProps = { events: rawInput }; 5387 } 5388 if (rawProps) { 5389 return EventSource_1.default.parse.call(this, rawProps, calendar); 5390 } 5391 return false; 5392 }; 5393 ArrayEventSource.prototype.setRawEventDefs = function (rawEventDefs) { 5394 this.rawEventDefs = rawEventDefs; 5395 this.eventDefs = this.parseEventDefs(rawEventDefs); 5396 }; 5397 ArrayEventSource.prototype.fetch = function (start, end, timezone) { 5398 var eventDefs = this.eventDefs; 5399 var i; 5400 if (this.currentTimezone != null && 5401 this.currentTimezone !== timezone) { 5402 for (i = 0; i < eventDefs.length; i++) { 5403 if (eventDefs[i] instanceof SingleEventDef_1.default) { 5404 eventDefs[i].rezone(); 5405 } 5406 } 5407 } 5408 this.currentTimezone = timezone; 5409 return Promise_1.default.resolve(eventDefs); 5410 }; 5411 ArrayEventSource.prototype.addEventDef = function (eventDef) { 5412 this.eventDefs.push(eventDef); 5413 }; 5414 /* 5415 eventDefId already normalized to a string 5416 */ 5417 ArrayEventSource.prototype.removeEventDefsById = function (eventDefId) { 5418 return util_1.removeMatching(this.eventDefs, function (eventDef) { 5419 return eventDef.id === eventDefId; 5420 }); 5421 }; 5422 ArrayEventSource.prototype.removeAllEventDefs = function () { 5423 this.eventDefs = []; 5424 }; 5425 ArrayEventSource.prototype.getPrimitive = function () { 5426 return this.rawEventDefs; 5427 };
5428 ArrayEventSource.prototype.applyManualStandardProps = function (rawProps) { 5429 var superSuccess = _super.prototype.applyManualStandardProps.call(this, rawProps); 5430 this.setRawEventDefs(rawProps.events); 5431 return superSuccess; 5432 }; 5433 return ArrayEventSource; 5434}(EventSource_1.default)); 5435exports.default = ArrayEventSource; 5436ArrayEventSource.defineStandardProps({ 5437 events: false // don't automatically transfer 5438}); 5439 5440 5441/***/ }), 5442/* 53 */ 5443/***/ (function(module, exports, __webpack_require__) { 5444 5445Object.defineProperty(exports, "__esModule", { value: true }); 5446var $ = __webpack_require__(3); 5447var util_1 = __webpack_require__(4); 5448/* 5449A cache for the left/right/top/bottom/width/height values for one or more elements. 5450Works with both offset (from topleft document) and position (from offsetParent). 5451 5452options: 5453- els 5454- isHorizontal 5455- isVertical 5456*/ 5457var CoordCache = /** @class */ (function () { 5458 function CoordCache(options) { 5459 this.isHorizontal = false; // whether to query for left/right/width 5460 this.isVertical = false; // whether to query for top/bottom/height 5461 this.els = $(options.els); 5462 this.isHorizontal = options.isHorizontal; 5463 this.isVertical = options.isVertical; 5464 this.forcedOffsetParentEl = options.offsetParent ? $(options.offsetParent) : null; 5465 } 5466 // Queries the els for coordinates and stores them. 5467 // Call this method before using and of the get* methods below. 5468 CoordCache.prototype.build = function () { 5469 var offsetParentEl = this.forcedOffsetParentEl; 5470 if (!offsetParentEl && this.els.length > 0) { 5471 offsetParentEl = this.els.eq(0).offsetParent(); 5472 } 5473 this.origin = offsetParentEl ? 5474 offsetParentEl.offset() : 5475 null;
5476 this.boundingRect = this.queryBoundingRect(); 5477 if (this.isHorizontal) { 5478 this.buildElHorizontals(); 5479 } 5480 if (this.isVertical) { 5481 this.buildElVerticals(); 5482 } 5483 }; 5484 // Destroys all internal data about coordinates, freeing memory 5485 CoordCache.prototype.clear = function () { 5486 this.origin = null; 5487 this.boundingRect = null; 5488 this.lefts = null; 5489 this.rights = null; 5490 this.tops = null; 5491 this.bottoms = null; 5492 }; 5493 // When called, if coord caches aren't built, builds them 5494 CoordCache.prototype.ensureBuilt = function () { 5495 if (!this.origin) { 5496 this.build(); 5497 } 5498 }; 5499 // Populates the left/right internal coordinate arrays 5500 CoordCache.prototype.buildElHorizontals = function () { 5501 var lefts = []; 5502 var rights = []; 5503 this.els.each(function (i, node) { 5504 var el = $(node); 5505 var left = el.offset().left; 5506 var width = el.outerWidth(); 5507 lefts.push(left); 5508 rights.push(left + width); 5509 }); 5510 this.lefts = lefts; 5511 this.rights = rights; 5512 }; 5513 // Populates the top/bottom internal coordinate arrays 5514 CoordCache.prototype.buildElVerticals = function () { 5515 var tops = []; 5516 var bottoms = []; 5517 this.els.each(function (i, node) { 5518 var el = $(node); 5519 var top = el.offset().top; 5520 var height = el.outerHeight(); 5521 tops.push(top); 5522 bottoms.push(top + height); 5523 }); 5524 this.tops = tops; 5525 this.bottoms = bottoms; 5526 }; 5527 // Given a left offset (from document left), returns the index of the el that it horizontally intersects. 5528 // If no intersection is made, returns undefined. 5529 CoordCache.prototype.getHorizontalIndex = function (leftOffset) { 5530 this.ensureBuilt(); 5531 var lefts = this.lefts; 5532 var rights = this.rights; 5533 var len = lefts.length; 5534 var i; 5535 for (i = 0; i < len; i++) { 5536 if (leftOffset >= lefts[i] && leftOffset < rights[i]) { 5537 return i; 5538 } 5539 } 5540 }; 5541 // Given a top offset (from document top), returns the index of the el that it vertically intersects. 5542 // If no intersection is made, returns undefined. 5543 CoordCache.prototype.getVerticalIndex = function (topOffset) { 5544 this.ensureBuilt(); 5545 var tops = this.tops; 5546 var bottoms = this.bottoms; 5547 var len = tops.length; 5548 var i; 5549 for (i = 0; i < len; i++) { 5550 if (topOffset >= tops[i] && topOffset < bottoms[i]) { 5551 return i; 5552 } 5553 } 5554 }; 5555 // Gets the left offset (from document left) of the element at the given index 5556 CoordCache.prototype.getLeftOffset = function (leftIndex) { 5557 this.ensureBuilt(); 5558 return this.lefts[leftIndex]; 5559 }; 5560 // Gets the left position (from offsetParent left) of the element at the given index 5561 CoordCache.prototype.getLeftPosition = function (leftIndex) { 5562 this.ensureBuilt(); 5563 return this.lefts[leftIndex] - this.origin.left; 5564 }; 5565 // Gets the right offset (from document left) of the element at the given index. 5566 // This value is NOT relative to the document's right edge, like the CSS concept of "right" would be. 5567 CoordCache.prototype.getRightOffset = function (leftIndex) { 5568 this.ensureBuilt(); 5569 return this.rights[leftIndex]; 5570 }; 5571 // Gets the right position (from offsetParent left) of the element at the given index. 5572 // This value is NOT relative to the offsetParent's right edge, like the CSS concept of "right" would be. 5573 CoordCache.prototype.getRightPosition = function (leftIndex) { 5574 this.ensureBuilt(); 5575 return this.rights[leftIndex] - this.origin.left; 5576 }; 5577 // Gets the width of the element at the given index 5578 CoordCache.prototype.getWidth = function (leftIndex) { 5579 this.ensureBuilt(); 5580 return this.rights[leftIndex] - this.lefts[leftIndex]; 5581 }; 5582 // Gets the top offset (from document top) of the element at the given index 5583 CoordCache.prototype.getTopOffset = function (topIndex) { 5584 this.ensureBuilt(); 5585 return this.tops[topIndex]; 5586 }; 5587 // Gets the top position (from offsetParent top) of the element at the given position 5588 CoordCache.prototype.getTopPosition = function (topIndex) { 5589 this.ensureBuilt(); 5590 return this.tops[topIndex] - this.origin.top; 5591 }; 5592 // Gets the bottom offset (from the document top) of the element at the given index. 5593 // This value is NOT relative to the offsetParent's bottom edge, like the CSS concept of "bottom" would be. 5594 CoordCache.prototype.getBottomOffset = function (topIndex) { 5595 this.ensureBuilt(); 5596 return this.bottoms[topIndex]; 5597 }; 5598 // Gets the bottom position (from the offsetParent top) of the element at the given index. 5599 // This value is NOT relative to the offsetParent's bottom edge, like the CSS concept of "bottom" would be. 5600 CoordCache.prototype.getBottomPosition = function (topIndex) { 5601 this.ensureBuilt(); 5602 return this.bottoms[topIndex] - this.origin.top; 5603 }; 5604 // Gets the height of the element at the given index 5605 CoordCache.prototype.getHeight = function (topIndex) { 5606 this.ensureBuilt(); 5607 return this.bottoms[topIndex] - this.tops[topIndex]; 5608 }; 5609 // Bounding Rect 5610 // TODO: decouple this from CoordCache 5611 // Compute and return what the elements' bounding rectangle is, from the user's perspective. 5612 // Right now, only returns a rectangle if constrained by an overflow:scroll element. 5613 // Returns null if there are no elements 5614 CoordCache.prototype.queryBoundingRect = function () { 5615 var scrollParentEl; 5616 if (this.els.length > 0) { 5617 scrollParentEl = util_1.getScrollParent(this.els.eq(0)); 5618 if (!scrollParentEl.is(document)) { 5619 return util_1.getClientRect(scrollParentEl); 5620 } 5621 } 5622 return null; 5623 }; 5624 CoordCache.prototype.isPointInBounds = function (leftOffset, topOffset) { 5625 return this.isLeftInBounds(leftOffset) && this.isTopInBounds(topOffset); 5626 }; 5627 CoordCache.prototype.isLeftInBounds = function (leftOffset) { 5628 return !this.boundingRect || (leftOffset >= this.boundingRect.left && leftOffset < this.boundingRect.right); 5629 }; 5630 CoordCache.prototype.isTopInBounds = function (topOffset) { 5631 return !this.boundingRect || (topOffset >= this.boundingRect.top && topOffset < this.boundingRect.bottom); 5632 }; 5633 return CoordCache; 5634}()); 5635exports.default = CoordCache; 5636 5637 5638/***/ }), 5639/* 54 */ 5640/***/ (function(module, exports, __webpack_require__) { 5641 5642Object.defineProperty(exports, "__esModule", { value: true });
5643var $ = __webpack_require__(3); 5644var util_1 = __webpack_require__(4); 5645var ListenerMixin_1 = __webpack_require__(7); 5646var GlobalEmitter_1 = __webpack_require__(21); 5647/* Tracks a drag's mouse movement, firing various handlers 5648----------------------------------------------------------------------------------------------------------------------*/ 5649// TODO: use Emitter 5650var DragListener = /** @class */ (function () { 5651 function DragListener(options) { 5652 this.isInteracting = false; 5653 this.isDistanceSurpassed = false; 5654 this.isDelayEnded = false; 5655 this.isDragging = false; 5656 this.isTouch = false; 5657 this.isGeneric = false; // initiated by 'dragstart' (jqui) 5658 this.shouldCancelTouchScroll = true; 5659 this.scrollAlwaysKills = false; 5660 this.isAutoScroll = false; 5661 // defaults 5662 this.scrollSensitivity = 30; // pixels from edge for scrolling to start 5663 this.scrollSpeed = 200; // pixels per second, at maximum speed 5664 this.scrollIntervalMs = 50; // millisecond wait between scroll increment 5665 this.options = options || {}; 5666 } 5667 // Interaction (high-level) 5668 // ----------------------------------------------------------------------------------------------------------------- 5669 DragListener.prototype.startInteraction = function (ev, extraOptions) { 5670 if (extraOptions === void 0) { extraOptions = {}; } 5671 if (ev.type === 'mousedown') { 5672 if (GlobalEmitter_1.default.get().shouldIgnoreMouse()) { 5673 return; 5674 } 5675 else if (!util_1.isPrimaryMouseButton(ev)) { 5676 return; 5677 } 5678 else { 5679 ev.preventDefault(); // prevents native selection in most browsers 5680 } 5681 } 5682 if (!this.isInteracting) { 5683 // process options 5684 this.delay = util_1.firstDefined(extraOptions.delay, this.options.delay, 0); 5685 this.minDistance = util_1.firstDefined(extraOptions.distance, this.options.distance, 0); 5686 this.subjectEl = this.options.subjectEl; 5687 util_1.preventSelection($('body')); 5688 this.isInteracting = true; 5689 this.isTouch = util_1.getEvIsTouch(ev); 5690 this.isGeneric = ev.type === 'dragstart'; 5691 this.isDelayEnded = false; 5692 this.isDistanceSurpassed = false; 5693 this.originX = util_1.getEvX(ev); 5694 this.originY = util_1.getEvY(ev); 5695 this.scrollEl = util_1.getScrollParent($(ev.target)); 5696 this.bindHandlers(); 5697 this.initAutoScroll(); 5698 this.handleInteractionStart(ev); 5699 this.startDelay(ev); 5700 if (!this.minDistance) { 5701 this.handleDistanceSurpassed(ev); 5702 } 5703 } 5704 }; 5705 DragListener.prototype.handleInteractionStart = function (ev) { 5706 this.trigger('interactionStart', ev); 5707 }; 5708 DragListener.prototype.endInteraction = function (ev, isCancelled) { 5709 if (this.isInteracting) { 5710 this.endDrag(ev); 5711 if (this.delayTimeoutId) { 5712 clearTimeout(this.delayTimeoutId); 5713 this.delayTimeoutId = null; 5714 } 5715 this.destroyAutoScroll(); 5716 this.unbindHandlers(); 5717 this.isInteracting = false; 5718 this.handleInteractionEnd(ev, isCancelled); 5719 util_1.allowSelection($('body')); 5720 } 5721 }; 5722 DragListener.prototype.handleInteractionEnd = function (ev, isCancelled) { 5723 this.trigger('interactionEnd', ev, isCancelled || false); 5724 }; 5725 // Binding To DOM 5726 // ----------------------------------------------------------------------------------------------------------------- 5727 DragListener.prototype.bindHandlers = function () { 5728 // some browsers (Safari in iOS 10) don't allow preventDefault on touch events that are bound after touchstart, 5729 // so listen to the GlobalEmitter singleton, which is always bound, instead of the document directly. 5730 var globalEmitter = GlobalEmitter_1.default.get(); 5731 if (this.isGeneric) { 5732 this.listenTo($(document), { 5733 drag: this.handleMove, 5734 dragstop: this.endInteraction 5735 }); 5736 } 5737 else if (this.isTouch) { 5738 this.listenTo(globalEmitter, { 5739 touchmove: this.handleTouchMove, 5740 touchend: this.endInteraction, 5741 scroll: this.handleTouchScroll 5742 }); 5743 } 5744 else { 5745 this.listenTo(globalEmitter, { 5746 mousemove: this.handleMouseMove, 5747 mouseup: this.endInteraction 5748 }); 5749 } 5750 this.listenTo(globalEmitter, { 5751 selectstart: util_1.preventDefault, 5752 contextmenu: util_1.preventDefault // long taps would open menu on Chrome dev tools 5753 }); 5754 }; 5755 DragListener.prototype.unbindHandlers = function () { 5756 this.stopListeningTo(GlobalEmitter_1.default.get()); 5757 this.stopListeningTo($(document)); // for isGeneric 5758 }; 5759 // Drag (high-level) 5760 // ----------------------------------------------------------------------------------------------------------------- 5761 // extraOptions ignored if drag already started 5762 DragListener.prototype.startDrag = function (ev, extraOptions) { 5763 this.startInteraction(ev, extraOptions); // ensure interaction began 5764 if (!this.isDragging) { 5765 this.isDragging = true; 5766 this.handleDragStart(ev); 5767 } 5768 }; 5769 DragListener.prototype.handleDragStart = function (ev) { 5770 this.trigger('dragStart', ev); 5771 }; 5772 DragListener.prototype.handleMove = function (ev) { 5773 var dx = util_1.getEvX(ev) - this.originX; 5774 var dy = util_1.getEvY(ev) - this.originY; 5775 var minDistance = this.minDistance; 5776 var distanceSq; // current distance from the origin, squared 5777 if (!this.isDistanceSurpassed) { 5778 distanceSq = dx * dx + dy * dy; 5779 if (distanceSq >= minDistance * minDistance) { 5780 this.handleDistanceSurpassed(ev); 5781 } 5782 } 5783 if (this.isDragging) { 5784 this.handleDrag(dx, dy, ev); 5785 } 5786 }; 5787 // Called while the mouse is being moved and when we know a legitimate drag is taking place 5788 DragListener.prototype.handleDrag = function (dx, dy, ev) { 5789 this.trigger('drag', dx, dy, ev); 5790 this.updateAutoScroll(ev); // will possibly cause scrolling 5791 }; 5792 DragListener.prototype.endDrag = function (ev) { 5793 if (this.isDragging) { 5794 this.isDragging = false; 5795 this.handleDragEnd(ev); 5796 } 5797 }; 5798 DragListener.prototype.handleDragEnd = function (ev) { 5799 this.trigger('dragEnd', ev); 5800 }; 5801 // Delay 5802 // ----------------------------------------------------------------------------------------------------------------- 5803 DragListener.prototype.startDelay = function (initialEv) { 5804 var _this = this; 5805 if (this.delay) { 5806 this.delayTimeoutId = setTimeout(function () { 5807 _this.handleDelayEnd(initialEv); 5808 }, this.delay); 5809 } 5810 else { 5811 this.handleDelayEnd(initialEv); 5812 } 5813 }; 5814 DragListener.prototype.handleDelayEnd = function (initialEv) { 5815 this.isDelayEnded = true; 5816 if (this.isDistanceSurpassed) { 5817 this.startDrag(initialEv); 5818 } 5819 }; 5820 // Distance 5821 // ----------------------------------------------------------------------------------------------------------------- 5822 DragListener.prototype.handleDistanceSurpassed = function (ev) { 5823 this.isDistanceSurpassed = true; 5824 if (this.isDelayEnded) { 5825 this.startDrag(ev); 5826 } 5827 }; 5828 // Mouse / Touch 5829 // ----------------------------------------------------------------------------------------------------------------- 5830 DragListener.prototype.handleTouchMove = function (ev) { 5831 // prevent inertia and touchmove-scrolling while dragging 5832 if (this.isDragging && this.shouldCancelTouchScroll) { 5833 ev.preventDefault(); 5834 } 5835 this.handleMove(ev); 5836 }; 5837 DragListener.prototype.handleMouseMove = function (ev) { 5838 this.handleMove(ev); 5839 }; 5840 // Scrolling (unrelated to auto-scroll) 5841 // ----------------------------------------------------------------------------------------------------------------- 5842 DragListener.prototype.handleTouchScroll = function (ev) { 5843 // if the drag is being initiated by touch, but a scroll happens before 5844 // the drag-initiating delay is over, cancel the drag 5845 if (!this.isDragging || this.scrollAlwaysKills) { 5846 this.endInteraction(ev, true); // isCancelled=true 5847 } 5848 }; 5849 // Utils 5850 // ----------------------------------------------------------------------------------------------------------------- 5851 // Triggers a callback. Calls a function in the option hash of the same name. 5852 // Arguments beyond the first `name` are forwarded on. 5853 DragListener.prototype.trigger = function (name) { 5854 var args = []; 5855 for (var _i = 1; _i < arguments.length; _i++) { 5856 args[_i - 1] = arguments[_i]; 5857 } 5858 if (this.options[name]) { 5859 this.options[name].apply(this, args); 5860 } 5861 // makes _methods callable by event name. TODO: kill this 5862 if (this['_' + name]) { 5863 this['_' + name].apply(this, args); 5864 } 5865 }; 5866 // Auto-scroll 5867 // ----------------------------------------------------------------------------------------------------------------- 5868 DragListener.prototype.initAutoScroll = function () { 5869 var scrollEl = this.scrollEl; 5870 this.isAutoScroll = 5871 this.options.scroll && 5872 scrollEl && 5873 !scrollEl.is(window) && 5874 !scrollEl.is(document); 5875 if (this.isAutoScroll) { 5876 // debounce makes sure rapid calls don't happen 5877 this.listenTo(scrollEl, 'scroll', util_1.debounce(this.handleDebouncedScroll, 100)); 5878 } 5879 }; 5880 DragListener.prototype.destroyAutoScroll = function () { 5881 this.endAutoScroll(); // kill any animation loop 5882 // remove the scroll handler if there is a scrollEl 5883 if (this.isAutoScroll) { 5884 this.stopListeningTo(this.scrollEl, 'scroll'); // will probably get removed by unbindHandlers too :( 5885 } 5886 }; 5887 // Computes and stores the bounding rectangle of scrollEl 5888 DragListener.prototype.computeScrollBounds = function () { 5889 if (this.isAutoScroll) { 5890 this.scrollBounds = util_1.getOuterRect(this.scrollEl); 5891 // TODO: use getClientRect in future. but prevents auto scrolling when on top of scrollbars 5892 } 5893 }; 5894 // Called when the dragging is in progress and scrolling should be updated 5895 DragListener.prototype.updateAutoScroll = function (ev) { 5896 var sensitivity = this.scrollSensitivity; 5897 var bounds = this.scrollBounds; 5898 var topCloseness; 5899 var bottomCloseness; 5900 var leftCloseness; 5901 var rightCloseness; 5902 var topVel = 0; 5903 var leftVel = 0; 5904 if (bounds) {
5905 // compute closeness to edges. valid range is from 0.0 - 1.0 5906 topCloseness = (sensitivity - (util_1.getEvY(ev) - bounds.top)) / sensitivity; 5907 bottomCloseness = (sensitivity - (bounds.bottom - util_1.getEvY(ev))) / sensitivity; 5908 leftCloseness = (sensitivity - (util_1.getEvX(ev) - bounds.left)) / sensitivity; 5909 rightCloseness = (sensitivity - (bounds.right - util_1.getEvX(ev))) / sensitivity; 5910 // translate vertical closeness into velocity. 5911 // mouse must be completely in bounds for velocity to happen. 5912 if (topCloseness >= 0 && topCloseness <= 1) { 5913 topVel = topCloseness * this.scrollSpeed * -1; // negative. for scrolling up 5914 } 5915 else if (bottomCloseness >= 0 && bottomCloseness <= 1) { 5916 topVel = bottomCloseness * this.scrollSpeed; 5917 } 5918 // translate horizontal closeness into velocity 5919 if (leftCloseness >= 0 && leftCloseness <= 1) { 5920 leftVel = leftCloseness * this.scrollSpeed * -1; // negative. for scrolling left 5921 } 5922 else if (rightCloseness >= 0 && rightCloseness <= 1) { 5923 leftVel = rightCloseness * this.scrollSpeed; 5924 } 5925 } 5926 this.setScrollVel(topVel, leftVel); 5927 }; 5928 // Sets the speed-of-scrolling for the scrollEl 5929 DragListener.prototype.setScrollVel = function (topVel, leftVel) { 5930 this.scrollTopVel = topVel; 5931 this.scrollLeftVel = leftVel; 5932 this.constrainScrollVel(); // massages into realistic values 5933 // if there is non-zero velocity, and an animation loop hasn't already started, then START 5934 if ((this.scrollTopVel || this.scrollLeftVel) && !this.scrollIntervalId) { 5935 this.scrollIntervalId = setInterval(util_1.proxy(this, 'scrollIntervalFunc'), // scope to `this` 5936 this.scrollIntervalMs); 5937 } 5938 }; 5939 // Forces scrollTopVel and scrollLeftVel to be zero if scrolling has already gone all the way 5940 DragListener.prototype.constrainScrollVel = function () { 5941 var el = this.scrollEl; 5942 if (this.scrollTopVel < 0) { 5943 if (el.scrollTop() <= 0) { 5944 this.scrollTopVel = 0; 5945 } 5946 } 5947 else if (this.scrollTopVel > 0) { 5948 if (el.scrollTop() + el[0].clientHeight >= el[0].scrollHeight) { 5949 this.scrollTopVel = 0; 5950 } 5951 } 5952 if (this.scrollLeftVel < 0) { 5953 if (el.scrollLeft() <= 0) { 5954 this.scrollLeftVel = 0; 5955 } 5956 } 5957 else if (this.scrollLeftVel > 0) { 5958 if (el.scrollLeft() + el[0].clientWidth >= el[0].scrollWidth) { 5959 this.scrollLeftVel = 0; 5960 } 5961 } 5962 }; 5963 // This function gets called during every iteration of the scrolling animation loop 5964 DragListener.prototype.scrollIntervalFunc = function () { 5965 var el = this.scrollEl; 5966 var frac = this.scrollIntervalMs / 1000; // considering animation frequency, what the vel should be mult'd by 5967 // change the value of scrollEl's scroll 5968 if (this.scrollTopVel) { 5969 el.scrollTop(el.scrollTop() + this.scrollTopVel * frac); 5970 } 5971 if (this.scrollLeftVel) { 5972 el.scrollLeft(el.scrollLeft() + this.scrollLeftVel * frac); 5973 } 5974 this.constrainScrollVel(); // since the scroll values changed, recompute the velocities 5975 // if scrolled all the way, which causes the vels to be zero, stop the animation loop 5976 if (!this.scrollTopVel && !this.scrollLeftVel) { 5977 this.endAutoScroll(); 5978 } 5979 }; 5980 // Kills any existing scrolling animation loop 5981 DragListener.prototype.endAutoScroll = function () { 5982 if (this.scrollIntervalId) { 5983 clearInterval(this.scrollIntervalId); 5984 this.scrollIntervalId = null; 5985 this.handleScrollEnd(); 5986 } 5987 }; 5988 // Get called when the scrollEl is scrolled (NOTE: this is delayed via debounce) 5989 DragListener.prototype.handleDebouncedScroll = function () {
5990 // recompute all coordinates, but *only* if this is *not* part of our scrolling animation 5991 if (!this.scrollIntervalId) { 5992 this.handleScrollEnd(); 5993 } 5994 }; 5995 DragListener.prototype.handleScrollEnd = function () { 5996 // Called when scrolling has stopped, whether through auto scroll, or the user scrolling 5997 }; 5998 return DragListener; 5999}()); 6000exports.default = DragListener; 6001ListenerMixin_1.default.mixInto(DragListener); 6002 6003 6004/***/ }), 6005/* 55 */ 6006/***/ (function(module, exports, __webpack_require__) { 6007 6008Object.defineProperty(exports, "__esModule", { value: true }); 6009var tslib_1 = __webpack_require__(2); 6010var util_1 = __webpack_require__(4); 6011var Mixin_1 = __webpack_require__(14); 6012/* 6013A set of rendering and date-related methods for a visual component comprised of one or more rows of day columns. 6014Prerequisite: the object being mixed into needs to be a *Grid* 6015*/ 6016var DayTableMixin = /** @class */ (function (_super) { 6017 tslib_1.__extends(DayTableMixin, _super); 6018 function DayTableMixin() { 6019 return _super !== null && _super.apply(this, arguments) || this; 6020 } 6021 // Populates internal variables used for date calculation and rendering 6022 DayTableMixin.prototype.updateDayTable = function () { 6023 var t = this; 6024 var view = t.view; 6025 var calendar = view.calendar; 6026 var date = calendar.msToUtcMoment(t.dateProfile.renderUnzonedRange.startMs, true); 6027 var end = calendar.msToUtcMoment(t.dateProfile.renderUnzonedRange.endMs, true); 6028 var dayIndex = -1; 6029 var dayIndices = []; 6030 var dayDates = []; 6031 var daysPerRow; 6032 var firstDay; 6033 var rowCnt; 6034 while (date.isBefore(end)) { 6035 if (view.isHiddenDay(date)) { 6036 dayIndices.push(dayIndex + 0.5); // mark that it's between indices 6037 } 6038 else { 6039 dayIndex++; 6040 dayIndices.push(dayIndex); 6041 dayDates.push(date.clone()); 6042 } 6043 date.add(1, 'days'); 6044 } 6045 if (this.breakOnWeeks) { 6046 // count columns until the day-of-week repeats 6047 firstDay = dayDates[0].day(); 6048 for (daysPerRow = 1; daysPerRow < dayDates.length; daysPerRow++) { 6049 if (dayDates[daysPerRow].day() === firstDay) { 6050 break; 6051 } 6052 } 6053 rowCnt = Math.ceil(dayDates.length / daysPerRow); 6054 } 6055 else { 6056 rowCnt = 1; 6057 daysPerRow = dayDates.length; 6058 } 6059 this.dayDates = dayDates; 6060 this.dayIndices = dayIndices; 6061 this.daysPerRow = daysPerRow; 6062 this.rowCnt = rowCnt; 6063 this.updateDayTableCols(); 6064 }; 6065 // Computes and assigned the colCnt property and updates any options that may be computed from it 6066 DayTableMixin.prototype.updateDayTableCols = function () { 6067 this.colCnt = this.computeColCnt(); 6068 this.colHeadFormat = 6069 this.opt('columnHeaderFormat') || 6070 this.opt('columnFormat') || // deprecated 6071 this.computeColHeadFormat(); 6072 }; 6073 // Determines how many columns there should be in the table 6074 DayTableMixin.prototype.computeColCnt = function () { 6075 return this.daysPerRow; 6076 }; 6077 // Computes the ambiguously-timed moment for the given cell 6078 DayTableMixin.prototype.getCellDate = function (row, col) { 6079 return this.dayDates[this.getCellDayIndex(row, col)].clone(); 6080 }; 6081 // Computes the ambiguously-timed date range for the given cell 6082 DayTableMixin.prototype.getCellRange = function (row, col) { 6083 var start = this.getCellDate(row, col); 6084 var end = start.clone().add(1, 'days'); 6085 return { start: start, end: end }; 6086 }; 6087 // Returns the number of day cells, chronologically, from the first of the grid (0-based) 6088 DayTableMixin.prototype.getCellDayIndex = function (row, col) { 6089 return row * this.daysPerRow + this.getColDayIndex(col); 6090 }; 6091 // Returns the numner of day cells, chronologically, from the first cell in *any given row* 6092 DayTableMixin.prototype.getColDayIndex = function (col) { 6093 if (this.isRTL) { 6094 return this.colCnt - 1 - col; 6095 } 6096 else { 6097 return col; 6098 } 6099 }; 6100 // Given a date, returns its chronolocial cell-index from the first cell of the grid. 6101 // If the date lies between cells (because of hiddenDays), returns a floating-point value between offsets. 6102 // If before the first offset, returns a negative number. 6103 // If after the last offset, returns an offset past the last cell offset. 6104 // Only works for *start* dates of cells. Will not work for exclusive end dates for cells. 6105 DayTableMixin.prototype.getDateDayIndex = function (date) { 6106 var dayIndices = this.dayIndices; 6107 var dayOffset = date.diff(this.dayDates[0], 'days'); 6108 if (dayOffset < 0) {
6109 return dayIndices[0] - 1; 6110 } 6111 else if (dayOffset >= dayIndices.length) { 6112 return dayIndices[dayIndices.length - 1] + 1; 6113 } 6114 else { 6115 return dayIndices[dayOffset]; 6116 } 6117 }; 6118 /* Options 6119 ------------------------------------------------------------------------------------------------------------------*/ 6120 // Computes a default column header formatting string if `colFormat` is not explicitly defined 6121 DayTableMixin.prototype.computeColHeadFormat = function () { 6122 // if more than one week row, or if there are a lot of columns with not much space, 6123 // put just the day numbers will be in each cell 6124 if (this.rowCnt > 1 || this.colCnt > 10) { 6125 return 'ddd'; // "Sat" 6126 } 6127 else if (this.colCnt > 1) { 6128 return this.opt('dayOfMonthFormat'); // "Sat 12/10" 6129 } 6130 else { 6131 return 'dddd'; // "Saturday" 6132 } 6133 }; 6134 /* Slicing 6135 ------------------------------------------------------------------------------------------------------------------*/ 6136 // Slices up a date range into a segment for every week-row it intersects with 6137 DayTableMixin.prototype.sliceRangeByRow = function (unzonedRange) { 6138 var daysPerRow = this.daysPerRow; 6139 var normalRange = this.view.computeDayRange(unzonedRange); // make whole-day range, considering nextDayThreshold 6140 var rangeFirst = this.getDateDayIndex(normalRange.start); // inclusive first index 6141 var rangeLast = this.getDateDayIndex(normalRange.end.clone().subtract(1, 'days')); // inclusive last index 6142 var segs = []; 6143 var row; 6144 var rowFirst; 6145 var rowLast; // inclusive day-index range for current row 6146 var segFirst; 6147 var segLast; // inclusive day-index range for segment 6148 for (row = 0; row < this.rowCnt; row++) { 6149 rowFirst = row * daysPerRow; 6150 rowLast = rowFirst + daysPerRow - 1; 6151 // intersect segment's offset range with the row's 6152 segFirst = Math.max(rangeFirst, rowFirst); 6153 segLast = Math.min(rangeLast, rowLast); 6154 // deal with in-between indices 6155 segFirst = Math.ceil(segFirst); // in-between starts round to next cell 6156 segLast = Math.floor(segLast); // in-between ends round to prev cell 6157 if (segFirst <= segLast) { 6158 segs.push({ 6159 row: row, 6160 // normalize to start of row 6161 firstRowDayIndex: segFirst - rowFirst, 6162 lastRowDayIndex: segLast - rowFirst, 6163 // must be matching integers to be the segment's start/end 6164 isStart: segFirst === rangeFirst, 6165 isEnd: segLast === rangeLast 6166 }); 6167 } 6168 } 6169 return segs; 6170 }; 6171 // Slices up a date range into a segment for every day-cell it intersects with. 6172 // TODO: make more DRY with sliceRangeByRow somehow. 6173 DayTableMixin.prototype.sliceRangeByDay = function (unzonedRange) { 6174 var daysPerRow = this.daysPerRow; 6175 var normalRange = this.view.computeDayRange(unzonedRange); // make whole-day range, considering nextDayThreshold 6176 var rangeFirst = this.getDateDayIndex(normalRange.start); // inclusive first index 6177 var rangeLast = this.getDateDayIndex(normalRange.end.clone().subtract(1, 'days')); // inclusive last index 6178 var segs = []; 6179 var row; 6180 var rowFirst; 6181 var rowLast; // inclusive day-index range for current row 6182 var i; 6183 var segFirst; 6184 var segLast; // inclusive day-index range for segment 6185 for (row = 0; row < this.rowCnt; row++) { 6186 rowFirst = row * daysPerRow; 6187 rowLast = rowFirst + daysPerRow - 1; 6188 for (i = rowFirst; i <= rowLast; i++) { 6189 // intersect segment's offset range with the row's 6190 segFirst = Math.max(rangeFirst, i); 6191 segLast = Math.min(rangeLast, i); 6192 // deal with in-between indices
6193 segFirst = Math.ceil(segFirst); // in-between starts round to next cell 6194 segLast = Math.floor(segLast); // in-between ends round to prev cell 6195 if (segFirst <= segLast) { 6196 segs.push({ 6197 row: row, 6198 // normalize to start of row 6199 firstRowDayIndex: segFirst - rowFirst, 6200 lastRowDayIndex: segLast - rowFirst, 6201 // must be matching integers to be the segment's start/end 6202 isStart: segFirst === rangeFirst, 6203 isEnd: segLast === rangeLast 6204 }); 6205 } 6206 } 6207 } 6208 return segs; 6209 }; 6210 /* Header Rendering 6211 ------------------------------------------------------------------------------------------------------------------*/ 6212 DayTableMixin.prototype.renderHeadHtml = function () { 6213 var theme = this.view.calendar.theme; 6214 return '' + 6215 '<div class="fc-row ' + theme.getClass('headerRow') + '">' + 6216 '<table class="' + theme.getClass('tableGrid') + '">' + 6217 '<thead>' + 6218 this.renderHeadTrHtml() + 6219 '</thead>' + 6220 '</table>' + 6221 '</div>'; 6222 }; 6223 DayTableMixin.prototype.renderHeadIntroHtml = function () { 6224 return this.renderIntroHtml(); // fall back to generic 6225 }; 6226 DayTableMixin.prototype.renderHeadTrHtml = function () { 6227 return '' + 6228 '<tr>' + 6229 (this.isRTL ? '' : this.renderHeadIntroHtml()) + 6230 this.renderHeadDateCellsHtml() + 6231 (this.isRTL ? this.renderHeadIntroHtml() : '') + 6232 '</tr>'; 6233 }; 6234 DayTableMixin.prototype.renderHeadDateCellsHtml = function () { 6235 var htmls = []; 6236 var col; 6237 var date; 6238 for (col = 0; col < this.colCnt; col++) { 6239 date = this.getCellDate(0, col); 6240 htmls.push(this.renderHeadDateCellHtml(date)); 6241 } 6242 return htmls.join(''); 6243 }; 6244 // TODO: when internalApiVersion, accept an object for HTML attributes 6245 // (colspan should be no different) 6246 DayTableMixin.prototype.renderHeadDateCellHtml = function (date, colspan, otherAttrs) { 6247 var t = this; 6248 var view = t.view; 6249 var isDateValid = t.dateProfile.activeUnzonedRange.containsDate(date); // TODO: called too frequently. cache somehow. 6250 var classNames = [ 6251 'fc-day-header', 6252 view.calendar.theme.getClass('widgetHeader') 6253 ]; 6254 var innerHtml; 6255 if (typeof t.opt('columnHeaderHtml') === 'function') { 6256 innerHtml = t.opt('columnHeaderHtml')(date); 6257 } 6258 else if (typeof t.opt('columnHeaderText') === 'function') { 6259 innerHtml = util_1.htmlEscape(t.opt('columnHeaderText')(date)); 6260 } 6261 else { 6262 innerHtml = util_1.htmlEscape(date.format(t.colHeadFormat)); 6263 } 6264 // if only one row of days, the classNames on the header can represent the specific days beneath 6265 if (t.rowCnt === 1) { 6266 classNames = classNames.concat( 6267 // includes the day-of-week class 6268 // noThemeHighlight=true (don't highlight the header) 6269 t.getDayClasses(date, true)); 6270 } 6271 else { 6272 classNames.push('fc-' + util_1.dayIDs[date.day()]); // only add the day-of-week class 6273 } 6274 return '' + 6275 '<th class="' + classNames.join(' ') + '"' + 6276 ((isDateValid && t.rowCnt) === 1 ? 6277 ' data-date="' + date.format('YYYY-MM-DD') + '"' : 6278 '') + 6279 (colspan > 1 ? 6280 ' colspan="' + colspan + '"' : 6281 '') + 6282 (otherAttrs ? 6283 ' ' + otherAttrs : 6284 '') + 6285 '>' + 6286 (isDateValid ? 6287 // don't make a link if the heading could represent multiple days, or if there's only one day (forceOff) 6288 view.buildGotoAnchorHtml({ date: date, forceOff: t.rowCnt > 1 || t.colCnt === 1 }, innerHtml) : 6289 // if not valid, display text, but no link 6290 innerHtml) + 6291 '</th>'; 6292 };
6293 /* Background Rendering 6294 ------------------------------------------------------------------------------------------------------------------*/ 6295 DayTableMixin.prototype.renderBgTrHtml = function (row) { 6296 return '' + 6297 '<tr>' + 6298 (this.isRTL ? '' : this.renderBgIntroHtml(row)) + 6299 this.renderBgCellsHtml(row) + 6300 (this.isRTL ? this.renderBgIntroHtml(row) : '') + 6301 '</tr>'; 6302 }; 6303 DayTableMixin.prototype.renderBgIntroHtml = function (row) { 6304 return this.renderIntroHtml(); // fall back to generic 6305 }; 6306 DayTableMixin.prototype.renderBgCellsHtml = function (row) { 6307 var htmls = []; 6308 var col; 6309 var date; 6310 for (col = 0; col < this.colCnt; col++) { 6311 date = this.getCellDate(row, col); 6312 htmls.push(this.renderBgCellHtml(date)); 6313 } 6314 return htmls.join(''); 6315 }; 6316 DayTableMixin.prototype.renderBgCellHtml = function (date, otherAttrs) { 6317 var t = this; 6318 var view = t.view; 6319 var isDateValid = t.dateProfile.activeUnzonedRange.containsDate(date); // TODO: called too frequently. cache somehow. 6320 var classes = t.getDayClasses(date); 6321 classes.unshift('fc-day', view.calendar.theme.getClass('widgetContent')); 6322 return '<td class="' + classes.join(' ') + '"' + 6323 (isDateValid ? 6324 ' data-date="' + date.format('YYYY-MM-DD') + '"' : // if date has a time, won't format it 6325 '') + 6326 (otherAttrs ? 6327 ' ' + otherAttrs : 6328 '') + 6329 '></td>'; 6330 }; 6331 /* Generic 6332 ------------------------------------------------------------------------------------------------------------------*/ 6333 DayTableMixin.prototype.renderIntroHtml = function () { 6334 // Generates the default HTML intro for any row. User classes should override 6335 }; 6336 // TODO: a generic method for dealing with <tr>, RTL, intro 6337 // when increment internalApiVersion 6338 // wrapTr (scheduler) 6339 /* Utils 6340 ------------------------------------------------------------------------------------------------------------------*/ 6341 // Applies the generic "intro" and "outro" HTML to the given cells. 6342 // Intro means the leftmost cell when the calendar is LTR and the rightmost cell when RTL. Vice-versa for outro. 6343 DayTableMixin.prototype.bookendCells = function (trEl) { 6344 var introHtml = this.renderIntroHtml(); 6345 if (introHtml) { 6346 if (this.isRTL) { 6347 trEl.append(introHtml); 6348 } 6349 else { 6350 trEl.prepend(introHtml); 6351 } 6352 } 6353 }; 6354 return DayTableMixin; 6355}(Mixin_1.default)); 6356exports.default = DayTableMixin; 6357 6358 6359/***/ }), 6360/* 56 */ 6361/***/ (function(module, exports) { 6362 6363Object.defineProperty(exports, "__esModule", { value: true }); 6364var BusinessHourRenderer = /** @class */ (function () { 6365 /* 6366 component implements: 6367 - eventRangesToEventFootprints 6368 - eventFootprintsToSegs 6369 */ 6370 function BusinessHourRenderer(component, fillRenderer) { 6371 this.component = component; 6372 this.fillRenderer = fillRenderer; 6373 } 6374 BusinessHourRenderer.prototype.render = function (businessHourGenerator) { 6375 var component = this.component; 6376 var unzonedRange = component._getDateProfile().activeUnzonedRange; 6377 var eventInstanceGroup = businessHourGenerator.buildEventInstanceGroup(component.hasAllDayBusinessHours, unzonedRange); 6378 var eventFootprints = eventInstanceGroup ? 6379 component.eventRangesToEventFootprints(eventInstanceGroup.sliceRenderRanges(unzonedRange)) : 6380 []; 6381 this.renderEventFootprints(eventFootprints); 6382 }; 6383 BusinessHourRenderer.prototype.renderEventFootprints = function (eventFootprints) { 6384 var segs = this.component.eventFootprintsToSegs(eventFootprints); 6385 this.renderSegs(segs); 6386 this.segs = segs; 6387 }; 6388 BusinessHourRenderer.prototype.renderSegs = function (segs) { 6389 if (this.fillRenderer) { 6390 this.fillRenderer.renderSegs('businessHours', segs, { 6391 getClasses: function (seg) { 6392 return ['fc-nonbusiness', 'fc-bgevent']; 6393 } 6394 }); 6395 } 6396 }; 6397 BusinessHourRenderer.prototype.unrender = function () { 6398 if (this.fillRenderer) { 6399 this.fillRenderer.unrender('businessHours'); 6400 } 6401 this.segs = null; 6402 }; 6403 BusinessHourRenderer.prototype.getSegs = function () { 6404 return this.segs || []; 6405 }; 6406 return BusinessHourRenderer; 6407}()); 6408exports.default = BusinessHourRenderer; 6409 6410 6411/***/ }), 6412/* 57 */ 6413/***/ (function(module, exports, __webpack_require__) { 6414 6415Object.defineProperty(exports, "__esModule", { value: true });
6416var $ = __webpack_require__(3); 6417var util_1 = __webpack_require__(4); 6418var FillRenderer = /** @class */ (function () { 6419 function FillRenderer(component) { 6420 this.fillSegTag = 'div'; 6421 this.component = component; 6422 this.elsByFill = {}; 6423 } 6424 FillRenderer.prototype.renderFootprint = function (type, componentFootprint, props) { 6425 this.renderSegs(type, this.component.componentFootprintToSegs(componentFootprint), props); 6426 }; 6427 FillRenderer.prototype.renderSegs = function (type, segs, props) { 6428 var els; 6429 segs = this.buildSegEls(type, segs, props); // assignes `.el` to each seg. returns successfully rendered segs 6430 els = this.attachSegEls(type, segs); 6431 if (els) { 6432 this.reportEls(type, els); 6433 } 6434 return segs; 6435 }; 6436 // Unrenders a specific type of fill that is currently rendered on the grid 6437 FillRenderer.prototype.unrender = function (type) { 6438 var el = this.elsByFill[type]; 6439 if (el) { 6440 el.remove(); 6441 delete this.elsByFill[type]; 6442 } 6443 }; 6444 // Renders and assigns an `el` property for each fill segment. Generic enough to work with different types. 6445 // Only returns segments that successfully rendered. 6446 FillRenderer.prototype.buildSegEls = function (type, segs, props) { 6447 var _this = this; 6448 var html = ''; 6449 var renderedSegs = []; 6450 var i; 6451 if (segs.length) { 6452 // build a large concatenation of segment HTML 6453 for (i = 0; i < segs.length; i++) { 6454 html += this.buildSegHtml(type, segs[i], props); 6455 } 6456 // Grab individual elements from the combined HTML string. Use each as the default rendering. 6457 // Then, compute the 'el' for each segment. 6458 $(html).each(function (i, node) { 6459 var seg = segs[i]; 6460 var el = $(node); 6461 // allow custom filter methods per-type 6462 if (props.filterEl) { 6463 el = props.filterEl(seg, el); 6464 } 6465 if (el) { 6466 el = $(el); // allow custom filter to return raw DOM node 6467 // correct element type? (would be bad if a non-TD were inserted into a table for example) 6468 if (el.is(_this.fillSegTag)) { 6469 seg.el = el; 6470 renderedSegs.push(seg); 6471 } 6472 } 6473 }); 6474 } 6475 return renderedSegs; 6476 }; 6477 // Builds the HTML needed for one fill segment. Generic enough to work with different types. 6478 FillRenderer.prototype.buildSegHtml = function (type, seg, props) { 6479 // custom hooks per-type 6480 var classes = props.getClasses ? props.getClasses(seg) : []; 6481 var css = util_1.cssToStr(props.getCss ? props.getCss(seg) : {}); 6482 return '<' + this.fillSegTag + 6483 (classes.length ? ' class="' + classes.join(' ') + '"' : '') + 6484 (css ? ' style="' + css + '"' : '') + 6485 ' />'; 6486 }; 6487 // Should return wrapping DOM structure 6488 FillRenderer.prototype.attachSegEls = function (type, segs) { 6489 // subclasses must implement 6490 }; 6491 FillRenderer.prototype.reportEls = function (type, nodes) { 6492 if (this.elsByFill[type]) { 6493 this.elsByFill[type] = this.elsByFill[type].add(nodes); 6494 } 6495 else { 6496 this.elsByFill[type] = $(nodes); 6497 } 6498 }; 6499 return FillRenderer; 6500}()); 6501exports.default = FillRenderer; 6502 6503 6504/***/ }), 6505/* 58 */ 6506/***/ (function(module, exports, __webpack_require__) { 6507 6508Object.defineProperty(exports, "__esModule", { value: true }); 6509var SingleEventDef_1 = __webpack_require__(13); 6510var EventFootprint_1 = __webpack_require__(36); 6511var EventSource_1 = __webpack_require__(6); 6512var HelperRenderer = /** @class */ (function () { 6513 function HelperRenderer(component, eventRenderer) { 6514 this.view = component._getView(); 6515 this.component = component; 6516 this.eventRenderer = eventRenderer; 6517 } 6518 HelperRenderer.prototype.renderComponentFootprint = function (componentFootprint) { 6519 this.renderEventFootprints([ 6520 this.fabricateEventFootprint(componentFootprint) 6521 ]); 6522 }; 6523 HelperRenderer.prototype.renderEventDraggingFootprints = function (eventFootprints, sourceSeg, isTouch) { 6524 this.renderEventFootprints(eventFootprints, sourceSeg, 'fc-dragging', isTouch ? null : this.view.opt('dragOpacity')); 6525 }; 6526 HelperRenderer.prototype.renderEventResizingFootprints = function (eventFootprints, sourceSeg, isTouch) { 6527 this.renderEventFootprints(eventFootprints, sourceSeg, 'fc-resizing'); 6528 }; 6529 HelperRenderer.prototype.renderEventFootprints = function (eventFootprints, sourceSeg, extraClassNames, opacity) { 6530 var segs = this.component.eventFootprintsToSegs(eventFootprints); 6531 var classNames = 'fc-helper ' + (extraClassNames || ''); 6532 var i; 6533 // assigns each seg's el and returns a subset of segs that were rendered 6534 segs = this.eventRenderer.renderFgSegEls(segs); 6535 for (i = 0; i < segs.length; i++) { 6536 segs[i].el.addClass(classNames); 6537 } 6538 if (opacity != null) { 6539 for (i = 0; i < segs.length; i++) { 6540 segs[i].el.css('opacity', opacity); 6541 } 6542 } 6543 this.helperEls = this.renderSegs(segs, sourceSeg); 6544 }; 6545 /* 6546 Must return all mock event elements 6547 */ 6548 HelperRenderer.prototype.renderSegs = function (segs, sourceSeg) { 6549 // Subclasses must implement 6550 }; 6551 HelperRenderer.prototype.unrender = function () { 6552 if (this.helperEls) { 6553 this.helperEls.remove(); 6554 this.helperEls = null; 6555 } 6556 }; 6557 HelperRenderer.prototype.fabricateEventFootprint = function (componentFootprint) { 6558 var calendar = this.view.calendar; 6559 var eventDateProfile = calendar.footprintToDateProfile(componentFootprint); 6560 var dummyEvent = new SingleEventDef_1.default(new EventSource_1.default(calendar)); 6561 var dummyInstance; 6562 dummyEvent.dateProfile = eventDateProfile; 6563 dummyInstance = dummyEvent.buildInstance(); 6564 return new EventFootprint_1.default(componentFootprint, dummyEvent, dummyInstance); 6565 }; 6566 return HelperRenderer; 6567}()); 6568exports.default = HelperRenderer; 6569 6570 6571/***/ }), 6572/* 59 */ 6573/***/ (function(module, exports, __webpack_require__) { 6574 6575Object.defineProperty(exports, "__esModule", { value: true });
6576var tslib_1 = __webpack_require__(2); 6577var GlobalEmitter_1 = __webpack_require__(21); 6578var Interaction_1 = __webpack_require__(15); 6579var EventPointing = /** @class */ (function (_super) { 6580 tslib_1.__extends(EventPointing, _super); 6581 function EventPointing() { 6582 return _super !== null && _super.apply(this, arguments) || this; 6583 } 6584 /* 6585 component must implement: 6586 - publiclyTrigger 6587 */ 6588 EventPointing.prototype.bindToEl = function (el) { 6589 var component = this.component; 6590 component.bindSegHandlerToEl(el, 'click', this.handleClick.bind(this)); 6591 component.bindSegHandlerToEl(el, 'mouseenter', this.handleMouseover.bind(this)); 6592 component.bindSegHandlerToEl(el, 'mouseleave', this.handleMouseout.bind(this)); 6593 }; 6594 EventPointing.prototype.handleClick = function (seg, ev) { 6595 var res = this.component.publiclyTrigger('eventClick', { 6596 context: seg.el[0], 6597 args: [seg.footprint.getEventLegacy(), ev, this.view] 6598 }); 6599 if (res === false) { 6600 ev.preventDefault(); 6601 } 6602 }; 6603 // Updates internal state and triggers handlers for when an event element is moused over 6604 EventPointing.prototype.handleMouseover = function (seg, ev) { 6605 if (!GlobalEmitter_1.default.get().shouldIgnoreMouse() && 6606 !this.mousedOverSeg) { 6607 this.mousedOverSeg = seg; 6608 // TODO: move to EventSelecting's responsibility 6609 if (this.view.isEventDefResizable(seg.footprint.eventDef)) { 6610 seg.el.addClass('fc-allow-mouse-resize'); 6611 } 6612 this.component.publiclyTrigger('eventMouseover', { 6613 context: seg.el[0], 6614 args: [seg.footprint.getEventLegacy(), ev, this.view] 6615 }); 6616 } 6617 }; 6618 // Updates internal state and triggers handlers for when an event element is moused out. 6619 // Can be given no arguments, in which case it will mouseout the segment that was previously moused over. 6620 EventPointing.prototype.handleMouseout = function (seg, ev) { 6621 if (this.mousedOverSeg) { 6622 this.mousedOverSeg = null; 6623 // TODO: move to EventSelecting's responsibility 6624 if (this.view.isEventDefResizable(seg.footprint.eventDef)) { 6625 seg.el.removeClass('fc-allow-mouse-resize'); 6626 } 6627 this.component.publiclyTrigger('eventMouseout', { 6628 context: seg.el[0], 6629 args: [ 6630 seg.footprint.getEventLegacy(), 6631 ev || {}, 6632 this.view 6633 ] 6634 }); 6635 } 6636 }; 6637 EventPointing.prototype.end = function () { 6638 if (this.mousedOverSeg) { 6639 this.handleMouseout(this.mousedOverSeg); 6640 } 6641 }; 6642 return EventPointing; 6643}(Interaction_1.default)); 6644exports.default = EventPointing; 6645 6646 6647/***/ }), 6648/* 60 */ 6649/***/ (function(module, exports, __webpack_require__) { 6650 6651Object.defineProperty(exports, "__esModule", { value: true }); 6652var tslib_1 = __webpack_require__(2); 6653var Mixin_1 = __webpack_require__(14); 6654var DateClicking_1 = __webpack_require__(245); 6655var DateSelecting_1 = __webpack_require__(225); 6656var EventPointing_1 = __webpack_require__(59); 6657var EventDragging_1 = __webpack_require__(224); 6658var EventResizing_1 = __webpack_require__(223);
6659var ExternalDropping_1 = __webpack_require__(222); 6660var StandardInteractionsMixin = /** @class */ (function (_super) { 6661 tslib_1.__extends(StandardInteractionsMixin, _super); 6662 function StandardInteractionsMixin() { 6663 return _super !== null && _super.apply(this, arguments) || this; 6664 } 6665 return StandardInteractionsMixin; 6666}(Mixin_1.default)); 6667exports.default = StandardInteractionsMixin; 6668StandardInteractionsMixin.prototype.dateClickingClass = DateClicking_1.default; 6669StandardInteractionsMixin.prototype.dateSelectingClass = DateSelecting_1.default; 6670StandardInteractionsMixin.prototype.eventPointingClass = EventPointing_1.default; 6671StandardInteractionsMixin.prototype.eventDraggingClass = EventDragging_1.default; 6672StandardInteractionsMixin.prototype.eventResizingClass = EventResizing_1.default; 6673StandardInteractionsMixin.prototype.externalDroppingClass = ExternalDropping_1.default; 6674 6675 6676/***/ }), 6677/* 61 */ 6678/***/ (function(module, exports, __webpack_require__) { 6679 6680Object.defineProperty(exports, "__esModule", { value: true }); 6681var tslib_1 = __webpack_require__(2); 6682var $ = __webpack_require__(3); 6683var util_1 = __webpack_require__(4); 6684var CoordCache_1 = __webpack_require__(53); 6685var Popover_1 = __webpack_require__(249); 6686var UnzonedRange_1 = __webpack_require__(5); 6687var ComponentFootprint_1 = __webpack_require__(12); 6688var EventFootprint_1 = __webpack_require__(36); 6689var BusinessHourRenderer_1 = __webpack_require__(56); 6690var StandardInteractionsMixin_1 = __webpack_require__(60); 6691var InteractiveDateComponent_1 = __webpack_require__(40); 6692var DayTableMixin_1 = __webpack_require__(55); 6693var DayGridEventRenderer_1 = __webpack_require__(250); 6694var DayGridHelperRenderer_1 = __webpack_require__(251); 6695var DayGridFillRenderer_1 = __webpack_require__(252); 6696/* A component that renders a grid of whole-days that runs horizontally. There can be multiple rows, one per week. 6697----------------------------------------------------------------------------------------------------------------------*/ 6698var DayGrid = /** @class */ (function (_super) { 6699 tslib_1.__extends(DayGrid, _super); 6700 function DayGrid(view) { 6701 var _this = _super.call(this, view) || this; 6702 _this.cellWeekNumbersVisible = false; // display week numbers in day cell? 6703 _this.bottomCoordPadding = 0; // hack for extending the hit area for the last row of the coordinate grid 6704 // isRigid determines whether the individual rows should ignore the contents and be a constant height. 6705 // Relies on the view's colCnt and rowCnt. In the future, this component should probably be self-sufficient. 6706 _this.isRigid = false; 6707 _this.hasAllDayBusinessHours = true; 6708 return _this; 6709 } 6710 // Slices up the given span (unzoned start/end with other misc data) into an array of segments 6711 DayGrid.prototype.componentFootprintToSegs = function (componentFootprint) { 6712 var segs = this.sliceRangeByRow(componentFootprint.unzonedRange); 6713 var i; 6714 var seg; 6715 for (i = 0; i < segs.length; i++) { 6716 seg = segs[i]; 6717 if (this.isRTL) { 6718 seg.leftCol = this.daysPerRow - 1 - seg.lastRowDayIndex; 6719 seg.rightCol = this.daysPerRow - 1 - seg.firstRowDayIndex; 6720 } 6721 else { 6722 seg.leftCol = seg.firstRowDayIndex; 6723 seg.rightCol = seg.lastRowDayIndex; 6724 } 6725 } 6726 return segs; 6727 }; 6728 /* Date Rendering 6729 ------------------------------------------------------------------------------------------------------------------*/ 6730 DayGrid.prototype.renderDates = function (dateProfile) { 6731 this.dateProfile = dateProfile; 6732 this.updateDayTable(); 6733 this.renderGrid(); 6734 }; 6735 DayGrid.prototype.unrenderDates = function () { 6736 this.removeSegPopover(); 6737 }; 6738 // Renders the rows and columns into the component's `this.el`, which should already be assigned. 6739 DayGrid.prototype.renderGrid = function () { 6740 var view = this.view; 6741 var rowCnt = this.rowCnt; 6742 var colCnt = this.colCnt; 6743 var html = ''; 6744 var row; 6745 var col; 6746 if (this.headContainerEl) { 6747 this.headContainerEl.html(this.renderHeadHtml()); 6748 } 6749 for (row = 0; row < rowCnt; row++) { 6750 html += this.renderDayRowHtml(row, this.isRigid); 6751 } 6752 this.el.html(html); 6753 this.rowEls = this.el.find('.fc-row'); 6754 this.cellEls = this.el.find('.fc-day, .fc-disabled-day');
6755 this.rowCoordCache = new CoordCache_1.default({ 6756 els: this.rowEls, 6757 isVertical: true 6758 }); 6759 this.colCoordCache = new CoordCache_1.default({ 6760 els: this.cellEls.slice(0, this.colCnt), 6761 isHorizontal: true 6762 }); 6763 // trigger dayRender with each cell's element 6764 for (row = 0; row < rowCnt; row++) { 6765 for (col = 0; col < colCnt; col++) { 6766 this.publiclyTrigger('dayRender', { 6767 context: view, 6768 args: [ 6769 this.getCellDate(row, col), 6770 this.getCellEl(row, col), 6771 view 6772 ] 6773 }); 6774 } 6775 } 6776 }; 6777 // Generates the HTML for a single row, which is a div that wraps a table. 6778 // `row` is the row number. 6779 DayGrid.prototype.renderDayRowHtml = function (row, isRigid) { 6780 var theme = this.view.calendar.theme; 6781 var classes = ['fc-row', 'fc-week', theme.getClass('dayRow')]; 6782 if (isRigid) { 6783 classes.push('fc-rigid'); 6784 } 6785 return '' + 6786 '<div class="' + classes.join(' ') + '">' + 6787 '<div class="fc-bg">' + 6788 '<table class="' + theme.getClass('tableGrid') + '">' + 6789 this.renderBgTrHtml(row) + 6790 '</table>' + 6791 '</div>' + 6792 '<div class="fc-content-skeleton">' + 6793 '<table>' + 6794 (this.getIsNumbersVisible() ? 6795 '<thead>' + 6796 this.renderNumberTrHtml(row) + 6797 '</thead>' : 6798 '') + 6799 '</table>' + 6800 '</div>' + 6801 '</div>'; 6802 }; 6803 DayGrid.prototype.getIsNumbersVisible = function () { 6804 return this.getIsDayNumbersVisible() || this.cellWeekNumbersVisible; 6805 }; 6806 DayGrid.prototype.getIsDayNumbersVisible = function () { 6807 return this.rowCnt > 1; 6808 }; 6809 /* Grid Number Rendering 6810 ------------------------------------------------------------------------------------------------------------------*/ 6811 DayGrid.prototype.renderNumberTrHtml = function (row) { 6812 return '' + 6813 '<tr>' + 6814 (this.isRTL ? '' : this.renderNumberIntroHtml(row)) + 6815 this.renderNumberCellsHtml(row) + 6816 (this.isRTL ? this.renderNumberIntroHtml(row) : '') + 6817 '</tr>'; 6818 }; 6819 DayGrid.prototype.renderNumberIntroHtml = function (row) { 6820 return this.renderIntroHtml(); 6821 }; 6822 DayGrid.prototype.renderNumberCellsHtml = function (row) { 6823 var htmls = []; 6824 var col; 6825 var date; 6826 for (col = 0; col < this.colCnt; col++) { 6827 date = this.getCellDate(row, col); 6828 htmls.push(this.renderNumberCellHtml(date)); 6829 } 6830 return htmls.join(''); 6831 }; 6832 // Generates the HTML for the <td>s of the "number" row in the DayGrid's content skeleton. 6833 // The number row will only exist if either day numbers or week numbers are turned on. 6834 DayGrid.prototype.renderNumberCellHtml = function (date) { 6835 var view = this.view; 6836 var html = ''; 6837 var isDateValid = this.dateProfile.activeUnzonedRange.containsDate(date); // TODO: called too frequently. cache somehow. 6838 var isDayNumberVisible = this.getIsDayNumbersVisible() && isDateValid; 6839 var classes; 6840 var weekCalcFirstDoW; 6841 if (!isDayNumberVisible && !this.cellWeekNumbersVisible) { 6842 // no numbers in day cell (week number must be along the side) 6843 return '<td/>'; // will create an empty space above events :( 6844 } 6845 classes = this.getDayClasses(date); 6846 classes.unshift('fc-day-top'); 6847 if (this.cellWeekNumbersVisible) { 6848 // To determine the day of week number change under ISO, we cannot 6849 // rely on moment.js methods such as firstDayOfWeek() or weekday(), 6850 // because they rely on the locale's dow (possibly overridden by 6851 // our firstDay option), which may not be Monday. We cannot change 6852 // dow, because that would affect the calendar start day as well. 6853 if (date._locale._fullCalendar_weekCalc === 'ISO') { 6854 weekCalcFirstDoW = 1; // Monday by ISO 8601 definition 6855 } 6856 else { 6857 weekCalcFirstDoW = date._locale.firstDayOfWeek(); 6858 } 6859 } 6860 html += '<td class="' + classes.join(' ') + '"' + 6861 (isDateValid ? 6862 ' data-date="' + date.format() + '"' : 6863 '') + 6864 '>'; 6865 if (this.cellWeekNumbersVisible && (date.day() === weekCalcFirstDoW)) { 6866 html += view.buildGotoAnchorHtml({ date: date, type: 'week' }, { 'class': 'fc-week-number' }, date.format('w') // inner HTML 6867 ); 6868 } 6869 if (isDayNumberVisible) { 6870 html += view.buildGotoAnchorHtml(date, { 'class': 'fc-day-number' }, date.format('D') // inner HTML 6871 ); 6872 } 6873 html += '</td>'; 6874 return html; 6875 }; 6876 /* Hit System 6877 ------------------------------------------------------------------------------------------------------------------*/ 6878 DayGrid.prototype.prepareHits = function () { 6879 this.colCoordCache.build(); 6880 this.rowCoordCache.build(); 6881 this.rowCoordCache.bottoms[this.rowCnt - 1] += this.bottomCoordPadding; // hack 6882 }; 6883 DayGrid.prototype.releaseHits = function () { 6884 this.colCoordCache.clear(); 6885 this.rowCoordCache.clear(); 6886 }; 6887 DayGrid.prototype.queryHit = function (leftOffset, topOffset) { 6888 if (this.colCoordCache.isLeftInBounds(leftOffset) && this.rowCoordCache.isTopInBounds(topOffset)) { 6889 var col = this.colCoordCache.getHorizontalIndex(leftOffset); 6890 var row = this.rowCoordCache.getVerticalIndex(topOffset); 6891 if (row != null && col != null) { 6892 return this.getCellHit(row, col); 6893 } 6894 } 6895 }; 6896 DayGrid.prototype.getHitFootprint = function (hit) { 6897 var range = this.getCellRange(hit.row, hit.col); 6898 return new ComponentFootprint_1.default(new UnzonedRange_1.default(range.start, range.end), true // all-day? 6899 ); 6900 }; 6901 DayGrid.prototype.getHitEl = function (hit) { 6902 return this.getCellEl(hit.row, hit.col); 6903 }; 6904 /* Cell System 6905 ------------------------------------------------------------------------------------------------------------------*/ 6906 // FYI: the first column is the leftmost column, regardless of date 6907 DayGrid.prototype.getCellHit = function (row, col) { 6908 return { 6909 row: row, 6910 col: col, 6911 component: this, 6912 left: this.colCoordCache.getLeftOffset(col), 6913 right: this.colCoordCache.getRightOffset(col), 6914 top: this.rowCoordCache.getTopOffset(row), 6915 bottom: this.rowCoordCache.getBottomOffset(row) 6916 }; 6917 }; 6918 DayGrid.prototype.getCellEl = function (row, col) { 6919 return this.cellEls.eq(row * this.colCnt + col); 6920 }; 6921 /* Event Rendering 6922 ------------------------------------------------------------------------------------------------------------------*/ 6923 // Unrenders all events currently rendered on the grid 6924 DayGrid.prototype.executeEventUnrender = function () { 6925 this.removeSegPopover(); // removes the "more.." events popover 6926 _super.prototype.executeEventUnrender.call(this); 6927 }; 6928 // Retrieves all rendered segment objects currently rendered on the grid 6929 DayGrid.prototype.getOwnEventSegs = function () { 6930 // append the segments from the "more..." popover 6931 return _super.prototype.getOwnEventSegs.call(this).concat(this.popoverSegs || []); 6932 }; 6933 /* Event Drag Visualization 6934 ------------------------------------------------------------------------------------------------------------------*/ 6935 // Renders a visual indication of an event or external element being dragged. 6936 // `eventLocation` has zoned start and end (optional) 6937 DayGrid.prototype.renderDrag = function (eventFootprints, seg, isTouch) { 6938 var i; 6939 for (i = 0; i < eventFootprints.length; i++) { 6940 this.renderHighlight(eventFootprints[i].componentFootprint); 6941 } 6942 // render drags from OTHER components as helpers 6943 if (eventFootprints.length && seg && seg.component !== this) { 6944 this.helperRenderer.renderEventDraggingFootprints(eventFootprints, seg, isTouch); 6945 return true; // signal helpers rendered 6946 } 6947 }; 6948 // Unrenders any visual indication of a hovering event 6949 DayGrid.prototype.unrenderDrag = function () { 6950 this.unrenderHighlight(); 6951 this.helperRenderer.unrender(); 6952 }; 6953 /* Event Resize Visualization 6954 ------------------------------------------------------------------------------------------------------------------*/ 6955 // Renders a visual indication of an event being resized 6956 DayGrid.prototype.renderEventResize = function (eventFootprints, seg, isTouch) { 6957 var i; 6958 for (i = 0; i < eventFootprints.length; i++) { 6959 this.renderHighlight(eventFootprints[i].componentFootprint); 6960 } 6961 this.helperRenderer.renderEventResizingFootprints(eventFootprints, seg, isTouch); 6962 }; 6963 // Unrenders a visual indication of an event being resized 6964 DayGrid.prototype.unrenderEventResize = function () { 6965 this.unrenderHighlight(); 6966 this.helperRenderer.unrender(); 6967 }; 6968 /* More+ Link Popover 6969 ------------------------------------------------------------------------------------------------------------------*/ 6970 DayGrid.prototype.removeSegPopover = function () { 6971 if (this.segPopover) { 6972 this.segPopover.hide(); // in handler, will call segPopover's removeElement 6973 } 6974 }; 6975 // Limits the number of "levels" (vertically stacking layers of events) for each row of the grid. 6976 // `levelLimit` can be false (don't limit), a number, or true (should be computed). 6977 DayGrid.prototype.limitRows = function (levelLimit) { 6978 var rowStructs = this.eventRenderer.rowStructs || []; 6979 var row; // row # 6980 var rowLevelLimit; 6981 for (row = 0; row < rowStructs.length; row++) { 6982 this.unlimitRow(row);
6983 if (!levelLimit) { 6984 rowLevelLimit = false; 6985 } 6986 else if (typeof levelLimit === 'number') { 6987 rowLevelLimit = levelLimit; 6988 } 6989 else { 6990 rowLevelLimit = this.computeRowLevelLimit(row); 6991 } 6992 if (rowLevelLimit !== false) { 6993 this.limitRow(row, rowLevelLimit); 6994 } 6995 } 6996 }; 6997 // Computes the number of levels a row will accomodate without going outside its bounds. 6998 // Assumes the row is "rigid" (maintains a constant height regardless of what is inside). 6999 // `row` is the row number. 7000 DayGrid.prototype.computeRowLevelLimit = function (row) { 7001 var rowEl = this.rowEls.eq(row); // the containing "fake" row div 7002 var rowHeight = rowEl.height(); // TODO: cache somehow? 7003 var trEls = this.eventRenderer.rowStructs[row].tbodyEl.children(); 7004 var i; 7005 var trEl; 7006 var trHeight; 7007 function iterInnerHeights(i, childNode) { 7008 trHeight = Math.max(trHeight, $(childNode).outerHeight()); 7009 } 7010 // Reveal one level <tr> at a time and stop when we find one out of bounds 7011 for (i = 0; i < trEls.length; i++) { 7012 trEl = trEls.eq(i).removeClass('fc-limited'); // reset to original state (reveal) 7013 // with rowspans>1 and IE8, trEl.outerHeight() would return the height of the largest cell, 7014 // so instead, find the tallest inner content element. 7015 trHeight = 0; 7016 trEl.find('> td > :first-child').each(iterInnerHeights); 7017 if (trEl.position().top + trHeight > rowHeight) { 7018 return i; 7019 } 7020 } 7021 return false; // should not limit at all 7022 }; 7023 // Limits the given grid row to the maximum number of levels and injects "more" links if necessary. 7024 // `row` is the row number. 7025 // `levelLimit` is a number for the maximum (inclusive) number of levels allowed. 7026 DayGrid.prototype.limitRow = function (row, levelLimit) { 7027 var _this = this; 7028 var rowStruct = this.eventRenderer.rowStructs[row]; 7029 var moreNodes = []; // array of "more" <a> links and <td> DOM nodes 7030 var col = 0; // col #, left-to-right (not chronologically) 7031 var levelSegs; // array of segment objects in the last allowable level, ordered left-to-right 7032 var cellMatrix; // a matrix (by level, then column) of all <td> jQuery elements in the row 7033 var limitedNodes; // array of temporarily hidden level <tr> and segment <td> DOM nodes 7034 var i; 7035 var seg; 7036 var segsBelow; // array of segment objects below `seg` in the current `col` 7037 var totalSegsBelow; // total number of segments below `seg` in any of the columns `seg` occupies 7038 var colSegsBelow; // array of segment arrays, below seg, one for each column (offset from segs's first column) 7039 var td; 7040 var rowspan; 7041 var segMoreNodes; // array of "more" <td> cells that will stand-in for the current seg's cell 7042 var j; 7043 var moreTd; 7044 var moreWrap; 7045 var moreLink; 7046 // Iterates through empty level cells and places "more" links inside if need be 7047 var emptyCellsUntil = function (endCol) { 7048 while (col < endCol) { 7049 segsBelow = _this.getCellSegs(row, col, levelLimit); 7050 if (segsBelow.length) { 7051 td = cellMatrix[levelLimit - 1][col]; 7052 moreLink = _this.renderMoreLink(row, col, segsBelow); 7053 moreWrap = $('<div/>').append(moreLink); 7054 td.append(moreWrap); 7055 moreNodes.push(moreWrap[0]); 7056 } 7057 col++; 7058 } 7059 }; 7060 if (levelLimit && levelLimit < rowStruct.segLevels.length) { 7061 levelSegs = rowStruct.segLevels[levelLimit - 1]; 7062 cellMatrix = rowStruct.cellMatrix; 7063 limitedNodes = rowStruct.tbodyEl.children().slice(levelLimit) // get level <tr> elements past the limit 7064 .addClass('fc-limited').get(); // hide elements and get a simple DOM-nodes array 7065 // iterate though segments in the last allowable level 7066 for (i = 0; i < levelSegs.length; i++) { 7067 seg = levelSegs[i]; 7068 emptyCellsUntil(seg.leftCol); // process empty cells before the segment 7069 // determine *all* segments below `seg` that occupy the same columns 7070 colSegsBelow = []; 7071 totalSegsBelow = 0; 7072 while (col <= seg.rightCol) { 7073 segsBelow = this.getCellSegs(row, col, levelLimit); 7074 colSegsBelow.push(segsBelow);
7075 totalSegsBelow += segsBelow.length; 7076 col++; 7077 } 7078 if (totalSegsBelow) { 7079 td = cellMatrix[levelLimit - 1][seg.leftCol]; // the segment's parent cell 7080 rowspan = td.attr('rowspan') || 1; 7081 segMoreNodes = []; 7082 // make a replacement <td> for each column the segment occupies. will be one for each colspan 7083 for (j = 0; j < colSegsBelow.length; j++) { 7084 moreTd = $('<td class="fc-more-cell"/>').attr('rowspan', rowspan); 7085 segsBelow = colSegsBelow[j]; 7086 moreLink = this.renderMoreLink(row, seg.leftCol + j, [seg].concat(segsBelow) // count seg as hidden too 7087 ); 7088 moreWrap = $('<div/>').append(moreLink); 7089 moreTd.append(moreWrap); 7090 segMoreNodes.push(moreTd[0]); 7091 moreNodes.push(moreTd[0]); 7092 } 7093 td.addClass('fc-limited').after($(segMoreNodes)); // hide original <td> and inject replacements 7094 limitedNodes.push(td[0]); 7095 } 7096 } 7097 emptyCellsUntil(this.colCnt); // finish off the level 7098 rowStruct.moreEls = $(moreNodes); // for easy undoing later 7099 rowStruct.limitedEls = $(limitedNodes); // for easy undoing later 7100 } 7101 }; 7102 // Reveals all levels and removes all "more"-related elements for a grid's row. 7103 // `row` is a row number. 7104 DayGrid.prototype.unlimitRow = function (row) { 7105 var rowStruct = this.eventRenderer.rowStructs[row]; 7106 if (rowStruct.moreEls) { 7107 rowStruct.moreEls.remove(); 7108 rowStruct.moreEls = null; 7109 } 7110 if (rowStruct.limitedEls) { 7111 rowStruct.limitedEls.removeClass('fc-limited'); 7112 rowStruct.limitedEls = null; 7113 } 7114 }; 7115 // Renders an <a> element that represents hidden event element for a cell. 7116 // Responsible for attaching click handler as well. 7117 DayGrid.prototype.renderMoreLink = function (row, col, hiddenSegs) { 7118 var _this = this; 7119 var view = this.view; 7120 return $('<a class="fc-more"/>') 7121 .text(this.getMoreLinkText(hiddenSegs.length)) 7122 .on('click', function (ev) { 7123 var clickOption = _this.opt('eventLimitClick'); 7124 var date = _this.getCellDate(row, col); 7125 var moreEl = $(ev.currentTarget); 7126 var dayEl = _this.getCellEl(row, col); 7127 var allSegs = _this.getCellSegs(row, col); 7128 // rescope the segments to be within the cell's date 7129 var reslicedAllSegs = _this.resliceDaySegs(allSegs, date); 7130 var reslicedHiddenSegs = _this.resliceDaySegs(hiddenSegs, date); 7131 if (typeof clickOption === 'function') { 7132 // the returned value can be an atomic option 7133 clickOption = _this.publiclyTrigger('eventLimitClick', { 7134 context: view, 7135 args: [ 7136 { 7137 date: date.clone(), 7138 dayEl: dayEl, 7139 moreEl: moreEl, 7140 segs: reslicedAllSegs, 7141 hiddenSegs: reslicedHiddenSegs 7142 }, 7143 ev, 7144 view 7145 ] 7146 }); 7147 } 7148 if (clickOption === 'popover') { 7149 _this.showSegPopover(row, col, moreEl, reslicedAllSegs); 7150 } 7151 else if (typeof clickOption === 'string') { 7152 view.calendar.zoomTo(date, clickOption); 7153 } 7154 }); 7155 }; 7156 // Reveals the popover that displays all events within a cell 7157 DayGrid.prototype.showSegPopover = function (row, col, moreLink, segs) { 7158 var _this = this; 7159 var view = this.view; 7160 var moreWrap = moreLink.parent(); // the <div> wrapper around the <a> 7161 var topEl; // the element we want to match the top coordinate of 7162 var options; 7163 if (this.rowCnt === 1) { 7164 topEl = view.el; // will cause the popover to cover any sort of header 7165 } 7166 else { 7167 topEl = this.rowEls.eq(row); // will align with top of row 7168 } 7169 options = { 7170 className: 'fc-more-popover ' + view.calendar.theme.getClass('popover'), 7171 content: this.renderSegPopoverContent(row, col, segs), 7172 parentEl: view.el, 7173 top: topEl.offset().top, 7174 autoHide: true, 7175 viewportConstrain: this.opt('popoverViewportConstrain'), 7176 hide: function () { 7177 // kill everything when the popover is hidden 7178 // notify events to be removed 7179 if (_this.popoverSegs) { 7180 _this.triggerBeforeEventSegsDestroyed(_this.popoverSegs); 7181 } 7182 _this.segPopover.removeElement(); 7183 _this.segPopover = null; 7184 _this.popoverSegs = null; 7185 } 7186 }; 7187 // Determine horizontal coordinate. 7188 // We use the moreWrap instead of the <td> to avoid border confusion. 7189 if (this.isRTL) { 7190 options.right = moreWrap.offset().left + moreWrap.outerWidth() + 1; // +1 to be over cell border 7191 } 7192 else { 7193 options.left = moreWrap.offset().left - 1; // -1 to be over cell border 7194 } 7195 this.segPopover = new Popover_1.default(options); 7196 this.segPopover.show(); 7197 // the popover doesn't live within the grid's container element, and thus won't get the event 7198 // delegated-handlers for free. attach event-related handlers to the popover. 7199 this.bindAllSegHandlersToEl(this.segPopover.el); 7200 this.triggerAfterEventSegsRendered(segs); 7201 }; 7202 // Builds the inner DOM contents of the segment popover 7203 DayGrid.prototype.renderSegPopoverContent = function (row, col, segs) { 7204 var view = this.view; 7205 var theme = view.calendar.theme; 7206 var title = this.getCellDate(row, col).format(this.opt('dayPopoverFormat'));
7207 var content = $('<div class="fc-header ' + theme.getClass('popoverHeader') + '">' + 7208 '<span class="fc-close ' + theme.getIconClass('close') + '"></span>' + 7209 '<span class="fc-title">' + 7210 util_1.htmlEscape(title) + 7211 '</span>' + 7212 '<div class="fc-clear"/>' + 7213 '</div>' + 7214 '<div class="fc-body ' + theme.getClass('popoverContent') + '">' + 7215 '<div class="fc-event-container"></div>' + 7216 '</div>'); 7217 var segContainer = content.find('.fc-event-container'); 7218 var i; 7219 // render each seg's `el` and only return the visible segs 7220 segs = this.eventRenderer.renderFgSegEls(segs, true); // disableResizing=true 7221 this.popoverSegs = segs; 7222 for (i = 0; i < segs.length; i++) { 7223 // because segments in the popover are not part of a grid coordinate system, provide a hint to any 7224 // grids that want to do drag-n-drop about which cell it came from 7225 this.hitsNeeded(); 7226 segs[i].hit = this.getCellHit(row, col); 7227 this.hitsNotNeeded(); 7228 segContainer.append(segs[i].el); 7229 } 7230 return content; 7231 }; 7232 // Given the events within an array of segment objects, reslice them to be in a single day 7233 DayGrid.prototype.resliceDaySegs = function (segs, dayDate) { 7234 var dayStart = dayDate.clone(); 7235 var dayEnd = dayStart.clone().add(1, 'days'); 7236 var dayRange = new UnzonedRange_1.default(dayStart, dayEnd); 7237 var newSegs = []; 7238 var i; 7239 var seg; 7240 var slicedRange; 7241 for (i = 0; i < segs.length; i++) { 7242 seg = segs[i]; 7243 slicedRange = seg.footprint.componentFootprint.unzonedRange.intersect(dayRange); 7244 if (slicedRange) { 7245 newSegs.push($.extend({}, seg, { 7246 footprint: new EventFootprint_1.default(new ComponentFootprint_1.default(slicedRange, seg.footprint.componentFootprint.isAllDay), seg.footprint.eventDef, seg.footprint.eventInstance), 7247 isStart: seg.isStart && slicedRange.isStart, 7248 isEnd: seg.isEnd && slicedRange.isEnd 7249 })); 7250 } 7251 } 7252 // force an order because eventsToSegs doesn't guarantee one 7253 // TODO: research if still needed 7254 this.eventRenderer.sortEventSegs(newSegs); 7255 return newSegs; 7256 }; 7257 // Generates the text that should be inside a "more" link, given the number of events it represents 7258 DayGrid.prototype.getMoreLinkText = function (num) { 7259 var opt = this.opt('eventLimitText'); 7260 if (typeof opt === 'function') { 7261 return opt(num); 7262 } 7263 else { 7264 return '+' + num + ' ' + opt; 7265 } 7266 }; 7267 // Returns segments within a given cell. 7268 // If `startLevel` is specified, returns only events including and below that level. Otherwise returns all segs. 7269 DayGrid.prototype.getCellSegs = function (row, col, startLevel) { 7270 var segMatrix = this.eventRenderer.rowStructs[row].segMatrix; 7271 var level = startLevel || 0; 7272 var segs = []; 7273 var seg; 7274 while (level < segMatrix.length) { 7275 seg = segMatrix[level][col]; 7276 if (seg) { 7277 segs.push(seg); 7278 } 7279 level++; 7280 } 7281 return segs; 7282 }; 7283 return DayGrid; 7284}(InteractiveDateComponent_1.default)); 7285exports.default = DayGrid; 7286DayGrid.prototype.eventRendererClass = DayGridEventRenderer_1.default; 7287DayGrid.prototype.businessHourRendererClass = BusinessHourRenderer_1.default; 7288DayGrid.prototype.helperRendererClass = DayGridHelperRenderer_1.default; 7289DayGrid.prototype.fillRendererClass = DayGridFillRenderer_1.default; 7290StandardInteractionsMixin_1.default.mixInto(DayGrid); 7291DayTableMixin_1.default.mixInto(DayGrid); 7292 7293 7294/***/ }), 7295/* 62 */ 7296/***/ (function(module, exports, __webpack_require__) { 7297 7298Object.defineProperty(exports, "__esModule", { value: true }); 7299var tslib_1 = __webpack_require__(2); 7300var $ = __webpack_require__(3); 7301var util_1 = __webpack_require__(4); 7302var Scroller_1 = __webpack_require__(39); 7303var View_1 = __webpack_require__(41); 7304var BasicViewDateProfileGenerator_1 = __webpack_require__(228); 7305var DayGrid_1 = __webpack_require__(61); 7306/* An abstract class for the "basic" views, as well as month view. Renders one or more rows of day cells. 7307----------------------------------------------------------------------------------------------------------------------*/ 7308// It is a manager for a DayGrid subcomponent, which does most of the heavy lifting. 7309// It is responsible for managing width/height. 7310var BasicView = /** @class */ (function (_super) { 7311 tslib_1.__extends(BasicView, _super); 7312 function BasicView(calendar, viewSpec) { 7313 var _this = _super.call(this, calendar, viewSpec) || this; 7314 _this.dayGrid = _this.instantiateDayGrid(); 7315 _this.dayGrid.isRigid = _this.hasRigidRows(); 7316 if (_this.opt('weekNumbers')) { 7317 if (_this.opt('weekNumbersWithinDays')) { 7318 _this.dayGrid.cellWeekNumbersVisible = true; 7319 _this.dayGrid.colWeekNumbersVisible = false; 7320 } 7321 else { 7322 _this.dayGrid.cellWeekNumbersVisible = false; 7323 _this.dayGrid.colWeekNumbersVisible = true; 7324 } 7325 } 7326 _this.addChild(_this.dayGrid); 7327 _this.scroller = new Scroller_1.default({ 7328 overflowX: 'hidden', 7329 overflowY: 'auto' 7330 }); 7331 return _this; 7332 } 7333 // Generates the DayGrid object this view needs. Draws from this.dayGridClass 7334 BasicView.prototype.instantiateDayGrid = function () { 7335 // generate a subclass on the fly with BasicView-specific behavior 7336 // TODO: cache this subclass 7337 var subclass = makeDayGridSubclass(this.dayGridClass); 7338 return new subclass(this); 7339 }; 7340 BasicView.prototype.executeDateRender = function (dateProfile) { 7341 this.dayGrid.breakOnWeeks = /year|month|week/.test(dateProfile.currentRangeUnit); 7342 _super.prototype.executeDateRender.call(this, dateProfile); 7343 }; 7344 BasicView.prototype.renderSkeleton = function () { 7345 var dayGridContainerEl; 7346 var dayGridEl; 7347 this.el.addClass('fc-basic-view').html(this.renderSkeletonHtml()); 7348 this.scroller.render(); 7349 dayGridContainerEl = this.scroller.el.addClass('fc-day-grid-container');
7350 dayGridEl = $('<div class="fc-day-grid" />').appendTo(dayGridContainerEl); 7351 this.el.find('.fc-body > tr > td').append(dayGridContainerEl); 7352 this.dayGrid.headContainerEl = this.el.find('.fc-head-container'); 7353 this.dayGrid.setElement(dayGridEl); 7354 }; 7355 BasicView.prototype.unrenderSkeleton = function () { 7356 this.dayGrid.removeElement(); 7357 this.scroller.destroy(); 7358 }; 7359 // Builds the HTML skeleton for the view. 7360 // The day-grid component will render inside of a container defined by this HTML. 7361 BasicView.prototype.renderSkeletonHtml = function () { 7362 var theme = this.calendar.theme; 7363 return '' + 7364 '<table class="' + theme.getClass('tableGrid') + '">' + 7365 (this.opt('columnHeader') ? 7366 '<thead class="fc-head">' + 7367 '<tr>' + 7368 '<td class="fc-head-container ' + theme.getClass('widgetHeader') + '"> </td>' + 7369 '</tr>' + 7370 '</thead>' : 7371 '') + 7372 '<tbody class="fc-body">' + 7373 '<tr>' + 7374 '<td class="' + theme.getClass('widgetContent') + '"></td>' + 7375 '</tr>' + 7376 '</tbody>' + 7377 '</table>'; 7378 }; 7379 // Generates an HTML attribute string for setting the width of the week number column, if it is known 7380 BasicView.prototype.weekNumberStyleAttr = function () { 7381 if (this.weekNumberWidth != null) { 7382 return 'style="width:' + this.weekNumberWidth + 'px"'; 7383 } 7384 return ''; 7385 }; 7386 // Determines whether each row should have a constant height 7387 BasicView.prototype.hasRigidRows = function () { 7388 var eventLimit = this.opt('eventLimit'); 7389 return eventLimit && typeof eventLimit !== 'number'; 7390 }; 7391 /* Dimensions 7392 ------------------------------------------------------------------------------------------------------------------*/ 7393 // Refreshes the horizontal dimensions of the view 7394 BasicView.prototype.updateSize = function (totalHeight, isAuto, isResize) { 7395 var eventLimit = this.opt('eventLimit'); 7396 var headRowEl = this.dayGrid.headContainerEl.find('.fc-row'); 7397 var scrollerHeight; 7398 var scrollbarWidths; 7399 // hack to give the view some height prior to dayGrid's columns being rendered 7400 // TODO: separate setting height from scroller VS dayGrid. 7401 if (!this.dayGrid.rowEls) { 7402 if (!isAuto) { 7403 scrollerHeight = this.computeScrollerHeight(totalHeight); 7404 this.scroller.setHeight(scrollerHeight); 7405 } 7406 return; 7407 } 7408 _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize); 7409 if (this.dayGrid.colWeekNumbersVisible) { 7410 // Make sure all week number cells running down the side have the same width. 7411 // Record the width for cells created later. 7412 this.weekNumberWidth = util_1.matchCellWidths(this.el.find('.fc-week-number')); 7413 } 7414 // reset all heights to be natural 7415 this.scroller.clear(); 7416 util_1.uncompensateScroll(headRowEl); 7417 this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed 7418 // is the event limit a constant level number? 7419 if (eventLimit && typeof eventLimit === 'number') { 7420 this.dayGrid.limitRows(eventLimit); // limit the levels first so the height can redistribute after 7421 } 7422 // distribute the height to the rows 7423 // (totalHeight is a "recommended" value if isAuto) 7424 scrollerHeight = this.computeScrollerHeight(totalHeight); 7425 this.setGridHeight(scrollerHeight, isAuto); 7426 // is the event limit dynamically calculated? 7427 if (eventLimit && typeof eventLimit !== 'number') { 7428 this.dayGrid.limitRows(eventLimit); // limit the levels after the grid's row heights have been set 7429 } 7430 if (!isAuto) { 7431 this.scroller.setHeight(scrollerHeight);
7432 scrollbarWidths = this.scroller.getScrollbarWidths(); 7433 if (scrollbarWidths.left || scrollbarWidths.right) { 7434 util_1.compensateScroll(headRowEl, scrollbarWidths); 7435 // doing the scrollbar compensation might have created text overflow which created more height. redo 7436 scrollerHeight = this.computeScrollerHeight(totalHeight); 7437 this.scroller.setHeight(scrollerHeight); 7438 } 7439 // guarantees the same scrollbar widths 7440 this.scroller.lockOverflow(scrollbarWidths); 7441 } 7442 }; 7443 // given a desired total height of the view, returns what the height of the scroller should be 7444 BasicView.prototype.computeScrollerHeight = function (totalHeight) { 7445 return totalHeight - 7446 util_1.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller 7447 }; 7448 // Sets the height of just the DayGrid component in this view 7449 BasicView.prototype.setGridHeight = function (height, isAuto) { 7450 if (isAuto) { 7451 util_1.undistributeHeight(this.dayGrid.rowEls); // let the rows be their natural height with no expanding 7452 } 7453 else { 7454 util_1.distributeHeight(this.dayGrid.rowEls, height, true); // true = compensate for height-hogging rows 7455 } 7456 }; 7457 /* Scroll 7458 ------------------------------------------------------------------------------------------------------------------*/ 7459 BasicView.prototype.computeInitialDateScroll = function () { 7460 return { top: 0 }; 7461 }; 7462 BasicView.prototype.queryDateScroll = function () { 7463 return { top: this.scroller.getScrollTop() }; 7464 }; 7465 BasicView.prototype.applyDateScroll = function (scroll) { 7466 if (scroll.top !== undefined) { 7467 this.scroller.setScrollTop(scroll.top); 7468 } 7469 }; 7470 return BasicView; 7471}(View_1.default)); 7472exports.default = BasicView; 7473BasicView.prototype.dateProfileGeneratorClass = BasicViewDateProfileGenerator_1.default; 7474BasicView.prototype.dayGridClass = DayGrid_1.default; 7475// customize the rendering behavior of BasicView's dayGrid 7476function makeDayGridSubclass(SuperClass) { 7477 return /** @class */ (function (_super) { 7478 tslib_1.__extends(SubClass, _super); 7479 function SubClass() { 7480 var _this = _super !== null && _super.apply(this, arguments) || this; 7481 _this.colWeekNumbersVisible = false; // display week numbers along the side? 7482 return _this; 7483 } 7484 // Generates the HTML that will go before the day-of week header cells 7485 SubClass.prototype.renderHeadIntroHtml = function () { 7486 var view = this.view; 7487 if (this.colWeekNumbersVisible) { 7488 return '' + 7489 '<th class="fc-week-number ' + view.calendar.theme.getClass('widgetHeader') + '" ' + view.weekNumberStyleAttr() + '>' + 7490 '<span>' + // needed for matchCellWidths 7491 util_1.htmlEscape(this.opt('weekNumberTitle')) + 7492 '</span>' + 7493 '</th>'; 7494 } 7495 return ''; 7496 }; 7497 // Generates the HTML that will go before content-skeleton cells that display the day/week numbers 7498 SubClass.prototype.renderNumberIntroHtml = function (row) { 7499 var view = this.view; 7500 var weekStart = this.getCellDate(row, 0); 7501 if (this.colWeekNumbersVisible) { 7502 return '' + 7503 '<td class="fc-week-number" ' + view.weekNumberStyleAttr() + '>' + 7504 view.buildGotoAnchorHtml(// aside from link, important for matchCellWidths 7505 { date: weekStart, type: 'week', forceOff: this.colCnt === 1 }, weekStart.format('w') // inner HTML 7506 ) + 7507 '</td>'; 7508 } 7509 return ''; 7510 }; 7511 // Generates the HTML that goes before the day bg cells for each day-row 7512 SubClass.prototype.renderBgIntroHtml = function () { 7513 var view = this.view; 7514 if (this.colWeekNumbersVisible) { 7515 return '<td class="fc-week-number ' + view.calendar.theme.getClass('widgetContent') + '" ' + 7516 view.weekNumberStyleAttr() + '></td>'; 7517 } 7518 return ''; 7519 }; 7520 // Generates the HTML that goes before every other type of row generated by DayGrid. 7521 // Affects helper-skeleton and highlight-skeleton rows. 7522 SubClass.prototype.renderIntroHtml = function () { 7523 var view = this.view; 7524 if (this.colWeekNumbersVisible) { 7525 return '<td class="fc-week-number" ' + view.weekNumberStyleAttr() + '></td>'; 7526 } 7527 return ''; 7528 }; 7529 SubClass.prototype.getIsNumbersVisible = function () { 7530 return DayGrid_1.default.prototype.getIsNumbersVisible.apply(this, arguments) || this.colWeekNumbersVisible; 7531 }; 7532 return SubClass; 7533 }(SuperClass)); 7534} 7535 7536 7537/***/ }), 7538/* 63 */, 7539/* 64 */, 7540/* 65 */, 7541/* 66 */, 7542/* 67 */, 7543/* 68 */, 7544/* 69 */, 7545/* 70 */, 7546/* 71 */, 7547/* 72 */, 7548/* 73 */, 7549/* 74 */, 7550/* 75 */, 7551/* 76 */, 7552/* 77 */, 7553/* 78 */, 7554/* 79 */, 7555/* 80 */, 7556/* 81 */, 7557/* 82 */, 7558/* 83 */, 7559/* 84 */, 7560/* 85 */, 7561/* 86 */, 7562/* 87 */, 7563/* 88 */, 7564/* 89 */, 7565/* 90 */, 7566/* 91 */, 7567/* 92 */, 7568/* 93 */, 7569/* 94 */, 7570/* 95 */, 7571/* 96 */, 7572/* 97 */, 7573/* 98 */, 7574/* 99 */, 7575/* 100 */, 7576/* 101 */, 7577/* 102 */, 7578/* 103 */, 7579/* 104 */, 7580/* 105 */, 7581/* 106 */, 7582/* 107 */, 7583/* 108 */, 7584/* 109 */, 7585/* 110 */, 7586/* 111 */, 7587/* 112 */, 7588/* 113 */, 7589/* 114 */, 7590/* 115 */, 7591/* 116 */, 7592/* 117 */, 7593/* 118 */, 7594/* 119 */, 7595/* 120 */, 7596/* 121 */, 7597/* 122 */, 7598/* 123 */, 7599/* 124 */, 7600/* 125 */, 7601/* 126 */, 7602/* 127 */, 7603/* 128 */, 7604/* 129 */, 7605/* 130 */, 7606/* 131 */, 7607/* 132 */, 7608/* 133 */, 7609/* 134 */, 7610/* 135 */, 7611/* 136 */, 7612/* 137 */, 7613/* 138 */, 7614/* 139 */, 7615/* 140 */, 7616/* 141 */, 7617/* 142 */, 7618/* 143 */, 7619/* 144 */, 7620/* 145 */, 7621/* 146 */, 7622/* 147 */, 7623/* 148 */, 7624/* 149 */, 7625/* 150 */, 7626/* 151 */, 7627/* 152 */, 7628/* 153 */, 7629/* 154 */, 7630/* 155 */, 7631/* 156 */, 7632/* 157 */, 7633/* 158 */, 7634/* 159 */, 7635/* 160 */, 7636/* 161 */, 7637/* 162 */, 7638/* 163 */, 7639/* 164 */, 7640/* 165 */, 7641/* 166 */, 7642/* 167 */, 7643/* 168 */, 7644/* 169 */, 7645/* 170 */, 7646/* 171 */, 7647/* 172 */, 7648/* 173 */, 7649/* 174 */, 7650/* 175 */, 7651/* 176 */, 7652/* 177 */, 7653/* 178 */, 7654/* 179 */, 7655/* 180 */, 7656/* 181 */, 7657/* 182 */, 7658/* 183 */, 7659/* 184 */, 7660/* 185 */, 7661/* 186 */, 7662/* 187 */, 7663/* 188 */, 7664/* 189 */, 7665/* 190 */, 7666/* 191 */, 7667/* 192 */, 7668/* 193 */, 7669/* 194 */, 7670/* 195 */, 7671/* 196 */, 7672/* 197 */, 7673/* 198 */, 7674/* 199 */, 7675/* 200 */, 7676/* 201 */, 7677/* 202 */, 7678/* 203 */, 7679/* 204 */, 7680/* 205 */, 7681/* 206 */, 7682/* 207 */ 7683/***/ (function(module, exports, __webpack_require__) { 7684 7685Object.defineProperty(exports, "__esModule", { value: true });
7686var UnzonedRange_1 = __webpack_require__(5); 7687var ComponentFootprint_1 = __webpack_require__(12); 7688var EventDefParser_1 = __webpack_require__(49); 7689var EventSource_1 = __webpack_require__(6); 7690var util_1 = __webpack_require__(35); 7691var Constraints = /** @class */ (function () { 7692 function Constraints(eventManager, _calendar) { 7693 this.eventManager = eventManager; 7694 this._calendar = _calendar; 7695 } 7696 Constraints.prototype.opt = function (name) { 7697 return this._calendar.opt(name); 7698 }; 7699 /* 7700 determines if eventInstanceGroup is allowed, 7701 in relation to other EVENTS and business hours. 7702 */ 7703 Constraints.prototype.isEventInstanceGroupAllowed = function (eventInstanceGroup) { 7704 var eventDef = eventInstanceGroup.getEventDef(); 7705 var eventFootprints = this.eventRangesToEventFootprints(eventInstanceGroup.getAllEventRanges()); 7706 var i; 7707 var peerEventInstances = this.getPeerEventInstances(eventDef); 7708 var peerEventRanges = peerEventInstances.map(util_1.eventInstanceToEventRange); 7709 var peerEventFootprints = this.eventRangesToEventFootprints(peerEventRanges); 7710 var constraintVal = eventDef.getConstraint(); 7711 var overlapVal = eventDef.getOverlap(); 7712 var eventAllowFunc = this.opt('eventAllow'); 7713 for (i = 0; i < eventFootprints.length; i++) { 7714 if (!this.isFootprintAllowed(eventFootprints[i].componentFootprint, peerEventFootprints, constraintVal, overlapVal, eventFootprints[i].eventInstance)) { 7715 return false; 7716 } 7717 } 7718 if (eventAllowFunc) { 7719 for (i = 0; i < eventFootprints.length; i++) { 7720 if (eventAllowFunc(eventFootprints[i].componentFootprint.toLegacy(this._calendar), eventFootprints[i].getEventLegacy()) === false) { 7721 return false; 7722 } 7723 } 7724 } 7725 return true; 7726 }; 7727 Constraints.prototype.getPeerEventInstances = function (eventDef) { 7728 return this.eventManager.getEventInstancesWithoutId(eventDef.id); 7729 }; 7730 Constraints.prototype.isSelectionFootprintAllowed = function (componentFootprint) { 7731 var peerEventInstances = this.eventManager.getEventInstances(); 7732 var peerEventRanges = peerEventInstances.map(util_1.eventInstanceToEventRange); 7733 var peerEventFootprints = this.eventRangesToEventFootprints(peerEventRanges); 7734 var selectAllowFunc; 7735 if (this.isFootprintAllowed(componentFootprint, peerEventFootprints, this.opt('selectConstraint'), this.opt('selectOverlap'))) { 7736 selectAllowFunc = this.opt('selectAllow'); 7737 if (selectAllowFunc) { 7738 return selectAllowFunc(componentFootprint.toLegacy(this._calendar)) !== false; 7739 } 7740 else { 7741 return true; 7742 } 7743 } 7744 return false; 7745 }; 7746 Constraints.prototype.isFootprintAllowed = function (componentFootprint, peerEventFootprints, constraintVal, overlapVal, subjectEventInstance // optional 7747 ) { 7748 var constraintFootprints; // ComponentFootprint[] 7749 var overlapEventFootprints; // EventFootprint[] 7750 if (constraintVal != null) { 7751 constraintFootprints = this.constraintValToFootprints(constraintVal, componentFootprint.isAllDay); 7752 if (!this.isFootprintWithinConstraints(componentFootprint, constraintFootprints)) { 7753 return false; 7754 } 7755 } 7756 overlapEventFootprints = this.collectOverlapEventFootprints(peerEventFootprints, componentFootprint); 7757 if (overlapVal === false) { 7758 if (overlapEventFootprints.length) { 7759 return false; 7760 } 7761 } 7762 else if (typeof overlapVal === 'function') { 7763 if (!isOverlapsAllowedByFunc(overlapEventFootprints, overlapVal, subjectEventInstance)) { 7764 return false; 7765 } 7766 } 7767 if (subjectEventInstance) { 7768 if (!isOverlapEventInstancesAllowed(overlapEventFootprints, subjectEventInstance)) { 7769 return false; 7770 } 7771 } 7772 return true; 7773 }; 7774 // Constraint 7775 // ------------------------------------------------------------------------------------------------ 7776 Constraints.prototype.isFootprintWithinConstraints = function (componentFootprint, constraintFootprints) { 7777 var i; 7778 for (i = 0; i < constraintFootprints.length; i++) { 7779 if (this.footprintContainsFootprint(constraintFootprints[i], componentFootprint)) { 7780 return true; 7781 } 7782 } 7783 return false; 7784 }; 7785 Constraints.prototype.constraintValToFootprints = function (constraintVal, isAllDay) { 7786 var eventInstances; 7787 if (constraintVal === 'businessHours') { 7788 return this.buildCurrentBusinessFootprints(isAllDay); 7789 } 7790 else if (typeof constraintVal === 'object') { 7791 eventInstances = this.parseEventDefToInstances(constraintVal); // handles recurring events 7792 if (!eventInstances) { 7793 return this.parseFootprints(constraintVal); 7794 } 7795 else { 7796 return this.eventInstancesToFootprints(eventInstances); 7797 } 7798 } 7799 else if (constraintVal != null) { 7800 eventInstances = this.eventManager.getEventInstancesWithId(constraintVal); 7801 return this.eventInstancesToFootprints(eventInstances); 7802 } 7803 }; 7804 // returns ComponentFootprint[] 7805 // uses current view's range 7806 Constraints.prototype.buildCurrentBusinessFootprints = function (isAllDay) { 7807 var view = this._calendar.view; 7808 var businessHourGenerator = view.get('businessHourGenerator'); 7809 var unzonedRange = view.dateProfile.activeUnzonedRange; 7810 var eventInstanceGroup = businessHourGenerator.buildEventInstanceGroup(isAllDay, unzonedRange); 7811 if (eventInstanceGroup) { 7812 return this.eventInstancesToFootprints(eventInstanceGroup.eventInstances); 7813 } 7814 else { 7815 return []; 7816 } 7817 }; 7818 // conversion util 7819 Constraints.prototype.eventInstancesToFootprints = function (eventInstances) { 7820 var eventRanges = eventInstances.map(util_1.eventInstanceToEventRange); 7821 var eventFootprints = this.eventRangesToEventFootprints(eventRanges); 7822 return eventFootprints.map(util_1.eventFootprintToComponentFootprint); 7823 }; 7824 // Overlap 7825 // ------------------------------------------------------------------------------------------------ 7826 Constraints.prototype.collectOverlapEventFootprints = function (peerEventFootprints, targetFootprint) { 7827 var overlapEventFootprints = []; 7828 var i; 7829 for (i = 0; i < peerEventFootprints.length; i++) { 7830 if (this.footprintsIntersect(targetFootprint, peerEventFootprints[i].componentFootprint)) { 7831 overlapEventFootprints.push(peerEventFootprints[i]); 7832 } 7833 } 7834 return overlapEventFootprints; 7835 }; 7836 // Conversion: eventDefs -> eventInstances -> eventRanges -> eventFootprints -> componentFootprints 7837 // ------------------------------------------------------------------------------------------------ 7838 // NOTE: this might seem like repetitive code with the Grid class, however, this code is related to 7839 // constraints whereas the Grid code is related to rendering. Each approach might want to convert 7840 // eventRanges -> eventFootprints in a different way. Regardless, there are opportunities to make 7841 // this more DRY. 7842 /*
7843 Returns false on invalid input. 7844 */ 7845 Constraints.prototype.parseEventDefToInstances = function (eventInput) { 7846 var eventManager = this.eventManager; 7847 var eventDef = EventDefParser_1.default.parse(eventInput, new EventSource_1.default(this._calendar)); 7848 if (!eventDef) { 7849 return false; 7850 } 7851 return eventDef.buildInstances(eventManager.currentPeriod.unzonedRange); 7852 }; 7853 Constraints.prototype.eventRangesToEventFootprints = function (eventRanges) { 7854 var i; 7855 var eventFootprints = []; 7856 for (i = 0; i < eventRanges.length; i++) { 7857 eventFootprints.push.apply(// footprints 7858 eventFootprints, this.eventRangeToEventFootprints(eventRanges[i])); 7859 } 7860 return eventFootprints; 7861 }; 7862 Constraints.prototype.eventRangeToEventFootprints = function (eventRange) { 7863 return [util_1.eventRangeToEventFootprint(eventRange)]; 7864 }; 7865 /* 7866 Parses footprints directly. 7867 Very similar to EventDateProfile::parse :( 7868 */ 7869 Constraints.prototype.parseFootprints = function (rawInput) { 7870 var start; 7871 var end; 7872 if (rawInput.start) { 7873 start = this._calendar.moment(rawInput.start); 7874 if (!start.isValid()) { 7875 start = null; 7876 } 7877 } 7878 if (rawInput.end) { 7879 end = this._calendar.moment(rawInput.end); 7880 if (!end.isValid()) { 7881 end = null; 7882 } 7883 } 7884 return [ 7885 new ComponentFootprint_1.default(new UnzonedRange_1.default(start, end), (start && !start.hasTime()) || (end && !end.hasTime()) // isAllDay 7886 ) 7887 ]; 7888 }; 7889 // Footprint Utils 7890 // ---------------------------------------------------------------------------------------- 7891 Constraints.prototype.footprintContainsFootprint = function (outerFootprint, innerFootprint) { 7892 return outerFootprint.unzonedRange.containsRange(innerFootprint.unzonedRange); 7893 }; 7894 Constraints.prototype.footprintsIntersect = function (footprint0, footprint1) { 7895 return footprint0.unzonedRange.intersectsWith(footprint1.unzonedRange); 7896 }; 7897 return Constraints; 7898}()); 7899exports.default = Constraints; 7900// optional subjectEventInstance 7901function isOverlapsAllowedByFunc(overlapEventFootprints, overlapFunc, subjectEventInstance) { 7902 var i; 7903 for (i = 0; i < overlapEventFootprints.length; i++) { 7904 if (!overlapFunc(overlapEventFootprints[i].eventInstance.toLegacy(), subjectEventInstance ? subjectEventInstance.toLegacy() : null)) { 7905 return false; 7906 } 7907 } 7908 return true; 7909} 7910function isOverlapEventInstancesAllowed(overlapEventFootprints, subjectEventInstance) { 7911 var subjectLegacyInstance = subjectEventInstance.toLegacy(); 7912 var i; 7913 var overlapEventInstance; 7914 var overlapEventDef; 7915 var overlapVal; 7916 for (i = 0; i < overlapEventFootprints.length; i++) { 7917 overlapEventInstance = overlapEventFootprints[i].eventInstance; 7918 overlapEventDef = overlapEventInstance.def; 7919 // don't need to pass in calendar, because don't want to consider global eventOverlap property, 7920 // because we already considered that earlier in the process. 7921 overlapVal = overlapEventDef.getOverlap(); 7922 if (overlapVal === false) { 7923 return false; 7924 } 7925 else if (typeof overlapVal === 'function') { 7926 if (!overlapVal(overlapEventInstance.toLegacy(), subjectLegacyInstance)) { 7927 return false; 7928 } 7929 } 7930 } 7931 return true; 7932} 7933 7934 7935/***/ }), 7936/* 208 */ 7937/***/ (function(module, exports, __webpack_require__) { 7938 7939/* 7940USAGE: 7941 import { default as ParsableModelMixin, ParsableModelInterface } from './ParsableModelMixin' 7942in class: 7943 applyProps: ParsableModelInterface['applyProps'] 7944 applyManualStandardProps: ParsableModelInterface['applyManualStandardProps'] 7945 applyMiscProps: ParsableModelInterface['applyMiscProps'] 7946 isStandardProp: ParsableModelInterface['isStandardProp'] 7947 static defineStandardProps = ParsableModelMixin.defineStandardProps 7948 static copyVerbatimStandardProps = ParsableModelMixin.copyVerbatimStandardProps 7949after class: 7950 ParsableModelMixin.mixInto(TheClass) 7951*/ 7952Object.defineProperty(exports, "__esModule", { value: true });
7953var tslib_1 = __webpack_require__(2); 7954var util_1 = __webpack_require__(4); 7955var Mixin_1 = __webpack_require__(14); 7956var ParsableModelMixin = /** @class */ (function (_super) { 7957 tslib_1.__extends(ParsableModelMixin, _super); 7958 function ParsableModelMixin() { 7959 return _super !== null && _super.apply(this, arguments) || this; 7960 } 7961 ParsableModelMixin.defineStandardProps = function (propDefs) { 7962 var proto = this.prototype; 7963 if (!proto.hasOwnProperty('standardPropMap')) { 7964 proto.standardPropMap = Object.create(proto.standardPropMap); 7965 } 7966 util_1.copyOwnProps(propDefs, proto.standardPropMap); 7967 }; 7968 ParsableModelMixin.copyVerbatimStandardProps = function (src, dest) { 7969 var map = this.prototype.standardPropMap; 7970 var propName; 7971 for (propName in map) { 7972 if (src[propName] != null && // in the src object? 7973 map[propName] === true // false means "copy verbatim" 7974 ) { 7975 dest[propName] = src[propName]; 7976 } 7977 } 7978 }; 7979 /* 7980 Returns true/false for success. 7981 Meant to be only called ONCE, at object creation. 7982 */ 7983 ParsableModelMixin.prototype.applyProps = function (rawProps) { 7984 var standardPropMap = this.standardPropMap; 7985 var manualProps = {}; 7986 var miscProps = {}; 7987 var propName; 7988 for (propName in rawProps) { 7989 if (standardPropMap[propName] === true) { 7990 this[propName] = rawProps[propName]; 7991 } 7992 else if (standardPropMap[propName] === false) { 7993 manualProps[propName] = rawProps[propName]; 7994 } 7995 else { 7996 miscProps[propName] = rawProps[propName]; 7997 } 7998 } 7999 this.applyMiscProps(miscProps); 8000 return this.applyManualStandardProps(manualProps); 8001 }; 8002 /* 8003 If subclasses override, they must call this supermethod and return the boolean response. 8004 Meant to be only called ONCE, at object creation. 8005 */ 8006 ParsableModelMixin.prototype.applyManualStandardProps = function (rawProps) { 8007 return true; 8008 }; 8009 /* 8010 Can be called even after initial object creation. 8011 */ 8012 ParsableModelMixin.prototype.applyMiscProps = function (rawProps) { 8013 // subclasses can implement 8014 }; 8015 /* 8016 TODO: why is this a method when defineStandardProps is static 8017 */ 8018 ParsableModelMixin.prototype.isStandardProp = function (propName) { 8019 return propName in this.standardPropMap; 8020 }; 8021 return ParsableModelMixin; 8022}(Mixin_1.default)); 8023exports.default = ParsableModelMixin; 8024ParsableModelMixin.prototype.standardPropMap = {}; // will be cloned by defineStandardProps 8025 8026 8027/***/ }), 8028/* 209 */ 8029/***/ (function(module, exports) { 8030 8031Object.defineProperty(exports, "__esModule", { value: true }); 8032var EventInstance = /** @class */ (function () { 8033 function EventInstance(def, dateProfile) { 8034 this.def = def; 8035 this.dateProfile = dateProfile; 8036 } 8037 EventInstance.prototype.toLegacy = function () { 8038 var dateProfile = this.dateProfile; 8039 var obj = this.def.toLegacy(); 8040 obj.start = dateProfile.start.clone(); 8041 obj.end = dateProfile.end ? dateProfile.end.clone() : null; 8042 return obj; 8043 }; 8044 return EventInstance; 8045}()); 8046exports.default = EventInstance; 8047 8048 8049/***/ }), 8050/* 210 */ 8051/***/ (function(module, exports, __webpack_require__) { 8052 8053Object.defineProperty(exports, "__esModule", { value: true }); 8054var tslib_1 = __webpack_require__(2); 8055var $ = __webpack_require__(3); 8056var moment = __webpack_require__(0); 8057var EventDef_1 = __webpack_require__(34); 8058var EventInstance_1 = __webpack_require__(209); 8059var EventDateProfile_1 = __webpack_require__(17); 8060var RecurringEventDef = /** @class */ (function (_super) { 8061 tslib_1.__extends(RecurringEventDef, _super); 8062 function RecurringEventDef() { 8063 return _super !== null && _super.apply(this, arguments) || this; 8064 } 8065 RecurringEventDef.prototype.isAllDay = function () { 8066 return !this.startTime && !this.endTime; 8067 }; 8068 RecurringEventDef.prototype.buildInstances = function (unzonedRange) { 8069 var calendar = this.source.calendar; 8070 var unzonedDate = unzonedRange.getStart(); 8071 var unzonedEnd = unzonedRange.getEnd(); 8072 var zonedDayStart; 8073 var instanceStart; 8074 var instanceEnd; 8075 var instances = []; 8076 while (unzonedDate.isBefore(unzonedEnd)) { 8077 // if everyday, or this particular day-of-week 8078 if (!this.dowHash || this.dowHash[unzonedDate.day()]) { 8079 zonedDayStart = calendar.applyTimezone(unzonedDate); 8080 instanceStart = zonedDayStart.clone(); 8081 instanceEnd = null; 8082 if (this.startTime) { 8083 instanceStart.time(this.startTime); 8084 } 8085 else { 8086 instanceStart.stripTime(); 8087 } 8088 if (this.endTime) { 8089 instanceEnd = zonedDayStart.clone().time(this.endTime); 8090 } 8091 instances.push(new EventInstance_1.default(this, // definition 8092 new EventDateProfile_1.default(instanceStart, instanceEnd, calendar))); 8093 } 8094 unzonedDate.add(1, 'days'); 8095 } 8096 return instances; 8097 }; 8098 RecurringEventDef.prototype.setDow = function (dowNumbers) { 8099 if (!this.dowHash) { 8100 this.dowHash = {}; 8101 } 8102 for (var i = 0; i < dowNumbers.length; i++) { 8103 this.dowHash[dowNumbers[i]] = true; 8104 } 8105 }; 8106 RecurringEventDef.prototype.clone = function () { 8107 var def = _super.prototype.clone.call(this); 8108 if (def.startTime) { 8109 def.startTime = moment.duration(this.startTime); 8110 } 8111 if (def.endTime) { 8112 def.endTime = moment.duration(this.endTime); 8113 } 8114 if (this.dowHash) { 8115 def.dowHash = $.extend({}, this.dowHash); 8116 } 8117 return def; 8118 }; 8119 return RecurringEventDef; 8120}(EventDef_1.default)); 8121exports.default = RecurringEventDef; 8122/* 8123HACK to work with TypeScript mixins 8124NOTE: if super-method fails, should still attempt to apply 8125*/ 8126RecurringEventDef.prototype.applyProps = function (rawProps) { 8127 var superSuccess = EventDef_1.default.prototype.applyProps.call(this, rawProps); 8128 if (rawProps.start) { 8129 this.startTime = moment.duration(rawProps.start); 8130 } 8131 if (rawProps.end) { 8132 this.endTime = moment.duration(rawProps.end); 8133 } 8134 if (rawProps.dow) { 8135 this.setDow(rawProps.dow); 8136 } 8137 return superSuccess; 8138}; 8139// Parsing 8140// --------------------------------------------------------------------------------------------------------------------- 8141RecurringEventDef.defineStandardProps({ 8142 start: false, 8143 end: false, 8144 dow: false 8145}); 8146 8147 8148/***/ }), 8149/* 211 */
8150/***/ (function(module, exports) { 8151 8152Object.defineProperty(exports, "__esModule", { value: true }); 8153var EventRange = /** @class */ (function () { 8154 function EventRange(unzonedRange, eventDef, eventInstance) { 8155 this.unzonedRange = unzonedRange; 8156 this.eventDef = eventDef; 8157 if (eventInstance) { 8158 this.eventInstance = eventInstance; 8159 } 8160 } 8161 return EventRange; 8162}()); 8163exports.default = EventRange; 8164 8165 8166/***/ }), 8167/* 212 */ 8168/***/ (function(module, exports, __webpack_require__) { 8169 8170Object.defineProperty(exports, "__esModule", { value: true }); 8171var $ = __webpack_require__(3); 8172var util_1 = __webpack_require__(35); 8173var EventInstanceGroup_1 = __webpack_require__(18); 8174var RecurringEventDef_1 = __webpack_require__(210); 8175var EventSource_1 = __webpack_require__(6); 8176var BUSINESS_HOUR_EVENT_DEFAULTS = { 8177 start: '09:00', 8178 end: '17:00', 8179 dow: [1, 2, 3, 4, 5], 8180 rendering: 'inverse-background' 8181 // classNames are defined in businessHoursSegClasses 8182}; 8183var BusinessHourGenerator = /** @class */ (function () { 8184 function BusinessHourGenerator(rawComplexDef, calendar) { 8185 this.rawComplexDef = rawComplexDef; 8186 this.calendar = calendar; 8187 } 8188 BusinessHourGenerator.prototype.buildEventInstanceGroup = function (isAllDay, unzonedRange) { 8189 var eventDefs = this.buildEventDefs(isAllDay); 8190 var eventInstanceGroup; 8191 if (eventDefs.length) { 8192 eventInstanceGroup = new EventInstanceGroup_1.default(util_1.eventDefsToEventInstances(eventDefs, unzonedRange)); 8193 // so that inverse-background rendering can happen even when no eventRanges in view 8194 eventInstanceGroup.explicitEventDef = eventDefs[0]; 8195 return eventInstanceGroup; 8196 } 8197 }; 8198 BusinessHourGenerator.prototype.buildEventDefs = function (isAllDay) { 8199 var rawComplexDef = this.rawComplexDef; 8200 var rawDefs = []; 8201 var requireDow = false; 8202 var i; 8203 var defs = []; 8204 if (rawComplexDef === true) { 8205 rawDefs = [{}]; // will get BUSINESS_HOUR_EVENT_DEFAULTS verbatim 8206 } 8207 else if ($.isPlainObject(rawComplexDef)) { 8208 rawDefs = [rawComplexDef]; 8209 } 8210 else if ($.isArray(rawComplexDef)) { 8211 rawDefs = rawComplexDef; 8212 requireDow = true; // every sub-definition NEEDS a day-of-week 8213 } 8214 for (i = 0; i < rawDefs.length; i++) { 8215 if (!requireDow || rawDefs[i].dow) { 8216 defs.push(this.buildEventDef(isAllDay, rawDefs[i])); 8217 } 8218 } 8219 return defs; 8220 }; 8221 BusinessHourGenerator.prototype.buildEventDef = function (isAllDay, rawDef) { 8222 var fullRawDef = $.extend({}, BUSINESS_HOUR_EVENT_DEFAULTS, rawDef); 8223 if (isAllDay) { 8224 fullRawDef.start = null; 8225 fullRawDef.end = null; 8226 } 8227 return RecurringEventDef_1.default.parse(fullRawDef, new EventSource_1.default(this.calendar) // dummy source 8228 ); 8229 }; 8230 return BusinessHourGenerator; 8231}()); 8232exports.default = BusinessHourGenerator; 8233 8234 8235/***/ }), 8236/* 213 */ 8237/***/ (function(module, exports, __webpack_require__) { 8238 8239Object.defineProperty(exports, "__esModule", { value: true }); 8240var tslib_1 = __webpack_require__(2); 8241var Theme_1 = __webpack_require__(19); 8242var StandardTheme = /** @class */ (function (_super) { 8243 tslib_1.__extends(StandardTheme, _super); 8244 function StandardTheme() { 8245 return _super !== null && _super.apply(this, arguments) || this; 8246 } 8247 return StandardTheme; 8248}(Theme_1.default)); 8249exports.default = StandardTheme; 8250StandardTheme.prototype.classes = { 8251 widget: 'fc-unthemed', 8252 widgetHeader: 'fc-widget-header', 8253 widgetContent: 'fc-widget-content', 8254 buttonGroup: 'fc-button-group', 8255 button: 'fc-button', 8256 cornerLeft: 'fc-corner-left', 8257 cornerRight: 'fc-corner-right', 8258 stateDefault: 'fc-state-default', 8259 stateActive: 'fc-state-active', 8260 stateDisabled: 'fc-state-disabled', 8261 stateHover: 'fc-state-hover', 8262 stateDown: 'fc-state-down', 8263 popoverHeader: 'fc-widget-header', 8264 popoverContent: 'fc-widget-content', 8265 // day grid 8266 headerRow: 'fc-widget-header', 8267 dayRow: 'fc-widget-content', 8268 // list view 8269 listView: 'fc-widget-content' 8270}; 8271StandardTheme.prototype.baseIconClass = 'fc-icon'; 8272StandardTheme.prototype.iconClasses = { 8273 close: 'fc-icon-x', 8274 prev: 'fc-icon-left-single-arrow', 8275 next: 'fc-icon-right-single-arrow', 8276 prevYear: 'fc-icon-left-double-arrow', 8277 nextYear: 'fc-icon-right-double-arrow' 8278}; 8279StandardTheme.prototype.iconOverrideOption = 'buttonIcons'; 8280StandardTheme.prototype.iconOverrideCustomButtonOption = 'icon'; 8281StandardTheme.prototype.iconOverridePrefix = 'fc-icon-'; 8282 8283 8284/***/ }), 8285/* 214 */ 8286/***/ (function(module, exports, __webpack_require__) { 8287 8288Object.defineProperty(exports, "__esModule", { value: true });
8289var tslib_1 = __webpack_require__(2); 8290var Theme_1 = __webpack_require__(19); 8291var JqueryUiTheme = /** @class */ (function (_super) { 8292 tslib_1.__extends(JqueryUiTheme, _super); 8293 function JqueryUiTheme() { 8294 return _super !== null && _super.apply(this, arguments) || this; 8295 } 8296 return JqueryUiTheme; 8297}(Theme_1.default)); 8298exports.default = JqueryUiTheme; 8299JqueryUiTheme.prototype.classes = { 8300 widget: 'ui-widget', 8301 widgetHeader: 'ui-widget-header', 8302 widgetContent: 'ui-widget-content', 8303 buttonGroup: 'fc-button-group', 8304 button: 'ui-button', 8305 cornerLeft: 'ui-corner-left', 8306 cornerRight: 'ui-corner-right', 8307 stateDefault: 'ui-state-default', 8308 stateActive: 'ui-state-active', 8309 stateDisabled: 'ui-state-disabled', 8310 stateHover: 'ui-state-hover', 8311 stateDown: 'ui-state-down', 8312 today: 'ui-state-highlight', 8313 popoverHeader: 'ui-widget-header', 8314 popoverContent: 'ui-widget-content', 8315 // day grid 8316 headerRow: 'ui-widget-header', 8317 dayRow: 'ui-widget-content', 8318 // list view 8319 listView: 'ui-widget-content' 8320}; 8321JqueryUiTheme.prototype.baseIconClass = 'ui-icon'; 8322JqueryUiTheme.prototype.iconClasses = { 8323 close: 'ui-icon-closethick', 8324 prev: 'ui-icon-circle-triangle-w', 8325 next: 'ui-icon-circle-triangle-e', 8326 prevYear: 'ui-icon-seek-prev', 8327 nextYear: 'ui-icon-seek-next' 8328}; 8329JqueryUiTheme.prototype.iconOverrideOption = 'themeButtonIcons'; 8330JqueryUiTheme.prototype.iconOverrideCustomButtonOption = 'themeIcon'; 8331JqueryUiTheme.prototype.iconOverridePrefix = 'ui-icon-'; 8332 8333 8334/***/ }), 8335/* 215 */ 8336/***/ (function(module, exports, __webpack_require__) { 8337 8338Object.defineProperty(exports, "__esModule", { value: true }); 8339var tslib_1 = __webpack_require__(2); 8340var $ = __webpack_require__(3); 8341var Promise_1 = __webpack_require__(20); 8342var EventSource_1 = __webpack_require__(6); 8343var FuncEventSource = /** @class */ (function (_super) { 8344 tslib_1.__extends(FuncEventSource, _super); 8345 function FuncEventSource() { 8346 return _super !== null && _super.apply(this, arguments) || this; 8347 } 8348 FuncEventSource.parse = function (rawInput, calendar) { 8349 var rawProps; 8350 // normalize raw input 8351 if ($.isFunction(rawInput.events)) { 8352 rawProps = rawInput; 8353 } 8354 else if ($.isFunction(rawInput)) { 8355 rawProps = { events: rawInput }; 8356 } 8357 if (rawProps) { 8358 return EventSource_1.default.parse.call(this, rawProps, calendar); 8359 } 8360 return false; 8361 }; 8362 FuncEventSource.prototype.fetch = function (start, end, timezone) { 8363 var _this = this; 8364 this.calendar.pushLoading(); 8365 return Promise_1.default.construct(function (onResolve) { 8366 _this.func.call(_this.calendar, start.clone(), end.clone(), timezone, function (rawEventDefs) { 8367 _this.calendar.popLoading(); 8368 onResolve(_this.parseEventDefs(rawEventDefs)); 8369 }); 8370 }); 8371 }; 8372 FuncEventSource.prototype.getPrimitive = function () { 8373 return this.func; 8374 }; 8375 FuncEventSource.prototype.applyManualStandardProps = function (rawProps) { 8376 var superSuccess = _super.prototype.applyManualStandardProps.call(this, rawProps); 8377 this.func = rawProps.events; 8378 return superSuccess; 8379 }; 8380 return FuncEventSource; 8381}(EventSource_1.default)); 8382exports.default = FuncEventSource; 8383FuncEventSource.defineStandardProps({ 8384 events: false // don't automatically transfer 8385}); 8386 8387 8388/***/ }), 8389/* 216 */ 8390/***/ (function(module, exports, __webpack_require__) { 8391 8392Object.defineProperty(exports, "__esModule", { value: true }); 8393var tslib_1 = __webpack_require__(2); 8394var $ = __webpack_require__(3); 8395var util_1 = __webpack_require__(4); 8396var Promise_1 = __webpack_require__(20); 8397var EventSource_1 = __webpack_require__(6); 8398var JsonFeedEventSource = /** @class */ (function (_super) { 8399 tslib_1.__extends(JsonFeedEventSource, _super); 8400 function JsonFeedEventSource() { 8401 return _super !== null && _super.apply(this, arguments) || this; 8402 } 8403 JsonFeedEventSource.parse = function (rawInput, calendar) { 8404 var rawProps; 8405 // normalize raw input 8406 if (typeof rawInput.url === 'string') { 8407 rawProps = rawInput; 8408 } 8409 else if (typeof rawInput === 'string') { 8410 rawProps = { url: rawInput }; 8411 } 8412 if (rawProps) { 8413 return EventSource_1.default.parse.call(this, rawProps, calendar); 8414 } 8415 return false; 8416 }; 8417 JsonFeedEventSource.prototype.fetch = function (start, end, timezone) { 8418 var _this = this; 8419 var ajaxSettings = this.ajaxSettings; 8420 var onSuccess = ajaxSettings.success; 8421 var onError = ajaxSettings.error;
8422 var requestParams = this.buildRequestParams(start, end, timezone); 8423 // todo: eventually handle the promise's then, 8424 // don't intercept success/error 8425 // tho will be a breaking API change 8426 this.calendar.pushLoading(); 8427 return Promise_1.default.construct(function (onResolve, onReject) { 8428 $.ajax($.extend({}, // destination 8429 JsonFeedEventSource.AJAX_DEFAULTS, ajaxSettings, { 8430 url: _this.url, 8431 data: requestParams, 8432 success: function (rawEventDefs, status, xhr) { 8433 var callbackRes; 8434 _this.calendar.popLoading(); 8435 if (rawEventDefs) { 8436 callbackRes = util_1.applyAll(onSuccess, _this, [rawEventDefs, status, xhr]); // redirect `this` 8437 if ($.isArray(callbackRes)) { 8438 rawEventDefs = callbackRes; 8439 } 8440 onResolve(_this.parseEventDefs(rawEventDefs)); 8441 } 8442 else { 8443 onReject(); 8444 } 8445 }, 8446 error: function (xhr, statusText, errorThrown) { 8447 _this.calendar.popLoading(); 8448 util_1.applyAll(onError, _this, [xhr, statusText, errorThrown]); // redirect `this` 8449 onReject(); 8450 } 8451 })); 8452 }); 8453 }; 8454 JsonFeedEventSource.prototype.buildRequestParams = function (start, end, timezone) { 8455 var calendar = this.calendar; 8456 var ajaxSettings = this.ajaxSettings; 8457 var startParam; 8458 var endParam; 8459 var timezoneParam;
8460 var customRequestParams; 8461 var params = {}; 8462 startParam = this.startParam; 8463 if (startParam == null) { 8464 startParam = calendar.opt('startParam'); 8465 } 8466 endParam = this.endParam; 8467 if (endParam == null) { 8468 endParam = calendar.opt('endParam'); 8469 } 8470 timezoneParam = this.timezoneParam; 8471 if (timezoneParam == null) { 8472 timezoneParam = calendar.opt('timezoneParam'); 8473 } 8474 // retrieve any outbound GET/POST $.ajax data from the options 8475 if ($.isFunction(ajaxSettings.data)) { 8476 // supplied as a function that returns a key/value object 8477 customRequestParams = ajaxSettings.data(); 8478 } 8479 else { 8480 // probably supplied as a straight key/value object 8481 customRequestParams = ajaxSettings.data || {}; 8482 } 8483 $.extend(params, customRequestParams); 8484 params[startParam] = start.format(); 8485 params[endParam] = end.format(); 8486 if (timezone && timezone !== 'local') { 8487 params[timezoneParam] = timezone; 8488 } 8489 return params; 8490 }; 8491 JsonFeedEventSource.prototype.getPrimitive = function () { 8492 return this.url; 8493 }; 8494 JsonFeedEventSource.prototype.applyMiscProps = function (rawProps) { 8495 this.ajaxSettings = rawProps; 8496 }; 8497 JsonFeedEventSource.AJAX_DEFAULTS = { 8498 dataType: 'json', 8499 cache: false 8500 }; 8501 return JsonFeedEventSource; 8502}(EventSource_1.default)); 8503exports.default = JsonFeedEventSource; 8504JsonFeedEventSource.defineStandardProps({ 8505 // automatically transfer (true)... 8506 url: true, 8507 startParam: true, 8508 endParam: true, 8509 timezoneParam: true 8510}); 8511 8512 8513/***/ }), 8514/* 217 */ 8515/***/ (function(module, exports, __webpack_require__) { 8516 8517Object.defineProperty(exports, "__esModule", { value: true }); 8518var EmitterMixin_1 = __webpack_require__(11); 8519var TaskQueue = /** @class */ (function () { 8520 function TaskQueue() { 8521 this.q = []; 8522 this.isPaused = false; 8523 this.isRunning = false; 8524 } 8525 TaskQueue.prototype.queue = function () { 8526 var args = []; 8527 for (var _i = 0; _i < arguments.length; _i++) { 8528 args[_i] = arguments[_i]; 8529 } 8530 this.q.push.apply(this.q, args); // append 8531 this.tryStart(); 8532 }; 8533 TaskQueue.prototype.pause = function () { 8534 this.isPaused = true; 8535 }; 8536 TaskQueue.prototype.resume = function () { 8537 this.isPaused = false; 8538 this.tryStart(); 8539 }; 8540 TaskQueue.prototype.getIsIdle = function () { 8541 return !this.isRunning && !this.isPaused; 8542 }; 8543 TaskQueue.prototype.tryStart = function () { 8544 if (!this.isRunning && this.canRunNext()) { 8545 this.isRunning = true; 8546 this.trigger('start'); 8547 this.runRemaining(); 8548 } 8549 }; 8550 TaskQueue.prototype.canRunNext = function () { 8551 return !this.isPaused && this.q.length; 8552 }; 8553 TaskQueue.prototype.runRemaining = function () { 8554 var _this = this; 8555 var task; 8556 var res; 8557 do { 8558 task = this.q.shift(); // always freshly reference q. might have been reassigned. 8559 res = this.runTask(task); 8560 if (res && res.then) { 8561 res.then(function () { 8562 if (_this.canRunNext()) { 8563 _this.runRemaining(); 8564 } 8565 }); 8566 return; // prevent marking as stopped 8567 } 8568 } while (this.canRunNext()); 8569 this.trigger('stop'); // not really a 'stop' ... more of a 'drained' 8570 this.isRunning = false; 8571 // if 'stop' handler added more tasks.... TODO: write test for this 8572 this.tryStart(); 8573 }; 8574 TaskQueue.prototype.runTask = function (task) { 8575 return task(); // task *is* the function, but subclasses can change the format of a task 8576 }; 8577 return TaskQueue; 8578}()); 8579exports.default = TaskQueue; 8580EmitterMixin_1.default.mixInto(TaskQueue); 8581 8582 8583/***/ }), 8584/* 218 */ 8585/***/ (function(module, exports, __webpack_require__) { 8586 8587Object.defineProperty(exports, "__esModule", { value: true });
8588var tslib_1 = __webpack_require__(2); 8589var TaskQueue_1 = __webpack_require__(217); 8590var RenderQueue = /** @class */ (function (_super) { 8591 tslib_1.__extends(RenderQueue, _super); 8592 function RenderQueue(waitsByNamespace) { 8593 var _this = _super.call(this) || this; 8594 _this.waitsByNamespace = waitsByNamespace || {}; 8595 return _this; 8596 } 8597 RenderQueue.prototype.queue = function (taskFunc, namespace, type) { 8598 var task = { 8599 func: taskFunc, 8600 namespace: namespace, 8601 type: type 8602 }; 8603 var waitMs; 8604 if (namespace) { 8605 waitMs = this.waitsByNamespace[namespace]; 8606 } 8607 if (this.waitNamespace) { 8608 if (namespace === this.waitNamespace && waitMs != null) { 8609 this.delayWait(waitMs); 8610 } 8611 else { 8612 this.clearWait(); 8613 this.tryStart(); 8614 } 8615 } 8616 if (this.compoundTask(task)) { 8617 if (!this.waitNamespace && waitMs != null) { 8618 this.startWait(namespace, waitMs); 8619 } 8620 else { 8621 this.tryStart(); 8622 } 8623 } 8624 }; 8625 RenderQueue.prototype.startWait = function (namespace, waitMs) { 8626 this.waitNamespace = namespace; 8627 this.spawnWait(waitMs); 8628 }; 8629 RenderQueue.prototype.delayWait = function (waitMs) { 8630 clearTimeout(this.waitId); 8631 this.spawnWait(waitMs); 8632 }; 8633 RenderQueue.prototype.spawnWait = function (waitMs) { 8634 var _this = this; 8635 this.waitId = setTimeout(function () { 8636 _this.waitNamespace = null; 8637 _this.tryStart(); 8638 }, waitMs); 8639 }; 8640 RenderQueue.prototype.clearWait = function () { 8641 if (this.waitNamespace) { 8642 clearTimeout(this.waitId); 8643 this.waitId = null; 8644 this.waitNamespace = null; 8645 } 8646 }; 8647 RenderQueue.prototype.canRunNext = function () { 8648 if (!_super.prototype.canRunNext.call(this)) { 8649 return false; 8650 } 8651 // waiting for a certain namespace to stop receiving tasks? 8652 if (this.waitNamespace) { 8653 var q = this.q; 8654 // if there was a different namespace task in the meantime, 8655 // that forces all previously-waiting tasks to suddenly execute.
8656 // TODO: find a way to do this in constant time. 8657 for (var i = 0; i < q.length; i++) { 8658 if (q[i].namespace !== this.waitNamespace) { 8659 return true; // allow execution 8660 } 8661 } 8662 return false; 8663 } 8664 return true; 8665 }; 8666 RenderQueue.prototype.runTask = function (task) { 8667 task.func(); 8668 }; 8669 RenderQueue.prototype.compoundTask = function (newTask) { 8670 var q = this.q; 8671 var shouldAppend = true; 8672 var i; 8673 var task; 8674 if (newTask.namespace && newTask.type === 'destroy') { 8675 // remove all init/add/remove ops with same namespace, regardless of order 8676 for (i = q.length - 1; i >= 0; i--) { 8677 task = q[i]; 8678 switch (task.type) { 8679 case 'init': 8680 shouldAppend = false; 8681 // the latest destroy is cancelled out by not doing the init 8682 /* falls through */ 8683 case 'add': 8684 /* falls through */ 8685 case 'remove': 8686 q.splice(i, 1); // remove task 8687 } 8688 } 8689 } 8690 if (shouldAppend) { 8691 q.push(newTask); 8692 } 8693 return shouldAppend; 8694 }; 8695 return RenderQueue; 8696}(TaskQueue_1.default)); 8697exports.default = RenderQueue; 8698 8699 8700/***/ }), 8701/* 219 */ 8702/***/ (function(module, exports, __webpack_require__) { 8703 8704Object.defineProperty(exports, "__esModule", { value: true }); 8705var tslib_1 = __webpack_require__(2); 8706var $ = __webpack_require__(3); 8707var moment = __webpack_require__(0); 8708var util_1 = __webpack_require__(4); 8709var moment_ext_1 = __webpack_require__(10); 8710var date_formatting_1 = __webpack_require__(47); 8711var Component_1 = __webpack_require__(237); 8712var util_2 = __webpack_require__(35); 8713var DateComponent = /** @class */ (function (_super) { 8714 tslib_1.__extends(DateComponent, _super); 8715 function DateComponent(_view, _options) { 8716 var _this = _super.call(this) || this; 8717 _this.isRTL = false; // frequently accessed options 8718 _this.hitsNeededDepth = 0; // necessary because multiple callers might need the same hits 8719 _this.hasAllDayBusinessHours = false; // TODO: unify with largeUnit and isTimeScale? 8720 _this.isDatesRendered = false; 8721 // hack to set options prior to the this.opt calls 8722 if (_view) { 8723 _this['view'] = _view; 8724 } 8725 if (_options) { 8726 _this['options'] = _options; 8727 } 8728 _this.uid = String(DateComponent.guid++); 8729 _this.childrenByUid = {}; 8730 _this.nextDayThreshold = moment.duration(_this.opt('nextDayThreshold')); 8731 _this.isRTL = _this.opt('isRTL'); 8732 if (_this.fillRendererClass) { 8733 _this.fillRenderer = new _this.fillRendererClass(_this); 8734 } 8735 if (_this.eventRendererClass) { 8736 _this.eventRenderer = new _this.eventRendererClass(_this, _this.fillRenderer); 8737 } 8738 if (_this.helperRendererClass && _this.eventRenderer) { 8739 _this.helperRenderer = new _this.helperRendererClass(_this, _this.eventRenderer); 8740 } 8741 if (_this.businessHourRendererClass && _this.fillRenderer) { 8742 _this.businessHourRenderer = new _this.businessHourRendererClass(_this, _this.fillRenderer); 8743 } 8744 return _this; 8745 } 8746 DateComponent.prototype.addChild = function (child) { 8747 if (!this.childrenByUid[child.uid]) { 8748 this.childrenByUid[child.uid] = child; 8749 return true; 8750 } 8751 return false; 8752 }; 8753 DateComponent.prototype.removeChild = function (child) { 8754 if (this.childrenByUid[child.uid]) { 8755 delete this.childrenByUid[child.uid]; 8756 return true; 8757 } 8758 return false; 8759 }; 8760 // TODO: only do if isInDom? 8761 // TODO: make part of Component, along with children/batch-render system? 8762 DateComponent.prototype.updateSize = function (totalHeight, isAuto, isResize) { 8763 this.callChildren('updateSize', arguments); 8764 }; 8765 // Options 8766 // ----------------------------------------------------------------------------------------------------------------- 8767 DateComponent.prototype.opt = function (name) { 8768 return this._getView().opt(name); // default implementation 8769 }; 8770 DateComponent.prototype.publiclyTrigger = function () { 8771 var args = []; 8772 for (var _i = 0; _i < arguments.length; _i++) { 8773 args[_i] = arguments[_i]; 8774 }
8775 var calendar = this._getCalendar(); 8776 return calendar.publiclyTrigger.apply(calendar, args); 8777 }; 8778 DateComponent.prototype.hasPublicHandlers = function () { 8779 var args = []; 8780 for (var _i = 0; _i < arguments.length; _i++) { 8781 args[_i] = arguments[_i]; 8782 } 8783 var calendar = this._getCalendar(); 8784 return calendar.hasPublicHandlers.apply(calendar, args); 8785 }; 8786 // Date 8787 // ----------------------------------------------------------------------------------------------------------------- 8788 DateComponent.prototype.executeDateRender = function (dateProfile) { 8789 this.dateProfile = dateProfile; // for rendering 8790 this.renderDates(dateProfile); 8791 this.isDatesRendered = true; 8792 this.callChildren('executeDateRender', arguments); 8793 }; 8794 DateComponent.prototype.executeDateUnrender = function () { 8795 this.callChildren('executeDateUnrender', arguments); 8796 this.dateProfile = null; 8797 this.unrenderDates(); 8798 this.isDatesRendered = false; 8799 }; 8800 // date-cell content only 8801 DateComponent.prototype.renderDates = function (dateProfile) { 8802 // subclasses should implement 8803 }; 8804 // date-cell content only 8805 DateComponent.prototype.unrenderDates = function () { 8806 // subclasses should override 8807 }; 8808 // Now-Indicator 8809 // ----------------------------------------------------------------------------------------------------------------- 8810 // Returns a string unit, like 'second' or 'minute' that defined how often the current time indicator 8811 // should be refreshed. If something falsy is returned, no time indicator is rendered at all. 8812 DateComponent.prototype.getNowIndicatorUnit = function () { 8813 // subclasses should implement 8814 }; 8815 // Renders a current time indicator at the given datetime 8816 DateComponent.prototype.renderNowIndicator = function (date) { 8817 this.callChildren('renderNowIndicator', arguments); 8818 }; 8819 // Undoes the rendering actions from renderNowIndicator 8820 DateComponent.prototype.unrenderNowIndicator = function () { 8821 this.callChildren('unrenderNowIndicator', arguments); 8822 }; 8823 // Business Hours 8824 // --------------------------------------------------------------------------------------------------------------- 8825 DateComponent.prototype.renderBusinessHours = function (businessHourGenerator) { 8826 if (this.businessHourRenderer) { 8827 this.businessHourRenderer.render(businessHourGenerator); 8828 } 8829 this.callChildren('renderBusinessHours', arguments); 8830 }; 8831 // Unrenders previously-rendered business-hours 8832 DateComponent.prototype.unrenderBusinessHours = function () { 8833 this.callChildren('unrenderBusinessHours', arguments); 8834 if (this.businessHourRenderer) { 8835 this.businessHourRenderer.unrender(); 8836 } 8837 }; 8838 // Event Displaying 8839 // ----------------------------------------------------------------------------------------------------------------- 8840 DateComponent.prototype.executeEventRender = function (eventsPayload) { 8841 if (this.eventRenderer) { 8842 this.eventRenderer.rangeUpdated(); // poorly named now 8843 this.eventRenderer.render(eventsPayload); 8844 } 8845 else if (this['renderEvents']) { 8846 this['renderEvents'](convertEventsPayloadToLegacyArray(eventsPayload)); 8847 } 8848 this.callChildren('executeEventRender', arguments); 8849 }; 8850 DateComponent.prototype.executeEventUnrender = function () { 8851 this.callChildren('executeEventUnrender', arguments); 8852 if (this.eventRenderer) { 8853 this.eventRenderer.unrender(); 8854 } 8855 else if (this['destroyEvents']) { 8856 this['destroyEvents'](); 8857 } 8858 }; 8859 DateComponent.prototype.getBusinessHourSegs = function () { 8860 var segs = this.getOwnBusinessHourSegs(); 8861 this.iterChildren(function (child) { 8862 segs.push.apply(segs, child.getBusinessHourSegs()); 8863 }); 8864 return segs; 8865 }; 8866 DateComponent.prototype.getOwnBusinessHourSegs = function () { 8867 if (this.businessHourRenderer) { 8868 return this.businessHourRenderer.getSegs(); 8869 } 8870 return []; 8871 }; 8872 DateComponent.prototype.getEventSegs = function () { 8873 var segs = this.getOwnEventSegs(); 8874 this.iterChildren(function (child) { 8875 segs.push.apply(segs, child.getEventSegs()); 8876 }); 8877 return segs; 8878 }; 8879 DateComponent.prototype.getOwnEventSegs = function () { 8880 if (this.eventRenderer) { 8881 return this.eventRenderer.getSegs(); 8882 } 8883 return []; 8884 }; 8885 // Event Rendering Triggering 8886 // ----------------------------------------------------------------------------------------------------------------- 8887 DateComponent.prototype.triggerAfterEventsRendered = function () { 8888 this.triggerAfterEventSegsRendered(this.getEventSegs()); 8889 this.publiclyTrigger('eventAfterAllRender', { 8890 context: this, 8891 args: [this] 8892 }); 8893 }; 8894 DateComponent.prototype.triggerAfterEventSegsRendered = function (segs) { 8895 var _this = this; 8896 // an optimization, because getEventLegacy is expensive 8897 if (this.hasPublicHandlers('eventAfterRender')) {
8898 segs.forEach(function (seg) { 8899 var legacy; 8900 if (seg.el) { 8901 legacy = seg.footprint.getEventLegacy(); 8902 _this.publiclyTrigger('eventAfterRender', { 8903 context: legacy, 8904 args: [legacy, seg.el, _this] 8905 }); 8906 } 8907 }); 8908 } 8909 }; 8910 DateComponent.prototype.triggerBeforeEventsDestroyed = function () { 8911 this.triggerBeforeEventSegsDestroyed(this.getEventSegs()); 8912 }; 8913 DateComponent.prototype.triggerBeforeEventSegsDestroyed = function (segs) { 8914 var _this = this; 8915 if (this.hasPublicHandlers('eventDestroy')) { 8916 segs.forEach(function (seg) { 8917 var legacy; 8918 if (seg.el) { 8919 legacy = seg.footprint.getEventLegacy(); 8920 _this.publiclyTrigger('eventDestroy', { 8921 context: legacy, 8922 args: [legacy, seg.el, _this] 8923 }); 8924 } 8925 }); 8926 } 8927 }; 8928 // Event Rendering Utils 8929 // ----------------------------------------------------------------------------------------------------------------- 8930 // Hides all rendered event segments linked to the given event 8931 // RECURSIVE with subcomponents 8932 DateComponent.prototype.showEventsWithId = function (eventDefId) { 8933 this.getEventSegs().forEach(function (seg) { 8934 if (seg.footprint.eventDef.id === eventDefId && 8935 seg.el // necessary? 8936 ) { 8937 seg.el.css('visibility', ''); 8938 } 8939 }); 8940 this.callChildren('showEventsWithId', arguments); 8941 }; 8942 // Shows all rendered event segments linked to the given event 8943 // RECURSIVE with subcomponents 8944 DateComponent.prototype.hideEventsWithId = function (eventDefId) { 8945 this.getEventSegs().forEach(function (seg) { 8946 if (seg.footprint.eventDef.id === eventDefId && 8947 seg.el // necessary? 8948 ) { 8949 seg.el.css('visibility', 'hidden'); 8950 } 8951 }); 8952 this.callChildren('hideEventsWithId', arguments); 8953 }; 8954 // Drag-n-Drop Rendering (for both events and external elements) 8955 // --------------------------------------------------------------------------------------------------------------- 8956 // Renders a visual indication of a event or external-element drag over the given drop zone. 8957 // If an external-element, seg will be `null`. 8958 // Must return elements used for any mock events. 8959 DateComponent.prototype.renderDrag = function (eventFootprints, seg, isTouch) { 8960 var renderedHelper = false; 8961 this.iterChildren(function (child) { 8962 if (child.renderDrag(eventFootprints, seg, isTouch)) { 8963 renderedHelper = true; 8964 } 8965 }); 8966 return renderedHelper; 8967 }; 8968 // Unrenders a visual indication of an event or external-element being dragged. 8969 DateComponent.prototype.unrenderDrag = function () { 8970 this.callChildren('unrenderDrag', arguments); 8971 }; 8972 // Event Resizing 8973 // --------------------------------------------------------------------------------------------------------------- 8974 // Renders a visual indication of an event being resized. 8975 DateComponent.prototype.renderEventResize = function (eventFootprints, seg, isTouch) { 8976 this.callChildren('renderEventResize', arguments); 8977 }; 8978 // Unrenders a visual indication of an event being resized. 8979 DateComponent.prototype.unrenderEventResize = function () { 8980 this.callChildren('unrenderEventResize', arguments); 8981 }; 8982 // Selection 8983 // --------------------------------------------------------------------------------------------------------------- 8984 // Renders a visual indication of the selection 8985 // TODO: rename to `renderSelection` after legacy is gone 8986 DateComponent.prototype.renderSelectionFootprint = function (componentFootprint) { 8987 this.renderHighlight(componentFootprint); 8988 this.callChildren('renderSelectionFootprint', arguments); 8989 }; 8990 // Unrenders a visual indication of selection 8991 DateComponent.prototype.unrenderSelection = function () { 8992 this.unrenderHighlight(); 8993 this.callChildren('unrenderSelection', arguments); 8994 }; 8995 // Highlight 8996 // --------------------------------------------------------------------------------------------------------------- 8997 // Renders an emphasis on the given date range. Given a span (unzoned start/end and other misc data) 8998 DateComponent.prototype.renderHighlight = function (componentFootprint) { 8999 if (this.fillRenderer) { 9000 this.fillRenderer.renderFootprint('highlight', componentFootprint, { 9001 getClasses: function () { 9002 return ['fc-highlight']; 9003 } 9004 }); 9005 } 9006 this.callChildren('renderHighlight', arguments); 9007 }; 9008 // Unrenders the emphasis on a date range 9009 DateComponent.prototype.unrenderHighlight = function () { 9010 if (this.fillRenderer) { 9011 this.fillRenderer.unrender('highlight'); 9012 } 9013 this.callChildren('unrenderHighlight', arguments); 9014 }; 9015 // Hit Areas 9016 // --------------------------------------------------------------------------------------------------------------- 9017 // just because all DateComponents support this interface
9018 // doesn't mean they need to have their own internal coord system. they can defer to sub-components. 9019 DateComponent.prototype.hitsNeeded = function () { 9020 if (!(this.hitsNeededDepth++)) { 9021 this.prepareHits(); 9022 } 9023 this.callChildren('hitsNeeded', arguments); 9024 }; 9025 DateComponent.prototype.hitsNotNeeded = function () { 9026 if (this.hitsNeededDepth && !(--this.hitsNeededDepth)) { 9027 this.releaseHits(); 9028 } 9029 this.callChildren('hitsNotNeeded', arguments); 9030 }; 9031 DateComponent.prototype.prepareHits = function () { 9032 // subclasses can implement 9033 }; 9034 DateComponent.prototype.releaseHits = function () { 9035 // subclasses can implement 9036 }; 9037 // Given coordinates from the topleft of the document, return data about the date-related area underneath. 9038 // Can return an object with arbitrary properties (although top/right/left/bottom are encouraged). 9039 // Must have a `grid` property, a reference to this current grid. TODO: avoid this 9040 // The returned object will be processed by getHitFootprint and getHitEl. 9041 DateComponent.prototype.queryHit = function (leftOffset, topOffset) { 9042 var childrenByUid = this.childrenByUid; 9043 var uid; 9044 var hit; 9045 for (uid in childrenByUid) { 9046 hit = childrenByUid[uid].queryHit(leftOffset, topOffset); 9047 if (hit) { 9048 break; 9049 } 9050 } 9051 return hit; 9052 }; 9053 DateComponent.prototype.getSafeHitFootprint = function (hit) { 9054 var footprint = this.getHitFootprint(hit); 9055 if (!this.dateProfile.activeUnzonedRange.containsRange(footprint.unzonedRange)) { 9056 return null; 9057 } 9058 return footprint; 9059 }; 9060 DateComponent.prototype.getHitFootprint = function (hit) { 9061 // what about being abstract!? 9062 }; 9063 // Given position-level information about a date-related area within the grid, 9064 // should return a jQuery element that best represents it. passed to dayClick callback. 9065 DateComponent.prototype.getHitEl = function (hit) { 9066 // what about being abstract!? 9067 }; 9068 /* Converting eventRange -> eventFootprint 9069 ------------------------------------------------------------------------------------------------------------------*/ 9070 DateComponent.prototype.eventRangesToEventFootprints = function (eventRanges) { 9071 var eventFootprints = []; 9072 var i; 9073 for (i = 0; i < eventRanges.length; i++) { 9074 eventFootprints.push.apply(// append 9075 eventFootprints, this.eventRangeToEventFootprints(eventRanges[i])); 9076 } 9077 return eventFootprints; 9078 }; 9079 DateComponent.prototype.eventRangeToEventFootprints = function (eventRange) { 9080 return [util_2.eventRangeToEventFootprint(eventRange)]; 9081 }; 9082 /* Converting componentFootprint/eventFootprint -> segs 9083 ------------------------------------------------------------------------------------------------------------------*/ 9084 DateComponent.prototype.eventFootprintsToSegs = function (eventFootprints) { 9085 var segs = []; 9086 var i; 9087 for (i = 0; i < eventFootprints.length; i++) { 9088 segs.push.apply(segs, this.eventFootprintToSegs(eventFootprints[i])); 9089 } 9090 return segs; 9091 }; 9092 // Given an event's span (unzoned start/end and other misc data), and the event itself, 9093 // slices into segments and attaches event-derived properties to them. 9094 // eventSpan - { start, end, isStart, isEnd, otherthings... } 9095 DateComponent.prototype.eventFootprintToSegs = function (eventFootprint) { 9096 var unzonedRange = eventFootprint.componentFootprint.unzonedRange; 9097 var segs; 9098 var i; 9099 var seg; 9100 segs = this.componentFootprintToSegs(eventFootprint.componentFootprint); 9101 for (i = 0; i < segs.length; i++) { 9102 seg = segs[i]; 9103 if (!unzonedRange.isStart) { 9104 seg.isStart = false; 9105 } 9106 if (!unzonedRange.isEnd) { 9107 seg.isEnd = false; 9108 } 9109 seg.footprint = eventFootprint; 9110 // TODO: rename to seg.eventFootprint 9111 } 9112 return segs; 9113 }; 9114 DateComponent.prototype.componentFootprintToSegs = function (componentFootprint) { 9115 return []; 9116 }; 9117 // Utils 9118 // --------------------------------------------------------------------------------------------------------------- 9119 DateComponent.prototype.callChildren = function (methodName, args) { 9120 this.iterChildren(function (child) { 9121 child[methodName].apply(child, args); 9122 }); 9123 }; 9124 DateComponent.prototype.iterChildren = function (func) { 9125 var childrenByUid = this.childrenByUid; 9126 var uid; 9127 for (uid in childrenByUid) { 9128 func(childrenByUid[uid]); 9129 } 9130 }; 9131 DateComponent.prototype._getCalendar = function () { 9132 var t = this; 9133 return t.calendar || t.view.calendar; 9134 }; 9135 DateComponent.prototype._getView = function () { 9136 return this.view; 9137 }; 9138 DateComponent.prototype._getDateProfile = function () { 9139 return this._getView().get('dateProfile'); 9140 }; 9141 // Generates HTML for an anchor to another view into the calendar. 9142 // Will either generate an <a> tag or a non-clickable <span> tag, depending on enabled settings. 9143 // `gotoOptions` can either be a moment input, or an object with the form: 9144 // { date, type, forceOff } 9145 // `type` is a view-type like "day" or "week". default value is "day". 9146 // `attrs` and `innerHtml` are use to generate the rest of the HTML tag. 9147 DateComponent.prototype.buildGotoAnchorHtml = function (gotoOptions, attrs, innerHtml) { 9148 var date; 9149 var type; 9150 var forceOff; 9151 var finalOptions; 9152 if ($.isPlainObject(gotoOptions)) { 9153 date = gotoOptions.date; 9154 type = gotoOptions.type; 9155 forceOff = gotoOptions.forceOff; 9156 } 9157 else { 9158 date = gotoOptions; // a single moment input 9159 } 9160 date = moment_ext_1.default(date); // if a string, parse it 9161 finalOptions = { 9162 date: date.format('YYYY-MM-DD'), 9163 type: type || 'day' 9164 }; 9165 if (typeof attrs === 'string') { 9166 innerHtml = attrs; 9167 attrs = null; 9168 } 9169 attrs = attrs ? ' ' + util_1.attrsToStr(attrs) : ''; // will have a leading space 9170 innerHtml = innerHtml || ''; 9171 if (!forceOff && this.opt('navLinks')) { 9172 return '<a' + attrs + 9173 ' data-goto="' + util_1.htmlEscape(JSON.stringify(finalOptions)) + '">' + 9174 innerHtml + 9175 '</a>'; 9176 } 9177 else { 9178 return '<span' + attrs + '>' + 9179 innerHtml + 9180 '</span>'; 9181 } 9182 }; 9183 DateComponent.prototype.getAllDayHtml = function () { 9184 return this.opt('allDayHtml') || util_1.htmlEscape(this.opt('allDayText'));
9185 }; 9186 // Computes HTML classNames for a single-day element 9187 DateComponent.prototype.getDayClasses = function (date, noThemeHighlight) { 9188 var view = this._getView(); 9189 var classes = []; 9190 var today; 9191 if (!this.dateProfile.activeUnzonedRange.containsDate(date)) { 9192 classes.push('fc-disabled-day'); // TODO: jQuery UI theme? 9193 } 9194 else { 9195 classes.push('fc-' + util_1.dayIDs[date.day()]); 9196 if (view.isDateInOtherMonth(date, this.dateProfile)) { 9197 classes.push('fc-other-month'); 9198 } 9199 today = view.calendar.getNow(); 9200 if (date.isSame(today, 'day')) { 9201 classes.push('fc-today'); 9202 if (noThemeHighlight !== true) { 9203 classes.push(view.calendar.theme.getClass('today')); 9204 } 9205 } 9206 else if (date < today) { 9207 classes.push('fc-past'); 9208 } 9209 else { 9210 classes.push('fc-future'); 9211 } 9212 } 9213 return classes; 9214 }; 9215 // Utility for formatting a range. Accepts a range object, formatting string, and optional separator. 9216 // Displays all-day ranges naturally, with an inclusive end. Takes the current isRTL into account. 9217 // The timezones of the dates within `range` will be respected. 9218 DateComponent.prototype.formatRange = function (range, isAllDay, formatStr, separator) { 9219 var end = range.end; 9220 if (isAllDay) { 9221 end = end.clone().subtract(1); // convert to inclusive. last ms of previous day 9222 } 9223 return date_formatting_1.formatRange(range.start, end, formatStr, separator, this.isRTL); 9224 }; 9225 // Compute the number of the give units in the "current" range. 9226 // Will return a floating-point number. Won't round. 9227 DateComponent.prototype.currentRangeAs = function (unit) { 9228 return this._getDateProfile().currentUnzonedRange.as(unit); 9229 }; 9230 // Returns the date range of the full days the given range visually appears to occupy. 9231 // Returns a plain object with start/end, NOT an UnzonedRange! 9232 DateComponent.prototype.computeDayRange = function (unzonedRange) { 9233 var calendar = this._getCalendar(); 9234 var startDay = calendar.msToUtcMoment(unzonedRange.startMs, true); // the beginning of the day the range starts 9235 var end = calendar.msToUtcMoment(unzonedRange.endMs); 9236 var endTimeMS = +end.time(); // # of milliseconds into `endDay` 9237 var endDay = end.clone().stripTime(); // the beginning of the day the range exclusively ends 9238 // If the end time is actually inclusively part of the next day and is equal to or 9239 // beyond the next day threshold, adjust the end to be the exclusive end of `endDay`. 9240 // Otherwise, leaving it as inclusive will cause it to exclude `endDay`. 9241 if (endTimeMS && endTimeMS >= this.nextDayThreshold) { 9242 endDay.add(1, 'days'); 9243 } 9244 // If end is within `startDay` but not past nextDayThreshold, assign the default duration of one day. 9245 if (endDay <= startDay) { 9246 endDay = startDay.clone().add(1, 'days'); 9247 } 9248 return { start: startDay, end: endDay }; 9249 }; 9250 // Does the given range visually appear to occupy more than one day? 9251 DateComponent.prototype.isMultiDayRange = function (unzonedRange) { 9252 var dayRange = this.computeDayRange(unzonedRange); 9253 return dayRange.end.diff(dayRange.start, 'days') > 1; 9254 }; 9255 DateComponent.guid = 0; // TODO: better system for this? 9256 return DateComponent; 9257}(Component_1.default)); 9258exports.default = DateComponent; 9259// legacy 9260function convertEventsPayloadToLegacyArray(eventsPayload) { 9261 var eventDefId; 9262 var eventInstances; 9263 var legacyEvents = []; 9264 var i; 9265 for (eventDefId in eventsPayload) { 9266 eventInstances = eventsPayload[eventDefId].eventInstances; 9267 for (i = 0; i < eventInstances.length; i++) { 9268 legacyEvents.push(eventInstances[i].toLegacy()); 9269 } 9270 } 9271 return legacyEvents; 9272} 9273 9274 9275/***/ }), 9276/* 220 */ 9277/***/ (function(module, exports, __webpack_require__) { 9278 9279Object.defineProperty(exports, "__esModule", { value: true });
9280var $ = __webpack_require__(3); 9281var moment = __webpack_require__(0); 9282var util_1 = __webpack_require__(4); 9283var options_1 = __webpack_require__(32); 9284var Iterator_1 = __webpack_require__(238); 9285var GlobalEmitter_1 = __webpack_require__(21); 9286var EmitterMixin_1 = __webpack_require__(11); 9287var ListenerMixin_1 = __webpack_require__(7); 9288var Toolbar_1 = __webpack_require__(239); 9289var OptionsManager_1 = __webpack_require__(240); 9290var ViewSpecManager_1 = __webpack_require__(241); 9291var Constraints_1 = __webpack_require__(207); 9292var locale_1 = __webpack_require__(31); 9293var moment_ext_1 = __webpack_require__(10); 9294var UnzonedRange_1 = __webpack_require__(5); 9295var ComponentFootprint_1 = __webpack_require__(12); 9296var EventDateProfile_1 = __webpack_require__(17); 9297var EventManager_1 = __webpack_require__(242); 9298var BusinessHourGenerator_1 = __webpack_require__(212); 9299var EventSourceParser_1 = __webpack_require__(38); 9300var EventDefParser_1 = __webpack_require__(49); 9301var SingleEventDef_1 = __webpack_require__(13); 9302var EventDefMutation_1 = __webpack_require__(37); 9303var EventSource_1 = __webpack_require__(6); 9304var ThemeRegistry_1 = __webpack_require__(51); 9305var Calendar = /** @class */ (function () { 9306 function Calendar(el, overrides) { 9307 this.loadingLevel = 0; // number of simultaneous loading tasks 9308 this.ignoreUpdateViewSize = 0; 9309 this.freezeContentHeightDepth = 0; 9310 // declare the current calendar instance relies on GlobalEmitter. needed for garbage collection. 9311 // unneeded() is called in destroy. 9312 GlobalEmitter_1.default.needed(); 9313 this.el = el; 9314 this.viewsByType = {}; 9315 this.optionsManager = new OptionsManager_1.default(this, overrides); 9316 this.viewSpecManager = new ViewSpecManager_1.default(this.optionsManager, this); 9317 this.initMomentInternals(); // needs to happen after options hash initialized 9318 this.initCurrentDate(); 9319 this.initEventManager(); 9320 this.constraints = new Constraints_1.default(this.eventManager, this); 9321 this.constructed(); 9322 } 9323 Calendar.prototype.constructed = function () { 9324 // useful for monkeypatching. used? 9325 }; 9326 Calendar.prototype.getView = function () { 9327 return this.view; 9328 }; 9329 Calendar.prototype.publiclyTrigger = function (name, triggerInfo) { 9330 var optHandler = this.opt(name); 9331 var context; 9332 var args; 9333 if ($.isPlainObject(triggerInfo)) { 9334 context = triggerInfo.context; 9335 args = triggerInfo.args; 9336 } 9337 else if ($.isArray(triggerInfo)) { 9338 args = triggerInfo; 9339 } 9340 if (context == null) { 9341 context = this.el[0]; // fallback context 9342 } 9343 if (!args) { 9344 args = []; 9345 } 9346 this.triggerWith(name, context, args); // Emitter's method 9347 if (optHandler) { 9348 return optHandler.apply(context, args); 9349 } 9350 }; 9351 Calendar.prototype.hasPublicHandlers = function (name) { 9352 return this.hasHandlers(name) || 9353 this.opt(name); // handler specified in options 9354 }; 9355 // Options Public API 9356 // ----------------------------------------------------------------------------------------------------------------- 9357 // public getter/setter 9358 Calendar.prototype.option = function (name, value) { 9359 var newOptionHash; 9360 if (typeof name === 'string') { 9361 if (value === undefined) { 9362 return this.optionsManager.get(name); 9363 } 9364 else { 9365 newOptionHash = {}; 9366 newOptionHash[name] = value; 9367 this.optionsManager.add(newOptionHash); 9368 } 9369 } 9370 else if (typeof name === 'object') { 9371 this.optionsManager.add(name); 9372 } 9373 }; 9374 // private getter 9375 Calendar.prototype.opt = function (name) { 9376 return this.optionsManager.get(name); 9377 }; 9378 // View 9379 // -----------------------------------------------------------------------------------------------------------------
9380 // Given a view name for a custom view or a standard view, creates a ready-to-go View object 9381 Calendar.prototype.instantiateView = function (viewType) { 9382 var spec = this.viewSpecManager.getViewSpec(viewType); 9383 if (!spec) { 9384 throw new Error("View type \"" + viewType + "\" is not valid"); 9385 } 9386 return new spec['class'](this, spec); 9387 }; 9388 // Returns a boolean about whether the view is okay to instantiate at some point 9389 Calendar.prototype.isValidViewType = function (viewType) { 9390 return Boolean(this.viewSpecManager.getViewSpec(viewType)); 9391 }; 9392 Calendar.prototype.changeView = function (viewName, dateOrRange) { 9393 if (dateOrRange) { 9394 if (dateOrRange.start && dateOrRange.end) { 9395 this.optionsManager.recordOverrides({ 9396 visibleRange: dateOrRange 9397 }); 9398 } 9399 else { 9400 this.currentDate = this.moment(dateOrRange).stripZone(); // just like gotoDate 9401 } 9402 } 9403 this.renderView(viewName); 9404 }; 9405 // Forces navigation to a view for the given date. 9406 // `viewType` can be a specific view name or a generic one like "week" or "day". 9407 Calendar.prototype.zoomTo = function (newDate, viewType) { 9408 var spec; 9409 viewType = viewType || 'day'; // day is default zoom 9410 spec = this.viewSpecManager.getViewSpec(viewType) || 9411 this.viewSpecManager.getUnitViewSpec(viewType); 9412 this.currentDate = newDate.clone(); 9413 this.renderView(spec ? spec.type : null); 9414 }; 9415 // Current Date 9416 // ----------------------------------------------------------------------------------------------------------------- 9417 Calendar.prototype.initCurrentDate = function () { 9418 var defaultDateInput = this.opt('defaultDate'); 9419 // compute the initial ambig-timezone date 9420 if (defaultDateInput != null) { 9421 this.currentDate = this.moment(defaultDateInput).stripZone(); 9422 } 9423 else { 9424 this.currentDate = this.getNow(); // getNow already returns unzoned 9425 } 9426 }; 9427 Calendar.prototype.prev = function () { 9428 var view = this.view; 9429 var prevInfo = view.dateProfileGenerator.buildPrev(view.get('dateProfile')); 9430 if (prevInfo.isValid) { 9431 this.currentDate = prevInfo.date; 9432 this.renderView(); 9433 } 9434 }; 9435 Calendar.prototype.next = function () { 9436 var view = this.view; 9437 var nextInfo = view.dateProfileGenerator.buildNext(view.get('dateProfile')); 9438 if (nextInfo.isValid) { 9439 this.currentDate = nextInfo.date; 9440 this.renderView(); 9441 } 9442 }; 9443 Calendar.prototype.prevYear = function () { 9444 this.currentDate.add(-1, 'years'); 9445 this.renderView(); 9446 }; 9447 Calendar.prototype.nextYear = function () { 9448 this.currentDate.add(1, 'years'); 9449 this.renderView(); 9450 }; 9451 Calendar.prototype.today = function () { 9452 this.currentDate = this.getNow(); // should deny like prev/next? 9453 this.renderView(); 9454 }; 9455 Calendar.prototype.gotoDate = function (zonedDateInput) { 9456 this.currentDate = this.moment(zonedDateInput).stripZone(); 9457 this.renderView(); 9458 }; 9459 Calendar.prototype.incrementDate = function (delta) { 9460 this.currentDate.add(moment.duration(delta)); 9461 this.renderView(); 9462 }; 9463 // for external API 9464 Calendar.prototype.getDate = function () { 9465 return this.applyTimezone(this.currentDate); // infuse the calendar's timezone 9466 }; 9467 // Loading Triggering 9468 // ----------------------------------------------------------------------------------------------------------------- 9469 // Should be called when any type of async data fetching begins 9470 Calendar.prototype.pushLoading = function () { 9471 if (!(this.loadingLevel++)) { 9472 this.publiclyTrigger('loading', [true, this.view]); 9473 } 9474 }; 9475 // Should be called when any type of async data fetching completes 9476 Calendar.prototype.popLoading = function () { 9477 if (!(--this.loadingLevel)) { 9478 this.publiclyTrigger('loading', [false, this.view]); 9479 } 9480 }; 9481 // High-level Rendering 9482 // ----------------------------------------------------------------------------------- 9483 Calendar.prototype.render = function () { 9484 if (!this.contentEl) { 9485 this.initialRender(); 9486 } 9487 else if (this.elementVisible()) { 9488 // mainly for the public API 9489 this.calcSize(); 9490 this.updateViewSize(); 9491 } 9492 }; 9493 Calendar.prototype.initialRender = function () { 9494 var _this = this; 9495 var el = this.el; 9496 el.addClass('fc'); 9497 // event delegation for nav links 9498 el.on('click.fc', 'a[data-goto]', function (ev) { 9499 var anchorEl = $(ev.currentTarget); 9500 var gotoOptions = anchorEl.data('goto'); // will automatically parse JSON 9501 var date = _this.moment(gotoOptions.date); 9502 var viewType = gotoOptions.type; 9503 // property like "navLinkDayClick". might be a string or a function 9504 var customAction = _this.view.opt('navLink' + util_1.capitaliseFirstLetter(viewType) + 'Click'); 9505 if (typeof customAction === 'function') { 9506 customAction(date, ev); 9507 } 9508 else { 9509 if (typeof customAction === 'string') { 9510 viewType = customAction; 9511 } 9512 _this.zoomTo(date, viewType); 9513 } 9514 });
9515 // called immediately, and upon option change 9516 this.optionsManager.watch('settingTheme', ['?theme', '?themeSystem'], function (opts) { 9517 var themeClass = ThemeRegistry_1.getThemeSystemClass(opts.themeSystem || opts.theme); 9518 var theme = new themeClass(_this.optionsManager); 9519 var widgetClass = theme.getClass('widget'); 9520 _this.theme = theme; 9521 if (widgetClass) { 9522 el.addClass(widgetClass); 9523 } 9524 }, function () { 9525 var widgetClass = _this.theme.getClass('widget'); 9526 _this.theme = null; 9527 if (widgetClass) { 9528 el.removeClass(widgetClass); 9529 } 9530 }); 9531 this.optionsManager.watch('settingBusinessHourGenerator', ['?businessHours'], function (deps) { 9532 _this.businessHourGenerator = new BusinessHourGenerator_1.default(deps.businessHours, _this); 9533 if (_this.view) { 9534 _this.view.set('businessHourGenerator', _this.businessHourGenerator); 9535 } 9536 }, function () { 9537 _this.businessHourGenerator = null; 9538 }); 9539 // called immediately, and upon option change. 9540 // HACK: locale often affects isRTL, so we explicitly listen to that too. 9541 this.optionsManager.watch('applyingDirClasses', ['?isRTL', '?locale'], function (opts) { 9542 el.toggleClass('fc-ltr', !opts.isRTL); 9543 el.toggleClass('fc-rtl', opts.isRTL); 9544 }); 9545 this.contentEl = $("<div class='fc-view-container'/>").prependTo(el); 9546 this.initToolbars(); 9547 this.renderHeader(); 9548 this.renderFooter(); 9549 this.renderView(this.opt('defaultView')); 9550 if (this.opt('handleWindowResize')) { 9551 $(window).resize(this.windowResizeProxy = util_1.debounce(// prevents rapid calls 9552 this.windowResize.bind(this), this.opt('windowResizeDelay'))); 9553 } 9554 }; 9555 Calendar.prototype.destroy = function () { 9556 if (this.view) { 9557 this.clearView(); 9558 } 9559 this.toolbarsManager.proxyCall('removeElement'); 9560 this.contentEl.remove(); 9561 this.el.removeClass('fc fc-ltr fc-rtl'); 9562 // removes theme-related root className 9563 this.optionsManager.unwatch('settingTheme'); 9564 this.optionsManager.unwatch('settingBusinessHourGenerator'); 9565 this.el.off('.fc'); // unbind nav link handlers 9566 if (this.windowResizeProxy) { 9567 $(window).unbind('resize', this.windowResizeProxy); 9568 this.windowResizeProxy = null; 9569 } 9570 GlobalEmitter_1.default.unneeded(); 9571 }; 9572 Calendar.prototype.elementVisible = function () { 9573 return this.el.is(':visible'); 9574 }; 9575 // Render Queue 9576 // ----------------------------------------------------------------------------------------------------------------- 9577 Calendar.prototype.bindViewHandlers = function (view) { 9578 var _this = this; 9579 view.watch('titleForCalendar', ['title'], function (deps) { 9580 if (view === _this.view) { 9581 _this.setToolbarsTitle(deps.title); 9582 } 9583 }); 9584 view.watch('dateProfileForCalendar', ['dateProfile'], function (deps) { 9585 if (view === _this.view) { 9586 _this.currentDate = deps.dateProfile.date; // might have been constrained by view dates 9587 _this.updateToolbarButtons(deps.dateProfile); 9588 } 9589 }); 9590 }; 9591 Calendar.prototype.unbindViewHandlers = function (view) { 9592 view.unwatch('titleForCalendar'); 9593 view.unwatch('dateProfileForCalendar'); 9594 }; 9595 // View Rendering 9596 // ----------------------------------------------------------------------------------- 9597 // Renders a view because of a date change, view-type change, or for the first time. 9598 // If not given a viewType, keep the current view but render different dates. 9599 // Accepts an optional scroll state to restore to. 9600 Calendar.prototype.renderView = function (viewType) { 9601 var oldView = this.view; 9602 var newView; 9603 this.freezeContentHeight(); 9604 if (oldView && viewType && oldView.type !== viewType) { 9605 this.clearView(); 9606 } 9607 // if viewType changed, or the view was never created, create a fresh view 9608 if (!this.view && viewType) { 9609 newView = this.view = 9610 this.viewsByType[viewType] || 9611 (this.viewsByType[viewType] = this.instantiateView(viewType)); 9612 this.bindViewHandlers(newView); 9613 newView.startBatchRender(); // so that setElement+setDate rendering are joined 9614 newView.setElement($("<div class='fc-view fc-" + viewType + "-view' />").appendTo(this.contentEl)); 9615 this.toolbarsManager.proxyCall('activateButton', viewType); 9616 } 9617 if (this.view) { 9618 // prevent unnecessary change firing 9619 if (this.view.get('businessHourGenerator') !== this.businessHourGenerator) { 9620 this.view.set('businessHourGenerator', this.businessHourGenerator); 9621 } 9622 this.view.setDate(this.currentDate); 9623 if (newView) { 9624 newView.stopBatchRender(); 9625 } 9626 } 9627 this.thawContentHeight(); 9628 }; 9629 // Unrenders the current view and reflects this change in the Header. 9630 // Unregsiters the `view`, but does not remove from viewByType hash. 9631 Calendar.prototype.clearView = function () { 9632 var currentView = this.view; 9633 this.toolbarsManager.proxyCall('deactivateButton', currentView.type); 9634 this.unbindViewHandlers(currentView); 9635 currentView.removeElement(); 9636 currentView.unsetDate(); // so bindViewHandlers doesn't fire with old values next time 9637 this.view = null; 9638 }; 9639 // Destroys the view, including the view object. Then, re-instantiates it and renders it. 9640 // Maintains the same scroll state. 9641 // TODO: maintain any other user-manipulated state. 9642 Calendar.prototype.reinitView = function () { 9643 var oldView = this.view; 9644 var scroll = oldView.queryScroll(); // wouldn't be so complicated if Calendar owned the scroll 9645 this.freezeContentHeight(); 9646 this.clearView(); 9647 this.calcSize(); 9648 this.renderView(oldView.type); // needs the type to freshly render
9649 this.view.applyScroll(scroll); 9650 this.thawContentHeight(); 9651 }; 9652 // Resizing 9653 // ----------------------------------------------------------------------------------- 9654 Calendar.prototype.getSuggestedViewHeight = function () { 9655 if (this.suggestedViewHeight == null) { 9656 this.calcSize(); 9657 } 9658 return this.suggestedViewHeight; 9659 }; 9660 Calendar.prototype.isHeightAuto = function () { 9661 return this.opt('contentHeight') === 'auto' || this.opt('height') === 'auto'; 9662 }; 9663 Calendar.prototype.updateViewSize = function (isResize) { 9664 if (isResize === void 0) { isResize = false; } 9665 var view = this.view; 9666 var scroll; 9667 if (!this.ignoreUpdateViewSize && view) { 9668 if (isResize) { 9669 this.calcSize(); 9670 scroll = view.queryScroll(); 9671 } 9672 this.ignoreUpdateViewSize++; 9673 view.updateSize(this.getSuggestedViewHeight(), this.isHeightAuto(), isResize); 9674 this.ignoreUpdateViewSize--; 9675 if (isResize) { 9676 view.applyScroll(scroll); 9677 } 9678 return true; // signal success 9679 } 9680 }; 9681 Calendar.prototype.calcSize = function () { 9682 if (this.elementVisible()) { 9683 this._calcSize(); 9684 } 9685 }; 9686 Calendar.prototype._calcSize = function () { 9687 var contentHeightInput = this.opt('contentHeight'); 9688 var heightInput = this.opt('height'); 9689 if (typeof contentHeightInput === 'number') { 9690 this.suggestedViewHeight = contentHeightInput; 9691 } 9692 else if (typeof contentHeightInput === 'function') { 9693 this.suggestedViewHeight = contentHeightInput(); 9694 } 9695 else if (typeof heightInput === 'number') { 9696 this.suggestedViewHeight = heightInput - this.queryToolbarsHeight(); 9697 } 9698 else if (typeof heightInput === 'function') { 9699 this.suggestedViewHeight = heightInput() - this.queryToolbarsHeight(); 9700 } 9701 else if (heightInput === 'parent') { 9702 this.suggestedViewHeight = this.el.parent().height() - this.queryToolbarsHeight(); 9703 } 9704 else { 9705 this.suggestedViewHeight = Math.round(this.contentEl.width() / 9706 Math.max(this.opt('aspectRatio'), .5)); 9707 } 9708 }; 9709 Calendar.prototype.windowResize = function (ev) { 9710 if ( 9711 // the purpose: so we don't process jqui "resize" events that have bubbled up 9712 // cast to any because .target, which is Element, can't be compared to window for some reason. 9713 ev.target === window && 9714 this.view && 9715 this.view.isDatesRendered) { 9716 if (this.updateViewSize(true)) { 9717 this.publiclyTrigger('windowResize', [this.view]); 9718 } 9719 } 9720 }; 9721 /* Height "Freezing" 9722 -----------------------------------------------------------------------------*/ 9723 Calendar.prototype.freezeContentHeight = function () { 9724 if (!(this.freezeContentHeightDepth++)) { 9725 this.forceFreezeContentHeight(); 9726 } 9727 }; 9728 Calendar.prototype.forceFreezeContentHeight = function () { 9729 this.contentEl.css({ 9730 width: '100%', 9731 height: this.contentEl.height(), 9732 overflow: 'hidden' 9733 }); 9734 }; 9735 Calendar.prototype.thawContentHeight = function () { 9736 this.freezeContentHeightDepth--; 9737 // always bring back to natural height 9738 this.contentEl.css({ 9739 width: '', 9740 height: '', 9741 overflow: '' 9742 }); 9743 // but if there are future thaws, re-freeze 9744 if (this.freezeContentHeightDepth) { 9745 this.forceFreezeContentHeight(); 9746 } 9747 }; 9748 // Toolbar 9749 // ----------------------------------------------------------------------------------------------------------------- 9750 Calendar.prototype.initToolbars = function () { 9751 this.header = new Toolbar_1.default(this, this.computeHeaderOptions()); 9752 this.footer = new Toolbar_1.default(this, this.computeFooterOptions()); 9753 this.toolbarsManager = new Iterator_1.default([this.header, this.footer]); 9754 }; 9755 Calendar.prototype.computeHeaderOptions = function () { 9756 return {
9757 extraClasses: 'fc-header-toolbar', 9758 layout: this.opt('header') 9759 }; 9760 }; 9761 Calendar.prototype.computeFooterOptions = function () { 9762 return { 9763 extraClasses: 'fc-footer-toolbar', 9764 layout: this.opt('footer') 9765 }; 9766 }; 9767 // can be called repeatedly and Header will rerender 9768 Calendar.prototype.renderHeader = function () { 9769 var header = this.header; 9770 header.setToolbarOptions(this.computeHeaderOptions()); 9771 header.render(); 9772 if (header.el) { 9773 this.el.prepend(header.el); 9774 } 9775 }; 9776 // can be called repeatedly and Footer will rerender 9777 Calendar.prototype.renderFooter = function () { 9778 var footer = this.footer; 9779 footer.setToolbarOptions(this.computeFooterOptions()); 9780 footer.render(); 9781 if (footer.el) { 9782 this.el.append(footer.el); 9783 } 9784 }; 9785 Calendar.prototype.setToolbarsTitle = function (title) { 9786 this.toolbarsManager.proxyCall('updateTitle', title); 9787 }; 9788 Calendar.prototype.updateToolbarButtons = function (dateProfile) { 9789 var now = this.getNow(); 9790 var view = this.view; 9791 var todayInfo = view.dateProfileGenerator.build(now); 9792 var prevInfo = view.dateProfileGenerator.buildPrev(view.get('dateProfile')); 9793 var nextInfo = view.dateProfileGenerator.buildNext(view.get('dateProfile')); 9794 this.toolbarsManager.proxyCall((todayInfo.isValid && !dateProfile.currentUnzonedRange.containsDate(now)) ? 9795 'enableButton' : 9796 'disableButton', 'today'); 9797 this.toolbarsManager.proxyCall(prevInfo.isValid ? 9798 'enableButton' : 9799 'disableButton', 'prev'); 9800 this.toolbarsManager.proxyCall(nextInfo.isValid ? 9801 'enableButton' : 9802 'disableButton', 'next'); 9803 }; 9804 Calendar.prototype.queryToolbarsHeight = function () { 9805 return this.toolbarsManager.items.reduce(function (accumulator, toolbar) { 9806 var toolbarHeight = toolbar.el ? toolbar.el.outerHeight(true) : 0; // includes margin 9807 return accumulator + toolbarHeight; 9808 }, 0); 9809 }; 9810 // Selection 9811 // ----------------------------------------------------------------------------------------------------------------- 9812 // this public method receives start/end dates in any format, with any timezone 9813 Calendar.prototype.select = function (zonedStartInput, zonedEndInput) { 9814 this.view.select(this.buildSelectFootprint.apply(this, arguments)); 9815 }; 9816 Calendar.prototype.unselect = function () { 9817 if (this.view) { 9818 this.view.unselect(); 9819 } 9820 }; 9821 // Given arguments to the select method in the API, returns a span (unzoned start/end and other info) 9822 Calendar.prototype.buildSelectFootprint = function (zonedStartInput, zonedEndInput) { 9823 var start = this.moment(zonedStartInput).stripZone(); 9824 var end; 9825 if (zonedEndInput) { 9826 end = this.moment(zonedEndInput).stripZone(); 9827 } 9828 else if (start.hasTime()) { 9829 end = start.clone().add(this.defaultTimedEventDuration); 9830 } 9831 else { 9832 end = start.clone().add(this.defaultAllDayEventDuration); 9833 } 9834 return new ComponentFootprint_1.default(new UnzonedRange_1.default(start, end), !start.hasTime()); 9835 }; 9836 // Date Utils 9837 // ----------------------------------------------------------------------------------------------------------------- 9838 Calendar.prototype.initMomentInternals = function () { 9839 var _this = this; 9840 this.defaultAllDayEventDuration = moment.duration(this.opt('defaultAllDayEventDuration')); 9841 this.defaultTimedEventDuration = moment.duration(this.opt('defaultTimedEventDuration')); 9842 // Called immediately, and when any of the options change. 9843 // Happens before any internal objects rebuild or rerender, because this is very core. 9844 this.optionsManager.watch('buildingMomentLocale', [ 9845 '?locale', '?monthNames', '?monthNamesShort', '?dayNames', '?dayNamesShort', 9846 '?firstDay', '?weekNumberCalculation' 9847 ], function (opts) { 9848 var weekNumberCalculation = opts.weekNumberCalculation; 9849 var firstDay = opts.firstDay; 9850 var _week; 9851 // normalize
9852 if (weekNumberCalculation === 'iso') { 9853 weekNumberCalculation = 'ISO'; // normalize 9854 } 9855 var localeData = Object.create(// make a cheap copy 9856 locale_1.getMomentLocaleData(opts.locale) // will fall back to en 9857 ); 9858 if (opts.monthNames) { 9859 localeData._months = opts.monthNames; 9860 } 9861 if (opts.monthNamesShort) { 9862 localeData._monthsShort = opts.monthNamesShort; 9863 } 9864 if (opts.dayNames) { 9865 localeData._weekdays = opts.dayNames; 9866 } 9867 if (opts.dayNamesShort) { 9868 localeData._weekdaysShort = opts.dayNamesShort; 9869 } 9870 if (firstDay == null && weekNumberCalculation === 'ISO') { 9871 firstDay = 1; 9872 } 9873 if (firstDay != null) { 9874 _week = Object.create(localeData._week); // _week: { dow: # } 9875 _week.dow = firstDay; 9876 localeData._week = _week; 9877 } 9878 if (weekNumberCalculation === 'ISO' || 9879 weekNumberCalculation === 'local' || 9880 typeof weekNumberCalculation === 'function') { 9881 localeData._fullCalendar_weekCalc = weekNumberCalculation; // moment-ext will know what to do with it 9882 } 9883 _this.localeData = localeData; 9884 // If the internal current date object already exists, move to new locale. 9885 // We do NOT need to do this technique for event dates, because this happens when converting to "segments". 9886 if (_this.currentDate) { 9887 _this.localizeMoment(_this.currentDate); // sets to localeData 9888 } 9889 }); 9890 }; 9891 // Builds a moment using the settings of the current calendar: timezone and locale. 9892 // Accepts anything the vanilla moment() constructor accepts. 9893 Calendar.prototype.moment = function () { 9894 var args = []; 9895 for (var _i = 0; _i < arguments.length; _i++) { 9896 args[_i] = arguments[_i]; 9897 } 9898 var mom; 9899 if (this.opt('timezone') === 'local') { 9900 mom = moment_ext_1.default.apply(null, args); 9901 // Force the moment to be local, because momentExt doesn't guarantee it. 9902 if (mom.hasTime()) { 9903 mom.local(); 9904 } 9905 } 9906 else if (this.opt('timezone') === 'UTC') { 9907 mom = moment_ext_1.default.utc.apply(null, args); // process as UTC 9908 } 9909 else { 9910 mom = moment_ext_1.default.parseZone.apply(null, args); // let the input decide the zone 9911 } 9912 this.localizeMoment(mom); // TODO 9913 return mom; 9914 }; 9915 Calendar.prototype.msToMoment = function (ms, forceAllDay) { 9916 var mom = moment_ext_1.default.utc(ms); // TODO: optimize by using Date.UTC 9917 if (forceAllDay) { 9918 mom.stripTime(); 9919 } 9920 else { 9921 mom = this.applyTimezone(mom); // may or may not apply locale 9922 } 9923 this.localizeMoment(mom); 9924 return mom; 9925 }; 9926 Calendar.prototype.msToUtcMoment = function (ms, forceAllDay) { 9927 var mom = moment_ext_1.default.utc(ms); // TODO: optimize by using Date.UTC 9928 if (forceAllDay) { 9929 mom.stripTime(); 9930 } 9931 this.localizeMoment(mom); 9932 return mom; 9933 }; 9934 // Updates the given moment's locale settings to the current calendar locale settings. 9935 Calendar.prototype.localizeMoment = function (mom) { 9936 mom._locale = this.localeData; 9937 }; 9938 // Returns a boolean about whether or not the calendar knows how to calculate 9939 // the timezone offset of arbitrary dates in the current timezone. 9940 Calendar.prototype.getIsAmbigTimezone = function () { 9941 return this.opt('timezone') !== 'local' && this.opt('timezone') !== 'UTC'; 9942 }; 9943 // Returns a copy of the given date in the current timezone. Has no effect on dates without times. 9944 Calendar.prototype.applyTimezone = function (date) { 9945 if (!date.hasTime()) { 9946 return date.clone(); 9947 } 9948 var zonedDate = this.moment(date.toArray()); 9949 var timeAdjust = date.time().asMilliseconds() - zonedDate.time().asMilliseconds(); 9950 var adjustedZonedDate; 9951 // Safari sometimes has problems with this coersion when near DST. Adjust if necessary. (bug #2396) 9952 if (timeAdjust) { 9953 adjustedZonedDate = zonedDate.clone().add(timeAdjust); // add milliseconds 9954 if (date.time().asMilliseconds() - adjustedZonedDate.time().asMilliseconds() === 0) { 9955 zonedDate = adjustedZonedDate; 9956 } 9957 } 9958 return zonedDate; 9959 }; 9960 /* 9961 Assumes the footprint is non-open-ended. 9962 */ 9963 Calendar.prototype.footprintToDateProfile = function (componentFootprint, ignoreEnd) { 9964 if (ignoreEnd === void 0) { ignoreEnd = false; } 9965 var start = moment_ext_1.default.utc(componentFootprint.unzonedRange.startMs); 9966 var end; 9967 if (!ignoreEnd) { 9968 end = moment_ext_1.default.utc(componentFootprint.unzonedRange.endMs); 9969 } 9970 if (componentFootprint.isAllDay) { 9971 start.stripTime(); 9972 if (end) { 9973 end.stripTime(); 9974 } 9975 } 9976 else { 9977 start = this.applyTimezone(start); 9978 if (end) { 9979 end = this.applyTimezone(end); 9980 } 9981 } 9982 return new EventDateProfile_1.default(start, end, this); 9983 }; 9984 // Returns a moment for the current date, as defined by the client's computer or from the `now` option. 9985 // Will return an moment with an ambiguous timezone. 9986 Calendar.prototype.getNow = function () { 9987 var now = this.opt('now'); 9988 if (typeof now === 'function') { 9989 now = now(); 9990 } 9991 return this.moment(now).stripZone(); 9992 }; 9993 // Produces a human-readable string for the given duration. 9994 // Side-effect: changes the locale of the given duration. 9995 Calendar.prototype.humanizeDuration = function (duration) { 9996 return duration.locale(this.opt('locale')).humanize(); 9997 }; 9998 // will return `null` if invalid range 9999 Calendar.prototype.parseUnzonedRange = function (rangeInput) { 10000 var start = null; 10001 var end = null; 10002 if (rangeInput.start) { 10003 start = this.moment(rangeInput.start).stripZone(); 10004 } 10005 if (rangeInput.end) {
10006 end = this.moment(rangeInput.end).stripZone(); 10007 } 10008 if (!start && !end) { 10009 return null; 10010 } 10011 if (start && end && end.isBefore(start)) { 10012 return null; 10013 } 10014 return new UnzonedRange_1.default(start, end); 10015 }; 10016 // Event-Date Utilities 10017 // ----------------------------------------------------------------------------------------------------------------- 10018 Calendar.prototype.initEventManager = function () { 10019 var _this = this; 10020 var eventManager = new EventManager_1.default(this); 10021 var rawSources = this.opt('eventSources') || []; 10022 var singleRawSource = this.opt('events'); 10023 this.eventManager = eventManager; 10024 if (singleRawSource) { 10025 rawSources.unshift(singleRawSource); 10026 } 10027 eventManager.on('release', function (eventsPayload) { 10028 _this.trigger('eventsReset', eventsPayload); 10029 }); 10030 eventManager.freeze(); 10031 rawSources.forEach(function (rawSource) { 10032 var source = EventSourceParser_1.default.parse(rawSource, _this); 10033 if (source) { 10034 eventManager.addSource(source); 10035 } 10036 }); 10037 eventManager.thaw(); 10038 }; 10039 Calendar.prototype.requestEvents = function (start, end) { 10040 return this.eventManager.requestEvents(start, end, this.opt('timezone'), !this.opt('lazyFetching')); 10041 }; 10042 // Get an event's normalized end date. If not present, calculate it from the defaults. 10043 Calendar.prototype.getEventEnd = function (event) { 10044 if (event.end) { 10045 return event.end.clone(); 10046 } 10047 else { 10048 return this.getDefaultEventEnd(event.allDay, event.start); 10049 } 10050 }; 10051 // Given an event's allDay status and start date, return what its fallback end date should be. 10052 // TODO: rename to computeDefaultEventEnd 10053 Calendar.prototype.getDefaultEventEnd = function (allDay, zonedStart) { 10054 var end = zonedStart.clone(); 10055 if (allDay) { 10056 end.stripTime().add(this.defaultAllDayEventDuration); 10057 } 10058 else { 10059 end.add(this.defaultTimedEventDuration); 10060 } 10061 if (this.getIsAmbigTimezone()) { 10062 end.stripZone(); // we don't know what the tzo should be 10063 } 10064 return end; 10065 }; 10066 // Public Events API 10067 // ----------------------------------------------------------------------------------------------------------------- 10068 Calendar.prototype.rerenderEvents = function () { 10069 this.view.flash('displayingEvents'); 10070 }; 10071 Calendar.prototype.refetchEvents = function () { 10072 this.eventManager.refetchAllSources(); 10073 }; 10074 Calendar.prototype.renderEvents = function (eventInputs, isSticky) { 10075 this.eventManager.freeze(); 10076 for (var i = 0; i < eventInputs.length; i++) { 10077 this.renderEvent(eventInputs[i], isSticky); 10078 } 10079 this.eventManager.thaw(); 10080 }; 10081 Calendar.prototype.renderEvent = function (eventInput, isSticky) { 10082 if (isSticky === void 0) { isSticky = false; } 10083 var eventManager = this.eventManager; 10084 var eventDef = EventDefParser_1.default.parse(eventInput, eventInput.source || eventManager.stickySource); 10085 if (eventDef) { 10086 eventManager.addEventDef(eventDef, isSticky); 10087 } 10088 }; 10089 // legacyQuery operates on legacy event instance objects 10090 Calendar.prototype.removeEvents = function (legacyQuery) { 10091 var eventManager = this.eventManager; 10092 var legacyInstances = []; 10093 var idMap = {}; 10094 var eventDef; 10095 var i; 10096 if (legacyQuery == null) { 10097 eventManager.removeAllEventDefs(); // persist=true 10098 } 10099 else { 10100 eventManager.getEventInstances().forEach(function (eventInstance) { 10101 legacyInstances.push(eventInstance.toLegacy()); 10102 }); 10103 legacyInstances = filterLegacyEventInstances(legacyInstances, legacyQuery); 10104 // compute unique IDs 10105 for (i = 0; i < legacyInstances.length; i++) { 10106 eventDef = this.eventManager.getEventDefByUid(legacyInstances[i]._id); 10107 idMap[eventDef.id] = true; 10108 } 10109 eventManager.freeze(); 10110 for (i in idMap) { 10111 eventManager.removeEventDefsById(i); // persist=true 10112 } 10113 eventManager.thaw(); 10114 } 10115 }; 10116 // legacyQuery operates on legacy event instance objects 10117 Calendar.prototype.clientEvents = function (legacyQuery) { 10118 var legacyEventInstances = [];
10119 this.eventManager.getEventInstances().forEach(function (eventInstance) { 10120 legacyEventInstances.push(eventInstance.toLegacy()); 10121 }); 10122 return filterLegacyEventInstances(legacyEventInstances, legacyQuery); 10123 }; 10124 Calendar.prototype.updateEvents = function (eventPropsArray) { 10125 this.eventManager.freeze(); 10126 for (var i = 0; i < eventPropsArray.length; i++) { 10127 this.updateEvent(eventPropsArray[i]); 10128 } 10129 this.eventManager.thaw(); 10130 }; 10131 Calendar.prototype.updateEvent = function (eventProps) { 10132 var eventDef = this.eventManager.getEventDefByUid(eventProps._id); 10133 var eventInstance; 10134 var eventDefMutation; 10135 if (eventDef instanceof SingleEventDef_1.default) { 10136 eventInstance = eventDef.buildInstance(); 10137 eventDefMutation = EventDefMutation_1.default.createFromRawProps(eventInstance, eventProps, // raw props 10138 null // largeUnit -- who uses it? 10139 ); 10140 this.eventManager.mutateEventsWithId(eventDef.id, eventDefMutation); // will release 10141 } 10142 }; 10143 // Public Event Sources API 10144 // ------------------------------------------------------------------------------------ 10145 Calendar.prototype.getEventSources = function () { 10146 return this.eventManager.otherSources.slice(); // clone 10147 }; 10148 Calendar.prototype.getEventSourceById = function (id) { 10149 return this.eventManager.getSourceById(EventSource_1.default.normalizeId(id)); 10150 }; 10151 Calendar.prototype.addEventSource = function (sourceInput) { 10152 var source = EventSourceParser_1.default.parse(sourceInput, this); 10153 if (source) { 10154 this.eventManager.addSource(source); 10155 } 10156 }; 10157 Calendar.prototype.removeEventSources = function (sourceMultiQuery) { 10158 var eventManager = this.eventManager; 10159 var sources; 10160 var i; 10161 if (sourceMultiQuery == null) { 10162 this.eventManager.removeAllSources(); 10163 } 10164 else { 10165 sources = eventManager.multiQuerySources(sourceMultiQuery); 10166 eventManager.freeze(); 10167 for (i = 0; i < sources.length; i++) { 10168 eventManager.removeSource(sources[i]); 10169 } 10170 eventManager.thaw(); 10171 } 10172 }; 10173 Calendar.prototype.removeEventSource = function (sourceQuery) { 10174 var eventManager = this.eventManager; 10175 var sources = eventManager.querySources(sourceQuery); 10176 var i; 10177 eventManager.freeze(); 10178 for (i = 0; i < sources.length; i++) { 10179 eventManager.removeSource(sources[i]); 10180 } 10181 eventManager.thaw(); 10182 }; 10183 Calendar.prototype.refetchEventSources = function (sourceMultiQuery) { 10184 var eventManager = this.eventManager; 10185 var sources = eventManager.multiQuerySources(sourceMultiQuery); 10186 var i; 10187 eventManager.freeze(); 10188 for (i = 0; i < sources.length; i++) { 10189 eventManager.refetchSource(sources[i]); 10190 } 10191 eventManager.thaw(); 10192 }; 10193 // not for internal use. use options module directly instead. 10194 Calendar.defaults = options_1.globalDefaults; 10195 Calendar.englishDefaults = options_1.englishDefaults; 10196 Calendar.rtlDefaults = options_1.rtlDefaults; 10197 return Calendar; 10198}()); 10199exports.default = Calendar; 10200EmitterMixin_1.default.mixInto(Calendar); 10201ListenerMixin_1.default.mixInto(Calendar); 10202function filterLegacyEventInstances(legacyEventInstances, legacyQuery) { 10203 if (legacyQuery == null) { 10204 return legacyEventInstances; 10205 } 10206 else if ($.isFunction(legacyQuery)) { 10207 return legacyEventInstances.filter(legacyQuery); 10208 } 10209 else { 10210 legacyQuery += ''; // normalize to string 10211 return legacyEventInstances.filter(function (legacyEventInstance) { 10212 // soft comparison because id not be normalized to string 10213 // tslint:disable-next-line 10214 return legacyEventInstance.id == legacyQuery || 10215 legacyEventInstance._id === legacyQuery; // can specify internal id, but must exactly match 10216 }); 10217 } 10218} 10219 10220 10221/***/ }), 10222/* 221 */ 10223/***/ (function(module, exports, __webpack_require__) { 10224 10225Object.defineProperty(exports, "__esModule", { value: true });
10226var moment = __webpack_require__(0); 10227var util_1 = __webpack_require__(4); 10228var UnzonedRange_1 = __webpack_require__(5); 10229var DateProfileGenerator = /** @class */ (function () { 10230 function DateProfileGenerator(_view) { 10231 this._view = _view; 10232 } 10233 DateProfileGenerator.prototype.opt = function (name) { 10234 return this._view.opt(name); 10235 }; 10236 DateProfileGenerator.prototype.trimHiddenDays = function (unzonedRange) { 10237 return this._view.trimHiddenDays(unzonedRange); 10238 }; 10239 DateProfileGenerator.prototype.msToUtcMoment = function (ms, forceAllDay) { 10240 return this._view.calendar.msToUtcMoment(ms, forceAllDay); 10241 }; 10242 /* Date Range Computation 10243 ------------------------------------------------------------------------------------------------------------------*/ 10244 // Builds a structure with info about what the dates/ranges will be for the "prev" view. 10245 DateProfileGenerator.prototype.buildPrev = function (currentDateProfile) { 10246 var prevDate = currentDateProfile.date.clone() 10247 .startOf(currentDateProfile.currentRangeUnit) 10248 .subtract(currentDateProfile.dateIncrement); 10249 return this.build(prevDate, -1); 10250 }; 10251 // Builds a structure with info about what the dates/ranges will be for the "next" view. 10252 DateProfileGenerator.prototype.buildNext = function (currentDateProfile) { 10253 var nextDate = currentDateProfile.date.clone() 10254 .startOf(currentDateProfile.currentRangeUnit) 10255 .add(currentDateProfile.dateIncrement); 10256 return this.build(nextDate, 1); 10257 }; 10258 // Builds a structure holding dates/ranges for rendering around the given date. 10259 // Optional direction param indicates whether the date is being incremented/decremented 10260 // from its previous value. decremented = -1, incremented = 1 (default). 10261 DateProfileGenerator.prototype.build = function (date, direction, forceToValid) { 10262 if (forceToValid === void 0) { forceToValid = false; } 10263 var isDateAllDay = !date.hasTime(); 10264 var validUnzonedRange; 10265 var minTime = null; 10266 var maxTime = null; 10267 var currentInfo; 10268 var isRangeAllDay; 10269 var renderUnzonedRange; 10270 var activeUnzonedRange; 10271 var isValid; 10272 validUnzonedRange = this.buildValidRange(); 10273 validUnzonedRange = this.trimHiddenDays(validUnzonedRange); 10274 if (forceToValid) { 10275 date = this.msToUtcMoment(validUnzonedRange.constrainDate(date), // returns MS 10276 isDateAllDay); 10277 } 10278 currentInfo = this.buildCurrentRangeInfo(date, direction); 10279 isRangeAllDay = /^(year|month|week|day)$/.test(currentInfo.unit); 10280 renderUnzonedRange = this.buildRenderRange(this.trimHiddenDays(currentInfo.unzonedRange), currentInfo.unit, isRangeAllDay); 10281 renderUnzonedRange = this.trimHiddenDays(renderUnzonedRange); 10282 activeUnzonedRange = renderUnzonedRange.clone(); 10283 if (!this.opt('showNonCurrentDates')) { 10284 activeUnzonedRange = activeUnzonedRange.intersect(currentInfo.unzonedRange); 10285 } 10286 minTime = moment.duration(this.opt('minTime')); 10287 maxTime = moment.duration(this.opt('maxTime')); 10288 activeUnzonedRange = this.adjustActiveRange(activeUnzonedRange, minTime, maxTime); 10289 activeUnzonedRange = activeUnzonedRange.intersect(validUnzonedRange); // might return null 10290 if (activeUnzonedRange) { 10291 date = this.msToUtcMoment(activeUnzonedRange.constrainDate(date), // returns MS 10292 isDateAllDay); 10293 } 10294 // it's invalid if the originally requested date is not contained, 10295 // or if the range is completely outside of the valid range. 10296 isValid = currentInfo.unzonedRange.intersectsWith(validUnzonedRange); 10297 return { 10298 // constraint for where prev/next operations can go and where events can be dragged/resized to. 10299 // an object with optional start and end properties. 10300 validUnzonedRange: validUnzonedRange, 10301 // range the view is formally responsible for. 10302 // for example, a month view might have 1st-31st, excluding padded dates 10303 currentUnzonedRange: currentInfo.unzonedRange, 10304 // name of largest unit being displayed, like "month" or "week" 10305 currentRangeUnit: currentInfo.unit, 10306 isRangeAllDay: isRangeAllDay, 10307 // dates that display events and accept drag-n-drop 10308 // will be `null` if no dates accept events 10309 activeUnzonedRange: activeUnzonedRange, 10310 // date range with a rendered skeleton 10311 // includes not-active days that need some sort of DOM 10312 renderUnzonedRange: renderUnzonedRange, 10313 // Duration object that denotes the first visible time of any given day 10314 minTime: minTime, 10315 // Duration object that denotes the exclusive visible end time of any given day 10316 maxTime: maxTime, 10317 isValid: isValid, 10318 date: date, 10319 // how far the current date will move for a prev/next operation 10320 dateIncrement: this.buildDateIncrement(currentInfo.duration) 10321 // pass a fallback (might be null) ^ 10322 }; 10323 }; 10324 // Builds an object with optional start/end properties. 10325 // Indicates the minimum/maximum dates to display. 10326 // not responsible for trimming hidden days. 10327 DateProfileGenerator.prototype.buildValidRange = function () { 10328 return this._view.getUnzonedRangeOption('validRange', this._view.calendar.getNow()) || 10329 new UnzonedRange_1.default(); // completely open-ended 10330 }; 10331 // Builds a structure with info about the "current" range, the range that is 10332 // highlighted as being the current month for example. 10333 // See build() for a description of `direction`. 10334 // Guaranteed to have `range` and `unit` properties. `duration` is optional. 10335 // TODO: accept a MS-time instead of a moment `date`? 10336 DateProfileGenerator.prototype.buildCurrentRangeInfo = function (date, direction) { 10337 var viewSpec = this._view.viewSpec; 10338 var duration = null; 10339 var unit = null; 10340 var unzonedRange = null; 10341 var dayCount; 10342 if (viewSpec.duration) { 10343 duration = viewSpec.duration; 10344 unit = viewSpec.durationUnit; 10345 unzonedRange = this.buildRangeFromDuration(date, direction, duration, unit); 10346 } 10347 else if ((dayCount = this.opt('dayCount'))) { 10348 unit = 'day'; 10349 unzonedRange = this.buildRangeFromDayCount(date, direction, dayCount); 10350 } 10351 else if ((unzonedRange = this.buildCustomVisibleRange(date))) { 10352 unit = util_1.computeGreatestUnit(unzonedRange.getStart(), unzonedRange.getEnd()); 10353 } 10354 else { 10355 duration = this.getFallbackDuration(); 10356 unit = util_1.computeGreatestUnit(duration); 10357 unzonedRange = this.buildRangeFromDuration(date, direction, duration, unit); 10358 } 10359 return { duration: duration, unit: unit, unzonedRange: unzonedRange }; 10360 }; 10361 DateProfileGenerator.prototype.getFallbackDuration = function () { 10362 return moment.duration({ days: 1 }); 10363 }; 10364 // Returns a new activeUnzonedRange to have time values (un-ambiguate) 10365 // minTime or maxTime causes the range to expand. 10366 DateProfileGenerator.prototype.adjustActiveRange = function (unzonedRange, minTime, maxTime) { 10367 var start = unzonedRange.getStart(); 10368 var end = unzonedRange.getEnd(); 10369 if (this._view.usesMinMaxTime) { 10370 if (minTime < 0) {
10371 start.time(0).add(minTime); 10372 } 10373 if (maxTime > 24 * 60 * 60 * 1000) { 10374 end.time(maxTime - (24 * 60 * 60 * 1000)); 10375 } 10376 } 10377 return new UnzonedRange_1.default(start, end); 10378 }; 10379 // Builds the "current" range when it is specified as an explicit duration. 10380 // `unit` is the already-computed computeGreatestUnit value of duration. 10381 // TODO: accept a MS-time instead of a moment `date`? 10382 DateProfileGenerator.prototype.buildRangeFromDuration = function (date, direction, duration, unit) { 10383 var alignment = this.opt('dateAlignment'); 10384 var dateIncrementInput; 10385 var dateIncrementDuration; 10386 var start; 10387 var end; 10388 var res; 10389 // compute what the alignment should be 10390 if (!alignment) { 10391 dateIncrementInput = this.opt('dateIncrement'); 10392 if (dateIncrementInput) { 10393 dateIncrementDuration = moment.duration(dateIncrementInput); 10394 // use the smaller of the two units 10395 if (dateIncrementDuration < duration) { 10396 alignment = util_1.computeDurationGreatestUnit(dateIncrementDuration, dateIncrementInput); 10397 } 10398 else { 10399 alignment = unit; 10400 } 10401 } 10402 else { 10403 alignment = unit; 10404 } 10405 } 10406 // if the view displays a single day or smaller 10407 if (duration.as('days') <= 1) { 10408 if (this._view.isHiddenDay(start)) { 10409 start = this._view.skipHiddenDays(start, direction); 10410 start.startOf('day'); 10411 } 10412 } 10413 function computeRes() { 10414 start = date.clone().startOf(alignment); 10415 end = start.clone().add(duration); 10416 res = new UnzonedRange_1.default(start, end); 10417 } 10418 computeRes(); 10419 // if range is completely enveloped by hidden days, go past the hidden days 10420 if (!this.trimHiddenDays(res)) { 10421 date = this._view.skipHiddenDays(date, direction); 10422 computeRes(); 10423 } 10424 return res; 10425 }; 10426 // Builds the "current" range when a dayCount is specified. 10427 // TODO: accept a MS-time instead of a moment `date`? 10428 DateProfileGenerator.prototype.buildRangeFromDayCount = function (date, direction, dayCount) { 10429 var customAlignment = this.opt('dateAlignment'); 10430 var runningCount = 0; 10431 var start = date.clone(); 10432 var end; 10433 if (customAlignment) { 10434 start.startOf(customAlignment); 10435 } 10436 start.startOf('day'); 10437 start = this._view.skipHiddenDays(start, direction); 10438 end = start.clone(); 10439 do { 10440 end.add(1, 'day'); 10441 if (!this._view.isHiddenDay(end)) { 10442 runningCount++; 10443 } 10444 } while (runningCount < dayCount); 10445 return new UnzonedRange_1.default(start, end); 10446 }; 10447 // Builds a normalized range object for the "visible" range, 10448 // which is a way to define the currentUnzonedRange and activeUnzonedRange at the same time. 10449 // TODO: accept a MS-time instead of a moment `date`? 10450 DateProfileGenerator.prototype.buildCustomVisibleRange = function (date) { 10451 var visibleUnzonedRange = this._view.getUnzonedRangeOption('visibleRange', this._view.calendar.applyTimezone(date) // correct zone. also generates new obj that avoids mutations 10452 ); 10453 if (visibleUnzonedRange && (visibleUnzonedRange.startMs == null || visibleUnzonedRange.endMs == null)) { 10454 return null; 10455 } 10456 return visibleUnzonedRange; 10457 }; 10458 // Computes the range that will represent the element/cells for *rendering*, 10459 // but which may have voided days/times. 10460 // not responsible for trimming hidden days. 10461 DateProfileGenerator.prototype.buildRenderRange = function (currentUnzonedRange, currentRangeUnit, isRangeAllDay) { 10462 return currentUnzonedRange.clone(); 10463 }; 10464 // Compute the duration value that should be added/substracted to the current date 10465 // when a prev/next operation happens. 10466 DateProfileGenerator.prototype.buildDateIncrement = function (fallback) { 10467 var dateIncrementInput = this.opt('dateIncrement'); 10468 var customAlignment; 10469 if (dateIncrementInput) { 10470 return moment.duration(dateIncrementInput); 10471 } 10472 else if ((customAlignment = this.opt('dateAlignment'))) { 10473 return moment.duration(1, customAlignment); 10474 } 10475 else if (fallback) { 10476 return fallback; 10477 } 10478 else { 10479 return moment.duration({ days: 1 }); 10480 } 10481 }; 10482 return DateProfileGenerator; 10483}()); 10484exports.default = DateProfileGenerator; 10485 10486 10487/***/ }), 10488/* 222 */ 10489/***/ (function(module, exports, __webpack_require__) { 10490 10491Object.defineProperty(exports, "__esModule", { value: true });
10492var tslib_1 = __webpack_require__(2); 10493var $ = __webpack_require__(3); 10494var moment = __webpack_require__(0); 10495var exportHooks = __webpack_require__(16); 10496var util_1 = __webpack_require__(4); 10497var moment_ext_1 = __webpack_require__(10); 10498var ListenerMixin_1 = __webpack_require__(7); 10499var HitDragListener_1 = __webpack_require__(23); 10500var SingleEventDef_1 = __webpack_require__(13); 10501var EventInstanceGroup_1 = __webpack_require__(18); 10502var EventSource_1 = __webpack_require__(6); 10503var Interaction_1 = __webpack_require__(15); 10504var ExternalDropping = /** @class */ (function (_super) { 10505 tslib_1.__extends(ExternalDropping, _super); 10506 function ExternalDropping() { 10507 var _this = _super !== null && _super.apply(this, arguments) || this; 10508 _this.isDragging = false; // jqui-dragging an external element? boolean 10509 return _this; 10510 } 10511 /* 10512 component impements: 10513 - eventRangesToEventFootprints 10514 - isEventInstanceGroupAllowed 10515 - isExternalInstanceGroupAllowed 10516 - renderDrag 10517 - unrenderDrag 10518 */ 10519 ExternalDropping.prototype.end = function () { 10520 if (this.dragListener) { 10521 this.dragListener.endInteraction(); 10522 } 10523 }; 10524 ExternalDropping.prototype.bindToDocument = function () { 10525 this.listenTo($(document), { 10526 dragstart: this.handleDragStart, 10527 sortstart: this.handleDragStart // jqui 10528 }); 10529 }; 10530 ExternalDropping.prototype.unbindFromDocument = function () { 10531 this.stopListeningTo($(document)); 10532 }; 10533 // Called when a jQuery UI drag is initiated anywhere in the DOM 10534 ExternalDropping.prototype.handleDragStart = function (ev, ui) { 10535 var el; 10536 var accept; 10537 if (this.opt('droppable')) { 10538 el = $((ui ? ui.item : null) || ev.target); 10539 // Test that the dragged element passes the dropAccept selector or filter function. 10540 // FYI, the default is "*" (matches all) 10541 accept = this.opt('dropAccept'); 10542 if ($.isFunction(accept) ? accept.call(el[0], el) : el.is(accept)) { 10543 if (!this.isDragging) { 10544 this.listenToExternalDrag(el, ev, ui); 10545 } 10546 } 10547 } 10548 }; 10549 // Called when a jQuery UI drag starts and it needs to be monitored for dropping 10550 ExternalDropping.prototype.listenToExternalDrag = function (el, ev, ui) { 10551 var _this = this; 10552 var component = this.component; 10553 var view = this.view; 10554 var meta = getDraggedElMeta(el); // extra data about event drop, including possible event to create 10555 var singleEventDef; // a null value signals an unsuccessful drag 10556 // listener that tracks mouse movement over date-associated pixel regions 10557 var dragListener = this.dragListener = new HitDragListener_1.default(component, { 10558 interactionStart: function () { 10559 _this.isDragging = true; 10560 }, 10561 hitOver: function (hit) { 10562 var isAllowed = true; 10563 var hitFootprint = hit.component.getSafeHitFootprint(hit); // hit might not belong to this grid 10564 var mutatedEventInstanceGroup; 10565 if (hitFootprint) { 10566 singleEventDef = _this.computeExternalDrop(hitFootprint, meta); 10567 if (singleEventDef) { 10568 mutatedEventInstanceGroup = new EventInstanceGroup_1.default(singleEventDef.buildInstances()); 10569 isAllowed = meta.eventProps ? // isEvent? 10570 component.isEventInstanceGroupAllowed(mutatedEventInstanceGroup) : 10571 component.isExternalInstanceGroupAllowed(mutatedEventInstanceGroup); 10572 } 10573 else { 10574 isAllowed = false; 10575 } 10576 } 10577 else { 10578 isAllowed = false; 10579 } 10580 if (!isAllowed) { 10581 singleEventDef = null;
10582 util_1.disableCursor(); 10583 } 10584 if (singleEventDef) { 10585 component.renderDrag(// called without a seg parameter 10586 component.eventRangesToEventFootprints(mutatedEventInstanceGroup.sliceRenderRanges(component.dateProfile.renderUnzonedRange, view.calendar))); 10587 } 10588 }, 10589 hitOut: function () { 10590 singleEventDef = null; // signal unsuccessful 10591 }, 10592 hitDone: function () { 10593 util_1.enableCursor(); 10594 component.unrenderDrag(); 10595 }, 10596 interactionEnd: function (ev) { 10597 if (singleEventDef) { 10598 view.reportExternalDrop(singleEventDef, Boolean(meta.eventProps), // isEvent 10599 Boolean(meta.stick), // isSticky 10600 el, ev, ui); 10601 } 10602 _this.isDragging = false; 10603 _this.dragListener = null; 10604 } 10605 }); 10606 dragListener.startDrag(ev); // start listening immediately 10607 }; 10608 // Given a hit to be dropped upon, and misc data associated with the jqui drag (guaranteed to be a plain object), 10609 // returns the zoned start/end dates for the event that would result from the hypothetical drop. end might be null. 10610 // Returning a null value signals an invalid drop hit. 10611 // DOES NOT consider overlap/constraint. 10612 // Assumes both footprints are non-open-ended. 10613 ExternalDropping.prototype.computeExternalDrop = function (componentFootprint, meta) { 10614 var calendar = this.view.calendar; 10615 var start = moment_ext_1.default.utc(componentFootprint.unzonedRange.startMs).stripZone(); 10616 var end; 10617 var eventDef; 10618 if (componentFootprint.isAllDay) { 10619 // if dropped on an all-day span, and element's metadata specified a time, set it 10620 if (meta.startTime) { 10621 start.time(meta.startTime); 10622 } 10623 else { 10624 start.stripTime(); 10625 } 10626 } 10627 if (meta.duration) { 10628 end = start.clone().add(meta.duration); 10629 } 10630 start = calendar.applyTimezone(start); 10631 if (end) { 10632 end = calendar.applyTimezone(end); 10633 } 10634 eventDef = SingleEventDef_1.default.parse($.extend({}, meta.eventProps, { 10635 start: start, 10636 end: end 10637 }), new EventSource_1.default(calendar)); 10638 return eventDef; 10639 }; 10640 return ExternalDropping; 10641}(Interaction_1.default)); 10642exports.default = ExternalDropping; 10643ListenerMixin_1.default.mixInto(ExternalDropping); 10644/* External-Dragging-Element Data 10645----------------------------------------------------------------------------------------------------------------------*/ 10646// Require all HTML5 data-* attributes used by FullCalendar to have this prefix. 10647// A value of '' will query attributes like data-event. A value of 'fc' will query attributes like data-fc-event. 10648exportHooks.dataAttrPrefix = ''; 10649// Given a jQuery element that might represent a dragged FullCalendar event, returns an intermediate data structure 10650// to be used for Event Object creation. 10651// A defined `.eventProps`, even when empty, indicates that an event should be created. 10652function getDraggedElMeta(el) { 10653 var prefix = exportHooks.dataAttrPrefix; 10654 var eventProps; // properties for creating the event, not related to date/time 10655 var startTime; // a Duration 10656 var duration; 10657 var stick; 10658 if (prefix) { 10659 prefix += '-'; 10660 } 10661 eventProps = el.data(prefix + 'event') || null; 10662 if (eventProps) { 10663 if (typeof eventProps === 'object') { 10664 eventProps = $.extend({}, eventProps); // make a copy 10665 } 10666 else { 10667 eventProps = {}; 10668 } 10669 // pluck special-cased date/time properties 10670 startTime = eventProps.start; 10671 if (startTime == null) { 10672 startTime = eventProps.time; 10673 } // accept 'time' as well 10674 duration = eventProps.duration; 10675 stick = eventProps.stick; 10676 delete eventProps.start; 10677 delete eventProps.time; 10678 delete eventProps.duration; 10679 delete eventProps.stick; 10680 } 10681 // fallback to standalone attribute values for each of the date/time properties 10682 if (startTime == null) { 10683 startTime = el.data(prefix + 'start'); 10684 } 10685 if (startTime == null) { 10686 startTime = el.data(prefix + 'time'); 10687 } // accept 'time' as well 10688 if (duration == null) { 10689 duration = el.data(prefix + 'duration'); 10690 } 10691 if (stick == null) { 10692 stick = el.data(prefix + 'stick'); 10693 } 10694 // massage into correct data types 10695 startTime = startTime != null ? moment.duration(startTime) : null; 10696 duration = duration != null ? moment.duration(duration) : null; 10697 stick = Boolean(stick); 10698 return { eventProps: eventProps, startTime: startTime, duration: duration, stick: stick }; 10699} 10700 10701 10702/***/ }), 10703/* 223 */ 10704/***/ (function(module, exports, __webpack_require__) { 10705 10706Object.defineProperty(exports, "__esModule", { value: true });
10707var tslib_1 = __webpack_require__(2); 10708var $ = __webpack_require__(3); 10709var util_1 = __webpack_require__(4); 10710var EventDefMutation_1 = __webpack_require__(37); 10711var EventDefDateMutation_1 = __webpack_require__(50); 10712var HitDragListener_1 = __webpack_require__(23); 10713var Interaction_1 = __webpack_require__(15); 10714var EventResizing = /** @class */ (function (_super) { 10715 tslib_1.__extends(EventResizing, _super); 10716 /* 10717 component impements: 10718 - bindSegHandlerToEl 10719 - publiclyTrigger 10720 - diffDates 10721 - eventRangesToEventFootprints 10722 - isEventInstanceGroupAllowed 10723 - getSafeHitFootprint 10724 */ 10725 function EventResizing(component, eventPointing) { 10726 var _this = _super.call(this, component) || this; 10727 _this.isResizing = false; 10728 _this.eventPointing = eventPointing; 10729 return _this; 10730 } 10731 EventResizing.prototype.end = function () { 10732 if (this.dragListener) { 10733 this.dragListener.endInteraction(); 10734 } 10735 }; 10736 EventResizing.prototype.bindToEl = function (el) { 10737 var component = this.component; 10738 component.bindSegHandlerToEl(el, 'mousedown', this.handleMouseDown.bind(this)); 10739 component.bindSegHandlerToEl(el, 'touchstart', this.handleTouchStart.bind(this)); 10740 }; 10741 EventResizing.prototype.handleMouseDown = function (seg, ev) { 10742 if (this.component.canStartResize(seg, ev)) { 10743 this.buildDragListener(seg, $(ev.target).is('.fc-start-resizer')) 10744 .startInteraction(ev, { distance: 5 }); 10745 } 10746 }; 10747 EventResizing.prototype.handleTouchStart = function (seg, ev) { 10748 if (this.component.canStartResize(seg, ev)) { 10749 this.buildDragListener(seg, $(ev.target).is('.fc-start-resizer')) 10750 .startInteraction(ev); 10751 } 10752 }; 10753 // Creates a listener that tracks the user as they resize an event segment. 10754 // Generic enough to work with any type of Grid. 10755 EventResizing.prototype.buildDragListener = function (seg, isStart) { 10756 var _this = this; 10757 var component = this.component; 10758 var view = this.view; 10759 var calendar = view.calendar; 10760 var eventManager = calendar.eventManager; 10761 var el = seg.el; 10762 var eventDef = seg.footprint.eventDef; 10763 var eventInstance = seg.footprint.eventInstance; 10764 var isDragging; 10765 var resizeMutation; // zoned event date properties. falsy if invalid resize 10766 // Tracks mouse movement over the *grid's* coordinate map 10767 var dragListener = this.dragListener = new HitDragListener_1.default(component, { 10768 scroll: this.opt('dragScroll'), 10769 subjectEl: el, 10770 interactionStart: function () { 10771 isDragging = false; 10772 }, 10773 dragStart: function (ev) { 10774 isDragging = true; 10775 // ensure a mouseout on the manipulated event has been reported 10776 _this.eventPointing.handleMouseout(seg, ev); 10777 _this.segResizeStart(seg, ev); 10778 }, 10779 hitOver: function (hit, isOrig, origHit) { 10780 var isAllowed = true; 10781 var origHitFootprint = component.getSafeHitFootprint(origHit); 10782 var hitFootprint = component.getSafeHitFootprint(hit); 10783 var mutatedEventInstanceGroup; 10784 if (origHitFootprint && hitFootprint) { 10785 resizeMutation = isStart ? 10786 _this.computeEventStartResizeMutation(origHitFootprint, hitFootprint, seg.footprint) : 10787 _this.computeEventEndResizeMutation(origHitFootprint, hitFootprint, seg.footprint); 10788 if (resizeMutation) { 10789 mutatedEventInstanceGroup = eventManager.buildMutatedEventInstanceGroup(eventDef.id, resizeMutation); 10790 isAllowed = component.isEventInstanceGroupAllowed(mutatedEventInstanceGroup); 10791 } 10792 else { 10793 isAllowed = false; 10794 } 10795 } 10796 else { 10797 isAllowed = false; 10798 } 10799 if (!isAllowed) { 10800 resizeMutation = null;
10801 util_1.disableCursor(); 10802 } 10803 else if (resizeMutation.isEmpty()) { 10804 // no change. (FYI, event dates might have zones) 10805 resizeMutation = null; 10806 } 10807 if (resizeMutation) { 10808 view.hideEventsWithId(seg.footprint.eventDef.id); 10809 view.renderEventResize(component.eventRangesToEventFootprints(mutatedEventInstanceGroup.sliceRenderRanges(component.dateProfile.renderUnzonedRange, calendar)), seg); 10810 } 10811 }, 10812 hitOut: function () { 10813 resizeMutation = null; 10814 }, 10815 hitDone: function () { 10816 view.unrenderEventResize(seg); 10817 view.showEventsWithId(seg.footprint.eventDef.id); 10818 util_1.enableCursor(); 10819 }, 10820 interactionEnd: function (ev) { 10821 if (isDragging) { 10822 _this.segResizeStop(seg, ev); 10823 } 10824 if (resizeMutation) { 10825 // no need to re-show original, will rerender all anyways. esp important if eventRenderWait 10826 view.reportEventResize(eventInstance, resizeMutation, el, ev); 10827 } 10828 _this.dragListener = null; 10829 } 10830 }); 10831 return dragListener; 10832 }; 10833 // Called before event segment resizing starts 10834 EventResizing.prototype.segResizeStart = function (seg, ev) { 10835 this.isResizing = true; 10836 this.component.publiclyTrigger('eventResizeStart', { 10837 context: seg.el[0], 10838 args: [ 10839 seg.footprint.getEventLegacy(), 10840 ev, 10841 {}, 10842 this.view 10843 ] 10844 }); 10845 }; 10846 // Called after event segment resizing stops 10847 EventResizing.prototype.segResizeStop = function (seg, ev) { 10848 this.isResizing = false; 10849 this.component.publiclyTrigger('eventResizeStop', { 10850 context: seg.el[0], 10851 args: [ 10852 seg.footprint.getEventLegacy(), 10853 ev, 10854 {}, 10855 this.view 10856 ] 10857 }); 10858 }; 10859 // Returns new date-information for an event segment being resized from its start 10860 EventResizing.prototype.computeEventStartResizeMutation = function (startFootprint, endFootprint, origEventFootprint) { 10861 var origRange = origEventFootprint.componentFootprint.unzonedRange; 10862 var startDelta = this.component.diffDates(endFootprint.unzonedRange.getStart(), startFootprint.unzonedRange.getStart()); 10863 var dateMutation; 10864 var eventDefMutation; 10865 if (origRange.getStart().add(startDelta) < origRange.getEnd()) { 10866 dateMutation = new EventDefDateMutation_1.default(); 10867 dateMutation.setStartDelta(startDelta); 10868 eventDefMutation = new EventDefMutation_1.default(); 10869 eventDefMutation.setDateMutation(dateMutation); 10870 return eventDefMutation; 10871 } 10872 return false; 10873 }; 10874 // Returns new date-information for an event segment being resized from its end 10875 EventResizing.prototype.computeEventEndResizeMutation = function (startFootprint, endFootprint, origEventFootprint) { 10876 var origRange = origEventFootprint.componentFootprint.unzonedRange; 10877 var endDelta = this.component.diffDates(endFootprint.unzonedRange.getEnd(), startFootprint.unzonedRange.getEnd()); 10878 var dateMutation; 10879 var eventDefMutation; 10880 if (origRange.getEnd().add(endDelta) > origRange.getStart()) { 10881 dateMutation = new EventDefDateMutation_1.default(); 10882 dateMutation.setEndDelta(endDelta); 10883 eventDefMutation = new EventDefMutation_1.default(); 10884 eventDefMutation.setDateMutation(dateMutation); 10885 return eventDefMutation; 10886 } 10887 return false; 10888 }; 10889 return EventResizing; 10890}(Interaction_1.default)); 10891exports.default = EventResizing; 10892 10893 10894/***/ }), 10895/* 224 */ 10896/***/ (function(module, exports, __webpack_require__) { 10897 10898Object.defineProperty(exports, "__esModule", { value: true });
10899var tslib_1 = __webpack_require__(2); 10900var util_1 = __webpack_require__(4); 10901var EventDefMutation_1 = __webpack_require__(37); 10902var EventDefDateMutation_1 = __webpack_require__(50); 10903var DragListener_1 = __webpack_require__(54); 10904var HitDragListener_1 = __webpack_require__(23); 10905var MouseFollower_1 = __webpack_require__(244); 10906var Interaction_1 = __webpack_require__(15); 10907var EventDragging = /** @class */ (function (_super) { 10908 tslib_1.__extends(EventDragging, _super); 10909 /* 10910 component implements: 10911 - bindSegHandlerToEl 10912 - publiclyTrigger 10913 - diffDates 10914 - eventRangesToEventFootprints 10915 - isEventInstanceGroupAllowed 10916 */ 10917 function EventDragging(component, eventPointing) { 10918 var _this = _super.call(this, component) || this; 10919 _this.isDragging = false; 10920 _this.eventPointing = eventPointing; 10921 return _this; 10922 } 10923 EventDragging.prototype.end = function () { 10924 if (this.dragListener) { 10925 this.dragListener.endInteraction(); 10926 } 10927 }; 10928 EventDragging.prototype.getSelectionDelay = function () { 10929 var delay = this.opt('eventLongPressDelay'); 10930 if (delay == null) { 10931 delay = this.opt('longPressDelay'); // fallback 10932 } 10933 return delay; 10934 }; 10935 EventDragging.prototype.bindToEl = function (el) { 10936 var component = this.component; 10937 component.bindSegHandlerToEl(el, 'mousedown', this.handleMousedown.bind(this)); 10938 component.bindSegHandlerToEl(el, 'touchstart', this.handleTouchStart.bind(this)); 10939 }; 10940 EventDragging.prototype.handleMousedown = function (seg, ev) { 10941 if (!this.component.shouldIgnoreMouse() && 10942 this.component.canStartDrag(seg, ev)) { 10943 this.buildDragListener(seg).startInteraction(ev, { distance: 5 }); 10944 } 10945 }; 10946 EventDragging.prototype.handleTouchStart = function (seg, ev) { 10947 var component = this.component; 10948 var settings = { 10949 delay: this.view.isEventDefSelected(seg.footprint.eventDef) ? // already selected? 10950 0 : this.getSelectionDelay() 10951 }; 10952 if (component.canStartDrag(seg, ev)) { 10953 this.buildDragListener(seg).startInteraction(ev, settings); 10954 } 10955 else if (component.canStartSelection(seg, ev)) { 10956 this.buildSelectListener(seg).startInteraction(ev, settings); 10957 } 10958 }; 10959 // seg isn't draggable, but let's use a generic DragListener 10960 // simply for the delay, so it can be selected. 10961 // Has side effect of setting/unsetting `dragListener` 10962 EventDragging.prototype.buildSelectListener = function (seg) { 10963 var _this = this; 10964 var view = this.view; 10965 var eventDef = seg.footprint.eventDef; 10966 var eventInstance = seg.footprint.eventInstance; // null for inverse-background events 10967 if (this.dragListener) { 10968 return this.dragListener; 10969 } 10970 var dragListener = this.dragListener = new DragListener_1.default({ 10971 dragStart: function (ev) { 10972 if (dragListener.isTouch && 10973 !view.isEventDefSelected(eventDef) && 10974 eventInstance) { 10975 // if not previously selected, will fire after a delay. then, select the event 10976 view.selectEventInstance(eventInstance); 10977 } 10978 }, 10979 interactionEnd: function (ev) { 10980 _this.dragListener = null; 10981 } 10982 }); 10983 return dragListener; 10984 }; 10985 // Builds a listener that will track user-dragging on an event segment. 10986 // Generic enough to work with any type of Grid. 10987 // Has side effect of setting/unsetting `dragListener` 10988 EventDragging.prototype.buildDragListener = function (seg) { 10989 var _this = this; 10990 var component = this.component; 10991 var view = this.view; 10992 var calendar = view.calendar; 10993 var eventManager = calendar.eventManager; 10994 var el = seg.el; 10995 var eventDef = seg.footprint.eventDef; 10996 var eventInstance = seg.footprint.eventInstance; // null for inverse-background events 10997 var isDragging; 10998 var mouseFollower; // A clone of the original element that will move with the mouse 10999 var eventDefMutation; 11000 if (this.dragListener) { 11001 return this.dragListener; 11002 } 11003 // Tracks mouse movement over the *view's* coordinate map. Allows dragging and dropping between subcomponents 11004 // of the view. 11005 var dragListener = this.dragListener = new HitDragListener_1.default(view, { 11006 scroll: this.opt('dragScroll'), 11007 subjectEl: el, 11008 subjectCenter: true, 11009 interactionStart: function (ev) { 11010 seg.component = component; // for renderDrag 11011 isDragging = false; 11012 mouseFollower = new MouseFollower_1.default(seg.el, { 11013 additionalClass: 'fc-dragging', 11014 parentEl: view.el, 11015 opacity: dragListener.isTouch ? null : _this.opt('dragOpacity'), 11016 revertDuration: _this.opt('dragRevertDuration'), 11017 zIndex: 2 // one above the .fc-view 11018 }); 11019 mouseFollower.hide(); // don't show until we know this is a real drag 11020 mouseFollower.start(ev); 11021 }, 11022 dragStart: function (ev) { 11023 if (dragListener.isTouch && 11024 !view.isEventDefSelected(eventDef) && 11025 eventInstance) { 11026 // if not previously selected, will fire after a delay. then, select the event 11027 view.selectEventInstance(eventInstance); 11028 } 11029 isDragging = true; 11030 // ensure a mouseout on the manipulated event has been reported 11031 _this.eventPointing.handleMouseout(seg, ev); 11032 _this.segDragStart(seg, ev); 11033 view.hideEventsWithId(seg.footprint.eventDef.id); 11034 }, 11035 hitOver: function (hit, isOrig, origHit) { 11036 var isAllowed = true; 11037 var origFootprint; 11038 var footprint; 11039 var mutatedEventInstanceGroup; 11040 // starting hit could be forced (DayGrid.limit) 11041 if (seg.hit) { 11042 origHit = seg.hit; 11043 } 11044 // hit might not belong to this grid, so query origin grid 11045 origFootprint = origHit.component.getSafeHitFootprint(
11045origHit); 11046 footprint = hit.component.getSafeHitFootprint(hit); 11047 if (origFootprint && footprint) { 11048 eventDefMutation = _this.computeEventDropMutation(origFootprint, footprint, eventDef); 11049 if (eventDefMutation) { 11050 mutatedEventInstanceGroup = eventManager.buildMutatedEventInstanceGroup(eventDef.id, eventDefMutation); 11051 isAllowed = component.isEventInstanceGroupAllowed(mutatedEventInstanceGroup); 11052 } 11053 else { 11054 isAllowed = false; 11055 } 11056 } 11057 else { 11058 isAllowed = false; 11059 } 11060 if (!isAllowed) { 11061 eventDefMutation = null; 11062 util_1.disableCursor(); 11063 } 11064 // if a valid drop location, have the subclass render a visual indication 11065 if (eventDefMutation && 11066 view.renderDrag(// truthy if rendered something 11067 component.eventRangesToEventFootprints(mutatedEventInstanceGroup.sliceRenderRanges(component.dateProfile.renderUnzonedRange, calendar)), seg, dragListener.isTouch)) { 11068 mouseFollower.hide(); // if the subclass is already using a mock event "helper", hide our own 11069 } 11070 else { 11071 mouseFollower.show(); // otherwise, have the helper follow the mouse (no snapping) 11072 } 11073 if (isOrig) { 11074 // needs to have moved hits to be a valid drop 11075 eventDefMutation = null; 11076 } 11077 }, 11078 hitOut: function () { 11079 view.unrenderDrag(seg); // unrender whatever was done in renderDrag 11080 mouseFollower.show(); // show in case we are moving out of all hits 11081 eventDefMutation = null; 11082 }, 11083 hitDone: function () { 11084 util_1.enableCursor(); 11085 }, 11086 interactionEnd: function (ev) { 11087 delete seg.component; // prevent side effects 11088 // do revert animation if hasn't changed. calls a callback when finished (whether animation or not) 11089 mouseFollower.stop(!eventDefMutation, function () { 11090 if (isDragging) { 11091 view.unrenderDrag(seg); 11092 _this.segDragStop(seg, ev); 11093 } 11094 view.showEventsWithId(seg.footprint.eventDef.id); 11095 if (eventDefMutation) { 11096 // no need to re-show original, will rerender all anyways. esp important if eventRenderWait 11097 view.reportEventDrop(eventInstance, eventDefMutation, el, ev); 11098 } 11099 }); 11100 _this.dragListener = null; 11101 } 11102 }); 11103 return dragListener; 11104 }; 11105 // Called before event segment dragging starts 11106 EventDragging.prototype.segDragStart = function (seg, ev) { 11107 this.isDragging = true; 11108 this.component.publiclyTrigger('eventDragStart', { 11109 context: seg.el[0], 11110 args: [ 11111 seg.footprint.getEventLegacy(), 11112 ev, 11113 {}, 11114 this.view 11115 ] 11116 }); 11117 }; 11118 // Called after event segment dragging stops 11119 EventDragging.prototype.segDragStop = function (seg, ev) { 11120 this.isDragging = false; 11121 this.component.publiclyTrigger('eventDragStop', { 11122 context: seg.el[0], 11123 args: [ 11124 seg.footprint.getEventLegacy(), 11125 ev, 11126 {}, 11127 this.view 11128 ] 11129 }); 11130 }; 11131 // DOES NOT consider overlap/constraint 11132 EventDragging.prototype.computeEventDropMutation = function (startFootprint, endFootprint, eventDef) { 11133 var eventDefMutation = new EventDefMutation_1.default(); 11134 eventDefMutation.setDateMutation(this.computeEventDateMutation(startFootprint, endFootprint)); 11135 return eventDefMutation; 11136 }; 11137 EventDragging.prototype.computeEventDateMutation = function (startFootprint, endFootprint) { 11138 var date0 = startFootprint.unzonedRange.getStart(); 11139 var date1 = endFootprint.unzonedRange.getStart(); 11140 var clearEnd = false; 11141 var forceTimed = false; 11142 var forceAllDay = false; 11143 var dateDelta; 11144 var dateMutation; 11145 if (startFootprint.isAllDay !== endFootprint.isAllDay) { 11146 clearEnd = true; 11147 if (endFootprint.isAllDay) { 11148 forceAllDay = true; 11149 date0.stripTime(); 11150 } 11151 else { 11152 forceTimed = true; 11153 } 11154 } 11155 dateDelta = this.component.diffDates(date1, date0); 11156 dateMutation = new EventDefDateMutation_1.default(); 11157 dateMutation.clearEnd = clearEnd; 11158 dateMutation.forceTimed = forceTimed; 11159 dateMutation.forceAllDay = forceAllDay; 11160 dateMutation.setDateDelta(dateDelta); 11161 return dateMutation; 11162 }; 11163 return EventDragging; 11164}(Interaction_1.default)); 11165exports.default = EventDragging; 11166 11167 11168/***/ }), 11169/* 225 */ 11170/***/ (function(module, exports, __webpack_require__) { 11171 11172Object.defineProperty(exports, "__esModule", { value: true });
11173var tslib_1 = __webpack_require__(2); 11174var util_1 = __webpack_require__(4); 11175var HitDragListener_1 = __webpack_require__(23); 11176var ComponentFootprint_1 = __webpack_require__(12); 11177var UnzonedRange_1 = __webpack_require__(5); 11178var Interaction_1 = __webpack_require__(15); 11179var DateSelecting = /** @class */ (function (_super) { 11180 tslib_1.__extends(DateSelecting, _super); 11181 /* 11182 component must implement: 11183 - bindDateHandlerToEl 11184 - getSafeHitFootprint 11185 - renderHighlight 11186 - unrenderHighlight 11187 */ 11188 function DateSelecting(component) { 11189 var _this = _super.call(this, component) || this; 11190 _this.dragListener = _this.buildDragListener(); 11191 return _this; 11192 } 11193 DateSelecting.prototype.end = function () { 11194 this.dragListener.endInteraction(); 11195 }; 11196 DateSelecting.prototype.getDelay = function () { 11197 var delay = this.opt('selectLongPressDelay'); 11198 if (delay == null) { 11199 delay = this.opt('longPressDelay'); // fallback 11200 } 11201 return delay; 11202 }; 11203 DateSelecting.prototype.bindToEl = function (el) { 11204 var _this = this; 11205 var component = this.component; 11206 var dragListener = this.dragListener; 11207 component.bindDateHandlerToEl(el, 'mousedown', function (ev) { 11208 if (_this.opt('selectable') && !component.shouldIgnoreMouse()) { 11209 dragListener.startInteraction(ev, { 11210 distance: _this.opt('selectMinDistance') 11211 }); 11212 } 11213 }); 11214 component.bindDateHandlerToEl(el, 'touchstart', function (ev) { 11215 if (_this.opt('selectable') && !component.shouldIgnoreTouch()) { 11216 dragListener.startInteraction(ev, { 11217 delay: _this.getDelay() 11218 }); 11219 } 11220 }); 11221 util_1.preventSelection(el); 11222 }; 11223 // Creates a listener that tracks the user's drag across day elements, for day selecting. 11224 DateSelecting.prototype.buildDragListener = function () { 11225 var _this = this; 11226 var component = this.component; 11227 var selectionFootprint; // null if invalid selection 11228 var dragListener = new HitDragListener_1.default(component, { 11229 scroll: this.opt('dragScroll'), 11230 interactionStart: function () { 11231 selectionFootprint = null; 11232 }, 11233 dragStart: function (ev) { 11234 _this.view.unselect(ev); // since we could be rendering a new selection, we want to clear any old one 11235 }, 11236 hitOver: function (hit, isOrig, origHit) { 11237 var origHitFootprint; 11238 var hitFootprint; 11239 if (origHit) { 11240 origHitFootprint = component.getSafeHitFootprint(origHit); 11241 hitFootprint = component.getSafeHitFootprint(hit); 11242 if (origHitFootprint && hitFootprint) { 11243 selectionFootprint = _this.computeSelection(origHitFootprint, hitFootprint); 11244 } 11245 else { 11246 selectionFootprint = null; 11247 } 11248 if (selectionFootprint) { 11249 component.renderSelectionFootprint(selectionFootprint); 11250 } 11251 else if (selectionFootprint === false) { 11252 util_1.disableCursor(); 11253 } 11254 } 11255 }, 11256 hitOut: function () { 11257 selectionFootprint = null; 11258 component.unrenderSelection(); 11259 }, 11260 hitDone: function () { 11261 util_1.enableCursor(); 11262 }, 11263 interactionEnd: function (ev, isCancelled) { 11264 if (!isCancelled && selectionFootprint) { 11265 // the selection will already have been rendered. just report it 11266 _this.view.reportSelection(selectionFootprint, ev); 11267 } 11268 } 11269 }); 11270 return dragListener; 11271 }; 11272 // Given the first and last date-spans of a selection, returns another date-span object. 11273 // Subclasses can override and provide additional data in the span object. Will be passed to render
11273SelectionFootprint(). 11274 // Will return false if the selection is invalid and this should be indicated to the user. 11275 // Will return null/undefined if a selection invalid but no error should be reported. 11276 DateSelecting.prototype.computeSelection = function (footprint0, footprint1) { 11277 var wholeFootprint = this.computeSelectionFootprint(footprint0, footprint1); 11278 if (wholeFootprint && !this.isSelectionFootprintAllowed(wholeFootprint)) { 11279 return false; 11280 } 11281 return wholeFootprint; 11282 }; 11283 // Given two spans, must return the combination of the two. 11284 // TODO: do this separation of concerns (combining VS validation) for event dnd/resize too. 11285 // Assumes both footprints are non-open-ended. 11286 DateSelecting.prototype.computeSelectionFootprint = function (footprint0, footprint1) { 11287 var ms = [ 11288 footprint0.unzonedRange.startMs, 11289 footprint0.unzonedRange.endMs, 11290 footprint1.unzonedRange.startMs, 11291 footprint1.unzonedRange.endMs 11292 ]; 11293 ms.sort(util_1.compareNumbers); 11294 return new ComponentFootprint_1.default(new UnzonedRange_1.default(ms[0], ms[3]), footprint0.isAllDay); 11295 }; 11296 DateSelecting.prototype.isSelectionFootprintAllowed = function (componentFootprint) { 11297 return this.component.dateProfile.validUnzonedRange.containsRange(componentFootprint.unzonedRange) && 11298 this.view.calendar.constraints.isSelectionFootprintAllowed(componentFootprint); 11299 }; 11300 return DateSelecting; 11301}(Interaction_1.default)); 11302exports.default = DateSelecting; 11303 11304 11305/***/ }), 11306/* 226 */ 11307/***/ (function(module, exports, __webpack_require__) { 11308 11309Object.defineProperty(exports, "__esModule", { value: true }); 11310var tslib_1 = __webpack_require__(2); 11311var moment = __webpack_require__(0); 11312var $ = __webpack_require__(3); 11313var util_1 = __webpack_require__(4); 11314var Scroller_1 = __webpack_require__(39); 11315var View_1 = __webpack_require__(41); 11316var TimeGrid_1 = __webpack_require__(227); 11317var DayGrid_1 = __webpack_require__(61); 11318var AGENDA_ALL_DAY_EVENT_LIMIT = 5; 11319var agendaTimeGridMethods; 11320var agendaDayGridMethods; 11321/* An abstract class for all agenda-related views. Displays one more columns with time slots running vertically. 11322----------------------------------------------------------------------------------------------------------------------*/ 11323// Is a manager for the TimeGrid subcomponent and possibly the DayGrid subcomponent (if allDaySlot is on). 11324// Responsible for managing width/height. 11325var AgendaView = /** @class */ (function (_super) { 11326 tslib_1.__extends(AgendaView, _super); 11327 function AgendaView(calendar, viewSpec) { 11328 var _this = _super.call(this, calendar, viewSpec) || this; 11329 _this.usesMinMaxTime = true; // indicates that minTime/maxTime affects rendering 11330 _this.timeGrid = _this.instantiateTimeGrid(); 11331 _this.addChild(_this.timeGrid); 11332 if (_this.opt('allDaySlot')) { 11333 _this.dayGrid = _this.instantiateDayGrid(); // the all-day subcomponent of this view 11334 _this.addChild(_this.dayGrid); 11335 } 11336 _this.scroller = new Scroller_1.default({ 11337 overflowX: 'hidden', 11338 overflowY: 'auto' 11339 }); 11340 return _this; 11341 } 11342 // Instantiates the TimeGrid object this view needs. Draws from this.timeGridClass 11343 AgendaView.prototype.instantiateTimeGrid = function () { 11344 var timeGrid = new this.timeGridClass(this); 11345 util_1.copyOwnProps(agendaTimeGridMethods, timeGrid); 11346 return timeGrid; 11347 }; 11348 // Instantiates the DayGrid object this view might need. Draws from this.dayGridClass 11349 AgendaView.prototype.instantiateDayGrid = function () { 11350 var dayGrid = new this.dayGridClass(this); 11351 util_1.copyOwnProps(agendaDayGridMethods, dayGrid); 11352 return dayGrid; 11353 }; 11354 /* Rendering 11355 ------------------------------------------------------------------------------------------------------------------*/ 11356 AgendaView.prototype.renderSkeleton = function () { 11357 var timeGridWrapEl; 11358 var timeGridEl; 11359 this.el.addClass('fc-agenda-view').html(this.renderSkeletonHtml()); 11360 this.scroller.render(); 11361 timeGridWrapEl = this.scroller.el.addClass('fc-time-grid-container');
11362 timeGridEl = $('<div class="fc-time-grid" />').appendTo(timeGridWrapEl); 11363 this.el.find('.fc-body > tr > td').append(timeGridWrapEl); 11364 this.timeGrid.headContainerEl = this.el.find('.fc-head-container'); 11365 this.timeGrid.setElement(timeGridEl); 11366 if (this.dayGrid) { 11367 this.dayGrid.setElement(this.el.find('.fc-day-grid')); 11368 // have the day-grid extend it's coordinate area over the <hr> dividing the two grids 11369 this.dayGrid.bottomCoordPadding = this.dayGrid.el.next('hr').outerHeight(); 11370 } 11371 }; 11372 AgendaView.prototype.unrenderSkeleton = function () { 11373 this.timeGrid.removeElement(); 11374 if (this.dayGrid) { 11375 this.dayGrid.removeElement(); 11376 } 11377 this.scroller.destroy(); 11378 }; 11379 // Builds the HTML skeleton for the view. 11380 // The day-grid and time-grid components will render inside containers defined by this HTML. 11381 AgendaView.prototype.renderSkeletonHtml = function () { 11382 var theme = this.calendar.theme; 11383 return '' + 11384 '<table class="' + theme.getClass('tableGrid') + '">' + 11385 (this.opt('columnHeader') ? 11386 '<thead class="fc-head">' + 11387 '<tr>' + 11388 '<td class="fc-head-container ' + theme.getClass('widgetHeader') + '"> </td>' + 11389 '</tr>' + 11390 '</thead>' : 11391 '') + 11392 '<tbody class="fc-body">' + 11393 '<tr>' + 11394 '<td class="' + theme.getClass('widgetContent') + '">' + 11395 (this.dayGrid ? 11396 '<div class="fc-day-grid"/>' + 11397 '<hr class="fc-divider ' + theme.getClass('widgetHeader') + '"/>' : 11398 '') + 11399 '</td>' + 11400 '</tr>' + 11401 '</tbody>' + 11402 '</table>'; 11403 }; 11404 // Generates an HTML attribute string for setting the width of the axis, if it is known 11405 AgendaView.prototype.axisStyleAttr = function () { 11406 if (this.axisWidth != null) { 11407 return 'style="width:' + this.axisWidth + 'px"'; 11408 } 11409 return ''; 11410 }; 11411 /* Now Indicator 11412 ------------------------------------------------------------------------------------------------------------------*/ 11413 AgendaView.prototype.getNowIndicatorUnit = function () { 11414 return this.timeGrid.getNowIndicatorUnit(); 11415 }; 11416 /* Dimensions 11417 ------------------------------------------------------------------------------------------------------------------*/ 11418 // Adjusts the vertical dimensions of the view to the specified values 11419 AgendaView.prototype.updateSize = function (totalHeight, isAuto, isResize) { 11420 var eventLimit; 11421 var scrollerHeight; 11422 var scrollbarWidths; 11423 _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize); 11424 // make all axis cells line up, and record the width so newly created axis cells will have it 11425 this.axisWidth = util_1.matchCellWidths(this.el.find('.fc-axis')); 11426 // hack to give the view some height prior to timeGrid's columns being rendered 11427 // TODO: separate setting height from scroller VS timeGrid. 11428 if (!this.timeGrid.colEls) { 11429 if (!isAuto) { 11430 scrollerHeight = this.computeScrollerHeight(totalHeight); 11431 this.scroller.setHeight(scrollerHeight); 11432 } 11433 return; 11434 } 11435 // set of fake row elements that must compensate when scroller has scrollbars 11436 var noScrollRowEls = this.el.find('.fc-row:not(.fc-scroller *)'); 11437 // reset all dimensions back to the original state 11438 this.timeGrid.bottomRuleEl.hide(); // .show() will be called later if this <hr> is necessary 11439 this.scroller.clear(); // sets height to 'auto' and clears overflow 11440 util_1.uncompensateScroll(noScrollRowEls); 11441 // limit number of events in the all-day area 11442 if (this.dayGrid) { 11443 this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed 11444 eventLimit = this.opt('eventLimit'); 11445 if (eventLimit && typeof eventLimit !== 'number') { 11446 eventLimit = AGENDA_ALL_DAY_EVENT_LIMIT; // make sure "auto" goes to a real number 11447 } 11448 if (eventLimit) { 11449 this.dayGrid.limitRows(eventLimit); 11450 } 11451 } 11452 if (!isAuto) { 11453 scrollerHeight = this.computeScrollerHeight(totalHeight); 11454 this.scroller.setHeight(scrollerHeight);
11455 scrollbarWidths = this.scroller.getScrollbarWidths(); 11456 if (scrollbarWidths.left || scrollbarWidths.right) { 11457 // make the all-day and header rows lines up 11458 util_1.compensateScroll(noScrollRowEls, scrollbarWidths); 11459 // the scrollbar compensation might have changed text flow, which might affect height, so recalculate 11460 // and reapply the desired height to the scroller. 11461 scrollerHeight = this.computeScrollerHeight(totalHeight); 11462 this.scroller.setHeight(scrollerHeight); 11463 } 11464 // guarantees the same scrollbar widths 11465 this.scroller.lockOverflow(scrollbarWidths); 11466 // if there's any space below the slats, show the horizontal rule. 11467 // this won't cause any new overflow, because lockOverflow already called. 11468 if (this.timeGrid.getTotalSlatHeight() < scrollerHeight) { 11469 this.timeGrid.bottomRuleEl.show(); 11470 } 11471 } 11472 }; 11473 // given a desired total height of the view, returns what the height of the scroller should be 11474 AgendaView.prototype.computeScrollerHeight = function (totalHeight) { 11475 return totalHeight - 11476 util_1.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller 11477 }; 11478 /* Scroll 11479 ------------------------------------------------------------------------------------------------------------------*/ 11480 // Computes the initial pre-configured scroll state prior to allowing the user to change it 11481 AgendaView.prototype.computeInitialDateScroll = function () { 11482 var scrollTime = moment.duration(this.opt('scrollTime')); 11483 var top = this.timeGrid.computeTimeTop(scrollTime); 11484 // zoom can give weird floating-point values. rather scroll a little bit further 11485 top = Math.ceil(top); 11486 if (top) { 11487 top++; // to overcome top border that slots beyond the first have. looks better 11488 } 11489 return { top: top }; 11490 }; 11491 AgendaView.prototype.queryDateScroll = function () { 11492 return { top: this.scroller.getScrollTop() }; 11493 }; 11494 AgendaView.prototype.applyDateScroll = function (scroll) { 11495 if (scroll.top !== undefined) { 11496 this.scroller.setScrollTop(scroll.top); 11497 } 11498 }; 11499 /* Hit Areas 11500 ------------------------------------------------------------------------------------------------------------------*/ 11501 // forward all hit-related method calls to the grids (dayGrid might not be defined) 11502 AgendaView.prototype.getHitFootprint = function (hit) { 11503 // TODO: hit.component is set as a hack to identify where the hit came from 11504 return hit.component.getHitFootprint(hit); 11505 }; 11506 AgendaView.prototype.getHitEl = function (hit) { 11507 // TODO: hit.component is set as a hack to identify where the hit came from 11508 return hit.component.getHitEl(hit); 11509 }; 11510 /* Event Rendering 11511 ------------------------------------------------------------------------------------------------------------------*/ 11512 AgendaView.prototype.executeEventRender = function (eventsPayload) { 11513 var dayEventsPayload = {}; 11514 var timedEventsPayload = {}; 11515 var id; 11516 var eventInstanceGroup; 11517 // separate the events into all-day and timed 11518 for (id in eventsPayload) { 11519 eventInstanceGroup = eventsPayload[id]; 11520 if (eventInstanceGroup.getEventDef().isAllDay()) { 11521 dayEventsPayload[id] = eventInstanceGroup; 11522 } 11523 else { 11524 timedEventsPayload[id] = eventInstanceGroup; 11525 } 11526 } 11527 this.timeGrid.executeEventRender(timedEventsPayload); 11528 if (this.dayGrid) { 11529 this.dayGrid.executeEventRender(dayEventsPayload); 11530 } 11531 }; 11532 /* Dragging/Resizing Routing 11533 ------------------------------------------------------------------------------------------------------------------*/ 11534 // A returned value of `true` signals that a mock "helper" event has been rendered. 11535 AgendaView.prototype.renderDrag = function (eventFootprints, seg, isTouch) { 11536 var groups = groupEventFootprintsByAllDay(eventFootprints); 11537 var renderedHelper = false; 11538 renderedHelper = this.timeGrid.renderDrag(groups.timed, seg, isTouch); 11539 if (this.dayGrid) { 11540 renderedHelper = this.dayGrid.renderDrag(groups.allDay, seg, isTouch) || renderedHelper; 11541 } 11542 return renderedHelper; 11543 }; 11544 AgendaView.prototype.renderEventResize = function (eventFootprints, seg, isTouch) { 11545 var groups = groupEventFootprintsByAllDay(eventFootprints); 11546 this.timeGrid.renderEventResize(groups.timed, seg, isTouch); 11547 if (this.dayGrid) { 11548 this.dayGrid.renderEventResize(groups.allDay, seg, isTouch); 11549 } 11550 }; 11551 /* Selection 11552 ------------------------------------------------------------------------------------------------------------------*/ 11553 // Renders a visual indication of a selection 11554 AgendaView.prototype.renderSelectionFootprint = function (componentFootprint) { 11555 if (!componentFootprint.isAllDay) { 11556 this.timeGrid.renderSelectionFootprint(componentFootprint); 11557 } 11558 else if (this.dayGrid) { 11559 this.dayGrid.renderSelectionFootprint(componentFootprint); 11560 } 11561 }; 11562 return AgendaView; 11563}(View_1.default)); 11564exports.default = AgendaView; 11565AgendaView.prototype.timeGridClass = TimeGrid_1.default; 11566AgendaView.prototype.dayGridClass = DayGrid_1.default; 11567// Will customize the rendering behavior of the AgendaView's timeGrid 11568agendaTimeGridMethods = { 11569 // Generates the HTML that will go before the day-of week header cells 11570 renderHeadIntroHtml: function () { 11571 var view = this.view; 11572 var calendar = view.calendar; 11573 var weekStart = calendar.msToUtcMoment(this.dateProfile.renderUnzonedRange.startMs, true); 11574 var weekText; 11575 if (this.opt('weekNumbers')) { 11576 weekText = weekStart.format(this.opt('smallWeekFormat'));
11577 return '' + 11578 '<th class="fc-axis fc-week-number ' + calendar.theme.getClass('widgetHeader') + '" ' + view.axisStyleAttr() + '>' + 11579 view.buildGotoAnchorHtml(// aside from link, important for matchCellWidths 11580 { date: weekStart, type: 'week', forceOff: this.colCnt > 1 }, util_1.htmlEscape(weekText) // inner HTML 11581 ) + 11582 '</th>'; 11583 } 11584 else { 11585 return '<th class="fc-axis ' + calendar.theme.getClass('widgetHeader') + '" ' + view.axisStyleAttr() + '></th>'; 11586 } 11587 }, 11588 // Generates the HTML that goes before the bg of the TimeGrid slot area. Long vertical column. 11589 renderBgIntroHtml: function () { 11590 var view = this.view; 11591 return '<td class="fc-axis ' + view.calendar.theme.getClass('widgetContent') + '" ' + view.axisStyleAttr() + '></td>'; 11592 }, 11593 // Generates the HTML that goes before all other types of cells. 11594 // Affects content-skeleton, helper-skeleton, highlight-skeleton for both the time-grid and day-grid. 11595 renderIntroHtml: function () { 11596 var view = this.view; 11597 return '<td class="fc-axis" ' + view.axisStyleAttr() + '></td>'; 11598 } 11599}; 11600// Will customize the rendering behavior of the AgendaView's dayGrid 11601agendaDayGridMethods = { 11602 // Generates the HTML that goes before the all-day cells 11603 renderBgIntroHtml: function () { 11604 var view = this.view; 11605 return '' + 11606 '<td class="fc-axis ' + view.calendar.theme.getClass('widgetContent') + '" ' + view.axisStyleAttr() + '>' + 11607 '<span>' + // needed for matchCellWidths 11608 view.getAllDayHtml() + 11609 '</span>' + 11610 '</td>'; 11611 }, 11612 // Generates the HTML that goes before all other types of cells. 11613 // Affects content-skeleton, helper-skeleton, highlight-skeleton for both the time-grid and day-grid. 11614 renderIntroHtml: function () { 11615 var view = this.view; 11616 return '<td class="fc-axis" ' + view.axisStyleAttr() + '></td>'; 11617 } 11618}; 11619function groupEventFootprintsByAllDay(eventFootprints) { 11620 var allDay = []; 11621 var timed = []; 11622 var i; 11623 for (i = 0; i < eventFootprints.length; i++) { 11624 if (eventFootprints[i].componentFootprint.isAllDay) { 11625 allDay.push(eventFootprints[i]); 11626 } 11627 else { 11628 timed.push(eventFootprints[i]); 11629 } 11630 } 11631 return { allDay: allDay, timed: timed }; 11632} 11633 11634 11635/***/ }), 11636/* 227 */ 11637/***/ (function(module, exports, __webpack_require__) { 11638 11639Object.defineProperty(exports, "__esModule", { value: true }); 11640var tslib_1 = __webpack_require__(2); 11641var $ = __webpack_require__(3); 11642var moment = __webpack_require__(0); 11643var util_1 = __webpack_require__(4); 11644var InteractiveDateComponent_1 = __webpack_require__(40); 11645var BusinessHourRenderer_1 = __webpack_require__(56); 11646var StandardInteractionsMixin_1 = __webpack_require__(60); 11647var DayTableMixin_1 = __webpack_require__(55); 11648var CoordCache_1 = __webpack_require__(53); 11649var UnzonedRange_1 = __webpack_require__(5); 11650var ComponentFootprint_1 = __webpack_require__(12); 11651var TimeGridEventRenderer_1 = __webpack_require__(246); 11652var TimeGridHelperRenderer_1 = __webpack_require__(247); 11653var TimeGridFillRenderer_1 = __webpack_require__(248);
11654/* A component that renders one or more columns of vertical time slots 11655----------------------------------------------------------------------------------------------------------------------*/ 11656// We mixin DayTable, even though there is only a single row of days 11657// potential nice values for the slot-duration and interval-duration 11658// from largest to smallest 11659var AGENDA_STOCK_SUB_DURATIONS = [ 11660 { hours: 1 }, 11661 { minutes: 30 }, 11662 { minutes: 15 }, 11663 { seconds: 30 }, 11664 { seconds: 15 } 11665]; 11666var TimeGrid = /** @class */ (function (_super) { 11667 tslib_1.__extends(TimeGrid, _super); 11668 function TimeGrid(view) { 11669 var _this = _super.call(this, view) || this; 11670 _this.processOptions(); 11671 return _this; 11672 } 11673 // Slices up the given span (unzoned start/end with other misc data) into an array of segments 11674 TimeGrid.prototype.componentFootprintToSegs = function (componentFootprint) { 11675 var segs = this.sliceRangeByTimes(componentFootprint.unzonedRange); 11676 var i; 11677 for (i = 0; i < segs.length; i++) { 11678 if (this.isRTL) { 11679 segs[i].col = this.daysPerRow - 1 - segs[i].dayIndex; 11680 } 11681 else { 11682 segs[i].col = segs[i].dayIndex; 11683 } 11684 } 11685 return segs; 11686 }; 11687 /* Date Handling 11688 ------------------------------------------------------------------------------------------------------------------*/ 11689 TimeGrid.prototype.sliceRangeByTimes = function (unzonedRange) { 11690 var segs = []; 11691 var segRange; 11692 var dayIndex; 11693 for (dayIndex = 0; dayIndex < this.daysPerRow; dayIndex++) { 11694 segRange = unzonedRange.intersect(this.dayRanges[dayIndex]); 11695 if (segRange) { 11696 segs.push({ 11697 startMs: segRange.startMs, 11698 endMs: segRange.endMs, 11699 isStart: segRange.isStart, 11700 isEnd: segRange.isEnd, 11701 dayIndex: dayIndex 11702 }); 11703 } 11704 } 11705 return segs; 11706 }; 11707 /* Options 11708 ------------------------------------------------------------------------------------------------------------------*/ 11709 // Parses various options into properties of this object 11710 TimeGrid.prototype.processOptions = function () { 11711 var slotDuration = this.opt('slotDuration'); 11712 var snapDuration = this.opt('snapDuration'); 11713 var input; 11714 slotDuration = moment.duration(slotDuration); 11715 snapDuration = snapDuration ? moment.duration(snapDuration) : slotDuration; 11716 this.slotDuration = slotDuration; 11717 this.snapDuration = snapDuration; 11718 this.snapsPerSlot = slotDuration / snapDuration; // TODO: ensure an integer multiple? 11719 // might be an array value (for TimelineView). 11720 // if so, getting the most granular entry (the last one probably). 11721 input = this.opt('slotLabelFormat'); 11722 if ($.isArray(input)) { 11723 input = input[input.length - 1]; 11724 } 11725 this.labelFormat = input || 11726 this.opt('smallTimeFormat'); // the computed default 11727 input = this.opt('slotLabelInterval'); 11728 this.labelInterval = input ? 11729 moment.duration(input) : 11730 this.computeLabelInterval(slotDuration); 11731 }; 11732 // Computes an automatic value for slotLabelInterval 11733 TimeGrid.prototype.computeLabelInterval = function (slotDuration) { 11734 var i; 11735 var labelInterval; 11736 var slotsPerLabel; 11737 // find the smallest stock label interval that results in more than one slots-per-label 11738 for (i = AGENDA_STOCK_SUB_DURATIONS.length - 1; i >= 0; i--) { 11739 labelInterval = moment.duration(AGENDA_STOCK_SUB_DURATIONS[i]); 11740 slotsPerLabel = util_1.divideDurationByDuration(labelInterval, slotDuration); 11741 if (util_1.isInt(slotsPerLabel) && slotsPerLabel > 1) { 11742 return labelInterval; 11743 } 11744 } 11745 return moment.duration(slotDuration); // fall back. clone 11746 }; 11747 /* Date Rendering 11748 ------------------------------------------------------------------------------------------------------------------*/ 11749 TimeGrid.prototype.renderDates = function (dateProfile) { 11750 this.dateProfile = dateProfile; 11751 this.updateDayTable(); 11752 this.renderSlats();
11753 this.renderColumns(); 11754 }; 11755 TimeGrid.prototype.unrenderDates = function () { 11756 // this.unrenderSlats(); // don't need this because repeated .html() calls clear 11757 this.unrenderColumns(); 11758 }; 11759 TimeGrid.prototype.renderSkeleton = function () { 11760 var theme = this.view.calendar.theme; 11761 this.el.html('<div class="fc-bg"></div>' + 11762 '<div class="fc-slats"></div>' + 11763 '<hr class="fc-divider ' + theme.getClass('widgetHeader') + '" style="display:none" />'); 11764 this.bottomRuleEl = this.el.find('hr'); 11765 }; 11766 TimeGrid.prototype.renderSlats = function () { 11767 var theme = this.view.calendar.theme; 11768 this.slatContainerEl = this.el.find('> .fc-slats') 11769 .html(// avoids needing ::unrenderSlats() 11770 '<table class="' + theme.getClass('tableGrid') + '">' + 11771 this.renderSlatRowHtml() + 11772 '</table>'); 11773 this.slatEls = this.slatContainerEl.find('tr'); 11774 this.slatCoordCache = new CoordCache_1.default({ 11775 els: this.slatEls, 11776 isVertical: true 11777 }); 11778 }; 11779 // Generates the HTML for the horizontal "slats" that run width-wise. Has a time axis on a side. Depends on RTL. 11780 TimeGrid.prototype.renderSlatRowHtml = function () { 11781 var view = this.view; 11782 var calendar = view.calendar; 11783 var theme = calendar.theme; 11784 var isRTL = this.isRTL; 11785 var dateProfile = this.dateProfile; 11786 var html = ''; 11787 var slotTime = moment.duration(+dateProfile.minTime); // wish there was .clone() for durations 11788 var slotIterator = moment.duration(0); 11789 var slotDate; // will be on the view's first day, but we only care about its time 11790 var isLabeled; 11791 var axisHtml; 11792 // Calculate the time for each slot 11793 while (slotTime < dateProfile.maxTime) { 11794 slotDate = calendar.msToUtcMoment(dateProfile.renderUnzonedRange.startMs).time(slotTime); 11795 isLabeled = util_1.isInt(util_1.divideDurationByDuration(slotIterator, this.labelInterval)); 11796 axisHtml = 11797 '<td class="fc-axis fc-time ' + theme.getClass('widgetContent') + '" ' + view.axisStyleAttr() + '>' + 11798 (isLabeled ? 11799 '<span>' + // for matchCellWidths 11800 util_1.htmlEscape(slotDate.format(this.labelFormat)) + 11801 '</span>' : 11802 '') + 11803 '</td>'; 11804 html += 11805 '<tr data-time="' + slotDate.format('HH:mm:ss') + '"' + 11806 (isLabeled ? '' : ' class="fc-minor"') + 11807 '>' + 11808 (!isRTL ? axisHtml : '') + 11809 '<td class="' + theme.getClass('widgetContent') + '"/>' + 11810 (isRTL ? axisHtml : '') + 11811 '</tr>'; 11812 slotTime.add(this.slotDuration); 11813 slotIterator.add(this.slotDuration); 11814 } 11815 return html; 11816 }; 11817 TimeGrid.prototype.renderColumns = function () { 11818 var dateProfile = this.dateProfile; 11819 var theme = this.view.calendar.theme; 11820 this.dayRanges = this.dayDates.map(function (dayDate) { 11821 return new UnzonedRange_1.default(dayDate.clone().add(dateProfile.minTime), dayDate.clone().add(dateProfile.maxTime)); 11822 }); 11823 if (this.headContainerEl) { 11824 this.headContainerEl.html(this.renderHeadHtml()); 11825 } 11826 this.el.find('> .fc-bg').html('<table class="' + theme.getClass('tableGrid') + '">' + 11827 this.renderBgTrHtml(0) + // row=0 11828 '</table>'); 11829 this.colEls = this.el.find('.fc-day, .fc-disabled-day'); 11830 this.colCoordCache = new CoordCache_1.default({ 11831 els: this.colEls, 11832 isHorizontal: true 11833 }); 11834 this.renderContentSkeleton(); 11835 }; 11836 TimeGrid.prototype.unrenderColumns = function () { 11837 this.unrenderContentSkeleton(); 11838 }; 11839 /* Content Skeleton 11840 ------------------------------------------------------------------------------------------------------------------*/ 11841 // Renders the DOM that the view's content will live in 11842 TimeGrid.prototype.renderContentSkeleton = function () { 11843 var cellHtml = ''; 11844 var i; 11845 var skeletonEl; 11846 for (i = 0; i < this.colCnt; i++) { 11847 cellHtml += 11848 '<td>' + 11849 '<div class="fc-content-col">' + 11850 '<div class="fc-event-container fc-helper-container"></div>' + 11851 '<div class="fc-event-container"></div>' + 11852 '<div class="fc-highlight-container"></div>' + 11853 '<div class="fc-bgevent-container"></div>' + 11854 '<div class="fc-business-container"></div>' + 11855 '</div>' + 11856 '</td>'; 11857 }
11858 skeletonEl = this.contentSkeletonEl = $('<div class="fc-content-skeleton">' + 11859 '<table>' + 11860 '<tr>' + cellHtml + '</tr>' + 11861 '</table>' + 11862 '</div>'); 11863 this.colContainerEls = skeletonEl.find('.fc-content-col'); 11864 this.helperContainerEls = skeletonEl.find('.fc-helper-container'); 11865 this.fgContainerEls = skeletonEl.find('.fc-event-container:not(.fc-helper-container)'); 11866 this.bgContainerEls = skeletonEl.find('.fc-bgevent-container'); 11867 this.highlightContainerEls = skeletonEl.find('.fc-highlight-container'); 11868 this.businessContainerEls = skeletonEl.find('.fc-business-container'); 11869 this.bookendCells(skeletonEl.find('tr')); // TODO: do this on string level 11870 this.el.append(skeletonEl); 11871 }; 11872 TimeGrid.prototype.unrenderContentSkeleton = function () { 11873 if (this.contentSkeletonEl) { 11874 this.contentSkeletonEl.remove(); 11875 this.contentSkeletonEl = null; 11876 this.colContainerEls = null; 11877 this.helperContainerEls = null; 11878 this.fgContainerEls = null; 11879 this.bgContainerEls = null; 11880 this.highlightContainerEls = null; 11881 this.businessContainerEls = null; 11882 } 11883 }; 11884 // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's col 11885 TimeGrid.prototype.groupSegsByCol = function (segs) { 11886 var segsByCol = []; 11887 var i; 11888 for (i = 0; i < this.colCnt; i++) { 11889 segsByCol.push([]); 11890 } 11891 for (i = 0; i < segs.length; i++) { 11892 segsByCol[segs[i].col].push(segs[i]); 11893 } 11894 return segsByCol; 11895 }; 11896 // Given segments grouped by column, insert the segments' elements into a parallel array of container 11897 // elements, each living within a column. 11898 TimeGrid.prototype.attachSegsByCol = function (segsByCol, containerEls) { 11899 var col; 11900 var segs; 11901 var i; 11902 for (col = 0; col < this.colCnt; col++) { 11903 segs = segsByCol[col]; 11904 for (i = 0; i < segs.length; i++) { 11905 containerEls.eq(col).append(segs[i].el); 11906 } 11907 } 11908 }; 11909 /* Now Indicator 11910 ------------------------------------------------------------------------------------------------------------------*/ 11911 TimeGrid.prototype.getNowIndicatorUnit = function () { 11912 return 'minute'; // will refresh on the minute 11913 }; 11914 TimeGrid.prototype.renderNowIndicator = function (date) { 11915 // HACK: if date columns not ready for some reason (scheduler) 11916 if (!this.colContainerEls) { 11917 return; 11918 } 11919 // seg system might be overkill, but it handles scenario where line needs to be rendered 11920 // more than once because of columns with the same date (resources columns for example) 11921 var segs = this.componentFootprintToSegs(new ComponentFootprint_1.default(new UnzonedRange_1.default(date, date.valueOf() + 1), // protect against null range 11922 false // all-day 11923 )); 11924 var top = this.computeDateTop(date, date); 11925 var nodes = []; 11926 var i; 11927 // render lines within the columns 11928 for (i = 0; i < segs.length; i++) { 11929 nodes.push($('<div class="fc-now-indicator fc-now-indicator-line"></div>') 11930 .css('top', top) 11931 .appendTo(this.colContainerEls.eq(segs[i].col))[0]); 11932 } 11933 // render an arrow over the axis 11934 if (segs.length > 0) { 11935 nodes.push($('<div class="fc-now-indicator fc-now-indicator-arrow"></div>') 11936 .css('top', top) 11937 .appendTo(this.el.find('.fc-content-skeleton'))[0]); 11938 } 11939 this.nowIndicatorEls = $(nodes); 11940 }; 11941 TimeGrid.prototype.unrenderNowIndicator = function () { 11942 if (this.nowIndicatorEls) { 11943 this.nowIndicatorEls.remove(); 11944 this.nowIndicatorEls = null; 11945 } 11946 }; 11947 /* Coordinates 11948 ------------------------------------------------------------------------------------------------------------------*/ 11949 TimeGrid.prototype.updateSize = function (totalHeight, isAuto, isResize) { 11950 _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
11951 this.slatCoordCache.build(); 11952 if (isResize) { 11953 this.updateSegVerticals([].concat(this.eventRenderer.getSegs(), this.businessSegs || [])); 11954 } 11955 }; 11956 TimeGrid.prototype.getTotalSlatHeight = function () { 11957 return this.slatContainerEl.outerHeight(); 11958 }; 11959 // Computes the top coordinate, relative to the bounds of the grid, of the given date. 11960 // `ms` can be a millisecond UTC time OR a UTC moment. 11961 // A `startOfDayDate` must be given for avoiding ambiguity over how to treat midnight. 11962 TimeGrid.prototype.computeDateTop = function (ms, startOfDayDate) { 11963 return this.computeTimeTop(moment.duration(ms - startOfDayDate.clone().stripTime())); 11964 }; 11965 // Computes the top coordinate, relative to the bounds of the grid, of the given time (a Duration). 11966 TimeGrid.prototype.computeTimeTop = function (time) { 11967 var len = this.slatEls.length; 11968 var dateProfile = this.dateProfile; 11969 var slatCoverage = (time - dateProfile.minTime) / this.slotDuration; // floating-point value of # of slots covered 11970 var slatIndex; 11971 var slatRemainder; 11972 // compute a floating-point number for how many slats should be progressed through. 11973 // from 0 to number of slats (inclusive) 11974 // constrained because minTime/maxTime might be customized. 11975 slatCoverage = Math.max(0, slatCoverage); 11976 slatCoverage = Math.min(len, slatCoverage); 11977 // an integer index of the furthest whole slat 11978 // from 0 to number slats (*exclusive*, so len-1) 11979 slatIndex = Math.floor(slatCoverage); 11980 slatIndex = Math.min(slatIndex, len - 1); 11981 // how much further through the slatIndex slat (from 0.0-1.0) must be covered in addition. 11982 // could be 1.0 if slatCoverage is covering *all* the slots 11983 slatRemainder = slatCoverage - slatIndex;
11984 return this.slatCoordCache.getTopPosition(slatIndex) + 11985 this.slatCoordCache.getHeight(slatIndex) * slatRemainder; 11986 }; 11987 // Refreshes the CSS top/bottom coordinates for each segment element. 11988 // Works when called after initial render, after a window resize/zoom for example. 11989 TimeGrid.prototype.updateSegVerticals = function (segs) { 11990 this.computeSegVerticals(segs); 11991 this.assignSegVerticals(segs); 11992 }; 11993 // For each segment in an array, computes and assigns its top and bottom properties 11994 TimeGrid.prototype.computeSegVerticals = function (segs) { 11995 var eventMinHeight = this.opt('agendaEventMinHeight'); 11996 var i; 11997 var seg; 11998 var dayDate; 11999 for (i = 0; i < segs.length; i++) { 12000 seg = segs[i]; 12001 dayDate = this.dayDates[seg.dayIndex]; 12002 seg.top = this.computeDateTop(seg.startMs, dayDate); 12003 seg.bottom = Math.max(seg.top + eventMinHeight, this.computeDateTop(seg.endMs, dayDate)); 12004 } 12005 }; 12006 // Given segments that already have their top/bottom properties computed, applies those values to 12007 // the segments' elements. 12008 TimeGrid.prototype.assignSegVerticals = function (segs) { 12009 var i; 12010 var seg; 12011 for (i = 0; i < segs.length; i++) { 12012 seg = segs[i]; 12013 seg.el.css(this.generateSegVerticalCss(seg)); 12014 } 12015 }; 12016 // Generates an object with CSS properties for the top/bottom coordinates of a segment element 12017 TimeGrid.prototype.generateSegVerticalCss = function (seg) { 12018 return { 12019 top: seg.top, 12020 bottom: -seg.bottom // flipped because needs to be space beyond bottom edge of event container 12021 }; 12022 }; 12023 /* Hit System 12024 ------------------------------------------------------------------------------------------------------------------*/ 12025 TimeGrid.prototype.prepareHits = function () { 12026 this.colCoordCache.build(); 12027 this.slatCoordCache.build(); 12028 }; 12029 TimeGrid.prototype.releaseHits = function () { 12030 this.colCoordCache.clear(); 12031 // NOTE: don't clear slatCoordCache because we rely on it for computeTimeTop 12032 }; 12033 TimeGrid.prototype.queryHit = function (leftOffset, topOffset) { 12034 var snapsPerSlot = this.snapsPerSlot; 12035 var colCoordCache = this.colCoordCache; 12036 var slatCoordCache = this.slatCoordCache; 12037 if (colCoordCache.isLeftInBounds(leftOffset) && slatCoordCache.isTopInBounds(topOffset)) { 12038 var colIndex = colCoordCache.getHorizontalIndex(leftOffset); 12039 var slatIndex = slatCoordCache.getVerticalIndex(topOffset); 12040 if (colIndex != null && slatIndex != null) { 12041 var slatTop = slatCoordCache.getTopOffset(slatIndex); 12042 var slatHeight = slatCoordCache.getHeight(slatIndex); 12043 var partial = (topOffset - slatTop) / slatHeight; // floating point number between 0 and 1 12044 var localSnapIndex = Math.floor(partial * snapsPerSlot); // the snap # relative to start of slat 12045 var snapIndex = slatIndex * snapsPerSlot + localSnapIndex; 12046 var snapTop = slatTop + (localSnapIndex / snapsPerSlot) * slatHeight; 12047 var snapBottom = slatTop + ((localSnapIndex + 1) / snapsPerSlot) * slatHeight; 12048 return { 12049 col: colIndex, 12050 snap: snapIndex, 12051 component: this, 12052 left: colCoordCache.getLeftOffset(colIndex), 12053 right: colCoordCache.getRightOffset(colIndex), 12054 top: snapTop, 12055 bottom: snapBottom 12056 }; 12057 } 12058 } 12059 }; 12060 TimeGrid.prototype.getHitFootprint = function (hit) { 12061 var start = this.getCellDate(0, hit.col); // row=0 12062 var time = this.computeSnapTime(hit.snap); // pass in the snap-index 12063 var end; 12064 start.time(time); 12065 end = start.clone().add(this.snapDuration); 12066 return new ComponentFootprint_1.default(new UnzonedRange_1.default(start, end), false // all-day? 12067 ); 12068 }; 12069 // Given a row number of the grid, representing a "snap", returns a time (Duration) from its start-of-day 12070 TimeGrid.prototype.computeSnapTime = function (snapIndex) { 12071 return moment.duration(this.dateProfile.minTime + this.snapDuration * snapIndex); 12072 }; 12073 TimeGrid.prototype.getHitEl = function (hit) { 12074 return this.colEls.eq(hit.col); 12075 }; 12076 /* Event Drag Visualization 12077 ------------------------------------------------------------------------------------------------------------------*/ 12078 // Renders a visual indication of an event being dragged over the specified date(s). 12079 // A returned value of `true` signals that a mock "helper" event has been rendered. 12080 TimeGrid.prototype.renderDrag = function (eventFootprints, seg, isTouch) { 12081 var i; 12082 if (seg) { 12083 if (eventFootprints.length) { 12084 this.helperRenderer.renderEventDraggingFootprints(eventFootprints, seg, isTouch); 12085 // signal that a helper has been rendered 12086 return true; 12087 } 12088 } 12089 else { 12090 for (i = 0; i < eventFootprints.length; i++) { 12091 this.renderHighlight(eventFootprints[i].componentFootprint); 12092 } 12093 } 12094 }; 12095 // Unrenders any visual indication of an event being dragged 12096 TimeGrid.prototype.unrenderDrag = function () { 12097 this.unrenderHighlight(); 12098 this.helperRenderer.unrender(); 12099 }; 12100 /* Event Resize Visualization 12101 ------------------------------------------------------------------------------------------------------------------*/ 12102 // Renders a visual indication of an event being resized 12103 TimeGrid.prototype.renderEventResize = function (eventFootprints, seg, isTouch) { 12104 this.helperRenderer.renderEventResizingFootprints(eventFootprints, seg, isTouch); 12105 }; 12106 // Unrenders any visual indication of an event being resized 12107 TimeGrid.prototype.unrenderEventResize = function () { 12108 this.helperRenderer.unrender(); 12109 }; 12110 /* Selection 12111 ------------------------------------------------------------------------------------------------------------------*/ 12112 // Renders a visual indication of a selection. Overrides the default, which was to simply render a highlight. 12113 TimeGrid.prototype.renderSelectionFootprint = function (componentFootprint) { 12114 if (this.opt('selectHelper')) { 12115 this.helperRenderer.renderComponentFootprint(componentFootprint); 12116 } 12117 else { 12118 this.renderHighlight(componentFootprint); 12119 } 12120 }; 12121 // Unrenders any visual indication of a selection 12122 TimeGrid.prototype.unrenderSelection = function () { 12123 this.helperRenderer.unrender(); 12124 this.unrenderHighlight(); 12125 }; 12126 return TimeGrid; 12127}(InteractiveDateComponent_1.default)); 12128exports.default = TimeGrid; 12129TimeGrid.prototype.eventRendererClass = TimeGridEventRenderer_1.default; 12130TimeGrid.prototype.businessHourRendererClass = BusinessHourRenderer_1.default; 12131TimeGrid.prototype.helperRendererClass = TimeGridHelperRenderer_1.default; 12132TimeGrid.prototype.fillRendererClass = TimeGridFillRenderer_1.default; 12133StandardInteractionsMixin_1.default.mixInto(TimeGrid); 12134DayTableMixin_1.default.mixInto(TimeGrid); 12135 12136 12137/***/ }), 12138/* 228 */ 12139/***/ (function(module, exports, __webpack_require__) { 12140 12141Object.defineProperty(exports, "__esModule", { value: true });
12142var tslib_1 = __webpack_require__(2); 12143var UnzonedRange_1 = __webpack_require__(5); 12144var DateProfileGenerator_1 = __webpack_require__(221); 12145var BasicViewDateProfileGenerator = /** @class */ (function (_super) { 12146 tslib_1.__extends(BasicViewDateProfileGenerator, _super); 12147 function BasicViewDateProfileGenerator() { 12148 return _super !== null && _super.apply(this, arguments) || this; 12149 } 12150 // Computes the date range that will be rendered. 12151 BasicViewDateProfileGenerator.prototype.buildRenderRange = function (currentUnzonedRange, currentRangeUnit, isRangeAllDay) { 12152 var renderUnzonedRange = _super.prototype.buildRenderRange.call(this, currentUnzonedRange, currentRangeUnit, isRangeAllDay); // an UnzonedRange 12153 var start = this.msToUtcMoment(renderUnzonedRange.startMs, isRangeAllDay); 12154 var end = this.msToUtcMoment(renderUnzonedRange.endMs, isRangeAllDay); 12155 // year and month views should be aligned with weeks. this is already done for week 12156 if (/^(year|month)$/.test(currentRangeUnit)) { 12157 start.startOf('week'); 12158 // make end-of-week if not already 12159 if (end.weekday()) { 12160 end.add(1, 'week').startOf('week'); // exclusively move backwards 12161 } 12162 } 12163 return new UnzonedRange_1.default(start, end); 12164 }; 12165 return BasicViewDateProfileGenerator; 12166}(DateProfileGenerator_1.default)); 12167exports.default = BasicViewDateProfileGenerator; 12168 12169 12170/***/ }), 12171/* 229 */ 12172/***/ (function(module, exports, __webpack_require__) { 12173 12174Object.defineProperty(exports, "__esModule", { value: true }); 12175var tslib_1 = __webpack_require__(2); 12176var moment = __webpack_require__(0); 12177var util_1 = __webpack_require__(4); 12178var BasicView_1 = __webpack_require__(62); 12179var MonthViewDateProfileGenerator_1 = __webpack_require__(253); 12180/* A month view with day cells running in rows (one-per-week) and columns 12181----------------------------------------------------------------------------------------------------------------------*/ 12182var MonthView = /** @class */ (function (_super) { 12183 tslib_1.__extends(MonthView, _super); 12184 function MonthView() { 12185 return _super !== null && _super.apply(this, arguments) || this; 12186 } 12187 // Overrides the default BasicView behavior to have special multi-week auto-height logic 12188 MonthView.prototype.setGridHeight = function (height, isAuto) { 12189 // if auto, make the height of each row the height that it would be if there were 6 weeks 12190 if (isAuto) { 12191 height *= this.dayGrid.rowCnt / 6; 12192 } 12193 util_1.distributeHeight(this.dayGrid.rowEls, height, !isAuto); // if auto, don't compensate for height-hogging rows 12194 }; 12195 MonthView.prototype.isDateInOtherMonth = function (date, dateProfile) { 12196 return date.month() !== moment.utc(dateProfile.currentUnzonedRange.startMs).month(); // TODO: optimize 12197 }; 12198 return MonthView; 12199}(BasicView_1.default)); 12200exports.default = MonthView; 12201MonthView.prototype.dateProfileGeneratorClass = MonthViewDateProfileGenerator_1.default; 12202 12203 12204/***/ }), 12205/* 230 */ 12206/***/ (function(module, exports, __webpack_require__) { 12207 12208Object.defineProperty(exports, "__esModule", { value: true }); 12209var tslib_1 = __webpack_require__(2); 12210var $ = __webpack_require__(3); 12211var util_1 = __webpack_require__(4); 12212var UnzonedRange_1 = __webpack_require__(5); 12213var View_1 = __webpack_require__(41); 12214var Scroller_1 = __webpack_require__(39); 12215var ListEventRenderer_1 = __webpack_require__(254); 12216var ListEventPointing_1 = __webpack_require__(255); 12217/* 12218Responsible for the scroller, and forwarding event-related actions into the "grid". 12219*/ 12220var ListView = /** @class */ (function (_super) { 12221 tslib_1.__extends(ListView, _super); 12222 function ListView(calendar, viewSpec) { 12223 var _this = _super.call(this, calendar, viewSpec) || this; 12224 _this.segSelector = '.fc-list-item'; // which elements accept event actions 12225 _this.scroller = new Scroller_1.default({ 12226 }); 12227 return _this; 12228 } 12229 ListView.prototype.renderSkeleton = function () { 12230 this.el.addClass('fc-list-view ' + 12231 this.calendar.theme.getClass('listView')); 12232 this.scroller.render(); 12233 this.scroller.el.appendTo(this.el); 12234 this.contentEl = this.scroller.scrollEl; // shortcut 12235 }; 12236 ListView.prototype.unrenderSkeleton = function () { 12237 this.scroller.destroy(); // will remove the Grid too 12238 }; 12239 ListView.prototype.updateSize = function (totalHeight, isAuto, isResize) { 12240 _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize); 12241 this.scroller.clear(); // sets height to 'auto' and clears overflow 12242 if (!isAuto) { 12243 this.scroller.setHeight(this.computeScrollerHeight(totalHeight)); 12244 } 12245 }; 12246 ListView.prototype.computeScrollerHeight = function (totalHeight) { 12247 return totalHeight -
12248 util_1.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller 12249 }; 12250 ListView.prototype.renderDates = function (dateProfile) { 12251 var calendar = this.calendar; 12252 var dayStart = calendar.msToUtcMoment(dateProfile.renderUnzonedRange.startMs, true); 12253 var viewEnd = calendar.msToUtcMoment(dateProfile.renderUnzonedRange.endMs, true); 12254 var dayDates = []; 12255 var dayRanges = []; 12256 while (dayStart < viewEnd) { 12257 dayDates.push(dayStart.clone()); 12258 dayRanges.push(new UnzonedRange_1.default(dayStart, dayStart.clone().add(1, 'day'))); 12259 dayStart.add(1, 'day'); 12260 } 12261 this.dayDates = dayDates; 12262 this.dayRanges = dayRanges; 12263 // all real rendering happens in EventRenderer 12264 }; 12265 // slices by day 12266 ListView.prototype.componentFootprintToSegs = function (footprint) { 12267 var dayRanges = this.dayRanges; 12268 var dayIndex; 12269 var segRange; 12270 var seg; 12271 var segs = []; 12272 for (dayIndex = 0; dayIndex < dayRanges.length; dayIndex++) { 12273 segRange = footprint.unzonedRange.intersect(dayRanges[dayIndex]); 12274 if (segRange) { 12275 seg = { 12276 startMs: segRange.startMs, 12277 endMs: segRange.endMs, 12278 isStart: segRange.isStart, 12279 isEnd: segRange.isEnd, 12280 dayIndex: dayIndex 12281 }; 12282 segs.push(seg); 12283 // detect when footprint won't go fully into the next day, 12284 // and mutate the latest seg to the be the end. 12285 if (!seg.isEnd && !footprint.isAllDay && 12286 dayIndex + 1 < dayRanges.length && 12287 footprint.unzonedRange.endMs < dayRanges[dayIndex + 1].startMs + this.nextDayThreshold) { 12288 seg.endMs = footprint.unzonedRange.endMs; 12289 seg.isEnd = true; 12290 break; 12291 } 12292 } 12293 } 12294 return segs; 12295 }; 12296 ListView.prototype.renderEmptyMessage = function () { 12297 this.contentEl.html('<div class="fc-list-empty-wrap2">' + // TODO: try less wraps 12298 '<div class="fc-list-empty-wrap1">' + 12299 '<div class="fc-list-empty">' + 12300 util_1.htmlEscape(this.opt('noEventsMessage')) + 12301 '</div>' + 12302 '</div>' + 12303 '</div>'); 12304 }; 12305 // render the event segments in the view 12306 ListView.prototype.renderSegList = function (allSegs) { 12307 var segsByDay = this.groupSegsByDay(allSegs); // sparse array 12308 var dayIndex; 12309 var daySegs; 12310 var i; 12311 var tableEl = $('<table class="fc-list-table ' + this.calendar.theme.getClass('tableList') + '"><tbody/></table>'); 12312 var tbodyEl = tableEl.find('tbody'); 12313 for (dayIndex = 0; dayIndex < segsByDay.length; dayIndex++) { 12314 daySegs = segsByDay[dayIndex]; 12315 if (daySegs) { 12316 // append a day header 12317 tbodyEl.append(this.dayHeaderHtml(this.dayDates[dayIndex])); 12318 this.eventRenderer.sortEventSegs(daySegs); 12319 for (i = 0; i < daySegs.length; i++) { 12320 tbodyEl.append(daySegs[i].el); // append event row 12321 } 12322 } 12323 } 12324 this.contentEl.empty().append(tableEl); 12325 }; 12326 // Returns a sparse array of arrays, segs grouped by their dayIndex 12327 ListView.prototype.groupSegsByDay = function (segs) { 12328 var segsByDay = []; // sparse array 12329 var i; 12330 var seg; 12331 for (i = 0; i < segs.length; i++) { 12332 seg = segs[i]; 12333 (segsByDay[seg.dayIndex] || (segsByDay[seg.dayIndex] = [])) 12334 .push(seg); 12335 } 12336 return segsByDay; 12337 }; 12338 // generates the HTML for the day headers that live amongst the event rows 12339 ListView.prototype.dayHeaderHtml = function (dayDate) { 12340 var mainFormat = this.opt('listDayFormat'); 12341 var altFormat = this.opt('listDayAltFormat'); 12342 return '<tr class="fc-list-heading" data-date="' + dayDate.format('YYYY-MM-DD') + '">' + 12343 '<td class="' + (this.calendar.theme.getClass('tableListHeading') || 12344 this.calendar.theme.getClass('widgetHeader')) + '" colspan="3">' + 12345 (mainFormat ? 12346 this.buildGotoAnchorHtml(dayDate, { 'class': 'fc-list-heading-main' }, util_1.htmlEscape(dayDate.format(mainFormat)) // inner HTML 12347 ) : 12348 '') + 12349 (altFormat ? 12350 this.buildGotoAnchorHtml(dayDate, { 'class': 'fc-list-heading-alt' }, util_1.htmlEscape(dayDate.format(altFormat)) // inner HTML 12351 ) : 12352 '') + 12353 '</td>' + 12354 '</tr>'; 12355 }; 12356 return ListView; 12357}(View_1.default)); 12358exports.default = ListView; 12359ListView.prototype.eventRendererClass = ListEventRenderer_1.default; 12360ListView.prototype.eventPointingClass = ListEventPointing_1.default; 12361 12362 12363/***/ }), 12364/* 231 */, 12365/* 232 */, 12366/* 233 */, 12367/* 234 */, 12368/* 235 */, 12369/* 236 */ 12370/***/ (function(module, exports, __webpack_require__) { 12371 12372var $ = __webpack_require__(3);
12373var exportHooks = __webpack_require__(16); 12374var util_1 = __webpack_require__(4); 12375var Calendar_1 = __webpack_require__(220); 12376// for intentional side-effects 12377__webpack_require__(10); 12378__webpack_require__(47); 12379__webpack_require__(256); 12380__webpack_require__(257); 12381__webpack_require__(260); 12382__webpack_require__(261); 12383__webpack_require__(262); 12384__webpack_require__(263); 12385$.fullCalendar = exportHooks; 12386$.fn.fullCalendar = function (options) { 12387 var args = Array.prototype.slice.call(arguments, 1); // for a possible method call 12388 var res = this; // what this function will return (this jQuery object by default) 12389 this.each(function (i, _element) { 12390 var element = $(_element); 12391 var calendar = element.data('fullCalendar'); // get the existing calendar object (if any) 12392 var singleRes; // the returned value of this single method call 12393 // a method call 12394 if (typeof options === 'string') { 12395 if (options === 'getCalendar') { 12396 if (!i) { 12397 res = calendar; 12398 } 12399 } 12400 else if (options === 'destroy') { 12401 if (calendar) { 12402 calendar.destroy(); 12403 element.removeData('fullCalendar'); 12404 } 12405 } 12406 else if (!calendar) { 12407 util_1.warn('Attempting to call a FullCalendar method on an element with no calendar.'); 12408 } 12409 else if ($.isFunction(calendar[options])) { 12410 singleRes = calendar[options].apply(calendar, args); 12411 if (!i) { 12412 res = singleRes; // record the first method call result 12413 } 12414 if (options === 'destroy') { 12415 element.removeData('fullCalendar'); 12416 } 12417 } 12418 else { 12419 util_1.warn("'" + options + "' is an unknown FullCalendar method."); 12420 } 12421 } 12422 else if (!calendar) { 12423 calendar = new Calendar_1.default(element, options); 12424 element.data('fullCalendar', calendar); 12425 calendar.render(); 12426 } 12427 }); 12428 return res; 12429}; 12430module.exports = exportHooks; 12431 12432 12433/***/ }), 12434/* 237 */ 12435/***/ (function(module, exports, __webpack_require__) { 12436 12437Object.defineProperty(exports, "__esModule", { value: true }); 12438var tslib_1 = __webpack_require__(2); 12439var Model_1 = __webpack_require__(48); 12440var Component = /** @class */ (function (_super) { 12441 tslib_1.__extends(Component, _super); 12442 function Component() { 12443 return _super !== null && _super.apply(this, arguments) || this; 12444 } 12445 Component.prototype.setElement = function (el) { 12446 this.el = el; 12447 this.bindGlobalHandlers(); 12448 this.renderSkeleton(); 12449 this.set('isInDom', true); 12450 }; 12451 Component.prototype.removeElement = function () { 12452 this.unset('isInDom'); 12453 this.unrenderSkeleton(); 12454 this.unbindGlobalHandlers(); 12455 this.el.remove(); 12456 // NOTE: don't null-out this.el in case the View was destroyed within an API callback. 12457 // We don't null-out the View's other jQuery element references upon destroy, 12458 // so we shouldn't kill this.el either. 12459 }; 12460 Component.prototype.bindGlobalHandlers = function () { 12461 // subclasses can override 12462 }; 12463 Component.prototype.unbindGlobalHandlers = function () { 12464 // subclasses can override 12465 }; 12466 /* 12467 NOTE: Can't have a `render` method. Read the deprecation notice in View::executeDateRender 12468 */ 12469 // Renders the basic structure of the view before any content is rendered 12470 Component.prototype.renderSkeleton = function () { 12471 // subclasses should implement 12472 }; 12473 // Unrenders the basic structure of the view 12474 Component.prototype.unrenderSkeleton = function () { 12475 // subclasses should implement 12476 }; 12477 return Component; 12478}(Model_1.default)); 12479exports.default = Component; 12480 12481 12482/***/ }), 12483/* 238 */ 12484/***/ (function(module, exports) { 12485 12486Object.defineProperty(exports, "__esModule", { value: true });
12487var Iterator = /** @class */ (function () { 12488 function Iterator(items) { 12489 this.items = items || []; 12490 } 12491 /* Calls a method on every item passing the arguments through */ 12492 Iterator.prototype.proxyCall = function (methodName) { 12493 var args = []; 12494 for (var _i = 1; _i < arguments.length; _i++) { 12495 args[_i - 1] = arguments[_i]; 12496 } 12497 var results = []; 12498 this.items.forEach(function (item) { 12499 results.push(item[methodName].apply(item, args)); 12500 }); 12501 return results; 12502 }; 12503 return Iterator; 12504}()); 12505exports.default = Iterator; 12506 12507 12508/***/ }), 12509/* 239 */ 12510/***/ (function(module, exports, __webpack_require__) { 12511 12512Object.defineProperty(exports, "__esModule", { value: true }); 12513var $ = __webpack_require__(3); 12514var util_1 = __webpack_require__(4); 12515/* Toolbar with buttons and title 12516----------------------------------------------------------------------------------------------------------------------*/ 12517var Toolbar = /** @class */ (function () { 12518 function Toolbar(calendar, toolbarOptions) { 12519 this.el = null; // mirrors local `el` 12520 this.viewsWithButtons = []; 12521 this.calendar = calendar; 12522 this.toolbarOptions = toolbarOptions; 12523 } 12524 // method to update toolbar-specific options, not calendar-wide options 12525 Toolbar.prototype.setToolbarOptions = function (newToolbarOptions) { 12526 this.toolbarOptions = newToolbarOptions; 12527 }; 12528 // can be called repeatedly and will rerender 12529 Toolbar.prototype.render = function () { 12530 var sections = this.toolbarOptions.layout; 12531 var el = this.el; 12532 if (sections) { 12533 if (!el) { 12534 el = this.el = $("<div class='fc-toolbar " + this.toolbarOptions.extraClasses + "'/>"); 12535 } 12536 else { 12537 el.empty(); 12538 } 12539 el.append(this.renderSection('left')) 12540 .append(this.renderSection('right')) 12541 .append(this.renderSection('center')) 12542 .append('<div class="fc-clear"/>'); 12543 } 12544 else { 12545 this.removeElement(); 12546 } 12547 }; 12548 Toolbar.prototype.removeElement = function () { 12549 if (this.el) { 12550 this.el.remove(); 12551 this.el = null; 12552 } 12553 }; 12554 Toolbar.prototype.renderSection = function (position) { 12555 var _this = this; 12556 var calendar = this.calendar; 12557 var theme = calendar.theme; 12558 var optionsManager = calendar.optionsManager; 12559 var viewSpecManager = calendar.viewSpecManager; 12560 var sectionEl = $('<div class="fc-' + position + '"/>'); 12561 var buttonStr = this.toolbarOptions.layout[position]; 12562 var calendarCustomButtons = optionsManager.get('customButtons') || {}; 12563 var calendarButtonTextOverrides = optionsManager.overrides.buttonText || {}; 12564 var calendarButtonText = optionsManager.get('buttonText') || {}; 12565 if (buttonStr) { 12566 $.each(buttonStr.split(' '), function (i, buttonGroupStr) { 12567 var groupChildren = $(); 12568 var isOnlyButtons = true; 12569 var groupEl; 12570 $.each(buttonGroupStr.split(','), function (j, buttonName) { 12571 var customButtonProps; 12572 var viewSpec; 12573 var buttonClick; 12574 var buttonIcon; // only one of these will be set 12575 var buttonText; // " 12576 var buttonInnerHtml; 12577 var buttonClasses; 12578 var buttonEl; 12579 var buttonAriaAttr; 12580 if (buttonName === 'title') { 12581 groupChildren = groupChildren.add($('<h2> </h2>')); // we always want it to take up height 12582 isOnlyButtons = false; 12583 } 12584 else { 12585 if ((customButtonProps = calendarCustomButtons[buttonName])) { 12586 buttonClick = function (ev) { 12587 if (customButtonProps.click) { 12588 customButtonProps.click.call(buttonEl[0], ev); 12589 } 12590 }; 12591 (buttonIcon = theme.getCustomButtonIconClass(customButtonProps)) || 12592 (buttonIcon = theme.getIconClass(buttonName)) || 12593 (buttonText = customButtonProps.text); 12594 } 12595 else if ((viewSpec = viewSpecManager.getViewSpec(buttonName))) { 12596 _this.viewsWithButtons.push(buttonName); 12597 buttonClick = function () { 12598 calendar.changeView(buttonName); 12599 }; 12600 (buttonText = viewSpec.buttonTextOverride) || 12601 (buttonIcon = theme.getIconClass(buttonName)) || 12602 (buttonText = viewSpec.buttonTextDefault); 12603 } 12604 else if (calendar[buttonName]) { 12605 buttonClick = function () { 12606 calendar[buttonName](); 12607 }; 12608 (buttonText = calendarButtonTextOverrides[buttonName]) || 12609 (buttonIcon = theme.getIconClass(buttonName)) || 12610 (buttonText = calendarButtonText[buttonName]); 12611 // ^ everything else is considered default 12612 } 12613 if (buttonClick) {
12614 buttonClasses = [ 12615 'fc-' + buttonName + '-button', 12616 theme.getClass('button'), 12617 theme.getClass('stateDefault') 12618 ]; 12619 if (buttonText) { 12620 buttonInnerHtml = util_1.htmlEscape(buttonText); 12621 buttonAriaAttr = ''; 12622 } 12623 else if (buttonIcon) { 12624 buttonInnerHtml = "<span class='" + buttonIcon + "'></span>"; 12625 buttonAriaAttr = ' aria-label="' + buttonName + '"'; 12626 } 12627 buttonEl = $(// type="button" so that it doesn't submit a form 12628 '<button type="button" class="' + buttonClasses.join(' ') + '"' + 12629 buttonAriaAttr + 12630 '>' + buttonInnerHtml + '</button>') 12631 .click(function (ev) { 12632 // don't process clicks for disabled buttons 12633 if (!buttonEl.hasClass(theme.getClass('stateDisabled'))) { 12634 buttonClick(ev); 12635 // after the click action, if the button becomes the "active" tab, or disabled, 12636 // it should never have a hover class, so remove it now. 12637 if (buttonEl.hasClass(theme.getClass('stateActive')) || 12638 buttonEl.hasClass(theme.getClass('stateDisabled'))) { 12639 buttonEl.removeClass(theme.getClass('stateHover')); 12640 } 12641 } 12642 }) 12643 .mousedown(function () { 12644 // the *down* effect (mouse pressed in). 12645 // only on buttons that are not the "active" tab, or disabled 12646 buttonEl 12647 .not('.' + theme.getClass('stateActive')) 12648 .not('.' + theme.getClass('stateDisabled')) 12649 .addClass(theme.getClass('stateDown')); 12650 }) 12651 .mouseup(function () { 12652 // undo the *down* effect 12653 buttonEl.removeClass(theme.getClass('stateDown')); 12654 }) 12655 .hover(function () { 12656 // the *hover* effect. 12657 // only on buttons that are not the "active" tab, or disabled 12658 buttonEl 12659 .not('.' + theme.getClass('stateActive')) 12660 .not('.' + theme.getClass('stateDisabled')) 12661 .addClass(theme.getClass('stateHover')); 12662 }, function () { 12663 // undo the *hover* effect 12664 buttonEl 12665 .removeClass(theme.getClass('stateHover')) 12666 .removeClass(theme.getClass('stateDown')); // if mouseleave happens before mouseup 12667 }); 12668 groupChildren = groupChildren.add(buttonEl); 12669 } 12670 } 12671 }); 12672 if (isOnlyButtons) { 12673 groupChildren 12674 .first().addClass(theme.getClass('cornerLeft')).end() 12675 .last().addClass(theme.getClass('cornerRight')).end(); 12676 } 12677 if (groupChildren.length > 1) { 12678 groupEl = $('<div/>'); 12679 if (isOnlyButtons) { 12680 groupEl.addClass(theme.getClass('buttonGroup')); 12681 } 12682 groupEl.append(groupChildren); 12683 sectionEl.append(groupEl); 12684 } 12685 else { 12686 sectionEl.append(groupChildren); // 1 or 0 children 12687 } 12688 }); 12689 } 12690 return sectionEl; 12691 }; 12692 Toolbar.prototype.updateTitle = function (text) { 12693 if (this.el) { 12694 this.el.find('h2').text(text); 12695 } 12696 }; 12697 Toolbar.prototype.activateButton = function (buttonName) { 12698 if (this.el) { 12699 this.el.find('.fc-' + buttonName + '-button') 12700 .addClass(this.calendar.theme.getClass('stateActive')); 12701 } 12702 }; 12703 Toolbar.prototype.deactivateButton = function (buttonName) { 12704 if (this.el) { 12705 this.el.find('.fc-' + buttonName + '-button') 12706 .removeClass(this.calendar.theme.getClass('stateActive')); 12707 } 12708 }; 12709 Toolbar.prototype.disableButton = function (buttonName) { 12710 if (this.el) { 12711 this.el.find('.fc-' + buttonName + '-button') 12712 .prop('disabled', true) 12713 .addClass(this.calendar.theme.getClass('stateDisabled')); 12714 } 12715 }; 12716 Toolbar.prototype.enableButton = function (buttonName) { 12717 if (this.el) { 12718 this.el.find('.fc-' + buttonName + '-button') 12719 .prop('disabled', false) 12720 .removeClass(this.calendar.theme.getClass('stateDisabled')); 12721 } 12722 }; 12723 Toolbar.prototype.getViewsWithButtons = function () { 12724 return this.viewsWithButtons; 12725 }; 12726 return Toolbar; 12727}()); 12728exports.default = Toolbar; 12729 12730 12731/***/ }), 12732/* 240 */ 12733/***/ (function(module, exports, __webpack_require__) { 12734 12735Object.defineProperty(exports, "__esModule", { value: true });
12736var tslib_1 = __webpack_require__(2); 12737var $ = __webpack_require__(3); 12738var util_1 = __webpack_require__(4); 12739var options_1 = __webpack_require__(32); 12740var locale_1 = __webpack_require__(31); 12741var Model_1 = __webpack_require__(48); 12742var OptionsManager = /** @class */ (function (_super) { 12743 tslib_1.__extends(OptionsManager, _super); 12744 function OptionsManager(_calendar, overrides) { 12745 var _this = _super.call(this) || this; 12746 _this._calendar = _calendar; 12747 _this.overrides = $.extend({}, overrides); // make a copy 12748 _this.dynamicOverrides = {}; 12749 _this.compute(); 12750 return _this; 12751 } 12752 OptionsManager.prototype.add = function (newOptionHash) { 12753 var optionCnt = 0; 12754 var optionName; 12755 this.recordOverrides(newOptionHash); // will trigger this model's watchers 12756 for (optionName in newOptionHash) { 12757 optionCnt++; 12758 } 12759 // special-case handling of single option change. 12760 // if only one option change, `optionName` will be its name. 12761 if (optionCnt === 1) { 12762 if (optionName === 'height' || optionName === 'contentHeight' || optionName === 'aspectRatio') { 12763 this._calendar.updateViewSize(true); // isResize=true 12764 return; 12765 } 12766 else if (optionName === 'defaultDate') { 12767 return; // can't change date this way. use gotoDate instead 12768 } 12769 else if (optionName === 'businessHours') { 12770 return; // this model already reacts to this 12771 } 12772 else if (/^(event|select)(Overlap|Constraint|Allow)$/.test(optionName)) { 12773 return; // doesn't affect rendering. only interactions. 12774 } 12775 else if (optionName === 'timezone') { 12776 this._calendar.view.flash('initialEvents'); 12777 return; 12778 } 12779 } 12780 // catch-all. rerender the header and footer and rebuild/rerender the current view 12781 this._calendar.renderHeader(); 12782 this._calendar.renderFooter(); 12783 // even non-current views will be affected by this option change. do before rerender 12784 // TODO: detangle 12785 this._calendar.viewsByType = {}; 12786 this._calendar.reinitView(); 12787 }; 12788 // Computes the flattened options hash for the calendar and assigns to `this.options`. 12789 // Assumes this.overrides and this.dynamicOverrides have already been initialized. 12790 OptionsManager.prototype.compute = function () { 12791 var locale; 12792 var localeDefaults; 12793 var isRTL; 12794 var dirDefaults; 12795 var rawOptions; 12796 locale = util_1.firstDefined(// explicit locale option given? 12797 this.dynamicOverrides.locale, this.overrides.locale); 12798 localeDefaults = locale_1.localeOptionHash[locale]; 12799 if (!localeDefaults) { 12800 locale = options_1.globalDefaults.locale; 12801 localeDefaults = locale_1.localeOptionHash[locale] || {}; 12802 } 12803 isRTL = util_1.firstDefined(// based on options computed so far, is direction RTL? 12804 this.dynamicOverrides.isRTL, this.overrides.isRTL, localeDefaults.isRTL, options_1.globalDefaults.isRTL); 12805 dirDefaults = isRTL ? options_1.rtlDefaults : {}; 12806 this.dirDefaults = dirDefaults; 12807 this.localeDefaults = localeDefaults; 12808 rawOptions = options_1.mergeOptions([ 12809 options_1.globalDefaults, 12810 dirDefaults, 12811 localeDefaults, 12812 this.overrides, 12813 this.dynamicOverrides 12814 ]); 12815 locale_1.populateInstanceComputableOptions(rawOptions); // fill in gaps with computed options 12816 this.reset(rawOptions); 12817 }; 12818 // stores the new options internally, but does not rerender anything. 12819 OptionsManager.prototype.recordOverrides = function (newOptionHash) { 12820 var optionName; 12821 for (optionName in newOptionHash) { 12822 this.dynamicOverrides[optionName] = newOptionHash[optionName]; 12823 } 12824 this._calendar.viewSpecManager.clearCache(); // the dynamic override invalidates the options in this cache, so just clear it 12825 this.compute(); // this.options needs to be recomputed after the dynamic override 12826 }; 12827 return OptionsManager; 12828}(Model_1.default)); 12829exports.default = OptionsManager; 12830 12831 12832/***/ }), 12833/* 241 */ 12834/***/ (function(module, exports, __webpack_require__) { 12835 12836Object.defineProperty(exports, "__esModule", { value: true });
12837var moment = __webpack_require__(0); 12838var $ = __webpack_require__(3); 12839var ViewRegistry_1 = __webpack_require__(22); 12840var util_1 = __webpack_require__(4); 12841var options_1 = __webpack_require__(32); 12842var locale_1 = __webpack_require__(31); 12843var ViewSpecManager = /** @class */ (function () { 12844 function ViewSpecManager(optionsManager, _calendar) { 12845 this.optionsManager = optionsManager; 12846 this._calendar = _calendar; 12847 this.clearCache(); 12848 } 12849 ViewSpecManager.prototype.clearCache = function () { 12850 this.viewSpecCache = {}; 12851 }; 12852 // Gets information about how to create a view. Will use a cache. 12853 ViewSpecManager.prototype.getViewSpec = function (viewType) { 12854 var cache = this.viewSpecCache; 12855 return cache[viewType] || (cache[viewType] = this.buildViewSpec(viewType)); 12856 }; 12857 // Given a duration singular unit, like "week" or "day", finds a matching view spec. 12858 // Preference is given to views that have corresponding buttons. 12859 ViewSpecManager.prototype.getUnitViewSpec = function (unit) { 12860 var viewTypes; 12861 var i; 12862 var spec; 12863 if ($.inArray(unit, util_1.unitsDesc) !== -1) { 12864 // put views that have buttons first. there will be duplicates, but oh well 12865 viewTypes = this._calendar.header.getViewsWithButtons(); // TODO: include footer as well? 12866 $.each(ViewRegistry_1.viewHash, function (viewType) { 12867 viewTypes.push(viewType); 12868 }); 12869 for (i = 0; i < viewTypes.length; i++) { 12870 spec = this.getViewSpec(viewTypes[i]); 12871 if (spec) { 12872 if (spec.singleUnit === unit) { 12873 return spec; 12874 } 12875 } 12876 } 12877 } 12878 }; 12879 // Builds an object with information on how to create a given view 12880 ViewSpecManager.prototype.buildViewSpec = function (requestedViewType) { 12881 var viewOverrides = this.optionsManager.overrides.views || {}; 12882 var specChain = []; // for the view. lowest to highest priority 12883 var defaultsChain = []; // for the view. lowest to highest priority 12884 var overridesChain = []; // for the view. lowest to highest priority 12885 var viewType = requestedViewType; 12886 var spec; // for the view 12887 var overrides; // for the view 12888 var durationInput; 12889 var duration; 12890 var unit; 12891 // iterate from the specific view definition to a more general one until we hit an actual View class 12892 while (viewType) { 12893 spec = ViewRegistry_1.viewHash[viewType]; 12894 overrides = viewOverrides[viewType]; 12895 viewType = null; // clear. might repopulate for another iteration 12896 if (typeof spec === 'function') { 12897 spec = { 'class': spec }; 12898 } 12899 if (spec) { 12900 specChain.unshift(spec); 12901 defaultsChain.unshift(spec.defaults || {}); 12902 durationInput = durationInput || spec.duration; 12903 viewType = viewType || spec.type; 12904 } 12905 if (overrides) { 12906 overridesChain.unshift(overrides); // view-specific option hashes have options at zero-level 12907 durationInput = durationInput || overrides.duration; 12908 viewType = viewType || overrides.type; 12909 } 12910 } 12911 spec = util_1.mergeProps(specChain); 12912 spec.type = requestedViewType; 12913 if (!spec['class']) { 12914 return false; 12915 } 12916 // fall back to top-level `duration` option 12917 durationInput = durationInput || 12918 this.optionsManager.dynamicOverrides.duration || 12919 this.optionsManager.overrides.duration; 12920 if (durationInput) { 12921 duration = moment.duration(durationInput); 12922 if (duration.valueOf()) { 12923 unit = util_1.computeDurationGreatestUnit(duration, durationInput); 12924 spec.duration = duration; 12925 spec.durationUnit = unit; 12926 // view is a single-unit duration, like "week" or "day" 12927 // incorporate options for this. lowest priority 12928 if (duration.as(unit) === 1) { 12929 spec.singleUnit = unit; 12930 overridesChain.unshift(viewOverrides[unit] || {}); 12931 } 12932 } 12933 } 12934 spec.defaults = options_1.mergeOptions(defaultsChain); 12935 spec.overrides = options_1.mergeOptions(overridesChain); 12936 this.buildViewSpecOptions(spec); 12937 this.buildViewSpecButtonText(spec, requestedViewType); 12938 return spec; 12939 }; 12940 // Builds and assigns a view spec's options object from its already-assigned defaults and overrides 12941 ViewSpecManager.prototype.buildViewSpecOptions = function (spec) { 12942 var optionsManager = this.optionsManager; 12943 spec.options = options_1.mergeOptions([ 12944 options_1.globalDefaults, 12945 spec.defaults, 12946 optionsManager.dirDefaults, 12947 optionsManager.localeDefaults, 12948 optionsManager.overrides, 12949 spec.overrides, 12950 optionsManager.dynamicOverrides // dynamically set via setter. highest precedence 12951 ]); 12952 locale_1.populateInstanceComputableOptions(spec.options); 12953 }; 12954 // Computes and assigns a view spec's buttonText-related options 12955 ViewSpecManager.prototype.buildViewSpecButtonText = function (spec, requestedViewType) { 12956 var optionsManager = this.optionsManager; 12957 // given an options object with a possible `buttonText` hash, lookup the buttonText for the 12958 // requested view, falling back to a generic unit entry like "week" or "day" 12959 function queryButtonText(options) { 12960 var buttonText = options.buttonText || {}; 12961 return buttonText[requestedViewType] || 12962 // view can decide to look up a certain key 12963 (spec.buttonTextKey ? buttonText[spec.buttonTextKey] : null) || 12964 // a key like "month" 12965 (spec.singleUnit ? buttonText[spec.singleUnit] : null); 12966 } 12967 // highest to lowest priority 12968 spec.buttonTextOverride = 12969 queryButtonText(optionsManager.dynamicOverrides) || 12970 queryButtonText(optionsManager.overrides) || // constructor-specified buttonText lookup hash takes precedence 12971 spec.overrides.buttonText; // `buttonText` for view-specific options is a string 12972 // highest to lowest priority. mirrors buildViewSpecOptions 12973 spec.buttonTextDefault = 12974 queryButtonText(optionsManager.localeDefaults) || 12975 queryButtonText(optionsManager.dirDefaults) ||
12976 spec.defaults.buttonText || // a single string. from ViewSubclass.defaults 12977 queryButtonText(options_1.globalDefaults) || 12978 (spec.duration ? this._calendar.humanizeDuration(spec.duration) : null) || // like "3 days" 12979 requestedViewType; // fall back to given view name 12980 }; 12981 return ViewSpecManager; 12982}()); 12983exports.default = ViewSpecManager; 12984 12985 12986/***/ }), 12987/* 242 */ 12988/***/ (function(module, exports, __webpack_require__) { 12989 12990Object.defineProperty(exports, "__esModule", { value: true }); 12991var $ = __webpack_require__(3); 12992var util_1 = __webpack_require__(4); 12993var EventPeriod_1 = __webpack_require__(243); 12994var ArrayEventSource_1 = __webpack_require__(52); 12995var EventSource_1 = __webpack_require__(6); 12996var EventSourceParser_1 = __webpack_require__(38); 12997var SingleEventDef_1 = __webpack_require__(13); 12998var EventInstanceGroup_1 = __webpack_require__(18); 12999var EmitterMixin_1 = __webpack_require__(11); 13000var ListenerMixin_1 = __webpack_require__(7); 13001var EventManager = /** @class */ (function () { 13002 function EventManager(calendar) { 13003 this.calendar = calendar; 13004 this.stickySource = new ArrayEventSource_1.default(calendar); 13005 this.otherSources = []; 13006 } 13007 EventManager.prototype.requestEvents = function (start, end, timezone, force) { 13008 if (force || 13009 !this.currentPeriod || 13010 !this.currentPeriod.isWithinRange(start, end) || 13011 timezone !== this.currentPeriod.timezone) { 13012 this.setPeriod(// will change this.currentPeriod 13013 new EventPeriod_1.default(start, end, timezone)); 13014 } 13015 return this.currentPeriod.whenReleased(); 13016 }; 13017 // Source Adding/Removing 13018 // ----------------------------------------------------------------------------------------------------------------- 13019 EventManager.prototype.addSource = function (eventSource) { 13020 this.otherSources.push(eventSource); 13021 if (this.currentPeriod) { 13022 this.currentPeriod.requestSource(eventSource); // might release 13023 } 13024 }; 13025 EventManager.prototype.removeSource = function (doomedSource) { 13026 util_1.removeExact(this.otherSources, doomedSource); 13027 if (this.currentPeriod) { 13028 this.currentPeriod.purgeSource(doomedSource); // might release 13029 } 13030 }; 13031 EventManager.prototype.removeAllSources = function () { 13032 this.otherSources = []; 13033 if (this.currentPeriod) { 13034 this.currentPeriod.purgeAllSources(); // might release 13035 } 13036 }; 13037 // Source Refetching 13038 // ----------------------------------------------------------------------------------------------------------------- 13039 EventManager.prototype.refetchSource = function (eventSource) { 13040 var currentPeriod = this.currentPeriod; 13041 if (currentPeriod) { 13042 currentPeriod.freeze(); 13043 currentPeriod.purgeSource(eventSource); 13044 currentPeriod.requestSource(eventSource); 13045 currentPeriod.thaw(); 13046 } 13047 }; 13048 EventManager.prototype.refetchAllSources = function () { 13049 var currentPeriod = this.currentPeriod; 13050 if (currentPeriod) { 13051 currentPeriod.freeze(); 13052 currentPeriod.purgeAllSources(); 13053 currentPeriod.requestSources(this.getSources()); 13054 currentPeriod.thaw(); 13055 } 13056 }; 13057 // Source Querying 13058 // ----------------------------------------------------------------------------------------------------------------- 13059 EventManager.prototype.getSources = function () { 13060 return [this.stickySource].concat(this.otherSources); 13061 }; 13062 // like querySources, but accepts multple match criteria (like multiple IDs) 13063 EventManager.prototype.multiQuerySources = function (matchInputs) { 13064 // coerce into an array 13065 if (!matchInputs) { 13066 matchInputs = []; 13067 } 13068 else if (!$.isArray(matchInputs)) { 13069 matchInputs = [matchInputs]; 13070 } 13071 var matchingSources = []; 13072 var i; 13073 // resolve raw inputs to real event source objects 13074 for (i = 0; i < matchInputs.length; i++) { 13075 matchingSources.push.apply(// append 13076 matchingSources, this.querySources(matchInputs[i])); 13077 } 13078 return matchingSources; 13079 }; 13080 // matchInput can either by a real event source object, an ID, or the function/URL for the source. 13081 // returns an array of matching source objects. 13082 EventManager.prototype.querySources = function (matchInput) { 13083 var sources = this.otherSources; 13084 var i; 13085 var source; 13086 // given a proper event source object 13087 for (i = 0; i < sources.length; i++) { 13088 source = sources[i];
13089 if (source === matchInput) { 13090 return [source]; 13091 } 13092 } 13093 // an ID match 13094 source = this.getSourceById(EventSource_1.default.normalizeId(matchInput)); 13095 if (source) { 13096 return [source]; 13097 } 13098 // parse as an event source 13099 matchInput = EventSourceParser_1.default.parse(matchInput, this.calendar); 13100 if (matchInput) { 13101 return $.grep(sources, function (source) { 13102 return isSourcesEquivalent(matchInput, source); 13103 }); 13104 } 13105 }; 13106 /* 13107 ID assumed to already be normalized 13108 */ 13109 EventManager.prototype.getSourceById = function (id) { 13110 return $.grep(this.otherSources, function (source) { 13111 return source.id && source.id === id; 13112 })[0]; 13113 }; 13114 // Event-Period 13115 // ----------------------------------------------------------------------------------------------------------------- 13116 EventManager.prototype.setPeriod = function (eventPeriod) { 13117 if (this.currentPeriod) { 13118 this.unbindPeriod(this.currentPeriod); 13119 this.currentPeriod = null; 13120 } 13121 this.currentPeriod = eventPeriod; 13122 this.bindPeriod(eventPeriod); 13123 eventPeriod.requestSources(this.getSources()); 13124 }; 13125 EventManager.prototype.bindPeriod = function (eventPeriod) { 13126 this.listenTo(eventPeriod, 'release', function (eventsPayload) { 13127 this.trigger('release', eventsPayload); 13128 }); 13129 }; 13130 EventManager.prototype.unbindPeriod = function (eventPeriod) { 13131 this.stopListeningTo(eventPeriod); 13132 }; 13133 // Event Getting/Adding/Removing 13134 // ----------------------------------------------------------------------------------------------------------------- 13135 EventManager.prototype.getEventDefByUid = function (uid) { 13136 if (this.currentPeriod) { 13137 return this.currentPeriod.getEventDefByUid(uid); 13138 } 13139 }; 13140 EventManager.prototype.addEventDef = function (eventDef, isSticky) { 13141 if (isSticky) { 13142 this.stickySource.addEventDef(eventDef); 13143 } 13144 if (this.currentPeriod) { 13145 this.currentPeriod.addEventDef(eventDef); // might release 13146 } 13147 }; 13148 EventManager.prototype.removeEventDefsById = function (eventId) {
13149 this.getSources().forEach(function (eventSource) { 13150 eventSource.removeEventDefsById(eventId); 13151 }); 13152 if (this.currentPeriod) { 13153 this.currentPeriod.removeEventDefsById(eventId); // might release 13154 } 13155 }; 13156 EventManager.prototype.removeAllEventDefs = function () { 13157 this.getSources().forEach(function (eventSource) { 13158 eventSource.removeAllEventDefs(); 13159 }); 13160 if (this.currentPeriod) { 13161 this.currentPeriod.removeAllEventDefs(); 13162 } 13163 }; 13164 // Event Mutating 13165 // ----------------------------------------------------------------------------------------------------------------- 13166 /* 13167 Returns an undo function. 13168 */ 13169 EventManager.prototype.mutateEventsWithId = function (eventDefId, eventDefMutation) { 13170 var currentPeriod = this.currentPeriod; 13171 var eventDefs; 13172 var undoFuncs = []; 13173 if (currentPeriod) { 13174 currentPeriod.freeze(); 13175 eventDefs = currentPeriod.getEventDefsById(eventDefId); 13176 eventDefs.forEach(function (eventDef) { 13177 // add/remove esp because id might change 13178 currentPeriod.removeEventDef(eventDef); 13179 undoFuncs.push(eventDefMutation.mutateSingle(eventDef)); 13180 currentPeriod.addEventDef(eventDef); 13181 }); 13182 currentPeriod.thaw(); 13183 return function () { 13184 currentPeriod.freeze(); 13185 for (var i = 0; i < eventDefs.length; i++) { 13186 currentPeriod.removeEventDef(eventDefs[i]); 13187 undoFuncs[i](); 13188 currentPeriod.addEventDef(eventDefs[i]); 13189 } 13190 currentPeriod.thaw(); 13191 }; 13192 } 13193 return function () { }; 13194 }; 13195 /* 13196 copies and then mutates 13197 */ 13198 EventManager.prototype.buildMutatedEventInstanceGroup = function (eventDefId, eventDefMutation) { 13199 var eventDefs = this.getEventDefsById(eventDefId); 13200 var i; 13201 var defCopy; 13202 var allInstances = []; 13203 for (i = 0; i < eventDefs.length; i++) { 13204 defCopy = eventDefs[i].clone(); 13205 if (defCopy instanceof SingleEventDef_1.default) { 13206 eventDefMutation.mutateSingle(defCopy); 13207 allInstances.push.apply(allInstances, // append 13208 defCopy.buildInstances()); 13209 } 13210 } 13211 return new EventInstanceGroup_1.default(allInstances); 13212 }; 13213 // Freezing 13214 // ----------------------------------------------------------------------------------------------------------------- 13215 EventManager.prototype.freeze = function () { 13216 if (this.currentPeriod) { 13217 this.currentPeriod.freeze(); 13218 } 13219 }; 13220 EventManager.prototype.thaw = function () { 13221 if (this.currentPeriod) { 13222 this.currentPeriod.thaw(); 13223 } 13224 }; 13225 // methods that simply forward to EventPeriod 13226 EventManager.prototype.getEventDefsById = function (eventDefId) { 13227 return this.currentPeriod.getEventDefsById(eventDefId); 13228 }; 13229 EventManager.prototype.getEventInstances = function () { 13230 return this.currentPeriod.getEventInstances(); 13231 }; 13232 EventManager.prototype.getEventInstancesWithId = function (eventDefId) { 13233 return this.currentPeriod.getEventInstancesWithId(eventDefId); 13234 }; 13235 EventManager.prototype.getEventInstancesWithoutId = function (eventDefId) { 13236 return this.currentPeriod.getEventInstancesWithoutId(eventDefId); 13237 }; 13238 return EventManager; 13239}()); 13240exports.default = EventManager; 13241EmitterMixin_1.default.mixInto(EventManager); 13242ListenerMixin_1.default.mixInto(EventManager); 13243function isSourcesEquivalent(source0, source1) { 13244 return source0.getPrimitive() === source1.getPrimitive(); 13245} 13246 13247 13248/***/ }), 13249/* 243 */ 13250/***/ (function(module, exports, __webpack_require__) { 13251 13252Object.defineProperty(exports, "__esModule", { value: true }); 13253var $ = __webpack_require__(3); 13254var util_1 = __webpack_require__(4); 13255var Promise_1 = __webpack_require__(20); 13256var EmitterMixin_1 = __webpack_require__(11); 13257var UnzonedRange_1 = __webpack_require__(5); 13258var EventInstanceGroup_1 = __webpack_require__(18); 13259var EventPeriod = /** @class */ (function () { 13260 function EventPeriod(start, end, timezone) { 13261 this.pendingCnt = 0; 13262 this.freezeDepth = 0; 13263 this.stuntedReleaseCnt = 0; 13264 this.releaseCnt = 0; 13265 this.start = start; 13266 this.end = end; 13267 this.timezone = timezone; 13268 this.unzonedRange = new UnzonedRange_1.default(start.clone().stripZone(), end.clone().stripZone()); 13269 this.requestsByUid = {}; 13270 this.eventDefsByUid = {}; 13271 this.eventDefsById = {}; 13272 this.eventInstanceGroupsById = {}; 13273 } 13274 EventPeriod.prototype.isWithinRange = function (start, end) { 13275 // TODO: use a range util function? 13276 return !start.isBefore(this.start) && !end.isAfter(this.end); 13277 }; 13278 // Requesting and Purging 13279 // ----------------------------------------------------------------------------------------------------------------- 13280 EventPeriod.prototype.requestSources = function (sources) { 13281 this.freeze(); 13282 for (var i = 0; i < sources.length; i++) { 13283 this.requestSource(sources[i]); 13284 } 13285 this.thaw(); 13286 }; 13287 EventPeriod.prototype.requestSource = function (source) { 13288 var _this = this; 13289 var request = { source: source, status: 'pending', eventDefs: null }; 13290 this.requestsByUid[source.uid] = request; 13291 this.pendingCnt += 1; 13292 source.fetch(this.start, this.end, this.timezone).then(function (eventDefs) { 13293 if (request.status !== 'cancelled') { 13294 request.status = 'completed'; 13295 request.eventDefs = eventDefs; 13296 _this.addEventDefs(eventDefs); 13297 _this.pendingCnt--; 13298 _this.tryRelease(); 13299 } 13300 }, function () { 13301 if (request.status !== 'cancelled') { 13302 request.status = 'failed'; 13303 _this.pendingCnt--; 13304 _this.tryRelease(); 13305 } 13306 }); 13307 }; 13308 EventPeriod.prototype.purgeSource = function (source) { 13309 var request = this.requestsByUid[source.uid]; 13310 if (request) { 13311 delete this.requestsByUid[source.uid]; 13312 if (request.status === 'pending') { 13313 request.status = 'cancelled'; 13314 this.pendingCnt--; 13315 this.tryRelease(); 13316 } 13317 else if (request.status === 'completed') {
13318 request.eventDefs.forEach(this.removeEventDef.bind(this)); 13319 } 13320 } 13321 }; 13322 EventPeriod.prototype.purgeAllSources = function () { 13323 var requestsByUid = this.requestsByUid; 13324 var uid; 13325 var request; 13326 var completedCnt = 0; 13327 for (uid in requestsByUid) { 13328 request = requestsByUid[uid]; 13329 if (request.status === 'pending') { 13330 request.status = 'cancelled'; 13331 } 13332 else if (request.status === 'completed') { 13333 completedCnt++; 13334 } 13335 } 13336 this.requestsByUid = {}; 13337 this.pendingCnt = 0; 13338 if (completedCnt) { 13339 this.removeAllEventDefs(); // might release 13340 } 13341 }; 13342 // Event Definitions 13343 // ----------------------------------------------------------------------------------------------------------------- 13344 EventPeriod.prototype.getEventDefByUid = function (eventDefUid) { 13345 return this.eventDefsByUid[eventDefUid]; 13346 }; 13347 EventPeriod.prototype.getEventDefsById = function (eventDefId) { 13348 var a = this.eventDefsById[eventDefId]; 13349 if (a) { 13350 return a.slice(); // clone 13351 } 13352 return []; 13353 }; 13354 EventPeriod.prototype.addEventDefs = function (eventDefs) { 13355 for (var i = 0; i < eventDefs.length; i++) { 13356 this.addEventDef(eventDefs[i]); 13357 } 13358 }; 13359 EventPeriod.prototype.addEventDef = function (eventDef) { 13360 var eventDefsById = this.eventDefsById; 13361 var eventDefId = eventDef.id; 13362 var eventDefs = eventDefsById[eventDefId] || (eventDefsById[eventDefId] = []); 13363 var eventInstances = eventDef.buildInstances(this.unzonedRange); 13364 var i; 13365 eventDefs.push(eventDef); 13366 this.eventDefsByUid[eventDef.uid] = eventDef; 13367 for (i = 0; i < eventInstances.length; i++) { 13368 this.addEventInstance(eventInstances[i], eventDefId); 13369 } 13370 }; 13371 EventPeriod.prototype.removeEventDefsById = function (eventDefId) { 13372 var _this = this; 13373 this.getEventDefsById(eventDefId).forEach(function (eventDef) { 13374 _this.removeEventDef(eventDef); 13375 }); 13376 }; 13377 EventPeriod.prototype.removeAllEventDefs = function () { 13378 var isEmpty = $.isEmptyObject(this.eventDefsByUid); 13379 this.eventDefsByUid = {}; 13380 this.eventDefsById = {}; 13381 this.eventInstanceGroupsById = {}; 13382 if (!isEmpty) { 13383 this.tryRelease(); 13384 } 13385 }; 13386 EventPeriod.prototype.removeEventDef = function (eventDef) { 13387 var eventDefsById = this.eventDefsById; 13388 var eventDefs = eventDefsById[eventDef.id]; 13389 delete this.eventDefsByUid[eventDef.uid]; 13390 if (eventDefs) { 13391 util_1.removeExact(eventDefs, eventDef); 13392 if (!eventDefs.length) { 13393 delete eventDefsById[eventDef.id]; 13394 } 13395 this.removeEventInstancesForDef(eventDef); 13396 } 13397 }; 13398 // Event Instances 13399 // ----------------------------------------------------------------------------------------------------------------- 13400 EventPeriod.prototype.getEventInstances = function () { 13401 var eventInstanceGroupsById = this.eventInstanceGroupsById; 13402 var eventInstances = []; 13403 var id; 13404 for (id in eventInstanceGroupsById) { 13405 eventInstances.push.apply(eventInstances, // append 13406 eventInstanceGroupsById[id].eventInstances); 13407 } 13408 return eventInstances; 13409 }; 13410 EventPeriod.prototype.getEventInstancesWithId = function (eventDefId) { 13411 var eventInstanceGroup = this.eventInstanceGroupsById[eventDefId]; 13412 if (eventInstanceGroup) { 13413 return eventInstanceGroup.eventInstances.slice(); // clone 13414 } 13415 return []; 13416 }; 13417 EventPeriod.prototype.getEventInstancesWithoutId = function (eventDefId) { 13418 var eventInstanceGroupsById = this.eventInstanceGroupsById; 13419 var matchingInstances = []; 13420 var id; 13421 for (id in eventInstanceGroupsById) { 13422 if (id !== eventDefId) { 13423 matchingInstances.push.apply(matchingInstances, // append 13424 eventInstanceGroupsById[id].eventInstances); 13425 } 13426 } 13427 return matchingInstances; 13428 }; 13429 EventPeriod.prototype.addEventInstance = function (eventInstance, eventDefId) { 13430 var eventInstanceGroupsById = this.eventInstanceGroupsById; 13431 var eventInstanceGroup = eventInstanceGroupsById[eventDefId] || 13432 (eventInstanceGroupsById[eventDefId] = new EventInstanceGroup_1.default()); 13433 eventInstanceGroup.eventInstances.push(eventInstance); 13434 this.tryRelease(); 13435 }; 13436 EventPeriod.prototype.removeEventInstancesForDef = function (eventDef) { 13437 var eventInstanceGroupsById = this.eventInstanceGroupsById; 13438 var eventInstanceGroup = eventInstanceGroupsById[eventDef.id]; 13439 var removeCnt; 13440 if (eventInstanceGroup) { 13441 removeCnt = util_1.removeMatching(eventInstanceGroup.eventInstances, function (currentEventInstance) { 13442 return currentEventInstance.def === eventDef; 13443 }); 13444 if (!eventInstanceGroup.eventInstances.length) { 13445 delete eventInstanceGroupsById[eventDef.id]; 13446 } 13447 if (removeCnt) { 13448 this.tryRelease(); 13449 } 13450 } 13451 }; 13452 // Releasing and Freezing 13453 // ----------------------------------------------------------------------------------------------------------------- 13454 EventPeriod.prototype.tryRelease = function () { 13455 if (!this.pendingCnt) { 13456 if (!this.freezeDepth) { 13457 this.release(); 13458 } 13459 else { 13460 this.stuntedReleaseCnt++; 13461 } 13462 } 13463 }; 13464 EventPeriod.prototype.release = function () { 13465 this.releaseCnt++; 13466 this.trigger('release', this.eventInstanceGroupsById); 13467 }; 13468 EventPeriod.prototype.whenReleased = function () { 13469 var _this = this; 13470 if (this.releaseCnt) { 13471 return Promise_1.default.resolve(this.eventInstanceGroupsById); 13472 } 13473 else { 13474 return Promise_1.default.construct(function (onResolve) { 13475 _this.one('release', onResolve); 13476 }); 13477 } 13478 }; 13479 EventPeriod.prototype.freeze = function () { 13480 if (!(this.freezeDepth++)) { 13481 this.stuntedReleaseCnt = 0; 13482 } 13483 }; 13484 EventPeriod.prototype.thaw = function () { 13485 if (!(--this.freezeDepth) && this.stuntedReleaseCnt && !this.pendingCnt) { 13486 this.release(); 13487 } 13488 }; 13489 return EventPeriod; 13490}()); 13491exports.default = EventPeriod; 13492EmitterMixin_1.default.mixInto(EventPeriod); 13493 13494 13495/***/ }), 13496/* 244 */ 13497/***/ (function(module, exports, __webpack_require__) { 13498 13499Object.defineProperty(exports, "__esModule", { value: true });
13500var $ = __webpack_require__(3); 13501var util_1 = __webpack_require__(4); 13502var ListenerMixin_1 = __webpack_require__(7); 13503/* Creates a clone of an element and lets it track the mouse as it moves 13504----------------------------------------------------------------------------------------------------------------------*/ 13505var MouseFollower = /** @class */ (function () { 13506 function MouseFollower(sourceEl, options) { 13507 this.isFollowing = false; 13508 this.isHidden = false; 13509 this.isAnimating = false; // doing the revert animation? 13510 this.options = options = options || {}; 13511 this.sourceEl = sourceEl; 13512 this.parentEl = options.parentEl ? $(options.parentEl) : sourceEl.parent(); // default to sourceEl's parent 13513 } 13514 // Causes the element to start following the mouse 13515 MouseFollower.prototype.start = function (ev) { 13516 if (!this.isFollowing) { 13517 this.isFollowing = true; 13518 this.y0 = util_1.getEvY(ev); 13519 this.x0 = util_1.getEvX(ev); 13520 this.topDelta = 0; 13521 this.leftDelta = 0; 13522 if (!this.isHidden) { 13523 this.updatePosition(); 13524 } 13525 if (util_1.getEvIsTouch(ev)) { 13526 this.listenTo($(document), 'touchmove', this.handleMove); 13527 } 13528 else { 13529 this.listenTo($(document), 'mousemove', this.handleMove); 13530 } 13531 } 13532 }; 13533 // Causes the element to stop following the mouse. If shouldRevert is true, will animate back to original position. 13534 // `callback` gets invoked when the animation is complete. If no animation, it is invoked immediately. 13535 MouseFollower.prototype.stop = function (shouldRevert, callback) { 13536 var _this = this; 13537 var revertDuration = this.options.revertDuration; 13538 var complete = function () { 13539 _this.isAnimating = false; 13540 _this.removeElement(); 13541 _this.top0 = _this.left0 = null; // reset state for future updatePosition calls 13542 if (callback) { 13543 callback(); 13544 } 13545 }; 13546 if (this.isFollowing && !this.isAnimating) { 13547 this.isFollowing = false; 13548 this.stopListeningTo($(document)); 13549 if (shouldRevert && revertDuration && !this.isHidden) { 13550 this.isAnimating = true; 13551 this.el.animate({ 13552 top: this.top0, 13553 left: this.left0 13554 }, { 13555 duration: revertDuration, 13556 complete: complete 13557 }); 13558 } 13559 else { 13560 complete(); 13561 } 13562 } 13563 }; 13564 // Gets the tracking element. Create it if necessary 13565 MouseFollower.prototype.getEl = function () { 13566 var el = this.el; 13567 if (!el) { 13568 el = this.el = this.sourceEl.clone() 13569 .addClass(this.options.additionalClass || '') 13570 .css({ 13571 position: 'absolute', 13572 visibility: '', 13573 display: this.isHidden ? 'none' : '', 13574 margin: 0, 13575 right: 'auto', 13576 bottom: 'auto', 13577 width: this.sourceEl.width(), 13578 height: this.sourceEl.height(), 13579 opacity: this.options.opacity || '', 13580 zIndex: this.options.zIndex 13581 }); 13582 // we don't want long taps or any mouse interaction causing selection/menus. 13583 // would use preventSelection(), but that prevents selectstart, causing problems. 13584 el.addClass('fc-unselectable'); 13585 el.appendTo(this.parentEl); 13586 } 13587 return el; 13588 }; 13589 // Removes the tracking element if it has already been created 13590 MouseFollower.prototype.removeElement = function () { 13591 if (this.el) { 13592 this.el.remove(); 13593 this.el = null; 13594 } 13595 }; 13596 // Update the CSS position of the tracking element 13597 MouseFollower.prototype.updatePosition = function () { 13598 var sourceOffset; 13599 var origin; 13600 this.getEl(); // ensure this.el
13601 // make sure origin info was computed 13602 if (this.top0 == null) { 13603 sourceOffset = this.sourceEl.offset(); 13604 origin = this.el.offsetParent().offset(); 13605 this.top0 = sourceOffset.top - origin.top; 13606 this.left0 = sourceOffset.left - origin.left; 13607 } 13608 this.el.css({ 13609 top: this.top0 + this.topDelta, 13610 left: this.left0 + this.leftDelta 13611 }); 13612 }; 13613 // Gets called when the user moves the mouse 13614 MouseFollower.prototype.handleMove = function (ev) { 13615 this.topDelta = util_1.getEvY(ev) - this.y0; 13616 this.leftDelta = util_1.getEvX(ev) - this.x0; 13617 if (!this.isHidden) { 13618 this.updatePosition(); 13619 } 13620 }; 13621 // Temporarily makes the tracking element invisible. Can be called before following starts 13622 MouseFollower.prototype.hide = function () { 13623 if (!this.isHidden) { 13624 this.isHidden = true; 13625 if (this.el) { 13626 this.el.hide(); 13627 } 13628 } 13629 }; 13630 // Show the tracking element after it has been temporarily hidden 13631 MouseFollower.prototype.show = function () { 13632 if (this.isHidden) { 13633 this.isHidden = false; 13634 this.updatePosition(); 13635 this.getEl().show(); 13636 } 13637 }; 13638 return MouseFollower; 13639}()); 13640exports.default = MouseFollower; 13641ListenerMixin_1.default.mixInto(MouseFollower); 13642 13643 13644/***/ }), 13645/* 245 */ 13646/***/ (function(module, exports, __webpack_require__) { 13647 13648Object.defineProperty(exports, "__esModule", { value: true }); 13649var tslib_1 = __webpack_require__(2); 13650var HitDragListener_1 = __webpack_require__(23); 13651var Interaction_1 = __webpack_require__(15); 13652var DateClicking = /** @class */ (function (_super) { 13653 tslib_1.__extends(DateClicking, _super); 13654 /* 13655 component must implement: 13656 - bindDateHandlerToEl 13657 - getSafeHitFootprint 13658 - getHitEl 13659 */ 13660 function DateClicking(component) { 13661 var _this = _super.call(this, component) || this; 13662 _this.dragListener = _this.buildDragListener(); 13663 return _this; 13664 } 13665 DateClicking.prototype.end = function () { 13666 this.dragListener.endInteraction(); 13667 }; 13668 DateClicking.prototype.bindToEl = function (el) { 13669 var component = this.component; 13670 var dragListener = this.dragListener; 13671 component.bindDateHandlerToEl(el, 'mousedown', function (ev) { 13672 if (!component.shouldIgnoreMouse()) { 13673 dragListener.startInteraction(ev); 13674 } 13675 }); 13676 component.bindDateHandlerToEl(el, 'touchstart', function (ev) { 13677 if (!component.shouldIgnoreTouch()) { 13678 dragListener.startInteraction(ev); 13679 } 13680 }); 13681 }; 13682 // Creates a listener that tracks the user's drag across day elements, for day clicking. 13683 DateClicking.prototype.buildDragListener = function () { 13684 var _this = this; 13685 var component = this.component; 13686 var dayClickHit; // null if invalid dayClick 13687 var dragListener = new HitDragListener_1.default(component, { 13688 scroll: this.opt('dragScroll'), 13689 interactionStart: function () { 13690 dayClickHit = dragListener.origHit; 13691 }, 13692 hitOver: function (hit, isOrig, origHit) { 13693 // if user dragged to another cell at any point, it can no longer be a dayClick 13694 if (!isOrig) { 13695 dayClickHit = null; 13696 } 13697 }, 13698 hitOut: function () { 13699 dayClickHit = null; 13700 }, 13701 interactionEnd: function (ev, isCancelled) { 13702 var componentFootprint; 13703 if (!isCancelled && dayClickHit) { 13704 componentFootprint = component.getSafeHitFootprint(dayClickHit); 13705 if (componentFootprint) { 13706 _this.view.triggerDayClick(componentFootprint, component.getHitEl(dayClickHit), ev); 13707 } 13708 } 13709 } 13710 }); 13711 // because dragListener won't be called with any time delay, "dragging" will begin immediately, 13712 // which will kill any touchmoving/scrolling. Prevent this. 13713 dragListener.shouldCancelTouchScroll = false; 13714 dragListener.scrollAlwaysKills = true; 13715 return dragListener; 13716 }; 13717 return DateClicking; 13718}(Interaction_1.default)); 13719exports.default = DateClicking; 13720 13721 13722/***/ }), 13723/* 246 */ 13724/***/ (function(module, exports, __webpack_require__) { 13725 13726Object.defineProperty(exports, "__esModule", { value: true });
13727var tslib_1 = __webpack_require__(2); 13728var util_1 = __webpack_require__(4); 13729var EventRenderer_1 = __webpack_require__(42); 13730/* 13731Only handles foreground segs. 13732Does not own rendering. Use for low-level util methods by TimeGrid. 13733*/ 13734var TimeGridEventRenderer = /** @class */ (function (_super) { 13735 tslib_1.__extends(TimeGridEventRenderer, _super); 13736 function TimeGridEventRenderer(timeGrid, fillRenderer) { 13737 var _this = _super.call(this, timeGrid, fillRenderer) || this; 13738 _this.timeGrid = timeGrid; 13739 return _this; 13740 } 13741 TimeGridEventRenderer.prototype.renderFgSegs = function (segs) { 13742 this.renderFgSegsIntoContainers(segs, this.timeGrid.fgContainerEls); 13743 }; 13744 // Given an array of foreground segments, render a DOM element for each, computes position, 13745 // and attaches to the column inner-container elements. 13746 TimeGridEventRenderer.prototype.renderFgSegsIntoContainers = function (segs, containerEls) { 13747 var segsByCol; 13748 var col; 13749 segsByCol = this.timeGrid.groupSegsByCol(segs); 13750 for (col = 0; col < this.timeGrid.colCnt; col++) { 13751 this.updateFgSegCoords(segsByCol[col]); 13752 } 13753 this.timeGrid.attachSegsByCol(segsByCol, containerEls); 13754 }; 13755 TimeGridEventRenderer.prototype.unrenderFgSegs = function () { 13756 if (this.fgSegs) { 13757 this.fgSegs.forEach(function (seg) { 13758 seg.el.remove(); 13759 }); 13760 } 13761 }; 13762 // Computes a default event time formatting string if `timeFormat` is not explicitly defined 13763 TimeGridEventRenderer.prototype.computeEventTimeFormat = function () { 13764 return this.opt('noMeridiemTimeFormat'); // like "6:30" (no AM/PM) 13765 }; 13766 // Computes a default `displayEventEnd` value if one is not expliclty defined 13767 TimeGridEventRenderer.prototype.computeDisplayEventEnd = function () { 13768 return true; 13769 }; 13770 // Renders the HTML for a single event segment's default rendering 13771 TimeGridEventRenderer.prototype.fgSegHtml = function (seg, disableResizing) { 13772 var view = this.view; 13773 var calendar = view.calendar; 13774 var componentFootprint = seg.footprint.componentFootprint; 13775 var isAllDay = componentFootprint.isAllDay; 13776 var eventDef = seg.footprint.eventDef; 13777 var isDraggable = view.isEventDefDraggable(eventDef); 13778 var isResizableFromStart = !disableResizing && seg.isStart && view.isEventDefResizableFromStart(eventDef); 13779 var isResizableFromEnd = !disableResizing && seg.isEnd && view.isEventDefResizableFromEnd(eventDef); 13780 var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd); 13781 var skinCss = util_1.cssToStr(this.getSkinCss(eventDef)); 13782 var timeText; 13783 var fullTimeText; // more verbose time text. for the print stylesheet 13784 var startTimeText; // just the start time text 13785 classes.unshift('fc-time-grid-event', 'fc-v-event'); 13786 // if the event appears to span more than one day... 13787 if (view.isMultiDayRange(componentFootprint.unzonedRange)) { 13788 // Don't display time text on segments that run entirely through a day. 13789 // That would appear as midnight-midnight and would look dumb. 13790 // Otherwise, display the time text for the *segment's* times (like 6pm-midnight or midnight-10am) 13791 if (seg.isStart || seg.isEnd) { 13792 var zonedStart = calendar.msToMoment(seg.startMs); 13793 var zonedEnd = calendar.msToMoment(seg.endMs); 13794 timeText = this._getTimeText(zonedStart, zonedEnd, isAllDay); 13795 fullTimeText = this._getTimeText(zonedStart, zonedEnd, isAllDay, 'LT'); 13796 startTimeText = this._getTimeText(zonedStart, zonedEnd, isAllDay, null, false); // displayEnd=false 13797 } 13798 } 13799 else { 13800 // Display the normal time text for the *event's* times 13801 timeText = this.getTimeText(seg.footprint); 13802 fullTimeText = this.getTimeText(seg.footprint, 'LT'); 13803 startTimeText = this.getTimeText(seg.footprint, null, false); // displayEnd=false 13804 } 13805 return '<a class="' + classes.join(' ') + '"' + 13806 (eventDef.url ? 13807 ' href="' + util_1.htmlEscape(eventDef.url) + '"' : 13808 '') + 13809 (skinCss ? 13810 ' style="' + skinCss + '"' : 13811 '') + 13812 '>' + 13813 '<div class="fc-content">' + 13814 (timeText ? 13815 '<div class="fc-time"' + 13816 ' data-start="' + util_1.htmlEscape(startTimeText) + '"' + 13817 ' data-full="' + util_1.htmlEscape(fullTimeText) + '"' + 13818 '>' + 13819 '<span>' + util_1.htmlEscape(timeText) + '</span>' + 13820 '</div>' : 13821 '') + 13822 (eventDef.title ? 13823 '<div class="fc-title">' + 13824 util_1.htmlEscape(eventDef.title) + 13825 '</div>' : 13826 '') + 13827 '</div>' + 13828 '<div class="fc-bg"/>' + 13829 /* TODO: write CSS for this 13830 (isResizableFromStart ? 13831 '<div class="fc-resizer fc-start-resizer" />' : 13832 '' 13833 ) + 13834 */ 13835 (isResizableFromEnd ? 13836 '<div class="fc-resizer fc-end-resizer" />' : 13837 '') + 13838 '</a>'; 13839 }; 13840 // Given segments that are assumed to all live in the *same column*, 13841 // compute their verical/horizontal coordinates and assign to their elements. 13842 TimeGridEventRenderer.prototype.updateFgSegCoords = function (segs) { 13843 this.timeGrid.computeSegVerticals(segs); // horizontals relies on this 13844 this.computeFgSegHorizontals(segs); // compute horizontal coordinates, z-index's, and reorder the array 13845 this.timeGrid.assignSegVerticals(segs); 13846 this.assignFgSegHorizontals(segs); 13847 }; 13848 // Given an array of segments that are all in the same column, set
13848s the backwardCoord and forwardCoord on each. 13849 // NOTE: Also reorders the given array by date! 13850 TimeGridEventRenderer.prototype.computeFgSegHorizontals = function (segs) { 13851 var levels; 13852 var level0; 13853 var i; 13854 this.sortEventSegs(segs); // order by certain criteria 13855 levels = buildSlotSegLevels(segs); 13856 computeForwardSlotSegs(levels); 13857 if ((level0 = levels[0])) { 13858 for (i = 0; i < level0.length; i++) { 13859 computeSlotSegPressures(level0[i]); 13860 } 13861 for (i = 0; i < level0.length; i++) { 13862 this.computeFgSegForwardBack(level0[i], 0, 0); 13863 } 13864 } 13865 }; 13866 // Calculate seg.forwardCoord and seg.backwardCoord for the segment, where both values range 13867 // from 0 to 1. If the calendar is left-to-right, the seg.backwardCoord maps to "left" and 13868 // seg.forwardCoord maps to "right" (via percentage). Vice-versa if the calendar is right-to-left. 13869 // 13870 // The segment might be part of a "series", which means consecutive segments with the same pressure 13871 // who's width is unknown until an edge has been hit. `seriesBackwardPressure` is the number of 13872 // segments behind this one in the current series, and `seriesBackwardCoord` is the starting 13873 // coordinate of the first segment in the series. 13874 TimeGridEventRenderer.prototype.computeFgSegForwardBack = function (seg, seriesBackwardPressure, seriesBackwardCoord) { 13875 var forwardSegs = seg.forwardSegs; 13876 var i; 13877 if (seg.forwardCoord === undefined) { 13878 if (!forwardSegs.length) { 13879 // if there are no forward segments, this segment should butt up against the edge 13880 seg.forwardCoord = 1; 13881 } 13882 else { 13883 // sort highest pressure first 13884 this.sortForwardSegs(forwardSegs); 13885 // this segment's forwardCoord will be calculated from the backwardCoord of the 13886 // highest-pressure forward segment. 13887 this.computeFgSegForwardBack(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord); 13888 seg.forwardCoord = forwardSegs[0].backwardCoord; 13889 } 13890 // calculate the backwardCoord from the forwardCoord. consider the series 13891 seg.backwardCoord = seg.forwardCoord - 13892 (seg.forwardCoord - seriesBackwardCoord) / // available width for series 13893 (seriesBackwardPressure + 1); // # of segments in the series 13894 // use this segment's coordinates to computed the coordinates of the less-pressurized 13895 // forward segments 13896 for (i = 0; i < forwardSegs.length; i++) { 13897 this.computeFgSegForwardBack(forwardSegs[i], 0, seg.forwardCoord); 13898 } 13899 } 13900 }; 13901 TimeGridEventRenderer.prototype.sortForwardSegs = function (forwardSegs) { 13902 forwardSegs.sort(util_1.proxy(this, 'compareForwardSegs')); 13903 }; 13904 // A cmp function for determining which forward segment to rely on more when computing coordinates. 13905 TimeGridEventRenderer.prototype.compareForwardSegs = function (seg1, seg2) { 13906 // put higher-pressure first 13907 return seg2.forwardPressure - seg1.forwardPressure || 13908 // put segments that are closer to initial edge first (and favor ones with no coords yet) 13909 (seg1.backwardCoord || 0) - (seg2.backwardCoord || 0) || 13910 // do normal sorting... 13911 this.compareEventSegs(seg1, seg2); 13912 }; 13913 // Given foreground event segments that have already had their position coordinates computed, 13914 // assigns position-related CSS values to their elements. 13915 TimeGridEventRenderer.prototype.assignFgSegHorizontals = function (segs) { 13916 var i; 13917 var seg; 13918 for (i = 0; i < segs.length; i++) { 13919 seg = segs[i]; 13920 seg.el.css(this.generateFgSegHorizontalCss(seg)); 13921 // if the height is short, add a className for alternate styling 13922 if (seg.bottom - seg.top < 30) { 13923 seg.el.addClass('fc-short'); 13924 } 13925 } 13926 }; 13927 // Generates an object with CSS properties/values that should be applied to an event segment element. 13928 // Contains important positioning-related properties that should be applied to any event element, customized or not. 13929 TimeGridEventRenderer.prototype.generateFgSegHorizontalCss = function (seg) { 13930 var shouldOverlap = this.opt('slotEventOverlap'); 13931 var backwardCoord = seg.backwardCoord; // the left side if LTR. the right side if RTL. floating-point 13932 var forwardCoord = seg.forwardCoord; // the right side if LTR. the left side if RTL. floating-point 13933 var props = this.timeGrid.generateSegVerticalCss(seg); // get top/bottom first 13934 var isRTL = this.timeGrid.isRTL; 13935 var left; // amount of space from left edge, a fraction of the total width 13936 var right; // amount of space from right edge, a fraction of the total width 13937 if (shouldOverlap) { 13938 // double the width, but don't go beyond the maximum forward coordinate (1.0) 13939 forwardCoord = Math.min(1, backwardCoord + (forwardCoord - backwardCoord) * 2); 13940 } 13941 if (isRTL) { 13942 left = 1 - forwardCoord; 13943 right = backwardCoord; 13944 } 13945 else { 13946 left = backwardCoord; 13947 right = 1 - forwardCoord; 13948 } 13949 props.zIndex = seg.level + 1; // convert from 0-base to 1-based 13950 props.left = left * 100 + '%'; 13951 props.right = right * 100 + '%'; 13952 if (shouldOverlap && seg.forwardPressure) { 13953 // add padding to the edge so that forward stacked events don't cover the resizer's icon 13954 props[isRTL ? 'marginLeft' : 'marginRight'] = 10 * 2; // 10 is a guesstimate of the icon's width 13955 } 13956 return props; 13957 }; 13958 return TimeGridEventRenderer; 13959}(EventRenderer_1.default)); 13960exports.default = TimeGridEventRenderer; 13961// Builds an array of segments "levels". The first level will be the leftmost tier of segments if the calendar is 13962// left-to-right, or the rightmost if the calendar is right-to-left. Assumes the segments are already ordered by date. 13963function buildSlotSegLevels(segs) { 13964 var levels = []; 13965 var i; 13966 var seg; 13967 var j; 13968 for (i = 0; i < segs.length; i++) { 13969 seg = segs[i]; 13970 // go through all the levels and stop on the first level where there are no collisions 13971 for (j = 0; j < levels.length; j++) { 13972 if (!computeSlotSegCollisions(seg, levels[j]).length) { 13973 break; 13974 } 13975 } 13976 seg.level = j; 13977 (levels[j] || (levels[j] = [])).push(seg); 13978 } 13979 return levels; 13980} 13981// For every segment, figure out the other segments that are in subsequent 13982// levels that also occupy the same vertical space. Accumulate in seg.forwardSegs 13983function computeForwardSlotSegs(levels) { 13984 var i; 13985 var level; 13986 var j; 13987 var seg; 13988 var k; 13989 for (i = 0; i < levels.length; i++) { 13990 level = levels[i]; 13991 for (j = 0; j < level.length; j++) { 13992 seg = level[j]; 13993 seg.forwardSegs = []; 13994 for (k = i + 1; k < levels.length; k++) { 13995 computeSlotSegCollisions(seg, levels[k], seg.forwardSegs); 13996 } 13997 } 13998 } 13999} 14000// Figure out which path forward (via seg.forwardSegs) results in the longest path until
14001// the furthest edge is reached. The number of segments in this path will be seg.forwardPressure 14002function computeSlotSegPressures(seg) { 14003 var forwardSegs = seg.forwardSegs; 14004 var forwardPressure = 0; 14005 var i; 14006 var forwardSeg; 14007 if (seg.forwardPressure === undefined) { 14008 for (i = 0; i < forwardSegs.length; i++) { 14009 forwardSeg = forwardSegs[i]; 14010 // figure out the child's maximum forward path 14011 computeSlotSegPressures(forwardSeg); 14012 // either use the existing maximum, or use the child's forward pressure 14013 // plus one (for the forwardSeg itself) 14014 forwardPressure = Math.max(forwardPressure, 1 + forwardSeg.forwardPressure); 14015 } 14016 seg.forwardPressure = forwardPressure; 14017 } 14018} 14019// Find all the segments in `otherSegs` that vertically collide with `seg`. 14020// Append into an optionally-supplied `results` array and return. 14021function computeSlotSegCollisions(seg, otherSegs, results) { 14022 if (results === void 0) { results = []; } 14023 for (var i = 0; i < otherSegs.length; i++) { 14024 if (isSlotSegCollision(seg, otherSegs[i])) { 14025 results.push(otherSegs[i]); 14026 } 14027 } 14028 return results; 14029} 14030// Do these segments occupy the same vertical space? 14031function isSlotSegCollision(seg1, seg2) { 14032 return seg1.bottom > seg2.top && seg1.top < seg2.bottom; 14033} 14034 14035 14036/***/ }), 14037/* 247 */ 14038/***/ (function(module, exports, __webpack_require__) { 14039 14040Object.defineProperty(exports, "__esModule", { value: true }); 14041var tslib_1 = __webpack_require__(2); 14042var $ = __webpack_require__(3); 14043var HelperRenderer_1 = __webpack_require__(58); 14044var TimeGridHelperRenderer = /** @class */ (function (_super) { 14045 tslib_1.__extends(TimeGridHelperRenderer, _super); 14046 function TimeGridHelperRenderer() { 14047 return _super !== null && _super.apply(this, arguments) || this; 14048 } 14049 TimeGridHelperRenderer.prototype.renderSegs = function (segs, sourceSeg) { 14050 var helperNodes = []; 14051 var i; 14052 var seg; 14053 var sourceEl; 14054 // TODO: not good to call eventRenderer this way 14055 this.eventRenderer.renderFgSegsIntoContainers(segs, this.component.helperContainerEls); 14056 // Try to make the segment that is in the same row as sourceSeg look the same 14057 for (i = 0; i < segs.length; i++) { 14058 seg = segs[i]; 14059 if (sourceSeg && sourceSeg.col === seg.col) { 14060 sourceEl = sourceSeg.el; 14061 seg.el.css({ 14062 left: sourceEl.css('left'), 14063 right: sourceEl.css('right'), 14064 'margin-left': sourceEl.css('margin-left'), 14065 'margin-right': sourceEl.css('margin-right') 14066 }); 14067 } 14068 helperNodes.push(seg.el[0]); 14069 } 14070 return $(helperNodes); // must return the elements rendered 14071 }; 14072 return TimeGridHelperRenderer; 14073}(HelperRenderer_1.default)); 14074exports.default = TimeGridHelperRenderer; 14075 14076 14077/***/ }), 14078/* 248 */ 14079/***/ (function(module, exports, __webpack_require__) { 14080 14081Object.defineProperty(exports, "__esModule", { value: true }); 14082var tslib_1 = __webpack_require__(2); 14083var FillRenderer_1 = __webpack_require__(57); 14084var TimeGridFillRenderer = /** @class */ (function (_super) { 14085 tslib_1.__extends(TimeGridFillRenderer, _super); 14086 function TimeGridFillRenderer() { 14087 return _super !== null && _super.apply(this, arguments) || this; 14088 } 14089 TimeGridFillRenderer.prototype.attachSegEls = function (type, segs) { 14090 var timeGrid = this.component; 14091 var containerEls; 14092 // TODO: more efficient lookup 14093 if (type === 'bgEvent') { 14094 containerEls = timeGrid.bgContainerEls; 14095 } 14096 else if (type === 'businessHours') { 14097 containerEls = timeGrid.businessContainerEls; 14098 } 14099 else if (type === 'highlight') { 14100 containerEls = timeGrid.highlightContainerEls; 14101 } 14102 timeGrid.updateSegVerticals(segs); 14103 timeGrid.attachSegsByCol(timeGrid.groupSegsByCol(segs), containerEls); 14104 return segs.map(function (seg) { 14105 return seg.el[0]; 14106 }); 14107 }; 14108 return TimeGridFillRenderer; 14109}(FillRenderer_1.default)); 14110exports.default = TimeGridFillRenderer; 14111 14112 14113/***/ }), 14114/* 249 */ 14115/***/ (function(module, exports, __webpack_require__) { 14116 14117/* A rectangular panel that is absolutely positioned over other content 14118------------------------------------------------------------------------------------------------------------------------ 14119Options: 14120 - className (string) 14121 - content (HTML string or jQuery element set) 14122 - parentEl 14123 - top 14124 - left 14125 - right (the x coord of where the right edge should be. not a "CSS" right) 14126 - autoHide (boolean) 14127 - show (callback) 14128 - hide (callback) 14129*/ 14130Object.defineProperty(exports, "__esModule", { value: true });
14131var $ = __webpack_require__(3); 14132var util_1 = __webpack_require__(4); 14133var ListenerMixin_1 = __webpack_require__(7); 14134var Popover = /** @class */ (function () { 14135 function Popover(options) { 14136 this.isHidden = true; 14137 this.margin = 10; // the space required between the popover and the edges of the scroll container 14138 this.options = options || {}; 14139 } 14140 // Shows the popover on the specified position. Renders it if not already 14141 Popover.prototype.show = function () { 14142 if (this.isHidden) { 14143 if (!this.el) { 14144 this.render(); 14145 } 14146 this.el.show(); 14147 this.position(); 14148 this.isHidden = false; 14149 this.trigger('show'); 14150 } 14151 }; 14152 // Hides the popover, through CSS, but does not remove it from the DOM 14153 Popover.prototype.hide = function () { 14154 if (!this.isHidden) { 14155 this.el.hide(); 14156 this.isHidden = true; 14157 this.trigger('hide'); 14158 } 14159 }; 14160 // Creates `this.el` and renders content inside of it 14161 Popover.prototype.render = function () { 14162 var _this = this; 14163 var options = this.options; 14164 this.el = $('<div class="fc-popover"/>') 14165 .addClass(options.className || '') 14166 .css({ 14167 // position initially to the top left to avoid creating scrollbars 14168 top: 0, 14169 left: 0 14170 }) 14171 .append(options.content) 14172 .appendTo(options.parentEl); 14173 // when a click happens on anything inside with a 'fc-close' className, hide the popover 14174 this.el.on('click', '.fc-close', function () { 14175 _this.hide(); 14176 }); 14177 if (options.autoHide) { 14178 this.listenTo($(document), 'mousedown', this.documentMousedown); 14179 } 14180 }; 14181 // Triggered when the user clicks *anywhere* in the document, for the autoHide feature 14182 Popover.prototype.documentMousedown = function (ev) { 14183 // only hide the popover if the click happened outside the popover 14184 if (this.el && !$(ev.target).closest(this.el).length) { 14185 this.hide(); 14186 } 14187 }; 14188 // Hides and unregisters any handlers 14189 Popover.prototype.removeElement = function () { 14190 this.hide(); 14191 if (this.el) { 14192 this.el.remove(); 14193 this.el = null; 14194 } 14195 this.stopListeningTo($(document), 'mousedown'); 14196 }; 14197 // Positions the popover optimally, using the top/left/right options 14198 Popover.prototype.position = function () { 14199 var options = this.options; 14200 var origin = this.el.offsetParent().offset(); 14201 var width = this.el.outerWidth(); 14202 var height = this.el.outerHeight(); 14203 var windowEl = $(window); 14204 var viewportEl = util_1.getScrollParent(this.el); 14205 var viewportTop; 14206 var viewportLeft; 14207 var viewportOffset; 14208 var top; // the "position" (not "offset") values for the popover 14209 var left; // 14210 // compute top and left 14211 top = options.top || 0; 14212 if (options.left !== undefined) { 14213 left = options.left; 14214 } 14215 else if (options.right !== undefined) { 14216 left = options.right - width; // derive the left value from the right value 14217 } 14218 else { 14219 left = 0; 14220 } 14221 if (viewportEl.is(window) || viewportEl.is(document)) { 14222 viewportEl = windowEl; 14223 viewportTop = 0; // the window is always at the top left 14224 viewportLeft = 0; // (and .offset() won't work if called here) 14225 } 14226 else { 14227 viewportOffset = viewportEl.offset(); 14228 viewportTop = viewportOffset.top; 14229 viewportLeft = viewportOffset.left; 14230 } 14231 // if the window is scrolled, it causes the visible area to be further down 14232 viewportTop += windowEl.scrollTop(); 14233 viewportLeft += windowEl.scrollLeft(); 14234 // constrain to the view port. if constrained by two edges, give precedence to top/left 14235 if (options.viewportConstrain !== false) { 14236 top = Math.min(top, viewportTop + viewportEl.outerHeight() - height - this.margin); 14237 top = Math.max(top, viewportTop + this.margin); 14238 left = Math.min(left, viewportLeft + viewportEl.outerWidth() - width - this.margin); 14239 left = Math.max(left, viewportLeft + this.margin); 14240 } 14241 this.el.css({ 14242 top: top - origin.top, 14243 left: left - origin.left 14244 }); 14245 }; 14246 // Triggers a callback. Calls a function in the option hash of the same name. 14247 // Arguments beyond the first `name` are forwarded on. 14248 // TODO: better code reuse for this. Repeat code 14249 Popover.prototype.trigger = function (name) { 14250 if (this.options[name]) { 14251 this.options[name].apply(this, Array.prototype.slice.call(arguments, 1)); 14252 } 14253 }; 14254 return Popover; 14255}()); 14256exports.default = Popover; 14257ListenerMixin_1.default.mixInto(Popover); 14258 14259 14260/***/ }), 14261/* 250 */ 14262/***/ (function(module, exports, __webpack_require__) { 14263 14264Object.defineProperty(exports, "__esModule", { value: true });
14265var tslib_1 = __webpack_require__(2); 14266var $ = __webpack_require__(3); 14267var util_1 = __webpack_require__(4); 14268var EventRenderer_1 = __webpack_require__(42); 14269/* Event-rendering methods for the DayGrid class 14270----------------------------------------------------------------------------------------------------------------------*/ 14271var DayGridEventRenderer = /** @class */ (function (_super) { 14272 tslib_1.__extends(DayGridEventRenderer, _super); 14273 function DayGridEventRenderer(dayGrid, fillRenderer) { 14274 var _this = _super.call(this, dayGrid, fillRenderer) || this; 14275 _this.dayGrid = dayGrid; 14276 return _this; 14277 } 14278 DayGridEventRenderer.prototype.renderBgRanges = function (eventRanges) { 14279 // don't render timed background events 14280 eventRanges = $.grep(eventRanges, function (eventRange) { 14281 return eventRange.eventDef.isAllDay(); 14282 }); 14283 _super.prototype.renderBgRanges.call(this, eventRanges); 14284 }; 14285 // Renders the given foreground event segments onto the grid 14286 DayGridEventRenderer.prototype.renderFgSegs = function (segs) { 14287 var rowStructs = this.rowStructs = this.renderSegRows(segs); 14288 // append to each row's content skeleton 14289 this.dayGrid.rowEls.each(function (i, rowNode) { 14290 $(rowNode).find('.fc-content-skeleton > table').append(rowStructs[i].tbodyEl); 14291 }); 14292 }; 14293 // Unrenders all currently rendered foreground event segments 14294 DayGridEventRenderer.prototype.unrenderFgSegs = function () { 14295 var rowStructs = this.rowStructs || []; 14296 var rowStruct; 14297 while ((rowStruct = rowStructs.pop())) { 14298 rowStruct.tbodyEl.remove(); 14299 } 14300 this.rowStructs = null; 14301 }; 14302 // Uses the given events array to generate <tbody> elements that should be appended to each row's content skeleton. 14303 // Returns an array of rowStruct objects (see the bottom of `renderSegRow`). 14304 // PRECONDITION: each segment shoud already have a rendered and assigned `.el` 14305 DayGridEventRenderer.prototype.renderSegRows = function (segs) { 14306 var rowStructs = []; 14307 var segRows; 14308 var row; 14309 segRows = this.groupSegRows(segs); // group into nested arrays 14310 // iterate each row of segment groupings 14311 for (row = 0; row < segRows.length; row++) { 14312 rowStructs.push(this.renderSegRow(row, segRows[row])); 14313 } 14314 return rowStructs; 14315 }; 14316 // Given a row # and an array of segments all in the same row, render a <tbody> element, a skeleton that contains 14317 // the segments. Returns object with a bunch of internal data about how the render was calculated. 14318 // NOTE: modifies rowSegs 14319 DayGridEventRenderer.prototype.renderSegRow = function (row, rowSegs) { 14320 var colCnt = this.dayGrid.colCnt; 14321 var segLevels = this.buildSegLevels(rowSegs); // group into sub-arrays of levels 14322 var levelCnt = Math.max(1, segLevels.length); // ensure at least one level 14323 var tbody = $('<tbody/>'); 14324 var segMatrix = []; // lookup for which segments are rendered into which level+col cells 14325 var cellMatrix = []; // lookup for all <td> elements of the level+col matrix 14326 var loneCellMatrix = []; // lookup for <td> elements that only take up a single column 14327 var i; 14328 var levelSegs; 14329 var col; 14330 var tr; 14331 var j; 14332 var seg; 14333 var td; 14334 // populates empty cells from the current column (`col`) to `endCol` 14335 function emptyCellsUntil(endCol) { 14336 while (col < endCol) { 14337 // try to grab a cell from the level above and extend its rowspan. otherwise, create a fresh cell 14338 td = (loneCellMatrix[i - 1] || [])[col]; 14339 if (td) { 14340 td.attr('rowspan', parseInt(td.attr('rowspan') || 1, 10) + 1); 14341 } 14342 else { 14343 td = $('<td/>'); 14344 tr.append(td); 14345 } 14346 cellMatrix[i][col] = td; 14347 loneCellMatrix[i][col] = td; 14348 col++; 14349 } 14350 } 14351 for (i = 0; i < levelCnt; i++) { 14352 levelSegs = segLevels[i]; 14353 col = 0; 14354 tr = $('<tr/>'); 14355 segMatrix.push([]); 14356 cellMatrix.push([]); 14357 loneCellMatrix.push([]); 14358 // levelCnt might be 1 even though there are no actual levels. protect against this. 14359 // this single empty row is useful for styling. 14360 if (levelSegs) { 14361 for (j = 0; j < levelSegs.length; j++) { 14362 seg = levelSegs[j]; 14363 emptyCellsUntil(seg.leftCol); 14364 // create a container that occupies or more columns. append the event element. 14365 td = $('<td class="fc-event-container"/>').append(seg.el); 14366 if (seg.leftCol !== seg.rightCol) { 14367 td.attr('colspan', seg.rightCol - seg.leftCol + 1); 14368 } 14369 else { 14370 loneCellMatrix[i][col] = td; 14371 } 14372 while (col <= seg.rightCol) { 14373 cellMatrix[i][col] = td; 14374 segMatrix[i][col] = seg; 14375 col++; 14376 } 14377 tr.append(td); 14378 } 14379 } 14380 emptyCellsUntil(colCnt); // finish off the row 14381 this.dayGrid.bookendCells(tr); 14382 tbody.append(tr); 14383 } 14384 return { 14385 row: row, 14386 tbodyEl: tbody, 14387 cellMatrix: cellMatrix, 14388 segMatrix: segMatrix, 14389 segLevels: segLevels, 14390 segs: rowSegs 14391 }; 14392 }; 14393 // Stacks a flat array of segments, which are all assumed to be in the same row, into subarrays of vertical levels. 14394 // NOTE: modifies segs 14395 DayGridEventRenderer.prototype.buildSegLevels = function (segs) { 14396 var levels = []; 14397 var i; 14398 var seg; 14399 var j; 14400 // Give preference to elements with certain criteria, so they have 14401 // a chance to be closer to the top. 14402 this.sortEventSegs(segs); 14403 for (i = 0; i < segs.length; i++) { 14404 seg = segs[i]; 14405 // loop through levels, starting with the topmost, until the segment doesn't collide with other segments 14406 for (j = 0; j < levels.length; j++) {
14407 if (!isDaySegCollision(seg, levels[j])) { 14408 break; 14409 } 14410 } 14411 // `j` now holds the desired subrow index 14412 seg.level = j; 14413 // create new level array if needed and append segment 14414 (levels[j] || (levels[j] = [])).push(seg); 14415 } 14416 // order segments left-to-right. very important if calendar is RTL 14417 for (j = 0; j < levels.length; j++) { 14418 levels[j].sort(compareDaySegCols); 14419 } 14420 return levels; 14421 }; 14422 // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's row 14423 DayGridEventRenderer.prototype.groupSegRows = function (segs) { 14424 var segRows = []; 14425 var i; 14426 for (i = 0; i < this.dayGrid.rowCnt; i++) { 14427 segRows.push([]); 14428 } 14429 for (i = 0; i < segs.length; i++) { 14430 segRows[segs[i].row].push(segs[i]); 14431 } 14432 return segRows; 14433 }; 14434 // Computes a default event time formatting string if `timeFormat` is not explicitly defined 14435 DayGridEventRenderer.prototype.computeEventTimeFormat = function () { 14436 return this.opt('extraSmallTimeFormat'); // like "6p" or "6:30p" 14437 }; 14438 // Computes a default `displayEventEnd` value if one is not expliclty defined 14439 DayGridEventRenderer.prototype.computeDisplayEventEnd = function () { 14440 return this.dayGrid.colCnt === 1; // we'll likely have space if there's only one day 14441 }; 14442 // Builds the HTML to be used for the default element for an individual segment 14443 DayGridEventRenderer.prototype.fgSegHtml = function (seg, disableResizing) { 14444 var view = this.view; 14445 var eventDef = seg.footprint.eventDef; 14446 var isAllDay = seg.footprint.componentFootprint.isAllDay; 14447 var isDraggable = view.isEventDefDraggable(eventDef); 14448 var isResizableFromStart = !disableResizing && isAllDay && 14449 seg.isStart && view.isEventDefResizableFromStart(eventDef); 14450 var isResizableFromEnd = !disableResizing && isAllDay && 14451 seg.isEnd && view.isEventDefResizableFromEnd(eventDef); 14452 var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd); 14453 var skinCss = util_1.cssToStr(this.getSkinCss(eventDef)); 14454 var timeHtml = ''; 14455 var timeText; 14456 var titleHtml; 14457 classes.unshift('fc-day-grid-event', 'fc-h-event');
14458 // Only display a timed events time if it is the starting segment 14459 if (seg.isStart) { 14460 timeText = this.getTimeText(seg.footprint); 14461 if (timeText) { 14462 timeHtml = '<span class="fc-time">' + util_1.htmlEscape(timeText) + '</span>'; 14463 } 14464 } 14465 titleHtml = 14466 '<span class="fc-title">' + 14467 (util_1.htmlEscape(eventDef.title || '') || ' ') + // we always want one line of height 14468 '</span>'; 14469 return '<a class="' + classes.join(' ') + '"' + 14470 (eventDef.url ? 14471 ' href="' + util_1.htmlEscape(eventDef.url) + '"' : 14472 '') + 14473 (skinCss ? 14474 ' style="' + skinCss + '"' : 14475 '') + 14476 '>' + 14477 '<div class="fc-content">' + 14478 (this.dayGrid.isRTL ? 14479 titleHtml + ' ' + timeHtml : // put a natural space in between 14480 timeHtml + ' ' + titleHtml // 14481 ) + 14482 '</div>' + 14483 (isResizableFromStart ? 14484 '<div class="fc-resizer fc-start-resizer" />' : 14485 '') + 14486 (isResizableFromEnd ? 14487 '<div class="fc-resizer fc-end-resizer" />' : 14488 '') + 14489 '</a>'; 14490 }; 14491 return DayGridEventRenderer; 14492}(EventRenderer_1.default)); 14493exports.default = DayGridEventRenderer; 14494// Computes whether two segments' columns collide. They are assumed to be in the same row. 14495function isDaySegCollision(seg, otherSegs) { 14496 var i; 14497 var otherSeg; 14498 for (i = 0; i < otherSegs.length; i++) { 14499 otherSeg = otherSegs[i]; 14500 if (otherSeg.leftCol <= seg.rightCol && 14501 otherSeg.rightCol >= seg.leftCol) { 14502 return true; 14503 } 14504 } 14505 return false; 14506} 14507// A cmp function for determining the leftmost event 14508function compareDaySegCols(a, b) { 14509 return a.leftCol - b.leftCol; 14510} 14511 14512 14513/***/ }), 14514/* 251 */ 14515/***/ (function(module, exports, __webpack_require__) { 14516 14517Object.defineProperty(exports, "__esModule", { value: true }); 14518var tslib_1 = __webpack_require__(2); 14519var $ = __webpack_require__(3); 14520var HelperRenderer_1 = __webpack_require__(58); 14521var DayGridHelperRenderer = /** @class */ (function (_super) { 14522 tslib_1.__extends(DayGridHelperRenderer, _super); 14523 function DayGridHelperRenderer() { 14524 return _super !== null && _super.apply(this, arguments) || this; 14525 } 14526 // Renders a mock "helper" event. `sourceSeg` is the associated internal segment object. It can be null. 14527 DayGridHelperRenderer.prototype.renderSegs = function (segs, sourceSeg) { 14528 var helperNodes = []; 14529 var rowStructs; 14530 // TODO: not good to call eventRenderer this way 14531 rowStructs = this.eventRenderer.renderSegRows(segs); 14532 // inject each new event skeleton into each associated row 14533 this.component.rowEls.each(function (row, rowNode) { 14534 var rowEl = $(rowNode); // the .fc-row 14535 var skeletonEl = $('<div class="fc-helper-skeleton"><table/></div>'); // will be absolutely positioned 14536 var skeletonTopEl; 14537 var skeletonTop; 14538 // If there is an original segment, match the top position. Otherwise, put it at the row's top level 14539 if (sourceSeg && sourceSeg.row === row) { 14540 skeletonTop = sourceSeg.el.position().top; 14541 } 14542 else { 14543 skeletonTopEl = rowEl.find('.fc-content-skeleton tbody'); 14544 if (!skeletonTopEl.length) { 14545 skeletonTopEl = rowEl.find('.fc-content-skeleton table'); 14546 } 14547 skeletonTop = skeletonTopEl.position().top; 14548 } 14549 skeletonEl.css('top', skeletonTop) 14550 .find('table') 14551 .append(rowStructs[row].tbodyEl); 14552 rowEl.append(skeletonEl); 14553 helperNodes.push(skeletonEl[0]); 14554 }); 14555 return $(helperNodes); // must return the elements rendered 14556 }; 14557 return DayGridHelperRenderer; 14558}(HelperRenderer_1.default)); 14559exports.default = DayGridHelperRenderer; 14560 14561 14562/***/ }), 14563/* 252 */ 14564/***/ (function(module, exports, __webpack_require__) { 14565 14566Object.defineProperty(exports, "__esModule", { value: true });
14567var tslib_1 = __webpack_require__(2); 14568var $ = __webpack_require__(3); 14569var FillRenderer_1 = __webpack_require__(57); 14570var DayGridFillRenderer = /** @class */ (function (_super) { 14571 tslib_1.__extends(DayGridFillRenderer, _super); 14572 function DayGridFillRenderer() { 14573 var _this = _super !== null && _super.apply(this, arguments) || this; 14574 _this.fillSegTag = 'td'; // override the default tag name 14575 return _this; 14576 } 14577 DayGridFillRenderer.prototype.attachSegEls = function (type, segs) { 14578 var nodes = []; 14579 var i; 14580 var seg; 14581 var skeletonEl; 14582 for (i = 0; i < segs.length; i++) { 14583 seg = segs[i]; 14584 skeletonEl = this.renderFillRow(type, seg); 14585 this.component.rowEls.eq(seg.row).append(skeletonEl); 14586 nodes.push(skeletonEl[0]); 14587 } 14588 return nodes; 14589 }; 14590 // Generates the HTML needed for one row of a fill. Requires the seg's el to be rendered. 14591 DayGridFillRenderer.prototype.renderFillRow = function (type, seg) { 14592 var colCnt = this.component.colCnt; 14593 var startCol = seg.leftCol; 14594 var endCol = seg.rightCol + 1; 14595 var className; 14596 var skeletonEl; 14597 var trEl; 14598 if (type === 'businessHours') { 14599 className = 'bgevent'; 14600 } 14601 else { 14602 className = type.toLowerCase(); 14603 } 14604 skeletonEl = $('<div class="fc-' + className + '-skeleton">' + 14605 '<table><tr/></table>' + 14606 '</div>'); 14607 trEl = skeletonEl.find('tr'); 14608 if (startCol > 0) { 14609 trEl.append('<td colspan="' + startCol + '"/>'); 14610 } 14611 trEl.append(seg.el.attr('colspan', endCol - startCol)); 14612 if (endCol < colCnt) { 14613 trEl.append('<td colspan="' + (colCnt - endCol) + '"/>'); 14614 } 14615 this.component.bookendCells(trEl); 14616 return skeletonEl; 14617 }; 14618 return DayGridFillRenderer; 14619}(FillRenderer_1.default)); 14620exports.default = DayGridFillRenderer; 14621 14622 14623/***/ }), 14624/* 253 */ 14625/***/ (function(module, exports, __webpack_require__) { 14626 14627Object.defineProperty(exports, "__esModule", { value: true }); 14628var tslib_1 = __webpack_require__(2); 14629var BasicViewDateProfileGenerator_1 = __webpack_require__(228); 14630var UnzonedRange_1 = __webpack_require__(5); 14631var MonthViewDateProfileGenerator = /** @class */ (function (_super) { 14632 tslib_1.__extends(MonthViewDateProfileGenerator, _super); 14633 function MonthViewDateProfileGenerator() { 14634 return _super !== null && _super.apply(this, arguments) || this; 14635 } 14636 // Computes the date range that will be rendered. 14637 MonthViewDateProfileGenerator.prototype.buildRenderRange = function (currentUnzonedRange, currentRangeUnit, isRangeAllDay) { 14638 var renderUnzonedRange = _super.prototype.buildRenderRange.call(this, currentUnzonedRange, currentRangeUnit, isRangeAllDay); 14639 var start = this.msToUtcMoment(renderUnzonedRange.startMs, isRangeAllDay); 14640 var end = this.msToUtcMoment(renderUnzonedRange.endMs, isRangeAllDay); 14641 var rowCnt; 14642 // ensure 6 weeks 14643 if (this.opt('fixedWeekCount')) { 14644 rowCnt = Math.ceil(// could be partial weeks due to hiddenDays 14645 end.diff(start, 'weeks', true) // dontRound=true 14646 ); 14647 end.add(6 - rowCnt, 'weeks'); 14648 } 14649 return new UnzonedRange_1.default(start, end); 14650 }; 14651 return MonthViewDateProfileGenerator; 14652}(BasicViewDateProfileGenerator_1.default)); 14653exports.default = MonthViewDateProfileGenerator; 14654 14655 14656/***/ }), 14657/* 254 */ 14658/***/ (function(module, exports, __webpack_require__) { 14659 14660Object.defineProperty(exports, "__esModule", { value: true }); 14661var tslib_1 = __webpack_require__(2); 14662var util_1 = __webpack_require__(4); 14663var EventRenderer_1 = __webpack_require__(42); 14664var ListEventRenderer = /** @class */ (function (_super) { 14665 tslib_1.__extends(ListEventRenderer, _super); 14666 function ListEventRenderer() { 14667 return _super !== null && _super.apply(this, arguments) || this; 14668 } 14669 ListEventRenderer.prototype.renderFgSegs = function (segs) { 14670 if (!segs.length) { 14671 this.component.renderEmptyMessage(); 14672 } 14673 else {
14674 this.component.renderSegList(segs); 14675 } 14676 }; 14677 // generates the HTML for a single event row 14678 ListEventRenderer.prototype.fgSegHtml = function (seg) { 14679 var view = this.view; 14680 var calendar = view.calendar; 14681 var theme = calendar.theme; 14682 var eventFootprint = seg.footprint; 14683 var eventDef = eventFootprint.eventDef; 14684 var componentFootprint = eventFootprint.componentFootprint; 14685 var url = eventDef.url; 14686 var classes = ['fc-list-item'].concat(this.getClasses(eventDef)); 14687 var bgColor = this.getBgColor(eventDef); 14688 var timeHtml; 14689 if (componentFootprint.isAllDay) { 14690 timeHtml = view.getAllDayHtml(); 14691 } 14692 else if (view.isMultiDayRange(componentFootprint.unzonedRange)) { 14693 if (seg.isStart || seg.isEnd) { 14694 timeHtml = util_1.htmlEscape(this._getTimeText(calendar.msToMoment(seg.startMs), calendar.msToMoment(seg.endMs), componentFootprint.isAllDay)); 14695 } 14696 else { 14697 timeHtml = view.getAllDayHtml(); 14698 } 14699 } 14700 else { 14701 // Display the normal time text for the *event's* times 14702 timeHtml = util_1.htmlEscape(this.getTimeText(eventFootprint)); 14703 } 14704 if (url) { 14705 classes.push('fc-has-url'); 14706 } 14707 return '<tr class="' + classes.join(' ') + '">' + 14708 (this.displayEventTime ? 14709 '<td class="fc-list-item-time ' + theme.getClass('widgetContent') + '">' + 14710 (timeHtml || '') + 14711 '</td>' : 14712 '') + 14713 '<td class="fc-list-item-marker ' + theme.getClass('widgetContent') + '">' + 14714 '<span class="fc-event-dot"' + 14715 (bgColor ? 14716 ' style="background-color:' + bgColor + '"' : 14717 '') + 14718 '></span>' + 14719 '</td>' + 14720 '<td class="fc-list-item-title ' + theme.getClass('widgetContent') + '">' + 14721 '<a' + (url ? ' href="' + util_1.htmlEscape(url) + '"' : '') + '>' + 14722 util_1.htmlEscape(eventDef.title || '') + 14723 '</a>' + 14724 '</td>' + 14725 '</tr>'; 14726 }; 14727 // like "4:00am" 14728 ListEventRenderer.prototype.computeEventTimeFormat = function () { 14729 return this.opt('mediumTimeFormat'); 14730 }; 14731 return ListEventRenderer; 14732}(EventRenderer_1.default)); 14733exports.default = ListEventRenderer; 14734 14735 14736/***/ }), 14737/* 255 */ 14738/***/ (function(module, exports, __webpack_require__) { 14739 14740Object.defineProperty(exports, "__esModule", { value: true }); 14741var tslib_1 = __webpack_require__(2); 14742var $ = __webpack_require__(3); 14743var EventPointing_1 = __webpack_require__(59); 14744var ListEventPointing = /** @class */ (function (_super) { 14745 tslib_1.__extends(ListEventPointing, _super); 14746 function ListEventPointing() { 14747 return _super !== null && _super.apply(this, arguments) || this; 14748 } 14749 // for events with a url, the whole <tr> should be clickable, 14750 // but it's impossible to wrap with an <a> tag. simulate this. 14751 ListEventPointing.prototype.handleClick = function (seg, ev) { 14752 var url; 14753 _super.prototype.handleClick.call(this, seg, ev); // might prevent the default action 14754 // not clicking on or within an <a> with an href 14755 if (!$(ev.target).closest('a[href]').length) { 14756 url = seg.footprint.eventDef.url; 14757 if (url && !ev.isDefaultPrevented()) { 14758 window.location.href = url; // simulate link click 14759 } 14760 } 14761 }; 14762 return ListEventPointing; 14763}(EventPointing_1.default)); 14764exports.default = ListEventPointing; 14765 14766 14767/***/ }), 14768/* 256 */ 14769/***/ (function(module, exports, __webpack_require__) { 14770 14771Object.defineProperty(exports, "__esModule", { value: true }); 14772var EventSourceParser_1 = __webpack_require__(38); 14773var ArrayEventSource_1 = __webpack_require__(52); 14774var FuncEventSource_1 = __webpack_require__(215); 14775var JsonFeedEventSource_1 = __webpack_require__(216); 14776EventSourceParser_1.default.registerClass(ArrayEventSource_1.default); 14777EventSourceParser_1.default.registerClass(FuncEventSource_1.default); 14778EventSourceParser_1.default.registerClass(JsonFeedEventSource_1.default); 14779 14780 14781/***/ }), 14782/* 257 */ 14783/***/ (function(module, exports, __webpack_require__) { 14784 14785Object.defineProperty(exports, "__esModule", { value: true });
14786var ThemeRegistry_1 = __webpack_require__(51); 14787var StandardTheme_1 = __webpack_require__(213); 14788var JqueryUiTheme_1 = __webpack_require__(214); 14789var Bootstrap3Theme_1 = __webpack_require__(258); 14790var Bootstrap4Theme_1 = __webpack_require__(259); 14791ThemeRegistry_1.defineThemeSystem('standard', StandardTheme_1.default); 14792ThemeRegistry_1.defineThemeSystem('jquery-ui', JqueryUiTheme_1.default); 14793ThemeRegistry_1.defineThemeSystem('bootstrap3', Bootstrap3Theme_1.default); 14794ThemeRegistry_1.defineThemeSystem('bootstrap4', Bootstrap4Theme_1.default); 14795 14796 14797/***/ }), 14798/* 258 */ 14799/***/ (function(module, exports, __webpack_require__) { 14800 14801Object.defineProperty(exports, "__esModule", { value: true }); 14802var tslib_1 = __webpack_require__(2); 14803var Theme_1 = __webpack_require__(19); 14804var Bootstrap3Theme = /** @class */ (function (_super) { 14805 tslib_1.__extends(Bootstrap3Theme, _super); 14806 function Bootstrap3Theme() { 14807 return _super !== null && _super.apply(this, arguments) || this; 14808 } 14809 return Bootstrap3Theme; 14810}(Theme_1.default)); 14811exports.default = Bootstrap3Theme; 14812Bootstrap3Theme.prototype.classes = { 14813 widget: 'fc-bootstrap3', 14814 tableGrid: 'table-bordered', 14815 tableList: 'table', 14816 tableListHeading: 'active', 14817 buttonGroup: 'btn-group', 14818 button: 'btn btn-default', 14819 stateActive: 'active', 14820 stateDisabled: 'disabled', 14821 today: 'alert alert-info', 14822 popover: 'panel panel-default', 14823 popoverHeader: 'panel-heading', 14824 popoverContent: 'panel-body', 14825 // day grid 14826 // for left/right border color when border is inset from edges (all-day in agenda view) 14827 // avoid `panel` class b/c don't want margins/radius. only border color. 14828 headerRow: 'panel-default', 14829 dayRow: 'panel-default', 14830 // list view 14831 listView: 'panel panel-default' 14832}; 14833Bootstrap3Theme.prototype.baseIconClass = 'glyphicon'; 14834Bootstrap3Theme.prototype.iconClasses = { 14835 close: 'glyphicon-remove', 14836 prev: 'glyphicon-chevron-left', 14837 next: 'glyphicon-chevron-right', 14838 prevYear: 'glyphicon-backward', 14839 nextYear: 'glyphicon-forward' 14840}; 14841Bootstrap3Theme.prototype.iconOverrideOption = 'bootstrapGlyphicons'; 14842Bootstrap3Theme.prototype.iconOverrideCustomButtonOption = 'bootstrapGlyphicon'; 14843Bootstrap3Theme.prototype.iconOverridePrefix = 'glyphicon-'; 14844 14845 14846/***/ }), 14847/* 259 */ 14848/***/ (function(module, exports, __webpack_require__) { 14849 14850Object.defineProperty(exports, "__esModule", { value: true }); 14851var tslib_1 = __webpack_require__(2); 14852var Theme_1 = __webpack_require__(19); 14853var Bootstrap4Theme = /** @class */ (function (_super) { 14854 tslib_1.__extends(Bootstrap4Theme, _super); 14855 function Bootstrap4Theme() { 14856 return _super !== null && _super.apply(this, arguments) || this; 14857 } 14858 return Bootstrap4Theme; 14859}(Theme_1.default)); 14860exports.default = Bootstrap4Theme; 14861Bootstrap4Theme.prototype.classes = { 14862 widget: 'fc-bootstrap4',
14863 tableGrid: 'table-bordered', 14864 tableList: 'table', 14865 tableListHeading: 'table-active', 14866 buttonGroup: 'btn-group', 14867 button: 'btn btn-primary', 14868 stateActive: 'active', 14869 stateDisabled: 'disabled', 14870 today: 'alert alert-info', 14871 popover: 'card card-primary', 14872 popoverHeader: 'card-header', 14873 popoverContent: 'card-body', 14874 // day grid 14875 // for left/right border color when border is inset from edges (all-day in agenda view) 14876 // avoid `table` class b/c don't want margins/padding/structure. only border color. 14877 headerRow: 'table-bordered', 14878 dayRow: 'table-bordered', 14879 // list view 14880 listView: 'card card-primary' 14881}; 14882Bootstrap4Theme.prototype.baseIconClass = 'fa'; 14883Bootstrap4Theme.prototype.iconClasses = { 14884 close: 'fa-times', 14885 prev: 'fa-chevron-left', 14886 next: 'fa-chevron-right', 14887 prevYear: 'fa-angle-double-left', 14888 nextYear: 'fa-angle-double-right' 14889}; 14890Bootstrap4Theme.prototype.iconOverrideOption = 'bootstrapFontAwesome'; 14891Bootstrap4Theme.prototype.iconOverrideCustomButtonOption = 'bootstrapFontAwesome'; 14892Bootstrap4Theme.prototype.iconOverridePrefix = 'fa-'; 14893 14894 14895/***/ }), 14896/* 260 */ 14897/***/ (function(module, exports, __webpack_require__) { 14898 14899Object.defineProperty(exports, "__esModule", { value: true }); 14900var ViewRegistry_1 = __webpack_require__(22); 14901var BasicView_1 = __webpack_require__(62); 14902var MonthView_1 = __webpack_require__(229); 14903ViewRegistry_1.defineView('basic', { 14904 'class': BasicView_1.default 14905}); 14906ViewRegistry_1.defineView('basicDay', { 14907 type: 'basic', 14908 duration: { days: 1 } 14909}); 14910ViewRegistry_1.defineView('basicWeek', { 14911 type: 'basic', 14912 duration: { weeks: 1 } 14913}); 14914ViewRegistry_1.defineView('month', { 14915 'class': MonthView_1.default, 14916 duration: { months: 1 }, 14917 defaults: { 14918 fixedWeekCount: true 14919 } 14920}); 14921 14922 14923/***/ }), 14924/* 261 */ 14925/***/ (function(module, exports, __webpack_require__) { 14926 14927Object.defineProperty(exports, "__esModule", { value: true }); 14928var ViewRegistry_1 = __webpack_require__(22); 14929var AgendaView_1 = __webpack_require__(226); 14930ViewRegistry_1.defineView('agenda', { 14931 'class': AgendaView_1.default, 14932 defaults: { 14933 allDaySlot: true, 14934 slotDuration: '00:30:00', 14935 slotEventOverlap: true // a bad name. confused with overlap/constraint system 14936 } 14937}); 14938ViewRegistry_1.defineView('agendaDay', { 14939 type: 'agenda', 14940 duration: { days: 1 } 14941}); 14942ViewRegistry_1.defineView('agendaWeek', { 14943 type: 'agenda', 14944 duration: { weeks: 1 } 14945}); 14946 14947 14948/***/ }), 14949/* 262 */ 14950/***/ (function(module, exports, __webpack_require__) { 14951 14952Object.defineProperty(exports, "__esModule", { value: true }); 14953var ViewRegistry_1 = __webpack_require__(22); 14954var ListView_1 = __webpack_require__(230); 14955ViewRegistry_1.defineView('list', { 14956 'class': ListView_1.default, 14957 buttonTextKey: 'list', 14958 defaults: { 14959 buttonText: 'list', 14960 listDayFormat: 'LL', 14961 noEventsMessage: 'No events to display' 14962 } 14963}); 14964ViewRegistry_1.defineView('listDay', { 14965 type: 'list', 14966 duration: { days: 1 }, 14967 defaults: { 14968 listDayFormat: 'dddd' // day-of-week is all we need. full date is probably in header 14969 } 14970}); 14971ViewRegistry_1.defineView('listWeek', { 14972 type: 'list', 14973 duration: { weeks: 1 }, 14974 defaults: { 14975 listDayFormat: 'dddd', 14976 listDayAltFormat: 'LL' 14977 } 14978}); 14979ViewRegistry_1.defineView('listMonth', { 14980 type: 'list', 14981 duration: { month: 1 }, 14982 defaults: { 14983 listDayAltFormat: 'dddd' // day-of-week is nice-to-have 14984 } 14985}); 14986ViewRegistry_1.defineView('listYear', { 14987 type: 'list', 14988 duration: { year: 1 }, 14989 defaults: { 14990 listDayAltFormat: 'dddd' // day-of-week is nice-to-have 14991 } 14992}); 14993 14994 14995/***/ }), 14996/* 263 */ 14997/***/ (function(module, exports) { 14998 14999Object.defineProperty(exports, "__esModule", { value: true }); 15000 15001 15002/***/ }) 15003/******/ ]); 15004});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.