@corpsmap/corpsmap 4.1.31 → 4.1.34

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": "4.1.31",
3
+ "version": "4.1.34",
4
4
  "main": "dist/corpsmap.umd.js",
5
5
  "module": "dist/corpsmap.es.js",
6
6
  "type": "module",
@@ -16,6 +16,10 @@ const createNode = (options, map) => {
16
16
  if (!options.minzoom) options.minzoom = scaleToMapZoom(options.maxscale, 0);
17
17
  if (!options.maxzoom) options.maxzoom = scaleToMapZoom(options.minscale, 20);
18
18
 
19
+ // Accept the correct spelling and the legacy misspelled one (identifyRenameColums).
20
+ const renameColumns =
21
+ options.identifyRenameColumns ?? options.identifyRenameColums;
22
+
19
23
  const node = {
20
24
  id: options.id,
21
25
  teamDatasetId: options.teamDatasetId,
@@ -43,7 +47,9 @@ const createNode = (options, map) => {
43
47
  identifyType: options.identifyType,
44
48
  identifyLayers: options.identifyLayers,
45
49
  identifyFields: options.identifyFields,
46
- identifyRenameColums: options.identifyRenameColums,
50
+ identifyRenameColumns: renameColumns,
51
+ // Deprecated alias for the original misspelling; remove in the next major version.
52
+ identifyRenameColums: renameColumns,
47
53
  identifyFormatColumns: options.identifyFormatColumns,
48
54
  legend: options.legend,
49
55
  legendOverride: !!options.legendOverride,
@@ -56,7 +56,7 @@ export default {
56
56
  const src = mapLayer.getSource();
57
57
  let excludedColumns = store.selectIdentifyColumnsExclude();
58
58
  const identifyFields = lyr.identifyFields;
59
- const identifyRenameColumns = lyr.identifyRenameColumns ?? lyr.identifyRenameColums;
59
+ const identifyRenameColumns = lyr.identifyRenameColumns;
60
60
  const identifyFormatColumns = lyr.identifyFormatColumns;
61
61
  src.forEachFeatureIntersectingExtent(identifyExtent, (f) => {
62
62
  const geoJsonFeature = geoJSON.writeFeatureObject(f, {
@@ -118,11 +118,11 @@ export default {
118
118
  })
119
119
  }
120
120
  // Column Renaming
121
- if (visibleLayer.identifyRenameColums) {
121
+ if (visibleLayer.identifyRenameColumns) {
122
122
  data.results.forEach((result) => {
123
123
  if(result.attributes){
124
124
  for (const [featureKey, featureValue] of Object.entries(result.attributes)) {
125
- for (const [key, value] of Object.entries(visibleLayer.identifyRenameColums)){
125
+ for (const [key, value] of Object.entries(visibleLayer.identifyRenameColumns)){
126
126
  if (featureKey === key) {
127
127
  result.attributes[value] = result.attributes[featureKey];
128
128
  delete result.attributes[featureKey];
@@ -105,7 +105,7 @@ export default {
105
105
  }
106
106
 
107
107
  const identifyRenameColumns =
108
- lyr.identifyRenameColumns ?? lyr.identifyRenameColums;
108
+ lyr.identifyRenameColumns;
109
109
  if (identifyRenameColumns) {
110
110
  outFeatures = identifyRenameColumnsArcgisvector(
111
111
  outFeatures,
@@ -22,6 +22,18 @@ function buildMapServerUrl(lyr, typeName, extent) {
22
22
  ].join("");
23
23
  }
24
24
 
25
+ // Column options for one request: the identifyLayers entry's own setting wins,
26
+ // otherwise fall back to the parent layer's (e.g. a Top 10 site).
27
+ function getColumnOptions(lyr, entry = {}) {
28
+ return {
29
+ identifyFields: entry.identifyFields ?? lyr.identifyFields,
30
+ identifyRenameColumns:
31
+ entry.identifyRenameColumns ?? lyr.identifyRenameColumns,
32
+ identifyFormatColumns:
33
+ entry.identifyFormatColumns ?? lyr.identifyFormatColumns,
34
+ };
35
+ }
36
+
25
37
  /**
26
38
  * Work out which WFS requests to send for a layer.
27
39
  *
@@ -45,6 +57,7 @@ function getIdentifyTargets(lyr) {
45
57
  resultKey: lyr.uid,
46
58
  layerName: lyr.displayName,
47
59
  label: lyr.id,
60
+ ...getColumnOptions(lyr),
48
61
  },
49
62
  ];
50
63
  }
@@ -65,6 +78,7 @@ function getIdentifyTargets(lyr) {
65
78
  resultKey: `${lyr.uid}:${name}`,
66
79
  layerName: `${lyr.displayName}:${name}`,
67
80
  label: `${lyr.id}/${entry.layerList}`,
81
+ ...getColumnOptions(lyr, entry),
68
82
  };
69
83
  });
70
84
  }
@@ -148,28 +162,27 @@ export default {
148
162
  excludedColumns
149
163
  );
150
164
 
151
- // Column options come from the parent layer; for FUDS Top 10 these are
152
- // all null, so every sub-layer returns all of its columns.
153
- if (lyr.identifyFields) {
165
+ // Column options are per target: the identifyLayers entry, else the
166
+ // parent layer. Order matters: include (old names), rename, then
167
+ // format (which uses the new names).
168
+ if (target.identifyFields) {
154
169
  outFeatures = identifyIncludeColumnsArcgisvector(
155
170
  outFeatures,
156
- lyr.identifyFields
171
+ target.identifyFields
157
172
  );
158
173
  }
159
174
 
160
- const identifyRenameColumns =
161
- lyr.identifyRenameColumns ?? lyr.identifyRenameColums;
162
- if (identifyRenameColumns) {
175
+ if (target.identifyRenameColumns) {
163
176
  outFeatures = identifyRenameColumnsArcgisvector(
164
177
  outFeatures,
165
- identifyRenameColumns
178
+ target.identifyRenameColumns
166
179
  );
167
180
  }
168
181
 
169
- if (lyr.identifyFormatColumns) {
182
+ if (target.identifyFormatColumns) {
170
183
  outFeatures = identifyFormatColumnsArcgisvector(
171
184
  outFeatures,
172
- lyr.identifyFormatColumns
185
+ target.identifyFormatColumns
173
186
  );
174
187
  }
175
188
 
@@ -98,11 +98,11 @@ export default {
98
98
  })
99
99
  }
100
100
  //Column Renaming
101
- if (layers[0].identifyRenameColums) {
101
+ if (layers[0].identifyRenameColumns) {
102
102
  outFeatures.forEach((feature) => {
103
103
  if(feature.properties){
104
104
  for (const [featureKey, featureValue] of Object.entries(feature.properties)) {
105
- for (const [key, value] of Object.entries(layers[0].identifyRenameColums)){
105
+ for (const [key, value] of Object.entries(layers[0].identifyRenameColumns)){
106
106
  if (featureKey === key) {
107
107
  feature.properties[value] = feature.properties[featureKey];
108
108
  delete feature.properties[featureKey];