@esri/solutions-components 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -82,6 +82,14 @@ const MapSelectTools = class {
82
82
  }
83
83
  }
84
84
  }
85
+ /**
86
+ * Called each time the mapView prop is changed.
87
+ */
88
+ async mapViewWatchHandler(v, oldV) {
89
+ if (v && v !== oldV) {
90
+ await this._init();
91
+ }
92
+ }
85
93
  /**
86
94
  * Called each time the searchConfiguration prop is changed.
87
95
  *
@@ -89,7 +97,7 @@ const MapSelectTools = class {
89
97
  */
90
98
  async watchSearchConfigurationHandler(newValue, oldValue) {
91
99
  if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
92
- this._initSearchWidget();
100
+ await this._initSearchWidget();
93
101
  }
94
102
  }
95
103
  //--------------------------------------------------------------------------
@@ -173,12 +181,6 @@ const MapSelectTools = class {
173
181
  */
174
182
  async componentDidLoad() {
175
183
  await this._init();
176
- await this._searchWidget.when(() => {
177
- var _a;
178
- this._searchWidget.allPlaceholder = ((_a = this.searchConfiguration) === null || _a === void 0 ? void 0 : _a.allPlaceholder) &&
179
- this.searchConfiguration.allPlaceholder.toLowerCase() !== "find address or place" ?
180
- this.searchConfiguration.allPlaceholder : this._translations.placeholder;
181
- });
182
184
  }
183
185
  /**
184
186
  * Renders the component.
@@ -265,7 +267,7 @@ const MapSelectTools = class {
265
267
  async _init() {
266
268
  this._initGraphicsLayer();
267
269
  await this._initSelectionSet();
268
- this._initSearchWidget();
270
+ await this._initSearchWidget();
269
271
  }
270
272
  /**
271
273
  * Initialize the state of the component with any stored values in a selection set
@@ -311,7 +313,7 @@ const MapSelectTools = class {
311
313
  *
312
314
  * @protected
313
315
  */
314
- _initSearchWidget() {
316
+ async _initSearchWidget() {
315
317
  if (this.mapView && this._searchElement) {
316
318
  const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
317
319
  const searchOptions = Object.assign({ view: this.mapView, container: this._searchElement, searchTerm: this._searchTerm }, searchConfiguration);
@@ -340,6 +342,12 @@ const MapSelectTools = class {
340
342
  void this._clearResults(false, clearLabel);
341
343
  }
342
344
  });
345
+ await this._searchWidget.when(() => {
346
+ var _a;
347
+ this._searchWidget.allPlaceholder = ((_a = this.searchConfiguration) === null || _a === void 0 ? void 0 : _a.allPlaceholder) &&
348
+ this.searchConfiguration.allPlaceholder.toLowerCase() !== "find address or place" ?
349
+ this.searchConfiguration.allPlaceholder : this._translations.placeholder;
350
+ });
343
351
  }
344
352
  }
345
353
  /**
@@ -407,19 +415,21 @@ const MapSelectTools = class {
407
415
  */
