@esri/solutions-components 0.3.9 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. package/dist/assets/t9n/public-notification/resources.json +0 -2
  2. package/dist/assets/t9n/public-notification/resources_en.json +0 -2
  3. package/dist/cjs/buffer-tools_6.cjs.entry.js +5 -2
  4. package/dist/cjs/calcite-input-message_5.cjs.entry.js +1342 -18
  5. package/dist/cjs/{calcite-input-message.calcite-notice.map-select-tools.pdf-download.refine-selection-cd8ad61e.js → downloadUtils-27dbd8b9.js} +205 -1337
  6. package/dist/cjs/{index.es-e89ba2a1.js → index.es-40d341ed.js} +3 -13
  7. package/dist/cjs/layer-table.cjs.entry.js +5 -15
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/public-notification.cjs.entry.js +23 -2
  10. package/dist/cjs/solutions-components.cjs.js +1 -1
  11. package/dist/collection/components/layer-table/layer-table.js +4 -16
  12. package/dist/collection/components/map-search/map-search.js +1 -1
  13. package/dist/collection/components/map-select-tools/map-select-tools.js +73 -17
  14. package/dist/collection/components/pdf-download/pdf-download.js +9 -76
  15. package/dist/collection/components/public-notification/public-notification.js +45 -3
  16. package/dist/collection/components/refine-selection/refine-selection.js +1 -1
  17. package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +13 -5
  18. package/dist/collection/demos/buffer-tools.html +1 -1
  19. package/dist/collection/utils/csvUtils.js +4 -0
  20. package/dist/collection/utils/csvUtils.ts +7 -0
  21. package/dist/collection/utils/downloadUtils.js +181 -0
  22. package/dist/collection/utils/downloadUtils.ts +235 -0
  23. package/dist/collection/utils/interfaces.ts +8 -1
  24. package/dist/collection/utils/pdfUtils.js +7 -0
  25. package/dist/collection/utils/pdfUtils.ts +13 -2
  26. package/dist/components/downloadUtils.js +2279 -0
  27. package/dist/components/index.es.js +1 -1
  28. package/dist/components/layer-table.js +5 -16
  29. package/dist/components/map-layer-picker2.js +1 -1
  30. package/dist/components/map-search.js +1 -1
  31. package/dist/components/map-select-tools2.js +69 -19
  32. package/dist/components/pdf-download2.js +10 -2124
  33. package/dist/components/public-notification.js +24 -3
  34. package/dist/components/queryUtils.js +1 -1
  35. package/dist/components/refine-selection-tools2.js +6 -3
  36. package/dist/components/refine-selection2.js +1 -1
  37. package/dist/esm/buffer-tools_6.entry.js +6 -3
  38. package/dist/esm/calcite-combobox_3.entry.js +1 -1
  39. package/dist/esm/calcite-input-message_5.entry.js +1341 -13
  40. package/dist/esm/{calcite-input-message.calcite-notice.map-select-tools.pdf-download.refine-selection-ddd74bd6.js → downloadUtils-76e38a94.js} +206 -1335
  41. package/dist/esm/{index.es-8edafdb2.js → index.es-489f4f08.js} +2 -12
  42. package/dist/esm/layer-table.entry.js +6 -16
  43. package/dist/esm/loader.js +1 -1
  44. package/dist/esm/{mapViewUtils-63e118f8.js → mapViewUtils-02696ab6.js} +1 -1
  45. package/dist/esm/public-notification.entry.js +24 -3
  46. package/dist/esm/solutions-components.js +1 -1
  47. package/dist/solutions-components/demos/buffer-tools.html +1 -1
  48. package/dist/solutions-components/{p-cc2e20c8.js → p-1bfd07e3.js} +1 -1
  49. package/dist/solutions-components/{p-117174e8.entry.js → p-335fce8c.entry.js} +1 -1
  50. package/dist/solutions-components/p-4ef94c6b.entry.js +6 -0
  51. package/dist/solutions-components/p-5d27b47d.entry.js +17 -0
  52. package/dist/solutions-components/p-92cb569a.entry.js +6 -0
  53. package/dist/solutions-components/{p-2a96314a.entry.js → p-a3b60bc9.entry.js} +2 -2
  54. package/dist/solutions-components/{p-98884f44.js → p-bff8aa4e.js} +3 -3
  55. package/dist/solutions-components/p-caa7e7a7.js +437 -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 +235 -0
  59. package/dist/solutions-components/utils/interfaces.ts +8 -1
  60. package/dist/solutions-components/utils/pdfUtils.ts +13 -2
  61. package/dist/types/components/json-editor/assets/monaco-editor/monaco.d.ts +8262 -0
  62. package/dist/types/components/map-select-tools/map-select-tools.d.ts +19 -1
  63. package/dist/types/components/pdf-download/pdf-download.d.ts +0 -18
  64. package/dist/types/components/public-notification/public-notification.d.ts +10 -0
  65. package/dist/types/components/refine-selection-tools/refine-selection-tools.d.ts +2 -2
  66. package/dist/types/components.d.ts +6 -2
  67. package/dist/types/preact.d.ts +2 -1
  68. package/dist/types/utils/downloadUtils.d.ts +40 -0
  69. package/dist/types/utils/interfaces.d.ts +6 -2
  70. package/dist/types/utils/pdfUtils.d.ts +3 -1
  71. package/package.json +1 -1
  72. package/dist/cjs/csvUtils-3a56c6d8.js +0 -54
  73. package/dist/components/csvUtils.js +0 -52
  74. package/dist/esm/csvUtils-23b5418f.js +0 -52
  75. package/dist/solutions-components/p-15f9b0a0.entry.js +0 -6
  76. package/dist/solutions-components/p-238db156.js +0 -416
  77. package/dist/solutions-components/p-3069e3b7.js +0 -21
  78. package/dist/solutions-components/p-6d28f991.entry.js +0 -6
  79. package/dist/solutions-components/p-c5341977.entry.js +0 -6
@@ -3,20 +3,1348 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- export { I as calcite_input_message, N as calcite_notice, M as map_select_tools, P as pdf_download, R as refine_selection } from './calcite-input-message.calcite-notice.map-select-tools.pdf-download.refine-selection-ddd74bd6.js';
7
- import './index-c246d90e.js';
8
- import './dom-3bdc69ee.js';
6
+ import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } 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 { g as goToSelection, h as highlightFeatures, d as queryObjectIds, e as getQueryGeoms } from './mapViewUtils-02696ab6.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 { d as downloadCSV, a as downloadPDF } from './downloadUtils-76e38a94.js';
16
+ import { a as getSelectionIds, g as getTotal } from './publicNotificationUtils-5cb5a607.js';
9
17
  import './resources-436ae282.js';
10
18
  import './guid-15fce7c0.js';
11
- import './interfaces-4ae145eb.js';
12
- import './conditionalSlot-d09506c4.js';
13
19
  import './observers-31601001.js';
14
- import './loadModules-649aedac.js';
15
- import './locale-4a87aff1.js';
16
- import './_commonjsHelpers-d5f9d613.js';
17
- import './mapViewUtils-63e118f8.js';
18
- import './interfaces-d0d83efa.js';
19
- import './publicNotificationStore-b9daaee4.js';
20
20
  import './index-ac7f66eb.js';
