@esri/solutions-components 0.7.32 → 0.7.34

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. package/dist/cjs/card-manager_3.cjs.entry.js +35 -23
  2. package/dist/cjs/{downloadUtils-10e0de31.js → downloadUtils-6b451886.js} +2 -2
  3. package/dist/cjs/{index.es-72dc7ab9.js → index.es-3eaba9ef.js} +1 -1
  4. package/dist/cjs/map-select-tools_3.cjs.entry.js +1 -1
  5. package/dist/cjs/public-notification.cjs.entry.js +1 -1
  6. package/dist/collection/components/layer-table/layer-table.js +34 -22
  7. package/dist/collection/demos/crowdsource-manager.html +181 -159
  8. package/dist/collection/utils/downloadUtils.js +1 -1
  9. package/dist/collection/utils/downloadUtils.ts +1 -1
  10. package/dist/collection/utils/interfaces.ts +10 -3
  11. package/dist/components/downloadUtils.js +1 -1
  12. package/dist/components/layer-table2.js +34 -22
  13. package/dist/esm/card-manager_3.entry.js +35 -23
  14. package/dist/esm/{downloadUtils-d297078f.js → downloadUtils-4577cf8b.js} +2 -2
  15. package/dist/esm/{index.es-3b4fa9d0.js → index.es-a28dad8e.js} +1 -1
  16. package/dist/esm/map-select-tools_3.entry.js +1 -1
  17. package/dist/esm/public-notification.entry.js +1 -1
  18. package/dist/solutions-components/demos/crowdsource-manager.html +181 -159
  19. package/dist/solutions-components/p-0b65130f.entry.js +6 -0
  20. package/dist/solutions-components/{p-103c5318.js → p-6c85b276.js} +2 -2
  21. package/dist/solutions-components/{p-57d49d15.entry.js → p-a84acc82.entry.js} +1 -1
  22. package/dist/solutions-components/{p-8ec25bf4.js → p-b1a5f341.js} +1 -1
  23. package/dist/solutions-components/{p-921f21d5.entry.js → p-e22bce70.entry.js} +1 -1
  24. package/dist/solutions-components/solutions-components.esm.js +1 -1
  25. package/dist/solutions-components/utils/downloadUtils.ts +1 -1
  26. package/dist/solutions-components/utils/interfaces.ts +10 -3
  27. package/dist/types/components/layer-table/layer-table.d.ts +1 -0
  28. package/dist/types/utils/interfaces.d.ts +9 -3
  29. package/package.json +1 -1
  30. package/dist/solutions-components/p-09ec8c8f.entry.js +0 -6
@@ -10,7 +10,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
10
10
  const index = require('./index-b8a649fc.js');
11
11
  const locale = require('./locale-a476e15d.js');
12
12
  const mapViewUtils = require('./mapViewUtils-8aa325de.js');
13
- const downloadUtils = require('./downloadUtils-10e0de31.js');
13
+ const downloadUtils = require('./downloadUtils-6b451886.js');
14
14
  require('./esri-loader-a91c0ec1.js');
15
15
  require('./_commonjsHelpers-384729db.js');
16
16
  require('./interfaces-7cd0a48a.js');