408
416
  _initGraphicsLayer() {
409
417
  const title = this._translations.bufferLayer;
410
- const bufferIndex = this.mapView.map.layers.findIndex((l) => l.title === title);
411
- if (bufferIndex > -1) {
412
- this._bufferGraphicsLayer = this.mapView.map.layers.getItemAt(bufferIndex);
413
- }
414
- else {
415
- this._bufferGraphicsLayer = new this.GraphicsLayer({ title, listMode: "hide" });
416
- state.managedLayers.push(title);
417
- const sketchIndex = this.mapView.map.layers.findIndex((l) => l.title === this._translations.sketchLayer);
418
- if (sketchIndex > -1) {
419
- this.mapView.map.layers.add(this._bufferGraphicsLayer, sketchIndex);
418
+ if (this.mapView) {
419
+ const bufferIndex = this.mapView.map.layers.findIndex((l) => l.title === title);
420
+ if (bufferIndex > -1) {
421
+ this._bufferGraphicsLayer = this.mapView.map.layers.getItemAt(bufferIndex);
420
422
  }
421
423
  else {
422
- this.mapView.map.layers.add(this._bufferGraphicsLayer);
424
+ this._bufferGraphicsLayer = new this.GraphicsLayer({ title, listMode: "hide" });
425
+ state.managedLayers.push(title);
426
+ const sketchIndex = this.mapView.map.layers.findIndex((l) => l.title === this._translations.sketchLayer);
427
+ if (sketchIndex > -1) {
428
+ this.mapView.map.layers.add(this._bufferGraphicsLayer, sketchIndex);
429
+ }
430
+ else {
431
+ this.mapView.map.layers.add(this._bufferGraphicsLayer);
432
+ }
423
433
  }
424
434
  }
425
435
  }
@@ -777,6 +787,7 @@ const MapSelectTools = class {
777
787
  get el() { return getElement(this); }
778
788
  static get watchers() { return {
779
789
  "geometries": ["watchGeometriesHandler"],
790
+ "mapView": ["mapViewWatchHandler"],
780
791
  "searchConfiguration": ["watchSearchConfigurationHandler"]
781
792
  }; }
782
793
  };
@@ -78,6 +78,7 @@ const PublicNotification = class {
78
78
  if (v === null || v === void 0 ? void 0 : v.popup) {
79
79
  this._popupsEnabled = v === null || v === void 0 ? void 0 : v.popup.autoOpenEnabled;
80
80
  }
81
+ this._initSearchConfiguration(this.searchConfiguration);
81
82
  }
82
83
  /**
83
84
  * Called each time the searchConfiguration prop is changed.
@@ -86,7 +87,7 @@ const PublicNotification = class {
86
87
  */
87
88
  async watchSearchConfigurationHandler(newValue, oldValue) {
88
89
  const s_newValue = JSON.stringify(newValue);
89
- if (s_newValue !== JSON.stringify(oldValue)) {
90
+ if (this.mapView && (s_newValue !== JSON.stringify(oldValue) || (s_newValue && !this._searchConfiguration))) {
90
91
  this._searchConfiguration = JSON.parse(s_newValue);
91
92
  this.searchConfigurationChange.emit(this._searchConfiguration);
92
93
  // force back to list page before we create Search
@@ -175,6 +176,12 @@ const PublicNotification = class {
175
176
  const headerSlot = this._isMobile ? "footer" : "header";
176
177
  return (h(Host, null, h("calcite-shell", null, h("calcite-action-bar", { class: "border-bottom-1 action-bar-size", "expand-disabled": true, layout: "horizontal", slot: headerSlot }, this._getActionGroup("list-check", EPageType.LIST, this._translations.myLists), this.showRefineSelection ? this._getActionGroup("test-data", EPageType.REFINE, this._translations.refineSelection) : null, this._getActionGroup("export", EPageType.EXPORT, this._translations.export)), this._getPage(this._pageType))));
177
178
  }
179
+ /**
180
+ * StencilJS: Called once just after the component is first loaded.
181
+ */
182
+ async componentDidLoad() {
183
+ this._initSearchConfiguration(this.searchConfiguration);
184
+ }
178
185
  /**
179
186
  * StencilJS: Called every time the component is disconnected from the DOM
180
187
  */
@@ -201,6 +208,22 @@ const PublicNotification = class {
201
208
  this._geometryEngine = geometryEngine;
202
209
  this._jsonUtils = jsonUtils;
203
210
  }
211
+ /**
212
+ * Load the search configuration
213
+ *
214
+ * @returns Promise resolving when function is done
215
+ *
216
+ * @protected
217
+ */
218
+ _initSearchConfiguration(v) {
219
+ if (this.searchConfiguration && !this._searchConfiguration && this.mapView) {
220
+ this._searchConfiguration = v;
221
+ this.searchConfigurationChange.emit(this._searchConfiguration);
222
+ // force back to list page before we create Search
223
+ // https://devtopia.esri.com/WebGIS/arcgis-template-configuration/issues/3402
224
+ void this._home();
225
+ }
226
+ }
204
227
  /**
205
228
  * Initialize the default symbols that will be used when creating new graphics
206
229
  *