@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.
@@ -86,6 +86,14 @@ const MapSelectTools = class {
86
86
  }
87
87
  }
88
88
  }
89
+ /**
90
+ * Called each time the mapView prop is changed.
91
+ */
92
+ async mapViewWatchHandler(v, oldV) {
93
+ if (v && v !== oldV) {
94
+ await this._init();
95
+ }
96
+ }
89
97
  /**
90
98
  * Called each time the searchConfiguration prop is changed.
91
99
  *
@@ -93,7 +101,7 @@ const MapSelectTools = class {
93
101
  */
94
102
  async watchSearchConfigurationHandler(newValue, oldValue) {
95
103
  if (JSON.stringify(newValue) !== JSON.stringify(oldValue)) {
96
- this._initSearchWidget();
104
+ await this._initSearchWidget();
97
105
  }
98
106
  }
99
107
  //--------------------------------------------------------------------------
@@ -177,12 +185,6 @@ const MapSelectTools = class {
177
185
  */
178
186
  async componentDidLoad() {
179
187
  await this._init();
180
- await this._searchWidget.when(() => {
181
- var _a;
182
- this._searchWidget.allPlaceholder = ((_a = this.searchConfiguration) === null || _a === void 0 ? void 0 : _a.allPlaceholder) &&
183
- this.searchConfiguration.allPlaceholder.toLowerCase() !== "find address or place" ?
184
- this.searchConfiguration.allPlaceholder : this._translations.placeholder;
185
- });
186
188
  }
187
189
  /**
188
190
  * Renders the component.
@@ -269,7 +271,7 @@ const MapSelectTools = class {
269
271
  async _init() {
270
272
  this._initGraphicsLayer();
271
273
  await this._initSelectionSet();
272
- this._initSearchWidget();
274
+ await this._initSearchWidget();
273
275
  }
274
276
  /**
275
277
  * Initialize the state of the component with any stored values in a selection set
@@ -315,7 +317,7 @@ const MapSelectTools = class {
315
317
  *
316
318
  * @protected
317
319
  */
318
- _initSearchWidget() {
320
+ async _initSearchWidget() {
319
321
  if (this.mapView && this._searchElement) {
320
322
  const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
321
323
  const searchOptions = Object.assign({ view: this.mapView, container: this._searchElement, searchTerm: this._searchTerm }, searchConfiguration);
@@ -344,6 +346,12 @@ const MapSelectTools = class {
344
346
  void this._clearResults(false, clearLabel);
345
347
  }
346
348
  });
349
+ await this._searchWidget.when(() => {
350
+ var _a;
351
+ this._searchWidget.allPlaceholder = ((_a = this.searchConfiguration) === null || _a === void 0 ? void 0 : _a.allPlaceholder) &&
352
+ this.searchConfiguration.allPlaceholder.toLowerCase() !== "find address or place" ?
353
+ this.searchConfiguration.allPlaceholder : this._translations.placeholder;
354
+ });
347
355
  }
348
356
  }
349
357
  /**
@@ -411,19 +419,21 @@ const MapSelectTools = class {
411
419
  */
