pass_b_map_vue2 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/.eslintrc.js +22 -0
  2. package/.github/ISSUE_TEMPLATE.md +7 -0
  3. package/.travis.yml +26 -0
  4. package/CONTRIBUTING.md +27 -0
  5. package/LICENSE +21 -0
  6. package/README.md +52 -0
  7. package/build/compiler.js +127 -0
  8. package/build/webpack.docs.config.js +86 -0
  9. package/build/webpack.prod.config.js +24 -0
  10. package/build/webpack.test.config.js +27 -0
  11. package/components/base/bindEvent.js +11 -0
  12. package/components/base/events.js +120 -0
  13. package/components/base/factory.js +39 -0
  14. package/components/base/mixins/abstract.js +13 -0
  15. package/components/base/mixins/common.js +81 -0
  16. package/components/base/util.js +6 -0
  17. package/components/context-menu/Item.vue +62 -0
  18. package/components/context-menu/Menu.vue +52 -0
  19. package/components/controls/CityList.vue +43 -0
  20. package/components/controls/Control.vue +37 -0
  21. package/components/controls/Copyright.vue +52 -0
  22. package/components/controls/Geolocation.vue +59 -0
  23. package/components/controls/MapType.vue +39 -0
  24. package/components/controls/Navigation.vue +55 -0
  25. package/components/controls/OverviewMap.vue +56 -0
  26. package/components/controls/Panorama.vue +29 -0
  27. package/components/controls/Scale.vue +36 -0
  28. package/components/extra/CurveLine.vue +101 -0
  29. package/components/extra/Heatmap.vue +78 -0
  30. package/components/extra/Lushu.vue +125 -0
  31. package/components/extra/MarkerClusterer.vue +93 -0
  32. package/components/index.js +98 -0
  33. package/components/layers/Tile.vue +53 -0
  34. package/components/layers/Traffic.vue +34 -0
  35. package/components/map/Map.vue +287 -0
  36. package/components/map/MapView.vue +9 -0
  37. package/components/others/AutoComplete.vue +70 -0
  38. package/components/others/Boundary.vue +60 -0
  39. package/components/overlays/Circle.vue +170 -0
  40. package/components/overlays/Ground.vue +65 -0
  41. package/components/overlays/Icon.vue +0 -0
  42. package/components/overlays/InfoWindow.vue +137 -0
  43. package/components/overlays/Label.vue +99 -0
  44. package/components/overlays/Marker.vue +163 -0
  45. package/components/overlays/Overlay.vue +55 -0
  46. package/components/overlays/PointCollection.vue +76 -0
  47. package/components/overlays/Polygon.vue +105 -0
  48. package/components/overlays/Polyline.vue +86 -0
  49. package/components/overlays/Symblo.vue +0 -0
  50. package/components/search/Bus.vue +102 -0
  51. package/components/search/Driving.vue +177 -0
  52. package/components/search/LocalSearch.vue +152 -0
  53. package/components/search/Transit.vue +126 -0
  54. package/components/search/Walking.vue +115 -0
  55. package/index.d.ts +3 -0
  56. package/index.js +1 -0
  57. package/karma.conf.js +44 -0
  58. package/package.json +69 -0
  59. package/test/map.js +37 -0
  60. package/test/util/BMap.mock/Map.js +82 -0
  61. package/test/util/BMap.mock/create-class.js +9 -0
  62. package/test/util/BMap.mock/index.js +5 -0
  63. package/test/util/BMap.mock/spy.js +2 -0
  64. package/test/util/util.js +12 -0
  65. package/types/auto-complete.d.ts +21 -0
  66. package/types/base/base-control.d.ts +12 -0
  67. package/types/base/common.d.ts +127 -0
  68. package/types/boundary.d.ts +40 -0
  69. package/types/bus.d.ts +27 -0
  70. package/types/circle.d.ts +46 -0
  71. package/types/city-list.d.ts +3 -0
  72. package/types/control.d.ts +3 -0
  73. package/types/copyright.d.ts +7 -0
  74. package/types/curve-line.d.ts +36 -0
  75. package/types/driving.d.ts +47 -0
  76. package/types/geolocation.d.ts +18 -0
  77. package/types/ground.d.ts +24 -0
  78. package/types/heatmap.d.ts +29 -0
  79. package/types/index.d.ts +93 -0
  80. package/types/info-window.d.ts +51 -0
  81. package/types/item.d.ts +25 -0
  82. package/types/label.d.ts +35 -0
  83. package/types/local-search.d.ts +62 -0
  84. package/types/lushu.d.ts +53 -0
  85. package/types/map-type.d.ts +13 -0
  86. package/types/map-view.d.ts +3 -0
  87. package/types/map.d.ts +87 -0
  88. package/types/marker-clusterer.d.ts +25 -0
  89. package/types/marker.d.ts +78 -0
  90. package/types/menu.d.ts +7 -0
  91. package/types/navigation.d.ts +18 -0
  92. package/types/overlay.d.ts +16 -0
  93. package/types/overview-map.d.ts +14 -0
  94. package/types/panorama.d.ts +3 -0
  95. package/types/point-collection.d.ts +26 -0
  96. package/types/polygon.d.ts +46 -0
  97. package/types/polyline.d.ts +37 -0
  98. package/types/scale.d.ts +3 -0
  99. package/types/tile.d.ts +21 -0
  100. package/types/traffic.d.ts +8 -0
  101. package/types/transit.d.ts +39 -0
  102. package/types/tsconfig.json +17 -0
  103. package/types/walking.d.ts +35 -0
