@esri/solutions-components 0.7.24 → 0.7.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. package/dist/cjs/{info-card_4.cjs.entry.js → basemap-gallery_7.cjs.entry.js} +410 -324
  2. package/dist/cjs/buffer-tools_3.cjs.entry.js +3 -4
  3. package/dist/cjs/{calcite-alert_3.cjs.entry.js → calcite-alert_4.cjs.entry.js} +296 -3
  4. package/dist/cjs/calcite-combobox_6.cjs.entry.js +1 -2
  5. package/dist/cjs/calcite-flow_4.cjs.entry.js +3 -4
  6. package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +1 -2
  7. package/dist/cjs/{card-manager_2.cjs.entry.js → card-manager_3.cjs.entry.js} +182 -5
  8. package/dist/cjs/crowdsource-manager.cjs.entry.js +1 -2
  9. package/dist/cjs/crowdsource-reporter.cjs.entry.js +32 -90
  10. package/dist/cjs/{downloadUtils-401356b5.js → downloadUtils-83c6d3c3.js} +6 -6
  11. package/dist/cjs/{index.es-a9a4ff08.js → index.es-bd1a93b2.js} +2 -2
  12. package/dist/cjs/layout-manager.cjs.entry.js +1 -2
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/cjs/{locale-1ff119f5.js → locale-a476e15d.js} +24 -3
  15. package/dist/cjs/map-select-tools_3.cjs.entry.js +4 -5
  16. package/dist/cjs/{popupUtils-8d5b6e94.js → popupUtils-a73902a6.js} +2 -2
  17. package/dist/cjs/public-notification.cjs.entry.js +3 -4
  18. package/dist/cjs/solution-configuration.cjs.entry.js +1 -2
  19. package/dist/cjs/solution-contents_3.cjs.entry.js +1 -2
  20. package/dist/cjs/solutions-components.cjs.js +1 -1
  21. package/dist/cjs/spatial-ref.cjs.entry.js +1 -2
  22. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +5 -27
  23. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +69 -95
  24. package/dist/collection/demos/crowdsource-reporter.html +96 -45
  25. package/dist/components/crowdsource-reporter.js +95 -209
  26. package/dist/esm/{info-card_4.entry.js → basemap-gallery_7.entry.js} +406 -323
  27. package/dist/esm/buffer-tools_3.entry.js +1 -2
  28. package/dist/esm/{calcite-alert_3.entry.js → calcite-alert_4.entry.js} +295 -3
  29. package/dist/esm/calcite-combobox_6.entry.js +1 -2
  30. package/dist/esm/calcite-flow_4.entry.js +3 -4
  31. package/dist/esm/calcite-shell-panel_14.entry.js +1 -2
  32. package/dist/esm/{card-manager_2.entry.js → card-manager_3.entry.js} +181 -5
  33. package/dist/esm/crowdsource-manager.entry.js +1 -2
  34. package/dist/esm/crowdsource-reporter.entry.js +32 -90
  35. package/dist/esm/{downloadUtils-067dc2ff.js → downloadUtils-a301c193.js} +2 -2
  36. package/dist/esm/{index.es-92e46d8b.js → index.es-37a9907e.js} +2 -2
  37. package/dist/esm/layout-manager.entry.js +1 -2
  38. package/dist/esm/loader.js +1 -1
  39. package/dist/esm/{locale-13e3c96c.js → locale-731e75a8.js} +22 -2
  40. package/dist/esm/map-select-tools_3.entry.js +2 -3
  41. package/dist/esm/{popupUtils-b71f30fc.js → popupUtils-a593bd78.js} +1 -1
  42. package/dist/esm/public-notification.entry.js +2 -3
  43. package/dist/esm/solution-configuration.entry.js +1 -2
  44. package/dist/esm/solution-contents_3.entry.js +1 -2
  45. package/dist/esm/solutions-components.js +1 -1
  46. package/dist/esm/spatial-ref.entry.js +1 -2
  47. package/dist/solutions-components/demos/crowdsource-reporter.html +96 -45
  48. package/dist/solutions-components/{p-36cbf14f.js → p-0587972d.js} +1 -1
  49. package/dist/solutions-components/p-0b4f4b0e.entry.js +6 -0
  50. package/dist/solutions-components/{p-f54f3719.entry.js → p-0b619197.entry.js} +1 -1
  51. package/dist/solutions-components/{p-d50f34c4.entry.js → p-2656c6e4.entry.js} +1 -1
  52. package/dist/solutions-components/p-284cc5cd.entry.js +6 -0
  53. package/dist/solutions-components/{p-01032eec.entry.js → p-29f661f5.entry.js} +2 -2
  54. package/dist/solutions-components/p-5af99fd8.entry.js +6 -0
  55. package/dist/solutions-components/{p-d9061e5d.entry.js → p-7116f96d.entry.js} +1 -1
  56. package/dist/solutions-components/p-7c13406e.entry.js +6 -0
  57. package/dist/solutions-components/{p-685257d1.entry.js → p-7dbccc10.entry.js} +1 -1
  58. package/dist/solutions-components/p-8308f64c.entry.js +6 -0
  59. package/dist/solutions-components/{p-ca4023f4.entry.js → p-891682da.entry.js} +1 -1
  60. package/dist/solutions-components/{p-14ff1465.js → p-a603e673.js} +2 -2
  61. package/dist/solutions-components/p-b37ec1f3.entry.js +6 -0
  62. package/dist/solutions-components/{p-fec77450.js → p-db868283.js} +1 -1
  63. package/dist/solutions-components/{p-fb1c6811.entry.js → p-dded59a7.entry.js} +1 -1
  64. package/dist/solutions-components/p-e88a64be.entry.js +6 -0
  65. package/dist/solutions-components/p-e902ba19.js +36 -0
  66. package/dist/solutions-components/p-fe295e9d.entry.js +6 -0
  67. package/dist/solutions-components/solutions-components.esm.js +1 -1
  68. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +14 -28
  69. package/dist/types/components.d.ts +16 -0
  70. package/package.json +1 -1
  71. package/dist/cjs/basemap-gallery_5.cjs.entry.js +0 -573
  72. package/dist/cjs/loadModules-46d14e81.js +0 -30
  73. package/dist/esm/basemap-gallery_5.entry.js +0 -565
  74. package/dist/esm/loadModules-cea493da.js +0 -28
  75. package/dist/solutions-components/p-3606c4b8.entry.js +0 -6
  76. package/dist/solutions-components/p-48ff9cea.js +0 -21
  77. package/dist/solutions-components/p-5e832d65.entry.js +0 -6
  78. package/dist/solutions-components/p-8fc072ca.entry.js +0 -6
  79. package/dist/solutions-components/p-a2d3df14.entry.js +0 -6
  80. package/dist/solutions-components/p-ab006ace.js +0 -21
  81. package/dist/solutions-components/p-ba56035f.entry.js +0 -6
  82. package/dist/solutions-components/p-c0ed2b83.entry.js +0 -6
  83. package/dist/solutions-components/p-cc88bb42.entry.js +0 -6
  84. package/dist/solutions-components/p-db69f4ba.entry.js +0 -6
  85. package/dist/solutions-components/p-e3061220.entry.js +0 -6
