@corpsmap/corpsmap 3.2.0 → 3.2.2
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.
- package/css/corpsmap.css +109 -109
- package/lib/dev.js +38 -28
- package/lib/prod.js +38 -28
- package/package.json +1 -1
- package/src/application-bundles/search-bundle.js +1 -2
- package/src/config/default-config.js +14 -20
- package/src/core-plugins/geocoder/bundle.js +3 -2
- package/src/core-plugins/geocoder/search-bar.js +15 -6
- package/src/core-plugins/legend/legend-item-multiple.js +5 -0
package/css/corpsmap.css
CHANGED
|
@@ -1,3 +1,112 @@
|
|
|
1
|
+
.loading-container {
|
|
2
|
+
height: 100px;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
align-items: center;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.loading-text {
|
|
10
|
+
font-size: 18px;
|
|
11
|
+
margin-top: 15px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.loading-spinner {
|
|
15
|
+
font-size: 12px;
|
|
16
|
+
height: 12px;
|
|
17
|
+
width: 12px;
|
|
18
|
+
margin: 0 auto;
|
|
19
|
+
background-color: red;
|
|
20
|
+
-webkit-animation: move 3s linear infinite; /* Safari */
|
|
21
|
+
animation: move 3s linear infinite;
|
|
22
|
+
animation-play-state: running;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@keyframes move {
|
|
26
|
+
0%,
|
|
27
|
+
100% {
|
|
28
|
+
transform: translate(-10px, -10px);
|
|
29
|
+
background-color: #f5f5f5;
|
|
30
|
+
border-radius: 40%;
|
|
31
|
+
}
|
|
32
|
+
25% {
|
|
33
|
+
transform: translate(10px, -10px);
|
|
34
|
+
border-radius: 20%;
|
|
35
|
+
}
|
|
36
|
+
50% {
|
|
37
|
+
transform: translate(10px, 10px);
|
|
38
|
+
background-color: #4d4c4e;
|
|
39
|
+
border-radius: 0%;
|
|
40
|
+
}
|
|
41
|
+
75% {
|
|
42
|
+
transform: translate(-10px, 10px);
|
|
43
|
+
border-radius: 20%;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Safari */
|
|
48
|
+
@-webkit-keyframes move {
|
|
49
|
+
0%,
|
|
50
|
+
100% {
|
|
51
|
+
-webkit-transform: translate(-10px, -10px);
|
|
52
|
+
background-color: #f5f5f5;
|
|
53
|
+
border-radius: 40%;
|
|
54
|
+
}
|
|
55
|
+
25% {
|
|
56
|
+
-webkit-transform: translate(10px, -10px);
|
|
57
|
+
border-radius: 20%;
|
|
58
|
+
}
|
|
59
|
+
50% {
|
|
60
|
+
-webkit-transform: translate(10px, 10px);
|
|
61
|
+
background-color: #4d4c4e;
|
|
62
|
+
border-radius: 0%;
|
|
63
|
+
}
|
|
64
|
+
75% {
|
|
65
|
+
-webkit-transform: translate(-10px, 10px);
|
|
66
|
+
border-radius: 20%;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.cm-map-loading-container {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
align-items: center;
|
|
75
|
+
}
|
|
76
|
+
.cm-loading-indicator {
|
|
77
|
+
margin: 5px;
|
|
78
|
+
border: 2px solid #f3f3f3;
|
|
79
|
+
border-radius: 50%;
|
|
80
|
+
border-top: 2px solid #3498db;
|
|
81
|
+
width: 25px;
|
|
82
|
+
height: 25px;
|
|
83
|
+
-webkit-animation: spin 1s linear infinite; /* Safari */
|
|
84
|
+
animation: spin 1s linear infinite;
|
|
85
|
+
}
|
|
86
|
+
.cm-map-ready {
|
|
87
|
+
padding: 5px;
|
|
88
|
+
width: 25px;
|
|
89
|
+
height: 25px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Safari */
|
|
93
|
+
@-webkit-keyframes spin {
|
|
94
|
+
0% {
|
|
95
|
+
-webkit-transform: rotate(0deg);
|
|
96
|
+
}
|
|
97
|
+
100% {
|
|
98
|
+
-webkit-transform: rotate(360deg);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@keyframes spin {
|
|
103
|
+
0% {
|
|
104
|
+
transform: rotate(0deg);
|
|
105
|
+
}
|
|
106
|
+
100% {
|
|
107
|
+
transform: rotate(360deg);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
1
110
|
.corpsmap .sidebar {
|
|
2
111
|
display: flex;
|
|
3
112
|
position: absolute;
|
|
@@ -169,115 +278,6 @@
|
|
|
169
278
|
outline: 0;
|
|
170
279
|
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
|
|
171
280
|
}
|
|
172
|
-
.loading-container {
|
|
173
|
-
height: 100px;
|
|
174
|
-
display: flex;
|
|
175
|
-
flex-direction: column;
|
|
176
|
-
justify-content: center;
|
|
177
|
-
align-items: center;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.loading-text {
|
|
181
|
-
font-size: 18px;
|
|
182
|
-
margin-top: 15px;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.loading-spinner {
|
|
186
|
-
font-size: 12px;
|
|
187
|
-
height: 12px;
|
|
188
|
-
width: 12px;
|
|
189
|
-
margin: 0 auto;
|
|
190
|
-
background-color: red;
|
|
191
|
-
-webkit-animation: move 3s linear infinite; /* Safari */
|
|
192
|
-
animation: move 3s linear infinite;
|
|
193
|
-
animation-play-state: running;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
@keyframes move {
|
|
197
|
-
0%,
|
|
198
|
-
100% {
|
|
199
|
-
transform: translate(-10px, -10px);
|
|
200
|
-
background-color: #f5f5f5;
|
|
201
|
-
border-radius: 40%;
|
|
202
|
-
}
|
|
203
|
-
25% {
|
|
204
|
-
transform: translate(10px, -10px);
|
|
205
|
-
border-radius: 20%;
|
|
206
|
-
}
|
|
207
|
-
50% {
|
|
208
|
-
transform: translate(10px, 10px);
|
|
209
|
-
background-color: #4d4c4e;
|
|
210
|
-
border-radius: 0%;
|
|
211
|
-
}
|
|
212
|
-
75% {
|
|
213
|
-
transform: translate(-10px, 10px);
|
|
214
|
-
border-radius: 20%;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/* Safari */
|
|
219
|
-
@-webkit-keyframes move {
|
|
220
|
-
0%,
|
|
221
|
-
100% {
|
|
222
|
-
-webkit-transform: translate(-10px, -10px);
|
|
223
|
-
background-color: #f5f5f5;
|
|
224
|
-
border-radius: 40%;
|
|
225
|
-
}
|
|
226
|
-
25% {
|
|
227
|
-
-webkit-transform: translate(10px, -10px);
|
|
228
|
-
border-radius: 20%;
|
|
229
|
-
}
|
|
230
|
-
50% {
|
|
231
|
-
-webkit-transform: translate(10px, 10px);
|
|
232
|
-
background-color: #4d4c4e;
|
|
233
|
-
border-radius: 0%;
|
|
234
|
-
}
|
|
235
|
-
75% {
|
|
236
|
-
-webkit-transform: translate(-10px, 10px);
|
|
237
|
-
border-radius: 20%;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.cm-map-loading-container {
|
|
242
|
-
display: flex;
|
|
243
|
-
flex-direction: column;
|
|
244
|
-
justify-content: center;
|
|
245
|
-
align-items: center;
|
|
246
|
-
}
|
|
247
|
-
.cm-loading-indicator {
|
|
248
|
-
margin: 5px;
|
|
249
|
-
border: 2px solid #f3f3f3;
|
|
250
|
-
border-radius: 50%;
|
|
251
|
-
border-top: 2px solid #3498db;
|
|
252
|
-
width: 25px;
|
|
253
|
-
height: 25px;
|
|
254
|
-
-webkit-animation: spin 1s linear infinite; /* Safari */
|
|
255
|
-
animation: spin 1s linear infinite;
|
|
256
|
-
}
|
|
257
|
-
.cm-map-ready {
|
|
258
|
-
padding: 5px;
|
|
259
|
-
width: 25px;
|
|
260
|
-
height: 25px;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/* Safari */
|
|
264
|
-
@-webkit-keyframes spin {
|
|
265
|
-
0% {
|
|
266
|
-
-webkit-transform: rotate(0deg);
|
|
267
|
-
}
|
|
268
|
-
100% {
|
|
269
|
-
-webkit-transform: rotate(360deg);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
@keyframes spin {
|
|
274
|
-
0% {
|
|
275
|
-
transform: rotate(0deg);
|
|
276
|
-
}
|
|
277
|
-
100% {
|
|
278
|
-
transform: rotate(360deg);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
281
|
@import url("https://fonts.googleapis.com/css?family=Roboto:300,400,500,700");
|
|
282
282
|
|
|
283
283
|
/*!
|
package/lib/dev.js
CHANGED
|
@@ -105713,9 +105713,7 @@ var searchBundle = {
|
|
|
105713
105713
|
sortedResultsGeo.push(result);
|
|
105714
105714
|
}
|
|
105715
105715
|
});
|
|
105716
|
-
var sortedResults = [].concat(sortedResultsWMS, sortedResultsGeo);
|
|
105717
|
-
|
|
105718
|
-
console.log(sortedResults);
|
|
105716
|
+
var sortedResults = [].concat(sortedResultsWMS, sortedResultsGeo);
|
|
105719
105717
|
dispatch({
|
|
105720
105718
|
type: "SEARCH_SUCCESS",
|
|
105721
105719
|
payload: {
|
|
@@ -106179,6 +106177,12 @@ var loadPlugins = (function (store, plugins) {
|
|
|
106179
106177
|
store.doStopLoadingPlugins();
|
|
106180
106178
|
});
|
|
106181
106179
|
|
|
106180
|
+
var defaultMapboxToken = "pk.eyJ1IjoidXNhY2UiLCJhIjoiY2p4YW5hdjR6MThoZDNubG1mdG1rYXR1dSJ9.1jDEJhe6OP-e6iZNeEtzjA"; // Set value REACT_APP_MAPBOX_TOKEN in application. For instance, Corpsmap-orm, FUDSMIS
|
|
106181
|
+
// For localhost create .env.development REACT_APP_MAPBOX_TOKEN="mapboxToken"
|
|
106182
|
+
// use token if it is undefined
|
|
106183
|
+
|
|
106184
|
+
var mapboxTokenEnvVariable = "".concat(process.env.REACT_APP_MAPBOX_TOKEN);
|
|
106185
|
+
var mapboxToken = mapboxTokenEnvVariable === "undefined" ? defaultMapboxToken : mapboxTokenEnvVariable;
|
|
106182
106186
|
var config = {
|
|
106183
106187
|
map: {
|
|
106184
106188
|
basemap: 0,
|
|
@@ -106194,10 +106198,10 @@ var config = {
|
|
|
106194
106198
|
},
|
|
106195
106199
|
dim: "2d",
|
|
106196
106200
|
theme: "bg-blue-chambray",
|
|
106201
|
+
mapboxToken: mapboxToken,
|
|
106197
106202
|
basemaps: [{
|
|
106198
106203
|
id: "OpenStreetMap",
|
|
106199
106204
|
name: "OpenStreetMap",
|
|
106200
|
-
oldUrl: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
106201
106205
|
url: "https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
106202
106206
|
maxZoom: 19,
|
|
106203
106207
|
attributions: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
@@ -106205,34 +106209,30 @@ var config = {
|
|
|
106205
106209
|
}, {
|
|
106206
106210
|
id: "MapBoxStreets",
|
|
106207
106211
|
name: "MapBox Streets",
|
|
106208
|
-
|
|
106209
|
-
url: "https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoidXNhY2UiLCJhIjoiY2p4YW5hdjR6MThoZDNubG1mdG1rYXR1dSJ9.1jDEJhe6OP-e6iZNeEtzjA",
|
|
106212
|
+
url: "https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/256/{z}/{x}/{y}?access_token={accessToken}",
|
|
106210
106213
|
attributions: 'Imagery from <a href="https://mapbox.com/about/maps/">MapBox</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
106211
106214
|
subdomains: "abcd",
|
|
106212
|
-
accessToken:
|
|
106215
|
+
accessToken: mapboxToken,
|
|
106213
106216
|
visible: false
|
|
106214
106217
|
}, {
|
|
106215
106218
|
id: "MapBoxAerial",
|
|
106216
106219
|
name: "MapBox Aerial",
|
|
106217
|
-
|
|
106218
|
-
url: "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoidXNhY2UiLCJhIjoiY2p4YW5hdjR6MThoZDNubG1mdG1rYXR1dSJ9.1jDEJhe6OP-e6iZNeEtzjA",
|
|
106220
|
+
url: "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/256/{z}/{x}/{y}?access_token={accessToken}",
|
|
106219
106221
|
attributions: 'Imagery from <a href="https://mapbox.com/about/maps/">MapBox</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
106220
106222
|
subdomains: "abcd",
|
|
106221
|
-
accessToken:
|
|
106223
|
+
accessToken: mapboxToken,
|
|
106222
106224
|
visible: false
|
|
106223
106225
|
}, {
|
|
106224
106226
|
id: "MapBoxOutdoor",
|
|
106225
106227
|
name: "MapBox Outdoor",
|
|
106226
|
-
|
|
106227
|
-
url: "https://api.mapbox.com/styles/v1/mapbox/outdoors-v10/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoidXNhY2UiLCJhIjoiY2p4YW5hdjR6MThoZDNubG1mdG1rYXR1dSJ9.1jDEJhe6OP-e6iZNeEtzjA",
|
|
106228
|
+
url: "https://api.mapbox.com/styles/v1/mapbox/outdoors-v10/tiles/256/{z}/{x}/{y}?access_token={accessToken}",
|
|
106228
106229
|
attributions: 'Imagery from <a href="https://mapbox.com/about/maps/">MapBox</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
106229
106230
|
subdomains: "abcd",
|
|
106230
|
-
accessToken:
|
|
106231
|
+
accessToken: mapboxToken,
|
|
106231
106232
|
visible: false
|
|
106232
106233
|
}, {
|
|
106233
106234
|
id: "StamenToner",
|
|
106234
106235
|
name: "Stamen Toner",
|
|
106235
|
-
oldUrl: "https://stamen-tiles-{s}.a.ssl.fastly.net/toner/{z}/{x}/{y}.png",
|
|
106236
106236
|
url: "https://stamen-tiles-{a-d}.a.ssl.fastly.net/toner/{z}/{x}/{y}.png",
|
|
106237
106237
|
attributions: 'Map tiles by <a href="https://stamen.com">Stamen Design</a>, <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
106238
106238
|
subdomains: "abcd",
|
|
@@ -106243,7 +106243,6 @@ var config = {
|
|
|
106243
106243
|
}, {
|
|
106244
106244
|
id: "StamenWatercolor",
|
|
106245
106245
|
name: "Stamen Watercolor",
|
|
106246
|
-
oldUrl: "https://stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg",
|
|
106247
106246
|
url: "https://stamen-tiles-{a-d}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg",
|
|
106248
106247
|
attributions: 'Map tiles by <a href="https://stamen.com">Stamen Design</a>, <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
106249
106248
|
subdomains: "abcd",
|
|
@@ -106290,7 +106289,6 @@ var config = {
|
|
|
106290
106289
|
}, {
|
|
106291
106290
|
id: "CartoDBDarkMatter",
|
|
106292
106291
|
name: "CartoDB Dark Matter",
|
|
106293
|
-
oldUrl: "https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png",
|
|
106294
106292
|
url: "https://cartodb-basemaps-{a-d}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png",
|
|
106295
106293
|
attributions: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> © <a href="https://cartodb.com/attributionss">CartoDB</a>',
|
|
106296
106294
|
subdomains: "abcd",
|
|
@@ -106299,7 +106297,6 @@ var config = {
|
|
|
106299
106297
|
}, {
|
|
106300
106298
|
id: "CartoDBPositron",
|
|
106301
106299
|
name: "CartoDB Positron",
|
|
106302
|
-
oldUrl: "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",
|
|
106303
106300
|
url: "https://cartodb-basemaps-{a-d}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",
|
|
106304
106301
|
attributions: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> © <a href="https://cartodb.com/attributionss">CartoDB</a>',
|
|
106305
106302
|
subdomains: "abcd",
|
|
@@ -106554,7 +106551,7 @@ var config = {
|
|
|
106554
106551
|
};
|
|
106555
106552
|
|
|
106556
106553
|
var name = "@corpsmap/corpsmap";
|
|
106557
|
-
var version$1 = "3.2.
|
|
106554
|
+
var version$1 = "3.2.2";
|
|
106558
106555
|
var description = "CorpsMap as React Components";
|
|
106559
106556
|
var main = "index.js";
|
|
106560
106557
|
var scripts = {
|
|
@@ -135524,7 +135521,8 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135524
135521
|
|
|
135525
135522
|
_this = _super.call(this, props);
|
|
135526
135523
|
_this.state = {
|
|
135527
|
-
selectedIdx: null
|
|
135524
|
+
selectedIdx: null,
|
|
135525
|
+
currentVal: ""
|
|
135528
135526
|
};
|
|
135529
135527
|
_this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
|
|
135530
135528
|
_this.fireSearch = _this.fireSearch.bind(_assertThisInitialized(_this));
|
|
@@ -135546,16 +135544,23 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135546
135544
|
value: function handleChange(val) {
|
|
135547
135545
|
var doSearchSetQuery = this.props.doSearchSetQuery;
|
|
135548
135546
|
this.setState({
|
|
135549
|
-
selectedIdx: null
|
|
135547
|
+
selectedIdx: null,
|
|
135548
|
+
currentVal: val
|
|
135550
135549
|
});
|
|
135551
135550
|
doSearchSetQuery(val);
|
|
135552
|
-
|
|
135551
|
+
console.log(val);
|
|
135552
|
+
|
|
135553
|
+
if (val.length < 3) {
|
|
135554
|
+
return null;
|
|
135555
|
+
} else {
|
|
135556
|
+
this.debouncedSearch();
|
|
135557
|
+
}
|
|
135553
135558
|
}
|
|
135554
135559
|
}, {
|
|
135555
135560
|
key: "fireSearch",
|
|
135556
135561
|
value: function fireSearch() {
|
|
135557
135562
|
var doSearchShouldFire = this.props.doSearchShouldFire;
|
|
135558
|
-
doSearchShouldFire();
|
|
135563
|
+
doSearchShouldFire(this.state.currentVal);
|
|
135559
135564
|
}
|
|
135560
135565
|
}, {
|
|
135561
135566
|
key: "handleKeyUp",
|
|
@@ -135594,11 +135599,15 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135594
135599
|
var _classnames,
|
|
135595
135600
|
_this2 = this;
|
|
135596
135601
|
|
|
135597
|
-
var
|
|
135602
|
+
var _this$state = this.state,
|
|
135603
|
+
selectedIdx = _this$state.selectedIdx,
|
|
135604
|
+
currentVal = _this$state.currentVal;
|
|
135598
135605
|
var _this$props = this.props,
|
|
135599
135606
|
theme = _this$props.theme,
|
|
135600
135607
|
searchResults = _this$props.searchResults,
|
|
135601
135608
|
searchQueryString = _this$props.searchQueryString;
|
|
135609
|
+
var emptyArry = [];
|
|
135610
|
+
var optSearchResults = currentVal < 2 ? emptyArry : searchResults;
|
|
135602
135611
|
var containerClass = classnames((_classnames = {}, _defineProperty(_classnames, theme, true), _defineProperty(_classnames, "cm-btn-group", true), _classnames));
|
|
135603
135612
|
return /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("div", {
|
|
135604
135613
|
className: containerClass,
|
|
@@ -135619,7 +135628,7 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135619
135628
|
_this2.searchResultsList = el;
|
|
135620
135629
|
},
|
|
135621
135630
|
onItemClick: this.handleItemClick,
|
|
135622
|
-
items:
|
|
135631
|
+
items: optSearchResults,
|
|
135623
135632
|
selectedIdx: selectedIdx
|
|
135624
135633
|
}));
|
|
135625
135634
|
}
|
|
@@ -135792,9 +135801,10 @@ var bundle$4 = {
|
|
|
135792
135801
|
var mapProjection = store.selectMapProjection();
|
|
135793
135802
|
var geoProjection = store.selectGeoProjection();
|
|
135794
135803
|
var c = transform(store.selectViewCenter(), mapProjection, geoProjection);
|
|
135804
|
+
var mapboxToken = store.selectDefaultConfig().mapboxToken;
|
|
135795
135805
|
if (q.length < 2) return;
|
|
135796
135806
|
q = encodeURIComponent(q);
|
|
135797
|
-
apiGet("https://api.mapbox.com/geocoding/v5/mapbox.places/".concat(q, ".json?proximity=").concat(c.toString()).concat(countries && countries.length ? "&country=".concat(countries.join(",")) : "", "&access_token=
|
|
135807
|
+
apiGet("https://api.mapbox.com/geocoding/v5/mapbox.places/".concat(q, ".json?proximity=").concat(c.toString()).concat(countries && countries.length ? "&country=".concat(countries.join(",")) : "", "&access_token=").concat(mapboxToken), function (err, response, body) {
|
|
135798
135808
|
if (err) return callback(err);
|
|
135799
135809
|
var results = JSON.parse(body);
|
|
135800
135810
|
return callback(null, results.features.map(function (r) {
|
|
@@ -158661,7 +158671,7 @@ var LegendItemMultiple = /*#__PURE__*/function (_React$Component) {
|
|
|
158661
158671
|
var _this$props = this.props,
|
|
158662
158672
|
layer = _this$props.layer,
|
|
158663
158673
|
images = _this$props.images;
|
|
158664
|
-
return /*#__PURE__*/React$1__default.createElement("li", {
|
|
158674
|
+
return /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("li", {
|
|
158665
158675
|
className: "cm-list-group-item corpsmap-legend-item-multiple"
|
|
158666
158676
|
}, /*#__PURE__*/React$1__default.createElement(Header, {
|
|
158667
158677
|
layer: layer
|
|
@@ -158671,8 +158681,8 @@ var LegendItemMultiple = /*#__PURE__*/function (_React$Component) {
|
|
|
158671
158681
|
}, typeof image === "string" ? image : /*#__PURE__*/React$1__default.createElement("img", {
|
|
158672
158682
|
alt: image.alt,
|
|
158673
158683
|
src: image.src
|
|
158674
|
-
}), layer.type === "WMS" ? null : image.title);
|
|
158675
|
-
}));
|
|
158684
|
+
}), layer.type === "WMS" ? null : image.title, /*#__PURE__*/React$1__default.createElement("br", null), layer.attributions ? /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("label", null, /*#__PURE__*/React$1__default.createElement("strong", null, "Credits: ", layer.attributions), " ")) : null);
|
|
158685
|
+
})));
|
|
158676
158686
|
}
|
|
158677
158687
|
}]);
|
|
158678
158688
|
|
package/lib/prod.js
CHANGED
|
@@ -105627,9 +105627,7 @@ var searchBundle = {
|
|
|
105627
105627
|
sortedResultsGeo.push(result);
|
|
105628
105628
|
}
|
|
105629
105629
|
});
|
|
105630
|
-
var sortedResults = [].concat(sortedResultsWMS, sortedResultsGeo);
|
|
105631
|
-
|
|
105632
|
-
console.log(sortedResults);
|
|
105630
|
+
var sortedResults = [].concat(sortedResultsWMS, sortedResultsGeo);
|
|
105633
105631
|
dispatch({
|
|
105634
105632
|
type: "SEARCH_SUCCESS",
|
|
105635
105633
|
payload: {
|
|
@@ -106093,6 +106091,12 @@ var loadPlugins = (function (store, plugins) {
|
|
|
106093
106091
|
store.doStopLoadingPlugins();
|
|
106094
106092
|
});
|
|
106095
106093
|
|
|
106094
|
+
var defaultMapboxToken = "pk.eyJ1IjoidXNhY2UiLCJhIjoiY2p4YW5hdjR6MThoZDNubG1mdG1rYXR1dSJ9.1jDEJhe6OP-e6iZNeEtzjA"; // Set value REACT_APP_MAPBOX_TOKEN in application. For instance, Corpsmap-orm, FUDSMIS
|
|
106095
|
+
// For localhost create .env.development REACT_APP_MAPBOX_TOKEN="mapboxToken"
|
|
106096
|
+
// use token if it is undefined
|
|
106097
|
+
|
|
106098
|
+
var mapboxTokenEnvVariable = "".concat(process.env.REACT_APP_MAPBOX_TOKEN);
|
|
106099
|
+
var mapboxToken = mapboxTokenEnvVariable === "undefined" ? defaultMapboxToken : mapboxTokenEnvVariable;
|
|
106096
106100
|
var config = {
|
|
106097
106101
|
map: {
|
|
106098
106102
|
basemap: 0,
|
|
@@ -106108,10 +106112,10 @@ var config = {
|
|
|
106108
106112
|
},
|
|
106109
106113
|
dim: "2d",
|
|
106110
106114
|
theme: "bg-blue-chambray",
|
|
106115
|
+
mapboxToken: mapboxToken,
|
|
106111
106116
|
basemaps: [{
|
|
106112
106117
|
id: "OpenStreetMap",
|
|
106113
106118
|
name: "OpenStreetMap",
|
|
106114
|
-
oldUrl: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
106115
106119
|
url: "https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
106116
106120
|
maxZoom: 19,
|
|
106117
106121
|
attributions: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
@@ -106119,34 +106123,30 @@ var config = {
|
|
|
106119
106123
|
}, {
|
|
106120
106124
|
id: "MapBoxStreets",
|
|
106121
106125
|
name: "MapBox Streets",
|
|
106122
|
-
|
|
106123
|
-
url: "https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoidXNhY2UiLCJhIjoiY2p4YW5hdjR6MThoZDNubG1mdG1rYXR1dSJ9.1jDEJhe6OP-e6iZNeEtzjA",
|
|
106126
|
+
url: "https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/256/{z}/{x}/{y}?access_token={accessToken}",
|
|
106124
106127
|
attributions: 'Imagery from <a href="https://mapbox.com/about/maps/">MapBox</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
106125
106128
|
subdomains: "abcd",
|
|
106126
|
-
accessToken:
|
|
106129
|
+
accessToken: mapboxToken,
|
|
106127
106130
|
visible: false
|
|
106128
106131
|
}, {
|
|
106129
106132
|
id: "MapBoxAerial",
|
|
106130
106133
|
name: "MapBox Aerial",
|
|
106131
|
-
|
|
106132
|
-
url: "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoidXNhY2UiLCJhIjoiY2p4YW5hdjR6MThoZDNubG1mdG1rYXR1dSJ9.1jDEJhe6OP-e6iZNeEtzjA",
|
|
106134
|
+
url: "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/256/{z}/{x}/{y}?access_token={accessToken}",
|
|
106133
106135
|
attributions: 'Imagery from <a href="https://mapbox.com/about/maps/">MapBox</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
106134
106136
|
subdomains: "abcd",
|
|
106135
|
-
accessToken:
|
|
106137
|
+
accessToken: mapboxToken,
|
|
106136
106138
|
visible: false
|
|
106137
106139
|
}, {
|
|
106138
106140
|
id: "MapBoxOutdoor",
|
|
106139
106141
|
name: "MapBox Outdoor",
|
|
106140
|
-
|
|
106141
|
-
url: "https://api.mapbox.com/styles/v1/mapbox/outdoors-v10/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoidXNhY2UiLCJhIjoiY2p4YW5hdjR6MThoZDNubG1mdG1rYXR1dSJ9.1jDEJhe6OP-e6iZNeEtzjA",
|
|
106142
|
+
url: "https://api.mapbox.com/styles/v1/mapbox/outdoors-v10/tiles/256/{z}/{x}/{y}?access_token={accessToken}",
|
|
106142
106143
|
attributions: 'Imagery from <a href="https://mapbox.com/about/maps/">MapBox</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
106143
106144
|
subdomains: "abcd",
|
|
106144
|
-
accessToken:
|
|
106145
|
+
accessToken: mapboxToken,
|
|
106145
106146
|
visible: false
|
|
106146
106147
|
}, {
|
|
106147
106148
|
id: "StamenToner",
|
|
106148
106149
|
name: "Stamen Toner",
|
|
106149
|
-
oldUrl: "https://stamen-tiles-{s}.a.ssl.fastly.net/toner/{z}/{x}/{y}.png",
|
|
106150
106150
|
url: "https://stamen-tiles-{a-d}.a.ssl.fastly.net/toner/{z}/{x}/{y}.png",
|
|
106151
106151
|
attributions: 'Map tiles by <a href="https://stamen.com">Stamen Design</a>, <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
106152
106152
|
subdomains: "abcd",
|
|
@@ -106157,7 +106157,6 @@ var config = {
|
|
|
106157
106157
|
}, {
|
|
106158
106158
|
id: "StamenWatercolor",
|
|
106159
106159
|
name: "Stamen Watercolor",
|
|
106160
|
-
oldUrl: "https://stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg",
|
|
106161
106160
|
url: "https://stamen-tiles-{a-d}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg",
|
|
106162
106161
|
attributions: 'Map tiles by <a href="https://stamen.com">Stamen Design</a>, <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
106163
106162
|
subdomains: "abcd",
|
|
@@ -106204,7 +106203,6 @@ var config = {
|
|
|
106204
106203
|
}, {
|
|
106205
106204
|
id: "CartoDBDarkMatter",
|
|
106206
106205
|
name: "CartoDB Dark Matter",
|
|
106207
|
-
oldUrl: "https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png",
|
|
106208
106206
|
url: "https://cartodb-basemaps-{a-d}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png",
|
|
106209
106207
|
attributions: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> © <a href="https://cartodb.com/attributionss">CartoDB</a>',
|
|
106210
106208
|
subdomains: "abcd",
|
|
@@ -106213,7 +106211,6 @@ var config = {
|
|
|
106213
106211
|
}, {
|
|
106214
106212
|
id: "CartoDBPositron",
|
|
106215
106213
|
name: "CartoDB Positron",
|
|
106216
|
-
oldUrl: "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",
|
|
106217
106214
|
url: "https://cartodb-basemaps-{a-d}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",
|
|
106218
106215
|
attributions: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> © <a href="https://cartodb.com/attributionss">CartoDB</a>',
|
|
106219
106216
|
subdomains: "abcd",
|
|
@@ -106468,7 +106465,7 @@ var config = {
|
|
|
106468
106465
|
};
|
|
106469
106466
|
|
|
106470
106467
|
var name = "@corpsmap/corpsmap";
|
|
106471
|
-
var version$1 = "3.2.
|
|
106468
|
+
var version$1 = "3.2.2";
|
|
106472
106469
|
var description = "CorpsMap as React Components";
|
|
106473
106470
|
var main = "index.js";
|
|
106474
106471
|
var scripts = {
|
|
@@ -135438,7 +135435,8 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135438
135435
|
|
|
135439
135436
|
_this = _super.call(this, props);
|
|
135440
135437
|
_this.state = {
|
|
135441
|
-
selectedIdx: null
|
|
135438
|
+
selectedIdx: null,
|
|
135439
|
+
currentVal: ""
|
|
135442
135440
|
};
|
|
135443
135441
|
_this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
|
|
135444
135442
|
_this.fireSearch = _this.fireSearch.bind(_assertThisInitialized(_this));
|
|
@@ -135460,16 +135458,23 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135460
135458
|
value: function handleChange(val) {
|
|
135461
135459
|
var doSearchSetQuery = this.props.doSearchSetQuery;
|
|
135462
135460
|
this.setState({
|
|
135463
|
-
selectedIdx: null
|
|
135461
|
+
selectedIdx: null,
|
|
135462
|
+
currentVal: val
|
|
135464
135463
|
});
|
|
135465
135464
|
doSearchSetQuery(val);
|
|
135466
|
-
|
|
135465
|
+
console.log(val);
|
|
135466
|
+
|
|
135467
|
+
if (val.length < 3) {
|
|
135468
|
+
return null;
|
|
135469
|
+
} else {
|
|
135470
|
+
this.debouncedSearch();
|
|
135471
|
+
}
|
|
135467
135472
|
}
|
|
135468
135473
|
}, {
|
|
135469
135474
|
key: "fireSearch",
|
|
135470
135475
|
value: function fireSearch() {
|
|
135471
135476
|
var doSearchShouldFire = this.props.doSearchShouldFire;
|
|
135472
|
-
doSearchShouldFire();
|
|
135477
|
+
doSearchShouldFire(this.state.currentVal);
|
|
135473
135478
|
}
|
|
135474
135479
|
}, {
|
|
135475
135480
|
key: "handleKeyUp",
|
|
@@ -135508,11 +135513,15 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135508
135513
|
var _classnames,
|
|
135509
135514
|
_this2 = this;
|
|
135510
135515
|
|
|
135511
|
-
var
|
|
135516
|
+
var _this$state = this.state,
|
|
135517
|
+
selectedIdx = _this$state.selectedIdx,
|
|
135518
|
+
currentVal = _this$state.currentVal;
|
|
135512
135519
|
var _this$props = this.props,
|
|
135513
135520
|
theme = _this$props.theme,
|
|
135514
135521
|
searchResults = _this$props.searchResults,
|
|
135515
135522
|
searchQueryString = _this$props.searchQueryString;
|
|
135523
|
+
var emptyArry = [];
|
|
135524
|
+
var optSearchResults = currentVal < 2 ? emptyArry : searchResults;
|
|
135516
135525
|
var containerClass = classnames((_classnames = {}, _defineProperty(_classnames, theme, true), _defineProperty(_classnames, "cm-btn-group", true), _classnames));
|
|
135517
135526
|
return /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("div", {
|
|
135518
135527
|
className: containerClass,
|
|
@@ -135533,7 +135542,7 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135533
135542
|
_this2.searchResultsList = el;
|
|
135534
135543
|
},
|
|
135535
135544
|
onItemClick: this.handleItemClick,
|
|
135536
|
-
items:
|
|
135545
|
+
items: optSearchResults,
|
|
135537
135546
|
selectedIdx: selectedIdx
|
|
135538
135547
|
}));
|
|
135539
135548
|
}
|
|
@@ -135706,9 +135715,10 @@ var bundle$4 = {
|
|
|
135706
135715
|
var mapProjection = store.selectMapProjection();
|
|
135707
135716
|
var geoProjection = store.selectGeoProjection();
|
|
135708
135717
|
var c = transform(store.selectViewCenter(), mapProjection, geoProjection);
|
|
135718
|
+
var mapboxToken = store.selectDefaultConfig().mapboxToken;
|
|
135709
135719
|
if (q.length < 2) return;
|
|
135710
135720
|
q = encodeURIComponent(q);
|
|
135711
|
-
apiGet("https://api.mapbox.com/geocoding/v5/mapbox.places/".concat(q, ".json?proximity=").concat(c.toString()).concat(countries && countries.length ? "&country=".concat(countries.join(",")) : "", "&access_token=
|
|
135721
|
+
apiGet("https://api.mapbox.com/geocoding/v5/mapbox.places/".concat(q, ".json?proximity=").concat(c.toString()).concat(countries && countries.length ? "&country=".concat(countries.join(",")) : "", "&access_token=").concat(mapboxToken), function (err, response, body) {
|
|
135712
135722
|
if (err) return callback(err);
|
|
135713
135723
|
var results = JSON.parse(body);
|
|
135714
135724
|
return callback(null, results.features.map(function (r) {
|
|
@@ -158575,7 +158585,7 @@ var LegendItemMultiple = /*#__PURE__*/function (_React$Component) {
|
|
|
158575
158585
|
var _this$props = this.props,
|
|
158576
158586
|
layer = _this$props.layer,
|
|
158577
158587
|
images = _this$props.images;
|
|
158578
|
-
return /*#__PURE__*/React$1__default.createElement("li", {
|
|
158588
|
+
return /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("li", {
|
|
158579
158589
|
className: "cm-list-group-item corpsmap-legend-item-multiple"
|
|
158580
158590
|
}, /*#__PURE__*/React$1__default.createElement(Header, {
|
|
158581
158591
|
layer: layer
|
|
@@ -158585,8 +158595,8 @@ var LegendItemMultiple = /*#__PURE__*/function (_React$Component) {
|
|
|
158585
158595
|
}, typeof image === "string" ? image : /*#__PURE__*/React$1__default.createElement("img", {
|
|
158586
158596
|
alt: image.alt,
|
|
158587
158597
|
src: image.src
|
|
158588
|
-
}), layer.type === "WMS" ? null : image.title);
|
|
158589
|
-
}));
|
|
158598
|
+
}), layer.type === "WMS" ? null : image.title, /*#__PURE__*/React$1__default.createElement("br", null), layer.attributions ? /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("label", null, /*#__PURE__*/React$1__default.createElement("strong", null, "Credits: ", layer.attributions), " ")) : null);
|
|
158599
|
+
})));
|
|
158590
158600
|
}
|
|
158591
158601
|
}]);
|
|
158592
158602
|
|
package/package.json
CHANGED
|
@@ -57,6 +57,7 @@ export default {
|
|
|
57
57
|
({ dispatch, store }) => {
|
|
58
58
|
dispatch({ type: "SEARCH_START", payload: { shouldFire: false } });
|
|
59
59
|
const listeners = store.selectSearchOnFireSearchListeners();
|
|
60
|
+
|
|
60
61
|
async.parallel(listeners, (err, r) => {
|
|
61
62
|
if (err)
|
|
62
63
|
return dispatch({
|
|
@@ -77,8 +78,6 @@ export default {
|
|
|
77
78
|
});
|
|
78
79
|
|
|
79
80
|
const sortedResults = [...sortedResultsWMS, ...sortedResultsGeo];
|
|
80
|
-
// Delete below after Testing
|
|
81
|
-
console.log(sortedResults);
|
|
82
81
|
|
|
83
82
|
dispatch({
|
|
84
83
|
type: "SEARCH_SUCCESS",
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
let defaultMapboxToken = "pk.eyJ1IjoidXNhY2UiLCJhIjoiY2p4YW5hdjR6MThoZDNubG1mdG1rYXR1dSJ9.1jDEJhe6OP-e6iZNeEtzjA";
|
|
2
|
+
// Set value REACT_APP_MAPBOX_TOKEN in application. For instance, Corpsmap-orm, FUDSMIS
|
|
3
|
+
// For localhost create .env.development REACT_APP_MAPBOX_TOKEN="mapboxToken"
|
|
4
|
+
// use token if it is undefined
|
|
5
|
+
let mapboxTokenEnvVariable = `${process.env.REACT_APP_MAPBOX_TOKEN}`;
|
|
6
|
+
let mapboxToken = mapboxTokenEnvVariable === "undefined" ? defaultMapboxToken : mapboxTokenEnvVariable ;
|
|
7
|
+
|
|
1
8
|
const config = {
|
|
2
9
|
map: {
|
|
3
10
|
basemap: 0,
|
|
@@ -13,11 +20,11 @@ const config = {
|
|
|
13
20
|
},
|
|
14
21
|
dim: "2d",
|
|
15
22
|
theme: "bg-blue-chambray",
|
|
23
|
+
mapboxToken: mapboxToken ,
|
|
16
24
|
basemaps: [
|
|
17
25
|
{
|
|
18
26
|
id: "OpenStreetMap",
|
|
19
27
|
name: "OpenStreetMap",
|
|
20
|
-
oldUrl: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
21
28
|
url: "https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
22
29
|
maxZoom: 19,
|
|
23
30
|
attributions:
|
|
@@ -27,46 +34,39 @@ const config = {
|
|
|
27
34
|
{
|
|
28
35
|
id: "MapBoxStreets",
|
|
29
36
|
name: "MapBox Streets",
|
|
30
|
-
oldUrl:
|
|
31
|
-
"https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}",
|
|
32
37
|
url:
|
|
33
|
-
"https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/256/{z}/{x}/{y}?access_token=
|
|
38
|
+
"https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/256/{z}/{x}/{y}?access_token={accessToken}",
|
|
34
39
|
attributions:
|
|
35
40
|
'Imagery from <a href="https://mapbox.com/about/maps/">MapBox</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
36
41
|
subdomains: "abcd",
|
|
37
|
-
accessToken:
|
|
42
|
+
accessToken: mapboxToken,
|
|
38
43
|
visible: false
|
|
39
44
|
},
|
|
40
45
|
{
|
|
41
46
|
id: "MapBoxAerial",
|
|
42
47
|
name: "MapBox Aerial",
|
|
43
|
-
oldUrl:
|
|
44
|
-
"https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}",
|
|
45
48
|
url:
|
|
46
|
-
"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/256/{z}/{x}/{y}?access_token=
|
|
49
|
+
"https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/256/{z}/{x}/{y}?access_token={accessToken}",
|
|
47
50
|
attributions:
|
|
48
51
|
'Imagery from <a href="https://mapbox.com/about/maps/">MapBox</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
49
52
|
subdomains: "abcd",
|
|
50
|
-
accessToken:
|
|
53
|
+
accessToken: mapboxToken,
|
|
51
54
|
visible: false
|
|
52
55
|
},
|
|
53
56
|
{
|
|
54
57
|
id: "MapBoxOutdoor",
|
|
55
58
|
name: "MapBox Outdoor",
|
|
56
|
-
oldUrl:
|
|
57
|
-
"https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}",
|
|
58
59
|
url:
|
|
59
|
-
"https://api.mapbox.com/styles/v1/mapbox/outdoors-v10/tiles/256/{z}/{x}/{y}?access_token=
|
|
60
|
+
"https://api.mapbox.com/styles/v1/mapbox/outdoors-v10/tiles/256/{z}/{x}/{y}?access_token={accessToken}",
|
|
60
61
|
attributions:
|
|
61
62
|
'Imagery from <a href="https://mapbox.com/about/maps/">MapBox</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
62
63
|
subdomains: "abcd",
|
|
63
|
-
accessToken:
|
|
64
|
+
accessToken: mapboxToken,
|
|
64
65
|
visible: false
|
|
65
66
|
},
|
|
66
67
|
{
|
|
67
68
|
id: "StamenToner",
|
|
68
69
|
name: "Stamen Toner",
|
|
69
|
-
oldUrl: "https://stamen-tiles-{s}.a.ssl.fastly.net/toner/{z}/{x}/{y}.png",
|
|
70
70
|
url: "https://stamen-tiles-{a-d}.a.ssl.fastly.net/toner/{z}/{x}/{y}.png",
|
|
71
71
|
attributions:
|
|
72
72
|
'Map tiles by <a href="https://stamen.com">Stamen Design</a>, <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
@@ -79,8 +79,6 @@ const config = {
|
|
|
79
79
|
{
|
|
80
80
|
id: "StamenWatercolor",
|
|
81
81
|
name: "Stamen Watercolor",
|
|
82
|
-
oldUrl:
|
|
83
|
-
"https://stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg",
|
|
84
82
|
url:
|
|
85
83
|
"https://stamen-tiles-{a-d}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg",
|
|
86
84
|
attributions:
|
|
@@ -148,8 +146,6 @@ const config = {
|
|
|
148
146
|
{
|
|
149
147
|
id: "CartoDBDarkMatter",
|
|
150
148
|
name: "CartoDB Dark Matter",
|
|
151
|
-
oldUrl:
|
|
152
|
-
"https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png",
|
|
153
149
|
url:
|
|
154
150
|
"https://cartodb-basemaps-{a-d}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png",
|
|
155
151
|
attributions:
|
|
@@ -161,8 +157,6 @@ const config = {
|
|
|
161
157
|
{
|
|
162
158
|
id: "CartoDBPositron",
|
|
163
159
|
name: "CartoDB Positron",
|
|
164
|
-
oldUrl:
|
|
165
|
-
"https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",
|
|
166
160
|
url:
|
|
167
161
|
"https://cartodb-basemaps-{a-d}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",
|
|
168
162
|
attributions:
|
|
@@ -132,13 +132,14 @@ export default {
|
|
|
132
132
|
let q = store.selectSearchQueryString();
|
|
133
133
|
const mapProjection = store.selectMapProjection();
|
|
134
134
|
const geoProjection = store.selectGeoProjection();
|
|
135
|
-
let c = transform(store.selectViewCenter(), mapProjection, geoProjection);
|
|
135
|
+
let c = transform(store.selectViewCenter(), mapProjection, geoProjection);
|
|
136
|
+
let mapboxToken = store.selectDefaultConfig().mapboxToken;
|
|
136
137
|
if (q.length < 2) return;
|
|
137
138
|
q = encodeURIComponent(q);
|
|
138
139
|
apiGet(
|
|
139
140
|
`https://api.mapbox.com/geocoding/v5/mapbox.places/${q}.json?proximity=${c.toString()}${
|
|
140
141
|
countries && countries.length ? `&country=${countries.join(",")}` : ""
|
|
141
|
-
}&access_token
|
|
142
|
+
}&access_token=${mapboxToken}`,
|
|
142
143
|
(err, response, body) => {
|
|
143
144
|
if (err) return callback(err);
|
|
144
145
|
|
|
@@ -8,7 +8,8 @@ class SearchBar extends React.Component {
|
|
|
8
8
|
constructor(props) {
|
|
9
9
|
super(props);
|
|
10
10
|
this.state = {
|
|
11
|
-
selectedIdx: null
|
|
11
|
+
selectedIdx: null,
|
|
12
|
+
currentVal : ""
|
|
12
13
|
};
|
|
13
14
|
this.handleChange = this.handleChange.bind(this);
|
|
14
15
|
this.fireSearch = this.fireSearch.bind(this);
|
|
@@ -25,14 +26,20 @@ class SearchBar extends React.Component {
|
|
|
25
26
|
|
|
26
27
|
handleChange(val) {
|
|
27
28
|
const { doSearchSetQuery } = this.props;
|
|
28
|
-
this.setState({ selectedIdx: null });
|
|
29
|
+
this.setState({ selectedIdx: null, currentVal: val });
|
|
29
30
|
doSearchSetQuery(val);
|
|
30
|
-
|
|
31
|
+
console.log(val)
|
|
32
|
+
if (val.length < 3){
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
else{
|
|
36
|
+
this.debouncedSearch();
|
|
37
|
+
}
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
fireSearch() {
|
|
34
41
|
const { doSearchShouldFire } = this.props;
|
|
35
|
-
doSearchShouldFire();
|
|
42
|
+
doSearchShouldFire(this.state.currentVal);
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
handleKeyUp(e) {
|
|
@@ -65,8 +72,10 @@ class SearchBar extends React.Component {
|
|
|
65
72
|
}
|
|
66
73
|
|
|
67
74
|
render() {
|
|
68
|
-
const { selectedIdx } = this.state;
|
|
75
|
+
const { selectedIdx, currentVal } = this.state;
|
|
69
76
|
const { theme, searchResults, searchQueryString } = this.props;
|
|
77
|
+
const emptyArry = [];
|
|
78
|
+
let optSearchResults = currentVal < 2 ? emptyArry : searchResults
|
|
70
79
|
const containerClass = classnames({
|
|
71
80
|
[theme]: true,
|
|
72
81
|
"cm-btn-group": true
|
|
@@ -95,7 +104,7 @@ class SearchBar extends React.Component {
|
|
|
95
104
|
this.searchResultsList = el;
|
|
96
105
|
}}
|
|
97
106
|
onItemClick={this.handleItemClick}
|
|
98
|
-
items={
|
|
107
|
+
items={optSearchResults}
|
|
99
108
|
selectedIdx={selectedIdx}
|
|
100
109
|
/>
|
|
101
110
|
</div>
|
|
@@ -6,6 +6,7 @@ class LegendItemMultiple extends React.Component {
|
|
|
6
6
|
const { layer, images } = this.props;
|
|
7
7
|
|
|
8
8
|
return (
|
|
9
|
+
<div>
|
|
9
10
|
<li className="cm-list-group-item corpsmap-legend-item-multiple">
|
|
10
11
|
<Header layer={layer} />
|
|
11
12
|
{images.map((image, i) => {
|
|
@@ -17,10 +18,14 @@ class LegendItemMultiple extends React.Component {
|
|
|
17
18
|
<img alt={image.alt} src={image.src}></img>
|
|
18
19
|
)}
|
|
19
20
|
{layer.type === "WMS" ? null : image.title}
|
|
21
|
+
<br></br>
|
|
22
|
+
{layer.attributions ? <div><label><strong>Credits: {layer.attributions}</strong> </label></div> : null}
|
|
20
23
|
</div>
|
|
21
24
|
);
|
|
22
25
|
})}
|
|
23
26
|
</li>
|
|
27
|
+
|
|
28
|
+
</div>
|
|
24
29
|
);
|
|
25
30
|
}
|
|
26
31
|
}
|