@esri/solutions-components 0.6.6 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
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,321 @@
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
+ /** @license
7
+ * Copyright 2022 Esri
8
+ *
9
+ * Licensed under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an "AS IS" BASIS,
17
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ * See the License for the specific language governing permissions and
19
+ * limitations under the License.
20
+ */
21
+ import { Host, h } from "@stencil/core";
22
+ import { loadModules } from "../../utils/loadModules";
23
+ export class MapSearch {
24
+ constructor() {
25
+ this.mapView = undefined;
26
+ this.popupEnabled = false;
27
+ this.resultGraphicEnabled = false;
28
+ this.searchConfiguration = undefined;
29
+ this.searchTerm = undefined;
30
+ this.searchWidget = undefined;
31
+ }
32
+ //--------------------------------------------------------------------------
33
+ //
34
+ // Watch handlers
35
+ //
36
+ //--------------------------------------------------------------------------
37
+ /**
38
+ * Called each time the searchConfiguration prop is changed.
39
+ *
40
+ * @returns Promise when complete
41
+ */
42
+ async watchSearchConfigurationHandler() {
43
+ this._initSearchWidget();
44
+ }
45
+ /**
46
+ * Called each time the mapView prop is changed.
47
+ *
48
+ * @returns Promise when complete
49
+ */
50
+ async mapViewWatchHandler() {
51
+ await this.mapView.when(() => {
52
+ this._initSearchWidget();
53
+ });
54
+ }
55
+ //--------------------------------------------------------------------------
56
+ //
57
+ // Methods (public)
58
+ //
59
+ //--------------------------------------------------------------------------
60
+ //--------------------------------------------------------------------------
61
+ //
62
+ // Events (public)
63
+ //
64
+ //--------------------------------------------------------------------------
65
+ //--------------------------------------------------------------------------
66
+ //
67
+ // Functions (lifecycle)
68
+ //
69
+ //--------------------------------------------------------------------------
70
+ /**
71
+ * StencilJS: Called once just after the component is first connected to the DOM.
72
+ */
73
+ async componentWillLoad() {
74
+ await this._initModules();
75
+ }
76
+ /**
77
+ * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
78
+ */
79
+ async componentDidLoad() {
80
+ return this._initSearchWidget();
81
+ }
82
+ /**
83
+ * Renders the component.
84
+ */
85
+ render() {
86
+ return (h(Host, null, h("div", { class: "search-widget", ref: (el) => { this._searchElement = el; } })));
87
+ }
88
+ //--------------------------------------------------------------------------
89
+ //
90
+ // Functions (protected)
91
+ //
92
+ //--------------------------------------------------------------------------
93
+ /**
94
+ * Load esri javascript api modules
95
+ *
96
+ * @returns Promise resolving when function is done
97
+ *
98
+ * @protected
99
+ */
100
+ async _initModules() {
101
+ const [Search, FeatureLayer] = await loadModules([
102
+ "esri/widgets/Search",
103
+ "esri/layers/FeatureLayer"
104
+ ]);
105
+ this.Search = Search;
106
+ this.FeatureLayer = FeatureLayer;
107
+ }
108
+ /**
109
+ * Initialize the search widget
110
+ *
111
+ * @protected
112
+ */
113
+ _initSearchWidget() {
114
+ if (this.mapView && this._searchElement && !this.searchWidget) {
115
+ let searchOptions = {
116
+ view: this.mapView,
117
+ container: this._searchElement,
118
+ searchTerm: this.searchTerm
119
+ };
120
+ if (this.searchConfiguration) {
121
+ const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
122
+ searchOptions = Object.assign({}, searchConfiguration);
123
+ }
124
+ this.searchWidget = new this.Search(searchOptions);
125
+ this.searchWidget.popupEnabled = this.popupEnabled;
126
+ this.searchWidget.resultGraphicEnabled = this.resultGraphicEnabled;
127
+ }
128
+ else {
129
+ if (this.searchWidget) {
130
+ this.searchWidget.view = this.mapView;
131
+ }
132
+ }
133
+ }
134
+ /**
135
+ * Initialize the search widget based on user defined configuration
136
+ *
137
+ * @param searchConfiguration search configuration defined by the user
138
+ * @param view the current map view
139
+ *
140
+ * @protected
141
+ */
142
+ _getSearchConfig(searchConfiguration, view) {
143
+ const INCLUDE_DEFAULT_SOURCES = "includeDefaultSources";
144
+ const sources = searchConfiguration.sources;
145
+ if ((sources === null || sources === void 0 ? void 0 : sources.length) > 0) {
146
+ searchConfiguration[INCLUDE_DEFAULT_SOURCES] = false;
147
+ sources.forEach((source) => {
148
+ var _a, _b;
149
+ const isLayerSource = source.hasOwnProperty("layer");
150
+ if (isLayerSource) {
151
+ const layerSource = source;
152
+ const layerId = (_a = layerSource.layer) === null || _a === void 0 ? void 0 : _a.id;
153
+ const layerFromMap = layerId ? view.map.findLayerById(layerId) : null;
154
+ const layerUrl = (_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url;
155
+ if (layerFromMap) {
156
+ layerSource.layer = layerFromMap;
157
+ }
158
+ else if (layerUrl) {
159
+ layerSource.layer = new this.FeatureLayer(layerUrl);
160
+ }
161
+ }
162
+ });
163
+ sources === null || sources === void 0 ? void 0 : sources.forEach((source) => {
164
+ const isLocatorSource = source.hasOwnProperty("locator");
165
+ if (isLocatorSource) {
166
+ const locatorSource = source;
167
+ if ((locatorSource === null || locatorSource === void 0 ? void 0 : locatorSource.name) === "ArcGIS World Geocoding Service") {
168
+ const outFields = locatorSource.outFields || ["Addr_type", "Match_addr", "StAddr", "City"];
169
+ locatorSource.outFields = outFields;
170
+ locatorSource.singleLineFieldName = "SingleLine";
171
+ }
172
+ locatorSource.url = locatorSource.url;
173
+ delete locatorSource.url;
174
+ }
175
+ });
176
+ }
177
+ else {
178
+ searchConfiguration = Object.assign(Object.assign({}, searchConfiguration), { includeDefaultSources: true });
179
+ }
180
+ return searchConfiguration;
181
+ }
182
+ static get is() { return "map-search"; }
183
+ static get encapsulation() { return "shadow"; }
184
+ static get originalStyleUrls() {
185
+ return {
186
+ "$": ["map-search.css"]
187
+ };
188
+ }
189
+ static get styleUrls() {
190
+ return {
191
+ "$": ["map-search.css"]
192
+ };
193
+ }
194
+ static get properties() {
195
+ return {
196
+ "mapView": {
197
+ "type": "unknown",
198
+ "mutable": false,
199
+ "complexType": {
200
+ "original": "__esri.MapView",
201
+ "resolved": "MapView",
202
+ "references": {
203
+ "___esri": {
204
+ "location": "global",
205
+ "id": "global::___esri"
206
+ }
207
+ }
208
+ },
209
+ "required": false,
210
+ "optional": false,
211
+ "docs": {
212
+ "tags": [],
213
+ "text": "esri/views/MapView: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html"
214
+ }
215
+ },
216
+ "popupEnabled": {
217
+ "type": "boolean",
218
+ "mutable": false,
219
+ "complexType": {
220
+ "original": "boolean",
221
+ "resolved": "boolean",
222
+ "references": {}
223
+ },
224
+ "required": false,
225
+ "optional": false,
226
+ "docs": {
227
+ "tags": [],
228
+ "text": "boolean: When true the selected feature popup will be shown when serach result is found"
229
+ },
230
+ "attribute": "popup-enabled",
231
+ "reflect": false,
232
+ "defaultValue": "false"
233
+ },
234
+ "resultGraphicEnabled": {
235
+ "type": "boolean",
236
+ "mutable": false,
237
+ "complexType": {
238
+ "original": "boolean",
239
+ "resolved": "boolean",
240
+ "references": {}
241
+ },
242
+ "required": false,
243
+ "optional": false,
244
+ "docs": {
245
+ "tags": [],
246
+ "text": "boolean: When true a graphic will be added for the search result"
247
+ },
248
+ "attribute": "result-graphic-enabled",
249
+ "reflect": false,
250
+ "defaultValue": "false"
251
+ },
252
+ "searchConfiguration": {
253
+ "type": "unknown",
254
+ "mutable": false,
255
+ "complexType": {
256
+ "original": "ISearchConfiguration",
257
+ "resolved": "ISearchConfiguration",
258
+ "references": {
259
+ "ISearchConfiguration": {
260
+ "location": "import",
261
+ "path": "../../utils/interfaces",
262
+ "id": "src/utils/interfaces.ts::ISearchConfiguration"
263
+ }
264
+ }
265
+ },
266
+ "required": false,
267
+ "optional": false,
268
+ "docs": {
269
+ "tags": [],
270
+ "text": "ISearchConfiguration: Configuration details for the Search widget"
271
+ }
272
+ },
273
+ "searchTerm": {
274
+ "type": "string",
275
+ "mutable": false,
276
+ "complexType": {
277
+ "original": "string",
278
+ "resolved": "string",
279
+ "references": {}
280
+ },
281
+ "required": false,
282
+ "optional": false,
283
+ "docs": {
284
+ "tags": [],
285
+ "text": "string: Text entered by the end user.\r\nUsed to search against the locator."
286
+ },
287
+ "attribute": "search-term",
288
+ "reflect": false
289
+ },
290
+ "searchWidget": {
291
+ "type": "unknown",
292
+ "mutable": false,
293
+ "complexType": {
294
+ "original": "__esri.widgetsSearch",
295
+ "resolved": "widgetsSearch",
296
+ "references": {
297
+ "___esri": {
298
+ "location": "global",
299
+ "id": "global::___esri"
300
+ }
301
+ }
302
+ },
303
+ "required": false,
304
+ "optional": false,
305
+ "docs": {
306
+ "tags": [],
307
+ "text": "esri/widgets/Search: https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html"
308
+ }
309
+ }
310
+ };
311
+ }
312
+ static get watchers() {
313
+ return [{
314
+ "propName": "searchConfiguration",
315
+ "methodName": "watchSearchConfigurationHandler"
316
+ }, {
317
+ "propName": "mapView",
318
+ "methodName": "mapViewWatchHandler"
319
+ }];
320
+ }
321
+ }
@@ -0,0 +1,29 @@
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
+ /** @license
7
+ * Copyright 2022 Esri
8
+ *
9
+ * Licensed under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an "AS IS" BASIS,
17
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ * See the License for the specific language governing permissions and
19
+ * limitations under the License.
20
+ */
21
+ import { newE2EPage } from "@stencil/core/testing";
22
+ xdescribe('map-search', () => {
23
+ it('renders', async () => {
24
+ const page = await newE2EPage();
25
+ await page.setContent('<map-search></map-search>');
26
+ const element = await page.find('map-search');
27
+ expect(element).toHaveClass('hydrated');
28
+ });
29
+ });
@@ -0,0 +1,37 @@
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
+ /** @license
7
+ * Copyright 2022 Esri
8
+ *
9
+ * Licensed under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an "AS IS" BASIS,
17
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ * See the License for the specific language governing permissions and
19
+ * limitations under the License.
20
+ */
21
+ import { newSpecPage } from "@stencil/core/testing";
22
+ import { MapSearch } from "../map-search";
23
+ xdescribe('map-search', () => {
24
+ it('renders', async () => {
25
+ const page = await newSpecPage({
26
+ components: [MapSearch],
27
+ html: `<map-search></map-search>`,
28
+ });
29
+ expect(page.root).toEqualHtml(`
30
+ <map-search>
31
+ <mock:shadow-root>
32
+ <slot></slot>
33
+ </mock:shadow-root>
34
+ </map-search>
35
+ `);
36
+ });
37
+ });
@@ -25,9 +25,53 @@ export class MapTools {
25
25
  constructor() {
26
26
  this.layout = "vertical";
27
27
  this.mapView = undefined;
28
+ this.searchConfiguration = undefined;
28
29
  this._translations = undefined;
29
30
  this._showTools = true;
30
- this._showBasemapPicker = false;
31
+ this._showBasemapWidget = false;
32
+ this._showSearchWidget = false;
33
+ }
34
+ //--------------------------------------------------------------------------
35
+ //
36
+ // Watch handlers
37
+ //
38
+ //--------------------------------------------------------------------------
39
+ /**
40
+ * Store the home extent when the map view changes
41
+ */
42
+ async mapViewWatchHandler() {
43
+ await this.mapView.when(() => {
44
+ this._homeExtent = this.mapView.extent;
45
+ });
46
+ }
47
+ /**
48
+ * When the _showBasemapWidget property is true display the basemap gallery
49
+ */
50
+ async _showBasemapWidgetWatchHandler(v) {
51
+ if (v) {
52
+ this.mapView.ui.add(this._basemapElement.basemapWidget, {
53
+ position: "top-right",
54
+ index: 1
55
+ });
56
+ }
57
+ else {
58
+ this.mapView.ui.remove(this._basemapElement.basemapWidget);
59
+ }
60
+ }
61
+ /**
62
+ * When the _showSearchWidget property is true display the search widget
63
+ */
64
+ async _showSearchWidgetWatchHandler(v) {
65
+ console.log("_showSearchWidget changed");
66
+ if (v) {
67
+ this.mapView.ui.add(this._searchElement.searchWidget, {
68
+ position: "top-right",
69
+ index: 1
70
+ });
71
+ }
72
+ else {
73
+ this.mapView.ui.remove(this._searchElement.searchWidget);
74
+ }
31
75
  }
32
76
  //--------------------------------------------------------------------------
33
77
  //
@@ -46,8 +90,15 @@ export class MapTools {
46
90
  render() {
47
91
  const toggleIcon = this._showTools ? "chevrons-up" : "chevrons-down";
48
92
  const toolsClass = this._showTools ? "" : "display-none";
49
- return (h(Host, null, h("div", { class: "display-flex" }, 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, () => this._goHome()), this._getActionGroup("plus", false, this._translations.zoomIn, () => this._zoomIn()), this._getActionGroup("minus", false, this._translations.zoomOut, () => 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())))));
93
+ const searchClass = this._showSearchWidget ? "" : "display-none";
94
+ const basemapClass = this._showBasemapWidget ? "" : "display-none";
95
+ 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 })));
50
96
  }
