├── tests ├── .eslintrc └── index-test.js ├── .gitignore ├── .travis.yml ├── nwb.config.js ├── CONTRIBUTING.md ├── demo └── src │ ├── index.html │ └── index.js ├── docs ├── runtime.13df06eb.js ├── index.html ├── runtime.13df06eb.js.map └── demo.608d89c8.js ├── package.json ├── src └── index.js └── README.md /tests/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "mocha": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /coverage 2 | /demo/dist 3 | /es 4 | /lib 5 | /node_modules 6 | /umd 7 | npm-debug.log* 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: node_js 4 | node_js: 5 | - 6 6 | 7 | branches: 8 | only: 9 | - master 10 | -------------------------------------------------------------------------------- /nwb.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | type: 'react-component', 3 | npm: { 4 | esModules: true, 5 | umd: { 6 | global: 'EsriLoaderReact', 7 | externals: { 8 | 'esri-loader': 'EsriLoader', 9 | 'prop-types': 'PropTypes', 10 | react: 'React', 11 | } 12 | } 13 | }, 14 | webpack: { 15 | html: { 16 | template: 'demo/src/index.html' 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Prerequisites 2 | 3 | [Node.js](http://nodejs.org/) >= v4 must be installed. 4 | 5 | ## Installation 6 | 7 | - Running `npm install` in the components's root directory will install everything you need for development. 8 | 9 | ## Demo Development Server 10 | 11 | - `npm start` will run a development server with the component's demo app at [http://localhost:3000](http://localhost:3000) with hot module reloading. 12 | 13 | ## Running Tests 14 | 15 | - `npm test` will run the tests once. 16 | 17 | - `npm run test:coverage` will run the tests and produce a coverage report in `coverage/`. 18 | 19 | - `npm run test:watch` will run the tests on every change. 20 | 21 | ## Building 22 | 23 | - `npm run build` will build the component for publishing to npm and also bundle the demo app. 24 | 25 | - `npm run clean` will delete built resources. 26 | -------------------------------------------------------------------------------- /demo/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Esri Loader React 7 | 8 | 11 | 12 | 29 | 30 | 31 |
32 | Fork me on GitHub 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/runtime.13df06eb.js: -------------------------------------------------------------------------------- 1 | !function(e){function r(r){for(var n,f,i=r[0],l=r[1],a=r[2],c=0,s=[];c=1.5.x || 2.x", 23 | "prop-types": "^15.x", 24 | "react": "15.x || 16.x" 25 | }, 26 | "devDependencies": { 27 | "esri-loader": "^2.10.0", 28 | "expect": "^23.6.0", 29 | "nwb": "^0.23.0", 30 | "prop-types": "^15.7.2", 31 | "react": "^16.9.0", 32 | "react-dom": "^16.9.0", 33 | "react-syntax-highlighter": "^8.1.0", 34 | "react-test-renderer": "^16.9.0", 35 | "chai": "^4.2.0", 36 | "enzyme": "^3.10.0", 37 | "enzyme-adapter-react-16": "^1.14.0", 38 | "sinon": "^5.1.1" 39 | }, 40 | "author": "Dave Timmins ", 41 | "homepage": "https://github.com/davetimmins/esri-loader-react/", 42 | "license": "MIT", 43 | "repository": { 44 | "type": "git", 45 | "url": "https://github.com/davetimmins/esri-loader-react.git" 46 | }, 47 | "bugs": { 48 | "url": "https://github.com/davetimmins/esri-loader-react/issues" 49 | }, 50 | "keywords": [ 51 | "esri-loader esri arcgis react react-component" 52 | ] 53 | } 54 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React, {PureComponent} from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import {loadModules} from 'esri-loader'; 4 | 5 | class EsriLoaderReact extends PureComponent { 6 | 7 | componentDidCatch(error, info) { 8 | 9 | const {onError} = this.props; 10 | 11 | if (onError) { 12 | onError(error, info); 13 | } 14 | } 15 | 16 | componentDidMount () { 17 | 18 | const {modulesToLoad, options, onReady, onError} = this.props; 19 | 20 | loadModules(modulesToLoad ? modulesToLoad : [], options) 21 | .then(loadedModules => { 22 | 23 | if (onReady) { 24 | onReady({loadedModules, containerNode: this.mapContainer}); 25 | } 26 | }) 27 | .catch(error => { 28 | 29 | if (onError) { 30 | onError(error, null); 31 | } 32 | }); 33 | } 34 | 35 | render () { 36 | 37 | const {renderMapContainer, mapContainerClassName, children} = this.props; 38 | 39 | if (!renderMapContainer) { 40 | return children ? children : null; 41 | } 42 | 43 | return ( 44 |
this.mapContainer = node} className={mapContainerClassName}> 45 | {children ? children : null} 46 |
47 | ); 48 | } 49 | } 50 | 51 | EsriLoaderReact.propTypes = { 52 | renderMapContainer: PropTypes.bool, // default is true 53 | mapContainerClassName: PropTypes.string, // default is 'map-view' 54 | modulesToLoad: PropTypes.arrayOf(PropTypes.string), 55 | options: PropTypes.shape({ 56 | url: PropTypes.string, 57 | dojoConfig: PropTypes.object 58 | }), 59 | onError: PropTypes.func, // (error, info) => 60 | onReady: PropTypes.func, // ({loadedModules, containerNode (null if renderMapContainer !== true)}) 61 | }; 62 | 63 | EsriLoaderReact.defaultProps = { 64 | renderMapContainer: true, 65 | mapContainerClassName: 'map-view', 66 | onError: (error, info) => console.error(error), 67 | }; 68 | 69 | export default EsriLoaderReact; -------------------------------------------------------------------------------- /demo/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {render} from 'react-dom'; 3 | import SyntaxHighlighter, { registerLanguage } from "react-syntax-highlighter/prism-light"; 4 | import jsx from 'react-syntax-highlighter/languages/prism/jsx'; 5 | import prism from 'react-syntax-highlighter/styles/prism/prism'; 6 | 7 | import EsriLoaderReact from '../../src'; 8 | import {version} from '../../package.json'; 9 | 10 | registerLanguage('jsx', jsx); 11 | 12 | function DemoComponent({options}) { 13 | 14 | const codeString = " \ 15 | import React from 'react'; \n \ 16 | import EsriLoaderReact from 'esri-loader-react'; \n \ 17 | \n \ 18 | function DemoComponent(props) { \n \ 19 | \n \ 20 | const options = { \n \ 21 | url: 'https://js.arcgis.com/4.12/' \n \ 22 | }; \n \ 23 | \n \ 24 | return ( \n \ 25 | { \n \ 29 | new MapView({ \n \ 30 | container: containerNode, \n \ 31 | map: new Map({basemap: 'streets-vector'}) \n \ 32 | }); \n \ 33 | }} \n \ 34 | /> \n \ 35 | ); \n \ 36 | } \ 37 | "; 38 | 39 | return ( 40 |
41 |
42 |

{`Esri-Loader-React v${version}`}

43 |
44 | { 48 | 49 | let view = new MapView({ 50 | container: containerNode, 51 | map: new Map({basemap: 'streets-vector'}), 52 | zoom: 4, 53 | center: [174, -42], 54 | }); 55 | 56 | view.ui.add(new ScaleBar({ 57 | view: view, 58 | unit: 'metric' 59 | }), { 60 | position: "bottom-left" 61 | }); 62 | }} 63 | /> 64 | {codeString} 65 |
66 | ); 67 | } 68 | 69 | const options = { 70 | url: 'https://js.arcgis.com/4.12/' 71 | }; 72 | 73 | render( 74 | , 77 | document.querySelector('#demo') 78 | ); 79 | -------------------------------------------------------------------------------- /tests/index-test.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import {render, unmountComponentAtNode} from 'react-dom' 3 | import TestRenderer from 'react-test-renderer'; 4 | import expect, { spyOn, done } from 'expect'; 5 | import {configure, shallow, mount} from 'enzyme' 6 | import Adapter from 'enzyme-adapter-react-16' 7 | 8 | configure({ adapter: new Adapter() }) 9 | 10 | import EsriLoaderReact from 'src/'; 11 | 12 | describe('', () => { 13 | let testRenderer; 14 | let testInstance; 15 | 16 | let context = { 17 | onReadyCallback: function ({loadedModules, containerNode}) { return new Promise().resolve()}, 18 | onErrorCallback: function (error, info) {}, 19 | }; 20 | 21 | let a; 22 | 23 | beforeEach(() => { 24 | 25 | a = spyOn(context, 'onReadyCallback'); 26 | spyOn(context, 'onErrorCallback'); 27 | 28 | testRenderer = TestRenderer.create( 29 | 33 |

Welcome to Esri-Loader-React

34 |

blah blah

35 |
36 | ); 37 | testInstance = testRenderer.root; 38 | }); 39 | 40 | afterEach(() => { 41 | testRenderer.unmount(); 42 | }); 43 | 44 | it('should render children', () => { 45 | expect(testInstance.props.children).toContain(

Welcome to Esri-Loader-React

); 46 | expect(testInstance.props.children).toContain(

blah blah

); 47 | }); 48 | 49 | // it('should have called onReady', async () => { 50 | // //context.onReadyCallback.then(() => done()); 51 | 52 | // const wrapper = shallow() 53 | 54 | // await wrapper.instance().componentDidMount() 55 | 56 | // expect(a).toHaveBeenCalled(); 57 | // }); 58 | 59 | it('should not have called onError', function () { 60 | expect(context.onErrorCallback).toNotHaveBeenCalled(); 61 | }); 62 | 63 | it('should have default props', function () { 64 | expect(testInstance.props.renderMapContainer).toEqual(true); 65 | expect(testInstance.props.mapContainerClassName).toEqual('map-view'); 66 | expect(testInstance.props.onError).toExist(); 67 | }); 68 | 69 | it('should match passed in props', function () { 70 | expect(testInstance.props.modulesToLoad).toEqual(['esri/Map', 'esri/views/MapView']); 71 | expect(testInstance.props.onReady).toEqual(context.onReadyCallback); 72 | }); 73 | }) 74 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Esri Loader React 7 | 8 | 11 | 12 | 29 | 30 | 31 |
32 | Fork me on GitHub 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # esri-loader-react 2 | 3 | [![Build Status](https://travis-ci.org/davetimmins/esri-loader-react.svg?branch=master)](https://travis-ci.org/davetimmins/esri-loader-react) 4 | 5 | [![npm](https://img.shields.io/npm/v/esri-loader-react.svg)](https://www.npmjs.com/package/esri-loader-react) 6 | 7 | A React component wrapper around [esri-loader](https://github.com/Esri/esri-loader) 8 | 9 | > **Version 2.x of this library is compatible with [esri-loader](https://github.com/Esri/esri-loader) 1.5.0 and higher.** 10 | 11 | ### Usage 12 | 13 | `npm install react react-dom prop-types esri-loader esri-loader-react` 14 | 15 | Mount the loader component to load the [Esri JS API](https://developers.arcgis.com/javascript/) when you will need it in your app. 16 | You can pass in the options that get forwarded to the [esri-loader](https://github.com/Esri/esri-loader) `loadModules` function. 17 | 18 | You can still use this component as a means of pre-loading the [Esri JS API](https://developers.arcgis.com/javascript/) though it is less useful now that [esri-loader](https://github.com/Esri/esri-loader) version 1.5.0 onward is basically a 1-liner to do this. Instead, the main usage of this component is likely to be ensuring that the [Esri JS API](https://developers.arcgis.com/javascript/) is ready to use and the modules you need are available and these can then be used to do something in your UI with a DOM node mounted for you to use. If you don't need to auto inject a container node into your UI then set `renderMapContainer={false}`. You can pass through children to be rendered too. 19 | 20 | ```js 21 | import React, {PureComponent} from 'react'; 22 | import EsriLoaderReact from 'esri-loader-react'; 23 | 24 | class AppMain extends PureComponent { 25 | 26 | render() { 27 | const options = { 28 | url: 'https://js.arcgis.com/4.6/' 29 | }; 30 | 31 | return ( 32 | { 36 | new MapView({ 37 | container: containerNode, 38 | map: new Map({basemap: 'oceans'}) 39 | }); 40 | }} 41 | /> 42 | ); 43 | } 44 | } 45 | ``` 46 | 47 | you can still use the functions from [esri-loader](https://github.com/Esri/esri-loader) elsewhere in your code as needed. 48 | 49 | The component has the following properties 50 | 51 | ```js 52 | EsriLoaderReact.propTypes = { 53 | renderMapContainer: PropTypes.bool, // default is true 54 | mapContainerClassName: PropTypes.string, // default is 'map-view' 55 | modulesToLoad: PropTypes.arrayOf(PropTypes.string), 56 | options: PropTypes.shape({ 57 | url: PropTypes.string, 58 | dojoConfig: PropTypes.object 59 | }), 60 | onError: PropTypes.func, // (error, info) => also called from componentDidCatch, default is onError: (error, info) => console.error(error), 61 | onReady: PropTypes.func, // ({loadedModules, containerNode}) => containerNode is null if renderMapContainer !== true 62 | }; 63 | ``` 64 | 65 | ### Build locally 66 | 67 | 1. `npm install` 68 | 2. `npm run build` 69 | 70 | you can run the demo using `npm start` 71 | 72 | ### Examples 73 | 74 | * https://davetimmins.github.io/arcgis-react-redux-legend/ 75 | * https://github.com/davetimmins/create-react-app-esri-loader/ 76 | * https://github.com/tomwayson/esri-react-router-example 77 | -------------------------------------------------------------------------------- /docs/runtime.13df06eb.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///webpack/bootstrap"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","1","exports","module","l","m","c","d","name","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","p","jsonpArray","window","oldJsonpFunction","slice"],"mappings":"aACA,SAAAA,EAAAC,GAQA,IAPA,IAMAC,EAAAC,EANAC,EAAAH,EAAA,GACAI,EAAAJ,EAAA,GACAK,EAAAL,EAAA,GAIAM,EAAA,EAAAC,KACQD,EAAAH,EAAAK,OAAoBF,IAC5BJ,EAAAC,EAAAG,GACAG,EAAAP,IACAK,EAAAG,KAAAD,EAAAP,GAAA,IAEAO,EAAAP,GAAA,EAEA,IAAAD,KAAAG,EACAO,OAAAC,UAAAC,eAAAC,KAAAV,EAAAH,KACAc,EAAAd,GAAAG,EAAAH,IAKA,IAFAe,KAAAhB,GAEAO,EAAAC,QACAD,EAAAU,OAAAV,GAOA,OAHAW,EAAAR,KAAAS,MAAAD,EAAAb,OAGAe,IAEA,SAAAA,IAEA,IADA,IAAAC,EACAf,EAAA,EAAiBA,EAAAY,EAAAV,OAA4BF,IAAA,CAG7C,IAFA,IAAAgB,EAAAJ,EAAAZ,GACAiB,GAAA,EACAC,EAAA,EAAkBA,EAAAF,EAAAd,OAA2BgB,IAAA,CAC7C,IAAAC,EAAAH,EAAAE,GACA,IAAAf,EAAAgB,KAAAF,GAAA,GAEAA,IACAL,EAAAQ,OAAApB,IAAA,GACAe,EAAAM,IAAAC,EAAAN,EAAA,KAGA,OAAAD,EAIA,IAAAQ,KAKApB,GACAqB,EAAA,GAGAZ,KAGA,SAAAS,EAAA1B,GAGA,GAAA4B,EAAA5B,GACA,OAAA4B,EAAA5B,GAAA8B,QAGA,IAAAC,EAAAH,EAAA5B,IACAK,EAAAL,EACAgC,GAAA,EACAF,YAUA,OANAhB,EAAAd,GAAAa,KAAAkB,EAAAD,QAAAC,IAAAD,QAAAJ,GAGAK,EAAAC,GAAA,EAGAD,EAAAD,QAKAJ,EAAAO,EAAAnB,EAGAY,EAAAQ,EAAAN,EAGAF,EAAAS,EAAA,SAAAL,EAAAM,EAAAC,GACAX,EAAAY,EAAAR,EAAAM,IACA1B,OAAA6B,eAAAT,EAAAM,GAA0CI,YAAA,EAAAC,IAAAJ,KAK1CX,EAAAgB,EAAA,SAAAZ,GACA,oBAAAa,eAAAC,aACAlC,OAAA6B,eAAAT,EAAAa,OAAAC,aAAwDC,MAAA,WAExDnC,OAAA6B,eAAAT,EAAA,cAAiDe,OAAA,KAQjDnB,EAAAoB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAAnB,EAAAmB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAvC,OAAAwC,OAAA,MAGA,GAFAxB,EAAAgB,EAAAO,GACAvC,OAAA6B,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC,EAAAE,GAAA,iBAAAF,EAAA,QAAAM,KAAAN,EAAAnB,EAAAS,EAAAc,EAAAE,EAAA,SAAAA,GAAgH,OAAAN,EAAAM,IAAqBC,KAAA,KAAAD,IACrI,OAAAF,GAIAvB,EAAA2B,EAAA,SAAAtB,GACA,IAAAM,EAAAN,KAAAiB,WACA,WAA2B,OAAAjB,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAL,EAAAS,EAAAE,EAAA,IAAAA,GACAA,GAIAX,EAAAY,EAAA,SAAAgB,EAAAC,GAAsD,OAAA7C,OAAAC,UAAAC,eAAAC,KAAAyC,EAAAC,IAGtD7B,EAAA8B,EAAA,GAEA,IAAAC,EAAAC,OAAA,aAAAA,OAAA,iBACAC,EAAAF,EAAAhD,KAAA2C,KAAAK,GACAA,EAAAhD,KAAAX,EACA2D,IAAAG,QACA,QAAAvD,EAAA,EAAgBA,EAAAoD,EAAAlD,OAAuBF,IAAAP,EAAA2D,EAAApD,IACvC,IAAAU,EAAA4C,EAIAxC","file":"runtime.13df06eb.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t1: 0\n \t};\n\n \tvar deferredModules = [];\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// 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, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\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 \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// run deferred modules from other chunks\n \tcheckDeferredModules();\n"],"sourceRoot":""} -------------------------------------------------------------------------------- /docs/demo.608d89c8.js: -------------------------------------------------------------------------------- 1 | (window.webpackJsonp=window.webpackJsonp||[]).push([[0],[function(e,t,n){"use strict";e.exports=n(36)},function(e,t,n){e.exports=n(101)()},function(e,t,n){"use strict";var r=n(11),o=n(20),a=n(21);e.exports=function(e){var t,n,l=e.space,i=e.mustUseProperty||[],u=e.attributes||{},s=e.properties,c=e.transform,f={},d={};for(t in s)n=new a(t,c(u,t),s[t],l),-1!==i.indexOf(t)&&(n.mustUseProperty=!0),f[t]=n,d[r(t)]=t,d[r(n.attribute)]=t;return new o(f,d,l)}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict"; 2 | /* 3 | object-assign 4 | (c) Sindre Sorhus 5 | @license MIT 6 | */var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,l,i=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),u=1;u0?r:n)(e)}},function(e,t,n){"use strict";e.exports=o;var r=o.prototype;function o(e,t,n){this.property=e,this.normal=t,n&&(this.space=n)}r.space=null,r.normal={},r.property={}},function(e,t,n){"use strict";var r=n(22),o=n(12);e.exports=i,i.prototype=new r,i.prototype.defined=!0;var a=["boolean","booleanish","overloadedBoolean","number","commaSeparated","spaceSeparated","commaOrSpaceSeparated"],l=a.length;function i(e,t,n,i){var s,c=-1;for(u(this,"space",i),r.call(this,e,t);++c=48&&t<=57}},function(e,t,n){"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=n(37)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(n(100));t.default=r.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={'code[class*="language-"]':{color:"black",background:"none",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"black",background:"#f5f2f0",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto"},'pre[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},':not(pre) > code[class*="language-"]':{background:"#f5f2f0",padding:".1em",borderRadius:".3em",whiteSpace:"normal"},comment:{color:"slategray"},prolog:{color:"slategray"},doctype:{color:"slategray"},cdata:{color:"slategray"},punctuation:{color:"#999"},".namespace":{Opacity:".7"},property:{color:"#905"},tag:{color:"#905"},boolean:{color:"#905"},number:{color:"#905"},constant:{color:"#905"},symbol:{color:"#905"},deleted:{color:"#905"},selector:{color:"#690"},"attr-name":{color:"#690"},string:{color:"#690"},char:{color:"#690"},builtin:{color:"#690"},inserted:{color:"#690"},operator:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},entity:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)",cursor:"help"},url:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".language-css .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".style .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},atrule:{color:"#07a"},"attr-value":{color:"#07a"},keyword:{color:"#07a"},function:{color:"#DD4A68"},"class-name":{color:"#DD4A68"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"bold"},variable:{color:"#e90"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}}},function(e,t,n){!function(e){"use strict";var t="4.12";function n(e){var t=e&&e.match(/^(\d)\.(\d+)/);return t&&{major:parseInt(t[1],10),minor:parseInt(t[2],10)}}function r(e){return void 0===e&&(e=t),"https://js.arcgis.com/"+e+"/"}function o(e){return!e||n(e)?function(e){void 0===e&&(e=t);var o=r(e),a=n(e);if(3===a.major){var l=a.minor<=10?"js/":"";return""+o+l+"esri/css/esri.css"}return o+"esri/css/main.css"}(e):e}function a(e,t){var n=o(e),r=function(e){return document.querySelector('link[href*="'+e+'"]')}(n);return r||function(e,t){if(t){var n=document.querySelector(t);n.parentNode.insertBefore(e,n)}else document.head.appendChild(e)}(r=function(e){var t=document.createElement("link");return t.rel="stylesheet",t.href=e,t}(n),t),r}var l={Promise:"undefined"!=typeof window?window.Promise:void 0};function i(e,t,n){var r;n&&(r=function(e,t){var n=function(r){t(r.error||new Error("There was an error attempting to load "+e.src)),e.removeEventListener("error",n,!1)};return e.addEventListener("error",n,!1),n}(e,n));var o=function(){t(e),e.removeEventListener("load",o,!1),r&&e.removeEventListener("error",r,!1)};e.addEventListener("load",o,!1)}function u(){return document.querySelector("script[data-esri-loader]")}function s(){var e=window.require;return e&&e.on}function c(e){void 0===e&&(e={});var t=e.version,n=e.url||r(t);return new l.Promise(function(r,o){var l=u();if(l){var c=l.getAttribute("src");c!==n?o(new Error("The ArcGIS API for JavaScript is already loaded ("+c+").")):s()?r(l):i(l,r,o)}else if(s())o(new Error("The ArcGIS API for JavaScript is already loaded."));else{var f=e.css;if(f){var d=!0===f;a(d?t:f,e.insertCssBefore)}e.dojoConfig&&(window.dojoConfig=e.dojoConfig),i(l=function(e){var t=document.createElement("script");return t.type="text/javascript",t.src=e,t.setAttribute("data-esri-loader","loading"),t}(n),function(){l.setAttribute("data-esri-loader","loaded"),r(l)},o),document.body.appendChild(l)}})}function f(e){return new l.Promise(function(t,n){var r=window.require.on("error",n);window.require(e,function(){for(var e=[],n=0;nl){for(var t=0,n=o.length-a;t-1};c.prototype.append=function(e,t){e=i(e),t=u(t);var n=this.map[e];this.map[e]=n?n+","+t:t},c.prototype.delete=function(e){delete this.map[i(e)]},c.prototype.get=function(e){return e=i(e),this.has(e)?this.map[e]:null},c.prototype.has=function(e){return this.map.hasOwnProperty(i(e))},c.prototype.set=function(e,t){this.map[i(e)]=u(t)},c.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},c.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),s(e)},c.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),s(e)},c.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),s(e)},t.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var a=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},m.call(g.prototype),m.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},v.error=function(){var e=new v(null,{status:0,statusText:""});return e.type="error",e};var l=[301,302,303,307,308];v.redirect=function(e,t){if(-1===l.indexOf(t))throw new RangeError("Invalid status code");return new v(null,{status:t,headers:{location:e}})},e.Headers=c,e.Request=g,e.Response=v,e.fetch=function(e,n){return new Promise(function(r,o){var a=new g(e,n),l=new XMLHttpRequest;l.onload=function(){var e={status:l.status,statusText:l.statusText,headers:function(e){var t=new c;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();t.append(r,o)}}),t}(l.getAllResponseHeaders()||"")};e.url="responseURL"in l?l.responseURL:e.headers.get("X-Request-URL");var t="response"in l?l.response:l.responseText;r(new v(t,e))},l.onerror=function(){o(new TypeError("Network request failed"))},l.ontimeout=function(){o(new TypeError("Network request failed"))},l.open(a.method,a.url,!0),"include"===a.credentials?l.withCredentials=!0:"omit"===a.credentials&&(l.withCredentials=!1),"responseType"in l&&t.blob&&(l.responseType="blob"),a.headers.forEach(function(e,t){l.setRequestHeader(t,e)}),l.send(void 0===a._bodyInit?null:a._bodyInit)})},e.fetch.polyfill=!0}function i(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function u(e){return"string"!=typeof e&&(e=String(e)),e}function s(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t.iterable&&(n[Symbol.iterator]=function(){return n}),n}function c(e){this.map={},e instanceof c?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function d(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function p(e){var t=new FileReader,n=d(t);return t.readAsArrayBuffer(e),n}function h(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(t.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(t.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(t.arrayBuffer&&t.blob&&r(e))this._bodyArrayBuffer=h(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!t.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e)&&!o(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=h(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},t.blob&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=d(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function y(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}}),t}function v(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new c(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:this)},function(e,t,n){"use strict"; 7 | /** @license React v16.9.0 8 | * react.production.min.js 9 | * 10 | * Copyright (c) Facebook, Inc. and its affiliates. 11 | * 12 | * This source code is licensed under the MIT license found in the 13 | * LICENSE file in the root directory of this source tree. 14 | */var r=n(4),o="function"==typeof Symbol&&Symbol.for,a=o?Symbol.for("react.element"):60103,l=o?Symbol.for("react.portal"):60106,i=o?Symbol.for("react.fragment"):60107,u=o?Symbol.for("react.strict_mode"):60108,s=o?Symbol.for("react.profiler"):60114,c=o?Symbol.for("react.provider"):60109,f=o?Symbol.for("react.context"):60110,d=o?Symbol.for("react.forward_ref"):60112,p=o?Symbol.for("react.suspense"):60113,h=o?Symbol.for("react.suspense_list"):60120,m=o?Symbol.for("react.memo"):60115,g=o?Symbol.for("react.lazy"):60116;o&&Symbol.for("react.fundamental"),o&&Symbol.for("react.responder");var y="function"==typeof Symbol&&Symbol.iterator;function v(e){for(var t=e.message,n="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;rM.length&&M.push(e)}function z(e,t,n){return null==e?0:function e(t,n,r,o){var i=typeof t;"undefined"!==i&&"boolean"!==i||(t=null);var u=!1;if(null===t)u=!0;else switch(i){case"string":case"number":u=!0;break;case"object":switch(t.$$typeof){case a:case l:u=!0}}if(u)return r(o,t,""===n?"."+L(t,0):n),1;if(u=0,n=""===n?".":n+":",Array.isArray(t))for(var s=0;sthis.eventPool.length&&this.eventPool.push(e)}function fe(e){e.eventPool=[],e.getPooled=se,e.release=ce}o(ue.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=le)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=le)},persist:function(){this.isPersistent=le},isPersistent:ie,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=ie,this._dispatchInstances=this._dispatchListeners=null}}),ue.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},ue.extend=function(e){function t(){}function n(){return r.apply(this,arguments)}var r=this;t.prototype=r.prototype;var a=new t;return o(a,n.prototype),n.prototype=a,n.prototype.constructor=n,n.Interface=o({},r.Interface,e),n.extend=r.extend,fe(n),n},fe(ue);var de=ue.extend({data:null}),pe=ue.extend({data:null}),he=[9,13,27,32],me=V&&"CompositionEvent"in window,ge=null;V&&"documentMode"in document&&(ge=document.documentMode);var ye=V&&"TextEvent"in window&&!ge,ve=V&&(!me||ge&&8=ge),be=String.fromCharCode(32),we={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},xe=!1;function ke(e,t){switch(e){case"keyup":return-1!==he.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function Ee(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var _e=!1;var Se={eventTypes:we,extractEvents:function(e,t,n,r){var o=void 0,a=void 0;if(me)e:{switch(e){case"compositionstart":o=we.compositionStart;break e;case"compositionend":o=we.compositionEnd;break e;case"compositionupdate":o=we.compositionUpdate;break e}o=void 0}else _e?ke(e,n)&&(o=we.compositionEnd):"keydown"===e&&229===n.keyCode&&(o=we.compositionStart);return o?(ve&&"ko"!==n.locale&&(_e||o!==we.compositionStart?o===we.compositionEnd&&_e&&(a=ae()):(re="value"in(ne=r)?ne.value:ne.textContent,_e=!0)),o=de.getPooled(o,t,n,r),a?o.data=a:null!==(a=Ee(n))&&(o.data=a),W(o),a=o):a=null,(e=ye?function(e,t){switch(e){case"compositionend":return Ee(t);case"keypress":return 32!==t.which?null:(xe=!0,be);case"textInput":return(e=t.data)===be&&xe?null:e;default:return null}}(e,n):function(e,t){if(_e)return"compositionend"===e||!me&&ke(e,t)?(e=ae(),oe=re=ne=null,_e=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1