@corpsmap/corpsmap 3.2.81 → 3.2.83

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.
@@ -1,349 +1,290 @@
1
- // import { v4 } from "uuid/v4";
2
- import { v4 as uuidv4 } from "uuid";
3
- export default {
4
- name: "ui",
1
+ import v4 from 'uuid/v4';
5
2
 
3
+ export default {
4
+ name: 'ui',
5
+
6
6
  getReducer: () => {
7
7
  const initialData = {
8
- northConfig: {
9
- height: window.innerHeight,
8
+ northConfig:{
9
+ height: window.innerHeight
10
10
  },
11
- southConfig: {
11
+ southConfig:{
12
12
  height: 0,
13
- children: [],
13
+ children: []
14
14
  },
15
- primaryPanelConfig: {
15
+ primaryPanelConfig:{
16
16
  openedBy: null,
17
17
  width: 420,
18
18
  children: [],
19
- options: null,
19
+ options: null
20
20
  },
21
- secondaryPanelConfig: {
21
+ secondaryPanelConfig:{
22
22
  open: false,
23
23
  width: 300,
24
24
  children: [],
25
- options: null,
25
+ options: null
26
26
  },
27
- modalConfig: {
27
+ modalConfig:{
28
28
  children: [],
29
29
  options: null,
30
- openedBy: null,
30
+ openedBy: null
31
31
  },
32
- basicToolbarConfig: {
33
- activeTool: null,
32
+ basicToolbarConfig:{
33
+ activeTool: null
34
34
  },
35
- theme: "bg-blue-chambray",
36
- shouldUpdateWindowSize: false,
37
- };
35
+ theme: 'bg-blue-chambray',
36
+ shouldUpdateWindowSize: false
37
+ }
38
38
 
39
39
  return (state = initialData, { type, payload }) => {
40
- if (type === "WINDOW_RESIZE") {
41
- return Object.assign({}, state, {
42
- shouldUpdateWindowSize: true,
40
+
41
+ if(type === 'WINDOW_RESIZE'){
42
+ return Object.assign({}, state, {
43
+ shouldUpdateWindowSize: true
43
44
  });
44
45
  }
45
46
 
46
- if (type.indexOf("UI_UPDATE_WINDOW_SIZE_") !== -1) {
47
+ if(type.indexOf('UI_UPDATE_WINDOW_SIZE_') !== -1){
47
48
  return Object.assign({}, state, payload);
48
49
  }
49
50
 
50
- if (type === "UI_RESIZED_NORTH_SOUTH") {
51
+ if(type === 'UI_RESIZED_NORTH_SOUTH'){
51
52
  const northConfig = {
52
- height: payload.hNorth,
53
- };
53
+ height: payload.hNorth
54
+ }
54
55
  const southConfig = {
55
56
  height: payload.hSouth,
56
57
  children: state.southConfig.children,
57
- options: state.southConfig.options,
58
- };
58
+ options: state.southConfig.options
59
+ }
59
60
  return Object.assign({}, state, {
60
61
  northConfig: northConfig,
61
- southConfig: southConfig,
62
- });
62
+ southConfig: southConfig
63
+ })
63
64
  }
64
65
 
65
- if (type === "UI_OPENED_SOUTH_PANEL") {
66
+ if(type === 'UI_OPENED_SOUTH_PANEL'){
66
67
  const northConfig = {
67
- height: window.innerHeight / 2,
68
- };
68
+ height: window.innerHeight / 2
69
+ }
69
70
  const southConfig = {
70
71
  height: window.innerHeight / 2,
71
- children: payload.children,
72
- };
72
+ children: payload.children
73
+ }
73
74
  return Object.assign({}, state, {
74
75
  northConfig: northConfig,
75
- southConfig: southConfig,
76
- });
76
+ southConfig: southConfig
77
+ })
77
78
  }
78
79
 
79
- if (type === "UI_CLOSED_SOUTH_PANEL") {
80
+ if(type === 'UI_CLOSED_SOUTH_PANEL'){
80
81
  const northConfig = {
81
- height: window.innerHeight,
82
- };
82
+ height: window.innerHeight
83
+ }
83
84
  const southConfig = {
84
85
  height: 0,
85
- children: [],
86
- };
86
+ children: []
87
+ }
87
88
  return Object.assign({}, state, {
88
89
  northConfig: northConfig,
89
- southConfig: southConfig,
90
- });
90
+ southConfig: southConfig
91
+ })
91
92
  }
92
93
 
93
- if (type === "UI_CLOSED_SOUTH_TAB") {
94
+ if(type === 'UI_CLOSED_SOUTH_TAB'){
94
95
  const southConfig = {
95
- children: payload.children,
96
- };
96
+ children: payload.children
97
+ }
97
98
  return Object.assign({}, state, {
98
- southConfig: southConfig,
99
- });
99
+ southConfig: southConfig
100
+ })
100
101
  }
101
102
 
102
- if (type === "UI_OPENED_MODAL_WINDOW") {
103
+ if(type === 'UI_OPENED_MODAL_WINDOW'){
103
104
  const modalConfig = {
104
105
  children: payload.children,
105
106
  options: payload.options,
106
- openedBy: payload.openedBy,
107
- };
107
+ openedBy: payload.openedBy
108
+ }
108
109
  return Object.assign({}, state, {
109
- modalConfig: modalConfig,
110
- });
110
+ modalConfig: modalConfig
111
+ })
111
112
  }