97
+ //--------------------------------------------------------------------------
98
+ //
99
+ // Functions (protected)
100
+ //
101
+ //--------------------------------------------------------------------------
51
102
  /**
52
103
  * Get a calcite action group for the current action
53
104
  *
@@ -63,9 +114,15 @@ export class MapTools {
63
114
  _getActionGroup(icon, disabled, tip, func) {
64
115
  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))));
65
116
  }
66
- // Need to discuss this with the team
67
- _goHome() {
68
- alert("go home");
117
+ /**
118
+ * Go to the exent that was first used when loading the map
119
+ *
120
+ * @returns void
121
+ *
122
+ * @protected
123
+ */
124
+ async _goHome() {
125
+ await this.mapView.goTo(this._homeExtent);
69
126
  }
70
127
  // need to discuss this with the team
71
128
  _showList() {
@@ -73,15 +130,44 @@ export class MapTools {
73
130
  }
74
131
  // Need to discuss this with the team
75
132
  _search() {
76
- alert("search");
133
+ this._showSearchWidget = !this._showSearchWidget;
134
+ this._showTools = false;
135
+ }
136
+ /**
137
+ * Fixed zoom in
138
+ *
139
+ * @returns void
140
+ *
141
+ * @protected
142
+ */
143
+ async _zoomIn() {
144
+ await this._zoom(this.mapView.zoom + 1);
77
145
  }
78
- // Need to explore map fixed zoom in considerations
79
- _zoomIn() {
80
- alert("zoom in");
146
+ /**
147
+ * Fixed zoom out
148
+ *
149
+ * @returns void
150
+ *
151
+ * @protected
152
+ */
153
+ async _zoomOut() {
154
+ await this._zoom(this.mapView.zoom - 1);
81
155
  }
82
- // Need to explore map fixed zoom out considerations
83
- _zoomOut() {
84
- alert("zoom out");
156
+ /**
157
+ * Zoom in/out at the maps current center point
158
+ *
159
+ * @param zoom Number to zoom level to go to
160
+ *
161
+ * @returns void
162
+ *
163
+ * @protected
164
+ */
165
+ async _zoom(zoom) {
166
+ var _a;
167
+ await ((_a = this.mapView) === null || _a === void 0 ? void 0 : _a.goTo({
168
+ target: this.mapView.center,
169
+ zoom
170
+ }));
85
171
  }
86
172
  /**
87
173
  * Show/Hide the basemap picker
@@ -91,7 +177,8 @@ export class MapTools {
91
177
  * @protected
92
178
  */
93
179
  _toggleBasemapPicker() {
94
- this._showBasemapPicker = !this._showBasemapPicker;
180
+ this._showBasemapWidget = !this._showBasemapWidget;
181
+ this._showTools = false;
95
182
  }
96
183
  /**
97
184
  * Emit the expand map event
@@ -111,6 +198,10 @@ export class MapTools {
111
198
  * @protected
112
199
  */
113
200
  _toggleTools() {
201
+ if (!this._showTools) {
202
+ this._showBasemapWidget = false;
203
+ this._showSearchWidget = false;
204
+ }
114
205
  this._showTools = !this._showTools;
115
206
  }
116
207
  /**
@@ -174,6 +265,27 @@ export class MapTools {
174
265
  "tags": [],
175
266
  "text": "esri/views/View: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html"
176
267
  }
268
+ },
269
+ "searchConfiguration": {
270
+ "type": "unknown",
271
+ "mutable": false,
272
+ "complexType": {
273
+ "original": "ISearchConfiguration",
274
+ "resolved": "ISearchConfiguration",
275
+ "references": {
276
+ "ISearchConfiguration": {
277
+ "location": "import",
278
+ "path": "../../utils/interfaces",
279
+ "id": "src/utils/interfaces.ts::ISearchConfiguration"
280
+ }
281
+ }
282
+ },
283
+ "required": false,
284
+ "optional": false,
285
+ "docs": {
286
+ "tags": [],
287
+ "text": "ISearchConfiguration: Configuration details for the Search widget"
288
+ }
177
289
  }
178
290
  };
179
291
  }
@@ -181,7 +293,8 @@ export class MapTools {
181
293
  return {
182
294
  "_translations": {},
183
295
  "_showTools": {},
184
- "_showBasemapPicker": {}
296
+ "_showBasemapWidget": {},
297
+ "_showSearchWidget": {}
185
298
  };
186
299
  }
187
300
  static get events() {
@@ -209,4 +322,16 @@ export class MapTools {
209
322
  }];
210
323
  }
211
324
  static get elementRef() { return "el"; }
325
+ static get watchers() {
326
+ return [{
327
+ "propName": "mapView",
328
+ "methodName": "mapViewWatchHandler"
329
+ }, {
330
+ "propName": "_showBasemapWidget",
331
+ "methodName": "_showBasemapWidgetWatchHandler"
332
+ }, {
333
+ "propName": "_showSearchWidget",
334
+ "methodName": "_showSearchWidgetWatchHandler"
335
+ }];
336
+ }
212
337
  }
@@ -83,6 +83,9 @@
83
83
  demo.mapInfos = [
84
84
  ...custom,
85
85
  ...[{
86
+ id: "ce3dec81bf714d3bb71da9691ab686d1",
87
+ name: "Popup Configured Map"
88
+ }, {
86
89
  id: "863e4f6f2a7840db896cc1b1606d552d",
87
90
  name: "IA map"
88
91
  }, {
@@ -94,9 +97,6 @@
94
97
  }, {
95
98
  id: "f5b01c17a09941eaad63e7b4e6c7d880",
96
99
  name: "Attachments Map"
97
- }, {
98
- id: "ce3dec81bf714d3bb71da9691ab686d1",
99
- name: "Popup Configured Map"
100
100
  }]
101
101
  ];
102
102
  }
@@ -446,6 +446,8 @@ export interface IMediaCardValues {
446
446
  export interface IMapInfo {
447
447
  id: string;
448
448
  name: string;
449
+ searchConfiguration?: ISearchConfiguration;
450
+ filters?: any[]; // TODO generate an interface for this once we know how it will be passed in
449
451
  }
450
452
 
451
453
  export interface IExportInfos {
@@ -296,5 +296,6 @@ function defineCustomElement() {
296
296
  break;
297
297
  } });
298
298
  }
299
+ defineCustomElement();
299
300
 
300
301
  export { ActionBar as A, defineCustomElement as d };
@@ -173,5 +173,6 @@ function defineCustomElement() {
173
173
  break;
174
174
  } });
175
175
  }
176
+ defineCustomElement();
176
177
 
177
178
  export { ActionGroup as A, SLOTS as S, defineCustomElement as d };
@@ -342,5 +342,6 @@ function defineCustomElement() {
342
342
  break;
343
343
  } });
344
344
  }
345
+ defineCustomElement();
345
346
 
346
347
  export { ActionMenu as A, SLOTS as S, defineCustomElement as d };
@@ -221,5 +221,6 @@ function defineCustomElement() {
221
221
  break;
222
222
  } });
223
223
  }
224
+ defineCustomElement();
224
225
 
225
226
  export { Action as A, defineCustomElement as d };
@@ -322,5 +322,6 @@ function defineCustomElement() {
322
322
  break;
323
323
  } });
324
324
  }
325
+ defineCustomElement();
325
326
 
326
327
  export { Alert as A, defineCustomElement as d };
@@ -169,5 +169,6 @@ function defineCustomElement() {
169
169
  break;
170
170
  } });
171
171
  }
172
+ defineCustomElement();
172
173
 
173
174
  export { Avatar as A, defineCustomElement as d };