@esri/solutions-components 0.7.20 → 0.7.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. package/dist/assets/t9n/public-notification/resources.json +2 -1
  2. package/dist/assets/t9n/public-notification/resources_en.json +2 -1
  3. package/dist/cjs/card-manager_3.cjs.entry.js +133 -91
  4. package/dist/cjs/crowdsource-manager.cjs.entry.js +10 -10
  5. package/dist/cjs/{downloadUtils-9a13c6ac.js → downloadUtils-401356b5.js} +5 -3
  6. package/dist/cjs/{index.es-284a020c.js → index.es-a9a4ff08.js} +1 -1
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/map-select-tools_3.cjs.entry.js +1 -1
  9. package/dist/cjs/public-notification.cjs.entry.js +7 -4
  10. package/dist/cjs/solutions-components.cjs.js +1 -1
  11. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +29 -11
  12. package/dist/collection/components/layer-table/layer-table.js +162 -99
  13. package/dist/collection/components/public-notification/public-notification.js +7 -3
  14. package/dist/collection/utils/pdfUtils.js +4 -2
  15. package/dist/collection/utils/pdfUtils.ts +4 -2
  16. package/dist/components/crowdsource-manager.js +13 -12
  17. package/dist/components/downloadUtils.js +4 -2
  18. package/dist/components/layer-table2.js +134 -91
  19. package/dist/components/public-notification.js +7 -3
  20. package/dist/esm/card-manager_3.entry.js +133 -91
  21. package/dist/esm/crowdsource-manager.entry.js +10 -10
  22. package/dist/esm/{downloadUtils-a4bbdb1d.js → downloadUtils-13579d93.js} +5 -3
  23. package/dist/esm/{index.es-48fdb288.js → index.es-04d2e63e.js} +1 -1
  24. package/dist/esm/loader.js +1 -1
  25. package/dist/esm/map-select-tools_3.entry.js +1 -1
  26. package/dist/esm/public-notification.entry.js +7 -4
  27. package/dist/esm/solutions-components.js +1 -1
  28. package/dist/solutions-components/p-02fad071.entry.js +6 -0
  29. package/dist/solutions-components/{p-b1422b00.entry.js → p-24286e8c.entry.js} +1 -1
  30. package/dist/solutions-components/p-630e274b.entry.js +6 -0
  31. package/dist/solutions-components/{p-72dbfa77.js → p-c68a6d4f.js} +1 -1
  32. package/dist/solutions-components/{p-d4afcf86.js → p-c9f87acb.js} +2 -2
  33. package/dist/solutions-components/p-d3085b7a.entry.js +6 -0
  34. package/dist/solutions-components/solutions-components.esm.js +1 -1
  35. package/dist/solutions-components/utils/pdfUtils.ts +4 -2
  36. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +13 -4
  37. package/dist/types/components/layer-table/layer-table.d.ts +14 -5
  38. package/dist/types/components/public-notification/public-notification.d.ts +4 -0
  39. package/dist/types/components.d.ts +18 -0
  40. package/package.json +1 -1
  41. package/dist/solutions-components/p-107b7816.entry.js +0 -6
  42. package/dist/solutions-components/p-2abc02a1.entry.js +0 -6
  43. package/dist/solutions-components/p-6b4e621b.entry.js +0 -6