112
113
 
113
- if (type === "UI_CLOSED_MODAL_WINDOW") {
114
+ if(type === 'UI_CLOSED_MODAL_WINDOW'){
114
115
  const modalConfig = {
115
116
  children: [],
116
117
  options: null,
117
- openedBy: null,
118
- };
118
+ openedBy: null
119
+ }
119
120
  return Object.assign({}, state, {
120
- modalConfig: modalConfig,
121
- });
121
+ modalConfig: modalConfig
122
+ })
122
123
  }
123
124
 
124
- if (type === "UI_OPENED_PRIMARY_PANEL") {
125
+ if(type === 'UI_OPENED_PRIMARY_PANEL'){
125
126
  const primaryPanelConfig = {
126
127
  openedBy: payload.openedBy,
127
128
  width: state.primaryPanelConfig.width,
128
129
  children: payload.children,
129
- options: payload.options,
130
- };
130
+ options: payload.options
131
+ }
131
132
  return Object.assign({}, state, {
132
- primaryPanelConfig: primaryPanelConfig,
133
- });
133
+ primaryPanelConfig: primaryPanelConfig
134
+ })
134
135
  }
135
136
 
136
- if (type === "UI_CLOSED_PRIMARY_PANEL") {
137
+ if(type === 'UI_CLOSED_PRIMARY_PANEL'){
137
138
  const primaryPanelConfig = {
138
139
  openedBy: null,
139
140
  width: state.primaryPanelConfig.width,
140
141
  left: state.primaryPanelConfig.left,
141
142
  children: [],
142
- options: null,
143
- };
143
+ options: null
144
+ }
144
145
  return Object.assign({}, state, {
145
- primaryPanelConfig: primaryPanelConfig,
146
- });
146
+ primaryPanelConfig: primaryPanelConfig
147
+ })
147
148
  }
148
149
 
149
- if (type === "UI_RESIZED_PRIMARY_PANEL") {
150
+ if(type === 'UI_RESIZED_PRIMARY_PANEL'){
150
151
  const primaryPanelConfig = {
151
152
  open: state.primaryPanelConfig.open,
152
153
  width: payload.width,
153
154
  left: state.primaryPanelConfig.left,
154
155
  children: state.primaryPanelConfig.children,
155
156
  options: state.primaryPanelConfig.options,
156
- openedBy: state.primaryPanelConfig.openedBy,
157
- };
157
+ openedBy: state.primaryPanelConfig.openedBy
158
+ }
158
159
  const secondaryPanelConfig = {
159
160
  open: state.secondaryPanelConfig.open,
160
161
  width: state.secondaryPanelConfig.width,
161
162
  left: payload.width,
162
163
  children: state.secondaryPanelConfig.children,
163
164
  options: state.secondaryPanelConfig.options,
164
- openedBy: state.secondaryPanelConfig.openedBy,
165
- };
165
+ openedBy: state.secondaryPanelConfig.openedBy
166
+ }
166
167
  return Object.assign({}, state, {
167
168
  primaryPanelConfig: primaryPanelConfig,
168
- secondaryPanelConfig: secondaryPanelConfig,
169
- });
169
+ secondaryPanelConfig: secondaryPanelConfig
170
+ })
170
171
  }
171
172
 
