@esri/solutions-components 0.6.45 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/card-manager_3.cjs.entry.js +1 -1
- package/dist/cjs/{downloadUtils-d017810f.js → downloadUtils-e3e595e9.js} +30 -52
- package/dist/cjs/{index.es-de35a9a4.js → index.es-047537b5.js} +1 -1
- package/dist/cjs/map-select-tools_3.cjs.entry.js +1 -1
- package/dist/cjs/public-notification.cjs.entry.js +1 -1
- package/dist/collection/demos/new-public-notification.html +16 -2
- package/dist/collection/utils/downloadUtils.js +28 -50
- package/dist/collection/utils/downloadUtils.ts +7 -13
- package/dist/components/downloadUtils.js +28 -50
- package/dist/esm/card-manager_3.entry.js +1 -1
- package/dist/esm/{downloadUtils-a3f28bae.js → downloadUtils-8fbd1347.js} +29 -51
- package/dist/esm/{index.es-e0432a23.js → index.es-b6705ce7.js} +1 -1
- package/dist/esm/map-select-tools_3.entry.js +1 -1
- package/dist/esm/public-notification.entry.js +1 -1
- package/dist/solutions-components/demos/new-public-notification.html +16 -2
- package/dist/solutions-components/{p-02b1befe.js → p-072680a5.js} +12 -12
- package/dist/solutions-components/{p-5d5d10d5.js → p-092fd5d9.js} +1 -1
- package/dist/solutions-components/{p-4fbf3997.entry.js → p-11cb7b04.entry.js} +1 -1
- package/dist/solutions-components/{p-94d64f05.entry.js → p-7f793144.entry.js} +1 -1
- package/dist/solutions-components/{p-5a5676d4.entry.js → p-f367db61.entry.js} +1 -1
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/downloadUtils.ts +7 -13
- package/dist/types/utils/downloadUtils.d.ts +1 -9
- package/package.json +1 -1
@@ -11,7 +11,7 @@ const index = require('./index-2d5760f2.js');
|
|
11
11
|
const locale = require('./locale-ef06bf9e.js');
|
12
12
|
const mapViewUtils = require('./mapViewUtils-f7bbc35b.js');
|
13
13
|
const loadModules = require('./loadModules-ad1ab1a8.js');
|
14
|
-
const downloadUtils = require('./downloadUtils-
|
14
|
+
const downloadUtils = require('./downloadUtils-e3e595e9.js');
|
15
15
|
require('./_commonjsHelpers-384729db.js');
|
16
16
|
require('./interfaces-000be6de.js');
|
17
17
|
require('./solution-resource-f9e3b289.js');
|
@@ -1509,7 +1509,7 @@ function(t){var e=function(t){for(var e=t.length,r=new Uint8Array(e),n=0;n<e;n++
|
|
1509
1509
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1510
1510
|
* ====================================================================
|
1511
1511
|
*/
|
1512
|
-
function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):Promise.resolve().then(function () { return require('./index.es-
|
1512
|
+
function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):Promise.resolve().then(function () { return require('./index.es-047537b5.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},
|
1513
1513
|
/** ====================================================================
|
1514
1514
|
* @license
|
1515
1515
|
* jsPDF XMP metadata plugin
|
@@ -2556,28 +2556,21 @@ async function _convertPopupArcadeToLabelSpec(expressionInfo) {
|
|
2556
2556
|
* @param layer Layer from which to fetch features
|
2557
2557
|
* @return Promise resolving to a set of executors keyed using the expression name
|
2558
2558
|
*/
|
2559
|
-
|
2560
|
-
|
2561
|
-
labelFormat: string,
|
2562
|
-
layer: __esri.FeatureLayer
|
2563
|
-
): Promise<IArcadeExecutors> {
|
2564
|
-
const arcadeExecutors: IArcadeExecutors = {};
|
2565
|
-
|
2559
|
+
async function _createArcadeExecutors(labelFormat, layer) {
|
2560
|
+
const arcadeExecutors = {};
|
2566
2561
|
// Are any Arcade expressions in the layer?
|
2567
2562
|
if (!Array.isArray(layer.popupTemplate.expressionInfos) || layer.popupTemplate.expressionInfos.length === 0) {
|
2568
2563
|
return Promise.resolve(arcadeExecutors);
|
2569
2564
|
}
|
2570
|
-
|
2571
2565
|
// Are there any Arcade expressions in the label format?
|
2572
2566
|
const arcadeExpressionRegExp = /\{expression\/\w+\}/g;
|
2573
2567
|
const arcadeExpressionsMatches = labelFormat.match(arcadeExpressionRegExp);
|
2574
2568
|
if (!arcadeExpressionsMatches) {
|
2575
2569
|
return Promise.resolve(arcadeExecutors);
|
2576
2570
|
}
|
2577
|
-
|
2578
2571
|
// Generate an Arcade executor for each match
|
2579
|
-
const [arcade] = await loadModules(["esri/arcade"]);
|
2580
|
-
const labelingProfile
|
2572
|
+
const [arcade] = await loadModules.loadModules(["esri/arcade"]);
|
2573
|
+
const labelingProfile = {
|
2581
2574
|
variables: [
|
2582
2575
|
{
|
2583
2576
|
name: "$feature",
|
@@ -2597,38 +2590,26 @@ async function _createArcadeExecutors(
|
|
2597
2590
|
}
|
2598
2591
|
]
|
2599
2592
|
};
|
2600
|
-
|
2601
|
-
|
2602
|
-
|
2603
|
-
(
|
2604
|
-
|
2605
|
-
|
2606
|
-
|
2607
|
-
|
2608
|
-
|
2609
|
-
|
2610
|
-
arcade.createArcadeExecutor(expressionInfo.expression, labelingProfile);
|
2611
|
-
}
|
2612
|
-
}
|
2613
|
-
);
|
2614
|
-
}
|
2615
|
-
);
|
2616
|
-
|
2593
|
+
const createArcadeExecutorPromises = {};
|
2594
|
+
arcadeExpressionsMatches.forEach((match) => {
|
2595
|
+
const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
|
2596
|
+
(layer.popupTemplate.expressionInfos || []).forEach(expressionInfo => {
|
2597
|
+
if (expressionInfo.name === expressionName) {
|
2598
|
+
createArcadeExecutorPromises[expressionName] =
|
2599
|
+
arcade.createArcadeExecutor(expressionInfo.expression, labelingProfile);
|
2600
|
+
}
|
2601
|
+
});
|
2602
|
+
});
|
2617
2603
|
const promises = Object.values(createArcadeExecutorPromises);
|
2618
2604
|
return Promise.all(promises)
|
2619
|
-
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
for (let i = 0; i < expressionNames.length; ++i) {
|
2624
|
-
arcadeExecutors[expressionNames[i]] = executors[i].valueOf() as __esri.ArcadeExecutor;
|
2625
|
-
}
|
2626
|
-
|
2627
|
-
return arcadeExecutors;
|
2605
|
+
.then(executors => {
|
2606
|
+
const expressionNames = Object.keys(createArcadeExecutorPromises);
|
2607
|
+
for (let i = 0; i < expressionNames.length; ++i) {
|
2608
|
+
arcadeExecutors[expressionNames[i]] = executors[i].valueOf();
|
2628
2609
|
}
|
2629
|
-
|
2610
|
+
return arcadeExecutors;
|
2611
|
+
});
|
2630
2612
|
}
|
2631
|
-
*/
|
2632
2613
|
/**
|
2633
2614
|
* Creates a title from a list of selection set names.
|
2634
2615
|
*
|
@@ -3025,7 +3006,7 @@ async function _prepareLabels(webmap, layer, ids, formatUsingLayerPopup = true,
|
|
3025
3006
|
// Apply the label format
|
3026
3007
|
const labels = labelFormatProps.labelFormat.type === "pattern" ?
|
3027
3008
|
// Export attributes in format
|
3028
|
-
await _prepareLabelsFromPattern(
|
3009
|
+
await _prepareLabelsFromPattern(layer, featureSet, attributeOrigNames, attributeTypes, attributeDomains, labelFormatProps.attributeFormats, labelFormatProps.labelFormat.format, includeHeaderNames)
|
3029
3010
|
: labelFormatProps.labelFormat.type === "executor" ?
|
3030
3011
|
// Export attributes in expression
|
3031
3012
|
await _prepareLabelsUsingExecutor(featureSet, labelFormatProps.labelFormat.format)
|
@@ -3075,31 +3056,28 @@ async function _prepareLabelsFromAll(featureSet, attributeTypes, attributeDomain
|
|
3075
3056
|
* @param includeHeaderNames Add the label format at the front of the list of generated labels
|
3076
3057
|
* @returns Promise resolving with list of labels, each of which is a list of label lines
|
3077
3058
|
*/
|
3078
|
-
async function _prepareLabelsFromPattern(
|
3079
|
-
|
3080
|
-
featureSet, attributeOrigNames, attributeTypes, attributeDomains, attributeFormats, labelFormat, includeHeaderNames = false) {
|
3059
|
+
async function _prepareLabelsFromPattern(layer, featureSet, attributeOrigNames, attributeTypes, attributeDomains, attributeFormats, labelFormat, includeHeaderNames = false) {
|
3060
|
+
var _a;
|
3081
3061
|
const [intl] = await loadModules.loadModules(["esri/intl"]);
|
3082
3062
|
// Find the label fields that we need to replace with values
|
3083
3063
|
const attributeExpressionMatches = _getFieldExpressionsFromLabel(labelFormat);
|
3084
3064
|
const attributeNames = _getFieldNamesFromFieldExpressions(attributeExpressionMatches);
|
3085
3065
|
// Do we need any Arcade executors?
|
3086
|
-
|
3087
|
-
|
3066
|
+
const arcadeExecutors = await _createArcadeExecutors(labelFormat, layer);
|
3067
|
+
const arcadeExpressionRegExp = /\{expression\/\w+\}/g;
|
3088
3068
|
// Find the label fields that we need to replace with values
|
3089
|
-
|
3069
|
+
const arcadeExpressionMatches = (_a = labelFormat.match(arcadeExpressionRegExp)) !== null && _a !== void 0 ? _a : [];
|
3090
3070
|
// Convert feature attributes into an array of labels
|
3091
3071
|
const labels = await Promise.all(featureSet.map(async (feature) => {
|
3092
3072
|
var _a;
|
3093
3073
|
let labelPrep = labelFormat;
|
3094
|
-
|
3095
|
-
// Replace Arcade expressions in this feature
|
3074
|
+
//Replace Arcade expressions in this feature
|
3096
3075
|
for (let i = 0; i < arcadeExpressionMatches.length; i++) {
|
3097
|
-
const match
|
3076
|
+
const match = arcadeExpressionMatches[i];
|
3098
3077
|
const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
|
3099
|
-
const value = await arcadeExecutors[expressionName].executeAsync({"$feature": feature, "$layer"
|
3078
|
+
const value = await arcadeExecutors[expressionName].executeAsync({ "$feature": feature, "$layer": layer });
|
3100
3079
|
labelPrep = labelPrep.replace(match, value);
|
3101
3080
|
}
|
3102
|
-
*/
|
3103
3081
|
// Replace non-Arcade fields in this feature
|
3104
3082
|
const attributeValues = (_a = feature.attributes) !== null && _a !== void 0 ? _a : feature;
|
3105
3083
|
attributeNames.forEach((attributeName, i) => {
|
@@ -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-e3e595e9.js');
|
10
10
|
require('./index-2d5760f2.js');
|
11
11
|
require('./loadModules-ad1ab1a8.js');
|
12
12
|
require('./locale-ef06bf9e.js');
|
@@ -13,7 +13,7 @@ const mapViewUtils = require('./mapViewUtils-f7bbc35b.js');
|
|
13
13
|
const interfaces = require('./interfaces-000be6de.js');
|
14
14
|
const publicNotificationStore = require('./publicNotificationStore-e1ae21f1.js');
|
15
15
|
const locale = require('./locale-ef06bf9e.js');
|
16
|
-
const downloadUtils = require('./downloadUtils-
|
16
|
+
const downloadUtils = require('./downloadUtils-e3e595e9.js');
|
17
17
|
require('./index-74222073.js');
|
18
18
|
require('./_commonjsHelpers-384729db.js');
|
19
19
|
require('./solution-resource-f9e3b289.js');
|
@@ -13,7 +13,7 @@ const loadModules = require('./loadModules-ad1ab1a8.js');
|
|
13
13
|
const mapViewUtils = require('./mapViewUtils-f7bbc35b.js');
|
14
14
|
const publicNotificationStore = require('./publicNotificationStore-e1ae21f1.js');
|
15
15
|
const locale = require('./locale-ef06bf9e.js');
|
16
|
-
const downloadUtils = require('./downloadUtils-
|
16
|
+
const downloadUtils = require('./downloadUtils-e3e595e9.js');
|
17
17
|
require('./index-74222073.js');
|
18
18
|
require('./_commonjsHelpers-384729db.js');
|
19
19
|
require('./solution-resource-f9e3b289.js');
|
@@ -74,13 +74,27 @@
|
|
74
74
|
Legend,
|
75
75
|
esriConfig
|
76
76
|
) => {
|
77
|
+
let itemId;
|
78
|
+
var vars = window.location.search.substring(1).split('&');
|
79
|
+
vars.forEach((param) => {
|
80
|
+
let vals = param.split('=');
|
81
|
+
const v = vals[1];
|
82
|
+
switch (vals[0]) {
|
83
|
+
case "id":
|
84
|
+
itemId = v;
|
85
|
+
break;
|
86
|
+
default:
|
87
|
+
break;
|
88
|
+
}
|
89
|
+
});
|
90
|
+
|
77
91
|
//esriConfig.portalUrl = "https://solutions.mapsdevext.arcgis.com";
|
78
92
|
var webMap = new WebMap({
|
79
93
|
portalItem: {
|
80
94
|
// solutions
|
81
|
-
id: "3715f4899bea4b2a948347c5c2357e58"
|
95
|
+
id: itemId ? itemId : "3715f4899bea4b2a948347c5c2357e58"
|
82
96
|
// InstantApps
|
83
|
-
//id: "863e4f6f2a7840db896cc1b1606d552d"
|
97
|
+
//id: itemId ? itemId : "863e4f6f2a7840db896cc1b1606d552d"
|
84
98
|
}
|
85
99
|
});
|
86
100
|
|
@@ -238,28 +238,21 @@ export async function _convertPopupArcadeToLabelSpec(expressionInfo) {
|
|
238
238
|
* @param layer Layer from which to fetch features
|
239
239
|
* @return Promise resolving to a set of executors keyed using the expression name
|
240
240
|
*/
|
241
|
-
|
242
|
-
|
243
|
-
labelFormat: string,
|
244
|
-
layer: __esri.FeatureLayer
|
245
|
-
): Promise<IArcadeExecutors> {
|
246
|
-
const arcadeExecutors: IArcadeExecutors = {};
|
247
|
-
|
241
|
+
async function _createArcadeExecutors(labelFormat, layer) {
|
242
|
+
const arcadeExecutors = {};
|
248
243
|
// Are any Arcade expressions in the layer?
|
249
244
|
if (!Array.isArray(layer.popupTemplate.expressionInfos) || layer.popupTemplate.expressionInfos.length === 0) {
|
250
245
|
return Promise.resolve(arcadeExecutors);
|
251
246
|
}
|
252
|
-
|
253
247
|
// Are there any Arcade expressions in the label format?
|
254
248
|
const arcadeExpressionRegExp = /\{expression\/\w+\}/g;
|
255
249
|
const arcadeExpressionsMatches = labelFormat.match(arcadeExpressionRegExp);
|
256
250
|
if (!arcadeExpressionsMatches) {
|
257
251
|
return Promise.resolve(arcadeExecutors);
|
258
252
|
}
|
259
|
-
|
260
253
|
// Generate an Arcade executor for each match
|
261
254
|
const [arcade] = await loadModules(["esri/arcade"]);
|
262
|
-
const labelingProfile
|
255
|
+
const labelingProfile = {
|
263
256
|
variables: [
|
264
257
|
{
|
265
258
|
name: "$feature",
|
@@ -279,38 +272,26 @@ async function _createArcadeExecutors(
|
|
279
272
|
}
|
280
273
|
]
|
281
274
|
};
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
(
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
arcade.createArcadeExecutor(expressionInfo.expression, labelingProfile);
|
293
|
-
}
|
294
|
-
}
|
295
|
-
);
|
296
|
-
}
|
297
|
-
);
|
298
|
-
|
275
|
+
const createArcadeExecutorPromises = {};
|
276
|
+
arcadeExpressionsMatches.forEach((match) => {
|
277
|
+
const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
|
278
|
+
(layer.popupTemplate.expressionInfos || []).forEach(expressionInfo => {
|
279
|
+
if (expressionInfo.name === expressionName) {
|
280
|
+
createArcadeExecutorPromises[expressionName] =
|
281
|
+
arcade.createArcadeExecutor(expressionInfo.expression, labelingProfile);
|
282
|
+
}
|
283
|
+
});
|
284
|
+
});
|
299
285
|
const promises = Object.values(createArcadeExecutorPromises);
|
300
286
|
return Promise.all(promises)
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
for (let i = 0; i < expressionNames.length; ++i) {
|
306
|
-
arcadeExecutors[expressionNames[i]] = executors[i].valueOf() as __esri.ArcadeExecutor;
|
307
|
-
}
|
308
|
-
|
309
|
-
return arcadeExecutors;
|
287
|
+
.then(executors => {
|
288
|
+
const expressionNames = Object.keys(createArcadeExecutorPromises);
|
289
|
+
for (let i = 0; i < expressionNames.length; ++i) {
|
290
|
+
arcadeExecutors[expressionNames[i]] = executors[i].valueOf();
|
310
291
|
}
|
311
|
-
|
292
|
+
return arcadeExecutors;
|
293
|
+
});
|
312
294
|
}
|
313
|
-
*/
|
314
295
|
/**
|
315
296
|
* Creates a title from a list of selection set names.
|
316
297
|
*
|
@@ -707,7 +688,7 @@ export async function _prepareLabels(webmap, layer, ids, formatUsingLayerPopup =
|
|
707
688
|
// Apply the label format
|
708
689
|
const labels = labelFormatProps.labelFormat.type === "pattern" ?
|
709
690
|
// Export attributes in format
|
710
|
-
await _prepareLabelsFromPattern(
|
691
|
+
await _prepareLabelsFromPattern(layer, featureSet, attributeOrigNames, attributeTypes, attributeDomains, labelFormatProps.attributeFormats, labelFormatProps.labelFormat.format, includeHeaderNames)
|
711
692
|
: labelFormatProps.labelFormat.type === "executor" ?
|
712
693
|
// Export attributes in expression
|
713
694
|
await _prepareLabelsUsingExecutor(featureSet, labelFormatProps.labelFormat.format)
|
@@ -757,31 +738,28 @@ export async function _prepareLabelsFromAll(featureSet, attributeTypes, attribut
|
|
757
738
|
* @param includeHeaderNames Add the label format at the front of the list of generated labels
|
758
739
|
* @returns Promise resolving with list of labels, each of which is a list of label lines
|
759
740
|
*/
|
760
|
-
export async function _prepareLabelsFromPattern(
|
761
|
-
|
762
|
-
featureSet, attributeOrigNames, attributeTypes, attributeDomains, attributeFormats, labelFormat, includeHeaderNames = false) {
|
741
|
+
export async function _prepareLabelsFromPattern(layer, featureSet, attributeOrigNames, attributeTypes, attributeDomains, attributeFormats, labelFormat, includeHeaderNames = false) {
|
742
|
+
var _a;
|
763
743
|
const [intl] = await loadModules(["esri/intl"]);
|
764
744
|
// Find the label fields that we need to replace with values
|
765
745
|
const attributeExpressionMatches = _getFieldExpressionsFromLabel(labelFormat);
|
766
746
|
const attributeNames = _getFieldNamesFromFieldExpressions(attributeExpressionMatches);
|
767
747
|
// Do we need any Arcade executors?
|
768
|
-
|
769
|
-
|
748
|
+
const arcadeExecutors = await _createArcadeExecutors(labelFormat, layer);
|
749
|
+
const arcadeExpressionRegExp = /\{expression\/\w+\}/g;
|
770
750
|
// Find the label fields that we need to replace with values
|
771
|
-
|
751
|
+
const arcadeExpressionMatches = (_a = labelFormat.match(arcadeExpressionRegExp)) !== null && _a !== void 0 ? _a : [];
|
772
752
|
// Convert feature attributes into an array of labels
|
773
753
|
const labels = await Promise.all(featureSet.map(async (feature) => {
|
774
754
|
var _a;
|
775
755
|
let labelPrep = labelFormat;
|
776
|
-
|
777
|
-
// Replace Arcade expressions in this feature
|
756
|
+
//Replace Arcade expressions in this feature
|
778
757
|
for (let i = 0; i < arcadeExpressionMatches.length; i++) {
|
779
|
-
const match
|
758
|
+
const match = arcadeExpressionMatches[i];
|
780
759
|
const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
|
781
|
-
const value = await arcadeExecutors[expressionName].executeAsync({"$feature": feature, "$layer"
|
760
|
+
const value = await arcadeExecutors[expressionName].executeAsync({ "$feature": feature, "$layer": layer });
|
782
761
|
labelPrep = labelPrep.replace(match, value);
|
783
762
|
}
|
784
|
-
*/
|
785
763
|
// Replace non-Arcade fields in this feature
|
786
764
|
const attributeValues = (_a = feature.attributes) !== null && _a !== void 0 ? _a : feature;
|
787
765
|
attributeNames.forEach((attributeName, i) => {
|
@@ -25,7 +25,6 @@ import * as common from "@esri/solution-common";
|
|
25
25
|
|
26
26
|
export { ILabel } from "./pdfUtils";
|
27
27
|
|
28
|
-
/*
|
29
28
|
interface IArcadeExecutors {
|
30
29
|
[expressionName: string]: __esri.ArcadeExecutor;
|
31
30
|
}
|
@@ -33,7 +32,6 @@ interface IArcadeExecutors {
|
|
33
32
|
interface IArcadeExecutorPromises {
|
34
33
|
[expressionName: string]: Promise<__esri.ArcadeExecutor>;
|
35
34
|
}
|
36
|
-
*/
|
37
35
|
|
38
36
|
export interface IAttributeOrigNames {
|
39
37
|
[lowercaseName: string]: string;
|
@@ -381,7 +379,6 @@ export async function _convertPopupArcadeToLabelSpec(
|
|
381
379
|
* @param layer Layer from which to fetch features
|
382
380
|
* @return Promise resolving to a set of executors keyed using the expression name
|
383
381
|
*/
|
384
|
-
/*
|
385
382
|
async function _createArcadeExecutors(
|
386
383
|
labelFormat: string,
|
387
384
|
layer: __esri.FeatureLayer
|
@@ -453,7 +450,6 @@ async function _createArcadeExecutors(
|
|
453
450
|
}
|
454
451
|
);
|
455
452
|
}
|
456
|
-
*/
|
457
453
|
|
458
454
|
/**
|
459
455
|
* Creates a title from a list of selection set names.
|
@@ -944,7 +940,7 @@ export async function _prepareLabels(
|
|
944
940
|
const labels
|
945
941
|
= labelFormatProps.labelFormat.type === "pattern" ?
|
946
942
|
// Export attributes in format
|
947
|
-
await _prepareLabelsFromPattern(
|
943
|
+
await _prepareLabelsFromPattern(layer, featureSet, attributeOrigNames, attributeTypes, attributeDomains,
|
948
944
|
labelFormatProps.attributeFormats, labelFormatProps.labelFormat.format as string, includeHeaderNames)
|
949
945
|
|
950
946
|
: labelFormatProps.labelFormat.type === "executor" ?
|
@@ -1015,7 +1011,7 @@ export async function _prepareLabelsFromAll(
|
|
1015
1011
|
* @returns Promise resolving with list of labels, each of which is a list of label lines
|
1016
1012
|
*/
|
1017
1013
|
export async function _prepareLabelsFromPattern(
|
1018
|
-
|
1014
|
+
layer: __esri.FeatureLayer,
|
1019
1015
|
featureSet: __esri.Graphic[],
|
1020
1016
|
attributeOrigNames: IAttributeOrigNames,
|
1021
1017
|
attributeTypes: IAttributeTypes,
|
@@ -1031,26 +1027,24 @@ export async function _prepareLabelsFromPattern(
|
|
1031
1027
|
const attributeNames = _getFieldNamesFromFieldExpressions(attributeExpressionMatches);
|
1032
1028
|
|
1033
1029
|
// Do we need any Arcade executors?
|
1034
|
-
|
1035
|
-
|
1030
|
+
const arcadeExecutors = await _createArcadeExecutors(labelFormat, layer);
|
1031
|
+
const arcadeExpressionRegExp = /\{expression\/\w+\}/g;
|
1036
1032
|
|
1037
1033
|
// Find the label fields that we need to replace with values
|
1038
|
-
|
1034
|
+
const arcadeExpressionMatches = labelFormat.match(arcadeExpressionRegExp) ?? [];
|
1039
1035
|
|
1040
1036
|
// Convert feature attributes into an array of labels
|
1041
1037
|
const labels = await Promise.all(featureSet.map(
|
1042
1038
|
async feature => {
|
1043
1039
|
let labelPrep = labelFormat;
|
1044
1040
|
|
1045
|
-
|
1046
|
-
// Replace Arcade expressions in this feature
|
1041
|
+
//Replace Arcade expressions in this feature
|
1047
1042
|
for (let i = 0; i < arcadeExpressionMatches.length; i++) {
|
1048
1043
|
const match: string = arcadeExpressionMatches[i];
|
1049
1044
|
const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
|
1050
|
-
const value = await arcadeExecutors[expressionName].executeAsync({"$feature": feature, "$layer"
|
1045
|
+
const value = await arcadeExecutors[expressionName].executeAsync({"$feature": feature, "$layer": layer});
|
1051
1046
|
labelPrep = labelPrep.replace(match, value);
|
1052
1047
|
}
|
1053
|
-
*/
|
1054
1048
|
|
1055
1049
|
// Replace non-Arcade fields in this feature
|
1056
1050
|
const attributeValues = feature.attributes ?? feature;
|
@@ -2554,28 +2554,21 @@ async function _convertPopupArcadeToLabelSpec(expressionInfo) {
|
|
2554
2554
|
* @param layer Layer from which to fetch features
|
2555
2555
|
* @return Promise resolving to a set of executors keyed using the expression name
|
2556
2556
|
*/
|
2557
|
-
|
2558
|
-
|
2559
|
-
labelFormat: string,
|
2560
|
-
layer: __esri.FeatureLayer
|
2561
|
-
): Promise<IArcadeExecutors> {
|
2562
|
-
const arcadeExecutors: IArcadeExecutors = {};
|
2563
|
-
|
2557
|
+
async function _createArcadeExecutors(labelFormat, layer) {
|
2558
|
+
const arcadeExecutors = {};
|
2564
2559
|
// Are any Arcade expressions in the layer?
|
2565
2560
|
if (!Array.isArray(layer.popupTemplate.expressionInfos) || layer.popupTemplate.expressionInfos.length === 0) {
|
2566
2561
|
return Promise.resolve(arcadeExecutors);
|
2567
2562
|
}
|
2568
|
-
|
2569
2563
|
// Are there any Arcade expressions in the label format?
|
2570
2564
|
const arcadeExpressionRegExp = /\{expression\/\w+\}/g;
|
2571
2565
|
const arcadeExpressionsMatches = labelFormat.match(arcadeExpressionRegExp);
|
2572
2566
|
if (!arcadeExpressionsMatches) {
|
2573
2567
|
return Promise.resolve(arcadeExecutors);
|
2574
2568
|
}
|
2575
|
-
|
2576
2569
|
// Generate an Arcade executor for each match
|
2577
2570
|
const [arcade] = await loadModules(["esri/arcade"]);
|
2578
|
-
const labelingProfile
|
2571
|
+
const labelingProfile = {
|
2579
2572
|
variables: [
|
2580
2573
|
{
|
2581
2574
|
name: "$feature",
|
@@ -2595,38 +2588,26 @@ async function _createArcadeExecutors(
|
|
2595
2588
|
}
|
2596
2589
|
]
|
2597
2590
|
};
|
2598
|
-
|
2599
|
-
|
2600
|
-
|
2601
|
-
(
|
2602
|
-
|
2603
|
-
|
2604
|
-
|
2605
|
-
|
2606
|
-
|
2607
|
-
|
2608
|
-
arcade.createArcadeExecutor(expressionInfo.expression, labelingProfile);
|
2609
|
-
}
|
2610
|
-
}
|
2611
|
-
);
|
2612
|
-
}
|
2613
|
-
);
|
2614
|
-
|
2591
|
+
const createArcadeExecutorPromises = {};
|
2592
|
+
arcadeExpressionsMatches.forEach((match) => {
|
2593
|
+
const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
|
2594
|
+
(layer.popupTemplate.expressionInfos || []).forEach(expressionInfo => {
|
2595
|
+
if (expressionInfo.name === expressionName) {
|
2596
|
+
createArcadeExecutorPromises[expressionName] =
|
2597
|
+
arcade.createArcadeExecutor(expressionInfo.expression, labelingProfile);
|
2598
|
+
}
|
2599
|
+
});
|
2600
|
+
});
|
2615
2601
|
const promises = Object.values(createArcadeExecutorPromises);
|
2616
2602
|
return Promise.all(promises)
|
2617
|
-
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2621
|
-
for (let i = 0; i < expressionNames.length; ++i) {
|
2622
|
-
arcadeExecutors[expressionNames[i]] = executors[i].valueOf() as __esri.ArcadeExecutor;
|
2623
|
-
}
|
2624
|
-
|
2625
|
-
return arcadeExecutors;
|
2603
|
+
.then(executors => {
|
2604
|
+
const expressionNames = Object.keys(createArcadeExecutorPromises);
|
2605
|
+
for (let i = 0; i < expressionNames.length; ++i) {
|
2606
|
+
arcadeExecutors[expressionNames[i]] = executors[i].valueOf();
|
2626
2607
|
}
|
2627
|
-
|
2608
|
+
return arcadeExecutors;
|
2609
|
+
});
|
2628
2610
|
}
|
2629
|
-
*/
|
2630
2611
|
/**
|
2631
2612
|
* Creates a title from a list of selection set names.
|
2632
2613
|
*
|
@@ -3023,7 +3004,7 @@ async function _prepareLabels(webmap, layer, ids, formatUsingLayerPopup = true,
|
|
3023
3004
|
// Apply the label format
|
3024
3005
|
const labels = labelFormatProps.labelFormat.type === "pattern" ?
|
3025
3006
|
// Export attributes in format
|
3026
|
-
await _prepareLabelsFromPattern(
|
3007
|
+
await _prepareLabelsFromPattern(layer, featureSet, attributeOrigNames, attributeTypes, attributeDomains, labelFormatProps.attributeFormats, labelFormatProps.labelFormat.format, includeHeaderNames)
|
3027
3008
|
: labelFormatProps.labelFormat.type === "executor" ?
|
3028
3009
|
// Export attributes in expression
|
3029
3010
|
await _prepareLabelsUsingExecutor(featureSet, labelFormatProps.labelFormat.format)
|
@@ -3073,31 +3054,28 @@ async function _prepareLabelsFromAll(featureSet, attributeTypes, attributeDomain
|
|
3073
3054
|
* @param includeHeaderNames Add the label format at the front of the list of generated labels
|
3074
3055
|
* @returns Promise resolving with list of labels, each of which is a list of label lines
|
3075
3056
|
*/
|
3076
|
-
async function _prepareLabelsFromPattern(
|
3077
|
-
|
3078
|
-
featureSet, attributeOrigNames, attributeTypes, attributeDomains, attributeFormats, labelFormat, includeHeaderNames = false) {
|
3057
|
+
async function _prepareLabelsFromPattern(layer, featureSet, attributeOrigNames, attributeTypes, attributeDomains, attributeFormats, labelFormat, includeHeaderNames = false) {
|
3058
|
+
var _a;
|
3079
3059
|
const [intl] = await loadModules(["esri/intl"]);
|
3080
3060
|
// Find the label fields that we need to replace with values
|
3081
3061
|
const attributeExpressionMatches = _getFieldExpressionsFromLabel(labelFormat);
|
3082
3062
|
const attributeNames = _getFieldNamesFromFieldExpressions(attributeExpressionMatches);
|
3083
3063
|
// Do we need any Arcade executors?
|
3084
|
-
|
3085
|
-
|
3064
|
+
const arcadeExecutors = await _createArcadeExecutors(labelFormat, layer);
|
3065
|
+
const arcadeExpressionRegExp = /\{expression\/\w+\}/g;
|
3086
3066
|
// Find the label fields that we need to replace with values
|
3087
|
-
|
3067
|
+
const arcadeExpressionMatches = (_a = labelFormat.match(arcadeExpressionRegExp)) !== null && _a !== void 0 ? _a : [];
|
3088
3068
|
// Convert feature attributes into an array of labels
|
3089
3069
|
const labels = await Promise.all(featureSet.map(async (feature) => {
|
3090
3070
|
var _a;
|
3091
3071
|
let labelPrep = labelFormat;
|
3092
|
-
|
3093
|
-
// Replace Arcade expressions in this feature
|
3072
|
+
//Replace Arcade expressions in this feature
|
3094
3073
|
for (let i = 0; i < arcadeExpressionMatches.length; i++) {
|
3095
|
-
const match
|
3074
|
+
const match = arcadeExpressionMatches[i];
|
3096
3075
|
const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
|
3097
|
-
const value = await arcadeExecutors[expressionName].executeAsync({"$feature": feature, "$layer"
|
3076
|
+
const value = await arcadeExecutors[expressionName].executeAsync({ "$feature": feature, "$layer": layer });
|
3098
3077
|
labelPrep = labelPrep.replace(match, value);
|
3099
3078
|
}
|
3100
|
-
*/
|
3101
3079
|
// Replace non-Arcade fields in this feature
|
3102
3080
|
const attributeValues = (_a = feature.attributes) !== null && _a !== void 0 ? _a : feature;
|
3103
3081
|
attributeNames.forEach((attributeName, i) => {
|
@@ -7,7 +7,7 @@ import { r as registerInstance, h, H as Host, g as getElement, c as createEvent
|
|
7
7
|
import { g as getLocaleComponentStrings } from './locale-5bdc0197.js';
|
8
8
|
import { q as queryFeaturesByID, a as getLayerOrTable, g as goToSelection, b as queryAllIds } from './mapViewUtils-1e2befd7.js';
|
9
9
|
import { l as loadModules } from './loadModules-0bf05e85.js';
|
10
|
-
import { d as downloadCSV } from './downloadUtils-
|
10
|
+
import { d as downloadCSV } from './downloadUtils-8fbd1347.js';
|
11
11
|
import './_commonjsHelpers-d5f9d613.js';
|
12
12
|
import './interfaces-7470d906.js';
|
13
13
|
import './solution-resource-be35d35b.js';
|