@esri/solutions-components 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/t9n/public-notification/resources.json +5 -5
- package/dist/assets/t9n/public-notification/resources_en.json +5 -5
- package/dist/cjs/calcite-input-message_5.cjs.entry.js +1 -17
- package/dist/cjs/{downloadUtils-ae182e3a.js → downloadUtils-d05b069f.js} +91 -42
- package/dist/cjs/{index.es-b71e9071.js → index.es-e47b660c.js} +1 -1
- package/dist/cjs/layer-table.cjs.entry.js +1 -1
- package/dist/cjs/public-notification.cjs.entry.js +3 -11
- package/dist/collection/components/map-select-tools/map-select-tools.js +0 -16
- package/dist/collection/components/public-notification/public-notification.js +3 -11
- package/dist/collection/utils/downloadUtils.js +90 -41
- package/dist/collection/utils/downloadUtils.ts +123 -52
- package/dist/components/downloadUtils.js +90 -41
- package/dist/components/map-select-tools2.js +0 -16
- package/dist/components/public-notification.js +3 -11
- package/dist/esm/calcite-input-message_5.entry.js +1 -17
- package/dist/esm/{downloadUtils-8d64719e.js → downloadUtils-a9b39194.js} +91 -42
- package/dist/esm/{index.es-1d777745.js → index.es-4904465f.js} +1 -1
- package/dist/esm/layer-table.entry.js +1 -1
- package/dist/esm/public-notification.entry.js +3 -11
- package/dist/solutions-components/p-20c73673.entry.js +6 -0
- package/dist/solutions-components/{p-702e1915.js → p-25eb36dc.js} +1 -1
- package/dist/solutions-components/p-59caff67.entry.js +17 -0
- package/dist/solutions-components/{p-048a4c91.entry.js → p-a606221a.entry.js} +1 -1
- package/dist/solutions-components/{p-01215468.js → p-e7b3a4d9.js} +3 -3
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/downloadUtils.ts +123 -52
- package/dist/types/components/json-editor/assets/monaco-editor/monaco.d.ts +8262 -0
- package/package.json +1 -1
- package/dist/solutions-components/p-4bfcd9ea.entry.js +0 -17
- package/dist/solutions-components/p-a99ca396.entry.js +0 -6
@@ -17,15 +17,15 @@
|
|
17
17
|
"selectedAddresses": "{{n}} selected addresses from {{layer}}",
|
18
18
|
"selectionLoading": "Selection loading",
|
19
19
|
"selectPDFLabelOption": "Select PDF label option",
|
20
|
-
"refineTip": "
|
20
|
+
"refineTip": "Refine and finalize your lists by using sketch tools to add or remove features across all selection sets.",
|
21
21
|
"refineTipNoSelections": "There are no selections to refine. Go to My lists to create a list of features.",
|
22
22
|
"removeDuplicate": "Remove duplicate addresses",
|
23
|
-
"selectLayerAndAdd": "Choose
|
24
|
-
"selectSearchTip": "Search for an address, place, or feature
|
23
|
+
"selectLayerAndAdd": "Choose a layer, click Add, and select features to create a list that you can export to CSV or PDF for download.",
|
24
|
+
"selectSearchTip": "Search for an address, place, or feature to make a selection.",
|
25
25
|
"selectLayerTip": "Draw shapes to select features from the chosen selection layer; the results will be used to select features from the addressee layer",
|
26
|
-
"selectSketchTip": "
|
26
|
+
"selectSketchTip": "Use sketch tools to draw graphics in the map to select intersecting features in the addressee layer.",
|
27
27
|
"optionalSearchDistance": "and optionally add search distance.",
|
28
|
-
"listHasSetsTip": "
|
28
|
+
"listHasSetsTip": "Edit or delete existing lists or choose a layer and click Add to create a notification list.",
|
29
29
|
"uniqueCout": "Unique Count: {{n}}",
|
30
30
|
"shouldProceed": "Would you like to proceed?",
|
31
31
|
"proceed": "Proceed",
|
@@ -17,15 +17,15 @@
|
|
17
17
|
"selectedAddresses": "{{n}} selected addresses from {{layer}}",
|
18
18
|
"selectionLoading": "Selection loading",
|
19
19
|
"selectPDFLabelOption": "Select PDF label option",
|
20
|
-
"refineTip": "
|
20
|
+
"refineTip": "Refine and finalize your lists by using sketch tools to add or remove features across all selection sets.",
|
21
21
|
"refineTipNoSelections": "There are no selections to refine. Go to My lists to create a list of features.",
|
22
22
|
"removeDuplicate": "Remove duplicate addresses",
|
23
|
-
"selectLayerAndAdd": "Choose
|
24
|
-
"selectSearchTip": "Search for an address, place, or feature
|
23
|
+
"selectLayerAndAdd": "Choose a layer, click Add, and select features to create a list that you can export to CSV or PDF for download.",
|
24
|
+
"selectSearchTip": "Search for an address, place, or feature to make a selection.",
|
25
25
|
"selectLayerTip": "Draw shapes to select features from the chosen selection layer; the results will be used to select features from the addressee layer",
|
26
|
-
"selectSketchTip": "
|
26
|
+
"selectSketchTip": "Use sketch tools to draw graphics in the map to select intersecting features in the addressee layer.",
|
27
27
|
"optionalSearchDistance": "and optionally add search distance.",
|
28
|
-
"listHasSetsTip": "
|
28
|
+
"listHasSetsTip": "Edit or delete existing lists or choose a layer and click Add to create a notification list.",
|
29
29
|
"uniqueCout": "Unique Count: {{n}}",
|
30
30
|
"shouldProceed": "Would you like to proceed?",
|
31
31
|
"proceed": "Proceed",
|
@@ -16,7 +16,7 @@ const mapViewUtils = require('./mapViewUtils-d250b1ed.js');
|
|
16
16
|
const interfaces$1 = require('./interfaces-17c631bf.js');
|
17
17
|
const publicNotificationStore = require('./publicNotificationStore-20e924f5.js');
|
18
18
|
const locale = require('./locale-04da9a8c.js');
|
19
|
-
const downloadUtils = require('./downloadUtils-
|
19
|
+
const downloadUtils = require('./downloadUtils-d05b069f.js');
|
20
20
|
const publicNotificationUtils = require('./publicNotificationUtils-9d585d8d.js');
|
21
21
|
require('./resources-b56bce71.js');
|
22
22
|
require('./guid-84ac4d91.js');
|
@@ -296,11 +296,6 @@ const MapSelectTools = class {
|
|
296
296
|
* @returns Promise when complete
|
297
297
|
*/
|
298
298
|
async watchSearchConfigurationHandler(newValue, oldValue) {
|
299
|
-
console.log("watchSearchConfigurationHandler");
|
300
|
-
console.log("newValue");
|
301
|
-
console.log(newValue);
|
302
|
-
console.log("oldValue");
|
303
|
-
console.log(oldValue);
|
304
299
|
if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
|
305
300
|
this._initSearchWidget();
|
306
301
|
}
|
@@ -367,7 +362,6 @@ const MapSelectTools = class {
|
|
367
362
|
* Handle changes to the search configuration
|
368
363
|
*/
|
369
364
|
searchConfigurationChangeChanged(event) {
|
370
|
-
console.log("searchConfigurationChange listener");
|
371
365
|
this.searchConfiguration = event.detail;
|
372
366
|
}
|
373
367
|
/**
|
@@ -500,16 +494,8 @@ const MapSelectTools = class {
|
|
500
494
|
* @protected
|
501
495
|
*/
|
502
496
|
_initSearchWidget() {
|
503
|
-
console.log("_initSearchWidget");
|
504
|
-
console.log("this.mapView");
|
505
|
-
console.log(this.mapView);
|
506
|
-
console.log("this._searchElement");
|
507
|
-
console.log(this._searchElement);
|
508
497
|
if (this.mapView && this._searchElement) {
|
509
|
-
console.log("this._getSearchConfig");
|
510
498
|
const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
|
511
|
-
console.log("searchConfiguration");
|
512
|
-
console.log(searchConfiguration);
|
513
499
|
const searchOptions = Object.assign({ view: this.mapView, container: this._searchElement, searchTerm: this._searchTerm }, searchConfiguration);
|
514
500
|
this._searchWidget = new this.Search(searchOptions);
|
515
501
|
this._searchWidget.popupEnabled = false;
|
@@ -549,11 +535,9 @@ const MapSelectTools = class {
|
|
549
535
|
? view.map.findLayerById(layerSource.layer.id)
|
550
536
|
: null;
|
551
537
|
if (layerFromMap) {
|
552
|
-
console.log("layerFromMap");
|
553
538
|
layerSource.layer = layerFromMap;
|
554
539
|
}
|
555
540
|
else if ((_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url) {
|
556
|
-
console.log("create new");
|
557
541
|
layerSource.layer = new this.FeatureLayer((_c = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _c === void 0 ? void 0 : _c.url);
|
558
542
|
}
|
559
543
|
}
|
@@ -1082,7 +1082,7 @@ function(t){var e=function(t){for(var e=t.length,r=new Uint8Array(e),n=0;n<e;n++
|
|
1082
1082
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1083
1083
|
* ====================================================================
|
1084
1084
|
*/
|
1085
|
-
function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):Promise.resolve().then(function () { return require('./index.es-
|
1085
|
+
function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):Promise.resolve().then(function () { return require('./index.es-e47b660c.js'); })).catch((function(t){return Promise.reject(new Error("Could not load canvg: "+t))})).then((function(t){return t.default?t.default:t}))}E.API.addSvgAsImage=function(t,r,n,i,o,s,c,u){if(isNaN(r)||isNaN(n))throw a.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(i)||isNaN(o))throw a.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var h=document.createElement("canvas");h.width=i,h.height=o;var l=h.getContext("2d");l.fillStyle="#fff",l.fillRect(0,0,h.width,h.height);var f={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},d=this;return e().then((function(e){return e.fromString(l,t,f)}),(function(){return Promise.reject(new Error("Could not load canvg."))})).then((function(t){return t.render(f)})).then((function(){d.addImage(h.toDataURL("image/jpeg",1),r,n,i,o,c,u);}))};}(),E.API.putTotalPages=function(t){var e,r=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(e=new RegExp(t,"g"),r=this.internal.getNumberOfPages()):(e=new RegExp(this.pdfEscape16(t,this.internal.getFont()),"g"),r=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var i=0;i<this.internal.pages[n].length;i++)this.internal.pages[n][i]=this.internal.pages[n][i].replace(e,r);return this},E.API.viewerPreferences=function(e,r){var n;e=e||{},r=r||!1;var i,a,o,s={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},c=Object.keys(s),u=[],h=0,l=0,f=0;function d(t,e){var r,n=!1;for(r=0;r<t.length;r+=1)t[r]===e&&(n=!0);return n}if(void 0===this.internal.viewerpreferences&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(s)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,"reset"===e||!0===r){var p=c.length;for(f=0;f<p;f+=1)n[c[f]].value=n[c[f]].defaultValue,n[c[f]].explicitSet=!1;}if("object"===t(e))for(a in e)if(o=e[a],d(c,a)&&void 0!==o){if("boolean"===n[a].type&&"boolean"==typeof o)n[a].value=o;else if("name"===n[a].type&&d(n[a].valueSet,o))n[a].value=o;else if("integer"===n[a].type&&Number.isInteger(o))n[a].value=o;else if("array"===n[a].type){for(h=0;h<o.length;h+=1)if(i=!0,1===o[h].length&&"number"==typeof o[h][0])u.push(String(o[h]-1));else if(o[h].length>1){for(l=0;l<o[h].length;l+=1)"number"!=typeof o[h][l]&&(i=!1);!0===i&&u.push([o[h][0]-1,o[h][1]-1].join(" "));}n[a].value="["+u.join(" ")+"]";}else n[a].value=n[a].defaultValue;n[a].explicitSet=!0;}return !1===this.internal.viewerpreferences.isSubscribed&&(this.internal.events.subscribe("putCatalog",(function(){var t,e=[];for(t in n)!0===n[t].explicitSet&&("name"===n[t].type?e.push("/"+t+" /"+n[t].value):e.push("/"+t+" "+n[t].value));0!==e.length&&this.internal.write("/ViewerPreferences\n<<\n"+e.join("\n")+"\n>>");})),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=n,this},
|
1086
1086
|
/** ====================================================================
|
1087
1087
|
* @license
|
1088
1088
|
* jsPDF XMP metadata plugin
|
@@ -2124,6 +2124,7 @@ function _downloadPDFFile(labels, labelPageDescription, fileTitle) {
|
|
2124
2124
|
* See the License for the specific language governing permissions and
|
2125
2125
|
* limitations under the License.
|
2126
2126
|
*/
|
2127
|
+
const lineSeparatorChar = "|";
|
2127
2128
|
//#endregion
|
2128
2129
|
//#region Public functions
|
2129
2130
|
/**
|
@@ -2156,7 +2157,12 @@ async function downloadCSV(selectionSetNames, layer, ids, formatUsingLayerPopup,
|
|
2156
2157
|
*/
|
2157
2158
|
async function downloadPDF(selectionSetNames, layer, ids, removeDuplicates, labelPageDescription) {
|
2158
2159
|
console.log("downloadPDF using selectionSetNames " + JSON.stringify(selectionSetNames)); //???
|
2159
|
-
|
2160
|
+
let labels = await _prepareLabels(layer, ids, removeDuplicates);
|
2161
|
+
labels =
|
2162
|
+
// Remove empty lines in labels
|
2163
|
+
labels.map(labelLines => labelLines.filter(line => line.length > 0))
|
2164
|
+
// Remove empty labels
|
2165
|
+
.filter(label => label.length > 0);
|
2160
2166
|
exportPDF(labels, labelPageDescription);
|
2161
2167
|
return Promise.resolve();
|
2162
2168
|
}
|
@@ -2167,7 +2173,7 @@ async function downloadPDF(selectionSetNames, layer, ids, removeDuplicates, labe
|
|
2167
2173
|
*
|
2168
2174
|
* @param fieldInfos Layer's fieldInfos structure
|
2169
2175
|
* @param bypassFieldVisiblity Indicates if the configured fieldInfo visibility property should be ignored
|
2170
|
-
* @return Label spec
|
2176
|
+
* @return Label spec with lines separated by `lineSeparatorChar`
|
2171
2177
|
*/
|
2172
2178
|
function _convertPopupFieldsToLabelSpec(fieldInfos, bypassFieldVisiblity = false) {
|
2173
2179
|
const labelSpec = [];
|
@@ -2177,7 +2183,7 @@ function _convertPopupFieldsToLabelSpec(fieldInfos, bypassFieldVisiblity = false
|
|
2177
2183
|
labelSpec.push(`{${fieldInfo.fieldName}}`);
|
2178
2184
|
}
|
2179
2185
|
});
|
2180
|
-
return labelSpec;
|
2186
|
+
return labelSpec.join(lineSeparatorChar);
|
2181
2187
|
}
|
2182
2188
|
/**
|
2183
2189
|
* Converts the text of a custom popup into a multiline label specification; conversion splits text into
|
@@ -2185,22 +2191,19 @@ function _convertPopupFieldsToLabelSpec(fieldInfos, bypassFieldVisiblity = false
|
|
2185
2191
|
*
|
2186
2192
|
* @param popupInfo Layer's popupInfo structure containing description, fieldInfos, and expressionInfos, e.g.,
|
2187
2193
|
* "<div style='text-align: left;'>{NAME}<br />{STREET}<br />{CITY}, {STATE} {ZIP} <br /></div>"
|
2188
|
-
* @return Label spec
|
2194
|
+
* @return Label spec with lines separated by `lineSeparatorChar`
|
2189
2195
|
*/
|
2190
2196
|
function _convertPopupTextToLabelSpec(popupInfo) {
|
2191
|
-
// Replace <br>, <br/> with
|
2192
|
-
popupInfo = popupInfo.replace(/<br\s*\/?>/gi,
|
2193
|
-
// Remove remaining HTML tags, replace 0xA0 that popup uses for spaces, replace some char representations,
|
2197
|
+
// Replace <br>, <br/> with the line separator character
|
2198
|
+
popupInfo = popupInfo.replace(/<br\s*\/?>/gi, lineSeparatorChar);
|
2199
|
+
// Remove remaining HTML tags, replace 0xA0 that popup uses for spaces, and replace some char representations,
|
2194
2200
|
// and split the label back into individual lines
|
2195
|
-
|
2201
|
+
const labelSpec = popupInfo
|
2196
2202
|
.replace(/<[\s.]*[^<>]*\/?>/gi, "")
|
2197
2203
|
.replace(/\xA0/gi, " ")
|
2198
2204
|
.replace(/</gi, "<")
|
2199
2205
|
.replace(/>/gi, ">")
|
2200
|
-
.replace(/ /gi, " ")
|
2201
|
-
.split("|");
|
2202
|
-
// Trim lines and remove empties
|
2203
|
-
labelSpec = labelSpec.map(line => line.trim()).filter(line => line.length > 0);
|
2206
|
+
.replace(/ /gi, " ");
|
2204
2207
|
return labelSpec;
|
2205
2208
|
}
|
2206
2209
|
/**
|
@@ -2219,7 +2222,7 @@ async function _createArcadeExecutors(labelFormat, layer) {
|
|
2219
2222
|
}
|
2220
2223
|
// Are there any Arcade expressions in the label format?
|
2221
2224
|
const arcadeExpressionRegExp = /\{expression\/\w+\}/g;
|
2222
|
-
const arcadeExpressionsMatches = labelFormat.
|
2225
|
+
const arcadeExpressionsMatches = labelFormat.match(arcadeExpressionRegExp);
|
2223
2226
|
if (!arcadeExpressionsMatches) {
|
2224
2227
|
return Promise.resolve(arcadeExecutors);
|
2225
2228
|
}
|
@@ -2246,6 +2249,39 @@ async function _createArcadeExecutors(labelFormat, layer) {
|
|
2246
2249
|
return arcadeExecutors;
|
2247
2250
|
});
|
2248
2251
|
}
|
2252
|
+
/**
|
2253
|
+
* Prepares an attribute's value by applying domain and type information.
|
2254
|
+
*
|
2255
|
+
* @param attributeValue Value of attribute
|
2256
|
+
* @param attributeType Type of attribute
|
2257
|
+
* @param attributeDomain Domain info for attribute, if any
|
2258
|
+
* @return Attribute value modified appropriate to domain and type
|
2259
|
+
*/
|
2260
|
+
function _prepareAttributeValue(attributeValue, attributeType, attributeDomain, intl) {
|
2261
|
+
if (attributeDomain && attributeDomain.type === "coded-value") {
|
2262
|
+
// "coded-value" domain field
|
2263
|
+
const value = attributeDomain.getName(attributeValue);
|
2264
|
+
return value;
|
2265
|
+
}
|
2266
|
+
else {
|
2267
|
+
// Non-domain field or unsupported domain type
|
2268
|
+
let value = attributeValue;
|
2269
|
+
switch (attributeType) {
|
2270
|
+
case "date":
|
2271
|
+
// Format date produces odd characters for the space between the time and the AM/PM text,
|
2272
|
+
// e.g., "12/31/1969, 4:00 PM"
|
2273
|
+
value = intl.formatDate(value).replace(/\xe2\x80\xaf/g, "");
|
2274
|
+
break;
|
2275
|
+
case "double":
|
2276
|
+
case "integer":
|
2277
|
+
case "long":
|
2278
|
+
case "small-integer":
|
2279
|
+
value = intl.formatNumber(value);
|
2280
|
+
break;
|
2281
|
+
}
|
2282
|
+
return value;
|
2283
|
+
}
|
2284
|
+
}
|
2249
2285
|
/**
|
2250
2286
|
* Creates labels from items.
|
2251
2287
|
*
|
@@ -2262,6 +2298,13 @@ async function _prepareLabels(layer, ids, removeDuplicates = true, formatUsingLa
|
|
2262
2298
|
const [intl] = await loadModules.loadModules(["esri/intl"]);
|
2263
2299
|
// Get the features to export
|
2264
2300
|
const featureSet = await mapViewUtils.queryFeaturesByID(ids, layer);
|
2301
|
+
// Get field data types. Do we have any domain-based fields?
|
2302
|
+
const attributeTypes = {};
|
2303
|
+
const attributeDomains = {};
|
2304
|
+
layer.fields.forEach(field => {
|
2305
|
+
attributeTypes[field.name] = field.type;
|
2306
|
+
attributeDomains[field.name] = field.domain;
|
2307
|
+
});
|
2265
2308
|
// Get the label formatting, if any
|
2266
2309
|
let labelFormat;
|
2267
2310
|
let arcadeExecutors = {};
|
@@ -2275,7 +2318,7 @@ async function _prepareLabels(layer, ids, removeDuplicates = true, formatUsingLa
|
|
2275
2318
|
// Can we use the popup title?
|
2276
2319
|
// eslint-disable-next-line unicorn/prefer-ternary
|
2277
2320
|
if (typeof layer.popupTemplate.title === "string") {
|
2278
|
-
labelFormat =
|
2321
|
+
labelFormat = layer.popupTemplate.title;
|
2279
2322
|
// Otherwise revert to using attributes
|
2280
2323
|
}
|
2281
2324
|
else {
|
@@ -2294,35 +2337,43 @@ async function _prepareLabels(layer, ids, removeDuplicates = true, formatUsingLa
|
|
2294
2337
|
// eslint-disable-next-line unicorn/prefer-ternary
|
2295
2338
|
if (labelFormat) {
|
2296
2339
|
const arcadeExpressionRegExp = /\{expression\/\w+\}/g;
|
2297
|
-
|
2340
|
+
const attributeRegExp = /\{\w+\}/g;
|
2341
|
+
// Find the label fields that we need to replace with values
|
2342
|
+
const arcadeExpressionMatches = labelFormat.match(arcadeExpressionRegExp);
|
2343
|
+
const attributeMatches = labelFormat.match(attributeRegExp);
|
2344
|
+
// Convert feature attributes into an array of labels
|
2298
2345
|
labels = featureSet.features.map(feature => {
|
2299
|
-
|
2300
|
-
|
2301
|
-
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2305
|
-
|
2306
|
-
|
2307
|
-
|
2308
|
-
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2316
|
-
|
2346
|
+
let labelPrep = labelFormat;
|
2347
|
+
// Replace Arcade expressions
|
2348
|
+
if (arcadeExpressionMatches) {
|
2349
|
+
arcadeExpressionMatches.forEach((match) => {
|
2350
|
+
const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
|
2351
|
+
const value = arcadeExecutors[expressionName].execute({ "$feature": feature });
|
2352
|
+
labelPrep = labelPrep.replace(match, value);
|
2353
|
+
});
|
2354
|
+
}
|
2355
|
+
// Replace non-Arcade fields
|
2356
|
+
if (attributeMatches) {
|
2357
|
+
attributeMatches.forEach((match) => {
|
2358
|
+
const attributeName = match.substring(1, match.length - 1);
|
2359
|
+
const value = _prepareAttributeValue(feature.attributes[attributeName], attributeTypes[attributeName], attributeDomains[attributeName], intl);
|
2360
|
+
labelPrep = labelPrep.replace(match, value);
|
2361
|
+
});
|
2362
|
+
}
|
2363
|
+
// Split label into lines
|
2364
|
+
let label = labelPrep.split(lineSeparatorChar);
|
2365
|
+
// Trim lines
|
2366
|
+
label = label.map(line => line.trim());
|
2317
2367
|
return label;
|
2318
|
-
})
|
2319
|
-
// Remove empty labels
|
2320
|
-
.filter(label => label.length > 0);
|
2368
|
+
});
|
2321
2369
|
}
|
2322
2370
|
else {
|
2323
2371
|
// Export all attributes
|
2324
2372
|
labels = featureSet.features.map(feature => {
|
2325
|
-
return Object.
|
2373
|
+
return Object.keys(feature.attributes).map((attributeName) => {
|
2374
|
+
const value = _prepareAttributeValue(feature.attributes[attributeName], attributeTypes[attributeName], attributeDomains[attributeName], intl);
|
2375
|
+
return `${value}`;
|
2376
|
+
});
|
2326
2377
|
});
|
2327
2378
|
}
|
2328
2379
|
// Remove duplicates
|
@@ -2335,14 +2386,12 @@ async function _prepareLabels(layer, ids, removeDuplicates = true, formatUsingLa
|
|
2335
2386
|
if (includeHeaderNames) {
|
2336
2387
|
let headerNames = [];
|
2337
2388
|
if (labelFormat) {
|
2338
|
-
headerNames = labelFormat.
|
2389
|
+
headerNames = labelFormat.replace(/\{/g, "").replace(/\}/g, "").split(lineSeparatorChar);
|
2339
2390
|
}
|
2340
2391
|
else {
|
2341
2392
|
const featuresAttrs = featureSet.features[0].attributes;
|
2342
2393
|
Object.keys(featuresAttrs).forEach(k => {
|
2343
|
-
|
2344
|
-
headerNames.push(k);
|
2345
|
-
}
|
2394
|
+
headerNames.push(k);
|
2346
2395
|
});
|
2347
2396
|
}
|
2348
2397
|
labels.unshift(headerNames);
|
@@ -6,7 +6,7 @@
|
|
6
6
|
'use strict';
|
7
7
|
|
8
8
|
const _commonjsHelpers = require('./_commonjsHelpers-384729db.js');
|
9
|
-
const downloadUtils = require('./downloadUtils-
|
9
|
+
const downloadUtils = require('./downloadUtils-d05b069f.js');
|
10
10
|
require('./index-c6979cbb.js');
|
11
11
|
require('./loadModules-0806a34f.js');
|
12
12
|
require('./locale-04da9a8c.js');
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
10
10
|
const index = require('./index-c6979cbb.js');
|
11
11
|
const locale = require('./locale-04da9a8c.js');
|
12
12
|
const mapViewUtils = require('./mapViewUtils-d250b1ed.js');
|
13
|
-
const downloadUtils = require('./downloadUtils-
|
13
|
+
const downloadUtils = require('./downloadUtils-d05b069f.js');
|
14
14
|
require('./_commonjsHelpers-384729db.js');
|
15
15
|
require('./interfaces-17c631bf.js');
|
16
16
|
require('./loadModules-0806a34f.js');
|
@@ -69,17 +69,9 @@ const PublicNotification = class {
|
|
69
69
|
* @returns Promise when complete
|
70
70
|
*/
|
71
71
|
async watchSearchConfigurationHandler(newValue, oldValue) {
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
console.log("PN watchSearchConfigurationHandler");
|
76
|
-
console.log("PN newValue");
|
77
|
-
console.log(newValue);
|
78
|
-
console.log("PN oldValue");
|
79
|
-
console.log(oldValue);
|
80
|
-
if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
|
81
|
-
console.log("Emit event from parent");
|
82
|
-
this._searchConfiguration = Object.assign({}, newValue);
|
72
|
+
const s_newValue = JSON.stringify(newValue);
|
73
|
+
if (s_newValue !== JSON.stringify(oldValue)) {
|
74
|
+
this._searchConfiguration = JSON.parse(s_newValue);
|
83
75
|
this.searchConfigurationChange.emit(this._searchConfiguration);
|
84
76
|
}
|
85
77
|
}
|
@@ -78,11 +78,6 @@ export class MapSelectTools {
|
|
78
78
|
* @returns Promise when complete
|
79
79
|
*/
|
80
80
|
async watchSearchConfigurationHandler(newValue, oldValue) {
|
81
|
-
console.log("watchSearchConfigurationHandler");
|
82
|
-
console.log("newValue");
|
83
|
-
console.log(newValue);
|
84
|
-
console.log("oldValue");
|
85
|
-
console.log(oldValue);
|
86
81
|
if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
|
87
82
|
this._initSearchWidget();
|
88
83
|
}
|
@@ -149,7 +144,6 @@ export class MapSelectTools {
|
|
149
144
|
* Handle changes to the search configuration
|
150
145
|
*/
|
151
146
|
searchConfigurationChangeChanged(event) {
|
152
|
-
console.log("searchConfigurationChange listener");
|
153
147
|
this.searchConfiguration = event.detail;
|
154
148
|
}
|
155
149
|
/**
|
@@ -282,16 +276,8 @@ export class MapSelectTools {
|
|
282
276
|
* @protected
|
283
277
|
*/
|
284
278
|
_initSearchWidget() {
|
285
|
-
console.log("_initSearchWidget");
|
286
|
-
console.log("this.mapView");
|
287
|
-
console.log(this.mapView);
|
288
|
-
console.log("this._searchElement");
|
289
|
-
console.log(this._searchElement);
|
290
279
|
if (this.mapView && this._searchElement) {
|
291
|
-
console.log("this._getSearchConfig");
|
292
280
|
const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
|
293
|
-
console.log("searchConfiguration");
|
294
|
-
console.log(searchConfiguration);
|
295
281
|
const searchOptions = Object.assign({ view: this.mapView, container: this._searchElement, searchTerm: this._searchTerm }, searchConfiguration);
|
296
282
|
this._searchWidget = new this.Search(searchOptions);
|
297
283
|
this._searchWidget.popupEnabled = false;
|
@@ -331,11 +317,9 @@ export class MapSelectTools {
|
|
331
317
|
? view.map.findLayerById(layerSource.layer.id)
|
332
318
|
: null;
|
333
319
|
if (layerFromMap) {
|
334
|
-
console.log("layerFromMap");
|
335
320
|
layerSource.layer = layerFromMap;
|
336
321
|
}
|
337
322
|
else if ((_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url) {
|
338
|
-
console.log("create new");
|
339
323
|
layerSource.layer = new this.FeatureLayer((_c = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _c === void 0 ? void 0 : _c.url);
|
340
324
|
}
|
341
325
|
}
|
@@ -73,17 +73,9 @@ export class PublicNotification {
|
|
73
73
|
* @returns Promise when complete
|
74
74
|
*/
|
75
75
|
async watchSearchConfigurationHandler(newValue, oldValue) {
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
console.log("PN watchSearchConfigurationHandler");
|
80
|
-
console.log("PN newValue");
|
81
|
-
console.log(newValue);
|
82
|
-
console.log("PN oldValue");
|
83
|
-
console.log(oldValue);
|
84
|
-
if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
|
85
|
-
console.log("Emit event from parent");
|
86
|
-
this._searchConfiguration = Object.assign({}, newValue);
|
76
|
+
const s_newValue = JSON.stringify(newValue);
|
77
|
+
if (s_newValue !== JSON.stringify(oldValue)) {
|
78
|
+
this._searchConfiguration = JSON.parse(s_newValue);
|
87
79
|
this.searchConfigurationChange.emit(this._searchConfiguration);
|
88
80
|
}
|
89
81
|
}
|