/******/ (function(modules) { // webpackBootstrap /******/ function hotDisposeChunk(chunkId) { /******/ delete installedChunks[chunkId]; /******/ } /******/ var parentHotUpdateCallback = this["webpackHotUpdate"]; /******/ this["webpackHotUpdate"] = /******/ function webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars /******/ hotAddUpdateChunk(chunkId, moreModules); /******/ if(parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules); /******/ } ; /******/ /******/ function hotDownloadUpdateChunk(chunkId) { // eslint-disable-line no-unused-vars /******/ var head = document.getElementsByTagName("head")[0]; /******/ var script = document.createElement("script"); /******/ script.type = "text/javascript"; /******/ script.charset = "utf-8"; /******/ script.src = __webpack_require__.p + "" + chunkId + "." + hotCurrentHash + ".hot-update.js"; /******/ head.appendChild(script); /******/ } /******/ /******/ function hotDownloadManifest() { // eslint-disable-line no-unused-vars /******/ return new Promise(function(resolve, reject) { /******/ if(typeof XMLHttpRequest === "undefined") /******/ return reject(new Error("No browser support")); /******/ try { /******/ var request = new XMLHttpRequest(); /******/ var requestPath = __webpack_require__.p + "" + hotCurrentHash + ".hot-update.json"; /******/ request.open("GET", requestPath, true); /******/ request.timeout = 10000; /******/ request.send(null); /******/ } catch(err) { /******/ return reject(err); /******/ } /******/ request.onreadystatechange = function() { /******/ if(request.readyState !== 4) return; /******/ if(request.status === 0) { /******/ // timeout /******/ reject(new Error("Manifest request to " + requestPath + " timed out.")); /******/ } else if(request.status === 404) { /******/ // no update available /******/ resolve(); /******/ } else if(request.status !== 200 && request.status !== 304) { /******/ // other failure /******/ reject(new Error("Manifest request to " + requestPath + " failed.")); /******/ } else { /******/ // success /******/ try { /******/ var update = JSON.parse(request.responseText); /******/ } catch(e) { /******/ reject(e); /******/ return; /******/ } /******/ resolve(update); /******/ } /******/ }; /******/ }); /******/ } /******/ /******/ /******/ /******/ var hotApplyOnUpdate = true; /******/ var hotCurrentHash = "92c8774f2f345bdf48a1"; // eslint-disable-line no-unused-vars /******/ var hotCurrentModuleData = {}; /******/ var hotCurrentChildModule; // eslint-disable-line no-unused-vars /******/ var hotCurrentParents = []; // eslint-disable-line no-unused-vars /******/ var hotCurrentParentsTemp = []; // eslint-disable-line no-unused-vars /******/ /******/ function hotCreateRequire(moduleId) { // eslint-disable-line no-unused-vars /******/ var me = installedModules[moduleId]; /******/ if(!me) return __webpack_require__; /******/ var fn = function(request) { /******/ if(me.hot.active) { /******/ if(installedModules[request]) { /******/ if(installedModules[request].parents.indexOf(moduleId) < 0) /******/ installedModules[request].parents.push(moduleId); /******/ } else { /******/ hotCurrentParents = [moduleId]; /******/ hotCurrentChildModule = request; /******/ } /******/ if(me.children.indexOf(request) < 0) /******/ me.children.push(request); /******/ } else { /******/ console.warn("[HMR] unexpected require(" + request + ") from disposed module " + moduleId); /******/ hotCurrentParents = []; /******/ } /******/ return __webpack_require__(request); /******/ }; /******/ var ObjectFactory = function ObjectFactory(name) { /******/ return { /******/ configurable: true, /******/ enumerable: true, /******/ get: function() { /******/ return __webpack_require__[name]; /******/ }, /******/ set: function(value) { /******/ __webpack_require__[name] = value; /******/ } /******/ }; /******/ }; /******/ for(var name in __webpack_require__) { /******/ if(Object.prototype.hasOwnProperty.call(__webpack_require__, name) && name !== "e") { /******/ Object.defineProperty(fn, name, ObjectFactory(name)); /******/ } /******/ } /******/ fn.e = function(chunkId) { /******/ if(hotStatus === "ready") /******/ hotSetStatus("prepare"); /******/ hotChunksLoading++; /******/ return __webpack_require__.e(chunkId).then(finishChunkLoading, function(err) { /******/ finishChunkLoading(); /******/ throw err; /******/ }); /******/ /******/ function finishChunkLoading() { /******/ hotChunksLoading--; /******/ if(hotStatus === "prepare") { /******/ if(!hotWaitingFilesMap[chunkId]) { /******/ hotEnsureUpdateChunk(chunkId); /******/ } /******/ if(hotChunksLoading === 0 && hotWaitingFiles === 0) { /******/ hotUpdateDownloaded(); /******/ } /******/ } /******/ } /******/ }; /******/ return fn; /******/ } /******/ /******/ function hotCreateModule(moduleId) { // eslint-disable-line no-unused-vars /******/ var hot = { /******/ // private stuff /******/ _acceptedDependencies: {}, /******/ _declinedDependencies: {}, /******/ _selfAccepted: false, /******/ _selfDeclined: false, /******/ _disposeHandlers: [], /******/ _main: hotCurrentChildModule !== moduleId, /******/ /******/ // Module API /******/ active: true, /******/ accept: function(dep, callback) { /******/ if(typeof dep === "undefined") /******/ hot._selfAccepted = true; /******/ else if(typeof dep === "function") /******/ hot._selfAccepted = dep; /******/ else if(typeof dep === "object") /******/ for(var i = 0; i < dep.length; i++) /******/ hot._acceptedDependencies[dep[i]] = callback || function() {}; /******/ else /******/ hot._acceptedDependencies[dep] = callback || function() {}; /******/ }, /******/ decline: function(dep) { /******/ if(typeof dep === "undefined") /******/ hot._selfDeclined = true; /******/ else if(typeof dep === "object") /******/ for(var i = 0; i < dep.length; i++) /******/ hot._declinedDependencies[dep[i]] = true; /******/ else /******/ hot._declinedDependencies[dep] = true; /******/ }, /******/ dispose: function(callback) { /******/ hot._disposeHandlers.push(callback); /******/ }, /******/ addDisposeHandler: function(callback) { /******/ hot._disposeHandlers.push(callback); /******/ }, /******/ removeDisposeHandler: function(callback) { /******/ var idx = hot._disposeHandlers.indexOf(callback); /******/ if(idx >= 0) hot._disposeHandlers.splice(idx, 1); /******/ }, /******/ /******/ // Management API /******/ check: hotCheck, /******/ apply: hotApply, /******/ status: function(l) { /******/ if(!l) return hotStatus; /******/ hotStatusHandlers.push(l); /******/ }, /******/ addStatusHandler: function(l) { /******/ hotStatusHandlers.push(l); /******/ }, /******/ removeStatusHandler: function(l) { /******/ var idx = hotStatusHandlers.indexOf(l); /******/ if(idx >= 0) hotStatusHandlers.splice(idx, 1); /******/ }, /******/ /******/ //inherit from previous dispose call /******/ data: hotCurrentModuleData[moduleId] /******/ }; /******/ hotCurrentChildModule = undefined; /******/ return hot; /******/ } /******/ /******/ var hotStatusHandlers = []; /******/ var hotStatus = "idle"; /******/ /******/ function hotSetStatus(newStatus) { /******/ hotStatus = newStatus; /******/ for(var i = 0; i < hotStatusHandlers.length; i++) /******/ hotStatusHandlers[i].call(null, newStatus); /******/ } /******/ /******/ // while downloading /******/ var hotWaitingFiles = 0; /******/ var hotChunksLoading = 0; /******/ var hotWaitingFilesMap = {}; /******/ var hotRequestedFilesMap = {}; /******/ var hotAvailableFilesMap = {}; /******/ var hotDeferred; /******/ /******/ // The update info /******/ var hotUpdate, hotUpdateNewHash; /******/ /******/ function toModuleId(id) { /******/ var isNumber = (+id) + "" === id; /******/ return isNumber ? +id : id; /******/ } /******/ /******/ function hotCheck(apply) { /******/ if(hotStatus !== "idle") throw new Error("check() is only allowed in idle status"); /******/ hotApplyOnUpdate = apply; /******/ hotSetStatus("check"); /******/ return hotDownloadManifest().then(function(update) { /******/ if(!update) { /******/ hotSetStatus("idle"); /******/ return null; /******/ } /******/ hotRequestedFilesMap = {}; /******/ hotWaitingFilesMap = {}; /******/ hotAvailableFilesMap = update.c; /******/ hotUpdateNewHash = update.h; /******/ /******/ hotSetStatus("prepare"); /******/ var promise = new Promise(function(resolve, reject) { /******/ hotDeferred = { /******/ resolve: resolve, /******/ reject: reject /******/ }; /******/ }); /******/ hotUpdate = {}; /******/ var chunkId = 0; /******/ { // eslint-disable-line no-lone-blocks /******/ /*globals chunkId */ /******/ hotEnsureUpdateChunk(chunkId); /******/ } /******/ if(hotStatus === "prepare" && hotChunksLoading === 0 && hotWaitingFiles === 0) { /******/ hotUpdateDownloaded(); /******/ } /******/ return promise; /******/ }); /******/ } /******/ /******/ function hotAddUpdateChunk(chunkId, moreModules) { // eslint-disable-line no-unused-vars /******/ if(!hotAvailableFilesMap[chunkId] || !hotRequestedFilesMap[chunkId]) /******/ return; /******/ hotRequestedFilesMap[chunkId] = false; /******/ for(var moduleId in moreModules) { /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { /******/ hotUpdate[moduleId] = moreModules[moduleId]; /******/ } /******/ } /******/ if(--hotWaitingFiles === 0 && hotChunksLoading === 0) { /******/ hotUpdateDownloaded(); /******/ } /******/ } /******/ /******/ function hotEnsureUpdateChunk(chunkId) { /******/ if(!hotAvailableFilesMap[chunkId]) { /******/ hotWaitingFilesMap[chunkId] = true; /******/ } else { /******/ hotRequestedFilesMap[chunkId] = true; /******/ hotWaitingFiles++; /******/ hotDownloadUpdateChunk(chunkId); /******/ } /******/ } /******/ /******/ function hotUpdateDownloaded() { /******/ hotSetStatus("ready"); /******/ var deferred = hotDeferred; /******/ hotDeferred = null; /******/ if(!deferred) return; /******/ if(hotApplyOnUpdate) { /******/ hotApply(hotApplyOnUpdate).then(function(result) { /******/ deferred.resolve(result); /******/ }, function(err) { /******/ deferred.reject(err); /******/ }); /******/ } else { /******/ var outdatedModules = []; /******/ for(var id in hotUpdate) { /******/ if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) { /******/ outdatedModules.push(toModuleId(id)); /******/ } /******/ } /******/ deferred.resolve(outdatedModules); /******/ } /******/ } /******/ /******/ function hotApply(options) { /******/ if(hotStatus !== "ready") throw new Error("apply() is only allowed in ready status"); /******/ options = options || {}; /******/ /******/ var cb; /******/ var i; /******/ var j; /******/ var module; /******/ var moduleId; /******/ /******/ function getAffectedStuff(updateModuleId) { /******/ var outdatedModules = [updateModuleId]; /******/ var outdatedDependencies = {}; /******/ /******/ var queue = outdatedModules.slice().map(function(id) { /******/ return { /******/ chain: [id], /******/ id: id /******/ }; /******/ }); /******/ while(queue.length > 0) { /******/ var queueItem = queue.pop(); /******/ var moduleId = queueItem.id; /******/ var chain = queueItem.chain; /******/ module = installedModules[moduleId]; /******/ if(!module || module.hot._selfAccepted) /******/ continue; /******/ if(module.hot._selfDeclined) { /******/ return { /******/ type: "self-declined", /******/ chain: chain, /******/ moduleId: moduleId /******/ }; /******/ } /******/ if(module.hot._main) { /******/ return { /******/ type: "unaccepted", /******/ chain: chain, /******/ moduleId: moduleId /******/ }; /******/ } /******/ for(var i = 0; i < module.parents.length; i++) { /******/ var parentId = module.parents[i]; /******/ var parent = installedModules[parentId]; /******/ if(!parent) continue; /******/ if(parent.hot._declinedDependencies[moduleId]) { /******/ return { /******/ type: "declined", /******/ chain: chain.concat([parentId]), /******/ moduleId: moduleId, /******/ parentId: parentId /******/ }; /******/ } /******/ if(outdatedModules.indexOf(parentId) >= 0) continue; /******/ if(parent.hot._acceptedDependencies[moduleId]) { /******/ if(!outdatedDependencies[parentId]) /******/ outdatedDependencies[parentId] = []; /******/ addAllToSet(outdatedDependencies[parentId], [moduleId]); /******/ continue; /******/ } /******/ delete outdatedDependencies[parentId]; /******/ outdatedModules.push(parentId); /******/ queue.push({ /******/ chain: chain.concat([parentId]), /******/ id: parentId /******/ }); /******/ } /******/ } /******/ /******/ return { /******/ type: "accepted", /******/ moduleId: updateModuleId, /******/ outdatedModules: outdatedModules, /******/ outdatedDependencies: outdatedDependencies /******/ }; /******/ } /******/ /******/ function addAllToSet(a, b) { /******/ for(var i = 0; i < b.length; i++) { /******/ var item = b[i]; /******/ if(a.indexOf(item) < 0) /******/ a.push(item); /******/ } /******/ } /******/ /******/ // at begin all updates modules are outdated /******/ // the "outdated" status can propagate to parents if they don't accept the children /******/ var outdatedDependencies = {}; /******/ var outdatedModules = []; /******/ var appliedUpdate = {}; /******/ /******/ var warnUnexpectedRequire = function warnUnexpectedRequire() { /******/ console.warn("[HMR] unexpected require(" + result.moduleId + ") to disposed module"); /******/ }; /******/ /******/ for(var id in hotUpdate) { /******/ if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) { /******/ moduleId = toModuleId(id); /******/ var result; /******/ if(hotUpdate[id]) { /******/ result = getAffectedStuff(moduleId); /******/ } else { /******/ result = { /******/ type: "disposed", /******/ moduleId: id /******/ }; /******/ } /******/ var abortError = false; /******/ var doApply = false; /******/ var doDispose = false; /******/ var chainInfo = ""; /******/ if(result.chain) { /******/ chainInfo = "\nUpdate propagation: " + result.chain.join(" -> "); /******/ } /******/ switch(result.type) { /******/ case "self-declined": /******/ if(options.onDeclined) /******/ options.onDeclined(result); /******/ if(!options.ignoreDeclined) /******/ abortError = new Error("Aborted because of self decline: " + result.moduleId + chainInfo); /******/ break; /******/ case "declined": /******/ if(options.onDeclined) /******/ options.onDeclined(result); /******/ if(!options.ignoreDeclined) /******/ abortError = new Error("Aborted because of declined dependency: " + result.moduleId + " in " + result.parentId + chainInfo); /******/ break; /******/ case "unaccepted": /******/ if(options.onUnaccepted) /******/ options.onUnaccepted(result); /******/ if(!options.ignoreUnaccepted) /******/ abortError = new Error("Aborted because " + moduleId + " is not accepted" + chainInfo); /******/ break; /******/ case "accepted": /******/ if(options.onAccepted) /******/ options.onAccepted(result); /******/ doApply = true; /******/ break; /******/ case "disposed": /******/ if(options.onDisposed) /******/ options.onDisposed(result); /******/ doDispose = true; /******/ break; /******/ default: /******/ throw new Error("Unexception type " + result.type); /******/ } /******/ if(abortError) { /******/ hotSetStatus("abort"); /******/ return Promise.reject(abortError); /******/ } /******/ if(doApply) { /******/ appliedUpdate[moduleId] = hotUpdate[moduleId]; /******/ addAllToSet(outdatedModules, result.outdatedModules); /******/ for(moduleId in result.outdatedDependencies) { /******/ if(Object.prototype.hasOwnProperty.call(result.outdatedDependencies, moduleId)) { /******/ if(!outdatedDependencies[moduleId]) /******/ outdatedDependencies[moduleId] = []; /******/ addAllToSet(outdatedDependencies[moduleId], result.outdatedDependencies[moduleId]); /******/ } /******/ } /******/ } /******/ if(doDispose) { /******/ addAllToSet(outdatedModules, [result.moduleId]); /******/ appliedUpdate[moduleId] = warnUnexpectedRequire; /******/ } /******/ } /******/ } /******/ /******/ // Store self accepted outdated modules to require them later by the module system /******/ var outdatedSelfAcceptedModules = []; /******/ for(i = 0; i < outdatedModules.length; i++) { /******/ moduleId = outdatedModules[i]; /******/ if(installedModules[moduleId] && installedModules[moduleId].hot._selfAccepted) /******/ outdatedSelfAcceptedModules.push({ /******/ module: moduleId, /******/ errorHandler: installedModules[moduleId].hot._selfAccepted /******/ }); /******/ } /******/ /******/ // Now in "dispose" phase /******/ hotSetStatus("dispose"); /******/ Object.keys(hotAvailableFilesMap).forEach(function(chunkId) { /******/ if(hotAvailableFilesMap[chunkId] === false) { /******/ hotDisposeChunk(chunkId); /******/ } /******/ }); /******/ /******/ var idx; /******/ var queue = outdatedModules.slice(); /******/ while(queue.length > 0) { /******/ moduleId = queue.pop(); /******/ module = installedModules[moduleId]; /******/ if(!module) continue; /******/ /******/ var data = {}; /******/ /******/ // Call dispose handlers /******/ var disposeHandlers = module.hot._disposeHandlers; /******/ for(j = 0; j < disposeHandlers.length; j++) { /******/ cb = disposeHandlers[j]; /******/ cb(data); /******/ } /******/ hotCurrentModuleData[moduleId] = data; /******/ /******/ // disable module (this disables requires from this module) /******/ module.hot.active = false; /******/ /******/ // remove module from cache /******/ delete installedModules[moduleId]; /******/ /******/ // remove "parents" references from all children /******/ for(j = 0; j < module.children.length; j++) { /******/ var child = installedModules[module.children[j]]; /******/ if(!child) continue; /******/ idx = child.parents.indexOf(moduleId); /******/ if(idx >= 0) { /******/ child.parents.splice(idx, 1); /******/ } /******/ } /******/ } /******/ /******/ // remove outdated dependency from module children /******/ var dependency; /******/ var moduleOutdatedDependencies; /******/ for(moduleId in outdatedDependencies) { /******/ if(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) { /******/ module = installedModules[moduleId]; /******/ if(module) { /******/ moduleOutdatedDependencies = outdatedDependencies[moduleId]; /******/ for(j = 0; j < moduleOutdatedDependencies.length; j++) { /******/ dependency = moduleOutdatedDependencies[j]; /******/ idx = module.children.indexOf(dependency); /******/ if(idx >= 0) module.children.splice(idx, 1); /******/ } /******/ } /******/ } /******/ } /******/ /******/ // Not in "apply" phase /******/ hotSetStatus("apply"); /******/ /******/ hotCurrentHash = hotUpdateNewHash; /******/ /******/ // insert new code /******/ for(moduleId in appliedUpdate) { /******/ if(Object.prototype.hasOwnProperty.call(appliedUpdate, moduleId)) { /******/ modules[moduleId] = appliedUpdate[moduleId]; /******/ } /******/ } /******/ /******/ // call accept handlers /******/ var error = null; /******/ for(moduleId in outdatedDependencies) { /******/ if(Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)) { /******/ module = installedModules[moduleId]; /******/ moduleOutdatedDependencies = outdatedDependencies[moduleId]; /******/ var callbacks = []; /******/ for(i = 0; i < moduleOutdatedDependencies.length; i++) { /******/ dependency = moduleOutdatedDependencies[i]; /******/ cb = module.hot._acceptedDependencies[dependency]; /******/ if(callbacks.indexOf(cb) >= 0) continue; /******/ callbacks.push(cb); /******/ } /******/ for(i = 0; i < callbacks.length; i++) { /******/ cb = callbacks[i]; /******/ try { /******/ cb(moduleOutdatedDependencies); /******/ } catch(err) { /******/ if(options.onErrored) { /******/ options.onErrored({ /******/ type: "accept-errored", /******/ moduleId: moduleId, /******/ dependencyId: moduleOutdatedDependencies[i], /******/ error: err /******/ }); /******/ } /******/ if(!options.ignoreErrored) { /******/ if(!error) /******/ error = err; /******/ } /******/ } /******/ } /******/ } /******/ } /******/ /******/ // Load self accepted modules /******/ for(i = 0; i < outdatedSelfAcceptedModules.length; i++) { /******/ var item = outdatedSelfAcceptedModules[i]; /******/ moduleId = item.module; /******/ hotCurrentParents = [moduleId]; /******/ try { /******/ __webpack_require__(moduleId); /******/ } catch(err) { /******/ if(typeof item.errorHandler === "function") { /******/ try { /******/ item.errorHandler(err); /******/ } catch(err2) { /******/ if(options.onErrored) { /******/ options.onErrored({ /******/ type: "self-accept-error-handler-errored", /******/ moduleId: moduleId, /******/ error: err2, /******/ orginalError: err /******/ }); /******/ } /******/ if(!options.ignoreErrored) { /******/ if(!error) /******/ error = err2; /******/ } /******/ if(!error) /******/ error = err; /******/ } /******/ } else { /******/ if(options.onErrored) { /******/ options.onErrored({ /******/ type: "self-accept-errored", /******/ moduleId: moduleId, /******/ error: err /******/ }); /******/ } /******/ if(!options.ignoreErrored) { /******/ if(!error) /******/ error = err; /******/ } /******/ } /******/ } /******/ } /******/ /******/ // handle errors in accept handlers and self accepted module load /******/ if(error) { /******/ hotSetStatus("fail"); /******/ return Promise.reject(error); /******/ } /******/ /******/ hotSetStatus("idle"); /******/ return new Promise(function(resolve) { /******/ resolve(outdatedModules); /******/ }); /******/ } /******/ /******/ // 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: {}, /******/ hot: hotCreateModule(moduleId), /******/ parents: (hotCurrentParentsTemp = hotCurrentParents, hotCurrentParents = [], hotCurrentParentsTemp), /******/ children: [] /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); /******/ /******/ // 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; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // __webpack_hash__ /******/ __webpack_require__.h = function() { return hotCurrentHash; }; /******/ /******/ // Load entry module and return exports /******/ return hotCreateRequire(14)(__webpack_require__.s = 14); /******/ }) /************************************************************************/ /******/ ([ /* 0 */, /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__components_grid_grid__ = __webpack_require__(9); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__components_grid_grid___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__components_grid_grid__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__components_grid_extension_link_row_action_extension__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__components_grid_extension_link_row_action_extension___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__components_grid_extension_link_row_action_extension__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__components_grid_extension_action_row_submit_row_action_extension__ = __webpack_require__(5); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__components_grid_extension_action_row_submit_row_action_extension___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__components_grid_extension_action_row_submit_row_action_extension__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__components_grid_extension_sorting_extension__ = __webpack_require__(8); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__components_grid_extension_sorting_extension___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__components_grid_extension_sorting_extension__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__components_grid_extension_position_extension__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__components_grid_extension_position_extension___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__components_grid_extension_position_extension__); /** * 2007-2018 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA * @copyright 2007-2018 PrestaShop SA * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ var $ = window.$; $(function () { var gridDivs = document.querySelectorAll('.js-grid'); gridDivs.forEach(function (gridDiv) { var linkBlockGrid = new __WEBPACK_IMPORTED_MODULE_0__components_grid_grid___default.a(gridDiv.dataset.gridId); linkBlockGrid.addExtension(new __WEBPACK_IMPORTED_MODULE_3__components_grid_extension_sorting_extension___default.a()); linkBlockGrid.addExtension(new __WEBPACK_IMPORTED_MODULE_1__components_grid_extension_link_row_action_extension___default.a()); linkBlockGrid.addExtension(new __WEBPACK_IMPORTED_MODULE_2__components_grid_extension_action_row_submit_row_action_extension___default.a()); linkBlockGrid.addExtension(new __WEBPACK_IMPORTED_MODULE_4__components_grid_extension_position_extension___default.a()); }); }); /***/ }), /* 2 */ /***/ (function(module, exports) { /*! jquery.tablednd.js 30-12-2017 */ !function(a,b,c,d){var e="touchstart mousedown",f="touchmove mousemove",g="touchend mouseup";a(c).ready(function(){function b(a){for(var b={},c=a.match(/([^;:]+)/g)||[];c.length;)b[c.shift()]=c.shift().trim();return b}a("table").each(function(){"dnd"===a(this).data("table")&&a(this).tableDnD({onDragStyle:a(this).data("ondragstyle")&&b(a(this).data("ondragstyle"))||null,onDropStyle:a(this).data("ondropstyle")&&b(a(this).data("ondropstyle"))||null,onDragClass:a(this).data("ondragclass")===d&&"tDnD_whileDrag"||a(this).data("ondragclass"),onDrop:a(this).data("ondrop")&&new Function("table","row",a(this).data("ondrop")),onDragStart:a(this).data("ondragstart")&&new Function("table","row",a(this).data("ondragstart")),onDragStop:a(this).data("ondragstop")&&new Function("table","row",a(this).data("ondragstop")),scrollAmount:a(this).data("scrollamount")||5,sensitivity:a(this).data("sensitivity")||10,hierarchyLevel:a(this).data("hierarchylevel")||0,indentArtifact:a(this).data("indentartifact")||'
 
',autoWidthAdjust:a(this).data("autowidthadjust")||!0,autoCleanRelations:a(this).data("autocleanrelations")||!0,jsonPretifySeparator:a(this).data("jsonpretifyseparator")||"\t",serializeRegexp:a(this).data("serializeregexp")&&new RegExp(a(this).data("serializeregexp"))||/[^\-]*$/,serializeParamName:a(this).data("serializeparamname")||!1,dragHandle:a(this).data("draghandle")||null})})}),jQuery.tableDnD={currentTable:null,dragObject:null,mouseOffset:null,oldX:0,oldY:0,build:function(b){return this.each(function(){this.tableDnDConfig=a.extend({onDragStyle:null,onDropStyle:null,onDragClass:"tDnD_whileDrag",onDrop:null,onDragStart:null,onDragStop:null,scrollAmount:5,sensitivity:10,hierarchyLevel:0,indentArtifact:'
 
',autoWidthAdjust:!0,autoCleanRelations:!0,jsonPretifySeparator:"\t",serializeRegexp:/[^\-]*$/,serializeParamName:!1,dragHandle:null},b||{}),a.tableDnD.makeDraggable(this),this.tableDnDConfig.hierarchyLevel&&a.tableDnD.makeIndented(this)}),this},makeIndented:function(b){var c,d,e=b.tableDnDConfig,f=b.rows,g=a(f).first().find("td:first")[0],h=0,i=0;if(a(b).hasClass("indtd"))return null;d=a(b).addClass("indtd").attr("style"),a(b).css({whiteSpace:"nowrap"});for(var j=0;ja.vertical&&this.dragObject.parentNode.insertBefore(this.dragObject,b.nextSibling)||00&&a(c).find("td:first").children(":first").remove()&&a(c).data("level",--d),0>b.horizontal&&d=d&&a(c).children(":first").prepend(e.indentArtifact)&&a(c).data("level",++d)},mousemove:function(b){var c,d,e,f,g,h=a(a.tableDnD.dragObject),i=a.tableDnD.currentTable.tableDnDConfig;return b&&b.preventDefault(),!!a.tableDnD.dragObject&&("touchmove"===b.type&&event.preventDefault(),i.onDragClass&&h.addClass(i.onDragClass)||h.css(i.onDragStyle),d=a.tableDnD.mouseCoords(b),f=d.x-a.tableDnD.mouseOffset.x,g=d.y-a.tableDnD.mouseOffset.y,a.tableDnD.autoScroll(d),c=a.tableDnD.findDropTargetRow(h,g),e=a.tableDnD.findDragDirection(f,g),a.tableDnD.moveVerticle(e,c),a.tableDnD.moveHorizontal(e,c),!1)},findDragDirection:function(a,b){var c=this.currentTable.tableDnDConfig.sensitivity,d=this.oldX,e=this.oldY,f=d-c,g=d+c,h=e-c,i=e+c,j={horizontal:a>=f&&a<=g?0:a>d?-1:1,vertical:b>=h&&b<=i?0:b>e?-1:1};return 0!==j.horizontal&&(this.oldX=a),0!==j.vertical&&(this.oldY=b),j},findDropTargetRow:function(b,c){for(var d=0,e=this.currentTable.rows,f=this.currentTable.tableDnDConfig,g=0,h=null,i=0;ig-d&&c1&&a(this.currentTable.rows).each(function(){if((h=a(this).data("level"))>1)for(e=a(this).prev().data("level");h>e+1;)a(this).find("td:first").children(":first").remove(),a(this).data("level",--h)}),b.onDragClass&&a(d).removeClass(b.onDragClass)||a(d).css(b.onDropStyle),this.dragObject=null,b.onDrop&&this.originalOrder!==this.currentOrder()&&a(d).hide().fadeIn("fast")&&b.onDrop(this.currentTable,d),b.onDragStop&&b.onDragStop(this.currentTable,d),this.currentTable=null},mouseup:function(b){return b&&b.preventDefault(),a.tableDnD.processMouseup(),!1},jsonize:function(a){var b=this.currentTable;return a?JSON.stringify(this.tableData(b),null,b.tableDnDConfig.jsonPretifySeparator):JSON.stringify(this.tableData(b))},serialize:function(){return a.param(this.tableData(this.currentTable))},serializeTable:function(a){for(var b="",c=a.tableDnDConfig.serializeParamName||a.id,d=a.rows,e=0;e0&&(b+="&");var f=d[e].id;f&&a.tableDnDConfig&&a.tableDnDConfig.serializeRegexp&&(f=f.match(a.tableDnDConfig.serializeRegexp)[0],b+=c+"[]="+f)}return b},serializeTables:function(){var b=[];return a("table").each(function(){this.id&&b.push(a.param(a.tableDnD.tableData(this)))}),b.join("&")},tableData:function(b){var c,d,e,f,g=b.tableDnDConfig,h=[],i=0,j=0,k=null,l={};if(b||(b=this.currentTable),!b||!b.rows||!b.rows.length)return{error:{code:500,message:"Not a valid table."}};if(!b.id&&!g.serializeParamName)return{error:{code:500,message:"No serializable unique id provided."}};f=g.autoCleanRelations&&b.rows||a.makeArray(b.rows),d=g.serializeParamName||b.id,e=d,c=function(a){return a&&g&&g.serializeRegexp?a.match(g.serializeRegexp)[0]:a},l[e]=[],!g.autoCleanRelations&&a(f[0]).data("level")&&f.unshift({id:"undefined"});for(var m=0;mi)h.push([e,i]),e=c(f[m-1].id);else if(j=i&&(h[n][1]=0);i=j,a.isArray(l[e])||(l[e]=[]),k=c(f[m].id),k&&l[e].push(k)}else(k=c(f[m].id))&&l[e].push(k);return l}},jQuery.fn.extend({tableDnD:a.tableDnD.build,tableDnDUpdate:a.tableDnD.updateTables,tableDnDSerialize:a.proxy(a.tableDnD.serialize,a.tableDnD),tableDnDSerializeAll:a.tableDnD.serializeTables,tableDnDData:a.proxy(a.tableDnD.tableData,a.tableDnD)})}(jQuery,window,window.document); /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * 2007-2020 PrestaShop SA and Contributors * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to https://www.prestashop.com for more information. * * @author PrestaShop SA * @copyright 2007-2020 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ var _window = window, $ = _window.$; /** * Makes a table sortable by columns. * This forces a page reload with more query parameters. */ var TableSorting = function () { /** * @param {jQuery} table */ function TableSorting(table) { _classCallCheck(this, TableSorting); this.selector = '.ps-sortable-column'; this.columns = $(table).find(this.selector); } /** * Attaches the listeners */ _createClass(TableSorting, [{ key: 'attach', value: function attach() { var _this = this; this.columns.on('click', function (e) { var $column = $(e.delegateTarget); _this.sortByColumn($column, _this.getToggledSortDirection($column)); }); } /** * Sort using a column name * @param {string} columnName * @param {string} direction "asc" or "desc" */ }, { key: 'sortBy', value: function sortBy(columnName, direction) { var $column = this.columns.is('[data-sort-col-name="' + columnName + '"]'); if (!$column) { throw new Error('Cannot sort by "' + columnName + '": invalid column'); } this.sortByColumn($column, direction); } /** * Sort using a column element * @param {jQuery} column * @param {string} direction "asc" or "desc" * @private */ }, { key: 'sortByColumn', value: function sortByColumn(column, direction) { window.location = this.getUrl(column.data('sortColName'), direction === 'desc' ? 'desc' : 'asc', column.data('sortPrefix')); } /** * Returns the inverted direction to sort according to the column's current one * @param {jQuery} column * @return {string} * @private */ }, { key: 'getToggledSortDirection', value: function getToggledSortDirection(column) { return column.data('sortDirection') === 'asc' ? 'desc' : 'asc'; } /** * Returns the url for the sorted table * @param {string} colName * @param {string} direction * @param {string} prefix * @return {string} * @private */ }, { key: 'getUrl', value: function getUrl(colName, direction, prefix) { var url = new URL(window.location.href); var params = url.searchParams; if (prefix) { params.set(prefix + '[orderBy]', colName); params.set(prefix + '[sortOrder]', direction); } else { params.set('orderBy', colName); params.set('sortOrder', direction); } return url.toString(); } }]); return TableSorting; }(); exports.default = TableSorting; /***/ }), /* 4 */, /* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** * 2007-2020 PrestaShop SA and Contributors * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to https://www.prestashop.com for more information. * * @author PrestaShop SA * @copyright 2007-2020 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ var _modal = __webpack_require__(10); var _modal2 = _interopRequireDefault(_modal); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var _window = window, $ = _window.$; /** * Class SubmitRowActionExtension handles submitting of row action */ var SubmitRowActionExtension = function () { function SubmitRowActionExtension() { _classCallCheck(this, SubmitRowActionExtension); } _createClass(SubmitRowActionExtension, [{ key: 'extend', /** * Extend grid * * @param {Grid} grid */ value: function extend(grid) { var _this = this; grid.getContainer().on('click', '.js-submit-row-action', function (event) { event.preventDefault(); var $button = $(event.currentTarget); var confirmMessage = $button.data('confirmMessage'); var confirmTitle = $button.data('title'); var method = $button.data('method'); if (confirmTitle) { _this.showConfirmModal($button, grid, confirmMessage, confirmTitle, method); } else { if (confirmMessage.length && !window.confirm(confirmMessage)) { return; } _this.postForm($button, method); } }); } }, { key: 'postForm', value: function postForm($button, method) { var isGetOrPostMethod = ['GET', 'POST'].includes(method); var $form = $('
', { action: $button.data('url'), method: isGetOrPostMethod ? method : 'POST' }).appendTo('body'); if (!isGetOrPostMethod) { $form.append($('', { type: '_hidden', name: '_method', value: method })); } $form.submit(); } /** * @param {jQuery} $submitBtn * @param {Grid} grid * @param {string} confirmMessage * @param {string} confirmTitle * @param {string} method */ }, { key: 'showConfirmModal', value: function showConfirmModal($submitBtn, grid, confirmMessage, confirmTitle, method) { var _this2 = this; var confirmButtonLabel = $submitBtn.data('confirmButtonLabel'); var closeButtonLabel = $submitBtn.data('closeButtonLabel'); var confirmButtonClass = $submitBtn.data('confirmButtonClass'); var modal = new _modal2.default({ id: grid.getId() + '-grid-confirm-modal', confirmTitle: confirmTitle, confirmMessage: confirmMessage, confirmButtonLabel: confirmButtonLabel, closeButtonLabel: closeButtonLabel, confirmButtonClass: confirmButtonClass }, function () { return _this2.postForm($submitBtn, method); }); modal.show(); } }]); return SubmitRowActionExtension; }(); exports.default = SubmitRowActionExtension; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * 2007-2020 PrestaShop SA and Contributors * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to https://www.prestashop.com for more information. * * @author PrestaShop SA * @copyright 2007-2020 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ var _window = window, $ = _window.$; /** * Class LinkRowActionExtension handles link row actions */ var LinkRowActionExtension = function () { function LinkRowActionExtension() { _classCallCheck(this, LinkRowActionExtension); } _createClass(LinkRowActionExtension, [{ key: 'extend', /** * Extend grid * * @param {Grid} grid */ value: function extend(grid) { this.initRowLinks(grid); this.initConfirmableActions(grid); } /** * Extend grid * * @param {Grid} grid */ }, { key: 'initConfirmableActions', value: function initConfirmableActions(grid) { grid.getContainer().on('click', '.js-link-row-action', function (event) { var confirmMessage = $(event.currentTarget).data('confirm-message'); if (confirmMessage.length && !window.confirm(confirmMessage)) { event.preventDefault(); } }); } /** * Add a click event on rows that matches the first link action (if present) * * @param {Grid} grid */ }, { key: 'initRowLinks', value: function initRowLinks(grid) { $('tr', grid.getContainer()).each(function initEachRow() { var $parentRow = $(this); $('.js-link-row-action[data-clickable-row=1]:first', $parentRow).each(function propagateFirstLinkAction() { var $rowAction = $(this); var $parentCell = $rowAction.closest('td'); var clickableCells = $('td.clickable', $parentRow).not($parentCell); clickableCells.addClass('cursor-pointer').click(function () { var confirmMessage = $rowAction.data('confirm-message'); if (!confirmMessage.length || window.confirm(confirmMessage)) { document.location = $rowAction.attr('href'); } }); }); }); } }]); return LinkRowActionExtension; }(); exports.default = LinkRowActionExtension; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** * 2007-2020 PrestaShop SA and Contributors * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to https://www.prestashop.com for more information. * * @author PrestaShop SA * @copyright 2007-2020 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ __webpack_require__(2); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var _window = window, $ = _window.$; /** * Class PositionExtension extends Grid with reorderable positions */ var PositionExtension = function () { function PositionExtension() { var _this = this; _classCallCheck(this, PositionExtension); return { extend: function extend(grid) { return _this.extend(grid); } }; } /** * Extend grid * * @param {Grid} grid */ _createClass(PositionExtension, [{ key: 'extend', value: function extend(grid) { var _this2 = this; this.grid = grid; this.addIdsToGridTableRows(); grid.getContainer().find('.js-grid-table').tableDnD({ onDragClass: 'position-row-while-drag', dragHandle: '.js-drag-handle', onDrop: function onDrop(table, row) { return _this2.handlePositionChange(row); } }); grid.getContainer().find('.js-drag-handle').hover(function () { $(this).closest('tr').addClass('hover'); }, function () { $(this).closest('tr').removeClass('hover'); }); } /** * When position is changed handle update * * @param {HTMLElement} row * * @private */ }, { key: 'handlePositionChange', value: function handlePositionChange(row) { var $rowPositionContainer = $(row).find('.js-' + this.grid.getId() + '-position:first'); var updateUrl = $rowPositionContainer.data('update-url'); var method = $rowPositionContainer.data('update-method'); var positions = this.getRowsPositions(); var params = { positions: positions }; this.updatePosition(updateUrl, params, method); } /** * Returns the current table positions * @returns {Array} * @private */ }, { key: 'getRowsPositions', value: function getRowsPositions() { var tableData = JSON.parse($.tableDnD.jsonize()); var rowsData = tableData[this.grid.getId() + '_grid_table']; var completeRowsData = []; var trData = void 0; // retrieve dragAndDropOffset offset to have all needed data // for positions mapping evolution over time for (var i = 0; i < rowsData.length; i += 1) { trData = this.grid.getContainer().find('#' + rowsData[i]); completeRowsData.push({ rowMarker: rowsData[i], offset: trData.data('dragAndDropOffset') }); } return this.computeMappingBetweenOldAndNewPositions(completeRowsData); } /** * Add ID's to Grid table rows to make tableDnD.onDrop() function work. * * @private */ }, { key: 'addIdsToGridTableRows', value: function addIdsToGridTableRows() { var counter = 0; this.grid.getContainer().find('.js-grid-table .js-' + this.grid.getId() + '-position').each(function (index, positionWrapper) { var $positionWrapper = $(positionWrapper); var rowId = $positionWrapper.data('id'); var position = $positionWrapper.data('position'); var id = 'row_' + rowId + '_' + position; $positionWrapper.closest('tr').attr('id', id); $positionWrapper.closest('td').addClass('js-drag-handle'); $positionWrapper.closest('tr').data('dragAndDropOffset', counter); counter += 1; }); } /** * Process rows positions update * * @param {String} url * @param {Object} params * @param {String} method * * @private */ }, { key: 'updatePosition', value: function updatePosition(url, params, method) { var isGetOrPostMethod = ['GET', 'POST'].includes(method); var $form = $('', { action: url, method: isGetOrPostMethod ? method : 'POST' }).appendTo('body'); var positionsNb = params.positions.length; var position = void 0; for (var i = 0; i < positionsNb; i += 1) { position = params.positions[i]; $form.append($('', { type: 'hidden', name: 'positions[' + i + '][rowId]', value: position.rowId }), $('', { type: 'hidden', name: 'positions[' + i + '][oldPosition]', value: position.oldPosition }), $('', { type: 'hidden', name: 'positions[' + i + '][newPosition]', value: position.newPosition })); } // This _method param is used by Symfony to simulate DELETE and PUT methods if (!isGetOrPostMethod) { $form.append($('', { type: 'hidden', name: '_method', value: method })); } $form.submit(); } /** * Rows have been reordered. This function * finds, for each row ID: the old position, the new position * * @returns {Array} * @private */ }, { key: 'computeMappingBetweenOldAndNewPositions', value: function computeMappingBetweenOldAndNewPositions(rowsData) { var regex = /^row_(\d+)_(\d+)$/; var rowsNb = rowsData.length; var positionsBeforeDragAndDrop = {}; var positionsAfterDragAndDrop = {}; var mapping = []; var rowDataMarker = void 0; var rowDataParsedData = void 0; var i = void 0; var rowID = void 0; var rowOldPosition = void 0; var rowOldOffset = void 0; var rowNewOffset = void 0; // first, compute for each position, // where they were before the drag-and-drop // and where they are after the drag-and-drop for (i = 0; i < rowsNb; i += 1) { rowDataMarker = rowsData[i].rowMarker; rowDataParsedData = regex.exec(rowDataMarker); rowID = rowDataParsedData[1]; rowOldPosition = parseInt(rowDataParsedData[2], 10); rowOldOffset = rowsData[i].offset; rowNewOffset = i; positionsBeforeDragAndDrop[rowOldOffset] = rowOldPosition; positionsAfterDragAndDrop[rowNewOffset] = rowOldPosition; } var previousRowPositionWithThisOffset = void 0; // for each row in table, we look at before the drag-and-drop // and find what other row was there, this is the new position // of current row for (i = 0; i < rowsNb; i += 1) { rowDataMarker = rowsData[i].rowMarker; rowDataParsedData = regex.exec(rowDataMarker); rowID = rowDataParsedData[1]; rowOldPosition = parseInt(rowDataParsedData[2], 10); rowNewOffset = i; previousRowPositionWithThisOffset = positionsBeforeDragAndDrop[rowNewOffset]; mapping.push({ rowId: rowID, oldPosition: rowOldPosition, newPosition: previousRowPositionWithThisOffset }); } return mapping; } }]); return PositionExtension; }(); exports.default = PositionExtension; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** * 2007-2020 PrestaShop SA and Contributors * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to https://www.prestashop.com for more information. * * @author PrestaShop SA * @copyright 2007-2020 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ var _tableSorting = __webpack_require__(3); var _tableSorting2 = _interopRequireDefault(_tableSorting); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Class ReloadListExtension extends grid with "List reload" action */ var SortingExtension = function () { function SortingExtension() { _classCallCheck(this, SortingExtension); } _createClass(SortingExtension, [{ key: 'extend', /** * Extend grid * * @param {Grid} grid */ value: function extend(grid) { var $sortableTable = grid.getContainer().find('table.table'); new _tableSorting2.default($sortableTable).attach(); } }]); return SortingExtension; }(); exports.default = SortingExtension; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * 2007-2020 PrestaShop SA and Contributors * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to https://www.prestashop.com for more information. * * @author PrestaShop SA * @copyright 2007-2020 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ var _window = window, $ = _window.$; /** * Class is responsible for handling Grid events */ var Grid = function () { /** * Grid id * * @param {string} id */ function Grid(id) { _classCallCheck(this, Grid); this.id = id; this.$container = $('#' + this.id + '_grid'); } /** * Get grid id * * @returns {string} */ _createClass(Grid, [{ key: 'getId', value: function getId() { return this.id; } /** * Get grid container * * @returns {jQuery} */ }, { key: 'getContainer', value: function getContainer() { return this.$container; } /** * Get grid header container * * @returns {jQuery} */ }, { key: 'getHeaderContainer', value: function getHeaderContainer() { return this.$container.closest('.js-grid-panel').find('.js-grid-header'); } /** * Extend grid with external extensions * * @param {object} extension */ }, { key: 'addExtension', value: function addExtension(extension) { extension.extend(this); } }]); return Grid; }(); exports.default = Grid; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = ConfirmModal; /** * 2007-2020 PrestaShop SA and Contributors * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to https://www.prestashop.com for more information. * * @author PrestaShop SA * @copyright 2007-2020 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ var _window = window, $ = _window.$; /** * ConfirmModal component * * @param {String} id * @param {String} confirmTitle * @param {String} confirmMessage * @param {String} closeButtonLabel * @param {String} confirmButtonLabel * @param {String} confirmButtonClass * @param {Boolean} closable * @param {Function} confirmCallback * */ function ConfirmModal(params, confirmCallback) { var _this = this; // Construct the modal var id = params.id, closable = params.closable; this.modal = Modal(params); // jQuery modal object this.$modal = $(this.modal.container); this.show = function () { _this.$modal.modal(); }; this.modal.confirmButton.addEventListener('click', confirmCallback); this.$modal.modal({ backdrop: closable ? true : 'static', keyboard: closable !== undefined ? closable : true, closable: closable !== undefined ? closable : true, show: false }); this.$modal.on('hidden.bs.modal', function () { document.querySelector('#' + id).remove(); }); document.body.appendChild(this.modal.container); } /** * Modal component to improve lisibility by constructing the modal outside the main function * * @param {Object} params * */ function Modal(_ref) { var _ref$id = _ref.id, id = _ref$id === undefined ? 'confirm-modal' : _ref$id, confirmTitle = _ref.confirmTitle, _ref$confirmMessage = _ref.confirmMessage, confirmMessage = _ref$confirmMessage === undefined ? '' : _ref$confirmMessage, _ref$closeButtonLabel = _ref.closeButtonLabel, closeButtonLabel = _ref$closeButtonLabel === undefined ? 'Close' : _ref$closeButtonLabel, _ref$confirmButtonLab = _ref.confirmButtonLabel, confirmButtonLabel = _ref$confirmButtonLab === undefined ? 'Accept' : _ref$confirmButtonLab, _ref$confirmButtonCla = _ref.confirmButtonClass, confirmButtonClass = _ref$confirmButtonCla === undefined ? 'btn-primary' : _ref$confirmButtonCla; var modal = {}; // Main modal element modal.container = document.createElement('div'); modal.container.classList.add('modal', 'fade'); modal.container.id = id; // Modal dialog element modal.dialog = document.createElement('div'); modal.dialog.classList.add('modal-dialog'); // Modal content element modal.content = document.createElement('div'); modal.content.classList.add('modal-content'); // Modal header element modal.header = document.createElement('div'); modal.header.classList.add('modal-header'); // Modal title element if (confirmTitle) { modal.title = document.createElement('h4'); modal.title.classList.add('modal-title'); modal.title.innerHTML = confirmTitle; } // Modal close button icon modal.closeIcon = document.createElement('button'); modal.closeIcon.classList.add('close'); modal.closeIcon.setAttribute('type', 'button'); modal.closeIcon.dataset.dismiss = 'modal'; modal.closeIcon.innerHTML = '×'; // Modal body element modal.body = document.createElement('div'); modal.body.classList.add('modal-body', 'text-left', 'font-weight-normal'); // Modal message element modal.message = document.createElement('p'); modal.message.classList.add('confirm-message'); modal.message.innerHTML = confirmMessage; // Modal footer element modal.footer = document.createElement('div'); modal.footer.classList.add('modal-footer'); // Modal close button element modal.closeButton = document.createElement('button'); modal.closeButton.setAttribute('type', 'button'); modal.closeButton.classList.add('btn', 'btn-outline-secondary', 'btn-lg'); modal.closeButton.dataset.dismiss = 'modal'; modal.closeButton.innerHTML = closeButtonLabel; // Modal close button element modal.confirmButton = document.createElement('button'); modal.confirmButton.setAttribute('type', 'button'); modal.confirmButton.classList.add('btn', confirmButtonClass, 'btn-lg', 'btn-confirm-submit'); modal.confirmButton.dataset.dismiss = 'modal'; modal.confirmButton.innerHTML = confirmButtonLabel; // Constructing the modal if (confirmTitle) { modal.header.append(modal.title, modal.closeIcon); } else { modal.header.appendChild(modal.closeIcon); } modal.body.appendChild(modal.message); modal.footer.append(modal.closeButton, modal.confirmButton); modal.content.append(modal.header, modal.body, modal.footer); modal.dialog.appendChild(modal.content); modal.container.appendChild(modal.dialog); return modal; } /***/ }), /* 11 */, /* 12 */, /* 13 */, /* 14 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(1); /***/ }) /******/ ]);