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