@esri/solutions-components 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/calcite-input-text_5.cjs.entry.js +36 -36
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +1 -1
- package/dist/cjs/solution-configuration.cjs.entry.js +1 -1
- package/dist/cjs/solution-contents_3.cjs.entry.js +1 -1
- package/dist/cjs/{solution-store-70002b57.js → solution-store-ca4639d5.js} +3 -3
- package/dist/collection/components/add-record-modal/test/add-record-modal.e2e.js +24 -0
- package/dist/collection/components/add-record-modal/test/add-record-modal.spec.js +32 -0
- package/dist/collection/components/buffer-tools/test/buffer-tools.e2e.js +24 -0
- package/dist/collection/components/buffer-tools/test/buffer-tools.spec.js +157 -0
- package/dist/collection/components/card-manager/test/card-manager.e2e.js +24 -0
- package/dist/collection/components/card-manager/test/card-manager.spec.js +32 -0
- package/dist/collection/components/comment-card/test/comment-card.e2e.js +24 -0
- package/dist/collection/components/comment-card/test/comment-card.spec.js +32 -0
- package/dist/collection/components/crowdsource-manager/test/crowdsource-manager.e2e.js +24 -0
- package/dist/collection/components/crowdsource-manager/test/crowdsource-manager.spec.js +32 -0
- package/dist/collection/components/crowdsource-reporter/test/crowdsource-reporter.e2e.js +24 -0
- package/dist/collection/components/crowdsource-reporter/test/crowdsource-reporter.spec.js +32 -0
- package/dist/collection/components/deduct-calculator/test/deduct-calculator.e2e.js +24 -0
- package/dist/collection/components/deduct-calculator/test/deduct-calculator.spec.js +32 -0
- package/dist/collection/components/edit-record-modal/test/edit-record-modal.e2e.js +24 -0
- package/dist/collection/components/edit-record-modal/test/edit-record-modal.spec.js +32 -0
- package/dist/collection/components/info-card/test/info-card.e2e.js +24 -0
- package/dist/collection/components/info-card/test/info-card.spec.js +32 -0
- package/dist/collection/components/json-editor/test/json-editor.e2e.js +31 -0
- package/dist/collection/components/json-editor/test/json-editor.spec.js +60 -0
- package/dist/collection/components/layer-table/test/layer-table.e2e.js +24 -0
- package/dist/collection/components/layer-table/test/layer-table.spec.js +32 -0
- package/dist/collection/components/list-item/test/list-item.e2e.js +24 -0
- package/dist/collection/components/list-item/test/list-item.spec.js +32 -0
- package/dist/collection/components/map-card/test/map-card.e2e.js +24 -0
- package/dist/collection/components/map-card/test/map-card.spec.js +32 -0
- package/dist/collection/components/map-draw-tools/test/map-draw-tools.e2e.js +24 -0
- package/dist/collection/components/map-draw-tools/test/map-draw-tools.spec.js +32 -0
- package/dist/collection/components/map-layer-picker/test/map-layer-picker.e2e.js +24 -0
- package/dist/collection/components/map-layer-picker/test/map-layer-picker.spec.js +109 -0
- package/dist/collection/components/map-search/test/map-search.e2e.js +24 -0
- package/dist/collection/components/map-search/test/map-search.spec.js +53 -0
- package/dist/collection/components/map-select-tools/map-select-tools.js +36 -36
- package/dist/collection/components/map-select-tools/test/map-select-tools.e2e.js +24 -0
- package/dist/collection/components/map-select-tools/test/map-select-tools.spec.js +349 -0
- package/dist/collection/components/media-card/test/media-card.e2e.js +24 -0
- package/dist/collection/components/media-card/test/media-card.spec.js +32 -0
- package/dist/collection/components/pci-calculator/test/pci-calculator.e2e.js +24 -0
- package/dist/collection/components/pci-calculator/test/pci-calculator.spec.js +32 -0
- package/dist/collection/components/pdf-download/test/pdf-download.e2e.js +71 -0
- package/dist/collection/components/pdf-download/test/pdf-download.spec.js +104 -0
- package/dist/collection/components/public-notification/test/public-notification.e2e.js +95 -0
- package/dist/collection/components/public-notification/test/public-notification.spec.js +149 -0
- package/dist/collection/components/refine-selection/refine-selection.css +85 -85
- package/dist/collection/components/solution-configuration/test/solution-configuration.e2e.js +31 -0
- package/dist/collection/components/solution-configuration/test/solution-configuration.spec.js +114 -0
- package/dist/collection/components/solution-contents/test/solution-contents.e2e.js +89 -0
- package/dist/collection/components/solution-contents/test/solution-contents.spec.js +138 -0
- package/dist/collection/components/solution-item/test/solution-item.e2e.js +31 -0
- package/dist/collection/components/solution-item/test/solution-item.spec.js +72 -0
- package/dist/collection/components/solution-item-details/test/solution-item-details.e2e.js +31 -0
- package/dist/collection/components/solution-item-details/test/solution-item-details.spec.js +137 -0
- package/dist/collection/components/solution-item-icon/test/solution-item-icon.e2e.js +24 -0
- package/dist/collection/components/solution-item-icon/test/solution-item-icon.spec.js +34 -0
- package/dist/collection/components/solution-item-sharing/test/solution-item-sharing.e2e.js +31 -0
- package/dist/collection/components/solution-item-sharing/test/solution-item-sharing.spec.js +49 -0
- package/dist/collection/components/solution-organization-variables/test/solution-organization-variables.e2e.js +31 -0
- package/dist/collection/components/solution-organization-variables/test/solution-organization-variables.spec.js +60 -0
- package/dist/collection/components/solution-resource-item/test/solution-resource-item.e2e.js +31 -0
- package/dist/collection/components/solution-resource-item/test/solution-resource-item.spec.js +50 -0
- package/dist/collection/components/solution-spatial-ref/test/solution-spatial-ref.e2e.js +31 -0
- package/dist/collection/components/solution-spatial-ref/test/solution-spatial-ref.spec.js +170 -0
- package/dist/collection/components/solution-template-data/test/solution-template-data.e2e.js +31 -0
- package/dist/collection/components/solution-template-data/test/solution-template-data.spec.js +55 -0
- package/dist/collection/components/solution-variables/test/solution-variables.e2e.js +31 -0
- package/dist/collection/components/solution-variables/test/solution-variables.spec.js +126 -0
- package/dist/collection/utils/publicNotificationUtils.js +45 -0
- package/dist/collection/utils/templates.e2e.js +25 -0
- package/dist/collection/utils/test/csvUtils.spec.js +46 -0
- package/dist/collection/utils/test/downloadUtils.spec.js +102 -0
- package/dist/collection/utils/test/pciUtils.spec.js +297 -0
- package/dist/collection/utils/test/solution-store.spec.js +439 -0
- package/dist/components/map-select-tools2.js +36 -36
- package/dist/components/solution-store.js +3 -3
- package/dist/esm/calcite-input-text_5.entry.js +36 -36
- package/dist/esm/calcite-shell-panel_14.entry.js +1 -1
- package/dist/esm/solution-configuration.entry.js +1 -1
- package/dist/esm/solution-contents_3.entry.js +1 -1
- package/dist/esm/{solution-store-5d068b07.js → solution-store-70f874f8.js} +3 -3
- package/dist/solutions-components/{p-41802f6b.entry.js → p-16dfb254.entry.js} +1 -1
- package/dist/solutions-components/{p-4769a2a5.entry.js → p-5ed755a2.entry.js} +1 -1
- package/dist/solutions-components/{p-826a814d.js → p-78719506.js} +2 -2
- package/dist/solutions-components/{p-9f620303.entry.js → p-b4b19fd3.entry.js} +1 -1
- package/dist/solutions-components/{p-24fe6e1c.entry.js → p-d5d5942d.entry.js} +1 -1
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/common.js +291 -0
- package/dist/solutions-components/utils/csvDownload.js +36 -0
- package/dist/solutions-components/utils/csvUtils.js +32 -0
- package/dist/solutions-components/utils/downloadUtils.js +386 -0
- package/dist/solutions-components/utils/interfaces.js +56 -0
- package/dist/solutions-components/utils/languageUtil.js +85 -0
- package/dist/solutions-components/utils/loadModules.js +20 -0
- package/dist/solutions-components/utils/locale.js +56 -0
- package/dist/solutions-components/utils/mapViewUtils.js +140 -0
- package/dist/solutions-components/utils/pciUtils.js +837 -0
- package/dist/solutions-components/utils/pdfUtils.js +62 -0
- package/dist/solutions-components/utils/publicNotificationStore.js +38 -0
- package/dist/solutions-components/utils/publicNotificationUtils.js +45 -0
- package/dist/solutions-components/utils/queryUtils.js +148 -0
- package/dist/solutions-components/utils/solution-store.js +579 -0
- package/dist/solutions-components/utils/templates.e2e.js +25 -0
- package/dist/solutions-components/utils/templates.js +341 -0
- package/dist/solutions-components/utils/test/csvUtils.spec.js +46 -0
- package/dist/solutions-components/utils/test/downloadUtils.spec.js +102 -0
- package/dist/solutions-components/utils/test/mocks/jsApi.js +74 -0
- package/dist/solutions-components/utils/test/pciUtils.spec.js +297 -0
- package/dist/solutions-components/utils/test/solution-store.spec.js +439 -0
- package/dist/solutions-components/utils/test/testUtils.js +135 -0
- package/dist/solutions-components/utils/types.js +14 -0
- package/dist/solutions-components_commit.txt +7 -0
- package/package.json +7 -7
@@ -0,0 +1,140 @@
|
|
1
|
+
/** @license
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
import { queryExtent } from "./queryUtils";
|
17
|
+
/**
|
18
|
+
* Gets the layer names from the current map
|
19
|
+
*
|
20
|
+
* @param mapView the map view to fetch the layer names from
|
21
|
+
*
|
22
|
+
* @returns Promise resolving with an array of layer names
|
23
|
+
*
|
24
|
+
*/
|
25
|
+
export async function getMapLayerHash(mapView) {
|
26
|
+
let layerHash = {};
|
27
|
+
await mapView.when(() => {
|
28
|
+
layerHash = mapView.map.allLayers.toArray().reduce((prev, cur) => {
|
29
|
+
if (cur.type === "feature") {
|
30
|
+
prev[cur.id] = cur.title;
|
31
|
+
}
|
32
|
+
return prev;
|
33
|
+
}, {});
|
34
|
+
});
|
35
|
+
return layerHash;
|
36
|
+
}
|
37
|
+
/**
|
38
|
+
* Gets the layer names from the current map
|
39
|
+
*
|
40
|
+
* @param mapView the map view to fetch the layer names from
|
41
|
+
*
|
42
|
+
* @returns Promise resolving with an array of layer names
|
43
|
+
*
|
44
|
+
*/
|
45
|
+
export async function getMapLayerIds(mapView) {
|
46
|
+
let layerIds = [];
|
47
|
+
await mapView.when(() => {
|
48
|
+
layerIds = mapView.map.allLayers.toArray().reduce((prev, cur) => {
|
49
|
+
if (cur.type === "feature") {
|
50
|
+
prev.push(cur.id);
|
51
|
+
}
|
52
|
+
return prev;
|
53
|
+
}, []);
|
54
|
+
});
|
55
|
+
return layerIds;
|
56
|
+
}
|
57
|
+
/**
|
58
|
+
* Get a layer view by id
|
59
|
+
*
|
60
|
+
* @param mapView the map view to fetch the layer from
|
61
|
+
* @param id the id if the layer to fetch
|
62
|
+
*
|
63
|
+
* @returns Promise resolving with the fetched layer view
|
64
|
+
*
|
65
|
+
*/
|
66
|
+
export async function getMapLayerView(mapView, id) {
|
67
|
+
const layer = await getMapLayer(mapView, id);
|
68
|
+
return layer ? await mapView.whenLayerView(layer) : undefined;
|
69
|
+
}
|
70
|
+
/**
|
71
|
+
* Get a layer by id
|
72
|
+
*
|
73
|
+
* @param mapView the map view to fetch the layer from
|
74
|
+
* @param id the id if the layer to fetch
|
75
|
+
*
|
76
|
+
* @returns Promise resolving with the fetched layer
|
77
|
+
*
|
78
|
+
*/
|
79
|
+
export async function getMapLayer(mapView, id) {
|
80
|
+
let layers = [];
|
81
|
+
await mapView.when(() => {
|
82
|
+
layers = mapView.map.allLayers.toArray().filter((l) => {
|
83
|
+
return l.id === id;
|
84
|
+
});
|
85
|
+
});
|
86
|
+
return layers.length > 0 ? layers[0] : undefined;
|
87
|
+
}
|
88
|
+
/**
|
89
|
+
* Highlight features by OID
|
90
|
+
*
|
91
|
+
* @param ids the OIDs from the layer to highlight
|
92
|
+
* @param layerView the layer view to highlight
|
93
|
+
* @param mapView the map view used if updateExtent is true
|
94
|
+
* @param updateExtent optional (default false) boolean to indicate if we should zoom to the extent
|
95
|
+
*
|
96
|
+
* @returns Promise resolving with the highlight handle
|
97
|
+
*
|
98
|
+
*/
|
99
|
+
export async function highlightFeatures(ids, layerView, mapView, updateExtent = false) {
|
100
|
+
if (updateExtent) {
|
101
|
+
await goToSelection(ids, layerView, mapView, false);
|
102
|
+
}
|
103
|
+
return layerView.highlight(ids);
|
104
|
+
}
|
105
|
+
/**
|
106
|
+
* Flash features by OID
|
107
|
+
*
|
108
|
+
* @param ids the OIDs from the layer to highlight
|
109
|
+
* @param layerView the layer view to highlight
|
110
|
+
*
|
111
|
+
* @returns Promise resolving when the operation is complete
|
112
|
+
*
|
113
|
+
*/
|
114
|
+
export async function flashSelection(ids, layerView, featureEffect) {
|
115
|
+
const filter = {
|
116
|
+
objectIds: ids
|
117
|
+
};
|
118
|
+
layerView.featureEffect = Object.assign(Object.assign({}, featureEffect), { filter });
|
119
|
+
setTimeout(() => {
|
120
|
+
layerView.featureEffect = undefined;
|
121
|
+
}, 1300);
|
122
|
+
}
|
123
|
+
/**
|
124
|
+
* Zoom to features based on OID
|
125
|
+
*
|
126
|
+
* @param ids the OIDs from the layer to go to
|
127
|
+
* @param layerView the layer view that contains the OIDs
|
128
|
+
* @param mapView the map view to show the extent change
|
129
|
+
* @param flashFeatures optional (default true) boolean to indicate if we should flash the features
|
130
|
+
*
|
131
|
+
* @returns Promise resolving when the operation is complete
|
132
|
+
*
|
133
|
+
*/
|
134
|
+
export async function goToSelection(ids, layerView, mapView, flashFeatures = true, featureEffect = undefined) {
|
135
|
+
const result = await queryExtent(ids, layerView.layer);
|
136
|
+
await mapView.goTo(result.extent);
|
137
|
+
if (flashFeatures) {
|
138
|
+
await flashSelection(ids, layerView, featureEffect);
|
139
|
+
}
|
140
|
+
}
|