@esri/solutions-components 0.6.6 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/dist/cjs/basemap-gallery_4.cjs.entry.js +622 -0
  2. package/dist/cjs/card-manager_4.cjs.entry.js +91 -37
  3. package/dist/cjs/crowdsource-manager.cjs.entry.js +4 -2
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/solutions-components.cjs.js +2 -2
  6. package/dist/collection/collection-manifest.json +3 -1
  7. package/dist/collection/components/basemap-gallery/basemap-gallery.css +19 -0
  8. package/dist/collection/components/basemap-gallery/basemap-gallery.js +166 -0
  9. package/dist/collection/components/basemap-gallery/test/basemap-gallery.e2e.js +29 -0
  10. package/dist/collection/components/basemap-gallery/test/basemap-gallery.spec.js +37 -0
  11. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +43 -2
  12. package/dist/collection/components/layer-table/layer-table.js +99 -30
  13. package/dist/collection/components/map-card/map-card.css +0 -7
  14. package/dist/collection/components/map-card/map-card.js +12 -7
  15. package/dist/collection/components/map-search/map-search.css +24 -0
  16. package/dist/collection/components/map-search/map-search.js +321 -0
  17. package/dist/collection/components/map-search/test/map-search.e2e.js +29 -0
  18. package/dist/collection/components/map-search/test/map-search.spec.js +37 -0
  19. package/dist/collection/components/map-tools/map-tools.js +139 -14
  20. package/dist/collection/demos/crowdsource-manager.html +3 -3
  21. package/dist/collection/utils/interfaces.ts +2 -0
  22. package/dist/components/action-bar.js +1 -0
  23. package/dist/components/action-group.js +1 -0
  24. package/dist/components/action-menu.js +1 -0
  25. package/dist/components/action.js +1 -0
  26. package/dist/components/alert.js +1 -0
  27. package/dist/components/avatar.js +1 -0
  28. package/dist/components/basemap-gallery.d.ts +11 -0
  29. package/dist/components/basemap-gallery.js +11 -0
  30. package/dist/components/basemap-gallery2.js +118 -0
  31. package/dist/components/buffer-tools2.js +1 -0
  32. package/dist/components/button.js +1 -0
  33. package/dist/components/calcite-accordion-item.js +1 -0
  34. package/dist/components/calcite-accordion.js +1 -0
  35. package/dist/components/calcite-action-pad.js +1 -0
  36. package/dist/components/calcite-block-section.js +1 -0
  37. package/dist/components/calcite-block.js +1 -0
  38. package/dist/components/calcite-card.js +1 -0
  39. package/dist/components/calcite-chip-group.js +1 -0
  40. package/dist/components/calcite-color-picker.js +1 -0
  41. package/dist/components/calcite-combobox-item-group.js +1 -0
  42. package/dist/components/calcite-fab.js +1 -0
  43. package/dist/components/calcite-flow-item.js +1 -0
  44. package/dist/components/calcite-flow.js +1 -0
  45. package/dist/components/calcite-inline-editable.js +1 -0
  46. package/dist/components/calcite-input-date-picker.js +1 -0
  47. package/dist/components/calcite-input-time-picker.js +1 -0
  48. package/dist/components/calcite-input-time-zone.js +1 -0
  49. package/dist/components/calcite-list-item-group.js +1 -0
  50. package/dist/components/calcite-menu-item.js +1 -0
  51. package/dist/components/calcite-modal.js +1 -0
  52. package/dist/components/calcite-navigation-logo.js +1 -0
  53. package/dist/components/calcite-navigation-user.js +1 -0
  54. package/dist/components/calcite-navigation.js +1 -0
  55. package/dist/components/calcite-option-group.js +1 -0
  56. package/dist/components/calcite-pagination.js +1 -0
  57. package/dist/components/calcite-pick-list-group.js +1 -0
  58. package/dist/components/calcite-pick-list.js +1 -0
  59. package/dist/components/calcite-radio-button-group.js +1 -0
  60. package/dist/components/calcite-radio-button.js +1 -0
  61. package/dist/components/calcite-rating.js +1 -0
  62. package/dist/components/calcite-shell-center-row.js +1 -0
  63. package/dist/components/calcite-sortable-list.js +1 -0
  64. package/dist/components/calcite-split-button.js +1 -0
  65. package/dist/components/calcite-stepper-item.js +1 -0
  66. package/dist/components/calcite-stepper.js +1 -0
  67. package/dist/components/calcite-text-area.js +1 -0
  68. package/dist/components/calcite-tile-select-group.js +1 -0
  69. package/dist/components/calcite-tile-select.js +1 -0
  70. package/dist/components/calcite-tip-group.js +1 -0
  71. package/dist/components/calcite-tip-manager.js +1 -0
  72. package/dist/components/calcite-tip.js +1 -0
  73. package/dist/components/card-manager2.js +1 -0
  74. package/dist/components/checkbox.js +1 -0
  75. package/dist/components/chip.js +1 -0
  76. package/dist/components/color-picker-hex-input.js +1 -0
  77. package/dist/components/color-picker-swatch.js +1 -0
  78. package/dist/components/combobox-item.js +1 -0
  79. package/dist/components/combobox.js +1 -0
  80. package/dist/components/crowdsource-manager.js +95 -78
  81. package/dist/components/crowdsource-reporter.js +1 -0
  82. package/dist/components/date-picker-day.js +1 -0
  83. package/dist/components/date-picker-month-header.js +1 -0
  84. package/dist/components/date-picker-month.js +1 -0
  85. package/dist/components/date-picker.js +1 -0
  86. package/dist/components/deduct-calculator2.js +1 -0
  87. package/dist/components/dropdown-group.js +1 -0
  88. package/dist/components/dropdown-item.js +1 -0
  89. package/dist/components/dropdown.js +1 -0
  90. package/dist/components/edit-card2.js +1 -0
  91. package/dist/components/esri-loader.js +301 -0
  92. package/dist/components/filter2.js +1 -0
  93. package/dist/components/graph.js +1 -0
  94. package/dist/components/handle.js +1 -0
  95. package/dist/components/icon.js +1 -0
  96. package/dist/components/index.d.ts +6 -0
  97. package/dist/components/index.js +1 -1
  98. package/dist/components/info-card2.js +1 -0
  99. package/dist/components/input-message.js +1 -0
  100. package/dist/components/input-number.js +1 -0
  101. package/dist/components/input-text.js +1 -0
  102. package/dist/components/input.js +1 -0
  103. package/dist/components/json-editor2.js +1 -0
  104. package/dist/components/label2.js +1 -0
  105. package/dist/components/layer-table2.js +83 -31
  106. package/dist/components/layout-manager2.js +1 -0
  107. package/dist/components/link.js +1 -0
  108. package/dist/components/list-item.js +1 -0
  109. package/dist/components/list-item2.js +1 -0
  110. package/dist/components/list.js +1 -0
  111. package/dist/components/loadModules.js +1 -1
  112. package/dist/components/loader.js +1 -0
  113. package/dist/components/locale.js +2 -295
  114. package/dist/components/map-card2.js +61 -42
  115. package/dist/components/map-draw-tools2.js +1 -0
  116. package/dist/components/map-layer-picker2.js +1 -0
  117. package/dist/components/map-picker2.js +1 -0
  118. package/dist/components/map-search.d.ts +11 -0
  119. package/dist/components/map-search.js +11 -0
  120. package/dist/components/map-search2.js +201 -0
  121. package/dist/components/map-select-tools2.js +1 -0
  122. package/dist/components/map-tools2.js +141 -30
  123. package/dist/components/menu.js +1 -0
  124. package/dist/components/notice.js +1 -0
  125. package/dist/components/option.js +1 -0
  126. package/dist/components/panel.js +1 -0
  127. package/dist/components/pci-calculator.js +1 -0
  128. package/dist/components/pdf-download2.js +1 -0
  129. package/dist/components/pick-list-item.js +1 -0
  130. package/dist/components/popover.js +1 -0
  131. package/dist/components/progress.js +1 -0
  132. package/dist/components/public-notification.js +1 -0
  133. package/dist/components/refine-selection2.js +1 -0
  134. package/dist/components/scrim.js +1 -0
  135. package/dist/components/segmented-control-item.js +1 -0
  136. package/dist/components/segmented-control.js +1 -0
  137. package/dist/components/select.js +1 -0
  138. package/dist/components/shell-panel.js +1 -0
  139. package/dist/components/shell.js +1 -0
  140. package/dist/components/slider.js +1 -0
  141. package/dist/components/solution-configuration.js +1 -0
  142. package/dist/components/solution-contents2.js +1 -0
  143. package/dist/components/solution-item-details2.js +1 -0
  144. package/dist/components/solution-item-icon2.js +1 -0
  145. package/dist/components/solution-item-sharing2.js +1 -0
  146. package/dist/components/solution-item2.js +1 -0
  147. package/dist/components/solution-organization-variables2.js +1 -0
  148. package/dist/components/solution-resource-item2.js +1 -0
  149. package/dist/components/solution-spatial-ref2.js +1 -0
  150. package/dist/components/solution-template-data2.js +1 -0
  151. package/dist/components/solution-variables2.js +1 -0
  152. package/dist/components/stack.js +1 -0
  153. package/dist/components/store-manager.js +1 -0
  154. package/dist/components/switch.js +1 -0
  155. package/dist/components/tab-nav.js +1 -0
  156. package/dist/components/tab-title.js +1 -0
  157. package/dist/components/tab.js +1 -0
  158. package/dist/components/tabs.js +1 -0
  159. package/dist/components/tile.js +1 -0
  160. package/dist/components/time-picker.js +1 -0
  161. package/dist/components/tooltip.js +1 -0
  162. package/dist/components/tree-item.js +1 -0
  163. package/dist/components/tree.js +1 -0
  164. package/dist/components/value-list-item.js +1 -0
  165. package/dist/components/value-list.js +1 -0
  166. package/dist/esm/basemap-gallery_4.entry.js +615 -0
  167. package/dist/esm/card-manager_4.entry.js +91 -37
  168. package/dist/esm/crowdsource-manager.entry.js +4 -2
  169. package/dist/esm/loader.js +1 -1
  170. package/dist/esm/polyfills/core-js.js +11 -0
  171. package/dist/esm/polyfills/dom.js +79 -0
  172. package/dist/esm/polyfills/es5-html-element.js +1 -0
  173. package/dist/esm/polyfills/index.js +34 -0
  174. package/dist/esm/polyfills/system.js +6 -0
  175. package/dist/esm/solutions-components.js +2 -2
  176. package/dist/solutions-components/demos/crowdsource-manager.html +3 -3
  177. package/dist/solutions-components/p-55aefaa8.entry.js +6 -0
  178. package/dist/solutions-components/p-5b5a6ac8.entry.js +6 -0
  179. package/dist/solutions-components/p-a6c85bd7.entry.js +6 -0
  180. package/dist/solutions-components/solutions-components.esm.js +1 -1
  181. package/dist/solutions-components/utils/interfaces.ts +2 -0
  182. package/dist/types/components/basemap-gallery/basemap-gallery.d.ts +64 -0
  183. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +9 -1
  184. package/dist/types/components/layer-table/layer-table.d.ts +24 -2
  185. package/dist/types/components/map-card/map-card.d.ts +10 -2
  186. package/dist/types/components/map-search/map-search.d.ts +107 -0
  187. package/dist/types/components/map-tools/map-tools.d.ts +68 -5
  188. package/dist/types/components.d.ts +122 -0
  189. package/dist/types/preact.d.ts +4 -0
  190. package/dist/types/stencil-public-runtime.d.ts +2 -0
  191. package/dist/types/utils/interfaces.d.ts +2 -0
  192. package/package.json +1 -1
  193. package/dist/cjs/map-picker_2.cjs.entry.js +0 -264
  194. package/dist/esm/map-picker_2.entry.js +0 -259
  195. package/dist/solutions-components/p-1990d9c8.entry.js +0 -6
  196. package/dist/solutions-components/p-40bde8b2.entry.js +0 -6
  197. package/dist/solutions-components/p-b921aa1a.entry.js +0 -6