172
- if (type === "UI_ACTIVATE_BASIC_TOOL") {
173
+ if(type === 'UI_ACTIVATE_BASIC_TOOL'){
173
174
  const basicToolbarConfig = {
174
- activeTool: payload,
175
- };
175
+ activeTool: payload
176
+ }
176
177
  return Object.assign({}, state, {
177
- basicToolbarConfig: basicToolbarConfig,
178
- });
178
+ basicToolbarConfig: basicToolbarConfig
179
+ })
179
180
  }
180
181
 
181
- if (type === "UI_DEACTIVATE_BASIC_TOOL") {
182
+ if(type === 'UI_DEACTIVATE_BASIC_TOOL'){
182
183
  const basicToolbarConfig = {
183
- activeTool: null,
184
- };
184
+ activeTool: null
185
+ }
185
186
  return Object.assign({}, state, {
186
- basicToolbarConfig: basicToolbarConfig,
187
- });
187
+ basicToolbarConfig: basicToolbarConfig
188
+ })
188
189
  }
189
190
 
190
- if (type === "UI_THEME_CHANGED") {
191
+ if(type === 'UI_THEME_CHANGED'){
191
192
  return Object.assign({}, state, {
192
- theme: payload,
193
- });
193
+ theme: payload
194
+ })
194
195
  }
195
196
 
196
197
  return state;
197
- };
198
+ }
198
199
  },
199
200
 
200
201
  // ACTION CREATORS
