@esri/solutions-components 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. package/dist/assets/arcgis-pdf-creator/PDFCreator.js +6 -3
  2. package/dist/assets/arcgis-pdf-creator/PDFCreator_jsPDF.js +1 -1
  3. package/dist/assets/arcgis-pdf-creator/PDFCreator_pdf_lib.js +1 -1
  4. package/dist/assets/arcgis-pdf-creator/PDFLabels.js +54 -3
  5. package/dist/assets/arcgis-pdf-creator/grid.js +1 -1
  6. package/dist/assets/data/images/grid.png +0 -0
  7. package/dist/assets/data/images/horizontal.png +0 -0
  8. package/dist/assets/data/images/vertical.png +0 -0
  9. package/dist/assets/t9n/crowdsource-manager/resources.json +7 -1
  10. package/dist/assets/t9n/crowdsource-manager/resources_en.json +7 -1
  11. package/dist/cjs/buffer-tools_6.cjs.entry.js +88 -92
  12. package/dist/cjs/{calcite-block_2.cjs.entry.js → calcite-action-bar_4.cjs.entry.js} +307 -18
  13. package/dist/cjs/{calcite-action.cjs.entry.js → calcite-action_2.cjs.entry.js} +84 -1
  14. package/dist/cjs/{calcite-combobox_3.cjs.entry.js → calcite-chip_4.cjs.entry.js} +131 -5
  15. package/dist/cjs/{calcite-dropdown-group_4.cjs.entry.js → calcite-dropdown_5.cjs.entry.js} +467 -1
  16. package/dist/cjs/calcite-input-message_5.cjs.entry.js +19 -17
  17. package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
  18. package/dist/cjs/{calcite-action-bar_2.cjs.entry.js → calcite-tooltip.cjs.entry.js} +2 -208
  19. package/dist/cjs/crowdsource-manager.cjs.entry.js +88 -14
  20. package/dist/cjs/{downloadUtils-415ab342.js → downloadUtils-9359e9ff.js} +135 -44
  21. package/dist/cjs/{index.es-98008aa0.js → index.es-9c0d0ed6.js} +3 -3
  22. package/dist/cjs/{interfaces-17c631bf.js → interfaces-cac36920.js} +6 -0
  23. package/dist/cjs/layer-table_2.cjs.entry.js +512 -0
  24. package/dist/cjs/loader.cjs.js +1 -1
  25. package/dist/cjs/{mapViewUtils-f617ae9a.js → mapViewUtils-090f4d4d.js} +3 -3
  26. package/dist/cjs/public-notification.cjs.entry.js +173 -48
  27. package/dist/cjs/solution-configuration.cjs.entry.js +2 -2
  28. package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
  29. package/dist/cjs/{solution-store-b86759b2.js → solution-store-d28c332e.js} +1 -1
  30. package/dist/cjs/solutions-components.cjs.js +1 -1
  31. package/dist/collection/assets/arcgis-pdf-creator/PDFCreator.js +6 -3
  32. package/dist/collection/assets/arcgis-pdf-creator/PDFCreator_jsPDF.js +1 -1
  33. package/dist/collection/assets/arcgis-pdf-creator/PDFCreator_pdf_lib.js +1 -1
  34. package/dist/collection/assets/arcgis-pdf-creator/PDFLabels.js +54 -3
  35. package/dist/collection/assets/arcgis-pdf-creator/grid.js +1 -1
  36. package/dist/collection/components/crowdsource-manager/crowdsource-manager.css +122 -0
  37. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +130 -14
  38. package/dist/collection/components/layer-table/layer-table.css +2 -70
  39. package/dist/collection/components/layer-table/layer-table.js +66 -106
  40. package/dist/collection/components/map-card/map-card.css +4 -7
  41. package/dist/collection/components/map-card/map-card.js +44 -10
  42. package/dist/collection/components/map-draw-tools/map-draw-tools.js +4 -8
  43. package/dist/collection/components/map-select-tools/map-select-tools.js +75 -15
  44. package/dist/collection/components/public-notification/public-notification.js +217 -25
  45. package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +1 -1
  46. package/dist/collection/demos/crowdsource-manager.html +14 -41
  47. package/dist/collection/utils/csvDownload.js +41 -0
  48. package/dist/collection/utils/csvDownload.ts +42 -0
  49. package/dist/collection/utils/csvUtils.js +6 -23
  50. package/dist/collection/utils/csvUtils.ts +8 -27
  51. package/dist/collection/utils/downloadUtils.js +30 -14
  52. package/dist/collection/utils/downloadUtils.ts +36 -14
  53. package/dist/collection/utils/interfaces.js +6 -0
  54. package/dist/collection/utils/interfaces.ts +6 -0
  55. package/dist/collection/utils/pdfUtils.js +9 -6
  56. package/dist/collection/utils/pdfUtils.ts +13 -8
  57. package/dist/collection/utils/queryUtils.js +2 -2
  58. package/dist/collection/utils/queryUtils.ts +2 -2
  59. package/dist/collection/utils/test/csvUtils.spec.tsx +56 -0
  60. package/dist/collection/utils/test/downloadUtils.spec.tsx +133 -0
  61. package/dist/components/crowdsource-manager.js +293 -17
  62. package/dist/components/downloadUtils.js +133 -42
  63. package/dist/components/interfaces3.js +7 -1
  64. package/dist/components/layer-table.js +1 -443
  65. package/dist/components/layer-table2.js +429 -0
  66. package/dist/components/map-card.js +1 -339
  67. package/dist/{esm/map-card.entry.js → components/map-card2.js} +118 -22
  68. package/dist/components/map-draw-tools2.js +19 -23
  69. package/dist/components/map-layer-picker2.js +1 -1
  70. package/dist/components/map-select-tools2.js +21 -16
  71. package/dist/components/public-notification.js +209 -81
  72. package/dist/components/queryUtils.js +2 -2
  73. package/dist/components/refine-selection-tools2.js +3 -3
  74. package/dist/components/refine-selection2.js +1 -1
  75. package/dist/components/solution-resource-item2.js +1 -1
  76. package/dist/components/solution-store.js +1 -1
  77. package/dist/esm/buffer-tools_6.entry.js +79 -83
  78. package/dist/esm/{calcite-block_2.entry.js → calcite-action-bar_4.entry.js} +307 -20
  79. package/dist/esm/{calcite-action.entry.js → calcite-action_2.entry.js} +84 -2
  80. package/dist/esm/{calcite-combobox_3.entry.js → calcite-chip_4.entry.js} +134 -9
  81. package/dist/esm/{calcite-dropdown-group_4.entry.js → calcite-dropdown_5.entry.js} +468 -3
  82. package/dist/esm/calcite-input-message_5.entry.js +19 -17
  83. package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
  84. package/dist/esm/{calcite-action-bar_2.entry.js → calcite-tooltip.entry.js} +4 -209
  85. package/dist/esm/crowdsource-manager.entry.js +88 -14
  86. package/dist/esm/{downloadUtils-606b0f0e.js → downloadUtils-a8f139c5.js} +135 -44
  87. package/dist/esm/{index.es-c736c805.js → index.es-a75412ff.js} +3 -3
  88. package/dist/esm/{interfaces-d0d83efa.js → interfaces-cd4054e5.js} +7 -1
  89. package/dist/esm/layer-table_2.entry.js +507 -0
  90. package/dist/esm/loader.js +1 -1
  91. package/dist/esm/{mapViewUtils-4e945e07.js → mapViewUtils-8ffcd36d.js} +4 -4
  92. package/dist/esm/public-notification.entry.js +169 -44
  93. package/dist/esm/solution-configuration.entry.js +2 -2
  94. package/dist/esm/solution-contents_3.entry.js +2 -2
  95. package/dist/esm/{solution-store-477288ac.js → solution-store-1b67f2c8.js} +1 -1
  96. package/dist/esm/solutions-components.js +1 -1
  97. package/dist/solutions-components/demos/crowdsource-manager.html +14 -41
  98. package/dist/solutions-components/{p-dd11eeb2.js → p-1395b0ef.js} +1 -1
  99. package/dist/solutions-components/{p-4f5641b4.entry.js → p-1affd711.entry.js} +18 -18
  100. package/dist/solutions-components/p-30de8da1.entry.js +17 -0
  101. package/dist/solutions-components/{p-91cad71e.entry.js → p-439c878d.entry.js} +3 -9
  102. package/dist/solutions-components/{p-72117a18.js → p-765a27f3.js} +1 -1
  103. package/dist/solutions-components/p-813a04c3.entry.js +6 -0
  104. package/dist/solutions-components/{p-9e8a371f.entry.js → p-874b39a7.entry.js} +3 -3
  105. package/dist/solutions-components/p-8cece97f.js +21 -0
  106. package/dist/solutions-components/{p-dd0241fb.entry.js → p-97aa7211.entry.js} +1 -1
  107. package/dist/solutions-components/{p-0e459cc7.entry.js → p-a955a3e6.entry.js} +10 -4
  108. package/dist/solutions-components/{p-6a657ff6.js → p-bb64bd47.js} +25 -9
  109. package/dist/solutions-components/p-c392dd95.entry.js +17 -0
  110. package/dist/solutions-components/p-ca386a72.entry.js +6 -0
  111. package/dist/solutions-components/p-d47d74a6.entry.js +23 -0
  112. package/dist/solutions-components/p-db846ee2.entry.js +11 -0
  113. package/dist/solutions-components/p-dc53c9c1.js +36 -0
  114. package/dist/solutions-components/p-e1c93241.entry.js +6 -0
  115. package/dist/solutions-components/{p-4cbaf0f1.entry.js → p-e6d235d6.entry.js} +1 -1
  116. package/dist/solutions-components/solutions-components.esm.js +6 -6
  117. package/dist/solutions-components/utils/csvDownload.ts +42 -0
  118. package/dist/solutions-components/utils/csvUtils.ts +8 -27
  119. package/dist/solutions-components/utils/downloadUtils.ts +36 -14
  120. package/dist/solutions-components/utils/interfaces.ts +6 -0
  121. package/dist/solutions-components/utils/pdfUtils.ts +13 -8
  122. package/dist/solutions-components/utils/queryUtils.ts +2 -2
  123. package/dist/solutions-components/utils/test/csvUtils.spec.tsx +56 -0
  124. package/dist/solutions-components/utils/test/downloadUtils.spec.tsx +133 -0
  125. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +39 -0
  126. package/dist/types/components/layer-table/layer-table.d.ts +35 -48
  127. package/dist/types/components/map-card/map-card.d.ts +10 -6
  128. package/dist/types/components/map-select-tools/map-select-tools.d.ts +16 -1
  129. package/dist/types/components/public-notification/public-notification.d.ts +86 -4
  130. package/dist/types/components.d.ts +68 -0
  131. package/dist/types/preact.d.ts +2 -1
  132. package/dist/types/utils/csvDownload.d.ts +24 -0
  133. package/dist/types/utils/csvUtils.d.ts +2 -1
  134. package/dist/types/utils/downloadUtils.d.ts +25 -0
  135. package/dist/types/utils/interfaces.d.ts +5 -0
  136. package/dist/types/utils/pdfUtils.d.ts +2 -1
  137. package/package.json +4 -4
  138. package/dist/cjs/calcite-chip.cjs.entry.js +0 -142
  139. package/dist/cjs/calcite-dropdown.cjs.entry.js +0 -481
  140. package/dist/cjs/calcite-handle.cjs.entry.js +0 -99
  141. package/dist/cjs/calcite-loader.cjs.entry.js +0 -95
  142. package/dist/cjs/layer-table.cjs.entry.js +0 -317
  143. package/dist/cjs/map-card.cjs.entry.js +0 -252
  144. package/dist/esm/calcite-chip.entry.js +0 -138
  145. package/dist/esm/calcite-dropdown.entry.js +0 -477
  146. package/dist/esm/calcite-handle.entry.js +0 -95
  147. package/dist/esm/calcite-loader.entry.js +0 -91
  148. package/dist/esm/layer-table.entry.js +0 -313
  149. package/dist/solutions-components/p-11132485.entry.js +0 -11
  150. package/dist/solutions-components/p-15b43c29.entry.js +0 -11
  151. package/dist/solutions-components/p-5034aabc.entry.js +0 -11
  152. package/dist/solutions-components/p-5ee7b022.entry.js +0 -12
  153. package/dist/solutions-components/p-6f012424.entry.js +0 -6
  154. package/dist/solutions-components/p-7fd10eb3.entry.js +0 -11
  155. package/dist/solutions-components/p-84bbaebf.entry.js +0 -6
  156. package/dist/solutions-components/p-88e28de2.js +0 -36
  157. package/dist/solutions-components/p-a57ef371.entry.js +0 -6
  158. package/dist/solutions-components/p-ac76d270.entry.js +0 -17
  159. package/dist/solutions-components/p-dbc9a5a8.js +0 -21
  160. package/dist/solutions-components/p-e162304e.entry.js +0 -6
  161. package/dist/solutions-components/p-f5c70be2.entry.js +0 -6
  162. package/dist/solutions-components/p-f6b17cc6.entry.js +0 -11
