1/* 2@license 3 4dhtmlxGantt v.6.3.5 Standard 5 6This version of dhtmlxGantt is distributed under GPL 2.0 license and can be legally used in GPL projects. 7 8To use dhtmlxGantt in non-GPL projects (and get Pro version of the product), please obtain Commercial/Enterprise or Ultimate license on our site https://dhtmlx.com/docs/products/dhtmlxGantt/#licensing or contact us at sales@dhtmlx.com 9 10(c) XB Software Ltd. 11 12*/ 13(function webpackUniversalModuleDefinition(root, factory) { 14 if(typeof exports === 'object' && typeof module === 'object') 15 module.exports = factory(); 16 else if(typeof define === 'function' && define.amd) 17 define("ext/dhtmlxgantt_fullscreen", [], factory); 18 else if(typeof exports === 'object') 19 exports["ext/dhtmlxgantt_fullscreen"] = factory(); 20 else 21 root["ext/dhtmlxgantt_fullscreen"] = factory(); 22})(window, function() { 23return /******/ (function(modules) { // webpackBootstrap 24/******/ // The module cache 25/******/ var installedModules = {}; 26/******/ 27/******/ // The require function 28/******/ function __webpack_require__(moduleId) { 29/******/ 30/******/ // Check if module is in cache 31/******/ if(installedModules[moduleId]) { 32/******/ return installedModules[moduleId].exports; 33/******/ } 34/******/ // Create a new module (and put it into the cache) 35/******/ var module = installedModules[moduleId] = { 36/******/ i: moduleId, 37/******/ l: false, 38/******/ exports: {} 39/******/ }; 40/******/ 41/******/ // Execute the module function 42/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 43/******/ 44/******/ // Flag the module as loaded 45/******/ module.l = true; 46/******/ 47/******/ // Return the exports of the module 48/******/ return module.exports; 49/******/ } 50/******/ 51/******/ 52/******/ // expose the modules object (__webpack_modules__) 53/******/ __webpack_require__.m = modules; 54/******/ 55/******/ // expose the module cache 56/******/ __webpack_require__.c = installedModules; 57/******/ 58/******/ // define getter function for harmony exports 59/******/ __webpack_require__.d = function(exports, name, getter) { 60/******/ if(!__webpack_require__.o(exports, name)) { 61/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 62/******/ } 63/******/ }; 64/******/ 65/******/ // define __esModule on exports 66/******/ __webpack_require__.r = function(exports) { 67/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 68/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 69/******/ } 70/******/ Object.defineProperty(exports, '__esModule', { value: true }); 71/******/ }; 72/******/ 73/******/ // create a fake namespace object 74/******/ // mode & 1: value is a module id, require it 75/******/ // mode & 2: merge all properties of value into the ns 76/******/ // mode & 4: return value when already ns object 77/******/ // mode & 8|1: behave like require 78/******/ __webpack_require__.t = function(value, mode) { 79/******/ if(mode & 1) value = __webpack_require__(value); 80/******/ if(mode & 8) return value; 81/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 82/******/ var ns = Object.create(null); 83/******/ __webpack_require__.r(ns); 84/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 85/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 86/******/ return ns; 87/******/ }; 88/******/ 89/******/ // getDefaultExport function for compatibility with non-harmony modules 90/******/ __webpack_require__.n = function(module) { 91/******/ var getter = module && module.__esModule ? 92/******/ function getDefault() { return module['default']; } : 93/******/ function getModuleExports() { return module; }; 94/******/ __webpack_require__.d(getter, 'a', getter); 95/******/ return getter; 96/******/ }; 97/******/ 98/******/ // Object.prototype.hasOwnProperty.call 99/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 100/******/ 101/******/ // __webpack_public_path__ 102/******/ __webpack_require__.p = "/codebase/sources/"; 103/******/ 104/******/ 105/******/ // Load entry module and return exports 106/******/ return __webpack_require__(__webpack_require__.s = "./sources/ext/fullscreen/index.ts"); 107/******/ }) 108/************************************************************************/ 109/******/ ({ 110 111/***/ "./sources/ext/fullscreen/index.ts": 112/*!*****************************************!*\ 113 !*** ./sources/ext/fullscreen/index.ts ***! 114 \*****************************************/ 115/*! no static exports found */ 116/***/ (function(module, exports) { 117 118function isExpanded() { 119 var element = (document.fullscreenElement || 120 document.mozFullScreenElement || 121 document.webkitFullscreenElement || 122 document.msFullscreenElement); 123 return !!(element && element === document.body); 124} 125function isFullscreenAvailable() { 126 return document.fullscreenEnabled || 127 document.webkitFullscreenEnabled || 128 document.mozFullScreenEnabled || 129 document.msFullscreenEnabled; 130} 131var state = gantt.$services.getService("state"); 132state.registerProvider("fullscreen", function () { 133 return { fullscreen: isExpanded() }; 134}); 135var backupBodyPadding = { 136 overflow: null, 137 padding: null, 138 paddingTop: null, 139 paddingRight: null, 140 paddingBottom: null, 141 paddingLeft: null 142}; 143var backupElementSizes = { 144 width: null, 145 height: null, 146 top: null, 147 left: null, 148 position: null, 149 zIndex: null, 150 modified: false 151}; 152var backupPositioning = null; 153function resetParentPositioning(root) { 154 var parent = root.parentNode; 155 var positions = []; 156 while (parent && parent.style) { 157 positions.push({ 158 element: parent, 159 originalPositioning: parent.style.position 160 }); 161 parent.style.position = "static"; 162 parent = parent.parentNode; 163 } 164 return positions; 165} 166function restoreParentPositioning(positions) { 167 positions.forEach(function (record) { 168 record.element.style.position = record.originalPositioning; 169 }); 170} 171// expand gantt root element to fullscreen automatically 172function setFullScreenSizes() { 173 var root = gantt.ext.fullscreen.getFullscreenElement(); 174 var body = document.body; 175 updateSizes(root.style, backupElementSizes); 176 backupBodyPadding = { 177 overflow: body.style.overflow, 178 padding: body.style.padding ? body.style.padding : null, 179 paddingTop: body.style.paddingTop ? body.style.paddingTop : null, 180 paddingRight: body.style.paddingRight ? body.style.paddingRight : null, 181 paddingBottom: body.style.paddingBottom ? body.style.paddingBottom : null, 182 paddingLeft: body.style.paddingLeft ? body.style.paddingLeft : null 183 }; 184 if (body.style.padding) { 185 body.style.padding = "0"; 186 } 187 if (body.style.paddingTop) { 188 body.style.paddingTop = "0"; 189 } 190 if (body.style.paddingRight) { 191 body.style.paddingRight = "0"; 192 } 193 if (body.style.paddingBottom) { 194 body.style.paddingBottom = "0"; 195 } 196 if (body.style.paddingLeft) { 197 body.style.paddingLeft = "0"; 198 } 199 body.style.overflow = "hidden"; 200 root.style.width = "100vw"; 201 root.style.height = "100vh"; 202 root.style.top = "0px"; 203 root.style.left = "0px"; 204 root.style.position = "absolute"; 205 root.style.zIndex = 1; 206 backupElementSizes.modified = true; 207 backupPositioning = resetParentPositioning(root); 208} 209function restoreSizes() { 210 var root = gantt.ext.fullscreen.getFullscreenElement(); 211 var body = document.body; 212 if (backupElementSizes.modified) { 213 if (backupBodyPadding.padding) { 214 body.style.padding = backupBodyPadding.padding; 215 } 216 if (backupBodyPadding.paddingTop) { 217 body.style.paddingTop = backupBodyPadding.paddingTop; 218 } 219 if (backupBodyPadding.paddingRight) { 220 body.style.paddingRight = backupBodyPadding.paddingRight; 221 } 222 if (backupBodyPadding.paddingBottom) { 223 body.style.paddingBottom = backupBodyPadding.paddingBottom; 224 } 225 if (backupBodyPadding.paddingLeft) { 226 body.style.paddingLeft = backupBodyPadding.paddingLeft; 227 } 228 body.style.overflow = backupBodyPadding.overflow; 229 backupBodyPadding = { 230 overflow: null, 231 padding: null, 232 paddingTop: null, 233 paddingRight: null, 234 paddingBottom: null, 235 paddingLeft: null 236 }; 237 updateSizes(backupElementSizes, root.style); 238 backupElementSizes.modified = false; 239 } 240 restoreParentPositioning(backupPositioning); 241 backupPositioning = null; 242} 243function updateSizes(source, target) { 244 target.width = source.width; 245 target.height = source.height; 246 target.top = source.top; 247 target.left = source.left; 248 target.position = source.position; 249 target.zIndex = source.zIndex; 250} 251function addDOMEvents() { 252 gantt.event(document, "webkitfullscreenchange", onFullScreenChange); 253 gantt.event(document, "mozfullscreenchange", onFullScreenChange); 254 gantt.event(document, "MSFullscreenChange", onFullScreenChange); 255 // For IE on Win 10 256 gantt.event(document, "fullscreenChange", onFullScreenChange); 257 gantt.event(document, "fullscreenchange", onFullScreenChange); 258} 259var expandGantt = false; 260function onFullScreenChange() { 261 if (!gantt.$container) { 262 // do nothing if gantt is not yet initialized 263 return; 264 } 265 var event; 266 var isBodyExpanded = isExpanded(); 267 if (isBodyExpanded) { 268 if (expandGantt) { 269 event = "onExpand"; 270 setFullScreenSizes(); 271 } 272 } 273 else if (expandGantt) { 274 expandGantt = false; 275 event = "onCollapse"; 276 restoreSizes(); 277 } 278 setTimeout(function () { 279 gantt.render(); 280 }); 281 setTimeout(function () { 282 gantt.callEvent(event, [gantt.ext.fullscreen.getFullscreenElement()]); 283 }); 284} 285function cantFullscreen() { 286 if (!gantt.$container) { // check is gantt initialized or not 287 return true; 288 } 289 if (!gantt.ext.fullscreen.getFullscreenElement()) { 290 return true; 291 } 292 if (!isFullscreenAvailable()) { 293 // tslint:disable-next-line: no-console 294 var method = console.warning || console.log; 295 method("The `fullscreen` feature not being allowed, or full-screen mode not being supported"); 296 return true; 297 } 298 return false; 299} 300gantt.ext.fullscreen = { 301 expand: function () { 302 if (cantFullscreen()) { 303 return; 304 } 305 if (isExpanded()) { 306 return; 307 } 308 if (!gantt.callEvent("onBeforeExpand", [this.getFullscreenElement()])) { 309 return; 310 } 311 expandGantt = true; 312 // we switch body to fullscreen and then expand fullscreen element to viewport 313 // we do it to correct display common elements: lightboxes, tooltip etc. 314 var element = document.body; 315 var requestArguments = element.webkitRequestFullscreen ? 316 [Element.ALLOW_KEYBOARD_INPUT] : []; 317 var requestFullscreen = element.msRequestFullscreen || 318 element.mozRequestFullScreen || 319 element.webkitRequestFullscreen || 320 element.requestFullscreen; 321 if (requestFullscreen) { 322 requestFullscreen.apply(element, requestArguments); 323 } 324 }, 325 collapse: function () { 326 if (cantFullscreen()) { 327 return; 328 } 329 if (!isExpanded()) { 330 return; 331 } 332 if (!gantt.callEvent("onBeforeCollapse", [this.getFullscreenElement()])) { 333 return; 334 } 335 var requestExitFullscreen = document.msExitFullscreen || 336 document.mozCancelFullScreen || 337 document.webkitExitFullscreen || 338 document.exitFullscreen; 339 if (requestExitFullscreen) { 340 requestExitFullscreen.apply(document); 341 } 342 }, 343 toggle: function () { 344 if (cantFullscreen()) { 345 return; 346 } 347 if (!isExpanded()) { 348 this.expand(); 349 } 350 else { 351 this.collapse(); 352 } 353 }, 354 getFullscreenElement: function () { 355 return gantt.$root; 356 }, 357}; 358gantt.expand = function () { 359 gantt.ext.fullscreen.expand(); 360}; 361gantt.collapse = function () { 362 gantt.ext.fullscreen.collapse(); 363}; 364gantt.attachEvent("onGanttReady", addDOMEvents); 365 366 367/***/ }) 368 369/******/ }); 370});