@esri/solutions-components 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/buffer-tools_4.cjs.entry.js +1 -1
- package/dist/cjs/calcite-combobox_6.cjs.entry.js +74 -52
- package/dist/cjs/calcite-input-text_4.cjs.entry.js +9 -9
- package/dist/cjs/card-manager_3.cjs.entry.js +36 -29
- package/dist/cjs/crowdsource-manager.cjs.entry.js +2 -2
- package/dist/cjs/{downloadUtils-6d4e269f.js → downloadUtils-4aadf4b0.js} +4 -3
- package/dist/cjs/edit-card_2.cjs.entry.js +11 -6
- package/dist/cjs/{index.es-fc923796.js → index.es-17db3b89.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{mapViewUtils-efc49df7.js → mapViewUtils-77a1ff88.js} +48 -6
- package/dist/cjs/public-notification.cjs.entry.js +3 -3
- package/dist/cjs/{publicNotificationStore-cd1a32c3.js → publicNotificationStore-ec1bdd2d.js} +5 -1
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/components/card-manager/card-manager.js +8 -8
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.css +2 -2
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +1 -1
- package/dist/collection/components/edit-card/edit-card.css +1 -1
- package/dist/collection/components/edit-card/edit-card.js +7 -1
- package/dist/collection/components/info-card/info-card.js +4 -5
- package/dist/collection/components/layer-table/layer-table.js +34 -27
- package/dist/collection/components/map-layer-picker/map-layer-picker.js +110 -54
- package/dist/collection/components/map-select-tools/map-select-tools.js +5 -5
- package/dist/collection/components/refine-selection/refine-selection.js +3 -3
- package/dist/collection/demos/crowdsource-manager.html +31 -16
- package/dist/collection/utils/downloadUtils.js +2 -1
- package/dist/collection/utils/downloadUtils.ts +1 -1
- package/dist/collection/utils/interfaces.ts +6 -5
- package/dist/collection/utils/mapViewUtils.js +44 -5
- package/dist/collection/utils/mapViewUtils.ts +52 -7
- package/dist/collection/utils/publicNotificationStore.js +5 -1
- package/dist/collection/utils/publicNotificationStore.ts +5 -1
- package/dist/components/card-manager2.js +5 -5
- package/dist/components/crowdsource-manager.js +2 -2
- package/dist/components/downloadUtils.js +2 -1
- package/dist/components/edit-card2.js +7 -1
- package/dist/components/info-card2.js +4 -5
- package/dist/components/layer-table2.js +33 -26
- package/dist/components/map-layer-picker2.js +78 -54
- package/dist/components/map-select-tools2.js +5 -5
- package/dist/components/mapViewUtils.js +45 -6
- package/dist/components/publicNotificationStore.js +5 -1
- package/dist/components/refine-selection2.js +3 -3
- package/dist/esm/buffer-tools_4.entry.js +1 -1
- package/dist/esm/calcite-combobox_6.entry.js +74 -52
- package/dist/esm/calcite-input-text_4.entry.js +9 -9
- package/dist/esm/card-manager_3.entry.js +36 -29
- package/dist/esm/crowdsource-manager.entry.js +2 -2
- package/dist/esm/{downloadUtils-1092cb0f.js → downloadUtils-3b5f85d9.js} +4 -3
- package/dist/esm/edit-card_2.entry.js +11 -6
- package/dist/esm/{index.es-08a48fdd.js → index.es-bb9196f6.js} +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{mapViewUtils-a787c6a8.js → mapViewUtils-55ea1e10.js} +45 -6
- package/dist/esm/public-notification.entry.js +3 -3
- package/dist/esm/{publicNotificationStore-c36d95bf.js → publicNotificationStore-6ef555f3.js} +5 -1
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/demos/crowdsource-manager.html +31 -16
- package/dist/solutions-components/{p-841a5f97.entry.js → p-03179924.entry.js} +1 -1
- package/dist/solutions-components/{p-a29ba58a.js → p-477ae127.js} +2 -2
- package/dist/solutions-components/p-4af3f843.js +36 -0
- package/dist/solutions-components/{p-5b260e5f.js → p-6015e2ee.js} +1 -1
- package/dist/solutions-components/{p-ad60a547.js → p-9807924d.js} +3 -3
- package/dist/solutions-components/{p-781480c2.entry.js → p-a56f965e.entry.js} +1 -1
- package/dist/solutions-components/{p-5a6ca63b.entry.js → p-cdc0bb97.entry.js} +6 -6
- package/dist/solutions-components/{p-6305f474.entry.js → p-d3fd28e9.entry.js} +1 -1
- package/dist/solutions-components/p-d83da8a0.entry.js +11 -0
- package/dist/solutions-components/p-d875f38c.entry.js +6 -0
- package/dist/solutions-components/p-ef235c88.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/downloadUtils.ts +1 -1
- package/dist/solutions-components/utils/interfaces.ts +6 -5
- package/dist/solutions-components/utils/mapViewUtils.ts +52 -7
- package/dist/solutions-components/utils/publicNotificationStore.ts +5 -1
- package/dist/types/components/card-manager/card-manager.d.ts +2 -2
- package/dist/types/components/edit-card/edit-card.d.ts +6 -2
- package/dist/types/components/layer-table/layer-table.d.ts +4 -4
- package/dist/types/components/map-layer-picker/map-layer-picker.d.ts +34 -19
- package/dist/types/components.d.ts +22 -6
- package/dist/types/utils/interfaces.d.ts +4 -3
- package/dist/types/utils/mapViewUtils.d.ts +22 -5
- package/dist/types/utils/publicNotificationStore.d.ts +2 -0
- package/package.json +1 -1
- package/dist/solutions-components/p-0641aa9b.js +0 -36
- package/dist/solutions-components/p-74a2d025.entry.js +0 -6
- package/dist/solutions-components/p-a62c1b3c.entry.js +0 -6
- package/dist/solutions-components/p-ccf5c0ff.entry.js +0 -11
@@ -21,7 +21,7 @@
|
|
21
21
|
import { Host, h } from "@stencil/core";
|
22
22
|
import { loadModules } from "../../utils/loadModules";
|
23
23
|
import { getLocaleComponentStrings } from "../../utils/locale";
|
24
|
-
import {
|
24
|
+
import { getLayer, getMapLayerIds } from "../../utils/mapViewUtils";
|
25
25
|
import { queryFeaturesByID, queryAllIds } from "../../utils/queryUtils";
|
26
26
|
import * as downloadUtils from "../../utils/downloadUtils";
|
27
27
|
export class LayerTable {
|
@@ -43,7 +43,7 @@ export class LayerTable {
|
|
43
43
|
this.mapView = undefined;
|
44
44
|
this._alertOpen = false;
|
45
45
|
this._fetchingData = false;
|
46
|
-
this.
|
46
|
+
this._layer = undefined;
|
47
47
|
this._selectedIndexes = [];
|
48
48
|
this._showOnlySelected = false;
|
49
49
|
this._translations = undefined;
|
@@ -59,7 +59,7 @@ export class LayerTable {
|
|
59
59
|
async mapViewWatchHandler() {
|
60
60
|
this._fetchingData = true;
|
61
61
|
const mapLayerIds = await getMapLayerIds(this.mapView);
|
62
|
-
this.
|
62
|
+
this._layer = await getLayer(this.mapView, mapLayerIds[0]);
|
63
63
|
this._resetTable();
|
64
64
|
this.reactiveUtils.on(() => this.mapView, "click", (event) => {
|
65
65
|
void this._mapClicked(event);
|
@@ -69,7 +69,7 @@ export class LayerTable {
|
|
69
69
|
/**
|
70
70
|
* watch for changes in layer view and verify if it has editing enabled
|
71
71
|
*/
|
72
|
-
async
|
72
|
+
async _layerWatchHandler() {
|
73
73
|
this._fetchingData = true;
|
74
74
|
this._resetTable();
|
75
75
|
this._fetchingData = false;
|
@@ -106,7 +106,7 @@ export class LayerTable {
|
|
106
106
|
* Renders the component.
|
107
107
|
*/
|
108
108
|
render() {
|
109
|
-
if (!this.
|
109
|
+
if (!this._layer) {
|
110
110
|
return null;
|
111
111
|
}
|
112
112
|
const tableNodeClass = this._fetchingData ? "display-none" : "";
|
@@ -141,8 +141,8 @@ export class LayerTable {
|
|
141
141
|
*/
|
142
142
|
_getTableControlRow(slot) {
|
143
143
|
const featuresSelected = this._selectedIndexes.length > 0;
|
144
|
-
return (h("div", { class: "display-flex table-border height-51", slot: slot }, h("calcite-action-bar", { expandDisabled: true, expanded: true, layout: "horizontal" }, h("div", { class: "border-end" }, h("map-layer-picker", { appearance: "transparent", mapView: this.mapView, onLayerSelectionChange: (evt) => this._layerSelectionChanged(evt), placeholderIcon: "layers", scale: "l", type: "dropdown" })), h("calcite-action", { appearance: "solid", disabled: !featuresSelected, icon: "magnifying-glass", id: "magnifying-glass", label: this._translations.zoom, onClick: () => this._zoom(), text: this._translations.zoom, textEnabled: true }), h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": "magnifying-glass" }, h("span", null, this._translations.zoom)), h("calcite-action", { appearance: "solid", icon: "filter", id: "filter", onClick: () => this._filter(), text: this._translations.filters, "text-enabled": "true", textEnabled: true }), h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": "filter" }, h("span", null, this._translations.filters)), h("calcite-action", { appearance: "solid", disabled: !featuresSelected, id: "trash", onClick: () => this._delete(), text: "" }, h("calcite-button", { appearance: "transparent", iconStart: "trash", kind: "danger" }, this._translations.delete)), h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": "trash" }, h("span", null, this._translations.delete))), h("calcite-dropdown", null, h("calcite-action", { appearance: "solid", label: "", slot: "trigger", text: "" }, h("calcite-button", { appearance: "transparent", iconEnd: "chevron-down", kind: "neutral" }, this._translations.more)), h("calcite-dropdown-group", { "selection-mode": "none" }, h("calcite-dropdown-item", { iconStart: "list-check-all", onClick: () => this._selectAll() }, this._translations.selectAll), h("calcite-dropdown-item", { iconStart: "selected-items-filter", onClick: () => this.
|
145
|
-
this._translations.showSelected), h("calcite-dropdown-item", { iconStart: "
|
144
|
+
return (h("div", { class: "display-flex table-border height-51", slot: slot }, h("calcite-action-bar", { expandDisabled: true, expanded: true, layout: "horizontal" }, h("div", { class: "border-end" }, h("map-layer-picker", { appearance: "transparent", mapView: this.mapView, onLayerSelectionChange: (evt) => this._layerSelectionChanged(evt), placeholderIcon: "layers", scale: "l", type: "dropdown" })), h("calcite-action", { appearance: "solid", disabled: !featuresSelected, icon: "magnifying-glass", id: "magnifying-glass", label: this._translations.zoom, onClick: () => this._zoom(), text: this._translations.zoom, textEnabled: true }), h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": "magnifying-glass" }, h("span", null, this._translations.zoom)), h("calcite-action", { appearance: "solid", icon: "filter", id: "filter", onClick: () => this._filter(), text: this._translations.filters, "text-enabled": "true", textEnabled: true }), h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": "filter" }, h("span", null, this._translations.filters)), h("calcite-action", { appearance: "solid", disabled: !featuresSelected, id: "trash", onClick: () => this._delete(), text: "" }, h("calcite-button", { appearance: "transparent", iconStart: "trash", kind: "danger" }, this._translations.delete)), h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": "trash" }, h("span", null, this._translations.delete)), h("calcite-action", { appearance: "solid", disabled: !featuresSelected, icon: "erase", id: "erase", onClick: () => this._clearSelection(), text: this._translations.clearSelection, "text-enabled": "true", textEnabled: true }), h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": "erase" }, h("span", null, this._translations.clearSelection))), h("calcite-dropdown", null, h("calcite-action", { appearance: "solid", label: "", slot: "trigger", text: "" }, h("calcite-button", { appearance: "transparent", iconEnd: "chevron-down", kind: "neutral" }, this._translations.more)), h("calcite-dropdown-group", { "selection-mode": "none" }, h("calcite-dropdown-item", { iconStart: "list-check-all", onClick: () => this._selectAll() }, this._translations.selectAll), h("calcite-dropdown-item", { iconStart: "selected-items-filter", onClick: () => this._toggleShowSelected() }, this._showOnlySelected ? this._translations.showAll :
|
145
|
+
this._translations.showSelected), h("calcite-dropdown-item", { iconStart: "refresh", onClick: () => this._switchSelected() }, this._translations.switchSelected), h("calcite-dropdown-item", { iconStart: "refresh", onClick: () => this._refresh() }, this._translations.refresh), h("calcite-dropdown-item", { iconStart: "export", onClick: () => void this._exportToCSV() }, this._translations.exportCSV)))));
|
146
146
|
}
|
147
147
|
/**
|
148
148
|
* Initialize the FeatureTable
|
@@ -150,10 +150,9 @@ export class LayerTable {
|
|
150
150
|
* @returns void
|
151
151
|
*/
|
152
152
|
_getTable(node) {
|
153
|
-
|
154
|
-
if ((_a = this._layerView) === null || _a === void 0 ? void 0 : _a.layer) {
|
153
|
+
if (this._layer) {
|
155
154
|
this._table = new this.FeatureTable({
|
156
|
-
layer: this.
|
155
|
+
layer: this._layer,
|
157
156
|
view: this.mapView,
|
158
157
|
//editingEnabled: this._editEnabled,
|
159
158
|
highlightOnRowSelectEnabled: true,
|
@@ -166,6 +165,14 @@ export class LayerTable {
|
|
166
165
|
});
|
167
166
|
this._table.highlightIds.on("change", () => {
|
168
167
|
this._selectedIndexes = this._table.highlightIds.toArray();
|
168
|
+
if (this._showOnlySelected) {
|
169
|
+
if (this._selectedIndexes.length > 0) {
|
170
|
+
this._table.filterBySelection();
|
171
|
+
}
|
172
|
+
else {
|
173
|
+
this._toggleShowSelected();
|
174
|
+
}
|
175
|
+
}
|
169
176
|
this.featureSelectionChange.emit(this._selectedIndexes);
|
170
177
|
});
|
171
178
|
}
|
@@ -176,10 +183,11 @@ export class LayerTable {
|
|
176
183
|
* @returns void
|
177
184
|
*/
|
178
185
|
_resetTable() {
|
179
|
-
|
180
|
-
|
181
|
-
this.
|
182
|
-
this.
|
186
|
+
if (this._layer && this._table) {
|
187
|
+
this._clearSelection();
|
188
|
+
this.featureSelectionChange.emit(this._selectedIndexes);
|
189
|
+
this._table.layer = this._layer;
|
190
|
+
this._editEnabled = this._layer.editingEnabled;
|
183
191
|
this._table.view = this.mapView;
|
184
192
|
this._table.editingEnabled = this._editEnabled;
|
185
193
|
this._table.clearSelectionFilter();
|
@@ -193,7 +201,7 @@ export class LayerTable {
|
|
193
201
|
*/
|
194
202
|
async _mapClicked(evt) {
|
195
203
|
const opts = {
|
196
|
-
include: this.
|
204
|
+
include: this._layer
|
197
205
|
};
|
198
206
|
const hitTestResult = await this.mapView.hitTest(evt.screenPoint, opts);
|
199
207
|
if (hitTestResult.results.length > 0) {
|
@@ -238,7 +246,7 @@ export class LayerTable {
|
|
238
246
|
*
|
239
247
|
* @returns void
|
240
248
|
*/
|
241
|
-
|
249
|
+
_toggleShowSelected() {
|
242
250
|
this._showOnlySelected = !this._showOnlySelected;
|
243
251
|
if (this._showOnlySelected) {
|
244
252
|
this._table.filterBySelection();
|
@@ -283,10 +291,10 @@ export class LayerTable {
|
|
283
291
|
async _exportToCSV() {
|
284
292
|
const exportInfos = {};
|
285
293
|
const ids = this._table.highlightIds.toArray();
|
286
|
-
exportInfos[this.
|
294
|
+
exportInfos[this._layer.id] = {
|
287
295
|
selectionSetNames: [],
|
288
296
|
ids,
|
289
|
-
|
297
|
+
layer: this._layer
|
290
298
|
};
|
291
299
|
void downloadUtils.downloadCSV(exportInfos, false, // formatUsingLayerPopup
|
292
300
|
true);
|
@@ -321,7 +329,7 @@ export class LayerTable {
|
|
321
329
|
this._alertMessage = this._translations.confirm;
|
322
330
|
this._alertKind = "danger";
|
323
331
|
this._alertActionFunction = () => {
|
324
|
-
void this.
|
332
|
+
void this._layer.applyEdits({
|
325
333
|
deleteFeatures: this._table.highlightIds.toArray()
|
326
334
|
});
|
327
335
|
this._alertOpen = false;
|
@@ -352,15 +360,14 @@ export class LayerTable {
|
|
352
360
|
* @returns a promise that will resolve when the operation is complete
|
353
361
|
*/
|
354
362
|
async _layerSelectionChanged(evt) {
|
355
|
-
var _a;
|
356
363
|
const id = evt.detail[0];
|
357
|
-
if (id !==
|
364
|
+
if (id !== this._layer.id || this._allIds.length === 0) {
|
358
365
|
this._fetchingData = true;
|
359
366
|
this._table.highlightIds.removeAll();
|
360
|
-
this.
|
361
|
-
this._allIds = await queryAllIds(this.
|
367
|
+
this._layer = await getLayer(this.mapView, id);
|
368
|
+
this._allIds = await queryAllIds(this._layer);
|
362
369
|
this._selectedIndexes = [];
|
363
|
-
this._table.layer = this.
|
370
|
+
this._table.layer = this._layer;
|
364
371
|
this._table.render();
|
365
372
|
this._fetchingData = false;
|
366
373
|
}
|
@@ -413,7 +420,7 @@ export class LayerTable {
|
|
413
420
|
return {
|
414
421
|
"_alertOpen": {},
|
415
422
|
"_fetchingData": {},
|
416
|
-
"
|
423
|
+
"_layer": {},
|
417
424
|
"_selectedIndexes": {},
|
418
425
|
"_showOnlySelected": {},
|
419
426
|
"_translations": {}
|
@@ -469,8 +476,8 @@ export class LayerTable {
|
|
469
476
|
"propName": "mapView",
|
470
477
|
"methodName": "mapViewWatchHandler"
|
471
478
|
}, {
|
472
|
-
"propName": "
|
473
|
-
"methodName": "
|
479
|
+
"propName": "_layer",
|
480
|
+
"methodName": "_layerWatchHandler"
|
474
481
|
}];
|
475
482
|
}
|
476
483
|
}
|
@@ -19,19 +19,21 @@
|
|
19
19
|
* limitations under the License.
|
20
20
|
*/
|
21
21
|
import { Host, h } from "@stencil/core";
|
22
|
-
import { getMapLayerHash, getMapLayerIds } from "../../utils/mapViewUtils";
|
22
|
+
import { getMapLayerHash, getMapLayerIds, getMapTableHash, getMapTableIds } from "../../utils/mapViewUtils";
|
23
23
|
import state from "../../utils/publicNotificationStore";
|
24
24
|
export class MapLayerPicker {
|
25
25
|
constructor() {
|
26
26
|
this.appearance = "transparent";
|
27
27
|
this.enabledLayerIds = [];
|
28
|
+
this.enabledTableIds = [];
|
28
29
|
this.mapView = undefined;
|
29
30
|
this.placeholderIcon = "";
|
30
|
-
this.
|
31
|
+
this.selectedIds = [];
|
31
32
|
this.scale = "m";
|
33
|
+
this.showTables = true;
|
32
34
|
this.type = "select";
|
33
|
-
this.
|
34
|
-
this.
|
35
|
+
this.ids = [];
|
36
|
+
this.selectedName = "";
|
35
37
|
}
|
36
38
|
//--------------------------------------------------------------------------
|
37
39
|
//
|
@@ -44,7 +46,11 @@ export class MapLayerPicker {
|
|
44
46
|
*/
|
45
47
|
async mapViewWatchHandler() {
|
46
48
|
await this._setLayers();
|
47
|
-
|
49
|
+
const hasLayers = Object.keys(state.layerNameHash).length > 0;
|
50
|
+
const hasTables = Object.keys(state.tableNameHash).length > 0 && this.showTables;
|
51
|
+
if (hasLayers || hasTables) {
|
52
|
+
this._setSelectedLayer(this.ids[0], hasLayers ? "layer" : "table");
|
53
|
+
}
|
48
54
|
}
|
49
55
|
//--------------------------------------------------------------------------
|
50
56
|
//
|
@@ -56,8 +62,8 @@ export class MapLayerPicker {
|
|
56
62
|
*/
|
57
63
|
async componentWillLoad() {
|
58
64
|
await this._setLayers();
|
59
|
-
if (this.
|
60
|
-
this.layerSelectionChange.emit(this.
|
65
|
+
if (this.ids.length > 0 || this.selectedIds.length === 1) {
|
66
|
+
this.layerSelectionChange.emit(this.selectedIds.length === 1 ? [this.selectedIds[0]] : [this.ids[0]]);
|
61
67
|
}
|
62
68
|
}
|
63
69
|
/**
|
@@ -71,13 +77,15 @@ export class MapLayerPicker {
|
|
71
77
|
* StencilJS: Called once just after the component is fully loaded and the first render() occurs.
|
72
78
|
*/
|
73
79
|
async componentDidLoad() {
|
74
|
-
if (this.
|
75
|
-
const id = this.
|
80
|
+
if (this.ids.length > 0 || this.selectedIds.length === 1) {
|
81
|
+
const id = this.selectedIds.length === 1 ? this.selectedIds[0] : this.ids[0];
|
76
82
|
if (this.type === "select") {
|
77
83
|
this._layerElement.value = id;
|
78
84
|
}
|
79
85
|
else if (this.type === "dropdown") {
|
80
|
-
this.
|
86
|
+
this.selectedName = Object.keys(state.layerNameHash).indexOf(id) > -1 ?
|
87
|
+
state.layerNameHash[id] : Object.keys(state.tableNameHash).indexOf(id) > -1 ?
|
88
|
+
state.tableNameHash[id] : "";
|
81
89
|
}
|
82
90
|
}
|
83
91
|
}
|
@@ -94,7 +102,7 @@ export class MapLayerPicker {
|
|
94
102
|
* @returns Calcite Select component with the ids of the layers from the map
|
95
103
|
*/
|
96
104
|
_getSelect() {
|
97
|
-
return (h("calcite-select", { label: "", onCalciteSelectChange: () => this._layerSelectionChange(), ref: (el) => { this._layerElement = el; }, scale: this.scale }, this.
|
105
|
+
return (h("calcite-select", { label: "", onCalciteSelectChange: () => this._layerSelectionChange(), ref: (el) => { this._layerElement = el; }, scale: this.scale }, this._getMapLayerOptions()));
|
98
106
|
}
|
99
107
|
/**
|
100
108
|
* Create a list of layer ids from the map
|
@@ -104,7 +112,7 @@ export class MapLayerPicker {
|
|
104
112
|
* @returns Calcite ComboBox component with the ids of the layers from the map
|
105
113
|
*/
|
106
114
|
_getCombobox() {
|
107
|
-
return (h("calcite-combobox", { clearDisabled: true, label: "", onCalciteComboboxChange: () => this._layerSelectionChange(), "placeholder-icon": this.placeholderIcon, ref: (el) => { this._layerElement = el; }, scale: this.scale, "selection-mode": "single" }, this.
|
115
|
+
return (h("calcite-combobox", { clearDisabled: true, label: "", onCalciteComboboxChange: () => this._layerSelectionChange(), "placeholder-icon": this.placeholderIcon, ref: (el) => { this._layerElement = el; }, scale: this.scale, "selection-mode": "single" }, this._getMapLayerOptions()));
|
108
116
|
}
|
109
117
|
/**
|
110
118
|
* Hydrate a dropdown component with items to display the layer names
|
@@ -112,54 +120,42 @@ export class MapLayerPicker {
|
|
112
120
|
* @returns Array of Dropdown items with layer names
|
113
121
|
*/
|
114
122
|
_getDropdown() {
|
115
|
-
return (h("calcite-dropdown", { class: "layer-picker-dropdown" }, h("calcite-action", { slot: "trigger", text: "" }, h("calcite-button", { alignment: "icon-end-space-between", appearance: this.appearance, class: "max-width-350", iconEnd: "chevron-down", iconStart: "layers", kind: "neutral", width: "full" }, h("div", null, this.
|
123
|
+
return (h("calcite-dropdown", { class: "layer-picker-dropdown" }, h("calcite-action", { slot: "trigger", text: "" }, h("calcite-button", { alignment: "icon-end-space-between", appearance: this.appearance, class: "max-width-350", iconEnd: "chevron-down", iconStart: "layers", kind: "neutral", width: "full" }, h("div", null, this.selectedName))), h("calcite-dropdown-group", { "selection-mode": "single" }, this._getMapLayerOptions())));
|
116
124
|
}
|
117
125
|
/**
|
118
|
-
*
|
126
|
+
* Get the appropriate type of dom nodes for each valid layer or table
|
119
127
|
*
|
120
|
-
* @returns Array of
|
128
|
+
* @returns Array of dom nodes with the names of the layers and optionally of the tables
|
121
129
|
*/
|
122
|
-
|
123
|
-
return this.
|
124
|
-
if (
|
125
|
-
prev.push(
|
130
|
+
_getMapLayerOptions() {
|
131
|
+
return this.ids.reduce((prev, cur) => {
|
132
|
+
if (this._validLayer(cur)) {
|
133
|
+
prev.push(this._getItem(cur, "layer"));
|
134
|
+
}
|
135
|
+
else if (this._validTable(cur)) {
|
136
|
+
prev.push(this._getItem(cur, "table"));
|
126
137
|
}
|
127
138
|
return prev;
|
128
139
|
}, []);
|
129
140
|
}
|
130
141
|
/**
|
131
|
-
*
|
132
|
-
*/
|
133
|
-
_setSelectedLayer(id) {
|
134
|
-
this.selectedLayerName = state.layerNameHash[id];
|
135
|
-
this.selectedLayerIds = [id];
|
136
|
-
this.layerSelectionChange.emit(this.selectedLayerIds);
|
137
|
-
}
|
138
|
-
/**
|
139
|
-
* Hydrate a select component with the ids of the layers in the map
|
142
|
+
* Get the appropriate type of dom node for the current layer or table id
|
140
143
|
*
|
141
|
-
* @returns
|
144
|
+
* @returns A dom node with the name of the layer or table
|
142
145
|
*/
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
return prev;
|
149
|
-
}, []);
|
146
|
+
_getItem(id, itemType) {
|
147
|
+
const name = itemType === "layer" ? state.layerNameHash[id] : state.tableNameHash[id];
|
148
|
+
return this.type === "combobox" ? (h("calcite-combobox-item", { textLabel: name, value: id })) :
|
149
|
+
this.type === "select" ? (h("calcite-option", { label: name, value: id })) :
|
150
|
+
(h("calcite-dropdown-item", { onClick: () => void this._setSelectedLayer(id, itemType) }, name));
|
150
151
|
}
|
151
152
|
/**
|
152
|
-
*
|
153
|
-
*
|
154
|
-
* @returns Array of ComboBox items for the ids of the layers
|
153
|
+
* Store the layer name based on the user selection
|
155
154
|
*/
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
}
|
161
|
-
return prev;
|
162
|
-
}, []);
|
155
|
+
_setSelectedLayer(id, type) {
|
156
|
+
this.selectedName = type === "layer" ? state.layerNameHash[id] : state.tableNameHash[id];
|
157
|
+
this.selectedIds = [id];
|
158
|
+
this.layerSelectionChange.emit(this.selectedIds);
|
163
159
|
}
|
164
160
|
/**
|
165
161
|
* Fetch the ids of the layers from the map
|
@@ -169,8 +165,12 @@ export class MapLayerPicker {
|
|
169
165
|
async _setLayers() {
|
170
166
|
if (this.mapView) {
|
171
167
|
const mapLayerIds = await getMapLayerIds(this.mapView);
|
172
|
-
|
173
|
-
|
168
|
+
const mapTableIds = this.showTables ? await getMapTableIds(this.mapView) : [];
|
169
|
+
this.ids = [
|
170
|
+
...mapLayerIds.filter(n => { var _a; return ((_a = this.enabledLayerIds) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.enabledLayerIds.indexOf(n) > -1 : true; }),
|
171
|
+
...mapTableIds.filter(n => { var _a; return ((_a = this.enabledTableIds) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.enabledTableIds.indexOf(n) > -1 : true; }),
|
172
|
+
];
|
173
|
+
await this._initStateHash();
|
174
174
|
}
|
175
175
|
}
|
176
176
|
/**
|
@@ -178,11 +178,33 @@ export class MapLayerPicker {
|
|
178
178
|
*
|
179
179
|
* @returns Promise when the operation has completed
|
180
180
|
*/
|
181
|
-
async
|
181
|
+
async _initStateHash() {
|
182
182
|
if (this.mapView) {
|
183
183
|
state.layerNameHash = await getMapLayerHash(this.mapView);
|
184
|
+
state.tableNameHash = this.showTables ? await getMapTableHash(this.mapView) : {};
|
184
185
|
}
|
185
186
|
}
|
187
|
+
/**
|
188
|
+
* Evaluate if the id exists in the current hash and verify if it should be excluded
|
189
|
+
*
|
190
|
+
* @returns boolean when true the layer will be used in the current layer picker type
|
191
|
+
*/
|
192
|
+
_validLayer(id) {
|
193
|
+
const name = state.layerNameHash[id];
|
194
|
+
return name && state.managedLayers.indexOf(name) < 0 && (this.enabledLayerIds.length > 0 ?
|
195
|
+
this.enabledLayerIds.indexOf(id) > -1 : name);
|
196
|
+
}
|
197
|
+
/**
|
198
|
+
* Evaluate if the id exists in the current hash and verify if it should be excluded
|
199
|
+
*
|
200
|
+
* @returns boolean when true the table will be used in the current layer picker type
|
201
|
+
*/
|
202
|
+
_validTable(id) {
|
203
|
+
const name = state.tableNameHash[id];
|
204
|
+
const validName = name && this.showTables;
|
205
|
+
return validName ? state.managedTables.indexOf(name) < 0 &&
|
206
|
+
(this.enabledTableIds.length > 0 ? this.enabledTableIds.indexOf(id) > -1 : true) : validName;
|
207
|
+
}
|
186
208
|
/**
|
187
209
|
* Fetch the ids of the layers from the map
|
188
210
|
*
|
@@ -191,8 +213,8 @@ export class MapLayerPicker {
|
|
191
213
|
_layerSelectionChange() {
|
192
214
|
const ids = Array.isArray(this._layerElement.value) ? this._layerElement.value : [this._layerElement.value];
|
193
215
|
if (JSON.stringify(ids) !== JSON.stringify([""])) {
|
194
|
-
this.
|
195
|
-
this.layerSelectionChange.emit(this.
|
216
|
+
this.selectedIds = ids;
|
217
|
+
this.layerSelectionChange.emit(this.selectedIds);
|
196
218
|
}
|
197
219
|
}
|
198
220
|
static get is() { return "map-layer-picker"; }
|
@@ -242,6 +264,22 @@ export class MapLayerPicker {
|
|
242
264
|
},
|
243
265
|
"defaultValue": "[]"
|
244
266
|
},
|
267
|
+
"enabledTableIds": {
|
268
|
+
"type": "unknown",
|
269
|
+
"mutable": false,
|
270
|
+
"complexType": {
|
271
|
+
"original": "string[]",
|
272
|
+
"resolved": "string[]",
|
273
|
+
"references": {}
|
274
|
+
},
|
275
|
+
"required": false,
|
276
|
+
"optional": false,
|
277
|
+
"docs": {
|
278
|
+
"tags": [],
|
279
|
+
"text": "string[]: Optional list of enabled table ids\r\n If empty all tables will be available"
|
280
|
+
},
|
281
|
+
"defaultValue": "[]"
|
282
|
+
},
|
245
283
|
"mapView": {
|
246
284
|
"type": "unknown",
|
247
285
|
"mutable": false,
|
@@ -279,7 +317,7 @@ export class MapLayerPicker {
|
|
279
317
|
"reflect": false,
|
280
318
|
"defaultValue": "\"\""
|
281
319
|
},
|
282
|
-
"
|
320
|
+
"selectedIds": {
|
283
321
|
"type": "unknown",
|
284
322
|
"mutable": true,
|
285
323
|
"complexType": {
|
@@ -313,6 +351,24 @@ export class MapLayerPicker {
|
|
313
351
|
"reflect": false,
|
314
352
|
"defaultValue": "\"m\""
|
315
353
|
},
|
354
|
+
"showTables": {
|
355
|
+
"type": "boolean",
|
356
|
+
"mutable": false,
|
357
|
+
"complexType": {
|
358
|
+
"original": "boolean",
|
359
|
+
"resolved": "boolean",
|
360
|
+
"references": {}
|
361
|
+
},
|
362
|
+
"required": false,
|
363
|
+
"optional": false,
|
364
|
+
"docs": {
|
365
|
+
"tags": [],
|
366
|
+
"text": "boolean: when true standalone tables will also be available"
|
367
|
+
},
|
368
|
+
"attribute": "show-tables",
|
369
|
+
"reflect": false,
|
370
|
+
"defaultValue": "true"
|
371
|
+
},
|
316
372
|
"type": {
|
317
373
|
"type": "string",
|
318
374
|
"mutable": false,
|
@@ -335,8 +391,8 @@ export class MapLayerPicker {
|
|
335
391
|
}
|
336
392
|
static get states() {
|
337
393
|
return {
|
338
|
-
"
|
339
|
-
"
|
394
|
+
"ids": {},
|
395
|
+
"selectedName": {}
|
340
396
|
};
|
341
397
|
}
|
342
398
|
static get events() {
|
@@ -20,7 +20,7 @@
|
|
20
20
|
*/
|
21
21
|
import { Host, h } from "@stencil/core";
|
22
22
|
import { loadModules } from "../../utils/loadModules";
|
23
|
-
import { highlightFeatures,
|
23
|
+
import { highlightFeatures, getFeatureLayerView, goToSelection } from "../../utils/mapViewUtils";
|
24
24
|
import { getQueryGeoms, queryFeaturesByGeometry, queryObjectIds } from "../../utils/queryUtils";
|
25
25
|
import { EWorkflowType } from "../../utils/interfaces";
|
26
26
|
import state from "../../utils/publicNotificationStore";
|
@@ -199,7 +199,7 @@ export class MapSelectTools {
|
|
199
199
|
*/
|
200
200
|
_getUseLayerFeaturesOptions() {
|
201
201
|
const useLayerFeaturesClass = this._useLayerFeaturesEnabled ? "div-visible" : "div-not-visible";
|
202
|
-
return (h("div", null, h("div", { class: "padding-top-1 display-flex" }, h("calcite-label", { class: "label-margin-0 w-100", layout: "inline-space-between" }, h("div", { class: "tooltip-container" }, this._translations.useLayerFeatures, h("calcite-icon", { class: "padding-start-1-2 icon", icon: "question", id: "use-layer-features-icon", scale: "s" }))), h("calcite-popover", { closable: true, label: "", referenceElement: "use-layer-features-icon" }, h("span", { class: "tooltip-message" }, this._translations.useLayerFeaturesTooltip)), h("calcite-switch", { checked: this._useLayerFeaturesEnabled, onCalciteSwitchChange: () => { this._useLayerFeaturesEnabledChanged(); } })), h("div", { class: useLayerFeaturesClass + " padding-top-1" }, h("map-layer-picker", { enabledLayerIds: this.selectionLayerIds, mapView: this.mapView, onLayerSelectionChange: (evt) => { void this._layerSelectionChange(evt); },
|
202
|
+
return (h("div", null, h("div", { class: "padding-top-1 display-flex" }, h("calcite-label", { class: "label-margin-0 w-100", layout: "inline-space-between" }, h("div", { class: "tooltip-container" }, this._translations.useLayerFeatures, h("calcite-icon", { class: "padding-start-1-2 icon", icon: "question", id: "use-layer-features-icon", scale: "s" }))), h("calcite-popover", { closable: true, label: "", referenceElement: "use-layer-features-icon" }, h("span", { class: "tooltip-message" }, this._translations.useLayerFeaturesTooltip)), h("calcite-switch", { checked: this._useLayerFeaturesEnabled, onCalciteSwitchChange: () => { this._useLayerFeaturesEnabledChanged(); } })), h("div", { class: useLayerFeaturesClass + " padding-top-1" }, h("map-layer-picker", { enabledLayerIds: this.selectionLayerIds, mapView: this.mapView, onLayerSelectionChange: (evt) => { void this._layerSelectionChange(evt); }, selectedIds: this.layerViews.map(l => l.layer.id) }))));
|
203
203
|
}
|
204
204
|
/**
|
205
205
|
* Renders the number of selected features
|
@@ -228,7 +228,7 @@ export class MapSelectTools {
|
|
228
228
|
* @protected
|
229
229
|
*/
|
230
230
|
_getMapLayerPicker() {
|
231
|
-
return (h("div", { class: "display-flex padding-sides-1 padding-bottom-1" }, h("calcite-label", { class: "font-bold width-full label-margin-0" }, this._translations.inputLayer, h("map-layer-picker", { enabledLayerIds: this.enabledLayerIds, mapView: this.mapView, onLayerSelectionChange: (evt) => this._inputLayerSelectionChange(evt),
|
231
|
+
return (h("div", { class: "display-flex padding-sides-1 padding-bottom-1" }, h("calcite-label", { class: "font-bold width-full label-margin-0" }, this._translations.inputLayer, h("map-layer-picker", { enabledLayerIds: this.enabledLayerIds, mapView: this.mapView, onLayerSelectionChange: (evt) => this._inputLayerSelectionChange(evt), selectedIds: this.selectLayerView ? [this.selectLayerView.layer.id] : this.selectionSet ? [this.selectionSet.layerView.layer.id] : [] }))));
|
232
232
|
}
|
233
233
|
//--------------------------------------------------------------------------
|
234
234
|
//
|
@@ -661,7 +661,7 @@ export class MapSelectTools {
|
|
661
661
|
async _layerSelectionChange(evt) {
|
662
662
|
if (Array.isArray(evt.detail) && evt.detail.length > 0) {
|
663
663
|
const layerPromises = evt.detail.map(id => {
|
664
|
-
return
|
664
|
+
return getFeatureLayerView(this.mapView, id);
|
665
665
|
});
|
666
666
|
return Promise.all(layerPromises).then((layerViews) => {
|
667
667
|
this.layerViews = layerViews;
|
@@ -689,7 +689,7 @@ export class MapSelectTools {
|
|
689
689
|
var _a;
|
690
690
|
const id = ((_a = evt === null || evt === void 0 ? void 0 : evt.detail) === null || _a === void 0 ? void 0 : _a.length) > 0 ? evt.detail[0] : "";
|
691
691
|
if (!this.selectLayerView || id !== this.selectLayerView.layer.id) {
|
692
|
-
this.selectLayerView = await
|
692
|
+
this.selectLayerView = await getFeatureLayerView(this.mapView, id);
|
693
693
|
this._updateLabel();
|
694
694
|
this._bufferGeometry ? await this._selectFeatures([this._bufferGeometry]) :
|
695
695
|
await this._highlightWithOIDsOrGeoms();
|
@@ -20,7 +20,7 @@
|
|
20
20
|
*/
|
21
21
|
import { Host, h } from "@stencil/core";
|
22
22
|
import { EDrawMode, ESelectionMode, EWorkflowType } from "../../utils/interfaces";
|
23
|
-
import { getIdSets,
|
23
|
+
import { getIdSets, getFeatureLayerView, highlightAllFeatures } from "../../utils/mapViewUtils";
|
24
24
|
import { queryFeaturesByGeometry } from "../../utils/queryUtils";
|
25
25
|
import state from "../../utils/publicNotificationStore";
|
26
26
|
import { getLocaleComponentStrings } from "../../utils/locale";
|
@@ -77,7 +77,7 @@ export class RefineSelection {
|
|
77
77
|
render() {
|
78
78
|
var _a, _b;
|
79
79
|
const layerPickerClass = this._enabledLayerIds.length > 1 ? "display-block" : "display-none";
|
80
|
-
return (h(Host, null, h("div", { class: layerPickerClass + " padding-top-sides-1" }, h("div", { class: "display-flex" }, h("calcite-label", { class: "font-bold width-full label-margin-0" }, h("div", { class: "display-flex" }, this._translations.inputLayer, h("calcite-icon", { class: "padding-start-1-2 icon", icon: "question", id: "refine-input-layer", scale: "s" })), h("map-layer-picker", { enabledLayerIds: this._enabledLayerIds, mapView: this.mapView, onLayerSelectionChange: (evt) => { void this._layerSelectionChange(evt); }, ref: (el) => { this._layerPicker = el; },
|
80
|
+
return (h(Host, null, h("div", { class: layerPickerClass + " padding-top-sides-1" }, h("div", { class: "display-flex" }, h("calcite-label", { class: "font-bold width-full label-margin-0" }, h("div", { class: "display-flex" }, this._translations.inputLayer, h("calcite-icon", { class: "padding-start-1-2 icon", icon: "question", id: "refine-input-layer", scale: "s" })), h("map-layer-picker", { enabledLayerIds: this._enabledLayerIds, mapView: this.mapView, onLayerSelectionChange: (evt) => { void this._layerSelectionChange(evt); }, ref: (el) => { this._layerPicker = el; }, selectedIds: [this._refineLayer.layer.id] })), h("calcite-popover", { closable: true, label: "", referenceElement: "refine-input-layer" }, h("span", { class: "tooltip-message" }, this._translations.inputLayerTip)))), h("div", { class: "padding-1" }, h("div", { class: "padding-bottom-1" }, h("calcite-segmented-control", { class: "w-100" }, h("calcite-segmented-control-item", { checked: this._addEnabled, class: "w-50 word-wrap-anywhere", onClick: () => this._setSelectionMode(ESelectionMode.ADD), value: ESelectionMode.ADD }, h("span", { class: "font-weight-500" }, this._translations.add)), h("calcite-segmented-control-item", { checked: !this._addEnabled, class: "w-50 word-wrap-anywhere", onClick: () => this._setSelectionMode(ESelectionMode.REMOVE), value: ESelectionMode.REMOVE }, h("span", { class: "font-weight-500" }, this._translations.remove)))), h("div", null, h("map-draw-tools", { active: true, drawMode: EDrawMode.REFINE, mapView: this.mapView, onDrawRedo: () => this._redo(), onDrawUndo: () => this._undo(), onSketchGraphicsChange: (evt) => this._sketchGraphicsChanged(evt), pointSymbol: this.sketchPointSymbol, polygonSymbol: this.sketchPolygonSymbol, polylineSymbol: this.sketchLineSymbol, redoEnabled: ((_a = this._refineSelectionSet) === null || _a === void 0 ? void 0 : _a.redoStack.length) > 0, ref: (el) => { this._drawTools = el; }, undoEnabled: ((_b = this._refineSelectionSet) === null || _b === void 0 ? void 0 : _b.undoStack.length) > 0 })), h("br", null), (h("calcite-list", { class: "list-border" }, this._getRefineSelectionSetList())))));
|
81
81
|
}
|
82
82
|
//--------------------------------------------------------------------------
|
83
83
|
//
|
@@ -171,7 +171,7 @@ export class RefineSelection {
|
|
171
171
|
refineInfo[id] = {
|
172
172
|
addIds: [],
|
173
173
|
removeIds: [],
|
174
|
-
layerView: await
|
174
|
+
layerView: await getFeatureLayerView(this.mapView, id)
|
175
175
|
};
|
176
176
|
if (selectionSet) {
|
177
177
|
selectionSet.refineInfos = Object.assign(Object.assign({}, selectionSet.refineInfos), refineInfo);
|
@@ -41,23 +41,38 @@
|
|
41
41
|
<script>
|
42
42
|
function addValues() {
|
43
43
|
const demo = document.getElementById("demo");
|
44
|
+
|
45
|
+
let custom = [];
|
46
|
+
var vars = window.location.search.substring(1).split('&');
|
47
|
+
vars.forEach((v) => {
|
48
|
+
let paramName = v.split('=');
|
49
|
+
if (paramName[0] === "id") {
|
50
|
+
custom = [{
|
51
|
+
id:paramName[1],
|
52
|
+
name: "Map from URL"
|
53
|
+
}];
|
54
|
+
}
|
55
|
+
});
|
56
|
+
|
44
57
|
demo.mapInfos = [
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
...custom,
|
59
|
+
...[{
|
60
|
+
id: "863e4f6f2a7840db896cc1b1606d552d",
|
61
|
+
name: "IA map"
|
62
|
+
}, {
|
63
|
+
id: "3715f4899bea4b2a948347c5c2357e58",
|
64
|
+
name: "PN Map"
|
65
|
+
}, {
|
66
|
+
id: "4fa949c89bb04ecb8a9f5ad119448333",
|
67
|
+
name: "CS TIL DATA"
|
68
|
+
}, {
|
69
|
+
id: "f5b01c17a09941eaad63e7b4e6c7d880",
|
70
|
+
name: "Attachments Map"
|
71
|
+
}, {
|
72
|
+
id: "ce3dec81bf714d3bb71da9691ab686d1",
|
73
|
+
name: "Popup Configured Map"
|
74
|
+
}]
|
75
|
+
];
|
61
76
|
}
|
62
77
|
</script>
|
63
78
|
</head>
|
@@ -479,8 +479,9 @@ function _getSelectionSetNames(exportInfos, id = /.+/) {
|
|
479
479
|
export async function consolidateLabels(exportInfos, formatUsingLayerPopup = true, includeHeaderNames = false, isCSVExport = false) {
|
480
480
|
const labelRequests = [];
|
481
481
|
Object.keys(exportInfos).forEach(k => {
|
482
|
+
var _a;
|
482
483
|
const labelInfo = exportInfos[k];
|
483
|
-
labelRequests.push(_prepareLabels(labelInfo.layerView.layer, labelInfo.ids, formatUsingLayerPopup, includeHeaderNames));
|
484
|
+
labelRequests.push(_prepareLabels(((_a = labelInfo.layerView) === null || _a === void 0 ? void 0 : _a.layer) || labelInfo.layer, labelInfo.ids, formatUsingLayerPopup, includeHeaderNames));
|
484
485
|
if (isCSVExport) {
|
485
486
|
// add the layer id as a temp value separator that we can use to split values for CSV export
|
486
487
|
labelRequests.push(Promise.resolve([[k]]));
|
@@ -669,7 +669,7 @@ export async function consolidateLabels(
|
|
669
669
|
|
670
670
|
Object.keys(exportInfos).forEach(k => {
|
671
671
|
const labelInfo: IExportInfo = exportInfos[k];
|
672
|
-
labelRequests.push(_prepareLabels(labelInfo.layerView.layer, labelInfo.ids, formatUsingLayerPopup, includeHeaderNames));
|
672
|
+
labelRequests.push(_prepareLabels(labelInfo.layerView?.layer || labelInfo.layer, labelInfo.ids, formatUsingLayerPopup, includeHeaderNames));
|
673
673
|
if (isCSVExport) {
|
674
674
|
// add the layer id as a temp value separator that we can use to split values for CSV export
|
675
675
|
labelRequests.push(Promise.resolve([[k]]));
|