@esri/solutions-components 0.8.4 → 0.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/assets/t9n/crowdsource-reporter/resources.json +5 -6
  2. package/dist/assets/t9n/crowdsource-reporter/resources_en.json +5 -6
  3. package/dist/assets/t9n/feature-list/resources.json +1 -1
  4. package/dist/assets/t9n/feature-list/resources_en.json +1 -1
  5. package/dist/assets/t9n/public-notification/resources.json +3 -1
  6. package/dist/assets/t9n/public-notification/resources_en.json +3 -1
  7. package/dist/cjs/buffer-tools_3.cjs.entry.js +2 -2
  8. package/dist/cjs/calcite-alert_4.cjs.entry.js +2 -2
  9. package/dist/cjs/calcite-combobox_5.cjs.entry.js +2 -2
  10. package/dist/cjs/calcite-flow_5.cjs.entry.js +163 -16
  11. package/dist/cjs/card-manager_3.cjs.entry.js +41 -2
  12. package/dist/cjs/crowdsource-manager.cjs.entry.js +2 -1
  13. package/dist/cjs/crowdsource-reporter.cjs.entry.js +120 -38
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/cjs/map-select-tools_3.cjs.entry.js +2 -2
  16. package/dist/cjs/public-notification.cjs.entry.js +110 -4
  17. package/dist/cjs/{publicNotificationStore-ef379d11.js → publicNotificationStore-e790601d.js} +2 -2
  18. package/dist/cjs/solutions-components.cjs.js +1 -1
  19. package/dist/collection/collection-manifest.json +1 -1
  20. package/dist/collection/components/create-feature/create-feature.css +9 -0
  21. package/dist/collection/components/create-feature/create-feature.js +134 -6
  22. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +19 -1
  23. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +5 -0
  24. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +120 -38
  25. package/dist/collection/components/feature-list/feature-list.js +93 -5
  26. package/dist/collection/components/info-card/info-card.css +1 -1
  27. package/dist/collection/components/info-card/info-card.js +1 -1
  28. package/dist/collection/components/layer-list/layer-list.js +6 -6
  29. package/dist/collection/components/map-card/map-card.js +27 -2
  30. package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
  31. package/dist/collection/components/map-layer-picker/map-layer-picker.js +1 -1
  32. package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
  33. package/dist/collection/components/public-notification/public-notification.js +110 -3
  34. package/dist/collection/demos/crowdsource-reporter.html +1 -1
  35. package/dist/collection/utils/interfaces.ts +7 -0
  36. package/dist/collection/utils/publicNotificationStore.js +2 -2
  37. package/dist/collection/utils/publicNotificationStore.ts +3 -2
  38. package/dist/components/create-feature2.js +111 -7
  39. package/dist/components/crowdsource-manager.js +3 -1
  40. package/dist/components/crowdsource-reporter.js +121 -39
  41. package/dist/components/feature-list2.js +54 -6
  42. package/dist/components/info-card2.js +2 -2
  43. package/dist/components/layer-list2.js +6 -6
  44. package/dist/components/map-card2.js +42 -2
  45. package/dist/components/map-draw-tools2.js +1 -1
  46. package/dist/components/map-layer-picker2.js +1 -1
  47. package/dist/components/map-select-tools2.js +1 -1
  48. package/dist/components/public-notification.js +110 -3
  49. package/dist/components/publicNotificationStore.js +2 -2
  50. package/dist/esm/buffer-tools_3.entry.js +2 -2
  51. package/dist/esm/calcite-alert_4.entry.js +3 -3
  52. package/dist/esm/calcite-combobox_5.entry.js +3 -3
  53. package/dist/esm/calcite-flow_5.entry.js +164 -17
  54. package/dist/esm/card-manager_3.entry.js +43 -4
  55. package/dist/esm/crowdsource-manager.entry.js +3 -2
  56. package/dist/esm/crowdsource-reporter.entry.js +121 -39
  57. package/dist/esm/{downloadUtils-0c13073b.js → downloadUtils-0c1e4d7b.js} +2 -2
  58. package/dist/esm/{index.es-ad250bc6.js → index.es-286e3cfa.js} +2 -2
  59. package/dist/esm/loader.js +1 -1
  60. package/dist/esm/map-select-tools_3.entry.js +4 -4
  61. package/dist/esm/{mapViewUtils-20504620.js → mapViewUtils-253178f1.js} +1 -1
  62. package/dist/esm/public-notification.entry.js +112 -6
  63. package/dist/esm/{publicNotificationStore-3bf4de75.js → publicNotificationStore-223faed2.js} +2 -2
  64. package/dist/esm/solutions-components.js +1 -1
  65. package/dist/solutions-components/demos/crowdsource-reporter.html +1 -1
  66. package/dist/solutions-components/p-15f9624a.entry.js +6 -0
  67. package/dist/solutions-components/{p-955647ea.entry.js → p-1ea5e061.entry.js} +2 -2
  68. package/dist/solutions-components/{p-590a2a26.js → p-212b02e7.js} +1 -1
  69. package/dist/solutions-components/p-238d3b5f.entry.js +6 -0
  70. package/dist/solutions-components/p-273d833b.entry.js +6 -0
  71. package/dist/solutions-components/{p-cc280aa1.js → p-322868ec.js} +1 -1
  72. package/dist/solutions-components/{p-1d3a1794.js → p-331b5d1e.js} +2 -2
  73. package/dist/solutions-components/{p-c897e3eb.js → p-3af79063.js} +1 -1
  74. package/dist/solutions-components/p-45ed16d5.entry.js +6 -0
  75. package/dist/solutions-components/p-80b11ec1.entry.js +17 -0
  76. package/dist/solutions-components/{p-5c7e3941.entry.js → p-813fd8a4.entry.js} +2 -2
  77. package/dist/solutions-components/{p-ff302d95.entry.js → p-d136eab0.entry.js} +2 -2
  78. package/dist/solutions-components/p-e0446d5b.entry.js +6 -0
  79. package/dist/solutions-components/solutions-components.esm.js +1 -1
  80. package/dist/solutions-components/utils/interfaces.ts +7 -0
  81. package/dist/solutions-components/utils/publicNotificationStore.ts +3 -2
  82. package/dist/types/components/create-feature/create-feature.d.ts +43 -1
  83. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +4 -0
  84. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +31 -10
  85. package/dist/types/components/feature-list/feature-list.d.ts +31 -0
  86. package/dist/types/components/layer-list/layer-list.d.ts +3 -3
  87. package/dist/types/components/map-card/map-card.d.ts +8 -0
  88. package/dist/types/components/public-notification/public-notification.d.ts +48 -0
  89. package/dist/types/components.d.ts +37 -0
  90. package/dist/types/utils/interfaces.d.ts +6 -0
  91. package/dist/types/utils/publicNotificationStore.d.ts +2 -1
  92. package/package.json +2 -1
  93. package/dist/solutions-components/p-6512dc44.entry.js +0 -6
  94. package/dist/solutions-components/p-65ad1625.entry.js +0 -6
  95. package/dist/solutions-components/p-989bf0bf.entry.js +0 -6
  96. package/dist/solutions-components/p-a0611720.entry.js +0 -6
  97. package/dist/solutions-components/p-efe1694a.entry.js +0 -17
  98. package/dist/solutions-components/p-f3467807.entry.js +0 -6
