@corpsmap/corpsmap 3.0.19 → 3.1.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/lib/dev.js CHANGED
@@ -65287,9 +65287,9 @@ function getXyzSource(options) {
65287
65287
  maxZoom: options.maxzoom,
65288
65288
  minZoom: options.minzoom,
65289
65289
  url: url,
65290
- crossOrigin: isCrossOrigin(options.url),
65291
- // CWBI-13636 Prevent horizontal wrapping.
65292
- wrapX: false
65290
+ crossOrigin: isCrossOrigin(options.url) // CWBI-13636 Prevent horizontal wrapping. Uncomment to limit
65291
+ // wrapX: false,
65292
+
65293
65293
  });
65294
65294
  }
65295
65295
 
@@ -65383,8 +65383,8 @@ function getEsriVectorSource(options) {
65383
65383
  }
65384
65384
 
65385
65385
  function getTileLayer(options, source) {
65386
- // CWBI-13636 Prevent horizontal wrapping.
65387
- source.wrapX = false;
65386
+ // CWBI-13636 Prevent horizontal wrapping. Uncomment to limit
65387
+ // source.wrapX = false;
65388
65388
  return new TileLayer({
65389
65389
  source: source,
65390
65390
  visible: options.visible,
@@ -65396,8 +65396,8 @@ function getTileLayer(options, source) {
65396
65396
  }
65397
65397
 
65398
65398
  function getImageLayer(options, source) {
65399
- // CWBI-13636 Prevent horizontal wrapping.
65400
- source.wrapX = false;
65399
+ // CWBI-13636 Prevent horizontal wrapping. Uncomment to limit
65400
+ // source.wrapX = false;
65401
65401
  return new ImageLayer({
65402
65402
  source: source,
65403
65403
  visible: options.visible,
@@ -79054,9 +79054,9 @@ var createOlMapBundle = (function (opts) {
79054
79054
  var dispatch = _ref2.dispatch,
79055
79055
  store = _ref2.store;
79056
79056
  var geoProjection = store.selectMapGeoProjection();
79057
- var webProjection = store.selectMapWebProjection(); // CWBI-13636 Limit Map Extent
79057
+ var webProjection = store.selectMapWebProjection(); // CWBI-13636 Limit Map Extent uncomment to limit
79058
+ // const extent = transformExtent([-180, -85, 180, 85], geoProjection, webProjection)
79058
79059
 
79059
- var extent = transformExtent([-180, -85, 180, 85], geoProjection, webProjection);
79060
79060
  var center = opts.hasOwnProperty("center") ? opts.center : store.selectMapCenter();
79061
79061
  var zoom = opts.hasOwnProperty("zoom") ? opts.zoom : store.selectMapZoom();
79062
79062
  var rotation = opts.hasOwnProperty("rotation") ? opts.rotation : store.selectMapRotation();
@@ -79068,8 +79068,9 @@ var createOlMapBundle = (function (opts) {
79068
79068
  zoom: zoom,
79069
79069
  rotation: rotation,
79070
79070
  minZoom: minZoom,
79071
- maxZoom: maxZoom,
79072
- extent: extent
79071
+ maxZoom: maxZoom // CWBI-13636 Limit Map Extent uncomment to limit
79072
+ // extent: extent,
79073
+
79073
79074
  });
79074
79075
  var map = new Map$3({
79075
79076
  controls: [new ScaleLine({
@@ -105538,11 +105539,11 @@ var primaryPanelBundle = createContainerBundle({
105538
105539
  });
105539
105540
 
105540
105541
  var searchBundle = {
105541
- name: 'search',
105542
+ name: "search",
105542
105543
  getReducer: function getReducer() {
105543
105544
  var initialData = {
105544
105545
  shouldFireSearch: false,
105545
- q: '',
105546
+ q: "",
105546
105547
  selected: null,
105547
105548
  onFireSearchListeners: [],
105548
105549
  results: []
@@ -105554,7 +105555,7 @@ var searchBundle = {
105554
105555
  type = _ref.type,
105555
105556
  payload = _ref.payload;
105556
105557
 
105557
- if (type.indexOf('SEARCH_') !== -1) {
105558
+ if (type.indexOf("SEARCH_") !== -1) {
105558
105559
  return Object.assign({}, state, payload);
105559
105560
  }
105560
105561
 
@@ -105568,7 +105569,7 @@ var searchBundle = {
105568
105569
  var listeners = store.selectSearchOnFireSearchListeners();
105569
105570
  if (options.onFireSearch) listeners.push(options.onFireSearch);
105570
105571
  dispatch({
105571
- type: 'SEARCH_COLLECTION_ADDED',
105572
+ type: "SEARCH_COLLECTION_ADDED",
105572
105573
  payload: {
105573
105574
  onFireSearchListeners: listeners
105574
105575
  }
@@ -105579,7 +105580,7 @@ var searchBundle = {
105579
105580
  return function (_ref3) {
105580
105581
  var dispatch = _ref3.dispatch;
105581
105582
  dispatch({
105582
- type: 'SEARCH_SHOULD_FIRE',
105583
+ type: "SEARCH_SHOULD_FIRE",
105583
105584
  payload: {
105584
105585
  shouldFire: true
105585
105586
  }
@@ -105591,7 +105592,7 @@ var searchBundle = {
105591
105592
  var dispatch = _ref4.dispatch,
105592
105593
  store = _ref4.store;
105593
105594
  dispatch({
105594
- type: 'SEARCH_SET_QUERY',
105595
+ type: "SEARCH_SET_QUERY",
105595
105596
  payload: {
105596
105597
  q: q,
105597
105598
  results: []
@@ -105603,7 +105604,7 @@ var searchBundle = {
105603
105604
  return function (_ref5) {
105604
105605
  var dispatch = _ref5.dispatch;
105605
105606
  dispatch({
105606
- type: 'SEARCH_ITEM_SELECTED',
105607
+ type: "SEARCH_ITEM_SELECTED",
105607
105608
  payload: {
105608
105609
  selected: item
105609
105610
  }
@@ -105615,7 +105616,7 @@ var searchBundle = {
105615
105616
  var dispatch = _ref6.dispatch,
105616
105617
  store = _ref6.store;
105617
105618
  dispatch({
105618
- type: 'SEARCH_START',
105619
+ type: "SEARCH_START",
105619
105620
  payload: {
105620
105621
  shouldFire: false
105621
105622
  }
@@ -105623,7 +105624,7 @@ var searchBundle = {
105623
105624
  var listeners = store.selectSearchOnFireSearchListeners();
105624
105625
  async$1.parallel(listeners, function (err, r) {
105625
105626
  if (err) return dispatch({
105626
- type: 'SEARCH_ERROR',
105627
+ type: "SEARCH_ERROR",
105627
105628
  payload: {
105628
105629
  err: err,
105629
105630
  results: []
@@ -105632,10 +105633,24 @@ var searchBundle = {
105632
105633
 
105633
105634
  var results = lodash.flatten(r);
105634
105635
 
105636
+ var sortedResultsGeo = [];
105637
+ var sortedResultsWMS = [];
105638
+ results.forEach(function (result) {
105639
+ if (result.provider !== "geocoder") {
105640
+ sortedResultsWMS.push(result);
105641
+ }
105642
+
105643
+ if (result.provider === "geocoder") {
105644
+ sortedResultsGeo.push(result);
105645
+ }
105646
+ });
105647
+ var sortedResults = [].concat(sortedResultsWMS, sortedResultsGeo); // Delete below after Testing
105648
+
105649
+ console.log(sortedResults);
105635
105650
  dispatch({
105636
- type: 'SEARCH_SUCCESS',
105651
+ type: "SEARCH_SUCCESS",
105637
105652
  payload: {
105638
- results: results
105653
+ results: sortedResults
105639
105654
  }
105640
105655
  });
105641
105656
  });
@@ -105652,7 +105667,7 @@ var searchBundle = {
105652
105667
  },
105653
105668
  reactSearchShouldFire: function reactSearchShouldFire(state) {
105654
105669
  if (state.search.shouldFire) return {
105655
- actionCreator: 'doSearchFire'
105670
+ actionCreator: "doSearchFire"
105656
105671
  };
105657
105672
  }
105658
105673
  }; // => add collection, should have a name and implement the following api:
@@ -106470,7 +106485,7 @@ var config = {
106470
106485
  };
106471
106486
 
106472
106487
  var name = "@corpsmap/corpsmap";
106473
- var version$1 = "3.0.19";
106488
+ var version$1 = "3.1.2";
106474
106489
  var description = "CorpsMap as React Components";
106475
106490
  var main = "index.js";
106476
106491
  var scripts = {
@@ -132745,6 +132760,29 @@ var formatArcgisrest = function formatArcgisrest(attributes) {
132745
132760
  return attributes;
132746
132761
  };
132747
132762
 
132763
+ var formatArcgisVector = function formatArcgisVector(results) {
132764
+ results.map(function (feat) {
132765
+ for (var _i2 = 0, _Object$entries2 = Object.entries(feat.properties); _i2 < _Object$entries2.length; _i2++) {
132766
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
132767
+ key = _Object$entries2$_i[0],
132768
+ value = _Object$entries2$_i[1];
132769
+
132770
+ var result = String(value).includes("https:") || String(value).includes("http:") ? value : null;
132771
+
132772
+ if (result) {
132773
+ feat.properties[key] = "<a href=\"".concat(value, "\" target=\"_new\" > ").concat(value, " </a>");
132774
+ }
132775
+ } // results.properties = feat.properties;
132776
+
132777
+ });
132778
+ return results;
132779
+ };
132780
+
132781
+ var formatUtilities = {
132782
+ formatArcgisVector: formatArcgisVector,
132783
+ formatArcgisrest: formatArcgisrest
132784
+ };
132785
+
132748
132786
  function formatUrl(options) {
132749
132787
  var url = "".concat(options.root, "/identify?");
132750
132788
  var params = [];
@@ -132857,7 +132895,7 @@ var bundle$1 = {
132857
132895
  type: featureType,
132858
132896
  coordinates: coords
132859
132897
  },
132860
- properties: formatArcgisrest(feat.attributes)
132898
+ properties: formatUtilities(feat.attributes)
132861
132899
  };
132862
132900
  })
132863
132901
  })
@@ -162004,7 +162042,7 @@ var bundle$d = {
162004
162042
  err: null,
162005
162043
  result: _defineProperty({}, lyr.uid, {
162006
162044
  type: "FeatureCollection",
162007
- features: outFeatures
162045
+ features: formatUtilities.formatArcgisVector(outFeatures)
162008
162046
  })
162009
162047
  });
162010
162048
  }
package/lib/prod.js CHANGED
@@ -65201,9 +65201,9 @@ function getXyzSource(options) {
65201
65201
  maxZoom: options.maxzoom,
65202
65202
  minZoom: options.minzoom,
65203
65203
  url: url,
65204
- crossOrigin: isCrossOrigin(options.url),
65205
- // CWBI-13636 Prevent horizontal wrapping.
65206
- wrapX: false
65204
+ crossOrigin: isCrossOrigin(options.url) // CWBI-13636 Prevent horizontal wrapping. Uncomment to limit
65205
+ // wrapX: false,
65206
+
65207
65207
  });
65208
65208
  }
65209
65209
 
@@ -65297,8 +65297,8 @@ function getEsriVectorSource(options) {
65297
65297
  }
65298
65298
 
65299
65299
  function getTileLayer(options, source) {
65300
- // CWBI-13636 Prevent horizontal wrapping.
65301
- source.wrapX = false;
65300
+ // CWBI-13636 Prevent horizontal wrapping. Uncomment to limit
65301
+ // source.wrapX = false;
65302
65302
  return new TileLayer({
65303
65303
  source: source,
65304
65304
  visible: options.visible,
@@ -65310,8 +65310,8 @@ function getTileLayer(options, source) {
65310
65310
  }
65311
65311
 
65312
65312
  function getImageLayer(options, source) {
65313
- // CWBI-13636 Prevent horizontal wrapping.
65314
- source.wrapX = false;
65313
+ // CWBI-13636 Prevent horizontal wrapping. Uncomment to limit
65314
+ // source.wrapX = false;
65315
65315
  return new ImageLayer({
65316
65316
  source: source,
65317
65317
  visible: options.visible,
@@ -78968,9 +78968,9 @@ var createOlMapBundle = (function (opts) {
78968
78968
  var dispatch = _ref2.dispatch,
78969
78969
  store = _ref2.store;
78970
78970
  var geoProjection = store.selectMapGeoProjection();
78971
- var webProjection = store.selectMapWebProjection(); // CWBI-13636 Limit Map Extent
78971
+ var webProjection = store.selectMapWebProjection(); // CWBI-13636 Limit Map Extent uncomment to limit
78972
+ // const extent = transformExtent([-180, -85, 180, 85], geoProjection, webProjection)
78972
78973
 
78973
- var extent = transformExtent([-180, -85, 180, 85], geoProjection, webProjection);
78974
78974
  var center = opts.hasOwnProperty("center") ? opts.center : store.selectMapCenter();
78975
78975
  var zoom = opts.hasOwnProperty("zoom") ? opts.zoom : store.selectMapZoom();
78976
78976
  var rotation = opts.hasOwnProperty("rotation") ? opts.rotation : store.selectMapRotation();
@@ -78982,8 +78982,9 @@ var createOlMapBundle = (function (opts) {
78982
78982
  zoom: zoom,
78983
78983
  rotation: rotation,
78984
78984
  minZoom: minZoom,
78985
- maxZoom: maxZoom,
78986
- extent: extent
78985
+ maxZoom: maxZoom // CWBI-13636 Limit Map Extent uncomment to limit
78986
+ // extent: extent,
78987
+
78987
78988
  });
78988
78989
  var map = new Map$3({
78989
78990
  controls: [new ScaleLine({
@@ -105452,11 +105453,11 @@ var primaryPanelBundle = createContainerBundle({
105452
105453
  });
105453
105454
 
105454
105455
  var searchBundle = {
105455
- name: 'search',
105456
+ name: "search",
105456
105457
  getReducer: function getReducer() {
105457
105458
  var initialData = {
105458
105459
  shouldFireSearch: false,
105459
- q: '',
105460
+ q: "",
105460
105461
  selected: null,
105461
105462
  onFireSearchListeners: [],
105462
105463
  results: []
@@ -105468,7 +105469,7 @@ var searchBundle = {
105468
105469
  type = _ref.type,
105469
105470
  payload = _ref.payload;
105470
105471
 
105471
- if (type.indexOf('SEARCH_') !== -1) {
105472
+ if (type.indexOf("SEARCH_") !== -1) {
105472
105473
  return Object.assign({}, state, payload);
105473
105474
  }
105474
105475
 
@@ -105482,7 +105483,7 @@ var searchBundle = {
105482
105483
  var listeners = store.selectSearchOnFireSearchListeners();
105483
105484
  if (options.onFireSearch) listeners.push(options.onFireSearch);
105484
105485
  dispatch({
105485
- type: 'SEARCH_COLLECTION_ADDED',
105486
+ type: "SEARCH_COLLECTION_ADDED",
105486
105487
  payload: {
105487
105488
  onFireSearchListeners: listeners
105488
105489
  }
@@ -105493,7 +105494,7 @@ var searchBundle = {
105493
105494
  return function (_ref3) {
105494
105495
  var dispatch = _ref3.dispatch;
105495
105496
  dispatch({
105496
- type: 'SEARCH_SHOULD_FIRE',
105497
+ type: "SEARCH_SHOULD_FIRE",
105497
105498
  payload: {
105498
105499
  shouldFire: true
105499
105500
  }
@@ -105505,7 +105506,7 @@ var searchBundle = {
105505
105506
  var dispatch = _ref4.dispatch,
105506
105507
  store = _ref4.store;
105507
105508
  dispatch({
105508
- type: 'SEARCH_SET_QUERY',
105509
+ type: "SEARCH_SET_QUERY",
105509
105510
  payload: {
105510
105511
  q: q,
105511
105512
  results: []
@@ -105517,7 +105518,7 @@ var searchBundle = {
105517
105518
  return function (_ref5) {
105518
105519
  var dispatch = _ref5.dispatch;
105519
105520
  dispatch({
105520
- type: 'SEARCH_ITEM_SELECTED',
105521
+ type: "SEARCH_ITEM_SELECTED",
105521
105522
  payload: {
105522
105523
  selected: item
105523
105524
  }
@@ -105529,7 +105530,7 @@ var searchBundle = {
105529
105530
  var dispatch = _ref6.dispatch,
105530
105531
  store = _ref6.store;
105531
105532
  dispatch({
105532
- type: 'SEARCH_START',
105533
+ type: "SEARCH_START",
105533
105534
  payload: {
105534
105535
  shouldFire: false
105535
105536
  }
@@ -105537,7 +105538,7 @@ var searchBundle = {
105537
105538
  var listeners = store.selectSearchOnFireSearchListeners();
105538
105539
  async$1.parallel(listeners, function (err, r) {
105539
105540
  if (err) return dispatch({
105540
- type: 'SEARCH_ERROR',
105541
+ type: "SEARCH_ERROR",
105541
105542
  payload: {
105542
105543
  err: err,
105543
105544
  results: []
@@ -105546,10 +105547,24 @@ var searchBundle = {
105546
105547
 
105547
105548
  var results = lodash.flatten(r);
105548
105549
 
105550
+ var sortedResultsGeo = [];
105551
+ var sortedResultsWMS = [];
105552
+ results.forEach(function (result) {
105553
+ if (result.provider !== "geocoder") {
105554
+ sortedResultsWMS.push(result);
105555
+ }
105556
+
105557
+ if (result.provider === "geocoder") {
105558
+ sortedResultsGeo.push(result);
105559
+ }
105560
+ });
105561
+ var sortedResults = [].concat(sortedResultsWMS, sortedResultsGeo); // Delete below after Testing
105562
+
105563
+ console.log(sortedResults);
105549
105564
  dispatch({
105550
- type: 'SEARCH_SUCCESS',
105565
+ type: "SEARCH_SUCCESS",
105551
105566
  payload: {
105552
- results: results
105567
+ results: sortedResults
105553
105568
  }
105554
105569
  });
105555
105570
  });
@@ -105566,7 +105581,7 @@ var searchBundle = {
105566
105581
  },
105567
105582
  reactSearchShouldFire: function reactSearchShouldFire(state) {
105568
105583
  if (state.search.shouldFire) return {
105569
- actionCreator: 'doSearchFire'
105584
+ actionCreator: "doSearchFire"
105570
105585
  };
105571
105586
  }
105572
105587
  }; // => add collection, should have a name and implement the following api:
@@ -106384,7 +106399,7 @@ var config = {
106384
106399
  };
106385
106400
 
106386
106401
  var name = "@corpsmap/corpsmap";
106387
- var version$1 = "3.0.19";
106402
+ var version$1 = "3.1.2";
106388
106403
  var description = "CorpsMap as React Components";
106389
106404
  var main = "index.js";
106390
106405
  var scripts = {
@@ -132659,6 +132674,29 @@ var formatArcgisrest = function formatArcgisrest(attributes) {
132659
132674
  return attributes;
132660
132675
  };
132661
132676
 
132677
+ var formatArcgisVector = function formatArcgisVector(results) {
132678
+ results.map(function (feat) {
132679
+ for (var _i2 = 0, _Object$entries2 = Object.entries(feat.properties); _i2 < _Object$entries2.length; _i2++) {
132680
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
132681
+ key = _Object$entries2$_i[0],
132682
+ value = _Object$entries2$_i[1];
132683
+
132684
+ var result = String(value).includes("https:") || String(value).includes("http:") ? value : null;
132685
+
132686
+ if (result) {
132687
+ feat.properties[key] = "<a href=\"".concat(value, "\" target=\"_new\" > ").concat(value, " </a>");
132688
+ }
132689
+ } // results.properties = feat.properties;
132690
+
132691
+ });
132692
+ return results;
132693
+ };
132694
+
132695
+ var formatUtilities = {
132696
+ formatArcgisVector: formatArcgisVector,
132697
+ formatArcgisrest: formatArcgisrest
132698
+ };
132699
+
132662
132700
  function formatUrl(options) {
132663
132701
  var url = "".concat(options.root, "/identify?");
132664
132702
  var params = [];
@@ -132771,7 +132809,7 @@ var bundle$1 = {
132771
132809
  type: featureType,
132772
132810
  coordinates: coords
132773
132811
  },
132774
- properties: formatArcgisrest(feat.attributes)
132812
+ properties: formatUtilities(feat.attributes)
132775
132813
  };
132776
132814
  })
132777
132815
  })
@@ -161918,7 +161956,7 @@ var bundle$d = {
161918
161956
  err: null,
161919
161957
  result: _defineProperty({}, lyr.uid, {
161920
161958
  type: "FeatureCollection",
161921
- features: outFeatures
161959
+ features: formatUtilities.formatArcgisVector(outFeatures)
161922
161960
  })
161923
161961
  });
161924
161962
  }
package/package.json CHANGED
@@ -1,87 +1,87 @@
1
- {
2
- "name": "@corpsmap/corpsmap",
3
- "version": "3.0.19",
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.2",
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
+ }
@@ -63,8 +63,8 @@ export default (opts) => {
63
63
  doMapInitialize: (el, opts) => ({ dispatch, store }) => {
64
64
  const geoProjection = store.selectMapGeoProjection();
65
65
  const webProjection = store.selectMapWebProjection();
66
- // CWBI-13636 Limit Map Extent
67
- const extent = transformExtent([-180, -85, 180, 85], geoProjection, webProjection)
66
+ // CWBI-13636 Limit Map Extent uncomment to limit
67
+ // const extent = transformExtent([-180, -85, 180, 85], geoProjection, webProjection)
68
68
  const center = opts.hasOwnProperty("center")
69
69
  ? opts.center
70
70
  : store.selectMapCenter();
@@ -89,7 +89,8 @@ export default (opts) => {
89
89
  rotation: rotation,
90
90
  minZoom: minZoom,
91
91
  maxZoom: maxZoom,
92
- extent: extent,
92
+ // CWBI-13636 Limit Map Extent uncomment to limit
93
+ // extent: extent,
93
94
  });
94
95
 
95
96
  const map = new olMap({
@@ -1,58 +1,91 @@
1
- import async from 'async';
2
- import _ from 'lodash';
1
+ import async from "async";
2
+ import _ from "lodash";
3
3
 
4
4
  export default {
5
- name: 'search',
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('SEARCH_') !== -1){
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: (options) => ({ dispatch, store }) => {
25
- const listeners = store.selectSearchOnFireSearchListeners();
26
- if(options.onFireSearch) listeners.push(options.onFireSearch);
27
- dispatch({ type: 'SEARCH_COLLECTION_ADDED', payload: {
28
- onFireSearchListeners: listeners
29
- }})
30
- },
31
-
32
- doSearchShouldFire: () => ({dispatch}) => {
33
- dispatch({ type:'SEARCH_SHOULD_FIRE', payload: { shouldFire: true }});
34
- },
35
-
36
- doSearchSetQuery: (q) => ({ dispatch, store }) => {
37
- dispatch({ type:'SEARCH_SET_QUERY', payload: { q: q, results: [] }});
38
- },
39
-
40
- doSearchSelectItem: (item) => ({dispatch}) => {
41
- dispatch({ type:'SEARCH_ITEM_SELECTED', payload: { selected: item }})
42
- },
43
-
44
- doSearchFire: () => ({ dispatch, store }) => {
45
- dispatch({ type: 'SEARCH_START', payload: { shouldFire: false }});
46
- const listeners = store.selectSearchOnFireSearchListeners();
47
- async.parallel(
48
- listeners,
49
- (err, r) => {
50
- if(err) return dispatch({ type: 'SEARCH_ERROR', payload: { err: err, results: []}})
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
- dispatch({ type: 'SEARCH_SUCCESS', payload: { results: results }});
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: 'doSearchFire' };
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: () => ({ dispatch, store }) => {
30
- dispatch({
31
- type: "VECTOR_IDENT_REGISTERED",
32
- payload: { shouldRegister: false },
33
- });
34
- store.doIdentifyAddCollection({
35
- onIdentify: store.doVectorIdentFire,
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: (callback) => ({ dispatch, store }) => {
40
- const layers = store.selectVisibleLayers();
41
- const coords = store.selectIdentifyCoordinates();
42
- const resolution = store.selectResolution();
43
- let identifyFeature = {};
44
- const out = [];
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
- if (typeof coords[0] === "number") {
47
- const pt = point(coords);
48
- const radius = (resolution * 5) / 1000;
49
- identifyFeature = buffer(pt, radius, {
50
- units: "kilometers",
51
- });
52
- } else {
53
- identifyFeature = polygon(coords);
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
- const identifyExtent = transformExtent(
57
- bbox(identifyFeature),
58
- "EPSG:4326",
59
- "EPSG:3857"
60
- );
61
+ const identifyExtent = transformExtent(
62
+ bbox(identifyFeature),
63
+ "EPSG:4326",
64
+ "EPSG:3857"
65
+ );
61
66
 
62
- layers.forEach((lyr) => {
63
- if (lyr.identifyType === "arcgisvector") {
64
- const { mapLayer } = lyr;
65
- const outFeatures = [];
66
- const src = mapLayer.getSource();
67
- src.forEachFeatureIntersectingExtent(identifyExtent, (f) => {
68
- const geoJsonFeature = geoJSON.writeFeatureObject(f, {
69
- featureProjection: "EPSG:3857",
70
- dataProjection: "EPSG:4326",
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
- if (!disjoint(identifyFeature, geoJsonFeature))
73
- outFeatures.push(geoJsonFeature);
74
- });
75
- out.push({
76
- dataset: lyr.uid,
77
- layerName: lyr.displayName,
78
- err: null,
79
- result: {
80
- [lyr.uid]: {
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
- return callback(null, out);
89
- },
90
+ });
91
+ }
92
+ });
93
+ return callback(null, out);
94
+ },
90
95
 
91
96
  reactVectorIdentShouldRegister: (state) => {
92
97
  if (state.vectorIdent.shouldRegister)
@@ -12,4 +12,23 @@ const formatArcgisrest = function (attributes) {
12
12
  return attributes;
13
13
  };
14
14
 
15
- export default formatArcgisrest;
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 };
@@ -70,8 +70,8 @@ function getXyzSource(options) {
70
70
  minZoom: options.minzoom,
71
71
  url: url,
72
72
  crossOrigin: isCrossOrigin(options.url),
73
- // CWBI-13636 Prevent horizontal wrapping.
74
- wrapX: false,
73
+ // CWBI-13636 Prevent horizontal wrapping. Uncomment to limit
74
+ // wrapX: false,
75
75
  });
76
76
  }
77
77
 
@@ -168,8 +168,8 @@ function getEsriVectorSource(options) {
168
168
  }
169
169
 
170
170
  function getTileLayer(options, source) {
171
- // CWBI-13636 Prevent horizontal wrapping.
172
- source.wrapX = false;
171
+ // CWBI-13636 Prevent horizontal wrapping. Uncomment to limit
172
+ // source.wrapX = false;
173
173
  return new Tile({
174
174
  source: source,
175
175
  visible: options.visible,
@@ -181,8 +181,8 @@ function getTileLayer(options, source) {
181
181
  }
182
182
 
183
183
  function getImageLayer(options, source) {
184
- // CWBI-13636 Prevent horizontal wrapping.
185
- source.wrapX = false;
184
+ // CWBI-13636 Prevent horizontal wrapping. Uncomment to limit
185
+ // source.wrapX = false;
186
186
  return new Image({
187
187
  source: source,
188
188
  visible: options.visible,