@esri/solutions-components 0.3.2 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -19,14 +19,15 @@
|
|
19
19
|
* limitations under the License.
|
20
20
|
*/
|
21
21
|
import { Host, h } from "@stencil/core";
|
22
|
-
import {
|
22
|
+
import { getMapLayerHash, getMapLayerIds } from "../../utils/mapViewUtils";
|
23
23
|
import state from "../../utils/publicNotificationStore";
|
24
24
|
export class MapLayerPicker {
|
25
25
|
constructor() {
|
26
|
-
this.
|
26
|
+
this.enabledLayerIds = [];
|
27
27
|
this.mapView = undefined;
|
28
|
-
this.
|
28
|
+
this.selectedLayerIds = [];
|
29
29
|
this.selectionMode = "single";
|
30
|
+
this.layerIds = [];
|
30
31
|
}
|
31
32
|
//--------------------------------------------------------------------------
|
32
33
|
//
|
@@ -41,7 +42,7 @@ export class MapLayerPicker {
|
|
41
42
|
if (newValue !== oldValue) {
|
42
43
|
await this._setLayers();
|
43
44
|
if (this.selectionMode === "single") {
|
44
|
-
this.layerSelectionChange.emit([this.
|
45
|
+
this.layerSelectionChange.emit([this.layerIds[0]]);
|
45
46
|
}
|
46
47
|
}
|
47
48
|
}
|
@@ -55,8 +56,8 @@ export class MapLayerPicker {
|
|
55
56
|
*/
|
56
57
|
async componentWillLoad() {
|
57
58
|
await this._setLayers();
|
58
|
-
if (this.selectionMode === "single" && (this.
|
59
|
-
this.layerSelectionChange.emit(this.
|
59
|
+
if (this.selectionMode === "single" && (this.layerIds.length > 0 || this.selectedLayerIds.length === 1)) {
|
60
|
+
this.layerSelectionChange.emit(this.selectedLayerIds.length === 1 ? [this.selectedLayerIds[0]] : [this.layerIds[0]]);
|
60
61
|
}
|
61
62
|
}
|
62
63
|
/**
|
@@ -75,62 +76,74 @@ export class MapLayerPicker {
|
|
75
76
|
*
|
76
77
|
* Used for selecting a single layer.
|
77
78
|
*
|
78
|
-
* @returns Calcite Select component with the
|
79
|
+
* @returns Calcite Select component with the ids of the layers from the map
|
79
80
|
*/
|
80
81
|
_getSelect() {
|
81
82
|
return (h("calcite-select", { label: "", onCalciteSelectChange: (evt) => this._layerSelectionChange(evt), ref: (el) => { this._layerElement = el; } }, this._addMapLayersOptions()));
|
82
83
|
}
|
83
84
|
/**
|
84
|
-
* Create a list of
|
85
|
+
* Create a list of layer ids from the map
|
85
86
|
*
|
86
87
|
* Used for selecting multiple layers
|
87
88
|
*
|
88
|
-
* @returns Calcite ComboBox component with the
|
89
|
+
* @returns Calcite ComboBox component with the ids of the layers from the map
|
89
90
|
*/
|
90
91
|
_getCombobox() {
|
91
92
|
return (h("calcite-combobox", { label: "", onCalciteComboboxChange: (evt) => this._layerSelectionChange(evt), "selection-mode": this.selectionMode }, this._addMapLayersOptions()));
|
92
93
|
}
|
93
94
|
/**
|
94
|
-
* Hydrate a select or combobox component with the
|
95
|
+
* Hydrate a select or combobox component with the ids of the layers in the map
|
95
96
|
*
|
96
|
-
* @returns Array of ComboBox items or Select options for the
|
97
|
+
* @returns Array of ComboBox items or Select options for the ids of the layers
|
97
98
|
*/
|
98
99
|
_addMapLayersOptions() {
|
99
|
-
return this.
|
100
|
-
if (state.managedLayers.indexOf(cur) < 0) {
|
101
|
-
prev.push(this.selectionMode === "multi" && this.
|
102
|
-
(h("calcite-combobox-item", { selected: true, textLabel: cur, value: cur })) :
|
100
|
+
return this.layerIds.reduce((prev, cur) => {
|
101
|
+
if (state.managedLayers.indexOf(state.layerNameHash[cur]) < 0 && (this.enabledLayerIds.length > 0 ? this.enabledLayerIds.indexOf(cur) > -1 : true)) {
|
102
|
+
prev.push(this.selectionMode === "multi" && this.selectedLayerIds.indexOf(cur) > -1 ?
|
103
|
+
(h("calcite-combobox-item", { selected: true, textLabel: state.layerNameHash[cur], value: cur })) :
|
103
104
|
this.selectionMode === "multi" ?
|
104
|
-
(h("calcite-combobox-item", { textLabel: cur, value: cur })) :
|
105
|
-
this.
|
106
|
-
(h("calcite-option", { label: cur, selected: true, value: cur })) :
|
107
|
-
(h("calcite-option", { label: cur, value: cur })));
|
105
|
+
(h("calcite-combobox-item", { textLabel: state.layerNameHash[cur], value: cur })) :
|
106
|
+
this.selectedLayerIds.indexOf(cur) > -1 ?
|
107
|
+
(h("calcite-option", { label: state.layerNameHash[cur], selected: true, value: cur })) :
|
108
|
+
(h("calcite-option", { label: state.layerNameHash[cur], value: cur })));
|
108
109
|
}
|
109
110
|
return prev;
|
110
111
|
}, []);
|
111
112
|
}
|
112
113
|
/**
|
113
|
-
* Fetch the
|
114
|
+
* Fetch the ids of the layers from the map
|
114
115
|
*
|
115
116
|
* @returns Promise when the operation has completed
|
116
117
|
*/
|
117
118
|
async _setLayers() {
|
118
119
|
if (this.mapView) {
|
119
|
-
|
120
|
+
const mapLayerIds = await getMapLayerIds(this.mapView);
|
121
|
+
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; });
|
122
|
+
await this._initLayerHashState();
|
120
123
|
}
|
121
124
|
}
|
122
125
|
/**
|
123
|
-
*
|
126
|
+
* Create a layer id:title hash for layer name display
|
127
|
+
*
|
128
|
+
* @returns Promise when the operation has completed
|
129
|
+
*/
|
130
|
+
async _initLayerHashState() {
|
131
|
+
if (this.mapView) {
|
132
|
+
state.layerNameHash = await getMapLayerHash(this.mapView);
|
133
|
+
}
|
134
|
+
}
|
135
|
+
/**
|
136
|
+
* Fetch the ids of the layers from the map
|
124
137
|
*
|
125
138
|
* @returns Promise when the operation has completed
|
126
139
|
*/
|
127
140
|
_layerSelectionChange(evt) {
|
128
141
|
var _a;
|
129
|
-
this.
|
142
|
+
this.selectedLayerIds = this.selectionMode === "single" ?
|
130
143
|
[this._layerElement.value] : ((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.selectedItems.map((item) => {
|
131
144
|
return item.value;
|
132
145
|
})) || [];
|
133
|
-
this.layerSelectionChange.emit(this.
|
146
|
+
this.layerSelectionChange.emit(this.selectedLayerIds);
|
134
147
|
}
|
135
148
|
static get is() { return "map-layer-picker"; }
|
136
149
|
static get originalStyleUrls() {
|
@@ -145,9 +158,9 @@ export class MapLayerPicker {
|
|
145
158
|
}
|
146
159
|
static get properties() {
|
147
160
|
return {
|
148
|
-
"
|
161
|
+
"enabledLayerIds": {
|
149
162
|
"type": "unknown",
|
150
|
-
"mutable":
|
163
|
+
"mutable": false,
|
151
164
|
"complexType": {
|
152
165
|
"original": "string[]",
|
153
166
|
"resolved": "string[]",
|
@@ -157,7 +170,7 @@ export class MapLayerPicker {
|
|
157
170
|
"optional": false,
|
158
171
|
"docs": {
|
159
172
|
"tags": [],
|
160
|
-
"text": "string[]: list of layer
|
173
|
+
"text": "string[]: Optional list of enabled layer ids\r\n If empty all layers will be available"
|
161
174
|
},
|
162
175
|
"defaultValue": "[]"
|
163
176
|
},
|
@@ -180,7 +193,7 @@ export class MapLayerPicker {
|
|
180
193
|
"text": "esri/views/View: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html"
|
181
194
|
}
|
182
195
|
},
|
183
|
-
"
|
196
|
+
"selectedLayerIds": {
|
184
197
|
"type": "unknown",
|
185
198
|
"mutable": true,
|
186
199
|
"complexType": {
|
@@ -192,7 +205,7 @@ export class MapLayerPicker {
|
|
192
205
|
"optional": false,
|
193
206
|
"docs": {
|
194
207
|
"tags": [],
|
195
|
-
"text": "string[]: list of
|
208
|
+
"text": "string[]: list of layer ids that have been selected by the end user"
|
196
209
|
},
|
197
210
|
"defaultValue": "[]"
|
198
211
|
},
|
@@ -221,6 +234,11 @@ export class MapLayerPicker {
|
|
221
234
|
}
|
222
235
|
};
|
223
236
|
}
|
237
|
+
static get states() {
|
238
|
+
return {
|
239
|
+
"layerIds": {}
|
240
|
+
};
|
241
|
+
}
|
224
242
|
static get events() {
|
225
243
|
return [{
|
226
244
|
"method": "layerSelectionChange",
|
@@ -24,6 +24,7 @@ import { getLocaleComponentStrings } from "../../utils/locale";
|
|
24
24
|
export class MapSearch {
|
25
25
|
constructor() {
|
26
26
|
this.mapView = undefined;
|
27
|
+
this.searchConfiguration = undefined;
|
27
28
|
this._searchTerm = undefined;
|
28
29
|
this._translations = undefined;
|
29
30
|
}
|
@@ -84,10 +85,12 @@ export class MapSearch {
|
|
84
85
|
* @protected
|
85
86
|
*/
|
86
87
|
async _initModules() {
|
87
|
-
const [Search] = await loadModules([
|
88
|
-
"esri/widgets/Search"
|
88
|
+
const [Search, FeatureLayer] = await loadModules([
|
89
|
+
"esri/widgets/Search",
|
90
|
+
"esri/layers/FeatureLayer"
|
89
91
|
]);
|
90
92
|
this.Search = Search;
|
93
|
+
this.FeatureLayer = FeatureLayer;
|
91
94
|
}
|
92
95
|
/**
|
93
96
|
* Initialize the search widget
|
@@ -104,11 +107,8 @@ export class MapSearch {
|
|
104
107
|
*/
|
105
108
|
_initSearchWidget() {
|
106
109
|
if (this.mapView && this._searchElement) {
|
107
|
-
const
|
108
|
-
|
109
|
-
container: this._searchElement,
|
110
|
-
searchTerm: this._searchTerm
|
111
|
-
};
|
110
|
+
const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
|
111
|
+
const searchOptions = Object.assign({ view: this.mapView, container: this._searchElement, searchTerm: this._searchTerm }, searchConfiguration);
|
112
112
|
this._searchWidget = new this.Search(searchOptions);
|
113
113
|
this._searchWidget.on("search-clear", () => {
|
114
114
|
this._searchResult = undefined;
|
@@ -126,6 +126,45 @@ export class MapSearch {
|
|
126
126
|
});
|
127
127
|
}
|
128
128
|
}
|
129
|
+
/**
|
130
|
+
* Initialize the search widget based on user defined configuration
|
131
|
+
*
|
132
|
+
* @param searchConfiguration search configuration defined by the user
|
133
|
+
* @param view the current map view
|
134
|
+
*
|
135
|
+
* @protected
|
136
|
+
*/
|
137
|
+
_getSearchConfig(searchConfiguration, view) {
|
138
|
+
var _a;
|
139
|
+
const sources = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources;
|
140
|
+
if (sources) {
|
141
|
+
sources.forEach(source => {
|
142
|
+
var _a, _b, _c;
|
143
|
+
const isLayerSource = source.hasOwnProperty("layer");
|
144
|
+
if (isLayerSource) {
|
145
|
+
const layerSource = source;
|
146
|
+
const layerFromMap = ((_a = layerSource.layer) === null || _a === void 0 ? void 0 : _a.id)
|
147
|
+
? view.map.findLayerById(layerSource.layer.id)
|
148
|
+
: null;
|
149
|
+
if (layerFromMap) {
|
150
|
+
layerSource.layer = layerFromMap;
|
151
|
+
}
|
152
|
+
else if ((_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url) {
|
153
|
+
layerSource.layer = new this.FeatureLayer((_c = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _c === void 0 ? void 0 : _c.url);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
});
|
157
|
+
}
|
158
|
+
(_a = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources) === null || _a === void 0 ? void 0 : _a.forEach(source => {
|
159
|
+
const isLocatorSource = source.hasOwnProperty("locator");
|
160
|
+
if (isLocatorSource) {
|
161
|
+
const locatorSource = source;
|
162
|
+
locatorSource.url = locatorSource.url;
|
163
|
+
delete locatorSource.url;
|
164
|
+
}
|
165
|
+
});
|
166
|
+
return searchConfiguration;
|
167
|
+
}
|
129
168
|
/**
|
130
169
|
* Fetches the component's translations
|
131
170
|
*
|
@@ -166,6 +205,26 @@ export class MapSearch {
|
|
166
205
|
"tags": [],
|
167
206
|
"text": "esri/views/View: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html"
|
168
207
|
}
|
208
|
+
},
|
209
|
+
"searchConfiguration": {
|
210
|
+
"type": "unknown",
|
211
|
+
"mutable": false,
|
212
|
+
"complexType": {
|
213
|
+
"original": "ISearchConfiguration",
|
214
|
+
"resolved": "ISearchConfiguration",
|
215
|
+
"references": {
|
216
|
+
"ISearchConfiguration": {
|
217
|
+
"location": "import",
|
218
|
+
"path": "../../utils/interfaces"
|
219
|
+
}
|
220
|
+
}
|
221
|
+
},
|
222
|
+
"required": false,
|
223
|
+
"optional": false,
|
224
|
+
"docs": {
|
225
|
+
"tags": [],
|
226
|
+
"text": "ISearchConfiguration: Configuration details for the Search widget"
|
227
|
+
}
|
169
228
|
}
|
170
229
|
};
|
171
230
|
}
|
@@ -35,9 +35,13 @@ export class MapSelectTools {
|
|
35
35
|
* string: A label to help uniquely identify the selection set
|
36
36
|
*/
|
37
37
|
this._selectionLabel = "";
|
38
|
+
this.enabledLayerIds = [];
|
39
|
+
this.defaultBufferDistance = undefined;
|
40
|
+
this.defaultBufferUnit = undefined;
|
38
41
|
this.geometries = undefined;
|
39
42
|
this.isUpdate = false;
|
40
43
|
this.mapView = undefined;
|
44
|
+
this.searchConfiguration = undefined;
|
41
45
|
this.selectionSet = undefined;
|
42
46
|
this.selectLayerView = undefined;
|
43
47
|
this.showBufferTools = true;
|
@@ -163,7 +167,7 @@ export class MapSelectTools {
|
|
163
167
|
const useSelectClass = this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
|
164
168
|
const useDrawClass = !this._layerSelectChecked && !searchEnabled ? " div-visible" : " div-not-visible";
|
165
169
|
const showLayerChoiceClass = searchEnabled ? "div-not-visible" : "div-visible";
|
166
|
-
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)));
|
170
|
+
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)));
|
167
171
|
}
|
168
172
|
//--------------------------------------------------------------------------
|
169
173
|
//
|
@@ -178,16 +182,18 @@ export class MapSelectTools {
|
|
178
182
|
* @protected
|
179
183
|
*/
|
180
184
|
async _initModules() {
|
181
|
-
const [GraphicsLayer, Graphic, Search, geometryEngine] = await loadModules([
|
185
|
+
const [GraphicsLayer, Graphic, Search, geometryEngine, FeatureLayer] = await loadModules([
|
182
186
|
"esri/layers/GraphicsLayer",
|
183
187
|
"esri/Graphic",
|
184
188
|
"esri/widgets/Search",
|
185
|
-
"esri/geometry/geometryEngine"
|
189
|
+
"esri/geometry/geometryEngine",
|
190
|
+
"esri/layers/FeatureLayer"
|
186
191
|
]);
|
187
192
|
this.GraphicsLayer = GraphicsLayer;
|
188
193
|
this.Graphic = Graphic;
|
189
194
|
this.Search = Search;
|
190
195
|
this._geometryEngine = geometryEngine;
|
196
|
+
this.FeatureLayer = FeatureLayer;
|
191
197
|
}
|
192
198
|
/**
|
193
199
|
* Initialize the graphics layer, selection set, and search widget
|
@@ -231,11 +237,8 @@ export class MapSelectTools {
|
|
231
237
|
*/
|
232
238
|
_initSearchWidget() {
|
233
239
|
if (this.mapView && this._searchElement) {
|
234
|
-
const
|
235
|
-
|
236
|
-
container: this._searchElement,
|
237
|
-
searchTerm: this._searchTerm
|
238
|
-
};
|
240
|
+
const searchConfiguration = this._getSearchConfig(this.searchConfiguration, this.mapView);
|
241
|
+
const searchOptions = Object.assign({ view: this.mapView, container: this._searchElement, searchTerm: this._searchTerm }, searchConfiguration);
|
239
242
|
this._searchWidget = new this.Search(searchOptions);
|
240
243
|
this._searchWidget.on("search-clear", () => {
|
241
244
|
void this._clearResults(false);
|
@@ -250,6 +253,45 @@ export class MapSelectTools {
|
|
250
253
|
});
|
251
254
|
}
|
252
255
|
}
|
256
|
+
/**
|
257
|
+
* Initialize the search widget based on user defined configuration
|
258
|
+
*
|
259
|
+
* @param searchConfiguration search configuration defined by the user
|
260
|
+
* @param view the current map view
|
261
|
+
*
|
262
|
+
* @protected
|
263
|
+
*/
|
264
|
+
_getSearchConfig(searchConfiguration, view) {
|
265
|
+
var _a;
|
266
|
+
const sources = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources;
|
267
|
+
if (sources) {
|
268
|
+
sources.forEach(source => {
|
269
|
+
var _a, _b, _c;
|
270
|
+
const isLayerSource = source.hasOwnProperty("layer");
|
271
|
+
if (isLayerSource) {
|
272
|
+
const layerSource = source;
|
273
|
+
const layerFromMap = ((_a = layerSource.layer) === null || _a === void 0 ? void 0 : _a.id)
|
274
|
+
? view.map.findLayerById(layerSource.layer.id)
|
275
|
+
: null;
|
276
|
+
if (layerFromMap) {
|
277
|
+
layerSource.layer = layerFromMap;
|
278
|
+
}
|
279
|
+
else if ((_b = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _b === void 0 ? void 0 : _b.url) {
|
280
|
+
layerSource.layer = new this.FeatureLayer((_c = layerSource === null || layerSource === void 0 ? void 0 : layerSource.layer) === null || _c === void 0 ? void 0 : _c.url);
|
281
|
+
}
|
282
|
+
}
|
283
|
+
});
|
284
|
+
}
|
285
|
+
(_a = searchConfiguration === null || searchConfiguration === void 0 ? void 0 : searchConfiguration.sources) === null || _a === void 0 ? void 0 : _a.forEach(source => {
|
286
|
+
const isLocatorSource = source.hasOwnProperty("locator");
|
287
|
+
if (isLocatorSource) {
|
288
|
+
const locatorSource = source;
|
289
|
+
locatorSource.url = locatorSource.url;
|
290
|
+
delete locatorSource.url;
|
291
|
+
}
|
292
|
+
});
|
293
|
+
return searchConfiguration;
|
294
|
+
}
|
253
295
|
/**
|
254
296
|
* Initialize the graphics layer used to store any buffer grapghics
|
255
297
|
*
|
@@ -438,6 +480,61 @@ export class MapSelectTools {
|
|
438
480
|
}
|
439
481
|
static get properties() {
|
440
482
|
return {
|
483
|
+
"enabledLayerIds": {
|
484
|
+
"type": "unknown",
|
485
|
+
"mutable": false,
|
486
|
+
"complexType": {
|
487
|
+
"original": "string[]",
|
488
|
+
"resolved": "string[]",
|
489
|
+
"references": {}
|
490
|
+
},
|
491
|
+
"required": false,
|
492
|
+
"optional": false,
|
493
|
+
"docs": {
|
494
|
+
"tags": [],
|
495
|
+
"text": "string[]: Optional list of enabled layer ids\r\n If empty all layers will be available"
|
496
|
+
},
|
497
|
+
"defaultValue": "[]"
|
498
|
+
},
|
499
|
+
"defaultBufferDistance": {
|
500
|
+
"type": "number",
|
501
|
+
"mutable": false,
|
502
|
+
"complexType": {
|
503
|
+
"original": "number",
|
504
|
+
"resolved": "number",
|
505
|
+
"references": {}
|
506
|
+
},
|
507
|
+
"required": false,
|
508
|
+
"optional": false,
|
509
|
+
"docs": {
|
510
|
+
"tags": [],
|
511
|
+
"text": "number: The default value to show for the buffer distance"
|
512
|
+
},
|
513
|
+
"attribute": "default-buffer-distance",
|
514
|
+
"reflect": false
|
515
|
+
},
|
516
|
+
"defaultBufferUnit": {
|
517
|
+
"type": "string",
|
518
|
+
"mutable": false,
|
519
|
+
"complexType": {
|
520
|
+
"original": "DistanceUnit",
|
521
|
+
"resolved": "\"feet\" | \"kilometers\" | \"meters\" | \"miles\"",
|
522
|
+
"references": {
|
523
|
+
"DistanceUnit": {
|
524
|
+
"location": "import",
|
525
|
+
"path": "../../utils/interfaces"
|
526
|
+
}
|
527
|
+
}
|
528
|
+
},
|
529
|
+
"required": false,
|
530
|
+
"optional": false,
|
531
|
+
"docs": {
|
532
|
+
"tags": [],
|
533
|
+
"text": "number: The default value to show for the buffer unit"
|
534
|
+
},
|
535
|
+
"attribute": "default-buffer-unit",
|
536
|
+
"reflect": false
|
537
|
+
},
|
441
538
|
"geometries": {
|
442
539
|
"type": "unknown",
|
443
540
|
"mutable": false,
|
@@ -494,6 +591,26 @@ export class MapSelectTools {
|
|
494
591
|
"text": "esri/views/View: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html"
|
495
592
|
}
|
496
593
|
},
|
594
|
+
"searchConfiguration": {
|
595
|
+
"type": "unknown",
|
596
|
+
"mutable": false,
|
597
|
+
"complexType": {
|
598
|
+
"original": "ISearchConfiguration",
|
599
|
+
"resolved": "ISearchConfiguration",
|
600
|
+
"references": {
|
601
|
+
"ISearchConfiguration": {
|
602
|
+
"location": "import",
|
603
|
+
"path": "../../utils/interfaces"
|
604
|
+
}
|
605
|
+
}
|
606
|
+
},
|
607
|
+
"required": false,
|
608
|
+
"optional": false,
|
609
|
+
"docs": {
|
610
|
+
"tags": [],
|
611
|
+
"text": "ISearchConfiguration: Configuration details for the Search widget"
|
612
|
+
}
|
613
|
+
},
|
497
614
|
"selectionSet": {
|
498
615
|
"type": "unknown",
|
499
616
|
"mutable": false,
|
@@ -26,6 +26,7 @@ import { exportCSV } from "../../utils/csvUtils";
|
|
26
26
|
export class PdfDownload {
|
27
27
|
constructor() {
|
28
28
|
this.disabled = true;
|
29
|
+
this.enabledSizeValues = [];
|
29
30
|
this.layerView = undefined;
|
30
31
|
this._translations = undefined;
|
31
32
|
}
|
@@ -56,8 +57,8 @@ export class PdfDownload {
|
|
56
57
|
* @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
|
57
58
|
* @returns Promise resolving when function is done
|
58
59
|
*/
|
59
|
-
async downloadCSV(ids, removeDuplicates) {
|
60
|
-
return this._downloadCSV(ids, removeDuplicates);
|
60
|
+
async downloadCSV(ids, removeDuplicates, addColumnTitle) {
|
61
|
+
return this._downloadCSV(ids, removeDuplicates, addColumnTitle);
|
61
62
|
}
|
62
63
|
//--------------------------------------------------------------------------
|
63
64
|
//
|
@@ -100,9 +101,13 @@ export class PdfDownload {
|
|
100
101
|
const _b = parseInt(b.descriptionPDF.labelsPerPageDisplay, 10);
|
101
102
|
return _a < _b ? -1 : _a > _b ? 1 : 0;
|
102
103
|
});
|
103
|
-
return sortedPdfIndo.
|
104
|
-
|
105
|
-
|
104
|
+
return sortedPdfIndo.reduce((prev, cur) => {
|
105
|
+
if (this.enabledSizeValues.length === 0 ||
|
106
|
+
this.enabledSizeValues.indexOf(parseInt(cur.descriptionPDF.labelsPerPageDisplay, 10)) > -1) {
|
107
|
+
prev.push((h("calcite-option", { value: cur }, this._getLabelSizeText(cur))));
|
108
|
+
}
|
109
|
+
return prev;
|
110
|
+
}, []);
|
106
111
|
}
|
107
112
|
/**
|
108
113
|
* Downloads pdf of mailing labels for the provided list of ids
|
@@ -127,10 +132,10 @@ export class PdfDownload {
|
|
127
132
|
* @returns Promise that will resolve when the download is complete
|
128
133
|
* @protected
|
129
134
|
*/
|
130
|
-
async _downloadCSV(ids, removeDuplicates) {
|
135
|
+
async _downloadCSV(ids, removeDuplicates, addColumnTitle) {
|
131
136
|
// TODO this will be leveraged when we do the real implementation of this
|
132
137
|
console.log(removeDuplicates);
|
133
|
-
await exportCSV(this.layerView, ids);
|
138
|
+
await exportCSV(this.layerView, ids, addColumnTitle);
|
134
139
|
}
|
135
140
|
/**
|
136
141
|
* Gets the formatted pdf export size text
|
@@ -186,6 +191,22 @@ export class PdfDownload {
|
|
186
191
|
"reflect": false,
|
187
192
|
"defaultValue": "true"
|
188
193
|
},
|
194
|
+
"enabledSizeValues": {
|
195
|
+
"type": "unknown",
|
196
|
+
"mutable": false,
|
197
|
+
"complexType": {
|
198
|
+
"original": "number[]",
|
199
|
+
"resolved": "number[]",
|
200
|
+
"references": {}
|
201
|
+
},
|
202
|
+
"required": false,
|
203
|
+
"optional": false,
|
204
|
+
"docs": {
|
205
|
+
"tags": [],
|
206
|
+
"text": "string[]: Optional list of enabled size values for PDF export\r\n If empty all sizes will be enabled"
|
207
|
+
},
|
208
|
+
"defaultValue": "[]"
|
209
|
+
},
|
189
210
|
"layerView": {
|
190
211
|
"type": "unknown",
|
191
212
|
"mutable": false,
|
@@ -253,7 +274,7 @@ export class PdfDownload {
|
|
253
274
|
},
|
254
275
|
"downloadCSV": {
|
255
276
|
"complexType": {
|
256
|
-
"signature": "(ids: number[], removeDuplicates: boolean) => Promise<void>",
|
277
|
+
"signature": "(ids: number[], removeDuplicates: boolean, addColumnTitle: boolean) => Promise<void>",
|
257
278
|
"parameters": [{
|
258
279
|
"tags": [{
|
259
280
|
"name": "param",
|
@@ -266,6 +287,9 @@ export class PdfDownload {
|
|
266
287
|
"text": "removeDuplicates When true a single label is generated when multiple featues have a shared address value"
|
267
288
|
}],
|
268
289
|
"text": "When true a single label is generated when multiple featues have a shared address value"
|
290
|
+
}, {
|
291
|
+
"tags": [],
|
292
|
+
"text": ""
|
269
293
|
}],
|
270
294
|
"references": {
|
271
295
|
"Promise": {
|