From b4fd8adc9954b0bd1a3e44307f040fc1a331c6e0 Mon Sep 17 00:00:00 2001 From: JserWang Date: Mon, 21 Jan 2019 17:21:48 +0800 Subject: [PATCH] Release 1.0.0 (#82) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * change proj directory * import third part libs from nodemodules * feat: add name props for map * refactor: map、contextmenu * refactor: add placeholder, adjust directory * fix: when map mounted only send the map instance to users * chore: rename mapMounted => mounted * chore: process contextmenu item iconUrl * refactor: custom control * fix: just process different config in lifecycle componentDidUpdate * refactor: custom control * fix: process map center error * refactor: cityList and copyright * chore: make the most of the extends * refactor: other controls * chore: adjust control extends * refactor: custom overlay * refactor: marker, fix (#71) * chore: move firstLowerCase to Util * refactor: remove the constructor of the control subclasses * refactor: adjust marker and circle * refactor: adjust the implementation of placeholder * chore: adjust the internal implementation of control * refactor: label、polygon、boundary、marker、infowindow * chore: update README * fix: unknown character * fix: unknown character * refactor: polyline * fix: adapt to win * chore: pre release 1.0.0 * feat: add util methods * fix: if the ContextMenu's children is undefined. * fix: in react 15.4.2 the children should be a valid React element (or null) * style: placeholder default style * fix: in react 15.4.2 the children should be a valid React element (or null) * refactor: prompt when assigning undefined to Events * fix: RegeneratorRuntime is not defined when the project does not reference babel-polyfill * release 1.0.0 * release 1.0.0 --- .babelrc | 4 +- .eslintrc | 9 +- .gitignore | 18 +- README.md | 73 +- dist/rc-bmap.min.js | 1 - docs/.vuepress/config.js | 85 - docs/.vuepress/public/favicon.ico | Bin 4286 -> 0 bytes docs/.vuepress/public/home.png | Bin 7218 -> 0 bytes docs/README.md | 25 - docs/api/README.md | 113 - docs/api/autocomplete.md | 36 - docs/api/boundary.md | 90 - docs/api/busLineSearch.md | 55 - docs/api/circle.md | 84 - docs/api/cityList.md | 25 - docs/api/copyright.md | 19 - docs/api/curveLine.md | 57 - docs/api/distanceTool.md | 54 - docs/api/drawingmanager.md | 76 - docs/api/drivingRoute.md | 49 - docs/api/geolocation.md | 42 - docs/api/ground.md | 42 - docs/api/heatmap.md | 31 - docs/api/infowindow.md | 83 - docs/api/label.md | 60 - docs/api/localSearch.md | 49 - docs/api/map.md | 214 - docs/api/mapTypeCtrl.md | 25 - docs/api/marker.md | 95 - docs/api/markerClusterer.md | 31 - docs/api/navigation.md | 31 - docs/api/overviewMap.md | 36 - docs/api/panorama.md | 13 - docs/api/pointcollection.md | 37 - docs/api/polygon.md | 78 - docs/api/polyline.md | 72 - docs/api/ridingRoute.md | 49 - docs/api/scale.md | 19 - docs/api/symbol.md | 57 - docs/api/tile.md | 31 - docs/api/trafficControl.md | 7 - docs/api/transitRoute.md | 73 - docs/api/walkingRoute.md | 49 - docs/guide/README.md | 107 - docs/guide/constants.md | 164 - docs/guide/control.md | 444 -- docs/guide/getting-started.md | 33 - docs/guide/lib.md | 419 - docs/guide/map.md | 266 - docs/guide/other.md | 109 - docs/guide/overlay.md | 607 -- docs/guide/question.md | 9 - docs/guide/route.md | 272 - examples/.babelrc | 13 - examples/.eslintrc | 18 - examples/config/webpack.common.js | 81 - examples/config/webpack.dev.js | 22 - examples/config/webpack.prod.js | 62 - examples/index.html | 10 - examples/index.js | 8 - examples/package.json | 49 - examples/src/App.js | 50 - examples/src/app.css | 3 - examples/src/components/Container/index.js | 26 - examples/src/control/cityList/index.js | 72 - examples/src/control/cityList/index.md | 70 - examples/src/control/copyright/index.js | 72 - examples/src/control/copyright/index.md | 70 - examples/src/control/geolocation/index.js | 112 - examples/src/control/geolocation/index.md | 110 - examples/src/control/mapTypeCtrl/index.js | 88 - examples/src/control/mapTypeCtrl/index.md | 86 - examples/src/control/navigation/index.js | 94 - examples/src/control/navigation/index.md | 96 - examples/src/control/overviewMap/index.js | 101 - examples/src/control/overviewMap/index.md | 99 - examples/src/control/panorama/index.js | 62 - examples/src/control/panorama/index.md | 60 - examples/src/control/scale/index.js | 75 - examples/src/control/scale/index.md | 73 - examples/src/lib/curveLine/index.js | 112 - examples/src/lib/curveLine/index.md | 109 - examples/src/lib/distanceTool/index.js | 132 - examples/src/lib/distanceTool/index.md | 130 - examples/src/lib/drawingManager/index.js | 111 - examples/src/lib/drawingManager/index.md | 109 - examples/src/lib/heatmap/index.js | 194 - examples/src/lib/heatmap/index.md | 192 - examples/src/lib/markerClusterer/index.js | 263 - examples/src/lib/markerClusterer/index.md | 263 - examples/src/lib/trafficControl/index.js | 44 - examples/src/lib/trafficControl/index.md | 42 - examples/src/map/index.js | 218 - examples/src/map/index.md | 216 - examples/src/menuData.js | 164 - examples/src/other/autoComplete/index.js | 69 - examples/src/other/autoComplete/index.md | 66 - examples/src/other/tile/index.js | 73 - examples/src/other/tile/index.md | 71 - examples/src/overlay/boundary/index.js | 200 - examples/src/overlay/boundary/index.md | 198 - examples/src/overlay/circle/index.js | 185 - examples/src/overlay/circle/index.md | 183 - examples/src/overlay/ground/index.js | 133 - examples/src/overlay/ground/index.md | 129 - examples/src/overlay/infoWindow/index.js | 197 - examples/src/overlay/infoWindow/index.md | 195 - examples/src/overlay/label/index.js | 134 - examples/src/overlay/label/index.md | 132 - examples/src/overlay/marker/index.js | 215 - examples/src/overlay/marker/index.md | 213 - examples/src/overlay/pointCollection/index.js | 121 - examples/src/overlay/pointCollection/index.md | 119 - examples/src/overlay/polygon/index.js | 196 - examples/src/overlay/polygon/index.md | 194 - examples/src/overlay/polyline/index.js | 196 - examples/src/overlay/polyline/index.md | 196 - examples/src/overlay/symbol/index.js | 152 - examples/src/overlay/symbol/index.md | 150 - examples/src/router.js | 81 - examples/src/service/busLineSearch/index.js | 88 - examples/src/service/busLineSearch/index.md | 86 - examples/src/service/drivingRoute/index.js | 79 - examples/src/service/drivingRoute/index.md | 78 - examples/src/service/localSearch/index.js | 93 - examples/src/service/localSearch/index.md | 91 - examples/src/service/ridingRoute/index.js | 51 - examples/src/service/ridingRoute/index.md | 51 - examples/src/service/transitRoute/index.js | 67 - examples/src/service/transitRoute/index.md | 65 - examples/src/service/walkingRoute/index.js | 51 - examples/src/service/walkingRoute/index.md | 49 - examples/src/util/index.js | 58 - examples/yarn.lock | 6999 ----------------- lib/components/AutoComplete/index.js | 73 - lib/components/Control/BaseControl.js | 55 - lib/components/Control/CityList.js | 72 - lib/components/Control/Copyright.js | 74 - lib/components/Control/Geolocation.js | 81 - lib/components/Control/MapType.js | 86 - lib/components/Control/Navigation.js | 81 - lib/components/Control/OverviewMap.js | 79 - lib/components/Control/Panorama.js | 68 - lib/components/Control/Scale.js | 75 - lib/components/Control/index.js | 84 - lib/components/Layers/Tile.js | 97 - lib/components/Lib/CurveLine.js | 103 - lib/components/Lib/DistanceTool.js | 62 - lib/components/Lib/DrawingManager.js | 107 - lib/components/Lib/Heatmap.js | 83 - lib/components/Lib/MarkerClusterer.js | 89 - lib/components/Lib/TrafficControl.js | 65 - lib/components/Map/index.js | 273 - lib/components/Overlay/BaseOverlay.js | 64 - lib/components/Overlay/Boundary.js | 104 - lib/components/Overlay/Circle.js | 84 - lib/components/Overlay/Ground.js | 67 - lib/components/Overlay/InfoWindow.js | 80 - lib/components/Overlay/Label.js | 49 - lib/components/Overlay/Marker.js | 57 - lib/components/Overlay/PointCollection.js | 77 - lib/components/Overlay/Polygon.js | 59 - lib/components/Overlay/Polyline.js | 89 - lib/components/Overlay/Symbol.js | 85 - lib/components/Overlay/index.js | 89 - lib/components/ReactComponent/index.js | 65 - lib/components/Service/BaseService.js | 38 - lib/components/Service/BusLineSearch.js | 81 - lib/components/Service/DrivingRoute.js | 79 - lib/components/Service/LocalSearch.js | 79 - lib/components/Service/RidingRoute.js | 77 - lib/components/Service/TransitRoute.js | 87 - lib/components/Service/WalkingRoute.js | 77 - lib/components/_base/events.js | 34 - lib/components/_base/options.js | 18 - lib/components/_base/util.js | 388 - lib/constants/Animation.js | 9 - lib/constants/ContextMenuIcon.js | 9 - lib/constants/ControlAnchor.js | 11 - lib/constants/DrawingMode.js | 12 - lib/constants/DrivingPolicy.js | 11 - lib/constants/IntercityPolicy.js | 10 - lib/constants/LengthUnit.js | 9 - lib/constants/MapPane.js | 14 - lib/constants/MapType.js | 11 - lib/constants/MapTypeControlType.js | 10 - lib/constants/NavigationType.js | 11 - lib/constants/ShapeType.js | 12 - lib/constants/SizeType.js | 14 - lib/constants/StatusCode.js | 10 - lib/constants/SymbolShapeType.js | 21 - lib/constants/TransitPolicy.js | 13 - lib/constants/TransitTypePolicy.js | 10 - lib/index.js | 511 -- lib/libs/DistanceTool.js | 1766 ----- lib/libs/DrawingManager.js | 1618 ---- lib/libs/TrafficControl.js | 1134 --- package.json | 32 +- src/components/AutoComplete/index.js | 75 +- src/components/Base/Bounds.js | 13 + src/components/Base/Common.js | 57 + src/components/Base/Events.js | 10 + src/components/Base/Path.js | 83 + src/components/Base/Point.js | 56 + src/components/Base/Size.js | 12 + src/components/Base/index.js | 17 + src/components/ContextMenu/Item.js | 78 + src/components/ContextMenu/index.js | 90 + src/components/Control/BaseControl.js | 68 +- src/components/Control/CityList.js | 32 +- src/components/Control/Copyright.js | 33 - src/components/Control/CopyrightControl.js | 65 + src/components/Control/Custom.js | 43 + src/components/Control/Geolocation.js | 34 +- src/components/Control/MapType.js | 31 +- src/components/Control/Navigation.js | 30 +- src/components/Control/OverviewMap.js | 32 +- src/components/Control/Panorama.js | 23 +- src/components/Control/Scale.js | 26 +- src/components/Control/index.js | 45 - src/components/Copyright/index.js | 52 + src/components/Layer/TileLayer.js | 36 + src/components/Layer/TrafficLayer.js | 36 + src/components/Layers/Tile.js | 67 - src/components/Lib/CurveLine.js | 57 - src/components/Lib/DistanceTool.js | 24 - src/components/Lib/DrawingManager.js | 64 - src/components/Lib/Heatmap.js | 43 - src/components/Lib/MarkerClusterer.js | 46 - src/components/Lib/TrafficControl.js | 30 - src/components/Map/PlaceHolder.js | 18 + src/components/Map/index.js | 299 +- src/components/Overlay/BaseOverlay.js | 74 +- src/components/Overlay/Boundary.js | 119 +- src/components/Overlay/Circle.js | 41 +- src/components/Overlay/Custom.js | 54 + src/components/Overlay/Ground.js | 27 +- src/components/Overlay/HTMLComponent.js | 55 + src/components/Overlay/InfoWindow.js | 41 - src/components/Overlay/InfoWindow/Content.js | 7 + .../Overlay/InfoWindow/MaxContent.js | 7 + src/components/Overlay/InfoWindow/Title.js | 7 + src/components/Overlay/InfoWindow/index.js | 17 + src/components/Overlay/Label.js | 13 - src/components/Overlay/Label/Content.js | 7 + src/components/Overlay/Label/index.js | 44 + src/components/Overlay/Marker.js | 24 - src/components/Overlay/Marker/Icon.js | 54 + src/components/Overlay/Marker/index.js | 23 + src/components/Overlay/PointCollection.js | 35 +- src/components/Overlay/Polygon.js | 17 +- src/components/Overlay/Polyline.js | 47 - .../Overlay/Polyline/IconSequence.js | 56 + src/components/Overlay/Polyline/index.js | 11 + src/components/Overlay/Symbol.js | 91 +- src/components/Overlay/index.js | 47 - src/components/ReactComponent/index.js | 35 - src/components/Service/BaseService.js | 19 - src/components/Service/BusLineSearch.js | 42 - src/components/Service/DrivingRoute.js | 40 - src/components/Service/LocalSearch.js | 40 - src/components/Service/RidingRoute.js | 38 - src/components/Service/TransitRoute.js | 48 - src/components/Service/WalkingRoute.js | 38 - src/components/_base/events.js | 148 - src/components/_base/options.js | 48 - src/components/_base/util.js | 308 - src/constants/Animation.js | 4 - src/constants/ContextMenuIcon.js | 4 - src/constants/ControlAnchor.js | 6 - src/constants/DrawingMode.js | 7 - src/constants/DrivingPolicy.js | 6 - src/constants/IntercityPolicy.js | 5 - src/constants/LengthUnit.js | 4 - src/constants/MapPane.js | 9 - src/constants/MapType.js | 6 - src/constants/MapTypeControlType.js | 5 - src/constants/NavigationType.js | 6 - src/constants/ShapeType.js | 7 - src/constants/SizeType.js | 9 - src/constants/StatusCode.js | 5 - src/constants/SymbolShapeType.js | 16 - src/constants/TransitPolicy.js | 8 - src/constants/TransitTypePolicy.js | 5 - src/core/AutoComplete/index.js | 72 + src/core/Control/BaseControl.js | 37 + src/core/Control/CityList.js | 21 + src/core/Control/Copyright.js | 15 + src/core/Control/Custom.js | 54 + src/core/Control/Geolocation.js | 16 + src/core/Control/MapType.js | 21 + src/core/Control/Navigation.js | 19 + src/core/Control/OverviewMap.js | 21 + src/core/Control/Panorama.js | 11 + src/core/Control/Scale.js | 19 + src/core/Layer/TileLayer.js | 36 + src/core/Layer/TrafficLayer.js | 41 + src/core/Map/index.js | 112 + src/core/Overlay/BaseOverlay.js | 43 + src/core/Overlay/Circle.js | 37 + src/core/Overlay/Custom.js | 46 + src/core/Overlay/GroundOverlay.js | 30 + src/core/Overlay/Icon.js | 45 + src/core/Overlay/IconSequence.js | 13 + src/core/Overlay/InfoWindow.js | 47 + src/core/Overlay/Label.js | 37 + src/core/Overlay/Marker.js | 59 + src/core/Overlay/PointCollection.js | 37 + src/core/Overlay/Polygon.js | 40 + src/core/Overlay/Polyline.js | 39 + src/core/Overlay/Symbol.js | 25 + src/core/constants/index.js | 177 + src/core/index.js | 82 + src/core/options/autoComplete.js | 7 + src/core/options/circle.js | 16 + src/core/options/ground.js | 9 + src/core/options/infoWindow.js | 13 + src/core/options/label.js | 13 + src/core/options/map.js | 22 + src/core/options/marker.js | 16 + src/core/options/polygon.js | 15 + src/core/options/polyline.js | 13 + src/core/options/symbol.js | 13 + src/core/utils/index.js | 285 + src/core/utils/map.js | 199 + src/index.js | 67 +- src/libs/DistanceTool.js | 1795 ----- src/libs/DrawingManager.js | 1641 ---- src/libs/TrafficControl.js | 1132 --- types/autoComplete.d.ts | 33 - types/base/common.d.ts | 75 - types/base/constants.d.ts | 89 - types/base/events.d.ts | 127 - types/boundary.d.ts | 62 - types/busLineSearch.d.ts | 47 - types/circle.d.ts | 58 - types/cityList.d.ts | 26 - types/copyright.d.ts | 22 - types/curveLine.d.ts | 46 - types/distanceTool.d.ts | 42 - types/drawingManager.d.ts | 43 - types/drivingRoute.d.ts | 48 - types/geolocation.d.ts | 35 - types/ground.d.ts | 34 - types/heatmap.d.ts | 30 - types/index.d.ts | 58 - types/infoWindow.d.ts | 58 - types/label.d.ts | 42 - types/localSearch.d.ts | 43 - types/map.d.ts | 103 - types/mapTypeCtrl.d.ts | 26 - types/marker.d.ts | 57 - types/markerClusterer.d.ts | 29 - types/navigation.d.ts | 30 - types/overviewMap.d.ts | 31 - types/panorama.d.ts | 18 - types/pointCollection.d.ts | 31 - types/polygon.d.ts | 54 - types/polyline.d.ts | 50 - types/ridingRoute.d.ts | 43 - types/scale.d.ts | 22 - types/symbol.d.ts | 46 - types/tile.d.ts | 29 - types/trafficControl.d.ts | 13 - types/transitRoute.d.ts | 60 - types/tsconfig.json | 12 - types/typings.json | 4 - types/walkingRoute.d.ts | 43 - webpack.config.js | 54 - yarn.lock | 22 +- 370 files changed, 3355 insertions(+), 37611 deletions(-) delete mode 100644 dist/rc-bmap.min.js delete mode 100644 docs/.vuepress/config.js delete mode 100644 docs/.vuepress/public/favicon.ico delete mode 100644 docs/.vuepress/public/home.png delete mode 100644 docs/README.md delete mode 100644 docs/api/README.md delete mode 100644 docs/api/autocomplete.md delete mode 100644 docs/api/boundary.md delete mode 100644 docs/api/busLineSearch.md delete mode 100644 docs/api/circle.md delete mode 100644 docs/api/cityList.md delete mode 100644 docs/api/copyright.md delete mode 100644 docs/api/curveLine.md delete mode 100644 docs/api/distanceTool.md delete mode 100644 docs/api/drawingmanager.md delete mode 100644 docs/api/drivingRoute.md delete mode 100644 docs/api/geolocation.md delete mode 100644 docs/api/ground.md delete mode 100644 docs/api/heatmap.md delete mode 100644 docs/api/infowindow.md delete mode 100644 docs/api/label.md delete mode 100644 docs/api/localSearch.md delete mode 100644 docs/api/map.md delete mode 100644 docs/api/mapTypeCtrl.md delete mode 100644 docs/api/marker.md delete mode 100644 docs/api/markerClusterer.md delete mode 100644 docs/api/navigation.md delete mode 100644 docs/api/overviewMap.md delete mode 100644 docs/api/panorama.md delete mode 100644 docs/api/pointcollection.md delete mode 100644 docs/api/polygon.md delete mode 100644 docs/api/polyline.md delete mode 100644 docs/api/ridingRoute.md delete mode 100644 docs/api/scale.md delete mode 100644 docs/api/symbol.md delete mode 100644 docs/api/tile.md delete mode 100644 docs/api/trafficControl.md delete mode 100644 docs/api/transitRoute.md delete mode 100644 docs/api/walkingRoute.md delete mode 100644 docs/guide/README.md delete mode 100644 docs/guide/constants.md delete mode 100644 docs/guide/control.md delete mode 100644 docs/guide/getting-started.md delete mode 100644 docs/guide/lib.md delete mode 100644 docs/guide/map.md delete mode 100644 docs/guide/other.md delete mode 100644 docs/guide/overlay.md delete mode 100644 docs/guide/question.md delete mode 100644 docs/guide/route.md delete mode 100644 examples/.babelrc delete mode 100644 examples/.eslintrc delete mode 100644 examples/config/webpack.common.js delete mode 100644 examples/config/webpack.dev.js delete mode 100644 examples/config/webpack.prod.js delete mode 100644 examples/index.html delete mode 100644 examples/index.js delete mode 100644 examples/package.json delete mode 100644 examples/src/App.js delete mode 100644 examples/src/app.css delete mode 100644 examples/src/components/Container/index.js delete mode 100644 examples/src/control/cityList/index.js delete mode 100644 examples/src/control/cityList/index.md delete mode 100644 examples/src/control/copyright/index.js delete mode 100644 examples/src/control/copyright/index.md delete mode 100644 examples/src/control/geolocation/index.js delete mode 100644 examples/src/control/geolocation/index.md delete mode 100644 examples/src/control/mapTypeCtrl/index.js delete mode 100644 examples/src/control/mapTypeCtrl/index.md delete mode 100644 examples/src/control/navigation/index.js delete mode 100644 examples/src/control/navigation/index.md delete mode 100644 examples/src/control/overviewMap/index.js delete mode 100644 examples/src/control/overviewMap/index.md delete mode 100644 examples/src/control/panorama/index.js delete mode 100644 examples/src/control/panorama/index.md delete mode 100644 examples/src/control/scale/index.js delete mode 100644 examples/src/control/scale/index.md delete mode 100644 examples/src/lib/curveLine/index.js delete mode 100644 examples/src/lib/curveLine/index.md delete mode 100644 examples/src/lib/distanceTool/index.js delete mode 100644 examples/src/lib/distanceTool/index.md delete mode 100644 examples/src/lib/drawingManager/index.js delete mode 100644 examples/src/lib/drawingManager/index.md delete mode 100644 examples/src/lib/heatmap/index.js delete mode 100644 examples/src/lib/heatmap/index.md delete mode 100644 examples/src/lib/markerClusterer/index.js delete mode 100644 examples/src/lib/markerClusterer/index.md delete mode 100644 examples/src/lib/trafficControl/index.js delete mode 100644 examples/src/lib/trafficControl/index.md delete mode 100644 examples/src/map/index.js delete mode 100644 examples/src/map/index.md delete mode 100644 examples/src/menuData.js delete mode 100644 examples/src/other/autoComplete/index.js delete mode 100644 examples/src/other/autoComplete/index.md delete mode 100644 examples/src/other/tile/index.js delete mode 100644 examples/src/other/tile/index.md delete mode 100644 examples/src/overlay/boundary/index.js delete mode 100644 examples/src/overlay/boundary/index.md delete mode 100644 examples/src/overlay/circle/index.js delete mode 100644 examples/src/overlay/circle/index.md delete mode 100644 examples/src/overlay/ground/index.js delete mode 100644 examples/src/overlay/ground/index.md delete mode 100644 examples/src/overlay/infoWindow/index.js delete mode 100644 examples/src/overlay/infoWindow/index.md delete mode 100644 examples/src/overlay/label/index.js delete mode 100644 examples/src/overlay/label/index.md delete mode 100644 examples/src/overlay/marker/index.js delete mode 100644 examples/src/overlay/marker/index.md delete mode 100644 examples/src/overlay/pointCollection/index.js delete mode 100644 examples/src/overlay/pointCollection/index.md delete mode 100644 examples/src/overlay/polygon/index.js delete mode 100644 examples/src/overlay/polygon/index.md delete mode 100644 examples/src/overlay/polyline/index.js delete mode 100644 examples/src/overlay/polyline/index.md delete mode 100644 examples/src/overlay/symbol/index.js delete mode 100644 examples/src/overlay/symbol/index.md delete mode 100644 examples/src/router.js delete mode 100644 examples/src/service/busLineSearch/index.js delete mode 100644 examples/src/service/busLineSearch/index.md delete mode 100644 examples/src/service/drivingRoute/index.js delete mode 100644 examples/src/service/drivingRoute/index.md delete mode 100644 examples/src/service/localSearch/index.js delete mode 100644 examples/src/service/localSearch/index.md delete mode 100644 examples/src/service/ridingRoute/index.js delete mode 100644 examples/src/service/ridingRoute/index.md delete mode 100644 examples/src/service/transitRoute/index.js delete mode 100644 examples/src/service/transitRoute/index.md delete mode 100644 examples/src/service/walkingRoute/index.js delete mode 100644 examples/src/service/walkingRoute/index.md delete mode 100644 examples/src/util/index.js delete mode 100644 examples/yarn.lock delete mode 100644 lib/components/AutoComplete/index.js delete mode 100644 lib/components/Control/BaseControl.js delete mode 100644 lib/components/Control/CityList.js delete mode 100644 lib/components/Control/Copyright.js delete mode 100644 lib/components/Control/Geolocation.js delete mode 100644 lib/components/Control/MapType.js delete mode 100644 lib/components/Control/Navigation.js delete mode 100644 lib/components/Control/OverviewMap.js delete mode 100644 lib/components/Control/Panorama.js delete mode 100644 lib/components/Control/Scale.js delete mode 100644 lib/components/Control/index.js delete mode 100644 lib/components/Layers/Tile.js delete mode 100644 lib/components/Lib/CurveLine.js delete mode 100644 lib/components/Lib/DistanceTool.js delete mode 100644 lib/components/Lib/DrawingManager.js delete mode 100644 lib/components/Lib/Heatmap.js delete mode 100644 lib/components/Lib/MarkerClusterer.js delete mode 100644 lib/components/Lib/TrafficControl.js delete mode 100644 lib/components/Map/index.js delete mode 100644 lib/components/Overlay/BaseOverlay.js delete mode 100644 lib/components/Overlay/Boundary.js delete mode 100644 lib/components/Overlay/Circle.js delete mode 100644 lib/components/Overlay/Ground.js delete mode 100644 lib/components/Overlay/InfoWindow.js delete mode 100644 lib/components/Overlay/Label.js delete mode 100644 lib/components/Overlay/Marker.js delete mode 100644 lib/components/Overlay/PointCollection.js delete mode 100644 lib/components/Overlay/Polygon.js delete mode 100644 lib/components/Overlay/Polyline.js delete mode 100644 lib/components/Overlay/Symbol.js delete mode 100644 lib/components/Overlay/index.js delete mode 100644 lib/components/ReactComponent/index.js delete mode 100644 lib/components/Service/BaseService.js delete mode 100644 lib/components/Service/BusLineSearch.js delete mode 100644 lib/components/Service/DrivingRoute.js delete mode 100644 lib/components/Service/LocalSearch.js delete mode 100644 lib/components/Service/RidingRoute.js delete mode 100644 lib/components/Service/TransitRoute.js delete mode 100644 lib/components/Service/WalkingRoute.js delete mode 100644 lib/components/_base/events.js delete mode 100644 lib/components/_base/options.js delete mode 100644 lib/components/_base/util.js delete mode 100644 lib/constants/Animation.js delete mode 100644 lib/constants/ContextMenuIcon.js delete mode 100644 lib/constants/ControlAnchor.js delete mode 100644 lib/constants/DrawingMode.js delete mode 100644 lib/constants/DrivingPolicy.js delete mode 100644 lib/constants/IntercityPolicy.js delete mode 100644 lib/constants/LengthUnit.js delete mode 100644 lib/constants/MapPane.js delete mode 100644 lib/constants/MapType.js delete mode 100644 lib/constants/MapTypeControlType.js delete mode 100644 lib/constants/NavigationType.js delete mode 100644 lib/constants/ShapeType.js delete mode 100644 lib/constants/SizeType.js delete mode 100644 lib/constants/StatusCode.js delete mode 100644 lib/constants/SymbolShapeType.js delete mode 100644 lib/constants/TransitPolicy.js delete mode 100644 lib/constants/TransitTypePolicy.js delete mode 100644 lib/index.js delete mode 100644 lib/libs/DistanceTool.js delete mode 100644 lib/libs/DrawingManager.js delete mode 100644 lib/libs/TrafficControl.js create mode 100644 src/components/Base/Bounds.js create mode 100644 src/components/Base/Common.js create mode 100644 src/components/Base/Events.js create mode 100644 src/components/Base/Path.js create mode 100644 src/components/Base/Point.js create mode 100644 src/components/Base/Size.js create mode 100644 src/components/Base/index.js create mode 100644 src/components/ContextMenu/Item.js create mode 100644 src/components/ContextMenu/index.js delete mode 100644 src/components/Control/Copyright.js create mode 100644 src/components/Control/CopyrightControl.js create mode 100644 src/components/Control/Custom.js delete mode 100644 src/components/Control/index.js create mode 100644 src/components/Copyright/index.js create mode 100644 src/components/Layer/TileLayer.js create mode 100644 src/components/Layer/TrafficLayer.js delete mode 100644 src/components/Layers/Tile.js delete mode 100644 src/components/Lib/CurveLine.js delete mode 100644 src/components/Lib/DistanceTool.js delete mode 100644 src/components/Lib/DrawingManager.js delete mode 100644 src/components/Lib/Heatmap.js delete mode 100644 src/components/Lib/MarkerClusterer.js delete mode 100644 src/components/Lib/TrafficControl.js create mode 100644 src/components/Map/PlaceHolder.js create mode 100644 src/components/Overlay/Custom.js create mode 100644 src/components/Overlay/HTMLComponent.js delete mode 100644 src/components/Overlay/InfoWindow.js create mode 100644 src/components/Overlay/InfoWindow/Content.js create mode 100644 src/components/Overlay/InfoWindow/MaxContent.js create mode 100644 src/components/Overlay/InfoWindow/Title.js create mode 100644 src/components/Overlay/InfoWindow/index.js delete mode 100644 src/components/Overlay/Label.js create mode 100644 src/components/Overlay/Label/Content.js create mode 100644 src/components/Overlay/Label/index.js delete mode 100644 src/components/Overlay/Marker.js create mode 100644 src/components/Overlay/Marker/Icon.js create mode 100644 src/components/Overlay/Marker/index.js delete mode 100644 src/components/Overlay/Polyline.js create mode 100644 src/components/Overlay/Polyline/IconSequence.js create mode 100644 src/components/Overlay/Polyline/index.js delete mode 100644 src/components/Overlay/index.js delete mode 100644 src/components/ReactComponent/index.js delete mode 100644 src/components/Service/BaseService.js delete mode 100644 src/components/Service/BusLineSearch.js delete mode 100644 src/components/Service/DrivingRoute.js delete mode 100644 src/components/Service/LocalSearch.js delete mode 100644 src/components/Service/RidingRoute.js delete mode 100644 src/components/Service/TransitRoute.js delete mode 100644 src/components/Service/WalkingRoute.js delete mode 100644 src/components/_base/events.js delete mode 100644 src/components/_base/options.js delete mode 100644 src/components/_base/util.js delete mode 100644 src/constants/Animation.js delete mode 100644 src/constants/ContextMenuIcon.js delete mode 100644 src/constants/ControlAnchor.js delete mode 100644 src/constants/DrawingMode.js delete mode 100644 src/constants/DrivingPolicy.js delete mode 100644 src/constants/IntercityPolicy.js delete mode 100644 src/constants/LengthUnit.js delete mode 100644 src/constants/MapPane.js delete mode 100644 src/constants/MapType.js delete mode 100644 src/constants/MapTypeControlType.js delete mode 100644 src/constants/NavigationType.js delete mode 100644 src/constants/ShapeType.js delete mode 100644 src/constants/SizeType.js delete mode 100644 src/constants/StatusCode.js delete mode 100644 src/constants/SymbolShapeType.js delete mode 100644 src/constants/TransitPolicy.js delete mode 100644 src/constants/TransitTypePolicy.js create mode 100644 src/core/AutoComplete/index.js create mode 100644 src/core/Control/BaseControl.js create mode 100644 src/core/Control/CityList.js create mode 100644 src/core/Control/Copyright.js create mode 100644 src/core/Control/Custom.js create mode 100644 src/core/Control/Geolocation.js create mode 100644 src/core/Control/MapType.js create mode 100644 src/core/Control/Navigation.js create mode 100644 src/core/Control/OverviewMap.js create mode 100644 src/core/Control/Panorama.js create mode 100644 src/core/Control/Scale.js create mode 100644 src/core/Layer/TileLayer.js create mode 100644 src/core/Layer/TrafficLayer.js create mode 100644 src/core/Map/index.js create mode 100644 src/core/Overlay/BaseOverlay.js create mode 100644 src/core/Overlay/Circle.js create mode 100644 src/core/Overlay/Custom.js create mode 100644 src/core/Overlay/GroundOverlay.js create mode 100644 src/core/Overlay/Icon.js create mode 100644 src/core/Overlay/IconSequence.js create mode 100644 src/core/Overlay/InfoWindow.js create mode 100644 src/core/Overlay/Label.js create mode 100644 src/core/Overlay/Marker.js create mode 100644 src/core/Overlay/PointCollection.js create mode 100644 src/core/Overlay/Polygon.js create mode 100644 src/core/Overlay/Polyline.js create mode 100644 src/core/Overlay/Symbol.js create mode 100644 src/core/constants/index.js create mode 100644 src/core/index.js create mode 100644 src/core/options/autoComplete.js create mode 100644 src/core/options/circle.js create mode 100644 src/core/options/ground.js create mode 100644 src/core/options/infoWindow.js create mode 100644 src/core/options/label.js create mode 100644 src/core/options/map.js create mode 100644 src/core/options/marker.js create mode 100644 src/core/options/polygon.js create mode 100644 src/core/options/polyline.js create mode 100644 src/core/options/symbol.js create mode 100644 src/core/utils/index.js create mode 100644 src/core/utils/map.js delete mode 100644 src/libs/DistanceTool.js delete mode 100644 src/libs/DrawingManager.js delete mode 100644 src/libs/TrafficControl.js delete mode 100644 types/autoComplete.d.ts delete mode 100644 types/base/common.d.ts delete mode 100644 types/base/constants.d.ts delete mode 100644 types/base/events.d.ts delete mode 100644 types/boundary.d.ts delete mode 100644 types/busLineSearch.d.ts delete mode 100644 types/circle.d.ts delete mode 100644 types/cityList.d.ts delete mode 100644 types/copyright.d.ts delete mode 100644 types/curveLine.d.ts delete mode 100644 types/distanceTool.d.ts delete mode 100644 types/drawingManager.d.ts delete mode 100644 types/drivingRoute.d.ts delete mode 100644 types/geolocation.d.ts delete mode 100644 types/ground.d.ts delete mode 100644 types/heatmap.d.ts delete mode 100644 types/index.d.ts delete mode 100644 types/infoWindow.d.ts delete mode 100644 types/label.d.ts delete mode 100644 types/localSearch.d.ts delete mode 100644 types/map.d.ts delete mode 100644 types/mapTypeCtrl.d.ts delete mode 100644 types/marker.d.ts delete mode 100644 types/markerClusterer.d.ts delete mode 100644 types/navigation.d.ts delete mode 100644 types/overviewMap.d.ts delete mode 100644 types/panorama.d.ts delete mode 100644 types/pointCollection.d.ts delete mode 100644 types/polygon.d.ts delete mode 100644 types/polyline.d.ts delete mode 100644 types/ridingRoute.d.ts delete mode 100644 types/scale.d.ts delete mode 100644 types/symbol.d.ts delete mode 100644 types/tile.d.ts delete mode 100644 types/trafficControl.d.ts delete mode 100644 types/transitRoute.d.ts delete mode 100644 types/tsconfig.json delete mode 100644 types/typings.json delete mode 100644 types/walkingRoute.d.ts delete mode 100644 webpack.config.js diff --git a/.babelrc b/.babelrc index 0d04309..60b7f3e 100644 --- a/.babelrc +++ b/.babelrc @@ -5,6 +5,8 @@ "stage-0" ], "plugins": [ - "transform-decorators-legacy" + "transform-runtime", + "transform-decorators-legacy", + "babel-plugin-transform-regenerator" ] } \ No newline at end of file diff --git a/.eslintrc b/.eslintrc index 6273fd5..1b36d95 100644 --- a/.eslintrc +++ b/.eslintrc @@ -6,12 +6,15 @@ }, "rules": { "import/no-extraneous-dependencies": "off", - "no-param-reassign": "warn", + "no-param-reassign": "off", "react/prop-types": "off", "no-underscore-dangle": "warn", + "linebreak-style": "off", "global-require": "warn", "react/jsx-filename-extension": "off", "react/require-default-props": "off", - "react/forbid-prop-types": "off" + "react/forbid-prop-types": "off", + "react/destructuring-assignment": "off", + "react/no-array-index-key": "off" } -} \ No newline at end of file +} diff --git a/.gitignore b/.gitignore index 44e9611..ef72dbd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,6 @@ -# See https://help.github.com/ignore-files/ for more about ignoring files. - # dependencies /node_modules -# testing -/coverage - -# production -/build - -# misc .DS_Store .env.local .env.development.local @@ -19,10 +10,11 @@ npm-debug.log* yarn-debug.log* yarn-error.log* -/docs/publish.sh /docs/.vuepress/dist .vscode -/examples/node_modules -/examples/dist -/examples/publish.sh \ No newline at end of file +lib +dist +package-lock.json +/.idea +/lib/ diff --git a/README.md b/README.md index ad9b442..d9848f5 100644 --- a/README.md +++ b/README.md @@ -10,48 +10,43 @@ ## 文档 -[https://bmap.jser-club.com](https://bmap.jser-club.com) - -## 开始 - -### 安装 - -```bash -yarn add rc-bmap # 或者:npm install --save rc-bmap -``` - -### 使用 -``` js -import React from 'react'; -import { render } from 'react-dom'; -import { Map } from 'rc-bmap'; - -render(, - document.getElementById('app') -); - -``` +1.0.0文档地址 +[https://jser.wang/bmap/](https://jser.wang/bmap/) -更多用法,见[官网](https://bmap.jser-club.com)。 - -更多示例,见[示例](https://bmap.jser-club.com/examples/) +0.2.4文档地址 +[https://bmap.jser-club.com](https://bmap.jser-club.com) ## 协议 [MIT 许可证](https://opensource.org/licenses/MIT) -## 如何本地启动demo - -* 进入`examples`目录,执行 - -```bash -yarn install # 安装相关依赖 -npm run dev # 启动本地服务 -``` - -## 如何启动本地文档 -* 进入`docs`目录,执行 - -```bash -vuepress dev # 文档由vuepress驱动 -``` +## 本地开发 + +与`demo`结合的最佳实践: + +1. 将`demo`工程`clone`至本地。 + ``` bash + git clone https://github.com/jser-club/rc-bmap-demo.git + ``` +2. 安装`demo`工程所需依赖。 + ``` bash + cd 你刚clone的工程目录 + yarn install + ``` +3. 进入`rc-bmap`工程的目录,执行 + ``` bash + yarn link + ``` +4. 进入`rc-bmap-dmeo`工程目录执行 + ``` bash + yarn link rc-bmap + ``` +5. 修改完`rc-bmap`的源码后,在`rc-bmap`工程执行 + ``` bash + yarn run build + ``` + 如果在windows系统下 + ```bash + yarn run build_win + ``` +6. 在`demo`重新点击按钮运行,即可看到最新修改后的效果 diff --git a/dist/rc-bmap.min.js b/dist/rc-bmap.min.js deleted file mode 100644 index df6db8f..0000000 --- a/dist/rc-bmap.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-dom"),require("react")):"function"==typeof define&&define.amd?define(["react-dom","react"],t):"object"==typeof exports?exports["rc-bmap"]=t(require("react-dom"),require("react")):e["rc-bmap"]=t(e.ReactDOM,e.React)}("undefined"!=typeof self?self:this,function(e,t){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=15)}([function(e,t,n){"use strict";(function(e){function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function i(e){return e.replace(j,function(e){return e.toUpperCase()})}function r(t,n){return new e.BMap.Point(t,n)}function a(t,n){return new e.BMap.Size(t,n)}function s(t){var n=t.sw,o=t.ne;return new e.BMap.Bounds(r(n.lng,n.lat),r(o.lng,o.lat))}function l(){return e.bMapInstance.getBounds()}function u(e,t,n){n&&C[t]&&C[t].forEach(function(t){if(n[t]){var o=function(){for(var e,o=arguments.length,i=Array(o),r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=t.url,o=t.size,i=t.opts,r=void 0===i?{}:i,s=o&&a(o.width,o.height);return new e.BMap.Icon(n,s,{anchor:r.anchor&&e[r.anchor],imageSize:r.imageSize&&a(r.imageSize.width,r.imageSize.height),imageOffset:r.imageOffset&&a(r.imageOffset.width,r.imageOffset.height),infoWindowAnchor:r.infoWindowAnchor&&a(r.infoWindowAnchor.width,r.infoWindowAnchor.height),printImageUrl:r.printImageUrl})}function f(e,t,n){k[t].forEach(function(t){if(n[t]||"boolean"==typeof n[t]){var o=i(t);e["set"+o](n[t])}})}function d(e,t,n){k[t].forEach(function(t){if(n[t]||"boolean"==typeof n[t]){var o=i(t),r="disable";n[t]&&(r="enable"),e[""+r+o]()}})}function h(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.content,o=t.point,i=t.offset,s=void 0===i?{width:0,height:0}:i,l=t.massClear,c=void 0===l||l,p=t.title,d=t.events,h=t.zIndex,_=t.style,y={offset:s&&a(s.width,s.height),enableMassClear:c,position:o&&r(o.lng,o.lat)},g=new e.BMap.Label(n,y);return u(g,"LABEL",d),f(g,"LABEL_SET_OPTIONS",{title:p,zIndex:h,style:_}),g}function _(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.path,o=t.opts,i=void 0===o?{}:o,r=e[n]||n;return new e.BMap.Symbol(r,T({},i))}function y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments[1],o=new e.BMap.ContextMenu;return t.forEach(function(t){var n=t.iconUrl===B.default.ZOOMIN||t.iconUrl===B.default.ZOOMOUT?e[t.iconUrl]:t.iconUrl,i={width:t.width,id:t.id,iconUrl:n},r=new e.BMap.MenuItem(t.text,t.callback,i);t.disabled&&r.disable(),t.separator&&o.addSeparator(),o.addItem(r)}),u(o,"CONTEXT_MENU",n),o}function g(t){var n=t.points,o=t.strokeColor,i=t.fillColor,a=t.strokeWeight,s=t.strokeOpacity,l=t.fillOpacity,c=t.strokeStyle,p=t.clicking,f=void 0===p||p,d=t.events,h={strokeColor:o,fillColor:i,strokeWeight:a,strokeOpacity:s,fillOpacity:l,strokeStyle:c,enableClicking:f},_=[];n&&(_=n.map(function(e){return r(e.lng,e.lat)}));var y=new e.BMap.Polygon(_,h);return u(y,"POLYGON",d),y}function m(){return!!document.createElement("canvas").getContext}function v(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))}function b(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.url,n=e.id,o=document.createElement("link");o.rel="stylesheet",o.type="text/css",o.href=t,void 0!==n&&(o.id=n),document.getElementsByTagName("head")[0].appendChild(o)}function O(t){return new Promise(function(n){new e.BMap.LocalSearch(e.bMapInstance,{onSearchComplete:function(e){var t=null;e&&(t=e.getPoi(0)),n(t)}}).search(t)})}function w(t,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;return new Promise(function(i){var a=new e.BMap.Convertor;Array.isArray(t)||(t=[t]);var s=t.map(function(e){return r(e.lng,e.lat)});a.translate(s,n,o,function(e){i(e)})})}function P(e,t){if(e){var n=y(e.items,e.events);t.addContextMenu(n)}}function M(t){var n=t.point,o=t.offset,i=void 0===o?{width:0,height:0}:o,s=t.icon,l=t.massClear,c=void 0===l||l,d=t.dragging,_=void 0!==d&&d,y=t.clicking,g=void 0===y||y,m=t.raiseOnDrag,v=void 0!==m&&m,b=t.draggingCursor,O=t.rotation,w=t.shadow,M=t.title,T=t.events,E=t.label,C=t.zIndex,S=t.top,k=void 0!==S&&S,x=t.contextMenu,B=n&&r(n.lng,n.lat),j={offset:i&&a(i.width,i.height),enableMassClear:c,enableDragging:_,enableClicking:g,raiseOnDrag:v,draggingCursor:b,rotation:O,title:M},A=new e.BMap.Marker(B,j),L={label:E&&h(E.props),shadow:w&&p(w),zIndex:C,top:k};return s&&s instanceof e.BMap.Symbol?L.icon=s:s&&(L.icon=p(s)),u(A,"MARKER",T),P(x,A),f(A,"MARKER_SET_OPTIONS",L),A}Object.defineProperty(t,"__esModule",{value:!0}),t.isPoint=void 0;var T=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l,u,c,p=function(){function e(e,t){for(var n=0;n=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l,u=function(){function e(e,t){for(var n=0;n=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l,u=function(){function e(e,t){for(var n=0;n-1?l+="top:"+a+"px;":l+="bottom:"+a+"px;",r.indexOf("l")>-1?l+="left:"+a+"px;":l+="right:"+a+"px;",e=document.createElement("div"),e.style.cssText="border-radius:5px;position:absolute;"+l+"font-family:Helvetica; width:256px;z-index:10000000000; background:rgba(255,255,255,1);padding:10px;border:1px solid black;margin:0;",e.innerHTML="

"+i+"

",s.style.cssText="position:relative;font-size:12px;display:block;list-style:none;list-style-type:none;margin:0;height:15px;",t=document.createElement("div"),t.style.cssText=["position:relative;display:block;width:256px;height:15px;border-bottom:1px solid black; background-image:url(",n.createGradientImage(),");"].join(""),e.appendChild(s),e.appendChild(t),n.set("element",e),n.set("labelsEl",s),n.update(1)},processGradientObject:function(){var e=this,t=this.config.gradient,n=[];for(var o in t)t.hasOwnProperty(o)&&n.push({stop:o,value:t[o]});n.sort(function(e,t){return e.stop-t.stop}),n.unshift({stop:0,value:"rgba(0,0,0,0)"}),e.set("gradientArr",n)},createGradientImage:function(){var e,t=this,n=t.get("gradientArr"),o=n.length,i=document.createElement("canvas"),r=i.getContext("2d");i.width="256",i.height="15",e=r.createLinearGradient(0,5,256,10);for(var a=0;a>0),0),r.lineTo(.5+(1/(o-1)*a*256>>0),0==a?15:5);return r.moveTo(255.5,0),r.lineTo(255.5,15),r.moveTo(255.5,4.5),r.lineTo(0,4.5),r.stroke(),t.set("ctx",r),i.toDataURL()},getElement:function(){return this.get("element")},update:function(e){for(var t,n,o=this,i=o.get("gradientArr"),r=o.get("ctx"),a=o.get("labelsEl"),s="",l=0;l>0,n=r.measureText(t).width/2>>0,0==l&&(n=0),l==i.length-1&&(n*=2),s+='
  • '+t+"
  • ";a.innerHTML=s}};var n=function(t){var n={radius:40,element:{},canvas:{},acanvas:{},ctx:{},actx:{},legend:null,visible:!0,width:0,height:0,max:!1,gradient:!1,opacity:180,premultiplyAlpha:!1,bounds:{l:1e3,r:0,t:1e3,b:0},debug:!1};this.store=new e(this),this.get=function(e){return n[e]},this.set=function(e,t){n[e]=t},this.configure(t),this.init()};return n.prototype={configure:function(e){var n=this;if(n.set("radius",e.radius||40),n.set("element",e.element instanceof Object?e.element:document.getElementById(e.element)),n.set("visible",null==e.visible||e.visible),n.set("max",e.max||!1),n.set("gradient",e.gradient||{.45:"rgb(0,0,255)",.55:"rgb(0,255,255)",.65:"rgb(0,255,0)",.95:"yellow",1:"rgb(255,0,0)"}),n.set("opacity",parseInt(255/(100/e.opacity),10)||180),n.set("width",e.width||0),n.set("height",e.height||0),n.set("debug",e.debug),e.legend){var o=e.legend;o.gradient=n.get("gradient"),n.set("legend",new t(o))}},resize:function(){var e=this,t=e.get("element"),n=e.get("canvas"),o=e.get("acanvas");n.width=o.width=e.get("width")||t.style.width.replace(/px/,"")||e.getWidth(t),this.set("width",n.width),n.height=o.height=e.get("height")||t.style.height.replace(/px/,"")||e.getHeight(t),this.set("height",n.height)},init:function(){var e=this,t=document.createElement("canvas"),n=document.createElement("canvas"),o=t.getContext("2d"),i=n.getContext("2d"),r=e.get("element");e.initColorPalette(),e.set("canvas",t),e.set("ctx",o),e.set("acanvas",n),e.set("actx",i),e.resize(),t.style.cssText=n.style.cssText="position:absolute;top:0;left:0;z-index:10000000;",e.get("visible")||(t.style.display="none"),r.appendChild(t),e.get("legend")&&r.appendChild(e.get("legend").getElement()),e.get("debug")&&document.body.appendChild(n),i.shadowOffsetX=15e3,i.shadowOffsetY=15e3,i.shadowBlur=15},initColorPalette:function(){var e,t,n,o=this,i=document.createElement("canvas"),r=o.get("gradient");i.width="1",i.height="256",e=i.getContext("2d"),t=e.createLinearGradient(0,0,1,256),n=e.getImageData(0,0,1,1),n.data[0]=n.data[3]=64,n.data[1]=n.data[2]=0,e.putImageData(n,0,0),n=e.getImageData(0,0,1,1),o.set("premultiplyAlpha",n.data[0]<60||n.data[0]>70);for(var a in r)t.addColorStop(a,r[a]);e.fillStyle=t,e.fillRect(0,0,1,256),o.set("gradient",e.getImageData(0,0,1,256).data)},getWidth:function(e){var t=e.offsetWidth;return e.style.paddingLeft&&(t+=e.style.paddingLeft),e.style.paddingRight&&(t+=e.style.paddingRight),t},getHeight:function(e){var t=e.offsetHeight;return e.style.paddingTop&&(t+=e.style.paddingTop),e.style.paddingBottom&&(t+=e.style.paddingBottom),t},colorize:function(e,t){var n,o,i,r,a,s,l,u,c,p=this,f=p.get("width"),d=p.get("radius"),h=p.get("height"),_=p.get("actx"),y=p.get("ctx"),g=3*d,m=p.get("premultiplyAlpha"),v=p.get("gradient"),b=p.get("opacity"),O=p.get("bounds");null!=e&&null!=t?(e+g>f&&(e=f-g),e<0&&(e=0),t<0&&(t=0),t+g>h&&(t=h-g),n=e,o=t,r=e+g,i=t+g):(n=O.l<0?0:O.l,r=O.r>f?f:O.r,o=O.t<0?0:O.t,i=O.b>h?h:O.b),a=_.getImageData(n,o,r-n,i-o),s=a.data.length;for(var w=3;w>0,u=t-1.5*r>>0,c=e+1.5*r>>0,p=t+1.5*r>>0;a.shadowColor="rgba(0,0,0,"+(n?n/i.store.max:"0.1")+")",a.shadowOffsetX=15e3,a.shadowOffsetY=15e3,a.shadowBlur=15,a.beginPath(),a.arc(e-15e3,t-15e3,r,0,2*Math.PI,!0),a.closePath(),a.fill(),o?i.colorize(l,u):(ls.r&&(s.r=c),p>s.b&&(s.b=p))},toggleDisplay:function(){var e=this,t=e.get("visible"),n=e.get("canvas");n.style.display=t?"none":"block",e.set("visible",!t)},getImageData:function(){return this.get("canvas").toDataURL()},clear:function(){var e=this,t=e.get("width"),n=e.get("height");e.store.set("data",[]),e.get("ctx").clearRect(0,0,t,n),e.get("actx").clearRect(0,0,t,n)},cleanup:function(){var e=this;e.get("element").removeChild(e.get("canvas"))}},{create:function(e){return new n(e)},util:{mousePosition:function(e){var t,n;if(e.layerX?(t=e.layerX,n=e.layerY):e.offsetX&&(t=e.offsetX,n=e.offsetY),void 0!==t)return[t,n]}}}}(),n=function(t){try{BMap}catch(e){throw Error("Baidu Map JS API is not ready yet!")}if(!n._isExtended){n._isExtended=!0,e(n,BMap.Overlay,"HeatmapOverlay");var o=new n(t);this.__proto__=o.__proto__}this.conf=t,this.heatmap=null,this.latlngs=[],this.bounds=null,this._moveendHandler=this._moveendHandler.bind(this)};return n.prototype.initialize=function(e){this._map=e;var n=document.createElement("div");return n.style.position="absolute",n.style.top=0,n.style.left=0,n.style.border=0,n.style.width=this._map.getSize().width+"px",n.style.height=this._map.getSize().height+"px",this.conf.element=n,e.getPanes().mapPane.appendChild(n),this.heatmap=t.create(this.conf),this._div=n,n},n.prototype.draw=function(){var e=this._map.getBounds();if(!e.equals(this.bounds)){this.bounds=e;var t=this._map.pointToOverlayPixel(e.getNorthEast()),n=this._map.pointToOverlayPixel(e.getSouthWest());if(t&&n){var o=t.y,i=n.x,r=n.y-t.y,a=t.x-n.x;if(this.conf.element.style.left=i+"px",this.conf.element.style.top=o+"px",this.conf.element.style.width=a+"px",this.conf.element.style.height=r+"px",this.heatmap.store.get("heatmap").resize(),this.latlngs.length>0){this.heatmap.clear();for(var s=this.latlngs.length,l={max:this.heatmap.store.max,data:[]};s--;){var u=this.latlngs[s].latlng;if(e.containsPoint(u)){var c=this._map.pointToOverlayPixel(u),p=new BMap.Pixel(c.x-i,c.y-o),f=this.pixelTransform(p);l.data.push({x:f.x,y:f.y,count:this.latlngs[s].c})}}this.heatmap.store.setDataSet(l)}}}},n.prototype.pixelTransform=function(e){for(var t=this.heatmap.get("width"),n=this.heatmap.get("height");e.x<0;)e.x+=t;for(;e.x>t;)e.x-=t;for(;e.y<0;)e.y+=n;for(;e.y>n;)e.y-=n;return e.x=e.x>>0,e.y=e.y>>0,e},n.prototype._moveendHandler=function(e){this.setDataSet(this._data),delete this._data,this._map.removeEventListener("moveend",this._moveendHandler)},n.prototype.setDataSet=function(e){if(this._map){var t=this._map.getBounds(),n=this._map.pointToOverlayPixel(t.getNorthEast()),o=this._map.pointToOverlayPixel(t.getSouthWest());n&&o||(this._data=e,this._map.addEventListener("moveend",this._moveendHandler));var i={max:e.max,data:[]},r=e.data,a=r.length;for(this.latlngs=[];a--;){var s=new BMap.Point(r[a].lng,r[a].lat);if(this.latlngs.push({latlng:s,c:r[a].count}),t.containsPoint(s)){var l=this._map.pointToOverlayPixel(s),u=this._map.pointToOverlayPixel(t.getSouthWest()).x,c=this._map.pointToOverlayPixel(t.getNorthEast()).y,p=new BMap.Pixel(l.x-u,l.y-c),f=this.pixelTransform(p);i.data.push({x:f.x,y:f.y,count:r[a].count})}}this.heatmap.clear(),this.heatmap.store.setDataSet(i)}},n.prototype.addDataPoint=function(e,t,n){var o=new BMap.Point(e,t),i=this.pixelTransform(this._map.pointToOverlayPixel(o));this.heatmap.store.addDataPoint(i.x,i.y,n),this.latlngs.push({latlng:o,c:n})},n.prototype.toggle=function(){this.heatmap.toggleDisplay()},n})},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s,l=function(){function e(e,t){for(var n=0;n0&&(t=t.concat(i))}return t}function n(e,t){var n=[];if(!(e&&t&&e instanceof BMap.Point&&t instanceof BMap.Point))return null;var o,i,r,a,s,l,u=function(e){return 1-2*e+e*e},c=function(e){return 2*e-2*e*e},p=function(e){return e*e},f=0,d=0;if(void 0===t)return void(void 0!==n&&(n=[]));var h=parseFloat(e.lat),_=parseFloat(t.lat),y=parseFloat(e.lng),g=parseFloat(t.lng);for(g>y&&parseFloat(g-y)>180&&y<0&&(y=parseFloat(360+y)),y>g&&parseFloat(y-g)>180&&g<0&&(g=parseFloat(360+g)),0,l=0,_==h?(o=0,i=y-g):g==y?(o=Math.PI/2,i=h-_):(o=Math.atan((_-h)/(g-y)),i=(_-h)/Math.sin(o)),0==l&&(l=o+Math.PI/5),r=i/2,s=r*Math.cos(l)+y,a=r*Math.sin(l)+h,f=0;f<31;f++)n.push(new BMap.Point(y*u(d)+s*c(d)+g*p(d),h*u(d)+a*c(d)+_*p(d))),d+=1/30;return n}return e})},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s,l=function(){function e(e,t){for(var n=0;n0&&i.getBoxObjectFor&&"absolute"==a(e,"position")&&(""===e.style.top||e.style.left),{left:0,top:0}),l=r.ie&&!r.isStrict?i.body:i.documentElement;if(e==l)return s;if(e.getBoundingClientRect){o=e.getBoundingClientRect(),s.left=Math.floor(o.left)+Math.max(i.documentElement.scrollLeft,i.body.scrollLeft),s.top=Math.floor(o.top)+Math.max(i.documentElement.scrollTop,i.body.scrollTop),s.left-=i.documentElement.clientLeft,s.top-=i.documentElement.clientTop;var u=i.body,c=parseInt(a(u,"borderLeftWidth")),p=parseInt(a(u,"borderTopWidth"));r.ie&&!r.isStrict&&(s.left-=isNaN(c)?2:c,s.top-=isNaN(p)?2:p)}else{n=e;do{if(s.left+=n.offsetLeft,s.top+=n.offsetTop,r.isWebkit>0&&"fixed"==a(n,"position")){s.left+=i.body.scrollLeft,s.top+=i.body.scrollTop;break}n=n.offsetParent}while(n&&n!=e);for((r.opera>0||r.isWebkit>0&&"absolute"==a(e,"position"))&&(s.top-=i.body.offsetTop),n=e.offsetParent;n&&n!=i.body;)s.left-=n.scrollLeft,r.opera&&"TR"==n.tagName||(s.top-=n.scrollTop),n=n.offsetParent}return s},t.event=t.event||{},t.event._listeners=t.event._listeners||[],t.event.on=function(e,n,o){n=n.replace(/^on/i,""),e=t.dom._g(e);var i,r=function(t){o.call(e,t)},a=t.event._listeners,s=t.event._eventFilter,l=n;return n=n.toLowerCase(),s&&s[n]&&(i=s[n](e,n,r),l=i.type,r=i.listener),e.addEventListener?e.addEventListener(l,r,!1):e.attachEvent&&e.attachEvent("on"+l,r),a[a.length]=[e,n,o,r,l],e},t.on=t.event.on,function(){var e=n[t.guid];t.lang.guid=function(){return"TANGRAM__"+(e._counter++).toString(36)},e._counter=e._counter||1}(),n[t.guid]._instances=n[t.guid]._instances||{},t.lang.isFunction=function(e){return"[object Function]"==Object.prototype.toString.call(e)},t.lang.Class=function(e){this.guid=e||t.lang.guid(),n[t.guid]._instances[this.guid]=this},n[t.guid]._instances=n[t.guid]._instances||{},t.lang.Class.prototype.dispose=function(){delete n[t.guid]._instances[this.guid];for(var e in this)t.lang.isFunction(this[e])||delete this[e];this.disposed=!0},t.lang.Class.prototype.toString=function(){return"[object "+(this._className||"Object")+"]"},t.lang.Event=function(e,t){this.type=e,this.returnValue=!0,this.target=t||null,this.currentTarget=null},t.lang.Class.prototype.addEventListener=function(e,n,o){if(t.lang.isFunction(n)){!this.__listeners&&(this.__listeners={});var i,r=this.__listeners;if("string"==typeof o&&o){if(/[^\w\-]/.test(o))throw"nonstandard key:"+o;n.hashCode=o,i=o}0!=e.indexOf("on")&&(e="on"+e),"object"!=typeof r[e]&&(r[e]={}),i=i||t.lang.guid(),n.hashCode=i,r[e][i]=n}},t.lang.Class.prototype.removeEventListener=function(e,n){if(void 0===n||(!t.lang.isFunction(n)||(n=n.hashCode))&&t.lang.isString(n)){!this.__listeners&&(this.__listeners={}),0!=e.indexOf("on")&&(e="on"+e);var o=this.__listeners;if(o[e])if(void 0!==n)o[e][n]&&delete o[e][n];else for(var i in o[e])delete o[e][i]}},t.lang.Class.prototype.dispatchEvent=function(e,n){t.lang.isString(e)&&(e=new t.lang.Event(e)),!this.__listeners&&(this.__listeners={}),n=n||{};for(var o in n)e[o]=n[o];var o,i=this.__listeners,r=e.type;if(e.target=e.target||this,e.currentTarget=this,0!=r.indexOf("on")&&(r="on"+r),t.lang.isFunction(this[r])&&this[r].apply(this,arguments),"object"==typeof i[r])for(o in i[r])i[r][o].apply(this,arguments);return e.returnValue},t.lang.inherits=function(e,t,n){var o,i,r=e.prototype,a=new Function;a.prototype=t.prototype,i=e.prototype=new a;for(o in r)i[o]=r[o];e.prototype.constructor=e,e.superClass=t.prototype,"string"==typeof n&&(i._className=n)},t.inherits=t.lang.inherits;var o=function(t,n,i){try{BMap}catch(e){throw Error("Baidu Map JS API is not ready yet!")}e.lang.inherits(o,BMap.Overlay,"TextIconOverlay"),this._position=t,this._text=n,this._options=i||{},this._styles=this._options.styles||[],!this._styles.length&&this._setupDefaultStyles()};return o.prototype._setupDefaultStyles=function(){for(var e,t=[53,56,66,78,90],n=0;e=t[n];n++)this._styles.push({url:"http://api.map.baidu.com/library/TextIconOverlay/1.2/src/images/m"+n+".png",size:new BMap.Size(e,e)})},o.prototype.initialize=function(e){return this._map=e,this._domElement=document.createElement("div"),this._updateCss(),this._updateText(),this._updatePosition(),this._bind(),this._map.getPanes().markerMouseTarget.appendChild(this._domElement),this._domElement},o.prototype.draw=function(){this._map&&this._updatePosition()},o.prototype.getText=function(){return this._text},o.prototype.setText=function(e){!e||this._text&&this._text.toString()==e.toString()||(this._text=e,this._updateText(),this._updateCss(),this._updatePosition())},o.prototype.getPosition=function(){return this._position},o.prototype.setPosition=function(e){!e||this._position&&this._position.equals(e)||(this._position=e,this._updatePosition())},o.prototype.getStyleByText=function(e,t){var n=parseInt(e),o=parseInt(n/10);return o=Math.max(0,o),o=Math.min(o,t.length-1),t[o]},o.prototype._updateCss=function(){if(this._domElement){var e=this.getStyleByText(this._text,this._styles);this._domElement.style.cssText=this._buildCssText(e)}},o.prototype._updateText=function(){this._domElement&&(this._domElement.innerHTML=this._text)},o.prototype._updatePosition=function(){if(this._domElement&&this._position){var e=this._domElement.style,t=this._map.pointToOverlayPixel(this._position);t.x-=Math.ceil(parseInt(e.width)/2),t.y-=Math.ceil(parseInt(e.height)/2),e.left=t.x+"px",e.top=t.y+"px"}},o.prototype._buildCssText=function(t){var n=t.url,o=t.size,i=t.anchor,r=t.offset,a=t.textColor||"black",s=t.textSize||10,l=[];if(e.browser.ie<7)l.push('filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="'+n+'");');else{l.push("background-image:url("+n+");");var u="0 0";r instanceof BMap.Size&&(u=r.width+"px "+r.height+"px"),l.push("background-position:"+u+";")}return o instanceof BMap.Size&&(i instanceof BMap.Size?(i.height>0&&i.height0&&i.widththis._markerClusterer.getMaxZoom()){this._clusterMarker&&this._map.removeOverlay(this._clusterMarker);for(var e,t=0;e=this._markers[t];t++)this._map.addOverlay(e)}else{if(this._markers.length=t.width-20||o.y<=50||o.y>=t.height-10?(o.x<=20?this._panByX=8:o.x>=t.width-20&&(this._panByX=-8),o.y<=50?this._panByY=8:o.y>=t.height-10&&(this._panByY=-8),this._edgeMoveTimer||(this._edgeMoveTimer=setInterval(function(){t.panBy(n._panByX,n._panByY,{noAnimation:!0})},30))):this._edgeMoveTimer&&(clearInterval(this._edgeMoveTimer),this._edgeMoveTimer=null)},e.prototype._adjustSize=function(e){this.container.style.width=e.width+"px",this.container.style.height=e.height+"px"},e.prototype.getDrawPoint=function(e){var t=this._map,n=u.getTarget(e),o=e.offsetX||e.layerX||0,i=e.offsetY||e.layerY||0;for(1!=n.nodeType&&(n=n.parentNode);n&&n!=t.getContainer();)0==n.clientWidth&&0==n.clientHeight&&n.offsetParent&&"TD"==n.offsetParent.nodeName||(o+=n.offsetLeft||0,i+=n.offsetTop||0),n=n.offsetParent;var r=new BMap.Pixel(o,i);return t.pixelToPoint(r)},t.prototype=new BMap.Control,t.prototype.initialize=function(e){var t=this.container=document.createElement("div");t.className="BMapLib_Drawing";var n=this.panel=document.createElement("div");return n.className="BMapLib_Drawing_panel",this.drawingToolOptions&&this.drawingToolOptions.scale&&this._setScale(this.drawingToolOptions.scale),t.appendChild(n),n.innerHTML=this._generalHtml(),this._bind(n),e.getContainer().appendChild(t),t},t.prototype._generalHtml=function(e){var t={};t.hander="拖动地图",t[o]="画点",t[a]="画圆",t[i]="画折线",t[l]="画多边形",t[s]="画矩形";var n=function(e,n){return''},r=[];r.push(n("BMapLib_box BMapLib_hander","hander"));for(var u=0,c=this.drawingModes.length;u=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l,u=function(){function e(e,t){for(var n=0;n1?this._opts.opacity=1:this._opts.opacity<0&&(this._opts.opacity=0),"solid"!=this._opts.lineStyle&&"dashed"!=this._opts.lineStyle&&(this._opts.lineStyle="solid"),this._units[this._opts.unit]||(this._opts.unit="metric"),this.text="测距")};t.lang.inherits(n,t.lang.Class,"DistanceTool"),n.prototype._bind=function(){this._setCursor(this._opts.cursor);var e=this;if(t.on(this._map.getContainer(),"mousemove",function(t){if(e._isOpen&&e._followTitle){t=window.event||t;if((t.target||t.srcElement)!=i.getDom(e._map))return void e._followTitle.hide();e._mapMoving||e._followTitle.show();var n=i.getDrawPoint(t,!0);e._followTitle.setPosition(n)}}),this._startFollowText){this._followTitle=new BMap.Label(this._startFollowText,{offset:new BMap.Size(14,16)});this._followTitle.setStyles({color:"#333",borderColor:"#ff0103"})}},n.prototype.open=function(){if(1==this._isOpen)return!0;if(!o._toolInUse){this._isOpen=!0,o._toolInUse=!0,this._mapMoving&&delete this._mapMoving;var e=this;this._binded||(this._binded=!0,this._bind(),this._map.addEventListener("moving",function(){e._hideCurrent()})),this._followTitle&&(this._map.addOverlay(this._followTitle),this._followTitle.hide());var n=function(n){var o=e._map;if(e._isOpen){n=window.event||n;var r=i.getDrawPoint(n,!0);if(e._isPointValid(r)){if(e._bind.initX=n.pageX||n.clientX||0,e._bind.initY=n.pageY||n.clientY||0,e._points.length>0){var a=o.pointToPixel(e._points[e._points.length-1]),s=o.pointToPixel(r);if(Math.sqrt(Math.pow(a.x-s.x,2)+Math.pow(a.y-s.y,2))<5)return}e._bind.x=n.layerX||n.offsetX||0,e._bind.y=n.layerY||n.offsetY||0,e._points.push(r),e._addSecPoint(r),0==e._paths.length&&e._formatTitle(1,e._opts.followText,e._getTotalDistance()),e._paths.length>0&&(e._paths[e._paths.length-1].show(),e._paths[e._paths.length-1].setStrokeOpacity(e._opts.opacity));var l=new BMap.Polyline([r,r],{enableMassClear:e._enableMassClear});if(e._map.addOverlay(l),e._paths.push(l),e._overlays.push(l),l.setStrokeWeight(e._opts.lineStroke),l.setStrokeColor(e._opts.lineColor),l.setStrokeOpacity(e._opts.opacity/2),l.setStrokeStyle(e._opts.lineStyle),e._mapMoving&&l.hide(),e._points.length>1){e._paths[e._points.length-2].setPositionAt(1,r)}var u="";if(e._points.length>1){var c=(e._setSegDistance(e._points[e._points.length-2],e._points[e._points.length-1]),e._getTotalDistance());u=e._formatDisStr(c)}else u="起点";var p=new BMap.Label(u,{offset:new BMap.Size(10,-5),enableMassClear:e._enableMassClear});p.setStyles({color:"#333",borderColor:"#ff0103"}),e._map.addOverlay(p),e._formatSegLabel(p,u),e._overlays.push(p),r.disLabel=p,p.setPosition(r);var f=new t.lang.Event("onaddpoint");f.point=r,f.pixel=e._map.pointToPixel(r),f.index=e._points.length-1,f.distance=e._getTotalDistance().toFixed(0),e.dispatchEvent(f)}}},r=function t(n){if(e._isOpen)if(e._paths.length>0){n=window.event||n;var o=n.pageX||n.clientX||0,r=n.pageY||n.clientY||0;void 0===e._bind.initX&&(e._bind.x=n.layerX||n.offsetX||0,e._bind.y=n.layerY||n.offsetY||0,e._bind.initX=o,e._bind.initY=r);var a=e._bind.x+o-e._bind.initX,s=e._bind.y+r-e._bind.initY,l=e._paths[e._paths.length-1],u=e._map.pixelToPoint(new BMap.Pixel(a,s));l.setPositionAt(1,u),e._mapMoving||l.show();var c=0,p=0;if(a<10?c=8:a>e._map.getSize().width-10&&(c=-8),s<10?p=8:s>e._map.getSize().height-10&&(p=-8),0!=c||0!=p)t._movingTimerId||(e._mapMoving=!0,e._map.panBy(c,p,{noAnimation:!0}),e._movingTimerId=t._movingTimerId=setInterval(function(){e._map.panBy(c,p,{noAnimation:!0})},30),l.hide(),e._followTitle&&e._followTitle.hide());else if(t._movingTimerId){clearInterval(t._movingTimerId),delete t._movingTimerId,delete e._movingTimerId;var f=e._paths[e._paths.length-1],d=e._map.pixelToPoint(new BMap.Pixel(a,s));if(!f)return;f.setPositionAt(1,d),f.show(),e._followTitle&&(e._followTitle.setPosition(d),e._followTitle.show()),e._bind.i=0,e._bind.j=0,delete e._mapMoving}if(e._followTitle){var h=e._getTotalDistance(),_=e._map.getDistance(e._points[e._points.length-1],u);e._updateInstDis(e._followTitle,h+_)}}else if(e._followTitle){e._followTitle.show(),n=window.event||n;var y=n.target||n.srcElement;y!=i.getDom()&&e._followTitle.hide()}},a=function o(a){e._isOpen&&(t.un(i.getDom(e._map),"click",n),t.un(document,"mousemove",r),t.un(i.getDom(e._map),"dblclick",o),t.un(document,"keydown",s),t.un(i.getDom(e._map),"mouseup",l),setTimeout(function(){e.close()},50))},s=function(t){t=window.event||t,27==t.keyCode&&(e._clearCurData(),setTimeout(function(){e.close()},50))},l=function(t){t=window.event||t;var n=0;/msie (\d+\.\d)/i.test(navigator.userAgent)&&(n=document.documentMode||+RegExp.$1),(n&&1!=t.button||2==t.button)&&e.close()};return e._initData(),this._formatTitle(),i.show(this._map),this._setCursor(this._opts.cursor),t.on(i.getDom(this._map),"click",n),t.on(document,"mousemove",r),t.on(i.getDom(this._map),"dblclick",a),t.on(document,"keydown",s),t.on(i.getDom(this._map),"mouseup",l),this.bindFunc=[{elem:i.getDom(this._map),type:"click",func:n},{elem:i.getDom(this._map),type:"dblclick",func:a},{elem:document,type:"mousemove",func:r},{elem:document,type:"keydown",func:s},{elem:i.getDom(this._map),type:"mouseup",func:l}],!0}},n.prototype._dispatchLastEvent=function(){var e=new t.lang.Event("ondrawend");e.points=this._points?this._points.slice(0):[],e.overlays=this._paths?this._paths.slice(0,this._paths.length-1):[],e.distance=this._getTotalDistance().toFixed(0),this.dispatchEvent(e)},n.prototype.close=function(){if(0!=this._isOpen){this._isOpen=!1,o._toolInUse=!1,this._mapMoving&&delete this._mapMoving;var e=this;if(e._dispatchLastEvent(),e._points.length<2)e._clearCurData();else{e._paths[e._paths.length-1].remove(),e._paths[e._paths.length-1]=null,e._paths.length=e._paths.length-1;var n=e._points[e._points.length-1];n.disLabel&&n.disLabel.remove(),e._processLastOp()}i.hide();for(var r=0,a=this.bindFunc.length;rthis._units[t].incon?(o/=this._units[t].incon,n=this._units[t].u2,o=o.toFixed(1)):o=o.toFixed(0),o+n},n.prototype._setCursor=function(e){var t=/webkit/.test(navigator.userAgent.toLowerCase())?"url("+this._opts.cursor+") 3 6, crosshair":"url("+this._opts.cursor+"), crosshair";i._setCursor(t)},n.prototype._getCursor=function(){return this._opts.cursor},n.prototype._formatSegLabel=function(e,t){e.setStyle({border:"none",padding:"0"}),e.setContent(""+t+"")},n.prototype._processLastOp=function(){var n=this;if(delete n._bind.x,delete n._bind.y,delete n._bind.initX,delete n._bind.initY,n._paths.length>n._points.length-1){var o=n._paths.length-1;n._paths[o].remove(),n._paths[o]=null,n._paths.length=o}var i={};i.points=n._points.slice(0),i.paths=n._paths.slice(0),i.dots=n._dots.slice(0),i.segDis=n._segDistance.slice(0);var r=n._map.pointToPixel(i.points[i.points.length-1]),a=n._map.pointToPixel(i.points[i.points.length-2]),s=[0,0],l=[0,0];l=r.y-a.y>=0?[-5,11]:[-5,-35],s=r.x-a.x>=0?[14,0]:[-14,0];var u=i.points[i.points.length-1];u.disLabel=new BMap.Label("",{offset:new BMap.Size(-15,-40),enableMassClear:n._enableMassClear}),u.disLabel.setStyles({color:"#333",borderColor:"#ff0103"}),n._map.addOverlay(u.disLabel),u.disLabel.setOffset(new BMap.Size(l[0],l[1])),u.disLabel.setPosition(u),n._formatTitle(2,"","",u.disLabel);var c=this._opts.closeIcon?this._opts.closeIcon:new BMap.Icon("http://api.map.baidu.com/images/mapctrls.gif",new BMap.Size(12,12),{imageOffset:new BMap.Size(0,-14)});i.closeBtn=new BMap.Marker(i.points[i.points.length-1],{icon:c,offset:new BMap.Size(s[0],s[1]),baseZIndex:36e5,enableMassClear:n._enableMassClear}),n._map.addOverlay(i.closeBtn),i.closeBtn.setTitle("清除本次测距"),i.closeBtn.addEventListener("click",function(o){for(var r=0,a=i.points.length;rthis._units[s].incon?(u/=this._units[s].incon,l=this._units[s].u2,u=u.toFixed(1)):u=u.toFixed(0),a.push("总长:"+u+""+l+"
    "),a.push(""+t+"")}else if(2==e){var s=this._opts.unit,l=this._units[s].u1,u=this._convertUnit(this._getTotalDistance(),s);u>this._units[s].incon?(u/=this._units[s].incon,l=this._units[s].u2,u=u.toFixed(1)):u=u.toFixed(0),a.push("总长:"+u+""+l)}else i.setOffset(0,25),a.push(r);i.setContent(a.join(""))}},n.prototype._updateInstDis=function(e,t){var n=this._opts.unit,o=this._units[n].u1;if(t>this._units[n].incon?(t/=this._units[n].incon,o=this._units[n].u2,t=t.toFixed(1)):t=t.toFixed(0),e){var i=[];i.push("总长:"+t+""+o+"
    "),i.push(""+this._opts.followText+""),e.setContent(i.join(""))}},n.prototype._hideCurrent=function(){if(this._isOpen){if(this._paths.length>0){this._paths[this._paths.length-1].hide()}this._followTitle&&this._followTitle.hide()}},n.prototype._isPointValid=function(e){if(!e)return!1;var t=this._map.getBounds(),n=t.getSouthWest(),o=t.getNorthEast();return!(e.lngo.lng||e.lato.lat)};var i={_map:null,_html:"
    ",_maskElement:null,_cursor:"default",_inUse:!1,show:function(e){this._map||(this._map=e),this._inUse=!0,this._maskElement||this._createMask(e),this._maskElement.style.display="block"},_createMask:function(n){if(this._map=n,this._map){t.insertHTML(this._map.getContainer(),"beforeEnd",this._html);var o=this._maskElement=this._map.getContainer().lastChild,i=function(n){return e(n),t.preventDefault(n)};t.on(o,"mouseup",function(e){2==e.button&&i(e)}),t.on(o,"contextmenu",i),o.style.display="none"}},getDrawPoint:function(e,t){e=window.event||e;var n=e.layerX||e.offsetX||0,o=e.layerY||e.offsetY||0,r=e.target||e.srcElement;if(r!=i.getDom(this._map)&&1==t)for(;r&&r!=this._map.getContainer();)0==r.clientWidth&&0==r.clientHeight&&r.offsetParent&&"td"==r.offsetParent.nodeName.toLowerCase()||(n+=r.offsetLeft,o+=r.offsetTop),r=r.offsetParent;if(!(r!=i.getDom(this._map)&&r!=this._map.getContainer()||void 0===n||void 0===o||isNaN(n)||isNaN(o)))return this._map.pixelToPoint(new BMap.Pixel(n,o))},hide:function(){this._map&&(this._inUse=!1,this._maskElement&&(this._maskElement.style.display="none"))},getDom:function(e){return this._maskElement||this._createMask(e),this._maskElement},_setCursor:function(e){this._cursor=e||"default",this._maskElement&&(this._maskElement.style.cursor=this._cursor)}};return n})}).call(t,n(1))},function(e,t,n){"use strict";(function(e){function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s,l=function(){function e(e,t){for(var n=0;n165&&(i=165),a.browser.ie<=6?c.style.marginLeft=.53*i+"px":c.style.marginLeft=i+"px",T.style.marginLeft=i+"px",l()}function i(){a.un(document,"onmousemove",o),a.un(document,"onmouseup",i),e.showTraffic({predictDate:{hour:e.hour,weekday:e.weekday}})}function r(e){var t=parseInt(a.dom.getStyle("tcTimeBox","marginLeft")),n=Math.ceil(24*(t-4)/165);s("next"==e?n+1:n-1)}function s(t){t<0&&(t=0),t>24&&(t=24),u=t;var n=6.875*t;T.style.marginLeft=n+"px";var o=a.g("tcMove");a.browser.ie<=6&&a.browser.ie>0?o.style.marginLeft=.53*n+"px":o.style.marginLeft=n+"px",e.hour=u,g?e.showTraffic():e.showTraffic({predictDate:{hour:e.hour,weekday:e.weekday}}),l()}function l(){var t=parseInt(T.style.marginLeft),n=Math.ceil(24*(t-4)/165);u=n,e.hour=n,n<10&&(n="0"+n),g?(P.innerHTML=e.time,T.innerHTML=n+":00"):P.innerHTML=T.innerHTML=n+":00"}var u,c=a.g("tcMove");a.on(c,"onmousedown",t),a.on("tcPrev","click",function(){r("prev")}),a.on("tcNext","click",function(){r("next")}),this.setBarTime=function(e){s(e)}}var t=this,_=["查看实时路况","流量预测"],y=["查看流量预测","实时路况"],g=!0;this.bShow=!1;var m=this;m._bind=!1,o(r,"afterEnd",function(){var e=['
    '];return e.push('
    实时路况
    '),e.push('
    '),e.push('
    更新时间:  查看流量预测
    '),e.push('
    '),e.push(''),e.push('
    时间
    '),e.push('
    '),e.push('
    20:00
    '),e.push('
    '),e.push('
    '),e.push('
    '),e.push('
    '),e.push("
    "),e.push('
    (基于历史流量统计预测 仅供参考)
    '),e.push("
    "),e.join("")}()),o(r,"afterEnd",'
    实时路况
    ');var v=a.g("tcViewPrediction"),b=a.g("tcPredition"),O=a.g("tcTitle"),w=a.g("maplibTcDay"),P=a.g("tcNow"),M=a.g("tcWrap"),T=a.g("tcTimeBox"),E=a.g("tcUpdate"),C=["一","二","三","四","五","六","日"],S=new h(t);this.show=function(){c(),t.bShow=!0,a.dom.removeClass(r,"maplibTcBtnOff"+s)},this.hide=function(){t.bShow=!1,a.dom.addClass(r,"maplibTcBtnOff"+s),a.isMobile()?a.dom.addClass("tcWrap_mobile","maplibTfctrHide"):(a.dom.addClass("tcWrap","maplibTcHide"),a.dom.addClass("tcPredition","maplibTcHide")),t.hideTraffic()},this.isbShow=function(){return t.bShow},this.setPopOffset=function(e){var n=e.height+24+"px",o=e.width+"px";switch(t.getAnchor()){case BMAP_ANCHOR_TOP_LEFT:M.style.top=n,M.style.left=o;break;case BMAP_ANCHOR_TOP_RIGHT:M.style.top=n,M.style.right=o;break;case BMAP_ANCHOR_BOTTOM_RIGHT:M.style.bottom=n,M.style.right=o;break;case BMAP_ANCHOR_BOTTOM_LEFT:M.style.bottom=n,M.style.left=o}};var k=a.isMobile()?"ontouchend":"onclick";a.event.on(r,k,function(){u()}),a.event.on("tcClose","click",function(e){u()})},l.prototype.showTraffic=function(e){var t;if(this._trafficLayer&&this._map.removeTileLayer(this._trafficLayer),e){if(e.predictDate.weekday>7||e.predictDate.weekday<1)return;t=new BMap.TrafficLayer(e)}else t=new BMap.TrafficLayer;this.bShow=!0,a.isMobile()&&a.dom.removeClass(this.btn,"maplibTcBtnOff"+s),this._map.addTileLayer(t),this._trafficLayer=t},l.prototype.hideTraffic=function(){this.bShow=!1,this._trafficLayer&&(this._map.removeTileLayer(this._trafficLayer),this._trafficLayer=null),a.isMobile()&&a.dom.addClass(this.btn,"maplibTcBtnOff"+s)},l.prototype.remove=function(){this.hideTraffic();var e=a.g("tcWrap");e.parentNode.removeChild(e),BMap.Control.prototype.remove.call(this),this.timer&&clearInterval(this.timer)},l.getTime=function(e){this.curTime=isNaN(e)?new Date:new Date(e)},l})},function(e,t,n){"use strict";(function(e){function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r,a=function(){function e(e,t){for(var n=0;n0){var l={anchor:r.anchor,offset:(0,u.getSize)(r.offset)};this.copyRight=new e.BMap.CopyrightControl(l),this.copyRight.addCopyright({id:2,content:r.content,bounds:r.bounds?(0,u.getBounds)(r.bounds):this.map.getBounds()}),this.map.addControl(this.copyRight)}this.instance=new e.BMap.TileLayer({transparentPng:n,tileUrlTemplate:o,zIndex:a}),s&&(this.instance.getTilesUrl=s),this.map.addTileLayer(this.instance)}},{key:"onPropsUpdate",value:function(e){this.props=e,this.destroy(),this.init()}}]),t}())||r;t.default=f}).call(t,n(1))},function(e,t,n){"use strict";(function(e){function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s,l=function(){function e(e,t){for(var n=0;n8;LO-*fM|-`QtU!?+3m?b~P2(>Qsn zVccdI#_dSRGVVYk{-{wcr6=slQo^lXuDjJmaGU>v>$*NUJ#cgL;AVaupR7h8zhYP5 zoRx)HD_j4$l}oH`7AC^_G|Ov~%v^Ax{yRjdn+1>()M(`a(zD}H`7d7vpGnq&GfpN# z)7^}Fxt5UMo`%-dX=pA@Lu2U&Mf96^wAWc*R%Z*$ipAD?{MODVT-PzdtpT*qXBuzF zEPEw&uTxlr-s%k4*Jhx*P4t_1PVzi>eFuuHvn%#lw*WcxP0w}eolXZh=NM*;GwEUd z6Hg5NO1{mYkB8-gRfe8qaH(H`g&3lk2*eUXK)2h4cDt?SUazO@BRy!(wr#L1D@4=3wApd$k82yLwC~MWUJ#i0k+1cGem^j@Am^8YPA~F z%B$d}_JdV82Ho77z|vD7QXd66h}3alxNm0<=ZOgm%ud50GslMY}7b36ZRl} zc%SrSj6r|%1Z)*gL$z8})TmqoFMkkt>UGrPD0tZe(A>Nd?6)@Npuh31vXyKho5J_% z--JyVtdh-}BG!@*D?W3J-WK;rn|1C56k9cjEdW+KB7*m(kbH154hG zdk-qVlkfTFhaiQs3p$qj_WNbnA(G{_uhF(C;H9IO-}j^4>mcf9fLAd02L`WygZxiG z`9Av?${a!2{lKfAgXGr0X@41qFTFaj+*82KQ-Lfm9tN>>5m@$7#giQSR_zp?`2wWZ zKwCYOIRL`?6X&PZdy8xkjqg$Ban!xILx(tgUV01T{Y&J$uoln<_kw8pxyDP_2Ph6i z=zj!6>_4{8%tU3oE8Axx>{$Pk9TMN0;XyVM7R7)D%RX@(KY0(<8umA=LzcWt@#e;eRuY9W3^pFz!MfDi+J`Q;L zM;t!cqVCE)38M8A#=EOxE2*#G{j!%-S5Qo)ll5bb?;D1BCs|YF9p#707wi$dLbc#& z*kF#s*9W9qQo2)*W2yW6d_y~w4j2d7ulj^~@ZxJ&^Kavs(|(PnAHo{^0QJl0>vqhe z@U?(w&8fS{7nJYR+ejZ)IOJ3M0n`cYtR6>y&ElCaQICWckDbTGr+8BS>p^+J^3SP! zm-d><#c+*NeE7y2`grU-Ha^v(jo&4qAw5&owdw~>F0_N`;8m4hBFrI+vGFnIsi%hr z*+}_DBsy2ZTdLQv^;aUiVT*C`{rF=J)4PXyTK!w!=a^f%Cb)UxdauMBL=kS-BHYLSrc6p;`F1f;vWTVUysT1rwnA89aXSZe85dgJx` zN4)pU{4nRtIrlSh=FZHG)6rHVC1N51005-wU}Zf30E_K^48#Ed03b`NW&i+NT}RVE z<(~-qe?Axt#&-F!dlfT!j9I&FL?96VE`-D3H#av;W1F`q%;Di78jae$M}Js(+}zx> zTY0=jVII&J6b2K&gLGYcJV#QIXro-#6&dOZ2xR)XvV%@(sG@9Mw8~*mjEA-`}4&#nizrSN4yO9xzQOC?pbD zd58+#dURQRL}BjlQJ5d=nCv~I*XqOh9cK3uGY-QXJq?=i4D%qjx2 zc8XboV@eNEk7&gA#jDfD-%AIVTen@C*OtJbMcB6Xxa&qrveD~z<>c;f1jV<`X z*3tCV!LO~OnNV5h|0NTdJ}+zRSmdwbDx!DDXCMX(*cpZmhclDkbIU-N|#5DS{%1zO>oyn#!HD z+A$>I>{`#L^7nyyz*gJ}zfFgyYo!pb^yD*bC|kGPVd4jC{4n}0LKQ1v2r?cNNliMvG}r6BdyEcA{2#od7T`zTFX8?7OswJKQ8@q&7h@Ygbd zzYd6PuhTph2NHwN{6(uqM*V*}{o=Q|bhrkA>UaXM6}lV;ZMm`7o+n0Tj!Gv*9sc>v zh2hLr=F_YSW<*1oeCHm9rhVik<-(~3CO;Nbph?c4#MT;{8F;uceU0vkeolqEn%A#_ zC<_LG7}~E>1a~y5kGSjLqoqM@hED`XS>k&Q@GH+;cAtj7XOjD#;BmBypsYrDc#t}! zclCsl{c-TCEW>j%BBsgN$0nz;S>D4Rq@a!G%j$oEWS3yrwHk9})F58i`o;_&t*XI7 z(jC?dE=q5B!O)Ys&WW$fgyPYP8^(JuuB%-M+If9SGKZz*c_L> zF>tW2GEE6Zonct4BUS@j5TUK2XC2;x38=FFIAm&n*Zn}sr?qG}-anB0kn3PBH7D09 zjQxJI@!E_luzA4Tia$b2h@d=YfJ;GGFcfDyR2t&;bQbR)ku%M*emSX-a%CeLI(NID zmP{Ay-*oSjjn!#V0BR(6&_qIXDD4+&PdL7ndZh)0e4;%hwEJlv-JU>wZK|g1=gE*V z*52INJzaM!_+$Uqo#)Z&ZIp45_vvR-VoD_TwG?QX(f$*&#dPOXq`d2b8bh}Nj6;R9 zfYhRNPE$|WgM_g~A%cl{(UM`-UZBfs76y3HgDt4$WiS;()~BkbmE$||Y?idpKnyZj zJ*O^3A&uue#|ZU%`fU4(p-@*bR2QO}KmDxUeZ5xMp&|fyPKe0jT+^(Ab*>$7W)e%+ z>m+Mi{l1nh{3(^*ahLQKGIJ?$BufS`Lc)W(HEiJlUq2UDHhp?T>91mk@>~CC2pXj; zPEqqti!k9z1{dI=f^P*i$d%bMi`}|c9?)RV-+}k zNIRLcMnro;Z<83n9VYs&>g$*~X$t2IMUncpgu9;AajO`hpF`&@DkPt{qUn6_k|V-< zo}LH+XactW>WHz(cI3$eq=M(Q)opESz{a>NVZ->`YyEyWooXUs%DO_5vz>xJaC~v| zodk)DV!p^5?8q}~e4OCNv7rS2jI0v#5S@xUAMU~0q!|C~ecLX@t&%6z_4wsCwlr?D z{xVNVz4(d7_tu#&`jY+ZsY+O^lZkFLH&daa#n@#1?6c|E_=_*K)Fp$$Wh1aPSi+if zaKiX3aA8ZcD}O^cU_2lib9T-PT~9O?{bRtc*{C}_Cg@3&rZJmSW}>{ zQ{;~~>-{THUCLbjI>w+C$IutItFm8W5gD5{8??d2zUPQ}%@Rgbxjt;2R9=%-<>X&+ zTPR5kh*9wH!2i-16xN65{w)aFM_={P13-eUcpOKsGgoQs^H{~|T5S@Gk^<0$4TFC| zHYNR?F#;)>;dyfIU$L`1il{;Hh_7(LMf*=-vfGiS@MAE8m0|}IRZa1Q$#!Nt&N+~i zPOGKLBPL(SrYiMUhucZsyh@k~oArI*9;o;7_SNgVSh4I&wI*PB&voPMH}1iFL~W_} z$07FAHN$}C4I=C%o;K{%-0jON!D}Zo9>B=14%?1`_pB~HcZ7V*gQc4 z@)U1$G;nXeZ+kiz>Ld8-4UWg18$6dmszbaYGutN&o6b3n))cf=Gm1wTIeZ+?B3JK0 zzW&k=u{qI=`TEYwVNy<3-?d_N=0L@AEhTRQ_V{wo^z*ipN&>N>I-@e-fe7q%DuO{d zX>6YCg6%+;zbdr4WXJ3RY?QS8)E(yShhDV&w48+8ZlF&HEbBGxdb__%vN_uG;i4D6w zwd3AD%#8O893Wa`v5;Xd5S;)_QSuoFk)>$QqR|KCw5VZQigLQq(6Gd$3FvkUkBmaL zp=)Kr6Z%CQwrZ_-Li>-F5d=}l`fTMMPr4U! z^|CC0%@AhSMLn=gqd)xGX$4H!+>?+VE#K>nFQ>bRog^=fQmOtdJ6p4GcRtJ@U+AxN z_KutXb-0}ABcI`si?8Nqj-k88A~*ZSfsG=4c{;~Iiw#ms^%T|`W!2dyfQyoWxhcQ& z*Oon{u)TO;otP(dmWq}^hmmDIEn!{hQk0af$|>Xv%-)n+Y7Pd=-Jy{}W%-RDMZX+4 za#pD|F%p80`BNWOjt~+u?e`5OArX$*j~?CTd=ACxiz}+tu^%R~ zd{TbM62Ba=^T-y0tyRD*ugE0+${UTn-6FU&Qj8@#UEL7;nAm4y5)%z3E`-R}fitDc z#sB&!+hduS+$Hyp6Oy&zCX?JMar3^!ew_iL<9-#J#lQ-iH%*;*ffJ2{yAy`T2k`%q zo$fY~A5>jABW}P|SqbdGby8?@>OO|$s)mw|jqPUP6|98OaVrXkOjm}x_DJB;|JYV* zU~!xgB;gdxkLd9 zC1oT}V#z9OYwERjR|0DJuJ(qbFL#oFZ>`@utSi~QrM)9*}H&aI> zoXM(^d6R&r*X>VB*o|@d`)Z0vwb_chkh-D7hxUGQ^A9e6DKQYCA^+YY`LFRa=YQrup)sX=a+*m8%e^cn*a?eM>L=iQjWCEks7@t zVXC0un{zaH$*T%-IWv`U4NdJEyHcZ4GLc${~BUBsQP#sRbS4PFPBaApuhA z;^L1vH*O|{;=d5w?l8wVo%d}GJQC-6^?zdnbE8nIbuMlG)#OK;e(}CW23!ur%!?`4 zX4%KL%dQ9(cGW%vLlxOzhqVbq zq9?CtGiI2#As-K&FTbb?j(3f2B}Sdit|Vg7R_?ZI_){LD-_4L)AM>B8^e%o8q}CBx zN07Nd`+aD5EVBWPx-Qk)4gK$ah$eOyr(y-21@3+Pu z81257OMq9OqaJJ<$L_Jpvi<`o^8QVf`Jy`gZTj0;U-Fcu5mxy4j+uxbEtXMc8FroS zSTy7}oAcM}O!aXQ~l1#4R;)8neH9ljE9 z^eJb30BS;!`F_qod!0>bBx64VkCMQY4S@y?R-1(WlCSgtJ#w zM_=sH`<%}WJB*8z1zB)=F-xnddjW{?%RD0&(UI0MaDcTYP4uHd+6r6s9a26|P6HH_cWTUQqhoh4)54l$LL*dz%2aW7#^ zz*CGHdkyU)8)-9jGL|k-jI!QmHV8Xw9u0+D2^ewjCDBh6EsDv2lzYAwzRW3?rZAwl zRFhT2-$^7>I6MzDDGAdd0h$5T+Hn*H6{J5~4@W=%XH$K6((C9Dx1!E{tqkuj6+m3DdeI5w|9 z8drzMBt|f0|pWFaiZ&KMHC$i=g^vepuCjTnr4_ohxjgX zwjc`h*osmk?mICtV@!IdvRyt2Ng#Fq_vzi&M(Kzh$tUEeYB(oTcw<^5uLxzS z9tK8HcD%VxsVvVv`O_cp7SjUe(#r|H2c8#lkP>}(5&sDvCoTrS6RW;IS7>LDA=$UO zy;+4%5!iDv_hQeRgt2t12)RE@E) zjrTzeL7PHt&BDA+*cFmE#`Qe#-qaf~e7umvEI$QMcJMy-(Xyu4ZdlWzmRDdef~>7^ z9Gfu)*_{SkEd#fCLotF^%)HbtK*g7_PIk|2OL8a(1!y=p_7-76k&%s1Wy)|iSG;ZzS-vZ#QyM=>E8kKz-_e5z0w`%HNqkF?|dwQMa<%4 z1@owopYv~*Dg$nbF4yu8iE5HJJ9LF7#z>4&;678s&7aA!Np#*Si<^J~4~M{s;lJ3m!on(+Jjsk? zcMJ6FbMAvZ1#^xkK2>-voIb6SrvAw1Wk8wspuONm(N6nraRbA8zyCPWW)WzYN_}1% z+a!+qXG7lIkc4H6rj3*TcZT+?B=Qia=MmYsrMyJ1NN8L#x=Xd_nH#xVM82a52DB74 zJm`V07S%R{+0pStpPZ>jkyEYVN`E!Kjy}3Ne7L%pmiu9!UGcoK^?4k1q^qgO^!#c9 zyUFqfhHa;sxxy-YUt4ovzVxjQRPaX59y8GV?2C<48V_(q6pvC>gifQWwTYVMNBt*0 zNe%$z=v)A;c~k2eH4U`>QkK4e04r8Fn;uK-xnzX;;yfGg!}_z7&li3)p+Fd%n8CL) z9_ddRK6qA7g&4M>yd_WKgpppvH?=m#NsPQEXCVBOB#f?&VgIO7D^%mk|MFZ(nIYqS zmcxuuTBCZ7&W0*E(jXQHOaHl%QF5fnqpUMn(dJY_P{*$v3022e;*QVH|H4@RADQJr z+*wSlu>6Fq@Owyg17ps7PZ-NxjUMGF4E(Z~rJ*<&~Xgk{u;-QH9= z-dO4?ydrsEs$1s;#8P*+QcjE$D(rLs)-5Y_L13NpoawDXyy^CZM21xL8%CZuHT288m- zqcFX)o*&4doasjmP|LEIp~v67BZ~Ho?uqksVeMi*jhCBGzP_FQ=E1u>RvydgVS_kF z9UBvky|5Je4$hRFc_CzQlf?d`6o*rVGa`IW332tIMa!cq=9?hX@4cFlsTV?t>_w&6 zq8y^O%uFxkUY$uMv3Z6%T3iD~qdTOVxXY)W*4kYx6v~f0@_*@7*=hD1iT^-#K`J54 z<0H^t@hB2DK>}|nqxuMDEetxX6>+g{!dtUZJO!Hq$HUjj+y;Nvd}_PuV|gN(7bZ7Xsb{1wUP>3?!uR)f;*0$*29Y6=Kgd3Pn2P)$ zdM+BW!_1~6K#*c+Q_Uk@!UcPBnU<Op(zetCZ$_U!Le6}^d99qTa3uI4Znm~BxZA2Dk&6ZOE zrQ)=Kn8-O$-j74a#W3YJ;ya$UG=LHY)mQ zAK6dUccnZ`6Ikxw-qJCI1dhbq=ePvqvR8TFurbF?{ugV%F9>KbHoVh~77pelHpkCG zu>$JuT{KnM+JqfSwCY{?fZ=L*GaF6YTAajA;~tZw7>8cM{(N)r#JJ}BbQxsKPI?}p wEmWM=R9&;`L>le4{l#AvN|i^%w@?2v5gDnF&n5BizXqVLqOIKU+9v$}0QCf35dZ)H diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index a427f08..0000000 --- a/docs/README.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -home: true -heroImage: /home.png -actionText: 快速上手 → -actionLink: /guide/getting-started -features: -- title: 基于BaiduMap - details: 所有BaiduMap提供的API在这里你都能使用。 -- title: 组件化 - details: 就像使用React组件一样使用它。 -- title: 提供常用组件 - details: 覆盖部分业务场景,引入即用。 -footer: MIT Licensed | Copyright © 2018-present JserWang ---- - -### 还原你最熟悉的方式 - -``` js - - - - -``` \ No newline at end of file diff --git a/docs/api/README.md b/docs/api/README.md deleted file mode 100644 index ebdd6de..0000000 --- a/docs/api/README.md +++ /dev/null @@ -1,113 +0,0 @@ -# 通用规则 - -在接下来的 API 的类型中,您会看到类型为`Icon`、`Size`、`Point`、`ContextMenu`的类型,在此为您统一解释。 - -## Point - -```ts -{ - [lng: number], // 经度 - [lat: number], // 维度 -} -``` - -## Size - -```ts -{ - [height: number], // 高度 - [width: number], // 宽度 -} -``` - -## Icon - -```ts -{ - [url: string], // icon url地址 - [size: Size], // 图标可视区域的大小 - [opts: IconOptions]: { - [anchor: ControlAnchor], // 图标的定位点相对于图标左上角的偏移值 - [imageSize: Size], // 图片的大小,同CSS中background-size。 - [imageOffset: Size], // 图片相对于可视区域的偏移值,同CSS中background-position - [infoWindowAnchor: Size], // 信息窗口开启位置相对于图标左上角的偏移值 - [printImageUrl: string], // 设置icon打印图片的url,该打印图片只针对IE6有效 - } -} -``` - -## ContextMenu - -`items`为数组 - -```ts -{ - [items: ContextMenuItem[]]: [ - { - [text: string], // 设置菜单项显示的文本 - [callback: Function], // 菜单项被点击回调函数 - [separator: boolean], // 是否显示分隔线 - [width: number], // 指定此菜单项的宽度 - [iconUrl: string], // 指定此菜单项的icon URL(大小为17px*17px) - [disabled: boolean] // 是否禁用 - } - ] -} -``` - -## Enum - -每个`Enum`类型均为对应常量,您可以通过点击其链接来查看常量中具体包含值 - -## RenderOption - -```ts -{ - [panel: string | HTMLElement], // 结果列表的HTML容器id或容器元素,提供此参数后,结果列表将在此容器中进行展示。此属性对LocalCity无效。驾车路线规划无效 - [selectFirstResult: boolean], // 是否选择第一个检索结果。此属性仅对LocalSearch有效 - [autoViewport: boolean], // 检索结束后是否自动调整地图视野。此属性对LocalCity无效 -} -``` - -## DrawingOption - -```ts -{ - [strokeColor: string], //边线颜色。 - [fillColor: string], //填充颜色。当参数为空时,圆形将没有填充效果。 - [strokeWeight: number], //边线的宽度,以像素为单位。 - [strokeOpacity: number], //边线透明度,取值范围0 - 1。 - [fillOpacity: number], //填充的透明度,取值范围0 - 1。 - [strokeStyle: string], //边线的样式,solid或dashed。 -} -``` - -## Bounds - -```ts -{ - ne: Point; - sw: Point; -} -``` - -## CopyRight - -```ts -{ - [anchor: Enum], // 定位 - [offset: Size], // 偏移值 - [content: string], // 显示内容 - [bounds: Bounds], // 所适用的地理区域 -} -``` - -## HeatPoint - -```ts -{ - [lng: number], // 经度 - [lat: number], // 纬度 - [count: number], // 热度 -} -``` diff --git a/docs/api/autocomplete.md b/docs/api/autocomplete.md deleted file mode 100644 index 6722331..0000000 --- a/docs/api/autocomplete.md +++ /dev/null @@ -1,36 +0,0 @@ -# AutoComplete - -## input - -- 类型:`string | HTMLElement` -- 默认值:`undefined` -- 描述:文本输入框元素或其 id - -## events - -- 类型:`Object` -- 默认值:`undefined` -- 描述:绑定事件 - -| 事件 | 描述 | -| ----------- | ---------------------------------- | -| onconfirm | 回车选中某条记录后触发 | -| onhighlight | 键盘或者鼠标移动,某条记录高亮之后 | - -## searchComplete - -- 类型:`Function` -- 默认值:`undefined` -- 描述:在 input 框中输入字符后,发起列表检索,完成后的回调函数 - -## value - -- 类型:`string` -- 默认值: `undefined` -- 描述:设置绑定文本框中的值 - -## location - -- 类型: `string | Point` -- 默认值:`当前地图示例` -- 描述:设置返回结果的所属范围。 diff --git a/docs/api/boundary.md b/docs/api/boundary.md deleted file mode 100644 index f312362..0000000 --- a/docs/api/boundary.md +++ /dev/null @@ -1,90 +0,0 @@ -# Boundary - -## name - -- 类型 `string` -- 默认值 `undefined` -- 描述 行政区域名字 - -## onError - -- 类型 `Function` -- 默认值 `undefined` -- 描述 初始化失败回调 - -## autoViewport - -- 类型 `boolean` -- 默认值 `undefined` -- 描述 加完成后是否自动移动 - -## strokeColor - -- 类型 `string` -- 默认值 `undefined` -- 描述 边线颜色 - -## fillColor - -- 类型 `string` -- 默认值 `undefined` -- 描述 填充颜色。当参数为空时,圆形将没有填充效果 - -## strokeWeight - -- 类型:`number` -- 默认值:`undefined` -- 描述:边线的宽度,以像素为单位 - -## strokeOpacity - -- 类型:`number` -- 默认值:`undefined` -- 描述:边线透明度,取值范围 0 - 1 - -## fillOpacity - -- 类型:`number` -- 默认值:`undefined` -- 描述:填充的透明度,取值范围 0 - 1 - -## strokeStyle - -- 类型:`string` -- 默认值:`undefined` -- 描述:边线的样式,solid 或 dashed - -## massClear - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否在调用 map.clearOverlays 清除此覆盖物 - -## editing - -- 类型:`boolean` -- 默认值:`false` -- 描述:是否启用线编辑 - -## clicking - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否响应点击事件 - -## events - -- 类型:`Object` -- 默认值:`undefined` -- 描述:[绑定事件](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a7b54) - -| 事件 | 参数 | 描述 | -| ---------- | --------------------------------- | ---------------------------------- | -| click | event{type, target, point, pixel} | 点击多边形后会触发此事件 | -| dblclick | event{type, target, point, pixel} | 双击多边形后会触发此事件 | -| mousedown | event{type, target, point, pixel} | 鼠标在多边形上按下触发此事件 | -| mouseup | event{type, target, point, pixel} | 鼠标在多边形释放触发此事件 | -| mouseout | event{type, target, point, pixel} | 鼠标离开多边形时触发此事件 | -| mouseover | event{type, target, point, pixel} | 当鼠标进入多边形区域时会触发此事件 | -| remove | event{type, target} | 移除多边形时触发 | -| lineupdate | event{type, target} | 覆盖物的属性发生变化时触发 | diff --git a/docs/api/busLineSearch.md b/docs/api/busLineSearch.md deleted file mode 100644 index 7c86ead..0000000 --- a/docs/api/busLineSearch.md +++ /dev/null @@ -1,55 +0,0 @@ -# BusLineSearch - -## location - -- 类型:`Map | String` | [Point](/api/#point) -- 默认值:当前地图示例 -- 描述:表示检索区域,类型可为地图实例、坐标点或城市名称的字符串。当参数为地图实例时,检索位置由当前地图中心点确定;当参数为坐标时,检索位置由该点所在位置确定;当参数为城市名称时,检索会在该城市内进行 - -## renderOptions - -- 类型:[RenderOption](/api/#renderoption) -- 默认值:`undefined` -- 描述:搜索结果呈现的配置 - -## onGetBusListComplete - -- 类型:`Function` -- 默认值:`undefined` -- 描述:设置公交列表查询后的回调函数 - -## onGetBusLineComplete - -- 类型:`Function` -- 默认值:`undefined` -- 描述:设置公交线路查询后的回调函数 - -## onBusListHtmlSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:公交列表结果页渲染后回调函数 - -## onBusLineHtmlSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:公交线路结果页渲染后回调函数 - -## onPolylinesSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述 添加公交线时候回调函数 - -## onMarkersSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:添加公交站点时候回调函数 - -## showInMap - -- 类型:`boolean` -- 默认值:`false` -- 描述:用来表示是否将查询结果渲染至地图中 diff --git a/docs/api/circle.md b/docs/api/circle.md deleted file mode 100644 index 3ee0587..0000000 --- a/docs/api/circle.md +++ /dev/null @@ -1,84 +0,0 @@ -# Circle - -## point - -- 类型:[Point](/api/#point) -- 默认值:`undefined` -- 描述:指定位置的坐标 - -## radius - -- 类型:`number` -- 默认值:`undefined` -- 描述:圆角大小 - -## strokeColor - -- 类型:`string` -- 默认值:`undefined` -- 描述:圆形边线颜色 - -## fillColor - -- 类型:`string` -- 默认值:`undefined` -- 描述:圆形填充颜色。当参数为空时,圆形将没有填充效果 - -## strokeWeight - -- 类型:`number` -- 默认值:`undefined` -- 描述:圆形边线的宽度,以像素为单位 - -## strokeOpacity - -- 类型:`number` -- 默认值:`undefined` -- 描述:圆形边线透明度,取值范围 0 - 1 - -## fillOpacity - -- 类型:`number` -- 默认值:`undefined` -- 描述:圆形填充的透明度,取值范围 0 - 1 - -## strokeStyle - -- 类型:`string` -- 默认值:`undefined` -- 描述:圆形边线的样式,solid 或 dashed - -## massClear - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否在调用 map.clearOverlays 清除此覆盖物 - -## editing - -- 类型:`boolean` -- 默认值:`false` -- 描述:是否启用线编辑 - -## clicking - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否响应点击事件 - -## events - -- 类型:`Object` -- 默认值:`undefined` -- 描述:[绑定事件](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b16) - -| 事件 | 参数 | 描述 | -| ---------- | --------------------------------- | ------------------------------------ | -| click | event{type, target, point, pixel} | 鼠标点击圆形后会触发此事件 | -| dblclick | event{type, target, point, pixel} | 鼠标双击圆形后会触发此事件 | -| mousedown | event{type, target, point, pixel} | 鼠标在圆形上按下触发此事件 | -| mouseup | event{type, target, point, pixel} | 鼠标在圆形释放触发此事件 | -| mouseout | event{type, target, point, pixel} | 鼠标离开圆形时触发此事件 | -| mouseover | event{type, target, point, pixel} | 当鼠标进入圆形区域时会触发此事件 | -| remove | event{type, target} | 移除圆形时触发此事件 | -| lineupdate | event{type, target} | 圆形覆盖物的属性发生变化时触发此事件 | diff --git a/docs/api/cityList.md b/docs/api/cityList.md deleted file mode 100644 index 6f20ddb..0000000 --- a/docs/api/cityList.md +++ /dev/null @@ -1,25 +0,0 @@ -# CityList - -## anchor - -- 类型:[Enum](/guide/constants.html#controlanchor) -- 默认值:[ControlAnchor](/guide/constants.html#controlanchor).TOP_LEFT -- 描述:控件的停靠位置 - -## offset - -- 类型:[Size](/api/#size) -- 默认值:`{ width: 0, height: 0 }` -- 描述:控件的偏移值 - -## onChangeBefore - -- 类型:`Function` -- 默认值:`undefined` -- 描述:切换城市之前回调函数 - -## onChangeAfter - -- 类型:`Function` -- 默认值:`undefined` -- 描述:切换城市之后回调函数 diff --git a/docs/api/copyright.md b/docs/api/copyright.md deleted file mode 100644 index 613d8f1..0000000 --- a/docs/api/copyright.md +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright - -## anchor - -- 类型:[Enum](/guide/constants.html#controlanchor) -- 默认值:[ControlAnchor](/guide/constants.html#controlanchor).BOTTOM_LEFT -- 描述:控件的停靠位置 - -## offset - -- 类型:[Size](/api/#size) -- 默认值:`{ width: 0, height: 0 }` -- 描述:控件的偏移值 - -## content - -- 类型:`string | HTMLElement` -- 默认值:`undefined` -- 描述:该版权的文本信息,用于显示在地图上,支持 HTML 内容 diff --git a/docs/api/curveLine.md b/docs/api/curveLine.md deleted file mode 100644 index 54f6153..0000000 --- a/docs/api/curveLine.md +++ /dev/null @@ -1,57 +0,0 @@ -# CurveLine - -## points - -- 类型:[Point](/api/#point)[] -- 默认值:`undefined` -- 描述:抛物线数据对象 - -## strokeColor - -- 类型:`string` -- 默认值:`undefined` -- 描述:折线颜色 - -## strokeWeight - -- 类型:`number` -- 默认值:`undefined` -- 描述:折线的宽度,以像素为单位 - -## strokeOpacity - -- 类型:`number` -- 默认值:`undefined` -- 描述:折线的透明度,取值范围 0 - 1 - -## strokeStyle - -- 类型:`string` -- 默认值:`undefined` -- 描述:折线的样式,solid 或 dashed - -## massClear - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否在调用 map.clearOverlays 清除此覆盖物,默认为 true - -## clicking - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否响应点击事件,默认为 true - -## editing - -- 类型:`boolean` -- 默认值:`false` -- 描述:是否使用编辑功能 - -## events - -- 属性 `Object` -- 默认值 `undefined` -- 描述 [绑定事件](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b11) - -事件同`Polyline`事件 diff --git a/docs/api/distanceTool.md b/docs/api/distanceTool.md deleted file mode 100644 index 896ed21..0000000 --- a/docs/api/distanceTool.md +++ /dev/null @@ -1,54 +0,0 @@ -# DistanceTool - -## followText - -- 类型:`string` -- 默认值:`"单击确定地点,双击结束"` -- 描述:测距过程中,提示框文字 - -## unit - -- 类型:`string` -- 默认值:`"metric"` -- 描述:测距结果所用的单位制,"metric"表示米制,"us"表示美国传统单位 - -## lineColor - -- 类型:`string` -- 默认值:`"#ff6319"` -- 描述:折线颜色 - -## lineStroke - -- 类型:`number` -- 默认值:`2` -- 描述:折线线宽 - -## opacity - -- 类型:`number` -- 默认值:`0.8` -- 描述:折线透明度 - -## lineStyle - -- 类型:`string` -- 默认值:`"solid"` -- 描述:`solid`或`dashed` - -## cursor - -- 类型:`string` -- 默认值:`"http://api.map.baidu.com/images/ruler.cur"` -- 描述:跟随的鼠标样式 - -## events - -- 类型:`Object` -- 默认值:`undefined` -- 描述:绑定事件 - -| 事件名 | 描述 | -| ---------- | ------------------------------------------ | -| onaddpoint | 测距过程中,每次点击底图添加节点时触发 | -| ondrawend | 测距时,每次双击底图结束当前测距折线时触发 | diff --git a/docs/api/drawingmanager.md b/docs/api/drawingmanager.md deleted file mode 100644 index 0549be1..0000000 --- a/docs/api/drawingmanager.md +++ /dev/null @@ -1,76 +0,0 @@ -# DrawingManager - -## anchor - -- 类型:[Enum](/guide/constants.html#controlanchor) -- 默认值:[ControlAnchor](/guide/constants.html#controlanchor).BOTTOM_RIGHT -- 描述 表示控件的定位,默认定位到右下角 - -## offset - -- 类型:[Size](/api/#size) -- 默认值:`{ width: 10, height: 10 }` -- 描述:标注的位置偏移值 - -## circleOptions - -- 类型:[DrawingOption](/api/#drawingoption) -- 默认值: - -```js -{ - strokeColor: "red", // 边线颜色。 - fillColor: "red", // 填充颜色。当参数为空时,圆形将没有填充效果。 - strokeWeight: 3, // 边线的宽度,以像素为单位。 - strokeOpacity: 0.8, // 边线透明度,取值范围0 - 1。 - fillOpacity: 0.6, // 填充的透明度,取值范围0 - 1。 - strokeStyle: "solid" // 边线的样式,solid或dashed。 -} -``` - -- 描述:所画圆可选参数 - -## polylineOptions - -- 类型:[DrawingOption](/api/#drawingoption) -- 默认值:同 `circleOptions` -- 描述:所画的线的可选参数 - -## PolygonOptions - -- 类型:[DrawingOption](/api/#drawingoption) -- 默认值:同 `circleOptions` -- 描述:所画的多边形的可选参数 - -## rectangleOptions - -- 类型:[DrawingOption](/api/#drawingoption) -- 默认值:同`circleOptions` -- 描述:所画的矩形的可选参数 - -## markerOptions - -- 类型:[DrawingOption](/api/#drawingoption) -- 默认值:同`circleOptions` -- 描述:所画的点的可选参数 - -## drawingModes - -- 类型:[Enum](/guide/constants.html#drawingmode)[] -- 默认值:`undefined` -- 描述:绘制工具支持绘制的图形 - -## events - -- 类型:`Object` -- 默认值:`undefined` -- 描述:绑定事件 - -| 事件名 | 描述 | -| ----------------- | ------------------ | -| circlecomplete | 绘制圆完成事件 | -| markercomplete | 绘制点完成事件 | -| overlaycomplete | 鼠标绘制完成事件 | -| polygoncomplete | 绘制多边形完成事件 | -| polylinecomplete | 绘制线完成事件 | -| rectanglecomplete | 绘制矩形完成事件 | diff --git a/docs/api/drivingRoute.md b/docs/api/drivingRoute.md deleted file mode 100644 index b241ee2..0000000 --- a/docs/api/drivingRoute.md +++ /dev/null @@ -1,49 +0,0 @@ -# DrivingRoute - -## location - -- 类型:`Map | String` | [Point](/api/#point) -- 默认值:当前地图示例 -- 描述:表示检索区域,类型可为地图实例、坐标点或城市名称的字符串。当参数为地图实例时,检索位置由当前地图中心点确定;当参数为坐标时,检索位置由该点所在位置确定;当参数为城市名称时,检索会在该城市内进行 - -## renderOptions - -- 类型:[RenderOption](/api/#renderoption) -- 默认值:`undefined` -- 描述:搜索结果呈现的配置 - -## policy - -- 类型:[Enum](/guide/constants.html#drivingpolicy) -- 默认值:[DrivingPolicy](/guide/constants.html#drivingpolicy).NORMAL -- 描述:驾车策略 - -## onSearchComplete - -- 类型:`Function` -- 默认值:`undefined` -- 描述:检索完成后的回调函数 - -## onMarkersSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:标注添加完成后的回调函数 - -## onInfoHtmlSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:标注气泡内容创建后的回调函数 - -## onPolylinesSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:折线添加完成后的回调函数 - -## showInMap - -- 类型:`boolean` -- 默认值:`false` -- 描述:用来表示是否将查询结果渲染至地图中 diff --git a/docs/api/geolocation.md b/docs/api/geolocation.md deleted file mode 100644 index 8a40de7..0000000 --- a/docs/api/geolocation.md +++ /dev/null @@ -1,42 +0,0 @@ -# Geolocation - -## anchor - -- 类型:[Enum](/guide/constants.html#controlanchor) -- 默认值:[ControlAnchor](/guide/constants.html#controlanchor).BOTTOM_LEFT -- 描述:控件的停靠位置,默认定位到地图的左下角 - -## offset - -- 类型:[Size](/api/#size) -- 默认值:`{ width: 0, height: 0 }` -- 描述:控件的水平偏移值 - -## showAddressBar - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否显示定位信息面板。 - -## autoLocation - -- 类型:`boolean` -- 默认值:`false` -- 描述:添加控件时是否进行定位。 - -## locationIcon - -- 类型:[Icon](/api/#icon) -- 默认值:`undefined` -- 描述:自定义定位中心点的 Icon 样式 - -## events - -- 类型:`Object` -- 默认值:`undefined` -- 描述:绑定事件 - -| 事件名 | 描述 | -| --------------- | -------------------- | -| locationSuccess | 定位成功后触发此事件 | -| locationError | 定位失败后触发此事件 | diff --git a/docs/api/ground.md b/docs/api/ground.md deleted file mode 100644 index f80f318..0000000 --- a/docs/api/ground.md +++ /dev/null @@ -1,42 +0,0 @@ -# Ground - -## bounds - -- 类型:[Bounds](/api/#bounds) -- 默认值:`undefined` -- 描述:设置图层显示的矩形区域 - -## imageURL - -- 类型:`string` -- 默认值:`undefined` -- 描述:图层地址 - -## opacity - -- 类型:`number` -- 默认值:`undefined` -- 描述:图层透明度 - -## maxZoom - -- 类型:`number` -- 默认值:`undefined` -- 描述:图层显示的最大级别 - -## minZoom - -- 类型:`number` -- 默认值:`undefined` -- 描述:图层显示的最小级别 - -## events - -- 类型:`Object` -- 默认值:`undefined` -- 描述 [绑定事件](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b18) - -| 事件 | 参数 | 描述 | -| -------- | ------------------- | -------------------------- | -| click | event{type, target} | 鼠标点击图层后会触发此事件 | -| dblclick | event{type, target} | 鼠标双击图层后会触发此事件 | diff --git a/docs/api/heatmap.md b/docs/api/heatmap.md deleted file mode 100644 index ea5c968..0000000 --- a/docs/api/heatmap.md +++ /dev/null @@ -1,31 +0,0 @@ -# Heatmap - -## points - -- 类型:[HeatPoint](/api/#heatpoint)[] -- 默认值:`undefined` -- 描述:热力图集合点 - -## opacity - -- 类型:`number` -- 默认值:`undefined` -- 描述:透明度,取值范围 1-100 - -## max - -- 类型:`number` -- 默认值:`undefined` -- 描述:权重最大值 - -## radius - -- 类型:`number` -- 默认值:`undefined` -- 描述:热力圆半径 - -## gradient - -- 类型:`Object` -- 默认值:`undefined` -- 描述:热力图渐变区间 diff --git a/docs/api/infowindow.md b/docs/api/infowindow.md deleted file mode 100644 index 860b1a1..0000000 --- a/docs/api/infowindow.md +++ /dev/null @@ -1,83 +0,0 @@ -# InfoWindow - -## title - -- 类型:`string` -- 默认值:`undefined` -- 描述:信息窗标题文字,支持 HTML 内容 - -## content - -- 类型:`string` -- 默认值:`undefined` -- 描述:信息窗显示文字,支持 HTML 内容 - -## point - -- 类型:[Point](/api/#point) -- 默认值:`undefined` -- 描述:显示位置坐标 - -## offset - -- 类型:[Size](/api/#size) -- 默认值:`undefined` -- 描述:信息窗位置偏移值 - -## width - -- 类型:`number` -- 默认值:`undefined` -- 描述:信息窗宽度,单位像素。取值范围:0, 220 - 730。如果您指定宽度为 0,则信息窗口的宽度将按照其内容自动调整 - -## height - -- 类型:`number` -- 默认值:`undefined` -- 描述:信息窗高度,单位像素。取值范围:0, 60 - 650。如果您指定高度为 0,则信息窗口的高度将按照其内容自动调整 - -## maxWidth - -- 类型:`number` -- 默认值:`undefined` -- 描述:信息窗最大化时的宽度,单位像素。取值范围:220 - 730 - -** 该属性仅在width: 0时生效 ** - -## autoPan - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否开启信息窗口打开时地图自动移动 - -## closeOnClick - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否开启点击地图关闭信息窗口 - -## displayMessage - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否在信息窗里显示短信发送按钮 - -## message - -- 类型:`string` -- 默认值:`true` -- 描述:自定义部分的短信内容 - -## events - -- 类型:`Object` -- 默认值:`undefined` -- 描述:[绑定事件](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b7) - -| 事件 | 参数 | 描述 | -| ---------- | -------------------------- | ---------------------------------- | -| close | event{type, target, point} | 信息窗口被关闭时触发此事件 | -| open | event{type, target, point} | 信息窗口被打开时触发此事件 | -| maximize | event{type, target} | 信息窗口最大化后触发此事件 | -| restore | event{type, target} | 信息窗口还原时触发此事件 | -| clickclose | event{type, target} | 点击信息窗口的关闭按钮时触发此事件 | diff --git a/docs/api/label.md b/docs/api/label.md deleted file mode 100644 index bd21642..0000000 --- a/docs/api/label.md +++ /dev/null @@ -1,60 +0,0 @@ -# Label - -## offset - -- 类型:[Size](/api/#size) -- 默认值:`{ width: 0, height: 0 }` -- 描述:文本标注的位置偏移值 - -## point - -- 类型:[Point](/api/#point) -- 默认值:`undefined` -- 描述:文本标注的位置 - -## massClear - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否在调用 map.clearOverlays 清除此覆盖物 - -## content - -- 类型:`string` -- 默认值:`undefined` -- 描述:显示标签 - -## title - -- 类型:`string` -- 默认值:`undefined` -- 描述:鼠标悬浮显示文字 - -## zIndex - -- 类型:`number` -- 默认值:`undefined` -- 描述:同 html 的 z-index - -## style - -- 类型:`Object` -- 默认值:`undefined` -- 描述:标签样式 - -## events - -- 类型:`Object` -- 默认值:`undefined` -- 描述:[绑定事件](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b9) - -| 事件 | 参数 | 描述 | -| ---------- | ------------------- | ------------------------------------ | -| click | event{type, target} | 点击文本标注后会触发此事件 | -| dblclick | event{type, target} | 双击文本标注后会触发此事件 | -| mousedown | event{type, target} | 鼠标在文本标注上按下触发此事件 | -| mouseup | event{type, target} | 鼠标在文本标注释放触发此事件 | -| mouseout | event{type, target} | 鼠标离开文本标注时触发此事件 | -| mouseover | event{type, target} | 当鼠标进入文本标注区域时会触发此事件 | -| remove | event{type, target} | 移除文本标注时触发 | -| rightclick | event{type, target} | 右键点击标注时触发此事件 | diff --git a/docs/api/localSearch.md b/docs/api/localSearch.md deleted file mode 100644 index 009f41c..0000000 --- a/docs/api/localSearch.md +++ /dev/null @@ -1,49 +0,0 @@ -# LocalSearch - -## location - -- 类型:`Map | String` | [Point](/api/#point) -- 默认值:当前地图示例 -- 描述:表示检索区域,类型可为地图实例、坐标点或城市名称的字符串。当参数为地图实例时,检索位置由当前地图中心点确定;当参数为坐标时,检索位置由该点所在位置确定;当参数为城市名称时,检索会在该城市内进行 - -## renderOptions - -- 类型:[RenderOption](/api/#renderoption) -- 默认值:`undefined` -- 描述:搜索结果呈现的配置 - -## onMarkersSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:标注添加完成后的回调函数 - -## onInfoHtmlSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:标注气泡内容创建后的回调函数 - -## onResultsHtmlSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:结果列表添加完成后的回调函数 - -## pageCapacity - -- 类型:`number` -- 默认值:`undefined` -- 描述:设置每页容量,取值范围:1 - 100,对于多关键字检索,容量表示每个关键字的数量,如果有 2 个关键字,则实际检索结果数量范围为:2 - 200 - -## onSearchComplete - -- 类型:`Function` -- 默认值:`undefined` -- 描述:检索完成后的回调函数 - -## showInMap - -- 类型:`boolean` -- 默认值:`false` -- 描述:用来表示是否将查询结果渲染至地图中 diff --git a/docs/api/map.md b/docs/api/map.md deleted file mode 100644 index e28f74c..0000000 --- a/docs/api/map.md +++ /dev/null @@ -1,214 +0,0 @@ -# Map - -## ak - -- 类型:`string` -- 默认值:`undefined` -- 描述:加载地图时所需 ak - -## center - -- 类型:[Point](/api/#point) -- 默认值:`{ lng: 116.404, lat: 39.915 }` -- 描述:设初始化地图中心点,默认值为 { lng: 116.404, lat: 39.915 } - -## zoom - -- 类型:`number` -- 默认值:`15` -- 描述:将视图切换到指定的缩放等级,中心点坐标不变。 - -## placeHolder - -- 类型:`string | ReactElement` -- 默认值:`"地图加载中..."` -- 描述:地图未加载完成时,展示内容 - -## mapMounted - -- 类型:`Function` --  默认值:`undefined` -- 描述:地图渲染完成后回调函数 - -## minZoom - -- 类型:`number` -- 默认值:`3` -- 描述:地图允许的最小级别,取值不得小于地图类型所允许的最小级别 - -## maxZoom - -- 类型:`number` -- 默认值:`19` -- 描述:地图允许的最大级别。取值不得大于地图类型所允许的最大级别 - -## defaultCursor - -- 类型:`string` -- 默认值:`undefined` -- 描述:设置地图默认的鼠标指针样式。参数 cursor 应符合 CSS 的 cursor 属性规范 - -## draggingCursor - -- 类型:`string` -- 默认值:`undefined` -- 描述:设置拖拽地图时的鼠标指针样式。参数 cursor 应符合 CSS 的 cursor 属性规范 - -## mapStyle - -- 类型:`Object` -- 默认值:`undefined` -- 描述:设置地图样式,样式包括地图底图颜色和地图要素是否展示两部分 -- 用法: - -若您使用[百度地图个性化模板时](http://lbsyun.baidu.com/custom/list.htm),可传递如下值: - -```js -{ - style: "midnight"; -} -``` - -若您使用[百度地图图形编辑工具](http://lbsyun.baidu.com/img-editor.html),可传递如下值: - -```js -{ - styleJson: mapStyle, -} -``` - -## mapType - -- 类型:[Enum](/guide/constants.html#maptype) -- 默认值:[MapType](/guide/constants.html#maptype).NORMAL -- 描述:设置地图类型 - -## highResolution - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否启用使用高分辨率地图 - -## autoResize - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否自动适应地图容器变化 - -## mapClick - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否开启底图可点功能 - -## dragging - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否启用地图拖拽 - -## scrollWheelZoom - -- 类型:`boolean` -- 默认值:`false` -- 描述:是否启用滚轮放大缩小 - -## doubleClickZoom - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否启用双击放大 - -## keyboard - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否启用键盘操作 - -## inertialDragging - -- 类型:`boolean` -- 默认值:`false` -- 描述:是否启用地图惯性拖拽 - -## continuousZoom - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否启用连续缩放效果 - -## pinchToZoom - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否启用双指操作缩放 - -## events - -- 类型:`Object` -- 默认值:`undefined` -- 描述:为地图[绑定事件](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a0b0) - -|事件| 参数| 描述| -|----|----|----| -|click| {type, target, point, pixel, overlay} |左键单击地图时触发此事件。 当双击时,产生的事件序列为: click click dblclick| -|dblclick| {type, target, pixel, point}| 鼠标双击地图时会触发此事件| -|rightclick| {type, target, point, pixel, overlay}| 右键单击地图时触发此事件。 当双击时,产生的事件序列为: rightclick rightclick rightdblclick| -|rightdblclick| {type, target, point, pixel, overlay} |右键双击地图时触发此事件| -|maptypechange |{type, target} |地图类型发生变化时触发此事件| -|mousemove| {type, target, point, pixel, overlay} |鼠标在地图区域移动过程中触发此事件| -|mouseover| {type, target} |鼠标移入地图区域时触发此事件| -|mouseout |{type, target}| 鼠标移出地图区域时触发此事件| -|movestart| {type, target} |地图移动开始时触发此事件| -|moving |{type, target} |地图移动过程中触发此事件| -|moveend| {type, target}| 地图移动结束时触发此事件| -|zoomstart |{type, target} |地图更改缩放级别开始时触发触发此事件| -|zoomend |{type, target} |地图更改缩放级别结束时触发触发此事件| -|addoverlay| {type, target} |当使用Map.addOverlay()方法向地图中添加单个覆盖物时会触发此事件| -|addcontrol| {type, target}| 当使用Map.addControl()方法向地图中添加单个控件时会触发此事件| -|removecontrol| {type, target}| 当使用Map.removeControl()方法移除单个控件时会触发此事件| -|removeoverlay| {type, target} |当使用Map.removeOverlay()方法移除单个覆盖物时会触发此事件| -|clearoverlays| {type, target} |当使用Map.clearOverlays()方法一次性移除全部覆盖物时会触发此事件| -|dragstart| {type, target, pixel, point}| 开始拖拽地图时触发| -|dragging |{type, target, pixel, point} |拖拽地图过程中触发| -|dragend |{type, target, pixel, point}| 停止拖拽地图时触发| -|addtilelayer| {type, target}| 添加一个自定义地图图层时触发此事件| -|removetilelayer| {type, target}| 移除一个自定义地图图层时触发此事件| -|load| {type, target, pixel, point, zoom} |调用Map.centerAndZoom()方法时会触发此事件。这表示位置、缩放层级已经确定,但可能还在载入地图图块| -|resize |{type, target, size} |地图可视区域大小发生变化时会触发此事件| -|hotspotclick|{type, target, spots} |点击热区时触发此事件| -|hotspotover| {type, target, spots}| 鼠标移至热区时触发此事件| -|hotspotout| {type, target, spots} |鼠标移出热区时触发此事件| -|tilesloaded| {type, target}| 当地图所有图块完成加载时触发此事件| -|touchstart| {type, target, point,pixel} |触摸开始时触发此事件,仅适用移动设备| -|touchmove| {type, target, point,pixel}| 触摸移动时触发此事件,仅适用移动设备| -|touchend| {type, target, point,pixel}| 触摸结束时触发此事件,仅适用移动设备| -|longpress| {type, target, point,pixel}| 长按事件,仅适用移动设备| - - -## contextMenu - -- 类型:[ContextMenu](/api/#contextmenu) -- 默认值:`undefined` -- 描述:为地图设置右键菜单 -- 用法: - -```js -{ - items: [ - { - text: "放大", - callback: function() { - global.bMapInstance.zoomIn(); - } - }, - { - text: "缩小", - callback: function() { - global.bMapInstance.zoomOut(); - }, - separator: true - } - ]; -} -``` diff --git a/docs/api/mapTypeCtrl.md b/docs/api/mapTypeCtrl.md deleted file mode 100644 index 547b3c0..0000000 --- a/docs/api/mapTypeCtrl.md +++ /dev/null @@ -1,25 +0,0 @@ -# MapTypeCtrl - -## anchor - -- 类型:[Enum](/guide/constants.html#controlanchor) -- 默认值:[ControlAnchor](/guide/constants.html#controlanchor).TOP_RIGHT -- 描述:控件的停靠位置 - -## offset - -- 类型:[Size](/api/#size) -- 默认值:`{ width: 10, height: 10 }` -- 描述:控件的偏移值 - -## type - -- 类型:[Enum](/guide/constants.html#maptypecontroltype) -- 默认值:[MapTypeControlType](/guide/constants.html#maptypecontroltype).HORIZONTAL -- 描述:控件样式 - -## mapTypes - -- 类型:[Enum](/guide/constants.html#maptype)[] -- 默认值:[[MapType](/guide/constants.html#maptype).NORMAL, [MapType](/guide/constants.html#maptype).PERSPECTIVE, [MapType](/guide/constants.html#maptype).SATELLITE, [MapType](/guide/constants.html#maptype).HYBRID] -- 描述:控件展示的地图类型,默认为普通图、卫星图、卫星加路网混合图和三维图。通过此属性可配置控件展示的地图类型 diff --git a/docs/api/marker.md b/docs/api/marker.md deleted file mode 100644 index 3c50973..0000000 --- a/docs/api/marker.md +++ /dev/null @@ -1,95 +0,0 @@ -# Marker - -## point - -- 类型:`Point` -- 默认值:`undefined` -- 描述:添加标注的位置 - -## offset - -- 类型:[Size](/api/#size) -- 默认值:`{ width: 0, height: 0 }` -- 描述:标注的位置偏移值 - -## icon - -- 类型:[Icon](/api/#icon) -- 默认值:`undefined` -- 描述:标注所用的图标对象 - -## massClear - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否在调用 map.clearOverlays 清除此覆盖物 - -## dragging - -- 类型:`boolean` -- 默认值:`false` -- 描述:是否启用拖拽 - -## clicking - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否响应点击事件 - -## raiseOnDrag - -- 类型:`boolean` -- 默认值:`false` -- 描述:拖拽标注时,标注是否开启离开地图表面效果 - -## draggingCursor - -- 类型:`string` -- 默认值:`undefined` -- 描述:拖拽标注时的鼠标指针样式 - -## rotation - -- 类型:`number` -- 默认值:`undefined` -- 描述:旋转角度 - -## shadow - -- 类型:[Icon](/api/#icon) -- 默认值:`undefined` -- 描述:阴影图标 - -## title - -- 类型:`string` -- 默认值:`undefined` -- 描述:鼠标移到 marker 上的显示内容 - -## contextMenu - -- 类型:[ContextMenu](/api/#contextmenu) -- 默认值:`undefined` -- 描述:右键菜单 - -## events - -- 类型:`Object` -- 默认值:`undefined` -- 描述:为[绑定事件](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference.html#a3b2) - -|事件 |参数 |描述| -|----|-----|-----| -|click| event{type, target}| 点击标注图标后会触发此事件| -|dblclick| event{type, target, point,pixel}| 双击标注图标后会触发此事件| -|mousedown |event{type, target, point,pixel} |鼠标在标注图上按下触发此事件| -|mouseup |event{type, target, point,pixel}| 鼠标在标注图上释放触发此事件| -|mouseout |event{type, target, point,pixel}| 鼠标离开标注时触发此事件| -|mouseover |event{type, target, point,pixel}| 当鼠标进入标注图标区域时会触发此事件| -|remove| event{type, target} |移除标注时触发| -|infowindowclose |event{type, target}| 信息窗在此标注上关闭时触发此事件| -|infowindowopen| event{type, target} |信息窗在此标注上打开时触发此事件| -|dragstart |event{type, target}| 开始拖拽标注时触发此事件| -|dragging| event{type, target, pixel, point} |拖拽标注过程中触发此事件| -|dragend| event{type, target, pixel, point} |拖拽结束时触发此事件| -|rightclick |event{type, target} |右键点击标注时触发此事件| diff --git a/docs/api/markerClusterer.md b/docs/api/markerClusterer.md deleted file mode 100644 index ee0b78d..0000000 --- a/docs/api/markerClusterer.md +++ /dev/null @@ -1,31 +0,0 @@ -# MarkerClusterer - -## gridSize - -- 类型:`number` -- 默认值:`60` -- 描述:网格大小 - -## maxZoom - -- 类型:`number` -- 默认值:`undefined` -- 描述:聚合的最大缩放级别 - -## minClusterSize - -- 类型:`number` -- 默认值:`2` -- 描述:单个聚合的最小数量 - -## styles - -- 类型:`Array` -- 默认值:`undefined` -- 描述:聚合样式的风格集合 - -## averageCenter - -- 类型:`boolean` -- 默认值:`false` -- 描述:单个聚合的落脚点是否是聚合内所有标记的平均中心 diff --git a/docs/api/navigation.md b/docs/api/navigation.md deleted file mode 100644 index dbc95f0..0000000 --- a/docs/api/navigation.md +++ /dev/null @@ -1,31 +0,0 @@ -# Navigation - -## anchor - -- 类型:[Enum](/guide/constants.html#controlanchor) -- 默认值:[ControlAnchor](/guide/constants.html#controlanchor).TOP_LEFT -- 描述:控件的停靠位置 - -## offset - -- 类型:[Size](/api/#size) -- 默认值:`{ width: 10, height: 10 }` -- 描述:控件的水平偏移值 - -## type - -- 类型:[Enum](/guide/constants.html#navigationtype) -- 默认值:[NavigationType](/guide/constants.html#navigationtype).LARGE -- 描述:平移缩放控件的类型 - -## showZoomInfo - -- 类型:`boolean` -- 默认值:`true` -- 描述 是否显示级别提示信息 - -## geolocation - -- 类型:`boolean` -- 默认值:`false` -- 描述:控件是否集成定位功能 diff --git a/docs/api/overviewMap.md b/docs/api/overviewMap.md deleted file mode 100644 index 9c56a31..0000000 --- a/docs/api/overviewMap.md +++ /dev/null @@ -1,36 +0,0 @@ -# OverviewMap - -## anchor - -- 类型:[Enum](/guide/constants.html#controlanchor) -- 默认值:[ControlAnchor](/guide/constants.html#controlanchor).BOTTOM_LEFT -- 描述:控件的停靠位置,默认定位到地图的右下角 - -## offset - -- 类型:[Size](/api/#size) -- 默认值:`{ width: 0, height: 0 }` -- 描述:控件的偏移值 - -## size - -- 类型:[Size](/api/#size) -- 默认值:`{ width: 150, height: 150 }` -- 描述:缩略地图控件的大小 - -## isOpen - -- 类型:`boolean` -- 默认值:`false` -- 描述:缩略地图添加到地图后的开合状态 - -## events - -- 类型:`Object` -- 默认值:`undefined` -- 描述:[绑定事件](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a2b7) - -| 事件 | 描述 | -| ------------ | ---------------------------------------- | -| viewchanged | 缩略地图开合状态发生变化后触发此事件 | -| viewchanging | 缩略地图开合状态发生变化过程中触发此事件 | diff --git a/docs/api/panorama.md b/docs/api/panorama.md deleted file mode 100644 index 86eb4f6..0000000 --- a/docs/api/panorama.md +++ /dev/null @@ -1,13 +0,0 @@ -# Panorama - -## anchor - -- 类型:[Enum](/guide/constants.html#controlanchor) -- 默认值:[ControlAnchor](/guide/constants.html#controlanchor).TOP_RIGHT -- 描述:控件的停靠位置 - -## offset - -- 类型:[Size](/api/#size) -- 默认值:`{ width: 0, height: 0 }` -- 描述:控件的偏移值 diff --git a/docs/api/pointcollection.md b/docs/api/pointcollection.md deleted file mode 100644 index 0b5fe47..0000000 --- a/docs/api/pointcollection.md +++ /dev/null @@ -1,37 +0,0 @@ -# PointCollection - -## points - -- 类型:[Point](/api/#point)[] -- 默认值:`undefined` -- 描述:点集合 - -## shape - -- 类型:[Enum](/guide/constants.html#shapetype) -- 默认值:`undefined` -- 描述:海量点的预设形状 - -## size - -- 类型:[Enum](/guide/constants.html#sizetype) -- 默认值:`undefined` -- 描述:海量点的预设尺寸 - -## color - -- 类型:`string` -- 默认值:`'#fa937e'` -- 描述:海量点的颜色 - -## events - -- 类型:`Object` -- 默认值:`undefined` -- 描述:[绑定事件](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b20) - -| 事件 | 参数 | 描述 | -| --------- | ------------------------- | ------------------------ | -| click | event{type, target,point} | 鼠标点击点时会触发此事件 | -| mouseover | event{type, target,point} | 鼠标移入点时会触发该事件 | -| mouseout | event{type, target,point} | 鼠标移出点时会触发该事件 | diff --git a/docs/api/polygon.md b/docs/api/polygon.md deleted file mode 100644 index 3e405bd..0000000 --- a/docs/api/polygon.md +++ /dev/null @@ -1,78 +0,0 @@ -# Polygon - -## point - -- 类型:[Point](/api/#point)[] -- 默认值:`undefined` -- 描述:指定位置的坐标 - -## strokeColor - -- 类型:`string` -- 默认值:`undefined` -- 描述:边线颜色 - -## fillColor - -- 类型:`string` -- 默认值:`undefined` -- 描述:填充颜色。当参数为空时,圆形将没有填充效果 - -## strokeWeight - -- 类型:`number` -- 默认值:`undefined` -- 描述:边线的宽度,以像素为单位 - -## strokeOpacity - -- 类型:`number` -- 默认值:`undefined` -- 描述:边线透明度,取值范围 0 - 1 - -## fillOpacity - -- 类型:`number` -- 默认值:`undefined` -- 描述:填充的透明度,取值范围 0 - 1 - -## strokeStyle - -- 类型:`string` -- 默认值:`undefined` -- 描述:边线的样式,solid 或 dashed - -## massClear - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否在调用 map.clearOverlays 清除此覆盖物 - -## editing - -- 类型:`boolean` -- 默认值:`false` -- 描述:是否启用线编辑 - -## clicking - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否响应点击事件 - -## events - -- 类型:`Object` -- 默认值:`true` -- 描述:[绑定事件](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b14) - -| 事件 | 参数 | 描述 | -| ---------- | --------------------------------- | ---------------------------------- | -| click | event{type, target, point, pixel} | 点击多边形后会触发此事件 | -| dblclick | event{type, target, point, pixel} | 双击多边形后会触发此事件 | -| mousedown | event{type, target, point, pixel} | 鼠标在多边形上按下触发此事件 | -| mouseup | event{type, target, point, pixel} | 鼠标在多边形释放触发此事件 | -| mouseout | event{type, target, point, pixel} | 鼠标离开多边形时触发此事件 | -| mouseover | event{type, target, point, pixel} | 当鼠标进入多边形区域时会触发此事件 | -| remove | event{type, target} | 移除多边形时触发 | -| lineupdate | event{type, target} | 覆盖物的属性发生变化时触发 | diff --git a/docs/api/polyline.md b/docs/api/polyline.md deleted file mode 100644 index 7eb3066..0000000 --- a/docs/api/polyline.md +++ /dev/null @@ -1,72 +0,0 @@ -# Polyline - -## points - -- 类型:[Point](/api/#point)[] -- 默认值:`undefined` -- 描述:指定位置的坐标 - -## strokeColor - -- 类型:`string` -- 默认值:`undefined` -- 描述:折线颜色 - -## strokeWeight - -- 类型:`number` -- 默认值:`undefined` -- 描述:折线的宽度,以像素为单位 - -## strokeOpacity - -- 类型:`number` -- 默认值:`undefined` -- 描述:折线的透明度,取值范围 0 - 1 - -## strokeStyle - -- 类型:`string` -- 默认值:`undefined` -- 描述:折线的样式,solid 或 dashed - -## massClear - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否在调用 map.clearOverlays 清除此覆盖物 - -## editing - -- 类型:`boolean` -- 默认值:`false` -- 描述:是否启用线编辑 - -## clicking - -- 类型:`boolean` -- 默认值:`true` -- 描述:是否响应点击事件 - -## icons - -- 类型:`array` -- 默认值:`[]` -- 描述:绘制折线(轨迹)可加入纹理(箭头/方向), 在mapMounted生命周期中获取BMap对象,参照[官方文档](http://lbsyun.baidu.com/jsdemo.htm#c1_25)创建IconSequence实例 - -## event - -- 类型:`Object` -- 默认值:`undefined` -- 描述:[绑定事件](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b11) - -| 事件 | 参数 | 描述 | -| ---------- | --------------------------------- | -------------------------------- | -| click | event{type, target, point, pixel} | 点击折线后会触发此事件 | -| dblclick | event{type, target, point, pixel} | 双击折线后会触发此事件 | -| mousedown | event{type, target, point, pixel} | 鼠标在折线上按下触发此事件 | -| mouseup | event{type, target, point, pixel} | 鼠标在折线释放触发此事件 | -| mouseout | event{type, target, point, pixel} | 鼠标离开折线时触发此事件 | -| mouseover | event{type, target, point, pixel} | 当鼠标进入折线区域时会触发此事件 | -| remove | event{type, target} | 移除折线时触发 | -| lineupdate | event{type, target} | 覆盖物的属性发生变化时触发 | diff --git a/docs/api/ridingRoute.md b/docs/api/ridingRoute.md deleted file mode 100644 index 66054cf..0000000 --- a/docs/api/ridingRoute.md +++ /dev/null @@ -1,49 +0,0 @@ -# RidingRoute - -## location - -- 类型:`Map | String` | [Point](/api/#point) -- 默认值:当前地图示例 -- 描述:表示检索区域,类型可为地图实例、坐标点或城市名称的字符串。当参数为地图实例时,检索位置由当前地图中心点确定;当参数为坐标时,检索位置由该点所在位置确定;当参数为城市名称时,检索会在该城市内进行 - -## renderOptions - -- 类型:[RenderOption](/api/#renderoption) -- 默认值:`undefined` -- 描述:搜索结果呈现的配置 - -## onSearchComplete - -- 类型:`Function` -- 默认值:`undefined` -- 描述:检索完成后的回调函数 - -## onMarkersSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:标注添加完成后的回调函数 - -## onPolylinesSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:折线添加完成后的回调函数 - -## onInfoHtmlSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:标注气泡内容创建后的回调函数 - -## onResultsHtmlSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:结果列表添加完成后的回调函数 - -## showInMap - -- 类型:`boolean` -- 默认值:`false` -- 描述:用来表示是否将查询结果渲染至地图中 diff --git a/docs/api/scale.md b/docs/api/scale.md deleted file mode 100644 index b5bb665..0000000 --- a/docs/api/scale.md +++ /dev/null @@ -1,19 +0,0 @@ -# Scale - -## anchor - -- 类型:[Enum](/guide/constants.html#controlanchor) -- 默认值:[ControlAnchor](/guide/constants.html#controlanchor).TOP_LEFT -- 描述:控件的停靠位置 - -## offset - -- 类型:[Size](/api/#size) -- 默认值:`{ width: 81, height: 18 }` -- 描述:控件的偏移值 - -## unit - -- 类型:[Enum](/guide/constants.html#lengthunit) -- 默认值:[LengthUnit](/guide/constants.html#lengthunit).METRIC -- 描述:显示单位 diff --git a/docs/api/symbol.md b/docs/api/symbol.md deleted file mode 100644 index 877ca49..0000000 --- a/docs/api/symbol.md +++ /dev/null @@ -1,57 +0,0 @@ -# Symbol - -`Symbol` 继承自 `Marker`,享有 `Marker` 中的所有属性设置 - -## path - -- 类型:[Enum](/guide/constants.html#symbolshapetype) -- 默认值:[SymbolShapeType](/guide/constants.html#symbolshapetype).FORWARD_CLOSED_ARROW -- 描述:设置矢量图标的路径 - -## anchor - -- 类型:[Size](/api/#size) -- 默认值:{ width: 0, height: 0 } -- 描述:符号的位置偏移值 - -## fillColor - -- 类型:`string` -- 默认值:`undefined` -- 描述:设置矢量图标的填充颜色。支持颜色常量字符串、十六进制、RGB、RGBA 等格式 - -## fillOpacity - -- 类型:`number` -- 默认值:`undefined` -- 描述:设置矢量图标填充透明度,范围 0~1 - -## scale - -- 类型:`number` -- 默认值:`undefined` -- 描述:设置矢量图标的缩放比例 - -## rotation - -- 类型:`number` -- 默认值:`undefined` -- 描述:设置矢量图标的旋转角度,参数为角度 - -## strokeColor - -- 类型:`string` -- 默认值:`undefined` -- 描述:设置矢量图标的线填充颜色,支持颜色常量字符串、十六进制、RGB、RGBA 等格式 - -## strokeOpacity - -- 类型:`number` -- 默认值:`undefined` -- 描述:设置矢量图标线的透明度,opacity 范围 0~1 - -## strokeWeight - -- 类型:`number` -- 默认值:`undefined` -- 描述:旋设置线宽。如果此属性没有指定,则线宽跟 scale 数值相同 diff --git a/docs/api/tile.md b/docs/api/tile.md deleted file mode 100644 index d8f570f..0000000 --- a/docs/api/tile.md +++ /dev/null @@ -1,31 +0,0 @@ -# Tile - -## transparentPng - -- 类型:`boolean` -- 默认值:`undefined` -- 描述:是否使用了带有透明信息的 PNG。由于 IE6 不支持 PNG 透明,因此需要特殊处理 - -## tileUrlTemplate - -- 类型:`string` -- 默认值:无 -- 描述:指定图块网址模板,该模板可以针对每个图块请求而展开,以根据现有的图块坐标系引用唯一的图块。模板的格式应该为:http://yourhost/tile?x={X}&y={Y}&z={Z}.png 其中 X 和 Y 分别指纬度和经度图块坐标,Z 指缩放级别,比如: http://yourhost/tile?x=3&y=27&z=5.png 如果您没有提供图块网址模板,您需要实现 TileLayer.getTileUrl()抽象方法 - -## copyright - -- 类型:[CopyRight](/api/#copyright) -- 默认值:`undefined` -- 描述:地图图层的版权信息 - -## zIndex - -- 类型:`number` -- 默认值:`undefined` -- 描述:图层的 zIndex - -## getTilesUrl - -- 类型:`string` -- 默认值:`undefined` -- 描述:抽象。向地图返回地图图块的网址,图块索引由 tileCoord 的 x 和 y 属性在指定的缩放级别 zoom 提供。如果您在 TileLayerOptions 中提供了 tileUrlTemplate 参数,则可不实现此接口 diff --git a/docs/api/trafficControl.md b/docs/api/trafficControl.md deleted file mode 100644 index 0ea44a8..0000000 --- a/docs/api/trafficControl.md +++ /dev/null @@ -1,7 +0,0 @@ -# TrafficControl - -## anchor - -- 类型:[Enum](/guide/constants.html#controlanchor) -- 默认值:[ControlAnchor](/guide/constants.html#controlanchor).BOTTOM_RIGHT -- 描述:控件的停靠位置 diff --git a/docs/api/transitRoute.md b/docs/api/transitRoute.md deleted file mode 100644 index f7c4fd0..0000000 --- a/docs/api/transitRoute.md +++ /dev/null @@ -1,73 +0,0 @@ -# TransitRoute - -## location - -- 类型:`Map | String` | [Point](/api/#point) -- 默认值:当前地图示例 -- 描述:表示检索区域,类型可为地图实例、坐标点或城市名称的字符串。当参数为地图实例时,检索位置由当前地图中心点确定;当参数为坐标时,检索位置由该点所在位置确定;当参数为城市名称时,检索会在该城市内进行 - -## renderOptions - -- 类型:[RenderOption](/api/#renderoption) -- 默认值:`undefined` -- 描述:搜索结果呈现的配置 - -## policy - -- 类型:[Enum](/guide/constants.html#drivingpolicy) -- 默认值:[DrivingPolicy](/guide/constants.html#drivingpolicy).NORMAL -- 描述:市内公交的策略参数 - -## intercityPolicy - -- 类型:[Enum](/guide/constants.html#intercitypolicy) -- 默认值:[IntercityPolicy](/guide/constants.html#intercitypolicy).NORMAL -- 描述:跨城公交的换乘策略参数 - -## transitTypePolicy - -- 类型:[Enum](/guide/constants.html#transittypePolicy) -- 默认值:[TransitTypePolicy](/guide/constants.html#transittypePolicy).NORMAL -- 描述:跨城公交的交通方式策略参数 - -## pageCapacity - -- 类型:`number` -- 默认值:`undefined` -- 描述:返回方案的个数 - -## onSearchComplete - -- 类型:`Function` -- 默认值:`undefined` -- 描述:检索完成后的回调函数 - -## onMarkersSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:标注添加完成后的回调函数 - -## onInfoHtmlSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:气泡内容创建后的回调函数 - -## onPolylinesSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:折线添加完成后的回调函数 - -## onResultsHtmlSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:结果列表添加完成后的回调函数 - -## showInMap - -- 类型:`boolean` -- 默认值:`false` -- 描述:用来表示是否将查询结果渲染至地图中 diff --git a/docs/api/walkingRoute.md b/docs/api/walkingRoute.md deleted file mode 100644 index 88cc529..0000000 --- a/docs/api/walkingRoute.md +++ /dev/null @@ -1,49 +0,0 @@ -# WalkingRoute - -## location - -- 类型:`Map | String` | [Point](/api/#point) -- 默认值:当前地图示例 -- 描述:表示检索区域,类型可为地图实例、坐标点或城市名称的字符串。当参数为地图实例时,检索位置由当前地图中心点确定;当参数为坐标时,检索位置由该点所在位置确定;当参数为城市名称时,检索会在该城市内进行 - -## renderOptions - -- 类型:[RenderOption](/api/#renderoption) -- 默认值:`undefined` -- 描述:搜索结果呈现的配置 - -## onSearchComplete - -- 类型:`Function` -- 默认值:`undefined` -- 描述:检索完成后的回调函数 - -## onMarkersSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:标注添加完成后的回调函数 - -## onPolylinesSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:折线添加完成后的回调函数 - -## onInfoHtmlSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:标注气泡内容创建后的回调函数 - -## onResultsHtmlSet - -- 类型:`Function` -- 默认值:`undefined` -- 描述:结果列表添加完成后的回调函数 - -## showInMap - -- 类型:`boolean` -- 默认值:`false` -- 描述:用来表示是否将查询结果渲染至地图中 diff --git a/docs/guide/README.md b/docs/guide/README.md deleted file mode 100644 index e864584..0000000 --- a/docs/guide/README.md +++ /dev/null @@ -1,107 +0,0 @@ -# 介绍 - -## 初衷 - -rc-bmap 源于一次业务对百度地图相关的需求,由于前端技术栈使用的是 React,官方仅提供了最基础的 js,使用起来很不 React。现有 github 中的 React 版百度地图方式无法满足需求,所以决定来一次愉快的封装。 - -## 起步 - -::: danger -在开始之前,希望您对[React](https://reactjs.org/docs/getting-started.html)与[百度地图](http://lbsyun.baidu.com/index.php?title=jspopular3.0)已经有了一定的了解 -::: - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map } from "rc-bmap"; - -render( - , - document.getElementById("app") -); -``` - -::: warning 注意: - -1. 在使用时,您需要自行替换您自己在百度所申请的 AK 值,目前 AK 仅作 demo 示例使用。 -2. 此处,div#app 的高度与宽度均为 100%,若无相关高度定义时,百度地图将渲染在一个高度为 0 的容器中。 - ::: - -## 添加控件 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Navigation } from "rc-bmap"; - -render( - - {/* 在Map中添加控件 */} - - , - document.getElementById("app") -); -``` - -## 添加覆盖物 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Marker } from "rc-bmap"; - -const markerPoint = { - lng: 116.404, - lat: 39.915 -}; - -render( - - {/* 在Map中添加覆盖物 */} - - , - document.getElementById("app") -); -``` - -## 自定义控件与自定义覆盖物 - -在这里,我们为您提供了两个基础类,分别为`Control`与`Overlay`,您可以通过继承后,实现`render`方法即可呈现。 - -您自定义的控件与覆盖物,均可使用其父类的属性、事件、方法,与此同时,还为您提供了`state`与`setState`这对基友,方便您在内部通过更改状态即可完成对视图的重新渲染。 - -### 自定义控件 - -```js -import React from "react"; -import { ReactComponent, Control } from "rc-bmap"; - -@ReactComponent -class CustomControl extends Control { - render() { - return
    这是一个自定义控件
    ; - } -} - -export default CustomControl; -``` - -### 自定义覆盖物 - -```js -import React from "react"; -import { ReactComponent, Overlay } from "rc-bmap"; - -@ReactComponent -class CustomOverlay extends Overlay { - render() { - return
    这是一个自定义覆盖物
    ; - } -} - -export default CustomOverlay; -``` - -## 感兴趣吗? - -如果你对以上内容兴趣,那么请继续往下浏览各组件的使用方法吧。 diff --git a/docs/guide/constants.md b/docs/guide/constants.md deleted file mode 100644 index 9b21d39..0000000 --- a/docs/guide/constants.md +++ /dev/null @@ -1,164 +0,0 @@ -# 常量 - -## MapType - -| 值 | 描述 | -| ----------- | ---------------------------------- | -| NORMAL | 此地图类型展示普通街道视图 | BMAP_NORMAL_MAP | -| PERSPECTIVE | 此地图类型展示透视图像视图 | BMAP_PERSPECTIVE_MAP | -| SATELLITE | 此地图类型展示卫星视图 | BMAP_SATELLITE_MAP | -| HYBRID | 此地图类型展示卫星和路网的混合视图 | BMAP_HYBRID_MAP | - -## ControlAnchor - -| 值 | 描述 | -| ------------ | ------------------------ | -| TOP_LEFT | 控件将定位到地图的左上角 | BMAP_ANCHOR_TOP_LEFT | -| TOP_RIGHT | 控件将定位到地图的右上角 | BMAP_ANCHOR_TOP_RIGHT | -| BOTTOM_LEFT | 控件将定位到地图的左下角 | BMAP_ANCHOR_BOTTOM_LEFT | -| BOTTOM_RIGHT | 控件将定位到地图的右下角 | BMAP_ANCHOR_BOTTOM_RIGHT | - -## NavigationType - -| 值 | 描述 | -| ----- | ---------------------------------------------- | -| LARGE | 标准的平移缩放控件(包括平移、缩放按钮和滑块) | BMAP_NAVIGATION_CONTROL_LARGE | -| SMALL | 仅包含平移和缩放按钮 | BMAP_NAVIGATION_CONTROL_SMALL | -| PAN | 仅包含平移按钮 | BMAP_NAVIGATION_CONTROL_PAN | -| ZOOM | 仅包含缩放按钮 | BMAP_NAVIGATION_CONTROL_ZOOM | - -## LengthUnit - -| 值 | 描述 | -| -------- | -------- | -| METRIC | 公制单位 | BMAP_UNIT_METRIC | -| IMPERIAL | 英制单位 | BMAP_UNIT_IMPERIAL | - -## MapTypeControlType - -| 值 | 描述 | -| ---------- | ---------------------- | -| HORIZONTAL | 按钮水平方式展示 | BMAP_MAPTYPE_CONTROL_HORIZONTAL | -| DROPDOWN | 按钮呈下拉列表方式展示 | BMAP_MAPTYPE_CONTROL_DROPDOWN | -| MAP | 以图片方式展示类型控件 | BMAP_MAPTYPE_CONTROL_MAP | - -## StatusCode - -| 值 | 描述 | -| ------------------- | ----------------------- | -| PERMISSION_DENIED | 没有权限。对应数值“6” | BMAP_STATUS_PERMISSION_DENIED | -| SERVICE_UNAVAILABLE | 服务不可用。对应数值“7” | BMAP_STATUS_SERVICE_UNAVAILABLE | -| TIMEOUT | 超时。对应数值“8” | BMAP_STATUS_TIMEOUT | - -## MapPane - -| 值 | 描述 | -| ------------- | ------------------------------ | -| FLOAT | 信息窗口所在容器 | floatPane | -| FLOAT_SHADOW | 信息窗口阴影所在容器 | floatShadow | -| LABEL | 文本标注所在容器 | labelPane | -| MARKER | 标注图标所在容器 | markerPane | -| MARKER_MOUSE | 标注点击区域所在容器 | markerMouseTarget | -| MARKER_SHADOW | 标注阴影所在容器 | markerShadow | -| MAP | 折现、多边形等矢量图形所在容器 | mapPane | - -## Animation - -| 值 | 描述 | -| ------ | -------- | -| DROP | 坠落动画 | BMAP_ANIMATION_DROP | -| BOUNCE | 跳动动画 | BMAP_ANIMATION_BOUNCE | - -## ShapeType - -| 值 | 描述 | -| --------- | ----------------------------------- | -| CIRCLE | 圆形,为默认形状 | BMAP_POINT_SHAPE_CIRCLE | -| STAR | 星形 | BMAP_POINT_SHAPE_STAR | -| SQUARE | 方形 | BMAP_POINT_SHAPE_SQUARE | -| RHOMBUS | 菱形 | BMAP_POINT_SHAPE_RHOMBUS | -| WATERDROP | 水滴状,该类型无 size 和 color 属性 | BMAP_POINT_SHAPE_WATERDROP | - -## SizeType - -| 值 | 描述 | -| ------- | ------------------------------------------------------- | -| TINY | 定义点的尺寸为超小,宽高为 2px\*2px | BMAP_POINT_SIZE_TINY | -| SMALLER | 定义点的尺寸为很小,宽高为 4px\*4px | BMAP_POINT_SIZE_SMALLER | -| SMALL | 定义点的尺寸为小,宽高为 8px\*8px | BMAP_POINT_SIZE_SMALL | -| NORMAL | 定义点的尺寸为正常,宽高为 10px\*10px,为海量点默认尺寸 | BMAP_POINT_SIZE_NORMAL | -| BIG | 定义点的尺寸为大,宽高为 16px\*16px | BMAP_POINT_SIZE_BIG | -| BIGGER | 定义点的尺寸为很大,宽高为 20px\*20px | BMAP_POINT_SIZE_BIGGER | -| HUGE | 定义点的尺寸为超大,宽高为 30px\*30px | BMAP_POINT_SIZE_HUGE | - -## SymbolShapeType - -| 值 | 描述 | -| --------------------- | ------------------------------- | -| CIRCLE | 圆形,默认半径为 1px | BMap_Symbol_SHAPE_CIRCLE | -| RECTANGLE | 矩形,默认宽度 4px、高度 2px | BMap_Symbol_SHAPE_RECTANGLE | -| RHOMBUS | 菱形,默认外接圆半径 10px | BMap_Symbol_SHAPE_RHOMBUS | -| STAR | 五角星,五角星外接圆半径为 10px | BMap_Symbol_SHAPE_STAR | -| BACKWARD_CLOSED_ARROW | 箭头方向向下的闭合箭头 | BMap_Symbol_SHAPE_BACKWARD_CLOSED_ARROW | -| FORWARD_CLOSED_ARROW | 箭头方向向上的闭合箭头 | BMap_Symbol_SHAPE_FORWARD_CLOSED_ARROW | -| BACKWARD_OPEN_ARROW | 箭头方向向下的非闭合箭头 | BMap_Symbol_SHAPE_BACKWARD_OPEN_ARROW | -| FORWARD_OPEN_ARROW | 箭头方向向上的非闭合箭头 | BMap_Symbol_SHAPE_FORWARD_OPEN_ARROW | -| POINT | 定位点图标 | BMap_Symbol_SHAPE_POINT | -| PLANE | 预设的飞机形状 | BMap_Symbol_SHAPE_PLANE | -| CAMERA | 预设的照相机形状 | BMap_Symbol_SHAPE_CAMERA | -| WARNING | 预设的警告符号 | BMap_Symbol_SHAPE_WARNING | -| SMILE | 预设的笑脸形状 | BMap_Symbol_SHAPE_SMILE | -| CLOCK | 预设的钟表形状 | BMap_Symbol_SHAPE_CLOCK | - -## DrivingPolicy - -| 值 | 描述 | -| ---------------- | -------- | -| DEFAULT | 默认 | BMAP_DRIVING_POLICY_DEFAULT | -| FIRST_HIGHWAYS | 优先高速 | BMAP_DRIVING_POLICY_FIRST_HIGHWAYS | -| AVOID_HIGHWAYS | 避开高速 | BMAP_DRIVING_POLICY_AVOID_HIGHWAYS | -| AVOID_CONGESTION | 避开拥堵 | BMAP_DRIVING_POLICY_AVOID_CONGESTION | - -## IntercityPolicy - -| 值 | 描述 | -| ----------- | ------ | -| LEAST_TIME | 时间短 | BMAP_INTERCITY_POLICY_LEAST_TIME | -| EARLY_START | 出发早 | BMAP_INTERCITY_POLICY_EARLY_START | -| CHEAP_PRICE | 价格低 | BMAP_INTERCITY_POLICY_CHEAP_PRICE | - -## TransitPolicy - -| 值 | 描述 | -| -------------- | -------- | -| RECOMMEND | 推荐方案 | BMAP_TRANSIT_POLICY_RECOMMEND | -| LEAST_TIME | 最少时间 | BMAP_TRANSIT_POLICY_LEAST_TIME | -| LEAST_TRANSFER | 价格低 | BMAP_TRANSIT_POLICY_LEAST_TRANSFER | -| LEAST_WALKING | 最少换乘 | BMAP_TRANSIT_POLICY_LEAST_WALKING | -| AVOID_SUBWAYS | 不乘地铁 | BMAP_TRANSIT_POLICY_AVOID_SUBWAYS | -| FIRST_SUBWAYS | 优先地铁 | BMAP_TRANSIT_POLICY_FIRST_SUBWAYS | - -## TransitTypePolicy - -| 值 | 描述 | -| -------- | -------- | -| TRAIN | 火车优先 | BMAP_TRANSIT_TYPE_POLICY_TRAIN | -| AIRPLANE | 飞机优先 | BMAP_TRANSIT_TYPE_POLICY_AIRPLANE | -| COACH | 大巴优先 | BMAP_TRANSIT_TYPE_POLICY_COACH | - -## ContextMenuIcon - -| 值 | 描述 | -| ------- | -------- | -| ZOOMIN | 放大图标 | BMAP_CONTEXT_MENU_ICON_ZOOMIN | -| ZOOMOUT | 缩小图标 | BMAP_CONTEXT_MENU_ICON_ZOOMOUT | - -## DrawingMode - -| 值 | 描述 | -| --------- | ------ | -| MARKER | 标注 | -| CIRCLE | 圆 | -| POLYLINE | 折显 | -| POLYGON | 多边形 | -| RECTANGLE | 矩形 | diff --git a/docs/guide/control.md b/docs/guide/control.md deleted file mode 100644 index 9e8a136..0000000 --- a/docs/guide/control.md +++ /dev/null @@ -1,444 +0,0 @@ -# 控件 - -## 基础类 - -百度地图提供了基础的`Control`类,于是`rc-bmap`也为您提供了基础类`Control`的封装。 -当您想实现一个自定义的控件时,您仅需要继承该类即可完成自定义,在`render`函数使用 jsx 语法即可。 - -```js -import React from "react"; -import { ReactComponent, Control } from "rc-bmap"; - -@ReactComponent -class CustomControl extends Control { - render() { - return
    这是一个自定义控件
    ; - } -} - -export default CustomControl; -``` - -上面便是一个最简单的实现自定义控件的实现方式,接下来,让我们一起将它当做`Map` 的子组件来看看效果吧。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { ControlAnchor, Map } from "rc-bmap"; -import CustomControl from "./CustomControl"; - -const offset = { - width: 10, - height: 10 -}; - -render( - - - , - document.getElementById("app") -); -``` - -找到了吗?如果没有,仔细看看地图的右上角!看,我们通过上面代码自定义的子组件显示在地图上了。 - -OK,这里你又要继续了解关于基础组件的必须提供的两个属性了,一个是`anchor`,另一个是`offset`。 - -### anchor - -`anchor`为控件默认的停靠位置,默认值为`BMAP_ANCHOR_TOP_LEFT`。 -写起来会很长?没关系,为此准备了常量[ControlAnchor](#),为您免去苦恼,打点即用。 - -### offset - -`offset`控件默认的位置偏移值,默认值为`{ width: 0, height: 0 }`。 - -::: warning 注意 -您能将自定义控件像 React 组件一样使用,离不开一个高阶的功劳`ReactComponent`。 - -为此,您需要在头部增加`@ReactComponent`,来将这个类识别为 React 组件。 - -`@`的用法,需要 babel 的支持,若您想用,请安装: - -```bash - # 安装支持 - yarn add --dev babel-plugin-transform-decorators-legacy - # 或者:npm install --save-dev babel-plugin-transform-decorators-legacy -``` - -并在.babelrc 中进行配置: - -```js - "plugins": [ - "transform-decorators-legacy" - ] -``` - -当然,若您不想使用`@`的用法,您可以在 export 的时候,通过调用`ReactComponent`函数,也可以完成类似操作。 - -```js -export default ReactComponent(CustomControl); -``` - -::: - -### 复杂自定义控件实现 - -定义 `ComplexControl`控件: - -```js -import React from "react"; -import { ReactComponent, Control } from "rc-bmap"; - -const checkedStyle = { - height: 10, - width: 10, - borderRadius: 5, - background: "#e89a37" -}; - -const unCheckedStyle = { - height: 10, - width: 10, - borderRadius: 5, - background: "#888" -}; - -const container = { - display: "flex", - alignItems: "center", - justifyContent: "space-between", - background: "#fff", - height: 40, - width: 70, - padding: "0 10px", - cursor: "pointer", - borderRadius: 3 -}; - -@ReactComponent -class ComplexControl extends Control { - constructor(props) { - super(props); - this.state = { - checkedState: false - }; - } - - handleClick = () => { - this.setState({ - checkedState: !this.state.checkedState - }); - }; - - render() { - const { checkedState } = this.state; - return ( -
    -
    -
    路线
    -
    - ); - } -} - -export default ComplexControl; -``` - -在 Map 中使用: - -```js -import React from "react"; -import { render } from "react-dom"; -import { ControlAnchor, Map } from "rc-bmap"; -import ComplexControl from "./ComplexControl"; - -const offset = { - width: 10, - height: 10 -}; - -render( - - - , - document.getElementById("app") -); -``` - -::: tip 提示 -在自定义控件中,为了防止`render`中的`this`丢失,您有两种方式进行函数的`this`绑定, -一个是上述示例中,直接使用箭头函数,另一个是在`constructor`中提前进行`bind`操作。 - -```js -this.handleClick = this.handleClick.bind(this); -``` - -在自定义控件中,你依然可以使用`state`进行内部状态控制,通过`setState`来再次触发`render`。 -::: - -_以下控件内部提供了属性的默认值,当您不进行任何配置时,依然可以正常使用,当前展现控件可设置的属性而填写。_ - -- Navigation -- Geolocation -- OverviewMap -- Scale -- MapTypeCtrl - -## Navigation-平移缩放控件 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a2b2) - -```js -import React from "react"; -import { render } from "react-dom"; -import { ControlAnchor, Map, Navigation, NavigationType } from "rc-bmap"; - -const offset = { - width: 10, - height: 10 -}; - -render( - - - , - document.getElementById("app") -); -``` - -## Geolocation-定位控件 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a2b5) - -```js -import React from "react"; -import { render } from "react-dom"; -import { ControlAnchor, Map, Geolocation } from "rc-bmap"; - -const offset = { - width: 10, - height: 10 -}; - -const locationIcon = { - url: "http://api0.map.bdimg.com/images/copyright_logo.png", - size: { width: 100, height: 100 } -}; - -const geoEvents = { - locationSuccess: event => { - console.log("locationSuccess", event); - }, - locationError: event => { - console.log("locationError", event); - } -}; - -render( - - - , - document.getElementById("app") -); -``` - -## OverviewMap-缩略地图控件 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a2b7) - -```js -import React from "react"; -import { render } from "react-dom"; -import { ControlAnchor, Map, OverviewMap } from "rc-bmap"; - -const offset = { - width: 10, - height: 10 -}; - -const size = { - width: 150, - height: 150 -}; - -const events = { - viewchanged: event => { - console.log("viewchanged", event); - }, - viewchanging: event => { - console.log("viewchanging", event); - } -}; - -render( - - - , - document.getElementById("app") -); -``` - -## Scale-比例尺控件 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a2b9) - -```js -import React from "react"; -import { render } from "react-dom"; -import { ControlAnchor, Map, Scale, LengthUnit } from "rc-bmap"; - -const offset = { - width: 81, - height: 18 -}; - -render( - - - , - document.getElementById("app") -); -``` - -## Copyright-版权控件 - -> 您可以在地图上添加自己的版权信息。每一个版权信息需要包含如下内容:版权的唯一标识、版权内容和其适用的区域范围。 -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a2b12) - -```js -import React from "react"; -import { render } from "react-dom"; -import { ControlAnchor, Map, Copyright } from "rc-bmap"; - -const offset = { - width: 10, - height: 10 -}; - -render( - - - , - document.getElementById("app") -); -``` - -## MapTypeCtrl-切换地图类型控件 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a2b15)。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { - ControlAnchor, - Map, - MapTypeCtrl, - MapTypeControlType, - MapType -} from "rc-bmap"; - -const offset = { - width: 10, - height: 10 -}; - -render( - - - , - document.getElementById("app") -); -``` - -## Panorama - 切换全景地图控件 - -> 对应[百度文档地址](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a2b18)。 -> 控件内部提供了属性的默认值,当您不进行任何配置时,依然可以正常使用,以下仅为了展现当前控件可设置的属性而填写。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { ControlAnchor, Map, Panorama } from "rc-bmap"; - -const offset = { - width: 10, - height: 10 -}; - -render( - - - , - document.getElementById("app") -); -``` - -## CityList-城市列表控件 - -```js -import React from "react"; -import { render } from "react-dom"; -import { ControlAnchor, Map, CityList } from "rc-bmap"; - -const offset = { - width: 300, - height: 10 -}; - -const onChangeBefore = () => { - console.log("onChangeBefore"); -}; - -const onChangeAfter = () => { - console.log("onChangeBefore"); -}; - -render( - - - , - document.getElementById("app") -); -``` diff --git a/docs/guide/getting-started.md b/docs/guide/getting-started.md deleted file mode 100644 index aba3854..0000000 --- a/docs/guide/getting-started.md +++ /dev/null @@ -1,33 +0,0 @@ -# 安装 - -## 兼容性 - -当前针对 BaiduMap **v3.0** 进行封装,请确保您的使用版本为 3.0,3.0 与 2.0 相比,部分内部 api 已废弃或变更。 - -## 申请 AK - -使用百度地图的前,请确保您已拥有一个 AK,若您没有暂时还没有,可以[点击链接进行申请](http://lbsyun.baidu.com/apiconsole/key)。 - -::: tip 友情提示: -若您想在任何地方使用您所申请的 AK 时,在申请 AK 的页面中白名单可以填写: 0.0.0.0 -::: - -## 添加依赖 - -```bash -# 安装 -yarn add rc-bmap # 或者:npm install --save rc-bmap -``` - -## 开发版本 - -::: tip 提示 -当您想通过自己的封装或者对源码进行修改时,才需要进行此步骤 -::: - -```bash -git clone https://github.com/JserWang/rc-bmap.git -cd rc-bmap -git checkout dev -npm run build # 这时,您可以看到最新的开发版本lib -``` diff --git a/docs/guide/lib.md b/docs/guide/lib.md deleted file mode 100644 index fb65ea7..0000000 --- a/docs/guide/lib.md +++ /dev/null @@ -1,419 +0,0 @@ -# 扩展库 - -扩展库均基于[百度开源库](http://lbsyun.baidu.com/index.php?title=jspopular3.0/openlibrary)实现。 - -::: warning 注意 -以下属性表格中`Size`均为字面量`{ width, height }`,`Point`均为字面量`{ lng, lat }`,`Enum`均为对应常量。 -::: - -## MarkerClusterer-点聚合 - -| 属性 | 类型 | 描述 | -| -------------- | ------- | ---------------------------------------------- | -| gridSize | number | 网格大小 | -| maxZoom | number | 聚合的最大缩放级别 | -| minClusterSize | number | 单个聚合的最小数量 | -| styles | Array | 聚合样式的风格集合 | -| averageCenter | boolean | 单个聚合的落脚点是否是聚合内所有标记的平均中心 | - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Marker, MarkerClusterer } from "rc-bmap"; - -const points = [ - { lng: 116.418261, lat: 39.921984 }, - { lng: 116.423332, lat: 39.916532 }, - { lng: 116.419787, lat: 39.930658 }, - { lng: 116.418455, lat: 39.920921 }, - { lng: 116.418843, lat: 39.915516 }, - { lng: 116.42546, lat: 39.918503 }, - { lng: 116.423289, lat: 39.919989 }, - { lng: 116.418162, lat: 39.915051 }, - { lng: 116.422039, lat: 39.91782 }, - { lng: 116.41387, lat: 39.917253 }, - { lng: 116.41773, lat: 39.919426 }, - { lng: 116.421107, lat: 39.916445 }, - { lng: 116.417521, lat: 39.917943 }, - { lng: 116.419812, lat: 39.920836 }, - { lng: 116.420682, lat: 39.91463 }, - { lng: 116.415424, lat: 39.924675 }, - { lng: 116.419242, lat: 39.914509 }, - { lng: 116.422766, lat: 39.921408 }, - { lng: 116.421674, lat: 39.924396 }, - { lng: 116.427268, lat: 39.92267 }, - { lng: 116.417721, lat: 39.920034 }, - { lng: 116.412456, lat: 39.92667 }, - { lng: 116.420432, lat: 39.919114 }, - { lng: 116.425013, lat: 39.921611 }, - { lng: 116.418733, lat: 39.931037 }, - { lng: 116.419336, lat: 39.931134 }, - { lng: 116.413557, lat: 39.923254 }, - { lng: 116.418367, lat: 39.92943 }, - { lng: 116.424312, lat: 39.919621 }, - { lng: 116.423874, lat: 39.919447 }, - { lng: 116.424225, lat: 39.923091 }, - { lng: 116.417801, lat: 39.921854 }, - { lng: 116.417129, lat: 39.928227 }, - { lng: 116.426426, lat: 39.922286 }, - { lng: 116.421597, lat: 39.91948 }, - { lng: 116.423895, lat: 39.920787 }, - { lng: 116.423563, lat: 39.921197 }, - { lng: 116.417982, lat: 39.922547 }, - { lng: 116.426126, lat: 39.921938 }, - { lng: 116.42326, lat: 39.915782 }, - { lng: 116.419239, lat: 39.916759 }, - { lng: 116.417185, lat: 39.929123 }, - { lng: 116.417237, lat: 39.927518 }, - { lng: 116.417784, lat: 39.915754 }, - { lng: 116.420193, lat: 39.917061 }, - { lng: 116.422735, lat: 39.915619 }, - { lng: 116.418495, lat: 39.915958 }, - { lng: 116.416292, lat: 39.931166 }, - { lng: 116.419916, lat: 39.924055 }, - { lng: 116.42189, lat: 39.921308 }, - { lng: 116.413765, lat: 39.929376 }, - { lng: 116.418232, lat: 39.920348 }, - { lng: 116.417554, lat: 39.930511 }, - { lng: 116.418568, lat: 39.918161 }, - { lng: 116.413461, lat: 39.926306 }, - { lng: 116.42232, lat: 39.92161 }, - { lng: 116.4174, lat: 39.928616 }, - { lng: 116.424679, lat: 39.915499 }, - { lng: 116.42171, lat: 39.915738 }, - { lng: 116.417836, lat: 39.916998 }, - { lng: 116.420755, lat: 39.928001 }, - { lng: 116.414077, lat: 39.930655 }, - { lng: 116.426092, lat: 39.922995 }, - { lng: 116.41535, lat: 39.931054 }, - { lng: 116.413022, lat: 39.921895 }, - { lng: 116.415551, lat: 39.913373 }, - { lng: 116.421191, lat: 39.926572 }, - { lng: 116.419612, lat: 39.917119 }, - { lng: 116.418237, lat: 39.921337 }, - { lng: 116.423776, lat: 39.921919 }, - { lng: 116.417694, lat: 39.92536 }, - { lng: 116.415377, lat: 39.914137 }, - { lng: 116.417434, lat: 39.914394 }, - { lng: 116.42588, lat: 39.922622 }, - { lng: 116.418345, lat: 39.919467 }, - { lng: 116.426883, lat: 39.917171 }, - { lng: 116.423877, lat: 39.916659 }, - { lng: 116.415712, lat: 39.915613 }, - { lng: 116.419869, lat: 39.931416 }, - { lng: 116.416956, lat: 39.925377 }, - { lng: 116.42066, lat: 39.925017 }, - { lng: 116.416244, lat: 39.920215 }, - { lng: 116.41929, lat: 39.915908 }, - { lng: 116.422116, lat: 39.919658 }, - { lng: 116.4183, lat: 39.925015 }, - { lng: 116.421969, lat: 39.913527 }, - { lng: 116.422936, lat: 39.921854 }, - { lng: 116.41905, lat: 39.929217 }, - { lng: 116.424579, lat: 39.914987 }, - { lng: 116.42076, lat: 39.915251 }, - { lng: 116.425867, lat: 39.918989 } -]; - -render( - - - {points.map((item, index) => { - return ; - })} - - , - document.getElementById("app") -); -``` - -## CurveLine-抛物线 - -`CurveLine`的属性与`Polyline`类似。 -| 属性 | 类型 | 描述 | -| --- | ---- | --- | -| points | Array[Point] | 构成弧线的关键点 | -| strokeColor | string | 弧线颜色 | -| strokeWeight | number | 弧线的宽度,以像素为单位 | -| strokeOpacity | number | 构成弧线的透明度 | -| strokeStyle | string | 弧线的样式,solid 或 dashed | -| massClear | boolean | 是否在调用 map.clearOverlays 清除此覆盖物 | -| clicking | boolean | 是否响应点击事件 | -| editing | boolean | 是否启用编辑 | - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, CurveLine } from "rc-bmap"; - -const points = [ - { lng: 116.432045, lat: 39.910683 }, - { lng: 120.129721, lat: 30.314429 }, - { lng: 121.491121, lat: 25.127053 } -]; - -const events = { - click() { - console.log("CurveLine click"); - } -}; - -render( - - - , - document.getElementById("app") -); -``` - -## DrawingManager-绘制工具 - -| 属性 | 类型 | 描述 | -| ---------------- | ----------- | -------------------------------------------------------------------------------------------------------------------- | -| anchor | Enum | 绘制工具停靠位置 | -| offset | Size | 工具停靠偏移值 | -| drawingModes | Array[Enum] | 绘制工具支持绘制的图形,从常量-DrawingMode 取值 | -| circleOptions | object | 所画的圆的可选参数,参考[CircleOptions](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b17) | -| polylineOptions | object | 所画的点的可选参数,参考[CircleOptions](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b17) | -| markerOptions | object | 所画的点的可选参数,参考[CircleOptions](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b17) | -| polygonOptions | object | 所画的点的可选参数,参考[PolygonOptions](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b15) | -| rectangleOptions | object | 所画的点的可选参数,参考[PolygonOptions](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b15) | -| events | object | 绑定事件 | - -事件: -| 事件名 | 描述 | -| ----- | --- | -| circlecomplete | 绘制圆完成事件 | -| markercomplete | 绘制点完成事件 | -| overlaycomplete | 鼠标绘制完成事件 | -| polygoncomplete | 绘制多边形完成事件 | -| polylinecomplete | 绘制线完成事件 | -| rectanglecomplete | 绘制矩形完成事件 | - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, DrawingManager, DrawingMode } from "rc-bmap"; - -const events = { - circlecomplete(e, overlay) { - console.log(overlay); - } -}; - -const offset = { - width: 10, - height: 10 -}; - -const drawingModes = [DrawingMode.MARKER, DrawingMode.CIRCLE]; - -render( - - - , - document.getElementById("app") -); -``` - -## Heatmap-热力图 - -| 属性 | 类型 | 描述 | -| -------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------- | -| points | Array[Point] | 热力图集合点 | -| opacity | number | 透明度 | -| max | number | 权重最大值 | -| radius | number | 热力圆半径 | -| gradient | object | 热力图渐变区间,如: {.5:'rgb(0, 110, 255)',.8:'rgb(100, 0, 255)'},其中 key 表示插值的位置,取值范围 0 ~ 1,value 为颜色值。 | - -::: warning -这里的 Point 相比以往需多传递一个 count 值, 即`{ lng, lat, count }`。 -::: - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Heatmap } from "rc-bmap"; - -const points = [ - { lng: 116.418261, lat: 39.921984, count: 50 }, - { lng: 116.423332, lat: 39.916532, count: 51 }, - { lng: 116.419787, lat: 39.930658, count: 15 }, - { lng: 116.418455, lat: 39.920921, count: 40 }, - { lng: 116.418843, lat: 39.915516, count: 100 }, - { lng: 116.42546, lat: 39.918503, count: 6 }, - { lng: 116.423289, lat: 39.919989, count: 18 }, - { lng: 116.418162, lat: 39.915051, count: 80 }, - { lng: 116.422039, lat: 39.91782, count: 11 }, - { lng: 116.41387, lat: 39.917253, count: 7 }, - { lng: 116.41773, lat: 39.919426, count: 42 }, - { lng: 116.421107, lat: 39.916445, count: 4 }, - { lng: 116.417521, lat: 39.917943, count: 27 }, - { lng: 116.419812, lat: 39.920836, count: 23 }, - { lng: 116.420682, lat: 39.91463, count: 60 }, - { lng: 116.415424, lat: 39.924675, count: 8 }, - { lng: 116.419242, lat: 39.914509, count: 15 }, - { lng: 116.422766, lat: 39.921408, count: 25 }, - { lng: 116.421674, lat: 39.924396, count: 21 }, - { lng: 116.427268, lat: 39.92267, count: 1 }, - { lng: 116.417721, lat: 39.920034, count: 51 }, - { lng: 116.412456, lat: 39.92667, count: 7 }, - { lng: 116.420432, lat: 39.919114, count: 11 }, - { lng: 116.425013, lat: 39.921611, count: 35 }, - { lng: 116.418733, lat: 39.931037, count: 22 }, - { lng: 116.419336, lat: 39.931134, count: 4 }, - { lng: 116.413557, lat: 39.923254, count: 5 }, - { lng: 116.418367, lat: 39.92943, count: 3 }, - { lng: 116.424312, lat: 39.919621, count: 100 }, - { lng: 116.423874, lat: 39.919447, count: 87 }, - { lng: 116.424225, lat: 39.923091, count: 32 }, - { lng: 116.417801, lat: 39.921854, count: 44 }, - { lng: 116.417129, lat: 39.928227, count: 21 }, - { lng: 116.426426, lat: 39.922286, count: 80 }, - { lng: 116.421597, lat: 39.91948, count: 32 }, - { lng: 116.423895, lat: 39.920787, count: 26 }, - { lng: 116.423563, lat: 39.921197, count: 17 }, - { lng: 116.417982, lat: 39.922547, count: 17 }, - { lng: 116.426126, lat: 39.921938, count: 25 }, - { lng: 116.42326, lat: 39.915782, count: 100 }, - { lng: 116.419239, lat: 39.916759, count: 39 }, - { lng: 116.417185, lat: 39.929123, count: 11 }, - { lng: 116.417237, lat: 39.927518, count: 9 }, - { lng: 116.417784, lat: 39.915754, count: 47 }, - { lng: 116.420193, lat: 39.917061, count: 52 }, - { lng: 116.422735, lat: 39.915619, count: 100 }, - { lng: 116.418495, lat: 39.915958, count: 46 }, - { lng: 116.416292, lat: 39.931166, count: 9 }, - { lng: 116.419916, lat: 39.924055, count: 8 }, - { lng: 116.42189, lat: 39.921308, count: 11 }, - { lng: 116.413765, lat: 39.929376, count: 3 }, - { lng: 116.418232, lat: 39.920348, count: 50 }, - { lng: 116.417554, lat: 39.930511, count: 15 }, - { lng: 116.418568, lat: 39.918161, count: 23 }, - { lng: 116.413461, lat: 39.926306, count: 3 }, - { lng: 116.42232, lat: 39.92161, count: 13 }, - { lng: 116.4174, lat: 39.928616, count: 6 }, - { lng: 116.424679, lat: 39.915499, count: 21 }, - { lng: 116.42171, lat: 39.915738, count: 29 }, - { lng: 116.417836, lat: 39.916998, count: 99 }, - { lng: 116.420755, lat: 39.928001, count: 10 }, - { lng: 116.414077, lat: 39.930655, count: 14 }, - { lng: 116.426092, lat: 39.922995, count: 16 }, - { lng: 116.41535, lat: 39.931054, count: 15 }, - { lng: 116.413022, lat: 39.921895, count: 13 }, - { lng: 116.415551, lat: 39.913373, count: 17 }, - { lng: 116.421191, lat: 39.926572, count: 1 }, - { lng: 116.419612, lat: 39.917119, count: 9 }, - { lng: 116.418237, lat: 39.921337, count: 54 }, - { lng: 116.423776, lat: 39.921919, count: 26 }, - { lng: 116.417694, lat: 39.92536, count: 17 }, - { lng: 116.415377, lat: 39.914137, count: 19 }, - { lng: 116.417434, lat: 39.914394, count: 43 }, - { lng: 116.42588, lat: 39.922622, count: 27 }, - { lng: 116.418345, lat: 39.919467, count: 8 }, - { lng: 116.426883, lat: 39.917171, count: 3 }, - { lng: 116.423877, lat: 39.916659, count: 34 }, - { lng: 116.415712, lat: 39.915613, count: 14 }, - { lng: 116.419869, lat: 39.931416, count: 12 }, - { lng: 116.416956, lat: 39.925377, count: 11 }, - { lng: 116.42066, lat: 39.925017, count: 38 }, - { lng: 116.416244, lat: 39.920215, count: 91 }, - { lng: 116.41929, lat: 39.915908, count: 54 }, - { lng: 116.422116, lat: 39.919658, count: 21 }, - { lng: 116.4183, lat: 39.925015, count: 15 }, - { lng: 116.421969, lat: 39.913527, count: 3 }, - { lng: 116.422936, lat: 39.921854, count: 24 }, - { lng: 116.41905, lat: 39.929217, count: 12 }, - { lng: 116.424579, lat: 39.914987, count: 57 }, - { lng: 116.42076, lat: 39.915251, count: 70 }, - { lng: 116.425867, lat: 39.918989, count: 8 } -]; - -render( - - - , - document.getElementById("app") -); -``` - -## TrafficControl-路况控件 - -| 属性 | 类型 | 描述 | -| ------ | ---- | ------------ | -| anchor | Enum | 控件停靠位置 | - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, TrafficControl, ControlAnchor } from "rc-bmap"; - -render( - - - , - document.getElementById("app") -); -``` - -## DistanceTool-测距工具 - -| 属性 | 类型 | 描述 | -| ---------- | ------ | --------------------------------------------------------------------------- | -| followText | string | 测距过程中,提示框文字 | -| unit | string | 测距结果所用的单位制,可接受的属性为"metric"表示米制和"us"表示美国传统单位, | -| lineColor | string | 折线颜色 | -| lineStroke | string | 折线宽度 | -| opacity | string | 透明度 | -| lineStyle | string | 折线的样式,只可设置 solid 和 dashed | -| cursor | string | 跟随的鼠标样式 | - -事件: -| 事件名 | 描述 | -| ----- | --- | -| onaddpoint | 测距过程中,每次点击底图添加节点时触发 | -| ondrawend | 测距时,每次双击底图结束当前测距折线时触发 | - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, DistanceTool } from "rc-bmap"; - -let tool; -const getTool = instance => { - tool = instance; -}; - -const mapMounted = map => { - tool.open(); // 开启测距状态 - // tool.close(); // 关闭测距状态 -}; - -const events = { - onaddpoint() { - console.log("on add"); - } -}; - -render( - - - , - document.getElementById("app") -); -``` diff --git a/docs/guide/map.md b/docs/guide/map.md deleted file mode 100644 index ea44050..0000000 --- a/docs/guide/map.md +++ /dev/null @@ -1,266 +0,0 @@ -# 地图 - -## 创建 Map - -作为最外层的容器,所有的地图组件都将被`Map`包裹 - -```js -{/* ...其他地图组件 */} -``` - -您可以通过两种方式来初始化使用地图组件: - -- 通过 script 标签引入 - -```html - -``` - -::: warning 在此您还需要注意 -通过`script`标签引入时,您需要保证 js 的加载顺序,也就是您的业务代码,需要在该`script`之后。 -虽然引入`script`时,放到`body`最后是好的做法,但是如果您手动引入百度地图时,最好将`script`添加至`head`中。 - -另外,若您想使用`import BMap from 'BMap';`这样的操作时,您还需要额外在`webpack config`中添加以下信息: - -```js -externals: { - BMap: 'BMap', -}, -``` - -::: - -- 通过传入`ak`属性来进行异步渲染。当您将`ak`作为`Map`的属性传入时,将自动通过异步加载的方式来为您动态添加 script。 - -在您没有对 BMap 特殊的操作需求时,我推荐您使用异步加载的方式,因为它为您节省了很多配置的步骤,以及避免了加载顺序所带来的不必要性错误。 - -## 渲染前与渲染后 - -地图渲染前,您可以通过`placeHolder`来设置渲染时展示的文字或者 React 组件,`placeHolder`的默认值为字符串"地图加载中..."。 - -地图渲染后,您可以通过`mapMounted`回调函数来监听渲染完成事件,您可以通过`window.bMapInstance`来访问到当前`map`实例,您可以通过`window.BMap`访问到百度地图类。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map } from "rc-bmap"; - -const handleMapMounted = map => { - console.log("map mounted:", map); -}; - -render( - , - document.getElementById("app") -); -``` - -上面提到`placeHolder`还支持 React 组件,接下来一起将它替换一下看看效果吧。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map } from "rc-bmap"; - -const handleMapMounted = map => { - console.log("map mounted:", map); -}; - -const loading = () =>
    ; - -render( - , - document.getElementById("app") -); -``` - -## 中心点 & 缩放级别 - -由于百度地图在初次渲染时,必须提供`centerAndZoom`,所以在此为您设置了默认值`center`为天安门的经纬度`{ lng: 116.404, lat: 39.915 }`, `zoom`的默认值为 15。您仍然可以通过设置`props`的方式设置您认为合适的值。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map } from "rc-bmap"; - -const centerPoint = { lng: 116.372074, lat: 39.967488 }; - -render( - , - document.getElementById("app") -); -``` - -`zoom`,范围 3-19 级,若调用高清底图(针对移动端开发)时,`zoom`可赋值范围为 3-18 级 - -### zoom 对应关系 - -| 值 | 描述 | -| --- | ---------------------------------------------------------------------------------------------------- | -| 3 | 洲区域,比如亚洲、欧洲、非洲 | -| 4 | 国际,比如中国 | -| 5 | 省会,比如省会,增加黑色交通路线 | -| 6 | 市,显示各省区市,增加黄色交通路线 | -| 7 | 仅是在 6 级放大了,地图看起来更舒服 | -| 8 | 增加国道显示 | -| 9 | 粗略显示,还有县、市未显示 | -| 10 | 区、县全部显示 | -| 11 | 区、县、城镇、乡、街道名,未全部显示 | -| 12 | 区、县、城镇、乡、街道名、地名,地名未显示 | -| 13 | 在 12 的基础上,增加地名显示 | -| 14 | 区、县、城镇、乡、街道名、地名、小地名、小街道,增加大地名,轮廓显示,大地名着色,区隐藏 | -| 15 | 区、县、城镇、乡、街道名、地名、小地名、小街道,增加小区道路 | -| 16 | 区、县、城镇、乡、街道名、地名、小地名、小街道、小型店面,增加小型店面着色 | -| 17 | 区、县、城镇、乡、街道名、地名、小地名、小街道、小型店面、超小型店面,地铁路口级显示 | -| 18 | 区、县、城镇、乡、街道名、地名、小地名、小街道、小型店面、超小型店面,增加超小型区域轮廓,三维图显示 | -| 19 | 区、县、城镇、乡、街道名、地名、小地名、小街道、小型店面、超小型店面,在 18 级基础上放大,无增加 | - -### 最大缩放级别 & 最小缩放级别 - -您可以通过`maxZoom`与`minZoom`为地图设置最大缩放级别与最小缩放级别。 - -## 事件绑定 - -这里可以通过`events`一次性将需要绑定的事件写入,为组件进行绑定。`Map`中具体支持的事件,可以通过[API](/api/map.html#events)中进行查看。 -在 rc-bmap 中绑定方式如下: - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map } from "rc-bmap"; - -const mapEvents = { - click: event => { - console.log("mapClick", event); - }, - zoomend: event => { - console.log("zoomend", event); - } -}; - -render( - , - document.getElementById("app") -); -``` - -## 右键菜单 - -您可以直接通过`contextMenu`来为`Map`添加右键菜单。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map } from "rc-bmap"; - -const zoomIn = () => { - global.bMapInstance.zoomIn(); -}; - -const zoomOut = () => { - global.bMapInstance.zoomOut(); -}; - -const contextMenu = { - items: [ - { - text: "放大", - callback: zoomIn - }, - { - text: "缩小", - callback: zoomOut, - separator: true - } - ] -}; - -render( - , - document.getElementById("app") -); -``` - -## 高级配置 - -除了基础配置之外,还为您提供了一些额外的配置项来满足日常需求。 - -| 属性名 | 类型 | 说明 | -| ---------------- | :-----: | ---------------------------------- | -| highResolution | boolean | 是否启用使用高分辨率地图,默认启用 | -| autoResize | boolean | 是否自动适应地图容器变化,默认启用 | -| mapClick | boolean | 是否启用底图可点功能,默认启用 | -| dragging | boolean | 是否启用地图拖拽, 默认启用 | -| scrollWheelZoom | boolean | 是否启用滚轮放大缩小,默认禁用 | -| doubleClickZoom | boolean | 是否启用双击放大,默认启用 | -| keyboard | boolean | 是否启用键盘操作,默认禁用 | -| inertialDragging | boolean | 是否启用地图惯性拖拽,默认禁用 | -| continuousZoom | boolean | 是否启用连续缩放效果,默认启用 | -| pinchToZoom | boolean | 是否启用双指操作缩放,默认启用 | - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map } from "rc-bmap"; - -render( - , - document.getElementById("app") -); -``` - -## 个性化地图 - -您可通过`mapStyle`属性来进行个性化地图的相关配置。 - -- 当您使用[百度地图个性化模板时](http://lbsyun.baidu.com/custom/list.htm),您可以通过如下方式进行设置 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map } from "rc-bmap"; - -const mapStyle = { - style: "midnight" -}; - -render( - , - document.getElementById("app") -); -``` - -- 当您使用[百度地图图形编辑工具](http://lbsyun.baidu.com/img-editor.html),您可以通过如下方式进行设置 - -```js -import React from "react"; -import { render } from "react-dom"; -// 这里存储您通过编辑器生成的json -import styleJson from "./styleJson"; -import { Map } from "rc-bmap"; - -const mapStyle = { - styleJson -}; - -render( - , - document.getElementById("app") -); -``` - -## 更多 - -更多属性,可见[API](/api/map.html)中的描述。 diff --git a/docs/guide/other.md b/docs/guide/other.md deleted file mode 100644 index 560cf00..0000000 --- a/docs/guide/other.md +++ /dev/null @@ -1,109 +0,0 @@ -# 其他 - -## AutoComplete-自动完成类 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a7b50), -> 当前版本 input 仅支持传入文本框 id。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, AutoComplete } from "rc-bmap"; - -const events = { - onconfirm() { - console.log("onconfirm"); - }, - onhighlight() { - console.log("onhighlight"); - } -}; - -const container = { - height: "100%" -}; - -const mapContainer = { - height: "90%" -}; - -const searchComplete = () => { - console.log("searchComplete"); -}; - -render( -
    -
    - - - -
    - -
    , - document.getElementById("app") -); -``` - -### 更多 - -更多属性,可见[API](/api/autocomplete.html)中的描述。 - -## Tile-自定义图层 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a6b0) - -| 属性 | 类型 | 描述 | -| --------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| transparentPng | boolean | 是否使用了带有透明信息的 PNG | -| tileUrlTemplate | string | 指定图块网址模板,该模板可以针对每个图块请求而展开,以根据现有的图块坐标系引用唯一的图块。模板的格式应该为:http://yourhost/tile?x={X}&y={Y}&z={Z}.png 其中 X 和 Y 分别指纬度和经度图块坐标,Z 指缩放级别,比如: http://yourhost/tile?x=3&y=27&z=5.png 如果您没有提供图块网址模板,您需要实现 TileLayer.getTileUrl()抽象方法。 | -| copyright | { id, content, bounds } | 地图图层的版权信息 | -| zIndex | number | 图层的 zIndex | -| getTilesUrl | function | 抽象。向地图返回地图图块的网址,图块索引由 tileCoord 的 x 和 y 属性在指定的缩放级别 zoom 提供。如果您在 TileLayerOptions 中提供了 tileUrlTemplate 参数,则可不实现此接口。 | - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Tile } from "rc-bmap"; - -const getTilesUrl = (tileCoord, zoom) => { - const x = tileCoord.x; - const y = tileCoord.y; - //根据当前坐标,选取合适的瓦片图 - return ( - "http://lbsyun.baidu.com/jsdemo/demo/tiles/" + - zoom + - "/tile" + - x + - "_" + - y + - ".png" - ); -}; - -const center = { - lng: 116.332782, - lat: 40.007978 -}; - -render( - - - , - document.getElementById("app") -); -``` - -## convertPoint-坐标转换 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a7b55) - -与百度略有不同的是,`convertPoint`的第一个参数为`points`,传入指定坐标点的字面量值,或数组。第二个参数为`from`,第三个参数为`to`,关于 from、to 的理解,可参考[百度坐标转换 web api](http://lbsyun.baidu.com/index.php?title=webapi/guide/changeposition),返回值为`Promise`。 diff --git a/docs/guide/overlay.md b/docs/guide/overlay.md deleted file mode 100644 index 1ab0c6a..0000000 --- a/docs/guide/overlay.md +++ /dev/null @@ -1,607 +0,0 @@ -# 覆盖物 - -## 基础类 - -就像控件一样,覆盖物同样也提供了基础类的封装,用法与控件基础类相似,尽可能的降低了您在使用时的理解成本。 - -自定义覆盖物需继承自`Overlay`: - -```js -import React from "react"; -import { ReactComponent, Overlay } from "rc-bmap"; - -const container = { - width: 100, - height: 20 -}; - -@ReactComponent -class CustomOverlay extends Overlay { - render() { - return
    自定义覆盖物
    ; - } -} - -export default CustomOverlay; -``` - -同样,我们将自定义覆盖物添加至`Map`,看看效果吧。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, MapPane } from "rc-bmap"; -import CustomOverlay from "./CustomOverlay"; - -const point = { - lng: 116.404, - lat: 39.915 -}; - -render( - - - , - document.getElementById("app") -); -``` - -与基础控件不同的是,这里需要指定`point`作为当前添加覆盖物的坐标。`pane`属性用来表示需要将覆盖物添加至地图中的哪个容器,详细可见常量[MapPane](#)中的值,或见[百度地图文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b1)。`zIndex`就像 html 中的`z-index`一样,用来表示 z 轴显示位置的。 - -在自定义覆盖物中,您同样可以使用`state`、`setState`、`render`,在此不再展示自定义覆盖物中的进阶用法,您可以参考[复杂自定义控件实现](./control.html#复杂自定义控件实现)。 - -能在地图中看到自定义覆盖物,自然也离不开`ReactComponent`的功劳。 - -## Marker-标注 - -`Marker`作为地图中较常用的覆盖物,最简单的使用方式: - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Marker } from "rc-bmap"; - -const point = { - lng: 116.404, - lat: 39.915 -}; - -render( - - - , - document.getElementById("app") -); -``` - -### 偏移值 - -像控件一样,`Marker`同样可以通过`offset`设置偏移值,这里需要注意一点,由于是偏移值,需尽量将值控制相对较小,否则在地图缩放后,会有意想不到的效果。 - -### 自定义 icon - -不想使用百度默认提供的 icon 时,可以通过自定义 icon 来进行个性化设置。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Marker } from "rc-bmap"; - -const point = { - lng: 116.404, - lat: 39.915 -}; - -const icon = { - url: "http://lbsyun.baidu.com/jsdemo/img/fox.gif", - size: { - width: 300, - height: 157 - }, - opts: { - imageOffset: { width: 10, height: 10 } - } -}; - -render( - - - , - document.getElementById("app") -); -``` - -关于自定义 icon 的设置,您可以参考[百度地图 Icon](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b5)相关的配置,以字面量的形式传递给 Marker,其中`IconOptions`改名为`opts`,`Size`变为 `{ width, height }`的形式,其他保持原有即可。 - -### 设置 label - -当您想为`Marker`添加标签时,可以使用[Label]()标签。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Marker, Label } from "rc-bmap"; - -const point = { - lng: 116.404, - lat: 39.915 -}; - -const labelOffset = { - width: 0, - height: -10 -}; - -render( - - } - /> - , - document.getElementById("app") -); -``` - -### 设置动画 - -`Marker`目前支持两种动画,可通过`animation`进行设置。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Marker, Animation } from "rc-bmap"; - -const point = { - lng: 116.404, - lat: 39.915 -}; - -render( - - - , - document.getElementById("app") -); -``` - -### 绑定事件 - -这里可以通过`events`一次性将需要绑定的事件写入,为`Marker`进行绑定。使用方式可参考`Map`绑定事件。 -`Marker`支持的事件,可参考[百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b2)。 - -### 右键菜单 - -同`Map`使用方式,传递`contextMenu`即可。不同的是,当`clicking`设置为 false 时,`Marker`将不能响应右键菜单。 - -### 高级配置 - -| 属性名 | 类型 | 说明 | -| ---------------------------- | :-----: | ------------------------------------------------------ | -| [massClear](#highresolution) | boolean | 是否在调用 map.clearOverlays 清除此覆盖物,默认为 true | -| [dragging](#autoresize) | boolean | 是否启用拖拽,默认为 false | -| [clicking](#mapclick) | boolean | 是否响应点击事件。默认为 true | -| [raiseOnDrag](#dragging) | boolean | 拖拽标注时,标注是否开启离开地图表面效果。默认为 false | - -### 更多配置 - -更多配置,见[Marker]()。 - -## Symbol-矢量图标注 - -矢量图标继承自`Marker`,享有`Marker`的所有属性,唯独不同的是,您需要为`Symbol`设置它独有的属性。 -::: warning 注意 -由于`Symbol`实现原理为替换掉`Marker`属性中的 icon,所以在此您设置的 icon 属性将被覆盖掉。 -::: - -### 特有属性 - -| 属性名 | 类型 | 说明 | -| ------------- | ------------------------- | ----------------------------------------------------------------------- | -| path | string or SymbolShapeType | path 为 svg 中的 path 字符串或者已定义的符号常量 | -| anchor | object | 符号的位置偏移值 | -| fillColor | string | 设置矢量图标的填充颜色。支持颜色常量字符串、十六进制、RGB、RGBA 等格式 | -| fillOpacity | number | 设置矢量图标填充透明度,范围 0~1 | -| scale | number | 设置矢量图标的缩放比例 | -| rotation | number | 设置矢量图标的旋转角度,参数为角度 | -| strokeColor | string | 设置矢量图标的线填充颜色,支持颜色常量字符串、十六进制、RGB、RGBA 等格式 | -| strokeOpacity | number | 设置矢量图标线的透明度,opacity 范围 0~1 | -| strokeWeight | number | 旋设置线宽。如果此属性没有指定,则线宽跟 scale 数值相同 | - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Symbol, SymbolShapeType, Animation } from "rc-bmap"; - -const point = { - lng: 116.404, - lat: 39.915 -}; - -render( - - - , - document.getElementById("app") -); -``` - -## Label-文本标注 - -上面我们已经看到了一个最简单`Label`的实现方式。 - -这是 Label 所支持的全部属性: - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Label } from "rc-bmap"; - -const point = { - lng: 116.404, - lat: 39.915 -}; - -const offset = { - width: 3, - height: 0 -}; - -const events = { - click() { - console.log("label click"); - } -}; - -const style = { - backgroundColor: "red", - color: "#fff" -}; - -render( - - , - document.getElementById("app") -); -``` - -## InfoWindow-信息窗口 - -> 对应[百度文档地址](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b7)。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, InfoWindow } from "rc-bmap"; - -const point = { - lng: 116.404, - lat: 39.915 -}; - -const offset = { - width: 3, - height: 0 -}; - -const events = { - open() { - console.log("InfoWindow open"); - } -}; - -render( - - - , - document.getElementById("app") -); -``` - -## Polyline-折线 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b11) - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Polyline } from "rc-bmap"; - -const points = [ - { - lng: 116.399, - lat: 39.91 - }, - { - lng: 116.405, - lat: 39.92 - }, - { - lng: 116.425, - lat: 39.9 - } -]; - -const events = { - click() { - console.log("Polyline click"); - } -}; - -render( - - - , - document.getElementById("app") -); -``` - -## Circle-圆 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b16) - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Circle } from "rc-bmap"; - -const point = { - lng: 116.404, - lat: 39.915 -}; - -const events = { - click() { - console.log("Circle click"); - } -}; - -render( - - - , - document.getElementById("app") -); -``` - -## Polygon-多边形 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b14) - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Polygon } from "rc-bmap"; - -const points = [ - { - lng: 116.387112, - lat: 39.920977 - }, - { - lng: 116.385243, - lat: 39.913063 - }, - { - lng: 116.394226, - lat: 39.917988 - }, - { - lng: 116.401772, - lat: 39.921364 - }, - { - lng: 116.41248, - lat: 39.927893 - } -]; - -const events = { - click() { - console.log("Polygon click"); - } -}; - -render( - - - , - document.getElementById("app") -); -``` - -## Boundary-行政区域 - -该类继承自多边形`Polygon`,享有其所有属性,`Boundary`额外提供了 3 个属性`name`、`onError`、`autoViewport`。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Boundary } from "rc-bmap"; - -const events = { - click() { - console.log("Boundary click"); - } -}; - -const onError = () => { - console.log("onError"); -}; - -render( - - - , - document.getElementById("app") -); -``` - -## PointCollection-海量标注 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b20),示例中 points 文件来自于[百度提供 js](http://api.map.baidu.com/library/CurveLine/1.5/src/CurveLine.min.js)。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, PointCollection, SizeType, ShapeType } from ".rc-bmap"; -import points from "./points"; - -const events = { - click() { - console.log("PointCollection click"); - } -}; - -const pList = points.data.map(item => { - return { - lng: item[0], - lat: item[1] - }; -}); - -const mapCenter = { lng: 105.0, lat: 38.0 }; - -render( - - - , - document.getElementById("app") -); -``` - -## Ground-地面叠加层 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b18) - -这里的 bounds 第一次出现,如果你还不了解,可以[参考](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a1b2)。 -其中,`sw`表示矩形西南角经纬度,`ne`表示矩形东北角经纬度。 - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, Ground } from "rc-bmap"; - -const events = { - click() { - console.log("Ground click"); - } -}; - -const bounds = { - sw: { - lng: 116.29579, - lat: 39.837146 - }, - ne: { - lng: 116.475451, - lat: 39.9764 - } -}; - -render( - - - , - document.getElementById("app") -); -``` diff --git a/docs/guide/question.md b/docs/guide/question.md deleted file mode 100644 index f67ab7c..0000000 --- a/docs/guide/question.md +++ /dev/null @@ -1,9 +0,0 @@ -# Q&A - -## 1.地图滚动缩放表现效果与预期不符? - -请确认`Map`的父节点是否包含`position: fixed`,此处已反馈给百度官方。 - -## 2.在移动端规划路线未正常显示? - -请确认是否有全局样式,`canvas { width: 100% }` 导致路线未正常显示。 \ No newline at end of file diff --git a/docs/guide/route.md b/docs/guide/route.md deleted file mode 100644 index d419de2..0000000 --- a/docs/guide/route.md +++ /dev/null @@ -1,272 +0,0 @@ -# 规划 - -出于对规划相关的需求不同,所以这里不只是做简单的两点规划展示,您可以通过`getInstance`方法获取到对应组件实例后,进行规划操作。 - -以下所有规划类,将`Options`展开作为属性传入组件即可。 - -::: warning 需要注意一点 -每个规划均提供`ShowInMap`属性,用来表示是否将查询结果渲染至地图中,若不需要展示,不设置即可。 - -由于 3.0 的 api,部分规划不支持模糊匹配搜索(根据中文地名查询规划),所以在此提供 -`getPoiByKeyword`方法,用于支持模糊匹配。 -::: - -## TransitRoute-公交线路规划 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a7b7) - -```js -import React from "react"; -import { render } from "react-dom"; -import { - Map, - TransitRoute, - getPoiByKeyword, - TransitPolicy, - IntercityPolicy, - TransitTypePolicy -} from "rc-bmap"; - -let route; -const getRoute = instance => { - route = instance; -}; - -const mapMounted = map => { - Promise.all([ - getPoiByKeyword("百度大厦"), - getPoiByKeyword("北京邮电大学西门") - ]).then(res => { - route.search(res[0], res[1]); - }); -}; - -render( - - - , - document.getElementById("app") -); -``` - -## DrivingRoute-驾车路线规划 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a7b22) - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, DrivingRoute, getPoiByKeyword, DrivingPolicy } from "rc-bmap"; - -let route; -const getRoute = instance => { - route = instance; -}; - -const mapMounted = map => { - Promise.all([ - getPoiByKeyword("百度大厦"), - getPoiByKeyword("北京邮电大学西门") - ]).then(res => { - route.search(res[0], res[1]); - }); -}; - -render( - - - , - document.getElementById("app") -); -``` - -## RidingRoute-骑行路线规划 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a7b19) - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, RidingRoute, getPoiByKeyword } from "rc-bmap"; - -let route; -const getRoute = instance => { - route = instance; -}; - -const mapMounted = map => { - Promise.all([ - getPoiByKeyword("百度大厦"), - getPoiByKeyword("北京邮电大学西门") - ]).then(res => { - route.search(res[0], res[1]); - }); -}; - -render( - - - , - document.getElementById("app") -); -``` - -## WalkingRoute-步行路线规划 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a7b16) - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, WalkingRoute, getPoiByKeyword } from "rc-bmap"; - -let route; -const getRoute = instance => { - route = instance; -}; - -const mapMounted = map => { - Promise.all([ - getPoiByKeyword("百度大厦"), - getPoiByKeyword("北京邮电大学西门") - ]).then(res => { - route.search(res[0], res[1]); - }); -}; - -render( - - - , - document.getElementById("app") -); -``` - -## LocalSearch-周边检索 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a7b0) - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, LocalSearch, getPoiByKeyword, getMapBounds } from "rc-bmap"; - -let route; -const getRoute = instance => { - route = instance; -}; - -const mapMounted = map => { - route.searchInBounds(["酒店", "加油站"], getMapBounds()); -}; - -render( - - - , - document.getElementById("app") -); -``` - -## BusLineSearch-公交路线搜索 - -> [百度文档](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a7b43) - -```js -import React from "react"; -import { render } from "react-dom"; -import { Map, BusLineSearch, getPoiByKeyword } from "rc-bmap"; - -let route; -const getRoute = instance => { - route = instance; -}; - -const mapMounted = map => { - route.getBusList(331); -}; - -const onGetBusListComplete = result => { - if (result) { - // 获取第一个公交列表显示到map上 - const fstLine = result.getBusListItem(0); - route.getBusLine(fstLine); - } -}; - -render( - - - , - document.getElementById("app") -); -``` - -## 工具方法 - -为了更好的支持规划相关的使用而暴露出来的方法。 - -### getPoiByKeyword(keyword) - -根据关键字获取[LocalResultPoi](http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a7b5),该方法返回值为`Promise`。 - -### getMapBounds() - -获取当前地图可视区域,返回值为`{ sw, ne }`。 - -### getBounds({sw, ne}) - -返回一个包含所有给定点坐标的矩形区域。其中 sw 表示矩形区域的西南角,参数 ne 表示矩形区域的东北角。 diff --git a/examples/.babelrc b/examples/.babelrc deleted file mode 100644 index 4d67dba..0000000 --- a/examples/.babelrc +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": ["env", "react"], - "plugins": [ - ["transform-runtime", { - "helpers": false, - "polyfill": false, - "regenerator": true, - "moduleName": "babel-runtime" - }], - "transform-class-properties", - ["import", { "libraryName": "antd", "libraryDirectory": "es", "style": "css" }] - ] -} \ No newline at end of file diff --git a/examples/.eslintrc b/examples/.eslintrc deleted file mode 100644 index 83b3289..0000000 --- a/examples/.eslintrc +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "airbnb", - "parser": "babel-eslint", - "plugins":[ - "react", - "jsx-a11y", - "import" - ], - "rules": { - "import/no-extraneous-dependencies": "off", - "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], - "react/prop-types": 0, - "react/no-array-index-key": "off", - "import/no-unresolved": "off", - "no-multiple-empty-lines": ["error", {"max": 1} ], - "indent": ["error", 2] - } -} \ No newline at end of file diff --git a/examples/config/webpack.common.js b/examples/config/webpack.common.js deleted file mode 100644 index 0d30259..0000000 --- a/examples/config/webpack.common.js +++ /dev/null @@ -1,81 +0,0 @@ -const path = require('path'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const CleanWebpackPlugin = require('clean-webpack-plugin'); -const MiniCssExtractPlugin = require('mini-css-extract-plugin'); - -const PUBLIC_PATH = process.env.NODE_ENV === 'production' ? './' : '../'; - -module.exports = { - entry: { - main: './index.js', - }, - output: { - path: path.resolve(__dirname, '../dist'), - filename: '[name].[contenthash:12].js', - publicPath: PUBLIC_PATH, - }, - module: { - rules: [ - { - test: /\.js$/, - exclude: /node_modules/, - loader: 'babel-loader?cacheDirectory', - }, - { - test: /\.css$/, - exclude: /node_modules/, - use: [ - MiniCssExtractPlugin.loader, - 'css-loader?modules&localIdentName=[name]-[hash:base64:5]', - ], - }, - {// antd样式处理 - test: /\.css$/, - exclude: /src/, - use: [ - { loader: 'style-loader' }, - { - loader: 'css-loader', - options: { - importLoaders: 1, - }, - }, - ], - }, - { - test: /\.(png|svg|jpg|gif)$/, - use: [ - 'file-loader', - ], - }, - { - test: /\.(md)$/, - include: /src/, - use: [ - 'text-loader', - ], - }, - { - test: /\.(woff|woff2|eot|ttf|otf)$/, - use: [ - 'file-loader', - ], - }, - ], - }, - resolve: { - alias: { - components: path.resolve(__dirname, '../src/components'), - utils: path.resolve(__dirname, '../src/util'), - }, - }, - plugins: [ - new CleanWebpackPlugin(['dist'], { - root: path.resolve(__dirname, '../'), - }), - new HtmlWebpackPlugin({ - title: 'Demo', - template: './index.html', - }), - ], -}; diff --git a/examples/config/webpack.dev.js b/examples/config/webpack.dev.js deleted file mode 100644 index 2376831..0000000 --- a/examples/config/webpack.dev.js +++ /dev/null @@ -1,22 +0,0 @@ -const merge = require('webpack-merge'); -const path = require('path'); -const MiniCssExtractPlugin = require('mini-css-extract-plugin'); -const common = require('./webpack.common'); - -module.exports = merge(common, { - mode: 'development', - devtool: 'inline-source-map', - devServer: { - contentBase: path.resolve(__dirname, '../src/'), - compress: true, - port: 9000, - historyApiFallback: true, - publicPath: '//localhost:9000/', - }, - plugins: [ - new MiniCssExtractPlugin({ - filename: '[name].css', - chunkFilename: '[id].css', - }), - ], -}); diff --git a/examples/config/webpack.prod.js b/examples/config/webpack.prod.js deleted file mode 100644 index 4a97b6a..0000000 --- a/examples/config/webpack.prod.js +++ /dev/null @@ -1,62 +0,0 @@ -const merge = require('webpack-merge'); -const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); -const MiniCssExtractPlugin = require('mini-css-extract-plugin'); -const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); -// const BundleAnalyzer = require('webpack-bundle-analyzer'); -const common = require('./webpack.common'); - -// const { BundleAnalyzerPlugin } = BundleAnalyzer; - -module.exports = merge(common, { - mode: 'production', - optimization: { - minimizer: [ - new UglifyJsPlugin({ - cache: true, - parallel: true, - sourceMap: true, - uglifyOptions: { - mangle: { - safari10: true, - }, - }, - }), - new OptimizeCSSAssetsPlugin({}), // use OptimizeCSSAssetsPlugin - ], - runtimeChunk: { - name: 'manifest', - }, - splitChunks: { - chunks: 'all', - cacheGroups: { - libs: {// node_modules内的依赖库 - test: /[\\/]node_modules[\\/]/, - name: 'chunk-libs', - minChunks: 1, // 被不同entry引用次数(import),1次的话没必要提取 - maxInitialRequests: 5, - minSize: 0, - priority: 100, - chunks: 'initial', - // enforce: true? - }, - antd: { - test: /[\\/]node_modules[\\/]antd[\\/]/, - name: 'chunk-antd', - priority: 110, - }, - map: { - test: /[\\/]node_modules[\\/]rc-bmap[\\/]/, - name: 'chunk-map', - priority: 115, - }, - }, - }, - }, - plugins: [ - new MiniCssExtractPlugin({ - filename: '[name].[contenthash:12].css', - chunkFilename: '[name].[contenthash:12].css', // use contenthash * - }), - // new BundleAnalyzerPlugin(), - ], -}); diff --git a/examples/index.html b/examples/index.html deleted file mode 100644 index 2779bb7..0000000 --- a/examples/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - React&百度地图 示例 - - -
    - - diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 2f6bc75..0000000 --- a/examples/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import App from './src/App'; - -ReactDOM.render( - , - document.getElementById('root'), -); diff --git a/examples/package.json b/examples/package.json deleted file mode 100644 index 39f429a..0000000 --- a/examples/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "demo", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "build": "export NODE_ENV=production && webpack --config config/webpack.prod.js", - "dev": "webpack-dev-server --config config/webpack.dev.js" - }, - "author": "", - "license": "ISC", - "devDependencies": { - "babel-core": "^6.26.3", - "babel-eslint": "^8.2.6", - "babel-loader": "^7.1.5", - "babel-plugin-import": "^1.8.0", - "babel-plugin-transform-class-properties": "^6.24.1", - "babel-plugin-transform-runtime": "^6.23.0", - "babel-preset-env": "^1.7.0", - "babel-preset-react": "^6.24.1", - "clean-webpack-plugin": "^0.1.19", - "css-loader": "^1.0.0", - "eslint": "^4.19.1", - "eslint-config-airbnb": "^17.0.0", - "eslint-plugin-import": "^2.13.0", - "eslint-plugin-jsx-a11y": "^6.1.1", - "eslint-plugin-react": "^7.10.0", - "html-webpack-plugin": "^3.2.0", - "mini-css-extract-plugin": "^0.4.1", - "optimize-css-assets-webpack-plugin": "^5.0.0", - "style-loader": "^0.22.1", - "uglifyjs-webpack-plugin": "^1.2.7", - "webpack": "^4.16.5", - "webpack-bundle-analyzer": "^2.13.1", - "webpack-cli": "^3.1.0", - "webpack-dev-server": "^3.1.5", - "webpack-merge": "^4.1.4" - }, - "dependencies": { - "antd": "^3.8.1", - "rc-bmap": "0.2.2", - "react": "^16.4.2", - "react-dom": "^16.4.2", - "react-router-dom": "^4.3.1", - "react-syntax-highlighter": "^8.0.1", - "text-loader": "^0.0.1" - } -} diff --git a/examples/src/App.js b/examples/src/App.js deleted file mode 100644 index d0bddcf..0000000 --- a/examples/src/App.js +++ /dev/null @@ -1,50 +0,0 @@ -import React from 'react'; -import { Link, BrowserRouter as Router } from 'react-router-dom'; -import { Layout, Menu } from 'antd'; -import menuData from './menuData'; -import route from './router'; - -const { - Content, Sider, -} = Layout; - -const { SubMenu } = Menu; - -const App = () => ( - - - - - { - menuData.map((item, index) => ( - - { - item.children.map((child, idx) => ( - - - {child.text} - - - )) - } - - )) - } - - - - - { route() } - - - - -); - -export default App; diff --git a/examples/src/app.css b/examples/src/app.css deleted file mode 100644 index 715d873..0000000 --- a/examples/src/app.css +++ /dev/null @@ -1,3 +0,0 @@ -.container { - list-style: none; -} \ No newline at end of file diff --git a/examples/src/components/Container/index.js b/examples/src/components/Container/index.js deleted file mode 100644 index ce96035..0000000 --- a/examples/src/components/Container/index.js +++ /dev/null @@ -1,26 +0,0 @@ -/* eslint-disable */ -import React from 'react'; -import { Row, Col } from 'antd'; -import SyntaxHighlighter, { registerLanguage } from "react-syntax-highlighter/prism-light"; -import jsx from 'react-syntax-highlighter/languages/prism/jsx'; -import prism from 'react-syntax-highlighter/styles/prism/prism'; - -registerLanguage('jsx', jsx); - -export default function (props) { - return ( - - - - {props.code} - - - -
    - {props.children} -
    - -
    - ); -} -/* eslint-enable */ diff --git a/examples/src/control/cityList/index.js b/examples/src/control/cityList/index.js deleted file mode 100644 index 6216cda..0000000 --- a/examples/src/control/cityList/index.js +++ /dev/null @@ -1,72 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - CityList, -} from 'rc-bmap'; -import { getRandomControlAnchor } from 'utils'; -import Container from 'components/Container'; -import City from './index.md'; - -class CityListExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 0, - height: 0, - }, - anchor: ControlAnchor.TOP_RIGHT, - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - onChangeBefore = () => { - console.log('onChangeBefore'); - } - - onChangeAfter = () => { - console.log('onChangeAfter'); - } - - render() { - const { offset, anchor } = this.state; - return ( - -
    - - - - - -
    -
    - ); - } -} - -export default CityListExample; diff --git a/examples/src/control/cityList/index.md b/examples/src/control/cityList/index.md deleted file mode 100644 index bfa7a39..0000000 --- a/examples/src/control/cityList/index.md +++ /dev/null @@ -1,70 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - CityList, -} from 'rc-bmap'; -import { getRandomControlAnchor } from 'utils'; - -class CitylistExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 0, - height: 0, - }, - anchor: ControlAnchor.TOP_RIGHT, - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - onChangeBefore = () => { - console.log('onChangeBefore'); - } - - onChangeAfter = () => { - console.log('onChangeAfter'); - } - - render() { - const { offset, anchor } = this.state; - return ( - -
    - - - - - -
    -
    - ); - } -} - -export default CityListExample; diff --git a/examples/src/control/copyright/index.js b/examples/src/control/copyright/index.js deleted file mode 100644 index 9640a29..0000000 --- a/examples/src/control/copyright/index.js +++ /dev/null @@ -1,72 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - Copyright, -} from 'rc-bmap'; -import { getRandomControlAnchor } from 'utils'; -import Container from 'components/Container'; -import Copy from './index.md'; - -class CopyrightExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 10, - height: 10, - }, - anchor: ControlAnchor.TOP_RIGHT, - content: '该版权的文本信息,用于显示在地图上,支持HTML内容', - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - handleContent = () => { - const { content } = this.state; - this.setState({ - content: content === '版权信息' ? '

    这是一段HTML内容

    ' : '版权信息', - }); - } - - render() { - const { offset, anchor, content } = this.state; - return ( - -
    - - - - - - -
    -
    - ); - } -} - -export default CopyrightExample; diff --git a/examples/src/control/copyright/index.md b/examples/src/control/copyright/index.md deleted file mode 100644 index b06c048..0000000 --- a/examples/src/control/copyright/index.md +++ /dev/null @@ -1,70 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - Copyright, -} from 'rc-bmap'; -import { getRandomControlAnchor } from 'utils'; - -class CopyrightExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 10, - height: 10, - }, - anchor: ControlAnchor.TOP_RIGHT, - content: '该版权的文本信息,用于显示在地图上,支持HTML内容', - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - handleContent = () => { - const { content } = this.state; - this.setState({ - content: content === '版权信息' ? '

    这是一段HTML内容

    ' : '版权信息', - }); - } - - render() { - const { offset, anchor, content } = this.state; - return ( - -
    - - - - - - -
    -
    - ); - } -} - -export default CopyrightExample; diff --git a/examples/src/control/geolocation/index.js b/examples/src/control/geolocation/index.js deleted file mode 100644 index 5f8e03a..0000000 --- a/examples/src/control/geolocation/index.js +++ /dev/null @@ -1,112 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - Geolocation, -} from 'rc-bmap'; -import { getRandomControlAnchor } from 'utils'; -import Container from 'components/Container'; -import Geo from './index.md'; - -class GeolocationExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 0, - height: 0, - }, - anchor: ControlAnchor.TOP_RIGHT, - showAddressBar: true, - autoLocation: false, - locationIcon: null, - events: { - locationSuccess: (event) => { - console.log('locationSuccess', event); - }, - locationError: (event) => { - console.log('locationError', event); - }, - }, - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - hideAddressBar = () => { - const { showAddressBar } = this.state; - this.setState({ - showAddressBar: !showAddressBar, - }); - } - - autoLocation = () => { - const { autoLocation } = this.state; - this.setState({ - autoLocation: !autoLocation, - }); - } - - handleIcon = () => { - this.setState({ - locationIcon: { - url: 'http://api0.map.bdimg.com/images/copyright_logo.png', - size: { - width: 100, - height: 100, - }, - }, - }); - } - - render() { - const { - offset, anchor, showAddressBar, locationIcon, autoLocation, events, - } = this.state; - return ( - -
    - - - - - - - - -
    -
    - ); - } -} - -export default GeolocationExample; diff --git a/examples/src/control/geolocation/index.md b/examples/src/control/geolocation/index.md deleted file mode 100644 index b577a82..0000000 --- a/examples/src/control/geolocation/index.md +++ /dev/null @@ -1,110 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - Geolocation, -} from 'rc-bmap'; -import { getRandomControlAnchor } from 'utils'; - -class GeolocationExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 0, - height: 0, - }, - anchor: ControlAnchor.TOP_RIGHT, - showAddressBar: true, - autoLocation: false, - locationIcon: null, - events: { - locationSuccess: (event) => { - console.log('locationSuccess', event); - }, - locationError: (event) => { - console.log('locationError', event); - }, - }, - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - hideAddressBar = () => { - const { showAddressBar } = this.state; - this.setState({ - showAddressBar: !showAddressBar, - }); - } - - autoLocation = () => { - const { autoLocation } = this.state; - this.setState({ - autoLocation: !autoLocation, - }); - } - - handleIcon = () => { - this.setState({ - locationIcon: { - url: 'http://api0.map.bdimg.com/images/copyright_logo.png', - size: { - width: 100, - height: 100, - }, - }, - }); - } - - render() { - const { - offset, anchor, showAddressBar, locationIcon, autoLocation, events, - } = this.state; - return ( - -
    - - - - - - - - -
    -
    - ); - } -} - -export default GeolocationExample; diff --git a/examples/src/control/mapTypeCtrl/index.js b/examples/src/control/mapTypeCtrl/index.js deleted file mode 100644 index 2b2f48c..0000000 --- a/examples/src/control/mapTypeCtrl/index.js +++ /dev/null @@ -1,88 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - MapTypeCtrl, - MapType, - MapTypeControlType, -} from 'rc-bmap'; -import { - getRandomControlAnchor, - getRandomMapType, - getRandomMapTypeControlType, -} from 'utils'; -import Container from 'components/Container'; -import MTC from './index.md'; - -class MapTypeCtrlExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 0, - height: 0, - }, - anchor: ControlAnchor.TOP_RIGHT, - type: MapTypeControlType.HORIZONTAL, - mapTypes: [MapType.NORMAL, MapType.PERSPECTIVE, MapType.SATELLITE, MapType.HYBRID], - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - handleType = () => { - this.setState({ - type: MapTypeControlType[getRandomMapTypeControlType()], - }); - } - - handleMapTypes = () => { - this.setState({ - mapTypes: [MapType[getRandomMapType()]], - }); - } - - render() { - const { - offset, anchor, type, mapTypes, - } = this.state; - return ( - -
    - - - - - - - -
    -
    - ); - } -} - -export default MapTypeCtrlExample; diff --git a/examples/src/control/mapTypeCtrl/index.md b/examples/src/control/mapTypeCtrl/index.md deleted file mode 100644 index 0785444..0000000 --- a/examples/src/control/mapTypeCtrl/index.md +++ /dev/null @@ -1,86 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - MapTypeCtrl, - MapType, - MapTypeControlType, -} from 'rc-bmap'; -import { - getRandomControlAnchor, - getRandomMapType, - getRandomMapTypeControlType -} from 'utils'; - -class MapTypeCtrlExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 0, - height: 0, - }, - anchor: ControlAnchor.TOP_RIGHT, - type: MapTypeControlType.HORIZONTAL, - mapTypes: [MapType.NORMAL, MapType.PERSPECTIVE, MapType.SATELLITE, MapType.HYBRID], - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - handleType = () => { - this.setState({ - type: MapTypeControlType[getRandomMapTypeControlType()], - }); - } - - handleMapTypes = () => { - this.setState({ - mapTypes: [MapType[getRandomMapType()]], - }); - } - - render() { - const { - offset, anchor, type, mapTypes, - } = this.state; - return ( - -
    - - - - - - - -
    -
    - ); - } -} - -export default MapTypeCtrlExample; diff --git a/examples/src/control/navigation/index.js b/examples/src/control/navigation/index.js deleted file mode 100644 index fe08aaa..0000000 --- a/examples/src/control/navigation/index.js +++ /dev/null @@ -1,94 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - Navigation, - NavigationType, -} from 'rc-bmap'; -import { getRandomControlAnchor, getRandomNavigationType } from 'utils'; -import Container from 'components/Container'; -import Nav from './index.md'; - -class NavigationExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 0, - height: 0, - }, - anchor: ControlAnchor.TOP_LEFT, - type: NavigationType.LARGE, - showZoomInfo: true, - geolocation: false, - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - handleType = () => { - this.setState({ - type: NavigationType[getRandomNavigationType()], - }); - } - - hideZoom = () => { - const { showZoomInfo } = this.state; - this.setState({ - showZoomInfo: !showZoomInfo, - }); - } - - geolocation = () => { - const { geolocation } = this.state; - this.setState({ - geolocation: !geolocation, - }); - } - - render() { - const { - offset, anchor, type, showZoomInfo, geolocation, - } = this.state; - return ( - -
    - - - - - - - - -
    -
    - ); - } -} - -export default NavigationExample; diff --git a/examples/src/control/navigation/index.md b/examples/src/control/navigation/index.md deleted file mode 100644 index b63d1b1..0000000 --- a/examples/src/control/navigation/index.md +++ /dev/null @@ -1,96 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - Navigation, - NavigationType, -} from 'rc-bmap'; -import { getRandomControlAnchor, getRandomNavigationType } from 'utils'; - -class NavigationExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 0, - height: 0, - }, - anchor: ControlAnchor.TOP_LEFT, - type: NavigationType.LARGE, - showZoomInfo: true, - geolocation: false, - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - handleType = () => { - this.setState({ - type: NavigationType[getRandomNavigationType()], - }); - } - - hideZoom = () => { - const { showZoomInfo } = this.state; - this.setState({ - showZoomInfo: !showZoomInfo, - }); - } - - geolocation = () => { - const { geolocation } = this.state; - this.setState({ - geolocation: !geolocation, - }); - } - - render() { - const { - offset, anchor, type, showZoomInfo, geolocation, - } = this.state; - return ( - -
    - - - - - - - - -
    -
    - ); - } -} - -export default NavigationExample; diff --git a/examples/src/control/overviewMap/index.js b/examples/src/control/overviewMap/index.js deleted file mode 100644 index ff7daf5..0000000 --- a/examples/src/control/overviewMap/index.js +++ /dev/null @@ -1,101 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - OverviewMap, -} from 'rc-bmap'; -import { getRandomControlAnchor } from 'utils'; -import Container from 'components/Container'; -import Overview from './index.md'; - -class OverviewMapExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 0, - height: 0, - }, - anchor: ControlAnchor.TOP_RIGHT, - isOpen: true, - size: { - width: 150, - height: 150, - }, - events: { - viewchanged: (event) => { - console.log('viewchanged', event); - }, - viewchanging: (event) => { - console.log('viewchanging', event); - }, - }, - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - hideMap = () => { - const { isOpen } = this.state; - this.setState({ - isOpen: !isOpen, - }); - } - - handleSize = () => { - const { size } = this.state; - this.setState({ - size: { - width: size.width + 10, - height: size.height + 10, - }, - }); - } - - render() { - const { - offset, anchor, size, isOpen, events, - } = this.state; - return ( - -
    - - - - - - - -
    -
    - ); - } -} - -export default OverviewMapExample; diff --git a/examples/src/control/overviewMap/index.md b/examples/src/control/overviewMap/index.md deleted file mode 100644 index db72f11..0000000 --- a/examples/src/control/overviewMap/index.md +++ /dev/null @@ -1,99 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - OverviewMap, -} from 'rc-bmap'; -import { getRandomControlAnchor } from 'utils'; - -class OverviewMapExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 0, - height: 0, - }, - anchor: ControlAnchor.TOP_RIGHT, - isOpen: true, - size: { - width: 150, - height: 150, - }, - events: { - viewchanged: (event) => { - console.log('viewchanged', event); - }, - viewchanging: (event) => { - console.log('viewchanging', event); - }, - }, - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - hideMap = () => { - const { isOpen } = this.state; - this.setState({ - isOpen: !isOpen, - }); - } - - handleSize = () => { - const { size } = this.state; - this.setState({ - size: { - width: size.width + 10, - height: size.height + 10, - }, - }); - } - - render() { - const { - offset, anchor, size, isOpen, events, - } = this.state; - return ( - -
    - - - - - - - -
    -
    - ); - } -} - -export default OverviewMapExample; diff --git a/examples/src/control/panorama/index.js b/examples/src/control/panorama/index.js deleted file mode 100644 index 9f659aa..0000000 --- a/examples/src/control/panorama/index.js +++ /dev/null @@ -1,62 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - Panorama, -} from 'rc-bmap'; -import { getRandomControlAnchor } from 'utils'; -import Container from 'components/Container'; -import Pano from './index.md'; - -class PanoramaExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 0, - height: 0, - }, - anchor: ControlAnchor.TOP_RIGHT, - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - render() { - const { offset, anchor } = this.state; - return ( - -
    - - - - - -
    -
    - ); - } -} - -export default PanoramaExample; diff --git a/examples/src/control/panorama/index.md b/examples/src/control/panorama/index.md deleted file mode 100644 index 9f3da77..0000000 --- a/examples/src/control/panorama/index.md +++ /dev/null @@ -1,60 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - Panorama, -} from 'rc-bmap'; -import { getRandomControlAnchor } from 'utils'; - -class PanoramaExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 0, - height: 0, - }, - anchor: ControlAnchor.TOP_RIGHT, - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - render() { - const { offset, anchor } = this.state; - return ( - -
    - - - - - -
    -
    - ); - } -} - -export default PanoramaExample; diff --git a/examples/src/control/scale/index.js b/examples/src/control/scale/index.js deleted file mode 100644 index d24069f..0000000 --- a/examples/src/control/scale/index.js +++ /dev/null @@ -1,75 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - Scale, - LengthUnit, -} from 'rc-bmap'; -import Container from 'components/Container'; -import { getRandomControlAnchor } from 'utils'; -import Sc from './index.md'; - -class ScaleExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 10, - height: 10, - }, - anchor: ControlAnchor.TOP_RIGHT, - unit: LengthUnit.METRIC, - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - handleUnit = () => { - const { unit } = this.state; - this.setState({ - unit: unit === LengthUnit.IMPERIAL ? LengthUnit.METRIC : LengthUnit.IMPERIAL, - }); - } - - render() { - const { offset, anchor, unit } = this.state; - return ( - -
    - - - - - - -
    -
    - ); - } -} - -export default ScaleExample; diff --git a/examples/src/control/scale/index.md b/examples/src/control/scale/index.md deleted file mode 100644 index ea82688..0000000 --- a/examples/src/control/scale/index.md +++ /dev/null @@ -1,73 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - Scale, - LengthUnit, -} from 'rc-bmap'; -import { getRandomControlAnchor } from 'utils'; - -class ScaleExample extends React.Component { - constructor(props) { - super(props); - this.state = { - offset: { - width: 10, - height: 10, - }, - anchor: ControlAnchor.TOP_RIGHT, - unit: LengthUnit.METRIC, - }; - } - - handleAnchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - handleUnit = () => { - const { unit } = this.state; - this.setState({ - unit: unit === LengthUnit.IMPERIAL ? LengthUnit.METRIC : LengthUnit.IMPERIAL, - }); - } - - render() { - const { offset, anchor, unit } = this.state; - return ( - -
    - - - - - - -
    -
    - ); - } -} - -export default ScaleExample; diff --git a/examples/src/lib/curveLine/index.js b/examples/src/lib/curveLine/index.js deleted file mode 100644 index 233c62f..0000000 --- a/examples/src/lib/curveLine/index.js +++ /dev/null @@ -1,112 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - CurveLine, -} from 'rc-bmap'; -import Container from 'components/Container'; -import { getRandomColor } from 'utils'; -import Cur from './index.md'; - -class CurveLineExample extends React.Component { - constructor(props) { - super(props); - this.state = { - points: [ - { lng: 116.432045, lat: 39.910683 }, - { lng: 120.129721, lat: 30.314429 }, - { lng: 121.491121, lat: 25.127053 }, - ], - zoom: 5, - center: { - lng: 120.129721, - lat: 30.314429, - }, - strokeColor: 'blue', - strokeWeight: 3, - strokeOpacity: 0.6, - editing: false, - events: { - click() { - console.log('CurveLine click'); - }, - }, - }; - } - - handlePoints = () => { - const { points } = this.state; - this.setState({ - points: [ - { lng: points[0].lng + 0.01, lat: points[0].lat + 0.01 }, - { lng: points[1].lng + 0.01, lat: points[1].lat + 0.01 }, - { lng: points[2].lng + 0.01, lat: points[2].lat + 0.01 }, - ], - }); - } - - handleColor = () => { - this.setState({ - strokeColor: getRandomColor(), - }); - } - - handleStrokeWeight = () => { - const { strokeWeight } = this.state; - this.setState({ - strokeWeight: strokeWeight + 1, - }); - } - - handleStrokeOpacity = () => { - let { strokeOpacity } = this.state; - if (strokeOpacity > 0.9) { - strokeOpacity = 0.1; - } - this.setState({ - strokeOpacity: strokeOpacity + 0.1, - }); - } - - handleEditing = () => { - const { editing } = this.state; - this.setState({ - editing: !editing, - }); - } - - render() { - const { - zoom, center, points, strokeColor, strokeWeight, strokeOpacity, events, editing, - } = this.state; - console.log(strokeOpacity); - return ( - -
    - - - - - - - - -
    -
    - ); - } -} - -export default CurveLineExample; diff --git a/examples/src/lib/curveLine/index.md b/examples/src/lib/curveLine/index.md deleted file mode 100644 index 3bbbf05..0000000 --- a/examples/src/lib/curveLine/index.md +++ /dev/null @@ -1,109 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - CurveLine, -} from 'rc-bmap'; -import { getRandomColor } from 'utils'; - -class CurveLineExample extends React.Component { - constructor(props) { - super(props); - this.state = { - points: [ - { lng: 116.432045, lat: 39.910683 }, - { lng: 120.129721, lat: 30.314429 }, - { lng: 121.491121, lat: 25.127053 }, - ], - zoom: 5, - center: { - lng: 120.129721, - lat: 30.314429, - }, - strokeColor: 'blue', - strokeWeight: 3, - strokeOpacity: 0.6, - editing: false, - events: { - click() { - console.log('CurveLine click'); - }, - }, - }; - } - - handlePoints = () => { - const { points } = this.state; - this.setState({ - points: [ - { lng: points[0].lng + 0.01, lat: points[0].lat + 0.01 }, - { lng: points[1].lng + 0.01, lat: points[1].lat + 0.01 }, - { lng: points[2].lng + 0.01, lat: points[2].lat + 0.01 }, - ], - }); - } - - handleColor = () => { - this.setState({ - strokeColor: getRandomColor(), - }); - } - - handleStrokeWeight = () => { - const { strokeWeight } = this.state; - this.setState({ - strokeWeight: strokeWeight + 1, - }); - } - - handleStrokeOpacity = () => { - let { strokeOpacity } = this.state; - if (strokeOpacity > 0.9) { - strokeOpacity = 0.1; - } - this.setState({ - strokeOpacity: strokeOpacity + 0.1, - }); - } - - handleEditing = () => { - const { editing } = this.state; - this.setState({ - editing: !editing, - }); - } - - render() { - const { - zoom, center, points, strokeColor, strokeWeight, strokeOpacity, events, editing, - } = this.state; - return ( - -
    - - - - - - - - -
    -
    - ); - } -} - -export default CurveLineExample; diff --git a/examples/src/lib/distanceTool/index.js b/examples/src/lib/distanceTool/index.js deleted file mode 100644 index 18cda6e..0000000 --- a/examples/src/lib/distanceTool/index.js +++ /dev/null @@ -1,132 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - DistanceTool, -} from 'rc-bmap'; -import { getRandomColor } from 'utils'; -import Container from 'components/Container'; -import Distance from './index.md'; - -class DistanceToolExample extends React.Component { - constructor(props) { - super(props); - this.state = { - followText: '单击确定地点,双击结束', - unit: 'metric', - lineColor: '#ff6319', - lineStroke: 2, - opacity: 0.8, - lineStyle: 'solid', - cursor: 'http://is4.mzstatic.com/image/thumb/Purple122/v4/74/cf/18/74cf1856-76c6-2782-df5a-5637454f6974/source/512x512bb.jpg', - tool: '', - events: { - onaddpoint() { - console.log('on add'); - }, - }, - }; - } - - openTool = () => { - const { tool } = this.state; - tool.open(); // 开启测距状态 - }; - - closeTool = () => { - const { tool } = this.state; - tool.close(); // 关闭测距状态 - }; - - getTool = (instance) => { - this.state.tool = instance; - }; - - handleText = () => { - this.setState({ - followText: '这是一条新的提示信息', - }); - } - - handleUnit = () => { - const { unit } = this.state; - this.setState({ - unit: unit === 'us' ? 'metric' : 'us', - }); - } - - handleLineColor = () => { - this.setState({ - lineColor: getRandomColor(), - }); - } - - handleLineStroke = () => { - this.setState({ - lineStroke: 3, - }); - } - - handleOpacity = () => { - let { opacity } = this.state; - if (opacity > 0.9) { - opacity = 1; - } - this.setState({ - opacity: opacity + 0.1, - }); - } - - handleLineStyle = () => { - const { lineStyle } = this.state; - this.setState({ - lineStyle: lineStyle === 'dashed' ? 'solid' : 'dashed', - }); - } - - handleCursor = () => { - this.setState({ - cursor: 'http://api.map.baidu.com/images/ruler.cur', - }); - } - - render() { - const { - followText, unit, lineColor, lineStroke, opacity, lineStyle, cursor, events, - } = this.state; - return ( - -
    - - - - - - - - - - - - -
    -
    - ); - } -} - -export default DistanceToolExample; diff --git a/examples/src/lib/distanceTool/index.md b/examples/src/lib/distanceTool/index.md deleted file mode 100644 index f5bdd53..0000000 --- a/examples/src/lib/distanceTool/index.md +++ /dev/null @@ -1,130 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - DistanceTool, -} from 'rc-bmap'; -import { getRandomColor } from 'utils'; - -class DistanceToolExample extends React.Component { - constructor(props) { - super(props); - this.state = { - followText: '单击确定地点,双击结束', - unit: 'metric', - lineColor: '#ff6319', - lineStroke: 2, - opacity: 0.8, - lineStyle: 'solid', - cursor: 'http://is4.mzstatic.com/image/thumb/Purple122/v4/74/cf/18/74cf1856-76c6-2782-df5a-5637454f6974/source/512x512bb.jpg', - tool: '', - events: { - onaddpoint() { - console.log('on add'); - }, - }, - }; - } - - openTool = () => { - const { tool } = this.state; - tool.open(); // 开启测距状态 - }; - - closeTool = () => { - const { tool } = this.state; - tool.close(); // 关闭测距状态 - }; - - getTool = (instance) => { - this.state.tool = instance; - }; - - handleText = () => { - this.setState({ - followText: '这是一条新的提示信息', - }); - } - - handleUnit = () => { - const { unit } = this.state; - this.setState({ - unit: unit === 'us' ? 'metric' : 'us', - }); - } - - handleLineColor = () => { - this.setState({ - lineColor: getRandomColor(), - }); - } - - handleLineStroke = () => { - this.setState({ - lineStroke: 3, - }); - } - - handleOpacity = () => { - let { opacity } = this.state; - if (opacity > 0.9) { - opacity = 1; - } - this.setState({ - opacity: opacity + 0.1, - }); - } - - handleLineStyle = () => { - const { lineStyle } = this.state; - this.setState({ - lineStyle: lineStyle === 'dashed' ? 'solid' : 'dashed', - }); - } - - handleCursor = () => { - this.setState({ - cursor: 'http://api.map.baidu.com/images/ruler.cur', - }); - } - - render() { - const { - followText, unit, lineColor, lineStroke, opacity, lineStyle, cursor, events, - } = this.state; - return ( - -
    - - - - - - - - - - - - -
    -
    - ); - } -} - -export default DistanceToolExample; diff --git a/examples/src/lib/drawingManager/index.js b/examples/src/lib/drawingManager/index.js deleted file mode 100644 index f41f81c..0000000 --- a/examples/src/lib/drawingManager/index.js +++ /dev/null @@ -1,111 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - DrawingManager, - DrawingMode, -} from 'rc-bmap'; -import { getRandomControlAnchor, getRandomColor } from 'utils'; -import Container from 'components/Container'; -import Drawing from './index.md'; - -class DrawingManagerExample extends React.Component { - constructor(props) { - super(props); - this.state = { - anchor: ControlAnchor.TOP_RIGHT, - drawingModes: [ - DrawingMode.MARKER, - DrawingMode.CIRCLE, - DrawingMode.POLYLINE, - DrawingMode.RECTANGLE, - DrawingMode.POLYGON, - ], - offset: { width: 10, height: 10 }, - events: { - // 绘制圆完成时间 - circlecomplete(e, overlay) { - console.log(overlay); - }, - }, - circleOptions: { - strokeColor: 'red', // 边线颜色。 - fillColor: 'red', // 填充颜色。当参数为空时,圆形将没有填充效果。 - strokeWeight: 3, // 边线的宽度,以像素为单位。 - strokeOpacity: 0.8, // 边线透明度,取值范围0 - 1。 - fillOpacity: 0.6, // 填充的透明度,取值范围0 - 1。 - strokeStyle: 'solid', // 边线的样式,solid或dashed。 - }, - }; - } - - handleAchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 10, - height: offset.height + 10, - }, - }); - } - - handleModes = () => { - this.setState({ - drawingModes: [ - DrawingMode.MARKER, - DrawingMode.CIRCLE, - ], - }); - } - - handleCircle = () => { - const { circleOptions } = this.state; - this.setState({ - circleOptions: { - strokeColor: getRandomColor(), // 边线颜色。 - fillColor: getRandomColor(), // 填充颜色。当参数为空时,圆形将没有填充效果。 - strokeWeight: 1, // 边线的宽度,以像素为单位。 - strokeOpacity: 0.9, // 边线透明度,取值范围0 - 1。 - fillOpacity: 0.5, // 填充的透明度,取值范围0 - 1。 - strokeStyle: circleOptions.strokeStyle === 'dashed' ? 'solid' : 'dashed', // 边线的样式,solid或dashed。 - }, - }); - } - - render() { - const { - anchor, drawingModes, offset, events, circleOptions, - } = this.state; - return ( - -
    - - - - - - - -
    -
    - ); - } -} - -export default DrawingManagerExample; diff --git a/examples/src/lib/drawingManager/index.md b/examples/src/lib/drawingManager/index.md deleted file mode 100644 index adf1dbb..0000000 --- a/examples/src/lib/drawingManager/index.md +++ /dev/null @@ -1,109 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - DrawingManager, - DrawingMode, -} from 'rc-bmap'; -import { getRandomControlAnchor, getRandomColor } from 'utils'; - -class DrawingManagerExample extends React.Component { - constructor(props) { - super(props); - this.state = { - anchor: ControlAnchor.TOP_RIGHT, - drawingModes: [ - DrawingMode.MARKER, - DrawingMode.CIRCLE, - DrawingMode.POLYLINE, - DrawingMode.RECTANGLE, - DrawingMode.POLYGON, - ], - offset: { width: 10, height: 10 }, - events: { - // 绘制圆完成时间 - circlecomplete(e, overlay) { - console.log(overlay); - }, - }, - circleOptions: { - strokeColor: 'red', // 边线颜色。 - fillColor: 'red', // 填充颜色。当参数为空时,圆形将没有填充效果。 - strokeWeight: 3, // 边线的宽度,以像素为单位。 - strokeOpacity: 0.8, // 边线透明度,取值范围0 - 1。 - fillOpacity: 0.6, // 填充的透明度,取值范围0 - 1。 - strokeStyle: 'solid', // 边线的样式,solid或dashed。 - }, - }; - } - - handleAchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 10, - height: offset.height + 10, - }, - }); - } - - handleModes = () => { - this.setState({ - drawingModes: [ - DrawingMode.MARKER, - DrawingMode.CIRCLE, - ], - }); - } - - handleCircle = () => { - const { circleOptions } = this.state; - this.setState({ - circleOptions: { - strokeColor: getRandomColor(), // 边线颜色。 - fillColor: getRandomColor(), // 填充颜色。当参数为空时,圆形将没有填充效果。 - strokeWeight: 1, // 边线的宽度,以像素为单位。 - strokeOpacity: 0.9, // 边线透明度,取值范围0 - 1。 - fillOpacity: 0.5, // 填充的透明度,取值范围0 - 1。 - strokeStyle: circleOptions.strokeStyle === 'dashed' ? 'solid' : 'dashed', // 边线的样式,solid或dashed。 - }, - }); - } - - render() { - const { - anchor, drawingModes, offset, events, circleOptions, - } = this.state; - return ( - -
    - - - - - - - -
    -
    - ); - } -} - -export default DrawingManagerExample; diff --git a/examples/src/lib/heatmap/index.js b/examples/src/lib/heatmap/index.js deleted file mode 100644 index 5762cda..0000000 --- a/examples/src/lib/heatmap/index.js +++ /dev/null @@ -1,194 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - Heatmap, -} from 'rc-bmap'; -import { getRandomColor } from 'utils'; -import Container from 'components/Container'; -import Heat from './index.md'; - -class HeatmapExample extends React.Component { - constructor(props) { - super(props); - this.state = { - points: [ - { lng: 116.418261, lat: 39.921984, count: 50 }, - { lng: 116.423332, lat: 39.916532, count: 51 }, - { lng: 116.419787, lat: 39.930658, count: 15 }, - { lng: 116.418455, lat: 39.920921, count: 40 }, - { lng: 116.418843, lat: 39.915516, count: 100 }, - { lng: 116.42546, lat: 39.918503, count: 6 }, - { lng: 116.423289, lat: 39.919989, count: 18 }, - { lng: 116.418162, lat: 39.915051, count: 80 }, - { lng: 116.422039, lat: 39.91782, count: 11 }, - { lng: 116.41387, lat: 39.917253, count: 7 }, - { lng: 116.41773, lat: 39.919426, count: 42 }, - { lng: 116.421107, lat: 39.916445, count: 4 }, - { lng: 116.417521, lat: 39.917943, count: 27 }, - { lng: 116.419812, lat: 39.920836, count: 23 }, - { lng: 116.420682, lat: 39.91463, count: 60 }, - { lng: 116.415424, lat: 39.924675, count: 8 }, - { lng: 116.419242, lat: 39.914509, count: 15 }, - { lng: 116.422766, lat: 39.921408, count: 25 }, - { lng: 116.421674, lat: 39.924396, count: 21 }, - { lng: 116.427268, lat: 39.92267, count: 1 }, - { lng: 116.417721, lat: 39.920034, count: 51 }, - { lng: 116.412456, lat: 39.92667, count: 7 }, - { lng: 116.420432, lat: 39.919114, count: 11 }, - { lng: 116.425013, lat: 39.921611, count: 35 }, - { lng: 116.418733, lat: 39.931037, count: 22 }, - { lng: 116.419336, lat: 39.931134, count: 4 }, - { lng: 116.413557, lat: 39.923254, count: 5 }, - { lng: 116.418367, lat: 39.92943, count: 3 }, - { lng: 116.424312, lat: 39.919621, count: 100 }, - { lng: 116.423874, lat: 39.919447, count: 87 }, - { lng: 116.424225, lat: 39.923091, count: 32 }, - { lng: 116.417801, lat: 39.921854, count: 44 }, - { lng: 116.417129, lat: 39.928227, count: 21 }, - { lng: 116.426426, lat: 39.922286, count: 80 }, - { lng: 116.421597, lat: 39.91948, count: 32 }, - { lng: 116.423895, lat: 39.920787, count: 26 }, - { lng: 116.423563, lat: 39.921197, count: 17 }, - { lng: 116.417982, lat: 39.922547, count: 17 }, - { lng: 116.426126, lat: 39.921938, count: 25 }, - { lng: 116.42326, lat: 39.915782, count: 100 }, - { lng: 116.419239, lat: 39.916759, count: 39 }, - { lng: 116.417185, lat: 39.929123, count: 11 }, - { lng: 116.417237, lat: 39.927518, count: 9 }, - { lng: 116.417784, lat: 39.915754, count: 47 }, - { lng: 116.420193, lat: 39.917061, count: 52 }, - { lng: 116.422735, lat: 39.915619, count: 100 }, - { lng: 116.418495, lat: 39.915958, count: 46 }, - { lng: 116.416292, lat: 39.931166, count: 9 }, - { lng: 116.419916, lat: 39.924055, count: 8 }, - { lng: 116.42189, lat: 39.921308, count: 11 }, - { lng: 116.413765, lat: 39.929376, count: 3 }, - { lng: 116.418232, lat: 39.920348, count: 50 }, - { lng: 116.417554, lat: 39.930511, count: 15 }, - { lng: 116.418568, lat: 39.918161, count: 23 }, - { lng: 116.413461, lat: 39.926306, count: 3 }, - { lng: 116.42232, lat: 39.92161, count: 13 }, - { lng: 116.4174, lat: 39.928616, count: 6 }, - { lng: 116.424679, lat: 39.915499, count: 21 }, - { lng: 116.42171, lat: 39.915738, count: 29 }, - { lng: 116.417836, lat: 39.916998, count: 99 }, - { lng: 116.420755, lat: 39.928001, count: 10 }, - { lng: 116.414077, lat: 39.930655, count: 14 }, - { lng: 116.426092, lat: 39.922995, count: 16 }, - { lng: 116.41535, lat: 39.931054, count: 15 }, - { lng: 116.413022, lat: 39.921895, count: 13 }, - { lng: 116.415551, lat: 39.913373, count: 17 }, - { lng: 116.421191, lat: 39.926572, count: 1 }, - { lng: 116.419612, lat: 39.917119, count: 9 }, - { lng: 116.418237, lat: 39.921337, count: 54 }, - { lng: 116.423776, lat: 39.921919, count: 26 }, - { lng: 116.417694, lat: 39.92536, count: 17 }, - { lng: 116.415377, lat: 39.914137, count: 19 }, - { lng: 116.417434, lat: 39.914394, count: 43 }, - { lng: 116.42588, lat: 39.922622, count: 27 }, - { lng: 116.418345, lat: 39.919467, count: 8 }, - { lng: 116.426883, lat: 39.917171, count: 3 }, - { lng: 116.423877, lat: 39.916659, count: 34 }, - { lng: 116.415712, lat: 39.915613, count: 14 }, - { lng: 116.419869, lat: 39.931416, count: 12 }, - { lng: 116.416956, lat: 39.925377, count: 11 }, - { lng: 116.42066, lat: 39.925017, count: 38 }, - { lng: 116.416244, lat: 39.920215, count: 91 }, - { lng: 116.41929, lat: 39.915908, count: 54 }, - { lng: 116.422116, lat: 39.919658, count: 21 }, - { lng: 116.4183, lat: 39.925015, count: 15 }, - { lng: 116.421969, lat: 39.913527, count: 3 }, - { lng: 116.422936, lat: 39.921854, count: 24 }, - { lng: 116.41905, lat: 39.929217, count: 12 }, - { lng: 116.424579, lat: 39.914987, count: 57 }, - { lng: 116.42076, lat: 39.915251, count: 70 }, - { lng: 116.425867, lat: 39.918989, count: 8 }, - ], - opacity: 90, - max: 100, - radius: 20, - center: { - lng: 116.418261, - lat: 39.921984, - }, - }; - } - - handlePoint = () => { - this.setState({ - points: [ - { lng: 116.418261, lat: 39.921984, count: 50 }, - { lng: 116.423332, lat: 39.916532, count: 51 }, - { lng: 116.419787, lat: 39.930658, count: 15 }, - { lng: 116.418455, lat: 39.920921, count: 40 }, - ], - }); - } - - handleRadius = () => { - const { radius } = this.state; - this.setState({ - radius: radius + 3, - }); - } - - handleOpacity = () => { - let { opacity } = this.state; - if (opacity === 100) { - opacity = 1; - } - this.setState({ - opacity: opacity + 1, - }); - } - - handleMax = () => { - const { max } = this.state; - this.setState({ - max: max + 3, - }); - } - - handleGradient = () => { - this.setState({ - gradient: { - 0.2: getRandomColor(), - 0.5: getRandomColor(), - 0.8: getRandomColor(), - }, - }); - } - - render() { - const { - points, radius, max, gradient, center, opacity, - } = this.state; - return ( - -
    - - - - - - - - -
    -
    - ); - } -} - -export default HeatmapExample; diff --git a/examples/src/lib/heatmap/index.md b/examples/src/lib/heatmap/index.md deleted file mode 100644 index 277ff75..0000000 --- a/examples/src/lib/heatmap/index.md +++ /dev/null @@ -1,192 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - Heatmap, -} from 'rc-bmap'; -import { getRandomColor } from 'utils'; - -class HeatmapExample extends React.Component { - constructor(props) { - super(props); - this.state = { - points: [ - { lng: 116.418261, lat: 39.921984, count: 50 }, - { lng: 116.423332, lat: 39.916532, count: 51 }, - { lng: 116.419787, lat: 39.930658, count: 15 }, - { lng: 116.418455, lat: 39.920921, count: 40 }, - { lng: 116.418843, lat: 39.915516, count: 100 }, - { lng: 116.42546, lat: 39.918503, count: 6 }, - { lng: 116.423289, lat: 39.919989, count: 18 }, - { lng: 116.418162, lat: 39.915051, count: 80 }, - { lng: 116.422039, lat: 39.91782, count: 11 }, - { lng: 116.41387, lat: 39.917253, count: 7 }, - { lng: 116.41773, lat: 39.919426, count: 42 }, - { lng: 116.421107, lat: 39.916445, count: 4 }, - { lng: 116.417521, lat: 39.917943, count: 27 }, - { lng: 116.419812, lat: 39.920836, count: 23 }, - { lng: 116.420682, lat: 39.91463, count: 60 }, - { lng: 116.415424, lat: 39.924675, count: 8 }, - { lng: 116.419242, lat: 39.914509, count: 15 }, - { lng: 116.422766, lat: 39.921408, count: 25 }, - { lng: 116.421674, lat: 39.924396, count: 21 }, - { lng: 116.427268, lat: 39.92267, count: 1 }, - { lng: 116.417721, lat: 39.920034, count: 51 }, - { lng: 116.412456, lat: 39.92667, count: 7 }, - { lng: 116.420432, lat: 39.919114, count: 11 }, - { lng: 116.425013, lat: 39.921611, count: 35 }, - { lng: 116.418733, lat: 39.931037, count: 22 }, - { lng: 116.419336, lat: 39.931134, count: 4 }, - { lng: 116.413557, lat: 39.923254, count: 5 }, - { lng: 116.418367, lat: 39.92943, count: 3 }, - { lng: 116.424312, lat: 39.919621, count: 100 }, - { lng: 116.423874, lat: 39.919447, count: 87 }, - { lng: 116.424225, lat: 39.923091, count: 32 }, - { lng: 116.417801, lat: 39.921854, count: 44 }, - { lng: 116.417129, lat: 39.928227, count: 21 }, - { lng: 116.426426, lat: 39.922286, count: 80 }, - { lng: 116.421597, lat: 39.91948, count: 32 }, - { lng: 116.423895, lat: 39.920787, count: 26 }, - { lng: 116.423563, lat: 39.921197, count: 17 }, - { lng: 116.417982, lat: 39.922547, count: 17 }, - { lng: 116.426126, lat: 39.921938, count: 25 }, - { lng: 116.42326, lat: 39.915782, count: 100 }, - { lng: 116.419239, lat: 39.916759, count: 39 }, - { lng: 116.417185, lat: 39.929123, count: 11 }, - { lng: 116.417237, lat: 39.927518, count: 9 }, - { lng: 116.417784, lat: 39.915754, count: 47 }, - { lng: 116.420193, lat: 39.917061, count: 52 }, - { lng: 116.422735, lat: 39.915619, count: 100 }, - { lng: 116.418495, lat: 39.915958, count: 46 }, - { lng: 116.416292, lat: 39.931166, count: 9 }, - { lng: 116.419916, lat: 39.924055, count: 8 }, - { lng: 116.42189, lat: 39.921308, count: 11 }, - { lng: 116.413765, lat: 39.929376, count: 3 }, - { lng: 116.418232, lat: 39.920348, count: 50 }, - { lng: 116.417554, lat: 39.930511, count: 15 }, - { lng: 116.418568, lat: 39.918161, count: 23 }, - { lng: 116.413461, lat: 39.926306, count: 3 }, - { lng: 116.42232, lat: 39.92161, count: 13 }, - { lng: 116.4174, lat: 39.928616, count: 6 }, - { lng: 116.424679, lat: 39.915499, count: 21 }, - { lng: 116.42171, lat: 39.915738, count: 29 }, - { lng: 116.417836, lat: 39.916998, count: 99 }, - { lng: 116.420755, lat: 39.928001, count: 10 }, - { lng: 116.414077, lat: 39.930655, count: 14 }, - { lng: 116.426092, lat: 39.922995, count: 16 }, - { lng: 116.41535, lat: 39.931054, count: 15 }, - { lng: 116.413022, lat: 39.921895, count: 13 }, - { lng: 116.415551, lat: 39.913373, count: 17 }, - { lng: 116.421191, lat: 39.926572, count: 1 }, - { lng: 116.419612, lat: 39.917119, count: 9 }, - { lng: 116.418237, lat: 39.921337, count: 54 }, - { lng: 116.423776, lat: 39.921919, count: 26 }, - { lng: 116.417694, lat: 39.92536, count: 17 }, - { lng: 116.415377, lat: 39.914137, count: 19 }, - { lng: 116.417434, lat: 39.914394, count: 43 }, - { lng: 116.42588, lat: 39.922622, count: 27 }, - { lng: 116.418345, lat: 39.919467, count: 8 }, - { lng: 116.426883, lat: 39.917171, count: 3 }, - { lng: 116.423877, lat: 39.916659, count: 34 }, - { lng: 116.415712, lat: 39.915613, count: 14 }, - { lng: 116.419869, lat: 39.931416, count: 12 }, - { lng: 116.416956, lat: 39.925377, count: 11 }, - { lng: 116.42066, lat: 39.925017, count: 38 }, - { lng: 116.416244, lat: 39.920215, count: 91 }, - { lng: 116.41929, lat: 39.915908, count: 54 }, - { lng: 116.422116, lat: 39.919658, count: 21 }, - { lng: 116.4183, lat: 39.925015, count: 15 }, - { lng: 116.421969, lat: 39.913527, count: 3 }, - { lng: 116.422936, lat: 39.921854, count: 24 }, - { lng: 116.41905, lat: 39.929217, count: 12 }, - { lng: 116.424579, lat: 39.914987, count: 57 }, - { lng: 116.42076, lat: 39.915251, count: 70 }, - { lng: 116.425867, lat: 39.918989, count: 8 }, - ], - opacity: 90, - max: 100, - radius: 20, - center: { - lng: 116.418261, - lat: 39.921984, - }, - }; - } - - handlePoint = () => { - this.setState({ - points: [ - { lng: 116.418261, lat: 39.921984, count: 50 }, - { lng: 116.423332, lat: 39.916532, count: 51 }, - { lng: 116.419787, lat: 39.930658, count: 15 }, - { lng: 116.418455, lat: 39.920921, count: 40 }, - ], - }); - } - - handleRadius = () => { - const { radius } = this.state; - this.setState({ - radius: radius + 3, - }); - } - - handleOpacity = () => { - let { opacity } = this.state; - if (opacity === 100) { - opacity = 1; - } - this.setState({ - opacity: opacity + 1, - }); - } - - handleMax = () => { - const { max } = this.state; - this.setState({ - max: max + 3, - }); - } - - handleGradient = () => { - this.setState({ - gradient: { - 0.2: getRandomColor(), - 0.5: getRandomColor(), - 0.8: getRandomColor(), - }, - }); - } - - render() { - const { - points, radius, max, gradient, center, opacity, - } = this.state; - return ( - -
    - - - - - - - - -
    -
    - ); - } -} - -export default HeatmapExample; diff --git a/examples/src/lib/markerClusterer/index.js b/examples/src/lib/markerClusterer/index.js deleted file mode 100644 index 4cb619c..0000000 --- a/examples/src/lib/markerClusterer/index.js +++ /dev/null @@ -1,263 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - MarkerClusterer, - Marker, -} from 'rc-bmap'; -import Container from 'components/Container'; -import Clusterer from './index.md'; - -class MarkerClustererExample extends React.Component { - constructor(props) { - super(props); - this.state = { - points: [ - { lng: 116.418261, lat: 39.921984 }, - { lng: 116.423332, lat: 39.916532 }, - { lng: 116.419787, lat: 39.930658 }, - { lng: 116.418455, lat: 39.920921 }, - { lng: 116.418843, lat: 39.915516 }, - { lng: 116.42546, lat: 39.918503 }, - { lng: 116.423289, lat: 39.919989 }, - { lng: 116.418162, lat: 39.915051 }, - { lng: 116.422039, lat: 39.91782 }, - { lng: 116.41387, lat: 39.917253 }, - { lng: 116.41773, lat: 39.919426 }, - { lng: 116.421107, lat: 39.916445 }, - { lng: 116.417521, lat: 39.917943 }, - { lng: 116.419812, lat: 39.920836 }, - { lng: 116.420682, lat: 39.91463 }, - { lng: 116.415424, lat: 39.924675 }, - { lng: 116.419242, lat: 39.914509 }, - { lng: 116.422766, lat: 39.921408 }, - { lng: 116.421674, lat: 39.924396 }, - { lng: 116.427268, lat: 39.92267 }, - { lng: 116.417721, lat: 39.920034 }, - { lng: 116.412456, lat: 39.92667 }, - { lng: 116.420432, lat: 39.919114 }, - { lng: 116.425013, lat: 39.921611 }, - { lng: 116.418733, lat: 39.931037 }, - { lng: 116.419336, lat: 39.931134 }, - { lng: 116.413557, lat: 39.923254 }, - { lng: 116.418367, lat: 39.92943 }, - { lng: 116.424312, lat: 39.919621 }, - { lng: 116.423874, lat: 39.919447 }, - { lng: 116.424225, lat: 39.923091 }, - { lng: 116.417801, lat: 39.921854 }, - { lng: 116.417129, lat: 39.928227 }, - { lng: 116.426426, lat: 39.922286 }, - { lng: 116.421597, lat: 39.91948 }, - { lng: 116.423895, lat: 39.920787 }, - { lng: 116.423563, lat: 39.921197 }, - { lng: 116.417982, lat: 39.922547 }, - { lng: 116.426126, lat: 39.921938 }, - { lng: 116.42326, lat: 39.915782 }, - { lng: 116.419239, lat: 39.916759 }, - { lng: 116.417185, lat: 39.929123 }, - { lng: 116.417237, lat: 39.927518 }, - { lng: 116.417784, lat: 39.915754 }, - { lng: 116.420193, lat: 39.917061 }, - { lng: 116.422735, lat: 39.915619 }, - { lng: 116.418495, lat: 39.915958 }, - { lng: 116.416292, lat: 39.931166 }, - { lng: 116.419916, lat: 39.924055 }, - { lng: 116.42189, lat: 39.921308 }, - { lng: 116.413765, lat: 39.929376 }, - { lng: 116.418232, lat: 39.920348 }, - { lng: 116.417554, lat: 39.930511 }, - { lng: 116.418568, lat: 39.918161 }, - { lng: 116.413461, lat: 39.926306 }, - { lng: 116.42232, lat: 39.92161 }, - { lng: 116.4174, lat: 39.928616 }, - { lng: 116.424679, lat: 39.915499 }, - { lng: 116.42171, lat: 39.915738 }, - { lng: 116.417836, lat: 39.916998 }, - { lng: 116.420755, lat: 39.928001 }, - { lng: 116.414077, lat: 39.930655 }, - { lng: 116.426092, lat: 39.922995 }, - { lng: 116.41535, lat: 39.931054 }, - { lng: 116.413022, lat: 39.921895 }, - { lng: 116.415551, lat: 39.913373 }, - { lng: 116.421191, lat: 39.926572 }, - { lng: 116.419612, lat: 39.917119 }, - { lng: 116.418237, lat: 39.921337 }, - { lng: 116.423776, lat: 39.921919 }, - { lng: 116.417694, lat: 39.92536 }, - { lng: 116.415377, lat: 39.914137 }, - { lng: 116.417434, lat: 39.914394 }, - { lng: 116.42588, lat: 39.922622 }, - { lng: 116.418345, lat: 39.919467 }, - { lng: 116.426883, lat: 39.917171 }, - { lng: 116.423877, lat: 39.916659 }, - { lng: 116.415712, lat: 39.915613 }, - { lng: 116.419869, lat: 39.931416 }, - { lng: 116.416956, lat: 39.925377 }, - { lng: 116.42066, lat: 39.925017 }, - { lng: 116.416244, lat: 39.920215 }, - { lng: 116.41929, lat: 39.915908 }, - { lng: 116.422116, lat: 39.919658 }, - { lng: 116.4183, lat: 39.925015 }, - { lng: 116.421969, lat: 39.913527 }, - { lng: 116.422936, lat: 39.921854 }, - { lng: 116.41905, lat: 39.929217 }, - { lng: 116.424579, lat: 39.914987 }, - { lng: 116.42076, lat: 39.915251 }, - { lng: 116.425867, lat: 39.918989 }, - ], - gridSize: 50, - maxZoom: 0, - minClusterSize: 0, - // styles: , - center: { - lng: 116.418261, lat: 39.921984, - }, - averageCenter: true, - }; - } - - handlePoints = () => { - this.setState({ - points: [ - { lng: 116.422039, lat: 39.91782 }, - { lng: 116.41387, lat: 39.917253 }, - { lng: 116.41773, lat: 39.919426 }, - { lng: 116.421107, lat: 39.916445 }, - { lng: 116.417521, lat: 39.917943 }, - { lng: 116.419812, lat: 39.920836 }, - { lng: 116.420682, lat: 39.91463 }, - { lng: 116.415424, lat: 39.924675 }, - { lng: 116.419242, lat: 39.914509 }, - { lng: 116.422766, lat: 39.921408 }, - { lng: 116.421674, lat: 39.924396 }, - { lng: 116.427268, lat: 39.92267 }, - { lng: 116.417721, lat: 39.920034 }, - { lng: 116.412456, lat: 39.92667 }, - { lng: 116.420432, lat: 39.919114 }, - { lng: 116.425013, lat: 39.921611 }, - { lng: 116.418733, lat: 39.931037 }, - { lng: 116.419336, lat: 39.931134 }, - { lng: 116.413557, lat: 39.923254 }, - { lng: 116.418367, lat: 39.92943 }, - { lng: 116.424312, lat: 39.919621 }, - { lng: 116.423874, lat: 39.919447 }, - { lng: 116.424225, lat: 39.923091 }, - { lng: 116.417801, lat: 39.921854 }, - { lng: 116.417129, lat: 39.928227 }, - { lng: 116.426426, lat: 39.922286 }, - { lng: 116.421597, lat: 39.91948 }, - { lng: 116.423895, lat: 39.920787 }, - { lng: 116.423563, lat: 39.921197 }, - { lng: 116.417982, lat: 39.922547 }, - { lng: 116.426126, lat: 39.921938 }, - { lng: 116.42326, lat: 39.915782 }, - { lng: 116.419239, lat: 39.916759 }, - { lng: 116.417185, lat: 39.929123 }, - { lng: 116.417237, lat: 39.927518 }, - { lng: 116.417784, lat: 39.915754 }, - { lng: 116.420193, lat: 39.917061 }, - { lng: 116.422735, lat: 39.915619 }, - { lng: 116.418495, lat: 39.915958 }, - { lng: 116.416292, lat: 39.931166 }, - { lng: 116.419916, lat: 39.924055 }, - ], - }); - } - - handleSize = () => { - const { gridSize } = this.state; - this.setState({ - gridSize: gridSize + 5, - }); - } - - handleClusterSize = () => { - const { minClusterSize } = this.state; - this.setState({ - minClusterSize: minClusterSize + 5, - }); - } - - handleMaxZoom = () => { - let { maxZoom } = this.state; - if (maxZoom === 16) { - maxZoom = 1; - } - this.setState({ - maxZoom: maxZoom + 1, - }); - } - - handleStyle = () => { - this.setState({ - styles: [{ - url: 'http://api.map.baidu.com/library/MarkerClusterer/1.2/examples/images/heart30.png', - size: { width: 30, height: 26 }, - opt_anchor: [16, 0], - textColor: '#ff00ff', - opt_textSize: 10, - }, { - url: 'http://api.map.baidu.com/library/MarkerClusterer/1.2/examples/images/heart40.png', - size: { width: 40, height: 35 }, - opt_anchor: [40, 35], - textColor: '#ff0000', - opt_textSize: 12, - }, { - url: 'http://api.map.baidu.com/library/MarkerClusterer/1.2/examples/images/heart50.png', - size: { width: 50, height: 44 }, - opt_anchor: [32, 0], - textColor: 'white', - opt_textSize: 14, - }], - }); - } - - handleCenter = () => { - const { averageCenter } = this.state; - this.setState({ - averageCenter: !averageCenter, - }); - } - - render() { - const { - gridSize, points, maxZoom, minClusterSize, center, styles, averageCenter, - } = this.state; - return ( - -
    - - - { - points.map((item, index) => ( - - )) - } - - - - - - - - -
    -
    - ); - } -} - -export default MarkerClustererExample; diff --git a/examples/src/lib/markerClusterer/index.md b/examples/src/lib/markerClusterer/index.md deleted file mode 100644 index 4cb619c..0000000 --- a/examples/src/lib/markerClusterer/index.md +++ /dev/null @@ -1,263 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - MarkerClusterer, - Marker, -} from 'rc-bmap'; -import Container from 'components/Container'; -import Clusterer from './index.md'; - -class MarkerClustererExample extends React.Component { - constructor(props) { - super(props); - this.state = { - points: [ - { lng: 116.418261, lat: 39.921984 }, - { lng: 116.423332, lat: 39.916532 }, - { lng: 116.419787, lat: 39.930658 }, - { lng: 116.418455, lat: 39.920921 }, - { lng: 116.418843, lat: 39.915516 }, - { lng: 116.42546, lat: 39.918503 }, - { lng: 116.423289, lat: 39.919989 }, - { lng: 116.418162, lat: 39.915051 }, - { lng: 116.422039, lat: 39.91782 }, - { lng: 116.41387, lat: 39.917253 }, - { lng: 116.41773, lat: 39.919426 }, - { lng: 116.421107, lat: 39.916445 }, - { lng: 116.417521, lat: 39.917943 }, - { lng: 116.419812, lat: 39.920836 }, - { lng: 116.420682, lat: 39.91463 }, - { lng: 116.415424, lat: 39.924675 }, - { lng: 116.419242, lat: 39.914509 }, - { lng: 116.422766, lat: 39.921408 }, - { lng: 116.421674, lat: 39.924396 }, - { lng: 116.427268, lat: 39.92267 }, - { lng: 116.417721, lat: 39.920034 }, - { lng: 116.412456, lat: 39.92667 }, - { lng: 116.420432, lat: 39.919114 }, - { lng: 116.425013, lat: 39.921611 }, - { lng: 116.418733, lat: 39.931037 }, - { lng: 116.419336, lat: 39.931134 }, - { lng: 116.413557, lat: 39.923254 }, - { lng: 116.418367, lat: 39.92943 }, - { lng: 116.424312, lat: 39.919621 }, - { lng: 116.423874, lat: 39.919447 }, - { lng: 116.424225, lat: 39.923091 }, - { lng: 116.417801, lat: 39.921854 }, - { lng: 116.417129, lat: 39.928227 }, - { lng: 116.426426, lat: 39.922286 }, - { lng: 116.421597, lat: 39.91948 }, - { lng: 116.423895, lat: 39.920787 }, - { lng: 116.423563, lat: 39.921197 }, - { lng: 116.417982, lat: 39.922547 }, - { lng: 116.426126, lat: 39.921938 }, - { lng: 116.42326, lat: 39.915782 }, - { lng: 116.419239, lat: 39.916759 }, - { lng: 116.417185, lat: 39.929123 }, - { lng: 116.417237, lat: 39.927518 }, - { lng: 116.417784, lat: 39.915754 }, - { lng: 116.420193, lat: 39.917061 }, - { lng: 116.422735, lat: 39.915619 }, - { lng: 116.418495, lat: 39.915958 }, - { lng: 116.416292, lat: 39.931166 }, - { lng: 116.419916, lat: 39.924055 }, - { lng: 116.42189, lat: 39.921308 }, - { lng: 116.413765, lat: 39.929376 }, - { lng: 116.418232, lat: 39.920348 }, - { lng: 116.417554, lat: 39.930511 }, - { lng: 116.418568, lat: 39.918161 }, - { lng: 116.413461, lat: 39.926306 }, - { lng: 116.42232, lat: 39.92161 }, - { lng: 116.4174, lat: 39.928616 }, - { lng: 116.424679, lat: 39.915499 }, - { lng: 116.42171, lat: 39.915738 }, - { lng: 116.417836, lat: 39.916998 }, - { lng: 116.420755, lat: 39.928001 }, - { lng: 116.414077, lat: 39.930655 }, - { lng: 116.426092, lat: 39.922995 }, - { lng: 116.41535, lat: 39.931054 }, - { lng: 116.413022, lat: 39.921895 }, - { lng: 116.415551, lat: 39.913373 }, - { lng: 116.421191, lat: 39.926572 }, - { lng: 116.419612, lat: 39.917119 }, - { lng: 116.418237, lat: 39.921337 }, - { lng: 116.423776, lat: 39.921919 }, - { lng: 116.417694, lat: 39.92536 }, - { lng: 116.415377, lat: 39.914137 }, - { lng: 116.417434, lat: 39.914394 }, - { lng: 116.42588, lat: 39.922622 }, - { lng: 116.418345, lat: 39.919467 }, - { lng: 116.426883, lat: 39.917171 }, - { lng: 116.423877, lat: 39.916659 }, - { lng: 116.415712, lat: 39.915613 }, - { lng: 116.419869, lat: 39.931416 }, - { lng: 116.416956, lat: 39.925377 }, - { lng: 116.42066, lat: 39.925017 }, - { lng: 116.416244, lat: 39.920215 }, - { lng: 116.41929, lat: 39.915908 }, - { lng: 116.422116, lat: 39.919658 }, - { lng: 116.4183, lat: 39.925015 }, - { lng: 116.421969, lat: 39.913527 }, - { lng: 116.422936, lat: 39.921854 }, - { lng: 116.41905, lat: 39.929217 }, - { lng: 116.424579, lat: 39.914987 }, - { lng: 116.42076, lat: 39.915251 }, - { lng: 116.425867, lat: 39.918989 }, - ], - gridSize: 50, - maxZoom: 0, - minClusterSize: 0, - // styles: , - center: { - lng: 116.418261, lat: 39.921984, - }, - averageCenter: true, - }; - } - - handlePoints = () => { - this.setState({ - points: [ - { lng: 116.422039, lat: 39.91782 }, - { lng: 116.41387, lat: 39.917253 }, - { lng: 116.41773, lat: 39.919426 }, - { lng: 116.421107, lat: 39.916445 }, - { lng: 116.417521, lat: 39.917943 }, - { lng: 116.419812, lat: 39.920836 }, - { lng: 116.420682, lat: 39.91463 }, - { lng: 116.415424, lat: 39.924675 }, - { lng: 116.419242, lat: 39.914509 }, - { lng: 116.422766, lat: 39.921408 }, - { lng: 116.421674, lat: 39.924396 }, - { lng: 116.427268, lat: 39.92267 }, - { lng: 116.417721, lat: 39.920034 }, - { lng: 116.412456, lat: 39.92667 }, - { lng: 116.420432, lat: 39.919114 }, - { lng: 116.425013, lat: 39.921611 }, - { lng: 116.418733, lat: 39.931037 }, - { lng: 116.419336, lat: 39.931134 }, - { lng: 116.413557, lat: 39.923254 }, - { lng: 116.418367, lat: 39.92943 }, - { lng: 116.424312, lat: 39.919621 }, - { lng: 116.423874, lat: 39.919447 }, - { lng: 116.424225, lat: 39.923091 }, - { lng: 116.417801, lat: 39.921854 }, - { lng: 116.417129, lat: 39.928227 }, - { lng: 116.426426, lat: 39.922286 }, - { lng: 116.421597, lat: 39.91948 }, - { lng: 116.423895, lat: 39.920787 }, - { lng: 116.423563, lat: 39.921197 }, - { lng: 116.417982, lat: 39.922547 }, - { lng: 116.426126, lat: 39.921938 }, - { lng: 116.42326, lat: 39.915782 }, - { lng: 116.419239, lat: 39.916759 }, - { lng: 116.417185, lat: 39.929123 }, - { lng: 116.417237, lat: 39.927518 }, - { lng: 116.417784, lat: 39.915754 }, - { lng: 116.420193, lat: 39.917061 }, - { lng: 116.422735, lat: 39.915619 }, - { lng: 116.418495, lat: 39.915958 }, - { lng: 116.416292, lat: 39.931166 }, - { lng: 116.419916, lat: 39.924055 }, - ], - }); - } - - handleSize = () => { - const { gridSize } = this.state; - this.setState({ - gridSize: gridSize + 5, - }); - } - - handleClusterSize = () => { - const { minClusterSize } = this.state; - this.setState({ - minClusterSize: minClusterSize + 5, - }); - } - - handleMaxZoom = () => { - let { maxZoom } = this.state; - if (maxZoom === 16) { - maxZoom = 1; - } - this.setState({ - maxZoom: maxZoom + 1, - }); - } - - handleStyle = () => { - this.setState({ - styles: [{ - url: 'http://api.map.baidu.com/library/MarkerClusterer/1.2/examples/images/heart30.png', - size: { width: 30, height: 26 }, - opt_anchor: [16, 0], - textColor: '#ff00ff', - opt_textSize: 10, - }, { - url: 'http://api.map.baidu.com/library/MarkerClusterer/1.2/examples/images/heart40.png', - size: { width: 40, height: 35 }, - opt_anchor: [40, 35], - textColor: '#ff0000', - opt_textSize: 12, - }, { - url: 'http://api.map.baidu.com/library/MarkerClusterer/1.2/examples/images/heart50.png', - size: { width: 50, height: 44 }, - opt_anchor: [32, 0], - textColor: 'white', - opt_textSize: 14, - }], - }); - } - - handleCenter = () => { - const { averageCenter } = this.state; - this.setState({ - averageCenter: !averageCenter, - }); - } - - render() { - const { - gridSize, points, maxZoom, minClusterSize, center, styles, averageCenter, - } = this.state; - return ( - -
    - - - { - points.map((item, index) => ( - - )) - } - - - - - - - - -
    -
    - ); - } -} - -export default MarkerClustererExample; diff --git a/examples/src/lib/trafficControl/index.js b/examples/src/lib/trafficControl/index.js deleted file mode 100644 index c0ab981..0000000 --- a/examples/src/lib/trafficControl/index.js +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - TrafficControl, -} from 'rc-bmap'; -import { getRandomControlAnchor } from 'utils'; -import Container from 'components/Container'; -import Traffic from './index.md'; - -class TrafficControlExample extends React.Component { - constructor(props) { - super(props); - this.state = { - anchor: ControlAnchor.BOTTOM_RIGHT, - }; - } - - handleAchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - render() { - const { anchor } = this.state; - return ( - -
    - - - - -
    -
    - ); - } -} - -export default TrafficControlExample; diff --git a/examples/src/lib/trafficControl/index.md b/examples/src/lib/trafficControl/index.md deleted file mode 100644 index 44efa0d..0000000 --- a/examples/src/lib/trafficControl/index.md +++ /dev/null @@ -1,42 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - ControlAnchor, - TrafficControl, -} from 'rc-bmap'; -import { getRandomControlAnchor } from 'utils'; - -class TrafficControlExample extends React.Component { - constructor(props) { - super(props); - this.state = { - anchor: ControlAnchor.BOTTOM_RIGHT, - }; - } - - handleAchor = () => { - this.setState({ - anchor: ControlAnchor[getRandomControlAnchor()], - }); - } - - render() { - const { anchor } = this.state; - return ( - -
    - - - - -
    -
    - ); - } -} - -export default TrafficControlExample; diff --git a/examples/src/map/index.js b/examples/src/map/index.js deleted file mode 100644 index e5157c3..0000000 --- a/examples/src/map/index.js +++ /dev/null @@ -1,218 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - MapType, -} from 'rc-bmap'; -import { getRandomMapType } from 'utils'; -import Container from 'components/Container'; -import MapCode from './index.md'; - -class MapExample extends React.Component { - constructor(props) { - super(props); - this.state = { - center: { - lng: 116.332782, - lat: 40.007978, - }, - zoom: 14, - placeHolder: '地图加载中...', - minZoom: 3, - maxZoom: 19, - defaultCursor: '', - draggingCursor: '', - mapStyle: { - style: 'normal', - }, - mapType: MapType.NORMAL, - highResolution: true, - autoResize: true, - mapClick: true, - dragging: true, - scrollWheelZoom: true, - doubleClickZoom: true, - keyboard: true, - inertialDragging: true, - continuousZoom: true, - pinchToZoom: true, - events: { - click: (event) => { - console.log('mapClick', event); - }, - zoomend: (event) => { - console.log('zoomend', event); - }, - }, - contextMenu: { - items: [{ - text: '放大', - callback() { global.bMapInstance.zoomIn(); }, - }, - { - text: '缩小', - callback() { global.bMapInstance.zoomOut(); }, - separator: true, - }], - }, - }; - } - - handleCenter = () => { - const { center } = this.state; - this.setState({ - center: { lng: center.lng + 0.05, lat: center.lat + 0.05 }, - }); - } - - handleZoom = () => { - let { zoom } = this.state; - if (zoom === 19) { - zoom = 3; - } - this.setState({ - zoom: zoom + 1, - }); - } - - handleMapStyle = () => { - const { mapStyle } = this.state; - this.setState({ - mapStyle: mapStyle.style === 'normal' ? { style: 'midnight' } : { style: 'normal' }, - }); - } - - handleMapType = () => { - this.setState({ - mapType: MapType[getRandomMapType()], - }); - } - - handleHighResolution = () => { - const { highResolution } = this.state; - this.setState({ - highResolution: !highResolution, - }); - } - - handleAutoResize = () => { - const { autoResize } = this.state; - this.setState({ - autoResize: !autoResize, - }); - } - - handleMapClick = () => { - const { mapClick } = this.state; - this.setState({ - mapClick: !mapClick, - }); - } - - handleDragging = () => { - const { dragging } = this.state; - this.setState({ - dragging: !dragging, - }); - } - - handleScrollWheelZoom = () => { - const { scrollWheelZoom } = this.state; - this.setState({ - scrollWheelZoom: !scrollWheelZoom, - }); - } - - handleDoubleClickZoom = () => { - const { doubleClickZoom } = this.state; - this.setState({ - doubleClickZoom: !doubleClickZoom, - }); - } - - handleKeyboard = () => { - const { keyboard } = this.state; - this.setState({ - keyboard: !keyboard, - }); - } - - handleInertialDragging = () => { - const { inertialDragging } = this.state; - this.setState({ - inertialDragging: !inertialDragging, - }); - } - - handleContinuousZoom = () => { - const { continuousZoom } = this.state; - this.setState({ - continuousZoom: !continuousZoom, - }); - } - - handPinchToZoom = () => { - const { pinchToZoom } = this.state; - this.setState({ - pinchToZoom: !pinchToZoom, - }); - } - - render() { - const { - zoom, center, placeHolder, minZoom, maxZoom, - defaultCursor, draggingCursor, mapStyle, mapType, - highResolution, autoResize, mapClick, dragging, scrollWheelZoom, - doubleClickZoom, keyboard, inertialDragging, continuousZoom, - pinchToZoom, events, contextMenu, - } = this.state; - return ( - -
    - - - - - - - - - - - - - - - - - -
    -
    - ); - } -} - -export default MapExample; diff --git a/examples/src/map/index.md b/examples/src/map/index.md deleted file mode 100644 index c68e7d4..0000000 --- a/examples/src/map/index.md +++ /dev/null @@ -1,216 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - MapType, -} from 'rc-bmap'; -import { getRandomMapType } from 'utils'; - -class MapExample extends React.Component { - constructor(props) { - super(props); - this.state = { - center: { - lng: 116.332782, - lat: 40.007978, - }, - zoom: 14, - placeHolder: '地图加载中...', - minZoom: 3, - maxZoom: 19, - defaultCursor: '', - draggingCursor: '', - mapStyle: { - style: 'normal', - }, - mapType: MapType.NORMAL, - highResolution: true, - autoResize: true, - mapClick: true, - dragging: true, - scrollWheelZoom: true, - doubleClickZoom: true, - keyboard: true, - inertialDragging: true, - continuousZoom: true, - pinchToZoom: true, - events: { - click: (event) => { - console.log('mapClick', event); - }, - zoomend: (event) => { - console.log('zoomend', event); - }, - }, - contextMenu: { - items: [{ - text: '放大', - callback() { global.bMapInstance.zoomIn(); }, - }, - { - text: '缩小', - callback() { global.bMapInstance.zoomOut(); }, - separator: true, - }], - }, - }; - } - - handleCenter = () => { - const { center } = this.state; - this.setState({ - center: { lng: center.lng + 0.05, lat: center.lat + 0.05 }, - }); - } - - handleZoom = () => { - let { zoom } = this.state; - if (zoom === 19) { - zoom = 3; - } - this.setState({ - zoom: zoom + 1, - }); - } - - handleMapStyle = () => { - const { mapStyle } = this.state; - this.setState({ - mapStyle: mapStyle.style === 'normal' ? { style: 'midnight' } : { style: 'normal' }, - }); - } - - handleMapType = () => { - this.setState({ - mapType: MapType[getRandomMapType()], - }); - } - - handleHighResolution = () => { - const { highResolution } = this.state; - this.setState({ - highResolution: !highResolution, - }); - } - - handleAutoResize = () => { - const { autoResize } = this.state; - this.setState({ - autoResize: !autoResize, - }); - } - - handleMapClick = () => { - const { mapClick } = this.state; - this.setState({ - mapClick: !mapClick, - }); - } - - handleDragging = () => { - const { dragging } = this.state; - this.setState({ - dragging: !dragging, - }); - } - - handleScrollWheelZoom = () => { - const { scrollWheelZoom } = this.state; - this.setState({ - scrollWheelZoom: !scrollWheelZoom, - }); - } - - handleDoubleClickZoom = () => { - const { doubleClickZoom } = this.state; - this.setState({ - doubleClickZoom: !doubleClickZoom, - }); - } - - handleKeyboard = () => { - const { keyboard } = this.state; - this.setState({ - keyboard: !keyboard, - }); - } - - handleInertialDragging = () => { - const { inertialDragging } = this.state; - this.setState({ - inertialDragging: !inertialDragging, - }); - } - - handLecontinuousZoom = () => { - const { lecontinuousZoom } = this.state; - this.setState({ - lecontinuousZoom: !lecontinuousZoom, - }); - } - - handPinchToZoom = () => { - const { pnchToZoom } = this.state; - this.setState({ - pnchToZoom: !pnchToZoom, - }); - } - - render() { - const { - zoom, center, placeHolder, minZoom, maxZoom, - defaultCursor, draggingCursor, mapStyle, mapType, - highResolution, autoResize, mapClick, dragging, scrollWheelZoom, - doubleClickZoom, keyboard, inertialDragging, continuousZoom, - pinchToZoom, events, contextMenu, - } = this.state; - return ( - -
    - - - - - - - - - - - - - - - - - -
    -
    - ); - } -} - -export default MapExample; diff --git a/examples/src/menuData.js b/examples/src/menuData.js deleted file mode 100644 index 4e323f8..0000000 --- a/examples/src/menuData.js +++ /dev/null @@ -1,164 +0,0 @@ -export default [ - { - text: '地图展示', - children: [ - { - text: '地图', - path: '/map', - }, - ], - }, - { - text: '覆盖物', - children: [ - { - text: '圆', - path: '/circle', - }, - { - text: '信息窗口', - path: '/infoWindow', - }, - { - text: '文本标注', - path: '/label', - }, - { - text: '标注', - path: '/marker', - }, - { - text: '多边形', - path: '/polygon', - }, - { - text: '折线', - path: '/polyline', - }, - { - text: '矢量图标注', - path: '/symbol', - }, - { - text: '行政区域', - path: '/boundary', - }, - { - text: '海量标注', - path: '/pointCollection', - }, - { - text: '地面叠加层', - path: '/ground', - }, - ], - }, - { - text: '控件', - children: [ - { - text: '平移缩放控件', - path: '/navigation', - }, - { - text: '定位控件', - path: '/geolocation', - }, - { - text: '缩略地图控件', - path: '/overviewMap', - }, - { - text: '比例尺控件', - path: '/scale', - }, - { - text: '切换全景地图控件', - path: '/panorama', - }, - { - text: '版权控件', - path: '/copyright', - }, - { - text: '城市列表控件', - path: '/cityList', - }, - { - text: '切换地图类型控件', - path: '/mapTypeCtrl', - }, - ], - }, - { - text: '规划', - children: [ - { - text: '公交线路规划', - path: '/transitRoute', - }, - { - text: '驾车路线规划', - path: '/drivingRoute', - }, - { - text: '骑行路线规划', - path: '/ridingRoute', - }, - { - text: '步行路线规划', - path: '/walkingRoute', - }, - { - text: '周边检索', - path: '/localSearch', - }, - { - text: '公交路线搜索', - path: '/busLineSearch', - }, - ], - }, - { - text: '扩展库', - children: [ - { - text: '点聚合', - path: '/markerClusterer', - }, - { - text: '抛物线', - path: '/curveLine', - }, - { - text: '绘制工具', - path: '/drawingManager', - }, - { - text: '热力图', - path: '/heatmap', - }, - { - text: '路况控件', - path: '/trafficControl', - }, - { - text: '测距工具', - path: '/distanceTool', - }, - ], - }, - { - text: '其他', - children: [ - { - text: '自动完成类', - path: '/autoComplete', - }, - { - text: '自定义图层', - path: '/tile', - }, - ], - }, -]; diff --git a/examples/src/other/autoComplete/index.js b/examples/src/other/autoComplete/index.js deleted file mode 100644 index 9be2b46..0000000 --- a/examples/src/other/autoComplete/index.js +++ /dev/null @@ -1,69 +0,0 @@ -import React from 'react'; -import { - Map, - AutoComplete, -} from 'rc-bmap'; -import Container from 'components/Container'; -import { Button } from 'antd'; -import Ti from './index.md'; - -class AutoCompleteExample extends React.Component { - constructor(props) { - super(props); - this.state = { - location: '北京市', - value: '', - events: { - onconfirm() { - console.log('onconfirm'); - }, - onhighlight() { - console.log('onhighlight'); - }, - }, - }; - } - - searchComplete = () => { - console.log('searchComplete'); - } - - handleChangeValue = () => { - this.setState({ - value: '变更默认显示值', - }); - } - - handleChangeLocation = () => { - this.setState({ - location: '杭州市', - }); - } - - render() { - const { events, location, value } = this.state; - return ( - -
    - - - - - - -
    -
    - ); - } -} - -export default AutoCompleteExample; diff --git a/examples/src/other/autoComplete/index.md b/examples/src/other/autoComplete/index.md deleted file mode 100644 index aff7e3e..0000000 --- a/examples/src/other/autoComplete/index.md +++ /dev/null @@ -1,66 +0,0 @@ -import React from 'react'; -import { - Map, - AutoComplete, -} from 'rc-bmap'; - -class AutoCompleteExample extends React.Component { - constructor(props) { - super(props); - this.state = { - location: '北京市', - value: '', - events: { - onconfirm() { - console.log('onconfirm'); - }, - onhighlight() { - console.log('onhighlight'); - }, - }, - }; - } - - searchComplete = () => { - console.log('searchComplete'); - } - - handleChangeValue = () => { - this.setState({ - value: '变更默认显示值', - }); - } - - handleChangeLocation = () => { - this.setState({ - location: '杭州市', - }); - } - - render() { - const { events, location, value } = this.state; - return ( - -
    - - - - - - -
    -
    - ); - } -} - -export default AutoCompleteExample; diff --git a/examples/src/other/tile/index.js b/examples/src/other/tile/index.js deleted file mode 100644 index b35e5bf..0000000 --- a/examples/src/other/tile/index.js +++ /dev/null @@ -1,73 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - Tile, -} from 'rc-bmap'; -import Container from 'components/Container'; -import Ti from './index.md'; - -class TileExample extends React.Component { - constructor(props) { - super(props); - this.state = { - transparentPng: false, - zoom: 16, - zIndex: -1, - center: { - lng: 116.332782, - lat: 40.007978, - }, - }; - } - - getTilesUrl = (tileCoord, zoom) => { - const { x, y } = tileCoord; - // const y = tileCoord.y; - // 根据当前坐标,选取合适的瓦片图 - return `http://lbsyun.baidu.com/jsdemo/demo/tiles/${zoom}/tile${x}_${y}.png`; - }; - - handleZIndex = () => { - const { zIndex } = this.state; - this.setState({ - zIndex: zIndex + 1, - }); - } - - handlePng = () => { - const { transparentPng } = this.state; - this.setState({ - transparentPng: !transparentPng, - }); - } - - render() { - const { - zoom, center, zIndex, copyright, transparentPng, - } = this.state; - return ( - -
    - - - - - -
    -
    - ); - } -} - -export default TileExample; diff --git a/examples/src/other/tile/index.md b/examples/src/other/tile/index.md deleted file mode 100644 index 69cb80c..0000000 --- a/examples/src/other/tile/index.md +++ /dev/null @@ -1,71 +0,0 @@ -import React from 'react'; -import { Button } from 'antd'; -import { - Map, - Tile, -} from 'rc-bmap'; - -class TileExample extends React.Component { - constructor(props) { - super(props); - this.state = { - transparentPng: false, - zoom: 16, - zIndex: -1, - center: { - lng: 116.332782, - lat: 40.007978, - }, - }; - } - - getTilesUrl = (tileCoord, zoom) => { - const { x, y } = tileCoord; - // const y = tileCoord.y; - // 根据当前坐标,选取合适的瓦片图 - return `http://lbsyun.baidu.com/jsdemo/demo/tiles/${zoom}/tile${x}_${y}.png`; - }; - - handleZIndex = () => { - const { zIndex } = this.state; - this.setState({ - zIndex: zIndex + 1, - }); - } - - handlePng = () => { - const { transparentPng } = this.state; - this.setState({ - transparentPng: !transparentPng, - }); - } - - render() { - const { - zoom, center, zIndex, copyright, transparentPng, - } = this.state; - return ( - -
    - - - - - -
    -
    - ); - } -} - -export default TileExample; diff --git a/examples/src/overlay/boundary/index.js b/examples/src/overlay/boundary/index.js deleted file mode 100644 index 714b0dc..0000000 --- a/examples/src/overlay/boundary/index.js +++ /dev/null @@ -1,200 +0,0 @@ -import React, { Component } from 'react'; -import { Map, Boundary } from 'rc-bmap'; -import { Button } from 'antd'; -import Container from 'components/Container'; -import { getRandomColor, getRandomBoundary } from 'utils'; -import index from './index.md'; - -class BoundaryExample extends Component { - constructor(props) { - super(props); - this.state = { - name: '杭州市萧山区', - onError: this.onError, - autoViewport: true, - strokeColor: 'blue', - fillColor: 'red', - strokeWeight: 5, - strokeOpacity: 0.5, - fillOpacity: 0.9, - strokeStyle: 'dashed', - massClear: false, - editing: false, - clicking: true, - events: { - click: this.onClick, - }, - }; - } - - onClick = () => { - console.log('Boundary click'); - } - - onChangedClick = () => { - console.log('onChanged Boundary click'); - } - - onError = () => { - console.log('onError'); - } - - onChangedError = () => { - console.log('onChangedError'); - } - - handleName = () => { - this.setState({ - name: getRandomBoundary(), - }); - } - - handleOnError = () => { - this.setState({ - onError: this.onChangedError, - }); - } - - handleAutoViewport = () => { - const { autoViewport } = this.state; - this.setState({ - autoViewport: !autoViewport, - }); - } - - handleStrokeColor = () => { - this.setState({ - strokeColor: getRandomColor(), - }); - } - - handleFillColor = () => { - this.setState({ - fillColor: getRandomColor(), - }); - } - - handleStrokeWeight = () => { - const { strokeWeight } = this.state; - this.setState({ - strokeWeight: strokeWeight + 1, - }); - } - - handleStrokeOpacity = () => { - let { strokeOpacity } = this.state; - if (strokeOpacity >= 0.9) { - strokeOpacity = 0.1; - } - this.setState({ - strokeOpacity: strokeOpacity + 0.1, - }); - } - - handleFillOpacity = () => { - let { fillOpacity } = this.state; - if (fillOpacity >= 0.9) { - fillOpacity = 0.1; - } - this.setState({ - fillOpacity: fillOpacity + 0.1, - }); - } - - handleStrokeStyle = () => { - const { strokeStyle } = this.state; - this.setState({ - strokeStyle: strokeStyle === 'solid' ? 'dashed' : 'solid', - }); - } - - handleMassClear = () => { - const { massClear } = this.state; - this.setState({ - massClear: !massClear, - }); - } - - handleEditing = () => { - const { editing } = this.state; - this.setState({ - editing: !editing, - }); - } - - handleClicking = () => { - const { clicking } = this.state; - this.setState({ - clicking: !clicking, - }); - } - - handleEvents = () => { - this.setState({ - events: { - click: this.onChangedClick, - }, - }); - } - - handleClear = () => { - window.bMapInstance.clearOverlays(); - } - - render() { - const { - name, onError, autoViewport, strokeColor, - fillColor, strokeWeight, strokeOpacity, fillOpacity, strokeStyle, - massClear, editing, clicking, events, - } = this.state; - return ( - -
    - - - -
    - - - - - - - - - - - - - - -
    - ); - } -} - -export default BoundaryExample; diff --git a/examples/src/overlay/boundary/index.md b/examples/src/overlay/boundary/index.md deleted file mode 100644 index f4d9f4c..0000000 --- a/examples/src/overlay/boundary/index.md +++ /dev/null @@ -1,198 +0,0 @@ -import React, { Component } from 'react'; -import { Map, Boundary } from 'rc-bmap'; -import { Button } from 'antd'; -import { getRandomColor, getRandomBoundary } from 'utils'; - -class BoundaryExample extends Component { - constructor(props) { - super(props); - this.state = { - name: '杭州市萧山区', - onError: this.onError, - autoViewport: true, - strokeColor: 'blue', - fillColor: 'red', - strokeWeight: 5, - strokeOpacity: 0.5, - fillOpacity: 0.9, - strokeStyle: 'dashed', - massClear: false, - editing: false, - clicking: true, - events: { - click: this.onClick, - }, - }; - } - - onClick = () => { - console.log('Boundary click'); - } - - onChangedClick = () => { - console.log('onChanged Boundary click'); - } - - onError = () => { - console.log('onError'); - } - - onChangedError = () => { - console.log('onChangedError'); - } - - handleName = () => { - this.setState({ - name: getRandomBoundary(), - }); - } - - handleOnError = () => { - this.setState({ - onError: this.onChangedError, - }); - } - - handleAutoViewport = () => { - const { autoViewport } = this.state; - this.setState({ - autoViewport: !autoViewport, - }); - } - - handleStrokeColor = () => { - this.setState({ - strokeColor: getRandomColor(), - }); - } - - handleFillColor = () => { - this.setState({ - fillColor: getRandomColor(), - }); - } - - handleStrokeWeight = () => { - const { strokeWeight } = this.state; - this.setState({ - strokeWeight: strokeWeight + 1, - }); - } - - handleStrokeOpacity = () => { - let { strokeOpacity } = this.state; - if (strokeOpacity >= 0.9) { - strokeOpacity = 0.1; - } - this.setState({ - strokeOpacity: strokeOpacity + 0.1, - }); - } - - handleFillOpacity = () => { - let { fillOpacity } = this.state; - if (fillOpacity >= 0.9) { - fillOpacity = 0.1; - } - this.setState({ - fillOpacity: fillOpacity + 0.1, - }); - } - - handleStrokeStyle = () => { - const { strokeStyle } = this.state; - this.setState({ - strokeStyle: strokeStyle === 'solid' ? 'dashed' : 'solid', - }); - } - - handleMassClear = () => { - const { massClear } = this.state; - this.setState({ - massClear: !massClear, - }); - } - - handleEditing = () => { - const { editing } = this.state; - this.setState({ - editing: !editing, - }); - } - - handleClicking = () => { - const { clicking } = this.state; - this.setState({ - clicking: !clicking, - }); - } - - handleEvents = () => { - this.setState({ - events: { - click: this.onChangedClick, - }, - }); - } - - handleClear = () => { - window.bMapInstance.clearOverlays(); - } - - render() { - const { - name, onError, autoViewport, strokeColor, - fillColor, strokeWeight, strokeOpacity, fillOpacity, strokeStyle, - massClear, editing, clicking, events, - } = this.state; - return ( - -
    - - - -
    - - - - - - - - - - - - - - -
    - ); - } -} - -export default BoundaryExample; diff --git a/examples/src/overlay/circle/index.js b/examples/src/overlay/circle/index.js deleted file mode 100644 index fb8b072..0000000 --- a/examples/src/overlay/circle/index.js +++ /dev/null @@ -1,185 +0,0 @@ -import React, { Component } from 'react'; -import { Button } from 'antd'; -import { Map, Circle } from 'rc-bmap'; -import Container from 'components/Container'; -import { getRandomColor } from 'utils'; -import index from './index.md'; - -class CircleExample extends Component { - constructor(props) { - super(props); - this.state = { - point: { lng: 116.404, lat: 39.915 }, - radius: 500, - strokeColor: 'blue', - fillColor: 'red', - strokeWeight: 5, - strokeOpacity: 0.5, - fillOpacity: 0.9, - strokeStyle: 'dashed', - massClear: false, - editing: false, - clicking: true, - events: { - click: this.handleClick, - }, - }; - } - - handleClick = () => { - console.log('Circle click'); - } - - onChangedClick = () => { - console.log('onChanged Circle click'); - } - - handlePoint = () => { - const { point } = this.state; - this.setState({ - point: { - lng: point.lng + 0.01, - lat: point.lat + 0.01, - }, - }); - } - - handleRadius = () => { - const { radius } = this.state; - this.setState({ - radius: radius + 100, - }); - } - - handleStrokeColor = () => { - this.setState({ - strokeColor: getRandomColor(), - }); - } - - handleFillColor = () => { - this.setState({ - fillColor: getRandomColor(), - }); - } - - handleStrokeWeight = () => { - const { strokeWeight } = this.state; - this.setState({ - strokeWeight: strokeWeight + 1, - }); - } - - handleStrokeOpacity = () => { - let { strokeOpacity } = this.state; - if (strokeOpacity >= 0.9) { - strokeOpacity = 0.1; - } - this.setState({ - strokeOpacity: strokeOpacity + 0.1, - }); - } - - handleFillOpacity = () => { - let { fillOpacity } = this.state; - if (fillOpacity >= 0.9) { - fillOpacity = 0.1; - } - this.setState({ - fillOpacity: fillOpacity + 0.1, - }); - } - - handleStrokeStyle = () => { - const { strokeStyle } = this.state; - this.setState({ - strokeStyle: strokeStyle === 'dashed' ? 'solid' : 'dashed', - }); - } - - handleMassClear = () => { - const { massClear } = this.state; - this.setState({ - massClear: !massClear, - }); - } - - handleClear = () => { - window.bMapInstance.clearOverlays(); - } - - handleEditing = () => { - const { editing } = this.state; - this.setState({ - editing: !editing, - }); - } - - handleClicking = () => { - const { clicking } = this.state; - this.setState({ - clicking: !clicking, - }); - } - - handleEvents = () => { - this.setState({ - events: { - click: this.onChangedClick, - }, - }); - } - - render() { - const { - point, radius, strokeColor, fillColor, strokeWeight, - strokeOpacity, fillOpacity, strokeStyle, massClear, editing, clicking, events, - } = this.state; - return ( - -
    - - - -
    - - - - - - - - - - - - - -
    - ); - } -} - -export default CircleExample; diff --git a/examples/src/overlay/circle/index.md b/examples/src/overlay/circle/index.md deleted file mode 100644 index d5e9edd..0000000 --- a/examples/src/overlay/circle/index.md +++ /dev/null @@ -1,183 +0,0 @@ -import React, { Component } from 'react'; -import { Button } from 'antd'; -import { Map, Circle } from 'rc-bmap'; -import { getRandomColor } from 'utils'; - -class CircleExample extends Component { - constructor(props) { - super(props); - this.state = { - point: { lng: 116.404, lat: 39.915 }, - radius: 500, - strokeColor: 'blue', - fillColor: 'red', - strokeWeight: 5, - strokeOpacity: 0.5, - fillOpacity: 0.9, - strokeStyle: 'dashed', - massClear: false, - editing: false, - clicking: true, - events: { - click: this.handleClick, - }, - }; - } - - handleClick = () => { - console.log('Circle click'); - } - - onChangedClick = () => { - console.log('onChanged Circle click'); - } - - handlePoint = () => { - const { point } = this.state; - this.setState({ - point: { - lng: point.lng + 0.01, - lat: point.lat + 0.01, - }, - }); - } - - handleRadius = () => { - const { radius } = this.state; - this.setState({ - radius: radius + 100, - }); - } - - handleStrokeColor = () => { - this.setState({ - strokeColor: getRandomColor(), - }); - } - - handleFillColor = () => { - this.setState({ - fillColor: getRandomColor(), - }); - } - - handleStrokeWeight = () => { - const { strokeWeight } = this.state; - this.setState({ - strokeWeight: strokeWeight + 1, - }); - } - - handleStrokeOpacity = () => { - let { strokeOpacity } = this.state; - if (strokeOpacity >= 0.9) { - strokeOpacity = 0.1; - } - this.setState({ - strokeOpacity: strokeOpacity + 0.1, - }); - } - - handleFillOpacity = () => { - let { fillOpacity } = this.state; - if (fillOpacity >= 0.9) { - fillOpacity = 0.1; - } - this.setState({ - fillOpacity: fillOpacity + 0.1, - }); - } - - handleStrokeStyle = () => { - const { strokeStyle } = this.state; - this.setState({ - strokeStyle: strokeStyle === 'dashed' ? 'solid' : 'dashed', - }); - } - - handleMassClear = () => { - const { massClear } = this.state; - this.setState({ - massClear: !massClear, - }); - } - - handleClear = () => { - window.bMapInstance.clearOverlays(); - } - - handleEditing = () => { - const { editing } = this.state; - this.setState({ - editing: !editing, - }); - } - - handleClicking = () => { - const { clicking } = this.state; - this.setState({ - clicking: !clicking, - }); - } - - handleEvents = () => { - this.setState({ - events: { - click: this.onChangedClick, - }, - }); - } - - render() { - const { - point, radius, strokeColor, fillColor, strokeWeight, - strokeOpacity, fillOpacity, strokeStyle, massClear, editing, clicking, events, - } = this.state; - return ( - -
    - - - -
    - - - - - - - - - - - - - -
    - ); - } -} - -export default CircleExample; diff --git a/examples/src/overlay/ground/index.js b/examples/src/overlay/ground/index.js deleted file mode 100644 index a311bec..0000000 --- a/examples/src/overlay/ground/index.js +++ /dev/null @@ -1,133 +0,0 @@ -import React, { Component } from 'react'; -import { Button } from 'antd'; -import { Map, Ground } from 'rc-bmap'; -import Container from 'components/Container'; -import index from './index.md'; - -class GroundExample extends Component { - constructor(props) { - super(props); - this.state = { - bounds: { - sw: { - lng: 116.295, - lat: 39.837, - }, - ne: { - lng: 116.475, - lat: 39.976, - }, - }, - imageURL: 'http://lbsyun.baidu.com/jsdemo/img/si-huan.png', - opacity: 1, - maxZoom: 14, - minZoom: 10, - events: { - click: this.handleClick, - }, - }; - } - - handleClick = () => { - console.log('Circle click'); - } - - onChangedClick = () => { - console.log('onChanged Circle click'); - } - - handleBounds = () => { - const { bounds } = this.state; - this.setState({ - bounds: { - sw: { - lng: bounds.sw.lng + 0.01, - lat: bounds.sw.lat + 0.01, - }, - ne: { - lng: bounds.ne.lng + 0.01, - lat: bounds.ne.lat + 0.01, - }, - }, - }); - } - - handleOpacity = () => { - let { opacity } = this.state; - if (opacity >= 0.9) { - opacity = 0.1; - } - this.setState({ - opacity: opacity + 0.1, - }); - } - - handleMaxZoom = () => { - const { maxZoom } = this.state; - console.log(maxZoom); - this.setState({ - maxZoom: maxZoom + 1, - }); - } - - handleMinZoom = () => { - let { minZoom } = this.state; - const { maxZoom } = this.state; - if (minZoom + 1 >= maxZoom) { - minZoom = 0; - } - console.log(minZoom); - this.setState({ - minZoom: minZoom + 1, - }); - } - - handleEvents = () => { - this.setState({ - events: { - click: this.onChangedClick, - }, - }); - } - - handleImageURL = () => { - const { imageURL } = this.state; - this.setState({ - imageURL: imageURL ? '' : 'http://lbsyun.baidu.com/jsdemo/img/si-huan.png', - }); - } - - render() { - const { - bounds, opacity, maxZoom, minZoom, events, imageURL, - } = this.state; - return ( - -
    - - - -
    - - - - - - -
    - ); - } -} - -export default GroundExample; diff --git a/examples/src/overlay/ground/index.md b/examples/src/overlay/ground/index.md deleted file mode 100644 index 065d81b..0000000 --- a/examples/src/overlay/ground/index.md +++ /dev/null @@ -1,129 +0,0 @@ -import React, { Component } from 'react'; -import { Button } from 'antd'; -import { Map, Ground } from 'rc-bmap'; - -class GroundExample extends Component { - constructor(props) { - super(props); - this.state = { - bounds: { - sw: { - lng: 116.295, - lat: 39.837, - }, - ne: { - lng: 116.475, - lat: 39.976, - }, - }, - imageURL: 'http://lbsyun.baidu.com/jsdemo/img/si-huan.png', - opacity: 1, - maxZoom: 14, - minZoom: 10, - events: { - click: this.handleClick, - }, - }; - } - - handleClick = () => { - console.log('Circle click'); - } - - onChangedClick = () => { - console.log('onChanged Circle click'); - } - - handleBounds = () => { - const { bounds } = this.state; - this.setState({ - bounds: { - sw: { - lng: bounds.sw.lng + 0.01, - lat: bounds.sw.lat + 0.01, - }, - ne: { - lng: bounds.ne.lng + 0.01, - lat: bounds.ne.lat + 0.01, - }, - }, - }); - } - - handleOpacity = () => { - let { opacity } = this.state; - if (opacity >= 0.9) { - opacity = 0.1; - } - this.setState({ - opacity: opacity + 0.1, - }); - } - - handleMaxZoom = () => { - const { maxZoom } = this.state; - console.log(maxZoom); - this.setState({ - maxZoom: maxZoom + 1, - }); - } - - handleMinZoom = () => { - let { minZoom } = this.state; - const { maxZoom } = this.state; - if (minZoom + 1 >= maxZoom) { - minZoom = 0; - } - console.log(minZoom); - this.setState({ - minZoom: minZoom + 1, - }); - } - - handleEvents = () => { - this.setState({ - events: { - click: this.onChangedClick, - }, - }); - } - - handleImageURL = () => { - const { imageURL } = this.state; - this.setState({ - imageURL: imageURL ? '' : 'http://lbsyun.baidu.com/jsdemo/img/si-huan.png', - }); - } - - render() { - const { - bounds, opacity, maxZoom, minZoom, events, imageURL, - } = this.state; - return ( - -
    - - - -
    - - - - - - -
    - ); - } -} - -export default GroundExample; diff --git a/examples/src/overlay/infoWindow/index.js b/examples/src/overlay/infoWindow/index.js deleted file mode 100644 index 61eedae..0000000 --- a/examples/src/overlay/infoWindow/index.js +++ /dev/null @@ -1,197 +0,0 @@ -import React, { Component } from 'react'; -import { Button } from 'antd'; -import { Map, InfoWindow } from 'rc-bmap'; -import Container from 'components/Container'; -import index from './index.md'; - -class InfoWindowExample extends Component { - constructor(props) { - super(props); - this.state = { - title: '弹出框标题', - content: '弹出框内容', - point: { - lng: 116.404, - lat: 39.915, - }, - offset: { - width: 3, - height: 0, - }, - width: 220, - height: 60, - maxWidth: 250, - autoPan: false, - closeOnClick: false, - displayMessage: false, - message: '短信内容', - events: { - open: this.handleOpen, - }, - visible: true, - }; - } - - handleDisplay = () => { - const { visible } = this.state; - this.setState({ - visible: !visible, - }); - } - - handleOpen = () => { - console.log('InfoWindow open'); - } - - handleClose = () => { - console.log('InfoWindow close'); - } - - handleTitle = () => { - const { title } = this.state; - this.setState({ - title: title === '弹出框新标题' ? '弹出框标题' : '弹出框新标题', - }); - } - - handleContent = () => { - const { content } = this.state; - this.setState({ - content: content === '弹出框新内容' ? '弹出框内容' : '弹出框新内容', - }); - } - - handlePoint = () => { - const { point } = this.state; - this.setState({ - point: { - lng: point.lng + 0.001, - lat: point.lat + 0.001, - }, - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - handleWidth = () => { - const { width } = this.state; - this.setState({ - width: width + 10, - }); - } - - handleHeight = () => { - const { height } = this.state; - this.setState({ - height: height + 10, - }); - } - - handleMaxWidth = () => { - this.setState({ - maxWidth: 300, - }); - } - - handleAutoPan = () => { - const { autoPan } = this.state; - this.setState({ - autoPan: !autoPan, - }); - } - - handleCloseOnClick = () => { - const { closeOnClick } = this.state; - this.setState({ - closeOnClick: !closeOnClick, - }); - } - - handleDisplayMessage = () => { - const { displayMessage } = this.state; - this.setState({ - displayMessage: !displayMessage, - }); - } - - handleMessage = () => { - this.setState({ - message: '新的短信内容', - }); - } - - handleEvents = () => { - this.setState({ - events: { - close: this.handleClose, - }, - }); - } - - render() { - const { - title, content, point, offset, width, height, visible, - maxWidth, autoPan, closeOnClick, displayMessage, message, events, - } = this.state; - return ( - -
    - - { - visible && ( - - ) - } - -
    - - - - - - - - - - - - - -
    - ); - } -} - -export default InfoWindowExample; diff --git a/examples/src/overlay/infoWindow/index.md b/examples/src/overlay/infoWindow/index.md deleted file mode 100644 index 51d2169..0000000 --- a/examples/src/overlay/infoWindow/index.md +++ /dev/null @@ -1,195 +0,0 @@ -import React, { Component } from 'react'; -import { Button } from 'antd'; -import { Map, InfoWindow } from 'rc-bmap'; - -class InfoWindowExample extends Component { - constructor(props) { - super(props); - this.state = { - title: '弹出框标题', - content: '弹出框内容', - point: { - lng: 116.404, - lat: 39.915, - }, - offset: { - width: 3, - height: 0, - }, - width: 220, - height: 60, - maxWidth: 250, - autoPan: false, - closeOnClick: false, - displayMessage: false, - message: '短信内容', - events: { - open: this.handleOpen, - }, - visible: true, - }; - } - - handleDisplay = () => { - const { visible } = this.state; - this.setState({ - visible: !visible, - }); - } - - handleOpen = () => { - console.log('InfoWindow open'); - } - - handleClose = () => { - console.log('InfoWindow close'); - } - - handleTitle = () => { - const { title } = this.state; - this.setState({ - title: title === '弹出框新标题' ? '弹出框标题' : '弹出框新标题', - }); - } - - handleContent = () => { - const { content } = this.state; - this.setState({ - content: content === '弹出框新内容' ? '弹出框内容' : '弹出框新内容', - }); - } - - handlePoint = () => { - const { point } = this.state; - this.setState({ - point: { - lng: point.lng + 0.001, - lat: point.lat + 0.001, - }, - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 3, - height: offset.height + 3, - }, - }); - } - - handleWidth = () => { - const { width } = this.state; - this.setState({ - width: width + 10, - }); - } - - handleHeight = () => { - const { height } = this.state; - this.setState({ - height: height + 10, - }); - } - - handleMaxWidth = () => { - this.setState({ - maxWidth: 300, - }); - } - - handleAutoPan = () => { - const { autoPan } = this.state; - this.setState({ - autoPan: !autoPan, - }); - } - - handleCloseOnClick = () => { - const { closeOnClick } = this.state; - this.setState({ - closeOnClick: !closeOnClick, - }); - } - - handleDisplayMessage = () => { - const { displayMessage } = this.state; - this.setState({ - displayMessage: !displayMessage, - }); - } - - handleMessage = () => { - this.setState({ - message: '新的短信内容', - }); - } - - handleEvents = () => { - this.setState({ - events: { - close: this.handleClose, - }, - }); - } - - render() { - const { - title, content, point, offset, width, height, visible, - maxWidth, autoPan, closeOnClick, displayMessage, message, events, - } = this.state; - return ( - -
    - - { - visible && ( - - ) - } - -
    - - - - - - - - - - - - - -
    - ); - } -} - -export default InfoWindowExample; diff --git a/examples/src/overlay/label/index.js b/examples/src/overlay/label/index.js deleted file mode 100644 index 5c6910e..0000000 --- a/examples/src/overlay/label/index.js +++ /dev/null @@ -1,134 +0,0 @@ -import React, { Component } from 'react'; -import { Button } from 'antd'; -import { Map, Label } from 'rc-bmap'; -import Container from 'components/Container'; -import { getRandomColor } from 'utils'; -import index from './index.md'; - -class LabelExample extends Component { - constructor(props) { - super(props); - this.state = { - content: '这是标签哦', - point: { - lng: 116.404, - lat: 39.915, - }, - offset: { - width: 3, - height: 0, - }, - massClear: false, - title: '标签也可以是html哦', - zIndex: 100, - events: { - click() { - console.log('label click'); - }, - }, - style: { - backgroundColor: 'red', - color: '#fff', - }, - }; - } - - handleContent = () => { - const { content } = this.state; - this.setState({ - content: content === '新的标签内容' ? '标签内容' : '新的标签内容', - }); - } - - handlePoint = () => { - const { point } = this.state; - this.setState({ - point: { - lng: point.lng + 0.01, - lat: point.lat + 0.01, - }, - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 10, - height: offset.height + 10, - }, - }); - } - - handleMassClear = () => { - const { massClear } = this.state; - this.setState({ - massClear: !massClear, - }); - } - - handleClear = () => { - window.bMapInstance.clearOverlays(); - } - - handleTitle = () => { - const { title } = this.state; - this.setState({ - title: title === '新的title' ? 'title' : '新的title', - }); - } - - handleZIndex = () => { - this.setState({ - zIndex: 50, - }); - } - - handleStyle = () => { - this.setState({ - style: { - backgroundColor: getRandomColor(), - color: getRandomColor(), - }, - }); - } - - render() { - const { - content, point, offset, massClear, title, events, zIndex, style, - } = this.state; - return ( - -
    - - -
    - - - - - - - - -
    - ); - } -} - -export default LabelExample; diff --git a/examples/src/overlay/label/index.md b/examples/src/overlay/label/index.md deleted file mode 100644 index fd18d50..0000000 --- a/examples/src/overlay/label/index.md +++ /dev/null @@ -1,132 +0,0 @@ -import React, { Component } from 'react'; -import { Button } from 'antd'; -import { Map, Label } from 'rc-bmap'; -import { getRandomColor } from 'utils'; - -class LabelExample extends Component { - constructor(props) { - super(props); - this.state = { - content: '这是标签哦', - point: { - lng: 116.404, - lat: 39.915, - }, - offset: { - width: 3, - height: 0, - }, - massClear: false, - title: '标签也可以是html哦', - zIndex: 100, - events: { - click() { - console.log('label click'); - }, - }, - style: { - backgroundColor: 'red', - color: '#fff', - }, - }; - } - - handleContent = () => { - const { content } = this.state; - this.setState({ - content: content === '新的标签内容' ? '标签内容' : '新的标签内容', - }); - } - - handlePoint = () => { - const { point } = this.state; - this.setState({ - point: { - lng: point.lng + 0.01, - lat: point.lat + 0.01, - }, - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 10, - height: offset.height + 10, - }, - }); - } - - handleMassClear = () => { - const { massClear } = this.state; - this.setState({ - massClear: !massClear, - }); - } - - handleClear = () => { - window.bMapInstance.clearOverlays(); - } - - handleTitle = () => { - const { title } = this.state; - this.setState({ - title: title === '新的title' ? 'title' : '新的title', - }); - } - - handleZIndex = () => { - this.setState({ - zIndex: 50, - }); - } - - handleStyle = () => { - this.setState({ - style: { - backgroundColor: getRandomColor(), - color: getRandomColor(), - }, - }); - } - - render() { - const { - content, point, offset, massClear, title, events, zIndex, style, - } = this.state; - return ( - -
    - - -
    - - - - - - - - -
    - ); - } -} - -export default LabelExample; diff --git a/examples/src/overlay/marker/index.js b/examples/src/overlay/marker/index.js deleted file mode 100644 index 7f837f8..0000000 --- a/examples/src/overlay/marker/index.js +++ /dev/null @@ -1,215 +0,0 @@ -import React, { Component } from 'react'; -import { Button } from 'antd'; -import { Map, Marker, Animation } from 'rc-bmap'; -import Container from 'components/Container'; -import index from './index.md'; - -class MarkerExample extends Component { - constructor(props) { - super(props); - this.state = { - markerPoint: { lng: 116.404, lat: 39.915 }, - offset: { width: 10, height: 10 }, - icon: null, - dragging: false, - title: 'This is title', - clicking: true, - raiseOnDrag: false, - draggingCursor: '', - shadow: null, - contextMenu: { - items: [{ - text: '你好', - callback() { console.log(666); }, - separator: true, - width: 100, - disabled: false, - }], - }, - rotation: 0, - massClear: false, - }; - - this.icon = { - url: 'http://lbsyun.baidu.com/jsdemo/img/fox.gif', - size: { - width: 300, - height: 157, - }, - opts: { - imageOffset: { width: 10, height: 10 }, - }, - }; - - this.shadow = { - url: 'http://lbsyun.baidu.com/jsdemo/img/fox.gif', - size: { - width: 600, - height: 314, - }, - opts: { - imageOffset: { width: 200, height: 100 }, - }, - }; - } - - handleMarkerPoint = () => { - const { markerPoint } = this.state; - this.setState({ - markerPoint: { - lng: markerPoint.lng + 0.001, - lat: markerPoint.lat + 0.001, - }, - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 10, - height: offset.height + 10, - }, - }); - } - - handleIcon = () => { - const { icon } = this.state; - this.setState({ - icon: icon ? null : this.icon, - }); - } - - handleDragging = () => { - const { dragging } = this.state; - this.setState({ - dragging: !dragging, - }); - } - - handleTitle = () => { - const { title } = this.state; - this.setState({ - title: title ? '新title' : 'title', - }); - } - - handleRaiseOnDrag = () => { - const { raiseOnDrag } = this.state; - this.setState({ - raiseOnDrag: !raiseOnDrag, - }); - } - - handleDraggingCursor = () => { - this.setState({ - draggingCursor: 'default', - }); - } - - handleShadow = () => { - const { shadow } = this.state; - this.setState({ - shadow: shadow ? null : this.shadow, - }); - } - - handleContextMenu = () => { - this.setState({ - contextMenu: { - items: [{ - text: '大家好', - callback() { console.log(888); }, - separator: false, - width: 100, - disabled: true, - }], - }, - }); - } - - handleRotation = () => { - const { rotation } = this.state; - this.setState({ - rotation: rotation + 10, - }); - } - - handleMassClear = () => { - const { massClear } = this.state; - this.setState({ - massClear: !massClear, - }); - } - - handleClicking = () => { - const { clicking } = this.state; - this.setState({ - clicking: !clicking, - }); - } - - handleClear = () => { - window.bMapInstance.clearOverlays(); - } - - render() { - const { - markerPoint, offset, icon, dragging, title, clicking, - raiseOnDrag, draggingCursor, shadow, contextMenu, rotation, massClear, - } = this.state; - return ( - -
    - - - -
    - - - - - - - - - - - - - -
    - ); - } -} - -export default MarkerExample; diff --git a/examples/src/overlay/marker/index.md b/examples/src/overlay/marker/index.md deleted file mode 100644 index 2ca0e29..0000000 --- a/examples/src/overlay/marker/index.md +++ /dev/null @@ -1,213 +0,0 @@ -import React, { Component } from 'react'; -import { Button } from 'antd'; -import { Map, Marker, Animation } from 'rc-bmap'; - -class MarkerExample extends Component { - constructor(props) { - super(props); - this.state = { - markerPoint: { lng: 116.404, lat: 39.915 }, - offset: { width: 10, height: 10 }, - icon: null, - dragging: false, - title: 'This is title', - clicking: true, - raiseOnDrag: false, - draggingCursor: '', - shadow: null, - contextMenu: { - items: [{ - text: '你好', - callback() { console.log(666); }, - separator: true, - width: 100, - disabled: false, - }], - }, - rotation: 0, - massClear: false, - }; - - this.icon = { - url: 'http://lbsyun.baidu.com/jsdemo/img/fox.gif', - size: { - width: 300, - height: 157, - }, - opts: { - imageOffset: { width: 10, height: 10 }, - }, - }; - - this.shadow = { - url: 'http://lbsyun.baidu.com/jsdemo/img/fox.gif', - size: { - width: 600, - height: 314, - }, - opts: { - imageOffset: { width: 200, height: 100 }, - }, - }; - } - - handleMarkerPoint = () => { - const { markerPoint } = this.state; - this.setState({ - markerPoint: { - lng: markerPoint.lng + 0.001, - lat: markerPoint.lat + 0.001, - }, - }); - } - - handleOffset = () => { - const { offset } = this.state; - this.setState({ - offset: { - width: offset.width + 10, - height: offset.height + 10, - }, - }); - } - - handleIcon = () => { - const { icon } = this.state; - this.setState({ - icon: icon ? null : this.icon, - }); - } - - handleDragging = () => { - const { dragging } = this.state; - this.setState({ - dragging: !dragging, - }); - } - - handleTitle = () => { - const { title } = this.state; - this.setState({ - title: title ? '新title' : 'title', - }); - } - - handleRaiseOnDrag = () => { - const { raiseOnDrag } = this.state; - this.setState({ - raiseOnDrag: !raiseOnDrag, - }); - } - - handleDraggingCursor = () => { - this.setState({ - draggingCursor: 'default', - }); - } - - handleShadow = () => { - const { shadow } = this.state; - this.setState({ - shadow: shadow ? null : this.shadow, - }); - } - - handleContextMenu = () => { - this.setState({ - contextMenu: { - items: [{ - text: '大家好', - callback() { console.log(888); }, - separator: false, - width: 100, - disabled: true, - }], - }, - }); - } - - handleRotation = () => { - const { rotation } = this.state; - this.setState({ - rotation: rotation + 10, - }); - } - - handleMassClear = () => { - const { massClear } = this.state; - this.setState({ - massClear: !massClear, - }); - } - - handleClicking = () => { - const { clicking } = this.state; - this.setState({ - clicking: !clicking, - }); - } - - handleClear = () => { - window.bMapInstance.clearOverlays(); - } - - render() { - const { - markerPoint, offset, icon, dragging, title, clicking, - raiseOnDrag, draggingCursor, shadow, contextMenu, rotation, massClear, - } = this.state; - return ( - -
    - - - -
    - - - - - - - - - - - - - -
    - ); - } -} - -export default MarkerExample; diff --git a/examples/src/overlay/pointCollection/index.js b/examples/src/overlay/pointCollection/index.js deleted file mode 100644 index e8d9258..0000000 --- a/examples/src/overlay/pointCollection/index.js +++ /dev/null @@ -1,121 +0,0 @@ -import React, { Component } from 'react'; -import { - Map, PointCollection, SizeType, ShapeType, -} from 'rc-bmap'; -import { Button } from 'antd'; -import Container from 'components/Container'; -import { getRandomColor, getRandomShape } from 'utils'; -import index from './index.md'; - -class PointCollectionExample extends Component { - constructor(props) { - super(props); - this.state = { - color: 'red', - shape: ShapeType.STAR, - size: SizeType.BIGGER, - points: [ - { - lng: 116.387, - lat: 39.920, - }, { - lng: 116.385, - lat: 39.913, - }, - { - lng: 116.394, - lat: 39.917, - }, - ], - events: { - click: this.onClick, - }, - }; - } - - onClick = () => { - console.log('PointCollection click'); - } - - onChangedClick = () => { - console.log('onChanged PointCollection click'); - } - - handleEvents = () => { - this.setState({ - events: { - click: this.onChangedClick, - }, - }); - } - - handleSize = () => { - const { size } = this.state; - this.setState({ - size: size === SizeType.BIGGER ? SizeType.HUGE : SizeType.BIGGER, - }); - } - - handlePoints = () => { - const { points } = this.state; - this.setState({ - points: [ - { - lng: points[0].lng + 0.01, - lat: points[0].lat + 0.01, - }, { - lng: points[1].lng + 0.01, - lat: points[1].lat + 0.01, - }, - { - lng: points[2].lng + 0.01, - lat: points[2].lat + 0.01, - }, - ], - }); - } - - handleShape = () => { - const randomShape = getRandomShape(); - this.setState({ - shape: ShapeType[randomShape], - }); - } - - handleColor = () => { - this.setState({ - color: getRandomColor(), - }); - } - - render() { - const { - points, size, shape, color, events, - } = this.state; - return ( - -
    - - - -
    - - - - - -
    - ); - } -} - -export default PointCollectionExample; diff --git a/examples/src/overlay/pointCollection/index.md b/examples/src/overlay/pointCollection/index.md deleted file mode 100644 index 6f8b01b..0000000 --- a/examples/src/overlay/pointCollection/index.md +++ /dev/null @@ -1,119 +0,0 @@ -import React, { Component } from 'react'; -import { - Map, PointCollection, SizeType, ShapeType, -} from 'rc-bmap'; -import { Button } from 'antd'; -import { getRandomColor, getRandomShape } from 'utils'; - -class PointCollectionExample extends Component { - constructor(props) { - super(props); - this.state = { - color: 'red', - shape: ShapeType.STAR, - size: SizeType.BIGGER, - points: [ - { - lng: 116.387, - lat: 39.920, - }, { - lng: 116.385, - lat: 39.913, - }, - { - lng: 116.394, - lat: 39.917, - }, - ], - events: { - click: this.onClick, - }, - }; - } - - onClick = () => { - console.log('PointCollection click'); - } - - onChangedClick = () => { - console.log('onChanged PointCollection click'); - } - - handleEvents = () => { - this.setState({ - events: { - click: this.onChangedClick, - }, - }); - } - - handleSize = () => { - const { size } = this.state; - this.setState({ - size: size === SizeType.BIGGER ? SizeType.HUGE : SizeType.BIGGER, - }); - } - - handlePoints = () => { - const { points } = this.state; - this.setState({ - points: [ - { - lng: points[0].lng + 0.01, - lat: points[0].lat + 0.01, - }, { - lng: points[1].lng + 0.01, - lat: points[1].lat + 0.01, - }, - { - lng: points[2].lng + 0.01, - lat: points[2].lat + 0.01, - }, - ], - }); - } - - handleShape = () => { - const randomShape = getRandomShape(); - this.setState({ - shape: ShapeType[randomShape], - }); - } - - handleColor = () => { - this.setState({ - color: getRandomColor(), - }); - } - - render() { - const { - points, size, shape, color, events, - } = this.state; - return ( - -
    - - - -
    - - - - - -
    - ); - } -} - -export default PointCollectionExample; diff --git a/examples/src/overlay/polygon/index.js b/examples/src/overlay/polygon/index.js deleted file mode 100644 index 6e61b3d..0000000 --- a/examples/src/overlay/polygon/index.js +++ /dev/null @@ -1,196 +0,0 @@ -import React, { Component } from 'react'; -import { Button } from 'antd'; -import { Map, Polygon } from 'rc-bmap'; -import Container from 'components/Container'; -import { getRandomColor } from 'utils'; -import index from './index.md'; - -class PolygonExample extends Component { - constructor(props) { - super(props); - this.state = { - points: [ - { - lng: 116.387, - lat: 39.920, - }, { - lng: 116.385, - lat: 39.913, - }, - { - lng: 116.394, - lat: 39.917, - }, - ], - strokeColor: 'blue', - fillColor: 'red', - strokeWeight: 5, - strokeOpacity: 0.5, - fillOpacity: 0.9, - strokeStyle: 'dashed', - massClear: false, - editing: false, - clicking: true, - events: { - click: this.handleClick, - }, - }; - } - - handleClick = () => { - console.log('Polygon click'); - } - - onChangedClick = () => { - console.log('onChanged Polygon click'); - } - - handlePoints = () => { - const { points } = this.state; - this.setState({ - points: [ - { - lng: points[0].lng + 0.01, - lat: points[0].lat + 0.01, - }, { - lng: points[1].lng + 0.01, - lat: points[1].lat + 0.01, - }, - { - lng: points[2].lng + 0.01, - lat: points[2].lat + 0.01, - }, - ], - }); - } - - handleStrokeColor = () => { - this.setState({ - strokeColor: getRandomColor(), - }); - } - - handleFillColor = () => { - this.setState({ - fillColor: getRandomColor(), - }); - } - - handleStrokeWeight = () => { - const { strokeWeight } = this.state; - this.setState({ - strokeWeight: strokeWeight + 1, - }); - } - - handleStrokeOpacity = () => { - let { strokeOpacity } = this.state; - if (strokeOpacity === 1) { - strokeOpacity = 0.1; - } - this.setState({ - strokeOpacity: strokeOpacity + 0.1, - }); - } - - handleFillOpacity = () => { - let { fillOpacity } = this.state; - if (fillOpacity === 1) { - fillOpacity = 0.1; - } - this.setState({ - fillOpacity: fillOpacity + 0.1, - }); - } - - handleStrokeStyle = () => { - const { strokeStyle } = this.state; - this.setState({ - strokeStyle: strokeStyle === 'dashed' ? 'solid' : 'dashed', - }); - } - - handleMassClear = () => { - const { massClear } = this.state; - this.setState({ - massClear: !massClear, - }); - } - - handleClear = () => { - window.bMapInstance.clearOverlays(); - } - - handleEditing = () => { - const { editing } = this.state; - this.setState({ - editing: !editing, - }); - } - - handleClicking = () => { - const { clicking } = this.state; - this.setState({ - clicking: !clicking, - }); - } - - handleEvents = () => { - this.setState({ - events: { - click: this.onChangedClick, - }, - }); - } - - render() { - const { - points, strokeColor, fillColor, strokeWeight, strokeOpacity, - fillOpacity, strokeStyle, massClear, editing, clicking, events, - } = this.state; - return ( - -
    - - - -
    - - - - - - - - - - - - -
    - ); - } -} - -export default PolygonExample; diff --git a/examples/src/overlay/polygon/index.md b/examples/src/overlay/polygon/index.md deleted file mode 100644 index 00d342e..0000000 --- a/examples/src/overlay/polygon/index.md +++ /dev/null @@ -1,194 +0,0 @@ -import React, { Component } from 'react'; -import { Button } from 'antd'; -import { Map, Polygon } from 'rc-bmap'; -import { getRandomColor } from 'utils'; - -class PolygonExample extends Component { - constructor(props) { - super(props); - this.state = { - points: [ - { - lng: 116.387, - lat: 39.920, - }, { - lng: 116.385, - lat: 39.913, - }, - { - lng: 116.394, - lat: 39.917, - }, - ], - strokeColor: 'blue', - fillColor: 'red', - strokeWeight: 5, - strokeOpacity: 0.5, - fillOpacity: 0.9, - strokeStyle: 'dashed', - massClear: false, - editing: false, - clicking: true, - events: { - click: this.handleClick, - }, - }; - } - - handleClick = () => { - console.log('Polygon click'); - } - - onChangedClick = () => { - console.log('onChanged Polygon click'); - } - - handlePoints = () => { - const { points } = this.state; - this.setState({ - points: [ - { - lng: points[0].lng + 0.01, - lat: points[0].lat + 0.01, - }, { - lng: points[1].lng + 0.01, - lat: points[1].lat + 0.01, - }, - { - lng: points[2].lng + 0.01, - lat: points[2].lat + 0.01, - }, - ], - }); - } - - handleStrokeColor = () => { - this.setState({ - strokeColor: getRandomColor(), - }); - } - - handleFillColor = () => { - this.setState({ - fillColor: getRandomColor(), - }); - } - - handleStrokeWeight = () => { - const { strokeWeight } = this.state; - this.setState({ - strokeWeight: strokeWeight + 1, - }); - } - - handleStrokeOpacity = () => { - let { strokeOpacity } = this.state; - if (strokeOpacity === 1) { - strokeOpacity = 0.1; - } - this.setState({ - strokeOpacity: strokeOpacity + 0.1, - }); - } - - handleFillOpacity = () => { - let { fillOpacity } = this.state; - if (fillOpacity === 1) { - fillOpacity = 0.1; - } - this.setState({ - fillOpacity: fillOpacity + 0.1, - }); - } - - handleStrokeStyle = () => { - const { strokeStyle } = this.state; - this.setState({ - strokeStyle: strokeStyle === 'dashed' ? 'solid' : 'dashed', - }); - } - - handleMassClear = () => { - const { massClear } = this.state; - this.setState({ - massClear: !massClear, - }); - } - - handleClear = () => { - window.bMapInstance.clearOverlays(); - } - - handleEditing = () => { - const { editing } = this.state; - this.setState({ - editing: !editing, - }); - } - - handleClicking = () => { - const { clicking } = this.state; - this.setState({ - clicking: !clicking, - }); - } - - handleEvents = () => { - this.setState({ - events: { - click: this.onChangedClick, - }, - }); - } - - render() { - const { - points, strokeColor, fillColor, strokeWeight, strokeOpacity, - fillOpacity, strokeStyle, massClear, editing, clicking, events, - } = this.state; - return ( - -
    - - - -
    - - - - - - - - - - - - -
    - ); - } -} - -export default PolygonExample; diff --git a/examples/src/overlay/polyline/index.js b/examples/src/overlay/polyline/index.js deleted file mode 100644 index 85c6740..0000000 --- a/examples/src/overlay/polyline/index.js +++ /dev/null @@ -1,196 +0,0 @@ -import React, { Component } from 'react'; -import { Button } from 'antd'; -import { Map, Polyline } from 'rc-bmap'; -import Container from 'components/Container'; -import { getRandomColor } from 'utils'; -import index from './index.md'; - -class PolylineExample extends Component { - constructor(props) { - super(props); - this.state = { - points: [ - { - lng: 116.387, - lat: 39.920, - }, { - lng: 116.385, - lat: 39.913, - }, - ], - strokeColor: 'blue', - strokeWeight: 8, - strokeOpacity: 0.8, - strokeStyle: 'dashed', - massClear: false, - editing: false, - clicking: true, - events: { - click: this.handleClick, - }, - icons: [], - isShowArrow: false, - }; - } - - drawLineDirection = () => { - const sy = new window.BMap.Symbol(window.BMap_Symbol_SHAPE_BACKWARD_OPEN_ARROW, { - scale: 0.6, - strokeWeight: 1, - strokeColor: '#fff', - }); - const icons = new window.BMap.IconSequence(sy, '10', '30'); - return icons; - } - - mapMounted = () => { - const icons = this.drawLineDirection(); - this.setState({ icons }); - } - - handleClick = () => { - console.log('Polyline click'); - } - - onChangedClick = () => { - console.log('onChanged Polyline click'); - } - - handlePoints = () => { - const { points } = this.state; - this.setState({ - points: [ - { - lng: points[0].lng + 0.01, - lat: points[0].lat + 0.01, - }, { - lng: points[1].lng + 0.01, - lat: points[1].lat + 0.01, - }, - ], - }); - } - - handleStrokeColor = () => { - this.setState({ - strokeColor: getRandomColor(), - }); - } - - handleStrokeWeight = () => { - const { strokeWeight } = this.state; - this.setState({ - strokeWeight: strokeWeight + 1, - }); - } - - handleStrokeOpacity = () => { - let { strokeOpacity } = this.state; - if (strokeOpacity === 1) { - strokeOpacity = 0.1; - } - this.setState({ - strokeOpacity: strokeOpacity + 0.1, - }); - } - - handleStrokeStyle = () => { - const { strokeStyle } = this.state; - this.setState({ - strokeStyle: strokeStyle === 'dashed' ? 'solid' : 'dashed', - }); - } - - handleMassClear = () => { - const { massClear } = this.state; - this.setState({ - massClear: !massClear, - }); - } - - handleClear = () => { - window.bMapInstance.clearOverlays(); - } - - handleEditing = () => { - const { editing } = this.state; - this.setState({ - editing: !editing, - }); - } - - handleClicking = () => { - const { clicking } = this.state; - this.setState({ - clicking: !clicking, - }); - } - - handleEvents = () => { - this.setState({ - events: { - click: this.onChangedClick, - }, - }); - } - - handleShowArrow = () => { - const { isShowArrow } = this.state; - this.handleClear(); - this.setState({ isShowArrow: !isShowArrow }); - } - - render() { - const { - points, strokeColor, strokeWeight, strokeOpacity, - strokeStyle, massClear, editing, clicking, events, - icons, isShowArrow, - } = this.state; - return ( - -
    - - - -
    - - - - - - - - - - - -
    - ); - } -} - -export default PolylineExample; diff --git a/examples/src/overlay/polyline/index.md b/examples/src/overlay/polyline/index.md deleted file mode 100644 index 85c6740..0000000 --- a/examples/src/overlay/polyline/index.md +++ /dev/null @@ -1,196 +0,0 @@ -import React, { Component } from 'react'; -import { Button } from 'antd'; -import { Map, Polyline } from 'rc-bmap'; -import Container from 'components/Container'; -import { getRandomColor } from 'utils'; -import index from './index.md'; - -class PolylineExample extends Component { - constructor(props) { - super(props); - this.state = { - points: [ - { - lng: 116.387, - lat: 39.920, - }, { - lng: 116.385, - lat: 39.913, - }, - ], - strokeColor: 'blue', - strokeWeight: 8, - strokeOpacity: 0.8, - strokeStyle: 'dashed', - massClear: false, - editing: false, - clicking: true, - events: { - click: this.handleClick, - }, - icons: [], - isShowArrow: false, - }; - } - - drawLineDirection = () => { - const sy = new window.BMap.Symbol(window.BMap_Symbol_SHAPE_BACKWARD_OPEN_ARROW, { - scale: 0.6, - strokeWeight: 1, - strokeColor: '#fff', - }); - const icons = new window.BMap.IconSequence(sy, '10', '30'); - return icons; - } - - mapMounted = () => { - const icons = this.drawLineDirection(); - this.setState({ icons }); - } - - handleClick = () => { - console.log('Polyline click'); - } - - onChangedClick = () => { - console.log('onChanged Polyline click'); - } - - handlePoints = () => { - const { points } = this.state; - this.setState({ - points: [ - { - lng: points[0].lng + 0.01, - lat: points[0].lat + 0.01, - }, { - lng: points[1].lng + 0.01, - lat: points[1].lat + 0.01, - }, - ], - }); - } - - handleStrokeColor = () => { - this.setState({ - strokeColor: getRandomColor(), - }); - } - - handleStrokeWeight = () => { - const { strokeWeight } = this.state; - this.setState({ - strokeWeight: strokeWeight + 1, - }); - } - - handleStrokeOpacity = () => { - let { strokeOpacity } = this.state; - if (strokeOpacity === 1) { - strokeOpacity = 0.1; - } - this.setState({ - strokeOpacity: strokeOpacity + 0.1, - }); - } - - handleStrokeStyle = () => { - const { strokeStyle } = this.state; - this.setState({ - strokeStyle: strokeStyle === 'dashed' ? 'solid' : 'dashed', - }); - } - - handleMassClear = () => { - const { massClear } = this.state; - this.setState({ - massClear: !massClear, - }); - } - - handleClear = () => { - window.bMapInstance.clearOverlays(); - } - - handleEditing = () => { - const { editing } = this.state; - this.setState({ - editing: !editing, - }); - } - - handleClicking = () => { - const { clicking } = this.state; - this.setState({ - clicking: !clicking, - }); - } - - handleEvents = () => { - this.setState({ - events: { - click: this.onChangedClick, - }, - }); - } - - handleShowArrow = () => { - const { isShowArrow } = this.state; - this.handleClear(); - this.setState({ isShowArrow: !isShowArrow }); - } - - render() { - const { - points, strokeColor, strokeWeight, strokeOpacity, - strokeStyle, massClear, editing, clicking, events, - icons, isShowArrow, - } = this.state; - return ( - -
    - - - -
    - - - - - - - - - - - -
    - ); - } -} - -export default PolylineExample; diff --git a/examples/src/overlay/symbol/index.js b/examples/src/overlay/symbol/index.js deleted file mode 100644 index a1f6f50..0000000 --- a/examples/src/overlay/symbol/index.js +++ /dev/null @@ -1,152 +0,0 @@ -import React, { Component } from 'react'; -import { Map, Symbol, SymbolShapeType } from 'rc-bmap'; -import { Button } from 'antd'; -import Container from 'components/Container'; -import { getRandomColor, getRandomSymbolShape } from 'utils'; -import index from './index.md'; - -class SymbolExample extends Component { - constructor(props) { - super(props); - this.state = { - point: { - lng: 116.404, - lat: 39.915, - }, - path: SymbolShapeType.FORWARD_CLOSED_ARROW, - anchor: { - height: 10, - width: 50, - }, - fillColor: 'red', - fillOpacity: 0.8, - scale: 5, - rotation: 0, - strokeColor: 'blue', - strokeOpacity: 0.8, - strokeWeight: 1, - }; - } - - handlePoint = () => { - const { point } = this.state; - this.setState({ - point: { - lng: point.lng + 0.01, - lat: point.lat + 0.01, - }, - }); - } - - handlePath = () => { - const symbolShape = getRandomSymbolShape(); - this.setState({ - path: SymbolShapeType[symbolShape], - }); - } - - handleAnchor = () => { - const { anchor } = this.state; - this.setState({ - anchor: { - width: anchor.width + 5, - height: anchor.height + 5, - }, - }); - } - - handleFillColor = () => { - this.setState({ - fillColor: getRandomColor(), - }); - } - - handleFillOpacity = () => { - let { fillOpacity } = this.state; - if (fillOpacity >= 0.9) { - fillOpacity = 0.1; - } - this.setState({ - fillOpacity: fillOpacity + 0.1, - }); - } - - handleScale = () => { - const { scale } = this.state; - this.setState({ - scale: scale + 1, - }); - } - - handleRotation = () => { - const { rotation } = this.state; - this.setState({ - rotation: rotation + 10, - }); - } - - handleStrokeColor = () => { - this.setState({ - strokeColor: getRandomColor(), - }); - } - - handleStrokeWeight = () => { - const { strokeWeight } = this.state; - this.setState({ - strokeWeight: strokeWeight + 1, - }); - } - - handleStrokeOpacity = () => { - let { strokeOpacity } = this.state; - if (strokeOpacity >= 0.9) { - strokeOpacity = 0.1; - } - this.setState({ - strokeOpacity: strokeOpacity + 0.1, - }); - } - - render() { - const { - point, path, anchor, fillColor, fillOpacity, scale, - rotation, strokeColor, strokeOpacity, strokeWeight, - } = this.state; - return ( - -
    - - - -
    - - - - - - - - - - -
    - ); - } -} - -export default SymbolExample; diff --git a/examples/src/overlay/symbol/index.md b/examples/src/overlay/symbol/index.md deleted file mode 100644 index df7fad3..0000000 --- a/examples/src/overlay/symbol/index.md +++ /dev/null @@ -1,150 +0,0 @@ -import React, { Component } from 'react'; -import { Map, Symbol, SymbolShapeType } from 'rc-bmap'; -import { Button } from 'antd'; -import { getRandomColor, getRandomSymbolShape } from 'utils'; - -class SymbolExample extends Component { - constructor(props) { - super(props); - this.state = { - point: { - lng: 116.404, - lat: 39.915, - }, - path: SymbolShapeType.FORWARD_CLOSED_ARROW, - anchor: { - height: 10, - width: 50, - }, - fillColor: 'red', - fillOpacity: 0.8, - scale: 5, - rotation: 0, - strokeColor: 'blue', - strokeOpacity: 0.8, - strokeWeight: 1, - }; - } - - handlePoint = () => { - const { point } = this.state; - this.setState({ - point: { - lng: point.lng + 0.01, - lat: point.lat + 0.01, - }, - }); - } - - handlePath = () => { - const symbolShape = getRandomSymbolShape(); - this.setState({ - path: SymbolShapeType[symbolShape], - }); - } - - handleAnchor = () => { - const { anchor } = this.state; - this.setState({ - anchor: { - width: anchor.width + 5, - height: anchor.height + 5, - }, - }); - } - - handleFillColor = () => { - this.setState({ - fillColor: getRandomColor(), - }); - } - - handleFillOpacity = () => { - let { fillOpacity } = this.state; - if (fillOpacity >= 0.9) { - fillOpacity = 0.1; - } - this.setState({ - fillOpacity: fillOpacity + 0.1, - }); - } - - handleScale = () => { - const { scale } = this.state; - this.setState({ - scale: scale + 1, - }); - } - - handleRotation = () => { - const { rotation } = this.state; - this.setState({ - rotation: rotation + 10, - }); - } - - handleStrokeColor = () => { - this.setState({ - strokeColor: getRandomColor(), - }); - } - - handleStrokeWeight = () => { - const { strokeWeight } = this.state; - this.setState({ - strokeWeight: strokeWeight + 1, - }); - } - - handleStrokeOpacity = () => { - let { strokeOpacity } = this.state; - if (strokeOpacity >= 0.9) { - strokeOpacity = 0.1; - } - this.setState({ - strokeOpacity: strokeOpacity + 0.1, - }); - } - - render() { - const { - point, path, anchor, fillColor, fillOpacity, scale, - rotation, strokeColor, strokeOpacity, strokeWeight, - } = this.state; - return ( - -
    - - - -
    - - - - - - - - - - -
    - ); - } -} - -export default SymbolExample; diff --git a/examples/src/router.js b/examples/src/router.js deleted file mode 100644 index 25b0d76..0000000 --- a/examples/src/router.js +++ /dev/null @@ -1,81 +0,0 @@ -import React from 'react'; -import { - Route, - Switch, -} from 'react-router-dom'; - -import Navigation from './control/navigation/index'; -import Geolocation from './control/geolocation/index'; -import OverviewMap from './control/overviewMap/index'; -import Scale from './control/scale/index'; -import Panorama from './control/panorama/index'; -import Copyright from './control/copyright/index'; -import CityList from './control/cityList/index'; -import MapTypeCtrl from './control/mapTypeCtrl/index'; -import TransitRoute from './service/transitRoute/index'; -import DrivingRoute from './service/drivingRoute/index'; -import RidingRoute from './service/ridingRoute/index'; -import WalkingRoute from './service/walkingRoute/index'; -import LocalSearch from './service/localSearch/index'; -import BusLineSearch from './service/busLineSearch/index'; -import MarkerClusterer from './lib/markerClusterer/index'; -import CurveLine from './lib/curveLine/index'; -import DrawingManager from './lib/drawingManager/index'; -import Heatmap from './lib/heatmap/index'; -import TrafficControl from './lib/trafficControl/index'; -import DistanceTool from './lib/distanceTool/index'; -import Tile from './other/tile/index'; -import Boundary from './overlay/boundary/index'; -import Symbol from './overlay/symbol/index'; -import PointCollection from './overlay/pointCollection/index'; -import Ground from './overlay/ground/index'; -import Circle from './overlay/circle/index'; -import InfoWindow from './overlay/infoWindow/index'; -import Label from './overlay/label/index'; -import Marker from './overlay/marker/index'; -import Polygon from './overlay/polygon/index'; -import Polyline from './overlay/polyline/index'; -import AutoComplete from './other/autoComplete/index'; -import Map from './map/index'; - -const route = () => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -); - -export default route; diff --git a/examples/src/service/busLineSearch/index.js b/examples/src/service/busLineSearch/index.js deleted file mode 100644 index 9acc3f4..0000000 --- a/examples/src/service/busLineSearch/index.js +++ /dev/null @@ -1,88 +0,0 @@ -import React from 'react'; -import { - Map, - BusLineSearch, -} from 'rc-bmap'; -import Container from 'components/Container'; -import BusLine from './index.md'; - -class App extends React.Component { - constructor(props) { - super(props); - this.state = { - route: '', - }; - } - - getRoute = (instance) => { - this.state.route = instance; - console.log(instance); - }; - - mapMounted = () => { - const { route } = this.state; - route.getBusList(338); - }; - - onGetBusListComplete = (result) => { - const { route } = this.state; - if (result) { - // 获取第一个公交列表显示到map上 - const fstLine = result.getBusListItem(0); - route.getBusLine(fstLine); - } - } - - onGetBusLineComplete = (result) => { - console.log('onGetBusLineComplete'); - console.log(result); - } - - onBusListHtmlSet = (result) => { - console.log('onBusListHtmlSet'); - console.log(result); - } - - onBusLineHtmlSet = (result) => { - console.log('onBusLineHtmlSet'); - console.log(result); - } - - onBusLineHtmlSet = (result) => { - console.log('onBusLineHtmlSet'); - console.log(result); - } - - onPolylinesSet = (result) => { - console.log('onPolylinesSet'); - console.log(result); - } - - - render() { - return ( - -
    - - - -
    -
    - ); - } -} - -export default App; diff --git a/examples/src/service/busLineSearch/index.md b/examples/src/service/busLineSearch/index.md deleted file mode 100644 index d256b26..0000000 --- a/examples/src/service/busLineSearch/index.md +++ /dev/null @@ -1,86 +0,0 @@ -import React from 'react'; -import { - Map, - BusLineSearch, -} from 'rc-bmap'; - -class BusLineSearchExample extends React.Component { - constructor(props) { - super(props); - this.state = { - route: '', - }; - } - - getRoute = (instance) => { - this.state.route = instance; - console.log(instance); - }; - - mapMounted = () => { - const { route } = this.state; - route.getBusList(338); - }; - - onGetBusListComplete = (result) => { - const { route } = this.state; - if (result) { - // 获取第一个公交列表显示到map上 - const fstLine = result.getBusListItem(0); - route.getBusLine(fstLine); - } - } - - onGetBusLineComplete = (result) => { - console.log('onGetBusLineComplete'); - console.log(result); - } - - onBusListHtmlSet = (result) => { - console.log('onBusListHtmlSet'); - console.log(result); - } - - onBusLineHtmlSet = (result) => { - console.log('onBusLineHtmlSet'); - console.log(result); - } - - onBusLineHtmlSet = (result) => { - console.log('onBusLineHtmlSet'); - console.log(result); - } - - onPolylinesSet = (result) => { - console.log('onPolylinesSet'); - console.log(result); - } - - - render() { - return ( - -
    - - - -
    -
    - ); - } -} - -export default BusLineSearchExample; diff --git a/examples/src/service/drivingRoute/index.js b/examples/src/service/drivingRoute/index.js deleted file mode 100644 index 9dcc7e6..0000000 --- a/examples/src/service/drivingRoute/index.js +++ /dev/null @@ -1,79 +0,0 @@ -import React from 'react'; -import { - Map, - DrivingRoute, - DrivingPolicy, - getPoiByKeyword, - IntercityPolicy, -} from 'rc-bmap'; -import { Button } from 'antd'; -import Container from 'components/Container'; -import Driving from './index.md'; - -class App extends React.Component { - constructor(props) { - super(props); - this.state = { - route: '', - center: { - lng: 120.21937542, - lat: 30.25924446, - }, - policy: DrivingPolicy.NORMAL, - }; - } - - getRoute = (instance) => { - this.state.route = instance; - }; - - mapMounted = () => { - const { route } = this.state; - Promise.all( - [getPoiByKeyword('百度大厦'), getPoiByKeyword('北京邮电大学西门')], - ).then((res) => { - route.search(res[0], res[1]); - }); - }; - - handleCenter = () => { - this.setState({ - center: { - lng: 120.21937549, - lat: 30.25924440, - }, - }); - }; - - handlePolicy = () => { - this.setState({ - policy: IntercityPolicy.NORMAL, - }); - } - - render() { - const { center, policy } = this.state; - return ( - -
    - - - -
    - - -
    - ); - } -} - -export default App; diff --git a/examples/src/service/drivingRoute/index.md b/examples/src/service/drivingRoute/index.md deleted file mode 100644 index 0e6e597..0000000 --- a/examples/src/service/drivingRoute/index.md +++ /dev/null @@ -1,78 +0,0 @@ -import React from 'react'; -import { - Map, - DrivingRoute, - DrivingPolicy, - getPoiByKeyword, - IntercityPolicy, -} from 'rc-bmap'; -import { Button } from 'antd'; - -class DrivingRouteExample extends React.Component { - constructor(props) { - super(props); - this.state = { - route: '', - center: { - lng: 120.21937542, - lat: 30.25924446, - }, - policy: DrivingPolicy.NORMAL, - }; - } - - getRoute = (instance) => { - this.state.route = instance; - }; - - mapMounted = () => { - const { route } = this.state; - Promise.all( - [getPoiByKeyword('百度大厦'), getPoiByKeyword('北京邮电大学西门')], - ).then((res) => { - route.search(res[0], res[1]); - }); - }; - - handleCenter = () => { - this.setState({ - center: { - lng: 120.21937549, - lat: 30.25924440, - }, - }); - }; - - handlePolicy = () => { - this.setState({ - policy: IntercityPolicy.NORMAL, - }); - } - - - render() { - const { center, policy } = this.state; - return ( - -
    - - - -
    - - -
    - ); - } -} - -export default DrivingRouteExample; diff --git a/examples/src/service/localSearch/index.js b/examples/src/service/localSearch/index.js deleted file mode 100644 index e55e15a..0000000 --- a/examples/src/service/localSearch/index.js +++ /dev/null @@ -1,93 +0,0 @@ -import React from 'react'; -import { - Map, - getMapBounds, - LocalSearch, -} from 'rc-bmap'; -import { Button } from 'antd'; -import Container from 'components/Container'; -import Local from './index.md'; - -class App extends React.Component { - constructor(props) { - super(props); - this.state = { - route: '', - center: { - lng: 120.21937542, - lat: 30.25924446, - }, - pageCapacity: 5, - }; - } - - getRoute = (instance) => { - this.state.route = instance; - }; - - mapMounted = (map) => { - const { route } = this.state; - console.log(map); - route.searchInBounds(['酒店', '加油站'], getMapBounds()); - }; - - onInfoHtmlSet = (result) => { - console.log('onInfoHtmlSet'); - console.log(result); - } - - onResultsHtmlSet = (result) => { - console.log('onResultsHtmlSet'); - console.log(result); - } - - onSearchComplete = (result) => { - console.log('onSearchComplete'); - console.log(result); - } - - handleCenter = () => { - this.setState({ - center: { - lng: 120.21937549, - lat: 30.25924440, - }, - }); - }; - - handlePageCapacity = () => { - this.setState({ - pageCapacity: 20, - }); - } - - render() { - const { center, pageCapacity } = this.state; - return ( - -
    - - - -
    - - -
    - ); - } -} - -export default App; diff --git a/examples/src/service/localSearch/index.md b/examples/src/service/localSearch/index.md deleted file mode 100644 index e1629ae..0000000 --- a/examples/src/service/localSearch/index.md +++ /dev/null @@ -1,91 +0,0 @@ -import React from 'react'; -import { - Map, - getMapBounds, - LocalSearch, -} from 'rc-bmap'; -import { Button } from 'antd'; - -class LocalSearchExample extends React.Component { - constructor(props) { - super(props); - this.state = { - route: '', - center: { - lng: 120.21937542, - lat: 30.25924446, - }, - pageCapacity: 5, - }; - } - - getRoute = (instance) => { - this.state.route = instance; - }; - - mapMounted = (map) => { - const { route } = this.state; - console.log(map); - route.searchInBounds(['酒店', '加油站'], getMapBounds()); - }; - - onInfoHtmlSet = (result) => { - console.log('onInfoHtmlSet'); - console.log(result); - } - - onResultsHtmlSet = (result) => { - console.log('onResultsHtmlSet'); - console.log(result); - } - - onSearchComplete = (result) => { - console.log('onSearchComplete'); - console.log(result); - } - - handleCenter = () => { - this.setState({ - center: { - lng: 120.21937549, - lat: 30.25924440, - }, - }); - }; - - handlePageCapacity = () => { - this.setState({ - pageCapacity: 20, - }); - } - - render() { - const { center, pageCapacity } = this.state; - return ( - -
    - - - -
    - - -
    - ); - } -} - -export default LocalSearchExample; diff --git a/examples/src/service/ridingRoute/index.js b/examples/src/service/ridingRoute/index.js deleted file mode 100644 index e45c0db..0000000 --- a/examples/src/service/ridingRoute/index.js +++ /dev/null @@ -1,51 +0,0 @@ -import React from 'react'; -import { - Map, - getPoiByKeyword, - RidingRoute, -} from 'rc-bmap'; -import Container from 'components/Container'; -import Riding from './index.md'; - -class App extends React.Component { - constructor(props) { - super(props); - this.state = { - route: '', - }; - } - - getRoute = (instance) => { - this.state.route = instance; - }; - - mapMounted = () => { - const { route } = this.state; - Promise.all( - [getPoiByKeyword('百度大厦'), getPoiByKeyword('北京邮电大学西门')], - ).then((res) => { - route.search(res[0], res[1]); - }); - }; - - render() { - return ( - -
    - - - -
    -
    - ); - } -} - -export default App; diff --git a/examples/src/service/ridingRoute/index.md b/examples/src/service/ridingRoute/index.md deleted file mode 100644 index 7c59903..0000000 --- a/examples/src/service/ridingRoute/index.md +++ /dev/null @@ -1,51 +0,0 @@ -import React from 'react'; -import { - Map, - getPoiByKeyword, - RidingRoute, -} from 'rc-bmap'; -import Container from 'components/Container'; -import Riding from './index.md'; - -class App extends React.Component { - constructor(props) { - super(props); - this.state = { - route: '', - }; - } - - getRoute = (instance) => { - this.state.route = instance; - }; - - mapMounted = () => { - const { route } = this.state; - Promise.all( - [getPoiByKeyword('百度大厦'), getPoiByKeyword('北京邮电大学西门')], - ).then((res) => { - route.search(res[0], res[1]); - }); - }; - - render() { - return ( - -
    - - - -
    -
    - ); - } -} - -export default App; diff --git a/examples/src/service/transitRoute/index.js b/examples/src/service/transitRoute/index.js deleted file mode 100644 index 6793f82..0000000 --- a/examples/src/service/transitRoute/index.js +++ /dev/null @@ -1,67 +0,0 @@ -import React from 'react'; -import { - Map, - DrivingPolicy, - TransitPolicy, - getPoiByKeyword, - TransitRoute, -} from 'rc-bmap'; -import { Button } from 'antd'; -import Container from 'components/Container'; -import Transit from './index.md'; - -class App extends React.Component { - constructor(props) { - super(props); - this.state = { - route: '', - policy: DrivingPolicy.NORMAL, - // intercityPolicy: IntercityPolicy.NORMAL, - // transitTypePolicy: TransitTypePolicy.NORMAL, - }; - } - - getRoute = (instance) => { - this.state.route = instance; - }; - - mapMounted = () => { - const { route } = this.state; - Promise.all( - [getPoiByKeyword('百度大厦'), getPoiByKeyword('北京邮电大学西门')], - ).then((res) => { - route.search(res[0], res[1]); - }); - }; - - handlePolicy = () => { - this.setState({ - policy: TransitPolicy.NORMAL, - }); - } - - render() { - const { policy } = this.state; - return ( - -
    - - - -
    - -
    - ); - } -} - - -export default App; diff --git a/examples/src/service/transitRoute/index.md b/examples/src/service/transitRoute/index.md deleted file mode 100644 index 208636a..0000000 --- a/examples/src/service/transitRoute/index.md +++ /dev/null @@ -1,65 +0,0 @@ -import React from 'react'; -import { - Map, - DrivingPolicy, - TransitPolicy, - getPoiByKeyword, - TransitRoute, -} from 'rc-bmap'; -import { Button } from 'antd'; - -class TransitRouteExample extends React.Component { - constructor(props) { - super(props); - this.state = { - route: '', - policy: DrivingPolicy.NORMAL, - // intercityPolicy: IntercityPolicy.NORMAL, - // transitTypePolicy: TransitTypePolicy.NORMAL, - }; - } - - getRoute = (instance) => { - this.state.route = instance; - }; - - mapMounted = () => { - const { route } = this.state; - Promise.all( - [getPoiByKeyword('百度大厦'), getPoiByKeyword('北京邮电大学西门')], - ).then((res) => { - route.search(res[0], res[1]); - }); - }; - - handlePolicy = () => { - this.setState({ - policy: TransitPolicy.NORMAL, - }); - } - - render() { - const { policy } = this.state; - return ( - -
    - - - -
    - -
    - ); - } -} - - -export default TransitRouteExample; diff --git a/examples/src/service/walkingRoute/index.js b/examples/src/service/walkingRoute/index.js deleted file mode 100644 index 2475080..0000000 --- a/examples/src/service/walkingRoute/index.js +++ /dev/null @@ -1,51 +0,0 @@ -import React from 'react'; -import { - Map, - WalkingRoute, - getPoiByKeyword, -} from 'rc-bmap'; -import Container from 'components/Container'; -import Walking from './index.md'; - -class App extends React.Component { - constructor(props) { - super(props); - this.state = { - route: '', - }; - } - - getRoute = (instance) => { - this.state.route = instance; - }; - - mapMounted = () => { - const { route } = this.state; - Promise.all( - [getPoiByKeyword('百度大厦'), getPoiByKeyword('北京邮电大学西门')], - ).then((res) => { - route.search(res[0], res[1]); - }); - }; - - render() { - return ( - -
    - - - -
    -
    - ); - } -} -export default App; diff --git a/examples/src/service/walkingRoute/index.md b/examples/src/service/walkingRoute/index.md deleted file mode 100644 index 963493e..0000000 --- a/examples/src/service/walkingRoute/index.md +++ /dev/null @@ -1,49 +0,0 @@ -import React from 'react'; -import { - Map, - WalkingRoute, - getPoiByKeyword, -} from 'rc-bmap'; - -class WalkingRouteExample extends React.Component { - constructor(props) { - super(props); - this.state = { - route: '', - }; - } - - getRoute = (instance) => { - this.state.route = instance; - }; - - mapMounted = () => { - const { route } = this.state; - Promise.all( - [getPoiByKeyword('百度大厦'), getPoiByKeyword('北京邮电大学西门')], - ).then((res) => { - route.search(res[0], res[1]); - }); - }; - - render() { - return ( - -
    - - - -
    -
    - ); - } -} -export default WalkingRouteExample; diff --git a/examples/src/util/index.js b/examples/src/util/index.js deleted file mode 100644 index f1d9c2f..0000000 --- a/examples/src/util/index.js +++ /dev/null @@ -1,58 +0,0 @@ -function getRandomIndex(arr) { - return Math.floor((Math.random() * arr.length)); -} - -const randomColorArr = ['red', 'green', 'blue', 'orange', 'black', 'white']; -export function getRandomColor() { - return randomColorArr[getRandomIndex(randomColorArr)]; -} - -const randomBoundaryArr = ['北京市海淀区', '北京市朝阳区', '北京市昌平区', '北京市房山区', '北京市东城区', '北京市西城区']; -export function getRandomBoundary() { - return randomBoundaryArr[getRandomIndex(randomBoundaryArr)]; -} - -const randomSymbolShapeArr = [ - 'CIRCLE', - 'RECTANGLE', - 'RHOMBUS', - 'STAR', - 'BACKWARD_CLOSED_ARROW', - 'FORWARD_CLOSED_ARROW', - 'BACKWARD_OPEN_ARROW', - 'FORWARD_OPEN_ARROW', - 'POINT', - 'PLANE', - 'CAMERA', - 'WARNING', - 'SMILE', - 'CLOCK', -]; -export function getRandomSymbolShape() { - return randomSymbolShapeArr[getRandomIndex(randomSymbolShapeArr)]; -} - -const randomShapeArr = ['CIRCLE', 'STAR', 'SQUARE', 'RHOMBUS', 'WATERDROP']; -export function getRandomShape() { - return randomShapeArr[getRandomIndex(randomShapeArr)]; -} - -const randomControlAnchor = ['TOP_LEFT', 'TOP_RIGHT', 'BOTTOM_LEFT', 'BOTTOM_RIGHT']; -export function getRandomControlAnchor() { - return randomControlAnchor[getRandomIndex(randomControlAnchor)]; -} - -const randomNavigationType = ['LARGE', 'SMALL', 'PAN', 'ZOOM']; -export function getRandomNavigationType() { - return randomNavigationType[getRandomIndex(randomNavigationType)]; -} - -const randomMapType = ['NORMAL', 'PERSPECTIVE', 'SATELLITE', 'HYBRID']; -export function getRandomMapType() { - return randomMapType[getRandomIndex(randomMapType)]; -} - -const randomMapTypeControlType = ['HORIZONTAL', 'DROPDOWN', 'MAP']; -export function getRandomMapTypeControlType() { - return randomMapTypeControlType[getRandomIndex(randomMapTypeControlType)]; -} diff --git a/examples/yarn.lock b/examples/yarn.lock deleted file mode 100644 index cd91428..0000000 --- a/examples/yarn.lock +++ /dev/null @@ -1,6999 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@babel/code-frame@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "http://registry.npm.taobao.org/@babel/code-frame/download/@babel/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9" - dependencies: - "@babel/highlight" "7.0.0-beta.44" - -"@babel/generator@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "http://registry.npm.taobao.org/@babel/generator/download/@babel/generator-7.0.0-beta.44.tgz#c7e67b9b5284afcf69b309b50d7d37f3e5033d42" - dependencies: - "@babel/types" "7.0.0-beta.44" - jsesc "^2.5.1" - lodash "^4.2.0" - source-map "^0.5.0" - trim-right "^1.0.1" - -"@babel/helper-function-name@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "http://registry.npm.taobao.org/@babel/helper-function-name/download/@babel/helper-function-name-7.0.0-beta.44.tgz#e18552aaae2231100a6e485e03854bc3532d44dd" - dependencies: - "@babel/helper-get-function-arity" "7.0.0-beta.44" - "@babel/template" "7.0.0-beta.44" - "@babel/types" "7.0.0-beta.44" - -"@babel/helper-get-function-arity@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "http://registry.npm.taobao.org/@babel/helper-get-function-arity/download/@babel/helper-get-function-arity-7.0.0-beta.44.tgz#d03ca6dd2b9f7b0b1e6b32c56c72836140db3a15" - dependencies: - "@babel/types" "7.0.0-beta.44" - -"@babel/helper-module-imports@^7.0.0-beta.34": - version "7.0.0-rc.1" - resolved "http://registry.npm.taobao.org/@babel/helper-module-imports/download/@babel/helper-module-imports-7.0.0-rc.1.tgz#c6269fa9dc451152895f185f0339d45f32c52e75" - dependencies: - "@babel/types" "7.0.0-rc.1" - lodash "^4.17.10" - -"@babel/helper-split-export-declaration@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "http://registry.npm.taobao.org/@babel/helper-split-export-declaration/download/@babel/helper-split-export-declaration-7.0.0-beta.44.tgz#c0b351735e0fbcb3822c8ad8db4e583b05ebd9dc" - dependencies: - "@babel/types" "7.0.0-beta.44" - -"@babel/highlight@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "http://registry.npm.taobao.org/@babel/highlight/download/@babel/highlight-7.0.0-beta.44.tgz#18c94ce543916a80553edcdcf681890b200747d5" - dependencies: - chalk "^2.0.0" - esutils "^2.0.2" - js-tokens "^3.0.0" - -"@babel/template@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "http://registry.npm.taobao.org/@babel/template/download/@babel/template-7.0.0-beta.44.tgz#f8832f4fdcee5d59bf515e595fc5106c529b394f" - dependencies: - "@babel/code-frame" "7.0.0-beta.44" - "@babel/types" "7.0.0-beta.44" - babylon "7.0.0-beta.44" - lodash "^4.2.0" - -"@babel/traverse@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "http://registry.npm.taobao.org/@babel/traverse/download/@babel/traverse-7.0.0-beta.44.tgz#a970a2c45477ad18017e2e465a0606feee0d2966" - dependencies: - "@babel/code-frame" "7.0.0-beta.44" - "@babel/generator" "7.0.0-beta.44" - "@babel/helper-function-name" "7.0.0-beta.44" - "@babel/helper-split-export-declaration" "7.0.0-beta.44" - "@babel/types" "7.0.0-beta.44" - babylon "7.0.0-beta.44" - debug "^3.1.0" - globals "^11.1.0" - invariant "^2.2.0" - lodash "^4.2.0" - -"@babel/types@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "http://registry.npm.taobao.org/@babel/types/download/@babel/types-7.0.0-beta.44.tgz#6b1b164591f77dec0a0342aca995f2d046b3a757" - dependencies: - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^2.0.0" - -"@babel/types@7.0.0-rc.1": - version "7.0.0-rc.1" - resolved "http://registry.npm.taobao.org/@babel/types/download/@babel/types-7.0.0-rc.1.tgz#6abf6d14ddd9fc022617e5b62e6b32f4fa6526ad" - dependencies: - esutils "^2.0.2" - lodash "^4.17.10" - to-fast-properties "^2.0.0" - -"@webassemblyjs/ast@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/ast/download/@webassemblyjs/ast-1.5.13.tgz#81155a570bd5803a30ec31436bc2c9c0ede38f25" - dependencies: - "@webassemblyjs/helper-module-context" "1.5.13" - "@webassemblyjs/helper-wasm-bytecode" "1.5.13" - "@webassemblyjs/wast-parser" "1.5.13" - debug "^3.1.0" - mamacro "^0.0.3" - -"@webassemblyjs/floating-point-hex-parser@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/floating-point-hex-parser/download/@webassemblyjs/floating-point-hex-parser-1.5.13.tgz#29ce0baa97411f70e8cce68ce9c0f9d819a4e298" - -"@webassemblyjs/helper-api-error@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/helper-api-error/download/@webassemblyjs/helper-api-error-1.5.13.tgz#e49b051d67ee19a56e29b9aa8bd949b5b4442a59" - -"@webassemblyjs/helper-buffer@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/helper-buffer/download/@webassemblyjs/helper-buffer-1.5.13.tgz#873bb0a1b46449231137c1262ddfd05695195a1e" - dependencies: - debug "^3.1.0" - -"@webassemblyjs/helper-code-frame@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/helper-code-frame/download/@webassemblyjs/helper-code-frame-1.5.13.tgz#1bd2181b6a0be14e004f0fe9f5a660d265362b58" - dependencies: - "@webassemblyjs/wast-printer" "1.5.13" - -"@webassemblyjs/helper-fsm@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/helper-fsm/download/@webassemblyjs/helper-fsm-1.5.13.tgz#cdf3d9d33005d543a5c5e5adaabf679ffa8db924" - -"@webassemblyjs/helper-module-context@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/helper-module-context/download/@webassemblyjs/helper-module-context-1.5.13.tgz#dc29ddfb51ed657655286f94a5d72d8a489147c5" - dependencies: - debug "^3.1.0" - mamacro "^0.0.3" - -"@webassemblyjs/helper-wasm-bytecode@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/helper-wasm-bytecode/download/@webassemblyjs/helper-wasm-bytecode-1.5.13.tgz#03245817f0a762382e61733146f5773def15a747" - -"@webassemblyjs/helper-wasm-section@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/helper-wasm-section/download/@webassemblyjs/helper-wasm-section-1.5.13.tgz#efc76f44a10d3073b584b43c38a179df173d5c7d" - dependencies: - "@webassemblyjs/ast" "1.5.13" - "@webassemblyjs/helper-buffer" "1.5.13" - "@webassemblyjs/helper-wasm-bytecode" "1.5.13" - "@webassemblyjs/wasm-gen" "1.5.13" - debug "^3.1.0" - -"@webassemblyjs/ieee754@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/ieee754/download/@webassemblyjs/ieee754-1.5.13.tgz#573e97c8c12e4eebb316ca5fde0203ddd90b0364" - dependencies: - ieee754 "^1.1.11" - -"@webassemblyjs/leb128@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/leb128/download/@webassemblyjs/leb128-1.5.13.tgz#ab52ebab9cec283c1c1897ac1da833a04a3f4cee" - dependencies: - long "4.0.0" - -"@webassemblyjs/utf8@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/utf8/download/@webassemblyjs/utf8-1.5.13.tgz#6b53d2cd861cf94fa99c1f12779dde692fbc2469" - -"@webassemblyjs/wasm-edit@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/wasm-edit/download/@webassemblyjs/wasm-edit-1.5.13.tgz#c9cef5664c245cf11b3b3a73110c9155831724a8" - dependencies: - "@webassemblyjs/ast" "1.5.13" - "@webassemblyjs/helper-buffer" "1.5.13" - "@webassemblyjs/helper-wasm-bytecode" "1.5.13" - "@webassemblyjs/helper-wasm-section" "1.5.13" - "@webassemblyjs/wasm-gen" "1.5.13" - "@webassemblyjs/wasm-opt" "1.5.13" - "@webassemblyjs/wasm-parser" "1.5.13" - "@webassemblyjs/wast-printer" "1.5.13" - debug "^3.1.0" - -"@webassemblyjs/wasm-gen@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/wasm-gen/download/@webassemblyjs/wasm-gen-1.5.13.tgz#8e6ea113c4b432fa66540189e79b16d7a140700e" - dependencies: - "@webassemblyjs/ast" "1.5.13" - "@webassemblyjs/helper-wasm-bytecode" "1.5.13" - "@webassemblyjs/ieee754" "1.5.13" - "@webassemblyjs/leb128" "1.5.13" - "@webassemblyjs/utf8" "1.5.13" - -"@webassemblyjs/wasm-opt@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/wasm-opt/download/@webassemblyjs/wasm-opt-1.5.13.tgz#147aad7717a7ee4211c36b21a5f4c30dddf33138" - dependencies: - "@webassemblyjs/ast" "1.5.13" - "@webassemblyjs/helper-buffer" "1.5.13" - "@webassemblyjs/wasm-gen" "1.5.13" - "@webassemblyjs/wasm-parser" "1.5.13" - debug "^3.1.0" - -"@webassemblyjs/wasm-parser@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/wasm-parser/download/@webassemblyjs/wasm-parser-1.5.13.tgz#6f46516c5bb23904fbdf58009233c2dd8a54c72f" - dependencies: - "@webassemblyjs/ast" "1.5.13" - "@webassemblyjs/helper-api-error" "1.5.13" - "@webassemblyjs/helper-wasm-bytecode" "1.5.13" - "@webassemblyjs/ieee754" "1.5.13" - "@webassemblyjs/leb128" "1.5.13" - "@webassemblyjs/utf8" "1.5.13" - -"@webassemblyjs/wast-parser@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/wast-parser/download/@webassemblyjs/wast-parser-1.5.13.tgz#5727a705d397ae6a3ae99d7f5460acf2ec646eea" - dependencies: - "@webassemblyjs/ast" "1.5.13" - "@webassemblyjs/floating-point-hex-parser" "1.5.13" - "@webassemblyjs/helper-api-error" "1.5.13" - "@webassemblyjs/helper-code-frame" "1.5.13" - "@webassemblyjs/helper-fsm" "1.5.13" - long "^3.2.0" - mamacro "^0.0.3" - -"@webassemblyjs/wast-printer@1.5.13": - version "1.5.13" - resolved "http://registry.npm.taobao.org/@webassemblyjs/wast-printer/download/@webassemblyjs/wast-printer-1.5.13.tgz#bb34d528c14b4f579e7ec11e793ec50ad7cd7c95" - dependencies: - "@webassemblyjs/ast" "1.5.13" - "@webassemblyjs/wast-parser" "1.5.13" - long "^3.2.0" - -"@webpack-contrib/schema-utils@^1.0.0-beta.0": - version "1.0.0-beta.0" - resolved "http://registry.npm.taobao.org/@webpack-contrib/schema-utils/download/@webpack-contrib/schema-utils-1.0.0-beta.0.tgz#bf9638c9464d177b48209e84209e23bee2eb4f65" - dependencies: - ajv "^6.1.0" - ajv-keywords "^3.1.0" - chalk "^2.3.2" - strip-ansi "^4.0.0" - text-table "^0.2.0" - webpack-log "^1.1.2" - -abbrev@1: - version "1.1.1" - resolved "http://registry.npm.taobao.org/abbrev/download/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" - -accepts@~1.3.4, accepts@~1.3.5: - version "1.3.5" - resolved "http://registry.npm.taobao.org/accepts/download/accepts-1.3.5.tgz#eb777df6011723a3b14e8a72c0805c8e86746bd2" - dependencies: - mime-types "~2.1.18" - negotiator "0.6.1" - -acorn-dynamic-import@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/acorn-dynamic-import/download/acorn-dynamic-import-3.0.0.tgz#901ceee4c7faaef7e07ad2a47e890675da50a278" - dependencies: - acorn "^5.0.0" - -acorn-jsx@^3.0.0: - version "3.0.1" - resolved "http://registry.npm.taobao.org/acorn-jsx/download/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" - dependencies: - acorn "^3.0.4" - -acorn@^3.0.4: - version "3.3.0" - resolved "http://registry.npm.taobao.org/acorn/download/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" - -acorn@^5.0.0, acorn@^5.3.0, acorn@^5.5.0, acorn@^5.6.2: - version "5.7.1" - resolved "http://registry.npm.taobao.org/acorn/download/acorn-5.7.1.tgz#f095829297706a7c9776958c0afc8930a9b9d9d8" - -add-dom-event-listener@1.x: - version "1.0.2" - resolved "http://registry.npm.taobao.org/add-dom-event-listener/download/add-dom-event-listener-1.0.2.tgz#8faed2c41008721cf111da1d30d995b85be42bed" - dependencies: - object-assign "4.x" - -ajv-keywords@^2.1.0: - version "2.1.1" - resolved "http://registry.npm.taobao.org/ajv-keywords/download/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" - -ajv-keywords@^3.1.0: - version "3.2.0" - resolved "http://registry.npm.taobao.org/ajv-keywords/download/ajv-keywords-3.2.0.tgz#e86b819c602cf8821ad637413698f1dec021847a" - -ajv@^5.2.3, ajv@^5.3.0: - version "5.5.2" - resolved "http://registry.npm.taobao.org/ajv/download/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" - dependencies: - co "^4.6.0" - fast-deep-equal "^1.0.0" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.3.0" - -ajv@^6.1.0: - version "6.5.2" - resolved "http://registry.npm.taobao.org/ajv/download/ajv-6.5.2.tgz#678495f9b82f7cca6be248dd92f59bff5e1f4360" - dependencies: - fast-deep-equal "^2.0.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.1" - -alphanum-sort@^1.0.0: - version "1.0.2" - resolved "http://registry.npm.taobao.org/alphanum-sort/download/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3" - -ansi-escapes@^3.0.0: - version "3.1.0" - resolved "http://registry.npm.taobao.org/ansi-escapes/download/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" - -ansi-html@0.0.7: - version "0.0.7" - resolved "http://registry.npm.taobao.org/ansi-html/download/ansi-html-0.0.7.tgz#813584021962a9e9e6fd039f940d12f56ca7859e" - -ansi-regex@^2.0.0: - version "2.1.1" - resolved "http://registry.npm.taobao.org/ansi-regex/download/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - -ansi-regex@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/ansi-regex/download/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" - -ansi-styles@^2.2.1: - version "2.2.1" - resolved "http://registry.npm.taobao.org/ansi-styles/download/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" - -ansi-styles@^3.2.1: - version "3.2.1" - resolved "http://registry.npm.taobao.org/ansi-styles/download/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - dependencies: - color-convert "^1.9.0" - -antd@^3.8.1: - version "3.8.1" - resolved "http://registry.npm.taobao.org/antd/download/antd-3.8.1.tgz#1780acd5e9bc6c80dc23b042161418eb88f4d80e" - dependencies: - array-tree-filter "^2.0.0" - babel-runtime "6.x" - classnames "~2.2.0" - create-react-class "^15.6.0" - create-react-context "^0.2.2" - css-animation "^1.2.5" - dom-closest "^0.2.0" - enquire.js "^2.1.1" - intersperse "^1.0.0" - lodash "^4.17.5" - moment "^2.19.3" - omit.js "^1.0.0" - prop-types "^15.5.7" - raf "^3.4.0" - rc-animate "^2.4.1" - rc-calendar "~9.6.0" - rc-cascader "~0.14.0" - rc-checkbox "~2.1.5" - rc-collapse "~1.9.0" - rc-dialog "~7.2.0" - rc-drawer "~1.6.2" - rc-dropdown "~2.2.0" - rc-editor-mention "^1.0.2" - rc-form "^2.1.0" - rc-input-number "~4.0.0" - rc-menu "~7.0.2" - rc-notification "~3.2.0" - rc-pagination "~1.16.1" - rc-progress "~2.2.2" - rc-rate "~2.4.0" - rc-select "~8.1.1" - rc-slider "~8.6.0" - rc-steps "~3.1.0" - rc-switch "~1.6.0" - rc-table "~6.2.0" - rc-tabs "~9.3.3" - rc-time-picker "~3.3.0" - rc-tooltip "~3.7.0" - rc-tree "~1.13.0" - rc-tree-select "~2.0.5" - rc-trigger "^2.5.4" - rc-upload "~2.5.0" - rc-util "^4.0.4" - react-lazy-load "^3.0.12" - react-lifecycles-compat "^3.0.2" - react-slick "~0.23.1" - shallowequal "^1.0.1" - warning "~4.0.1" - -anymatch@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/anymatch/download/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" - dependencies: - micromatch "^3.1.4" - normalize-path "^2.1.1" - -aproba@^1.0.3, aproba@^1.1.1: - version "1.2.0" - resolved "http://registry.npm.taobao.org/aproba/download/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" - -are-we-there-yet@~1.1.2: - version "1.1.5" - resolved "http://registry.npm.taobao.org/are-we-there-yet/download/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" - dependencies: - delegates "^1.0.0" - readable-stream "^2.0.6" - -argparse@^1.0.7: - version "1.0.10" - resolved "http://registry.npm.taobao.org/argparse/download/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - dependencies: - sprintf-js "~1.0.2" - -aria-query@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/aria-query/download/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc" - dependencies: - ast-types-flow "0.0.7" - commander "^2.11.0" - -arr-diff@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/arr-diff/download/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" - -arr-flatten@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/arr-flatten/download/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" - -arr-union@^3.1.0: - version "3.1.0" - resolved "http://registry.npm.taobao.org/arr-union/download/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" - -array-find-index@^1.0.1: - version "1.0.2" - resolved "http://registry.npm.taobao.org/array-find-index/download/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" - -array-flatten@1.1.1: - version "1.1.1" - resolved "http://registry.npm.taobao.org/array-flatten/download/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" - -array-flatten@^2.1.0: - version "2.1.1" - resolved "http://registry.npm.taobao.org/array-flatten/download/array-flatten-2.1.1.tgz#426bb9da84090c1838d812c8150af20a8331e296" - -array-includes@^3.0.3: - version "3.0.3" - resolved "http://registry.npm.taobao.org/array-includes/download/array-includes-3.0.3.tgz#184b48f62d92d7452bb31b323165c7f8bd02266d" - dependencies: - define-properties "^1.1.2" - es-abstract "^1.7.0" - -array-tree-filter@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.taobao.org/array-tree-filter/download/array-tree-filter-1.0.1.tgz#0a8ad1eefd38ce88858632f9cc0423d7634e4d5d" - -array-tree-filter@^2.0.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/array-tree-filter/download/array-tree-filter-2.1.0.tgz#873ac00fec83749f255ac8dd083814b4f6329190" - -array-union@^1.0.1: - version "1.0.2" - resolved "http://registry.npm.taobao.org/array-union/download/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" - dependencies: - array-uniq "^1.0.1" - -array-uniq@^1.0.1: - version "1.0.3" - resolved "http://registry.npm.taobao.org/array-uniq/download/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" - -array-unique@^0.3.2: - version "0.3.2" - resolved "http://registry.npm.taobao.org/array-unique/download/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" - -arrify@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.taobao.org/arrify/download/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" - -asap@~2.0.3: - version "2.0.6" - resolved "http://registry.npm.taobao.org/asap/download/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" - -asn1.js@^4.0.0: - version "4.10.1" - resolved "http://registry.npm.taobao.org/asn1.js/download/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0" - dependencies: - bn.js "^4.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - -assert@^1.1.1: - version "1.4.1" - resolved "http://registry.npm.taobao.org/assert/download/assert-1.4.1.tgz#99912d591836b5a6f5b345c0f07eefc08fc65d91" - dependencies: - util "0.10.3" - -assign-symbols@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/assign-symbols/download/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" - -ast-types-flow@0.0.7, ast-types-flow@^0.0.7: - version "0.0.7" - resolved "http://registry.npm.taobao.org/ast-types-flow/download/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" - -async-each@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.taobao.org/async-each/download/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" - -async-limiter@~1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/async-limiter/download/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" - -async-validator@1.x: - version "1.8.5" - resolved "http://registry.npm.taobao.org/async-validator/download/async-validator-1.8.5.tgz#dc3e08ec1fd0dddb67e60842f02c0cd1cec6d7f0" - dependencies: - babel-runtime "6.x" - -async@^1.5.2: - version "1.5.2" - resolved "http://registry.npm.taobao.org/async/download/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" - -atob@^2.1.1: - version "2.1.1" - resolved "http://registry.npm.taobao.org/atob/download/atob-2.1.1.tgz#ae2d5a729477f289d60dd7f96a6314a22dd6c22a" - -axobject-query@^2.0.1: - version "2.0.1" - resolved "http://registry.npm.taobao.org/axobject-query/download/axobject-query-2.0.1.tgz#05dfa705ada8ad9db993fa6896f22d395b0b0a07" - dependencies: - ast-types-flow "0.0.7" - -babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: - version "6.26.0" - resolved "http://registry.npm.taobao.org/babel-code-frame/download/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" - dependencies: - chalk "^1.1.3" - esutils "^2.0.2" - js-tokens "^3.0.2" - -babel-core@^6.26.0, babel-core@^6.26.3: - version "6.26.3" - resolved "http://registry.npm.taobao.org/babel-core/download/babel-core-6.26.3.tgz#b2e2f09e342d0f0c88e2f02e067794125e75c207" - dependencies: - babel-code-frame "^6.26.0" - babel-generator "^6.26.0" - babel-helpers "^6.24.1" - babel-messages "^6.23.0" - babel-register "^6.26.0" - babel-runtime "^6.26.0" - babel-template "^6.26.0" - babel-traverse "^6.26.0" - babel-types "^6.26.0" - babylon "^6.18.0" - convert-source-map "^1.5.1" - debug "^2.6.9" - json5 "^0.5.1" - lodash "^4.17.4" - minimatch "^3.0.4" - path-is-absolute "^1.0.1" - private "^0.1.8" - slash "^1.0.0" - source-map "^0.5.7" - -babel-eslint@^8.2.6: - version "8.2.6" - resolved "http://registry.npm.taobao.org/babel-eslint/download/babel-eslint-8.2.6.tgz#6270d0c73205628067c0f7ae1693a9e797acefd9" - dependencies: - "@babel/code-frame" "7.0.0-beta.44" - "@babel/traverse" "7.0.0-beta.44" - "@babel/types" "7.0.0-beta.44" - babylon "7.0.0-beta.44" - eslint-scope "3.7.1" - eslint-visitor-keys "^1.0.0" - -babel-generator@^6.26.0: - version "6.26.1" - resolved "http://registry.npm.taobao.org/babel-generator/download/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90" - dependencies: - babel-messages "^6.23.0" - babel-runtime "^6.26.0" - babel-types "^6.26.0" - detect-indent "^4.0.0" - jsesc "^1.3.0" - lodash "^4.17.4" - source-map "^0.5.7" - trim-right "^1.0.1" - -babel-helper-builder-binary-assignment-operator-visitor@^6.24.1: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-helper-builder-binary-assignment-operator-visitor/download/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz#cce4517ada356f4220bcae8a02c2b346f9a56664" - dependencies: - babel-helper-explode-assignable-expression "^6.24.1" - babel-runtime "^6.22.0" - babel-types "^6.24.1" - -babel-helper-builder-react-jsx@^6.24.1: - version "6.26.0" - resolved "http://registry.npm.taobao.org/babel-helper-builder-react-jsx/download/babel-helper-builder-react-jsx-6.26.0.tgz#39ff8313b75c8b65dceff1f31d383e0ff2a408a0" - dependencies: - babel-runtime "^6.26.0" - babel-types "^6.26.0" - esutils "^2.0.2" - -babel-helper-call-delegate@^6.24.1: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-helper-call-delegate/download/babel-helper-call-delegate-6.24.1.tgz#ece6aacddc76e41c3461f88bfc575bd0daa2df8d" - dependencies: - babel-helper-hoist-variables "^6.24.1" - babel-runtime "^6.22.0" - babel-traverse "^6.24.1" - babel-types "^6.24.1" - -babel-helper-define-map@^6.24.1: - version "6.26.0" - resolved "http://registry.npm.taobao.org/babel-helper-define-map/download/babel-helper-define-map-6.26.0.tgz#a5f56dab41a25f97ecb498c7ebaca9819f95be5f" - dependencies: - babel-helper-function-name "^6.24.1" - babel-runtime "^6.26.0" - babel-types "^6.26.0" - lodash "^4.17.4" - -babel-helper-explode-assignable-expression@^6.24.1: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-helper-explode-assignable-expression/download/babel-helper-explode-assignable-expression-6.24.1.tgz#f25b82cf7dc10433c55f70592d5746400ac22caa" - dependencies: - babel-runtime "^6.22.0" - babel-traverse "^6.24.1" - babel-types "^6.24.1" - -babel-helper-function-name@^6.24.1: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-helper-function-name/download/babel-helper-function-name-6.24.1.tgz#d3475b8c03ed98242a25b48351ab18399d3580a9" - dependencies: - babel-helper-get-function-arity "^6.24.1" - babel-runtime "^6.22.0" - babel-template "^6.24.1" - babel-traverse "^6.24.1" - babel-types "^6.24.1" - -babel-helper-get-function-arity@^6.24.1: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-helper-get-function-arity/download/babel-helper-get-function-arity-6.24.1.tgz#8f7782aa93407c41d3aa50908f89b031b1b6853d" - dependencies: - babel-runtime "^6.22.0" - babel-types "^6.24.1" - -babel-helper-hoist-variables@^6.24.1: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-helper-hoist-variables/download/babel-helper-hoist-variables-6.24.1.tgz#1ecb27689c9d25513eadbc9914a73f5408be7a76" - dependencies: - babel-runtime "^6.22.0" - babel-types "^6.24.1" - -babel-helper-optimise-call-expression@^6.24.1: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-helper-optimise-call-expression/download/babel-helper-optimise-call-expression-6.24.1.tgz#f7a13427ba9f73f8f4fa993c54a97882d1244257" - dependencies: - babel-runtime "^6.22.0" - babel-types "^6.24.1" - -babel-helper-regex@^6.24.1: - version "6.26.0" - resolved "http://registry.npm.taobao.org/babel-helper-regex/download/babel-helper-regex-6.26.0.tgz#325c59f902f82f24b74faceed0363954f6495e72" - dependencies: - babel-runtime "^6.26.0" - babel-types "^6.26.0" - lodash "^4.17.4" - -babel-helper-remap-async-to-generator@^6.24.1: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-helper-remap-async-to-generator/download/babel-helper-remap-async-to-generator-6.24.1.tgz#5ec581827ad723fecdd381f1c928390676e4551b" - dependencies: - babel-helper-function-name "^6.24.1" - babel-runtime "^6.22.0" - babel-template "^6.24.1" - babel-traverse "^6.24.1" - babel-types "^6.24.1" - -babel-helper-replace-supers@^6.24.1: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-helper-replace-supers/download/babel-helper-replace-supers-6.24.1.tgz#bf6dbfe43938d17369a213ca8a8bf74b6a90ab1a" - dependencies: - babel-helper-optimise-call-expression "^6.24.1" - babel-messages "^6.23.0" - babel-runtime "^6.22.0" - babel-template "^6.24.1" - babel-traverse "^6.24.1" - babel-types "^6.24.1" - -babel-helpers@^6.24.1: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-helpers/download/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2" - dependencies: - babel-runtime "^6.22.0" - babel-template "^6.24.1" - -babel-loader@^7.1.5: - version "7.1.5" - resolved "http://registry.npm.taobao.org/babel-loader/download/babel-loader-7.1.5.tgz#e3ee0cd7394aa557e013b02d3e492bfd07aa6d68" - dependencies: - find-cache-dir "^1.0.0" - loader-utils "^1.0.2" - mkdirp "^0.5.1" - -babel-messages@^6.23.0: - version "6.23.0" - resolved "http://registry.npm.taobao.org/babel-messages/download/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-check-es2015-constants@^6.22.0: - version "6.22.0" - resolved "http://registry.npm.taobao.org/babel-plugin-check-es2015-constants/download/babel-plugin-check-es2015-constants-6.22.0.tgz#35157b101426fd2ffd3da3f75c7d1e91835bbf8a" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-import@^1.8.0: - version "1.8.0" - resolved "http://registry.npm.taobao.org/babel-plugin-import/download/babel-plugin-import-1.8.0.tgz#260deddd78f6fea0d110e1d106ba72a518d3c88c" - dependencies: - "@babel/helper-module-imports" "^7.0.0-beta.34" - -babel-plugin-syntax-async-functions@^6.8.0: - version "6.13.0" - resolved "http://registry.npm.taobao.org/babel-plugin-syntax-async-functions/download/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95" - -babel-plugin-syntax-class-properties@^6.8.0: - version "6.13.0" - resolved "http://registry.npm.taobao.org/babel-plugin-syntax-class-properties/download/babel-plugin-syntax-class-properties-6.13.0.tgz#d7eb23b79a317f8543962c505b827c7d6cac27de" - -babel-plugin-syntax-exponentiation-operator@^6.8.0: - version "6.13.0" - resolved "http://registry.npm.taobao.org/babel-plugin-syntax-exponentiation-operator/download/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz#9ee7e8337290da95288201a6a57f4170317830de" - -babel-plugin-syntax-flow@^6.18.0: - version "6.18.0" - resolved "http://registry.npm.taobao.org/babel-plugin-syntax-flow/download/babel-plugin-syntax-flow-6.18.0.tgz#4c3ab20a2af26aa20cd25995c398c4eb70310c8d" - -babel-plugin-syntax-jsx@^6.3.13, babel-plugin-syntax-jsx@^6.8.0: - version "6.18.0" - resolved "http://registry.npm.taobao.org/babel-plugin-syntax-jsx/download/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946" - -babel-plugin-syntax-trailing-function-commas@^6.22.0: - version "6.22.0" - resolved "http://registry.npm.taobao.org/babel-plugin-syntax-trailing-function-commas/download/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3" - -babel-plugin-transform-async-to-generator@^6.22.0: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-async-to-generator/download/babel-plugin-transform-async-to-generator-6.24.1.tgz#6536e378aff6cb1d5517ac0e40eb3e9fc8d08761" - dependencies: - babel-helper-remap-async-to-generator "^6.24.1" - babel-plugin-syntax-async-functions "^6.8.0" - babel-runtime "^6.22.0" - -babel-plugin-transform-class-properties@^6.24.1: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-class-properties/download/babel-plugin-transform-class-properties-6.24.1.tgz#6a79763ea61d33d36f37b611aa9def81a81b46ac" - dependencies: - babel-helper-function-name "^6.24.1" - babel-plugin-syntax-class-properties "^6.8.0" - babel-runtime "^6.22.0" - babel-template "^6.24.1" - -babel-plugin-transform-es2015-arrow-functions@^6.22.0: - version "6.22.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-arrow-functions/download/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz#452692cb711d5f79dc7f85e440ce41b9f244d221" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-block-scoped-functions@^6.22.0: - version "6.22.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-block-scoped-functions/download/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz#bbc51b49f964d70cb8d8e0b94e820246ce3a6141" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-block-scoping@^6.23.0: - version "6.26.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-block-scoping/download/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz#d70f5299c1308d05c12f463813b0a09e73b1895f" - dependencies: - babel-runtime "^6.26.0" - babel-template "^6.26.0" - babel-traverse "^6.26.0" - babel-types "^6.26.0" - lodash "^4.17.4" - -babel-plugin-transform-es2015-classes@^6.23.0: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-classes/download/babel-plugin-transform-es2015-classes-6.24.1.tgz#5a4c58a50c9c9461e564b4b2a3bfabc97a2584db" - dependencies: - babel-helper-define-map "^6.24.1" - babel-helper-function-name "^6.24.1" - babel-helper-optimise-call-expression "^6.24.1" - babel-helper-replace-supers "^6.24.1" - babel-messages "^6.23.0" - babel-runtime "^6.22.0" - babel-template "^6.24.1" - babel-traverse "^6.24.1" - babel-types "^6.24.1" - -babel-plugin-transform-es2015-computed-properties@^6.22.0: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-computed-properties/download/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz#6fe2a8d16895d5634f4cd999b6d3480a308159b3" - dependencies: - babel-runtime "^6.22.0" - babel-template "^6.24.1" - -babel-plugin-transform-es2015-destructuring@^6.23.0: - version "6.23.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-destructuring/download/babel-plugin-transform-es2015-destructuring-6.23.0.tgz#997bb1f1ab967f682d2b0876fe358d60e765c56d" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-duplicate-keys@^6.22.0: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-duplicate-keys/download/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz#73eb3d310ca969e3ef9ec91c53741a6f1576423e" - dependencies: - babel-runtime "^6.22.0" - babel-types "^6.24.1" - -babel-plugin-transform-es2015-for-of@^6.23.0: - version "6.23.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-for-of/download/babel-plugin-transform-es2015-for-of-6.23.0.tgz#f47c95b2b613df1d3ecc2fdb7573623c75248691" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-function-name@^6.22.0: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-function-name/download/babel-plugin-transform-es2015-function-name-6.24.1.tgz#834c89853bc36b1af0f3a4c5dbaa94fd8eacaa8b" - dependencies: - babel-helper-function-name "^6.24.1" - babel-runtime "^6.22.0" - babel-types "^6.24.1" - -babel-plugin-transform-es2015-literals@^6.22.0: - version "6.22.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-literals/download/babel-plugin-transform-es2015-literals-6.22.0.tgz#4f54a02d6cd66cf915280019a31d31925377ca2e" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-modules-amd@^6.22.0, babel-plugin-transform-es2015-modules-amd@^6.24.1: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-modules-amd/download/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz#3b3e54017239842d6d19c3011c4bd2f00a00d154" - dependencies: - babel-plugin-transform-es2015-modules-commonjs "^6.24.1" - babel-runtime "^6.22.0" - babel-template "^6.24.1" - -babel-plugin-transform-es2015-modules-commonjs@^6.23.0, babel-plugin-transform-es2015-modules-commonjs@^6.24.1: - version "6.26.2" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-modules-commonjs/download/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz#58a793863a9e7ca870bdc5a881117ffac27db6f3" - dependencies: - babel-plugin-transform-strict-mode "^6.24.1" - babel-runtime "^6.26.0" - babel-template "^6.26.0" - babel-types "^6.26.0" - -babel-plugin-transform-es2015-modules-systemjs@^6.23.0: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-modules-systemjs/download/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz#ff89a142b9119a906195f5f106ecf305d9407d23" - dependencies: - babel-helper-hoist-variables "^6.24.1" - babel-runtime "^6.22.0" - babel-template "^6.24.1" - -babel-plugin-transform-es2015-modules-umd@^6.23.0: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-modules-umd/download/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz#ac997e6285cd18ed6176adb607d602344ad38468" - dependencies: - babel-plugin-transform-es2015-modules-amd "^6.24.1" - babel-runtime "^6.22.0" - babel-template "^6.24.1" - -babel-plugin-transform-es2015-object-super@^6.22.0: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-object-super/download/babel-plugin-transform-es2015-object-super-6.24.1.tgz#24cef69ae21cb83a7f8603dad021f572eb278f8d" - dependencies: - babel-helper-replace-supers "^6.24.1" - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-parameters@^6.23.0: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-parameters/download/babel-plugin-transform-es2015-parameters-6.24.1.tgz#57ac351ab49caf14a97cd13b09f66fdf0a625f2b" - dependencies: - babel-helper-call-delegate "^6.24.1" - babel-helper-get-function-arity "^6.24.1" - babel-runtime "^6.22.0" - babel-template "^6.24.1" - babel-traverse "^6.24.1" - babel-types "^6.24.1" - -babel-plugin-transform-es2015-shorthand-properties@^6.22.0: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-shorthand-properties/download/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz#24f875d6721c87661bbd99a4622e51f14de38aa0" - dependencies: - babel-runtime "^6.22.0" - babel-types "^6.24.1" - -babel-plugin-transform-es2015-spread@^6.22.0: - version "6.22.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-spread/download/babel-plugin-transform-es2015-spread-6.22.0.tgz#d6d68a99f89aedc4536c81a542e8dd9f1746f8d1" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-sticky-regex@^6.22.0: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-sticky-regex/download/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz#00c1cdb1aca71112cdf0cf6126c2ed6b457ccdbc" - dependencies: - babel-helper-regex "^6.24.1" - babel-runtime "^6.22.0" - babel-types "^6.24.1" - -babel-plugin-transform-es2015-template-literals@^6.22.0: - version "6.22.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-template-literals/download/babel-plugin-transform-es2015-template-literals-6.22.0.tgz#a84b3450f7e9f8f1f6839d6d687da84bb1236d8d" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-typeof-symbol@^6.23.0: - version "6.23.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-typeof-symbol/download/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz#dec09f1cddff94b52ac73d505c84df59dcceb372" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-unicode-regex@^6.22.0: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-es2015-unicode-regex/download/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz#d38b12f42ea7323f729387f18a7c5ae1faeb35e9" - dependencies: - babel-helper-regex "^6.24.1" - babel-runtime "^6.22.0" - regexpu-core "^2.0.0" - -babel-plugin-transform-exponentiation-operator@^6.22.0: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-exponentiation-operator/download/babel-plugin-transform-exponentiation-operator-6.24.1.tgz#2ab0c9c7f3098fa48907772bb813fe41e8de3a0e" - dependencies: - babel-helper-builder-binary-assignment-operator-visitor "^6.24.1" - babel-plugin-syntax-exponentiation-operator "^6.8.0" - babel-runtime "^6.22.0" - -babel-plugin-transform-flow-strip-types@^6.22.0: - version "6.22.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-flow-strip-types/download/babel-plugin-transform-flow-strip-types-6.22.0.tgz#84cb672935d43714fdc32bce84568d87441cf7cf" - dependencies: - babel-plugin-syntax-flow "^6.18.0" - babel-runtime "^6.22.0" - -babel-plugin-transform-react-display-name@^6.23.0: - version "6.25.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-react-display-name/download/babel-plugin-transform-react-display-name-6.25.0.tgz#67e2bf1f1e9c93ab08db96792e05392bf2cc28d1" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-react-jsx-self@^6.22.0: - version "6.22.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-react-jsx-self/download/babel-plugin-transform-react-jsx-self-6.22.0.tgz#df6d80a9da2612a121e6ddd7558bcbecf06e636e" - dependencies: - babel-plugin-syntax-jsx "^6.8.0" - babel-runtime "^6.22.0" - -babel-plugin-transform-react-jsx-source@^6.22.0: - version "6.22.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-react-jsx-source/download/babel-plugin-transform-react-jsx-source-6.22.0.tgz#66ac12153f5cd2d17b3c19268f4bf0197f44ecd6" - dependencies: - babel-plugin-syntax-jsx "^6.8.0" - babel-runtime "^6.22.0" - -babel-plugin-transform-react-jsx@^6.24.1: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-react-jsx/download/babel-plugin-transform-react-jsx-6.24.1.tgz#840a028e7df460dfc3a2d29f0c0d91f6376e66a3" - dependencies: - babel-helper-builder-react-jsx "^6.24.1" - babel-plugin-syntax-jsx "^6.8.0" - babel-runtime "^6.22.0" - -babel-plugin-transform-regenerator@^6.22.0: - version "6.26.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-regenerator/download/babel-plugin-transform-regenerator-6.26.0.tgz#e0703696fbde27f0a3efcacf8b4dca2f7b3a8f2f" - dependencies: - regenerator-transform "^0.10.0" - -babel-plugin-transform-runtime@^6.23.0: - version "6.23.0" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-runtime/download/babel-plugin-transform-runtime-6.23.0.tgz#88490d446502ea9b8e7efb0fe09ec4d99479b1ee" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-strict-mode@^6.24.1: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-plugin-transform-strict-mode/download/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758" - dependencies: - babel-runtime "^6.22.0" - babel-types "^6.24.1" - -babel-preset-env@^1.7.0: - version "1.7.0" - resolved "http://registry.npm.taobao.org/babel-preset-env/download/babel-preset-env-1.7.0.tgz#dea79fa4ebeb883cd35dab07e260c1c9c04df77a" - dependencies: - babel-plugin-check-es2015-constants "^6.22.0" - babel-plugin-syntax-trailing-function-commas "^6.22.0" - babel-plugin-transform-async-to-generator "^6.22.0" - babel-plugin-transform-es2015-arrow-functions "^6.22.0" - babel-plugin-transform-es2015-block-scoped-functions "^6.22.0" - babel-plugin-transform-es2015-block-scoping "^6.23.0" - babel-plugin-transform-es2015-classes "^6.23.0" - babel-plugin-transform-es2015-computed-properties "^6.22.0" - babel-plugin-transform-es2015-destructuring "^6.23.0" - babel-plugin-transform-es2015-duplicate-keys "^6.22.0" - babel-plugin-transform-es2015-for-of "^6.23.0" - babel-plugin-transform-es2015-function-name "^6.22.0" - babel-plugin-transform-es2015-literals "^6.22.0" - babel-plugin-transform-es2015-modules-amd "^6.22.0" - babel-plugin-transform-es2015-modules-commonjs "^6.23.0" - babel-plugin-transform-es2015-modules-systemjs "^6.23.0" - babel-plugin-transform-es2015-modules-umd "^6.23.0" - babel-plugin-transform-es2015-object-super "^6.22.0" - babel-plugin-transform-es2015-parameters "^6.23.0" - babel-plugin-transform-es2015-shorthand-properties "^6.22.0" - babel-plugin-transform-es2015-spread "^6.22.0" - babel-plugin-transform-es2015-sticky-regex "^6.22.0" - babel-plugin-transform-es2015-template-literals "^6.22.0" - babel-plugin-transform-es2015-typeof-symbol "^6.23.0" - babel-plugin-transform-es2015-unicode-regex "^6.22.0" - babel-plugin-transform-exponentiation-operator "^6.22.0" - babel-plugin-transform-regenerator "^6.22.0" - browserslist "^3.2.6" - invariant "^2.2.2" - semver "^5.3.0" - -babel-preset-flow@^6.23.0: - version "6.23.0" - resolved "http://registry.npm.taobao.org/babel-preset-flow/download/babel-preset-flow-6.23.0.tgz#e71218887085ae9a24b5be4169affb599816c49d" - dependencies: - babel-plugin-transform-flow-strip-types "^6.22.0" - -babel-preset-react@^6.24.1: - version "6.24.1" - resolved "http://registry.npm.taobao.org/babel-preset-react/download/babel-preset-react-6.24.1.tgz#ba69dfaea45fc3ec639b6a4ecea6e17702c91380" - dependencies: - babel-plugin-syntax-jsx "^6.3.13" - babel-plugin-transform-react-display-name "^6.23.0" - babel-plugin-transform-react-jsx "^6.24.1" - babel-plugin-transform-react-jsx-self "^6.22.0" - babel-plugin-transform-react-jsx-source "^6.22.0" - babel-preset-flow "^6.23.0" - -babel-register@^6.26.0: - version "6.26.0" - resolved "http://registry.npm.taobao.org/babel-register/download/babel-register-6.26.0.tgz#6ed021173e2fcb486d7acb45c6009a856f647071" - dependencies: - babel-core "^6.26.0" - babel-runtime "^6.26.0" - core-js "^2.5.0" - home-or-tmp "^2.0.0" - lodash "^4.17.4" - mkdirp "^0.5.1" - source-map-support "^0.4.15" - -babel-runtime@6.x, babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.23.0, babel-runtime@^6.26.0: - version "6.26.0" - resolved "http://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" - dependencies: - core-js "^2.4.0" - regenerator-runtime "^0.11.0" - -babel-template@^6.24.1, babel-template@^6.26.0: - version "6.26.0" - resolved "http://registry.npm.taobao.org/babel-template/download/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" - dependencies: - babel-runtime "^6.26.0" - babel-traverse "^6.26.0" - babel-types "^6.26.0" - babylon "^6.18.0" - lodash "^4.17.4" - -babel-traverse@^6.24.1, babel-traverse@^6.26.0: - version "6.26.0" - resolved "http://registry.npm.taobao.org/babel-traverse/download/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" - dependencies: - babel-code-frame "^6.26.0" - babel-messages "^6.23.0" - babel-runtime "^6.26.0" - babel-types "^6.26.0" - babylon "^6.18.0" - debug "^2.6.8" - globals "^9.18.0" - invariant "^2.2.2" - lodash "^4.17.4" - -babel-types@^6.19.0, babel-types@^6.24.1, babel-types@^6.26.0: - version "6.26.0" - resolved "http://registry.npm.taobao.org/babel-types/download/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" - dependencies: - babel-runtime "^6.26.0" - esutils "^2.0.2" - lodash "^4.17.4" - to-fast-properties "^1.0.3" - -babylon@7.0.0-beta.44: - version "7.0.0-beta.44" - resolved "http://registry.npm.taobao.org/babylon/download/babylon-7.0.0-beta.44.tgz#89159e15e6e30c5096e22d738d8c0af8a0e8ca1d" - -babylon@^6.18.0: - version "6.18.0" - resolved "http://registry.npm.taobao.org/babylon/download/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" - -balanced-match@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - -base64-js@^1.0.2: - version "1.3.0" - resolved "http://registry.npm.taobao.org/base64-js/download/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3" - -base@^0.11.1: - version "0.11.2" - resolved "http://registry.npm.taobao.org/base/download/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" - dependencies: - cache-base "^1.0.1" - class-utils "^0.3.5" - component-emitter "^1.2.1" - define-property "^1.0.0" - isobject "^3.0.1" - mixin-deep "^1.2.0" - pascalcase "^0.1.1" - -batch@0.6.1: - version "0.6.1" - resolved "http://registry.npm.taobao.org/batch/download/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16" - -bfj-node4@^5.2.0: - version "5.3.1" - resolved "http://registry.npm.taobao.org/bfj-node4/download/bfj-node4-5.3.1.tgz#e23d8b27057f1d0214fc561142ad9db998f26830" - dependencies: - bluebird "^3.5.1" - check-types "^7.3.0" - tryer "^1.0.0" - -big.js@^3.1.3: - version "3.2.0" - resolved "http://registry.npm.taobao.org/big.js/download/big.js-3.2.0.tgz#a5fc298b81b9e0dca2e458824784b65c52ba588e" - -binary-extensions@^1.0.0: - version "1.11.0" - resolved "http://registry.npm.taobao.org/binary-extensions/download/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205" - -bluebird@^3.5.1: - version "3.5.1" - resolved "http://registry.npm.taobao.org/bluebird/download/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9" - -bmaplib.curveline@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/bmaplib.curveline/download/bmaplib.curveline-1.0.0.tgz#826eb0bf1c59fad1b23142be66fc360cf009aea2" - -bmaplib.heatmap@^1.0.4: - version "1.0.4" - resolved "http://registry.npm.taobao.org/bmaplib.heatmap/download/bmaplib.heatmap-1.0.4.tgz#30161262771fe78af35705ff92457725de5d9850" - -bmaplib.markerclusterer@^1.0.13: - version "1.0.13" - resolved "http://registry.npm.taobao.org/bmaplib.markerclusterer/download/bmaplib.markerclusterer-1.0.13.tgz#442d71a6c40844ee47d01f6db2166b54530b5bd1" - dependencies: - bmaplib.texticonoverlay "^1.0.2" - -bmaplib.texticonoverlay@^1.0.2: - version "1.0.2" - resolved "http://registry.npm.taobao.org/bmaplib.texticonoverlay/download/bmaplib.texticonoverlay-1.0.2.tgz#d78546ea0f036d9fe964983796315b6c112a05bf" - -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: - version "4.11.8" - resolved "http://registry.npm.taobao.org/bn.js/download/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" - -body-parser@1.18.2: - version "1.18.2" - resolved "http://registry.npm.taobao.org/body-parser/download/body-parser-1.18.2.tgz#87678a19d84b47d859b83199bd59bce222b10454" - dependencies: - bytes "3.0.0" - content-type "~1.0.4" - debug "2.6.9" - depd "~1.1.1" - http-errors "~1.6.2" - iconv-lite "0.4.19" - on-finished "~2.3.0" - qs "6.5.1" - raw-body "2.3.2" - type-is "~1.6.15" - -bonjour@^3.5.0: - version "3.5.0" - resolved "http://registry.npm.taobao.org/bonjour/download/bonjour-3.5.0.tgz#8e890a183d8ee9a2393b3844c691a42bcf7bc9f5" - dependencies: - array-flatten "^2.1.0" - deep-equal "^1.0.1" - dns-equal "^1.0.0" - dns-txt "^2.0.2" - multicast-dns "^6.0.1" - multicast-dns-service-types "^1.1.0" - -boolbase@^1.0.0, boolbase@~1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/boolbase/download/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "http://registry.npm.taobao.org/brace-expansion/download/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@^2.3.0, braces@^2.3.1: - version "2.3.2" - resolved "http://registry.npm.taobao.org/braces/download/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" - dependencies: - arr-flatten "^1.1.0" - array-unique "^0.3.2" - extend-shallow "^2.0.1" - fill-range "^4.0.0" - isobject "^3.0.1" - repeat-element "^1.1.2" - snapdragon "^0.8.1" - snapdragon-node "^2.0.1" - split-string "^3.0.2" - to-regex "^3.0.1" - -brorand@^1.0.1: - version "1.1.0" - resolved "http://registry.npm.taobao.org/brorand/download/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" - -browserify-aes@^1.0.0, browserify-aes@^1.0.4: - version "1.2.0" - resolved "http://registry.npm.taobao.org/browserify-aes/download/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" - dependencies: - buffer-xor "^1.0.3" - cipher-base "^1.0.0" - create-hash "^1.1.0" - evp_bytestokey "^1.0.3" - inherits "^2.0.1" - safe-buffer "^5.0.1" - -browserify-cipher@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.taobao.org/browserify-cipher/download/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0" - dependencies: - browserify-aes "^1.0.4" - browserify-des "^1.0.0" - evp_bytestokey "^1.0.0" - -browserify-des@^1.0.0: - version "1.0.2" - resolved "http://registry.npm.taobao.org/browserify-des/download/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c" - dependencies: - cipher-base "^1.0.1" - des.js "^1.0.0" - inherits "^2.0.1" - safe-buffer "^5.1.2" - -browserify-rsa@^4.0.0: - version "4.0.1" - resolved "http://registry.npm.taobao.org/browserify-rsa/download/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524" - dependencies: - bn.js "^4.1.0" - randombytes "^2.0.1" - -browserify-sign@^4.0.0: - version "4.0.4" - resolved "http://registry.npm.taobao.org/browserify-sign/download/browserify-sign-4.0.4.tgz#aa4eb68e5d7b658baa6bf6a57e630cbd7a93d298" - dependencies: - bn.js "^4.1.1" - browserify-rsa "^4.0.0" - create-hash "^1.1.0" - create-hmac "^1.1.2" - elliptic "^6.0.0" - inherits "^2.0.1" - parse-asn1 "^5.0.0" - -browserify-zlib@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/browserify-zlib/download/browserify-zlib-0.2.0.tgz#2869459d9aa3be245fe8fe2ca1f46e2e7f54d73f" - dependencies: - pako "~1.0.5" - -browserslist@^3.2.6: - version "3.2.8" - resolved "http://registry.npm.taobao.org/browserslist/download/browserslist-3.2.8.tgz#b0005361d6471f0f5952797a76fc985f1f978fc6" - dependencies: - caniuse-lite "^1.0.30000844" - electron-to-chromium "^1.3.47" - -browserslist@^4.0.0: - version "4.0.2" - resolved "http://registry.npm.taobao.org/browserslist/download/browserslist-4.0.2.tgz#294388f5844bb3ab15ef7394ca17f49bf7a4e6f1" - dependencies: - caniuse-lite "^1.0.30000876" - electron-to-chromium "^1.3.57" - node-releases "^1.0.0-alpha.11" - -buffer-from@^1.0.0: - version "1.1.1" - resolved "http://registry.npm.taobao.org/buffer-from/download/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" - -buffer-indexof@^1.0.0: - version "1.1.1" - resolved "http://registry.npm.taobao.org/buffer-indexof/download/buffer-indexof-1.1.1.tgz#52fabcc6a606d1a00302802648ef68f639da268c" - -buffer-xor@^1.0.3: - version "1.0.3" - resolved "http://registry.npm.taobao.org/buffer-xor/download/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" - -buffer@^4.3.0: - version "4.9.1" - resolved "http://registry.npm.taobao.org/buffer/download/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298" - dependencies: - base64-js "^1.0.2" - ieee754 "^1.1.4" - isarray "^1.0.0" - -builtin-modules@^1.0.0: - version "1.1.1" - resolved "http://registry.npm.taobao.org/builtin-modules/download/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" - -builtin-status-codes@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/builtin-status-codes/download/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" - -bytes@3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/bytes/download/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" - -cacache@^10.0.4: - version "10.0.4" - resolved "http://registry.npm.taobao.org/cacache/download/cacache-10.0.4.tgz#6452367999eff9d4188aefd9a14e9d7c6a263460" - dependencies: - bluebird "^3.5.1" - chownr "^1.0.1" - glob "^7.1.2" - graceful-fs "^4.1.11" - lru-cache "^4.1.1" - mississippi "^2.0.0" - mkdirp "^0.5.1" - move-concurrently "^1.0.1" - promise-inflight "^1.0.1" - rimraf "^2.6.2" - ssri "^5.2.4" - unique-filename "^1.1.0" - y18n "^4.0.0" - -cache-base@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/cache-base/download/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" - dependencies: - collection-visit "^1.0.0" - component-emitter "^1.2.1" - get-value "^2.0.6" - has-value "^1.0.0" - isobject "^3.0.1" - set-value "^2.0.0" - to-object-path "^0.3.0" - union-value "^1.0.0" - unset-value "^1.0.0" - -caller-path@^0.1.0: - version "0.1.0" - resolved "http://registry.npm.taobao.org/caller-path/download/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" - dependencies: - callsites "^0.2.0" - -callsites@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/callsites/download/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" - -camel-case@3.0.x: - version "3.0.0" - resolved "http://registry.npm.taobao.org/camel-case/download/camel-case-3.0.0.tgz#ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73" - dependencies: - no-case "^2.2.0" - upper-case "^1.1.1" - -camelcase-keys@^2.0.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/camelcase-keys/download/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7" - dependencies: - camelcase "^2.0.0" - map-obj "^1.0.0" - -camelcase@^2.0.0: - version "2.1.1" - resolved "http://registry.npm.taobao.org/camelcase/download/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" - -camelcase@^4.1.0: - version "4.1.0" - resolved "http://registry.npm.taobao.org/camelcase/download/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" - -caniuse-api@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/caniuse-api/download/caniuse-api-3.0.0.tgz#5e4d90e2274961d46291997df599e3ed008ee4c0" - dependencies: - browserslist "^4.0.0" - caniuse-lite "^1.0.0" - lodash.memoize "^4.1.2" - lodash.uniq "^4.5.0" - -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30000876: - version "1.0.30000877" - resolved "http://registry.npm.taobao.org/caniuse-lite/download/caniuse-lite-1.0.30000877.tgz#f189673b86ecc06436520e3e391de6a13ca923b4" - -chalk@^1.1.3: - version "1.1.3" - resolved "http://registry.npm.taobao.org/chalk/download/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.2, chalk@^2.4.1: - version "2.4.1" - resolved "http://registry.npm.taobao.org/chalk/download/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -character-entities-legacy@^1.0.0: - version "1.1.2" - resolved "http://registry.npm.taobao.org/character-entities-legacy/download/character-entities-legacy-1.1.2.tgz#7c6defb81648498222c9855309953d05f4d63a9c" - -character-entities@^1.0.0: - version "1.2.2" - resolved "http://registry.npm.taobao.org/character-entities/download/character-entities-1.2.2.tgz#58c8f371c0774ef0ba9b2aca5f00d8f100e6e363" - -character-reference-invalid@^1.0.0: - version "1.1.2" - resolved "http://registry.npm.taobao.org/character-reference-invalid/download/character-reference-invalid-1.1.2.tgz#21e421ad3d84055952dab4a43a04e73cd425d3ed" - -chardet@^0.4.0: - version "0.4.2" - resolved "http://registry.npm.taobao.org/chardet/download/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" - -chardet@^0.5.0: - version "0.5.0" - resolved "http://registry.npm.taobao.org/chardet/download/chardet-0.5.0.tgz#fe3ac73c00c3d865ffcc02a0682e2c20b6a06029" - -check-types@^7.3.0: - version "7.4.0" - resolved "http://registry.npm.taobao.org/check-types/download/check-types-7.4.0.tgz#0378ec1b9616ec71f774931a3c6516fad8c152f4" - -chokidar@^2.0.0, chokidar@^2.0.2: - version "2.0.4" - resolved "http://registry.npm.taobao.org/chokidar/download/chokidar-2.0.4.tgz#356ff4e2b0e8e43e322d18a372460bbcf3accd26" - dependencies: - anymatch "^2.0.0" - async-each "^1.0.0" - braces "^2.3.0" - glob-parent "^3.1.0" - inherits "^2.0.1" - is-binary-path "^1.0.0" - is-glob "^4.0.0" - lodash.debounce "^4.0.8" - normalize-path "^2.1.1" - path-is-absolute "^1.0.0" - readdirp "^2.0.0" - upath "^1.0.5" - optionalDependencies: - fsevents "^1.2.2" - -chownr@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/chownr/download/chownr-1.0.1.tgz#e2a75042a9551908bebd25b8523d5f9769d79181" - -chrome-trace-event@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/chrome-trace-event/download/chrome-trace-event-1.0.0.tgz#45a91bd2c20c9411f0963b5aaeb9a1b95e09cc48" - dependencies: - tslib "^1.9.0" - -cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: - version "1.0.4" - resolved "http://registry.npm.taobao.org/cipher-base/download/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -circular-json@^0.3.1: - version "0.3.3" - resolved "http://registry.npm.taobao.org/circular-json/download/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" - -class-utils@^0.3.5: - version "0.3.6" - resolved "http://registry.npm.taobao.org/class-utils/download/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" - dependencies: - arr-union "^3.1.0" - define-property "^0.2.5" - isobject "^3.0.0" - static-extend "^0.1.1" - -classnames@2.x, classnames@^2.2.0, classnames@^2.2.1, classnames@^2.2.3, classnames@^2.2.5, classnames@^2.2.6, classnames@~2.2.0: - version "2.2.6" - resolved "http://registry.npm.taobao.org/classnames/download/classnames-2.2.6.tgz#43935bffdd291f326dad0a205309b38d00f650ce" - -clean-css@4.1.x: - version "4.1.11" - resolved "http://registry.npm.taobao.org/clean-css/download/clean-css-4.1.11.tgz#2ecdf145aba38f54740f26cefd0ff3e03e125d6a" - dependencies: - source-map "0.5.x" - -clean-webpack-plugin@^0.1.19: - version "0.1.19" - resolved "http://registry.npm.taobao.org/clean-webpack-plugin/download/clean-webpack-plugin-0.1.19.tgz#ceda8bb96b00fe168e9b080272960d20fdcadd6d" - dependencies: - rimraf "^2.6.1" - -cli-cursor@^2.1.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/cli-cursor/download/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" - dependencies: - restore-cursor "^2.0.0" - -cli-width@^2.0.0: - version "2.2.0" - resolved "http://registry.npm.taobao.org/cli-width/download/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" - -clipboard@^2.0.0: - version "2.0.1" - resolved "http://registry.npm.taobao.org/clipboard/download/clipboard-2.0.1.tgz#a12481e1c13d8a50f5f036b0560fe5d16d74e46a" - dependencies: - good-listener "^1.2.2" - select "^1.1.2" - tiny-emitter "^2.0.0" - -cliui@^4.0.0: - version "4.1.0" - resolved "http://registry.npm.taobao.org/cliui/download/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" - dependencies: - string-width "^2.1.1" - strip-ansi "^4.0.0" - wrap-ansi "^2.0.0" - -co@^4.6.0: - version "4.6.0" - resolved "http://registry.npm.taobao.org/co/download/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - -coa@~2.0.1: - version "2.0.1" - resolved "http://registry.npm.taobao.org/coa/download/coa-2.0.1.tgz#f3f8b0b15073e35d70263fb1042cb2c023db38af" - dependencies: - q "^1.1.2" - -code-point-at@^1.0.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/code-point-at/download/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - -collection-visit@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/collection-visit/download/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" - dependencies: - map-visit "^1.0.0" - object-visit "^1.0.0" - -color-convert@^1.9.0, color-convert@^1.9.1: - version "1.9.2" - resolved "http://registry.npm.taobao.org/color-convert/download/color-convert-1.9.2.tgz#49881b8fba67df12a96bdf3f56c0aab9e7913147" - dependencies: - color-name "1.1.1" - -color-name@1.1.1: - version "1.1.1" - resolved "http://registry.npm.taobao.org/color-name/download/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689" - -color-name@^1.0.0: - version "1.1.3" - resolved "http://registry.npm.taobao.org/color-name/download/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - -color-string@^1.5.2: - version "1.5.3" - resolved "http://registry.npm.taobao.org/color-string/download/color-string-1.5.3.tgz#c9bbc5f01b58b5492f3d6857459cb6590ce204cc" - dependencies: - color-name "^1.0.0" - simple-swizzle "^0.2.2" - -color@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/color/download/color-3.0.0.tgz#d920b4328d534a3ac8295d68f7bd4ba6c427be9a" - dependencies: - color-convert "^1.9.1" - color-string "^1.5.2" - -colors@~1.1.2: - version "1.1.2" - resolved "http://registry.npm.taobao.org/colors/download/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" - -comma-separated-tokens@^1.0.0: - version "1.0.5" - resolved "http://registry.npm.taobao.org/comma-separated-tokens/download/comma-separated-tokens-1.0.5.tgz#b13793131d9ea2d2431cf5b507ddec258f0ce0db" - dependencies: - trim "0.0.1" - -commander@2.16.x, commander@~2.16.0: - version "2.16.0" - resolved "http://registry.npm.taobao.org/commander/download/commander-2.16.0.tgz#f16390593996ceb4f3eeb020b31d78528f7f8a50" - -commander@^2.11.0, commander@^2.13.0: - version "2.17.1" - resolved "http://registry.npm.taobao.org/commander/download/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" - -commander@~2.13.0: - version "2.13.0" - resolved "http://registry.npm.taobao.org/commander/download/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c" - -commondir@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/commondir/download/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" - -component-classes@1.x, component-classes@^1.2.5, component-classes@^1.2.6: - version "1.2.6" - resolved "http://registry.npm.taobao.org/component-classes/download/component-classes-1.2.6.tgz#c642394c3618a4d8b0b8919efccbbd930e5cd691" - dependencies: - component-indexof "0.0.3" - -component-emitter@^1.2.1: - version "1.2.1" - resolved "http://registry.npm.taobao.org/component-emitter/download/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" - -component-indexof@0.0.3: - version "0.0.3" - resolved "http://registry.npm.taobao.org/component-indexof/download/component-indexof-0.0.3.tgz#11d091312239eb8f32c8f25ae9cb002ffe8d3c24" - -compressible@~2.0.14: - version "2.0.14" - resolved "http://registry.npm.taobao.org/compressible/download/compressible-2.0.14.tgz#326c5f507fbb055f54116782b969a81b67a29da7" - dependencies: - mime-db ">= 1.34.0 < 2" - -compression@^1.5.2: - version "1.7.3" - resolved "http://registry.npm.taobao.org/compression/download/compression-1.7.3.tgz#27e0e176aaf260f7f2c2813c3e440adb9f1993db" - dependencies: - accepts "~1.3.5" - bytes "3.0.0" - compressible "~2.0.14" - debug "2.6.9" - on-headers "~1.0.1" - safe-buffer "5.1.2" - vary "~1.1.2" - -concat-map@0.0.1: - version "0.0.1" - resolved "http://registry.npm.taobao.org/concat-map/download/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - -concat-stream@^1.5.0, concat-stream@^1.6.0: - version "1.6.2" - resolved "http://registry.npm.taobao.org/concat-stream/download/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" - dependencies: - buffer-from "^1.0.0" - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" - -connect-history-api-fallback@^1.3.0: - version "1.5.0" - resolved "http://registry.npm.taobao.org/connect-history-api-fallback/download/connect-history-api-fallback-1.5.0.tgz#b06873934bc5e344fef611a196a6faae0aee015a" - -console-browserify@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/console-browserify/download/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" - dependencies: - date-now "^0.1.4" - -console-control-strings@^1.0.0, console-control-strings@~1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/console-control-strings/download/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" - -constants-browserify@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/constants-browserify/download/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" - -contains-path@^0.1.0: - version "0.1.0" - resolved "http://registry.npm.taobao.org/contains-path/download/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" - -content-disposition@0.5.2: - version "0.5.2" - resolved "http://registry.npm.taobao.org/content-disposition/download/content-disposition-0.5.2.tgz#0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4" - -content-type@~1.0.4: - version "1.0.4" - resolved "http://registry.npm.taobao.org/content-type/download/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" - -convert-source-map@^1.5.1: - version "1.5.1" - resolved "http://registry.npm.taobao.org/convert-source-map/download/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" - -cookie-signature@1.0.6: - version "1.0.6" - resolved "http://registry.npm.taobao.org/cookie-signature/download/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" - -cookie@0.3.1: - version "0.3.1" - resolved "http://registry.npm.taobao.org/cookie/download/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" - -copy-concurrently@^1.0.0: - version "1.0.5" - resolved "http://registry.npm.taobao.org/copy-concurrently/download/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0" - dependencies: - aproba "^1.1.1" - fs-write-stream-atomic "^1.0.8" - iferr "^0.1.5" - mkdirp "^0.5.1" - rimraf "^2.5.4" - run-queue "^1.0.0" - -copy-descriptor@^0.1.0: - version "0.1.1" - resolved "http://registry.npm.taobao.org/copy-descriptor/download/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" - -core-js@^1.0.0: - version "1.2.7" - resolved "http://registry.npm.taobao.org/core-js/download/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" - -core-js@^2.4.0, core-js@^2.5.0: - version "2.5.7" - resolved "http://registry.npm.taobao.org/core-js/download/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e" - -core-util-is@~1.0.0: - version "1.0.2" - resolved "http://registry.npm.taobao.org/core-util-is/download/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - -cosmiconfig@^5.0.0: - version "5.0.6" - resolved "http://registry.npm.taobao.org/cosmiconfig/download/cosmiconfig-5.0.6.tgz#dca6cf680a0bd03589aff684700858c81abeeb39" - dependencies: - is-directory "^0.3.1" - js-yaml "^3.9.0" - parse-json "^4.0.0" - -create-ecdh@^4.0.0: - version "4.0.3" - resolved "http://registry.npm.taobao.org/create-ecdh/download/create-ecdh-4.0.3.tgz#c9111b6f33045c4697f144787f9254cdc77c45ff" - dependencies: - bn.js "^4.1.0" - elliptic "^6.0.0" - -create-hash@^1.1.0, create-hash@^1.1.2: - version "1.2.0" - resolved "http://registry.npm.taobao.org/create-hash/download/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" - dependencies: - cipher-base "^1.0.1" - inherits "^2.0.1" - md5.js "^1.3.4" - ripemd160 "^2.0.1" - sha.js "^2.4.0" - -create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: - version "1.1.7" - resolved "http://registry.npm.taobao.org/create-hmac/download/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" - dependencies: - cipher-base "^1.0.3" - create-hash "^1.1.0" - inherits "^2.0.1" - ripemd160 "^2.0.0" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - -create-react-class@^15.5.2, create-react-class@^15.5.3, create-react-class@^15.6.0: - version "15.6.3" - resolved "http://registry.npm.taobao.org/create-react-class/download/create-react-class-15.6.3.tgz#2d73237fb3f970ae6ebe011a9e66f46dbca80036" - dependencies: - fbjs "^0.8.9" - loose-envify "^1.3.1" - object-assign "^4.1.1" - -create-react-context@^0.2.2: - version "0.2.2" - resolved "http://registry.npm.taobao.org/create-react-context/download/create-react-context-0.2.2.tgz#9836542f9aaa22868cd7d4a6f82667df38019dca" - dependencies: - fbjs "^0.8.0" - gud "^1.0.0" - -cross-spawn@^5.0.1, cross-spawn@^5.1.0: - version "5.1.0" - resolved "http://registry.npm.taobao.org/cross-spawn/download/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" - dependencies: - lru-cache "^4.0.1" - shebang-command "^1.2.0" - which "^1.2.9" - -cross-spawn@^6.0.5: - version "6.0.5" - resolved "http://registry.npm.taobao.org/cross-spawn/download/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" - dependencies: - nice-try "^1.0.4" - path-key "^2.0.1" - semver "^5.5.0" - shebang-command "^1.2.0" - which "^1.2.9" - -crypto-browserify@^3.11.0: - version "3.12.0" - resolved "http://registry.npm.taobao.org/crypto-browserify/download/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" - dependencies: - browserify-cipher "^1.0.0" - browserify-sign "^4.0.0" - create-ecdh "^4.0.0" - create-hash "^1.1.0" - create-hmac "^1.1.0" - diffie-hellman "^5.0.0" - inherits "^2.0.1" - pbkdf2 "^3.0.3" - public-encrypt "^4.0.0" - randombytes "^2.0.0" - randomfill "^1.0.3" - -css-animation@1.x, css-animation@^1.2.5, css-animation@^1.3.2: - version "1.4.1" - resolved "http://registry.npm.taobao.org/css-animation/download/css-animation-1.4.1.tgz#5b8813125de0fbbbb0bbe1b472ae84221469b7a8" - dependencies: - babel-runtime "6.x" - component-classes "^1.2.5" - -css-color-names@0.0.4, css-color-names@^0.0.4: - version "0.0.4" - resolved "http://registry.npm.taobao.org/css-color-names/download/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0" - -css-declaration-sorter@^3.0.0: - version "3.0.1" - resolved "http://registry.npm.taobao.org/css-declaration-sorter/download/css-declaration-sorter-3.0.1.tgz#d0e3056b0fd88dc1ea9dceff435adbe9c702a7f8" - dependencies: - postcss "^6.0.0" - timsort "^0.3.0" - -css-loader@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/css-loader/download/css-loader-1.0.0.tgz#9f46aaa5ca41dbe31860e3b62b8e23c42916bf56" - dependencies: - babel-code-frame "^6.26.0" - css-selector-tokenizer "^0.7.0" - icss-utils "^2.1.0" - loader-utils "^1.0.2" - lodash.camelcase "^4.3.0" - postcss "^6.0.23" - postcss-modules-extract-imports "^1.2.0" - postcss-modules-local-by-default "^1.2.0" - postcss-modules-scope "^1.1.0" - postcss-modules-values "^1.3.0" - postcss-value-parser "^3.3.0" - source-list-map "^2.0.0" - -css-select-base-adapter@~0.1.0: - version "0.1.0" - resolved "http://registry.npm.taobao.org/css-select-base-adapter/download/css-select-base-adapter-0.1.0.tgz#0102b3d14630df86c3eb9fa9f5456270106cf990" - -css-select@^1.1.0: - version "1.2.0" - resolved "http://registry.npm.taobao.org/css-select/download/css-select-1.2.0.tgz#2b3a110539c5355f1cd8d314623e870b121ec858" - dependencies: - boolbase "~1.0.0" - css-what "2.1" - domutils "1.5.1" - nth-check "~1.0.1" - -css-select@~1.3.0-rc0: - version "1.3.0-rc0" - resolved "http://registry.npm.taobao.org/css-select/download/css-select-1.3.0-rc0.tgz#6f93196aaae737666ea1036a8cb14a8fcb7a9231" - dependencies: - boolbase "^1.0.0" - css-what "2.1" - domutils "1.5.1" - nth-check "^1.0.1" - -css-selector-tokenizer@^0.7.0: - version "0.7.0" - resolved "http://registry.npm.taobao.org/css-selector-tokenizer/download/css-selector-tokenizer-0.7.0.tgz#e6988474ae8c953477bf5e7efecfceccd9cf4c86" - dependencies: - cssesc "^0.1.0" - fastparse "^1.1.1" - regexpu-core "^1.0.0" - -css-tree@1.0.0-alpha.29: - version "1.0.0-alpha.29" - resolved "http://registry.npm.taobao.org/css-tree/download/css-tree-1.0.0-alpha.29.tgz#3fa9d4ef3142cbd1c301e7664c1f352bd82f5a39" - dependencies: - mdn-data "~1.1.0" - source-map "^0.5.3" - -css-tree@1.0.0-alpha25: - version "1.0.0-alpha25" - resolved "http://registry.npm.taobao.org/css-tree/download/css-tree-1.0.0-alpha25.tgz#1bbfabfbf6eeef4f01d9108ff2edd0be2fe35597" - dependencies: - mdn-data "^1.0.0" - source-map "^0.5.3" - -css-unit-converter@^1.1.1: - version "1.1.1" - resolved "http://registry.npm.taobao.org/css-unit-converter/download/css-unit-converter-1.1.1.tgz#d9b9281adcfd8ced935bdbaba83786897f64e996" - -css-url-regex@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/css-url-regex/download/css-url-regex-1.1.0.tgz#83834230cc9f74c457de59eebd1543feeb83b7ec" - -css-what@2.1: - version "2.1.0" - resolved "http://registry.npm.taobao.org/css-what/download/css-what-2.1.0.tgz#9467d032c38cfaefb9f2d79501253062f87fa1bd" - -cssesc@^0.1.0: - version "0.1.0" - resolved "http://registry.npm.taobao.org/cssesc/download/cssesc-0.1.0.tgz#c814903e45623371a0477b40109aaafbeeaddbb4" - -cssnano-preset-default@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/cssnano-preset-default/download/cssnano-preset-default-4.0.0.tgz#c334287b4f7d49fb2d170a92f9214655788e3b6b" - dependencies: - css-declaration-sorter "^3.0.0" - cssnano-util-raw-cache "^4.0.0" - postcss "^6.0.0" - postcss-calc "^6.0.0" - postcss-colormin "^4.0.0" - postcss-convert-values "^4.0.0" - postcss-discard-comments "^4.0.0" - postcss-discard-duplicates "^4.0.0" - postcss-discard-empty "^4.0.0" - postcss-discard-overridden "^4.0.0" - postcss-merge-longhand "^4.0.0" - postcss-merge-rules "^4.0.0" - postcss-minify-font-values "^4.0.0" - postcss-minify-gradients "^4.0.0" - postcss-minify-params "^4.0.0" - postcss-minify-selectors "^4.0.0" - postcss-normalize-charset "^4.0.0" - postcss-normalize-display-values "^4.0.0" - postcss-normalize-positions "^4.0.0" - postcss-normalize-repeat-style "^4.0.0" - postcss-normalize-string "^4.0.0" - postcss-normalize-timing-functions "^4.0.0" - postcss-normalize-unicode "^4.0.0" - postcss-normalize-url "^4.0.0" - postcss-normalize-whitespace "^4.0.0" - postcss-ordered-values "^4.0.0" - postcss-reduce-initial "^4.0.0" - postcss-reduce-transforms "^4.0.0" - postcss-svgo "^4.0.0" - postcss-unique-selectors "^4.0.0" - -cssnano-util-get-arguments@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/cssnano-util-get-arguments/download/cssnano-util-get-arguments-4.0.0.tgz#ed3a08299f21d75741b20f3b81f194ed49cc150f" - -cssnano-util-get-match@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/cssnano-util-get-match/download/cssnano-util-get-match-4.0.0.tgz#c0e4ca07f5386bb17ec5e52250b4f5961365156d" - -cssnano-util-raw-cache@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/cssnano-util-raw-cache/download/cssnano-util-raw-cache-4.0.0.tgz#be0a2856e25f185f5f7a2bcc0624e28b7f179a9f" - dependencies: - postcss "^6.0.0" - -cssnano-util-same-parent@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/cssnano-util-same-parent/download/cssnano-util-same-parent-4.0.0.tgz#d2a3de1039aa98bc4ec25001fa050330c2a16dac" - -cssnano@^4.0.2: - version "4.0.5" - resolved "http://registry.npm.taobao.org/cssnano/download/cssnano-4.0.5.tgz#8789b5fdbe7be05d8a0f7e45c4c789ebe712f5aa" - dependencies: - cosmiconfig "^5.0.0" - cssnano-preset-default "^4.0.0" - is-resolvable "^1.0.0" - postcss "^6.0.0" - -csso@^3.5.0: - version "3.5.1" - resolved "http://registry.npm.taobao.org/csso/download/csso-3.5.1.tgz#7b9eb8be61628973c1b261e169d2f024008e758b" - dependencies: - css-tree "1.0.0-alpha.29" - -currently-unhandled@^0.4.1: - version "0.4.1" - resolved "http://registry.npm.taobao.org/currently-unhandled/download/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" - dependencies: - array-find-index "^1.0.1" - -cyclist@~0.2.2: - version "0.2.2" - resolved "http://registry.npm.taobao.org/cyclist/download/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" - -d@1: - version "1.0.0" - resolved "http://registry.npm.taobao.org/d/download/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" - dependencies: - es5-ext "^0.10.9" - -damerau-levenshtein@^1.0.4: - version "1.0.4" - resolved "http://registry.npm.taobao.org/damerau-levenshtein/download/damerau-levenshtein-1.0.4.tgz#03191c432cb6eea168bb77f3a55ffdccb8978514" - -date-now@^0.1.4: - version "0.1.4" - resolved "http://registry.npm.taobao.org/date-now/download/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" - -debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.6, debug@^2.6.8, debug@^2.6.9: - version "2.6.9" - resolved "http://registry.npm.taobao.org/debug/download/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - dependencies: - ms "2.0.0" - -debug@^3.1.0: - version "3.1.0" - resolved "http://registry.npm.taobao.org/debug/download/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" - dependencies: - ms "2.0.0" - -decamelize@^1.1.1, decamelize@^1.1.2: - version "1.2.0" - resolved "http://registry.npm.taobao.org/decamelize/download/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - -decamelize@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/decamelize/download/decamelize-2.0.0.tgz#656d7bbc8094c4c788ea53c5840908c9c7d063c7" - dependencies: - xregexp "4.0.0" - -decode-uri-component@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/decode-uri-component/download/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" - -deep-equal@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/deep-equal/download/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" - -deep-extend@^0.6.0: - version "0.6.0" - resolved "http://registry.npm.taobao.org/deep-extend/download/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" - -deep-is@~0.1.3: - version "0.1.3" - resolved "http://registry.npm.taobao.org/deep-is/download/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" - -define-properties@^1.1.2: - version "1.1.3" - resolved "http://registry.npm.taobao.org/define-properties/download/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" - dependencies: - object-keys "^1.0.12" - -define-property@^0.2.5: - version "0.2.5" - resolved "http://registry.npm.taobao.org/define-property/download/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" - dependencies: - is-descriptor "^0.1.0" - -define-property@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/define-property/download/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" - dependencies: - is-descriptor "^1.0.0" - -define-property@^2.0.2: - version "2.0.2" - resolved "http://registry.npm.taobao.org/define-property/download/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" - dependencies: - is-descriptor "^1.0.2" - isobject "^3.0.1" - -del@^2.0.2: - version "2.2.2" - resolved "http://registry.npm.taobao.org/del/download/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" - dependencies: - globby "^5.0.0" - is-path-cwd "^1.0.0" - is-path-in-cwd "^1.0.0" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - rimraf "^2.2.8" - -del@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/del/download/del-3.0.0.tgz#53ecf699ffcbcb39637691ab13baf160819766e5" - dependencies: - globby "^6.1.0" - is-path-cwd "^1.0.0" - is-path-in-cwd "^1.0.0" - p-map "^1.1.1" - pify "^3.0.0" - rimraf "^2.2.8" - -delegate@^3.1.2: - version "3.2.0" - resolved "http://registry.npm.taobao.org/delegate/download/delegate-3.2.0.tgz#b66b71c3158522e8ab5744f720d8ca0c2af59166" - -delegates@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/delegates/download/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" - -depd@1.1.1: - version "1.1.1" - resolved "http://registry.npm.taobao.org/depd/download/depd-1.1.1.tgz#5783b4e1c459f06fa5ca27f991f3d06e7a310359" - -depd@~1.1.1, depd@~1.1.2: - version "1.1.2" - resolved "http://registry.npm.taobao.org/depd/download/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" - -des.js@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/des.js/download/des.js-1.0.0.tgz#c074d2e2aa6a8a9a07dbd61f9a15c2cd83ec8ecc" - dependencies: - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - -destroy@~1.0.4: - version "1.0.4" - resolved "http://registry.npm.taobao.org/destroy/download/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" - -detect-indent@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/detect-indent/download/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" - dependencies: - repeating "^2.0.0" - -detect-libc@^1.0.2: - version "1.0.3" - resolved "http://registry.npm.taobao.org/detect-libc/download/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" - -detect-node@^2.0.3: - version "2.0.3" - resolved "http://registry.npm.taobao.org/detect-node/download/detect-node-2.0.3.tgz#a2033c09cc8e158d37748fbde7507832bd6ce127" - -diffie-hellman@^5.0.0: - version "5.0.3" - resolved "http://registry.npm.taobao.org/diffie-hellman/download/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" - dependencies: - bn.js "^4.1.0" - miller-rabin "^4.0.0" - randombytes "^2.0.0" - -dns-equal@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/dns-equal/download/dns-equal-1.0.0.tgz#b39e7f1da6eb0a75ba9c17324b34753c47e0654d" - -dns-packet@^1.3.1: - version "1.3.1" - resolved "http://registry.npm.taobao.org/dns-packet/download/dns-packet-1.3.1.tgz#12aa426981075be500b910eedcd0b47dd7deda5a" - dependencies: - ip "^1.1.0" - safe-buffer "^5.0.1" - -dns-txt@^2.0.2: - version "2.0.2" - resolved "http://registry.npm.taobao.org/dns-txt/download/dns-txt-2.0.2.tgz#b91d806f5d27188e4ab3e7d107d881a1cc4642b6" - dependencies: - buffer-indexof "^1.0.0" - -doctrine@1.5.0: - version "1.5.0" - resolved "http://registry.npm.taobao.org/doctrine/download/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" - dependencies: - esutils "^2.0.2" - isarray "^1.0.0" - -doctrine@^2.1.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/doctrine/download/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" - dependencies: - esutils "^2.0.2" - -dom-align@^1.7.0: - version "1.8.0" - resolved "http://registry.npm.taobao.org/dom-align/download/dom-align-1.8.0.tgz#c0e89b5b674c6e836cd248c52c2992135f093654" - -dom-closest@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/dom-closest/download/dom-closest-0.2.0.tgz#ebd9f91d1bf22e8d6f477876bbcd3ec90216c0cf" - dependencies: - dom-matches ">=1.0.1" - -dom-converter@~0.1: - version "0.1.4" - resolved "http://registry.npm.taobao.org/dom-converter/download/dom-converter-0.1.4.tgz#a45ef5727b890c9bffe6d7c876e7b19cb0e17f3b" - dependencies: - utila "~0.3" - -dom-matches@>=1.0.1: - version "2.0.0" - resolved "http://registry.npm.taobao.org/dom-matches/download/dom-matches-2.0.0.tgz#d2728b416a87533980eb089b848d253cf23a758c" - -dom-scroll-into-view@1.x, dom-scroll-into-view@^1.2.0: - version "1.2.1" - resolved "http://registry.npm.taobao.org/dom-scroll-into-view/download/dom-scroll-into-view-1.2.1.tgz#e8f36732dd089b0201a88d7815dc3f88e6d66c7e" - -dom-serializer@0: - version "0.1.0" - resolved "http://registry.npm.taobao.org/dom-serializer/download/dom-serializer-0.1.0.tgz#073c697546ce0780ce23be4a28e293e40bc30c82" - dependencies: - domelementtype "~1.1.1" - entities "~1.1.1" - -domain-browser@^1.1.1: - version "1.2.0" - resolved "http://registry.npm.taobao.org/domain-browser/download/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" - -domelementtype@1: - version "1.3.0" - resolved "http://registry.npm.taobao.org/domelementtype/download/domelementtype-1.3.0.tgz#b17aed82e8ab59e52dd9c19b1756e0fc187204c2" - -domelementtype@~1.1.1: - version "1.1.3" - resolved "http://registry.npm.taobao.org/domelementtype/download/domelementtype-1.1.3.tgz#bd28773e2642881aec51544924299c5cd822185b" - -domhandler@2.1: - version "2.1.0" - resolved "http://registry.npm.taobao.org/domhandler/download/domhandler-2.1.0.tgz#d2646f5e57f6c3bab11cf6cb05d3c0acf7412594" - dependencies: - domelementtype "1" - -domutils@1.1: - version "1.1.6" - resolved "http://registry.npm.taobao.org/domutils/download/domutils-1.1.6.tgz#bddc3de099b9a2efacc51c623f28f416ecc57485" - dependencies: - domelementtype "1" - -domutils@1.5.1: - version "1.5.1" - resolved "http://registry.npm.taobao.org/domutils/download/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" - dependencies: - dom-serializer "0" - domelementtype "1" - -dot-prop@^4.1.1: - version "4.2.0" - resolved "http://registry.npm.taobao.org/dot-prop/download/dot-prop-4.2.0.tgz#1f19e0c2e1aa0e32797c49799f2837ac6af69c57" - dependencies: - is-obj "^1.0.0" - -draft-js@^0.10.0, draft-js@~0.10.0: - version "0.10.5" - resolved "http://registry.npm.taobao.org/draft-js/download/draft-js-0.10.5.tgz#bfa9beb018fe0533dbb08d6675c371a6b08fa742" - dependencies: - fbjs "^0.8.15" - immutable "~3.7.4" - object-assign "^4.1.0" - -duplexer@^0.1.1: - version "0.1.1" - resolved "http://registry.npm.taobao.org/duplexer/download/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" - -duplexify@^3.4.2, duplexify@^3.6.0: - version "3.6.0" - resolved "http://registry.npm.taobao.org/duplexify/download/duplexify-3.6.0.tgz#592903f5d80b38d037220541264d69a198fb3410" - dependencies: - end-of-stream "^1.0.0" - inherits "^2.0.1" - readable-stream "^2.0.0" - stream-shift "^1.0.0" - -ee-first@1.1.1: - version "1.1.1" - resolved "http://registry.npm.taobao.org/ee-first/download/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" - -ejs@^2.5.7: - version "2.6.1" - resolved "http://registry.npm.taobao.org/ejs/download/ejs-2.6.1.tgz#498ec0d495655abc6f23cd61868d926464071aa0" - -electron-to-chromium@^1.3.47, electron-to-chromium@^1.3.57: - version "1.3.58" - resolved "http://registry.npm.taobao.org/electron-to-chromium/download/electron-to-chromium-1.3.58.tgz#8267a4000014e93986d9d18c65a8b4022ca75188" - -elliptic@^6.0.0: - version "6.4.1" - resolved "http://registry.npm.taobao.org/elliptic/download/elliptic-6.4.1.tgz#c2d0b7776911b86722c632c3c06c60f2f819939a" - dependencies: - bn.js "^4.4.0" - brorand "^1.0.1" - hash.js "^1.0.0" - hmac-drbg "^1.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.0" - -emoji-regex@^6.5.1: - version "6.5.1" - resolved "http://registry.npm.taobao.org/emoji-regex/download/emoji-regex-6.5.1.tgz#9baea929b155565c11ea41c6626eaa65cef992c2" - -emojis-list@^2.0.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/emojis-list/download/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" - -encodeurl@~1.0.2: - version "1.0.2" - resolved "http://registry.npm.taobao.org/encodeurl/download/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" - -encoding@^0.1.11: - version "0.1.12" - resolved "http://registry.npm.taobao.org/encoding/download/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" - dependencies: - iconv-lite "~0.4.13" - -end-of-stream@^1.0.0, end-of-stream@^1.1.0: - version "1.4.1" - resolved "http://registry.npm.taobao.org/end-of-stream/download/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" - dependencies: - once "^1.4.0" - -enhanced-resolve@^4.0.0, enhanced-resolve@^4.1.0: - version "4.1.0" - resolved "http://registry.npm.taobao.org/enhanced-resolve/download/enhanced-resolve-4.1.0.tgz#41c7e0bfdfe74ac1ffe1e57ad6a5c6c9f3742a7f" - dependencies: - graceful-fs "^4.1.2" - memory-fs "^0.4.0" - tapable "^1.0.0" - -enquire.js@^2.1.1, enquire.js@^2.1.6: - version "2.1.6" - resolved "http://registry.npm.taobao.org/enquire.js/download/enquire.js-2.1.6.tgz#3e8780c9b8b835084c3f60e166dbc3c2a3c89814" - -entities@~1.1.1: - version "1.1.1" - resolved "http://registry.npm.taobao.org/entities/download/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" - -errno@^0.1.3, errno@~0.1.7: - version "0.1.7" - resolved "http://registry.npm.taobao.org/errno/download/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" - dependencies: - prr "~1.0.1" - -error-ex@^1.2.0, error-ex@^1.3.1: - version "1.3.2" - resolved "http://registry.npm.taobao.org/error-ex/download/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" - dependencies: - is-arrayish "^0.2.1" - -es-abstract@^1.5.1, es-abstract@^1.6.1, es-abstract@^1.7.0: - version "1.12.0" - resolved "http://registry.npm.taobao.org/es-abstract/download/es-abstract-1.12.0.tgz#9dbbdd27c6856f0001421ca18782d786bf8a6165" - dependencies: - es-to-primitive "^1.1.1" - function-bind "^1.1.1" - has "^1.0.1" - is-callable "^1.1.3" - is-regex "^1.0.4" - -es-to-primitive@^1.1.1: - version "1.1.1" - resolved "http://registry.npm.taobao.org/es-to-primitive/download/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d" - dependencies: - is-callable "^1.1.1" - is-date-object "^1.0.1" - is-symbol "^1.0.1" - -es5-ext@^0.10.35, es5-ext@^0.10.9, es5-ext@~0.10.14: - version "0.10.46" - resolved "http://registry.npm.taobao.org/es5-ext/download/es5-ext-0.10.46.tgz#efd99f67c5a7ec789baa3daa7f79870388f7f572" - dependencies: - es6-iterator "~2.0.3" - es6-symbol "~3.1.1" - next-tick "1" - -es6-iterator@~2.0.3: - version "2.0.3" - resolved "http://registry.npm.taobao.org/es6-iterator/download/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" - dependencies: - d "1" - es5-ext "^0.10.35" - es6-symbol "^3.1.1" - -es6-symbol@^3.1.1, es6-symbol@~3.1.1: - version "3.1.1" - resolved "http://registry.npm.taobao.org/es6-symbol/download/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" - dependencies: - d "1" - es5-ext "~0.10.14" - -escape-html@~1.0.3: - version "1.0.3" - resolved "http://registry.npm.taobao.org/escape-html/download/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" - -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "http://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - -eslint-config-airbnb-base@^13.1.0: - version "13.1.0" - resolved "http://registry.npm.taobao.org/eslint-config-airbnb-base/download/eslint-config-airbnb-base-13.1.0.tgz#b5a1b480b80dfad16433d6c4ad84e6605052c05c" - dependencies: - eslint-restricted-globals "^0.1.1" - object.assign "^4.1.0" - object.entries "^1.0.4" - -eslint-config-airbnb@^17.0.0: - version "17.1.0" - resolved "http://registry.npm.taobao.org/eslint-config-airbnb/download/eslint-config-airbnb-17.1.0.tgz#3964ed4bc198240315ff52030bf8636f42bc4732" - dependencies: - eslint-config-airbnb-base "^13.1.0" - object.assign "^4.1.0" - object.entries "^1.0.4" - -eslint-import-resolver-node@^0.3.1: - version "0.3.2" - resolved "http://registry.npm.taobao.org/eslint-import-resolver-node/download/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" - dependencies: - debug "^2.6.9" - resolve "^1.5.0" - -eslint-module-utils@^2.2.0: - version "2.2.0" - resolved "http://registry.npm.taobao.org/eslint-module-utils/download/eslint-module-utils-2.2.0.tgz#b270362cd88b1a48ad308976ce7fa54e98411746" - dependencies: - debug "^2.6.8" - pkg-dir "^1.0.0" - -eslint-plugin-import@^2.13.0: - version "2.14.0" - resolved "http://registry.npm.taobao.org/eslint-plugin-import/download/eslint-plugin-import-2.14.0.tgz#6b17626d2e3e6ad52cfce8807a845d15e22111a8" - dependencies: - contains-path "^0.1.0" - debug "^2.6.8" - doctrine "1.5.0" - eslint-import-resolver-node "^0.3.1" - eslint-module-utils "^2.2.0" - has "^1.0.1" - lodash "^4.17.4" - minimatch "^3.0.3" - read-pkg-up "^2.0.0" - resolve "^1.6.0" - -eslint-plugin-jsx-a11y@^6.1.1: - version "6.1.1" - resolved "http://registry.npm.taobao.org/eslint-plugin-jsx-a11y/download/eslint-plugin-jsx-a11y-6.1.1.tgz#7bf56dbe7d47d811d14dbb3ddff644aa656ce8e1" - dependencies: - aria-query "^3.0.0" - array-includes "^3.0.3" - ast-types-flow "^0.0.7" - axobject-query "^2.0.1" - damerau-levenshtein "^1.0.4" - emoji-regex "^6.5.1" - has "^1.0.3" - jsx-ast-utils "^2.0.1" - -eslint-plugin-react@^7.10.0: - version "7.11.1" - resolved "http://registry.npm.taobao.org/eslint-plugin-react/download/eslint-plugin-react-7.11.1.tgz#c01a7af6f17519457d6116aa94fc6d2ccad5443c" - dependencies: - array-includes "^3.0.3" - doctrine "^2.1.0" - has "^1.0.3" - jsx-ast-utils "^2.0.1" - prop-types "^15.6.2" - -eslint-restricted-globals@^0.1.1: - version "0.1.1" - resolved "http://registry.npm.taobao.org/eslint-restricted-globals/download/eslint-restricted-globals-0.1.1.tgz#35f0d5cbc64c2e3ed62e93b4b1a7af05ba7ed4d7" - -eslint-scope@3.7.1: - version "3.7.1" - resolved "http://registry.npm.taobao.org/eslint-scope/download/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" - dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" - -eslint-scope@^3.7.1: - version "3.7.3" - resolved "http://registry.npm.taobao.org/eslint-scope/download/eslint-scope-3.7.3.tgz#bb507200d3d17f60247636160b4826284b108535" - dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" - -eslint-scope@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/eslint-scope/download/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172" - dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" - -eslint-visitor-keys@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/eslint-visitor-keys/download/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" - -eslint@^4.19.1: - version "4.19.1" - resolved "http://registry.npm.taobao.org/eslint/download/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300" - dependencies: - ajv "^5.3.0" - babel-code-frame "^6.22.0" - chalk "^2.1.0" - concat-stream "^1.6.0" - cross-spawn "^5.1.0" - debug "^3.1.0" - doctrine "^2.1.0" - eslint-scope "^3.7.1" - eslint-visitor-keys "^1.0.0" - espree "^3.5.4" - esquery "^1.0.0" - esutils "^2.0.2" - file-entry-cache "^2.0.0" - functional-red-black-tree "^1.0.1" - glob "^7.1.2" - globals "^11.0.1" - ignore "^3.3.3" - imurmurhash "^0.1.4" - inquirer "^3.0.6" - is-resolvable "^1.0.0" - js-yaml "^3.9.1" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.4" - minimatch "^3.0.2" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" - pluralize "^7.0.0" - progress "^2.0.0" - regexpp "^1.0.1" - require-uncached "^1.0.3" - semver "^5.3.0" - strip-ansi "^4.0.0" - strip-json-comments "~2.0.1" - table "4.0.2" - text-table "~0.2.0" - -espree@^3.5.4: - version "3.5.4" - resolved "http://registry.npm.taobao.org/espree/download/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" - dependencies: - acorn "^5.5.0" - acorn-jsx "^3.0.0" - -esprima@^4.0.0: - version "4.0.1" - resolved "http://registry.npm.taobao.org/esprima/download/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - -esquery@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.taobao.org/esquery/download/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" - dependencies: - estraverse "^4.0.0" - -esrecurse@^4.1.0: - version "4.2.1" - resolved "http://registry.npm.taobao.org/esrecurse/download/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" - dependencies: - estraverse "^4.1.0" - -estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: - version "4.2.0" - resolved "http://registry.npm.taobao.org/estraverse/download/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" - -esutils@^2.0.2: - version "2.0.2" - resolved "http://registry.npm.taobao.org/esutils/download/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" - -etag@~1.8.1: - version "1.8.1" - resolved "http://registry.npm.taobao.org/etag/download/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" - -eventemitter3@^3.0.0: - version "3.1.0" - resolved "http://registry.npm.taobao.org/eventemitter3/download/eventemitter3-3.1.0.tgz#090b4d6cdbd645ed10bf750d4b5407942d7ba163" - -eventlistener@0.0.1: - version "0.0.1" - resolved "http://registry.npm.taobao.org/eventlistener/download/eventlistener-0.0.1.tgz#ed2baabb852227af2bcf889152c72c63ca532eb8" - -events@^1.0.0: - version "1.1.1" - resolved "http://registry.npm.taobao.org/events/download/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" - -eventsource@0.1.6: - version "0.1.6" - resolved "http://registry.npm.taobao.org/eventsource/download/eventsource-0.1.6.tgz#0acede849ed7dd1ccc32c811bb11b944d4f29232" - dependencies: - original ">=0.0.5" - -evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: - version "1.0.3" - resolved "http://registry.npm.taobao.org/evp_bytestokey/download/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" - dependencies: - md5.js "^1.3.4" - safe-buffer "^5.1.1" - -execa@^0.7.0: - version "0.7.0" - resolved "http://registry.npm.taobao.org/execa/download/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" - dependencies: - cross-spawn "^5.0.1" - get-stream "^3.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" - -expand-brackets@^2.1.4: - version "2.1.4" - resolved "http://registry.npm.taobao.org/expand-brackets/download/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" - dependencies: - debug "^2.3.3" - define-property "^0.2.5" - extend-shallow "^2.0.1" - posix-character-classes "^0.1.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -express@^4.16.2: - version "4.16.3" - resolved "http://registry.npm.taobao.org/express/download/express-4.16.3.tgz#6af8a502350db3246ecc4becf6b5a34d22f7ed53" - dependencies: - accepts "~1.3.5" - array-flatten "1.1.1" - body-parser "1.18.2" - content-disposition "0.5.2" - content-type "~1.0.4" - cookie "0.3.1" - cookie-signature "1.0.6" - debug "2.6.9" - depd "~1.1.2" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - finalhandler "1.1.1" - fresh "0.5.2" - merge-descriptors "1.0.1" - methods "~1.1.2" - on-finished "~2.3.0" - parseurl "~1.3.2" - path-to-regexp "0.1.7" - proxy-addr "~2.0.3" - qs "6.5.1" - range-parser "~1.2.0" - safe-buffer "5.1.1" - send "0.16.2" - serve-static "1.13.2" - setprototypeof "1.1.0" - statuses "~1.4.0" - type-is "~1.6.16" - utils-merge "1.0.1" - vary "~1.1.2" - -extend-shallow@^2.0.1: - version "2.0.1" - resolved "http://registry.npm.taobao.org/extend-shallow/download/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" - dependencies: - is-extendable "^0.1.0" - -extend-shallow@^3.0.0, extend-shallow@^3.0.2: - version "3.0.2" - resolved "http://registry.npm.taobao.org/extend-shallow/download/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" - dependencies: - assign-symbols "^1.0.0" - is-extendable "^1.0.1" - -external-editor@^2.0.4: - version "2.2.0" - resolved "http://registry.npm.taobao.org/external-editor/download/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5" - dependencies: - chardet "^0.4.0" - iconv-lite "^0.4.17" - tmp "^0.0.33" - -external-editor@^3.0.0: - version "3.0.1" - resolved "http://registry.npm.taobao.org/external-editor/download/external-editor-3.0.1.tgz#fc9638c4d7cde4f0bb82b12307a1a23912c492e3" - dependencies: - chardet "^0.5.0" - iconv-lite "^0.4.22" - tmp "^0.0.33" - -extglob@^2.0.4: - version "2.0.4" - resolved "http://registry.npm.taobao.org/extglob/download/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" - dependencies: - array-unique "^0.3.2" - define-property "^1.0.0" - expand-brackets "^2.1.4" - extend-shallow "^2.0.1" - fragment-cache "^0.2.1" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -fast-deep-equal@^1.0.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/fast-deep-equal/download/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" - -fast-deep-equal@^2.0.1: - version "2.0.1" - resolved "http://registry.npm.taobao.org/fast-deep-equal/download/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" - -fast-json-stable-stringify@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/fast-json-stable-stringify/download/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" - -fast-levenshtein@~2.0.4: - version "2.0.6" - resolved "http://registry.npm.taobao.org/fast-levenshtein/download/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" - -fastparse@^1.1.1: - version "1.1.1" - resolved "http://registry.npm.taobao.org/fastparse/download/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" - -fault@^1.0.2: - version "1.0.2" - resolved "http://registry.npm.taobao.org/fault/download/fault-1.0.2.tgz#c3d0fec202f172a3a4d414042ad2bb5e2a3ffbaa" - dependencies: - format "^0.2.2" - -faye-websocket@^0.10.0: - version "0.10.0" - resolved "http://registry.npm.taobao.org/faye-websocket/download/faye-websocket-0.10.0.tgz#4e492f8d04dfb6f89003507f6edbf2d501e7c6f4" - dependencies: - websocket-driver ">=0.5.1" - -faye-websocket@~0.11.0: - version "0.11.1" - resolved "http://registry.npm.taobao.org/faye-websocket/download/faye-websocket-0.11.1.tgz#f0efe18c4f56e4f40afc7e06c719fd5ee6188f38" - dependencies: - websocket-driver ">=0.5.1" - -fbjs@^0.8.0, fbjs@^0.8.15, fbjs@^0.8.16, fbjs@^0.8.9: - version "0.8.17" - resolved "http://registry.npm.taobao.org/fbjs/download/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd" - dependencies: - core-js "^1.0.0" - isomorphic-fetch "^2.1.1" - loose-envify "^1.0.0" - object-assign "^4.1.0" - promise "^7.1.1" - setimmediate "^1.0.5" - ua-parser-js "^0.7.18" - -figures@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/figures/download/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" - dependencies: - escape-string-regexp "^1.0.5" - -file-entry-cache@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/file-entry-cache/download/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" - dependencies: - flat-cache "^1.2.1" - object-assign "^4.0.1" - -filesize@^3.5.11: - version "3.6.1" - resolved "http://registry.npm.taobao.org/filesize/download/filesize-3.6.1.tgz#090bb3ee01b6f801a8a8be99d31710b3422bb317" - -fill-range@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/fill-range/download/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" - dependencies: - extend-shallow "^2.0.1" - is-number "^3.0.0" - repeat-string "^1.6.1" - to-regex-range "^2.1.0" - -finalhandler@1.1.1: - version "1.1.1" - resolved "http://registry.npm.taobao.org/finalhandler/download/finalhandler-1.1.1.tgz#eebf4ed840079c83f4249038c9d703008301b105" - dependencies: - debug "2.6.9" - encodeurl "~1.0.2" - escape-html "~1.0.3" - on-finished "~2.3.0" - parseurl "~1.3.2" - statuses "~1.4.0" - unpipe "~1.0.0" - -find-cache-dir@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/find-cache-dir/download/find-cache-dir-1.0.0.tgz#9288e3e9e3cc3748717d39eade17cf71fc30ee6f" - dependencies: - commondir "^1.0.1" - make-dir "^1.0.0" - pkg-dir "^2.0.0" - -find-up@^1.0.0: - version "1.1.2" - resolved "http://registry.npm.taobao.org/find-up/download/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" - dependencies: - path-exists "^2.0.0" - pinkie-promise "^2.0.0" - -find-up@^2.0.0, find-up@^2.1.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/find-up/download/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" - dependencies: - locate-path "^2.0.0" - -find-up@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/find-up/download/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" - dependencies: - locate-path "^3.0.0" - -flat-cache@^1.2.1: - version "1.3.0" - resolved "http://registry.npm.taobao.org/flat-cache/download/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" - dependencies: - circular-json "^0.3.1" - del "^2.0.2" - graceful-fs "^4.1.2" - write "^0.2.1" - -flatten@^1.0.2: - version "1.0.2" - resolved "http://registry.npm.taobao.org/flatten/download/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782" - -flush-write-stream@^1.0.0: - version "1.0.3" - resolved "http://registry.npm.taobao.org/flush-write-stream/download/flush-write-stream-1.0.3.tgz#c5d586ef38af6097650b49bc41b55fabb19f35bd" - dependencies: - inherits "^2.0.1" - readable-stream "^2.0.4" - -follow-redirects@^1.0.0: - version "1.5.5" - resolved "http://registry.npm.taobao.org/follow-redirects/download/follow-redirects-1.5.5.tgz#3c143ca599a2e22e62876687d68b23d55bad788b" - dependencies: - debug "^3.1.0" - -for-in@^1.0.2: - version "1.0.2" - resolved "http://registry.npm.taobao.org/for-in/download/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" - -format@^0.2.2: - version "0.2.2" - resolved "http://registry.npm.taobao.org/format/download/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b" - -forwarded@~0.1.2: - version "0.1.2" - resolved "http://registry.npm.taobao.org/forwarded/download/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" - -fragment-cache@^0.2.1: - version "0.2.1" - resolved "http://registry.npm.taobao.org/fragment-cache/download/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" - dependencies: - map-cache "^0.2.2" - -fresh@0.5.2: - version "0.5.2" - resolved "http://registry.npm.taobao.org/fresh/download/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" - -from2@^2.1.0: - version "2.3.0" - resolved "http://registry.npm.taobao.org/from2/download/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af" - dependencies: - inherits "^2.0.1" - readable-stream "^2.0.0" - -fs-minipass@^1.2.5: - version "1.2.5" - resolved "http://registry.npm.taobao.org/fs-minipass/download/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d" - dependencies: - minipass "^2.2.1" - -fs-write-stream-atomic@^1.0.8: - version "1.0.10" - resolved "http://registry.npm.taobao.org/fs-write-stream-atomic/download/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" - dependencies: - graceful-fs "^4.1.2" - iferr "^0.1.5" - imurmurhash "^0.1.4" - readable-stream "1 || 2" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/fs.realpath/download/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - -fsevents@^1.2.2: - version "1.2.4" - resolved "http://registry.npm.taobao.org/fsevents/download/fsevents-1.2.4.tgz#f41dcb1af2582af3692da36fc55cbd8e1041c426" - dependencies: - nan "^2.9.2" - node-pre-gyp "^0.10.0" - -function-bind@^1.1.0, function-bind@^1.1.1: - version "1.1.1" - resolved "http://registry.npm.taobao.org/function-bind/download/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" - -functional-red-black-tree@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/functional-red-black-tree/download/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" - -gauge@~2.7.3: - version "2.7.4" - resolved "http://registry.npm.taobao.org/gauge/download/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" - dependencies: - aproba "^1.0.3" - console-control-strings "^1.0.0" - has-unicode "^2.0.0" - object-assign "^4.1.0" - signal-exit "^3.0.0" - string-width "^1.0.1" - strip-ansi "^3.0.1" - wide-align "^1.1.0" - -get-caller-file@^1.0.1: - version "1.0.3" - resolved "http://registry.npm.taobao.org/get-caller-file/download/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" - -get-stdin@^4.0.1: - version "4.0.1" - resolved "http://registry.npm.taobao.org/get-stdin/download/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" - -get-stream@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/get-stream/download/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" - -get-value@^2.0.3, get-value@^2.0.6: - version "2.0.6" - resolved "http://registry.npm.taobao.org/get-value/download/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" - -glob-parent@^3.1.0: - version "3.1.0" - resolved "http://registry.npm.taobao.org/glob-parent/download/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" - dependencies: - is-glob "^3.1.0" - path-dirname "^1.0.0" - -glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: - version "7.1.2" - resolved "http://registry.npm.taobao.org/glob/download/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -global-modules-path@^2.1.0: - version "2.3.0" - resolved "http://registry.npm.taobao.org/global-modules-path/download/global-modules-path-2.3.0.tgz#b0e2bac6beac39745f7db5c59d26a36a0b94f7dc" - -globals@^11.0.1, globals@^11.1.0: - version "11.7.0" - resolved "http://registry.npm.taobao.org/globals/download/globals-11.7.0.tgz#a583faa43055b1aca771914bf68258e2fc125673" - -globals@^9.18.0: - version "9.18.0" - resolved "http://registry.npm.taobao.org/globals/download/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" - -globby@^5.0.0: - version "5.0.0" - resolved "http://registry.npm.taobao.org/globby/download/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" - dependencies: - array-union "^1.0.1" - arrify "^1.0.0" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - -globby@^6.1.0: - version "6.1.0" - resolved "http://registry.npm.taobao.org/globby/download/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" - dependencies: - array-union "^1.0.1" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - -good-listener@^1.2.2: - version "1.2.2" - resolved "http://registry.npm.taobao.org/good-listener/download/good-listener-1.2.2.tgz#d53b30cdf9313dffb7dc9a0d477096aa6d145c50" - dependencies: - delegate "^3.1.2" - -graceful-fs@^4.1.11, graceful-fs@^4.1.2: - version "4.1.11" - resolved "http://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" - -gud@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/gud/download/gud-1.0.0.tgz#a489581b17e6a70beca9abe3ae57de7a499852c0" - -gzip-size@^4.1.0: - version "4.1.0" - resolved "http://registry.npm.taobao.org/gzip-size/download/gzip-size-4.1.0.tgz#8ae096257eabe7d69c45be2b67c448124ffb517c" - dependencies: - duplexer "^0.1.1" - pify "^3.0.0" - -hammerjs@^2.0.8: - version "2.0.8" - resolved "http://registry.npm.taobao.org/hammerjs/download/hammerjs-2.0.8.tgz#04ef77862cff2bb79d30f7692095930222bf60f1" - -handle-thing@^1.2.5: - version "1.2.5" - resolved "http://registry.npm.taobao.org/handle-thing/download/handle-thing-1.2.5.tgz#fd7aad726bf1a5fd16dfc29b2f7a6601d27139c4" - -has-ansi@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/has-ansi/download/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" - dependencies: - ansi-regex "^2.0.0" - -has-flag@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/has-flag/download/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - -has-symbols@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/has-symbols/download/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" - -has-unicode@^2.0.0: - version "2.0.1" - resolved "http://registry.npm.taobao.org/has-unicode/download/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" - -has-value@^0.3.1: - version "0.3.1" - resolved "http://registry.npm.taobao.org/has-value/download/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" - dependencies: - get-value "^2.0.3" - has-values "^0.1.4" - isobject "^2.0.0" - -has-value@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/has-value/download/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" - dependencies: - get-value "^2.0.6" - has-values "^1.0.0" - isobject "^3.0.0" - -has-values@^0.1.4: - version "0.1.4" - resolved "http://registry.npm.taobao.org/has-values/download/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" - -has-values@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/has-values/download/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" - dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" - -has@^1.0.0, has@^1.0.1, has@^1.0.3: - version "1.0.3" - resolved "http://registry.npm.taobao.org/has/download/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" - dependencies: - function-bind "^1.1.1" - -hash-base@^3.0.0: - version "3.0.4" - resolved "http://registry.npm.taobao.org/hash-base/download/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918" - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.5" - resolved "http://registry.npm.taobao.org/hash.js/download/hash.js-1.1.5.tgz#e38ab4b85dfb1e0c40fe9265c0e9b54854c23812" - dependencies: - inherits "^2.0.3" - minimalistic-assert "^1.0.1" - -hast-util-parse-selector@^2.2.0: - version "2.2.0" - resolved "http://registry.npm.taobao.org/hast-util-parse-selector/download/hast-util-parse-selector-2.2.0.tgz#2175f18cdd697308fc3431d5c29a9e48dfa4817a" - -hastscript@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/hastscript/download/hastscript-4.0.0.tgz#653f7f4f7aedb9e6c629af8c13707553f5671c77" - dependencies: - comma-separated-tokens "^1.0.0" - hast-util-parse-selector "^2.2.0" - property-information "^4.0.0" - space-separated-tokens "^1.0.0" - -he@1.1.x: - version "1.1.1" - resolved "http://registry.npm.taobao.org/he/download/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" - -hex-color-regex@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/hex-color-regex/download/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e" - -highlight.js@~9.12.0: - version "9.12.0" - resolved "http://registry.npm.taobao.org/highlight.js/download/highlight.js-9.12.0.tgz#e6d9dbe57cbefe60751f02af336195870c90c01e" - -history@^4.7.2: - version "4.7.2" - resolved "http://registry.npm.taobao.org/history/download/history-4.7.2.tgz#22b5c7f31633c5b8021c7f4a8a954ac139ee8d5b" - dependencies: - invariant "^2.2.1" - loose-envify "^1.2.0" - resolve-pathname "^2.2.0" - value-equal "^0.4.0" - warning "^3.0.0" - -hmac-drbg@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.taobao.org/hmac-drbg/download/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" - dependencies: - hash.js "^1.0.3" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.1" - -hoist-non-react-statics@^2.3.1, hoist-non-react-statics@^2.5.0: - version "2.5.5" - resolved "http://registry.npm.taobao.org/hoist-non-react-statics/download/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47" - -home-or-tmp@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/home-or-tmp/download/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" - dependencies: - os-homedir "^1.0.0" - os-tmpdir "^1.0.1" - -hosted-git-info@^2.1.4: - version "2.7.1" - resolved "http://registry.npm.taobao.org/hosted-git-info/download/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" - -hpack.js@^2.1.6: - version "2.1.6" - resolved "http://registry.npm.taobao.org/hpack.js/download/hpack.js-2.1.6.tgz#87774c0949e513f42e84575b3c45681fade2a0b2" - dependencies: - inherits "^2.0.1" - obuf "^1.0.0" - readable-stream "^2.0.1" - wbuf "^1.1.0" - -hsl-regex@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/hsl-regex/download/hsl-regex-1.0.0.tgz#d49330c789ed819e276a4c0d272dffa30b18fe6e" - -hsla-regex@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/hsla-regex/download/hsla-regex-1.0.0.tgz#c1ce7a3168c8c6614033a4b5f7877f3b225f9c38" - -html-comment-regex@^1.1.0: - version "1.1.1" - resolved "http://registry.npm.taobao.org/html-comment-regex/download/html-comment-regex-1.1.1.tgz#668b93776eaae55ebde8f3ad464b307a4963625e" - -html-entities@^1.2.0: - version "1.2.1" - resolved "http://registry.npm.taobao.org/html-entities/download/html-entities-1.2.1.tgz#0df29351f0721163515dfb9e5543e5f6eed5162f" - -html-minifier@^3.2.3: - version "3.5.19" - resolved "http://registry.npm.taobao.org/html-minifier/download/html-minifier-3.5.19.tgz#ed53c4b7326fe507bc3a1adbcc3bbb56660a2ebd" - dependencies: - camel-case "3.0.x" - clean-css "4.1.x" - commander "2.16.x" - he "1.1.x" - param-case "2.1.x" - relateurl "0.2.x" - uglify-js "3.4.x" - -html-webpack-plugin@^3.2.0: - version "3.2.0" - resolved "http://registry.npm.taobao.org/html-webpack-plugin/download/html-webpack-plugin-3.2.0.tgz#b01abbd723acaaa7b37b6af4492ebda03d9dd37b" - dependencies: - html-minifier "^3.2.3" - loader-utils "^0.2.16" - lodash "^4.17.3" - pretty-error "^2.0.2" - tapable "^1.0.0" - toposort "^1.0.0" - util.promisify "1.0.0" - -htmlparser2@~3.3.0: - version "3.3.0" - resolved "http://registry.npm.taobao.org/htmlparser2/download/htmlparser2-3.3.0.tgz#cc70d05a59f6542e43f0e685c982e14c924a9efe" - dependencies: - domelementtype "1" - domhandler "2.1" - domutils "1.1" - readable-stream "1.0" - -http-deceiver@^1.2.7: - version "1.2.7" - resolved "http://registry.npm.taobao.org/http-deceiver/download/http-deceiver-1.2.7.tgz#fa7168944ab9a519d337cb0bec7284dc3e723d87" - -http-errors@1.6.2: - version "1.6.2" - resolved "http://registry.npm.taobao.org/http-errors/download/http-errors-1.6.2.tgz#0a002cc85707192a7e7946ceedc11155f60ec736" - dependencies: - depd "1.1.1" - inherits "2.0.3" - setprototypeof "1.0.3" - statuses ">= 1.3.1 < 2" - -http-errors@~1.6.2: - version "1.6.3" - resolved "http://registry.npm.taobao.org/http-errors/download/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" - dependencies: - depd "~1.1.2" - inherits "2.0.3" - setprototypeof "1.1.0" - statuses ">= 1.4.0 < 2" - -http-parser-js@>=0.4.0: - version "0.4.13" - resolved "http://registry.npm.taobao.org/http-parser-js/download/http-parser-js-0.4.13.tgz#3bd6d6fde6e3172c9334c3b33b6c193d80fe1137" - -http-proxy-middleware@~0.18.0: - version "0.18.0" - resolved "http://registry.npm.taobao.org/http-proxy-middleware/download/http-proxy-middleware-0.18.0.tgz#0987e6bb5a5606e5a69168d8f967a87f15dd8aab" - dependencies: - http-proxy "^1.16.2" - is-glob "^4.0.0" - lodash "^4.17.5" - micromatch "^3.1.9" - -http-proxy@^1.16.2: - version "1.17.0" - resolved "http://registry.npm.taobao.org/http-proxy/download/http-proxy-1.17.0.tgz#7ad38494658f84605e2f6db4436df410f4e5be9a" - dependencies: - eventemitter3 "^3.0.0" - follow-redirects "^1.0.0" - requires-port "^1.0.0" - -https-browserify@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/https-browserify/download/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" - -iconv-lite@0.4.19: - version "0.4.19" - resolved "http://registry.npm.taobao.org/iconv-lite/download/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" - -iconv-lite@^0.4.17, iconv-lite@^0.4.22, iconv-lite@^0.4.4, iconv-lite@~0.4.13: - version "0.4.23" - resolved "http://registry.npm.taobao.org/iconv-lite/download/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63" - dependencies: - safer-buffer ">= 2.1.2 < 3" - -icss-replace-symbols@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/icss-replace-symbols/download/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded" - -icss-utils@^2.1.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/icss-utils/download/icss-utils-2.1.0.tgz#83f0a0ec378bf3246178b6c2ad9136f135b1c962" - dependencies: - postcss "^6.0.1" - -ieee754@^1.1.11, ieee754@^1.1.4: - version "1.1.12" - resolved "http://registry.npm.taobao.org/ieee754/download/ieee754-1.1.12.tgz#50bf24e5b9c8bb98af4964c941cdb0918da7b60b" - -iferr@^0.1.5: - version "0.1.5" - resolved "http://registry.npm.taobao.org/iferr/download/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" - -ignore-walk@^3.0.1: - version "3.0.1" - resolved "http://registry.npm.taobao.org/ignore-walk/download/ignore-walk-3.0.1.tgz#a83e62e7d272ac0e3b551aaa82831a19b69f82f8" - dependencies: - minimatch "^3.0.4" - -ignore@^3.3.3: - version "3.3.10" - resolved "http://registry.npm.taobao.org/ignore/download/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" - -immutable@^3.7.4: - version "3.8.2" - resolved "http://registry.npm.taobao.org/immutable/download/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3" - -immutable@~3.7.4: - version "3.7.6" - resolved "http://registry.npm.taobao.org/immutable/download/immutable-3.7.6.tgz#13b4d3cb12befa15482a26fe1b2ebae640071e4b" - -import-local@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/import-local/download/import-local-1.0.0.tgz#5e4ffdc03f4fe6c009c6729beb29631c2f8227bc" - dependencies: - pkg-dir "^2.0.0" - resolve-cwd "^2.0.0" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "http://registry.npm.taobao.org/imurmurhash/download/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - -indent-string@^2.1.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/indent-string/download/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" - dependencies: - repeating "^2.0.0" - -indexes-of@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/indexes-of/download/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607" - -indexof@0.0.1: - version "0.0.1" - resolved "http://registry.npm.taobao.org/indexof/download/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" - -inflight@^1.0.4: - version "1.0.6" - resolved "http://registry.npm.taobao.org/inflight/download/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@2.0.3, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3: - version "2.0.3" - resolved "http://registry.npm.taobao.org/inherits/download/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - -inherits@2.0.1: - version "2.0.1" - resolved "http://registry.npm.taobao.org/inherits/download/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" - -ini@~1.3.0: - version "1.3.5" - resolved "http://registry.npm.taobao.org/ini/download/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" - -inquirer@^3.0.6: - version "3.3.0" - resolved "http://registry.npm.taobao.org/inquirer/download/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" - dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.0" - cli-cursor "^2.1.0" - cli-width "^2.0.0" - external-editor "^2.0.4" - figures "^2.0.0" - lodash "^4.3.0" - mute-stream "0.0.7" - run-async "^2.2.0" - rx-lite "^4.0.8" - rx-lite-aggregates "^4.0.8" - string-width "^2.1.0" - strip-ansi "^4.0.0" - through "^2.3.6" - -inquirer@^6.0.0: - version "6.1.0" - resolved "http://registry.npm.taobao.org/inquirer/download/inquirer-6.1.0.tgz#8f65c7b31c498285f4ddf3b742ad8c487892040b" - dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.0" - cli-cursor "^2.1.0" - cli-width "^2.0.0" - external-editor "^3.0.0" - figures "^2.0.0" - lodash "^4.3.0" - mute-stream "0.0.7" - run-async "^2.2.0" - rxjs "^6.1.0" - string-width "^2.1.0" - strip-ansi "^4.0.0" - through "^2.3.6" - -internal-ip@1.2.0: - version "1.2.0" - resolved "http://registry.npm.taobao.org/internal-ip/download/internal-ip-1.2.0.tgz#ae9fbf93b984878785d50a8de1b356956058cf5c" - dependencies: - meow "^3.3.0" - -interpret@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/interpret/download/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" - -intersperse@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/intersperse/download/intersperse-1.0.0.tgz#f2561fb1cfef9f5277cc3347a22886b4351a5181" - -invariant@^2.2.0, invariant@^2.2.1, invariant@^2.2.2, invariant@^2.2.4: - version "2.2.4" - resolved "http://registry.npm.taobao.org/invariant/download/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" - dependencies: - loose-envify "^1.0.0" - -invert-kv@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/invert-kv/download/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" - -ip@^1.1.0, ip@^1.1.5: - version "1.1.5" - resolved "http://registry.npm.taobao.org/ip/download/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" - -ipaddr.js@1.8.0: - version "1.8.0" - resolved "http://registry.npm.taobao.org/ipaddr.js/download/ipaddr.js-1.8.0.tgz#eaa33d6ddd7ace8f7f6fe0c9ca0440e706738b1e" - -is-absolute-url@^2.0.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/is-absolute-url/download/is-absolute-url-2.1.0.tgz#50530dfb84fcc9aa7dbe7852e83a37b93b9f2aa6" - -is-accessor-descriptor@^0.1.6: - version "0.1.6" - resolved "http://registry.npm.taobao.org/is-accessor-descriptor/download/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" - dependencies: - kind-of "^3.0.2" - -is-accessor-descriptor@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/is-accessor-descriptor/download/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" - dependencies: - kind-of "^6.0.0" - -is-alphabetical@^1.0.0: - version "1.0.2" - resolved "http://registry.npm.taobao.org/is-alphabetical/download/is-alphabetical-1.0.2.tgz#1fa6e49213cb7885b75d15862fb3f3d96c884f41" - -is-alphanumerical@^1.0.0: - version "1.0.2" - resolved "http://registry.npm.taobao.org/is-alphanumerical/download/is-alphanumerical-1.0.2.tgz#1138e9ae5040158dc6ff76b820acd6b7a181fd40" - dependencies: - is-alphabetical "^1.0.0" - is-decimal "^1.0.0" - -is-arrayish@^0.2.1: - version "0.2.1" - resolved "http://registry.npm.taobao.org/is-arrayish/download/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - -is-arrayish@^0.3.1: - version "0.3.2" - resolved "http://registry.npm.taobao.org/is-arrayish/download/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03" - -is-binary-path@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.taobao.org/is-binary-path/download/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" - dependencies: - binary-extensions "^1.0.0" - -is-buffer@^1.1.5: - version "1.1.6" - resolved "http://registry.npm.taobao.org/is-buffer/download/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" - -is-builtin-module@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/is-builtin-module/download/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" - dependencies: - builtin-modules "^1.0.0" - -is-callable@^1.1.1, is-callable@^1.1.3: - version "1.1.4" - resolved "http://registry.npm.taobao.org/is-callable/download/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" - -is-color-stop@^1.0.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/is-color-stop/download/is-color-stop-1.1.0.tgz#cfff471aee4dd5c9e158598fbe12967b5cdad345" - dependencies: - css-color-names "^0.0.4" - hex-color-regex "^1.1.0" - hsl-regex "^1.0.0" - hsla-regex "^1.0.0" - rgb-regex "^1.0.1" - rgba-regex "^1.0.0" - -is-data-descriptor@^0.1.4: - version "0.1.4" - resolved "http://registry.npm.taobao.org/is-data-descriptor/download/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" - dependencies: - kind-of "^3.0.2" - -is-data-descriptor@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/is-data-descriptor/download/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" - dependencies: - kind-of "^6.0.0" - -is-date-object@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/is-date-object/download/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" - -is-decimal@^1.0.0: - version "1.0.2" - resolved "http://registry.npm.taobao.org/is-decimal/download/is-decimal-1.0.2.tgz#894662d6a8709d307f3a276ca4339c8fa5dff0ff" - -is-descriptor@^0.1.0: - version "0.1.6" - resolved "http://registry.npm.taobao.org/is-descriptor/download/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" - dependencies: - is-accessor-descriptor "^0.1.6" - is-data-descriptor "^0.1.4" - kind-of "^5.0.0" - -is-descriptor@^1.0.0, is-descriptor@^1.0.2: - version "1.0.2" - resolved "http://registry.npm.taobao.org/is-descriptor/download/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" - dependencies: - is-accessor-descriptor "^1.0.0" - is-data-descriptor "^1.0.0" - kind-of "^6.0.2" - -is-directory@^0.3.1: - version "0.3.1" - resolved "http://registry.npm.taobao.org/is-directory/download/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" - -is-extendable@^0.1.0, is-extendable@^0.1.1: - version "0.1.1" - resolved "http://registry.npm.taobao.org/is-extendable/download/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" - -is-extendable@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/is-extendable/download/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" - dependencies: - is-plain-object "^2.0.4" - -is-extglob@^2.1.0, is-extglob@^2.1.1: - version "2.1.1" - resolved "http://registry.npm.taobao.org/is-extglob/download/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - -is-finite@^1.0.0: - version "1.0.2" - resolved "http://registry.npm.taobao.org/is-finite/download/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" - dependencies: - number-is-nan "^1.0.0" - -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - dependencies: - number-is-nan "^1.0.0" - -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - -is-glob@^3.1.0: - version "3.1.0" - resolved "http://registry.npm.taobao.org/is-glob/download/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" - dependencies: - is-extglob "^2.1.0" - -is-glob@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/is-glob/download/is-glob-4.0.0.tgz#9521c76845cc2610a85203ddf080a958c2ffabc0" - dependencies: - is-extglob "^2.1.1" - -is-hexadecimal@^1.0.0: - version "1.0.2" - resolved "http://registry.npm.taobao.org/is-hexadecimal/download/is-hexadecimal-1.0.2.tgz#b6e710d7d07bb66b98cb8cece5c9b4921deeb835" - -is-negative-zero@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/is-negative-zero/download/is-negative-zero-2.0.0.tgz#9553b121b0fac28869da9ed459e20c7543788461" - -is-number@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/is-number/download/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" - dependencies: - kind-of "^3.0.2" - -is-obj@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.taobao.org/is-obj/download/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" - -is-path-cwd@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/is-path-cwd/download/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" - -is-path-in-cwd@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.taobao.org/is-path-in-cwd/download/is-path-in-cwd-1.0.1.tgz#5ac48b345ef675339bd6c7a48a912110b241cf52" - dependencies: - is-path-inside "^1.0.0" - -is-path-inside@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.taobao.org/is-path-inside/download/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" - dependencies: - path-is-inside "^1.0.1" - -is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: - version "2.0.4" - resolved "http://registry.npm.taobao.org/is-plain-object/download/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" - dependencies: - isobject "^3.0.1" - -is-promise@^2.1.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/is-promise/download/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" - -is-regex@^1.0.4: - version "1.0.4" - resolved "http://registry.npm.taobao.org/is-regex/download/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" - dependencies: - has "^1.0.1" - -is-resolvable@^1.0.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/is-resolvable/download/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" - -is-stream@^1.0.1, is-stream@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/is-stream/download/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - -is-svg@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/is-svg/download/is-svg-3.0.0.tgz#9321dbd29c212e5ca99c4fa9794c714bcafa2f75" - dependencies: - html-comment-regex "^1.1.0" - -is-symbol@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/is-symbol/download/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" - -is-utf8@^0.2.0: - version "0.2.1" - resolved "http://registry.npm.taobao.org/is-utf8/download/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" - -is-windows@^1.0.2: - version "1.0.2" - resolved "http://registry.npm.taobao.org/is-windows/download/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" - -is-wsl@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/is-wsl/download/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" - -isarray@0.0.1: - version "0.0.1" - resolved "http://registry.npm.taobao.org/isarray/download/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" - -isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/isarray/download/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - -isexe@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/isexe/download/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - -isobject@^2.0.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/isobject/download/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" - dependencies: - isarray "1.0.0" - -isobject@^3.0.0, isobject@^3.0.1: - version "3.0.1" - resolved "http://registry.npm.taobao.org/isobject/download/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" - -isomorphic-fetch@^2.1.1: - version "2.2.1" - resolved "http://registry.npm.taobao.org/isomorphic-fetch/download/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" - dependencies: - node-fetch "^1.0.1" - whatwg-fetch ">=0.10.0" - -js-tokens@^3.0.0, js-tokens@^3.0.2: - version "3.0.2" - resolved "http://registry.npm.taobao.org/js-tokens/download/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" - -"js-tokens@^3.0.0 || ^4.0.0": - version "4.0.0" - resolved "http://registry.npm.taobao.org/js-tokens/download/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - -js-yaml@^3.9.0, js-yaml@^3.9.1: - version "3.12.0" - resolved "http://registry.npm.taobao.org/js-yaml/download/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -js-yaml@~3.10.0: - version "3.10.0" - resolved "http://registry.npm.taobao.org/js-yaml/download/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -jsesc@^1.3.0: - version "1.3.0" - resolved "http://registry.npm.taobao.org/jsesc/download/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" - -jsesc@^2.5.1: - version "2.5.1" - resolved "http://registry.npm.taobao.org/jsesc/download/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe" - -jsesc@~0.5.0: - version "0.5.0" - resolved "http://registry.npm.taobao.org/jsesc/download/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" - -json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2: - version "1.0.2" - resolved "http://registry.npm.taobao.org/json-parse-better-errors/download/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" - -json-schema-traverse@^0.3.0: - version "0.3.1" - resolved "http://registry.npm.taobao.org/json-schema-traverse/download/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" - -json-schema-traverse@^0.4.1: - version "0.4.1" - resolved "http://registry.npm.taobao.org/json-schema-traverse/download/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" - -json-stable-stringify-without-jsonify@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/json-stable-stringify-without-jsonify/download/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" - -json2mq@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/json2mq/download/json2mq-0.2.0.tgz#b637bd3ba9eabe122c83e9720483aeb10d2c904a" - dependencies: - string-convert "^0.2.0" - -json3@^3.3.2: - version "3.3.2" - resolved "http://registry.npm.taobao.org/json3/download/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" - -json5@^0.5.0, json5@^0.5.1: - version "0.5.1" - resolved "http://registry.npm.taobao.org/json5/download/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" - -jsx-ast-utils@^2.0.1: - version "2.0.1" - resolved "http://registry.npm.taobao.org/jsx-ast-utils/download/jsx-ast-utils-2.0.1.tgz#e801b1b39985e20fffc87b40e3748080e2dcac7f" - dependencies: - array-includes "^3.0.3" - -killable@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/killable/download/killable-1.0.0.tgz#da8b84bd47de5395878f95d64d02f2449fe05e6b" - -kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: - version "3.2.2" - resolved "http://registry.npm.taobao.org/kind-of/download/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" - dependencies: - is-buffer "^1.1.5" - -kind-of@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/kind-of/download/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" - dependencies: - is-buffer "^1.1.5" - -kind-of@^5.0.0: - version "5.1.0" - resolved "http://registry.npm.taobao.org/kind-of/download/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" - -kind-of@^6.0.0, kind-of@^6.0.2: - version "6.0.2" - resolved "http://registry.npm.taobao.org/kind-of/download/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" - -last-call-webpack-plugin@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/last-call-webpack-plugin/download/last-call-webpack-plugin-3.0.0.tgz#9742df0e10e3cf46e5c0381c2de90d3a7a2d7555" - dependencies: - lodash "^4.17.5" - webpack-sources "^1.1.0" - -lcid@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/lcid/download/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" - dependencies: - invert-kv "^1.0.0" - -levn@^0.3.0, levn@~0.3.0: - version "0.3.0" - resolved "http://registry.npm.taobao.org/levn/download/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - dependencies: - prelude-ls "~1.1.2" - type-check "~0.3.2" - -load-json-file@^1.0.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/load-json-file/download/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" - dependencies: - graceful-fs "^4.1.2" - parse-json "^2.2.0" - pify "^2.0.0" - pinkie-promise "^2.0.0" - strip-bom "^2.0.0" - -load-json-file@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/load-json-file/download/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" - dependencies: - graceful-fs "^4.1.2" - parse-json "^2.2.0" - pify "^2.0.0" - strip-bom "^3.0.0" - -loader-runner@^2.3.0: - version "2.3.0" - resolved "http://registry.npm.taobao.org/loader-runner/download/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2" - -loader-utils@^0.2.16: - version "0.2.17" - resolved "http://registry.npm.taobao.org/loader-utils/download/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348" - dependencies: - big.js "^3.1.3" - emojis-list "^2.0.0" - json5 "^0.5.0" - object-assign "^4.0.1" - -loader-utils@^1.0.2, loader-utils@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/loader-utils/download/loader-utils-1.1.0.tgz#c98aef488bcceda2ffb5e2de646d6a754429f5cd" - dependencies: - big.js "^3.1.3" - emojis-list "^2.0.0" - json5 "^0.5.0" - -locate-path@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/locate-path/download/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" - dependencies: - p-locate "^2.0.0" - path-exists "^3.0.0" - -locate-path@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/locate-path/download/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" - dependencies: - p-locate "^3.0.0" - path-exists "^3.0.0" - -lodash._getnative@^3.0.0: - version "3.9.1" - resolved "http://registry.npm.taobao.org/lodash._getnative/download/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" - -lodash.camelcase@^4.3.0: - version "4.3.0" - resolved "http://registry.npm.taobao.org/lodash.camelcase/download/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" - -lodash.debounce@^4.0.0, lodash.debounce@^4.0.8: - version "4.0.8" - resolved "http://registry.npm.taobao.org/lodash.debounce/download/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" - -lodash.isarguments@^3.0.0: - version "3.1.0" - resolved "http://registry.npm.taobao.org/lodash.isarguments/download/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" - -lodash.isarray@^3.0.0: - version "3.0.4" - resolved "http://registry.npm.taobao.org/lodash.isarray/download/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" - -lodash.keys@^3.1.2: - version "3.1.2" - resolved "http://registry.npm.taobao.org/lodash.keys/download/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" - dependencies: - lodash._getnative "^3.0.0" - lodash.isarguments "^3.0.0" - lodash.isarray "^3.0.0" - -lodash.memoize@^4.1.2: - version "4.1.2" - resolved "http://registry.npm.taobao.org/lodash.memoize/download/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" - -lodash.throttle@^4.0.0: - version "4.1.1" - resolved "http://registry.npm.taobao.org/lodash.throttle/download/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4" - -lodash.uniq@^4.5.0: - version "4.5.0" - resolved "http://registry.npm.taobao.org/lodash.uniq/download/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" - -lodash@^4.16.5, lodash@^4.17.10, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.3.0: - version "4.17.10" - resolved "http://registry.npm.taobao.org/lodash/download/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" - -log-symbols@^2.1.0: - version "2.2.0" - resolved "http://registry.npm.taobao.org/log-symbols/download/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" - dependencies: - chalk "^2.0.1" - -loglevel@^1.4.1: - version "1.6.1" - resolved "http://registry.npm.taobao.org/loglevel/download/loglevel-1.6.1.tgz#e0fc95133b6ef276cdc8887cdaf24aa6f156f8fa" - -loglevelnext@^1.0.1: - version "1.0.5" - resolved "http://registry.npm.taobao.org/loglevelnext/download/loglevelnext-1.0.5.tgz#36fc4f5996d6640f539ff203ba819641680d75a2" - dependencies: - es6-symbol "^3.1.1" - object.assign "^4.1.0" - -long@4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/long/download/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" - -long@^3.2.0: - version "3.2.0" - resolved "http://registry.npm.taobao.org/long/download/long-3.2.0.tgz#d821b7138ca1cb581c172990ef14db200b5c474b" - -loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1: - version "1.4.0" - resolved "http://registry.npm.taobao.org/loose-envify/download/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" - dependencies: - js-tokens "^3.0.0 || ^4.0.0" - -loud-rejection@^1.0.0, loud-rejection@^1.6.0: - version "1.6.0" - resolved "http://registry.npm.taobao.org/loud-rejection/download/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" - dependencies: - currently-unhandled "^0.4.1" - signal-exit "^3.0.0" - -lower-case@^1.1.1: - version "1.1.4" - resolved "http://registry.npm.taobao.org/lower-case/download/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" - -lowlight@~1.9.1: - version "1.9.2" - resolved "http://registry.npm.taobao.org/lowlight/download/lowlight-1.9.2.tgz#0b9127e3cec2c3021b7795dd81005c709a42fdd1" - dependencies: - fault "^1.0.2" - highlight.js "~9.12.0" - -lru-cache@^4.0.1, lru-cache@^4.1.1: - version "4.1.3" - resolved "http://registry.npm.taobao.org/lru-cache/download/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c" - dependencies: - pseudomap "^1.0.2" - yallist "^2.1.2" - -make-dir@^1.0.0: - version "1.3.0" - resolved "http://registry.npm.taobao.org/make-dir/download/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" - dependencies: - pify "^3.0.0" - -mamacro@^0.0.3: - version "0.0.3" - resolved "http://registry.npm.taobao.org/mamacro/download/mamacro-0.0.3.tgz#ad2c9576197c9f1abf308d0787865bd975a3f3e4" - -map-cache@^0.2.2: - version "0.2.2" - resolved "http://registry.npm.taobao.org/map-cache/download/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" - -map-obj@^1.0.0, map-obj@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/map-obj/download/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" - -map-visit@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/map-visit/download/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" - dependencies: - object-visit "^1.0.0" - -md5.js@^1.3.4: - version "1.3.4" - resolved "http://registry.npm.taobao.org/md5.js/download/md5.js-1.3.4.tgz#e9bdbde94a20a5ac18b04340fc5764d5b09d901d" - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - -mdn-data@^1.0.0, mdn-data@~1.1.0: - version "1.1.4" - resolved "http://registry.npm.taobao.org/mdn-data/download/mdn-data-1.1.4.tgz#50b5d4ffc4575276573c4eedb8780812a8419f01" - -media-typer@0.3.0: - version "0.3.0" - resolved "http://registry.npm.taobao.org/media-typer/download/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" - -mem@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/mem/download/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" - dependencies: - mimic-fn "^1.0.0" - -memory-fs@^0.4.0, memory-fs@~0.4.1: - version "0.4.1" - resolved "http://registry.npm.taobao.org/memory-fs/download/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" - dependencies: - errno "^0.1.3" - readable-stream "^2.0.1" - -meow@^3.3.0: - version "3.7.0" - resolved "http://registry.npm.taobao.org/meow/download/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" - dependencies: - camelcase-keys "^2.0.0" - decamelize "^1.1.2" - loud-rejection "^1.0.0" - map-obj "^1.0.1" - minimist "^1.1.3" - normalize-package-data "^2.3.4" - object-assign "^4.0.1" - read-pkg-up "^1.0.1" - redent "^1.0.0" - trim-newlines "^1.0.0" - -merge-descriptors@1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/merge-descriptors/download/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" - -methods@~1.1.2: - version "1.1.2" - resolved "http://registry.npm.taobao.org/methods/download/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" - -micromatch@^3.1.4, micromatch@^3.1.8, micromatch@^3.1.9: - version "3.1.10" - resolved "http://registry.npm.taobao.org/micromatch/download/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - braces "^2.3.1" - define-property "^2.0.2" - extend-shallow "^3.0.2" - extglob "^2.0.4" - fragment-cache "^0.2.1" - kind-of "^6.0.2" - nanomatch "^1.2.9" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.2" - -miller-rabin@^4.0.0: - version "4.0.1" - resolved "http://registry.npm.taobao.org/miller-rabin/download/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" - dependencies: - bn.js "^4.0.0" - brorand "^1.0.1" - -"mime-db@>= 1.34.0 < 2", mime-db@~1.35.0: - version "1.35.0" - resolved "http://registry.npm.taobao.org/mime-db/download/mime-db-1.35.0.tgz#0569d657466491283709663ad379a99b90d9ab47" - -mime-types@~2.1.17, mime-types@~2.1.18: - version "2.1.19" - resolved "http://registry.npm.taobao.org/mime-types/download/mime-types-2.1.19.tgz#71e464537a7ef81c15f2db9d97e913fc0ff606f0" - dependencies: - mime-db "~1.35.0" - -mime@1.4.1: - version "1.4.1" - resolved "http://registry.npm.taobao.org/mime/download/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" - -mime@^2.1.0: - version "2.3.1" - resolved "http://registry.npm.taobao.org/mime/download/mime-2.3.1.tgz#b1621c54d63b97c47d3cfe7f7215f7d64517c369" - -mimic-fn@^1.0.0: - version "1.2.0" - resolved "http://registry.npm.taobao.org/mimic-fn/download/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" - -mini-css-extract-plugin@^0.4.1: - version "0.4.1" - resolved "http://registry.npm.taobao.org/mini-css-extract-plugin/download/mini-css-extract-plugin-0.4.1.tgz#d2bcf77bb2596b8e4bd9257e43d3f9164c2e86cb" - dependencies: - "@webpack-contrib/schema-utils" "^1.0.0-beta.0" - loader-utils "^1.1.0" - webpack-sources "^1.1.0" - -mini-store@^1.0.2, mini-store@^1.1.0: - version "1.1.2" - resolved "http://registry.npm.taobao.org/mini-store/download/mini-store-1.1.2.tgz#cc150e0878e080ca58219d47fccefefe2c9aea3e" - dependencies: - hoist-non-react-statics "^2.3.1" - prop-types "^15.6.0" - react-lifecycles-compat "^3.0.4" - shallowequal "^1.0.2" - -minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/minimalistic-assert/download/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" - -minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/minimalistic-crypto-utils/download/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" - -minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: - version "3.0.4" - resolved "http://registry.npm.taobao.org/minimatch/download/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - dependencies: - brace-expansion "^1.1.7" - -minimist@0.0.8: - version "0.0.8" - resolved "http://registry.npm.taobao.org/minimist/download/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - -minimist@^1.1.3, minimist@^1.2.0: - version "1.2.0" - resolved "http://registry.npm.taobao.org/minimist/download/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - -minipass@^2.2.1, minipass@^2.3.3: - version "2.3.4" - resolved "http://registry.npm.taobao.org/minipass/download/minipass-2.3.4.tgz#4768d7605ed6194d6d576169b9e12ef71e9d9957" - dependencies: - safe-buffer "^5.1.2" - yallist "^3.0.0" - -minizlib@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/minizlib/download/minizlib-1.1.0.tgz#11e13658ce46bc3a70a267aac58359d1e0c29ceb" - dependencies: - minipass "^2.2.1" - -mississippi@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/mississippi/download/mississippi-2.0.0.tgz#3442a508fafc28500486feea99409676e4ee5a6f" - dependencies: - concat-stream "^1.5.0" - duplexify "^3.4.2" - end-of-stream "^1.1.0" - flush-write-stream "^1.0.0" - from2 "^2.1.0" - parallel-transform "^1.1.0" - pump "^2.0.1" - pumpify "^1.3.3" - stream-each "^1.1.0" - through2 "^2.0.0" - -mixin-deep@^1.2.0: - version "1.3.1" - resolved "http://registry.npm.taobao.org/mixin-deep/download/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" - dependencies: - for-in "^1.0.2" - is-extendable "^1.0.1" - -mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: - version "0.5.1" - resolved "http://registry.npm.taobao.org/mkdirp/download/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - dependencies: - minimist "0.0.8" - -moment@2.x, moment@^2.19.3: - version "2.22.2" - resolved "http://registry.npm.taobao.org/moment/download/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66" - -move-concurrently@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/move-concurrently/download/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" - dependencies: - aproba "^1.1.1" - copy-concurrently "^1.0.0" - fs-write-stream-atomic "^1.0.8" - mkdirp "^0.5.1" - rimraf "^2.5.4" - run-queue "^1.0.3" - -ms@2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/ms/download/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - -multicast-dns-service-types@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/multicast-dns-service-types/download/multicast-dns-service-types-1.1.0.tgz#899f11d9686e5e05cb91b35d5f0e63b773cfc901" - -multicast-dns@^6.0.1: - version "6.2.3" - resolved "http://registry.npm.taobao.org/multicast-dns/download/multicast-dns-6.2.3.tgz#a0ec7bd9055c4282f790c3c82f4e28db3b31b229" - dependencies: - dns-packet "^1.3.1" - thunky "^1.0.2" - -mute-stream@0.0.7: - version "0.0.7" - resolved "http://registry.npm.taobao.org/mute-stream/download/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" - -nan@^2.9.2: - version "2.10.0" - resolved "http://registry.npm.taobao.org/nan/download/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f" - -nanomatch@^1.2.9: - version "1.2.13" - resolved "http://registry.npm.taobao.org/nanomatch/download/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - define-property "^2.0.2" - extend-shallow "^3.0.2" - fragment-cache "^0.2.1" - is-windows "^1.0.2" - kind-of "^6.0.2" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -natural-compare@^1.4.0: - version "1.4.0" - resolved "http://registry.npm.taobao.org/natural-compare/download/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - -needle@^2.2.1: - version "2.2.2" - resolved "http://registry.npm.taobao.org/needle/download/needle-2.2.2.tgz#1120ca4c41f2fcc6976fd28a8968afe239929418" - dependencies: - debug "^2.1.2" - iconv-lite "^0.4.4" - sax "^1.2.4" - -negotiator@0.6.1: - version "0.6.1" - resolved "http://registry.npm.taobao.org/negotiator/download/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" - -neo-async@^2.5.0: - version "2.5.2" - resolved "http://registry.npm.taobao.org/neo-async/download/neo-async-2.5.2.tgz#489105ce7bc54e709d736b195f82135048c50fcc" - -next-tick@1: - version "1.0.0" - resolved "http://registry.npm.taobao.org/next-tick/download/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" - -nice-try@^1.0.4: - version "1.0.4" - resolved "http://registry.npm.taobao.org/nice-try/download/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4" - -no-case@^2.2.0: - version "2.3.2" - resolved "http://registry.npm.taobao.org/no-case/download/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac" - dependencies: - lower-case "^1.1.1" - -node-fetch@^1.0.1: - version "1.7.3" - resolved "http://registry.npm.taobao.org/node-fetch/download/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" - dependencies: - encoding "^0.1.11" - is-stream "^1.0.1" - -node-forge@0.7.5: - version "0.7.5" - resolved "http://registry.npm.taobao.org/node-forge/download/node-forge-0.7.5.tgz#6c152c345ce11c52f465c2abd957e8639cd674df" - -node-libs-browser@^2.0.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/node-libs-browser/download/node-libs-browser-2.1.0.tgz#5f94263d404f6e44767d726901fff05478d600df" - dependencies: - assert "^1.1.1" - browserify-zlib "^0.2.0" - buffer "^4.3.0" - console-browserify "^1.1.0" - constants-browserify "^1.0.0" - crypto-browserify "^3.11.0" - domain-browser "^1.1.1" - events "^1.0.0" - https-browserify "^1.0.0" - os-browserify "^0.3.0" - path-browserify "0.0.0" - process "^0.11.10" - punycode "^1.2.4" - querystring-es3 "^0.2.0" - readable-stream "^2.3.3" - stream-browserify "^2.0.1" - stream-http "^2.7.2" - string_decoder "^1.0.0" - timers-browserify "^2.0.4" - tty-browserify "0.0.0" - url "^0.11.0" - util "^0.10.3" - vm-browserify "0.0.4" - -node-pre-gyp@^0.10.0: - version "0.10.3" - resolved "http://registry.npm.taobao.org/node-pre-gyp/download/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc" - dependencies: - detect-libc "^1.0.2" - mkdirp "^0.5.1" - needle "^2.2.1" - nopt "^4.0.1" - npm-packlist "^1.1.6" - npmlog "^4.0.2" - rc "^1.2.7" - rimraf "^2.6.1" - semver "^5.3.0" - tar "^4" - -node-releases@^1.0.0-alpha.11: - version "1.0.0-alpha.11" - resolved "http://registry.npm.taobao.org/node-releases/download/node-releases-1.0.0-alpha.11.tgz#73c810acc2e5b741a17ddfbb39dfca9ab9359d8a" - dependencies: - semver "^5.3.0" - -nopt@^4.0.1: - version "4.0.1" - resolved "http://registry.npm.taobao.org/nopt/download/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" - dependencies: - abbrev "1" - osenv "^0.1.4" - -normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: - version "2.4.0" - resolved "http://registry.npm.taobao.org/normalize-package-data/download/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" - dependencies: - hosted-git-info "^2.1.4" - is-builtin-module "^1.0.0" - semver "2 || 3 || 4 || 5" - validate-npm-package-license "^3.0.1" - -normalize-path@^2.1.1: - version "2.1.1" - resolved "http://registry.npm.taobao.org/normalize-path/download/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" - dependencies: - remove-trailing-separator "^1.0.1" - -normalize-url@^3.0.0: - version "3.2.0" - resolved "http://registry.npm.taobao.org/normalize-url/download/normalize-url-3.2.0.tgz#98d0948afc82829f374320f405fe9ca55a5f8567" - -npm-bundled@^1.0.1: - version "1.0.5" - resolved "http://registry.npm.taobao.org/npm-bundled/download/npm-bundled-1.0.5.tgz#3c1732b7ba936b3a10325aef616467c0ccbcc979" - -npm-packlist@^1.1.6: - version "1.1.11" - resolved "http://registry.npm.taobao.org/npm-packlist/download/npm-packlist-1.1.11.tgz#84e8c683cbe7867d34b1d357d893ce29e28a02de" - dependencies: - ignore-walk "^3.0.1" - npm-bundled "^1.0.1" - -npm-run-path@^2.0.0: - version "2.0.2" - resolved "http://registry.npm.taobao.org/npm-run-path/download/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" - dependencies: - path-key "^2.0.0" - -npmlog@^4.0.2: - version "4.1.2" - resolved "http://registry.npm.taobao.org/npmlog/download/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" - dependencies: - are-we-there-yet "~1.1.2" - console-control-strings "~1.1.0" - gauge "~2.7.3" - set-blocking "~2.0.0" - -nth-check@^1.0.1, nth-check@~1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/nth-check/download/nth-check-1.0.1.tgz#9929acdf628fc2c41098deab82ac580cf149aae4" - dependencies: - boolbase "~1.0.0" - -number-is-nan@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.taobao.org/number-is-nan/download/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" - -object-assign@4.x, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: - version "4.1.1" - resolved "http://registry.npm.taobao.org/object-assign/download/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - -object-copy@^0.1.0: - version "0.1.0" - resolved "http://registry.npm.taobao.org/object-copy/download/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" - dependencies: - copy-descriptor "^0.1.0" - define-property "^0.2.5" - kind-of "^3.0.3" - -object-keys@^1.0.11, object-keys@^1.0.12: - version "1.0.12" - resolved "http://registry.npm.taobao.org/object-keys/download/object-keys-1.0.12.tgz#09c53855377575310cca62f55bb334abff7b3ed2" - -object-visit@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.taobao.org/object-visit/download/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" - dependencies: - isobject "^3.0.0" - -object.assign@^4.1.0: - version "4.1.0" - resolved "http://registry.npm.taobao.org/object.assign/download/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" - dependencies: - define-properties "^1.1.2" - function-bind "^1.1.1" - has-symbols "^1.0.0" - object-keys "^1.0.11" - -object.entries@^1.0.4: - version "1.0.4" - resolved "http://registry.npm.taobao.org/object.entries/download/object.entries-1.0.4.tgz#1bf9a4dd2288f5b33f3a993d257661f05d161a5f" - dependencies: - define-properties "^1.1.2" - es-abstract "^1.6.1" - function-bind "^1.1.0" - has "^1.0.1" - -object.getownpropertydescriptors@^2.0.3: - version "2.0.3" - resolved "http://registry.npm.taobao.org/object.getownpropertydescriptors/download/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" - dependencies: - define-properties "^1.1.2" - es-abstract "^1.5.1" - -object.pick@^1.3.0: - version "1.3.0" - resolved "http://registry.npm.taobao.org/object.pick/download/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" - dependencies: - isobject "^3.0.1" - -object.values@^1.0.4: - version "1.0.4" - resolved "http://registry.npm.taobao.org/object.values/download/object.values-1.0.4.tgz#e524da09b4f66ff05df457546ec72ac99f13069a" - dependencies: - define-properties "^1.1.2" - es-abstract "^1.6.1" - function-bind "^1.1.0" - has "^1.0.1" - -obuf@^1.0.0, obuf@^1.1.1: - version "1.1.2" - resolved "http://registry.npm.taobao.org/obuf/download/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" - -omit.js@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/omit.js/download/omit.js-1.0.0.tgz#e013cb86a7517b9cf6f7cfb0ddb4297256a99288" - dependencies: - babel-runtime "^6.23.0" - -on-finished@~2.3.0: - version "2.3.0" - resolved "http://registry.npm.taobao.org/on-finished/download/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" - dependencies: - ee-first "1.1.1" - -on-headers@~1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/on-headers/download/on-headers-1.0.1.tgz#928f5d0f470d49342651ea6794b0857c100693f7" - -once@^1.3.0, once@^1.3.1, once@^1.4.0: - version "1.4.0" - resolved "http://registry.npm.taobao.org/once/download/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - dependencies: - wrappy "1" - -onetime@^2.0.0: - version "2.0.1" - resolved "http://registry.npm.taobao.org/onetime/download/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" - dependencies: - mimic-fn "^1.0.0" - -opener@^1.4.3: - version "1.5.0" - resolved "http://registry.npm.taobao.org/opener/download/opener-1.5.0.tgz#24222fb4ad423ba21f5bf38855cebe44220f6531" - -opn@^5.1.0: - version "5.3.0" - resolved "http://registry.npm.taobao.org/opn/download/opn-5.3.0.tgz#64871565c863875f052cfdf53d3e3cb5adb53b1c" - dependencies: - is-wsl "^1.1.0" - -optimize-css-assets-webpack-plugin@^5.0.0: - version "5.0.0" - resolved "http://registry.npm.taobao.org/optimize-css-assets-webpack-plugin/download/optimize-css-assets-webpack-plugin-5.0.0.tgz#8c9adf00e841871f627f82a8097a4f9fcc314de4" - dependencies: - cssnano "^4.0.2" - last-call-webpack-plugin "^3.0.0" - -optionator@^0.8.2: - version "0.8.2" - resolved "http://registry.npm.taobao.org/optionator/download/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" - dependencies: - deep-is "~0.1.3" - fast-levenshtein "~2.0.4" - levn "~0.3.0" - prelude-ls "~1.1.2" - type-check "~0.3.2" - wordwrap "~1.0.0" - -original@>=0.0.5: - version "1.0.2" - resolved "http://registry.npm.taobao.org/original/download/original-1.0.2.tgz#e442a61cffe1c5fd20a65f3261c26663b303f25f" - dependencies: - url-parse "^1.4.3" - -os-browserify@^0.3.0: - version "0.3.0" - resolved "http://registry.npm.taobao.org/os-browserify/download/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" - -os-homedir@^1.0.0: - version "1.0.2" - resolved "http://registry.npm.taobao.org/os-homedir/download/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" - -os-locale@^2.0.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/os-locale/download/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" - dependencies: - execa "^0.7.0" - lcid "^1.0.0" - mem "^1.1.0" - -os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.2: - version "1.0.2" - resolved "http://registry.npm.taobao.org/os-tmpdir/download/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - -osenv@^0.1.4: - version "0.1.5" - resolved "http://registry.npm.taobao.org/osenv/download/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" - dependencies: - os-homedir "^1.0.0" - os-tmpdir "^1.0.0" - -p-finally@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/p-finally/download/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" - -p-limit@^1.1.0: - version "1.3.0" - resolved "http://registry.npm.taobao.org/p-limit/download/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" - dependencies: - p-try "^1.0.0" - -p-limit@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/p-limit/download/p-limit-2.0.0.tgz#e624ed54ee8c460a778b3c9f3670496ff8a57aec" - dependencies: - p-try "^2.0.0" - -p-locate@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/p-locate/download/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" - dependencies: - p-limit "^1.1.0" - -p-locate@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/p-locate/download/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" - dependencies: - p-limit "^2.0.0" - -p-map@^1.1.1: - version "1.2.0" - resolved "http://registry.npm.taobao.org/p-map/download/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" - -p-try@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/p-try/download/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" - -p-try@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/p-try/download/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" - -pako@~1.0.5: - version "1.0.6" - resolved "http://registry.npm.taobao.org/pako/download/pako-1.0.6.tgz#0101211baa70c4bca4a0f63f2206e97b7dfaf258" - -parallel-transform@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/parallel-transform/download/parallel-transform-1.1.0.tgz#d410f065b05da23081fcd10f28854c29bda33b06" - dependencies: - cyclist "~0.2.2" - inherits "^2.0.3" - readable-stream "^2.1.5" - -param-case@2.1.x: - version "2.1.1" - resolved "http://registry.npm.taobao.org/param-case/download/param-case-2.1.1.tgz#df94fd8cf6531ecf75e6bef9a0858fbc72be2247" - dependencies: - no-case "^2.2.0" - -parse-asn1@^5.0.0: - version "5.1.1" - resolved "http://registry.npm.taobao.org/parse-asn1/download/parse-asn1-5.1.1.tgz#f6bf293818332bd0dab54efb16087724745e6ca8" - dependencies: - asn1.js "^4.0.0" - browserify-aes "^1.0.0" - create-hash "^1.1.0" - evp_bytestokey "^1.0.0" - pbkdf2 "^3.0.3" - -parse-entities@^1.1.2: - version "1.1.2" - resolved "http://registry.npm.taobao.org/parse-entities/download/parse-entities-1.1.2.tgz#9eaf719b29dc3bd62246b4332009072e01527777" - dependencies: - character-entities "^1.0.0" - character-entities-legacy "^1.0.0" - character-reference-invalid "^1.0.0" - is-alphanumerical "^1.0.0" - is-decimal "^1.0.0" - is-hexadecimal "^1.0.0" - -parse-json@^2.2.0: - version "2.2.0" - resolved "http://registry.npm.taobao.org/parse-json/download/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" - dependencies: - error-ex "^1.2.0" - -parse-json@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/parse-json/download/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" - dependencies: - error-ex "^1.3.1" - json-parse-better-errors "^1.0.1" - -parseurl@~1.3.2: - version "1.3.2" - resolved "http://registry.npm.taobao.org/parseurl/download/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3" - -pascalcase@^0.1.1: - version "0.1.1" - resolved "http://registry.npm.taobao.org/pascalcase/download/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" - -path-browserify@0.0.0: - version "0.0.0" - resolved "http://registry.npm.taobao.org/path-browserify/download/path-browserify-0.0.0.tgz#a0b870729aae214005b7d5032ec2cbbb0fb4451a" - -path-dirname@^1.0.0: - version "1.0.2" - resolved "http://registry.npm.taobao.org/path-dirname/download/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" - -path-exists@^2.0.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/path-exists/download/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" - dependencies: - pinkie-promise "^2.0.0" - -path-exists@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/path-exists/download/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" - -path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/path-is-absolute/download/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - -path-is-inside@^1.0.1, path-is-inside@^1.0.2: - version "1.0.2" - resolved "http://registry.npm.taobao.org/path-is-inside/download/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" - -path-key@^2.0.0, path-key@^2.0.1: - version "2.0.1" - resolved "http://registry.npm.taobao.org/path-key/download/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" - -path-parse@^1.0.5: - version "1.0.6" - resolved "http://registry.npm.taobao.org/path-parse/download/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" - -path-to-regexp@0.1.7: - version "0.1.7" - resolved "http://registry.npm.taobao.org/path-to-regexp/download/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" - -path-to-regexp@^1.7.0: - version "1.7.0" - resolved "http://registry.npm.taobao.org/path-to-regexp/download/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" - dependencies: - isarray "0.0.1" - -path-type@^1.0.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/path-type/download/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" - dependencies: - graceful-fs "^4.1.2" - pify "^2.0.0" - pinkie-promise "^2.0.0" - -path-type@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/path-type/download/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" - dependencies: - pify "^2.0.0" - -pbkdf2@^3.0.3: - version "3.0.16" - resolved "http://registry.npm.taobao.org/pbkdf2/download/pbkdf2-3.0.16.tgz#7404208ec6b01b62d85bf83853a8064f8d9c2a5c" - dependencies: - create-hash "^1.1.2" - create-hmac "^1.1.4" - ripemd160 "^2.0.1" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - -performance-now@^2.1.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/performance-now/download/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - -pify@^2.0.0: - version "2.3.0" - resolved "http://registry.npm.taobao.org/pify/download/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" - -pify@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/pify/download/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" - -pinkie-promise@^2.0.0: - version "2.0.1" - resolved "http://registry.npm.taobao.org/pinkie-promise/download/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" - dependencies: - pinkie "^2.0.0" - -pinkie@^2.0.0: - version "2.0.4" - resolved "http://registry.npm.taobao.org/pinkie/download/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" - -pkg-dir@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/pkg-dir/download/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" - dependencies: - find-up "^1.0.0" - -pkg-dir@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/pkg-dir/download/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" - dependencies: - find-up "^2.1.0" - -pluralize@^7.0.0: - version "7.0.0" - resolved "http://registry.npm.taobao.org/pluralize/download/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" - -portfinder@^1.0.9: - version "1.0.16" - resolved "http://registry.npm.taobao.org/portfinder/download/portfinder-1.0.16.tgz#a6a68be9c352bc66c1a4c17a261f661f3facaf52" - dependencies: - async "^1.5.2" - debug "^2.2.0" - mkdirp "0.5.x" - -posix-character-classes@^0.1.0: - version "0.1.1" - resolved "http://registry.npm.taobao.org/posix-character-classes/download/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" - -postcss-calc@^6.0.0: - version "6.0.1" - resolved "http://registry.npm.taobao.org/postcss-calc/download/postcss-calc-6.0.1.tgz#3d24171bbf6e7629d422a436ebfe6dd9511f4330" - dependencies: - css-unit-converter "^1.1.1" - postcss "^6.0.0" - postcss-selector-parser "^2.2.2" - reduce-css-calc "^2.0.0" - -postcss-colormin@^4.0.0: - version "4.0.1" - resolved "http://registry.npm.taobao.org/postcss-colormin/download/postcss-colormin-4.0.1.tgz#6f1c18a0155bc69613f2ff13843e2e4ae8ff0bbe" - dependencies: - browserslist "^4.0.0" - color "^3.0.0" - has "^1.0.0" - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - -postcss-convert-values@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-convert-values/download/postcss-convert-values-4.0.0.tgz#77d77d9aed1dc4e6956e651cc349d53305876f62" - dependencies: - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - -postcss-discard-comments@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-discard-comments/download/postcss-discard-comments-4.0.0.tgz#9684a299e76b3e93263ef8fd2adbf1a1c08fd88d" - dependencies: - postcss "^6.0.0" - -postcss-discard-duplicates@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-discard-duplicates/download/postcss-discard-duplicates-4.0.0.tgz#42f3c267f85fa909e042c35767ecfd65cb2bd72c" - dependencies: - postcss "^6.0.0" - -postcss-discard-empty@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-discard-empty/download/postcss-discard-empty-4.0.0.tgz#55e18a59c74128e38c7d2804bcfa4056611fb97f" - dependencies: - postcss "^6.0.0" - -postcss-discard-overridden@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-discard-overridden/download/postcss-discard-overridden-4.0.0.tgz#4a0bf85978784cf1f81ed2c1c1fd9d964a1da1fa" - dependencies: - postcss "^6.0.0" - -postcss-merge-longhand@^4.0.0: - version "4.0.4" - resolved "http://registry.npm.taobao.org/postcss-merge-longhand/download/postcss-merge-longhand-4.0.4.tgz#bffc7c6ffa146591c993a0bb8373d65f9a06d4d0" - dependencies: - css-color-names "0.0.4" - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - stylehacks "^4.0.0" - -postcss-merge-rules@^4.0.0: - version "4.0.1" - resolved "http://registry.npm.taobao.org/postcss-merge-rules/download/postcss-merge-rules-4.0.1.tgz#430fd59b3f2ed2e8afcd0b31278eda39854abb10" - dependencies: - browserslist "^4.0.0" - caniuse-api "^3.0.0" - cssnano-util-same-parent "^4.0.0" - postcss "^6.0.0" - postcss-selector-parser "^3.0.0" - vendors "^1.0.0" - -postcss-minify-font-values@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-minify-font-values/download/postcss-minify-font-values-4.0.0.tgz#4cc33d283d6a81759036e757ef981d92cbd85bed" - dependencies: - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - -postcss-minify-gradients@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-minify-gradients/download/postcss-minify-gradients-4.0.0.tgz#3fc3916439d27a9bb8066db7cdad801650eb090e" - dependencies: - cssnano-util-get-arguments "^4.0.0" - is-color-stop "^1.0.0" - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - -postcss-minify-params@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-minify-params/download/postcss-minify-params-4.0.0.tgz#05e9166ee48c05af651989ce84d39c1b4d790674" - dependencies: - alphanum-sort "^1.0.0" - cssnano-util-get-arguments "^4.0.0" - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - uniqs "^2.0.0" - -postcss-minify-selectors@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-minify-selectors/download/postcss-minify-selectors-4.0.0.tgz#b1e9f6c463416d3fcdcb26e7b785d95f61578aad" - dependencies: - alphanum-sort "^1.0.0" - has "^1.0.0" - postcss "^6.0.0" - postcss-selector-parser "^3.0.0" - -postcss-modules-extract-imports@^1.2.0: - version "1.2.0" - resolved "http://registry.npm.taobao.org/postcss-modules-extract-imports/download/postcss-modules-extract-imports-1.2.0.tgz#66140ecece38ef06bf0d3e355d69bf59d141ea85" - dependencies: - postcss "^6.0.1" - -postcss-modules-local-by-default@^1.2.0: - version "1.2.0" - resolved "http://registry.npm.taobao.org/postcss-modules-local-by-default/download/postcss-modules-local-by-default-1.2.0.tgz#f7d80c398c5a393fa7964466bd19500a7d61c069" - dependencies: - css-selector-tokenizer "^0.7.0" - postcss "^6.0.1" - -postcss-modules-scope@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/postcss-modules-scope/download/postcss-modules-scope-1.1.0.tgz#d6ea64994c79f97b62a72b426fbe6056a194bb90" - dependencies: - css-selector-tokenizer "^0.7.0" - postcss "^6.0.1" - -postcss-modules-values@^1.3.0: - version "1.3.0" - resolved "http://registry.npm.taobao.org/postcss-modules-values/download/postcss-modules-values-1.3.0.tgz#ecffa9d7e192518389f42ad0e83f72aec456ea20" - dependencies: - icss-replace-symbols "^1.1.0" - postcss "^6.0.1" - -postcss-normalize-charset@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-normalize-charset/download/postcss-normalize-charset-4.0.0.tgz#24527292702d5e8129eafa3d1de49ed51a6ab730" - dependencies: - postcss "^6.0.0" - -postcss-normalize-display-values@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-normalize-display-values/download/postcss-normalize-display-values-4.0.0.tgz#950e0c7be3445770a160fffd6b6644c3c0cd8f89" - dependencies: - cssnano-util-get-match "^4.0.0" - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - -postcss-normalize-positions@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-normalize-positions/download/postcss-normalize-positions-4.0.0.tgz#ee9343ab981b822c63ab72615ecccd08564445a3" - dependencies: - cssnano-util-get-arguments "^4.0.0" - has "^1.0.0" - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - -postcss-normalize-repeat-style@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-normalize-repeat-style/download/postcss-normalize-repeat-style-4.0.0.tgz#b711c592cf16faf9ff575e42fa100b6799083eff" - dependencies: - cssnano-util-get-arguments "^4.0.0" - cssnano-util-get-match "^4.0.0" - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - -postcss-normalize-string@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-normalize-string/download/postcss-normalize-string-4.0.0.tgz#718cb6d30a6fac6ac6a830e32c06c07dbc66fe5d" - dependencies: - has "^1.0.0" - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - -postcss-normalize-timing-functions@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-normalize-timing-functions/download/postcss-normalize-timing-functions-4.0.0.tgz#0351f29886aa981d43d91b2c2bd1aea6d0af6d23" - dependencies: - cssnano-util-get-match "^4.0.0" - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - -postcss-normalize-unicode@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-normalize-unicode/download/postcss-normalize-unicode-4.0.0.tgz#5acd5d47baea5d17674b2ccc4ae5166fa88cdf97" - dependencies: - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - -postcss-normalize-url@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-normalize-url/download/postcss-normalize-url-4.0.0.tgz#b7a9c8ad26cf26694c146eb2d68bd0cf49956f0d" - dependencies: - is-absolute-url "^2.0.0" - normalize-url "^3.0.0" - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - -postcss-normalize-whitespace@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-normalize-whitespace/download/postcss-normalize-whitespace-4.0.0.tgz#1da7e76b10ae63c11827fa04fc3bb4a1efe99cc0" - dependencies: - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - -postcss-ordered-values@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-ordered-values/download/postcss-ordered-values-4.0.0.tgz#58b40c74f72e022eb34152c12e4b0f9354482fc2" - dependencies: - cssnano-util-get-arguments "^4.0.0" - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - -postcss-reduce-initial@^4.0.0: - version "4.0.1" - resolved "http://registry.npm.taobao.org/postcss-reduce-initial/download/postcss-reduce-initial-4.0.1.tgz#f2d58f50cea2b0c5dc1278d6ea5ed0ff5829c293" - dependencies: - browserslist "^4.0.0" - caniuse-api "^3.0.0" - has "^1.0.0" - postcss "^6.0.0" - -postcss-reduce-transforms@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-reduce-transforms/download/postcss-reduce-transforms-4.0.0.tgz#f645fc7440c35274f40de8104e14ad7163edf188" - dependencies: - cssnano-util-get-match "^4.0.0" - has "^1.0.0" - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - -postcss-selector-parser@^2.2.2: - version "2.2.3" - resolved "http://registry.npm.taobao.org/postcss-selector-parser/download/postcss-selector-parser-2.2.3.tgz#f9437788606c3c9acee16ffe8d8b16297f27bb90" - dependencies: - flatten "^1.0.2" - indexes-of "^1.0.1" - uniq "^1.0.1" - -postcss-selector-parser@^3.0.0: - version "3.1.1" - resolved "http://registry.npm.taobao.org/postcss-selector-parser/download/postcss-selector-parser-3.1.1.tgz#4f875f4afb0c96573d5cf4d74011aee250a7e865" - dependencies: - dot-prop "^4.1.1" - indexes-of "^1.0.1" - uniq "^1.0.1" - -postcss-svgo@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-svgo/download/postcss-svgo-4.0.0.tgz#c0bbad02520fc636c9d78b0e8403e2e515c32285" - dependencies: - is-svg "^3.0.0" - postcss "^6.0.0" - postcss-value-parser "^3.0.0" - svgo "^1.0.0" - -postcss-unique-selectors@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/postcss-unique-selectors/download/postcss-unique-selectors-4.0.0.tgz#04c1e9764c75874261303402c41f0e9769fc5501" - dependencies: - alphanum-sort "^1.0.0" - postcss "^6.0.0" - uniqs "^2.0.0" - -postcss-value-parser@^3.0.0, postcss-value-parser@^3.3.0: - version "3.3.0" - resolved "http://registry.npm.taobao.org/postcss-value-parser/download/postcss-value-parser-3.3.0.tgz#87f38f9f18f774a4ab4c8a232f5c5ce8872a9d15" - -postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.23: - version "6.0.23" - resolved "http://registry.npm.taobao.org/postcss/download/postcss-6.0.23.tgz#61c82cc328ac60e677645f979054eb98bc0e3324" - dependencies: - chalk "^2.4.1" - source-map "^0.6.1" - supports-color "^5.4.0" - -prelude-ls@~1.1.2: - version "1.1.2" - resolved "http://registry.npm.taobao.org/prelude-ls/download/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" - -pretty-error@^2.0.2: - version "2.1.1" - resolved "http://registry.npm.taobao.org/pretty-error/download/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3" - dependencies: - renderkid "^2.0.1" - utila "~0.4" - -prismjs@^1.8.4, prismjs@~1.15.0: - version "1.15.0" - resolved "http://registry.npm.taobao.org/prismjs/download/prismjs-1.15.0.tgz#8801d332e472091ba8def94976c8877ad60398d9" - optionalDependencies: - clipboard "^2.0.0" - -private@^0.1.6, private@^0.1.8: - version "0.1.8" - resolved "http://registry.npm.taobao.org/private/download/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" - -process-nextick-args@~2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/process-nextick-args/download/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" - -process@^0.11.10: - version "0.11.10" - resolved "http://registry.npm.taobao.org/process/download/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" - -progress@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/progress/download/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" - -promise-inflight@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/promise-inflight/download/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" - -promise@^7.1.1: - version "7.3.1" - resolved "http://registry.npm.taobao.org/promise/download/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" - dependencies: - asap "~2.0.3" - -prop-types@15.x, prop-types@^15.5.0, prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.6, prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.5.9, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2: - version "15.6.2" - resolved "http://registry.npm.taobao.org/prop-types/download/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102" - dependencies: - loose-envify "^1.3.1" - object-assign "^4.1.1" - -property-information@^4.0.0: - version "4.1.0" - resolved "http://registry.npm.taobao.org/property-information/download/property-information-4.1.0.tgz#16f817d8c087f3018b91877c193d730570487bb2" - dependencies: - xtend "^4.0.1" - -proxy-addr@~2.0.3: - version "2.0.4" - resolved "http://registry.npm.taobao.org/proxy-addr/download/proxy-addr-2.0.4.tgz#ecfc733bf22ff8c6f407fa275327b9ab67e48b93" - dependencies: - forwarded "~0.1.2" - ipaddr.js "1.8.0" - -prr@~1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/prr/download/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" - -pseudomap@^1.0.2: - version "1.0.2" - resolved "http://registry.npm.taobao.org/pseudomap/download/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" - -public-encrypt@^4.0.0: - version "4.0.2" - resolved "http://registry.npm.taobao.org/public-encrypt/download/public-encrypt-4.0.2.tgz#46eb9107206bf73489f8b85b69d91334c6610994" - dependencies: - bn.js "^4.1.0" - browserify-rsa "^4.0.0" - create-hash "^1.1.0" - parse-asn1 "^5.0.0" - randombytes "^2.0.1" - -pump@^2.0.0, pump@^2.0.1: - version "2.0.1" - resolved "http://registry.npm.taobao.org/pump/download/pump-2.0.1.tgz#12399add6e4cf7526d973cbc8b5ce2e2908b3909" - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" - -pumpify@^1.3.3: - version "1.5.1" - resolved "http://registry.npm.taobao.org/pumpify/download/pumpify-1.5.1.tgz#36513be246ab27570b1a374a5ce278bfd74370ce" - dependencies: - duplexify "^3.6.0" - inherits "^2.0.3" - pump "^2.0.0" - -punycode@1.3.2: - version "1.3.2" - resolved "http://registry.npm.taobao.org/punycode/download/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" - -punycode@^1.2.4: - version "1.4.1" - resolved "http://registry.npm.taobao.org/punycode/download/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - -punycode@^2.1.0: - version "2.1.1" - resolved "http://registry.npm.taobao.org/punycode/download/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - -q@^1.1.2: - version "1.5.1" - resolved "http://registry.npm.taobao.org/q/download/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" - -qs@6.5.1: - version "6.5.1" - resolved "http://registry.npm.taobao.org/qs/download/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" - -querystring-es3@^0.2.0: - version "0.2.1" - resolved "http://registry.npm.taobao.org/querystring-es3/download/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" - -querystring@0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/querystring/download/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" - -querystringify@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/querystringify/download/querystringify-2.0.0.tgz#fa3ed6e68eb15159457c89b37bc6472833195755" - -raf@^3.4.0: - version "3.4.0" - resolved "http://registry.npm.taobao.org/raf/download/raf-3.4.0.tgz#a28876881b4bc2ca9117d4138163ddb80f781575" - dependencies: - performance-now "^2.1.0" - -randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: - version "2.0.6" - resolved "http://registry.npm.taobao.org/randombytes/download/randombytes-2.0.6.tgz#d302c522948588848a8d300c932b44c24231da80" - dependencies: - safe-buffer "^5.1.0" - -randomfill@^1.0.3: - version "1.0.4" - resolved "http://registry.npm.taobao.org/randomfill/download/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" - dependencies: - randombytes "^2.0.5" - safe-buffer "^5.1.0" - -range-parser@^1.0.3, range-parser@~1.2.0: - version "1.2.0" - resolved "http://registry.npm.taobao.org/range-parser/download/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" - -raw-body@2.3.2: - version "2.3.2" - resolved "http://registry.npm.taobao.org/raw-body/download/raw-body-2.3.2.tgz#bcd60c77d3eb93cde0050295c3f379389bc88f89" - dependencies: - bytes "3.0.0" - http-errors "1.6.2" - iconv-lite "0.4.19" - unpipe "1.0.0" - -rc-align@^2.4.0, rc-align@^2.4.1: - version "2.4.3" - resolved "http://registry.npm.taobao.org/rc-align/download/rc-align-2.4.3.tgz#b9b3c2a6d68adae71a8e1d041cd5e3b2a655f99a" - dependencies: - babel-runtime "^6.26.0" - dom-align "^1.7.0" - prop-types "^15.5.8" - rc-util "^4.0.4" - -rc-animate@2.x, rc-animate@^2.3.0, rc-animate@^2.4.1: - version "2.4.4" - resolved "http://registry.npm.taobao.org/rc-animate/download/rc-animate-2.4.4.tgz#a05a784c747beef140d99ff52b6117711bef4b1e" - dependencies: - babel-runtime "6.x" - css-animation "^1.3.2" - prop-types "15.x" - -rc-animate@3.0.0-rc.1: - version "3.0.0-rc.1" - resolved "http://registry.npm.taobao.org/rc-animate/download/rc-animate-3.0.0-rc.1.tgz#39703e5be6d35c0c50ae53126a6c2424e5ec9405" - dependencies: - babel-runtime "6.x" - classnames "^2.2.5" - component-classes "^1.2.6" - fbjs "^0.8.16" - prop-types "15.x" - raf "^3.4.0" - rc-util "^4.5.0" - react-lifecycles-compat "^3.0.4" - -rc-animate@^3.0.0-rc.1, rc-animate@^3.0.0-rc.4: - version "3.0.0-rc.4" - resolved "http://registry.npm.taobao.org/rc-animate/download/rc-animate-3.0.0-rc.4.tgz#caddbd849f01d987965c6237afe64167679497bd" - dependencies: - babel-runtime "6.x" - classnames "^2.2.5" - component-classes "^1.2.6" - fbjs "^0.8.16" - prop-types "15.x" - raf "^3.4.0" - rc-util "^4.5.0" - react-lifecycles-compat "^3.0.4" - -rc-bmap@0.2.2: - version "0.2.2" - resolved "https://registry.corp.bianlifeng.com/rc-bmap/download/rc-bmap-0.2.2.tgz#5941938b7d1fca09864ccddde2ebea78e1bcbae9" - dependencies: - bmaplib.curveline "^1.0.0" - bmaplib.heatmap "^1.0.4" - bmaplib.markerclusterer "^1.0.13" - -rc-calendar@~9.6.0: - version "9.6.2" - resolved "http://registry.npm.taobao.org/rc-calendar/download/rc-calendar-9.6.2.tgz#c7309db41225f4b8c81d5a1dcbe46d8ce07b6aee" - dependencies: - babel-runtime "6.x" - classnames "2.x" - create-react-class "^15.5.2" - moment "2.x" - prop-types "^15.5.8" - rc-trigger "^2.2.0" - rc-util "^4.1.1" - -rc-cascader@~0.14.0: - version "0.14.0" - resolved "http://registry.npm.taobao.org/rc-cascader/download/rc-cascader-0.14.0.tgz#a956c99896f10883bf63d46fb894d0cb326842a4" - dependencies: - array-tree-filter "^1.0.0" - prop-types "^15.5.8" - rc-trigger "^2.2.0" - rc-util "^4.0.4" - shallow-equal "^1.0.0" - warning "^4.0.1" - -rc-checkbox@~2.1.5: - version "2.1.5" - resolved "http://registry.npm.taobao.org/rc-checkbox/download/rc-checkbox-2.1.5.tgz#411858448c0ee2a797ef8544dac63bcaeef722ef" - dependencies: - babel-runtime "^6.23.0" - classnames "2.x" - prop-types "15.x" - rc-util "^4.0.4" - -rc-collapse@~1.9.0: - version "1.9.3" - resolved "http://registry.npm.taobao.org/rc-collapse/download/rc-collapse-1.9.3.tgz#d9741db06a823353e1fd1aec3ba4c0f9d8af4b26" - dependencies: - classnames "2.x" - css-animation "1.x" - prop-types "^15.5.6" - rc-animate "2.x" - -rc-dialog@~7.2.0: - version "7.2.0" - resolved "http://registry.npm.taobao.org/rc-dialog/download/rc-dialog-7.2.0.tgz#b56a2d3a56003437d6ff8917eac6b0fc601936ab" - dependencies: - babel-runtime "6.x" - rc-animate "2.x" - rc-util "^4.4.0" - -rc-drawer@~1.6.2: - version "1.6.3" - resolved "http://registry.npm.taobao.org/rc-drawer/download/rc-drawer-1.6.3.tgz#f866b7fbde2d307b59cfd06c015ae697017db388" - dependencies: - babel-runtime "6.x" - classnames "^2.2.5" - prop-types "^15.5.0" - rc-util "^4.5.1" - -rc-dropdown@~2.2.0: - version "2.2.0" - resolved "http://registry.npm.taobao.org/rc-dropdown/download/rc-dropdown-2.2.0.tgz#a905067666ce73c0ce26cf0980e7b75b46126825" - dependencies: - babel-runtime "^6.26.0" - prop-types "^15.5.8" - rc-trigger "^2.5.1" - react-lifecycles-compat "^3.0.2" - -rc-editor-core@~0.8.3: - version "0.8.6" - resolved "http://registry.npm.taobao.org/rc-editor-core/download/rc-editor-core-0.8.6.tgz#e48b288286effb3272cbc9c6f801450dcdb0b247" - dependencies: - babel-runtime "^6.26.0" - classnames "^2.2.5" - draft-js "^0.10.0" - immutable "^3.7.4" - lodash "^4.16.5" - prop-types "^15.5.8" - setimmediate "^1.0.5" - -rc-editor-mention@^1.0.2: - version "1.1.7" - resolved "http://registry.npm.taobao.org/rc-editor-mention/download/rc-editor-mention-1.1.7.tgz#c72d181859beda96669f4b43e19a941e68fa985b" - dependencies: - babel-runtime "^6.23.0" - classnames "^2.2.5" - dom-scroll-into-view "^1.2.0" - draft-js "~0.10.0" - prop-types "^15.5.8" - rc-animate "^2.3.0" - rc-editor-core "~0.8.3" - -rc-form@^2.1.0: - version "2.2.1" - resolved "http://registry.npm.taobao.org/rc-form/download/rc-form-2.2.1.tgz#9c6d968f1460fd3872d2e9371324d717775af260" - dependencies: - async-validator "1.x" - babel-runtime "6.x" - create-react-class "^15.5.3" - dom-scroll-into-view "1.x" - hoist-non-react-statics "^2.3.1" - lodash "^4.17.4" - warning "^3.0.0" - -rc-hammerjs@~0.6.0: - version "0.6.9" - resolved "http://registry.npm.taobao.org/rc-hammerjs/download/rc-hammerjs-0.6.9.tgz#9a4ddbda1b2ec8f9b9596091a6a989842a243907" - dependencies: - babel-runtime "6.x" - hammerjs "^2.0.8" - prop-types "^15.5.9" - -rc-input-number@~4.0.0: - version "4.0.12" - resolved "http://registry.npm.taobao.org/rc-input-number/download/rc-input-number-4.0.12.tgz#99b62f0b2395e1e76c9f72142b4ad7ea46f97d06" - dependencies: - babel-runtime "6.x" - classnames "^2.2.0" - is-negative-zero "^2.0.0" - prop-types "^15.5.7" - rc-util "^4.5.1" - rmc-feedback "^2.0.0" - -rc-menu@^7.0.2: - version "7.2.6" - resolved "http://registry.npm.taobao.org/rc-menu/download/rc-menu-7.2.6.tgz#b18b8da9d637533145c6bc28cae1f29ae55c8dc7" - dependencies: - babel-runtime "6.x" - classnames "2.x" - dom-scroll-into-view "1.x" - mini-store "^1.1.0" - prop-types "^15.5.6" - rc-animate "2.x" - rc-trigger "^2.3.0" - rc-util "^4.1.0" - -rc-menu@~7.0.2: - version "7.0.5" - resolved "http://registry.npm.taobao.org/rc-menu/download/rc-menu-7.0.5.tgz#986b65df5ad227aadf399ea374b98d2313802316" - dependencies: - babel-runtime "6.x" - classnames "2.x" - dom-scroll-into-view "1.x" - mini-store "^1.1.0" - prop-types "^15.5.6" - rc-animate "2.x" - rc-trigger "^2.3.0" - rc-util "^4.1.0" - -rc-notification@~3.2.0: - version "3.2.0" - resolved "http://registry.npm.taobao.org/rc-notification/download/rc-notification-3.2.0.tgz#bbfb6a92c4e54c9eeb7ac51a7e8c64011ea12ab1" - dependencies: - babel-runtime "6.x" - classnames "2.x" - prop-types "^15.5.8" - rc-animate "2.x" - rc-util "^4.0.4" - -rc-pagination@~1.16.1: - version "1.16.5" - resolved "http://registry.npm.taobao.org/rc-pagination/download/rc-pagination-1.16.5.tgz#550a758035e1957ccfa2f71ee6e55657da729679" - dependencies: - babel-runtime "6.x" - prop-types "^15.5.7" - -rc-progress@~2.2.2: - version "2.2.5" - resolved "http://registry.npm.taobao.org/rc-progress/download/rc-progress-2.2.5.tgz#e61d0544bf9d4208e5ba32fc50962159e7f952a3" - dependencies: - babel-runtime "6.x" - prop-types "^15.5.8" - -rc-rate@~2.4.0: - version "2.4.2" - resolved "http://registry.npm.taobao.org/rc-rate/download/rc-rate-2.4.2.tgz#c097bfdba7a5783cec287c928b1461cc1621f836" - dependencies: - babel-runtime "^6.26.0" - classnames "^2.2.5" - prop-types "^15.5.8" - rc-util "^4.3.0" - -rc-select@~8.1.1: - version "8.1.1" - resolved "http://registry.npm.taobao.org/rc-select/download/rc-select-8.1.1.tgz#89335cf0af518affe201bb6beefe161e1b4b2ab6" - dependencies: - babel-runtime "^6.23.0" - classnames "2.x" - component-classes "1.x" - dom-scroll-into-view "1.x" - prop-types "^15.5.8" - raf "^3.4.0" - rc-animate "2.x" - rc-menu "^7.0.2" - rc-trigger "^2.2.0" - rc-util "^4.0.4" - react-lifecycles-compat "^3.0.2" - warning "^3.0.0" - -rc-slider@~8.6.0: - version "8.6.1" - resolved "http://registry.npm.taobao.org/rc-slider/download/rc-slider-8.6.1.tgz#ee5e0380dbdf4b5de6955a265b0d4ff6196405d1" - dependencies: - babel-runtime "6.x" - classnames "^2.2.5" - prop-types "^15.5.4" - rc-tooltip "^3.7.0" - rc-util "^4.0.4" - shallowequal "^1.0.1" - warning "^3.0.0" - -rc-steps@~3.1.0: - version "3.1.1" - resolved "http://registry.npm.taobao.org/rc-steps/download/rc-steps-3.1.1.tgz#79583ad808309d82b8e011676321d153fd7ca403" - dependencies: - babel-runtime "^6.23.0" - classnames "^2.2.3" - lodash "^4.17.5" - prop-types "^15.5.7" - -rc-switch@~1.6.0: - version "1.6.0" - resolved "http://registry.npm.taobao.org/rc-switch/download/rc-switch-1.6.0.tgz#c2d7369bdb87c1fd45e84989a27c1fb2f201d2fd" - dependencies: - babel-runtime "^6.23.0" - classnames "^2.2.1" - prop-types "^15.5.6" - -rc-table@~6.2.0: - version "6.2.8" - resolved "http://registry.npm.taobao.org/rc-table/download/rc-table-6.2.8.tgz#c06bf48bfab60754ab3f70102290e41e8b32388e" - dependencies: - babel-runtime "6.x" - classnames "^2.2.5" - component-classes "^1.2.6" - lodash "^4.17.5" - mini-store "^1.0.2" - prop-types "^15.5.8" - rc-util "^4.0.4" - react-lifecycles-compat "^3.0.2" - shallowequal "^1.0.2" - warning "^3.0.0" - -rc-tabs@~9.3.3: - version "9.3.6" - resolved "http://registry.npm.taobao.org/rc-tabs/download/rc-tabs-9.3.6.tgz#873890b3a68164a5814f89e343270b1ce9eb6acd" - dependencies: - babel-runtime "6.x" - classnames "2.x" - lodash "^4.17.5" - prop-types "15.x" - rc-hammerjs "~0.6.0" - rc-util "^4.0.4" - warning "^3.0.0" - -rc-time-picker@~3.3.0: - version "3.3.1" - resolved "http://registry.npm.taobao.org/rc-time-picker/download/rc-time-picker-3.3.1.tgz#94f8bbd51e6b93de1f01e78064aef1e6d765b367" - dependencies: - babel-runtime "6.x" - classnames "2.x" - moment "2.x" - prop-types "^15.5.8" - rc-trigger "^2.2.0" - -rc-tooltip@^3.7.0, rc-tooltip@~3.7.0: - version "3.7.2" - resolved "http://registry.npm.taobao.org/rc-tooltip/download/rc-tooltip-3.7.2.tgz#3698656d4bacd51b72d9e327bed15d1d5a9f1b27" - dependencies: - babel-runtime "6.x" - prop-types "^15.5.8" - rc-trigger "^2.2.2" - -rc-tree-select@~2.0.5: - version "2.0.14" - resolved "http://registry.npm.taobao.org/rc-tree-select/download/rc-tree-select-2.0.14.tgz#6b76c50f32ebe9aeb720f98ce36b43b3e8be11d2" - dependencies: - babel-runtime "^6.23.0" - classnames "^2.2.1" - prop-types "^15.5.8" - raf "^3.4.0" - rc-animate "^3.0.0-rc.4" - rc-tree "~1.12.2" - rc-trigger "^3.0.0-rc.2" - rc-util "^4.5.0" - react-lifecycles-compat "^3.0.4" - shallowequal "^1.0.2" - warning "^4.0.1" - -rc-tree@~1.12.2: - version "1.12.7" - resolved "http://registry.npm.taobao.org/rc-tree/download/rc-tree-1.12.7.tgz#94ce4b59d27325c555d6238c7b92feeaa5d476a0" - dependencies: - babel-runtime "^6.23.0" - classnames "2.x" - prop-types "^15.5.8" - rc-animate "2.x" - rc-util "^4.0.4" - warning "^3.0.0" - -rc-tree@~1.13.0: - version "1.13.2" - resolved "http://registry.npm.taobao.org/rc-tree/download/rc-tree-1.13.2.tgz#47cd31a51871f26f50e34167d9dcf36a68c44955" - dependencies: - babel-runtime "^6.23.0" - classnames "2.x" - prop-types "^15.5.8" - rc-animate "3.0.0-rc.1" - rc-util "^4.5.1" - react-lifecycles-compat "^3.0.4" - warning "^3.0.0" - -rc-trigger@^2.2.0, rc-trigger@^2.2.2, rc-trigger@^2.3.0, rc-trigger@^2.5.1, rc-trigger@^2.5.4: - version "2.5.4" - resolved "http://registry.npm.taobao.org/rc-trigger/download/rc-trigger-2.5.4.tgz#9088a24ba5a811b254f742f004e38a9e2f8843fb" - dependencies: - babel-runtime "6.x" - classnames "^2.2.6" - prop-types "15.x" - rc-align "^2.4.0" - rc-animate "2.x" - rc-util "^4.4.0" - -rc-trigger@^3.0.0-rc.2: - version "3.0.0-rc.3" - resolved "http://registry.npm.taobao.org/rc-trigger/download/rc-trigger-3.0.0-rc.3.tgz#35842df1674d25315e1426a44882a4c97652258b" - dependencies: - babel-runtime "6.x" - classnames "^2.2.6" - prop-types "15.x" - raf "^3.4.0" - rc-align "^2.4.1" - rc-animate "^3.0.0-rc.1" - rc-util "^4.4.0" - -rc-upload@~2.5.0: - version "2.5.1" - resolved "http://registry.npm.taobao.org/rc-upload/download/rc-upload-2.5.1.tgz#7ae0c9038d98ba8750e9466d8f969e1b4bc9f0e0" - dependencies: - babel-runtime "6.x" - classnames "^2.2.5" - prop-types "^15.5.7" - warning "2.x" - -rc-util@^4.0.4, rc-util@^4.1.0, rc-util@^4.1.1, rc-util@^4.3.0, rc-util@^4.4.0, rc-util@^4.5.0, rc-util@^4.5.1: - version "4.5.1" - resolved "http://registry.npm.taobao.org/rc-util/download/rc-util-4.5.1.tgz#0e435057174c024901c7600ba8903dd03da3ab39" - dependencies: - add-dom-event-listener "1.x" - babel-runtime "6.x" - prop-types "^15.5.10" - shallowequal "^0.2.2" - -rc@^1.2.7: - version "1.2.8" - resolved "http://registry.npm.taobao.org/rc/download/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" - dependencies: - deep-extend "^0.6.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - -react-dom@^16.4.2: - version "16.4.2" - resolved "http://registry.npm.taobao.org/react-dom/download/react-dom-16.4.2.tgz#4afed569689f2c561d2b8da0b819669c38a0bda4" - dependencies: - fbjs "^0.8.16" - loose-envify "^1.1.0" - object-assign "^4.1.1" - prop-types "^15.6.0" - -react-lazy-load@^3.0.12: - version "3.0.13" - resolved "http://registry.npm.taobao.org/react-lazy-load/download/react-lazy-load-3.0.13.tgz#3b0a92d336d43d3f0d73cbe6f35b17050b08b824" - dependencies: - eventlistener "0.0.1" - lodash.debounce "^4.0.0" - lodash.throttle "^4.0.0" - prop-types "^15.5.8" - -react-lifecycles-compat@^3.0.2, react-lifecycles-compat@^3.0.4: - version "3.0.4" - resolved "http://registry.npm.taobao.org/react-lifecycles-compat/download/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" - -react-router-dom@^4.3.1: - version "4.3.1" - resolved "http://registry.npm.taobao.org/react-router-dom/download/react-router-dom-4.3.1.tgz#4c2619fc24c4fa87c9fd18f4fb4a43fe63fbd5c6" - dependencies: - history "^4.7.2" - invariant "^2.2.4" - loose-envify "^1.3.1" - prop-types "^15.6.1" - react-router "^4.3.1" - warning "^4.0.1" - -react-router@^4.3.1: - version "4.3.1" - resolved "http://registry.npm.taobao.org/react-router/download/react-router-4.3.1.tgz#aada4aef14c809cb2e686b05cee4742234506c4e" - dependencies: - history "^4.7.2" - hoist-non-react-statics "^2.5.0" - invariant "^2.2.4" - loose-envify "^1.3.1" - path-to-regexp "^1.7.0" - prop-types "^15.6.1" - warning "^4.0.1" - -react-slick@~0.23.1: - version "0.23.1" - resolved "http://registry.npm.taobao.org/react-slick/download/react-slick-0.23.1.tgz#15791c4107f0ba3a5688d5bd97b7b7ceaa0dd181" - dependencies: - classnames "^2.2.5" - enquire.js "^2.1.6" - json2mq "^0.2.0" - lodash.debounce "^4.0.8" - resize-observer-polyfill "^1.5.0" - -react-syntax-highlighter@^8.0.1: - version "8.0.1" - resolved "http://registry.npm.taobao.org/react-syntax-highlighter/download/react-syntax-highlighter-8.0.1.tgz#88f7833e3a2d3c718799f2e7776266486c82c566" - dependencies: - babel-runtime "^6.18.0" - highlight.js "~9.12.0" - lowlight "~1.9.1" - prismjs "^1.8.4" - refractor "^2.4.1" - -react@^16.4.2: - version "16.4.2" - resolved "http://registry.npm.taobao.org/react/download/react-16.4.2.tgz#2cd90154e3a9d9dd8da2991149fdca3c260e129f" - dependencies: - fbjs "^0.8.16" - loose-envify "^1.1.0" - object-assign "^4.1.1" - prop-types "^15.6.0" - -read-pkg-up@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/read-pkg-up/download/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" - dependencies: - find-up "^1.0.0" - read-pkg "^1.0.0" - -read-pkg-up@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/read-pkg-up/download/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" - dependencies: - find-up "^2.0.0" - read-pkg "^2.0.0" - -read-pkg@^1.0.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/read-pkg/download/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" - dependencies: - load-json-file "^1.0.0" - normalize-package-data "^2.3.2" - path-type "^1.0.0" - -read-pkg@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/read-pkg/download/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" - dependencies: - load-json-file "^2.0.0" - normalize-package-data "^2.3.2" - path-type "^2.0.0" - -"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.9, readable-stream@^2.3.3, readable-stream@^2.3.6: - version "2.3.6" - resolved "http://registry.npm.taobao.org/readable-stream/download/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -readable-stream@1.0: - version "1.0.34" - resolved "http://registry.npm.taobao.org/readable-stream/download/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "0.0.1" - string_decoder "~0.10.x" - -readdirp@^2.0.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/readdirp/download/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78" - dependencies: - graceful-fs "^4.1.2" - minimatch "^3.0.2" - readable-stream "^2.0.2" - set-immediate-shim "^1.0.1" - -redent@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/redent/download/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" - dependencies: - indent-string "^2.1.0" - strip-indent "^1.0.1" - -reduce-css-calc@^2.0.0: - version "2.1.4" - resolved "http://registry.npm.taobao.org/reduce-css-calc/download/reduce-css-calc-2.1.4.tgz#c20e9cda8445ad73d4ff4bea960c6f8353791708" - dependencies: - css-unit-converter "^1.1.1" - postcss-value-parser "^3.3.0" - -refractor@^2.4.1: - version "2.6.0" - resolved "http://registry.npm.taobao.org/refractor/download/refractor-2.6.0.tgz#6b0d88f654c8534eefed3329a35bc7bb74ae0979" - dependencies: - hastscript "^4.0.0" - parse-entities "^1.1.2" - prismjs "~1.15.0" - -regenerate@^1.2.1: - version "1.4.0" - resolved "http://registry.npm.taobao.org/regenerate/download/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" - -regenerator-runtime@^0.11.0: - version "0.11.1" - resolved "http://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" - -regenerator-transform@^0.10.0: - version "0.10.1" - resolved "http://registry.npm.taobao.org/regenerator-transform/download/regenerator-transform-0.10.1.tgz#1e4996837231da8b7f3cf4114d71b5691a0680dd" - dependencies: - babel-runtime "^6.18.0" - babel-types "^6.19.0" - private "^0.1.6" - -regex-not@^1.0.0, regex-not@^1.0.2: - version "1.0.2" - resolved "http://registry.npm.taobao.org/regex-not/download/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" - dependencies: - extend-shallow "^3.0.2" - safe-regex "^1.1.0" - -regexpp@^1.0.1: - version "1.1.0" - resolved "http://registry.npm.taobao.org/regexpp/download/regexpp-1.1.0.tgz#0e3516dd0b7904f413d2d4193dce4618c3a689ab" - -regexpu-core@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/regexpu-core/download/regexpu-core-1.0.0.tgz#86a763f58ee4d7c2f6b102e4764050de7ed90c6b" - dependencies: - regenerate "^1.2.1" - regjsgen "^0.2.0" - regjsparser "^0.1.4" - -regexpu-core@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/regexpu-core/download/regexpu-core-2.0.0.tgz#49d038837b8dcf8bfa5b9a42139938e6ea2ae240" - dependencies: - regenerate "^1.2.1" - regjsgen "^0.2.0" - regjsparser "^0.1.4" - -regjsgen@^0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/regjsgen/download/regjsgen-0.2.0.tgz#6c016adeac554f75823fe37ac05b92d5a4edb1f7" - -regjsparser@^0.1.4: - version "0.1.5" - resolved "http://registry.npm.taobao.org/regjsparser/download/regjsparser-0.1.5.tgz#7ee8f84dc6fa792d3fd0ae228d24bd949ead205c" - dependencies: - jsesc "~0.5.0" - -relateurl@0.2.x: - version "0.2.7" - resolved "http://registry.npm.taobao.org/relateurl/download/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" - -remove-trailing-separator@^1.0.1: - version "1.1.0" - resolved "http://registry.npm.taobao.org/remove-trailing-separator/download/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" - -renderkid@^2.0.1: - version "2.0.1" - resolved "http://registry.npm.taobao.org/renderkid/download/renderkid-2.0.1.tgz#898cabfc8bede4b7b91135a3ffd323e58c0db319" - dependencies: - css-select "^1.1.0" - dom-converter "~0.1" - htmlparser2 "~3.3.0" - strip-ansi "^3.0.0" - utila "~0.3" - -repeat-element@^1.1.2: - version "1.1.2" - resolved "http://registry.npm.taobao.org/repeat-element/download/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" - -repeat-string@^1.6.1: - version "1.6.1" - resolved "http://registry.npm.taobao.org/repeat-string/download/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" - -repeating@^2.0.0: - version "2.0.1" - resolved "http://registry.npm.taobao.org/repeating/download/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" - dependencies: - is-finite "^1.0.0" - -require-directory@^2.1.1: - version "2.1.1" - resolved "http://registry.npm.taobao.org/require-directory/download/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - -require-main-filename@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/require-main-filename/download/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" - -require-uncached@^1.0.3: - version "1.0.3" - resolved "http://registry.npm.taobao.org/require-uncached/download/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" - dependencies: - caller-path "^0.1.0" - resolve-from "^1.0.0" - -requires-port@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/requires-port/download/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - -resize-observer-polyfill@^1.5.0: - version "1.5.0" - resolved "http://registry.npm.taobao.org/resize-observer-polyfill/download/resize-observer-polyfill-1.5.0.tgz#660ff1d9712a2382baa2cad450a4716209f9ca69" - -resolve-cwd@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/resolve-cwd/download/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" - dependencies: - resolve-from "^3.0.0" - -resolve-from@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.taobao.org/resolve-from/download/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" - -resolve-from@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/resolve-from/download/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" - -resolve-pathname@^2.2.0: - version "2.2.0" - resolved "http://registry.npm.taobao.org/resolve-pathname/download/resolve-pathname-2.2.0.tgz#7e9ae21ed815fd63ab189adeee64dc831eefa879" - -resolve-url@^0.2.1: - version "0.2.1" - resolved "http://registry.npm.taobao.org/resolve-url/download/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" - -resolve@^1.5.0, resolve@^1.6.0: - version "1.8.1" - resolved "http://registry.npm.taobao.org/resolve/download/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" - dependencies: - path-parse "^1.0.5" - -restore-cursor@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/restore-cursor/download/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" - dependencies: - onetime "^2.0.0" - signal-exit "^3.0.2" - -ret@~0.1.10: - version "0.1.15" - resolved "http://registry.npm.taobao.org/ret/download/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" - -rgb-regex@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/rgb-regex/download/rgb-regex-1.0.1.tgz#c0e0d6882df0e23be254a475e8edd41915feaeb1" - -rgba-regex@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/rgba-regex/download/rgba-regex-1.0.0.tgz#43374e2e2ca0968b0ef1523460b7d730ff22eeb3" - -rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2: - version "2.6.2" - resolved "http://registry.npm.taobao.org/rimraf/download/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" - dependencies: - glob "^7.0.5" - -ripemd160@^2.0.0, ripemd160@^2.0.1: - version "2.0.2" - resolved "http://registry.npm.taobao.org/ripemd160/download/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - -rmc-feedback@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/rmc-feedback/download/rmc-feedback-2.0.0.tgz#cbc6cb3ae63c7a635eef0e25e4fbaf5ac366eeaa" - dependencies: - babel-runtime "6.x" - classnames "^2.2.5" - -run-async@^2.2.0: - version "2.3.0" - resolved "http://registry.npm.taobao.org/run-async/download/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" - dependencies: - is-promise "^2.1.0" - -run-queue@^1.0.0, run-queue@^1.0.3: - version "1.0.3" - resolved "http://registry.npm.taobao.org/run-queue/download/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" - dependencies: - aproba "^1.1.1" - -rx-lite-aggregates@^4.0.8: - version "4.0.8" - resolved "http://registry.npm.taobao.org/rx-lite-aggregates/download/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" - dependencies: - rx-lite "*" - -rx-lite@*, rx-lite@^4.0.8: - version "4.0.8" - resolved "http://registry.npm.taobao.org/rx-lite/download/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" - -rxjs@^6.1.0: - version "6.2.2" - resolved "http://registry.npm.taobao.org/rxjs/download/rxjs-6.2.2.tgz#eb75fa3c186ff5289907d06483a77884586e1cf9" - dependencies: - tslib "^1.9.0" - -safe-buffer@5.1.1: - version "5.1.1" - resolved "http://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" - -safe-buffer@5.1.2, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.2" - resolved "http://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - -safe-regex@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/safe-regex/download/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" - dependencies: - ret "~0.1.10" - -"safer-buffer@>= 2.1.2 < 3": - version "2.1.2" - resolved "http://registry.npm.taobao.org/safer-buffer/download/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - -sax@^1.2.4, sax@~1.2.4: - version "1.2.4" - resolved "http://registry.npm.taobao.org/sax/download/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" - -schema-utils@^0.4.4, schema-utils@^0.4.5: - version "0.4.7" - resolved "http://registry.npm.taobao.org/schema-utils/download/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187" - dependencies: - ajv "^6.1.0" - ajv-keywords "^3.1.0" - -select-hose@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/select-hose/download/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" - -select@^1.1.2: - version "1.1.2" - resolved "http://registry.npm.taobao.org/select/download/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d" - -selfsigned@^1.9.1: - version "1.10.3" - resolved "http://registry.npm.taobao.org/selfsigned/download/selfsigned-1.10.3.tgz#d628ecf9e3735f84e8bafba936b3cf85bea43823" - dependencies: - node-forge "0.7.5" - -"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.5.0: - version "5.5.0" - resolved "http://registry.npm.taobao.org/semver/download/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" - -send@0.16.2: - version "0.16.2" - resolved "http://registry.npm.taobao.org/send/download/send-0.16.2.tgz#6ecca1e0f8c156d141597559848df64730a6bbc1" - dependencies: - debug "2.6.9" - depd "~1.1.2" - destroy "~1.0.4" - encodeurl "~1.0.2" - escape-html "~1.0.3" - etag "~1.8.1" - fresh "0.5.2" - http-errors "~1.6.2" - mime "1.4.1" - ms "2.0.0" - on-finished "~2.3.0" - range-parser "~1.2.0" - statuses "~1.4.0" - -serialize-javascript@^1.4.0: - version "1.5.0" - resolved "http://registry.npm.taobao.org/serialize-javascript/download/serialize-javascript-1.5.0.tgz#1aa336162c88a890ddad5384baebc93a655161fe" - -serve-index@^1.7.2: - version "1.9.1" - resolved "http://registry.npm.taobao.org/serve-index/download/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239" - dependencies: - accepts "~1.3.4" - batch "0.6.1" - debug "2.6.9" - escape-html "~1.0.3" - http-errors "~1.6.2" - mime-types "~2.1.17" - parseurl "~1.3.2" - -serve-static@1.13.2: - version "1.13.2" - resolved "http://registry.npm.taobao.org/serve-static/download/serve-static-1.13.2.tgz#095e8472fd5b46237db50ce486a43f4b86c6cec1" - dependencies: - encodeurl "~1.0.2" - escape-html "~1.0.3" - parseurl "~1.3.2" - send "0.16.2" - -set-blocking@^2.0.0, set-blocking@~2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/set-blocking/download/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - -set-immediate-shim@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/set-immediate-shim/download/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" - -set-value@^0.4.3: - version "0.4.3" - resolved "http://registry.npm.taobao.org/set-value/download/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" - dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.1" - to-object-path "^0.3.0" - -set-value@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/set-value/download/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" - dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.3" - split-string "^3.0.1" - -setimmediate@^1.0.4, setimmediate@^1.0.5: - version "1.0.5" - resolved "http://registry.npm.taobao.org/setimmediate/download/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" - -setprototypeof@1.0.3: - version "1.0.3" - resolved "http://registry.npm.taobao.org/setprototypeof/download/setprototypeof-1.0.3.tgz#66567e37043eeb4f04d91bd658c0cbefb55b8e04" - -setprototypeof@1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/setprototypeof/download/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" - -sha.js@^2.4.0, sha.js@^2.4.8: - version "2.4.11" - resolved "http://registry.npm.taobao.org/sha.js/download/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -shallow-equal@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/shallow-equal/download/shallow-equal-1.0.0.tgz#508d1838b3de590ab8757b011b25e430900945f7" - -shallowequal@^0.2.2: - version "0.2.2" - resolved "http://registry.npm.taobao.org/shallowequal/download/shallowequal-0.2.2.tgz#1e32fd5bcab6ad688a4812cb0cc04efc75c7014e" - dependencies: - lodash.keys "^3.1.2" - -shallowequal@^1.0.1, shallowequal@^1.0.2: - version "1.1.0" - resolved "http://registry.npm.taobao.org/shallowequal/download/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8" - -shebang-command@^1.2.0: - version "1.2.0" - resolved "http://registry.npm.taobao.org/shebang-command/download/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" - dependencies: - shebang-regex "^1.0.0" - -shebang-regex@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/shebang-regex/download/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" - -signal-exit@^3.0.0, signal-exit@^3.0.2: - version "3.0.2" - resolved "http://registry.npm.taobao.org/signal-exit/download/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" - -simple-swizzle@^0.2.2: - version "0.2.2" - resolved "http://registry.npm.taobao.org/simple-swizzle/download/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" - dependencies: - is-arrayish "^0.3.1" - -slash@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/slash/download/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" - -slice-ansi@1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/slice-ansi/download/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" - dependencies: - is-fullwidth-code-point "^2.0.0" - -snapdragon-node@^2.0.1: - version "2.1.1" - resolved "http://registry.npm.taobao.org/snapdragon-node/download/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" - dependencies: - define-property "^1.0.0" - isobject "^3.0.0" - snapdragon-util "^3.0.1" - -snapdragon-util@^3.0.1: - version "3.0.1" - resolved "http://registry.npm.taobao.org/snapdragon-util/download/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" - dependencies: - kind-of "^3.2.0" - -snapdragon@^0.8.1: - version "0.8.2" - resolved "http://registry.npm.taobao.org/snapdragon/download/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" - dependencies: - base "^0.11.1" - debug "^2.2.0" - define-property "^0.2.5" - extend-shallow "^2.0.1" - map-cache "^0.2.2" - source-map "^0.5.6" - source-map-resolve "^0.5.0" - use "^3.1.0" - -sockjs-client@1.1.5: - version "1.1.5" - resolved "http://registry.npm.taobao.org/sockjs-client/download/sockjs-client-1.1.5.tgz#1bb7c0f7222c40f42adf14f4442cbd1269771a83" - dependencies: - debug "^2.6.6" - eventsource "0.1.6" - faye-websocket "~0.11.0" - inherits "^2.0.1" - json3 "^3.3.2" - url-parse "^1.1.8" - -sockjs@0.3.19: - version "0.3.19" - resolved "http://registry.npm.taobao.org/sockjs/download/sockjs-0.3.19.tgz#d976bbe800af7bd20ae08598d582393508993c0d" - dependencies: - faye-websocket "^0.10.0" - uuid "^3.0.1" - -source-list-map@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/source-list-map/download/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085" - -source-map-resolve@^0.5.0: - version "0.5.2" - resolved "http://registry.npm.taobao.org/source-map-resolve/download/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" - dependencies: - atob "^2.1.1" - decode-uri-component "^0.2.0" - resolve-url "^0.2.1" - source-map-url "^0.4.0" - urix "^0.1.0" - -source-map-support@^0.4.15: - version "0.4.18" - resolved "http://registry.npm.taobao.org/source-map-support/download/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" - dependencies: - source-map "^0.5.6" - -source-map-url@^0.4.0: - version "0.4.0" - resolved "http://registry.npm.taobao.org/source-map-url/download/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" - -source-map@0.5.x, source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7: - version "0.5.7" - resolved "http://registry.npm.taobao.org/source-map/download/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" - -source-map@^0.6.1, source-map@~0.6.1: - version "0.6.1" - resolved "http://registry.npm.taobao.org/source-map/download/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - -space-separated-tokens@^1.0.0: - version "1.1.2" - resolved "http://registry.npm.taobao.org/space-separated-tokens/download/space-separated-tokens-1.1.2.tgz#e95ab9d19ae841e200808cd96bc7bd0adbbb3412" - dependencies: - trim "0.0.1" - -spdx-correct@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/spdx-correct/download/spdx-correct-3.0.0.tgz#05a5b4d7153a195bc92c3c425b69f3b2a9524c82" - dependencies: - spdx-expression-parse "^3.0.0" - spdx-license-ids "^3.0.0" - -spdx-exceptions@^2.1.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/spdx-exceptions/download/spdx-exceptions-2.1.0.tgz#2c7ae61056c714a5b9b9b2b2af7d311ef5c78fe9" - -spdx-expression-parse@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/spdx-expression-parse/download/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" - dependencies: - spdx-exceptions "^2.1.0" - spdx-license-ids "^3.0.0" - -spdx-license-ids@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/spdx-license-ids/download/spdx-license-ids-3.0.0.tgz#7a7cd28470cc6d3a1cfe6d66886f6bc430d3ac87" - -spdy-transport@^2.0.18: - version "2.1.0" - resolved "http://registry.npm.taobao.org/spdy-transport/download/spdy-transport-2.1.0.tgz#4bbb15aaffed0beefdd56ad61dbdc8ba3e2cb7a1" - dependencies: - debug "^2.6.8" - detect-node "^2.0.3" - hpack.js "^2.1.6" - obuf "^1.1.1" - readable-stream "^2.2.9" - safe-buffer "^5.0.1" - wbuf "^1.7.2" - -spdy@^3.4.1: - version "3.4.7" - resolved "http://registry.npm.taobao.org/spdy/download/spdy-3.4.7.tgz#42ff41ece5cc0f99a3a6c28aabb73f5c3b03acbc" - dependencies: - debug "^2.6.8" - handle-thing "^1.2.5" - http-deceiver "^1.2.7" - safe-buffer "^5.0.1" - select-hose "^2.0.0" - spdy-transport "^2.0.18" - -split-string@^3.0.1, split-string@^3.0.2: - version "3.1.0" - resolved "http://registry.npm.taobao.org/split-string/download/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" - dependencies: - extend-shallow "^3.0.0" - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "http://registry.npm.taobao.org/sprintf-js/download/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - -ssri@^5.2.4: - version "5.3.0" - resolved "http://registry.npm.taobao.org/ssri/download/ssri-5.3.0.tgz#ba3872c9c6d33a0704a7d71ff045e5ec48999d06" - dependencies: - safe-buffer "^5.1.1" - -stable@~0.1.6: - version "0.1.8" - resolved "http://registry.npm.taobao.org/stable/download/stable-0.1.8.tgz#836eb3c8382fe2936feaf544631017ce7d47a3cf" - -static-extend@^0.1.1: - version "0.1.2" - resolved "http://registry.npm.taobao.org/static-extend/download/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" - dependencies: - define-property "^0.2.5" - object-copy "^0.1.0" - -"statuses@>= 1.3.1 < 2", "statuses@>= 1.4.0 < 2": - version "1.5.0" - resolved "http://registry.npm.taobao.org/statuses/download/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" - -statuses@~1.4.0: - version "1.4.0" - resolved "http://registry.npm.taobao.org/statuses/download/statuses-1.4.0.tgz#bb73d446da2796106efcc1b601a253d6c46bd087" - -stream-browserify@^2.0.1: - version "2.0.1" - resolved "http://registry.npm.taobao.org/stream-browserify/download/stream-browserify-2.0.1.tgz#66266ee5f9bdb9940a4e4514cafb43bb71e5c9db" - dependencies: - inherits "~2.0.1" - readable-stream "^2.0.2" - -stream-each@^1.1.0: - version "1.2.3" - resolved "http://registry.npm.taobao.org/stream-each/download/stream-each-1.2.3.tgz#ebe27a0c389b04fbcc233642952e10731afa9bae" - dependencies: - end-of-stream "^1.1.0" - stream-shift "^1.0.0" - -stream-http@^2.7.2: - version "2.8.3" - resolved "http://registry.npm.taobao.org/stream-http/download/stream-http-2.8.3.tgz#b2d242469288a5a27ec4fe8933acf623de6514fc" - dependencies: - builtin-status-codes "^3.0.0" - inherits "^2.0.1" - readable-stream "^2.3.6" - to-arraybuffer "^1.0.0" - xtend "^4.0.0" - -stream-shift@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/stream-shift/download/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" - -string-convert@^0.2.0: - version "0.2.1" - resolved "http://registry.npm.taobao.org/string-convert/download/string-convert-0.2.1.tgz#6982cc3049fbb4cd85f8b24568b9d9bf39eeff97" - -string-width@^1.0.1: - version "1.0.2" - resolved "http://registry.npm.taobao.org/string-width/download/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" - -"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: - version "2.1.1" - resolved "http://registry.npm.taobao.org/string-width/download/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" - -string_decoder@^1.0.0, string_decoder@~1.1.1: - version "1.1.1" - resolved "http://registry.npm.taobao.org/string_decoder/download/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - dependencies: - safe-buffer "~5.1.0" - -string_decoder@~0.10.x: - version "0.10.31" - resolved "http://registry.npm.taobao.org/string_decoder/download/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" - -strip-ansi@^3.0.0, strip-ansi@^3.0.1: - version "3.0.1" - resolved "http://registry.npm.taobao.org/strip-ansi/download/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - dependencies: - ansi-regex "^2.0.0" - -strip-ansi@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/strip-ansi/download/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" - dependencies: - ansi-regex "^3.0.0" - -strip-bom@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/strip-bom/download/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" - dependencies: - is-utf8 "^0.2.0" - -strip-bom@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/strip-bom/download/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" - -strip-eof@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/strip-eof/download/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" - -strip-indent@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/strip-indent/download/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2" - dependencies: - get-stdin "^4.0.1" - -strip-json-comments@~2.0.1: - version "2.0.1" - resolved "http://registry.npm.taobao.org/strip-json-comments/download/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - -style-loader@^0.22.1: - version "0.22.1" - resolved "http://registry.npm.taobao.org/style-loader/download/style-loader-0.22.1.tgz#901ea28aac78fcc00c5075585ac07d7ef3f87a52" - dependencies: - loader-utils "^1.1.0" - schema-utils "^0.4.5" - -stylehacks@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/stylehacks/download/stylehacks-4.0.0.tgz#64b323951c4a24e5fc7b2ec06c137bf32d155e8a" - dependencies: - browserslist "^4.0.0" - postcss "^6.0.0" - postcss-selector-parser "^3.0.0" - -supports-color@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/supports-color/download/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - -supports-color@^5.1.0, supports-color@^5.3.0, supports-color@^5.4.0: - version "5.4.0" - resolved "http://registry.npm.taobao.org/supports-color/download/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54" - dependencies: - has-flag "^3.0.0" - -svgo@^1.0.0: - version "1.0.5" - resolved "http://registry.npm.taobao.org/svgo/download/svgo-1.0.5.tgz#7040364c062a0538abacff4401cea6a26a7a389a" - dependencies: - coa "~2.0.1" - colors "~1.1.2" - css-select "~1.3.0-rc0" - css-select-base-adapter "~0.1.0" - css-tree "1.0.0-alpha25" - css-url-regex "^1.1.0" - csso "^3.5.0" - js-yaml "~3.10.0" - mkdirp "~0.5.1" - object.values "^1.0.4" - sax "~1.2.4" - stable "~0.1.6" - unquote "~1.1.1" - util.promisify "~1.0.0" - -table@4.0.2: - version "4.0.2" - resolved "http://registry.npm.taobao.org/table/download/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" - dependencies: - ajv "^5.2.3" - ajv-keywords "^2.1.0" - chalk "^2.1.0" - lodash "^4.17.4" - slice-ansi "1.0.0" - string-width "^2.1.1" - -tapable@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/tapable/download/tapable-1.0.0.tgz#cbb639d9002eed9c6b5975eb20598d7936f1f9f2" - -tar@^4: - version "4.4.6" - resolved "http://registry.npm.taobao.org/tar/download/tar-4.4.6.tgz#63110f09c00b4e60ac8bcfe1bf3c8660235fbc9b" - dependencies: - chownr "^1.0.1" - fs-minipass "^1.2.5" - minipass "^2.3.3" - minizlib "^1.1.0" - mkdirp "^0.5.0" - safe-buffer "^5.1.2" - yallist "^3.0.2" - -text-loader@^0.0.1: - version "0.0.1" - resolved "http://registry.npm.taobao.org/text-loader/download/text-loader-0.0.1.tgz#8bf75d749b7c0579c939920051c69ea572ebddc1" - -text-table@^0.2.0, text-table@~0.2.0: - version "0.2.0" - resolved "http://registry.npm.taobao.org/text-table/download/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" - -through2@^2.0.0: - version "2.0.3" - resolved "http://registry.npm.taobao.org/through2/download/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be" - dependencies: - readable-stream "^2.1.5" - xtend "~4.0.1" - -through@^2.3.6: - version "2.3.8" - resolved "http://registry.npm.taobao.org/through/download/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - -thunky@^1.0.2: - version "1.0.2" - resolved "http://registry.npm.taobao.org/thunky/download/thunky-1.0.2.tgz#a862e018e3fb1ea2ec3fce5d55605cf57f247371" - -timers-browserify@^2.0.4: - version "2.0.10" - resolved "http://registry.npm.taobao.org/timers-browserify/download/timers-browserify-2.0.10.tgz#1d28e3d2aadf1d5a5996c4e9f95601cd053480ae" - dependencies: - setimmediate "^1.0.4" - -timsort@^0.3.0: - version "0.3.0" - resolved "http://registry.npm.taobao.org/timsort/download/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" - -tiny-emitter@^2.0.0: - version "2.0.2" - resolved "http://registry.npm.taobao.org/tiny-emitter/download/tiny-emitter-2.0.2.tgz#82d27468aca5ade8e5fd1e6d22b57dd43ebdfb7c" - -tmp@^0.0.33: - version "0.0.33" - resolved "http://registry.npm.taobao.org/tmp/download/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" - dependencies: - os-tmpdir "~1.0.2" - -to-arraybuffer@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.taobao.org/to-arraybuffer/download/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" - -to-fast-properties@^1.0.3: - version "1.0.3" - resolved "http://registry.npm.taobao.org/to-fast-properties/download/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" - -to-fast-properties@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/to-fast-properties/download/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" - -to-object-path@^0.3.0: - version "0.3.0" - resolved "http://registry.npm.taobao.org/to-object-path/download/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" - dependencies: - kind-of "^3.0.2" - -to-regex-range@^2.1.0: - version "2.1.1" - resolved "http://registry.npm.taobao.org/to-regex-range/download/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" - dependencies: - is-number "^3.0.0" - repeat-string "^1.6.1" - -to-regex@^3.0.1, to-regex@^3.0.2: - version "3.0.2" - resolved "http://registry.npm.taobao.org/to-regex/download/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" - dependencies: - define-property "^2.0.2" - extend-shallow "^3.0.2" - regex-not "^1.0.2" - safe-regex "^1.1.0" - -toposort@^1.0.0: - version "1.0.7" - resolved "http://registry.npm.taobao.org/toposort/download/toposort-1.0.7.tgz#2e68442d9f64ec720b8cc89e6443ac6caa950029" - -trim-newlines@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/trim-newlines/download/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" - -trim-right@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/trim-right/download/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" - -trim@0.0.1: - version "0.0.1" - resolved "http://registry.npm.taobao.org/trim/download/trim-0.0.1.tgz#5858547f6b290757ee95cccc666fb50084c460dd" - -tryer@^1.0.0: - version "1.0.1" - resolved "http://registry.npm.taobao.org/tryer/download/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8" - -tslib@^1.9.0: - version "1.9.3" - resolved "http://registry.npm.taobao.org/tslib/download/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" - -tty-browserify@0.0.0: - version "0.0.0" - resolved "http://registry.npm.taobao.org/tty-browserify/download/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" - -type-check@~0.3.2: - version "0.3.2" - resolved "http://registry.npm.taobao.org/type-check/download/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" - dependencies: - prelude-ls "~1.1.2" - -type-is@~1.6.15, type-is@~1.6.16: - version "1.6.16" - resolved "http://registry.npm.taobao.org/type-is/download/type-is-1.6.16.tgz#f89ce341541c672b25ee7ae3c73dee3b2be50194" - dependencies: - media-typer "0.3.0" - mime-types "~2.1.18" - -typedarray@^0.0.6: - version "0.0.6" - resolved "http://registry.npm.taobao.org/typedarray/download/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" - -ua-parser-js@^0.7.18: - version "0.7.18" - resolved "http://registry.npm.taobao.org/ua-parser-js/download/ua-parser-js-0.7.18.tgz#a7bfd92f56edfb117083b69e31d2aa8882d4b1ed" - -uglify-es@^3.3.4: - version "3.3.9" - resolved "http://registry.npm.taobao.org/uglify-es/download/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677" - dependencies: - commander "~2.13.0" - source-map "~0.6.1" - -uglify-js@3.4.x: - version "3.4.7" - resolved "http://registry.npm.taobao.org/uglify-js/download/uglify-js-3.4.7.tgz#4df6b92e54789aa921a254cb1e33704d6ec12b89" - dependencies: - commander "~2.16.0" - source-map "~0.6.1" - -uglifyjs-webpack-plugin@^1.2.4, uglifyjs-webpack-plugin@^1.2.7: - version "1.3.0" - resolved "http://registry.npm.taobao.org/uglifyjs-webpack-plugin/download/uglifyjs-webpack-plugin-1.3.0.tgz#75f548160858163a08643e086d5fefe18a5d67de" - dependencies: - cacache "^10.0.4" - find-cache-dir "^1.0.0" - schema-utils "^0.4.5" - serialize-javascript "^1.4.0" - source-map "^0.6.1" - uglify-es "^3.3.4" - webpack-sources "^1.1.0" - worker-farm "^1.5.2" - -union-value@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/union-value/download/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" - dependencies: - arr-union "^3.1.0" - get-value "^2.0.6" - is-extendable "^0.1.1" - set-value "^0.4.3" - -uniq@^1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/uniq/download/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" - -uniqs@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/uniqs/download/uniqs-2.0.0.tgz#ffede4b36b25290696e6e165d4a59edb998e6b02" - -unique-filename@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/unique-filename/download/unique-filename-1.1.0.tgz#d05f2fe4032560871f30e93cbe735eea201514f3" - dependencies: - unique-slug "^2.0.0" - -unique-slug@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/unique-slug/download/unique-slug-2.0.0.tgz#db6676e7c7cc0629878ff196097c78855ae9f4ab" - dependencies: - imurmurhash "^0.1.4" - -unpipe@1.0.0, unpipe@~1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/unpipe/download/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" - -unquote@~1.1.1: - version "1.1.1" - resolved "http://registry.npm.taobao.org/unquote/download/unquote-1.1.1.tgz#8fded7324ec6e88a0ff8b905e7c098cdc086d544" - -unset-value@^1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/unset-value/download/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" - dependencies: - has-value "^0.3.1" - isobject "^3.0.0" - -upath@^1.0.5: - version "1.1.0" - resolved "http://registry.npm.taobao.org/upath/download/upath-1.1.0.tgz#35256597e46a581db4793d0ce47fa9aebfc9fabd" - -upper-case@^1.1.1: - version "1.1.3" - resolved "http://registry.npm.taobao.org/upper-case/download/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598" - -uri-js@^4.2.1: - version "4.2.2" - resolved "http://registry.npm.taobao.org/uri-js/download/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" - dependencies: - punycode "^2.1.0" - -urix@^0.1.0: - version "0.1.0" - resolved "http://registry.npm.taobao.org/urix/download/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" - -url-join@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/url-join/download/url-join-4.0.0.tgz#4d3340e807d3773bda9991f8305acdcc2a665d2a" - -url-parse@^1.1.8, url-parse@^1.4.3: - version "1.4.3" - resolved "http://registry.npm.taobao.org/url-parse/download/url-parse-1.4.3.tgz#bfaee455c889023219d757e045fa6a684ec36c15" - dependencies: - querystringify "^2.0.0" - requires-port "^1.0.0" - -url@^0.11.0: - version "0.11.0" - resolved "http://registry.npm.taobao.org/url/download/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" - dependencies: - punycode "1.3.2" - querystring "0.2.0" - -use@^3.1.0: - version "3.1.1" - resolved "http://registry.npm.taobao.org/use/download/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" - -util-deprecate@~1.0.1: - version "1.0.2" - resolved "http://registry.npm.taobao.org/util-deprecate/download/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - -util.promisify@1.0.0, util.promisify@~1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/util.promisify/download/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030" - dependencies: - define-properties "^1.1.2" - object.getownpropertydescriptors "^2.0.3" - -util@0.10.3: - version "0.10.3" - resolved "http://registry.npm.taobao.org/util/download/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" - dependencies: - inherits "2.0.1" - -util@^0.10.3: - version "0.10.4" - resolved "http://registry.npm.taobao.org/util/download/util-0.10.4.tgz#3aa0125bfe668a4672de58857d3ace27ecb76901" - dependencies: - inherits "2.0.3" - -utila@~0.3: - version "0.3.3" - resolved "http://registry.npm.taobao.org/utila/download/utila-0.3.3.tgz#d7e8e7d7e309107092b05f8d9688824d633a4226" - -utila@~0.4: - version "0.4.0" - resolved "http://registry.npm.taobao.org/utila/download/utila-0.4.0.tgz#8a16a05d445657a3aea5eecc5b12a4fa5379772c" - -utils-merge@1.0.1: - version "1.0.1" - resolved "http://registry.npm.taobao.org/utils-merge/download/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" - -uuid@^3.0.1, uuid@^3.1.0: - version "3.3.2" - resolved "http://registry.npm.taobao.org/uuid/download/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" - -v8-compile-cache@^2.0.0: - version "2.0.2" - resolved "http://registry.npm.taobao.org/v8-compile-cache/download/v8-compile-cache-2.0.2.tgz#a428b28bb26790734c4fc8bc9fa106fccebf6a6c" - -validate-npm-package-license@^3.0.1: - version "3.0.4" - resolved "http://registry.npm.taobao.org/validate-npm-package-license/download/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" - dependencies: - spdx-correct "^3.0.0" - spdx-expression-parse "^3.0.0" - -value-equal@^0.4.0: - version "0.4.0" - resolved "http://registry.npm.taobao.org/value-equal/download/value-equal-0.4.0.tgz#c5bdd2f54ee093c04839d71ce2e4758a6890abc7" - -vary@~1.1.2: - version "1.1.2" - resolved "http://registry.npm.taobao.org/vary/download/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" - -vendors@^1.0.0: - version "1.0.2" - resolved "http://registry.npm.taobao.org/vendors/download/vendors-1.0.2.tgz#7fcb5eef9f5623b156bcea89ec37d63676f21801" - -vm-browserify@0.0.4: - version "0.0.4" - resolved "http://registry.npm.taobao.org/vm-browserify/download/vm-browserify-0.0.4.tgz#5d7ea45bbef9e4a6ff65f95438e0a87c357d5a73" - dependencies: - indexof "0.0.1" - -warning@2.x: - version "2.1.0" - resolved "http://registry.npm.taobao.org/warning/download/warning-2.1.0.tgz#21220d9c63afc77a8c92111e011af705ce0c6901" - dependencies: - loose-envify "^1.0.0" - -warning@^3.0.0: - version "3.0.0" - resolved "http://registry.npm.taobao.org/warning/download/warning-3.0.0.tgz#32e5377cb572de4ab04753bdf8821c01ed605b7c" - dependencies: - loose-envify "^1.0.0" - -warning@^4.0.1, warning@~4.0.1: - version "4.0.1" - resolved "http://registry.npm.taobao.org/warning/download/warning-4.0.1.tgz#66ce376b7fbfe8a887c22bdf0e7349d73d397745" - dependencies: - loose-envify "^1.0.0" - -watchpack@^1.5.0: - version "1.6.0" - resolved "http://registry.npm.taobao.org/watchpack/download/watchpack-1.6.0.tgz#4bc12c2ebe8aa277a71f1d3f14d685c7b446cd00" - dependencies: - chokidar "^2.0.2" - graceful-fs "^4.1.2" - neo-async "^2.5.0" - -wbuf@^1.1.0, wbuf@^1.7.2: - version "1.7.3" - resolved "http://registry.npm.taobao.org/wbuf/download/wbuf-1.7.3.tgz#c1d8d149316d3ea852848895cb6a0bfe887b87df" - dependencies: - minimalistic-assert "^1.0.0" - -webpack-bundle-analyzer@^2.13.1: - version "2.13.1" - resolved "http://registry.npm.taobao.org/webpack-bundle-analyzer/download/webpack-bundle-analyzer-2.13.1.tgz#07d2176c6e86c3cdce4c23e56fae2a7b6b4ad526" - dependencies: - acorn "^5.3.0" - bfj-node4 "^5.2.0" - chalk "^2.3.0" - commander "^2.13.0" - ejs "^2.5.7" - express "^4.16.2" - filesize "^3.5.11" - gzip-size "^4.1.0" - lodash "^4.17.4" - mkdirp "^0.5.1" - opener "^1.4.3" - ws "^4.0.0" - -webpack-cli@^3.1.0: - version "3.1.0" - resolved "http://registry.npm.taobao.org/webpack-cli/download/webpack-cli-3.1.0.tgz#d71a83687dcfeb758fdceeb0fe042f96bcf62994" - dependencies: - chalk "^2.4.1" - cross-spawn "^6.0.5" - enhanced-resolve "^4.0.0" - global-modules-path "^2.1.0" - import-local "^1.0.0" - inquirer "^6.0.0" - interpret "^1.1.0" - loader-utils "^1.1.0" - supports-color "^5.4.0" - v8-compile-cache "^2.0.0" - yargs "^12.0.1" - -webpack-dev-middleware@3.1.3: - version "3.1.3" - resolved "http://registry.npm.taobao.org/webpack-dev-middleware/download/webpack-dev-middleware-3.1.3.tgz#8b32aa43da9ae79368c1bf1183f2b6cf5e1f39ed" - dependencies: - loud-rejection "^1.6.0" - memory-fs "~0.4.1" - mime "^2.1.0" - path-is-absolute "^1.0.0" - range-parser "^1.0.3" - url-join "^4.0.0" - webpack-log "^1.0.1" - -webpack-dev-server@^3.1.5: - version "3.1.5" - resolved "http://registry.npm.taobao.org/webpack-dev-server/download/webpack-dev-server-3.1.5.tgz#87477252e1ac6789303fb8cd3e585fa5d508a401" - dependencies: - ansi-html "0.0.7" - array-includes "^3.0.3" - bonjour "^3.5.0" - chokidar "^2.0.0" - compression "^1.5.2" - connect-history-api-fallback "^1.3.0" - debug "^3.1.0" - del "^3.0.0" - express "^4.16.2" - html-entities "^1.2.0" - http-proxy-middleware "~0.18.0" - import-local "^1.0.0" - internal-ip "1.2.0" - ip "^1.1.5" - killable "^1.0.0" - loglevel "^1.4.1" - opn "^5.1.0" - portfinder "^1.0.9" - selfsigned "^1.9.1" - serve-index "^1.7.2" - sockjs "0.3.19" - sockjs-client "1.1.5" - spdy "^3.4.1" - strip-ansi "^3.0.0" - supports-color "^5.1.0" - webpack-dev-middleware "3.1.3" - webpack-log "^1.1.2" - yargs "11.0.0" - -webpack-log@^1.0.1, webpack-log@^1.1.2: - version "1.2.0" - resolved "http://registry.npm.taobao.org/webpack-log/download/webpack-log-1.2.0.tgz#a4b34cda6b22b518dbb0ab32e567962d5c72a43d" - dependencies: - chalk "^2.1.0" - log-symbols "^2.1.0" - loglevelnext "^1.0.1" - uuid "^3.1.0" - -webpack-merge@^4.1.4: - version "4.1.4" - resolved "http://registry.npm.taobao.org/webpack-merge/download/webpack-merge-4.1.4.tgz#0fde38eabf2d5fd85251c24a5a8c48f8a3f4eb7b" - dependencies: - lodash "^4.17.5" - -webpack-sources@^1.0.1, webpack-sources@^1.1.0: - version "1.1.0" - resolved "http://registry.npm.taobao.org/webpack-sources/download/webpack-sources-1.1.0.tgz#a101ebae59d6507354d71d8013950a3a8b7a5a54" - dependencies: - source-list-map "^2.0.0" - source-map "~0.6.1" - -webpack@^4.16.5: - version "4.16.5" - resolved "http://registry.npm.taobao.org/webpack/download/webpack-4.16.5.tgz#29fb39462823d7eb8aefcab8b45f7f241db0d092" - dependencies: - "@webassemblyjs/ast" "1.5.13" - "@webassemblyjs/helper-module-context" "1.5.13" - "@webassemblyjs/wasm-edit" "1.5.13" - "@webassemblyjs/wasm-opt" "1.5.13" - "@webassemblyjs/wasm-parser" "1.5.13" - acorn "^5.6.2" - acorn-dynamic-import "^3.0.0" - ajv "^6.1.0" - ajv-keywords "^3.1.0" - chrome-trace-event "^1.0.0" - enhanced-resolve "^4.1.0" - eslint-scope "^4.0.0" - json-parse-better-errors "^1.0.2" - loader-runner "^2.3.0" - loader-utils "^1.1.0" - memory-fs "~0.4.1" - micromatch "^3.1.8" - mkdirp "~0.5.0" - neo-async "^2.5.0" - node-libs-browser "^2.0.0" - schema-utils "^0.4.4" - tapable "^1.0.0" - uglifyjs-webpack-plugin "^1.2.4" - watchpack "^1.5.0" - webpack-sources "^1.0.1" - -websocket-driver@>=0.5.1: - version "0.7.0" - resolved "http://registry.npm.taobao.org/websocket-driver/download/websocket-driver-0.7.0.tgz#0caf9d2d755d93aee049d4bdd0d3fe2cca2a24eb" - dependencies: - http-parser-js ">=0.4.0" - websocket-extensions ">=0.1.1" - -websocket-extensions@>=0.1.1: - version "0.1.3" - resolved "http://registry.npm.taobao.org/websocket-extensions/download/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29" - -whatwg-fetch@>=0.10.0: - version "2.0.4" - resolved "http://registry.npm.taobao.org/whatwg-fetch/download/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f" - -which-module@^2.0.0: - version "2.0.0" - resolved "http://registry.npm.taobao.org/which-module/download/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" - -which@^1.2.9: - version "1.3.1" - resolved "http://registry.npm.taobao.org/which/download/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" - dependencies: - isexe "^2.0.0" - -wide-align@^1.1.0: - version "1.1.3" - resolved "http://registry.npm.taobao.org/wide-align/download/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" - dependencies: - string-width "^1.0.2 || 2" - -wordwrap@~1.0.0: - version "1.0.0" - resolved "http://registry.npm.taobao.org/wordwrap/download/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" - -worker-farm@^1.5.2: - version "1.6.0" - resolved "http://registry.npm.taobao.org/worker-farm/download/worker-farm-1.6.0.tgz#aecc405976fab5a95526180846f0dba288f3a4a0" - dependencies: - errno "~0.1.7" - -wrap-ansi@^2.0.0: - version "2.1.0" - resolved "http://registry.npm.taobao.org/wrap-ansi/download/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" - dependencies: - string-width "^1.0.1" - strip-ansi "^3.0.1" - -wrappy@1: - version "1.0.2" - resolved "http://registry.npm.taobao.org/wrappy/download/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - -write@^0.2.1: - version "0.2.1" - resolved "http://registry.npm.taobao.org/write/download/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" - dependencies: - mkdirp "^0.5.1" - -ws@^4.0.0: - version "4.1.0" - resolved "http://registry.npm.taobao.org/ws/download/ws-4.1.0.tgz#a979b5d7d4da68bf54efe0408967c324869a7289" - dependencies: - async-limiter "~1.0.0" - safe-buffer "~5.1.0" - -xregexp@4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/xregexp/download/xregexp-4.0.0.tgz#e698189de49dd2a18cc5687b05e17c8e43943020" - -xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.1: - version "4.0.1" - resolved "http://registry.npm.taobao.org/xtend/download/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" - -y18n@^3.2.1: - version "3.2.1" - resolved "http://registry.npm.taobao.org/y18n/download/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" - -"y18n@^3.2.1 || ^4.0.0", y18n@^4.0.0: - version "4.0.0" - resolved "http://registry.npm.taobao.org/y18n/download/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" - -yallist@^2.1.2: - version "2.1.2" - resolved "http://registry.npm.taobao.org/yallist/download/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" - -yallist@^3.0.0, yallist@^3.0.2: - version "3.0.2" - resolved "http://registry.npm.taobao.org/yallist/download/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9" - -yargs-parser@^10.1.0: - version "10.1.0" - resolved "http://registry.npm.taobao.org/yargs-parser/download/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" - dependencies: - camelcase "^4.1.0" - -yargs-parser@^9.0.2: - version "9.0.2" - resolved "http://registry.npm.taobao.org/yargs-parser/download/yargs-parser-9.0.2.tgz#9ccf6a43460fe4ed40a9bb68f48d43b8a68cc077" - dependencies: - camelcase "^4.1.0" - -yargs@11.0.0: - version "11.0.0" - resolved "http://registry.npm.taobao.org/yargs/download/yargs-11.0.0.tgz#c052931006c5eee74610e5fc0354bedfd08a201b" - dependencies: - cliui "^4.0.0" - decamelize "^1.1.1" - find-up "^2.1.0" - get-caller-file "^1.0.1" - os-locale "^2.0.0" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^2.0.0" - which-module "^2.0.0" - y18n "^3.2.1" - yargs-parser "^9.0.2" - -yargs@^12.0.1: - version "12.0.1" - resolved "http://registry.npm.taobao.org/yargs/download/yargs-12.0.1.tgz#6432e56123bb4e7c3562115401e98374060261c2" - dependencies: - cliui "^4.0.0" - decamelize "^2.0.0" - find-up "^3.0.0" - get-caller-file "^1.0.1" - os-locale "^2.0.0" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^2.0.0" - which-module "^2.0.0" - y18n "^3.2.1 || ^4.0.0" - yargs-parser "^10.1.0" diff --git a/lib/components/AutoComplete/index.js b/lib/components/AutoComplete/index.js deleted file mode 100644 index e62f4e9..0000000 --- a/lib/components/AutoComplete/index.js +++ /dev/null @@ -1,73 +0,0 @@ -'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; }; }(); - -var _class; - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -var _util = require('../_base/util'); - -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 AutoComplete = (0, _ReactComponent2.default)(_class = function () { - function AutoComplete(props) { - var _this = this; - - _classCallCheck(this, AutoComplete); - - this.destroy = function () { - if (_this.instance.dispose) { - _this.instance.dispose(); - } - }; - - this.props = props; - this.map = global.bMapInstance; - this.init(); - } - - _createClass(AutoComplete, [{ - key: 'init', - value: function init() { - var _props = this.props, - input = _props.input, - events = _props.events, - value = _props.value, - location = _props.location, - searchComplete = _props.searchComplete; - - - this.instance = new global.BMap.Autocomplete({ - input: input, - location: location || this.map, - onSearchComplete: searchComplete - }); - - if (value) { - this.instance.setInputValue(value); - } - - (0, _util.bindEvents)(this.instance, 'AUTO_COMPLETE', events); - } - }, { - key: 'onPropsUpdate', - value: function onPropsUpdate(newProps) { - this.props = newProps; - this.destroy(); - this.init(); - } - }]); - - return AutoComplete; -}()) || _class; - -exports.default = AutoComplete; \ No newline at end of file diff --git a/lib/components/Control/BaseControl.js b/lib/components/Control/BaseControl.js deleted file mode 100644 index 6ee018f..0000000 --- a/lib/components/Control/BaseControl.js +++ /dev/null @@ -1,55 +0,0 @@ -'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; }; }(); - -var _reactDom = require('react-dom'); - -var _util = require('../_base/util'); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var BaseControl = function () { - function BaseControl(props) { - _classCallCheck(this, BaseControl); - - this.props = props; - this.state = {}; - this.map = global.bMapInstance; - - this.init(); - } - - _createClass(BaseControl, [{ - key: 'onPropsUpdate', - value: function onPropsUpdate(newProps) { - this.props = newProps; - (0, _util.unBindEvents)(this.instance); - this.destroy(); - this.init(); - } - }, { - key: 'setState', - value: function setState(param) { - if (param !== null) { - this.state = Object.assign(this.state, param); - } - if (this.render) { - (0, _reactDom.render)(this.render(), this.container); - } - } - }, { - key: 'destroy', - value: function destroy() { - this.map.removeControl(this.instance); - this.instance = null; - } - }]); - - return BaseControl; -}(); - -exports.default = BaseControl; \ No newline at end of file diff --git a/lib/components/Control/CityList.js b/lib/components/Control/CityList.js deleted file mode 100644 index ee533dd..0000000 --- a/lib/components/Control/CityList.js +++ /dev/null @@ -1,72 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseControl2 = require('./BaseControl'); - -var _BaseControl3 = _interopRequireDefault(_BaseControl2); - -var _util = require('../_base/util'); - -var _ControlAnchor = require('../../constants/ControlAnchor'); - -var _ControlAnchor2 = _interopRequireDefault(_ControlAnchor); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var CityList = (0, _ReactComponent2.default)(_class = function (_BaseControl) { - _inherits(CityList, _BaseControl); - - function CityList() { - _classCallCheck(this, CityList); - - return _possibleConstructorReturn(this, (CityList.__proto__ || Object.getPrototypeOf(CityList)).apply(this, arguments)); - } - - _createClass(CityList, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$anchor = _props.anchor, - anchor = _props$anchor === undefined ? _ControlAnchor2.default.TOP_LEFT : _props$anchor, - _props$offset = _props.offset, - offset = _props$offset === undefined ? { - width: 0, - height: 0 - } : _props$offset, - onChangeBefore = _props.onChangeBefore, - onChangeAfter = _props.onChangeAfter; - - - var opts = { - anchor: global[anchor], - offset: (0, _util.getSize)(offset.width, offset.height), - onChangeBefore: onChangeBefore, - onChangeAfter: onChangeAfter - }; - - this.instance = new global.BMap.CityListControl(opts); - this.map.addControl(this.instance); - } - }]); - - return CityList; -}(_BaseControl3.default)) || _class; - -exports.default = CityList; \ No newline at end of file diff --git a/lib/components/Control/Copyright.js b/lib/components/Control/Copyright.js deleted file mode 100644 index f6a2df0..0000000 --- a/lib/components/Control/Copyright.js +++ /dev/null @@ -1,74 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseControl2 = require('./BaseControl'); - -var _BaseControl3 = _interopRequireDefault(_BaseControl2); - -var _util = require('../_base/util'); - -var _ControlAnchor = require('../../constants/ControlAnchor'); - -var _ControlAnchor2 = _interopRequireDefault(_ControlAnchor); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Copyright = (0, _ReactComponent2.default)(_class = function (_BaseControl) { - _inherits(Copyright, _BaseControl); - - function Copyright() { - _classCallCheck(this, Copyright); - - return _possibleConstructorReturn(this, (Copyright.__proto__ || Object.getPrototypeOf(Copyright)).apply(this, arguments)); - } - - _createClass(Copyright, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$anchor = _props.anchor, - anchor = _props$anchor === undefined ? _ControlAnchor2.default.BOTTOM_LEFT : _props$anchor, - _props$offset = _props.offset, - offset = _props$offset === undefined ? { - width: 0, - height: 0 - } : _props$offset, - content = _props.content; - - - var opts = { - anchor: global[anchor], - offset: (0, _util.getSize)(offset.width, offset.height) - }; - - this.instance = new global.BMap.CopyrightControl(opts); - this.instance.addCopyright({ - id: 1, - content: content, - bounds: global.bMapInstance.getBounds() - }); - this.map.addControl(this.instance); - } - }]); - - return Copyright; -}(_BaseControl3.default)) || _class; - -exports.default = Copyright; \ No newline at end of file diff --git a/lib/components/Control/Geolocation.js b/lib/components/Control/Geolocation.js deleted file mode 100644 index 06d8b5a..0000000 --- a/lib/components/Control/Geolocation.js +++ /dev/null @@ -1,81 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseControl2 = require('./BaseControl'); - -var _BaseControl3 = _interopRequireDefault(_BaseControl2); - -var _util = require('../_base/util'); - -var _ControlAnchor = require('../../constants/ControlAnchor'); - -var _ControlAnchor2 = _interopRequireDefault(_ControlAnchor); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Geolocation = (0, _ReactComponent2.default)(_class = function (_BaseControl) { - _inherits(Geolocation, _BaseControl); - - function Geolocation() { - _classCallCheck(this, Geolocation); - - return _possibleConstructorReturn(this, (Geolocation.__proto__ || Object.getPrototypeOf(Geolocation)).apply(this, arguments)); - } - - _createClass(Geolocation, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$anchor = _props.anchor, - anchor = _props$anchor === undefined ? _ControlAnchor2.default.BOTTOM_LEFT : _props$anchor, - _props$offset = _props.offset, - offset = _props$offset === undefined ? { - width: 0, - height: 0 - } : _props$offset, - _props$showAddressBar = _props.showAddressBar, - showAddressBar = _props$showAddressBar === undefined ? true : _props$showAddressBar, - _props$autoLocation = _props.autoLocation, - autoLocation = _props$autoLocation === undefined ? false : _props$autoLocation, - locationIcon = _props.locationIcon, - events = _props.events; - - - var opts = { - anchor: global[anchor], - offset: (0, _util.getSize)(offset.width, offset.height), - showAddressBar: showAddressBar, - enableAutoLocation: autoLocation - }; - - if (locationIcon) { - opts.locationIcon = (0, _util.createIcon)(locationIcon); - } - - this.instance = new global.BMap.GeolocationControl(opts); - (0, _util.bindEvents)(this.instance, 'GEOLOCATION', events); - this.map.addControl(this.instance); - } - }]); - - return Geolocation; -}(_BaseControl3.default)) || _class; - -exports.default = Geolocation; \ No newline at end of file diff --git a/lib/components/Control/MapType.js b/lib/components/Control/MapType.js deleted file mode 100644 index b10b3a7..0000000 --- a/lib/components/Control/MapType.js +++ /dev/null @@ -1,86 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseControl2 = require('./BaseControl'); - -var _BaseControl3 = _interopRequireDefault(_BaseControl2); - -var _util = require('../_base/util'); - -var _ControlAnchor = require('../../constants/ControlAnchor'); - -var _ControlAnchor2 = _interopRequireDefault(_ControlAnchor); - -var _MapTypeControlType = require('../../constants/MapTypeControlType'); - -var _MapTypeControlType2 = _interopRequireDefault(_MapTypeControlType); - -var _MapType = require('../../constants/MapType'); - -var _MapType2 = _interopRequireDefault(_MapType); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var MapType = (0, _ReactComponent2.default)(_class = function (_BaseControl) { - _inherits(MapType, _BaseControl); - - function MapType() { - _classCallCheck(this, MapType); - - return _possibleConstructorReturn(this, (MapType.__proto__ || Object.getPrototypeOf(MapType)).apply(this, arguments)); - } - - _createClass(MapType, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$anchor = _props.anchor, - anchor = _props$anchor === undefined ? _ControlAnchor2.default.TOP_RIGHT : _props$anchor, - _props$offset = _props.offset, - offset = _props$offset === undefined ? { - width: 10, - height: 10 - } : _props$offset, - _props$type = _props.type, - type = _props$type === undefined ? _MapTypeControlType2.default.HORIZONTAL : _props$type, - _props$mapTypes = _props.mapTypes, - mapTypes = _props$mapTypes === undefined ? [_MapType2.default.NORMAL, _MapType2.default.PERSPECTIVE, _MapType2.default.SATELLITE, _MapType2.default.HYBRID] : _props$mapTypes; - - - var types = mapTypes.map(function (item) { - return global[item]; - }); - - var opts = { - anchor: global[anchor], - offset: (0, _util.getSize)(offset.width, offset.height), - type: global[type], - mapTypes: types - }; - - this.instance = new global.BMap.MapTypeControl(opts); - this.map.addControl(this.instance); - } - }]); - - return MapType; -}(_BaseControl3.default)) || _class; - -exports.default = MapType; \ No newline at end of file diff --git a/lib/components/Control/Navigation.js b/lib/components/Control/Navigation.js deleted file mode 100644 index bd50977..0000000 --- a/lib/components/Control/Navigation.js +++ /dev/null @@ -1,81 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseControl2 = require('./BaseControl'); - -var _BaseControl3 = _interopRequireDefault(_BaseControl2); - -var _util = require('../_base/util'); - -var _ControlAnchor = require('../../constants/ControlAnchor'); - -var _ControlAnchor2 = _interopRequireDefault(_ControlAnchor); - -var _NavigationType = require('../../constants/NavigationType'); - -var _NavigationType2 = _interopRequireDefault(_NavigationType); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Navigation = (0, _ReactComponent2.default)(_class = function (_BaseControl) { - _inherits(Navigation, _BaseControl); - - function Navigation() { - _classCallCheck(this, Navigation); - - return _possibleConstructorReturn(this, (Navigation.__proto__ || Object.getPrototypeOf(Navigation)).apply(this, arguments)); - } - - _createClass(Navigation, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$anchor = _props.anchor, - anchor = _props$anchor === undefined ? _ControlAnchor2.default.TOP_LEFT : _props$anchor, - _props$offset = _props.offset, - offset = _props$offset === undefined ? { - width: 10, - height: 10 - } : _props$offset, - _props$type = _props.type, - type = _props$type === undefined ? _NavigationType2.default.LARGE : _props$type, - _props$showZoomInfo = _props.showZoomInfo, - showZoomInfo = _props$showZoomInfo === undefined ? true : _props$showZoomInfo, - _props$geolocation = _props.geolocation, - geolocation = _props$geolocation === undefined ? false : _props$geolocation; - - - var opts = { - anchor: global[anchor], - offset: (0, _util.getSize)(offset.width, offset.height), - type: global[type], - showZoomInfo: showZoomInfo, - enableGeolocation: geolocation - }; - - this.instance = new global.BMap.NavigationControl(opts); - this.map.addControl(this.instance); - } - }]); - - return Navigation; -}(_BaseControl3.default)) || _class; - -exports.default = Navigation; \ No newline at end of file diff --git a/lib/components/Control/OverviewMap.js b/lib/components/Control/OverviewMap.js deleted file mode 100644 index b5e6eda..0000000 --- a/lib/components/Control/OverviewMap.js +++ /dev/null @@ -1,79 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseControl2 = require('./BaseControl'); - -var _BaseControl3 = _interopRequireDefault(_BaseControl2); - -var _util = require('../_base/util'); - -var _ControlAnchor = require('../../constants/ControlAnchor'); - -var _ControlAnchor2 = _interopRequireDefault(_ControlAnchor); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var OverviewMap = (0, _ReactComponent2.default)(_class = function (_BaseControl) { - _inherits(OverviewMap, _BaseControl); - - function OverviewMap() { - _classCallCheck(this, OverviewMap); - - return _possibleConstructorReturn(this, (OverviewMap.__proto__ || Object.getPrototypeOf(OverviewMap)).apply(this, arguments)); - } - - _createClass(OverviewMap, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$anchor = _props.anchor, - anchor = _props$anchor === undefined ? _ControlAnchor2.default.BOTTOM_RIGHT : _props$anchor, - _props$offset = _props.offset, - offset = _props$offset === undefined ? { - width: 0, - height: 0 - } : _props$offset, - _props$size = _props.size, - size = _props$size === undefined ? { - width: 150, - height: 150 - } : _props$size, - _props$isOpen = _props.isOpen, - isOpen = _props$isOpen === undefined ? false : _props$isOpen, - events = _props.events; - - - var opts = { - anchor: global[anchor], - offset: (0, _util.getSize)(offset.width, offset.height), - size: (0, _util.getSize)(size.width, size.height), - isOpen: isOpen - }; - - this.instance = new global.BMap.OverviewMapControl(opts); - (0, _util.bindEvents)(this.instance, 'OVERVIEW_MAP', events); - this.map.addControl(this.instance); - } - }]); - - return OverviewMap; -}(_BaseControl3.default)) || _class; - -exports.default = OverviewMap; \ No newline at end of file diff --git a/lib/components/Control/Panorama.js b/lib/components/Control/Panorama.js deleted file mode 100644 index 6eb4d09..0000000 --- a/lib/components/Control/Panorama.js +++ /dev/null @@ -1,68 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseControl2 = require('./BaseControl'); - -var _BaseControl3 = _interopRequireDefault(_BaseControl2); - -var _util = require('../_base/util'); - -var _ControlAnchor = require('../../constants/ControlAnchor'); - -var _ControlAnchor2 = _interopRequireDefault(_ControlAnchor); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Panorama = (0, _ReactComponent2.default)(_class = function (_BaseControl) { - _inherits(Panorama, _BaseControl); - - function Panorama() { - _classCallCheck(this, Panorama); - - return _possibleConstructorReturn(this, (Panorama.__proto__ || Object.getPrototypeOf(Panorama)).apply(this, arguments)); - } - - _createClass(Panorama, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$anchor = _props.anchor, - anchor = _props$anchor === undefined ? _ControlAnchor2.default.TOP_RIGHT : _props$anchor, - _props$offset = _props.offset, - offset = _props$offset === undefined ? { - width: 0, - height: 0 - } : _props$offset; - - - var opts = { - anchor: global[anchor], - offset: (0, _util.getSize)(offset.width, offset.height) - }; - - this.instance = new global.BMap.PanoramaControl(opts); - this.map.addControl(this.instance); - } - }]); - - return Panorama; -}(_BaseControl3.default)) || _class; - -exports.default = Panorama; \ No newline at end of file diff --git a/lib/components/Control/Scale.js b/lib/components/Control/Scale.js deleted file mode 100644 index 64389f1..0000000 --- a/lib/components/Control/Scale.js +++ /dev/null @@ -1,75 +0,0 @@ -'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; }; }(); - -var _class; - -var _util = require('../_base/util'); - -var _ControlAnchor = require('../../constants/ControlAnchor'); - -var _ControlAnchor2 = _interopRequireDefault(_ControlAnchor); - -var _LengthUnit = require('../../constants/LengthUnit'); - -var _LengthUnit2 = _interopRequireDefault(_LengthUnit); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -var _BaseControl2 = require('./BaseControl'); - -var _BaseControl3 = _interopRequireDefault(_BaseControl2); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Scale = (0, _ReactComponent2.default)(_class = function (_BaseControl) { - _inherits(Scale, _BaseControl); - - function Scale() { - _classCallCheck(this, Scale); - - return _possibleConstructorReturn(this, (Scale.__proto__ || Object.getPrototypeOf(Scale)).apply(this, arguments)); - } - - _createClass(Scale, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$anchor = _props.anchor, - anchor = _props$anchor === undefined ? _ControlAnchor2.default.TOP_LEFT : _props$anchor, - _props$offset = _props.offset, - offset = _props$offset === undefined ? { - width: 81, - height: 18 - } : _props$offset, - _props$unit = _props.unit, - unit = _props$unit === undefined ? _LengthUnit2.default.METRIC : _props$unit; - - - var opts = { - anchor: global[anchor], - offset: (0, _util.getSize)(offset.width, offset.height) - }; - - this.instance = new global.BMap.ScaleControl(opts); - this.instance.setUnit(global[unit]); - this.map.addControl(this.instance); - } - }]); - - return Scale; -}(_BaseControl3.default)) || _class; - -exports.default = Scale; \ No newline at end of file diff --git a/lib/components/Control/index.js b/lib/components/Control/index.js deleted file mode 100644 index a8f0024..0000000 --- a/lib/components/Control/index.js +++ /dev/null @@ -1,84 +0,0 @@ -'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; }; }(); - -var _reactDom = require('react-dom'); - -var _util = require('../_base/util'); - -var _BaseControl2 = require('./BaseControl'); - -var _BaseControl3 = _interopRequireDefault(_BaseControl2); - -var _ControlAnchor = require('../../constants/ControlAnchor'); - -var _ControlAnchor2 = _interopRequireDefault(_ControlAnchor); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var BaseCtrl = function BaseCtrl(defaultAnchor, defaultOffset) { - this.defaultAnchor = defaultAnchor; - this.defaultOffset = defaultOffset; -}; - -var Control = function (_BaseControl) { - _inherits(Control, _BaseControl); - - function Control() { - _classCallCheck(this, Control); - - return _possibleConstructorReturn(this, (Control.__proto__ || Object.getPrototypeOf(Control)).apply(this, arguments)); - } - - _createClass(Control, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$anchor = _props.anchor, - anchor = _props$anchor === undefined ? _ControlAnchor2.default.TOP_LEFT : _props$anchor, - _props$offset = _props.offset, - offset = _props$offset === undefined ? { - width: 0, - height: 0 - } : _props$offset; - - - if (!BaseCtrl.prototype.initialize) { - BaseCtrl.prototype = new global.BMap.Control(); - BaseCtrl.prototype.initialize = this.initialize.bind(this); - } - - this.instance = new BaseCtrl(global[anchor], (0, _util.getSize)(offset.width, offset.height)); - this.map.addControl(this.instance); - } - }, { - key: 'initialize', - value: function initialize() { - // // 创建一个DOM元素 - var container = document.createElement('div'); - this.container = container; - - if (this.render) { - (0, _reactDom.render)(this.render(), container); - } - // 添加DOM元素到地图中 - this.map.getContainer().appendChild(container); - // 将DOM元素返回 - return container; - } - }]); - - return Control; -}(_BaseControl3.default); - -exports.default = Control; \ No newline at end of file diff --git a/lib/components/Layers/Tile.js b/lib/components/Layers/Tile.js deleted file mode 100644 index 64a8397..0000000 --- a/lib/components/Layers/Tile.js +++ /dev/null @@ -1,97 +0,0 @@ -'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; }; }(); - -var _class; - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -var _util = require('../_base/util'); - -var _ControlAnchor = require('../../constants/ControlAnchor'); - -var _ControlAnchor2 = _interopRequireDefault(_ControlAnchor); - -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 Tile = (0, _ReactComponent2.default)(_class = function () { - function Tile(props) { - var _this = this; - - _classCallCheck(this, Tile); - - this.destroy = function () { - _this.map.removeTileLayer(_this.instance); - _this.instance = null; - if (_this.copyRight) { - _this.map.removeControl(_this.copyRight); - } - }; - - this.props = props; - this.map = global.bMapInstance; - this.init(); - } - - _createClass(Tile, [{ - key: 'init', - value: function init() { - var _props = this.props, - transparentPng = _props.transparentPng, - tileUrlTemplate = _props.tileUrlTemplate, - _props$copyright = _props.copyright, - copyright = _props$copyright === undefined ? { - anchor: global[_ControlAnchor2.default.BOTTOM_RIGHT], - offset: { width: 10, height: 10 } - } : _props$copyright, - zIndex = _props.zIndex, - getTilesUrl = _props.getTilesUrl; - - - if (Object.keys(copyright).length > 0) { - var opts = { - anchor: copyright.anchor, - offset: (0, _util.getSize)(copyright.offset) - }; - this.copyRight = new global.BMap.CopyrightControl(opts); - this.copyRight.addCopyright({ - id: 2, - content: copyright.content, - bounds: copyright.bounds ? (0, _util.getBounds)(copyright.bounds) : this.map.getBounds() - }); - this.map.addControl(this.copyRight); - } - - this.instance = new global.BMap.TileLayer({ - transparentPng: transparentPng, - tileUrlTemplate: tileUrlTemplate, - zIndex: zIndex - }); - - if (getTilesUrl) { - this.instance.getTilesUrl = getTilesUrl; - } - - this.map.addTileLayer(this.instance); - } - }, { - key: 'onPropsUpdate', - value: function onPropsUpdate(newProps) { - this.props = newProps; - this.destroy(); - this.init(); - } - }]); - - return Tile; -}()) || _class; - -exports.default = Tile; \ No newline at end of file diff --git a/lib/components/Lib/CurveLine.js b/lib/components/Lib/CurveLine.js deleted file mode 100644 index a4a2da0..0000000 --- a/lib/components/Lib/CurveLine.js +++ /dev/null @@ -1,103 +0,0 @@ -'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; }; }(); - -var _class; /* eslint-disable */ - -/* eslint-enable */ - - -var _bmaplib = require('bmaplib.curveline'); - -var _bmaplib2 = _interopRequireDefault(_bmaplib); - -var _BaseOverlay2 = require('../Overlay/BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -var _util = require('../_base/util'); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var CurveLine = (0, _ReactComponent2.default)(_class = function (_BaseOverlay) { - _inherits(CurveLine, _BaseOverlay); - - function CurveLine() { - _classCallCheck(this, CurveLine); - - return _possibleConstructorReturn(this, (CurveLine.__proto__ || Object.getPrototypeOf(CurveLine)).apply(this, arguments)); - } - - _createClass(CurveLine, [{ - key: 'init', - value: function init() { - var _props = this.props, - points = _props.points, - strokeColor = _props.strokeColor, - strokeWeight = _props.strokeWeight, - strokeOpacity = _props.strokeOpacity, - strokeStyle = _props.strokeStyle, - _props$massClear = _props.massClear, - massClear = _props$massClear === undefined ? true : _props$massClear, - _props$clicking = _props.clicking, - clicking = _props$clicking === undefined ? true : _props$clicking, - _props$editing = _props.editing, - editing = _props$editing === undefined ? false : _props$editing, - events = _props.events; - - - var opts = { - strokeColor: strokeColor, - strokeWeight: strokeWeight, - strokeOpacity: strokeOpacity, - strokeStyle: strokeStyle, - enableMassClear: massClear, - enableClicking: clicking - }; - - var pList = []; - - if (points) { - pList = points.map(function (item) { - return (0, _util.getPoint)(item.lng, item.lat); - }); - } - - this.instance = new _bmaplib2.default(pList, opts); - this.map.addOverlay(this.instance); - - if (editing) { - this.instance.enableEditing(); - } else { - this.instance.disableEditing(); - } - - (0, _util.bindEvents)(this.instance, 'POLYLINE', events); - } - }, { - key: 'destroy', - value: function destroy() { - this.instance.disableEditing(); - this.map.removeOverlay(this.instance); - this.instance = null; - } - }]); - - return CurveLine; -}(_BaseOverlay3.default)) || _class; - -exports.default = CurveLine; \ No newline at end of file diff --git a/lib/components/Lib/DistanceTool.js b/lib/components/Lib/DistanceTool.js deleted file mode 100644 index 574bbe4..0000000 --- a/lib/components/Lib/DistanceTool.js +++ /dev/null @@ -1,62 +0,0 @@ -'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; }; }(); - -var _class; - -var _util = require('../_base/util'); - -var _BaseOverlay2 = require('../Overlay/BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var DistanceTool = (0, _ReactComponent2.default)(_class = function (_BaseOverlay) { - _inherits(DistanceTool, _BaseOverlay); - - function DistanceTool() { - _classCallCheck(this, DistanceTool); - - return _possibleConstructorReturn(this, (DistanceTool.__proto__ || Object.getPrototypeOf(DistanceTool)).apply(this, arguments)); - } - - _createClass(DistanceTool, [{ - key: 'init', - value: function init() { - var _props = this.props, - events = _props.events, - opts = _objectWithoutProperties(_props, ['events']); - - var BDistanceTool = require('../../libs/DistanceTool.js'); - this.instance = new BDistanceTool(this.map, opts); - (0, _util.bindEvents)(this.instance, 'DISTANCE_TOOL', events); - } - }, { - key: 'destroy', - value: function destroy() { - this.instance.close(); - this.instance = null; - } - }]); - - return DistanceTool; -}(_BaseOverlay3.default)) || _class; - -exports.default = DistanceTool; \ No newline at end of file diff --git a/lib/components/Lib/DrawingManager.js b/lib/components/Lib/DrawingManager.js deleted file mode 100644 index 392b6fb..0000000 --- a/lib/components/Lib/DrawingManager.js +++ /dev/null @@ -1,107 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseOverlay2 = require('../Overlay/BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -var _util = require('../_base/util'); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -var _ControlAnchor = require('../../constants/ControlAnchor'); - -var _ControlAnchor2 = _interopRequireDefault(_ControlAnchor); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var DrawingManager = (0, _ReactComponent2.default)(_class = function (_BaseOverlay) { - _inherits(DrawingManager, _BaseOverlay); - - function DrawingManager(props) { - _classCallCheck(this, DrawingManager); - - (0, _util.appendCss)({ - url: 'http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css' - }); - return _possibleConstructorReturn(this, (DrawingManager.__proto__ || Object.getPrototypeOf(DrawingManager)).call(this, props)); - } - - _createClass(DrawingManager, [{ - key: 'init', - value: function init() { - var defaultStyle = { - strokeColor: 'red', // 边线颜色。 - fillColor: 'red', // 填充颜色。当参数为空时,圆形将没有填充效果。 - strokeWeight: 3, // 边线的宽度,以像素为单位。 - strokeOpacity: 0.8, // 边线透明度,取值范围0 - 1。 - fillOpacity: 0.6, // 填充的透明度,取值范围0 - 1。 - strokeStyle: 'solid' // 边线的样式,solid或dashed。 - }; - - var _props = this.props, - _props$anchor = _props.anchor, - anchor = _props$anchor === undefined ? _ControlAnchor2.default.TOP_RIGHT : _props$anchor, - _props$offset = _props.offset, - offset = _props$offset === undefined ? { - width: 10, - height: 10 - } : _props$offset, - _props$circleOptions = _props.circleOptions, - circleOptions = _props$circleOptions === undefined ? defaultStyle : _props$circleOptions, - _props$polylineOption = _props.polylineOptions, - polylineOptions = _props$polylineOption === undefined ? defaultStyle : _props$polylineOption, - _props$polygonOptions = _props.polygonOptions, - polygonOptions = _props$polygonOptions === undefined ? defaultStyle : _props$polygonOptions, - _props$rectangleOptio = _props.rectangleOptions, - rectangleOptions = _props$rectangleOptio === undefined ? defaultStyle : _props$rectangleOptio, - _props$markerOptions = _props.markerOptions, - markerOptions = _props$markerOptions === undefined ? defaultStyle : _props$markerOptions, - drawingModes = _props.drawingModes, - events = _props.events; - - - var BDrawingManager = require('../../libs/DrawingManager.js'); - this.instance = new BDrawingManager(this.map, { - enableDrawingTool: true, - drawingToolOptions: { - anchor: global[anchor], - offset: (0, _util.getSize)(offset.width, offset.height), - drawingModes: drawingModes - }, - circleOptions: circleOptions, - polylineOptions: polylineOptions, - polygonOptions: polygonOptions, - rectangleOptions: rectangleOptions, - markerOptions: markerOptions - }); - - (0, _util.bindEvents)(this.instance, 'DRAWING_MANAGER', events); - } - }, { - key: 'destroy', - value: function destroy() { - this.map.removeControl(this.instance._drawingTool); - this.instance = null; - } - }]); - - return DrawingManager; -}(_BaseOverlay3.default)) || _class; - -exports.default = DrawingManager; \ No newline at end of file diff --git a/lib/components/Lib/Heatmap.js b/lib/components/Lib/Heatmap.js deleted file mode 100644 index ba1c443..0000000 --- a/lib/components/Lib/Heatmap.js +++ /dev/null @@ -1,83 +0,0 @@ -'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; }; }(); - -var _class; /* eslint-disable */ - -/* eslint-enable */ - - -var _bmaplib = require('bmaplib.heatmap'); - -var _bmaplib2 = _interopRequireDefault(_bmaplib); - -var _BaseOverlay2 = require('../Overlay/BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -var _util = require('../_base/util'); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Heatmap = (0, _ReactComponent2.default)(_class = function (_BaseOverlay) { - _inherits(Heatmap, _BaseOverlay); - - function Heatmap() { - _classCallCheck(this, Heatmap); - - return _possibleConstructorReturn(this, (Heatmap.__proto__ || Object.getPrototypeOf(Heatmap)).apply(this, arguments)); - } - - _createClass(Heatmap, [{ - key: 'init', - value: function init() { - if (!(0, _util.isSupportCanvas)()) { - this.instance = null; - return; - } - - var _props = this.props, - points = _props.points, - opacity = _props.opacity, - max = _props.max, - radius = _props.radius, - gradient = _props.gradient; - - - var opts = { - opacity: opacity, - radius: radius, - gradient: gradient - }; - - this.instance = new _bmaplib2.default(opts); - this.map.addOverlay(this.instance); - - if (points) { - // 需要先addOverlay后再执行 - this.instance.setDataSet({ - data: points, - max: max - }); - } - } - }]); - - return Heatmap; -}(_BaseOverlay3.default)) || _class; - -exports.default = Heatmap; \ No newline at end of file diff --git a/lib/components/Lib/MarkerClusterer.js b/lib/components/Lib/MarkerClusterer.js deleted file mode 100644 index 83c741f..0000000 --- a/lib/components/Lib/MarkerClusterer.js +++ /dev/null @@ -1,89 +0,0 @@ -'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; }; }(); - -var _class; /* eslint-disable */ - -/* eslint-enable */ - - -var _bmaplib = require('bmaplib.markerclusterer'); - -var _bmaplib2 = _interopRequireDefault(_bmaplib); - -var _BaseOverlay2 = require('../Overlay/BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -var _util = require('../_base/util'); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var MarkerClusterer = (0, _ReactComponent2.default)(_class = function (_BaseOverlay) { - _inherits(MarkerClusterer, _BaseOverlay); - - function MarkerClusterer() { - _classCallCheck(this, MarkerClusterer); - - return _possibleConstructorReturn(this, (MarkerClusterer.__proto__ || Object.getPrototypeOf(MarkerClusterer)).apply(this, arguments)); - } - - _createClass(MarkerClusterer, [{ - key: 'init', - value: function init() { - var _props = this.props, - children = _props.children, - gridSize = _props.gridSize, - maxZoom = _props.maxZoom, - minClusterSize = _props.minClusterSize, - _props$styles = _props.styles, - styles = _props$styles === undefined ? [] : _props$styles, - _props$averageCenter = _props.averageCenter, - averageCenter = _props$averageCenter === undefined ? false : _props$averageCenter; - - var childrenMakers = children && !Array.isArray(children) ? [children] : children; - var markers = []; - childrenMakers.forEach(function (m) { - markers.push((0, _util.createMarker)(m.props)); - }); - - var opts = { - gridSize: gridSize, - maxZoom: maxZoom, - minClusterSize: minClusterSize, - styles: styles.map(function (item) { - item.size = (0, _util.getSize)(item.size.width, item.size.height); - return item; - }), - isAverageCenter: averageCenter, - markers: markers - }; - - this.instance = new _bmaplib2.default(this.map, opts); - } - }, { - key: 'destroy', - value: function destroy() { - this.instance.clearMarkers(); - this.instance = null; - } - }]); - - return MarkerClusterer; -}(_BaseOverlay3.default)) || _class; - -exports.default = MarkerClusterer; \ No newline at end of file diff --git a/lib/components/Lib/TrafficControl.js b/lib/components/Lib/TrafficControl.js deleted file mode 100644 index 75f6cd5..0000000 --- a/lib/components/Lib/TrafficControl.js +++ /dev/null @@ -1,65 +0,0 @@ -'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; }; }(); - -var _class; - -var _util = require('../_base/util'); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -var _ControlAnchor = require('../../constants/ControlAnchor'); - -var _ControlAnchor2 = _interopRequireDefault(_ControlAnchor); - -var _BaseControl2 = require('../Control/BaseControl'); - -var _BaseControl3 = _interopRequireDefault(_BaseControl2); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var TrafficControl = (0, _ReactComponent2.default)(_class = function (_BaseControl) { - _inherits(TrafficControl, _BaseControl); - - function TrafficControl(props) { - _classCallCheck(this, TrafficControl); - - (0, _util.appendCss)({ - url: 'http://api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.css' - }); - return _possibleConstructorReturn(this, (TrafficControl.__proto__ || Object.getPrototypeOf(TrafficControl)).call(this, props)); - } - - _createClass(TrafficControl, [{ - key: 'init', - value: function init() { - var _props$anchor = this.props.anchor, - anchor = _props$anchor === undefined ? _ControlAnchor2.default.BOTTOM_RIGHT : _props$anchor; - - - var BTrafficControl = require('../../libs/TrafficControl.js'); - this.instance = new BTrafficControl({ - showPanel: false - }); - - this.map.addControl(this.instance); - this.instance.setAnchor(global[anchor]); - } - }]); - - return TrafficControl; -}(_BaseControl3.default)) || _class; - -exports.default = TrafficControl; \ No newline at end of file diff --git a/lib/components/Map/index.js b/lib/components/Map/index.js deleted file mode 100644 index 5cfe07a..0000000 --- a/lib/components/Map/index.js +++ /dev/null @@ -1,273 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = undefined; - -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; }; }(); - -var _class, _temp, _initialiseProps; - -var _react = require('react'); - -var _react2 = _interopRequireDefault(_react); - -var _propTypes = require('prop-types'); - -var _propTypes2 = _interopRequireDefault(_propTypes); - -var _util = require('../_base/util'); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var fillStyle = { - width: '100%', - height: '100%' -}; - -var Map = (_temp = _class = function (_React$Component) { - _inherits(Map, _React$Component); - - function Map(props) { - _classCallCheck(this, Map); - - // React 16 - var _this = _possibleConstructorReturn(this, (Map.__proto__ || Object.getPrototypeOf(Map)).call(this, props)); - - _initialiseProps.call(_this); - - if (_react2.default.createRef) { - _this.mapContainerRef = _react2.default.createRef(); - } else { - _this.mapContainerRef = function (ref) { - _this.mapContainer = ref; - }; - } - return _this; - } - - _createClass(Map, [{ - key: 'componentDidMount', - value: function componentDidMount() { - var ak = this.props.ak; - - if (ak) { - this.getMapScript().then(this.init); - } else if (global.BMap) { - this.init(global.BMap); - } else { - console.warn('BMap is undefined'); - } - } - }, { - key: 'componentWillReceiveProps', - value: function componentWillReceiveProps(nextProps) { - var map = this.map; - - if (map) { - var props = this.processProps(nextProps); - this.processMapOptions(props); - this.processContextMenu(props.contextMenu); - (0, _util.unBindEvents)(map); - if (props.events) (0, _util.bindEvents)(map, 'MAP', props.events); - } - } - }, { - key: 'processProps', - value: function processProps(nextProps) { - var _props = this.props, - center = _props.center, - zoom = _props.zoom; - - var props = Object.assign({}, nextProps); - if (JSON.stringify(props.center) === JSON.stringify(center)) { - delete props.center; - } - - if (props.zoom === zoom) { - delete props.zoom; - } - return props; - } - }, { - key: 'render', - value: function render() { - var placeHolder = this.props.placeHolder; - - return _react2.default.createElement( - 'div', - { style: fillStyle }, - _react2.default.createElement( - 'div', - { ref: this.mapContainerRef, style: fillStyle }, - placeHolder - ), - this.renderChildren() - ); - } - }]); - - return Map; -}(_react2.default.Component), _class.defaultProps = { - placeHolder: '地图加载中...', - // 与官方文档保持一致 - dragging: true, - scrollWheelZoom: false, - doubleClickZoom: true, - keyboard: false, - inertialDragging: false, - continuousZoom: true, - pinchToZoom: true, - autoResize: true, - highResolution: true, - mapClick: true, - center: { lng: 116.404, lat: 39.915 }, - zoom: 15 -}, _class.propTypes = { - placeHolder: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]), - children: _propTypes2.default.any, - ak: _propTypes2.default.string, - minZoom: _propTypes2.default.number, - maxZoom: _propTypes2.default.number, - defaultCursor: _propTypes2.default.string, - draggingCursor: _propTypes2.default.string, - mapStyle: _propTypes2.default.object, - center: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]), - mapType: _propTypes2.default.string, - zoom: _propTypes2.default.number, - highResolution: _propTypes2.default.bool, - autoResize: _propTypes2.default.bool, - mapClick: _propTypes2.default.bool, - mapMounted: _propTypes2.default.func, - dragging: _propTypes2.default.bool, - scrollWheelZoom: _propTypes2.default.bool, - doubleClickZoom: _propTypes2.default.bool, - keyboard: _propTypes2.default.bool, - inertialDragging: _propTypes2.default.bool, - continuousZoom: _propTypes2.default.bool, - pinchToZoom: _propTypes2.default.bool, - events: _propTypes2.default.object, - contextMenu: _propTypes2.default.object -}, _initialiseProps = function _initialiseProps() { - var _this2 = this; - - this.init = function (BMap) { - var _props2 = _this2.props, - highResolution = _props2.highResolution, - autoResize = _props2.autoResize, - mapClick = _props2.mapClick, - mapMounted = _props2.mapMounted, - contextMenu = _props2.contextMenu, - events = _props2.events, - resetProps = _objectWithoutProperties(_props2, ['highResolution', 'autoResize', 'mapClick', 'mapMounted', 'contextMenu', 'events']); - - _this2.defaultCenter = (0, _util.getPoint)(116.404, 39.915); - _this2.mapContainer = _this2.mapContainer || _this2.mapContainerRef.current; - var map = new BMap.Map(_this2.mapContainer, { - enableHighResolution: highResolution, - enableAutoResize: autoResize, - enableMapClick: mapClick - }); - - _this2.map = map; - // 当初始化center为null或string时,保证地图正常渲染,用默认center处理centerAndZoom - if (!resetProps.center || typeof resetProps.center === 'string') { - map.centerAndZoom(_this2.defaultCenter, resetProps.zoom); - } - _this2.processContextMenu(contextMenu); - - global.bMapInstance = map; - _this2.processMapOptions(resetProps); - (0, _util.bindEvents)(map, 'MAP', events); - - // 地图配置完成后,强制刷新,渲染子组件 - _this2.forceUpdate(function () { - if (mapMounted) { - mapMounted(global.bMapInstance); - } - }); - }; - - this.processContextMenu = function (contextMenu) { - if (contextMenu) { - _this2.menu = (0, _util.createContextMenu)(contextMenu.items, contextMenu.events); - if (_this2.menu) { - _this2.map.removeContextMenu(_this2.menu); - } - _this2.map.addContextMenu(_this2.menu); - } - }; - - this.processMapOptions = function (props) { - var map = _this2.map; - - (0, _util.processSetOptions)(map, 'MAP_SET_OPTIONS', props); - (0, _util.processBooleanOptions)(map, 'MAP_BOOLEAN_OPTIONS', props); - - if (props.center) { - var center = props.center; - - if ((0, _util.isPoint)(center)) { - center = (0, _util.getPoint)(center.lng, center.lat); - } - if (props.zoom) { - map.centerAndZoom(center, props.zoom); - } else { - map.setCenter(center); - } - } - - if (props.mapType) { - map.setMapType(global[props.mapType]); - } - }; - - this.getMapScript = function () { - var ak = _this2.props.ak; - - global.BMap = global.BMap || {}; - if (Object.keys(global.BMap).length === 0) { - global.BMap._preloader = new Promise(function (resolve) { - var $script = document.createElement('script'); - global.document.body.appendChild($script); - global._initBaiduMap = function initBaiduMap() { - resolve(global.BMap); - global.document.body.removeChild($script); - global.BMap._preloader = null; - global._initBaiduMap = null; - }; - - $script.src = 'https://api.map.baidu.com/api?v=3.0&ak=' + ak + '&callback=_initBaiduMap'; - }); - - return global.BMap._preloader; - }if (!global.BMap._preloader) { - return Promise.resolve(global.BMap); - } - return global.BMap._preloader; - }; - - this.renderChildren = function () { - var children = _this2.props.children; - - if (!_this2.map || !children) { - return null; - } - return _react2.default.Children.map(children, function (child) { - if (child) { - return _react2.default.cloneElement(child); - } - return null; - }); - }; -}, _temp); -exports.default = Map; \ No newline at end of file diff --git a/lib/components/Overlay/BaseOverlay.js b/lib/components/Overlay/BaseOverlay.js deleted file mode 100644 index 300a532..0000000 --- a/lib/components/Overlay/BaseOverlay.js +++ /dev/null @@ -1,64 +0,0 @@ -'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; }; }(); - -var _reactDom = require('react-dom'); - -var _util = require('../_base/util'); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var BaseOverlay = function () { - function BaseOverlay(props) { - _classCallCheck(this, BaseOverlay); - - this.props = props; - this.state = {}; - this.map = global.bMapInstance; - - this.init(); - } - - _createClass(BaseOverlay, [{ - key: 'removeOverlay', - value: function removeOverlay() { - if (this.instance instanceof global.BMap.InfoWindow) { - this.map.closeInfoWindow(); - } else { - this.map.removeOverlay(this.instance); - } - } - }, { - key: 'onPropsUpdate', - value: function onPropsUpdate(newProps) { - this.props = newProps; - (0, _util.unBindEvents)(this.instance); - this.destroy(); - this.init(); - } - }, { - key: 'setState', - value: function setState(param) { - if (param !== null) { - this.state = Object.assign(this.state, param); - } - if (this.render) { - (0, _reactDom.render)(this.render(), this.container); - } - } - }, { - key: 'destroy', - value: function destroy() { - this.removeOverlay(); - this.instance = null; - } - }]); - - return BaseOverlay; -}(); - -exports.default = BaseOverlay; \ No newline at end of file diff --git a/lib/components/Overlay/Boundary.js b/lib/components/Overlay/Boundary.js deleted file mode 100644 index 37a63b8..0000000 --- a/lib/components/Overlay/Boundary.js +++ /dev/null @@ -1,104 +0,0 @@ -'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; }; }(); - -var _class; - -var _util = require('../_base/util'); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -var _BaseOverlay2 = require('./BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Boundary = (0, _ReactComponent2.default)(_class = function (_BaseOverlay) { - _inherits(Boundary, _BaseOverlay); - - function Boundary() { - _classCallCheck(this, Boundary); - - return _possibleConstructorReturn(this, (Boundary.__proto__ || Object.getPrototypeOf(Boundary)).apply(this, arguments)); - } - - _createClass(Boundary, [{ - key: 'init', - value: function init() { - var _this2 = this; - - var _props = this.props, - name = _props.name, - onError = _props.onError, - autoViewport = _props.autoViewport, - _props$massClear = _props.massClear, - massClear = _props$massClear === undefined ? true : _props$massClear, - _props$editing = _props.editing, - editing = _props$editing === undefined ? false : _props$editing, - polygonOpts = _objectWithoutProperties(_props, ['name', 'onError', 'autoViewport', 'massClear', 'editing']); - - this.getBoundary().then(function (points) { - polygonOpts.points = points; - _this2.instance = (0, _util.createPolygon)(polygonOpts); - _this2.map.addOverlay(_this2.instance); - (0, _util.processBooleanOptions)(_this2.instance, 'POLY_BOOLEAN_OPTIONS', { - massClear: massClear, - editing: editing - }); - if (autoViewport) { - points = points.map(function (item) { - return (0, _util.getPoint)(item.lng, item.lat); - }); - _this2.map.setViewport(points); - } - }).catch(function (msg) { - if (onError) { - onError(msg); - } - }); - } - }, { - key: 'getBoundary', - value: function getBoundary() { - var name = this.props.name; - - return new Promise(function (resolve, reject) { - var boundary = new global.BMap.Boundary(); - - boundary.get(name, function (res) { - var count = res.boundaries.length; - if (count === 0) { - reject(); - } - var points = res.boundaries[0].split(';').map(function (item) { - var pointArr = item.split(','); - return { - lng: pointArr[0], - lat: pointArr[1] - }; - }); - resolve(points); - }); - }); - } - }]); - - return Boundary; -}(_BaseOverlay3.default)) || _class; - -exports.default = Boundary; \ No newline at end of file diff --git a/lib/components/Overlay/Circle.js b/lib/components/Overlay/Circle.js deleted file mode 100644 index 7f5a15e..0000000 --- a/lib/components/Overlay/Circle.js +++ /dev/null @@ -1,84 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseOverlay2 = require('./BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -var _util = require('../_base/util'); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Circle = (0, _ReactComponent2.default)(_class = function (_BaseOverlay) { - _inherits(Circle, _BaseOverlay); - - function Circle() { - _classCallCheck(this, Circle); - - return _possibleConstructorReturn(this, (Circle.__proto__ || Object.getPrototypeOf(Circle)).apply(this, arguments)); - } - - _createClass(Circle, [{ - key: 'init', - value: function init() { - var _props = this.props, - point = _props.point, - radius = _props.radius, - strokeColor = _props.strokeColor, - fillColor = _props.fillColor, - strokeWeight = _props.strokeWeight, - strokeOpacity = _props.strokeOpacity, - fillOpacity = _props.fillOpacity, - strokeStyle = _props.strokeStyle, - _props$massClear = _props.massClear, - massClear = _props$massClear === undefined ? true : _props$massClear, - _props$editing = _props.editing, - editing = _props$editing === undefined ? false : _props$editing, - _props$clicking = _props.clicking, - clicking = _props$clicking === undefined ? true : _props$clicking, - events = _props.events; - - - var opts = { - strokeColor: strokeColor, - fillColor: fillColor, - strokeWeight: strokeWeight, - strokeOpacity: strokeOpacity, - fillOpacity: fillOpacity, - strokeStyle: strokeStyle, - enableClicking: clicking - }; - - this.instance = new global.BMap.Circle((0, _util.getPoint)(point.lng, point.lat), radius, opts); - this.map.addOverlay(this.instance); - - var booleanOpts = { - editing: editing, - massClear: massClear - }; - (0, _util.processBooleanOptions)(this.instance, 'CIRCLE_BOOLEAN_OPTIONS', booleanOpts); - (0, _util.bindEvents)(this.instance, 'CIRCLE', events); - } - }]); - - return Circle; -}(_BaseOverlay3.default)) || _class; - -exports.default = Circle; \ No newline at end of file diff --git a/lib/components/Overlay/Ground.js b/lib/components/Overlay/Ground.js deleted file mode 100644 index 65b2005..0000000 --- a/lib/components/Overlay/Ground.js +++ /dev/null @@ -1,67 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseOverlay2 = require('./BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -var _util = require('../_base/util'); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Ground = (0, _ReactComponent2.default)(_class = function (_BaseOverlay) { - _inherits(Ground, _BaseOverlay); - - function Ground() { - _classCallCheck(this, Ground); - - return _possibleConstructorReturn(this, (Ground.__proto__ || Object.getPrototypeOf(Ground)).apply(this, arguments)); - } - - _createClass(Ground, [{ - key: 'init', - value: function init() { - var _props = this.props, - bounds = _props.bounds, - opacity = _props.opacity, - imageURL = _props.imageURL, - minZoom = _props.minZoom, - maxZoom = _props.maxZoom, - events = _props.events; - - - var opts = { - opacity: opacity, - displayOnMinLevel: minZoom, - displayOnMaxLevel: maxZoom - }; - - this.instance = new global.BMap.GroundOverlay((0, _util.getBounds)(bounds), opts); - this.map.addOverlay(this.instance); - - this.instance.setImageURL(imageURL); - (0, _util.bindEvents)(this.instance, 'GROUND', events); - } - }]); - - return Ground; -}(_BaseOverlay3.default)) || _class; - -exports.default = Ground; \ No newline at end of file diff --git a/lib/components/Overlay/InfoWindow.js b/lib/components/Overlay/InfoWindow.js deleted file mode 100644 index 5e1d8ed..0000000 --- a/lib/components/Overlay/InfoWindow.js +++ /dev/null @@ -1,80 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseOverlay2 = require('./BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -var _util = require('../_base/util'); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var InfoWindow = (0, _ReactComponent2.default)(_class = function (_BaseOverlay) { - _inherits(InfoWindow, _BaseOverlay); - - function InfoWindow() { - _classCallCheck(this, InfoWindow); - - return _possibleConstructorReturn(this, (InfoWindow.__proto__ || Object.getPrototypeOf(InfoWindow)).apply(this, arguments)); - } - - _createClass(InfoWindow, [{ - key: 'init', - value: function init() { - var _props = this.props, - point = _props.point, - content = _props.content, - height = _props.height, - width = _props.width, - maxWidth = _props.maxWidth, - offset = _props.offset, - title = _props.title, - _props$autoPan = _props.autoPan, - autoPan = _props$autoPan === undefined ? true : _props$autoPan, - _props$closeOnClick = _props.closeOnClick, - closeOnClick = _props$closeOnClick === undefined ? true : _props$closeOnClick, - _props$displayMessage = _props.displayMessage, - displayMessage = _props$displayMessage === undefined ? true : _props$displayMessage, - message = _props.message, - events = _props.events; - - - var opts = { - width: width, - height: height, - maxWidth: maxWidth, - offset: offset && (0, _util.getSize)(offset.width, offset.height), - title: title, - enableAutoPan: autoPan, - enableCloseOnClick: closeOnClick, - enableMessage: displayMessage, - message: message - }; - - this.instance = new global.BMap.InfoWindow(content, opts); - this.map.openInfoWindow(this.instance, (0, _util.getPoint)(point.lng, point.lat)); - (0, _util.bindEvents)(this.instance, 'INFO_WINDOW', events); - } - }]); - - return InfoWindow; -}(_BaseOverlay3.default)) || _class; - -exports.default = InfoWindow; \ No newline at end of file diff --git a/lib/components/Overlay/Label.js b/lib/components/Overlay/Label.js deleted file mode 100644 index 2e5e25a..0000000 --- a/lib/components/Overlay/Label.js +++ /dev/null @@ -1,49 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseOverlay2 = require('./BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -var _util = require('../_base/util'); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Label = (0, _ReactComponent2.default)(_class = function (_BaseOverlay) { - _inherits(Label, _BaseOverlay); - - function Label() { - _classCallCheck(this, Label); - - return _possibleConstructorReturn(this, (Label.__proto__ || Object.getPrototypeOf(Label)).apply(this, arguments)); - } - - _createClass(Label, [{ - key: 'init', - value: function init() { - this.instance = (0, _util.createLabel)(this.props); - this.map.addOverlay(this.instance); - } - }]); - - return Label; -}(_BaseOverlay3.default)) || _class; - -exports.default = Label; \ No newline at end of file diff --git a/lib/components/Overlay/Marker.js b/lib/components/Overlay/Marker.js deleted file mode 100644 index 474531a..0000000 --- a/lib/components/Overlay/Marker.js +++ /dev/null @@ -1,57 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseOverlay2 = require('./BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -var _util = require('../_base/util'); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Marker = (0, _ReactComponent2.default)(_class = function (_BaseOverlay) { - _inherits(Marker, _BaseOverlay); - - function Marker() { - _classCallCheck(this, Marker); - - return _possibleConstructorReturn(this, (Marker.__proto__ || Object.getPrototypeOf(Marker)).apply(this, arguments)); - } - - _createClass(Marker, [{ - key: 'init', - value: function init() { - var animation = this.props.animation; - - this.instance = (0, _util.createMarker)(this.props); - - this.map.addOverlay(this.instance); - - // animation 需要在addOverlay之后添加,所以这里将setAnimation放置下个队列 - if (animation) { - this.instance.setAnimation(global[animation]); - } - } - }]); - - return Marker; -}(_BaseOverlay3.default)) || _class; - -exports.default = Marker; \ No newline at end of file diff --git a/lib/components/Overlay/PointCollection.js b/lib/components/Overlay/PointCollection.js deleted file mode 100644 index f37f9c1..0000000 --- a/lib/components/Overlay/PointCollection.js +++ /dev/null @@ -1,77 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseOverlay2 = require('./BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -var _util = require('../_base/util'); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var PointCollection = (0, _ReactComponent2.default)(_class = function (_BaseOverlay) { - _inherits(PointCollection, _BaseOverlay); - - function PointCollection() { - _classCallCheck(this, PointCollection); - - return _possibleConstructorReturn(this, (PointCollection.__proto__ || Object.getPrototypeOf(PointCollection)).apply(this, arguments)); - } - - _createClass(PointCollection, [{ - key: 'init', - value: function init() { - this.instance = null; - - // 判断浏览器支持海量点 - if ((0, _util.isSupportContext)()) { - var _props = this.props, - points = _props.points, - shape = _props.shape, - color = _props.color, - size = _props.size, - events = _props.events; - - - var opts = { - shape: shape && global[shape], - color: color, - size: size && global[size] - }; - - var pList = []; - if (points && Array.isArray(points)) { - pList = points.map(function (item) { - return (0, _util.getPoint)(item.lng, item.lat); - }); - } - - this.instance = new global.BMap.PointCollection(pList, opts); - this.map.addOverlay(this.instance); - - (0, _util.bindEvents)(this.instance, 'POINT_COLLECTION', events); - } - } - }]); - - return PointCollection; -}(_BaseOverlay3.default)) || _class; - -exports.default = PointCollection; \ No newline at end of file diff --git a/lib/components/Overlay/Polygon.js b/lib/components/Overlay/Polygon.js deleted file mode 100644 index 5c43182..0000000 --- a/lib/components/Overlay/Polygon.js +++ /dev/null @@ -1,59 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseOverlay2 = require('./BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -var _util = require('../_base/util'); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Polygon = (0, _ReactComponent2.default)(_class = function (_BaseOverlay) { - _inherits(Polygon, _BaseOverlay); - - function Polygon() { - _classCallCheck(this, Polygon); - - return _possibleConstructorReturn(this, (Polygon.__proto__ || Object.getPrototypeOf(Polygon)).apply(this, arguments)); - } - - _createClass(Polygon, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$massClear = _props.massClear, - massClear = _props$massClear === undefined ? true : _props$massClear, - _props$editing = _props.editing, - editing = _props$editing === undefined ? false : _props$editing; - - this.instance = (0, _util.createPolygon)(this.props); - this.map.addOverlay(this.instance); - (0, _util.processBooleanOptions)(this.instance, 'POLY_BOOLEAN_OPTIONS', { - massClear: massClear, - editing: editing - }); - } - }]); - - return Polygon; -}(_BaseOverlay3.default)) || _class; - -exports.default = Polygon; \ No newline at end of file diff --git a/lib/components/Overlay/Polyline.js b/lib/components/Overlay/Polyline.js deleted file mode 100644 index 7fa0bfd..0000000 --- a/lib/components/Overlay/Polyline.js +++ /dev/null @@ -1,89 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseOverlay2 = require('./BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -var _util = require('../_base/util'); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var Polyline = (0, _ReactComponent2.default)(_class = function (_BaseOverlay) { - _inherits(Polyline, _BaseOverlay); - - function Polyline() { - _classCallCheck(this, Polyline); - - return _possibleConstructorReturn(this, (Polyline.__proto__ || Object.getPrototypeOf(Polyline)).apply(this, arguments)); - } - - _createClass(Polyline, [{ - key: 'init', - value: function init() { - var _props = this.props, - points = _props.points, - strokeColor = _props.strokeColor, - strokeWeight = _props.strokeWeight, - strokeOpacity = _props.strokeOpacity, - strokeStyle = _props.strokeStyle, - _props$massClear = _props.massClear, - massClear = _props$massClear === undefined ? true : _props$massClear, - _props$editing = _props.editing, - editing = _props$editing === undefined ? false : _props$editing, - _props$clicking = _props.clicking, - clicking = _props$clicking === undefined ? true : _props$clicking, - events = _props.events, - _props$icons = _props.icons, - icons = _props$icons === undefined ? [] : _props$icons; - - - var opts = { - strokeColor: strokeColor, - strokeWeight: strokeWeight, - strokeOpacity: strokeOpacity, - strokeStyle: strokeStyle, - enableClicking: clicking, - icons: icons - }; - - var pList = []; - if (points) { - pList = points.map(function (item) { - return (0, _util.getPoint)(item.lng, item.lat); - }); - } - - this.instance = new global.BMap.Polyline(pList, opts); - this.map.addOverlay(this.instance); - - var booleanOpts = { - massClear: massClear, - editing: editing - }; - (0, _util.processBooleanOptions)(this.instance, 'POLYLINE_BOOLEAN_OPTIONS', booleanOpts); - (0, _util.bindEvents)(this.instance, 'POLYLINE', events); - } - }]); - - return Polyline; -}(_BaseOverlay3.default)) || _class; - -exports.default = Polyline; \ No newline at end of file diff --git a/lib/components/Overlay/Symbol.js b/lib/components/Overlay/Symbol.js deleted file mode 100644 index 42828a0..0000000 --- a/lib/components/Overlay/Symbol.js +++ /dev/null @@ -1,85 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseOverlay2 = require('./BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -var _util = require('../_base/util'); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var _Symbol = (0, _ReactComponent2.default)(_class = function (_BaseOverlay) { - _inherits(_Symbol, _BaseOverlay); - - function _Symbol() { - _classCallCheck(this, _Symbol); - - return _possibleConstructorReturn(this, (_Symbol.__proto__ || Object.getPrototypeOf(_Symbol)).apply(this, arguments)); - } - - _createClass(_Symbol, [{ - key: 'init', - value: function init() { - var _props = this.props, - path = _props.path, - _props$anchor = _props.anchor, - anchor = _props$anchor === undefined ? { - width: 0, - height: 0 - } : _props$anchor, - fillColor = _props.fillColor, - fillOpacity = _props.fillOpacity, - scale = _props.scale, - rotation = _props.rotation, - strokeColor = _props.strokeColor, - strokeOpacity = _props.strokeOpacity, - strokeWeight = _props.strokeWeight, - markerProps = _objectWithoutProperties(_props, ['path', 'anchor', 'fillColor', 'fillOpacity', 'scale', 'rotation', 'strokeColor', 'strokeOpacity', 'strokeWeight']); - - markerProps.icon = (0, _util.createSymbol)({ - path: path, - opts: { - anchor: (0, _util.getSize)(anchor.width, anchor.height), - fillColor: fillColor, - fillOpacity: fillOpacity, - scale: scale, - rotation: rotation, - strokeColor: strokeColor, - strokeOpacity: strokeOpacity, - strokeWeight: strokeWeight - } - }); - - this.instance = (0, _util.createMarker)(markerProps); - this.map.addOverlay(this.instance); - - if (markerProps.animation) { - this.instance.setAnimation(global[markerProps.animation]); - } - } - }]); - - return _Symbol; -}(_BaseOverlay3.default)) || _class; - -exports.default = _Symbol; \ No newline at end of file diff --git a/lib/components/Overlay/index.js b/lib/components/Overlay/index.js deleted file mode 100644 index 08c264d..0000000 --- a/lib/components/Overlay/index.js +++ /dev/null @@ -1,89 +0,0 @@ -'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; }; }(); - -var _reactDom = require('react-dom'); - -var _BaseOverlay2 = require('./BaseOverlay'); - -var _BaseOverlay3 = _interopRequireDefault(_BaseOverlay2); - -var _util = require('../_base/util'); - -var _MapPane = require('../../constants/MapPane'); - -var _MapPane2 = _interopRequireDefault(_MapPane); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var BOverlay = function Empty() {}; - -var Overlay = function (_BaseOverlay) { - _inherits(Overlay, _BaseOverlay); - - function Overlay() { - _classCallCheck(this, Overlay); - - return _possibleConstructorReturn(this, (Overlay.__proto__ || Object.getPrototypeOf(Overlay)).apply(this, arguments)); - } - - _createClass(Overlay, [{ - key: 'init', - value: function init() { - if (!BOverlay.prototype.initialize) { - BOverlay.prototype = new global.BMap.Overlay(); - BOverlay.prototype.initialize = this.initialize.bind(this); - BOverlay.prototype.draw = this.draw.bind(this); - } - - this.instance = new BOverlay(); - this.map.addOverlay(this.instance); - } - }, { - key: 'initialize', - value: function initialize() { - var _props = this.props, - _props$pane = _props.pane, - pane = _props$pane === undefined ? _MapPane2.default.MARKER : _props$pane, - zIndex = _props.zIndex; - - var container = document.createElement('div'); - this.container = container; - - if (zIndex) { - container.style.zIndex = zIndex; - } - container.style.position = 'absolute'; - if (this.render) { - (0, _reactDom.render)(this.render(), container); - } - this.map.getPanes()[pane].appendChild(container); - return container; - } - }, { - key: 'draw', - value: function draw() { - var container = this.container, - props = this.props; - var point = props.point; - - var position = this.map.pointToOverlayPixel((0, _util.getPoint)(point.lng, point.lat)); - container.style.left = position.x - container.offsetWidth / 2 + 'px'; - container.style.top = position.y - container.offsetHeight / 2 + 'px'; - } - }]); - - return Overlay; -}(_BaseOverlay3.default); - -exports.default = Overlay; \ No newline at end of file diff --git a/lib/components/ReactComponent/index.js b/lib/components/ReactComponent/index.js deleted file mode 100644 index 4c57f19..0000000 --- a/lib/components/ReactComponent/index.js +++ /dev/null @@ -1,65 +0,0 @@ -'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; }; }(); - -exports.default = ReactComponent; - -var _react = require('react'); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -function ReactComponent(Wrapped) { - return function (_PureComponent) { - _inherits(Proxy, _PureComponent); - - function Proxy(props) { - _classCallCheck(this, Proxy); - - var _this = _possibleConstructorReturn(this, (Proxy.__proto__ || Object.getPrototypeOf(Proxy)).call(this, props)); - - _this.getInstance = function () { - var getInstance = _this.props.getInstance; - - if (getInstance) { - getInstance(_this.wrapped.instance); - } - }; - - _this.map = global.bMapInstance; - _this.wrapped = new Wrapped(props); - // 获得实例 - _this.getInstance(); - return _this; - } - - _createClass(Proxy, [{ - key: 'componentDidUpdate', - value: function componentDidUpdate() { - if (this.wrapped.onPropsUpdate) { - this.wrapped.onPropsUpdate(this.props); - this.getInstance(); - } - } - }, { - key: 'componentWillUnmount', - value: function componentWillUnmount() { - this.wrapped.destroy(); - } - }, { - key: 'render', - value: function render() { - return null; - } - }]); - - return Proxy; - }(_react.PureComponent); -} \ No newline at end of file diff --git a/lib/components/Service/BaseService.js b/lib/components/Service/BaseService.js deleted file mode 100644 index 9ed41a7..0000000 --- a/lib/components/Service/BaseService.js +++ /dev/null @@ -1,38 +0,0 @@ -"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"); } } - -var BaseService = function () { - function BaseService(props) { - var _this = this; - - _classCallCheck(this, BaseService); - - this.destroy = function () { - _this.instance = null; - }; - - this.props = props; - this.map = global.bMapInstance; - this.init(); - } - - _createClass(BaseService, [{ - key: "onPropsUpdate", - value: function onPropsUpdate(newProps) { - this.props = newProps; - this.destroy(); - this.init(); - } - }]); - - return BaseService; -}(); - -exports.default = BaseService; \ No newline at end of file diff --git a/lib/components/Service/BusLineSearch.js b/lib/components/Service/BusLineSearch.js deleted file mode 100644 index c4853e5..0000000 --- a/lib/components/Service/BusLineSearch.js +++ /dev/null @@ -1,81 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseService2 = require('./BaseService'); - -var _BaseService3 = _interopRequireDefault(_BaseService2); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -var _util = require('../_base/util'); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var BusLineSearch = (0, _ReactComponent2.default)(_class = function (_BaseService) { - _inherits(BusLineSearch, _BaseService); - - function BusLineSearch() { - _classCallCheck(this, BusLineSearch); - - return _possibleConstructorReturn(this, (BusLineSearch.__proto__ || Object.getPrototypeOf(BusLineSearch)).apply(this, arguments)); - } - - _createClass(BusLineSearch, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$location = _props.location, - location = _props$location === undefined ? this.map : _props$location, - onGetBusListComplete = _props.onGetBusListComplete, - onGetBusLineComplete = _props.onGetBusLineComplete, - onBusListHtmlSet = _props.onBusListHtmlSet, - onBusLineHtmlSet = _props.onBusLineHtmlSet, - onPolylinesSet = _props.onPolylinesSet, - onMarkersSet = _props.onMarkersSet, - _props$renderOptions = _props.renderOptions, - renderOptions = _props$renderOptions === undefined ? {} : _props$renderOptions, - _props$showInMap = _props.showInMap, - showInMap = _props$showInMap === undefined ? false : _props$showInMap; - - - var _location = location; - if ((0, _util.isPoint)(location)) { - _location = (0, _util.getPoint)(_location.lng, _location.lat); - } - - this.instance = new global.BMap.BusLineSearch(_location, { - onGetBusListComplete: onGetBusListComplete, - onGetBusLineComplete: onGetBusLineComplete, - onBusListHtmlSet: onBusListHtmlSet, - onBusLineHtmlSet: onBusLineHtmlSet, - onPolylinesSet: onPolylinesSet, - onMarkersSet: onMarkersSet, - renderOptions: { - map: showInMap ? this.map : null, - panel: renderOptions.panel, - selectFirstResult: renderOptions.selectFirstResult, - autoViewport: renderOptions.autoViewport - } - }); - } - }]); - - return BusLineSearch; -}(_BaseService3.default)) || _class; - -exports.default = BusLineSearch; \ No newline at end of file diff --git a/lib/components/Service/DrivingRoute.js b/lib/components/Service/DrivingRoute.js deleted file mode 100644 index 9cc10ae..0000000 --- a/lib/components/Service/DrivingRoute.js +++ /dev/null @@ -1,79 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseService2 = require('./BaseService'); - -var _BaseService3 = _interopRequireDefault(_BaseService2); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -var _util = require('../_base/util'); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var DrivingRoute = (0, _ReactComponent2.default)(_class = function (_BaseService) { - _inherits(DrivingRoute, _BaseService); - - function DrivingRoute() { - _classCallCheck(this, DrivingRoute); - - return _possibleConstructorReturn(this, (DrivingRoute.__proto__ || Object.getPrototypeOf(DrivingRoute)).apply(this, arguments)); - } - - _createClass(DrivingRoute, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$location = _props.location, - location = _props$location === undefined ? this.map : _props$location, - policy = _props.policy, - onSearchComplete = _props.onSearchComplete, - onMarkersSet = _props.onMarkersSet, - onInfoHtmlSet = _props.onInfoHtmlSet, - onPolylinesSet = _props.onPolylinesSet, - _props$renderOptions = _props.renderOptions, - renderOptions = _props$renderOptions === undefined ? {} : _props$renderOptions, - _props$showInMap = _props.showInMap, - showInMap = _props$showInMap === undefined ? false : _props$showInMap; - - - var _location = location; - if ((0, _util.isPoint)(location)) { - _location = (0, _util.getPoint)(_location.lng, _location.lat); - } - - this.instance = new global.BMap.DrivingRoute(_location, { - policy: policy && global[policy], - onSearchComplete: onSearchComplete, - onMarkersSet: onMarkersSet, - onInfoHtmlSet: onInfoHtmlSet, - onPolylinesSet: onPolylinesSet, - renderOptions: { - map: showInMap ? this.map : null, - panel: renderOptions.panel, - selectFirstResult: renderOptions.selectFirstResult, - autoViewport: renderOptions.autoViewport - } - }); - } - }]); - - return DrivingRoute; -}(_BaseService3.default)) || _class; - -exports.default = DrivingRoute; \ No newline at end of file diff --git a/lib/components/Service/LocalSearch.js b/lib/components/Service/LocalSearch.js deleted file mode 100644 index c558fc6..0000000 --- a/lib/components/Service/LocalSearch.js +++ /dev/null @@ -1,79 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseService2 = require('./BaseService'); - -var _BaseService3 = _interopRequireDefault(_BaseService2); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -var _util = require('../_base/util'); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var LocalSearch = (0, _ReactComponent2.default)(_class = function (_BaseService) { - _inherits(LocalSearch, _BaseService); - - function LocalSearch() { - _classCallCheck(this, LocalSearch); - - return _possibleConstructorReturn(this, (LocalSearch.__proto__ || Object.getPrototypeOf(LocalSearch)).apply(this, arguments)); - } - - _createClass(LocalSearch, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$location = _props.location, - location = _props$location === undefined ? this.map : _props$location, - onMarkersSet = _props.onMarkersSet, - onInfoHtmlSet = _props.onInfoHtmlSet, - onResultsHtmlSet = _props.onResultsHtmlSet, - pageCapacity = _props.pageCapacity, - onSearchComplete = _props.onSearchComplete, - _props$renderOptions = _props.renderOptions, - renderOptions = _props$renderOptions === undefined ? {} : _props$renderOptions, - _props$showInMap = _props.showInMap, - showInMap = _props$showInMap === undefined ? false : _props$showInMap; - - - var _location = location; - if ((0, _util.isPoint)(location)) { - _location = (0, _util.getPoint)(_location.lng, _location.lat); - } - - this.instance = new global.BMap.LocalSearch(_location, { - onMarkersSet: onMarkersSet, - onInfoHtmlSet: onInfoHtmlSet, - onResultsHtmlSet: onResultsHtmlSet, - pageCapacity: pageCapacity, - onSearchComplete: onSearchComplete, - renderOptions: { - map: showInMap ? this.map : null, - panel: renderOptions.panel, - selectFirstResult: renderOptions.selectFirstResult, - autoViewport: renderOptions.autoViewport - } - }); - } - }]); - - return LocalSearch; -}(_BaseService3.default)) || _class; - -exports.default = LocalSearch; \ No newline at end of file diff --git a/lib/components/Service/RidingRoute.js b/lib/components/Service/RidingRoute.js deleted file mode 100644 index cdb2f8d..0000000 --- a/lib/components/Service/RidingRoute.js +++ /dev/null @@ -1,77 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseService2 = require('./BaseService'); - -var _BaseService3 = _interopRequireDefault(_BaseService2); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -var _util = require('../_base/util'); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var RidingRoute = (0, _ReactComponent2.default)(_class = function (_BaseService) { - _inherits(RidingRoute, _BaseService); - - function RidingRoute() { - _classCallCheck(this, RidingRoute); - - return _possibleConstructorReturn(this, (RidingRoute.__proto__ || Object.getPrototypeOf(RidingRoute)).apply(this, arguments)); - } - - _createClass(RidingRoute, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$location = _props.location, - location = _props$location === undefined ? this.map : _props$location, - onSearchComplete = _props.onSearchComplete, - onMarkersSet = _props.onMarkersSet, - onInfoHtmlSet = _props.onInfoHtmlSet, - onPolylinesSet = _props.onPolylinesSet, - _props$renderOptions = _props.renderOptions, - renderOptions = _props$renderOptions === undefined ? {} : _props$renderOptions, - _props$showInMap = _props.showInMap, - showInMap = _props$showInMap === undefined ? false : _props$showInMap; - - - var _location = location; - if ((0, _util.isPoint)(location)) { - _location = (0, _util.getPoint)(_location.lng, _location.lat); - } - - this.instance = new global.BMap.RidingRoute(_location, { - onSearchComplete: onSearchComplete, - onMarkersSet: onMarkersSet, - onInfoHtmlSet: onInfoHtmlSet, - onPolylinesSet: onPolylinesSet, - renderOptions: { - map: showInMap ? this.map : null, - panel: renderOptions.panel, - selectFirstResult: renderOptions.selectFirstResult, - autoViewport: renderOptions.autoViewport - } - }); - } - }]); - - return RidingRoute; -}(_BaseService3.default)) || _class; - -exports.default = RidingRoute; \ No newline at end of file diff --git a/lib/components/Service/TransitRoute.js b/lib/components/Service/TransitRoute.js deleted file mode 100644 index 71acf91..0000000 --- a/lib/components/Service/TransitRoute.js +++ /dev/null @@ -1,87 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseService2 = require('./BaseService'); - -var _BaseService3 = _interopRequireDefault(_BaseService2); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -var _util = require('../_base/util'); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var TransitRoute = (0, _ReactComponent2.default)(_class = function (_BaseService) { - _inherits(TransitRoute, _BaseService); - - function TransitRoute() { - _classCallCheck(this, TransitRoute); - - return _possibleConstructorReturn(this, (TransitRoute.__proto__ || Object.getPrototypeOf(TransitRoute)).apply(this, arguments)); - } - - _createClass(TransitRoute, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$location = _props.location, - location = _props$location === undefined ? this.map : _props$location, - policy = _props.policy, - intercityPolicy = _props.intercityPolicy, - transitTypePolicy = _props.transitTypePolicy, - pageCapacity = _props.pageCapacity, - onSearchComplete = _props.onSearchComplete, - onMarkersSet = _props.onMarkersSet, - onInfoHtmlSet = _props.onInfoHtmlSet, - onPolylinesSet = _props.onPolylinesSet, - onResultsHtmlSet = _props.onResultsHtmlSet, - _props$renderOptions = _props.renderOptions, - renderOptions = _props$renderOptions === undefined ? {} : _props$renderOptions, - _props$showInMap = _props.showInMap, - showInMap = _props$showInMap === undefined ? false : _props$showInMap; - - - var _location = location; - if ((0, _util.isPoint)(location)) { - _location = (0, _util.getPoint)(_location.lng, _location.lat); - } - - this.instance = new global.BMap.TransitRoute(_location, { - policy: policy && global[policy], - intercityPolicy: intercityPolicy && global[intercityPolicy], - transitTypePolicy: transitTypePolicy && global[transitTypePolicy], - pageCapacity: pageCapacity, - onSearchComplete: onSearchComplete, - onMarkersSet: onMarkersSet, - onInfoHtmlSet: onInfoHtmlSet, - onPolylinesSet: onPolylinesSet, - onResultsHtmlSet: onResultsHtmlSet, - renderOptions: { - map: showInMap ? this.map : null, - panel: renderOptions.panel, - selectFirstResult: renderOptions.selectFirstResult, - autoViewport: renderOptions.autoViewport - } - }); - } - }]); - - return TransitRoute; -}(_BaseService3.default)) || _class; - -exports.default = TransitRoute; \ No newline at end of file diff --git a/lib/components/Service/WalkingRoute.js b/lib/components/Service/WalkingRoute.js deleted file mode 100644 index c27f325..0000000 --- a/lib/components/Service/WalkingRoute.js +++ /dev/null @@ -1,77 +0,0 @@ -'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; }; }(); - -var _class; - -var _BaseService2 = require('./BaseService'); - -var _BaseService3 = _interopRequireDefault(_BaseService2); - -var _ReactComponent = require('../ReactComponent'); - -var _ReactComponent2 = _interopRequireDefault(_ReactComponent); - -var _util = require('../_base/util'); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - -var WalkingRoute = (0, _ReactComponent2.default)(_class = function (_BaseService) { - _inherits(WalkingRoute, _BaseService); - - function WalkingRoute() { - _classCallCheck(this, WalkingRoute); - - return _possibleConstructorReturn(this, (WalkingRoute.__proto__ || Object.getPrototypeOf(WalkingRoute)).apply(this, arguments)); - } - - _createClass(WalkingRoute, [{ - key: 'init', - value: function init() { - var _props = this.props, - _props$location = _props.location, - location = _props$location === undefined ? this.map : _props$location, - onSearchComplete = _props.onSearchComplete, - onMarkersSet = _props.onMarkersSet, - onInfoHtmlSet = _props.onInfoHtmlSet, - onPolylinesSet = _props.onPolylinesSet, - _props$renderOptions = _props.renderOptions, - renderOptions = _props$renderOptions === undefined ? {} : _props$renderOptions, - _props$showInMap = _props.showInMap, - showInMap = _props$showInMap === undefined ? false : _props$showInMap; - - - var _location = location; - if ((0, _util.isPoint)(location)) { - _location = (0, _util.getPoint)(_location.lng, _location.lat); - } - - this.instance = new global.BMap.WalkingRoute(_location, { - onSearchComplete: onSearchComplete, - onMarkersSet: onMarkersSet, - onInfoHtmlSet: onInfoHtmlSet, - onPolylinesSet: onPolylinesSet, - renderOptions: { - map: showInMap ? this.map : null, - panel: renderOptions.panel, - selectFirstResult: renderOptions.selectFirstResult, - autoViewport: renderOptions.autoViewport - } - }); - } - }]); - - return WalkingRoute; -}(_BaseService3.default)) || _class; - -exports.default = WalkingRoute; \ No newline at end of file diff --git a/lib/components/_base/events.js b/lib/components/_base/events.js deleted file mode 100644 index b72ef32..0000000 --- a/lib/components/_base/events.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var MAP = exports.MAP = ['click', 'dblclick', 'rightclick', 'rightdblclick', 'maptypechange', 'mousemove', 'mouseover', 'mouseout', 'movestart', 'moving', 'moveend', 'zoomstart', 'zoomend', 'addoverlay', 'addcontrol', 'removecontrol', 'removeoverlay', 'clearoverlays', 'dragstart', 'dragging', 'dragend', 'addtilelayer', 'removetilelayer', 'load', 'resize', 'hotspotclick', 'hotspotover', 'hotspotout', 'tilesloaded', 'touchstart', 'touchmove', 'touchend', 'longpress']; - -var OVERVIEW_MAP = exports.OVERVIEW_MAP = ['viewchanged', 'viewchanging']; - -var GEOLOCATION = exports.GEOLOCATION = ['locationSuccess', 'locationError']; - -var MARKER = exports.MARKER = ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseout', 'mouseover', 'remove', 'infowindowclose', 'infowindowopen', 'dragstart', 'dragging', 'dragend', 'rightclick']; - -var LABEL = exports.LABEL = ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseout', 'mouseover', 'remove', 'rightclick']; - -var POLYLINE = exports.POLYLINE = ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseout', 'mouseover', 'remove', 'lineupdate']; - -var POLYGON = exports.POLYGON = ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseout', 'mouseover', 'remove', 'lineupdate']; - -var CIRCLE = exports.CIRCLE = ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseout', 'mouseover', 'remove', 'lineupdate']; - -var INFO_WINDOW = exports.INFO_WINDOW = ['close', 'open', 'maximize', 'restore', 'clickclose']; - -var GROUND = exports.GROUND = ['click', 'dbclick']; - -var POINT_COLLECTION = exports.POINT_COLLECTION = ['click', 'mouseover', 'mouseout']; - -var CONTEXT_MENU = exports.CONTEXT_MENU = ['open', 'close']; - -var AUTO_COMPLETE = exports.AUTO_COMPLETE = ['onconfirm', 'onhighlight']; - -var DRAWING_MANAGER = exports.DRAWING_MANAGER = ['circlecomplete', 'markercomplete', 'overlaycomplete', 'polygoncomplete', 'polylinecomplete', 'rectanglecomplete']; - -var DISTANCE_TOOL = exports.DISTANCE_TOOL = ['onaddpoint', 'ondrawend']; \ No newline at end of file diff --git a/lib/components/_base/options.js b/lib/components/_base/options.js deleted file mode 100644 index 44c4295..0000000 --- a/lib/components/_base/options.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var MAP_SET_OPTIONS = exports.MAP_SET_OPTIONS = ['minZoom', 'maxZoom', 'defaultCursor', 'draggingCursor', 'mapStyle', 'zoom']; - -var MAP_BOOLEAN_OPTIONS = exports.MAP_BOOLEAN_OPTIONS = ['dragging', 'scrollWheelZoom', 'doubleClickZoom', 'keyboard', 'inertialDragging', 'continuousZoom', 'pinchToZoom', 'autoResize']; - -var MARKER_SET_OPTIONS = exports.MARKER_SET_OPTIONS = ['label', 'zIndex', 'top', 'icon', 'shadow']; - -var LABEL_SET_OPTIONS = exports.LABEL_SET_OPTIONS = ['title', 'zIndex', 'style']; - -var POLY_BOOLEAN_OPTIONS = exports.POLY_BOOLEAN_OPTIONS = ['editing', 'massClear']; - -var CIRCLE_BOOLEAN_OPTIONS = exports.CIRCLE_BOOLEAN_OPTIONS = ['editing', 'massClear']; - -var POLYLINE_BOOLEAN_OPTIONS = exports.POLYLINE_BOOLEAN_OPTIONS = ['editing', 'massClear']; \ No newline at end of file diff --git a/lib/components/_base/util.js b/lib/components/_base/util.js deleted file mode 100644 index 0591307..0000000 --- a/lib/components/_base/util.js +++ /dev/null @@ -1,388 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isPoint = undefined; - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - -exports.replaceInitialToUpper = replaceInitialToUpper; -exports.getPoint = getPoint; -exports.getSize = getSize; -exports.getBounds = getBounds; -exports.getMapBounds = getMapBounds; -exports.bindEvents = bindEvents; -exports.unBindEvents = unBindEvents; -exports.createIcon = createIcon; -exports.processSetOptions = processSetOptions; -exports.processBooleanOptions = processBooleanOptions; -exports.createLabel = createLabel; -exports.createSymbol = createSymbol; -exports.createContextMenu = createContextMenu; -exports.createPolygon = createPolygon; -exports.isSupportContext = isSupportContext; -exports.isSupportCanvas = isSupportCanvas; -exports.appendCss = appendCss; -exports.getPoiByKeyword = getPoiByKeyword; -exports.convertPoint = convertPoint; -exports.processContextMenu = processContextMenu; -exports.createMarker = createMarker; - -var _events = require('./events'); - -var EVENT = _interopRequireWildcard(_events); - -var _options = require('./options'); - -var OPTIONS = _interopRequireWildcard(_options); - -var _ContextMenuIcon = require('../../constants/ContextMenuIcon'); - -var _ContextMenuIcon2 = _interopRequireDefault(_ContextMenuIcon); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -var reg = /[a-z]/; - -function replaceInitialToUpper(value) { - return value.replace(reg, function (val) { - return val.toUpperCase(); - }); -} - -function getPoint(lng, lat) { - return new global.BMap.Point(lng, lat); -} - -function getSize(width, height) { - return new global.BMap.Size(width, height); -} - -function getBounds(bounds) { - var sw = bounds.sw, - ne = bounds.ne; - - return new global.BMap.Bounds(getPoint(sw.lng, sw.lat), getPoint(ne.lng, ne.lat)); -} - -function getMapBounds() { - return global.bMapInstance.getBounds(); -} - -var isPoint = exports.isPoint = function isPoint(obj) { - return obj.lng && obj.lat; -}; - -function bindEvents(target, eventKey, events) { - if (events && EVENT[eventKey]) { - EVENT[eventKey].forEach(function (eventName) { - if (events[eventName]) { - var callback = function callback() { - var _events$eventName; - - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - (_events$eventName = events[eventName]).call.apply(_events$eventName, [null].concat(args)); - }; - target.events = target.events || {}; - if (target.events['' + eventName]) { - target.removeEventListener(eventName, target.events['' + eventName]); - } - target.addEventListener(eventName, callback); - target.events['' + eventName] = callback; - } - }); - } -} - -function unBindEvents(target) { - var events = target.events; - - if (events) { - var eventNames = Object.keys(events); - for (var i = 0; i < eventNames.length; i += 1) { - var eventName = eventNames[i]; - var event = events[eventName]; - target.removeEventListener(eventName, event); - } - } -} - -function createIcon() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var url = options.url, - size = options.size, - _options$opts = options.opts, - opts = _options$opts === undefined ? {} : _options$opts; - - var iconSize = size && getSize(size.width, size.height); - return new global.BMap.Icon(url, iconSize, { - anchor: opts.anchor && global[opts.anchor], - imageSize: opts.imageSize && getSize(opts.imageSize.width, opts.imageSize.height), - imageOffset: opts.imageOffset && getSize(opts.imageOffset.width, opts.imageOffset.height), - infoWindowAnchor: opts.infoWindowAnchor && getSize(opts.infoWindowAnchor.width, opts.infoWindowAnchor.height), - printImageUrl: opts.printImageUrl - }); -} - -function processSetOptions(target, optionKey, opts) { - OPTIONS[optionKey].forEach(function (key) { - if (opts[key] || typeof opts[key] === 'boolean') { - var upKey = replaceInitialToUpper(key); - target['set' + upKey](opts[key]); - } - }); -} - -function processBooleanOptions(target, optionKey, opts) { - OPTIONS[optionKey].forEach(function (key) { - if (opts[key] || typeof opts[key] === 'boolean') { - var upKey = replaceInitialToUpper(key); - var prefix = 'disable'; - if (opts[key]) { - prefix = 'enable'; - } - target['' + prefix + upKey](); - } - }); -} - -function createLabel() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var content = options.content, - point = options.point, - _options$offset = options.offset, - offset = _options$offset === undefined ? { - width: 0, - height: 0 - } : _options$offset, - _options$massClear = options.massClear, - massClear = _options$massClear === undefined ? true : _options$massClear, - title = options.title, - events = options.events, - zIndex = options.zIndex, - style = options.style; - - - var opts = { - offset: offset && getSize(offset.width, offset.height), - enableMassClear: massClear, - position: point && getPoint(point.lng, point.lat) - }; - var label = new global.BMap.Label(content, opts); - bindEvents(label, 'LABEL', events); - var setOpts = { - title: title, - zIndex: zIndex, - style: style - }; - processSetOptions(label, 'LABEL_SET_OPTIONS', setOpts); - return label; -} - -function createSymbol() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var path = options.path, - _options$opts2 = options.opts, - opts = _options$opts2 === undefined ? {} : _options$opts2; - - var sPath = global[path] || path; - return new global.BMap.Symbol(sPath, _extends({}, opts)); -} - -function createContextMenu() { - var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - var events = arguments[1]; - - var menu = new global.BMap.ContextMenu(); - items.forEach(function (item) { - var iconUrl = item.iconUrl === _ContextMenuIcon2.default.ZOOMIN || item.iconUrl === _ContextMenuIcon2.default.ZOOMOUT ? global[item.iconUrl] : item.iconUrl; - var itemOpts = { - width: item.width, - id: item.id, - iconUrl: iconUrl - }; - var menuItem = new global.BMap.MenuItem(item.text, item.callback, itemOpts); - if (item.disabled) { - menuItem.disable(); - } - if (item.separator) { - menu.addSeparator(); - } - menu.addItem(menuItem); - }); - - bindEvents(menu, 'CONTEXT_MENU', events); - return menu; -} - -function createPolygon(props) { - var points = props.points, - strokeColor = props.strokeColor, - fillColor = props.fillColor, - strokeWeight = props.strokeWeight, - strokeOpacity = props.strokeOpacity, - fillOpacity = props.fillOpacity, - strokeStyle = props.strokeStyle, - _props$clicking = props.clicking, - clicking = _props$clicking === undefined ? true : _props$clicking, - events = props.events; - - - var opts = { - strokeColor: strokeColor, - fillColor: fillColor, - strokeWeight: strokeWeight, - strokeOpacity: strokeOpacity, - fillOpacity: fillOpacity, - strokeStyle: strokeStyle, - enableClicking: clicking - }; - - var pList = []; - - if (points) { - pList = points.map(function (item) { - return getPoint(item.lng, item.lat); - }); - } - - var instance = new global.BMap.Polygon(pList, opts); - - bindEvents(instance, 'POLYGON', events); - - return instance; -} - -function isSupportContext() { - return !!document.createElement('canvas').getContext; -} - -function isSupportCanvas() { - var elem = document.createElement('canvas'); - return !!(elem.getContext && elem.getContext('2d')); -} - -function appendCss() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var url = options.url, - id = options.id; - - var node = document.createElement('link'); - - node.rel = 'stylesheet'; - node.type = 'text/css'; - node.href = url; - if (typeof id !== 'undefined') { - node.id = id; - } - document.getElementsByTagName('head')[0].appendChild(node); -} - -function getPoiByKeyword(keyword) { - return new Promise(function (resolve) { - var local = new global.BMap.LocalSearch(global.bMapInstance, { - onSearchComplete: function onSearchComplete(result) { - var res = null; - if (result) { - res = result.getPoi(0); - } - resolve(res); - } - }); - local.search(keyword); - }); -} - -function convertPoint(points, from) { - var to = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5; - - return new Promise(function (resolve) { - var convert = new global.BMap.Convertor(); - if (!Array.isArray(points)) { - points = [points]; - } - var pList = points.map(function (item) { - return getPoint(item.lng, item.lat); - }); - convert.translate(pList, from, to, function (result) { - resolve(result); - }); - }); -} - -function processContextMenu(contextMenu, instance) { - if (contextMenu) { - var menu = createContextMenu(contextMenu.items, contextMenu.events); - instance.addContextMenu(menu); - } -} - -function createMarker(props) { - var point = props.point, - _props$offset = props.offset, - offset = _props$offset === undefined ? { - width: 0, - height: 0 - } : _props$offset, - icon = props.icon, - _props$massClear = props.massClear, - massClear = _props$massClear === undefined ? true : _props$massClear, - _props$dragging = props.dragging, - dragging = _props$dragging === undefined ? false : _props$dragging, - _props$clicking2 = props.clicking, - clicking = _props$clicking2 === undefined ? true : _props$clicking2, - _props$raiseOnDrag = props.raiseOnDrag, - raiseOnDrag = _props$raiseOnDrag === undefined ? false : _props$raiseOnDrag, - draggingCursor = props.draggingCursor, - rotation = props.rotation, - shadow = props.shadow, - title = props.title, - events = props.events, - label = props.label, - zIndex = props.zIndex, - _props$top = props.top, - top = _props$top === undefined ? false : _props$top, - contextMenu = props.contextMenu; - - - var oPoint = point && getPoint(point.lng, point.lat); - - var markerOpts = { - offset: offset && getSize(offset.width, offset.height), - enableMassClear: massClear, - enableDragging: dragging, - enableClicking: clicking, - raiseOnDrag: raiseOnDrag, - draggingCursor: draggingCursor, - rotation: rotation, - title: title - }; - - var instance = new global.BMap.Marker(oPoint, markerOpts); - - var setOpts = { - label: label && createLabel(label.props), - shadow: shadow && createIcon(shadow), - zIndex: zIndex, - top: top - }; - - if (icon && icon instanceof global.BMap.Symbol) { - setOpts.icon = icon; - } else if (icon) { - setOpts.icon = createIcon(icon); - } - - bindEvents(instance, 'MARKER', events); - - processContextMenu(contextMenu, instance); - processSetOptions(instance, 'MARKER_SET_OPTIONS', setOpts); - - return instance; -} \ No newline at end of file diff --git a/lib/constants/Animation.js b/lib/constants/Animation.js deleted file mode 100644 index bbd0abd..0000000 --- a/lib/constants/Animation.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - DROP: 'BMAP_ANIMATION_DROP', - BOUNCE: 'BMAP_ANIMATION_BOUNCE' -}; \ No newline at end of file diff --git a/lib/constants/ContextMenuIcon.js b/lib/constants/ContextMenuIcon.js deleted file mode 100644 index 062bd63..0000000 --- a/lib/constants/ContextMenuIcon.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - ZOOMIN: 'BMAP_CONTEXT_MENU_ICON_ZOOMIN', - ZOOMOUT: 'BMAP_CONTEXT_MENU_ICON_ZOOMOUT' -}; \ No newline at end of file diff --git a/lib/constants/ControlAnchor.js b/lib/constants/ControlAnchor.js deleted file mode 100644 index 35c802f..0000000 --- a/lib/constants/ControlAnchor.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - TOP_LEFT: 'BMAP_ANCHOR_TOP_LEFT', - TOP_RIGHT: 'BMAP_ANCHOR_TOP_RIGHT', - BOTTOM_LEFT: 'BMAP_ANCHOR_BOTTOM_LEFT', - BOTTOM_RIGHT: 'BMAP_ANCHOR_BOTTOM_RIGHT' -}; \ No newline at end of file diff --git a/lib/constants/DrawingMode.js b/lib/constants/DrawingMode.js deleted file mode 100644 index 64eaa98..0000000 --- a/lib/constants/DrawingMode.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - MARKER: 'marker', - CIRCLE: 'circle', - POLYLINE: 'polyline', - POLYGON: 'polygon', - RECTANGLE: 'rectangle' -}; \ No newline at end of file diff --git a/lib/constants/DrivingPolicy.js b/lib/constants/DrivingPolicy.js deleted file mode 100644 index 1c4eacf..0000000 --- a/lib/constants/DrivingPolicy.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - DEFAULT: 'BMAP_DRIVING_POLICY_DEFAULT', - FIRST_HIGHWAYS: 'BMAP_DRIVING_POLICY_FIRST_HIGHWAYS', - AVOID_HIGHWAYS: 'BMAP_DRIVING_POLICY_AVOID_HIGHWAYS', - AVOID_CONGESTION: 'BMAP_DRIVING_POLICY_AVOID_CONGESTION' -}; \ No newline at end of file diff --git a/lib/constants/IntercityPolicy.js b/lib/constants/IntercityPolicy.js deleted file mode 100644 index d337a7f..0000000 --- a/lib/constants/IntercityPolicy.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - LEAST_TIME: 'BMAP_INTERCITY_POLICY_LEAST_TIME', - EARLY_START: 'BMAP_INTERCITY_POLICY_EARLY_START', - CHEAP_PRICE: 'BMAP_INTERCITY_POLICY_CHEAP_PRICE' -}; \ No newline at end of file diff --git a/lib/constants/LengthUnit.js b/lib/constants/LengthUnit.js deleted file mode 100644 index 5702e44..0000000 --- a/lib/constants/LengthUnit.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - METRIC: 'BMAP_UNIT_METRIC', - IMPERIAL: 'BMAP_UNIT_IMPERIAL' -}; \ No newline at end of file diff --git a/lib/constants/MapPane.js b/lib/constants/MapPane.js deleted file mode 100644 index f3bc52a..0000000 --- a/lib/constants/MapPane.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - FLOAT: 'floatPane', // 信息窗口所在容器 - FLOAT_SHADOW: 'floatShadow', // 信息窗口阴影所在容器 - LABEL: 'labelPane', // 文本标注所在容器 - MARKER: 'markerPane', // 标注图标所在容器 - MARKER_MOUSE: 'markerMouseTarget', // 标注点击区域所在容器 - MARKER_SHADOW: 'markerShadow', // 标注阴影所在容器 - MAP: 'mapPane' // 折现、多边形等矢量图形所在容器 -}; \ No newline at end of file diff --git a/lib/constants/MapType.js b/lib/constants/MapType.js deleted file mode 100644 index 733d477..0000000 --- a/lib/constants/MapType.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - NORMAL: 'BMAP_NORMAL_MAP', - PERSPECTIVE: 'BMAP_PERSPECTIVE_MAP', - SATELLITE: 'BMAP_SATELLITE_MAP', - HYBRID: 'BMAP_HYBRID_MAP' -}; \ No newline at end of file diff --git a/lib/constants/MapTypeControlType.js b/lib/constants/MapTypeControlType.js deleted file mode 100644 index c508e77..0000000 --- a/lib/constants/MapTypeControlType.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - HORIZONTAL: 'BMAP_MAPTYPE_CONTROL_HORIZONTAL', - DROPDOWN: 'BMAP_MAPTYPE_CONTROL_DROPDOWN', - MAP: 'BMAP_MAPTYPE_CONTROL_MAP' -}; \ No newline at end of file diff --git a/lib/constants/NavigationType.js b/lib/constants/NavigationType.js deleted file mode 100644 index b735543..0000000 --- a/lib/constants/NavigationType.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - LARGE: 'BMAP_NAVIGATION_CONTROL_LARGE', - SMALL: 'BMAP_NAVIGATION_CONTROL_SMALL', - PAN: 'BMAP_NAVIGATION_CONTROL_PAN', - ZOOM: 'BMAP_NAVIGATION_CONTROL_ZOOM' -}; \ No newline at end of file diff --git a/lib/constants/ShapeType.js b/lib/constants/ShapeType.js deleted file mode 100644 index f5c1ca8..0000000 --- a/lib/constants/ShapeType.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - CIRCLE: 'BMAP_POINT_SHAPE_CIRCLE', - STAR: 'BMAP_POINT_SHAPE_STAR', - SQUARE: 'BMAP_POINT_SHAPE_SQUARE', - RHOMBUS: 'BMAP_POINT_SHAPE_RHOMBUS', - WATERDROP: 'BMAP_POINT_SHAPE_WATERDROP' -}; \ No newline at end of file diff --git a/lib/constants/SizeType.js b/lib/constants/SizeType.js deleted file mode 100644 index 58e2a0b..0000000 --- a/lib/constants/SizeType.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - TINY: 'BMAP_POINT_SIZE_TINY', - SMALLER: 'BMAP_POINT_SIZE_SMALLER', - SMALL: 'BMAP_POINT_SIZE_SMALL', - NORMAL: 'BMAP_POINT_SIZE_NORMAL', - BIG: 'BMAP_POINT_SIZE_BIG', - BIGGER: 'BMAP_POINT_SIZE_BIGGER', - HUGE: 'BMAP_POINT_SIZE_HUGE' -}; \ No newline at end of file diff --git a/lib/constants/StatusCode.js b/lib/constants/StatusCode.js deleted file mode 100644 index 61a7437..0000000 --- a/lib/constants/StatusCode.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - PERMISSION_DENIED: 'BMAP_STATUS_PERMISSION_DENIED', - SERVICE_UNAVAILABLE: 'BMAP_STATUS_SERVICE_UNAVAILABLE', - TIMEOUT: 'BMAP_STATUS_TIMEOUT' -}; \ No newline at end of file diff --git a/lib/constants/SymbolShapeType.js b/lib/constants/SymbolShapeType.js deleted file mode 100644 index 4f5a8df..0000000 --- a/lib/constants/SymbolShapeType.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - CIRCLE: 'BMap_Symbol_SHAPE_CIRCLE', - RECTANGLE: 'BMap_Symbol_SHAPE_RECTANGLE', - RHOMBUS: 'BMap_Symbol_SHAPE_RHOMBUS', - STAR: 'BMap_Symbol_SHAPE_STAR', - BACKWARD_CLOSED_ARROW: 'BMap_Symbol_SHAPE_BACKWARD_CLOSED_ARROW', - FORWARD_CLOSED_ARROW: 'BMap_Symbol_SHAPE_FORWARD_CLOSED_ARROW', - BACKWARD_OPEN_ARROW: 'BMap_Symbol_SHAPE_BACKWARD_OPEN_ARROW', - FORWARD_OPEN_ARROW: 'BMap_Symbol_SHAPE_FORWARD_OPEN_ARROW', - POINT: 'BMap_Symbol_SHAPE_POINT', - PLANE: 'BMap_Symbol_SHAPE_PLANE', - CAMERA: 'BMap_Symbol_SHAPE_CAMERA', - WARNING: 'BMap_Symbol_SHAPE_WARNING', - SMILE: 'BMap_Symbol_SHAPE_SMILE', - CLOCK: 'BMap_Symbol_SHAPE_CLOCK' -}; \ No newline at end of file diff --git a/lib/constants/TransitPolicy.js b/lib/constants/TransitPolicy.js deleted file mode 100644 index 42e61c6..0000000 --- a/lib/constants/TransitPolicy.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - RECOMMEND: 'BMAP_TRANSIT_POLICY_RECOMMEND', - LEAST_TIME: 'BMAP_TRANSIT_POLICY_LEAST_TIME', - LEAST_TRANSFER: 'BMAP_TRANSIT_POLICY_LEAST_TRANSFER', - LEAST_WALKING: 'BMAP_TRANSIT_POLICY_LEAST_WALKING', - AVOID_SUBWAYS: 'BMAP_TRANSIT_POLICY_AVOID_SUBWAYS', - FIRST_SUBWAYS: 'BMAP_TRANSIT_POLICY_FIRST_SUBWAYS' -}; \ No newline at end of file diff --git a/lib/constants/TransitTypePolicy.js b/lib/constants/TransitTypePolicy.js deleted file mode 100644 index 74b76cf..0000000 --- a/lib/constants/TransitTypePolicy.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = { - TRAIN: 'BMAP_TRANSIT_TYPE_POLICY_TRAIN', - AIRPLANE: 'BMAP_TRANSIT_TYPE_POLICY_AIRPLANE', - COACH: 'BMAP_TRANSIT_TYPE_POLICY_COACH' -}; \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 5b55314..0000000 --- a/lib/index.js +++ /dev/null @@ -1,511 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _Map = require('./components/Map'); - -Object.defineProperty(exports, 'Map', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Map).default; - } -}); - -var _Control = require('./components/Control'); - -Object.defineProperty(exports, 'Control', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Control).default; - } -}); - -var _Overlay = require('./components/Overlay'); - -Object.defineProperty(exports, 'Overlay', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Overlay).default; - } -}); - -var _ReactComponent = require('./components/ReactComponent'); - -Object.defineProperty(exports, 'ReactComponent', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_ReactComponent).default; - } -}); - -var _AutoComplete = require('./components/AutoComplete'); - -Object.defineProperty(exports, 'AutoComplete', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_AutoComplete).default; - } -}); - -var _Navigation = require('./components/Control/Navigation'); - -Object.defineProperty(exports, 'Navigation', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Navigation).default; - } -}); - -var _OverviewMap = require('./components/Control/OverviewMap'); - -Object.defineProperty(exports, 'OverviewMap', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_OverviewMap).default; - } -}); - -var _Scale = require('./components/Control/Scale'); - -Object.defineProperty(exports, 'Scale', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Scale).default; - } -}); - -var _MapType = require('./components/Control/MapType'); - -Object.defineProperty(exports, 'MapTypeCtrl', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_MapType).default; - } -}); - -var _Copyright = require('./components/Control/Copyright'); - -Object.defineProperty(exports, 'Copyright', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Copyright).default; - } -}); - -var _Geolocation = require('./components/Control/Geolocation'); - -Object.defineProperty(exports, 'Geolocation', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Geolocation).default; - } -}); - -var _Panorama = require('./components/Control/Panorama'); - -Object.defineProperty(exports, 'Panorama', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Panorama).default; - } -}); - -var _CityList = require('./components/Control/CityList'); - -Object.defineProperty(exports, 'CityList', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_CityList).default; - } -}); - -var _Marker = require('./components/Overlay/Marker'); - -Object.defineProperty(exports, 'Marker', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Marker).default; - } -}); - -var _Label = require('./components/Overlay/Label'); - -Object.defineProperty(exports, 'Label', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Label).default; - } -}); - -var _Polyline = require('./components/Overlay/Polyline'); - -Object.defineProperty(exports, 'Polyline', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Polyline).default; - } -}); - -var _Polygon = require('./components/Overlay/Polygon'); - -Object.defineProperty(exports, 'Polygon', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Polygon).default; - } -}); - -var _Circle = require('./components/Overlay/Circle'); - -Object.defineProperty(exports, 'Circle', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Circle).default; - } -}); - -var _InfoWindow = require('./components/Overlay/InfoWindow'); - -Object.defineProperty(exports, 'InfoWindow', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_InfoWindow).default; - } -}); - -var _Ground = require('./components/Overlay/Ground'); - -Object.defineProperty(exports, 'Ground', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Ground).default; - } -}); - -var _PointCollection = require('./components/Overlay/PointCollection'); - -Object.defineProperty(exports, 'PointCollection', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_PointCollection).default; - } -}); - -var _Symbol = require('./components/Overlay/Symbol'); - -Object.defineProperty(exports, 'Symbol', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Symbol).default; - } -}); - -var _Boundary = require('./components/Overlay/Boundary'); - -Object.defineProperty(exports, 'Boundary', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Boundary).default; - } -}); - -var _Heatmap = require('./components/Lib/Heatmap'); - -Object.defineProperty(exports, 'Heatmap', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Heatmap).default; - } -}); - -var _CurveLine = require('./components/Lib/CurveLine'); - -Object.defineProperty(exports, 'CurveLine', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_CurveLine).default; - } -}); - -var _MarkerClusterer = require('./components/Lib/MarkerClusterer'); - -Object.defineProperty(exports, 'MarkerClusterer', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_MarkerClusterer).default; - } -}); - -var _DrawingManager = require('./components/Lib/DrawingManager'); - -Object.defineProperty(exports, 'DrawingManager', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_DrawingManager).default; - } -}); - -var _DistanceTool = require('./components/Lib/DistanceTool'); - -Object.defineProperty(exports, 'DistanceTool', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_DistanceTool).default; - } -}); - -var _TrafficControl = require('./components/Lib/TrafficControl'); - -Object.defineProperty(exports, 'TrafficControl', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_TrafficControl).default; - } -}); - -var _Tile = require('./components/Layers/Tile'); - -Object.defineProperty(exports, 'Tile', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Tile).default; - } -}); - -var _LocalSearch = require('./components/Service/LocalSearch'); - -Object.defineProperty(exports, 'LocalSearch', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_LocalSearch).default; - } -}); - -var _TransitRoute = require('./components/Service/TransitRoute'); - -Object.defineProperty(exports, 'TransitRoute', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_TransitRoute).default; - } -}); - -var _DrivingRoute = require('./components/Service/DrivingRoute'); - -Object.defineProperty(exports, 'DrivingRoute', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_DrivingRoute).default; - } -}); - -var _WalkingRoute = require('./components/Service/WalkingRoute'); - -Object.defineProperty(exports, 'WalkingRoute', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_WalkingRoute).default; - } -}); - -var _RidingRoute = require('./components/Service/RidingRoute'); - -Object.defineProperty(exports, 'RidingRoute', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_RidingRoute).default; - } -}); - -var _BusLineSearch = require('./components/Service/BusLineSearch'); - -Object.defineProperty(exports, 'BusLineSearch', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_BusLineSearch).default; - } -}); - -var _MapType2 = require('./constants/MapType'); - -Object.defineProperty(exports, 'MapType', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_MapType2).default; - } -}); - -var _ControlAnchor = require('./constants/ControlAnchor'); - -Object.defineProperty(exports, 'ControlAnchor', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_ControlAnchor).default; - } -}); - -var _NavigationType = require('./constants/NavigationType'); - -Object.defineProperty(exports, 'NavigationType', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_NavigationType).default; - } -}); - -var _LengthUnit = require('./constants/LengthUnit'); - -Object.defineProperty(exports, 'LengthUnit', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_LengthUnit).default; - } -}); - -var _MapPane = require('./constants/MapPane'); - -Object.defineProperty(exports, 'MapPane', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_MapPane).default; - } -}); - -var _MapTypeControlType = require('./constants/MapTypeControlType'); - -Object.defineProperty(exports, 'MapTypeControlType', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_MapTypeControlType).default; - } -}); - -var _StatusCode = require('./constants/StatusCode'); - -Object.defineProperty(exports, 'StatusCode', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_StatusCode).default; - } -}); - -var _Animation = require('./constants/Animation'); - -Object.defineProperty(exports, 'Animation', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_Animation).default; - } -}); - -var _ShapeType = require('./constants/ShapeType'); - -Object.defineProperty(exports, 'ShapeType', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_ShapeType).default; - } -}); - -var _SizeType = require('./constants/SizeType'); - -Object.defineProperty(exports, 'SizeType', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_SizeType).default; - } -}); - -var _SymbolShapeType = require('./constants/SymbolShapeType'); - -Object.defineProperty(exports, 'SymbolShapeType', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_SymbolShapeType).default; - } -}); - -var _ContextMenuIcon = require('./constants/ContextMenuIcon'); - -Object.defineProperty(exports, 'ContextMenuIcon', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_ContextMenuIcon).default; - } -}); - -var _TransitPolicy = require('./constants/TransitPolicy'); - -Object.defineProperty(exports, 'TransitPolicy', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_TransitPolicy).default; - } -}); - -var _TransitTypePolicy = require('./constants/TransitTypePolicy'); - -Object.defineProperty(exports, 'TransitTypePolicy', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_TransitTypePolicy).default; - } -}); - -var _IntercityPolicy = require('./constants/IntercityPolicy'); - -Object.defineProperty(exports, 'IntercityPolicy', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_IntercityPolicy).default; - } -}); - -var _DrivingPolicy = require('./constants/DrivingPolicy'); - -Object.defineProperty(exports, 'DrivingPolicy', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_DrivingPolicy).default; - } -}); - -var _DrawingMode = require('./constants/DrawingMode'); - -Object.defineProperty(exports, 'DrawingMode', { - enumerable: true, - get: function get() { - return _interopRequireDefault(_DrawingMode).default; - } -}); - -var _util = require('./components/_base/util'); - -Object.defineProperty(exports, 'getMapBounds', { - enumerable: true, - get: function get() { - return _util.getMapBounds; - } -}); -Object.defineProperty(exports, 'getBounds', { - enumerable: true, - get: function get() { - return _util.getBounds; - } -}); -Object.defineProperty(exports, 'getPoiByKeyword', { - enumerable: true, - get: function get() { - return _util.getPoiByKeyword; - } -}); -Object.defineProperty(exports, 'convertPoint', { - enumerable: true, - get: function get() { - return _util.convertPoint; - } -}); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } \ No newline at end of file diff --git a/lib/libs/DistanceTool.js b/lib/libs/DistanceTool.js deleted file mode 100644 index e4a3f81..0000000 --- a/lib/libs/DistanceTool.js +++ /dev/null @@ -1,1766 +0,0 @@ -'use strict'; - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -/** - * @fileoverview 百度地图的测距工具类,对外开放。 - * 允许用户在地图上点击完成距离的测量。 - * 使用者可以自定义测距线段的相关样式,例如线宽、颜色、测距结果所用的单位制等等。 - * 主入口类是DistanceTool, - * 基于Baidu Map API 1.2。 - * - * @author Baidu Map Api Group - * @version 1.2 - */ -(function (root, factory) { - if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') { - module.exports = factory(); - } else if (typeof define === 'function' && define.amd) { - define(factory); - } else { - root.BMapLib = root.BMapLib || {}; - root.BMapLib.DistanceTool = root.BMapLib.DistanceTool || factory(); - } -})(undefined, function () { - /** - * 声明baidu包 - */ - var baidu = baidu || { guid: "$BAIDU$" }; - (function () { - // 一些页面级别唯一的属性,需要挂载在window[baidu.guid]上 - window[baidu.guid] = {}; - - /** - * 将源对象的所有属性拷贝到目标对象中 - * @name baidu.extend - * @function - * @grammar baidu.extend(target, source) - * @param {Object} target 目标对象 - * @param {Object} source 源对象 - * @returns {Object} 目标对象 - */ - baidu.extend = function (target, source) { - for (var p in source) { - if (source.hasOwnProperty(p)) { - target[p] = source[p]; - } - } - return target; - }; - - /** - * @ignore - * @namespace - * @baidu.lang 对语言层面的封装,包括类型判断、模块扩展、继承基类以及对象自定义事件的支持。 - * @property guid 对象的唯一标识 - */ - baidu.lang = baidu.lang || {}; - - /** - * 返回一个当前页面的唯一标识字符串。 - * @function - * @grammar baidu.lang.guid() - * @returns {String} 当前页面的唯一标识字符串 - */ - baidu.lang.guid = function () { - return "TANGRAM__" + (window[baidu.guid]._counter++).toString(36); - }; - - window[baidu.guid]._counter = window[baidu.guid]._counter || 1; - - /** - * 所有类的实例的容器 - * key为每个实例的guid - */ - window[baidu.guid]._instances = window[baidu.guid]._instances || {}; - - /** - * Tangram继承机制提供的一个基类,用户可以通过继承baidu.lang.Class来获取它的属性及方法。 - * @function - * @name baidu.lang.Class - * @grammar baidu.lang.Class(guid) - * @param {string} guid 对象的唯一标识 - * @meta standard - * @remark baidu.lang.Class和它的子类的实例均包含一个全局唯一的标识guid。 - * guid是在构造函数中生成的,因此,继承自baidu.lang.Class的类应该直接或者间接调用它的构造函数。
    - * baidu.lang.Class的构造函数中产生guid的方式可以保证guid的唯一性,及每个实例都有一个全局唯一的guid。 - */ - baidu.lang.Class = function (guid) { - this.guid = guid || baidu.lang.guid(); - window[baidu.guid]._instances[this.guid] = this; - }; - - window[baidu.guid]._instances = window[baidu.guid]._instances || {}; - - /** - * 判断目标参数是否string类型或String对象 - * @name baidu.lang.isString - * @function - * @grammar baidu.lang.isString(source) - * @param {Any} source 目标参数 - * @shortcut isString - * @meta standard - * - * @returns {boolean} 类型判断结果 - */ - baidu.lang.isString = function (source) { - return '[object String]' == Object.prototype.toString.call(source); - }; - - /** - * 判断目标参数是否为function或Function实例 - * @name baidu.lang.isFunction - * @function - * @grammar baidu.lang.isFunction(source) - * @param {Any} source 目标参数 - * @returns {boolean} 类型判断结果 - */ - baidu.lang.isFunction = function (source) { - return '[object Function]' == Object.prototype.toString.call(source); - }; - - /** - * 重载了默认的toString方法,使得返回信息更加准确一些。 - * @return {string} 对象的String表示形式 - */ - baidu.lang.Class.prototype.toString = function () { - return "[object " + (this._className || "Object") + "]"; - }; - - /** - * 释放对象所持有的资源,主要是自定义事件。 - * @name dispose - * @grammar obj.dispose() - */ - baidu.lang.Class.prototype.dispose = function () { - delete window[baidu.guid]._instances[this.guid]; - for (var property in this) { - if (!baidu.lang.isFunction(this[property])) { - delete this[property]; - } - } - this.disposed = true; - }; - - /** - * 自定义的事件对象。 - * @function - * @name baidu.lang.Event - * @grammar baidu.lang.Event(type[, target]) - * @param {string} type 事件类型名称。为了方便区分事件和一个普通的方法,事件类型名称必须以"on"(小写)开头。 - * @param {Object} [target]触发事件的对象 - * @meta standard - * @remark 引入该模块,会自动为Class引入3个事件扩展方法:addEventListener、removeEventListener和dispatchEvent。 - * @see baidu.lang.Class - */ - baidu.lang.Event = function (type, target) { - this.type = type; - this.returnValue = true; - this.target = target || null; - this.currentTarget = null; - }; - - /** - * 注册对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.addEventListener(type, handler[, key]) - * @param {string} type 自定义事件的名称 - * @param {Function} handler 自定义事件被触发时应该调用的回调函数 - * @param {string} [key] 为事件监听函数指定的名称,可在移除时使用。如果不提供,方法会默认为它生成一个全局唯一的key。 - * @remark 事件类型区分大小写。如果自定义事件名称不是以小写"on"开头,该方法会给它加上"on"再进行判断,即"click"和"onclick"会被认为是同一种事件。 - */ - baidu.lang.Class.prototype.addEventListener = function (type, handler, key) { - if (!baidu.lang.isFunction(handler)) { - return; - } - !this.__listeners && (this.__listeners = {}); - var t = this.__listeners, - id; - if (typeof key == "string" && key) { - if (/[^\w\-]/.test(key)) { - throw "nonstandard key:" + key; - } else { - handler.hashCode = key; - id = key; - } - } - type.indexOf("on") != 0 && (type = "on" + type); - _typeof(t[type]) != "object" && (t[type] = {}); - id = id || baidu.lang.guid(); - handler.hashCode = id; - t[type][id] = handler; - }; - - /** - * 移除对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.removeEventListener(type, handler) - * @param {string} type 事件类型 - * @param {Function|string} handler 要移除的事件监听函数或者监听函数的key - * @remark 如果第二个参数handler没有被绑定到对应的自定义事件中,什么也不做。 - */ - baidu.lang.Class.prototype.removeEventListener = function (type, handler) { - if (baidu.lang.isFunction(handler)) { - handler = handler.hashCode; - } else if (!baidu.lang.isString(handler)) { - return; - } - !this.__listeners && (this.__listeners = {}); - type.indexOf("on") != 0 && (type = "on" + type); - var t = this.__listeners; - if (!t[type]) { - return; - } - t[type][handler] && delete t[type][handler]; - }; - - /** - * 派发自定义事件,使得绑定到自定义事件上面的函数都会被执行。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.dispatchEvent(event, options) - * @param {baidu.lang.Event|String} event Event对象,或事件名称(1.1.1起支持) - * @param {Object} options 扩展参数,所含属性键值会扩展到Event对象上(1.2起支持) - * @remark 处理会调用通过addEventListenr绑定的自定义事件回调函数之外,还会调用直接绑定到对象上面的自定义事件。 - * 例如:
    - * myobj.onMyEvent = function(){}
    - * myobj.addEventListener("onMyEvent", function(){}); - */ - baidu.lang.Class.prototype.dispatchEvent = function (event, options) { - if (baidu.lang.isString(event)) { - event = new baidu.lang.Event(event); - } - !this.__listeners && (this.__listeners = {}); - options = options || {}; - for (var i in options) { - event[i] = options[i]; - } - var i, - t = this.__listeners, - p = event.type; - event.target = event.target || this; - event.currentTarget = this; - p.indexOf("on") != 0 && (p = "on" + p); - baidu.lang.isFunction(this[p]) && this[p].apply(this, arguments); - if (_typeof(t[p]) == "object") { - for (i in t[p]) { - t[p][i].apply(this, arguments); - } - } - return event.returnValue; - }; - - /** - * 为类型构造器建立继承关系 - * @name baidu.lang.inherits - * @function - * @grammar baidu.lang.inherits(subClass, superClass[, className]) - * @param {Function} subClass 子类构造器 - * @param {Function} superClass 父类构造器 - * @param {string} className 类名标识 - * @remark 使subClass继承superClass的prototype, - * 因此subClass的实例能够使用superClass的prototype中定义的所有属性和方法。
    - * 这个函数实际上是建立了subClass和superClass的原型链集成,并对subClass进行了constructor修正。
    - * 注意:如果要继承构造函数,需要在subClass里面call一下,具体见下面的demo例子 - * @shortcut inherits - * @meta standard - * @see baidu.lang.Class - */ - baidu.lang.inherits = function (subClass, superClass, className) { - var key, - proto, - selfProps = subClass.prototype, - clazz = new Function(); - clazz.prototype = superClass.prototype; - proto = subClass.prototype = new clazz(); - for (key in selfProps) { - proto[key] = selfProps[key]; - } - subClass.prototype.constructor = subClass; - subClass.superClass = superClass.prototype; - - if ("string" == typeof className) { - proto._className = className; - } - }; - - /** - * @ignore - * @namespace baidu.dom 操作dom的方法。 - */ - baidu.dom = baidu.dom || {}; - - /** - * 从文档中获取指定的DOM元素 - * - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @meta standard - * @return {HTMLElement} DOM元素,如果不存在,返回null,如果参数不合法,直接返回参数 - */ - baidu._g = baidu.dom._g = function (id) { - if (baidu.lang.isString(id)) { - return document.getElementById(id); - } - return id; - }; - - /** - * 从文档中获取指定的DOM元素 - * @name baidu.dom.g - * @function - * @grammar baidu.dom.g(id) - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @meta standard - * - * @returns {HTMLElement|null} 获取的元素,查找不到时返回null,如果参数不合法,直接返回参数 - */ - baidu.g = baidu.dom.g = function (id) { - if ('string' == typeof id || id instanceof String) { - return document.getElementById(id); - } else if (id && id.nodeName && (id.nodeType == 1 || id.nodeType == 9)) { - return id; - } - return null; - }; - - /** - * 在目标元素的指定位置插入HTML代码 - * @name baidu.dom.insertHTML - * @function - * @grammar baidu.dom.insertHTML(element, position, html) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} position 插入html的位置信息,取值为beforeBegin,afterBegin,beforeEnd,afterEnd - * @param {string} html 要插入的html - * @remark - * - * 对于position参数,大小写不敏感
    - * 参数的意思:beforeBegin<span>afterBegin this is span! beforeEnd</span> afterEnd
    - * 此外,如果使用本函数插入带有script标签的HTML字符串,script标签对应的脚本将不会被执行。 - * - * @shortcut insertHTML - * @meta standard - * - * @returns {HTMLElement} 目标元素 - */ - baidu.insertHTML = baidu.dom.insertHTML = function (element, position, html) { - element = baidu.dom.g(element); - var range, begin; - - if (element.insertAdjacentHTML) { - element.insertAdjacentHTML(position, html); - } else { - // 这里不做"undefined" != typeof(HTMLElement) && !window.opera判断,其它浏览器将出错?! - // 但是其实做了判断,其它浏览器下等于这个函数就不能执行了 - range = element.ownerDocument.createRange(); - // FF下range的位置设置错误可能导致创建出来的fragment在插入dom树之后html结构乱掉 - // 改用range.insertNode来插入html, by wenyuxiang @ 2010-12-14. - position = position.toUpperCase(); - if (position == 'AFTERBEGIN' || position == 'BEFOREEND') { - range.selectNodeContents(element); - range.collapse(position == 'AFTERBEGIN'); - } else { - begin = position == 'BEFOREBEGIN'; - range[begin ? 'setStartBefore' : 'setEndAfter'](element); - range.collapse(begin); - } - range.insertNode(range.createContextualFragment(html)); - } - return element; - }; - - /** - * 为目标元素添加className - * @name baidu.dom.addClass - * @function - * @grammar baidu.dom.addClass(element, className) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} className 要添加的className,允许同时添加多个class,中间使用空白符分隔 - * @remark - * 使用者应保证提供的className合法性,不应包含不合法字符,className合法字符参考:http://www.w3.org/TR/CSS2/syndata.html。 - * @shortcut addClass - * @meta standard - * - * @returns {HTMLElement} 目标元素 - */ - baidu.ac = baidu.dom.addClass = function (element, className) { - element = baidu.dom.g(element); - var classArray = className.split(/\s+/), - result = element.className, - classMatch = " " + result + " ", - i = 0, - l = classArray.length; - - for (; i < l; i++) { - if (classMatch.indexOf(" " + classArray[i] + " ") < 0) { - result += (result ? ' ' : '') + classArray[i]; - } - } - - element.className = result; - return element; - }; - - /** - * @ignore - * @namespace baidu.event 屏蔽浏览器差异性的事件封装。 - * @property target 事件的触发元素 - * @property pageX 鼠标事件的鼠标x坐标 - * @property pageY 鼠标事件的鼠标y坐标 - * @property keyCode 键盘事件的键值 - */ - baidu.event = baidu.event || {}; - - /** - * 事件监听器的存储表 - * @private - * @meta standard - */ - baidu.event._listeners = baidu.event._listeners || []; - - /** - * 为目标元素添加事件监听器 - * @name baidu.event.on - * @function - * @grammar baidu.event.on(element, type, listener) - * @param {HTMLElement|string|window} element 目标元素或目标元素id - * @param {string} type 事件类型 - * @param {Function} listener 需要添加的监听器 - * @remark - * 1. 不支持跨浏览器的鼠标滚轮事件监听器添加
    - * 2. 改方法不为监听器灌入事件对象,以防止跨iframe事件挂载的事件对象获取失败 - * @shortcut on - * @meta standard - * @see baidu.event.un - * - * @returns {HTMLElement|window} 目标元素 - */ - baidu.on = baidu.event.on = function (element, type, listener) { - type = type.replace(/^on/i, ''); - element = baidu._g(element); - var realListener = function realListener(ev) { - // 1. 这里不支持EventArgument, 原因是跨frame的事件挂载 - // 2. element是为了修正this - listener.call(element, ev); - }, - lis = baidu.event._listeners, - filter = baidu.event._eventFilter, - afterFilter, - realType = type; - type = type.toLowerCase(); - // filter过滤 - if (filter && filter[type]) { - afterFilter = filter[type](element, type, realListener); - realType = afterFilter.type; - realListener = afterFilter.listener; - } - // 事件监听器挂载 - if (element.addEventListener) { - element.addEventListener(realType, realListener, false); - } else if (element.attachEvent) { - element.attachEvent('on' + realType, realListener); - } - - // 将监听器存储到数组中 - lis[lis.length] = [element, type, listener, realListener, realType]; - return element; - }; - - /** - * 为目标元素移除事件监听器 - * @name baidu.event.un - * @function - * @grammar baidu.event.un(element, type, listener) - * @param {HTMLElement|string|window} element 目标元素或目标元素id - * @param {string} type 事件类型 - * @param {Function} listener 需要移除的监听器 - * @shortcut un - * @meta standard - * - * @returns {HTMLElement|window} 目标元素 - */ - baidu.un = baidu.event.un = function (element, type, listener) { - element = baidu._g(element); - type = type.replace(/^on/i, '').toLowerCase(); - - var lis = baidu.event._listeners, - len = lis.length, - isRemoveAll = !listener, - item, - realType, - realListener; - - //如果将listener的结构改成json - //可以节省掉这个循环,优化性能 - //但是由于un的使用频率并不高,同时在listener不多的时候 - //遍历数组的性能消耗不会对代码产生影响 - //暂不考虑此优化 - while (len--) { - item = lis[len]; - - // listener存在时,移除element的所有以listener监听的type类型事件 - // listener不存在时,移除element的所有type类型事件 - if (item[1] === type && item[0] === element && (isRemoveAll || item[2] === listener)) { - realType = item[4]; - realListener = item[3]; - if (element.removeEventListener) { - element.removeEventListener(realType, realListener, false); - } else if (element.detachEvent) { - element.detachEvent('on' + realType, realListener); - } - lis.splice(len, 1); - } - } - return element; - }; - - /** - * 阻止事件的默认行为 - * @name baidu.event.preventDefault - * @function - * @grammar baidu.event.preventDefault(event) - * @param {Event} event 事件对象 - * @meta standard - */ - baidu.preventDefault = baidu.event.preventDefault = function (event) { - if (event.preventDefault) { - event.preventDefault(); - } else { - event.returnValue = false; - } - }; - })(); - - /** - * @exports DistanceTool as BMapLib.DistanceTool - */ - var DistanceTool = - /** - * DistanceTool类的构造函数 - * @class 距离测算类,实现测距效果的入口。 - * 实例化该类后,即可调用该类提供的open - * 方法开启测距状态。 - * - * @constructor - * @param {Map} map Baidu map的实例对象 - * @param {Json Object} opts 可选的输入参数,非必填项。可输入选项包括:
    - * {"followText" : {String} 测距过程中,提示框文字, - *
    "unit" : {String} 测距结果所用的单位制,可接受的属性为"metric"表示米制和"us"表示美国传统单位, - *
    "lineColor" : {String} 折线颜色, - *
    "lineStroke" : {Number} 折线宽度, - *
    "opacity" : {Number} 透明度, - *
    "lineStyle" : {String} 折线的样式,只可设置solid和dashed, - *
    "secIcon" : {BMap.Icon} 转折点的Icon, - *
    "closeIcon" : {BMap.Icon} 关闭按钮的Icon, - *
    "cursor" : {String} 跟随的鼠标样式} - * - * @example 参考示例:
    - * var map = new BMap.Map("container");
    map.centerAndZoom(new BMap.Point(116.404, 39.915), 15);
    var myDistanceToolObject = new BMapLib.DistanceTool(map, {lineStroke : 2}); - */ - function DistanceTool(map, opts) { - if (!map) { - return; - } - - /** - * map对象 - * @private - * @type {Map} - */ - this._map = map; - - opts = opts || {}; - /** - * _opts是默认参数赋值。 - * 下面通过用户输入的opts,对默认参数赋值 - * @private - * @type {Json} - */ - this._opts = baidu.extend(baidu.extend(this._opts || {}, { - - /** - * 测距提示 - * @private - * @type {String} - */ - tips: "测距", - - /** - * 测距过程中,提示框文字 - * @private - * @type {String} - */ - followText: "单击确定地点,双击结束", - - /** - * 测距结果所用的单位制,可接受的属性为"metric"表示米制和"us"表示美国传统单位 - * @private - * @type {String} - */ - unit: "metric", - - /** - * 折线颜色 - * @private - * @type {String} - */ - lineColor: "#ff6319", - - /** - * 折线线宽 - * @private - * @type {Number} - */ - lineStroke: 2, - - /** - * 折线透明度 - * @private - * @type {Number} - */ - opacity: 0.8, - - /** - * 折线样式 - * @private - * @type {String} - */ - lineStyle: "solid", - - /** - * 跟随鼠标样式 - * @private - * @type {String} - */ - cursor: "http://api.map.baidu.com/images/ruler.cur", - - /** - * 转折点的ICON样式 - * @private - * @type {BMap.Icon} - */ - secIcon: null, - - /** - * 转折点的ICON样式 - * @private - * @type {BMap.Icon} - */ - closeIcon: null - }), opts); - - /** - * 跟随的title覆盖物 - * @private - * @type {BMap.Label} - */ - this._followTitle = null; - - /** - * 折线包含所有点的数组 - * @private - * @type {Array} - */ - this._points = []; - - /** - * 折线所包含的所有path数组 - * @private - * @type {Array} - */ - this._paths = []; - - /** - * 折线结点图片数组 - * @private - * @type {Array} - */ - this._dots = []; - - /** - * 折线测距包含所有线段的距离 - * @private - * @type {Array} - */ - this._segDistance = []; - - /** - * 覆盖物的数组 - * @private - * @type {Array} - */ - this._overlays = []; - - /** - * 是否在调用map.clearOverlays清除画线需要建立的相关overlay元素 - * @private - * @type {Boolean} - */ - this._enableMassClear = true, - - /** - * 单位制,存储语言包中定义的单位名称 - * @private - * @type {Json} - */ - this._units = { - // metric 表示米制 - metric: { - /** - * 米制的名称 - * @type {String} - */ - name: "metric", - - /** - * 和米制的换算关系 - * @type {Number} - */ - conv: 1, - - /** - * 米制单位下两个单位制之间的换算关系 - * @type {Number} - */ - incon: 1000, - - /** - * 米制单位下较小单位 - * @type {String} - */ - u1: "米", - - /** - * 米制单位下较大单位 - * @type {String} - */ - u2: "公里" - }, - // us 表示美国传统单位,各参数意义同上metric - us: { - name: "us", - conv: 3.2808, - incon: 5279.856, - u1: "英尺", - u2: "英里" - } - }; - - /** - * 是否已经开启了测距状态 - * @private - * @type {Boolean} - */ - this._isOpen = false; - - /** - * 未点击任何一点时,鼠标移动时的跟随提示文字 - * @private - * @type {String} - */ - this._startFollowText = "单击确定起点"; - - /** - * 地图移动的计时器 - * @private - * @type {Object} - */ - this._movingTimerId = null; - - /** - * 测距需要添加的CSS样式 - * @private - * @type {Json} - */ - this._styles = { - "BMapLib_diso": "height:17px;width:5px;position:absolute;background:url(http://api.map.baidu.com/images/dis_box_01.gif) no-repeat left top", - "BMapLib_disi": "color:#7a7a7a;position:absolute;left:5px;padding:0 4px 1px 0;line-height:17px;background:url(http://api.map.baidu.com/images/dis_box_01.gif) no-repeat right top", - "BMapLib_disBoxDis": "color:#ff6319;font-weight:bold" - }; - - if (this._opts.lineStroke <= 0) { - this._opts.lineStroke = 2; - } - if (this._opts.opacity > 1) { - this._opts.opacity = 1; - } else if (this._opts.opacity < 0) { - this._opts.opacity = 0; - } - if (this._opts.lineStyle != "solid" && this._opts.lineStyle != "dashed") { - this._opts.lineStyle = "solid"; - } - if (!this._units[this._opts.unit]) { - this._opts.unit = "metric"; - } - - this.text = "测距"; - }; - - // 通过baidu.lang下的inherits方法,让DistanceTool继承baidu.lang.Class - baidu.lang.inherits(DistanceTool, baidu.lang.Class, "DistanceTool"); - - /** - * 地图区域的移动事件绑定 - * @return 无返回值 - */ - DistanceTool.prototype._bind = function () { - // 设置鼠标样式 - this._setCursor(this._opts.cursor); - var me = this; - // 在装载地图的页面元素上,绑定鼠标移动事件 - baidu.on(this._map.getContainer(), "mousemove", function (e) { - if (!me._isOpen) { - return; - } - if (!me._followTitle) { - return; - } - e = window.event || e; - var t = e.target || e.srcElement; - // 如果触发该事件的页面元素不是遮盖效果层,则返回,无操作 - if (t != OperationMask.getDom(me._map)) { - me._followTitle.hide(); - return; - } - if (!me._mapMoving) { - me._followTitle.show(); - } - // 设置鼠标移动过程中,跟随的文字提示框的位置 - var pt = OperationMask.getDrawPoint(e, true); - me._followTitle.setPosition(pt); - }); - // 创建鼠标跟随的文字提示框 - if (this._startFollowText) { - var t = this._followTitle = new BMap.Label(this._startFollowText, { offset: new BMap.Size(14, 16) }); - this._followTitle.setStyles({ color: "#333", borderColor: "#ff0103" }); - } - }; - - /** - * 开启地图的测距状态 - * @return {Boolean},开启测距状态成功,返回true;否则返回false。 - * - * @example 参考示例:
    - * myDistanceToolObject.open(); - */ - DistanceTool.prototype.open = function () { - // 判断测距状态是否已经开启 - if (this._isOpen == true) { - return true; - } - // 已有其他地图上的鼠标操作工具开启 - if (!!global._toolInUse) { - return; - } - this._isOpen = true; - global._toolInUse = true; - - // 判断是否是否在移动过程中 - if (this._mapMoving) { - delete this._mapMoving; - } - - var me = this; - // 增加鼠标在地图区域移动的事件 - // 通过binded参数,避免多次绑定 - if (!this._binded) { - this._binded = true; - // 绑定控件项事件 - this._bind(); - // 地图的移动过程中,需要隐藏相关的提示框 - this._map.addEventListener("moving", function () { - me._hideCurrent(); - }); - } - - // 将文字提示框作为BMap.Label元素,提交给Map Api进行管理 - if (this._followTitle) { - this._map.addOverlay(this._followTitle); - this._followTitle.hide(); - } - - /** - * 测距过程中,点击地图时,触发的操作 - * @ignore - * @param {Object} e event对象 - */ - var distClick = function distClick(e) { - var map = me._map; - if (!me._isOpen) { - return; - } - // 通过event对象,计算得出点击位置的物理坐标,poi为一个BMap.Point对象 - e = window.event || e; - var poi = OperationMask.getDrawPoint(e, true); - // 验证计算得出的该点的位置合理性 - if (!me._isPointValid(poi)) { - return; - } - // 记录当前点的屏幕位置 - me._bind.initX = e.pageX || e.clientX || 0; - me._bind.initY = e.pageY || e.clientY || 0; - - // 这个if循环内的计算是,判断当前这个点,与存储内的最后一个点的距离, - // 如果距离过小,比如小于5,可以认为是用户的误点,可以忽略掉 - if (me._points.length > 0) { - var lstPx = map.pointToPixel(me._points[me._points.length - 1]); - var thisPx = map.pointToPixel(poi); - var dis = Math.sqrt(Math.pow(lstPx.x - thisPx.x, 2) + Math.pow(lstPx.y - thisPx.y, 2)); - if (dis < 5) { - return; - } - } - - me._bind.x = e.layerX || e.offsetX || 0; - me._bind.y = e.layerY || e.offsetY || 0; - me._points.push(poi); - // 添加测距结点 - me._addSecPoint(poi); - - // 调整跟踪鼠标的标签 - if (me._paths.length == 0) { - me._formatTitle(1, me._opts.followText, me._getTotalDistance()); - } - - // 修改确定线的颜色 - if (me._paths.length > 0) { - me._paths[me._paths.length - 1].show(); - me._paths[me._paths.length - 1].setStrokeOpacity(me._opts.opacity); - } - - var path = new BMap.Polyline([poi, poi], { enableMassClear: me._enableMassClear }); - me._map.addOverlay(path); - me._paths.push(path); - me._overlays.push(path); - - // 测距模式下线样式固定 - path.setStrokeWeight(me._opts.lineStroke); - path.setStrokeColor(me._opts.lineColor); - path.setStrokeOpacity(me._opts.opacity / 2); - path.setStrokeStyle(me._opts.lineStyle); - - // 如果地图正在移动则隐藏掉 - if (me._mapMoving) { - path.hide(); - } - - if (me._points.length > 1) { - var siblingPath = me._paths[me._points.length - 2]; - siblingPath.setPositionAt(1, poi); - } - - // 生成节点旁边的距离显示框 - var disText = ""; - if (me._points.length > 1) { - // 非起点的节点,显示当前的距离 - var segDis = me._setSegDistance(me._points[me._points.length - 2], me._points[me._points.length - 1]); - var meters = me._getTotalDistance(); - disText = me._formatDisStr(meters); - } else { - disText = "起点"; - } - var disLabel = new BMap.Label(disText, { offset: new BMap.Size(10, -5), enableMassClear: me._enableMassClear }); - disLabel.setStyles({ color: "#333", borderColor: "#ff0103" }); - me._map.addOverlay(disLabel); - me._formatSegLabel(disLabel, disText); - me._overlays.push(disLabel); - poi.disLabel = disLabel; - disLabel.setPosition(poi); - - /** - * 测距过程中,每次点击底图添加节点时,派发事件的接口 - * @name DistanceTool#onaddpoint - * @event - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值: - *
    {"point : {BMap.Point} 最新添加上的节点BMap.Point对象, - *
    "pixel:{BMap.pixel} 最新添加上的节点BMap.Pixel对象, - *
    "index:{Number} 最新添加的节点的索引, - *
    "distance:{Number} 截止最新添加的节点的总距离} - * - * @example 参考示例:
    - * myDistanceToolObject.addEventListener("addpoint", function(e) { alert(e.distance); }); - */ - - // 生成名为onaddpoint的baidu.lang.Event对象 - // 并给该event对象添加上point、pixel、index和distance等属性字段 - // 然后在此刻,将绑定在onaddpoint上事件,全部赋予event参数,然后派发出去 - var event = new baidu.lang.Event("onaddpoint"); - event.point = poi; - event.pixel = me._map.pointToPixel(poi); - event.index = me._points.length - 1; - event.distance = me._getTotalDistance().toFixed(0); - me.dispatchEvent(event); - }; - - /** - * 测距过程中,鼠标在地图上移动时,触发的操作 - * @ignore - * @param {Object} e event对象 - */ - var distMove = function distMove(e) { - if (!me._isOpen) { - return; - } - // 通过判断数组me._paths的长度,判断当前是否已经有测量节点 - // 也就是,如果没有节点,则还没有开始测量 - if (me._paths.length > 0) { - // 通过event参数,计算当前点的位置 - e = window.event || e; - var curX = e.pageX || e.clientX || 0; - var curY = e.pageY || e.clientY || 0; - if (typeof me._bind.initX == "undefined") { - me._bind.x = e.layerX || e.offsetX || 0; - me._bind.y = e.layerY || e.offsetY || 0; - me._bind.initX = curX; - me._bind.initY = curY; - } - var x = me._bind.x + curX - me._bind.initX; - var y = me._bind.y + curY - me._bind.initY; - - // 修改最后一条折线的终点位置,使之随着鼠标移动画线 - var path = me._paths[me._paths.length - 1]; - var poi = me._map.pixelToPoint(new BMap.Pixel(x, y)); - path.setPositionAt(1, poi); - - if (!me._mapMoving) { - path.show(); - } - var dx = 0; - var dy = 0; - // 计算当前鼠标位置,是否靠近边界、或者已经出了边界 - // 如果在边界位置,则需要向对应的方向移动地图,来进行测量 - // 每次移动的距离,设定为8 - if (x < 10) { - dx = 8; - } else if (x > me._map.getSize().width - 10) { - dx = -8; - } - if (y < 10) { - dy = 8; - } else if (y > me._map.getSize().height - 10) { - dy = -8; - } - // 如果dx和dy都等于0,表明不需要移动地图 - if (dx != 0 || dy != 0) { - // 此时需要向一个方向,平移地图 - if (!distMove._movingTimerId) { - me._mapMoving = true; - me._map.panBy(dx, dy, { noAnimation: true }); - me._movingTimerId = distMove._movingTimerId = setInterval(function () { - me._map.panBy(dx, dy, { noAnimation: true }); - }, 30); - // 地图移动过程中,隐藏线段和标签 - path.hide(); - me._followTitle && me._followTitle.hide(); - } - } else { - if (distMove._movingTimerId) { - // 此时用户不在需要移动地图来测量,可以清除计时器 - clearInterval(distMove._movingTimerId); - delete distMove._movingTimerId; - delete me._movingTimerId; - - // 显示跟随提示框,并修改线路位置 - var lstP = me._paths[me._paths.length - 1]; - var poiN = me._map.pixelToPoint(new BMap.Pixel(x, y)); - if (!lstP) { - return; - } - lstP.setPositionAt(1, poiN); - lstP.show(); - if (me._followTitle) { - me._followTitle.setPosition(poiN); - me._followTitle.show(); - } - me._bind.i = 0; - me._bind.j = 0; - delete me._mapMoving; - } - } - // 实时更新文字提示框中的距离 - if (me._followTitle) { - var td = me._getTotalDistance(); - var dis = me._map.getDistance(me._points[me._points.length - 1], poi); - me._updateInstDis(me._followTitle, td + dis); - } - } else { - // 此时用户还没有开始测量,只是鼠标随便在地图上移动 - if (me._followTitle) { - me._followTitle.show(); - e = window.event || e; - var t = e.target || e.srcElement; - if (t != OperationMask.getDom()) { - me._followTitle.hide(); - } - } - } - }; - - /** - * 测距要结束时,双击地图,触发的操作 - * @ignore - * @param {Object} e event对象 - */ - var distDblclick = function distDblclick(e) { - if (!me._isOpen) { - return; - } - // 结束时,删除绑定的事件 - baidu.un(OperationMask.getDom(me._map), "click", distClick); - baidu.un(document, "mousemove", distMove); - baidu.un(OperationMask.getDom(me._map), "dblclick", distDblclick); - baidu.un(document, "keydown", distKeyDown); - baidu.un(OperationMask.getDom(me._map), "mouseup", distMouseUp); - - // 调用close()关闭测距状态 - setTimeout(function () { - me.close(); - }, 50); - }; - - /** - * 测距时的键盘操作 - * @ignore - * @param {Object} e event对象 - */ - var distKeyDown = function distKeyDown(e) { - e = window.event || e; - if (e.keyCode == 27) { - // [ESC]退出本次测距 - me._clearCurData(); - setTimeout(function () { - me.close(); - }, 50); - } - }; - - /** - * 测距过程中,鼠标弹起时,触发的操作 - * @ignore - * @param {Object} e event对象 - */ - var distMouseUp = function distMouseUp(e) { - e = window.event || e; - var ieVersion = 0; - if (/msie (\d+\.\d)/i.test(navigator.userAgent)) { - ieVersion = document.documentMode || +RegExp['\x241']; - } - if (ieVersion && e.button != 1 || e.button == 2) { - me.close(); - } - }; - - // 初始化存储数据 - me._initData(); - - // 调整title的内容 - this._formatTitle(); - - // 创建透明覆盖层,并设置鼠标样式 - OperationMask.show(this._map); - this._setCursor(this._opts.cursor); - - // 绑定全部事件 - baidu.on(OperationMask.getDom(this._map), "click", distClick); - baidu.on(document, "mousemove", distMove); - baidu.on(OperationMask.getDom(this._map), "dblclick", distDblclick); - baidu.on(document, "keydown", distKeyDown); - baidu.on(OperationMask.getDom(this._map), "mouseup", distMouseUp); - - // 将绑定的事件、和对应的绑定对象,记录在数组中 - this.bindFunc = [{ elem: OperationMask.getDom(this._map), type: "click", func: distClick }, { elem: OperationMask.getDom(this._map), type: "dblclick", func: distDblclick }, { elem: document, type: "mousemove", func: distMove }, { elem: document, type: "keydown", func: distKeyDown }, { elem: OperationMask.getDom(this._map), type: "mouseup", func: distMouseUp }]; - return true; - }; - - /** - * 画线结束时,派发drawend事件 - * @return 无返回值 - */ - DistanceTool.prototype._dispatchLastEvent = function () { - /** - * 测距时,每次双击底图结束当前测距折线时,派发事件的接口 - * @name DistanceTool#ondrawend - * @event - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值: - *
    {"points : {BMap.Point} 所有测量时,打下的节点BMap.Point对象, - *
    "overlays:{Array} 所有测量时,生成的线段BMap.Overlay对象, - *
    "distance:{Number} 测量解释时的最终距离} - * - * @example 参考示例:
    - * myDistanceToolObject.addEventListener("drawend", function(e) { alert(e.distance); }); - */ - - // 生成名为ondrawend的baidu.lang.Event对象 - // 并给该event对象添加上points、overlays和distance等属性字段 - // 然后在此刻,将绑定在ondrawend上事件,全部赋予event参数,然后派发出去 - var event = new baidu.lang.Event("ondrawend"); - event.points = this._points ? this._points.slice(0) : []; - event.overlays = this._paths ? this._paths.slice(0, this._paths.length - 1) : []; - event.distance = this._getTotalDistance().toFixed(0); - this.dispatchEvent(event); - }; - - /** - * 关闭测距状态 - * @return 无返回值 - * - * @example 参考示例:
    - * myDistanceToolObject.close(); - */ - DistanceTool.prototype.close = function () { - if (this._isOpen == false) { - return; - } - this._isOpen = false; - global._toolInUse = false; - - if (this._mapMoving) { - delete this._mapMoving; - } - var me = this; - me._dispatchLastEvent(); - if (me._points.length < 2) { - // 不是有效绘制,清除所有内容 - me._clearCurData(); - } else { - me._paths[me._paths.length - 1].remove(); - me._paths[me._paths.length - 1] = null; - me._paths.length = me._paths.length - 1; - // 移除最近一次标记 - var pt = me._points[me._points.length - 1]; - if (pt.disLabel) { - pt.disLabel.remove(); - } - me._processLastOp(); - } - OperationMask.hide(); - - // 删除绑定的事件 - for (var i = 0, l = this.bindFunc.length; i < l; i++) { - baidu.un(this.bindFunc[i].elem, this.bindFunc[i].type, this.bindFunc[i].func); - } - - // 停止地图移动 - if (me._movingTimerId) { - clearInterval(me._movingTimerId); - me._movingTimerId = null; - } - - if (this._followTitle) { - this._followTitle.hide(); - } - }; - - /** - * 清除本次测距的暂存数据 - * @return 无返回值 - */ - DistanceTool.prototype._clearCurData = function () { - for (var i = 0, l = this._points.length; i < l; i++) { - if (this._points[i].disLabel) { - this._points[i].disLabel.remove(); - } - } - for (var i = 0, l = this._paths.length; i < l; i++) { - this._paths[i].remove(); - } - for (var i = 0, l = this._dots.length; i < l; i++) { - this._dots[i].remove(); - } - this._initData(); - }; - - /** - * 初始化存储数组 - * @return 无返回值 - */ - DistanceTool.prototype._initData = function () { - // 初始化point数组 - this._points.length = 0; - // 初始化path数组 - this._paths.length = 0; - // 初始化分段距离数组 - this._segDistance.length = 0; - // 初始化结点图像数组 - this._dots.length = 0; - }; - - /** - * 计算两点之间距离并存放在分段距离数组中 - * @param {Point} - * @param {Point} - * @return {Number} 两个地理点之间的距离 - */ - DistanceTool.prototype._setSegDistance = function (pt0, pt1) { - if (!pt0 || !pt1) { - return; - } - var dis = this._map.getDistance(pt0, pt1); - this._segDistance.push(dis); - return dis; - }; - - /** - * 获得总距离 - * @return {Number} 总距离 - */ - DistanceTool.prototype._getTotalDistance = function () { - var totalDis = 0; - for (var i = 0, l = this._segDistance.length; i < l; i++) { - totalDis += this._segDistance[i]; - } - return totalDis; - }; - - /** - * 将米制单位的数值换算成为目标单位下的数值 - * @type {Number} 需要转换的数值 - * @type {String} 字符串描述的目标单位, - * "metric" 表示米制单位, - * "us" 表示美国传统单位制 - * @return {Number} 转换后的数值 - */ - DistanceTool.prototype._convertUnit = function (num, unit) { - unit = unit || "metric"; - if (this._units[unit]) { - return num * this._units[unit].conv; - } - return num; - }; - - /** - * 添加测距结点 - * @param {BMap.Point} 节点 - * @return 无返回值 - */ - DistanceTool.prototype._addSecPoint = function (pt) { - var ico = this._opts.secIcon ? this._opts.secIcon : new BMap.Icon("http://api.map.baidu.com/images/mapctrls.png", new BMap.Size(11, 11), { imageOffset: new BMap.Size(-26, -313) }); - var secPt = new BMap.Marker(pt, { - icon: ico, - clickable: false, - baseZIndex: 3500000, - zIndexFixed: true, - enableMassClear: this._enableMassClear - }); - this._map.addOverlay(secPt); - this._dots.push(secPt); - }; - - /** - * 格式化距离字符串 - * @param {Number} 距离 - * @return {String} 格式化的字符串 - */ - DistanceTool.prototype._formatDisStr = function (distance) { - var u = this._opts.unit; - var unit = this._units[u].u1; - var dis = this._convertUnit(distance, u); - - if (dis > this._units[u].incon) { - dis = dis / this._units[u].incon; - unit = this._units[u].u2; - dis = dis.toFixed(1); - } else { - dis = dis.toFixed(0); - } - return dis + unit; - }; - - /** - * 设置鼠标样式 - * @param {String} cursor 鼠标样式 - * @return 没有返回值 - */ - DistanceTool.prototype._setCursor = function (cursor) { - // 由于webkit内核浏览器下,cursor设置后默认不会居中,所以需要对偏移值进行设置 - var csr = /webkit/.test(navigator.userAgent.toLowerCase()) ? "url(" + this._opts.cursor + ") 3 6, crosshair" : "url(" + this._opts.cursor + "), crosshair"; - OperationMask._setCursor(csr); - }; - - /** - * 获取鼠标样式 - * @return {String} 跟随的鼠标样式 - */ - DistanceTool.prototype._getCursor = function () { - return this._opts.cursor; - }; - - /** - * 调整分段距离样式 - * @param {BMap.Label} label 提示框的Label - * @param {String} 需要填入的文字 - * @return 没有返回值 - */ - DistanceTool.prototype._formatSegLabel = function (label, text) { - label.setStyle({ "border": "none", "padding": "0" }); - label.setContent("" + text + ""); - }; - - /** - * 处理最后一次操作,当用户双击或测距被强行退出时调用 - * @return 没有返回值 - */ - DistanceTool.prototype._processLastOp = function () { - var me = this; - // 删除上次移动临时数据 - delete me._bind.x; - delete me._bind.y; - delete me._bind.initX; - delete me._bind.initY; - // 验证路径 - if (me._paths.length > me._points.length - 1) { - var l = me._paths.length - 1; - me._paths[l].remove(); - me._paths[l] = null; - me._paths.length = l; - } - // 保存本次测距对象 - var disObj = {}; - disObj.points = me._points.slice(0); - disObj.paths = me._paths.slice(0); - disObj.dots = me._dots.slice(0); - disObj.segDis = me._segDistance.slice(0); - // 判断总距离和按钮位置 - var lstPx = me._map.pointToPixel(disObj.points[disObj.points.length - 1]); - var prePx = me._map.pointToPixel(disObj.points[disObj.points.length - 2]); - var btnOffset = [0, 0]; - var disOffset = [0, 0]; - if (lstPx.y - prePx.y >= 0) { - // 距离位于下端 - disOffset = [-5, 11]; - } else { - // 距离位于上端 - disOffset = [-5, -35]; - } - if (lstPx.x - prePx.x >= 0) { - // 按钮位于右侧 - btnOffset = [14, 0]; - } else { - // 按钮位于左侧 - btnOffset = [-14, 0]; - } - // 显示总距离 - var pt = disObj.points[disObj.points.length - 1]; - pt.disLabel = new BMap.Label("", { offset: new BMap.Size(-15, -40), enableMassClear: me._enableMassClear }); - pt.disLabel.setStyles({ color: "#333", borderColor: "#ff0103" }); - me._map.addOverlay(pt.disLabel); - pt.disLabel.setOffset(new BMap.Size(disOffset[0], disOffset[1])); - pt.disLabel.setPosition(pt); - me._formatTitle(2, "", "", pt.disLabel); - // 添加关闭按钮 - var bico = this._opts.closeIcon ? this._opts.closeIcon : new BMap.Icon("http://api.map.baidu.com/images/mapctrls.gif", new BMap.Size(12, 12), { imageOffset: new BMap.Size(0, -14) }); - disObj.closeBtn = new BMap.Marker(disObj.points[disObj.points.length - 1], { icon: bico, - offset: new BMap.Size(btnOffset[0], btnOffset[1]), - baseZIndex: 3600000, - enableMassClear: me._enableMassClear }); - me._map.addOverlay(disObj.closeBtn); - disObj.closeBtn.setTitle("清除本次测距"); - // 点击关闭按钮,绑定关闭按钮事件 - disObj.closeBtn.addEventListener("click", function (e) { - // 关闭本次测距,清除相关存储和变量 - for (var i = 0, l = disObj.points.length; i < l; i++) { - disObj.points[i].disLabel.remove(); - disObj.points[i].disLabel = null; - } - for (var i = 0, l = disObj.paths.length; i < l; i++) { - disObj.paths[i].remove(); - disObj.paths[i] = null; - } - for (var i = 0, l = disObj.dots.length; i < l; i++) { - disObj.dots[i].remove(); - disObj.dots[i] = null; - } - disObj.closeBtn.remove(); - disObj.closeBtn = null; - stopBubble(e); - - /** - * @ignore - * 测距结束后,点击线段上最后一个节点旁的关闭按钮时,派发事件的接口 - * @name DistanceTool#onremovepolyline - * @event - * @param {Event Object} e 回调函数会返回event参数 - * - * @example 参考示例:
    - * myDistanceToolObject.addEventListener("removepolyline", function(e) { alert(e.type); }); - */ - - // 生成名为onremovepolyline的baidu.lang.Event对象 - // 然后在此刻,将绑定在onremovepolyline上事件,全部赋予event参数,然后派发出去 - var event = new baidu.lang.Event("onremovepolyline"); - me.dispatchEvent(event); - }); - me._initData(); - }; - - /** - * 生成测距过程中的文字提示框 - * @param {String} type - * @param {String} text - * @param {String} distance - * @param {Label} label - * @return 无返回值 - */ - DistanceTool.prototype._formatTitle = function (type, text, distance, label) { - var title = label || this._followTitle; - if (!title) { - return; - } - title.setStyle({ "lineHeight": "16px", "zIndex": "85", "padding": "3px 5px" }); - var t = this._startFollowText || ""; - var htmls = []; - if (type == 1) { - // 测距过程中的提示 - title.setOffset(0, 25); - var u = this._opts.unit; - var unit = this._units[u].u1; - var dis = this._convertUnit(distance, u); - if (dis > this._units[u].incon) { - dis = dis / this._units[u].incon; - unit = this._units[u].u2; - dis = dis.toFixed(1); - } else { - dis = dis.toFixed(0); - } - htmls.push("总长:" + dis + "" + unit + "
    "); - htmls.push("" + text + ""); - } else if (type == 2) { - // 结束时的总距离展示 - var u = this._opts.unit; - var unit = this._units[u].u1; - var dis = this._convertUnit(this._getTotalDistance(), u); - if (dis > this._units[u].incon) { - dis = dis / this._units[u].incon; - unit = this._units[u].u2; - dis = dis.toFixed(1); - } else { - dis = dis.toFixed(0); - } - htmls.push("总长:" + dis + "" + unit); - } else { - title.setOffset(0, 25); - htmls.push(t); - } - title.setContent(htmls.join("")); - }; - - /** - * 更新label的距离 - * @param HTMLElement label的DOM元素 - * @param Number 距离 - */ - DistanceTool.prototype._updateInstDis = function (label, dis) { - // 换算距离 - var u = this._opts.unit; - var unit = this._units[u].u1; - if (dis > this._units[u].incon) { - dis = dis / this._units[u].incon; - unit = this._units[u].u2; - dis = dis.toFixed(1); - } else { - dis = dis.toFixed(0); - } - // 修改Label的内容 - if (label) { - var htmls = []; - htmls.push("总长:" + dis + "" + unit + "
    "); - htmls.push("" + this._opts.followText + ""); - label.setContent(htmls.join("")); - } - }; - - /** - * 隐藏相关的线段和提示框文字 - * @return 无返回值 - */ - DistanceTool.prototype._hideCurrent = function () { - if (!this._isOpen) { - return; - } - if (this._paths.length > 0) { - var p = this._paths[this._paths.length - 1]; - p.hide(); - } - this._followTitle && this._followTitle.hide(); - }; - - /** - * 验证传入点的位置合理性 - * @param {BMap.Point} pt 需要被验证的point点 - * @return 无返回值 - */ - DistanceTool.prototype._isPointValid = function (pt) { - if (!pt) { - return false; - } - var mapBounds = this._map.getBounds(); - var sw = mapBounds.getSouthWest(), - ne = mapBounds.getNorthEast(); - if (pt.lng < sw.lng || pt.lng > ne.lng || pt.lat < sw.lat || pt.lat > ne.lat) { - return false; - } - return true; - }; - - /** - * OperationMask,透明覆盖层,在地图上进行鼠标绘制操作时使用, - * 闭包,对外不暴露 - */ - var OperationMask = { - /** - * map对象 - * @type {Map} - */ - _map: null, - - /** - * HTML字符串 - * @type {String} - */ - _html: "
    ", - - /** - * html元素 - * @type {HTMLElement} - */ - _maskElement: null, - - /** - * 鼠标指针 - * @type {String} - */ - _cursor: 'default', - - /** - * 操作层是否在使用中 - * @type {Boolean} - */ - _inUse: false, - - /** - * 透明覆盖层的显示 - * - * @param {Map} map map对象 - * @return 无返回值 - */ - show: function show(map) { - if (!this._map) { - this._map = map; - } - this._inUse = true; - if (!this._maskElement) { - this._createMask(map); - } - this._maskElement.style.display = 'block'; - }, - - /** - * 创建覆盖层 - * - * @param {Map} map map对象 - * @return 无返回值 - */ - _createMask: function _createMask(map) { - this._map = map; - if (!this._map) { - return; - } - baidu.insertHTML(this._map.getContainer(), "beforeEnd", this._html); - var elem = this._maskElement = this._map.getContainer().lastChild; - - var stopAndPrevent = function stopAndPrevent(e) { - stopBubble(e); - return baidu.preventDefault(e); - }; - baidu.on(elem, 'mouseup', function (e) { - if (e.button == 2) { - stopAndPrevent(e); - } - }); - baidu.on(elem, 'contextmenu', stopAndPrevent); - elem.style.display = 'none'; - }, - - /** - * 获取当前绘制点的地理坐标 - * - * @param {Event} e e对象 - * @param {Boolean} n 是否向上查到相对于地图container元素的坐标位置 - * @return Point对象的位置信息 - */ - getDrawPoint: function getDrawPoint(e, n) { - e = window.event || e; - var x = e.layerX || e.offsetX || 0; - var y = e.layerY || e.offsetY || 0; - var t = e.target || e.srcElement; - if (t != OperationMask.getDom(this._map) && n == true) { - while (t && t != this._map.getContainer()) { - if (!(t.clientWidth == 0 && t.clientHeight == 0 && t.offsetParent && t.offsetParent.nodeName.toLowerCase() == 'td')) { - x += t.offsetLeft; - y += t.offsetTop; - } - t = t.offsetParent; - } - } - - if (t != OperationMask.getDom(this._map) && t != this._map.getContainer()) { - return; - } - if (typeof x === 'undefined' || typeof y === 'undefined') { - return; - } - if (isNaN(x) || isNaN(y)) { - return; - } - return this._map.pixelToPoint(new BMap.Pixel(x, y)); - }, - - /** - * 透明覆盖层的隐藏 - * - * @return 无返回值 - */ - hide: function hide() { - if (!this._map) { - return; - } - this._inUse = false; - if (this._maskElement) { - this._maskElement.style.display = 'none'; - } - }, - - /** - * 获取HTML容器 - * - * @param {Map} map map对象 - * @return HTML容器元素 - */ - getDom: function getDom(map) { - if (!this._maskElement) { - this._createMask(map); - } - return this._maskElement; - }, - - /** - * 设置鼠标样式 - * - * @type {String} cursor 鼠标样式 - * @return 无返回值 - */ - _setCursor: function _setCursor(cursor) { - this._cursor = cursor || 'default'; - if (this._maskElement) { - this._maskElement.style.cursor = this._cursor; - } - } - }; - - /** - * 停止事件冒泡传播, - * 闭包,对外不暴露 - * - * @type {Event} e e对象 - */ - function stopBubble(e) { - var e = window.event || e; - e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true; - }; - return DistanceTool; -}); \ No newline at end of file diff --git a/lib/libs/DrawingManager.js b/lib/libs/DrawingManager.js deleted file mode 100644 index 839c00e..0000000 --- a/lib/libs/DrawingManager.js +++ /dev/null @@ -1,1618 +0,0 @@ -'use strict'; - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -/** - * @fileoverview 百度地图的鼠标绘制工具,对外开放。 - * 允许用户在地图上点击完成鼠标绘制的功能。 - * 使用者可以自定义所绘制结果的相关样式,例如线宽、颜色、测线段距离、面积等等。 - * 主入口类是DrawingManager, - * 基于Baidu Map API 1.4。 - * - * @author Baidu Map Api Group - * @version 1.4 - */ -(function (root, factory) { - if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') { - module.exports = factory(); - } else if (typeof define === 'function' && define.amd) { - define(factory); - } else { - root.BMapLib = root.BMapLib || {}; - root.BMapLib.DrawingManager = root.BMapLib.DrawingManager || factory(); - } -})(undefined, function () { - /** - * 定义常量, 绘制的模式 - * @final {Number} DrawingType - */ - var BMAP_DRAWING_MARKER = "marker", - // 鼠标画点模式 - BMAP_DRAWING_POLYLINE = "polyline", - // 鼠标画线模式 - BMAP_DRAWING_CIRCLE = "circle", - // 鼠标画圆模式 - BMAP_DRAWING_RECTANGLE = "rectangle", - // 鼠标画矩形模式 - BMAP_DRAWING_POLYGON = "polygon"; // 鼠标画多边形模式 - - /** - * 声明baidu包 - */ - var baidu = baidu || { guid: "$BAIDU$" }; - (function () { - // 一些页面级别唯一的属性,需要挂载在window[baidu.guid]上 - window[baidu.guid] = {}; - - /** - * 将源对象的所有属性拷贝到目标对象中 - * @name baidu.extend - * @function - * @grammar baidu.extend(target, source) - * @param {Object} target 目标对象 - * @param {Object} source 源对象 - * @returns {Object} 目标对象 - */ - baidu.extend = function (target, source) { - for (var p in source) { - if (source.hasOwnProperty(p)) { - target[p] = source[p]; - } - } - return target; - }; - - /** - * @ignore - * @namespace - * @baidu.lang 对语言层面的封装,包括类型判断、模块扩展、继承基类以及对象自定义事件的支持。 - * @property guid 对象的唯一标识 - */ - baidu.lang = baidu.lang || {}; - - /** - * 返回一个当前页面的唯一标识字符串。 - * @function - * @grammar baidu.lang.guid() - * @returns {String} 当前页面的唯一标识字符串 - */ - baidu.lang.guid = function () { - return "TANGRAM__" + (window[baidu.guid]._counter++).toString(36); - }; - - window[baidu.guid]._counter = window[baidu.guid]._counter || 1; - - /** - * 所有类的实例的容器 - * key为每个实例的guid - */ - window[baidu.guid]._instances = window[baidu.guid]._instances || {}; - - /** - * Tangram继承机制提供的一个基类,用户可以通过继承baidu.lang.Class来获取它的属性及方法。 - * @function - * @name baidu.lang.Class - * @grammar baidu.lang.Class(guid) - * @param {string} guid 对象的唯一标识 - * @meta standard - * @remark baidu.lang.Class和它的子类的实例均包含一个全局唯一的标识guid。 - * guid是在构造函数中生成的,因此,继承自baidu.lang.Class的类应该直接或者间接调用它的构造函数。
    - * baidu.lang.Class的构造函数中产生guid的方式可以保证guid的唯一性,及每个实例都有一个全局唯一的guid。 - */ - baidu.lang.Class = function (guid) { - this.guid = guid || baidu.lang.guid(); - window[baidu.guid]._instances[this.guid] = this; - }; - - window[baidu.guid]._instances = window[baidu.guid]._instances || {}; - - /** - * 判断目标参数是否string类型或String对象 - * @name baidu.lang.isString - * @function - * @grammar baidu.lang.isString(source) - * @param {Any} source 目标参数 - * @shortcut isString - * @meta standard - * - * @returns {boolean} 类型判断结果 - */ - baidu.lang.isString = function (source) { - return '[object String]' == Object.prototype.toString.call(source); - }; - - /** - * 判断目标参数是否为function或Function实例 - * @name baidu.lang.isFunction - * @function - * @grammar baidu.lang.isFunction(source) - * @param {Any} source 目标参数 - * @returns {boolean} 类型判断结果 - */ - baidu.lang.isFunction = function (source) { - return '[object Function]' == Object.prototype.toString.call(source); - }; - - /** - * 重载了默认的toString方法,使得返回信息更加准确一些。 - * @return {string} 对象的String表示形式 - */ - baidu.lang.Class.prototype.toString = function () { - return "[object " + (this._className || "Object") + "]"; - }; - - /** - * 释放对象所持有的资源,主要是自定义事件。 - * @name dispose - * @grammar obj.dispose() - */ - baidu.lang.Class.prototype.dispose = function () { - delete window[baidu.guid]._instances[this.guid]; - for (var property in this) { - if (!baidu.lang.isFunction(this[property])) { - delete this[property]; - } - } - this.disposed = true; - }; - - /** - * 自定义的事件对象。 - * @function - * @name baidu.lang.Event - * @grammar baidu.lang.Event(type[, target]) - * @param {string} type 事件类型名称。为了方便区分事件和一个普通的方法,事件类型名称必须以"on"(小写)开头。 - * @param {Object} [target]触发事件的对象 - * @meta standard - * @remark 引入该模块,会自动为Class引入3个事件扩展方法:addEventListener、removeEventListener和dispatchEvent。 - * @see baidu.lang.Class - */ - baidu.lang.Event = function (type, target) { - this.type = type; - this.returnValue = true; - this.target = target || null; - this.currentTarget = null; - }; - - /** - * 注册对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.addEventListener(type, handler[, key]) - * @param {string} type 自定义事件的名称 - * @param {Function} handler 自定义事件被触发时应该调用的回调函数 - * @param {string} [key] 为事件监听函数指定的名称,可在移除时使用。如果不提供,方法会默认为它生成一个全局唯一的key。 - * @remark 事件类型区分大小写。如果自定义事件名称不是以小写"on"开头,该方法会给它加上"on"再进行判断,即"click"和"onclick"会被认为是同一种事件。 - */ - baidu.lang.Class.prototype.addEventListener = function (type, handler, key) { - if (!baidu.lang.isFunction(handler)) { - return; - } - !this.__listeners && (this.__listeners = {}); - var t = this.__listeners, - id; - if (typeof key == "string" && key) { - if (/[^\w\-]/.test(key)) { - throw "nonstandard key:" + key; - } else { - handler.hashCode = key; - id = key; - } - } - type.indexOf("on") != 0 && (type = "on" + type); - _typeof(t[type]) != "object" && (t[type] = {}); - id = id || baidu.lang.guid(); - handler.hashCode = id; - t[type][id] = handler; - }; - - /** - * 移除对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.removeEventListener(type, handler) - * @param {string} type 事件类型 - * @param {Function|string} handler 要移除的事件监听函数或者监听函数的key - * @remark 如果第二个参数handler没有被绑定到对应的自定义事件中,什么也不做。 - */ - baidu.lang.Class.prototype.removeEventListener = function (type, handler) { - if (baidu.lang.isFunction(handler)) { - handler = handler.hashCode; - } else if (!baidu.lang.isString(handler)) { - return; - } - !this.__listeners && (this.__listeners = {}); - type.indexOf("on") != 0 && (type = "on" + type); - var t = this.__listeners; - if (!t[type]) { - return; - } - t[type][handler] && delete t[type][handler]; - }; - - /** - * 派发自定义事件,使得绑定到自定义事件上面的函数都会被执行。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.dispatchEvent(event, options) - * @param {baidu.lang.Event|String} event Event对象,或事件名称(1.1.1起支持) - * @param {Object} options 扩展参数,所含属性键值会扩展到Event对象上(1.2起支持) - * @remark 处理会调用通过addEventListenr绑定的自定义事件回调函数之外,还会调用直接绑定到对象上面的自定义事件。 - * 例如:
    - * myobj.onMyEvent = function(){}
    - * myobj.addEventListener("onMyEvent", function(){}); - */ - baidu.lang.Class.prototype.dispatchEvent = function (event, options) { - if (baidu.lang.isString(event)) { - event = new baidu.lang.Event(event); - } - !this.__listeners && (this.__listeners = {}); - options = options || {}; - for (var i in options) { - event[i] = options[i]; - } - var i, - t = this.__listeners, - p = event.type; - p.indexOf("on") != 0 && (p = "on" + p); - baidu.lang.isFunction(this[p]) && this[p].apply(this, arguments); - if (_typeof(t[p]) == "object") { - for (i in t[p]) { - t[p][i].apply(this, arguments); - } - } - return event.returnValue; - }; - - /** - * 为类型构造器建立继承关系 - * @name baidu.lang.inherits - * @function - * @grammar baidu.lang.inherits(subClass, superClass[, className]) - * @param {Function} subClass 子类构造器 - * @param {Function} superClass 父类构造器 - * @param {string} className 类名标识 - * @remark 使subClass继承superClass的prototype, - * 因此subClass的实例能够使用superClass的prototype中定义的所有属性和方法。
    - * 这个函数实际上是建立了subClass和superClass的原型链集成,并对subClass进行了constructor修正。
    - * 注意:如果要继承构造函数,需要在subClass里面call一下,具体见下面的demo例子 - * @shortcut inherits - * @meta standard - * @see baidu.lang.Class - */ - baidu.lang.inherits = function (subClass, superClass, className) { - var key, - proto, - selfProps = subClass.prototype, - clazz = new Function(); - clazz.prototype = superClass.prototype; - proto = subClass.prototype = new clazz(); - for (key in selfProps) { - proto[key] = selfProps[key]; - } - subClass.prototype.constructor = subClass; - subClass.superClass = superClass.prototype; - - if ("string" == typeof className) { - proto._className = className; - } - }; - - /** - * @ignore - * @namespace baidu.dom 操作dom的方法。 - */ - baidu.dom = baidu.dom || {}; - - /** - * 从文档中获取指定的DOM元素 - * - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @meta standard - * @return {HTMLElement} DOM元素,如果不存在,返回null,如果参数不合法,直接返回参数 - */ - baidu._g = baidu.dom._g = function (id) { - if (baidu.lang.isString(id)) { - return document.getElementById(id); - } - return id; - }; - - /** - * 从文档中获取指定的DOM元素 - * @name baidu.dom.g - * @function - * @grammar baidu.dom.g(id) - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @meta standard - * - * @returns {HTMLElement|null} 获取的元素,查找不到时返回null,如果参数不合法,直接返回参数 - */ - baidu.g = baidu.dom.g = function (id) { - if ('string' == typeof id || id instanceof String) { - return document.getElementById(id); - } else if (id && id.nodeName && (id.nodeType == 1 || id.nodeType == 9)) { - return id; - } - return null; - }; - - /** - * 在目标元素的指定位置插入HTML代码 - * @name baidu.dom.insertHTML - * @function - * @grammar baidu.dom.insertHTML(element, position, html) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} position 插入html的位置信息,取值为beforeBegin,afterBegin,beforeEnd,afterEnd - * @param {string} html 要插入的html - * @remark - * - * 对于position参数,大小写不敏感
    - * 参数的意思:beforeBegin<span>afterBegin this is span! beforeEnd</span> afterEnd
    - * 此外,如果使用本函数插入带有script标签的HTML字符串,script标签对应的脚本将不会被执行。 - * - * @shortcut insertHTML - * @meta standard - * - * @returns {HTMLElement} 目标元素 - */ - baidu.insertHTML = baidu.dom.insertHTML = function (element, position, html) { - element = baidu.dom.g(element); - var range, begin; - - if (element.insertAdjacentHTML) { - element.insertAdjacentHTML(position, html); - } else { - // 这里不做"undefined" != typeof(HTMLElement) && !window.opera判断,其它浏览器将出错?! - // 但是其实做了判断,其它浏览器下等于这个函数就不能执行了 - range = element.ownerDocument.createRange(); - // FF下range的位置设置错误可能导致创建出来的fragment在插入dom树之后html结构乱掉 - // 改用range.insertNode来插入html, by wenyuxiang @ 2010-12-14. - position = position.toUpperCase(); - if (position == 'AFTERBEGIN' || position == 'BEFOREEND') { - range.selectNodeContents(element); - range.collapse(position == 'AFTERBEGIN'); - } else { - begin = position == 'BEFOREBEGIN'; - range[begin ? 'setStartBefore' : 'setEndAfter'](element); - range.collapse(begin); - } - range.insertNode(range.createContextualFragment(html)); - } - return element; - }; - - /** - * 为目标元素添加className - * @name baidu.dom.addClass - * @function - * @grammar baidu.dom.addClass(element, className) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} className 要添加的className,允许同时添加多个class,中间使用空白符分隔 - * @remark - * 使用者应保证提供的className合法性,不应包含不合法字符,className合法字符参考:http://www.w3.org/TR/CSS2/syndata.html。 - * @shortcut addClass - * @meta standard - * - * @returns {HTMLElement} 目标元素 - */ - baidu.ac = baidu.dom.addClass = function (element, className) { - element = baidu.dom.g(element); - var classArray = className.split(/\s+/), - result = element.className, - classMatch = " " + result + " ", - i = 0, - l = classArray.length; - - for (; i < l; i++) { - if (classMatch.indexOf(" " + classArray[i] + " ") < 0) { - result += (result ? ' ' : '') + classArray[i]; - } - } - - element.className = result; - return element; - }; - - /** - * @ignore - * @namespace baidu.event 屏蔽浏览器差异性的事件封装。 - * @property target 事件的触发元素 - * @property pageX 鼠标事件的鼠标x坐标 - * @property pageY 鼠标事件的鼠标y坐标 - * @property keyCode 键盘事件的键值 - */ - baidu.event = baidu.event || {}; - - /** - * 事件监听器的存储表 - * @private - * @meta standard - */ - baidu.event._listeners = baidu.event._listeners || []; - - /** - * 为目标元素添加事件监听器 - * @name baidu.event.on - * @function - * @grammar baidu.event.on(element, type, listener) - * @param {HTMLElement|string|window} element 目标元素或目标元素id - * @param {string} type 事件类型 - * @param {Function} listener 需要添加的监听器 - * @remark - * 1. 不支持跨浏览器的鼠标滚轮事件监听器添加
    - * 2. 改方法不为监听器灌入事件对象,以防止跨iframe事件挂载的事件对象获取失败 - * @shortcut on - * @meta standard - * @see baidu.event.un - * - * @returns {HTMLElement|window} 目标元素 - */ - baidu.on = baidu.event.on = function (element, type, listener) { - type = type.replace(/^on/i, ''); - element = baidu._g(element); - var realListener = function realListener(ev) { - // 1. 这里不支持EventArgument, 原因是跨frame的事件挂载 - // 2. element是为了修正this - listener.call(element, ev); - }, - lis = baidu.event._listeners, - filter = baidu.event._eventFilter, - afterFilter, - realType = type; - type = type.toLowerCase(); - // filter过滤 - if (filter && filter[type]) { - afterFilter = filter[type](element, type, realListener); - realType = afterFilter.type; - realListener = afterFilter.listener; - } - // 事件监听器挂载 - if (element.addEventListener) { - element.addEventListener(realType, realListener, false); - } else if (element.attachEvent) { - element.attachEvent('on' + realType, realListener); - } - - // 将监听器存储到数组中 - lis[lis.length] = [element, type, listener, realListener, realType]; - return element; - }; - - /** - * 为目标元素移除事件监听器 - * @name baidu.event.un - * @function - * @grammar baidu.event.un(element, type, listener) - * @param {HTMLElement|string|window} element 目标元素或目标元素id - * @param {string} type 事件类型 - * @param {Function} listener 需要移除的监听器 - * @shortcut un - * @meta standard - * - * @returns {HTMLElement|window} 目标元素 - */ - baidu.un = baidu.event.un = function (element, type, listener) { - element = baidu._g(element); - type = type.replace(/^on/i, '').toLowerCase(); - - var lis = baidu.event._listeners, - len = lis.length, - isRemoveAll = !listener, - item, - realType, - realListener; - - //如果将listener的结构改成json - //可以节省掉这个循环,优化性能 - //但是由于un的使用频率并不高,同时在listener不多的时候 - //遍历数组的性能消耗不会对代码产生影响 - //暂不考虑此优化 - while (len--) { - item = lis[len]; - - // listener存在时,移除element的所有以listener监听的type类型事件 - // listener不存在时,移除element的所有type类型事件 - if (item[1] === type && item[0] === element && (isRemoveAll || item[2] === listener)) { - realType = item[4]; - realListener = item[3]; - if (element.removeEventListener) { - element.removeEventListener(realType, realListener, false); - } else if (element.detachEvent) { - element.detachEvent('on' + realType, realListener); - } - lis.splice(len, 1); - } - } - return element; - }; - - /** - * 获取event事件,解决不同浏览器兼容问题 - * @param {Event} - * @return {Event} - */ - baidu.getEvent = baidu.event.getEvent = function (event) { - return window.event || event; - }; - - /** - * 获取event.target,解决不同浏览器兼容问题 - * @param {Event} - * @return {Target} - */ - baidu.getTarget = baidu.event.getTarget = function (event) { - var event = baidu.getEvent(event); - return event.target || event.srcElement; - }; - - /** - * 阻止事件的默认行为 - * @name baidu.event.preventDefault - * @function - * @grammar baidu.event.preventDefault(event) - * @param {Event} event 事件对象 - * @meta standard - */ - baidu.preventDefault = baidu.event.preventDefault = function (event) { - var event = baidu.getEvent(event); - if (event.preventDefault) { - event.preventDefault(); - } else { - event.returnValue = false; - } - }; - - /** - * 停止事件冒泡传播 - * @param {Event} - */ - baidu.stopBubble = baidu.event.stopBubble = function (event) { - event = baidu.getEvent(event); - event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true; - }; - - baidu.browser = baidu.browser || {}; - - if (/msie (\d+\.\d)/i.test(navigator.userAgent)) { - //IE 8下,以documentMode为准 - //在百度模板中,可能会有$,防止冲突,将$1 写成 \x241 - /** - * 判断是否为ie浏览器 - * @property ie ie版本号 - * @grammar baidu.browser.ie - * @meta standard - * @shortcut ie - * @see baidu.browser.firefox,baidu.browser.safari,baidu.browser.opera,baidu.browser.chrome,baidu.browser.maxthon - */ - baidu.browser.ie = baidu.ie = document.documentMode || +RegExp['\x241']; - } - })(); - - /** - * @exports DrawingManager as BMapLib.DrawingManager - */ - var DrawingManager = - /** - * DrawingManager类的构造函数 - * @class 鼠标绘制管理类,实现鼠标绘制管理的入口。 - * 实例化该类后,即可调用该类提供的open - * 方法开启绘制模式状态。 - * 也可加入工具栏进行选择操作。 - * - * @constructor - * @param {Map} map Baidu map的实例对象 - * @param {Json Object} opts 可选的输入参数,非必填项。可输入选项包括:
    - * {"isOpen" : {Boolean} 是否开启绘制模式 - *
    "enableDrawingTool" : {Boolean} 是否添加绘制工具栏控件,默认不添加 - *
    "drawingToolOptions" : {Json Object} 可选的输入参数,非必填项。可输入选项包括 - *
          "anchor" : {ControlAnchor} 停靠位置、默认左上角 - *
          "offset" : {Size} 偏移值。 - *
          "scale" : {Number} 工具栏的缩放比例,默认为1 - *
          "drawingModes" : {DrawingType} 工具栏上可以选择出现的绘制模式,将需要显示的DrawingType以数组型形式传入,如[BMAP_DRAWING_MARKER, BMAP_DRAWING_CIRCLE] 将只显示画点和画圆的选项 - *
    "enableCalculate" : {Boolean} 绘制是否进行测距(画线时候)、测面(画圆、多边形、矩形) - *
    "markerOptions" : {CircleOptions} 所画的点的可选参数,参考api中的对应类 - *
    "circleOptions" : {CircleOptions} 所画的圆的可选参数,参考api中的对应类 - *
    "polylineOptions" : {CircleOptions} 所画的线的可选参数,参考api中的对应类 - *
    "polygonOptions" : {PolygonOptions} 所画的多边形的可选参数,参考api中的对应类 - *
    "rectangleOptions" : {PolygonOptions} 所画的矩形的可选参数,参考api中的对应类 - * - * @example 参考示例:
    - * var map = new BMap.Map("container");
    map.centerAndZoom(new BMap.Point(116.404, 39.915), 15);
    - * var myDrawingManagerObject = new BMapLib.DrawingManager(map, {isOpen: true, - * drawingType: BMAP_DRAWING_MARKER, enableDrawingTool: true, - * enableCalculate: false, - * drawingToolOptions: { - * anchor: BMAP_ANCHOR_TOP_LEFT, - * offset: new BMap.Size(5, 5), - * drawingTypes : [ - * BMAP_DRAWING_MARKER, - * BMAP_DRAWING_CIRCLE, - * BMAP_DRAWING_POLYLINE, - * BMAP_DRAWING_POLYGON, - * BMAP_DRAWING_RECTANGLE - * ] - * }, - * polylineOptions: { - * strokeColor: "#333" - * }); - */ - function DrawingManager(map, opts) { - if (!map) { - return; - } - instances.push(this); - - opts = opts || {}; - - this._initialize(map, opts); - }; - - // 通过baidu.lang下的inherits方法,让DrawingManager继承baidu.lang.Class - baidu.lang.inherits(DrawingManager, baidu.lang.Class, "DrawingManager"); - - /** - * 开启地图的绘制模式 - * - * @example 参考示例:
    - * myDrawingManagerObject.open(); - */ - DrawingManager.prototype.open = function () { - // 判断绘制状态是否已经开启 - if (this._isOpen == true) { - return true; - } - closeInstanceExcept(this); - - this._open(); - }; - - /** - * 关闭地图的绘制状态 - * - * @example 参考示例:
    - * myDrawingManagerObject.close(); - */ - DrawingManager.prototype.close = function () { - - // 判断绘制状态是否已经开启 - if (this._isOpen == false) { - return true; - } - var me = this; - this._close(); - setTimeout(function () { - me._map.enableDoubleClickZoom(); - }, 2000); - }; - - /** - * 设置当前的绘制模式,参数DrawingType,为5个可选常量: - *
    BMAP_DRAWING_MARKER 画点 - *
    BMAP_DRAWING_CIRCLE 画圆 - *
    BMAP_DRAWING_POLYLINE 画线 - *
    BMAP_DRAWING_POLYGON 画多边形 - *
    BMAP_DRAWING_RECTANGLE 画矩形 - * @param {DrawingType} DrawingType - * @return {Boolean} - * - * @example 参考示例:
    - * myDrawingManagerObject.setDrawingMode(BMAP_DRAWING_POLYLINE); - */ - DrawingManager.prototype.setDrawingMode = function (drawingType) { - //与当前模式不一样时候才进行重新绑定事件 - if (this._drawingType != drawingType) { - closeInstanceExcept(this); - this._setDrawingMode(drawingType); - } - }; - - /** - * 获取当前的绘制模式 - * @return {DrawingType} 绘制的模式 - * - * @example 参考示例:
    - * alert(myDrawingManagerObject.getDrawingMode()); - */ - DrawingManager.prototype.getDrawingMode = function () { - return this._drawingType; - }; - - /** - * 打开距离或面积计算 - * - * @example 参考示例:
    - * myDrawingManagerObject.enableCalculate(); - */ - DrawingManager.prototype.enableCalculate = function () { - this._enableCalculate = true; - this._addGeoUtilsLibrary(); - }; - - /** - * 关闭距离或面积计算 - * - * @example 参考示例:
    - * myDrawingManagerObject.disableCalculate(); - */ - DrawingManager.prototype.disableCalculate = function () { - this._enableCalculate = false; - }; - - /** - * 鼠标绘制完成后,派发总事件的接口 - * @name DrawingManager#overlaycomplete - * @event - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值: - *
    {"drawingMode : {DrawingType} 当前的绘制模式 - *
    "overlay:{Marker||Polyline||Polygon||Circle} 对应的绘制模式返回对应的覆盖物 - *
    "calculate:{Number} 需要开启计算模式才会返回这个值,当绘制线的时候返回距离、绘制多边形、圆、矩形时候返回面积,单位为米, - *
    "label:{Label} 计算面积时候出现在Map上的Label对象 - * - * @example 参考示例: - * myDrawingManagerObject.addEventListener("overlaycomplete", function(e) { - * alert(e.drawingMode); - * alert(e.overlay); - * alert(e.calculate); - * alert(e.label); - * }); - */ - - /** - * 绘制点完成后,派发的事件接口 - * @name DrawingManager#markercomplete - * @event - * @param {Marker} overlay 回调函数会返回相应的覆盖物, - *
    {"overlay : {Marker} - * - * @example 参考示例: - * myDrawingManagerObject.addEventListener("circlecomplete", function(e, overlay) { - * alert(overlay); - * }); - */ - - /** - * 绘制圆完成后,派发的事件接口 - * @name DrawingManager#circlecomplete - * @event - * @param {Circle} overlay 回调函数会返回相应的覆盖物, - *
    {"overlay : {Circle} - */ - - /** - * 绘制线完成后,派发的事件接口 - * @name DrawingManager#polylinecomplete - * @event - * @param {Polyline} overlay 回调函数会返回相应的覆盖物, - *
    {"overlay : {Polyline} - */ - - /** - * 绘制多边形完成后,派发的事件接口 - * @name DrawingManager#polygoncomplete - * @event - * @param {Polygon} overlay 回调函数会返回相应的覆盖物, - *
    {"overlay : {Polygon} - */ - - /** - * 绘制矩形完成后,派发的事件接口 - * @name DrawingManager#rectanglecomplete - * @event - * @param {Polygon} overlay 回调函数会返回相应的覆盖物, - *
    {"overlay : {Polygon} - */ - - /** - * 初始化状态 - * @param {Map} 地图实例 - * @param {Object} 参数 - */ - DrawingManager.prototype._initialize = function (map, opts) { - - /** - * map对象 - * @private - * @type {Map} - */ - this._map = map; - - /** - * 配置对象 - * @private - * @type {Object} - */ - this._opts = opts; - - /** - * 当前的绘制模式, 默认是绘制点 - * @private - * @type {DrawingType} - */ - this._drawingType = opts.drawingMode || BMAP_DRAWING_MARKER; - - /** - * 是否添加添加鼠标绘制工具栏面板 - */ - if (opts.enableDrawingTool) { - var drawingTool = new DrawingTool(this, opts.drawingToolOptions); - this._drawingTool = drawingTool; - map.addControl(drawingTool); - } - - //是否计算绘制出的面积 - if (opts.enableCalculate === true) { - this.enableCalculate(); - } else { - this.disableCalculate(); - } - - /** - * 是否已经开启了绘制状态 - * @private - * @type {Boolean} - */ - this._isOpen = !!(opts.isOpen === true); - if (this._isOpen) { - this._open(); - } - - this.markerOptions = opts.markerOptions || {}; - this.circleOptions = opts.circleOptions || {}; - this.polylineOptions = opts.polylineOptions || {}; - this.polygonOptions = opts.polygonOptions || {}; - this.rectangleOptions = opts.rectangleOptions || {}; - this.controlButton = opts.controlButton == "right" ? "right" : "left"; - }, - - /** - * 开启地图的绘制状态 - * @return {Boolean},开启绘制状态成功,返回true;否则返回false。 - */ - DrawingManager.prototype._open = function () { - - this._isOpen = true; - - //添加遮罩,所有鼠标操作都在这个遮罩上完成 - if (!this._mask) { - this._mask = new Mask(); - } - this._map.addOverlay(this._mask); - this._setDrawingMode(this._drawingType); - }; - - /** - * 设置当前的绘制模式 - * @param {DrawingType} - */ - DrawingManager.prototype._setDrawingMode = function (drawingType) { - - this._drawingType = drawingType; - - /** - * 开启编辑状态时候才重新进行事件绑定 - */ - if (this._isOpen) { - - //清空之前的自定义事件 - this._mask.__listeners = {}; - - switch (drawingType) { - case BMAP_DRAWING_MARKER: - this._bindMarker(); - break; - case BMAP_DRAWING_CIRCLE: - this._bindCircle(); - break; - case BMAP_DRAWING_POLYLINE: - case BMAP_DRAWING_POLYGON: - this._bindPolylineOrPolygon(); - break; - case BMAP_DRAWING_RECTANGLE: - this._bindRectangle(); - break; - } - } - - /** - * 如果添加了工具栏,则也需要改变工具栏的样式 - */ - if (this._drawingTool && this._isOpen) { - this._drawingTool.setStyleByDrawingMode(drawingType); - } - }; - - /** - * 关闭地图的绘制状态 - * @return {Boolean},关闭绘制状态成功,返回true;否则返回false。 - */ - DrawingManager.prototype._close = function () { - - this._isOpen = false; - - if (this._mask) { - this._map.removeOverlay(this._mask); - } - - /** - * 如果添加了工具栏,则关闭时候将工具栏样式设置为拖拽地图 - */ - if (this._drawingTool) { - this._drawingTool.setStyleByDrawingMode("hander"); - } - }; - - /** - * 绑定鼠标画点的事件 - */ - DrawingManager.prototype._bindMarker = function () { - - var me = this, - map = this._map, - mask = this._mask; - - /** - * 鼠标点击的事件 - */ - var clickAction = function clickAction(e) { - // 往地图上添加marker - var marker = new BMap.Marker(e.point, me.markerOptions); - map.addOverlay(marker); - me._dispatchOverlayComplete(marker); - }; - - mask.addEventListener('click', clickAction); - }; - - /** - * 绑定鼠标画圆的事件 - */ - DrawingManager.prototype._bindCircle = function () { - - var me = this, - map = this._map, - mask = this._mask, - circle = null, - centerPoint = null; //圆的中心点 - - /** - * 开始绘制圆形 - */ - var startAction = function startAction(e) { - if (me.controlButton == "right" && (e.button == 1 || e.button == 0)) { - return; - } - centerPoint = e.point; - circle = new BMap.Circle(centerPoint, 0, me.circleOptions); - map.addOverlay(circle); - mask.enableEdgeMove(); - mask.addEventListener('mousemove', moveAction); - baidu.on(document, 'mouseup', endAction); - }; - - /** - * 绘制圆形过程中,鼠标移动过程的事件 - */ - var moveAction = function moveAction(e) { - circle.setRadius(me._map.getDistance(centerPoint, e.point)); - }; - - /** - * 绘制圆形结束 - */ - var endAction = function endAction(e) { - var calculate = me._calculate(circle, e.point); - me._dispatchOverlayComplete(circle, calculate); - centerPoint = null; - mask.disableEdgeMove(); - mask.removeEventListener('mousemove', moveAction); - baidu.un(document, 'mouseup', endAction); - }; - - /** - * 鼠标点击起始点 - */ - var mousedownAction = function mousedownAction(e) { - baidu.preventDefault(e); - baidu.stopBubble(e); - if (me.controlButton == "right" && e.button == 1) { - return; - } - if (centerPoint == null) { - startAction(e); - } - }; - - mask.addEventListener('mousedown', mousedownAction); - }; - - /** - * 画线和画多边形相似性比较大,公用一个方法 - */ - DrawingManager.prototype._bindPolylineOrPolygon = function () { - - var me = this, - map = this._map, - mask = this._mask, - points = [], - //用户绘制的点 - drawPoint = null, - //实际需要画在地图上的点 - overlay = null, - isBinded = false; - - /** - * 鼠标点击的事件 - */ - var startAction = function startAction(e) { - if (me.controlButton == "right" && (e.button == 1 || e.button == 0)) { - return; - } - points.push(e.point); - drawPoint = points.concat(points[points.length - 1]); - if (points.length == 1) { - if (me._drawingType == BMAP_DRAWING_POLYLINE) { - - overlay = new BMap.Polyline(drawPoint, me.polylineOptions); - } else if (me._drawingType == BMAP_DRAWING_POLYGON) { - overlay = new BMap.Polygon(drawPoint, me.polygonOptions); - } - map.addOverlay(overlay); - } else { - overlay.setPath(drawPoint); - } - if (!isBinded) { - isBinded = true; - mask.enableEdgeMove(); - mask.addEventListener('mousemove', mousemoveAction); - mask.addEventListener('dblclick', dblclickAction); - } - }; - - /** - * 鼠标移动过程的事件 - */ - var mousemoveAction = function mousemoveAction(e) { - overlay.setPositionAt(drawPoint.length - 1, e.point); - }; - - /** - * 鼠标双击的事件 - */ - var dblclickAction = function dblclickAction(e) { - baidu.stopBubble(e); - isBinded = false; - mask.disableEdgeMove(); - mask.removeEventListener('mousedown', startAction); - mask.removeEventListener('mousemove', mousemoveAction); - mask.removeEventListener('dblclick', dblclickAction); - //console.log(me.controlButton); - if (me.controlButton == "right") { - points.push(e.point); - } else if (baidu.ie <= 8) {} else { - points.pop(); - } - //console.log(points.length); - overlay.setPath(points); - var calculate = me._calculate(overlay, points.pop()); - me._dispatchOverlayComplete(overlay, calculate); - points.length = 0; - drawPoint.length = 0; - me.close(); - }; - - mask.addEventListener('mousedown', startAction); - - //双击时候不放大地图级别 - mask.addEventListener('dblclick', function (e) { - baidu.stopBubble(e); - }); - }; - - /** - * 绑定鼠标画矩形的事件 - */ - DrawingManager.prototype._bindRectangle = function () { - - var me = this, - map = this._map, - mask = this._mask, - polygon = null, - startPoint = null; - - /** - * 开始绘制矩形 - */ - var startAction = function startAction(e) { - baidu.stopBubble(e); - baidu.preventDefault(e); - if (me.controlButton == "right" && (e.button == 1 || e.button == 0)) { - return; - } - startPoint = e.point; - var endPoint = startPoint; - polygon = new BMap.Polygon(me._getRectanglePoint(startPoint, endPoint), me.rectangleOptions); - map.addOverlay(polygon); - mask.enableEdgeMove(); - mask.addEventListener('mousemove', moveAction); - baidu.on(document, 'mouseup', endAction); - }; - - /** - * 绘制矩形过程中,鼠标移动过程的事件 - */ - var moveAction = function moveAction(e) { - polygon.setPath(me._getRectanglePoint(startPoint, e.point)); - }; - - /** - * 绘制矩形结束 - */ - var endAction = function endAction(e) { - var calculate = me._calculate(polygon, polygon.getPath()[2]); - me._dispatchOverlayComplete(polygon, calculate); - startPoint = null; - mask.disableEdgeMove(); - mask.removeEventListener('mousemove', moveAction); - baidu.un(document, 'mouseup', endAction); - }; - - mask.addEventListener('mousedown', startAction); - }; - - /** - * 添加显示所绘制图形的面积或者长度 - * @param {overlay} 覆盖物 - * @param {point} 显示的位置 - */ - DrawingManager.prototype._calculate = function (overlay, point) { - var result = { - data: 0, //计算出来的长度或面积 - label: null //显示长度或面积的label对象 - }; - if (this._enableCalculate && BMapLib.GeoUtils) { - var type = overlay.toString(); - //不同覆盖物调用不同的计算方法 - switch (type) { - case "[object Polyline]": - result.data = BMapLib.GeoUtils.getPolylineDistance(overlay); - break; - case "[object Polygon]": - result.data = BMapLib.GeoUtils.getPolygonArea(overlay); - break; - case "[object Circle]": - var radius = overlay.getRadius(); - result.data = Math.PI * radius * radius; - break; - } - //一场情况处理 - if (!result.data || result.data < 0) { - result.data = 0; - } else { - //保留2位小数位 - result.data = result.data.toFixed(2); - } - result.label = this._addLabel(point, result.data); - } - return result; - }; - - /** - * 开启测距和测面功能需要依赖于GeoUtils库 - * 所以这里判断用户是否已经加载,若未加载则用js动态加载 - */ - DrawingManager.prototype._addGeoUtilsLibrary = function () { - if (!BMapLib.GeoUtils) { - var script = document.createElement('script'); - script.setAttribute("type", "text/javascript"); - script.setAttribute("src", 'http://api.map.baidu.com/library/GeoUtils/1.2/src/GeoUtils_min.js'); - document.body.appendChild(script); - } - }; - - /** - * 向地图中添加文本标注 - * @param {Point} - * @param {String} 所以显示的内容 - */ - DrawingManager.prototype._addLabel = function (point, content) { - var label = new BMap.Label(content, { - position: point - }); - this._map.addOverlay(label); - return label; - }; - - /** - * 根据起终点获取矩形的四个顶点 - * @param {Point} 起点 - * @param {Point} 终点 - */ - DrawingManager.prototype._getRectanglePoint = function (startPoint, endPoint) { - return [new BMap.Point(startPoint.lng, startPoint.lat), new BMap.Point(endPoint.lng, startPoint.lat), new BMap.Point(endPoint.lng, endPoint.lat), new BMap.Point(startPoint.lng, endPoint.lat)]; - }; - - /** - * 派发事件 - */ - DrawingManager.prototype._dispatchOverlayComplete = function (overlay, calculate) { - var options = { - 'overlay': overlay, - 'drawingMode': this._drawingType - }; - if (calculate) { - options.calculate = calculate.data || null; - options.label = calculate.label || null; - } - this.dispatchEvent(this._drawingType + 'complete', overlay); - this.dispatchEvent('overlaycomplete', options); - }; - - /** - * 创建遮罩对象 - */ - function Mask() { - /** - * 鼠标到地图边缘的时候是否自动平移地图 - */ - this._enableEdgeMove = false; - } - - Mask.prototype = new BMap.Overlay(); - - /** - * 这里不使用api中的自定义事件,是为了更灵活使用 - */ - Mask.prototype.dispatchEvent = baidu.lang.Class.prototype.dispatchEvent; - Mask.prototype.addEventListener = baidu.lang.Class.prototype.addEventListener; - Mask.prototype.removeEventListener = baidu.lang.Class.prototype.removeEventListener; - - Mask.prototype.initialize = function (map) { - var me = this; - this._map = map; - var div = this.container = document.createElement("div"); - var size = this._map.getSize(); - div.style.cssText = "position:absolute;background:url(about:blank);cursor:crosshair;width:" + size.width + "px;height:" + size.height + "px"; - this._map.addEventListener('resize', function (e) { - me._adjustSize(e.size); - }); - this._map.getPanes().floatPane.appendChild(div); - this._bind(); - return div; - }; - - Mask.prototype.draw = function () { - var map = this._map, - point = map.pixelToPoint(new BMap.Pixel(0, 0)), - pixel = map.pointToOverlayPixel(point); - this.container.style.left = pixel.x + "px"; - this.container.style.top = pixel.y + "px"; - }; - - /** - * 开启鼠标到地图边缘,自动平移地图 - */ - Mask.prototype.enableEdgeMove = function () { - this._enableEdgeMove = true; - }; - - /** - * 关闭鼠标到地图边缘,自动平移地图 - */ - Mask.prototype.disableEdgeMove = function () { - clearInterval(this._edgeMoveTimer); - this._enableEdgeMove = false; - }; - - /** - * 绑定事件,派发自定义事件 - */ - Mask.prototype._bind = function () { - - var me = this, - map = this._map, - container = this.container, - lastMousedownXY = null, - lastClickXY = null; - - /** - * 根据event对象获取鼠标的xy坐标对象 - * @param {Event} - * @return {Object} {x:e.x, y:e.y} - */ - var getXYbyEvent = function getXYbyEvent(e) { - return { - x: e.clientX, - y: e.clientY - }; - }; - - var domEvent = function domEvent(e) { - var type = e.type, - e = baidu.getEvent(e), - point = me.getDrawPoint(e); //当前鼠标所在点的地理坐标 - - var dispatchEvent = function dispatchEvent(type) { - e.point = point; - me.dispatchEvent(e); - }; - - if (type == "mousedown") { - lastMousedownXY = getXYbyEvent(e); - } - - var nowXY = getXYbyEvent(e); - //click经过一些特殊处理派发,其他同事件按正常的dom事件派发 - if (type == "click") { - //鼠标点击过程不进行移动才派发click和dblclick - if (Math.abs(nowXY.x - lastMousedownXY.x) < 5 && Math.abs(nowXY.y - lastMousedownXY.y) < 5) { - if (!lastClickXY || !(Math.abs(nowXY.x - lastClickXY.x) < 5 && Math.abs(nowXY.y - lastClickXY.y) < 5)) { - dispatchEvent('click'); - lastClickXY = getXYbyEvent(e); - } else { - lastClickXY = null; - } - } - } else { - dispatchEvent(type); - } - }; - - /** - * 将事件都遮罩层的事件都绑定到domEvent来处理 - */ - var events = ['click', 'mousedown', 'mousemove', 'mouseup', 'dblclick'], - index = events.length; - while (index--) { - baidu.on(container, events[index], domEvent); - } - - //鼠标移动过程中,到地图边缘后自动平移地图 - baidu.on(container, 'mousemove', function (e) { - if (me._enableEdgeMove) { - me.mousemoveAction(e); - } - }); - }; - - //鼠标移动过程中,到地图边缘后自动平移地图 - Mask.prototype.mousemoveAction = function (e) { - function getClientPosition(e) { - var clientX = e.clientX, - clientY = e.clientY; - if (e.changedTouches) { - clientX = e.changedTouches[0].clientX; - clientY = e.changedTouches[0].clientY; - } - return new BMap.Pixel(clientX, clientY); - } - - var map = this._map, - me = this, - pixel = map.pointToPixel(this.getDrawPoint(e)), - clientPos = getClientPosition(e), - offsetX = clientPos.x - pixel.x, - offsetY = clientPos.y - pixel.y; - pixel = new BMap.Pixel(clientPos.x - offsetX, clientPos.y - offsetY); - this._draggingMovePixel = pixel; - var point = map.pixelToPoint(pixel), - eventObj = { - pixel: pixel, - point: point - }; - // 拖拽到地图边缘移动地图 - this._panByX = this._panByY = 0; - if (pixel.x <= 20 || pixel.x >= map.width - 20 || pixel.y <= 50 || pixel.y >= map.height - 10) { - if (pixel.x <= 20) { - this._panByX = 8; - } else if (pixel.x >= map.width - 20) { - this._panByX = -8; - } - if (pixel.y <= 50) { - this._panByY = 8; - } else if (pixel.y >= map.height - 10) { - this._panByY = -8; - } - if (!this._edgeMoveTimer) { - this._edgeMoveTimer = setInterval(function () { - map.panBy(me._panByX, me._panByY, { "noAnimation": true }); - }, 30); - } - } else { - if (this._edgeMoveTimer) { - clearInterval(this._edgeMoveTimer); - this._edgeMoveTimer = null; - } - } - }; - - /* - * 调整大小 - * @param {Size} - */ - Mask.prototype._adjustSize = function (size) { - this.container.style.width = size.width + 'px'; - this.container.style.height = size.height + 'px'; - }; - - /** - * 获取当前绘制点的地理坐标 - * - * @param {Event} e e对象 - * @return Point对象的位置信息 - */ - Mask.prototype.getDrawPoint = function (e) { - - var map = this._map, - trigger = baidu.getTarget(e), - x = e.offsetX || e.layerX || 0, - y = e.offsetY || e.layerY || 0; - if (trigger.nodeType != 1) trigger = trigger.parentNode; - while (trigger && trigger != map.getContainer()) { - if (!(trigger.clientWidth == 0 && trigger.clientHeight == 0 && trigger.offsetParent && trigger.offsetParent.nodeName == 'TD')) { - x += trigger.offsetLeft || 0; - y += trigger.offsetTop || 0; - } - trigger = trigger.offsetParent; - } - var pixel = new BMap.Pixel(x, y); - var point = map.pixelToPoint(pixel); - return point; - }; - - /** - * 绘制工具面板,自定义控件 - */ - function DrawingTool(drawingManager, drawingToolOptions) { - this.drawingManager = drawingManager; - - drawingToolOptions = this.drawingToolOptions = drawingToolOptions || {}; - // 默认停靠位置和偏移量 - this.defaultAnchor = BMAP_ANCHOR_TOP_LEFT; - this.defaultOffset = new BMap.Size(10, 10); - - //默认所有工具栏都显示 - this.defaultDrawingModes = [BMAP_DRAWING_MARKER, BMAP_DRAWING_CIRCLE, BMAP_DRAWING_POLYLINE, BMAP_DRAWING_POLYGON, BMAP_DRAWING_RECTANGLE]; - //工具栏可显示的绘制模式 - if (drawingToolOptions.drawingModes) { - this.drawingModes = drawingToolOptions.drawingModes; - } else { - this.drawingModes = this.defaultDrawingModes; - } - - //用户设置停靠位置和偏移量 - if (drawingToolOptions.anchor) { - this.setAnchor(drawingToolOptions.anchor); - } - if (drawingToolOptions.offset) { - this.setOffset(drawingToolOptions.offset); - } - } - - // 通过JavaScript的prototype属性继承于BMap.Control - DrawingTool.prototype = new BMap.Control(); - - // 自定义控件必须实现自己的initialize方法,并且将控件的DOM元素返回 - // 在本方法中创建个div元素作为控件的容器,并将其添加到地图容器中 - DrawingTool.prototype.initialize = function (map) { - // 创建一个DOM元素 - var container = this.container = document.createElement("div"); - container.className = "BMapLib_Drawing"; - //用来设置外层边框阴影 - var panel = this.panel = document.createElement("div"); - panel.className = "BMapLib_Drawing_panel"; - if (this.drawingToolOptions && this.drawingToolOptions.scale) { - this._setScale(this.drawingToolOptions.scale); - } - container.appendChild(panel); - // 添加内容 - panel.innerHTML = this._generalHtml(); - //绑定事件 - this._bind(panel); - // 添加DOM元素到地图中 - map.getContainer().appendChild(container); - // 将DOM元素返回 - return container; - }; - - //生成工具栏的html元素 - DrawingTool.prototype._generalHtml = function (map) { - - //鼠标经过工具栏上的提示信息 - var tips = {}; - tips["hander"] = "拖动地图"; - tips[BMAP_DRAWING_MARKER] = "画点"; - tips[BMAP_DRAWING_CIRCLE] = "画圆"; - tips[BMAP_DRAWING_POLYLINE] = "画折线"; - tips[BMAP_DRAWING_POLYGON] = "画多边形"; - tips[BMAP_DRAWING_RECTANGLE] = "画矩形"; - - var getItem = function getItem(className, drawingType) { - return ''; - }; - - var html = []; - html.push(getItem("BMapLib_box BMapLib_hander", "hander")); - for (var i = 0, len = this.drawingModes.length; i < len; i++) { - var classStr = 'BMapLib_box BMapLib_' + this.drawingModes[i]; - if (i == len - 1) { - classStr += ' BMapLib_last'; - } - html.push(getItem(classStr, this.drawingModes[i])); - } - return html.join(''); - }; - - /** - * 设置工具栏的缩放比例 - */ - DrawingTool.prototype._setScale = function (scale) { - var width = 390, - height = 50, - ml = -parseInt((width - width * scale) / 2, 10), - mt = -parseInt((height - height * scale) / 2, 10); - this.container.style.cssText = ["-moz-transform: scale(" + scale + ");", "-o-transform: scale(" + scale + ");", "-webkit-transform: scale(" + scale + ");", "transform: scale(" + scale + ");", "margin-left:" + ml + "px;", "margin-top:" + mt + "px;", "*margin-left:0px;", //ie6、7 - "*margin-top:0px;", //ie6、7 - "margin-left:0px\\0;", //ie8 - "margin-top:0px\\0;", //ie8 - //ie下使用滤镜 - "filter: progid:DXImageTransform.Microsoft.Matrix(", "M11=" + scale + ",", "M12=0,", "M21=0,", "M22=" + scale + ",", "SizingMethod='auto expand');"].join(''); - }; - - //绑定工具栏的事件 - DrawingTool.prototype._bind = function (panel) { - var me = this; - baidu.on(this.panel, 'click', function (e) { - var target = baidu.getTarget(e); - var drawingType = target.getAttribute('drawingType'); - me.setStyleByDrawingMode(drawingType); - me._bindEventByDraingMode(drawingType); - }); - }; - - //设置工具栏当前选中的项样式 - DrawingTool.prototype.setStyleByDrawingMode = function (drawingType) { - if (!drawingType) { - return; - } - var boxs = this.panel.getElementsByTagName("a"); - for (var i = 0, len = boxs.length; i < len; i++) { - var box = boxs[i]; - if (box.getAttribute('drawingType') == drawingType) { - var classStr = "BMapLib_box BMapLib_" + drawingType + "_hover"; - if (i == len - 1) { - classStr += " BMapLib_last"; - } - box.className = classStr; - } else { - box.className = box.className.replace(/_hover/, ""); - } - } - }; - - //设置工具栏当前选中的项样式 - DrawingTool.prototype._bindEventByDraingMode = function (drawingType) { - var me = this; - var drawingManager = this.drawingManager; - //点在拖拽地图的按钮上 - if (drawingType == "hander") { - drawingManager.close(); - drawingManager._map.enableDoubleClickZoom(); - } else { - drawingManager.setDrawingMode(drawingType); - drawingManager.open(); - drawingManager._map.disableDoubleClickZoom(); - } - }; - - //用来存储用户实例化出来的drawingmanager对象 - var instances = []; - - /* - * 关闭其他实例的绘制模式 - * @param {DrawingManager} 当前的实例 - */ - function closeInstanceExcept(instance) { - var index = instances.length; - while (index--) { - if (instances[index] != instance) { - instances[index].close(); - } - } - } - return DrawingManager; -}); \ No newline at end of file diff --git a/lib/libs/TrafficControl.js b/lib/libs/TrafficControl.js deleted file mode 100644 index 46c480b..0000000 --- a/lib/libs/TrafficControl.js +++ /dev/null @@ -1,1134 +0,0 @@ -'use strict'; - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -/** - * @fileoverview 百度地图的测距工具类,对外开放。 - * 允许用户在地图上点击完成距离的测量。 - * 使用者可以自定义测距线段的相关样式,例如线宽、颜色、测距结果所用的单位制等等。 - * 主入口类是DistanceTool, - * 基于Baidu Map API 1.2。 - * - * @author Baidu Map Api Group - * @version 1.2 - */ -(function (root, factory) { - if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') { - var instance = factory(); - root.BMapLib = root.BMapLib || {}; - root.BMapLib.TrafficControl = root.BMapLib.TrafficControl || instance; - module.exports = instance; - } else if (typeof define === 'function' && define.amd) { - define(factory); - } else { - root.BMapLib = root.BMapLib || {}; - root.BMapLib.TrafficControl = root.BMapLib.TrafficControl || factory(); - } -})(window, function () { - //声明baidu包 - var T, - baidu = T = baidu || { - version: "1.3.9" - }; - //提出guid,防止在与老版本Tangram混用时 - //在下一行错误的修改window[undefined] - baidu.guid = "$BAIDU$"; - //闭包,里边是所用到的tangram的方法 - (function () { - /** @ignore - * @namespace baidu.dom 操作dom的方法。 - */ - baidu.dom = baidu.dom || {}; - - /* @ignore - * @namespace baidu.event 屏蔽浏览器差异性的事件封装。 - * @property target 事件的触发元素 - * @property pageX 鼠标事件的鼠标x坐标 - * @property pageY 鼠标事件的鼠标y坐标 - * @property keyCode 键盘事件的键值 - */ - baidu.event = baidu.event || {}; - - /* @ignore - * @namespace baidu.lang 对语言层面的封装,包括类型判断、模块扩展、继承基类以及对象自定义事件的支持。 - */ - baidu.lang = baidu.lang || {}; - - /* @ignore - * @namespace baidu.browser 判断浏览器类型和特性的属性。 - */ - baidu.browser = baidu.browser || {}; - /** - * 为目标元素添加className - * @name baidu.dom.addClass - * @function - * @grammar baidu.dom.addClass(element, className) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} className 要添加的className,允许同时添加多个class,中间使用空白符分隔 - * @remark - * 使用者应保证提供的className合法性,不应包含不合法字符,className合法字符参考:http://www.w3.org/TR/CSS2/syndata.html。 - * @shortcut addClass - * @meta standard - * @see baidu.dom.removeClass - * - * - * @returns {HTMLElement} 目标元素 - */ - baidu.dom.addClass = function (element, className) { - element = baidu.dom.g(element); - var classArray = className.split(/\s+/), - result = element.className, - classMatch = " " + result + " ", - i = 0, - l = classArray.length; - - for (; i < l; i++) { - if (classMatch.indexOf(" " + classArray[i] + " ") < 0) { - result += (result ? ' ' : '') + classArray[i]; - } - } - - element.className = result; - return element; - }; - - // 声明快捷方法 - baidu.addClass = baidu.dom.addClass; - /** - * 移除目标元素的className - * @name baidu.dom.removeClass - * @function - * @grammar baidu.dom.removeClass(element, className) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} className 要移除的className,允许同时移除多个class,中间使用空白符分隔 - * @remark - * 使用者应保证提供的className合法性,不应包含不合法字符,className合法字符参考:http://www.w3.org/TR/CSS2/syndata.html。 - * @shortcut removeClass - * @meta standard - * @see baidu.dom.addClass - * - * @returns {HTMLElement} 目标元素 - */ - baidu.dom.removeClass = function (element, className) { - element = baidu.dom.g(element); - - var oldClasses = element.className.split(/\s+/), - newClasses = className.split(/\s+/), - lenOld, - lenDel = newClasses.length, - j, - i = 0; - //考虑到同时删除多个className的应用场景概率较低,故放弃进一步性能优化 - // by rocy @1.3.4 - for (; i < lenDel; ++i) { - for (j = 0, lenOld = oldClasses.length; j < lenOld; ++j) { - if (oldClasses[j] == newClasses[i]) { - oldClasses.splice(j, 1); - break; - } - } - } - element.className = oldClasses.join(' '); - return element; - }; - - // 声明快捷方法 - baidu.removeClass = baidu.dom.removeClass; - - /** - * 获取目标元素的computed style值。如果元素的样式值不能被浏览器计算,则会返回空字符串(IE) - * - * @author berg - * @name baidu.dom.getComputedStyle - * @function - * @grammar baidu.dom.getComputedStyle(element, key) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} key 要获取的样式名 - * - * @see baidu.dom.getStyle - * - * @returns {string} 目标元素的computed style值 - */ - - baidu.dom.getComputedStyle = function (element, key) { - element = baidu.dom._g(element); - var doc = baidu.dom.getDocument(element), - styles; - if (doc.defaultView && doc.defaultView.getComputedStyle) { - styles = doc.defaultView.getComputedStyle(element, null); - if (styles) { - return styles[key] || styles.getPropertyValue(key); - } - } - return ''; - }; - /** - * 获取目标元素的样式值 - * @name baidu.dom.getStyle - * @function - * @grammar baidu.dom.getStyle(element, key) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} key 要获取的样式名 - * @remark - * - * 为了精简代码,本模块默认不对任何浏览器返回值进行归一化处理(如使用getStyle时,不同浏览器下可能返回rgb颜色或hex颜色),也不会修复浏览器的bug和差异性(如设置IE的float属性叫styleFloat,firefox则是cssFloat)。
    - * baidu.dom._styleFixer和baidu.dom._styleFilter可以为本模块提供支持。
    - * 其中_styleFilter能对颜色和px进行归一化处理,_styleFixer能对display,float,opacity,textOverflow的浏览器兼容性bug进行处理。 - * @shortcut getStyle - * @meta standard - * @see baidu.dom.setStyle,baidu.dom.setStyles, baidu.dom.getComputedStyle - * - * @returns {string} 目标元素的样式值 - */ - - baidu.dom.getStyle = function (element, key) { - var dom = baidu.dom; - - element = dom.g(element); - var value = element.style[key] || (element.currentStyle ? element.currentStyle[key] : "") || dom.getComputedStyle(element, key); - - return value; - }; - - // 声明快捷方法 - baidu.getStyle = baidu.dom.getStyle; - - /** - * 获取目标元素所属的document对象 - * @name baidu.dom.getDocument - * @function - * @grammar baidu.dom.getDocument(element) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @meta standard - * @see baidu.dom.getWindow - * - * @returns {HTMLDocument} 目标元素所属的document对象 - */ - baidu.dom.getDocument = function (element) { - element = baidu.dom.g(element); - return element.nodeType == 9 ? element : element.ownerDocument || element.document; - }; - - /** - * 从文档中获取指定的DOM元素 - * @name baidu.dom.g - * @function - * @grammar baidu.dom.g(id) - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @shortcut g,T.G - * @meta standard - * @see baidu.dom.q - * - * @returns {HTMLElement|null} 获取的元素,查找不到时返回null,如果参数不合法,直接返回参数 - */ - baidu.dom.g = function (id) { - if ('string' == typeof id || id instanceof String) { - return document.getElementById(id); - } else if (id && id.nodeName && (id.nodeType == 1 || id.nodeType == 9)) { - return id; - } - return null; - }; - // 声明快捷方法 - baidu.g = baidu.G = baidu.dom.g; - /** - * 从文档中获取指定的DOM元素 - * **内部方法** - * - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @meta standard - * @return {HTMLElement} DOM元素,如果不存在,返回null,如果参数不合法,直接返回参数 - */ - baidu.dom._g = function (id) { - if (baidu.lang.isString(id)) { - return document.getElementById(id); - } - return id; - }; - - // 声明快捷方法 - baidu._g = baidu.dom._g; - - /** - * 判断目标参数是否string类型或String对象 - * @name baidu.lang.isString - * @function - * @grammar baidu.lang.isString(source) - * @param {Any} source 目标参数 - * @shortcut isString - * @meta standard - * @see baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate - * - * @returns {boolean} 类型判断结果 - */ - baidu.lang.isString = function (source) { - return '[object String]' == Object.prototype.toString.call(source); - }; - - // 声明快捷方法 - baidu.isString = baidu.lang.isString; - - /** - * 事件监听器的存储表 - * @private - * @meta standard - */ - baidu.event._listeners = baidu.event._listeners || []; - /** - * 为目标元素添加事件监听器 - * @name baidu.event.on - * @function - * @grammar baidu.event.on(element, type, listener) - * @param {HTMLElement|string|window} element 目标元素或目标元素id - * @param {string} type 事件类型 - * @param {Function} listener 需要添加的监听器 - * @remark - * - 1. 不支持跨浏览器的鼠标滚轮事件监听器添加
    - 2. 改方法不为监听器灌入事件对象,以防止跨iframe事件挂载的事件对象获取失败 - * @shortcut on - * @meta standard - * @see baidu.event.un - * - * @returns {HTMLElement|window} 目标元素 - */ - baidu.event.on = function (element, type, listener) { - type = type.replace(/^on/i, ''); - element = baidu.dom._g(element); - - var realListener = function realListener(ev) { - // 1. 这里不支持EventArgument, 原因是跨frame的事件挂载 - // 2. element是为了修正this - listener.call(element, ev); - }, - lis = baidu.event._listeners, - filter = baidu.event._eventFilter, - afterFilter, - realType = type; - type = type.toLowerCase(); - // filter过滤 - if (filter && filter[type]) { - afterFilter = filter[type](element, type, realListener); - realType = afterFilter.type; - realListener = afterFilter.listener; - } - - // 事件监听器挂载 - if (element.addEventListener) { - element.addEventListener(realType, realListener, false); - } else if (element.attachEvent) { - element.attachEvent('on' + realType, realListener); - } - - // 将监听器存储到数组中 - lis[lis.length] = [element, type, listener, realListener, realType]; - return element; - }; - - // 声明快捷方法 - baidu.on = baidu.event.on; - - /** - * 为目标元素移除事件监听器 - * @name baidu.event.un - * @function - * @grammar baidu.event.un(element, type, listener) - * @param {HTMLElement|string|window} element 目标元素或目标元素id - * @param {string} type 事件类型 - * @param {Function} listener 需要移除的监听器 - * @shortcut un - * @meta standard - * @see baidu.event.on - * - * @returns {HTMLElement|window} 目标元素 - */ - baidu.event.un = function (element, type, listener) { - element = baidu.dom._g(element); - type = type.replace(/^on/i, '').toLowerCase(); - - var lis = baidu.event._listeners, - len = lis.length, - isRemoveAll = !listener, - item, - realType, - realListener; - - //如果将listener的结构改成json - //可以节省掉这个循环,优化性能 - //但是由于un的使用频率并不高,同时在listener不多的时候 - //遍历数组的性能消耗不会对代码产生影响 - //暂不考虑此优化 - while (len--) { - item = lis[len]; - - // listener存在时,移除element的所有以listener监听的type类型事件 - // listener不存在时,移除element的所有type类型事件 - if (item[1] === type && item[0] === element && (isRemoveAll || item[2] === listener)) { - realType = item[4]; - realListener = item[3]; - if (element.removeEventListener) { - element.removeEventListener(realType, realListener, false); - } else if (element.detachEvent) { - element.detachEvent('on' + realType, realListener); - } - lis.splice(len, 1); - } - } - - return element; - }; - - // 声明快捷方法 - baidu.un = baidu.event.un; - - ///import baidu.browser; - if (/msie (\d+\.\d)/i.test(navigator.userAgent)) { - //IE 8下,以documentMode为准 - //在百度模板中,可能会有$,防止冲突,将$1 写成 \x241 - /** - * 判断是否为ie浏览器 - * @property ie ie版本号 - * @grammar baidu.browser.ie - * @meta standard - * @shortcut ie - * @see baidu.browser.firefox,baidu.browser.safari,baidu.browser.opera,baidu.browser.chrome,baidu.browser.maxthon - */ - baidu.browser.ie = baidu.ie = document.documentMode || +RegExp['\x241']; - } - - /** - * @namespace baidu.platform 判断平台类型和特性的属性。 - */ - baidu.platform = baidu.platform || {}; - - /** - * 判断是否为iphone平台 - * @property iphone 是否为iphone平台 - * @grammar baidu.platform.iphone - * @meta standard - * @see baidu.platform.x11,baidu.platform.windows,baidu.platform.macintosh,baidu.platform.ipad,baidu.platform.android - */ - baidu.platform.isIphone = /iphone/i.test(navigator.userAgent); - - /** - * 判断是否为android平台 - * @property android 是否为android平台 - * @grammar baidu.platform.android - * @meta standard - * @see baidu.platform.x11,baidu.platform.windows,baidu.platform.macintosh,baidu.platform.iphone,baidu.platform.ipad - * @author jz - */ - baidu.platform.isAndroid = /android/i.test(navigator.userAgent); - /* - * Tangram - * Copyright 2009 Baidu Inc. All rights reserved. - */ - - ///import baidu.platform; - - /** - * 判断是否为ipad平台 - * @property ipad 是否为ipad平台 - * @grammar baidu.platform.ipad - * @meta standard - * @see baidu.platform.x11,baidu.platform.windows,baidu.platform.macintosh,baidu.platform.iphone,baidu.platform.android - * @author jz - */ - baidu.platform.isIpad = /ipad/i.test(navigator.userAgent); - - /** - * 是否为移动平台 - * @returns {Boolean} - */ - baidu.isMobile = function () { - return !!(baidu.platform.isIphone || baidu.platform.isIpad || baidu.platform.isAndroid); - }; - })(); - - var stylePrefix = baidu.isMobile() ? "_mobile" : "_deskTop"; - - /** - * @exports TrafficControl as BMapLib.TrafficControl - */ - var TrafficControl = - /** - * TrafficControl类的构造函数 - * @class 交通流量控件 入口。 - * 实例化该类后,通过addControl()方法,将控件添加到地图上 - * @constructor - * @example 参考示例:
    - * var map = new BMap.Map("container");
    map.centerAndZoom(new BMap.Point(116.404, 39.915), 15);
    var ctrl = new BMapLib.TrafficControl();
    map.addControl(ctrl); - */ - - function TrafficControl(options) { - // 默认停靠位置和偏移量 - this.defaultAnchor = BMAP_ANCHOR_TOP_RIGHT; - this.defaultOffset = new BMap.Size(10, 10); - this.showPanel = options && options.showPanel; - }; - // 继承Control - TrafficControl.prototype = new BMap.Control(); - /** - * 实现父类的initialize方法 - * @ignore - * @param {Map} map Baidu map的实例对象 - * @example 参考示例:
    - * var traffic = new BMapLib.TrafficControl.initialize(map); - */ - TrafficControl.prototype.initialize = function (map) { - var btn = create("div", { - "title": "显示交通流量", - "id": "tcBtn", - "class": "maplibTcBtn" + stylePrefix + " maplibTcBtnOff" + stylePrefix - }); - map.getContainer().appendChild(btn); - this._map = map; - - this._popUpDiv(this, btn); - var me = this; - this.btn = btn; - //将创建的dom元素返回 - return btn; - }; - - /** - * popUpDiv 类的构造函数 - * @class 私有类,创建交通流量控制面板。 - * 实例化该类后,即可调用该类提供的show - * 方法打开控制面板。 - * - * @constructor - * @param {TrafficControl} TrafficControl的实例对象 - * @param {DOM} button 创建的DOM按钮 - * @example 参考示例:
    - * var pop = new BMapLib.TrafficControl._popUpDiv(map);
    pop.show(); - */ - TrafficControl.prototype._popUpDiv = function (me, btn) { - var me = this; - var arrRealTimeTxt = ["查看实时路况", "流量预测"]; - var arrPredictionTxt = ["查看流量预测", "实时路况"]; - //是否是实时路况 - var bRealTime = true; - //该弹出层是打开还是关闭状态 - this.bShow = false; - var thisPop = this; - //重置绑定状态 - thisPop._bind = false; - - //将弹出div的HTML插入到dom中 - insertHTML(btn, "afterEnd", genHtml()); - insertHTML(btn, "afterEnd", genHtml_mobile()); - - //将用到的dom元素都存到变量中 - var viewPreDom = baidu.g("tcViewPrediction"); - var dvPredition = baidu.g("tcPredition"); - var dvTcTitle = baidu.g("tcTitle"); - var dvTcDay = baidu.g("maplibTcDay"); - var dvTcNow = baidu.g("tcNow"); - var dvTcWrap = baidu.g("tcWrap"); - var dvTcTimeBox = baidu.g("tcTimeBox"); - var dvTcUpdate = baidu.g("tcUpdate"); - - var weekName = ["一", "二", "三", "四", "五", "六", "日"]; - - //处理拖动时间条动作 - var timeline = new setBar(me); - /** - * 显示控制面板 * - * @return 无返回值 - * - * @example 参考示例:
    - * pop.show(); - */ - this.show = function () { - initialize(); - me.bShow = true; - baidu.dom.removeClass(btn, "maplibTcBtnOff" + stylePrefix); - }; - /** - * 隐藏控制面板 * - * @return 无返回值 - * - * @example 参考示例:
    - * pop.hide(); - */ - this.hide = function () { - me.bShow = false; - baidu.dom.addClass(btn, "maplibTcBtnOff" + stylePrefix); - if (baidu.isMobile()) { - baidu.dom.addClass("tcWrap_mobile", "maplibTfctrHide"); - } else { - baidu.dom.addClass("tcWrap", "maplibTcHide"); - baidu.dom.addClass("tcPredition", "maplibTcHide"); - } - me.hideTraffic(); - }; - /** - * 返回该控制面板的状态 * - * @return {Boolean} bShow 返回该控制面板的状态 - * - * @example 参考示例:
    - * pop.show(); - */ - this.isbShow = function () { - return me.bShow; - }; - /** - * 定位控制面板 - * @param {Size} size 百度地图基础类size - * @return 无返回值 - * - * @example 参考示例:
    - * pop.setPopOffset(); - */ - this.setPopOffset = function (size) { - var controlHeight = 24; - //弹出层的offset - var offsetH = size.height + controlHeight + "px"; - var offsetW = size.width + "px"; - - switch (me.getAnchor()) { - //左上 - case BMAP_ANCHOR_TOP_LEFT: - dvTcWrap.style.top = offsetH; - dvTcWrap.style.left = offsetW; - break; - //右上 - case BMAP_ANCHOR_TOP_RIGHT: - dvTcWrap.style.top = offsetH; - dvTcWrap.style.right = offsetW; - break; - //右下 - case BMAP_ANCHOR_BOTTOM_RIGHT: - dvTcWrap.style.bottom = offsetH; - dvTcWrap.style.right = offsetW; - break; - //左下 - case BMAP_ANCHOR_BOTTOM_LEFT: - dvTcWrap.style.bottom = offsetH; - dvTcWrap.style.left = offsetW; - break; - } - }; - var eventName = baidu.isMobile() ? "ontouchend" : "onclick"; - //绑定事件,控制弹出层的显示跟隐藏 - baidu.event.on(btn, eventName, function () { - showOrHidePopDiv(); - }); - baidu.event.on("tcClose", "click", function (e) { - showOrHidePopDiv(); - }); - //控制弹出层跟trafficLayer的隐藏或者显示。 - function showOrHidePopDiv() { - if (!thisPop.isbShow()) { - thisPop.setPopOffset(me.getOffset()); - thisPop.show(); - } else { - - thisPop.hide(); - } - } - //初始化面板的状态 - function initialize() { - dvTcDay.innerHTML = "更新时间"; - dvTcTitle.innerHTML = arrPredictionTxt[1]; - viewPreDom.innerHTML = arrPredictionTxt[0]; - baidu.dom.addClass(dvPredition, "maplibTcHide"); - dvTcUpdate.style.display = "block"; - - bRealTime = true; - if (baidu.isMobile()) { - if (me.showPanel) { - baidu.dom.removeClass("tcWrap_mobile", "maplibTfctrHide"); - } - } else { - baidu.dom.removeClass("tcWrap", "maplibTcHide"); - } - - //初始化a的状态 - var arrA = baidu.g("tcWeek").getElementsByTagName("a"); - for (var i = 0; i < 7; i++) { - arrA[i].className = ''; - } - - //获取服务器时间 - var curTimeUrl = "http://its.map.baidu.com:8002/traffic/GetCurrentTime?callback=BMapLib.TrafficControl.getTime&"; - scriptRequest(curTimeUrl + new Date().getTime(), callback); - //3分钟刷新一次,先清除之前可能存在的timer - if (me.timer) clearInterval(me.timer); - me.timer = setInterval(function () { - scriptRequest(curTimeUrl + new Date().getTime(), function () { - if (me.bShow) { - var t = TrafficControl.curTime; - var tHour = t.getHours(); - var time = (tHour < 10 ? "0" + tHour : tHour) + ":" + (t.getMinutes() < 10 ? "0" + t.getMinutes() : t.getMinutes()); - dvTcNow.innerHTML = time; - me.hideTraffic(); - me.showTraffic(); - } - }); - }, 1000 * 3 * 60); - - function callback() { - var t = TrafficControl.curTime; - var tHour = t.getHours(); - - //是否绑定了事件,防止重复绑定 - if (!thisPop._bind) { - bindEventToPopDiv(me); - //私有方法 绑定点击周一到周日事件 - bindEventToWeek(me); - thisPop._bind = true; - } - var time = (tHour < 10 ? "0" + tHour : tHour) + ":" + (t.getMinutes() < 10 ? "0" + t.getMinutes() : t.getMinutes()); - dvTcNow.innerHTML = time; - me.hour = tHour; - //0为周日,6为周六,转换成1-7对应周一到周日 - me.weekday = t.getDay() == 0 ? 7 : t.getDay(); - me.time = time; - timeline.setBarTime(tHour); - } - } - - //生成手机下的弹出html - function genHtml_mobile() { - return '
    实时路况
    '; - } - - //生成弹出div中的html - function genHtml() { - var html = ['
    ']; - html.push('
    实时路况
    '); - html.push('
    '); - html.push('
    更新时间:  查看流量预测
    '); - html.push('
    '); - html.push(''); - html.push('
    时间
    '); - html.push('
    '); - html.push('
    20:00
    '); - html.push('
    '); - html.push('
    '); - html.push('
    '); - html.push('
    '); - html.push('
    '); - html.push('
    (基于历史流量统计预测 仅供参考)
    '); - html.push('
    '); - - return html.join(""); - } - - //给弹出层中的按钮绑定事件 - function bindEventToPopDiv(me) { - - baidu.event.on("tcViewPrediction", "click", function () { - //如果当前是实时流量,就显示预测流量,相当于toggle - if (bRealTime) { - //显示预测交通流量 - showPrediction(); - } else { - //实时路况 - initialize(); - } - }); - - //显示预测流量 - function showPrediction() { - //清除 每3分钟调用1次实时流量的timer - if (me.timer) clearInterval(me.timer); - dvTcTitle.innerHTML = arrRealTimeTxt[1]; - viewPreDom.innerHTML = arrRealTimeTxt[0]; - baidu.dom.removeClass(dvPredition, "maplibTcHide"); - dvTcUpdate.style.display = "none"; - bRealTime = false; - dvTcDay.innerHTML = "星期" + weekName[me.weekday - 1]; - //设置预测流量的时间 - dvTcNow.innerHTML = dvTcTimeBox.innerHTML; - me.showTraffic({ - predictDate: { - hour: me.hour, - weekday: me.weekday - } - }); - } - baidu.event.on("tcUpdate", "click", function () { - initialize(); - }); - } - - //更新文字,只在预测流量中调用 - function updateTimeTxt() { - dvTcDay.innerHTML = "星期" + weekName[me.weekday - 1]; - dvTcNow.innerHTML = dvTcTimeBox.innerHTML; - } - - //绑定预测流量点击事件,周一到周日 - function bindEventToWeek(me) { - baidu.event.on("tcWeek", "onclick", function (e) { - var elem = e.target || e.srcElement; - if (elem.tagName.toLowerCase() == "a") { - var arrA = baidu.g("tcWeek").getElementsByTagName("a"); - for (var i = 0; i < 7; i++) { - arrA[i].className = ''; - } - baidu.dom.addClass(elem, "maplibTcOn"); - me.weekday = parseInt(attr(elem, "lang"), 10); - updateTimeTxt(); - me.showTraffic({ - predictDate: { - hour: me.hour, - weekday: me.weekday - } - }); - } - }); - } - - //时间条相关类 - function setBar(me) { - var hour; - var bt = baidu.g("tcMove"); - - //开始拖动 - function dragStart(e) { - baidu.on(document, "onmousemove", dragIng); - baidu.on(document, "onmouseup", dragEnd); - if (e && e.preventDefault) { - e.preventDefault(); - } else { - window.event.returnValue = false; - } - return false; - } - - //拖动进行中 - function dragIng(e) { - var x = e.clientX || e.x; - var left = getPosition(baidu.G("tcPrev")).left + 9; - var margin = x - left - 4; - if (margin < 0) margin = 0; - if (margin > 165) margin = 165; - if (baidu.browser.ie <= 6) { - bt.style.marginLeft = margin * 0.53 + "px"; - } else { - bt.style.marginLeft = margin + "px"; - } - dvTcTimeBox.style.marginLeft = margin + "px"; - setTimeBox(); - } - - //完成拖动 - function dragEnd() { - baidu.un(document, "onmousemove", dragIng); - baidu.un(document, "onmouseup", dragEnd); - //完成拖动后显示图层 - me.showTraffic({ - predictDate: { - hour: me.hour, - weekday: me.weekday - } - }); - } - baidu.on(bt, "onmousedown", dragStart); - - //绑定时间条中向前的箭头 - baidu.on("tcPrev", "click", function () { - setBarBtn("prev"); - }); - //绑定时间条中向后的箭头 - baidu.on("tcNext", "click", function () { - setBarBtn("next"); - }); - - //设置前进后退按钮 - function setBarBtn(key) { - var box = dvTcTimeBox; - var margin = parseInt(baidu.dom.getStyle("tcTimeBox", "marginLeft")); - var n = Math.ceil((margin - 4) * 24 / 165); - setBarTime(key == 'next' ? n + 1 : n - 1); - } - - /** - * 设置时间条上的时间 - * @param {Number} n 小时从0到24 - * @return 无返回值 - * - * @example 参考示例:
    - * timeBar.setBarTime(10); - */ - this.setBarTime = function (n) { - setBarTime(n); - }; - - //设置时间条的时间 - function setBarTime(n) { - if (n < 0) n = 0; - if (n > 24) n = 24; - hour = n; - var margin = n * (165 / 24); - dvTcTimeBox.style.marginLeft = margin + "px"; - var bt = baidu.g("tcMove"); - if (baidu.browser.ie <= 6 && baidu.browser.ie > 0) { - bt.style.marginLeft = margin * 0.53 + "px"; - } else { - bt.style.marginLeft = margin + "px"; - } - me.hour = hour; - if (bRealTime) { - me.showTraffic(); - } else { - me.showTraffic({ - predictDate: { - hour: me.hour, - weekday: me.weekday - } - }); - } - setTimeBox(); - } - - //设置时间条上里边的内容 - function setTimeBox() { - var margin = parseInt(dvTcTimeBox.style.marginLeft); - var n = Math.ceil((margin - 4) * 24 / 165); - hour = n; - me.hour = n; - if (n < 10) n = "0" + n; - if (bRealTime) { - //更新时间跟预测的交通流量不一样 - dvTcNow.innerHTML = me.time; - dvTcTimeBox.innerHTML = n + ":00"; - } else { - dvTcNow.innerHTML = dvTcTimeBox.innerHTML = n + ":00"; - } - } - } - }; - /** - * 添加交通流量图层 - * @param {Json} predictDate {weekday:预测日期,取值1到7,表示周一到周日 ,hour: 预测小时数,取值0到23,表示当日的0点到23点} 表示交通流量的预测日期 - * @return 无返回值 - * - * @example 参考示例:
    - * ctrl.showTraffic({predictDate:{hour:15, weekday: 5}}); - */ - TrafficControl.prototype.showTraffic = function (predictDate) { - var trafficLayer; - if (this._trafficLayer) { - this._map.removeTileLayer(this._trafficLayer); - } - if (predictDate) { - //如果weekday不在1到7之间,则返回; - if (predictDate.predictDate.weekday > 7 || predictDate.predictDate.weekday < 1) { - return; - } - trafficLayer = new BMap.TrafficLayer(predictDate); - } else { - trafficLayer = new BMap.TrafficLayer(); - } - this.bShow = true; - if (baidu.isMobile()) { - baidu.dom.removeClass(this.btn, "maplibTcBtnOff" + stylePrefix); - } - this._map.addTileLayer(trafficLayer); - this._trafficLayer = trafficLayer; - }; - /** - * 隐藏交通流量图层 - * @return 无返回值 - * - * @example 参考示例:
    - * ctrl.hideTraffic(); - */ - TrafficControl.prototype.hideTraffic = function () { - this.bShow = false; - if (this._trafficLayer) { - this._map.removeTileLayer(this._trafficLayer); - this._trafficLayer = null; - } - - if (baidu.isMobile()) { - baidu.dom.addClass(this.btn, "maplibTcBtnOff" + stylePrefix); - } - }; - - /** - * 重新父类的remove()方法,确保当移除控件的时候,与此控件相关的overlay等都会被去掉 - * 当使用removeControl()的方法的时候,会自动调用这个方法。 - * @return 无返回值 - * - * @example 参考示例:
    - * map.removeControl(ctrl); - */ - TrafficControl.prototype.remove = function () { - this.hideTraffic(); - var dvWrap = baidu.g("tcWrap"); - //移除在dom中添加的html - dvWrap.parentNode.removeChild(dvWrap); - BMap.Control.prototype.remove.call(this); - //移除每3秒调用一次的实时流量 - if (this.timer) clearInterval(this.timer); - }; - /** - * 设置获取属性 - * @ignore - * @param {String} 标签名称 - * @param {Object} 元素属性 - */ - - function attr(elem, name, value) { - if (!name || name.constructor != String) return ''; - name = { - 'for': 'htmlFor', - 'class': 'className' - }[name] || name; - if (typeof value != 'undefined') { - elem[name] = value; - if (elem.setAttribute) { - elem.setAttribute(name, value); - } - } - return elem[name] || elem.getAttribute(name) || ''; - } - /** - * 创建DOM对象 - * @ignore - * @param {String} 标签名称 - * @param {Object} 元素属性 - */ - - function create(tag, attr) { - var e = document.createElement(tag); - var attr = attr || {}; - var value; - // 设置属性 - for (var name in attr) { - value = attr[name]; - name = result()[name] || name; - if (name == "style") { - e.style.cssText = value; - continue; - } - if (e.setAttribute) { - e.setAttribute(name, value); - } else { - try { - e[name] = value; - } catch (e) {} - } - } - return e; - - function result() { - var attrName = { - 'cellpadding': 'cellPadding', - 'cellspacing': 'cellSpacing', - 'colspan': 'colSpan', - 'rowspan': 'rowSpan', - 'valign': 'vAlign' - }; - if (baidu.browser.ie < 8) { - //ie低版本,只认className - attrName['for'] = 'htmlFor'; - attrName['class'] = 'className'; - } else { - attrName['htmlFor'] = 'for'; - attrName['className'] = 'class'; - } - return attrName; - } - } - /** - * 获取对象元素在页面中的位置 - * @ignore - * @param {Object} Html元素对象 - * @return {Object} 位置对象 - */ - - function getPosition(obj) { - var pos = { - left: 0, - top: 0 - }; - while (obj && obj.offsetParent) { - pos.left += obj.offsetLeft; - pos.top += obj.offsetTop; - obj = obj.offsetParent; - }; - return pos; - } - /** - * 在目标元素的指定位置插入HTML代码, - * 闭包,对外不暴露 - * @ignore - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {String} position 插入html的位置信息 - * 取值为beforeBegin、afterBegin、beforeEnd或afterEnd,大小写不敏感 - * @param {String} html 要插入的html - * @return {HTMLElement} 目标元素 - */ - - function insertHTML(element, position, html) { - var range, begin; - if (element.insertAdjacentHTML) { - element.insertAdjacentHTML(position, html); - } else { - range = element.ownerDocument.createRange(); - // FF下range的位置设置错误可能导致创建出来的fragment在插入dom树之后html结构乱掉 - // 改用range.insertNode来插入html - position = position.toUpperCase(); - if (position == 'AFTERBEGIN' || position == 'BEFOREEND') { - range.selectNodeContents(element); - range.collapse(position == 'AFTERBEGIN'); - } else { - begin = position == 'BEFOREBEGIN'; - range[begin ? 'setStartBefore' : 'setEndAfter'](element); - range.collapse(begin); - } - range.insertNode(range.createContextualFragment(html)); - } - return element; - } - /** - * script异步请求 - * @param {String} url - * @param {Function} callback - * @returns none - */ - function scriptRequest(url, callback) { - var script = document.createElement('script'); - script.setAttribute('src', url); - script.setAttribute('type', 'text/javascript'); - script.setAttribute('charset', 'gbk'); - // 脚本加载完成后进行移除 - if (script.addEventListener) { - script.addEventListener('load', function (e) { - var t = e.target; - t.parentNode.removeChild(t); - if (callback) callback(); - }, false); - } else if (script.attachEvent) { - script.attachEvent('onreadystatechange', function (e) { - var t = window.event.srcElement; - if (t && (t.readyState == 'loaded' || t.readyState == 'complete')) { - t.parentNode.removeChild(t); - if (callback) callback(); - } - }); - } - // 使用setTimeout解决ie6无法发送问题 - setTimeout(function () { - document.getElementsByTagName('head')[0].appendChild(script); - script = null; - }, 1); - } - /** - * 将服务器更新时间设置为类的属性 - * @param {Date} dtNow 服务器更新时间 - * @param {Function} callback - * @returns none - */ - TrafficControl.getTime = function (dtNow) { - this.curTime = isNaN(dtNow) ? new Date() : new Date(dtNow); - }; - return TrafficControl; -}); \ No newline at end of file diff --git a/package.json b/package.json index 19ea7e1..4750361 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,7 @@ { "name": "rc-bmap", - "version": "0.2.4", + "version": "1.0.0", "main": "lib/index.js", - "typings": "types/index.d.ts", "repository": { "type": "git", "url": "git+https://github.com/JserWang/rc-bmap.git" @@ -18,24 +17,21 @@ "files": [ "src", "lib", - "types", - "dist" + "types" ], + "license": "MIT", "homepage": "https://bmap.jser-club.com", "dependencies": { - "bmaplib.curveline": "^1.0.0", - "bmaplib.heatmap": "^1.0.4", - "bmaplib.markerclusterer": "^1.0.13" + "babel-plugin-transform-regenerator": "^6.26.0", + "babel-plugin-transform-runtime": "^6.23.0", + "lodash.isequal": "^4.5.0", + "prop-types": "^15.6.2" }, "scripts": { "build": "rm -rf lib && babel src -d lib", - "build:dist": "webpack", - "prepublish": "npm run build:dist && npm run build", - "pub": "npm run prepublish && npm publish", - "precommit": "lint-staged" - }, - "lint-staged": { - "docs/**/*.md": ["prettier --parser markdown --write", "git add"] + "build_win": "rimraf lib && babel src -d lib", + "prepublish": "npm run build", + "pub": "npm run prepublish && npm publish" }, "devDependencies": { "@types/react": "^16.4.9", @@ -52,13 +48,7 @@ "eslint-plugin-import": "^2.14.0", "eslint-plugin-jsx-a11y": "^6.1.1", "eslint-plugin-react": "^7.11.0", - "git-hooks": "^1.1.10", - "husky": "^1.0.0-rc.13", - "lint-staged": "^7.2.2", - "prettier": "1.14.2", "react": "^16.4.1", - "react-dom": "^16.4.1", - "webpack": "^3.0.0", - "webpack-dev-server": "^2.5.0" + "react-dom": "^16.4.1" } } diff --git a/src/components/AutoComplete/index.js b/src/components/AutoComplete/index.js index 68f6036..5de01f2 100644 --- a/src/components/AutoComplete/index.js +++ b/src/components/AutoComplete/index.js @@ -1,46 +1,47 @@ -import ReactComponent from '../ReactComponent'; -import { bindEvents } from '../_base/util'; - -@ReactComponent -class AutoComplete { - constructor(props) { - this.props = props; - this.map = global.bMapInstance; - this.init(); +import { PureComponent } from 'react'; +import PropTypes from 'prop-types'; +import { Util, AutoComplete as BAutoComplete } from '../../core'; + +class AutoComplete extends PureComponent { + instance = null; + + config = {} + + static childContextTypes = { + centralizedUpdates: PropTypes.func, + } + + getChildContext() { + return { + centralizedUpdates: this.centralizedUpdates, + }; + } + + componentDidMount() { + const { children, ...resetProps } = this.props; + this.config = { ...this.config, ...resetProps }; + this.control = new BAutoComplete(this.config); + this.instance = this.control.instance; + } + + componentDidUpdate() { + const { children, ...resetProps } = this.props; + this.config = { ...this.config, ...resetProps }; + this.control.repaint(this.config); } - init() { - const { - input, - events, - value, - location, - searchComplete, - } = this.props; - - this.instance = new global.BMap.Autocomplete({ - input, - location: location || this.map, - onSearchComplete: searchComplete, - }); - - if (value) { - this.instance.setInputValue(value); - } - - bindEvents(this.instance, 'AUTO_COMPLETE', events); + componentWillUnmount() { + this.control.destroy(); } - onPropsUpdate(newProps) { - this.props = newProps; - this.destroy(); - this.init(); + centralizedUpdates = ({ name, data }) => { + const configName = Util.firstLowerCase(name); + this.config[configName] = data; } - destroy = () => { - if (this.instance.dispose) { - this.instance.dispose(); - } + render() { + const { children } = this.props; + return children || null; } } diff --git a/src/components/Base/Bounds.js b/src/components/Base/Bounds.js new file mode 100644 index 0000000..bc1451f --- /dev/null +++ b/src/components/Base/Bounds.js @@ -0,0 +1,13 @@ +import Common from './Common'; + +export default class Bounds extends Common { + static displayName = 'Bounds' + + getData = () => ({ + name: this.props.name || 'bounds', + data: { + sw: this.config.sw || this.props.sw, + ne: this.config.ne || this.props.ne, + }, + }) +} diff --git a/src/components/Base/Common.js b/src/components/Base/Common.js new file mode 100644 index 0000000..1c3a726 --- /dev/null +++ b/src/components/Base/Common.js @@ -0,0 +1,57 @@ +import React, { PureComponent } from 'react'; +import PropTypes from 'prop-types'; +import { Util } from '../../core'; + +class Common extends PureComponent { + static contextTypes = { + centralizedUpdates: PropTypes.func, + } + + config = {} + + static displayName = 'CommonBaseComponent'; + + static childContextTypes = { + centralizedUpdates: PropTypes.func, + } + + getChildContext() { + return { + centralizedUpdates: this.centralizedUpdates, + }; + } + + componentDidMount() { + const { context, getData } = this; + const data = (getData && getData()) || {}; + context.centralizedUpdates(data); + } + + componentDidUpdate() { + const { context, getData } = this; + const data = (getData && getData()) || {}; + context.centralizedUpdates(data); + } + + componentWillUnmount() { + const { context, getData } = this; + const data = (getData && getData()) || {}; + data.data = null; + context.centralizedUpdates(data); + } + + centralizedUpdates = ({ name, data }) => { + const configName = Util.firstLowerCase(name); + this.config[configName] = data; + } + + render() { + const { children } = this.props; + if (children) { + return
    {children}
    ; + } + return null; + } +} + +export default Common; diff --git a/src/components/Base/Events.js b/src/components/Base/Events.js new file mode 100644 index 0000000..a7c8e89 --- /dev/null +++ b/src/components/Base/Events.js @@ -0,0 +1,10 @@ +import Common from './Common'; + +export default class Events extends Common { + static displayName = 'Events' + + getData = () => ({ + name: 'events', + data: this.props, + }) +} diff --git a/src/components/Base/Path.js b/src/components/Base/Path.js new file mode 100644 index 0000000..f334e4f --- /dev/null +++ b/src/components/Base/Path.js @@ -0,0 +1,83 @@ +import React, { PureComponent } from 'react'; +import PropTypes from 'prop-types'; + +export default class Path extends PureComponent { + static displayName = 'Path' + + static contextTypes = { + centralizedUpdates: PropTypes.func, + } + + items = [] + + static childContextTypes = { + addPoint: PropTypes.func, + updatePoint: PropTypes.func, + removePoint: PropTypes.func, + } + + getChildContext() { + return { + addPoint: this.addPoint, + updatePoint: this.updatePoint, + removePoint: this.removePoint, + }; + } + + componentDidMount() { + const { context } = this; + context.centralizedUpdates({ + name: 'path', + data: [...this.items], + }); + } + + componentDidUpdate() { + const { context } = this; + context.centralizedUpdates({ + name: 'path', + data: [...this.items], + }); + } + + componentWillUnmount() { + const { context } = this; + context.centralizedUpdates({ + name: 'path', + data: null, + }); + } + + addPoint = (index, item) => { + if (this.items[index]) { + this.items.splice(index, 0, item); + } else { + this.items[index] = item; + } + } + + updatePoint = (index, item) => { + this.items[index] = item; + } + + removePoint = (index) => { + this.items.splice(index, 1); + } + + renderChildren = () => React.Children.map(this.props.children, (child, index) => { + if (child) { + return React.cloneElement(child, { + index, + }); + } + return null; + }) + + render() { + return ( +
    + {this.renderChildren()} +
    + ); + } +} diff --git a/src/components/Base/Point.js b/src/components/Base/Point.js new file mode 100644 index 0000000..7e14280 --- /dev/null +++ b/src/components/Base/Point.js @@ -0,0 +1,56 @@ +import PropTypes from 'prop-types'; +import Common from './Common'; + +export default class Point extends Common { + static displayName = 'Point' + + static contextTypes = { + centralizedUpdates: PropTypes.func, + addPoint: PropTypes.func, + updatePoint: PropTypes.func, + removePoint: PropTypes.func, + } + + componentDidMount() { + const { context } = this; + const { + index, lng, lat, name = 'point', + } = this.props; + // 若存在addPoint,则证明在Path下,不进行统一数据变更逻辑 + if (context.addPoint) { + context.addPoint(index, { lng, lat }); + } else { + this.centralizedUpdates(name, lng, lat); + } + } + + componentDidUpdate() { + const { context } = this; + const { + index, lng, lat, name = 'point', + } = this.props; + if (context.updatePoint) { + context.updatePoint(index, { lng, lat }); + } else { + this.centralizedUpdates(name, lng, lat); + } + } + + componentWillUnmount() { + const { context } = this; + const { index } = this.props; + if (context.removePoint) { + context.removePoint(index); + } + } + + centralizedUpdates = (name, lng, lat) => { + this.context.centralizedUpdates({ + name, + data: { + lng, + lat, + }, + }); + } +} diff --git a/src/components/Base/Size.js b/src/components/Base/Size.js new file mode 100644 index 0000000..7642c4c --- /dev/null +++ b/src/components/Base/Size.js @@ -0,0 +1,12 @@ +import Common from './Common'; + +export default class Size extends Common { + static displayName = 'Size' + + getData = () => { + const { width, height, name = 'size' } = this.props; + + const data = { width, height }; + return { name, data }; + } +} diff --git a/src/components/Base/index.js b/src/components/Base/index.js new file mode 100644 index 0000000..9f3d47a --- /dev/null +++ b/src/components/Base/index.js @@ -0,0 +1,17 @@ +import Point from './Point'; +import Size from './Size'; +import Events from './Events'; +import Bounds from './Bounds'; +import Path from './Path'; + +export default class Base { + static Point = Point; + + static Size = Size; + + static Events = Events; + + static Bounds = Bounds; + + static Path = Path; +} diff --git a/src/components/ContextMenu/Item.js b/src/components/ContextMenu/Item.js new file mode 100644 index 0000000..9ac26d0 --- /dev/null +++ b/src/components/ContextMenu/Item.js @@ -0,0 +1,78 @@ +import { PureComponent } from 'react'; +import PropTypes from 'prop-types'; +import { Util, BMapUtil, Constants } from '../../core'; + +const { CONTEXT_MENU_ICON } = Constants; +// 内置ContextMenuIcon集合 +const builtInArray = [CONTEXT_MENU_ICON.ZOOM_IN, CONTEXT_MENU_ICON.ZOOM_OUT]; + +/** + * 处理icon + * @param {*} iconUrl icon链接 + */ +const getIconUrl = (iconUrl) => { + let icon = iconUrl; + if (iconUrl && builtInArray.indexOf(iconUrl) > -1) { + icon = global[iconUrl]; + } + return icon; +}; + +export default class ContextMenuItem extends PureComponent { + displayName = 'ContextMenuItem' + + instance = null + + static contextTypes = { + addMenuItem: PropTypes.func, + updateMenuItem: PropTypes.func, + removeMenuItem: PropTypes.func, + } + + componentDidMount() { + const { context } = this; + const { index } = this.props; + + this.instance = this.getInstance(); + context.addMenuItem(index, this.instance); + } + + componentDidUpdate() { + const { context } = this; + const { index } = this.props; + this.instance = this.getInstance(); + context.updateMenuItem(index, this.instance); + } + + componentWillUnmount() { + const { context } = this; + const { index } = this.props; + context.removeMenuItem(index); + } + + /** + * 根据 props 初始化MenuItem + */ + getInstance = () => { + const { + disabled, separator, iconUrl, + text, width, id, onClick, + } = this.props; + const menuItem = BMapUtil.BMenuItem(text, onClick, { + id, + width, + iconUrl: getIconUrl(iconUrl), + }); + menuItem.separator = separator; + if (!Util.isNil(disabled) && disabled) { + menuItem.disable(); + } else { + menuItem.enable(); + } + return menuItem; + } + + render() { + return null; + } +} diff --git a/src/components/ContextMenu/index.js b/src/components/ContextMenu/index.js new file mode 100644 index 0000000..c109bff --- /dev/null +++ b/src/components/ContextMenu/index.js @@ -0,0 +1,90 @@ +import React, { PureComponent } from 'react'; +import PropTypes from 'prop-types'; +import Item from './Item'; +import { BMapUtil } from '../../core'; + +export default class ContextMenu extends PureComponent { + static Item = Item + + displayName = 'ContextMenu' + + static contextTypes = { + centralizedUpdates: PropTypes.func, + } + + // 子元素集合 + menuItems = []; + + // BContextMenu实例 + instance = null + + static childContextTypes = { + addMenuItem: PropTypes.func, + updateMenuItem: PropTypes.func, + removeMenuItem: PropTypes.func, + } + + getChildContext() { + return { + addMenuItem: this.addMenuItem, + updateMenuItem: this.updateMenuItem, + removeMenuItem: this.removeMenuItem, + }; + } + + componentDidMount() { + const { context } = this; + this.repaint(); + context.centralizedUpdates({ + name: 'contextMenu', + data: this.instance, + }); + } + + componentDidUpdate() { + const { context } = this; + this.repaint(); + context.centralizedUpdates({ + name: 'contextMenu', + data: this.instance, + }); + } + + addMenuItem = (index, item) => { + if (this.menuItems[index]) { + this.menuItems.splice(index, 0, item); + } else { + this.menuItems[index] = item; + } + } + + updateMenuItem = (index, item) => { + this.menuItems[index] = item; + } + + removeMenuItem = (index) => { + this.menuItems.splice(index, 1); + } + + repaint = () => { + this.instance = BMapUtil.BContextMenu(this.menuItems); + } + + renderChildren = () => React.Children.map(this.props.children, (child, index) => { + if (child) { + // 这里将 index 传递给MenuItem,保证子元素的显示顺序 + return React.cloneElement(child, { + index, + }); + } + return null; + }) + + render() { + return ( +
    + {this.renderChildren()} +
    + ); + } +} diff --git a/src/components/Control/BaseControl.js b/src/components/Control/BaseControl.js index a7f2984..d264f22 100644 --- a/src/components/Control/BaseControl.js +++ b/src/components/Control/BaseControl.js @@ -1,35 +1,57 @@ -import { render as reactRender } from 'react-dom'; -import { unBindEvents } from '../_base/util'; +import { PureComponent } from 'react'; +import PropTypes from 'prop-types'; +import { Util } from '../../core'; -class BaseControl { - constructor(props) { - this.props = props; - this.state = {}; - this.map = global.bMapInstance; +class BaseControl extends PureComponent { + static contextTypes = { + getMapInstance: PropTypes.func, + } + + static childContextTypes = { + centralizedUpdates: PropTypes.func, + } + + control = null + + mapInstance = null + + config = {} + + getChildContext() { + return { + centralizedUpdates: this.centralizedUpdates, + }; + } + + componentDidMount() { + const { context, props } = this; + const { children, ...resetProps } = props; + this.config = { ...this.config, ...resetProps }; + this.mapInstance = context.getMapInstance(); + const control = this.getRealControl(); + this.control = control; + this.instance = control.instance; + } - this.init(); + componentDidUpdate() { + const { children, ...resetProps } = this.props; + this.config = { ...this.config, ...resetProps }; + this.control.repaint(this.config); } - onPropsUpdate(newProps) { - this.props = newProps; - unBindEvents(this.instance); - this.destroy(); - this.init(); + componentWillUnmount() { + this.control.destroy(); } - setState(param) { - if (param !== null) { - this.state = Object.assign(this.state, param); - } - if (this.render) { - reactRender(this.render(), this.container); - } + centralizedUpdates = ({ name, data }) => { + const configName = Util.firstLowerCase(name); + this.config[configName] = data; } - destroy() { - this.map.removeControl(this.instance); - this.instance = null; + render() { + const { children } = this.props; + return children || null; } } diff --git a/src/components/Control/CityList.js b/src/components/Control/CityList.js index e039d09..5744b6e 100644 --- a/src/components/Control/CityList.js +++ b/src/components/Control/CityList.js @@ -1,30 +1,16 @@ +import React from 'react'; +import { CityList as BCityList } from '../../core'; import BaseControl from './BaseControl'; -import { getSize } from '../_base/util'; -import ANCHOR from '../../constants/ControlAnchor'; -import ReactComponent from '../ReactComponent'; -@ReactComponent class CityList extends BaseControl { - init() { - const { - anchor = ANCHOR.TOP_LEFT, - offset = { - width: 0, - height: 0, - }, - onChangeBefore, - onChangeAfter, - } = this.props; + getRealControl = () => new BCityList(this.config, this.mapInstance) - const opts = { - anchor: global[anchor], - offset: getSize(offset.width, offset.height), - onChangeBefore, - onChangeAfter, - }; - - this.instance = new global.BMap.CityListControl(opts); - this.map.addControl(this.instance); + render() { + const { children } = this.props; + if (children) { + return
    {children}
    ; + } + return null; } } diff --git a/src/components/Control/Copyright.js b/src/components/Control/Copyright.js deleted file mode 100644 index f2506d9..0000000 --- a/src/components/Control/Copyright.js +++ /dev/null @@ -1,33 +0,0 @@ -import BaseControl from './BaseControl'; -import { getSize } from '../_base/util'; -import ANCHOR from '../../constants/ControlAnchor'; -import ReactComponent from '../ReactComponent'; - -@ReactComponent -class Copyright extends BaseControl { - init() { - const { - anchor = ANCHOR.BOTTOM_LEFT, - offset = { - width: 0, - height: 0, - }, - content, - } = this.props; - - const opts = { - anchor: global[anchor], - offset: getSize(offset.width, offset.height), - }; - - this.instance = new global.BMap.CopyrightControl(opts); - this.instance.addCopyright({ - id: 1, - content, - bounds: global.bMapInstance.getBounds(), - }); - this.map.addControl(this.instance); - } -} - -export default Copyright; diff --git a/src/components/Control/CopyrightControl.js b/src/components/Control/CopyrightControl.js new file mode 100644 index 0000000..4f97925 --- /dev/null +++ b/src/components/Control/CopyrightControl.js @@ -0,0 +1,65 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { Copyright as BCopyright } from '../../core'; +import BaseControl from './BaseControl'; + +import Copyright from '../Copyright'; + +class CopyrightControl extends BaseControl { + static Copyright = Copyright; + + static childContextTypes = { + addCopyright: PropTypes.func, + updateCopyright: PropTypes.func, + removeCopyright: PropTypes.func, + } + + config = { + copyrights: [], + } + + getChildContext() { + return { + addCopyright: this.addCopyright, + updateCopyright: this.updateCopyright, + removeCopyright: this.removeCopyright, + }; + } + + addCopyright = (index, item) => { + if (this.config.copyrights[index]) { + this.config.copyrights.splice(index, 0, item); + } else { + this.config.copyrights[index] = item; + } + } + + updateCopyright = (index, item) => { + this.config.copyrights.splice(index, 1, item); + } + + removeCopyright = (index) => { + this.config.copyrights.splice(index, 1); + } + + getRealControl = () => new BCopyright(this.config, this.mapInstance) + + renderChildren = () => React.Children.map(this.props.children, (child, index) => { + if (child) { + return React.cloneElement(child, { + index, + }); + } + return null; + }) + + render() { + return ( +
    + {this.renderChildren()} +
    + ); + } +} + +export default CopyrightControl; diff --git a/src/components/Control/Custom.js b/src/components/Control/Custom.js new file mode 100644 index 0000000..90d596f --- /dev/null +++ b/src/components/Control/Custom.js @@ -0,0 +1,43 @@ +import React from 'react'; +import { initCustomControl } from '../../core'; +import BaseControl from './BaseControl'; + +const CustomHOC = WrappedComponent => class extends BaseControl { + config = {} + + control = null + + componentDidMount() { + const { context } = this; + const { children, ...resetProps } = this.props; + this.config = { ...this.config, ...resetProps }; + this.mapInstance = context.getMapInstance(); + this.control = initCustomControl(this.config, this.initialize, this.mapInstance); + } + + getContainer = (ref) => { + this.container = ref; + } + + initialize = () => { + const { container, mapInstance } = this; + mapInstance.getContainer().appendChild(container); + return container; + } + + render() { + const { context } = this; + const { children } = this.props; + return ( +
    + + { children } +
    + ); + } +}; + +export default CustomHOC; diff --git a/src/components/Control/Geolocation.js b/src/components/Control/Geolocation.js index 25e0c0b..a3400d6 100644 --- a/src/components/Control/Geolocation.js +++ b/src/components/Control/Geolocation.js @@ -1,38 +1,8 @@ +import { Geolocation as BGeolocation } from '../../core'; import BaseControl from './BaseControl'; -import { getSize, bindEvents, createIcon } from '../_base/util'; -import ANCHOR from '../../constants/ControlAnchor'; -import ReactComponent from '../ReactComponent'; -@ReactComponent class Geolocation extends BaseControl { - init() { - const { - anchor = ANCHOR.BOTTOM_LEFT, - offset = { - width: 0, - height: 0, - }, - showAddressBar = true, - autoLocation = false, - locationIcon, - events, - } = this.props; - - const opts = { - anchor: global[anchor], - offset: getSize(offset.width, offset.height), - showAddressBar, - enableAutoLocation: autoLocation, - }; - - if (locationIcon) { - opts.locationIcon = createIcon(locationIcon); - } - - this.instance = new global.BMap.GeolocationControl(opts); - bindEvents(this.instance, 'GEOLOCATION', events); - this.map.addControl(this.instance); - } + getRealControl = () => new BGeolocation(this.config, this.mapInstance) } export default Geolocation; diff --git a/src/components/Control/MapType.js b/src/components/Control/MapType.js index 47a4c49..d60a5e0 100644 --- a/src/components/Control/MapType.js +++ b/src/components/Control/MapType.js @@ -1,35 +1,8 @@ +import { MapType as BMapType } from '../../core'; import BaseControl from './BaseControl'; -import { getSize } from '../_base/util'; -import ANCHOR from '../../constants/ControlAnchor'; -import TYPE from '../../constants/MapTypeControlType'; -import MAP_TYPE from '../../constants/MapType'; -import ReactComponent from '../ReactComponent'; -@ReactComponent class MapType extends BaseControl { - init() { - const { - anchor = ANCHOR.TOP_RIGHT, - offset = { - width: 10, - height: 10, - }, - type = TYPE.HORIZONTAL, - mapTypes = [MAP_TYPE.NORMAL, MAP_TYPE.PERSPECTIVE, MAP_TYPE.SATELLITE, MAP_TYPE.HYBRID], - } = this.props; - - const types = mapTypes.map(item => global[item]); - - const opts = { - anchor: global[anchor], - offset: getSize(offset.width, offset.height), - type: global[type], - mapTypes: types, - }; - - this.instance = new global.BMap.MapTypeControl(opts); - this.map.addControl(this.instance); - } + getRealControl = () => new BMapType(this.config, this.mapInstance) } export default MapType; diff --git a/src/components/Control/Navigation.js b/src/components/Control/Navigation.js index 8366d30..05f8d43 100644 --- a/src/components/Control/Navigation.js +++ b/src/components/Control/Navigation.js @@ -1,34 +1,8 @@ +import { Navigation as BNavigation } from '../../core'; import BaseControl from './BaseControl'; -import { getSize } from '../_base/util'; -import ANCHOR from '../../constants/ControlAnchor'; -import TYPE from '../../constants/NavigationType'; -import ReactComponent from '../ReactComponent'; -@ReactComponent class Navigation extends BaseControl { - init() { - const { - anchor = ANCHOR.TOP_LEFT, - offset = { - width: 10, - height: 10, - }, - type = TYPE.LARGE, - showZoomInfo = true, - geolocation = false, - } = this.props; - - const opts = { - anchor: global[anchor], - offset: getSize(offset.width, offset.height), - type: global[type], - showZoomInfo, - enableGeolocation: geolocation, - }; - - this.instance = new global.BMap.NavigationControl(opts); - this.map.addControl(this.instance); - } + getRealControl = () => new BNavigation(this.config, this.mapInstance) } export default Navigation; diff --git a/src/components/Control/OverviewMap.js b/src/components/Control/OverviewMap.js index f5f41a3..a4d1a38 100644 --- a/src/components/Control/OverviewMap.js +++ b/src/components/Control/OverviewMap.js @@ -1,36 +1,8 @@ import BaseControl from './BaseControl'; -import { getSize, bindEvents } from '../_base/util'; -import ANCHOR from '../../constants/ControlAnchor'; -import ReactComponent from '../ReactComponent'; +import { OverviewMap as BOverviewMap } from '../../core'; -@ReactComponent class OverviewMap extends BaseControl { - init() { - const { - anchor = ANCHOR.BOTTOM_RIGHT, - offset = { - width: 0, - height: 0, - }, - size = { - width: 150, - height: 150, - }, - isOpen = false, - events, - } = this.props; - - const opts = { - anchor: global[anchor], - offset: getSize(offset.width, offset.height), - size: getSize(size.width, size.height), - isOpen, - }; - - this.instance = new global.BMap.OverviewMapControl(opts); - bindEvents(this.instance, 'OVERVIEW_MAP', events); - this.map.addControl(this.instance); - } + getRealControl = () => new BOverviewMap(this.config, this.mapInstance) } export default OverviewMap; diff --git a/src/components/Control/Panorama.js b/src/components/Control/Panorama.js index 71d915d..3c27ede 100644 --- a/src/components/Control/Panorama.js +++ b/src/components/Control/Panorama.js @@ -1,27 +1,8 @@ +import { Panorama as BPanorama } from '../../core'; import BaseControl from './BaseControl'; -import { getSize } from '../_base/util'; -import ANCHOR from '../../constants/ControlAnchor'; -import ReactComponent from '../ReactComponent'; -@ReactComponent class Panorama extends BaseControl { - init() { - const { - anchor = ANCHOR.TOP_RIGHT, - offset = { - width: 0, - height: 0, - }, - } = this.props; - - const opts = { - anchor: global[anchor], - offset: getSize(offset.width, offset.height), - }; - - this.instance = new global.BMap.PanoramaControl(opts); - this.map.addControl(this.instance); - } + getRealControl = () => new BPanorama(this.config, this.mapInstance) } export default Panorama; diff --git a/src/components/Control/Scale.js b/src/components/Control/Scale.js index 0ec8254..c57744b 100644 --- a/src/components/Control/Scale.js +++ b/src/components/Control/Scale.js @@ -1,30 +1,8 @@ -import { getSize } from '../_base/util'; -import CONTROL_ANCHOR from '../../constants/ControlAnchor'; -import LENGTH_UNIT from '../../constants/LengthUnit'; -import ReactComponent from '../ReactComponent'; import BaseControl from './BaseControl'; +import { Scale as BScale } from '../../core'; -@ReactComponent class Scale extends BaseControl { - init() { - const { - anchor = CONTROL_ANCHOR.TOP_LEFT, - offset = { - width: 81, - height: 18, - }, - unit = LENGTH_UNIT.METRIC, - } = this.props; - - const opts = { - anchor: global[anchor], - offset: getSize(offset.width, offset.height), - }; - - this.instance = new global.BMap.ScaleControl(opts); - this.instance.setUnit(global[unit]); - this.map.addControl(this.instance); - } + getRealControl = () => new BScale(this.config, this.mapInstance) } export default Scale; diff --git a/src/components/Control/index.js b/src/components/Control/index.js deleted file mode 100644 index 2aaa1f6..0000000 --- a/src/components/Control/index.js +++ /dev/null @@ -1,45 +0,0 @@ -import { render as reactRender } from 'react-dom'; -import { getSize } from '../_base/util'; -import BaseControl from './BaseControl'; -import CONTROL_ANCHOR from '../../constants/ControlAnchor'; - -const BaseCtrl = function (defaultAnchor, defaultOffset) { - this.defaultAnchor = defaultAnchor; - this.defaultOffset = defaultOffset; -}; - -class Control extends BaseControl { - init() { - const { - anchor = CONTROL_ANCHOR.TOP_LEFT, - offset = { - width: 0, - height: 0, - }, - } = this.props; - - if (!BaseCtrl.prototype.initialize) { - BaseCtrl.prototype = new global.BMap.Control(); - BaseCtrl.prototype.initialize = this.initialize.bind(this); - } - - this.instance = new BaseCtrl(global[anchor], getSize(offset.width, offset.height)); - this.map.addControl(this.instance); - } - - initialize() { - // // 创建一个DOM元素 - const container = document.createElement('div'); - this.container = container; - - if (this.render) { - reactRender(this.render(), container); - } - // 添加DOM元素到地图中 - this.map.getContainer().appendChild(container); - // 将DOM元素返回 - return container; - } -} - -export default Control; diff --git a/src/components/Copyright/index.js b/src/components/Copyright/index.js new file mode 100644 index 0000000..ad4d2d3 --- /dev/null +++ b/src/components/Copyright/index.js @@ -0,0 +1,52 @@ +import React, { PureComponent } from 'react'; +import PropTypes from 'prop-types'; + +export default class Copyright extends PureComponent { + static contextTypes = { + getMapInstance: PropTypes.func, + addCopyright: PropTypes.func, + updateCopyright: PropTypes.func, + removeCopyright: PropTypes.func, + } + + componentDidMount() { + const { context } = this; + const { index } = this.props; + context.addCopyright(index, this.getCopyright()); + } + + componentDidUpdate() { + const { context } = this; + const { index } = this.props; + context.updateCopyright(index, this.getCopyright()); + } + + componentWillUnmount() { + const { context } = this; + const { index } = this.props; + context.removeCopyright(index); + } + + getCopyright = () => { + const { context } = this; + const { index, bounds } = this.props; + return { + id: index, + bounds: bounds || context.getMapInstance().getBounds(), + content: this.container.innerHTML, + }; + } + + getContainer = (ref) => { + this.container = ref; + } + + render() { + const { children } = this.props; + return ( +
    + {children} +
    + ); + } +} diff --git a/src/components/Layer/TileLayer.js b/src/components/Layer/TileLayer.js new file mode 100644 index 0000000..32ac359 --- /dev/null +++ b/src/components/Layer/TileLayer.js @@ -0,0 +1,36 @@ +import { PureComponent } from 'react'; +import PropTypes from 'prop-types'; +import { TileLayer as BTileLayer } from '../../core'; + +class TileLayer extends PureComponent { + static contextTypes = { + getMapInstance: PropTypes.func, + } + + componentDidMount() { + const { context, props } = this; + const { children, ...resetProps } = props; + this.config = { ...this.config, ...resetProps }; + this.mapInstance = context.getMapInstance(); + const layer = new BTileLayer(this.config, this.mapInstance); + this.layer = layer; + this.instance = layer.instance; + } + + componentDidUpdate() { + const { children, ...resetProps } = this.props; + this.config = { ...this.config, ...resetProps }; + this.layer.repaint({ ...this.config }); + } + + componentWillUnmount() { + this.layer.destroy(); + } + + render() { + const { children } = this.props; + return children || null; + } +} + +export default TileLayer; diff --git a/src/components/Layer/TrafficLayer.js b/src/components/Layer/TrafficLayer.js new file mode 100644 index 0000000..b7db44c --- /dev/null +++ b/src/components/Layer/TrafficLayer.js @@ -0,0 +1,36 @@ +import { PureComponent } from 'react'; +import PropTypes from 'prop-types'; +import { TrafficLayer as BTrafficLayer } from '../../core'; + +class TrafficLayer extends PureComponent { + static contextTypes = { + getMapInstance: PropTypes.func, + } + + componentDidMount() { + const { context, props } = this; + const { children, ...resetProps } = props; + this.config = { ...this.config, ...resetProps }; + this.mapInstance = context.getMapInstance(); + const layer = new BTrafficLayer(this.config, this.mapInstance); + this.layer = layer; + this.instance = layer.instance; + } + + componentDidUpdate() { + const { children, ...resetProps } = this.props; + this.config = { ...this.config, ...resetProps }; + this.layer.repaint({ ...this.config }); + } + + componentWillUnmount() { + this.layer.destroy(); + } + + render() { + const { children } = this.props; + return children || null; + } +} + +export default TrafficLayer; diff --git a/src/components/Layers/Tile.js b/src/components/Layers/Tile.js deleted file mode 100644 index cc46f47..0000000 --- a/src/components/Layers/Tile.js +++ /dev/null @@ -1,67 +0,0 @@ -import ReactComponent from '../ReactComponent'; -import { getBounds, getSize } from '../_base/util'; -import ControlAnchor from '../../constants/ControlAnchor'; - -@ReactComponent -class Tile { - constructor(props) { - this.props = props; - this.map = global.bMapInstance; - this.init(); - } - - init() { - const { - transparentPng, - tileUrlTemplate, - copyright = { - anchor: global[ControlAnchor.BOTTOM_RIGHT], - offset: { width: 10, height: 10 }, - }, - zIndex, - getTilesUrl, - } = this.props; - - if (Object.keys(copyright).length > 0) { - const opts = { - anchor: copyright.anchor, - offset: getSize(copyright.offset), - }; - this.copyRight = new global.BMap.CopyrightControl(opts); - this.copyRight.addCopyright({ - id: 2, - content: copyright.content, - bounds: copyright.bounds ? getBounds(copyright.bounds) : this.map.getBounds(), - }); - this.map.addControl(this.copyRight); - } - - this.instance = new global.BMap.TileLayer({ - transparentPng, - tileUrlTemplate, - zIndex, - }); - - if (getTilesUrl) { - this.instance.getTilesUrl = getTilesUrl; - } - - this.map.addTileLayer(this.instance); - } - - onPropsUpdate(newProps) { - this.props = newProps; - this.destroy(); - this.init(); - } - - destroy = () => { - this.map.removeTileLayer(this.instance); - this.instance = null; - if (this.copyRight) { - this.map.removeControl(this.copyRight); - } - } -} - -export default Tile; diff --git a/src/components/Lib/CurveLine.js b/src/components/Lib/CurveLine.js deleted file mode 100644 index 16f65e2..0000000 --- a/src/components/Lib/CurveLine.js +++ /dev/null @@ -1,57 +0,0 @@ -/* eslint-disable */ -import { default as BCurveLine } from 'bmaplib.curveline'; -/* eslint-enable */ -import BaseOverlay from '../Overlay/BaseOverlay'; -import { getPoint, bindEvents } from '../_base/util'; -import ReactComponent from '../ReactComponent'; - -@ReactComponent -class CurveLine extends BaseOverlay { - init() { - const { - points, - strokeColor, - strokeWeight, - strokeOpacity, - strokeStyle, - massClear = true, - clicking = true, - editing = false, - events, - } = this.props; - - const opts = { - strokeColor, - strokeWeight, - strokeOpacity, - strokeStyle, - enableMassClear: massClear, - enableClicking: clicking, - }; - - let pList = []; - - if (points) { - pList = points.map(item => getPoint(item.lng, item.lat)); - } - - this.instance = new BCurveLine(pList, opts); - this.map.addOverlay(this.instance); - - if (editing) { - this.instance.enableEditing(); - } else { - this.instance.disableEditing(); - } - - bindEvents(this.instance, 'POLYLINE', events); - } - - destroy() { - this.instance.disableEditing(); - this.map.removeOverlay(this.instance); - this.instance = null; - } -} - -export default CurveLine; diff --git a/src/components/Lib/DistanceTool.js b/src/components/Lib/DistanceTool.js deleted file mode 100644 index a5cffee..0000000 --- a/src/components/Lib/DistanceTool.js +++ /dev/null @@ -1,24 +0,0 @@ -import { bindEvents } from '../_base/util'; -import BaseOverlay from '../Overlay/BaseOverlay'; -import ReactComponent from '../ReactComponent'; - -@ReactComponent -class DistanceTool extends BaseOverlay { - init() { - const { - events, - ...opts - } = this.props; - - const BDistanceTool = require('../../libs/DistanceTool.js'); - this.instance = new BDistanceTool(this.map, opts); - bindEvents(this.instance, 'DISTANCE_TOOL', events); - } - - destroy() { - this.instance.close(); - this.instance = null; - } -} - -export default DistanceTool; diff --git a/src/components/Lib/DrawingManager.js b/src/components/Lib/DrawingManager.js deleted file mode 100644 index 0e6fd69..0000000 --- a/src/components/Lib/DrawingManager.js +++ /dev/null @@ -1,64 +0,0 @@ -import BaseOverlay from '../Overlay/BaseOverlay'; -import { getSize, appendCss, bindEvents } from '../_base/util'; -import ReactComponent from '../ReactComponent'; -import ControlAnchor from '../../constants/ControlAnchor'; - -@ReactComponent -class DrawingManager extends BaseOverlay { - constructor(props) { - appendCss({ - url: 'http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css', - }); - super(props); - } - - init() { - const defaultStyle = { - strokeColor: 'red', // 边线颜色。 - fillColor: 'red', // 填充颜色。当参数为空时,圆形将没有填充效果。 - strokeWeight: 3, // 边线的宽度,以像素为单位。 - strokeOpacity: 0.8, // 边线透明度,取值范围0 - 1。 - fillOpacity: 0.6, // 填充的透明度,取值范围0 - 1。 - strokeStyle: 'solid', // 边线的样式,solid或dashed。 - }; - - const { - anchor = ControlAnchor.TOP_RIGHT, - offset = { - width: 10, - height: 10, - }, - circleOptions = defaultStyle, - polylineOptions = defaultStyle, - polygonOptions = defaultStyle, - rectangleOptions = defaultStyle, - markerOptions = defaultStyle, - drawingModes, - events, - } = this.props; - - const BDrawingManager = require('../../libs/DrawingManager.js'); - this.instance = new BDrawingManager(this.map, { - enableDrawingTool: true, - drawingToolOptions: { - anchor: global[anchor], - offset: getSize(offset.width, offset.height), - drawingModes, - }, - circleOptions, - polylineOptions, - polygonOptions, - rectangleOptions, - markerOptions, - }); - - bindEvents(this.instance, 'DRAWING_MANAGER', events); - } - - destroy() { - this.map.removeControl(this.instance._drawingTool); - this.instance = null; - } -} - -export default DrawingManager; diff --git a/src/components/Lib/Heatmap.js b/src/components/Lib/Heatmap.js deleted file mode 100644 index a5489bf..0000000 --- a/src/components/Lib/Heatmap.js +++ /dev/null @@ -1,43 +0,0 @@ -/* eslint-disable */ -import { default as BHeatmap } from 'bmaplib.heatmap'; -/* eslint-enable */ -import BaseOverlay from '../Overlay/BaseOverlay'; -import { isSupportCanvas } from '../_base/util'; -import ReactComponent from '../ReactComponent'; - -@ReactComponent -class Heatmap extends BaseOverlay { - init() { - if (!isSupportCanvas()) { - this.instance = null; - return; - } - - const { - points, - opacity, - max, - radius, - gradient, - } = this.props; - - const opts = { - opacity, - radius, - gradient, - }; - - this.instance = new BHeatmap(opts); - this.map.addOverlay(this.instance); - - if (points) { - // 需要先addOverlay后再执行 - this.instance.setDataSet({ - data: points, - max, - }); - } - } -} - -export default Heatmap; diff --git a/src/components/Lib/MarkerClusterer.js b/src/components/Lib/MarkerClusterer.js deleted file mode 100644 index d4ba85d..0000000 --- a/src/components/Lib/MarkerClusterer.js +++ /dev/null @@ -1,46 +0,0 @@ -/* eslint-disable */ -import { default as BMarkerClusterer } from 'bmaplib.markerclusterer'; -/* eslint-enable */ -import BaseOverlay from '../Overlay/BaseOverlay'; -import { getSize, createMarker } from '../_base/util'; -import ReactComponent from '../ReactComponent'; - -@ReactComponent -class MarkerClusterer extends BaseOverlay { - init() { - const { - children, - gridSize, - maxZoom, - minClusterSize, - styles = [], - averageCenter = false, - } = this.props; - const childrenMakers = children && !Array.isArray(children) ? [children] : children; - const markers = []; - childrenMakers.forEach((m) => { - markers.push(createMarker(m.props)); - }); - - const opts = { - gridSize, - maxZoom, - minClusterSize, - styles: styles.map((item) => { - item.size = getSize(item.size.width, item.size.height); - return item; - }), - isAverageCenter: averageCenter, - markers, - }; - - this.instance = new BMarkerClusterer(this.map, opts); - } - - destroy() { - this.instance.clearMarkers(); - this.instance = null; - } -} - -export default MarkerClusterer; diff --git a/src/components/Lib/TrafficControl.js b/src/components/Lib/TrafficControl.js deleted file mode 100644 index 2bbf6d8..0000000 --- a/src/components/Lib/TrafficControl.js +++ /dev/null @@ -1,30 +0,0 @@ -import { appendCss } from '../_base/util'; -import ReactComponent from '../ReactComponent'; -import ControlAnchor from '../../constants/ControlAnchor'; -import BaseControl from '../Control/BaseControl'; - -@ReactComponent -class TrafficControl extends BaseControl { - constructor(props) { - appendCss({ - url: 'http://api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.css', - }); - super(props); - } - - init() { - const { - anchor = ControlAnchor.BOTTOM_RIGHT, - } = this.props; - - const BTrafficControl = require('../../libs/TrafficControl.js'); - this.instance = new BTrafficControl({ - showPanel: false, - }); - - this.map.addControl(this.instance); - this.instance.setAnchor(global[anchor]); - } -} - -export default TrafficControl; diff --git a/src/components/Map/PlaceHolder.js b/src/components/Map/PlaceHolder.js new file mode 100644 index 0000000..454b5f0 --- /dev/null +++ b/src/components/Map/PlaceHolder.js @@ -0,0 +1,18 @@ +import React, { PureComponent } from 'react'; + +const style = { + height: '100%', + width: '100%', + display: 'flex', + justifyContent: 'center', + alignItems: 'center', +}; + +export default class PlaceHolder extends PureComponent { + static displayName= 'PlaceHolder' + + render() { + const { children } = this.props; + return children ||
    地图加载中...
    ; + } +} diff --git a/src/components/Map/index.js b/src/components/Map/index.js index 34052c2..3c40db9 100644 --- a/src/components/Map/index.js +++ b/src/components/Map/index.js @@ -1,228 +1,151 @@ -import React from 'react'; +import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; -import { - getPoint, - isPoint, - bindEvents, - processSetOptions, - createContextMenu, - processBooleanOptions, - unBindEvents, -} from '../_base/util'; +import initMap, { Util } from '../../core'; +import ContextMenu from '../ContextMenu'; +import PlaceHolder from './PlaceHolder'; const fillStyle = { width: '100%', height: '100%', }; -export default class Map extends React.Component { - static defaultProps = { - placeHolder: '地图加载中...', - // 与官方文档保持一致 - dragging: true, - scrollWheelZoom: false, - doubleClickZoom: true, - keyboard: false, - inertialDragging: false, - continuousZoom: true, - pinchToZoom: true, - autoResize: true, - highResolution: true, - mapClick: true, - center: { lng: 116.404, lat: 39.915 }, - zoom: 15, - }; - - static propTypes = { - placeHolder: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.object, - ]), - children: PropTypes.any, - ak: PropTypes.string, - minZoom: PropTypes.number, - maxZoom: PropTypes.number, - defaultCursor: PropTypes.string, - draggingCursor: PropTypes.string, - mapStyle: PropTypes.object, - center: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.object, - ]), - mapType: PropTypes.string, - zoom: PropTypes.number, - highResolution: PropTypes.bool, - autoResize: PropTypes.bool, - mapClick: PropTypes.bool, - mapMounted: PropTypes.func, - dragging: PropTypes.bool, - scrollWheelZoom: PropTypes.bool, - doubleClickZoom: PropTypes.bool, - keyboard: PropTypes.bool, - inertialDragging: PropTypes.bool, - continuousZoom: PropTypes.bool, - pinchToZoom: PropTypes.bool, - events: PropTypes.object, - contextMenu: PropTypes.object, - }; - - constructor(props) { - super(props); - // React 16 - if (React.createRef) { - this.mapContainerRef = React.createRef(); - } else { - this.mapContainerRef = (ref) => { - this.mapContainer = ref; - }; - } - } +export default class Map extends PureComponent { + static PlaceHolder = PlaceHolder; - componentDidMount() { - const { ak } = this.props; - if (ak) { - this.getMapScript().then(this.init); - } else if (global.BMap) { - this.init(global.BMap); - } else { - console.warn('BMap is undefined'); - } - } + static ContextMenu = ContextMenu; - componentWillReceiveProps(nextProps) { - const { map } = this; - if (map) { - const props = this.processProps(nextProps); - this.processMapOptions(props); - this.processContextMenu(props.contextMenu); - unBindEvents(map); - if (props.events) bindEvents(map, 'MAP', props.events); - } + static childContextTypes = { + getMapInstance: PropTypes.func, + centralizedUpdates: PropTypes.func, } - init = (BMap) => { - const { - highResolution, autoResize, mapClick, mapMounted, contextMenu, events, ...resetProps - } = this.props; - this.defaultCenter = getPoint(116.404, 39.915); - this.mapContainer = this.mapContainer || this.mapContainerRef.current; - const map = new BMap.Map(this.mapContainer, { - enableHighResolution: highResolution, - enableAutoResize: autoResize, - enableMapClick: mapClick, - }); - - this.map = map; - // 当初始化center为null或string时,保证地图正常渲染,用默认center处理centerAndZoom - if (!resetProps.center || typeof resetProps.center === 'string') { - map.centerAndZoom(this.defaultCenter, resetProps.zoom); - } - this.processContextMenu(contextMenu); + config = {} - global.bMapInstance = map; - this.processMapOptions(resetProps); - bindEvents(map, 'MAP', events); + // 仅用作config的组件 + configComponent = ['Point', 'PlaceHolder'] - // 地图配置完成后,强制刷新,渲染子组件 - this.forceUpdate(() => { - if (mapMounted) { - mapMounted(global.bMapInstance); - } - }); + getChildContext() { + return { + getMapInstance: this.getMapInstance, + centralizedUpdates: this.centralizedUpdates, + }; } - processContextMenu = (contextMenu) => { - if (contextMenu) { - this.menu = createContextMenu(contextMenu.items, contextMenu.events); - if (this.menu) { - this.map.removeContextMenu(this.menu); - } - this.map.addContextMenu(this.menu); - } + componentDidMount() { + const { children, ...resetProps } = this.props; + this.config = { ...this.config, ...resetProps }; + this.createMapInstance(this.config); } - processMapOptions = (props) => { - const { map } = this; - processSetOptions(map, 'MAP_SET_OPTIONS', props); - processBooleanOptions(map, 'MAP_BOOLEAN_OPTIONS', props); - - if (props.center) { - let { center } = props; - if (isPoint(center)) { - center = getPoint(center.lng, center.lat); - } - if (props.zoom) { - map.centerAndZoom(center, props.zoom); - } else { - map.setCenter(center); - } - } - - if (props.mapType) { - map.setMapType(global[props.mapType]); + componentDidUpdate() { + const { children, ...resetProps } = this.props; + this.config = { ...this.config, ...resetProps }; + if (this.map) { + this.map.repaint(this.config); } } - getMapScript = () => { - const { ak } = this.props; - global.BMap = global.BMap || {}; - if (Object.keys(global.BMap).length === 0) { - global.BMap._preloader = new Promise((resolve) => { - const $script = document.createElement('script'); - global.document.body.appendChild($script); - global._initBaiduMap = function initBaiduMap() { - resolve(global.BMap); - global.document.body.removeChild($script); - global.BMap._preloader = null; - global._initBaiduMap = null; - }; - - $script.src = `https://api.map.baidu.com/api?v=3.0&ak=${ak}&callback=_initBaiduMap`; - }); - - return global.BMap._preloader; - } if (!global.BMap._preloader) { - return Promise.resolve(global.BMap); - } - return global.BMap._preloader; + /** + * 内部子组件属性更新触发方法 + */ + centralizedUpdates = ({ name, data }) => { + const configName = Util.firstLowerCase(name); + this.config[configName] = data; } - - processProps(nextProps) { - const { center, zoom } = this.props; - const props = Object.assign({}, nextProps); - if (JSON.stringify(props.center) === JSON.stringify(center)) { - delete props.center; + /** + * 初始化地图实例 + */ + createMapInstance = async (config) => { + const { mounted, name } = this.props; + this.map = await initMap(this.mapContainer, config); + const mapInstance = this.map.instance; + if (name) { + global[`${name}`] = mapInstance; } + this.forceUpdate(() => { + if (mounted) { + mounted(mapInstance); + } + }); + } - if (props.zoom === zoom) { - delete props.zoom; - } - return props; + /** + * 获得地图容器ref + */ + getMapContainer = (ref) => { + this.mapContainer = ref; } + /** + * 获得地图实例 + */ + getMapInstance = () => this.map && this.map.instance + renderChildren = () => { const { children } = this.props; - if (!this.map || !children) { - return null; - } return React.Children.map(children, (child) => { - if (child) { - return React.cloneElement(child); + if (this.map || (child && this.configComponent.indexOf(child.type.displayName) > -1)) { + return child; } return null; }); } render() { - const { placeHolder } = this.props; return ( -
    -
    - {placeHolder} -
    - {this.renderChildren()} +
    + { this.renderChildren() }
    ); } } + + +Map.propTypes = { + //  + ak: PropTypes.string, + // 地图实例别名 + // 设置后可通过window[name]进行获取 + name: PropTypes.string, + // 当前缩放等级 + zoom: PropTypes.number, + // 当前百度地图版本, 2 or 3 + version: PropTypes.number, + // 最小缩放等级 + minZoom: PropTypes.number, + // 最大缩放等级 + maxZoom: PropTypes.number, + // 设置地图默认的鼠标指针样式 + defaultCursor: PropTypes.string, + // 设置拖拽地图时的鼠标指针样式 + draggingCursor: PropTypes.string, + // 设置地图样式,样式包括地图底图颜色和地图要素是否展示两部分 + mapStyle: PropTypes.object, + // 设置地图个性化样式V2版本,仅支持现代浏览器(支持Canvas) + mapStyleV2: PropTypes.object, + // 设置地图类型 + mapType: PropTypes.string, + // 地图初始化完成回调函数 + mounted: PropTypes.func, + // 是否启用使用高分辨率地图 + highResolution: PropTypes.bool, + // 自动适应地图容器变化 + autoResize: PropTypes.bool, + // 地图可点 + mapClick: PropTypes.bool, + // 拖拽 + dragging: PropTypes.bool, + // 滚轮缩放 + scrollWheelZoom: PropTypes.bool, + // 双击放大 + doubleClickZoom: PropTypes.bool, + // 键盘操作 + keyboard: PropTypes.bool, + // 惯性拖拽 + inertialDragging: PropTypes.bool, + // 连续缩放 + continuousZoom: PropTypes.bool, + // 双指操作 + pinchToZoom: PropTypes.bool, +}; diff --git a/src/components/Overlay/BaseOverlay.js b/src/components/Overlay/BaseOverlay.js index b2b7bc8..677acf3 100644 --- a/src/components/Overlay/BaseOverlay.js +++ b/src/components/Overlay/BaseOverlay.js @@ -1,43 +1,59 @@ +import React, { PureComponent } from 'react'; +import PropTypes from 'prop-types'; +import { Util } from '../../core'; -import { render as reactRender } from 'react-dom'; -import { unBindEvents } from '../_base/util'; +class BaseOverlay extends PureComponent { + static contextTypes = { + getMapInstance: PropTypes.func, + } + + static childContextTypes = { + centralizedUpdates: PropTypes.func, + } -class BaseOverlay { - constructor(props) { - this.props = props; - this.state = {}; - this.map = global.bMapInstance; + overlay = null - this.init(); + mapInstance = null + + config = {} + + getChildContext() { + return { + centralizedUpdates: this.centralizedUpdates, + }; } - removeOverlay() { - if (this.instance instanceof global.BMap.InfoWindow) { - this.map.closeInfoWindow(); - } else { - this.map.removeOverlay(this.instance); - } + componentDidMount() { + const { context, props } = this; + const { children, ...resetProps } = props; + this.config = { ...this.config, ...resetProps }; + this.mapInstance = context.getMapInstance(); + const overlay = this.getRealOverlay(); + this.overlay = overlay; + this.instance = overlay.instance; } - onPropsUpdate(newProps) { - this.props = newProps; - unBindEvents(this.instance); - this.destroy(); - this.init(); + componentDidUpdate() { + const { children, ...resetProps } = this.props; + this.config = { ...this.config, ...resetProps }; + this.overlay.repaint({ ...this.config }); } - setState(param) { - if (param !== null) { - this.state = Object.assign(this.state, param); - } - if (this.render) { - reactRender(this.render(), this.container); - } + componentWillUnmount() { + this.overlay.destroy(); } - destroy() { - this.removeOverlay(); - this.instance = null; + centralizedUpdates = ({ name, data }) => { + const configName = Util.firstLowerCase(name); + this.config[configName] = data; + } + + render() { + const { children } = this.props; + if (children) { + return
    {children}
    ; + } + return null; } } diff --git a/src/components/Overlay/Boundary.js b/src/components/Overlay/Boundary.js index 93e420c..cae396b 100644 --- a/src/components/Overlay/Boundary.js +++ b/src/components/Overlay/Boundary.js @@ -1,60 +1,77 @@ -import { getPoint, createPolygon, processBooleanOptions } from '../_base/util'; -import ReactComponent from '../ReactComponent'; -import BaseOverlay from './BaseOverlay'; - -@ReactComponent -class Boundary extends BaseOverlay { - init() { - const { - name, - onError, - autoViewport, - massClear = true, - editing = false, - ...polygonOpts - } = this.props; - - this.getBoundary() - .then((points) => { - polygonOpts.points = points; - this.instance = createPolygon(polygonOpts); - this.map.addOverlay(this.instance); - processBooleanOptions(this.instance, 'POLY_BOOLEAN_OPTIONS', { - massClear, - editing, - }); - if (autoViewport) { - points = points.map(item => getPoint(item.lng, item.lat)); - this.map.setViewport(points); - } - }).catch((msg) => { - if (onError) { - onError(msg); - } - }); +import React, { PureComponent } from 'react'; +import PropTypes from 'prop-types'; +import Polygon from './Polygon'; +import Base from '../Base'; +import { Util } from '../../core'; + +const { Point, Path } = Base; + +class Boundary extends PureComponent { + static contextTypes = { + getMapInstance: PropTypes.func, + } + + state = { + area: [], + } + + componentDidMount() { + const { name } = this.props; + this.getPoints(name); } - getBoundary() { + componentDidUpdate() { const { name } = this.props; - return new Promise((resolve, reject) => { - const boundary = new global.BMap.Boundary(); - - boundary.get(name, (res) => { - const count = res.boundaries.length; - if (count === 0) { - reject(); - } - const points = res.boundaries[0].split(';').map((item) => { - const pointArr = item.split(','); - return { - lng: pointArr[0], - lat: pointArr[1], - }; - }); - resolve(points); + if (name !== this.name) { + this.getPoints(name); + } + } + + getPoints = (name) => { + Util.getBoundary(name).then(({ points, area }) => { + this.name = name; + this.processAutoViewport(points); + this.setState({ + area, }); }); } + + processAutoViewport(points = []) { + const { context, props } = this; + const { autoViewport } = props; + if (autoViewport) { + context.getMapInstance().setViewport(points); + } + } + + render() { + const { area } = this.state; + const { children, ...resetProps } = this.props; + return ( + area.length > 0 ? ( +
    + { + area.map((points, index) => ( + + + { + points.map((item, idx) => ( + + )) + } + + { children } + + )) + } +
    + ) : null + ); + } } export default Boundary; diff --git a/src/components/Overlay/Circle.js b/src/components/Overlay/Circle.js index 8391b55..31135f5 100644 --- a/src/components/Overlay/Circle.js +++ b/src/components/Overlay/Circle.js @@ -1,45 +1,8 @@ import BaseOverlay from './BaseOverlay'; -import { getPoint, bindEvents, processBooleanOptions } from '../_base/util'; -import ReactComponent from '../ReactComponent'; +import { Circle as BCircle } from '../../core'; -@ReactComponent class Circle extends BaseOverlay { - init() { - const { - point, - radius, - strokeColor, - fillColor, - strokeWeight, - strokeOpacity, - fillOpacity, - strokeStyle, - massClear = true, - editing = false, - clicking = true, - events, - } = this.props; - - const opts = { - strokeColor, - fillColor, - strokeWeight, - strokeOpacity, - fillOpacity, - strokeStyle, - enableClicking: clicking, - }; - - this.instance = new global.BMap.Circle(getPoint(point.lng, point.lat), radius, opts); - this.map.addOverlay(this.instance); - - const booleanOpts = { - editing, - massClear, - }; - processBooleanOptions(this.instance, 'CIRCLE_BOOLEAN_OPTIONS', booleanOpts); - bindEvents(this.instance, 'CIRCLE', events); - } + getRealOverlay = () => new BCircle(this.config, this.mapInstance) } export default Circle; diff --git a/src/components/Overlay/Custom.js b/src/components/Overlay/Custom.js new file mode 100644 index 0000000..7df44d4 --- /dev/null +++ b/src/components/Overlay/Custom.js @@ -0,0 +1,54 @@ +import React from 'react'; +import { initCustomOverlay, Util, Constants } from '../../core'; +import BaseOverlay from './BaseOverlay'; + +const { MAP_PANES } = Constants; + +const CustomHOC = WrappedComponent => class extends BaseOverlay { + config = {} + + overlay = null + + componentDidMount() { + const { context } = this; + const { children, ...resetProps } = this.props; + this.config = { ...this.config, ...resetProps }; + this.mapInstance = context.getMapInstance(); + this.overlay = initCustomOverlay(this.config, this.initialize, this.draw, this.mapInstance); + } + + getContainer = (ref) => { + this.container = ref; + } + + initialize = () => { + const { container, mapInstance } = this; + mapInstance.getPanes()[MAP_PANES.MARKER].appendChild(container); + return container; + } + + draw = () => { + const { container, mapInstance } = this; + const { point } = this.config; + const bdPoint = Util.convert2BPoint({ ...point }); + const position = mapInstance.pointToOverlayPixel(bdPoint); + container.style.left = `${position.x - (container.offsetWidth / 2)}px`; + container.style.top = `${position.y - (container.offsetHeight / 2)}px`; + } + + render() { + const { context } = this; + const { children } = this.props; + return ( +
    + + { children } +
    + ); + } +}; + +export default CustomHOC; diff --git a/src/components/Overlay/Ground.js b/src/components/Overlay/Ground.js index 6c7be4d..094d7ff 100644 --- a/src/components/Overlay/Ground.js +++ b/src/components/Overlay/Ground.js @@ -1,31 +1,8 @@ +import { GroundOverlay as BGroundOverlay } from '../../core'; import BaseOverlay from './BaseOverlay'; -import { bindEvents, getBounds } from '../_base/util'; -import ReactComponent from '../ReactComponent'; -@ReactComponent class Ground extends BaseOverlay { - init() { - const { - bounds, - opacity, - imageURL, - minZoom, - maxZoom, - events, - } = this.props; - - const opts = { - opacity, - displayOnMinLevel: minZoom, - displayOnMaxLevel: maxZoom, - }; - - this.instance = new global.BMap.GroundOverlay(getBounds(bounds), opts); - this.map.addOverlay(this.instance); - - this.instance.setImageURL(imageURL); - bindEvents(this.instance, 'GROUND', events); - } + getRealOverlay = () => new BGroundOverlay(this.config, this.mapInstance) } export default Ground; diff --git a/src/components/Overlay/HTMLComponent.js b/src/components/Overlay/HTMLComponent.js new file mode 100644 index 0000000..f4200ec --- /dev/null +++ b/src/components/Overlay/HTMLComponent.js @@ -0,0 +1,55 @@ +import React, { PureComponent } from 'react'; +import PropTypes from 'prop-types'; + +const containerStyle = { + position: 'absolute', + top: -10000, +}; + +class HTMLComponent extends PureComponent { + static contextTypes = { + centralizedUpdates: PropTypes.func, + } + + static displayName = 'HTMLComponent'; + + componentDidMount() { + const { context } = this; + this.instance = this.content.innerHTML; + context.centralizedUpdates({ + name: this.name, + data: this.content.innerHTML, + }); + } + + componentDidUpdate() { + const { context } = this; + context.centralizedUpdates({ + name: this.name, + data: this.content.innerHTML, + }); + } + + componentWillUnmount() { + const { context } = this; + context.centralizedUpdates({ + name: this.name, + data: null, + }); + } + + getContent = (ref) => { + this.content = ref; + } + + render() { + const { children } = this.props; + return ( +
    + { children || null } +
    + ); + } +} + +export default HTMLComponent; diff --git a/src/components/Overlay/InfoWindow.js b/src/components/Overlay/InfoWindow.js deleted file mode 100644 index 20d1f0a..0000000 --- a/src/components/Overlay/InfoWindow.js +++ /dev/null @@ -1,41 +0,0 @@ -import BaseOverlay from './BaseOverlay'; -import { bindEvents, getSize, getPoint } from '../_base/util'; -import ReactComponent from '../ReactComponent'; - -@ReactComponent -class InfoWindow extends BaseOverlay { - init() { - const { - point, - content, - height, - width, - maxWidth, - offset, - title, - autoPan = true, - closeOnClick = true, - displayMessage = true, - message, - events, - } = this.props; - - const opts = { - width, - height, - maxWidth, - offset: offset && getSize(offset.width, offset.height), - title, - enableAutoPan: autoPan, - enableCloseOnClick: closeOnClick, - enableMessage: displayMessage, - message, - }; - - this.instance = new global.BMap.InfoWindow(content, opts); - this.map.openInfoWindow(this.instance, getPoint(point.lng, point.lat)); - bindEvents(this.instance, 'INFO_WINDOW', events); - } -} - -export default InfoWindow; diff --git a/src/components/Overlay/InfoWindow/Content.js b/src/components/Overlay/InfoWindow/Content.js new file mode 100644 index 0000000..dd0f797 --- /dev/null +++ b/src/components/Overlay/InfoWindow/Content.js @@ -0,0 +1,7 @@ +import HTMLComponent from '../HTMLComponent'; + +class Content extends HTMLComponent { + name = 'content'; +} + +export default Content; diff --git a/src/components/Overlay/InfoWindow/MaxContent.js b/src/components/Overlay/InfoWindow/MaxContent.js new file mode 100644 index 0000000..d97d340 --- /dev/null +++ b/src/components/Overlay/InfoWindow/MaxContent.js @@ -0,0 +1,7 @@ +import HTMLComponent from '../HTMLComponent'; + +class MaxContent extends HTMLComponent { + name = 'maxContent'; +} + +export default MaxContent; diff --git a/src/components/Overlay/InfoWindow/Title.js b/src/components/Overlay/InfoWindow/Title.js new file mode 100644 index 0000000..67d59c5 --- /dev/null +++ b/src/components/Overlay/InfoWindow/Title.js @@ -0,0 +1,7 @@ +import HTMLComponent from '../HTMLComponent'; + +class Title extends HTMLComponent { + name = 'title'; +} + +export default Title; diff --git a/src/components/Overlay/InfoWindow/index.js b/src/components/Overlay/InfoWindow/index.js new file mode 100644 index 0000000..5a6ffe0 --- /dev/null +++ b/src/components/Overlay/InfoWindow/index.js @@ -0,0 +1,17 @@ +import BaseOverlay from '../BaseOverlay'; +import { InfoWindow as BInfoWindow } from '../../../core'; +import Content from './Content'; +import Title from './Title'; +import MaxContent from './MaxContent'; + +class InfoWindow extends BaseOverlay { + static Content = Content; + + static Title = Title; + + static MaxContent = MaxContent; + + getRealOverlay = () => new BInfoWindow(this.config, this.mapInstance); +} + +export default InfoWindow; diff --git a/src/components/Overlay/Label.js b/src/components/Overlay/Label.js deleted file mode 100644 index 691bb47..0000000 --- a/src/components/Overlay/Label.js +++ /dev/null @@ -1,13 +0,0 @@ -import BaseOverlay from './BaseOverlay'; -import { createLabel } from '../_base/util'; -import ReactComponent from '../ReactComponent'; - -@ReactComponent -class Label extends BaseOverlay { - init() { - this.instance = createLabel(this.props); - this.map.addOverlay(this.instance); - } -} - -export default Label; diff --git a/src/components/Overlay/Label/Content.js b/src/components/Overlay/Label/Content.js new file mode 100644 index 0000000..955eb00 --- /dev/null +++ b/src/components/Overlay/Label/Content.js @@ -0,0 +1,7 @@ +import HTMLComponent from '../HTMLComponent'; + +class Content extends HTMLComponent { + name = 'content' +} + +export default Content; diff --git a/src/components/Overlay/Label/index.js b/src/components/Overlay/Label/index.js new file mode 100644 index 0000000..2b71622 --- /dev/null +++ b/src/components/Overlay/Label/index.js @@ -0,0 +1,44 @@ +import PropTypes from 'prop-types'; +import BaseOverlay from '../BaseOverlay'; +import { Label as BLabel } from '../../../core'; +import Content from './Content'; + +class Label extends BaseOverlay { + static Content = Content; + + static contextTypes = { + getMapInstance: PropTypes.func, + centralizedUpdates: PropTypes.func, + } + + componentDidMount() { + const { context, props } = this; + const { children, ...resetProps } = props; + this.config = { ...this.config, ...resetProps }; + this.mapInstance = context.getMapInstance(); + const overlay = this.getRealOverlay(); + this.overlay = overlay; + this.instance = overlay.instance; + + context.centralizedUpdates({ + name: 'label', + data: this.instance, + }); + } + + componentDidUpdate() { + const { context } = this; + const { children, ...resetProps } = this.props; + this.config = { ...this.config, ...resetProps }; + this.overlay.repaint({ ...this.config }); + + context.centralizedUpdates({ + name: 'label', + data: this.overlay.instance, + }); + } + + getRealOverlay = () => new BLabel(this.config, this.mapInstance) +} + +export default Label; diff --git a/src/components/Overlay/Marker.js b/src/components/Overlay/Marker.js deleted file mode 100644 index dd7b3f0..0000000 --- a/src/components/Overlay/Marker.js +++ /dev/null @@ -1,24 +0,0 @@ -import BaseOverlay from './BaseOverlay'; -import { - createMarker, -} from '../_base/util'; -import ReactComponent from '../ReactComponent'; - -@ReactComponent -class Marker extends BaseOverlay { - init() { - const { - animation, - } = this.props; - this.instance = createMarker(this.props); - - this.map.addOverlay(this.instance); - - // animation 需要在addOverlay之后添加,所以这里将setAnimation放置下个队列 - if (animation) { - this.instance.setAnimation(global[animation]); - } - } -} - -export default Marker; diff --git a/src/components/Overlay/Marker/Icon.js b/src/components/Overlay/Marker/Icon.js new file mode 100644 index 0000000..fed67e0 --- /dev/null +++ b/src/components/Overlay/Marker/Icon.js @@ -0,0 +1,54 @@ +import { PureComponent } from 'react'; +import PropTypes from 'prop-types'; +import { Icon as BIcon, Util } from '../../../core'; + +export default class Icon extends PureComponent { + config = {} + + static contextTypes = { + centralizedUpdates: PropTypes.func, + } + + static childContextTypes = { + centralizedUpdates: PropTypes.func, + } + + getChildContext() { + return { + centralizedUpdates: this.centralizedUpdates, + }; + } + + componentDidMount() { + const { context } = this; + context.centralizedUpdates({ + name: 'icon', + data: this.getIcon(), + }); + } + + componentDidUpdate() { + const { context } = this; + context.centralizedUpdates({ + name: 'icon', + data: this.getIcon(), + }); + } + + centralizedUpdates = ({ name, data }) => { + const configName = Util.firstLowerCase(name); + this.config[configName] = data; + } + + getIcon = () => { + const { children, ...resetProps } = this.props; + this.config = { ...this.config, ...resetProps }; + + return new BIcon({ ...this.config }); + } + + render() { + const { children } = this.props; + return children || null; + } +} diff --git a/src/components/Overlay/Marker/index.js b/src/components/Overlay/Marker/index.js new file mode 100644 index 0000000..621eb04 --- /dev/null +++ b/src/components/Overlay/Marker/index.js @@ -0,0 +1,23 @@ +import BaseOverlay from '../BaseOverlay'; +import ContextMenu from '../../ContextMenu'; +import Icon from './Icon'; +import Symbol from '../Symbol'; +import { Marker as BMarker } from '../../../core'; + +class Marker extends BaseOverlay { + static ContextMenu = ContextMenu; + + static Icon = Icon; + + static Symbol = Symbol; + + getRealOverlay = () => { + // symbol 覆盖 icon 属性 + if (this.config.symbol) { + this.config.icon = this.config.symbol; + } + return new BMarker(this.config, this.mapInstance); + } +} + +export default Marker; diff --git a/src/components/Overlay/PointCollection.js b/src/components/Overlay/PointCollection.js index 17f0ba6..1f0eb9f 100644 --- a/src/components/Overlay/PointCollection.js +++ b/src/components/Overlay/PointCollection.js @@ -1,39 +1,8 @@ import BaseOverlay from './BaseOverlay'; -import { getPoint, bindEvents, isSupportContext } from '../_base/util'; -import ReactComponent from '../ReactComponent'; +import { PointCollection as BPointCollection } from '../../core'; -@ReactComponent class PointCollection extends BaseOverlay { - init() { - this.instance = null; - - // 判断浏览器支持海量点 - if (isSupportContext()) { - const { - points, - shape, - color, - size, - events, - } = this.props; - - const opts = { - shape: shape && global[shape], - color, - size: size && global[size], - }; - - let pList = []; - if (points && Array.isArray(points)) { - pList = points.map(item => getPoint(item.lng, item.lat)); - } - - this.instance = new global.BMap.PointCollection(pList, opts); - this.map.addOverlay(this.instance); - - bindEvents(this.instance, 'POINT_COLLECTION', events); - } - } + getRealOverlay = () => new BPointCollection(this.config, this.mapInstance) } export default PointCollection; diff --git a/src/components/Overlay/Polygon.js b/src/components/Overlay/Polygon.js index 9d54041..4127ad1 100644 --- a/src/components/Overlay/Polygon.js +++ b/src/components/Overlay/Polygon.js @@ -1,21 +1,8 @@ import BaseOverlay from './BaseOverlay'; -import { createPolygon, processBooleanOptions } from '../_base/util'; -import ReactComponent from '../ReactComponent'; +import { Polygon as BPolygon } from '../../core'; -@ReactComponent class Polygon extends BaseOverlay { - init() { - const { - massClear = true, - editing = false, - } = this.props; - this.instance = createPolygon(this.props); - this.map.addOverlay(this.instance); - processBooleanOptions(this.instance, 'POLY_BOOLEAN_OPTIONS', { - massClear, - editing, - }); - } + getRealOverlay = () => new BPolygon(this.config, this.mapInstance); } export default Polygon; diff --git a/src/components/Overlay/Polyline.js b/src/components/Overlay/Polyline.js deleted file mode 100644 index b496a39..0000000 --- a/src/components/Overlay/Polyline.js +++ /dev/null @@ -1,47 +0,0 @@ -import BaseOverlay from './BaseOverlay'; -import { getPoint, bindEvents, processBooleanOptions } from '../_base/util'; -import ReactComponent from '../ReactComponent'; - -@ReactComponent -class Polyline extends BaseOverlay { - init() { - const { - points, - strokeColor, - strokeWeight, - strokeOpacity, - strokeStyle, - massClear = true, - editing = false, - clicking = true, - events, - icons = [], - } = this.props; - - const opts = { - strokeColor, - strokeWeight, - strokeOpacity, - strokeStyle, - enableClicking: clicking, - icons, - }; - - let pList = []; - if (points) { - pList = points.map(item => getPoint(item.lng, item.lat)); - } - - this.instance = new global.BMap.Polyline(pList, opts); - this.map.addOverlay(this.instance); - - const booleanOpts = { - massClear, - editing, - }; - processBooleanOptions(this.instance, 'POLYLINE_BOOLEAN_OPTIONS', booleanOpts); - bindEvents(this.instance, 'POLYLINE', events); - } -} - -export default Polyline; diff --git a/src/components/Overlay/Polyline/IconSequence.js b/src/components/Overlay/Polyline/IconSequence.js new file mode 100644 index 0000000..df56fe9 --- /dev/null +++ b/src/components/Overlay/Polyline/IconSequence.js @@ -0,0 +1,56 @@ +import { PureComponent } from 'react'; +import PropTypes from 'prop-types'; +import Symbol from '../Symbol'; +import { IconSequence as BIconSequence, Util } from '../../../core'; + +export default class IconSequence extends PureComponent { + static Symbol = Symbol; + + config = {}; + + static contextTypes = { + centralizedUpdates: PropTypes.func, + } + + static childContextTypes = { + centralizedUpdates: PropTypes.func, + } + + getChildContext() { + return { + centralizedUpdates: this.centralizedUpdates, + }; + } + + componentDidMount() { + const { context } = this; + context.centralizedUpdates({ + name: 'icons', + data: [this.iconSequence()], + }); + } + + componentDidUpdate() { + const { context } = this; + context.centralizedUpdates({ + name: 'icons', + data: [this.iconSequence()], + }); + } + + centralizedUpdates = ({ name, data }) => { + const configName = Util.firstLowerCase(name); + this.config[configName] = data; + } + + iconSequence = () => { + const { children, ...resetProps } = this.props; + this.config = { ...this.config, ...resetProps }; + return new BIconSequence({ ...this.config }); + } + + render() { + const { children } = this.props; + return children || null; + } +} diff --git a/src/components/Overlay/Polyline/index.js b/src/components/Overlay/Polyline/index.js new file mode 100644 index 0000000..4772234 --- /dev/null +++ b/src/components/Overlay/Polyline/index.js @@ -0,0 +1,11 @@ +import IconSequence from './IconSequence'; +import BaseOverlay from '../BaseOverlay'; +import { Polyline as BPolyline } from '../../../core'; + +class Polyline extends BaseOverlay { + static IconSequence = IconSequence; + + getRealOverlay = () => new BPolyline(this.config, this.mapInstance); +} + +export default Polyline; diff --git a/src/components/Overlay/Symbol.js b/src/components/Overlay/Symbol.js index d94c930..7d1edbb 100644 --- a/src/components/Overlay/Symbol.js +++ b/src/components/Overlay/Symbol.js @@ -1,47 +1,54 @@ -import BaseOverlay from './BaseOverlay'; -import { createSymbol, getSize, createMarker } from '../_base/util'; -import ReactComponent from '../ReactComponent'; - -@ReactComponent -class Symbol extends BaseOverlay { - init() { - const { - path, - anchor = { - width: 0, - height: 0, - }, - fillColor, - fillOpacity, - scale, - rotation, - strokeColor, - strokeOpacity, - strokeWeight, - ...markerProps - } = this.props; - - markerProps.icon = createSymbol({ - path, - opts: { - anchor: getSize(anchor.width, anchor.height), - fillColor, - fillOpacity, - scale, - rotation, - strokeColor, - strokeOpacity, - strokeWeight, - }, +import { PureComponent } from 'react'; +import PropTypes from 'prop-types'; +import { Symbol as BSymbol, Util } from '../../core'; + +export default class Symbol extends PureComponent { + config = {} + + static contextTypes = { + centralizedUpdates: PropTypes.func, + } + + static childContextTypes = { + centralizedUpdates: PropTypes.func, + } + + getChildContext() { + return { + centralizedUpdates: this.centralizedUpdates, + }; + } + + componentDidMount() { + const { context } = this; + context.centralizedUpdates({ + name: 'symbol', + data: this.getIcon(), }); + } - this.instance = createMarker(markerProps); - this.map.addOverlay(this.instance); + componentDidUpdate() { + const { context } = this; + context.centralizedUpdates({ + name: 'symbol', + data: this.getIcon(), + }); + } - if (markerProps.animation) { - this.instance.setAnimation(global[markerProps.animation]); - } + centralizedUpdates = ({ name, data }) => { + const configName = Util.firstLowerCase(name); + this.config[configName] = data; } -} -export default Symbol; + getIcon = () => { + const { children, ...resetProps } = this.props; + this.config = { ...this.config, ...resetProps }; + + return new BSymbol({ ...this.config }); + } + + render() { + const { children } = this.props; + return children || null; + } +} diff --git a/src/components/Overlay/index.js b/src/components/Overlay/index.js deleted file mode 100644 index 4e157e4..0000000 --- a/src/components/Overlay/index.js +++ /dev/null @@ -1,47 +0,0 @@ -import { render as reactRender } from 'react-dom'; -import BaseOverlay from './BaseOverlay'; -import { getPoint } from '../_base/util'; -import MAP_PANE from '../../constants/MapPane'; - -const BOverlay = function Empty() {}; -class Overlay extends BaseOverlay { - init() { - if (!BOverlay.prototype.initialize) { - BOverlay.prototype = new global.BMap.Overlay(); - BOverlay.prototype.initialize = this.initialize.bind(this); - BOverlay.prototype.draw = this.draw.bind(this); - } - - this.instance = new BOverlay(); - this.map.addOverlay(this.instance); - } - - initialize() { - const { - pane = MAP_PANE.MARKER, - zIndex, - } = this.props; - const container = document.createElement('div'); - this.container = container; - - if (zIndex) { - container.style.zIndex = zIndex; - } - container.style.position = 'absolute'; - if (this.render) { - reactRender(this.render(), container); - } - this.map.getPanes()[pane].appendChild(container); - return container; - } - - draw() { - const { container, props } = this; - const { point } = props; - const position = this.map.pointToOverlayPixel(getPoint(point.lng, point.lat)); - container.style.left = `${position.x - (container.offsetWidth / 2)}px`; - container.style.top = `${position.y - (container.offsetHeight / 2)}px`; - } -} - -export default Overlay; diff --git a/src/components/ReactComponent/index.js b/src/components/ReactComponent/index.js deleted file mode 100644 index 25e8ec4..0000000 --- a/src/components/ReactComponent/index.js +++ /dev/null @@ -1,35 +0,0 @@ -import { PureComponent } from 'react'; - -export default function ReactComponent(Wrapped) { - return class Proxy extends PureComponent { - constructor(props) { - super(props); - this.map = global.bMapInstance; - this.wrapped = new Wrapped(props); - // 获得实例 - this.getInstance(); - } - - componentDidUpdate() { - if (this.wrapped.onPropsUpdate) { - this.wrapped.onPropsUpdate(this.props); - this.getInstance(); - } - } - - componentWillUnmount() { - this.wrapped.destroy(); - } - - getInstance = () => { - const { getInstance } = this.props; - if (getInstance) { - getInstance(this.wrapped.instance); - } - } - - render() { - return null; - } - }; -} diff --git a/src/components/Service/BaseService.js b/src/components/Service/BaseService.js deleted file mode 100644 index 55dd0b0..0000000 --- a/src/components/Service/BaseService.js +++ /dev/null @@ -1,19 +0,0 @@ -class BaseService { - constructor(props) { - this.props = props; - this.map = global.bMapInstance; - this.init(); - } - - onPropsUpdate(newProps) { - this.props = newProps; - this.destroy(); - this.init(); - } - - destroy = () => { - this.instance = null; - } -} - -export default BaseService; diff --git a/src/components/Service/BusLineSearch.js b/src/components/Service/BusLineSearch.js deleted file mode 100644 index 1017c19..0000000 --- a/src/components/Service/BusLineSearch.js +++ /dev/null @@ -1,42 +0,0 @@ -import BaseService from './BaseService'; -import ReactComponent from '../ReactComponent'; -import { isPoint, getPoint } from '../_base/util'; - -@ReactComponent -class BusLineSearch extends BaseService { - init() { - const { - location = this.map, - onGetBusListComplete, - onGetBusLineComplete, - onBusListHtmlSet, - onBusLineHtmlSet, - onPolylinesSet, - onMarkersSet, - renderOptions = {}, - showInMap = false, - } = this.props; - - let _location = location; - if (isPoint(location)) { - _location = getPoint(_location.lng, _location.lat); - } - - this.instance = new global.BMap.BusLineSearch(_location, { - onGetBusListComplete, - onGetBusLineComplete, - onBusListHtmlSet, - onBusLineHtmlSet, - onPolylinesSet, - onMarkersSet, - renderOptions: { - map: showInMap ? this.map : null, - panel: renderOptions.panel, - selectFirstResult: renderOptions.selectFirstResult, - autoViewport: renderOptions.autoViewport, - }, - }); - } -} - -export default BusLineSearch; diff --git a/src/components/Service/DrivingRoute.js b/src/components/Service/DrivingRoute.js deleted file mode 100644 index 37ea120..0000000 --- a/src/components/Service/DrivingRoute.js +++ /dev/null @@ -1,40 +0,0 @@ -import BaseService from './BaseService'; -import ReactComponent from '../ReactComponent'; -import { isPoint, getPoint } from '../_base/util'; - -@ReactComponent -class DrivingRoute extends BaseService { - init() { - const { - location = this.map, - policy, - onSearchComplete, - onMarkersSet, - onInfoHtmlSet, - onPolylinesSet, - renderOptions = {}, - showInMap = false, - } = this.props; - - let _location = location; - if (isPoint(location)) { - _location = getPoint(_location.lng, _location.lat); - } - - this.instance = new global.BMap.DrivingRoute(_location, { - policy: policy && global[policy], - onSearchComplete, - onMarkersSet, - onInfoHtmlSet, - onPolylinesSet, - renderOptions: { - map: showInMap ? this.map : null, - panel: renderOptions.panel, - selectFirstResult: renderOptions.selectFirstResult, - autoViewport: renderOptions.autoViewport, - }, - }); - } -} - -export default DrivingRoute; diff --git a/src/components/Service/LocalSearch.js b/src/components/Service/LocalSearch.js deleted file mode 100644 index 4ab8f82..0000000 --- a/src/components/Service/LocalSearch.js +++ /dev/null @@ -1,40 +0,0 @@ -import BaseService from './BaseService'; -import ReactComponent from '../ReactComponent'; -import { isPoint, getPoint } from '../_base/util'; - -@ReactComponent -class LocalSearch extends BaseService { - init() { - const { - location = this.map, - onMarkersSet, - onInfoHtmlSet, - onResultsHtmlSet, - pageCapacity, - onSearchComplete, - renderOptions = {}, - showInMap = false, - } = this.props; - - let _location = location; - if (isPoint(location)) { - _location = getPoint(_location.lng, _location.lat); - } - - this.instance = new global.BMap.LocalSearch(_location, { - onMarkersSet, - onInfoHtmlSet, - onResultsHtmlSet, - pageCapacity, - onSearchComplete, - renderOptions: { - map: showInMap ? this.map : null, - panel: renderOptions.panel, - selectFirstResult: renderOptions.selectFirstResult, - autoViewport: renderOptions.autoViewport, - }, - }); - } -} - -export default LocalSearch; diff --git a/src/components/Service/RidingRoute.js b/src/components/Service/RidingRoute.js deleted file mode 100644 index be948df..0000000 --- a/src/components/Service/RidingRoute.js +++ /dev/null @@ -1,38 +0,0 @@ -import BaseService from './BaseService'; -import ReactComponent from '../ReactComponent'; -import { isPoint, getPoint } from '../_base/util'; - -@ReactComponent -class RidingRoute extends BaseService { - init() { - const { - location = this.map, - onSearchComplete, - onMarkersSet, - onInfoHtmlSet, - onPolylinesSet, - renderOptions = {}, - showInMap = false, - } = this.props; - - let _location = location; - if (isPoint(location)) { - _location = getPoint(_location.lng, _location.lat); - } - - this.instance = new global.BMap.RidingRoute(_location, { - onSearchComplete, - onMarkersSet, - onInfoHtmlSet, - onPolylinesSet, - renderOptions: { - map: showInMap ? this.map : null, - panel: renderOptions.panel, - selectFirstResult: renderOptions.selectFirstResult, - autoViewport: renderOptions.autoViewport, - }, - }); - } -} - -export default RidingRoute; diff --git a/src/components/Service/TransitRoute.js b/src/components/Service/TransitRoute.js deleted file mode 100644 index 5862cc7..0000000 --- a/src/components/Service/TransitRoute.js +++ /dev/null @@ -1,48 +0,0 @@ -import BaseService from './BaseService'; -import ReactComponent from '../ReactComponent'; -import { isPoint, getPoint } from '../_base/util'; - -@ReactComponent -class TransitRoute extends BaseService { - init() { - const { - location = this.map, - policy, - intercityPolicy, - transitTypePolicy, - pageCapacity, - onSearchComplete, - onMarkersSet, - onInfoHtmlSet, - onPolylinesSet, - onResultsHtmlSet, - renderOptions = {}, - showInMap = false, - } = this.props; - - let _location = location; - if (isPoint(location)) { - _location = getPoint(_location.lng, _location.lat); - } - - this.instance = new global.BMap.TransitRoute(_location, { - policy: policy && global[policy], - intercityPolicy: intercityPolicy && global[intercityPolicy], - transitTypePolicy: transitTypePolicy && global[transitTypePolicy], - pageCapacity, - onSearchComplete, - onMarkersSet, - onInfoHtmlSet, - onPolylinesSet, - onResultsHtmlSet, - renderOptions: { - map: showInMap ? this.map : null, - panel: renderOptions.panel, - selectFirstResult: renderOptions.selectFirstResult, - autoViewport: renderOptions.autoViewport, - }, - }); - } -} - -export default TransitRoute; diff --git a/src/components/Service/WalkingRoute.js b/src/components/Service/WalkingRoute.js deleted file mode 100644 index f2a7e1a..0000000 --- a/src/components/Service/WalkingRoute.js +++ /dev/null @@ -1,38 +0,0 @@ -import BaseService from './BaseService'; -import ReactComponent from '../ReactComponent'; -import { isPoint, getPoint } from '../_base/util'; - -@ReactComponent -class WalkingRoute extends BaseService { - init() { - const { - location = this.map, - onSearchComplete, - onMarkersSet, - onInfoHtmlSet, - onPolylinesSet, - renderOptions = {}, - showInMap = false, - } = this.props; - - let _location = location; - if (isPoint(location)) { - _location = getPoint(_location.lng, _location.lat); - } - - this.instance = new global.BMap.WalkingRoute(_location, { - onSearchComplete, - onMarkersSet, - onInfoHtmlSet, - onPolylinesSet, - renderOptions: { - map: showInMap ? this.map : null, - panel: renderOptions.panel, - selectFirstResult: renderOptions.selectFirstResult, - autoViewport: renderOptions.autoViewport, - }, - }); - } -} - -export default WalkingRoute; diff --git a/src/components/_base/events.js b/src/components/_base/events.js deleted file mode 100644 index 16de2c6..0000000 --- a/src/components/_base/events.js +++ /dev/null @@ -1,148 +0,0 @@ -export const MAP = [ - 'click', - 'dblclick', - 'rightclick', - 'rightdblclick', - 'maptypechange', - 'mousemove', - 'mouseover', - 'mouseout', - 'movestart', - 'moving', - 'moveend', - 'zoomstart', - 'zoomend', - 'addoverlay', - 'addcontrol', - 'removecontrol', - 'removeoverlay', - 'clearoverlays', - 'dragstart', - 'dragging', - 'dragend', - 'addtilelayer', - 'removetilelayer', - 'load', - 'resize', - 'hotspotclick', - 'hotspotover', - 'hotspotout', - 'tilesloaded', - 'touchstart', - 'touchmove', - 'touchend', - 'longpress', -]; - -export const OVERVIEW_MAP = [ - 'viewchanged', - 'viewchanging', -]; - -export const GEOLOCATION = [ - 'locationSuccess', - 'locationError', -]; - -export const MARKER = [ - 'click', - 'dblclick', - 'mousedown', - 'mouseup', - 'mouseout', - 'mouseover', - 'remove', - 'infowindowclose', - 'infowindowopen', - 'dragstart', - 'dragging', - 'dragend', - 'rightclick', -]; - -export const LABEL = [ - 'click', - 'dblclick', - 'mousedown', - 'mouseup', - 'mouseout', - 'mouseover', - 'remove', - 'rightclick', -]; - -export const POLYLINE = [ - 'click', - 'dblclick', - 'mousedown', - 'mouseup', - 'mouseout', - 'mouseover', - 'remove', - 'lineupdate', -]; - -export const POLYGON = [ - 'click', - 'dblclick', - 'mousedown', - 'mouseup', - 'mouseout', - 'mouseover', - 'remove', - 'lineupdate', -]; - -export const CIRCLE = [ - 'click', - 'dblclick', - 'mousedown', - 'mouseup', - 'mouseout', - 'mouseover', - 'remove', - 'lineupdate', -]; - -export const INFO_WINDOW = [ - 'close', - 'open', - 'maximize', - 'restore', - 'clickclose', -]; - -export const GROUND = [ - 'click', - 'dbclick', -]; - -export const POINT_COLLECTION = [ - 'click', - 'mouseover', - 'mouseout', -]; - -export const CONTEXT_MENU = [ - 'open', - 'close', -]; - -export const AUTO_COMPLETE = [ - 'onconfirm', - 'onhighlight', -]; - -export const DRAWING_MANAGER = [ - 'circlecomplete', - 'markercomplete', - 'overlaycomplete', - 'polygoncomplete', - 'polylinecomplete', - 'rectanglecomplete', -]; - -export const DISTANCE_TOOL = [ - 'onaddpoint', - 'ondrawend', -]; diff --git a/src/components/_base/options.js b/src/components/_base/options.js deleted file mode 100644 index d76301f..0000000 --- a/src/components/_base/options.js +++ /dev/null @@ -1,48 +0,0 @@ -export const MAP_SET_OPTIONS = [ - 'minZoom', - 'maxZoom', - 'defaultCursor', - 'draggingCursor', - 'mapStyle', - 'zoom', -]; - -export const MAP_BOOLEAN_OPTIONS = [ - 'dragging', - 'scrollWheelZoom', - 'doubleClickZoom', - 'keyboard', - 'inertialDragging', - 'continuousZoom', - 'pinchToZoom', - 'autoResize', -]; - -export const MARKER_SET_OPTIONS = [ - 'label', - 'zIndex', - 'top', - 'icon', - 'shadow', -]; - -export const LABEL_SET_OPTIONS = [ - 'title', - 'zIndex', - 'style', -]; - -export const POLY_BOOLEAN_OPTIONS = [ - 'editing', - 'massClear', -]; - -export const CIRCLE_BOOLEAN_OPTIONS = [ - 'editing', - 'massClear', -]; - -export const POLYLINE_BOOLEAN_OPTIONS = [ - 'editing', - 'massClear', -]; diff --git a/src/components/_base/util.js b/src/components/_base/util.js deleted file mode 100644 index 7164781..0000000 --- a/src/components/_base/util.js +++ /dev/null @@ -1,308 +0,0 @@ -import * as EVENT from './events'; -import * as OPTIONS from './options'; -import ContextMenuIcon from '../../constants/ContextMenuIcon'; - -const reg = /[a-z]/; - -export function replaceInitialToUpper(value) { - return value.replace(reg, val => val.toUpperCase()); -} - -export function getPoint(lng, lat) { - return new global.BMap.Point(lng, lat); -} - -export function getSize(width, height) { - return new global.BMap.Size(width, height); -} - -export function getBounds(bounds) { - const { sw, ne } = bounds; - return new global.BMap.Bounds(getPoint(sw.lng, sw.lat), getPoint(ne.lng, ne.lat)); -} - -export function getMapBounds() { - return global.bMapInstance.getBounds(); -} - -export const isPoint = obj => obj.lng && obj.lat; - -export function bindEvents(target, eventKey, events) { - if (events && EVENT[eventKey]) { - EVENT[eventKey].forEach((eventName) => { - if (events[eventName]) { - const callback = (...args) => { - events[eventName].call(null, ...args); - }; - target.events = target.events || {}; - if (target.events[`${eventName}`]) { - target.removeEventListener(eventName, target.events[`${eventName}`]); - } - target.addEventListener(eventName, callback); - target.events[`${eventName}`] = callback; - } - }); - } -} - -export function unBindEvents(target) { - const { events } = target; - if (events) { - const eventNames = Object.keys(events); - for (let i = 0; i < eventNames.length; i += 1) { - const eventName = eventNames[i]; - const event = events[eventName]; - target.removeEventListener(eventName, event); - } - } -} - -export function createIcon(options = {}) { - const { url, size, opts = {} } = options; - const iconSize = size && getSize(size.width, size.height); - return new global.BMap.Icon(url, iconSize, { - anchor: opts.anchor && global[opts.anchor], - imageSize: opts.imageSize && getSize(opts.imageSize.width, opts.imageSize.height), - imageOffset: opts.imageOffset && getSize(opts.imageOffset.width, opts.imageOffset.height), - infoWindowAnchor: opts.infoWindowAnchor - && getSize(opts.infoWindowAnchor.width, opts.infoWindowAnchor.height), - printImageUrl: opts.printImageUrl, - }); -} - -export function processSetOptions(target, optionKey, opts) { - OPTIONS[optionKey].forEach((key) => { - if (opts[key] || typeof opts[key] === 'boolean') { - const upKey = replaceInitialToUpper(key); - target[`set${upKey}`](opts[key]); - } - }); -} - -export function processBooleanOptions(target, optionKey, opts) { - OPTIONS[optionKey].forEach((key) => { - if (opts[key] || typeof opts[key] === 'boolean') { - const upKey = replaceInitialToUpper(key); - let prefix = 'disable'; - if (opts[key]) { - prefix = 'enable'; - } - target[`${prefix}${upKey}`](); - } - }); -} - -export function createLabel(options = {}) { - const { - content, - point, - offset = { - width: 0, - height: 0, - }, - massClear = true, - title, - events, - zIndex, - style, - } = options; - - const opts = { - offset: offset && getSize(offset.width, offset.height), - enableMassClear: massClear, - position: point && getPoint(point.lng, point.lat), - }; - const label = new global.BMap.Label(content, opts); - bindEvents(label, 'LABEL', events); - const setOpts = { - title, - zIndex, - style, - }; - processSetOptions(label, 'LABEL_SET_OPTIONS', setOpts); - return label; -} - -export function createSymbol(options = {}) { - const { path, opts = {} } = options; - const sPath = global[path] || path; - return new global.BMap.Symbol(sPath, { - ...opts, - }); -} - -export function createContextMenu(items = [], events) { - const menu = new global.BMap.ContextMenu(); - items.forEach((item) => { - const iconUrl = (item.iconUrl === ContextMenuIcon.ZOOMIN) - || (item.iconUrl === ContextMenuIcon.ZOOMOUT) ? global[item.iconUrl] : item.iconUrl; - const itemOpts = { - width: item.width, - id: item.id, - iconUrl, - }; - const menuItem = new global.BMap.MenuItem(item.text, item.callback, itemOpts); - if (item.disabled) { - menuItem.disable(); - } - if (item.separator) { - menu.addSeparator(); - } - menu.addItem(menuItem); - }); - - bindEvents(menu, 'CONTEXT_MENU', events); - return menu; -} - -export function createPolygon(props) { - const { - points, - strokeColor, - fillColor, - strokeWeight, - strokeOpacity, - fillOpacity, - strokeStyle, - clicking = true, - events, - } = props; - - const opts = { - strokeColor, - fillColor, - strokeWeight, - strokeOpacity, - fillOpacity, - strokeStyle, - enableClicking: clicking, - }; - - let pList = []; - - if (points) { - pList = points.map(item => getPoint(item.lng, item.lat)); - } - - const instance = new global.BMap.Polygon(pList, opts); - - bindEvents(instance, 'POLYGON', events); - - return instance; -} - -export function isSupportContext() { - return !!(document.createElement('canvas').getContext); -} - -export function isSupportCanvas() { - const elem = document.createElement('canvas'); - return !!(elem.getContext && elem.getContext('2d')); -} - -export function appendCss(options = {}) { - const { url, id } = options; - const node = document.createElement('link'); - - node.rel = 'stylesheet'; - node.type = 'text/css'; - node.href = url; - if (typeof id !== 'undefined') { - node.id = id; - } - document.getElementsByTagName('head')[0].appendChild(node); -} - -export function getPoiByKeyword(keyword) { - return new Promise((resolve) => { - const local = new global.BMap.LocalSearch(global.bMapInstance, { - onSearchComplete(result) { - let res = null; - if (result) { - res = result.getPoi(0); - } - resolve(res); - }, - }); - local.search(keyword); - }); -} - -export function convertPoint(points, from, to = 5) { - return new Promise((resolve) => { - const convert = new global.BMap.Convertor(); - if (!Array.isArray(points)) { - points = [points]; - } - const pList = points.map(item => getPoint(item.lng, item.lat)); - convert.translate(pList, from, to, (result) => { - resolve(result); - }); - }); -} - -export function processContextMenu(contextMenu, instance) { - if (contextMenu) { - const menu = createContextMenu(contextMenu.items, contextMenu.events); - instance.addContextMenu(menu); - } -} - -export function createMarker(props) { - const { - point, - offset = { - width: 0, - height: 0, - }, - icon, - massClear = true, - dragging = false, - clicking = true, - raiseOnDrag = false, - draggingCursor, - rotation, - shadow, - title, - events, - label, - zIndex, - top = false, - contextMenu, - } = props; - - const oPoint = point && getPoint(point.lng, point.lat); - - const markerOpts = { - offset: offset && getSize(offset.width, offset.height), - enableMassClear: massClear, - enableDragging: dragging, - enableClicking: clicking, - raiseOnDrag, - draggingCursor, - rotation, - title, - }; - - const instance = new global.BMap.Marker(oPoint, markerOpts); - - const setOpts = { - label: label && createLabel(label.props), - shadow: shadow && createIcon(shadow), - zIndex, - top, - }; - - if (icon && icon instanceof global.BMap.Symbol) { - setOpts.icon = icon; - } else if (icon) { - setOpts.icon = createIcon(icon); - } - - bindEvents(instance, 'MARKER', events); - - processContextMenu(contextMenu, instance); - processSetOptions(instance, 'MARKER_SET_OPTIONS', setOpts); - - return instance; -} diff --git a/src/constants/Animation.js b/src/constants/Animation.js deleted file mode 100644 index 31a4e3d..0000000 --- a/src/constants/Animation.js +++ /dev/null @@ -1,4 +0,0 @@ -export default { - DROP: 'BMAP_ANIMATION_DROP', - BOUNCE: 'BMAP_ANIMATION_BOUNCE', -}; diff --git a/src/constants/ContextMenuIcon.js b/src/constants/ContextMenuIcon.js deleted file mode 100644 index 2d2fe65..0000000 --- a/src/constants/ContextMenuIcon.js +++ /dev/null @@ -1,4 +0,0 @@ -export default { - ZOOMIN: 'BMAP_CONTEXT_MENU_ICON_ZOOMIN', - ZOOMOUT: 'BMAP_CONTEXT_MENU_ICON_ZOOMOUT', -}; diff --git a/src/constants/ControlAnchor.js b/src/constants/ControlAnchor.js deleted file mode 100644 index 5c05ec6..0000000 --- a/src/constants/ControlAnchor.js +++ /dev/null @@ -1,6 +0,0 @@ -export default { - TOP_LEFT: 'BMAP_ANCHOR_TOP_LEFT', - TOP_RIGHT: 'BMAP_ANCHOR_TOP_RIGHT', - BOTTOM_LEFT: 'BMAP_ANCHOR_BOTTOM_LEFT', - BOTTOM_RIGHT: 'BMAP_ANCHOR_BOTTOM_RIGHT', -}; diff --git a/src/constants/DrawingMode.js b/src/constants/DrawingMode.js deleted file mode 100644 index 717905b..0000000 --- a/src/constants/DrawingMode.js +++ /dev/null @@ -1,7 +0,0 @@ -export default { - MARKER: 'marker', - CIRCLE: 'circle', - POLYLINE: 'polyline', - POLYGON: 'polygon', - RECTANGLE: 'rectangle', -}; diff --git a/src/constants/DrivingPolicy.js b/src/constants/DrivingPolicy.js deleted file mode 100644 index 71469a3..0000000 --- a/src/constants/DrivingPolicy.js +++ /dev/null @@ -1,6 +0,0 @@ -export default { - DEFAULT: 'BMAP_DRIVING_POLICY_DEFAULT', - FIRST_HIGHWAYS: 'BMAP_DRIVING_POLICY_FIRST_HIGHWAYS', - AVOID_HIGHWAYS: 'BMAP_DRIVING_POLICY_AVOID_HIGHWAYS', - AVOID_CONGESTION: 'BMAP_DRIVING_POLICY_AVOID_CONGESTION', -}; diff --git a/src/constants/IntercityPolicy.js b/src/constants/IntercityPolicy.js deleted file mode 100644 index c8b3dd4..0000000 --- a/src/constants/IntercityPolicy.js +++ /dev/null @@ -1,5 +0,0 @@ -export default { - LEAST_TIME: 'BMAP_INTERCITY_POLICY_LEAST_TIME', - EARLY_START: 'BMAP_INTERCITY_POLICY_EARLY_START', - CHEAP_PRICE: 'BMAP_INTERCITY_POLICY_CHEAP_PRICE', -}; diff --git a/src/constants/LengthUnit.js b/src/constants/LengthUnit.js deleted file mode 100644 index 4eca8fa..0000000 --- a/src/constants/LengthUnit.js +++ /dev/null @@ -1,4 +0,0 @@ -export default { - METRIC: 'BMAP_UNIT_METRIC', - IMPERIAL: 'BMAP_UNIT_IMPERIAL', -}; diff --git a/src/constants/MapPane.js b/src/constants/MapPane.js deleted file mode 100644 index fe64106..0000000 --- a/src/constants/MapPane.js +++ /dev/null @@ -1,9 +0,0 @@ -export default { - FLOAT: 'floatPane', // 信息窗口所在容器 - FLOAT_SHADOW: 'floatShadow', // 信息窗口阴影所在容器 - LABEL: 'labelPane', // 文本标注所在容器 - MARKER: 'markerPane', // 标注图标所在容器 - MARKER_MOUSE: 'markerMouseTarget', // 标注点击区域所在容器 - MARKER_SHADOW: 'markerShadow', // 标注阴影所在容器 - MAP: 'mapPane', // 折现、多边形等矢量图形所在容器 -}; diff --git a/src/constants/MapType.js b/src/constants/MapType.js deleted file mode 100644 index 5f6170d..0000000 --- a/src/constants/MapType.js +++ /dev/null @@ -1,6 +0,0 @@ -export default { - NORMAL: 'BMAP_NORMAL_MAP', - PERSPECTIVE: 'BMAP_PERSPECTIVE_MAP', - SATELLITE: 'BMAP_SATELLITE_MAP', - HYBRID: 'BMAP_HYBRID_MAP', -}; diff --git a/src/constants/MapTypeControlType.js b/src/constants/MapTypeControlType.js deleted file mode 100644 index 1bf1aa5..0000000 --- a/src/constants/MapTypeControlType.js +++ /dev/null @@ -1,5 +0,0 @@ -export default { - HORIZONTAL: 'BMAP_MAPTYPE_CONTROL_HORIZONTAL', - DROPDOWN: 'BMAP_MAPTYPE_CONTROL_DROPDOWN', - MAP: 'BMAP_MAPTYPE_CONTROL_MAP', -}; diff --git a/src/constants/NavigationType.js b/src/constants/NavigationType.js deleted file mode 100644 index 986f914..0000000 --- a/src/constants/NavigationType.js +++ /dev/null @@ -1,6 +0,0 @@ -export default { - LARGE: 'BMAP_NAVIGATION_CONTROL_LARGE', - SMALL: 'BMAP_NAVIGATION_CONTROL_SMALL', - PAN: 'BMAP_NAVIGATION_CONTROL_PAN', - ZOOM: 'BMAP_NAVIGATION_CONTROL_ZOOM', -}; diff --git a/src/constants/ShapeType.js b/src/constants/ShapeType.js deleted file mode 100644 index 0d7acfb..0000000 --- a/src/constants/ShapeType.js +++ /dev/null @@ -1,7 +0,0 @@ -export default { - CIRCLE: 'BMAP_POINT_SHAPE_CIRCLE', - STAR: 'BMAP_POINT_SHAPE_STAR', - SQUARE: 'BMAP_POINT_SHAPE_SQUARE', - RHOMBUS: 'BMAP_POINT_SHAPE_RHOMBUS', - WATERDROP: 'BMAP_POINT_SHAPE_WATERDROP', -}; diff --git a/src/constants/SizeType.js b/src/constants/SizeType.js deleted file mode 100644 index 3795fd8..0000000 --- a/src/constants/SizeType.js +++ /dev/null @@ -1,9 +0,0 @@ -export default { - TINY: 'BMAP_POINT_SIZE_TINY', - SMALLER: 'BMAP_POINT_SIZE_SMALLER', - SMALL: 'BMAP_POINT_SIZE_SMALL', - NORMAL: 'BMAP_POINT_SIZE_NORMAL', - BIG: 'BMAP_POINT_SIZE_BIG', - BIGGER: 'BMAP_POINT_SIZE_BIGGER', - HUGE: 'BMAP_POINT_SIZE_HUGE', -}; diff --git a/src/constants/StatusCode.js b/src/constants/StatusCode.js deleted file mode 100644 index d64e319..0000000 --- a/src/constants/StatusCode.js +++ /dev/null @@ -1,5 +0,0 @@ -export default { - PERMISSION_DENIED: 'BMAP_STATUS_PERMISSION_DENIED', - SERVICE_UNAVAILABLE: 'BMAP_STATUS_SERVICE_UNAVAILABLE', - TIMEOUT: 'BMAP_STATUS_TIMEOUT', -}; diff --git a/src/constants/SymbolShapeType.js b/src/constants/SymbolShapeType.js deleted file mode 100644 index d1e0c92..0000000 --- a/src/constants/SymbolShapeType.js +++ /dev/null @@ -1,16 +0,0 @@ -export default { - CIRCLE: 'BMap_Symbol_SHAPE_CIRCLE', - RECTANGLE: 'BMap_Symbol_SHAPE_RECTANGLE', - RHOMBUS: 'BMap_Symbol_SHAPE_RHOMBUS', - STAR: 'BMap_Symbol_SHAPE_STAR', - BACKWARD_CLOSED_ARROW: 'BMap_Symbol_SHAPE_BACKWARD_CLOSED_ARROW', - FORWARD_CLOSED_ARROW: 'BMap_Symbol_SHAPE_FORWARD_CLOSED_ARROW', - BACKWARD_OPEN_ARROW: 'BMap_Symbol_SHAPE_BACKWARD_OPEN_ARROW', - FORWARD_OPEN_ARROW: 'BMap_Symbol_SHAPE_FORWARD_OPEN_ARROW', - POINT: 'BMap_Symbol_SHAPE_POINT', - PLANE: 'BMap_Symbol_SHAPE_PLANE', - CAMERA: 'BMap_Symbol_SHAPE_CAMERA', - WARNING: 'BMap_Symbol_SHAPE_WARNING', - SMILE: 'BMap_Symbol_SHAPE_SMILE', - CLOCK: 'BMap_Symbol_SHAPE_CLOCK', -}; diff --git a/src/constants/TransitPolicy.js b/src/constants/TransitPolicy.js deleted file mode 100644 index f2b9f7e..0000000 --- a/src/constants/TransitPolicy.js +++ /dev/null @@ -1,8 +0,0 @@ -export default { - RECOMMEND: 'BMAP_TRANSIT_POLICY_RECOMMEND', - LEAST_TIME: 'BMAP_TRANSIT_POLICY_LEAST_TIME', - LEAST_TRANSFER: 'BMAP_TRANSIT_POLICY_LEAST_TRANSFER', - LEAST_WALKING: 'BMAP_TRANSIT_POLICY_LEAST_WALKING', - AVOID_SUBWAYS: 'BMAP_TRANSIT_POLICY_AVOID_SUBWAYS', - FIRST_SUBWAYS: 'BMAP_TRANSIT_POLICY_FIRST_SUBWAYS', -}; diff --git a/src/constants/TransitTypePolicy.js b/src/constants/TransitTypePolicy.js deleted file mode 100644 index adfdc3b..0000000 --- a/src/constants/TransitTypePolicy.js +++ /dev/null @@ -1,5 +0,0 @@ -export default { - TRAIN: 'BMAP_TRANSIT_TYPE_POLICY_TRAIN', - AIRPLANE: 'BMAP_TRANSIT_TYPE_POLICY_AIRPLANE', - COACH: 'BMAP_TRANSIT_TYPE_POLICY_COACH', -}; diff --git a/src/core/AutoComplete/index.js b/src/core/AutoComplete/index.js new file mode 100644 index 0000000..8dfaf3d --- /dev/null +++ b/src/core/AutoComplete/index.js @@ -0,0 +1,72 @@ +import Util from '../utils'; +import BMapUtil from '../utils/map'; +import OPTIONS from '../options/autoComplete'; + +const getAutocompleteOptions = (config, map) => ({ + location: config.location || map, + types: config.types, + onSearchComplete: config.onSearchComplete, + input: config.input, +}); + +class AutoComplete { + config = {} + + outOfRangeOpts = ['input', 'onSearchComplete'] + + hasOutOfRangeOpts = (opts = []) => opts.some(item => this.outOfRangeOpts.indexOf(item) > -1) + + constructor(config = {}, map) { + this.config = { ...config }; + this.init(config, map); + } + + init = (config, map) => { + this.checkInputExist(); + const options = getAutocompleteOptions(config, map); + this.instance = BMapUtil.BAutocomplete(options); + this.processOptions(config); + this.processEvents(config.events); + } + + checkInputExist = () => { + if (!document.querySelector(`#${this.config.input}`)) { + throw Error(`[Input] ${this.config.input} is not exist when init autocomplete.`); + } + } + + repaint = (config) => { + const diffConfig = Util.compareConfig(this.config, config) || {}; + if (this.hasOutOfRangeOpts(Object.keys(diffConfig))) { + this.destroy(); + this.init({ ...this.config, ...diffConfig }); + } else { + this.processOptions(diffConfig); + + if (config.events) { + this.processEvents(config.events); + } + } + this.config = { ...this.config, ...diffConfig }; + } + + destroy = () => { + this.instance.dispose(); + } + + processEvents = (events) => { + Util.unbindEvents(this.instance); + if (events) { + Util.bindEvents(this.instance, events); + } + } + + processOptions(config) { + if (config.value) { + config.inputValue = config.value; + } + Util.processSetOptions(this.instance, OPTIONS.SET, config); + } +} + +export default AutoComplete; diff --git a/src/core/Control/BaseControl.js b/src/core/Control/BaseControl.js new file mode 100644 index 0000000..b6a0fb9 --- /dev/null +++ b/src/core/Control/BaseControl.js @@ -0,0 +1,37 @@ +/* + * 基础控件类 + * 用于统一处理重绘、销毁逻辑 + */ + +import Util from '../utils'; + +class BaseControl { + instance = null; + + constructor(config, map) { + this.map = map; + this.repaint(config); + } + + /** + * 重绘 + */ + repaint = (config) => { + this.destroy(); + config = { ...config, ...Util.convertControlOptions(config) }; + this.init(config); + Util.processControlVisible(this.instance, config.visible); + } + + /** + * 销毁 + */ + destroy = () => { + if (this.instance) { + this.map.removeControl(this.instance); + this.instance = null; + } + } +} + +export default BaseControl; diff --git a/src/core/Control/CityList.js b/src/core/Control/CityList.js new file mode 100644 index 0000000..261d176 --- /dev/null +++ b/src/core/Control/CityList.js @@ -0,0 +1,21 @@ +import BMapUtil from '../utils/map'; +import BaseControl from './BaseControl'; + +const processEvents = (config) => { + const events = config.events || {}; + const keys = Object.keys(events); + + keys.forEach((key) => { + config[key] = events[key]; + }); +}; + +class CityList extends BaseControl { + init(config = {}) { + processEvents(config); + this.instance = BMapUtil.BCityListControl(config); + this.map.addControl(this.instance); + } +} + +export default CityList; diff --git a/src/core/Control/Copyright.js b/src/core/Control/Copyright.js new file mode 100644 index 0000000..300c101 --- /dev/null +++ b/src/core/Control/Copyright.js @@ -0,0 +1,15 @@ +import BMapUtil from '../utils/map'; +import BaseControl from './BaseControl'; + +class Copyright extends BaseControl { + init(config = {}) { + const { copyrights = [] } = config; + this.instance = BMapUtil.BCopyrightControl(config); + copyrights.forEach((item) => { + this.instance.addCopyright(item); + }); + this.map.addControl(this.instance); + } +} + +export default Copyright; diff --git a/src/core/Control/Custom.js b/src/core/Control/Custom.js new file mode 100644 index 0000000..d8a044c --- /dev/null +++ b/src/core/Control/Custom.js @@ -0,0 +1,54 @@ +import Util from '../utils'; +import BMapUtil from '../utils/map'; + +class CustomControl { + constructor(config, map) { + this.map = map; + config = { ...config, ...Util.convertControlOptions(config) }; + this.config = { ...config }; + this.defaultAnchor = config.anchor; + this.defaultOffset = config.offset; + } + + config = {} + + processOptions = ({ anchor, offset, visible }) => { + if (anchor) { + this.setAnchor(anchor); + } + if (offset) { + this.setOffset(offset); + } + if (!Util.isNil(visible)) { + if (!visible) { + this.hide(); + } else { + this.show(); + } + } + } + + repaint = (config) => { + config = { ...config, ...Util.convertControlOptions(config) }; + const diffConfig = Util.compareConfig(this.config, config); + this.processOptions(diffConfig); + this.config = { ...this.config, ...diffConfig }; + } + + destroy = () => { + this.map.removeControl(this); + } +} + +// 异步加载时,BMap对象不存在,所以提供获得类方法,确保调用时BMap对象存在。 +const initCustomControl = (config, initialize, mapInstance) => { + CustomControl.prototype = BMapUtil.BControl(); + CustomControl.prototype.initialize = initialize; + + const control = new CustomControl(config, mapInstance); + mapInstance.addControl(control); + Util.processControlVisible(control, config.visible); + return control; +}; + +export default initCustomControl; diff --git a/src/core/Control/Geolocation.js b/src/core/Control/Geolocation.js new file mode 100644 index 0000000..a0cb73e --- /dev/null +++ b/src/core/Control/Geolocation.js @@ -0,0 +1,16 @@ +import Util from '../utils'; +import BMapUtil from '../utils/map'; +import BaseControl from './BaseControl'; + +class Geolocation extends BaseControl { + init(config = {}) { + config.locationIcon = config.icon; + delete config.icon; + this.instance = BMapUtil.BGeolocationControl(config); + this.map.addControl(this.instance); + + Util.bindEvents(this.instance, config.events); + } +} + +export default Geolocation; diff --git a/src/core/Control/MapType.js b/src/core/Control/MapType.js new file mode 100644 index 0000000..3a15c04 --- /dev/null +++ b/src/core/Control/MapType.js @@ -0,0 +1,21 @@ +import BMapUtil from '../utils/map'; +import BaseControl from './BaseControl'; + +const getTypes = types => types && types.map(item => global[item] || item); + +const getMapTypeOptions = config => ({ + anchor: config.anchor, + offset: config.offset, + type: global[config.type] || config.type, + mapTypes: getTypes(config.mapTypes), +}); + +class MapType extends BaseControl { + init(config = {}) { + const options = getMapTypeOptions(config); + this.instance = BMapUtil.BMapTypeControl(options); + this.map.addControl(this.instance); + } +} + +export default MapType; diff --git a/src/core/Control/Navigation.js b/src/core/Control/Navigation.js new file mode 100644 index 0000000..e8d0df1 --- /dev/null +++ b/src/core/Control/Navigation.js @@ -0,0 +1,19 @@ +import BMapUtil from '../utils/map'; +import BaseControl from './BaseControl'; + +const getNavigationControlOptions = config => ({ + anchor: config.anchor, + offset: config.offset, + type: global[config.type] || config.type, + showZoomInfo: config.showZoomInfo, +}); + +class Navigation extends BaseControl { + init(config = {}) { + const options = getNavigationControlOptions(config); + this.instance = BMapUtil.BNavigationControl(options); + this.map.addControl(this.instance); + } +} + +export default Navigation; diff --git a/src/core/Control/OverviewMap.js b/src/core/Control/OverviewMap.js new file mode 100644 index 0000000..be91c6d --- /dev/null +++ b/src/core/Control/OverviewMap.js @@ -0,0 +1,21 @@ +import Util from '../utils'; +import BMapUtil from '../utils/map'; +import BaseControl from './BaseControl'; + +const getOverviewMapControlOptions = config => ({ + anchor: config.anchor, + offset: config.offset, + size: config.size && BMapUtil.BSize({ ...config.size }), + isOpen: config.isOpen, +}); + +class OverviewMap extends BaseControl { + init(config = {}) { + const options = getOverviewMapControlOptions(config); + this.instance = BMapUtil.BOverviewMapControl(options); + this.map.addControl(this.instance); + Util.bindEvents(this.instance, config.events); + } +} + +export default OverviewMap; diff --git a/src/core/Control/Panorama.js b/src/core/Control/Panorama.js new file mode 100644 index 0000000..a7409d4 --- /dev/null +++ b/src/core/Control/Panorama.js @@ -0,0 +1,11 @@ +import BMapUtil from '../utils/map'; +import BaseControl from './BaseControl'; + +class Panorama extends BaseControl { + init(config = {}) { + this.instance = BMapUtil.BPanoramaControl(config); + this.map.addControl(this.instance); + } +} + +export default Panorama; diff --git a/src/core/Control/Scale.js b/src/core/Control/Scale.js new file mode 100644 index 0000000..a1d324e --- /dev/null +++ b/src/core/Control/Scale.js @@ -0,0 +1,19 @@ +import BMapUtil from '../utils/map'; +import BaseControl from './BaseControl'; + +const processUnit = (unit, instance) => { + if (unit) { + unit = global[unit] || unit; + instance.setUnit(unit); + } +}; + +class Scale extends BaseControl { + init(config = {}) { + this.instance = BMapUtil.BScaleControl(config); + processUnit(config.unit, this.instance); + this.map.addControl(this.instance); + } +} + +export default Scale; diff --git a/src/core/Layer/TileLayer.js b/src/core/Layer/TileLayer.js new file mode 100644 index 0000000..2ec02aa --- /dev/null +++ b/src/core/Layer/TileLayer.js @@ -0,0 +1,36 @@ +import BMapUtil from '../utils/map'; + +const getTileLayerOptions = config => ({ + transparentPng: config.transparentPng, + tileUrlTemplate: config.tileUrlTemplate, + zIndex: config.zIndex, +}); + +class TileLayer { + constructor(config, map) { + this.map = map; + this.init(config); + } + + init(config = {}) { + const options = getTileLayerOptions(config); + this.instance = BMapUtil.BTileLayer(options); + if (config.getTilesUrl) { + this.instance.getTilesUrl = config.getTilesUrl; + } + this.map.addTileLayer(this.instance); + } + + repaint = (config = {}) => { + this.destroy(); + this.init(config); + } + + destroy = () => { + if (this.instance) { + this.map.removeTileLayer(this.instance); + } + } +} + +export default TileLayer; diff --git a/src/core/Layer/TrafficLayer.js b/src/core/Layer/TrafficLayer.js new file mode 100644 index 0000000..cf236dc --- /dev/null +++ b/src/core/Layer/TrafficLayer.js @@ -0,0 +1,41 @@ +import BMapUtil from '../utils/map'; + +class TrafficLayer { + constructor(config, map) { + this.map = map; + this.init(config); + } + + init(config = {}) { + const now = new Date(); + if (!config.weekday) { + config.weekday = now.getDay(); + } + + if (!config.hour) { + config.hour = now.getHours(); + } + + this.instance = BMapUtil.BTrafficLayer({ + predictDate: { + weekday: config.weekday, + hour: config.hour, + }, + }); + + this.map.addTileLayer(this.instance); + } + + repaint = (config = {}) => { + this.destroy(); + this.init(config); + } + + destroy = () => { + if (this.instance) { + this.map.removeTileLayer(this.instance); + } + } +} + +export default TrafficLayer; diff --git a/src/core/Map/index.js b/src/core/Map/index.js new file mode 100644 index 0000000..ac54083 --- /dev/null +++ b/src/core/Map/index.js @@ -0,0 +1,112 @@ +/* + * 百度地图核心类 + * + */ + +import Util from '../utils'; +import BMapUtil from '../utils/map'; + +import OPTIONS from '../options/map'; + +/** + * 地图初始化配置项所需属性 + */ +const getMapOptions = config => ({ + minZoom: config.minZoom, + maxZoom: config.maxZoom, + mapType: config.mapType && global[config.mapType], + enableHighResolution: config.highResolution, + enableAutoResize: config.autoResize, + enableMapClick: config.mapClick, +}); + +/** + * 处理地图显示中心点 + */ +const processCenter = (center) => { + if (!Util.isNil(center) && !Util.isString(center)) { + center = Util.convert2BPoint(center, 'center'); + } + + return center; +}; + +class Map { + config = {} + + instance = null + + requiredProperty = ['zoom', 'center'] + + constructor(container, config) { + const mapOptions = getMapOptions(config); + this.instance = BMapUtil.BMap(container, mapOptions); + this.config.center = processCenter(config.center); + if (!config.zoom) { + throw Error('Missing the required property `zoom`'); + } + this.instance.centerAndZoom(this.config.center, config.zoom); + } + + /** + * 设置右键菜单 + */ + processContextMenu = (contextMenu) => { + if (this.contextMenu) { + this.instance.removeContextMenu(this.contextMenu); + } + this.contextMenu = contextMenu; + if (contextMenu) { + this.instance.addContextMenu(contextMenu); + } + } + + /** + * 设置地图类型 + */ + setMapType = (mapType) => { + if (mapType && global[mapType]) { + this.instance.setMapType(global[mapType]); + } + } + + /** + * 处理地图相关事件 + * 绑定之前先统一解绑 + */ + processEvents = (events) => { + Util.unbindEvents(this.instance); + Util.bindEvents(this.instance, events); + } + + /** + * 处理可以通过 setXXX 以及 enable、disableXXX 的方法 + */ + processOptions = (config) => { + Util.processSetOptions(this.instance, OPTIONS.SET, config); + Util.processBooleanOptions(this.instance, OPTIONS.BOOLEAN, config); + } + + /** + * 重绘 + */ + repaint = (config) => { + // 先进行一步转换,因为this.config.center为转换后的值,防止diff出现 bad case + if (config.center) { + config.center = processCenter(config.center); + } + const diffConfig = Util.compareConfig(this.config, config); + + this.processContextMenu(diffConfig.contextMenu); + this.processEvents(diffConfig.events); + + this.setMapType(diffConfig.mapType); + this.processOptions(diffConfig); + this.config = { + ...this.config, + ...diffConfig, + }; + } +} + +export default Map; diff --git a/src/core/Overlay/BaseOverlay.js b/src/core/Overlay/BaseOverlay.js new file mode 100644 index 0000000..00cae7c --- /dev/null +++ b/src/core/Overlay/BaseOverlay.js @@ -0,0 +1,43 @@ +import Util from '../utils'; + +class BaseOverlay { + config = {} + + outOfRangeOpts = [] + + constructor(config, map) { + this.map = map; + this.config = { ...config }; + this.init(config); + this.processEvents(config.events); + } + + hasOutOfRangeOpts = (opts = []) => opts.some(item => this.outOfRangeOpts.indexOf(item) > -1) + + processEvents = (events) => { + Util.unbindEvents(this.instance); + Util.bindEvents(this.instance, events); + } + + repaint = (config) => { + const diffConfig = Util.compareConfig(this.config, config) || {}; + + if (this.hasOutOfRangeOpts(Object.keys(diffConfig))) { + this.destroy(); + this.init({ ...this.config, ...diffConfig }); + } else { + this.processOptions(diffConfig); + + if (config.events) { + this.processEvents(config.events); + } + } + this.config = { ...this.config, ...diffConfig }; + } + + destroy = () => { + this.map.removeOverlay(this.instance); + } +} + +export default BaseOverlay; diff --git a/src/core/Overlay/Circle.js b/src/core/Overlay/Circle.js new file mode 100644 index 0000000..6f5a76f --- /dev/null +++ b/src/core/Overlay/Circle.js @@ -0,0 +1,37 @@ +import Util from '../utils'; +import BMapUtil from '../utils/map'; +import OPTIONS from '../options/circle'; +import BaseOverlay from './BaseOverlay'; + +const getCircleOptions = config => ({ + strokeColor: config.strokeColor, + fillColor: config.fillColor, + strokeWeight: config.strokeWeight, + strokeOpacity: config.strokeOpacity, + fillOpacity: config.fillOpacity, + strokeStyle: config.strokeStyle, + enableMassClear: config.massClear, + enableClicking: config.clicking, +}); + +class Circle extends BaseOverlay { + outOfRangeOpts = ['clicking'] + + init(config = {}) { + const options = getCircleOptions(config); + const center = Util.convert2BPoint(config.center); + this.instance = BMapUtil.BCircle(center, config.radius, options); + this.map.addOverlay(this.instance); + this.processOptions(config); + } + + processOptions(config) { + if (config.center) { + config.center = Util.convert2BPoint(config.center); + } + Util.processSetOptions(this.instance, OPTIONS.SET, config); + Util.processBooleanOptions(this.instance, OPTIONS.BOOLEAN, config); + } +} + +export default Circle; diff --git a/src/core/Overlay/Custom.js b/src/core/Overlay/Custom.js new file mode 100644 index 0000000..aa57d3c --- /dev/null +++ b/src/core/Overlay/Custom.js @@ -0,0 +1,46 @@ +import Util from '../utils'; +import BMapUtil from '../utils/map'; + +class CustomOverlay { + constructor(config, map) { + this.config = { ...config }; + this.map = map; + this.processOptions(config); + } + + config = {} + + processOptions = ({ visible }) => { + if (!Util.isNil(visible)) { + if (!visible) { + this.hide(); + } else { + this.show(); + } + } + } + + repaint = (config) => { + const diffConfig = Util.compareConfig(this.config, config); + this.processOptions(diffConfig); + this.config = { ...this.config, ...diffConfig }; + } + + destroy = () => { + this.map.removeOverlay(this); + } +} + +// 异步加载时,BMap对象不存在,所以提供获得类方法,确保调用时BMap对象存在。 +const initCustomOverlay = (config, initialize, draw, mapInstance) => { + CustomOverlay.prototype = BMapUtil.BOverlay(); + CustomOverlay.prototype.initialize = initialize; + CustomOverlay.prototype.draw = draw; + + const overlay = new CustomOverlay(config, mapInstance); + mapInstance.addOverlay(overlay); + + return overlay; +}; + +export default initCustomOverlay; diff --git a/src/core/Overlay/GroundOverlay.js b/src/core/Overlay/GroundOverlay.js new file mode 100644 index 0000000..c9d1db8 --- /dev/null +++ b/src/core/Overlay/GroundOverlay.js @@ -0,0 +1,30 @@ +import Util from '../utils'; +import BMapUtil from '../utils/map'; +import OPTIONS from '../options/ground'; +import BaseOverlay from './BaseOverlay'; + +const getGroundOverlayOptions = config => ({ + opacity: config.opacity, + imageURL: config.imageURL, + displayOnMaxLevel: config.displayOnMaxLevel, + displayOnMinLevel: config.displayOnMinLevel, +}); + +class GroundOverlay extends BaseOverlay { + init(config = {}) { + const bounds = Util.convert2BBounds(config.bounds); + const options = getGroundOverlayOptions(config); + this.instance = BMapUtil.BGroundOverlay(bounds, options); + this.map.addOverlay(this.instance); + this.processOptions(config); + } + + processOptions(config) { + if (config.bounds) { + config.bounds = Util.convert2BBounds(config.bounds); + } + Util.processSetOptions(this.instance, OPTIONS.SET, config); + } +} + +export default GroundOverlay; diff --git a/src/core/Overlay/Icon.js b/src/core/Overlay/Icon.js new file mode 100644 index 0000000..393cd8d --- /dev/null +++ b/src/core/Overlay/Icon.js @@ -0,0 +1,45 @@ +import Util from '../utils'; +import BMapUtil from '../utils/map'; + +const getIconOptions = config => ({ + anchor: config.anchor, + imageOffset: config.imageOffset, + imageSize: config.imageSize, + infoWindowAnchor: config.infoWindowAnchor, + printImageUrl: config.printImageUrl, +}); + +const processConfig = (config) => { + const { + size, imageOffset, imageSize, infoWindowAnchor, + } = config; + const result = { ...config }; + + if (size) { + result.size = Util.convert2BSize(size); + } + + if (imageOffset) { + result.imageOffset = Util.convert2BSize(imageOffset); + } + + if (imageSize) { + result.imageSize = Util.convert2BSize(imageSize); + } + + if (infoWindowAnchor) { + result.infoWindowAnchor = Util.convert2BSize(infoWindowAnchor); + } + return result; +}; + +class Icon { + constructor(config = {}) { + const result = processConfig(config); + const options = getIconOptions(result); + const icon = BMapUtil.BIcon(result.imageUrl, result.size, options); + return icon; + } +} + +export default Icon; diff --git a/src/core/Overlay/IconSequence.js b/src/core/Overlay/IconSequence.js new file mode 100644 index 0000000..bfb7d52 --- /dev/null +++ b/src/core/Overlay/IconSequence.js @@ -0,0 +1,13 @@ +import BMapUtil from '../utils/map'; + +class IconSequence { + constructor(config = {}) { + const { + symbol, offset, repeat, fixedRotation, + } = config; + const icon = BMapUtil.BIconSequence(symbol, offset, repeat, fixedRotation); + return icon; + } +} + +export default IconSequence; diff --git a/src/core/Overlay/InfoWindow.js b/src/core/Overlay/InfoWindow.js new file mode 100644 index 0000000..e0e5930 --- /dev/null +++ b/src/core/Overlay/InfoWindow.js @@ -0,0 +1,47 @@ +import Util from '../utils'; +import BMapUtil from '../utils/map'; + +import OPTIONS from '../options/infoWindow'; +import BaseOverlay from './BaseOverlay'; + +const getInfoWindowOptions = config => ({ + width: config.width, + height: config.height, + maxWidth: config.maxWidth, + offset: config.offset, + title: config.title, + enableAutoPan: config.autoPan, + enableCloseOnClick: config.closeOnClick, + enableMessage: config.displayMessage, + message: config.message, +}); + +class InfoWindow extends BaseOverlay { + outOfRangeOpts = ['maxWidth', 'offset', 'displayMessage', 'message', 'point'] + + init(config = {}) { + const options = getInfoWindowOptions(config); + const point = Util.convert2BPoint(config.point); + this.instance = BMapUtil.BInfoWindow(config.content, options); + this.processVisible(config.visible, point); + } + + processOptions(config) { + const point = config.point || this.config.point; + config.point = Util.convert2BPoint(point); + + Util.processSetOptions(this.instance, OPTIONS.SET, config); + Util.processBooleanOptions(this.instance, OPTIONS.BOOLEAN, config); + this.processVisible(config.visible, config.point); + } + + processVisible(visible = true, point) { + if (this.instance.isOpen() && !visible) { + this.map.closeInfoWindow(); + } else if (!this.instance.isOpen() && visible) { + this.map.openInfoWindow(this.instance, point); + } + } +} + +export default InfoWindow; diff --git a/src/core/Overlay/Label.js b/src/core/Overlay/Label.js new file mode 100644 index 0000000..bcaf20c --- /dev/null +++ b/src/core/Overlay/Label.js @@ -0,0 +1,37 @@ +import Util from '../utils'; +import BMapUtil from '../utils/map'; +import OPTIONS from '../options/label'; +import BaseOverlay from './BaseOverlay'; + +const getLabelOptions = config => ({ + offset: config.offset, + position: config.position, + enableMassClear: config.massClear, +}); + +class Label extends BaseOverlay { + outOfRangeOpts = [] + + init(config = {}) { + if (config.position) { + config.position = Util.convert2BPoint(config.position); + } + if (config.offset) { + config.offset = Util.convert2BSize(config.offset); + } + const options = getLabelOptions(config); + this.instance = BMapUtil.BLabel(config.content, options); + this.map.addOverlay(this.instance); + this.processOptions(config); + } + + processOptions(config) { + if (config.position) { + config.position = Util.convert2BPoint(config.position); + } + Util.processSetOptions(this.instance, OPTIONS.SET, config); + Util.processBooleanOptions(this.instance, OPTIONS.BOOLEAN, config); + } +} + +export default Label; diff --git a/src/core/Overlay/Marker.js b/src/core/Overlay/Marker.js new file mode 100644 index 0000000..42939c8 --- /dev/null +++ b/src/core/Overlay/Marker.js @@ -0,0 +1,59 @@ +import Util from '../utils'; +import BMapUtil from '../utils/map'; +import OPTIONS from '../options/marker'; +import BaseOverlay from './BaseOverlay'; + +const getMarkerOptions = config => ({ + offset: config.offset, + icon: config.icon, + enableMassClear: config.massClear, + enableClicking: config.clicking, + raiseOnDrag: config.raiseOnDrag, + draggingCursor: config.draggingCursor, + rotation: config.rotation, + shadow: config.shadow, + title: config.title, +}); + +class Marker extends BaseOverlay { + outOfRangeOpts = ['clicking', 'raiseOnDrag', 'draggingCursor', 'shadow'] + + init(config = {}) { + const options = getMarkerOptions(config); + const point = Util.convert2BPoint(config.point); + this.instance = BMapUtil.BMarker(point, options); + this.map.addOverlay(this.instance); + this.processOptions(config); + this.setContextMenu(config.contextMenu); + } + + processOptions(config) { + const { animation } = config; + if (animation) { + config.animation = global[animation] || animation; + } + + if (config.point) { + config.position = Util.convert2BPoint(config.point); + } + + Util.processSetOptions(this.instance, OPTIONS.SET, config); + Util.processBooleanOptions(this.instance, OPTIONS.BOOLEAN, config); + + if (config.contextMenu) { + this.setContextMenu(config.contextMenu); + } + } + + setContextMenu(contextMenu) { + if (this.contextMenu) { + this.instance.removeContextMenu(this.contextMenu); + } + this.contextMenu = contextMenu; + if (contextMenu) { + this.instance.addContextMenu(contextMenu); + } + } +} + +export default Marker; diff --git a/src/core/Overlay/PointCollection.js b/src/core/Overlay/PointCollection.js new file mode 100644 index 0000000..668580a --- /dev/null +++ b/src/core/Overlay/PointCollection.js @@ -0,0 +1,37 @@ +import Util from '../utils'; +import BMapUtil from '../utils/map'; + +import BaseOverlay from './BaseOverlay'; + +const getPointCollectionOptions = config => ({ + shape: config.shape ? global[config.shape] : null, + size: config.size ? global[config.size] : null, + color: config.color, +}); + +const processPoints = (points = []) => points.map(item => Util.convert2BPoint(item)); + +class PointCollection extends BaseOverlay { + init(config = {}) { + const options = getPointCollectionOptions(config); + const points = processPoints(config.path); + this.instance = BMapUtil.BPointCollection(points, options); + this.map.addOverlay(this.instance); + } + + processOptions(config) { + if (config.shape || config.size || config.color) { + this.instance.setStyles({ + shape: config.shape ? global[config.shape] : global[this.config.shape], + size: config.shape ? global[config.size] : global[this.config.size], + color: config.color || this.config.color, + }); + } + + if (config.path) { + this.instance.setPoints(processPoints(config.path)); + } + } +} + +export default PointCollection; diff --git a/src/core/Overlay/Polygon.js b/src/core/Overlay/Polygon.js new file mode 100644 index 0000000..043ba0b --- /dev/null +++ b/src/core/Overlay/Polygon.js @@ -0,0 +1,40 @@ +import Util from '../utils'; +import BMapUtil from '../utils/map'; +import OPTIONS from '../options/polygon'; +import BaseOverlay from './BaseOverlay'; + +const getPolygonOptions = config => ({ + strokeColor: config.strokeColor, + fillColor: config.fillColor, + strokeWeight: config.strokeWeight, + strokeOpacity: config.strokeOpacity, + fillOpacity: config.fillOpacity, + strokeStyle: config.strokeStyle, + enableMassClear: config.massClear, + enableClicking: config.clicking, +}); + +const processPoints = (points = []) => points.map(item => Util.convert2BPoint(item)); + +class Polygon extends BaseOverlay { + outOfRangeOpts = ['clicking'] + + init(config = {}) { + const options = getPolygonOptions(config); + const points = processPoints(config.path); + this.instance = BMapUtil.BPolygon(points, options); + this.map.addOverlay(this.instance); + this.processOptions(config); + } + + processOptions(config) { + if (config.path && Array.isArray(config.path)) { + config.path = processPoints(config.path); + } + + Util.processSetOptions(this.instance, OPTIONS.SET, config); + Util.processBooleanOptions(this.instance, OPTIONS.BOOLEAN, config); + } +} + +export default Polygon; diff --git a/src/core/Overlay/Polyline.js b/src/core/Overlay/Polyline.js new file mode 100644 index 0000000..d81895c --- /dev/null +++ b/src/core/Overlay/Polyline.js @@ -0,0 +1,39 @@ +import Util from '../utils'; +import BMapUtil from '../utils/map'; +import OPTIONS from '../options/polyline'; +import BaseOverlay from './BaseOverlay'; + +const getPolylineOptions = config => ({ + strokeColor: config.strokeColor, + strokeWeight: config.strokeWeight, + strokeOpacity: config.strokeOpacity, + strokeStyle: config.strokeStyle, + enableMassClear: config.massClear, + enableClicking: config.clicking, + icons: config.icons, +}); + +const processPoints = (points = []) => points.map(item => Util.convert2BPoint(item)); + +class Polyline extends BaseOverlay { + outOfRangeOpts = ['clicking'] + + init(config = {}) { + const options = getPolylineOptions(config); + const points = processPoints(config.path); + this.instance = BMapUtil.BPolyline(points, options); + this.map.addOverlay(this.instance); + this.processOptions(config); + } + + processOptions(config) { + if (config.path && Array.isArray(config.path)) { + config.path = processPoints(config.path); + } + + Util.processSetOptions(this.instance, OPTIONS.SET, config); + Util.processBooleanOptions(this.instance, OPTIONS.BOOLEAN, config); + } +} + +export default Polyline; diff --git a/src/core/Overlay/Symbol.js b/src/core/Overlay/Symbol.js new file mode 100644 index 0000000..c744f1c --- /dev/null +++ b/src/core/Overlay/Symbol.js @@ -0,0 +1,25 @@ +import Util from '../utils'; +import BMapUtil from '../utils/map'; + +const getSymbolOptions = config => ({ + anchor: config.anchor && Util.convert2BSize(config.anchor), + fillColor: config.fillColor, + fillOpacity: config.fillOpacity, + scale: config.scale, + rotation: config.rotation, + strokeColor: config.strokeColor, + strokeOpacity: config.strokeOpacity, + strokeWeight: config.strokeWeight, +}); + +const processPath = path => (global[path] ? global[path] : path); + +class Symbol { + constructor(config = {}) { + const options = getSymbolOptions(config); + const path = processPath(config.path); + return BMapUtil.BSymbol(path, options); + } +} + +export default Symbol; diff --git a/src/core/constants/index.js b/src/core/constants/index.js new file mode 100644 index 0000000..d636135 --- /dev/null +++ b/src/core/constants/index.js @@ -0,0 +1,177 @@ +/** + * 标注的动画效果 + */ +const ANIMATION = { + DROP: 'BMAP_ANIMATION_DROP', + BOUNCE: 'BMAP_ANIMATION_BOUNCE', +}; + +/** + * 内置的右键菜单图标 + */ +const CONTEXT_MENU_ICON = { + ZOOM_IN: 'BMAP_CONTEXT_MENU_ICON_ZOOMIN', + ZOOM_OUT: 'BMAP_CONTEXT_MENU_ICON_ZOOMOUT', +}; + +/** + * 控件的定位 + */ +const CONTROL_ANCHOR = { + TOP_LEFT: 'BMAP_ANCHOR_TOP_LEFT', + TOP_RIGHT: 'BMAP_ANCHOR_TOP_RIGHT', + BOTTOM_LEFT: 'BMAP_ANCHOR_BOTTOM_LEFT', + BOTTOM_RIGHT: 'BMAP_ANCHOR_BOTTOM_RIGHT', +}; + +/** + * 长度单位制 + */ +const LENGTH_UNIT = { + METRIC: 'BMAP_UNIT_METRIC', + IMPERIAL: 'BMAP_UNIT_IMPERIAL', +}; + +/** + * 地图上所有覆盖物的容器集合 + */ +const MAP_PANES = { + FLOAT: 'floatPane', // 信息窗口所在容器 + FLOAT_SHADOW: 'floatShadow', // 信息窗口阴影所在容器 + LABEL: 'labelPane', // 文本标注所在容器 + MARKER: 'markerPane', // 标注图标所在容器 + MARKER_MOUSE: 'markerMouseTarget', // 标注点击区域所在容器 + MARKER_SHADOW: 'markerShadow', // 标注阴影所在容器 + MAP: 'mapPane', // 折现、多边形等矢量图形所在容器 +}; + +/** + * 地图类型 + */ +const MAP_TYPE = { + NORMAL: 'BMAP_NORMAL_MAP', + PERSPECTIVE: 'BMAP_PERSPECTIVE_MAP', + SATELLITE: 'BMAP_SATELLITE_MAP', + HYBRID: 'BMAP_HYBRID_MAP', +}; + +/** + * MapTypeControl的外观样式 + */ +const MAP_TYPE_CONTROL_TYPE = { + HORIZONTAL: 'BMAP_MAPTYPE_CONTROL_HORIZONTAL', + DROPDOWN: 'BMAP_MAPTYPE_CONTROL_DROPDOWN', + MAP: 'BMAP_MAPTYPE_CONTROL_MAP', +}; + +/** + * 平移缩放控件的类型 + */ +const NAVIGATION_CONTROL_TYPE = { + LARGE: 'BMAP_NAVIGATION_CONTROL_LARGE', + SMALL: 'BMAP_NAVIGATION_CONTROL_SMALL', + PAN: 'BMAP_NAVIGATION_CONTROL_PAN', + ZOOM: 'BMAP_NAVIGATION_CONTROL_ZOOM', +}; + +/** + * 海量点预设的不同形状 + */ +const SHAPE_TYPE = { + CIRCLE: 'BMAP_POINT_SHAPE_CIRCLE', + STAR: 'BMAP_POINT_SHAPE_STAR', + SQUARE: 'BMAP_POINT_SHAPE_SQUARE', + RHOMBUS: 'BMAP_POINT_SHAPE_RHOMBUS', + WATERDROP: 'BMAP_POINT_SHAPE_WATERDROP', +}; + +/** + * 海量点预设的不同尺寸 + */ +const SIZE_TYPE = { + TINY: 'BMAP_POINT_SIZE_TINY', + SMALLER: 'BMAP_POINT_SIZE_SMALLER', + SMALL: 'BMAP_POINT_SIZE_SMALL', + NORMAL: 'BMAP_POINT_SIZE_NORMAL', + BIG: 'BMAP_POINT_SIZE_BIG', + BIGGER: 'BMAP_POINT_SIZE_BIGGER', + HUGE: 'BMAP_POINT_SIZE_HUGE', +}; + +/** + * 矢量图标类预设的图标样式 + */ +const SYMBOL_SHAPE_TYPE = { + CIRCLE: 'BMap_Symbol_SHAPE_CIRCLE', + RECTANGLE: 'BMap_Symbol_SHAPE_RECTANGLE', + RHOMBUS: 'BMap_Symbol_SHAPE_RHOMBUS', + STAR: 'BMap_Symbol_SHAPE_STAR', + BACKWARD_CLOSED_ARROW: 'BMap_Symbol_SHAPE_BACKWARD_CLOSED_ARROW', + FORWARD_CLOSED_ARROW: 'BMap_Symbol_SHAPE_FORWARD_CLOSED_ARROW', + BACKWARD_OPEN_ARROW: 'BMap_Symbol_SHAPE_BACKWARD_OPEN_ARROW', + FORWARD_OPEN_ARROW: 'BMap_Symbol_SHAPE_FORWARD_OPEN_ARROW', + POINT: 'BMap_Symbol_SHAPE_POINT', + PLANE: 'BMap_Symbol_SHAPE_PLANE', + CAMERA: 'BMap_Symbol_SHAPE_CAMERA', + WARNING: 'BMap_Symbol_SHAPE_WARNING', + SMILE: 'BMap_Symbol_SHAPE_SMILE', + CLOCK: 'BMap_Symbol_SHAPE_CLOCK', +}; + +/** + * 驾车方案的策略配置 + */ +const DRIVING_POLICY = { + DEFAULT: 'BMAP_DRIVING_POLICY_DEFAULT', + FIRST_HIGHWAYS: 'BMAP_DRIVING_POLICY_FIRST_HIGHWAYS', + AVOID_HIGHWAYS: 'BMAP_DRIVING_POLICY_AVOID_HIGHWAYS', + AVOID_CONGESTION: 'BMAP_DRIVING_POLICY_AVOID_CONGESTION', +}; + +/** + * 跨城公交换乘策略 + */ +const INTERCITY_POLICY = { + LEAST_TIME: 'BMAP_INTERCITY_POLICY_LEAST_TIME', + EARLY_START: 'BMAP_INTERCITY_POLICY_EARLY_START', + CHEAP_PRICE: 'BMAP_INTERCITY_POLICY_CHEAP_PRICE', +}; + +/** + * 市内公交方案换乘策略 + */ +const TRANSIT_POLICY = { + RECOMMEND: 'BMAP_TRANSIT_POLICY_RECOMMEND', + LEAST_TIME: 'BMAP_TRANSIT_POLICY_LEAST_TIME', + LEAST_TRANSFER: 'BMAP_TRANSIT_POLICY_LEAST_TRANSFER', + LEAST_WALKING: 'BMAP_TRANSIT_POLICY_LEAST_WALKING', + AVOID_SUBWAYS: 'BMAP_TRANSIT_POLICY_AVOID_SUBWAYS', + FIRST_SUBWAYS: 'BMAP_TRANSIT_POLICY_FIRST_SUBWAYS', +}; + +/** + * 跨城交通方式策略 + */ +const TRANSIT_TYPE_POLICY = { + TRAIN: 'BMAP_TRANSIT_TYPE_POLICY_TRAIN', + AIRPLANE: 'BMAP_TRANSIT_TYPE_POLICY_AIRPLANE', + COACH: 'BMAP_TRANSIT_TYPE_POLICY_COACH', +}; + +export default { + ANIMATION, + CONTEXT_MENU_ICON, + CONTROL_ANCHOR, + LENGTH_UNIT, + MAP_PANES, + MAP_TYPE, + MAP_TYPE_CONTROL_TYPE, + NAVIGATION_CONTROL_TYPE, + SHAPE_TYPE, + SIZE_TYPE, + SYMBOL_SHAPE_TYPE, + DRIVING_POLICY, + INTERCITY_POLICY, + TRANSIT_POLICY, + TRANSIT_TYPE_POLICY, +}; diff --git a/src/core/index.js b/src/core/index.js new file mode 100644 index 0000000..a9bb29a --- /dev/null +++ b/src/core/index.js @@ -0,0 +1,82 @@ +import Map from './Map'; +import BMapUtil from './utils/map'; +import Util from './utils'; +import initCustomControl from './Control/Custom'; +import CityList from './Control/CityList'; +import Copyright from './Control/Copyright'; +import Navigation from './Control/Navigation'; +import MapType from './Control/MapType'; +import Scale from './Control/Scale'; +import Panorama from './Control/Panorama'; +import OverviewMap from './Control/OverviewMap'; +import Geolocation from './Control/Geolocation'; +import initCustomOverlay from './Overlay/Custom'; +import Marker from './Overlay/Marker'; +import InfoWindow from './Overlay/InfoWindow'; +import Circle from './Overlay/Circle'; +import Polygon from './Overlay/Polygon'; +import Polyline from './Overlay/Polyline'; +import Label from './Overlay/Label'; +import GroundOverlay from './Overlay/GroundOverlay'; +import PointCollection from './Overlay/PointCollection'; +import Icon from './Overlay/Icon'; +import IconSequence from './Overlay/IconSequence'; +import Symbol from './Overlay/Symbol'; +import AutoComplete from './AutoComplete'; +import Constants from './constants'; +import TileLayer from './Layer/TileLayer'; +import TrafficLayer from './Layer/TrafficLayer'; + +export { + BMapUtil, + Util, + initCustomControl, + CityList, + Copyright, + Navigation, + MapType, + Scale, + Panorama, + OverviewMap, + Geolocation, + initCustomOverlay, + Marker, + Circle, + Polygon, + Label, + InfoWindow, + Polyline, + Constants, + AutoComplete, + GroundOverlay, + PointCollection, + Icon, + IconSequence, + Symbol, + TileLayer, + TrafficLayer, +}; + +const addBMapScript = (ak, version = 3) => { + if (!global.BMap && !global.mapLoader) { + global.mapLoader = new Promise((resolve) => { + const script = document.createElement('script'); + script.src = `https://api.map.baidu.com/api?v=${version}.0&ak=${ak}&callback=initBMapCallBack`; + document.head.appendChild(script); + global.initBMapCallBack = () => { + resolve(global.BMap); + document.head.removeChild(script); + delete global.mapLoader; + delete global.initBMapCallBack; + }; + }); + } + return global.mapLoader; +}; + +const initMap = async (container, config) => { + await addBMapScript(config.ak, config.version); + return new Map(container, config); +}; + +export default initMap; diff --git a/src/core/options/autoComplete.js b/src/core/options/autoComplete.js new file mode 100644 index 0000000..6084505 --- /dev/null +++ b/src/core/options/autoComplete.js @@ -0,0 +1,7 @@ +export default { + SET: [ + 'types', + 'location', + 'inputValue', + ], +}; diff --git a/src/core/options/circle.js b/src/core/options/circle.js new file mode 100644 index 0000000..370c73e --- /dev/null +++ b/src/core/options/circle.js @@ -0,0 +1,16 @@ +export default { + SET: [ + 'center', + 'radius', + 'strokeColor', + 'fillColor', + 'strokeOpacity', + 'fillOpacity', + 'strokeWeight', + 'strokeStyle', + ], + BOOLEAN: [ + 'editing', + 'massClear', + ], +}; diff --git a/src/core/options/ground.js b/src/core/options/ground.js new file mode 100644 index 0000000..b24dc59 --- /dev/null +++ b/src/core/options/ground.js @@ -0,0 +1,9 @@ +export default { + SET: [ + 'bounds', + 'opacity', + 'imageURL', + 'displayOnMinLevel', + 'displayOnMaxLevel', + ], +}; diff --git a/src/core/options/infoWindow.js b/src/core/options/infoWindow.js new file mode 100644 index 0000000..76cdfe9 --- /dev/null +++ b/src/core/options/infoWindow.js @@ -0,0 +1,13 @@ +export default { + SET: [ + 'width', + 'height', + 'title', + 'content', + 'maxContent', + ], + BOOLEAN: [ + 'autoPan', + 'closeOnClick', + ], +}; diff --git a/src/core/options/label.js b/src/core/options/label.js new file mode 100644 index 0000000..465f10a --- /dev/null +++ b/src/core/options/label.js @@ -0,0 +1,13 @@ +export default { + SET: [ + 'style', + 'content', + 'position', + 'offset', + 'title', + 'zIndex', + ], + BOOLEAN: [ + 'massClear', + ], +}; diff --git a/src/core/options/map.js b/src/core/options/map.js new file mode 100644 index 0000000..2ea3a86 --- /dev/null +++ b/src/core/options/map.js @@ -0,0 +1,22 @@ +export default { + SET: [ + 'center', + 'minZoom', + 'maxZoom', + 'defaultCursor', + 'draggingCursor', + 'mapStyle', + 'mapStyleV2', + 'zoom', + ], + BOOLEAN: [ + 'dragging', + 'scrollWheelZoom', + 'doubleClickZoom', + 'keyboard', + 'inertialDragging', + 'continuousZoom', + 'pinchToZoom', + 'autoResize', + ], +}; diff --git a/src/core/options/marker.js b/src/core/options/marker.js new file mode 100644 index 0000000..8817e9f --- /dev/null +++ b/src/core/options/marker.js @@ -0,0 +1,16 @@ +export default { + SET: [ + 'icon', + 'position', + 'offset', + 'label', + 'title', + 'zIndex', + 'animation', + 'rotation', + ], + BOOLEAN: [ + 'massClear', + 'dragging', + ], +}; diff --git a/src/core/options/polygon.js b/src/core/options/polygon.js new file mode 100644 index 0000000..0629f44 --- /dev/null +++ b/src/core/options/polygon.js @@ -0,0 +1,15 @@ +export default { + SET: [ + 'path', + 'strokeColor', + 'fillColor', + 'strokeOpacity', + 'fillOpacity', + 'strokeWeight', + 'strokeStyle', + ], + BOOLEAN: [ + 'editing', + 'massClear', + ], +}; diff --git a/src/core/options/polyline.js b/src/core/options/polyline.js new file mode 100644 index 0000000..47725ee --- /dev/null +++ b/src/core/options/polyline.js @@ -0,0 +1,13 @@ +export default { + SET: [ + 'path', + 'strokeColor', + 'strokeOpacity', + 'strokeWeight', + 'strokeStyle', + ], + BOOLEAN: [ + 'editing', + 'massClear', + ], +}; diff --git a/src/core/options/symbol.js b/src/core/options/symbol.js new file mode 100644 index 0000000..66739ff --- /dev/null +++ b/src/core/options/symbol.js @@ -0,0 +1,13 @@ +export default { + SET: [ + 'path', + 'anchor', + 'rotation', + 'scale', + 'strokeWeight', + 'strokeColor', + 'strokeOpacity', + 'fillColor', + 'fillOpacity', + ], +}; diff --git a/src/core/utils/index.js b/src/core/utils/index.js new file mode 100644 index 0000000..1a09a06 --- /dev/null +++ b/src/core/utils/index.js @@ -0,0 +1,285 @@ +import isEqual from 'lodash.isequal'; +import BMapUtil from './map'; + +/** + * 是否为Point + * @param {*} point + */ +const isPoint = point => point.lng && point.lat; + +/** + * 是否为BMap.Point + * @param {*} point + */ +const isBPoint = point => isPoint(point) && point.equals; + +/** + * 是否为Size + * @param {*} point + */ +const isSize = size => size.width && size.height; + +/** + * 是否为BMap.Size + * @param {*} size + */ +const isBSize = size => isSize(size) && size.equals; + +/** + * 是否为矩形范围 + * @param {*} bounds + */ +const isBounds = bounds => bounds.sw && bounds.ne; + +/** + * 是否为BMap.Bounds + * @param {*} bounds + */ +const isBBounds = bounds => isBounds(bounds) && bounds.equals; + +/** + * 是否为空 + * @param {*} obj + */ +const isNil = obj => obj === undefined || obj === null; + +/** + * 是否为字符串 + * @param {*} str + */ +const isString = str => typeof str === 'string'; + +/** + * 首字母转为大写 + * @param {*} str + */ +const firstUpperCase = str => str.replace(/^\S/, s => s.toUpperCase()); + +/** + * 首字母转为小写 + * @param {*} str + */ +const firstLowerCase = str => str.replace(/^\S/, s => s.toLowerCase()); + +/** + * 获取行政区包含点集合 + * @param {*} name 行政区名称 + */ +const getBoundary = name => new Promise((resolve, reject) => { + const boundary = new global.BMap.Boundary(); + + boundary.get(name, (res) => { + const count = res.boundaries.length; + if (count === 0) { + reject(); + } + const area = []; + let allPoints = []; + for (let i = 0; i < count; i += 1) { + const arr = res.boundaries[i].split(';').map((item) => { + const pointArr = item.split(','); + return BMapUtil.BPoint({ lng: pointArr[0], lat: pointArr[1].trim() }); + }); + allPoints = allPoints.concat(arr); + area.push(arr); + } + + resolve({ + area, + points: allPoints, + }); + }); +}); + +/** + * 将传入值转换为 BMap.Point + * @param {*} point 点对象 { lng, lat } + * @param {*} propsName 用于错误提示 + */ +const convert2BPoint = (point, propsName = 'point') => { + if (isNil(point)) { + throw Error(`Missing property \`${propsName}\``); + } + if (!isPoint(point)) { + throw Error(`The \`${propsName}\` property should be a literal value \`{ lng, lat }\``); + } else if (!isBPoint(point)) { + point = BMapUtil.BPoint({ ...point }); + } + return point; +}; + +/** + * 将传入值转换为 BMap.Size + * @param {*} point 矩形尺寸 { width, height } + * @param {*} propsName 用于错误提示 + */ +const convert2BSize = (size, propsName = 'size') => { + if (isNil(size)) { + throw Error(`Missing property \`${propsName}\``); + } + if (!isSize(size)) { + throw Error(`The \`${propsName}\` property should be a literal value \`{ width, height }\``); + } + if (!isBSize(size)) { + size = BMapUtil.BSize({ ...size }); + } + return size; +}; + +/** + * 将值转换为 BMap.Bounds + * @param {*} point 矩形区域 { sw, ne } + * @param {*} propsName 用于错误提示 + */ +const convert2BBounds = (bounds, propsName = 'bounds') => { + if (isNil(bounds)) { + throw Error(`Missing property \`${propsName}\``); + } + if (!isBounds(bounds)) { + throw Error(`The \`${propsName}\` property should be a literal value \`{ width, height }\``); + } + if (!isBBounds(bounds)) { + bounds = BMapUtil.BBounds({ ...bounds }); + } + return bounds; +}; + +/** + * 为目标对象绑定事件 + * @param {*} target 目标对象 + * @param {*} events 事件集合 + */ +const bindEvents = (target, events = {}) => { + Object.keys(events).forEach((eventName) => { + const eventType = typeof events[eventName]; + if (eventType !== 'function') { + console.warn(`Events's props value should be a function, but got '${eventType}'`); + } + const callback = (...args) => { + if (eventType === 'function') { + events[eventName].call(null, ...args); + } + }; + target.events = target.events || {}; + target.addEventListener(eventName, callback); + target.events[`${eventName}`] = callback; + }); +}; + +/** + * 将目标对象中已绑定事件移除 + * @param {*} target + */ +const unbindEvents = (target) => { + const { events = {} } = target; + Object.keys(events).forEach((eventName) => { + const event = events[eventName]; + target.removeEventListener(eventName, event); + }); + target.events = {}; +}; + +/** + * 处理 target.setXXX 方法 + * @param {*} target 目标对象 + * @param {*} options 属性集合 + * @param {*} values 值集合 + */ +const processSetOptions = (target, options, values) => { + options.forEach((key) => { + if (values[key] || typeof values[key] === 'boolean') { + const upKey = firstUpperCase(key); + if (target[`set${upKey}`]) { + target[`set${upKey}`](values[key]); + } + } + }); +}; + +/** + * 处理 target.enableXXX 、 target.disableXXX 方法 + * @param {*} target 目标对象 + * @param {*} options 属性集合 + * @param {*} values 值集合 + */ +const processBooleanOptions = (target, options, values) => { + options.forEach((key) => { + if (values[key] || typeof values[key] === 'boolean') { + const upKey = firstUpperCase(key); + const prefix = values[key] ? 'enable' : 'disable'; + if (target[`${prefix}${upKey}`]) { + target[`${prefix}${upKey}`](); + } + } + }); +}; + +/** + * 比较新旧config,返回差异集合 + * @param {*} oldConfig + * @param {*} newConfig + */ +const compareConfig = (oldConfig, newConfig) => { + const result = { ...oldConfig, ...newConfig }; + const keys = Object.keys(result); + for (let i = 0, len = keys.length; i < len; i += 1) { + const key = keys[i]; + if (!isNil(oldConfig[key]) && isEqual(oldConfig[key], result[key])) { + delete result[key]; + } + } + return result; +}; + +/** + * 转换Control配置项 + * @param {*} param0 + */ +const convertControlOptions = ({ anchor, offset }) => { + const result = {}; + + if (anchor) { + result.anchor = !isNil(global[anchor]) ? global[anchor] : anchor; + } + + if (offset) { + result.offset = convert2BSize(offset, 'offset'); + } + return result; +}; + +/** + * 处理Control显示隐藏 + * @param {*} target + * @param {*} visible + */ +const processControlVisible = (target, visible) => { + if (!isNil(target) && !isNil(visible)) { + return visible ? target.show() : target.hide(); + } + return null; +}; + + +export default { + isPoint, + isBPoint, + isSize, + isBSize, + isBounds, + isBBounds, + isNil, + isString, + getBoundary, + convert2BPoint, + convert2BSize, + convert2BBounds, + bindEvents, + unbindEvents, + processSetOptions, + processBooleanOptions, + compareConfig, + firstLowerCase, + convertControlOptions, + processControlVisible, +}; diff --git a/src/core/utils/map.js b/src/core/utils/map.js new file mode 100644 index 0000000..440edfe --- /dev/null +++ b/src/core/utils/map.js @@ -0,0 +1,199 @@ +const BMapUtil = { + BMap(container, opts) { + return new global.BMap.Map(container, opts); + }, + BPoint({ lng, lat }) { + return new global.BMap.Point(lng, lat); + }, + BSize({ width, height }) { + return new global.BMap.Size(Number(width), Number(height)); + }, + BPixel({ x, y }) { + return new global.BMap.Pixel(x, y); + }, + BBounds({ sw, ne }) { + const swPoint = BMapUtil.BPoint(sw); + const nePoint = BMapUtil.BPoint(ne); + + return new global.BMap.Bounds(swPoint, nePoint); + }, + BMenuItem(text, callback, opts) { + return new global.BMap.MenuItem(text, callback, opts); + }, + BContextMenu(subMenus = []) { + const contextMenu = new global.BMap.ContextMenu(); + subMenus.forEach((item) => { + contextMenu.addItem(item); + if (item.separator) { + contextMenu.addSeparator(); + } + }); + return contextMenu; + }, + BIcon(url, size, opts) { + return new global.BMap.Icon(url, size, opts); + }, + BIconSequence(symbol, offset, repeat, fixedRotation) { + return new global.BMap.IconSequence(symbol, offset, repeat, fixedRotation); + }, + BControl() { + return new global.BMap.Control(); + }, + BCityListControl(opts) { + return new global.BMap.CityListControl(opts); + }, + BCopyrightControl(opts) { + return new global.BMap.CopyrightControl(opts); + }, + BNavigationControl(opts) { + return new global.BMap.NavigationControl(opts); + }, + BMapTypeControl(opts) { + return new global.BMap.MapTypeControl(opts); + }, + BScaleControl(opts) { + return new global.BMap.ScaleControl(opts); + }, + BPanoramaControl(opts) { + return new global.BMap.PanoramaControl(opts); + }, + BOverviewMapControl(opts) { + return new global.BMap.OverviewMapControl(opts); + }, + BGeolocationControl(opts) { + return new global.BMap.GeolocationControl(opts); + }, + BOverlay() { + return new global.BMap.Overlay(); + }, + BMarker(point, opts) { + return new global.BMap.Marker(point, opts); + }, + BLabel(content, opts) { + return new global.BMap.Label(content, opts); + }, + BCircle(center, radius, opts) { + return new global.BMap.Circle(center, radius, opts); + }, + BPolyline(points, opts) { + return new global.BMap.Polyline(points, opts); + }, + BInfoWindow(content, opts) { + return new global.BMap.InfoWindow(content, opts); + }, + BPolygon(points, opts) { + return new global.BMap.Polygon(points, opts); + }, + BGroundOverlay(bounds, opts) { + return new global.BMap.GroundOverlay(bounds, opts); + }, + BPointCollection(points, opts) { + return new global.BMap.PointCollection(points, opts); + }, + BAutocomplete(opts) { + return new global.BMap.Autocomplete(opts); + }, + BSymbol(path, opts) { + return new global.BMap.Symbol(path, opts); + }, + BTileLayer(opts) { + return new global.BMap.TileLayer(opts); + }, + BTrafficLayer(opts) { + return new global.BMap.TrafficLayer(opts); + }, + BLocalSearch(location, opts) { + return new global.BMap.LocalSearch(location, opts); + }, + BGeolocation() { + return new global.BMap.Geolocation(); + }, + BConvertor() { + return new global.BMap.Convertor(); + }, + BTransitRoute(location, opts) { + return new global.BMap.TransitRoute(location, opts); + }, + BWalkingRoute(location, opts) { + return new global.BMap.WalkingRoute(location, opts); + }, + BRidingRoute(location, opts) { + return new global.BMap.RidingRoute(location, opts); + }, + BDrivingRoute(location, opts) { + return new global.BMap.DrivingRoute(location, opts); + }, + /** + * 根据关键字查询位置信息 + * @param {*} keyword 关键字 + * @param {*} location 定位信息[map实例/string/point] + */ + search(keyword, location) { + return new Promise((resolve) => { + const local = BMapUtil.BLocalSearch(location, { + onSearchComplete(result) { + const list = []; + for (let i = 0, len = result.getCurrentNumPois(); i < len - 1; i += 1) { + list.push(result.getPoi(i)); + } + resolve(result); + }, + }); + local.search(keyword); + }); + }, + + /** + * 获取当前位置信息 + */ + getCurrentPosition() { + return new Promise((resolve, reject) => { + const geo = BMapUtil.BGeolocation(); + geo.getCurrentPosition((result) => { + const status = geo.getStatus(); + if (status === global.BMAP_STATUS_SUCCESS) { + resolve(result); + } else { + reject(status); + } + }); + }); + }, + + /** + * 对指定的地址进行解析,返回坐标点 + * @param {*} address + * @param {*} city + */ + getPoint(address, city) { + return new Promise((resolve, reject) => { + const geo = new global.BMap.Geocoder(); + geo.getPoint(address, (point) => { + if (point) { + resolve(point); + } else { + reject(); + } + }, city); + }); + }, + + /** + * 对指定坐标点解析,返回地址信息 + * @param {*} point + */ + getLocation(point) { + return new Promise((resolve, reject) => { + const geo = new global.BMap.Geocoder(); + geo.getLocation(point, (result) => { + if (result) { + resolve(result); + } else { + reject(); + } + }); + }); + }, +}; + +export default BMapUtil; diff --git a/src/index.js b/src/index.js index 3683f94..799e87a 100644 --- a/src/index.js +++ b/src/index.js @@ -1,10 +1,14 @@ +/** + * 基础类 + */ +export { default as Base } from './components/Base'; + /** * 基础组件 */ export { default as Map } from './components/Map'; -export { default as Control } from './components/Control'; -export { default as Overlay } from './components/Overlay'; -export { default as ReactComponent } from './components/ReactComponent'; +export { default as CustomControl } from './components/Control/Custom'; +export { default as CustomOverlay } from './components/Overlay/Custom'; export { default as AutoComplete } from './components/AutoComplete'; /** @@ -13,8 +17,8 @@ export { default as AutoComplete } from './components/AutoComplete'; export { default as Navigation } from './components/Control/Navigation'; export { default as OverviewMap } from './components/Control/OverviewMap'; export { default as Scale } from './components/Control/Scale'; -export { default as MapTypeCtrl } from './components/Control/MapType'; -export { default as Copyright } from './components/Control/Copyright'; +export { default as MapType } from './components/Control/MapType'; +export { default as CopyrightControl } from './components/Control/CopyrightControl'; export { default as Geolocation } from './components/Control/Geolocation'; export { default as Panorama } from './components/Control/Panorama'; export { default as CityList } from './components/Control/CityList'; @@ -30,58 +34,13 @@ export { default as Circle } from './components/Overlay/Circle'; export { default as InfoWindow } from './components/Overlay/InfoWindow'; export { default as Ground } from './components/Overlay/Ground'; export { default as PointCollection } from './components/Overlay/PointCollection'; -export { default as Symbol } from './components/Overlay/Symbol'; export { default as Boundary } from './components/Overlay/Boundary'; -/** - * 扩展类库 - */ -export { default as Heatmap } from './components/Lib/Heatmap'; -export { default as CurveLine } from './components/Lib/CurveLine'; -export { default as MarkerClusterer } from './components/Lib/MarkerClusterer'; -export { default as DrawingManager } from './components/Lib/DrawingManager'; -export { default as DistanceTool } from './components/Lib/DistanceTool'; -export { default as TrafficControl } from './components/Lib/TrafficControl'; - /** * 地图图层 */ -export { default as Tile } from './components/Layers/Tile'; - -/** - * 服务类 - */ -export { default as LocalSearch } from './components/Service/LocalSearch'; -export { default as TransitRoute } from './components/Service/TransitRoute'; -export { default as DrivingRoute } from './components/Service/DrivingRoute'; -export { default as WalkingRoute } from './components/Service/WalkingRoute'; -export { default as RidingRoute } from './components/Service/RidingRoute'; -export { default as BusLineSearch } from './components/Service/BusLineSearch'; +export { default as TileLayer } from './components/Layer/TileLayer'; +export { default as TrafficLayer } from './components/Layer/TrafficLayer'; -/** - * 常量 - */ -export { default as MapType } from './constants/MapType'; -export { default as ControlAnchor } from './constants/ControlAnchor'; -export { default as NavigationType } from './constants/NavigationType'; -export { default as LengthUnit } from './constants/LengthUnit'; -export { default as MapPane } from './constants/MapPane'; -export { default as MapTypeControlType } from './constants/MapTypeControlType'; -export { default as StatusCode } from './constants/StatusCode'; -export { default as Animation } from './constants/Animation'; -export { default as ShapeType } from './constants/ShapeType'; -export { default as SizeType } from './constants/SizeType'; -export { default as SymbolShapeType } from './constants/SymbolShapeType'; -export { default as ContextMenuIcon } from './constants/ContextMenuIcon'; -export { default as TransitPolicy } from './constants/TransitPolicy'; -export { default as TransitTypePolicy } from './constants/TransitTypePolicy'; -export { default as IntercityPolicy } from './constants/IntercityPolicy'; -export { default as DrivingPolicy } from './constants/DrivingPolicy'; -export { default as DrawingMode } from './constants/DrawingMode'; - -/** - * 工具方法 - */ -export { - getMapBounds, getBounds, getPoiByKeyword, convertPoint, -} from './components/_base/util'; +export { default as Constants } from './core/constants'; +export { default as BMapUtil } from './core/utils/map'; diff --git a/src/libs/DistanceTool.js b/src/libs/DistanceTool.js deleted file mode 100644 index 9b9d812..0000000 --- a/src/libs/DistanceTool.js +++ /dev/null @@ -1,1795 +0,0 @@ -/** - * @fileoverview 百度地图的测距工具类,对外开放。 - * 允许用户在地图上点击完成距离的测量。 - * 使用者可以自定义测距线段的相关样式,例如线宽、颜色、测距结果所用的单位制等等。 - * 主入口类是DistanceTool, - * 基于Baidu Map API 1.2。 - * - * @author Baidu Map Api Group - * @version 1.2 - */ -(function (root, factory) { - if (typeof exports === 'object') { - module.exports = factory(); - } else if (typeof define === 'function' && define.amd) { - define(factory); - } else { - root.BMapLib = root.BMapLib || {}; - root.BMapLib.DistanceTool = root.BMapLib.DistanceTool || factory(); - } -})(this, function () { - /** - * 声明baidu包 - */ - var baidu = baidu || {guid : "$BAIDU$"}; - (function() { - // 一些页面级别唯一的属性,需要挂载在window[baidu.guid]上 - window[baidu.guid] = {}; - - /** - * 将源对象的所有属性拷贝到目标对象中 - * @name baidu.extend - * @function - * @grammar baidu.extend(target, source) - * @param {Object} target 目标对象 - * @param {Object} source 源对象 - * @returns {Object} 目标对象 - */ - baidu.extend = function (target, source) { - for (var p in source) { - if (source.hasOwnProperty(p)) { - target[p] = source[p]; - } - } - return target; - }; - - /** - * @ignore - * @namespace - * @baidu.lang 对语言层面的封装,包括类型判断、模块扩展、继承基类以及对象自定义事件的支持。 - * @property guid 对象的唯一标识 - */ - baidu.lang = baidu.lang || {}; - - /** - * 返回一个当前页面的唯一标识字符串。 - * @function - * @grammar baidu.lang.guid() - * @returns {String} 当前页面的唯一标识字符串 - */ - baidu.lang.guid = function() { - return "TANGRAM__" + (window[baidu.guid]._counter ++).toString(36); - }; - - window[baidu.guid]._counter = window[baidu.guid]._counter || 1; - - /** - * 所有类的实例的容器 - * key为每个实例的guid - */ - window[baidu.guid]._instances = window[baidu.guid]._instances || {}; - - /** - * Tangram继承机制提供的一个基类,用户可以通过继承baidu.lang.Class来获取它的属性及方法。 - * @function - * @name baidu.lang.Class - * @grammar baidu.lang.Class(guid) - * @param {string} guid 对象的唯一标识 - * @meta standard - * @remark baidu.lang.Class和它的子类的实例均包含一个全局唯一的标识guid。 - * guid是在构造函数中生成的,因此,继承自baidu.lang.Class的类应该直接或者间接调用它的构造函数。
    - * baidu.lang.Class的构造函数中产生guid的方式可以保证guid的唯一性,及每个实例都有一个全局唯一的guid。 - */ - baidu.lang.Class = function(guid) { - this.guid = guid || baidu.lang.guid(); - window[baidu.guid]._instances[this.guid] = this; - }; - - window[baidu.guid]._instances = window[baidu.guid]._instances || {}; - - /** - * 判断目标参数是否string类型或String对象 - * @name baidu.lang.isString - * @function - * @grammar baidu.lang.isString(source) - * @param {Any} source 目标参数 - * @shortcut isString - * @meta standard - * - * @returns {boolean} 类型判断结果 - */ - baidu.lang.isString = function (source) { - return '[object String]' == Object.prototype.toString.call(source); - }; - - /** - * 判断目标参数是否为function或Function实例 - * @name baidu.lang.isFunction - * @function - * @grammar baidu.lang.isFunction(source) - * @param {Any} source 目标参数 - * @returns {boolean} 类型判断结果 - */ - baidu.lang.isFunction = function (source) { - return '[object Function]' == Object.prototype.toString.call(source); - }; - - /** - * 重载了默认的toString方法,使得返回信息更加准确一些。 - * @return {string} 对象的String表示形式 - */ - baidu.lang.Class.prototype.toString = function(){ - return "[object " + (this._className || "Object" ) + "]"; - }; - - /** - * 释放对象所持有的资源,主要是自定义事件。 - * @name dispose - * @grammar obj.dispose() - */ - baidu.lang.Class.prototype.dispose = function(){ - delete window[baidu.guid]._instances[this.guid]; - for(var property in this){ - if (!baidu.lang.isFunction(this[property])) { - delete this[property]; - } - } - this.disposed = true; - }; - - /** - * 自定义的事件对象。 - * @function - * @name baidu.lang.Event - * @grammar baidu.lang.Event(type[, target]) - * @param {string} type 事件类型名称。为了方便区分事件和一个普通的方法,事件类型名称必须以"on"(小写)开头。 - * @param {Object} [target]触发事件的对象 - * @meta standard - * @remark 引入该模块,会自动为Class引入3个事件扩展方法:addEventListener、removeEventListener和dispatchEvent。 - * @see baidu.lang.Class - */ - baidu.lang.Event = function (type, target) { - this.type = type; - this.returnValue = true; - this.target = target || null; - this.currentTarget = null; - }; - - /** - * 注册对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.addEventListener(type, handler[, key]) - * @param {string} type 自定义事件的名称 - * @param {Function} handler 自定义事件被触发时应该调用的回调函数 - * @param {string} [key] 为事件监听函数指定的名称,可在移除时使用。如果不提供,方法会默认为它生成一个全局唯一的key。 - * @remark 事件类型区分大小写。如果自定义事件名称不是以小写"on"开头,该方法会给它加上"on"再进行判断,即"click"和"onclick"会被认为是同一种事件。 - */ - baidu.lang.Class.prototype.addEventListener = function (type, handler, key) { - if (!baidu.lang.isFunction(handler)) { - return; - } - !this.__listeners && (this.__listeners = {}); - var t = this.__listeners, id; - if (typeof key == "string" && key) { - if (/[^\w\-]/.test(key)) { - throw("nonstandard key:" + key); - } else { - handler.hashCode = key; - id = key; - } - } - type.indexOf("on") != 0 && (type = "on" + type); - typeof t[type] != "object" && (t[type] = {}); - id = id || baidu.lang.guid(); - handler.hashCode = id; - t[type][id] = handler; - }; - - /** - * 移除对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.removeEventListener(type, handler) - * @param {string} type 事件类型 - * @param {Function|string} handler 要移除的事件监听函数或者监听函数的key - * @remark 如果第二个参数handler没有被绑定到对应的自定义事件中,什么也不做。 - */ - baidu.lang.Class.prototype.removeEventListener = function (type, handler) { - if (baidu.lang.isFunction(handler)) { - handler = handler.hashCode; - } else if (!baidu.lang.isString(handler)) { - return; - } - !this.__listeners && (this.__listeners = {}); - type.indexOf("on") != 0 && (type = "on" + type); - var t = this.__listeners; - if (!t[type]) { - return; - } - t[type][handler] && delete t[type][handler]; - }; - - /** - * 派发自定义事件,使得绑定到自定义事件上面的函数都会被执行。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.dispatchEvent(event, options) - * @param {baidu.lang.Event|String} event Event对象,或事件名称(1.1.1起支持) - * @param {Object} options 扩展参数,所含属性键值会扩展到Event对象上(1.2起支持) - * @remark 处理会调用通过addEventListenr绑定的自定义事件回调函数之外,还会调用直接绑定到对象上面的自定义事件。 - * 例如:
    - * myobj.onMyEvent = function(){}
    - * myobj.addEventListener("onMyEvent", function(){}); - */ - baidu.lang.Class.prototype.dispatchEvent = function (event, options) { - if (baidu.lang.isString(event)) { - event = new baidu.lang.Event(event); - } - !this.__listeners && (this.__listeners = {}); - options = options || {}; - for (var i in options) { - event[i] = options[i]; - } - var i, t = this.__listeners, p = event.type; - event.target = event.target || this; - event.currentTarget = this; - p.indexOf("on") != 0 && (p = "on" + p); - baidu.lang.isFunction(this[p]) && this[p].apply(this, arguments); - if (typeof t[p] == "object") { - for (i in t[p]) { - t[p][i].apply(this, arguments); - } - } - return event.returnValue; - }; - - /** - * 为类型构造器建立继承关系 - * @name baidu.lang.inherits - * @function - * @grammar baidu.lang.inherits(subClass, superClass[, className]) - * @param {Function} subClass 子类构造器 - * @param {Function} superClass 父类构造器 - * @param {string} className 类名标识 - * @remark 使subClass继承superClass的prototype, - * 因此subClass的实例能够使用superClass的prototype中定义的所有属性和方法。
    - * 这个函数实际上是建立了subClass和superClass的原型链集成,并对subClass进行了constructor修正。
    - * 注意:如果要继承构造函数,需要在subClass里面call一下,具体见下面的demo例子 - * @shortcut inherits - * @meta standard - * @see baidu.lang.Class - */ - baidu.lang.inherits = function (subClass, superClass, className) { - var key, proto, - selfProps = subClass.prototype, - clazz = new Function(); - clazz.prototype = superClass.prototype; - proto = subClass.prototype = new clazz(); - for (key in selfProps) { - proto[key] = selfProps[key]; - } - subClass.prototype.constructor = subClass; - subClass.superClass = superClass.prototype; - - if ("string" == typeof className) { - proto._className = className; - } - }; - - /** - * @ignore - * @namespace baidu.dom 操作dom的方法。 - */ - baidu.dom = baidu.dom || {}; - - /** - * 从文档中获取指定的DOM元素 - * - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @meta standard - * @return {HTMLElement} DOM元素,如果不存在,返回null,如果参数不合法,直接返回参数 - */ - baidu._g = baidu.dom._g = function (id) { - if (baidu.lang.isString(id)) { - return document.getElementById(id); - } - return id; - }; - - /** - * 从文档中获取指定的DOM元素 - * @name baidu.dom.g - * @function - * @grammar baidu.dom.g(id) - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @meta standard - * - * @returns {HTMLElement|null} 获取的元素,查找不到时返回null,如果参数不合法,直接返回参数 - */ - baidu.g = baidu.dom.g = function (id) { - if ('string' == typeof id || id instanceof String) { - return document.getElementById(id); - } else if (id && id.nodeName && (id.nodeType == 1 || id.nodeType == 9)) { - return id; - } - return null; - }; - - /** - * 在目标元素的指定位置插入HTML代码 - * @name baidu.dom.insertHTML - * @function - * @grammar baidu.dom.insertHTML(element, position, html) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} position 插入html的位置信息,取值为beforeBegin,afterBegin,beforeEnd,afterEnd - * @param {string} html 要插入的html - * @remark - * - * 对于position参数,大小写不敏感
    - * 参数的意思:beforeBegin<span>afterBegin this is span! beforeEnd</span> afterEnd
    - * 此外,如果使用本函数插入带有script标签的HTML字符串,script标签对应的脚本将不会被执行。 - * - * @shortcut insertHTML - * @meta standard - * - * @returns {HTMLElement} 目标元素 - */ - baidu.insertHTML = baidu.dom.insertHTML = function (element, position, html) { - element = baidu.dom.g(element); - var range,begin; - - if (element.insertAdjacentHTML) { - element.insertAdjacentHTML(position, html); - } else { - // 这里不做"undefined" != typeof(HTMLElement) && !window.opera判断,其它浏览器将出错?! - // 但是其实做了判断,其它浏览器下等于这个函数就不能执行了 - range = element.ownerDocument.createRange(); - // FF下range的位置设置错误可能导致创建出来的fragment在插入dom树之后html结构乱掉 - // 改用range.insertNode来插入html, by wenyuxiang @ 2010-12-14. - position = position.toUpperCase(); - if (position == 'AFTERBEGIN' || position == 'BEFOREEND') { - range.selectNodeContents(element); - range.collapse(position == 'AFTERBEGIN'); - } else { - begin = position == 'BEFOREBEGIN'; - range[begin ? 'setStartBefore' : 'setEndAfter'](element); - range.collapse(begin); - } - range.insertNode(range.createContextualFragment(html)); - } - return element; - }; - - /** - * 为目标元素添加className - * @name baidu.dom.addClass - * @function - * @grammar baidu.dom.addClass(element, className) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} className 要添加的className,允许同时添加多个class,中间使用空白符分隔 - * @remark - * 使用者应保证提供的className合法性,不应包含不合法字符,className合法字符参考:http://www.w3.org/TR/CSS2/syndata.html。 - * @shortcut addClass - * @meta standard - * - * @returns {HTMLElement} 目标元素 - */ - baidu.ac = baidu.dom.addClass = function (element, className) { - element = baidu.dom.g(element); - var classArray = className.split(/\s+/), - result = element.className, - classMatch = " " + result + " ", - i = 0, - l = classArray.length; - - for (; i < l; i++){ - if ( classMatch.indexOf( " " + classArray[i] + " " ) < 0 ) { - result += (result ? ' ' : '') + classArray[i]; - } - } - - element.className = result; - return element; - }; - - /** - * @ignore - * @namespace baidu.event 屏蔽浏览器差异性的事件封装。 - * @property target 事件的触发元素 - * @property pageX 鼠标事件的鼠标x坐标 - * @property pageY 鼠标事件的鼠标y坐标 - * @property keyCode 键盘事件的键值 - */ - baidu.event = baidu.event || {}; - - /** - * 事件监听器的存储表 - * @private - * @meta standard - */ - baidu.event._listeners = baidu.event._listeners || []; - - /** - * 为目标元素添加事件监听器 - * @name baidu.event.on - * @function - * @grammar baidu.event.on(element, type, listener) - * @param {HTMLElement|string|window} element 目标元素或目标元素id - * @param {string} type 事件类型 - * @param {Function} listener 需要添加的监听器 - * @remark - * 1. 不支持跨浏览器的鼠标滚轮事件监听器添加
    - * 2. 改方法不为监听器灌入事件对象,以防止跨iframe事件挂载的事件对象获取失败 - * @shortcut on - * @meta standard - * @see baidu.event.un - * - * @returns {HTMLElement|window} 目标元素 - */ - baidu.on = baidu.event.on = function (element, type, listener) { - type = type.replace(/^on/i, ''); - element = baidu._g(element); - var realListener = function (ev) { - // 1. 这里不支持EventArgument, 原因是跨frame的事件挂载 - // 2. element是为了修正this - listener.call(element, ev); - }, - lis = baidu.event._listeners, - filter = baidu.event._eventFilter, - afterFilter, - realType = type; - type = type.toLowerCase(); - // filter过滤 - if(filter && filter[type]){ - afterFilter = filter[type](element, type, realListener); - realType = afterFilter.type; - realListener = afterFilter.listener; - } - // 事件监听器挂载 - if (element.addEventListener) { - element.addEventListener(realType, realListener, false); - } else if (element.attachEvent) { - element.attachEvent('on' + realType, realListener); - } - - // 将监听器存储到数组中 - lis[lis.length] = [element, type, listener, realListener, realType]; - return element; - }; - - /** - * 为目标元素移除事件监听器 - * @name baidu.event.un - * @function - * @grammar baidu.event.un(element, type, listener) - * @param {HTMLElement|string|window} element 目标元素或目标元素id - * @param {string} type 事件类型 - * @param {Function} listener 需要移除的监听器 - * @shortcut un - * @meta standard - * - * @returns {HTMLElement|window} 目标元素 - */ - baidu.un = baidu.event.un = function (element, type, listener) { - element = baidu._g(element); - type = type.replace(/^on/i, '').toLowerCase(); - - var lis = baidu.event._listeners, - len = lis.length, - isRemoveAll = !listener, - item, - realType, realListener; - - //如果将listener的结构改成json - //可以节省掉这个循环,优化性能 - //但是由于un的使用频率并不高,同时在listener不多的时候 - //遍历数组的性能消耗不会对代码产生影响 - //暂不考虑此优化 - while (len--) { - item = lis[len]; - - // listener存在时,移除element的所有以listener监听的type类型事件 - // listener不存在时,移除element的所有type类型事件 - if (item[1] === type - && item[0] === element - && (isRemoveAll || item[2] === listener)) { - realType = item[4]; - realListener = item[3]; - if (element.removeEventListener) { - element.removeEventListener(realType, realListener, false); - } else if (element.detachEvent) { - element.detachEvent('on' + realType, realListener); - } - lis.splice(len, 1); - } - } - return element; - }; - - /** - * 阻止事件的默认行为 - * @name baidu.event.preventDefault - * @function - * @grammar baidu.event.preventDefault(event) - * @param {Event} event 事件对象 - * @meta standard - */ - baidu.preventDefault = baidu.event.preventDefault = function (event) { - if (event.preventDefault) { - event.preventDefault(); - } else { - event.returnValue = false; - } - }; - })(); - - /** - * @exports DistanceTool as BMapLib.DistanceTool - */ - var DistanceTool = - /** - * DistanceTool类的构造函数 - * @class 距离测算类,实现测距效果的入口。 - * 实例化该类后,即可调用该类提供的open - * 方法开启测距状态。 - * - * @constructor - * @param {Map} map Baidu map的实例对象 - * @param {Json Object} opts 可选的输入参数,非必填项。可输入选项包括:
    - * {"followText" : {String} 测距过程中,提示框文字, - *
    "unit" : {String} 测距结果所用的单位制,可接受的属性为"metric"表示米制和"us"表示美国传统单位, - *
    "lineColor" : {String} 折线颜色, - *
    "lineStroke" : {Number} 折线宽度, - *
    "opacity" : {Number} 透明度, - *
    "lineStyle" : {String} 折线的样式,只可设置solid和dashed, - *
    "secIcon" : {BMap.Icon} 转折点的Icon, - *
    "closeIcon" : {BMap.Icon} 关闭按钮的Icon, - *
    "cursor" : {String} 跟随的鼠标样式} - * - * @example 参考示例:
    - * var map = new BMap.Map("container");
    map.centerAndZoom(new BMap.Point(116.404, 39.915), 15);
    var myDistanceToolObject = new BMapLib.DistanceTool(map, {lineStroke : 2}); - */ - function(map, opts){ - if (!map) { - return; - } - - /** - * map对象 - * @private - * @type {Map} - */ - this._map = map; - - opts = opts || {}; - /** - * _opts是默认参数赋值。 - * 下面通过用户输入的opts,对默认参数赋值 - * @private - * @type {Json} - */ - this._opts = baidu.extend( - baidu.extend(this._opts || {}, { - - /** - * 测距提示 - * @private - * @type {String} - */ - tips : "测距", - - /** - * 测距过程中,提示框文字 - * @private - * @type {String} - */ - followText : "单击确定地点,双击结束", - - /** - * 测距结果所用的单位制,可接受的属性为"metric"表示米制和"us"表示美国传统单位 - * @private - * @type {String} - */ - unit : "metric", - - /** - * 折线颜色 - * @private - * @type {String} - */ - lineColor : "#ff6319", - - /** - * 折线线宽 - * @private - * @type {Number} - */ - lineStroke : 2, - - /** - * 折线透明度 - * @private - * @type {Number} - */ - opacity : 0.8, - - /** - * 折线样式 - * @private - * @type {String} - */ - lineStyle : "solid", - - /** - * 跟随鼠标样式 - * @private - * @type {String} - */ - cursor : "http://api.map.baidu.com/images/ruler.cur", - - /** - * 转折点的ICON样式 - * @private - * @type {BMap.Icon} - */ - secIcon : null, - - /** - * 转折点的ICON样式 - * @private - * @type {BMap.Icon} - */ - closeIcon : null - }) - , opts); - - /** - * 跟随的title覆盖物 - * @private - * @type {BMap.Label} - */ - this._followTitle = null; - - /** - * 折线包含所有点的数组 - * @private - * @type {Array} - */ - this._points = []; - - /** - * 折线所包含的所有path数组 - * @private - * @type {Array} - */ - this._paths = []; - - /** - * 折线结点图片数组 - * @private - * @type {Array} - */ - this._dots = []; - - /** - * 折线测距包含所有线段的距离 - * @private - * @type {Array} - */ - this._segDistance = []; - - /** - * 覆盖物的数组 - * @private - * @type {Array} - */ - this._overlays = []; - - /** - * 是否在调用map.clearOverlays清除画线需要建立的相关overlay元素 - * @private - * @type {Boolean} - */ - this._enableMassClear = true, - - /** - * 单位制,存储语言包中定义的单位名称 - * @private - * @type {Json} - */ - this._units = { - // metric 表示米制 - metric : { - /** - * 米制的名称 - * @type {String} - */ - name : "metric", - - /** - * 和米制的换算关系 - * @type {Number} - */ - conv : 1, - - /** - * 米制单位下两个单位制之间的换算关系 - * @type {Number} - */ - incon : 1000, - - /** - * 米制单位下较小单位 - * @type {String} - */ - u1 : "米", - - /** - * 米制单位下较大单位 - * @type {String} - */ - u2 : "公里" - }, - // us 表示美国传统单位,各参数意义同上metric - us : { - name : "us", - conv : 3.2808, - incon : 5279.856, - u1 : "英尺", - u2 : "英里" - } - }; - - /** - * 是否已经开启了测距状态 - * @private - * @type {Boolean} - */ - this._isOpen = false; - - /** - * 未点击任何一点时,鼠标移动时的跟随提示文字 - * @private - * @type {String} - */ - this._startFollowText = "单击确定起点"; - - /** - * 地图移动的计时器 - * @private - * @type {Object} - */ - this._movingTimerId = null; - - /** - * 测距需要添加的CSS样式 - * @private - * @type {Json} - */ - this._styles = { - "BMapLib_diso" : "height:17px;width:5px;position:absolute;background:url(http://api.map.baidu.com/images/dis_box_01.gif) no-repeat left top" - ,"BMapLib_disi" : "color:#7a7a7a;position:absolute;left:5px;padding:0 4px 1px 0;line-height:17px;background:url(http://api.map.baidu.com/images/dis_box_01.gif) no-repeat right top" - ,"BMapLib_disBoxDis" : "color:#ff6319;font-weight:bold" - }; - - if (this._opts.lineStroke <= 0) { - this._opts.lineStroke = 2; - } - if (this._opts.opacity > 1) { - this._opts.opacity = 1; - } else if (this._opts.opacity < 0) { - this._opts.opacity = 0; - } - if (this._opts.lineStyle != "solid" && - this._opts.lineStyle != "dashed") { - this._opts.lineStyle = "solid"; - } - if (!this._units[this._opts.unit]) { - this._opts.unit = "metric"; - } - - this.text = "测距"; - } - - // 通过baidu.lang下的inherits方法,让DistanceTool继承baidu.lang.Class - baidu.lang.inherits(DistanceTool, baidu.lang.Class, "DistanceTool"); - - /** - * 地图区域的移动事件绑定 - * @return 无返回值 - */ - DistanceTool.prototype._bind = function(){ - // 设置鼠标样式 - this._setCursor(this._opts.cursor); - var me = this; - // 在装载地图的页面元素上,绑定鼠标移动事件 - baidu.on(this._map.getContainer(), "mousemove", function(e){ - if (!me._isOpen) { - return; - } - if (!me._followTitle) { - return; - } - e = window.event || e; - var t = e.target || e.srcElement; - // 如果触发该事件的页面元素不是遮盖效果层,则返回,无操作 - if (t != OperationMask.getDom(me._map)) { - me._followTitle.hide(); - return; - } - if (!me._mapMoving) { - me._followTitle.show(); - } - // 设置鼠标移动过程中,跟随的文字提示框的位置 - var pt = OperationMask.getDrawPoint(e, true); - me._followTitle.setPosition(pt); - }); - // 创建鼠标跟随的文字提示框 - if (this._startFollowText) { - var t = this._followTitle = new BMap.Label(this._startFollowText, {offset : new BMap.Size(14, 16)}); - this._followTitle.setStyles({color : "#333", borderColor : "#ff0103"}); - } - }; - - /** - * 开启地图的测距状态 - * @return {Boolean},开启测距状态成功,返回true;否则返回false。 - * - * @example 参考示例:
    - * myDistanceToolObject.open(); - */ - DistanceTool.prototype.open = function(){ - // 判断测距状态是否已经开启 - if (this._isOpen == true){ - return true; - } - // 已有其他地图上的鼠标操作工具开启 - if (!!global._toolInUse) { - return; - } - this._isOpen = true; - global._toolInUse = true; - - // 判断是否是否在移动过程中 - if (this._mapMoving){ - delete this._mapMoving; - } - - var me = this; - // 增加鼠标在地图区域移动的事件 - // 通过binded参数,避免多次绑定 - if (!this._binded) { - this._binded = true; - // 绑定控件项事件 - this._bind(); - // 地图的移动过程中,需要隐藏相关的提示框 - this._map.addEventListener("moving", function(){ - me._hideCurrent(); - }); - } - - // 将文字提示框作为BMap.Label元素,提交给Map Api进行管理 - if (this._followTitle) { - this._map.addOverlay(this._followTitle); - this._followTitle.hide(); - } - - /** - * 测距过程中,点击地图时,触发的操作 - * @ignore - * @param {Object} e event对象 - */ - var distClick = function(e) { - var map = me._map; - if (!me._isOpen) { - return; - } - // 通过event对象,计算得出点击位置的物理坐标,poi为一个BMap.Point对象 - e = window.event || e; - var poi = OperationMask.getDrawPoint(e, true); - // 验证计算得出的该点的位置合理性 - if (!me._isPointValid(poi)) { - return; - } - // 记录当前点的屏幕位置 - me._bind.initX = e.pageX || e.clientX || 0; - me._bind.initY = e.pageY || e.clientY || 0; - - // 这个if循环内的计算是,判断当前这个点,与存储内的最后一个点的距离, - // 如果距离过小,比如小于5,可以认为是用户的误点,可以忽略掉 - if (me._points.length > 0){ - var lstPx = map.pointToPixel(me._points[me._points.length - 1]); - var thisPx = map.pointToPixel(poi); - var dis = Math.sqrt(Math.pow(lstPx.x - thisPx.x, 2) + Math.pow(lstPx.y - thisPx.y, 2)); - if (dis < 5) { - return; - } - } - - me._bind.x = e.layerX || e.offsetX || 0; - me._bind.y = e.layerY || e.offsetY || 0; - me._points.push(poi); - // 添加测距结点 - me._addSecPoint(poi); - - // 调整跟踪鼠标的标签 - if (me._paths.length == 0) { - me._formatTitle(1, me._opts.followText, me._getTotalDistance()); - } - - // 修改确定线的颜色 - if (me._paths.length > 0) { - me._paths[me._paths.length - 1].show(); - me._paths[me._paths.length - 1].setStrokeOpacity(me._opts.opacity); - } - - var path = new BMap.Polyline([poi, poi], {enableMassClear : me._enableMassClear}); - me._map.addOverlay(path); - me._paths.push(path); - me._overlays.push(path); - - // 测距模式下线样式固定 - path.setStrokeWeight(me._opts.lineStroke); - path.setStrokeColor(me._opts.lineColor); - path.setStrokeOpacity(me._opts.opacity / 2); - path.setStrokeStyle(me._opts.lineStyle); - - // 如果地图正在移动则隐藏掉 - if (me._mapMoving){ - path.hide(); - } - - if (me._points.length > 1) { - var siblingPath = me._paths[me._points.length - 2]; - siblingPath.setPositionAt(1, poi); - } - - // 生成节点旁边的距离显示框 - var disText = ""; - if (me._points.length > 1) { - // 非起点的节点,显示当前的距离 - var segDis = me._setSegDistance(me._points[me._points.length - 2], me._points[me._points.length - 1]); - var meters = me._getTotalDistance(); - disText = me._formatDisStr(meters); - } else { - disText = "起点"; - } - var disLabel = new BMap.Label(disText, {offset : new BMap.Size(10, -5), enableMassClear : me._enableMassClear}); - disLabel.setStyles({color : "#333", borderColor : "#ff0103"}); - me._map.addOverlay(disLabel); - me._formatSegLabel(disLabel, disText); - me._overlays.push(disLabel); - poi.disLabel = disLabel; - disLabel.setPosition(poi); - - /** - * 测距过程中,每次点击底图添加节点时,派发事件的接口 - * @name DistanceTool#onaddpoint - * @event - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值: - *
    {"point : {BMap.Point} 最新添加上的节点BMap.Point对象, - *
    "pixel:{BMap.pixel} 最新添加上的节点BMap.Pixel对象, - *
    "index:{Number} 最新添加的节点的索引, - *
    "distance:{Number} 截止最新添加的节点的总距离} - * - * @example 参考示例:
    - * myDistanceToolObject.addEventListener("addpoint", function(e) { alert(e.distance); }); - */ - - // 生成名为onaddpoint的baidu.lang.Event对象 - // 并给该event对象添加上point、pixel、index和distance等属性字段 - // 然后在此刻,将绑定在onaddpoint上事件,全部赋予event参数,然后派发出去 - var event = new baidu.lang.Event("onaddpoint"); - event.point = poi; - event.pixel = me._map.pointToPixel(poi); - event.index = me._points.length - 1; - event.distance = me._getTotalDistance().toFixed(0); - me.dispatchEvent(event); - }; - - /** - * 测距过程中,鼠标在地图上移动时,触发的操作 - * @ignore - * @param {Object} e event对象 - */ - var distMove = function(e) { - if (!me._isOpen){ - return; - } - // 通过判断数组me._paths的长度,判断当前是否已经有测量节点 - // 也就是,如果没有节点,则还没有开始测量 - if (me._paths.length > 0) { - // 通过event参数,计算当前点的位置 - e = window.event || e; - var curX = e.pageX || e.clientX || 0; - var curY = e.pageY || e.clientY || 0; - if (typeof me._bind.initX == "undefined") { - me._bind.x = e.layerX || e.offsetX || 0; - me._bind.y = e.layerY || e.offsetY || 0; - me._bind.initX = curX; - me._bind.initY = curY; - } - var x = me._bind.x + curX - me._bind.initX; - var y = me._bind.y + curY - me._bind.initY; - - // 修改最后一条折线的终点位置,使之随着鼠标移动画线 - var path = me._paths[me._paths.length - 1]; - var poi = me._map.pixelToPoint(new BMap.Pixel(x, y)); - path.setPositionAt(1, poi); - - if (!me._mapMoving) { - path.show(); - } - var dx = 0; - var dy = 0; - // 计算当前鼠标位置,是否靠近边界、或者已经出了边界 - // 如果在边界位置,则需要向对应的方向移动地图,来进行测量 - // 每次移动的距离,设定为8 - if (x < 10) { - dx = 8; - } else if (x > me._map.getSize().width - 10){ - dx = -8; - } - if (y < 10) { - dy = 8; - } else if (y > me._map.getSize().height - 10){ - dy = -8; - } - // 如果dx和dy都等于0,表明不需要移动地图 - if (dx != 0 || dy != 0){ - // 此时需要向一个方向,平移地图 - if (!distMove._movingTimerId){ - me._mapMoving = true; - me._map.panBy(dx, dy, {noAnimation : true}); - me._movingTimerId = distMove._movingTimerId = setInterval(function(){ - me._map.panBy(dx, dy, {noAnimation : true}); - }, 30); - // 地图移动过程中,隐藏线段和标签 - path.hide(); - me._followTitle && me._followTitle.hide(); - } - } else { - if (distMove._movingTimerId) { - // 此时用户不在需要移动地图来测量,可以清除计时器 - clearInterval(distMove._movingTimerId); - delete distMove._movingTimerId; - delete me._movingTimerId; - - // 显示跟随提示框,并修改线路位置 - var lstP = me._paths[me._paths.length - 1]; - var poiN = me._map.pixelToPoint(new BMap.Pixel(x, y)); - if (!lstP) { - return; - } - lstP.setPositionAt(1, poiN); - lstP.show(); - if (me._followTitle) { - me._followTitle.setPosition(poiN); - me._followTitle.show(); - } - me._bind.i = 0; - me._bind.j = 0; - delete me._mapMoving; - } - } - // 实时更新文字提示框中的距离 - if (me._followTitle) { - var td = me._getTotalDistance(); - var dis = me._map.getDistance(me._points[me._points.length - 1], poi); - me._updateInstDis(me._followTitle, td + dis); - } - } else { - // 此时用户还没有开始测量,只是鼠标随便在地图上移动 - if (me._followTitle) { - me._followTitle.show(); - e = window.event || e; - var t = e.target || e.srcElement; - if (t != OperationMask.getDom()) { - me._followTitle.hide(); - } - } - } - }; - - /** - * 测距要结束时,双击地图,触发的操作 - * @ignore - * @param {Object} e event对象 - */ - var distDblclick = function(e) { - if (!me._isOpen) { - return; - } - // 结束时,删除绑定的事件 - baidu.un(OperationMask.getDom(me._map), "click", distClick); - baidu.un(document, "mousemove", distMove); - baidu.un(OperationMask.getDom(me._map), "dblclick", distDblclick); - baidu.un(document, "keydown", distKeyDown); - baidu.un(OperationMask.getDom(me._map), "mouseup", distMouseUp); - - // 调用close()关闭测距状态 - setTimeout(function(){ - me.close(); - }, 50); - }; - - /** - * 测距时的键盘操作 - * @ignore - * @param {Object} e event对象 - */ - var distKeyDown = function(e){ - e = window.event || e; - if (e.keyCode == 27){ - // [ESC]退出本次测距 - me._clearCurData(); - setTimeout(function(){ - me.close(); - }, 50); - } - }; - - /** - * 测距过程中,鼠标弹起时,触发的操作 - * @ignore - * @param {Object} e event对象 - */ - var distMouseUp = function(e) { - e = window.event || e; - var ieVersion = 0; - if (/msie (\d+\.\d)/i.test(navigator.userAgent)) { - ieVersion = document.documentMode || + RegExp['\x241']; - } - if (ieVersion && - e.button != 1 || - e.button == 2){ - me.close(); - } - }; - - // 初始化存储数据 - me._initData(); - - // 调整title的内容 - this._formatTitle(); - - // 创建透明覆盖层,并设置鼠标样式 - OperationMask.show(this._map); - this._setCursor(this._opts.cursor); - - // 绑定全部事件 - baidu.on(OperationMask.getDom(this._map), "click", distClick); - baidu.on(document, "mousemove", distMove); - baidu.on(OperationMask.getDom(this._map), "dblclick", distDblclick); - baidu.on(document, "keydown", distKeyDown); - baidu.on(OperationMask.getDom(this._map), "mouseup", distMouseUp); - - // 将绑定的事件、和对应的绑定对象,记录在数组中 - this.bindFunc = [ - {elem : OperationMask.getDom(this._map), type : "click", func : distClick}, - {elem : OperationMask.getDom(this._map), type : "dblclick", func : distDblclick}, - {elem : document, type : "mousemove", func : distMove}, - {elem : document, type : "keydown", func : distKeyDown}, - {elem : OperationMask.getDom(this._map), type : "mouseup", func : distMouseUp}]; - return true; - }; - - /** - * 画线结束时,派发drawend事件 - * @return 无返回值 - */ - DistanceTool.prototype._dispatchLastEvent = function() { - /** - * 测距时,每次双击底图结束当前测距折线时,派发事件的接口 - * @name DistanceTool#ondrawend - * @event - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值: - *
    {"points : {BMap.Point} 所有测量时,打下的节点BMap.Point对象, - *
    "overlays:{Array} 所有测量时,生成的线段BMap.Overlay对象, - *
    "distance:{Number} 测量解释时的最终距离} - * - * @example 参考示例:
    - * myDistanceToolObject.addEventListener("drawend", function(e) { alert(e.distance); }); - */ - - // 生成名为ondrawend的baidu.lang.Event对象 - // 并给该event对象添加上points、overlays和distance等属性字段 - // 然后在此刻,将绑定在ondrawend上事件,全部赋予event参数,然后派发出去 - var event = new baidu.lang.Event("ondrawend"); - event.points = - this._points ? - this._points.slice(0) : - []; - event.overlays = - this._paths ? - this._paths.slice(0, this._paths.length - 1) : - []; - event.distance = this._getTotalDistance().toFixed(0); - this.dispatchEvent(event); - }; - - /** - * 关闭测距状态 - * @return 无返回值 - * - * @example 参考示例:
    - * myDistanceToolObject.close(); - */ - DistanceTool.prototype.close = function(){ - if (this._isOpen == false){ - return; - } - this._isOpen = false; - global._toolInUse = false; - - if (this._mapMoving){ - delete this._mapMoving; - } - var me = this; - me._dispatchLastEvent(); - if (me._points.length < 2){ - // 不是有效绘制,清除所有内容 - me._clearCurData(); - } else { - me._paths[me._paths.length - 1].remove(); - me._paths[me._paths.length - 1] = null; - me._paths.length = me._paths.length - 1; - // 移除最近一次标记 - var pt = me._points[me._points.length - 1]; - if (pt.disLabel){ - pt.disLabel.remove(); - } - me._processLastOp(); - } - OperationMask.hide(); - - // 删除绑定的事件 - for (var i = 0, l = this.bindFunc.length; i < l; i ++){ - baidu.un(this.bindFunc[i].elem, this.bindFunc[i].type, this.bindFunc[i].func); - } - - // 停止地图移动 - if (me._movingTimerId){ - clearInterval(me._movingTimerId); - me._movingTimerId = null; - } - - if (this._followTitle){ - this._followTitle.hide(); - } - }; - - /** - * 清除本次测距的暂存数据 - * @return 无返回值 - */ - DistanceTool.prototype._clearCurData = function(){ - for (var i = 0, l = this._points.length; i < l; i ++){ - if (this._points[i].disLabel){ - this._points[i].disLabel.remove(); - } - } - for (var i = 0, l = this._paths.length; i < l; i ++){ - this._paths[i].remove(); - } - for (var i = 0, l = this._dots.length; i < l; i ++){ - this._dots[i].remove(); - } - this._initData(); - }; - - /** - * 初始化存储数组 - * @return 无返回值 - */ - DistanceTool.prototype._initData = function(){ - // 初始化point数组 - this._points.length = 0; - // 初始化path数组 - this._paths.length = 0; - // 初始化分段距离数组 - this._segDistance.length = 0; - // 初始化结点图像数组 - this._dots.length = 0; - }; - - /** - * 计算两点之间距离并存放在分段距离数组中 - * @param {Point} - * @param {Point} - * @return {Number} 两个地理点之间的距离 - */ - DistanceTool.prototype._setSegDistance = function(pt0, pt1){ - if (!pt0 || !pt1){ - return; - } - var dis = this._map.getDistance(pt0, pt1); - this._segDistance.push(dis); - return dis; - }; - - /** - * 获得总距离 - * @return {Number} 总距离 - */ - DistanceTool.prototype._getTotalDistance = function(){ - var totalDis = 0; - for (var i = 0, l = this._segDistance.length; i < l; i ++){ - totalDis += this._segDistance[i]; - } - return totalDis; - }; - - /** - * 将米制单位的数值换算成为目标单位下的数值 - * @type {Number} 需要转换的数值 - * @type {String} 字符串描述的目标单位, - * "metric" 表示米制单位, - * "us" 表示美国传统单位制 - * @return {Number} 转换后的数值 - */ - DistanceTool.prototype._convertUnit = function(num, unit){ - unit = unit || "metric"; - if (this._units[unit]){ - return num * this._units[unit].conv; - } - return num; - }; - - /** - * 添加测距结点 - * @param {BMap.Point} 节点 - * @return 无返回值 - */ - DistanceTool.prototype._addSecPoint = function(pt){ - var ico = - this._opts.secIcon ? - this._opts.secIcon : - new BMap.Icon("http://api.map.baidu.com/images/mapctrls.png", new BMap.Size(11, 11), {imageOffset: new BMap.Size(-26, -313)}); - var secPt = new BMap.Marker(pt, { - icon : ico, - clickable : false, - baseZIndex : 3500000, - zIndexFixed : true, - enableMassClear : this._enableMassClear - }); - this._map.addOverlay(secPt); - this._dots.push(secPt); - }; - - /** - * 格式化距离字符串 - * @param {Number} 距离 - * @return {String} 格式化的字符串 - */ - DistanceTool.prototype._formatDisStr = function(distance){ - var u = this._opts.unit; - var unit = this._units[u].u1; - var dis = this._convertUnit(distance, u); - - if (dis > this._units[u].incon){ - dis = dis / this._units[u].incon; - unit = this._units[u].u2; - dis = dis.toFixed(1); - } else { - dis = dis.toFixed(0); - } - return dis + unit; - }; - - /** - * 设置鼠标样式 - * @param {String} cursor 鼠标样式 - * @return 没有返回值 - */ - DistanceTool.prototype._setCursor = function(cursor){ - // 由于webkit内核浏览器下,cursor设置后默认不会居中,所以需要对偏移值进行设置 - var csr = - /webkit/.test(navigator.userAgent.toLowerCase()) ? - "url(" + this._opts.cursor + ") 3 6, crosshair" : - "url(" + this._opts.cursor + "), crosshair" - OperationMask._setCursor(csr); - }; - - /** - * 获取鼠标样式 - * @return {String} 跟随的鼠标样式 - */ - DistanceTool.prototype._getCursor = function(){ - return this._opts.cursor; - }; - - /** - * 调整分段距离样式 - * @param {BMap.Label} label 提示框的Label - * @param {String} 需要填入的文字 - * @return 没有返回值 - */ - DistanceTool.prototype._formatSegLabel = function(label, text){ - label.setStyle({"border" : "none", "padding" : "0"}); - label.setContent("" + text + ""); - }; - - /** - * 处理最后一次操作,当用户双击或测距被强行退出时调用 - * @return 没有返回值 - */ - DistanceTool.prototype._processLastOp = function() { - var me = this; - // 删除上次移动临时数据 - delete me._bind.x; - delete me._bind.y; - delete me._bind.initX; - delete me._bind.initY; - // 验证路径 - if (me._paths.length > me._points.length - 1){ - var l = me._paths.length - 1; - me._paths[l].remove(); - me._paths[l] = null; - me._paths.length = l; - } - // 保存本次测距对象 - var disObj = {}; - disObj.points = me._points.slice(0); - disObj.paths = me._paths.slice(0); - disObj.dots = me._dots.slice(0); - disObj.segDis = me._segDistance.slice(0); - // 判断总距离和按钮位置 - var lstPx = me._map.pointToPixel(disObj.points[disObj.points.length - 1]); - var prePx = me._map.pointToPixel(disObj.points[disObj.points.length - 2]); - var btnOffset = [0, 0]; - var disOffset = [0, 0]; - if (lstPx.y - prePx.y >= 0){ - // 距离位于下端 - disOffset = [-5, 11]; - } else { - // 距离位于上端 - disOffset = [-5, -35]; - } - if (lstPx.x - prePx.x >= 0){ - // 按钮位于右侧 - btnOffset = [14, 0]; - } else { - // 按钮位于左侧 - btnOffset = [-14, 0]; - } - // 显示总距离 - var pt = disObj.points[disObj.points.length - 1]; - pt.disLabel = new BMap.Label("", {offset: new BMap.Size(-15, -40), enableMassClear: me._enableMassClear}); - pt.disLabel.setStyles({color: "#333", borderColor: "#ff0103"}); - me._map.addOverlay(pt.disLabel); - pt.disLabel.setOffset(new BMap.Size(disOffset[0], disOffset[1])); - pt.disLabel.setPosition(pt); - me._formatTitle(2, "", "", pt.disLabel); - // 添加关闭按钮 - var bico = - this._opts.closeIcon ? - this._opts.closeIcon : - new BMap.Icon("http://api.map.baidu.com/images/mapctrls.gif", new BMap.Size(12, 12), {imageOffset: new BMap.Size(0, -14)}); - disObj.closeBtn = new BMap.Marker(disObj.points[disObj.points.length - 1], - {icon : bico, - offset : new BMap.Size(btnOffset[0], btnOffset[1]), - baseZIndex : 3600000, - enableMassClear : me._enableMassClear} - ); - me._map.addOverlay(disObj.closeBtn); - disObj.closeBtn.setTitle("清除本次测距"); - // 点击关闭按钮,绑定关闭按钮事件 - disObj.closeBtn.addEventListener("click", function(e){ - // 关闭本次测距,清除相关存储和变量 - for (var i = 0, l = disObj.points.length; i < l; i ++){ - disObj.points[i].disLabel.remove(); - disObj.points[i].disLabel = null; - } - for (var i = 0, l = disObj.paths.length; i < l; i ++){ - disObj.paths[i].remove(); - disObj.paths[i] = null; - } - for (var i = 0, l = disObj.dots.length; i < l; i ++){ - disObj.dots[i].remove(); - disObj.dots[i] = null; - } - disObj.closeBtn.remove(); - disObj.closeBtn = null; - stopBubble(e); - - /** - * @ignore - * 测距结束后,点击线段上最后一个节点旁的关闭按钮时,派发事件的接口 - * @name DistanceTool#onremovepolyline - * @event - * @param {Event Object} e 回调函数会返回event参数 - * - * @example 参考示例:
    - * myDistanceToolObject.addEventListener("removepolyline", function(e) { alert(e.type); }); - */ - - // 生成名为onremovepolyline的baidu.lang.Event对象 - // 然后在此刻,将绑定在onremovepolyline上事件,全部赋予event参数,然后派发出去 - var event = new baidu.lang.Event("onremovepolyline"); - me.dispatchEvent(event); - }); - me._initData(); - }; - - /** - * 生成测距过程中的文字提示框 - * @param {String} type - * @param {String} text - * @param {String} distance - * @param {Label} label - * @return 无返回值 - */ - DistanceTool.prototype._formatTitle = function(type, text, distance, label){ - var title = label || this._followTitle; - if (!title){ - return; - } - title.setStyle({"lineHeight" : "16px", "zIndex" : "85", "padding" : "3px 5px"}); - var t = this._startFollowText || ""; - var htmls = []; - if (type == 1){ - // 测距过程中的提示 - title.setOffset(0, 25); - var u = this._opts.unit; - var unit = this._units[u].u1; - var dis = this._convertUnit(distance, u); - if (dis > this._units[u].incon){ - dis = dis / this._units[u].incon; - unit = this._units[u].u2; - dis = dis.toFixed(1); - } else { - dis = dis.toFixed(0); - } - htmls.push("总长:" + dis + "" + unit + "
    "); - htmls.push("" + text + ""); - } else if (type == 2) { - // 结束时的总距离展示 - var u = this._opts.unit; - var unit = this._units[u].u1; - var dis = this._convertUnit(this._getTotalDistance(), u); - if (dis > this._units[u].incon){ - dis = dis / this._units[u].incon; - unit = this._units[u].u2; - dis = dis.toFixed(1); - } else{ - dis = dis.toFixed(0); - } - htmls.push("总长:" + dis + "" + unit); - } else { - title.setOffset(0, 25); - htmls.push(t); - } - title.setContent(htmls.join("")); - }; - - /** - * 更新label的距离 - * @param HTMLElement label的DOM元素 - * @param Number 距离 - */ - DistanceTool.prototype._updateInstDis = function(label, dis){ - // 换算距离 - var u = this._opts.unit; - var unit = this._units[u].u1; - if (dis > this._units[u].incon){ - dis = dis / this._units[u].incon; - unit = this._units[u].u2; - dis = dis.toFixed(1); - } else { - dis = dis.toFixed(0); - } - // 修改Label的内容 - if (label) { - var htmls = []; - htmls.push("总长:" + dis + "" + unit + "
    "); - htmls.push("" + this._opts.followText + ""); - label.setContent(htmls.join("")); - } - }; - - /** - * 隐藏相关的线段和提示框文字 - * @return 无返回值 - */ - DistanceTool.prototype._hideCurrent = function(){ - if (!this._isOpen){ - return; - } - if (this._paths.length > 0){ - var p = this._paths[this._paths.length - 1]; - p.hide(); - } - this._followTitle && this._followTitle.hide(); - }; - - /** - * 验证传入点的位置合理性 - * @param {BMap.Point} pt 需要被验证的point点 - * @return 无返回值 - */ - DistanceTool.prototype._isPointValid = function(pt){ - if (!pt){ - return false; - } - var mapBounds = this._map.getBounds(); - var sw = mapBounds.getSouthWest(), - ne = mapBounds.getNorthEast(); - if (pt.lng < sw.lng || - pt.lng > ne.lng || - pt.lat < sw.lat || - pt.lat > ne.lat) { - return false; - } - return true; - }; - - - /** - * OperationMask,透明覆盖层,在地图上进行鼠标绘制操作时使用, - * 闭包,对外不暴露 - */ - var OperationMask = { - /** - * map对象 - * @type {Map} - */ - _map : null, - - /** - * HTML字符串 - * @type {String} - */ - _html : "
    ", - - /** - * html元素 - * @type {HTMLElement} - */ - _maskElement : null, - - /** - * 鼠标指针 - * @type {String} - */ - _cursor: 'default', - - /** - * 操作层是否在使用中 - * @type {Boolean} - */ - _inUse: false, - - /** - * 透明覆盖层的显示 - * - * @param {Map} map map对象 - * @return 无返回值 - */ - show : function(map) { - if (!this._map) { - this._map = map; - } - this._inUse = true; - if (!this._maskElement) { - this._createMask(map); - } - this._maskElement.style.display = 'block'; - }, - - /** - * 创建覆盖层 - * - * @param {Map} map map对象 - * @return 无返回值 - */ - _createMask : function(map) { - this._map = map; - if (!this._map) { - return; - } - baidu.insertHTML(this._map.getContainer(), "beforeEnd", this._html); - var elem = this._maskElement = this._map.getContainer().lastChild; - - var stopAndPrevent = function(e) { - stopBubble(e); - return baidu.preventDefault(e); - } - baidu.on(elem, 'mouseup', function(e) { - if (e.button == 2) { - stopAndPrevent(e); - } - }); - baidu.on(elem, 'contextmenu', stopAndPrevent); - elem.style.display = 'none'; - }, - - /** - * 获取当前绘制点的地理坐标 - * - * @param {Event} e e对象 - * @param {Boolean} n 是否向上查到相对于地图container元素的坐标位置 - * @return Point对象的位置信息 - */ - getDrawPoint : function(e, n) { - e = window.event || e; - var x = e.layerX || e.offsetX || 0; - var y = e.layerY || e.offsetY || 0; - var t = e.target || e.srcElement; - if (t != OperationMask.getDom(this._map) && n == true) { - while (t && t != this._map.getContainer()) { - if (!(t.clientWidth == 0 && - t.clientHeight == 0 && - t.offsetParent && - t.offsetParent.nodeName.toLowerCase() == 'td')) { - x += t.offsetLeft; - y += t.offsetTop; - } - t = t.offsetParent; - } - } - - if (t != OperationMask.getDom(this._map) && - t != this._map.getContainer()) { - return; - } - if (typeof x === 'undefined' || - typeof y === 'undefined') { - return; - } - if (isNaN(x) || isNaN(y)) { - return; - } - return this._map.pixelToPoint(new BMap.Pixel(x, y)); - }, - - /** - * 透明覆盖层的隐藏 - * - * @return 无返回值 - */ - hide : function() { - if (!this._map) { - return; - } - this._inUse = false; - if (this._maskElement) { - this._maskElement.style.display = 'none'; - } - }, - - /** - * 获取HTML容器 - * - * @param {Map} map map对象 - * @return HTML容器元素 - */ - getDom : function(map) { - if (!this._maskElement) { - this._createMask(map); - } - return this._maskElement; - }, - - /** - * 设置鼠标样式 - * - * @type {String} cursor 鼠标样式 - * @return 无返回值 - */ - _setCursor : function(cursor) { - this._cursor = cursor || 'default'; - if (this._maskElement) { - this._maskElement.style.cursor = this._cursor; - } - } - }; - - /** - * 停止事件冒泡传播, - * 闭包,对外不暴露 - * - * @type {Event} e e对象 - */ - function stopBubble(e){ - var e = window.event || e; - e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true; - }; - return DistanceTool; -}); \ No newline at end of file diff --git a/src/libs/DrawingManager.js b/src/libs/DrawingManager.js deleted file mode 100644 index 6897d98..0000000 --- a/src/libs/DrawingManager.js +++ /dev/null @@ -1,1641 +0,0 @@ -/** - * @fileoverview 百度地图的鼠标绘制工具,对外开放。 - * 允许用户在地图上点击完成鼠标绘制的功能。 - * 使用者可以自定义所绘制结果的相关样式,例如线宽、颜色、测线段距离、面积等等。 - * 主入口类是DrawingManager, - * 基于Baidu Map API 1.4。 - * - * @author Baidu Map Api Group - * @version 1.4 - */ -(function (root, factory) { - if (typeof exports === 'object') { - module.exports = factory(); - } else if (typeof define === 'function' && define.amd) { - define(factory); - } else { - root.BMapLib = root.BMapLib || {}; - root.BMapLib.DrawingManager = root.BMapLib.DrawingManager || factory(); - } -})(this, function () { - /** - * 定义常量, 绘制的模式 - * @final {Number} DrawingType - */ - var BMAP_DRAWING_MARKER = "marker", // 鼠标画点模式 - BMAP_DRAWING_POLYLINE = "polyline", // 鼠标画线模式 - BMAP_DRAWING_CIRCLE = "circle", // 鼠标画圆模式 - BMAP_DRAWING_RECTANGLE = "rectangle", // 鼠标画矩形模式 - BMAP_DRAWING_POLYGON = "polygon"; // 鼠标画多边形模式 - - /** - * 声明baidu包 - */ - var baidu = baidu || {guid : "$BAIDU$"}; - (function() { - // 一些页面级别唯一的属性,需要挂载在window[baidu.guid]上 - window[baidu.guid] = {}; - - /** - * 将源对象的所有属性拷贝到目标对象中 - * @name baidu.extend - * @function - * @grammar baidu.extend(target, source) - * @param {Object} target 目标对象 - * @param {Object} source 源对象 - * @returns {Object} 目标对象 - */ - baidu.extend = function (target, source) { - for (var p in source) { - if (source.hasOwnProperty(p)) { - target[p] = source[p]; - } - } - return target; - }; - - /** - * @ignore - * @namespace - * @baidu.lang 对语言层面的封装,包括类型判断、模块扩展、继承基类以及对象自定义事件的支持。 - * @property guid 对象的唯一标识 - */ - baidu.lang = baidu.lang || {}; - - /** - * 返回一个当前页面的唯一标识字符串。 - * @function - * @grammar baidu.lang.guid() - * @returns {String} 当前页面的唯一标识字符串 - */ - baidu.lang.guid = function() { - return "TANGRAM__" + (window[baidu.guid]._counter ++).toString(36); - }; - - window[baidu.guid]._counter = window[baidu.guid]._counter || 1; - - /** - * 所有类的实例的容器 - * key为每个实例的guid - */ - window[baidu.guid]._instances = window[baidu.guid]._instances || {}; - - /** - * Tangram继承机制提供的一个基类,用户可以通过继承baidu.lang.Class来获取它的属性及方法。 - * @function - * @name baidu.lang.Class - * @grammar baidu.lang.Class(guid) - * @param {string} guid 对象的唯一标识 - * @meta standard - * @remark baidu.lang.Class和它的子类的实例均包含一个全局唯一的标识guid。 - * guid是在构造函数中生成的,因此,继承自baidu.lang.Class的类应该直接或者间接调用它的构造函数。
    - * baidu.lang.Class的构造函数中产生guid的方式可以保证guid的唯一性,及每个实例都有一个全局唯一的guid。 - */ - baidu.lang.Class = function(guid) { - this.guid = guid || baidu.lang.guid(); - window[baidu.guid]._instances[this.guid] = this; - }; - - window[baidu.guid]._instances = window[baidu.guid]._instances || {}; - - /** - * 判断目标参数是否string类型或String对象 - * @name baidu.lang.isString - * @function - * @grammar baidu.lang.isString(source) - * @param {Any} source 目标参数 - * @shortcut isString - * @meta standard - * - * @returns {boolean} 类型判断结果 - */ - baidu.lang.isString = function (source) { - return '[object String]' == Object.prototype.toString.call(source); - }; - - /** - * 判断目标参数是否为function或Function实例 - * @name baidu.lang.isFunction - * @function - * @grammar baidu.lang.isFunction(source) - * @param {Any} source 目标参数 - * @returns {boolean} 类型判断结果 - */ - baidu.lang.isFunction = function (source) { - return '[object Function]' == Object.prototype.toString.call(source); - }; - - /** - * 重载了默认的toString方法,使得返回信息更加准确一些。 - * @return {string} 对象的String表示形式 - */ - baidu.lang.Class.prototype.toString = function(){ - return "[object " + (this._className || "Object" ) + "]"; - }; - - /** - * 释放对象所持有的资源,主要是自定义事件。 - * @name dispose - * @grammar obj.dispose() - */ - baidu.lang.Class.prototype.dispose = function(){ - delete window[baidu.guid]._instances[this.guid]; - for(var property in this){ - if (!baidu.lang.isFunction(this[property])) { - delete this[property]; - } - } - this.disposed = true; - }; - - /** - * 自定义的事件对象。 - * @function - * @name baidu.lang.Event - * @grammar baidu.lang.Event(type[, target]) - * @param {string} type 事件类型名称。为了方便区分事件和一个普通的方法,事件类型名称必须以"on"(小写)开头。 - * @param {Object} [target]触发事件的对象 - * @meta standard - * @remark 引入该模块,会自动为Class引入3个事件扩展方法:addEventListener、removeEventListener和dispatchEvent。 - * @see baidu.lang.Class - */ - baidu.lang.Event = function (type, target) { - this.type = type; - this.returnValue = true; - this.target = target || null; - this.currentTarget = null; - }; - - /** - * 注册对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.addEventListener(type, handler[, key]) - * @param {string} type 自定义事件的名称 - * @param {Function} handler 自定义事件被触发时应该调用的回调函数 - * @param {string} [key] 为事件监听函数指定的名称,可在移除时使用。如果不提供,方法会默认为它生成一个全局唯一的key。 - * @remark 事件类型区分大小写。如果自定义事件名称不是以小写"on"开头,该方法会给它加上"on"再进行判断,即"click"和"onclick"会被认为是同一种事件。 - */ - baidu.lang.Class.prototype.addEventListener = function (type, handler, key) { - if (!baidu.lang.isFunction(handler)) { - return; - } - !this.__listeners && (this.__listeners = {}); - var t = this.__listeners, id; - if (typeof key == "string" && key) { - if (/[^\w\-]/.test(key)) { - throw("nonstandard key:" + key); - } else { - handler.hashCode = key; - id = key; - } - } - type.indexOf("on") != 0 && (type = "on" + type); - typeof t[type] != "object" && (t[type] = {}); - id = id || baidu.lang.guid(); - handler.hashCode = id; - t[type][id] = handler; - }; - - /** - * 移除对象的事件监听器。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.removeEventListener(type, handler) - * @param {string} type 事件类型 - * @param {Function|string} handler 要移除的事件监听函数或者监听函数的key - * @remark 如果第二个参数handler没有被绑定到对应的自定义事件中,什么也不做。 - */ - baidu.lang.Class.prototype.removeEventListener = function (type, handler) { - if (baidu.lang.isFunction(handler)) { - handler = handler.hashCode; - } else if (!baidu.lang.isString(handler)) { - return; - } - !this.__listeners && (this.__listeners = {}); - type.indexOf("on") != 0 && (type = "on" + type); - var t = this.__listeners; - if (!t[type]) { - return; - } - t[type][handler] && delete t[type][handler]; - }; - - /** - * 派发自定义事件,使得绑定到自定义事件上面的函数都会被执行。引入baidu.lang.Event后,Class的子类实例才会获得该方法。 - * @grammar obj.dispatchEvent(event, options) - * @param {baidu.lang.Event|String} event Event对象,或事件名称(1.1.1起支持) - * @param {Object} options 扩展参数,所含属性键值会扩展到Event对象上(1.2起支持) - * @remark 处理会调用通过addEventListenr绑定的自定义事件回调函数之外,还会调用直接绑定到对象上面的自定义事件。 - * 例如:
    - * myobj.onMyEvent = function(){}
    - * myobj.addEventListener("onMyEvent", function(){}); - */ - baidu.lang.Class.prototype.dispatchEvent = function (event, options) { - if (baidu.lang.isString(event)) { - event = new baidu.lang.Event(event); - } - !this.__listeners && (this.__listeners = {}); - options = options || {}; - for (var i in options) { - event[i] = options[i]; - } - var i, t = this.__listeners, p = event.type; - p.indexOf("on") != 0 && (p = "on" + p); - baidu.lang.isFunction(this[p]) && this[p].apply(this, arguments); - if (typeof t[p] == "object") { - for (i in t[p]) { - t[p][i].apply(this, arguments); - } - } - return event.returnValue; - }; - - /** - * 为类型构造器建立继承关系 - * @name baidu.lang.inherits - * @function - * @grammar baidu.lang.inherits(subClass, superClass[, className]) - * @param {Function} subClass 子类构造器 - * @param {Function} superClass 父类构造器 - * @param {string} className 类名标识 - * @remark 使subClass继承superClass的prototype, - * 因此subClass的实例能够使用superClass的prototype中定义的所有属性和方法。
    - * 这个函数实际上是建立了subClass和superClass的原型链集成,并对subClass进行了constructor修正。
    - * 注意:如果要继承构造函数,需要在subClass里面call一下,具体见下面的demo例子 - * @shortcut inherits - * @meta standard - * @see baidu.lang.Class - */ - baidu.lang.inherits = function (subClass, superClass, className) { - var key, proto, - selfProps = subClass.prototype, - clazz = new Function(); - clazz.prototype = superClass.prototype; - proto = subClass.prototype = new clazz(); - for (key in selfProps) { - proto[key] = selfProps[key]; - } - subClass.prototype.constructor = subClass; - subClass.superClass = superClass.prototype; - - if ("string" == typeof className) { - proto._className = className; - } - }; - - /** - * @ignore - * @namespace baidu.dom 操作dom的方法。 - */ - baidu.dom = baidu.dom || {}; - - /** - * 从文档中获取指定的DOM元素 - * - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @meta standard - * @return {HTMLElement} DOM元素,如果不存在,返回null,如果参数不合法,直接返回参数 - */ - baidu._g = baidu.dom._g = function (id) { - if (baidu.lang.isString(id)) { - return document.getElementById(id); - } - return id; - }; - - /** - * 从文档中获取指定的DOM元素 - * @name baidu.dom.g - * @function - * @grammar baidu.dom.g(id) - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @meta standard - * - * @returns {HTMLElement|null} 获取的元素,查找不到时返回null,如果参数不合法,直接返回参数 - */ - baidu.g = baidu.dom.g = function (id) { - if ('string' == typeof id || id instanceof String) { - return document.getElementById(id); - } else if (id && id.nodeName && (id.nodeType == 1 || id.nodeType == 9)) { - return id; - } - return null; - }; - - /** - * 在目标元素的指定位置插入HTML代码 - * @name baidu.dom.insertHTML - * @function - * @grammar baidu.dom.insertHTML(element, position, html) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} position 插入html的位置信息,取值为beforeBegin,afterBegin,beforeEnd,afterEnd - * @param {string} html 要插入的html - * @remark - * - * 对于position参数,大小写不敏感
    - * 参数的意思:beforeBegin<span>afterBegin this is span! beforeEnd</span> afterEnd
    - * 此外,如果使用本函数插入带有script标签的HTML字符串,script标签对应的脚本将不会被执行。 - * - * @shortcut insertHTML - * @meta standard - * - * @returns {HTMLElement} 目标元素 - */ - baidu.insertHTML = baidu.dom.insertHTML = function (element, position, html) { - element = baidu.dom.g(element); - var range,begin; - - if (element.insertAdjacentHTML) { - element.insertAdjacentHTML(position, html); - } else { - // 这里不做"undefined" != typeof(HTMLElement) && !window.opera判断,其它浏览器将出错?! - // 但是其实做了判断,其它浏览器下等于这个函数就不能执行了 - range = element.ownerDocument.createRange(); - // FF下range的位置设置错误可能导致创建出来的fragment在插入dom树之后html结构乱掉 - // 改用range.insertNode来插入html, by wenyuxiang @ 2010-12-14. - position = position.toUpperCase(); - if (position == 'AFTERBEGIN' || position == 'BEFOREEND') { - range.selectNodeContents(element); - range.collapse(position == 'AFTERBEGIN'); - } else { - begin = position == 'BEFOREBEGIN'; - range[begin ? 'setStartBefore' : 'setEndAfter'](element); - range.collapse(begin); - } - range.insertNode(range.createContextualFragment(html)); - } - return element; - }; - - /** - * 为目标元素添加className - * @name baidu.dom.addClass - * @function - * @grammar baidu.dom.addClass(element, className) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} className 要添加的className,允许同时添加多个class,中间使用空白符分隔 - * @remark - * 使用者应保证提供的className合法性,不应包含不合法字符,className合法字符参考:http://www.w3.org/TR/CSS2/syndata.html。 - * @shortcut addClass - * @meta standard - * - * @returns {HTMLElement} 目标元素 - */ - baidu.ac = baidu.dom.addClass = function (element, className) { - element = baidu.dom.g(element); - var classArray = className.split(/\s+/), - result = element.className, - classMatch = " " + result + " ", - i = 0, - l = classArray.length; - - for (; i < l; i++){ - if ( classMatch.indexOf( " " + classArray[i] + " " ) < 0 ) { - result += (result ? ' ' : '') + classArray[i]; - } - } - - element.className = result; - return element; - }; - - /** - * @ignore - * @namespace baidu.event 屏蔽浏览器差异性的事件封装。 - * @property target 事件的触发元素 - * @property pageX 鼠标事件的鼠标x坐标 - * @property pageY 鼠标事件的鼠标y坐标 - * @property keyCode 键盘事件的键值 - */ - baidu.event = baidu.event || {}; - - /** - * 事件监听器的存储表 - * @private - * @meta standard - */ - baidu.event._listeners = baidu.event._listeners || []; - - /** - * 为目标元素添加事件监听器 - * @name baidu.event.on - * @function - * @grammar baidu.event.on(element, type, listener) - * @param {HTMLElement|string|window} element 目标元素或目标元素id - * @param {string} type 事件类型 - * @param {Function} listener 需要添加的监听器 - * @remark - * 1. 不支持跨浏览器的鼠标滚轮事件监听器添加
    - * 2. 改方法不为监听器灌入事件对象,以防止跨iframe事件挂载的事件对象获取失败 - * @shortcut on - * @meta standard - * @see baidu.event.un - * - * @returns {HTMLElement|window} 目标元素 - */ - baidu.on = baidu.event.on = function (element, type, listener) { - type = type.replace(/^on/i, ''); - element = baidu._g(element); - var realListener = function (ev) { - // 1. 这里不支持EventArgument, 原因是跨frame的事件挂载 - // 2. element是为了修正this - listener.call(element, ev); - }, - lis = baidu.event._listeners, - filter = baidu.event._eventFilter, - afterFilter, - realType = type; - type = type.toLowerCase(); - // filter过滤 - if(filter && filter[type]){ - afterFilter = filter[type](element, type, realListener); - realType = afterFilter.type; - realListener = afterFilter.listener; - } - // 事件监听器挂载 - if (element.addEventListener) { - element.addEventListener(realType, realListener, false); - } else if (element.attachEvent) { - element.attachEvent('on' + realType, realListener); - } - - // 将监听器存储到数组中 - lis[lis.length] = [element, type, listener, realListener, realType]; - return element; - }; - - /** - * 为目标元素移除事件监听器 - * @name baidu.event.un - * @function - * @grammar baidu.event.un(element, type, listener) - * @param {HTMLElement|string|window} element 目标元素或目标元素id - * @param {string} type 事件类型 - * @param {Function} listener 需要移除的监听器 - * @shortcut un - * @meta standard - * - * @returns {HTMLElement|window} 目标元素 - */ - baidu.un = baidu.event.un = function (element, type, listener) { - element = baidu._g(element); - type = type.replace(/^on/i, '').toLowerCase(); - - var lis = baidu.event._listeners, - len = lis.length, - isRemoveAll = !listener, - item, - realType, realListener; - - //如果将listener的结构改成json - //可以节省掉这个循环,优化性能 - //但是由于un的使用频率并不高,同时在listener不多的时候 - //遍历数组的性能消耗不会对代码产生影响 - //暂不考虑此优化 - while (len--) { - item = lis[len]; - - // listener存在时,移除element的所有以listener监听的type类型事件 - // listener不存在时,移除element的所有type类型事件 - if (item[1] === type - && item[0] === element - && (isRemoveAll || item[2] === listener)) { - realType = item[4]; - realListener = item[3]; - if (element.removeEventListener) { - element.removeEventListener(realType, realListener, false); - } else if (element.detachEvent) { - element.detachEvent('on' + realType, realListener); - } - lis.splice(len, 1); - } - } - return element; - }; - - /** - * 获取event事件,解决不同浏览器兼容问题 - * @param {Event} - * @return {Event} - */ - baidu.getEvent = baidu.event.getEvent = function (event) { - return window.event || event; - } - - /** - * 获取event.target,解决不同浏览器兼容问题 - * @param {Event} - * @return {Target} - */ - baidu.getTarget = baidu.event.getTarget = function (event) { - var event = baidu.getEvent(event); - return event.target || event.srcElement; - } - - /** - * 阻止事件的默认行为 - * @name baidu.event.preventDefault - * @function - * @grammar baidu.event.preventDefault(event) - * @param {Event} event 事件对象 - * @meta standard - */ - baidu.preventDefault = baidu.event.preventDefault = function (event) { - var event = baidu.getEvent(event); - if (event.preventDefault) { - event.preventDefault(); - } else { - event.returnValue = false; - } - }; - - /** - * 停止事件冒泡传播 - * @param {Event} - */ - baidu.stopBubble = baidu.event.stopBubble = function (event) { - event = baidu.getEvent(event); - event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true; - } - - baidu.browser = baidu.browser || {}; - - if (/msie (\d+\.\d)/i.test(navigator.userAgent)) { - //IE 8下,以documentMode为准 - //在百度模板中,可能会有$,防止冲突,将$1 写成 \x241 - /** - * 判断是否为ie浏览器 - * @property ie ie版本号 - * @grammar baidu.browser.ie - * @meta standard - * @shortcut ie - * @see baidu.browser.firefox,baidu.browser.safari,baidu.browser.opera,baidu.browser.chrome,baidu.browser.maxthon - */ - baidu.browser.ie = baidu.ie = document.documentMode || + RegExp['\x241']; -} - - })(); - - /** - * @exports DrawingManager as BMapLib.DrawingManager - */ - var DrawingManager = - /** - * DrawingManager类的构造函数 - * @class 鼠标绘制管理类,实现鼠标绘制管理的入口。 - * 实例化该类后,即可调用该类提供的open - * 方法开启绘制模式状态。 - * 也可加入工具栏进行选择操作。 - * - * @constructor - * @param {Map} map Baidu map的实例对象 - * @param {Json Object} opts 可选的输入参数,非必填项。可输入选项包括:
    - * {"isOpen" : {Boolean} 是否开启绘制模式 - *
    "enableDrawingTool" : {Boolean} 是否添加绘制工具栏控件,默认不添加 - *
    "drawingToolOptions" : {Json Object} 可选的输入参数,非必填项。可输入选项包括 - *
          "anchor" : {ControlAnchor} 停靠位置、默认左上角 - *
          "offset" : {Size} 偏移值。 - *
          "scale" : {Number} 工具栏的缩放比例,默认为1 - *
          "drawingModes" : {DrawingType} 工具栏上可以选择出现的绘制模式,将需要显示的DrawingType以数组型形式传入,如[BMAP_DRAWING_MARKER, BMAP_DRAWING_CIRCLE] 将只显示画点和画圆的选项 - *
    "enableCalculate" : {Boolean} 绘制是否进行测距(画线时候)、测面(画圆、多边形、矩形) - *
    "markerOptions" : {CircleOptions} 所画的点的可选参数,参考api中的对应类 - *
    "circleOptions" : {CircleOptions} 所画的圆的可选参数,参考api中的对应类 - *
    "polylineOptions" : {CircleOptions} 所画的线的可选参数,参考api中的对应类 - *
    "polygonOptions" : {PolygonOptions} 所画的多边形的可选参数,参考api中的对应类 - *
    "rectangleOptions" : {PolygonOptions} 所画的矩形的可选参数,参考api中的对应类 - * - * @example 参考示例:
    - * var map = new BMap.Map("container");
    map.centerAndZoom(new BMap.Point(116.404, 39.915), 15);
    - * var myDrawingManagerObject = new BMapLib.DrawingManager(map, {isOpen: true, - * drawingType: BMAP_DRAWING_MARKER, enableDrawingTool: true, - * enableCalculate: false, - * drawingToolOptions: { - * anchor: BMAP_ANCHOR_TOP_LEFT, - * offset: new BMap.Size(5, 5), - * drawingTypes : [ - * BMAP_DRAWING_MARKER, - * BMAP_DRAWING_CIRCLE, - * BMAP_DRAWING_POLYLINE, - * BMAP_DRAWING_POLYGON, - * BMAP_DRAWING_RECTANGLE - * ] - * }, - * polylineOptions: { - * strokeColor: "#333" - * }); - */ - function(map, opts){ - if (!map) { - return; - } - instances.push(this); - - opts = opts || {}; - - this._initialize(map, opts); - } - - // 通过baidu.lang下的inherits方法,让DrawingManager继承baidu.lang.Class - baidu.lang.inherits(DrawingManager, baidu.lang.Class, "DrawingManager"); - - /** - * 开启地图的绘制模式 - * - * @example 参考示例:
    - * myDrawingManagerObject.open(); - */ - DrawingManager.prototype.open = function() { - // 判断绘制状态是否已经开启 - if (this._isOpen == true){ - return true; - } - closeInstanceExcept(this); - - this._open(); - } - - /** - * 关闭地图的绘制状态 - * - * @example 参考示例:
    - * myDrawingManagerObject.close(); - */ - DrawingManager.prototype.close = function() { - - // 判断绘制状态是否已经开启 - if (this._isOpen == false){ - return true; - } - var me = this; - this._close(); - setTimeout(function(){ - me._map.enableDoubleClickZoom(); - },2000); - - } - - /** - * 设置当前的绘制模式,参数DrawingType,为5个可选常量: - *
    BMAP_DRAWING_MARKER 画点 - *
    BMAP_DRAWING_CIRCLE 画圆 - *
    BMAP_DRAWING_POLYLINE 画线 - *
    BMAP_DRAWING_POLYGON 画多边形 - *
    BMAP_DRAWING_RECTANGLE 画矩形 - * @param {DrawingType} DrawingType - * @return {Boolean} - * - * @example 参考示例:
    - * myDrawingManagerObject.setDrawingMode(BMAP_DRAWING_POLYLINE); - */ - DrawingManager.prototype.setDrawingMode = function(drawingType) { - //与当前模式不一样时候才进行重新绑定事件 - if (this._drawingType != drawingType) { - closeInstanceExcept(this); - this._setDrawingMode(drawingType); - } - } - - /** - * 获取当前的绘制模式 - * @return {DrawingType} 绘制的模式 - * - * @example 参考示例:
    - * alert(myDrawingManagerObject.getDrawingMode()); - */ - DrawingManager.prototype.getDrawingMode = function() { - return this._drawingType; - } - - /** - * 打开距离或面积计算 - * - * @example 参考示例:
    - * myDrawingManagerObject.enableCalculate(); - */ - DrawingManager.prototype.enableCalculate = function() { - this._enableCalculate = true; - this._addGeoUtilsLibrary(); - } - - /** - * 关闭距离或面积计算 - * - * @example 参考示例:
    - * myDrawingManagerObject.disableCalculate(); - */ - DrawingManager.prototype.disableCalculate = function() { - this._enableCalculate = false; - } - - /** - * 鼠标绘制完成后,派发总事件的接口 - * @name DrawingManager#overlaycomplete - * @event - * @param {Event Object} e 回调函数会返回event参数,包括以下返回值: - *
    {"drawingMode : {DrawingType} 当前的绘制模式 - *
    "overlay:{Marker||Polyline||Polygon||Circle} 对应的绘制模式返回对应的覆盖物 - *
    "calculate:{Number} 需要开启计算模式才会返回这个值,当绘制线的时候返回距离、绘制多边形、圆、矩形时候返回面积,单位为米, - *
    "label:{Label} 计算面积时候出现在Map上的Label对象 - * - * @example 参考示例: - * myDrawingManagerObject.addEventListener("overlaycomplete", function(e) { - * alert(e.drawingMode); - * alert(e.overlay); - * alert(e.calculate); - * alert(e.label); - * }); - */ - - /** - * 绘制点完成后,派发的事件接口 - * @name DrawingManager#markercomplete - * @event - * @param {Marker} overlay 回调函数会返回相应的覆盖物, - *
    {"overlay : {Marker} - * - * @example 参考示例: - * myDrawingManagerObject.addEventListener("circlecomplete", function(e, overlay) { - * alert(overlay); - * }); - */ - - /** - * 绘制圆完成后,派发的事件接口 - * @name DrawingManager#circlecomplete - * @event - * @param {Circle} overlay 回调函数会返回相应的覆盖物, - *
    {"overlay : {Circle} - */ - - /** - * 绘制线完成后,派发的事件接口 - * @name DrawingManager#polylinecomplete - * @event - * @param {Polyline} overlay 回调函数会返回相应的覆盖物, - *
    {"overlay : {Polyline} - */ - - /** - * 绘制多边形完成后,派发的事件接口 - * @name DrawingManager#polygoncomplete - * @event - * @param {Polygon} overlay 回调函数会返回相应的覆盖物, - *
    {"overlay : {Polygon} - */ - - /** - * 绘制矩形完成后,派发的事件接口 - * @name DrawingManager#rectanglecomplete - * @event - * @param {Polygon} overlay 回调函数会返回相应的覆盖物, - *
    {"overlay : {Polygon} - */ - - /** - * 初始化状态 - * @param {Map} 地图实例 - * @param {Object} 参数 - */ - DrawingManager.prototype._initialize = function(map, opts) { - - /** - * map对象 - * @private - * @type {Map} - */ - this._map = map; - - /** - * 配置对象 - * @private - * @type {Object} - */ - this._opts = opts; - - /** - * 当前的绘制模式, 默认是绘制点 - * @private - * @type {DrawingType} - */ - this._drawingType = opts.drawingMode || BMAP_DRAWING_MARKER; - - /** - * 是否添加添加鼠标绘制工具栏面板 - */ - if (opts.enableDrawingTool) { - var drawingTool = new DrawingTool(this, opts.drawingToolOptions); - this._drawingTool = drawingTool; - map.addControl(drawingTool); - } - - //是否计算绘制出的面积 - if (opts.enableCalculate === true) { - this.enableCalculate(); - } else { - this.disableCalculate(); - } - - /** - * 是否已经开启了绘制状态 - * @private - * @type {Boolean} - */ - this._isOpen = !!(opts.isOpen === true); - if (this._isOpen) { - this._open(); - } - - this.markerOptions = opts.markerOptions || {}; - this.circleOptions = opts.circleOptions || {}; - this.polylineOptions = opts.polylineOptions || {}; - this.polygonOptions = opts.polygonOptions || {}; - this.rectangleOptions = opts.rectangleOptions || {}; - this.controlButton = opts.controlButton == "right" ? "right" : "left"; - - }, - - /** - * 开启地图的绘制状态 - * @return {Boolean},开启绘制状态成功,返回true;否则返回false。 - */ - DrawingManager.prototype._open = function() { - - this._isOpen = true; - - //添加遮罩,所有鼠标操作都在这个遮罩上完成 - if (!this._mask) { - this._mask = new Mask(); - } - this._map.addOverlay(this._mask); - this._setDrawingMode(this._drawingType); - - } - - /** - * 设置当前的绘制模式 - * @param {DrawingType} - */ - DrawingManager.prototype._setDrawingMode = function(drawingType) { - - this._drawingType = drawingType; - - /** - * 开启编辑状态时候才重新进行事件绑定 - */ - if (this._isOpen) { - - //清空之前的自定义事件 - this._mask.__listeners = {}; - - switch (drawingType) { - case BMAP_DRAWING_MARKER: - this._bindMarker(); - break; - case BMAP_DRAWING_CIRCLE: - this._bindCircle(); - break; - case BMAP_DRAWING_POLYLINE: - case BMAP_DRAWING_POLYGON: - this._bindPolylineOrPolygon(); - break; - case BMAP_DRAWING_RECTANGLE: - this._bindRectangle(); - break; - } - } - - /** - * 如果添加了工具栏,则也需要改变工具栏的样式 - */ - if (this._drawingTool && this._isOpen) { - this._drawingTool.setStyleByDrawingMode(drawingType); - } - } - - /** - * 关闭地图的绘制状态 - * @return {Boolean},关闭绘制状态成功,返回true;否则返回false。 - */ - DrawingManager.prototype._close = function() { - - this._isOpen = false; - - - if (this._mask) { - this._map.removeOverlay(this._mask); - } - - /** - * 如果添加了工具栏,则关闭时候将工具栏样式设置为拖拽地图 - */ - if (this._drawingTool) { - this._drawingTool.setStyleByDrawingMode("hander"); - } - } - - /** - * 绑定鼠标画点的事件 - */ - DrawingManager.prototype._bindMarker = function() { - - var me = this, - map = this._map, - mask = this._mask; - - /** - * 鼠标点击的事件 - */ - var clickAction = function (e) { - // 往地图上添加marker - var marker = new BMap.Marker(e.point, me.markerOptions); - map.addOverlay(marker); - me._dispatchOverlayComplete(marker); - } - - mask.addEventListener('click', clickAction); - } - - /** - * 绑定鼠标画圆的事件 - */ - DrawingManager.prototype._bindCircle = function() { - - var me = this, - map = this._map, - mask = this._mask, - circle = null, - centerPoint = null; //圆的中心点 - - /** - * 开始绘制圆形 - */ - var startAction = function (e) { - if(me.controlButton == "right" && (e.button == 1 || e.button==0)){ - return ; - } - centerPoint = e.point; - circle = new BMap.Circle(centerPoint, 0, me.circleOptions); - map.addOverlay(circle); - mask.enableEdgeMove(); - mask.addEventListener('mousemove', moveAction); - baidu.on(document, 'mouseup', endAction); - } - - /** - * 绘制圆形过程中,鼠标移动过程的事件 - */ - var moveAction = function(e) { - circle.setRadius(me._map.getDistance(centerPoint, e.point)); - } - - /** - * 绘制圆形结束 - */ - var endAction = function (e) { - var calculate = me._calculate(circle, e.point); - me._dispatchOverlayComplete(circle, calculate); - centerPoint = null; - mask.disableEdgeMove(); - mask.removeEventListener('mousemove', moveAction); - baidu.un(document, 'mouseup', endAction); - } - - /** - * 鼠标点击起始点 - */ - var mousedownAction = function (e) { - baidu.preventDefault(e); - baidu.stopBubble(e); - if(me.controlButton == "right" && e.button == 1){ - return ; - } - if (centerPoint == null) { - startAction(e); - } - } - - mask.addEventListener('mousedown', mousedownAction); - } - - /** - * 画线和画多边形相似性比较大,公用一个方法 - */ - DrawingManager.prototype._bindPolylineOrPolygon = function() { - - var me = this, - map = this._map, - mask = this._mask, - points = [], //用户绘制的点 - drawPoint = null, //实际需要画在地图上的点 - overlay = null, - isBinded = false; - - /** - * 鼠标点击的事件 - */ - var startAction = function (e) { - if(me.controlButton == "right" && (e.button == 1 || e.button==0)){ - return ; - } - points.push(e.point); - drawPoint = points.concat(points[points.length - 1]); - if (points.length == 1) { - if (me._drawingType == BMAP_DRAWING_POLYLINE) { - - overlay = new BMap.Polyline(drawPoint, me.polylineOptions); - } else if (me._drawingType == BMAP_DRAWING_POLYGON) { - overlay = new BMap.Polygon(drawPoint, me.polygonOptions); - } - map.addOverlay(overlay); - } else { - overlay.setPath(drawPoint); - } - if (!isBinded) { - isBinded = true; - mask.enableEdgeMove(); - mask.addEventListener('mousemove', mousemoveAction); - mask.addEventListener('dblclick', dblclickAction); - } - } - - /** - * 鼠标移动过程的事件 - */ - var mousemoveAction = function(e) { - overlay.setPositionAt(drawPoint.length - 1, e.point); - } - - /** - * 鼠标双击的事件 - */ - var dblclickAction = function (e) { - baidu.stopBubble(e); - isBinded = false; - mask.disableEdgeMove(); - mask.removeEventListener('mousedown',startAction); - mask.removeEventListener('mousemove', mousemoveAction); - mask.removeEventListener('dblclick', dblclickAction); - //console.log(me.controlButton); - if(me.controlButton == "right"){ - points.push(e.point); - } - else if(baidu.ie <= 8){ - }else{ - points.pop(); - } - //console.log(points.length); - overlay.setPath(points); - var calculate = me._calculate(overlay, points.pop()); - me._dispatchOverlayComplete(overlay, calculate); - points.length = 0; - drawPoint.length = 0; - me.close(); - - } - - mask.addEventListener('mousedown', startAction); - - //双击时候不放大地图级别 - mask.addEventListener('dblclick', function(e){ - baidu.stopBubble(e); - }); - } - - /** - * 绑定鼠标画矩形的事件 - */ - DrawingManager.prototype._bindRectangle = function() { - - var me = this, - map = this._map, - mask = this._mask, - polygon = null, - startPoint = null; - - /** - * 开始绘制矩形 - */ - var startAction = function (e) { - baidu.stopBubble(e); - baidu.preventDefault(e); - if(me.controlButton == "right" && (e.button == 1 || e.button==0)){ - return ; - } - startPoint = e.point; - var endPoint = startPoint; - polygon = new BMap.Polygon(me._getRectanglePoint(startPoint, endPoint), me.rectangleOptions); - map.addOverlay(polygon); - mask.enableEdgeMove(); - mask.addEventListener('mousemove', moveAction); - baidu.on(document, 'mouseup', endAction); - } - - /** - * 绘制矩形过程中,鼠标移动过程的事件 - */ - var moveAction = function(e) { - polygon.setPath(me._getRectanglePoint(startPoint, e.point)); - } - - /** - * 绘制矩形结束 - */ - var endAction = function (e) { - var calculate = me._calculate(polygon, polygon.getPath()[2]); - me._dispatchOverlayComplete(polygon, calculate); - startPoint = null; - mask.disableEdgeMove(); - mask.removeEventListener('mousemove', moveAction); - baidu.un(document, 'mouseup', endAction); - } - - mask.addEventListener('mousedown', startAction); - } - - /** - * 添加显示所绘制图形的面积或者长度 - * @param {overlay} 覆盖物 - * @param {point} 显示的位置 - */ - DrawingManager.prototype._calculate = function (overlay, point) { - var result = { - data : 0, //计算出来的长度或面积 - label : null //显示长度或面积的label对象 - }; - if (this._enableCalculate && BMapLib.GeoUtils) { - var type = overlay.toString(); - //不同覆盖物调用不同的计算方法 - switch (type) { - case "[object Polyline]": - result.data = BMapLib.GeoUtils.getPolylineDistance(overlay); - break; - case "[object Polygon]": - result.data = BMapLib.GeoUtils.getPolygonArea(overlay); - break; - case "[object Circle]": - var radius = overlay.getRadius(); - result.data = Math.PI * radius * radius; - break; - } - //一场情况处理 - if (!result.data || result.data < 0) { - result.data = 0; - } else { - //保留2位小数位 - result.data = result.data.toFixed(2); - } - result.label = this._addLabel(point, result.data); - } - return result; - } - - /** - * 开启测距和测面功能需要依赖于GeoUtils库 - * 所以这里判断用户是否已经加载,若未加载则用js动态加载 - */ - DrawingManager.prototype._addGeoUtilsLibrary = function () { - if (!BMapLib.GeoUtils) { - var script = document.createElement('script'); - script.setAttribute("type", "text/javascript"); - script.setAttribute("src", 'http://api.map.baidu.com/library/GeoUtils/1.2/src/GeoUtils_min.js'); - document.body.appendChild(script); - } - } - - /** - * 向地图中添加文本标注 - * @param {Point} - * @param {String} 所以显示的内容 - */ - DrawingManager.prototype._addLabel = function (point, content) { - var label = new BMap.Label(content, { - position: point - }); - this._map.addOverlay(label); - return label; - } - - /** - * 根据起终点获取矩形的四个顶点 - * @param {Point} 起点 - * @param {Point} 终点 - */ - DrawingManager.prototype._getRectanglePoint = function (startPoint, endPoint) { - return [ - new BMap.Point(startPoint.lng,startPoint.lat), - new BMap.Point(endPoint.lng,startPoint.lat), - new BMap.Point(endPoint.lng,endPoint.lat), - new BMap.Point(startPoint.lng,endPoint.lat) - ]; - } - - /** - * 派发事件 - */ - DrawingManager.prototype._dispatchOverlayComplete = function (overlay, calculate) { - var options = { - 'overlay' : overlay, - 'drawingMode' : this._drawingType - }; - if (calculate) { - options.calculate = calculate.data || null; - options.label = calculate.label || null; - } - this.dispatchEvent(this._drawingType + 'complete', overlay); - this.dispatchEvent('overlaycomplete', options); - } - - /** - * 创建遮罩对象 - */ - function Mask(){ - /** - * 鼠标到地图边缘的时候是否自动平移地图 - */ - this._enableEdgeMove = false; - } - - Mask.prototype = new BMap.Overlay(); - - /** - * 这里不使用api中的自定义事件,是为了更灵活使用 - */ - Mask.prototype.dispatchEvent = baidu.lang.Class.prototype.dispatchEvent; - Mask.prototype.addEventListener = baidu.lang.Class.prototype.addEventListener; - Mask.prototype.removeEventListener = baidu.lang.Class.prototype.removeEventListener; - - Mask.prototype.initialize = function(map){ - var me = this; - this._map = map; - var div = this.container = document.createElement("div"); - var size = this._map.getSize(); - div.style.cssText = "position:absolute;background:url(about:blank);cursor:crosshair;width:" + size.width + "px;height:" + size.height + "px"; - this._map.addEventListener('resize', function(e) { - me._adjustSize(e.size); - }); - this._map.getPanes().floatPane.appendChild(div); - this._bind(); - return div; - }; - - Mask.prototype.draw = function() { - var map = this._map, - point = map.pixelToPoint(new BMap.Pixel(0, 0)), - pixel = map.pointToOverlayPixel(point); - this.container.style.left = pixel.x + "px"; - this.container.style.top = pixel.y + "px"; - }; - - /** - * 开启鼠标到地图边缘,自动平移地图 - */ - Mask.prototype.enableEdgeMove = function() { - this._enableEdgeMove = true; - } - - /** - * 关闭鼠标到地图边缘,自动平移地图 - */ - Mask.prototype.disableEdgeMove = function() { - clearInterval(this._edgeMoveTimer); - this._enableEdgeMove = false; - } - - /** - * 绑定事件,派发自定义事件 - */ - Mask.prototype._bind = function() { - - var me = this, - map = this._map, - container = this.container, - lastMousedownXY = null, - lastClickXY = null; - - /** - * 根据event对象获取鼠标的xy坐标对象 - * @param {Event} - * @return {Object} {x:e.x, y:e.y} - */ - var getXYbyEvent = function(e){ - return { - x : e.clientX, - y : e.clientY - } - }; - - var domEvent = function(e) { - var type = e.type, - e = baidu.getEvent(e), - point = me.getDrawPoint(e); //当前鼠标所在点的地理坐标 - - var dispatchEvent = function(type) { - e.point = point; - me.dispatchEvent(e); - } - - if (type == "mousedown") { - lastMousedownXY = getXYbyEvent(e); - } - - var nowXY = getXYbyEvent(e); - //click经过一些特殊处理派发,其他同事件按正常的dom事件派发 - if (type == "click") { - //鼠标点击过程不进行移动才派发click和dblclick - if (Math.abs(nowXY.x - lastMousedownXY.x) < 5 && Math.abs(nowXY.y - lastMousedownXY.y) < 5 ) { - if (!lastClickXY || !(Math.abs(nowXY.x - lastClickXY.x) < 5 && Math.abs(nowXY.y - lastClickXY.y) < 5)) { - dispatchEvent('click'); - lastClickXY = getXYbyEvent(e); - } else { - lastClickXY = null; - } - } - } else { - dispatchEvent(type); - } - } - - /** - * 将事件都遮罩层的事件都绑定到domEvent来处理 - */ - var events = ['click', 'mousedown', 'mousemove', 'mouseup', 'dblclick'], - index = events.length; - while (index--) { - baidu.on(container, events[index], domEvent); - } - - //鼠标移动过程中,到地图边缘后自动平移地图 - baidu.on(container, 'mousemove', function(e) { - if (me._enableEdgeMove) { - me.mousemoveAction(e); - } - }); - }; - - //鼠标移动过程中,到地图边缘后自动平移地图 - Mask.prototype.mousemoveAction = function(e) { - function getClientPosition(e) { - var clientX = e.clientX, - clientY = e.clientY; - if (e.changedTouches) { - clientX = e.changedTouches[0].clientX; - clientY = e.changedTouches[0].clientY; - } - return new BMap.Pixel(clientX, clientY); - } - - var map = this._map, - me = this, - pixel = map.pointToPixel(this.getDrawPoint(e)), - clientPos = getClientPosition(e), - offsetX = clientPos.x - pixel.x, - offsetY = clientPos.y - pixel.y; - pixel = new BMap.Pixel((clientPos.x - offsetX), (clientPos.y - offsetY)); - this._draggingMovePixel = pixel; - var point = map.pixelToPoint(pixel), - eventObj = { - pixel: pixel, - point: point - }; - // 拖拽到地图边缘移动地图 - this._panByX = this._panByY = 0; - if (pixel.x <= 20 || pixel.x >= map.width - 20 - || pixel.y <= 50 || pixel.y >= map.height - 10) { - if (pixel.x <= 20) { - this._panByX = 8; - } else if (pixel.x >= map.width - 20) { - this._panByX = -8; - } - if (pixel.y <= 50) { - this._panByY = 8; - } else if (pixel.y >= map.height - 10) { - this._panByY = -8; - } - if (!this._edgeMoveTimer) { - this._edgeMoveTimer = setInterval(function(){ - map.panBy(me._panByX, me._panByY, {"noAnimation": true}); - }, 30); - } - } else { - if (this._edgeMoveTimer) { - clearInterval(this._edgeMoveTimer); - this._edgeMoveTimer = null; - } - } - } - - /* - * 调整大小 - * @param {Size} - */ - Mask.prototype._adjustSize = function(size) { - this.container.style.width = size.width + 'px'; - this.container.style.height = size.height + 'px'; - }; - - /** - * 获取当前绘制点的地理坐标 - * - * @param {Event} e e对象 - * @return Point对象的位置信息 - */ - Mask.prototype.getDrawPoint = function(e) { - - var map = this._map, - trigger = baidu.getTarget(e), - x = e.offsetX || e.layerX || 0, - y = e.offsetY || e.layerY || 0; - if (trigger.nodeType != 1) trigger = trigger.parentNode; - while (trigger && trigger != map.getContainer()) { - if (!(trigger.clientWidth == 0 && - trigger.clientHeight == 0 && - trigger.offsetParent && trigger.offsetParent.nodeName == 'TD')) { - x += trigger.offsetLeft || 0; - y += trigger.offsetTop || 0; - } - trigger = trigger.offsetParent; - } - var pixel = new BMap.Pixel(x, y); - var point = map.pixelToPoint(pixel); - return point; - - } - - /** - * 绘制工具面板,自定义控件 - */ - function DrawingTool(drawingManager, drawingToolOptions) { - this.drawingManager = drawingManager; - - drawingToolOptions = this.drawingToolOptions = drawingToolOptions || {}; - // 默认停靠位置和偏移量 - this.defaultAnchor = BMAP_ANCHOR_TOP_LEFT; - this.defaultOffset = new BMap.Size(10, 10); - - //默认所有工具栏都显示 - this.defaultDrawingModes = [ - BMAP_DRAWING_MARKER, - BMAP_DRAWING_CIRCLE, - BMAP_DRAWING_POLYLINE, - BMAP_DRAWING_POLYGON, - BMAP_DRAWING_RECTANGLE - ]; - //工具栏可显示的绘制模式 - if (drawingToolOptions.drawingModes) { - this.drawingModes = drawingToolOptions.drawingModes; - } else { - this.drawingModes = this.defaultDrawingModes - } - - //用户设置停靠位置和偏移量 - if (drawingToolOptions.anchor) { - this.setAnchor(drawingToolOptions.anchor); - } - if (drawingToolOptions.offset) { - this.setOffset(drawingToolOptions.offset); - } - } - - // 通过JavaScript的prototype属性继承于BMap.Control - DrawingTool.prototype = new BMap.Control(); - - // 自定义控件必须实现自己的initialize方法,并且将控件的DOM元素返回 - // 在本方法中创建个div元素作为控件的容器,并将其添加到地图容器中 - DrawingTool.prototype.initialize = function(map){ - // 创建一个DOM元素 - var container = this.container = document.createElement("div"); - container.className = "BMapLib_Drawing"; - //用来设置外层边框阴影 - var panel = this.panel = document.createElement("div"); - panel.className = "BMapLib_Drawing_panel"; - if (this.drawingToolOptions && this.drawingToolOptions.scale) { - this._setScale(this.drawingToolOptions.scale); - } - container.appendChild(panel); - // 添加内容 - panel.innerHTML = this._generalHtml(); - //绑定事件 - this._bind(panel); - // 添加DOM元素到地图中 - map.getContainer().appendChild(container); - // 将DOM元素返回 - return container; - } - - //生成工具栏的html元素 - DrawingTool.prototype._generalHtml = function(map){ - - //鼠标经过工具栏上的提示信息 - var tips = {}; - tips["hander"] = "拖动地图"; - tips[BMAP_DRAWING_MARKER] = "画点"; - tips[BMAP_DRAWING_CIRCLE] = "画圆"; - tips[BMAP_DRAWING_POLYLINE] = "画折线"; - tips[BMAP_DRAWING_POLYGON] = "画多边形"; - tips[BMAP_DRAWING_RECTANGLE] = "画矩形"; - - var getItem = function(className, drawingType) { - return ''; - } - - var html = []; - html.push(getItem("BMapLib_box BMapLib_hander", "hander")); - for (var i = 0, len = this.drawingModes.length; i < len; i++) { - var classStr = 'BMapLib_box BMapLib_' + this.drawingModes[i]; - if (i == len-1) { - classStr += ' BMapLib_last'; - } - html.push(getItem(classStr, this.drawingModes[i])); - } - return html.join(''); - } - - /** - * 设置工具栏的缩放比例 - */ - DrawingTool.prototype._setScale = function(scale){ - var width = 390, - height = 50, - ml = -parseInt((width - width * scale) / 2, 10), - mt = -parseInt((height - height * scale) / 2, 10); - this.container.style.cssText = [ - "-moz-transform: scale(" + scale + ");", - "-o-transform: scale(" + scale + ");", - "-webkit-transform: scale(" + scale + ");", - "transform: scale(" + scale + ");", - "margin-left:" + ml + "px;", - "margin-top:" + mt + "px;", - "*margin-left:0px;", //ie6、7 - "*margin-top:0px;", //ie6、7 - "margin-left:0px\\0;", //ie8 - "margin-top:0px\\0;", //ie8 - //ie下使用滤镜 - "filter: progid:DXImageTransform.Microsoft.Matrix(", - "M11=" + scale + ",", - "M12=0,", - "M21=0,", - "M22=" + scale + ",", - "SizingMethod='auto expand');" - ].join(''); - } - - //绑定工具栏的事件 - DrawingTool.prototype._bind = function(panel){ - var me = this; - baidu.on(this.panel, 'click', function (e) { - var target = baidu.getTarget(e); - var drawingType = target.getAttribute('drawingType'); - me.setStyleByDrawingMode(drawingType); - me._bindEventByDraingMode(drawingType); - }); - } - - //设置工具栏当前选中的项样式 - DrawingTool.prototype.setStyleByDrawingMode = function(drawingType){ - if (!drawingType) { - return; - } - var boxs = this.panel.getElementsByTagName("a"); - for (var i = 0, len = boxs.length; i < len; i++) { - var box = boxs[i]; - if (box.getAttribute('drawingType') == drawingType) { - var classStr = "BMapLib_box BMapLib_" + drawingType + "_hover"; - if (i == len - 1) { - classStr += " BMapLib_last"; - } - box.className = classStr; - } else { - box.className = box.className.replace(/_hover/, ""); - } - } - } - - //设置工具栏当前选中的项样式 - DrawingTool.prototype._bindEventByDraingMode = function(drawingType){ - var me = this; - var drawingManager = this.drawingManager; - //点在拖拽地图的按钮上 - if (drawingType == "hander") { - drawingManager.close(); - drawingManager._map.enableDoubleClickZoom(); - } else { - drawingManager.setDrawingMode(drawingType); - drawingManager.open(); - drawingManager._map.disableDoubleClickZoom(); - } - } - - //用来存储用户实例化出来的drawingmanager对象 - var instances = []; - - /* - * 关闭其他实例的绘制模式 - * @param {DrawingManager} 当前的实例 - */ - function closeInstanceExcept(instance) { - var index = instances.length; - while (index--) { - if (instances[index] != instance) { - instances[index].close(); - } - } - } - return DrawingManager; -}); \ No newline at end of file diff --git a/src/libs/TrafficControl.js b/src/libs/TrafficControl.js deleted file mode 100644 index 00f5c25..0000000 --- a/src/libs/TrafficControl.js +++ /dev/null @@ -1,1132 +0,0 @@ -/** - * @fileoverview 百度地图的测距工具类,对外开放。 - * 允许用户在地图上点击完成距离的测量。 - * 使用者可以自定义测距线段的相关样式,例如线宽、颜色、测距结果所用的单位制等等。 - * 主入口类是DistanceTool, - * 基于Baidu Map API 1.2。 - * - * @author Baidu Map Api Group - * @version 1.2 - */ -(function (root, factory) { - if (typeof exports === 'object') { - const instance = factory(); - root.BMapLib = root.BMapLib || {}; - root.BMapLib.TrafficControl = root.BMapLib.TrafficControl || instance; - module.exports = instance; - } else if (typeof define === 'function' && define.amd) { - define(factory); - } else { - root.BMapLib = root.BMapLib || {}; - root.BMapLib.TrafficControl = root.BMapLib.TrafficControl || factory(); - } -})(window, function () { - //声明baidu包 - var T, baidu = T = baidu || { - version: "1.3.9" - }; - //提出guid,防止在与老版本Tangram混用时 - //在下一行错误的修改window[undefined] - baidu.guid = "$BAIDU$"; - //闭包,里边是所用到的tangram的方法 - (function () { - /** @ignore - * @namespace baidu.dom 操作dom的方法。 - */ - baidu.dom = baidu.dom || {}; - - /* @ignore - * @namespace baidu.event 屏蔽浏览器差异性的事件封装。 - * @property target 事件的触发元素 - * @property pageX 鼠标事件的鼠标x坐标 - * @property pageY 鼠标事件的鼠标y坐标 - * @property keyCode 键盘事件的键值 - */ - baidu.event = baidu.event || {}; - - /* @ignore - * @namespace baidu.lang 对语言层面的封装,包括类型判断、模块扩展、继承基类以及对象自定义事件的支持。 - */ - baidu.lang = baidu.lang || {}; - - /* @ignore - * @namespace baidu.browser 判断浏览器类型和特性的属性。 - */ - baidu.browser = baidu.browser || {}; - /** - * 为目标元素添加className - * @name baidu.dom.addClass - * @function - * @grammar baidu.dom.addClass(element, className) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} className 要添加的className,允许同时添加多个class,中间使用空白符分隔 - * @remark - * 使用者应保证提供的className合法性,不应包含不合法字符,className合法字符参考:http://www.w3.org/TR/CSS2/syndata.html。 - * @shortcut addClass - * @meta standard - * @see baidu.dom.removeClass - * - * - * @returns {HTMLElement} 目标元素 - */ - baidu.dom.addClass = function (element, className) { - element = baidu.dom.g(element); - var classArray = className.split(/\s+/), - result = element.className, - classMatch = " " + result + " ", - i = 0, - l = classArray.length; - - for (; i < l; i++) { - if (classMatch.indexOf(" " + classArray[i] + " ") < 0) { - result += (result ? ' ' : '') + classArray[i]; - } - } - - element.className = result; - return element; - }; - - // 声明快捷方法 - baidu.addClass = baidu.dom.addClass; - /** - * 移除目标元素的className - * @name baidu.dom.removeClass - * @function - * @grammar baidu.dom.removeClass(element, className) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} className 要移除的className,允许同时移除多个class,中间使用空白符分隔 - * @remark - * 使用者应保证提供的className合法性,不应包含不合法字符,className合法字符参考:http://www.w3.org/TR/CSS2/syndata.html。 - * @shortcut removeClass - * @meta standard - * @see baidu.dom.addClass - * - * @returns {HTMLElement} 目标元素 - */ - baidu.dom.removeClass = function (element, className) { - element = baidu.dom.g(element); - - var oldClasses = element.className.split(/\s+/), - newClasses = className.split(/\s+/), - lenOld, lenDel = newClasses.length, - j, i = 0; - //考虑到同时删除多个className的应用场景概率较低,故放弃进一步性能优化 - // by rocy @1.3.4 - for (; i < lenDel; ++i) { - for (j = 0, lenOld = oldClasses.length; j < lenOld; ++j) { - if (oldClasses[j] == newClasses[i]) { - oldClasses.splice(j, 1); - break; - } - } - } - element.className = oldClasses.join(' '); - return element; - }; - - // 声明快捷方法 - baidu.removeClass = baidu.dom.removeClass; - - /** - * 获取目标元素的computed style值。如果元素的样式值不能被浏览器计算,则会返回空字符串(IE) - * - * @author berg - * @name baidu.dom.getComputedStyle - * @function - * @grammar baidu.dom.getComputedStyle(element, key) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} key 要获取的样式名 - * - * @see baidu.dom.getStyle - * - * @returns {string} 目标元素的computed style值 - */ - - baidu.dom.getComputedStyle = function (element, key) { - element = baidu.dom._g(element); - var doc = baidu.dom.getDocument(element), - styles; - if (doc.defaultView && doc.defaultView.getComputedStyle) { - styles = doc.defaultView.getComputedStyle(element, null); - if (styles) { - return styles[key] || styles.getPropertyValue(key); - } - } - return ''; - }; - /** - * 获取目标元素的样式值 - * @name baidu.dom.getStyle - * @function - * @grammar baidu.dom.getStyle(element, key) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {string} key 要获取的样式名 - * @remark - * - * 为了精简代码,本模块默认不对任何浏览器返回值进行归一化处理(如使用getStyle时,不同浏览器下可能返回rgb颜色或hex颜色),也不会修复浏览器的bug和差异性(如设置IE的float属性叫styleFloat,firefox则是cssFloat)。
    - * baidu.dom._styleFixer和baidu.dom._styleFilter可以为本模块提供支持。
    - * 其中_styleFilter能对颜色和px进行归一化处理,_styleFixer能对display,float,opacity,textOverflow的浏览器兼容性bug进行处理。 - * @shortcut getStyle - * @meta standard - * @see baidu.dom.setStyle,baidu.dom.setStyles, baidu.dom.getComputedStyle - * - * @returns {string} 目标元素的样式值 - */ - - baidu.dom.getStyle = function (element, key) { - var dom = baidu.dom; - - element = dom.g(element); - var value = element.style[key] || (element.currentStyle ? element.currentStyle[key] : "") || dom.getComputedStyle(element, key); - - return value; - }; - - // 声明快捷方法 - baidu.getStyle = baidu.dom.getStyle; - - /** - * 获取目标元素所属的document对象 - * @name baidu.dom.getDocument - * @function - * @grammar baidu.dom.getDocument(element) - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @meta standard - * @see baidu.dom.getWindow - * - * @returns {HTMLDocument} 目标元素所属的document对象 - */ - baidu.dom.getDocument = function (element) { - element = baidu.dom.g(element); - return element.nodeType == 9 ? element : element.ownerDocument || element.document; - }; - - - /** - * 从文档中获取指定的DOM元素 - * @name baidu.dom.g - * @function - * @grammar baidu.dom.g(id) - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @shortcut g,T.G - * @meta standard - * @see baidu.dom.q - * - * @returns {HTMLElement|null} 获取的元素,查找不到时返回null,如果参数不合法,直接返回参数 - */ - baidu.dom.g = function (id) { - if ('string' == typeof id || id instanceof String) { - return document.getElementById(id); - } else if (id && id.nodeName && (id.nodeType == 1 || id.nodeType == 9)) { - return id; - } - return null; - }; - // 声明快捷方法 - baidu.g = baidu.G = baidu.dom.g; - /** - * 从文档中获取指定的DOM元素 - * **内部方法** - * - * @param {string|HTMLElement} id 元素的id或DOM元素 - * @meta standard - * @return {HTMLElement} DOM元素,如果不存在,返回null,如果参数不合法,直接返回参数 - */ - baidu.dom._g = function (id) { - if (baidu.lang.isString(id)) { - return document.getElementById(id); - } - return id; - }; - - // 声明快捷方法 - baidu._g = baidu.dom._g; - - - /** - * 判断目标参数是否string类型或String对象 - * @name baidu.lang.isString - * @function - * @grammar baidu.lang.isString(source) - * @param {Any} source 目标参数 - * @shortcut isString - * @meta standard - * @see baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate - * - * @returns {boolean} 类型判断结果 - */ - baidu.lang.isString = function (source) { - return '[object String]' == Object.prototype.toString.call(source); - }; - - // 声明快捷方法 - baidu.isString = baidu.lang.isString; - - /** - * 事件监听器的存储表 - * @private - * @meta standard - */ - baidu.event._listeners = baidu.event._listeners || []; - /** - * 为目标元素添加事件监听器 - * @name baidu.event.on - * @function - * @grammar baidu.event.on(element, type, listener) - * @param {HTMLElement|string|window} element 目标元素或目标元素id - * @param {string} type 事件类型 - * @param {Function} listener 需要添加的监听器 - * @remark - * - 1. 不支持跨浏览器的鼠标滚轮事件监听器添加
    - 2. 改方法不为监听器灌入事件对象,以防止跨iframe事件挂载的事件对象获取失败 - - * @shortcut on - * @meta standard - * @see baidu.event.un - * - * @returns {HTMLElement|window} 目标元素 - */ - baidu.event.on = function (element, type, listener) { - type = type.replace(/^on/i, ''); - element = baidu.dom._g(element); - - var realListener = function (ev) { - // 1. 这里不支持EventArgument, 原因是跨frame的事件挂载 - // 2. element是为了修正this - listener.call(element, ev); - }, - lis = baidu.event._listeners, - filter = baidu.event._eventFilter, - afterFilter, realType = type; - type = type.toLowerCase(); - // filter过滤 - if (filter && filter[type]) { - afterFilter = filter[type](element, type, realListener); - realType = afterFilter.type; - realListener = afterFilter.listener; - } - - // 事件监听器挂载 - if (element.addEventListener) { - element.addEventListener(realType, realListener, false); - } else if (element.attachEvent) { - element.attachEvent('on' + realType, realListener); - } - - // 将监听器存储到数组中 - lis[lis.length] = [element, type, listener, realListener, realType]; - return element; - }; - - // 声明快捷方法 - baidu.on = baidu.event.on; - - /** - * 为目标元素移除事件监听器 - * @name baidu.event.un - * @function - * @grammar baidu.event.un(element, type, listener) - * @param {HTMLElement|string|window} element 目标元素或目标元素id - * @param {string} type 事件类型 - * @param {Function} listener 需要移除的监听器 - * @shortcut un - * @meta standard - * @see baidu.event.on - * - * @returns {HTMLElement|window} 目标元素 - */ - baidu.event.un = function (element, type, listener) { - element = baidu.dom._g(element); - type = type.replace(/^on/i, '').toLowerCase(); - - var lis = baidu.event._listeners, - len = lis.length, - isRemoveAll = !listener, - item, realType, realListener; - - //如果将listener的结构改成json - //可以节省掉这个循环,优化性能 - //但是由于un的使用频率并不高,同时在listener不多的时候 - //遍历数组的性能消耗不会对代码产生影响 - //暂不考虑此优化 - while (len--) { - item = lis[len]; - - // listener存在时,移除element的所有以listener监听的type类型事件 - // listener不存在时,移除element的所有type类型事件 - if (item[1] === type && item[0] === element && (isRemoveAll || item[2] === listener)) { - realType = item[4]; - realListener = item[3]; - if (element.removeEventListener) { - element.removeEventListener(realType, realListener, false); - } else if (element.detachEvent) { - element.detachEvent('on' + realType, realListener); - } - lis.splice(len, 1); - } - } - - return element; - }; - - // 声明快捷方法 - baidu.un = baidu.event.un; - - ///import baidu.browser; - if (/msie (\d+\.\d)/i.test(navigator.userAgent)) { - //IE 8下,以documentMode为准 - //在百度模板中,可能会有$,防止冲突,将$1 写成 \x241 - /** - * 判断是否为ie浏览器 - * @property ie ie版本号 - * @grammar baidu.browser.ie - * @meta standard - * @shortcut ie - * @see baidu.browser.firefox,baidu.browser.safari,baidu.browser.opera,baidu.browser.chrome,baidu.browser.maxthon - */ - baidu.browser.ie = baidu.ie = document.documentMode || +RegExp['\x241']; - } - - /** - * @namespace baidu.platform 判断平台类型和特性的属性。 - */ - baidu.platform = baidu.platform || {}; - - /** - * 判断是否为iphone平台 - * @property iphone 是否为iphone平台 - * @grammar baidu.platform.iphone - * @meta standard - * @see baidu.platform.x11,baidu.platform.windows,baidu.platform.macintosh,baidu.platform.ipad,baidu.platform.android - */ - baidu.platform.isIphone = /iphone/i.test(navigator.userAgent); - - /** - * 判断是否为android平台 - * @property android 是否为android平台 - * @grammar baidu.platform.android - * @meta standard - * @see baidu.platform.x11,baidu.platform.windows,baidu.platform.macintosh,baidu.platform.iphone,baidu.platform.ipad - * @author jz - */ - baidu.platform.isAndroid = /android/i.test(navigator.userAgent); - /* - * Tangram - * Copyright 2009 Baidu Inc. All rights reserved. - */ - - ///import baidu.platform; - - /** - * 判断是否为ipad平台 - * @property ipad 是否为ipad平台 - * @grammar baidu.platform.ipad - * @meta standard - * @see baidu.platform.x11,baidu.platform.windows,baidu.platform.macintosh,baidu.platform.iphone,baidu.platform.android - * @author jz - */ - baidu.platform.isIpad = /ipad/i.test(navigator.userAgent); - - /** - * 是否为移动平台 - * @returns {Boolean} - */ - baidu.isMobile = function() { - return !!(baidu.platform.isIphone || baidu.platform.isIpad || baidu.platform.isAndroid); - } - - })(); - - var stylePrefix = baidu.isMobile() ? "_mobile" : "_deskTop"; - - /** - * @exports TrafficControl as BMapLib.TrafficControl - */ - var TrafficControl = - /** - * TrafficControl类的构造函数 - * @class 交通流量控件 入口。 - * 实例化该类后,通过addControl()方法,将控件添加到地图上 - - * @constructor - * @example 参考示例:
    - * var map = new BMap.Map("container");
    map.centerAndZoom(new BMap.Point(116.404, 39.915), 15);
    var ctrl = new BMapLib.TrafficControl();
    map.addControl(ctrl); - */ - - function (options) { - // 默认停靠位置和偏移量 - this.defaultAnchor = BMAP_ANCHOR_TOP_RIGHT; - this.defaultOffset = new BMap.Size(10, 10); - this.showPanel = options && options.showPanel; - } - // 继承Control - TrafficControl.prototype = new BMap.Control(); - /** - * 实现父类的initialize方法 - * @ignore - * @param {Map} map Baidu map的实例对象 - - * @example 参考示例:
    - * var traffic = new BMapLib.TrafficControl.initialize(map); - */ - TrafficControl.prototype.initialize = function (map) { - var btn = create("div", { - "title": "显示交通流量", - "id": "tcBtn", - "class": "maplibTcBtn" + stylePrefix + " maplibTcBtnOff" + stylePrefix - }); - map.getContainer().appendChild(btn); - this._map = map; - - this._popUpDiv(this, btn); - var me = this; - this.btn = btn; - //将创建的dom元素返回 - return btn; - } - - /** - * popUpDiv 类的构造函数 - * @class 私有类,创建交通流量控制面板。 - * 实例化该类后,即可调用该类提供的show - * 方法打开控制面板。 - * - * @constructor - * @param {TrafficControl} TrafficControl的实例对象 - * @param {DOM} button 创建的DOM按钮 - - * @example 参考示例:
    - * var pop = new BMapLib.TrafficControl._popUpDiv(map);
    pop.show(); - */ - TrafficControl.prototype._popUpDiv = function (me, btn) { - var me = this; - var arrRealTimeTxt = ["查看实时路况", "流量预测"]; - var arrPredictionTxt = ["查看流量预测", "实时路况"]; - //是否是实时路况 - var bRealTime = true; - //该弹出层是打开还是关闭状态 - this.bShow = false; - var thisPop = this; - //重置绑定状态 - thisPop._bind = false; - - //将弹出div的HTML插入到dom中 - insertHTML(btn, "afterEnd", genHtml()); - insertHTML(btn, "afterEnd", genHtml_mobile()); - - //将用到的dom元素都存到变量中 - var viewPreDom = baidu.g("tcViewPrediction"); - var dvPredition = baidu.g("tcPredition"); - var dvTcTitle = baidu.g("tcTitle"); - var dvTcDay = baidu.g("maplibTcDay"); - var dvTcNow = baidu.g("tcNow"); - var dvTcWrap = baidu.g("tcWrap"); - var dvTcTimeBox = baidu.g("tcTimeBox"); - var dvTcUpdate = baidu.g("tcUpdate"); - - var weekName = ["一", "二", "三", "四", "五", "六", "日"]; - - //处理拖动时间条动作 - var timeline = new setBar(me); - /** - * 显示控制面板 * - * @return 无返回值 - * - * @example 参考示例:
    - * pop.show(); - */ - this.show = function () { - initialize(); - me.bShow = true; - baidu.dom.removeClass(btn, "maplibTcBtnOff" + stylePrefix); - } - /** - * 隐藏控制面板 * - * @return 无返回值 - * - * @example 参考示例:
    - * pop.hide(); - */ - this.hide = function () { - me.bShow = false; - baidu.dom.addClass(btn, "maplibTcBtnOff" + stylePrefix); - if (baidu.isMobile()) { - baidu.dom.addClass("tcWrap_mobile", "maplibTfctrHide"); - } else { - baidu.dom.addClass("tcWrap", "maplibTcHide"); - baidu.dom.addClass("tcPredition", "maplibTcHide"); - } - me.hideTraffic(); - } - /** - * 返回该控制面板的状态 * - * @return {Boolean} bShow 返回该控制面板的状态 - * - * @example 参考示例:
    - * pop.show(); - */ - this.isbShow = function () { - return me.bShow; - } - /** - * 定位控制面板 - * @param {Size} size 百度地图基础类size - * @return 无返回值 - * - * @example 参考示例:
    - * pop.setPopOffset(); - */ - this.setPopOffset = function (size) { - var controlHeight = 24; - //弹出层的offset - var offsetH = size.height + controlHeight + "px"; - var offsetW= size.width + "px" ; - - switch (me.getAnchor()) { - //左上 - case BMAP_ANCHOR_TOP_LEFT: - dvTcWrap.style.top = offsetH ; - dvTcWrap.style.left = offsetW; - break; - //右上 - case BMAP_ANCHOR_TOP_RIGHT: - dvTcWrap.style.top = offsetH; - dvTcWrap.style.right = offsetW; - break; - //右下 - case BMAP_ANCHOR_BOTTOM_RIGHT: - dvTcWrap.style.bottom = offsetH; - dvTcWrap.style.right = offsetW; - break; - //左下 - case BMAP_ANCHOR_BOTTOM_LEFT: - dvTcWrap.style.bottom = offsetH; - dvTcWrap.style.left = offsetW; - break; - } - } - var eventName = baidu.isMobile() ? "ontouchend" : "onclick" - //绑定事件,控制弹出层的显示跟隐藏 - baidu.event.on(btn, eventName, function () { - showOrHidePopDiv(); - }); - baidu.event.on("tcClose", "click", function (e) { - showOrHidePopDiv(); - }) - //控制弹出层跟trafficLayer的隐藏或者显示。 - function showOrHidePopDiv(){ - if (!thisPop.isbShow()) { - thisPop.setPopOffset(me.getOffset()); - thisPop.show(); - } else { - - thisPop.hide(); - } - } - //初始化面板的状态 - function initialize() { - dvTcDay.innerHTML = "更新时间"; - dvTcTitle.innerHTML = arrPredictionTxt[1]; - viewPreDom.innerHTML = arrPredictionTxt[0]; - baidu.dom.addClass(dvPredition, "maplibTcHide"); - dvTcUpdate.style.display = "block"; - - bRealTime = true; - if (baidu.isMobile()) { - if (me.showPanel) { - baidu.dom.removeClass("tcWrap_mobile", "maplibTfctrHide"); - } - } else { - baidu.dom.removeClass("tcWrap", "maplibTcHide"); - } - - //初始化a的状态 - var arrA = baidu.g("tcWeek").getElementsByTagName("a"); - for (var i = 0; i < 7; i++) { - arrA[i].className = ''; - } - - //获取服务器时间 - var curTimeUrl = "http://its.map.baidu.com:8002/traffic/GetCurrentTime?callback=BMapLib.TrafficControl.getTime&"; - scriptRequest(curTimeUrl + (new Date()).getTime(),callback); - //3分钟刷新一次,先清除之前可能存在的timer - if(me.timer) clearInterval(me.timer); - me.timer = setInterval(function(){ - scriptRequest(curTimeUrl + (new Date()).getTime(),function(){ - if(me.bShow){ - var t = TrafficControl.curTime; - var tHour = t.getHours(); - var time = (tHour < 10 ? ("0" + tHour) : tHour) + ":" + (t.getMinutes() < 10 ? ("0" + t.getMinutes()) : t.getMinutes()); - dvTcNow.innerHTML = time; - me.hideTraffic(); - me.showTraffic(); - } - }); - }, 1000 * 3 *60); - - function callback(){ - var t = TrafficControl.curTime; - var tHour = t.getHours(); - - //是否绑定了事件,防止重复绑定 - if (!thisPop._bind) { - bindEventToPopDiv(me); - //私有方法 绑定点击周一到周日事件 - bindEventToWeek(me); - thisPop._bind = true; - } - var time = (tHour < 10 ? ("0" + tHour) : tHour) + ":" + (t.getMinutes() < 10 ? ("0" + t.getMinutes()) : t.getMinutes()); - dvTcNow.innerHTML = time; - me.hour = tHour; - //0为周日,6为周六,转换成1-7对应周一到周日 - me.weekday = t.getDay() == 0? 7: t.getDay(); - me.time = time; - timeline.setBarTime(tHour); - } - } - - //生成手机下的弹出html - function genHtml_mobile() { - return '
    实时路况
    '; - } - - //生成弹出div中的html - function genHtml() { - var html = ['
    ']; - html.push('
    实时路况
    '); - html.push('
    '); - html.push('
    更新时间:  查看流量预测
    '); - html.push('
    '); - html.push(''); - html.push('
    时间
    '); - html.push('
    '); - html.push('
    20:00
    '); - html.push('
    '); - html.push('
    '); - html.push('
    '); - html.push('
    '); - html.push('
    '); - html.push('
    (基于历史流量统计预测 仅供参考)
    '); - html.push('
    '); - - return html.join(""); - } - - //给弹出层中的按钮绑定事件 - function bindEventToPopDiv(me) { - - baidu.event.on("tcViewPrediction", "click", function () { - //如果当前是实时流量,就显示预测流量,相当于toggle - if (bRealTime) { - //显示预测交通流量 - showPrediction(); - } else { - //实时路况 - initialize(); - } - }); - - //显示预测流量 - function showPrediction() { - //清除 每3分钟调用1次实时流量的timer - if(me.timer) clearInterval(me.timer); - dvTcTitle.innerHTML = arrRealTimeTxt[1]; - viewPreDom.innerHTML = arrRealTimeTxt[0]; - baidu.dom.removeClass(dvPredition, "maplibTcHide"); - dvTcUpdate.style.display = "none"; - bRealTime = false; - dvTcDay.innerHTML = "星期" + weekName[me.weekday-1]; - //设置预测流量的时间 - dvTcNow.innerHTML = dvTcTimeBox.innerHTML; - me.showTraffic({ - predictDate: { - hour: me.hour, - weekday: me.weekday - } - }); - } - baidu.event.on("tcUpdate", "click", function () { - initialize(); - }); - } - - //更新文字,只在预测流量中调用 - function updateTimeTxt() { - dvTcDay.innerHTML = "星期" + weekName[me.weekday-1]; - dvTcNow.innerHTML = dvTcTimeBox.innerHTML; - } - - //绑定预测流量点击事件,周一到周日 - function bindEventToWeek(me) { - baidu.event.on("tcWeek", "onclick", function (e) { - var elem = e.target || e.srcElement; - if (elem.tagName.toLowerCase() == "a") { - var arrA = baidu.g("tcWeek").getElementsByTagName("a"); - for (var i = 0; i < 7; i++) { - arrA[i].className = ''; - } - baidu.dom.addClass(elem, "maplibTcOn"); - me.weekday = (parseInt(attr(elem, "lang"), 10)); - updateTimeTxt(); - me.showTraffic({ - predictDate: { - hour: me.hour, - weekday: me.weekday - } - }); - } - }); - } - - //时间条相关类 - function setBar(me) { - var hour; - var bt = baidu.g("tcMove"); - - //开始拖动 - function dragStart(e) { - baidu.on(document, "onmousemove", dragIng); - baidu.on(document, "onmouseup", dragEnd); - if (e && e.preventDefault) { - e.preventDefault(); - }else{ - window.event.returnValue = false; - } - return false; - } - - //拖动进行中 - function dragIng(e) { - var x = e.clientX || e.x; - var left = getPosition(baidu.G("tcPrev")).left + 9; - var margin = x - left - 4; - if (margin < 0) margin = 0; - if (margin > 165) margin = 165; - if (baidu.browser.ie <= 6) { - bt.style.marginLeft = (margin * 0.53) + "px"; - } else { - bt.style.marginLeft = margin + "px"; - } - dvTcTimeBox.style.marginLeft = (margin) + "px"; - setTimeBox(); - } - - //完成拖动 - function dragEnd() { - baidu.un(document, "onmousemove", dragIng) - baidu.un(document, "onmouseup", dragEnd); - //完成拖动后显示图层 - me.showTraffic({ - predictDate: { - hour: me.hour, - weekday: me.weekday - } - }); - } - baidu.on(bt, "onmousedown", dragStart); - - //绑定时间条中向前的箭头 - baidu.on("tcPrev", "click", function () { - setBarBtn("prev"); - - }); - //绑定时间条中向后的箭头 - baidu.on("tcNext", "click", function () { - setBarBtn("next"); - }); - - //设置前进后退按钮 - function setBarBtn(key) { - var box = dvTcTimeBox; - var margin = parseInt(baidu.dom.getStyle("tcTimeBox", "marginLeft")); - var n = Math.ceil((margin - 4) * 24 / 165); - setBarTime(key == 'next' ? (n + 1) : (n - 1)); - } - - /** - * 设置时间条上的时间 - * @param {Number} n 小时从0到24 - * @return 无返回值 - * - * @example 参考示例:
    - * timeBar.setBarTime(10); - */ - this.setBarTime = function (n) { - setBarTime(n) - } - - //设置时间条的时间 - function setBarTime(n) { - if (n < 0) n = 0; - if (n > 24) n = 24; - hour = n; - var margin = n * (165 / 24); - dvTcTimeBox.style.marginLeft = margin + "px"; - var bt = baidu.g("tcMove"); - if (baidu.browser.ie <= 6 && baidu.browser.ie > 0) { - bt.style.marginLeft = (margin * 0.53) + "px"; - } else { - bt.style.marginLeft = margin + "px"; - } - me.hour = hour; - if(bRealTime){ - me.showTraffic(); - }else{ - me.showTraffic({ - predictDate: { - hour: me.hour, - weekday: me.weekday - } - }); - } - setTimeBox(); - } - - //设置时间条上里边的内容 - function setTimeBox() { - var margin = parseInt(dvTcTimeBox.style.marginLeft); - var n = Math.ceil((margin - 4) * 24 / 165); - hour = n; - me.hour = n; - if (n < 10) n = "0" + n; - if(bRealTime){ - //更新时间跟预测的交通流量不一样 - dvTcNow.innerHTML = me.time; - dvTcTimeBox.innerHTML = n + ":00"; - }else{ - dvTcNow.innerHTML = dvTcTimeBox.innerHTML = n + ":00"; - } - } - } - } - /** - * 添加交通流量图层 - * @param {Json} predictDate {weekday:预测日期,取值1到7,表示周一到周日 ,hour: 预测小时数,取值0到23,表示当日的0点到23点} 表示交通流量的预测日期 - * @return 无返回值 - * - * @example 参考示例:
    - * ctrl.showTraffic({predictDate:{hour:15, weekday: 5}}); - */ - TrafficControl.prototype.showTraffic = function (predictDate) { - var trafficLayer; - if (this._trafficLayer) { - this._map.removeTileLayer(this._trafficLayer); - } - if(predictDate){ - //如果weekday不在1到7之间,则返回; - if(predictDate.predictDate.weekday > 7 || predictDate.predictDate.weekday < 1 ){ - return; - } - trafficLayer = new BMap.TrafficLayer(predictDate); - }else{ - trafficLayer = new BMap.TrafficLayer(); - } - this.bShow = true; - if (baidu.isMobile()) { - baidu.dom.removeClass(this.btn, "maplibTcBtnOff" + stylePrefix); - } - this._map.addTileLayer(trafficLayer); - this._trafficLayer = trafficLayer; - } - /** - * 隐藏交通流量图层 - * @return 无返回值 - * - * @example 参考示例:
    - * ctrl.hideTraffic(); - */ - TrafficControl.prototype.hideTraffic = function () { - this.bShow = false; - if (this._trafficLayer) { - this._map.removeTileLayer(this._trafficLayer); - this._trafficLayer = null; - } - - if (baidu.isMobile()) { - baidu.dom.addClass(this.btn, "maplibTcBtnOff" + stylePrefix); - } - } - - /** - * 重新父类的remove()方法,确保当移除控件的时候,与此控件相关的overlay等都会被去掉 - * 当使用removeControl()的方法的时候,会自动调用这个方法。 - * @return 无返回值 - * - * @example 参考示例:
    - * map.removeControl(ctrl); - */ - TrafficControl.prototype.remove = function(){ - this.hideTraffic(); - var dvWrap = baidu.g("tcWrap"); - //移除在dom中添加的html - dvWrap.parentNode.removeChild(dvWrap); - BMap.Control.prototype.remove.call(this); - //移除每3秒调用一次的实时流量 - if(this.timer) clearInterval(this.timer); - } - /** - * 设置获取属性 - * @ignore - * @param {String} 标签名称 - * @param {Object} 元素属性 - */ - - function attr(elem, name, value) { - if (!name || name.constructor != String) return ''; - name = { - 'for': 'htmlFor', - 'class': 'className' - }[name] || name; - if (typeof value != 'undefined') { - elem[name] = value; - if (elem.setAttribute) { - elem.setAttribute(name, value); - } - } - return elem[name] || elem.getAttribute(name) || ''; - } - /** - * 创建DOM对象 - * @ignore - * @param {String} 标签名称 - * @param {Object} 元素属性 - */ - - function create(tag, attr) { - var e = document.createElement(tag); - var attr = attr || {}; - var value; - // 设置属性 - for (var name in attr) { - value = attr[name]; - name = result()[name] || name; - if (name == "style") { - e.style.cssText = value; - continue; - } - if (e.setAttribute) { - e.setAttribute(name, value); - } else { - try { - e[name] = value; - } catch (e) {} - } - } - return e; - - function result() { - var attrName = { - 'cellpadding': 'cellPadding', - 'cellspacing': 'cellSpacing', - 'colspan': 'colSpan', - 'rowspan': 'rowSpan', - 'valign': 'vAlign' - }; - if (baidu.browser.ie < 8) { //ie低版本,只认className - attrName['for'] = 'htmlFor'; - attrName['class'] = 'className'; - } else { - attrName['htmlFor'] = 'for'; - attrName['className'] = 'class'; - } - return attrName; - } - } - /** - * 获取对象元素在页面中的位置 - * @ignore - * @param {Object} Html元素对象 - * @return {Object} 位置对象 - */ - - function getPosition(obj) { - var pos = { - left: 0, - top: 0 - }; - while (obj && obj.offsetParent) { - pos.left += obj.offsetLeft; - pos.top += obj.offsetTop; - obj = obj.offsetParent; - }; - return pos; - } - /** - * 在目标元素的指定位置插入HTML代码, - * 闭包,对外不暴露 - * @ignore - * @param {HTMLElement|string} element 目标元素或目标元素的id - * @param {String} position 插入html的位置信息 - * 取值为beforeBegin、afterBegin、beforeEnd或afterEnd,大小写不敏感 - * @param {String} html 要插入的html - * @return {HTMLElement} 目标元素 - */ - - function insertHTML(element, position, html) { - var range, begin; - if (element.insertAdjacentHTML) { - element.insertAdjacentHTML(position, html); - } else { - range = element.ownerDocument.createRange(); - // FF下range的位置设置错误可能导致创建出来的fragment在插入dom树之后html结构乱掉 - // 改用range.insertNode来插入html - position = position.toUpperCase(); - if (position == 'AFTERBEGIN' || position == 'BEFOREEND') { - range.selectNodeContents(element); - range.collapse(position == 'AFTERBEGIN'); - } else { - begin = position == 'BEFOREBEGIN'; - range[begin ? 'setStartBefore' : 'setEndAfter'](element); - range.collapse(begin); - } - range.insertNode(range.createContextualFragment(html)); - } - return element; - } - /** - * script异步请求 - * @param {String} url - * @param {Function} callback - * @returns none - */ - function scriptRequest(url,callback){ - var script = document.createElement('script'); - script.setAttribute('src', url); - script.setAttribute('type', 'text/javascript'); - script.setAttribute('charset', 'gbk'); - // 脚本加载完成后进行移除 - if (script.addEventListener) { - script.addEventListener('load', function(e) { - var t = e.target; - t.parentNode.removeChild(t); - if(callback) callback(); - }, false); - } - else if (script.attachEvent) { - script.attachEvent('onreadystatechange', function(e) { - var t = window.event.srcElement; - if (t && (t.readyState == 'loaded' || t.readyState == 'complete')) { - t.parentNode.removeChild(t); - if(callback) callback(); - } - }); - } - // 使用setTimeout解决ie6无法发送问题 - setTimeout(function() { - document.getElementsByTagName('head')[0].appendChild(script); - script = null; - }, 1); - } - /** - * 将服务器更新时间设置为类的属性 - * @param {Date} dtNow 服务器更新时间 - * @param {Function} callback - * @returns none - */ - TrafficControl.getTime = function(dtNow){ - this.curTime = isNaN(dtNow) ? new Date() : new Date(dtNow); - } - return TrafficControl; -}); \ No newline at end of file diff --git a/types/autoComplete.d.ts b/types/autoComplete.d.ts deleted file mode 100644 index ccba438..0000000 --- a/types/autoComplete.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Component } from 'react'; -import { Point } from './base/common'; -import { ControlAnchor } from "./base/constants"; -import { AutoCompleteEvents } from './base/events'; - -export declare class AutoComplete extends Component { - /** - * 文本输入框元素或其id - */ - input: string | HTMLElement; - /** - * 在input框中输入字符后,发起列表检索,完成后的回调函数 - */ - searchComplete: Function; - /** - * 折线颜色 - */ - events: AutoCompleteEvents; - /** - * 获取当前实例 - */ - getInstance: Function; - - /** - * 设定返回结果的所属范围 - */ - location: string | Point; - - /** - * 绑定的input控件的值 - */ - value: string; -} diff --git a/types/base/common.d.ts b/types/base/common.d.ts deleted file mode 100644 index 603fa37..0000000 --- a/types/base/common.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { ControlAnchor } from './constants'; - -export interface MapStyle { - style: string; - featrues: any[]; - styleJson: any[]; -} - -export interface Point { - lng: number; - lat: number; -} - -export interface Size { - width: number; - height: number; -} - -export interface ContextMenu { - items: ContextMenuItem[]; -} - -export interface ContextMenuItem { - text: string; - callback: Function; - separator: boolean; - width: number; - iconUrl: string; - disabled: boolean; -} - -export interface Icon { - url: string; - size: Size; - opts: IconOptions; -} - -export interface IconOptions { - anchor: ControlAnchor; - imageSize: Size; - imageOffset: Size; - infoWindowAnchor: Size; - printImageUrl: string; -} - -export interface Bounds { - ne: Point; - sw: Point; -} - -export interface RenderOption { - panel: string | HTMLElement; - selectFirstResult: boolean; - autoViewport: boolean; -} - -export interface DrawingOption { - strokeColor: string; - fillColor: string; - strokeWeight: number; - strokeOpacity: number; - fillOpacity: number; - strokeStyle: string; -} - -export interface HeatPoint { - lng: number; - lat: number; - count: number; -} - -export interface Copyright { - content: string; - bounds: Bounds; -} diff --git a/types/base/constants.d.ts b/types/base/constants.d.ts deleted file mode 100644 index 848c159..0000000 --- a/types/base/constants.d.ts +++ /dev/null @@ -1,89 +0,0 @@ -export type MapType = - 'BMAP_NORMAL_MAP' - | 'BMAP_PERSPECTIVE_MAP' - | 'BMAP_SATELLITE_MAP' - | 'BMAP_HYBRID_MAP'; - -export type ControlAnchor = - 'BMAP_ANCHOR_TOP_LEFT' - | 'BMAP_ANCHOR_TOP_RIGHT' - | 'BMAP_ANCHOR_BOTTOM_LEFT' - | 'BMAP_ANCHOR_BOTTOM_RIGHT'; - -export type NavigationType = - 'BMAP_NAVIGATION_CONTROL_LARGE' - | 'BMAP_NAVIGATION_CONTROL_SMALL' - | 'BMAP_NAVIGATION_CONTROL_PAN' - | 'BMAP_NAVIGATION_CONTROL_ZOOM'; - -export type LengthUnit = - 'BMAP_UNIT_METRIC' - | 'BMAP_UNIT_IMPERIAL'; - -export type MapTypeControlType = - 'BMAP_MAPTYPE_CONTROL_HORIZONTAL' - | 'BMAP_MAPTYPE_CONTROL_DROPDOWN' - | 'BMAP_MAPTYPE_CONTROL_MAP'; - -export type SymbolShapeType = - 'BMap_Symbol_SHAPE_CIRCLE' - | 'BMap_Symbol_SHAPE_RECTANGLE' - | 'BMap_Symbol_SHAPE_RHOMBUS' - | 'BMap_Symbol_SHAPE_STAR' - | 'BMap_Symbol_SHAPE_BACKWARD_CLOSED_ARROW' - | 'BMap_Symbol_SHAPE_FORWARD_CLOSED_ARROW' - | 'BMap_Symbol_SHAPE_BACKWARD_OPEN_ARROW' - | 'BMap_Symbol_SHAPE_FORWARD_OPEN_ARROW' - | 'BMap_Symbol_SHAPE_POINT' - | 'BMap_Symbol_SHAPE_PLANE' - | 'BMap_Symbol_SHAPE_CAMERA' - | 'BMap_Symbol_SHAPE_WARNING' - | 'BMap_Symbol_SHAPE_SMILE' - | 'BMap_Symbol_SHAPE_CLOCK'; - -export type ShapeType = - 'BMAP_POINT_SHAPE_CIRCLE' - | 'BMAP_POINT_SHAPE_STAR' - | 'BMAP_POINT_SHAPE_SQUARE' - | 'BMAP_POINT_SHAPE_RHOMBUS' - | 'BMAP_POINT_SHAPE_WATERDROP'; - -export type SizeType = - 'BMAP_POINT_SIZE_TINY' - | 'BMAP_POINT_SIZE_SMALLER' - | 'BMAP_POINT_SIZE_SMALL' - | 'BMAP_POINT_SIZE_NORMAL' - | 'BMAP_POINT_SIZE_BIG' - | 'BMAP_POINT_SIZE_BIGGER' - | 'BMAP_POINT_SIZE_HUGE'; - -export type TransitPolicy = - 'BMAP_TRANSIT_POLICY_RECOMMEND' - | 'BMAP_TRANSIT_POLICY_LEAST_TIME' - | 'BMAP_TRANSIT_POLICY_LEAST_TRANSFER' - | 'BMAP_TRANSIT_POLICY_LEAST_WALKING' - | 'BMAP_TRANSIT_POLICY_AVOID_SUBWAYS' - | 'BMAP_TRANSIT_POLICY_FIRST_SUBWAYS'; - -export type IntercityPolicy = - 'BMAP_INTERCITY_POLICY_LEAST_TIME' - | 'BMAP_INTERCITY_POLICY_EARLY_START' - | 'BMAP_INTERCITY_POLICY_CHEAP_PRICE'; - -export type TransitTypePolicy = - 'BMAP_TRANSIT_TYPE_POLICY_TRAIN' - | 'BMAP_TRANSIT_TYPE_POLICY_AIRPLANE' - | 'BMAP_TRANSIT_TYPE_POLICY_COACH'; - -export type DrivingPolicy = - 'BMAP_DRIVING_POLICY_DEFAULT' - | 'BMAP_DRIVING_POLICY_FIRST_HIGHWAYS' - | 'BMAP_DRIVING_POLICY_AVOID_HIGHWAYS' - | 'BMAP_DRIVING_POLICY_AVOID_CONGESTION'; - -export type DrawingMode = - 'marker' - | 'circle' - | 'polyline' - | 'polygon' - | 'rectangle' diff --git a/types/base/events.d.ts b/types/base/events.d.ts deleted file mode 100644 index 22ae2c5..0000000 --- a/types/base/events.d.ts +++ /dev/null @@ -1,127 +0,0 @@ -export interface MapEvents { - click: Function; - dblclick: Function; - rightclick: Function; - rightdblclick: Function; - maptypechange: Function; - mousemove: Function; - mouseover: Function; - mouseout: Function; - movestart: Function; - moving: Function; - moveend: Function; - zoomstart: Function; - zoomend: Function; - addoverlay: Function; - addcontrol: Function; - removecontrol: Function; - removeoverlay: Function; - clearoverlays: Function; - dragstart: Function; - dragging: Function; - dragend: Function; - addtilelayer: Function; - removetilelayer: Function; - load: Function; - resize: Function; - hotspotclick: Function; - hotspotover: Function; - hotspotout: Function; - tilesloaded: Function; - touchstart: Function; - touchmove: Function; - touchend: Function; - longpress: Function; -} - -export interface GeolocationEvents { - locationSuccess: Function; - locationError: Function; -} - -export interface OverviewMapEvents { - viewchanged: Function; - viewchanging: Function; -} - -export interface LabelEvents { - click: Function; - dblclick: Function; - mousedown: Function; - mouseup: Function; - mouseout: Function; - mouseover: Function; - remove: Function; - rightclick: Function; -} - -export interface InfoWindowEvents { - close: Function; - open: Function; - maximize: Function; - restore: Function; - clickclose: Function; -} - -export interface PolylineEvents { - click: Function; - dblclick: Function; - mousedown: Function; - mouseup: Function; - mouseout: Function; - mouseover: Function; - remove: Function; - lineupdate: Function; -} - -export interface CircleEvents { - click: Function; - dblclick: Function; - mousedown: Function; - mouseup: Function; - mouseout: Function; - mouseover: Function; - remove: Function; - lineupdate: Function; -} - -export interface PolygonEvents { - click: Function; - dblclick: Function; - mousedown: Function; - mouseup: Function; - mouseout: Function; - mouseover: Function; - remove: Function; - lineupdate: Function; -} - -export interface PointCollectionEvents { - click: Function; - mouseover: Function; - mouseout: Function; -} - -export interface GroundEvents { - click: Function; - dbclick: Function; -} - -export interface DrawingManagerEvents { - circlecomplete: Function; - markercomplete: Function; - overlaycomplete: Function; - polygoncomplete: Function; - polylinecomplete: Function; - rectanglecomplete: Function; -} - -export interface DistanceToolEvents { - onaddpoint: Function; - ondrawend: Function; -} - -export interface AutoCompleteEvents { - onconfirm: Function; - onhighlight: Function; -} diff --git a/types/boundary.d.ts b/types/boundary.d.ts deleted file mode 100644 index 42c8eea..0000000 --- a/types/boundary.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { Component } from 'react'; -import { PolygonEvents } from './base/events'; -import { Size, Point } from './base/common'; - -export declare class Boundary extends Component { - /** - * 行政区域名字 - */ - name: string; - /** - * 初始化失败回调 - */ - onError: Function; - /** - * 加完成后是否自动移动 - */ - autoViewport: boolean; - /** - * 边线颜色 - */ - strokeColor: string; - /** - * 填充颜色。当参数为空时,圆形将没有填充效果 - */ - fillColor: string; - /** - * 边线的宽度,以像素为单位 - */ - strokeWeight: number; - /** - * 边线透明度,取值范围0 - 1 - */ - strokeOpacity: number; - /** - * 填充的透明度,取值范围0 - 1 - */ - fillOpacity: number; - /** - * 边线的样式,solid或dashed - */ - strokeStyle: string; - /** - * 是否在调用map.clearOverlays清除此覆盖物 - */ - massClear: boolean; - /** - * 是否启用线编辑 - */ - editing: boolean; - /** - * 是否响应点击事件 - */ - clicking: boolean; - /** - * 绑定事件 - */ - events: PolygonEvents; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/busLineSearch.d.ts b/types/busLineSearch.d.ts deleted file mode 100644 index ae3a174..0000000 --- a/types/busLineSearch.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Component } from 'react'; -import { Point, RenderOption } from './base/common'; - -declare type mapInstance = any; - -export declare class BusLineSearch extends Component { - /** - * 表示检索区域,类型可为地图实例、坐标点或城市名称的字符串。 - */ - location: mapInstance | string | Point; - /** - * 搜索结果呈现的配置 - */ - renderOptions: RenderOption; - /** - * 设置公交列表查询后的回调函数 - */ - onGetBusListComplete: Function; - /** - * 设置公交线路查询后的回调函数 - */ - onGetBusLineComplete: Function; - /** - * 公交列表结果页渲染后回调函数 - */ - onBusListHtmlSet: Function; - /** - * 公交线路结果页渲染后回调函数 - */ - onBusLineHtmlSet: Function; - /** - * 添加公交线时候回调函数 - */ - onPolylinesSet: Function; - /** - * 添加公交站点时候回调函数 - */ - onMarkersSet: Function; - /** - * 是否将查询结果渲染至地图中 - */ - showInMap: boolean; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/circle.d.ts b/types/circle.d.ts deleted file mode 100644 index fc369b7..0000000 --- a/types/circle.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Component } from 'react'; -import { CircleEvents } from './base/events'; -import { Size, Point } from './base/common'; - -export declare class Circle extends Component { - /** - * 指定位置的坐标 - */ - points: Point[]; - /** - * 圆角大小 - */ - radius: number; - /** - * 圆形边线颜色 - */ - strokeColor: string; - /** - * 圆形填充颜色。当参数为空时,圆形将没有填充效果 - */ - fillColor: string; - /** - * 圆形边线的宽度,以像素为单位 - */ - strokeWeight: number; - /** - * 圆形边线透明度,取值范围0 - 1 - */ - strokeOpacity: number; - /** - * 圆形填充的透明度,取值范围0 - 1 - */ - fillOpacity: number; - /** - * 圆形边线的样式,solid或dashed - */ - strokeStyle: string; - /** - * 是否在调用map.clearOverlays清除此覆盖物 - */ - massClear: boolean; - /** - * 是否启用线编辑 - */ - editing: boolean; - /** - * 是否响应点击事件 - */ - clicking: boolean; - /** - * 绑定事件 - */ - events: CircleEvents; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/cityList.d.ts b/types/cityList.d.ts deleted file mode 100644 index d656bb8..0000000 --- a/types/cityList.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Component } from 'react'; -import { ControlAnchor } from "./base/constants"; -import { Size } from './base/common'; - -export declare class CityList extends Component { - /** - * 控件的停靠位置 - */ - anchor: ControlAnchor; - /** - * 控件的水平偏移值 - */ - offset: Size; - /** - * 切换城市之前回调函数 - */ - onChangeBefore: Function; - /** - * 切换城市之后回调函数 - */ - onChangeAfter: Function; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/copyright.d.ts b/types/copyright.d.ts deleted file mode 100644 index 6201180..0000000 --- a/types/copyright.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Component } from 'react'; -import { ControlAnchor } from "./base/constants"; -import { Size } from './base/common'; - -export declare class CopyRight extends Component { - /** - * 控件的停靠位置 - */ - anchor: ControlAnchor; - /** - * 控件的水平偏移值 - */ - offset: Size; - /** - * 该版权的文本信息,支持HTML内容 - */ - content: string | HTMLElement; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/curveLine.d.ts b/types/curveLine.d.ts deleted file mode 100644 index ea844c5..0000000 --- a/types/curveLine.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Component } from 'react'; -import { PolylineEvents } from './base/events'; -import { Size, Point } from './base/common'; - -export declare class CurveLine extends Component { - /** - * 抛物线数据对象 - */ - points: Point[]; - /** - * 折线颜色 - */ - strokeColor: string; - /** - * 折线的宽度,以像素为单位 - */ - strokeWeight: number; - /** - * 折线的透明度,取值范围0 - 1 - */ - strokeOpacity: number; - /** - * 折线的样式,solid或dashed - */ - strokeStyle: string; - /** - * 是否在调用map.clearOverlays清除此覆盖物 - */ - massClear: boolean; - /** - * 是否启用线编辑 - */ - editing: boolean; - /** - * 是否响应点击事件 - */ - clicking: boolean; - /** - * 绑定事件 - */ - events: PolylineEvents; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/distanceTool.d.ts b/types/distanceTool.d.ts deleted file mode 100644 index 43121d8..0000000 --- a/types/distanceTool.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Component } from 'react'; -import { ControlAnchor } from "./base/constants"; -import { DistanceToolEvents } from './base/events'; - -export declare class DistanceTool extends Component { - /** - * 测距过程中,提示框文字 - */ - followText: string; - /** - * 测距结果所用的单位制,"metric"表示米制,"us"表示美国传统单位 - */ - unit: string; - /** - * 折线颜色 - */ - lineColor: string; - /** - * 折线线宽 - */ - lineStroke: number; - /** - * 折线透明度 - */ - opacity: number; - /** - * 折线颜色 - */ - lineStyle: string; - /** - * 跟随的鼠标样式 - */ - cursor: string; - /** - * 绑定事件 - */ - events: DistanceToolEvents; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/drawingManager.d.ts b/types/drawingManager.d.ts deleted file mode 100644 index b12272b..0000000 --- a/types/drawingManager.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Component } from 'react'; -import { DrawingManagerEvents } from './base/events'; -import { Size, DrawingOption } from './base/common'; -import { ControlAnchor, DrawingMode } from './base/constants'; - -export declare class DrawingManager extends Component { - /** - * 抛物线数据对象 - */ - anchor: ControlAnchor; - /** - * 标注的位置偏移值 - */ - offset: Size; - /** - * 所画圆可选参数 - */ - circleOptions: DrawingOption; - /** - * 所画的线的可选参数 - */ - polylineOptions: DrawingOption; - /** - * 所画的多边形的可选参数 - */ - rectangleOptions: DrawingOption; - /** - * 所画的点的可选参数 - */ - markerOptions: DrawingOption; - /** - * 是否启用线编辑 - */ - drawingModes: DrawingMode[]; - /** - * 绑定事件 - */ - events: DrawingManagerEvents; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/drivingRoute.d.ts b/types/drivingRoute.d.ts deleted file mode 100644 index efd7dab..0000000 --- a/types/drivingRoute.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Component } from 'react'; -import { Point, RenderOption } from './base/common'; -import { DrivingPolicy } from './base/constants'; - -declare type mapInstance = any; - -export declare class DrivingRoute extends Component { - /** - * 表示检索区域,类型可为地图实例、坐标点或城市名称的字符串。 - */ - location: mapInstance | string | Point; - /** - * 搜索结果呈现的配置 - */ - renderOptions: RenderOption; - /** - * 市内公交的策略参数 - */ - policy: DrivingPolicy; - /** - * 检索完成后的回调函数 - */ - onSearchComplete: Function; - /** - * 标注添加完成后的回调函数 - */ - onMarkersSet: Function; - /** - * 气泡内容创建后的回调函数 - */ - onInfoHtmlSet: Function; - /** - * 折线添加完成后的回调函数 - */ - onPolylinesSet: Function; - /** - * 结果列表添加完成后的回调函数 - */ - onResultsHtmlSet: Function; - /** - * 是否将查询结果渲染至地图中 - */ - showInMap: boolean; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/geolocation.d.ts b/types/geolocation.d.ts deleted file mode 100644 index 6178b77..0000000 --- a/types/geolocation.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Component } from 'react'; -import { GeolocationEvents } from './base/events'; -import { ControlAnchor } from "./base/constants"; -import { Icon, Size } from './base/common'; - -export declare class Geolocation extends Component { - /** - * 控件的停靠位置 - */ - anchor: ControlAnchor; - /** - * 控件的水平偏移值 - */ - offset: Size; - /** - * 是否显示定位信息面板 - */ - showAddressBar: boolean; - /** - * 添加控件时是否进行定位 - */ - autoLocation: boolean; - /** - * 设置icon - */ - locationIcon: Icon; - /** - * 绑定事件 - */ - events: GeolocationEvents; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/ground.d.ts b/types/ground.d.ts deleted file mode 100644 index 3aa4d40..0000000 --- a/types/ground.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Component } from 'react'; -import { GroundEvents } from './base/events'; -import { Bounds } from './base/common'; - -export declare class Ground extends Component { - /** - * 设置图层显示的矩形区域 - */ - bounds: Bounds; - /** - * 图层地址 - */ - imageURL: string; - /** - * 图层透明度 - */ - opacity: number; - /** - * 图层显示的最大级别 - */ - maxZoom: number; - /** - * 图层显示的最小级别 - */ - minZoom: number; - /** - * 绑定事件 - */ - events: GroundEvents; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/heatmap.d.ts b/types/heatmap.d.ts deleted file mode 100644 index d94e212..0000000 --- a/types/heatmap.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Component } from 'react'; -import { CircleEvents } from './base/events'; -import { Size, HeatPoint } from './base/common'; - -export declare class Heatmap extends Component { - /** - * 热力图集合点 - */ - points: HeatPoint[]; - /** - * 热力图圆半径 - */ - radius: number; - /** - * 透明度 - */ - opacity: number; - /** - * 权重最大值 - */ - max: number; - /** - * 热力图渐变区间 - */ - gradient: any; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/index.d.ts b/types/index.d.ts deleted file mode 100644 index 397a637..0000000 --- a/types/index.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -export { Map } from './map'; -export { Navigation } from './navigation'; -export { Geolocation } from './geolocation'; -export { OverviewMap } from './overviewMap'; -export { Scale } from './scale'; -export { CopyRight } from './copyright'; -export { MapTypeCtrl } from './mapTypeCtrl'; -export { Panorama } from './panorama'; -export { CityList } from './cityList'; -export { Marker } from './marker'; -export { Symbol } from './symbol'; -export { Label } from './label'; -export { InfoWindow } from './infoWindow'; -export { Polyline } from './polyline'; -export { Circle } from './circle'; -export { Polygon } from './polygon'; -export { Boundary } from './boundary'; -export { PointCollection } from './pointCollection'; -export { Ground } from './ground'; -export { TransitRoute } from './transitRoute'; -export { DrivingRoute } from './drivingRoute'; -export { RidingRoute } from './ridingRoute'; -export { WalkingRoute } from './walkingRoute'; -export { LocalSearch } from './localSearch'; -export { BusLineSearch } from './busLineSearch'; -export { MarkerClusterer } from './markerClusterer'; -export { CurveLine } from './curveLine'; -export { DrawingManager } from './drawingManager'; -export { Heatmap } from './heatmap'; -export { TrafficControl } from './trafficControl'; -export { DistanceTool } from './distanceTool'; -export { AutoComplete } from './autoComplete'; -export { Tile } from './tile'; - -export interface MapType{} -export interface ControlAnchor{} -export interface LengthUnit{} -export interface MapPane{} -export interface MapTypeControlType{} -export interface StatusCode{} -export interface Animation{} -export interface ShapeType{} -export interface SizeType{} -export interface SymbolShapeType{} -export interface ContextMenuIcon{} -export interface TransitPolicy{} -export interface TransitTypePolicy{} -export interface IntercityPolicy{} -export interface DrivingPolicy{} -export interface DrawingMode{} -export class Control{} -export class Overlay{} -export class ReactComponent{} - -export declare function getMapBounds(): any; -export declare function getBounds(): any; -export declare function getPoiByKeyword(): any; -export declare function convertPoint(): any; \ No newline at end of file diff --git a/types/infoWindow.d.ts b/types/infoWindow.d.ts deleted file mode 100644 index c5fa884..0000000 --- a/types/infoWindow.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Component } from 'react'; -import { Size, Point } from './base/common'; -import { InfoWindowEvents } from './base/events'; - -export declare class InfoWindow extends Component { - /** - * 信息窗标题文字,支持HTML内容 - */ - title: string; - /** - * 信息窗显示文字,支持HTML内容 - */ - content: string; - /** - * 显示位置坐标 - */ - point: Point; - /** - * 信息窗位置偏移值 - */ - offset: Size; - /** - * 信息窗宽度,单位像素。取值范围:0, 220 - 730。如果您指定宽度为0,则信息窗口的宽度将按照其内容自动调整 - */ - width: number; - /** - * 信息窗高度,单位像素。取值范围:0, 60 - 650。如果您指定高度为0,则信息窗口的高度将按照其内容自动调整 - */ - height: number; - /** - * 信息窗最大化时的宽度,单位像素。取值范围:220 - 730 - */ - maxWidth: number; - /** - * 是否开启信息窗口打开时地图自动移动 - */ - autoPan: boolean; - /** - * 是否开启点击地图关闭信息窗口 - */ - closeOnClick: boolean; - /** - * 是否在信息窗里显示短信发送按钮 - */ - displayMessage: boolean; - /** - * 自定义部分的短信内容 - */ - message: string; - /** - * 绑定事件 - */ - events: InfoWindowEvents; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/label.d.ts b/types/label.d.ts deleted file mode 100644 index 74d5f2c..0000000 --- a/types/label.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Component } from 'react'; -import { LabelEvents } from './base/events'; -import { Size, Point } from './base/common'; - -export declare class Label extends Component { - /** - * 位置偏移值 - */ - offset: Size; - /** - * 文本标注的位置 - */ - point: Point; - /** - * 是否在调用map.clearOverlays清除此覆盖物 - */ - massClear: boolean; - /** - * 显示标签 - */ - content: string; - /** - * 鼠标悬浮显示文字 - */ - title: string; - /** - * 同html的z-index - */ - zIndex: number; - /** - * 标签样式 - */ - style: any; - /** - * 绑定事件 - */ - events: LabelEvents; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/localSearch.d.ts b/types/localSearch.d.ts deleted file mode 100644 index 8c155d8..0000000 --- a/types/localSearch.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Component } from 'react'; -import { Point, RenderOption } from './base/common'; - -declare type mapInstance = any; - -export declare class LocalSearch extends Component { - /** - * 表示检索区域,类型可为地图实例、坐标点或城市名称的字符串。 - */ - location: mapInstance | string | Point; - /** - * 搜索结果呈现的配置 - */ - renderOptions: RenderOption; - /** - * 检索完成后的回调函数 - */ - onSearchComplete: Function; - /** - * 标注添加完成后的回调函数 - */ - onMarkersSet: Function; - /** - * 气泡内容创建后的回调函数 - */ - onInfoHtmlSet: Function; - /** - * 设置每页容量,取值范围:1 - 100 - */ - pageCapacity: number; - /** - * 结果列表添加完成后的回调函数 - */ - onResultsHtmlSet: Function; - /** - * 是否将查询结果渲染至地图中 - */ - showInMap: boolean; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/map.d.ts b/types/map.d.ts deleted file mode 100644 index 4e2850f..0000000 --- a/types/map.d.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { Component } from 'react'; -import { MapType } from './base/constants'; -import { MapEvents } from './base/events'; -import { MapStyle, Point, ContextMenu } from './base/common'; - -export declare class Map extends Component { - /** - * 加载地图时所需ak,百度地图开放平台中申请 - */ - ak: string - /** - * 地图未渲染时占位 - */ - placeHolder: string | any - /** - * 地图渲染完成后回调函数 - */ - mapMounted: Function - /** - * 地图允许的最小级别,取值不得小于地图类型所允许的最小级别 - */ - minZoom: number - /** - * 地图允许的最大级别。取值不得大于地图类型所允许的最大级别 - */ - maxZoom: number - /** - * 设置地图默认的鼠标指针样式。参数cursor应符合CSS的cursor属性规范 - */ - defaultCursor: string - /** - * 设置拖拽地图时的鼠标指针样式。参数cursor应符合CSS的cursor属性规范 - */ - draggingCursor: string - /** - * 设置地图样式,样式包括地图底图颜色和地图要素是否展示两部分 - */ - mapStyle: MapStyle - /** - * 设地图中心点 - */ - center: Point - /** - * 设置地图类型,从MapType中取值 - */ - mapType: MapType - /** - * 将视图切换到指定的缩放等级,中心点坐标不变 - */ - zoom: number - /** - * 是否启用使用高分辨率地图 - */ - highResolution: boolean - /** - * 是否自动适应地图容器变化 - */ - autoResize: boolean - /** - * 是否开启底图可点功能 - */ - mapClick: boolean - /** - * 是否启用地图拖拽 - */ - dragging: boolean - /** - * 是否启用滚轮放大缩小 - */ - scrollWheelZoom: boolean - /** - * 是否启用双击放大 - */ - doubleClickZoom: boolean - /** - * 是否启用键盘操作 - */ - keyboard: boolean - /** - * 是否启用地图惯性拖拽 - */ - inertialDragging: boolean - /** - * 是否启用连续缩放效果 - */ - continuousZoom: boolean - /** - * 是否启用双指操作缩放 - */ - pinchToZoom: boolean - /** - * 为地图绑定事件 - */ - events: MapEvents - /** - * 右键菜单 - */ - contextMenu: ContextMenu - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/mapTypeCtrl.d.ts b/types/mapTypeCtrl.d.ts deleted file mode 100644 index 5c9462c..0000000 --- a/types/mapTypeCtrl.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Component } from 'react'; -import { ControlAnchor, MapTypeControlType, MapType } from "./base/constants"; -import { Size } from './base/common'; - -export declare class MapTypeCtrl extends Component { - /** - * 控件的停靠位置 - */ - anchor: ControlAnchor; - /** - * 控件的水平偏移值 - */ - offset: Size; - /** - * 控件样式 - */ - type: MapTypeControlType; - /** - * 控件展示的地图类型 - */ - mapTypes: MapType[]; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/marker.d.ts b/types/marker.d.ts deleted file mode 100644 index a4e27e0..0000000 --- a/types/marker.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Component } from 'react'; -import { Size, Icon, ContextMenu, Point } from './base/common'; - -export declare class Marker extends Component { - /** - * 控件的水平偏移值 - */ - offset: Size; - /** - * 控件显示经纬度 - */ - point: Point; - /** - * 标注所用的图标对象 - */ - icon: Icon; - /** - * 是否在调用map.clearOverlays清除此覆盖物 - */ - massClear: boolean; - /** - * 是否启用拖拽 - */ - dragging: boolean; - /** - * 是否响应点击事件 - */ - clicking: boolean; - /** - * 拖拽标注时,标注是否开启离开地图表面效果 - */ - raiseOnDrag: boolean; - /** - * 拖拽标注时的鼠标指针样式 - */ - draggingCursor: string; - /** - * 旋转角度 - */ - rotation: number; - /** - * 阴影图标 - */ - shadow: Icon; - /** - * 鼠标移到marker上的显示内容 - */ - title: string; - /** - * 右键菜单 - */ - contextMenu: ContextMenu; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/markerClusterer.d.ts b/types/markerClusterer.d.ts deleted file mode 100644 index 91a2898..0000000 --- a/types/markerClusterer.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Component } from 'react'; -import { Size } from './base/common'; - -export declare class MarkerClusterer extends Component { - /** - * 网格大小 - */ - gridSize: number; - /** - * 聚合的最大缩放级别 - */ - maxZoom: number; - /** - * 单个聚合的最小数量 - */ - minClusterSize: number; - /** - * 聚合样式的风格集合 - */ - styles: any; - /** - * 单个聚合的落脚点是否是聚合内所有标记的平均中心 - */ - averageCenter: boolean; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/navigation.d.ts b/types/navigation.d.ts deleted file mode 100644 index 4a557e4..0000000 --- a/types/navigation.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Component } from 'react'; -import { ControlAnchor, NavigationType } from "./base/constants"; -import { Size } from './base/common'; - -export declare class Navigation extends Component { - /** - * 控件的停靠位置 - */ - anchor: ControlAnchor; - /** - * 控件的水平偏移值 - */ - offset: Size; - /** - * 平移缩放控件的类型 - */ - type: NavigationType - /** - * 是否显示级别提示信息 - */ - showZoomInfo: boolean - /** - * 控件是否集成定位功能 - */ - geolocation: boolean - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/overviewMap.d.ts b/types/overviewMap.d.ts deleted file mode 100644 index 3a8bd93..0000000 --- a/types/overviewMap.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Component } from 'react'; -import { OverviewMapEvents } from './base/events'; -import { ControlAnchor } from "./base/constants"; -import { Size } from './base/common'; - -export declare class OverviewMap extends Component { - /** - * 控件的停靠位置 - */ - anchor: ControlAnchor; - /** - * 控件的水平偏移值 - */ - offset: Size; - /** - * 缩略地图控件的大小 - */ - size: Size; - /** - * 缩略地图添加到地图后的开合状态 - */ - isOpen: boolean - /** - * 绑定事件 - */ - events: OverviewMapEvents - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/panorama.d.ts b/types/panorama.d.ts deleted file mode 100644 index da66658..0000000 --- a/types/panorama.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Component } from 'react'; -import { ControlAnchor } from "./base/constants"; -import { Size } from './base/common'; - -export declare class Panorama extends Component { - /** - * 控件的停靠位置 - */ - anchor: ControlAnchor; - /** - * 控件的水平偏移值 - */ - offset: Size; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/pointCollection.d.ts b/types/pointCollection.d.ts deleted file mode 100644 index 0fb968f..0000000 --- a/types/pointCollection.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Component } from 'react'; -import { PointCollectionEvents } from './base/events'; -import { Point } from './base/common'; -import { ShapeType, SizeType } from './base/constants'; - -export declare class PointCollection extends Component { - /** - * 点集合 - */ - points: Point[]; - /** - * 海量点的预设形状 - */ - shape: ShapeType; - /** - * 海量点的预设尺寸 - */ - size: SizeType; - /** - * 海量点的颜色 - */ - color: string; - /** - * 绑定事件 - */ - events: PointCollectionEvents; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/polygon.d.ts b/types/polygon.d.ts deleted file mode 100644 index 3c41a0d..0000000 --- a/types/polygon.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Component } from 'react'; -import { PolygonEvents } from './base/events'; -import { Size, Point } from './base/common'; - -export declare class Polygon extends Component { - /** - * 指定位置的坐标 - */ - points: Point[]; - /** - * 边线颜色 - */ - strokeColor: string; - /** - * 填充颜色。当参数为空时,圆形将没有填充效果 - */ - fillColor: string; - /** - * 边线的宽度,以像素为单位 - */ - strokeWeight: number; - /** - * 边线透明度,取值范围0 - 1 - */ - strokeOpacity: number; - /** - * 填充的透明度,取值范围0 - 1 - */ - fillOpacity: number; - /** - * 边线的样式,solid或dashed - */ - strokeStyle: string; - /** - * 是否在调用map.clearOverlays清除此覆盖物 - */ - massClear: boolean; - /** - * 是否启用线编辑 - */ - editing: boolean; - /** - * 是否响应点击事件 - */ - clicking: boolean; - /** - * 绑定事件 - */ - events: PolygonEvents; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/polyline.d.ts b/types/polyline.d.ts deleted file mode 100644 index 80ed656..0000000 --- a/types/polyline.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { Component } from 'react'; -import { PolylineEvents } from './base/events'; -import { Size, Point } from './base/common'; - -export declare class Polyline extends Component { - /** - * 指定位置的坐标 - */ - points: Point[]; - /** - * 折线颜色 - */ - strokeColor: string; - /** - * 折线的宽度,以像素为单位 - */ - strokeWeight: number; - /** - * 折线的透明度,取值范围0 - 1 - */ - strokeOpacity: number; - /** - * 折线的样式,solid或dashed - */ - strokeStyle: string; - /** - * 是否在调用map.clearOverlays清除此覆盖物 - */ - massClear: boolean; - /** - * 是否启用线编辑 - */ - editing: boolean; - /** - * 是否响应点击事件 - */ - clicking: boolean; - /** - * 绑定事件 - */ - events: PolylineEvents; - /** - * 获取当前实例 - */ - getInstance: Function; - /** - * 方向纹理 - */ - icons: Array; -} diff --git a/types/ridingRoute.d.ts b/types/ridingRoute.d.ts deleted file mode 100644 index fb45f58..0000000 --- a/types/ridingRoute.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Component } from 'react'; -import { Point, RenderOption } from './base/common'; - -declare type mapInstance = any; - -export declare class RidingRoute extends Component { - /** - * 表示检索区域,类型可为地图实例、坐标点或城市名称的字符串。 - */ - location: mapInstance | string | Point; - /** - * 搜索结果呈现的配置 - */ - renderOptions: RenderOption; - /** - * 检索完成后的回调函数 - */ - onSearchComplete: Function; - /** - * 标注添加完成后的回调函数 - */ - onMarkersSet: Function; - /** - * 气泡内容创建后的回调函数 - */ - onInfoHtmlSet: Function; - /** - * 折线添加完成后的回调函数 - */ - onPolylinesSet: Function; - /** - * 结果列表添加完成后的回调函数 - */ - onResultsHtmlSet: Function; - /** - * 是否将查询结果渲染至地图中 - */ - showInMap: boolean; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/scale.d.ts b/types/scale.d.ts deleted file mode 100644 index c1f34fc..0000000 --- a/types/scale.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Component } from 'react'; -import { ControlAnchor, LengthUnit } from "./base/constants"; -import { Size } from './base/common'; - -export declare class Scale extends Component { - /** - * 控件的停靠位置 - */ - anchor: ControlAnchor; - /** - * 控件的水平偏移值 - */ - offset: Size; - /** - * 显示单位 - */ - unit: LengthUnit; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/symbol.d.ts b/types/symbol.d.ts deleted file mode 100644 index 6e6c651..0000000 --- a/types/symbol.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { SymbolShapeType } from "./base/constants"; -import { Size } from './base/common'; -import { Marker } from "./marker"; - -export declare class Symbol extends Marker { - /** - * 符号的位置偏移值 - */ - path: string | SymbolShapeType; - /** - * 符号的位置偏移值 - */ - anchor: Size; - /** - * 设置矢量图标的填充颜色 - */ - fillColor: string; - /** - * 设置矢量图标填充透明度,范围0~1 - */ - fillOpacity: number; - /** - * 设置矢量图标的缩放比例 - */ - scale: number; - /** - * 设置矢量图标的旋转角度,参数为角度 - */ - rotation: number; - /** - * 设置矢量图标的线填充颜色,支持颜色常量字符串、十六进制、RGB、RGBA等格式 - */ - strokeColor: string; - /** - * 设置矢量图标线的透明度,opacity范围0~1 - */ - strokeOpacity: number; - /** - * 旋设置线宽。如果此属性没有指定,则线宽跟scale数值相同 - */ - strokeWeight: number; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/tile.d.ts b/types/tile.d.ts deleted file mode 100644 index 0f15fc8..0000000 --- a/types/tile.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Component } from 'react'; -import { Copyright } from './base/common'; - -export declare class Tile extends Component { - /** - * 是否使用了带有透明信息的PNG。 - */ - transparentPng: boolean; - /** - * 指定图块网址模板,该模板可以针对每个图块请求而展开 - */ - tileUrlTemplate: string; - /** - * 地图图层的版权信息 - */ - copyright: Copyright; - /** - * 图层的 zIndex - */ - zIndex: number; - /** - * 向地图返回地图图块的网址,图块索引由 tileCoord 的 x 和 y 属性在指定的缩放级别 zoom 提供。如果您在 TileLayerOptions 中提供了 tileUrlTemplate 参数,则可不实现此接口 - */ - getTilesUrl: string; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/trafficControl.d.ts b/types/trafficControl.d.ts deleted file mode 100644 index 942b672..0000000 --- a/types/trafficControl.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Component } from 'react'; -import { ControlAnchor } from "./base/constants"; - -export declare class TrafficControl extends Component { - /** - * 控件的停靠位置 - */ - anchor: ControlAnchor; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/transitRoute.d.ts b/types/transitRoute.d.ts deleted file mode 100644 index 2642765..0000000 --- a/types/transitRoute.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { Component } from 'react'; -import { Point, RenderOption } from './base/common'; -import { TransitPolicy, IntercityPolicy, TransitTypePolicy } from './base/constants'; - -declare type mapInstance = any; - -export declare class TransitRoute extends Component { - /** - * 表示检索区域,类型可为地图实例、坐标点或城市名称的字符串。 - */ - location: mapInstance | string | Point; - /** - * 搜索结果呈现的配置 - */ - renderOptions: RenderOption; - /** - * 市内公交的策略参数 - */ - policy: TransitPolicy; - /** - * 跨城公交的换乘策略参数 - */ - intercityPolicy: IntercityPolicy; - /** - * 跨城公交的交通方式策略参数 - */ - transitTypePolicy: TransitTypePolicy; - /** - * 返回方案的个数 - */ - pageCapacity: number; - /** - * 检索完成后的回调函数 - */ - onSearchComplete: Function; - /** - * 标注添加完成后的回调函数 - */ - onMarkersSet: Function; - /** - * 气泡内容创建后的回调函数 - */ - onInfoHtmlSet: Function; - /** - * 折线添加完成后的回调函数 - */ - onPolylinesSet: Function; - /** - * 结果列表添加完成后的回调函数 - */ - onResultsHtmlSet: Function; - /** - * 是否将查询结果渲染至地图中 - */ - showInMap: boolean; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/types/tsconfig.json b/types/tsconfig.json deleted file mode 100644 index 7012f2d..0000000 --- a/types/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "compilerOptions": { - "lib": [ - "es5", - "dom", - ], - "strict": true, - }, - "include": [ - "*.ts" - ] -} \ No newline at end of file diff --git a/types/typings.json b/types/typings.json deleted file mode 100644 index f5483cc..0000000 --- a/types/typings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "rc-bmap", - "main": "index.d.ts" -} \ No newline at end of file diff --git a/types/walkingRoute.d.ts b/types/walkingRoute.d.ts deleted file mode 100644 index a7195b4..0000000 --- a/types/walkingRoute.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Component } from 'react'; -import { Point, RenderOption } from './base/common'; - -declare type mapInstance = any; - -export declare class WalkingRoute extends Component { - /** - * 表示检索区域,类型可为地图实例、坐标点或城市名称的字符串。 - */ - location: mapInstance | string | Point; - /** - * 搜索结果呈现的配置 - */ - renderOptions: RenderOption; - /** - * 检索完成后的回调函数 - */ - onSearchComplete: Function; - /** - * 标注添加完成后的回调函数 - */ - onMarkersSet: Function; - /** - * 气泡内容创建后的回调函数 - */ - onInfoHtmlSet: Function; - /** - * 折线添加完成后的回调函数 - */ - onPolylinesSet: Function; - /** - * 结果列表添加完成后的回调函数 - */ - onResultsHtmlSet: Function; - /** - * 是否将查询结果渲染至地图中 - */ - showInMap: boolean; - /** - * 获取当前实例 - */ - getInstance: Function; -} diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index c2b48e3..0000000 --- a/webpack.config.js +++ /dev/null @@ -1,54 +0,0 @@ -const path = require('path'); -const webpack = require('webpack'); - -module.exports = { - entry: { - 'rc-bmap': path.join(__dirname, 'src/index.js'), - }, - externals: [ - { - react: { - amd: 'react', - commonjs: 'react', - commonjs2: 'react', - root: 'React', - }, - }, - { - 'react-dom': { - amd: 'react-dom', - commonjs: 'react-dom', - commonjs2: 'react-dom', - root: 'ReactDOM', - }, - }, - ], - output: { - filename: '[name].min.js', - library: 'rc-bmap', - libraryTarget: 'umd', - path: path.resolve(__dirname, 'dist'), - }, - module: { - rules: [{ - test: /\.js|\.jsx$/, - exclude: /(node_modules)/, - loader: 'babel-loader', - options: { - presets: ['es2015', 'react', 'stage-0'], - plugins: ['transform-decorators-legacy'], - }, - }], - }, - plugins: [ - new webpack.DefinePlugin({ - 'process.env.NODE_ENV': JSON.stringify('production'), - }), - new webpack.optimize.UglifyJsPlugin({ - compress: { - dead_code: true, - warnings: false, - }, - }), - ], -}; diff --git a/yarn.lock b/yarn.lock index 9eb3cca..ac3a4ff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1107,10 +1107,22 @@ bmaplib.markerclusterer@^1.0.13: dependencies: bmaplib.texticonoverlay "^1.0.2" +bmaplib.new-distancetool@^1.0.0: + version "1.0.0" + resolved "http://registry.npm.taobao.org/bmaplib.new-distancetool/download/bmaplib.new-distancetool-1.0.0.tgz#ad146d843d1dad0a210d762f115c23fc71a3a5d0" + +bmaplib.new-drawingmanager@^1.0.0: + version "1.0.0" + resolved "http://registry.npm.taobao.org/bmaplib.new-drawingmanager/download/bmaplib.new-drawingmanager-1.0.0.tgz#fb9022ec0df24269c2a86f08525376e6a162e0ef" + bmaplib.texticonoverlay@^1.0.2: version "1.0.2" resolved "http://registry.npm.taobao.org/bmaplib.texticonoverlay/download/bmaplib.texticonoverlay-1.0.2.tgz#d78546ea0f036d9fe964983796315b6c112a05bf" +bmaplib.trafficcontrol@^1.0.0: + version "1.0.0" + resolved "http://registry.npm.taobao.org/bmaplib.trafficcontrol/download/bmaplib.trafficcontrol-1.0.0.tgz#bf4eaa93600e74eef1d5cabc935c92295fe4ef74" + bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: version "4.11.8" resolved "http://registry.npm.taobao.org/bn.js/download/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" @@ -1458,14 +1470,10 @@ color-name@1.1.1: version "1.1.1" resolved "http://registry.npm.taobao.org/color-name/download/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689" -commander@^2.11.0: +commander@^2.11.0, commander@^2.14.1, commander@^2.9.0: version "2.17.1" resolved "http://registry.npm.taobao.org/commander/download/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" -commander@^2.14.1, commander@^2.9.0: - version "2.17.1" - resolved "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" - commondir@^1.0.1: version "1.0.1" resolved "http://registry.npm.taobao.org/commondir/download/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -3368,6 +3376,10 @@ lodash.debounce@^4.0.8: version "4.0.8" resolved "http://registry.npm.taobao.org/lodash.debounce/download/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "http://registry.npm.taobao.org/lodash.isequal/download/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + lodash@^4.17.10, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.3.0: version "4.17.10" resolved "http://registry.npm.taobao.org/lodash/download/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"