/*! * TOAST UI Calendar * @version 1.14.1 | Wed Sep 01 2021 * @author NHN FE Development Lab * @license MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("tui-code-snippet"), require("tui-date-picker")); else if(typeof define === 'function' && define.amd) define(["tui-code-snippet", "tui-date-picker"], factory); else if(typeof exports === 'object') exports["Calendar"] = factory(require("tui-code-snippet"), require("tui-date-picker")); else root["tui"] = root["tui"] || {}, root["tui"]["Calendar"] = factory((root["tui"] && root["tui"]["util"]), (root["tui"] && root["tui"]["DatePicker"])); })(window, function(__WEBPACK_EXTERNAL_MODULE_tui_code_snippet__, __WEBPACK_EXTERNAL_MODULE_tui_date_picker__) { 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, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // 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 = "/dist"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "./src/index.js"); /******/ }) /************************************************************************/ /******/ ({ /***/ "./node_modules/dompurify/dist/purify.js": /*!***********************************************!*\ !*** ./node_modules/dompurify/dist/purify.js ***! \***********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { /*! @license DOMPurify 2.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.1/LICENSE */ (function (global, factory) { true ? module.exports = factory() : undefined; }(this, function () { 'use strict'; function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } var hasOwnProperty = Object.hasOwnProperty, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var freeze = Object.freeze, seal = Object.seal, create = Object.create; // eslint-disable-line import/no-mutable-exports var _ref = typeof Reflect !== 'undefined' && Reflect, apply = _ref.apply, construct = _ref.construct; if (!apply) { apply = function apply(fun, thisValue, args) { return fun.apply(thisValue, args); }; } if (!freeze) { freeze = function freeze(x) { return x; }; } if (!seal) { seal = function seal(x) { return x; }; } if (!construct) { construct = function construct(Func, args) { return new (Function.prototype.bind.apply(Func, [null].concat(_toConsumableArray(args))))(); }; } var arrayForEach = unapply(Array.prototype.forEach); var arrayPop = unapply(Array.prototype.pop); var arrayPush = unapply(Array.prototype.push); var stringToLowerCase = unapply(String.prototype.toLowerCase); var stringMatch = unapply(String.prototype.match); var stringReplace = unapply(String.prototype.replace); var stringIndexOf = unapply(String.prototype.indexOf); var stringTrim = unapply(String.prototype.trim); var regExpTest = unapply(RegExp.prototype.test); var typeErrorCreate = unconstruct(TypeError); function unapply(func) { return function (thisArg) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return apply(func, thisArg, args); }; } function unconstruct(func) { return function () { for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return construct(func, args); }; } /* Add properties to a lookup table */ function addToSet(set, array) { if (setPrototypeOf) { // Make 'in' and truthy checks like Boolean(set.constructor) // independent of any properties defined on Object.prototype. // Prevent prototype setters from intercepting set as a this value. setPrototypeOf(set, null); } var l = array.length; while (l--) { var element = array[l]; if (typeof element === 'string') { var lcElement = stringToLowerCase(element); if (lcElement !== element) { // Config presets (e.g. tags.js, attrs.js) are immutable. if (!isFrozen(array)) { array[l] = lcElement; } element = lcElement; } } set[element] = true; } return set; } /* Shallow clone an object */ function clone(object) { var newObject = create(null); var property = void 0; for (property in object) { if (apply(hasOwnProperty, object, [property])) { newObject[property] = object[property]; } } return newObject; } /* IE10 doesn't support __lookupGetter__ so lets' * simulate it. It also automatically checks * if the prop is function or getter and behaves * accordingly. */ function lookupGetter(object, prop) { while (object !== null) { var desc = getOwnPropertyDescriptor(object, prop); if (desc) { if (desc.get) { return unapply(desc.get); } if (typeof desc.value === 'function') { return unapply(desc.value); } } object = getPrototypeOf(object); } function fallbackValue(element) { console.warn('fallback value for', element); return null; } return fallbackValue; } var html = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG var svg = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']); var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default. // We still need to know them so that we can do namespace // checks properly in case one wants to add them to // allow-list. var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'feimage', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']); var mathMl = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']); // Similarly to SVG, we want to know all MathML elements, // even those that we disallow by default. var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']); var text = freeze(['#text']); var html$1 = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']); var svg$1 = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']); var mathMl$1 = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']); var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']); // eslint-disable-next-line unicorn/better-regex var MUSTACHE_EXPR = seal(/\{\{[\s\S]*|[\s\S]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode var ERB_EXPR = seal(/<%[\s\S]*|[\s\S]*%>/gm); var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape ); var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex ); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; function _toConsumableArray$1(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } var getGlobal = function getGlobal() { return typeof window === 'undefined' ? null : window; }; /** * Creates a no-op policy for internal use only. * Don't export this function outside this module! * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory. * @param {Document} document The document object (to determine policy name suffix) * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types * are not supported). */ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) { if ((typeof trustedTypes === 'undefined' ? 'undefined' : _typeof(trustedTypes)) !== 'object' || typeof trustedTypes.createPolicy !== 'function') { return null; } // Allow the callers to control the unique policy name // by adding a data-tt-policy-suffix to the script element with the DOMPurify. // Policy creation with duplicate names throws in Trusted Types. var suffix = null; var ATTR_NAME = 'data-tt-policy-suffix'; if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) { suffix = document.currentScript.getAttribute(ATTR_NAME); } var policyName = 'dompurify' + (suffix ? '#' + suffix : ''); try { return trustedTypes.createPolicy(policyName, { createHTML: function createHTML(html$$1) { return html$$1; } }); } catch (_) { // Policy creation failed (most likely another DOMPurify script has // already run). Skip creating the policy, as this will only cause errors // if TT are enforced. console.warn('TrustedTypes policy ' + policyName + ' could not be created.'); return null; } }; function createDOMPurify() { var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal(); var DOMPurify = function DOMPurify(root) { return createDOMPurify(root); }; /** * Version label, exposed for easier checks * if DOMPurify is up to date or not */ DOMPurify.version = '2.3.1'; /** * Array of elements that DOMPurify removed during sanitation. * Empty if nothing was removed. */ DOMPurify.removed = []; if (!window || !window.document || window.document.nodeType !== 9) { // Not running in a browser, provide a factory function // so that you can pass your own Window DOMPurify.isSupported = false; return DOMPurify; } var originalDocument = window.document; var document = window.document; var DocumentFragment = window.DocumentFragment, HTMLTemplateElement = window.HTMLTemplateElement, Node = window.Node, Element = window.Element, NodeFilter = window.NodeFilter, _window$NamedNodeMap = window.NamedNodeMap, NamedNodeMap = _window$NamedNodeMap === undefined ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap, Text = window.Text, Comment = window.Comment, DOMParser = window.DOMParser, trustedTypes = window.trustedTypes; var ElementPrototype = Element.prototype; var cloneNode = lookupGetter(ElementPrototype, 'cloneNode'); var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling'); var getChildNodes = lookupGetter(ElementPrototype, 'childNodes'); var getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a // new document created via createHTMLDocument. As per the spec // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries) // a new empty registry is used when creating a template contents owner // document, so we use that as our parent document to ensure nothing // is inherited. if (typeof HTMLTemplateElement === 'function') { var template = document.createElement('template'); if (template.content && template.content.ownerDocument) { document = template.content.ownerDocument; } } var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument); var emptyHTML = trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML('') : ''; var _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName; var importNode = originalDocument.importNode; var documentMode = {}; try { documentMode = clone(document).documentMode ? document.documentMode : {}; } catch (_) {} var hooks = {}; /** * Expose whether this browser supports running the full DOMPurify. */ DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9; var MUSTACHE_EXPR$$1 = MUSTACHE_EXPR, ERB_EXPR$$1 = ERB_EXPR, DATA_ATTR$$1 = DATA_ATTR, ARIA_ATTR$$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$$1 = ATTR_WHITESPACE; var IS_ALLOWED_URI$$1 = IS_ALLOWED_URI; /** * We consider the elements and attributes below to be safe. Ideally * don't add any new ones but feel free to remove unwanted ones. */ /* allowed element names */ var ALLOWED_TAGS = null; var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray$1(html), _toConsumableArray$1(svg), _toConsumableArray$1(svgFilters), _toConsumableArray$1(mathMl), _toConsumableArray$1(text))); /* Allowed attribute names */ var ALLOWED_ATTR = null; var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray$1(html$1), _toConsumableArray$1(svg$1), _toConsumableArray$1(mathMl$1), _toConsumableArray$1(xml))); /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */ var FORBID_TAGS = null; /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */ var FORBID_ATTR = null; /* Decide if ARIA attributes are okay */ var ALLOW_ARIA_ATTR = true; /* Decide if custom data attributes are okay */ var ALLOW_DATA_ATTR = true; /* Decide if unknown protocols are okay */ var ALLOW_UNKNOWN_PROTOCOLS = false; /* Output should be safe for common template engines. * This means, DOMPurify removes data attributes, mustaches and ERB */ var SAFE_FOR_TEMPLATES = false; /* Decide if document with ... should be returned */ var WHOLE_DOCUMENT = false; /* Track whether config is already set on this instance of DOMPurify. */ var SET_CONFIG = false; /* Decide if all elements (e.g. style, script) must be children of * document.body. By default, browsers might move them to document.head */ var FORCE_BODY = false; /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html * string (or a TrustedHTML object if Trusted Types are supported). * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead */ var RETURN_DOM = false; /* Decide if a DOM `DocumentFragment` should be returned, instead of a html * string (or a TrustedHTML object if Trusted Types are supported) */ var RETURN_DOM_FRAGMENT = false; /* If `RETURN_DOM` or `RETURN_DOM_FRAGMENT` is enabled, decide if the returned DOM * `Node` is imported into the current `Document`. If this flag is not enabled the * `Node` will belong (its ownerDocument) to a fresh `HTMLDocument`, created by * DOMPurify. * * This defaults to `true` starting DOMPurify 2.2.0. Note that setting it to `false` * might cause XSS from attacks hidden in closed shadowroots in case the browser * supports Declarative Shadow: DOM https://web.dev/declarative-shadow-dom/ */ var RETURN_DOM_IMPORT = true; /* Try to return a Trusted Type object instead of a string, return a string in * case Trusted Types are not supported */ var RETURN_TRUSTED_TYPE = false; /* Output should be free from DOM clobbering attacks? */ var SANITIZE_DOM = true; /* Keep element content when removing element? */ var KEEP_CONTENT = true; /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead * of importing it into a new Document and returning a sanitized copy */ var IN_PLACE = false; /* Allow usage of profiles like html, svg and mathMl */ var USE_PROFILES = {}; /* Tags to ignore content of when KEEP_CONTENT is true */ var FORBID_CONTENTS = null; var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']); /* Tags that are safe for data: URIs */ var DATA_URI_TAGS = null; var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']); /* Attributes safe for values like "javascript:" */ var URI_SAFE_ATTRIBUTES = null; var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']); var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML'; var SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; /* Document namespace */ var NAMESPACE = HTML_NAMESPACE; var IS_EMPTY_INPUT = false; /* Keep a reference to config to pass to hooks */ var CONFIG = null; /* Ideally, do not touch anything below this line */ /* ______________________________________________ */ var formElement = document.createElement('form'); /** * _parseConfig * * @param {Object} cfg optional config literal */ // eslint-disable-next-line complexity var _parseConfig = function _parseConfig(cfg) { if (CONFIG && CONFIG === cfg) { return; } /* Shield configuration object from tampering */ if (!cfg || (typeof cfg === 'undefined' ? 'undefined' : _typeof(cfg)) !== 'object') { cfg = {}; } /* Shield configuration object from prototype pollution */ cfg = clone(cfg); /* Set configuration parameters */ ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS; ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR; URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR) : DEFAULT_URI_SAFE_ATTRIBUTES; DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS) : DEFAULT_DATA_URI_TAGS; FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS) : DEFAULT_FORBID_CONTENTS; FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS) : {}; FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR) : {}; USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false; ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false RETURN_DOM = cfg.RETURN_DOM || false; // Default false RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false RETURN_DOM_IMPORT = cfg.RETURN_DOM_IMPORT !== false; // Default true RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false FORCE_BODY = cfg.FORCE_BODY || false; // Default false SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true IN_PLACE = cfg.IN_PLACE || false; // Default false IS_ALLOWED_URI$$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$$1; NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; if (SAFE_FOR_TEMPLATES) { ALLOW_DATA_ATTR = false; } if (RETURN_DOM_FRAGMENT) { RETURN_DOM = true; } /* Parse profile info */ if (USE_PROFILES) { ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray$1(text))); ALLOWED_ATTR = []; if (USE_PROFILES.html === true) { addToSet(ALLOWED_TAGS, html); addToSet(ALLOWED_ATTR, html$1); } if (USE_PROFILES.svg === true) { addToSet(ALLOWED_TAGS, svg); addToSet(ALLOWED_ATTR, svg$1); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.svgFilters === true) { addToSet(ALLOWED_TAGS, svgFilters); addToSet(ALLOWED_ATTR, svg$1); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.mathMl === true) { addToSet(ALLOWED_TAGS, mathMl); addToSet(ALLOWED_ATTR, mathMl$1); addToSet(ALLOWED_ATTR, xml); } } /* Merge configuration parameters */ if (cfg.ADD_TAGS) { if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { ALLOWED_TAGS = clone(ALLOWED_TAGS); } addToSet(ALLOWED_TAGS, cfg.ADD_TAGS); } if (cfg.ADD_ATTR) { if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { ALLOWED_ATTR = clone(ALLOWED_ATTR); } addToSet(ALLOWED_ATTR, cfg.ADD_ATTR); } if (cfg.ADD_URI_SAFE_ATTR) { addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR); } if (cfg.FORBID_CONTENTS) { if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { FORBID_CONTENTS = clone(FORBID_CONTENTS); } addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS); } /* Add #text in case KEEP_CONTENT is set to true */ if (KEEP_CONTENT) { ALLOWED_TAGS['#text'] = true; } /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */ if (WHOLE_DOCUMENT) { addToSet(ALLOWED_TAGS, ['html', 'head', 'body']); } /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */ if (ALLOWED_TAGS.table) { addToSet(ALLOWED_TAGS, ['tbody']); delete FORBID_TAGS.tbody; } // Prevent further manipulation of configuration. // Not available in IE8, Safari 5, etc. if (freeze) { freeze(cfg); } CONFIG = cfg; }; var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']); var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); /* Keep track of all possible SVG and MathML tags * so that we can perform the namespace checks * correctly. */ var ALL_SVG_TAGS = addToSet({}, svg); addToSet(ALL_SVG_TAGS, svgFilters); addToSet(ALL_SVG_TAGS, svgDisallowed); var ALL_MATHML_TAGS = addToSet({}, mathMl); addToSet(ALL_MATHML_TAGS, mathMlDisallowed); /** * * * @param {Element} element a DOM element whose namespace is being checked * @returns {boolean} Return false if the element has a * namespace that a spec-compliant parser would never * return. Return true otherwise. */ var _checkValidNamespace = function _checkValidNamespace(element) { var parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode // can be null. We just simulate parent in this case. if (!parent || !parent.tagName) { parent = { namespaceURI: HTML_NAMESPACE, tagName: 'template' }; } var tagName = stringToLowerCase(element.tagName); var parentTagName = stringToLowerCase(parent.tagName); if (element.namespaceURI === SVG_NAMESPACE) { // The only way to switch from HTML namespace to SVG // is via . If it happens via any other tag, then // it should be killed. if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === 'svg'; } // The only way to switch from MathML to SVG is via // svg if parent is either or MathML // text integration points. if (parent.namespaceURI === MATHML_NAMESPACE) { return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); } // We only allow elements that are defined in SVG // spec. All others are disallowed in SVG namespace. return Boolean(ALL_SVG_TAGS[tagName]); } if (element.namespaceURI === MATHML_NAMESPACE) { // The only way to switch from HTML namespace to MathML // is via . If it happens via any other tag, then // it should be killed. if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === 'math'; } // The only way to switch from SVG to MathML is via // and HTML integration points if (parent.namespaceURI === SVG_NAMESPACE) { return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName]; } // We only allow elements that are defined in MathML // spec. All others are disallowed in MathML namespace. return Boolean(ALL_MATHML_TAGS[tagName]); } if (element.namespaceURI === HTML_NAMESPACE) { // The only way to switch from SVG to HTML is via // HTML integration points, and from MathML to HTML // is via MathML text integration points if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { return false; } if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { return false; } // Certain elements are allowed in both SVG and HTML // namespace. We need to specify them explicitly // so that they don't get erronously deleted from // HTML namespace. var commonSvgAndHTMLElements = addToSet({}, ['title', 'style', 'font', 'a', 'script']); // We disallow tags that are specific for MathML // or SVG and should never appear in HTML namespace return !ALL_MATHML_TAGS[tagName] && (commonSvgAndHTMLElements[tagName] || !ALL_SVG_TAGS[tagName]); } // The code should never reach this place (this means // that the element somehow got namespace that is not // HTML, SVG or MathML). Return false just in case. return false; }; /** * _forceRemove * * @param {Node} node a DOM node */ var _forceRemove = function _forceRemove(node) { arrayPush(DOMPurify.removed, { element: node }); try { // eslint-disable-next-line unicorn/prefer-dom-node-remove node.parentNode.removeChild(node); } catch (_) { try { node.outerHTML = emptyHTML; } catch (_) { node.remove(); } } }; /** * _removeAttribute * * @param {String} name an Attribute name * @param {Node} node a DOM node */ var _removeAttribute = function _removeAttribute(name, node) { try { arrayPush(DOMPurify.removed, { attribute: node.getAttributeNode(name), from: node }); } catch (_) { arrayPush(DOMPurify.removed, { attribute: null, from: node }); } node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes if (name === 'is' && !ALLOWED_ATTR[name]) { if (RETURN_DOM || RETURN_DOM_FRAGMENT) { try { _forceRemove(node); } catch (_) {} } else { try { node.setAttribute(name, ''); } catch (_) {} } } }; /** * _initDocument * * @param {String} dirty a string of dirty markup * @return {Document} a DOM, filled with the dirty markup */ var _initDocument = function _initDocument(dirty) { /* Create a HTML document */ var doc = void 0; var leadingWhitespace = void 0; if (FORCE_BODY) { dirty = '' + dirty; } else { /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */ var matches = stringMatch(dirty, /^[\r\n\t ]+/); leadingWhitespace = matches && matches[0]; } var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; /* * Use the DOMParser API by default, fallback later if needs be * DOMParser not work for svg when has multiple root element. */ if (NAMESPACE === HTML_NAMESPACE) { try { doc = new DOMParser().parseFromString(dirtyPayload, 'text/html'); } catch (_) {} } /* Use createHTMLDocument in case DOMParser is not available */ if (!doc || !doc.documentElement) { doc = implementation.createDocument(NAMESPACE, 'template', null); try { doc.documentElement.innerHTML = IS_EMPTY_INPUT ? '' : dirtyPayload; } catch (_) { // Syntax error if dirtyPayload is invalid xml } } var body = doc.body || doc.documentElement; if (dirty && leadingWhitespace) { body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null); } /* Work on whole document or just its body */ if (NAMESPACE === HTML_NAMESPACE) { return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0]; } return WHOLE_DOCUMENT ? doc.documentElement : body; }; /** * _createIterator * * @param {Document} root document/fragment to create iterator for * @return {Iterator} iterator instance */ var _createIterator = function _createIterator(root) { return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false); }; /** * _isClobbered * * @param {Node} elm element to check for clobbering attacks * @return {Boolean} true if clobbered, false if safe */ var _isClobbered = function _isClobbered(elm) { if (elm instanceof Text || elm instanceof Comment) { return false; } if (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function') { return true; } return false; }; /** * _isNode * * @param {Node} obj object to check whether it's a DOM node * @return {Boolean} true is object is a DOM node */ var _isNode = function _isNode(object) { return (typeof Node === 'undefined' ? 'undefined' : _typeof(Node)) === 'object' ? object instanceof Node : object && (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'; }; /** * _executeHook * Execute user configurable hooks * * @param {String} entryPoint Name of the hook's entry point * @param {Node} currentNode node to work on with the hook * @param {Object} data additional hook parameters */ var _executeHook = function _executeHook(entryPoint, currentNode, data) { if (!hooks[entryPoint]) { return; } arrayForEach(hooks[entryPoint], function (hook) { hook.call(DOMPurify, currentNode, data, CONFIG); }); }; /** * _sanitizeElements * * @protect nodeName * @protect textContent * @protect removeChild * * @param {Node} currentNode to check for permission to exist * @return {Boolean} true if node was killed, false if left alive */ var _sanitizeElements = function _sanitizeElements(currentNode) { var content = void 0; /* Execute a hook if present */ _executeHook('beforeSanitizeElements', currentNode, null); /* Check if element is clobbered or can clobber */ if (_isClobbered(currentNode)) { _forceRemove(currentNode); return true; } /* Check if tagname contains Unicode */ if (stringMatch(currentNode.nodeName, /[\u0080-\uFFFF]/)) { _forceRemove(currentNode); return true; } /* Now let's check the element's type and name */ var tagName = stringToLowerCase(currentNode.nodeName); /* Execute a hook if present */ _executeHook('uponSanitizeElement', currentNode, { tagName: tagName, allowedTags: ALLOWED_TAGS }); /* Detect mXSS attempts abusing namespace confusion */ if (!_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) { _forceRemove(currentNode); return true; } /* Mitigate a problem with templates inside select */ if (tagName === 'select' && regExpTest(/ ' + schedule.title + ''; * }, * milestoneTitle: function() { * return 'MILESTONE'; * }, * task: function(schedule) { * return '#' + schedule.title; * }, * taskTitle: function() { * return 'TASK'; * }, * allday: function(schedule) { * return getTimeTemplate(schedule, true); * }, * alldayTitle: function() { * return 'ALL DAY'; * }, * time: function(schedule) { * return '' + moment(schedule.start.getTime()).format('HH:mm') + ' ' + schedule.title; * }, * goingDuration: function(schedule) { * return '' + schedule.goingDuration + 'min.'; * }, * comingDuration: function(schedule) { * return '' + schedule.comingDuration + 'min.'; * }, * monthMoreTitleDate: function(date, dayname) { * var day = date.split('.')[2]; * * return '' + day + ' ' + dayname + ''; * }, * monthMoreClose: function() { * return ''; * }, * monthGridHeader: function(dayModel) { * var date = parseInt(dayModel.date.split('-')[2], 10); * var classNames = ['tui-full-calendar-weekday-grid-date ']; * * if (dayModel.isToday) { * classNames.push('tui-full-calendar-weekday-grid-date-decorator'); * } * * return '' + date + ''; * }, * monthGridHeaderExceed: function(hiddenSchedules) { * return '+' + hiddenSchedules + ''; * }, * monthGridFooter: function() { * return ''; * }, * monthGridFooterExceed: function(hiddenSchedules) { * return ''; * }, * monthDayname: function(model) { * return (model.label).toString().toLocaleUpperCase(); * }, * weekDayname: function(model) { * return '' + model.date + '  ' + model.dayName + ''; * }, * weekGridFooterExceed: function(hiddenSchedules) { * return '+' + hiddenSchedules; * }, * dayGridTitle: function(viewName) { * * // use another functions instead of 'dayGridTitle' * // milestoneTitle: function() {...} * // taskTitle: function() {...} * // alldayTitle: function() {...} * * var title = ''; * switch(viewName) { * case 'milestone': * title = 'MILESTONE'; * break; * case 'task': * title = 'TASK'; * break; * case 'allday': * title = 'ALL DAY'; * break; * } * * return title; * }, * schedule: function(schedule) { * * // use another functions instead of 'schedule' * // milestone: function() {...} * // task: function() {...} * // allday: function() {...} * * var tpl; * * switch(category) { * case 'milestone': * tpl = ' ' + schedule.title + ''; * break; * case 'task': * tpl = '#' + schedule.title; * break; * case 'allday': * tpl = getTimeTemplate(schedule, true); * break; * } * * return tpl; * }, * collapseBtnTitle: function() { * return ''; * }, * timezoneDisplayLabel: function(timezoneOffset, displayLabel) { * var gmt, hour, minutes; * * if (!displayLabel) { * gmt = timezoneOffset < 0 ? '-' : '+'; * hour = Math.abs(parseInt(timezoneOffset / 60, 10)); * minutes = Math.abs(timezoneOffset % 60); * displayLabel = gmt + getPadStart(hour) + ':' + getPadStart(minutes); * } * * return displayLabel; * }, * timegridDisplayPrimayTime: function(time) { * // will be deprecated. use 'timegridDisplayPrimaryTime' * var meridiem = 'am'; * var hour = time.hour; * * if (time.hour > 12) { * meridiem = 'pm'; * hour = time.hour - 12; * } * * return hour + ' ' + meridiem; * }, * timegridDisplayPrimaryTime: function(time) { * var meridiem = 'am'; * var hour = time.hour; * * if (time.hour > 12) { * meridiem = 'pm'; * hour = time.hour - 12; * } * * return hour + ' ' + meridiem; * }, * timegridDisplayTime: function(time) { * return getPadStart(time.hour) + ':' + getPadStart(time.hour); * }, * timegridCurrentTime: function(timezone) { * var templates = []; * * if (timezone.dateDifference) { * templates.push('[' + timezone.dateDifferenceSign + timezone.dateDifference + ']
'); * } * * templates.push(moment(timezone.hourmarker).format('HH:mm a')); * * return templates.join(''); * }, * popupIsAllDay: function() { * return 'All Day'; * }, * popupStateFree: function() { * return 'Free'; * }, * popupStateBusy: function() { * return 'Busy'; * }, * titlePlaceholder: function() { * return 'Subject'; * }, * locationPlaceholder: function() { * return 'Location'; * }, * startDatePlaceholder: function() { * return 'Start date'; * }, * endDatePlaceholder: function() { * return 'End date'; * }, * popupSave: function() { * return 'Save'; * }, * popupUpdate: function() { * return 'Update'; * }, * popupDetailDate: function(isAllDay, start, end) { * var isSameDate = moment(start).isSame(end); * var endFormat = (isSameDate ? '' : 'YYYY.MM.DD ') + 'hh:mm a'; * * if (isAllDay) { * return moment(start).format('YYYY.MM.DD') + (isSameDate ? '' : ' - ' + moment(end).format('YYYY.MM.DD')); * } * * return (moment(start).format('YYYY.MM.DD hh:mm a') + ' - ' + moment(end).format(endFormat)); * }, * popupDetailLocation: function(schedule) { * return 'Location : ' + schedule.location; * }, * popupDetailUser: function(schedule) { * return 'User : ' + (schedule.attendees || []).join(', '); * }, * popupDetailState: function(schedule) { * return 'State : ' + schedule.state || 'Busy'; * }, * popupDetailRepeat: function(schedule) { * return 'Repeat : ' + schedule.recurrenceRule; * }, * popupDetailBody: function(schedule) { * return 'Body : ' + schedule.body; * }, * popupEdit: function() { * return 'Edit'; * }, * popupDelete: function() { * return 'Delete'; * } * } * } */ /** * Options for daily, weekly view. * @typedef {object} WeekOptions * @property {number} [startDayOfWeek=0] - The start day of week, * @property {Array.} [daynames] - The day names in weekly and daily. Default values are ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] * @property {boolean} [narrowWeekend=false] - Make weekend column narrow(1/2 width) * @property {boolean} [workweek=false] - Show only 5 days except for weekend * @property {boolean} [showTimezoneCollapseButton=false] - Show a collapse button to close multiple timezones * @property {boolean} [timezonesCollapsed=false] - An initial multiple timezones collapsed state * @property {number} [hourStart=0] - Can limit of render hour start. * @property {number} [hourEnd=24] - Can limit of render hour end. */ /** * Options for monthly view. * @typedef {object} MonthOptions * @property {Array.} [daynames] - The day names in monthly. Default values are ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] * @property {number} [startDayOfWeek=0] - The start day of week * @property {boolean} [narrowWeekend=false] - Make weekend column narrow(1/2 width) * @property {number} [visibleWeeksCount=6] - The visible week count in monthly(0 or null are same with 6) * @property {boolean} [isAlways6Week=true] - Always show 6 weeks. If false, show 5 weeks or 6 weeks based on the month. * @property {boolean} [workweek=false] - Show only 5 days except for weekend * @property {number} [visibleScheduleCount] - The visible schedule count in monthly grid * @property {object} [moreLayerSize] - The more layer size * @property {object} [moreLayerSize.width=null] - The css width value(px, 'auto'). * The default value 'null' is to fit a grid cell. * @property {object} [moreLayerSize.height=null] - The css height value(px, 'auto'). * The default value 'null' is to fit a grid cell. * @property {object} [grid] - The grid's header and footer information * @property {object} [grid.header] - The grid's header informatioin * @property {number} [grid.header.height=34] - The grid's header height * @property {object} [grid.footer] - The grid's footer informatioin * @property {number} [grid.footer.height=34] - The grid's footer height * @property {function} [scheduleFilter=null] - The filter schedules on month view. A parameter is {Schedule} object. */ /** * @typedef {object} CalendarColor * @property {string} [color] - The calendar color * @property {string} [bgColor] - The calendar background color * @property {string} [borderColor] - The calendar left border color * @property {string} [dragBgColor] - The Background color displayed when you drag a calendar's schedule */ /** * @typedef {object} Timezone * @property {Array.} [zones] - {@link Zone} array. Set the list of time zones. * The first zone element is primary * The rest zone elements are shown in left timegrid of weekly/daily view * @property {function} [offsetCalculator = null] - If you define the 'offsetCalculator' property, the offset calculation is done with this function. * The offsetCalculator option allows you to set up a function that returns the timezone offset for that time using date libraries like ['js-joda'](https://js-joda.github.io/js-joda/) and ['moment-timezone'](https://momentjs.com/timezone/). * The 'offsetCalculator' option is useful when your browser does not support 'Intl.DateTimeFormat' and 'formatToPart', or you want to use the date library you are familiar with. * * @example * var cal = new Calendar('#calendar', { * timezone: { * zones: [ * { * timezoneName: 'Asia/Seoul', * displayLabel: 'GMT+09:00', * tooltip: 'Seoul' * }, * { * timezoneName: 'America/New_York', * displayLabel: 'GMT-05:00', * tooltip: 'New York', * } * ], * offsetCalculator: function(timezoneName, timestamp){ * // matches 'getTimezoneOffset()' of Date API * // e.g. +09:00 => -540, -04:00 => 240 * return moment.tz.zone(timezoneName).utcOffset(timestamp); * }, * } * }); */ /** * @typedef {object} Zone * @property {string} [timezoneName] - timezone name (time zone names of the IANA time zone database, such as 'Asia/Seoul', 'America/New_York'). * Basically, it will calculate the offset using 'Intl.DateTimeFormat' with the value of the this property entered. * This property is required. * @property {string} [displayLabel] - The display label of your timezone at weekly/daily view(e.g. 'GMT+09:00') * @property {string} [tooltip] - The tooltip(e.g. 'Seoul') * @property {number} [timezoneOffset] - The minutes for your timezone offset. If null, use the browser's timezone. Refer to Date.prototype.getTimezoneOffset(). * This property will be deprecated. (since version 1.13) * * @example * var cal = new Calendar('#calendar', { * timezone: { * zones: [ * { * timezoneName: 'Asia/Seoul', * displayLabel: 'GMT+09:00', * tooltip: 'Seoul' * }, * { * timezoneName: 'America/New_York', * displayLabel: 'GMT-05:00', * tooltip: 'New York', * } * ], * } * }); */ /** * @typedef {object} CalendarProps * @property {string|number} id - The calendar id * @property {string} name - The calendar name * @property {string} color - The text color when schedule is displayed * @property {string} bgColor - The background color schedule is displayed * @property {string} borderColor - The color of left border or bullet point when schedule is displayed * @property {string} dragBgColor - The background color when schedule dragging * @example * var cal = new Calendar('#calendar', { * ... * calendars: [ * { * id: '1', * name: 'My Calendar', * color: '#ffffff', * bgColor: '#9e5fff', * dragBgColor: '#9e5fff', * borderColor: '#9e5fff' * }, * { * id: '2', * name: 'Company', * color: '#00a9ff', * bgColor: '#00a9ff', * dragBgColor: '#00a9ff', * borderColor: '#00a9ff' * }, * ] * }); */ /** * @typedef {object} Options - Calendar option object * @property {string} [defaultView='week'] - Default view of calendar. The default value is 'week'. * @property {boolean|Array.} [taskView=true] - Show the milestone and task in weekly, daily view. The default value is true. If the value is array, it can be ['milestone', 'task']. * @property {boolean|Array.} [scheduleView=true] - Show the all day and time grid in weekly, daily view. The default value is false. If the value is array, it can be ['allday', 'time']. * @property {themeConfig} [theme=themeConfig] - {@link themeConfig} for custom style. * @property {Template} [template={}] - {@link Template} for further information * @property {WeekOptions} [week={}] - {@link WeekOptions} for week view * @property {MonthOptions} [month={}] - {@link MonthOptions} for month view * @property {Array.} [calendars=[]] - {@link CalendarProps} List that can be used to add new schedule. The default value is []. * @property {boolean} [useCreationPopup=false] - Whether use default creation popup or not. The default value is false. * @property {boolean} [useDetailPopup=false] - Whether use default detail popup or not. The default value is false. * @property {Timezone} [timezone] - {@link Timezone} - Set a custom time zone. You can add secondary timezone in the weekly/daily view. * @property {boolean} [disableDblClick=false] - Disable double click to create a schedule. The default value is false. * @property {boolean} [disableClick=false] - Disable click to create a schedule. The default value is false. * @property {boolean} [isReadOnly=false] - {@link Calendar} is read-only mode and a user can't create and modify any schedule. The default value is false. * @property {boolean} [usageStatistics=true] - Let us know the hostname. If you don't want to send the hostname, please set to false. * @property {Array.} [timezones] - This property will be deprecated. (since version 1.13) Please use timezone property. */ /** * {@link https://nhn.github.io/tui.code-snippet/latest/CustomEvents CustomEvents} document at {@link https://github.com/nhn/tui.code-snippet tui-code-snippet} * @typedef {class} CustomEvents */ /** * @typedef {object} TimeCreationGuide - Time creation guide instance to present selected time period * @property {HTMLElement} guideElement - Guide element * @property {Object.} guideElements - Map by key. It can be used in monthly view * @property {function} clearGuideElement - Hide the creation guide * @example * calendar.on('beforeCreateSchedule', function(event) { * var guide = event.guide; * // Use guideEl$'s left, top to locate your schedule creation popup * var guideEl$ = guide.guideElement ? * guide.guideElement : guide.guideElements[Object.keys(guide.guideElements)[0]]; * * // After that call this to hide the creation guide * guide.clearGuideElement(); * }); */ /** * Calendar class * @constructor * @mixes CustomEvents * @param {HTMLElement|string} container - The container element or selector id * @param {Options} options - The calendar {@link Options} object * @example * var calendar = new tui.Calendar(document.getElementById('calendar'), { * defaultView: 'week', * taskView: true, // Can be also ['milestone', 'task'] * scheduleView: true, // Can be also ['allday', 'time'] * template: { * milestone: function(schedule) { * return ' ' + schedule.title + ''; * }, * milestoneTitle: function() { * return 'Milestone'; * }, * task: function(schedule) { * return '  #' + schedule.title; * }, * taskTitle: function() { * return ''; * }, * allday: function(schedule) { * return schedule.title + ' '; * }, * alldayTitle: function() { * return 'All Day'; * }, * time: function(schedule) { * return schedule.title + ' ' + schedule.start; * } * }, * month: { * daynames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], * startDayOfWeek: 0, * narrowWeekend: true * }, * week: { * daynames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], * startDayOfWeek: 0, * narrowWeekend: true * } * }); */ function Calendar(container, options) { options = util.extend( { usageStatistics: true }, options ); if (options.usageStatistics === true && util.sendHostname) { util.sendHostname('calendar', GA_TRACKING_ID); } if (util.isString(container)) { container = document.querySelector(container); } /** * Calendar color map * @type {object} * @private */ this._calendarColor = {}; /** * Current rendered date * @type {TZDate} * @private */ this._renderDate = datetime.start(); /** * start and end date of weekly, monthly * @type {object} * @private */ this._renderRange = { start: null, end: null }; /** * base controller * @type {Base} * @private */ this._controller = _createController(options); this._controller.setCalendars(options.calendars); /** * layout view (layout manager) * @type {Layout} * @private */ this._layout = new Layout(container, this._controller.theme); /** * global drag handler * @type {Drag} * @private */ this._dragHandler = new Drag({distance: 10}, this._layout.container); /** * current rendered view name. ('day', 'week', 'month') * @type {string} * @default 'week' * @private */ this._viewName = options.defaultView || 'week'; /** * Refresh method. it can be ref different functions for each view modes. * @type {function} * @private */ this._refreshMethod = null; /** * Scroll to now. It can be called for 'week', 'day' view modes. * @type {function} * @private */ this._scrollToNowMethod = null; /** * It's true if Calendar.prototype.scrollToNow() is called. * @type {boolean} * @private */ this._requestScrollToNow = false; /** * Open schedule creation popup * @type {function} * @private */ this._openCreationPopup = null; /** * Hide the more view * @type {function} * @private */ this._hideMoreView = null; /** * Unique id for requestAnimFrame() * @type {number} * @private */ this._requestRender = 0; /** * calendar options * @type {Options} * @private */ this._options = {}; this._initialize(options); } /** * destroy calendar instance. */ Calendar.prototype.destroy = function() { this._dragHandler.destroy(); this._controller.off(); this._layout.clear(); this._layout.destroy(); util.forEach(this._options.template, function(func, name) { if (func) { Handlebars.unregisterHelper(name + '-tmpl'); } }); this._options = this._renderDate = this._controller = this._layout = this._dragHandler = this._viewName = this._refreshMethod = this._scrollToNowMethod = null; }; /** * Initialize calendar * @param {Options} options - calendar options * @private */ // eslint-disable-next-line complexity Calendar.prototype._initialize = function(options) { var controller = this._controller, viewName = this._viewName; this._options = util.extend( { defaultView: viewName, taskView: true, scheduleView: true, template: util.extend( { allday: null, time: null }, util.pick(options, 'template') || {} ), week: util.extend({}, util.pick(options, 'week') || {}), month: util.extend({}, util.pick(options, 'month') || {}), calendars: [], useCreationPopup: false, useDetailPopup: false, timezones: options.timezone && options.timezone.zones ? options.timezone.zones : [], disableDblClick: false, disableClick: false, isReadOnly: false }, options ); this._options.week = util.extend( { startDayOfWeek: 0, workweek: false }, util.pick(this._options, 'week') || {} ); this._options.timezone = util.extend({zones: []}, util.pick(options, 'timezone') || {}); this._options.month = util.extend( { startDayOfWeek: 0, workweek: false, scheduleFilter: function(schedule) { return ( Boolean(schedule.isVisible) && (schedule.category === 'allday' || schedule.category === 'time') ); } }, util.pick(options, 'month') || {} ); if (this._options.isReadOnly) { this._options.useCreationPopup = false; } this._layout.controller = controller; this._setAdditionalInternalOptions(this._options); this.changeView(viewName, true); }; /** * Set additional internal options * 1. Register to the template handlebar * 2. Update the calendar list and set the color of the calendar. * 3. Change the primary timezone offset of the timezones. * @param {Options} options - calendar options * @private */ Calendar.prototype._setAdditionalInternalOptions = function(options) { var timezone = options.timezone; var templateWithSanitizer = function(templateFn) { return function() { var template = templateFn.apply(null, arguments); return DOMPurify.sanitize(template); }; }; var zones, offsetCalculator; util.forEach(options.template, function(func, name) { if (func) { Handlebars.registerHelper(name + '-tmpl', templateWithSanitizer(func)); } }); util.forEach( options.calendars || [], function(calendar) { this.setCalendarColor(calendar.id, calendar, true); }, this ); if (timezone) { offsetCalculator = timezone.offsetCalculator; if (util.isFunction(offsetCalculator)) { tz.setOffsetCalculator(offsetCalculator); } zones = timezone.zones; if (zones.length) { tz.setPrimaryTimezoneByOption(zones[0]); if (util.isNumber(zones[0].timezoneOffset)) { // @deprecated timezoneOffset property will be deprecated. use timezone property tz.setOffsetByTimezoneOption(zones[0].timezoneOffset); } } } }; /********** * CRUD Methods **********/ /** * Create schedules and render calendar. * @param {Array.} schedules - {@link Schedule} data list * @param {boolean} [silent=false] - no auto render after creation when set true * @example * calendar.createSchedules([ * { * id: '1', * calendarId: '1', * title: 'my schedule', * category: 'time', * dueDateClass: '', * start: '2018-01-18T22:30:00+09:00', * end: '2018-01-19T02:30:00+09:00' * }, * { * id: '2', * calendarId: '1', * title: 'second schedule', * category: 'time', * dueDateClass: '', * start: '2018-01-18T17:30:00+09:00', * end: '2018-01-19T17:31:00+09:00' * } * ]); */ Calendar.prototype.createSchedules = function(schedules, silent) { util.forEach( schedules, function(obj) { this._setScheduleColor(obj.calendarId, obj); }, this ); this._controller.createSchedules(schedules, silent); if (!silent) { this.render(); } }; /** * Get a {@link Schedule} object by schedule id and calendar id. * @param {string} scheduleId - ID of schedule * @param {string} calendarId - calendarId of the schedule * @returns {Schedule} schedule object * @example * var schedule = calendar.getSchedule(scheduleId, calendarId); * console.log(schedule.title); */ Calendar.prototype.getSchedule = function(scheduleId, calendarId) { return this._controller.schedules.single(function(model) { return model.id === scheduleId && model.calendarId === calendarId; }); }; /** * Update the schedule * @param {string} scheduleId - ID of the original schedule to update * @param {string} calendarId - The calendarId of the original schedule to update * @param {object} changes - The {@link Schedule} properties and values with changes to update * @param {boolean} [silent=false] - No auto render after creation when set true * @example * calendar.updateSchedule(schedule.id, schedule.calendarId, { * title: 'Changed schedule', * start: new Date('2019-11-05T09:00:00'), * end: new Date('2019-11-05T10:00:00'), * category: 'time' * }); */ Calendar.prototype.updateSchedule = function(scheduleId, calendarId, changes, silent) { var ctrl = this._controller, ownSchedules = ctrl.schedules, schedule = ownSchedules.single(function(model) { return model.id === scheduleId && model.calendarId === calendarId; }); var hasChangedCalendar = false; if (!changes || !schedule) { return; } hasChangedCalendar = this._hasChangedCalendar(schedule, changes); changes = hasChangedCalendar ? this._setScheduleColor(changes.calendarId, changes) : changes; ctrl.updateSchedule(schedule, changes); if (!silent) { this.render(); } }; Calendar.prototype._hasChangedCalendar = function(schedule, changes) { return schedule && changes.calendarId && schedule.calendarId !== changes.calendarId; }; Calendar.prototype._setScheduleColor = function(calendarId, schedule) { var calColor = this._calendarColor; var color = calColor[calendarId]; if (color) { schedule.color = schedule.color || color.color; schedule.bgColor = schedule.bgColor || color.bgColor; schedule.borderColor = schedule.borderColor || color.borderColor; schedule.dragBgColor = schedule.dragBgColor || color.dragBgColor; } return schedule; }; /** * Delete a schedule. * @param {string} scheduleId - ID of schedule to delete * @param {string} calendarId - The CalendarId of the schedule to delete * @param {boolean} [silent=false] - No auto render after creation when set true */ Calendar.prototype.deleteSchedule = function(scheduleId, calendarId, silent) { var ctrl = this._controller, ownSchedules = ctrl.schedules, schedule = ownSchedules.single(function(model) { return model.id === scheduleId && model.calendarId === calendarId; }); if (!schedule) { return; } ctrl.deleteSchedule(schedule); if (!silent) { this.render(); } }; /********** * Private Methods **********/ /** * @param {string|Date} date - The Date to show in calendar * @param {number} [startDayOfWeek=0] - The Start day of week * @param {boolean} [workweek=false] - The only show work week * @returns {array} render range * @private */ Calendar.prototype._getWeekDayRange = function(date, startDayOfWeek, workweek) { var day; var start; var end; var range; startDayOfWeek = (startDayOfWeek || 0); // eslint-disable-line date = util.isDate(date) ? date : new TZDate(date); day = date.getDay(); // calculate default render range first. start = new TZDate(date).addDate(-day + startDayOfWeek); end = new TZDate(start).addDate(6); if (day < startDayOfWeek) { start = new TZDate(start).addDate(-7); end = new TZDate(end).addDate(-7); } if (workweek) { range = datetime.range( datetime.start(start), datetime.end(end), datetime.MILLISECONDS_PER_DAY ); range = util.filter(range, function(weekday) { return !datetime.isWeekend(weekday.getDay()); }); start = range[0]; end = range[range.length - 1]; } start = datetime.start(start); end = datetime.start(end); return [start, end]; }; /** * Toggle schedules' visibility by calendar ID * @param {string} calendarId - The calendar id value * @param {boolean} toHide - Set true to hide schedules * @param {boolean} [render=true] - set true then render after change visible property each models */ Calendar.prototype.toggleSchedules = function(calendarId, toHide, render) { var ownSchedules = this._controller.schedules; render = util.isExisty(render) ? render : true; calendarId = util.isArray(calendarId) ? calendarId : [calendarId]; ownSchedules.each(function(schedule) { if (~util.inArray(schedule.calendarId, calendarId)) { schedule.set('isVisible', !toHide); } }); if (render) { this.render(); } }; /********** * General Methods **********/ /** * Render the calendar. The real rendering occurs after requestAnimationFrame. * If you have to render immediately, use the 'immediately' parameter as true. * @param {boolean} [immediately=false] - Render it immediately * @example * var silent = true; * calendar.clear(); * calendar.createSchedules(schedules, silent); * calendar.render(); * @example * // Render a calendar when resizing a window. * window.addEventListener('resize', function() { * calendar.render(); * }); */ Calendar.prototype.render = function(immediately) { if (this._requestRender) { reqAnimFrame.cancelAnimFrame(this._requestRender); } if (immediately) { this._renderFunc(); } else { this._requestRender = reqAnimFrame.requestAnimFrame(this._renderFunc, this); } }; /** * Render and refresh all layout and process requests. * @private */ Calendar.prototype._renderFunc = function() { if (this._refreshMethod) { this._refreshMethod(); } if (this._layout) { this._layout.render(); } if (this._scrollToNowMethod && this._requestScrollToNow) { this._scrollToNowMethod(); } this._requestScrollToNow = false; this._requestRender = null; }; /** * Delete all schedules and clear view. The real rendering occurs after requestAnimationFrame. * If you have to render immediately, use the 'immediately' parameter as true. * @param {boolean} [immediately=false] - Render it immediately * @example * calendar.clear(); * calendar.createSchedules(schedules, true); * calendar.render(); */ Calendar.prototype.clear = function(immediately) { this._controller.clearSchedules(); this.render(immediately); }; /** * Scroll to current time on today in case of daily, weekly view * @example * function onNewSchedules(schedules) { * calendar.createSchedules(schedules); * if (calendar.getViewName() !== 'month') { * calendar.scrollToNow(); * } * } */ Calendar.prototype.scrollToNow = function() { if (this._scrollToNowMethod) { this._requestScrollToNow = true; // this._scrollToNowMethod() will be called at next frame rendering. } }; /** * Move to today. * @example * function onClickTodayBtn() { * calendar.today(); * } */ Calendar.prototype.today = function() { this._renderDate = datetime.start(); this._setViewName(this._viewName); this.move(); this.render(); }; /** * Move the calendar amount of offset value * @param {number} offset - The offset value. * @private * @example * // move previous week when "week" view. * // move previous month when "month" view. * calendar.move(-1); */ // eslint-disable-next-line complexity Calendar.prototype.move = function(offset) { var renderDate = dw(datetime.start(this._renderDate)), viewName = this._viewName, view = this._getCurrentView(), recursiveSet = _setOptionRecurseively, startDate, endDate, tempDate, startDayOfWeek, visibleWeeksCount, workweek, isAlways6Week, datetimeOptions; offset = util.isExisty(offset) ? offset : 0; if (viewName === 'month') { startDayOfWeek = util.pick(this._options, 'month', 'startDayOfWeek') || 0; visibleWeeksCount = mmin(util.pick(this._options, 'month', 'visibleWeeksCount') || 0, 6); workweek = util.pick(this._options, 'month', 'workweek') || false; isAlways6Week = util.pick(this._options, 'month', 'isAlways6Week'); if (visibleWeeksCount) { datetimeOptions = { startDayOfWeek: startDayOfWeek, isAlways6Week: false, visibleWeeksCount: visibleWeeksCount, workweek: workweek }; renderDate.addDate(offset * 7 * datetimeOptions.visibleWeeksCount); tempDate = datetime.arr2dCalendar(renderDate.d, datetimeOptions); recursiveSet(view, function(childView, opt) { opt.renderMonth = new TZDate(renderDate.d); }); } else { datetimeOptions = { startDayOfWeek: startDayOfWeek, isAlways6Week: isAlways6Week, workweek: workweek }; renderDate.addMonth(offset); tempDate = datetime.arr2dCalendar(renderDate.d, datetimeOptions); recursiveSet(view, function(childView, opt) { opt.renderMonth = new TZDate(renderDate.d); }); } startDate = tempDate[0][0]; endDate = tempDate[tempDate.length - 1][tempDate[tempDate.length - 1].length - 1]; } else if (viewName === 'week') { renderDate.addDate(offset * 7); startDayOfWeek = util.pick(this._options, 'week', 'startDayOfWeek') || 0; workweek = util.pick(this._options, 'week', 'workweek') || false; tempDate = this._getWeekDayRange(renderDate.d, startDayOfWeek, workweek); startDate = tempDate[0]; endDate = tempDate[1]; recursiveSet(view, function(childView, opt) { opt.renderStartDate = new TZDate(startDate); opt.renderEndDate = new TZDate(endDate); childView.setState({ collapsed: true }); }); } else if (viewName === 'day') { renderDate.addDate(offset); startDate = datetime.start(renderDate.d); endDate = datetime.end(renderDate.d); recursiveSet(view, function(childView, opt) { opt.renderStartDate = new TZDate(startDate); opt.renderEndDate = new TZDate(endDate); childView.setState({ collapsed: true }); }); } this._renderDate = renderDate.d; this._renderRange = { start: startDate, end: endDate }; }; /** * Move to specific date * @param {(Date|string)} date - The date to move * @example * calendar.on('clickDayname', function(event) { * if (calendar.getViewName() === 'week') { * calendar.setDate(new Date(event.date)); * calendar.changeView('day', true); * } * }); */ Calendar.prototype.setDate = function(date) { if (util.isString(date)) { date = datetime.parse(date); } this._renderDate = new TZDate(date); this._setViewName(this._viewName); this.move(0); this.render(); }; /** * Move the calendar forward a day, a week, a month, 2 weeks, 3 weeks. * @example * function moveToNextOrPrevRange(val) { if (val === -1) { calendar.prev(); } else if (val === 1) { calendar.next(); } } */ Calendar.prototype.next = function() { this.move(1); this.render(); }; /** * Move the calendar backward a day, a week, a month, 2 weeks, 3 weeks. * @example * function moveToNextOrPrevRange(val) { if (val === -1) { calendar.prev(); } else if (val === 1) { calendar.next(); } } */ Calendar.prototype.prev = function() { this.move(-1); this.render(); }; /** * Return current rendered view. * @returns {View} current view instance * @private */ Calendar.prototype._getCurrentView = function() { var viewName = this._viewName; if (viewName === 'day') { viewName = 'week'; } return util.pick(this._layout.children.items, viewName); }; /** * Change calendar's schedule color with option * @param {string} calendarId - The calendar ID * @param {CalendarColor} option - The {@link CalendarColor} object * @param {boolean} [silent=false] - No auto render after creation when set true * @example * calendar.setCalendarColor('1', { * color: '#e8e8e8', * bgColor: '#585858', * borderColor: '#a1b56c' * dragBgColor: '#585858', * }); * calendar.setCalendarColor('2', { * color: '#282828', * bgColor: '#dc9656', * borderColor: '#a1b56c', * dragBgColor: '#dc9656', * }); * calendar.setCalendarColor('3', { * color: '#a16946', * bgColor: '#ab4642', * borderColor: '#a1b56c', * dragBgColor: '#ab4642', * }); */ Calendar.prototype.setCalendarColor = function(calendarId, option, silent) { var calColor = this._calendarColor, ownSchedules = this._controller.schedules, ownColor = calColor[calendarId]; if (!util.isObject(option)) { config.throwError( "Calendar#changeCalendarColor(): color 는 {color: '', bgColor: ''} 형태여야 합니다." ); } ownColor = calColor[calendarId] = util.extend( { color: '#000', bgColor: '#a1b56c', borderColor: '#a1b56c', dragBgColor: '#a1b56c' }, option ); ownSchedules.each(function(model) { if (model.calendarId !== calendarId) { return; } model.color = ownColor.color; model.bgColor = ownColor.bgColor; model.borderColor = ownColor.borderColor; model.dragBgColor = ownColor.dragBgColor; }); if (!silent) { this.render(); } }; /********** * Custom Events **********/ /** * A bridge-based event handler for connecting a click handler to a user click event handler for each view * @fires Calendar#clickSchedule * @param {object} clickScheduleData - The event data of 'clickSchedule' handler * @private */ Calendar.prototype._onClick = function(clickScheduleData) { /** * Fire this event when click a schedule. * @event Calendar#clickSchedule * @type {object} * @property {Schedule} schedule - The {@link Schedule} instance * @property {MouseEvent} event - MouseEvent * @example * calendar.on('clickSchedule', function(event) { * var schedule = event.schedule; * * if (lastClickSchedule) { * calendar.updateSchedule(lastClickSchedule.id, lastClickSchedule.calendarId, { * isFocused: false * }); * } * calendar.updateSchedule(schedule.id, schedule.calendarId, { * isFocused: true * }); * * lastClickSchedule = schedule; * // open detail view * }); */ this.fire('clickSchedule', clickScheduleData); }; /** * A bridge-based event handler for connecting a click handler to a user click event handler for each view * @fires Calendar#clickMore * @param {object} clickMoreSchedule - The event data of 'clickMore' handler * @private */ Calendar.prototype._onClickMore = function(clickMoreSchedule) { /** * Fire this event when click a schedule. * @event Calendar#clickMore * @type {object} * @property {Date} date - The Clicked date * @property {HTMLElement} target - The more element * @example * calendar.on('clickMore', function(event) { * console.log('clickMore', event.date, event.target); * }); */ this.fire('clickMore', clickMoreSchedule); }; /** * dayname click event handler * @fires Calendar#clickDayname * @param {object} clickScheduleData - The event data of 'clickDayname' handler * @private */ Calendar.prototype._onClickDayname = function(clickScheduleData) { /** * Fire this event when click a day name in weekly. * @event Calendar#clickDayname * @type {object} * @property {string} date - The date string by format 'YYYY-MM-DD' * @example * calendar.on('clickDayname', function(event) { * if (calendar.getViewName() === 'week') { * calendar.setDate(new Date(event.date)); * calendar.changeView('day', true); * } * }); */ this.fire('clickDayname', clickScheduleData); }; /** * @fires {Calendar#n('beforeCreateSchedule', function} * @param {object} createScheduleData - select schedule data from allday, time * @private */ Calendar.prototype._onBeforeCreate = function(createScheduleData) { if (this._options.useCreationPopup && !createScheduleData.useCreationPopup) { if (this._showCreationPopup) { this._showCreationPopup(createScheduleData); return; } } /** * Fire this event when select time period in daily, weekly, monthly. * @event Calendar#beforeCreateSchedule * @type {object} * @property {boolean} isAllDay - The allday schedule * @property {Date} start - The selected start time * @property {Date} end - The selected end time * @property {TimeCreationGuide} guide - {@link TimeCreationGuide} instance * @property {string} triggerEventName - The event name like 'click', 'dblclick' * @example * calendar.on('beforeCreateSchedule', function(event) { * var startTime = event.start; * var endTime = event.end; * var isAllDay = event.isAllDay; * var guide = event.guide; * var triggerEventName = event.triggerEventName; * var schedule; * * if (triggerEventName === 'click') { * // open writing simple schedule popup * schedule = {...}; * } else if (triggerEventName === 'dblclick') { * // open writing detail schedule popup * schedule = {...}; * } * * calendar.createSchedules([schedule]); * }); */ this.fire('beforeCreateSchedule', createScheduleData); }; /** * @fires Calendar#beforeUpdateSchedule * @param {object} updateScheduleData - update {@link Schedule} data * @private */ Calendar.prototype._onBeforeUpdate = function(updateScheduleData) { /** * Fire this event when drag a schedule to change time in daily, weekly, monthly. * @event Calendar#beforeUpdateSchedule * @type {object} * @property {Schedule} schedule - The original {@link Schedule} instance * @property {object} changes - The {@link Schedule} properties and values with changes to update * @property {Date} start - Deprecated: start time to update * @property {Date} end - Deprecated: end time to update * @example * calendar.on('beforeUpdateSchedule', function(event) { * var schedule = event.schedule; * var changes = event.changes; * * calendar.updateSchedule(schedule.id, schedule.calendarId, changes); * }); */ this.fire('beforeUpdateSchedule', updateScheduleData); }; /** * @fires Calendar#beforeDeleteSchedule * @param {object} deleteScheduleData - delete schedule data * @private */ Calendar.prototype._onBeforeDelete = function(deleteScheduleData) { /** * Fire this event when delete a schedule. * @event Calendar#beforeDeleteSchedule * @type {object} * @property {Schedule} schedule - The {@link Schedule} instance to delete * @example * calendar.on('beforeDeleteSchedule', function(event) { * var schedule = event.schedule; * alert('The schedule is removed.', schedule); * }); */ this.fire('beforeDeleteSchedule', deleteScheduleData); }; /** * @fires Calendar#afterRenderSchedule * @param {Schedule} scheduleData - The schedule data * @private */ Calendar.prototype._onAfterRenderSchedule = function(scheduleData) { /** * Fire this event by every single schedule after rendering whole calendar. * @event Calendar#afterRenderSchedule * @type {object} * @property {Schedule} schedule - A rendered {@link Schedule} instance * @example * calendar.on('afterRenderSchedule', function(event) { * var schedule = event.schedule; * var element = calendar.getElement(schedule.id, schedule.calendarId); * // use the element * console.log(element); * }); */ this.fire('afterRenderSchedule', scheduleData); }; /** * @fires Calendar#clickTimezonesCollapseBtn * @param {boolean} timezonesCollapsed - timezones collapsed flag * @private */ Calendar.prototype._onClickTimezonesCollapseBtn = function(timezonesCollapsed) { /** * Fire this event by clicking timezones collapse button * @event Calendar#clickTimezonesCollapseBtn * @type {object} * @property {boolean} timezonesCollapsed - The timezones collapes flag * @example * calendar.on('clickTimezonesCollapseBtn', function(timezonesCollapsed) { * console.log(timezonesCollapsed); * }); */ this.fire('clickTimezonesCollapseBtn', timezonesCollapsed); }; /** * Toggle calendar factory class, main view, wallview event connection * @param {boolean} isAttach - attach events if true. * @param {Week|Month} view - Weekly view or Monthly view * @private */ Calendar.prototype._toggleViewSchedule = function(isAttach, view) { var self = this, handler = view.handler, method = isAttach ? 'on' : 'off'; util.forEach(handler.click, function(clickHandler) { clickHandler[method]('clickSchedule', self._onClick, self); }); util.forEach(handler.dayname, function(clickHandler) { clickHandler[method]('clickDayname', self._onClickDayname, self); }); util.forEach(handler.creation, function(creationHandler) { creationHandler[method]('beforeCreateSchedule', self._onBeforeCreate, self); creationHandler[method]('beforeDeleteSchedule', self._onBeforeDelete, self); }); util.forEach(handler.move, function(moveHandler) { moveHandler[method]('beforeUpdateSchedule', self._onBeforeUpdate, self); }); util.forEach(handler.resize, function(resizeHandler) { resizeHandler[method]('beforeUpdateSchedule', self._onBeforeUpdate, self); }); // bypass events from view view[method]('afterRenderSchedule', self._onAfterRenderSchedule, self); view[method]('clickTimezonesCollapseBtn', self._onClickTimezonesCollapseBtn, self); view[method]('clickMore', self._onClickMore, self); }; /** * Change current view with view name('day', 'week', 'month') * @param {string} newViewName - The New view name to render * @param {boolean} force - Force render despite of current view and new view are equal * @example * // daily view * calendar.changeView('day', true); * * // weekly view * calendar.changeView('week', true); * * // monthly view(default 6 weeks view) * calendar.setOptions({month: {visibleWeeksCount: 6}}, true); // or null * calendar.changeView('month', true); * * // 2 weeks monthly view * calendar.setOptions({month: {visibleWeeksCount: 2}}, true); * calendar.changeView('month', true); * * // 3 weeks monthly view * calendar.setOptions({month: {visibleWeeksCount: 3}}, true); * calendar.changeView('month', true); * * // narrow weekend * calendar.setOptions({month: {narrowWeekend: true}}, true); * calendar.setOptions({week: {narrowWeekend: true}}, true); * calendar.changeView(calendar.getViewName(), true); * * // change start day of week(from monday) * calendar.setOptions({week: {startDayOfWeek: 1}}, true); * calendar.setOptions({month: {startDayOfWeek: 1}}, true); * calendar.changeView(calendar.getViewName(), true); * * // work week * calendar.setOptions({week: {workweek: true}}, true); * calendar.setOptions({month: {workweek: true}}, true); * calendar.changeView(calendar.getViewName(), true); */ // eslint-disable-next-line complexity Calendar.prototype.changeView = function(newViewName, force) { var self = this, layout = this._layout, controller = this._controller, dragHandler = this._dragHandler, options = this._options, viewName = this._viewName, created; if (!force && viewName === newViewName) { return; } this._setViewName(newViewName); // convert day to week if (viewName === 'day') { viewName = 'week'; } if (newViewName === 'day') { newViewName = 'week'; } layout.children.doWhenHas(viewName, function(view) { self._toggleViewSchedule(false, view); }); layout.clear(); if (newViewName === 'month') { created = _createMonthView(controller, layout.container, dragHandler, options); } else if (newViewName === 'week') { created = _createWeekView( controller, layout.container, dragHandler, options, this.getViewName() ); } layout.addChild(created.view); layout.children.doWhenHas(newViewName, function(view) { self._toggleViewSchedule(true, view); }); this._refreshMethod = created.refresh; this._scrollToNowMethod = created.scrollToNow; this._openCreationPopup = created.openCreationPopup; this._showCreationPopup = created.showCreationPopup; this._hideMoreView = created.hideMoreView; this.move(); this.render(); }; /** * @deprecated * Toggle task view('Milestone', 'Task') panel * @param {boolean} enabled - use task view * @example * // There is no milestone, task, so hide those view panel * calendar.toggleTaskView(false); * * // There are some milestone, task, so show those view panel. * calendar.toggleTaskView(true); */ Calendar.prototype.toggleTaskView = function(enabled) { var viewName = this._viewName, options = this._options; options.taskView = enabled; this.changeView(viewName, true); }; /** * @deprecated * Toggle schedule view('AllDay', TimeGrid') panel * @param {boolean} enabled - use task view * @example * // hide those view panel to show only 'Milestone', 'Task' * calendar.toggleScheduleView(false); * * // show those view panel. * calendar.toggleScheduleView(true); */ Calendar.prototype.toggleScheduleView = function(enabled) { var viewName = this._viewName, options = this._options; options.scheduleView = enabled; this.changeView(viewName, true); }; /** * Set current view name * @param {string} viewName - new view name to render * @private */ Calendar.prototype._setViewName = function(viewName) { this._viewName = viewName; }; /** * Get a schedule element by schedule id and calendar id. * @param {string} scheduleId - ID of schedule * @param {string} calendarId - calendarId of schedule * @returns {HTMLElement} schedule element if found or null * @example * var element = calendar.getElement(scheduleId, calendarId); * console.log(element); */ Calendar.prototype.getElement = function(scheduleId, calendarId) { var schedule = this.getSchedule(scheduleId, calendarId); if (schedule) { return document.querySelector( '[data-schedule-id="' + scheduleId + '"][data-calendar-id="' + calendarId + '"]' ); } return null; }; /** * Set a theme. If some keys are not defined in the preset, will be return. * @param {object} theme - multiple styles map * @returns {Array.} keys - error keys not predefined. * @example * cal.setTheme({ 'month.dayname.height': '31px', 'common.dayname.color': '#333', 'month.dayname.borderBottom': '1px solid #e5e5e5' // Not valid key will be return. * }); */ Calendar.prototype.setTheme = function(theme) { var result = this._controller.setTheme(theme); this.render(true); return result; }; /** * Set options of calendar * @param {Options} options - set {@link Options} * @param {boolean} [silent=false] - no auto render after creation when set true */ Calendar.prototype.setOptions = function(options, silent) { util.forEach( options, function(value, name) { if (util.isObject(value) && !util.isArray(value)) { util.forEach( value, function(innerValue, innerName) { this._options[name][innerName] = innerValue; }, this ); } else { this._options[name] = value; } }, this ); this._setAdditionalInternalOptions(options); if (!silent) { this.changeView(this._viewName, true); } }; /** * Get current {@link Options}. * @returns {Options} options */ Calendar.prototype.getOptions = function() { return this._options; }; /** * Current rendered date ({@link TZDate} for further information) * @returns {TZDate} */ Calendar.prototype.getDate = function() { return this._renderDate; }; /** * Start time of rendered date range ({@link TZDate} for further information) * @returns {TZDate} */ Calendar.prototype.getDateRangeStart = function() { return this._renderRange.start; }; /** * End time of rendered date range ({@link TZDate} for further information) * @returns {TZDate} */ Calendar.prototype.getDateRangeEnd = function() { return this._renderRange.end; }; /** * Get current view name('day', 'week', 'month') * @returns {string} view name */ Calendar.prototype.getViewName = function() { return this._viewName; }; /** * Set calendar list * @param {Array.} calendars - {@link CalendarProps} List */ Calendar.prototype.setCalendars = function(calendars) { util.forEach( calendars || [], function(calendar) { this.setCalendarColor(calendar.id, calendar, true); }, this ); this._controller.setCalendars(calendars); this.render(); }; /** * Open schedule creation popup * @param {Schedule} schedule - The preset {@link Schedule} data */ Calendar.prototype.openCreationPopup = function(schedule) { if (this._openCreationPopup) { this._openCreationPopup(schedule); } }; /** * Hide the more view */ Calendar.prototype.hideMoreView = function() { if (this._hideMoreView) { this._hideMoreView(); } }; /** * Set timezone offset * @param {number} offset - The offset (min) * @static * @deprecated * @example * var timezoneName = moment.tz.guess(); * tui.Calendar.setTimezoneOffset(moment.tz.zone(timezoneName).utcOffset(moment())); */ Calendar.setTimezoneOffset = function(offset) { tz.setOffset(offset); }; /** * Set a callback function to get timezone offset by timestamp * @param {function} callback - The callback function * @static * @deprecated * @example * var timezoneName = moment.tz.guess(); * tui.Calendar.setTimezoneOffsetCallback(function(timestamp) { * return moment.tz.zone(timezoneName).utcOffset(timestamp)); * }); */ Calendar.setTimezoneOffsetCallback = function(callback) { tz.setOffsetCallback(callback); }; /** * Create controller instance * @returns {Base} controller instance * @param {Options} options - calendar options * @private */ function _createController(options) { return controllerFactory(options); } /** * Create week view instance by dependent module instances * @param {Base} controller - controller * @param {HTMLElement} container - container element * @param {Drag} dragHandler - global drag handler * @param {object} options - options for week view * @param {string} viewName - 'week', 'day' * @returns {Week} week view instance * @private */ function _createWeekView(controller, container, dragHandler, options, viewName) { return weekViewFactory(controller, container, dragHandler, options, viewName); } /** * Create week view instance by dependent module instances * @param {Base} controller - controller * @param {HTMLElement} container - container element * @param {Drag} dragHandler - global drag handler * @param {object} options - options for week view * @returns {Month} month view instance * @private */ function _createMonthView(controller, container, dragHandler, options) { return monthViewFactory(controller, container, dragHandler, options); } /** * Set child view's options recursively * @param {View} view - parent view * @param {function} func - option manipulate function * @private */ function _setOptionRecurseively(view, func) { view.recursive(function(childView) { var opt = childView.options; if (!opt) { return; } func(childView, opt); }); } util.CustomEvents.mixin(Calendar); module.exports = Calendar; /***/ }), /***/ "./src/js/factory/controller.js": /*!**************************************!*\ !*** ./src/js/factory/controller.js ***! \**************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Controller factory module. * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var Base = __webpack_require__(/*! ../controller/base */ "./src/js/controller/base.js"), Core = __webpack_require__(/*! ../controller/viewMixin/core */ "./src/js/controller/viewMixin/core.js"), Week = __webpack_require__(/*! ../controller/viewMixin/week */ "./src/js/controller/viewMixin/week.js"), Month = __webpack_require__(/*! ../controller/viewMixin/month */ "./src/js/controller/viewMixin/month.js"); /** * Mixin object. create object property to target and mix to that * @param {object} from - source object * @param {object} to - target object * @param {string} propertyName - property name */ function mixin(from, to, propertyName) { var obj = to[propertyName] = {}; util.forEach(from, function(method, methodName) { obj[methodName] = method.bind(to); }); } /** * @param {object} options - options for base controller * @param {function} [options.groupFunc] - function for group each models {@see Collection#groupBy} * @returns {Base} The controller instance. */ module.exports = function(options) { var controller = new Base(options); mixin(Core, controller, 'Core'); mixin(Week, controller, 'Week'); mixin(Month, controller, 'Month'); // for Theme controller.Core.theme = controller.theme; controller.Week.theme = controller.theme; controller.Month.theme = controller.theme; return controller; }; /***/ }), /***/ "./src/js/factory/monthView.js": /*!*************************************!*\ !*** ./src/js/factory/monthView.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Month view factory module * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../config */ "./src/js/config.js"), array = __webpack_require__(/*! ../common/array */ "./src/js/common/array.js"), datetime = __webpack_require__(/*! ../common/datetime */ "./src/js/common/datetime.js"), domutil = __webpack_require__(/*! ../common/domutil */ "./src/js/common/domutil.js"), common = __webpack_require__(/*! ../common/common */ "./src/js/common/common.js"), Month = __webpack_require__(/*! ../view/month/month */ "./src/js/view/month/month.js"), MonthClick = __webpack_require__(/*! ../handler/month/click */ "./src/js/handler/month/click.js"), MonthCreation = __webpack_require__(/*! ../handler/month/creation */ "./src/js/handler/month/creation.js"), MonthResize = __webpack_require__(/*! ../handler/month/resize */ "./src/js/handler/month/resize.js"), MonthMove = __webpack_require__(/*! ../handler/month/move */ "./src/js/handler/month/move.js"), More = __webpack_require__(/*! ../view/month/more */ "./src/js/view/month/more.js"), ScheduleCreationPopup = __webpack_require__(/*! ../view/popup/scheduleCreationPopup */ "./src/js/view/popup/scheduleCreationPopup.js"), ScheduleDetailPopup = __webpack_require__(/*! ../view/popup/scheduleDetailPopup */ "./src/js/view/popup/scheduleDetailPopup.js"), Schedule = __webpack_require__(/*! ../model/schedule */ "./src/js/model/schedule.js"); /** * Get the view model for more layer * @param {TZDate} date - date has more schedules * @param {HTMLElement} target - target element * @param {Collection} schedules - schedule collection * @param {string[]} daynames - daynames to use upside of month more view * @returns {object} view model */ function getViewModelForMoreLayer(date, target, schedules, daynames) { schedules.each(function(schedule) { var model = schedule.model; schedule.hasMultiDates = datetime.hasMultiDates(model.start, model.end); }); return { target: target, date: datetime.format(date, 'YYYY.MM.DD'), dayname: daynames[date.getDay()], schedules: schedules.sort(array.compare.schedule.asc) }; } /** * @param {Base} baseController - controller instance * @param {HTMLElement} layoutContainer - container element for month view * @param {Drag} dragHandler - drag handler instance * @param {object} options - options * @returns {object} view instance and refresh method */ function createMonthView(baseController, layoutContainer, dragHandler, options) { var monthViewContainer, monthView, moreView, createView; var clickHandler, creationHandler, resizeHandler, moveHandler, clearSchedulesHandler, onUpdateSchedule; var onShowCreationPopup, onSaveNewSchedule, onShowEditPopup; var detailView, onShowDetailPopup, onDeleteSchedule, onEditSchedule; monthViewContainer = domutil.appendHTMLElement( 'div', layoutContainer, config.classname('month')); monthView = new Month(options, monthViewContainer, baseController.Month); moreView = new More(options.month, layoutContainer, baseController.theme); // handlers clickHandler = new MonthClick(dragHandler, monthView, baseController); if (!options.isReadOnly) { creationHandler = new MonthCreation(dragHandler, monthView, baseController, options); resizeHandler = new MonthResize(dragHandler, monthView, baseController); moveHandler = new MonthMove(dragHandler, monthView, baseController); } clearSchedulesHandler = function() { if (moreView) { moreView.hide(); } }; onUpdateSchedule = function() { if (moreView) { moreView.refresh(); } }; // binding +n click schedule clickHandler.on('clickMore', function(clickMoreSchedule) { var date = clickMoreSchedule.date, target = clickMoreSchedule.target, schedules = util.pick(baseController.findByDateRange( datetime.start(date), datetime.end(date) ), clickMoreSchedule.ymd); schedules.items = util.filter(schedules.items, function(item) { return options.month.scheduleFilter(item.model); }); if (schedules && schedules.length) { moreView.render(getViewModelForMoreLayer(date, target, schedules, monthView.options.daynames)); schedules.each(function(scheduleViewModel) { if (scheduleViewModel) { /** * @event More#afterRenderSchedule */ monthView.fire('afterRenderSchedule', {schedule: scheduleViewModel.model}); } }); monthView.fire('clickMore', { date: clickMoreSchedule.date, target: moreView.getMoreViewElement() }); } }); // binding popup for schedules creation if (options.useCreationPopup) { createView = new ScheduleCreationPopup(layoutContainer, baseController.calendars, options.usageStatistics); onSaveNewSchedule = function(scheduleData) { creationHandler.fire('beforeCreateSchedule', util.extend(scheduleData, { useCreationPopup: true })); }; createView.on('beforeCreateSchedule', onSaveNewSchedule); } // binding popup for schedule detail if (options.useDetailPopup) { detailView = new ScheduleDetailPopup(layoutContainer, baseController.calendars); onShowDetailPopup = function(eventData) { var scheduleId = eventData.schedule.calendarId; eventData.calendar = common.find(baseController.calendars, function(calendar) { return calendar.id === scheduleId; }); if (options.isReadOnly) { eventData.schedule = util.extend({}, eventData.schedule, {isReadOnly: true}); } detailView.render(eventData); }; onDeleteSchedule = function(eventData) { if (creationHandler) { creationHandler.fire('beforeDeleteSchedule', eventData); } }; onEditSchedule = function(eventData) { moveHandler.fire('beforeUpdateSchedule', eventData); }; clickHandler.on('clickSchedule', onShowDetailPopup); detailView.on('beforeDeleteSchedule', onDeleteSchedule); if (options.useCreationPopup) { onShowEditPopup = function(eventData) { createView.setCalendars(baseController.calendars); createView.render(eventData); }; createView.on('beforeUpdateSchedule', onEditSchedule); detailView.on('beforeUpdateSchedule', onShowEditPopup); } else { detailView.on('beforeUpdateSchedule', onEditSchedule); } } // binding clear schedules baseController.on('clearSchedules', clearSchedulesHandler); // bind update schedule event baseController.on('updateSchedule', onUpdateSchedule); if (moveHandler) { moveHandler.on('monthMoveStart_from_morelayer', function() { moreView.hide(); }); } monthView.handler = { click: { 'default': clickHandler } }; if (!options.isReadOnly) { monthView.handler = util.extend(monthView.handler, { creation: { 'default': creationHandler }, resize: { 'default': resizeHandler }, move: { 'default': moveHandler } }); } monthView._beforeDestroy = function() { moreView.destroy(); baseController.off('clearSchedules', clearSchedulesHandler); baseController.off('updateSchedule', onUpdateSchedule); util.forEach(monthView.handler, function(type) { util.forEach(type, function(handler) { handler.off(); handler.destroy(); }); }); if (options.useCreationPopup && options.useDetailPopup) { createView.off('beforeUpdateSchedule', onUpdateSchedule); } if (options.useCreationPopup) { if (creationHandler) { creationHandler.off('beforeCreateSchedule', onShowCreationPopup); } createView.off('saveSchedule', onSaveNewSchedule); createView.destroy(); } if (options.useDetailPopup) { clickHandler.off('clickSchedule', onShowDetailPopup); detailView.off('beforeUpdateSchedule', onUpdateSchedule); detailView.off('beforeDeleteSchedule', onDeleteSchedule); detailView.destroy(); } }; // add controller monthView.controller = baseController.Month; return { view: monthView, refresh: function() { monthView.vLayout.refresh(); }, openCreationPopup: function(schedule) { if (createView && creationHandler) { creationHandler.invokeCreationClick(Schedule.create(schedule)); } }, showCreationPopup: function(eventData) { if (createView) { createView.setCalendars(baseController.calendars); createView.render(eventData); } }, hideMoreView: function() { if (moreView) { moreView.hide(); } } }; } module.exports = createMonthView; /***/ }), /***/ "./src/js/factory/weekView.js": /*!************************************!*\ !*** ./src/js/factory/weekView.js ***! \************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Factory module for WeekView * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../config */ "./src/js/config.js"); var domutil = __webpack_require__(/*! ../common/domutil */ "./src/js/common/domutil.js"); var common = __webpack_require__(/*! ../common/common */ "./src/js/common/common.js"); var VLayout = __webpack_require__(/*! ../common/vlayout */ "./src/js/common/vlayout.js"); var reqAnimFrame = __webpack_require__(/*! ../common/reqAnimFrame */ "./src/js/common/reqAnimFrame.js"); var Schedule = __webpack_require__(/*! ../model/schedule */ "./src/js/model/schedule.js"); // Parent views var Week = __webpack_require__(/*! ../view/week/week */ "./src/js/view/week/week.js"); // Sub views var DayName = __webpack_require__(/*! ../view/week/dayname */ "./src/js/view/week/dayname.js"); var DayGrid = __webpack_require__(/*! ../view/week/dayGrid */ "./src/js/view/week/dayGrid.js"); var TimeGrid = __webpack_require__(/*! ../view/week/timeGrid */ "./src/js/view/week/timeGrid.js"); var ScheduleCreationPopup = __webpack_require__(/*! ../view/popup/scheduleCreationPopup */ "./src/js/view/popup/scheduleCreationPopup.js"); var ScheduleDetailPopup = __webpack_require__(/*! ../view/popup/scheduleDetailPopup */ "./src/js/view/popup/scheduleDetailPopup.js"); // Handlers var DayNameClick = __webpack_require__(/*! ../handler/time/clickDayname */ "./src/js/handler/time/clickDayname.js"); var DayGridClick = __webpack_require__(/*! ../handler/daygrid/click */ "./src/js/handler/daygrid/click.js"); var DayGridCreation = __webpack_require__(/*! ../handler/daygrid/creation */ "./src/js/handler/daygrid/creation.js"); var DayGridMove = __webpack_require__(/*! ../handler/daygrid/move */ "./src/js/handler/daygrid/move.js"); var DayGridResize = __webpack_require__(/*! ../handler/daygrid/resize */ "./src/js/handler/daygrid/resize.js"); var TimeClick = __webpack_require__(/*! ../handler/time/click */ "./src/js/handler/time/click.js"); var TimeCreation = __webpack_require__(/*! ../handler/time/creation */ "./src/js/handler/time/creation.js"); var TimeMove = __webpack_require__(/*! ../handler/time/move */ "./src/js/handler/time/move.js"); var TimeResize = __webpack_require__(/*! ../handler/time/resize */ "./src/js/handler/time/resize.js"); var DAYGRID_HANDLDERS = { 'click': DayGridClick, 'creation': DayGridCreation, 'move': DayGridMove, 'resize': DayGridResize }; var TIMEGRID_HANDLERS = { 'click': TimeClick, 'creation': TimeCreation, 'move': TimeMove, 'resize': TimeResize }; var DEFAULT_PANELS = [ { name: 'milestone', type: 'daygrid', minHeight: 20, maxHeight: 80, showExpandableButton: true, maxExpandableHeight: 210, handlers: ['click'], show: true }, { name: 'task', type: 'daygrid', minHeight: 40, maxHeight: 120, showExpandableButton: true, maxExpandableHeight: 210, handlers: ['click', 'move'], show: true }, { name: 'allday', type: 'daygrid', minHeight: 30, maxHeight: 80, showExpandableButton: true, maxExpandableHeight: 210, handlers: ['click', 'creation', 'move', 'resize'], show: true }, { name: 'time', type: 'timegrid', autoHeight: true, handlers: ['click', 'creation', 'move', 'resize'], show: true } ]; /* eslint-disable complexity*/ module.exports = function(baseController, layoutContainer, dragHandler, options, viewName) { var panels = [], vpanels = []; var weekView, dayNameContainer, dayNameView, vLayoutContainer, vLayout; var createView, onSaveNewSchedule, onSetCalendars, lastVPanel; var detailView, onShowDetailPopup, onDeleteSchedule, onShowEditPopup, onEditSchedule; var taskView = options.taskView; var scheduleView = options.scheduleView; var viewVisibilities = { 'milestone': util.isArray(taskView) ? util.inArray('milestone', taskView) >= 0 : taskView, 'task': util.isArray(taskView) ? util.inArray('task', taskView) >= 0 : taskView, 'allday': util.isArray(scheduleView) ? util.inArray('allday', scheduleView) >= 0 : scheduleView, 'time': util.isArray(scheduleView) ? util.inArray('time', scheduleView) >= 0 : scheduleView }; // Make panels by view sequence and visibilities util.forEach(DEFAULT_PANELS, function(panel) { var name = panel.name; panel = util.extend({}, panel); panels.push(panel); // Change visibilities panel.show = viewVisibilities[name]; if (panel.show) { if (vpanels.length) { vpanels.push({ isSplitter: true }); } vpanels.push(util.extend({}, panel)); } }); if (vpanels.length) { lastVPanel = vpanels[vpanels.length - 1]; lastVPanel.autoHeight = true; lastVPanel.maxHeight = null; lastVPanel.showExpandableButton = false; util.forEach(panels, function(panel) { if (panel.name === lastVPanel.name) { panel.showExpandableButton = false; return false; } return true; }); } util.extend(options.week, {panels: panels}); weekView = new Week(null, options.week, layoutContainer, panels, viewName); weekView.handler = { click: {}, dayname: {}, creation: {}, move: {}, resize: {} }; dayNameContainer = domutil.appendHTMLElement('div', weekView.container, config.classname('dayname-layout')); /********** * Day name (top row(Mon, Tue, Wed...)) **********/ dayNameView = new DayName(options, dayNameContainer, baseController.theme); weekView.handler.dayname.date = new DayNameClick(dragHandler, dayNameView, baseController); weekView.addChild(dayNameView); /********** * Initialize vertical layout module **********/ vLayoutContainer = domutil.appendHTMLElement('div', weekView.container, config.classname('vlayout-area')); vLayoutContainer.style.height = (domutil.getSize(weekView.container)[1] - dayNameView.container.offsetHeight) + 'px'; vLayout = new VLayout({ panels: vpanels, panelHeights: options.week.panelHeights || [] }, vLayoutContainer, baseController.theme); weekView.vLayout = vLayout; util.forEach(panels, function(panel) { var name = panel.name; var handlers = panel.handlers; var view; if (!panel.show) { return; } if (panel.type === 'daygrid') { /********** * Schedule panel by Grid **********/ view = new DayGrid(name, options, vLayout.getPanelByName(panel.name).container, baseController.theme); view.on('afterRender', function(viewModel) { vLayout.getPanelByName(name).setHeight(null, viewModel.height); }); weekView.addChild(view); util.forEach(handlers, function(type) { if (!options.isReadOnly || type === 'click') { weekView.handler[type][name] = new DAYGRID_HANDLDERS[type](dragHandler, view, baseController, options); view.addHandler(type, weekView.handler[type][name], vLayout.getPanelByName(name)); } }); } else if (panel.type === 'timegrid') { /********** * Schedule panel by TimeGrid **********/ view = new TimeGrid(name, options, vLayout.getPanelByName(name).container); weekView.addChild(view); util.forEach(handlers, function(type) { if (!options.isReadOnly || type === 'click') { weekView.handler[type][name] = new TIMEGRID_HANDLERS[type](dragHandler, view, baseController, options); } }); view.on('clickTimezonesCollapsedBtn', function() { var timezonesCollapsed = !weekView.state.timezonesCollapsed; weekView.setState({ timezonesCollapsed: timezonesCollapsed }); reqAnimFrame.requestAnimFrame(function() { if (!weekView.invoke('clickTimezonesCollapseBtn', timezonesCollapsed)) { weekView.render(); } }); }); } }); vLayout.on('resize', function() { reqAnimFrame.requestAnimFrame(function() { weekView.render(); }); }); // binding create schedules event if (options.useCreationPopup) { createView = new ScheduleCreationPopup(layoutContainer, baseController.calendars, options.usageStatistics); onSaveNewSchedule = function(scheduleData) { util.extend(scheduleData, { useCreationPopup: true }); if (scheduleData.isAllDay) { weekView.handler.creation.allday.fire('beforeCreateSchedule', scheduleData); } else { weekView.handler.creation.time.fire('beforeCreateSchedule', scheduleData); } }; createView.on('beforeCreateSchedule', onSaveNewSchedule); } onSetCalendars = function(calendars) { if (createView) { createView.setCalendars(calendars); } }; baseController.on('setCalendars', onSetCalendars); // binding popup for schedule detail if (options.useDetailPopup) { detailView = new ScheduleDetailPopup(layoutContainer, baseController.calendars); onShowDetailPopup = function(eventData) { var scheduleId = eventData.schedule.calendarId; eventData.calendar = common.find(baseController.calendars, function(calendar) { return calendar.id === scheduleId; }); if (options.isReadOnly) { eventData.schedule = util.extend({}, eventData.schedule, {isReadOnly: true}); } detailView.render(eventData); }; onDeleteSchedule = function(eventData) { if (eventData.isAllDay) { weekView.handler.creation.allday.fire('beforeDeleteSchedule', eventData); } else { weekView.handler.creation.time.fire('beforeDeleteSchedule', eventData); } }; onEditSchedule = function(eventData) { if (eventData.isAllDay) { weekView.handler.move.allday.fire('beforeUpdateSchedule', eventData); } else { weekView.handler.move.time.fire('beforeUpdateSchedule', eventData); } }; util.forEach(weekView.handler.click, function(panel) { panel.on('clickSchedule', onShowDetailPopup); }); if (options.useCreationPopup) { onShowEditPopup = function(eventData) { var calendars = baseController.calendars; eventData.isEditMode = true; createView.setCalendars(calendars); createView.render(eventData); }; createView.on('beforeUpdateSchedule', onEditSchedule); detailView.on('beforeUpdateSchedule', onShowEditPopup); } else { detailView.on('beforeUpdateSchedule', onEditSchedule); } detailView.on('beforeDeleteSchedule', onDeleteSchedule); } weekView.on('afterRender', function() { vLayout.refresh(); }); // add controller weekView.controller = baseController.Week; // add destroy weekView._beforeDestroy = function() { util.forEach(weekView.handler, function(type) { util.forEach(type, function(handler) { handler.off(); handler.destroy(); }); }); if (options.useCreationPopup) { createView.off('beforeCreateSchedule', onSaveNewSchedule); createView.destroy(); } if (options.useDetailPopup) { detailView.off('beforeDeleteSchedule', onDeleteSchedule); detailView.destroy(); } weekView.off(); }; return { view: weekView, refresh: function() { var weekViewHeight = weekView.getViewBound().height, daynameViewHeight = domutil.getBCRect( dayNameView.container ).height; vLayout.container.style.height = weekViewHeight - daynameViewHeight + 'px'; vLayout.refresh(); }, scrollToNow: function() { weekView.children.each(function(childView) { if (childView.scrollToNow) { childView.scrollToNow(); } }); }, openCreationPopup: function(schedule) { if (createView) { if (schedule.isAllDay) { weekView.handler.creation.allday.invokeCreationClick(Schedule.create(schedule)); } else { weekView.handler.creation.time.invokeCreationClick(Schedule.create(schedule)); } } }, showCreationPopup: function(eventData) { if (createView) { createView.setCalendars(baseController.calendars); createView.render(eventData); } } }; }; /***/ }), /***/ "./src/js/handler/daygrid/click.js": /*!*****************************************!*\ !*** ./src/js/handler/daygrid/click.js ***! \*****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Click handle module for daygrid schedules * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var DayGridMove = __webpack_require__(/*! ./move */ "./src/js/handler/daygrid/move.js"); /** * @constructor * @implements {Handler} * @mixes CustomEvents * @param {Drag} [dragHandler] - Drag handler instance. * @param {DayGrid} [view] - daygrid view instance. * @param {Base} [controller] - Base controller instance. */ function DayGridClick(dragHandler, view, controller) { /** * @type {Drag} */ this.dragHandler = dragHandler; /** * @type {DayGrid} */ this.view = view; /** * @type {Base} */ this.controller = controller; dragHandler.on({ 'click': this._onClick }, this); } /** * Destroy handler module */ DayGridClick.prototype.destroy = function() { this.dragHandler.off(this); this.view = this.controller = this.dragHandler = null; }; /** * Check target element is expected condition for activate this plugins. * @param {HTMLElement} target - The element to check * @returns {string} - model id */ DayGridClick.prototype.checkExpectCondition = DayGridMove.prototype.checkExpectedCondition; /** * Click event handler * @param {object} clickEvent - click event data * @emits DayGridClick#clickSchedule * @emits DayGridClick#collapse * @emits DayGridClick#expand */ DayGridClick.prototype._onClick = function(clickEvent) { var self = this, target = clickEvent.target, dayGridScheduleView = this.checkExpectCondition(target), scheduleCollection = this.controller.schedules, collapseBtnElement = domutil.closest( target, config.classname('.weekday-collapse-btn') ), expandBtnElement = domutil.closest( target, config.classname('.weekday-exceed-in-week') ), containsTarget = this.view.container.contains(target); var blockElement, scheduleElement; if (!containsTarget) { return; } if (collapseBtnElement) { /** * click collpase btn event * @events DayGridClick#collapse */ self.fire('collapse'); return; } if (expandBtnElement) { this.view.setState({ clickedExpandBtnIndex: parseInt(domutil.getData(expandBtnElement, 'index'), 10) }); /** * click expand btn event * @events DayGridClick#expand */ self.fire('expand'); return; } if (!dayGridScheduleView) { return; } scheduleElement = domutil.closest(target, config.classname('.weekday-schedule')); if (scheduleElement) { blockElement = domutil.closest(target, config.classname('.weekday-schedule-block')); scheduleCollection.doWhenHas(domutil.getData(blockElement, 'id'), function(schedule) { /** * @events DayGridClick#clickSchedule * @type {object} * @property {Schedule} schedule - schedule instance * @property {MouseEvent} event - MouseEvent object */ self.fire('clickSchedule', { schedule: schedule, event: clickEvent.originEvent }); }); } }; util.CustomEvents.mixin(DayGridClick); module.exports = DayGridClick; /***/ }), /***/ "./src/js/handler/daygrid/core.js": /*!****************************************!*\ !*** ./src/js/handler/daygrid/core.js ***! \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint no-shadow: 0 */ /** * @fileoverview Base mixin object for handler/daygrid * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var domevent = __webpack_require__(/*! ../../common/domevent */ "./src/js/common/domevent.js"); var common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var mmax = Math.max, mmin = Math.min; /** * @mixin dayGridCore */ var dayGridCore = { /** * @param {view} view - view instance. * @param {MouseEvent} mouseEvent - mouse schedule object. * @returns {function|boolean} function that return schedule data by mouse events. */ _retriveScheduleData: function(view, mouseEvent) { var weekdayView = view.children.single(), container, datesInRange, containerWidth, mousePos, dragStartXIndex, grids, range; if (!weekdayView) { return false; } container = weekdayView.container; range = weekdayView.getRenderDateRange(); datesInRange = range.length; grids = weekdayView.getRenderDateGrids(); containerWidth = domutil.getSize(container)[0]; mousePos = domevent.getMousePosition(mouseEvent, container); dragStartXIndex = getX(grids, common.ratio(containerWidth, 100, mousePos[0])); /** * @param {MouseEvent} mouseEvent - mouse schedule in drag actions. * @returns {object} schedule data. */ return function(mouseEvent) { var pos = domevent.getMousePosition(mouseEvent, container), mouseX = pos[0], xIndex = getX(grids, common.ratio(containerWidth, 100, mouseX)); // apply limitation of creation schedule X index. xIndex = mmax(xIndex, 0); xIndex = mmin(xIndex, datesInRange - 1); return { relatedView: view, dragStartXIndex: dragStartXIndex, datesInRange: datesInRange, xIndex: xIndex, triggerEvent: mouseEvent.type, grids: grids, range: range }; }; }, /** * @param {view} view - view instance. * @param {TZDate} startDate - start date * @returns {object} schedule data by mouse events. */ _retriveScheduleDataFromDate: function(view, startDate) { var weekdayView = view.children.single(), xIndex = 0, datesInRange, dragStartXIndex = 0, grids, range; if (!weekdayView) { return false; } range = weekdayView.getRenderDateRange(); datesInRange = range.length; grids = weekdayView.getRenderDateGrids(); util.forEach(range, function(date, index) { if (datetime.isSameDate(date, startDate)) { xIndex = dragStartXIndex = index; } }); // apply limitation of creation schedule X index. xIndex = mmax(xIndex, 0); xIndex = mmin(xIndex, datesInRange - 1); return { relatedView: view, dragStartXIndex: dragStartXIndex, datesInRange: datesInRange, xIndex: xIndex, triggerEvent: 'manual', grids: grids, range: range }; } }; /** * Get the left index * @param {Array} grids - grid size information * @param {number} left - left position(percent) * @returns {number} grid left index */ function getX(grids, left) { var i = 0; var length = grids.length; var grid; if (left < 0) { left = 0; } for (; i < length; i += 1) { grid = grids[i]; if (grid.left <= left && left <= (grid.left + grid.width)) { return i; } } return i; } module.exports = dayGridCore; /***/ }), /***/ "./src/js/handler/daygrid/creation.js": /*!********************************************!*\ !*** ./src/js/handler/daygrid/creation.js ***! \********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Handler module for WeekdayInWeek view's creation actions. * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var domevent = __webpack_require__(/*! ../../common/domevent */ "./src/js/common/domevent.js"); var dayGridCore = __webpack_require__(/*! ./core */ "./src/js/handler/daygrid/core.js"); var DayGridCreationGuide = __webpack_require__(/*! ./creationGuide */ "./src/js/handler/daygrid/creationGuide.js"); var TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date; var CLICK_DELAY = 300; /** * @constructor * @implements {Handler} * @mixes dayGridCore * @mixes CutomEvents * @param {Drag} [dragHandler] - Drag handler instance. * @param {DayGrid} [view] - DayGrid view instance. * @param {Base} [controller] - Base controller instance. * @param {Options} [options] - calendar Options */ function DayGridCreation(dragHandler, view, controller, options) { /** * Drag handler instance. * @type {Drag} */ this.dragHandler = dragHandler; /** * view instance. * @type {DayGrid} */ this.view = view; /** * Base controller instance. * @type {Base} */ this.controller = controller; /** * @type {function} */ this.getScheduleDataFunc = null; /** * @type {DayGridCreationGuide} */ this.guide = new DayGridCreationGuide(this); /** * @type {boolean} */ this._requestOnClick = false; /** * @type {boolean} */ this._disableDblClick = options.disableDblClick; /** * @type {boolean} */ this._disableClick = options.disableClick; dragHandler.on('dragStart', this._onDragStart, this); dragHandler.on('click', this._onClick, this); if (this._disableDblClick) { CLICK_DELAY = 0; } else { domevent.on(view.container, 'dblclick', this._onDblClick, this); } } /** * Destroy method */ DayGridCreation.prototype.destroy = function() { this.guide.destroy(); this.dragHandler.off(this); if (this.view && this.view.container) { domevent.off(this.view.container, 'dblclick', this._onDblClick, this); } this.dragHandler = this.view = this.controller = this.getScheduleDataFunc = null; }; /** * Check dragstart target is expected conditions for this handler. * @param {HTMLElement} target - dragstart event handler's target element. * @returns {boolean|WeekdayInWeek} return WeekdayInWeek view instance when satiate condition. */ DayGridCreation.prototype.checkExpectedCondition = function(target) { var cssClass = domutil.getClass(target).trim(); var excludeTarget = true; var matches, schedulesElement; if (domutil.closest(target, config.classname('.weekday-exceed-in-week')) || domutil.closest(target, config.classname('.weekday-collapse-btn')) ) { return false; } if (domutil.closest(target, config.classname('.weekday-schedule-block'), excludeTarget)) { return false; } schedulesElement = domutil.closest(target, config.classname('.weekday-schedules')); if (!schedulesElement && cssClass !== config.classname('weekday-schedules')) { return false; } target = schedulesElement ? schedulesElement.parentNode : target.parentNode; cssClass = domutil.getClass(target); matches = cssClass.match(config.daygrid.getViewIDRegExp); if (!matches || matches.length < 2) { return false; } return util.pick(this.view.children.items, matches[1]); }; /** * Request schedule model creation to controller by custom schedules. * @fires {DayGridCreation#beforeCreateSchedule} * @param {object} scheduleData - schedule data from DayGridCreation module. */ DayGridCreation.prototype._createSchedule = function(scheduleData) { var dateRange = scheduleData.range, startXIndex = scheduleData.dragStartXIndex, xIndex = scheduleData.xIndex, start, end; // when inverse start, end then change it. if (xIndex < startXIndex) { startXIndex = xIndex + startXIndex; xIndex = startXIndex - xIndex; startXIndex = startXIndex - xIndex; } start = new TZDate(dateRange[startXIndex]); end = datetime.end(dateRange[xIndex]); /** * @event {DayGridCreation#beforeCreateSchedule} * @type {object} * @property {string} category - schedule category * @property {boolean} isAllDay - whether schedule is fired in view area? * @property {Date} start - select start time * @property {Date} end - select end time * @property {DayGridCreationGuide} guide - DayGridCreationGuide instance * @property {string} triggerEventName - event name */ this.fire('beforeCreateSchedule', { category: this.view.options.viewName, isAllDay: true, start: start, end: end, guide: this.guide, triggerEventName: scheduleData.triggerEvent }); }; /** * DragStart event handler method. * @emits DayGridCreation#dragstart * @param {object} dragStartEventData - Drag#dragStart event handler schedule data. */ DayGridCreation.prototype._onDragStart = function(dragStartEventData) { var target = dragStartEventData.target, result = this.checkExpectedCondition(target), getScheduleDataFunc, scheduleData; if (!result) { return; } this.dragHandler.on({ drag: this._onDrag, dragEnd: this._onDragEnd }, this); getScheduleDataFunc = this._retriveScheduleData(this.view, dragStartEventData.originEvent); this.getScheduleDataFunc = getScheduleDataFunc; scheduleData = getScheduleDataFunc(dragStartEventData.originEvent); /** * @event DayGridCreation#dragstart * @type {object} * @property {DayGridView} relatedView - view instance. * @property {number} datesInRange - date count of this view. * @property {number} dragStartXIndex - index number of dragstart grid index. * @property {number} xIndex - index number of mouse positions. */ this.fire('dragstart', scheduleData); }; /** * Drag event handler method. * @emits DayGridCreation#drag * @param {object} dragEventData - Drag#drag event handler scheduledata. */ DayGridCreation.prototype._onDrag = function(dragEventData) { var getScheduleDataFunc = this.getScheduleDataFunc, scheduleData; if (!getScheduleDataFunc) { return; } scheduleData = getScheduleDataFunc(dragEventData.originEvent); /** * @event DayGridCreation#drag * @type {object} * @property {DayGridView} relatedView - view instance. * @property {number} datesInRange - date count of this view. * @property {number} dragStartXIndex - index number of dragstart grid index. * @property {number} xIndex - index number of mouse positions. */ this.fire('drag', scheduleData); }; /** * DragEnd event hander method. * @emits DayGridCreation#dragend * @param {object} dragEndEventData - Drag#dragEnd event handler data. * @param {string} [overrideEventName] - override emitted event name when supplied. */ DayGridCreation.prototype._onDragEnd = function(dragEndEventData, overrideEventName) { var getScheduleDataFunc = this.getScheduleDataFunc; var scheduleData; if (!getScheduleDataFunc) { return; } this.dragHandler.off({ drag: this._onDrag, dragEnd: this._onDragEnd }, this); scheduleData = getScheduleDataFunc(dragEndEventData.originEvent); this._createSchedule(scheduleData); /** * @event DayGridCreation#dragend * @type {object} * @property {DayGridView} relatedView - view instance. * @property {number} datesInRange - date count of this view. * @property {number} dragStartXIndex - index number of dragstart grid index. * @property {number} xIndex - index number of mouse positions. */ this.fire(overrideEventName || 'dragend', scheduleData); this.getScheduleDataFunc = null; }; /** * Click event handler method. * @emits DayGridCreation#click * @param {object} clickEventData - Drag#click event handler data. */ DayGridCreation.prototype._onClick = function(clickEventData) { var self = this; var getScheduleDataFunc, scheduleData; if (!this.checkExpectedCondition(clickEventData.target) || this._disableClick) { return; } getScheduleDataFunc = this._retriveScheduleData(this.view, clickEventData.originEvent); scheduleData = getScheduleDataFunc(clickEventData.originEvent); this._requestOnClick = true; setTimeout(function() { if (self._requestOnClick) { self.fire('click', scheduleData); self._createSchedule(scheduleData); } self._requestOnClick = false; }, CLICK_DELAY); }; /** * Dblclick event handler method. * @emits DayGridCreation#click * @param {object} clickEventData - Drag#Click event handler data. */ DayGridCreation.prototype._onDblClick = function(clickEventData) { var getScheduleDataFunc, scheduleData; if (!this.checkExpectedCondition(clickEventData.target)) { return; } getScheduleDataFunc = this._retriveScheduleData(this.view, clickEventData); scheduleData = getScheduleDataFunc(clickEventData); this.fire('click', scheduleData); this._createSchedule(scheduleData); this._requestOnClick = false; }; /** * Invoke creation click * @param {Schedule} schedule - schedule instance */ DayGridCreation.prototype.invokeCreationClick = function(schedule) { var scheduleData = this._retriveScheduleDataFromDate(this.view, schedule.start); this.fire('click', scheduleData); this._createSchedule(scheduleData); }; common.mixin(dayGridCore, DayGridCreation); util.CustomEvents.mixin(DayGridCreation); module.exports = DayGridCreation; /***/ }), /***/ "./src/js/handler/daygrid/creationGuide.js": /*!*************************************************!*\ !*** ./src/js/handler/daygrid/creationGuide.js ***! \*************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Guide element for DayGrid.Creation * @author NHN FE Development Lab */ var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var reqAnimFrame = __webpack_require__(/*! ../../common/reqAnimFrame */ "./src/js/common/reqAnimFrame.js"); /** * Class for DayGrid.Creation dragging effect. * @constructor * @param {DayGridCreation} creation - instance of DayGridCreation. */ function DayGridCreationGuide(creation) { /** * @type {DayGridCreation} */ this.creation = creation; /** * @type {HTMLDIVElement} */ this.scheduleContainer = null; /** * @type {HTMLDIVElement} */ this.guideElement = document.createElement('div'); this.initializeGuideElement(); this.applyTheme(creation.controller.theme); creation.on({ dragstart: this._createGuideElement, drag: this._onDrag, click: this._createGuideElement }, this); } /** * Destroy method */ DayGridCreationGuide.prototype.destroy = function() { this.clearGuideElement(); this.creation.off(this); this.creation = this.scheduleContainer = this.guideElement = null; }; /** * initialize guide element's default style. */ DayGridCreationGuide.prototype.initializeGuideElement = function() { domutil.addClass(this.guideElement, config.classname('daygrid-guide-creation-block')); }; /** * Drag event handler * @param {object} scheduleData - schedule data from DayGrid.Creation handler. */ DayGridCreationGuide.prototype._onDrag = function(scheduleData) { this._refreshGuideElement(scheduleData, true); }; /** * Get element width based on narrowWeekend * @param {number} dragStartIndex - grid start index * @param {number} dragEndIndex - grid end index * @param {Array} grids - dates information * @returns {number} element width */ DayGridCreationGuide.prototype._getGuideWidth = function(dragStartIndex, dragEndIndex, grids) { var width = 0; var i = dragStartIndex; for (; i <= dragEndIndex; i += 1) { width += grids[i] ? grids[i].width : 0; } return width; }; /** * Refresh guide element. * @param {object} scheduleData - schedule data from DayGrid.Creation handler. * @param {boolean} defer - If set to true, set style in the next frame */ DayGridCreationGuide.prototype._refreshGuideElement = function(scheduleData, defer) { var guideElement = this.guideElement, data = scheduleData, dragStartXIndex = data.dragStartXIndex < data.xIndex ? data.dragStartXIndex : data.xIndex, dragEndXIndex = data.dragStartXIndex < data.xIndex ? data.xIndex : data.dragStartXIndex, leftPercent, widthPercent; leftPercent = data.grids[dragStartXIndex] ? data.grids[dragStartXIndex].left : 0; widthPercent = this._getGuideWidth(dragStartXIndex, dragEndXIndex, data.grids); /** eslint-disable require-jsdoc */ function setStyle() { guideElement.style.display = 'block'; guideElement.style.left = leftPercent + '%'; guideElement.style.width = widthPercent + '%'; } if (defer) { reqAnimFrame.requestAnimFrame(setStyle); } else { setStyle(); } }; /** * Clear guide element. */ DayGridCreationGuide.prototype.clearGuideElement = function() { var guideElement = this.guideElement; domutil.remove(guideElement); guideElement.style.display = 'none'; guideElement.style.left = ''; guideElement.style.width = ''; }; /** * Create guide element * @param {object} dragStartEventData - schedule data object of DayGrid.Creation. */ DayGridCreationGuide.prototype._createGuideElement = function(dragStartEventData) { var creation = this.creation, view = creation.view, container = view.container, scheduleContainer = domutil.find(config.classname('.weekday-grid'), container); scheduleContainer.appendChild(this.guideElement); this._refreshGuideElement(dragStartEventData); }; /** * Drag event handler. * @param {object} dragEventData - event data object of DayGrid.Creation. */ DayGridCreationGuide.prototype._onDrag = function(dragEventData) { this._refreshGuideElement(dragEventData); }; DayGridCreationGuide.prototype.applyTheme = function(theme) { var style = this.guideElement.style; style.backgroundColor = theme.common.creationGuide.backgroundColor; style.border = theme.common.creationGuide.border; }; module.exports = DayGridCreationGuide; /***/ }), /***/ "./src/js/handler/daygrid/move.js": /*!****************************************!*\ !*** ./src/js/handler/daygrid/move.js ***! \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Move handler for DayGrid view. * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var dayGridCore = __webpack_require__(/*! ./core */ "./src/js/handler/daygrid/core.js"); var DayGridMoveGuide = __webpack_require__(/*! ./moveGuide */ "./src/js/handler/daygrid/moveGuide.js"); var TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date; /** * @constructor * @implements {Handler} * @mixes dayGridCore * @mixes CustomEvents * @param {Drag} dragHandler - Drag handler instance. * @param {DayGrid} view - view instance. * @param {Base} controller - Base controller instance. */ function DayGridMove(dragHandler, view, controller) { /** * Drag handler instance. * @type {Drag} */ this.dragHandler = dragHandler; /** * view instance. * @type {DayGrid} */ this.view = view; /** * Base controller instance. * @type {Base} */ this.controller = controller; /** * Temporary variable for dragstart event data. * @type {object} */ this._dragStart = null; dragHandler.on({ dragStart: this._onDragStart }, this); /** * @type {DayGridMoveGuide} */ this.guide = new DayGridMoveGuide(this); } DayGridMove.prototype.destroy = function() { this.guide.destroy(); this.dragHandler.off(this); this.dragHandler = this.view = this.controller = this.guide = this._dragStart = null; }; /** * Check dragstart target is expected conditions for this handler. * @param {HTMLElement} target - dragstart event handler's target element. * @returns {boolean|DayGridSchedule} return DayGridSchedule view instance when satiate condition. */ DayGridMove.prototype.checkExpectedCondition = function(target) { var cssClass = domutil.getClass(target), parentView, matches; if (~cssClass.indexOf(config.classname('weekday-resize-handle'))) { return false; } parentView = domutil.closest(target, config.classname('.weekday')); if (!parentView) { return false; } cssClass = domutil.getClass(parentView); matches = cssClass.match(config.daygrid.getViewIDRegExp); if (!matches || matches.length < 2) { return false; } return util.pick(this.view.children.items, matches[1]); }; /** * DragStart event handler method. * @emits DayGridMove#dragstart * @param {object} dragStartEventData - Drag#dragStart event handler event data. */ DayGridMove.prototype._onDragStart = function(dragStartEventData) { var target = dragStartEventData.target, result = this.checkExpectedCondition(target), controller = this.controller, excludeTarget = true, scheduleBlockElement, modelID, targetModel, getScheduleDataFunc, scheduleData; if (!result) { return; } scheduleBlockElement = domutil.closest(target, config.classname('.weekday-schedule-block'), excludeTarget); if (!scheduleBlockElement) { return; } modelID = domutil.getData(scheduleBlockElement, 'id'); targetModel = controller.schedules.items[modelID]; if (!targetModel) { return; } if (targetModel.isReadOnly) { return; } getScheduleDataFunc = this._retriveScheduleData(this.view, dragStartEventData.originEvent); this.getScheduleDataFunc = getScheduleDataFunc; scheduleData = this._dragStart = getScheduleDataFunc(dragStartEventData.originEvent); util.extend(scheduleData, { scheduleBlockElement: scheduleBlockElement, model: targetModel }); this.dragHandler.on({ drag: this._onDrag, dragEnd: this._onDragEnd, click: this._onClick }, this); /** * @event DayGridMove#dragstart * @type {object} * @property {DayGrid} relatedView - view instance. * @property {number} datesInRange - date count of this view. * @property {number} dragStartXIndex - index number of dragstart grid index. * @property {number} xIndex - index number of mouse positions. * @property {Schedule} model - data object of model isntance. * @property {HTMLDivElement} scheduleBlockElement - target schedule block element. */ this.fire('dragstart', scheduleData); }; /** * Drag event handler method. * @emits DayGridMove#drag * @param {object} dragEventData - Drag#drag event handler eventdata. */ DayGridMove.prototype._onDrag = function(dragEventData) { var getScheduleDataFunc = this.getScheduleDataFunc; if (!getScheduleDataFunc) { return; } /** * @schedule DayGridMove#drag * @type {object} * @property {DayGrid} relatedView - view instance. * @property {number} datesInRange - date count of this view. * @property {number} dragStartXIndex - index number of dragstart grid index. * @property {number} xIndex - index number of mouse positions. */ this.fire('drag', getScheduleDataFunc(dragEventData.originEvent)); }; /** * Request update schedule model to base controller. * @fires DayGridMove#beforeUpdateSchedule * @param {object} scheduleData - schedule data from DayGridMove handler module. */ DayGridMove.prototype._updateSchedule = function(scheduleData) { var schedule = scheduleData.targetModel, dateOffset = scheduleData.xIndex - scheduleData.dragStartXIndex, newStarts = new TZDate(schedule.start), newEnds = new TZDate(schedule.end); newStarts = newStarts.addDate(dateOffset); newEnds = newEnds.addDate(dateOffset); /** * @event DayGridMove#beforeUpdateSchedule * @type {object} * @property {Schedule} schedule - The original schedule instance * @property {Date} start - Deprecated: start time to update * @property {Date} end - Deprecated: end time to update * @property {object} changes - start and end time to update * @property {Date} start - start time to update * @property {Date} end - end time to update */ this.fire('beforeUpdateSchedule', { schedule: schedule, changes: { start: newStarts, end: newEnds }, start: newStarts, end: newEnds }); }; /** * DragEnd event hander method. * @emits DayGridMove#dragend * @param {object} dragEndEventData - Drag#DragEnd event handler data. * @param {string} [overrideEventName] - override emitted event name when supplied. * @param {?boolean} skipUpdate - true then skip update schedule model. */ DayGridMove.prototype._onDragEnd = function(dragEndEventData, overrideEventName, skipUpdate) { var getScheduleDataFunc = this.getScheduleDataFunc, dragStart = this._dragStart, scheduleData; if (!getScheduleDataFunc || !dragStart) { return; } this.dragHandler.off({ drag: this._onDrag, dragEnd: this._onDragEnd, click: this._onClick }, this); scheduleData = getScheduleDataFunc(dragEndEventData.originEvent); util.extend(scheduleData, { targetModel: dragStart.model }); if (!skipUpdate) { this._updateSchedule(scheduleData); } /** * @event DayGridMove#dragend * @type {object} * @property {DayGrid} relatedView - view instance. * @property {number} datesInRange - date count of this view. * @property {number} dragStartXIndex - index number of dragstart grid index. * @property {number} xIndex - index number of mouse positions. */ this.fire(overrideEventName || 'dragend', scheduleData); this.getScheduleDataFunc = this._dragStart = null; }; /** * Click event handler method. * @emits DayGridMove#click * @param {object} clickEventData - Drag#Click event handler data. */ DayGridMove.prototype._onClick = function(clickEventData) { /** * @event DayGridMove#click * @type {object} * @property {DayGrid} relatedView - view instance. * @property {number} datesInRange - date count of this view. * @property {number} dragStartXIndex - index number of dragstart grid index. * @property {number} xIndex - index number of mouse positions. */ this._onDragEnd(clickEventData, 'click', true); }; common.mixin(dayGridCore, DayGridMove); util.CustomEvents.mixin(DayGridMove); module.exports = DayGridMove; /***/ }), /***/ "./src/js/handler/daygrid/moveGuide.js": /*!*********************************************!*\ !*** ./src/js/handler/daygrid/moveGuide.js ***! \*********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/** * @fileoverview Effect module for DayGrid.Move * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var reqAnimFrame = __webpack_require__(/*! ../../common/reqAnimFrame */ "./src/js/common/reqAnimFrame.js"); /** * Class for DayGrid.Move dragging effect. * @constructor * @param {DayGridMove} daygridMove - instance of DayGridMove. */ function DayGridMoveGuide(daygridMove) { /** * @type {DayGridMove} */ this.daygridMove = daygridMove; /** * The element that actually contains the event element * @type {HTMLDIVElement} */ this.scheduleContainer = null; /** * @type {number} */ this._dragStartXIndex = null; /** * @type {HTMLDIVElement} */ this.guideElement = null; /** * @type {HTMLElement[]} */ this.elements = null; daygridMove.on({ 'dragstart': this._onDragStart, 'drag': this._onDrag, 'dragend': this._clearGuideElement, 'click': this._clearGuideElement }, this); } /** * Destroy method */ DayGridMoveGuide.prototype.destroy = function() { this._clearGuideElement(); this.daygridMove.off(this); this.daygridMove = this.scheduleContainer = this._dragStartXIndex = this.elements = this.guideElement = null; }; /** * Clear guide element. */ DayGridMoveGuide.prototype._clearGuideElement = function() { this._showOriginScheduleBlocks(); domutil.remove(this.guideElement); if (!util.browser.msie) { domutil.removeClass(global.document.body, config.classname('dragging')); } this._dragStartXIndex = this.getScheduleDataFunc = this.guideElement = null; }; /** * Dim element blocks * @param {number} modelID - Schedule model instance ID */ DayGridMoveGuide.prototype._hideOriginScheduleBlocks = function(modelID) { var className = config.classname('weekday-schedule-block-dragging-dim'); var scheduleBlocks = domutil.find( config.classname('.weekday-schedule-block'), this.daygridMove.view.container, true ); this.elements = util.filter(scheduleBlocks, function(schedule) { return domutil.getData(schedule, 'id') === modelID; }); util.forEach(this.elements, function(el) { domutil.addClass(el, className); }); }; /** * Show element blocks */ DayGridMoveGuide.prototype._showOriginScheduleBlocks = function() { var className = config.classname('weekday-schedule-block-dragging-dim'); util.forEach(this.elements, function(el) { domutil.removeClass(el, className); }); }; /** * Highlight element blocks * @param {Schedule} model - model * @param {HTMLElement} parent - parent element */ DayGridMoveGuide.prototype._highlightScheduleBlocks = function(model, parent) { var elements = domutil.find(config.classname('.weekday-schedule'), parent, true); util.forEach(elements, function(el) { el.style.margin = '0'; if (!model.isFocused) { el.style.backgroundColor = model.dragBgColor; el.style.borderLeftColor = model.borderColor; el.style.color = '#ffffff'; } }); }; /** * Refresh guide element. * @param {number} leftPercent - left percent of guide element. * @param {number} widthPercent - width percent of guide element. * @param {boolean} isExceededLeft - schedule start is faster then render start date? * @param {boolean} isExceededRight - schedule end is later then render end date? */ DayGridMoveGuide.prototype.refreshGuideElement = function(leftPercent, widthPercent, isExceededLeft, isExceededRight) { var guideElement = this.guideElement; reqAnimFrame.requestAnimFrame(function() { guideElement.style.left = leftPercent + '%'; guideElement.style.width = widthPercent + '%'; if (isExceededLeft) { domutil.addClass(guideElement, config.classname('weekday-exceed-left')); } else { domutil.removeClass(guideElement, config.classname('weekday-exceed-left')); } if (isExceededRight) { domutil.addClass(guideElement, config.classname('weekday-exceed-right')); } else { domutil.removeClass(guideElement, config.classname('weekday-exceed-right')); } }); }; /** * Get schedule block information from schedule data. * * For example, there is single schedule has 10 length. but render range in view is 5 then * rendered block must be cut out to render properly. in this case, this method return * how many block are cut before rendering. * * @param {object} dragStartEventData - schedule data from DayGrid.Move handler. * @returns {function} function that return schedule block information. */ DayGridMoveGuide.prototype._getScheduleBlockDataFunc = function(dragStartEventData) { var model = dragStartEventData.model, datesInRange = dragStartEventData.datesInRange, range = dragStartEventData.range, baseWidthPercent = (100 / datesInRange), originScheduleStarts = datetime.start(model.start), originScheduleEnds = datetime.end(model.end), renderStartDate = datetime.start(range[0]), renderEndDate = datetime.end(range[range.length - 1]), fromLeft = Math.ceil((originScheduleStarts.getTime() - renderStartDate.getTime()) / datetime.MILLISECONDS_PER_DAY) || 0, fromRight = Math.ceil((originScheduleEnds.getTime() - renderEndDate.getTime()) / datetime.MILLISECONDS_PER_DAY) || 0; return function(indexOffset) { return { baseWidthPercent: baseWidthPercent, fromLeft: fromLeft + indexOffset, fromRight: fromRight + indexOffset }; }; }; /** * DragStart event handler. * @param {object} dragStartEventData - schedule data. */ DayGridMoveGuide.prototype._onDragStart = function(dragStartEventData) { var container = this.daygridMove.view.container, guideElement = this.guideElement = dragStartEventData.scheduleBlockElement.cloneNode(true), scheduleContainer; if (!util.browser.msie) { domutil.addClass(global.document.body, config.classname('dragging')); } this._hideOriginScheduleBlocks(String(dragStartEventData.model.cid())); scheduleContainer = domutil.find(config.classname('.weekday-schedules'), container); domutil.appendHTMLElement('div', guideElement, config.classname('weekday-schedule-cover')); scheduleContainer.appendChild(guideElement); this._dragStartXIndex = dragStartEventData.xIndex; this.getScheduleDataFunc = this._getScheduleBlockDataFunc(dragStartEventData); this._highlightScheduleBlocks(dragStartEventData.model, guideElement); }; /** * Drag event handler. * @param {object} dragEventData - schedule data. */ DayGridMoveGuide.prototype._onDrag = function(dragEventData) { var getScheduleDataFunc = this.getScheduleDataFunc, dragStartXIndex = this._dragStartXIndex, datesInRange = dragEventData.datesInRange, grids = dragEventData.grids, scheduleData, isExceededLeft, isExceededRight, originLength, leftIndex, size, newLeft, newWidth; if (!getScheduleDataFunc) { return; } scheduleData = getScheduleDataFunc(dragEventData.xIndex - dragStartXIndex); isExceededLeft = scheduleData.fromLeft < 0; isExceededRight = scheduleData.fromRight > 0; leftIndex = Math.max(0, scheduleData.fromLeft); originLength = (scheduleData.fromLeft * -1) + (datesInRange + scheduleData.fromRight); size = isExceededLeft ? (originLength + scheduleData.fromLeft) : originLength; size = isExceededRight ? (size - scheduleData.fromRight) : size; newLeft = grids[leftIndex] ? grids[leftIndex].left : 0; newWidth = getScheduleBlockWidth(leftIndex, size, grids); this.refreshGuideElement(newLeft, newWidth, isExceededLeft, isExceededRight); }; /** * Get schedule width based on grids * @param {number} left - left index * @param {number} size - schedule width * @param {Array} grids - dates information * @returns {number} element width */ function getScheduleBlockWidth(left, size, grids) { var width = 0; var i = 0; var length = grids.length; for (; i < size; i += 1) { left = (left + i) % length; if (left < length) { width += grids[left] ? grids[left].width : 0; } } return width; } module.exports = DayGridMoveGuide; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./src/js/handler/daygrid/resize.js": /*!******************************************!*\ !*** ./src/js/handler/daygrid/resize.js ***! \******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Resize handler module for DayGrid view. * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"); var dayGridCore = __webpack_require__(/*! ./core */ "./src/js/handler/daygrid/core.js"); var DayGridResizeGuide = __webpack_require__(/*! ./resizeGuide */ "./src/js/handler/daygrid/resizeGuide.js"); var TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date; /** * @constructor * @implements {Handler} * @mixes dayGridCore * @mixes CustomEvents * @param {Drag} [dragHandler] - Drag handler instance. * @param {DayGrid} [view] - view instance. * @param {Base} [controller] - Base controller instance. */ function DayGridResize(dragHandler, view, controller) { /** * Drag handler instance. * @type {Drag} */ this.dragHandler = dragHandler; /** * view instance. * @type {DayGrid} */ this.view = view; /** * Base controller instance. * @type {Base} */ this.controller = controller; /** * Temporary variable for dragStart event data. * @type {object} */ this._dragStart = null; dragHandler.on({ dragStart: this._onDragStart }, this); /** * @type {DayGridResizeGuide} */ this.guide = new DayGridResizeGuide(this); } /** * Destroy method */ DayGridResize.prototype.destroy = function() { this.guide.destroy(); this.dragHandler.off(this); this.dragHandler = this.view = this.controller = this.guide = this._dragStart = null; }; /** * Check dragstart target is expected conditions for this handler. * @param {HTMLElement} target - dragstart event handler's target element. * @returns {boolean|WeekdayInWeek} return WeekdayInWeek view instance when satiate condition. */ DayGridResize.prototype.checkExpectedCondition = function(target) { var cssClass = domutil.getClass(target), matches; if (!~cssClass.indexOf(config.classname('weekday-resize-handle'))) { return false; } target = domutil.closest(target, config.classname('.weekday')); if (!target) { return false; } cssClass = domutil.getClass(target); matches = cssClass.match(config.daygrid.getViewIDRegExp); if (!matches || matches.length < 2) { return false; } return util.pick(this.view.children.items, matches[1]); }; /** * DragStart event handler. * @emits DayGridResize#dragstart * @param {object} dragStartEventData - schedule data. */ DayGridResize.prototype._onDragStart = function(dragStartEventData) { var target = dragStartEventData.target, result = this.checkExpectedCondition(target), controller = this.controller, scheduleBlockElement, modelID, targetModel, getScheduleDataFunc, scheduleData; if (!result) { return; } scheduleBlockElement = domutil.closest(target, config.classname('.weekday-schedule-block')); modelID = domutil.getData(scheduleBlockElement, 'id'); targetModel = controller.schedules.items[modelID]; if (!targetModel) { return; } getScheduleDataFunc = this._retriveScheduleData(this.view, dragStartEventData.originEvent); this.getScheduleDataFunc = getScheduleDataFunc; scheduleData = this._dragStart = getScheduleDataFunc(dragStartEventData.originEvent); util.extend(scheduleData, { scheduleBlockElement: scheduleBlockElement, model: targetModel }); this.dragHandler.on({ drag: this._onDrag, dragEnd: this._onDragEnd, click: this._onClick }, this); /** * @event DayGridResize#dragstart * @type {object} * @property {View} relatedView - view instance. * @property {number} datesInRange - date count of this view. * @property {number} dragStartXIndex - index number of dragstart grid index. * @property {number} xIndex - index number of mouse positions. * @property {Schedule} model - data object of model isntance. * @property {HTMLDivElement} scheduleBlockElement - target schedule block element. */ this.fire('dragstart', scheduleData); }; /** * Drag event handler method. * @emits DayGridResize#drag * @param {object} dragEventData - Drag#drag event handler scheduledata. */ DayGridResize.prototype._onDrag = function(dragEventData) { var getScheduleDataFunc = this.getScheduleDataFunc; if (!getScheduleDataFunc) { return; } /** * @event DayGridResize#drag * @type {object} * @property {View} relatedView - view instance. * @property {number} datesInRange - date count of this view. * @property {number} dragStartXIndex - index number of dragstart grid index. * @property {number} xIndex - index number of mouse positions. */ this.fire('drag', getScheduleDataFunc(dragEventData.originEvent)); }; /** * Request update schedule instance to base controller. * @fires DayGridResize#beforeUpdateSchedule * @param {object} scheduleData - schedule data from DayGridResize handler. */ DayGridResize.prototype._updateSchedule = function(scheduleData) { var schedule = scheduleData.targetModel, dateOffset = scheduleData.xIndex - scheduleData.dragStartXIndex, newEnds = new TZDate(schedule.end); var changes; newEnds = newEnds.addDate(dateOffset); newEnds = new TZDate(common.maxDate(datetime.end(schedule.start), newEnds)); changes = common.getScheduleChanges( schedule, ['end'], {end: newEnds} ); /** * @event DayGridResize#beforeUpdateSchedule * @type {object} * @property {Schedule} schedule - The original schedule instance * @property {Date} start - Deprecated: start time to update * @property {Date} end - Deprecated: end time to update * @property {object} changes - end time to update * @property {date} end - end time to update */ this.fire('beforeUpdateSchedule', { schedule: schedule, changes: changes, start: schedule.getStarts(), end: newEnds }); }; /** * DragEnd event hander method. * @emits DayGridResize#dragend * @param {object} dragEndEventData - Drag#DragEnd event handler data. * @param {string} [overrideEventName] - override emitted event name when supplied. * @param {?boolean} skipUpdate - true then skip update schedule model. */ DayGridResize.prototype._onDragEnd = function(dragEndEventData, overrideEventName, skipUpdate) { var getScheduleDataFunc = this.getScheduleDataFunc, dragStart = this._dragStart, scheduleData; if (!getScheduleDataFunc || !dragStart) { return; } this.dragHandler.off({ drag: this._onDrag, dragEnd: this._onDragEnd, click: this._onClick }, this); scheduleData = getScheduleDataFunc(dragEndEventData.originEvent); util.extend(scheduleData, { targetModel: dragStart.model }); if (!skipUpdate) { this._updateSchedule(scheduleData); } /** * @event DayGridResize#dragend * @type {object} * @property {View} relatedView - view instance. * @property {number} datesInRange - date count of this view. * @property {number} dragStartXIndex - index number of dragstart grid index. * @property {number} xIndex - index number of mouse positions. */ this.fire(overrideEventName || 'dragend', scheduleData); this.getScheduleDataFunc = this._dragStart = null; }; /** * Click event handler method. * @emits DayGridResize#click * @param {object} clickEventData - Drag#Click event handler data. */ DayGridResize.prototype._onClick = function(clickEventData) { /** * @event DayGridResize#click * @type {object} * @property {View} relatedView - view instance. * @property {number} datesInRange - date count of this view. * @property {number} dragStartXIndex - index number of dragstart grid index. * @property {number} xIndex - index number of mouse positions. */ this._onDragEnd(clickEventData, 'click', true); }; common.mixin(dayGridCore, DayGridResize); util.CustomEvents.mixin(DayGridResize); module.exports = DayGridResize; /***/ }), /***/ "./src/js/handler/daygrid/resizeGuide.js": /*!***********************************************!*\ !*** ./src/js/handler/daygrid/resizeGuide.js ***! \***********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/** * @fileoverview Resize Guide module. * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var reqAnimFrame = __webpack_require__(/*! ../../common/reqAnimFrame */ "./src/js/common/reqAnimFrame.js"); /** * @constructor * @param {DayGridResize} resizeHandler - instance of DayGridResize */ function DayGridResizeGuide(resizeHandler) { /** * @type {DayGridResize} */ this.resizeHandler = resizeHandler; /** * The element that actually contains the event element * @type {HTMLDIVElement} */ this.scheduleContainer = null; /** * @type {function} */ this.getScheduleDataFunc = null; /** * @type {HTMLDIVElement} */ this.guideElement = null; /** * @type {HTMLDIVElement} */ this.scheduleBlockElement = null; resizeHandler.on({ 'dragstart': this._onDragStart, 'drag': this._onDrag, 'dragend': this._clearGuideElement, 'click': this._clearGuideElement }, this); } /** * Destroy method */ DayGridResizeGuide.prototype.destroy = function() { this._clearGuideElement(); this.resizeHandler.off(this); this.resizeHandler = this.scheduleContainer = this.getScheduleDataFunc = this.guideElement = this.scheduleBlockElement = null; }; /** * Clear guide element. */ DayGridResizeGuide.prototype._clearGuideElement = function() { domutil.remove(this.guideElement); if (!util.browser.msie) { domutil.removeClass(global.document.body, config.classname('resizing-x')); } if (this.scheduleBlockElement) { domutil.removeClass(this.scheduleBlockElement, config.classname('weekday-schedule-block-dragging-dim')); } this.getScheduleDataFunc = null; }; /** * Refresh guide element * @param {number} newWidth - new width percentage value to resize guide element. */ DayGridResizeGuide.prototype.refreshGuideElement = function(newWidth) { var guideElement = this.guideElement; reqAnimFrame.requestAnimFrame(function() { guideElement.style.width = newWidth + '%'; }); }; /** * Return function that calculate guide element's new width percentage value. * @param {object} dragStartEventData - dragstart schedule data. * @returns {function} return function that calculate guide element new width percentage. */ DayGridResizeGuide.prototype.getGuideElementWidthFunc = function(dragStartEventData) { var model = dragStartEventData.model, viewOptions = this.resizeHandler.view.options, fromLeft = Math.ceil( (model.start - viewOptions.renderStartDate) / datetime.MILLISECONDS_PER_DAY ) || 0, grids = dragStartEventData.grids; return function(xIndex) { var width = 0; var i = 0; var length = grids.length; width += grids[fromLeft] ? grids[fromLeft].width : 0; for (; i < length; i += 1) { if (i > fromLeft && i <= xIndex) { width += grids[i] ? grids[i].width : 0; } } return width; }; }; /** * DragStart event handler. * @param {object} dragStartEventData - schedule data. */ DayGridResizeGuide.prototype._onDragStart = function(dragStartEventData) { var container = this.resizeHandler.view.container, scheduleBlockElement = this.scheduleBlockElement = dragStartEventData.scheduleBlockElement, guideElement = this.guideElement = scheduleBlockElement.cloneNode(true), scheduleContainer; if (!util.browser.msie) { domutil.addClass(global.document.body, config.classname('resizing-x')); } scheduleContainer = domutil.find(config.classname('.weekday-schedules'), container); domutil.addClass(guideElement, config.classname('daygrid-guide-move')); domutil.addClass(scheduleBlockElement, config.classname('weekday-schedule-block-dragging-dim')); scheduleContainer.appendChild(guideElement); this.getScheduleDataFunc = this.getGuideElementWidthFunc(dragStartEventData); }; /** * Drag event handler. * @param {object} dragEventData - schedule data. */ DayGridResizeGuide.prototype._onDrag = function(dragEventData) { var func = this.getScheduleDataFunc; if (!func) { return; } this.refreshGuideElement(func(dragEventData.xIndex)); }; module.exports = DayGridResizeGuide; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./src/js/handler/drag.js": /*!********************************!*\ !*** ./src/js/handler/drag.js ***! \********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/** * @fileoverview Drag handler for calendar. * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var domutil = __webpack_require__(/*! ../common/domutil */ "./src/js/common/domutil.js"); var domevent = __webpack_require__(/*! ../common/domevent */ "./src/js/common/domevent.js"); var config = __webpack_require__(/*! ../config */ "./src/js/config.js"); /** * @constructor * @mixes CustomEvents * @param {object} options - options for drag handler * @param {number} [options.distance=10] - distance in pixels after mouse must move before dragging should start * @param {function} [options.exclude] - filter function for don't fire drag events that specific conditions. * @param {HTMLElement} container element to watching drag interaction. */ function Drag(options, container) { domevent.on(container, 'mousedown', this._onMouseDown, this); this.options = util.extend({ distance: 10, exclude: null }, options); /** * @type {HTMLElement} */ this.container = container; /** * Flag for represent current dragging session has been cancelled for exclude option. * @type {boolean} */ this._cancelled = false; /** * @type {boolean} */ this._isMoved = false; /** * dragging distance in pixel between mousedown and firing dragStart events * @type {number} */ this._distance = 0; /** * @type {boolean} */ this._dragStartFired = false; /** * @type {object} */ this._dragStartEventData = null; } /** * Destroy method. */ Drag.prototype.destroy = function() { domevent.off(this.container, 'mousedown', this._onMouseDown, this); this._isMoved = null; this.container = null; }; /** * Clear cache data for single dragging session. */ Drag.prototype._clearData = function() { this._cancelled = false; this._distance = 0; this._isMoved = false; this._dragStartFired = false; this._dragStartEventData = null; }; /** * Toggle events for mouse dragging. * @param {boolean} toBind - bind events related with dragging when supplied "true" */ Drag.prototype._toggleDragEvent = function(toBind) { var container = this.container, domMethod, method; if (toBind) { domMethod = 'on'; method = 'disable'; } else { domMethod = 'off'; method = 'enable'; } domutil[method + 'TextSelection'](container, preventDefaultWhenNotPopup); domutil[method + 'ImageDrag'](container, preventDefaultWhenNotPopup); domevent[domMethod](global.document, { mousemove: this._onMouseMove, mouseup: this._onMouseUp }, this); }; /** * Normalize mouse event object. * @param {MouseEvent} mouseEvent - mouse event object. * @returns {object} normalized mouse event data. */ Drag.prototype._getEventData = function(mouseEvent) { return { target: domevent.getEventTarget(mouseEvent), originEvent: mouseEvent }; }; /** * MouseDown DOM event handler. * @param {MouseEvent} mouseDownEvent MouseDown event object. */ Drag.prototype._onMouseDown = function(mouseDownEvent) { var opt = this.options, target = domevent.getEventTarget(mouseDownEvent); // only primary button can start drag. if (domevent.getMouseButton(mouseDownEvent) !== 0) { return; } if (opt.exclude && opt.exclude(target)) { this._cancelled = true; return; } this._clearData(); this._dragStartEventData = this._getEventData(mouseDownEvent); this._toggleDragEvent(true); /** * mousedown event for firefox bug. cancelable. * @event Drag#mouseDown * @type {object} * @property {HTMLElement} target - target element in this event. * @property {MouseEvent} originEvent - original mouse event object. */ this.fire('mousedown', this._dragStartEventData); }; /** * MouseMove DOM event handler. * @emits Drag#drag * @emits Drag#dragStart * @param {MouseEvent} mouseMoveEvent MouseMove event object. */ Drag.prototype._onMouseMove = function(mouseMoveEvent) { var distance; if (this._cancelled) { this._clearData(); return; } distance = this.options.distance; // prevent automatic scrolling. preventDefaultWhenNotPopup(mouseMoveEvent); if (this._distance < distance) { this._distance += 1; return; } this._isMoved = true; if (!this._dragStartFired) { this._dragStartFired = true; /** * Drag start events. cancelable. * @event Drag#dragStart * @type {object} * @property {HTMLElement} target - target element in this event. * @property {MouseEvent} originEvent - original mouse event object. */ if (!this.invoke('dragStart', this._dragStartEventData)) { this._toggleDragEvent(false); this._clearData(); return; } } /** * CalEvents while dragging. * @event Drag#drag * @type {object} * @property {HTMLElement} target - target element in this event. * @property {MouseEvent} originEvent - original mouse event object. */ this.fire('drag', this._getEventData(mouseMoveEvent)); }; /** * MouseUp DOM event handler. * @param {MouseEvent} mouseUpEvent MouseUp event object. * @emits Drag#dragEnd * @emits Drag#click */ Drag.prototype._onMouseUp = function(mouseUpEvent) { if (this._cancelled) { return; } this._toggleDragEvent(false); // emit "click" event when not emitted drag event between mousedown and mouseup. if (this._isMoved) { this._isMoved = false; /** * Drag end events. * @event Drag#dragEnd * @type {MouseEvent} * @property {HTMLElement} target - target element in this event. * @property {MouseEvent} originEvent - original mouse event object. */ this.fire('dragEnd', this._getEventData(mouseUpEvent)); } else { /** * Click events. * @event Drag#click * @type {MouseEvent} * @property {HTMLElement} target - target element in this event. * @property {MouseEvent} originEvent - original mouse event object. */ this.fire('click', this._getEventData(mouseUpEvent)); } this._clearData(); }; /** * If the target is not a popup, it prevents the default. * @method * @param {MouseEvent} event - Mouse event object */ function preventDefaultWhenNotPopup(event) { var popup = domutil.closest(event.target, config.classname('.popup')); if (!popup) { domevent.preventDefault(event); } } util.CustomEvents.mixin(Drag); module.exports = Drag; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./src/js/handler/month/click.js": /*!***************************************!*\ !*** ./src/js/handler/month/click.js ***! \***************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Click handler for month view * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"), datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"), domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); /** * @constructor * @implements {Handler} * @mixes util.CustomEvents * @param {Drag} [dragHandler] - Drag handler instance. * @param {Month} [monthView] - Month view instance. * @param {Base} [baseController] - Base controller instance. */ function MonthClick(dragHandler, monthView, baseController) { /** * @type {Drag} */ this.dragHandler = dragHandler; /** * @type {Month} */ this.monthView = monthView; /** * @type {Base} */ this.baseController = baseController; dragHandler.on({ 'click': this._onClick }, this); } /** * Destructor */ MonthClick.prototype.destroy = function() { this.dragHandler.off(this); this.monthView = this.baseController = this.dragHandler = null; }; /** * @fires MonthClick#clickMore * @param {object} clickEvent - click event object */ MonthClick.prototype._onClick = function(clickEvent) { var self = this, moreElement, scheduleCollection = this.baseController.schedules, blockElement = domutil.closest(clickEvent.target, config.classname('.weekday-schedule-block')) || domutil.closest(clickEvent.target, config.classname('.month-more-schedule')); moreElement = domutil.closest( clickEvent.target, config.classname('.weekday-exceed-in-month') ); if (moreElement) { self.fire('clickMore', { date: datetime.parse(domutil.getData(moreElement, 'ymd')), target: moreElement, ymd: domutil.getData(moreElement, 'ymd') }); } if (blockElement) { scheduleCollection.doWhenHas(domutil.getData(blockElement, 'id'), function(schedule) { /** * @events AlldayClick#clickSchedule * @type {object} * @property {Schedule} schedule - schedule instance * @property {MouseEvent} event - MouseEvent object */ self.fire('clickSchedule', { schedule: schedule, event: clickEvent.originEvent }); }); } }; util.CustomEvents.mixin(MonthClick); module.exports = MonthClick; /***/ }), /***/ "./src/js/handler/month/core.js": /*!**************************************!*\ !*** ./src/js/handler/month/core.js ***! \**************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable complexity */ /** * @fileoverview Module for calculate date by month view and mouse event object * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"), domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"), domevent = __webpack_require__(/*! ../../common/domevent */ "./src/js/common/domevent.js"), datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var mfloor = Math.floor; /** * Get high order function that can calc date in mouse point * @param {Month} monthView - month view * @returns {function} function return event data by mouse event object */ function getMousePosDate(monthView) { var weekColl = monthView.children, weeks = weekColl.sort(function(a, b) { return util.stamp(a) - util.stamp(b); }), weekCount = weekColl.length, days = weekColl.single().getRenderDateRange(), dayCount = days.length, relativeContainer = util.pick(monthView.vLayout.panels[1], 'container'), size = domutil.getSize(relativeContainer), grids = monthView.grids; /** * Get the left index * @param {number} left - left position(percent) * @returns {number} grid left index */ function getX(left) { var i = 0; var length = grids.length; var grid; for (; i < length; i += 1) { grid = grids[i]; if (grid.left <= left && left <= (grid.left + grid.width)) { return i; } } return left < 0 ? -1 : i; } /** * Get date related with mouse event object * @param {object} mouseEvent - click event data * @returns {object} data related with mouse event */ function getDate(mouseEvent) { var pos = domevent.getMousePosition(mouseEvent, relativeContainer), x = getX(common.ratio(size[0], 100, pos[0])), y = mfloor(common.ratio(size[1], weekCount, pos[1])), weekdayView, date, dateRange; if (y < 0) { y = 0; } if (y >= weeks.length) { y = weeks.length - 1; } weekdayView = util.pick(weeks, y); if (!weekdayView) { return null; } dateRange = weekdayView.getRenderDateRange(); if (x < 0) { x = 0; } if (x >= dateRange.length) { x = dateRange.length - 1; } date = util.pick(dateRange, x); if (!date) { return null; } return { x: x, y: y, sizeX: dayCount, sizeY: weekCount, date: datetime.end(date), weekdayView: weekdayView, triggerEvent: mouseEvent.type }; } return getDate; } module.exports = getMousePosDate; /***/ }), /***/ "./src/js/handler/month/creation.js": /*!******************************************!*\ !*** ./src/js/handler/month/creation.js ***! \******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Creation handler for month view * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var array = __webpack_require__(/*! ../../common/array */ "./src/js/common/array.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var domevent = __webpack_require__(/*! ../../common/domevent */ "./src/js/common/domevent.js"); var getMousePosDate = __webpack_require__(/*! ./core */ "./src/js/handler/month/core.js"); var Guide = __webpack_require__(/*! ./creationGuide */ "./src/js/handler/month/creationGuide.js"); var TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date; var CLICK_DELAY = 300; /** * @constructor * @param {Drag} dragHandler - Drag handler instance. * @param {Month} monthView - Month view instance. * @param {Base} baseController - Base controller instance. * @param {Options} [options] - calendar Options */ function MonthCreation(dragHandler, monthView, baseController, options) { /** * @type {Drag} */ this.dragHandler = dragHandler; /** * @type {Month} */ this.monthView = monthView; /** * @type {Base} */ this.baseController = baseController; /** * @type {function} */ this.getScheduleData = null; /** * Cache for dragging session * @type {object} */ this._cache = null; /** * @type {MonthCreationGuide} */ this.guide = new Guide(this); /** * @type {boolean} */ this._requestOnClick = false; /** * @type {boolean} */ this._disableDblClick = options.disableDblClick; /** * @type {boolean} */ this._disableClick = options.disableClick; dragHandler.on('dragStart', this._onDragStart, this); dragHandler.on('click', this._onClick, this); if (this._disableDblClick) { CLICK_DELAY = 0; } else { domevent.on(monthView.container, 'dblclick', this._onDblClick, this); } } /** * Destructor */ MonthCreation.prototype.destroy = function() { this.dragHandler.off(this); this.guide.destroy(); if (this.monthView && this.monthView.container) { domevent.off(this.monthView.container, 'dblclick', this._onDblClick, this); } this.dragHandler = this.monthView = this.baseController = this.getScheduleData = this._cache = this.guide = null; }; /** * Fire before create schedule * @fires {MonthCreation#beforeCreateSchedule} * @param {object} eventData - cache data from single dragging session */ MonthCreation.prototype._createSchedule = function(eventData) { /** * @event {MonthCreation#beforeCreateSchedule} * @type {object} * @property {boolean} isAllDay - whether schedule is fired in allday view area? * @property {Date} start - select start time * @property {Date} end - select end time * @property {TimeCreationGuide} guide - TimeCreationGuide instance * @property {string} triggerEventName - event name */ this.fire('beforeCreateSchedule', { isAllDay: eventData.isAllDay, start: eventData.start, end: eventData.end, guide: this.guide.guide, triggerEventName: eventData.triggerEvent }); }; /** * DragStart event handler * @fires {MonthCreation#monthCreationDragstart} * @param {object} dragStartEvent - dragStart event data */ MonthCreation.prototype._onDragStart = function(dragStartEvent) { var eventData; if (!isElementWeekdayGrid(dragStartEvent.target)) { return; } this.dragHandler.on({ drag: this._onDrag, dragEnd: this._onDragEnd }, this); this.getScheduleData = getMousePosDate(this.monthView); eventData = this.getScheduleData(dragStartEvent.originEvent); this._cache = { start: new TZDate(eventData.date) }; /** * @event {MonthCreation#monthCreationDragstart} * @type {object} * @property {number} x - x index * @property {number} y - y index * @property {Date} date - drag date */ this.fire('monthCreationDragstart', eventData); }; /** * Drag event handler * @fires {MonthCreation#monthCreationDrag} * @param {object} dragEvent - drag event data */ MonthCreation.prototype._onDrag = function(dragEvent) { var eventData; if (!this.getScheduleData) { return; } eventData = this.getScheduleData(dragEvent.originEvent); if (!eventData) { return; } /** * @event {MonthCreation#monthCreationDrag} * @type {object} * @property {number} x - x index * @property {number} y - y index * @property {Date} date - drag date */ this.fire('monthCreationDrag', eventData); }; /** * DragEnd event handler * @fires {MonthCreation#monthCreationDragend} * @param {object} dragEndEvent - drag end event data */ MonthCreation.prototype._onDragEnd = function(dragEndEvent) { var cache = this._cache; var eventData; var times; this.dragHandler.off({ drag: this._onDrag, dragEnd: this._onDragEnd }, this); if (!this.getScheduleData) { return; } eventData = this.getScheduleData(dragEndEvent.originEvent); if (eventData) { cache.end = new TZDate(eventData.date); cache.isAllDay = true; times = [ cache.start, cache.end ].sort(array.compare.num.asc); cache.start = new TZDate(times[0]); cache.end = datetime.end(times[1]); this._createSchedule(cache); } /** * @event {MonthCreation#monthCreationDragend} * @type {object} * @property {number} x - x index * @property {number} y - y index * @property {Date} date - drag date */ this.fire('monthCreationDragend', eventData); this.getScheduleData = this._cache = null; }; /** * Dblclick event handler * @fires {MonthCreation#monthCreationDragstart} * @param {MouseEvent} e - Native MouseEvent */ MonthCreation.prototype._onDblClick = function(e) { var eventData, range; if (!isElementWeekdayGrid(e.target)) { return; } eventData = getMousePosDate(this.monthView)(e); this.fire('monthCreationClick', eventData); range = this._adjustStartAndEndTime(new TZDate(eventData.date), new TZDate(eventData.date)); this._createSchedule({ start: range.start, end: range.end, isAllDay: false, triggerEvent: eventData.triggerEvent }); this._requestOnClick = false; }; /** * Click event handler * @fires {MonthCreation#monthCreationDragstart} * @param {MouseEvent} e - Native MouseEvent */ MonthCreation.prototype._onClick = function(e) { var self = this; var eventData, range; if (!isElementWeekdayGrid(e.target) || this._disableClick) { return; } eventData = getMousePosDate(this.monthView)(e.originEvent); this._requestOnClick = true; setTimeout(function() { if (self._requestOnClick) { self.fire('monthCreationClick', eventData); range = self._adjustStartAndEndTime(new TZDate(eventData.date), new TZDate(eventData.date)); self._createSchedule({ start: range.start, end: range.end, isAllDay: false, triggerEvent: eventData.triggerEvent }); } self._requestOnClick = false; }, CLICK_DELAY); }; /** * Adjust time to our o'clock * @param {TZDate} start - start time * @param {TZDate} end - end time * @returns {Object} start and end */ MonthCreation.prototype._adjustStartAndEndTime = function(start, end) { var now = new TZDate(); var hours = now.getHours(); var minutes = now.getMinutes(); // adjust start to less time. Adjusting had been greater time in monthly view when clicking grid if (minutes <= 30) { minutes = 0; } else { minutes = 30; } start.setHours(hours, minutes, 0, 0); end.setHours(hours + 1, minutes, 0, 0); return { start: start, end: end }; }; /** * Invoke creation click * @param {Schedule} schedule - schedule instance */ MonthCreation.prototype.invokeCreationClick = function(schedule) { var eventData = { model: schedule }; this.fire('monthCreationClick', eventData); this._createSchedule({ start: schedule.start, end: schedule.end, isAllDay: schedule.isAllDay, triggerEvent: 'manual' }); }; /** * Returns whether the given element is Weekday-Schedule. * @param {HTMLElement} el - target element * @returns {boolean} */ function isElementWeekdayGrid(el) { return domutil.closest(el, config.classname('.weekday-grid')) && !domutil.closest(el, config.classname('.weekday-exceed-in-month')); } util.CustomEvents.mixin(MonthCreation); module.exports = MonthCreation; /***/ }), /***/ "./src/js/handler/month/creationGuide.js": /*!***********************************************!*\ !*** ./src/js/handler/month/creationGuide.js ***! \***********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Creation guide module for month view * @author NHN FE Development Lab */ var MonthGuide = __webpack_require__(/*! ./guide */ "./src/js/handler/month/guide.js"); /** * @constructor * @param {MonthCreation} monthCreation - instance of MonthCreation */ function MonthCreationGuide(monthCreation) { /** * @type {MonthCreation} */ this.monthCreation = monthCreation; /** * @type {MonthGuide} */ this.guide = null; monthCreation.on({ monthCreationDragstart: this._createGuideElement, monthCreationDrag: this._onDrag, monthCreationDragend: this._onDragEnd, monthCreationClick: this._createGuideElement }, this); } /** * Destructor */ MonthCreationGuide.prototype.destroy = function() { this.monthCreation.off(this); if (this.guide) { this.guide.destroy(); } this.guide = this.monthCreation = null; }; /** * Drag start event handler * @param {object} dragStartEvent - schedule data from MonthCreation */ MonthCreationGuide.prototype._createGuideElement = function(dragStartEvent) { var options = { isCreationMode: true, height: '100%', top: 0 }; this.guide = new MonthGuide(options, this.monthCreation.monthView); this.guide.start(dragStartEvent); }; /** * Drag event handler * @param {object} dragEvent - schedule data from MonthCreation */ MonthCreationGuide.prototype._onDrag = function(dragEvent) { this.guide.update(dragEvent.x, dragEvent.y); }; /** * Drag end event handler */ MonthCreationGuide.prototype._onDragEnd = function() { // Do nothing. User calls destroy directly. this.guide = null; }; module.exports = MonthCreationGuide; /***/ }), /***/ "./src/js/handler/month/guide.hbs": /*!****************************************!*\ !*** ./src/js/handler/month/guide.hbs ***! \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=container.escapeExpression, alias2=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n"; },"3":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n
\n" + ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"isAllDay") : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.program(6, data, 0),"data":data,"loc":{"start":{"line":9,"column":12},"end":{"line":13,"column":19}}})) != null ? stack1 : "") + "
\n
 
\n
\n"; },"4":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + ((stack1 = (lookupProperty(helpers,"allday-tmpl")||(depth0 && lookupProperty(depth0,"allday-tmpl"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),depth0,{"name":"allday-tmpl","hash":{},"data":data,"loc":{"start":{"line":10,"column":16},"end":{"line":10,"column":38}}})) != null ? stack1 : "") + "\n"; },"6":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + ((stack1 = (lookupProperty(helpers,"time-tmpl")||(depth0 && lookupProperty(depth0,"time-tmpl"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),depth0,{"name":"time-tmpl","hash":{},"data":data,"loc":{"start":{"line":12,"column":16},"end":{"line":12,"column":36}}})) != null ? stack1 : "") + "\n"; },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n" + ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"isCreationMode") : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(3, data, 0),"data":data,"loc":{"start":{"line":2,"column":4},"end":{"line":17,"column":11}}})) != null ? stack1 : "") + "
\n"; },"useData":true}); /***/ }), /***/ "./src/js/handler/month/guide.js": /*!***************************************!*\ !*** ./src/js/handler/month/guide.js ***! \***************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Guide element controller for creation, resize in month view * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"), domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"), datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"), TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date, tmpl = __webpack_require__(/*! ./guide.hbs */ "./src/js/handler/month/guide.hbs"); var mmax = Math.max, mmin = Math.min, mabs = Math.abs, mfloor = Math.floor; /** * @constructor * @param {object} [options] - options * @param {boolean} [options.useHandle=false] - whether displaying resize handle on * guide element? * @param {boolean} [options.isResizeMode=false] - whether resize mode? * @param {Month} monthView - Month view instance */ function MonthGuide(options, monthView) { /** * @type {object} */ this.options = util.extend({ top: 0, height: '20px', bgColor: '#f7ca88', label: 'New event', isResizeMode: false, isCreationMode: false, styles: this._getStyles(monthView.controller.theme) }, options); /** * @type {Month} */ this.view = monthView; /** * @type {WeekdayInMonth[]} */ this.weeks = monthView.children.sort(function(a, b) { return util.stamp(a) - util.stamp(b); }); /** * @type {number} */ this.days = monthView.children.single().getRenderDateRange().length; /** * start coordinate of guide effect. (x, y) (days, weeks) effect can't * start lower than this coordinate. * @type {number[]} */ this.startCoord = [0, 0]; /** * @type {Object.} */ this.guideElements = {}; /** * horizontal grid information * @type {Object} */ this.grids = monthView.grids; } /** * Destructor */ MonthGuide.prototype.destroy = function() { this.clear(); this.options = this.view = this.weeks = this.days = this.startCoord = this.guideElements = null; }; MonthGuide.prototype.clearGuideElement = function() { this.destroy(); }; /** * Get ratio value in week. * @param {number} value - value for calc ratio in week * @returns {number} percent value */ MonthGuide.prototype._getRatioValueInWeek = function(value) { var grid = this.grids[value] || {left: 100}; return grid.left; }; /** * Create guide element * @returns {HTMLElement} guide element */ MonthGuide.prototype._createGuideElement = function() { var guide = document.createElement('div'); guide.innerHTML = tmpl(this.options); return guide.firstChild; }; /** * Get guide element. if not exist then create one * @param {number} y - y coordinate * @returns {?HTMLElement} guide element */ MonthGuide.prototype._getGuideElement = function(y) { var guideElements = this.guideElements, guide = guideElements[y], weekdayView = this.weeks[y], container; if (!weekdayView) { return null; } if (!guide) { guide = this._createGuideElement(); container = weekdayView.container; container.appendChild(guide); guideElements[y] = guide; } return guide; }; /** * Get coordinate by supplied date in month * @param {TZDate} date - date to find coordinate * @returns {number[]} coordinate (x, y) */ MonthGuide.prototype._getCoordByDate = function(date) { var WEEKEND_DAYS = 2; var weeks = this.weeks; var isWorkWeek = util.pick(this.view, 'options', 'workweek'); var days = isWorkWeek ? this.days + WEEKEND_DAYS : this.days; var getIdxFromDiff = function(d1, d2) { return mfloor(datetime.millisecondsTo('day', mabs(d2 - d1))); }, monthStart = datetime.start(weeks[0].options.renderStartDate), isBefore = date < monthStart, start = new TZDate(monthStart), end = new TZDate(monthStart).addDate(isBefore ? -days : days).addDate(-1), x = getIdxFromDiff(date, start), y = 0; while (!datetime.isBetweenWithDate(date, start, end)) { start.addDate(isBefore ? -days : days); end = new TZDate(start).addDate(days - 1); x = getIdxFromDiff(date, start); y += (isBefore ? -1 : 1); } return [x, y]; }; /** * Get limited coordinate by supplied coodinates * @param {number[]} coord - coordinate need to limit * @param {number[]} [min] - minimum limitaion of coordinate * @param {number[]} [max] - maximum limitation of coordinate * @returns {number[]} limited coordiate */ MonthGuide.prototype._getLimitedCoord = function(coord, min, max) { var toIndex = 1, x = coord[0], y = coord[1], result; min = min || [0, 0]; max = max || [this.days - toIndex, this.weeks.length - toIndex]; if (y < min[1]) { result = min.slice(0); } else if (y > max[1]) { result = max.slice(0); } else { x = mmax(min[0], x); x = mmin(max[0], x); result = [x, y]; } return result; }; /** * Prepare guide element modification * @param {object} dragStartEvent - dragStart schedule data from *guide */ MonthGuide.prototype.start = function(dragStartEvent) { var opt = this.options, target = dragStartEvent.target, model = dragStartEvent.model, x = dragStartEvent.x, y = dragStartEvent.y, renderMonth = new TZDate(this.view.options.renderMonth), temp; if (opt.isCreationMode) { if (model && !datetime.isSameMonth(renderMonth, model.start)) { model.start.setMonth(renderMonth.getMonth()); model.start.setDate(1); model.end.setMonth(renderMonth.getMonth()); model.end.setDate(1); } } else { temp = this._getCoordByDate(model.getStarts()); x = temp[0]; y = temp[1]; util.extend(this.options, { top: parseInt(target.style.top, 10) + 'px', height: parseInt(target.style.height, 10) + 'px', label: model.title }, model); } if (util.isUndefined(x) || util.isUndefined(y)) { temp = this._getCoordByDate(model.getStarts()); x = temp[0]; y = temp[1]; } this.startCoord = [x, y]; this.update(x, y); }; /** * Data for update several guide elements * @typedef UpdateIndication * @type {object} * @property {HTMLElement} guide - guide element * @property {number} left - left style value * @property {number} width - width style value * @property {boolean} [exceedL=false] - whether schedule is exceeded past weeks? * @property {boolean} [exceedR=false] - whether schedule is exceeded future weeks? */ /** * Modify HTML element that uses for guide element * @param {UpdateIndication[]} inds - indication of update severel guide element */ MonthGuide.prototype._updateGuides = function(inds) { util.forEach(inds, function(ind) { var guide = ind.guide, exceedLClass = config.classname('month-exceed-left'), exceedRClass = config.classname('month-exceed-right'); guide.style.display = 'block'; guide.style.left = ind.left + '%'; guide.style.width = ind.width + '%'; if (ind.exceedL) { domutil.addClass(guide, exceedLClass); } else { domutil.removeClass(guide, exceedLClass); } if (ind.exceedR) { domutil.addClass(guide, exceedRClass); } else { domutil.removeClass(guide, exceedRClass); } }); }; /** * Get guide element indicate for origin week * @param {number[]} startCoord - drag start coordinate * @param {number[]} mouseCoord - mouse coordinate * @returns {object} indicate */ MonthGuide.prototype._getOriginIndicate = function(startCoord, mouseCoord) { var left = mmin(startCoord[0], mouseCoord[0]), right = mmax(startCoord[0], mouseCoord[0]) + 1, exceedL, exceedR; if (mouseCoord[1] > startCoord[1]) { left = startCoord[0]; right = this.days; exceedR = true; } else if (mouseCoord[1] < startCoord[1]) { left = 0; right = startCoord[0] + 1; exceedL = true; } return { left: this._getRatioValueInWeek(left), width: this._getRatioValueInWeek(right) - this._getRatioValueInWeek(left), exceedL: exceedL, exceedR: exceedR }; }; /** * Get guide element indicate for week related with mouse position * @param {number[]} startCoord - drag start coordinate * @param {number[]} mouseCoord - mouse coordinate * @returns {object} indicate */ MonthGuide.prototype._getMouseIndicate = function(startCoord, mouseCoord) { var left = mouseCoord[0], right = mouseCoord[0] + 1, exceedL, exceedR; if (mouseCoord[1] > startCoord[1]) { left = 0; exceedL = true; } else if (mouseCoord[1] < startCoord[1]) { right = this.days; exceedR = true; } return { left: this._getRatioValueInWeek(left), width: this._getRatioValueInWeek(right) - this._getRatioValueInWeek(left), exceedL: exceedL, exceedR: exceedR }; }; /** * Get guide element indicate for contained weeks * @returns {object} indicate */ MonthGuide.prototype._getContainIndicate = function() { return { left: 0, width: 100, exceedL: true, exceedR: true }; }; /** * Remove several guide element that supplied by parameter * @param {number[]} yCoords - array of y coordinate to remove guide element */ MonthGuide.prototype._removeGuideElements = function(yCoords) { var guides = this.guideElements; util.forEach(yCoords, function(y) { domutil.remove(guides[y]); delete guides[y]; }); }; /** * Get excluded numbers in range * @param {number[]} range - the range. value must be sequencial. * @param {number[]} numbers - numbers to check * @returns {number[]} excluded numbers */ MonthGuide.prototype._getExcludesInRange = function(range, numbers) { var min = mmin.apply(null, range), max = mmax.apply(null, range), excludes = []; util.forEach(numbers, function(num) { num = parseInt(num, 10); if (num < min || num > max) { excludes.push(num); } }); return excludes; }; /** * Update guide elements by coordinate in month grid from mousemove event * @param {number} x - x coordinate * @param {number} y - y coordinate */ MonthGuide.prototype.update = function(x, y) { var self = this, startCoord = this.startCoord, mouseCoord = [x, y], limitedCoord = this.options.isResizeMode ? this._getLimitedCoord(mouseCoord, startCoord) : mouseCoord, renderedYIndex = util.keys(this.guideElements), yCoordsToUpdate = util.range( mmin(startCoord[1], limitedCoord[1]), mmax(startCoord[1], limitedCoord[1]) + 1 ), yCoordsToRemove = this._getExcludesInRange( yCoordsToUpdate, renderedYIndex ), renderIndication = {}; this._removeGuideElements(yCoordsToRemove); util.forEach(yCoordsToUpdate, function(guideYCoord) { var guide = self._getGuideElement(guideYCoord), indicate; if (!guide) { return; } if (guideYCoord === startCoord[1]) { indicate = self._getOriginIndicate(startCoord, limitedCoord); } else if (guideYCoord === mouseCoord[1]) { indicate = self._getMouseIndicate(startCoord, mouseCoord); } else { indicate = self._getContainIndicate(); } renderIndication[guideYCoord] = util.extend({ guide: guide }, indicate); }); this._updateGuides(renderIndication); }; /** * Clear all guide elements */ MonthGuide.prototype.clear = function() { util.forEach(this.guideElements, function(element) { domutil.remove(element); }); this.guideElements = {}; }; /** * Get the styles from theme * @param {Theme} theme - theme instance * @returns {object} styles - styles object */ MonthGuide.prototype._getStyles = function(theme) { var styles = {}; if (theme) { styles.border = theme.common.creationGuide.border; styles.backgroundColor = theme.common.creationGuide.backgroundColor; styles.scheduleHeight = theme.month.schedule.height; styles.scheduleGutter = theme.month.schedule.marginTop; styles.marginLeft = theme.month.schedule.marginLeft; styles.marginRight = theme.month.schedule.marginRight; styles.borderRadius = theme.month.schedule.borderRadius; } return styles; }; module.exports = MonthGuide; /***/ }), /***/ "./src/js/handler/month/move.js": /*!**************************************!*\ !*** ./src/js/handler/month/move.js ***! \**************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Move handler for month view * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"), domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"), datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"), getMousePosData = __webpack_require__(/*! ./core */ "./src/js/handler/month/core.js"), MonthMoveGuide = __webpack_require__(/*! ./moveGuide */ "./src/js/handler/month/moveGuide.js"), TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date; /** * @constructor * @mixes CustomEvents * @param {Drag} dragHandler - Drag handler instance. * @param {Month} monthView - Month view instance. * @param {Base} baseController - Base controller instance. */ function MonthMove(dragHandler, monthView, baseController) { /** * @type {Drag} */ this.dragHandler = dragHandler; /** * @type {Month} */ this.monthView = monthView; /** * @type {Base} */ this.baseController = baseController; /** * @type {function} */ this.getScheduleData = null; /** * @type {object} */ this._cache = null; /** * @type {MonthMoveGuide} */ this.guide = new MonthMoveGuide(this); dragHandler.on('dragStart', this._onDragStart, this); } /** * Destructor */ MonthMove.prototype.destroy = function() { this.dragHandler.off(this); this.dragHandler = this.monthView = this.baseController = null; }; /** * Update target schedule * @fires {MonthMove#beforeUpdateSchedule} * @param {object} scheduleCache - cache object that result of single dragging * session. */ MonthMove.prototype.updateSchedule = function(scheduleCache) { var schedule = scheduleCache.model; var duration = schedule.duration(); var startDateRaw = datetime.raw(schedule.start); var dragEndTime = new TZDate(scheduleCache.end); var newStartDate = new TZDate(dragEndTime); newStartDate.setHours(startDateRaw.h, startDateRaw.m, startDateRaw.s, startDateRaw.ms); /** * @event MonthMove#beforeUpdateSchedule * @type {object} * @property {Schedule} schedule - The original schedule instance * @property {Date} start - Deprecated: start time to update * @property {Date} end - Deprecated: end time to update * @property {object} changes - start and end time to update * @property {Date} start - start time to update * @property {Date} end - end time to update */ this.fire('beforeUpdateSchedule', { schedule: schedule, changes: { start: newStartDate, end: new TZDate(newStartDate).addMilliseconds(duration) }, start: newStartDate, end: new TZDate(newStartDate).addMilliseconds(duration) }); }; /** * Get schedule block to clone for month guide effect * @param {HTMLElement} target - target element that related with drag schedule * @returns {HTMLElement} element to create guide effect */ MonthMove.prototype.getMonthScheduleBlock = function(target) { var blockSelector = config.classname('.weekday-schedule-block'); return domutil.closest(target, blockSelector); }; /** * Get schedule block from more layer * @param {HTMLElement} target - element to check * @returns {HTMLElement} schedule element */ MonthMove.prototype.getMoreLayerScheduleBlock = function(target) { var className = config.classname('.month-more-schedule'); return domutil.closest(target, className); }; /** * Check handler has permission to handle fired schedule * @fires {MonthMove#monthMoveStart_from_morelayer} * @param {HTMLElement} target - target element of fired schedule * @returns {(string|null)} model instance ID related with schedule. if handle * has not permission to handle the schedule then return null. */ MonthMove.prototype.hasPermissionToHandle = function(target) { var modelID = null; var blockElement; if (domutil.hasClass(target, config.classname('weekday-resize-handle'))) { return null; } blockElement = this.getMonthScheduleBlock(target); if (blockElement) { modelID = domutil.getData(blockElement, 'id'); } else { blockElement = this.getMoreLayerScheduleBlock(target); if (blockElement) { modelID = domutil.getData(blockElement, 'id'); /** * Fire for notificate that the drag schedule start at more layer view. * @event {MonthMove#monthMoveStart_from_morelayer} */ this.fire('monthMoveStart_from_morelayer'); } } return modelID; }; /** * Event handler for Drag#dragStart * @fires {MonthMove#monthMoveDragstart} * @param {object} dragStartEvent - drag start schedule data */ MonthMove.prototype._onDragStart = function(dragStartEvent) { var target = dragStartEvent.target, modelID = this.hasPermissionToHandle(target), model = this.baseController.schedules.items[modelID], scheduleData; if (!modelID || !model || model.isReadOnly || model.isPending) { return; } this.dragHandler.on({ drag: this._onDrag, dragEnd: this._onDragEnd }, this); this.getScheduleData = getMousePosData(this.monthView); scheduleData = this.getScheduleData(dragStartEvent.originEvent); scheduleData.originEvent = dragStartEvent.originEvent; scheduleData.target = this.getMonthScheduleBlock(target); scheduleData.model = model; this._cache = { model: model, target: target, start: new TZDate(Number(scheduleData.date)) }; /** * @event {MonthMove#monthMoveDragstart} * @type {object} * @property {number} x - x index * @property {number} y - y index * @property {Date} date - drag date * @property {HTMLElement} target - schedule block element * @property {Schedule} model - model instance */ this.fire('monthMoveDragstart', scheduleData); }; /** * @fires {MonthMove#monthMoveDrag} * @param {object} dragEvent - drag event data */ MonthMove.prototype._onDrag = function(dragEvent) { var scheduleData; if (!this.getScheduleData) { return; } scheduleData = util.extend({ originEvent: dragEvent.originEvent }, this.getScheduleData(dragEvent.originEvent)); if (!scheduleData) { return; } /** * @event {MonthMove#monthMoveDrag} * @type {object} * @property {number} x - x index * @property {number} y - y index * @property {Date} date - drag date */ this.fire('monthMoveDrag', scheduleData); }; /** * Event handler for Drag#dragEnd * @fires {MonthMove#monthMoveDragend} * @param {object} dragEndEvent - dragend event data */ MonthMove.prototype._onDragEnd = function(dragEndEvent) { var cache = this._cache; var scheduleData; this.dragHandler.off({ drag: this._onDrag, dragEnd: this._onDragEnd }, this); if (!this.getScheduleData) { return; } scheduleData = this.getScheduleData(dragEndEvent.originEvent); if (scheduleData) { cache.end = new TZDate(scheduleData.date); this.updateSchedule(cache); } /** * @event {MonthResize#monthMoveDragend} * @type {object} * @property {number} x - x index * @property {number} y - y index * @property {Date} date - drag date */ this.fire('monthMoveDragend', scheduleData); this.getScheduleData = this._cache = null; }; util.CustomEvents.mixin(MonthMove); module.exports = MonthMove; /***/ }), /***/ "./src/js/handler/month/moveGuide.hbs": /*!********************************************!*\ !*** ./src/js/handler/month/moveGuide.hbs ***! \********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " border-left:3px solid " + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"borderColor") : stack1), depth0)) + ";\n "; },"3":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " \n"; },"5":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":16,"column":110},"end":{"line":16,"column":124}}}) : helper))) + "weekday-schedule-title-focused"; },"7":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + ((stack1 = (lookupProperty(helpers,"allday-tmpl")||(depth0 && lookupProperty(depth0,"allday-tmpl"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? lookupProperty(depth0,"model") : depth0),{"name":"allday-tmpl","hash":{},"data":data,"loc":{"start":{"line":18,"column":12},"end":{"line":18,"column":35}}})) != null ? stack1 : "") + "\n"; },"9":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + ((stack1 = (lookupProperty(helpers,"time-tmpl")||(depth0 && lookupProperty(depth0,"time-tmpl"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? lookupProperty(depth0,"model") : depth0),{"name":"time-tmpl","hash":{},"data":data,"loc":{"start":{"line":20,"column":12},"end":{"line":20,"column":33}}})) != null ? stack1 : "") + "\n"; },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n" + ((stack1 = lookupProperty(helpers,"unless").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"isAllDay") : stack1),{"name":"unless","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":13,"column":4},"end":{"line":15,"column":15}}})) != null ? stack1 : "") + "
\n" + ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"isAllDay") : stack1),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.program(9, data, 0),"data":data,"loc":{"start":{"line":17,"column":8},"end":{"line":21,"column":15}}})) != null ? stack1 : "") + "
\n
\n
\n"; },"useData":true}); /***/ }), /***/ "./src/js/handler/month/moveGuide.js": /*!*******************************************!*\ !*** ./src/js/handler/month/moveGuide.js ***! \*******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/** * @fileoverview Module for modification of guide element for move in month view * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"), domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"), domevent = __webpack_require__(/*! ../../common/domevent */ "./src/js/common/domevent.js"), FloatingLayer = __webpack_require__(/*! ../../common/floatingLayer */ "./src/js/common/floatingLayer.js"), tmpl = __webpack_require__(/*! ./moveGuide.hbs */ "./src/js/handler/month/moveGuide.hbs"), Schedule = __webpack_require__(/*! ../../model/schedule */ "./src/js/model/schedule.js"); /** * @constructor * @param {MonthMove} monthMove - month/move module instance */ function MonthMoveGuide(monthMove) { /** * @type {MonthMove} */ this.monthMove = monthMove; /** * @type {HTMLElement[]} */ this.elements = null; /** * @type {FloatingLayer} */ this.layer = null; monthMove.on({ monthMoveDragstart: this._onDragStart, monthMoveDrag: this._onDrag, monthMoveDragend: this._onDragEnd }, this); } /** * Destructor */ MonthMoveGuide.prototype.destroy = function() { this.monthMove.off(this); this._clearGridBgColor(); if (this.layer) { this.layer.destroy(); } if (this.element) { domutil.remove(this.element); } this.monthMove = this.elements = this.layer = null; }; /** * Hide element blocks for resize effect * @param {number} modelID - Schedule model instance ID */ MonthMoveGuide.prototype._hideOriginScheduleBlocks = function(modelID) { var className = config.classname('weekday-schedule-block-dragging-dim'); this.elements = domutil.find( config.classname('.weekday-schedule-block-' + modelID), this.monthMove.monthView.container, true ); util.forEach(this.elements, function(el) { domutil.addClass(el, className); }); }; /** * Show element blocks */ MonthMoveGuide.prototype._showOriginScheduleBlocks = function() { var className = config.classname('weekday-schedule-block-dragging-dim'); util.forEach(this.elements, function(el) { domutil.removeClass(el, className); }); }; /** * Clear background color for filled grid element. */ MonthMoveGuide.prototype._clearGridBgColor = function() { var selector = config.classname('.weekday-filled'), className = config.classname('weekday-filled'), beforeGridElement = domutil.find(selector, this.monthMove.monthView.container); if (beforeGridElement) { domutil.removeClass(beforeGridElement, className); } }; /** * Fill background color of date grids relatied with model updates. * @param {object} dragEvent - drag event data from MonthMoveGuide#_onDrag */ MonthMoveGuide.prototype._updateGridBgColor = function(dragEvent) { var gridElements = domutil.find(config.classname('.weekday-grid-line'), this.monthMove.monthView.container, true), className = config.classname('weekday-filled'), targetIndex = (dragEvent.x + (dragEvent.sizeX * dragEvent.y)); this._clearGridBgColor(); if (!gridElements || !gridElements[targetIndex]) { return; } domutil.addClass(gridElements[targetIndex], className); }; /** * Handler for MonthMove#dragStart * @param {object} dragStartEvent - dragStart schedule data object */ MonthMoveGuide.prototype._onDragStart = function(dragStartEvent) { var monthView = this.monthMove.monthView, firstWeekdayView = monthView.children.single(), weekdayOptions = firstWeekdayView.options, widthPercent = 100 / firstWeekdayView.getRenderDateRange().length, height = weekdayOptions.scheduleGutter + weekdayOptions.scheduleHeight, container = monthView.container, mousePos = domevent.getMousePosition(dragStartEvent.originEvent, container), model = dragStartEvent.model, layer = new FloatingLayer(null, container); this._hideOriginScheduleBlocks(model.cid()); this.layer = layer; layer.setSize(widthPercent + '%', height); layer.setPosition(mousePos[0], mousePos[1]); layer.setContent(tmpl({ model: util.extend( Schedule.create(model), model ), styles: { scheduleHeight: weekdayOptions.scheduleHeight, scheduleBulletTop: weekdayOptions.scheduleHeight / 3, borderRadius: monthView.controller.theme.month.schedule.borderRadius } })); layer.show(); if (!util.browser.msie) { domutil.addClass(global.document.body, config.classname('dragging')); } }; /** * Handler for MonthMove#drag * @param {object} dragEvent - drag event data object */ MonthMoveGuide.prototype._onDrag = function(dragEvent) { var container = this.monthMove.monthView.container, mousePos = domevent.getMousePosition( dragEvent.originEvent, container ); this._updateGridBgColor(dragEvent); if (!this.layer) { return; } this.layer.setPosition(mousePos[0], mousePos[1]); }; /** * Handler for MonthMove#dragEnd */ MonthMoveGuide.prototype._onDragEnd = function() { this._showOriginScheduleBlocks(); if (!util.browser.msie) { domutil.removeClass(global.document.body, config.classname('dragging')); } this._clearGridBgColor(); this.layer.destroy(); this.layer = null; }; module.exports = MonthMoveGuide; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./src/js/handler/month/resize.js": /*!****************************************!*\ !*** ./src/js/handler/month/resize.js ***! \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Module for resize schedule in month view * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"), datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"), domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"), getMousePosData = __webpack_require__(/*! ./core */ "./src/js/handler/month/core.js"), MonthResizeGuide = __webpack_require__(/*! ./resizeGuide */ "./src/js/handler/month/resizeGuide.js"), TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date; var common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"); /** * @constructor * @param {Drag} dragHandler - Drag handler instance. * @param {Month} monthView - Month view instance. * @param {Base} baseController - Base controller instance. */ function MonthResize(dragHandler, monthView, baseController) { /** * @type {Drag} */ this.dragHandler = dragHandler; /** * @type {Month} */ this.monthView = monthView; /** * @type {Base} */ this.baseController = baseController; /** * @type {function} */ this.getScheduleData = null; /** * @type {object} */ this._cache = null; /** * @type {MonthResizeGuide} */ this.guide = new MonthResizeGuide(this); dragHandler.on('dragStart', this._onDragStart, this); } /** * Destructor */ MonthResize.prototype.destroy = function() { this.dragHandler.off(this); this.dragHandler = this.monthView = this.baseController = null; }; /** * Fire event for update model * @fires {MonthResize#beforeUpdateSchedule} * @param {object} scheduleCache - cache object that result of single dragging * session. */ MonthResize.prototype._updateSchedule = function(scheduleCache) { // You can not change the start date of the event. Only the end time can be changed. var newEnd = datetime.end(new TZDate(scheduleCache.end)), schedule = scheduleCache.schedule; var changes = common.getScheduleChanges( schedule, ['end'], {end: newEnd} ); /** * @event MonthResize#beforeUpdateSchedule * @type {object} * @property {Schedule} schedule - The original schedule instance * @property {Date} start - Deprecated: start time to update * @property {Date} end - Deprecated: end time to update * @property {object} changes - end time to update * @property {date} end - end time to update */ this.fire('beforeUpdateSchedule', { schedule: schedule, changes: changes, start: new TZDate(schedule.getStarts()), end: newEnd }); }; /** * Event handler for Drag#dragStart * @fires {MonthResize#monthResizeDragstart} * @param {object} dragStartEvent - drag start event data */ MonthResize.prototype._onDragStart = function(dragStartEvent) { var target = dragStartEvent.target, modelID, schedule, scheduleData; if (!domutil.hasClass(target, config.classname('weekday-resize-handle'))) { return; } target = domutil.closest(target, config.classname('.weekday-schedule-block')); if (!target) { return; } modelID = domutil.getData(target, 'id'); schedule = this.baseController.schedules.items[modelID]; this.dragHandler.on({ drag: this._onDrag, dragEnd: this._onDragEnd }, this); this.getScheduleData = getMousePosData(this.monthView); scheduleData = this.getScheduleData(dragStartEvent.originEvent); scheduleData.target = target; scheduleData.model = schedule; this._cache = { schedule: schedule, target: target, start: new TZDate(scheduleData.date) }; /** * @event {MonthCreation#monthResizeDragstart} * @type {object} * @property {number} x - x index * @property {number} y - y index * @property {Date} date - drag date * @property {HTMLElement} target - schedule block element * @property {Schedule} model - model instance */ this.fire('monthResizeDragstart', scheduleData); }; /** * @fires {MonthResize#monthResizeDrag} * @param {object} dragEvent - drag event data */ MonthResize.prototype._onDrag = function(dragEvent) { var scheduleData; if (!this.getScheduleData) { return; } scheduleData = this.getScheduleData(dragEvent.originEvent); if (!scheduleData) { return; } /** * @event {MonthResize#monthResizeDrag} * @type {object} * @property {number} x - x index * @property {number} y - y index * @property {Date} date - drag date */ this.fire('monthResizeDrag', scheduleData); }; /** * @fires {MonthResize#monthResizeDragend} * @param {object} dragEndEvent - drag end event data */ MonthResize.prototype._onDragEnd = function(dragEndEvent) { var cache = this._cache; var scheduleData; var start, end; this.dragHandler.off({ drag: this._onDrag, dragEnd: this._onDragEnd }, this); if (!this.getScheduleData) { return; } scheduleData = this.getScheduleData(dragEndEvent.originEvent); if (scheduleData) { start = new TZDate(cache.schedule.getStarts()); end = new TZDate(scheduleData.date); cache.end = end; if (start <= cache.end) { this._updateSchedule(cache); } } /** * @event {MonthResize#monthResizeDragend} * @type {object} * @property {number} x - x index * @property {number} y - y index * @property {Date} date - drag date */ this.fire('monthResizeDragend', scheduleData); this.getScheduleData = this._cache = null; }; util.CustomEvents.mixin(MonthResize); module.exports = MonthResize; /***/ }), /***/ "./src/js/handler/month/resizeGuide.js": /*!*********************************************!*\ !*** ./src/js/handler/month/resizeGuide.js ***! \*********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/** * @fileoverview Module for modification of guide element in schedule resize * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"), domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"), MonthGuide = __webpack_require__(/*! ./guide */ "./src/js/handler/month/guide.js"); /** * @constructor * @param {MonthResize} monthResize - month/resize module instance */ function MonthResizeGuide(monthResize) { /** * @type {MonthResize} */ this.monthResize = monthResize; /** * @type {HTMLElement[]} */ this.elements = null; /** * @type {MonthGuide} */ this.guide = null; monthResize.on({ monthResizeDragstart: this._onDragStart, monthResizeDrag: this._onDrag, monthResizeDragend: this._onDragEnd }, this); } /** * Destructor */ MonthResizeGuide.prototype.destroy = function() { this.monthResize.off(this); this.guide.destroy(); this.guide = this.monthResize = null; }; /** * Hide element blocks for resize effect * @param {number} modelID - Schedule model instance ID */ MonthResizeGuide.prototype._hideScheduleBlocks = function(modelID) { this.elements = domutil.find( config.classname('.weekday-schedule-block-' + modelID), this.monthResize.monthView.container, true ); util.forEach(this.elements, function(el) { el.style.display = 'none'; }); }; /** * Show element blocks */ MonthResizeGuide.prototype._showScheduleBlocks = function() { util.forEach(this.elements, function(el) { el.style.display = 'block'; }); }; /** * Drag start event handler * @param {object} dragStartEvent - schedule data from MonthResize */ MonthResizeGuide.prototype._onDragStart = function(dragStartEvent) { this.guide = new MonthGuide({ isResizeMode: true }, this.monthResize.monthView); this.guide.start(dragStartEvent); this._hideScheduleBlocks(dragStartEvent.model.cid()); if (!util.browser.msie) { domutil.addClass(global.document.body, config.classname('resizing-x')); } }; /** * Drag event handler * @param {object} dragEvent - event data from MonthCreation */ MonthResizeGuide.prototype._onDrag = function(dragEvent) { this.guide.update(dragEvent.x, dragEvent.y); }; /** * Drag end event handler */ MonthResizeGuide.prototype._onDragEnd = function() { this._showScheduleBlocks(); this.guide.destroy(); this.elements = this.guide = null; if (!util.browser.msie) { domutil.removeClass(global.document.body, config.classname('resizing-x')); } }; module.exports = MonthResizeGuide; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./src/js/handler/time/click.js": /*!**************************************!*\ !*** ./src/js/handler/time/click.js ***! \**************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Allday event click event hander module * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); /** * @constructor * @implements {Handler} * @mixes util.CustomEvents * @param {Drag} [dragHandler] - Drag handler instance. * @param {TimeGrid} [timeGridView] - TimeGrid view instance. * @param {Base} [baseController] - Base controller instance. */ function TimeClick(dragHandler, timeGridView, baseController) { /** * @type {Drag} */ this.dragHandler = dragHandler; /** * @type {TimeGrid} */ this.timeGridView = timeGridView; /** * @type {Base} */ this.baseController = baseController; dragHandler.on({ 'click': this._onClick }, this); } /** * Destroy method */ TimeClick.prototype.destroy = function() { this.dragHandler.off(this); this.timeGridView = this.baseController = this.dragHandler = null; }; /** * Check target element is expected condition for activate this plugins. * @param {HTMLElement} target - The element to check * @returns {string} - model id */ TimeClick.prototype.checkExpectCondition = function(target) { var container, matches; container = domutil.closest(target, config.classname('.time-date')); if (!container) { return false; } matches = domutil.getClass(container).match(config.time.getViewIDRegExp); if (!matches || matches.length < 2) { return false; } return util.pick(this.timeGridView.children.items, Number(matches[1])); }; /** * Click event hander * @param {object} clickEvent - click event from {@link Drag} * @emits TimeClick#clickEvent */ TimeClick.prototype._onClick = function(clickEvent) { var self = this, target = clickEvent.target, timeView = this.checkExpectCondition(target), blockElement = domutil.closest(target, config.classname('.time-date-schedule-block')), schedulesCollection = this.baseController.schedules; if (!timeView || !blockElement) { return; } schedulesCollection.doWhenHas(domutil.getData(blockElement, 'id'), function(schedule) { /** * @events TimeClick#clickSchedule * @type {object} * @property {Schedule} schedule - schedule instance * @property {MouseEvent} event - MouseEvent object */ self.fire('clickSchedule', { schedule: schedule, event: clickEvent.originEvent }); }); }; util.CustomEvents.mixin(TimeClick); module.exports = TimeClick; /***/ }), /***/ "./src/js/handler/time/clickDayname.js": /*!*********************************************!*\ !*** ./src/js/handler/time/clickDayname.js ***! \*********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Dayname click event hander module * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); /** * @constructor * @implements {Handler} * @mixes util.CustomEvents * @param {Drag} [dragHandler] - Drag handler instance. * @param {DayName} [dayNameView] - DayName view instance. * @param {Base} [baseController] - Base controller instance. */ function DayNameClick(dragHandler, dayNameView, baseController) { /** * @type {Drag} */ this.dragHandler = dragHandler; /** * @type {DayName} */ this.dayNameView = dayNameView; /** * @type {Base} */ this.baseController = baseController; dragHandler.on({ 'click': this._onClick }, this); } /** * Destroy method */ DayNameClick.prototype.destroy = function() { this.dragHandler.off(this); this.dayNameView = this.baseController = this.dragHandler = null; }; /** * Check target element is expected condition for activate this plugins. * @param {HTMLElement} target - The element to check * @returns {string} - model id */ DayNameClick.prototype.checkExpectCondition = function(target) { var container = domutil.closest(target, config.classname('.dayname-date-area')); if (!container) { return false; } return true; }; /** * Click event hander * @param {object} clickEvent - click event from {@link Drag} * @emits DayNameClick#clickDayname */ DayNameClick.prototype._onClick = function(clickEvent) { var self = this, target = clickEvent.target, daynameView = this.checkExpectCondition(target), blockElement = domutil.closest(target, config.classname('.dayname')); if (!daynameView || !blockElement) { return; } /** * @events DayNameClick#clickDayname * @type {object} * @property {string} date - click date */ self.fire('clickDayname', { date: domutil.getData(blockElement, 'date') }); }; util.CustomEvents.mixin(DayNameClick); module.exports = DayNameClick; /***/ }), /***/ "./src/js/handler/time/core.js": /*!*************************************!*\ !*** ./src/js/handler/time/core.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Core methods for dragging actions * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var domevent = __webpack_require__(/*! ../../common/domevent */ "./src/js/common/domevent.js"); var Point = __webpack_require__(/*! ../../common/point */ "./src/js/common/point.js"); var TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date; /** * @mixin Time.Core */ var timeCore = { /** * Get Y index ratio(hour) in time grids by supplied parameters. * @param {number} baseMil - base milliseconds number for supplied height. * @param {number} height - container element height. * @param {number} y - Y coordinate to calculate hour ratio. * @returns {number} hour index ratio value. */ _calcGridYIndex: function(baseMil, height, y) { // get ratio from right expression > point.y : x = session.height : baseMil // and convert milliseconds value to hours. var result = datetime.millisecondsTo('hour', (y * baseMil) / height), floored = result | 0, nearest = common.nearest(result - floored, [0, 1]); return floored + (nearest ? 0.5 : 0); }, /** * Get function to makes event data from Time and mouseEvent * @param {Time} timeView - Instance of time view. * @returns {function} - Function that return event data from mouse event. */ _retriveScheduleData: function(timeView) { var self = this, container = timeView.container, options = timeView.options, viewHeight = timeView.getViewBound().height, viewTime = timeView.getDate(), hourLength = options.hourEnd - options.hourStart, baseMil = datetime.millisecondsFrom('hour', hourLength); /** * @param {MouseEvent} mouseEvent - mouse event object to get common event data. * @param {object} [extend] - object to extend event data before return. * @returns {object} - common event data for time */ return function(mouseEvent, extend) { var mouseY = Point.n(domevent.getMousePosition(mouseEvent, container)).y, gridY = common.ratio(viewHeight, hourLength, mouseY), timeY = new TZDate(viewTime).addMinutes(datetime.minutesFromHours(gridY)), nearestGridY = self._calcGridYIndex(baseMil, viewHeight, mouseY), nearestGridTimeY = new TZDate(viewTime).addMinutes( datetime.minutesFromHours(nearestGridY + options.hourStart) ); return util.extend({ target: domevent.getEventTarget(mouseEvent), relatedView: timeView, originEvent: mouseEvent, mouseY: mouseY, gridY: gridY, timeY: timeY, nearestGridY: nearestGridY, nearestGridTimeY: nearestGridTimeY, triggerEvent: mouseEvent.type }, extend); }; }, /** * Get function to makes event data from Time and mouseEvent * @param {Time} timeView - Instance of time view. * @param {TZDate} startDate - start date * @param {TZDate} endDate - end date * @param {number} hourStart Can limit of render hour start. * @returns {object} - common event data for time from mouse event. */ _retriveScheduleDataFromDate: function(timeView, startDate, endDate, hourStart) { var viewTime = timeView.getDate(); var gridY, timeY, nearestGridY, nearestGridTimeY, nearestGridEndY, nearestGridEndTimeY; gridY = startDate.getHours() - hourStart + getNearestHour(startDate.getMinutes()); timeY = new TZDate(viewTime).addMinutes(datetime.minutesFromHours(gridY)); nearestGridY = gridY; nearestGridTimeY = new TZDate(viewTime).addMinutes(datetime.minutesFromHours(nearestGridY)); nearestGridEndY = endDate.getHours() - hourStart + getNearestHour(endDate.getMinutes()); nearestGridEndTimeY = new TZDate(viewTime).addMinutes(datetime.minutesFromHours(nearestGridEndY)); return { target: timeView, relatedView: timeView, gridY: gridY, timeY: timeY, nearestGridY: nearestGridY, nearestGridTimeY: nearestGridTimeY, nearestGridEndY: nearestGridEndY, nearestGridEndTimeY: nearestGridEndTimeY, triggerEvent: 'manual', hourStart: hourStart }; }, /** * Mixin method. * @param {(TimeCreation|TimeMove)} obj - Constructor functions */ mixin: function(obj) { var proto = obj.prototype; util.forEach(timeCore, function(method, methodName) { if (methodName === 'mixin') { return; } proto[methodName] = method; }); } }; /** * Get the nearest hour * @param {number} minutes - minutes * @returns {number} hour */ function getNearestHour(minutes) { var nearestHour; if (minutes === 0) { nearestHour = 0; } else if (minutes > 30) { nearestHour = 1; } else if (minutes <= 30) { nearestHour = 0.5; } return nearestHour; } module.exports = timeCore; /***/ }), /***/ "./src/js/handler/time/creation.js": /*!*****************************************!*\ !*** ./src/js/handler/time/creation.js ***! \*****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Handling creation events from drag handler and time grid view * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var array = __webpack_require__(/*! ../../common/array */ "./src/js/common/array.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var domevent = __webpack_require__(/*! ../../common/domevent */ "./src/js/common/domevent.js"); var common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"); var TimeCreationGuide = __webpack_require__(/*! ./creationGuide */ "./src/js/handler/time/creationGuide.js"); var TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date; var timeCore = __webpack_require__(/*! ./core */ "./src/js/handler/time/core.js"); var CLICK_DELAY = 300; /** * @constructor * @implements {Handler} * @mixes timeCore * @mixes CustomEvents * @param {Drag} [dragHandler] - Drag handler instance. * @param {TimeGrid} [timeGridView] - TimeGrid view instance. * @param {Base} [baseController] - Base controller instance. * @param {Options} [options] - calendar Options */ function TimeCreation(dragHandler, timeGridView, baseController, options) { /** * Drag handler instance. * @type {Drag} */ this.dragHandler = dragHandler; /** * TimeGrid view instance. * @type {TimeGrid} */ this.timeGridView = timeGridView; /** * Base controller instance. * @type {Base} */ this.baseController = baseController; /** * @type {TimeCreationGuide} */ this.guide = new TimeCreationGuide(this); /** * Temporary function for single drag session's calc. * @type {function} */ this._getScheduleDataFunc = null; /** * Temporary function for drag start data cache. * @type {object} */ this._dragStart = null; /** * @type {boolean} */ this._requestOnClick = false; /** * @type {boolean} */ this._disableDblClick = options.disableDblClick; /** * @type {boolean} */ this._disableClick = options.disableClick; dragHandler.on('dragStart', this._onDragStart, this); dragHandler.on('click', this._onClick, this); if (this._disableDblClick) { CLICK_DELAY = 0; } else { domevent.on(timeGridView.container, 'dblclick', this._onDblClick, this); } } /** * Destroy method */ TimeCreation.prototype.destroy = function() { var timeGridView = this.timeGridView; this.guide.destroy(); this.dragHandler.off(this); if (timeGridView && timeGridView.container) { domevent.off(timeGridView.container, 'dblclick', this._onDblClick, this); } this.dragHandler = this.timeGridView = this.baseController = this._getScheduleDataFunc = this._dragStart = this.guide = null; }; /** * Check target element is expected condition for activate this plugins. * @param {HTMLElement} target - The element to check * @returns {(boolean|Time)} - return Time view instance when satiate condition. */ TimeCreation.prototype.checkExpectedCondition = function(target) { var cssClass = domutil.getClass(target), matches; if (cssClass === config.classname('time-date-schedule-block-wrap')) { target = target.parentNode; cssClass = domutil.getClass(target); } matches = cssClass.match(config.time.getViewIDRegExp); if (!matches || matches.length < 2) { return false; } return util.pick(this.timeGridView.children.items, matches[1]); }; /** * Drag#dragStart event handler. * @emits TimeCreation#timeCreationDragstart * @param {object} dragStartEventData - Drag#dragStart event data. * @param {string} [overrideEventName] - override emitted event name when supplied. * @param {function} [revise] - supply function for revise event data before emit. */ TimeCreation.prototype._onDragStart = function(dragStartEventData, overrideEventName, revise) { var target = dragStartEventData.target, result = this.checkExpectedCondition(target), getScheduleDataFunc, eventData; if (!result) { return; } getScheduleDataFunc = this._getScheduleDataFunc = this._retriveScheduleData(result); eventData = this._dragStart = getScheduleDataFunc(dragStartEventData.originEvent); if (revise) { revise(eventData); } this.dragHandler.on({ drag: this._onDrag, dragEnd: this._onDragEnd }, this); /** * @event TimeCreation#timeCreationDragstart * @type {object} * @property {Time} relatedView - time view instance related with mouse position. * @property {MouseEvent} originEvent - mouse event object. * @property {number} mouseY - mouse Y px mouse event. * @property {number} gridY - grid Y index value related with mouseY value. * @property {number} timeY - milliseconds value of mouseY points. * @property {number} nearestGridY - nearest grid index related with mouseY value. * @property {number} nearestGridTimeY - time value for nearestGridY. */ this.fire(overrideEventName || 'timeCreationDragstart', eventData); }; /** * Drag#drag event handler * @emits TimeCreation#timeCreationDrag * @param {object} dragEventData - event data from Drag#drag. * @param {string} [overrideEventName] - override emitted event name when supplied. * @param {function} [revise] - supply function for revise event data before emit. */ TimeCreation.prototype._onDrag = function(dragEventData, overrideEventName, revise) { var getScheduleDataFunc = this._getScheduleDataFunc, eventData; if (!getScheduleDataFunc) { return; } eventData = getScheduleDataFunc(dragEventData.originEvent); if (revise) { revise(eventData); } /** * @event TimeCreation#timeCreationDrag * @type {object} * @property {Time} relatedView - time view instance related with mouse position. * @property {MouseEvent} originEvent - mouse event object. * @property {number} mouseY - mouse Y px mouse event. * @property {number} gridY - grid Y index value related with mouseY value. * @property {number} timeY - milliseconds value of mouseY points. * @property {number} nearestGridY - nearest grid index related with mouseY value. * @property {number} nearestGridTimeY - time value for nearestGridY. */ this.fire(overrideEventName || 'timeCreationDrag', eventData); }; /** * @fires TimeCreation#beforeCreateSchedule * @param {object} eventData - event data object from TimeCreation#timeCreationDragend * or TimeCreation#timeCreationClick */ TimeCreation.prototype._createSchedule = function(eventData) { var relatedView = eventData.relatedView, createRange = eventData.createRange, nearestGridTimeY = eventData.nearestGridTimeY, nearestGridEndTimeY = eventData.nearestGridEndTimeY ? eventData.nearestGridEndTimeY : new TZDate(nearestGridTimeY).addMinutes(30), baseDate, dateStart, dateEnd, start, end; if (!createRange) { createRange = [ nearestGridTimeY, nearestGridEndTimeY ]; } baseDate = new TZDate(relatedView.getDate()); dateStart = datetime.start(baseDate); dateEnd = datetime.getStartOfNextDay(baseDate); start = common.limitDate(createRange[0], dateStart, dateEnd); end = common.limitDate(createRange[1], dateStart, dateEnd); /** * @event TimeCreation#beforeCreateSchedule * @type {object} * @property {boolean} isAllDay - whether schedule is fired in allday view area? * @property {Date} start - select start time * @property {Date} end - select end time * @property {TimeCreationGuide} guide - TimeCreationGuide instance * @property {string} triggerEventName - event name */ this.fire('beforeCreateSchedule', { isAllDay: false, start: new TZDate(start), end: new TZDate(end), guide: this.guide, triggerEventName: eventData.triggerEvent }); }; /** * Drag#dragEnd event handler * @emits TimeCreation#timeCreationDragend * @param {object} dragEndEventData - event data from Drag#dragend */ TimeCreation.prototype._onDragEnd = function(dragEndEventData) { var self = this, dragStart = this._dragStart; this.dragHandler.off({ drag: this._onDrag, dragEnd: this._onDragEnd }, this); /** * Function for manipulate event data before firing event * @param {object} eventData - event data */ function reviseFunc(eventData) { var range = [ dragStart.nearestGridTimeY, eventData.nearestGridTimeY ].sort(array.compare.num.asc); range[1].addMinutes(30); eventData.createRange = range; self._createSchedule(eventData); } /** * @event TimeCreation#timeCreationDragend * @type {object} * @property {Time} relatedView - time view instance related with mouse position. * @property {MouseEvent} originEvent - mouse event object. * @property {number} mouseY - mouse Y px mouse event. * @property {number} gridY - grid Y index value related with mouseY value. * @property {number} timeY - milliseconds value of mouseY points. * @property {number} nearestGridY - nearest grid index related with mouseY value. * @property {number} nearestGridTimeY - time value for nearestGridY. * @property {number[]} createRange - milliseconds range between drag start and end to create. */ this._onDrag(dragEndEventData, 'timeCreationDragend', reviseFunc); this._dragStart = this._getScheduleDataFunc = null; }; /** * Drag#click event handler * @emits TimeCreation#timeCreationClick * @param {object} clickEventData - event data from Drag#click. */ TimeCreation.prototype._onClick = function(clickEventData) { var self = this; var condResult, getScheduleDataFunc, eventData; this.dragHandler.off({ drag: this._onDrag, dragEnd: this._onDragEnd }, this); condResult = this.checkExpectedCondition(clickEventData.target); if (!condResult || this._disableClick) { return; } getScheduleDataFunc = this._retriveScheduleData(condResult); eventData = getScheduleDataFunc(clickEventData.originEvent); this._requestOnClick = true; setTimeout(function() { if (self._requestOnClick) { self.fire('timeCreationClick', eventData); self._createSchedule(eventData); } self._requestOnClick = false; }, CLICK_DELAY); this._dragStart = this._getScheduleDataFunc = null; }; /** * Dblclick event handler * @param {MouseEvent} e - Native MouseEvent */ TimeCreation.prototype._onDblClick = function(e) { var condResult, getScheduleDataFunc, eventData; condResult = this.checkExpectedCondition(e.target); if (!condResult) { return; } getScheduleDataFunc = this._retriveScheduleData(condResult); eventData = getScheduleDataFunc(e); this.fire('timeCreationClick', eventData); this._createSchedule(eventData); this._requestOnClick = false; }; /** * Invoke creation click * @param {Schedule} schedule - schedule instance */ TimeCreation.prototype.invokeCreationClick = function(schedule) { var opt = this.timeGridView.options, range = datetime.range( opt.renderStartDate, opt.renderEndDate, datetime.MILLISECONDS_PER_DAY), hourStart = opt.hourStart, targetDate = schedule.start; var eventData, timeView; util.forEach(range, function(date, index) { if (datetime.isSameDate(date, targetDate)) { timeView = this.timeGridView.children.toArray()[index]; } }, this); // If start date is not in current date, set start date as first date. if (!timeView) { timeView = this.timeGridView.children.toArray()[0]; } eventData = this._retriveScheduleDataFromDate(timeView, schedule.start, schedule.end, hourStart); this.fire('timeCreationClick', eventData); this._createSchedule(eventData); }; timeCore.mixin(TimeCreation); util.CustomEvents.mixin(TimeCreation); module.exports = TimeCreation; /***/ }), /***/ "./src/js/handler/time/creationGuide.js": /*!**********************************************!*\ !*** ./src/js/handler/time/creationGuide.js ***! \**********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/** * @fileoverview Module for Time.Creation effect while dragging. * @author NHN FE Development Lab */ var common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var reqAnimFrame = __webpack_require__(/*! ../../common/reqAnimFrame */ "./src/js/common/reqAnimFrame.js"); var ratio = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js").ratio; var TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date; var MIN60 = (datetime.MILLISECONDS_PER_MINUTES * 60); /** * Class for Time.Creation dragging effect. * @constructor * @param {TimeCreation} timeCreation - instance of TimeCreation. */ function TimeCreationGuide(timeCreation) { /** * Guide element for creation effect. * @type {HTMLElement} */ this.guideElement = global.document.createElement('div'); /** * @type {HTMLDivElement} */ this.guideTimeElement = domutil.appendHTMLElement( 'span', this.guideElement, config.classname('time-guide-creation-label') ); domutil.addClass(this.guideElement, config.classname('time-guide-creation')); /** * @type {TimeCreation} */ this.timeCreation = timeCreation; /** * @type {array} */ this._styleUnit = null; /** * @type {array} */ this._styleStart = null; /** * @type {function} */ this._styleFunc = null; timeCreation.on({ timeCreationDragstart: this._createGuideElement, timeCreationDrag: this._onDrag, timeCreationClick: this._createGuideElement }, this); this.applyTheme(timeCreation.baseController.theme); } /** * Destroy method. */ TimeCreationGuide.prototype.destroy = function() { this.clearGuideElement(); this.timeCreation.off(this); this.timeCreation = this._styleUnit = this._styleStart = this._styleFunc = this.guideElement = this.guideTimeElement = null; }; /** * Clear guide element. */ TimeCreationGuide.prototype.clearGuideElement = function() { var guideElement = this.guideElement, timeElement = this.guideTimeElement; domutil.remove(guideElement); reqAnimFrame.requestAnimFrame(function() { guideElement.style.display = 'none'; guideElement.style.top = ''; guideElement.style.height = ''; timeElement.innerHTML = ''; }); }; /** * Refresh guide element * @param {number} top - The number of guide element's style top * @param {number} height - The number of guide element's style height * @param {TZDate} start - start time of schedule to create * @param {TZDate} end - end time of schedule to create * @param {boolean} bottomLabel - is label need to render bottom of guide element? */ TimeCreationGuide.prototype._refreshGuideElement = function(top, height, start, end, bottomLabel) { var guideElement = this.guideElement; var timeElement = this.guideTimeElement; guideElement.style.top = top + 'px'; guideElement.style.height = height + 'px'; guideElement.style.display = 'block'; timeElement.innerHTML = datetime.format(start, 'HH:mm') + ' - ' + datetime.format(end, 'HH:mm'); if (bottomLabel) { domutil.removeClass(timeElement, config.classname('time-guide-bottom')); } else { domutil.addClass(timeElement, config.classname('time-guide-bottom')); } }; /** * Get unit data of calculating new style of guide element by user interaction * @param {Time} relatedView - time view instance related with schedule * @returns {array} unit data. */ TimeCreationGuide.prototype._getUnitData = function(relatedView) { var viewOpt = relatedView.options, viewHeight = relatedView.getViewBound().height, hourLength = viewOpt.hourEnd - viewOpt.hourStart, todayStart = datetime.parse(viewOpt.ymd), todayEnd = datetime.getStartOfNextDay(todayStart); todayStart.setHours(0, 0, 0, 0); todayStart.setHours(viewOpt.hourStart); // [0] height of view // [1] hour length of view // [2] start time of view // [3] end time of view // [4] height of view for one hour return [ viewHeight, hourLength, todayStart, todayEnd, viewHeight / hourLength ]; }; /** * Applying limitation to supplied data and return it. * @param {number} top - top pixel of guide element * @param {number} height - height pixel of guide element * @param {TZDate} start - relative time value of dragstart point * @param {TZDate} end - relative time value of dragend point * @returns {array} limited style data */ TimeCreationGuide.prototype._limitStyleData = function(top, height, start, end) { var unitData = this._styleUnit; top = common.limit(top, [0], [unitData[0]]); height = common.limit(top + height, [0], [unitData[0]]) - top; start = common.limitDate(start, unitData[2], unitData[3]); end = common.limitDate(end, unitData[2], unitData[3]); return [top, height, start, end]; }; /** * Get function to calculate guide element UI data from supplied units * @param {number} viewHeight - total height of view's container element * @param {number} hourLength - hour length that rendered in time view * @param {TZDate} todayStart - time for view's start date * @returns {function} UI data calculator function */ TimeCreationGuide.prototype._getStyleDataFunc = function(viewHeight, hourLength, todayStart) { var todayStartTime = todayStart; var todayEndTime = datetime.end(todayStart); /** * Get top, time value from schedule data * @param {object} scheduleData - schedule data object * @returns {number[]} top, time */ function getStyleData(scheduleData) { var minMinutes = 30; var gridY = scheduleData.nearestGridY, gridTimeY = scheduleData.nearestGridTimeY, gridEndTimeY = scheduleData.nearestGridEndTimeY || new TZDate(gridTimeY).addMinutes(minMinutes), top, startTime, endTime; top = common.limit(ratio(hourLength, viewHeight, gridY), [0], [viewHeight]); startTime = common.limitDate(gridTimeY, todayStartTime, todayEndTime); endTime = common.limitDate(gridEndTimeY, todayStartTime, todayEndTime); return [top, startTime, endTime]; } return getStyleData; }; /** * DragStart event handler * @param {object} dragStartEventData - dragStart schedule data. */ TimeCreationGuide.prototype._createGuideElement = function(dragStartEventData) { var relatedView = dragStartEventData.relatedView, hourStart = datetime.millisecondsFrom('hour', dragStartEventData.hourStart) || 0, unitData, styleFunc, styleData, result, top, height, start, end; unitData = this._styleUnit = this._getUnitData(relatedView); styleFunc = this._styleFunc = this._getStyleDataFunc.apply(this, unitData); styleData = this._styleStart = styleFunc(dragStartEventData); start = new TZDate(styleData[1]).addMinutes(datetime.minutesFromHours(hourStart)); end = new TZDate(styleData[2]).addMinutes(datetime.minutesFromHours(hourStart)); top = styleData[0]; height = (unitData[4] * (end - start) / MIN60); result = this._limitStyleData( top, height, start, end ); this._refreshGuideElement.apply(this, result); relatedView.container.appendChild(this.guideElement); }; /** * Drag event handler * @param {object} dragEventData - drag schedule data. */ TimeCreationGuide.prototype._onDrag = function(dragEventData) { var minutes30 = 30; var styleFunc = this._styleFunc, unitData = this._styleUnit, startStyle = this._styleStart, refreshGuideElement = this._refreshGuideElement.bind(this), heightOfHalfHour, endStyle, result; if (!styleFunc || !unitData || !startStyle) { return; } heightOfHalfHour = (unitData[4] / 2); endStyle = styleFunc(dragEventData); if (endStyle[0] > startStyle[0]) { result = this._limitStyleData( startStyle[0], (endStyle[0] - startStyle[0]) + heightOfHalfHour, startStyle[1], new TZDate(endStyle[1]).addMinutes(minutes30) ); } else { result = this._limitStyleData( endStyle[0], (startStyle[0] - endStyle[0]) + heightOfHalfHour, endStyle[1], new TZDate(startStyle[1]).addMinutes(minutes30) ); result.push(true); } reqAnimFrame.requestAnimFrame(function() { refreshGuideElement.apply(null, result); }); }; TimeCreationGuide.prototype.applyTheme = function(theme) { var style = this.guideElement.style; var timeStyle = this.guideTimeElement.style; // block style.backgroundColor = theme.common.creationGuide.backgroundColor; style.border = theme.common.creationGuide.border; // label timeStyle.color = theme.week.creationGuide.color; timeStyle.fontSize = theme.week.creationGuide.fontSize; timeStyle.fontWeight = theme.week.creationGuide.fontWeight; }; module.exports = TimeCreationGuide; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./src/js/handler/time/move.js": /*!*************************************!*\ !*** ./src/js/handler/time/move.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Handling move schedules from drag handler and time grid view * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var domevent = __webpack_require__(/*! ../../common/domevent */ "./src/js/common/domevent.js"); var TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date; var timeCore = __webpack_require__(/*! ./core */ "./src/js/handler/time/core.js"); var TimeMoveGuide = __webpack_require__(/*! ./moveGuide */ "./src/js/handler/time/moveGuide.js"); /** * @constructor * @implements {Handler} * @mixes timeCore * @mixes util.CustomEvents * @param {Drag} [dragHandler] - Drag handler instance. * @param {TimeGrid} [timeGridView] - TimeGrid view instance. * @param {Base} [baseController] - Base controller instance. */ function TimeMove(dragHandler, timeGridView, baseController) { /** * @type {Drag} */ this.dragHandler = dragHandler; /** * @type {TimeGrid} */ this.timeGridView = timeGridView; /** * @type {Base} */ this.baseController = baseController; /** * @type {function} */ this._getScheduleDataFunc = null; /** * @type {object} */ this._dragStart = null; /** * @type {TimeMoveGuide} */ this._guide = new TimeMoveGuide(this); dragHandler.on('dragStart', this._onDragStart, this); dragHandler.on('mousedown', this._onMouseDown, this); } /** * Destroy method. */ TimeMove.prototype.destroy = function() { this._guide.destroy(); this.dragHandler.off(this); this.dragHandler = this.timeGridView = this.baseController = this._getScheduleDataFunc = this._dragStart = this._guide = null; }; /** * Check target element is expected condition for activate this plugins. * @param {HTMLElement} target - The element to check * @returns {boolean|object} - return object when satiate condition. */ TimeMove.prototype.checkExpectCondition = function(target) { if (!domutil.closest(target, config.classname('.time-schedule'))) { return false; } return this._getTimeView(target); }; /** * Get Time view container from supplied element. * @param {HTMLElement} target - element to find time view container. * @returns {object|boolean} - return time view instance when finded. */ TimeMove.prototype._getTimeView = function(target) { var container = domutil.closest(target, config.classname('.time-date')), matches; if (!container) { return false; } matches = domutil.getClass(container).match(config.time.getViewIDRegExp); if (!matches || matches.length < 2) { return false; } return util.pick(this.timeGridView.children.items, Number(matches[1])); }; /** * @emits TimeMove#mousedown * @param {object} mouseDownEventData - Drag#mousedown schedule data. */ TimeMove.prototype._onMouseDown = function(mouseDownEventData) { var target = mouseDownEventData.target, timeView = this.checkExpectCondition(target), blockElement = domutil.closest(target, config.classname('.time-date-schedule-block')); if (!timeView || !blockElement) { return; } // EventTarget.target is not changed in mousemove event even if mouse is over the other element. // It's different with other browsers(IE, Chrome, Safari) if (util.browser.firefox) { domevent.preventDefault(mouseDownEventData.originEvent); } }; /** * @emits TimeMove#timeMoveDragstart * @param {object} dragStartEventData - Drag#dragStart schedule data. */ TimeMove.prototype._onDragStart = function(dragStartEventData) { var target = dragStartEventData.target, timeView = this.checkExpectCondition(target), blockElement = domutil.closest(target, config.classname('.time-date-schedule-block')), getScheduleDataFunc, scheduleData, ctrl = this.baseController, targetModelID, targetModel; if (!timeView || !blockElement) { return; } targetModelID = domutil.getData(blockElement, 'id'); targetModel = ctrl.schedules.items[targetModelID]; if (targetModel.isReadOnly) { return; } getScheduleDataFunc = this._getScheduleDataFunc = this._retriveScheduleData(timeView); scheduleData = this._dragStart = getScheduleDataFunc( dragStartEventData.originEvent, { targetModelID: targetModelID, model: targetModel } ); this.dragHandler.on({ drag: this._onDrag, dragEnd: this._onDragEnd, click: this._onClick }, this); /** * @event TimeMove#timeMoveDragstart * @type {object} * @property {HTMLElement} target - current target in mouse event object. * @property {Time} relatedView - time view instance related with mouse position. * @property {MouseEvent} originEvent - mouse event object. * @property {number} mouseY - mouse Y px mouse event. * @property {number} gridY - grid Y index value related with mouseY value. * @property {number} timeY - milliseconds value of mouseY points. * @property {number} nearestGridY - nearest grid index related with mouseY value. * @property {number} nearestGridTimeY - time value for nearestGridY. * @property {string} targetModelID - The model unique id emitted move schedule. * @property {Schedule} model - model instance */ this.fire('timeMoveDragstart', scheduleData); }; /** * @emits TimeMove#timeMoveDrag * @param {MouseEvent} dragEventData - mousemove event object * @param {string} [overrideEventName] - name of emitting event to override. * @param {function} [revise] - supply function for revise schedule data before emit. */ TimeMove.prototype._onDrag = function(dragEventData, overrideEventName, revise) { var getScheduleDataFunc = this._getScheduleDataFunc, timeView = this._getTimeView(dragEventData.target), dragStart = this._dragStart, scheduleData; if (!timeView || !getScheduleDataFunc || !dragStart) { return; } scheduleData = getScheduleDataFunc(dragEventData.originEvent, { currentView: timeView, targetModelID: dragStart.targetModelID }); if (revise) { revise(scheduleData); } /** * @event TimeMove#timeMoveDrag * @type {object} * @property {HTMLElement} target - current target in mouse event object. * @property {Time} relatedView - time view instance related with drag start position. * @property {MouseEvent} originEvent - mouse event object. * @property {number} mouseY - mouse Y px mouse event. * @property {number} gridY - grid Y index value related with mouseY value. * @property {number} timeY - milliseconds value of mouseY points. * @property {number} nearestGridY - nearest grid index related with mouseY value. * @property {number} nearestGridTimeY - time value for nearestGridY. * @property {Time} currentView - time view instance related with current mouse position. * @property {string} targetModelID - The model unique id emitted move schedule. */ this.fire(overrideEventName || 'timeMoveDrag', scheduleData); }; /** * Update model instance by dragend event results. * @fires TimeMove#beforeUpdateSchedule * @param {object} scheduleData - schedule data from TimeMove#timeMoveDragend */ TimeMove.prototype._updateSchedule = function(scheduleData) { var ctrl = this.baseController, modelID = scheduleData.targetModelID, range = scheduleData.nearestRange, timeDiff = range[1] - range[0], dateDiff = 0, schedule = ctrl.schedules.items[modelID], relatedView = scheduleData.relatedView, currentView = scheduleData.currentView, newStarts, newEnds; if (!schedule || !currentView) { return; } timeDiff -= datetime.millisecondsFrom('minutes', 30); newStarts = new TZDate(schedule.getStarts()).addMilliseconds(timeDiff); newEnds = new TZDate(schedule.getEnds()).addMilliseconds(timeDiff); if (currentView) { dateDiff = currentView.getDate() - relatedView.getDate(); } newStarts.addMilliseconds(dateDiff); newEnds.addMilliseconds(dateDiff); /** * @event TimeMove#beforeUpdateSchedule * @type {object} * @property {Schedule} schedule - The original schedule instance * @property {Date} start - Deprecated: start time to update * @property {Date} end - Deprecated: end time to update * @property {object} changes - start and end time to update * @property {Date} start - start time to update * @property {Date} end - end time to update */ this.fire('beforeUpdateSchedule', { schedule: schedule, changes: { start: newStarts, end: newEnds }, start: newStarts, end: newEnds }); }; /** * @emits TimeMove#timeMoveDragend * @param {MouseEvent} dragEndEventData - mouseup mouse event object. */ TimeMove.prototype._onDragEnd = function(dragEndEventData) { var getScheduleDataFunc = this._getScheduleDataFunc, currentView = this._getTimeView(dragEndEventData.target), dragStart = this._dragStart, scheduleData; this.dragHandler.off({ drag: this._onDrag, dragEnd: this._onDragEnd, click: this._onClick }, this); if (!getScheduleDataFunc || !dragStart) { return; } scheduleData = getScheduleDataFunc(dragEndEventData.originEvent, { currentView: currentView, targetModelID: dragStart.targetModelID }); scheduleData.range = [ dragStart.timeY, new TZDate(scheduleData.timeY).addMinutes(30) ]; scheduleData.nearestRange = [ dragStart.nearestGridTimeY, new TZDate(scheduleData.nearestGridTimeY).addMinutes(30) ]; this._updateSchedule(scheduleData); /** * @event TimeMove#timeMoveDragend * @type {object} * @property {HTMLElement} target - current target in mouse event object. * @property {Time} relatedView - time view instance related with drag start position. * @property {Time} currentView - time view instance related with current mouse position. * @property {MouseEvent} originEvent - mouse event object. * @property {number} mouseY - mouse Y px mouse event. * @property {number} gridY - grid Y index value related with mouseY value. * @property {number} timeY - milliseconds value of mouseY points. * @property {number} nearestGridY - nearest grid index related with mouseY value. * @property {number} nearestGridTimeY - time value for nearestGridY. * @property {string} targetModelID - The model unique id emitted move schedule. * @property {number[]} range - milliseconds range between drag start and end. * @property {number[]} nearestRange - milliseconds range related with nearestGridY between start and end. */ this.fire('timeMoveDragend', scheduleData); }; /** * @emits TimeMove#timeMoveClick * @param {MouseEvent} clickEventData - click mouse event object. */ TimeMove.prototype._onClick = function(clickEventData) { var getScheduleDataFunc = this._getScheduleDataFunc, dragStart = this._dragStart, scheduleData; this.dragHandler.off({ drag: this._onDrag, dragEnd: this._onDragEnd, click: this._onClick }, this); if (!getScheduleDataFunc || !dragStart) { return; } scheduleData = getScheduleDataFunc(clickEventData.originEvent, { targetModelID: dragStart.targetModelID }); /** * @event TimeMove#timeMoveClick * @type {object} * @property {HTMLElement} target - current target in mouse event object. * @property {Time} relatedView - time view instance related with drag start position. * @property {MouseEvent} originEvent - mouse event object. * @property {number} mouseY - mouse Y px mouse event. * @property {number} gridY - grid Y index value related with mouseY value. * @property {number} timeY - milliseconds value of mouseY points. * @property {number} nearestGridY - nearest grid index related with mouseY value. * @property {number} nearestGridTimeY - time value for nearestGridY. * @property {string} targetModelID - The model unique id emitted move schedule. */ this.fire('timeMoveClick', scheduleData); }; timeCore.mixin(TimeMove); util.CustomEvents.mixin(TimeMove); module.exports = TimeMove; /***/ }), /***/ "./src/js/handler/time/moveGuide.js": /*!******************************************!*\ !*** ./src/js/handler/time/moveGuide.js ***! \******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/** * @fileoverview Module for Time.Move effect while dragging. * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var reqAnimFrame = __webpack_require__(/*! ../../common/reqAnimFrame */ "./src/js/common/reqAnimFrame.js"); var ratio = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js").ratio; var FloatingLayer = __webpack_require__(/*! ../../common/floatingLayer */ "./src/js/common/floatingLayer.js"); var tmpl = __webpack_require__(/*! ../../view/template/week/timeMoveGuide.hbs */ "./src/js/view/template/week/timeMoveGuide.hbs"); var TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date; var Schedule = __webpack_require__(/*! ../../model/schedule */ "./src/js/model/schedule.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"); var SCHEDULE_MIN_DURATION = datetime.MILLISECONDS_SCHEDULE_MIN_DURATION; /** * Class for Time.Move effect. * @constructor * @param {TimeMove} timeMove - The instance of TimeMove. */ function TimeMoveGuide(timeMove) { /** * @type {FloatingLayer} */ this._guideLayer = null; /** * @Type {Schedule} */ this._model = null; /** * @type {object} */ this._viewModel = null; /** * @type {object} */ this._lastDrag = null; /** * @type {HTMLElement} */ this.guideElement = null; /** * @type {TimeMove} */ this.timeMove = timeMove; /** * @type {HTMLElement} */ this._container = null; /** * @type {function} */ this._getTopFunc = null; /** * @type {number} */ this._startGridY = 0; /** * @type {number} */ this._startTopPixel = 0; timeMove.on({ 'timeMoveDragstart': this._onDragStart, 'timeMoveDrag': this._onDrag, 'timeMoveDragend': this._clearGuideElement, 'timeMoveClick': this._clearGuideElement }, this); } /** * Destroy method */ TimeMoveGuide.prototype.destroy = function() { this._clearGuideElement(); this.timeMove.off(this); if (this._guideLayer) { this._guideLayer.destroy(); } this.guideElement = this.timeMove = this._container = this._guideLayer = this._lastDrag = this._getTopFunc = this._startGridY = this._startTopPixel = this._viewModel = null; }; /** * Clear guide element. */ TimeMoveGuide.prototype._clearGuideElement = function() { if (!util.browser.msie) { domutil.removeClass(global.document.body, config.classname('dragging')); } if (this._guideLayer) { this._guideLayer.destroy(); } this._showOriginScheduleBlocks(); this.guideElement = this._getTopFunc = this._guideLayer = this._model = this._lastDrag = this._startGridY = this._startTopPixel = this._viewModel = null; }; /** * Dim element blocks * @param {number} modelID - Schedule model instance ID */ TimeMoveGuide.prototype._hideOriginScheduleBlocks = function() { var className = config.classname('time-date-schedule-block-dragging-dim'); if (this.guideElement) { domutil.addClass(this.guideElement, className); } }; /** * Show element blocks */ TimeMoveGuide.prototype._showOriginScheduleBlocks = function() { var className = config.classname('time-date-schedule-block-dragging-dim'); if (this.guideElement) { domutil.removeClass(this.guideElement, className); } }; /** * Refresh guide element * @param {string} top - guide element's style top. * @param {Schedule} model - updated model * @param {object} viewModel - view model */ TimeMoveGuide.prototype._refreshGuideElement = function(top, model, viewModel) { var self = this; reqAnimFrame.requestAnimFrame(function() { if (!self._guideLayer) { return; } self._guideLayer.setPosition(0, top); self._guideLayer.setContent(tmpl(util.extend({model: model}, viewModel))); }); }; /** * TimeMove#timeMoveDragstart event handler * @param {object} dragStartEventData - dragstart event data */ TimeMoveGuide.prototype._onDragStart = function(dragStartEventData) { var guideElement = domutil.closest( dragStartEventData.target, config.classname('.time-date-schedule-block') ); var duration, modelDuration, goingDuration, comingDuration; if (!guideElement) { return; } this._startTopPixel = parseFloat(guideElement.style.top); this._startGridY = dragStartEventData.nearestGridY; this.guideElement = guideElement; this._container = dragStartEventData.relatedView.container; this._model = util.extend( Schedule.create(dragStartEventData.model), dragStartEventData.model ); modelDuration = this._model.duration(); modelDuration = modelDuration > SCHEDULE_MIN_DURATION ? modelDuration : SCHEDULE_MIN_DURATION; goingDuration = datetime.millisecondsFrom('minutes', this._model.goingDuration); comingDuration = datetime.millisecondsFrom('minutes', this._model.comingDuration); duration = goingDuration + modelDuration + comingDuration; this._lastDrag = dragStartEventData; this._viewModel = { hasGoingDuration: goingDuration > 0, hasComingDuration: comingDuration > 0, goingDurationHeight: common.ratio(duration, goingDuration, 100), modelDurationHeight: common.ratio(duration, modelDuration, 100), comingDurationHeight: common.ratio(duration, comingDuration, 100) }; this._resetGuideLayer(); this._hideOriginScheduleBlocks(); }; /** * TimeMove#timeMoveDrag event handler * @param {object} dragEventData - drag event data */ TimeMoveGuide.prototype._onDrag = function(dragEventData) { var timeView = dragEventData.currentView, viewOptions = timeView.options, viewHeight = timeView.getViewBound().height, guideHeight = parseFloat(this.guideElement.style.height), hourLength = viewOptions.hourEnd - viewOptions.hourStart, gridYOffset = dragEventData.nearestGridY - this._startGridY, gridYOffsetPixel = ratio(hourLength, viewHeight, gridYOffset), gridDiff = dragEventData.nearestGridY - this._lastDrag.nearestGridY, bottomLimit, top; if (!util.browser.msie) { domutil.addClass(global.document.body, config.classname('dragging')); } if (this._container !== timeView.container) { this._container = timeView.container; this._resetGuideLayer(); } top = this._startTopPixel + gridYOffsetPixel; bottomLimit = viewHeight - guideHeight; top = Math.max(top, 0); top = Math.min(top, bottomLimit); // update time this._model.start = new TZDate(this._model.getStarts()).addMinutes(datetime.minutesFromHours(gridDiff)); this._model.end = new TZDate(this._model.getEnds()).addMinutes(datetime.minutesFromHours(gridDiff)); this._lastDrag = dragEventData; this._refreshGuideElement(top, this._model, this._viewModel); }; TimeMoveGuide.prototype._resetGuideLayer = function() { if (this._guideLayer) { this._guideLayer.destroy(); this._guideLayer = null; } this._guideLayer = new FloatingLayer(null, this._container); this._guideLayer.setSize(this._container.getBoundingClientRect().width, this.guideElement.style.height); this._guideLayer.setPosition(0, this.guideElement.style.top); this._guideLayer.setContent(tmpl(util.extend({model: this._model}, this._viewModel))); this._guideLayer.show(); }; module.exports = TimeMoveGuide; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./src/js/handler/time/resize.js": /*!***************************************!*\ !*** ./src/js/handler/time/resize.js ***! \***************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Handling resize schedules from drag handler and time grid view * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date; var common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"); var timeCore = __webpack_require__(/*! ./core */ "./src/js/handler/time/core.js"); var TimeResizeGuide = __webpack_require__(/*! ./resizeGuide */ "./src/js/handler/time/resizeGuide.js"); /** * @constructor * @implements {Handler} * @mixes timeCore * @mixes util.CustomEvents * @param {Drag} [dragHandler] - Drag handler instance. * @param {TimeGrid} [timeGridView] - TimeGrid view instance. * @param {Base} [baseController] - Base controller instance. */ function TimeResize(dragHandler, timeGridView, baseController) { /** * @type {Drag} */ this.dragHandler = dragHandler; /** * @type {TimeGrid} */ this.timeGridView = timeGridView; /** * @type {Base} */ this.baseController = baseController; /** * @type {function} */ this._getScheduleDataFunc = null; /** * @type {object} */ this._dragStart = null; /** * @type {TimeResizeGuide} */ this._guide = new TimeResizeGuide(this); dragHandler.on('dragStart', this._onDragStart, this); } /** * Destroy method */ TimeResize.prototype.destroy = function() { this._guide.destroy(); this.dragHandler.off(this); this.dragHandler = this.timeGridView = this.baseController = this._getScheduleDataFunc = this._dragStart = this._guide = null; }; /** * @param {HTMLElement} target - element to check condition. * @returns {object|boolean} - return time view instance or false */ TimeResize.prototype.checkExpectCondition = function(target) { var container, matches; if (!domutil.hasClass(target, config.classname('time-resize-handle'))) { return false; } container = domutil.closest(target, config.classname('.time-date')); if (!container) { return false; } matches = domutil.getClass(container).match(config.time.getViewIDRegExp); if (!matches || matches.length < 2) { return false; } return util.pick(this.timeGridView.children.items, Number(matches[1])); }; /** * @emits TimeResize#timeResizeDragstart * @param {object} dragStartEventData - event data of Drag#dragstart */ TimeResize.prototype._onDragStart = function(dragStartEventData) { var target = dragStartEventData.target, timeView = this.checkExpectCondition(target), blockElement = domutil.closest(target, config.classname('.time-date-schedule-block')), ctrl = this.baseController, targetModelID, getScheduleDataFunc, scheduleData; if (!timeView || !blockElement) { return; } targetModelID = domutil.getData(blockElement, 'id'); getScheduleDataFunc = this._getScheduleDataFunc = this._retriveScheduleData(timeView); scheduleData = this._dragStart = getScheduleDataFunc( dragStartEventData.originEvent, { targetModelID: targetModelID, schedule: ctrl.schedules.items[targetModelID] } ); this.dragHandler.on({ drag: this._onDrag, dragEnd: this._onDragEnd, click: this._onClick }, this); /** * @event TimeResize#timeResizeDragstart * @type {object} * @property {HTMLElement} target - current target in mouse event object. * @property {Time} relatedView - time view instance related with mouse position. * @property {MouseEvent} originEvent - mouse event object. * @property {number} mouseY - mouse Y px mouse event. * @property {number} gridY - grid Y index value related with mouseY value. * @property {number} timeY - milliseconds value of mouseY points. * @property {number} nearestGridY - nearest grid index related with mouseY value. * @property {number} nearestGridTimeY - time value for nearestGridY. * @property {string} targetModelID - The model unique id emitted move schedule. * @property {Schedule} schedule - schedule data */ this.fire('timeResizeDragstart', scheduleData); }; /** * Drag#drag event handler * @emits TimeResize#timeResizeDrag * @param {object} dragEventData - event data of Drag#drag custom event. * @param {string} [overrideEventName] - override emitted event name when supplied. * @param {function} [revise] - supply function for revise schedule data before emit. */ TimeResize.prototype._onDrag = function(dragEventData, overrideEventName, revise) { var getScheduleDataFunc = this._getScheduleDataFunc, startScheduleData = this._dragStart, scheduleData; if (!getScheduleDataFunc || !startScheduleData) { return; } scheduleData = getScheduleDataFunc(dragEventData.originEvent, { targetModelID: startScheduleData.targetModelID }); if (revise) { revise(scheduleData); } /** * @event TimeResize#timeResizeDrag * @type {object} * @property {HTMLElement} target - current target in mouse event object. * @property {Time} relatedView - time view instance related with drag start position. * @property {MouseEvent} originEvent - mouse event object. * @property {number} mouseY - mouse Y px mouse event. * @property {number} gridY - grid Y index value related with mouseY value. * @property {number} timeY - milliseconds value of mouseY points. * @property {number} nearestGridY - nearest grid index related with mouseY value. * @property {number} nearestGridTimeY - time value for nearestGridY. * @property {string} targetModelID - The model unique id emitted move schedule. */ this.fire(overrideEventName || 'timeResizeDrag', scheduleData); }; /** * Update model instance by dragend event results. * @fires TimeResize#beforeUpdateSchedule * @param {object} scheduleData - schedule data from TimeResize#timeResizeDragend */ TimeResize.prototype._updateSchedule = function(scheduleData) { var ctrl = this.baseController, modelID = scheduleData.targetModelID, range = scheduleData.nearestRange, timeDiff = range[1] - range[0], schedule = ctrl.schedules.items[modelID], relatedView = scheduleData.relatedView, dateEnd, newEnds, baseDate; var changes; if (!schedule) { return; } timeDiff -= datetime.millisecondsFrom('minutes', 30); baseDate = new TZDate(relatedView.getDate()); dateEnd = datetime.end(baseDate); newEnds = new TZDate(schedule.getEnds()).addMilliseconds(timeDiff); if (newEnds > dateEnd) { newEnds = new TZDate(dateEnd); } if (newEnds.getTime() - schedule.getStarts().getTime() < datetime.millisecondsFrom('minutes', 30)) { newEnds = new TZDate(schedule.getStarts()).addMinutes(30); } changes = common.getScheduleChanges( schedule, ['end'], {end: newEnds} ); /** * @event TimeResize#beforeUpdateSchedule * @type {object} * @property {Schedule} schedule - The original schedule instance * @property {Date} start - Deprecated: start time to update * @property {Date} end - Deprecated: end time to update * @property {object} changes - end time to update * @property {date} end - end time to update */ this.fire('beforeUpdateSchedule', { schedule: schedule, changes: changes, start: schedule.getStarts(), end: newEnds }); }; /** * Drag#dragEnd event handler * @emits TimeResize#timeResizeDragend * @param {MouseEvent} dragEndEventData - Mouse event of Drag#dragEnd custom event. */ TimeResize.prototype._onDragEnd = function(dragEndEventData) { var getScheduleDataFunc = this._getScheduleDataFunc, dragStart = this._dragStart, scheduleData; this.dragHandler.off({ drag: this._onDrag, dragEnd: this._onDragEnd, click: this._onClick }, this); if (!getScheduleDataFunc || !dragStart) { return; } scheduleData = getScheduleDataFunc(dragEndEventData.originEvent, { targetModelID: dragStart.targetModelID }); scheduleData.range = [ dragStart.timeY, new TZDate(scheduleData.timeY).addMinutes(30) ]; scheduleData.nearestRange = [ dragStart.nearestGridTimeY, scheduleData.nearestGridTimeY.addMinutes(30) ]; this._updateSchedule(scheduleData); /** * @event TimeResize#timeResizeDragend * @type {object} * @property {HTMLElement} target - current target in mouse event object. * @property {Time} relatedView - time view instance related with drag start position. * @property {MouseEvent} originEvent - mouse event object. * @property {number} mouseY - mouse Y px mouse event. * @property {number} gridY - grid Y index value related with mouseY value. * @property {number} timeY - milliseconds value of mouseY points. * @property {number} nearestGridY - nearest grid index related with mouseY value. * @property {number} nearestGridTimeY - time value for nearestGridY. * @property {string} targetModelID - The model unique id emitted move schedule. * @property {number[]} range - milliseconds range between drag start and end. * @property {number[]} nearestRange - milliseconds range related with nearestGridY between start and end. */ this.fire('timeResizeDragend', scheduleData); this._getScheduleDataFunc = this._dragStart = null; }; /** * @emits TimeResize#timeResizeClick */ TimeResize.prototype._onClick = function() { this.dragHandler.off({ drag: this._onDrag, dragEnd: this._onDragEnd, click: this._onClick }, this); /** * @event TimeResize#timeResizeClick */ this.fire('timeResizeClick'); }; timeCore.mixin(TimeResize); util.CustomEvents.mixin(TimeResize); module.exports = TimeResize; /***/ }), /***/ "./src/js/handler/time/resizeGuide.js": /*!********************************************!*\ !*** ./src/js/handler/time/resizeGuide.js ***! \********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/** * @fileoverview Module for Time.Resize effect while dragging. * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var reqAnimFrame = __webpack_require__(/*! ../../common/reqAnimFrame */ "./src/js/common/reqAnimFrame.js"); var ratio = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js").ratio; var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); /** * Class for Time.Resize effect. * @constructor * @param {TimeResize} timeResize - the instance of TimeResize handler. */ function TimeResizeGuide(timeResize) { /** * @type {HTMLElement} */ this.guideElement = null; /** * @type {TimeResize} */ this.timeResize = timeResize; /** * @type {function} */ this._getTopFunc = null; /** * @type {HTMLElement} */ this._originScheduleElement = null; /** * @type {number} */ this._startTopPixel = 0; /** * @type {number} */ this._startHeightPixel = 0; /** * @type {number} */ this._startGridY = 0; /** * @type {Schedule} */ this._schedule = null; timeResize.on({ 'timeResizeDragstart': this._onDragStart, 'timeResizeDrag': this._onDrag, 'timeResizeDragend': this._clearGuideElement, 'timeResizeClick': this._clearGuideElement }, this); } /** * Destroy method */ TimeResizeGuide.prototype.destroy = function() { this._clearGuideElement(); this.timeResize.off(this); this.guideElement = this.timeResize = this._getTopFunc = this._originScheduleElement = this._startHeightPixel = this._startGridY = this._startTopPixel = null; }; /** * Clear guide element. */ TimeResizeGuide.prototype._clearGuideElement = function() { var guideElement = this.guideElement, originElement = this._originScheduleElement; if (!util.browser.msie) { domutil.removeClass(global.document.body, config.classname('resizing')); } if (originElement) { originElement.style.display = 'block'; } domutil.remove(guideElement); this.guideElement = this._getTopFunc = this._originScheduleElement = this._startHeightPixel = this._startGridY = this._startTopPixel = null; }; /** * Refresh guide element * @param {number} guideHeight - guide element's style height. * @param {number} minTimeHeight - time element's min height * @param {number} timeHeight - time element's height. */ TimeResizeGuide.prototype._refreshGuideElement = function(guideHeight, minTimeHeight, timeHeight) { var guideElement = this.guideElement; var timeElement; if (!guideElement) { return; } timeElement = domutil.find(config.classname('.time-schedule-content-time'), guideElement); reqAnimFrame.requestAnimFrame(function() { guideElement.style.height = guideHeight + 'px'; guideElement.style.display = 'block'; if (timeElement) { timeElement.style.height = timeHeight + 'px'; timeElement.style.minHeight = minTimeHeight + 'px'; } }); }; /** * TimeMove#timeMoveDragstart event handler * @param {object} dragStartEventData - dragstart event data */ TimeResizeGuide.prototype._onDragStart = function(dragStartEventData) { var originElement = domutil.closest( dragStartEventData.target, config.classname('.time-date-schedule-block') ), schedule = dragStartEventData.schedule, guideElement; if (!util.browser.msie) { domutil.addClass(global.document.body, config.classname('resizing')); } if (!originElement || !schedule) { return; } this._startGridY = dragStartEventData.nearestGridY; this._startHeightPixel = parseFloat(originElement.style.height); this._startTopPixel = parseFloat(originElement.style.top); this._originScheduleElement = originElement; this._schedule = schedule; guideElement = this.guideElement = originElement.cloneNode(true); domutil.addClass(guideElement, config.classname('time-guide-resize')); originElement.style.display = 'none'; dragStartEventData.relatedView.container.appendChild(guideElement); }; /** * @param {object} dragEventData - event data from Drag#drag. */ TimeResizeGuide.prototype._onDrag = function(dragEventData) { var timeView = dragEventData.relatedView, viewOptions = timeView.options, viewHeight = timeView.getViewBound().height, hourLength = viewOptions.hourEnd - viewOptions.hourStart, guideElement = this.guideElement, guideTop = parseFloat(guideElement.style.top), gridYOffset = dragEventData.nearestGridY - this._startGridY, // hourLength : viewHeight = gridYOffset : X; gridYOffsetPixel = ratio(hourLength, viewHeight, gridYOffset), goingDuration = this._schedule.goingDuration, modelDuration = this._schedule.duration() / datetime.MILLISECONDS_PER_MINUTES, comingDuration = this._schedule.comingDuration, minutesLength = hourLength * 60, timeHeight, timeMinHeight, minHeight, maxHeight, height; height = (this._startHeightPixel + gridYOffsetPixel); // at least large than 30min from schedule start time. minHeight = guideTop + ratio(hourLength, viewHeight, 0.5); minHeight -= this._startTopPixel; timeMinHeight = minHeight; minHeight += ratio(minutesLength, viewHeight, goingDuration) + ratio(minutesLength, viewHeight, comingDuration); // smaller than 24h maxHeight = viewHeight - guideTop; height = Math.max(height, minHeight); height = Math.min(height, maxHeight); timeHeight = ratio(minutesLength, viewHeight, modelDuration) + gridYOffsetPixel; this._refreshGuideElement(height, timeMinHeight, timeHeight); }; module.exports = TimeResizeGuide; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) /***/ }), /***/ "./src/js/model/schedule.js": /*!**********************************!*\ !*** ./src/js/model/schedule.js ***! \**********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint complexity: 0 */ /** * @fileoverview Model of schedule. * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var tz = __webpack_require__(/*! ../common/timezone */ "./src/js/common/timezone.js"); var datetime = __webpack_require__(/*! ../common/datetime */ "./src/js/common/datetime.js"); var dirty = __webpack_require__(/*! ../common/dirty */ "./src/js/common/dirty.js"); var model = __webpack_require__(/*! ../common/model */ "./src/js/common/model.js"); var TZDate = tz.Date; var MIN_TO_MS = 60 * 1000; var SCHEDULE_MIN_DURATION = datetime.MILLISECONDS_SCHEDULE_MIN_DURATION; /** * Schedule category * @readonly * @enum {string} */ var SCHEDULE_CATEGORY = { /** milestone */ MILESTONE: 'milestone', /** task */ TASK: 'task', /** all-day schedule */ ALLDAY: 'allday', /** normal schedule */ TIME: 'time' }; /** * Get duration by primary timezone * @param {Date} start render start date * @param {Date} end render end date * @returns {number} duration */ function getDurationByPrimaryTimezone(start, end) { var checkOffset = tz.isDifferentOffsetStartAndEndTime(start.getTime(), end.getTime()); var isOffsetChanged = checkOffset.isOffsetChanged; var duration = end - start; if (isOffsetChanged !== 0) { duration += checkOffset.offsetDiff * MIN_TO_MS; } return duration; } /** * Get duration by native timezone * @param {TZDate} start render start date * @param {TZDate} end render end date * @returns {number} duration */ function getDurationByNativeTimezone(start, end) { var startOffset = start.toDate().getTimezoneOffset(); var endOffset = end.toDate().getTimezoneOffset(); return (end - start) + ((endOffset - startOffset) * MIN_TO_MS); } /** * The model of calendar schedules. * @constructor * @mixes dirty * @mixes model */ function Schedule() { /** * `Optional` unique id for various use. * @type {string} */ this.id = ''; /** * title for schedule. * @type {string} */ this.title = ''; /** * body for schedule. * @type {string} */ this.body = ''; /** * is schedule is all day schedule? * @type {boolean} */ this.isAllDay = false; /** * schedule start * @type {TZDate} */ this.start = null; /** * schedule end * @type {TZDate} */ this.end = null; /** * schedule text color * @type {string} */ this.color = '#000'; /** * schedule block visibility * @type {boolean} */ this.isVisible = true; /** * schedule background color * @type {string} */ this.bgColor = '#a1b56c'; /** * schedule background color when dragging it * @type {string} */ this.dragBgColor = '#a1b56c'; /** * schedule left border color * @type {string} */ this.borderColor = '#000'; /** * calendar ID * @type {string} */ this.calendarId = ''; /** * Schedule category(milestone, task, allday, time) * @type {string} */ this.category = ''; /** * Classification of work schedules (before work, before lunch, before work) * @type {string} */ this.dueDateClass = ''; /** * Custom style for schedule element * @type {string} */ this.customStyle = ''; /** * in progress flag to do something * @type {boolean} */ this.isPending = false; /** * focused schedule flag * @type {boolean} */ this.isFocused = false; /** * read-only schedule flag * @type {boolean} */ this.isReadOnly = false; /** * private schedule * @type {boolean} */ this.isPrivate = false; /** * location * @type {string} */ this.location = ''; /** * attendees * @type {Array.} */ this.attendees = []; /** * recurrence rule * @type {any} */ this.recurrenceRule = ''; /** * state. 'Busy' is default. * @type {string} */ this.state = ''; /** * travelTime: going-Duration minutes * @type {number} */ this.goingDuration = 0; /** * travelTime: coming-Duration minutes * @type {number} */ this.comingDuration = 0; /** * Separate data storage space independent of rendering. * @type {object} */ this.raw = null; // initialize model id util.stamp(this); } /********** * static props **********/ Schedule.schema = { required: ['title'], dateRange: ['start', 'end'] }; /** * create schedule model from json(object) data. * @param {object} data object for model. * @returns {Schedule} Schedule model instance. */ Schedule.create = function(data) { var inst = new Schedule(); inst.init(data); return inst; }; /********** * prototype props **********/ /** * Initialize schedule instance. * @param {object} options options. */ Schedule.prototype.init = function(options) { options = util.extend({}, options); if (options.category === SCHEDULE_CATEGORY.ALLDAY) { options.isAllDay = true; } this.id = options.id || ''; this.title = options.title || ''; this.body = options.body || ''; this.isAllDay = util.isExisty(options.isAllDay) ? options.isAllDay : false; this.isVisible = util.isExisty(options.isVisible) ? options.isVisible : true; this.color = options.color || this.color; this.bgColor = options.bgColor || this.bgColor; this.dragBgColor = options.dragBgColor || this.dragBgColor; this.borderColor = options.borderColor || this.borderColor; this.calendarId = options.calendarId || ''; this.category = options.category || ''; this.dueDateClass = options.dueDateClass || ''; this.customStyle = options.customStyle || ''; this.location = options.location || ''; this.attendees = options.attendees || []; this.recurrenceRule = options.recurrenceRule || ''; this.isPrivate = options.isPrivate || false; this.isPending = options.isPending || false; this.isFocused = options.isFocused || false; this.isReadOnly = options.isReadOnly || false; this.goingDuration = options.goingDuration || 0; this.comingDuration = options.comingDuration || 0; this.state = options.state || ''; if (this.isAllDay) { this.setAllDayPeriod(options.start, options.end); } else { this.setTimePeriod(options.start, options.end); } this.raw = options.raw || null; }; Schedule.prototype.setAllDayPeriod = function(start, end) { // If it is an all-day schedule, only the date information of the string is used. if (util.isString(start) && start.length === 10) { start = datetime.parse(start); } else { start = new TZDate(start || Date.now()); } if (util.isString(end) && end.length === 10) { end = datetime.parse(end); end.setHours(23, 59, 59); } else { end = new TZDate(end || start); } this.start = datetime.start(start); this.end = datetime.renderEnd(start, end); }; Schedule.prototype.setTimePeriod = function(start, end) { this.start = new TZDate(start || Date.now()); this.end = new TZDate(end || this.start); if (!end) { this.end.setMinutes(this.end.getMinutes() + 30); } }; /** * @returns {Date} render start date. */ Schedule.prototype.getStarts = function() { return this.start; }; /** * @returns {Date} render end date. */ Schedule.prototype.getEnds = function() { return this.end; }; /** * @returns {number} instance unique id. */ Schedule.prototype.cid = function() { return util.stamp(this); }; /** * Check two schedule are equals (means title, isAllDay, start, end are same) * @param {Schedule} schedule Schedule model instance to compare. * @returns {boolean} Return false when not same. */ Schedule.prototype.equals = function(schedule) { if (this.id !== schedule.id) { return false; } if (this.title !== schedule.title) { return false; } if (this.body !== schedule.body) { return false; } if (this.isAllDay !== schedule.isAllDay) { return false; } if (datetime.compare(this.getStarts(), schedule.getStarts()) !== 0) { return false; } if (datetime.compare(this.getEnds(), schedule.getEnds()) !== 0) { return false; } if (this.color !== schedule.color) { return false; } if (this.bgColor !== schedule.bgColor) { return false; } if (this.dragBgColor !== schedule.dragBgColor) { return false; } if (this.borderColor !== schedule.borderColor) { return false; } return true; }; /** * return duration between start and end. * @returns {Date} duration (UTC) */ Schedule.prototype.duration = function() { var start = this.getStarts(), end = this.getEnds(), duration; var hasPrimaryTimezoneCustomSetting = tz.hasPrimaryTimezoneCustomSetting(); if (this.isAllDay) { duration = datetime.end(end) - datetime.start(start); } else if (hasPrimaryTimezoneCustomSetting && tz.isPrimaryUsingDSTTimezone()) { duration = getDurationByPrimaryTimezone(start, end); } else if (hasPrimaryTimezoneCustomSetting && tz.isNativeOsUsingDSTTimezone()) { duration = getDurationByNativeTimezone(start, end); } else { duration = end - start; } return duration; }; /** * Returns true if the given Schedule coincides with the same time as the * calling Schedule. * @param {Schedule} schedule The other schedule to compare with this Schedule. * @returns {boolean} If the other schedule occurs within the same time as the first object. */ Schedule.prototype.collidesWith = function(schedule) { var ownStarts = this.getStarts(), ownEnds = this.getEnds(), start = schedule.getStarts(), end = schedule.getEnds(); var ownGoingDuration = datetime.millisecondsFrom('minutes', this.goingDuration), ownComingDuration = datetime.millisecondsFrom('minutes', this.comingDuration), goingDuration = datetime.millisecondsFrom('minutes', schedule.goingDuration), comingDuration = datetime.millisecondsFrom('minutes', schedule.comingDuration); if (Math.abs(ownEnds - ownStarts) < SCHEDULE_MIN_DURATION) { ownEnds += SCHEDULE_MIN_DURATION; } if (Math.abs(end - start) < SCHEDULE_MIN_DURATION) { end += SCHEDULE_MIN_DURATION; } ownStarts -= ownGoingDuration; ownEnds += ownComingDuration; start -= goingDuration; end += comingDuration; if ( (start > ownStarts && start < ownEnds) || (end > ownStarts && end < ownEnds) || (start <= ownStarts && end >= ownEnds) ) { return true; } return false; }; model.mixin(Schedule.prototype); dirty.mixin(Schedule.prototype); module.exports = Schedule; /***/ }), /***/ "./src/js/model/viewModel/scheduleViewModel.js": /*!*****************************************************!*\ !*** ./src/js/model/viewModel/scheduleViewModel.js ***! \*****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Model for views * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var SCHEDULE_MIN_DURATION = datetime.MILLISECONDS_SCHEDULE_MIN_DURATION; /** * Schedule ViewModel * @constructor * @param {Schedule} schedule Schedule instance. */ function ScheduleViewModel(schedule) { /** * The model of schedule. * @type {Schedule} */ this.model = schedule; /** * @type {number} */ this.top = 0; /** * @type {number} */ this.left = 0; /** * @type {number} */ this.width = 0; /** * @type {number} */ this.height = 0; /** * Represent schedule has collide with other schedules when rendering. * @type {boolean} */ this.hasCollide = false; /** * Extra space at rigth side of this schedule. * @type {number} */ this.extraSpace = 0; /** * represent this schedule block is not visible after rendered. * * in month view, some viewmodel in date need to hide when already rendered before dates. * * set true then it just shows empty space. * @type {boolean} */ this.hidden = false; /** * whether the schedule includes multiple dates */ this.hasMultiDates = false; /** * represent render start date used at rendering. * * if set null then use model's 'start' property. * @type {TZDate} */ this.renderStarts = null; /** * whether the actual start-date is before the render-start-date * @type {boolean} */ this.exceedLeft = false; /** * represent render end date used at rendering. * * if set null then use model's 'end' property. * @type {TZDate} */ this.renderEnds = null; /** * whether the actual end-date is after the render-end-date * @type {boolean} */ this.exceedRight = false; } /********** * static props **********/ /** * ScheduleViewModel factory method. * @param {Schedule} schedule Schedule instance. * @returns {ScheduleViewModel} ScheduleViewModel instance. */ ScheduleViewModel.create = function(schedule) { return new ScheduleViewModel(schedule); }; /********** * prototype props **********/ /** * return renderStarts property to render properly when specific schedule that exceed rendering date range. * * if renderStarts is not set. return model's start property. * @override * @returns {Date} render start date. */ ScheduleViewModel.prototype.getStarts = function() { if (this.renderStarts) { return this.renderStarts; } return this.model.start; }; /** * return renderStarts property to render properly when specific schedule that exceed rendering date range. * * if renderEnds is not set. return model's end property. * @override * @returns {Date} render end date. */ ScheduleViewModel.prototype.getEnds = function() { if (this.renderEnds) { return this.renderEnds; } return this.model.end; }; /** * @returns {number} unique number for model. */ ScheduleViewModel.prototype.cid = function() { return util.stamp(this.model); }; /** * Shadowing valueOf method for schedule sorting. * @returns {Schedule} The model of schedule. */ ScheduleViewModel.prototype.valueOf = function() { return this.model; }; /** * Link duration method * @returns {number} Schedule#duration result. */ ScheduleViewModel.prototype.duration = function() { return this.model.duration(); }; /** * Link collidesWith method * @param {Schedule|ScheduleViewModel} viewModel - Model or viewmodel instance of Schedule. * @returns {boolean} Schedule#collidesWith result. */ ScheduleViewModel.prototype.collidesWith = function(viewModel) { var ownStarts = this.getStarts(), ownEnds = this.getEnds(), start = viewModel.getStarts(), end = viewModel.getEnds(); var ownGoingDuration = datetime.millisecondsFrom('minutes', this.valueOf().goingDuration), ownComingDuration = datetime.millisecondsFrom('minutes', this.valueOf().comingDuration), goingDuration = datetime.millisecondsFrom('minutes', viewModel.valueOf().goingDuration), comingDuration = datetime.millisecondsFrom('minutes', viewModel.valueOf().comingDuration); if (Math.abs(ownEnds - ownStarts) < SCHEDULE_MIN_DURATION) { ownEnds += SCHEDULE_MIN_DURATION; } if (Math.abs(end - start) < SCHEDULE_MIN_DURATION) { end += SCHEDULE_MIN_DURATION; } ownStarts -= ownGoingDuration; ownEnds += ownComingDuration; start -= goingDuration; end += comingDuration; if ((start > ownStarts && start < ownEnds) || (end > ownStarts && end < ownEnds) || (start <= ownStarts && end >= ownEnds)) { return true; } return false; }; module.exports = ScheduleViewModel; /***/ }), /***/ "./src/js/theme/standard.js": /*!**********************************!*\ !*** ./src/js/theme/standard.js ***! \**********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview The standard theme * @author NHN FE Development Lab */ /** * "common" prefix is for entire calendar. "common" properties can be overriden by "week", "month". * "week" prefix is for weekly and daily view. * "month" prefix is for monthly view. */ var theme = { 'common.border': '1px solid #e5e5e5', 'common.backgroundColor': 'white', 'common.holiday.color': '#ff4040', 'common.saturday.color': '#333', 'common.dayname.color': '#333', 'common.today.color': '#333', // creation guide style 'common.creationGuide.backgroundColor': 'rgba(81, 92, 230, 0.05)', 'common.creationGuide.border': '1px solid #515ce6', // month header 'dayname' 'month.dayname.height': '31px', 'month.dayname.borderLeft': 'none', 'month.dayname.paddingLeft': '10px', 'month.dayname.paddingRight': '0', 'month.dayname.backgroundColor': 'inherit', 'month.dayname.fontSize': '12px', 'month.dayname.fontWeight': 'normal', 'month.dayname.textAlign': 'left', // month day grid cell 'day' 'month.holidayExceptThisMonth.color': 'rgba(255, 64, 64, 0.4)', 'month.dayExceptThisMonth.color': 'rgba(51, 51, 51, 0.4)', 'month.weekend.backgroundColor': 'inherit', 'month.day.fontSize': '14px', // month schedule style 'month.schedule.borderRadius': '2px', 'month.schedule.height': '24px', 'month.schedule.marginTop': '2px', 'month.schedule.marginLeft': '8px', 'month.schedule.marginRight': '8px', // month more view 'month.moreView.border': '1px solid #d5d5d5', 'month.moreView.boxShadow': '0 2px 6px 0 rgba(0, 0, 0, 0.1)', 'month.moreView.backgroundColor': 'white', 'month.moreView.paddingBottom': '17px', 'month.moreViewTitle.height': '44px', 'month.moreViewTitle.marginBottom': '12px', 'month.moreViewTitle.borderBottom': 'none', 'month.moreViewTitle.padding': '12px 17px 0 17px', 'month.moreViewList.padding': '0 17px', // week header 'dayname' 'week.dayname.height': '42px', 'week.dayname.borderTop': '1px solid #e5e5e5', 'week.dayname.borderBottom': '1px solid #e5e5e5', 'week.dayname.borderLeft': 'none', 'week.dayname.paddingLeft': '0', 'week.dayname.backgroundColor': 'inherit', 'week.dayname.textAlign': 'left', 'week.today.color': 'inherit', 'week.pastDay.color': '#bbb', // week vertical panel 'vpanel' 'week.vpanelSplitter.border': '1px solid #e5e5e5', 'week.vpanelSplitter.height': '3px', // week daygrid 'daygrid' 'week.daygrid.borderRight': '1px solid #e5e5e5', 'week.daygrid.backgroundColor': 'inherit', 'week.daygridLeft.width': '72px', 'week.daygridLeft.backgroundColor': 'inherit', 'week.daygridLeft.paddingRight': '8px', 'week.daygridLeft.borderRight': '1px solid #e5e5e5', 'week.today.backgroundColor': 'rgba(81, 92, 230, 0.05)', 'week.weekend.backgroundColor': 'inherit', // week timegrid 'timegrid' 'week.timegridLeft.width': '72px', 'week.timegridLeft.backgroundColor': 'inherit', 'week.timegridLeft.borderRight': '1px solid #e5e5e5', 'week.timegridLeft.fontSize': '11px', 'week.timegridOneHour.height': '52px', 'week.timegridHalfHour.height': '26px', 'week.timegridHalfHour.borderBottom': 'none', 'week.timegridHorizontalLine.borderBottom': '1px solid #e5e5e5', 'week.timegrid.paddingRight': '8px', 'week.timegrid.borderRight': '1px solid #e5e5e5', 'week.timegridSchedule.borderRadius': '2px', 'week.timegridSchedule.paddingLeft': '2px', 'week.currentTime.color': '#515ce6', 'week.currentTime.fontSize': '11px', 'week.currentTime.fontWeight': 'normal', 'week.currentTimeLinePast.border': '1px dashed #515ce6', 'week.currentTimeLineBullet.backgroundColor': '#515ce6', 'week.currentTimeLineToday.border': '1px solid #515ce6', 'week.currentTimeLineFuture.border': 'none', // week creation guide style 'week.creationGuide.color': '#515ce6', 'week.creationGuide.fontSize': '11px', 'week.creationGuide.fontWeight': 'bold', // week daygrid schedule style 'week.dayGridSchedule.borderRadius': '2px', 'week.dayGridSchedule.height': '24px', 'week.dayGridSchedule.marginTop': '2px', 'week.dayGridSchedule.marginLeft': '8px', 'week.dayGridSchedule.marginRight': '8px' }; module.exports = theme; /***/ }), /***/ "./src/js/theme/theme.js": /*!*******************************!*\ !*** ./src/js/theme/theme.js ***! \*******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview The all configuration of a theme * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var themeStandard = __webpack_require__(/*! ./standard */ "./src/js/theme/standard.js"); var themeConfig = __webpack_require__(/*! ./themeConfig */ "./src/js/theme/themeConfig.js"); var common = __webpack_require__(/*! ../common/common */ "./src/js/common/common.js"); /** * Theme manager * @param {object} customTheme - custom theme */ function Theme(customTheme) { var theme = customTheme || themeStandard; /** * @type {util.HashMap} */ this._map = new util.HashMap(); this.setStyles(theme); } /** * Get a style with key * @param {string} key - key for getting a style * @returns {string|undefined} style */ Theme.prototype.getStyle = function(key) { return this._map.get(key); }; /** * Set a style * @param {string} key - key for setting a style * @param {string} style - style value * @returns {boolean} true if the give key is valid or false */ Theme.prototype.setStyle = function(key, style) { var styles = {}; styles[key] = style; return this.setStyles(styles).length === 0; }; /** * Set styles * @param {object} styles - multiple styles map * @returns {Array.} error keys */ Theme.prototype.setStyles = function(styles) { var errors = []; util.forEach(styles, function(style, key) { if (util.isUndefined(themeConfig[key])) { errors.push(key); } else { this._map.set(key, style); common.set(this, key, style); } }, this); // apply missing styles which have to be default util.forEach(themeConfig, function(style, key) { if (!this.getStyle(key)) { this._map.set(key, style); common.set(this, key, style); } }, this); return errors; }; /** * Delete all styles */ Theme.prototype.clear = function() { var keys = this._map.keys(); var categories = {}; util.forEach(keys, function(key) { var category = key.split('.')[0]; if (!categories[category]) { categories[category] = category; } }); util.forEach(categories, function(child) { delete this[child]; }, this); this._map.removeAll(); }; module.exports = Theme; /***/ }), /***/ "./src/js/theme/themeConfig.js": /*!*************************************!*\ !*** ./src/js/theme/themeConfig.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview The all configuration of a theme * @author NHN FE Development Lab */ /** * Full configuration for theme. * "common" prefix is for entire calendar. "common" properties can be overriden by "week", "month". * "week" prefix is for weekly and daily view. * "month" prefix is for monthly view. * @typedef {object} themeConfig * @example // default keys and styles var themeConfig = { 'common.border': '1px solid #e5e5e5', 'common.backgroundColor': 'white', 'common.holiday.color': '#ff4040', 'common.saturday.color': '#333', 'common.dayname.color': '#333', 'common.today.color': '#333', // creation guide style 'common.creationGuide.backgroundColor': 'rgba(81, 92, 230, 0.05)', 'common.creationGuide.border': '1px solid #515ce6', // month header 'dayname' 'month.dayname.height': '31px', 'month.dayname.borderLeft': '1px solid #e5e5e5', 'month.dayname.paddingLeft': '10px', 'month.dayname.paddingRight': '10px', 'month.dayname.backgroundColor': 'inherit', 'month.dayname.fontSize': '12px', 'month.dayname.fontWeight': 'normal', 'month.dayname.textAlign': 'left', // month day grid cell 'day' 'month.holidayExceptThisMonth.color': 'rgba(255, 64, 64, 0.4)', 'month.dayExceptThisMonth.color': 'rgba(51, 51, 51, 0.4)', 'month.weekend.backgroundColor': 'inherit', 'month.day.fontSize': '14px', // month schedule style 'month.schedule.borderRadius': '2px', 'month.schedule.height': '24px', 'month.schedule.marginTop': '2px', 'month.schedule.marginLeft': '8px', 'month.schedule.marginRight': '8px', // month more view 'month.moreView.border': '1px solid #d5d5d5', 'month.moreView.boxShadow': '0 2px 6px 0 rgba(0, 0, 0, 0.1)', 'month.moreView.backgroundColor': 'white', 'month.moreView.paddingBottom': '17px', 'month.moreViewTitle.height': '44px', 'month.moreViewTitle.marginBottom': '12px', 'month.moreViewTitle.backgroundColor': 'inherit', 'month.moreViewTitle.borderBottom': 'none', 'month.moreViewTitle.padding': '12px 17px 0 17px', 'month.moreViewList.padding': '0 17px', // week header 'dayname' 'week.dayname.height': '42px', 'week.dayname.borderTop': '1px solid #e5e5e5', 'week.dayname.borderBottom': '1px solid #e5e5e5', 'week.dayname.borderLeft': 'inherit', 'week.dayname.paddingLeft': '0', 'week.dayname.backgroundColor': 'inherit', 'week.dayname.textAlign': 'left', 'week.today.color': '#333', 'week.pastDay.color': '#bbb', // week vertical panel 'vpanel' 'week.vpanelSplitter.border': '1px solid #e5e5e5', 'week.vpanelSplitter.height': '3px', // week daygrid 'daygrid' 'week.daygrid.borderRight': '1px solid #e5e5e5', 'week.daygrid.backgroundColor': 'inherit', 'week.daygridLeft.width': '72px', 'week.daygridLeft.backgroundColor': 'inherit', 'week.daygridLeft.paddingRight': '8px', 'week.daygridLeft.borderRight': '1px solid #e5e5e5', 'week.today.backgroundColor': 'rgba(81, 92, 230, 0.05)', 'week.weekend.backgroundColor': 'inherit', // week timegrid 'timegrid' 'week.timegridLeft.width': '72px', 'week.timegridLeft.backgroundColor': 'inherit', 'week.timegridLeft.borderRight': '1px solid #e5e5e5', 'week.timegridLeft.fontSize': '11px', 'week.timegridLeftTimezoneLabel.height': '40px', 'week.timegridLeftAdditionalTimezone.backgroundColor': 'white', 'week.timegridOneHour.height': '52px', 'week.timegridHalfHour.height': '26px', 'week.timegridHalfHour.borderBottom': 'none', 'week.timegridHorizontalLine.borderBottom': '1px solid #e5e5e5', 'week.timegrid.paddingRight': '8px', 'week.timegrid.borderRight': '1px solid #e5e5e5', 'week.timegridSchedule.borderRadius': '2px', 'week.timegridSchedule.paddingLeft': '2px', 'week.currentTime.color': '#515ce6', 'week.currentTime.fontSize': '11px', 'week.currentTime.fontWeight': 'normal', 'week.pastTime.color': '#bbb', 'week.pastTime.fontWeight': 'normal', 'week.futureTime.color': '#333', 'week.futureTime.fontWeight': 'normal', 'week.currentTimeLinePast.border': '1px dashed #515ce6', 'week.currentTimeLineBullet.backgroundColor': '#515ce6', 'week.currentTimeLineToday.border': '1px solid #515ce6', 'week.currentTimeLineFuture.border': 'none', // week creation guide style 'week.creationGuide.color': '#515ce6', 'week.creationGuide.fontSize': '11px', 'week.creationGuide.fontWeight': 'bold', // week daygrid schedule style 'week.dayGridSchedule.borderRadius': '2px', 'week.dayGridSchedule.height': '24px', 'week.dayGridSchedule.marginTop': '2px', 'week.dayGridSchedule.marginLeft': '8px', 'week.dayGridSchedule.marginRight': '8px' }; */ var themeConfig = { 'common.border': '1px solid #e5e5e5', 'common.backgroundColor': 'white', 'common.holiday.color': '#ff4040', 'common.saturday.color': '#333', 'common.dayname.color': '#333', 'common.today.color': '#333', // creation guide style 'common.creationGuide.backgroundColor': 'rgba(81, 92, 230, 0.05)', 'common.creationGuide.border': '1px solid #515ce6', // month header 'dayname' 'month.dayname.height': '31px', 'month.dayname.borderLeft': '1px solid #e5e5e5', 'month.dayname.paddingLeft': '10px', 'month.dayname.paddingRight': '10px', 'month.dayname.backgroundColor': 'inherit', 'month.dayname.fontSize': '12px', 'month.dayname.fontWeight': 'normal', 'month.dayname.textAlign': 'left', // month day grid cell 'day' 'month.holidayExceptThisMonth.color': 'rgba(255, 64, 64, 0.4)', 'month.dayExceptThisMonth.color': 'rgba(51, 51, 51, 0.4)', 'month.weekend.backgroundColor': 'inherit', 'month.day.fontSize': '14px', // month schedule style 'month.schedule.borderRadius': '2px', 'month.schedule.height': '24px', 'month.schedule.marginTop': '2px', 'month.schedule.marginLeft': '8px', 'month.schedule.marginRight': '8px', // month more view 'month.moreView.border': '1px solid #d5d5d5', 'month.moreView.boxShadow': '0 2px 6px 0 rgba(0, 0, 0, 0.1)', 'month.moreView.backgroundColor': 'white', 'month.moreView.paddingBottom': '17px', 'month.moreViewTitle.height': '44px', 'month.moreViewTitle.marginBottom': '12px', 'month.moreViewTitle.backgroundColor': 'inherit', 'month.moreViewTitle.borderBottom': 'none', 'month.moreViewTitle.padding': '12px 17px 0 17px', 'month.moreViewList.padding': '0 17px', // week header 'dayname' 'week.dayname.height': '42px', 'week.dayname.borderTop': '1px solid #e5e5e5', 'week.dayname.borderBottom': '1px solid #e5e5e5', 'week.dayname.borderLeft': 'inherit', 'week.dayname.paddingLeft': '0', 'week.dayname.backgroundColor': 'inherit', 'week.dayname.textAlign': 'left', 'week.today.color': '#333', 'week.pastDay.color': '#bbb', // week vertical panel 'vpanel' 'week.vpanelSplitter.border': '1px solid #e5e5e5', 'week.vpanelSplitter.height': '3px', // week daygrid 'daygrid' 'week.daygrid.borderRight': '1px solid #e5e5e5', 'week.daygrid.backgroundColor': 'inherit', 'week.daygridLeft.width': '72px', 'week.daygridLeft.backgroundColor': 'inherit', 'week.daygridLeft.paddingRight': '8px', 'week.daygridLeft.borderRight': '1px solid #e5e5e5', 'week.today.backgroundColor': 'rgba(81, 92, 230, 0.05)', 'week.weekend.backgroundColor': 'inherit', // week timegrid 'timegrid' 'week.timegridLeft.width': '72px', 'week.timegridLeft.backgroundColor': 'inherit', 'week.timegridLeft.borderRight': '1px solid #e5e5e5', 'week.timegridLeft.fontSize': '11px', 'week.timegridLeftTimezoneLabel.height': '40px', 'week.timegridLeftAdditionalTimezone.backgroundColor': 'white', 'week.timegridOneHour.height': '52px', 'week.timegridHalfHour.height': '26px', 'week.timegridHalfHour.borderBottom': 'none', 'week.timegridHorizontalLine.borderBottom': '1px solid #e5e5e5', 'week.timegrid.paddingRight': '8px', 'week.timegrid.borderRight': '1px solid #e5e5e5', 'week.timegridSchedule.borderRadius': '2px', 'week.timegridSchedule.paddingLeft': '2px', 'week.currentTime.color': '#515ce6', 'week.currentTime.fontSize': '11px', 'week.currentTime.fontWeight': 'normal', 'week.pastTime.color': '#bbb', 'week.pastTime.fontWeight': 'normal', 'week.futureTime.color': '#333', 'week.futureTime.fontWeight': 'normal', 'week.currentTimeLinePast.border': '1px dashed #515ce6', 'week.currentTimeLineBullet.backgroundColor': '#515ce6', 'week.currentTimeLineToday.border': '1px solid #515ce6', 'week.currentTimeLineFuture.border': 'none', // week creation guide style 'week.creationGuide.color': '#515ce6', 'week.creationGuide.fontSize': '11px', 'week.creationGuide.fontWeight': 'bold', // week daygrid schedule style 'week.dayGridSchedule.borderRadius': '2px', 'week.dayGridSchedule.height': '24px', 'week.dayGridSchedule.marginTop': '2px', 'week.dayGridSchedule.marginLeft': '8px', 'week.dayGridSchedule.marginRight': '8px' }; module.exports = themeConfig; /***/ }), /***/ "./src/js/view/layout.js": /*!*******************************!*\ !*** ./src/js/view/layout.js ***! \*******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Layout view. wrap all view containers at outside. * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../config */ "./src/js/config.js"); var domutil = __webpack_require__(/*! ../common/domutil */ "./src/js/common/domutil.js"); var Collection = __webpack_require__(/*! ../common/collection */ "./src/js/common/collection.js"); var View = __webpack_require__(/*! ./view */ "./src/js/view/view.js"); /** * Layout view for toggle each child view. It will controlled via navigation UI. * @constructor * @extends {View} * @param {HTMLElement} container Container element to use layout view. * @param {Theme} theme - theme instance */ function Layout(container, theme) { container = domutil.appendHTMLElement('div', container, config.classname('layout')); /** * @type {HTMLElement} */ this.container = container; /*eslint-disable*/ /** * @type {Collection} Child view collection. */ this.children = new Collection(function(childView) { return childView.viewName; }); /* eslint-enable*/ /** * @type {Theme} */ this.theme = theme; this.applyTheme(); } util.inherit(Layout, View); /** * Clear child views. */ Layout.prototype.clear = function() { this.children.each(function(childView) { childView.destroy(); }); this.children.clear(); this.container.innerHTML = ''; }; /** * Remove child view. * @override * @param {(string|View)} viewName - name of view or instance. */ Layout.prototype.removeChild = function(viewName) { this.children.remove(viewName); }; /** * Toggle child views. * @param {string} viewName - Name of view. */ Layout.prototype.toggleChildView = function(viewName) { var container, prefix = ['add', 'remove'], flag; this.children.each(function(childView) { container = childView.container; flag = Number(childView.viewName === viewName); domutil[prefix[flag] + 'Class'](container, config.classname('hidden')); }); }; Layout.prototype.applyTheme = function() { var style = this.container.style; var theme = this.theme.common; // background color style.backgroundColor = theme.backgroundColor; }; module.exports = Layout; /***/ }), /***/ "./src/js/view/month/month.js": /*!************************************!*\ !*** ./src/js/view/month/month.js ***! \************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Month view * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"), datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"), domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"), TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date, tmpl = __webpack_require__(/*! ../template/month/month.hbs */ "./src/js/view/template/month/month.hbs"), View = __webpack_require__(/*! ../view */ "./src/js/view/view.js"), VLayout = __webpack_require__(/*! ../..//common/vlayout */ "./src/js/common/vlayout.js"), WeekdayInMonth = __webpack_require__(/*! ./weekdayInMonth */ "./src/js/view/month/weekdayInMonth.js"); var mmin = Math.min; /** * @constructor * @extends {View} * @param {object} options - options * @param {function} [options.scheduleFilter] - schedule filter * @param {number} [options.startDayOfWeek=0] - start day of week * @param {string} [options.renderMonth='2015-12'] - render month * @param {string[]} [options.daynames] - daynames to use upside of month view * @param {HTMLElement} container - container element * @param {Base.Month} controller - controller instance */ function Month(options, container, controller) { var theme = controller ? controller.theme : null; var monthOption; options = options || {}; monthOption = options ? options.month : {}; View.call(this, container); /** * @type {Base.Month} */ this.controller = controller; /** * @type {VLayout} */ this.vLayout = new VLayout({ panels: [ {height: parseInt(controller.theme.month.dayname.height, 10) || 42}, {autoHeight: true} ] }, container, theme); /** * @type {string} */ this.options = util.extend({ scheduleFilter: function(schedule) { return Boolean(schedule.isVisible); }, startDayOfWeek: 0, renderMonth: '2018-01', daynames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], narrowWeekend: false, visibleWeeksCount: null, isAlways6Week: true, isReadOnly: options.isReadOnly, grid: { header: { height: 34 }, footer: { height: 3 } } }, monthOption); this.options.grid.header = util.extend({ height: 34 }, util.pick(monthOption, 'grid', 'header')); this.options.grid.footer = util.extend({ height: 3 }, util.pick(monthOption, 'grid', 'footer')); /** * horizontal grid information * @type {Object} */ this.grids = datetime.getGridLeftAndWidth( this.options.daynames.length, this.options.narrowWeekend, this.options.startDayOfWeek); } util.inherit(Month, View); /** * Name of view. for managing subview at layout view * @type {string} */ Month.prototype.viewName = 'month'; /** * Get calendar array by supplied date * @param {string} renderMonth - month to render YYYY-MM, weeks2/3 to render YYYY-MM-DD * @returns {array.} calendar array */ Month.prototype._getMonthCalendar = function(renderMonth) { var date = new TZDate(renderMonth); var startDayOfWeek = this.options.startDayOfWeek || 0; var visibleWeeksCount = mmin(this.options.visibleWeeksCount || 0, 6); var workweek = this.options.workweek || false; var datetimeOptions, calendar; if (this.options.visibleWeeksCount) { datetimeOptions = { startDayOfWeek: startDayOfWeek, isAlways6Week: false, visibleWeeksCount: visibleWeeksCount, workweek: workweek }; } else { datetimeOptions = { startDayOfWeek: startDayOfWeek, isAlways6Week: this.options.isAlways6Week, workweek: workweek }; } calendar = datetime.arr2dCalendar(date, datetimeOptions); return calendar; }; /** * Create children view (week) and add children * @param {HTMLElement} container - container element to render weeks * @param {array.} calendar - calendar array from datetime#arr2dCalendar * @param {Theme} theme - theme instance */ Month.prototype._renderChildren = function(container, calendar, theme) { var self = this; var weekCount = calendar.length; var heightPercent = 100 / weekCount; var opt = this.options; var renderMonth = opt.renderMonth; var narrowWeekend = opt.narrowWeekend; var startDayOfWeek = opt.startDayOfWeek; var visibleWeeksCount = opt.visibleWeeksCount; var visibleScheduleCount = opt.visibleScheduleCount; var gridOption = opt.grid; var isReadOnly = opt.isReadOnly; container.innerHTML = ''; this.children.clear(); util.forEach(calendar, function(weekArr) { var start = new TZDate(weekArr[0]), end = new TZDate(weekArr[weekArr.length - 1]), weekdayViewContainer, weekdayView; weekdayViewContainer = domutil.appendHTMLElement( 'div', container, config.classname('month-week-item')); weekdayView = new WeekdayInMonth({ renderMonth: renderMonth, heightPercent: heightPercent, renderStartDate: start, renderEndDate: end, narrowWeekend: narrowWeekend, startDayOfWeek: startDayOfWeek, visibleWeeksCount: visibleWeeksCount, visibleScheduleCount: visibleScheduleCount, grid: gridOption, scheduleHeight: parseInt(theme.month.schedule.height, 10), scheduleGutter: parseInt(theme.month.schedule.marginTop, 10), isReadOnly: isReadOnly }, weekdayViewContainer); self.addChild(weekdayView); }); }; /** * Render month view * @override */ Month.prototype.render = function() { var self = this, opt = this.options, vLayout = this.vLayout, controller = this.controller, daynames = opt.daynames, workweek = opt.workweek, calendar = this._getMonthCalendar(opt.renderMonth), scheduleFilter = opt.scheduleFilter, theme = controller ? controller.theme : null, styles = this._getStyles(theme), grids, daynameViewModel, baseViewModel; grids = this.grids = datetime.getGridLeftAndWidth( opt.daynames.length, opt.narrowWeekend, opt.startDayOfWeek ); daynameViewModel = util.map( util.range(opt.startDayOfWeek, 7).concat(util.range(7)).slice(0, 7), function(day, index) { return { day: day, label: daynames[day], width: grids[index] ? grids[index].width : 0, left: grids[index] ? grids[index].left : 0, color: this._getDayNameColor(theme, day) }; }, this ); if (workweek) { grids = this.grids = datetime.getGridLeftAndWidth(5, opt.narrowWeekend, opt.startDayOfWeek, workweek); daynameViewModel = util.filter(daynameViewModel, function(daynameModel) { return !datetime.isWeekend(daynameModel.day); }); util.forEach(daynameViewModel, function(daynameModel, index) { daynameModel.width = grids[index] ? grids[index].width : 0; daynameModel.left = grids[index] ? grids[index].left : 0; }); } baseViewModel = { daynames: daynameViewModel, styles: styles }; vLayout.panels[0].container.innerHTML = tmpl(baseViewModel); this._renderChildren(vLayout.panels[1].container, calendar, theme); baseViewModel.panelHeight = vLayout.panels[1].getHeight(); this.children.each(function(childView) { var start = datetime.start(childView.options.renderStartDate); var end = datetime.start(childView.options.renderEndDate); var eventsInDateRange = controller.findByDateRange( datetime.start(start), datetime.end(end), scheduleFilter ); var dateRange = datetime.range( datetime.start(start), datetime.end(end), datetime.MILLISECONDS_PER_DAY); var viewModel = { eventsInDateRange: eventsInDateRange, range: dateRange.slice(0, grids.length), grids: grids, panelHeight: baseViewModel.panelHeight, theme: theme }; childView.render(viewModel); self._invokeAfterRenderSchedule(eventsInDateRange); }); }; /** * Fire 'afterRenderSchedule' event * @param {Array} matrices - schedule matrices from view model * @fires Month#afterRenderSchedule */ Month.prototype._invokeAfterRenderSchedule = function(matrices) { var self = this; util.forEachArray(matrices, function(matrix) { util.forEachArray(matrix, function(column) { util.forEachArray(column, function(scheduleViewModel) { if (scheduleViewModel && !scheduleViewModel.hidden) { /** * @event Month#afterRenderSchedule */ self.fire('afterRenderSchedule', {schedule: scheduleViewModel.model}); } }); }); }); }; /** * Get the styles from theme * @param {Theme} theme - theme instance * @returns {object} styles - styles object */ Month.prototype._getStyles = function(theme) { var styles = {}; var dayname; if (theme) { dayname = theme.month.dayname; styles.borderTop = dayname.borderTop || theme.common.border; styles.borderLeft = dayname.borderLeft || theme.common.border; styles.height = dayname.height; styles.paddingLeft = dayname.paddingLeft; styles.paddingRight = dayname.paddingRight; styles.fontSize = dayname.fontSize; styles.backgroundColor = dayname.backgroundColor; styles.fontWeight = dayname.fontWeight; styles.textAlign = dayname.textAlign; } return styles; }; /** * Get a day name color * @param {Theme} theme - theme instance * @param {number} day - day number * @returns {string} style - color style */ Month.prototype._getDayNameColor = function(theme, day) { var color = ''; if (theme) { if (day === 0) { color = theme.common.holiday.color; } else if (day === 6) { color = theme.common.saturday.color; } else { color = theme.common.dayname.color; } } return color; }; module.exports = Month; /***/ }), /***/ "./src/js/view/month/more.js": /*!***********************************!*\ !*** ./src/js/view/month/more.js ***! \***********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Floating layer for displaying schedule in specific date * @author NHN FE Development Lab */ var OUT_PADDING = 5; var VIEW_MIN_WIDTH = 280; var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"), domevent = __webpack_require__(/*! ../../common/domevent */ "./src/js/common/domevent.js"), domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"), View = __webpack_require__(/*! ../../view/view */ "./src/js/view/view.js"), FloatingLayer = __webpack_require__(/*! ../../common/floatingLayer */ "./src/js/common/floatingLayer.js"), common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"), tmpl = __webpack_require__(/*! ../template/month/more.hbs */ "./src/js/view/template/month/more.hbs"); /** * @constructor * @extends {View} * @param {object} options - options * @param {object} [options.moreLayerSize] - more layer size * @param {object} [options.moreLayerSize.width=null] - css width value(px, auto). * The default value 'null' is to fit a grid cell. * @param {object} [options.moreLayerSize.height=null] - css height value(px, auto). * The default value 'null' is to fit a grid cell. * @param {HTMLElement} container = container element * @param {Theme} theme - theme instance */ function More(options, container, theme) { View.call(this, container); /** * @type {FloatingLayer} */ this.layer = new FloatingLayer(null, container); /** * cached view model * @type {object} */ this._viewModel = null; /** * @type {object} */ this.options = util.extend({ moreLayerSize: { width: null, height: null }, scheduleHeight: parseInt(theme.month.schedule.height, 10) || 18, scheduleGutter: parseInt(theme.month.schedule.marginTop, 10) || 2, scheduleBulletTop: (parseInt(theme.month.schedule.height, 10) || 18) / 3, borderRadius: theme.month.schedule.borderRadius }, options); /** * @type {Theme} */ this.theme = theme; domevent.on(container, 'click', this._onClick, this); } util.inherit(More, View); /** * Click event handler for close button * @param {MouseEvent} clickEvent - mouse event object */ More.prototype._onClick = function(clickEvent) { var target = domevent.getEventTarget(clickEvent); var className = config.classname('month-more-close'); if (!domutil.hasClass(target, className) && !domutil.closest(target, '.' + className)) { return; } this.hide(); }; /** * Mousedown event handler for hiding more layer when user mousedown outside of * layer * @param {MouseEvent} mouseDownEvent - mouse event object */ More.prototype._onMouseDown = function(mouseDownEvent) { var target = domevent.getEventTarget(mouseDownEvent), moreLayer = domutil.closest(target, config.classname('.month-more')); if (moreLayer) { return; } this.hide(); }; /** * Get new position for more layer by +n element itself * @param {HTMLElement} target - parent grid-line element of +n element * @param {HTMLElement} weekItem - weekItem container element * @returns {number[]} new position of more layer */ More.prototype._getRenderPosition = function(target, weekItem) { var pos = domevent.getMousePosition({ clientX: domutil.getPosition(target)[0], clientY: domutil.getPosition(weekItem)[1] }, this.container); var containerSize = domutil.getSize(this.container); var left = pos[0] - OUT_PADDING; var top = pos[1] - OUT_PADDING; left = common.ratio(containerSize[0], 100, left); top = common.ratio(containerSize[1], 100, top); return [left, top]; }; /** * @override */ More.prototype.destroy = function() { this.layer.destroy(); this.layer = null; domevent.off(this.container, 'click', this._onClick, this); domevent.off(document.body, 'mousedown', this._onMouseDown, this); View.prototype.destroy.call(this); }; /** * @override * @param {object} viewModel - view model from factory/monthView */ More.prototype.render = function(viewModel) { var target = domutil.closest(viewModel.target, config.classname('.weekday-grid-line')); var weekItem = domutil.closest(target, config.classname('.month-week-item')); var layer = this.layer; var self = this; var pos = this._getRenderPosition(target, weekItem); var minHeight = domutil.getSize(weekItem)[1] + (OUT_PADDING * 2); var width = target.offsetWidth + (OUT_PADDING * 2); var opt = this.options; var optMoreLayerSize = opt.moreLayerSize; var styles = this._getStyles(this.theme); var maxVisibleSchedulesInLayer = 10; var height = ''; var containerSize = domutil.getSize(this.container); var calWidth = 0; var calHeight = 0; var isOverWidth = false; var isOverHeight = false; var leftPos = pos[0]; var topPos = pos[1]; this._viewModel = util.extend(viewModel, { scheduleGutter: opt.scheduleGutter, scheduleHeight: opt.scheduleHeight, scheduleBulletTop: opt.scheduleBulletTop, borderRadius: opt.borderRadius, styles: styles }); width = Math.max(width, VIEW_MIN_WIDTH); height = parseInt(styles.titleHeight, 10); height += parseInt(styles.titleMarginBottom, 10); if (viewModel.schedules.length <= maxVisibleSchedulesInLayer) { height += (opt.scheduleGutter + opt.scheduleHeight) * viewModel.schedules.length; } else { height += (opt.scheduleGutter + opt.scheduleHeight) * maxVisibleSchedulesInLayer; } height += parseInt(styles.paddingBottom, 10); height += OUT_PADDING; // for border if (optMoreLayerSize.width) { width = optMoreLayerSize.width; } if (optMoreLayerSize.height) { height = optMoreLayerSize.height; } if (isNaN(height) || height < minHeight) { height = minHeight; } layer.setContent(tmpl(viewModel)); calWidth = leftPos * containerSize[0] / 100; calHeight = topPos * containerSize[1] / 100; isOverWidth = calWidth + width >= containerSize[0]; isOverHeight = calHeight + height >= containerSize[1]; leftPos = leftPos + '%'; topPos = topPos + '%'; if (isOverWidth && isOverHeight) { layer.setLTRB({ right: 0, bottom: 0 }); } else if (!isOverWidth && isOverHeight) { layer.setLTRB({ left: leftPos, bottom: 0 }); } else if (isOverWidth && !isOverHeight) { layer.setLTRB({ right: 0, top: topPos }); } else { layer.setPosition(leftPos, topPos); } layer.setSize(width, height); layer.show(); util.debounce(function() { domevent.on(document.body, 'mousedown', self._onMouseDown, self); })(); }; /** * Hide layer */ More.prototype.hide = function() { this.layer.hide(); domevent.off(document.body, 'mousedown', this._onMouseDown, this); }; /** * refresh layer */ More.prototype.refresh = function() { if (this._viewModel) { this.layer.setContent(tmpl(this._viewModel)); } }; /** * Return more layer root element * @returns {HTMLElement} root element */ More.prototype.getMoreViewElement = function() { return domutil.find(config.classname('.month-more'), this.layer.container); }; /** * Get the styles from theme * @param {Theme} theme - theme instance * @returns {object} styles - styles object */ More.prototype._getStyles = function(theme) { var styles = {}; var listHeight = ''; if (theme) { styles.border = theme.month.moreView.border || theme.common.border; styles.boxShadow = theme.month.moreView.boxShadow; styles.backgroundColor = theme.month.moreView.backgroundColor || theme.common.backgroundColor; styles.paddingBottom = theme.month.moreView.paddingBottom; styles.titleHeight = theme.month.moreViewTitle.height; styles.titleMarginBottom = theme.month.moreViewTitle.marginBottom; styles.titleBackgroundColor = theme.month.moreViewTitle.backgroundColor; styles.titleBorderBottom = theme.month.moreViewTitle.borderBottom; styles.titlePadding = theme.month.moreViewTitle.padding; styles.listPadding = theme.month.moreViewList.padding; listHeight = 'calc(100%'; if (parseInt(styles.titleHeight, 10)) { listHeight += ' - ' + styles.titleHeight; } if (parseInt(styles.titleMarginBottom, 10)) { listHeight += ' - ' + styles.titleMarginBottom; } listHeight += ')'; styles.listHeight = listHeight; } return styles; }; module.exports = More; /***/ }), /***/ "./src/js/view/month/weekdayInMonth.js": /*!*********************************************!*\ !*** ./src/js/view/month/weekdayInMonth.js ***! \*********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Monthday in month view * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"), common = __webpack_require__(/*! ../../common/common.js */ "./src/js/common/common.js"), domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"), View = __webpack_require__(/*! ../../view/view */ "./src/js/view/view.js"), Weekday = __webpack_require__(/*! ../weekday */ "./src/js/view/weekday.js"), baseTmpl = __webpack_require__(/*! ../template/month/weekdayInMonth.hbs */ "./src/js/view/template/month/weekdayInMonth.hbs"), scheduleTmpl = __webpack_require__(/*! ../template/month/weekdayInMonthSchedule.hbs */ "./src/js/view/template/month/weekdayInMonthSchedule.hbs"); var mfloor = Math.floor, mmin = Math.min; /** * @constructor * @extends {Weekday} * @param {object} options - options for WeekdayInWeek view * @param {number} [options.heightPercent] - height percent of view * @param {number} [options.containerButtonGutter=8] - free space at bottom to * make create easy. * @param {number} [options.scheduleHeight=18] - height of each schedule block. * @param {number} [options.scheduleGutter=2] - gutter height of each schedule block. * @param {HTMLDIVElement} container - DOM element to use container for this * view. */ function WeekdayInMonth(options, container) { Weekday.call(this, options, container); container.style.height = options.heightPercent + '%'; } util.inherit(WeekdayInMonth, Weekday); /** * Get schedule container element's bound properly by override * * View#getViewBound. * @override */ WeekdayInMonth.prototype.getViewBound = function() { var bound = View.prototype.getViewBound.call(this); return bound; }; /** * Get limit index of schedule block in current view * @param {number} panelHeight - panel's height for pre-calculation * @returns {number} limit index */ WeekdayInMonth.prototype._getRenderLimitIndex = function(panelHeight) { var opt = this.options; var containerHeight = panelHeight || this.getViewBound().height; var gridHeaderHeight = util.pick(opt, 'grid', 'header', 'height') || 0; var gridFooterHeight = util.pick(opt, 'grid', 'footer', 'height') || 0; var visibleScheduleCount = opt.visibleScheduleCount || 0; var count; containerHeight -= (gridHeaderHeight + gridFooterHeight); count = mfloor(containerHeight / (opt.scheduleHeight + opt.scheduleGutter)); if (!visibleScheduleCount) { visibleScheduleCount = count; } return mmin(count, visibleScheduleCount); // subtraction for '+n' label block }; /** * @override * @param {object} viewModel - schedules view models */ WeekdayInMonth.prototype.getBaseViewModel = function(viewModel) { var opt = this.options, gridHeaderHeight = util.pick(opt, 'grid', 'header', 'height') || 0, gridFooterHeight = util.pick(opt, 'grid', 'footer', 'height') || 0, renderLimitIdx = this._getRenderLimitIndex() + 1, exceedDate = this.getExceedDate(renderLimitIdx, viewModel.eventsInDateRange, viewModel.range), styles = this._getStyles(viewModel.theme); var baseViewModel; viewModel = util.extend({ exceedDate: exceedDate }, viewModel); baseViewModel = Weekday.prototype.getBaseViewModel.call(this, viewModel); baseViewModel = util.extend({ matrices: viewModel.eventsInDateRange, gridHeaderHeight: gridHeaderHeight, gridFooterHeight: gridFooterHeight, renderLimitIdx: renderLimitIdx, isReadOnly: opt.isReadOnly, styles: styles }, baseViewModel); return baseViewModel; }; /** * @override * @param {object} viewModel - schedules view models */ WeekdayInMonth.prototype.render = function(viewModel) { var container = this.container, baseViewModel = this.getBaseViewModel(viewModel), scheduleContainer; if (!this.options.visibleWeeksCount) { setIsOtherMonthFlag(baseViewModel.dates, this.options.renderMonth, viewModel.theme); } container.innerHTML = baseTmpl(baseViewModel); scheduleContainer = domutil.find( config.classname('.weekday-schedules'), container ); if (!scheduleContainer) { return; } scheduleContainer.innerHTML = scheduleTmpl(baseViewModel); common.setAutoEllipsis( config.classname('.weekday-schedule-title'), container, true ); }; WeekdayInMonth.prototype._beforeDestroy = function() { }; /** * Get the styles from theme * @param {Theme} theme - theme instance * @returns {object} styles - styles object */ WeekdayInMonth.prototype._getStyles = function(theme) { var styles = {}; if (theme) { styles.borderTop = theme.common.border; styles.borderLeft = theme.common.border; styles.fontSize = theme.month.day.fontSize; styles.borderRadius = theme.month.schedule.borderRadius; styles.marginLeft = theme.month.schedule.marginLeft; styles.marginRight = theme.month.schedule.marginRight; styles.scheduleBulletTop = this.options.scheduleHeight / 3; } return styles; }; /** * 현재 달이 아닌 날짜에 대해 isOtherMonth = true 플래그를 추가한다. * @param {Array} dates - 날짜정보 배열 * @param {TZDate} renderMonth - 현재 렌더링중인 월 (YYYYMM) * @param {Theme} theme - theme instance */ function setIsOtherMonthFlag(dates, renderMonth, theme) { var month = renderMonth.getMonth() + 1; util.forEach(dates, function(dateObj) { var isOtherMonth = dateObj.month !== month; dateObj.isOtherMonth = isOtherMonth; if (isOtherMonth) { dateObj.color = Weekday.prototype._getDayNameColor(theme, dateObj.day, dateObj.isToday, isOtherMonth); } }); } module.exports = WeekdayInMonth; /***/ }), /***/ "./src/js/view/popup/scheduleCreationPopup.js": /*!****************************************************!*\ !*** ./src/js/view/popup/scheduleCreationPopup.js ***! \****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Floating layer for writing new schedules * @author NHN FE Development Lab */ var View = __webpack_require__(/*! ../../view/view */ "./src/js/view/view.js"); var FloatingLayer = __webpack_require__(/*! ../../common/floatingLayer */ "./src/js/common/floatingLayer.js"); var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var DatePicker = __webpack_require__(/*! tui-date-picker */ "tui-date-picker"); var timezone = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var domevent = __webpack_require__(/*! ../../common/domevent */ "./src/js/common/domevent.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var tmpl = __webpack_require__(/*! ../template/popup/scheduleCreationPopup.hbs */ "./src/js/view/template/popup/scheduleCreationPopup.hbs"); var TZDate = timezone.Date; var MAX_WEEK_OF_MONTH = 6; /** * @constructor * @extends {View} * @param {HTMLElement} container - container element * @param {Array.} calendars - calendar list used to create new schedule * @param {boolean} usageStatistics - GA tracking options in Calendar */ function ScheduleCreationPopup(container, calendars, usageStatistics) { View.call(this, container); /** * @type {FloatingLayer} */ this.layer = new FloatingLayer(null, container); /** * cached view model * @type {object} */ this._viewModel = null; this._selectedCal = null; this._schedule = null; this.calendars = calendars; this._focusedDropdown = null; this._usageStatistics = usageStatistics; this._onClickListeners = [ this._selectDropdownMenuItem.bind(this), this._toggleDropdownMenuView.bind(this), this._closeDropdownMenuView.bind(this, null), this._closePopup.bind(this), this._toggleIsAllday.bind(this), this._toggleIsPrivate.bind(this), this._onClickSaveSchedule.bind(this) ]; domevent.on(container, 'click', this._onClick, this); } util.inherit(ScheduleCreationPopup, View); /** * Mousedown event handler for hiding popup layer when user mousedown outside of * layer * @param {MouseEvent} mouseDownEvent - mouse event object */ ScheduleCreationPopup.prototype._onMouseDown = function(mouseDownEvent) { var target = domevent.getEventTarget(mouseDownEvent), popupLayer = domutil.closest(target, config.classname('.floating-layer')); if (popupLayer) { return; } this.hide(); }; /** * @override */ ScheduleCreationPopup.prototype.destroy = function() { this.layer.destroy(); this.layer = null; domevent.off(this.container, 'click', this._onClick, this); domevent.off(document.body, 'mousedown', this._onMouseDown, this); View.prototype.destroy.call(this); }; /** * @override * Click event handler for close button * @param {MouseEvent} clickEvent - mouse event object */ ScheduleCreationPopup.prototype._onClick = function(clickEvent) { var target = domevent.getEventTarget(clickEvent); util.forEach(this._onClickListeners, function(listener) { return !listener(target); }); }; /** * Test click event target is close button, and return layer is closed(hidden) * @param {HTMLElement} target click event target * @returns {boolean} whether popup layer is closed or not */ ScheduleCreationPopup.prototype._closePopup = function(target) { var className = config.classname('popup-close'); if (domutil.hasClass(target, className) || domutil.closest(target, '.' + className)) { this.hide(); return true; } return false; }; /** * Toggle dropdown menu view, when user clicks dropdown button * @param {HTMLElement} target click event target * @returns {boolean} whether user clicked dropdown button or not */ ScheduleCreationPopup.prototype._toggleDropdownMenuView = function(target) { var className = config.classname('dropdown-button'); var dropdownBtn = domutil.hasClass(target, className) ? target : domutil.closest(target, '.' + className); if (!dropdownBtn) { return false; } if (domutil.hasClass(dropdownBtn.parentNode, config.classname('open'))) { this._closeDropdownMenuView(dropdownBtn.parentNode); } else { this._openDropdownMenuView(dropdownBtn.parentNode); } return true; }; /** * Close drop down menu * @param {HTMLElement} dropdown - dropdown element that has a opened dropdown menu */ ScheduleCreationPopup.prototype._closeDropdownMenuView = function(dropdown) { dropdown = dropdown || this._focusedDropdown; if (dropdown) { domutil.removeClass(dropdown, config.classname('open')); this._focusedDropdown = null; } }; /** * Open drop down menu * @param {HTMLElement} dropdown - dropdown element that has a closed dropdown menu */ ScheduleCreationPopup.prototype._openDropdownMenuView = function(dropdown) { domutil.addClass(dropdown, config.classname('open')); this._focusedDropdown = dropdown; }; /** * If click dropdown menu item, close dropdown menu * @param {HTMLElement} target click event target * @returns {boolean} whether */ ScheduleCreationPopup.prototype._selectDropdownMenuItem = function(target) { var itemClassName = config.classname('dropdown-menu-item'); var iconClassName = config.classname('icon'); var contentClassName = config.classname('content'); var selectedItem = domutil.hasClass(target, itemClassName) ? target : domutil.closest(target, '.' + itemClassName); var bgColor, title, dropdown, dropdownBtn; if (!selectedItem) { return false; } bgColor = domutil.find('.' + iconClassName, selectedItem).style.backgroundColor || 'transparent'; title = domutil.find('.' + contentClassName, selectedItem).innerHTML; dropdown = domutil.closest(selectedItem, config.classname('.dropdown')); dropdownBtn = domutil.find(config.classname('.dropdown-button'), dropdown); domutil.find('.' + contentClassName, dropdownBtn).innerText = title; if (domutil.hasClass(dropdown, config.classname('section-calendar'))) { domutil.find('.' + iconClassName, dropdownBtn).style.backgroundColor = bgColor; this._selectedCal = common.find(this.calendars, function(cal) { return String(cal.id) === domutil.getData(selectedItem, 'calendarId'); }); } domutil.removeClass(dropdown, config.classname('open')); return true; }; /** * Toggle allday checkbox state * @param {HTMLElement} target click event target * @returns {boolean} whether event target is allday section or not */ ScheduleCreationPopup.prototype._toggleIsAllday = function(target) { var className = config.classname('section-allday'); var alldaySection = domutil.hasClass(target, className) ? target : domutil.closest(target, '.' + className); var checkbox; if (alldaySection) { checkbox = domutil.find(config.classname('.checkbox-square'), alldaySection); checkbox.checked = !checkbox.checked; return true; } return false; }; /** * Toggle private button * @param {HTMLElement} target click event target * @returns {boolean} whether event target is private section or not */ ScheduleCreationPopup.prototype._toggleIsPrivate = function(target) { var className = config.classname('section-private'); var privateSection = domutil.hasClass(target, className) ? target : domutil.closest(target, '.' + className); if (privateSection) { if (domutil.hasClass(privateSection, config.classname('public'))) { domutil.removeClass(privateSection, config.classname('public')); } else { domutil.addClass(privateSection, config.classname('public')); } return true; } return false; }; /** * Save new schedule if user clicked save button * @emits ScheduleCreationPopup#saveSchedule * @param {HTMLElement} target click event target * @returns {boolean} whether save button is clicked or not */ // eslint-disable-next-line complexity ScheduleCreationPopup.prototype._onClickSaveSchedule = function(target) { var className = config.classname('popup-save'); var cssPrefix = config.cssPrefix; var title; var startDate; var endDate; var rangeDate; var form; var isAllDay; if (!domutil.hasClass(target, className) && !domutil.closest(target, '.' + className)) { return false; } title = domutil.get(cssPrefix + 'schedule-title'); startDate = new TZDate(this.rangePicker.getStartDate()); endDate = new TZDate(this.rangePicker.getEndDate()); if (!this._validateForm(title, startDate, endDate)) { if (!title.value) { title.focus(); } return false; } isAllDay = !!domutil.get(cssPrefix + 'schedule-allday').checked; rangeDate = this._getRangeDate(startDate, endDate, isAllDay); form = { calendarId: this._selectedCal ? this._selectedCal.id : null, title: title, location: domutil.get(cssPrefix + 'schedule-location'), start: rangeDate.start, end: rangeDate.end, isAllDay: isAllDay, state: domutil.get(cssPrefix + 'schedule-state').innerText, isPrivate: !domutil.hasClass(domutil.get(cssPrefix + 'schedule-private'), config.classname('public')) }; if (this._isEditMode) { this._onClickUpdateSchedule(form); } else { this._onClickCreateSchedule(form); } this.hide(); return true; }; /** * @override * @param {object} viewModel - view model from factory/monthView */ ScheduleCreationPopup.prototype.render = function(viewModel) { var calendars = this.calendars; var layer = this.layer; var self = this; var boxElement, guideElements; viewModel.zIndex = this.layer.zIndex + 5; viewModel.calendars = calendars; if (calendars.length) { viewModel.selectedCal = this._selectedCal = calendars[0]; } this._isEditMode = viewModel.schedule && viewModel.schedule.id; if (this._isEditMode) { boxElement = viewModel.target; viewModel = this._makeEditModeData(viewModel); } else { this.guide = viewModel.guide; guideElements = this._getGuideElements(this.guide); boxElement = guideElements.length ? guideElements[0] : null; } layer.setContent(tmpl(viewModel)); this._createDatepicker(viewModel.start, viewModel.end, viewModel.isAllDay); layer.show(); if (boxElement) { this._setPopupPositionAndArrowDirection(boxElement.getBoundingClientRect()); } util.debounce(function() { domevent.on(document.body, 'mousedown', self._onMouseDown, self); })(); }; /** * Make view model for edit mode * @param {object} viewModel - original view model from 'beforeCreateEditPopup' * @returns {object} - edit mode view model */ ScheduleCreationPopup.prototype._makeEditModeData = function(viewModel) { var schedule = viewModel.schedule; var title, isPrivate, location, startDate, endDate, isAllDay, state; var raw = schedule.raw || {}; var calendars = this.calendars; var id = schedule.id; title = schedule.title; isPrivate = raw['class'] === 'private'; location = schedule.location; startDate = schedule.start; endDate = schedule.end; isAllDay = schedule.isAllDay; state = schedule.state; viewModel.selectedCal = this._selectedCal = common.find(this.calendars, function(cal) { return cal.id === viewModel.schedule.calendarId; }); this._schedule = schedule; return { id: id, selectedCal: this._selectedCal, calendars: calendars, title: title, isPrivate: isPrivate, location: location, isAllDay: isAllDay, state: state, start: startDate, end: endDate, raw: { class: isPrivate ? 'private' : 'public' }, zIndex: this.layer.zIndex + 5, isEditMode: this._isEditMode }; }; /** * Set popup position and arrow direction to apear near guide element * @param {MonthCreationGuide|TimeCreationGuide|DayGridCreationGuide} guideBound - creation guide element */ ScheduleCreationPopup.prototype._setPopupPositionAndArrowDirection = function(guideBound) { var layer = domutil.find(config.classname('.popup'), this.layer.container); var layerSize = { width: layer.offsetWidth, height: layer.offsetHeight }; var containerBound = this.container.getBoundingClientRect(); var pos = this._calcRenderingData(layerSize, containerBound, guideBound); this.layer.setPosition(pos.x, pos.y); this._setArrowDirection(pos.arrow); }; /** * Get guide elements from creation guide object * It is used to calculate rendering position of popup * It will be disappeared when hiding popup * @param {MonthCreationGuide|TimeCreationGuide|AlldayCreationGuide} guide - creation guide * @returns {Array.} creation guide element */ ScheduleCreationPopup.prototype._getGuideElements = function(guide) { var guideElements = []; var i = 0; if (guide.guideElement) { guideElements.push(guide.guideElement); } else if (guide.guideElements) { for (; i < MAX_WEEK_OF_MONTH; i += 1) { if (guide.guideElements[i]) { guideElements.push(guide.guideElements[i]); } } } return guideElements; }; /** * Get guide element's bound data which only includes top, right, bottom, left * @param {Array.} guideElements - creation guide elements * @returns {Object} - popup bound data */ ScheduleCreationPopup.prototype._getBoundOfFirstRowGuideElement = function(guideElements) { var bound; if (!guideElements.length) { return null; } bound = guideElements[0].getBoundingClientRect(); return { top: bound.top, left: bound.left, bottom: bound.bottom, right: bound.right }; }; /** * Get calculate rendering positions of y and arrow direction by guide block elements * @param {number} guideBoundTop - guide block's top * @param {number} guideBoundBottom - guide block's bottom * @param {number} layerHeight - popup layer's height * @param {number} containerTop - container's top * @param {number} containerBottom - container's bottom * @returns {YAndArrowDirection} y and arrowDirection */ ScheduleCreationPopup.prototype._getYAndArrowDirection = function( guideBoundTop, guideBoundBottom, layerHeight, containerTop, containerBottom ) { var arrowDirection = 'arrow-bottom'; var MARGIN = 3; var y = guideBoundTop - layerHeight; if (y < containerTop) { y = guideBoundBottom - containerTop + MARGIN; arrowDirection = 'arrow-top'; } else { y = y - containerTop - MARGIN; } if (y + layerHeight > containerBottom) { y = containerBottom - layerHeight - containerTop - MARGIN; } /** * @typedef {Object} YAndArrowDirection * @property {number} y - top position of popup layer * @property {string} [arrowDirection] - direction of popup arrow */ return { y: y, arrowDirection: arrowDirection }; }; /** * Get calculate rendering x position and arrow left by guide block elements * @param {number} guideBoundLeft - guide block's left * @param {number} guideBoundRight - guide block's right * @param {number} layerWidth - popup layer's width * @param {number} containerLeft - container's left * @param {number} containerRight - container's right * @returns {XAndArrowLeft} x and arrowLeft */ ScheduleCreationPopup.prototype._getXAndArrowLeft = function( guideBoundLeft, guideBoundRight, layerWidth, containerLeft, containerRight ) { var guideHorizontalCenter = (guideBoundLeft + guideBoundRight) / 2; var x = guideHorizontalCenter - (layerWidth / 2); var ARROW_WIDTH_HALF = 8; var arrowLeft; if (x + layerWidth > containerRight) { x = guideBoundRight - layerWidth + ARROW_WIDTH_HALF; arrowLeft = guideHorizontalCenter - x; } else { x += ARROW_WIDTH_HALF; } if (x < containerLeft) { x = 0; arrowLeft = guideHorizontalCenter - containerLeft - ARROW_WIDTH_HALF; } else { x = x - containerLeft - ARROW_WIDTH_HALF; } /** * @typedef {Object} XAndArrowLeft * @property {number} x - left position of popup layer * @property {numbe3er} arrowLeft - relative position of popup arrow, if it is not set, arrow appears on the middle of popup */ return { x: x, arrowLeft: arrowLeft }; }; /** * Calculate rendering position usering guide elements * @param {{width: {number}, height: {number}}} layerSize - popup layer's width and height * @param {{top: {number}, left: {number}, right: {number}, bottom: {number}}} containerBound - width and height of the upper layer, that acts as a border of popup * @param {{top: {number}, left: {number}, right: {number}, bottom: {number}}} guideBound - guide element bound data * @returns {PopupRenderingData} rendering position of popup and popup arrow */ ScheduleCreationPopup.prototype._calcRenderingData = function(layerSize, containerBound, guideBound) { var yPosInfo = this._getYAndArrowDirection( guideBound.top, guideBound.bottom, layerSize.height, containerBound.top, containerBound.bottom ); var xPosInfo = this._getXAndArrowLeft( guideBound.left, guideBound.right, layerSize.width, containerBound.left, containerBound.right ); /** * @typedef {Object} PopupRenderingData * @property {number} x - left position * @property {number} y - top position * @property {string} arrow.direction - direction of popup arrow * @property {number} [arrow.position] - relative position of popup arrow, if it is not set, arrow appears on the middle of popup */ return { x: xPosInfo.x, y: yPosInfo.y, arrow: { direction: yPosInfo.arrowDirection, position: xPosInfo.arrowLeft } }; }; /** * Set arrow's direction and position * @param {Object} arrow rendering data for popup arrow */ ScheduleCreationPopup.prototype._setArrowDirection = function(arrow) { var direction = arrow.direction || 'arrow-bottom'; var arrowEl = domutil.get(config.classname('popup-arrow')); var borderElement = domutil.find(config.classname('.popup-arrow-border', arrowEl)); if (direction !== config.classname('arrow-bottom')) { domutil.removeClass(arrowEl, config.classname('arrow-bottom')); domutil.addClass(arrowEl, config.classname(direction)); } if (arrow.position) { borderElement.style.left = arrow.position + 'px'; } }; /** * Create date range picker using start date and end date * @param {TZDate} start - start date * @param {TZDate} end - end date * @param {boolean} isAllDay - isAllDay */ ScheduleCreationPopup.prototype._createDatepicker = function(start, end, isAllDay) { var cssPrefix = config.cssPrefix; this.rangePicker = DatePicker.createRangePicker({ startpicker: { date: new TZDate(start).toDate(), input: '#' + cssPrefix + 'schedule-start-date', container: '#' + cssPrefix + 'startpicker-container' }, endpicker: { date: new TZDate(end).toDate(), input: '#' + cssPrefix + 'schedule-end-date', container: '#' + cssPrefix + 'endpicker-container' }, format: isAllDay ? 'yyyy-MM-dd' : 'yyyy-MM-dd HH:mm', timepicker: isAllDay ? null : { showMeridiem: false, usageStatistics: this._usageStatistics }, usageStatistics: this._usageStatistics }); }; /** * Hide layer */ ScheduleCreationPopup.prototype.hide = function() { this.layer.hide(); if (this.guide) { this.guide.clearGuideElement(); this.guide = null; } domevent.off(document.body, 'mousedown', this._onMouseDown, this); }; /** * refresh layer */ ScheduleCreationPopup.prototype.refresh = function() { if (this._viewModel) { this.layer.setContent(this.tmpl(this._viewModel)); } }; /** * Set calendar list * @param {Array.} calendars - calendar list */ ScheduleCreationPopup.prototype.setCalendars = function(calendars) { this.calendars = calendars || []; }; /** * Validate the form * @param {string} title title of then entered schedule * @param {TZDate} startDate start date time from range picker * @param {TZDate} endDate end date time from range picker * @returns {boolean} Returns false if the form is not valid for submission. */ ScheduleCreationPopup.prototype._validateForm = function(title, startDate, endDate) { if (!title.value) { return false; } if (!startDate && !endDate) { return false; } if (datetime.compare(startDate, endDate) === 1) { return false; } return true; }; /** * Get range date from range picker * @param {TZDate} startDate start date time from range picker * @param {TZDate} endDate end date time from range picker * @param {boolean} isAllDay whether it is an all-day schedule * @returns {RangeDate} Returns the start and end time data that is the range date */ ScheduleCreationPopup.prototype._getRangeDate = function(startDate, endDate, isAllDay) { var start = isAllDay ? datetime.start(startDate) : startDate; var end = isAllDay ? datetime.renderEnd(startDate, endDate) : endDate; /** * @typedef {object} RangeDate * @property {TZDate} start start time * @property {TZDate} end end time */ return { start: new TZDate(start), end: new TZDate(end) }; }; /** * Request schedule model creation to controller by custom schedules. * @fires {ScheduleCreationPopup#beforeUpdateSchedule} * @param {{ calendarId: {string}, title: {string}, location: {string}, start: {TZDate}, end: {TZDate}, isAllDay: {boolean}, state: {string}, isPrivate: {boolean} }} form schedule input form data */ ScheduleCreationPopup.prototype._onClickUpdateSchedule = function(form) { var changes = common.getScheduleChanges( this._schedule, ['calendarId', 'title', 'location', 'start', 'end', 'isAllDay', 'state'], { calendarId: form.calendarId, title: form.title.value, location: form.location.value, start: form.start, end: form.end, isAllDay: form.isAllDay, state: form.state } ); /** * @event ScheduleCreationPopup#beforeUpdateSchedule * @type {object} * @property {Schedule} schedule - schedule object to be updated */ this.fire('beforeUpdateSchedule', { schedule: util.extend({ raw: { class: form.isPrivate ? 'private' : 'public' } }, this._schedule), changes: changes, start: form.start, end: form.end, calendar: this._selectedCal, triggerEventName: 'click' }); }; /** * Request the controller to update the schedule model according to the custom schedule. * @fires {ScheduleCreationPopup#beforeCreateSchedule} * @param {{ calendarId: {string}, title: {string}, location: {string}, start: {TZDate}, end: {TZDate}, isAllDay: {boolean}, state: {string} }} form schedule input form data */ ScheduleCreationPopup.prototype._onClickCreateSchedule = function(form) { /** * @event ScheduleCreationPopup#beforeCreateSchedule * @type {object} * @property {Schedule} schedule - new schedule instance to be added */ this.fire('beforeCreateSchedule', { calendarId: form.calendarId, title: form.title.value, location: form.location.value, raw: { class: form.isPrivate ? 'private' : 'public' }, start: form.start, end: form.end, isAllDay: form.isAllDay, state: form.state }); }; module.exports = ScheduleCreationPopup; /***/ }), /***/ "./src/js/view/popup/scheduleDetailPopup.js": /*!**************************************************!*\ !*** ./src/js/view/popup/scheduleDetailPopup.js ***! \**************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint-disable vars-on-top */ /** * @fileoverview Floating layer for showing detail schedule * @author NHN FE Development Lab */ var View = __webpack_require__(/*! ../../view/view */ "./src/js/view/view.js"); var FloatingLayer = __webpack_require__(/*! ../../common/floatingLayer */ "./src/js/common/floatingLayer.js"); var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"), domevent = __webpack_require__(/*! ../../common/domevent */ "./src/js/common/domevent.js"), domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var tmpl = __webpack_require__(/*! ../template/popup/scheduleDetailPopup.hbs */ "./src/js/view/template/popup/scheduleDetailPopup.hbs"); var tz = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js"); var TZDate = tz.Date; var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); /** * @constructor * @extends {View} * @param {HTMLElement} container - container element */ function ScheduleDetailPopup(container) { View.call(this, container); /** * @type {FloatingLayer} */ this.layer = new FloatingLayer(null, container); /** * cached view model * @type {object} */ this._viewModel = null; this._schedule = null; this._calendar = null; domevent.on(container, 'click', this._onClick, this); } util.inherit(ScheduleDetailPopup, View); /** * Mousedown event handler for hiding popup layer when user mousedown outside of * layer * @param {MouseEvent} mouseDownEvent - mouse event object */ ScheduleDetailPopup.prototype._onMouseDown = function(mouseDownEvent) { var target = domevent.getEventTarget(mouseDownEvent), popupLayer = domutil.closest(target, config.classname('.floating-layer')); if (popupLayer) { return; } this.hide(); }; /** * @override */ ScheduleDetailPopup.prototype.destroy = function() { this.layer.destroy(); this.layer = null; domevent.off(this.container, 'click', this._onClick, this); domevent.off(document.body, 'mousedown', this._onMouseDown, this); View.prototype.destroy.call(this); }; /** * @override * Click event handler for close button * @param {MouseEvent} clickEvent - mouse event object */ ScheduleDetailPopup.prototype._onClick = function(clickEvent) { var target = domevent.getEventTarget(clickEvent); this._onClickEditSchedule(target); this._onClickDeleteSchedule(target); }; /** * @fires ScheduleDetailPopup#clickEditSchedule * @param {HTMLElement} target - event target */ ScheduleDetailPopup.prototype._onClickEditSchedule = function(target) { var className = config.classname('popup-edit'); if (domutil.hasClass(target, className) || domutil.closest(target, '.' + className)) { this.fire('beforeUpdateSchedule', { schedule: this._schedule, triggerEventName: 'click', target: this._scheduleEl }); this.hide(); } }; /** * @fires ScheduleDetailPopup#clickEditSchedule * @param {HTMLElement} target - event target */ ScheduleDetailPopup.prototype._onClickDeleteSchedule = function(target) { var className = config.classname('popup-delete'); if (domutil.hasClass(target, className) || domutil.closest(target, '.' + className)) { this.fire('beforeDeleteSchedule', { schedule: this._schedule }); this.hide(); } }; /** * @override * @param {object} viewModel - view model from factory/monthView */ ScheduleDetailPopup.prototype.render = function(viewModel) { var layer = this.layer; var self = this; layer.setContent(tmpl({ schedule: this._getScheduleModel(viewModel.schedule), calendar: viewModel.calendar })); layer.show(); this._setPopupPositionAndArrowDirection(viewModel.event); this._schedule = viewModel.schedule; this._calendar = viewModel.calendar; util.debounce(function() { domevent.on(document.body, 'mousedown', self._onMouseDown, self); })(); }; // eslint-disable-next-line complexity ScheduleDetailPopup.prototype._getScheduleModel = function(scheduleViewModel) { var viewModel = util.extend({}, scheduleViewModel); var dayStart = datetime.start(scheduleViewModel.start); var startDayOffset = dayStart.toDate().getTimezoneOffset(); var nativeOffsetMs = tz.getNativeOffsetMs(); var hasPrimaryTimezoneCustomSetting = tz.hasPrimaryTimezoneCustomSetting(); var startOffset = viewModel.start.toDate().getTimezoneOffset(); var endOffset = viewModel.end.toDate().getTimezoneOffset(); var primaryTimezoneCode = tz.getPrimaryTimezoneName(); var primaryOffset = tz.getPrimaryOffset(); var startTimezoneOffset = tz.getOffsetByTimezoneName( primaryTimezoneCode, viewModel.start.getTime() ); var endTimezoneOffset = tz.getOffsetByTimezoneName( primaryTimezoneCode, viewModel.end.getTime() ); var MIN_TO_MS = 60 * 1000; var offsetDiffMs = 0; var start, end; if ( hasPrimaryTimezoneCustomSetting && tz.isNativeOsUsingDSTTimezone() && nativeOffsetMs !== startDayOffset ) { // When using a custom time zone, the native time zone offset is fixed and rendered. // So, The fixed and rendered time should be recalculated as the original time zone offset. // The current system OS local time is not affected by summer/standard time and the schedule should always be displayed in the same location. offsetDiffMs = (startOffset * MIN_TO_MS) - nativeOffsetMs; start = new TZDate(viewModel.start); start.addMilliseconds(offsetDiffMs); viewModel.start = start; offsetDiffMs = (endOffset * MIN_TO_MS) - nativeOffsetMs; end = new TZDate(viewModel.end); end.addMilliseconds(offsetDiffMs); viewModel.end = end; } if ( hasPrimaryTimezoneCustomSetting && tz.isPrimaryUsingDSTTimezone() && (primaryOffset !== startTimezoneOffset || primaryOffset !== endTimezoneOffset) ) { // The custom time zone is a time zone where two offsets including DST are applied. // The first rendered schedule is calculated and drawn with the offset calculated at the access time(system OS local time). // It should be recalculated with the original time zone offset. offsetDiffMs = (primaryOffset - startTimezoneOffset) * MIN_TO_MS; start = new TZDate(viewModel.start); start.addMilliseconds(offsetDiffMs); viewModel.start = start; offsetDiffMs = (primaryOffset - endTimezoneOffset) * MIN_TO_MS; end = new TZDate(viewModel.end); end.addMilliseconds(offsetDiffMs); viewModel.end = end; } return viewModel; }; /** * Set popup position and arrow direction to apear near guide element * @param {Event} event - creation guide element */ ScheduleDetailPopup.prototype._setPopupPositionAndArrowDirection = function(event) { var layer = domutil.find(config.classname('.popup'), this.layer.container); var layerSize = { width: layer.offsetWidth, height: layer.offsetHeight }; var containerBound = this.container.getBoundingClientRect(); var scheduleEl = domevent.getEventTarget(event); var blockEl = domutil.closest(scheduleEl, config.classname('.time-date-schedule-block')) || domutil.closest(scheduleEl, config.classname('.weekday-schedule')) || scheduleEl; var scheduleBound = blockEl.getBoundingClientRect(); var pos; this._scheduleEl = blockEl; pos = this._calcRenderingData(layerSize, containerBound, scheduleBound); this.layer.setPosition(pos.x, pos.y); this._setArrowDirection(pos.arrow); }; /** * Get calculate rendering positions of y and arrow top by schedule block elements * @param {number} scheduleBoundTop - schedule block's top * @param {number} scheduleBoundBottom - schedule block's bottom * @param {number} layerHeight - popup layer's height * @param {number} containerTop - container's top * @param {number} containerBottom - container's bottom * @returns {YAndArrowTop} y and arrowTop */ ScheduleDetailPopup.prototype._getYAndArrowTop = function( scheduleBoundTop, scheduleBoundBottom, layerHeight, containerTop, containerBottom ) { var ARROW_WIDTH_HALF = 8; var scheduleVerticalCenter, y, arrowTop; scheduleBoundTop = scheduleBoundTop < 0 ? 0 : scheduleBoundTop; scheduleVerticalCenter = (scheduleBoundTop + scheduleBoundBottom) / 2; y = scheduleVerticalCenter - (layerHeight / 2); if (y < containerTop) { y = 0; arrowTop = scheduleVerticalCenter - containerTop - ARROW_WIDTH_HALF; } else if (y + layerHeight > containerBottom) { y = Math.max(containerBottom - layerHeight - containerTop, 0); arrowTop = scheduleVerticalCenter - y - containerTop - ARROW_WIDTH_HALF; } else { y -= containerTop; } if (arrowTop < 0 || arrowTop > layerHeight) { arrowTop = null; } /** * @typedef {Object} YAndArrowTop * @property {number} y - top position of popup layer * @property {number} [arrowTop] - relative position of popup arrow, if it is not set, arrow appears on the middle of popup */ return { y: y, arrowTop: arrowTop }; }; /** * Get calculate rendering x position and arrow direction by schedule block elements * @param {number} scheduleBoundLeft - schedule block's left * @param {number} scheduleBoundRight - schedule block's right * @param {number} layerWidth - popup layer's width * @param {number} containerLeft - container's left * @param {number} containerRight - container's right * @returns {XAndArrowDirection} x and arrowDirection */ ScheduleDetailPopup.prototype._getXAndArrowDirection = function( scheduleBoundLeft, scheduleBoundRight, layerWidth, containerLeft, containerRight ) { var arrowDirection = 'arrow-left'; var x = scheduleBoundRight; var MARGIN = 4; if (x + layerWidth > containerRight) { arrowDirection = 'arrow-right'; x = scheduleBoundLeft - layerWidth - MARGIN; } else { x += MARGIN; } if (x < containerLeft) { x = 0; } else { x -= containerLeft; } /** * @typedef {Object} XAndArrowDirection * @property {number} x - left position of popup layer * @property {string} arrowDirection - direction of popup arrow */ return { x: x, arrowDirection: arrowDirection }; }; /** * Calculate rendering position usering guide elements * @param {{width: {number}, height: {number}}} layerSize - popup layer's width and height * @param {{top: {number}, left: {number}, right: {number}, bottom: {number}}} containerBound - width and height of the upper layer, that acts as a border of popup * @param {{top: {number}, left: {number}, right: {number}, bottom: {number}}} scheduleBound - guide element bound data * @returns {PopupRenderingData} rendering position of popup and popup arrow */ ScheduleDetailPopup.prototype._calcRenderingData = function(layerSize, containerBound, scheduleBound) { var yPosInfo = this._getYAndArrowTop( scheduleBound.top, scheduleBound.bottom, layerSize.height, containerBound.top, containerBound.bottom ); var xPosInfo = this._getXAndArrowDirection( scheduleBound.left, scheduleBound.right, layerSize.width, containerBound.left, containerBound.right ); /** * @typedef {Object} PopupRenderingData * @property {number} x - left position * @property {number} y - top position * @property {string} arrow.direction - direction of popup arrow * @property {number} [arrow.position] - relative position of popup arrow, if it is not set, arrow appears on the middle of popup */ return { x: xPosInfo.x, y: yPosInfo.y, arrow: { direction: xPosInfo.arrowDirection, position: yPosInfo.arrowTop } }; }; /** * Set arrow's direction and position * @param {Object} arrow rendering data for popup arrow */ ScheduleDetailPopup.prototype._setArrowDirection = function(arrow) { var direction = arrow.direction || 'arrow-left'; var arrowEl = domutil.find(config.classname('.popup-arrow'), this.layer.container); var borderElement = domutil.find(config.classname('.popup-arrow-border'), arrowEl); if (direction !== config.classname('arrow-left')) { domutil.removeClass(arrowEl, config.classname('arrow-left')); domutil.addClass(arrowEl, config.classname(direction)); } if (arrow.position) { borderElement.style.top = arrow.position + 'px'; } }; /** * Hide layer */ ScheduleDetailPopup.prototype.hide = function() { this.layer.hide(); if (this.guide) { this.guide.clearGuideElement(); this.guide = null; } domevent.off(document.body, 'mousedown', this._onMouseDown, this); }; /** * refresh layer */ ScheduleDetailPopup.prototype.refresh = function() { if (this._viewModel) { this.layer.setContent(this.tmpl(this._viewModel)); } }; module.exports = ScheduleDetailPopup; /***/ }), /***/ "./src/js/view/template/helper.js": /*!****************************************!*\ !*** ./src/js/view/template/helper.js ***! \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* eslint complexity: 0 */ /** * @fileoverview Helpers for handlebar templates. * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var Handlebars = __webpack_require__(/*! handlebars-template-loader/runtime */ "./node_modules/handlebars-template-loader/runtime/index.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var mmax = Math.max; var SIXTY_MINUTES = 60; var helpers = { /** * Stamp supplied object * * Commonly use for rendering object's unique ID to rendered view * @param {object} obj - object to stamp * @returns {number} stamp value */ 'stamp': function(obj) { return util.stamp(obj); }, /** * Whether supplied object are equal? * @param {*} a - a * @param {*} b - b * @returns {boolean} result of operation */ 'equal': function(a, b) { return a === b; }, /** * OR * @param {*} a - a * @param {*} b - b * @returns {boolean} or */ 'or': function(a, b) { return a || b; }, /** * AND * @param {*} a - a * @param {*} b - b * @returns {boolean} or */ 'and': function(a, b) { return a && b; }, /** * Compare object or apply logical operation by customizable oper parameter * @param {*} a - a * @param {string} oper - operator ex) '==', '<' * @param {*} b - b * @param {Handlebars} options - handlebar options * @returns {boolean} result of operation */ 'fi': function(a, oper, b, options) { switch (oper) { case '==': return (a == b) ? options.fn(this) : options.inverse(this); // eslint-disable-line case '===': return (a === b) ? options.fn(this) : options.inverse(this); case '!==': return (a !== b) ? options.fn(this) : options.inverse(this); case '<': return (a < b) ? options.fn(this) : options.inverse(this); case '||': return (a || b) ? options.fn(this) : options.inverse(this); default: throw new Error('Not match operation'); } }, /** * Get hhmm formatted time str * @param {Date} date - date object * @returns {string} formatted value */ 'hhmm': function(date) { return datetime.format(date, 'HH:mm'); }, /** * Get `width` stylesheet string * @param {number} width - width percentage * @returns {string} css style part */ 'common-width': function(width) { return getElSize(width, '%', 'width'); }, /** * Get element left based on narrowWeekend * @param {object} viewModel - view model * @param {Array} grids - dates information * @returns {number} element left */ 'grid-left': function(viewModel, grids) { return getElLeft(viewModel, grids); }, /** * Get element width based on narrowWeekend * @param {object} viewModel - view model * @param {Array} grids - dates information * @returns {number} element width */ 'grid-width': function(viewModel, grids) { return getElWidth(viewModel, grids); }, /** * Use in time.hbs * @param {ScheduleViewModel} viewModel viewModel * @returns {string} element size css class */ 'time-scheduleBlock': function(viewModel) { var top = getElSize(viewModel.top, 'px', 'top'), left = getElSize(viewModel.left, '%', 'left'), width = getElSize(viewModel.width, '%', 'width'), height = getElSize(viewModel.height, 'px', 'height'); return [top, left, width, height].join(';'); }, 'month-scheduleBlock': function(viewModel, grids, blockHeight, paddingTop) { var top = getElSize(((viewModel.top - 1) * blockHeight) + paddingTop, 'px', 'top'); var left = getElSize(grids[viewModel.left] ? grids[viewModel.left].left : 0, '%', 'left'); var width = getElSize(getElWidth(viewModel, grids), '%', 'width'); var height = getElSize(viewModel.height, 'px', 'height'); return [top, left, width, height].join(';'); }, 'holiday': function(day) { var cssClass = ''; if (day === 0) { cssClass = config.classname('holiday-sun'); } if (day === 6) { cssClass = config.classname('holiday-sat'); } return cssClass; }, /** * Add supplied two parameter * @param {*} a - a * @param {*} b - b * @returns {number} result of operation */ 'add': function(a, b) { return a + b; }, /** * Multiply supplied two parameter * @param {*} a - a * @param {*} b - b * @returns {number} result of operation */ 'multiply': function(a, b) { return a * b; }, /** * Divide supplied two parameter * @param {*} a - a * @param {*} b - b * @returns {number} result of operation */ 'divide': function(a, b) { return a / b; }, /** * Subtract supplied two parameter * @param {*} a - a * @param {*} b - b * @returns {number} result of operation */ 'subtract': function(a, b) { return a - b; }, 'getRight': function(a, b) { return mmax(0, 100 - (a + b)); }, /** * Get css prefix in global configuration * @returns {string} css prefix */ 'CSS_PREFIX': function() { return config.cssPrefix; }, 'reverse': function(array) { return array.slice().reverse(); }, /********** * Default schedule template **********/ 'milestone-tmpl': function(model) { var icon = config.classname('icon'); var iconName = config.classname('ic-milestone'); return '' + common.stripTags(model.title) + ''; }, 'milestoneTitle-tmpl': function() { var className = config.classname('left-content'); return 'Milestone'; }, 'task-tmpl': function(model) { return '#' + model.title; }, 'taskTitle-tmpl': function() { var className = config.classname('left-content'); return 'Task'; }, 'alldayTitle-tmpl': function() { var className = config.classname('left-content'); return 'All Day'; }, 'allday-tmpl': function(model) { return common.stripTags(model.title); }, 'time-tmpl': function(model) { return common.stripTags(model.title); }, 'goingDuration-tmpl': function(model) { var goingDuration = model.goingDuration; var hour = parseInt(goingDuration / SIXTY_MINUTES, 10); var minutes = goingDuration % SIXTY_MINUTES; return 'GoingTime ' + datetime.leadingZero(hour, 2) + ':' + datetime.leadingZero(minutes, 2); }, 'comingDuration-tmpl': function(model) { var goingDuration = model.goingDuration; var hour = parseInt(goingDuration / SIXTY_MINUTES, 10); var minutes = goingDuration % SIXTY_MINUTES; return 'ComingTime ' + datetime.leadingZero(hour, 2) + ':' + datetime.leadingZero(minutes, 2); }, 'monthMoreTitleDate-tmpl': function(date, dayname) { var classDay = config.classname('month-more-title-day'); var classDayLabel = config.classname('month-more-title-day-label'); var day = util.pick(date.split('.'), 2); return '' + day + ' ' + dayname + ''; }, 'monthMoreClose-tmpl': function() { return ''; }, 'monthGridHeader-tmpl': function(model) { var date = parseInt(model.date.split('-')[2], 10); var classNames = []; classNames.push(config.classname('weekday-grid-date')); if (model.isToday) { classNames.push(config.classname('weekday-grid-date-decorator')); } return '' + date + ''; }, 'monthGridHeaderExceed-tmpl': function(hiddenSchedules) { var className = config.classname('weekday-grid-more-schedules'); return '' + hiddenSchedules + ' more'; }, 'monthGridFooter-tmpl': function() { return ''; }, /* eslint no-unused-vars: 0 */ 'monthGridFooterExceed-tmpl': function(hiddenSchedules) { return ''; }, 'monthDayname-tmpl': function(model) { return model.label; }, 'weekDayname-tmpl': function(model) { var classDate = config.classname('dayname-date'); var className = config.classname('dayname-name'); return '' + model.date + '  ' + model.dayName + ''; }, 'weekGridFooterExceed-tmpl': function(hiddenSchedules) { return '+' + hiddenSchedules; }, 'dayGridTitle-tmpl': function(viewName) { var tmpl = Handlebars.helpers[viewName + 'Title-tmpl']; if (tmpl) { return tmpl(viewName); } return viewName; }, 'schedule-tmpl': function(model) { var tmpl = Handlebars.helpers[model.category + '-tmpl']; if (tmpl) { return tmpl(model); } return ''; }, 'collapseBtnTitle-tmpl': function() { var iconName = config.classname('icon'); var closeIconName = config.classname('ic-arrow-solid-top'); return ''; }, 'timezoneDisplayLabel-tmpl': function(timezoneOffset, displayLabel) { var gmt, hour, minutes; if (util.isUndefined(displayLabel)) { gmt = timezoneOffset < 0 ? '-' : '+'; hour = Math.abs(parseInt(timezoneOffset / SIXTY_MINUTES, 10)); minutes = Math.abs(timezoneOffset % SIXTY_MINUTES); displayLabel = gmt + datetime.leadingZero(hour, 2) + ':' + datetime.leadingZero(minutes, 2); } return displayLabel; }, 'timegridDisplayPrimayTime-tmpl': function(time) { /* TODO: 삭제 필요 (will be deprecated) */ return Handlebars.helpers['timegridDisplayPrimaryTime-tmpl'](time); }, 'timegridDisplayPrimaryTime-tmpl': function(time) { var hour = time.hour; var meridiem = hour >= 12 ? 'pm' : 'am'; if (hour > 12) { hour = hour - 12; } return hour + ' ' + meridiem; }, 'timegridDisplayTime-tmpl': function(time) { return datetime.leadingZero(time.hour, 2) + ':' + datetime.leadingZero(time.minutes, 2); }, 'timegridCurrentTime-tmpl': function(timezone) { var templates = []; if (timezone.dateDifference) { templates.push('[' + timezone.dateDifferenceSign + timezone.dateDifference + ']
'); } templates.push(datetime.format(timezone.hourmarker, 'HH:mm')); return templates.join(''); }, 'popupIsAllDay-tmpl': function() { return 'All day'; }, 'popupStateFree-tmpl': function() { return 'Free'; }, 'popupStateBusy-tmpl': function() { return 'Busy'; }, 'titlePlaceholder-tmpl': function() { return 'Subject'; }, 'locationPlaceholder-tmpl': function() { return 'Location'; }, 'startDatePlaceholder-tmpl': function() { return 'Start date'; }, 'endDatePlaceholder-tmpl': function() { return 'End date'; }, 'popupSave-tmpl': function() { return 'Save'; }, 'popupUpdate-tmpl': function() { return 'Update'; }, 'popupDetailDate-tmpl': function(isAllDay, start, end) { var isSameDate = datetime.isSameDate(start, end); var endFormat = (isSameDate ? '' : 'YYYY.MM.DD ') + 'hh:mm tt'; if (isAllDay) { return datetime.format(start, 'YYYY.MM.DD') + (isSameDate ? '' : ' - ' + datetime.format(end, 'YYYY.MM.DD')); } return (datetime.format(start, 'YYYY.MM.DD hh:mm tt') + ' - ' + datetime.format(end, endFormat)); }, 'popupDetailLocation-tmpl': function(schedule) { return schedule.location; }, 'popupDetailUser-tmpl': function(schedule) { return (schedule.attendees || []).join(', '); }, 'popupDetailState-tmpl': function(schedule) { return schedule.state || 'Busy'; }, 'popupDetailRepeat-tmpl': function(schedule) { return schedule.recurrenceRule; }, 'popupDetailBody-tmpl': function(schedule) { return schedule.body; }, 'popupEdit-tmpl': function() { return 'Edit'; }, 'popupDelete-tmpl': function() { return 'Delete'; } }; /** * Get CSS syntax for element size * @param {number} value - size value to apply element * @param {string} postfix - postfix string ex) px, em, % * @param {string} prefix - property name ex) width, height * @returns {string} CSS syntax */ function getElSize(value, postfix, prefix) { prefix = prefix || ''; if (util.isNumber(value)) { return prefix + ':' + value + postfix; } return prefix + ':auto'; } /** * Get element left based on narrowWeekend * @param {object} viewModel - view model * @param {Array} grids - dates information * @returns {number} element left */ function getElLeft(viewModel, grids) { return grids[viewModel.left] ? grids[viewModel.left].left : 0; } /** * Get element width based on narrowWeekend * @param {object} viewModel - view model * @param {Array} grids - dates information * @returns {number} element width */ function getElWidth(viewModel, grids) { var width = 0; var i = 0; var length = grids.length; var left; for (; i < viewModel.width; i += 1) { left = (viewModel.left + i) % length; left += parseInt((viewModel.left + i) / length, 10); if (left < length) { width += grids[left] ? grids[left].width : 0; } } return width; } Handlebars.registerHelper(helpers); /***/ }), /***/ "./src/js/view/template/month/month.hbs": /*!**********************************************!*\ !*** ./src/js/view/template/month/month.hbs ***! \**********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n \n " + ((stack1 = (lookupProperty(helpers,"monthDayname-tmpl")||(depth0 && lookupProperty(depth0,"monthDayname-tmpl"))||alias2).call(alias1,depth0,{"name":"monthDayname-tmpl","hash":{},"data":data,"loc":{"start":{"line":16,"column":12},"end":{"line":16,"column":40}}})) != null ? stack1 : "") + "\n \n
\n"; },"2":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " border-right: " + container.escapeExpression(container.lambda(((stack1 = ((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"styles"))) && lookupProperty(stack1,"borderLeft")), depth0)) + ";\n"; },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.escapeExpression, alias3=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n" + ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"daynames") : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":3,"column":0},"end":{"line":19,"column":9}}})) != null ? stack1 : "") + "
\n"; },"useData":true}); /***/ }), /***/ "./src/js/view/template/month/more.hbs": /*!*********************************************!*\ !*** ./src/js/view/template/month/more.hbs ***! \*********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = (lookupProperty(helpers,"fi")||(depth0 && lookupProperty(depth0,"fi"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"isAllDay") : stack1),"||",(depth0 != null ? lookupProperty(depth0,"hasMultiDates") : depth0),{"name":"fi","hash":{},"fn":container.program(2, data, 0),"inverse":container.program(7, data, 0),"data":data,"loc":{"start":{"line":9,"column":8},"end":{"line":65,"column":15}}})) != null ? stack1 : ""); },"2":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=container.escapeExpression, alias4=container.lambda, alias5="function", lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n " + ((stack1 = (lookupProperty(helpers,"allday-tmpl")||(depth0 && lookupProperty(depth0,"allday-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"model") : depth0),{"name":"allday-tmpl","hash":{},"data":data,"loc":{"start":{"line":20,"column":20},"end":{"line":20,"column":43}}})) != null ? stack1 : "") + "\n
\n"; },"3":function(container,depth0,helpers,partials,data) { var stack1, alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " color: #ffffff; background-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + "; border-left:3px solid " + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"borderColor") : stack1), depth0)) + ";\n"; },"5":function(container,depth0,helpers,partials,data) { var stack1, alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + "; background-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"bgColor") : stack1), depth0)) + "; border-left:3px solid " + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"borderColor") : stack1), depth0)) + ";\n"; },"7":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = (lookupProperty(helpers,"fi")||(depth0 && lookupProperty(depth0,"fi"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"category") : stack1),"===","time",{"name":"fi","hash":{},"fn":container.program(8, data, 0),"inverse":container.program(17, data, 0),"data":data,"loc":{"start":{"line":23,"column":12},"end":{"line":64,"column":19}}})) != null ? stack1 : ""); },"8":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=container.escapeExpression, alias4=container.lambda, alias5="function", lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n \n " + ((stack1 = (lookupProperty(helpers,"time-tmpl")||(depth0 && lookupProperty(depth0,"time-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"model") : depth0),{"name":"time-tmpl","hash":{},"data":data,"loc":{"start":{"line":42,"column":53},"end":{"line":42,"column":74}}})) != null ? stack1 : "") + "\n
\n"; },"9":function(container,depth0,helpers,partials,data) { return " background: #ffffff\n"; },"11":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " background:" + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"borderColor") : stack1), depth0)) + "\n "; },"13":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "\n color: #ffffff;\n background-color: " + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + "\n"; },"15":function(container,depth0,helpers,partials,data) { return " color:#333;\n "; },"17":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=container.escapeExpression, alias4=container.lambda, alias5="function", lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n " + ((stack1 = (lookupProperty(helpers,"schedule-tmpl")||(depth0 && lookupProperty(depth0,"schedule-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"model") : depth0),{"name":"schedule-tmpl","hash":{},"data":data,"loc":{"start":{"line":62,"column":65},"end":{"line":62,"column":90}}})) != null ? stack1 : "") + "\n
\n"; },"18":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":47,"column":115},"end":{"line":47,"column":129}}}) : helper))) + "weekday-schedule-focused "; },"20":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " margin-left: " + container.escapeExpression(container.lambda(((stack1 = ((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"styles"))) && lookupProperty(stack1,"marginLeft")), depth0)) + ";\n"; },"22":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " margin-right: " + container.escapeExpression(container.lambda(((stack1 = ((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"styles"))) && lookupProperty(stack1,"marginRight")), depth0)) + ";\n"; },"24":function(container,depth0,helpers,partials,data) { var stack1, alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " color: #ffffff; background-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + "; border-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + ";\n"; },"26":function(container,depth0,helpers,partials,data) { var stack1, alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + "; background-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"bgColor") : stack1), depth0)) + "; border-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"borderColor") : stack1), depth0)) + ";\n"; },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n
\n " + ((stack1 = (lookupProperty(helpers,"monthMoreTitleDate-tmpl")||(depth0 && lookupProperty(depth0,"monthMoreTitleDate-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"date") : depth0),(depth0 != null ? lookupProperty(depth0,"dayname") : depth0),{"name":"monthMoreTitleDate-tmpl","hash":{},"data":data,"loc":{"start":{"line":4,"column":58},"end":{"line":4,"column":100}}})) != null ? stack1 : "") + "\n \n
\n
\n" + ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"schedules") : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":8,"column":8},"end":{"line":66,"column":17}}})) != null ? stack1 : "") + "
\n
\n"; },"useData":true}); /***/ }), /***/ "./src/js/view/template/month/weekdayInMonth.hbs": /*!*******************************************************!*\ !*** ./src/js/view/template/month/weekdayInMonth.hbs ***! \*******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n
\n " + ((stack1 = (lookupProperty(helpers,"monthGridHeader-tmpl")||(depth0 && lookupProperty(depth0,"monthGridHeader-tmpl"))||alias2).call(alias1,depth0,{"name":"monthGridHeader-tmpl","hash":{},"data":data,"loc":{"start":{"line":14,"column":44},"end":{"line":14,"column":75}}})) != null ? stack1 : "") + "\n" + ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"hiddenSchedules") : depth0),{"name":"if","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":15,"column":12},"end":{"line":17,"column":19}}})) != null ? stack1 : "") + "
\n
\n " + ((stack1 = (lookupProperty(helpers,"monthGridFooter-tmpl")||(depth0 && lookupProperty(depth0,"monthGridFooter-tmpl"))||alias2).call(alias1,depth0,{"name":"monthGridFooter-tmpl","hash":{},"data":data,"loc":{"start":{"line":20,"column":44},"end":{"line":20,"column":75}}})) != null ? stack1 : "") + "\n" + ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"hiddenSchedules") : depth0),{"name":"if","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":21,"column":12},"end":{"line":23,"column":19}}})) != null ? stack1 : "") + "
\n
\n"; },"2":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":7,"column":84},"end":{"line":7,"column":98}}}) : helper))) + "near-month-day"; },"4":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":7,"column":135},"end":{"line":7,"column":149}}}) : helper))) + "today"; },"6":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":7,"column":182},"end":{"line":7,"column":196}}}) : helper))) + "extra-date"; },"8":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " border-right:" + container.escapeExpression(container.lambda(((stack1 = ((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"styles"))) && lookupProperty(stack1,"borderLeft")), depth0)) + ";\n"; },"10":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + ((stack1 = (lookupProperty(helpers,"monthGridHeaderExceed-tmpl")||(depth0 && lookupProperty(depth0,"monthGridHeaderExceed-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"hiddenSchedules") : depth0),{"name":"monthGridHeaderExceed-tmpl","hash":{},"data":data,"loc":{"start":{"line":16,"column":87},"end":{"line":16,"column":135}}})) != null ? stack1 : "") + "\n"; },"12":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + ((stack1 = (lookupProperty(helpers,"monthGridFooterExceed-tmpl")||(depth0 && lookupProperty(depth0,"monthGridFooterExceed-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"hiddenSchedules") : depth0),{"name":"monthGridFooterExceed-tmpl","hash":{},"data":data,"loc":{"start":{"line":22,"column":87},"end":{"line":22,"column":135}}})) != null ? stack1 : "") + "\n"; },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n
\n" + ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"dates") : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":6,"column":0},"end":{"line":26,"column":11}}})) != null ? stack1 : "") + "
\n
\n"; },"useData":true}); /***/ }), /***/ "./src/js/view/template/month/weekdayInMonthSchedule.hbs": /*!***************************************************************!*\ !*** ./src/js/view/template/month/weekdayInMonthSchedule.hbs ***! \***************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = lookupProperty(helpers,"each").call(depth0 != null ? depth0 : (container.nullContext || {}),depth0,{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":2,"column":0},"end":{"line":80,"column":11}}})) != null ? stack1 : ""); },"2":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "\n" + ((stack1 = lookupProperty(helpers,"each").call(depth0 != null ? depth0 : (container.nullContext || {}),depth0,{"name":"each","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":3,"column":0},"end":{"line":79,"column":11}}})) != null ? stack1 : ""); },"3":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "\n" + ((stack1 = lookupProperty(helpers,"if").call(depth0 != null ? depth0 : (container.nullContext || {}),depth0,{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":4,"column":0},"end":{"line":78,"column":9}}})) != null ? stack1 : ""); },"4":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "\n" + ((stack1 = (lookupProperty(helpers,"fi")||(depth0 && lookupProperty(depth0,"fi"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? lookupProperty(depth0,"top") : depth0),"<",((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"renderLimitIdx")),{"name":"fi","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":5,"column":4},"end":{"line":77,"column":13}}})) != null ? stack1 : ""); },"5":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=container.escapeExpression, alias4="function", lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n" + ((stack1 = (lookupProperty(helpers,"fi")||(depth0 && lookupProperty(depth0,"fi"))||alias2).call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"isAllDay") : stack1),"||",(depth0 != null ? lookupProperty(depth0,"hasMultiDates") : depth0),{"name":"fi","hash":{},"fn":container.program(10, data, 0),"inverse":container.program(23, data, 0),"data":data,"loc":{"start":{"line":13,"column":8},"end":{"line":75,"column":15}}})) != null ? stack1 : "") + "
\n"; },"6":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":9,"column":31},"end":{"line":9,"column":45}}}) : helper))) + "weekday-exceed-left"; },"8":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":10,"column":32},"end":{"line":10,"column":46}}}) : helper))) + "weekday-exceed-right"; },"10":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : (container.nullContext || {}), alias4=container.hooks.helperMissing, alias5="function", lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n " + ((stack1 = (lookupProperty(helpers,"allday-tmpl")||(depth0 && lookupProperty(depth0,"allday-tmpl"))||alias4).call(alias3,(depth0 != null ? lookupProperty(depth0,"model") : depth0),{"name":"allday-tmpl","hash":{},"data":data,"loc":{"start":{"line":29,"column":47},"end":{"line":29,"column":70}}})) != null ? stack1 : "") + "\n " + ((stack1 = lookupProperty(helpers,"unless").call(alias3,(lookupProperty(helpers,"or")||(depth0 && lookupProperty(depth0,"or"))||alias4).call(alias3,((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"isReadOnly")),((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"isReadOnly") : stack1),{"name":"or","hash":{},"data":data,"loc":{"start":{"line":30,"column":22},"end":{"line":30,"column":60}}}),{"name":"unless","hash":{},"fn":container.program(21, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":30,"column":12},"end":{"line":30,"column":194}}})) != null ? stack1 : "") + "\n
\n"; },"11":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":14,"column":146},"end":{"line":14,"column":160}}}) : helper))) + "weekday-schedule-focused "; },"13":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " margin-left: " + container.escapeExpression(container.lambda(((stack1 = ((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"styles"))) && lookupProperty(stack1,"marginLeft")), depth0)) + ";\n"; },"15":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " margin-right: " + container.escapeExpression(container.lambda(((stack1 = ((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"styles"))) && lookupProperty(stack1,"marginRight")), depth0)) + ";\n"; },"17":function(container,depth0,helpers,partials,data) { var stack1, alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " color: #ffffff; background-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + "; border-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + ";\n"; },"19":function(container,depth0,helpers,partials,data) { var stack1, alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + "; background-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"bgColor") : stack1), depth0)) + "; border-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"borderColor") : stack1), depth0)) + ";\n"; },"21":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " "; },"23":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = (lookupProperty(helpers,"fi")||(depth0 && lookupProperty(depth0,"fi"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"category") : stack1),"===","time",{"name":"fi","hash":{},"fn":container.program(24, data, 0),"inverse":container.program(33, data, 0),"data":data,"loc":{"start":{"line":33,"column":12},"end":{"line":74,"column":19}}})) != null ? stack1 : ""); },"24":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : (container.nullContext || {}), alias4=container.hooks.helperMissing, alias5="function", lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n \n " + ((stack1 = (lookupProperty(helpers,"time-tmpl")||(depth0 && lookupProperty(depth0,"time-tmpl"))||alias4).call(alias3,(depth0 != null ? lookupProperty(depth0,"model") : depth0),{"name":"time-tmpl","hash":{},"data":data,"loc":{"start":{"line":54,"column":53},"end":{"line":54,"column":74}}})) != null ? stack1 : "") + "\n
\n"; },"25":function(container,depth0,helpers,partials,data) { return " background: #ffffff\n"; },"27":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " background:" + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"borderColor") : stack1), depth0)) + "\n"; },"29":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " color: #ffffff;\n background-color: " + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + "\n"; },"31":function(container,depth0,helpers,partials,data) { return " color:#333;\n"; },"33":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : (container.nullContext || {}), alias4=container.hooks.helperMissing, alias5="function", lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
\n " + ((stack1 = (lookupProperty(helpers,"schedule-tmpl")||(depth0 && lookupProperty(depth0,"schedule-tmpl"))||alias4).call(alias3,(depth0 != null ? lookupProperty(depth0,"model") : depth0),{"name":"schedule-tmpl","hash":{},"data":data,"loc":{"start":{"line":72,"column":65},"end":{"line":72,"column":90}}})) != null ? stack1 : "") + "\n
\n"; },"34":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " margin-left: " + container.escapeExpression(container.lambda(((stack1 = ((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"styles"))) && lookupProperty(stack1,"marginLeft")), depth0)) + ";\n"; },"36":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " margin-right: " + container.escapeExpression(container.lambda(((stack1 = ((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"styles"))) && lookupProperty(stack1,"marginRight")), depth0)) + ";\n"; },"38":function(container,depth0,helpers,partials,data) { var stack1, alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " color: #ffffff; background-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + "; border-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + ";\n"; },"40":function(container,depth0,helpers,partials,data) { var stack1, alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + "; background-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"bgColor") : stack1), depth0)) + "; border-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"borderColor") : stack1), depth0)) + ";\n"; },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = lookupProperty(helpers,"each").call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? lookupProperty(depth0,"matrices") : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":1,"column":0},"end":{"line":81,"column":11}}})) != null ? stack1 : ""); },"useData":true}); /***/ }), /***/ "./src/js/view/template/popup/scheduleCreationPopup.hbs": /*!**************************************************************!*\ !*** ./src/js/view/template/popup/scheduleCreationPopup.hbs ***! \**************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":3,"column":150},"end":{"line":3,"column":164}}}) : helper))) + "hide"; },"3":function(container,depth0,helpers,partials,data) { var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
  • \n \n " + alias4(((helper = (helper = lookupProperty(helpers,"name") || (depth0 != null ? lookupProperty(depth0,"name") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data,"loc":{"start":{"line":13,"column":60},"end":{"line":13,"column":68}}}) : helper))) + "\n
  • \n"; },"5":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":23,"column":135},"end":{"line":23,"column":149}}}) : helper))) + "public"; },"7":function(container,depth0,helpers,partials,data) { return " checked"; },"9":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return container.escapeExpression(((helper = (helper = lookupProperty(helpers,"state") || (depth0 != null ? lookupProperty(depth0,"state") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"state","hash":{},"data":data,"loc":{"start":{"line":54,"column":99},"end":{"line":54,"column":108}}}) : helper))); },"11":function(container,depth0,helpers,partials,data) { var stack1, helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = ((helper = (helper = lookupProperty(helpers,"popupStateBusy-tmpl") || (depth0 != null ? lookupProperty(depth0,"popupStateBusy-tmpl") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"popupStateBusy-tmpl","hash":{},"data":data,"loc":{"start":{"line":54,"column":116},"end":{"line":54,"column":141}}}) : helper))) != null ? stack1 : ""); },"13":function(container,depth0,helpers,partials,data) { var stack1, helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = ((helper = (helper = lookupProperty(helpers,"popupUpdate-tmpl") || (depth0 != null ? lookupProperty(depth0,"popupUpdate-tmpl") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"popupUpdate-tmpl","hash":{},"data":data,"loc":{"start":{"line":69,"column":163},"end":{"line":69,"column":185}}}) : helper))) != null ? stack1 : ""); },"15":function(container,depth0,helpers,partials,data) { var stack1, helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = ((helper = (helper = lookupProperty(helpers,"popupSave-tmpl") || (depth0 != null ? lookupProperty(depth0,"popupSave-tmpl") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"popupSave-tmpl","hash":{},"data":data,"loc":{"start":{"line":69,"column":193},"end":{"line":69,"column":213}}}) : helper))) != null ? stack1 : ""); },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n
    \n
    \n \n
      \n" + ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"calendars") : depth0),{"name":"each","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":10,"column":16},"end":{"line":15,"column":25}}})) != null ? stack1 : "") + "
    \n
    \n
    \n
    \n \n \n
    \n \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n -\n
    \n \n \n
    \n
    \n
    \n \n \n " + ((stack1 = ((helper = (helper = lookupProperty(helpers,"popupIsAllDay-tmpl") || (depth0 != null ? lookupProperty(depth0,"popupIsAllDay-tmpl") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"popupIsAllDay-tmpl","hash":{},"data":data,"loc":{"start":{"line":48,"column":52},"end":{"line":48,"column":76}}}) : helper))) != null ? stack1 : "") + "\n
    \n
    \n
    \n \n
      \n
    • \n \n " + ((stack1 = ((helper = (helper = lookupProperty(helpers,"popupStateBusy-tmpl") || (depth0 != null ? lookupProperty(depth0,"popupStateBusy-tmpl") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"popupStateBusy-tmpl","hash":{},"data":data,"loc":{"start":{"line":60,"column":52},"end":{"line":60,"column":77}}}) : helper))) != null ? stack1 : "") + "\n
    • \n
    • \n \n " + ((stack1 = ((helper = (helper = lookupProperty(helpers,"popupStateFree-tmpl") || (depth0 != null ? lookupProperty(depth0,"popupStateFree-tmpl") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"popupStateFree-tmpl","hash":{},"data":data,"loc":{"start":{"line":64,"column":52},"end":{"line":64,"column":77}}}) : helper))) != null ? stack1 : "") + "\n
    • \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n"; },"useData":true}); /***/ }), /***/ "./src/js/view/template/popup/scheduleDetailPopup.hbs": /*!************************************************************!*\ !*** ./src/js/view/template/popup/scheduleDetailPopup.hbs ***! \************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    " + ((stack1 = (lookupProperty(helpers,"popupDetailLocation-tmpl")||(depth0 && lookupProperty(depth0,"popupDetailLocation-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"schedule") : depth0),{"name":"popupDetailLocation-tmpl","hash":{},"data":data,"loc":{"start":{"line":11,"column":182},"end":{"line":11,"column":221}}})) != null ? stack1 : "") + "
    "; },"3":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    " + ((stack1 = (lookupProperty(helpers,"popupDetailRepeat-tmpl")||(depth0 && lookupProperty(depth0,"popupDetailRepeat-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"schedule") : depth0),{"name":"popupDetailRepeat-tmpl","hash":{},"data":data,"loc":{"start":{"line":12,"column":186},"end":{"line":12,"column":223}}})) != null ? stack1 : "") + "
    "; },"5":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    " + ((stack1 = (lookupProperty(helpers,"popupDetailUser-tmpl")||(depth0 && lookupProperty(depth0,"popupDetailUser-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"schedule") : depth0),{"name":"popupDetailUser-tmpl","hash":{},"data":data,"loc":{"start":{"line":13,"column":218},"end":{"line":13,"column":253}}})) != null ? stack1 : "") + "
    "; },"7":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    " + ((stack1 = (lookupProperty(helpers,"popupDetailState-tmpl")||(depth0 && lookupProperty(depth0,"popupDetailState-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"schedule") : depth0),{"name":"popupDetailState-tmpl","hash":{},"data":data,"loc":{"start":{"line":14,"column":176},"end":{"line":14,"column":212}}})) != null ? stack1 : "") + "
    "; },"9":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    " + alias4(alias5(((stack1 = (depth0 != null ? lookupProperty(depth0,"calendar") : depth0)) != null ? lookupProperty(stack1,"name") : stack1), depth0)) + "
    \n"; },"11":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    " + ((stack1 = (lookupProperty(helpers,"popupDetailBody-tmpl")||(depth0 && lookupProperty(depth0,"popupDetailBody-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"schedule") : depth0),{"name":"popupDetailBody-tmpl","hash":{},"data":data,"loc":{"start":{"line":18,"column":151},"end":{"line":18,"column":186}}})) != null ? stack1 : "") + "
    "; },"13":function(container,depth0,helpers,partials,data) { return ""; },"15":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n \n
    \n \n
    \n"; },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n
    \n
    \n
    \n \n " + alias4(alias5(((stack1 = (depth0 != null ? lookupProperty(depth0,"schedule") : depth0)) != null ? lookupProperty(stack1,"title") : stack1), depth0)) + "\n
    \n
    " + ((stack1 = (lookupProperty(helpers,"popupDetailDate-tmpl")||(depth0 && lookupProperty(depth0,"popupDetailDate-tmpl"))||alias2).call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"schedule") : depth0)) != null ? lookupProperty(stack1,"isAllDay") : stack1),((stack1 = (depth0 != null ? lookupProperty(depth0,"schedule") : depth0)) != null ? lookupProperty(stack1,"start") : stack1),((stack1 = (depth0 != null ? lookupProperty(depth0,"schedule") : depth0)) != null ? lookupProperty(stack1,"end") : stack1),{"name":"popupDetailDate-tmpl","hash":{},"data":data,"loc":{"start":{"line":8,"column":73},"end":{"line":8,"column":145}}})) != null ? stack1 : "") + "
    \n
    \n
    \n " + ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"schedule") : depth0)) != null ? lookupProperty(stack1,"location") : stack1),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":11,"column":8},"end":{"line":11,"column":241}}})) != null ? stack1 : "") + "\n " + ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"schedule") : depth0)) != null ? lookupProperty(stack1,"recurrenceRule") : stack1),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":12,"column":8},"end":{"line":12,"column":243}}})) != null ? stack1 : "") + "\n " + ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"schedule") : depth0)) != null ? lookupProperty(stack1,"attendees") : stack1),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":13,"column":8},"end":{"line":13,"column":273}}})) != null ? stack1 : "") + "\n " + ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"schedule") : depth0)) != null ? lookupProperty(stack1,"state") : stack1),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":14,"column":8},"end":{"line":14,"column":232}}})) != null ? stack1 : "") + "\n" + ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"calendar") : depth0),{"name":"if","hash":{},"fn":container.program(9, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":15,"column":8},"end":{"line":17,"column":15}}})) != null ? stack1 : "") + " " + ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"schedule") : depth0)) != null ? lookupProperty(stack1,"body") : stack1),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":18,"column":8},"end":{"line":18,"column":206}}})) != null ? stack1 : "") + "\n
    \n" + ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (depth0 != null ? lookupProperty(depth0,"schedule") : depth0)) != null ? lookupProperty(stack1,"isReadOnly") : stack1),{"name":"if","hash":{},"fn":container.program(13, data, 0),"inverse":container.program(15, data, 0),"data":data,"loc":{"start":{"line":20,"column":4},"end":{"line":27,"column":11}}})) != null ? stack1 : "") + "
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n"; },"useData":true}); /***/ }), /***/ "./src/js/view/template/week/dayGrid.hbs": /*!***********************************************!*\ !*** ./src/js/view/template/week/dayGrid.hbs ***! \***********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n"; },"2":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " border-right: " + container.escapeExpression(container.lambda(((stack1 = ((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"styles"))) && lookupProperty(stack1,"borderRight")), depth0)) + ";\n"; },"4":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = lookupProperty(helpers,"each").call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? lookupProperty(depth0,"days") : depth0),{"name":"each","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":17,"column":8},"end":{"line":27,"column":19}}})) != null ? stack1 : ""); },"5":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = lookupProperty(helpers,"if").call(depth0 != null ? depth0 : (container.nullContext || {}),((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"collapsed")),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.program(9, data, 0),"data":data,"loc":{"start":{"line":18,"column":12},"end":{"line":26,"column":19}}})) != null ? stack1 : ""); },"6":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = lookupProperty(helpers,"if").call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? lookupProperty(depth0,"hiddenSchedules") : depth0),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":19,"column":16},"end":{"line":21,"column":23}}})) != null ? stack1 : ""); },"7":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + ((stack1 = (lookupProperty(helpers,"weekGridFooterExceed-tmpl")||(depth0 && lookupProperty(depth0,"weekGridFooterExceed-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"hiddenSchedules") : depth0),{"name":"weekGridFooterExceed-tmpl","hash":{},"data":data,"loc":{"start":{"line":20,"column":145},"end":{"line":20,"column":192}}})) != null ? stack1 : "") + "\n"; },"9":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = (lookupProperty(helpers,"fi")||(depth0 && lookupProperty(depth0,"fi"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),(data && lookupProperty(data,"key")),"===",((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"collapseBtnIndex")),{"name":"fi","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":23,"column":16},"end":{"line":25,"column":23}}})) != null ? stack1 : ""); },"10":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + ((stack1 = ((helper = (helper = lookupProperty(helpers,"collapseBtnTitle-tmpl") || (depth0 != null ? lookupProperty(depth0,"collapseBtnTitle-tmpl") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"collapseBtnTitle-tmpl","hash":{},"data":data,"loc":{"start":{"line":24,"column":121},"end":{"line":24,"column":148}}}) : helper))) != null ? stack1 : "") + "\n"; },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n " + ((stack1 = (lookupProperty(helpers,"dayGridTitle-tmpl")||(depth0 && lookupProperty(depth0,"dayGridTitle-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"viewName") : depth0),{"name":"dayGridTitle-tmpl","hash":{},"data":data,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":36}}})) != null ? stack1 : "") + "\n
    \n
    \n
    \n
    \n" + ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"days") : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":7,"column":8},"end":{"line":14,"column":19}}})) != null ? stack1 : "") + ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"showExpandableButton")),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":16,"column":8},"end":{"line":28,"column":15}}})) != null ? stack1 : "") + "
    \n
    \n
    \n"; },"useData":true}); /***/ }), /***/ "./src/js/view/template/week/dayGridSchedule.hbs": /*!*******************************************************!*\ !*** ./src/js/view/template/week/dayGridSchedule.hbs ***! \*******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = lookupProperty(helpers,"each").call(depth0 != null ? depth0 : (container.nullContext || {}),depth0,{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":3,"column":4},"end":{"line":27,"column":15}}})) != null ? stack1 : ""); },"2":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "\n " + ((stack1 = lookupProperty(helpers,"each").call(depth0 != null ? depth0 : (container.nullContext || {}),depth0,{"name":"each","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":4,"column":4},"end":{"line":26,"column":15}}})) != null ? stack1 : ""); },"3":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "\n " + ((stack1 = lookupProperty(helpers,"if").call(depth0 != null ? depth0 : (container.nullContext || {}),depth0,{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":5,"column":4},"end":{"line":25,"column":13}}})) != null ? stack1 : ""); },"4":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=container.escapeExpression, alias4="function", alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "\n
    \n
    \n " + ((stack1 = (lookupProperty(helpers,"schedule-tmpl")||(depth0 && lookupProperty(depth0,"schedule-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"model") : depth0),{"name":"schedule-tmpl","hash":{},"data":data,"loc":{"start":{"line":21,"column":87},"end":{"line":21,"column":112}}})) != null ? stack1 : "") + "\n " + ((stack1 = lookupProperty(helpers,"unless").call(alias1,(lookupProperty(helpers,"or")||(depth0 && lookupProperty(depth0,"or"))||alias2).call(alias1,((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"isReadOnly")),((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"isReadOnly") : stack1),{"name":"or","hash":{},"data":data,"loc":{"start":{"line":22,"column":22},"end":{"line":22,"column":60}}}),{"name":"unless","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":22,"column":12},"end":{"line":22,"column":193}}})) != null ? stack1 : "") + "\n
    \n
    \n"; },"5":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":8,"column":31},"end":{"line":8,"column":45}}}) : helper))) + "weekday-exceed-left"; },"7":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":9,"column":32},"end":{"line":9,"column":46}}}) : helper))) + "weekday-exceed-right"; },"9":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":13,"column":146},"end":{"line":13,"column":160}}}) : helper))) + "weekday-schedule-focused "; },"11":function(container,depth0,helpers,partials,data) { var stack1, alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " color: #ffffff; background-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + "; border-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + ";\n"; },"13":function(container,depth0,helpers,partials,data) { var stack1, alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + "; background-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"bgColor") : stack1), depth0)) + "; border-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"borderColor") : stack1), depth0)) + ";\n"; },"15":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " "; },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n" + ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"matrices") : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":2,"column":4},"end":{"line":28,"column":15}}})) != null ? stack1 : "") + "
    \n"; },"useData":true}); /***/ }), /***/ "./src/js/view/template/week/daynames.hbs": /*!************************************************!*\ !*** ./src/js/view/template/week/daynames.hbs ***! \************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n \n " + ((stack1 = (lookupProperty(helpers,"weekDayname-tmpl")||(depth0 && lookupProperty(depth0,"weekDayname-tmpl"))||alias2).call(alias1,depth0,{"name":"weekDayname-tmpl","hash":{},"data":data,"loc":{"start":{"line":7,"column":8},"end":{"line":7,"column":35}}})) != null ? stack1 : "") + "\n \n
    \n"; },"2":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":3,"column":49},"end":{"line":3,"column":63}}}) : helper))) + "today"; },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n" + ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"dayNames") : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":2,"column":0},"end":{"line":10,"column":9}}})) != null ? stack1 : "") + "
    \n"; },"useData":true}); /***/ }), /***/ "./src/js/view/template/week/time.hbs": /*!********************************************!*\ !*** ./src/js/view/template/week/time.hbs ***! \********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = lookupProperty(helpers,"each").call(depth0 != null ? depth0 : (container.nullContext || {}),depth0,{"name":"each","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":3,"column":4},"end":{"line":60,"column":13}}})) != null ? stack1 : ""); },"2":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = lookupProperty(helpers,"each").call(depth0 != null ? depth0 : (container.nullContext || {}),depth0,{"name":"each","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":4,"column":8},"end":{"line":59,"column":17}}})) != null ? stack1 : ""); },"3":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = lookupProperty(helpers,"if").call(depth0 != null ? depth0 : (container.nullContext || {}),depth0,{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":5,"column":8},"end":{"line":58,"column":17}}})) != null ? stack1 : ""); },"4":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n
    \n" + ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"hasGoingDuration") : depth0),{"name":"if","hash":{},"fn":container.program(19, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":29,"column":12},"end":{"line":37,"column":19}}})) != null ? stack1 : "") + "
    \n " + ((stack1 = (lookupProperty(helpers,"time-tmpl")||(depth0 && lookupProperty(depth0,"time-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"model") : depth0),{"name":"time-tmpl","hash":{},"data":data,"loc":{"start":{"line":45,"column":20},"end":{"line":45,"column":41}}})) != null ? stack1 : "") + "\n
    \n" + ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"hasComingDuration") : depth0),{"name":"if","hash":{},"fn":container.program(26, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":47,"column":12},"end":{"line":54,"column":19}}})) != null ? stack1 : "") + "
    \n " + ((stack1 = lookupProperty(helpers,"unless").call(alias1,(lookupProperty(helpers,"or")||(depth0 && lookupProperty(depth0,"or"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"croppedEnd") : depth0),(lookupProperty(helpers,"or")||(depth0 && lookupProperty(depth0,"or"))||alias2).call(alias1,((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"isReadOnly")),((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"isReadOnly") : stack1),{"name":"or","hash":{},"data":data,"loc":{"start":{"line":56,"column":37},"end":{"line":56,"column":75}}}),{"name":"or","hash":{},"data":data,"loc":{"start":{"line":56,"column":22},"end":{"line":56,"column":76}}}),{"name":"unless","hash":{},"fn":container.program(29, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":56,"column":12},"end":{"line":56,"column":207}}})) != null ? stack1 : "") + "\n
    \n"; },"5":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " " + container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":6,"column":83},"end":{"line":6,"column":97}}}) : helper))) + "time-date-schedule-block-pending"; },"7":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " padding-left: " + container.escapeExpression(container.lambda(((stack1 = ((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"styles"))) && lookupProperty(stack1,"paddingLeft")), depth0)) + ";\n"; },"9":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":12,"column":147},"end":{"line":12,"column":161}}}) : helper))) + "time-schedule-focused "; },"11":function(container,depth0,helpers,partials,data) { var stack1, alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " border-bottom-left-radius: " + alias2(alias1(((stack1 = ((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"styles"))) && lookupProperty(stack1,"borderRadius")), depth0)) + ";\n border-bottom-right-radius: " + alias2(alias1(((stack1 = ((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"styles"))) && lookupProperty(stack1,"borderRadius")), depth0)) + ";\n"; },"13":function(container,depth0,helpers,partials,data) { var stack1, alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " border-top-left-radius: " + alias2(alias1(((stack1 = ((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"styles"))) && lookupProperty(stack1,"borderRadius")), depth0)) + ";\n border-top-right-radius: " + alias2(alias1(((stack1 = ((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"styles"))) && lookupProperty(stack1,"borderRadius")), depth0)) + ";\n"; },"15":function(container,depth0,helpers,partials,data) { var stack1, alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " color: #ffffff; background-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + "; border-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + ";\n"; },"17":function(container,depth0,helpers,partials,data) { var stack1, alias1=container.lambda, alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + "; background-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"bgColor") : stack1), depth0)) + "; border-color:" + alias2(alias1(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"borderColor") : stack1), depth0)) + ";\n"; },"19":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    " + ((stack1 = (lookupProperty(helpers,"goingDuration-tmpl")||(depth0 && lookupProperty(depth0,"goingDuration-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"model") : depth0),{"name":"goingDuration-tmpl","hash":{},"data":data,"loc":{"start":{"line":36,"column":66},"end":{"line":36,"column":96}}})) != null ? stack1 : "") + "
    \n"; },"20":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " border-color:" + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"color") : stack1), depth0)) + ";\n"; },"22":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " border-color:" + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"borderColor") : stack1), depth0)) + ";\n"; },"24":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "border-bottom: 1px dashed " + container.escapeExpression(((helper = (helper = lookupProperty(helpers,"travelBorderColor") || (depth0 != null ? lookupProperty(depth0,"travelBorderColor") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"travelBorderColor","hash":{},"data":data,"loc":{"start":{"line":44,"column":67},"end":{"line":44,"column":88}}}) : helper))) + ";"; },"26":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    " + ((stack1 = (lookupProperty(helpers,"comingDuration-tmpl")||(depth0 && lookupProperty(depth0,"comingDuration-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"model") : depth0),{"name":"comingDuration-tmpl","hash":{},"data":data,"loc":{"start":{"line":53,"column":26},"end":{"line":53,"column":57}}})) != null ? stack1 : "") + "
    \n"; },"27":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " border-color:" + container.escapeExpression(container.lambda(((stack1 = (depth0 != null ? lookupProperty(depth0,"model") : depth0)) != null ? lookupProperty(stack1,"borderColor") : stack1), depth0)) + ";\n "; },"29":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
     
    "; },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n" + ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"matrices") : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":2,"column":0},"end":{"line":61,"column":9}}})) != null ? stack1 : "") + "
    \n"; },"useData":true}); /***/ }), /***/ "./src/js/view/template/week/timeGrid.hbs": /*!************************************************!*\ !*** ./src/js/view/template/week/timeGrid.hbs ***! \************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n" + ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"isPrimary") : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.program(10, data, 0),"data":data,"loc":{"start":{"line":4,"column":8},"end":{"line":26,"column":15}}})) != null ? stack1 : "") + "
    \n"; },"2":function(container,depth0,helpers,partials,data) { return "display:none;"; },"4":function(container,depth0,helpers,partials,data) { var stack1, alias1=depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"timeSlots") : depth0),{"name":"each","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":5,"column":12},"end":{"line":9,"column":23}}})) != null ? stack1 : "") + ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"showHourMarker")),{"name":"if","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":10,"column":12},"end":{"line":14,"column":19}}})) != null ? stack1 : ""); },"5":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n " + ((stack1 = (lookupProperty(helpers,"timegridDisplayPrimayTime-tmpl")||(depth0 && lookupProperty(depth0,"timegridDisplayPrimayTime-tmpl"))||alias2).call(alias1,depth0,{"name":"timegridDisplayPrimayTime-tmpl","hash":{},"data":data,"loc":{"start":{"line":7,"column":68},"end":{"line":7,"column":109}}})) != null ? stack1 : "") + "\n
    \n"; },"6":function(container,depth0,helpers,partials,data) { return "display:none"; },"8":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n
    " + ((stack1 = (lookupProperty(helpers,"timegridCurrentTime-tmpl")||(depth0 && lookupProperty(depth0,"timegridCurrentTime-tmpl"))||alias2).call(alias1,depth0,{"name":"timegridCurrentTime-tmpl","hash":{},"data":data,"loc":{"start":{"line":12,"column":223},"end":{"line":12,"column":258}}})) != null ? stack1 : "") + "
    \n
    \n"; },"10":function(container,depth0,helpers,partials,data) { var stack1, alias1=depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"timeSlots") : depth0),{"name":"each","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":16,"column":12},"end":{"line":20,"column":23}}})) != null ? stack1 : "") + ((stack1 = lookupProperty(helpers,"if").call(alias1,((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"showHourMarker")),{"name":"if","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":21,"column":12},"end":{"line":25,"column":19}}})) != null ? stack1 : ""); },"11":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n " + ((stack1 = (lookupProperty(helpers,"timegridDisplayTime-tmpl")||(depth0 && lookupProperty(depth0,"timegridDisplayTime-tmpl"))||alias2).call(alias1,depth0,{"name":"timegridDisplayTime-tmpl","hash":{},"data":data,"loc":{"start":{"line":18,"column":68},"end":{"line":18,"column":103}}})) != null ? stack1 : "") + "\n
    \n"; },"13":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n
    " + ((stack1 = (lookupProperty(helpers,"timegridCurrentTime-tmpl")||(depth0 && lookupProperty(depth0,"timegridCurrentTime-tmpl"))||alias2).call(alias1,depth0,{"name":"timegridCurrentTime-tmpl","hash":{},"data":data,"loc":{"start":{"line":23,"column":171},"end":{"line":23,"column":206}}})) != null ? stack1 : "") + "
    \n
    \n"; },"15":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n
    \n
    \n"; },"16":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return " border-bottom: " + container.escapeExpression(container.lambda(((stack1 = ((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"styles"))) && lookupProperty(stack1,"borderBottom")), depth0)) + ";\n"; },"18":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n
    \n
    today
    \n
    \n
    \n
    \n"; },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n" + ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"timezones") : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":2,"column":4},"end":{"line":28,"column":15}}})) != null ? stack1 : "") + "
    \n
    \n
    \n" + ((stack1 = lookupProperty(helpers,"each").call(alias1,(depth0 != null ? lookupProperty(depth0,"hoursLabels") : depth0),{"name":"each","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":32,"column":8},"end":{"line":40,"column":19}}})) != null ? stack1 : "") + "
    \n
    \n
    \n
    \n\n" + ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"showHourMarker") : depth0),{"name":"if","hash":{},"fn":container.program(18, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":46,"column":4},"end":{"line":53,"column":11}}})) != null ? stack1 : "") + "
    \n"; },"useData":true}); /***/ }), /***/ "./src/js/view/template/week/timeGridCurrentTime.hbs": /*!***********************************************************!*\ !*** ./src/js/view/template/week/timeGridCurrentTime.hbs ***! \***********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = (lookupProperty(helpers,"timegridCurrentTime-tmpl")||(depth0 && lookupProperty(depth0,"timegridCurrentTime-tmpl"))||container.hooks.helperMissing).call(depth0 != null ? depth0 : (container.nullContext || {}),depth0,{"name":"timegridCurrentTime-tmpl","hash":{},"data":data,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}}})) != null ? stack1 : "") + "\n"; },"useData":true}); /***/ }), /***/ "./src/js/view/template/week/timeMoveGuide.hbs": /*!*****************************************************!*\ !*** ./src/js/view/template/week/timeMoveGuide.hbs ***! \*****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    " + ((stack1 = (lookupProperty(helpers,"goingDuration-tmpl")||(depth0 && lookupProperty(depth0,"goingDuration-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"model") : depth0),{"name":"goingDuration-tmpl","hash":{},"data":data,"loc":{"start":{"line":4,"column":230},"end":{"line":4,"column":260}}})) != null ? stack1 : "") + "
    \n"; },"3":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    " + ((stack1 = (lookupProperty(helpers,"comingDuration-tmpl")||(depth0 && lookupProperty(depth0,"comingDuration-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"model") : depth0),{"name":"comingDuration-tmpl","hash":{},"data":data,"loc":{"start":{"line":10,"column":228},"end":{"line":10,"column":259}}})) != null ? stack1 : "") + "
    \n"; },"5":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
     
    "; },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n
    \n" + ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"hasGoingDuration") : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":3,"column":8},"end":{"line":5,"column":15}}})) != null ? stack1 : "") + "
    \n " + ((stack1 = (lookupProperty(helpers,"time-tmpl")||(depth0 && lookupProperty(depth0,"time-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"model") : depth0),{"name":"time-tmpl","hash":{},"data":data,"loc":{"start":{"line":7,"column":16},"end":{"line":7,"column":37}}})) != null ? stack1 : "") + "\n
    \n" + ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"hasComingDuration") : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":9,"column":8},"end":{"line":11,"column":15}}})) != null ? stack1 : "") + "
    \n " + ((stack1 = lookupProperty(helpers,"unless").call(alias1,(depth0 != null ? lookupProperty(depth0,"croppedEnd") : depth0),{"name":"unless","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":13,"column":4},"end":{"line":13,"column":104}}})) != null ? stack1 : "") + "\n
    \n
    \n"; },"useData":true}); /***/ }), /***/ "./src/js/view/template/week/timezoneSticky.hbs": /*!******************************************************!*\ !*** ./src/js/view/template/week/timezoneSticky.hbs ***! \******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var Handlebars = __webpack_require__(/*! ./node_modules/handlebars/runtime.js */ "./node_modules/handlebars/runtime.js"); module.exports = (Handlebars['default'] || Handlebars).template({"1":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n
    \n" + ((stack1 = lookupProperty(helpers,"if").call(alias1,(lookupProperty(helpers,"and")||(depth0 && lookupProperty(depth0,"and"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"isPrimary") : depth0),((stack1 = (data && lookupProperty(data,"root"))) && lookupProperty(stack1,"showTimezoneCollapseButton")),{"name":"and","hash":{},"data":data,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":62}}}),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":4,"column":8},"end":{"line":10,"column":15}}})) != null ? stack1 : "") + "
    " + ((stack1 = (lookupProperty(helpers,"timezoneDisplayLabel-tmpl")||(depth0 && lookupProperty(depth0,"timezoneDisplayLabel-tmpl"))||alias2).call(alias1,(depth0 != null ? lookupProperty(depth0,"timezoneOffset") : depth0),(depth0 != null ? lookupProperty(depth0,"displayLabel") : depth0),{"name":"timezoneDisplayLabel-tmpl","hash":{},"data":data,"loc":{"start":{"line":11,"column":59},"end":{"line":11,"column":118}}})) != null ? stack1 : "") + "
    \n
    \n
    \n"; },"2":function(container,depth0,helpers,partials,data) { return "display:none;"; },"4":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return "
    \n \n \n \n
    \n"; },"5":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":7,"column":84},"end":{"line":7,"column":98}}}) : helper))) + "ic-arrow-right"; },"7":function(container,depth0,helpers,partials,data) { var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return container.escapeExpression(((helper = (helper = lookupProperty(helpers,"CSS_PREFIX") || (depth0 != null ? lookupProperty(depth0,"CSS_PREFIX") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"CSS_PREFIX","hash":{},"data":data,"loc":{"start":{"line":7,"column":120},"end":{"line":7,"column":134}}}) : helper))) + "ic-arrow-left"; },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, alias1=depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function(parent, propertyName) { if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { return parent[propertyName]; } return undefined }; return ((stack1 = lookupProperty(helpers,"each").call(alias1,(lookupProperty(helpers,"reverse")||(depth0 && lookupProperty(depth0,"reverse"))||container.hooks.helperMissing).call(alias1,(depth0 != null ? lookupProperty(depth0,"timezones") : depth0),{"name":"reverse","hash":{},"data":data,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":27}}}),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":1,"column":0},"end":{"line":14,"column":11}}})) != null ? stack1 : ""); },"useData":true}); /***/ }), /***/ "./src/js/view/view.js": /*!*****************************!*\ !*** ./src/js/view/view.js ***! \*****************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview The base class of views. * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var domutil = __webpack_require__(/*! ../common/domutil */ "./src/js/common/domutil.js"); var Collection = __webpack_require__(/*! ../common/collection */ "./src/js/common/collection.js"); /** * Base class of views. * * All views create own container element inside supplied container element. * @constructor * @param {HTMLElement} container Default container element for view. * you can use this element for this.container syntax. */ function View(container) { var id = util.stamp(this); if (util.isUndefined(container)) { container = domutil.appendHTMLElement('div'); } domutil.addClass(container, this.cssprefix(id)); /** * unique id * @type {number} */ this.id = id; /** * base element of view. * @type {HTMLDIVElement} */ this.container = container; /*eslint-disable*/ /** * child views. * @type {Collection} */ this.children = new Collection(function(view) { return util.stamp(view); }); /* eslint-enable*/ /** * parent view instance. * @type {View} */ this.parent = null; /** * state of view */ this.state = {}; } /** * CSS classname prefix * @type {string} */ View.prototype.cssPrefix = 'tui-view-'; /** * Add child views. * @param {View} view The view instance to add. * @param {function} [fn] Function for invoke before add. parent view class is supplied first arguments. */ View.prototype.addChild = function(view, fn) { if (fn) { fn.call(view, this); } // add parent view view.parent = this; this.children.add(view); }; /** * Remove added child view. * @param {(number|View)} id View id or instance itself to remove. * @param {function} [fn] Function for invoke before remove. parent view class is supplied first arguments. */ View.prototype.removeChild = function(id, fn) { var view = util.isNumber(id) ? this.children.items[id] : id; id = util.stamp(view); if (fn) { fn.call(view, this); } this.children.remove(id); }; /** * Render view recursively. */ View.prototype.render = function() { this.children.each(function(childView) { childView.render(); }); }; /** * Invoke function recursively. * @param {function} fn - function to invoke child view recursively * @param {boolean} [skipThis=false] - set true then skip invoke with this(root) view. */ View.prototype.recursive = function(fn, skipThis) { if (!util.isFunction(fn)) { return; } if (!skipThis) { fn(this); } this.children.each(function(childView) { childView.recursive(fn); }); }; /** * Resize view recursively to parent. */ View.prototype.resize = function() { var args = Array.prototype.slice.call(arguments), parent = this.parent; while (parent) { if (util.isFunction(parent._onResize)) { parent._onResize.apply(parent, args); } parent = parent.parent; } }; /** * Invoking method before destroying. */ View.prototype._beforeDestroy = function() {}; /** * Clear properties */ View.prototype._destroy = function() { this._beforeDestroy(); this.children.clear(); this.container.innerHTML = ''; this.id = this.parent = this.children = this.container = null; }; /*eslint-disable*/ /** * Destroy child view recursively. */ View.prototype.destroy = function(isChildView) { this.children.each(function(childView) { childView.destroy(true); childView._destroy(); }); if (isChildView) { return; } this._destroy(); }; /* eslint-enable*/ /** * Calculate view's container element bound. * @returns {object} The bound of container element. */ View.prototype.getViewBound = function() { var container = this.container, position = domutil.getPosition(container), size = domutil.getSize(container); return { x: position[0], y: position[1], width: size[0], height: size[1] }; }; /** * Return view default CSS prefix * @param {string} [className] - if supplied then return prefix added class name * @returns {string} CSS prefix value */ View.prototype.cssprefix = function(className) { return this.cssPrefix + (className || ''); }; /** * set state * @param {object} state - state */ View.prototype.setState = function(state) { util.extend(this.state, state); }; util.CustomEvents.mixin(View); module.exports = View; /***/ }), /***/ "./src/js/view/week/dayGrid.js": /*!*************************************!*\ !*** ./src/js/view/week/dayGrid.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview DayGrid in weekly view * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"), common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"), datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"), domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"), TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date, View = __webpack_require__(/*! ../../view/view */ "./src/js/view/view.js"), DayGridSchedule = __webpack_require__(/*! ./dayGridSchedule */ "./src/js/view/week/dayGridSchedule.js"), baseTmpl = __webpack_require__(/*! ../template/week/dayGrid.hbs */ "./src/js/view/template/week/dayGrid.hbs"), reqAnimFrame = __webpack_require__(/*! ../../common/reqAnimFrame */ "./src/js/common/reqAnimFrame.js"); var mmax = Math.max, mmin = Math.min; /** * @constructor * @extends {Weekday} * @param {string} name - view name * @param {object} options - options for DayGridSchedule view * @param {number} [options.heightPercent] - height percent of view * @param {number} [options.containerButtonGutter=8] - free space at bottom to * make create easy. * @param {number} [options.scheduleHeight=18] - height of each schedule block. * @param {number} [options.scheduleGutter=2] - gutter height of each schedule block. * @param {HTMLDIVElement} container - DOM element to use container for this * view. * @param {Theme} theme - theme instance */ function DayGrid(name, options, container, theme) { container = domutil.appendHTMLElement( 'div', container, config.classname('daygrid-layout') ); View.call(this, container); name = name || 'daygrid'; this.options = util.extend({ viewName: name, daynames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], renderStartDate: '', renderEndDate: '', containerBottomGutter: 18, scheduleHeight: parseInt(theme.week.dayGridSchedule.height, 10), scheduleGutter: parseInt(theme.week.dayGridSchedule.marginTop, 10), scheduleContainerTop: 1, timezones: options.timezones, isReadOnly: options.isReadOnly, getViewModelFunc: function(viewModel) { return viewModel.schedulesInDateRange[name]; }, setViewModelFunc: function(viewModel, matrices) { viewModel.schedulesInDateRange[name] = matrices; } }, options.week); this.handler = {}; this.vPanel = null; this.state.collapsed = true; } util.inherit(DayGrid, View); /** * @override * @param {object} viewModel - schedules view models */ DayGrid.prototype.getBaseViewModel = function(viewModel) { var opt = this.options, daynames = opt.daynames, range = viewModel.range, grids = viewModel.grids, matrices = opt.getViewModelFunc(viewModel), exceedDate = {}, panel = getPanel(opt.panels, opt.viewName), panelHeight = this.getViewBound().height, collapsed = this.state.collapsed, heightForcedSet = this.vPanel ? this.vPanel.getHeightForcedSet() : false, timezonesCollapsed = viewModel.state.timezonesCollapsed, styles = this._getStyles(viewModel.theme, timezonesCollapsed); var baseViewModel, visibleScheduleCount; var now = new TZDate().toLocalTime(); if (panel.showExpandableButton) { if (!heightForcedSet) { if (collapsed) { panelHeight = mmax(panelHeight, panel.maxHeight); } else { panelHeight = mmin(panelHeight, panel.maxExpandableHeight); } } visibleScheduleCount = Math.floor(panelHeight / (opt.scheduleHeight + opt.scheduleGutter)); if (collapsed) { exceedDate = this.parent.controller.getExceedDate(visibleScheduleCount, matrices, viewModel.range ); matrices = this.parent.controller.excludeExceedSchedules(matrices, visibleScheduleCount); opt.setViewModelFunc(viewModel, matrices); } } baseViewModel = { viewName: opt.viewName, range: range, grids: grids, days: util.map(viewModel.range, function(d, index) { var day = d.getDay(); var ymd = datetime.format(d, 'YYYYMMDD'); var isToday = datetime.isSameDate(now, d); return { day: day, dayName: daynames[day], isToday: isToday, date: d.getDate(), renderDate: datetime.format(d, 'YYYY-MM-DD'), hiddenSchedules: exceedDate[ymd] || 0, width: grids[index] ? grids[index].width : 0, left: grids[index] ? grids[index].left : 0, backgroundColor: viewModel.range.length > 1 ? getWeekBackgroundColor(day, isToday, styles) : styles.backgroundColor }; }), exceedDate: exceedDate, showExpandableButton: panel.showExpandableButton, collapsed: collapsed, collapseBtnIndex: this.state.clickedExpandBtnIndex, styles: styles }; return baseViewModel; }; /** * @override * @param {object} viewModel - schedules view models */ DayGrid.prototype.render = function(viewModel) { var opt = this.options, container = this.container, baseViewModel = this.getBaseViewModel(viewModel), scheduleContainerTop = this.options.scheduleContainerTop; var dayGridSchedule; container.innerHTML = baseTmpl(baseViewModel); this.children.clear(); dayGridSchedule = new DayGridSchedule( opt, domutil.find(config.classname('.container'), container) ); this.addChild(dayGridSchedule); dayGridSchedule.on('afterRender', function(weekdayViewModel) { baseViewModel.height = weekdayViewModel.minHeight + scheduleContainerTop; }); this.children.each(function(childView) { childView.render(viewModel); }, this); this.fire('afterRender', baseViewModel); }; DayGrid.prototype._beforeDestroy = function() { }; DayGrid.prototype.addHandler = function(type, handler, vPanel) { var self = this; this.handler[type] = handler; this.vPanel = vPanel; if (type === 'click') { handler.on('expand', function() { self.setState({ collapsed: false }); }, this); handler.on('collapse', function() { self.setState({ collapsed: true }); }, this); } }; DayGrid.prototype._expand = function() { reqAnimFrame.requestAnimFrame(function() { var vPanel = this.vPanel; var opt = this.options; var panel = getPanel(opt.panels, opt.viewName); vPanel.setMaxHeight(panel.maxExpandableHeight); vPanel.setHeightForcedSet(false); vPanel.setHeight(null, panel.maxExpandableHeight); if (this.parent) { this.parent.render(); } }, this); }; DayGrid.prototype._collapse = function() { reqAnimFrame.requestAnimFrame(function() { var vPanel = this.vPanel; var opt = this.options; var panel = getPanel(opt.panels, opt.viewName); vPanel.setMaxHeight(panel.maxHeight); vPanel.setHeightForcedSet(false); vPanel.setHeight(null, panel.minHeight); if (this.parent) { this.parent.render(); } }, this); }; /** * set state * @param {object} state - state */ DayGrid.prototype.setState = function(state) { var collapsed = this.state.collapsed; View.prototype.setState.call(this, state); if (this.state.collapsed === collapsed) { return; } if (this.state.collapsed) { this._collapse(); } else { this._expand(); } }; /** * Get the styles from theme * @param {Theme} theme - theme instance * @param {boolean} timezonesCollapsed - multiple timezones are collapsed. * @returns {object} styles - styles object */ DayGrid.prototype._getStyles = function(theme, timezonesCollapsed) { var styles = {}; var timezonesLength = this.options.timezones.length; var collapsed = timezonesCollapsed; var numberAndUnit; if (theme) { styles.borderRight = theme.week.daygrid.borderRight || theme.common.border; styles.todayBackgroundColor = theme.week.today.backgroundColor; styles.weekendBackgroundColor = theme.week.weekend.backgroundColor; styles.backgroundColor = theme.week.daygrid.backgroundColor; styles.leftWidth = theme.week.daygridLeft.width; styles.leftBackgroundColor = theme.week.daygridLeft.backgroundColor; styles.leftPaddingRight = theme.week.daygridLeft.paddingRight; styles.leftBorderRight = theme.week.daygridLeft.borderRight; if (!collapsed && timezonesLength > 1) { numberAndUnit = common.parseUnit(styles.leftWidth); styles.leftWidth = (numberAndUnit[0] * timezonesLength) + numberAndUnit[1]; } } return styles; }; /** * Get a background color based on day. * @param {number} day - day number * @param {boolean} isToday - today flag * @param {object} styles - style object * @returns {string} backgroundColor */ function getWeekBackgroundColor(day, isToday, styles) { var backgroundColor = ''; if (day === 0 || day === 6) { backgroundColor = styles.weekendBackgroundColor; } else if (isToday) { backgroundColor = styles.todayBackgroundColor; } else { backgroundColor = styles.backgroundColor; } return backgroundColor; } /** * get a panel infomation * @param {Array.} panels - panel infomations * @param {string} name - panel name * @returns {object} panel information */ function getPanel(panels, name) { var found; util.forEach(panels, function(panel) { if (panel.name === name) { found = panel; } }); return found; } module.exports = DayGrid; /***/ }), /***/ "./src/js/view/week/dayGridSchedule.js": /*!*********************************************!*\ !*** ./src/js/view/week/dayGridSchedule.js ***! \*********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Weekday view for week * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var Weekday = __webpack_require__(/*! ../weekday */ "./src/js/view/weekday.js"), tmpl = __webpack_require__(/*! ../template/week/dayGridSchedule.hbs */ "./src/js/view/template/week/dayGridSchedule.hbs"); var mmax = Math.max; /** * @constructor * @extends {Weekday} * @param {object} options - options for DayGridSchedule view * @param {number} [options.containerButtonGutter=8] - free space at bottom to * make create easy. * @param {number} [options.scheduleHeight=18] - height of each schedule block. * @param {number} [options.scheduleGutter=2] - gutter height of each schedule block. * @param {HTMLDIVElement} container - DOM element to use container for this * view. */ function DayGridSchedule(options, container) { Weekday.call(this, options, container); this.collapsed = true; } util.inherit(DayGridSchedule, Weekday); /** * Render Weekday view * @override */ DayGridSchedule.prototype.render = function(viewModel) { var container = this.container; var baseViewModel; baseViewModel = this.getBaseViewModel(viewModel); container.innerHTML = tmpl(baseViewModel); this.fire('afterRender', baseViewModel); }; /** * returns maximum schedule count in day * @param {array} matrices - The matrices for schedule placing. * @returns {number} maximum schedule count in day */ DayGridSchedule.prototype._getMaxScheduleInDay = function(matrices) { return mmax.apply( null, util.map(matrices, function(matrix) { return Math.max.apply(null, util.map(matrix, function(row) { return row.length; })); }) ); }; /** * returns minimum height for container. * @param {number} maxScheduleInDay - max schedule blocks in one day * @returns {number} */ DayGridSchedule.prototype._getMinHeight = function(maxScheduleInDay) { var opt = this.options; var contentHeight = (maxScheduleInDay * opt.scheduleHeight) + ((maxScheduleInDay - 1) * opt.scheduleGutter); // if (this.collapsed && this.aboutMe.maxHeight >= contentHeight + opt.containerBottomGutter) { // contentHeight += opt.containerBottomGutter; // } return contentHeight; }; /** * @override * @param {object} viewModel - schedules view models */ DayGridSchedule.prototype.getBaseViewModel = function(viewModel) { var opt = this.options; var matrices = opt.getViewModelFunc(viewModel); var maxScheduleInDay = this._getMaxScheduleInDay(matrices); var baseViewModel; var styles = this._getStyles(viewModel.theme); baseViewModel = Weekday.prototype.getBaseViewModel.call(this, viewModel); baseViewModel = util.extend({ minHeight: this._getMinHeight(maxScheduleInDay), matrices: matrices, scheduleContainerTop: this.options.scheduleContainerTop, maxScheduleInDay: maxScheduleInDay, isReadOnly: opt.isReadOnly, styles: styles }, baseViewModel); return baseViewModel; }; /** * Get the styles from theme * @param {Theme} theme - theme instance * @returns {object} styles - styles object */ DayGridSchedule.prototype._getStyles = function(theme) { var styles = {}; if (theme) { styles.borderRadius = theme.week.dayGridSchedule.borderRadius; } return styles; }; module.exports = DayGridSchedule; /***/ }), /***/ "./src/js/view/week/dayname.js": /*!*************************************!*\ !*** ./src/js/view/week/dayname.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview View for rendering daynames * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date; var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var View = __webpack_require__(/*! ../view */ "./src/js/view/view.js"); var daynameTmpl = __webpack_require__(/*! ../template/week/daynames.hbs */ "./src/js/view/template/week/daynames.hbs"); /** * @constructor * @param {object} options - options for dayname view * @param {HTMLElement} container Container element to use. * @param {Theme} theme - theme instance * @extends {View} */ function DayName(options, container, theme) { container = domutil.appendHTMLElement( 'div', container, config.classname('dayname-container') ); this.options = util.extend({ daynames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], timezones: options.timezones }, options.week); /** * @type {Theme} */ this.theme = theme; View.call(this, container); this.applyTheme(); } util.inherit(DayName, View); /** * Get default viewmodels. * @param {Date} start The date of start render * @param {Date} end The end of end render * @param {object} grids grid data(width, left, day) * @returns {array} viewmodel. */ DayName.prototype._getBaseViewModel = function(start, end, grids) { var daynames = this.options.daynames, theme = this.theme, now = new TZDate().toLocalTime(), viewModel; viewModel = util.map(datetime.range( datetime.start(start), datetime.end(end), datetime.MILLISECONDS_PER_DAY ), function(d, i) { var day = d.getDay(); var isToday = datetime.isSameDate(d, now); var isPastDay = d < now && !isToday; return { day: day, dayName: daynames[day], isToday: isToday, date: d.getDate(), left: grids[i] ? grids[i].left : 0, width: grids[i] ? grids[i].width : 0, renderDate: datetime.format(d, 'YYYY-MM-DD'), color: this._getDayNameColor(theme, day, isToday, isPastDay) }; }, this); return viewModel; }; /** * @override * @param {object} viewModel View model from parent (WeekView) */ DayName.prototype.render = function(viewModel) { var dayNames = this._getBaseViewModel( viewModel.renderStartDate, viewModel.renderEndDate, viewModel.grids ); var timezonesCollapsed = viewModel.state.timezonesCollapsed; var styles = this._getStyles(this.theme, timezonesCollapsed); var baseViewModel = util.extend({}, { dayNames: dayNames, styles: styles }); this.container.innerHTML = daynameTmpl(baseViewModel); }; /** * Get a day name color * @param {Theme} theme - theme instance * @param {number} day - day number * @param {boolean} isToday - today flag * @param {boolean} isPastDay - is past day flag * @returns {string} style - color style */ DayName.prototype._getDayNameColor = function(theme, day, isToday, isPastDay) { var color = ''; if (theme) { if (day === 0) { color = theme.common.holiday.color; } else if (isPastDay) { color = theme.week.pastDay.color || theme.common.dayname.color; } else if (day === 6) { color = theme.common.saturday.color; } else if (isToday) { color = theme.week.today.color || theme.common.today.color; } else { color = theme.common.dayname.color; } } return color; }; /** * Get the styles from theme * @param {Theme} theme - theme instance * @param {boolean} timezonesCollapsed - multiple timezones are collapsed. * @returns {object} styles - styles object */ DayName.prototype._getStyles = function(theme, timezonesCollapsed) { var styles = {}; var timezonesLength = this.options.timezones.length; var collapsed = timezonesCollapsed; var numberAndUnit; if (theme) { styles.borderTop = theme.week.dayname.borderTop || theme.common.border; styles.borderBottom = theme.week.dayname.borderBottom || theme.common.border; styles.borderLeft = theme.week.dayname.borderLeft || theme.common.border; styles.paddingLeft = theme.week.dayname.paddingLeft; styles.backgroundColor = theme.week.dayname.backgroundColor; styles.height = theme.week.dayname.height; styles.textAlign = theme.week.dayname.textAlign; styles.marginLeft = theme.week.daygridLeft.width; if (!collapsed && timezonesLength > 1) { numberAndUnit = common.parseUnit(styles.marginLeft); styles.marginLeft = (numberAndUnit[0] * timezonesLength) + numberAndUnit[1]; } } return styles; }; DayName.prototype.applyTheme = function() { var styles = this._getStyles(this.theme); var style = this.container.style; style.borderTop = styles.borderTop; style.borderBottom = styles.borderBottom; style.height = styles.height; style.backgroundColor = styles.backgroundColor; style.textAlign = styles.textAlign; return style; }; module.exports = DayName; /***/ }), /***/ "./src/js/view/week/time.js": /*!**********************************!*\ !*** ./src/js/view/week/time.js ***! \**********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview View of time. * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var View = __webpack_require__(/*! ../view */ "./src/js/view/view.js"); var timeTmpl = __webpack_require__(/*! ../template/week/time.hbs */ "./src/js/view/template/week/time.hbs"); var tz = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js"); var forEachArr = util.forEachArray; var SCHEDULE_MIN_DURATION = datetime.MILLISECONDS_SCHEDULE_MIN_DURATION; /** * calculate offset start of schedule * @param {ScheduleViewModel} viewModel - view model instance to calculate bound. * @param {object} options - options for calculating schedule element's bound. * @returns {object} - left and width */ function getOffsetStart(viewModel, options) { var goingDuration = datetime.millisecondsFrom('minutes', viewModel.valueOf().goingDuration); var startDayOffset = options.todayStart.toDate().getTimezoneOffset(); var nativeOffsetMs = tz.getNativeOffsetMs(); var startOffset = viewModel.valueOf().start.toDate().getTimezoneOffset(); var primaryOffset = tz.getPrimaryOffset(); var timezoneOffset = tz.getOffsetByTimezoneName( tz.getPrimaryTimezoneName(), viewModel.valueOf().start.getTime() ); var MIN_TO_MS = 60 * 1000; var offsetDiffMs = 0; var offsetStart = viewModel.valueOf().start - goingDuration - options.todayStart; if (tz.hasPrimaryTimezoneCustomSetting()) { if (tz.isNativeOsUsingDSTTimezone() && nativeOffsetMs !== startDayOffset) { // When using a custom time zone, the native time zone offset is fixed and rendered. // So, The fixed and rendered time should be recalculated as the original time zone offset. // The current system OS local time is not affected by summer/standard time and the schedule should always be displayed in the same location. offsetDiffMs = (startOffset * MIN_TO_MS) - nativeOffsetMs; offsetStart += offsetDiffMs; } if (tz.isPrimaryUsingDSTTimezone() && primaryOffset !== timezoneOffset) { // The custom time zone is a time zone where two offsets including DST are applied. // The first rendered schedule is calculated and drawn with the offset calculated at the access time(system OS local time). // It should be recalculated with the original time zone offset. offsetDiffMs = (primaryOffset - timezoneOffset) * MIN_TO_MS; offsetStart += offsetDiffMs; } } return offsetStart; } /** * @constructor * @extends {View} * @param {object} options Options * @param {number} options.index Date index in week view. * @param {number} options.width Date element width (percent) * @param {string} options.ymd YYYMMDD string for this view * @param {boolean} options.isToday when set true then assign today design class to container. * @param {number} options.hourStart Can limit of render hour start. * @param {number} options.hourEnd Can limit of render hour end. * @param {HTMLElement} container Element to use container for this view. * @param {Theme} theme - theme instance */ function Time(options, container, theme) { View.call(this, container); this.options = util.extend( { index: 0, width: 0, ymd: '', isToday: false, pending: false, hourStart: 0, hourEnd: 24, defaultMarginBottom: 2, minHeight: 18.5, isReadOnly: false }, options ); this.timeTmpl = timeTmpl; /** * @type {Theme} */ this.theme = theme; container.style.width = options.width + '%'; container.style.left = options.left + '%'; if (this.options.isToday) { domutil.addClass(this.container, config.classname('today')); } this.applyTheme(); } util.inherit(Time, View); /** * Convert YYYYMMDD formatted string date to Date. * @param {string} str formatted string. * @returns {Date} start of date. */ Time.prototype._parseDateGroup = function(str) { var y = parseInt(str.substr(0, 4), 10), m = parseInt(str.substr(4, 2), 10), d = parseInt(str.substr(6, 2), 10); var date = datetime.start(); date.setFullYear(y, m - 1, d); return datetime.start(date); }; /** * calculate left and width * @param {ScheduleViewModel} viewModel - view model instance to calculate bound. * @param {object} options - options for calculating schedule element's bound. * @returns {object} - left and width */ Time.prototype._getScheduleViewBoundX = function(viewModel, options) { var width = options.baseWidth * (viewModel.extraSpace + 1); // set width auto when has no collisions. if (!viewModel.hasCollide) { width = null; } return { left: options.baseLeft[options.columnIndex], width: width }; }; /** * calculate top, height, croppedStart and croppedEnd * @param {ScheduleViewModel} viewModel - view model instance to calculate bound. * @param {object} options - options for calculating schedule element's bound. * @returns {object} - left and width */ Time.prototype._getScheduleViewBoundY = function(viewModel, options) { var baseMS = options.baseMS; var baseHeight = options.baseHeight; var croppedStart = false; var croppedEnd = false; var goingDuration = datetime.millisecondsFrom('minutes', viewModel.valueOf().goingDuration); var comingDuration = datetime.millisecondsFrom('minutes', viewModel.valueOf().comingDuration); var modelDuration = viewModel.duration(); var top, height, duration; var goingDurationHeight, modelDurationHeight, comingDurationHeight; var offsetStart = getOffsetStart(viewModel, options); // containerHeight : milliseconds in day = x : schedule's milliseconds top = (baseHeight * offsetStart) / baseMS; modelDuration = modelDuration > SCHEDULE_MIN_DURATION ? modelDuration : SCHEDULE_MIN_DURATION; duration = modelDuration + goingDuration + comingDuration; height = (baseHeight * duration) / baseMS; goingDurationHeight = (baseHeight * goingDuration) / baseMS; // common.ratio(duration, goingDuration, 100); modelDurationHeight = (baseHeight * modelDuration) / baseMS; // common.ratio(duration, modelDuration, 100); comingDurationHeight = (baseHeight * comingDuration) / baseMS; // common.ratio(duration, comingDuration, 100); if (offsetStart < 0) { top = 0; height += (baseHeight * offsetStart) / baseMS; croppedStart = true; } if (height + top > baseHeight) { height = baseHeight - top; croppedEnd = true; } return { top: top, height: Math.max(height, this.options.minHeight) - this.options.defaultMarginBottom, modelDurationHeight: modelDurationHeight, goingDurationHeight: goingDurationHeight, comingDurationHeight: comingDurationHeight, hasGoingDuration: goingDuration > 0, hasComingDuration: comingDuration > 0, croppedStart: croppedStart, croppedEnd: croppedEnd }; }; /** * @param {ScheduleViewModel} viewModel - view model instance to calculate bound. * @param {object} options - options for calculating schedule element's bound. * @param {Date} options.todayStart - date object represent schedule date's start (00:00:00) * @param {number} options.baseMS - the number of milliseconds to render schedule blocks. * @param {number} options.baseHeight - pixel value related with baseMS options. * @param {number[]} options.baseLeft - left position percents for each columns. * @param {number} options.baseWidth - the unit of schedule blocks width percent. * @param {number} options.columnIndex - the number index of schedule blocks. * it represent rendering index from left sides in view. * @returns {object} bound object for supplied view model. */ Time.prototype.getScheduleViewBound = function(viewModel, options) { var boundX = this._getScheduleViewBoundX(viewModel, options); var boundY = this._getScheduleViewBoundY(viewModel, options); var schedule = viewModel.model; var isReadOnly = util.pick(schedule, 'isReadOnly') || false; var travelBorderColor = schedule.isFocused ? '#ffffff' : schedule.borderColor; if (travelBorderColor === schedule.bgColor) { travelBorderColor = null; // follow text color } return util.extend( { isReadOnly: isReadOnly, travelBorderColor: travelBorderColor }, boundX, boundY ); }; /** * Set viewmodels for rendering. * @param {string} ymd The date of schedules. YYYYMMDD format. * @param {array} matrices The matrices for schedule placing. * @param {number} containerHeight - container's height */ Time.prototype._getBaseViewModel = function(ymd, matrices, containerHeight) { var self = this, options = this.options, hourStart = options.hourStart, hourEnd = options.hourEnd, isReadOnly = options.isReadOnly, todayStart, baseMS; /** * Calculate each schedule element bounds relative with rendered hour milliseconds and * wrap each schedule model to viewmodels. */ containerHeight = containerHeight || this.getViewBound().height; todayStart = this._parseDateGroup(ymd); todayStart.setHours(hourStart); baseMS = datetime.millisecondsFrom('hour', hourEnd - hourStart); forEachArr(matrices, function(matrix) { var maxRowLength, widthPercent, leftPercents, i; maxRowLength = Math.max.apply( null, util.map(matrix, function(row) { return row.length; }) ); widthPercent = 100 / maxRowLength; leftPercents = []; for (i = 0; i < maxRowLength; i += 1) { leftPercents[i] = widthPercent * i; } forEachArr(matrix, function(row) { forEachArr(row, function(viewModel, col) { var viewBound; if (!viewModel) { return; } viewBound = self.getScheduleViewBound(viewModel, { todayStart: todayStart, baseMS: baseMS, baseLeft: leftPercents, baseWidth: widthPercent, baseHeight: containerHeight, columnIndex: col, isReadOnly: isReadOnly }); util.extend(viewModel, viewBound); }); }); }); }; /** * @returns {Date} - Date of this view. */ Time.prototype.getDate = function() { return this._parseDateGroup(this.options.ymd); }; /** * @override * @param {string} ymd The date of schedules. YYYYMMDD format * @param {array} matrices Matrices for placing schedules * @param {number} containerHeight - container's height */ Time.prototype.render = function(ymd, matrices, containerHeight) { this._getBaseViewModel(ymd, matrices, containerHeight); this.container.innerHTML = this.timeTmpl({ matrices: matrices, styles: this._getStyles(this.theme), isReadOnly: this.options.isReadOnly }); }; /** * Get the styles from theme * @param {Theme} theme - theme instance * @returns {object} styles - styles object */ Time.prototype._getStyles = function(theme) { var styles = {}; var options = this.options; if (theme) { styles.borderRight = theme.week.timegrid.borderRight || theme.common.border; styles.marginRight = theme.week.timegrid.paddingRight; styles.borderRadius = theme.week.timegridSchedule.borderRadius; styles.paddingLeft = theme.week.timegridSchedule.paddingLeft; styles.backgroundColor = options.isToday ? theme.week.today.backgroundColor : 'inherit'; } return styles; }; Time.prototype.applyTheme = function() { var style = this.container.style; var styles = this._getStyles(this.theme); style.borderRight = styles.borderRight; style.backgroundColor = styles.backgroundColor; }; module.exports = Time; /***/ }), /***/ "./src/js/view/week/timeGrid.js": /*!**************************************!*\ !*** ./src/js/view/week/timeGrid.js ***! \**************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview View for rendered schedules by times. * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var common = __webpack_require__(/*! ../../common/common */ "./src/js/common/common.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var domevent = __webpack_require__(/*! ../../common/domevent */ "./src/js/common/domevent.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var tz = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js"); var reqAnimFrame = __webpack_require__(/*! ../../common/reqAnimFrame */ "./src/js/common/reqAnimFrame.js"); var View = __webpack_require__(/*! ../view */ "./src/js/view/view.js"); var Time = __webpack_require__(/*! ./time */ "./src/js/view/week/time.js"); var AutoScroll = __webpack_require__(/*! ../../common/autoScroll */ "./src/js/common/autoScroll.js"); var mainTmpl = __webpack_require__(/*! ../template/week/timeGrid.hbs */ "./src/js/view/template/week/timeGrid.hbs"); var timezoneStickyTmpl = __webpack_require__(/*! ../template/week/timezoneSticky.hbs */ "./src/js/view/template/week/timezoneSticky.hbs"); var timegridCurrentTimeTmpl = __webpack_require__(/*! ../template/week/timeGridCurrentTime.hbs */ "./src/js/view/template/week/timeGridCurrentTime.hbs"); var TZDate = tz.Date; var HOURMARKER_REFRESH_INTERVAL = 1000 * 60; var SIXTY_SECONDS = 60; var SIXTY_MINUTES = 60; /** * Returns a list of time labels from start to end. * For hidden labels near the current time, set to hidden: true. * @param {object} opt - TimeGrid.options * @param {boolean} hasHourMarker - Whether the current time is displayed * @param {number} timezoneOffset - timezone offset * @param {object} styles - styles * @returns {Array.} */ function getHoursLabels(opt, hasHourMarker, timezoneOffset, styles) { var hourStart = opt.hourStart; var hourEnd = opt.hourEnd; var renderEndDate = new TZDate(opt.renderEndDate); var shiftByOffset = parseInt(timezoneOffset / SIXTY_MINUTES, 10); var shiftMinutes = Math.abs(timezoneOffset % SIXTY_MINUTES); var now = new TZDate().toLocalTime(); var nowMinutes = now.getMinutes(); var hoursRange = util.range(0, 24); var nowAroundHours = null; var nowHours, nowHoursIndex; var isNegativeZero = 1 / -Infinity === shiftByOffset; if ((shiftByOffset < 0 || isNegativeZero) && shiftMinutes > 0) { shiftByOffset -= 1; } // shift the array and take elements between start and end common.shiftArray(hoursRange, shiftByOffset); common.takeArray(hoursRange, hourStart, hourEnd); nowHours = common.shiftHours(now.getHours(), shiftByOffset) % 24; nowHoursIndex = util.inArray(nowHours, hoursRange); if (hasHourMarker) { if (nowMinutes < 20) { nowAroundHours = nowHours; } else if (nowMinutes > 40) { nowAroundHours = nowHours + 1; } if (util.isNumber(nowAroundHours)) { nowAroundHours %= 24; } } return util.map(hoursRange, function(hour, index) { var color; var fontWeight; var isPast = (hasHourMarker && index <= nowHoursIndex) || (renderEndDate < now && !datetime.isSameDate(renderEndDate, now)); if (isPast) { // past color = styles.pastTimeColor; fontWeight = styles.pastTimeFontWeight; } else { // future color = styles.futureTimeColor; fontWeight = styles.futureTimeFontWeight; } return { hour: hour, minutes: shiftMinutes, hidden: nowAroundHours === hour || index === 0, color: color || '', fontWeight: fontWeight || '' }; }); } /** * Returns timezone offset from timezone object * @param {object} timezoneObj - timezone object in options.timzones * @param {number} timestamp - timestamp * @returns {number} timezoneOffset - timezone offset */ function getOffsetByTimezoneOption(timezoneObj, timestamp) { var primaryOffset = tz.getPrimaryOffset(); if (util.isString(timezoneObj.timezoneName)) { return -tz.getOffsetByTimezoneName(timezoneObj.timezoneName, timestamp); } // @deprecated timezoneOffset property will be deprecated if (util.isNumber(timezoneObj.timezoneOffset) && timezoneObj.timezoneOffset !== primaryOffset) { return timezoneObj.timezoneOffset; } return -primaryOffset; } /** * @constructor * @extends {View} * @param {string} name - view name * @param {object} options The object for view customization. * @param {string} options.renderStartDate - render start date. YYYY-MM-DD * @param {string} options.renderEndDate - render end date. YYYY-MM-DD * @param {number} [options.hourStart=0] You can change view's start hours. * @param {number} [options.hourEnd=0] You can change view's end hours. * @param {HTMLElement} panelElement panel element. */ function TimeGrid(name, options, panelElement) { var container = domutil.appendHTMLElement( 'div', panelElement, config.classname('timegrid-container') ); var stickyContainer = domutil.appendHTMLElement( 'div', panelElement, config.classname('timegrid-sticky-container') ); panelElement.style.position = 'relative'; // for stickyContainer name = name || 'time'; View.call(this, container); if (!util.browser.safari) { /** * @type {AutoScroll} */ this._autoScroll = new AutoScroll(container); } this.stickyContainer = stickyContainer; /** * Time view options. * @type {object} */ this.options = util.extend( { viewName: name, renderStartDate: '', renderEndDate: '', hourStart: 0, hourEnd: 24, timezones: options.timezones, isReadOnly: options.isReadOnly, showTimezoneCollapseButton: false }, options.week ); if (this.options.timezones.length < 1) { this.options.timezones = [ { timezoneOffset: tz.getPrimaryOffset() } ]; } /** * Interval id for hourmarker animation. * @type {number} */ this.intervalID = 0; /** * timer id for hourmarker initial state * @type {number} */ this.timerID = 0; /** * requestAnimationFrame unique ID * @type {number} */ this.rAnimationFrameID = 0; /** * @type {boolean} */ this._scrolled = false; /** * cache parent's view model * @type {object} */ this._cacheParentViewModel = null; /** * cache hoursLabels view model to render again TimeGrid * @type {object} */ this._cacheHoursLabels = null; this.attachEvent(); } util.inherit(TimeGrid, View); /********** * Prototype props **********/ /** * @type {string} */ TimeGrid.prototype.viewName = 'timegrid'; /** * Destroy view. * @override */ TimeGrid.prototype._beforeDestroy = function() { clearInterval(this.intervalID); clearTimeout(this.timerID); reqAnimFrame.cancelAnimFrame(this.rAnimationFrameID); if (this._autoScroll) { this._autoScroll.destroy(); } domevent.off(this.stickyContainer, 'click', this._onClickStickyContainer, this); this._autoScroll = this.hourmarkers = this.intervalID = this.timerID = this.rAnimationFrameID = this._cacheParentViewModel = this.stickyContainer = null; }; /** * @param {Date} [time] - date object to convert pixel in grids. * use **Date.now()** when not supplied. * @returns {number} The pixel value represent current time in grids. */ TimeGrid.prototype._getTopPercentByTime = function(time) { var opt = this.options, raw = datetime.raw(time || new TZDate()), hourLength = util.range(opt.hourStart, opt.hourEnd).length, maxMilliseconds = hourLength * datetime.MILLISECONDS_PER_HOUR, hmsMilliseconds = datetime.millisecondsFrom('hour', raw.h) + datetime.millisecondsFrom('minutes', raw.m) + datetime.millisecondsFrom('seconds', raw.s) + raw.ms, topPercent; topPercent = common.ratio(maxMilliseconds, 100, hmsMilliseconds); topPercent -= common.ratio( maxMilliseconds, 100, datetime.millisecondsFrom('hour', opt.hourStart) ); return common.limit(topPercent, [0], [100]); }; /** * Get Hourmarker viewmodel. * @param {TZDate} now - now * @param {object} grids grid information(width, left, day) * @param {Array.} range render range * @returns {object} ViewModel of hourmarker. */ TimeGrid.prototype._getHourmarkerViewModel = function(now, grids, range) { var todaymarkerLeft = -1; var todaymarkerWidth = -1; var hourmarkerTimzones = []; var opt = this.options; var primaryOffset = tz.getPrimaryOffset(); var timezones = opt.timezones; var viewModel; util.forEach(range, function(date, index) { if (datetime.isSameDate(now, date)) { todaymarkerLeft = grids[index] ? grids[index].left : 0; todaymarkerWidth = grids[index] ? grids[index].width : 0; } }); util.forEach(timezones, function(timezone) { var hourmarker = new TZDate(now); var timezoneOffset = getOffsetByTimezoneOption(timezone, hourmarker.getTime()); var timezoneDifference = timezoneOffset + primaryOffset; var dateDifference; hourmarker.setMinutes(hourmarker.getMinutes() + timezoneDifference); dateDifference = datetime.getDateDifference(hourmarker, now); hourmarkerTimzones.push({ hourmarker: hourmarker, dateDifferenceSign: dateDifference < 0 ? '-' : '+', dateDifference: Math.abs(dateDifference) }); }); viewModel = { currentHours: now.getHours(), hourmarkerTop: this._getTopPercentByTime(now), hourmarkerTimzones: hourmarkerTimzones, todaymarkerLeft: todaymarkerLeft, todaymarkerWidth: todaymarkerWidth, todaymarkerRight: todaymarkerLeft + todaymarkerWidth }; return viewModel; }; /** * Get timezone view model * @param {number} currentHours - current hour * @param {boolean} timezonesCollapsed - multiple timezones are collapsed. * @param {object} styles - styles * @returns {object} ViewModel */ TimeGrid.prototype._getTimezoneViewModel = function(currentHours, timezonesCollapsed, styles) { var opt = this.options; var primaryOffset = tz.getPrimaryOffset(); var timezones = opt.timezones; var timezonesLength = timezones.length; var timezoneViewModel = []; var collapsed = timezonesCollapsed; var width = collapsed ? 100 : 100 / timezonesLength; var now = new TZDate().toLocalTime(); var backgroundColor = styles.displayTimezoneLabelBackgroundColor; // eslint-disable-next-line complexity util.forEach(timezones, function(timezone, index) { var hourmarker = new TZDate(now); var timezoneOffset = getOffsetByTimezoneOption(timezone, hourmarker.getTime()); var timezoneDifference = timezoneOffset + primaryOffset; var timeSlots = getHoursLabels(opt, currentHours >= 0, timezoneDifference, styles); var dateDifference; hourmarker.setMinutes(hourmarker.getMinutes() + timezoneDifference); dateDifference = datetime.getDateDifference(hourmarker, now); if (index > 0) { backgroundColor = styles.additionalTimezoneBackgroundColor; } timezoneViewModel.push({ timeSlots: timeSlots, displayLabel: timezone.displayLabel, timezoneOffset: timezone.timezoneOffset, tooltip: timezone.tooltip || '', width: width, left: collapsed ? 0 : (timezones.length - index - 1) * width, isPrimary: index === 0, backgroundColor: backgroundColor || '', hidden: index !== 0 && collapsed, hourmarker: hourmarker, dateDifferenceSign: dateDifference < 0 ? '-' : '+', dateDifference: Math.abs(dateDifference) }); }); return timezoneViewModel; }; /** * Get base viewModel. * @param {object} viewModel - view model * @returns {object} ViewModel */ TimeGrid.prototype._getBaseViewModel = function(viewModel) { var grids = viewModel.grids; var range = viewModel.range; var opt = this.options; var baseViewModel = this._getHourmarkerViewModel(new TZDate().toLocalTime(), grids, range); var timezonesCollapsed = util.pick(viewModel, 'state', 'timezonesCollapsed'); var styles = this._getStyles(viewModel.theme, timezonesCollapsed); return util.extend(baseViewModel, { timezones: this._getTimezoneViewModel( baseViewModel.todaymarkerLeft, timezonesCollapsed, styles ), hoursLabels: getHoursLabels(opt, baseViewModel.todaymarkerLeft >= 0, 0, styles), styles: styles, showTimezoneCollapseButton: util.pick(opt, 'showTimezoneCollapseButton'), timezonesCollapsed: timezonesCollapsed }); }; /** * Reconcilation child views and render. * @param {object} viewModels Viewmodel * @param {object} grids grid information(width, left, day) * @param {HTMLElement} container Container element for each time view. * @param {Theme} theme - theme instance */ TimeGrid.prototype._renderChildren = function(viewModels, grids, container, theme) { var self = this, options = this.options, childOption, child, isToday, containerHeight, today = datetime.format(new TZDate().toLocalTime(), 'YYYYMMDD'), i = 0; // clear contents container.innerHTML = ''; this.children.clear(); containerHeight = domutil.getSize(container.parentElement)[1]; // reconcilation of child views util.forEach(viewModels, function(schedules, ymd) { isToday = ymd === today; childOption = { index: i, left: grids[i] ? grids[i].left : 0, width: grids[i] ? grids[i].width : 0, ymd: ymd, isToday: isToday, isPending: options.isPending, isFocused: options.isFocused, isReadOnly: options.isReadOnly, hourStart: options.hourStart, hourEnd: options.hourEnd }; child = new Time( childOption, domutil.appendHTMLElement('div', container, config.classname('time-date')), theme ); child.render(ymd, schedules, containerHeight); self.addChild(child); i += 1; }); }; /** * @override * @param {object} viewModel ViewModel list from Week view. */ TimeGrid.prototype.render = function(viewModel) { var opt = this.options, timeViewModel = viewModel.schedulesInDateRange[opt.viewName], container = this.container, grids = viewModel.grids, baseViewModel = this._getBaseViewModel(viewModel), scheduleLen = util.keys(timeViewModel).length; this._cacheParentViewModel = viewModel; this._cacheHoursLabels = baseViewModel.hoursLabels; if (!scheduleLen) { return; } baseViewModel.showHourMarker = baseViewModel.todaymarkerLeft >= 0; container.innerHTML = mainTmpl(baseViewModel); /********** * Render sticky container for timezone display label **********/ this.renderStickyContainer(baseViewModel); /********** * Render children **********/ this._renderChildren( timeViewModel, grids, domutil.find(config.classname('.timegrid-schedules-container'), container), viewModel.theme ); this._hourLabels = domutil.find('ul', container); /********** * Render hourmarker **********/ this.hourmarkers = domutil.find(config.classname('.timegrid-hourmarker'), container, true); if (!this._scrolled) { this._scrolled = true; this.scrollToNow(); } }; TimeGrid.prototype.renderStickyContainer = function(baseViewModel) { var stickyContainer = this.stickyContainer; stickyContainer.innerHTML = timezoneStickyTmpl(baseViewModel); stickyContainer.style.display = baseViewModel.timezones.length > 1 ? 'block' : 'none'; stickyContainer.style.width = baseViewModel.styles.leftWidth; stickyContainer.style.height = baseViewModel.styles.displayTimezoneLabelHeight; stickyContainer.style.borderBottom = baseViewModel.styles.leftBorderRight; }; /** * Refresh hourmarker element. */ TimeGrid.prototype.refreshHourmarker = function() { var hourmarkers = this.hourmarkers; var viewModel = this._cacheParentViewModel; var hoursLabels = this._cacheHoursLabels; var rAnimationFrameID = this.rAnimationFrameID; var baseViewModel; if (!hourmarkers || !viewModel || rAnimationFrameID) { return; } baseViewModel = this._getBaseViewModel(viewModel); this.rAnimationFrameID = reqAnimFrame.requestAnimFrame(function() { var needsRender = false; util.forEach(hoursLabels, function(hoursLabel, index) { if (hoursLabel.hidden !== baseViewModel.hoursLabels[index].hidden) { needsRender = true; return false; } return true; }); if (needsRender) { this.render(viewModel); } else { util.forEach(hourmarkers, function(hourmarker) { var todaymarker = domutil.find( config.classname('.timegrid-todaymarker'), hourmarker ); var hourmarkerContainer = domutil.find( config.classname('.timegrid-hourmarker-time'), hourmarker ); var timezone = domutil.closest(hourmarker, config.classname('.timegrid-timezone')); var timezoneIndex = timezone ? domutil.getData(timezone, 'timezoneIndex') : 0; hourmarker.style.top = baseViewModel.hourmarkerTop + '%'; if (todaymarker) { todaymarker.style.display = baseViewModel.todaymarkerLeft >= 0 ? 'block' : 'none'; } if (hourmarkerContainer) { hourmarkerContainer.innerHTML = timegridCurrentTimeTmpl( baseViewModel.hourmarkerTimzones[timezoneIndex] ); } }); } this.rAnimationFrameID = null; }, this); }; /** * Attach events */ TimeGrid.prototype.attachEvent = function() { clearInterval(this.intervalID); clearTimeout(this.timerID); this.intervalID = this.timerID = this.rAnimationFrameID = null; this.timerID = setTimeout( this.onTick.bind(this), (SIXTY_SECONDS - new TZDate().getSeconds()) * 1000 ); domevent.on(this.stickyContainer, 'click', this._onClickStickyContainer, this); }; /** * Scroll time grid to current hourmarker. */ TimeGrid.prototype.scrollToNow = function() { var container = this.container; var offsetTop, viewBound, scrollTop, scrollAmount, scrollBy, scrollFn; if (!this.hourmarkers || !this.hourmarkers.length) { return; } offsetTop = this.hourmarkers[0].offsetTop; viewBound = this.getViewBound(); scrollTop = offsetTop; scrollAmount = viewBound.height / 4; scrollBy = 10; scrollFn = function() { if (scrollTop > offsetTop - scrollAmount) { scrollTop -= scrollBy; container.scrollTop = scrollTop; reqAnimFrame.requestAnimFrame(scrollFn); } else { container.scrollTop = offsetTop - scrollAmount; } }; reqAnimFrame.requestAnimFrame(scrollFn); }; /********** * Schedule handlers **********/ /** * Interval tick handler */ TimeGrid.prototype.onTick = function() { if (this.timerID) { clearTimeout(this.timerID); this.timerID = null; } if (!this.intervalID) { this.intervalID = setInterval(this.onTick.bind(this), HOURMARKER_REFRESH_INTERVAL); } this.refreshHourmarker(); }; /** * Get the styles from theme * @param {Theme} theme - theme instance * @param {boolean} timezonesCollapsed - multiple timezones are collapsed. * @returns {object} styles - styles object */ // eslint-disable-next-line complexity TimeGrid.prototype._getStyles = function(theme, timezonesCollapsed) { var styles = {}; var timezonesLength = this.options.timezones.length; var collapsed = timezonesCollapsed; var numberAndUnit; if (theme) { styles.borderBottom = theme.week.timegridHorizontalLine.borderBottom || theme.common.border; styles.halfHourBorderBottom = theme.week.timegridHalfHour.borderBottom || theme.common.border; styles.todayBackgroundColor = theme.week.today.backgroundColor; styles.weekendBackgroundColor = theme.week.weekend.backgroundColor; styles.backgroundColor = theme.week.daygrid.backgroundColor; styles.leftWidth = theme.week.timegridLeft.width; styles.leftBackgroundColor = theme.week.timegridLeft.backgroundColor; styles.leftBorderRight = theme.week.timegridLeft.borderRight || theme.common.border; styles.leftFontSize = theme.week.timegridLeft.fontSize; styles.timezoneWidth = theme.week.timegridLeft.width; styles.additionalTimezoneBackgroundColor = theme.week.timegridLeftAdditionalTimezone.backgroundColor || styles.leftBackgroundColor; styles.displayTimezoneLabelHeight = theme.week.timegridLeftTimezoneLabel.height; styles.displayTimezoneLabelBackgroundColor = theme.week.timegridLeft.backgroundColor === 'inherit' ? 'white' : theme.week.timegridLeft.backgroundColor; styles.oneHourHeight = theme.week.timegridOneHour.height; styles.halfHourHeight = theme.week.timegridHalfHour.height; styles.quaterHourHeight = (parseInt(styles.halfHourHeight, 10) / 2) + 'px'; styles.currentTimeColor = theme.week.currentTime.color; styles.currentTimeFontSize = theme.week.currentTime.fontSize; styles.currentTimeFontWeight = theme.week.currentTime.fontWeight; styles.pastTimeColor = theme.week.pastTime.color; styles.pastTimeFontWeight = theme.week.pastTime.fontWeight; styles.futureTimeColor = theme.week.futureTime.color; styles.futureTimeFontWeight = theme.week.futureTime.fontWeight; styles.currentTimeLeftBorderTop = theme.week.currentTimeLinePast.border; styles.currentTimeBulletBackgroundColor = theme.week.currentTimeLineBullet.backgroundColor; styles.currentTimeTodayBorderTop = theme.week.currentTimeLineToday.border; styles.currentTimeRightBorderTop = theme.week.currentTimeLineFuture.border; if (!collapsed && timezonesLength > 1) { numberAndUnit = common.parseUnit(styles.leftWidth); styles.leftWidth = (numberAndUnit[0] * timezonesLength) + numberAndUnit[1]; } } return styles; }; /** * @param {MouseEvent} event - mouse event object */ TimeGrid.prototype._onClickStickyContainer = function(event) { var target = domevent.getEventTarget(event); var closeBtn = domutil.closest(target, config.classname('.timegrid-timezone-close-btn')); if (!closeBtn) { return; } this.fire('clickTimezonesCollapsedBtn'); }; module.exports = TimeGrid; /***/ }), /***/ "./src/js/view/week/week.js": /*!**********************************!*\ !*** ./src/js/view/week/week.js ***! \**********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview View of days UI. * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../../config */ "./src/js/config.js"); var domutil = __webpack_require__(/*! ../../common/domutil */ "./src/js/common/domutil.js"); var datetime = __webpack_require__(/*! ../../common/datetime */ "./src/js/common/datetime.js"); var TZDate = __webpack_require__(/*! ../../common/timezone */ "./src/js/common/timezone.js").Date; var View = __webpack_require__(/*! ../view */ "./src/js/view/view.js"); /** * @constructor * @param {Base.Week} controller The controller mixin part. * @param {object} options View options * @param {string} [options.renderStartDate] Start date of render. * if not supplied then use -3d from today. YYYY-MM-DD format. * @param {string} [options.renderEndDate] End date of render. * if not supplied then use +3d from today. YYYY-MM-DD format. * @param {string} [options.cssPrefix] - CSS classname prefix * @param {HTMLElement} container The element to use container for this view. * @param {object} panels - schedule panels like 'milestone', 'task', 'allday', 'time' * @param {string} viewName - 'week', 'day' * @extends {View} */ function Week(controller, options, container, panels, viewName) { var range; container = domutil.appendHTMLElement('div', container); View.call(this, container); domutil.addClass(container, config.classname('week-container')); range = this._getRenderDateRange(new TZDate()); /** * @type {object} Options for view. */ this.options = util.extend({ scheduleFilter: [function(schedule) { return Boolean(schedule.isVisible); }], renderStartDate: datetime.format(range.start, 'YYYY-MM-DD'), renderEndDate: datetime.format(range.end, 'YYYY-MM-DD'), narrowWeekend: false, startDayOfWeek: 0, workweek: false, showTimezoneCollapseButton: false, timezonesCollapsed: false, hourStart: 0, hourEnd: 24 }, options); /** * Week controller mixin. * @type {Base.Week} */ this.controller = controller; /** * Schedule Panels * @type {Array.} */ this.panels = panels; /** * Week view states * @type {object} */ this.state = { timezonesCollapsed: this.options.timezonesCollapsed }; if (viewName === 'day') { _disableDayOptions(this.options); } } util.inherit(Week, View); /********** * Override props **********/ /** * Render each child view with schedules in ranges. * @fires Week#afterRender * @override */ Week.prototype.render = function() { var self = this, options = this.options, scheduleFilter = options.scheduleFilter, narrowWeekend = options.narrowWeekend, startDayOfWeek = options.startDayOfWeek, workweek = options.workweek, theme = this.controller.theme || {}, state = this.state; var renderStartDate, renderEndDate, schedulesInDateRange, viewModel, grids, range; renderStartDate = new TZDate(options.renderStartDate); renderEndDate = new TZDate(options.renderEndDate); range = datetime.range( datetime.start(renderStartDate), datetime.end(renderEndDate), datetime.MILLISECONDS_PER_DAY ); if (options.workweek && datetime.compare(renderStartDate, renderEndDate)) { range = util.filter(range, function(date) { return !datetime.isWeekend(date.getDay()); }); renderStartDate = range[0]; renderEndDate = range[range.length - 1]; } schedulesInDateRange = this.controller.findByDateRange( datetime.start(renderStartDate), datetime.end(renderEndDate), this.panels, scheduleFilter, this.options ); grids = datetime.getGridLeftAndWidth( range.length, narrowWeekend, startDayOfWeek, workweek ); viewModel = { schedulesInDateRange: schedulesInDateRange, renderStartDate: renderStartDate, renderEndDate: renderEndDate, grids: grids, range: range, theme: theme, state: state }; this.children.each(function(childView) { var matrices; var viewName = util.pick(childView.options, 'viewName'); childView.render(viewModel); if (viewName) { matrices = viewModel.schedulesInDateRange[viewName]; // DayGrid limits schedule count by visibleScheduleCount after rendering it. if (util.isArray(matrices)) { self._invokeAfterRenderSchedule(matrices); } else { util.forEach(matrices, function(matricesOfDay) { self._invokeAfterRenderSchedule(matricesOfDay); }); } } }); /** * @event Week#afterRender */ this.fire('afterRender'); }; /** * Fire 'afterRenderSchedule' event * @param {Array} matrices - schedule matrices from view model * @fires Week#afterRenderSchedule */ Week.prototype._invokeAfterRenderSchedule = function(matrices) { var self = this; util.forEachArray(matrices, function(matrix) { util.forEachArray(matrix, function(column) { util.forEachArray(column, function(scheduleViewModel) { if (scheduleViewModel) { /** * @event Week#afterRenderSchedule */ self.fire('afterRenderSchedule', {schedule: scheduleViewModel.model}); } }); }); }); }; /********** * Prototype props **********/ Week.prototype.viewName = 'week'; /** * Calculate default render date range from supplied date. * @param {Date} baseDate base date. * @returns {object} date range. */ Week.prototype._getRenderDateRange = function(baseDate) { var base = datetime.start(baseDate), start = new TZDate(Number(base)), end = new TZDate(Number(base)); start.setDate(start.getDate() - 3); end.setDate(end.getDate() + 3); return { start: start, end: end }; }; /** * disable options for day view * @param {WeekOptions} options - week options to disable */ function _disableDayOptions(options) { options.workweek = false; } util.CustomEvents.mixin(Week); module.exports = Week; /***/ }), /***/ "./src/js/view/weekday.js": /*!********************************!*\ !*** ./src/js/view/weekday.js ***! \********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @fileoverview Weekday view * @author NHN FE Development Lab */ var util = __webpack_require__(/*! tui-code-snippet */ "tui-code-snippet"); var config = __webpack_require__(/*! ../config */ "./src/js/config.js"), domutil = __webpack_require__(/*! ../common/domutil */ "./src/js/common/domutil.js"), datetime = __webpack_require__(/*! ../common/datetime */ "./src/js/common/datetime.js"), TZDate = __webpack_require__(/*! ../common/timezone */ "./src/js/common/timezone.js").Date, View = __webpack_require__(/*! ./view */ "./src/js/view/view.js"); /** * @constructor * @extends {View} * @param {object} options - view options. * @param {number} [options.containerButtonGutter=8] - free space at bottom to * make create easy. * @param {number} [options.scheduleHeight=18] - height of each schedule block. * @param {number} [options.scheduleGutter=2] - gutter height of each schedule block. * @param {HTMLDIVElement} container - DOM element to use container for this * view. */ function Weekday(options, container) { container = domutil.appendHTMLElement( 'div', container, config.classname('weekday') ); /** * @type {object} */ this.options = util.extend({ containerBottomGutter: 8, scheduleHeight: 18, scheduleGutter: 2, narrowWeekend: false, startDayOfWeek: 0, workweek: false }, options); /* * cache parent's view model * @type {object} */ this._cacheParentViewModel = null; View.call(this, container); } util.inherit(Weekday, View); /** * Get render date range * @returns {Date[]} rendered date range */ Weekday.prototype.getRenderDateRange = function() { return this._cacheParentViewModel.range; }; /** * Get render date grids information * @returns {Date[]} rendered date grids information */ Weekday.prototype.getRenderDateGrids = function() { return this._cacheParentViewModel.grids; }; /** * Get default view model. * @param {object} viewModel parent's view model * @returns {object} viewModel to rendering. */ Weekday.prototype.getBaseViewModel = function(viewModel) { var opt = this.options; var range = viewModel.range; var gridWidth = (100 / range.length); var grids = viewModel.grids; var exceedDate = viewModel.exceedDate || {}; var theme = viewModel.theme; var now = new TZDate().toLocalTime(); this._cacheParentViewModel = viewModel; return { width: gridWidth, scheduleHeight: opt.scheduleHeight, scheduleBlockHeight: (opt.scheduleHeight + opt.scheduleGutter), scheduleBlockGutter: opt.scheduleGutter, dates: util.map(range, function(date, index) { var day = date.getDay(); var ymd = datetime.format(new TZDate(date), 'YYYYMMDD'); var isToday = datetime.isSameDate(now, date); return { date: datetime.format(date, 'YYYY-MM-DD'), month: date.getMonth() + 1, day: day, isToday: isToday, ymd: ymd, hiddenSchedules: exceedDate[ymd] || 0, width: grids[index] ? grids[index].width : 0, left: grids[index] ? grids[index].left : 0, color: this._getDayNameColor(theme, day, isToday), backgroundColor: this._getDayBackgroundColor(theme, day) }; }, this) }; }; /* eslint max-nested-callbacks: 0 */ /** * Make exceed date information * @param {number} maxCount - exceed schedule count * @param {Array} eventsInDateRange - matrix of ScheduleViewModel * @param {Array.} range - date range of one week * @returns {object} exceedDate */ Weekday.prototype.getExceedDate = function(maxCount, eventsInDateRange, range) { var exceedDate = this._initExceedDate(range); util.forEach(eventsInDateRange, function(matrix) { util.forEach(matrix, function(column) { util.forEach(column, function(viewModel) { var period; if (!viewModel || viewModel.top < maxCount) { return; } // check that this schedule block is not visible after rendered. viewModel.hidden = true; period = datetime.range( viewModel.getStarts(), viewModel.getEnds(), datetime.MILLISECONDS_PER_DAY ); util.forEach(period, function(date) { var ymd = datetime.format(date, 'YYYYMMDD'); exceedDate[ymd] += 1; }); }); }); }); return exceedDate; }; /** * Initiate exceed date information * @param {Array.} range - date range of one week * @returns {Object} - initiated exceed date */ Weekday.prototype._initExceedDate = function(range) { var exceedDate = {}; util.forEach(range, function(date) { var ymd = datetime.format(date, 'YYYYMMDD'); exceedDate[ymd] = 0; }); return exceedDate; }; /** * Get a day name color * @param {Theme} theme - theme instance * @param {number} day - day number * @param {boolean} isToday - today flag * @param {boolean} isOtherMonth - not this month flag * @returns {string} style - color style */ Weekday.prototype._getDayNameColor = function(theme, day, isToday, isOtherMonth) { var color = ''; if (theme) { if (day === 0) { color = isOtherMonth ? theme.month.holidayExceptThisMonth.color : theme.common.holiday.color; } else if (day === 6) { color = isOtherMonth ? theme.month.dayExceptThisMonth.color : theme.common.saturday.color; } else if (isToday) { color = theme.common.today.color; } else { color = isOtherMonth ? theme.month.dayExceptThisMonth.color : theme.common.dayname.color; } } return color; }; /** * Get a day background color * @param {Theme} theme - theme instance * @param {number} day - day number * @returns {string} style - color style */ Weekday.prototype._getDayBackgroundColor = function(theme, day) { var color = ''; if (theme) { if (day === 0 || day === 6) { color = theme.month.weekend.backgroundColor; } else { color = 'inherit'; } } return color; }; module.exports = Weekday; /***/ }), /***/ "tui-code-snippet": /*!******************************************************************************************************************************!*\ !*** external {"commonjs":"tui-code-snippet","commonjs2":"tui-code-snippet","amd":"tui-code-snippet","root":["tui","util"]} ***! \******************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_tui_code_snippet__; /***/ }), /***/ "tui-date-picker": /*!*********************************************************************************************************************************!*\ !*** external {"commonjs":"tui-date-picker","commonjs2":"tui-date-picker","amd":"tui-date-picker","root":["tui","DatePicker"]} ***! \*********************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_tui_date_picker__; /***/ }) /******/ }); }); //# sourceMappingURL=tui-calendar.js.map