@@ -8,94 +8,135 @@
8
8
  Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
10
  const index = require('./index-b8a649fc.js');
11
- const locale = require('./locale-1ff119f5.js');
12
- const loadModules = require('./loadModules-46d14e81.js');
13
- const popupUtils = require('./popupUtils-8d5b6e94.js');
11
+ const locale = require('./locale-a476e15d.js');
14
12
  require('./esri-loader-a91c0ec1.js');
15
13
  require('./_commonjsHelpers-384729db.js');
16
14
 
17
- const infoCardCss = ":host{display:block;--calcite-label-margin-bottom:0}.padding-1-2{padding:0.5rem}.display-none{display:none !important}.display-flex{display:flex}.position-absolute{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto}.esri-features__footer{display:none !important}.button-container{justify-content:space-between;align-items:center}.top-border{border-top:1px solid var(--calcite-color-border-1)}.min-width-100{min-width:100px}.width-100{width:100%}.esri-features__container{padding:0.5rem !important;background-color:var(--calcite-color-foreground-1) !important;height:100% !important}.overflow-hidden{overflow:hidden}.height-40{height:40px}.padding-top-46{padding-top:46px}.end-border{border-inline-end:1px solid var(--calcite-color-border-1)}.font-bold{font-weight:bold}.visibility-hidden{visibility:hidden;height:0px}.padding-inline-start-1{padding-inline-start:1rem}";
15
+ const basemapGalleryCss = ":host{display:block}";
18
16
 
