@esri/solutions-components 0.8.5 → 0.8.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) 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/crowdsource-manager.cjs.entry.js +6 -4
  12. package/dist/cjs/crowdsource-reporter.cjs.entry.js +124 -38
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/cjs/map-select-tools_3.cjs.entry.js +2 -2
  15. package/dist/cjs/public-notification.cjs.entry.js +110 -4
  16. package/dist/cjs/{publicNotificationStore-ef379d11.js → publicNotificationStore-e790601d.js} +2 -2
  17. package/dist/cjs/solutions-components.cjs.js +1 -1
  18. package/dist/collection/collection-manifest.json +1 -1
  19. package/dist/collection/components/create-feature/create-feature.css +9 -0
  20. package/dist/collection/components/create-feature/create-feature.js +134 -6
  21. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +102 -66
  22. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +5 -0
  23. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +196 -38
  24. package/dist/collection/components/feature-list/feature-list.js +93 -5
  25. package/dist/collection/components/info-card/info-card.css +1 -1
  26. package/dist/collection/components/info-card/info-card.js +1 -1
  27. package/dist/collection/components/layer-list/layer-list.js +6 -6
  28. package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
  29. package/dist/collection/components/map-layer-picker/map-layer-picker.js +1 -1
  30. package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
  31. package/dist/collection/components/public-notification/public-notification.js +110 -3
  32. package/dist/collection/demos/crowdsource-reporter.html +1 -1
  33. package/dist/collection/utils/interfaces.ts +23 -0
  34. package/dist/collection/utils/publicNotificationStore.js +2 -2
  35. package/dist/collection/utils/publicNotificationStore.ts +3 -2
  36. package/dist/components/create-feature2.js +111 -7
  37. package/dist/components/crowdsource-manager.js +12 -8
  38. package/dist/components/crowdsource-reporter.js +129 -39
  39. package/dist/components/feature-list2.js +54 -6
  40. package/dist/components/info-card2.js +2 -2
  41. package/dist/components/layer-list2.js +6 -6
  42. package/dist/components/map-draw-tools2.js +1 -1
  43. package/dist/components/map-layer-picker2.js +1 -1
  44. package/dist/components/map-select-tools2.js +1 -1
  45. package/dist/components/public-notification.js +110 -3
  46. package/dist/components/publicNotificationStore.js +2 -2
  47. package/dist/esm/buffer-tools_3.entry.js +2 -2
  48. package/dist/esm/calcite-alert_4.entry.js +3 -3
  49. package/dist/esm/calcite-combobox_5.entry.js +3 -3
  50. package/dist/esm/calcite-flow_5.entry.js +164 -17
  51. package/dist/esm/card-manager_3.entry.js +2 -2
  52. package/dist/esm/crowdsource-manager.entry.js +7 -5
  53. package/dist/esm/crowdsource-reporter.entry.js +125 -39
  54. package/dist/esm/{downloadUtils-0c13073b.js → downloadUtils-0c1e4d7b.js} +2 -2
  55. package/dist/esm/{index.es-ad250bc6.js → index.es-286e3cfa.js} +2 -2
  56. package/dist/esm/loader.js +1 -1
  57. package/dist/esm/map-select-tools_3.entry.js +4 -4
  58. package/dist/esm/{mapViewUtils-20504620.js → mapViewUtils-253178f1.js} +1 -1
  59. package/dist/esm/public-notification.entry.js +112 -6
  60. package/dist/esm/{publicNotificationStore-3bf4de75.js → publicNotificationStore-223faed2.js} +2 -2
  61. package/dist/esm/solutions-components.js +1 -1
  62. package/dist/solutions-components/demos/crowdsource-reporter.html +1 -1
  63. package/dist/solutions-components/p-15f9624a.entry.js +6 -0
  64. package/dist/solutions-components/{p-955647ea.entry.js → p-1ea5e061.entry.js} +2 -2
  65. package/dist/solutions-components/{p-590a2a26.js → p-212b02e7.js} +1 -1
  66. package/dist/solutions-components/p-238d3b5f.entry.js +6 -0
  67. package/dist/solutions-components/{p-cc280aa1.js → p-322868ec.js} +1 -1
  68. package/dist/solutions-components/{p-1d3a1794.js → p-331b5d1e.js} +2 -2
  69. package/dist/solutions-components/{p-c897e3eb.js → p-3af79063.js} +1 -1
  70. package/dist/solutions-components/p-6db185bf.entry.js +6 -0
  71. package/dist/solutions-components/p-80b11ec1.entry.js +17 -0
  72. package/dist/solutions-components/{p-5c7e3941.entry.js → p-813fd8a4.entry.js} +2 -2
  73. package/dist/solutions-components/{p-ff302d95.entry.js → p-d136eab0.entry.js} +2 -2
  74. package/dist/solutions-components/p-e0446d5b.entry.js +6 -0
  75. package/dist/solutions-components/p-e8f13354.entry.js +6 -0
  76. package/dist/solutions-components/solutions-components.esm.js +1 -1
  77. package/dist/solutions-components/utils/interfaces.ts +23 -0
  78. package/dist/solutions-components/utils/publicNotificationStore.ts +3 -2
  79. package/dist/types/components/create-feature/create-feature.d.ts +43 -1
  80. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +22 -14
  81. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +48 -11
  82. package/dist/types/components/feature-list/feature-list.d.ts +31 -0
  83. package/dist/types/components/layer-list/layer-list.d.ts +3 -3
  84. package/dist/types/components/public-notification/public-notification.d.ts +48 -0
  85. package/dist/types/components.d.ts +71 -2
  86. package/dist/types/utils/interfaces.d.ts +20 -0
  87. package/dist/types/utils/publicNotificationStore.d.ts +2 -1
  88. package/package.json +1 -1
  89. package/dist/solutions-components/p-6512dc44.entry.js +0 -6
  90. package/dist/solutions-components/p-6f65682c.entry.js +0 -6
  91. package/dist/solutions-components/p-989bf0bf.entry.js +0 -6
  92. package/dist/solutions-components/p-a0611720.entry.js +0 -6
  93. package/dist/solutions-components/p-b8c12736.entry.js +0 -6
  94. package/dist/solutions-components/p-efe1694a.entry.js +0 -17