201
- doUiUpdateWindowSize:
202
- () =>
203
- ({ dispatch, store }) => {
204
- dispatch({
205
- type: "UI_UPDATE_WINDOW_SIZE_START",
206
- payload: { shouldUpdateWindowSize: false },
207
- });
208
- const h = store.selectViewportHeight();
209
- const northConfig = store.selectNorthConfig();
210
- const southConfig = store.selectSouthConfig();
211
- const northPortion =
212
- northConfig.height / (northConfig.height + southConfig.height);
213
- const southPortion =
214
- southConfig.height / (northConfig.height + southConfig.height);
215
- const newPayload = {
216
- northConfig: Object.assign({}, northConfig, {
217
- height: h * northPortion,
218
- }),
219
- southConfig: Object.assign({}, southConfig, {
220
- height: h * southPortion,
221
- }),
222
- };
223
- dispatch({ type: "UI_UPDATE_WINDOW_SIZE_COMPLETE", payload: newPayload });
224
- store.doMapUpdateSize();
225
- },
226
-
227
- doMapUpdateSize:
228
- () =>
229
- ({ dispatch, store }) => {
230
- const map = store.selectMap();
231
- window.setTimeout(() => {
232
- map.updateSize();
233
- }, 100);
234
- },
235
-
236
- doSouthRegionOpen:
237
- ({ component, options, openedBy, displayName }) =>
238
- ({ dispatch, store }) => {
239
- const existingChildren = store.selectSouthRegionChildren();
240
- const uid = v4();
241
- dispatch({
242
- type: "UI_OPENED_SOUTH_PANEL",
243
- payload: {
244
- children: existingChildren.concat([
245
- { component, options, openedBy, displayName, uid },
246
- ]),
247
- },
248
- });
249
- store.doMapUpdateSize();
250
- },
251
-
252
- doCloseSouthTab:
253
- (child) =>
254
- ({ dispatch, store }) => {
255
- const children = store.selectSouthRegionChildren().slice();
256
- const idx = children.indexOf(child);
257
- children.splice(idx, 1);
258
- dispatch({
259
- type: "UI_CLOSED_SOUTH_TAB",
260
- payload: { children: children },
261
- });
262
- if (children.length === 0) return store.doCloseSouthRegion();
263
- },
264
-
265
- doCloseSouthRegion:
266
- () =>
267
- ({ dispatch, store }) => {
268
- dispatch({ type: "UI_CLOSED_SOUTH_PANEL" });
269
- store.doMapUpdateSize();
270
- },
271
-
272
- doModalOpen:
273
- ({ children, options, openedBy }) =>
274
- ({ dispatch }) => {
275
- dispatch({
276
- type: "UI_OPENED_MODAL_WINDOW",
277
- payload: { children, options, openedBy },
278
- });
279
- },
280
-
281
- doModalClose:
282
- () =>
283
- ({ dispatch }) => {
284
- dispatch({ type: "UI_CLOSED_MODAL_WINDOW" });
285
- },
286
-
287
- doPrimaryPanelOpen:
288
- ({ children, options, openedBy }) =>
289
- ({ dispatch }) => {
290
- dispatch({
291
- type: "UI_OPENED_PRIMARY_PANEL",
292
- payload: { children, options, openedBy },
293
- });
294
- },
295
-
296
- doPrimaryPanelClose:
297
- () =>
298
- ({ dispatch }) => {
299
- dispatch({ type: "UI_CLOSED_PRIMARY_PANEL" });
300
- },
301
-
302
- doOpenSecondaryPanel:
303
- ({ children, options, openedBy }) =>
304
- ({ dispatch }) => {
305
- dispatch({
306
- type: "UI_OPENED_SECONDARY_PANEL",
307
- payload: { children, options, openedBy },
308
- });
309
- },
310
-
311
- doCloseSecondaryPanel:
312
- () =>
313
- ({ dispatch }) => {
314
- dispatch({ type: "UI_CLOSED_SECONDARY_PANEL" });
315
- },
316
-
317
- doSetTheme:
318
- (newTheme) =>
319
- ({ dispatch }) => {
320
- dispatch({ type: "UI_THEME_CHANGED", payload: newTheme });
321
- },
322
-
323
- doResizeSouthRegion:
324
- ({ hNorth, hSouth }) =>
325
- ({ dispatch, store }) => {
326
- dispatch({ type: "UI_RESIZED_NORTH_SOUTH", payload: { hNorth, hSouth } });
327
- store.doMapUpdateSize();
328
- },
329
-
330
- doPrimaryPanelResize:
331
- ({ width }) =>
332
- ({ dispatch }) => {
333
- dispatch({ type: "UI_RESIZED_PRIMARY_PANEL", payload: { width } });
334
- },
335
-
336
- doBasicToolbarActivate:
337
- ({ activeTool }) =>
338
- ({ dispatch }) => {
339
- dispatch({ type: "UI_ACTIVATE_BASIC_TOOL", payload: activeTool });
340
- },
341
-
342
- doBasicToolbarDeactivate:
343
- () =>
344
- ({ dispatch }) => {
345
- dispatch({ type: "UI_DEACTIVATE_BASIC_TOOL" });
346
- },
202
+ doUiUpdateWindowSize: () => ({ dispatch, store }) => {
203
+ dispatch({ type: 'UI_UPDATE_WINDOW_SIZE_START', payload: { shouldUpdateWindowSize: false }});
204
+ const h = store.selectViewportHeight();
205
+ const northConfig = store.selectNorthConfig();
206
+ const southConfig = store.selectSouthConfig();
207
+ const northPortion = northConfig.height / (northConfig.height + southConfig.height);
208
+ const southPortion = southConfig.height / (northConfig.height + southConfig.height);
209
+ const newPayload = {
210
+ northConfig: Object.assign({}, northConfig, { height: h * northPortion }),
211
+ southConfig: Object.assign({}, southConfig, { height: h * southPortion })
212
+ }
213
+ dispatch({ type: 'UI_UPDATE_WINDOW_SIZE_COMPLETE', payload: newPayload});
214
+ store.doMapUpdateSize();
215
+ },
216
+
217
+ doMapUpdateSize: () => ({ dispatch, store }) => {
218
+ const map = store.selectMap();
219
+ window.setTimeout(() => { map.updateSize(); }, 100);
220
+ },
221
+
222
+ doSouthRegionOpen: ({ component, options, openedBy, displayName }) => ({ dispatch, store }) => {
223
+ const existingChildren = store.selectSouthRegionChildren();
224
+ const uid = v4();
225
+ dispatch({type:'UI_OPENED_SOUTH_PANEL', payload:{
226
+ children: existingChildren.concat([{ component, options, openedBy, displayName, uid }])
227
+ }});
228
+ store.doMapUpdateSize();
229
+ },
230
+
231
+ doCloseSouthTab: (child) => ({ dispatch, store }) => {
232
+ const children = store.selectSouthRegionChildren().slice();
233
+ const idx = children.indexOf(child);
234
+ children.splice(idx, 1);
235
+ dispatch({type:'UI_CLOSED_SOUTH_TAB', payload: { children: children }});
236
+ if(children.length === 0) return store.doCloseSouthRegion();
237
+ },
238
+
239
+ doCloseSouthRegion: () => ({ dispatch, store }) => {
240
+ dispatch({type:'UI_CLOSED_SOUTH_PANEL'});
241
+ store.doMapUpdateSize();
242
+ },
243
+
244
+ doModalOpen: ({ children, options, openedBy }) => ({ dispatch }) => {
245
+ dispatch({type:'UI_OPENED_MODAL_WINDOW', payload: {children, options, openedBy }});
246
+ },
247
+
248
+ doModalClose: () => ({ dispatch }) => {
249
+ dispatch({type:'UI_CLOSED_MODAL_WINDOW'});
250
+ },
251
+
252
+ doPrimaryPanelOpen: ({ children, options, openedBy }) => ({ dispatch }) => {
253
+ dispatch({type:'UI_OPENED_PRIMARY_PANEL', payload:{ children, options, openedBy }});
254
+ },
255
+
256
+ doPrimaryPanelClose: () => ({ dispatch }) => {
257
+ dispatch({type:'UI_CLOSED_PRIMARY_PANEL'});
258
+ },
259
+
260
+ doOpenSecondaryPanel: ({ children, options, openedBy }) => ({ dispatch }) => {
261
+ dispatch({type:'UI_OPENED_SECONDARY_PANEL', payload:{ children, options, openedBy }});
262
+ },
263
+
264
+ doCloseSecondaryPanel: () => ({ dispatch }) => {
265
+ dispatch({type:'UI_CLOSED_SECONDARY_PANEL'});
266
+ },
267
+
268
+ doSetTheme: (newTheme) => ({ dispatch }) => {
269
+ dispatch({type:'UI_THEME_CHANGED', payload: newTheme});
270
+ },
271
+
272
+ doResizeSouthRegion: ({ hNorth, hSouth }) => ({ dispatch, store }) => {
273
+ dispatch({type:'UI_RESIZED_NORTH_SOUTH', payload:{ hNorth, hSouth }});
274
+ store.doMapUpdateSize()
275
+ },
276
+
277
+ doPrimaryPanelResize: ({ width }) => ({ dispatch }) => {
278
+ dispatch({type:'UI_RESIZED_PRIMARY_PANEL', payload:{ width }});
279
+ },
280
+
281
+ doBasicToolbarActivate: ({ activeTool }) => ({ dispatch }) => {
282
+ dispatch({type:'UI_ACTIVATE_BASIC_TOOL', payload: activeTool });
283
+ },
284
+
285
+ doBasicToolbarDeactivate: () => ({ dispatch }) => {
286
+ dispatch({type:'UI_DEACTIVATE_BASIC_TOOL'});
287
+ },
347
288
 