@@ -8,7 +8,7 @@
8
8
  const _commonjsHelpers = require('./_commonjsHelpers-384729db.js');
9
9
  const index = require('./index-c6979cbb.js');
10
10
  const loadModules = require('./loadModules-0806a34f.js');
11
- const mapViewUtils = require('./mapViewUtils-f617ae9a.js');
11
+ const mapViewUtils = require('./mapViewUtils-090f4d4d.js');
12
12
 
13
13
  /** @license
14
14
  * Copyright 2022 Esri
@@ -26,32 +26,19 @@ const mapViewUtils = require('./mapViewUtils-f617ae9a.js');
26
26
  * limitations under the License.
27
27
  */
28
28
  //#region Public functions
29
- /**
30
- * Export a csv of the attributes from the features that match the provided ids
31
- *
32
- * @param labels Labels to write
33
- */
34
- function exportCSV(labels) {
35
- // Format values to string so it doesn't get tripped up when a value has a comma
36
- // another option could be to export with a different delimiter
37
- const outputLines = labels.map(label => Object.values(label).map(v => `"${v}"`).join(",") + "\r\n");
38
- _downloadCSVFile(outputLines, `notify-${Date.now().toString()}`);
39
- }
40
- //#endregion
41
- //#region Private functions
42
29
  /**
43
30
  * Download the CSV file
44
31
  *
32
+ * @param title Title (without file extension) to use for file; defaults to "export"
45
33
  * @param outputLines Lines of output to write to file
46
- * @param fileTitle Title (without file extension) to use for file; defaults to "export"
47
34
  *
48
35
  * @see {@link https://medium.com/@danny.pule/export-json-to-csv-file-using-javascript-a0b7bc5b00d2}
49
36
  */
