@corpsmap/corpsmap 3.2.74 → 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.74",
3
+ "version": "3.2.77",
4
4
  "description": "CorpsMap as React Components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,37 +16,44 @@
16
16
  "author": "willbreitkreutz",
17
17
  "license": "MIT",
18
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",
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",
23
+ "@babel/plugin-transform-numeric-separator": "^7.27.1",
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",
24
34
  "concurrently": "^5.3.0",
25
35
  "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",
36
+ "glob": "^9.0.0",
37
+ "react": "^18.3.0",
38
+ "react-dom": "^18.3.0",
39
+ "react-select": "^5.10.2",
40
+ "rollup": "^2.68.0",
41
+ "rollup-plugin-css-only": "^4.5.2",
34
42
  "rollup-plugin-postcss": "^2.0.3",
35
- "rollup-plugin-replace": "^2.2.0",
36
- "styled-jsx": "^3.2.1",
43
+ "styled-jsx": "^5.1.6",
37
44
  "wait-on": "^5.2.1"
38
45
  },
39
46
  "peerDependencies": {
40
- "react": ">= 16.x.x",
41
- "react-dom": ">=16.x.x"
47
+ "react": ">= 18.x.x",
48
+ "react-dom": ">=18.x.x"
42
49
  },
43
50
  "dependencies": {
44
51
  "@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",
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",
50
57
  "@turf/buffer": "^5.1.5",
51
58
  "@turf/center-of-mass": "^6.0.1",
52
59
  "@turf/centroid": "^6.0.2",
@@ -72,16 +79,16 @@
72
79
  "ol-esri-style": "^2.0.7",
73
80
  "parse2-kmz": "^1.0.5",
74
81
  "proj4": "^2.4.4",
75
- "react-data-grid": "^6.1.0",
76
- "react-datepicker": "^2.9.6",
82
+ "react-data-grid": "7.0.0-beta.42",
83
+ "react-datepicker": "^6.9.0",
84
+ "react-select": "^5.10.2",
77
85
  "react-dnd": "^9.4.0",
78
86
  "react-dnd-html5-backend": "^9.4.0",
79
- "react-notification-system": "^0.2.17",
80
87
  "react-split": "^2.0.7",
81
88
  "redux-bundler": "^26.0.0",
82
89
  "redux-bundler-react": "^1.2.0",
83
90
  "shpjs": "^3.4.3",
84
- "uuid": "^3.3.3",
91
+ "uuid": "^7.0.0",
85
92
  "xhr": "^2.5.0"
86
93
  }
87
94
  }
package/rollup.config.js CHANGED
@@ -1,12 +1,12 @@
1
- import babel from "rollup-plugin-babel";
2
- import commonjs from "rollup-plugin-commonjs";
3
- import resolve from "rollup-plugin-node-resolve";
4
- import replace from "rollup-plugin-replace";
1
+ import babel from "@rollup/plugin-babel";
2
+ import commonjs from "@rollup/plugin-commonjs";
3
+ import resolve from "@rollup/plugin-node-resolve";
4
+ import replace from "@rollup/plugin-replace";
5
5
  import css from "rollup-plugin-css-only";
6
- import postcss from 'rollup-plugin-postcss';
7
- import json from 'rollup-plugin-json';
8
- import pkg from './package.json';
9
-
6
+ import postcss from "rollup-plugin-postcss";
7
+ import json from "@rollup/plugin-json";
8
+ import pkg from "./package.json";
9
+ import path from "path";
10
10
 
11
11
  const NODE_ENV = process.env.NODE_ENV || "development";
12
12
  const outputFile = NODE_ENV === "production" ? "./lib/prod.js" : "./lib/dev.js";
@@ -15,36 +15,38 @@ export default {
15
15
  input: "./src/index.js",
16
16
  output: {
17
17
  file: outputFile,
18
- format: "cjs"
18
+ format: "cjs",
19
19
  },
20
20
  plugins: [
21
21
  replace({
22
- "process.env.NODE_ENV": JSON.stringify(NODE_ENV)
22
+ "process.env.NODE_ENV": JSON.stringify(NODE_ENV),
23
23
  }),
24
24
  babel({
25
- plugins:[['import', { libraryName: 'antd', style: true }]],
26
- extensions: ['.js', '.jsx', '.ts', '.tsx'],
27
- exclude: "node_modules/**"
25
+ plugins: [["import", { libraryName: "antd", style: true }]],
26
+ extensions: [".js", ".jsx", ".ts", ".tsx"],
27
+ exclude: "node_modules/**",
28
+ babelHelpers: "bundled",
28
29
  }),
29
30
  css({
30
- output: "./css/corpsmap.css"
31
+ // output: "./css/corpsmap.css",
32
+ extract: path.resolve("./css/corpsmap.css"),
31
33
  }),
32
34
  resolve({
33
35
  module: true,
34
36
  jsnext: true,
35
37
  customResolveOptions: {
36
- moduleDirectory: 'node_modules'
37
- }
38
+ moduleDirectory: "node_modules",
39
+ },
38
40
  }),
39
41
  json(),
40
42
  commonjs(),
41
43
  postcss({
42
- extensions: ['.css', '.scss', '.less'],
43
- use: ['sass', ['less', { javascriptEnabled: true }]],
44
- })
44
+ extensions: [".css", ".scss", ".less"],
45
+ use: ["sass", ["less", { javascriptEnabled: true }]],
46
+ }),
45
47
  ],
46
48
  external: [
47
49
  ...Object.keys(pkg.devDependencies || {}),
48
- ...Object.keys(pkg.peerDependencies || {})
49
- ]
50
+ ...Object.keys(pkg.peerDependencies || {}),
51
+ ],
50
52
  };
@@ -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
+ };
@@ -1,4 +1,4 @@
1
- import v4 from "uuid";
1
+ import { v4 } from "uuid";
2
2
  import GeoJSON from "ol/format/GeoJSON";
3
3
  import { getLayer } from "../../openlayers-utils/layer-utilities";
4
4
  import shp from "shpjs";
@@ -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
  },