@corpsmap/corpsmap 3.0.18 → 3.1.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.
- package/lib/dev.js +78 -31
- package/lib/prod.js +78 -31
- package/package.json +87 -87
- package/src/application-bundles/search-bundle.js +77 -45
- package/src/core-plugins/identify-vector/bundle.js +60 -55
- package/src/core-plugins/tree-view/layer-subpanel/defaults-toggle.js +22 -17
- package/src/core-plugins/tree-view/layer-subpanel/favorites-toggle.js +21 -16
- package/src/openlayers-utils/format-utilities.js +20 -1
package/lib/dev.js
CHANGED
|
@@ -105538,11 +105538,11 @@ var primaryPanelBundle = createContainerBundle({
|
|
|
105538
105538
|
});
|
|
105539
105539
|
|
|
105540
105540
|
var searchBundle = {
|
|
105541
|
-
name:
|
|
105541
|
+
name: "search",
|
|
105542
105542
|
getReducer: function getReducer() {
|
|
105543
105543
|
var initialData = {
|
|
105544
105544
|
shouldFireSearch: false,
|
|
105545
|
-
q:
|
|
105545
|
+
q: "",
|
|
105546
105546
|
selected: null,
|
|
105547
105547
|
onFireSearchListeners: [],
|
|
105548
105548
|
results: []
|
|
@@ -105554,7 +105554,7 @@ var searchBundle = {
|
|
|
105554
105554
|
type = _ref.type,
|
|
105555
105555
|
payload = _ref.payload;
|
|
105556
105556
|
|
|
105557
|
-
if (type.indexOf(
|
|
105557
|
+
if (type.indexOf("SEARCH_") !== -1) {
|
|
105558
105558
|
return Object.assign({}, state, payload);
|
|
105559
105559
|
}
|
|
105560
105560
|
|
|
@@ -105568,7 +105568,7 @@ var searchBundle = {
|
|
|
105568
105568
|
var listeners = store.selectSearchOnFireSearchListeners();
|
|
105569
105569
|
if (options.onFireSearch) listeners.push(options.onFireSearch);
|
|
105570
105570
|
dispatch({
|
|
105571
|
-
type:
|
|
105571
|
+
type: "SEARCH_COLLECTION_ADDED",
|
|
105572
105572
|
payload: {
|
|
105573
105573
|
onFireSearchListeners: listeners
|
|
105574
105574
|
}
|
|
@@ -105579,7 +105579,7 @@ var searchBundle = {
|
|
|
105579
105579
|
return function (_ref3) {
|
|
105580
105580
|
var dispatch = _ref3.dispatch;
|
|
105581
105581
|
dispatch({
|
|
105582
|
-
type:
|
|
105582
|
+
type: "SEARCH_SHOULD_FIRE",
|
|
105583
105583
|
payload: {
|
|
105584
105584
|
shouldFire: true
|
|
105585
105585
|
}
|
|
@@ -105591,7 +105591,7 @@ var searchBundle = {
|
|
|
105591
105591
|
var dispatch = _ref4.dispatch,
|
|
105592
105592
|
store = _ref4.store;
|
|
105593
105593
|
dispatch({
|
|
105594
|
-
type:
|
|
105594
|
+
type: "SEARCH_SET_QUERY",
|
|
105595
105595
|
payload: {
|
|
105596
105596
|
q: q,
|
|
105597
105597
|
results: []
|
|
@@ -105603,7 +105603,7 @@ var searchBundle = {
|
|
|
105603
105603
|
return function (_ref5) {
|
|
105604
105604
|
var dispatch = _ref5.dispatch;
|
|
105605
105605
|
dispatch({
|
|
105606
|
-
type:
|
|
105606
|
+
type: "SEARCH_ITEM_SELECTED",
|
|
105607
105607
|
payload: {
|
|
105608
105608
|
selected: item
|
|
105609
105609
|
}
|
|
@@ -105615,7 +105615,7 @@ var searchBundle = {
|
|
|
105615
105615
|
var dispatch = _ref6.dispatch,
|
|
105616
105616
|
store = _ref6.store;
|
|
105617
105617
|
dispatch({
|
|
105618
|
-
type:
|
|
105618
|
+
type: "SEARCH_START",
|
|
105619
105619
|
payload: {
|
|
105620
105620
|
shouldFire: false
|
|
105621
105621
|
}
|
|
@@ -105623,7 +105623,7 @@ var searchBundle = {
|
|
|
105623
105623
|
var listeners = store.selectSearchOnFireSearchListeners();
|
|
105624
105624
|
async$1.parallel(listeners, function (err, r) {
|
|
105625
105625
|
if (err) return dispatch({
|
|
105626
|
-
type:
|
|
105626
|
+
type: "SEARCH_ERROR",
|
|
105627
105627
|
payload: {
|
|
105628
105628
|
err: err,
|
|
105629
105629
|
results: []
|
|
@@ -105632,10 +105632,24 @@ var searchBundle = {
|
|
|
105632
105632
|
|
|
105633
105633
|
var results = lodash.flatten(r);
|
|
105634
105634
|
|
|
105635
|
+
var sortedResultsGeo = [];
|
|
105636
|
+
var sortedResultsWMS = [];
|
|
105637
|
+
results.forEach(function (result) {
|
|
105638
|
+
if (result.provider !== "geocoder") {
|
|
105639
|
+
sortedResultsWMS.push(result);
|
|
105640
|
+
}
|
|
105641
|
+
|
|
105642
|
+
if (result.provider === "geocoder") {
|
|
105643
|
+
sortedResultsGeo.push(result);
|
|
105644
|
+
}
|
|
105645
|
+
});
|
|
105646
|
+
var sortedResults = [].concat(sortedResultsWMS, sortedResultsGeo); // Delete below after Testing
|
|
105647
|
+
|
|
105648
|
+
console.log(sortedResults);
|
|
105635
105649
|
dispatch({
|
|
105636
|
-
type:
|
|
105650
|
+
type: "SEARCH_SUCCESS",
|
|
105637
105651
|
payload: {
|
|
105638
|
-
results:
|
|
105652
|
+
results: sortedResults
|
|
105639
105653
|
}
|
|
105640
105654
|
});
|
|
105641
105655
|
});
|
|
@@ -105652,7 +105666,7 @@ var searchBundle = {
|
|
|
105652
105666
|
},
|
|
105653
105667
|
reactSearchShouldFire: function reactSearchShouldFire(state) {
|
|
105654
105668
|
if (state.search.shouldFire) return {
|
|
105655
|
-
actionCreator:
|
|
105669
|
+
actionCreator: "doSearchFire"
|
|
105656
105670
|
};
|
|
105657
105671
|
}
|
|
105658
105672
|
}; // => add collection, should have a name and implement the following api:
|
|
@@ -106470,7 +106484,7 @@ var config = {
|
|
|
106470
106484
|
};
|
|
106471
106485
|
|
|
106472
106486
|
var name = "@corpsmap/corpsmap";
|
|
106473
|
-
var version$1 = "3.
|
|
106487
|
+
var version$1 = "3.1.1";
|
|
106474
106488
|
var description = "CorpsMap as React Components";
|
|
106475
106489
|
var main = "index.js";
|
|
106476
106490
|
var scripts = {
|
|
@@ -132745,6 +132759,29 @@ var formatArcgisrest = function formatArcgisrest(attributes) {
|
|
|
132745
132759
|
return attributes;
|
|
132746
132760
|
};
|
|
132747
132761
|
|
|
132762
|
+
var formatArcgisVector = function formatArcgisVector(results) {
|
|
132763
|
+
results.map(function (feat) {
|
|
132764
|
+
for (var _i2 = 0, _Object$entries2 = Object.entries(feat.properties); _i2 < _Object$entries2.length; _i2++) {
|
|
132765
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
|
|
132766
|
+
key = _Object$entries2$_i[0],
|
|
132767
|
+
value = _Object$entries2$_i[1];
|
|
132768
|
+
|
|
132769
|
+
var result = String(value).includes("https:") || String(value).includes("http:") ? value : null;
|
|
132770
|
+
|
|
132771
|
+
if (result) {
|
|
132772
|
+
feat.properties[key] = "<a href=\"".concat(value, "\" target=\"_new\" > ").concat(value, " </a>");
|
|
132773
|
+
}
|
|
132774
|
+
} // results.properties = feat.properties;
|
|
132775
|
+
|
|
132776
|
+
});
|
|
132777
|
+
return results;
|
|
132778
|
+
};
|
|
132779
|
+
|
|
132780
|
+
var formatUtilities = {
|
|
132781
|
+
formatArcgisVector: formatArcgisVector,
|
|
132782
|
+
formatArcgisrest: formatArcgisrest
|
|
132783
|
+
};
|
|
132784
|
+
|
|
132748
132785
|
function formatUrl(options) {
|
|
132749
132786
|
var url = "".concat(options.root, "/identify?");
|
|
132750
132787
|
var params = [];
|
|
@@ -132857,7 +132894,7 @@ var bundle$1 = {
|
|
|
132857
132894
|
type: featureType,
|
|
132858
132895
|
coordinates: coords
|
|
132859
132896
|
},
|
|
132860
|
-
properties:
|
|
132897
|
+
properties: formatUtilities(feat.attributes)
|
|
132861
132898
|
};
|
|
132862
132899
|
})
|
|
132863
132900
|
})
|
|
@@ -161104,14 +161141,19 @@ var FavoritesToggle = function FavoritesToggle(props) {
|
|
|
161104
161141
|
var doToggleLayerFavoritesAdd = props.doToggleLayerFavoritesAdd,
|
|
161105
161142
|
layer = props.layer;
|
|
161106
161143
|
var btnTxt = layer.favorite ? "REMOVE FROM FAVORITE LAYERS" : "ADD TO FAVORITE LAYERS";
|
|
161107
|
-
|
|
161108
|
-
|
|
161109
|
-
|
|
161110
|
-
|
|
161111
|
-
|
|
161112
|
-
|
|
161113
|
-
|
|
161114
|
-
|
|
161144
|
+
|
|
161145
|
+
if (!layer.id) {
|
|
161146
|
+
return null;
|
|
161147
|
+
} else {
|
|
161148
|
+
return /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("button", {
|
|
161149
|
+
onClick: function onClick() {
|
|
161150
|
+
doToggleLayerFavoritesAdd(layer, !layer.favorite);
|
|
161151
|
+
},
|
|
161152
|
+
type: "button",
|
|
161153
|
+
className: "cm-btn cm-btn-xs cm-btn-default",
|
|
161154
|
+
title: btnTxt
|
|
161155
|
+
}, btnTxt));
|
|
161156
|
+
}
|
|
161115
161157
|
};
|
|
161116
161158
|
|
|
161117
161159
|
var FavoritesToggle$1 = connect("doToggleLayerFavoritesAdd", FavoritesToggle);
|
|
@@ -161120,14 +161162,19 @@ var DefaultsToggle = function DefaultsToggle(props) {
|
|
|
161120
161162
|
var doToggleUserDefaultLayersAdd = props.doToggleUserDefaultLayersAdd,
|
|
161121
161163
|
layer = props.layer;
|
|
161122
161164
|
var btnTxt = layer.userDefaultLayer ? "REMOVE FROM DEFAULT LAYERS" : "ADD TO DEFAULT LAYERS";
|
|
161123
|
-
|
|
161124
|
-
|
|
161125
|
-
|
|
161126
|
-
|
|
161127
|
-
|
|
161128
|
-
|
|
161129
|
-
|
|
161130
|
-
|
|
161165
|
+
|
|
161166
|
+
if (!layer.id) {
|
|
161167
|
+
return null;
|
|
161168
|
+
} else {
|
|
161169
|
+
return /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("button", {
|
|
161170
|
+
onClick: function onClick() {
|
|
161171
|
+
doToggleUserDefaultLayersAdd(layer, !layer.userDefaultLayer);
|
|
161172
|
+
},
|
|
161173
|
+
type: "button",
|
|
161174
|
+
className: "cm-btn cm-btn-xs cm-btn-default",
|
|
161175
|
+
title: btnTxt
|
|
161176
|
+
}, btnTxt));
|
|
161177
|
+
}
|
|
161131
161178
|
};
|
|
161132
161179
|
|
|
161133
161180
|
var DefaultsToggle$1 = connect("doToggleUserDefaultLayersAdd", DefaultsToggle);
|
|
@@ -161994,7 +162041,7 @@ var bundle$d = {
|
|
|
161994
162041
|
err: null,
|
|
161995
162042
|
result: _defineProperty({}, lyr.uid, {
|
|
161996
162043
|
type: "FeatureCollection",
|
|
161997
|
-
features: outFeatures
|
|
162044
|
+
features: formatUtilities.formatArcgisVector(outFeatures)
|
|
161998
162045
|
})
|
|
161999
162046
|
});
|
|
162000
162047
|
}
|
package/lib/prod.js
CHANGED
|
@@ -105452,11 +105452,11 @@ var primaryPanelBundle = createContainerBundle({
|
|
|
105452
105452
|
});
|
|
105453
105453
|
|
|
105454
105454
|
var searchBundle = {
|
|
105455
|
-
name:
|
|
105455
|
+
name: "search",
|
|
105456
105456
|
getReducer: function getReducer() {
|
|
105457
105457
|
var initialData = {
|
|
105458
105458
|
shouldFireSearch: false,
|
|
105459
|
-
q:
|
|
105459
|
+
q: "",
|
|
105460
105460
|
selected: null,
|
|
105461
105461
|
onFireSearchListeners: [],
|
|
105462
105462
|
results: []
|
|
@@ -105468,7 +105468,7 @@ var searchBundle = {
|
|
|
105468
105468
|
type = _ref.type,
|
|
105469
105469
|
payload = _ref.payload;
|
|
105470
105470
|
|
|
105471
|
-
if (type.indexOf(
|
|
105471
|
+
if (type.indexOf("SEARCH_") !== -1) {
|
|
105472
105472
|
return Object.assign({}, state, payload);
|
|
105473
105473
|
}
|
|
105474
105474
|
|
|
@@ -105482,7 +105482,7 @@ var searchBundle = {
|
|
|
105482
105482
|
var listeners = store.selectSearchOnFireSearchListeners();
|
|
105483
105483
|
if (options.onFireSearch) listeners.push(options.onFireSearch);
|
|
105484
105484
|
dispatch({
|
|
105485
|
-
type:
|
|
105485
|
+
type: "SEARCH_COLLECTION_ADDED",
|
|
105486
105486
|
payload: {
|
|
105487
105487
|
onFireSearchListeners: listeners
|
|
105488
105488
|
}
|
|
@@ -105493,7 +105493,7 @@ var searchBundle = {
|
|
|
105493
105493
|
return function (_ref3) {
|
|
105494
105494
|
var dispatch = _ref3.dispatch;
|
|
105495
105495
|
dispatch({
|
|
105496
|
-
type:
|
|
105496
|
+
type: "SEARCH_SHOULD_FIRE",
|
|
105497
105497
|
payload: {
|
|
105498
105498
|
shouldFire: true
|
|
105499
105499
|
}
|
|
@@ -105505,7 +105505,7 @@ var searchBundle = {
|
|
|
105505
105505
|
var dispatch = _ref4.dispatch,
|
|
105506
105506
|
store = _ref4.store;
|
|
105507
105507
|
dispatch({
|
|
105508
|
-
type:
|
|
105508
|
+
type: "SEARCH_SET_QUERY",
|
|
105509
105509
|
payload: {
|
|
105510
105510
|
q: q,
|
|
105511
105511
|
results: []
|
|
@@ -105517,7 +105517,7 @@ var searchBundle = {
|
|
|
105517
105517
|
return function (_ref5) {
|
|
105518
105518
|
var dispatch = _ref5.dispatch;
|
|
105519
105519
|
dispatch({
|
|
105520
|
-
type:
|
|
105520
|
+
type: "SEARCH_ITEM_SELECTED",
|
|
105521
105521
|
payload: {
|
|
105522
105522
|
selected: item
|
|
105523
105523
|
}
|
|
@@ -105529,7 +105529,7 @@ var searchBundle = {
|
|
|
105529
105529
|
var dispatch = _ref6.dispatch,
|
|
105530
105530
|
store = _ref6.store;
|
|
105531
105531
|
dispatch({
|
|
105532
|
-
type:
|
|
105532
|
+
type: "SEARCH_START",
|
|
105533
105533
|
payload: {
|
|
105534
105534
|
shouldFire: false
|
|
105535
105535
|
}
|
|
@@ -105537,7 +105537,7 @@ var searchBundle = {
|
|
|
105537
105537
|
var listeners = store.selectSearchOnFireSearchListeners();
|
|
105538
105538
|
async$1.parallel(listeners, function (err, r) {
|
|
105539
105539
|
if (err) return dispatch({
|
|
105540
|
-
type:
|
|
105540
|
+
type: "SEARCH_ERROR",
|
|
105541
105541
|
payload: {
|
|
105542
105542
|
err: err,
|
|
105543
105543
|
results: []
|
|
@@ -105546,10 +105546,24 @@ var searchBundle = {
|
|
|
105546
105546
|
|
|
105547
105547
|
var results = lodash.flatten(r);
|
|
105548
105548
|
|
|
105549
|
+
var sortedResultsGeo = [];
|
|
105550
|
+
var sortedResultsWMS = [];
|
|
105551
|
+
results.forEach(function (result) {
|
|
105552
|
+
if (result.provider !== "geocoder") {
|
|
105553
|
+
sortedResultsWMS.push(result);
|
|
105554
|
+
}
|
|
105555
|
+
|
|
105556
|
+
if (result.provider === "geocoder") {
|
|
105557
|
+
sortedResultsGeo.push(result);
|
|
105558
|
+
}
|
|
105559
|
+
});
|
|
105560
|
+
var sortedResults = [].concat(sortedResultsWMS, sortedResultsGeo); // Delete below after Testing
|
|
105561
|
+
|
|
105562
|
+
console.log(sortedResults);
|
|
105549
105563
|
dispatch({
|
|
105550
|
-
type:
|
|
105564
|
+
type: "SEARCH_SUCCESS",
|
|
105551
105565
|
payload: {
|
|
105552
|
-
results:
|
|
105566
|
+
results: sortedResults
|
|
105553
105567
|
}
|
|
105554
105568
|
});
|
|
105555
105569
|
});
|
|
@@ -105566,7 +105580,7 @@ var searchBundle = {
|
|
|
105566
105580
|
},
|
|
105567
105581
|
reactSearchShouldFire: function reactSearchShouldFire(state) {
|
|
105568
105582
|
if (state.search.shouldFire) return {
|
|
105569
|
-
actionCreator:
|
|
105583
|
+
actionCreator: "doSearchFire"
|
|
105570
105584
|
};
|
|
105571
105585
|
}
|
|
105572
105586
|
}; // => add collection, should have a name and implement the following api:
|
|
@@ -106384,7 +106398,7 @@ var config = {
|
|
|
106384
106398
|
};
|
|
106385
106399
|
|
|
106386
106400
|
var name = "@corpsmap/corpsmap";
|
|
106387
|
-
var version$1 = "3.
|
|
106401
|
+
var version$1 = "3.1.1";
|
|
106388
106402
|
var description = "CorpsMap as React Components";
|
|
106389
106403
|
var main = "index.js";
|
|
106390
106404
|
var scripts = {
|
|
@@ -132659,6 +132673,29 @@ var formatArcgisrest = function formatArcgisrest(attributes) {
|
|
|
132659
132673
|
return attributes;
|
|
132660
132674
|
};
|
|
132661
132675
|
|
|
132676
|
+
var formatArcgisVector = function formatArcgisVector(results) {
|
|
132677
|
+
results.map(function (feat) {
|
|
132678
|
+
for (var _i2 = 0, _Object$entries2 = Object.entries(feat.properties); _i2 < _Object$entries2.length; _i2++) {
|
|
132679
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
|
|
132680
|
+
key = _Object$entries2$_i[0],
|
|
132681
|
+
value = _Object$entries2$_i[1];
|
|
132682
|
+
|
|
132683
|
+
var result = String(value).includes("https:") || String(value).includes("http:") ? value : null;
|
|
132684
|
+
|
|
132685
|
+
if (result) {
|
|
132686
|
+
feat.properties[key] = "<a href=\"".concat(value, "\" target=\"_new\" > ").concat(value, " </a>");
|
|
132687
|
+
}
|
|
132688
|
+
} // results.properties = feat.properties;
|
|
132689
|
+
|
|
132690
|
+
});
|
|
132691
|
+
return results;
|
|
132692
|
+
};
|
|
132693
|
+
|
|
132694
|
+
var formatUtilities = {
|
|
132695
|
+
formatArcgisVector: formatArcgisVector,
|
|
132696
|
+
formatArcgisrest: formatArcgisrest
|
|
132697
|
+
};
|
|
132698
|
+
|
|
132662
132699
|
function formatUrl(options) {
|
|
132663
132700
|
var url = "".concat(options.root, "/identify?");
|
|
132664
132701
|
var params = [];
|
|
@@ -132771,7 +132808,7 @@ var bundle$1 = {
|
|
|
132771
132808
|
type: featureType,
|
|
132772
132809
|
coordinates: coords
|
|
132773
132810
|
},
|
|
132774
|
-
properties:
|
|
132811
|
+
properties: formatUtilities(feat.attributes)
|
|
132775
132812
|
};
|
|
132776
132813
|
})
|
|
132777
132814
|
})
|
|
@@ -161018,14 +161055,19 @@ var FavoritesToggle = function FavoritesToggle(props) {
|
|
|
161018
161055
|
var doToggleLayerFavoritesAdd = props.doToggleLayerFavoritesAdd,
|
|
161019
161056
|
layer = props.layer;
|
|
161020
161057
|
var btnTxt = layer.favorite ? "REMOVE FROM FAVORITE LAYERS" : "ADD TO FAVORITE LAYERS";
|
|
161021
|
-
|
|
161022
|
-
|
|
161023
|
-
|
|
161024
|
-
|
|
161025
|
-
|
|
161026
|
-
|
|
161027
|
-
|
|
161028
|
-
|
|
161058
|
+
|
|
161059
|
+
if (!layer.id) {
|
|
161060
|
+
return null;
|
|
161061
|
+
} else {
|
|
161062
|
+
return /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("button", {
|
|
161063
|
+
onClick: function onClick() {
|
|
161064
|
+
doToggleLayerFavoritesAdd(layer, !layer.favorite);
|
|
161065
|
+
},
|
|
161066
|
+
type: "button",
|
|
161067
|
+
className: "cm-btn cm-btn-xs cm-btn-default",
|
|
161068
|
+
title: btnTxt
|
|
161069
|
+
}, btnTxt));
|
|
161070
|
+
}
|
|
161029
161071
|
};
|
|
161030
161072
|
|
|
161031
161073
|
var FavoritesToggle$1 = connect("doToggleLayerFavoritesAdd", FavoritesToggle);
|
|
@@ -161034,14 +161076,19 @@ var DefaultsToggle = function DefaultsToggle(props) {
|
|
|
161034
161076
|
var doToggleUserDefaultLayersAdd = props.doToggleUserDefaultLayersAdd,
|
|
161035
161077
|
layer = props.layer;
|
|
161036
161078
|
var btnTxt = layer.userDefaultLayer ? "REMOVE FROM DEFAULT LAYERS" : "ADD TO DEFAULT LAYERS";
|
|
161037
|
-
|
|
161038
|
-
|
|
161039
|
-
|
|
161040
|
-
|
|
161041
|
-
|
|
161042
|
-
|
|
161043
|
-
|
|
161044
|
-
|
|
161079
|
+
|
|
161080
|
+
if (!layer.id) {
|
|
161081
|
+
return null;
|
|
161082
|
+
} else {
|
|
161083
|
+
return /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("button", {
|
|
161084
|
+
onClick: function onClick() {
|
|
161085
|
+
doToggleUserDefaultLayersAdd(layer, !layer.userDefaultLayer);
|
|
161086
|
+
},
|
|
161087
|
+
type: "button",
|
|
161088
|
+
className: "cm-btn cm-btn-xs cm-btn-default",
|
|
161089
|
+
title: btnTxt
|
|
161090
|
+
}, btnTxt));
|
|
161091
|
+
}
|
|
161045
161092
|
};
|
|
161046
161093
|
|
|
161047
161094
|
var DefaultsToggle$1 = connect("doToggleUserDefaultLayersAdd", DefaultsToggle);
|
|
@@ -161908,7 +161955,7 @@ var bundle$d = {
|
|
|
161908
161955
|
err: null,
|
|
161909
161956
|
result: _defineProperty({}, lyr.uid, {
|
|
161910
161957
|
type: "FeatureCollection",
|
|
161911
|
-
features: outFeatures
|
|
161958
|
+
features: formatUtilities.formatArcgisVector(outFeatures)
|
|
161912
161959
|
})
|
|
161913
161960
|
});
|
|
161914
161961
|
}
|
package/package.json
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@corpsmap/corpsmap",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "CorpsMap as React Components",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"prepublishOnly": "npm run release",
|
|
8
|
-
"release": "npm run build:dev && npm run build:prod",
|
|
9
|
-
"build:dev": "cross-env NODE_ENV=development rollup -c",
|
|
10
|
-
"build:prod": "cross-env NODE_ENV=production rollup -c",
|
|
11
|
-
"dev": "cross-env NODE_ENV=development rollup -c --watch",
|
|
12
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
13
|
-
"sample-app": "wait-on file:lib/dev.js && (cd ../corpsmap-test-app && npm run start)",
|
|
14
|
-
"dev-n-sample": "concurrently \"npm run dev\" \"npm run sample-app\""
|
|
15
|
-
},
|
|
16
|
-
"author": "willbreitkreutz",
|
|
17
|
-
"license": "MIT",
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"@babel/core": "^7.5.5",
|
|
20
|
-
"@babel/plugin-proposal-class-properties": "^7.5.5",
|
|
21
|
-
"@babel/preset-env": "^7.5.5",
|
|
22
|
-
"@babel/preset-react": "^7.0.0",
|
|
23
|
-
"babel-plugin-import": "^1.12.2",
|
|
24
|
-
"concurrently": "^5.3.0",
|
|
25
|
-
"cross-env": "^5.2.0",
|
|
26
|
-
"react": "^16.9.0",
|
|
27
|
-
"react-dom": "^16.9.0",
|
|
28
|
-
"rollup": "^1.20.2",
|
|
29
|
-
"rollup-plugin-babel": "^4.3.3",
|
|
30
|
-
"rollup-plugin-commonjs": "^10.1.0",
|
|
31
|
-
"rollup-plugin-css-only": "^1.0.0",
|
|
32
|
-
"rollup-plugin-json": "^4.0.0",
|
|
33
|
-
"rollup-plugin-node-resolve": "^5.2.0",
|
|
34
|
-
"rollup-plugin-postcss": "^2.0.3",
|
|
35
|
-
"rollup-plugin-replace": "^2.2.0",
|
|
36
|
-
"styled-jsx": "^3.2.1",
|
|
37
|
-
"wait-on": "^5.2.1"
|
|
38
|
-
},
|
|
39
|
-
"peerDependencies": {
|
|
40
|
-
"react": ">= 16.x.x",
|
|
41
|
-
"react-dom": ">=16.x.x"
|
|
42
|
-
},
|
|
43
|
-
"dependencies": {
|
|
44
|
-
"@mapbox/togeojson": "^0.16.0",
|
|
45
|
-
"@turf/bbox": "^6.0.1",
|
|
46
|
-
"@turf/bbox-polygon": "^6.0.1",
|
|
47
|
-
"@turf/boolean-crosses": "^6.0.1",
|
|
48
|
-
"@turf/boolean-disjoint": "^6.0.2",
|
|
49
|
-
"@turf/boolean-point-in-polygon": "^6.0.1",
|
|
50
|
-
"@turf/buffer": "^5.1.5",
|
|
51
|
-
"@turf/center-of-mass": "^6.0.1",
|
|
52
|
-
"@turf/centroid": "^6.0.2",
|
|
53
|
-
"@turf/distance": "^6.0.1",
|
|
54
|
-
"@turf/flatten": "^5.1.5",
|
|
55
|
-
"@turf/helpers": "^6.1.4",
|
|
56
|
-
"@turf/length": "^6.0.2",
|
|
57
|
-
"@turf/line-slice": "^5.1.5",
|
|
58
|
-
"async": "^2.6.1",
|
|
59
|
-
"classnames": "^2.2.5",
|
|
60
|
-
"css": "^2.2.4",
|
|
61
|
-
"decompress": "^4.2.1",
|
|
62
|
-
"extract-files": "^12.0.0",
|
|
63
|
-
"file-saver": "^2.0.2",
|
|
64
|
-
"is-html": "^2.0.0",
|
|
65
|
-
"jspdf": "^1.5.3",
|
|
66
|
-
"kmljs": "0.0.1",
|
|
67
|
-
"lodash": "^4.17.15",
|
|
68
|
-
"markdown-it": "^12.0.3",
|
|
69
|
-
"moment": "^2.24.0",
|
|
70
|
-
"money-clip": "^3.0.1",
|
|
71
|
-
"ol": "^6.4.3",
|
|
72
|
-
"ol-esri-style": "^2.0.7",
|
|
73
|
-
"parse2-kmz": "^1.0.5",
|
|
74
|
-
"proj4": "^2.4.4",
|
|
75
|
-
"react-data-grid": "^6.1.0",
|
|
76
|
-
"react-datepicker": "^2.9.6",
|
|
77
|
-
"react-dnd": "^9.4.0",
|
|
78
|
-
"react-dnd-html5-backend": "^9.4.0",
|
|
79
|
-
"react-notification-system": "^0.2.17",
|
|
80
|
-
"react-split": "^2.0.7",
|
|
81
|
-
"redux-bundler": "^26.0.0",
|
|
82
|
-
"redux-bundler-react": "^1.2.0",
|
|
83
|
-
"shpjs": "^3.4.3",
|
|
84
|
-
"uuid": "^3.3.3",
|
|
85
|
-
"xhr": "^2.5.0"
|
|
86
|
-
}
|
|
87
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@corpsmap/corpsmap",
|
|
3
|
+
"version": "3.1.1",
|
|
4
|
+
"description": "CorpsMap as React Components",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"prepublishOnly": "npm run release",
|
|
8
|
+
"release": "npm run build:dev && npm run build:prod",
|
|
9
|
+
"build:dev": "cross-env NODE_ENV=development rollup -c",
|
|
10
|
+
"build:prod": "cross-env NODE_ENV=production rollup -c",
|
|
11
|
+
"dev": "cross-env NODE_ENV=development rollup -c --watch",
|
|
12
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
13
|
+
"sample-app": "wait-on file:lib/dev.js && (cd ../corpsmap-test-app && npm run start)",
|
|
14
|
+
"dev-n-sample": "concurrently \"npm run dev\" \"npm run sample-app\""
|
|
15
|
+
},
|
|
16
|
+
"author": "willbreitkreutz",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@babel/core": "^7.5.5",
|
|
20
|
+
"@babel/plugin-proposal-class-properties": "^7.5.5",
|
|
21
|
+
"@babel/preset-env": "^7.5.5",
|
|
22
|
+
"@babel/preset-react": "^7.0.0",
|
|
23
|
+
"babel-plugin-import": "^1.12.2",
|
|
24
|
+
"concurrently": "^5.3.0",
|
|
25
|
+
"cross-env": "^5.2.0",
|
|
26
|
+
"react": "^16.9.0",
|
|
27
|
+
"react-dom": "^16.9.0",
|
|
28
|
+
"rollup": "^1.20.2",
|
|
29
|
+
"rollup-plugin-babel": "^4.3.3",
|
|
30
|
+
"rollup-plugin-commonjs": "^10.1.0",
|
|
31
|
+
"rollup-plugin-css-only": "^1.0.0",
|
|
32
|
+
"rollup-plugin-json": "^4.0.0",
|
|
33
|
+
"rollup-plugin-node-resolve": "^5.2.0",
|
|
34
|
+
"rollup-plugin-postcss": "^2.0.3",
|
|
35
|
+
"rollup-plugin-replace": "^2.2.0",
|
|
36
|
+
"styled-jsx": "^3.2.1",
|
|
37
|
+
"wait-on": "^5.2.1"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": ">= 16.x.x",
|
|
41
|
+
"react-dom": ">=16.x.x"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@mapbox/togeojson": "^0.16.0",
|
|
45
|
+
"@turf/bbox": "^6.0.1",
|
|
46
|
+
"@turf/bbox-polygon": "^6.0.1",
|
|
47
|
+
"@turf/boolean-crosses": "^6.0.1",
|
|
48
|
+
"@turf/boolean-disjoint": "^6.0.2",
|
|
49
|
+
"@turf/boolean-point-in-polygon": "^6.0.1",
|
|
50
|
+
"@turf/buffer": "^5.1.5",
|
|
51
|
+
"@turf/center-of-mass": "^6.0.1",
|
|
52
|
+
"@turf/centroid": "^6.0.2",
|
|
53
|
+
"@turf/distance": "^6.0.1",
|
|
54
|
+
"@turf/flatten": "^5.1.5",
|
|
55
|
+
"@turf/helpers": "^6.1.4",
|
|
56
|
+
"@turf/length": "^6.0.2",
|
|
57
|
+
"@turf/line-slice": "^5.1.5",
|
|
58
|
+
"async": "^2.6.1",
|
|
59
|
+
"classnames": "^2.2.5",
|
|
60
|
+
"css": "^2.2.4",
|
|
61
|
+
"decompress": "^4.2.1",
|
|
62
|
+
"extract-files": "^12.0.0",
|
|
63
|
+
"file-saver": "^2.0.2",
|
|
64
|
+
"is-html": "^2.0.0",
|
|
65
|
+
"jspdf": "^1.5.3",
|
|
66
|
+
"kmljs": "0.0.1",
|
|
67
|
+
"lodash": "^4.17.15",
|
|
68
|
+
"markdown-it": "^12.0.3",
|
|
69
|
+
"moment": "^2.24.0",
|
|
70
|
+
"money-clip": "^3.0.1",
|
|
71
|
+
"ol": "^6.4.3",
|
|
72
|
+
"ol-esri-style": "^2.0.7",
|
|
73
|
+
"parse2-kmz": "^1.0.5",
|
|
74
|
+
"proj4": "^2.4.4",
|
|
75
|
+
"react-data-grid": "^6.1.0",
|
|
76
|
+
"react-datepicker": "^2.9.6",
|
|
77
|
+
"react-dnd": "^9.4.0",
|
|
78
|
+
"react-dnd-html5-backend": "^9.4.0",
|
|
79
|
+
"react-notification-system": "^0.2.17",
|
|
80
|
+
"react-split": "^2.0.7",
|
|
81
|
+
"redux-bundler": "^26.0.0",
|
|
82
|
+
"redux-bundler-react": "^1.2.0",
|
|
83
|
+
"shpjs": "^3.4.3",
|
|
84
|
+
"uuid": "^3.3.3",
|
|
85
|
+
"xhr": "^2.5.0"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,58 +1,91 @@
|
|
|
1
|
-
import async from
|
|
2
|
-
import _ from
|
|
1
|
+
import async from "async";
|
|
2
|
+
import _ from "lodash";
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
name:
|
|
5
|
+
name: "search",
|
|
6
6
|
|
|
7
|
-
getReducer(){
|
|
7
|
+
getReducer() {
|
|
8
8
|
const initialData = {
|
|
9
9
|
shouldFireSearch: false,
|
|
10
|
-
q:
|
|
10
|
+
q: "",
|
|
11
11
|
selected: null,
|
|
12
12
|
onFireSearchListeners: [],
|
|
13
|
-
results: []
|
|
14
|
-
}
|
|
13
|
+
results: [],
|
|
14
|
+
};
|
|
15
15
|
|
|
16
|
-
return (state = initialData, {type, payload}) => {
|
|
17
|
-
if(type.indexOf(
|
|
16
|
+
return (state = initialData, { type, payload }) => {
|
|
17
|
+
if (type.indexOf("SEARCH_") !== -1) {
|
|
18
18
|
return Object.assign({}, state, payload);
|
|
19
19
|
}
|
|
20
20
|
return state;
|
|
21
|
-
}
|
|
21
|
+
};
|
|
22
22
|
},
|
|
23
23
|
|
|
24
|
-
doSearchAddCollection:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
24
|
+
doSearchAddCollection:
|
|
25
|
+
(options) =>
|
|
26
|
+
({ dispatch, store }) => {
|
|
27
|
+
const listeners = store.selectSearchOnFireSearchListeners();
|
|
28
|
+
if (options.onFireSearch) listeners.push(options.onFireSearch);
|
|
29
|
+
dispatch({
|
|
30
|
+
type: "SEARCH_COLLECTION_ADDED",
|
|
31
|
+
payload: {
|
|
32
|
+
onFireSearchListeners: listeners,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
doSearchShouldFire:
|
|
38
|
+
() =>
|
|
39
|
+
({ dispatch }) => {
|
|
40
|
+
dispatch({ type: "SEARCH_SHOULD_FIRE", payload: { shouldFire: true } });
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
doSearchSetQuery:
|
|
44
|
+
(q) =>
|
|
45
|
+
({ dispatch, store }) => {
|
|
46
|
+
dispatch({ type: "SEARCH_SET_QUERY", payload: { q: q, results: [] } });
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
doSearchSelectItem:
|
|
50
|
+
(item) =>
|
|
51
|
+
({ dispatch }) => {
|
|
52
|
+
dispatch({ type: "SEARCH_ITEM_SELECTED", payload: { selected: item } });
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
doSearchFire:
|
|
56
|
+
() =>
|
|
57
|
+
({ dispatch, store }) => {
|
|
58
|
+
dispatch({ type: "SEARCH_START", payload: { shouldFire: false } });
|
|
59
|
+
const listeners = store.selectSearchOnFireSearchListeners();
|
|
60
|
+
async.parallel(listeners, (err, r) => {
|
|
61
|
+
if (err)
|
|
62
|
+
return dispatch({
|
|
63
|
+
type: "SEARCH_ERROR",
|
|
64
|
+
payload: { err: err, results: [] },
|
|
65
|
+
});
|
|
51
66
|
const results = _.flatten(r);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
67
|
+
|
|
68
|
+
const sortedResultsGeo = [];
|
|
69
|
+
const sortedResultsWMS = [];
|
|
70
|
+
results.forEach((result) => {
|
|
71
|
+
if (result.provider !== "geocoder") {
|
|
72
|
+
sortedResultsWMS.push(result);
|
|
73
|
+
}
|
|
74
|
+
if (result.provider === "geocoder") {
|
|
75
|
+
sortedResultsGeo.push(result);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const sortedResults = [...sortedResultsWMS, ...sortedResultsGeo];
|
|
80
|
+
// Delete below after Testing
|
|
81
|
+
console.log(sortedResults);
|
|
82
|
+
|
|
83
|
+
dispatch({
|
|
84
|
+
type: "SEARCH_SUCCESS",
|
|
85
|
+
payload: { results: sortedResults },
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
},
|
|
56
89
|
|
|
57
90
|
selectSearchOnFireSearchListeners: (state) => {
|
|
58
91
|
return state.search.onFireSearchListeners;
|
|
@@ -67,9 +100,9 @@ export default {
|
|
|
67
100
|
},
|
|
68
101
|
|
|
69
102
|
reactSearchShouldFire: (state) => {
|
|
70
|
-
if(state.search.shouldFire) return { actionCreator:
|
|
71
|
-
}
|
|
72
|
-
}
|
|
103
|
+
if (state.search.shouldFire) return { actionCreator: "doSearchFire" };
|
|
104
|
+
},
|
|
105
|
+
};
|
|
73
106
|
|
|
74
107
|
// => add collection, should have a name and implement the following api:
|
|
75
108
|
|
|
@@ -88,4 +121,3 @@ export default {
|
|
|
88
121
|
// geometry: <object>, // geojson geometry
|
|
89
122
|
// properties: <object> // geojson properties
|
|
90
123
|
// }
|
|
91
|
-
|
|
@@ -5,6 +5,7 @@ import disjoint from "@turf/boolean-disjoint";
|
|
|
5
5
|
import bbox from "@turf/bbox";
|
|
6
6
|
import GeoJSON from "ol/format/GeoJSON";
|
|
7
7
|
import { transformExtent } from "ol/proj";
|
|
8
|
+
import formatUtilities from "../../openlayers-utils/format-utilities";
|
|
8
9
|
|
|
9
10
|
const geoJSON = new GeoJSON();
|
|
10
11
|
|
|
@@ -26,67 +27,71 @@ export default {
|
|
|
26
27
|
};
|
|
27
28
|
},
|
|
28
29
|
|
|
29
|
-
doVectorIdentRegister:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
doVectorIdentRegister:
|
|
31
|
+
() =>
|
|
32
|
+
({ dispatch, store }) => {
|
|
33
|
+
dispatch({
|
|
34
|
+
type: "VECTOR_IDENT_REGISTERED",
|
|
35
|
+
payload: { shouldRegister: false },
|
|
36
|
+
});
|
|
37
|
+
store.doIdentifyAddCollection({
|
|
38
|
+
onIdentify: store.doVectorIdentFire,
|
|
39
|
+
});
|
|
40
|
+
},
|
|
38
41
|
|
|
39
|
-
doVectorIdentFire:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
doVectorIdentFire:
|
|
43
|
+
(callback) =>
|
|
44
|
+
({ dispatch, store }) => {
|
|
45
|
+
const layers = store.selectVisibleLayers();
|
|
46
|
+
const coords = store.selectIdentifyCoordinates();
|
|
47
|
+
const resolution = store.selectResolution();
|
|
48
|
+
let identifyFeature = {};
|
|
49
|
+
const out = [];
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
if (typeof coords[0] === "number") {
|
|
52
|
+
const pt = point(coords);
|
|
53
|
+
const radius = (resolution * 5) / 1000;
|
|
54
|
+
identifyFeature = buffer(pt, radius, {
|
|
55
|
+
units: "kilometers",
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
identifyFeature = polygon(coords);
|
|
59
|
+
}
|
|
55
60
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
const identifyExtent = transformExtent(
|
|
62
|
+
bbox(identifyFeature),
|
|
63
|
+
"EPSG:4326",
|
|
64
|
+
"EPSG:3857"
|
|
65
|
+
);
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
layers.forEach((lyr) => {
|
|
68
|
+
if (lyr.identifyType === "arcgisvector") {
|
|
69
|
+
const { mapLayer } = lyr;
|
|
70
|
+
const outFeatures = [];
|
|
71
|
+
const src = mapLayer.getSource();
|
|
72
|
+
src.forEachFeatureIntersectingExtent(identifyExtent, (f) => {
|
|
73
|
+
const geoJsonFeature = geoJSON.writeFeatureObject(f, {
|
|
74
|
+
featureProjection: "EPSG:3857",
|
|
75
|
+
dataProjection: "EPSG:4326",
|
|
76
|
+
});
|
|
77
|
+
if (!disjoint(identifyFeature, geoJsonFeature))
|
|
78
|
+
outFeatures.push(geoJsonFeature);
|
|
71
79
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
type: "FeatureCollection",
|
|
82
|
-
features: outFeatures,
|
|
80
|
+
out.push({
|
|
81
|
+
dataset: lyr.uid,
|
|
82
|
+
layerName: lyr.displayName,
|
|
83
|
+
err: null,
|
|
84
|
+
result: {
|
|
85
|
+
[lyr.uid]: {
|
|
86
|
+
type: "FeatureCollection",
|
|
87
|
+
features: formatUtilities.formatArcgisVector(outFeatures),
|
|
88
|
+
},
|
|
83
89
|
},
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return callback(null, out);
|
|
94
|
+
},
|
|
90
95
|
|
|
91
96
|
reactVectorIdentShouldRegister: (state) => {
|
|
92
97
|
if (state.vectorIdent.shouldRegister)
|
|
@@ -3,21 +3,26 @@ import { connect } from "redux-bundler-react";
|
|
|
3
3
|
|
|
4
4
|
const DefaultsToggle = (props) => {
|
|
5
5
|
const { doToggleUserDefaultLayersAdd, layer } = props;
|
|
6
|
-
const btnTxt = layer.userDefaultLayer
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
const btnTxt = layer.userDefaultLayer
|
|
7
|
+
? "REMOVE FROM DEFAULT LAYERS"
|
|
8
|
+
: "ADD TO DEFAULT LAYERS";
|
|
9
|
+
if (!layer.id) {
|
|
10
|
+
return null;
|
|
11
|
+
} else {
|
|
12
|
+
return (
|
|
13
|
+
<div>
|
|
14
|
+
<button
|
|
15
|
+
onClick={() => {
|
|
16
|
+
doToggleUserDefaultLayersAdd(layer, !layer.userDefaultLayer);
|
|
17
|
+
}}
|
|
18
|
+
type="button"
|
|
19
|
+
className="cm-btn cm-btn-xs cm-btn-default"
|
|
20
|
+
title={btnTxt}
|
|
21
|
+
>
|
|
22
|
+
{btnTxt}
|
|
23
|
+
</button>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
22
27
|
};
|
|
23
|
-
export default connect("doToggleUserDefaultLayersAdd", DefaultsToggle);
|
|
28
|
+
export default connect("doToggleUserDefaultLayersAdd", DefaultsToggle);
|
|
@@ -3,21 +3,26 @@ import { connect } from "redux-bundler-react";
|
|
|
3
3
|
|
|
4
4
|
const FavoritesToggle = (props) => {
|
|
5
5
|
const { doToggleLayerFavoritesAdd, layer } = props;
|
|
6
|
-
const btnTxt = layer.favorite
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
const btnTxt = layer.favorite
|
|
7
|
+
? "REMOVE FROM FAVORITE LAYERS"
|
|
8
|
+
: "ADD TO FAVORITE LAYERS";
|
|
9
|
+
if (!layer.id) {
|
|
10
|
+
return null;
|
|
11
|
+
} else {
|
|
12
|
+
return (
|
|
13
|
+
<div>
|
|
14
|
+
<button
|
|
15
|
+
onClick={() => {
|
|
16
|
+
doToggleLayerFavoritesAdd(layer, !layer.favorite);
|
|
17
|
+
}}
|
|
18
|
+
type="button"
|
|
19
|
+
className="cm-btn cm-btn-xs cm-btn-default"
|
|
20
|
+
title={btnTxt}
|
|
21
|
+
>
|
|
22
|
+
{btnTxt}
|
|
23
|
+
</button>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
22
27
|
};
|
|
23
28
|
export default connect("doToggleLayerFavoritesAdd", FavoritesToggle);
|
|
@@ -12,4 +12,23 @@ const formatArcgisrest = function (attributes) {
|
|
|
12
12
|
return attributes;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const formatArcgisVector = function (results) {
|
|
16
|
+
results.map((feat) => {
|
|
17
|
+
for (const [key, value] of Object.entries(feat.properties)) {
|
|
18
|
+
const result =
|
|
19
|
+
String(value).includes("https:") || String(value).includes("http:")
|
|
20
|
+
? value
|
|
21
|
+
: null;
|
|
22
|
+
|
|
23
|
+
if (result) {
|
|
24
|
+
feat.properties[
|
|
25
|
+
key
|
|
26
|
+
] = `<a href="${value}" target="_new" > ${value} </a>`;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// results.properties = feat.properties;
|
|
30
|
+
});
|
|
31
|
+
return results;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default { formatArcgisVector, formatArcgisrest };
|