50
- function _downloadCSVFile(outputLines, fileTitle) {
37
+ function downloadCSVFile(title, outputLines) {
51
38
  const link = document.createElement("a");
52
39
  if (link.download !== undefined) {
53
40
  link.href = URL.createObjectURL(new Blob(outputLines, { type: "text/csv;charset=utf-8;" }));
54
- link.download = `${fileTitle}.csv` || "export.csv";
41
+ link.download = `${title}.csv` || "export.csv";
55
42
  link.style.visibility = "hidden";
56
43
  document.body.appendChild(link);
57
44
  link.click();
@@ -60,6 +47,37 @@ function _downloadCSVFile(outputLines, fileTitle) {
60
47
  }
61
48
  //#endregion
62
49
 
50
+ /** @license
51
+ * Copyright 2022 Esri
52
+ *
53
+ * Licensed under the Apache License, Version 2.0 (the "License");
54
+ * you may not use this file except in compliance with the License.
55
+ * You may obtain a copy of the License at
56
+ *
57
+ * http://www.apache.org/licenses/LICENSE-2.0
58
+ *
59
+ * Unless required by applicable law or agreed to in writing, software
60
+ * distributed under the License is distributed on an "AS IS" BASIS,
61
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
62
+ * See the License for the specific language governing permissions and
63
+ * limitations under the License.
64
+ */
65
+ //#endregion
66
+ //#region Public functions
67
+ /**
68
+ * Export a csv of the attributes from the features that match the provided ids
69
+ *
70
+ * @param title Title to use for file
71
+ * @param labels Labels to write
72
+ */
73
+ function exportCSV(title, labels) {
74
+ // Format values to string so it doesn't get tripped up when a value has a comma
75
+ // another option could be to export with a different delimiter
76
+ const outputLines = labels.map(label => Object.values(label).map(v => `"${v}"`).join(",") + "\r\n");
77
+ downloadCSVFile(title, outputLines);
78
+ }
79
+ //#endregion
80
+
63
81
  var _typeof_1 = _commonjsHelpers.createCommonjsModule(function (module) {
64
82
  function _typeof(obj) {
65
83
  "@babel/helpers - typeof";
@@ -1082,7 +1100,7 @@ function(t){var e=function(t){for(var e=t.length,r=new Uint8Array(e),n=0;n<e;n++
1082
1100
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1083
1101
  * ====================================================================
1084
1102
  */
1085
- function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):Promise.resolve().then(function () { return require('./index.es-98008aa0.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},
1103
+ function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):Promise.resolve().then(function () { return require('./index.es-9c0d0ed6.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
1104
  /** ====================================================================
1087
1105
  * @license
1088
1106
  * jsPDF XMP metadata plugin
@@ -1126,7 +1144,7 @@ function(t){t.__bidiEngine__=t.prototype.__bidiEngine__=function(t){var r,n,i,a,
1126
1144
 
1127
1145
  /* @preserve
1128
1146
  * arcgis-pdf-creator v0.0.1
1129
- * Fri Feb 03 2023 09:47:02 GMT-0800 (Pacific Standard Time)
1147
+ * Tue Mar 21 2023 10:44:29 GMT-0700 (Pacific Daylight Time)
1130
1148
  */
1131
1149
  /** @license
1132
1150
  * Copyright 2022 Esri
@@ -1401,13 +1419,16 @@ class PDFCreator {
1401
1419
  *
1402
1420
  * @param text String to estimate
1403
1421
  * @param fontSize Text size in points
1404
- * @returns Estimated width of text in doc units
1422
+ * @returns Estimated width of text using (points x 1/72 inches/point) * 0.6;
1423
+ * need to override this generalized function with a specific PDF generator;
1424
+ * the 0.6 width:height ratio comes from https://www.fhwa.dot.gov/publications/research/safety/98057/ch03.cfm#width
1405
1425
  *
1406
1426
  * @class PDFCreator
1407
1427
  */
1408
1428
  getTextWidth(text, fontSize) {
1429
+ const ratioWidthToHeight = 0.6;
1409
1430
  // Return a value for testing
1410
- return text.length * fontSize;
1431
+ return text.length * fontSize * this.fontProps.fontResolutionInchesPerPoint * ratioWidthToHeight;
1411
1432
  }
1412
1433
  /**
1413
1434
  * @class PDFCreator
@@ -1515,7 +1536,7 @@ class PDFCreator {
1515
1536
 
1516
1537
  /* @preserve
1517
1538
  * arcgis-pdf-creator v0.0.1
1518
- * Fri Feb 03 2023 09:47:02 GMT-0800 (Pacific Standard Time)
1539
+ * Tue Mar 21 2023 10:44:29 GMT-0700 (Pacific Daylight Time)
1519
1540
  */
1520
1541
 
1521
1542
  /** @license
@@ -1743,7 +1764,7 @@ class PDFCreator_jsPDF extends PDFCreator {
1743
1764
 
1744
1765
  /* @preserve
1745
1766
  * arcgis-pdf-creator v0.0.1
1746
- * Fri Feb 03 2023 09:47:02 GMT-0800 (Pacific Standard Time)
1767
+ * Tue Mar 21 2023 10:44:29 GMT-0700 (Pacific Daylight Time)
1747
1768
  */
1748
1769
  /** @license
1749
1770
  * Copyright 2022 Esri
@@ -1806,7 +1827,7 @@ function drawGridOfBoxes(PDFCreator, options = {
1806
1827
 
1807
1828
  /* @preserve
1808
1829
  * arcgis-pdf-creator v0.0.1
1809
- * Fri Feb 03 2023 09:47:02 GMT-0800 (Pacific Standard Time)
1830
+ * Tue Mar 21 2023 10:44:29 GMT-0700 (Pacific Daylight Time)
1810
1831
  */
1811
1832
 
1812
1833
  /** @license
@@ -1833,12 +1854,13 @@ class PDFLabels {
1833
1854
  * @param labels Array of labels; each label consists of one or more line strings
1834
1855
  * @param labelSpec Properties describing page dimensions of labels sheet
1835
1856
  * @param startingPageNum The 1-based page number to start printing labels into; page is assumed to be blank & to exist
1857
+ * @param heading Line to add at top of label page outside of labels
1836
1858
  * @param progressCallback Callback with percent done in range 0..100
1837
1859
  * @returns Promise which, when resolved, returns the 1-based page number of the last page containing labels
1838
1860
  *
1839
1861
  * @class PDFLabels
1840
1862
  */
1841
- addLabelsToDoc(labels, labelSpec, startingPageNum, progressCallback) {
1863
+ addLabelsToDoc(labels, labelSpec, startingPageNum, heading, progressCallback) {
1842
1864
  return new Promise((resolve) => {
1843
1865
  const labelsPerPageDisplay = labelSpec.numLabelsAcross * labelSpec.numLabelsDown;
1844
1866
  let column;
@@ -1849,6 +1871,9 @@ class PDFLabels {
1849
1871
  // Draw
1850
1872
  let currentPageNum = startingPageNum;
1851
1873
  const topOfFirstLabel = labelSpec.pageProperties.topMargin - this.PDFCreator.pageOptions.topMargin;
1874
+ if (heading) {
1875
+ this._drawSupplementalText(heading, 0, -0.1);
1876
+ }
1852
1877
  for (let iLabel = 0, iNonBlankLabel = 0; iLabel < labels.length; iLabel++) {
1853
1878
  if (progressCallback) {
1854
1879
  progressCallback(Math.round(iLabel / labels.length * 100));
@@ -1864,6 +1889,9 @@ class PDFLabels {
1864
1889
  // Advance to next page
1865
1890
  this.PDFCreator.addPage();
1866
1891
  ++currentPageNum;
1892
+ if (heading) {
1893
+ this._drawSupplementalText(heading, 0, -0.1);
1894
+ }
1867
1895
  }
1868
1896
  // Prep the new page
1869
1897
  column = 0;
@@ -1876,11 +1904,14 @@ class PDFLabels {
1876
1904
  row = 0;
1877
1905
  }
1878
1906
  // Draw the label
1907
+ const minimumFontSize = 4;
1879
1908
  // Temporarily reduce the font size if we have more lines than the label can hold
1880
1909
  let fontPoints = labelSpec.fontSizePx;
1881
1910
  if (labelSpec.maxNumLabelLines < labelLines.length) {
1882
- fontPoints = Math.floor(labelSpec.maxNumLabelLines / labelLines.length * labelSpec.fontSizePx);
1911
+ fontPoints = Math.max(Math.floor(labelSpec.maxNumLabelLines / labelLines.length * labelSpec.fontSizePx), minimumFontSize);
1883
1912
  }
1913
+ // Temporarily reduce the font size farther if label lines are too long
1914
+ fontPoints = this._getFontSizeForOverlongLines(labelLines, maxLabelTextWidth, fontPoints, minimumFontSize);
1884
1915
  // Clip overlong lines; append ellipses to clipped lines
1885
1916
  labelLines = this._clipOverlongLines(labelLines, maxLabelTextWidth, fontPoints);
1886
1917
  const labelLineHeight = this.PDFCreator.fontAscenderDescenderHeight(fontPoints);
@@ -2042,6 +2073,47 @@ class PDFLabels {
2042
2073
  });
2043
2074
  return trimmedLines;
2044
2075
  }
2076
+ /**
2077
+ * Draws supplemental text such as a heading or footer.
2078
+ *
2079
+ * @param text Text to draw
2080
+ * @param left Offset from left edge of document to left edge of text
2081
+ * @param top Offset from top of document to top of text
2082
+ */
2083
+ _drawSupplementalText(text, left, top) {
2084
+ const fontPoints = 6;
2085
+ this.PDFCreator.drawText(text, {
2086
+ left,
2087
+ top,
2088
+ fontPoints,
2089
+ fontColor: "000000"
2090
+ });
2091
+ }
2092
+ /**
2093
+ * Trims a set of text lines to fit within specified bounds.
2094
+ *
2095
+ * @param lines Text lines to be checked
2096
+ * @param maxTextWidth The maximum width permitted for the drawing of the text in doc units
2097
+ * @param preferredFontSize Initial text size in points
2098
+ * @param minimumFontSize The smallest acceptable font size in points
2099
+ * @returns The maximum of `minimumFontSize` and the font size in points that should help all lines
2100
+ * of the label to fit on the label
2101
+ *
2102
+ * @class PDFLabels
2103
+ * @private
2104
+ */
2105
+ _getFontSizeForOverlongLines(lines, maxTextWidth, preferredFontSize, minimumFontSize) {
2106
+ let fontSize = preferredFontSize;
2107
+ lines.forEach(line => {
2108
+ line = line.trim();
2109
+ if (this.PDFCreator.getTextWidth(line, fontSize) > maxTextWidth) {
2110
+ do {
2111
+ --fontSize;
2112
+ } while (this.PDFCreator.getTextWidth(line, fontSize) > maxTextWidth && fontSize > minimumFontSize);
2113
+ }
2114
+ });
2115
+ return fontSize;
2116
+ }
2045
2117
  /**
2046
2118
  * Loads the label formats.
2047
2119
  *
@@ -2078,31 +2150,34 @@ class PDFLabels {
2078
2150
  /**
2079
2151
  * Exports a PDF of labels.
2080
2152
  *
2153
+ * @param title Title to use for file
2081
2154
  * @param labels Labels to write
2082
2155
  * @param labelPageDescription Page format to use for labels
2083
2156
  */
2084
- function exportPDF(labels, labelPageDescription) {
2085
- _downloadPDFFile(labels, labelPageDescription, `notify-${Date.now().toString()}`);
2157
+ function exportPDF(title, labels, labelPageDescription) {
2158
+ downloadPDFFile(title, labels, labelPageDescription);
2086
2159
  }
2087
2160
  //#endregion
2088
2161
  //#region Private functions
2089
2162
  /**
2090
2163
  * Downloads the PDF file.
2091
2164
  *
2165
+ * @param title Title (without file extension) to use for file; defaults to "export"
2092
2166
  * @param labels Labels to write
2093
2167
  * @param labelPageDescription Page format to use for labels
2094
- * @param fileTitle Title (without file extension) to use for file; defaults to "export"
2095
2168
  */
2096
- function _downloadPDFFile(labels, labelPageDescription, fileTitle) {
2169
+ function downloadPDFFile(title, labels, labelPageDescription) {
2097
2170
  const pdfLib = new PDFCreator_jsPDF();
2098
2171
  pdfLib.initialize({
2099
2172
  pageType: "ANSI_A"
2100
- }, index.getAssetPath(`../assets/arcgis-pdf-creator/`), "en", fileTitle, false)
2173
+ }, index.getAssetPath(`../assets/arcgis-pdf-creator/`), "en", title)
2101
2174
  .then(() => {
2102
2175
  const labeller = new PDFLabels();
2103
2176
  labeller.initialize(pdfLib)
2104
2177
  .then(async () => {
2105
- await labeller.addLabelsToDoc(labels, labelPageDescription.labelSpec, 1);
2178
+ await labeller.addLabelsToDoc(labels, labelPageDescription.labelSpec, 1, // startingPageNum
2179
+ title // heading
2180
+ );
2106
2181
  pdfLib.save();
2107
2182
  });
2108
2183
  });
@@ -2140,10 +2215,8 @@ const lineSeparatorChar = "|";
2140
2215
  * @returns Promise resolving when function is done
2141
2216
  */
2142
2217
  async function downloadCSV(selectionSetNames, layer, ids, formatUsingLayerPopup, removeDuplicates = false, addColumnTitle = false) {
2143
- console.log("downloadCSV using selectionSetNames " + JSON.stringify(selectionSetNames)); //???
2144
- console.log("downloadCSV removeDuplicates", removeDuplicates); //???
2145
2218
  const labels = await _prepareLabels(layer, ids, removeDuplicates, formatUsingLayerPopup, addColumnTitle);
2146
- exportCSV(labels);
2219
+ exportCSV(_createTitle(selectionSetNames), labels);
2147
2220
  return Promise.resolve();
2148
2221
  }
2149
2222
  /**
@@ -2157,15 +2230,13 @@ async function downloadCSV(selectionSetNames, layer, ids, formatUsingLayerPopup,
2157
2230
  * @returns Promise resolving when function is done
2158
2231
  */
2159
2232
  async function downloadPDF(selectionSetNames, layer, ids, removeDuplicates, labelPageDescription) {
2160
- console.log("downloadPDF using selectionSetNames " + JSON.stringify(selectionSetNames)); //???
2161
- console.log("downloadPDF removeDuplicates", removeDuplicates); //???
2162
2233
  let labels = await _prepareLabels(layer, ids, removeDuplicates);
2163
2234
  labels =
2164
2235
  // Remove empty lines in labels
2165
2236
  labels.map(labelLines => labelLines.filter(line => line.length > 0))
2166
2237
  // Remove empty labels
2167
2238
  .filter(label => label.length > 0);
2168
- exportPDF(labels, labelPageDescription);
2239
+ exportPDF(_createTitle(selectionSetNames), labels, labelPageDescription);
2169
2240
  return Promise.resolve();
2170
2241
  }
2171
2242
  //#endregion
@@ -2202,17 +2273,25 @@ function _convertPopupTextToLabelSpec(popupInfo) {
2202
2273
  popupInfo = popupInfo.replace(/<p[^>]*>/gi, lineSeparatorChar).trim().replace(/^\|/, "");
2203
2274
  // Remove </p>
2204
2275
  popupInfo = popupInfo.replace(/<\/p>/gi, "");
2205
- // Remove \n
2206
- popupInfo = popupInfo.replace(/\n/gi, "");
2207
- // Remove remaining HTML tags, replace 0xA0 that popup uses for spaces, and replace some char representations,
2208
- // and split the label back into individual lines
2209
- const labelSpec = popupInfo
2276
+ // Replace \n with the line separator character
2277
+ popupInfo = popupInfo.replace(/\n/gi, "|");
2278
+ // Remove remaining HTML tags, replace 0xA0 that popup uses for spaces, and replace some char representations
2279
+ let labelSpec = popupInfo
2210
2280
  .replace(/<[\s.]*[^<>]*\/?>/gi, "")
2211
2281
  .replace(/\xA0/gi, " ")
2212
2282
  .replace(/&lt;/gi, "<")
2213
2283
  .replace(/&gt;/gi, ">")
2214
2284
  .replace(/&nbsp;/gi, " ");
2215
- return labelSpec;
2285
+ // Trim each line
2286
+ labelSpec = labelSpec.replace(/\s*\|\s*/g, "|");
2287
+ // Remove empty lines
2288
+ while (labelSpec.match(/\|\|/)) {
2289
+ labelSpec = labelSpec.replace(/\|\|/, "|");
2290
+ }
2291
+ // Remove leading and trailing line feeds
2292
+ labelSpec = labelSpec.replace(/^\|/, "");
2293
+ labelSpec = labelSpec.replace(/\|$/, "");
2294
+ return labelSpec.trim();
2216
2295
  }
2217
2296
  /**
2218
2297
  * Extracts Arcade expressions from the lines of a label format and creates an Arcade executor for each
@@ -2276,6 +2355,18 @@ async function _createArcadeExecutors(labelFormat, layer) {
2276
2355
  return arcadeExecutors;
2277
2356
  });
2278
2357
  }
2358
+ /**
2359
+ * Creates a title from a list of selection set names.
2360
+ *
2361
+ * @param selectionSetNames Names to use in title
2362
+ * @return Title composed of the selectionSetNames separated by commas; if there are no
2363
+ * selection set names supplied, "download" is returned
2364
+ */
2365
+ function _createTitle(selectionSetNames) {
2366
+ // Windows doesn't permit the characters \/:*?"<>|
2367
+ const title = selectionSetNames.length > 0 ? selectionSetNames.join(", ") : "download";
2368
+ return title;
2369
+ }
2279
2370
  /**
2280
2371
  * Prepares an attribute's value by applying domain and type information.
2281
2372
  *
@@ -6,12 +6,12 @@
6
6
  'use strict';
7
7
 
8
8
  const _commonjsHelpers = require('./_commonjsHelpers-384729db.js');
9
- const downloadUtils = require('./downloadUtils-415ab342.js');
9
+ const downloadUtils = require('./downloadUtils-9359e9ff.js');
10
10
  require('./index-c6979cbb.js');
11
11
  require('./loadModules-0806a34f.js');
12
12
  require('./locale-04da9a8c.js');
13
- require('./mapViewUtils-f617ae9a.js');
14
- require('./interfaces-17c631bf.js');
13
+ require('./mapViewUtils-090f4d4d.js');
14
+ require('./interfaces-cac36920.js');
15
15
 
16
16
  var check = function (it) {
17
17
  return it && it.Math == Math && it;
@@ -20,6 +20,12 @@
20
20
  * See the License for the specific language governing permissions and
21
21
  * limitations under the License.
22
22
  */
23
+ exports.ELayoutMode = void 0;
24
+ (function (ELayoutMode) {
25
+ ELayoutMode["GRID"] = "GRID";
26
+ ELayoutMode["HORIZONTAL"] = "HORIZONTAL";
27
+ ELayoutMode["VERTICAL"] = "VERTICAL";
28
+ })(exports.ELayoutMode || (exports.ELayoutMode = {}));
23
29
  /**
24
30
  * Resource update types
25
31
  */