@@ -0,0 +1,78 @@
1
+ <script>
2
+ import commonMixin from '../base/mixins/common.js'
3
+ import Heatmap from 'bmaplib.heatmap'
4
+
5
+ export default {
6
+ name: 'bml-heatmap',
7
+ render () {},
8
+ mixins: [commonMixin('overlay')],
9
+ props: {
10
+ data: {
11
+ type: Array,
12
+ default: Array
13
+ },
14
+ max: {
15
+ type: Number
16
+ },
17
+ radius: {
18
+ type: Number
19
+ },
20
+ gradient: {
21
+ type: Object
22
+ },
23
+ opacity: {
24
+ type: Number
25
+ }
26
+ },
27
+ watch: {
28
+ data: {
29
+ handler () {
30
+ this.reload()
31
+ },
32
+ deep: true
33
+ },
34
+ max () {
35
+ this.reload()
36
+ },
37
+ radius (val) {
38
+ const {originInstance, opacity, gradient} = this
39
+ originInstance.setOptions({
40
+ radius: val,
41
+ opacity,
42
+ gradient
43
+ })
44
+ },
45
+ gradient: {
46
+ handler (val) {
47
+ const {originInstance, radius, opacity} = this
48
+ originInstance.setOptions({
49
+ radius,
50
+ opacity,
51
+ gradient: val
52
+ })
53
+ },
54
+ deep: true
55
+ },
56
+ opacity (val) {
57
+ const {originInstance, radius, gradient} = this
58
+ originInstance.setOptions({
59
+ radius,
60
+ opacity: val,
61
+ gradient
62
+ })
63
+ }
64
+ },
65
+ methods: {
66
+ load () {
67
+ const {map, data, max, radius, opacity, gradient} = this
68
+ const overlay = this.originInstance = new Heatmap({
69
+ radius,
70
+ opacity,
71
+ gradient
72
+ })
73
+ map.addOverlay(overlay)
74
+ overlay.setDataSet({data, max})
75
+ }
76
+ }
77
+ }
78
+ </script>
@@ -0,0 +1,125 @@
1
+ <script>
2
+ /*eslint-disable*/
3
+ import commonMixin from '../base/mixins/common.js'
4
+ import {createIcon} from '../base/factory.js'
5
+ import Lushu from 'bmaplib.lushu'
6
+
7
+ export default {
8
+ name: 'bm-lushu',
9
+ render (h) {},
10
+ mixins: [commonMixin('lushu')],
11
+ props: {
12
+ path: {
13
+ type: Array,
14
+ default: []
15
+ },
16
+ landmarkPois: {
17
+ type: Array,
18
+ default () {
19
+ return []
20
+ }
21
+ },
22
+ icon: {
23
+ type: Object
24
+ },
25
+ speed: {
26
+ type: Number,
27
+ default: 4000
28
+ },
29
+ content: {
30
+ type: String,
31
+ default: ''
32
+ },
33
+ autoView: {
34
+ type: Boolean,
35
+ default: false
36
+ },
37
+ rotation: {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ infoWindow: {
42
+ type: Boolean,
43
+ default: true
44
+ },
45
+ play: {
46
+ type: Boolean,
47
+ default: true
48
+ }
49
+ },
50
+ watch: {
51
+ path: {
52
+ handler (val) {
53
+ this.reload()
54
+ },
55
+ deep: true
56
+ },
57
+ landmarkPois: {
58
+ handler (val) {
59
+ this.reload()
60
+ },
61
+ deep: true
62
+ },
63
+ icon: {
64
+ handler (val) {
65
+ const {originInstance, content} = this
66
+ const newMarker = createIcon(BMap, val)
67
+ originInstance._opts.icon = newMarker
68
+ originInstance._marker = newMarker
69
+ },
70
+ deep: true
71
+ },
72
+ speed (val) {
73
+ const {originInstance, content} = this
74
+ originInstance._opts.speed = val
75
+ },
76
+ content (val) {
77
+ const {originInstance, infoWindow} = this
78
+ val && infoWindow ? originInstance.showInfoWindow() : originInstance.hideInfoWindow()
79
+ originInstance._opts.defaultContent = val
80
+ originInstance._overlay && originInstance._overlay.setHtml(val)
81
+ },
82
+ autoView (val) {
83
+ const {originInstance, content} = this
84
+ originInstance._opts.autoView = val
85
+ },
86
+ rotation (val) {
87
+ const {originInstance, content} = this
88
+ originInstance._opts.enableRotation = val
89
+ },
90
+ infoWindow (val) {
91
+ const {originInstance, content} = this
92
+ originInstance && val && content ? originInstance.showInfoWindow() : originInstance.hideInfoWindow()
93
+ },
94
+ play (val) {
95
+ const {originInstance} = this
96
+ val && originInstance ? originInstance.start() : !this._isEnd && originInstance.pause()
97
+ }
98
+ },
99
+ methods: {
100
+ load () {
101
+ const {BMap, map, path, landmarkPois, icon, speed, content, autoView, rotation, infoWindow, play} = this
102
+ const lushu = this.originInstance = new Lushu(map, path, {
103
+ enableRotation: rotation,
104
+ landmarkPois,
105
+ showInfoWindow: infoWindow,
106
+ defaultContent: content,
107
+ icon: icon && createIcon(BMap, icon),
108
+ speed,
109
+ autoView,
110
+ onstart: e => {
111
+ this._isEnd = false
112
+ this.$emit('start')
113
+ },
114
+ onstop: e => {
115
+ this._isEnd = true
116
+ this.$emit('stop')
117
+ },
118
+ onpause: e => this.$emit('pause')
119
+ })
120
+ play && path.length && lushu.start(this)
121
+ path.length && (content && infoWindow ? lushu.showInfoWindow() : lushu.hideInfoWindow())
122
+ }
123
+ }
124
+ }
125
+ </script>
@@ -0,0 +1,93 @@
1
+ <template>
2
+ <span>
3
+ <slot></slot>
4
+ </span>
5
+ </template>
6
+
7
+ <script>
8
+ import MarkerClusterer from 'bmaplib.markerclusterer'
9
+ import {createSize} from '../base/factory.js'
10
+ import commonMixin from '../base/mixins/common.js'
11
+
12
+ export default {
13
+ name: 'bml-marker-clusterer',
14
+ mixins: [commonMixin('markerClusterer')],
15
+ props: {
16
+ gridSize: {
17
+ type: Object
18
+ },
19
+ maxZoom: {
20
+ type: Number
21
+ },
22
+ minClusterSize: {
23
+ type: Number
24
+ },
25
+ styles: {
26
+ type: Array,
27
+ default () {
28
+ return []
29
+ }
30
+ },
31
+ averageCenter: {
32
+ type: Boolean,
33
+ default: false
34
+ }
35
+ },
36
+ watch: {
37
+ gridSize: {
38
+ handler (val) {
39
+ const {BMap, originInstance} = this
40
+ originInstance.setGridSize(BMap, val.map)
41
+ },
42
+ deep: true
43
+ },
44
+ maxZoom (val) {
45
+ const {originInstance} = this
46
+ originInstance.setMaxZoom(val)
47
+ },
48
+ minClusterSize: {
49
+ handler (val) {
50
+ const {BMap, originInstance} = this
51
+ originInstance.setMinClusterSize(createSize(BMap, val))
52
+ },
53
+ deep: true
54
+ },
55
+ styles: {
56
+ handler (val) {
57
+ const {BMap, originInstance} = this
58
+ const obj = JSON.parse(JSON.stringify(val)).map(item => {
59
+ item.size = item.size && createSize(BMap, item.size)
60
+ return item
61
+ })
62
+ originInstance.setStyles(obj)
63
+ },
64
+ deep: true
65
+ },
66
+ averageCenter (val) {
67
+ this.reload()
68
+ }
69
+ },
70
+ methods: {
71
+ load () {
72
+ const {BMap, map, gridSize, minClusterSize, maxZoom, styles, averageCenter} = this
73
+ this.originInstance = new MarkerClusterer(map, {
74
+ gridSize: gridSize && createSize(BMap, gridSize),
75
+ maxZoom,
76
+ minClusterSize: minClusterSize && createSize(BMap, minClusterSize),
77
+ styles: styles.map(item => {
78
+ item.size = createSize(BMap, item.size)
79
+ return item
80
+ }),
81
+ isAverageCenter: averageCenter
82
+ })
83
+ this.$nextTick(() => {
84
+ const markers = this.$children.map(inst => inst.originInstance).filter(marker => marker instanceof BMap.Marker)
85
+ this.originInstance.addMarkers(markers)
86
+ })
87
+ }
88
+ },
89
+ beforeCreate () {
90
+ this.preventChildrenRender = true
91
+ }
92
+ }
93
+ </script>
@@ -0,0 +1,98 @@
1
+ import BaiduMap from './map/Map.vue'
2
+ import BmView from './map/MapView.vue'
3
+ import BmScale from './controls/Scale.vue'
4
+ import BmNavigation from './controls/Navigation.vue'
5
+ import BmMapType from './controls/MapType.vue'
6
+ import BmOverviewMap from './controls/OverviewMap.vue'
7
+ import BmGeolocation from './controls/Geolocation.vue'
8
+ import BmCopyright from './controls/Copyright.vue'
9
+ import BmCityList from './controls/CityList.vue'
10
+ import BmPanorama from './controls/Panorama.vue'
11
+ import BmControl from './controls/Control.vue'
12
+ import BmMarker from './overlays/Marker.vue'
13
+ import BmPointCollection from './overlays/PointCollection.vue'
14
+ import BmPolyline from './overlays/Polyline.vue'
15
+ import BmPolygon from './overlays/Polygon.vue'
16
+ import BmCircle from './overlays/Circle.vue'
17
+ import BmGround from './overlays/Ground.vue'
18
+ import BmLabel from './overlays/Label.vue'
19
+ import BmInfoWindow from './overlays/InfoWindow.vue'
20
+ import BmOverlay from './overlays/Overlay.vue'
21
+ import BmContextMenu from './context-menu/Menu.vue'
22
+ import BmContextMenuItem from './context-menu/Item.vue'
23
+ import BmLocalSearch from './search/LocalSearch.vue'
24
+ import BmTransit from './search/Transit.vue'
25
+ import BmWalking from './search/Walking.vue'
26
+ import BmDriving from './search/Driving.vue'
27
+ import BmBus from './search/Bus.vue'
28
+ import BmTile from './layers/Tile.vue'
29
+ import BmTraffic from './layers/Traffic.vue'
30
+ import BmBoundary from './others/Boundary.vue'
31
+ import BmAutoComplete from './others/AutoComplete.vue'
32
+
33
+ import BmlMarkerClusterer from './extra/MarkerClusterer.vue'
34
+ import BmlLushu from './extra/Lushu.vue'
35
+ import BmlHeatmap from './extra/Heatmap.vue'
36
+ import BmlCurveLine from './extra/CurveLine.vue'
37
+
38
+ export default {
39
+ install (Vue, options) {
40
+ const {ak} = options
41
+ Vue.prototype._BMap = () => ({ak})
42
+
43
+ Vue.component('baidu-map', BaiduMap)
44
+ Vue.component('bm-view', BmView)
45
+
46
+ Vue.component('bm-scale', BmScale)
47
+ Vue.component('bm-navigation', BmNavigation)
48
+ Vue.component('bm-map-type', BmMapType)
49
+ Vue.component('bm-overview-map', BmOverviewMap)
50
+ Vue.component('bm-geolocation', BmGeolocation)
51
+ Vue.component('bm-copyright', BmCopyright)
52
+ Vue.component('bm-city-list', BmCityList)
53
+ Vue.component('bm-panorama', BmPanorama)
54
+ Vue.component('bm-control', BmControl)
55
+
56
+ Vue.component('bm-marker', BmMarker)
57
+ Vue.component('bm-point-collection', BmPointCollection)
58
+ Vue.component('bm-polyline', BmPolyline)
59
+ Vue.component('bm-polygon', BmPolygon)
60
+ Vue.component('bm-circle', BmCircle)
61
+ Vue.component('bm-ground', BmGround)
62
+ Vue.component('bm-label', BmLabel)
63
+ Vue.component('bm-info-window', BmInfoWindow)
64
+ Vue.component('bm-overlay', BmOverlay)
65
+
66
+ Vue.component('bm-context-menu', BmContextMenu)
67
+ Vue.component('bm-context-menu-item', BmContextMenuItem)
68
+
69
+ Vue.component('bm-local-search', BmLocalSearch)
70
+ Vue.component('bm-transit', BmTransit)
71
+ Vue.component('bm-walking', BmWalking)
72
+ Vue.component('bm-driving', BmDriving)
73
+ Vue.component('bm-bus', BmBus)
74
+
75
+ Vue.component('bm-tile', BmTile)
76
+ Vue.component('bm-traffic', BmTraffic)
77
+
78
+ Vue.component('bm-auto-complete', BmAutoComplete)
79
+ Vue.component('bm-boundary', BmBoundary)
80
+ }
81
+ }
82
+
83
+ export {
84
+ BaiduMap, BmView,
85
+ BmScale, BmNavigation, BmMapType, BmOverviewMap, BmGeolocation, BmCopyright, BmCityList, BmPanorama, BmControl,
86
+ BmMarker, BmPointCollection, BmPolyline, BmPolygon, BmCircle, BmGround, BmLabel, BmInfoWindow, BmOverlay,
87
+ BmContextMenu, BmContextMenuItem,
88
+ BmLocalSearch, BmTransit, BmWalking, BmDriving, BmBus,
89
+ BmTile, BmTraffic,
90
+ BmBoundary, BmAutoComplete
91
+ }
92
+
93
+ export {
94
+ BmlMarkerClusterer,
95
+ BmlLushu,
96
+ BmlHeatmap,
97
+ BmlCurveLine
98
+ }
@@ -0,0 +1,53 @@
1
+ <script>
2
+ import commonMixin from '../base/mixins/common.js'
3
+ import {createBounds} from '../base/factory.js'
4
+
5
+ export default {
6
+ name: 'bm-tile',
7
+ render (h) {},
8
+ mixins: [commonMixin('layer')],
9
+ props: {
10
+ transparentPng: {
11
+ type: Boolean
12
+ },
13
+ tileUrlTemplate: {
14
+ type: String
15
+ },
16
+ copyright: {
17
+ },
18
+ zIndex: {
19
+ type: Number
20
+ }
21
+ },
22
+ watch: {
23
+ transparentPng () {
24
+ this.reload()
25
+ },
26
+ tileUrlTemplate () {
27
+ this.reload()
28
+ },
29
+ copyright () {
30
+ this.reload()
31
+ },
32
+ zIndex () {
33
+ this.reload()
34
+ }
35
+ },
36
+ methods: {
37
+ load () {
38
+ const {BMap, map, transparentPng, tileUrlTemplate, copyright, zIndex} = this
39
+ this.originInstance = new BMap.TileLayer({
40
+ transparentPng,
41
+ tileUrlTemplate,
42
+ copyright: copyright && {
43
+ id: copyright.id,
44
+ content: copyright.content,
45
+ bounds: copyright.bounds && createBounds(copyright.bounds)
46
+ },
47
+ zIndex
48
+ })
49
+ map.addTileLayer(this.originInstance)
50
+ }
51
+ }
52
+ }
53
+ </script>
@@ -0,0 +1,34 @@
1
+ <script>
2
+ import commonMixin from '../base/mixins/common.js'
3
+
4
+ export default {
5
+ name: 'bm-triffic',
6
+ render (h) {},
7
+ mixins: [commonMixin('layer')],
8
+ props: {
9
+ predictDate: {
10
+ type: Object
11
+ }
12
+ },
13
+ watch: {
14
+ 'pridictDate.weekday' () {
15
+ this.reload()
16
+ },
17
+ 'pridictDate.hour' () {
18
+ this.reload()
19
+ },
20
+ pridictDate () {
21
+ this.reload()
22
+ }
23
+ },
24
+ methods: {
25
+ load () {
26
+ const {pridictDate, BMap, map} = this
27
+ this.originInstance = new BMap.TrafficLayer({
28
+ pridictDate
29
+ })
30
+ map.addTileLayer(this.originInstance)
31
+ }
32
+ }
33
+ }
34
+ </script>