@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
@@ -64,6 +64,10 @@ const MapSelectTools = class {
64
64
  // Properties (protected)
65
65
  //
66
66
  //--------------------------------------------------------------------------
67
+ /**
68
+ * esri/request: https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html
69
+ */
70
+ _esriRequest;
67
71
  /**
68
72
  * esri/layers/FeatureLayer: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html
69
73
  */
@@ -293,7 +297,7 @@ const MapSelectTools = class {
293
297
  render() {
294
298
  const mapToolsClass = this.enableSketchTools ? "" : "display-none";
295
299
  const mapToolsContainerClass = this.enableSketchTools ? "padding-top-1" : "";
296
- return (index.h(index.Host, { key: 'd9b4042323733785938a45be76688099b8a81b23' }, this._getMapLayerPicker(), index.h("div", { key: 'd468cd2df9971c02909fd0bc9603603bb213164f', class: "border-bottom" }), index.h("div", { key: '8cecea0a4387371c3af1ea76bbafd1cf7f205d77', class: "padding-top-sides-1" }, index.h("div", { key: 'd5364d20f014611ca73bbe1bc5b638aaa8e38738', class: "search-widget", ref: (el) => { this._searchElement = el; } }), index.h("div", { key: '2c1f16ce050e934e8dbd25a0ef430d8590438ce5', class: mapToolsContainerClass }, index.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()), index.h("div", { key: '92859f6a60356d7ddc0b5530a06e181d67f3274b', class: "border-bottom" }), this._getNameInput()));
300
+ return (index.h(index.Host, { key: '6753158d00a33dd5dfbb1f22cc27388baf4c0b5e' }, this._getMapLayerPicker(), index.h("div", { key: '082c6be48d3dfbe2e39be2c462959c7772a91d40', class: "border-bottom" }), index.h("div", { key: '0e8133a809b05bef34c2f19adeff43c1e57cc002', class: "padding-top-sides-1" }, index.h("div", { key: '4434b5b4d073f3ba9a7e44b82078b9b81733025b', class: "search-widget", ref: (el) => { this._searchElement = el; } }), index.h("div", { key: '6f01e27e06ea365de6ff98df3f9edd973d87117c', class: mapToolsContainerClass }, index.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()), index.h("div", { key: '4c7cf401b5bcc7e4adef34e140d22676fce8ebbc', class: "border-bottom" }), this._getNameInput()));
297
301
  }
298
302
  /**
299
303
  * Renders the buffer tools component.
@@ -360,13 +364,15 @@ const MapSelectTools = class {
360
364
  * @protected
361
365
  */
362
366
  async _initModules() {
363
- const [GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await locale.loadModules([
367
+ const [esriRequest, GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await locale.loadModules([
368
+ "esri/request",
364
369
  "esri/layers/GraphicsLayer",
365
370
  "esri/Graphic",
366
371
  "esri/widgets/Search",
367
372
  "esri/geometry/geometryEngine",
368
373
  "esri/layers/FeatureLayer"
369
374
  ]);
375
+ this._esriRequest = esriRequest;
370
376
  this.GraphicsLayer = GraphicsLayer;
371
377
  this.Graphic = Graphic;
372
378
  this.Search = Search;
@@ -443,25 +449,7 @@ const MapSelectTools = class {
443
449
  void this._clearResults(false, clearLabel);
444
450
  });
445
451
  this._searchWidget.on("select-result", (searchResults) => {
446
- if (searchResults.result) {
447
- this._searchResult = searchResults.result;
448
- const resultFeature = searchResults.result.feature;
449
- const resultLayer = resultFeature?.layer;
450
- const selectLayer = this.selectLayerView.layer;
451
- const oid = resultFeature?.getObjectId();
452
- const useOIDs = resultLayer?.url && selectLayer?.url && resultLayer.url === selectLayer.url && !isNaN(oid);
453
- const oids = useOIDs ? [oid] : undefined;
454
- this._workflowType = interfaces.EWorkflowType.SEARCH;
455
- void this._updateLabel();
456
- const graphics = [searchResults.result.feature];
457
- this._updateSelection(graphics, useOIDs, oids);
458
- this._drawTools.graphics = graphics;
459
- this._searchWidget.resultGraphic.visible = false;
460
- }
461
- else {
462
- const clearLabel = this._searchClearLabel();
463
- void this._clearResults(false, clearLabel);
464
- }
452
+ void this._selectResult(searchResults.result);
465
453
  });
466
454
  await this._searchWidget.when(() => {
467
455
  this._searchWidget.allPlaceholder = this.searchConfiguration?.allPlaceholder &&
@@ -470,6 +458,75 @@ const MapSelectTools = class {
470
458
  });
471
459
  }
472
460
  }
461
+ /**
462
+ * Handle the result from the search widget.
463
+ *
464
+ * @param url the url of the layer view
465
+ *
466
+ * @returns the url of the views source
467
+ * @protected
468
+ */
469
+ async _selectResult(result) {
470
+ if (result) {
471
+ this._searchResult = result;
472
+ const resultFeature = result.feature;
473
+ const resultLayer = resultFeature?.layer;
474
+ const selectLayer = this.selectLayerView.layer;
475
+ const oid = resultFeature?.getObjectId();
476
+ let resultLayerSourceUrl;
477
+ if (resultLayer.sourceJSON?.isView) {
478
+ resultLayerSourceUrl = await this._getViewSourceUrl(resultLayer.url);
479
+ }
480
+ let selectLayerSourceUrl;
481
+ if (selectLayer.sourceJSON?.isView) {
482
+ selectLayerSourceUrl = await this._getViewSourceUrl(selectLayer.url);
483
+ }
484
+ const rUrl = resultLayer?.url?.toLowerCase();
485
+ const rSourceUrl = resultLayerSourceUrl?.toLowerCase();
486
+ const sUrl = selectLayer?.url?.toLowerCase();
487
+ const sSourceUrl = selectLayerSourceUrl?.toLowerCase();
488
+ const useOIDs = rUrl && sUrl &&
489
+ (rUrl === sUrl || rUrl === sSourceUrl || rSourceUrl === sUrl || rSourceUrl === sSourceUrl) &&
490
+ !isNaN(oid);
491
+ const oids = useOIDs ? [oid] : undefined;
492
+ this._workflowType = interfaces.EWorkflowType.SEARCH;
493
+ void this._updateLabel();
494
+ const graphics = [result.feature];
495
+ this._updateSelection(graphics, useOIDs, oids);
496
+ this._drawTools.graphics = graphics;
497
+ this._searchWidget.resultGraphic.visible = false;
498
+ }
499
+ else {
500
+ const clearLabel = this._searchClearLabel();
501
+ void this._clearResults(false, clearLabel);
502
+ }
503
+ }
504
+ /**
505
+ * Get the source url for a view. This function supports single source views only.
506
+ *
507
+ * @param url the url of the layer view
508
+ *
509
+ * @returns the url of the views source
510
+ * @protected
511
+ */
512
+ async _getViewSourceUrl(url) {
513
+ let sourceUrl = "";
514
+ const resultLayerSourcesUrl = `${url}/sources?f=json`;
515
+ try {
516
+ const request = await this._esriRequest(resultLayerSourcesUrl, {
517
+ query: {
518
+ f: "json"
519
+ }
520
+ });
521
+ if (request?.data?.services?.length === 1) {
522
+ sourceUrl = request.data.services[0].url;
523
+ }
524
+ }
525
+ catch (error) {
526
+ console.log(error);
527
+ }
528
+ return sourceUrl;
529
+ }
473
530
  /**
474
531
  * Check if the current label should be cleared
475
532
  *
@@ -36,9 +36,9 @@ const PublicNotification = class {
36
36
  this.defaultExportTitle = "";
37
37
  this.defaultNumLabelsPerPage = 6;
38
38
  this.enableLayerFeatures = true;
39
- this.enableLayerFeaturesOnLoad = true;
39
+ this.enableLayerFeaturesOnLoad = false;
40
40
  this.enableSearchDistance = true;
41
- this.enableSearchDistanceOnLoad = true;
41
+ this.enableSearchDistanceOnLoad = false;
42
42
  this.enableSketchTools = true;
43
43
  this.featureEffect = undefined;
44
44
  this.featureHighlightEnabled = undefined;
@@ -259,7 +259,7 @@ const PublicNotification = class {
259
259
  */
260
260
  render() {
261
261
  const headerSlot = this._isMobile ? "footer" : "header";
262
- return (index.h(index.Host, { key: '5473fef09cfb2a8870f8e03f263f4d003c6768e4' }, index.h("calcite-shell", { key: '4ecd592093267c886138b79b2ebb1b4b2e913463' }, index.h("calcite-action-bar", { key: 'e427d8982bc5e68d9b5430875b9079a0ce43e02b', 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))));
262
+ return (index.h(index.Host, { key: '019074cdfaddd8121a6ed255f42dea427aac9440' }, index.h("calcite-shell", { key: 'ece21e206f6519627bc8f139c35f68838eb701a2' }, index.h("calcite-action-bar", { key: '92883d5df9fcf43584f3934bf7f61640afed2bdb', 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))));
263
263
  }
264
264
  /**
265
265
  * StencilJS: Called once just after the component is first loaded.