@esri/solutions-components 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/t9n/map-select-tools/resources.json +1 -1
- package/dist/assets/t9n/map-select-tools/resources_en.json +1 -1
- package/dist/assets/t9n/public-notification/resources.json +5 -3
- package/dist/assets/t9n/public-notification/resources_en.json +5 -3
- package/dist/assets/t9n/refine-selection/resources.json +3 -3
- package/dist/assets/t9n/refine-selection/resources_en.json +3 -3
- package/dist/cjs/calcite-input-message_5.cjs.entry.js +8 -6
- package/dist/cjs/{downloadUtils-27dbd8b9.js → downloadUtils-99981c6b.js} +88 -15
- package/dist/cjs/{index.es-40d341ed.js → index.es-53f3bc97.js} +1 -1
- package/dist/cjs/layer-table.cjs.entry.js +2 -2
- package/dist/cjs/public-notification.cjs.entry.js +24 -9
- package/dist/collection/components/layer-table/layer-table.js +1 -1
- package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
- package/dist/collection/components/pdf-download/pdf-download.js +26 -6
- package/dist/collection/components/public-notification/public-notification.js +24 -9
- package/dist/collection/utils/downloadUtils.js +87 -14
- package/dist/collection/utils/downloadUtils.ts +123 -14
- package/dist/components/downloadUtils.js +87 -14
- package/dist/components/layer-table.js +1 -1
- package/dist/components/map-select-tools2.js +1 -1
- package/dist/components/pdf-download2.js +6 -4
- package/dist/components/public-notification.js +24 -9
- package/dist/esm/calcite-input-message_5.entry.js +8 -6
- package/dist/esm/{downloadUtils-76e38a94.js → downloadUtils-4bb47330.js} +88 -15
- package/dist/esm/{index.es-489f4f08.js → index.es-4424d2f7.js} +1 -1
- package/dist/esm/layer-table.entry.js +2 -2
- package/dist/esm/public-notification.entry.js +24 -9
- package/dist/solutions-components/{p-caa7e7a7.js → p-0aed9b0d.js} +11 -11
- package/dist/solutions-components/{p-5d27b47d.entry.js → p-0d3b0fa0.entry.js} +2 -2
- package/dist/solutions-components/{p-bff8aa4e.js → p-50117f71.js} +1 -1
- package/dist/solutions-components/p-5e4dfbe4.entry.js +6 -0
- package/dist/solutions-components/{p-92cb569a.entry.js → p-ec7f7804.entry.js} +1 -1
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/downloadUtils.ts +123 -14
- package/dist/types/components/map-select-tools/map-select-tools.d.ts +1 -1
- package/dist/types/components/pdf-download/pdf-download.d.ts +4 -2
- package/dist/types/components/public-notification/public-notification.d.ts +9 -1
- package/dist/types/components.d.ts +4 -2
- package/dist/types/utils/downloadUtils.d.ts +4 -2
- package/package.json +1 -1
- package/dist/solutions-components/p-4ef94c6b.entry.js +0 -6
@@ -1,21 +1,23 @@
|
|
1
1
|
{
|
2
|
-
"refineSelection": "Refine
|
2
|
+
"refineSelection": "Refine selection",
|
3
3
|
"downloadPDF": "Download PDF",
|
4
4
|
"downloadCSV": "Download CSV",
|
5
|
+
"downloadNoLists": "There are no lists to export. Go to My lists to create a list of features.",
|
5
6
|
"add": "Add",
|
6
7
|
"remove": "Remove",
|
7
8
|
"back": "Back",
|
8
|
-
"addresseeLayer": "Addressee
|
9
|
+
"addresseeLayer": "Addressee layer",
|
9
10
|
"selectedFeatures": "{{n}} selected features",
|
10
11
|
"noNotifications": "You have no notification list yet.",
|
11
12
|
"notifications": "Notifications",
|
12
|
-
"myLists": "My
|
13
|
+
"myLists": "My lists",
|
13
14
|
"stepTwoFull": "Select features from: {{layer}}",
|
14
15
|
"cancel": "Cancel",
|
15
16
|
"done": "Done",
|
16
17
|
"selectedAddresses": "{{n}} selected addresses from {{layer}}",
|
17
18
|
"selectPDFLabelOption": "Select PDF label option",
|
18
19
|
"refineTip": "Add or remove features to refine and finalize the selection using the sketch tools. This functionality will work across all selection sets.",
|
20
|
+
"refineTipNoSelections": "There are no selections to refine. Go to My lists to create a list of features.",
|
19
21
|
"removeDuplicate": "Remove duplicate addresses",
|
20
22
|
"selectLayerAndAdd": "Choose an addressee layer and click on the 'Add' button to create a notification list by selecting features.",
|
21
23
|
"selectSearchTip": "Search for an address, place, or feature for selection",
|
@@ -1,21 +1,23 @@
|
|
1
1
|
{
|
2
|
-
"refineSelection": "Refine
|
2
|
+
"refineSelection": "Refine selection",
|
3
3
|
"downloadPDF": "Download PDF",
|
4
4
|
"downloadCSV": "Download CSV",
|
5
|
+
"downloadNoLists": "There are no lists to export. Go to My lists to create a list of features.",
|
5
6
|
"add": "Add",
|
6
7
|
"remove": "Remove",
|
7
8
|
"back": "Back",
|
8
|
-
"addresseeLayer": "Addressee
|
9
|
+
"addresseeLayer": "Addressee layer",
|
9
10
|
"selectedFeatures": "{{n}} selected features",
|
10
11
|
"noNotifications": "You have no notification list yet.",
|
11
12
|
"notifications": "Notifications",
|
12
|
-
"myLists": "My
|
13
|
+
"myLists": "My lists",
|
13
14
|
"stepTwoFull": "Select features from: {{layer}}",
|
14
15
|
"cancel": "Cancel",
|
15
16
|
"done": "Done",
|
16
17
|
"selectedAddresses": "{{n}} selected addresses from {{layer}}",
|
17
18
|
"selectPDFLabelOption": "Select PDF label option",
|
18
19
|
"refineTip": "Add or remove features to refine and finalize the selection using the sketch tools. This functionality will work across all selection sets.",
|
20
|
+
"refineTipNoSelections": "There are no selections to refine. Go to My lists to create a list of features.",
|
19
21
|
"removeDuplicate": "Remove duplicate addresses",
|
20
22
|
"selectLayerAndAdd": "Choose an addressee layer and click on the 'Add' button to create a notification list by selecting features.",
|
21
23
|
"selectSearchTip": "Search for an address, place, or feature for selection",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"add": "Add",
|
3
3
|
"remove": "Remove",
|
4
|
-
"featuresAdded": "Features
|
5
|
-
"featuresRemoved": "Features
|
6
|
-
"totalSelected": "Total
|
4
|
+
"featuresAdded": "Features added: {{n}}",
|
5
|
+
"featuresRemoved": "Features removed: {{n}}",
|
6
|
+
"totalSelected": "Total selected: {{n}}"
|
7
7
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"add": "Add",
|
3
3
|
"remove": "Remove",
|
4
|
-
"featuresAdded": "Features
|
5
|
-
"featuresRemoved": "Features
|
6
|
-
"totalSelected": "Total
|
4
|
+
"featuresAdded": "Features added: {{n}}",
|
5
|
+
"featuresRemoved": "Features removed: {{n}}",
|
6
|
+
"totalSelected": "Total selected: {{n}}"
|
7
7
|
}
|
@@ -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-db1db902.js');
|
19
|
-
const downloadUtils = require('./downloadUtils-
|
19
|
+
const downloadUtils = require('./downloadUtils-99981c6b.js');
|
20
20
|
const publicNotificationUtils = require('./publicNotificationUtils-9d585d8d.js');
|
21
21
|
require('./resources-b56bce71.js');
|
22
22
|
require('./guid-84ac4d91.js');
|
@@ -743,7 +743,7 @@ const MapSelectTools = class {
|
|
743
743
|
* @param graphics graphics to be used for selection
|
744
744
|
* @param label selection label
|
745
745
|
* @param useOIDs indicates if the OIDs should override the geometry for selection
|
746
|
-
* @param oids list of IDs to select when
|
746
|
+
* @param oids list of IDs to select when useOIDs is true
|
747
747
|
*
|
748
748
|
* @protected
|
749
749
|
*/
|
@@ -992,24 +992,26 @@ const PdfDownload = class {
|
|
992
992
|
/**
|
993
993
|
* Downloads csv of mailing labels for the provided list of ids
|
994
994
|
*
|
995
|
+
* @param selectionSetNames Names of the selection sets used to provide ids
|
995
996
|
* @param ids List of ids to download
|
996
997
|
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
997
998
|
* @param addColumnTitle Indicates if column headings should be included in output
|
998
999
|
* @returns Promise resolving when function is done
|
999
1000
|
*/
|
1000
|
-
async downloadCSV(ids, removeDuplicates, addColumnTitle = true) {
|
1001
|
-
return downloadUtils.downloadCSV(this.layerView.layer, ids, true, // formatUsingLayerPopup
|
1001
|
+
async downloadCSV(selectionSetNames, ids, removeDuplicates, addColumnTitle = true) {
|
1002
|
+
return downloadUtils.downloadCSV(selectionSetNames, this.layerView.layer, ids, true, // formatUsingLayerPopup
|
1002
1003
|
removeDuplicates, addColumnTitle);
|
1003
1004
|
}
|
1004
1005
|
/**
|
1005
1006
|
* Downloads pdf of mailing labels for the provided list of ids
|
1006
1007
|
*
|
1008
|
+
* @param selectionSetNames Names of the selection sets used to provide ids
|
1007
1009
|
* @param ids List of ids to download
|
1008
1010
|
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
1009
1011
|
* @returns Promise resolving when function is done
|
1010
1012
|
*/
|
1011
|
-
async downloadPDF(ids, removeDuplicates) {
|
1012
|
-
return downloadUtils.downloadPDF(this.layerView.layer, ids, removeDuplicates, this._labelInfoElement.selectedOption.value);
|
1013
|
+
async downloadPDF(selectionSetNames, ids, removeDuplicates) {
|
1014
|
+
return downloadUtils.downloadPDF(selectionSetNames, this.layerView.layer, ids, removeDuplicates, this._labelInfoElement.selectedOption.value);
|
1013
1015
|
}
|
1014
1016
|
//--------------------------------------------------------------------------
|
1015
1017
|
//
|
@@ -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-53f3bc97.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
|
@@ -2129,6 +2129,7 @@ function _downloadPDFFile(labels, labelPageDescription, fileTitle) {
|
|
2129
2129
|
/**
|
2130
2130
|
* Downloads csv of mailing labels for the provided list of ids
|
2131
2131
|
*
|
2132
|
+
* @param selectionSetNames Names of the selection sets used to provide ids
|
2132
2133
|
* @param layer Layer providing features and attributes for download
|
2133
2134
|
* @param ids List of ids to download
|
2134
2135
|
* @param formatUsingLayerPopup When true, the layer's popup is used to choose attributes for each column; when false,
|
@@ -2137,7 +2138,8 @@ function _downloadPDFFile(labels, labelPageDescription, fileTitle) {
|
|
2137
2138
|
* @param addColumnTitle Indicates if column headings should be included in output
|
2138
2139
|
* @returns Promise resolving when function is done
|
2139
2140
|
*/
|
2140
|
-
async function downloadCSV(layer, ids, formatUsingLayerPopup, removeDuplicates = false, addColumnTitle = false) {
|
2141
|
+
async function downloadCSV(selectionSetNames, layer, ids, formatUsingLayerPopup, removeDuplicates = false, addColumnTitle = false) {
|
2142
|
+
console.log("downloadCSV using selectionSetNames " + JSON.stringify(selectionSetNames)); //???
|
2141
2143
|
const labels = await _prepareLabels(layer, ids, removeDuplicates, formatUsingLayerPopup, addColumnTitle);
|
2142
2144
|
exportCSV(labels);
|
2143
2145
|
return Promise.resolve();
|
@@ -2145,13 +2147,15 @@ async function downloadCSV(layer, ids, formatUsingLayerPopup, removeDuplicates =
|
|
2145
2147
|
/**
|
2146
2148
|
* Downloads csv of mailing labels for the provided list of ids
|
2147
2149
|
*
|
2150
|
+
* @param selectionSetNames Names of the selection sets used to provide ids
|
2148
2151
|
* @param layer Layer providing features and attributes for download
|
2149
2152
|
* @param ids List of ids to download
|
2150
2153
|
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
2151
2154
|
* @param labelPageDescription Provides PDF page layout info
|
2152
2155
|
* @returns Promise resolving when function is done
|
2153
2156
|
*/
|
2154
|
-
async function downloadPDF(layer, ids, removeDuplicates, labelPageDescription) {
|
2157
|
+
async function downloadPDF(selectionSetNames, layer, ids, removeDuplicates, labelPageDescription) {
|
2158
|
+
console.log("downloadPDF using selectionSetNames " + JSON.stringify(selectionSetNames)); //???
|
2155
2159
|
const labels = await _prepareLabels(layer, ids, removeDuplicates);
|
2156
2160
|
exportPDF(labels, labelPageDescription);
|
2157
2161
|
return Promise.resolve();
|
@@ -2162,13 +2166,14 @@ async function downloadPDF(layer, ids, removeDuplicates, labelPageDescription) {
|
|
2162
2166
|
* Converts a set of fieldInfos into template lines.
|
2163
2167
|
*
|
2164
2168
|
* @param fieldInfos Layer's fieldInfos structure
|
2169
|
+
* @param bypassFieldVisiblity Indicates if the configured fieldInfo visibility property should be ignored
|
2165
2170
|
* @return Label spec
|
2166
2171
|
*/
|
2167
|
-
function _convertPopupFieldsToLabelSpec(fieldInfos) {
|
2172
|
+
function _convertPopupFieldsToLabelSpec(fieldInfos, bypassFieldVisiblity = false) {
|
2168
2173
|
const labelSpec = [];
|
2169
2174
|
// Every visible attribute is used
|
2170
2175
|
fieldInfos.forEach(fieldInfo => {
|
2171
|
-
if (fieldInfo.visible) {
|
2176
|
+
if (fieldInfo.visible || bypassFieldVisiblity) {
|
2172
2177
|
labelSpec.push(`{${fieldInfo.fieldName}}`);
|
2173
2178
|
}
|
2174
2179
|
});
|
@@ -2198,6 +2203,49 @@ function _convertPopupTextToLabelSpec(popupInfo) {
|
|
2198
2203
|
labelSpec = labelSpec.map(line => line.trim()).filter(line => line.length > 0);
|
2199
2204
|
return labelSpec;
|
2200
2205
|
}
|
2206
|
+
/**
|
2207
|
+
* Extracts Arcade expressions from the lines of a label format and creates an Arcade executor for each
|
2208
|
+
* referenced expression name.
|
2209
|
+
*
|
2210
|
+
* @param labelFormat Label to examine
|
2211
|
+
* @param layer Layer from which to fetch features
|
2212
|
+
* @return Promise resolving to a set of executors keyed using the expression name
|
2213
|
+
*/
|
2214
|
+
async function _createArcadeExecutors(labelFormat, layer) {
|
2215
|
+
const arcadeExecutors = {};
|
2216
|
+
// Are any Arcade expressions in the layer?
|
2217
|
+
if (!Array.isArray(layer.popupTemplate.expressionInfos) || layer.popupTemplate.expressionInfos.length === 0) {
|
2218
|
+
return Promise.resolve(arcadeExecutors);
|
2219
|
+
}
|
2220
|
+
// Are there any Arcade expressions in the label format?
|
2221
|
+
const arcadeExpressionRegExp = /\{expression\/\w+\}/g;
|
2222
|
+
const arcadeExpressionsMatches = labelFormat.join("|").match(arcadeExpressionRegExp);
|
2223
|
+
if (!arcadeExpressionsMatches) {
|
2224
|
+
return Promise.resolve(arcadeExecutors);
|
2225
|
+
}
|
2226
|
+
// Generate an Arcade executor for each match
|
2227
|
+
const [arcade] = await loadModules.loadModules(["esri/arcade"]);
|
2228
|
+
const labelingProfile = arcade.createArcadeProfile("popup");
|
2229
|
+
const createArcadeExecutorPromises = {};
|
2230
|
+
arcadeExpressionsMatches.forEach((match) => {
|
2231
|
+
const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
|
2232
|
+
(layer.popupTemplate.expressionInfos || []).forEach(expressionInfo => {
|
2233
|
+
if (expressionInfo.name === expressionName) {
|
2234
|
+
createArcadeExecutorPromises[expressionName] =
|
2235
|
+
arcade.createArcadeExecutor(expressionInfo.expression, labelingProfile);
|
2236
|
+
}
|
2237
|
+
});
|
2238
|
+
});
|
2239
|
+
const promises = Object.values(createArcadeExecutorPromises);
|
2240
|
+
return Promise.all(promises)
|
2241
|
+
.then(executors => {
|
2242
|
+
const expressionNames = Object.keys(createArcadeExecutorPromises);
|
2243
|
+
for (let i = 0; i < expressionNames.length; ++i) {
|
2244
|
+
arcadeExecutors[expressionNames[i]] = executors[i].valueOf();
|
2245
|
+
}
|
2246
|
+
return arcadeExecutors;
|
2247
|
+
});
|
2248
|
+
}
|
2201
2249
|
/**
|
2202
2250
|
* Creates labels from items.
|
2203
2251
|
*
|
@@ -2211,33 +2259,57 @@ function _convertPopupTextToLabelSpec(popupInfo) {
|
|
2211
2259
|
*/
|
2212
2260
|
async function _prepareLabels(layer, ids, removeDuplicates = true, formatUsingLayerPopup = true, includeHeaderNames = false) {
|
2213
2261
|
var _a, _b, _c, _d;
|
2214
|
-
const [intl] = await loadModules.loadModules([
|
2215
|
-
|
2216
|
-
]);
|
2217
|
-
// Get the attributes of the features to export
|
2262
|
+
const [intl] = await loadModules.loadModules(["esri/intl"]);
|
2263
|
+
// Get the features to export
|
2218
2264
|
const featureSet = await mapViewUtils.queryFeaturesByID(ids, layer);
|
2219
|
-
const featuresAttrs = featureSet.features.map(f => f.attributes);
|
2220
2265
|
// Get the label formatting, if any
|
2221
2266
|
let labelFormat;
|
2267
|
+
let arcadeExecutors = {};
|
2222
2268
|
if (layer.popupEnabled) {
|
2223
2269
|
// What data fields are used in the labels?
|
2224
2270
|
// Example labelFormat: ['{NAME}', '{STREET}', '{CITY}, {STATE} {ZIP}']
|
2225
2271
|
if (formatUsingLayerPopup && ((_b = (_a = layer.popupTemplate) === null || _a === void 0 ? void 0 : _a.content[0]) === null || _b === void 0 ? void 0 : _b.type) === "fields") {
|
2226
2272
|
labelFormat = _convertPopupFieldsToLabelSpec(layer.popupTemplate.fieldInfos);
|
2273
|
+
// If popup is configured with "no attribute information", then no fields will visible
|
2274
|
+
if (labelFormat.length === 0) {
|
2275
|
+
// Can we use the popup title?
|
2276
|
+
// eslint-disable-next-line unicorn/prefer-ternary
|
2277
|
+
if (typeof layer.popupTemplate.title === "string") {
|
2278
|
+
labelFormat = [layer.popupTemplate.title];
|
2279
|
+
// Otherwise revert to using attributes
|
2280
|
+
}
|
2281
|
+
else {
|
2282
|
+
labelFormat = _convertPopupFieldsToLabelSpec(layer.popupTemplate.fieldInfos, true);
|
2283
|
+
}
|
2284
|
+
}
|
2227
2285
|
}
|
2228
2286
|
else if (formatUsingLayerPopup && ((_d = (_c = layer.popupTemplate) === null || _c === void 0 ? void 0 : _c.content[0]) === null || _d === void 0 ? void 0 : _d.type) === "text") {
|
2229
2287
|
labelFormat = _convertPopupTextToLabelSpec(layer.popupTemplate.content[0].text);
|
2288
|
+
// Do we need any Arcade executors?
|
2289
|
+
arcadeExecutors = await _createArcadeExecutors(labelFormat, layer);
|
2230
2290
|
}
|
2231
2291
|
}
|
2232
2292
|
// Apply the label format
|
2233
2293
|
let labels;
|
2234
2294
|
// eslint-disable-next-line unicorn/prefer-ternary
|
2235
2295
|
if (labelFormat) {
|
2296
|
+
const arcadeExpressionRegExp = /\{expression\/\w+\}/g;
|
2236
2297
|
// Convert attributes into an array of labels
|
2237
|
-
labels =
|
2298
|
+
labels = featureSet.features.map(feature => {
|
2238
2299
|
const label = [];
|
2239
2300
|
labelFormat.forEach(labelLineTemplate => {
|
2240
|
-
|
2301
|
+
let labelLine = labelLineTemplate;
|
2302
|
+
// Replace Arcade expressions
|
2303
|
+
const arcadeExpressionsMatches = labelLine.match(arcadeExpressionRegExp);
|
2304
|
+
if (arcadeExpressionsMatches) {
|
2305
|
+
arcadeExpressionsMatches.forEach((match) => {
|
2306
|
+
const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
|
2307
|
+
const replacement = arcadeExecutors[expressionName].execute({ "$feature": feature });
|
2308
|
+
labelLine = labelLine.replace(match, replacement);
|
2309
|
+
});
|
2310
|
+
}
|
2311
|
+
// Replace fields; must be done after Arcade check because `substitute` will discard Arcade expressions!
|
2312
|
+
labelLine = intl.substitute(labelLine, feature.attributes).trim();
|
2241
2313
|
if (labelLine.length > 0) {
|
2242
2314
|
label.push(labelLine);
|
2243
2315
|
}
|
@@ -2249,8 +2321,8 @@ async function _prepareLabels(layer, ids, removeDuplicates = true, formatUsingLa
|
|
2249
2321
|
}
|
2250
2322
|
else {
|
2251
2323
|
// Export all attributes
|
2252
|
-
labels =
|
2253
|
-
return Object.values(
|
2324
|
+
labels = featureSet.features.map(feature => {
|
2325
|
+
return Object.values(feature.attributes).map(attribute => `${attribute}`);
|
2254
2326
|
});
|
2255
2327
|
}
|
2256
2328
|
// Remove duplicates
|
@@ -2266,7 +2338,8 @@ async function _prepareLabels(layer, ids, removeDuplicates = true, formatUsingLa
|
|
2266
2338
|
headerNames = labelFormat.map(labelFormatLine => labelFormatLine.replace(/\{/g, "").replace(/\}/g, ""));
|
2267
2339
|
}
|
2268
2340
|
else {
|
2269
|
-
|
2341
|
+
const featuresAttrs = featureSet.features[0].attributes;
|
2342
|
+
Object.keys(featuresAttrs).forEach(k => {
|
2270
2343
|
if (featuresAttrs[0].hasOwnProperty(k)) {
|
2271
2344
|
headerNames.push(k);
|
2272
2345
|
}
|
@@ -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-99981c6b.js');
|
10
10
|
require('./index-c6979cbb.js');
|
11
11
|
require('./loadModules-918ff3e7.js');
|
12
12
|
require('./locale-db1db902.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-db1db902.js');
|
12
12
|
const mapViewUtils = require('./mapViewUtils-d250b1ed.js');
|
13
|
-
const downloadUtils = require('./downloadUtils-
|
13
|
+
const downloadUtils = require('./downloadUtils-99981c6b.js');
|
14
14
|
require('./_commonjsHelpers-384729db.js');
|
15
15
|
require('./interfaces-17c631bf.js');
|
16
16
|
require('./loadModules-918ff3e7.js');
|
@@ -222,7 +222,7 @@ const LayerTable = class {
|
|
222
222
|
* @returns a promise that will resolve when the operation is complete
|
223
223
|
*/
|
224
224
|
async _exportToCSV() {
|
225
|
-
return downloadUtils.downloadCSV(this._layerView.layer, this._getSelectedIds(), false, // formatUsingLayerPopup
|
225
|
+
return downloadUtils.downloadCSV([], this._layerView.layer, this._getSelectedIds(), false, // formatUsingLayerPopup
|
226
226
|
false, // removeDuplicates
|
227
227
|
true);
|
228
228
|
}
|
@@ -78,7 +78,8 @@ const PublicNotification = class {
|
|
78
78
|
console.log(oldValue);
|
79
79
|
if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
|
80
80
|
console.log("Emit event from parent");
|
81
|
-
this.
|
81
|
+
this.searchConfiguration = Object.assign({}, newValue);
|
82
|
+
this.searchConfigurationChange.emit(this.searchConfiguration);
|
82
83
|
}
|
83
84
|
}
|
84
85
|
/**
|
@@ -148,8 +149,7 @@ const PublicNotification = class {
|
|
148
149
|
* Renders the component.
|
149
150
|
*/
|
150
151
|
render() {
|
151
|
-
|
152
|
-
return (index.h(index.Host, null, index.h("calcite-shell", null, index.h("calcite-action-bar", { class: "border-bottom-1 action-bar-size", "expand-disabled": true, layout: "horizontal", slot: "header" }, this._getActionGroup("list-check", false, interfaces.EPageType.LIST, this._translations.myLists), this.showRefineSelection ? this._getActionGroup("test-data", !hasSelections, interfaces.EPageType.REFINE, this._translations.refineSelection) : undefined, this._getActionGroup("file-pdf", !hasSelections, interfaces.EPageType.PDF, this._translations.downloadPDF), this._getActionGroup("file-csv", !hasSelections, interfaces.EPageType.CSV, this._translations.downloadCSV)), this._getPage(this._pageType))));
|
152
|
+
return (index.h(index.Host, null, index.h("calcite-shell", null, index.h("calcite-action-bar", { class: "border-bottom-1 action-bar-size", "expand-disabled": true, layout: "horizontal", slot: "header" }, this._getActionGroup("list-check", interfaces.EPageType.LIST, this._translations.myLists), this.showRefineSelection ? this._getActionGroup("test-data", interfaces.EPageType.REFINE, this._translations.refineSelection) : undefined, this._getActionGroup("file-pdf", interfaces.EPageType.PDF, this._translations.downloadPDF), this._getActionGroup("file-csv", interfaces.EPageType.CSV, this._translations.downloadCSV)), this._getPage(this._pageType))));
|
153
153
|
}
|
154
154
|
//--------------------------------------------------------------------------
|
155
155
|
//
|
@@ -179,9 +179,9 @@ const PublicNotification = class {
|
|
179
179
|
*
|
180
180
|
* @protected
|
181
181
|
*/
|
182
|
-
_getActionGroup(icon,
|
182
|
+
_getActionGroup(icon, pageType, tip) {
|
183
183
|
const groupClass = this.showRefineSelection ? "action-center w-1-4" : "action-center w-1-3";
|
184
|
-
return (index.h("calcite-action-group", { class: groupClass, layout: "horizontal" }, index.h("calcite-action", { active: this._pageType === pageType, alignment: "center", class: "width-full height-full", compact: false,
|
184
|
+
return (index.h("calcite-action-group", { class: groupClass, layout: "horizontal" }, index.h("calcite-action", { active: this._pageType === pageType, alignment: "center", class: "width-full height-full", compact: false, icon: icon, id: icon, onClick: () => { this._setPageType(pageType); }, text: "" }), index.h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": icon }, index.h("span", null, tip))));
|
185
185
|
}
|
186
186
|
/**
|
187
187
|
* Navigate to the defined page type
|
@@ -295,6 +295,16 @@ const PublicNotification = class {
|
|
295
295
|
this._layerSelectionChangeEvt.detail[0] : "";
|
296
296
|
await this._updateAddresseeLayer(id);
|
297
297
|
}
|
298
|
+
/**
|
299
|
+
* Check if any selection sets exist.
|
300
|
+
*
|
301
|
+
* @returns true if selection sets exist
|
302
|
+
*
|
303
|
+
* @protected
|
304
|
+
*/
|
305
|
+
_hasSelections() {
|
306
|
+
return this._selectionSets.length > 0;
|
307
|
+
}
|
298
308
|
/**
|
299
309
|
* Create the Select page that shows the selection workflows
|
300
310
|
*
|
@@ -323,7 +333,9 @@ const PublicNotification = class {
|
|
323
333
|
* @protected
|
324
334
|
*/
|
325
335
|
_getRefinePage() {
|
326
|
-
|
336
|
+
const hasSelections = this._hasSelections();
|
337
|
+
return (index.h("calcite-panel", null, this._getLabel(this._translations.refineSelection), hasSelections ? (index.h("div", null, this._getNotice(this._translations.refineTip, "padding-sides-1"), index.h("refine-selection", { addresseeLayer: this.addresseeLayer, enabledLayerIds: this.selectionLayerIds, mapView: this.mapView, selectionSets: this._selectionSets }))) :
|
338
|
+
this._getNotice(this._translations.refineTipNoSelections, "padding-sides-1")));
|
327
339
|
}
|
328
340
|
/**
|
329
341
|
* Create the PDF download page that shows the download options
|
@@ -354,7 +366,8 @@ const PublicNotification = class {
|
|
354
366
|
*/
|
355
367
|
_getDownloadPage(type) {
|
356
368
|
const isPdf = type === interfaces.EExportType.PDF;
|
357
|
-
|
369
|
+
const hasSelections = this._hasSelections();
|
370
|
+
return (index.h("calcite-panel", null, index.h("div", null, index.h("div", { class: "padding-top-sides-1" }, index.h("calcite-label", { class: "font-bold" }, isPdf ? this._translations.downloadPDF : this._translations.downloadCSV)), hasSelections ? (index.h("div", null, index.h("calcite-label", null, this._translations.notifications), this._getSelectionLists(), index.h("div", { class: "margin-side-1 padding-top-1 border-bottom" }), index.h("div", { class: "padding-top-sides-1" }, index.h("calcite-label", { layout: "inline" }, index.h("calcite-checkbox", { disabled: !this._downloadActive, ref: (el) => { this._removeDuplicates = el; } }), this._translations.removeDuplicate)), index.h("div", { class: isPdf ? "" : "display-none" }, this._getLabel(this._translations.selectPDFLabelOption, false), index.h("div", { class: "padding-sides-1" }, index.h("pdf-download", { disabled: !this._downloadActive, layerView: this.addresseeLayer, ref: (el) => { this._downloadTools = el; } }))), index.h("div", { class: "padding-1 display-flex" }, index.h("calcite-button", { disabled: !this._downloadActive, onClick: isPdf ? () => this._downloadPDF() : () => this._downloadCSV(), width: "full" }, isPdf ? this._translations.downloadPDF : this._translations.downloadCSV)))) : (this._getNotice(this._translations.downloadNoLists, "padding-sides-1 padding-bottom-1")))));
|
358
371
|
}
|
359
372
|
/**
|
360
373
|
* Create the stacked navigation buttons for a page
|
@@ -437,7 +450,8 @@ const PublicNotification = class {
|
|
437
450
|
*/
|
438
451
|
_downloadPDF() {
|
439
452
|
const ids = publicNotificationUtils.getSelectionIds(this._getDownloadSelectionSets());
|
440
|
-
|
453
|
+
const selectionSetNames = this._selectionSets.map(set => set.label);
|
454
|
+
void this._downloadTools.downloadPDF(selectionSetNames, ids, this._removeDuplicates.checked);
|
441
455
|
}
|
442
456
|
/**
|
443
457
|
* Download all selection sets as CSV
|
@@ -446,7 +460,8 @@ const PublicNotification = class {
|
|
446
460
|
*/
|
447
461
|
_downloadCSV() {
|
448
462
|
const ids = publicNotificationUtils.getSelectionIds(this._getDownloadSelectionSets());
|
449
|
-
|
463
|
+
const selectionSetNames = this._selectionSets.map(set => set.label);
|
464
|
+
void this._downloadTools.downloadCSV(selectionSetNames, ids, this._removeDuplicates.checked);
|
450
465
|
}
|
451
466
|
/**
|
452
467
|
* Get all enabled selection sets
|
@@ -231,7 +231,7 @@ export class LayerTable {
|
|
231
231
|
* @returns a promise that will resolve when the operation is complete
|
232
232
|
*/
|
233
233
|
async _exportToCSV() {
|
234
|
-
return downloadUtils.downloadCSV(this._layerView.layer, this._getSelectedIds(), false, // formatUsingLayerPopup
|
234
|
+
return downloadUtils.downloadCSV([], this._layerView.layer, this._getSelectedIds(), false, // formatUsingLayerPopup
|
235
235
|
false, // removeDuplicates
|
236
236
|
true);
|
237
237
|
}
|
@@ -526,7 +526,7 @@ export class MapSelectTools {
|
|
526
526
|
* @param graphics graphics to be used for selection
|
527
527
|
* @param label selection label
|
528
528
|
* @param useOIDs indicates if the OIDs should override the geometry for selection
|
529
|
-
* @param oids list of IDs to select when
|
529
|
+
* @param oids list of IDs to select when useOIDs is true
|
530
530
|
*
|
531
531
|
* @protected
|
532
532
|
*/
|
@@ -43,24 +43,26 @@ export class PdfDownload {
|
|
43
43
|
/**
|
44
44
|
* Downloads csv of mailing labels for the provided list of ids
|
45
45
|
*
|
46
|
+
* @param selectionSetNames Names of the selection sets used to provide ids
|
46
47
|
* @param ids List of ids to download
|
47
48
|
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
48
49
|
* @param addColumnTitle Indicates if column headings should be included in output
|
49
50
|
* @returns Promise resolving when function is done
|
50
51
|
*/
|
51
|
-
async downloadCSV(ids, removeDuplicates, addColumnTitle = true) {
|
52
|
-
return downloadUtils.downloadCSV(this.layerView.layer, ids, true, // formatUsingLayerPopup
|
52
|
+
async downloadCSV(selectionSetNames, ids, removeDuplicates, addColumnTitle = true) {
|
53
|
+
return downloadUtils.downloadCSV(selectionSetNames, this.layerView.layer, ids, true, // formatUsingLayerPopup
|
53
54
|
removeDuplicates, addColumnTitle);
|
54
55
|
}
|
55
56
|
/**
|
56
57
|
* Downloads pdf of mailing labels for the provided list of ids
|
57
58
|
*
|
59
|
+
* @param selectionSetNames Names of the selection sets used to provide ids
|
58
60
|
* @param ids List of ids to download
|
59
61
|
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
60
62
|
* @returns Promise resolving when function is done
|
61
63
|
*/
|
62
|
-
async downloadPDF(ids, removeDuplicates) {
|
63
|
-
return downloadUtils.downloadPDF(this.layerView.layer, ids, removeDuplicates, this._labelInfoElement.selectedOption.value);
|
64
|
+
async downloadPDF(selectionSetNames, ids, removeDuplicates) {
|
65
|
+
return downloadUtils.downloadPDF(selectionSetNames, this.layerView.layer, ids, removeDuplicates, this._labelInfoElement.selectedOption.value);
|
64
66
|
}
|
65
67
|
//--------------------------------------------------------------------------
|
66
68
|
//
|
@@ -205,8 +207,14 @@ export class PdfDownload {
|
|
205
207
|
return {
|
206
208
|
"downloadCSV": {
|
207
209
|
"complexType": {
|
208
|
-
"signature": "(ids: number[], removeDuplicates: boolean, addColumnTitle?: boolean) => Promise<void>",
|
210
|
+
"signature": "(selectionSetNames: string[], ids: number[], removeDuplicates: boolean, addColumnTitle?: boolean) => Promise<void>",
|
209
211
|
"parameters": [{
|
212
|
+
"tags": [{
|
213
|
+
"name": "param",
|
214
|
+
"text": "selectionSetNames Names of the selection sets used to provide ids"
|
215
|
+
}],
|
216
|
+
"text": "Names of the selection sets used to provide ids"
|
217
|
+
}, {
|
210
218
|
"tags": [{
|
211
219
|
"name": "param",
|
212
220
|
"text": "ids List of ids to download"
|
@@ -235,6 +243,9 @@ export class PdfDownload {
|
|
235
243
|
"docs": {
|
236
244
|
"text": "Downloads csv of mailing labels for the provided list of ids",
|
237
245
|
"tags": [{
|
246
|
+
"name": "param",
|
247
|
+
"text": "selectionSetNames Names of the selection sets used to provide ids"
|
248
|
+
}, {
|
238
249
|
"name": "param",
|
239
250
|
"text": "ids List of ids to download"
|
240
251
|
}, {
|
@@ -251,8 +262,14 @@ export class PdfDownload {
|
|
251
262
|
},
|
252
263
|
"downloadPDF": {
|
253
264
|
"complexType": {
|
254
|
-
"signature": "(ids: number[], removeDuplicates: boolean) => Promise<void>",
|
265
|
+
"signature": "(selectionSetNames: string[], ids: number[], removeDuplicates: boolean) => Promise<void>",
|
255
266
|
"parameters": [{
|
267
|
+
"tags": [{
|
268
|
+
"name": "param",
|
269
|
+
"text": "selectionSetNames Names of the selection sets used to provide ids"
|
270
|
+
}],
|
271
|
+
"text": "Names of the selection sets used to provide ids"
|
272
|
+
}, {
|
256
273
|
"tags": [{
|
257
274
|
"name": "param",
|
258
275
|
"text": "ids List of ids to download"
|
@@ -278,6 +295,9 @@ export class PdfDownload {
|
|
278
295
|
"docs": {
|
279
296
|
"text": "Downloads pdf of mailing labels for the provided list of ids",
|
280
297
|
"tags": [{
|
298
|
+
"name": "param",
|
299
|
+
"text": "selectionSetNames Names of the selection sets used to provide ids"
|
300
|
+
}, {
|
281
301
|
"name": "param",
|
282
302
|
"text": "ids List of ids to download"
|
283
303
|
}, {
|