348
289
  // SELECTORS
349
290
  selectNorthConfig: (state) => {
@@ -399,7 +340,6 @@ export default {
399
340
  },
400
341
 
401
342
  reactShouldUpdateWindowSize: (state) => {
402
- if (state.ui.shouldUpdateWindowSize)
403
- return { actionCreator: "doUiUpdateWindowSize" };
404
- },
405
- };
343
+ if(state.ui.shouldUpdateWindowSize) return { actionCreator: 'doUiUpdateWindowSize' };
344
+ }
345
+ }
@@ -1,5 +1,4 @@
1
- // import { v4 } from "uuid";
2
- import { v4 as uuidv4 } from "uuid";
1
+ import v4 from "uuid";
3
2
  import GeoJSON from "ol/format/GeoJSON";
4
3
  import { getLayer } from "../../openlayers-utils/layer-utilities";
5
4
  import shp from "shpjs";
@@ -0,0 +1,59 @@
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
+ );
@@ -129,7 +129,7 @@ class ChangeLogModal extends React.Component {
129
129
  <div className="cm-modal-body">
130
130
  <div style={filterStyle}>
131
131
  <label style={{ fontSize: "18px", fontWeight: "bold" }}>
132
- Change Log Filter
132
+ Change Log
133
133
  </label>
134
134
  </div>
135
135
 
@@ -142,7 +142,7 @@ class ChangeLogModal extends React.Component {
142
142
 
143
143
  <div style={filterStyle}>
144
144
  <label htmlFor="select-district">
145
- <b>Change Log Search:</b>
145
+ <b>Search:</b>
146
146
  </label>
147
147
 
148
148
  <input