@@ -12,7 +12,7 @@ import { c as connectLocalized, d as disconnectLocalized } from './locale-904407
12
12
  import { c as connectMessages, s as setUpMessages, d as disconnectMessages, u as updateMessages } from './t9n-436fb2b1.js';
13
13
  import { S as SLOTS$1 } from './resources-00983bd3.js';
14
14
  import { l as loadModules, g as getLocaleComponentStrings, f as formatNumber } from './locale-bcbea4ef.js';
15
- import { a as getAllLayers, g as getLayerOrTable, b as getFeatureLayerView, h as highlightFeatures, d as getMapLayerHash } from './mapViewUtils-20504620.js';
15
+ import { a as getAllLayers, g as getLayerOrTable, b as getFeatureLayerView, h as highlightFeatures, c as getMapLayerHash } from './mapViewUtils-253178f1.js';
16
16
  import { P as PopupUtils } from './popupUtils-af124b47.js';
17
17
  import './guid-b75a5f7b.js';
18
18
  import './resources-8834f920.js';
@@ -336,7 +336,7 @@ const FlowItem = class {
336
336
  };
337
337
  FlowItem.style = flowItemCss;
338
338
 
339
- const createFeatureCss = ":host{display:block}.esri-editor__panel-toolbar{display:none !important}.esri-editor__update-actions{display:none !important}.esri-editor__panel-content{padding-block:0px !important}.esri-editor .esri-item-list__group__header{display:none !important}.esri-editor__panel-content__section .esri-widget__heading{display:none !important}.esri-editor .esri-item-list__filter-container--sticky{padding-block:0px !important;padding-inline:10px !important}";
339
+ const createFeatureCss = ":host{display:block}.esri-editor__panel-toolbar{display:none !important}.esri-editor__update-actions{display:none !important}.esri-editor__panel-content{padding-block:0px !important}.esri-editor .esri-item-list__group__header{display:none !important}.esri-editor__panel-content__section .esri-widget__heading{display:none !important}.esri-editor .esri-item-list__filter-container--sticky{padding-block:0px !important;padding-inline:10px !important}.search-widget{width:92% !important;margin:5px 0 20px 14px}.display-none{display:none !important}";
340
340
 
