@corpsmap/corpsmap 3.2.76 → 3.2.77

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corpsmap/corpsmap",
3
- "version": "3.2.76",
3
+ "version": "3.2.77",
4
4
  "description": "CorpsMap as React Components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,27 +16,30 @@
16
16
  "author": "willbreitkreutz",
17
17
  "license": "MIT",
18
18
  "devDependencies": {
19
- "@babel/core": "^7.5.5",
20
- "@babel/eslint-parser": "^7.28.5",
21
- "@babel/plugin-proposal-class-properties": "^7.5.5",
19
+ "@babel/cli": "^7.28.3",
20
+ "@babel/core": "^7.28.5",
21
+ "@babel/eslint-parser": "^7.26.10",
22
+ "@babel/plugin-transform-class-properties": "^7.27.1",
22
23
  "@babel/plugin-transform-numeric-separator": "^7.27.1",
23
- "@babel/preset-env": "^7.5.5",
24
- "@babel/preset-react": "^7.0.0",
25
- "babel-plugin-import": "^1.12.2",
24
+ "@babel/preset-env": "^7.28.5",
25
+ "@babel/preset-react": "^7.28.5",
26
+ "@rollup/plugin-babel": "^6.0.3",
27
+ "@rollup/plugin-commonjs": "^28.0.9",
28
+ "@rollup/plugin-json": "^6.0.0",
29
+ "@rollup/plugin-node-resolve": "^13.0.6",
30
+ "@rollup/plugin-replace": "^6.0.2",
31
+ "@rollup/plugin-terser": "^0.4.4",
32
+ "babel-loader": "^10.0.0",
33
+ "babel-plugin-import": "^1.13.8",
26
34
  "concurrently": "^5.3.0",
27
35
  "cross-env": "^5.2.0",
28
36
  "glob": "^9.0.0",
29
37
  "react": "^18.3.0",
30
38
  "react-dom": "^18.3.0",
39
+ "react-select": "^5.10.2",
31
40
  "rollup": "^2.68.0",
32
- "@rollup/plugin-babel": "^6.0.3",
33
- "@rollup/plugin-commonjs": "^24.1.0",
34
41
  "rollup-plugin-css-only": "^4.5.2",
35
- "@rollup/plugin-json": "^6.0.0",
36
- "@rollup/plugin-node-resolve": "^13.0.6",
37
- "@rollup/plugin-terser": "^0.4.4",
38
42
  "rollup-plugin-postcss": "^2.0.3",
39
- "@rollup/plugin-replace": "^6.0.2",
40
43
  "styled-jsx": "^5.1.6",
41
44
  "wait-on": "^5.2.1"
42
45
  },
@@ -46,11 +49,11 @@
46
49
  },
47
50
  "dependencies": {
48
51
  "@mapbox/togeojson": "^0.16.0",
49
- "@turf/bbox": "^6.0.1",
50
- "@turf/bbox-polygon": "^6.0.1",
51
- "@turf/boolean-crosses": "^6.0.1",
52
- "@turf/boolean-disjoint": "^6.0.2",
53
- "@turf/boolean-point-in-polygon": "^6.0.1",
52
+ "@turf/bbox": "^7.2.0",
53
+ "@turf/bbox-polygon": "^7.2.0",
54
+ "@turf/boolean-crosses": "^7.2.0",
55
+ "@turf/boolean-disjoint": "^7.2.0",
56
+ "@turf/boolean-point-in-polygon": "^7.2.0",
54
57
  "@turf/buffer": "^5.1.5",
55
58
  "@turf/center-of-mass": "^6.0.1",
56
59
  "@turf/centroid": "^6.0.2",
@@ -78,6 +81,7 @@
78
81
  "proj4": "^2.4.4",
79
82
  "react-data-grid": "7.0.0-beta.42",
80
83
  "react-datepicker": "^6.9.0",
84
+ "react-select": "^5.10.2",
81
85
  "react-dnd": "^9.4.0",
82
86
  "react-dnd-html5-backend": "^9.4.0",
83
87
  "react-split": "^2.0.7",
@@ -1,44 +1,46 @@
1
- import xhr from 'xhr';
1
+ import xhr from "xhr";
2
2
 
3
3
  export default {
4
- name: 'api',
4
+ name: "api",
5
5
 
6
6
  getReducer: () => {
7
+ const root = `${process.env.REACT_APP_CM_ENV}`;
7
8
  const initialData = {
8
- root: process.env.REACT_APP_CM_ENV
9
- }
9
+ root: root === "undefined" ? "development" : root,
10
+ };
10
11
 
11
12
  return (state = initialData, { type, payload }) => {
12
13
  return state;
13
- }
14
+ };
14
15
  },
