@esri/solutions-components 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/assets/t9n/map-select-tools/resources.json +1 -1
  2. package/dist/assets/t9n/map-select-tools/resources_en.json +1 -1
  3. package/dist/assets/t9n/public-notification/resources.json +5 -5
  4. package/dist/assets/t9n/public-notification/resources_en.json +5 -5
  5. package/dist/assets/t9n/refine-selection/resources.json +3 -3
  6. package/dist/assets/t9n/refine-selection/resources_en.json +3 -3
  7. package/dist/cjs/calcite-input-message_5.cjs.entry.js +1344 -18
  8. package/dist/cjs/{calcite-input-message.calcite-notice.map-select-tools.pdf-download.refine-selection-da276a1c.js → downloadUtils-99981c6b.js} +278 -1383
  9. package/dist/cjs/{index.es-176629d8.js → index.es-53f3bc97.js} +3 -13
  10. package/dist/cjs/layer-table.cjs.entry.js +5 -15
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/public-notification.cjs.entry.js +25 -10
  13. package/dist/cjs/solutions-components.cjs.js +1 -1
  14. package/dist/collection/components/layer-table/layer-table.js +4 -16
  15. package/dist/collection/components/map-search/map-search.js +1 -1
  16. package/dist/collection/components/map-select-tools/map-select-tools.js +43 -39
  17. package/dist/collection/components/pdf-download/pdf-download.js +33 -80
  18. package/dist/collection/components/public-notification/public-notification.js +26 -11
  19. package/dist/collection/components/refine-selection/refine-selection.js +1 -1
  20. package/dist/collection/utils/csvUtils.js +4 -0
  21. package/dist/collection/utils/csvUtils.ts +7 -0
  22. package/dist/collection/utils/downloadUtils.js +254 -0
  23. package/dist/collection/utils/downloadUtils.ts +344 -0
  24. package/dist/collection/utils/interfaces.ts +3 -2
  25. package/dist/collection/utils/pdfUtils.js +7 -0
  26. package/dist/collection/utils/pdfUtils.ts +13 -2
  27. package/dist/components/downloadUtils.js +2352 -0
  28. package/dist/components/index.es.js +1 -1
  29. package/dist/components/layer-table.js +5 -16
  30. package/dist/components/map-layer-picker2.js +1 -1
  31. package/dist/components/map-search.js +1 -1
  32. package/dist/components/map-select-tools2.js +45 -41
  33. package/dist/components/pdf-download2.js +14 -2126
  34. package/dist/components/public-notification.js +26 -11
  35. package/dist/components/queryUtils.js +1 -1
  36. package/dist/components/refine-selection-tools2.js +1 -1
  37. package/dist/components/refine-selection2.js +1 -1
  38. package/dist/esm/buffer-tools_6.entry.js +1 -1
  39. package/dist/esm/calcite-combobox_3.entry.js +1 -1
  40. package/dist/esm/calcite-input-message_5.entry.js +1343 -13
  41. package/dist/esm/{calcite-input-message.calcite-notice.map-select-tools.pdf-download.refine-selection-c6f63458.js → downloadUtils-4bb47330.js} +279 -1381
  42. package/dist/esm/{index.es-54a6f3a3.js → index.es-4424d2f7.js} +2 -12
  43. package/dist/esm/layer-table.entry.js +6 -16
  44. package/dist/esm/loader.js +1 -1
  45. package/dist/esm/{mapViewUtils-63e118f8.js → mapViewUtils-02696ab6.js} +1 -1
  46. package/dist/esm/public-notification.entry.js +26 -11
  47. package/dist/esm/solutions-components.js +1 -1
  48. package/dist/solutions-components/p-0aed9b0d.js +437 -0
  49. package/dist/solutions-components/p-0d3b0fa0.entry.js +17 -0
  50. package/dist/solutions-components/{p-cc2e20c8.js → p-1bfd07e3.js} +1 -1
  51. package/dist/solutions-components/{p-117174e8.entry.js → p-335fce8c.entry.js} +1 -1
  52. package/dist/solutions-components/{p-1e459361.js → p-50117f71.js} +3 -3
  53. package/dist/solutions-components/p-5e4dfbe4.entry.js +6 -0
  54. package/dist/solutions-components/{p-8a0c0935.entry.js → p-a3b60bc9.entry.js} +1 -1
  55. package/dist/solutions-components/p-ec7f7804.entry.js +6 -0
  56. package/dist/solutions-components/solutions-components.esm.js +1 -1
  57. package/dist/solutions-components/utils/csvUtils.ts +7 -0
  58. package/dist/solutions-components/utils/downloadUtils.ts +344 -0
  59. package/dist/solutions-components/utils/interfaces.ts +3 -2
  60. package/dist/solutions-components/utils/pdfUtils.ts +13 -2
  61. package/dist/types/components/map-select-tools/map-select-tools.d.ts +12 -6
  62. package/dist/types/components/pdf-download/pdf-download.d.ts +4 -20
  63. package/dist/types/components/public-notification/public-notification.d.ts +9 -1
  64. package/dist/types/components.d.ts +4 -2
  65. package/dist/types/utils/downloadUtils.d.ts +42 -0
  66. package/dist/types/utils/interfaces.d.ts +2 -3
  67. package/dist/types/utils/pdfUtils.d.ts +3 -1
  68. package/package.json +1 -1
  69. package/dist/cjs/csvUtils-3a56c6d8.js +0 -54
  70. package/dist/components/csvUtils.js +0 -52
  71. package/dist/esm/csvUtils-23b5418f.js +0 -52
  72. package/dist/solutions-components/p-3069e3b7.js +0 -21
  73. package/dist/solutions-components/p-6d28f991.entry.js +0 -6
  74. package/dist/solutions-components/p-80f5e33c.js +0 -416
  75. package/dist/solutions-components/p-8927862a.entry.js +0 -6
  76. package/dist/solutions-components/p-e69c58e5.entry.js +0 -6
@@ -3,960 +3,60 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import { r as registerInstance, h as h$1, H as Host, g as getElement, c as createEvent, a as getAssetPath } from './index-c246d90e.js';
7
- import { s as setRequestedIcon, g as getElementProp, a as getSlotted } from './dom-3bdc69ee.js';
8
- import { S as StatusIcons } from './interfaces-4ae145eb.js';
9
- import { c as connectConditionalSlotComponent, d as disconnectConditionalSlotComponent } from './conditionalSlot-d09506c4.js';
10
- import { l as loadModules } from './loadModules-649aedac.js';
11
- import { h as highlightFeatures, g as goToSelection, d as queryObjectIds, e as getQueryGeoms, q as queryFeaturesByID } from './mapViewUtils-63e118f8.js';
12
- import { E as EWorkflowType, f as ESelectionMode, g as ERefineMode, c as ESketchType } from './interfaces-d0d83efa.js';
13
- import { s as state } from './publicNotificationStore-b9daaee4.js';
14
- import { g as getLocaleComponentStrings } from './locale-4a87aff1.js';
15
- import { e as exportCSV } from './csvUtils-23b5418f.js';
16
6
  import { c as createCommonjsModule, g as getDefaultExportFromCjs } from './_commonjsHelpers-d5f9d613.js';
