@esri/solutions-components 0.6.6 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/basemap-gallery_4.cjs.entry.js +622 -0
- package/dist/cjs/card-manager_4.cjs.entry.js +91 -37
- package/dist/cjs/crowdsource-manager.cjs.entry.js +4 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/solutions-components.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/basemap-gallery/basemap-gallery.css +19 -0
- package/dist/collection/components/basemap-gallery/basemap-gallery.js +166 -0
- package/dist/collection/components/basemap-gallery/test/basemap-gallery.e2e.js +29 -0
- package/dist/collection/components/basemap-gallery/test/basemap-gallery.spec.js +37 -0
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +43 -2
- package/dist/collection/components/layer-table/layer-table.js +99 -30
- package/dist/collection/components/map-card/map-card.css +0 -7
- package/dist/collection/components/map-card/map-card.js +12 -7
- package/dist/collection/components/map-search/map-search.css +24 -0
- package/dist/collection/components/map-search/map-search.js +321 -0
- package/dist/collection/components/map-search/test/map-search.e2e.js +29 -0
- package/dist/collection/components/map-search/test/map-search.spec.js +37 -0
- package/dist/collection/components/map-tools/map-tools.js +139 -14
- package/dist/collection/demos/crowdsource-manager.html +3 -3
- package/dist/collection/utils/interfaces.ts +2 -0
- package/dist/components/action-bar.js +1 -0
- package/dist/components/action-group.js +1 -0
- package/dist/components/action-menu.js +1 -0
- package/dist/components/action.js +1 -0
- package/dist/components/alert.js +1 -0
- package/dist/components/avatar.js +1 -0
- package/dist/components/basemap-gallery.d.ts +11 -0
- package/dist/components/basemap-gallery.js +11 -0
- package/dist/components/basemap-gallery2.js +118 -0
- package/dist/components/buffer-tools2.js +1 -0
- package/dist/components/button.js +1 -0
- package/dist/components/calcite-accordion-item.js +1 -0
- package/dist/components/calcite-accordion.js +1 -0
- package/dist/components/calcite-action-pad.js +1 -0
- package/dist/components/calcite-block-section.js +1 -0
- package/dist/components/calcite-block.js +1 -0
- package/dist/components/calcite-card.js +1 -0
- package/dist/components/calcite-chip-group.js +1 -0
- package/dist/components/calcite-color-picker.js +1 -0
- package/dist/components/calcite-combobox-item-group.js +1 -0
- package/dist/components/calcite-fab.js +1 -0
- package/dist/components/calcite-flow-item.js +1 -0
- package/dist/components/calcite-flow.js +1 -0
- package/dist/components/calcite-inline-editable.js +1 -0
- package/dist/components/calcite-input-date-picker.js +1 -0
- package/dist/components/calcite-input-time-picker.js +1 -0
- package/dist/components/calcite-input-time-zone.js +1 -0
- package/dist/components/calcite-list-item-group.js +1 -0
- package/dist/components/calcite-menu-item.js +1 -0
- package/dist/components/calcite-modal.js +1 -0
- package/dist/components/calcite-navigation-logo.js +1 -0
- package/dist/components/calcite-navigation-user.js +1 -0
- package/dist/components/calcite-navigation.js +1 -0
- package/dist/components/calcite-option-group.js +1 -0
- package/dist/components/calcite-pagination.js +1 -0
- package/dist/components/calcite-pick-list-group.js +1 -0
- package/dist/components/calcite-pick-list.js +1 -0
- package/dist/components/calcite-radio-button-group.js +1 -0
- package/dist/components/calcite-radio-button.js +1 -0
- package/dist/components/calcite-rating.js +1 -0
- package/dist/components/calcite-shell-center-row.js +1 -0
- package/dist/components/calcite-sortable-list.js +1 -0
- package/dist/components/calcite-split-button.js +1 -0
- package/dist/components/calcite-stepper-item.js +1 -0
- package/dist/components/calcite-stepper.js +1 -0
- package/dist/components/calcite-text-area.js +1 -0
- package/dist/components/calcite-tile-select-group.js +1 -0
- package/dist/components/calcite-tile-select.js +1 -0
- package/dist/components/calcite-tip-group.js +1 -0
- package/dist/components/calcite-tip-manager.js +1 -0
- package/dist/components/calcite-tip.js +1 -0
- package/dist/components/card-manager2.js +1 -0
- package/dist/components/checkbox.js +1 -0
- package/dist/components/chip.js +1 -0
- package/dist/components/color-picker-hex-input.js +1 -0
- package/dist/components/color-picker-swatch.js +1 -0
- package/dist/components/combobox-item.js +1 -0
- package/dist/components/combobox.js +1 -0
- package/dist/components/crowdsource-manager.js +95 -78
- package/dist/components/crowdsource-reporter.js +1 -0
- package/dist/components/date-picker-day.js +1 -0
- package/dist/components/date-picker-month-header.js +1 -0
- package/dist/components/date-picker-month.js +1 -0
- package/dist/components/date-picker.js +1 -0
- package/dist/components/deduct-calculator2.js +1 -0
- package/dist/components/dropdown-group.js +1 -0
- package/dist/components/dropdown-item.js +1 -0
- package/dist/components/dropdown.js +1 -0
- package/dist/components/edit-card2.js +1 -0
- package/dist/components/esri-loader.js +301 -0
- package/dist/components/filter2.js +1 -0
- package/dist/components/graph.js +1 -0
- package/dist/components/handle.js +1 -0
- package/dist/components/icon.js +1 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +1 -1
- package/dist/components/info-card2.js +1 -0
- package/dist/components/input-message.js +1 -0
- package/dist/components/input-number.js +1 -0
- package/dist/components/input-text.js +1 -0
- package/dist/components/input.js +1 -0
- package/dist/components/json-editor2.js +1 -0
- package/dist/components/label2.js +1 -0
- package/dist/components/layer-table2.js +83 -31
- package/dist/components/layout-manager2.js +1 -0
- package/dist/components/link.js +1 -0
- package/dist/components/list-item.js +1 -0
- package/dist/components/list-item2.js +1 -0
- package/dist/components/list.js +1 -0
- package/dist/components/loadModules.js +1 -1
- package/dist/components/loader.js +1 -0
- package/dist/components/locale.js +2 -295
- package/dist/components/map-card2.js +61 -42
- package/dist/components/map-draw-tools2.js +1 -0
- package/dist/components/map-layer-picker2.js +1 -0
- package/dist/components/map-picker2.js +1 -0
- package/dist/components/map-search.d.ts +11 -0
- package/dist/components/map-search.js +11 -0
- package/dist/components/map-search2.js +201 -0
- package/dist/components/map-select-tools2.js +1 -0
- package/dist/components/map-tools2.js +141 -30
- package/dist/components/menu.js +1 -0
- package/dist/components/notice.js +1 -0
- package/dist/components/option.js +1 -0
- package/dist/components/panel.js +1 -0
- package/dist/components/pci-calculator.js +1 -0
- package/dist/components/pdf-download2.js +1 -0
- package/dist/components/pick-list-item.js +1 -0
- package/dist/components/popover.js +1 -0
- package/dist/components/progress.js +1 -0
- package/dist/components/public-notification.js +1 -0
- package/dist/components/refine-selection2.js +1 -0
- package/dist/components/scrim.js +1 -0
- package/dist/components/segmented-control-item.js +1 -0
- package/dist/components/segmented-control.js +1 -0
- package/dist/components/select.js +1 -0
- package/dist/components/shell-panel.js +1 -0
- package/dist/components/shell.js +1 -0
- package/dist/components/slider.js +1 -0
- package/dist/components/solution-configuration.js +1 -0
- package/dist/components/solution-contents2.js +1 -0
- package/dist/components/solution-item-details2.js +1 -0
- package/dist/components/solution-item-icon2.js +1 -0
- package/dist/components/solution-item-sharing2.js +1 -0
- package/dist/components/solution-item2.js +1 -0
- package/dist/components/solution-organization-variables2.js +1 -0
- package/dist/components/solution-resource-item2.js +1 -0
- package/dist/components/solution-spatial-ref2.js +1 -0
- package/dist/components/solution-template-data2.js +1 -0
- package/dist/components/solution-variables2.js +1 -0
- package/dist/components/stack.js +1 -0
- package/dist/components/store-manager.js +1 -0
- package/dist/components/switch.js +1 -0
- package/dist/components/tab-nav.js +1 -0
- package/dist/components/tab-title.js +1 -0
- package/dist/components/tab.js +1 -0
- package/dist/components/tabs.js +1 -0
- package/dist/components/tile.js +1 -0
- package/dist/components/time-picker.js +1 -0
- package/dist/components/tooltip.js +1 -0
- package/dist/components/tree-item.js +1 -0
- package/dist/components/tree.js +1 -0
- package/dist/components/value-list-item.js +1 -0
- package/dist/components/value-list.js +1 -0
- package/dist/esm/basemap-gallery_4.entry.js +615 -0
- package/dist/esm/card-manager_4.entry.js +91 -37
- package/dist/esm/crowdsource-manager.entry.js +4 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/solutions-components.js +2 -2
- package/dist/solutions-components/demos/crowdsource-manager.html +3 -3
- package/dist/solutions-components/p-55aefaa8.entry.js +6 -0
- package/dist/solutions-components/p-5b5a6ac8.entry.js +6 -0
- package/dist/solutions-components/p-a6c85bd7.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/interfaces.ts +2 -0
- package/dist/types/components/basemap-gallery/basemap-gallery.d.ts +64 -0
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +9 -1
- package/dist/types/components/layer-table/layer-table.d.ts +24 -2
- package/dist/types/components/map-card/map-card.d.ts +10 -2
- package/dist/types/components/map-search/map-search.d.ts +107 -0
- package/dist/types/components/map-tools/map-tools.d.ts +68 -5
- package/dist/types/components.d.ts +122 -0
- package/dist/types/preact.d.ts +4 -0
- package/dist/types/stencil-public-runtime.d.ts +2 -0
- package/dist/types/utils/interfaces.d.ts +2 -0
- package/package.json +1 -1
- package/dist/cjs/map-picker_2.cjs.entry.js +0 -264
- package/dist/esm/map-picker_2.entry.js +0 -259
- package/dist/solutions-components/p-1990d9c8.entry.js +0 -6
- package/dist/solutions-components/p-40bde8b2.entry.js +0 -6
- package/dist/solutions-components/p-b921aa1a.entry.js +0 -6
@@ -0,0 +1,622 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
* Licensed under the Apache License, Version 2.0
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
*/
|
6
|
+
'use strict';
|
7
|
+
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
9
|
+
|
10
|
+
const index = require('./index-0e50040c.js');
|
11
|
+
const loadModules = require('./loadModules-31cab7ac.js');
|
12
|
+
const locale = require('./locale-d15cd743.js');
|
13
|
+
const interfaces = require('./interfaces-d539e30c.js');
|
14
|
+
require('./_commonjsHelpers-384729db.js');
|
15
|
+
|
16
|
+
const basemapGalleryCss = ":host{display:block}";
|
17
|
+
|
18
|
+
const BasemapGallery = class {
|
19
|
+
constructor(hostRef) {
|
20
|
+
index.registerInstance(this, hostRef);
|
21
|
+
this.mapView = undefined;
|
22
|
+
this.basemapWidget = undefined;
|
23
|
+
}
|
24
|
+
//--------------------------------------------------------------------------
|
25
|
+
//
|
26
|
+
// Watch handlers
|
27
|
+
//
|
28
|
+
//--------------------------------------------------------------------------
|
29
|
+
async mapViewWatchHandler() {
|
30
|
+
await this.mapView.when(() => {
|
31
|
+
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
|
+
//--------------------------------------------------------------------------
|
49
|
+
/**
|
50
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
51
|
+
*/
|
52
|
+
async componentWillLoad() {
|
53
|
+
return this._initModules();
|
54
|
+
}
|
55
|
+
/**
|
56
|
+
* StencilJS: Renders the component.
|
57
|
+
*/
|
58
|
+
render() {
|
59
|
+
return (index.h(index.Host, null, index.h("div", { ref: (el) => { this._basemapElement = el; } })));
|
60
|
+
}
|
61
|
+
//--------------------------------------------------------------------------
|
62
|
+
//
|
63
|
+
// Functions (protected)
|
64
|
+
//
|
65
|
+
//--------------------------------------------------------------------------
|
66
|
+
/**
|
67
|
+
* Load esri javascript api modules
|
68
|
+
*
|
69
|
+
* @returns Promise resolving when function is done
|
70
|
+
*
|
71
|
+
* @protected
|
72
|
+
*/
|
73
|
+
async _initModules() {
|
74
|
+
const [BasemapGallery] = await loadModules.loadModules([
|
75
|
+
"esri/widgets/BasemapGallery"
|
76
|
+
]);
|
77
|
+
this.BasemapGallery = BasemapGallery;
|
78
|
+
}
|
79
|
+
/**
|
80
|
+
* Initialize the basemap gallery or reset the current view if it already exists
|
81
|
+
*
|
82
|
+
* @returns void
|
83
|
+
*
|
84
|
+
* @protected
|
85
|
+
*/
|
86
|
+
_initBaseMapGallery(view) {
|
87
|
+
if (view && this.BasemapGallery) {
|
88
|
+
if (!this.basemapWidget) {
|
89
|
+
this.basemapWidget = new this.BasemapGallery({
|
90
|
+
container: this._basemapElement,
|
91
|
+
view
|
92
|
+
});
|
93
|
+
}
|
94
|
+
else {
|
95
|
+
this.basemapWidget.view = view;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
get el() { return index.getElement(this); }
|
100
|
+
static get watchers() { return {
|
101
|
+
"mapView": ["mapViewWatchHandler"]
|
102
|
+
}; }
|
103
|
+
};
|
104
|
+
BasemapGallery.style = basemapGalleryCss;
|
105
|
+
|
106
|
+
const mapPickerCss = ":host{display:block}.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-ui-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-scrim-background);z-index:1;width:100%;height:-moz-fit-content;height:fit-content}.display-none{display:none}";
|
107
|
+
|
108
|
+
const MapPicker = class {
|
109
|
+
constructor(hostRef) {
|
110
|
+
index.registerInstance(this, hostRef);
|
111
|
+
this.mapInfoChange = index.createEvent(this, "mapInfoChange", 7);
|
112
|
+
/**
|
113
|
+
* string: the id of map currently displayed
|
114
|
+
*/
|
115
|
+
this._loadedId = "";
|
116
|
+
this.mapInfos = [];
|
117
|
+
this._mapListExpanded = false;
|
118
|
+
this._webMapInfo = undefined;
|
119
|
+
}
|
120
|
+
//--------------------------------------------------------------------------
|
121
|
+
//
|
122
|
+
// Watch handlers
|
123
|
+
//
|
124
|
+
//--------------------------------------------------------------------------
|
125
|
+
/**
|
126
|
+
* Called each time the _webMapInfo prop is changed.
|
127
|
+
*/
|
128
|
+
_webMapInfoWatchHandler(v, oldV) {
|
129
|
+
if (v && JSON.stringify(v) !== JSON.stringify(oldV)) {
|
130
|
+
this._loadedId = v === null || v === void 0 ? void 0 : v.id;
|
131
|
+
this.mapInfoChange.emit(v);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
/**
|
135
|
+
* Called each time the mapInfos prop is changed.
|
136
|
+
*/
|
137
|
+
mapInfosWatchHandler(v, oldV) {
|
138
|
+
if (v && JSON.stringify(v) !== JSON.stringify(oldV)) {
|
139
|
+
this.mapInfoChange.emit(v[0]);
|
140
|
+
}
|
141
|
+
}
|
142
|
+
//--------------------------------------------------------------------------
|
143
|
+
//
|
144
|
+
// Functions (lifecycle)
|
145
|
+
//
|
146
|
+
//--------------------------------------------------------------------------
|
147
|
+
/**
|
148
|
+
* Renders the component.
|
149
|
+
*/
|
150
|
+
render() {
|
151
|
+
return (index.h(index.Host, null, this._getToolbar(), this._getMapNameList(this._mapListExpanded)));
|
152
|
+
}
|
153
|
+
/**
|
154
|
+
* Called after each render
|
155
|
+
*/
|
156
|
+
async componentDidRender() {
|
157
|
+
if (this._mapListExpanded) {
|
158
|
+
await this._list.setFocus();
|
159
|
+
}
|
160
|
+
}
|
161
|
+
/**
|
162
|
+
* Called once after the component has loaded
|
163
|
+
*/
|
164
|
+
componentDidLoad() {
|
165
|
+
const webMapInfo = this.mapInfos && this.mapInfos.length > 0 ? this.mapInfos[0] : undefined;
|
166
|
+
if (webMapInfo) {
|
167
|
+
this._webMapSelected(webMapInfo);
|
168
|
+
}
|
169
|
+
}
|
170
|
+
//--------------------------------------------------------------------------
|
171
|
+
//
|
172
|
+
// Functions (protected)
|
173
|
+
//
|
174
|
+
//--------------------------------------------------------------------------
|
175
|
+
/**
|
176
|
+
* Get a calcite action group for the map list
|
177
|
+
* Actions do not support multiple icons so this uses a block
|
178
|
+
*
|
179
|
+
* @returns the dom node for the action group
|
180
|
+
*
|
181
|
+
* @protected
|
182
|
+
*/
|
183
|
+
_getMapPicker() {
|
184
|
+
var _a;
|
185
|
+
const mapListIcon = this._mapListExpanded ? "chevron-up" : "chevron-down";
|
186
|
+
return (index.h("calcite-button", { alignment: "icon-end-space-between", appearance: "solid", class: "width-full height-full", iconEnd: mapListIcon, kind: "neutral", onClick: () => this._chooseMap(), width: "full" }, (_a = this._webMapInfo) === null || _a === void 0 ? void 0 : _a.name));
|
187
|
+
}
|
188
|
+
/**
|
189
|
+
* Create the toolbar (controls used for map and app interactions)
|
190
|
+
*
|
191
|
+
* @returns The dom node with the toolbar
|
192
|
+
*
|
193
|
+
* @protected
|
194
|
+
*/
|
195
|
+
_getToolbar() {
|
196
|
+
return (index.h("div", { class: "display-flex" }, index.h("calcite-action-bar", { class: "border-bottom-1 action-bar-size", "expand-disabled": true, layout: "horizontal", slot: "header" }, this._getMapPicker())));
|
197
|
+
}
|
198
|
+
/**
|
199
|
+
* Get a pick list for all maps in mapInfos
|
200
|
+
*
|
201
|
+
* @param show boolean to indicate if the list should be shown or hidden
|
202
|
+
*
|
203
|
+
* @returns the dom node for the list of maps
|
204
|
+
*
|
205
|
+
* @protected
|
206
|
+
*/
|
207
|
+
_getMapNameList(show) {
|
208
|
+
const listClass = show ? "map-list" : "display-none";
|
209
|
+
return (index.h("div", { class: listClass }, index.h("calcite-list", { id: "mapList", ref: (el) => this._list = el, selectionAppearance: "border" }, this.mapInfos.map(mapInfo => {
|
210
|
+
return (index.h("calcite-list-item", { label: mapInfo.name, onClick: () => this._webMapSelected(mapInfo), selected: mapInfo.id === this._loadedId, value: mapInfo.id }));
|
211
|
+
}))));
|
212
|
+
}
|
213
|
+
/**
|
214
|
+
* Fired when the user clicks on the map list
|
215
|
+
*
|
216
|
+
* @param webMapInfo the web map id and name selected from the list
|
217
|
+
*
|
218
|
+
* @returns void
|
219
|
+
*
|
220
|
+
* @protected
|
221
|
+
*/
|
222
|
+
_webMapSelected(webMapInfo) {
|
223
|
+
this._mapListExpanded = false;
|
224
|
+
this._webMapInfo = webMapInfo;
|
225
|
+
}
|
226
|
+
/**
|
227
|
+
* Toggles the open/close state of the map list
|
228
|
+
*
|
229
|
+
* @returns the dom node for the action group
|
230
|
+
*
|
231
|
+
* @protected
|
232
|
+
*/
|
233
|
+
_chooseMap() {
|
234
|
+
this._mapListExpanded = !this._mapListExpanded;
|
235
|
+
}
|
236
|
+
get el() { return index.getElement(this); }
|
237
|
+
static get watchers() { return {
|
238
|
+
"_webMapInfo": ["_webMapInfoWatchHandler"],
|
239
|
+
"mapInfos": ["mapInfosWatchHandler"]
|
240
|
+
}; }
|
241
|
+
};
|
242
|
+
MapPicker.style = mapPickerCss;
|
243
|
+
|
244
|
+
const mapSearchCss = ":host{display:block}.search-widget{width:100% !important;border:1px solid var(--calcite-ui-border-input)}";
|
245
|
+
|
246
|
+
const MapSearch = class {
|
247
|
+
constructor(hostRef) {
|
248
|
+
index.registerInstance(this, hostRef);
|
249
|
+
this.mapView = undefined;
|
250
|
+
this.popupEnabled = false;
|
251
|
+
this.resultGraphicEnabled = false;
|
252
|
+
this.searchConfiguration = undefined;
|
253
|
+
this.searchTerm = undefined;
|
254
|
+
this.searchWidget = undefined;
|
255
|
+
}
|
256
|
+
//--------------------------------------------------------------------------
|
257
|
+
//
|
258
|
+
// Watch handlers
|
259
|
+
//
|
260
|
+
//--------------------------------------------------------------------------
|
261
|
+
/**
|
262
|
+
* Called each time the searchConfiguration prop is changed.
|
263
|
+
*
|
264
|
+
* @returns Promise when complete
|
265
|
+
*/
|
266
|
+
async watchSearchConfigurationHandler() {
|
267
|
+
this._initSearchWidget();
|
268
|
+
}
|
269
|
+
/**
|
270
|
+
* Called each time the mapView prop is changed.
|
271
|
+
*
|
272
|
+
* @returns Promise when complete
|
273
|
+
*/
|
274
|
+
async mapViewWatchHandler() {
|
275
|
+
await this.mapView.when(() => {
|
276
|
+
this._initSearchWidget();
|
277
|
+
});
|
278
|
+
}
|
279
|
+
//--------------------------------------------------------------------------
|
280
|
+
//
|
281
|
+
// Methods (public)
|
282
|
+
//
|
283
|
+
//--------------------------------------------------------------------------
|
284
|
+
//--------------------------------------------------------------------------
|
285
|
+
//
|
286
|
+
// Events (public)
|
287
|
+
//
|
288
|
+
//--------------------------------------------------------------------------
|
289
|
+
//--------------------------------------------------------------------------
|
290
|
+
//
|
291
|
+
// Functions (lifecycle)
|
292
|
+
//
|
293
|
+
//--------------------------------------------------------------------------
|
294
|
+
/**
|
295
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
296
|
+
*/
|
297
|
+
async componentWillLoad() {
|
298
|
+
await this._initModules();
|
299
|
+
}
|
300
|
+
/**
|
301
|
+
* StencilJS: Called once just after the component is fully loaded and the first render() occurs.
|
302
|
+
*/
|
303
|
+
async componentDidLoad() {
|
304
|
+
return this._initSearchWidget();
|
305
|
+
}
|
306
|
+
/**
|
307
|
+
* Renders the component.
|
308
|
+
*/
|
309
|
+
render() {
|
310
|
+
return (index.h(index.Host, null, index.h("div", { class: "search-widget", ref: (el) => { this._searchElement = el; } })));
|
311
|
+
}
|
312
|
+
//--------------------------------------------------------------------------
|
313
|
+
//
|
314
|
+
// Functions (protected)
|
315
|
+
//
|
316
|
+
//--------------------------------------------------------------------------
|
317
|
+
/**
|
318
|
+
* Load esri javascript api modules
|
319
|
+
*
|
320
|
+
* @returns Promise resolving when function is done
|
321
|
+
*
|
322
|
+
* @protected
|
323
|
+
*/
|
324
|
+
async _initModules() {
|
325
|
+
const [Search, FeatureLayer] = await loadModules.loadModules([
|
326
|
+
"esri/widgets/Search",
|
327
|
+
"esri/layers/FeatureLayer"
|
328
|
+
]);
|
329
|
+
this.Search = Search;
|
330
|
+
this.FeatureLayer = FeatureLayer;
|
331
|
+
}
|
332
|
+
/**
|
333
|
+
* Initialize the search widget
|
334
|
+
*
|
335
|
+
* @protected
|
336
|
+
*/
|
337
|
+
_initSearchWidget() {
|
338
|
+
if (this.mapView && this._searchElement && !this.searchWidget) {
|
339
|
+
let searchOptions = {
|
340
|
+
view: this.mapView,
|
341
|
+
container: this._searchElement,
|
342
|
+
searchTerm: this.searchTerm
|
343
|
+
};
|
344
|
+
if (this.searchConfiguration) {
|
345
|
+
const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
|
346
|
+
searchOptions = Object.assign({}, searchConfiguration);
|
347
|
+
}
|
348
|
+
this.searchWidget = new this.Search(searchOptions);
|
349
|
+
this.searchWidget.popupEnabled = this.popupEnabled;
|
350
|
+
this.searchWidget.resultGraphicEnabled = this.resultGraphicEnabled;
|
351
|
+
}
|
352
|
+
else {
|
353
|
+
if (this.searchWidget) {
|
354
|
+
this.searchWidget.view = this.mapView;
|
355
|
+
}
|
356
|
+
}
|
357
|
+
}
|
358
|
+
/**
|
359
|
+
* Initialize the search widget based on user defined configuration
|
360
|
+
*
|
361
|
+
* @param searchConfiguration search configuration defined by the user
|
362
|
+
* @param view the current map view
|
363
|
+
*
|
364
|
+
* @protected
|
365
|
+
*/
|
366
|
+
_getSearchConfig(searchConfiguration, view) {
|
367
|
+
const INCLUDE_DEFAULT_SOURCES = "includeDefaultSources";
|
368
|
+
const sources = searchConfiguration.sources;
|
369
|
+
if ((sources === null || sources === void 0 ? void 0 : sources.length) > 0) {
|
370
|
+
searchConfiguration[INCLUDE_DEFAULT_SOURCES] = false;
|
371
|
+
sources.forEach((source) => {
|
372
|
+
var _a, _b;
|
373
|
+
const isLayerSource = source.hasOwnProperty("layer");
|
374
|
+
if (isLayerSource) {
|
375
|
+
const layerSource = source;
|
376
|
+
const layerId = (_a = layerSource.layer) === null || _a === void 0 ? void 0 : _a.id;
|
377
|
+
const layerFromMap = layerId ? view.map.findLayerById(layerId) : null;
|
378
|
+
const layerUrl = (_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url;
|
379
|
+
if (layerFromMap) {
|
380
|
+
layerSource.layer = layerFromMap;
|
381
|
+
}
|
382
|
+
else if (layerUrl) {
|
383
|
+
layerSource.layer = new this.FeatureLayer(layerUrl);
|
384
|
+
}
|
385
|
+
}
|
386
|
+
});
|
387
|
+
sources === null || sources === void 0 ? void 0 : sources.forEach((source) => {
|
388
|
+
const isLocatorSource = source.hasOwnProperty("locator");
|
389
|
+
if (isLocatorSource) {
|
390
|
+
const locatorSource = source;
|
391
|
+
if ((locatorSource === null || locatorSource === void 0 ? void 0 : locatorSource.name) === "ArcGIS World Geocoding Service") {
|
392
|
+
const outFields = locatorSource.outFields || ["Addr_type", "Match_addr", "StAddr", "City"];
|
393
|
+
locatorSource.outFields = outFields;
|
394
|
+
locatorSource.singleLineFieldName = "SingleLine";
|
395
|
+
}
|
396
|
+
locatorSource.url = locatorSource.url;
|
397
|
+
delete locatorSource.url;
|
398
|
+
}
|
399
|
+
});
|
400
|
+
}
|
401
|
+
else {
|
402
|
+
searchConfiguration = Object.assign(Object.assign({}, searchConfiguration), { includeDefaultSources: true });
|
403
|
+
}
|
404
|
+
return searchConfiguration;
|
405
|
+
}
|
406
|
+
static get watchers() { return {
|
407
|
+
"searchConfiguration": ["watchSearchConfigurationHandler"],
|
408
|
+
"mapView": ["mapViewWatchHandler"]
|
409
|
+
}; }
|
410
|
+
};
|
411
|
+
MapSearch.style = mapSearchCss;
|
412
|
+
|
413
|
+
const mapToolsCss = ":host{display:block}.display-none{display:none}.border{border:1px solid var(--calcite-ui-border-3)}.margin-top-1-2{margin-top:0.5rem}";
|
414
|
+
|
415
|
+
const MapTools = class {
|
416
|
+
constructor(hostRef) {
|
417
|
+
index.registerInstance(this, hostRef);
|
418
|
+
this.expandMap = index.createEvent(this, "expandMap", 7);
|
419
|
+
this.layout = "vertical";
|
420
|
+
this.mapView = undefined;
|
421
|
+
this.searchConfiguration = undefined;
|
422
|
+
this._translations = undefined;
|
423
|
+
this._showTools = true;
|
424
|
+
this._showBasemapWidget = false;
|
425
|
+
this._showSearchWidget = false;
|
426
|
+
}
|
427
|
+
//--------------------------------------------------------------------------
|
428
|
+
//
|
429
|
+
// Watch handlers
|
430
|
+
//
|
431
|
+
//--------------------------------------------------------------------------
|
432
|
+
/**
|
433
|
+
* Store the home extent when the map view changes
|
434
|
+
*/
|
435
|
+
async mapViewWatchHandler() {
|
436
|
+
await this.mapView.when(() => {
|
437
|
+
this._homeExtent = this.mapView.extent;
|
438
|
+
});
|
439
|
+
}
|
440
|
+
/**
|
441
|
+
* When the _showBasemapWidget property is true display the basemap gallery
|
442
|
+
*/
|
443
|
+
async _showBasemapWidgetWatchHandler(v) {
|
444
|
+
if (v) {
|
445
|
+
this.mapView.ui.add(this._basemapElement.basemapWidget, {
|
446
|
+
position: "top-right",
|
447
|
+
index: 1
|
448
|
+
});
|
449
|
+
}
|
450
|
+
else {
|
451
|
+
this.mapView.ui.remove(this._basemapElement.basemapWidget);
|
452
|
+
}
|
453
|
+
}
|
454
|
+
/**
|
455
|
+
* When the _showSearchWidget property is true display the search widget
|
456
|
+
*/
|
457
|
+
async _showSearchWidgetWatchHandler(v) {
|
458
|
+
console.log("_showSearchWidget changed");
|
459
|
+
if (v) {
|
460
|
+
this.mapView.ui.add(this._searchElement.searchWidget, {
|
461
|
+
position: "top-right",
|
462
|
+
index: 1
|
463
|
+
});
|
464
|
+
}
|
465
|
+
else {
|
466
|
+
this.mapView.ui.remove(this._searchElement.searchWidget);
|
467
|
+
}
|
468
|
+
}
|
469
|
+
//--------------------------------------------------------------------------
|
470
|
+
//
|
471
|
+
// Functions (lifecycle)
|
472
|
+
//
|
473
|
+
//--------------------------------------------------------------------------
|
474
|
+
/**
|
475
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
476
|
+
*/
|
477
|
+
async componentWillLoad() {
|
478
|
+
await this._getTranslations();
|
479
|
+
}
|
480
|
+
/**
|
481
|
+
* StencilJS: Renders the component.
|
482
|
+
*/
|
483
|
+
render() {
|
484
|
+
const toggleIcon = this._showTools ? "chevrons-up" : "chevrons-down";
|
485
|
+
const toolsClass = this._showTools ? "" : "display-none";
|
486
|
+
const searchClass = this._showSearchWidget ? "" : "display-none";
|
487
|
+
const basemapClass = this._showBasemapWidget ? "" : "display-none";
|
488
|
+
return (index.h(index.Host, null, index.h("div", null, index.h("calcite-action", { alignment: "center", class: "border", compact: false, icon: toggleIcon, onClick: () => { this._toggleTools(); }, text: "" }), index.h("calcite-action-bar", { class: `border margin-top-1-2 ${toolsClass}`, "expand-disabled": true, layout: this.layout }, this._getActionGroup("home", false, this._translations.home, () => void this._goHome()), this._getActionGroup("plus", false, this._translations.zoomIn, () => void this._zoomIn()), this._getActionGroup("minus", false, this._translations.zoomOut, () => void this._zoomOut()), this._getActionGroup("list", false, this._translations.list, () => this._showList()), this._getActionGroup("magnifying-glass", false, this._translations.search, () => this._search()), this._getActionGroup("expand", false, this._translations.expand, () => this._expand()), this._getActionGroup("basemap", false, this._translations.basemap, () => this._toggleBasemapPicker()))), index.h("basemap-gallery", { class: basemapClass, mapView: this.mapView, ref: (el) => { this._basemapElement = el; } }), index.h("map-search", { class: searchClass, mapView: this.mapView, ref: (el) => { this._searchElement = el; }, searchConfiguration: this.searchConfiguration })));
|
489
|
+
}
|
490
|
+
//--------------------------------------------------------------------------
|
491
|
+
//
|
492
|
+
// Functions (protected)
|
493
|
+
//
|
494
|
+
//--------------------------------------------------------------------------
|
495
|
+
/**
|
496
|
+
* Get a calcite action group for the current action
|
497
|
+
*
|
498
|
+
* @param icon the icon to display for the current action
|
499
|
+
* @param disabled should the action be disabled
|
500
|
+
* @param tip information tip to display helpful details to end user
|
501
|
+
* @param func the associated onClick function to execute
|
502
|
+
*
|
503
|
+
* @returns the dom node for the action group
|
504
|
+
*
|
505
|
+
* @protected
|
506
|
+
*/
|
507
|
+
_getActionGroup(icon, disabled, tip, func) {
|
508
|
+
return (index.h("calcite-action-group", null, index.h("calcite-action", { alignment: "center", compact: false, disabled: disabled, icon: icon, id: icon, onClick: func, text: "" }, index.h("calcite-icon", { icon: "cheveron-up", scale: "s", slot: "icon" })), index.h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": icon }, index.h("span", null, tip))));
|
509
|
+
}
|
510
|
+
/**
|
511
|
+
* Go to the exent that was first used when loading the map
|
512
|
+
*
|
513
|
+
* @returns void
|
514
|
+
*
|
515
|
+
* @protected
|
516
|
+
*/
|
517
|
+
async _goHome() {
|
518
|
+
await this.mapView.goTo(this._homeExtent);
|
519
|
+
}
|
520
|
+
// need to discuss this with the team
|
521
|
+
_showList() {
|
522
|
+
alert("show list");
|
523
|
+
}
|
524
|
+
// Need to discuss this with the team
|
525
|
+
_search() {
|
526
|
+
this._showSearchWidget = !this._showSearchWidget;
|
527
|
+
this._showTools = false;
|
528
|
+
}
|
529
|
+
/**
|
530
|
+
* Fixed zoom in
|
531
|
+
*
|
532
|
+
* @returns void
|
533
|
+
*
|
534
|
+
* @protected
|
535
|
+
*/
|
536
|
+
async _zoomIn() {
|
537
|
+
await this._zoom(this.mapView.zoom + 1);
|
538
|
+
}
|
539
|
+
/**
|
540
|
+
* Fixed zoom out
|
541
|
+
*
|
542
|
+
* @returns void
|
543
|
+
*
|
544
|
+
* @protected
|
545
|
+
*/
|
546
|
+
async _zoomOut() {
|
547
|
+
await this._zoom(this.mapView.zoom - 1);
|
548
|
+
}
|
549
|
+
/**
|
550
|
+
* Zoom in/out at the maps current center point
|
551
|
+
*
|
552
|
+
* @param zoom Number to zoom level to go to
|
553
|
+
*
|
554
|
+
* @returns void
|
555
|
+
*
|
556
|
+
* @protected
|
557
|
+
*/
|
558
|
+
async _zoom(zoom) {
|
559
|
+
var _a;
|
560
|
+
await ((_a = this.mapView) === null || _a === void 0 ? void 0 : _a.goTo({
|
561
|
+
target: this.mapView.center,
|
562
|
+
zoom
|
563
|
+
}));
|
564
|
+
}
|
565
|
+
/**
|
566
|
+
* Show/Hide the basemap picker
|
567
|
+
*
|
568
|
+
* @returns void
|
569
|
+
*
|
570
|
+
* @protected
|
571
|
+
*/
|
572
|
+
_toggleBasemapPicker() {
|
573
|
+
this._showBasemapWidget = !this._showBasemapWidget;
|
574
|
+
this._showTools = false;
|
575
|
+
}
|
576
|
+
/**
|
577
|
+
* Emit the expand map event
|
578
|
+
*
|
579
|
+
* @returns void
|
580
|
+
*
|
581
|
+
* @protected
|
582
|
+
*/
|
583
|
+
_expand() {
|
584
|
+
this.expandMap.emit(interfaces.EExpandType.EXPAND);
|
585
|
+
}
|
586
|
+
/**
|
587
|
+
* Show/Hide the map tools
|
588
|
+
*
|
589
|
+
* @returns void
|
590
|
+
*
|
591
|
+
* @protected
|
592
|
+
*/
|
593
|
+
_toggleTools() {
|
594
|
+
if (!this._showTools) {
|
595
|
+
this._showBasemapWidget = false;
|
596
|
+
this._showSearchWidget = false;
|
597
|
+
}
|
598
|
+
this._showTools = !this._showTools;
|
599
|
+
}
|
600
|
+
/**
|
601
|
+
* Fetches the component's translations
|
602
|
+
*
|
603
|
+
* @returns Promise when complete
|
604
|
+
* @protected
|
605
|
+
*/
|
606
|
+
async _getTranslations() {
|
607
|
+
const messages = await locale.getLocaleComponentStrings(this.el);
|
608
|
+
this._translations = messages[0];
|
609
|
+
}
|
610
|
+
get el() { return index.getElement(this); }
|
611
|
+
static get watchers() { return {
|
612
|
+
"mapView": ["mapViewWatchHandler"],
|
613
|
+
"_showBasemapWidget": ["_showBasemapWidgetWatchHandler"],
|
614
|
+
"_showSearchWidget": ["_showSearchWidgetWatchHandler"]
|
615
|
+
}; }
|
616
|
+
};
|
617
|
+
MapTools.style = mapToolsCss;
|
618
|
+
|
619
|
+
exports.basemap_gallery = BasemapGallery;
|
620
|
+
exports.map_picker = MapPicker;
|
621
|
+
exports.map_search = MapSearch;
|
622
|
+
exports.map_tools = MapTools;
|