@esri/solutions-components 0.10.20 → 0.10.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. package/dist/cjs/calcite-alert_5.cjs.entry.js +6 -2
  2. package/dist/cjs/crowdsource-manager.cjs.entry.js +17 -3
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/map-select-tools_3.cjs.entry.js +78 -21
  5. package/dist/cjs/public-notification.cjs.entry.js +3 -3
  6. package/dist/cjs/solutions-components.cjs.js +1 -1
  7. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +37 -4
  8. package/dist/collection/components/edit-card/edit-card.js +6 -2
  9. package/dist/collection/components/map-select-tools/map-select-tools.js +78 -21
  10. package/dist/collection/components/public-notification/public-notification.js +5 -5
  11. package/dist/components/crowdsource-manager.js +20 -4
  12. package/dist/components/edit-card2.js +6 -2
  13. package/dist/components/map-select-tools2.js +78 -21
  14. package/dist/components/public-notification.js +3 -3
  15. package/dist/esm/calcite-alert_5.entry.js +6 -2
  16. package/dist/esm/crowdsource-manager.entry.js +17 -3
  17. package/dist/esm/loader.js +1 -1
  18. package/dist/esm/map-select-tools_3.entry.js +78 -21
  19. package/dist/esm/public-notification.entry.js +3 -3
  20. package/dist/esm/solutions-components.js +1 -1
  21. package/dist/solutions-components/{p-4c88578a.entry.js → p-5067d77e.entry.js} +1 -1
  22. package/dist/solutions-components/{p-9fed495d.entry.js → p-a85fd786.entry.js} +1 -1
  23. package/dist/solutions-components/p-bd2278cf.entry.js +6 -0
  24. package/dist/solutions-components/p-cd5a9034.entry.js +6 -0
  25. package/dist/solutions-components/solutions-components.esm.js +1 -1
  26. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +8 -0
  27. package/dist/types/components/edit-card/edit-card.d.ts +3 -1
  28. package/dist/types/components/map-select-tools/map-select-tools.d.ts +22 -0
  29. package/dist/types/components.d.ts +8 -0
  30. package/package.json +1 -1
  31. package/dist/solutions-components/p-5612aa0c.entry.js +0 -6
  32. package/dist/solutions-components/p-bde2619f.entry.js +0 -6