21
- import './csvUtils-23b5418f.js';
22
- import './publicNotificationUtils-5cb5a607.js';
21
+ import './_commonjsHelpers-d5f9d613.js';
22
+
23
+ /*!
24
+ * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
25
+ * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
26
+ * v1.0.0-beta.97
27
+ */
28
+ var StatusIconDefaults;
29
+ (function (StatusIconDefaults) {
30
+ StatusIconDefaults["valid"] = "check-circle";
31
+ StatusIconDefaults["invalid"] = "exclamation-mark-triangle";
32
+ StatusIconDefaults["idle"] = "information";
33
+ })(StatusIconDefaults || (StatusIconDefaults = {}));
34
+
35
+ 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}";
36
+
37
+ const InputMessage = class {
38
+ constructor(hostRef) {
39
+ registerInstance(this, hostRef);
40
+ //--------------------------------------------------------------------------
41
+ //
42
+ // Properties
43
+ //
44
+ //--------------------------------------------------------------------------
45
+ /** When `true`, the component is active. */
46
+ this.active = false;
47
+ /** Specifies the size of the component. */
48
+ this.scale = "m";
49
+ /** Specifies the status of the input field, which determines message and icons. */
50
+ this.status = "idle";
51
+ }
52
+ handleIconEl() {
53
+ this.requestedIcon = setRequestedIcon(StatusIconDefaults, this.icon, this.status);
54
+ }
55
+ //--------------------------------------------------------------------------
56
+ //
57
+ // Lifecycle
58
+ //
59
+ //--------------------------------------------------------------------------
60
+ connectedCallback() {
61
+ this.status = getElementProp(this.el, "status", this.status);
62
+ this.scale = getElementProp(this.el, "scale", this.scale);
63
+ this.requestedIcon = setRequestedIcon(StatusIconDefaults, this.icon, this.status);
64
+ }
65
+ render() {
66
+ const hidden = !this.active;
67
+ return (h(Host, { "calcite-hydrated-hidden": hidden }, this.renderIcon(this.requestedIcon), h("slot", null)));
68
+ }
69
+ //--------------------------------------------------------------------------
70
+ //
71
+ // Private Methods
72
+ //
73
+ //--------------------------------------------------------------------------
74
+ renderIcon(iconName) {
75
+ if (iconName) {
76
+ return h("calcite-icon", { class: "calcite-input-message-icon", icon: iconName, scale: "s" });
77
+ }
78
+ }
79
+ get el() { return getElement(this); }
80
+ static get watchers() { return {
81
+ "status": ["handleIconEl"],
82
+ "icon": ["handleIconEl"]
83
+ }; }
84
+ };
85
+ InputMessage.style = inputMessageCss;
86
+
87
+ /*!
88
+ * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
89
+ * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
90
+ * v1.0.0-beta.97
91
+ */
92
+ const TEXT = {
93
+ close: "Close"
94
+ };
95
+ const SLOTS = {
96
+ title: "title",
97
+ message: "message",
98
+ link: "link",
99
+ actionsEnd: "actions-end"
100
+ };
101
+ const CSS = {
102
+ actionsEnd: "actions-end",
103
+ close: "notice-close",
104
+ container: "container",
105
+ content: "notice-content",
106
+ icon: "notice-icon"
107
+ };
108
+
109
+ 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)}";
110
+
111
+ const Notice = class {
112
+ constructor(hostRef) {
113
+ registerInstance(this, hostRef);
114
+ this.calciteNoticeClose = createEvent(this, "calciteNoticeClose", 6);
115
+ this.calciteNoticeOpen = createEvent(this, "calciteNoticeOpen", 6);
116
+ //--------------------------------------------------------------------------
117
+ //
118
+ // Properties
119
+ //
120
+ //---------------------------------------------------------------------------
121
+ /**
122
+ * When `true`, the component is active.
123
+ *
124
+ * @deprecated Use `open` instead.
125
+ */
126
+ this.active = false;
127
+ /** When `true`, the component is visible. */
128
+ this.open = false;
129
+ /** The color for the component's top border and icon. */
130
+ this.color = "blue";
131
+ /**
132
+ * When `true`, a close button is added to the component.
133
+ *
134
+ * @deprecated use `closable` instead.
135
+ */
136
+ this.dismissible = false;
137
+ /** When `true`, a close button is added to the component. */
138
+ this.closable = false;
139
+ /**
140
+ * Accessible name for the close button.
141
+ *
142
+ * @default "Close"
143
+ */
144
+ this.intlClose = TEXT.close;
145
+ /** Specifies the size of the component. */
146
+ this.scale = "m";
147
+ /** Specifies the width of the component. */
148
+ this.width = "auto";
149
+ //--------------------------------------------------------------------------
150
+ //
151
+ // Private Methods
152
+ //
153
+ //--------------------------------------------------------------------------
154
+ this.close = () => {
155
+ this.open = false;
156
+ this.calciteNoticeClose.emit();
157
+ };
158
+ }
159
+ activeHandler(value) {
160
+ this.open = value;
161
+ }
162
+ openHandler(value) {
163
+ this.active = value;
164
+ }
165
+ handleDismissible(value) {
166
+ this.closable = value;
167
+ }
168
+ handleClosable(value) {
169
+ this.dismissible = value;
170
+ }
171
+ updateRequestedIcon() {
172
+ this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
173
+ }
174
+ //--------------------------------------------------------------------------
175
+ //
176
+ // Lifecycle
177
+ //
178
+ //--------------------------------------------------------------------------
179
+ connectedCallback() {
180
+ connectConditionalSlotComponent(this);
181
+ const isOpen = this.active || this.open;
182
+ if (isOpen) {
183
+ this.activeHandler(isOpen);
184
+ this.openHandler(isOpen);
185
+ }
186
+ if (this.dismissible) {
187
+ this.handleDismissible(this.dismissible);
188
+ }
189
+ if (this.closable) {
190
+ this.handleClosable(this.closable);
191
+ }
192
+ }
193
+ disconnectedCallback() {
194
+ disconnectConditionalSlotComponent(this);
195
+ }
196
+ componentWillLoad() {
197
+ this.requestedIcon = setRequestedIcon(StatusIcons, this.icon, this.color);
198
+ }
199
+ render() {
200
+ const { el } = this;
201
+ const closeButton = (h("button", { "aria-label": this.intlClose, class: CSS.close, onClick: this.close, ref: (el) => (this.closeButton = el) }, h("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : "s" })));
202
+ const hasActionEnd = getSlotted(el, SLOTS.actionsEnd);
203
+ return (h("div", { class: CSS.container }, this.requestedIcon ? (h("div", { class: CSS.icon }, h("calcite-icon", { icon: this.requestedIcon, scale: this.scale === "l" ? "m" : "s" }))) : null, h("div", { class: CSS.content }, h("slot", { name: SLOTS.title }), h("slot", { name: SLOTS.message }), h("slot", { name: SLOTS.link })), hasActionEnd ? (h("div", { class: CSS.actionsEnd }, h("slot", { name: SLOTS.actionsEnd }))) : null, this.closable ? closeButton : null));
204
+ }
205
+ //--------------------------------------------------------------------------
206
+ //
207
+ // Public Methods
208
+ //
209
+ //--------------------------------------------------------------------------
210
+ /** Sets focus on the component. */
211
+ async setFocus() {
212
+ const noticeLinkEl = this.el.querySelector("calcite-link");
213
+ if (!this.closeButton && !noticeLinkEl) {
214
+ return;
215
+ }
216
+ if (noticeLinkEl) {
217
+ noticeLinkEl.setFocus();
218
+ }
219
+ else if (this.closeButton) {
220
+ this.closeButton.focus();
221
+ }
222
+ }
223
+ get el() { return getElement(this); }
224
+ static get watchers() { return {
225
+ "active": ["activeHandler"],
226
+ "open": ["openHandler"],
227
+ "dismissible": ["handleDismissible"],
228
+ "closable": ["handleClosable"],
229
+ "icon": ["updateRequestedIcon"],
230
+ "color": ["updateRequestedIcon"]
231
+ }; }
232
+ };
233
+ Notice.style = noticeCss;
234
+
235
+ 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}";
236
+
237
+ const MapSelectTools = class {
238
+ constructor(hostRef) {
239
+ registerInstance(this, hostRef);
240
+ this.selectionSetChange = createEvent(this, "selectionSetChange", 7);
241
+ this.sketchTypeChange = createEvent(this, "sketchTypeChange", 7);
242
+ this.workflowTypeChange = createEvent(this, "workflowTypeChange", 7);
243
+ /**
244
+ * number[]: the oids of the selected features
245
+ */
246
+ this._selectedIds = [];
247
+ /**
248
+ * string: A label to help uniquely identify the selection set
249
+ */
250
+ this._selectionLabel = "";
251
+ this.bufferColor = [227, 139, 79, 0.8];
252
+ this.bufferOutlineColor = [255, 255, 255];
253
+ this.enabledLayerIds = [];
254
+ this.defaultBufferDistance = undefined;
255
+ this.defaultBufferUnit = undefined;
256
+ this.geometries = undefined;
257
+ this.isUpdate = false;
258
+ this.mapView = undefined;
259
+ this.searchConfiguration = undefined;
260
+ this.selectionSet = undefined;
261
+ this.selectLayerView = undefined;
262
+ this.showBufferTools = true;
263
+ this._layerSelectChecked = undefined;
264
+ this._searchTerm = undefined;
265
+ this._translations = undefined;
266
+ this._workflowType = undefined;
267
+ }
268
+ //--------------------------------------------------------------------------
269
+ //
270
+ // Watch handlers
271
+ //
272
+ //--------------------------------------------------------------------------
273
+ /**
274
+ * Called each time the geometries prop is changed.
275
+ *
276
+ * @returns Promise when complete
277
+ */
278
+ async watchGeometriesHandler(newValue, oldValue) {
279
+ if (newValue !== oldValue) {
280
+ if (newValue.length > 0) {
281
+ return this._highlightWithOIDsOrGeoms();
282
+ }
283
+ else if (newValue.length === 0) {
284
+ return this._clearResults(true, true);
285
+ }
286
+ }
287
+ }
288
+ /**
289
+ * Called each time the searchConfiguration prop is changed.
290
+ *
291
+ * @returns Promise when complete
292
+ */
293
+ async watchSearchConfigurationHandler(newValue, oldValue) {
294
+ console.log("watchSearchConfigurationHandler");
295
+ console.log("newValue");
296
+ console.log(newValue);
297
+ console.log("oldValue");
298
+ console.log(oldValue);
299
+ if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
300
+ this._initSearchWidget();
301
+ }
302
+ }
303
+ /**
304
+ * Called each time the workflowType prop is changed and emits the workflowTypeChange event.
305
+ *
306
+ * @returns Promise when complete
307
+ */
308
+ async workflowTypeHandler(newValue, oldValue) {
309
+ if (newValue !== oldValue) {
310
+ this.mapView.popup.autoOpenEnabled = ["SELECT", "SKETCH", "REFINE", "SEARCH"].indexOf(newValue) < 0;
311
+ this.workflowTypeChange.emit(newValue);
312
+ }
313
+ }
314
+ //--------------------------------------------------------------------------
315
+ //
316
+ // Methods (public)
317
+ //
318
+ //--------------------------------------------------------------------------
319
+ /**
320
+ * Clear any selection results
321
+ *
322
+ * @returns Promise when the results have been cleared
323
+ */
324
+ async clearSelection() {
325
+ return this._clearResults();
326
+ }
327
+ /**
328
+ * Get the new selection set
329
+ *
330
+ * @returns Promise with the new selection set
331
+ */
332
+ async getSelection() {
333
+ // Allow any non whitespace
334
+ if (!/\S+/gm.test(this._selectionLabel)) {
335
+ this._selectionLabel = this._getSelectionBaseLabel();
336
+ }
337
+ const isBaseLabel = this._selectionLabel === this._getSelectionBaseLabel();
338
+ return {
339
+ id: this.isUpdate ? this.selectionSet.id : Date.now(),
340
+ workflowType: this._workflowType,
341
+ searchResult: this._searchResult,
342
+ buffer: this._bufferGeometry,
343
+ distance: this._bufferTools.distance,
344
+ download: true,
345
+ unit: this._bufferTools.unit,
346
+ label: (this._selectionLabel && !isBaseLabel) ?
347
+ this._selectionLabel : `${this._selectionLabel} ${this._bufferTools.distance} ${this._bufferTools.unit}`,
348
+ selectedIds: this._selectedIds,
349
+ layerView: this.selectLayerView,
350
+ geometries: this.geometries,
351
+ refineSelectLayers: this._refineTools.layerViews,
352
+ skipGeomOIDs: this._skipGeomOIDs
353
+ };
354
+ }
355
+ /**
356
+ * Handle changes to the selection sets
357
+ */
358
+ labelChange(event) {
359
+ this._selectionLabel = event.detail;
360
+ }
361
+ /**
362
+ * Handle changes to the search configuration
363
+ */
364
+ searchConfigurationChangeChanged(event) {
365
+ console.log("searchConfigurationChange listener");
366
+ this.searchConfiguration = event.detail;
367
+ }
368
+ /**
369
+ * Listen to changes in the sketch graphics
370
+ *
371
+ */
372
+ sketchGraphicsChange(event) {
373
+ this._updateSelection(EWorkflowType.SKETCH, event.detail, this._selectionLabel || this._translations.sketch, false);
374
+ }
375
+ /**
376
+ * Listen to changes in the refine graphics
377
+ *
378
+ */
379
+ refineSelectionGraphicsChange(event) {
380
+ const graphics = event.detail.graphics;
381
+ const oids = Array.isArray(graphics) ? graphics.map(g => g.attributes[g.layer.objectIdField]) : [];
382
+ this._updateSelection(EWorkflowType.SELECT, graphics, this._selectionLabel || this._translations.select, event.detail.useOIDs, oids);
383
+ return this._highlightFeatures(oids);
384
+ }
385
+ //--------------------------------------------------------------------------
386
+ //
387
+ // Functions (lifecycle)
388
+ //
389
+ //--------------------------------------------------------------------------
390
+ /**
391
+ * StencilJS: Called once just after the component is first connected to the DOM.
392
+ */
393
+ async componentWillLoad() {
394
+ await this._getTranslations();
395
+ await this._initModules();
396
+ }
397
+ /**
398
+ * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
399
+ */
400
+ async componentDidLoad() {
401
+ return this._init();
402
+ }
403
+ /**
404
+ * Renders the component.
405
+ */
406
+ render() {
407
+ var _a, _b;
408
+ const searchEnabled = this._workflowType === EWorkflowType.SEARCH;
409
+ const showSearchClass = searchEnabled ? " div-visible-search" : " div-not-visible";
410
+ const drawEnabled = this._workflowType === EWorkflowType.SKETCH || this._workflowType === EWorkflowType.SELECT;
411
+ const showBufferToolsClass = this.showBufferTools ? "search-distance" : "div-not-visible";
412
+ const useSelectClass = this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
413
+ const useDrawClass = !this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
414
+ const showLayerChoiceClass = searchEnabled ? "div-not-visible" : "div-visible";
415
+ return (h(Host, null, h("div", { class: "padding-bottom-1" }, h("calcite-radio-group", { class: "w-100", onCalciteRadioGroupChange: (evt) => this._workflowChange(evt) }, h("calcite-radio-group-item", { checked: searchEnabled, class: "w-50 end-border", value: EWorkflowType.SEARCH }, this._translations.search), h("calcite-radio-group-item", { checked: drawEnabled, class: "w-50", value: EWorkflowType.SKETCH }, this._translations.sketch))), h("div", { class: showSearchClass }, h("div", { class: "search-widget", ref: (el) => { this._searchElement = el; } })), h("div", { class: showLayerChoiceClass }, h("calcite-label", { layout: "inline" }, h("calcite-checkbox", { checked: this._layerSelectChecked, onCalciteCheckboxChange: () => this._layerSelectChanged(), ref: (el) => this._selectFromLayerElement = el }), "Use layer features")), h("div", { class: useDrawClass }, h("map-draw-tools", { active: true, border: true, mapView: this.mapView, ref: (el) => { this._drawTools = el; } })), h("div", { class: useSelectClass }, h("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("calcite-label", { class: showBufferToolsClass }, this._translations.searchDistance, h("buffer-tools", { distance: ((_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.distance) || this.defaultBufferDistance, geometries: this.geometries, onBufferComplete: (evt) => this._bufferComplete(evt), ref: (el) => this._bufferTools = el, unit: ((_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.unit) || this.defaultBufferUnit })), h("slot", null)));
416
+ }
417
+ //--------------------------------------------------------------------------
418
+ //
419
+ // Functions (protected)
420
+ //
421
+ //--------------------------------------------------------------------------
422
+ /**
423
+ * Load esri javascript api modules
424
+ *
425
+ * @returns Promise resolving when function is done
426
+ *
427
+ * @protected
428
+ */
429
+ async _initModules() {
430
+ const [GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await loadModules([
431
+ "esri/layers/GraphicsLayer",
432
+ "esri/Graphic",
433
+ "esri/widgets/Search",
434
+ "esri/geometry/geometryEngine",
435
+ "esri/layers/FeatureLayer"
436
+ ]);
437
+ this.GraphicsLayer = GraphicsLayer;
438
+ this.Graphic = Graphic;
439
+ this.Search = Search;
440
+ this._geometryEngine = geometryEngine;
441
+ this.FeatureLayer = FeatureLayer;
442
+ }
443
+ /**
444
+ * Initialize the graphics layer, selection set, and search widget
445
+ *
446
+ * @returns Promise when the operation has completed
447
+ */
448
+ async _init() {
449
+ this._initGraphicsLayer();
450
+ this._initSelectionSet();
451
+ this._initSearchWidget();
452
+ }
453
+ /**
454
+ * Initialize the state of the component with any stored values in a selection set
455
+ *
456
+ * @protected
457
+ */
458
+ _initSelectionSet() {
459
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
460
+ if (this.selectionSet) {
461
+ this._searchTerm = (_b = (_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.searchResult) === null || _b === void 0 ? void 0 : _b.name;
462
+ this._workflowType = (_c = this.selectionSet) === null || _c === void 0 ? void 0 : _c.workflowType;
463
+ this._searchResult = (_d = this.selectionSet) === null || _d === void 0 ? void 0 : _d.searchResult;
464
+ this._refineSelectLayers = (_e = this.selectionSet) === null || _e === void 0 ? void 0 : _e.refineSelectLayers;
465
+ this._selectedIds = (_f = this.selectionSet) === null || _f === void 0 ? void 0 : _f.selectedIds;
466
+ this._skipGeomOIDs = (_g = this.selectionSet) === null || _g === void 0 ? void 0 : _g.skipGeomOIDs;
467
+ this._layerSelectChecked = ((_h = this.selectionSet) === null || _h === void 0 ? void 0 : _h.workflowType) === EWorkflowType.SELECT;
468
+ this.geometries = [
469
+ ...((_j = this.selectionSet) === null || _j === void 0 ? void 0 : _j.geometries) || []
470
+ ];
471
+ // reset selection label base
472
+ this._selectionLabel = ((_k = this.selectionSet) === null || _k === void 0 ? void 0 : _k.label) || this._getSelectionBaseLabel();
473
+ void goToSelection(this.selectionSet.selectedIds, this.selectionSet.layerView, this.mapView, false);
474
+ }
475
+ else {
476
+ this._workflowType = EWorkflowType.SEARCH;
477
+ this.mapView.popup.autoOpenEnabled = false;
478
+ }
479
+ }
480
+ /**
481
+ * Get the default label base when the user has not provided a value
482
+ *
483
+ * @protected
484
+ */
485
+ _getSelectionBaseLabel() {
486
+ var _a, _b;
487
+ return this._workflowType === EWorkflowType.SKETCH ?
488
+ this._translations.sketch : this._workflowType === EWorkflowType.SELECT ?
489
+ this._translations.select : this._workflowType === EWorkflowType.SEARCH && this._searchResult ?
490
+ (_a = this._searchResult) === null || _a === void 0 ? void 0 : _a.name : (_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.label;
491
+ }
492
+ /**
493
+ * Initialize the search widget
494
+ *
495
+ * @protected
496
+ */
497
+ _initSearchWidget() {
498
+ console.log("_initSearchWidget");
499
+ console.log("this.mapView");
500
+ console.log(this.mapView);
501
+ console.log("this._searchElement");
502
+ console.log(this._searchElement);
503
+ if (this.mapView && this._searchElement) {
504
+ console.log("this._getSearchConfig");
505
+ const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
506
+ console.log("searchConfiguration");
507
+ console.log(searchConfiguration);
508
+ const searchOptions = Object.assign({ view: this.mapView, container: this._searchElement, searchTerm: this._searchTerm }, searchConfiguration);
509
+ this._searchWidget = new this.Search(searchOptions);
510
+ this._searchWidget.popupEnabled = false;
511
+ this._searchWidget.on("search-clear", () => {
512
+ void this._clearResults(false);
513
+ });
514
+ this._searchWidget.on("select-result", (searchResults) => {
515
+ var _a, _b;
516
+ void this._clearResults(false);
517
+ if (searchResults.result) {
518
+ this._searchResult = searchResults.result;
519
+ const useOIDs = ((_a = searchResults.source) === null || _a === void 0 ? void 0 : _a.layer.id) === this.selectLayerView.layer.id;
520
+ const oids = useOIDs ? [searchResults.result.feature.getObjectId()] : undefined;
521
+ this._updateSelection(EWorkflowType.SEARCH, [searchResults.result.feature], (_b = searchResults === null || searchResults === void 0 ? void 0 : searchResults.result) === null || _b === void 0 ? void 0 : _b.name, useOIDs, oids);
522
+ }
523
+ });
524
+ console.log("END search widget init");
525
+ }
526
+ }
527
+ /**
528
+ * Initialize the search widget based on user defined configuration
529
+ *
530
+ * @param searchConfiguration search configuration defined by the user
531
+ * @param view the current map view
532
+ *
533
+ * @protected
534
+ */
535
+ _getSearchConfig(searchConfiguration, view) {
536
+ var _a;
537
+ const sources = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources;
538
+ if (sources) {
539
+ sources.forEach(source => {
540
+ var _a, _b, _c;
541
+ const isLayerSource = source.hasOwnProperty("layer");
542
+ if (isLayerSource) {
543
+ const layerSource = source;
544
+ const layerFromMap = ((_a = layerSource.layer) === null || _a === void 0 ? void 0 : _a.id)
545
+ ? view.map.findLayerById(layerSource.layer.id)
546
+ : null;
547
+ if (layerFromMap) {
548
+ console.log("layerFromMap");
549
+ layerSource.layer = layerFromMap;
550
+ }
551
+ else if ((_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url) {
552
+ console.log("create new");
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 based on OIDs when skipOIDs have been defined
610
+ *
611
+ * @protected
612
+ */
613
+ async _highlightWithOIDsOrGeoms() {
614
+ var _a;
615
+ if (((_a = this._skipGeomOIDs) === null || _a === void 0 ? void 0 : _a.length) > 0) {
616
+ this._selectedIds = this._skipGeomOIDs;
617
+ return this._highlightFeatures(this._selectedIds);
618
+ }
619
+ else {
620
+ return this._geomQuery(this.geometries);
621
+ }
622
+ }
623
+ /**
624
+ * Highlight the features in the map
625
+ *
626
+ * @protected
627
+ */
628
+ async _highlightFeatures(ids) {
629
+ var _a;
630
+ (_a = state.highlightHandle) === null || _a === void 0 ? void 0 : _a.remove();
631
+ if (ids.length > 0) {
632
+ state.highlightHandle = await highlightFeatures(ids, this.selectLayerView, this.mapView);
633
+ }
634
+ this.selectionSetChange.emit(ids.length);
635
+ }
636
+ /**
637
+ * Query the selectLayerView based on any user drawn geometries or buffers
638
+ *
639
+ * @param geometries Array of geometries used for the selection of ids from the select layer view
640
+ *
641
+ * @returns Promise when the selection is complete and the graphics have been highlighted
642
+ */
643
+ async _selectFeatures(geometries) {
644
+ this._selectedIds = await queryObjectIds(geometries, this.selectLayerView.layer);
645
+ // Add geometries used for selecting features as graphics
646
+ this._drawTools.graphics = this.geometries.map(geom => {
647
+ var _a, _b, _c;
648
+ const props = {
649
+ "geometry": geom,
650
+ "symbol": geom.type === "point" ?
651
+ (_a = this._drawTools) === null || _a === void 0 ? void 0 : _a.pointSymbol : geom.type === "polyline" ?
652
+ (_b = this._drawTools) === null || _b === void 0 ? void 0 : _b.polylineSymbol : geom.type === "polygon" ?
653
+ (_c = this._drawTools) === null || _c === void 0 ? void 0 : _c.polygonSymbol : undefined
654
+ };
655
+ return new this.Graphic(props);
656
+ });
657
+ void this._highlightFeatures(this._selectedIds);
658
+ }
659
+ /**
660
+ * Query the selectLayerView based on any user drawn geometries or buffers
661
+ *
662
+ * @param evt CustomEvent that contains the result of the buffer
663
+ *
664
+ * @protected
665
+ */
666
+ async _bufferComplete(evt) {
667
+ this._bufferGeometry = Array.isArray(evt.detail) ?
668
+ evt.detail[0] : evt.detail;
669
+ if (this._bufferGeometry) {
670
+ // Create a symbol for rendering the graphic
671
+ const symbol = {
672
+ type: "simple-fill",
673
+ color: this.bufferColor,
674
+ outline: {
675
+ color: this.bufferOutlineColor,
676
+ width: 1
677
+ }
678
+ };
679
+ // Add the geometry and symbol to a new graphic
680
+ const polygonGraphic = new this.Graphic({
681
+ geometry: this._bufferGeometry,
682
+ symbol
683
+ });
684
+ this._bufferGraphicsLayer.removeAll();
685
+ this._bufferGraphicsLayer.add(polygonGraphic);
686
+ void this._selectFeatures([this._bufferGeometry]);
687
+ void this.mapView.goTo(polygonGraphic.geometry.extent);
688
+ }
689
+ else {
690
+ if (this._bufferGraphicsLayer) {
691
+ this._bufferGraphicsLayer.removeAll();
692
+ }
693
+ return this._highlightWithOIDsOrGeoms();
694
+ }
695
+ }
696
+ /**
697
+ * Fetch a single geometry for each potential geometry type
698
+ *
699
+ * @param geometries All current selection geometries
700
+ *
701
+ * @protected
702
+ */
703
+ _geomQuery(geometries) {
704
+ const queryGeoms = getQueryGeoms(geometries, this._geometryEngine);
705
+ return this._selectFeatures(queryGeoms);
706
+ }
707
+ /**
708
+ * Clear all stored values and general state for the component
709
+ *
710
+ * @param clearSearchWidget Optional boolean for clearing the search widget (default is true)
711
+ * @param clearLabel Optional boolean for clearing the search label (default is true)
712
+ *
713
+ * @protected
714
+ */
715
+ async _clearResults(clearSearchWidget = true, clearLabel = true) {
716
+ var _a, _b;
717
+ this._selectedIds = [];
718
+ if (clearLabel) {
719
+ this._selectionLabel = "";
720
+ }
721
+ if (this._bufferGraphicsLayer) {
722
+ this._bufferGraphicsLayer.removeAll();
723
+ }
724
+ if (clearSearchWidget && this._searchWidget) {
725
+ this._searchWidget.clear();
726
+ }
727
+ (_a = state.highlightHandle) === null || _a === void 0 ? void 0 : _a.remove();
728
+ // for sketch
729
+ // checking for clear as it would throw off tests
730
+ if ((_b = this._drawTools) === null || _b === void 0 ? void 0 : _b.clear) {
731
+ void this._drawTools.clear();
732
+ }
733
+ this.selectionSetChange.emit(this._selectedIds.length);
734
+ }
735
+ /**
736
+ * Fetch a single geometry for the current geometry type
737
+ *
738
+ * @param type worflow type
739
+ * @param graphics graphics to be used for selection
740
+ * @param label selection label
741
+ * @param useOIDs indicates if the OIDs should override the geometry for selection
742
+ * @param oids list of IDs to select when useGeoms is false
743
+ *
744
+ * @protected
745
+ */
746
+ _updateSelection(type, graphics, label, useOIDs, oids) {
747
+ this._selectedIds = useOIDs && oids ? oids : this._selectedIds;
748
+ // see https://github.com/Esri/solutions-components/issues/148
749
+ this._skipGeomOIDs = useOIDs ? oids : undefined;
750
+ this.geometries = Array.isArray(graphics) ? graphics.map(g => g.geometry) : this.geometries;
751
+ this._workflowType = type;
752
+ this._selectionLabel = label;
753
+ }
754
+ /**
755
+ * Fetches the component's translations
756
+ *
757
+ * @protected
758
+ */
759
+ async _getTranslations() {
760
+ const translations = await getLocaleComponentStrings(this.el);
761
+ this._translations = translations[0];
762
+ }
763
+ get el() { return getElement(this); }
764
+ static get watchers() { return {
765
+ "geometries": ["watchGeometriesHandler"],
766
+ "searchConfiguration": ["watchSearchConfigurationHandler"],
767
+ "_workflowType": ["workflowTypeHandler"]
768
+ }; }
769
+ };
770
+ MapSelectTools.style = mapSelectToolsCss;
771
+
772
+ const labelFormats = [
773
+ {
774
+ descriptionPDF: {
775
+ labelWidthDisplay: "2-5/8",
776
+ labelHeightDisplay: "1",
777
+ labelsPerPageDisplay: "30",
778
+ averyPartNumber: "*60"
779
+ },
780
+ labelSpec: {
781
+ type: "AVERY",
782
+ pageProperties: {
783
+ pageType: "ANSI A",
784
+ leftMargin: 0.1875,
785
+ rightMargin: 0.1875,
786
+ topMargin: 0.5,
787
+ bottomMargin: 0.5
788
+ },
789
+ numLabelsAcross: 3,
790
+ numLabelsDown: 10,
791
+ labelWidth: 2.625,
792
+ labelHeight: 1,
793
+ horizGapIn: 0.125,
794
+ vertGapIn: 0,
795
+ labelPadding: 0.1,
796
+ fontSizePx: 11,
797
+ maxNumLabelLines: 4
798
+ }
799
+ },
800
+ {
801
+ descriptionPDF: {
802
+ labelWidthDisplay: "4",
803
+ labelHeightDisplay: "1",
804
+ labelsPerPageDisplay: "20",
805
+ averyPartNumber: "*61"
806
+ },
807
+ labelSpec: {
808
+ type: "AVERY",
809
+ pageProperties: {
810
+ pageType: "ANSI A",
811
+ leftMargin: 0.15625,
812
+ rightMargin: 0.15625,
813
+ topMargin: 0.47637821,
814
+ bottomMargin: 0.5
815
+ },
816
+ numLabelsAcross: 2,
817
+ numLabelsDown: 10,
818
+ labelWidth: 4,
819
+ labelHeight: 1.0025,
820
+ horizGapIn: 0.1875,
821
+ vertGapIn: 0,
822
+ labelPadding: 0.1,
823
+ fontSizePx: 11,
824
+ maxNumLabelLines: 4
825
+ }
826
+ },
827
+ {
828
+ descriptionPDF: {
829
+ labelWidthDisplay: "4",
830
+ labelHeightDisplay: "1-1/3",
831
+ labelsPerPageDisplay: "14",
832
+ averyPartNumber: "*62"
833
+ },
834
+ labelSpec: {
835
+ type: "AVERY",
836
+ pageProperties: {
837
+ pageType: "ANSI A",
838
+ leftMargin: 0.15625,
839
+ rightMargin: 0.15625,
840
+ topMargin: 0.81889808,
841
+ bottomMargin: 0.83464612
842
+ },
843
+ numLabelsAcross: 2,
844
+ numLabelsDown: 7,
845
+ labelWidth: 4,
846
+ labelHeight: 1.3352,
847
+ horizGapIn: 0.1875,
848
+ vertGapIn: 0,
849
+ labelPadding: 0.1,
850
+ fontSizePx: 11,
851
+ maxNumLabelLines: 6
852
+ }
853
+ },
854
+ {
855
+ descriptionPDF: {
856
+ labelWidthDisplay: "4",
857
+ labelHeightDisplay: "2",
858
+ labelsPerPageDisplay: "10",
859
+ averyPartNumber: "*63"
860
+ },
861
+ labelSpec: {
862
+ type: "AVERY",
863
+ pageProperties: {
864
+ pageType: "ANSI A",
865
+ leftMargin: 0.15625,
866
+ rightMargin: 0.15625,
867
+ topMargin: 0.5,
868
+ bottomMargin: 0.5
869
+ },
870
+ numLabelsAcross: 2,
871
+ numLabelsDown: 5,
872
+ labelWidth: 4,
873
+ labelHeight: 2,
874
+ horizGapIn: 0.1875,
875
+ vertGapIn: 0,
876
+ labelPadding: 0.1,
877
+ fontSizePx: 12,
878
+ maxNumLabelLines: 10
879
+ }
880
+ },
881
+ {
882
+ descriptionPDF: {
883
+ labelWidthDisplay: "4",
884
+ labelHeightDisplay: "3-1/3",
885
+ labelsPerPageDisplay: "6",
886
+ averyPartNumber: "*64"
887
+ },
888
+ labelSpec: {
889
+ type: "AVERY",
890
+ pageProperties: {
891
+ pageType: "ANSI A",
892
+ leftMargin: 0.15625,
893
+ rightMargin: 0.15625,
894
+ topMargin: 0.4724412,
895
+ bottomMargin: 0.50000027
896
+ },
897
+ numLabelsAcross: 2,
898
+ numLabelsDown: 3,
899
+ labelWidth: 4,
900
+ labelHeight: 3.342,
901
+ horizGapIn: 0.1875,
902
+ vertGapIn: 0,
903
+ labelPadding: 0.1,
904
+ fontSizePx: 14,
905
+ maxNumLabelLines: 12
906
+ }
907
+ },
908
+ {
909
+ descriptionPDF: {
910
+ labelWidthDisplay: "1-3/4",
911
+ labelHeightDisplay: "1/2",
912
+ labelsPerPageDisplay: "80",
913
+ averyPartNumber: "*67"
914
+ },
915
+ labelSpec: {
916
+ type: "AVERY",
917
+ pageProperties: {
918
+ pageType: "ANSI A",
919
+ leftMargin: 0.307086375,
920
+ rightMargin: 0.307086375,
921
+ topMargin: 0.4724412,
922
+ bottomMargin: 0.49606326
923
+ },
924
+ numLabelsAcross: 4,
925
+ numLabelsDown: 20,
926
+ labelWidth: 1.75,
927
+ labelHeight: 0.50155,
928
+ horizGapIn: 0.29527575,
929
+ vertGapIn: 0,
930
+ labelPadding: 0.1,
931
+ fontSizePx: 8,
932
+ maxNumLabelLines: 3
933
+ }
934
+ },
935
+ {
936
+ descriptionPDF: {
937
+ labelWidthDisplay: "1-3/4",
938
+ labelHeightDisplay: "2/3",
939
+ labelsPerPageDisplay: "60",
940
+ averyPartNumber: "*95"
941
+ },
942
+ labelSpec: {
943
+ type: "AVERY",
944
+ pageProperties: {
945
+ pageType: "ANSI A",
946
+ leftMargin: 0.28936983,
947
+ rightMargin: 0.28936983,
948
+ topMargin: 0.53937037,
949
+ bottomMargin: 0.5511814
950
+ },
951
+ numLabelsAcross: 4,
952
+ numLabelsDown: 15,
953
+ labelWidth: 1.75,
954
+ labelHeight: 0.6605,
955
+ horizGapIn: 0.30708678,
956
+ vertGapIn: 0,
957
+ labelPadding: 0.1,
958
+ fontSizePx: 8,
959
+ maxNumLabelLines: 4
960
+ }
961
+ }
962
+ ];
963
+
964
+ const pdfLabelFormats = /*#__PURE__*/Object.freeze({
965
+ __proto__: null,
966
+ 'default': labelFormats
967
+ });
968
+
969
+ const pdfDownloadCss = ":host{display:block}";
970
+
971
+ const PdfDownload = class {
972
+ constructor(hostRef) {
973
+ registerInstance(this, hostRef);
974
+ this.disabled = false;
975
+ this.layerView = undefined;
976
+ this._translations = undefined;
977
+ }
978
+ //--------------------------------------------------------------------------
979
+ //
980
+ // Watch handlers
981
+ //
982
+ //--------------------------------------------------------------------------
983
+ //--------------------------------------------------------------------------
984
+ //
985
+ // Methods (public)
986
+ //
987
+ //--------------------------------------------------------------------------
988
+ /**
989
+ * Downloads csv of mailing labels for the provided list of ids
990
+ *
991
+ * @param ids List of ids to download
992
+ * @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
993
+ * @param addColumnTitle Indicates if column headings should be included in output
994
+ * @returns Promise resolving when function is done
995
+ */
996
+ async downloadCSV(ids, removeDuplicates, addColumnTitle = true) {
997
+ return downloadCSV(this.layerView.layer, ids, true, // formatUsingLayerPopup
998
+ removeDuplicates, addColumnTitle);
999
+ }
1000
+ /**
1001
+ * Downloads pdf of mailing labels for the provided list of ids
1002
+ *
1003
+ * @param ids List of ids to download
1004
+ * @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
1005
+ * @returns Promise resolving when function is done
1006
+ */
1007
+ async downloadPDF(ids, removeDuplicates) {
1008
+ return downloadPDF(this.layerView.layer, ids, removeDuplicates, this._labelInfoElement.selectedOption.value);
1009
+ }
1010
+ //--------------------------------------------------------------------------
1011
+ //
1012
+ // Events (public)
1013
+ //
1014
+ //--------------------------------------------------------------------------
1015
+ //--------------------------------------------------------------------------
1016
+ //
1017
+ // Functions (lifecycle)
1018
+ //
1019
+ //--------------------------------------------------------------------------
1020
+ /**
1021
+ * StencilJS: Called once just after the component is first connected to the DOM.
1022
+ */
1023
+ async componentWillLoad() {
1024
+ await this._getTranslations();
1025
+ await this._initModules();
1026
+ }
1027
+ /**
1028
+ * Renders the component.
1029
+ */
1030
+ render() {
1031
+ return (h(Host, null, h("calcite-select", { disabled: this.disabled, label: "", ref: (el) => { this._labelInfoElement = el; } }, this._renderItems())));
1032
+ }
1033
+ //--------------------------------------------------------------------------
1034
+ //
1035
+ // Functions (protected)
1036
+ //
1037
+ //--------------------------------------------------------------------------
1038
+ /**
1039
+ * Load esri javascript api modules
1040
+ *
1041
+ * @returns Promise resolving when function is done
1042
+ *
1043
+ * @protected
1044
+ */
1045
+ async _initModules() {
1046
+ const [intl] = await loadModules([
1047
+ "esri/intl"
1048
+ ]);
1049
+ this._intl = intl;
1050
+ }
1051
+ /**
1052
+ * Gets the formatted pdf export size text
1053
+ *
1054
+ * @param labelInfo current user selected label info
1055
+ *
1056
+ * @returns the pdf label as a string
1057
+ * @protected
1058
+ */
1059
+ _getLabelSizeText(labelInfo) {
1060
+ const lNum = labelInfo.descriptionPDF.labelsPerPageDisplay;
1061
+ const lSize = `${labelInfo.descriptionPDF.labelWidthDisplay} x ${labelInfo.descriptionPDF.labelHeightDisplay}`;
1062
+ return this._translations.pdfLabel.replace("{{n}}", lNum).replace("{{labelSize}}", lSize);
1063
+ }
1064
+ /**
1065
+ * Fetches the component's translations
1066
+ *
1067
+ * @protected
1068
+ */
1069
+ async _getTranslations() {
1070
+ const translations = await getLocaleComponentStrings(this.el);
1071
+ this._translations = translations[0];
1072
+ }
1073
+ /**
1074
+ * Renders the pdf export size options
1075
+ *
1076
+ * @returns Node array of size options
1077
+ *
1078
+ * @protected
1079
+ */
1080
+ _renderItems() {
1081
+ const s = pdfLabelFormats;
1082
+ const sortedPdfIndo = (s.default || s).sort((a, b) => {
1083
+ const _a = parseInt(a.descriptionPDF.labelsPerPageDisplay, 10);
1084
+ const _b = parseInt(b.descriptionPDF.labelsPerPageDisplay, 10);
1085
+ return _a < _b ? -1 : _a > _b ? 1 : 0;
1086
+ });
1087
+ return sortedPdfIndo.map((l) => {
1088
+ return (h("calcite-option", { value: l }, this._getLabelSizeText(l)));
1089
+ });
1090
+ }
1091
+ get el() { return getElement(this); }
1092
+ };
1093
+ PdfDownload.style = pdfDownloadCss;
1094
+
1095
+ const refineSelectionCss = ":host{display:block}";
1096
+
1097
+ const RefineSelection = class {
1098
+ constructor(hostRef) {
1099
+ registerInstance(this, hostRef);
1100
+ this.selectionSetsChanged = createEvent(this, "selectionSetsChanged", 7);
1101
+ //--------------------------------------------------------------------------
1102
+ //
1103
+ // Properties (protected)
1104
+ //
1105
+ //--------------------------------------------------------------------------
1106
+ /**
1107
+ * boolean: Indicates if any new graphics should be added or removed
1108
+ */
1109
+ this._addEnabled = true;
1110
+ this.addresseeLayer = undefined;
1111
+ this.enabledLayerIds = [];
1112
+ this.mapView = undefined;
1113
+ this.selectionSets = [];
1114
+ this.GraphicsLayer = undefined;
1115
+ this.SketchViewModel = undefined;
1116
+ this._translations = undefined;
1117
+ }
1118
+ //--------------------------------------------------------------------------
1119
+ //
1120
+ // Watch handlers
1121
+ //
1122
+ //--------------------------------------------------------------------------
1123
+ /**
1124
+ * Called each time the addresseeLayer is changed.
1125
+ * Add a new clean refine set for the new addressee layer.
1126
+ */
1127
+ addresseeLayerWatchHandler() {
1128
+ const selectionSets = this.selectionSets.filter(ss => ss.workflowType !== EWorkflowType.REFINE);
1129
+ this.selectionSets = this._initRefineSelectionSet(selectionSets);
1130
+ }
1131
+ /**
1132
+ * Handles changes to refine selection ids.
1133
+ *
1134
+ */
1135
+ refineSelectionIdsChange(event) {
1136
+ var _a, _b;
1137
+ const addIds = ((_a = event.detail) === null || _a === void 0 ? void 0 : _a.addIds) || [];
1138
+ const removeIds = ((_b = event.detail) === null || _b === void 0 ? void 0 : _b.removeIds) || [];
1139
+ this._updateSelectionSets(removeIds);
1140
+ this._updateRefineSelectionSet(addIds, removeIds);
1141
+ }
1142
+ //--------------------------------------------------------------------------
1143
+ //
1144
+ // Functions (lifecycle)
1145
+ //
1146
+ //--------------------------------------------------------------------------
1147
+ /**
1148
+ * StencilJS: Called once just after the component is first connected to the DOM.
1149
+ */
1150
+ async componentWillLoad() {
1151
+ await this._getTranslations();
1152
+ const refineSet = this._getRefineSelectionSet(this.selectionSets);
1153
+ if (!refineSet) {
1154
+ this.selectionSets = this._initRefineSelectionSet(this.selectionSets);
1155
+ }
1156
+ }
1157
+ /**
1158
+ * Renders the component.
1159
+ */
1160
+ render() {
1161
+ return (h(Host, null, h("div", { class: "padding-1" }, h("div", null, h("calcite-radio-group", { class: "w-100", onCalciteRadioGroupChange: (evt) => this._modeChanged(evt) }, h("calcite-radio-group-item", { checked: this._addEnabled, class: "w-50", onClick: () => this._setSelectionMode(ESelectionMode.ADD), value: ESelectionMode.ADD }, this._translations.add), h("calcite-radio-group-item", { checked: !this._addEnabled, class: "w-50", onClick: () => this._setSelectionMode(ESelectionMode.REMOVE), value: ESelectionMode.REMOVE }, this._translations.remove)), h("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("br", null), (h("calcite-list", { class: "list-border" }, this._getRefineSelectionSetList())))));
1162
+ }
1163
+ //--------------------------------------------------------------------------
1164
+ //
1165
+ // Functions (protected)
1166
+ //
1167
+ //--------------------------------------------------------------------------
1168
+ /**
1169
+ * Store the Add/Remove mode
1170
+ *
1171
+ * @protected
1172
+ */
1173
+ _modeChanged(evt) {
1174
+ this._addEnabled = evt.detail === ESelectionMode.ADD;
1175
+ }
1176
+ /**
1177
+ * Set the refine tools selection mode
1178
+ *
1179
+ * @protected
1180
+ */
1181
+ _setSelectionMode(mode) {
1182
+ this._refineTools.mode = mode;
1183
+ }
1184
+ /**
1185
+ * Create a list to show the number added/removed/total unique selected
1186
+ *
1187
+ * @returns the list node
1188
+ * @protected
1189
+ */
1190
+ _getRefineSelectionSetList() {
1191
+ const total = getTotal(this.selectionSets);
1192
+ const refineSet = this._getRefineSelectionSet(this.selectionSets);
1193
+ const numAdded = (refineSet === null || refineSet === void 0 ? void 0 : refineSet.refineIds.addIds.length) || 0;
1194
+ const numRemoved = (refineSet === null || refineSet === void 0 ? void 0 : refineSet.refineIds.removeIds.length) || 0;
1195
+ return [(h("calcite-list-item", { label: this._translations.featuresAdded.replace("{{n}}", numAdded.toString()), "non-interactive": true })), (h("calcite-list-item", { label: this._translations.featuresRemoved.replace("{{n}}", numRemoved.toString()), "non-interactive": true })), (h("calcite-list-item", { label: this._translations.totalSelected.replace("{{n}}", total.toString()), "non-interactive": true }))];
1196
+ }
1197
+ /**
1198
+ * Fetch the refine selection set
1199
+ *
1200
+ * @returns the refine selection set
1201
+ * @protected
1202
+ */
1203
+ _getRefineSelectionSet(selectionSets) {
1204
+ let refineSelectionSet;
1205
+ selectionSets.some(ss => {
1206
+ if (ss.workflowType === EWorkflowType.REFINE) {
1207
+ refineSelectionSet = ss;
1208
+ return true;
1209
+ }
1210
+ });
1211
+ return refineSelectionSet;
1212
+ }
1213
+ /**
1214
+ * Remove ids from existing selection sets.
1215
+ * Remove any selection sets than have no selected ids
1216
+ * This can update any selection set not just the refine set.
1217
+ * We do not do something similar for adds as we will only ever add from refine tools to the single REFINE selection set.
1218
+ *
1219
+ * @param removeIds the ids to remove
1220
+ *
1221
+ * @protected
1222
+ */
1223
+ _updateSelectionSets(removeIds) {
1224
+ if (removeIds.length > 0) {
1225
+ this.selectionSets = this.selectionSets.reduce((prev, cur) => {
1226
+ cur.selectedIds = cur.selectedIds.filter(id => removeIds.indexOf(id) < 0);
1227
+ if (cur.selectedIds.length > 0 || cur.workflowType === EWorkflowType.REFINE) {
1228
+ prev.push(cur);
1229
+ }
1230
+ return prev;
1231
+ }, []);
1232
+ this.selectionSetsChanged.emit(this.selectionSets);
1233
+ }
1234
+ }
1235
+ /**
1236
+ * Update the refine selection set with any adds or removes
1237
+ *
1238
+ * @param addIds any ids to add
1239
+ * @param removeIds any ids to remove
1240
+ *
1241
+ * @returns Promise resolving when function is done
1242
+ * @protected
1243
+ */
1244
+ _updateRefineSelectionSet(addIds, removeIds) {
1245
+ const selectionSet = this._getRefineSelectionSet(this.selectionSets);
1246
+ this._updateRefineIds(selectionSet, addIds, removeIds);
1247
+ this.selectionSetsChanged.emit(this.selectionSets);
1248
+ }
1249
+ /**
1250
+ * Update the ids stored for the refine selection set
1251
+ *
1252
+ * @param selectionSet the refine selection set
1253
+ * @param addIds any ids to add
1254
+ * @param removeIds any ids to remove
1255
+ *
1256
+ * @returns updated selection sets
1257
+ * @protected
1258
+ */
1259
+ _updateRefineIds(selectionSet, addIds, removeIds) {
1260
+ // remove ids if they exist in the current add or remove list
1261
+ selectionSet.refineIds.addIds = selectionSet.refineIds.addIds.filter(id => removeIds.indexOf(id) < 0);
1262
+ selectionSet.refineIds.removeIds = selectionSet.refineIds.removeIds.filter(id => addIds.indexOf(id) < 0);
1263
+ const _addIds = [...new Set(selectionSet.refineIds.addIds.concat(addIds))];
1264
+ const _removeIds = [...new Set(selectionSet.refineIds.removeIds.concat(removeIds))];
1265
+ selectionSet.refineIds = {
1266
+ addIds: _addIds.filter(id => _removeIds.indexOf(id) < 0),
1267
+ removeIds: _removeIds.filter(id => _addIds.indexOf(id) < 0)
1268
+ };
1269
+ selectionSet.selectedIds = selectionSet.refineIds.addIds.length > 0 ?
1270
+ [...new Set(selectionSet.selectedIds.concat(selectionSet.refineIds.addIds))] :
1271
+ selectionSet.selectedIds.filter(id => selectionSet.refineIds.removeIds.indexOf(id) < 0);
1272
+ return this.selectionSets.map(ss => {
1273
+ return ss.workflowType === EWorkflowType.REFINE ? selectionSet : ss;
1274
+ });
1275
+ }
1276
+ /**
1277
+ * Add a new refine selection set
1278
+ *
1279
+ * @returns updated selection sets
1280
+ * @protected
1281
+ */
1282
+ _initRefineSelectionSet(selectionSets) {
1283
+ return [
1284
+ ...selectionSets,
1285
+ ({
1286
+ buffer: undefined,
1287
+ distance: 0,
1288
+ download: true,
1289
+ geometries: [],
1290
+ id: Date.now(),
1291
+ label: "Refine",
1292
+ layerView: this.addresseeLayer,
1293
+ refineSelectLayers: [],
1294
+ searchResult: undefined,
1295
+ selectedIds: [],
1296
+ unit: "feet",
1297
+ workflowType: EWorkflowType.REFINE,
1298
+ refineIds: {
1299
+ addIds: [],
1300
+ removeIds: []
1301
+ },
1302
+ redoStack: [],
1303
+ undoStack: []
1304
+ })
1305
+ ];
1306
+ }
1307
+ /**
1308
+ * Fetches the component's translations
1309
+ *
1310
+ * @protected
1311
+ */
1312
+ async _getTranslations() {
1313
+ const translations = await getLocaleComponentStrings(this.el);
1314
+ this._translations = translations[0];
1315
+ }
1316
+ /** Provides access to protected methods for unit testing.
1317
+ *
1318
+ * @param methodName Name of protected method to run
1319
+ * @param arg1 First argument to forward to method, e.g., for "_modeChanged", `ESelectionMode`
1320
+ * @returns
1321
+ */
1322
+ _testAccess(methodName, arg1) {
1323
+ switch (methodName) {
1324
+ case "_modeChanged":
1325
+ return this._modeChanged(arg1);
1326
+ case "_setSelectionMode":
1327
+ return this._setSelectionMode(arg1);
1328
+ // case "_getRefineSelectionSetList":
1329
+ // return this._getRefineSelectionSetList();
1330
+ // case "_getRefineSelectionSet":
1331
+ // return this._getRefineSelectionSet(arg1);
1332
+ // case "_updateSelectionSets":
1333
+ // return this._updateSelectionSets(arg1);
1334
+ // case "_updateRefineSelectionSet":
1335
+ // return this._updateRefineSelectionSet(arg1, arg2);
1336
+ // case "_updateRefineIds":
1337
+ // return this._updateRefineIds(arg1, arg2, arg3);
1338
+ // case "_addRefineSelectionSet":
1339
+ // return this._addRefineSelectionSet(arg1, arg2);
1340
+ }
1341
+ return null;
1342
+ }
1343
+ get el() { return getElement(this); }
1344
+ static get watchers() { return {
1345
+ "addresseeLayer": ["addresseeLayerWatchHandler"]
1346
+ }; }
1347
+ };
1348
+ RefineSelection.style = refineSelectionCss;
1349
+
1350
+ export { InputMessage as calcite_input_message, Notice as calcite_notice, MapSelectTools as map_select_tools, PdfDownload as pdf_download, RefineSelection as refine_selection };