@@ -1383,35 +1383,47 @@ const LayerTable = class {
1383
1383
  * @returns a list of column templates if they exist
1384
1384
  */
1385
1385
  _getColumnTemplates(id, fieldInfos) {
1386
- var _a;
1387
- let layerInfo;
1388
- (_a = this.mapInfo.layerInfos) === null || _a === void 0 ? void 0 : _a.some(li => {
1389
- if (li.id === id) {
1390
- layerInfo = li;
1386
+ var _a, _b;
1387
+ let layerOption;
1388
+ (_b = (_a = this.mapInfo) === null || _a === void 0 ? void 0 : _a.layerOptions) === null || _b === void 0 ? void 0 : _b.layers.some(l => {
1389
+ if (l.id === id) {
1390
+ layerOption = l;
1391
1391
  return true;
1392
1392
  }
1393
1393
  });
1394
- let columnTemplates = layerInfo === null || layerInfo === void 0 ? void 0 : layerInfo.columnTemplates;
1394
+ const fieldOrder = (layerOption === null || layerOption === void 0 ? void 0 : layerOption.fields) && (layerOption === null || layerOption === void 0 ? void 0 : layerOption.fieldOrder) ?
1395
+ layerOption.fieldOrder.filter(f => layerOption.fields.indexOf(f) > -1) :
1396
+ undefined;
1397
+ let columnTemplates;
1395
1398
  if (fieldInfos) {
1396
- columnTemplates = columnTemplates ? columnTemplates.map(columnTemplate => {
1397
- fieldInfos.some(fieldInfo => {
1398
- if (fieldInfo.name === columnTemplate.fieldName) {
1399
- columnTemplate.label = fieldInfo.alias;
1400
- columnTemplate.menuConfig = this._getMenuConfig(fieldInfo.name);
1401
- return true;
1399
+ columnTemplates = layerOption && (layerOption === null || layerOption === void 0 ? void 0 : layerOption.fields)
1400
+ ? fieldInfos.reduce((prev, cur) => {
1401
+ if (layerOption.fields.indexOf(cur.name) > -1) {
1402
+ const template = {
1403
+ type: "field",
1404
+ fieldName: cur.name,
1405
+ label: cur.alias,
1406
+ menuConfig: this._getMenuConfig(cur.name)
1407
+ };
1408
+ prev.push(template);
1402
1409
  }
1410
+ return prev;
1411
+ }, []).sort(this._sortFields.bind(this, layerOption === null || layerOption === void 0 ? void 0 : layerOption.fieldOrder))
1412
+ : fieldInfos.map(fieldInfo => {
1413
+ return {
1414
+ type: "field",
1415
+ fieldName: fieldInfo.name,
1416
+ label: fieldInfo.alias,
1417
+ menuConfig: this._getMenuConfig(fieldInfo.name)
1418
+ };
1403
1419
  });
1404
- return columnTemplate;
1405
- }) : fieldInfos.map(fieldInfo => {
1406
- return {
1407
- type: "field",
1408
- fieldName: fieldInfo.name,
1409
- label: fieldInfo.alias,
1410
- menuConfig: this._getMenuConfig(fieldInfo.name)
1411
- };
1412
- });
1413
1420
  }
1414
- return columnTemplates;
1421
+ return fieldOrder ?
1422
+ columnTemplates === null || columnTemplates === void 0 ? void 0 : columnTemplates.sort(this._sortFields.bind(this, fieldOrder)) :
1423
+ columnTemplates;
1424
+ }
1425
+ _sortFields(sorter, a, b) {
1426
+ return (sorter === null || sorter === void 0 ? void 0 : sorter.indexOf(a.fieldName)) - sorter.indexOf(b.fieldName);
1415
1427
  }
1416
1428
  /**
1417
1429
  * Get the menu config that adds the ability to hide the current column
@@ -1510,7 +1510,7 @@ function(t){var e=function(t){for(var e=t.length,r=new Uint8Array(e),n=0;n<e;n++
1510
1510
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1511
1511
  * ====================================================================
1512
1512
  */
1513
- function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):Promise.resolve().then(function () { return require('./index.es-72dc7ab9.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
+ function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):Promise.resolve().then(function () { return require('./index.es-3eaba9ef.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},
1514
1514
  /** ====================================================================
1515
1515
  * @license
1516
1516
  * jsPDF XMP metadata plugin
@@ -3084,7 +3084,7 @@ async function _prepareLabelsFromPattern(layer, featureSet, attributeOrigNames,
3084
3084
  const match = arcadeExpressionMatches[i];
3085
3085
  const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
3086
3086
  const value = await arcadeExecutors[expressionName].executeAsync({ "$feature": feature, "$layer": layer });
3087
- labelPrep = labelPrep.replace(match, value);
3087
+ labelPrep = labelPrep.replace(match, value).replace(/\n/gi, "|");
3088
3088
  }
3089
3089
  // Replace non-Arcade fields in this feature
3090
3090
  const attributeValues = (_a = feature.attributes) !== null && _a !== void 0 ? _a : feature;
@@ -6,7 +6,7 @@
6
6
  'use strict';
7
7
 
8
8
  const _commonjsHelpers = require('./_commonjsHelpers-384729db.js');
9
- const downloadUtils = require('./downloadUtils-10e0de31.js');
9
+ const downloadUtils = require('./downloadUtils-6b451886.js');
10
10
  require('./index-b8a649fc.js');
11
11
  require('./locale-a476e15d.js');
12
12
  require('./esri-loader-a91c0ec1.js');
@@ -12,7 +12,7 @@ const locale = require('./locale-a476e15d.js');
12
12
  const mapViewUtils = require('./mapViewUtils-8aa325de.js');
13
13
  const interfaces = require('./interfaces-7cd0a48a.js');
14
14
  const publicNotificationStore = require('./publicNotificationStore-3a17c2f4.js');
15
- const downloadUtils = require('./downloadUtils-10e0de31.js');
15
+ const downloadUtils = require('./downloadUtils-6b451886.js');
16
16
  require('./esri-loader-a91c0ec1.js');
17
17
  require('./_commonjsHelpers-384729db.js');
18
18
  require('./index-22bb61da.js');
@@ -12,7 +12,7 @@ const interfaces = require('./interfaces-7cd0a48a.js');
12
12
  const locale = require('./locale-a476e15d.js');
13
13
  const mapViewUtils = require('./mapViewUtils-8aa325de.js');
14
14
  const publicNotificationStore = require('./publicNotificationStore-3a17c2f4.js');
15
- const downloadUtils = require('./downloadUtils-10e0de31.js');
15
+ const downloadUtils = require('./downloadUtils-6b451886.js');
16
16
  require('./esri-loader-a91c0ec1.js');
17
17
  require('./_commonjsHelpers-384729db.js');
18
18
  require('./index-22bb61da.js');
@@ -1298,35 +1298,47 @@ export class LayerTable {
1298
1298
  * @returns a list of column templates if they exist
1299
1299
  */
1300
1300
  _getColumnTemplates(id, fieldInfos) {
1301
- var _a;
1302
- let layerInfo;
1303
- (_a = this.mapInfo.layerInfos) === null || _a === void 0 ? void 0 : _a.some(li => {
1304
- if (li.id === id) {
1305
- layerInfo = li;
1301
+ var _a, _b;
1302
+ let layerOption;
1303
+ (_b = (_a = this.mapInfo) === null || _a === void 0 ? void 0 : _a.layerOptions) === null || _b === void 0 ? void 0 : _b.layers.some(l => {
1304
+ if (l.id === id) {
1305
+ layerOption = l;
1306
1306
  return true;
1307
1307
  }
1308
1308
  });
1309
- let columnTemplates = layerInfo === null || layerInfo === void 0 ? void 0 : layerInfo.columnTemplates;
1309
+ const fieldOrder = (layerOption === null || layerOption === void 0 ? void 0 : layerOption.fields) && (layerOption === null || layerOption === void 0 ? void 0 : layerOption.fieldOrder) ?
1310
+ layerOption.fieldOrder.filter(f => layerOption.fields.indexOf(f) > -1) :
1311
+ undefined;
1312
+ let columnTemplates;
1310
1313
  if (fieldInfos) {
1311
- columnTemplates = columnTemplates ? columnTemplates.map(columnTemplate => {
1312
- fieldInfos.some(fieldInfo => {
1313
- if (fieldInfo.name === columnTemplate.fieldName) {
1314
- columnTemplate.label = fieldInfo.alias;
1315
- columnTemplate.menuConfig = this._getMenuConfig(fieldInfo.name);
1316
- return true;
1314
+ columnTemplates = layerOption && (layerOption === null || layerOption === void 0 ? void 0 : layerOption.fields)
1315
+ ? fieldInfos.reduce((prev, cur) => {
1316
+ if (layerOption.fields.indexOf(cur.name) > -1) {
1317
+ const template = {
1318
+ type: "field",
1319
+ fieldName: cur.name,
1320
+ label: cur.alias,
1321
+ menuConfig: this._getMenuConfig(cur.name)
1322
+ };
1323
+ prev.push(template);
1317
1324
  }
1325
+ return prev;
1326
+ }, []).sort(this._sortFields.bind(this, layerOption === null || layerOption === void 0 ? void 0 : layerOption.fieldOrder))
1327
+ : fieldInfos.map(fieldInfo => {
1328
+ return {
1329
+ type: "field",
1330
+ fieldName: fieldInfo.name,
1331
+ label: fieldInfo.alias,
1332
+ menuConfig: this._getMenuConfig(fieldInfo.name)
1333
+ };
1318
1334
  });
1319
- return columnTemplate;
1320
- }) : fieldInfos.map(fieldInfo => {
1321
- return {
1322
- type: "field",
1323
- fieldName: fieldInfo.name,
1324
- label: fieldInfo.alias,
1325
- menuConfig: this._getMenuConfig(fieldInfo.name)
1326
- };
1327
- });
1328
1335
  }
1329
- return columnTemplates;
1336
+ return fieldOrder ?
1337
+ columnTemplates === null || columnTemplates === void 0 ? void 0 : columnTemplates.sort(this._sortFields.bind(this, fieldOrder)) :
1338
+ columnTemplates;
1339
+ }
1340
+ _sortFields(sorter, a, b) {
1341
+ return (sorter === null || sorter === void 0 ? void 0 : sorter.indexOf(a.fieldName)) - sorter.indexOf(b.fieldName);
1330
1342
  }
1331
1343
  /**
1332
1344
  * Get the menu config that adds the ability to hide the current column
@@ -1,12 +1,10 @@
1
1
  <html>
2
- <head>
3
- <meta charset="utf-8" />
4
- <meta
5
- name="viewport"
6
- content="initial-scale=1,maximum-scale=1,user-scalable=no"
7
- />
8
- <title>Crowdsource Manager</title>
9
- <!--
2
+
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
6
+ <title>Crowdsource Manager</title>
7
+ <!--
10
8
  | Copyright 2022 Esri
11
9
  |
12
10
  | Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,164 +19,188 @@
21
19
  | See the License for the specific language governing permissions and
22
20
  | limitations under the License.
23
21
  -->
24
- <style>
25
- .crowdsource {
26
- height: 100vh;
27
- width: 100vw;
28
- display: flex;
29
- }
30
- </style>
22
+ <style>
23
+ .crowdsource {
24
+ height: 100vh;
25
+ width: 100vw;
26
+ display: flex;
27
+ }
28
+ </style>
31
29
 
32
- <link rel="stylesheet" href="https://jsdev.arcgis.com/4.29/esri/themes/light/main.css" />
33
- <!-- <link rel="stylesheet" href="https://jsdev.arcgis.com/4.29/esri/themes/dark/main.css" /> -->
34
- <link rel="stylesheet" type="text/css" href="https://js.arcgis.com/calcite-components/2.0.0/calcite.css" />
30
+ <link rel="stylesheet" href="https://jsdev.arcgis.com/4.29/esri/themes/light/main.css" />
31
+ <!-- <link rel="stylesheet" href="https://jsdev.arcgis.com/4.29/esri/themes/dark/main.css" /> -->
32
+ <link rel="stylesheet" type="text/css" href="https://js.arcgis.com/calcite-components/2.0.0/calcite.css" />
35
33
 
36
- <link rel="stylesheet" href="https://webapps-cdn.esri.com/CDN/fonts/v1.4.1/fonts.css" />
37
- <link rel="stylesheet" href="../solutions-components.css" type="text/css">
34
+ <link rel="stylesheet" href="https://webapps-cdn.esri.com/CDN/fonts/v1.4.1/fonts.css" />
35
+ <link rel="stylesheet" href="../solutions-components.css" type="text/css">
38
36
 
39
- <script src="https://jsdev.arcgis.com/4.29/"></script>
40
- <script type="module" src="../solutions-components.esm.js"></script>
37
+ <script src="https://jsdev.arcgis.com/4.29/"></script>
38
+ <script type="module" src="../solutions-components.esm.js"></script>
41
39
 
42
- <script>
43
- function addValues() {
44
- const demo = document.getElementById("demo");
40
+ <script>
41
+ function addValues() {
42
+ const demo = document.getElementById("demo");
45
43
 
46
- let headerSet = false;
47
- let custom = [];
48
- var vars = window.location.search.substring(1).split('&');
49
- vars.forEach((param) => {
50
- let vals = param.split('=');
51
- const v = vals[1];
52
- switch (vals[0]) {
53
- case "id":
54
- custom = [{
55
- id: v,
56
- name: "Map from URL"
57
- }];
58
- break;
59
- case "zoomAndScrollToSelected":
60
- demo.zoomAndScrollToSelected = v.toLocaleLowerCase() === "true";
61
- break;
62
- case "hideHeader":
63
- demo.hideHeader = v.toLocaleLowerCase() === "true";
64
- headerSet = true;
65
- break;
66
- default:
67
- break;
68
- }
69
- });
70
-
71
- if (!headerSet) {
72
- // Want the header to be disabled by default for IA
73
- // Want the header to be enabled by default for the demo app
74
- demo.hideHeader = false;
44
+ let headerSet = false;
45
+ let custom = [];
46
+ var vars = window.location.search.substring(1).split('&');
47
+ vars.forEach((param) => {
48
+ let vals = param.split('=');
49
+ const v = vals[1];
50
+ switch (vals[0]) {
51
+ case "id":
52
+ custom = [{
53
+ id: v,
54
+ name: "Map from URL"
55
+ }];
56
+ break;
57
+ case "zoomAndScrollToSelected":
58
+ demo.zoomAndScrollToSelected = v.toLocaleLowerCase() === "true";
59
+ break;
60
+ case "hideHeader":
61
+ demo.hideHeader = v.toLocaleLowerCase() === "true";
62
+ headerSet = true;
63
+ break;
64
+ default:
65
+ break;
75
66
  }
67
+ });
76
68
 
77
- demo.mapInfos = [
78
- ...custom,
79
- ...[{
80
- id: "ce3dec81bf714d3bb71da9691ab686d1",
81
- name: "Popup Configured Map",
82
- filterConfig: {
83
- mapId: "ce3dec81bf714d3bb71da9691ab686d1",
84
- layerExpressions: [
85
- {
86
- id: "Requests_681",
87
- title: "Requests",
88
- operator: " AND ",
89
- expressions: [
90
- {
91
- definitionExpression: "OBJECTID > 690",
92
- id: 1701793260225,
93
- index: 0,
94
- name: "greater than 690",
95
- active: false
96
- }
97
- ]
98
- }, {
99
- id: "Requets_6608",
100
- title: "Comments",
101
- operator: " AND ",
102
- expressions: [
103
- {
104
- definitionExpression: "OBJECTID > 1",
105
- id: 1701793260226,
106
- index: 0,
107
- name: "greater than 1",
108
- active: false
109
- }
110
- ]
111
- }
112
- ]
113
- }
114
- // filters: {},
115
- // layerInfos: [{
116
- // id: "Requests_681",
117
- // columnTemplates: [{
118
- // type: "field",
119
- // fieldName: "ObjectId",
120
- // visible: false
121
- // }, {
122
- // type: "field",
123
- // fieldName: "reqcategory",
124
- // label: "Request ID",
125
- // visible: true
126
- // }]
127
- // }, {
128
- // id: "Requets_6608",
129
- // columnTemplates: [{
130
- // type: "field",
131
- // fieldName: "requestglobalid",
132
- // visible: false
133
- // }, {
134
- // type: "field",
135
- // fieldName: "comments",
136
- // label: "Comments",
137
- // visible: true
138
- // }]
139
- // }]
140
- }, {
141
- id: "863e4f6f2a7840db896cc1b1606d552d",
142
- name: "IA map"
143
- }, {
144
- id: "3715f4899bea4b2a948347c5c2357e58",
145
- name: "PN Map"
146
- }, {
147
- id: "4fa949c89bb04ecb8a9f5ad119448333",
148
- name: "CS TIL DATA"
149
- }, {
150
- id: "f5b01c17a09941eaad63e7b4e6c7d880",
151
- name: "Attachments Map"
152
- }, {
153
- id: "b422923b7a4c4958b9788118255f2f0a",
154
- name: "Floor aware map"
155
- }, {
156
- id: "5dc8ae351ff34280a75f7ffe1115b36b",
157
- name: "Standalone table",
158
- filterConfig: {
159
- "mapId": "5dc8ae351ff34280a75f7ffe1115b36b",
160
- "layerExpressions": [{
161
- "id": "18c4a8cda15-layer-2",
162
- "title": "Table_1",
163
- "operator": " AND ",
164
- "expressions": [{
165
- "definitionExpression": "OBJECTID > 14",
166
- "id": 1702486334825,
167
- "index": 0,
168
- "name": "> 14",
169
- "active": false
170
- }]
171
- }]
172
- }
173
- }]
174
- ];
69
+ if (!headerSet) {
70
+ // Want the header to be disabled by default for IA
71
+ // Want the header to be enabled by default for the demo app
72
+ demo.hideHeader = false;
175
73
  }
176
- </script>
177
- </head>
178
74
 
179
- <!-- <body class="calcite-mode-dark" onload="addValues()"> -->
180
- <body onload="addValues()">
181
- <crowdsource-manager id="demo" class="crowdsource"/>
182
- <!-- <crowdsource-manager id="demo" class="crowdsource" theme="dark"/> -->
183
- </body>
75
+ demo.mapInfos = [
76
+ ...custom,
77
+ ...[{
78
+ id: "ce3dec81bf714d3bb71da9691ab686d1",
79
+ name: "Popup Configured Map",
80
+ filterConfig: {
81
+ mapId: "ce3dec81bf714d3bb71da9691ab686d1",
82
+ layerExpressions: [
83
+ {
84
+ id: "Requests_681",
85
+ title: "Requests",
86
+ operator: " AND ",
87
+ expressions: [
88
+ {
89
+ definitionExpression: "OBJECTID > 690",
90
+ id: 1701793260225,
91
+ index: 0,
92
+ name: "greater than 690",
93
+ active: false
94
+ }
95
+ ]
96
+ }, {
97
+ id: "Requets_6608",
98
+ title: "Comments",
99
+ operator: " AND ",
100
+ expressions: [
101
+ {
102
+ definitionExpression: "OBJECTID > 1",
103
+ id: 1701793260226,
104
+ index: 0,
105
+ name: "greater than 1",
106
+ active: false
107
+ }
108
+ ]
109
+ }
110
+ ]
111
+ }
112
+ }, {
113
+ id: "863e4f6f2a7840db896cc1b1606d552d",
114
+ name: "IA map"
115
+ }, {
116
+ id: "3715f4899bea4b2a948347c5c2357e58",
117
+ name: "PN Map"
118
+ }, {
119
+ id: "4fa949c89bb04ecb8a9f5ad119448333",
120
+ name: "CS TIL DATA"
121
+ }, {
122
+ id: "f5b01c17a09941eaad63e7b4e6c7d880",
123
+ name: "Attachments Map"
124
+ }, {
125
+ id: "b422923b7a4c4958b9788118255f2f0a",
126
+ name: "Floor aware map"
127
+ }, {
128
+ id: "5dc8ae351ff34280a75f7ffe1115b36b",
129
+ name: "Standalone table",
130
+ filterConfig: {
131
+ mapId: "5dc8ae351ff34280a75f7ffe1115b36b",
132
+ layerExpressions: [{
133
+ id: "18c4a8cda15-layer-2",
134
+ title: "Table_1",
135
+ operator: " AND ",
136
+ expressions: [{
137
+ definitionExpression: "OBJECTID > 14",
138
+ id: 1702486334825,
139
+ index: 0,
140
+ name: "> 14",
141
+ active: false
142
+ }]
143
+ }]
144
+ }
145
+ }, {
146
+ id: "91e220910a994da4abfb0d1763d64ecb",
147
+ name: "EditMultiLayers",
148
+ visible: true,
149
+ layerOptions: {
150
+ layers: [{
151
+ id: "18b1fb85a29-layer-3",
152
+ fields: [
153
+ "OBJECTID", "a", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "c"
154
+ ],
155
+ fieldOrder: [
156
+ "c", "b", "a", "OBJECTID", "Shape__Area", "Shape__Length", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"
157
+ ]
158
+ }, {
159
+ id: "18b1fb862df-layer-4",
160
+ fields: ["OBJECTID", "test"],
161
+ fieldOrder: ["test", "OBJECTID"]
162
+ }, {
163
+ id: "18b1fb82f0e-layer-2",
164
+ fields: [
165
+ "URL", "Avg_Stars", "Your_Stars", "Route_Type", "Rating", "Pitches", "Length", "Area_Latitude", "Area_Longitude", "ObjectId"
166
+ ],
167
+ fieldOrder: [
168
+ "Your_Stars", "Route", "Location", "URL", "Avg_Stars", "Route_Type", "Rating", "Pitches", "Length", "Area_Latitude", "Area_Longitude", "ObjectId"
169
+ ]
170
+ }],
171
+ mapId: "91e220910a994da4abfb0d1763d64ecb"
172
+ }
173
+ }, {
174
+ id: "7197542839d948258c7862b33f9d96ad",
175
+ name: "EditPolymap",
176
+ visible: true
177
+ }, {
178
+ id: "fbe7bb1907f34d5aa8771ad6475a1dfe",
179
+ name: "Mountain Project",
180
+ visible: true,
181
+ layerOptions: {
182
+ layers: [{
183
+ id: "18a6ffdeae9-layer-2",
184
+ fields: [
185
+ "URL", "Avg_Stars", "Your_Stars", "Route_Type", "Rating", "Pitches", "Length", "Area_Latitude", "Area_Longitude", "ObjectId"
186
+ ],
187
+ fieldOrder: [
188
+ "Avg_Stars", "Route", "Location", "URL", "Your_Stars", "Route_Type", "Rating", "Pitches", "Length", "Area_Latitude", "Area_Longitude", "ObjectId"
189
+ ]
190
+ }],
191
+ mapId: "fbe7bb1907f34d5aa8771ad6475a1dfe"
192
+ }
193
+ }]
194
+ ];
195
+ }
196
+ </script>
197
+ </head>
198
+
199
+ <!-- <body class="calcite-mode-dark" onload="addValues()"> -->
200
+
201
+ <body onload="addValues()">
202
+ <crowdsource-manager id="demo" class="crowdsource" />
203
+ <!-- <crowdsource-manager id="demo" class="crowdsource" theme="dark"/> -->
204
+ </body>
205
+
184
206
  </html>
@@ -763,7 +763,7 @@ export async function _prepareLabelsFromPattern(layer, featureSet, attributeOrig
763
763
  const match = arcadeExpressionMatches[i];
764
764
  const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
765
765
  const value = await arcadeExecutors[expressionName].executeAsync({ "$feature": feature, "$layer": layer });
766
- labelPrep = labelPrep.replace(match, value);
766
+ labelPrep = labelPrep.replace(match, value).replace(/\n/gi, "|");
767
767
  }
768
768
  // Replace non-Arcade fields in this feature
769
769
  const attributeValues = (_a = feature.attributes) !== null && _a !== void 0 ? _a : feature;
@@ -1051,7 +1051,7 @@ export async function _prepareLabelsFromPattern(
1051
1051
  const match: string = arcadeExpressionMatches[i];
1052
1052
  const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
1053
1053
  const value = await arcadeExecutors[expressionName].executeAsync({"$feature": feature, "$layer": layer});
1054
- labelPrep = labelPrep.replace(match, value);
1054
+ labelPrep = labelPrep.replace(match, value).replace(/\n/gi, "|");
1055
1055
  }
1056
1056
 
1057
1057
  // Replace non-Arcade fields in this feature
@@ -450,14 +450,21 @@ export interface IMapInfo {
450
450
  name: string;
451
451
  searchConfiguration?: ISearchConfiguration;
452
452
  filterConfig?: IFilterConfig;
453
- layerInfos?: ILayerInfo[];
454
453
  _hasValidLayers?: boolean;
455
454
  visible?: boolean;
455
+ layerOptions?: ILayerOptions;
456
456
  }
457
457
 
458
- export interface ILayerInfo {
458
+ export interface ILayerOptions {
459
+ layers: ILayerDef[];
460
+ mapId?: string;
461
+ }
462
+
463
+ export interface ILayerDef {
459
464
  id: string;
460
- columnTemplates: __esri.FieldColumnTemplate[];
465
+ sublayerId?: number;
466
+ fields?: string[];
467
+ fieldOrder?: string[];
461
468
  }
462
469
 
463
470
  export interface IMapChange {
@@ -3082,7 +3082,7 @@ async function _prepareLabelsFromPattern(layer, featureSet, attributeOrigNames,
3082
3082
  const match = arcadeExpressionMatches[i];
3083
3083
  const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
3084
3084
  const value = await arcadeExecutors[expressionName].executeAsync({ "$feature": feature, "$layer": layer });
3085
- labelPrep = labelPrep.replace(match, value);
3085
+ labelPrep = labelPrep.replace(match, value).replace(/\n/gi, "|");
3086
3086
  }
3087
3087
  // Replace non-Arcade fields in this feature
3088
3088
  const attributeValues = (_a = feature.attributes) !== null && _a !== void 0 ? _a : feature;