@@ -60,6 +60,10 @@ const MapSelectTools = class {
60
60
  // Properties (protected)
61
61
  //
62
62
  //--------------------------------------------------------------------------
63
+ /**
64
+ * esri/request: https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html
65
+ */
66
+ _esriRequest;
63
67
  /**
64
68
  * esri/layers/FeatureLayer: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html
65
69
  */
@@ -289,7 +293,7 @@ const MapSelectTools = class {
289
293
  render() {
290
294
  const mapToolsClass = this.enableSketchTools ? "" : "display-none";
291
295
  const mapToolsContainerClass = this.enableSketchTools ? "padding-top-1" : "";
292
- return (h(Host, { key: 'd9b4042323733785938a45be76688099b8a81b23' }, this._getMapLayerPicker(), h("div", { key: 'd468cd2df9971c02909fd0bc9603603bb213164f', class: "border-bottom" }), h("div", { key: '8cecea0a4387371c3af1ea76bbafd1cf7f205d77', class: "padding-top-sides-1" }, h("div", { key: 'd5364d20f014611ca73bbe1bc5b638aaa8e38738', class: "search-widget", ref: (el) => { this._searchElement = el; } }), h("div", { key: '2c1f16ce050e934e8dbd25a0ef430d8590438ce5', class: mapToolsContainerClass }, h("map-draw-tools", { key: '256ee8262662c1c54cee34bdc084e7555e3985c6', active: true, class: mapToolsClass, editGraphicsEnabled: !this._useLayerFeaturesEnabled, graphics: this._graphics, mapView: this.mapView, onSketchGraphicsChange: (evt) => void this._sketchGraphicsChanged(evt), pointSymbol: this.sketchPointSymbol, polygonSymbol: this.sketchPolygonSymbol, polylineSymbol: this.sketchLineSymbol, ref: (el) => { this._drawTools = el; } })), this.enableSearchDistance ? this._getBufferOptions() : undefined, this.enableLayerFeatures ? this._getUseLayerFeaturesOptions() : undefined, this._getNumSelected()), h("div", { key: '92859f6a60356d7ddc0b5530a06e181d67f3274b', class: "border-bottom" }), this._getNameInput()));
296
+ return (h(Host, { key: '6753158d00a33dd5dfbb1f22cc27388baf4c0b5e' }, this._getMapLayerPicker(), h("div", { key: '082c6be48d3dfbe2e39be2c462959c7772a91d40', class: "border-bottom" }), h("div", { key: '0e8133a809b05bef34c2f19adeff43c1e57cc002', class: "padding-top-sides-1" }, h("div", { key: '4434b5b4d073f3ba9a7e44b82078b9b81733025b', class: "search-widget", ref: (el) => { this._searchElement = el; } }), h("div", { key: '6f01e27e06ea365de6ff98df3f9edd973d87117c', class: mapToolsContainerClass }, h("map-draw-tools", { key: '24ffe562d080955f2aacfd080c0baa1997f8eaab', active: true, class: mapToolsClass, editGraphicsEnabled: !this._useLayerFeaturesEnabled, graphics: this._graphics, mapView: this.mapView, onSketchGraphicsChange: (evt) => void this._sketchGraphicsChanged(evt), pointSymbol: this.sketchPointSymbol, polygonSymbol: this.sketchPolygonSymbol, polylineSymbol: this.sketchLineSymbol, ref: (el) => { this._drawTools = el; } })), this.enableSearchDistance ? this._getBufferOptions() : undefined, this.enableLayerFeatures ? this._getUseLayerFeaturesOptions() : undefined, this._getNumSelected()), h("div", { key: '4c7cf401b5bcc7e4adef34e140d22676fce8ebbc', class: "border-bottom" }), this._getNameInput()));
293
297
  }
294
298
  /**
295
299
  * Renders the buffer tools component.
@@ -356,13 +360,15 @@ const MapSelectTools = class {
356
360
  * @protected
357
361
  */
358
362
  async _initModules() {
359
- const [GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await loadModules([
363
+ const [esriRequest, GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await loadModules([
364
+ "esri/request",
360
365
  "esri/layers/GraphicsLayer",
361
366
  "esri/Graphic",
362
367
  "esri/widgets/Search",
363
368
  "esri/geometry/geometryEngine",
364
369
  "esri/layers/FeatureLayer"
365
370
  ]);
371
+ this._esriRequest = esriRequest;
366
372
  this.GraphicsLayer = GraphicsLayer;
367
373
  this.Graphic = Graphic;
368
374
  this.Search = Search;
@@ -439,25 +445,7 @@ const MapSelectTools = class {
439
445
  void this._clearResults(false, clearLabel);
440
446
  });
441
447
  this._searchWidget.on("select-result", (searchResults) => {
442
- if (searchResults.result) {
443
- this._searchResult = searchResults.result;
444
- const resultFeature = searchResults.result.feature;
445
- const resultLayer = resultFeature?.layer;
446
- const selectLayer = this.selectLayerView.layer;
447
- const oid = resultFeature?.getObjectId();
448
- const useOIDs = resultLayer?.url && selectLayer?.url && resultLayer.url === selectLayer.url && !isNaN(oid);
449
- const oids = useOIDs ? [oid] : undefined;
450
- this._workflowType = EWorkflowType.SEARCH;
451
- void this._updateLabel();
452
- const graphics = [searchResults.result.feature];
453
- this._updateSelection(graphics, useOIDs, oids);
454
- this._drawTools.graphics = graphics;
455
- this._searchWidget.resultGraphic.visible = false;
456
- }
457
- else {
458
- const clearLabel = this._searchClearLabel();
459
- void this._clearResults(false, clearLabel);
460
- }
448
+ void this._selectResult(searchResults.result);
461
449
  });
462
450
  await this._searchWidget.when(() => {
463
451
  this._searchWidget.allPlaceholder = this.searchConfiguration?.allPlaceholder &&
@@ -466,6 +454,75 @@ const MapSelectTools = class {
466
454
  });
467
455
  }
468
456
  }
457
+ /**
458
+ * Handle the result from the search widget.
459
+ *
460
+ * @param url the url of the layer view
461
+ *
462
+ * @returns the url of the views source
463
+ * @protected
464
+ */
465
+ async _selectResult(result) {
466
+ if (result) {
467
+ this._searchResult = result;
468
+ const resultFeature = result.feature;
469
+ const resultLayer = resultFeature?.layer;
470
+ const selectLayer = this.selectLayerView.layer;
471
+ const oid = resultFeature?.getObjectId();
472
+ let resultLayerSourceUrl;
473
+ if (resultLayer.sourceJSON?.isView) {
474
+ resultLayerSourceUrl = await this._getViewSourceUrl(resultLayer.url);
475
+ }
476
+ let selectLayerSourceUrl;
477
+ if (selectLayer.sourceJSON?.isView) {
478
+ selectLayerSourceUrl = await this._getViewSourceUrl(selectLayer.url);
479
+ }
480
+ const rUrl = resultLayer?.url?.toLowerCase();
481
+ const rSourceUrl = resultLayerSourceUrl?.toLowerCase();
482
+ const sUrl = selectLayer?.url?.toLowerCase();
483
+ const sSourceUrl = selectLayerSourceUrl?.toLowerCase();
484
+ const useOIDs = rUrl && sUrl &&
485
+ (rUrl === sUrl || rUrl === sSourceUrl || rSourceUrl === sUrl || rSourceUrl === sSourceUrl) &&
486
+ !isNaN(oid);
487
+ const oids = useOIDs ? [oid] : undefined;
488
+ this._workflowType = EWorkflowType.SEARCH;
489
+ void this._updateLabel();
490
+ const graphics = [result.feature];
491
+ this._updateSelection(graphics, useOIDs, oids);
492
+ this._drawTools.graphics = graphics;
493
+ this._searchWidget.resultGraphic.visible = false;
494
+ }
495
+ else {
496
+ const clearLabel = this._searchClearLabel();
497
+ void this._clearResults(false, clearLabel);
498
+ }
499
+ }
500
+ /**
501
+ * Get the source url for a view. This function supports single source views only.
502
+ *
503
+ * @param url the url of the layer view
504
+ *
505
+ * @returns the url of the views source
506
+ * @protected
507
+ */
508
+ async _getViewSourceUrl(url) {
509
+ let sourceUrl = "";
510
+ const resultLayerSourcesUrl = `${url}/sources?f=json`;
511
+ try {
512
+ const request = await this._esriRequest(resultLayerSourcesUrl, {
513
+ query: {
514
+ f: "json"
515
+ }
516
+ });
517
+ if (request?.data?.services?.length === 1) {
518
+ sourceUrl = request.data.services[0].url;
519
+ }
520
+ }
521
+ catch (error) {
522
+ console.log(error);
523
+ }
524
+ return sourceUrl;
525
+ }
469
526
  /**
470
527
  * Check if the current label should be cleared
471
528
  *
@@ -32,9 +32,9 @@ const PublicNotification = class {
32
32
  this.defaultExportTitle = "";
33
33
  this.defaultNumLabelsPerPage = 6;
34
34
  this.enableLayerFeatures = true;
35
- this.enableLayerFeaturesOnLoad = true;
35
+ this.enableLayerFeaturesOnLoad = false;
36
36
  this.enableSearchDistance = true;
37
- this.enableSearchDistanceOnLoad = true;
37
+ this.enableSearchDistanceOnLoad = false;
38
38
  this.enableSketchTools = true;
39
39
  this.featureEffect = undefined;
40
40
  this.featureHighlightEnabled = undefined;
@@ -255,7 +255,7 @@ const PublicNotification = class {
255
255
  */
256
256
  render() {
257
257
  const headerSlot = this._isMobile ? "footer" : "header";
258
- return (h(Host, { key: '5473fef09cfb2a8870f8e03f263f4d003c6768e4' }, h("calcite-shell", { key: '4ecd592093267c886138b79b2ebb1b4b2e913463' }, h("calcite-action-bar", { key: 'e427d8982bc5e68d9b5430875b9079a0ce43e02b', 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))));
258
+ return (h(Host, { key: '019074cdfaddd8121a6ed255f42dea427aac9440' }, h("calcite-shell", { key: 'ece21e206f6519627bc8f139c35f68838eb701a2' }, h("calcite-action-bar", { key: '92883d5df9fcf43584f3934bf7f61640afed2bdb', 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))));
259
259
  }
260
260
  /**
261
261
  * StencilJS: Called once just after the component is first loaded.