15
16
 
16
17
  selectApiRoot: (state) => {
17
- return process.env.NODE_ENV==='development' ? state.api.root : state.windowLocation.origin;
18
+ return process.env.NODE_ENV === "development"
19
+ ? state.api.root
20
+ : state.windowLocation.origin;
18
21
  },
19
22
 
20
23
  getExtraArgs: (store) => {
21
-
22
24
  return {
23
25
  anonGet: (path, callback) => {
24
26
  const options = {
25
- url: path
26
- }
27
- xhr.get(options, callback)
27
+ url: path,
28
+ };
29
+ xhr.get(options, callback);
28
30
  },
29
31
 
30
32
  apiGet: (path, callback) => {
31
33
  // const token = store.selectTokenRaw();
32
34
  const token = null;
33
35
  const options = {
34
- url: path
35
- }
36
- if(token){
36
+ url: path,
37
+ };
38
+ if (token) {
37
39
  options.headers = {
38
- Authorization: "Bearer " + token
39
- }
40
+ Authorization: "Bearer " + token,
41
+ };
40
42
  }
41
- xhr.get(options, callback)
43
+ xhr.get(options, callback);
42
44
  },
43
45
 
44
46
  apiPost: (path, payload, callback) => {
@@ -46,29 +48,29 @@ export default {
46
48
  const token = null;
47
49
  const options = {
48
50
  url: path,
49
- json: payload
50
- }
51
- if(token){
51
+ json: payload,
52
+ };
53
+ if (token) {
52
54
  options.headers = {
53
- Authorization: "Bearer " + token
54
- }
55
+ Authorization: "Bearer " + token,
56
+ };
55
57
  }
56
- xhr.post(options, callback)
58
+ xhr.post(options, callback);
57
59
  },
58
60
 
59
61
  apiDel: (path, callback) => {
60
62
  // const token = store.selectTokenRaw();
61
63
  const token = null;
62
64
  const options = {
63
- url: path
64
- }
65
- if(token){
65
+ url: path,
66
+ };
67
+ if (token) {
66
68
  options.headers = {
67
- Authorization: "Bearer " + token
68
- }
69
+ Authorization: "Bearer " + token,
70
+ };
69
71
  }
70
- xhr.del(options, callback)
71
- }
72
- }
73
- }
74
- }
72
+ xhr.del(options, callback);
73
+ },
74
+ };
75
+ },
76
+ };
@@ -44,186 +44,209 @@ export default {
44
44
  }
45
45
  };
46
46
  },
