@esri/solutions-components 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/t9n/public-notification/resources.json +4 -1
- package/dist/assets/t9n/public-notification/resources_en.json +4 -1
- package/dist/cjs/buffer-tools_6.cjs.entry.js +8 -7
- package/dist/cjs/calcite-combobox_3.cjs.entry.js +38 -25
- package/dist/cjs/calcite-input-message_5.cjs.entry.js +272 -21
- package/dist/cjs/{csvUtils-18a03353.js → csvUtils-83af7ae1.js} +5 -5
- package/dist/cjs/layer-table.cjs.entry.js +3 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-search.cjs.entry.js +46 -7
- package/dist/cjs/{mapViewUtils-8ea9adc5.js → mapViewUtils-55ac76cb.js} +40 -25
- package/dist/cjs/public-notification.cjs.entry.js +101 -18
- package/dist/cjs/{publicNotificationStore-aca88430.js → publicNotificationStore-28a8759d.js} +3 -1
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +0 -5
- package/dist/collection/components/buffer-tools/buffer-tools.js +7 -6
- package/dist/collection/components/layer-table/layer-table.js +1 -1
- package/dist/collection/components/map-layer-picker/map-layer-picker.js +47 -29
- package/dist/collection/components/map-search/map-search.js +66 -7
- package/dist/collection/components/map-select-tools/map-select-tools.js +125 -8
- package/dist/collection/components/pdf-download/pdf-download.js +32 -8
- package/dist/collection/components/public-notification/public-notification.css +46 -41
- package/dist/collection/components/public-notification/public-notification.js +267 -19
- package/dist/collection/components/refine-selection/refine-selection.js +18 -1
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +22 -5
- package/dist/{solutions-components/demos/config-pdf-download.html → collection/demos/buffer-tools.html} +13 -21
- package/dist/collection/demos/index.html +0 -24
- package/dist/collection/demos/map-draw-tools.html +17 -17
- package/dist/collection/demos/map-layer-picker.html +2 -0
- package/dist/collection/demos/map-search.html +16 -15
- package/dist/collection/demos/map-select-tools.html +16 -24
- package/dist/collection/demos/new-public-notification.html +46 -35
- package/dist/collection/demos/pdf-download.html +8 -1
- package/dist/collection/utils/csvUtils.js +4 -4
- package/dist/collection/utils/csvUtils.ts +6 -4
- package/dist/collection/utils/interfaces.ts +65 -1
- package/dist/collection/utils/mapViewUtils.js +36 -22
- package/dist/collection/utils/mapViewUtils.ts +50 -27
- package/dist/collection/utils/publicNotificationStore.js +3 -1
- package/dist/collection/utils/publicNotificationStore.ts +3 -1
- package/dist/collection/utils/queryUtils.js +2 -2
- package/dist/collection/utils/queryUtils.ts +2 -2
- package/dist/components/buffer-tools2.js +1 -1
- package/dist/components/csvUtils.js +4 -4
- package/dist/components/index.d.ts +0 -5
- package/dist/components/index.js +0 -5
- package/dist/components/layer-table.js +2 -3
- package/dist/components/map-layer-picker2.js +177 -28
- package/dist/components/map-search.js +47 -7
- package/dist/components/map-select-tools2.js +56 -11
- package/dist/components/pdf-download2.js +217 -8
- package/dist/components/public-notification.js +154 -55
- package/dist/components/publicNotificationStore.js +3 -1
- package/dist/components/queryUtils.js +3 -3
- package/dist/components/refine-selection-tools2.js +9 -8
- package/dist/components/refine-selection2.js +3 -1
- package/dist/esm/buffer-tools_6.entry.js +8 -7
- package/dist/esm/calcite-combobox_3.entry.js +38 -25
- package/dist/esm/calcite-input-message_5.entry.js +271 -20
- package/dist/esm/{csvUtils-edc0c2a8.js → csvUtils-eb231cfb.js} +5 -5
- package/dist/esm/layer-table.entry.js +3 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-search.entry.js +46 -7
- package/dist/esm/{mapViewUtils-31d2c2bb.js → mapViewUtils-e5d8a1e1.js} +39 -25
- package/dist/esm/public-notification.entry.js +101 -18
- package/dist/esm/{publicNotificationStore-3e762eea.js → publicNotificationStore-8e9cb73b.js} +3 -1
- package/dist/esm/solutions-components.js +1 -1
- package/dist/{collection/demos/config-pdf-download.html → solutions-components/demos/buffer-tools.html} +13 -21
- package/dist/solutions-components/demos/index.html +0 -24
- package/dist/solutions-components/demos/map-draw-tools.html +17 -17
- package/dist/solutions-components/demos/map-layer-picker.html +2 -0
- package/dist/solutions-components/demos/map-search.html +16 -15
- package/dist/solutions-components/demos/map-select-tools.html +16 -24
- package/dist/solutions-components/demos/new-public-notification.html +46 -35
- package/dist/solutions-components/demos/pdf-download.html +8 -1
- package/dist/solutions-components/p-07593958.entry.js +6 -0
- package/dist/solutions-components/p-3fa9b3c8.js +36 -0
- package/dist/solutions-components/p-9b5a9117.entry.js +12 -0
- package/dist/solutions-components/{p-15cd8a97.js → p-9c1ebc90.js} +1 -1
- package/dist/solutions-components/{p-c76f8ff7.entry.js → p-a516c658.entry.js} +1 -1
- package/dist/solutions-components/{p-ad42039f.js → p-b668daf8.js} +2 -2
- package/dist/solutions-components/p-bfa95147.entry.js +17 -0
- package/dist/solutions-components/p-d09a168c.entry.js +6 -0
- package/dist/solutions-components/{p-fa6046a8.entry.js → p-fc9609e6.entry.js} +2 -2
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/csvUtils.ts +6 -4
- package/dist/solutions-components/utils/interfaces.ts +65 -1
- package/dist/solutions-components/utils/mapViewUtils.ts +50 -27
- package/dist/solutions-components/utils/publicNotificationStore.ts +3 -1
- package/dist/solutions-components/utils/queryUtils.ts +2 -2
- package/dist/types/components/buffer-tools/buffer-tools.d.ts +4 -3
- package/dist/types/components/map-layer-picker/map-layer-picker.d.ts +22 -11
- package/dist/types/components/map-search/map-search.d.ts +18 -1
- package/dist/types/components/map-select-tools/map-select-tools.d.ts +31 -1
- package/dist/types/components/pdf-download/pdf-download.d.ts +7 -2
- package/dist/types/components/public-notification/public-notification.d.ts +98 -4
- package/dist/types/components/refine-selection/refine-selection.d.ts +5 -0
- package/dist/types/components/refine-selection-tools/refine-selection-tools.d.ts +6 -1
- package/dist/types/components.d.ts +154 -180
- package/dist/types/preact.d.ts +0 -10
- package/dist/types/utils/csvUtils.d.ts +1 -1
- package/dist/types/utils/interfaces.d.ts +56 -1
- package/dist/types/utils/mapViewUtils.d.ts +19 -9
- package/dist/types/utils/publicNotificationStore.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/check-list.cjs.entry.js +0 -103
- package/dist/cjs/config-buffer-tools.cjs.entry.js +0 -125
- package/dist/cjs/config-draw-tools.cjs.entry.js +0 -85
- package/dist/cjs/config-layer-picker.cjs.entry.js +0 -113
- package/dist/cjs/config-pdf-download.cjs.entry.js +0 -117
- package/dist/cjs/labelFormats-3236d2e0.js +0 -212
- package/dist/collection/components/check-list/check-list.css +0 -3
- package/dist/collection/components/check-list/check-list.js +0 -179
- package/dist/collection/components/config-buffer-tools/config-buffer-tools.css +0 -34
- package/dist/collection/components/config-buffer-tools/config-buffer-tools.js +0 -209
- package/dist/collection/components/config-draw-tools/config-draw-tools.css +0 -17
- package/dist/collection/components/config-draw-tools/config-draw-tools.js +0 -150
- package/dist/collection/components/config-layer-picker/config-layer-picker.css +0 -17
- package/dist/collection/components/config-layer-picker/config-layer-picker.js +0 -218
- package/dist/collection/components/config-pdf-download/config-pdf-download.css +0 -17
- package/dist/collection/components/config-pdf-download/config-pdf-download.js +0 -183
- package/dist/collection/demos/check-list.html +0 -65
- package/dist/collection/demos/config-buffer-tools.html +0 -92
- package/dist/collection/demos/config-draw-tools.html +0 -58
- package/dist/collection/demos/config-layer-picker.html +0 -97
- package/dist/components/check-list.d.ts +0 -11
- package/dist/components/check-list.js +0 -11
- package/dist/components/check-list2.js +0 -131
- package/dist/components/config-buffer-tools.d.ts +0 -11
- package/dist/components/config-buffer-tools.js +0 -187
- package/dist/components/config-draw-tools.d.ts +0 -11
- package/dist/components/config-draw-tools.js +0 -121
- package/dist/components/config-layer-picker.d.ts +0 -11
- package/dist/components/config-layer-picker.js +0 -163
- package/dist/components/config-pdf-download.d.ts +0 -11
- package/dist/components/config-pdf-download.js +0 -154
- package/dist/components/labelFormats.js +0 -210
- package/dist/components/mapViewUtils.js +0 -129
- package/dist/esm/check-list.entry.js +0 -99
- package/dist/esm/config-buffer-tools.entry.js +0 -121
- package/dist/esm/config-draw-tools.entry.js +0 -81
- package/dist/esm/config-layer-picker.entry.js +0 -109
- package/dist/esm/config-pdf-download.entry.js +0 -113
- package/dist/esm/labelFormats-b37958c3.js +0 -210
- package/dist/solutions-components/demos/check-list.html +0 -65
- package/dist/solutions-components/demos/config-buffer-tools.html +0 -92
- package/dist/solutions-components/demos/config-draw-tools.html +0 -58
- package/dist/solutions-components/demos/config-layer-picker.html +0 -97
- package/dist/solutions-components/p-16a0e65a.entry.js +0 -6
- package/dist/solutions-components/p-35078393.entry.js +0 -17
- package/dist/solutions-components/p-3d72bba6.entry.js +0 -6
- package/dist/solutions-components/p-3e444242.entry.js +0 -6
- package/dist/solutions-components/p-67afea92.entry.js +0 -12
- package/dist/solutions-components/p-7dcab29d.js +0 -36
- package/dist/solutions-components/p-89f7b02a.entry.js +0 -6
- package/dist/solutions-components/p-906b7b96.entry.js +0 -6
- package/dist/solutions-components/p-99c98510.entry.js +0 -6
- package/dist/solutions-components/p-b1a3605f.entry.js +0 -6
- package/dist/solutions-components/p-e99b1247.js +0 -6
- package/dist/types/components/check-list/check-list.d.ts +0 -57
- package/dist/types/components/config-buffer-tools/config-buffer-tools.d.ts +0 -92
- package/dist/types/components/config-draw-tools/config-draw-tools.d.ts +0 -58
- package/dist/types/components/config-layer-picker/config-layer-picker.d.ts +0 -83
- package/dist/types/components/config-pdf-download/config-pdf-download.d.ts +0 -81
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
7
|
-
import {
|
|
7
|
+
import { a as queryExtent } from './queryUtils.js';
|
|
8
8
|
import { s as state } from './publicNotificationStore.js';
|
|
9
9
|
import { d as defineCustomElement$6 } from './chip.js';
|
|
10
10
|
import { d as defineCustomElement$5 } from './combobox.js';
|
|
@@ -13,6 +13,141 @@ import { d as defineCustomElement$3 } from './icon.js';
|
|
|
13
13
|
import { d as defineCustomElement$2 } from './option.js';
|
|
14
14
|
import { d as defineCustomElement$1 } from './select.js';
|
|
15
15
|
|
|
16
|
+
/** @license
|
|
17
|
+
* Copyright 2022 Esri
|
|
18
|
+
*
|
|
19
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
20
|
+
* you may not use this file except in compliance with the License.
|
|
21
|
+
* You may obtain a copy of the License at
|
|
22
|
+
*
|
|
23
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
24
|
+
*
|
|
25
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
26
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28
|
+
* See the License for the specific language governing permissions and
|
|
29
|
+
* limitations under the License.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Gets the layer names from the current map
|
|
33
|
+
*
|
|
34
|
+
* @param mapView the map view to fetch the layer names from
|
|
35
|
+
*
|
|
36
|
+
* @returns Promise resolving with an array of layer names
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
async function getMapLayerHash(mapView) {
|
|
40
|
+
let layerHash = {};
|
|
41
|
+
await mapView.when(() => {
|
|
42
|
+
layerHash = mapView.map.layers.toArray().reduce((prev, cur) => {
|
|
43
|
+
prev[cur.id] = cur.title;
|
|
44
|
+
return prev;
|
|
45
|
+
}, {});
|
|
46
|
+
});
|
|
47
|
+
return layerHash;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Gets the layer names from the current map
|
|
51
|
+
*
|
|
52
|
+
* @param mapView the map view to fetch the layer names from
|
|
53
|
+
*
|
|
54
|
+
* @returns Promise resolving with an array of layer names
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
async function getMapLayerIds(mapView) {
|
|
58
|
+
let layerIds = [];
|
|
59
|
+
await mapView.when(() => {
|
|
60
|
+
layerIds = mapView.map.layers.toArray().map((l) => {
|
|
61
|
+
return l.id;
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
return layerIds;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get a layer view by id
|
|
68
|
+
*
|
|
69
|
+
* @param mapView the map view to fetch the layer from
|
|
70
|
+
* @param id the id if the layer to fetch
|
|
71
|
+
*
|
|
72
|
+
* @returns Promise resolving with the fetched layer view
|
|
73
|
+
*
|
|
74
|
+
*/
|
|
75
|
+
async function getMapLayerView(mapView, id) {
|
|
76
|
+
const layer = await getMapLayer(mapView, id);
|
|
77
|
+
return layer ? await mapView.whenLayerView(layer) : undefined;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get a layer by id
|
|
81
|
+
*
|
|
82
|
+
* @param mapView the map view to fetch the layer from
|
|
83
|
+
* @param id the id if the layer to fetch
|
|
84
|
+
*
|
|
85
|
+
* @returns Promise resolving with the fetched layer
|
|
86
|
+
*
|
|
87
|
+
*/
|
|
88
|
+
async function getMapLayer(mapView, id) {
|
|
89
|
+
let layers = [];
|
|
90
|
+
await mapView.when(() => {
|
|
91
|
+
layers = mapView.map.layers.toArray().filter((l) => {
|
|
92
|
+
return l.id === id;
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
return layers.length > 0 ? layers[0] : undefined;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Highlight features by OID
|
|
99
|
+
*
|
|
100
|
+
* @param ids the OIDs from the layer to highlight
|
|
101
|
+
* @param layerView the layer view to highlight
|
|
102
|
+
* @param mapView the map view used if updateExtent is true
|
|
103
|
+
* @param updateExtent optional (default false) boolean to indicate if we should zoom to the extent
|
|
104
|
+
*
|
|
105
|
+
* @returns Promise resolving with the highlight handle
|
|
106
|
+
*
|
|
107
|
+
*/
|
|
108
|
+
async function highlightFeatures(ids, layerView, mapView, updateExtent = false) {
|
|
109
|
+
if (updateExtent) {
|
|
110
|
+
await goToSelection(ids, layerView, mapView, false);
|
|
111
|
+
}
|
|
112
|
+
return layerView.highlight(ids);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Flash features by OID
|
|
116
|
+
*
|
|
117
|
+
* @param ids the OIDs from the layer to highlight
|
|
118
|
+
* @param layerView the layer view to highlight
|
|
119
|
+
*
|
|
120
|
+
* @returns Promise resolving when the operation is complete
|
|
121
|
+
*
|
|
122
|
+
*/
|
|
123
|
+
async function flashSelection(ids, layerView, featureEffect) {
|
|
124
|
+
const filter = {
|
|
125
|
+
objectIds: ids
|
|
126
|
+
};
|
|
127
|
+
layerView.featureEffect = Object.assign(Object.assign({}, featureEffect), { filter });
|
|
128
|
+
setTimeout(() => {
|
|
129
|
+
layerView.featureEffect = undefined;
|
|
130
|
+
}, 1300);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Zoom to features based on OID
|
|
134
|
+
*
|
|
135
|
+
* @param ids the OIDs from the layer to go to
|
|
136
|
+
* @param layerView the layer view that contains the OIDs
|
|
137
|
+
* @param mapView the map view to show the extent change
|
|
138
|
+
* @param flashFeatures optional (default true) boolean to indicate if we should flash the features
|
|
139
|
+
*
|
|
140
|
+
* @returns Promise resolving when the operation is complete
|
|
141
|
+
*
|
|
142
|
+
*/
|
|
143
|
+
async function goToSelection(ids, layerView, mapView, flashFeatures = true, featureEffect = undefined) {
|
|
144
|
+
const result = await queryExtent(ids, layerView.layer);
|
|
145
|
+
await mapView.goTo(result.extent);
|
|
146
|
+
if (flashFeatures) {
|
|
147
|
+
await flashSelection(ids, layerView, featureEffect);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
16
151
|
const mapLayerPickerCss = ":host{display:block}.map-layer-picker-container{width:100%}.map-layer-picker{position:relative;width:100%;display:inline-block}.padding-bottom-1{padding-bottom:1rem}";
|
|
17
152
|
|
|
18
153
|
const MapLayerPicker = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -20,10 +155,11 @@ const MapLayerPicker = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
20
155
|
super();
|
|
21
156
|
this.__registerHost();
|
|
22
157
|
this.layerSelectionChange = createEvent(this, "layerSelectionChange", 7);
|
|
23
|
-
this.
|
|
158
|
+
this.enabledLayerIds = [];
|
|
24
159
|
this.mapView = undefined;
|
|
25
|
-
this.
|
|
160
|
+
this.selectedLayerIds = [];
|
|
26
161
|
this.selectionMode = "single";
|
|
162
|
+
this.layerIds = [];
|
|
27
163
|
}
|
|
28
164
|
//--------------------------------------------------------------------------
|
|
29
165
|
//
|
|
@@ -38,7 +174,7 @@ const MapLayerPicker = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
38
174
|
if (newValue !== oldValue) {
|
|
39
175
|
await this._setLayers();
|
|
40
176
|
if (this.selectionMode === "single") {
|
|
41
|
-
this.layerSelectionChange.emit([this.
|
|
177
|
+
this.layerSelectionChange.emit([this.layerIds[0]]);
|
|
42
178
|
}
|
|
43
179
|
}
|
|
44
180
|
}
|
|
@@ -52,8 +188,8 @@ const MapLayerPicker = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
52
188
|
*/
|
|
53
189
|
async componentWillLoad() {
|
|
54
190
|
await this._setLayers();
|
|
55
|
-
if (this.selectionMode === "single" && (this.
|
|
56
|
-
this.layerSelectionChange.emit(this.
|
|
191
|
+
if (this.selectionMode === "single" && (this.layerIds.length > 0 || this.selectedLayerIds.length === 1)) {
|
|
192
|
+
this.layerSelectionChange.emit(this.selectedLayerIds.length === 1 ? [this.selectedLayerIds[0]] : [this.layerIds[0]]);
|
|
57
193
|
}
|
|
58
194
|
}
|
|
59
195
|
/**
|
|
@@ -72,62 +208,74 @@ const MapLayerPicker = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
72
208
|
*
|
|
73
209
|
* Used for selecting a single layer.
|
|
74
210
|
*
|
|
75
|
-
* @returns Calcite Select component with the
|
|
211
|
+
* @returns Calcite Select component with the ids of the layers from the map
|
|
76
212
|
*/
|
|
77
213
|
_getSelect() {
|
|
78
214
|
return (h("calcite-select", { label: "", onCalciteSelectChange: (evt) => this._layerSelectionChange(evt), ref: (el) => { this._layerElement = el; } }, this._addMapLayersOptions()));
|
|
79
215
|
}
|
|
80
216
|
/**
|
|
81
|
-
* Create a list of
|
|
217
|
+
* Create a list of layer ids from the map
|
|
82
218
|
*
|
|
83
219
|
* Used for selecting multiple layers
|
|
84
220
|
*
|
|
85
|
-
* @returns Calcite ComboBox component with the
|
|
221
|
+
* @returns Calcite ComboBox component with the ids of the layers from the map
|
|
86
222
|
*/
|
|
87
223
|
_getCombobox() {
|
|
88
224
|
return (h("calcite-combobox", { label: "", onCalciteComboboxChange: (evt) => this._layerSelectionChange(evt), "selection-mode": this.selectionMode }, this._addMapLayersOptions()));
|
|
89
225
|
}
|
|
90
226
|
/**
|
|
91
|
-
* Hydrate a select or combobox component with the
|
|
227
|
+
* Hydrate a select or combobox component with the ids of the layers in the map
|
|
92
228
|
*
|
|
93
|
-
* @returns Array of ComboBox items or Select options for the
|
|
229
|
+
* @returns Array of ComboBox items or Select options for the ids of the layers
|
|
94
230
|
*/
|
|
95
231
|
_addMapLayersOptions() {
|
|
96
|
-
return this.
|
|
97
|
-
if (state.managedLayers.indexOf(cur) < 0) {
|
|
98
|
-
prev.push(this.selectionMode === "multi" && this.
|
|
99
|
-
(h("calcite-combobox-item", { selected: true, textLabel: cur, value: cur })) :
|
|
232
|
+
return this.layerIds.reduce((prev, cur) => {
|
|
233
|
+
if (state.managedLayers.indexOf(state.layerNameHash[cur]) < 0 && (this.enabledLayerIds.length > 0 ? this.enabledLayerIds.indexOf(cur) > -1 : true)) {
|
|
234
|
+
prev.push(this.selectionMode === "multi" && this.selectedLayerIds.indexOf(cur) > -1 ?
|
|
235
|
+
(h("calcite-combobox-item", { selected: true, textLabel: state.layerNameHash[cur], value: cur })) :
|
|
100
236
|
this.selectionMode === "multi" ?
|
|
101
|
-
(h("calcite-combobox-item", { textLabel: cur, value: cur })) :
|
|
102
|
-
this.
|
|
103
|
-
(h("calcite-option", { label: cur, selected: true, value: cur })) :
|
|
104
|
-
(h("calcite-option", { label: cur, value: cur })));
|
|
237
|
+
(h("calcite-combobox-item", { textLabel: state.layerNameHash[cur], value: cur })) :
|
|
238
|
+
this.selectedLayerIds.indexOf(cur) > -1 ?
|
|
239
|
+
(h("calcite-option", { label: state.layerNameHash[cur], selected: true, value: cur })) :
|
|
240
|
+
(h("calcite-option", { label: state.layerNameHash[cur], value: cur })));
|
|
105
241
|
}
|
|
106
242
|
return prev;
|
|
107
243
|
}, []);
|
|
108
244
|
}
|
|
109
245
|
/**
|
|
110
|
-
* Fetch the
|
|
246
|
+
* Fetch the ids of the layers from the map
|
|
111
247
|
*
|
|
112
248
|
* @returns Promise when the operation has completed
|
|
113
249
|
*/
|
|
114
250
|
async _setLayers() {
|
|
115
251
|
if (this.mapView) {
|
|
116
|
-
|
|
252
|
+
const mapLayerIds = await getMapLayerIds(this.mapView);
|
|
253
|
+
this.layerIds = mapLayerIds.filter(n => { var _a; return ((_a = this.enabledLayerIds) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.enabledLayerIds.indexOf(n) > -1 : true; });
|
|
254
|
+
await this._initLayerHashState();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Create a layer id:title hash for layer name display
|
|
259
|
+
*
|
|
260
|
+
* @returns Promise when the operation has completed
|
|
261
|
+
*/
|
|
262
|
+
async _initLayerHashState() {
|
|
263
|
+
if (this.mapView) {
|
|
264
|
+
state.layerNameHash = await getMapLayerHash(this.mapView);
|
|
117
265
|
}
|
|
118
266
|
}
|
|
119
267
|
/**
|
|
120
|
-
* Fetch the
|
|
268
|
+
* Fetch the ids of the layers from the map
|
|
121
269
|
*
|
|
122
270
|
* @returns Promise when the operation has completed
|
|
123
271
|
*/
|
|
124
272
|
_layerSelectionChange(evt) {
|
|
125
273
|
var _a;
|
|
126
|
-
this.
|
|
274
|
+
this.selectedLayerIds = this.selectionMode === "single" ?
|
|
127
275
|
[this._layerElement.value] : ((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.selectedItems.map((item) => {
|
|
128
276
|
return item.value;
|
|
129
277
|
})) || [];
|
|
130
|
-
this.layerSelectionChange.emit(this.
|
|
278
|
+
this.layerSelectionChange.emit(this.selectedLayerIds);
|
|
131
279
|
}
|
|
132
280
|
get el() { return this; }
|
|
133
281
|
static get watchers() { return {
|
|
@@ -135,10 +283,11 @@ const MapLayerPicker = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
135
283
|
}; }
|
|
136
284
|
static get style() { return mapLayerPickerCss; }
|
|
137
285
|
}, [0, "map-layer-picker", {
|
|
138
|
-
"
|
|
286
|
+
"enabledLayerIds": [16],
|
|
139
287
|
"mapView": [16],
|
|
140
|
-
"
|
|
141
|
-
"selectionMode": [1537, "selection-mode"]
|
|
288
|
+
"selectedLayerIds": [1040],
|
|
289
|
+
"selectionMode": [1537, "selection-mode"],
|
|
290
|
+
"layerIds": [32]
|
|
142
291
|
}]);
|
|
143
292
|
function defineCustomElement() {
|
|
144
293
|
if (typeof customElements === "undefined") {
|
|
@@ -185,4 +334,4 @@ function defineCustomElement() {
|
|
|
185
334
|
}
|
|
186
335
|
defineCustomElement();
|
|
187
336
|
|
|
188
|
-
export { MapLayerPicker as M, defineCustomElement as d };
|
|
337
|
+
export { MapLayerPicker as M, getMapLayerView as a, defineCustomElement as d, goToSelection as g, highlightFeatures as h };
|
|
@@ -15,6 +15,7 @@ const MapSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
15
15
|
this.__registerHost();
|
|
16
16
|
this.searchChange = createEvent(this, "searchChange", 7);
|
|
17
17
|
this.mapView = undefined;
|
|
18
|
+
this.searchConfiguration = undefined;
|
|
18
19
|
this._searchTerm = undefined;
|
|
19
20
|
this._translations = undefined;
|
|
20
21
|
}
|
|
@@ -75,10 +76,12 @@ const MapSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
75
76
|
* @protected
|
|
76
77
|
*/
|
|
77
78
|
async _initModules() {
|
|
78
|
-
const [Search] = await loadModules([
|
|
79
|
-
"esri/widgets/Search"
|
|
79
|
+
const [Search, FeatureLayer] = await loadModules([
|
|
80
|
+
"esri/widgets/Search",
|
|
81
|
+
"esri/layers/FeatureLayer"
|
|
80
82
|
]);
|
|
81
83
|
this.Search = Search;
|
|
84
|
+
this.FeatureLayer = FeatureLayer;
|
|
82
85
|
}
|
|
83
86
|
/**
|
|
84
87
|
* Initialize the search widget
|
|
@@ -95,11 +98,8 @@ const MapSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
95
98
|
*/
|
|
96
99
|
_initSearchWidget() {
|
|
97
100
|
if (this.mapView && this._searchElement) {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
container: this._searchElement,
|
|
101
|
-
searchTerm: this._searchTerm
|
|
102
|
-
};
|
|
101
|
+
const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
|
|
102
|
+
const searchOptions = Object.assign({ view: this.mapView, container: this._searchElement, searchTerm: this._searchTerm }, searchConfiguration);
|
|
103
103
|
this._searchWidget = new this.Search(searchOptions);
|
|
104
104
|
this._searchWidget.on("search-clear", () => {
|
|
105
105
|
this._searchResult = undefined;
|
|
@@ -117,6 +117,45 @@ const MapSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Initialize the search widget based on user defined configuration
|
|
122
|
+
*
|
|
123
|
+
* @param searchConfiguration search configuration defined by the user
|
|
124
|
+
* @param view the current map view
|
|
125
|
+
*
|
|
126
|
+
* @protected
|
|
127
|
+
*/
|
|
128
|
+
_getSearchConfig(searchConfiguration, view) {
|
|
129
|
+
var _a;
|
|
130
|
+
const sources = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources;
|
|
131
|
+
if (sources) {
|
|
132
|
+
sources.forEach(source => {
|
|
133
|
+
var _a, _b, _c;
|
|
134
|
+
const isLayerSource = source.hasOwnProperty("layer");
|
|
135
|
+
if (isLayerSource) {
|
|
136
|
+
const layerSource = source;
|
|
137
|
+
const layerFromMap = ((_a = layerSource.layer) === null || _a === void 0 ? void 0 : _a.id)
|
|
138
|
+
? view.map.findLayerById(layerSource.layer.id)
|
|
139
|
+
: null;
|
|
140
|
+
if (layerFromMap) {
|
|
141
|
+
layerSource.layer = layerFromMap;
|
|
142
|
+
}
|
|
143
|
+
else if ((_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url) {
|
|
144
|
+
layerSource.layer = new this.FeatureLayer((_c = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _c === void 0 ? void 0 : _c.url);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
(_a = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources) === null || _a === void 0 ? void 0 : _a.forEach(source => {
|
|
150
|
+
const isLocatorSource = source.hasOwnProperty("locator");
|
|
151
|
+
if (isLocatorSource) {
|
|
152
|
+
const locatorSource = source;
|
|
153
|
+
locatorSource.url = locatorSource.url;
|
|
154
|
+
delete locatorSource.url;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
return searchConfiguration;
|
|
158
|
+
}
|
|
120
159
|
/**
|
|
121
160
|
* Fetches the component's translations
|
|
122
161
|
*
|
|
@@ -130,6 +169,7 @@ const MapSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
130
169
|
static get style() { return mapSearchCss; }
|
|
131
170
|
}, [0, "map-search", {
|
|
132
171
|
"mapView": [16],
|
|
172
|
+
"searchConfiguration": [16],
|
|
133
173
|
"_searchTerm": [32],
|
|
134
174
|
"_translations": [32],
|
|
135
175
|
"clear": [64]
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
7
7
|
import { l as loadModules } from './loadModules.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { g as goToSelection, h as highlightFeatures, d as defineCustomElement$2 } from './map-layer-picker2.js';
|
|
9
|
+
import { b as queryObjectIds, c as getQueryGeoms } from './queryUtils.js';
|
|
10
10
|
import { c as EWorkflowType, e as ESelectionMode, f as ERefineMode, b as ESketchType } from './interfaces3.js';
|
|
11
11
|
import { s as state } from './publicNotificationStore.js';
|
|
12
12
|
import { g as getLocaleComponentStrings } from './locale.js';
|
|
@@ -28,7 +28,6 @@ import { d as defineCustomElement$6 } from './radio-group-item.js';
|
|
|
28
28
|
import { d as defineCustomElement$5 } from './select.js';
|
|
29
29
|
import { d as defineCustomElement$4 } from './slider.js';
|
|
30
30
|
import { d as defineCustomElement$3 } from './map-draw-tools2.js';
|
|
31
|
-
import { d as defineCustomElement$2 } from './map-layer-picker2.js';
|
|
32
31
|
import { d as defineCustomElement$1 } from './refine-selection-tools2.js';
|
|
33
32
|
|
|
34
33
|
const mapSelectToolsCss = ":host{display:block}.div-visible{display:inherit}.div-visible-search{display:flex;height:44px;align-items:center;padding-bottom:0}.div-not-visible{display:none}.padding-bottom-1{padding-bottom:1rem}.search-widget{width:100% !important;border:1px solid var(--calcite-ui-border-input)}.w-100{width:100%}.w-50{width:50%}.search-distance-container{padding-top:\"1rem\" !important}.end-border{-webkit-border-end:1px solid var(--calcite-ui-border-2);border-inline-end:1px solid var(--calcite-ui-border-2)}.search-distance{display:flex;padding-top:1rem}";
|
|
@@ -48,9 +47,13 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
48
47
|
* string: A label to help uniquely identify the selection set
|
|
49
48
|
*/
|
|
50
49
|
this._selectionLabel = "";
|
|
50
|
+
this.enabledLayerIds = [];
|
|
51
|
+
this.defaultBufferDistance = undefined;
|
|
52
|
+
this.defaultBufferUnit = undefined;
|
|
51
53
|
this.geometries = undefined;
|
|
52
54
|
this.isUpdate = false;
|
|
53
55
|
this.mapView = undefined;
|
|
56
|
+
this.searchConfiguration = undefined;
|
|
54
57
|
this.selectionSet = undefined;
|
|
55
58
|
this.selectLayerView = undefined;
|
|
56
59
|
this.showBufferTools = true;
|
|
@@ -176,7 +179,7 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
176
179
|
const useSelectClass = this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
|
|
177
180
|
const useDrawClass = !this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
|
|
178
181
|
const showLayerChoiceClass = searchEnabled ? "div-not-visible" : "div-visible";
|
|
179
|
-
return (h(Host, null, h("div", { class: "padding-bottom-1" }, h("calcite-radio-group", { class: "w-100", onCalciteRadioGroupChange: (evt) => this._workflowChange(evt) }, h("calcite-radio-group-item", { checked: searchEnabled, class: "w-50 end-border", value: EWorkflowType.SEARCH }, this._translations.search), h("calcite-radio-group-item", { checked: drawEnabled, class: "w-50", value: EWorkflowType.SKETCH }, this._translations.sketch))), h("div", { class: showSearchClass }, h("div", { class: "search-widget", ref: (el) => { this._searchElement = el; } })), h("div", { class: showLayerChoiceClass }, h("calcite-label", { layout: "inline" }, h("calcite-checkbox", { onCalciteCheckboxChange: () => this._layerSelectChanged(), ref: (el) => this._selectFromLayerElement = el }), "Use layer features")), h("div", { class: useDrawClass }, h("map-draw-tools", { active: true, border: true, mapView: this.mapView, ref: (el) => { this._drawTools = el; } })), h("div", { class: useSelectClass }, h("refine-selection-tools", { active: true, border: true, layerViews: this._refineSelectLayers, mapView: this.mapView, mode: ESelectionMode.ADD, ref: (el) => { this._refineTools = el; }, refineMode: ERefineMode.SUBSET })), h("calcite-label", { class: showBufferToolsClass }, this._translations.searchDistance, h("buffer-tools", { distance: (_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.distance, geometries: this.geometries, onBufferComplete: (evt) => this._bufferComplete(evt), ref: (el) => this._bufferTools = el, unit: (_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.unit })), h("slot", null)));
|
|
182
|
+
return (h(Host, null, h("div", { class: "padding-bottom-1" }, h("calcite-radio-group", { class: "w-100", onCalciteRadioGroupChange: (evt) => this._workflowChange(evt) }, h("calcite-radio-group-item", { checked: searchEnabled, class: "w-50 end-border", value: EWorkflowType.SEARCH }, this._translations.search), h("calcite-radio-group-item", { checked: drawEnabled, class: "w-50", value: EWorkflowType.SKETCH }, this._translations.sketch))), h("div", { class: showSearchClass }, h("div", { class: "search-widget", ref: (el) => { this._searchElement = el; } })), h("div", { class: showLayerChoiceClass }, h("calcite-label", { layout: "inline" }, h("calcite-checkbox", { onCalciteCheckboxChange: () => this._layerSelectChanged(), ref: (el) => this._selectFromLayerElement = el }), "Use layer features")), h("div", { class: useDrawClass }, h("map-draw-tools", { active: true, border: true, mapView: this.mapView, ref: (el) => { this._drawTools = el; } })), h("div", { class: useSelectClass }, h("refine-selection-tools", { active: true, border: true, enabledLayerIds: this.enabledLayerIds, layerViews: this._refineSelectLayers, mapView: this.mapView, mode: ESelectionMode.ADD, ref: (el) => { this._refineTools = el; }, refineMode: ERefineMode.SUBSET })), h("calcite-label", { class: showBufferToolsClass }, this._translations.searchDistance, h("buffer-tools", { distance: ((_a = this.selectionSet) === null || _a === void 0 ? void 0 : _a.distance) || this.defaultBufferDistance, geometries: this.geometries, onBufferComplete: (evt) => this._bufferComplete(evt), ref: (el) => this._bufferTools = el, unit: ((_b = this.selectionSet) === null || _b === void 0 ? void 0 : _b.unit) || this.defaultBufferUnit })), h("slot", null)));
|
|
180
183
|
}
|
|
181
184
|
//--------------------------------------------------------------------------
|
|
182
185
|
//
|
|
@@ -191,16 +194,18 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
191
194
|
* @protected
|
|
192
195
|
*/
|
|
193
196
|
async _initModules() {
|
|
194
|
-
const [GraphicsLayer, Graphic, Search, geometryEngine] = await loadModules([
|
|
197
|
+
const [GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await loadModules([
|
|
195
198
|
"esri/layers/GraphicsLayer",
|
|
196
199
|
"esri/Graphic",
|
|
197
200
|
"esri/widgets/Search",
|
|
198
|
-
"esri/geometry/geometryEngine"
|
|
201
|
+
"esri/geometry/geometryEngine",
|
|
202
|
+
"esri/layers/FeatureLayer"
|
|
199
203
|
]);
|
|
200
204
|
this.GraphicsLayer = GraphicsLayer;
|
|
201
205
|
this.Graphic = Graphic;
|
|
202
206
|
this.Search = Search;
|
|
203
207
|
this._geometryEngine = geometryEngine;
|
|
208
|
+
this.FeatureLayer = FeatureLayer;
|
|
204
209
|
}
|
|
205
210
|
/**
|
|
206
211
|
* Initialize the graphics layer, selection set, and search widget
|
|
@@ -244,11 +249,8 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
244
249
|
*/
|
|
245
250
|
_initSearchWidget() {
|
|
246
251
|
if (this.mapView && this._searchElement) {
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
container: this._searchElement,
|
|
250
|
-
searchTerm: this._searchTerm
|
|
251
|
-
};
|
|
252
|
+
const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
|
|
253
|
+
const searchOptions = Object.assign({ view: this.mapView, container: this._searchElement, searchTerm: this._searchTerm }, searchConfiguration);
|
|
252
254
|
this._searchWidget = new this.Search(searchOptions);
|
|
253
255
|
this._searchWidget.on("search-clear", () => {
|
|
254
256
|
void this._clearResults(false);
|
|
@@ -263,6 +265,45 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
263
265
|
});
|
|
264
266
|
}
|
|
265
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* Initialize the search widget based on user defined configuration
|
|
270
|
+
*
|
|
271
|
+
* @param searchConfiguration search configuration defined by the user
|
|
272
|
+
* @param view the current map view
|
|
273
|
+
*
|
|
274
|
+
* @protected
|
|
275
|
+
*/
|
|
276
|
+
_getSearchConfig(searchConfiguration, view) {
|
|
277
|
+
var _a;
|
|
278
|
+
const sources = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources;
|
|
279
|
+
if (sources) {
|
|
280
|
+
sources.forEach(source => {
|
|
281
|
+
var _a, _b, _c;
|
|
282
|
+
const isLayerSource = source.hasOwnProperty("layer");
|
|
283
|
+
if (isLayerSource) {
|
|
284
|
+
const layerSource = source;
|
|
285
|
+
const layerFromMap = ((_a = layerSource.layer) === null || _a === void 0 ? void 0 : _a.id)
|
|
286
|
+
? view.map.findLayerById(layerSource.layer.id)
|
|
287
|
+
: null;
|
|
288
|
+
if (layerFromMap) {
|
|
289
|
+
layerSource.layer = layerFromMap;
|
|
290
|
+
}
|
|
291
|
+
else if ((_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url) {
|
|
292
|
+
layerSource.layer = new this.FeatureLayer((_c = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _c === void 0 ? void 0 : _c.url);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
(_a = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources) === null || _a === void 0 ? void 0 : _a.forEach(source => {
|
|
298
|
+
const isLocatorSource = source.hasOwnProperty("locator");
|
|
299
|
+
if (isLocatorSource) {
|
|
300
|
+
const locatorSource = source;
|
|
301
|
+
locatorSource.url = locatorSource.url;
|
|
302
|
+
delete locatorSource.url;
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
return searchConfiguration;
|
|
306
|
+
}
|
|
266
307
|
/**
|
|
267
308
|
* Initialize the graphics layer used to store any buffer grapghics
|
|
268
309
|
*
|
|
@@ -445,9 +486,13 @@ const MapSelectTools = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
445
486
|
}; }
|
|
446
487
|
static get style() { return mapSelectToolsCss; }
|
|
447
488
|
}, [4, "map-select-tools", {
|
|
489
|
+
"enabledLayerIds": [16],
|
|
490
|
+
"defaultBufferDistance": [2, "default-buffer-distance"],
|
|
491
|
+
"defaultBufferUnit": [1, "default-buffer-unit"],
|
|
448
492
|
"geometries": [16],
|
|
449
493
|
"isUpdate": [4, "is-update"],
|
|
450
494
|
"mapView": [16],
|
|
495
|
+
"searchConfiguration": [16],
|
|
451
496
|
"selectionSet": [16],
|
|
452
497
|
"selectLayerView": [16],
|
|
453
498
|
"showBufferTools": [4, "show-buffer-tools"],
|