@@ -0,0 +1,615 @@
1
+ /*!
2
+ * Copyright 2022 Esri
3
+ * Licensed under the Apache License, Version 2.0
4
+ * http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-b5d9d795.js';
7
+ import { l as loadModules } from './loadModules-2ecd1e44.js';
8
+ import { g as getLocaleComponentStrings } from './locale-aa3de591.js';
9
+ import { g as EExpandType } from './interfaces-5a2fe8b4.js';
10
+ import './_commonjsHelpers-d5f9d613.js';
11
+
12
+ const basemapGalleryCss = ":host{display:block}";
13
+
14
+ const BasemapGallery = class {
15
+ constructor(hostRef) {
16
+ registerInstance(this, hostRef);
17
+ this.mapView = undefined;
18
+ this.basemapWidget = undefined;
19
+ }
20
+ //--------------------------------------------------------------------------
21
+ //
22
+ // Watch handlers
23
+ //
24
+ //--------------------------------------------------------------------------
25
+ async mapViewWatchHandler() {
26
+ await this.mapView.when(() => {
27
+ this._initBaseMapGallery(this.mapView);
28
+ });
29
+ }
30
+ //--------------------------------------------------------------------------
31
+ //
32
+ // Methods (public)
33
+ //
34
+ //--------------------------------------------------------------------------
35
+ //--------------------------------------------------------------------------
36
+ //
37
+ // Events (public)
38
+ //
39
+ //--------------------------------------------------------------------------
40
+ //--------------------------------------------------------------------------
41
+ //
42
+ // Functions (lifecycle)
43
+ //
44
+ //--------------------------------------------------------------------------
45
+ /**
46
+ * StencilJS: Called once just after the component is first connected to the DOM.
47
+ */
48
+ async componentWillLoad() {
49
+ return this._initModules();
50
+ }
51
+ /**
52
+ * StencilJS: Renders the component.
53
+ */
54
+ render() {
55
+ return (h(Host, null, h("div", { ref: (el) => { this._basemapElement = el; } })));
56
+ }
57
+ //--------------------------------------------------------------------------
58
+ //
59
+ // Functions (protected)
60
+ //
61
+ //--------------------------------------------------------------------------
62
+ /**
63
+ * Load esri javascript api modules
64
+ *
65
+ * @returns Promise resolving when function is done
66
+ *
67
+ * @protected
68
+ */
69
+ async _initModules() {
70
+ const [BasemapGallery] = await loadModules([
71
+ "esri/widgets/BasemapGallery"
72
+ ]);
73
+ this.BasemapGallery = BasemapGallery;
74
+ }
75
+ /**
76
+ * Initialize the basemap gallery or reset the current view if it already exists
77
+ *
78
+ * @returns void
79
+ *
80
+ * @protected
81
+ */
82
+ _initBaseMapGallery(view) {
83
+ if (view && this.BasemapGallery) {
84
+ if (!this.basemapWidget) {
85
+ this.basemapWidget = new this.BasemapGallery({
86
+ container: this._basemapElement,
87
+ view
88
+ });
89
+ }
90
+ else {
91
+ this.basemapWidget.view = view;
92
+ }
93
+ }
94
+ }
95
+ get el() { return getElement(this); }
96
+ static get watchers() { return {
97
+ "mapView": ["mapViewWatchHandler"]
98
+ }; }
99
+ };
100
+ BasemapGallery.style = basemapGalleryCss;
101
+
102
+ const mapPickerCss = ":host{display:block}.width-full{width:100%}.height-full{height:100%}.display-flex{display:flex}.border-bottom-1{border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3)}.action-bar-size{height:51px;width:100%}.map-list{position:absolute;display:flex;flex-direction:column;overflow:hidden;animation:calcite-scrim-fade-in var(--calcite-internal-animation-timing-medium) ease-in-out;background-color:var(--calcite-scrim-background);z-index:1;width:100%;height:-moz-fit-content;height:fit-content}.display-none{display:none}";
103
+
104
+ const MapPicker = class {
105
+ constructor(hostRef) {
106
+ registerInstance(this, hostRef);
107
+ this.mapInfoChange = createEvent(this, "mapInfoChange", 7);
108
+ /**
109
+ * string: the id of map currently displayed
110
+ */
111
+ this._loadedId = "";
112
+ this.mapInfos = [];
113
+ this._mapListExpanded = false;
114
+ this._webMapInfo = undefined;
115
+ }
116
+ //--------------------------------------------------------------------------
117
+ //
118
+ // Watch handlers
119
+ //
120
+ //--------------------------------------------------------------------------
121
+ /**
122
+ * Called each time the _webMapInfo prop is changed.
123
+ */
124
+ _webMapInfoWatchHandler(v, oldV) {
125
+ if (v && JSON.stringify(v) !== JSON.stringify(oldV)) {
126
+ this._loadedId = v === null || v === void 0 ? void 0 : v.id;
127
+ this.mapInfoChange.emit(v);
128
+ }
129
+ }
130
+ /**
131
+ * Called each time the mapInfos prop is changed.
132
+ */
133
+ mapInfosWatchHandler(v, oldV) {
134
+ if (v && JSON.stringify(v) !== JSON.stringify(oldV)) {
135
+ this.mapInfoChange.emit(v[0]);
136
+ }
137
+ }
138
+ //--------------------------------------------------------------------------
139
+ //
140
+ // Functions (lifecycle)
141
+ //
142
+ //--------------------------------------------------------------------------
143
+ /**
144
+ * Renders the component.
145
+ */
146
+ render() {
147
+ return (h(Host, null, this._getToolbar(), this._getMapNameList(this._mapListExpanded)));
148
+ }
149
+ /**
150
+ * Called after each render
151
+ */
152
+ async componentDidRender() {
153
+ if (this._mapListExpanded) {
154
+ await this._list.setFocus();
155
+ }
156
+ }
157
+ /**
158
+ * Called once after the component has loaded
159
+ */
160
+ componentDidLoad() {
161
+ const webMapInfo = this.mapInfos && this.mapInfos.length > 0 ? this.mapInfos[0] : undefined;
162
+ if (webMapInfo) {
163
+ this._webMapSelected(webMapInfo);
164
+ }
165
+ }
166
+ //--------------------------------------------------------------------------
167
+ //
168
+ // Functions (protected)
169
+ //
170
+ //--------------------------------------------------------------------------
171
+ /**
172
+ * Get a calcite action group for the map list
173
+ * Actions do not support multiple icons so this uses a block
174
+ *
175
+ * @returns the dom node for the action group
176
+ *
177
+ * @protected
178
+ */
179
+ _getMapPicker() {
180
+ var _a;
181
+ const mapListIcon = this._mapListExpanded ? "chevron-up" : "chevron-down";
182
+ return (h("calcite-button", { alignment: "icon-end-space-between", appearance: "solid", class: "width-full height-full", iconEnd: mapListIcon, kind: "neutral", onClick: () => this._chooseMap(), width: "full" }, (_a = this._webMapInfo) === null || _a === void 0 ? void 0 : _a.name));
183
+ }
184
+ /**
185
+ * Create the toolbar (controls used for map and app interactions)
186
+ *
187
+ * @returns The dom node with the toolbar
188
+ *
189
+ * @protected
190
+ */
191
+ _getToolbar() {
192
+ return (h("div", { class: "display-flex" }, h("calcite-action-bar", { class: "border-bottom-1 action-bar-size", "expand-disabled": true, layout: "horizontal", slot: "header" }, this._getMapPicker())));
193
+ }
194
+ /**
195
+ * Get a pick list for all maps in mapInfos
196
+ *
197
+ * @param show boolean to indicate if the list should be shown or hidden
198
+ *
199
+ * @returns the dom node for the list of maps
200
+ *
201
+ * @protected
202
+ */
203
+ _getMapNameList(show) {
204
+ const listClass = show ? "map-list" : "display-none";
205
+ return (h("div", { class: listClass }, h("calcite-list", { id: "mapList", ref: (el) => this._list = el, selectionAppearance: "border" }, this.mapInfos.map(mapInfo => {
206
+ return (h("calcite-list-item", { label: mapInfo.name, onClick: () => this._webMapSelected(mapInfo), selected: mapInfo.id === this._loadedId, value: mapInfo.id }));
207
+ }))));
208
+ }
209
+ /**
210
+ * Fired when the user clicks on the map list
211
+ *
212
+ * @param webMapInfo the web map id and name selected from the list
213
+ *
214
+ * @returns void
215
+ *
216
+ * @protected
217
+ */
218
+ _webMapSelected(webMapInfo) {
219
+ this._mapListExpanded = false;
220
+ this._webMapInfo = webMapInfo;
221
+ }
222
+ /**
223
+ * Toggles the open/close state of the map list
224
+ *
225
+ * @returns the dom node for the action group
226
+ *
227
+ * @protected
228
+ */
229
+ _chooseMap() {
230
+ this._mapListExpanded = !this._mapListExpanded;
231
+ }
232
+ get el() { return getElement(this); }
233
+ static get watchers() { return {
234
+ "_webMapInfo": ["_webMapInfoWatchHandler"],
235
+ "mapInfos": ["mapInfosWatchHandler"]
236
+ }; }
237
+ };
238
+ MapPicker.style = mapPickerCss;
239
+
240
+ const mapSearchCss = ":host{display:block}.search-widget{width:100% !important;border:1px solid var(--calcite-ui-border-input)}";
241
+
242
+ const MapSearch = class {
243
+ constructor(hostRef) {
244
+ registerInstance(this, hostRef);
245
+ this.mapView = undefined;
246
+ this.popupEnabled = false;
247
+ this.resultGraphicEnabled = false;
248
+ this.searchConfiguration = undefined;
249
+ this.searchTerm = undefined;
250
+ this.searchWidget = undefined;
251
+ }
252
+ //--------------------------------------------------------------------------
253
+ //
254
+ // Watch handlers
255
+ //
256
+ //--------------------------------------------------------------------------
257
+ /**
258
+ * Called each time the searchConfiguration prop is changed.
259
+ *
260
+ * @returns Promise when complete
261
+ */
262
+ async watchSearchConfigurationHandler() {
263
+ this._initSearchWidget();
264
+ }
265
+ /**
266
+ * Called each time the mapView prop is changed.
267
+ *
268
+ * @returns Promise when complete
269
+ */
270
+ async mapViewWatchHandler() {
271
+ await this.mapView.when(() => {
272
+ this._initSearchWidget();
273
+ });
274
+ }
275
+ //--------------------------------------------------------------------------
276
+ //
277
+ // Methods (public)
278
+ //
279
+ //--------------------------------------------------------------------------
280
+ //--------------------------------------------------------------------------
281
+ //
282
+ // Events (public)
283
+ //
284
+ //--------------------------------------------------------------------------
285
+ //--------------------------------------------------------------------------
286
+ //
287
+ // Functions (lifecycle)
288
+ //
289
+ //--------------------------------------------------------------------------
290
+ /**
291
+ * StencilJS: Called once just after the component is first connected to the DOM.
292
+ */
293
+ async componentWillLoad() {
294
+ await this._initModules();
295
+ }
296
+ /**
297
+ * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
298
+ */
299
+ async componentDidLoad() {
300
+ return this._initSearchWidget();
301
+ }
302
+ /**
303
+ * Renders the component.
304
+ */
305
+ render() {
306
+ return (h(Host, null, h("div", { class: "search-widget", ref: (el) => { this._searchElement = el; } })));
307
+ }
308
+ //--------------------------------------------------------------------------
309
+ //
310
+ // Functions (protected)
311
+ //
312
+ //--------------------------------------------------------------------------
313
+ /**
314
+ * Load esri javascript api modules
315
+ *
316
+ * @returns Promise resolving when function is done
317
+ *
318
+ * @protected
319
+ */
320
+ async _initModules() {
321
+ const [Search, FeatureLayer] = await loadModules([
322
+ "esri/widgets/Search",
323
+ "esri/layers/FeatureLayer"
324
+ ]);
325
+ this.Search = Search;
326
+ this.FeatureLayer = FeatureLayer;
327
+ }
328
+ /**
329
+ * Initialize the search widget
330
+ *
331
+ * @protected
332
+ */
333
+ _initSearchWidget() {
334
+ if (this.mapView && this._searchElement && !this.searchWidget) {
335
+ let searchOptions = {
336
+ view: this.mapView,
337
+ container: this._searchElement,
338
+ searchTerm: this.searchTerm
339
+ };
340
+ if (this.searchConfiguration) {
341
+ const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
342
+ searchOptions = Object.assign({}, searchConfiguration);
343
+ }
344
+ this.searchWidget = new this.Search(searchOptions);
345
+ this.searchWidget.popupEnabled = this.popupEnabled;
346
+ this.searchWidget.resultGraphicEnabled = this.resultGraphicEnabled;
347
+ }
348
+ else {
349
+ if (this.searchWidget) {
350
+ this.searchWidget.view = this.mapView;
351
+ }
352
+ }
353
+ }
354
+ /**
355
+ * Initialize the search widget based on user defined configuration
356
+ *
357
+ * @param searchConfiguration search configuration defined by the user
358
+ * @param view the current map view
359
+ *
360
+ * @protected
361
+ */
362
+ _getSearchConfig(searchConfiguration, view) {
363
+ const INCLUDE_DEFAULT_SOURCES = "includeDefaultSources";
364
+ const sources = searchConfiguration.sources;
365
+ if ((sources === null || sources === void 0 ? void 0 : sources.length) > 0) {
366
+ searchConfiguration[INCLUDE_DEFAULT_SOURCES] = false;
367
+ sources.forEach((source) => {
368
+ var _a, _b;
369
+ const isLayerSource = source.hasOwnProperty("layer");
370
+ if (isLayerSource) {
371
+ const layerSource = source;
372
+ const layerId = (_a = layerSource.layer) === null || _a === void 0 ? void 0 : _a.id;
373
+ const layerFromMap = layerId ? view.map.findLayerById(layerId) : null;
374
+ const layerUrl = (_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url;
375
+ if (layerFromMap) {
376
+ layerSource.layer = layerFromMap;
377
+ }
378
+ else if (layerUrl) {
379
+ layerSource.layer = new this.FeatureLayer(layerUrl);
380
+ }
381
+ }
382
+ });
383
+ sources === null || sources === void 0 ? void 0 : sources.forEach((source) => {
384
+ const isLocatorSource = source.hasOwnProperty("locator");
385
+ if (isLocatorSource) {
386
+ const locatorSource = source;
387
+ if ((locatorSource === null || locatorSource === void 0 ? void 0 : locatorSource.name) === "ArcGIS World Geocoding Service") {
388
+ const outFields = locatorSource.outFields || ["Addr_type", "Match_addr", "StAddr", "City"];
389
+ locatorSource.outFields = outFields;
390
+ locatorSource.singleLineFieldName = "SingleLine";
391
+ }
392
+ locatorSource.url = locatorSource.url;
393
+ delete locatorSource.url;
394
+ }
395
+ });
396
+ }
397
+ else {
398
+ searchConfiguration = Object.assign(Object.assign({}, searchConfiguration), { includeDefaultSources: true });
399
+ }
400
+ return searchConfiguration;
401
+ }
402
+ static get watchers() { return {
403
+ "searchConfiguration": ["watchSearchConfigurationHandler"],
404
+ "mapView": ["mapViewWatchHandler"]
405
+ }; }
406
+ };
407
+ MapSearch.style = mapSearchCss;
408
+
409
+ const mapToolsCss = ":host{display:block}.display-none{display:none}.border{border:1px solid var(--calcite-ui-border-3)}.margin-top-1-2{margin-top:0.5rem}";
410
+
411
+ const MapTools = class {
412
+ constructor(hostRef) {
413
+ registerInstance(this, hostRef);
414
+ this.expandMap = createEvent(this, "expandMap", 7);
415
+ this.layout = "vertical";
416
+ this.mapView = undefined;
417
+ this.searchConfiguration = undefined;
418
+ this._translations = undefined;
419
+ this._showTools = true;
420
+ this._showBasemapWidget = false;
421
+ this._showSearchWidget = false;
422
+ }
423
+ //--------------------------------------------------------------------------
424
+ //
425
+ // Watch handlers
426
+ //
427
+ //--------------------------------------------------------------------------
428
+ /**
429
+ * Store the home extent when the map view changes
430
+ */
431
+ async mapViewWatchHandler() {
432
+ await this.mapView.when(() => {
433
+ this._homeExtent = this.mapView.extent;
434
+ });
435
+ }
436
+ /**
437
+ * When the _showBasemapWidget property is true display the basemap gallery
438
+ */
439
+ async _showBasemapWidgetWatchHandler(v) {
440
+ if (v) {
441
+ this.mapView.ui.add(this._basemapElement.basemapWidget, {
442
+ position: "top-right",
443
+ index: 1
444
+ });
445
+ }
446
+ else {
447
+ this.mapView.ui.remove(this._basemapElement.basemapWidget);
448
+ }
449
+ }
450
+ /**
451
+ * When the _showSearchWidget property is true display the search widget
452
+ */
453
+ async _showSearchWidgetWatchHandler(v) {
454
+ console.log("_showSearchWidget changed");
455
+ if (v) {
456
+ this.mapView.ui.add(this._searchElement.searchWidget, {
457
+ position: "top-right",
458
+ index: 1
459
+ });
460
+ }
461
+ else {
462
+ this.mapView.ui.remove(this._searchElement.searchWidget);
463
+ }
464
+ }
465
+ //--------------------------------------------------------------------------
466
+ //
467
+ // Functions (lifecycle)
468
+ //
469
+ //--------------------------------------------------------------------------
470
+ /**
471
+ * StencilJS: Called once just after the component is first connected to the DOM.
472
+ */
473
+ async componentWillLoad() {
474
+ await this._getTranslations();
475
+ }
476
+ /**
477
+ * StencilJS: Renders the component.
478
+ */
479
+ render() {
480
+ const toggleIcon = this._showTools ? "chevrons-up" : "chevrons-down";
481
+ const toolsClass = this._showTools ? "" : "display-none";
482
+ const searchClass = this._showSearchWidget ? "" : "display-none";
483
+ const basemapClass = this._showBasemapWidget ? "" : "display-none";
484
+ return (h(Host, null, h("div", null, h("calcite-action", { alignment: "center", class: "border", compact: false, icon: toggleIcon, onClick: () => { this._toggleTools(); }, text: "" }), h("calcite-action-bar", { class: `border margin-top-1-2 ${toolsClass}`, "expand-disabled": true, layout: this.layout }, this._getActionGroup("home", false, this._translations.home, () => void this._goHome()), this._getActionGroup("plus", false, this._translations.zoomIn, () => void this._zoomIn()), this._getActionGroup("minus", false, this._translations.zoomOut, () => void this._zoomOut()), this._getActionGroup("list", false, this._translations.list, () => this._showList()), this._getActionGroup("magnifying-glass", false, this._translations.search, () => this._search()), this._getActionGroup("expand", false, this._translations.expand, () => this._expand()), this._getActionGroup("basemap", false, this._translations.basemap, () => this._toggleBasemapPicker()))), h("basemap-gallery", { class: basemapClass, mapView: this.mapView, ref: (el) => { this._basemapElement = el; } }), h("map-search", { class: searchClass, mapView: this.mapView, ref: (el) => { this._searchElement = el; }, searchConfiguration: this.searchConfiguration })));
485
+ }
486
+ //--------------------------------------------------------------------------
487
+ //
488
+ // Functions (protected)
489
+ //
490
+ //--------------------------------------------------------------------------
491
+ /**
492
+ * Get a calcite action group for the current action
493
+ *
494
+ * @param icon the icon to display for the current action
495
+ * @param disabled should the action be disabled
496
+ * @param tip information tip to display helpful details to end user
497
+ * @param func the associated onClick function to execute
498
+ *
499
+ * @returns the dom node for the action group
500
+ *
501
+ * @protected
502
+ */
503
+ _getActionGroup(icon, disabled, tip, func) {
504
+ return (h("calcite-action-group", null, h("calcite-action", { alignment: "center", compact: false, disabled: disabled, icon: icon, id: icon, onClick: func, text: "" }, h("calcite-icon", { icon: "cheveron-up", scale: "s", slot: "icon" })), h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": icon }, h("span", null, tip))));
505
+ }
506
+ /**
507
+ * Go to the exent that was first used when loading the map
508
+ *
509
+ * @returns void
510
+ *
511
+ * @protected
512
+ */
513
+ async _goHome() {
514
+ await this.mapView.goTo(this._homeExtent);
515
+ }
516
+ // need to discuss this with the team
517
+ _showList() {
518
+ alert("show list");
519
+ }
520
+ // Need to discuss this with the team
521
+ _search() {
522
+ this._showSearchWidget = !this._showSearchWidget;
523
+ this._showTools = false;
524
+ }
525
+ /**
526
+ * Fixed zoom in
527
+ *
528
+ * @returns void
529
+ *
530
+ * @protected
531
+ */
532
+ async _zoomIn() {
533
+ await this._zoom(this.mapView.zoom + 1);
534
+ }
535
+ /**
536
+ * Fixed zoom out
537
+ *
538
+ * @returns void
539
+ *
540
+ * @protected
541
+ */
542
+ async _zoomOut() {
543
+ await this._zoom(this.mapView.zoom - 1);
544
+ }
545
+ /**
546
+ * Zoom in/out at the maps current center point
547
+ *
548
+ * @param zoom Number to zoom level to go to
549
+ *
550
+ * @returns void
551
+ *
552
+ * @protected
553
+ */
554
+ async _zoom(zoom) {
555
+ var _a;
556
+ await ((_a = this.mapView) === null || _a === void 0 ? void 0 : _a.goTo({
557
+ target: this.mapView.center,
558
+ zoom
559
+ }));
560
+ }
561
+ /**
562
+ * Show/Hide the basemap picker
563
+ *
564
+ * @returns void
565
+ *
566
+ * @protected
567
+ */
568
+ _toggleBasemapPicker() {
569
+ this._showBasemapWidget = !this._showBasemapWidget;
570
+ this._showTools = false;
571
+ }
572
+ /**
573
+ * Emit the expand map event
574
+ *
575
+ * @returns void
576
+ *
577
+ * @protected
578
+ */
579
+ _expand() {
580
+ this.expandMap.emit(EExpandType.EXPAND);
581
+ }
582
+ /**
583
+ * Show/Hide the map tools
584
+ *
585
+ * @returns void
586
+ *
587
+ * @protected
588
+ */
589
+ _toggleTools() {
590
+ if (!this._showTools) {
591
+ this._showBasemapWidget = false;
592
+ this._showSearchWidget = false;
593
+ }
594
+ this._showTools = !this._showTools;
595
+ }
596
+ /**
597
+ * Fetches the component's translations
598
+ *
599
+ * @returns Promise when complete
600
+ * @protected
601
+ */
602
+ async _getTranslations() {
603
+ const messages = await getLocaleComponentStrings(this.el);
604
+ this._translations = messages[0];
605
+ }
606
+ get el() { return getElement(this); }
607
+ static get watchers() { return {
608
+ "mapView": ["mapViewWatchHandler"],
609
+ "_showBasemapWidget": ["_showBasemapWidgetWatchHandler"],
610
+ "_showSearchWidget": ["_showSearchWidgetWatchHandler"]
611
+ }; }
612
+ };
613
+ MapTools.style = mapToolsCss;
614
+
615
+ export { BasemapGallery as basemap_gallery, MapPicker as map_picker, MapSearch as map_search, MapTools as map_tools };