UNPKG

admin-lte

Version:
1,327 lines (1,304 loc) 624 kB
/*! * FullCalendar v3.9.0 * Docs & License: https://fullcalendar.io/ * (c) 2018 Adam Shaw */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("moment"), require("jquery")); else if(typeof define === 'function' && define.amd) define(["moment", "jquery"], factory); else if(typeof exports === 'object') exports["FullCalendar"] = factory(require("moment"), require("jquery")); else root["FullCalendar"] = factory(root["moment"], root["jQuery"]); })(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_3__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 236); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_0__; /***/ }), /* 1 */, /* 2 */ /***/ (function(module, exports) { /* derived from: https://github.com/Microsoft/tslib/blob/v1.6.0/tslib.js only include the helpers we need, to keep down filesize */ var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; exports.__extends = function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; /***/ }), /* 3 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_3__; /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", { value: true }); var moment = __webpack_require__(0); var $ = __webpack_require__(3); /* FullCalendar-specific DOM Utilities ----------------------------------------------------------------------------------------------------------------------*/ // Given the scrollbar widths of some other container, create borders/margins on rowEls in order to match the left // and right space that was offset by the scrollbars. A 1-pixel border first, then margin beyond that. function compensateScroll(rowEls, scrollbarWidths) { if (scrollbarWidths.left) { rowEls.css({ 'border-left-width': 1, 'margin-left': scrollbarWidths.left - 1 }); } if (scrollbarWidths.right) { rowEls.css({ 'border-right-width': 1, 'margin-right': scrollbarWidths.right - 1 }); } } exports.compensateScroll = compensateScroll; // Undoes compensateScroll and restores all borders/margins function uncompensateScroll(rowEls) { rowEls.css({ 'margin-left': '', 'margin-right': '', 'border-left-width': '', 'border-right-width': '' }); } exports.uncompensateScroll = uncompensateScroll; // Make the mouse cursor express that an event is not allowed in the current area function disableCursor() { $('body').addClass('fc-not-allowed'); } exports.disableCursor = disableCursor; // Returns the mouse cursor to its original look function enableCursor() { $('body').removeClass('fc-not-allowed'); } exports.enableCursor = enableCursor; // Given a total available height to fill, have `els` (essentially child rows) expand to accomodate. // By default, all elements that are shorter than the recommended height are expanded uniformly, not considering // any other els that are already too tall. if `shouldRedistribute` is on, it considers these tall rows and // reduces the available height. function distributeHeight(els, availableHeight, shouldRedistribute) { // *FLOORING NOTE*: we floor in certain places because zoom can give inaccurate floating-point dimensions, // and it is better to be shorter than taller, to avoid creating unnecessary scrollbars. var minOffset1 = Math.floor(availableHeight / els.length); // for non-last element var minOffset2 = Math.floor(availableHeight - minOffset1 * (els.length - 1)); // for last element *FLOORING NOTE* var flexEls = []; // elements that are allowed to expand. array of DOM nodes var flexOffsets = []; // amount of vertical space it takes up var flexHeights = []; // actual css height var usedHeight = 0; undistributeHeight(els); // give all elements their natural height // find elements that are below the recommended height (expandable). // important to query for heights in a single first pass (to avoid reflow oscillation). els.each(function (i, el) { var minOffset = i === els.length - 1 ? minOffset2 : minOffset1; var naturalOffset = $(el).outerHeight(true); if (naturalOffset < minOffset) { flexEls.push(el); flexOffsets.push(naturalOffset); flexHeights.push($(el).height()); } else { // this element stretches past recommended height (non-expandable). mark the space as occupied. usedHeight += naturalOffset; } }); // readjust the recommended height to only consider the height available to non-maxed-out rows. if (shouldRedistribute) { availableHeight -= usedHeight; minOffset1 = Math.floor(availableHeight / flexEls.length); minOffset2 = Math.floor(availableHeight - minOffset1 * (flexEls.length - 1)); // *FLOORING NOTE* } // assign heights to all expandable elements $(flexEls).each(function (i, el) { var minOffset = i === flexEls.length - 1 ? minOffset2 : minOffset1; var naturalOffset = flexOffsets[i]; var naturalHeight = flexHeights[i]; var newHeight = minOffset - (naturalOffset - naturalHeight); // subtract the margin/padding if (naturalOffset < minOffset) { $(el).height(newHeight); } }); } exports.distributeHeight = distributeHeight; // Undoes distrubuteHeight, restoring all els to their natural height function undistributeHeight(els) { els.height(''); } exports.undistributeHeight = undistributeHeight; // Given `els`, a jQuery set of <td> cells, find the cell with the largest natural width and set the widths of all the // cells to be that width. // PREREQUISITE: if you want a cell to take up width, it needs to have a single inner element w/ display:inline function matchCellWidths(els) { var maxInnerWidth = 0; els.find('> *').each(function (i, innerEl) { var innerWidth = $(innerEl).outerWidth(); if (innerWidth > maxInnerWidth) { maxInnerWidth = innerWidth; } }); maxInnerWidth++; // sometimes not accurate of width the text needs to stay on one line. insurance els.width(maxInnerWidth); return maxInnerWidth; } exports.matchCellWidths = matchCellWidths; // Given one element that resides inside another, // Subtracts the height of the inner element from the outer element. function subtractInnerElHeight(outerEl, innerEl) { var both = outerEl.add(innerEl); var diff; // effin' IE8/9/10/11 sometimes returns 0 for dimensions. this weird hack was the only thing that worked both.css({ position: 'relative', left: -1 // ensure reflow in case the el was already relative. negative is less likely to cause new scroll }); diff = outerEl.outerHeight() - innerEl.outerHeight(); // grab the dimensions both.css({ position: '', left: '' }); // undo hack return diff; } exports.subtractInnerElHeight = subtractInnerElHeight; /* Element Geom Utilities ----------------------------------------------------------------------------------------------------------------------*/ // borrowed from https://github.com/jquery/jquery-ui/blob/1.11.0/ui/core.js#L51 function getScrollParent(el) { var position = el.css('position'); var scrollParent = el.parents().filter(function () { var parent = $(this); return (/(auto|scroll)/).test(parent.css('overflow') + parent.css('overflow-y') + parent.css('overflow-x')); }).eq(0); return position === 'fixed' || !scrollParent.length ? $(el[0].ownerDocument || document) : scrollParent; } exports.getScrollParent = getScrollParent; // Queries the outer bounding area of a jQuery element. // Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive). // Origin is optional. function getOuterRect(el, origin) { var offset = el.offset(); var left = offset.left - (origin ? origin.left : 0); var top = offset.top - (origin ? origin.top : 0); return { left: left, right: left + el.outerWidth(), top: top, bottom: top + el.outerHeight() }; } exports.getOuterRect = getOuterRect; // Queries the area within the margin/border/scrollbars of a jQuery element. Does not go within the padding. // Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive). // Origin is optional. // WARNING: given element can't have borders // NOTE: should use clientLeft/clientTop, but very unreliable cross-browser. function getClientRect(el, origin) { var offset = el.offset(); var scrollbarWidths = getScrollbarWidths(el); var left = offset.left + getCssFloat(el, 'border-left-width') + scrollbarWidths.left - (origin ? origin.left : 0); var top = offset.top + getCssFloat(el, 'border-top-width') + scrollbarWidths.top - (origin ? origin.top : 0); return { left: left, right: left + el[0].clientWidth, top: top, bottom: top + el[0].clientHeight // clientHeight includes padding but NOT scrollbars }; } exports.getClientRect = getClientRect; // Queries the area within the margin/border/padding of a jQuery element. Assumed not to have scrollbars. // Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive). // Origin is optional. function getContentRect(el, origin) { var offset = el.offset(); // just outside of border, margin not included var left = offset.left + getCssFloat(el, 'border-left-width') + getCssFloat(el, 'padding-left') - (origin ? origin.left : 0); var top = offset.top + getCssFloat(el, 'border-top-width') + getCssFloat(el, 'padding-top') - (origin ? origin.top : 0); return { left: left, right: left + el.width(), top: top, bottom: top + el.height() }; } exports.getContentRect = getContentRect; // Returns the computed left/right/top/bottom scrollbar widths for the given jQuery element. // WARNING: given element can't have borders (which will cause offsetWidth/offsetHeight to be larger). // NOTE: should use clientLeft/clientTop, but very unreliable cross-browser. function getScrollbarWidths(el) { var leftRightWidth = el[0].offsetWidth - el[0].clientWidth; var bottomWidth = el[0].offsetHeight - el[0].clientHeight; var widths; leftRightWidth = sanitizeScrollbarWidth(leftRightWidth); bottomWidth = sanitizeScrollbarWidth(bottomWidth); widths = { left: 0, right: 0, top: 0, bottom: bottomWidth }; if (getIsLeftRtlScrollbars() && el.css('direction') === 'rtl') { widths.left = leftRightWidth; } else { widths.right = leftRightWidth; } return widths; } exports.getScrollbarWidths = getScrollbarWidths; // The scrollbar width computations in getScrollbarWidths are sometimes flawed when it comes to // retina displays, rounding, and IE11. Massage them into a usable value. function sanitizeScrollbarWidth(width) { width = Math.max(0, width); // no negatives width = Math.round(width); return width; } // Logic for determining if, when the element is right-to-left, the scrollbar appears on the left side var _isLeftRtlScrollbars = null; function getIsLeftRtlScrollbars() { if (_isLeftRtlScrollbars === null) { _isLeftRtlScrollbars = computeIsLeftRtlScrollbars(); } return _isLeftRtlScrollbars; } function computeIsLeftRtlScrollbars() { var el = $('<div><div/></div>') .css({ position: 'absolute', top: -1000, left: 0, border: 0, padding: 0, overflow: 'scroll', direction: 'rtl' }) .appendTo('body'); var innerEl = el.children(); var res = innerEl.offset().left > el.offset().left; // is the inner div shifted to accommodate a left scrollbar? el.remove(); return res; } // Retrieves a jQuery element's computed CSS value as a floating-point number. // If the queried value is non-numeric (ex: IE can return "medium" for border width), will just return zero. function getCssFloat(el, prop) { return parseFloat(el.css(prop)) || 0; } /* Mouse / Touch Utilities ----------------------------------------------------------------------------------------------------------------------*/ // Returns a boolean whether this was a left mouse click and no ctrl key (which means right click on Mac) function isPrimaryMouseButton(ev) { return ev.which === 1 && !ev.ctrlKey; } exports.isPrimaryMouseButton = isPrimaryMouseButton; function getEvX(ev) { var touches = ev.originalEvent.touches; // on mobile FF, pageX for touch events is present, but incorrect, // so, look at touch coordinates first. if (touches && touches.length) { return touches[0].pageX; } return ev.pageX; } exports.getEvX = getEvX; function getEvY(ev) { var touches = ev.originalEvent.touches; // on mobile FF, pageX for touch events is present, but incorrect, // so, look at touch coordinates first. if (touches && touches.length) { return touches[0].pageY; } return ev.pageY; } exports.getEvY = getEvY; function getEvIsTouch(ev) { return /^touch/.test(ev.type); } exports.getEvIsTouch = getEvIsTouch; function preventSelection(el) { el.addClass('fc-unselectable') .on('selectstart', preventDefault); } exports.preventSelection = preventSelection; function allowSelection(el) { el.removeClass('fc-unselectable') .off('selectstart', preventDefault); } exports.allowSelection = allowSelection; // Stops a mouse/touch event from doing it's native browser action function preventDefault(ev) { ev.preventDefault(); } exports.preventDefault = preventDefault; /* General Geometry Utils ----------------------------------------------------------------------------------------------------------------------*/ // Returns a new rectangle that is the intersection of the two rectangles. If they don't intersect, returns false function intersectRects(rect1, rect2) { var res = { left: Math.max(rect1.left, rect2.left), right: Math.min(rect1.right, rect2.right), top: Math.max(rect1.top, rect2.top), bottom: Math.min(rect1.bottom, rect2.bottom) }; if (res.left < res.right && res.top < res.bottom) { return res; } return false; } exports.intersectRects = intersectRects; // Returns a new point that will have been moved to reside within the given rectangle function constrainPoint(point, rect) { return { left: Math.min(Math.max(point.left, rect.left), rect.right), top: Math.min(Math.max(point.top, rect.top), rect.bottom) }; } exports.constrainPoint = constrainPoint; // Returns a point that is the center of the given rectangle function getRectCenter(rect) { return { left: (rect.left + rect.right) / 2, top: (rect.top + rect.bottom) / 2 }; } exports.getRectCenter = getRectCenter; // Subtracts point2's coordinates from point1's coordinates, returning a delta function diffPoints(point1, point2) { return { left: point1.left - point2.left, top: point1.top - point2.top }; } exports.diffPoints = diffPoints; /* Object Ordering by Field ----------------------------------------------------------------------------------------------------------------------*/ function parseFieldSpecs(input) { var specs = []; var tokens = []; var i; var token; if (typeof input === 'string') { tokens = input.split(/\s*,\s*/); } else if (typeof input === 'function') { tokens = [input]; } else if ($.isArray(input)) { tokens = input; } for (i = 0; i < tokens.length; i++) { token = tokens[i]; if (typeof token === 'string') { specs.push(token.charAt(0) === '-' ? { field: token.substring(1), order: -1 } : { field: token, order: 1 }); } else if (typeof token === 'function') { specs.push({ func: token }); } } return specs; } exports.parseFieldSpecs = parseFieldSpecs; function compareByFieldSpecs(obj1, obj2, fieldSpecs, obj1fallback, obj2fallback) { var i; var cmp; for (i = 0; i < fieldSpecs.length; i++) { cmp = compareByFieldSpec(obj1, obj2, fieldSpecs[i], obj1fallback, obj2fallback); if (cmp) { return cmp; } } return 0; } exports.compareByFieldSpecs = compareByFieldSpecs; function compareByFieldSpec(obj1, obj2, fieldSpec, obj1fallback, obj2fallback) { if (fieldSpec.func) { return fieldSpec.func(obj1, obj2); } var val1 = obj1[fieldSpec.field]; var val2 = obj2[fieldSpec.field]; if (val1 == null && obj1fallback) { val1 = obj1fallback[fieldSpec.field]; } if (val2 == null && obj2fallback) { val2 = obj2fallback[fieldSpec.field]; } return flexibleCompare(val1, val2) * (fieldSpec.order || 1); } exports.compareByFieldSpec = compareByFieldSpec; function flexibleCompare(a, b) { if (!a && !b) { return 0; } if (b == null) { return -1; } if (a == null) { return 1; } if ($.type(a) === 'string' || $.type(b) === 'string') { return String(a).localeCompare(String(b)); } return a - b; } exports.flexibleCompare = flexibleCompare; /* Date Utilities ----------------------------------------------------------------------------------------------------------------------*/ exports.dayIDs = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; exports.unitsDesc = ['year', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond']; // descending // Diffs the two moments into a Duration where full-days are recorded first, then the remaining time. // Moments will have their timezones normalized. function diffDayTime(a, b) { return moment.duration({ days: a.clone().stripTime().diff(b.clone().stripTime(), 'days'), ms: a.time() - b.time() // time-of-day from day start. disregards timezone }); } exports.diffDayTime = diffDayTime; // Diffs the two moments via their start-of-day (regardless of timezone). Produces whole-day durations. function diffDay(a, b) { return moment.duration({ days: a.clone().stripTime().diff(b.clone().stripTime(), 'days') }); } exports.diffDay = diffDay; // Diffs two moments, producing a duration, made of a whole-unit-increment of the given unit. Uses rounding. function diffByUnit(a, b, unit) { return moment.duration(Math.round(a.diff(b, unit, true)), // returnFloat=true unit); } exports.diffByUnit = diffByUnit; // Computes the unit name of the largest whole-unit period of time. // For example, 48 hours will be "days" whereas 49 hours will be "hours". // Accepts start/end, a range object, or an original duration object. function computeGreatestUnit(start, end) { var i; var unit; var val; for (i = 0; i < exports.unitsDesc.length; i++) { unit = exports.unitsDesc[i]; val = computeRangeAs(unit, start, end); if (val >= 1 && isInt(val)) { break; } } return unit; // will be "milliseconds" if nothing else matches } exports.computeGreatestUnit = computeGreatestUnit; // like computeGreatestUnit, but has special abilities to interpret the source input for clues function computeDurationGreatestUnit(duration, durationInput) { var unit = computeGreatestUnit(duration); // prevent days:7 from being interpreted as a week if (unit === 'week' && typeof durationInput === 'object' && durationInput.days) { unit = 'day'; } return unit; } exports.computeDurationGreatestUnit = computeDurationGreatestUnit; // Computes the number of units (like "hours") in the given range. // Range can be a {start,end} object, separate start/end args, or a Duration. // Results are based on Moment's .as() and .diff() methods, so results can depend on internal handling // of month-diffing logic (which tends to vary from version to version). function computeRangeAs(unit, start, end) { if (end != null) { return end.diff(start, unit, true); } else if (moment.isDuration(start)) { return start.as(unit); } else { return start.end.diff(start.start, unit, true); } } // Intelligently divides a range (specified by a start/end params) by a duration function divideRangeByDuration(start, end, dur) { var months; if (durationHasTime(dur)) { return (end - start) / dur; } months = dur.asMonths(); if (Math.abs(months) >= 1 && isInt(months)) { return end.diff(start, 'months', true) / months; } return end.diff(start, 'days', true) / dur.asDays(); } exports.divideRangeByDuration = divideRangeByDuration; // Intelligently divides one duration by another function divideDurationByDuration(dur1, dur2) { var months1; var months2; if (durationHasTime(dur1) || durationHasTime(dur2)) { return dur1 / dur2; } months1 = dur1.asMonths(); months2 = dur2.asMonths(); if (Math.abs(months1) >= 1 && isInt(months1) && Math.abs(months2) >= 1 && isInt(months2)) { return months1 / months2; } return dur1.asDays() / dur2.asDays(); } exports.divideDurationByDuration = divideDurationByDuration; // Intelligently multiplies a duration by a number function multiplyDuration(dur, n) { var months; if (durationHasTime(dur)) { return moment.duration(dur * n); } months = dur.asMonths(); if (Math.abs(months) >= 1 && isInt(months)) { return moment.duration({ months: months * n }); } return moment.duration({ days: dur.asDays() * n }); } exports.multiplyDuration = multiplyDuration; // Returns a boolean about whether the given duration has any time parts (hours/minutes/seconds/ms) function durationHasTime(dur) { return Boolean(dur.hours() || dur.minutes() || dur.seconds() || dur.milliseconds()); } exports.durationHasTime = durationHasTime; function isNativeDate(input) { return Object.prototype.toString.call(input) === '[object Date]' || input instanceof Date; } exports.isNativeDate = isNativeDate; // Returns a boolean about whether the given input is a time string, like "06:40:00" or "06:00" function isTimeString(str) { return typeof str === 'string' && /^\d+\:\d+(?:\:\d+\.?(?:\d{3})?)?$/.test(str); } exports.isTimeString = isTimeString; /* Logging and Debug ----------------------------------------------------------------------------------------------------------------------*/ function log() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var console = window.console; if (console && console.log) { return console.log.apply(console, args); } } exports.log = log; function warn() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var console = window.console; if (console && console.warn) { return console.warn.apply(console, args); } else { return log.apply(null, args); } } exports.warn = warn; /* General Utilities ----------------------------------------------------------------------------------------------------------------------*/ var hasOwnPropMethod = {}.hasOwnProperty; // Merges an array of objects into a single object. // The second argument allows for an array of property names who's object values will be merged together. function mergeProps(propObjs, complexProps) { var dest = {}; var i; var name; var complexObjs; var j; var val; var props; if (complexProps) { for (i = 0; i < complexProps.length; i++) { name = complexProps[i]; complexObjs = []; // collect the trailing object values, stopping when a non-object is discovered for (j = propObjs.length - 1; j >= 0; j--) { val = propObjs[j][name]; if (typeof val === 'object') { complexObjs.unshift(val); } else if (val !== undefined) { dest[name] = val; // if there were no objects, this value will be used break; } } // if the trailing values were objects, use the merged value if (complexObjs.length) { dest[name] = mergeProps(complexObjs); } } } // copy values into the destination, going from last to first for (i = propObjs.length - 1; i >= 0; i--) { props = propObjs[i]; for (name in props) { if (!(name in dest)) { dest[name] = props[name]; } } } return dest; } exports.mergeProps = mergeProps; function copyOwnProps(src, dest) { for (var name_1 in src) { if (hasOwnProp(src, name_1)) { dest[name_1] = src[name_1]; } } } exports.copyOwnProps = copyOwnProps; function hasOwnProp(obj, name) { return hasOwnPropMethod.call(obj, name); } exports.hasOwnProp = hasOwnProp; function applyAll(functions, thisObj, args) { if ($.isFunction(functions)) { functions = [functions]; } if (functions) { var i = void 0; var ret = void 0; for (i = 0; i < functions.length; i++) { ret = functions[i].apply(thisObj, args) || ret; } return ret; } } exports.applyAll = applyAll; function removeMatching(array, testFunc) { var removeCnt = 0; var i = 0; while (i < array.length) { if (testFunc(array[i])) { array.splice(i, 1); removeCnt++; } else { i++; } } return removeCnt; } exports.removeMatching = removeMatching; function removeExact(array, exactVal) { var removeCnt = 0; var i = 0; while (i < array.length) { if (array[i] === exactVal) { array.splice(i, 1); removeCnt++; } else { i++; } } return removeCnt; } exports.removeExact = removeExact; function isArraysEqual(a0, a1) { var len = a0.length; var i; if (len == null || len !== a1.length) { return false; } for (i = 0; i < len; i++) { if (a0[i] !== a1[i]) { return false; } } return true; } exports.isArraysEqual = isArraysEqual; function firstDefined() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } for (var i = 0; i < args.length; i++) { if (args[i] !== undefined) { return args[i]; } } } exports.firstDefined = firstDefined; function htmlEscape(s) { return (s + '').replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/'/g, '&#039;') .replace(/"/g, '&quot;') .replace(/\n/g, '<br />'); } exports.htmlEscape = htmlEscape; function stripHtmlEntities(text) { return text.replace(/&.*?;/g, ''); } exports.stripHtmlEntities = stripHtmlEntities; // Given a hash of CSS properties, returns a string of CSS. // Uses property names as-is (no camel-case conversion). Will not make statements for null/undefined values. function cssToStr(cssProps) { var statements = []; $.each(cssProps, function (name, val) { if (val != null) { statements.push(name + ':' + val); } }); return statements.join(';'); } exports.cssToStr = cssToStr; // Given an object hash of HTML attribute names to values, // generates a string that can be injected between < > in HTML function attrsToStr(attrs) { var parts = []; $.each(attrs, function (name, val) { if (val != null) { parts.push(name + '="' + htmlEscape(val) + '"'); } }); return parts.join(' '); } exports.attrsToStr = attrsToStr; function capitaliseFirstLetter(str) { return str.charAt(0).toUpperCase() + str.slice(1); } exports.capitaliseFirstLetter = capitaliseFirstLetter; function compareNumbers(a, b) { return a - b; } exports.compareNumbers = compareNumbers; function isInt(n) { return n % 1 === 0; } exports.isInt = isInt; // Returns a method bound to the given object context. // Just like one of the jQuery.proxy signatures, but without the undesired behavior of treating the same method with // different contexts as identical when binding/unbinding events. function proxy(obj, methodName) { var method = obj[methodName]; return function () { return method.apply(obj, arguments); }; } exports.proxy = proxy; // Returns a function, that, as long as it continues to be invoked, will not // be triggered. The function will be called after it stops being called for // N milliseconds. If `immediate` is passed, trigger the function on the // leading edge, instead of the trailing. // https://github.com/jashkenas/underscore/blob/1.6.0/underscore.js#L714 function debounce(func, wait, immediate) { if (immediate === void 0) { immediate = false; } var timeout; var args; var context; var timestamp; var result; var later = function () { var last = +new Date() - timestamp; if (last < wait) { timeout = setTimeout(later, wait - last); } else { timeout = null; if (!immediate) { result = func.apply(context, args); context = args = null; } } }; return function () { context = this; args = arguments; timestamp = +new Date(); var callNow = immediate && !timeout; if (!timeout) { timeout = setTimeout(later, wait); } if (callNow) { result = func.apply(context, args); context = args = null; } return result; }; } exports.debounce = debounce; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", { value: true }); var moment = __webpack_require__(0); var moment_ext_1 = __webpack_require__(10); var UnzonedRange = /** @class */ (function () { function UnzonedRange(startInput, endInput) { // TODO: move these into footprint. // Especially, doesn't make sense for null startMs/endMs. this.isStart = true; this.isEnd = true; if (moment.isMoment(startInput)) { startInput = startInput.clone().stripZone(); } if (moment.isMoment(endInput)) { endInput = endInput.clone().stripZone(); } if (startInput) { this.startMs = startInput.valueOf(); } if (endInput) { this.endMs = endInput.valueOf(); } } /* SIDEEFFECT: will mutate eventRanges. Will return a new array result. Only works for non-open-ended ranges. */ UnzonedRange.invertRanges = function (ranges, constraintRange) { var invertedRanges = []; var startMs = constraintRange.startMs; // the end of the previous range. the start of the new range var i; var dateRange; // ranges need to be in order. required for our date-walking algorithm ranges.sort(compareUnzonedRanges); for (i = 0; i < ranges.length; i++) { dateRange = ranges[i]; // add the span of time before the event (if there is any) if (dateRange.startMs > startMs) { invertedRanges.push(new UnzonedRange(startMs, dateRange.startMs)); } if (dateRange.endMs > startMs) { startMs = dateRange.endMs; } } // add the span of time after the last event (if there is any) if (startMs < constraintRange.endMs) { invertedRanges.push(new UnzonedRange(startMs, constraintRange.endMs)); } return invertedRanges; }; UnzonedRange.prototype.intersect = function (otherRange) { var startMs = this.startMs; var endMs = this.endMs; var newRange = null; if (otherRange.startMs != null) { if (startMs == null) { startMs = otherRange.startMs; } else { startMs = Math.max(startMs, otherRange.startMs); } } if (otherRange.endMs != null) { if (endMs == null) { endMs = otherRange.endMs; } else { endMs = Math.min(endMs, otherRange.endMs); } } if (startMs == null || endMs == null || startMs < endMs) { newRange = new UnzonedRange(startMs, endMs); newRange.isStart = this.isStart && startMs === this.startMs; newRange.isEnd = this.isEnd && endMs === this.endMs; } return newRange; }; UnzonedRange.prototype.intersectsWith = function (otherRange) { return (this.endMs == null || otherRange.startMs == null || this.endMs > otherRange.startMs) && (this.startMs == null || otherRange.endMs == null || this.startMs < otherRange.endMs); }; UnzonedRange.prototype.containsRange = function (innerRange) { return (this.startMs == null || (innerRange.startMs != null && innerRange.startMs >= this.startMs)) && (this.endMs == null || (innerRange.endMs != null && innerRange.endMs <= this.endMs)); }; // `date` can be a moment, a Date, or a millisecond time. UnzonedRange.prototype.containsDate = function (date) { var ms = date.valueOf(); return (this.startMs == null || ms >= this.startMs) && (this.endMs == null || ms < this.endMs); }; // If the given date is not within the given range, move it inside. // (If it's past the end, make it one millisecond before the end). // `date` can be a moment, a Date, or a millisecond time. // Returns a MS-time. UnzonedRange.prototype.constrainDate = function (date) { var ms = date.valueOf(); if (this.startMs != null && ms < this.startMs) { ms = this.startMs; } if (this.endMs != null && ms >= this.endMs) { ms = this.endMs - 1; } return ms; }; UnzonedRange.prototype.equals = function (otherRange) { return this.startMs === otherRange.startMs && this.endMs === otherRange.endMs; }; UnzonedRange.prototype.clone = function () { var range = new UnzonedRange(this.startMs, this.endMs); range.isStart = this.isStart; range.isEnd = this.isEnd; return range; }; // Returns an ambig-zoned moment from startMs. // BEWARE: returned moment is not localized. // Formatting and start-of-week will be default. UnzonedRange.prototype.getStart = function () { if (this.startMs != null) { return moment_ext_1.default.utc(this.startMs).stripZone(); } return null; }; // Returns an ambig-zoned moment from startMs. // BEWARE: returned moment is not localized. // Formatting and start-of-week will be default. UnzonedRange.prototype.getEnd = function () { if (this.endMs != null) { return moment_ext_1.default.utc(this.endMs).stripZone(); } return null; }; UnzonedRange.prototype.as = function (unit) { return moment.utc(this.endMs).diff(moment.utc(this.startMs), unit, true); }; return UnzonedRange; }()); exports.default = UnzonedRange; /* Only works for non-open-ended ranges. */ function compareUnzonedRanges(range1, range2) { return range1.startMs - range2.startMs; // earlier ranges go first } /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(2); var $ = __webpack_require__(3); var ParsableModelMixin_1 = __webpack_require__(208); var Class_1 = __webpack_require__(33); var EventDefParser_1 = __webpack_require__(49); var EventSource = /** @class */ (function (_super) { tslib_1.__extends(EventSource, _super); // can we do away with calendar? at least for the abstract? // useful for buildEventDef function EventSource(calendar) { var _this = _super.call(this) || this; _this.calendar = calendar; _this.className = []; _this.uid = String(EventSource.uuid++); return _this; } /* rawInput can be any data type! */ EventSource.parse = function (rawInput, calendar) { var source = new this(calendar); if (typeof rawInput === 'object') { if (source.applyProps(rawInput)) { return source; } } return false; }; EventSource.normalizeId = function (id) { if (id) { return String(id); } return null; }; EventSource.prototype.fetch = function (start, end, timezone) { // subclasses must implement. must return a promise. }; EventSource.prototype.removeEventDefsById = function (eventDefId) { // optional for subclasses to implement }; EventSource.prototype.removeAllEventDefs = function () { // optional for subclasses to implement }; /* For compairing/matching */ EventSource.prototype.getPrimitive = function (otherSource) { // subclasses must implement }; EventSource.prototype.parseEventDefs = function (rawEventDefs) { var i; var eventDef; var eventDefs = []; for (i = 0; i < rawEventDefs.length; i++) { eventDef = this.parseEventDef(rawEventDefs[i]); if (eventDef) { eventDefs.push(eventDef); } } return eventDefs; }; EventSource.prototype.parseEventDef = function (rawInput) { var calendarTransform = this.calendar.opt('eventDataTransform'); var sourceTransform = this.eventDataTransform; if (calendarTransform) { rawInput = calendarTransform(rawInput, this.calendar); } if (sourceTransform) { rawInput = sourceTransform(rawInput, this.calendar); } return EventDefParser_1.default.parse(rawInput, this); }; EventSource.prototype.applyManualStandardProps = function (rawProps) { if (rawProps.id != null) { this.id = EventSource.normalizeId(rawProps.id); } // TODO: converge with EventDef if ($.isArray(rawProps.className)) { this.className = rawProps.className; } else if (typeof rawProps.className === 'string') { this.className = rawProps.className.split(/\s+/); } return true; }; EventSource.uuid = 0; EventSource.defineStandardProps = ParsableModelMixin_1.default.defineStandardProps; EventSource.copyVerbatimStandardProps = ParsableModelMixin_1.default.copyVerbatimStandardProps; return EventSource; }(Class_1.default)); exports.default = EventSource; ParsableModelMixin_1.default.mixInto(EventSource); // Parsing // --------------------------------------------------------------------------------------------------------------------- EventSource.defineStandardProps({ // manually process... id: false, className: false, // automatically transfer... color: true, backgroundColor: true, borderColor: true, textColor: true, editable: true, startEditable: true, durationEditable: true, rendering: true, overlap: true, constraint: true, allDayDefault: true, eventDataTransform: true }); /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { /* Utility methods for easily listening to events on another object, and more importantly, easily unlistening from them. USAGE: import { default as ListenerMixin, ListenerInterface } from './ListenerMixin' in class: listenTo: ListenerInterface['listenTo'] stopListeningTo: ListenerInterface['stopListeningTo'] after class: ListenerMixin.mixInto(TheClass) */ Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = __webpack_require__(2); var $ = __webpack_require__(3); var Mixin_1 = __webpack_require__(14); var guid = 0; var ListenerMixin = /** @class */ (function (_super) { tslib_1.__extends(ListenerMixin, _super); function ListenerMixin() { return _super !== null && _super.apply(this, arguments) || this; } /* Given an `other` object that has on/off methods, bind the given `callback` to an event by the given name. The `callback` will be called with the `this` context of the object that .listenTo is being called on. Can be called: .listenTo(other, eventName, callback) OR .listenTo(other, { eventName1: callback1, eventName2: callback2 }) */ ListenerMixin.prototype.listenTo = function (other, arg, callback) { if (typeof arg === 'object') { for (var eventName in arg) { if (arg.hasOwnProperty(eventName)) { this.listenTo(other, eventName, arg[eventName]); } } } else if (typeof arg === 'string') { other.on(arg + '.' + this.getListenerNamespace(), // use event namespacing to identify this object $.proxy(callback, this) // always use `this` context // the usually-undesired jQuery guid behavior doesn't matter, // because we always unbind via namespace ); } }; /* Causes the current object to stop listening to events on the `other` object. `eventName` is optional. If omitted, will stop listening to ALL events on `other`. */ ListenerMixin.prototype.stopListeningTo = function (other, eventName) { other.off((eventName || '') + '.' + this.getListenerNamespace()); }; /* Returns a string, unique to this object, to be used for event namespacing */ ListenerMixin.prototype.getListenerNamespace = function () { if (this.listenerId == null) { this.listenerId = guid++; } return '_listener' + this.listenerId; }; return ListenerMixin; }(Mixin_1.default)); exports.default = ListenerMixin; /***/ }), /* 8 */, /* 9 */, /* 10 */ /***/ (function(module, exports, __webpack_require__) { Object.defineProperty(exports, "__esModule", { value: true }); var moment = __webpack_require__(0); var $ = __webpack_require__(3); var util_1 = __webpack_require__(4); var ambigDateOfMonthRegex = /^\s*\d{4}-\d\d$/; var 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+)?)?)?)?)?$/; var newMomentProto = moment.fn; // where we will attach our new methods exports.newMomentProto = newMomentProto; var oldMomentProto = $.extend({}, newMomentProto); // copy of original moment methods exports.oldMomentProto = oldMomentProto; // tell momentjs to transfer these properties upon clone var momentProperties = moment.momentProperties; momentProperties.push('_fullCalendar'); momentProperties.push('_ambigTime'); momentProperties.push('_ambigZone'); /* Call this if you want Moment's original format method to be used */ function oldMomentFormat(mom, formatStr) { return oldMomentProto.format.call(mom, formatStr); // oldMomentProto defined in moment-ext.js } exports.oldMomentFormat = oldMomentFormat; // Creating // ------------------------------------------------------------------------------------------------- // Creates a new moment, similar to the vanilla moment(...) constructor, but with // extra features (ambiguous time, enhanced formatting). When given an existing moment, // it will function as a clone (and retain the zone of the moment). Anything else will // result in a moment in the local zone. var momentExt = function () { return makeMoment(arguments); }; exports.default = momentExt; // Sames as momentExt, but forces the resulting moment to be in the UTC timezone. momentExt.utc = function () { var mom = makeMoment(arguments, true); // Force it into UTC because makeMoment doesn't guarantee it // (if given a pre-existing moment for example) if (mom.hasTime()) { mom.utc(); } return mom; }; // Same as momentExt, but when given an ISO8601 string, the timezone offset is preserved. // ISO8601 strings with no timezone offset will become ambiguously zoned. momentExt.parseZone = function () { return makeMoment(arguments, true, true); }; // Builds an enhanced moment from args. When given an existing moment, it clones. When given a // native Date, or called with no arguments (the current time), the resulting moment will be local. // Anything else needs to be "parsed" (a string or an array), and will be affected by: // parseAsUTC - if there is no zone information, should we parse the input in UTC? // parseZone - if there is zone information, should we force the zone of the moment? function makeMoment(args, parseAsUTC, parseZone) { if (parseAsUTC === void 0) { parseAsUTC = false; } if (parseZone === void 0) { parseZone = false; } var input = args[0]; var isSingleString = args.length === 1 && typeof input === 'string'; var isAmbigTime; var isAmbigZone; var ambigMatch; var mom; if (moment.isMoment(input) || util_1.isNativeDate(input) || input === undefined) { mom = moment.apply(null, args); } else { isAmbigTime = false; isAmbigZone = false; if (isSingleString) { if (ambigDateOfMonthRegex.test(input)) { // accept strings like '2014-05', but convert to the first of the month input += '-01'; args = [input]; // for when we pass it on to moment's constructor isAmbigTime = true; isAmbigZone = true;