17
- import { a as getSelectionIds, g as getTotal } from './publicNotificationUtils-5cb5a607.js';
18
-
19
- /*!
20
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
21
- * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
22
- * v1.0.0-beta.97
23
- */
24
- var StatusIconDefaults;
25
- (function (StatusIconDefaults) {
26
- StatusIconDefaults["valid"] = "check-circle";
27
- StatusIconDefaults["invalid"] = "exclamation-mark-triangle";
28
- StatusIconDefaults["idle"] = "information";
29
- })(StatusIconDefaults || (StatusIconDefaults = {}));
30
-
31
- const inputMessageCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host([active][scale=m]),:host([active][scale=l]){--calcite-input-message-spacing-value:0.25rem}:host{visibility:hidden;box-sizing:border-box;display:flex;block-size:0px;inline-size:100%;align-items:center;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}:host([active]){visibility:visible;block-size:auto;opacity:1;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}:host([active][scale=m]),:host([active][scale=l]){-webkit-margin-before:var(--calcite-input-message-spacing-value);margin-block-start:var(--calcite-input-message-spacing-value)}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}.calcite-input-message-icon{pointer-events:none;display:inline-flex;flex-shrink:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;-webkit-margin-end:0.5rem;margin-inline-end:0.5rem}:host([status=invalid]) .calcite-input-message-icon{color:var(--calcite-ui-danger)}:host([status=warning]) .calcite-input-message-icon{color:var(--calcite-ui-warning)}:host([status=valid]) .calcite-input-message-icon{color:var(--calcite-ui-success)}:host([status=idle]) .calcite-input-message-icon{color:var(--calcite-ui-brand)}:host([status][active]){color:var(--calcite-ui-text-1)}:host([status][scale=s]){font-size:var(--calcite-font-size--3);line-height:0.75rem}:host([status][scale=m]){-webkit-margin-before:0.25rem;margin-block-start:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}:host([status][scale=l]){-webkit-margin-before:0.25rem;margin-block-start:0.25rem;font-size:var(--calcite-font-size--1);line-height:1rem}";
32
-
33
- const InputMessage = class {
34
- constructor(hostRef) {
35
- registerInstance(this, hostRef);
36
- //--------------------------------------------------------------------------
37
- //
38
- // Properties
39
- //
40
- //--------------------------------------------------------------------------
41
- /** When `true`, the component is active. */
42
- this.active = false;
43
- /** Specifies the size of the component. */
44
- this.scale = "m";
45
- /** Specifies the status of the input field, which determines message and icons. */
46
- this.status = "idle";
47
- }
48
- handleIconEl() {
49
- this.requestedIcon = setRequestedIcon(StatusIconDefaults, this.icon, this.status);
50
- }
51
- //--------------------------------------------------------------------------
52
- //
53
- // Lifecycle
54
- //
55
- //--------------------------------------------------------------------------
56
- connectedCallback() {
57
- this.status = getElementProp(this.el, "status", this.status);
58
- this.scale = getElementProp(this.el, "scale", this.scale);
59
- this.requestedIcon = setRequestedIcon(StatusIconDefaults, this.icon, this.status);
60
- }
61
- render() {
62
- const hidden = !this.active;
63
- return (h$1(Host, { "calcite-hydrated-hidden": hidden }, this.renderIcon(this.requestedIcon), h$1("slot", null)));
64
- }
65
- //--------------------------------------------------------------------------
66
- //
67
- // Private Methods
68
- //
69
- //--------------------------------------------------------------------------
70
- renderIcon(iconName) {
71
- if (iconName) {
72
- return h$1("calcite-icon", { class: "calcite-input-message-icon", icon: iconName, scale: "s" });
73
- }
74
- }
75
- get el() { return getElement(this); }
76
- static get watchers() { return {
77
- "status": ["handleIconEl"],
78
- "icon": ["handleIconEl"]
79
- }; }
80
- };
81
- InputMessage.style = inputMessageCss;
82
-
83
- /*!
84
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
85
- * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
86
- * v1.0.0-beta.97
87
- */
88
- const TEXT = {
89
- close: "Close"
90
- };
91
- const SLOTS = {
92
- title: "title",
93
- message: "message",
94
- link: "link",
95
- actionsEnd: "actions-end"
96
- };
97
- const CSS = {
98
- actionsEnd: "actions-end",
99
- close: "notice-close",
100
- container: "container",
101
- content: "notice-content",
102
- icon: "notice-icon"
103
- };
104
-
105
- const noticeCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host([scale=s]){--calcite-notice-spacing-token-small:0.5rem;--calcite-notice-spacing-token-large:0.75rem}:host([scale=s]) .container slot[name=title]::slotted(*),:host([scale=s]) .container *::slotted([slot=title]){margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=s]) .container slot[name=message]::slotted(*),:host([scale=s]) .container *::slotted([slot=message]){margin-block:0.125rem;font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) ::slotted(calcite-link){margin-block:0.125rem;font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) .notice-close{padding:0.5rem}:host([scale=m]){--calcite-notice-spacing-token-small:0.75rem;--calcite-notice-spacing-token-large:1rem}:host([scale=m]) .container slot[name=title]::slotted(*),:host([scale=m]) .container *::slotted([slot=title]){margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=m]) .container slot[name=message]::slotted(*),:host([scale=m]) .container *::slotted([slot=message]){margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) ::slotted(calcite-link){margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=l]){--calcite-notice-spacing-token-small:1rem;--calcite-notice-spacing-token-large:1.25rem}:host([scale=l]) .container slot[name=title]::slotted(*),:host([scale=l]) .container *::slotted([slot=title]){margin-block:0.125rem;font-size:var(--calcite-font-size-1);line-height:1.375}:host([scale=l]) .container slot[name=message]::slotted(*),:host([scale=l]) .container *::slotted([slot=message]){margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) ::slotted(calcite-link){margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([width=auto]){--calcite-notice-width:auto}:host([width=half]){--calcite-notice-width:50%}:host([width=full]){--calcite-notice-width:100%}:host{margin-inline:auto;display:none;max-inline-size:100%;align-items:center;inline-size:var(--calcite-notice-width)}.container{pointer-events:none;margin-block:0px;box-sizing:border-box;display:none;inline-size:100%;background-color:var(--calcite-ui-foreground-1);opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;max-block-size:0;text-align:start;-webkit-border-start:0px solid;border-inline-start:0px solid;box-shadow:0 0 0 0 transparent}.notice-close{outline-color:transparent}.notice-close:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}:host{display:flex}:host([open]) .container{pointer-events:auto;display:flex;max-block-size:100%;align-items:center;border-width:2px;opacity:1;--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.container slot[name=title]::slotted(*),.container *::slotted([slot=title]){margin:0px;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}.container slot[name=message]::slotted(*),.container *::slotted([slot=message]){margin:0px;display:inline;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2);-webkit-margin-end:var(--calcite-notice-spacing-token-small);margin-inline-end:var(--calcite-notice-spacing-token-small)}.notice-content{box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto;display:flex;min-inline-size:0px;flex-direction:column;overflow-wrap:break-word;flex:1 1 0;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:0 var(--calcite-notice-spacing-token-small)}.notice-content:first-of-type:not(:only-child){-webkit-padding-start:var(--calcite-notice-spacing-token-large);padding-inline-start:var(--calcite-notice-spacing-token-large)}.notice-content:only-of-type{padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large)}.notice-icon{display:flex;align-items:center;box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto}.notice-close{display:flex;cursor:pointer;align-items:center;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px;box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto;-webkit-appearance:none}.notice-close:hover,.notice-close:focus{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}.notice-close:active{background-color:var(--calcite-ui-foreground-3)}.actions-end{display:flex;align-self:stretch}:host([color=blue]) .container{border-color:var(--calcite-ui-brand)}:host([color=blue]) .container .notice-icon{color:var(--calcite-ui-brand)}:host([color=red]) .container{border-color:var(--calcite-ui-danger)}:host([color=red]) .container .notice-icon{color:var(--calcite-ui-danger)}:host([color=yellow]) .container{border-color:var(--calcite-ui-warning)}:host([color=yellow]) .container .notice-icon{color:var(--calcite-ui-warning)}:host([color=green]) .container{border-color:var(--calcite-ui-success)}:host([color=green]) .container .notice-icon{color:var(--calcite-ui-success)}";
106
-
107
- const Notice = class {
108
- constructor(hostRef) {
109
- registerInstance(this, hostRef);
110
- this.calciteNoticeClose = createEvent(this, "calciteNoticeClose", 6);
111
- this.calciteNoticeOpen = createEvent(this, "calciteNoticeOpen", 6);
112
- //--------------------------------------------------------------------------
113
- //
114
- // Properties
115
- //
116
- //---------------------------------------------------------------------------
117
- /**
118
- * When `true`, the component is active.
119
- *
120
- * @deprecated Use `open` instead.
121
- */
122
- this.active = false;
123
- /** When `true`, the component is visible. */
124
- this.open = false;
125
- /** The color for the component's top border and icon. */
126
- this.color = "blue";
127
- /**
128
- * When `true`, a close button is added to the component.
129
- *
130
- * @deprecated use `closable` instead.
131
- */
132
- this.dismissible = false;
133
- /** When `true`, a close button is added to the component. */
134
- this.closable = false;
135
- /**
136
- * Accessible name for the close button.
137
- *
138
- * @default "Close"
139
- */
140
- this.intlClose = TEXT.close;
141
- /** Specifies the size of the component. */
142
- this.scale = "m";
143
- /** Specifies the width of the component. */
144
- this.width = "auto";
145
- //--------------------------------------------------------------------------
146
- //
147
- // Private Methods
148
- //
149
- //--------------------------------------------------------------------------
150
- this.close = () => {
151
- this.open = false;
152
- this.calciteNoticeClose.emit();
153
- };
154
- }
155
- activeHandler(value) {
156
- this.open = value;
157
- }
158
- openHandler(value) {
159
- this.active = value;
160
- }
161
- handleDismissible(value) {
162
- this.closable = value;
163
- }
164
- handleClosable(value) {
165
- this.dismissible = value;
166
- }
167
- updateRequestedIcon() {
168
- this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
169
- }
170
- //--------------------------------------------------------------------------
171
- //
172
- // Lifecycle
173
- //
174
- //--------------------------------------------------------------------------
175
- connectedCallback() {
176
- connectConditionalSlotComponent(this);
177
- const isOpen = this.active || this.open;
178
- if (isOpen) {
179
- this.activeHandler(isOpen);
180
- this.openHandler(isOpen);
181
- }
182
- if (this.dismissible) {
183
- this.handleDismissible(this.dismissible);
184
- }
185
- if (this.closable) {
186
- this.handleClosable(this.closable);
187
- }
188
- }
189
- disconnectedCallback() {
190
- disconnectConditionalSlotComponent(this);
191
- }
192
- componentWillLoad() {
193
- this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
194
- }
195
- render() {
196
- const { el } = this;
197
- const closeButton = (h$1("button", { "aria-label": this.intlClose, class: CSS.close, onClick: this.close, ref: (el) => (this.closeButton = el) }, h$1("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : "s" })));
198
- const hasActionEnd = getSlotted(el, SLOTS.actionsEnd);
199
- return (h$1("div", { class: CSS.container }, this.requestedIcon ? (h$1("div", { class: CSS.icon }, h$1("calcite-icon", { icon: this.requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null, h$1("div", { class: CSS.content }, h$1("slot", { name: SLOTS.title }), h$1("slot", { name: SLOTS.message }), h$1("slot", { name: SLOTS.link })), hasActionEnd ? (h$1("div", { class: CSS.actionsEnd }, h$1("slot", { name: SLOTS.actionsEnd }))) : null, this.closable ? closeButton : null));
200
- }
201
- //--------------------------------------------------------------------------
202
- //
203
- // Public Methods
204
- //
205
- //--------------------------------------------------------------------------
206
- /** Sets focus on the component. */
207
- async setFocus() {
208
- const noticeLinkEl = this.el.querySelector("calcite-link");
209
- if (!this.closeButton && !noticeLinkEl) {
210
- return;
211
- }
212
- if (noticeLinkEl) {
213
- noticeLinkEl.setFocus();
214
- }
215
- else if (this.closeButton) {
216
- this.closeButton.focus();
217
- }
218
- }
219
- get el() { return getElement(this); }
220
- static get watchers() { return {
221
- "active": ["activeHandler"],
222
- "open": ["openHandler"],
223
- "dismissible": ["handleDismissible"],
224
- "closable": ["handleClosable"],
225
- "icon": ["updateRequestedIcon"],
226
- "color": ["updateRequestedIcon"]
227
- }; }
228
- };
229
- Notice.style = noticeCss;
230
-
231
- const mapSelectToolsCss = ":host{display:block}.div-visible{display:inherit}.div-visible-search{display:flex;height:44px;align-items:center;padding-bottom:0}.div-not-visible{display:none}.padding-bottom-1{padding-bottom:1rem}.search-widget{width:100% !important;border:1px solid var(--calcite-ui-border-input)}.w-100{width:100%}.w-50{width:50%}.search-distance-container{padding-top:\"1rem\" !important}.end-border{-webkit-border-end:1px solid var(--calcite-ui-border-2);border-inline-end:1px solid var(--calcite-ui-border-2)}.search-distance{display:flex;padding-top:1rem}";
7
+ import { a as getAssetPath } from './index-c246d90e.js';
8
+ import { l as loadModules } from './loadModules-649aedac.js';
9
+ import { b as queryFeaturesByID } from './mapViewUtils-02696ab6.js';
232
10
 
233
- const MapSelectTools = class {
234
- constructor(hostRef) {
235
- registerInstance(this, hostRef);
236
- this.selectionSetChange = createEvent(this, "selectionSetChange", 7);
237
- this.sketchTypeChange = createEvent(this, "sketchTypeChange", 7);
238
- this.workflowTypeChange = createEvent(this, "workflowTypeChange", 7);
239
- /**
240
- * number[]: the oids of the selected features
241
- */
242
- this._selectedIds = [];
243
- /**
244
- * string: A label to help uniquely identify the selection set
245
- */
246
- this._selectionLabel = "";
247
- /**
248
- * boolean: When false the geometries will be used for selection
249
- * When true a list of OIDs will be used
250
- * see https://github.com/Esri/solutions-components/issues/148
251
- */
252
- this._skipGeomQuery = false;
253
- this.bufferColor = [227, 139, 79, 0.8];
254
- this.bufferOutlineColor = [255, 255, 255];
255
- this.enabledLayerIds = [];
256
- this.defaultBufferDistance = undefined;
257
- this.defaultBufferUnit = undefined;
258
- this.geometries = undefined;
259
- this.isUpdate = false;
260
- this.mapView = undefined;
261
- this.searchConfiguration = undefined;
262
- this.selectionSet = undefined;
263
- this.selectLayerView = undefined;
264
- this.showBufferTools = true;
265
- this._layerSelectChecked = undefined;
266
- this._searchTerm = undefined;
267
- this._translations = undefined;
268
- this._workflowType = undefined;
269
- }
270
- //--------------------------------------------------------------------------
271
- //
272
- // Watch handlers
273
- //
274
- //--------------------------------------------------------------------------
275
- /**
276
- * Called each time the geometries prop is changed.
277
- *
278
- * @returns Promise when complete
279
- */
280
- async watchGeometriesHandler(newValue, oldValue) {
281
- if (newValue !== oldValue) {
282
- if (newValue.length > 0) {
283
- if (this._skipGeomQuery) {
284
- void highlightFeatures(this._selectedIds, this.selectLayerView, this.mapView);
285
- }
286
- else {
287
- return this._geomQuery(this.geometries);
288
- }
289
- }
290
- else if (newValue.length === 0) {
291
- return this._clearResults(true, true);
292
- }
293
- }
294
- }
295
- /**
296
- * Called each time the searchConfiguration prop is changed.
297
- *
298
- * @returns Promise when complete
299
- */
300
- async watchSearchConfigurationHandler(newValue, oldValue) {
301
- console.log("watchSearchConfigurationHandler");
302
- console.log("newValue");
303
- console.log(newValue);
304
- console.log("oldValue");
305
- console.log(oldValue);
306
- if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
307
- this._initSearchWidget();
308
- }
309
- }
310
- /**
311
- * Called each time the workflowType prop is changed and emits the workflowTypeChange event.
312
- *
313
- * @returns Promise when complete
314
- */
315
- async workflowTypeHandler(newValue, oldValue) {
316
- if (newValue !== oldValue) {
317
- this.mapView.popup.autoOpenEnabled = ["SELECT", "SKETCH", "REFINE"].indexOf(newValue) < 0;
318
- this.workflowTypeChange.emit(newValue);
319
- }
320
- }
321
- //--------------------------------------------------------------------------
322
- //
323
- // Methods (public)
324
- //
325
- //--------------------------------------------------------------------------
326
- /**
327
- * Clear any selection results
328
- *
329
- * @returns Promise when the results have been cleared
330
- */
331
- async clearSelection() {
332
- return this._clearResults();
333
- }
334
- /**
335
- * Get the new selection set
336
- *
337
- * @returns Promise with the new selection set
338
- */
339
- async getSelection() {
340
- // Allow any non whitespace
341
- if (!/\S+/gm.test(this._selectionLabel)) {
342
- this._selectionLabel = this._getSelectionBaseLabel();
343
- }
344
- const isBaseLabel = this._selectionLabel === this._getSelectionBaseLabel();
345
- return {
346
- id: this.isUpdate ? this.selectionSet.id : Date.now(),
347
- workflowType: this._workflowType,
348
- searchResult: this._searchResult,
349
- buffer: this._bufferGeometry,
350
- distance: this._bufferTools.distance,
351
- download: true,
352
- unit: this._bufferTools.unit,
353
- label: (this._selectionLabel && !isBaseLabel) ?
354
- this._selectionLabel : `${this._selectionLabel} ${this._bufferTools.distance} ${this._bufferTools.unit}`,
355
- selectedIds: this._selectedIds,
356
- layerView: this.selectLayerView,
357
- geometries: this.geometries,
358
- refineSelectLayers: this._refineTools.layerViews,
359
- skipGeomQuery: this._skipGeomQuery
360
- };
361
- }
362
- /**
363
- * Handle changes to the selection sets
364
- */
365
- labelChange(event) {
366
- this._selectionLabel = event.detail;
367
- }
368
- /**
369
- * Handle changes to the search configuration
370
- */
371
- searchConfigurationChangeChanged(event) {
372
- this.searchConfiguration = event.detail;
373
- }
374
- /**
375
- * Listen to changes in the sketch graphics
376
- *
377
- */
378
- sketchGraphicsChange(event) {
379
- this._updateSelection(EWorkflowType.SKETCH, event.detail, this._selectionLabel || this._translations.sketch, true);
380
- }
381
- /**
382
- * Listen to changes in the refine graphics
383
- *
384
- */
385
- refineSelectionGraphicsChange(event) {
386
- const graphics = event.detail.graphics;
387
- this._skipGeomQuery = event.detail.useOIDs;
388
- const oids = Array.isArray(graphics) ? graphics.map(g => g.attributes[g.layer.objectIdField]) : [];
389
- this._updateSelection(EWorkflowType.SELECT, graphics, this._selectionLabel || this._translations.select, !event.detail.useOIDs, oids);
390
- return this._highlightFeatures(oids);
391
- }
392
- //--------------------------------------------------------------------------
393
- //
394
- // Functions (lifecycle)
395
- //
396
- //--------------------------------------------------------------------------
397
- /**
398
- * StencilJS: Called once just after the component is first connected to the DOM.
399
- */
400
- async componentWillLoad() {
401
- await this._getTranslations();
402
- await this._initModules();
403
- }
404
- /**
405
- * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
406
- */
407
- async componentDidLoad() {
408
- return this._init();
409
- }
410
- /**
411
- * Renders the component.
412
- */
413
- render() {
414
- var _a, _b, _c;
415
- const searchEnabled = this._workflowType === EWorkflowType.SEARCH;
416
- const showSearchClass = searchEnabled ? " div-visible-search" : " div-not-visible";
417
- const drawEnabled = this._workflowType === EWorkflowType.SKETCH || this._workflowType === EWorkflowType.SELECT;
418
- const showBufferToolsClass = this.showBufferTools ? "search-distance" : "div-not-visible";
419
- const useSelectClass = this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
420
- const useDrawClass = !this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
421
- const showLayerChoiceClass = searchEnabled ? "div-not-visible" : "div-visible";
422
- return (h$1(Host, null, h$1("div", { class: "padding-bottom-1" }, h$1("calcite-radio-group", { class: "w-100", onCalciteRadioGroupChange: (evt) => this._workflowChange(evt) }, h$1("calcite-radio-group-item", { checked: searchEnabled, class: "w-50 end-border", value: EWorkflowType.SEARCH }, this._translations.search), h$1("calcite-radio-group-item", { checked: drawEnabled, class: "w-50", value: EWorkflowType.SKETCH }, this._translations.sketch))), h$1("div", { class: showSearchClass }, h$1("div", { class: "search-widget", ref: (el) => { this._searchElement = el; } })), h$1("div", { class: showLayerChoiceClass }, h$1("calcite-label", { layout: "inline" }, h$1("calcite-checkbox", { checked: ((_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.workflowType) === EWorkflowType.SELECT, onCalciteCheckboxChange: () => this._layerSelectChanged(), ref: (el) => this._selectFromLayerElement = el }), "Use layer features")), h$1("div", { class: useDrawClass }, h$1("map-draw-tools", { active: true, border: true, mapView: this.mapView, ref: (el) => { this._drawTools = el; } })), h$1("div", { class: useSelectClass }, h$1("refine-selection-tools", { active: true, border: true, enabledLayerIds: this.enabledLayerIds, layerView: this.selectLayerView, layerViews: this._refineSelectLayers, mapView: this.mapView, mode: ESelectionMode.ADD, ref: (el) => { this._refineTools = el; }, refineMode: ERefineMode.SUBSET })), h$1("calcite-label", { class: showBufferToolsClass }, this._translations.searchDistance, h$1("buffer-tools", { distance: ((_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.distance) || this.defaultBufferDistance, geometries: this.geometries, onBufferComplete: (evt) => this._bufferComplete(evt), ref: (el) => this._bufferTools = el, unit: ((_c = this.selectionSet) === null || _c === void 0 ? void 0 : _c.unit) || this.defaultBufferUnit })), h$1("slot", null)));
423
- }
424
- //--------------------------------------------------------------------------
425
- //
426
- // Functions (protected)
427
- //
428
- //--------------------------------------------------------------------------
429
- /**
430
- * Load esri javascript api modules
431
- *
432
- * @returns Promise resolving when function is done
433
- *
434
- * @protected
435
- */
436
- async _initModules() {
437
- const [GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await loadModules([
438
- "esri/layers/GraphicsLayer",
439
- "esri/Graphic",
440
- "esri/widgets/Search",
441
- "esri/geometry/geometryEngine",
442
- "esri/layers/FeatureLayer"
443
- ]);
444
- this.GraphicsLayer = GraphicsLayer;
445
- this.Graphic = Graphic;
446
- this.Search = Search;
447
- this._geometryEngine = geometryEngine;
448
- this.FeatureLayer = FeatureLayer;
449
- }
450
- /**
451
- * Initialize the graphics layer, selection set, and search widget
452
- *
453
- * @returns Promise when the operation has completed
454
- */
455
- async _init() {
456
- this._initGraphicsLayer();
457
- this._initSelectionSet();
458
- this._initSearchWidget();
459
- }
460
- /**
461
- * Initialize the state of the component with any stored values in a selection set
462
- *
463
- * @protected
464
- */
465
- _initSelectionSet() {
466
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
467
- if (this.selectionSet) {
468
- this._searchTerm = (_b = (_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.searchResult) === null || _b === void 0 ? void 0 : _b.name;
469
- this._workflowType = (_c = this.selectionSet) === null || _c === void 0 ? void 0 : _c.workflowType;
470
- this._searchResult = (_d = this.selectionSet) === null || _d === void 0 ? void 0 : _d.searchResult;
471
- this._refineSelectLayers = (_e = this.selectionSet) === null || _e === void 0 ? void 0 : _e.refineSelectLayers;
472
- this._selectedIds = (_f = this.selectionSet) === null || _f === void 0 ? void 0 : _f.selectedIds;
473
- this._skipGeomQuery = (_g = this.selectionSet) === null || _g === void 0 ? void 0 : _g.skipGeomQuery;
474
- this.geometries = [
475
- ...((_h = this.selectionSet) === null || _h === void 0 ? void 0 : _h.geometries) || []
476
- ];
477
- // reset selection label base
478
- this._selectionLabel = ((_j = this.selectionSet) === null || _j === void 0 ? void 0 : _j.label) || this._getSelectionBaseLabel();
479
- void goToSelection(this.selectionSet.selectedIds, this.selectionSet.layerView, this.mapView, false);
480
- }
481
- else {
482
- this._workflowType = EWorkflowType.SEARCH;
483
- }
484
- }
485
- /**
486
- * Get the default label base when the user has not provided a value
487
- *
488
- * @protected
489
- */
490
- _getSelectionBaseLabel() {
491
- var _a, _b;
492
- return this._workflowType === EWorkflowType.SKETCH ?
493
- this._translations.sketch : this._workflowType === EWorkflowType.SELECT ?
494
- this._translations.select : this._workflowType === EWorkflowType.SEARCH && this._searchResult ?
495
- (_a = this._searchResult) === null || _a === void 0 ? void 0 : _a.name : (_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.label;
496
- }
497
- /**
498
- * Initialize the search widget
499
- *
500
- * @protected
501
- */
502
- _initSearchWidget() {
503
- console.log("_initSearchWidget");
504
- console.log("this.mapView");
505
- console.log(this.mapView);
506
- console.log("this._searchElement");
507
- console.log(this._searchElement);
508
- if (this.mapView && this._searchElement) {
509
- console.log("this._getSearchConfig");
510
- const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
511
- console.log("searchConfiguration");
512
- console.log(searchConfiguration);
513
- const searchOptions = Object.assign({ view: this.mapView, container: this._searchElement, searchTerm: this._searchTerm }, searchConfiguration);
514
- this._searchWidget = new this.Search(searchOptions);
515
- this._searchWidget.on("search-clear", () => {
516
- void this._clearResults(false);
517
- });
518
- this._searchWidget.on("select-result", (searchResults) => {
519
- var _a;
520
- void this._clearResults(false);
521
- if (searchResults.result) {
522
- this._searchResult = searchResults.result;
523
- this._updateSelection(EWorkflowType.SEARCH, [searchResults.result.feature], (_a = searchResults === null || searchResults === void 0 ? void 0 : searchResults.result) === null || _a === void 0 ? void 0 : _a.name, true);
524
- }
525
- });
526
- console.log("END search widget init");
527
- }
528
- }
529
- /**
530
- * Initialize the search widget based on user defined configuration
531
- *
532
- * @param searchConfiguration search configuration defined by the user
533
- * @param view the current map view
534
- *
535
- * @protected
536
- */
537
- _getSearchConfig(searchConfiguration, view) {
538
- var _a;
539
- const sources = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources;
540
- if (sources) {
541
- sources.forEach(source => {
542
- var _a, _b, _c;
543
- const isLayerSource = source.hasOwnProperty("layer");
544
- if (isLayerSource) {
545
- const layerSource = source;
546
- const layerFromMap = ((_a = layerSource.layer) === null || _a === void 0 ? void 0 : _a.id)
547
- ? view.map.findLayerById(layerSource.layer.id)
548
- : null;
549
- if (layerFromMap) {
550
- layerSource.layer = layerFromMap;
551
- }
552
- else if ((_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url) {
553
- layerSource.layer = new this.FeatureLayer((_c = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _c === void 0 ? void 0 : _c.url);
554
- }
555
- }
556
- });
557
- }
558
- (_a = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources) === null || _a === void 0 ? void 0 : _a.forEach(source => {
559
- const isLocatorSource = source.hasOwnProperty("locator");
560
- if (isLocatorSource) {
561
- const locatorSource = source;
562
- locatorSource.url = locatorSource.url;
563
- delete locatorSource.url;
564
- }
565
- });
566
- return searchConfiguration;
567
- }
568
- /**
569
- * Initialize the graphics layer used to store any buffer grapghics
570
- *
571
- * @protected
572
- */
573
- _initGraphicsLayer() {
574
- const title = this._translations.bufferLayer;
575
- const bufferIndex = this.mapView.map.layers.findIndex((l) => l.title === title);
576
- if (bufferIndex > -1) {
577
- this._bufferGraphicsLayer = this.mapView.map.layers.getItemAt(bufferIndex);
578
- }
579
- else {
580
- this._bufferGraphicsLayer = new this.GraphicsLayer({ title });
581
- state.managedLayers.push(title);
582
- const sketchIndex = this.mapView.map.layers.findIndex((l) => l.title === this._translations.sketchLayer);
583
- if (sketchIndex > -1) {
584
- this.mapView.map.layers.add(this._bufferGraphicsLayer, sketchIndex);
585
- }
586
- else {
587
- this.mapView.map.layers.add(this._bufferGraphicsLayer);
588
- }
589
- }
590
- }
591
- /**
592
- * Store the layer select checked change
593
- *
594
- * @protected
595
- */
596
- _layerSelectChanged() {
597
- this._layerSelectChecked = this._selectFromLayerElement.checked;
598
- this.sketchTypeChange.emit(this._layerSelectChecked ? ESketchType.LAYER : ESketchType.INTERACTIVE);
599
- }
600
- /**
601
- * Store workflow type change
602
- *
603
- * @protected
604
- */
605
- _workflowChange(evt) {
606
- this._workflowType = evt.detail;
607
- }
608
- /**
609
- * Highlight the features in the map
610
- *
611
- * @protected
612
- */
613
- async _highlightFeatures(ids) {
614
- var _a;
615
- (_a = state.highlightHandle) === null || _a === void 0 ? void 0 : _a.remove();
616
- if (ids.length > 0) {
617
- state.highlightHandle = await highlightFeatures(ids, this.selectLayerView, this.mapView);
618
- }
619
- this.selectionSetChange.emit(ids.length);
620
- }
621
- /**
622
- * Query the selectLayerView based on any user drawn geometries or buffers
623
- *
624
- * @param geometries Array of geometries used for the selection of ids from the select layer view
625
- *
626
- * @returns Promise when the selection is complete and the graphics have been highlighted
627
- */
628
- async _selectFeatures(geometries) {
629
- this._selectedIds = await queryObjectIds(geometries, this.selectLayerView.layer);
630
- // Add geometries used for selecting features as graphics
631
- this._drawTools.graphics = this.geometries.map(geom => {
632
- var _a, _b, _c;
633
- const props = {
634
- "geometry": geom,
635
- "symbol": geom.type === "point" ?
636
- (_a = this._drawTools) === null || _a === void 0 ? void 0 : _a.pointSymbol : geom.type === "polyline" ?
637
- (_b = this._drawTools) === null || _b === void 0 ? void 0 : _b.polylineSymbol : geom.type === "polygon" ?
638
- (_c = this._drawTools) === null || _c === void 0 ? void 0 : _c.polygonSymbol : undefined
639
- };
640
- return new this.Graphic(props);
641
- });
642
- void this._highlightFeatures(this._selectedIds);
643
- }
644
- /**
645
- * Query the selectLayerView based on any user drawn geometries or buffers
646
- *
647
- * @param evt CustomEvent that contains the result of the buffer
648
- *
649
- * @protected
650
- */
651
- async _bufferComplete(evt) {
652
- var _a, _b;
653
- this._bufferGeometry = Array.isArray(evt.detail) ?
654
- evt.detail[0] : evt.detail;
655
- if (this._bufferGeometry) {
656
- // Create a symbol for rendering the graphic
657
- const symbol = {
658
- type: "simple-fill",
659
- color: this.bufferColor,
660
- outline: {
661
- color: this.bufferOutlineColor,
662
- width: 1
663
- }
664
- };
665
- // Add the geometry and symbol to a new graphic
666
- const polygonGraphic = new this.Graphic({
667
- geometry: this._bufferGeometry,
668
- symbol
669
- });
670
- this._bufferGraphicsLayer.removeAll();
671
- this._bufferGraphicsLayer.add(polygonGraphic);
672
- void this._selectFeatures([this._bufferGeometry]);
673
- void this.mapView.goTo(polygonGraphic.geometry.extent);
674
- }
675
- else {
676
- if (this._bufferGraphicsLayer) {
677
- this._bufferGraphicsLayer.removeAll();
678
- }
679
- if (this._skipGeomQuery || ((_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.skipGeomQuery)) {
680
- this._selectedIds = (_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.selectedIds;
681
- void this._highlightFeatures(this._selectedIds);
682
- }
683
- else {
684
- void this._geomQuery(this.geometries);
685
- }
686
- }
687
- }
688
- /**
689
- * Fetch a single geometry for each potential geometry type
690
- *
691
- * @param geometries All current selection geometries
692
- *
693
- * @protected
694
- */
695
- _geomQuery(geometries) {
696
- const queryGeoms = getQueryGeoms(geometries, this._geometryEngine);
697
- return this._selectFeatures(queryGeoms);
698
- }
699
- /**
700
- * Clear all stored values and general state for the component
701
- *
702
- * @param clearSearchWidget Optional boolean for clearing the search widget (default is true)
703
- * @param clearLabel Optional boolean for clearing the search label (default is true)
704
- *
705
- * @protected
706
- */
707
- async _clearResults(clearSearchWidget = true, clearLabel = true) {
708
- var _a, _b;
709
- this._selectedIds = [];
710
- if (clearLabel) {
711
- this._selectionLabel = "";
712
- }
713
- if (this._bufferGraphicsLayer) {
714
- this._bufferGraphicsLayer.removeAll();
715
- }
716
- if (clearSearchWidget && this._searchWidget) {
717
- this._searchWidget.clear();
718
- }
719
- (_a = state.highlightHandle) === null || _a === void 0 ? void 0 : _a.remove();
720
- // for sketch
721
- // checking for clear as it would throw off tests
722
- if ((_b = this._drawTools) === null || _b === void 0 ? void 0 : _b.clear) {
723
- void this._drawTools.clear();
724
- }
725
- this.selectionSetChange.emit(this._selectedIds.length);
726
- }
727
- /**
728
- * Fetch a single geometry for the current geometry type
729
- *
730
- * @param type worflow type
731
- * @param graphics graphics to be used for selection
732
- * @param label selection label
733
- * @param useGeoms indicates if the geometries should be used directly for selections
734
- * @param oids list of IDs to select when useGeoms is false
735
- *
736
- * @protected
737
- */
738
- _updateSelection(type, graphics, label, useGeoms, oids) {
739
- this._selectedIds = oids ? oids : this._selectedIds;
740
- // see https://github.com/Esri/solutions-components/issues/148
741
- this._skipGeomQuery = !useGeoms;
742
- this.geometries = Array.isArray(graphics) ? graphics.map(g => g.geometry) : this.geometries;
743
- this._workflowType = type;
744
- this._selectionLabel = label;
745
- }
746
- /**
747
- * Fetches the component's translations
748
- *
749
- * @protected
750
- */
751
- async _getTranslations() {
752
- const translations = await getLocaleComponentStrings(this.el);
753
- this._translations = translations[0];
11
+ /** @license
12
+ * Copyright 2022 Esri
13
+ *
14
+ * Licensed under the Apache License, Version 2.0 (the "License");
15
+ * you may not use this file except in compliance with the License.
16
+ * You may obtain a copy of the License at
17
+ *
18
+ * http://www.apache.org/licenses/LICENSE-2.0
19
+ *
20
+ * Unless required by applicable law or agreed to in writing, software
21
+ * distributed under the License is distributed on an "AS IS" BASIS,
22
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
+ * See the License for the specific language governing permissions and
24
+ * limitations under the License.
25
+ */
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
+ /**
41
+ * Download the CSV file
42
+ *
43
+ * @param outputLines Lines of output to write to file
44
+ * @param fileTitle Title (without file extension) to use for file; defaults to "export"
45
+ *
46
+ * @see {@link https://medium.com/@danny.pule/export-json-to-csv-file-using-javascript-a0b7bc5b00d2}
47
+ */
48
+ function _downloadCSVFile(outputLines, fileTitle) {
49
+ const link = document.createElement("a");
50
+ if (link.download !== undefined) {
51
+ link.href = URL.createObjectURL(new Blob(outputLines, { type: "text/csv;charset=utf-8;" }));
52
+ link.download = `${fileTitle}.csv` || "export.csv";
53
+ link.style.visibility = "hidden";
54
+ document.body.appendChild(link);
55
+ link.click();
56
+ document.body.removeChild(link);
754
57
  }
755
- get el() { return getElement(this); }
756
- static get watchers() { return {
757
- "geometries": ["watchGeometriesHandler"],
758
- "searchConfiguration": ["watchSearchConfigurationHandler"],
759
- "_workflowType": ["workflowTypeHandler"]
760
- }; }
761
- };
762
- MapSelectTools.style = mapSelectToolsCss;
763
-
764
- const labelFormats = [
765
- {
766
- descriptionPDF: {
767
- labelWidthDisplay: "2-5/8",
768
- labelHeightDisplay: "1",
769
- labelsPerPageDisplay: "30",
770
- averyPartNumber: "*60"
771
- },
772
- labelSpec: {
773
- type: "AVERY",
774
- pageProperties: {
775
- pageType: "ANSI A",
776
- leftMargin: 0.1875,
777
- rightMargin: 0.1875,
778
- topMargin: 0.5,
779
- bottomMargin: 0.5
780
- },
781
- numLabelsAcross: 3,
782
- numLabelsDown: 10,
783
- labelWidth: 2.625,
784
- labelHeight: 1,
785
- horizGapIn: 0.125,
786
- vertGapIn: 0,
787
- labelPadding: 0.1,
788
- fontSizePx: 11,
789
- maxNumLabelLines: 4
790
- }
791
- },
792
- {
793
- descriptionPDF: {
794
- labelWidthDisplay: "4",
795
- labelHeightDisplay: "1",
796
- labelsPerPageDisplay: "20",
797
- averyPartNumber: "*61"
798
- },
799
- labelSpec: {
800
- type: "AVERY",
801
- pageProperties: {
802
- pageType: "ANSI A",
803
- leftMargin: 0.15625,
804
- rightMargin: 0.15625,
805
- topMargin: 0.47637821,
806
- bottomMargin: 0.5
807
- },
808
- numLabelsAcross: 2,
809
- numLabelsDown: 10,
810
- labelWidth: 4,
811
- labelHeight: 1.0025,
812
- horizGapIn: 0.1875,
813
- vertGapIn: 0,
814
- labelPadding: 0.1,
815
- fontSizePx: 11,
816
- maxNumLabelLines: 4
817
- }
818
- },
819
- {
820
- descriptionPDF: {
821
- labelWidthDisplay: "4",
822
- labelHeightDisplay: "1-1/3",
823
- labelsPerPageDisplay: "14",
824
- averyPartNumber: "*62"
825
- },
826
- labelSpec: {
827
- type: "AVERY",
828
- pageProperties: {
829
- pageType: "ANSI A",
830
- leftMargin: 0.15625,
831
- rightMargin: 0.15625,
832
- topMargin: 0.81889808,
833
- bottomMargin: 0.83464612
834
- },
835
- numLabelsAcross: 2,
836
- numLabelsDown: 7,
837
- labelWidth: 4,
838
- labelHeight: 1.3352,
839
- horizGapIn: 0.1875,
840
- vertGapIn: 0,
841
- labelPadding: 0.1,
842
- fontSizePx: 11,
843
- maxNumLabelLines: 6
844
- }
845
- },
846
- {
847
- descriptionPDF: {
848
- labelWidthDisplay: "4",
849
- labelHeightDisplay: "2",
850
- labelsPerPageDisplay: "10",
851
- averyPartNumber: "*63"
852
- },
853
- labelSpec: {
854
- type: "AVERY",
855
- pageProperties: {
856
- pageType: "ANSI A",
857
- leftMargin: 0.15625,
858
- rightMargin: 0.15625,
859
- topMargin: 0.5,
860
- bottomMargin: 0.5
861
- },
862
- numLabelsAcross: 2,
863
- numLabelsDown: 5,
864
- labelWidth: 4,
865
- labelHeight: 2,
866
- horizGapIn: 0.1875,
867
- vertGapIn: 0,
868
- labelPadding: 0.1,
869
- fontSizePx: 12,
870
- maxNumLabelLines: 10
871
- }
872
- },
873
- {
874
- descriptionPDF: {
875
- labelWidthDisplay: "4",
876
- labelHeightDisplay: "3-1/3",
877
- labelsPerPageDisplay: "6",
878
- averyPartNumber: "*64"
879
- },
880
- labelSpec: {
881
- type: "AVERY",
882
- pageProperties: {
883
- pageType: "ANSI A",
884
- leftMargin: 0.15625,
885
- rightMargin: 0.15625,
886
- topMargin: 0.4724412,
887
- bottomMargin: 0.50000027
888
- },
889
- numLabelsAcross: 2,
890
- numLabelsDown: 3,
891
- labelWidth: 4,
892
- labelHeight: 3.342,
893
- horizGapIn: 0.1875,
894
- vertGapIn: 0,
895
- labelPadding: 0.1,
896
- fontSizePx: 14,
897
- maxNumLabelLines: 12
898
- }
899
- },
900
- {
901
- descriptionPDF: {
902
- labelWidthDisplay: "1-3/4",
903
- labelHeightDisplay: "1/2",
904
- labelsPerPageDisplay: "80",
905
- averyPartNumber: "*67"
906
- },
907
- labelSpec: {
908
- type: "AVERY",
909
- pageProperties: {
910
- pageType: "ANSI A",
911
- leftMargin: 0.307086375,
912
- rightMargin: 0.307086375,
913
- topMargin: 0.4724412,
914
- bottomMargin: 0.49606326
915
- },
916
- numLabelsAcross: 4,
917
- numLabelsDown: 20,
918
- labelWidth: 1.75,
919
- labelHeight: 0.50155,
920
- horizGapIn: 0.29527575,
921
- vertGapIn: 0,
922
- labelPadding: 0.1,
923
- fontSizePx: 8,
924
- maxNumLabelLines: 3
925
- }
926
- },
927
- {
928
- descriptionPDF: {
929
- labelWidthDisplay: "1-3/4",
930
- labelHeightDisplay: "2/3",
931
- labelsPerPageDisplay: "60",
932
- averyPartNumber: "*95"
933
- },
934
- labelSpec: {
935
- type: "AVERY",
936
- pageProperties: {
937
- pageType: "ANSI A",
938
- leftMargin: 0.28936983,
939
- rightMargin: 0.28936983,
940
- topMargin: 0.53937037,
941
- bottomMargin: 0.5511814
942
- },
943
- numLabelsAcross: 4,
944
- numLabelsDown: 15,
945
- labelWidth: 1.75,
946
- labelHeight: 0.6605,
947
- horizGapIn: 0.30708678,
948
- vertGapIn: 0,
949
- labelPadding: 0.1,
950
- fontSizePx: 8,
951
- maxNumLabelLines: 4
952
- }
953
- }
954
- ];
955
-
956
- const pdfUtils = /*#__PURE__*/Object.freeze({
957
- __proto__: null,
958
- 'default': labelFormats
959
- });
58
+ }
59
+ //#endregion
960
60
 
961
61
  var _typeof_1 = createCommonjsModule(function (module) {
962
62
  function _typeof(obj) {
@@ -1980,7 +1080,7 @@ function(t){var e=function(t){for(var e=t.length,r=new Uint8Array(e),n=0;n<e;n++
1980
1080
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1981
1081
  * ====================================================================
1982
1082
  */
1983
- function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):import('./index.es-54a6f3a3.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},
1083
+ function(t){function e(){return (n.canvg?Promise.resolve(n.canvg):import('./index.es-4424d2f7.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},
1984
1084
  /** ====================================================================
1985
1085
  * @license
1986
1086
  * jsPDF XMP metadata plugin
@@ -2971,6 +2071,8 @@ class PDFLabels {
2971
2071
  * See the License for the specific language governing permissions and
2972
2072
  * limitations under the License.
2973
2073
  */
2074
+ //#endregion
2075
+ //#region Public functions
2974
2076
  /**
2975
2077
  * Exports a PDF of labels.
2976
2078
  *
@@ -2980,6 +2082,8 @@ class PDFLabels {
2980
2082
  function exportPDF(labels, labelPageDescription) {
2981
2083
  _downloadPDFFile(labels, labelPageDescription, `notify-${Date.now().toString()}`);
2982
2084
  }
2085
+ //#endregion
2086
+ //#region Private functions
2983
2087
  /**
2984
2088
  * Downloads the PDF file.
2985
2089
  *
@@ -3000,159 +2104,210 @@ function _downloadPDFFile(labels, labelPageDescription, fileTitle) {
3000
2104
  pdfLib.save();
3001
2105
  });
3002
2106
  });
3003
- }
3004
-
3005
- const pdfDownloadCss = ":host{display:block}";
2107
+ }
2108
+ //#endregion
3006
2109
 
3007
- const PdfDownload = class {
3008
- constructor(hostRef) {
3009
- registerInstance(this, hostRef);
3010
- this.disabled = false;
3011
- this.layerView = undefined;
3012
- this._translations = undefined;
3013
- }
3014
- //--------------------------------------------------------------------------
3015
- //
3016
- // Watch handlers
3017
- //
3018
- //--------------------------------------------------------------------------
3019
- //--------------------------------------------------------------------------
3020
- //
3021
- // Methods (public)
3022
- //
3023
- //--------------------------------------------------------------------------
3024
- /**
3025
- * Downloads csv of mailing labels for the provided list of ids
3026
- *
3027
- * @param ids List of ids to download
3028
- * @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
3029
- * @param addColumnTitle Indicates if column headings should be included in output
3030
- * @returns Promise resolving when function is done
3031
- */
3032
- async downloadCSV(ids, removeDuplicates, addColumnTitle = true) {
3033
- const labels = await this._prepareLabels(ids, removeDuplicates, addColumnTitle);
3034
- return exportCSV(labels);
3035
- }
3036
- /**
3037
- * Downloads pdf of mailing labels for the provided list of ids
3038
- *
3039
- * @param ids List of ids to download
3040
- * @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
3041
- * @returns Promise resolving when function is done
3042
- */
3043
- async downloadPDF(ids, removeDuplicates) {
3044
- const labels = await this._prepareLabels(ids, removeDuplicates);
3045
- const labelPageDescription = this._labelInfoElement.selectedOption.value;
3046
- return exportPDF(labels, labelPageDescription);
3047
- }
3048
- //--------------------------------------------------------------------------
3049
- //
3050
- // Events (public)
3051
- //
3052
- //--------------------------------------------------------------------------
3053
- //--------------------------------------------------------------------------
3054
- //
3055
- // Functions (lifecycle)
3056
- //
3057
- //--------------------------------------------------------------------------
3058
- /**
3059
- * StencilJS: Called once just after the component is first connected to the DOM.
3060
- */
3061
- async componentWillLoad() {
3062
- await this._getTranslations();
3063
- await this._initModules();
3064
- }
3065
- /**
3066
- * Renders the component.
3067
- */
3068
- render() {
3069
- return (h$1(Host, null, h$1("calcite-select", { disabled: this.disabled, label: "", ref: (el) => { this._labelInfoElement = el; } }, this._renderItems())));
3070
- }
3071
- //--------------------------------------------------------------------------
3072
- //
3073
- // Functions (protected)
3074
- //
3075
- //--------------------------------------------------------------------------
3076
- /**
3077
- * Load esri javascript api modules
3078
- *
3079
- * @returns Promise resolving when function is done
3080
- *
3081
- * @protected
3082
- */
3083
- async _initModules() {
3084
- const [intl] = await loadModules([
3085
- "esri/intl"
3086
- ]);
3087
- this._intl = intl;
3088
- }
3089
- /**
3090
- * Converts the text of a custom popup into a multiline label specification; conversion splits text into
3091
- * lines on <br>s, and removes HTML tags. It does not handle Arcade and related records.
3092
- *
3093
- * @param popupInfo Layer's popupInfo structure containing description, fieldInfos, and expressionInfos, e.g.,
3094
- * "<div style='text-align: left;'>{NAME}<br />{STREET}<br />{CITY}, {STATE} {ZIP} <br /></div>"
3095
- * @return Label spec
3096
- */
3097
- _convertPopupToLabelSpec(popupInfo) {
3098
- // Replace <br>, <br/> with |
3099
- popupInfo = popupInfo.replace(/<br\s*\/?>/gi, "|");
3100
- // Remove remaining HTML tags, replace 0xA0 that popup uses for spaces, replace some char representations,
3101
- // and split the label back into individual lines
3102
- let labelSpec = popupInfo
3103
- .replace(/<[\s.]*[^<>]*\/?>/gi, "")
3104
- .replace(/\xA0/gi, " ")
3105
- .replace(/&lt;/gi, "<")
3106
- .replace(/&gt;/gi, ">")
3107
- .replace(/&nbsp;/gi, " ")
3108
- .split("|");
3109
- // Trim lines and remove empties
3110
- labelSpec = labelSpec.map(line => line.trim()).filter(line => line.length > 0);
3111
- return labelSpec;
3112
- }
3113
- ;
3114
- /**
3115
- * Gets the formatted pdf export size text
3116
- *
3117
- * @param labelInfo current user selected label info
3118
- *
3119
- * @returns the pdf label as a string
3120
- * @protected
3121
- */
3122
- _getLabelSizeText(labelInfo) {
3123
- const lNum = labelInfo.descriptionPDF.labelsPerPageDisplay;
3124
- const lSize = `${labelInfo.descriptionPDF.labelWidthDisplay} x ${labelInfo.descriptionPDF.labelHeightDisplay}`;
3125
- return this._translations.pdfLabel.replace("{{n}}", lNum).replace("{{labelSize}}", lSize);
3126
- }
3127
- /**
3128
- * Fetches the component's translations
3129
- *
3130
- * @protected
3131
- */
3132
- async _getTranslations() {
3133
- const translations = await getLocaleComponentStrings(this.el);
3134
- this._translations = translations[0];
3135
- }
3136
- /**
3137
- * Creates labels from items.
3138
- *
3139
- * @param ids List of ids to download
3140
- * @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
3141
- * @param includeHeaderNames Add the label format at the front of the list of generated labels
3142
- * @returns Promise resolving when function is done
3143
- */
3144
- async _prepareLabels(ids, removeDuplicates, includeHeaderNames = false) {
3145
- // Get the attributes of the features to export
3146
- const featureSet = await queryFeaturesByID(ids, this.layerView.layer);
3147
- const featuresAttrs = featureSet.features.map(f => f.attributes);
2110
+ /** @license
2111
+ * Copyright 2022 Esri
2112
+ *
2113
+ * Licensed under the Apache License, Version 2.0 (the "License");
2114
+ * you may not use this file except in compliance with the License.
2115
+ * You may obtain a copy of the License at
2116
+ *
2117
+ * http://www.apache.org/licenses/LICENSE-2.0
2118
+ *
2119
+ * Unless required by applicable law or agreed to in writing, software
2120
+ * distributed under the License is distributed on an "AS IS" BASIS,
2121
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2122
+ * See the License for the specific language governing permissions and
2123
+ * limitations under the License.
2124
+ */
2125
+ //#endregion
2126
+ //#region Public functions
2127
+ /**
2128
+ * Downloads csv of mailing labels for the provided list of ids
2129
+ *
2130
+ * @param selectionSetNames Names of the selection sets used to provide ids
2131
+ * @param layer Layer providing features and attributes for download
2132
+ * @param ids List of ids to download
2133
+ * @param formatUsingLayerPopup When true, the layer's popup is used to choose attributes for each column; when false,
2134
+ * all attributes are exported
2135
+ * @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
2136
+ * @param addColumnTitle Indicates if column headings should be included in output
2137
+ * @returns Promise resolving when function is done
2138
+ */
2139
+ async function downloadCSV(selectionSetNames, layer, ids, formatUsingLayerPopup, removeDuplicates = false, addColumnTitle = false) {
2140
+ console.log("downloadCSV using selectionSetNames " + JSON.stringify(selectionSetNames)); //???
2141
+ const labels = await _prepareLabels(layer, ids, removeDuplicates, formatUsingLayerPopup, addColumnTitle);
2142
+ exportCSV(labels);
2143
+ return Promise.resolve();
2144
+ }
2145
+ /**
2146
+ * Downloads csv of mailing labels for the provided list of ids
2147
+ *
2148
+ * @param selectionSetNames Names of the selection sets used to provide ids
2149
+ * @param layer Layer providing features and attributes for download
2150
+ * @param ids List of ids to download
2151
+ * @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
2152
+ * @param labelPageDescription Provides PDF page layout info
2153
+ * @returns Promise resolving when function is done
2154
+ */
2155
+ async function downloadPDF(selectionSetNames, layer, ids, removeDuplicates, labelPageDescription) {
2156
+ console.log("downloadPDF using selectionSetNames " + JSON.stringify(selectionSetNames)); //???
2157
+ const labels = await _prepareLabels(layer, ids, removeDuplicates);
2158
+ exportPDF(labels, labelPageDescription);
2159
+ return Promise.resolve();
2160
+ }
2161
+ //#endregion
2162
+ //#region Private functions
2163
+ /**
2164
+ * Converts a set of fieldInfos into template lines.
2165
+ *
2166
+ * @param fieldInfos Layer's fieldInfos structure
2167
+ * @param bypassFieldVisiblity Indicates if the configured fieldInfo visibility property should be ignored
2168
+ * @return Label spec
2169
+ */
2170
+ function _convertPopupFieldsToLabelSpec(fieldInfos, bypassFieldVisiblity = false) {
2171
+ const labelSpec = [];
2172
+ // Every visible attribute is used
2173
+ fieldInfos.forEach(fieldInfo => {
2174
+ if (fieldInfo.visible || bypassFieldVisiblity) {
2175
+ labelSpec.push(`{${fieldInfo.fieldName}}`);
2176
+ }
2177
+ });
2178
+ return labelSpec;
2179
+ }
2180
+ /**
2181
+ * Converts the text of a custom popup into a multiline label specification; conversion splits text into
2182
+ * lines on <br>s, and removes HTML tags. It does not handle Arcade and related records.
2183
+ *
2184
+ * @param popupInfo Layer's popupInfo structure containing description, fieldInfos, and expressionInfos, e.g.,
2185
+ * "<div style='text-align: left;'>{NAME}<br />{STREET}<br />{CITY}, {STATE} {ZIP} <br /></div>"
2186
+ * @return Label spec
2187
+ */
2188
+ function _convertPopupTextToLabelSpec(popupInfo) {
2189
+ // Replace <br>, <br/> with |
2190
+ popupInfo = popupInfo.replace(/<br\s*\/?>/gi, "|");
2191
+ // Remove remaining HTML tags, replace 0xA0 that popup uses for spaces, replace some char representations,
2192
+ // and split the label back into individual lines
2193
+ let labelSpec = popupInfo
2194
+ .replace(/<[\s.]*[^<>]*\/?>/gi, "")
2195
+ .replace(/\xA0/gi, " ")
2196
+ .replace(/&lt;/gi, "<")
2197
+ .replace(/&gt;/gi, ">")
2198
+ .replace(/&nbsp;/gi, " ")
2199
+ .split("|");
2200
+ // Trim lines and remove empties
2201
+ labelSpec = labelSpec.map(line => line.trim()).filter(line => line.length > 0);
2202
+ return labelSpec;
2203
+ }
2204
+ /**
2205
+ * Extracts Arcade expressions from the lines of a label format and creates an Arcade executor for each
2206
+ * referenced expression name.
2207
+ *
2208
+ * @param labelFormat Label to examine
2209
+ * @param layer Layer from which to fetch features
2210
+ * @return Promise resolving to a set of executors keyed using the expression name
2211
+ */
2212
+ async function _createArcadeExecutors(labelFormat, layer) {
2213
+ const arcadeExecutors = {};
2214
+ // Are any Arcade expressions in the layer?
2215
+ if (!Array.isArray(layer.popupTemplate.expressionInfos) || layer.popupTemplate.expressionInfos.length === 0) {
2216
+ return Promise.resolve(arcadeExecutors);
2217
+ }
2218
+ // Are there any Arcade expressions in the label format?
2219
+ const arcadeExpressionRegExp = /\{expression\/\w+\}/g;
2220
+ const arcadeExpressionsMatches = labelFormat.join("|").match(arcadeExpressionRegExp);
2221
+ if (!arcadeExpressionsMatches) {
2222
+ return Promise.resolve(arcadeExecutors);
2223
+ }
2224
+ // Generate an Arcade executor for each match
2225
+ const [arcade] = await loadModules(["esri/arcade"]);
2226
+ const labelingProfile = arcade.createArcadeProfile("popup");
2227
+ const createArcadeExecutorPromises = {};
2228
+ arcadeExpressionsMatches.forEach((match) => {
2229
+ const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
2230
+ (layer.popupTemplate.expressionInfos || []).forEach(expressionInfo => {
2231
+ if (expressionInfo.name === expressionName) {
2232
+ createArcadeExecutorPromises[expressionName] =
2233
+ arcade.createArcadeExecutor(expressionInfo.expression, labelingProfile);
2234
+ }
2235
+ });
2236
+ });
2237
+ const promises = Object.values(createArcadeExecutorPromises);
2238
+ return Promise.all(promises)
2239
+ .then(executors => {
2240
+ const expressionNames = Object.keys(createArcadeExecutorPromises);
2241
+ for (let i = 0; i < expressionNames.length; ++i) {
2242
+ arcadeExecutors[expressionNames[i]] = executors[i].valueOf();
2243
+ }
2244
+ return arcadeExecutors;
2245
+ });
2246
+ }
2247
+ /**
2248
+ * Creates labels from items.
2249
+ *
2250
+ * @param layer Layer from which to fetch features
2251
+ * @param ids List of ids to download
2252
+ * @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
2253
+ * @param formatUsingLayerPopup When true, the layer's popup is used to choose attributes for each column; when false,
2254
+ * all attributes are exported
2255
+ * @param includeHeaderNames Add the label format at the front of the list of generated labels
2256
+ * @returns Promise resolving when function is done
2257
+ */
2258
+ async function _prepareLabels(layer, ids, removeDuplicates = true, formatUsingLayerPopup = true, includeHeaderNames = false) {
2259
+ var _a, _b, _c, _d;
2260
+ const [intl] = await loadModules(["esri/intl"]);
2261
+ // Get the features to export
2262
+ const featureSet = await queryFeaturesByID(ids, layer);
2263
+ // Get the label formatting, if any
2264
+ let labelFormat;
2265
+ let arcadeExecutors = {};
2266
+ if (layer.popupEnabled) {
3148
2267
  // What data fields are used in the labels?
3149
2268
  // Example labelFormat: ['{NAME}', '{STREET}', '{CITY}, {STATE} {ZIP}']
3150
- const labelFormat = this._convertPopupToLabelSpec(this.layerView.layer.popupTemplate.content[0].text);
2269
+ if (formatUsingLayerPopup && ((_b = (_a = layer.popupTemplate) === null || _a === void 0 ? void 0 : _a.content[0]) === null || _b === void 0 ? void 0 : _b.type) === "fields") {
2270
+ labelFormat = _convertPopupFieldsToLabelSpec(layer.popupTemplate.fieldInfos);
2271
+ // If popup is configured with "no attribute information", then no fields will visible
2272
+ if (labelFormat.length === 0) {
2273
+ // Can we use the popup title?
2274
+ // eslint-disable-next-line unicorn/prefer-ternary
2275
+ if (typeof layer.popupTemplate.title === "string") {
2276
+ labelFormat = [layer.popupTemplate.title];
2277
+ // Otherwise revert to using attributes
2278
+ }
2279
+ else {
2280
+ labelFormat = _convertPopupFieldsToLabelSpec(layer.popupTemplate.fieldInfos, true);
2281
+ }
2282
+ }
2283
+ }
2284
+ else if (formatUsingLayerPopup && ((_d = (_c = layer.popupTemplate) === null || _c === void 0 ? void 0 : _c.content[0]) === null || _d === void 0 ? void 0 : _d.type) === "text") {
2285
+ labelFormat = _convertPopupTextToLabelSpec(layer.popupTemplate.content[0].text);
2286
+ // Do we need any Arcade executors?
2287
+ arcadeExecutors = await _createArcadeExecutors(labelFormat, layer);
2288
+ }
2289
+ }
2290
+ // Apply the label format
2291
+ let labels;
2292
+ // eslint-disable-next-line unicorn/prefer-ternary
2293
+ if (labelFormat) {
2294
+ const arcadeExpressionRegExp = /\{expression\/\w+\}/g;
3151
2295
  // Convert attributes into an array of labels
3152
- let labels = featuresAttrs.map(featureAttributes => {
2296
+ labels = featureSet.features.map(feature => {
3153
2297
  const label = [];
3154
2298
  labelFormat.forEach(labelLineTemplate => {
3155
- const labelLine = this._intl.substitute(labelLineTemplate, featureAttributes).trim();
2299
+ let labelLine = labelLineTemplate;
2300
+ // Replace Arcade expressions
2301
+ const arcadeExpressionsMatches = labelLine.match(arcadeExpressionRegExp);
2302
+ if (arcadeExpressionsMatches) {
2303
+ arcadeExpressionsMatches.forEach((match) => {
2304
+ const expressionName = match.substring(match.indexOf("/") + 1, match.length - 1);
2305
+ const replacement = arcadeExecutors[expressionName].execute({ "$feature": feature });
2306
+ labelLine = labelLine.replace(match, replacement);
2307
+ });
2308
+ }
2309
+ // Replace fields; must be done after Arcade check because `substitute` will discard Arcade expressions!
2310
+ labelLine = intl.substitute(labelLine, feature.attributes).trim();
3156
2311
  if (labelLine.length > 0) {
3157
2312
  label.push(labelLine);
3158
2313
  }
@@ -3161,294 +2316,37 @@ const PdfDownload = class {
3161
2316
  })
3162
2317
  // Remove empty labels
3163
2318
  .filter(label => label.length > 0);
3164
- // Remove duplicates
3165
- if (removeDuplicates) {
3166
- const labelsAsStrings = labels.map(label => JSON.stringify(label));
3167
- const uniqueLabels = new Set(labelsAsStrings);
3168
- labels = Array.from(uniqueLabels, labelString => JSON.parse(labelString));
3169
- }
3170
- // Add header names
3171
- if (includeHeaderNames) {
3172
- const headerNames = labelFormat.map(labelFormatLine => labelFormatLine.replace(/\{/g, "").replace(/\}/g, ""));
3173
- labels.unshift(headerNames);
3174
- }
3175
- return Promise.resolve(labels);
3176
2319
  }
3177
- /**
3178
- * Renders the pdf export size options
3179
- *
3180
- * @returns Node array of size options
3181
- *
3182
- * @protected
3183
- */
3184
- _renderItems() {
3185
- const s = pdfUtils;
3186
- const sortedPdfIndo = (s.default || s).sort((a, b) => {
3187
- const _a = parseInt(a.descriptionPDF.labelsPerPageDisplay, 10);
3188
- const _b = parseInt(b.descriptionPDF.labelsPerPageDisplay, 10);
3189
- return _a < _b ? -1 : _a > _b ? 1 : 0;
3190
- });
3191
- return sortedPdfIndo.map((l) => {
3192
- return (h$1("calcite-option", { value: l }, this._getLabelSizeText(l)));
2320
+ else {
2321
+ // Export all attributes
2322
+ labels = featureSet.features.map(feature => {
2323
+ return Object.values(feature.attributes).map(attribute => `${attribute}`);
3193
2324
  });
3194
2325
  }
3195
- get el() { return getElement(this); }
3196
- };
3197
- PdfDownload.style = pdfDownloadCss;
3198
-
3199
- const refineSelectionCss = ":host{display:block}";
3200
-
3201
- const RefineSelection = class {
3202
- constructor(hostRef) {
3203
- registerInstance(this, hostRef);
3204
- this.selectionSetsChanged = createEvent(this, "selectionSetsChanged", 7);
3205
- //--------------------------------------------------------------------------
3206
- //
3207
- // Properties (protected)
3208
- //
3209
- //--------------------------------------------------------------------------
3210
- /**
3211
- * boolean: Indicates if any new graphics should be added or removed
3212
- */
3213
- this._addEnabled = true;
3214
- this.addresseeLayer = undefined;
3215
- this.enabledLayerIds = [];
3216
- this.mapView = undefined;
3217
- this.selectionSets = [];
3218
- this.GraphicsLayer = undefined;
3219
- this.SketchViewModel = undefined;
3220
- this._translations = undefined;
2326
+ // Remove duplicates
2327
+ if (removeDuplicates) {
2328
+ const labelsAsStrings = labels.map(label => JSON.stringify(label));
2329
+ const uniqueLabels = new Set(labelsAsStrings);
2330
+ labels = Array.from(uniqueLabels, labelString => JSON.parse(labelString));
3221
2331
  }
3222
- //--------------------------------------------------------------------------
3223
- //
3224
- // Watch handlers
3225
- //
3226
- //--------------------------------------------------------------------------
3227
- /**
3228
- * Called each time the addresseeLayer is changed.
3229
- * Add a new clean refine set for the new addressee layer.
3230
- */
3231
- addresseeLayerWatchHandler() {
3232
- const selectionSets = this.selectionSets.filter(ss => ss.workflowType !== EWorkflowType.REFINE);
3233
- this.selectionSets = this._initRefineSelectionSet(selectionSets);
3234
- }
3235
- /**
3236
- * Handles changes to refine selection ids.
3237
- *
3238
- */
3239
- refineSelectionIdsChange(event) {
3240
- var _a, _b;
3241
- const addIds = ((_a = event.detail) === null || _a === void 0 ? void 0 : _a.addIds) || [];
3242
- const removeIds = ((_b = event.detail) === null || _b === void 0 ? void 0 : _b.removeIds) || [];
3243
- this._updateSelectionSets(removeIds);
3244
- this._updateRefineSelectionSet(addIds, removeIds);
3245
- }
3246
- //--------------------------------------------------------------------------
3247
- //
3248
- // Functions (lifecycle)
3249
- //
3250
- //--------------------------------------------------------------------------
3251
- /**
3252
- * StencilJS: Called once just after the component is first connected to the DOM.
3253
- */
3254
- async componentWillLoad() {
3255
- await this._getTranslations();
3256
- const refineSet = this._getRefineSelectionSet(this.selectionSets);
3257
- if (!refineSet) {
3258
- this.selectionSets = this._initRefineSelectionSet(this.selectionSets);
2332
+ // Add header names
2333
+ if (includeHeaderNames) {
2334
+ let headerNames = [];
2335
+ if (labelFormat) {
2336
+ headerNames = labelFormat.map(labelFormatLine => labelFormatLine.replace(/\{/g, "").replace(/\}/g, ""));
3259
2337
  }
3260
- }
3261
- /**
3262
- * Renders the component.
3263
- */
3264
- render() {
3265
- return (h$1(Host, null, h$1("div", { class: "padding-1" }, h$1("div", null, h$1("calcite-radio-group", { class: "w-100", onCalciteRadioGroupChange: (evt) => this._modeChanged(evt) }, h$1("calcite-radio-group-item", { checked: this._addEnabled, class: "w-50", onClick: () => this._setSelectionMode(ESelectionMode.ADD), value: ESelectionMode.ADD }, this._translations.add), h$1("calcite-radio-group-item", { checked: !this._addEnabled, class: "w-50", onClick: () => this._setSelectionMode(ESelectionMode.REMOVE), value: ESelectionMode.REMOVE }, this._translations.remove)), h$1("refine-selection-tools", { border: true, enabledLayerIds: this.enabledLayerIds, ids: getSelectionIds(this.selectionSets), layerViews: [this.addresseeLayer], mapView: this.mapView, mode: this._addEnabled ? ESelectionMode.ADD : ESelectionMode.REMOVE, ref: (el) => { this._refineTools = el; }, refineMode: ERefineMode.ALL, refineSelectionSet: this._getRefineSelectionSet(this.selectionSets), useLayerPicker: false })), h$1("br", null), (h$1("calcite-list", { class: "list-border" }, this._getRefineSelectionSetList())))));
3266
- }
3267
- //--------------------------------------------------------------------------
3268
- //
3269
- // Functions (protected)
3270
- //
3271
- //--------------------------------------------------------------------------
3272
- /**
3273
- * Store the Add/Remove mode
3274
- *
3275
- * @protected
3276
- */
3277
- _modeChanged(evt) {
3278
- this._addEnabled = evt.detail === ESelectionMode.ADD;
3279
- }
3280
- /**
3281
- * Set the refine tools selection mode
3282
- *
3283
- * @protected
3284
- */
3285
- _setSelectionMode(mode) {
3286
- this._refineTools.mode = mode;
3287
- }
3288
- /**
3289
- * Create a list to show the number added/removed/total unique selected
3290
- *
3291
- * @returns the list node
3292
- * @protected
3293
- */
3294
- _getRefineSelectionSetList() {
3295
- const total = getTotal(this.selectionSets);
3296
- const refineSet = this._getRefineSelectionSet(this.selectionSets);
3297
- const numAdded = (refineSet === null || refineSet === void 0 ? void 0 : refineSet.refineIds.addIds.length) || 0;
3298
- const numRemoved = (refineSet === null || refineSet === void 0 ? void 0 : refineSet.refineIds.removeIds.length) || 0;
3299
- return [(h$1("calcite-list-item", { label: this._translations.featuresAdded.replace("{{n}}", numAdded.toString()) })), (h$1("calcite-list-item", { label: this._translations.featuresRemoved.replace("{{n}}", numRemoved.toString()) })), (h$1("calcite-list-item", { label: this._translations.totalSelected.replace("{{n}}", total.toString()) }))];
3300
- }
3301
- /**
3302
- * Fetch the refine selection set
3303
- *
3304
- * @returns the refine selection set
3305
- * @protected
3306
- */
3307
- _getRefineSelectionSet(selectionSets) {
3308
- let refineSelectionSet;
3309
- selectionSets.some(ss => {
3310
- if (ss.workflowType === EWorkflowType.REFINE) {
3311
- refineSelectionSet = ss;
3312
- return true;
3313
- }
3314
- });
3315
- return refineSelectionSet;
3316
- }
3317
- /**
3318
- * Remove ids from existing selection sets.
3319
- * Remove any selection sets than have no selected ids
3320
- * This can update any selection set not just the refine set.
3321
- * We do not do something similar for adds as we will only ever add from refine tools to the single REFINE selection set.
3322
- *
3323
- * @param removeIds the ids to remove
3324
- *
3325
- * @protected
3326
- */
3327
- _updateSelectionSets(removeIds) {
3328
- if (removeIds.length > 0) {
3329
- this.selectionSets = this.selectionSets.reduce((prev, cur) => {
3330
- cur.selectedIds = cur.selectedIds.filter(id => removeIds.indexOf(id) < 0);
3331
- if (cur.selectedIds.length > 0 || cur.workflowType === EWorkflowType.REFINE) {
3332
- prev.push(cur);
2338
+ else {
2339
+ const featuresAttrs = featureSet.features[0].attributes;
2340
+ Object.keys(featuresAttrs).forEach(k => {
2341
+ if (featuresAttrs[0].hasOwnProperty(k)) {
2342
+ headerNames.push(k);
3333
2343
  }
3334
- return prev;
3335
- }, []);
3336
- this.selectionSetsChanged.emit(this.selectionSets);
3337
- }
3338
- }
3339
- /**
3340
- * Update the refine selection set with any adds or removes
3341
- *
3342
- * @param addIds any ids to add
3343
- * @param removeIds any ids to remove
3344
- *
3345
- * @returns Promise resolving when function is done
3346
- * @protected
3347
- */
3348
- _updateRefineSelectionSet(addIds, removeIds) {
3349
- const selectionSet = this._getRefineSelectionSet(this.selectionSets);
3350
- this._updateRefineIds(selectionSet, addIds, removeIds);
3351
- this.selectionSetsChanged.emit(this.selectionSets);
3352
- }
3353
- /**
3354
- * Update the ids stored for the refine selection set
3355
- *
3356
- * @param selectionSet the refine selection set
3357
- * @param addIds any ids to add
3358
- * @param removeIds any ids to remove
3359
- *
3360
- * @returns updated selection sets
3361
- * @protected
3362
- */
3363
- _updateRefineIds(selectionSet, addIds, removeIds) {
3364
- // remove ids if they exist in the current add or remove list
3365
- selectionSet.refineIds.addIds = selectionSet.refineIds.addIds.filter(id => removeIds.indexOf(id) < 0);
3366
- selectionSet.refineIds.removeIds = selectionSet.refineIds.removeIds.filter(id => addIds.indexOf(id) < 0);
3367
- const _addIds = [...new Set(selectionSet.refineIds.addIds.concat(addIds))];
3368
- const _removeIds = [...new Set(selectionSet.refineIds.removeIds.concat(removeIds))];
3369
- selectionSet.refineIds = {
3370
- addIds: _addIds.filter(id => _removeIds.indexOf(id) < 0),
3371
- removeIds: _removeIds.filter(id => _addIds.indexOf(id) < 0)
3372
- };
3373
- selectionSet.selectedIds = selectionSet.refineIds.addIds.length > 0 ?
3374
- [...new Set(selectionSet.selectedIds.concat(selectionSet.refineIds.addIds))] :
3375
- selectionSet.selectedIds.filter(id => selectionSet.refineIds.removeIds.indexOf(id) < 0);
3376
- return this.selectionSets.map(ss => {
3377
- return ss.workflowType === EWorkflowType.REFINE ? selectionSet : ss;
3378
- });
3379
- }
3380
- /**
3381
- * Add a new refine selection set
3382
- *
3383
- * @returns updated selection sets
3384
- * @protected
3385
- */
3386
- _initRefineSelectionSet(selectionSets) {
3387
- return [
3388
- ...selectionSets,
3389
- ({
3390
- buffer: undefined,
3391
- distance: 0,
3392
- download: true,
3393
- geometries: [],
3394
- id: Date.now(),
3395
- label: "Refine",
3396
- layerView: this.addresseeLayer,
3397
- refineSelectLayers: [],
3398
- searchResult: undefined,
3399
- selectedIds: [],
3400
- unit: "feet",
3401
- workflowType: EWorkflowType.REFINE,
3402
- refineIds: {
3403
- addIds: [],
3404
- removeIds: []
3405
- },
3406
- redoStack: [],
3407
- undoStack: []
3408
- })
3409
- ];
3410
- }
3411
- /**
3412
- * Fetches the component's translations
3413
- *
3414
- * @protected
3415
- */
3416
- async _getTranslations() {
3417
- const translations = await getLocaleComponentStrings(this.el);
3418
- this._translations = translations[0];
3419
- }
3420
- /** Provides access to protected methods for unit testing.
3421
- *
3422
- * @param methodName Name of protected method to run
3423
- * @param arg1 First argument to forward to method, e.g., for "_modeChanged", `ESelectionMode`
3424
- * @returns
3425
- */
3426
- _testAccess(methodName, arg1) {
3427
- switch (methodName) {
3428
- case "_modeChanged":
3429
- return this._modeChanged(arg1);
3430
- case "_setSelectionMode":
3431
- return this._setSelectionMode(arg1);
3432
- // case "_getRefineSelectionSetList":
3433
- // return this._getRefineSelectionSetList();
3434
- // case "_getRefineSelectionSet":
3435
- // return this._getRefineSelectionSet(arg1);
3436
- // case "_updateSelectionSets":
3437
- // return this._updateSelectionSets(arg1);
3438
- // case "_updateRefineSelectionSet":
3439
- // return this._updateRefineSelectionSet(arg1, arg2);
3440
- // case "_updateRefineIds":
3441
- // return this._updateRefineIds(arg1, arg2, arg3);
3442
- // case "_addRefineSelectionSet":
3443
- // return this._addRefineSelectionSet(arg1, arg2);
2344
+ });
3444
2345
  }
3445
- return null;
2346
+ labels.unshift(headerNames);
3446
2347
  }
3447
- get el() { return getElement(this); }
3448
- static get watchers() { return {
3449
- "addresseeLayer": ["addresseeLayerWatchHandler"]
3450
- }; }
3451
- };
3452
- RefineSelection.style = refineSelectionCss;
2348
+ return Promise.resolve(labels);
2349
+ }
2350
+ //#endregion
3453
2351
 
3454
- export { InputMessage as I, MapSelectTools as M, Notice as N, PdfDownload as P, RefineSelection as R, _typeof_1 as _ };
2352
+ export { _typeof_1 as _, downloadPDF as a, downloadCSV as d };