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