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