412
420
  _initGraphicsLayer() {
413
421
  const title = this._translations.bufferLayer;
414
- const bufferIndex = this.mapView.map.layers.findIndex((l) => l.title === title);
415
- if (bufferIndex > -1) {
416
- this._bufferGraphicsLayer = this.mapView.map.layers.getItemAt(bufferIndex);
417
- }
418
- else {
419
- this._bufferGraphicsLayer = new this.GraphicsLayer({ title, listMode: "hide" });
420
- publicNotificationStore.state.managedLayers.push(title);
421
- const sketchIndex = this.mapView.map.layers.findIndex((l) => l.title === this._translations.sketchLayer);
422
- if (sketchIndex > -1) {
423
- this.mapView.map.layers.add(this._bufferGraphicsLayer, sketchIndex);
422
+ if (this.mapView) {
423
+ const bufferIndex = this.mapView.map.layers.findIndex((l) => l.title === title);
424
+ if (bufferIndex > -1) {
425
+ this._bufferGraphicsLayer = this.mapView.map.layers.getItemAt(bufferIndex);
424
426
  }
425
427
  else {
426
- this.mapView.map.layers.add(this._bufferGraphicsLayer);
428
+ this._bufferGraphicsLayer = new this.GraphicsLayer({ title, listMode: "hide" });
429
+ publicNotificationStore.state.managedLayers.push(title);
430
+ const sketchIndex = this.mapView.map.layers.findIndex((l) => l.title === this._translations.sketchLayer);
431
+ if (sketchIndex > -1) {
432
+ this.mapView.map.layers.add(this._bufferGraphicsLayer, sketchIndex);
433
+ }
434
+ else {
435
+ this.mapView.map.layers.add(this._bufferGraphicsLayer);
436
+ }
427
437
  }
428
438
  }
429
439
  }
@@ -781,6 +791,7 @@ const MapSelectTools = class {
781
791
  get el() { return index.getElement(this); }
782
792
  static get watchers() { return {
783
793
  "geometries": ["watchGeometriesHandler"],
794
+ "mapView": ["mapViewWatchHandler"],
784
795
  "searchConfiguration": ["watchSearchConfigurationHandler"]
785
796
  }; }
786
797
  };
@@ -82,6 +82,7 @@ const PublicNotification = class {
82
82
  if (v === null || v === void 0 ? void 0 : v.popup) {
83
83
  this._popupsEnabled = v === null || v === void 0 ? void 0 : v.popup.autoOpenEnabled;
84
84
  }
85
+ this._initSearchConfiguration(this.searchConfiguration);
85
86
  }
86
87
  /**
87
88
  * Called each time the searchConfiguration prop is changed.
@@ -90,7 +91,7 @@ const PublicNotification = class {
90
91
  */
91
92
  async watchSearchConfigurationHandler(newValue, oldValue) {
92
93
  const s_newValue = JSON.stringify(newValue);
93
- if (s_newValue !== JSON.stringify(oldValue)) {
94
+ if (this.mapView && (s_newValue !== JSON.stringify(oldValue) || (s_newValue && !this._searchConfiguration))) {
94
95
  this._searchConfiguration = JSON.parse(s_newValue);
95
96
  this.searchConfigurationChange.emit(this._searchConfiguration);
96
97
  // force back to list page before we create Search
@@ -179,6 +180,12 @@ const PublicNotification = class {
179
180
  const headerSlot = this._isMobile ? "footer" : "header";
180
181
  return (index.h(index.Host, null, index.h("calcite-shell", null, index.h("calcite-action-bar", { class: "border-bottom-1 action-bar-size", "expand-disabled": true, layout: "horizontal", slot: headerSlot }, this._getActionGroup("list-check", interfaces.EPageType.LIST, this._translations.myLists), this.showRefineSelection ? this._getActionGroup("test-data", interfaces.EPageType.REFINE, this._translations.refineSelection) : null, this._getActionGroup("export", interfaces.EPageType.EXPORT, this._translations.export)), this._getPage(this._pageType))));
181
182
  }
183
+ /**
184
+ * StencilJS: Called once just after the component is first loaded.
185
+ */
186
+ async componentDidLoad() {
187
+ this._initSearchConfiguration(this.searchConfiguration);
188
+ }
182
189
  /**
183
190
  * StencilJS: Called every time the component is disconnected from the DOM
184
191
  */
@@ -205,6 +212,22 @@ const PublicNotification = class {
205
212
  this._geometryEngine = geometryEngine;
206
213
  this._jsonUtils = jsonUtils;
207
214
  }
215
+ /**
216
+ * Load the search configuration
217
+ *
218
+ * @returns Promise resolving when function is done
219
+ *
220
+ * @protected
221
+ */
222
+ _initSearchConfiguration(v) {
223
+ if (this.searchConfiguration && !this._searchConfiguration && this.mapView) {
224
+ this._searchConfiguration = v;
225
+ this.searchConfigurationChange.emit(this._searchConfiguration);
226
+ // force back to list page before we create Search
227
+ // https://devtopia.esri.com/WebGIS/arcgis-template-configuration/issues/3402
228
+ void this._home();
229
+ }
230
+ }
208
231
  /**
209
232
  * Initialize the default symbols that will be used when creating new graphics
210
233
  *