@@ -297,7 +297,7 @@ export class MapLayerPicker {
297
297
  _validLayer(id) {
298
298
  var _a;
299
299
  const name = (_a = this._layerNameHash[id]) === null || _a === void 0 ? void 0 : _a.name;
300
- return name && state.managedLayers.indexOf(name) < 0 && (this.enabledLayerIds.length > 0 ?
300
+ return name && Object.keys(state.managedLayers).indexOf(name) < 0 && (this.enabledLayerIds.length > 0 ?
301
301
  this.enabledLayerIds.indexOf(id) > -1 : true);
302
302
  }
303
303
  /**
@@ -427,7 +427,7 @@ export class MapSelectTools {
427
427
  }
428
428
  else {
429
429
  this._bufferGraphicsLayer = new this.GraphicsLayer({ title, listMode: "hide" });
430
- state.managedLayers.push(title);
430
+ state.managedLayers[title] = "buffer";
431
431
  const sketchIndex = this.mapView.map.layers.findIndex((l) => l.title === this._translations.sketchLayer);
432
432
  if (sketchIndex > -1) {
433
433
  this.mapView.map.layers.add(this._bufferGraphicsLayer, sketchIndex);
@@ -59,6 +59,7 @@ export class PublicNotification {
59
59
  this.sketchLineSymbol = undefined;
60
60
  this.sketchPointSymbol = undefined;
61
61
  this.sketchPolygonSymbol = undefined;
62
+ this._exportGraphics = false;
62
63
  this._addMap = false;
63
64
  this._addResults = true;
64
65
  this._addTitle = false;
@@ -137,6 +138,7 @@ export class PublicNotification {
137
138
  if (pageType === EPageType.EXPORT) {
138
139
  this._fetchingData = true;
139
140
  this._numDuplicates = await this._getNumDuplicates();
141
+ this._updateExportGraphics();
140
142
  this._fetchingData = false;
141
143
  }
142
144
  this._clearHighlight();
@@ -144,6 +146,9 @@ export class PublicNotification {
144
146
  // clear any draw shapes or buffers
145
147
  await this._clearSelection();
146
148
  }
149
+ if (oldPageType === EPageType.EXPORT) {
150
+ this._removeExportGraphics();
151
+ }
147
152
  if (pageType !== EPageType.SELECT) {
148
153
  return this._highlightFeatures();
149
154
  }
@@ -207,12 +212,14 @@ export class PublicNotification {
207
212
  * @protected
208
213
  */
209
214
  async _initModules() {
210
- const [geometryEngine, jsonUtils] = await loadModules([
215
+ const [geometryEngine, jsonUtils, graphic] = await loadModules([
211
216
  "esri/geometry/geometryEngine",
212
- "esri/symbols/support/jsonUtils"
217
+ "esri/symbols/support/jsonUtils",
218
+ "esri/Graphic"
213
219
  ]);
214
220
  this._geometryEngine = geometryEngine;
215
221
  this._jsonUtils = jsonUtils;
222
+ this.Graphic = graphic;
216
223
  }
217
224
  /**
218
225
  * Load the search configuration
@@ -540,9 +547,107 @@ export class PublicNotification {
540
547
  _getExportOptions() {
541
548
  const displayClass = this._exportType === EExportType.PDF ? "display-block" : "display-none";
542
549
  const titleOptionsClass = this._addTitle ? "display-block" : "display-none";
550
+ const graphicsOptionsClass = this._addMap ? "display-flex" : "display-none";
543
551
  const title = this._titleValue ? this._titleValue : this.defaultExportTitle ? this.defaultExportTitle : "";
544
552
  const formatOptionsClass = this._addResults ? "" : "display-none";
545
- return (h("div", { class: displayClass }, this._getLabel(this._translations.pdfOptions, true), h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: "label-margin-0", layout: "inline" }, h("calcite-checkbox", { checked: this._addResults, onCalciteCheckboxChange: () => this._addResults = !this._addResults }), this._translations.addResults)), h("div", { class: `padding-top-sides-1 ${formatOptionsClass}` }, h("calcite-label", { class: "label-margin-0" }, this._translations.selectPDFLabelOption)), h("div", { class: `padding-sides-1 ${formatOptionsClass}` }, h("pdf-download", { defaultNumLabelsPerPage: parseInt(this.defaultNumLabelsPerPage.toString(), 10), disabled: !this._downloadActive, ref: (el) => { this._downloadTools = el; } })), h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: "label-margin-0", layout: "inline" }, h("calcite-checkbox", { checked: this._addTitle, onCalciteCheckboxChange: () => this._addTitle = !this._addTitle }), this._translations.title)), h("div", { class: titleOptionsClass }, this._getLabel(this._translations.title, true, ""), h("calcite-input-text", { class: "padding-sides-1", onCalciteInputTextInput: () => this._changeTitle(), placeholder: this._translations.titlePlaceholder, ref: (el) => { this._titleElement = el; }, value: title })), h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: "label-margin-0", layout: "inline" }, h("calcite-checkbox", { checked: this._addMap, onCalciteCheckboxChange: () => this._addMap = !this._addMap }), this._translations.includeMap))));
553
+ return (h("div", { class: displayClass }, this._getLabel(this._translations.pdfOptions, true), h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: "label-margin-0", layout: "inline" }, h("calcite-checkbox", { checked: this._addResults, onCalciteCheckboxChange: () => this._addResults = !this._addResults }), this._translations.addResults)), h("div", { class: `padding-top-sides-1 ${formatOptionsClass}` }, h("calcite-label", { class: "label-margin-0" }, this._translations.selectPDFLabelOption)), h("div", { class: `padding-sides-1 ${formatOptionsClass}` }, h("pdf-download", { defaultNumLabelsPerPage: parseInt(this.defaultNumLabelsPerPage.toString(), 10), disabled: !this._downloadActive, ref: (el) => { this._downloadTools = el; } })), h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: "label-margin-0", layout: "inline" }, h("calcite-checkbox", { checked: this._addTitle, onCalciteCheckboxChange: () => this._addTitle = !this._addTitle }), this._translations.title)), h("div", { class: titleOptionsClass }, this._getLabel(this._translations.title, true, ""), h("calcite-input-text", { class: "padding-sides-1", onCalciteInputTextInput: () => this._changeTitle(), placeholder: this._translations.titlePlaceholder, ref: (el) => { this._titleElement = el; }, value: title })), h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: "label-margin-0", layout: "inline" }, h("calcite-checkbox", { checked: this._addMap, onCalciteCheckboxChange: () => this._handleAddMapChange() }), this._translations.includeMap)), h("div", { class: `padding-top-sides-1 ${graphicsOptionsClass}` }, h("calcite-label", { class: "label-margin-0", layout: "inline" }, h("calcite-checkbox", { checked: this._exportGraphics, onCalciteCheckboxChange: () => this._handleExportGraphicsChange() }), this._translations.listGraphics), h("calcite-icon", { class: "padding-start-1-2 icon", icon: "question", id: "list-graphics-icon", scale: "s" }), h("calcite-popover", { closable: true, label: "", referenceElement: "list-graphics-icon" }, h("span", { class: "tooltip-message" }, this._translations.listGraphicsTip)))));
554
+ }
555
+ /**
556
+ * Toggle the _addMap state variable and update the graphics on the map
557
+ *
558
+ * @protected
559
+ */
560
+ _handleAddMapChange() {
561
+ this._addMap = !this._addMap;
562
+ this._updateExportGraphics();
563
+ }
564
+ /**
565
+ * Toggle the _exportGraphics state variable and update the graphics on the map
566
+ *
567
+ * @protected
568
+ */
569
+ _handleExportGraphicsChange() {
570
+ this._exportGraphics = !this._exportGraphics;
571
+ this._updateExportGraphics();
572
+ }
573
+ /**
574
+ * Get the "sketch" or "buffer" graphics layer
575
+ *
576
+ * @param type The type of managed layer to fetch "sketch" | "buffer"
577
+ *
578
+ * @protected
579
+ */
580
+ _getManagedLayer(type) {
581
+ let layer;
582
+ Object.keys(state.managedLayers).some((k) => {
583
+ const i = this.mapView.map.layers.findIndex((l) => l.title === k);
584
+ if (state.managedLayers[k] === type) {
585
+ layer = this.mapView.map.layers.getItemAt(i);
586
+ return true;
587
+ }
588
+ });
589
+ return layer;
590
+ }
591
+ /**
592
+ * Update the export graphics by adding or removeing them
593
+ *
594
+ * @param clear When true the graphics layers will be cleared prior to adding any new graphics, defaults to false
595
+ *
596
+ * @protected
597
+ */
598
+ _updateExportGraphics(clear = false) {
599
+ if (clear || !this._exportGraphics || !this._addMap) {
600
+ this._removeExportGraphics();
601
+ }
602
+ if (this._exportGraphics && this._addMap) {
603
+ this._addExportGraphics();
604
+ }
605
+ }
606
+ /**
607
+ * Remove all buffer and sketch graphics
608
+ *
609
+ * @protected
610
+ */
611
+ _removeExportGraphics() {
612
+ const sketchLayer = this._getManagedLayer("sketch");
613
+ const bufferLayer = this._getManagedLayer("buffer");
614
+ if (sketchLayer) {
615
+ sketchLayer.graphics.removeAll();
616
+ }
617
+ if (bufferLayer) {
618
+ bufferLayer.graphics.removeAll();
619
+ }
620
+ }
621
+ /**
622
+ * Add all buffer and sketch graphics that are flagged for download
623
+ *
624
+ * @protected
625
+ */
626
+ _addExportGraphics() {
627
+ const sketchLayer = this._getManagedLayer("sketch");
628
+ const bufferLayer = this._getManagedLayer("buffer");
629
+ this._selectionSets.forEach(ss => {
630
+ if (ss.download) {
631
+ if (sketchLayer) {
632
+ sketchLayer.graphics.add(ss.sketchGraphic);
633
+ }
634
+ if (bufferLayer) {
635
+ const symbol = {
636
+ type: "simple-fill",
637
+ color: this.bufferColor,
638
+ outline: {
639
+ color: this.bufferOutlineColor,
640
+ width: 1
641
+ }
642
+ };
643
+ const bufferGraphic = new this.Graphic({
644
+ geometry: ss.buffer,
645
+ symbol
646
+ });
647
+ bufferLayer.graphics.add(bufferGraphic);
648
+ }
649
+ }
650
+ });
546
651
  }
547
652
  /**
548
653
  * Render the refine page
@@ -636,6 +741,7 @@ export class PublicNotification {
636
741
  isActive = ss.download ? true : isActive;
637
742
  return ss;
638
743
  });
744
+ this._updateExportGraphics(true);
639
745
  this._downloadActive = isActive;
640
746
  this._fetchingData = true;
641
747
  this._numDuplicates = await this._getNumDuplicates();
@@ -1251,6 +1357,7 @@ export class PublicNotification {
1251
1357
  }
1252
1358
  static get states() {
1253
1359
  return {
1360
+ "_exportGraphics": {},
1254
1361
  "_addMap": {},
1255
1362
  "_addResults": {},
1256
1363
  "_addTitle": {},
@@ -163,7 +163,7 @@
163
163
  demo.reportButtonText = "Report an incident";
164
164
  demo.enableNewReports = true;
165
165
  demo.theme = "light";
166
- demo.reportSubmittedMessage = "Thank you";
166
+ demo.reportSubmittedMessage = "Thank you! Your request was successfully submitted";
167
167
  //Select reporting layers -
168
168
  //demo.layers = ['SE_field_mapping_9688', 'SE_field_mapping_5784', 'SE_field_mapping_1853']; //Se mapping
169
169
  //demo.layers = ['Three_Layers_nested_4042', 'SE_sort_2889', 'SE_sort_756']; //screening layers
@@ -565,3 +565,26 @@ export interface IPopupUtils {
565
565
  export interface IConsentResponse {
566
566
  granted: boolean;
567
567
  }
568
+
569
+ /**
570
+ * Key is the layer name and the value is the type of layer
571
+ */
572
+ export interface IManagedLayers {
573
+ [key: string]: "buffer" | "sketch";
574
+ }
575
+
576
+ /**
577
+ * Key is the layers guid
578
+ */
579
+ export interface IReportingOptions {
580
+ [key: string]: IReportOption;
581
+ }
582
+
583
+ export interface IReportOption {
584
+ reporting: boolean;
585
+ comment: boolean;
586
+ like: boolean;
587
+ dislike: boolean;
588
+ likeField: string;
589
+ dislikeField: string;
590
+ }
@@ -20,8 +20,8 @@
20
20
  */
21
21
  import { createStore } from "@stencil/store";
22
22
  const { state, onChange } = createStore({
23
- // List of layers added and managed by the component
24
- managedLayers: [],
23
+ // Key Value pair whose Key is the layer name and the Value is the type of layer ("buffer" | "sketch")
24
+ managedLayers: {},
25
25
  // List of tables added and managed by the component
26
26
  managedTables: [],
27
27
  // Handle[]: https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Handles.html#Handle
@@ -15,10 +15,11 @@
15
15
  */
16
16
 
17
17
  import { createStore } from "@stencil/store";
18
+ import { IManagedLayers } from "./interfaces";
18
19
 
19
20
  const { state, onChange } = createStore({
20
- // List of layers added and managed by the component
21
- managedLayers: [],
21
+ // Key Value pair whose Key is the layer name and the Value is the type of layer ("buffer" | "sketch")
22
+ managedLayers: {} as IManagedLayers,
22
23
  // List of tables added and managed by the component
23
24
  managedTables: [],
24
25
  // Handle[]: https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Handles.html#Handle
@@ -3,11 +3,11 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
6
+ import { proxyCustomElement, HTMLElement, createEvent, h, Fragment } from '@stencil/core/internal/client';
7
7
  import { l as loadModules } from './loadModules.js';
8
- import { a as getAllLayers } from './mapViewUtils.js';
8
+ import { a as getAllLayers, g as getLayerOrTable } from './mapViewUtils.js';
9
9
 
10
- 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}";
10
+ 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}";
11
11
 
12
12
  const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature extends HTMLElement {
13
13
  constructor() {
@@ -20,6 +20,8 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
20
20
  this.mapView = undefined;
21
21
  this.selectedLayerId = undefined;
22
22
  this.customizeSubmit = false;
23
+ this.searchConfiguration = undefined;
24
+ this.showSearchWidget = undefined;
23
25
  }
24
26
  //--------------------------------------------------------------------------
25
27
  //
@@ -79,7 +81,8 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
79
81
  * Renders the component.
80
82
  */
81
83
  render() {
82
- return (h(Host, { id: "feature-form" }));
84
+ const showSearchWidget = this.showSearchWidget ? '' : 'display-none';
85
+ return (h(Fragment, null, h("div", { id: "feature-form" }), h("div", { class: `search-widget ${showSearchWidget}`, id: "search-widget-ref" })));
83
86
  }
84
87
  //--------------------------------------------------------------------------
85
88
  //
@@ -87,11 +90,12 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
87
90
  //
88
91
  //--------------------------------------------------------------------------
89
92
  /**
90
- * Init Editor widget and starts the create workflow
93
+ * Init Editor widget and Search widget
91
94
  */
92
95
  async init() {
93
96
  if (this.mapView && this.selectedLayerId) {
94
97
  await this.createEditorWidget();
98
+ await this.createSearchWidget();
95
99
  }
96
100
  }
97
101
  /**
@@ -100,12 +104,14 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
100
104
  * @protected
101
105
  */
102
106
  async initModules() {
103
- const [Editor, reactiveUtils] = await loadModules([
107
+ const [Editor, reactiveUtils, Search] = await loadModules([
104
108
  "esri/widgets/Editor",
105
- "esri/core/reactiveUtils"
109
+ "esri/core/reactiveUtils",
110
+ "esri/widgets/Search"
106
111
  ]);
107
112
  this.Editor = Editor;
108
113
  this.reactiveUtils = reactiveUtils;
114
+ this.Search = Search;
109
115
  }
110
116
  /**
111
117
  * Display editor widget to create the new feature
@@ -159,6 +165,13 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
159
165
  }
160
166
  });
161
167
  this._editor.viewModel.addHandles(handle);
168
+ //Add handle to watch editor viewmodel state and then show the search widget
169
+ const formHandle = this.reactiveUtils.watch(() => this._editor.viewModel.state, (state) => {
170
+ if (state === 'creating-features') {
171
+ this.showSearchWidget = true;
172
+ }
173
+ });
174
+ this._editor.viewModel.addHandles(formHandle);
162
175
  }
163
176
  /**
164
177
  * Start creating the feature
@@ -177,6 +190,7 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
177
190
  //on sketch complete emit the event
178
191
  this._editor.viewModel.sketchViewModel.on("create", (evt) => {
179
192
  if (evt.state === "complete") {
193
+ this.showSearchWidget = false;
180
194
  this.drawComplete.emit();
181
195
  }
182
196
  });
@@ -193,6 +207,94 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
193
207
  this.hideEditorsElements();
194
208
  }
195
209
  }
210
+ /**
211
+ * Display search widget to search location
212
+ * @protected
213
+ */
214
+ async createSearchWidget() {
215
+ let searchOptions = {
216
+ view: this.mapView,
217
+ };
218
+ if (this.searchConfiguration) {
219
+ const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
220
+ searchOptions = Object.assign({}, searchConfiguration);
221
+ }
222
+ this._search = new this.Search(searchOptions);
223
+ this._search.container = 'search-widget-ref';
224
+ this._search.popupEnabled = false;
225
+ this._search.resultGraphicEnabled = false;
226
+ const layer = await getLayerOrTable(this.mapView, this.selectedLayerId);
227
+ let pointGeometry = null;
228
+ // on search get the geometry of the searched location and pass it in sketchViewModel and go to featureForm page
229
+ this._search.on('search-complete', (e) => {
230
+ var _a;
231
+ void this.mapView.goTo(e.results[0].results[0].extent);
232
+ if (layer.geometryType === 'point') {
233
+ pointGeometry = (_a = e.results[0].results[0]) === null || _a === void 0 ? void 0 : _a.feature.geometry;
234
+ }
235
+ });
236
+ //Add handle to watch if search viewModel state is ready
237
+ const createFeatureHandle = this.reactiveUtils.watch(() => this._search.viewModel.state, (state) => {
238
+ if (state === 'ready') {
239
+ setTimeout(() => {
240
+ if (this._editor.viewModel.sketchViewModel.createGraphic && pointGeometry) {
241
+ this._editor.viewModel.sketchViewModel.createGraphic.set('geometry', pointGeometry);
242
+ this._editor.viewModel.sketchViewModel.complete();
243
+ this.hideEditorsElements();
244
+ }
245
+ }, 100);
246
+ }
247
+ });
248
+ this._search.viewModel.addHandles(createFeatureHandle);
249
+ }
250
+ /**
251
+ * Initialize the search widget based on user defined configuration
252
+ *
253
+ * @param searchConfiguration search configuration defined by the user
254
+ * @param view the current map view
255
+ *
256
+ * @protected
257
+ */
258
+ _getSearchConfig(searchConfiguration, view) {
259
+ const INCLUDE_DEFAULT_SOURCES = "includeDefaultSources";
260
+ const sources = searchConfiguration.sources;
261
+ if ((sources === null || sources === void 0 ? void 0 : sources.length) > 0) {
262
+ searchConfiguration[INCLUDE_DEFAULT_SOURCES] = false;
263
+ sources.forEach((source) => {
264
+ var _a, _b;
265
+ const isLayerSource = source.hasOwnProperty("layer");
266
+ if (isLayerSource) {
267
+ const layerSource = source;
268
+ const layerId = (_a = layerSource.layer) === null || _a === void 0 ? void 0 : _a.id;
269
+ const layerFromMap = layerId ? view.map.findLayerById(layerId) : null;
270
+ const layerUrl = (_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url;
271
+ if (layerFromMap) {
272
+ layerSource.layer = layerFromMap;
273
+ }
274
+ else if (layerUrl) {
275
+ layerSource.layer = new this.FeatureLayer(layerUrl);
276
+ }
277
+ }
278
+ });
279
+ sources === null || sources === void 0 ? void 0 : sources.forEach((source) => {
280
+ const isLocatorSource = source.hasOwnProperty("locator");
281
+ if (isLocatorSource) {
282
+ const locatorSource = source;
283
+ if ((locatorSource === null || locatorSource === void 0 ? void 0 : locatorSource.name) === "ArcGIS World Geocoding Service") {
284
+ const outFields = locatorSource.outFields || ["Addr_type", "Match_addr", "StAddr", "City"];
285
+ locatorSource.outFields = outFields;
286
+ locatorSource.singleLineFieldName = "SingleLine";
287
+ }
288
+ locatorSource.url = locatorSource.url;
289
+ delete locatorSource.url;
290
+ }
291
+ });
292
+ }
293
+ else {
294
+ searchConfiguration = Object.assign(Object.assign({}, searchConfiguration), { includeDefaultSources: true });
295
+ }
296
+ return searchConfiguration;
297
+ }
196
298
  /**
197
299
  * Hides the elements of editor widget
198
300
  * @protected
@@ -255,6 +357,8 @@ const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature exten
255
357
  "mapView": [16],
256
358
  "selectedLayerId": [1, "selected-layer-id"],
257
359
  "customizeSubmit": [4, "customize-submit"],
360
+ "searchConfiguration": [16],
361
+ "showSearchWidget": [32],
258
362
  "close": [64],
259
363
  "submit": [64]
260
364
  }, undefined, {
@@ -92,6 +92,7 @@ const CrowdsourceManager$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceM
92
92
  */
93
93
  this._shouldSetMapView = false;
94
94
  this.appProxies = undefined;
95
+ this.basemapConfig = undefined;
95
96
  this.defaultCenter = "";
96
97
  this.defaultGlobalId = "";
97
98
  this.defaultLayer = "";
@@ -99,26 +100,27 @@ const CrowdsourceManager$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceM
99
100
  this.defaultOid = "";
100
101
  this.defaultWebmap = "";
101
102
  this.enableAutoRefresh = false;
103
+ this.enableBasemap = true;
102
104
  this.enableColumnReorder = true;
103
105
  this.enableCSV = true;
104
106
  this.enableFloorFilter = true;
105
107
  this.enableFullscreen = true;
108
+ this.enableHome = true;
106
109
  this.enableInlineEdit = false;
107
110
  this.enableLegend = true;
108
111
  this.enableSearch = true;
109
112
  this.enableShare = false;
110
- this.enableHome = true;
111
113
  this.enableZoom = true;
112
- this.enableBasemap = true;
113
- this.basemapConfig = undefined;
114
- this.showNewestFirst = true;
114
+ this.hideMapOnLoad = undefined;
115
115
  this.mapInfos = [];
116
116
  this.onlyShowUpdatableLayers = true;
117
117
  this.searchConfiguration = undefined;
118
118
  this.shareIncludeEmbed = undefined;
119
119
  this.shareIncludeSocial = undefined;
120
+ this.showNewestFirst = true;
120
121
  this.theme = "light";
121
122
  this.zoomAndScrollToSelected = false;
123
+ this.zoomToScale = undefined;
122
124
  this._expandPopup = false;
123
125
  this._hideFooter = false;
124
126
  this._hideTable = false;
@@ -546,6 +548,7 @@ const CrowdsourceManager$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceM
546
548
  static get style() { return crowdsourceManagerCss; }
547
549
  }, [0, "crowdsource-manager", {
548
550
  "appProxies": [8, "app-proxies"],
551
+ "basemapConfig": [16],
549
552
  "defaultCenter": [1, "default-center"],
550
553
  "defaultGlobalId": [1, "default-global-id"],
551
554
  "defaultLayer": [1, "default-layer"],
@@ -553,26 +556,27 @@ const CrowdsourceManager$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceM
553
556
  "defaultOid": [1, "default-oid"],
554
557
  "defaultWebmap": [1, "default-webmap"],
555
558
  "enableAutoRefresh": [4, "enable-auto-refresh"],
559
+ "enableBasemap": [4, "enable-basemap"],
556
560
  "enableColumnReorder": [4, "enable-column-reorder"],
557
561
  "enableCSV": [4, "enable-c-s-v"],
558
562
  "enableFloorFilter": [4, "enable-floor-filter"],
559
563
  "enableFullscreen": [4, "enable-fullscreen"],
564
+ "enableHome": [4, "enable-home"],
560
565
  "enableInlineEdit": [4, "enable-inline-edit"],
561
566
  "enableLegend": [4, "enable-legend"],
562
567
  "enableSearch": [4, "enable-search"],
563
568
  "enableShare": [4, "enable-share"],
564
- "enableHome": [4, "enable-home"],
565
569
  "enableZoom": [4, "enable-zoom"],
566
- "enableBasemap": [4, "enable-basemap"],
567
- "basemapConfig": [16],
568
- "showNewestFirst": [4, "show-newest-first"],
570
+ "hideMapOnLoad": [4, "hide-map-on-load"],
569
571
  "mapInfos": [16],
570
572
  "onlyShowUpdatableLayers": [4, "only-show-updatable-layers"],
571
573
  "searchConfiguration": [16],
572
574
  "shareIncludeEmbed": [4, "share-include-embed"],
573
575
  "shareIncludeSocial": [4, "share-include-social"],
576
+ "showNewestFirst": [4, "show-newest-first"],
574
577
  "theme": [1],
575
578
  "zoomAndScrollToSelected": [4, "zoom-and-scroll-to-selected"],
579
+ "zoomToScale": [2, "zoom-to-scale"],
576
580
  "_expandPopup": [32],
577
581
  "_hideFooter": [32],
578
582
  "_hideTable": [32],