silverstripe-mapboxfield/client/dist/js/bundle.js.map
2018-11-29 17:38:20 +00:00

1 line
8.2 KiB
Plaintext

{"version":3,"sources":["webpack:///webpack/bootstrap 05e1510e624ea01d2372","webpack:///./client/src/bundles/bundle.js","webpack:///./client/src/components/MapboxField/MapboxField.js","webpack:///external \"jQuery\""],"names":["jQuery","entwine","$","MapboxField","onmatch","getMapboxField","setMapboxField","_super","render","$container","rendered","_getLngField","val","_getLatField","coords","change","find","mapboxgl","accessToken","_getAccessToken","map","Map","center","_getLngLatValue","container","get","style","zoom","marker","Marker","draggable","setLngLat","addTo","on","_onMarkerUpdate","geocoder","MapboxGeocoder","addControl","event","result","geometry","coordinates","NavigationControl","lngLat","getLngLat","_setLngLatValue","lng","lat","window","mapboxAccessToken"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;AChEA;AAAA;AAAA;AAAA;AAAA;AACA;;AAEAA,8CAAMA,CAACC,OAAP,CAAe,IAAf,EAAqB,UAACC,CAAD,EAAO;AAC1BA,IAAE,wBAAF,EAA4BD,OAA5B,CAAoC;AAClCE,iBAAa,IADqB;;AAGlCC,WAHkC,qBAGxB;AACR,UAAI,CAAC,KAAKC,cAAL,EAAL,EAA4B;AAC1B,aAAKC,cAAL,CAAoB,IAAIH,mFAAJ,CAAgB,IAAhB,CAApB;AACD;AACF;AAPiC,GAApC;;AAUAD,IAAE,8CAAF,EAAkDD,OAAlD,CAA0D;AACxDG,WADwD,qBA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ArB;AACD,OAFD;;AAKA,UAAMO,WAAW,IAAIC,cAAJ,CAAmB;AAClClB,qBAAaf,YAAYgB,eAAZ;AADqB,OAAnB,CAAjB;AAGAC,UAAIiB,UAAJ,CAAeF,QAAf;;AAGAA,eAASF,EAAT,CAAY,QAAZ,EAAsB,UAACK,KAAD,EAAW;AAC/BV,eAAOG,SAAP,CAAiBO,MAAMC,MAAN,CAAaC,QAAb,CAAsBC,WAAvC;AACA,cAAKP,eAAL,CAAqBN,MAArB;AACD,OAHD;;AAKAR,UAAIiB,UAAJ,CAAe,IAAIpB,SAASyB,iBAAb,EAAf;;AAEA,WAAKhC,QAAL,GAAgB,IAAhB;AACD;;;oCAMekB,M,EAAQ;AACtB,UAAMe,SAASf,OAAOgB,SAAP,EAAf;AACA,WAAKC,eAAL,CAAqB,CAACF,OAAOG,GAAR,EAAaH,OAAOI,GAApB,CAArB;AACD;;;sCA7FwB;AACvB,aAAOC,OAAOC,iBAAd;AACD;;;;;;AA8FY9C,oEAAf,E;;;;;;;AC9GA,wB","file":"js/bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./client/src/bundles/bundle.js\");\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 05e1510e624ea01d2372","import jQuery from 'jquery';\nimport MapboxField from 'components/MapboxField/MapboxField';\n\njQuery.entwine('ss', ($) => {\n $('.cms-edit-form .mapbox').entwine({\n MapboxField: null,\n\n onmatch() {\n if (!this.getMapboxField()) {\n this.setMapboxField(new MapboxField(this));\n }\n }\n });\n\n $('.cms-edit-form [aria-hidden=\"false\"] .mapbox').entwine({\n onmatch() {\n this._super();\n\n this.getMapboxField().render();\n }\n });\n});\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/bundles/bundle.js","\nclass MapboxField {\n /**\n * @param {jQuery} $container\n */\n constructor($container) {\n this.$container = $container;\n this.rendered = false;\n }\n\n /**\n * @returns {string}\n * @private\n */\n static _getAccessToken() {\n return window.mapboxAccessToken;\n }\n\n /**\n * @returns {string[]}\n * @private\n */\n _getLngLatValue() {\n return [\n this._getLngField().val(),\n this._getLatField().val()\n ]\n }\n\n /**\n * @param {[]} coords\n * @private\n */\n _setLngLatValue(coords) {\n this._getLngField().val(coords[0]).change();\n this._getLatField().val(coords[1]).change();\n }\n\n /**\n * @returns {jQuery}\n * @private\n */\n _getLngField() {\n return this.$container.find('input[data-mapbox-field=\"Longitude\"]');\n }\n\n /**\n * @returns {jQuery}\n * @private\n */\n _getLatField() {\n return this.$container.find('input[data-mapbox-field=\"Latitude\"]');\n }\n\n /**\n * Render the map\n */\n render() {\n if (this.rendered) {\n return;\n }\n\n // Set up map\n mapboxgl.accessToken = MapboxField._getAccessToken();\n const map = new mapboxgl.Map({\n center: this._getLngLatValue(),\n container: this.$container.find('.mapbox__map').get(0),\n style: 'mapbox://styles/mapbox/basic-v9',\n zoom: 15\n });\n\n // Add marker\n const marker = new mapboxgl.Marker({\n draggable: true\n })\n .setLngLat(this._getLngLatValue())\n .addTo(map);\n\n // Udpdate the coordinates after dragging marker\n marker.on('dragend', () => {\n this._onMarkerUpdate(marker);\n });\n\n // Add geocoder to map\n const geocoder = new MapboxGeocoder({\n accessToken: MapboxField._getAccessToken()\n });\n map.addControl(geocoder);\n\n // Update the marker after geocoding\n geocoder.on('result', (event) => {\n marker.setLngLat(event.result.geometry.coordinates);\n this._onMarkerUpdate(marker);\n });\n\n map.addControl(new mapboxgl.NavigationControl());\n\n this.rendered = true;\n }\n\n /**\n * @param {Object} marker\n * @private\n */\n _onMarkerUpdate(marker) {\n const lngLat = marker.getLngLat();\n this._setLngLatValue([lngLat.lng, lngLat.lat]);\n }\n}\n\nexport default MapboxField;\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/components/MapboxField/MapboxField.js","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0"],"sourceRoot":""}