@@ -7,7 +7,7 @@ import { r as registerInstance, h, H as Host, g as getElement, c as createEvent
7
7
  import { g as getLocaleComponentStrings } from './locale-834c52c6.js';
8
8
  import { q as queryFeaturesByID, a as getLayerOrTable, g as goToSelection, b as queryFeatureIds, c as queryAllIds, d as queryFeaturesByGlobalID } from './mapViewUtils-8fe70944.js';
9
9
  import { l as loadModules } from './loadModules-cea493da.js';
10
- import { d as downloadCSV } from './downloadUtils-a4bbdb1d.js';
10
+ import { d as downloadCSV } from './downloadUtils-13579d93.js';
11
11
  import './esri-loader-eda07632.js';
12
12
  import './_commonjsHelpers-d5f9d613.js';
13
13
  import './interfaces-341e3ab3.js';
@@ -117,6 +117,10 @@ const LayerTable = class {
117
117
  * boolean: When true the ctrl key is currently pressed
118
118
  */
119
119
  this._ctrlIsPressed = false;
120
+ /**
121
+ * boolean: When true the default filter provided via url param has been honored and should now be ignored
122
+ */
123
+ this._defaultFilterHonored = false;
120
124
  /**
121
125
  * boolean: When true the default global id provided via url param has been honored and should now be ignored
122
126
  */
@@ -150,8 +154,9 @@ const LayerTable = class {
150
154
  this.onTableNodeCreate = (node) => {
151
155
  this._tableNode = node;
152
156
  };
153
- this.defaultLayerId = undefined;
157
+ this.defaultFilter = undefined;
154
158
  this.defaultGlobalId = undefined;
159
+ this.defaultLayerId = undefined;
155
160
  this.defaultOid = undefined;
156
161
  this.enableAutoRefresh = undefined;
157
162
  this.enableColumnReorder = true;
@@ -521,93 +526,95 @@ const LayerTable = class {
521
526
  const featuresSelected = this._featuresSelected();
522
527
  const featuresEmpty = this._featuresEmpty();
523
528
  const hasFilterExpressions = this._hasFilterExpressions();
524
- this._toolInfos = [{
525
- active: false,
526
- icon: "zoom-to-object",
527
- indicator: false,
528
- label: this._translations.zoom,
529
- func: () => this._zoom(),
530
- disabled: !featuresSelected,
531
- isOverflow: false
532
- },
533
- hasFilterExpressions ? {
534
- active: false,
535
- icon: "filter",
536
- indicator: false,
537
- label: this._translations.filters,
538
- func: () => this._toggleFilter(),
539
- disabled: false,
540
- isOverflow: false
541
- } : undefined,
542
- this._deleteEnabled ? {
543
- active: false,
544
- icon: "trash",
545
- indicator: false,
546
- label: this._translations.delete,
547
- func: () => this._delete(),
548
- disabled: !featuresSelected,
549
- isDanger: true,
550
- isOverflow: false
551
- } : undefined, {
552
- active: false,
553
- icon: "erase",
554
- indicator: false,
555
- label: this._translations.clearSelection,
556
- func: () => this._clearSelection(),
557
- disabled: !featuresSelected,
558
- isOverflow: false
559
- }, {
560
- active: false,
561
- icon: "selected-items-filter",
562
- indicator: false,
563
- label: this._showOnlySelected ? this._translations.showAll : this._translations.showSelected,
564
- func: () => this._toggleShowSelected(),
565
- disabled: !featuresSelected,
566
- isOverflow: false
567
- }, {
568
- active: false,
569
- icon: "list-check-all",
570
- indicator: false,
571
- func: () => this._selectAll(),
572
- label: this._translations.selectAll,
573
- disabled: featuresEmpty,
574
- isOverflow: false
575
- }, {
576
- active: false,
577
- icon: "compare",
578
- indicator: false,
579
- func: () => this._switchSelected(),
580
- label: this._translations.switchSelected,
581
- disabled: featuresEmpty,
582
- isOverflow: false
583
- }, {
584
- active: false,
585
- icon: "refresh",
586
- indicator: false,
587
- func: () => this._refresh(),
588
- label: this._translations.refresh,
589
- disabled: false,
590
- isOverflow: false
591
- },
592
- this.enableCSV ? {
593
- active: false,
594
- icon: "export",
595
- indicator: false,
596
- func: () => void this._exportToCSV(),
597
- label: this._translations.exportCSV,
598
- disabled: featuresEmpty,
599
- isOverflow: false
600
- } : undefined, {
601
- active: false,
602
- icon: this._showHideOpen ? "chevron-down" : "chevron-right",
603
- indicator: false,
604
- func: () => this._toggleShowHide(),
605
- label: this._translations.showHideColumns,
606
- disabled: false,
607
- isOverflow: false,
608
- isSublist: true
609
- }];
610
- this._defaultVisibleToolSizeInfos = undefined;
529
+ if (this._translations) {
530
+ this._toolInfos = [{
531
+ active: false,
532
+ icon: "zoom-to-object",
533
+ indicator: false,
534
+ label: this._translations.zoom,
535
+ func: () => this._zoom(),
536
+ disabled: !featuresSelected,
537
+ isOverflow: false
538
+ },
539
+ hasFilterExpressions ? {
540
+ active: false,
541
+ icon: "filter",
542
+ indicator: false,
543
+ label: this._translations.filters,
544
+ func: () => this._toggleFilter(),
545
+ disabled: false,
546
+ isOverflow: false
547
+ } : undefined,
548
+ this._deleteEnabled ? {
549
+ active: false,
550
+ icon: "trash",
551
+ indicator: false,
552
+ label: this._translations.delete,
553
+ func: () => this._delete(),
554
+ disabled: !featuresSelected,
555
+ isDanger: true,
556
+ isOverflow: false
557
+ } : undefined, {
558
+ active: false,
559
+ icon: "erase",
560
+ indicator: false,
561
+ label: this._translations.clearSelection,
562
+ func: () => this._clearSelection(),
563
+ disabled: !featuresSelected,
564
+ isOverflow: false
565
+ }, {
566
+ active: false,
567
+ icon: "selected-items-filter",
568
+ indicator: false,
569
+ label: this._showOnlySelected ? this._translations.showAll : this._translations.showSelected,
570
+ func: () => this._toggleShowSelected(),
571
+ disabled: !featuresSelected,
572
+ isOverflow: false
573
+ }, {
574
+ active: false,
575
+ icon: "list-check-all",
576
+ indicator: false,
577
+ func: () => this._selectAll(),
578
+ label: this._translations.selectAll,
579
+ disabled: featuresEmpty,
580
+ isOverflow: false
581
+ }, {
582
+ active: false,
583
+ icon: "compare",
584
+ indicator: false,
585
+ func: () => this._switchSelected(),
586
+ label: this._translations.switchSelected,
587
+ disabled: featuresEmpty,
588
+ isOverflow: false
589
+ }, {
590
+ active: false,
591
+ icon: "refresh",
592
+ indicator: false,
593
+ func: () => this._refresh(),
594
+ label: this._translations.refresh,
595
+ disabled: false,
596
+ isOverflow: false
597
+ },
598
+ this.enableCSV ? {
599
+ active: false,
600
+ icon: "export",
601
+ indicator: false,
602
+ func: () => void this._exportToCSV(),
603
+ label: this._translations.exportCSV,
604
+ disabled: featuresEmpty,
605
+ isOverflow: false
606
+ } : undefined, {
607
+ active: false,
608
+ icon: this._showHideOpen ? "chevron-down" : "chevron-right",
609
+ indicator: false,
610
+ func: () => this._toggleShowHide(),
611
+ label: this._translations.showHideColumns,
612
+ disabled: false,
613
+ isOverflow: false,
614
+ isSublist: true
615
+ }];
616
+ this._defaultVisibleToolSizeInfos = undefined;
617
+ }
611
618
  }
612
619
  /**
613
620
  * Returns true when one ore more features are selected
@@ -818,13 +825,39 @@ const LayerTable = class {
818
825
  if ((_b = this.mapInfo) === null || _b === void 0 ? void 0 : _b.id) {
819
826
  urlObj.searchParams.set("webmap", this.mapInfo.id);
820
827
  }
828
+ else {
829
+ urlObj.searchParams.delete("webmap");
830
+ }
821
831
  if ((_c = this._layer) === null || _c === void 0 ? void 0 : _c.id) {
822
832
  urlObj.searchParams.set("layer", this._layer.id);
823
833
  }
834
+ else {
835
+ urlObj.searchParams.delete("layer");
836
+ }
824
837
  if (((_d = this._selectedIndexes) === null || _d === void 0 ? void 0 : _d.length) > 0) {
825
838
  urlObj.searchParams.set("oid", this._selectedIndexes.join(","));
826
839
  }
840
+ else {
841
+ urlObj.searchParams.delete("oid");
842
+ }
843
+ if (this._filterActive) {
844
+ const filter = JSON.parse(this._filterList.urlParams.get("filter"));
845
+ const layerExpressions = this._filterList.layerExpressions.map(layerExp => {
846
+ layerExp.expressions = layerExp.expressions.map(exp => {
847
+ if (exp.id.toString() === filter.expressionId.toString()) {
848
+ exp.active = true;
849
+ }
850
+ return exp;
851
+ });
852
+ return layerExp;
853
+ });
854
+ urlObj.searchParams.set("filter", JSON.stringify(layerExpressions));
855
+ }
856
+ else {
857
+ urlObj.searchParams.delete("filter");
858
+ }
827
859
  this._shareNode.shareUrl = urlObj.href;
860
+ history.pushState(history.state, document.title, urlObj.href);
828
861
  }
829
862
  /**
830
863
  * Get a tooltip
@@ -945,7 +978,8 @@ const LayerTable = class {
945
978
  const _end = this._table.viewModel.getObjectIdIndex(this._currentId);
946
979
  const startIndex = _start < _end ? _start : _end;
947
980
  const endIndex = _end > _start ? _end : _start;
948
- this._selectedIndexes = oids.reduce((prev, cur) => {
981
+ this._skipOnChange = startIndex + 1 !== endIndex;
982
+ const selectedIndexes = oids.reduce((prev, cur) => {
949
983
  const id = cur;
950
984
  const index = this._table.viewModel.getObjectIdIndex(id);
951
985
  if ((id === this._currentId || id === this._previousCurrentId)) {
@@ -967,6 +1001,7 @@ const LayerTable = class {
967
1001
  }
968
1002
  return prev;
969
1003
  }, []);
1004
+ this._selectedIndexes = _start < _end ? selectedIndexes.reverse() : selectedIndexes;
970
1005
  this._table.highlightIds.addMany(this._selectedIndexes.filter(i => ids.indexOf(i) < 0));
971
1006
  }
972
1007
  }
@@ -1029,6 +1064,11 @@ const LayerTable = class {
1029
1064
  }
1030
1065
  this._defaultGlobalIdHonored = true;
1031
1066
  }
1067
+ if (!this._defaultFilterHonored && this.defaultFilter && this._filterList) {
1068
+ this._layerExpressions = this.defaultFilter;
1069
+ this._filterActive = true;
1070
+ this._defaultFilterHonored = true;
1071
+ }
1032
1072
  });
1033
1073
  this._showOnlySelected = false;
1034
1074
  this._sortActive = false;
@@ -1137,19 +1177,21 @@ const LayerTable = class {
1137
1177
  */
1138
1178
  _filterModal() {
1139
1179
  var _a, _b, _c;
1140
- return (h("calcite-modal", { "aria-labelledby": "modal-title", class: "modal", kind: "brand", onCalciteModalClose: async () => this._closeFilter(), open: this._filterOpen, widthScale: "s" }, h("div", { class: "display-flex align-center", id: "modal-title", slot: "header" }, (_b = (_a = this._translations) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.replace("{{title}}", (_c = this._layer) === null || _c === void 0 ? void 0 : _c.title)), h("div", { slot: "content" }, h("instant-apps-filter-list", { autoUpdateUrl: false, closeBtn: true, closeBtnOnClick: async () => this._closeFilter(), layerExpressions: this._layerExpressions, onFilterListReset: () => this._handleFilterListReset(), onFilterUpdate: () => this._handleFilterUpdate(), ref: (el) => this._filterList = el, view: this.mapView, zoomBtn: false }))));
1180
+ return (h("calcite-modal", { "aria-labelledby": "modal-title", class: "modal", kind: "brand", onCalciteModalClose: async () => this._closeFilter(), open: this._filterOpen, widthScale: "s" }, h("div", { class: "display-flex align-center", id: "modal-title", slot: "header" }, (_b = (_a = this._translations) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.replace("{{title}}", (_c = this._layer) === null || _c === void 0 ? void 0 : _c.title)), h("div", { slot: "content" }, h("instant-apps-filter-list", { autoUpdateUrl: true, closeBtn: true, closeBtnOnClick: async () => this._closeFilter(), layerExpressions: this._layerExpressions, onFilterListReset: () => this._handleFilterListReset(), onFilterUpdate: () => this._handleFilterUpdate(), ref: (el) => this._filterList = el, view: this.mapView, zoomBtn: false }))));
1141
1181
  }
1142
1182
  /**
1143
1183
  * Reset the filter active prop
1144
1184
  */
1145
1185
  _handleFilterListReset() {
1146
1186
  this._filterActive = false;
1187
+ this._updateShareUrl();
1147
1188
  }
1148
1189
  /**
1149
1190
  * Check if the layers definitionExpression has been modified
1150
1191
  */
1151
1192
  _handleFilterUpdate() {
1152
1193
  this._filterActive = this._definitionExpression !== this._layer.definitionExpression;
1194
+ this._updateShareUrl();
1153
1195
  }
1154
1196
  /**
1155
1197
  * Close the filter modal
@@ -20,6 +20,7 @@ const CrowdsourceManager = class {
20
20
  */
21
21
  this._shouldSetMapView = false;
22
22
  this.defaultCenter = "";
23
+ this.defaultFilter = "";
23
24
  this.defaultGlobalId = "";
24
25
  this.defaultLayer = "";
25
26
  this.defaultLevel = "";
@@ -70,6 +71,12 @@ const CrowdsourceManager = class {
70
71
  this._defaultCenter = !this.defaultCenter ? undefined :
71
72
  this.defaultCenter.split(";").map(v => parseFloat(v));
72
73
  }
74
+ /**
75
+ * Watch for filter url param to be set
76
+ */
77
+ defaultFilterWatchHandler() {
78
+ this._defaultFilter = JSON.parse(this.defaultFilter);
79
+ }
73
80
  /**
74
81
  * Watch for globalid url param to be set
75
82
  */
@@ -96,13 +103,6 @@ const CrowdsourceManager = class {
96
103
  enableZoomWatchHandler() {
97
104
  this._initMapZoom();
98
105
  }
99
- /**
100
- * Show the map, popup, and table if the user switches out of mobile mode
101
- */
102
- async _isMobileWatchHandler() {
103
- const show = !this._isMobile ? false : this._numSelected > 0;
104
- this.showHideMapPopupAndTable(show);
105
- }
106
106
  //--------------------------------------------------------------------------
107
107
  //
108
108
  // Methods (public)
@@ -381,7 +381,7 @@ const CrowdsourceManager = class {
381
381
  const toggleLayout = layoutMode === ELayoutMode.HORIZONTAL ? "horizontal" : "vertical";
382
382
  const toggleSlot = layoutMode === ELayoutMode.HORIZONTAL ? "header" : "panel-start";
383
383
  const hasMapAndLayer = this.defaultWebmap && this.defaultLayer;
384
- return (h("calcite-shell", { class: `${tableSizeClass} ${tableClass} border-bottom` }, !this._isMobile ? (h("calcite-action-bar", { class: "border-sides", expandDisabled: true, layout: toggleLayout, slot: toggleSlot }, h("calcite-action", { class: "toggle-node", icon: icon, id: id, onClick: () => this._toggleLayout(), text: "" }), h("calcite-tooltip", { label: tooltip, placement: "bottom", "reference-element": id }, h("span", null, tooltip)))) : undefined, h("div", { class: `width-full height-full position-relative` }, h("layer-table", { defaultGlobalId: hasMapAndLayer ? this._defaultGlobalId : undefined, defaultLayerId: hasMapAndLayer ? this.defaultLayer : "", defaultOid: hasMapAndLayer && !this.defaultGlobalId ? this._defaultOid : undefined, enableAutoRefresh: this.enableAutoRefresh, enableCSV: this.enableCSV, enableColumnReorder: this.enableColumnReorder, enableInlineEdit: this.enableInlineEdit, enableShare: this.enableShare, isMobile: this._isMobile, mapInfo: this._mapInfo, mapView: this === null || this === void 0 ? void 0 : this._mapView, onlyShowUpdatableLayers: this.onlyShowUpdatableLayers, ref: (el) => this._layerTable = el, shareIncludeEmbed: this.shareIncludeEmbed, shareIncludeSocial: this.shareIncludeSocial, showNewestFirst: this.showNewestFirst, zoomAndScrollToSelected: this.zoomAndScrollToSelected }))));
384
+ return (h("calcite-shell", { class: `${tableSizeClass} ${tableClass} border-bottom` }, !this._isMobile ? (h("calcite-action-bar", { class: "border-sides", expandDisabled: true, layout: toggleLayout, slot: toggleSlot }, h("calcite-action", { class: "toggle-node", icon: icon, id: id, onClick: () => this._toggleLayout(), text: "" }), h("calcite-tooltip", { label: tooltip, placement: "bottom", "reference-element": id }, h("span", null, tooltip)))) : undefined, h("div", { class: `width-full height-full position-relative` }, h("layer-table", { defaultFilter: hasMapAndLayer ? this._defaultFilter : undefined, defaultGlobalId: hasMapAndLayer ? this._defaultGlobalId : undefined, defaultLayerId: hasMapAndLayer ? this.defaultLayer : "", defaultOid: hasMapAndLayer && !this.defaultGlobalId ? this._defaultOid : undefined, enableAutoRefresh: this.enableAutoRefresh, enableCSV: this.enableCSV, enableColumnReorder: this.enableColumnReorder, enableInlineEdit: this.enableInlineEdit, enableShare: this.enableShare, isMobile: this._isMobile, mapInfo: this._mapInfo, mapView: this === null || this === void 0 ? void 0 : this._mapView, onlyShowUpdatableLayers: this.onlyShowUpdatableLayers, ref: (el) => this._layerTable = el, shareIncludeEmbed: this.shareIncludeEmbed, shareIncludeSocial: this.shareIncludeSocial, showNewestFirst: this.showNewestFirst, zoomAndScrollToSelected: this.zoomAndScrollToSelected }))));
385
385
  }
386
386
  /**
387
387
  * Update the component layout when its size changes
@@ -473,11 +473,11 @@ const CrowdsourceManager = class {
473
473
  get el() { return getElement(this); }
474
474
  static get watchers() { return {
475
475
  "defaultCenter": ["defaultCenterWatchHandler"],
476
+ "defaultFilter": ["defaultFilterWatchHandler"],
476
477
  "defaultGlobalId": ["defaultGlobalIdWatchHandler"],
477
478
  "defaultOid": ["defaultOidWatchHandler"],
478
479
  "defaultLevel": ["defaultLevelWatchHandler"],
479
- "enableZoom": ["enableZoomWatchHandler"],
480
- "_isMobile": ["_isMobileWatchHandler"]
480
+ "enableZoom": ["enableZoomWatchHandler"]
481
481
  }; }
482
482
  };
483
483
  CrowdsourceManager.style = crowdsourceManagerCss;
@@ -1508,7 +1508,7 @@ function(t){var e=function(t){for(var e=t.length,r=new Uint8Array(e),n=0;n<e;n++
1508
1508
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1509
1509
  * ====================================================================
1510
1510
  */
1511
- function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):import('./index.es-48fdb288.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},
1511
+ function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):import('./index.es-04d2e63e.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},
1512
1512
  /** ====================================================================
1513
1513
  * @license
1514
1514
  * jsPDF XMP metadata plugin
@@ -2231,8 +2231,10 @@ function downloadPDFFile(filename, labels, labelPageDescription, title = "", ini
2231
2231
  if (title) {
2232
2232
  labeller.drawSupplementalText(title, 0, -0.1);
2233
2233
  }
2234
- pdfLib.addPage();
2235
- ++startingPageNum;
2234
+ if (labels.length > 0) {
2235
+ pdfLib.addPage();
2236
+ ++startingPageNum;
2237
+ }
2236
2238
  }
2237
2239
  // Add the labels to the PDF
2238
2240
  await labeller.addLabelsToDoc(labels, labelSpec, startingPageNum, title // heading
@@ -4,7 +4,7 @@
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-a4bbdb1d.js';
7
+ import { _ as _typeof_1 } from './downloadUtils-13579d93.js';
8
8
  import './index-7183ce4a.js';
9
9
  import './loadModules-cea493da.js';
10
10
  import './esri-loader-eda07632.js';