341
341
  const CreateFeature = class {
342
342
  constructor(hostRef) {
@@ -348,6 +348,8 @@ const CreateFeature = class {
348
348
  this.mapView = undefined;
349
349
  this.selectedLayerId = undefined;
350
350
  this.customizeSubmit = false;
351
+ this.searchConfiguration = undefined;
352
+ this.showSearchWidget = undefined;
351
353
  }
352
354
  //--------------------------------------------------------------------------
353
355
  //
@@ -407,7 +409,8 @@ const CreateFeature = class {
407
409
  * Renders the component.
408
410
  */
409
411
  render() {
410
- return (h(Host, { id: "feature-form" }));
412
+ const showSearchWidget = this.showSearchWidget ? '' : 'display-none';
413
+ return (h(Fragment, null, h("div", { id: "feature-form" }), h("div", { class: `search-widget ${showSearchWidget}`, id: "search-widget-ref" })));
411
414
  }
412
415
  //--------------------------------------------------------------------------
413
416
  //
@@ -415,11 +418,12 @@ const CreateFeature = class {
415
418
  //
416
419
  //--------------------------------------------------------------------------
417
420
  /**
418
- * Init Editor widget and starts the create workflow
421
+ * Init Editor widget and Search widget
419
422
  */
420
423
  async init() {
421
424
  if (this.mapView && this.selectedLayerId) {
422
425
  await this.createEditorWidget();
426
+ await this.createSearchWidget();
423
427
  }
424
428
  }
425
429
  /**
@@ -428,12 +432,14 @@ const CreateFeature = class {
428
432
  * @protected
429
433
  */
430
434
  async initModules() {
431
- const [Editor, reactiveUtils] = await loadModules([
435
+ const [Editor, reactiveUtils, Search] = await loadModules([
432
436
  "esri/widgets/Editor",
433
- "esri/core/reactiveUtils"
437
+ "esri/core/reactiveUtils",
438
+ "esri/widgets/Search"
434
439
  ]);
435
440
  this.Editor = Editor;
436
441
  this.reactiveUtils = reactiveUtils;
442
+ this.Search = Search;
437
443
  }
438
444
  /**
439
445
  * Display editor widget to create the new feature
@@ -487,6 +493,13 @@ const CreateFeature = class {
487
493
  }
488
494
  });
489
495
  this._editor.viewModel.addHandles(handle);
496
+ //Add handle to watch editor viewmodel state and then show the search widget
497
+ const formHandle = this.reactiveUtils.watch(() => this._editor.viewModel.state, (state) => {
498
+ if (state === 'creating-features') {
499
+ this.showSearchWidget = true;
500
+ }
501
+ });
502
+ this._editor.viewModel.addHandles(formHandle);
490
503
  }
491
504
  /**
492
505
  * Start creating the feature
@@ -505,6 +518,7 @@ const CreateFeature = class {
505
518
  //on sketch complete emit the event
506
519
  this._editor.viewModel.sketchViewModel.on("create", (evt) => {
507
520
  if (evt.state === "complete") {
521
+ this.showSearchWidget = false;
508
522
  this.drawComplete.emit();
509
523
  }
510
524
  });
@@ -521,6 +535,94 @@ const CreateFeature = class {
521
535
  this.hideEditorsElements();
522
536
  }
523
537
  }
538
+ /**
539
+ * Display search widget to search location
540
+ * @protected
541
+ */
542
+ async createSearchWidget() {
543
+ let searchOptions = {
544
+ view: this.mapView,
545
+ };
546
+ if (this.searchConfiguration) {
547
+ const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
548
+ searchOptions = Object.assign({}, searchConfiguration);
549
+ }
550
+ this._search = new this.Search(searchOptions);
551
+ this._search.container = 'search-widget-ref';
552
+ this._search.popupEnabled = false;
553
+ this._search.resultGraphicEnabled = false;
554
+ const layer = await getLayerOrTable(this.mapView, this.selectedLayerId);
555
+ let pointGeometry = null;
556
+ // on search get the geometry of the searched location and pass it in sketchViewModel and go to featureForm page
557
+ this._search.on('search-complete', (e) => {
558
+ var _a;
559
+ void this.mapView.goTo(e.results[0].results[0].extent);
560
+ if (layer.geometryType === 'point') {
561
+ pointGeometry = (_a = e.results[0].results[0]) === null || _a === void 0 ? void 0 : _a.feature.geometry;
562
+ }
563
+ });
564
+ //Add handle to watch if search viewModel state is ready
565
+ const createFeatureHandle = this.reactiveUtils.watch(() => this._search.viewModel.state, (state) => {
566
+ if (state === 'ready') {
567
+ setTimeout(() => {
568
+ if (this._editor.viewModel.sketchViewModel.createGraphic && pointGeometry) {
569
+ this._editor.viewModel.sketchViewModel.createGraphic.set('geometry', pointGeometry);
570
+ this._editor.viewModel.sketchViewModel.complete();
571
+ this.hideEditorsElements();
572
+ }
573
+ }, 100);
574
+ }
575
+ });
576
+ this._search.viewModel.addHandles(createFeatureHandle);
577
+ }
578
+ /**
579
+ * Initialize the search widget based on user defined configuration
580
+ *
581
+ * @param searchConfiguration search configuration defined by the user
582
+ * @param view the current map view
583
+ *
584
+ * @protected
585
+ */
586
+ _getSearchConfig(searchConfiguration, view) {
587
+ const INCLUDE_DEFAULT_SOURCES = "includeDefaultSources";
588
+ const sources = searchConfiguration.sources;
589
+ if ((sources === null || sources === void 0 ? void 0 : sources.length) > 0) {
590
+ searchConfiguration[INCLUDE_DEFAULT_SOURCES] = false;
591
+ sources.forEach((source) => {
592
+ var _a, _b;
593
+ const isLayerSource = source.hasOwnProperty("layer");
594
+ if (isLayerSource) {
595
+ const layerSource = source;
596
+ const layerId = (_a = layerSource.layer) === null || _a === void 0 ? void 0 : _a.id;
597
+ const layerFromMap = layerId ? view.map.findLayerById(layerId) : null;
598
+ const layerUrl = (_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url;
599
+ if (layerFromMap) {
600
+ layerSource.layer = layerFromMap;
601
+ }
602
+ else if (layerUrl) {
603
+ layerSource.layer = new this.FeatureLayer(layerUrl);
604
+ }
605
+ }
606
+ });
607
+ sources === null || sources === void 0 ? void 0 : sources.forEach((source) => {
608
+ const isLocatorSource = source.hasOwnProperty("locator");
609
+ if (isLocatorSource) {
610
+ const locatorSource = source;
611
+ if ((locatorSource === null || locatorSource === void 0 ? void 0 : locatorSource.name) === "ArcGIS World Geocoding Service") {
612
+ const outFields = locatorSource.outFields || ["Addr_type", "Match_addr", "StAddr", "City"];
613
+ locatorSource.outFields = outFields;
614
+ locatorSource.singleLineFieldName = "SingleLine";
615
+ }
616
+ locatorSource.url = locatorSource.url;
617
+ delete locatorSource.url;
618
+ }
619
+ });
620
+ }
621
+ else {
622
+ searchConfiguration = Object.assign(Object.assign({}, searchConfiguration), { includeDefaultSources: true });
623
+ }
624
+ return searchConfiguration;
625
+ }
524
626
  /**
525
627
  * Hides the elements of editor widget
526
628
  * @protected
@@ -592,6 +694,7 @@ const FeatureList = class {
592
694
  this.noFeaturesFoundMsg = undefined;
593
695
  this.pageSize = 100;
594
696
  this.highlightOnMap = false;
697
+ this.highlightOnHover = false;
595
698
  this._featureItems = [];
596
699
  this._featuresCount = 0;
597
700
  this._isLoading = false;
@@ -611,6 +714,16 @@ const FeatureList = class {
611
714
  }
612
715
  //--------------------------------------------------------------------------
613
716
  //
717
+ // Methods (public)
718
+ /**
719
+ * Refresh the feature list which will fetch the latest features and update the features list
720
+ * @returns Promise that resolves when the operation is complete
721
+ */
722
+ async refresh() {
723
+ await this.initializeFeatureItems();
724
+ }
725
+ //--------------------------------------------------------------------------
726
+ //
614
727
  // Functions (lifecycle)
615
728
  //
616
729
  //--------------------------------------------------------------------------
@@ -619,6 +732,7 @@ const FeatureList = class {
619
732
  * @returns Promise when complete
620
733
  */
621
734
  async componentWillLoad() {
735
+ await this.initModules();
622
736
  await this._getTranslations();
623
737
  this._isLoading = true;
624
738
  this._popupUtils = new PopupUtils();
@@ -645,6 +759,17 @@ const FeatureList = class {
645
759
  // Functions (protected)
646
760
  //
647
761
  //--------------------------------------------------------------------------
762
+ /**
763
+ * Load esri javascript api modules
764
+ * @returns Promise resolving when function is done
765
+ * @protected
766
+ */
767
+ async initModules() {
768
+ const [Color] = await loadModules([
769
+ "esri/Color"
770
+ ]);
771
+ this.Color = Color;
772
+ }
648
773
  /**
649
774
  * Initialize the features list using the selected layer
650
775
  * @protected
@@ -680,10 +805,7 @@ const FeatureList = class {
680
805
  */
681
806
  async featureClicked(event, selectedFeature) {
682
807
  //clear previous highlight and remove the highlightHandle
683
- if (this.highlightOnMap && this._highlightHandle) {
684
- this._highlightHandle.remove();
685
- this._highlightHandle = null;
686
- }
808
+ this.clearHighlights();
687
809
  //highlight on map only if it is selected item
688
810
  if (this.highlightOnMap) {
689
811
  const selectedFeatureObjectId = Number(event.target.value);
@@ -692,6 +814,31 @@ const FeatureList = class {
692
814
  }
693
815
  this.featureSelect.emit(selectedFeature);
694
816
  }
817
+ /**
818
+ * On feature hover in feature list highlight the feature on the map
819
+ * @param selectedFeature mouseovered feature graphic
820
+ * @protected
821
+ */
822
+ async onFeatureHover(selectedFeature) {
823
+ //clear previous highlight and remove the highlightHandle
824
+ this.clearHighlights();
825
+ if (this.highlightOnHover) {
826
+ const oId = selectedFeature.getObjectId();
827
+ const selectedLayerView = await getFeatureLayerView(this.mapView, this.selectedLayerId);
828
+ selectedLayerView.highlightOptions = { color: new this.Color("#FFFF00") };
829
+ this._highlightHandle = selectedLayerView.highlight([oId]);
830
+ }
831
+ }
832
+ /**
833
+ * Clears the highlight
834
+ * @protected
835
+ */
836
+ clearHighlights() {
837
+ //if a feature is already highlighted, then remove the highlight
838
+ if (this._highlightHandle) {
839
+ this._highlightHandle.remove();
840
+ }
841
+ }
695
842
  /**
696
843
  * Query the selected feature layer, in descending order of object id's
697
844
  * @param page 0th page number in the pagination item
@@ -742,7 +889,7 @@ const FeatureList = class {
742
889
  const oId = selectedFeature.attributes[this._selectedLayer.objectIdField].toString();
743
890
  //use object id if popupTitle is null or undefined
744
891
  popupTitle = popupTitle !== null && popupTitle !== void 0 ? popupTitle : oId;
745
- return (h("calcite-list-item", { onCalciteListItemSelect: (e) => { void this.featureClicked(e, selectedFeature); }, value: oId }, h("div", { class: "popup-title", slot: "content-start" }, popupTitle), h("calcite-icon", { icon: "chevron-right", scale: "s", slot: "content-end" })));
892
+ return (h("calcite-list-item", { onCalciteListItemSelect: (e) => { void this.featureClicked(e, selectedFeature); }, onMouseLeave: () => { void this.clearHighlights(); }, onMouseOver: () => { void this.onFeatureHover(selectedFeature); }, value: oId }, h("div", { class: "popup-title", slot: "content-start" }, popupTitle), h("calcite-icon", { icon: "chevron-right", scale: "s", slot: "content-end" })));
746
893
  }
747
894
  /**
748
895
  * Fetches the component's translations
@@ -822,7 +969,7 @@ const LayerList = class {
822
969
  render() {
823
970
  return (h(Fragment, null, this._isLoading && h("calcite-loader", { label: "", scale: "m" }), !this._isLoading && this.mapView && this._noLayersToDisplay &&
824
971
  h("calcite-notice", { class: "error-msg", icon: "layers-reference", kind: "danger", open: true }, h("div", { slot: "title" }, this._translations.error), h("div", { slot: "message" }, this.noLayerErrorMsg ? this.noLayerErrorMsg : this._noLayerToDisplayErrorMsg)), !this._isLoading && this.mapView &&
825
- h("calcite-list", { "selection-appearance": "border", "selection-mode": this.showNextIcon ? "none" : "single-persist" }, this.renderLayerList())));
972
+ h("calcite-list", { "selection-appearance": "border", "selection-mode": "none" }, this.renderLayerList())));
826
973
  }
827
974
  //--------------------------------------------------------------------------
828
975
  //
@@ -870,7 +1017,7 @@ const LayerList = class {
870
1017
  }
871
1018
  });
872
1019
  await Promise.all(def).then(() => {
873
- const editableLayerIds = this.getEditableIds(this._layerItemsHash);
1020
+ const editableLayerIds = this.getLayersToBeShownInList(this._layerItemsHash);
874
1021
  this._mapLayerIds = editableLayerIds.reverse();
875
1022
  this.handleNoLayersToDisplay();
876
1023
  }, () => {
@@ -886,17 +1033,17 @@ const LayerList = class {
886
1033
  this.layersListLoaded.emit(this._mapLayerIds);
887
1034
  }
888
1035
  /**
889
- * Returns the ids of all OR configured layers that support edits with the update capability
1036
+ * Returns the ids of all OR configured layers that needs to be shown in the list
890
1037
  * @param hash each layer item details
891
1038
  * @returns array of layer ids
892
1039
  */
893
- getEditableIds(hash) {
1040
+ getLayersToBeShownInList(hash) {
894
1041
  var _a;
895
1042
  const configuredLayers = ((_a = this.layers) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.layers : [];
896
1043
  return Object.keys(hash).reduce((prev, cur) => {
897
- let showLayer = hash[cur].supportsAdd;
1044
+ let showLayer = true;
898
1045
  if ((configuredLayers === null || configuredLayers === void 0 ? void 0 : configuredLayers.length) > 0) {
899
- showLayer = configuredLayers.indexOf(cur) > -1 ? hash[cur].supportsAdd : false;
1046
+ showLayer = configuredLayers.indexOf(cur) > -1;
900
1047
  }
901
1048
  if (showLayer) {
902
1049
  prev.push(cur);
@@ -5,8 +5,8 @@
5
5
  */
6
6
  import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-164d485a.js';
7
7
  import { g as getLocaleComponentStrings, l as loadModules } from './locale-bcbea4ef.js';
8
- import { q as queryFeaturesByID, g as getLayerOrTable, c as goToSelection, e as queryAllIds, f as queryFeatureIds, i as queryFeaturesByGlobalID } from './mapViewUtils-20504620.js';
9
- import { d as downloadCSV } from './downloadUtils-0c13073b.js';
8
+ import { q as queryFeaturesByID, g as getLayerOrTable, d as goToSelection, e as queryAllIds, f as queryFeatureIds, i as queryFeaturesByGlobalID } from './mapViewUtils-253178f1.js';
9
+ import { d as downloadCSV } from './downloadUtils-0c1e4d7b.js';
10
10
  import './esri-loader-1b324844.js';
11
11
  import './_commonjsHelpers-0f74c230.js';
12
12
  import './interfaces-586e863c.js';
@@ -1567,6 +1567,38 @@ const LayerTable = class {
1567
1567
  };
1568
1568
  LayerTable.style = layerTableCss;
1569
1569
 
1570
+ function joinAppProxies(map, config, appProxies) {
1571
+ if (appProxies) {
1572
+ appProxies.forEach((proxy) => {
1573
+ map.allLayers.forEach((layer) => {
1574
+ if (layer && layer.url === proxy.sourceUrl) {
1575
+ // directly change the layer url to the proxy url
1576
+ layer.url = proxy.proxyUrl;
1577
+ // Replace the layer's portalItem's url with the proxy url too, otherwise anonymous viewers get a sign-in prompt.
1578
+ if (layer.portalItem) {
1579
+ layer.portalItem.when(() => {
1580
+ // layer.portalItem exists, see above. Not sure why typescript thinks it could be undefined here.
1581
+ layer.portalItem.url = proxy.proxyUrl;
1582
+ });
1583
+ }
1584
+ // also add a request interceptor in case we missed any requests to the original url, or the jsapi team adds new requests in the future.
1585
+ config.request?.interceptors?.push({
1586
+ // this interceptor only applies to requests made to this proxy's sourceUrl (the layer's original url).
1587
+ urls: proxy.sourceUrl,
1588
+ before: (params) => {
1589
+ // change requests from the original url to the proxy url
1590
+ if (params.url && params.url === proxy.sourceUrl) {
1591
+ params.url = proxy.proxyUrl;
1592
+ }
1593
+ },
1594
+ });
1595
+ }
1596
+ });
1597
+ });
1598
+ }
1599
+ return map;
1600
+ }
1601
+
1570
1602
  const mapCardCss = ":host{display:block;--calcite-label-margin-bottom:0;--calcite-block-padding:0}.map-height{height:calc(100% - 51px)}.height-full{height:100%}.box-shadow{box-shadow:none !important}.visibility-hidden-1{visibility:hidden;height:1px;}.display-none{display:none}";
1571
1603
 
1572
1604
  const MapCard = class {
@@ -1582,6 +1614,7 @@ const MapCard = class {
1582
1614
  * string: the id of map currently displayed
1583
1615
  */
1584
1616
  this._loadedId = "";
1617
+ this.appProxies = undefined;
1585
1618
  this.defaultWebmapId = "";
1586
1619
  this.enableHome = undefined;
1587
1620
  this.enableLegend = undefined;
@@ -1658,14 +1691,16 @@ const MapCard = class {
1658
1691
  * @protected
1659
1692
  */
1660
1693
  async _initModules() {
1661
- const [WebMap, MapView, Home] = await loadModules([
1694
+ const [WebMap, MapView, Home, esriConfig] = await loadModules([
1662
1695
  "esri/WebMap",
1663
1696
  "esri/views/MapView",
1664
- "esri/widgets/Home"
1697
+ "esri/widgets/Home",
1698
+ "esri/config"
1665
1699
  ]);
1666
1700
  this.WebMap = WebMap;
1667
1701
  this.MapView = MapView;
1668
1702
  this.Home = Home;
1703
+ this.esriConfig = esriConfig;
1669
1704
  }
1670
1705
  /**
1671
1706
  * Load the webmap for the provided webMapInfo
@@ -1686,6 +1721,10 @@ const MapCard = class {
1686
1721
  const webMap = new this.WebMap({
1687
1722
  portalItem: { id }
1688
1723
  });
1724
+ if (this.appProxies) {
1725
+ await webMap.load();
1726
+ await joinAppProxies(webMap, this.esriConfig, this.appProxies);
1727
+ }
1689
1728
  this.mapView = new this.MapView({
1690
1729
  container: this._mapDiv,
1691
1730
  map: webMap,
@@ -6,7 +6,7 @@
6
6
  import { r as registerInstance, h, H as Host, g as getElement } from './index-164d485a.js';
7
7
  import { g as getLocaleComponentStrings } from './locale-bcbea4ef.js';
8
8
  import { E as ELayoutMode } from './interfaces-586e863c.js';
9
- import { g as getLayerOrTable } from './mapViewUtils-20504620.js';
9
+ import { g as getLayerOrTable } from './mapViewUtils-253178f1.js';
10
10
  import './esri-loader-1b324844.js';
11
11
  import './_commonjsHelpers-0f74c230.js';
12
12
 
@@ -35,6 +35,7 @@ const CrowdsourceManager = class {
35
35
  * MapView.when is not fired when mapView is not currently visible
36
36
  */
37
37
  this._shouldSetMapView = false;
38
+ this.appProxies = undefined;
38
39
  this.defaultCenter = "";
39
40
  this.defaultGlobalId = "";
40
41
  this.defaultLayer = "";
@@ -322,7 +323,7 @@ const CrowdsourceManager = class {
322
323
  _getMapNode(panelOpen) {
323
324
  var _a;
324
325
  const mapContainerClass = this._layoutMode === ELayoutMode.HORIZONTAL && (!this._isMobile || panelOpen) ? "" : "adjusted-height-50";
325
- return (h("div", { class: `${mapContainerClass} overflow-hidden` }, h("map-card", { basemapConfig: this.basemapConfig, class: "width-full", defaultWebmapId: this.defaultWebmap, enableBasemap: this.enableBasemap, enableFloorFilter: this.enableFloorFilter, enableFullscreen: this.enableFullscreen, enableHome: this.enableHome, enableLegend: this.enableLegend, enableSearch: this.enableSearch, enableSingleExpand: true, hidden: this._expandPopup && !this._isMobile, homeZoomIndex: 3, homeZoomPosition: "top-left", homeZoomToolsSize: "s", mapInfos: (_a = this.mapInfos) === null || _a === void 0 ? void 0 : _a.filter(mapInfo => mapInfo.visible !== false), mapWidgetsIndex: 0, mapWidgetsPosition: "top-right", mapWidgetsSize: "m", stackTools: true, theme: this.theme, toolOrder: ["legend", "search", "fullscreen", "basemap", "floorfilter"] })));
326
+ return (h("div", { class: `${mapContainerClass} overflow-hidden` }, h("map-card", { appProxies: this.appProxies, basemapConfig: this.basemapConfig, class: "width-full", defaultWebmapId: this.defaultWebmap, enableBasemap: this.enableBasemap, enableFloorFilter: this.enableFloorFilter, enableFullscreen: this.enableFullscreen, enableHome: this.enableHome, enableLegend: this.enableLegend, enableSearch: this.enableSearch, enableSingleExpand: true, hidden: this._expandPopup && !this._isMobile, homeZoomIndex: 3, homeZoomPosition: "top-left", homeZoomToolsSize: "s", mapInfos: (_a = this.mapInfos) === null || _a === void 0 ? void 0 : _a.filter(mapInfo => mapInfo.visible !== false), mapWidgetsIndex: 0, mapWidgetsPosition: "top-right", mapWidgetsSize: "m", stackTools: true, theme: this.theme, toolOrder: ["legend", "search", "fullscreen", "basemap", "floorfilter"] })));
326
327
  }
327
328
  /**
328
329
  * Get the expand node for the popup information