19
- const InfoCard = class {
17
+ const BasemapGallery = class {
20
18
  constructor(hostRef) {
21
19
  index.registerInstance(this, hostRef);
22
- this.popupClosed = index.createEvent(this, "popupClosed", 7);
23
- this.selectionChanged = index.createEvent(this, "selectionChanged", 7);
24
- this.graphics = undefined;
25
- this.isLoading = false;
26
- this.isMobile = undefined;
27
20
  this.mapView = undefined;
28
- this.zoomAndScrollToSelected = undefined;
29
- this.allowEditing = true;
30
- this._alertOpen = false;
31
- this._count = "";
32
- this._editRecordOpen = false;
33
- this._mobileTitle = "";
34
- this._showListView = false;
35
- this._translations = undefined;
21
+ this.basemapConfig = undefined;
22
+ this.basemapWidget = undefined;
36
23
  }
37
24
  //--------------------------------------------------------------------------
38
25
  //
39
26
  // Watch handlers
40
27
  //
41
28
  //--------------------------------------------------------------------------
29
+ async mapViewWatchHandler() {
30
+ await this.mapView.when(() => {
31
+ void this._initBaseMapGallery(this.mapView);
32
+ });
33
+ }
34
+ //--------------------------------------------------------------------------
35
+ //
36
+ // Methods (public)
37
+ //
38
+ //--------------------------------------------------------------------------
39
+ //--------------------------------------------------------------------------
40
+ //
41
+ // Events (public)
42
+ //
43
+ //--------------------------------------------------------------------------
44
+ //--------------------------------------------------------------------------
45
+ //
46
+ // Functions (lifecycle)
47
+ //
48
+ //--------------------------------------------------------------------------
42
49
  /**
43
- * Watch for changes to the graphic and update the feature widget
50
+ * StencilJS: Called once just after the component is first connected to the DOM.
44
51
  */
45
- async graphicsWatchHandler() {
46
- await this.setGraphics();
52
+ async componentWillLoad() {
53
+ return this._initModules();
47
54
  }
48
55
  /**
49
- * Watch for changes to the isMobile prop then init the Features widget
50
- * We need to know if the title should be displayed by the widget (non mobile)
51
- * or by us (mobile)
56
+ * StencilJS: Renders the component.
52
57
  */
53
- async isMobileWatchHandler() {
54
- await this._initFeaturesWidget();
58
+ render() {
59
+ return (index.h(index.Host, null, index.h("div", { ref: (el) => { this._basemapElement = el; } })));
55
60
  }
56
61
  /**
57
- * Watch for changes to the mapView and re-init the Feature widget
62
+ * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
58
63
  */
59
- async mapViewWatchHandler() {
60
- return await this._initFeaturesWidget();
64
+ async componentDidLoad() {
65
+ if (this.mapView) {
66
+ await this.mapViewWatchHandler();
67
+ }
61
68
  }
62
69
  //--------------------------------------------------------------------------
63
70
  //
64
- // Methods (public)
71
+ // Functions (protected)
65
72
  //
66
73
  //--------------------------------------------------------------------------
67
74
  /**
68
- * Get the current selected feature from the Features widget
75
+ * Load esri javascript api modules
69
76
  *
70
- * @returns Promise resolving with the current feature
71
- */
72
- async getSelectedFeature() {
73
- return this._features.selectedFeature;
74
- }
75
- /**
76
- * Respond to and close the edit record display
77
+ * @returns Promise resolving when function is done
77
78
  *
78
- * @returns a promise when the operation has completed
79
+ * @protected
79
80
  */
80
- async closeEdit() {
81
- this._editRecordOpen = false;
81
+ async _initModules() {
82
+ const [BasemapGallery, PortalBasemapsSource] = await locale.loadModules([
83
+ "esri/widgets/BasemapGallery",
84
+ "esri/widgets/BasemapGallery/support/PortalBasemapsSource"
85
+ ]);
86
+ this.BasemapGallery = BasemapGallery;
87
+ this.PortalBasemapsSource = PortalBasemapsSource;
82
88
  }
83
89
  /**
84
- * Reset key properties when the layer selection changes
90
+ * Initialize the basemap gallery or reset the current view if it already exists
91
+ *
92
+ * @protected
85
93
  */
86
- async layerSelectionChange() {
94
+ async _initBaseMapGallery(view) {
87
95
  var _a;
88
- this._showListView = false;
89
- if ((_a = this._features) === null || _a === void 0 ? void 0 : _a.viewModel) {
90
- this._features.viewModel.featureMenuOpen = false;
91
- this._features.close();
96
+ if (this.BasemapGallery) {
97
+ if (this.basemapWidget) {
98
+ this.basemapWidget.destroy();
99
+ }
100
+ const source = new this.PortalBasemapsSource({
101
+ query: ((_a = this.basemapConfig) === null || _a === void 0 ? void 0 : _a.basemapGroupId) ? `id:${this.basemapConfig.basemapGroupId}` : null,
102
+ filterFunction: this.basemapConfig ? (basemap) => {
103
+ return !this.basemapConfig.basemapIdsToFilter.includes(basemap.portalItem.id);
104
+ } : () => true
105
+ });
106
+ await source.refresh();
107
+ this.basemapWidget = new this.BasemapGallery({
108
+ container: this._basemapElement,
109
+ view,
110
+ source
111
+ });
92
112
  }
93
113
  }
94
- /**
95
- * Refresh the info-card graphics
96
- */
97
- async refreshGraphics(evt) {
98
- this.graphics = [...evt.detail];
114
+ get el() { return index.getElement(this); }
115
+ static get watchers() { return {
116
+ "mapView": ["mapViewWatchHandler"]
117
+ }; }
118
+ };
119
+ BasemapGallery.style = basemapGalleryCss;
120
+
121
+ const floorFilterCss = ":host{display:block}";
122
+
123
+ const FloorFilter = class {
124
+ constructor(hostRef) {
125
+ index.registerInstance(this, hostRef);
126
+ this.levelChanged = index.createEvent(this, "levelChanged", 7);
127
+ this.enabled = undefined;
128
+ this.floorFilterWidget = undefined;
129
+ this.mapView = undefined;
130
+ }
131
+ //--------------------------------------------------------------------------
132
+ //
133
+ // Watch handlers
134
+ //
135
+ //--------------------------------------------------------------------------
136
+ async mapViewWatchHandler() {
137
+ await this.mapView.when(() => {
138
+ this._initFloorFilter(this.mapView);
139
+ });
99
140
  }
100
141
  //--------------------------------------------------------------------------
101
142
  //
@@ -104,41 +145,12 @@ const InfoCard = class {
104
145
  //--------------------------------------------------------------------------
105
146
  /**
106
147
  * StencilJS: Called once just after the component is first connected to the DOM.
107
- *
108
- * @returns Promise when complete
109
148
  */
110
149
  async componentWillLoad() {
111
- await this._initModules();
112
- await this._getTranslations();
113
- this._popupUtils = new popupUtils.PopupUtils();
150
+ return this._initModules();
114
151
  }
115
- /**
116
- * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
117
- * @returns Promise when complete
118
- */
119
- async componentDidLoad() {
120
- var _a;
121
- if (((_a = this.graphics) === null || _a === void 0 ? void 0 : _a.length) > 0) {
122
- await this.setGraphics();
123
- }
124
- }
125
- /**
126
- * Renders the component.
127
- */
128
152
  render() {
129
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
130
- const loadingClass = this.isLoading ? "" : "display-none";
131
- const featureNodeClass = this.isLoading || this._editRecordOpen ? "visibility-hidden" : "position-absolute";
132
- const editClass = !this.isLoading && this._editRecordOpen ? "position-absolute" : "display-none";
133
- const editButtonClass = (!this.isLoading && this._editRecordOpen) || this._showListView ? "display-none" : "";
134
- const nextBackDisabled = ((_b = (_a = this._features) === null || _a === void 0 ? void 0 : _a.features) === null || _b === void 0 ? void 0 : _b.length) < 2;
135
- const nextBackClass = this.isMobile ? "display-none" : "";
136
- const shellClass = this.isMobile && !this._editRecordOpen ? "padding-top-46" : "";
137
- const id = (_d = (_c = this._features) === null || _c === void 0 ? void 0 : _c.selectedFeature) === null || _d === void 0 ? void 0 : _d.getObjectId();
138
- const ids = parseInt(id === null || id === void 0 ? void 0 : id.toString(), 10) > -1 ? [id] : [];
139
- const deleteEnabled = ((_e = this._layer) === null || _e === void 0 ? void 0 : _e.editingEnabled) && ((_h = (_g = (_f = this._layer) === null || _f === void 0 ? void 0 : _f.capabilities) === null || _g === void 0 ? void 0 : _g.operations) === null || _h === void 0 ? void 0 : _h.supportsDelete);
140
- return (index.h(index.Host, null, this.isMobile && !this._editRecordOpen ? (index.h("calcite-panel", null, index.h("calcite-action", { class: "end-border", icon: "chevron-left", iconFlipRtl: true, onClick: () => this._closePopup(), scale: "s", slot: "header-actions-start", text: "" }), index.h("span", { class: "font-bold", slot: "header-content" }, this._mobileTitle))) : undefined, index.h("calcite-shell", { class: shellClass }, index.h("calcite-loader", { class: loadingClass, label: this._translations.fetchingData }), index.h("div", { class: "esri-widget " + featureNodeClass, id: "features-node" }), index.h("div", { class: `${editButtonClass} width-100`, slot: "footer" }, this.allowEditing &&
141
- index.h("div", { class: "display-flex top-border padding-1-2" }, index.h("calcite-button", { appearance: "solid", id: "solutions-edit", onClick: () => this._openEditRecord(), width: "full" }, this._translations.edit), this.isMobile && deleteEnabled ? (index.h("delete-button", { class: "padding-inline-start-1 width-100", id: "solutions-delete", ids: ids, layer: this._layer, onEditsComplete: () => this._closePopup() })) : undefined, index.h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": "solutions-edit" }, index.h("span", null, this._translations.edit)), this.isMobile ? (index.h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": "solutions-delete" }, index.h("span", null, this._translations.delete))) : undefined), !nextBackDisabled && index.h("div", { class: `display-flex padding-1-2 button-container top-border ${nextBackClass}` }, index.h("div", { class: "min-width-100" }, index.h("calcite-button", { appearance: "outline", disabled: nextBackDisabled, id: "solutions-back", onClick: () => this._back(), width: "full" }, this._translations.back), index.h("calcite-tooltip", { label: "", placement: "top", "reference-element": "solutions-back" }, index.h("span", null, this._translations.back))), index.h("div", null, index.h("calcite-action", { icon: "list", onClick: () => this._toggleListView(), scale: "s", text: this._count, textEnabled: true })), index.h("div", { class: "min-width-100" }, index.h("calcite-button", { appearance: "outline", disabled: nextBackDisabled, id: "solutions-next", onClick: () => this._next(), width: "full" }, this._translations.next), index.h("calcite-tooltip", { label: "", placement: "top", "reference-element": "solutions-next" }, index.h("span", null, this._translations.next))))), index.h("edit-card", { class: editClass, graphicIndex: (_j = this._features) === null || _j === void 0 ? void 0 : _j.selectedFeatureIndex, graphics: this.graphics, mapView: this.mapView, open: this._editRecordOpen }), index.h("calcite-alert", { icon: "layer-broken", kind: "warning", label: "", onCalciteAlertClose: () => this._alertClosed(), open: this._alertOpen, placement: "top" }, index.h("div", { slot: "title" }, this._translations.editDisabled), index.h("div", { slot: "message" }, this._translations.enableEditing)))));
153
+ return (index.h(index.Host, null, index.h("div", { ref: (el) => { this._floorFilterElement = el; } })));
142
154
  }
143
155
  //--------------------------------------------------------------------------
144
156
  //
@@ -153,217 +165,174 @@ const InfoCard = class {
153
165
  * @protected
154
166
  */
155
167
  async _initModules() {
156
- const [Features, reactiveUtils] = await loadModules.loadModules([
157
- "esri/widgets/Features",
168
+ const [FloorFilter, reactiveUtils] = await locale.loadModules([
169
+ "esri/widgets/FloorFilter",
158
170
  "esri/core/reactiveUtils"
159
171
  ]);
160
- this.Features = Features;
172
+ this.FloorFilter = FloorFilter;
161
173
  this.reactiveUtils = reactiveUtils;
162
174
  }
163
175
  /**
164
- * Initializes the features widget if not created and updates the feature widget and other required states
165
- *
166
- * @protected
176
+ * Initialize the floor filter or reset the current view if it already exists
167
177
  */
168
- async setGraphics() {
178
+ _initFloorFilter(view) {
169
179
  var _a;
170
- if (!this._features) {
171
- await this._initFeaturesWidget();
172
- }
173
- if (this.graphics.length > 0) {
174
- this._layer = (_a = this.graphics[0]) === null || _a === void 0 ? void 0 : _a.layer;
175
- this._editEnabled = this._layer.editingEnabled && this._layer.capabilities.operations.supportsUpdate;
176
- this._mobileTitle = await this._popupUtils.getPopupTitle(this.graphics[0]);
177
- this._features.open({
178
- features: this.graphics
179
- });
180
- }
181
- else {
182
- this._features.clear();
183
- this._features.close();
184
- }
185
- this._count = this._getCount();
186
- }
187
- /**
188
- * Init the Feature widget so we can display the popup content
189
- *
190
- * @returns a promise when the operation has completed
191
- *
192
- * @protected
193
- */
194
- async _initFeaturesWidget() {
195
- var _a;
196
- return this.isMobile !== undefined ? await ((_a = this.mapView) === null || _a === void 0 ? void 0 : _a.when(() => {
197
- if (!this._features) {
198
- this._features = new this.Features({
199
- view: this.mapView,
200
- container: "features-node",
201
- visibleElements: {
202
- actionBar: false,
203
- closeButton: false,
204
- heading: !this.isMobile
205
- }
180
+ if (view && this.enabled && this.FloorFilter && ((_a = view === null || view === void 0 ? void 0 : view.map) === null || _a === void 0 ? void 0 : _a.floorInfo)) {
181
+ if (!this.floorFilterWidget) {
182
+ this.floorFilterWidget = new this.FloorFilter({
183
+ container: this._floorFilterElement,
184
+ view
206
185
  });
207
- this.reactiveUtils.watch(() => this._features.viewModel.featureMenuOpen, (isOpen) => {
208
- if (!isOpen) {
209
- this._showListView = isOpen;
210
- }
211
- });
212
- if (this.zoomAndScrollToSelected) {
213
- this.reactiveUtils.watch(() => this._features.selectedFeatureIndex, (i) => {
214
- if (i > -1) {
215
- this.selectionChanged.emit([this._features.selectedFeature]);
216
- }
217
- });
186
+ if (this._levelHandle) {
187
+ this._levelHandle.remove();
218
188
  }
189
+ this._levelHandle = this.reactiveUtils.watch(() => this.floorFilterWidget.level, (level) => {
190
+ this.levelChanged.emit(level);
191
+ });
219
192
  }
220
193
  else {
221
- this._features.view = this.mapView;
222
- this._features.visibleElements.actionBar = false;
223
- this._features.visibleElements.closeButton = false;
224
- this._features.visibleElements.heading = !this.isMobile;
194
+ this.floorFilterWidget.view = view;
225
195
  }
226
- })) : Promise.resolve();
196
+ }
227
197
  }
228
- /**
229
- * Close the popup and emit the selected features
230
- */
231
- _closePopup() {
232
- this.popupClosed.emit();
198
+ get el() { return index.getElement(this); }
199
+ static get watchers() { return {
200
+ "mapView": ["mapViewWatchHandler"]
201
+ }; }
202
+ };
203
+ FloorFilter.style = floorFilterCss;
204
+
205
+ const mapFullscreenCss = ":host{display:block}";
206
+
207
+ const MapFullscreen = class {
208
+ constructor(hostRef) {
209
+ index.registerInstance(this, hostRef);
210
+ this.fullscreenStateChange = index.createEvent(this, "fullscreenStateChange", 7);
211
+ this.mapView = undefined;
212
+ this.fullscreenWidget = undefined;
233
213
  }
214
+ //--------------------------------------------------------------------------
215
+ //
216
+ // Watch handlers
217
+ //
218
+ //--------------------------------------------------------------------------
234
219
  /**
235
- * Set the alertOpen member to false when the alert is closed
220
+ * Called each time the mapView prop is changed.
221
+ *
222
+ * @returns Promise when complete
236
223
  */
237
- _alertClosed() {
238
- this._alertOpen = false;
224
+ async mapViewWatchHandler() {
225
+ await this.mapView.when(async () => {
226
+ await this._initFullscreenWidget();
227
+ });
239
228
  }
229
+ //--------------------------------------------------------------------------
230
+ //
231
+ // Functions (lifecycle)
232
+ //
233
+ //--------------------------------------------------------------------------
240
234
  /**
241
- * Open the edit record
235
+ * StencilJS: Called once just after the component is first connected to the DOM.
242
236
  */
243
- _openEditRecord() {
244
- if (this._editEnabled) {
245
- this._editRecordOpen = true;
246
- }
247
- else {
248
- this._alertOpen = true;
249
- }
237
+ async componentWillLoad() {
238
+ await this._initModules();
250
239
  }
251
240
  /**
252
- * Go to the previous feature in the features widget
241
+ * Renders the component.
253
242
  */
254
- _back() {
255
- this._features.previous();
256
- this._count = this._getCount();
243
+ render() {
244
+ return (index.h(index.Host, null, index.h("div", { class: "fullscreen-widget", ref: (el) => { this._fullscreenElement = el; } })));
257
245
  }
258
246
  /**
259
- * Go to the next feature in the features widget
247
+ * StencilJS: Called just after the component updates.
248
+ * It's never called during the first render().
260
249
  */
261
- _next() {
262
- this._features.next();
263
- this._count = this._getCount();
250
+ async componentDidUpdate() {
251
+ await this._initFullscreenWidget();
264
252
  }
265
253
  /**
266
- * Get the current index of total string
267
- *
268
- * @returns the index of total string
254
+ * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
269
255
  */
270
- _getCount() {
271
- var _a, _b, _c;
272
- const index = (((_a = this._features) === null || _a === void 0 ? void 0 : _a.viewModel.selectedFeatureIndex) + 1).toString();
273
- const total = (_c = (_b = this._features) === null || _b === void 0 ? void 0 : _b.features) === null || _c === void 0 ? void 0 : _c.length.toString();
274
- return this._translations.indexOfTotal
275
- .replace("{{index}}", index)
276
- .replace("{{total}}", total);
256
+ async componentDidLoad() {
257
+ await this._initFullscreenWidget();
277
258
  }
259
+ //--------------------------------------------------------------------------
260
+ //
261
+ // Functions (protected)
262
+ //
263
+ //--------------------------------------------------------------------------
278
264
  /**
279
- * Toggle the visibility of the features list view
265
+ * Load esri javascript api modules
266
+ *
267
+ * @returns Promise resolving when function is done
268
+ *
269
+ * @protected
280
270
  */
281
- _toggleListView() {
282
- this._showListView = !this._showListView;
283
- const i = this._features.selectedFeatureIndex;
284
- this._features.open({
285
- features: this.graphics,
286
- featureMenuOpen: this._showListView
287
- });
288
- this._features.selectedFeatureIndex = i;
271
+ async _initModules() {
272
+ const [Fullscreen, reactiveUtils] = await locale.loadModules([
273
+ "esri/widgets/Fullscreen",
274
+ "esri/core/reactiveUtils"
275
+ ]);
276
+ this.Fullscreen = Fullscreen;
277
+ this.reactiveUtils = reactiveUtils;
289
278
  }
290
279
  /**
291
- * Fetches the component's translations
280
+ * Initialize the search widget
292
281
  *
293
- * @returns Promise when complete
294
282
  * @protected
295
283
  */
296
- async _getTranslations() {
297
- const messages = await locale.getLocaleComponentStrings(this.el);
298
- this._translations = messages[0];
284
+ async _initFullscreenWidget() {
285
+ if (this.mapView && this._fullscreenElement && !this.fullscreenWidget) {
286
+ this.fullscreenWidget = new this.Fullscreen({
287
+ view: this.mapView
288
+ });
289
+ await this.fullscreenWidget.when(() => {
290
+ if (this._fullscreenStateChangeHandle) {
291
+ this._fullscreenStateChangeHandle.remove();
292
+ }
293
+ this._fullscreenStateChangeHandle = this.reactiveUtils.watch(() => this.fullscreenWidget.viewModel.state, (state) => this.fullscreenStateChange.emit(state));
294
+ });
295
+ }
296
+ else if (this.fullscreenWidget) {
297
+ this.fullscreenWidget.view = this.mapView;
298
+ }
299
299
  }
300
- get el() { return index.getElement(this); }
301
300
  static get watchers() { return {
302
- "graphics": ["graphicsWatchHandler"],
303
- "isMobile": ["isMobileWatchHandler"],
304
301
  "mapView": ["mapViewWatchHandler"]
305
302
  }; }
306
303
  };
307
- InfoCard.style = infoCardCss;
304
+ MapFullscreen.style = mapFullscreenCss;
308
305
 
309
- 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{visibility:hidden}.display-none{display:none}";
306
+ const mapLegendCss = ":host{display:block}";
310
307
 
311
- const MapCard = class {
308
+ const MapLegend = class {
312
309
  constructor(hostRef) {
313
310
  index.registerInstance(this, hostRef);
314
- this.mapChanged = index.createEvent(this, "mapChanged", 7);
315
- this.beforeMapChanged = index.createEvent(this, "beforeMapChanged", 7);
316
- /**
317
- * boolean: When true the default map provided via url params has been loaded and should no longer override other maps
318
- */
319
- this._defaultWebmapHonored = false;
320
- /**
321
- * string: the id of map currently displayed
322
- */
323
- this._loadedId = "";
324
- this.defaultWebmapId = "";
325
- this.enableHome = undefined;
326
- this.enableLegend = undefined;
327
- this.enableFloorFilter = undefined;
328
- this.enableFullscreen = undefined;
329
- this.enableSingleExpand = true;
330
- this.enableSearch = undefined;
331
- this.enableBasemap = undefined;
332
- this.basemapConfig = undefined;
333
- this.hidden = undefined;
334
- this.homeZoomIndex = 3;
335
- this.homeZoomPosition = "top-left";
336
- this.homeZoomToolsSize = "m";
337
- this.mapInfos = [];
338
- this.mapWidgetsIndex = 0;
339
- this.mapWidgetsPosition = "top-right";
340
- this.mapWidgetsSize = "m";
341
311
  this.mapView = undefined;
342
- this.stackTools = true;
343
- this.theme = undefined;
344
- this.toolOrder = undefined;
345
- this._searchConfiguration = undefined;
346
- this._webMapInfo = undefined;
312
+ this.legendWidget = undefined;
347
313
  }
348
314
  //--------------------------------------------------------------------------
349
315
  //
350
316
  // Watch handlers
351
317
  //
352
318
  //--------------------------------------------------------------------------
353
- /**
354
- * Add/remove home widget
355
- */
356
- enableHomeWatchHandler() {
357
- this._initHome();
358
- }
359
- /**
360
- * Listen for changes to map info and load the appropriate map
361
- */
362
- async mapInfoChange(evt) {
363
- await this._loadMap(evt.detail);
319
+ async mapViewWatchHandler() {
320
+ await this.mapView.when(() => {
321
+ this._initLegend(this.mapView);
322
+ });
364
323
  }
365
324
  //--------------------------------------------------------------------------
366
325
  //
326
+ // Methods (public)
327
+ //
328
+ //--------------------------------------------------------------------------
329
+ //--------------------------------------------------------------------------
330
+ //
331
+ // Events (public)
332
+ //
333
+ //--------------------------------------------------------------------------
334
+ //--------------------------------------------------------------------------
335
+ //
367
336
  // Functions (lifecycle)
368
337
  //
369
338
  //--------------------------------------------------------------------------
@@ -371,18 +340,21 @@ const MapCard = class {
371
340
  * StencilJS: Called once just after the component is first connected to the DOM.
372
341
  */
373
342
  async componentWillLoad() {
374
- await this._initModules();
343
+ return this._initModules();
375
344
  }
376
345
  /**
377
- * Renders the component.
346
+ * StencilJS: Renders the component.
378
347
  */
379
348
  render() {
380
- var _a, _b;
381
- const mapClass = this.hidden ? "visibility-hidden" : "";
382
- const themeClass = this.theme === "dark" ? "calcite-mode-dark" : "calcite-mode-light";
383
- const mapPickerClass = ((_a = this.mapInfos) === null || _a === void 0 ? void 0 : _a.length) > 1 ? "" : "display-none";
384
- const mapHeightClass = ((_b = this.mapInfos) === null || _b === void 0 ? void 0 : _b.length) > 1 ? "map-height" : "height-full";
385
- return (index.h(index.Host, null, index.h("map-picker", { class: mapPickerClass, mapInfos: this.mapInfos, ref: (el) => this._mapPicker = el }), index.h("div", { class: `${mapHeightClass} ${mapClass}`, ref: (el) => (this._mapDiv = el) }), index.h("map-tools", { basemapConfig: this.basemapConfig, class: `box-shadow ${themeClass}`, enableBasemap: this.enableBasemap, enableFloorFilter: this.enableFloorFilter, enableFullscreen: this.enableFullscreen, enableHome: this.enableHome, enableLegend: this.enableLegend, enableSearch: this.enableSearch, enableSingleExpand: this.enableSingleExpand, homeZoomToolsSize: this.homeZoomToolsSize, mapView: this.mapView, mapWidgetsSize: this.mapWidgetsSize, position: this.mapWidgetsPosition, ref: (el) => this._mapTools = el, searchConfiguration: this._searchConfiguration, stackTools: this.stackTools, toolOrder: this.toolOrder })));
349
+ return (index.h(index.Host, null, index.h("div", { ref: (el) => { this._legendElement = el; } })));
350
+ }
351
+ /**
352
+ * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
353
+ */
354
+ async componentDidLoad() {
355
+ if (this.mapView) {
356
+ await this.mapViewWatchHandler();
357
+ }
386
358
  }
387
359
  //--------------------------------------------------------------------------
388
360
  //
@@ -397,91 +369,33 @@ const MapCard = class {
397
369
  * @protected
398
370
  */
399
371
  async _initModules() {
400
- const [WebMap, MapView, Home] = await loadModules.loadModules([
401
- "esri/WebMap",
402
- "esri/views/MapView",
403
- "esri/widgets/Home"
372
+ const [Legend] = await locale.loadModules([
373
+ "esri/widgets/Legend"
404
374
  ]);
405
- this.WebMap = WebMap;
406
- this.MapView = MapView;
407
- this.Home = Home;
375
+ this.Legend = Legend;
408
376
  }
409
377
  /**
410
- * Load the webmap for the provided webMapInfo
411
- *
412
- * @param webMapInfo the webmap id and name to load
378
+ * Initialize the basemap gallery or reset the current view if it already exists
413
379
  */
414
- async _loadMap(webMapInfo) {
415
- var _a;
416
- // on the first render use the default webmap id if provided otherwise use the first child of the provided mapInfos
417
- const loadDefaultMap = !this._defaultWebmapHonored && this.defaultWebmapId;
418
- const defaultMap = (_a = this.mapInfos) === null || _a === void 0 ? void 0 : _a.filter(i => i.id === this.defaultWebmapId);
419
- const mapConfigChanged = JSON.stringify(webMapInfo) !== JSON.stringify(this._webMapInfo);
420
- this._webMapInfo = loadDefaultMap && defaultMap ? defaultMap[0] :
421
- !(webMapInfo === null || webMapInfo === void 0 ? void 0 : webMapInfo.id) && this.mapInfos.length > 0 ? this.mapInfos[0] : webMapInfo;
422
- const id = this._webMapInfo.id;
423
- const isDefaultMap = loadDefaultMap && (webMapInfo === null || webMapInfo === void 0 ? void 0 : webMapInfo.id) === this.defaultWebmapId;
424
- if ((this._loadedId !== id && !loadDefaultMap) || isDefaultMap) {
425
- const webMap = new this.WebMap({
426
- portalItem: { id }
427
- });
428
- this.mapView = new this.MapView({
429
- container: this._mapDiv,
430
- map: webMap,
431
- resizeAlign: "center"
432
- });
433
- this._loadedId = id;
434
- this._searchConfiguration = this._webMapInfo.searchConfiguration;
435
- this.beforeMapChanged.emit();
436
- await this.mapView.when(() => {
437
- this._initHome();
438
- this.mapView.ui.add(this._mapTools, { position: this.mapWidgetsPosition, index: this.mapWidgetsIndex });
439
- this._defaultWebmapHonored = isDefaultMap ? true : this._defaultWebmapHonored;
440
- this.mapChanged.emit({
441
- id: id,
442
- mapView: this.mapView
380
+ _initLegend(view) {
381
+ if (view && this.Legend) {
382
+ if (!this.legendWidget) {
383
+ this.legendWidget = new this.Legend({
384
+ container: this._legendElement,
385
+ view
443
386
  });
444
- });
445
- }
446
- else if (loadDefaultMap) {
447
- this._defaultWebmapHonored = true;
448
- this._mapPicker.setMapByID(id);
449
- }
450
- else if (mapConfigChanged) {
451
- // Map is the same so no need to reload but we need to update for any changes from the config
452
- this._searchConfiguration = this._webMapInfo.searchConfiguration;
453
- this.beforeMapChanged.emit();
454
- this.mapChanged.emit({
455
- id: id,
456
- mapView: this.mapView
457
- });
458
- }
459
- }
460
- /**
461
- * Add/remove the home widget base on enableHome prop
462
- *
463
- * @protected
464
- */
465
- _initHome() {
466
- if (this.enableHome) {
467
- this._homeWidget = new this.Home({
468
- view: this.mapView
469
- });
470
- this.mapView.ui.add(this._homeWidget, { position: this.homeZoomPosition, index: this.homeZoomIndex });
471
- const size = this.homeZoomToolsSize === "s" ? "32px" : this.homeZoomToolsSize === "m" ? "40px" : "48px";
472
- this._homeWidget.domNode.style.height = size;
473
- this._homeWidget.domNode.style.width = size;
474
- }
475
- else if (this._homeWidget) {
476
- this.mapView.ui.remove(this._homeWidget);
387
+ }
388
+ else {
389
+ this.legendWidget.view = view;
390
+ }
477
391
  }
478
392
  }
479
393
  get el() { return index.getElement(this); }
480
394
  static get watchers() { return {
481
- "enableHome": ["enableHomeWatchHandler"]
395
+ "mapView": ["mapViewWatchHandler"]
482
396
  }; }
483
397
  };
484
- MapCard.style = mapCardCss;
398
+ MapLegend.style = mapLegendCss;
485
399
 
486
400
  const mapPickerCss = ":host{display:block;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.width-full{width:100%}.height-full{height:100%}.display-flex{display:flex}.border-bottom-1{border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-color-border-3)}.action-bar-size{height:51px;width:100%}.map-list{position:absolute;display:flex;flex-direction:column;overflow:hidden;animation:calcite-scrim-fade-in var(--calcite-internal-animation-timing-medium) ease-in-out;background-color:var(--calcite-color-background);z-index:1000;width:100%;height:-moz-fit-content;height:fit-content}.display-none{display:none}.align-center{align-items:center}";
487
401
 
@@ -641,6 +555,175 @@ const MapPicker = class {
641
555
  };
642
556
  MapPicker.style = mapPickerCss;
643
557
 
558
+ const mapSearchCss = ":host{display:block}.search-widget{width:100% !important;border:1px solid var(--calcite-color-border-input)}";
559
+
560
+ const MapSearch = class {
561
+ constructor(hostRef) {
562
+ index.registerInstance(this, hostRef);
563
+ this.mapView = undefined;
564
+ this.popupEnabled = false;
565
+ this.resultGraphicEnabled = false;
566
+ this.searchConfiguration = undefined;
567
+ this.searchTerm = undefined;
568
+ this.searchWidget = undefined;
569
+ }
570
+ //--------------------------------------------------------------------------
571
+ //
572
+ // Watch handlers
573
+ //
574
+ //--------------------------------------------------------------------------
575
+ /**
576
+ * Called each time the searchConfiguration prop is changed.
577
+ *
578
+ * @returns Promise when complete
579
+ */
580
+ async watchSearchConfigurationHandler() {
581
+ this._initSearchWidget();
582
+ }
583
+ /**
584
+ * Called each time the mapView prop is changed.
585
+ *
586
+ * @returns Promise when complete
587
+ */
588
+ async mapViewWatchHandler() {
589
+ await this.mapView.when(() => {
590
+ this._initSearchWidget();
591
+ });
592
+ }
593
+ //--------------------------------------------------------------------------
594
+ //
595
+ // Methods (public)
596
+ //
597
+ //--------------------------------------------------------------------------
598
+ //--------------------------------------------------------------------------
599
+ //
600
+ // Events (public)
601
+ //
602
+ //--------------------------------------------------------------------------
603
+ //--------------------------------------------------------------------------
604
+ //
605
+ // Functions (lifecycle)
606
+ //
607
+ //--------------------------------------------------------------------------
608
+ /**
609
+ * StencilJS: Called once just after the component is first connected to the DOM.
610
+ */
611
+ async componentWillLoad() {
612
+ await this._initModules();
613
+ }
614
+ /**
615
+ * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
616
+ */
617
+ async componentDidLoad() {
618
+ return this._initSearchWidget();
619
+ }
620
+ /**
621
+ * Renders the component.
622
+ */
623
+ render() {
624
+ return (index.h(index.Host, null, index.h("div", { class: "search-widget", ref: (el) => { this._searchElement = el; } })));
625
+ }
626
+ //--------------------------------------------------------------------------
627
+ //
628
+ // Functions (protected)
629
+ //
630
+ //--------------------------------------------------------------------------
631
+ /**
632
+ * Load esri javascript api modules
633
+ *
634
+ * @returns Promise resolving when function is done
635
+ *
636
+ * @protected
637
+ */
638
+ async _initModules() {
639
+ const [Search, FeatureLayer] = await locale.loadModules([
640
+ "esri/widgets/Search",
641
+ "esri/layers/FeatureLayer"
642
+ ]);
643
+ this.Search = Search;
644
+ this.FeatureLayer = FeatureLayer;
645
+ }
646
+ /**
647
+ * Initialize the search widget
648
+ *
649
+ * @protected
650
+ */
651
+ _initSearchWidget() {
652
+ if (this.mapView && this._searchElement && !this.searchWidget) {
653
+ let searchOptions = {
654
+ view: this.mapView,
655
+ container: this._searchElement,
656
+ searchTerm: this.searchTerm
657
+ };
658
+ if (this.searchConfiguration) {
659
+ const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
660
+ searchOptions = Object.assign({}, searchConfiguration);
661
+ }
662
+ this.searchWidget = new this.Search(searchOptions);
663
+ this.searchWidget.popupEnabled = this.popupEnabled;
664
+ this.searchWidget.resultGraphicEnabled = this.resultGraphicEnabled;
665
+ }
666
+ else {
667
+ if (this.searchWidget) {
668
+ this.searchWidget.view = this.mapView;
669
+ }
670
+ }
671
+ }
672
+ /**
673
+ * Initialize the search widget based on user defined configuration
674
+ *
675
+ * @param searchConfiguration search configuration defined by the user
676
+ * @param view the current map view
677
+ *
678
+ * @protected
679
+ */
680
+ _getSearchConfig(searchConfiguration, view) {
681
+ const INCLUDE_DEFAULT_SOURCES = "includeDefaultSources";
682
+ const sources = searchConfiguration.sources;
683
+ if ((sources === null || sources === void 0 ? void 0 : sources.length) > 0) {
684
+ searchConfiguration[INCLUDE_DEFAULT_SOURCES] = false;
685
+ sources.forEach((source) => {
686
+ var _a, _b;
687
+ const isLayerSource = source.hasOwnProperty("layer");
688
+ if (isLayerSource) {
689
+ const layerSource = source;
690
+ const layerId = (_a = layerSource.layer) === null || _a === void 0 ? void 0 : _a.id;
691
+ const layerFromMap = layerId ? view.map.findLayerById(layerId) : null;
692
+ const layerUrl = (_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url;
693
+ if (layerFromMap) {
694
+ layerSource.layer = layerFromMap;
695
+ }
696
+ else if (layerUrl) {
697
+ layerSource.layer = new this.FeatureLayer(layerUrl);
698
+ }
699
+ }
700
+ });
701
+ sources === null || sources === void 0 ? void 0 : sources.forEach((source) => {
702
+ const isLocatorSource = source.hasOwnProperty("locator");
703
+ if (isLocatorSource) {
704
+ const locatorSource = source;
705
+ if ((locatorSource === null || locatorSource === void 0 ? void 0 : locatorSource.name) === "ArcGIS World Geocoding Service") {
706
+ const outFields = locatorSource.outFields || ["Addr_type", "Match_addr", "StAddr", "City"];
707
+ locatorSource.outFields = outFields;
708
+ locatorSource.singleLineFieldName = "SingleLine";
709
+ }
710
+ locatorSource.url = locatorSource.url;
711
+ delete locatorSource.url;
712
+ }
713
+ });
714
+ }
715
+ else {
716
+ searchConfiguration = Object.assign(Object.assign({}, searchConfiguration), { includeDefaultSources: true });
717
+ }
718
+ return searchConfiguration;
719
+ }
720
+ static get watchers() { return {
721
+ "searchConfiguration": ["watchSearchConfigurationHandler"],
722
+ "mapView": ["mapViewWatchHandler"]
723
+ }; }
724
+ };
725
+ MapSearch.style = mapSearchCss;
726
+
644
727
  const mapToolsCss = ":host{display:block}.display-none{display:none}.margin-top-1-2{margin-top:0.5rem}.square-32{width:32px;height:32px}.square-40{width:40px;height:40px}.square-48{width:48px;height:48px}.width-40{width:40px}.square-40-41{width:40px;height:41px}.border-bottom{border-bottom:1px solid var(--calcite-color-border-3)}.box-shadow{box-shadow:0 1px 2px rgba(0, 0, 0, 0.3)}.margin-bottom-1-2{margin-bottom:0.5rem}";
645
728
 
646
729
  const MapTools = class {
@@ -817,7 +900,7 @@ const MapTools = class {
817
900
  * @protected
818
901
  */
819
902
  async _initModules() {
820
- const [Expand] = await loadModules.loadModules([
903
+ const [Expand] = await locale.loadModules([
821
904
  "esri/widgets/Expand"
822
905
  ]);
823
906
  this.Expand = Expand;
@@ -998,7 +1081,10 @@ const MapTools = class {
998
1081
  };
999
1082
  MapTools.style = mapToolsCss;
1000
1083
 
1001
- exports.info_card = InfoCard;
1002
- exports.map_card = MapCard;
1084
+ exports.basemap_gallery = BasemapGallery;
1085
+ exports.floor_filter = FloorFilter;
1086
+ exports.map_fullscreen = MapFullscreen;
1087
+ exports.map_legend = MapLegend;
1003
1088
  exports.map_picker = MapPicker;
1089
+ exports.map_search = MapSearch;
1004
1090
  exports.map_tools = MapTools;