47
- doCoordsInitialize: () => ({ dispatch, store }) => {
48
- dispatch({
49
- type: "COORD_INITIALIZE_START",
50
- payload: {
51
- _shouldInitialize: false,
52
- },
53
- });
47
+ doCoordsInitialize:
48
+ () =>
49
+ ({ dispatch, store }) => {
50
+ dispatch({
51
+ type: "COORD_INITIALIZE_START",
52
+ payload: {
53
+ _shouldInitialize: false,
54
+ },
55
+ });
54
56
 
55
- const map = store.selectMap();
56
- map.on("pointermove", throttle(store.doCoordsPointerMove, 200));
57
+ const map = store.selectMap();
58
+ map.on("pointermove", throttle(store.doCoordsPointerMove, 200));
57
59
 
58
- dispatch({
59
- type: "COORD_INITIALIZE_FINISH",
60
- });
61
- },
62
- doCoordsPointerMove: (e) => ({ dispatch, store }) => {
63
- e.preventDefault();
64
- e.stopPropagation();
65
-
66
- const displayProjection = store.selectDisplayProjection();
67
- const coord = e.coordinate;
68
- const projected = transform(coord, "EPSG:3857", displayProjection);
69
- const X = Math.round(projected[0] * 10000) / 10000;
70
- const Y = Math.round(projected[1] * 10000) / 10000;
71
-
72
- dispatch({
73
- type: "COORD_POSITION_UPDATE",
74
- payload: {
75
- values: { X, Y },
76
- },
77
- });
78
- },
79
- doRenderCoordsOverlay: (center, coords) => ({ dispatch, store }) => {
80
- const map = store.selectMap();
81
- const hasCoordsOverlay = store.selectCoordsOverlay();
82
-
83
- if (hasCoordsOverlay) {
84
- store.doClearCoordOverlay(hasCoordsOverlay);
85
- }
86
- //generate overlay
87
- const el = document.createElement("div");
88
- const overlay = new Overlay({
89
- element: el,
90
- positioning: "bottom-center",
91
- offset: [0, -10],
92
- });
93
-
94
- //add overlay to map
95
- map.addOverlay(overlay);
96
- ReactDOM.render(
97
- <Popup
98
- overlay={overlay}
99
- coords={coords}
100
- map={map}
101
- onClear={store.doClearPopup}
102
- />,
103
- el
104
- );
105
-
106
- overlay.setPosition(center);
107
- dispatch({ type: "COORD_OVERLAY_RENDERED", payload: { overlay: overlay } });
108
- },
109
- doClearPopup: (e, overlay) => ({ store }) => {
110
- console.log(e);
111
- e.preventDefault();
112
- e.stopPropagation();
113
- store.doClearCoordOverlay(overlay);
114
- },
115
- doClearCoordOverlay: (overlay) => ({ dispatch, store }) => {
116
- const map = store.selectMap();
117
- overlay.setPosition(undefined);
118
- const el = overlay.getElement();
119
- el.parentNode.removeChild(el);
120
- map.removeOverlay(overlay);
121
- dispatch({ type: "COORD_OVERLAY_REMOVED", payload: { overlay: null } });
122
- },
123
- doStartCoordCopy: () => ({ dispatch, store }) => {
124
- const map = store.selectMap();
125
- store.doSetCursor("crosshair");
126
-
127
- //Parent container for coord copy.
128
- const container = document.createElement("div");
129
- container.id = "cm-copy-coords";
130
- document.body.appendChild(container);
131
-
132
- dispatch({
133
- type: "COORD_COPY_ACTIVE",
134
- payload: {
135
- copyActive: true,
136
- container: container,
137
- notification: {
138
- message: "Click on map to copy coordinates.",
139
- level: "info",
140
- },
141
- },
142
- });
60
+ dispatch({
61
+ type: "COORD_INITIALIZE_FINISH",
62
+ });
63
+ },
64
+ doCoordsPointerMove:
65
+ (e) =>
66
+ ({ dispatch, store }) => {
67
+ e.preventDefault();
68
+ e.stopPropagation();
143
69
 
144
- //listen once for click event
145
- map.once("singleclick", store.doCoordCopy);
146
- },
147
- doCoordCopy: (e) => ({ dispatch, store }) => {
148
- e.preventDefault();
149
- e.stopPropagation();
150
-
151
- const copyContainer = store.selectCoordsContainer();
152
- const displayProjection = store.selectDisplayProjection();
153
- const coord = e.coordinate;
154
- const projected = transform(coord, "EPSG:3857", displayProjection);
155
- const x = Math.round(projected[0] * 10000) / 10000;
156
- const y = Math.round(projected[1] * 10000) / 10000;
157
-
158
- //Add temp input node to use execCommand.
159
- const valueEl = document.createElement("input");
160
- copyContainer.appendChild(valueEl);
161
- valueEl.value = `${x}, ${y}`;
162
- valueEl.select();
163
- document.execCommand("copy");
164
-
165
- store.doStopCoordCopy(x, y);
166
- },
167
- doStopCoordCopy: (x, y) => ({ dispatch, store }) => {
168
- const copyContainer = store.selectCoordsContainer();
169
- const msg = `Copied ${x}, ${y} to the clipboard.`;
170
- store.doSetCursor("default");
171
-
172
- dispatch({
173
- type: "COORD_COPIED",
174
- payload: {
175
- copyActive: false,
176
- container: null,
177
- notification: {
178
- title: "Coordinate Display",
179
- message: msg,
180
- level: "info",
70
+ const displayProjection = store.selectDisplayProjection();
71
+ const coord = e.coordinate;
72
+ const projected = transform(coord, "EPSG:3857", displayProjection);
73
+ const X = Math.round(projected[0] * 10000) / 10000;
74
+ const Y = Math.round(projected[1] * 10000) / 10000;
75
+
76
+ dispatch({
77
+ type: "COORD_POSITION_UPDATE",
78
+ payload: {
79
+ values: { X, Y },
181
80
  },
182
- },
183
- });
81
+ });
82
+ },
83
+ doRenderCoordsOverlay:
84
+ (center, coords) =>
85
+ ({ dispatch, store }) => {
86
+ const map = store.selectMap();
87
+ const hasCoordsOverlay = store.selectCoordsOverlay();
184
88
 
185
- copyContainer.remove(); //remove dynamically created node.
186
- store.doBasicToolbarDeactivate(); //close tool after copy.
187
- },
188
- doUpdateCoordInput: (e, label) => ({ dispatch, store }) => {
189
- e.preventDefault();
190
- e.stopPropagation();
191
- const latLonInput = store.selectCoordsLatLonInput();
192
-
193
- dispatch({
194
- type: "COORD_INPUT_UPDATED",
195
- payload: {
196
- latLonInput: {
197
- ...latLonInput,
198
- [`${label}`]: e.currentTarget.value,
89
+ if (hasCoordsOverlay) {
90
+ store.doClearCoordOverlay(hasCoordsOverlay);
91
+ }
92
+ //generate overlay
93
+ const el = document.createElement("div");
94
+ const overlay = new Overlay({
95
+ element: el,
96
+ positioning: "bottom-center",
97
+ offset: [0, -10],
98
+ });
99
+
100
+ //add overlay to map
101
+ map.addOverlay(overlay);
102
+ ReactDOM.render(
103
+ <Popup
104
+ overlay={overlay}
105
+ coords={coords}
106
+ map={map}
107
+ onClear={store.doClearPopup}
108
+ />,
109
+ el
110
+ );
111
+
112
+ overlay.setPosition(center);
113
+ dispatch({
114
+ type: "COORD_OVERLAY_RENDERED",
115
+ payload: { overlay: overlay },
116
+ });
117
+ },
118
+ doClearPopup:
119
+ (e, overlay) =>
120
+ ({ store }) => {
121
+ console.log(e);
122
+ e.preventDefault();
123
+ e.stopPropagation();
124
+ store.doClearCoordOverlay(overlay);
125
+ },
126
+ doClearCoordOverlay:
127
+ (overlay) =>
128
+ ({ dispatch, store }) => {
129
+ const map = store.selectMap();
130
+ overlay.setPosition(undefined);
131
+ const el = overlay.getElement();
132
+ el.parentNode.removeChild(el);
133
+ map.removeOverlay(overlay);
134
+ dispatch({ type: "COORD_OVERLAY_REMOVED", payload: { overlay: null } });
135
+ },
136
+ doStartCoordCopy:
137
+ () =>
138
+ ({ dispatch, store }) => {
139
+ const map = store.selectMap();
140
+ store.doSetCursor("crosshair");
141
+
142
+ //Parent container for coord copy.
143
+ const container = document.createElement("div");
144
+ container.id = "cm-copy-coords";
145
+ document.body.appendChild(container);
146
+
147
+ dispatch({
148
+ type: "COORD_COPY_ACTIVE",
149
+ payload: {
150
+ copyActive: true,
151
+ container: container,
152
+ notification: {
153
+ message: "Click on map to copy coordinates.",
154
+ level: "info",
155
+ },
199
156
  },
200
- },
201
- });
202
- },
203
- doCoordZoomTo: () => ({ dispatch, store }) => {
204
- const latLonInput = store.selectCoordsLatLonInput();
205
- const displayProjection = store.selectDisplayProjection();
206
- const x = Number(latLonInput.X);
207
- const y = Number(latLonInput.Y);
157
+ });
158
+
159
+ //listen once for click event
160
+ map.once("singleclick", store.doCoordCopy);
161
+ },
162
+ doCoordCopy:
163
+ (e) =>
164
+ ({ dispatch, store }) => {
165
+ e.preventDefault();
166
+ e.stopPropagation();
167
+
168
+ const copyContainer = store.selectCoordsContainer();
169
+ const displayProjection = store.selectDisplayProjection();
170
+ const coord = e.coordinate;
171
+ const projected = transform(coord, "EPSG:3857", displayProjection);
172
+ const x = Math.round(projected[0] * 10000) / 10000;
173
+ const y = Math.round(projected[1] * 10000) / 10000;
174
+
175
+ //Add temp input node to use execCommand.
176
+ const valueEl = document.createElement("input");
177
+ copyContainer.appendChild(valueEl);
178
+ valueEl.value = `${x}, ${y}`;
179
+ valueEl.select();
180
+ document.execCommand("copy");
181
+
182
+ store.doStopCoordCopy(x, y);
183
+ },
184
+ doStopCoordCopy:
185
+ (x, y) =>
186
+ ({ dispatch, store }) => {
187
+ const copyContainer = store.selectCoordsContainer();
188
+ const msg = `Copied ${x}, ${y} to the clipboard.`;
189
+ store.doSetCursor("default");
208
190
 
209
- if (isNaN(x) || isNaN(y)) {
210
191
  dispatch({
211
- type: "COORD_INPUT_INVALID",
192
+ type: "COORD_COPIED",
212
193
  payload: {
194
+ copyActive: false,
195
+ container: null,
213
196
  notification: {
214
197
  title: "Coordinate Display",
215
- message: "Enter valid number.",
216
- level: "danger",
198
+ message: msg,
199
+ level: "info",
217
200
  },
218
201
  },
219
202
  });
220
- } else {
221
- const center = transform([x, y], displayProjection, "EPSG:3857");
222
- store.doRenderCoordsOverlay(center, { x, y });
223
- store.doZoomToLocation(center, 13);
224
- store.doBasicToolbarDeactivate();
225
- }
226
- },
203
+
204
+ copyContainer.remove(); //remove dynamically created node.
205
+ store.doBasicToolbarDeactivate(); //close tool after copy.
206
+ },
207
+ doUpdateCoordInput:
208
+ (e, label) =>
209
+ ({ dispatch, store }) => {
210
+ e.preventDefault();
211
+ e.stopPropagation();
212
+ const latLonInput = store.selectCoordsLatLonInput();
213
+
214
+ dispatch({
215
+ type: "COORD_INPUT_UPDATED",
216
+ payload: {
217
+ latLonInput: {
218
+ ...latLonInput,
219
+ [`${label}`]: e.currentTarget.value,
220
+ },
221
+ },
222
+ });
223
+ },
224
+ doCoordZoomTo:
225
+ () =>
226
+ ({ dispatch, store }) => {
227
+ const latLonInput = store.selectCoordsLatLonInput();
228
+ const displayProjection = store.selectDisplayProjection();
229
+ const x = Number(latLonInput.X);
230
+ const y = Number(latLonInput.Y);
231
+
232
+ if (isNaN(x) || isNaN(y)) {
233
+ dispatch({
234
+ type: "COORD_INPUT_INVALID",
235
+ payload: {
236
+ notification: {
237
+ title: "Coordinate Display",
238
+ message: "Enter valid number.",
239
+ level: "danger",
240
+ },
241
+ },
242
+ });
243
+ } else {
244
+ const center = transform([x, y], displayProjection, "EPSG:3857");
245
+ store.doRenderCoordsOverlay(center, { x, y });
246
+ store.doZoomToLocation(center, 13);
247
+ store.doBasicToolbarDeactivate();
248
+ }
249
+ },
227
250
  selectCoordsValues: (state) => {
228
251
  return state.coordinateDisplay.values;
229
252
  },
@@ -1,59 +0,0 @@
1
- import React from "react";
2
- import { connect } from 'redux-bundler-react';
3
- import classnames from "classnames";
4
-
5
-
6
- class BasemapItem extends React.Component {
7
- handleClick = () => {
8
- const { idx, doChangeBasemap } = this.props;
9
- doChangeBasemap(idx);
10
- }
11
-
12
- render() {
13
- const { active, basemap, basemapImages, theme } = this.props;
14
- let tileurl = basemap.url.replace(/{[a-z]-[a-z]}/gi, "a");
15
- tileurl = tileurl.replace("{z}", "12");
16
- tileurl = tileurl.replace("{x}", "1206");
17
- tileurl = tileurl.replace("{y}", "1539");
18
-
19
- const itemClass = classnames({
20
- "cm-list-group-item": true,
21
- "pointer": true,
22
- [theme]: active
23
- })
24
-
25
- let basemapUI = null;
26
- //looking to set src.
27
- basemapImages.every((imageID) =>{
28
- if( basemap.id === imageID){
29
- console.log(basemap.id)
30
- basemapUI =
31
- (<li onClick={this.handleClick} className={itemClass} title={basemap.name}>
32
- <div className="overflow-ellipsis">
33
- <img src={basemap.altImage} width="40" height="40" alt={`Basemap tile for ${basemap.name}`} />
34
- <span style={{marginLeft:'10px'}}>{basemap.name}</span>
35
- </div>
36
- </li>)
37
- return false
38
- }else{
39
- basemapUI = (
40
- <li onClick={this.handleClick} className={itemClass} title={basemap.name}>
41
- <div className="overflow-ellipsis">
42
- <img src={tileurl} width="40" height="40" alt={`Basemap tile for ${basemap.name}`} />
43
- <span style={{marginLeft:'10px'}}>{basemap.name}</span>
44
- </div>
45
- </li>
46
- );
47
- return true
48
- }
49
- });
50
- return basemapUI
51
- }
52
- }
53
-
54
- export default connect(
55
- 'selectTheme',
56
- 'doChangeBasemap',
57
- 'selectBasemapImages',
58
- BasemapItem
59
- );