@esri/solutions-components 0.7.18 → 0.7.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/calcite-alert_3.cjs.entry.js +93 -6
- package/dist/cjs/calcite-combobox_6.cjs.entry.js +1 -1
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +1 -1
- package/dist/cjs/card-manager_3.cjs.entry.js +12 -5
- package/dist/cjs/crowdsource-manager.cjs.entry.js +4 -3
- package/dist/cjs/{downloadUtils-8f50633d.js → downloadUtils-9a13c6ac.js} +19 -14
- package/dist/cjs/{index.es-140aa937.js → index.es-284a020c.js} +2 -2
- package/dist/cjs/map-select-tools_3.cjs.entry.js +2 -2
- package/dist/cjs/{mapViewUtils-569e9644.js → mapViewUtils-8aa325de.js} +4 -1
- package/dist/cjs/public-notification.cjs.entry.js +2 -2
- package/dist/cjs/solution-contents_3.cjs.entry.js +4 -4
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.css +4 -1
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +3 -2
- package/dist/collection/components/edit-card/edit-card.js +1 -2
- package/dist/collection/components/info-card/info-card.js +3 -3
- package/dist/collection/components/layer-table/layer-table.css +4 -0
- package/dist/collection/components/layer-table/layer-table.js +9 -2
- package/dist/collection/components/solution-item-sharing/solution-item-sharing.js +1 -1
- package/dist/collection/components/solution-spatial-ref/solution-spatial-ref.js +4 -4
- package/dist/collection/utils/downloadUtils.js +17 -12
- package/dist/collection/utils/downloadUtils.ts +20 -12
- package/dist/collection/utils/interfaces.ts +5 -0
- package/dist/collection/utils/popupUtils.js +94 -0
- package/dist/collection/utils/popupUtils.ts +104 -0
- package/dist/collection/utils/queryUtils.js +4 -1
- package/dist/collection/utils/queryUtils.ts +5 -1
- package/dist/components/crowdsource-manager.js +4 -3
- package/dist/components/downloadUtils.js +17 -12
- package/dist/components/edit-card2.js +1 -2
- package/dist/components/info-card2.js +91 -3
- package/dist/components/layer-table2.js +10 -3
- package/dist/components/queryUtils.js +4 -1
- package/dist/components/solution-item-sharing2.js +1 -1
- package/dist/components/solution-spatial-ref2.js +4 -4
- package/dist/esm/calcite-alert_3.entry.js +93 -6
- package/dist/esm/calcite-combobox_6.entry.js +1 -1
- package/dist/esm/calcite-shell-panel_14.entry.js +1 -1
- package/dist/esm/card-manager_3.entry.js +12 -5
- package/dist/esm/crowdsource-manager.entry.js +4 -3
- package/dist/esm/{downloadUtils-9dee8bc0.js → downloadUtils-a4bbdb1d.js} +19 -14
- package/dist/esm/{index.es-54e86c8e.js → index.es-48fdb288.js} +2 -2
- package/dist/esm/map-select-tools_3.entry.js +2 -2
- package/dist/esm/{mapViewUtils-066602d5.js → mapViewUtils-8fe70944.js} +4 -1
- package/dist/esm/public-notification.entry.js +2 -2
- package/dist/esm/solution-contents_3.entry.js +4 -4
- package/dist/solutions-components/{p-d0c4572d.entry.js → p-1d56804c.entry.js} +18 -2
- package/dist/solutions-components/p-24b3ad7d.entry.js +6 -0
- package/dist/solutions-components/{p-6656c53e.entry.js → p-2abc02a1.entry.js} +1 -1
- package/dist/solutions-components/{p-825c045a.entry.js → p-2ddd9cf8.entry.js} +1 -1
- package/dist/solutions-components/{p-e8011829.entry.js → p-48a5ae32.entry.js} +1 -1
- package/dist/solutions-components/{p-dfdb8411.js → p-72dbfa77.js} +1 -1
- package/dist/solutions-components/{p-683cded6.entry.js → p-b1422b00.entry.js} +1 -1
- package/dist/solutions-components/p-b5d1b979.js +36 -0
- package/dist/solutions-components/{p-e405f393.entry.js → p-cf24ce53.entry.js} +1 -1
- package/dist/solutions-components/{p-1bdd64a0.js → p-d4afcf86.js} +4 -4
- package/dist/solutions-components/{p-f486c86d.entry.js → p-fdb1ace8.entry.js} +1 -1
- package/dist/solutions-components/solutions-components.css +1 -1
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/downloadUtils.ts +20 -12
- package/dist/solutions-components/utils/interfaces.ts +5 -0
- package/dist/solutions-components/utils/popupUtils.ts +104 -0
- package/dist/solutions-components/utils/queryUtils.ts +5 -1
- package/dist/types/components/info-card/info-card.d.ts +5 -0
- package/dist/types/utils/downloadUtils.d.ts +3 -3
- package/dist/types/utils/interfaces.d.ts +4 -0
- package/dist/types/utils/popupUtils.d.ts +46 -0
- package/dist/types/utils/queryUtils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/solutions-components/p-531d91d6.js +0 -36
- package/dist/solutions-components/p-8ca5d651.entry.js +0 -6
|
@@ -125,14 +125,15 @@ export async function consolidateLabels(
|
|
|
125
125
|
exportInfos: IExportInfos,
|
|
126
126
|
formatUsingLayerPopup = true,
|
|
127
127
|
includeHeaderNames = false,
|
|
128
|
-
isCSVExport = false
|
|
128
|
+
isCSVExport = false,
|
|
129
|
+
fields = []
|
|
129
130
|
): Promise<string[][]> {
|
|
130
131
|
const labelRequests = [];
|
|
131
132
|
|
|
132
133
|
Object.keys(exportInfos).forEach(k => {
|
|
133
134
|
const labelInfo: IExportInfo = exportInfos[k];
|
|
134
135
|
labelRequests.push(
|
|
135
|
-
_prepareLabels(webmap, labelInfo.layerView?.layer || labelInfo.layer, labelInfo.ids, formatUsingLayerPopup, includeHeaderNames)
|
|
136
|
+
_prepareLabels(webmap, labelInfo.layerView?.layer || labelInfo.layer, labelInfo.ids, formatUsingLayerPopup, includeHeaderNames, fields)
|
|
136
137
|
);
|
|
137
138
|
if (isCSVExport) {
|
|
138
139
|
// add the layer id as a temp value separator that we can use to split values for CSV export
|
|
@@ -160,9 +161,10 @@ export async function downloadCSV(
|
|
|
160
161
|
exportInfos: IExportInfos,
|
|
161
162
|
formatUsingLayerPopup: boolean,
|
|
162
163
|
removeDuplicates = false,
|
|
163
|
-
addColumnTitle = false
|
|
164
|
+
addColumnTitle = false,
|
|
165
|
+
fields = []
|
|
164
166
|
): Promise<void> {
|
|
165
|
-
let labels = await consolidateLabels(webmap, exportInfos, formatUsingLayerPopup, addColumnTitle, true);
|
|
167
|
+
let labels = await consolidateLabels(webmap, exportInfos, formatUsingLayerPopup, addColumnTitle, true, fields);
|
|
166
168
|
labels = removeDuplicates ? removeDuplicateLabels(labels) : labels;
|
|
167
169
|
|
|
168
170
|
const layerIds = Object.keys(exportInfos);
|
|
@@ -838,7 +840,8 @@ export async function _prepareLabels(
|
|
|
838
840
|
layer: __esri.FeatureLayer,
|
|
839
841
|
ids: number[],
|
|
840
842
|
formatUsingLayerPopup = true,
|
|
841
|
-
includeHeaderNames = false
|
|
843
|
+
includeHeaderNames = false,
|
|
844
|
+
fields = []
|
|
842
845
|
): Promise<string[][]> {
|
|
843
846
|
// Get the label formatting, if any
|
|
844
847
|
const labelFormatProps: ILabelFormatProps = await _getLabelFormat(webmap, layer, formatUsingLayerPopup);
|
|
@@ -909,7 +912,8 @@ export async function _prepareLabels(
|
|
|
909
912
|
|
|
910
913
|
} else {
|
|
911
914
|
// Get the features to export
|
|
912
|
-
|
|
915
|
+
const outFields = fields.length > 0 ? fields : undefined;
|
|
916
|
+
featureSet = await queryFeaturesByID(ids, featureLayer, [], false, undefined, outFields);
|
|
913
917
|
}
|
|
914
918
|
|
|
915
919
|
// Get field data types. Do we have any domain-based fields?
|
|
@@ -920,18 +924,22 @@ export async function _prepareLabels(
|
|
|
920
924
|
if (featureLayer.fields) {
|
|
921
925
|
featureLayer.fields.forEach(
|
|
922
926
|
field => {
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
+
if (fields.indexOf(field.name.toLowerCase()) > -1) {
|
|
928
|
+
const lowercaseFieldname = field.name.toLowerCase();
|
|
929
|
+
attributeOrigNames[lowercaseFieldname] = field.name;
|
|
930
|
+
attributeDomains[lowercaseFieldname] = field.domain;
|
|
931
|
+
attributeTypes[lowercaseFieldname] = field.type;
|
|
932
|
+
}
|
|
927
933
|
}
|
|
928
934
|
);
|
|
929
935
|
} else {
|
|
930
936
|
// Feature layer is missing fields, so get info from first feature
|
|
931
937
|
Object.keys(featureSet[0]).forEach(
|
|
932
938
|
fieldName => {
|
|
933
|
-
|
|
934
|
-
|
|
939
|
+
if (fields.indexOf(fieldName.toLowerCase()) > -1) {
|
|
940
|
+
const lowercaseFieldname = fieldName.toLowerCase();
|
|
941
|
+
attributeOrigNames[lowercaseFieldname] = fieldName;
|
|
942
|
+
}
|
|
935
943
|
}
|
|
936
944
|
)
|
|
937
945
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
|
|
17
|
+
import { loadModules } from "./loadModules";
|
|
18
|
+
|
|
19
|
+
export class PopupUtils {
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* esri/arcade: https://developers.arcgis.com/javascript/latest/api-reference/esri-arcade.html
|
|
23
|
+
*/
|
|
24
|
+
arcade: typeof import("esri/arcade");
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get the popup title that honors arcade expressions
|
|
28
|
+
*
|
|
29
|
+
* @returns Promise resolving with the popup title
|
|
30
|
+
*
|
|
31
|
+
* @protected
|
|
32
|
+
*/
|
|
33
|
+
public async getPopupTitle(
|
|
34
|
+
graphic: __esri.Graphic
|
|
35
|
+
): Promise<string> {
|
|
36
|
+
if (!this.arcade) {
|
|
37
|
+
await this._initModules()
|
|
38
|
+
}
|
|
39
|
+
let attributes = {};
|
|
40
|
+
for (const [key, value] of Object.entries(graphic.attributes)) {
|
|
41
|
+
attributes = {
|
|
42
|
+
...attributes,
|
|
43
|
+
[`{${key.toUpperCase()}}`]: value
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const layer = graphic.layer as __esri.FeatureLayer;
|
|
47
|
+
const popupTitle = this._removeTags(layer?.popupTemplate?.title as string);
|
|
48
|
+
if (popupTitle.includes("{expression/expr") && layer?.popupTemplate?.expressionInfos != null) {
|
|
49
|
+
for (let i = 0; i < layer.popupTemplate?.expressionInfos.length; i++) {
|
|
50
|
+
const info = layer.popupTemplate.expressionInfos[i];
|
|
51
|
+
const profile = {
|
|
52
|
+
variables: [
|
|
53
|
+
{
|
|
54
|
+
name: "$feature",
|
|
55
|
+
type: "feature"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
} as __esri.Profile;
|
|
59
|
+
try {
|
|
60
|
+
const arcadeExecutor = await this.arcade.createArcadeExecutor(info.expression, profile);
|
|
61
|
+
const arcadeTitle = arcadeExecutor.execute({ $feature: graphic });
|
|
62
|
+
if (arcadeTitle != null || arcadeTitle !== "") {
|
|
63
|
+
attributes[`{expression/${info.name}}`.toUpperCase()] = arcadeTitle;
|
|
64
|
+
}
|
|
65
|
+
} catch {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return popupTitle?.replace(/{.*?}/g, (placeholder: string) => {
|
|
72
|
+
return attributes[placeholder.toUpperCase()] != null ? (attributes[placeholder.toUpperCase()] as string) : "";
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Remove any tags from the title
|
|
78
|
+
*
|
|
79
|
+
* @returns title string without tags
|
|
80
|
+
*
|
|
81
|
+
* @protected
|
|
82
|
+
*/
|
|
83
|
+
protected _removeTags(str: string): string {
|
|
84
|
+
if (str == null || str === "") {
|
|
85
|
+
return "";
|
|
86
|
+
}
|
|
87
|
+
return str.toString().replace(/(<([^>]+)>)/gi, "");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Load esri javascript api modules
|
|
92
|
+
*
|
|
93
|
+
* @returns Promise resolving when function is done
|
|
94
|
+
*
|
|
95
|
+
* @protected
|
|
96
|
+
*/
|
|
97
|
+
protected async _initModules(): Promise<void> {
|
|
98
|
+
const [arcade] = await loadModules([
|
|
99
|
+
"esri/arcade"
|
|
100
|
+
]);
|
|
101
|
+
this.arcade = arcade;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
}
|
|
@@ -126,7 +126,8 @@ export async function queryFeaturesByID(
|
|
|
126
126
|
layer: __esri.FeatureLayer,
|
|
127
127
|
graphics: __esri.Graphic[],
|
|
128
128
|
returnGeometry: boolean,
|
|
129
|
-
outSpatialReference?: __esri.SpatialReference
|
|
129
|
+
outSpatialReference?: __esri.SpatialReference,
|
|
130
|
+
fields?: string[]
|
|
130
131
|
): Promise<__esri.Graphic[]> {
|
|
131
132
|
const num = layer.capabilities?.query.maxRecordCount;
|
|
132
133
|
const start = 0;
|
|
@@ -141,6 +142,9 @@ export async function queryFeaturesByID(
|
|
|
141
142
|
if (outSpatialReference) {
|
|
142
143
|
q.outSpatialReference = outSpatialReference;
|
|
143
144
|
}
|
|
145
|
+
if (fields) {
|
|
146
|
+
q.outFields = fields;
|
|
147
|
+
}
|
|
144
148
|
|
|
145
149
|
const result = await layer.queryFeatures(q);
|
|
146
150
|
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
/// <reference types="arcgis-js-api" />
|
|
17
17
|
import { EventEmitter } from "../../stencil-public-runtime";
|
|
18
18
|
import InfoCard_T9n from "../../assets/t9n/info-card/resources.json";
|
|
19
|
+
import { IPopupUtils } from "../../utils/interfaces";
|
|
19
20
|
export declare class InfoCard {
|
|
20
21
|
el: HTMLInfoCardElement;
|
|
21
22
|
/**
|
|
@@ -79,6 +80,10 @@ export declare class InfoCard {
|
|
|
79
80
|
* used for widget instance
|
|
80
81
|
*/
|
|
81
82
|
protected _features: __esri.Features;
|
|
83
|
+
/**
|
|
84
|
+
* IPopupUtils: When false alerts will be shown to indicate that the layer must have editing enabled for edit actions
|
|
85
|
+
*/
|
|
86
|
+
protected _popupUtils: IPopupUtils;
|
|
82
87
|
/**
|
|
83
88
|
* esri/core/reactiveUtils: https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html
|
|
84
89
|
*/
|
|
@@ -77,7 +77,7 @@ import { IQueryRelatedOptions, IQueryRelatedResponse, IRelatedRecordGroup } from
|
|
|
77
77
|
* @param includeHeaderNames Add the label format at the front of the list of generated labels
|
|
78
78
|
* @returns selectionSetNames that will be used for export filenames
|
|
79
79
|
*/
|
|
80
|
-
export declare function consolidateLabels(webmap: __esri.Map, exportInfos: IExportInfos, formatUsingLayerPopup?: boolean, includeHeaderNames?: boolean, isCSVExport?: boolean): Promise<string[][]>;
|
|
80
|
+
export declare function consolidateLabels(webmap: __esri.Map, exportInfos: IExportInfos, formatUsingLayerPopup?: boolean, includeHeaderNames?: boolean, isCSVExport?: boolean, fields?: any[]): Promise<string[][]>;
|
|
81
81
|
/**
|
|
82
82
|
* Downloads csv of mailing labels for the provided list of ids
|
|
83
83
|
*
|
|
@@ -89,7 +89,7 @@ export declare function consolidateLabels(webmap: __esri.Map, exportInfos: IExpo
|
|
|
89
89
|
* @param addColumnTitle Indicates if column headings should be included in output
|
|
90
90
|
* @returns Promise resolving when function is done
|
|
91
91
|
*/
|
|
92
|
-
export declare function downloadCSV(webmap: __esri.Map, exportInfos: IExportInfos, formatUsingLayerPopup: boolean, removeDuplicates?: boolean, addColumnTitle?: boolean): Promise<void>;
|
|
92
|
+
export declare function downloadCSV(webmap: __esri.Map, exportInfos: IExportInfos, formatUsingLayerPopup: boolean, removeDuplicates?: boolean, addColumnTitle?: boolean, fields?: any[]): Promise<void>;
|
|
93
93
|
/**
|
|
94
94
|
* Downloads csv of mailing labels for the provided list of ids
|
|
95
95
|
*
|
|
@@ -230,7 +230,7 @@ export declare function _prepareAttributeValue(attributeValue: any, attributeTyp
|
|
|
230
230
|
* @param includeHeaderNames Add the label format at the front of the list of generated labels
|
|
231
231
|
* @returns Promise resolving when function is done
|
|
232
232
|
*/
|
|
233
|
-
export declare function _prepareLabels(webmap: __esri.Map, layer: __esri.FeatureLayer, ids: number[], formatUsingLayerPopup?: boolean, includeHeaderNames?: boolean): Promise<string[][]>;
|
|
233
|
+
export declare function _prepareLabels(webmap: __esri.Map, layer: __esri.FeatureLayer, ids: number[], formatUsingLayerPopup?: boolean, includeHeaderNames?: boolean, fields?: any[]): Promise<string[][]>;
|
|
234
234
|
/**
|
|
235
235
|
* Creates labels from all attributes in items.
|
|
236
236
|
*
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
/// <reference types="arcgis-js-api" />
|
|
17
|
+
export declare class PopupUtils {
|
|
18
|
+
/**
|
|
19
|
+
* esri/arcade: https://developers.arcgis.com/javascript/latest/api-reference/esri-arcade.html
|
|
20
|
+
*/
|
|
21
|
+
arcade: typeof import("esri/arcade");
|
|
22
|
+
/**
|
|
23
|
+
* Get the popup title that honors arcade expressions
|
|
24
|
+
*
|
|
25
|
+
* @returns Promise resolving with the popup title
|
|
26
|
+
*
|
|
27
|
+
* @protected
|
|
28
|
+
*/
|
|
29
|
+
getPopupTitle(graphic: __esri.Graphic): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Remove any tags from the title
|
|
32
|
+
*
|
|
33
|
+
* @returns title string without tags
|
|
34
|
+
*
|
|
35
|
+
* @protected
|
|
36
|
+
*/
|
|
37
|
+
protected _removeTags(str: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Load esri javascript api modules
|
|
40
|
+
*
|
|
41
|
+
* @returns Promise resolving when function is done
|
|
42
|
+
*
|
|
43
|
+
* @protected
|
|
44
|
+
*/
|
|
45
|
+
protected _initModules(): Promise<void>;
|
|
46
|
+
}
|
|
@@ -59,7 +59,7 @@ export declare function queryObjectIds(geometries: __esri.Geometry[], layer: __e
|
|
|
59
59
|
*
|
|
60
60
|
* @returns Promise with the featureSet from the layer that match the provided ids
|
|
61
61
|
*/
|
|
62
|
-
export declare function queryFeaturesByID(ids: number[], layer: __esri.FeatureLayer, graphics: __esri.Graphic[], returnGeometry: boolean, outSpatialReference?: __esri.SpatialReference): Promise<__esri.Graphic[]>;
|
|
62
|
+
export declare function queryFeaturesByID(ids: number[], layer: __esri.FeatureLayer, graphics: __esri.Graphic[], returnGeometry: boolean, outSpatialReference?: __esri.SpatialReference, fields?: string[]): Promise<__esri.Graphic[]>;
|
|
63
63
|
/**
|
|
64
64
|
* Query the layer for features that have the provided globalId
|
|
65
65
|
*
|
package/package.json
CHANGED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2022 Esri
|
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
*/
|
|
6
|
-
import{c as n}from"./p-4af32c75.js";
|
|
7
|
-
/** @license
|
|
8
|
-
* Copyright 2022 Esri
|
|
9
|
-
*
|
|
10
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
-
* you may not use this file except in compliance with the License.
|
|
12
|
-
* You may obtain a copy of the License at
|
|
13
|
-
*
|
|
14
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
*
|
|
16
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
-
* See the License for the specific language governing permissions and
|
|
20
|
-
* limitations under the License.
|
|
21
|
-
*/async function t(n){const t=n.createQuery();return t.where=n.definitionExpression||"1=1",await n.queryObjectIds(t)}async function a(n,t){let a=[];const s=n?n.map((n=>async function(n,t){const a=t.createQuery();return a.spatialRelationship="intersects",a.geometry=n,t.queryObjectIds(a)}
|
|
22
|
-
/** @license
|
|
23
|
-
* Copyright 2022 Esri
|
|
24
|
-
*
|
|
25
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
26
|
-
* you may not use this file except in compliance with the License.
|
|
27
|
-
* You may obtain a copy of the License at
|
|
28
|
-
*
|
|
29
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
30
|
-
*
|
|
31
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
32
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
33
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
34
|
-
* See the License for the specific language governing permissions and
|
|
35
|
-
* limitations under the License.
|
|
36
|
-
*/(n,t))):[Promise.resolve()];return(await Promise.all(s)).forEach((n=>{a=[...a,...n||[]]})),a}async function s(n,t,a,c,o){var i;const e=null===(i=t.capabilities)||void 0===i?void 0:i.query.maxRecordCount,r=t.createQuery();r.start=0,r.returnGeometry=c,r.objectIds=n.slice(0,e),e&&(r.num=e),o&&(r.outSpatialReference=o);const u=await t.queryFeatures(r);a=a.concat(u.features);const f=n.slice(e,n.length);return f.length>0?s(f,t,a,c,o):Promise.resolve(a)}async function c(n,t){const a=t.globalIdField;if(!a)return[];const s=t.createQuery();return s.returnGeometry=!1,s.outFields=[t.objectIdField],s.where=n.map((n=>`${a} = '${n}'`)).join(" or "),(await t.queryFeatures(s)).features}async function o(n,t,a,s){const c=t.capabilities.query.maxRecordCount,i=t.createQuery();i.start=n,i.num=c,i.geometry=a;const e=await t.queryFeatures(i);return s[t.id]=s[t.id].concat(e.features),e.exceededTransferLimit?o(n+=c,t,a,s):Promise.resolve(s)}async function i(n,t,a){const s=n.createQuery();return s.where=t||"1=1",s.orderByFields=a,await n.queryObjectIds(s)}function e(n,t){return[...r(n,"polygon",t),...r(n,"polyline",t),...r(n,"point",t)]}function r(n,t,a){const s=(null==n?void 0:n.filter((n=>n.type===t)))||[];return s.length<=1?s:[a.union(s)]}async function u(n,t){let a;return await n.when((()=>{a=n.map.allLayers.toArray().reduce(((n,t)=>("feature"===t.type&&(n[t.id]={name:t.title,supportsUpdate:void 0}),n)),{})})),w(t,a,n)}async function f(n,t){let a;return await n.when((()=>{a=n.map.allTables.toArray().reduce(((n,t)=>(n[t.id]={name:t.title,supportsUpdate:void 0},n)),{})})),w(t,a,n)}async function w(n,t,a){if(n){const n={},s=Object.keys(t);for(let c=0;c<s.length;c++){const o=s[c],i=await l(a,o);await i.load(),await i.when(),n[o]={name:t[o].name,supportsUpdate:i.editingEnabled&&i.capabilities.operations.supportsUpdate}}return n}return t}async function y(n,t){const a=await l(n,t);return a?await n.whenLayerView(a):void 0}async function l(n,t){let a=[];return await n.when((()=>{a=[...n.map.allLayers.toArray(),...n.map.allTables.toArray()].filter((n=>n.id===t))})),a.length>0?a[0]:void 0}async function d(n){const t=n.map.allLayers.toArray();let a;return await n.when((()=>{a=t.map((t=>n.whenLayerView(t)))})),await Promise.allSettled(a),t}async function p(n,t,a,s=!1){return s&&await v(n,t,a,!1),t.highlight(n)}async function m(n){const t=j(n);return Object.keys(t).reduce(((n,a)=>{const s=t[a];return n.push(s.layerView.highlight(s.ids)),n}),[])}function j(t){return t.reduce(((t,a)=>{const s=a.layerView,c=null==s?void 0:s.layer.id;return c&&Object.keys(t).indexOf(c)>-1?t[c].ids=[...new Set([...a.selectedIds,...t[c].ids])]:c&&(t[c]={layerView:s,ids:a.selectedIds}),a.workflowType===n.REFINE&&Object.keys(a.refineInfos).forEach((n=>{const s=a.refineInfos[n];Object.keys(t).indexOf(n)>-1&&(t[n].ids=[...new Set([...s.addIds,...t[n].ids])],t[n].ids=t[n].ids.filter((n=>s.removeIds.indexOf(n)<0)))})),t}),{})}async function v(n,t,a,s=!0,c){const o=await async function(n,t){const a=t.createQuery();return a.objectIds=n,t.queryExtent(a)}(n,t.layer);await a.goTo(o.extent),s&&await async function(n,t,a){const s={objectIds:n};t.featureEffect=Object.assign(Object.assign({},a),{filter:s}),setTimeout((()=>{t.featureEffect=void 0}),1300)}(n,t,c)}export{l as a,i as b,t as c,c as d,a as e,e as f,v as g,p as h,y as i,o as j,j as k,m as l,d as m,u as n,f as o,s as q}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2022 Esri
|
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
-
*/
|
|
6
|
-
import{r as t,h as i,H as e,g as s}from"./p-78780f63.js";import{g as h}from"./p-6b943f52.js";import{E as l}from"./p-4af32c75.js";import"./p-d918ec36.js";import"./p-e1a4994d.js";const o=class{constructor(i){t(this,i),this._shouldSetMapView=!1,this.classicGrid=!1,this.defaultCenter="",this.defaultGlobalId="",this.defaultLayer="",this.defaultLevel="",this.defaultOid="",this.defaultWebmap="",this.enableAutoRefresh=!1,this.enableColumnReorder=!0,this.enableCSV=!0,this.enableFloorFilter=!0,this.enableFullscreen=!0,this.enableInlineEdit=!1,this.enableLegend=!0,this.enableSearch=!0,this.enableShare=!1,this.enableHome=!0,this.enableZoom=!0,this.enableBasemap=!0,this.basemapConfig=void 0,this.showNewestFirst=!0,this.hideMap=!1,this.mapInfos=[],this.onlyShowUpdatableLayers=!0,this.searchConfiguration=void 0,this.shareIncludeEmbed=void 0,this.shareIncludeSocial=void 0,this.theme="light",this.zoomAndScrollToSelected=!1,this._expandPopup=!1,this._hideFooter=!1,this._hideTable=!1,this._isMobile=void 0,this._translations=void 0,this._layoutMode=l.GRID,this._mapInfo=void 0,this._mapView=void 0,this._panelOpen=!0,this._numSelected=0,this._tableOnly=!1}defaultCenterWatchHandler(){this._defaultCenter=this.defaultCenter?this.defaultCenter.split(";").map((t=>parseFloat(t))):void 0}defaultGlobalIdWatchHandler(){this._defaultGlobalId=this.defaultGlobalId?this.defaultGlobalId.indexOf(",")>-1?this.defaultGlobalId.split(","):[this.defaultGlobalId]:void 0}defaultOidWatchHandler(){this._defaultOid=this.defaultOid?this.defaultOid.indexOf(",")>-1?this.defaultOid.split(",").map((t=>parseInt(t,10))):[parseInt(this.defaultOid,10)]:void 0}defaultLevelWatchHandler(){this._defaultLevel=this.defaultLevel?parseInt(this.defaultLevel,10):void 0}enableZoomWatchHandler(){this._initMapZoom()}async _isMobileWatchHandler(){this.showHideMapPopupAndTable(!!this._isMobile&&this._numSelected>0)}async featureSelectionChange(t){var i;this._numSelected=null===(i=t.detail)||void 0===i?void 0:i.length}async popupClosed(){this._isMobile&&this.showHideMapPopupAndTable(!1)}async idsFound(t){const i=t.detail;this._tableOnly=i.tableIds.length>0&&0===i.layerIds.length,this._tableOnly&&(this._expandPopup=!0)}async layoutChanged(t){this._layoutMode=t.detail}async mapChanged(t){this._mapChange=t.detail,await this._mapChange.mapView.when((async()=>{await this._setMapView()}))}async beforeMapChanged(){this._expandPopup&&(this._shouldSetMapView=!0,this._expandPopup=!1)}async componentWillLoad(){await this._getTranslations(),this._resizeObserver=new ResizeObserver((()=>this._onResize()))}render(){return i(e,null,i("calcite-shell",{class:"position-relative"},i("calcite-panel",{class:"width-full height-full"},this._getBody(this._layoutMode,this._panelOpen,this.hideMap,this._hideTable)),this._getFooter()))}async componentDidRender(){this._shouldSetMapView&&(this._shouldSetMapView=!1,await this._setMapView())}async componentDidLoad(){this._resizeObserver.observe(this.el)}_getFooter(){return this._isMobile&&this._numSelected>0&&!this._hideFooter?i("div",{class:"width-100",slot:"footer"},i("div",{class:"display-flex padding-1-2"},i("calcite-button",{appearance:"solid",id:"solutions-show",onClick:()=>this.showHideMapPopupAndTable(!0),width:"full"},this._translations.view.replace("{{n}}",this._numSelected.toString())),i("calcite-button",{appearance:"outline",class:"padding-inline-start-1",id:"solutions-delete",kind:"danger",onClick:()=>this._layerTable.deleteFeatures(),width:"full"},this._translations.delete.replace("{{n}}",this._numSelected.toString())))):void 0}_getDividerIcon(t,i){let e="";switch(t){case l.HORIZONTAL:e=this.classicGrid?i?"chevrons-down":"chevrons-up":i?"chevrons-up":"chevrons-down";break;case l.VERTICAL:e=this.classicGrid?i?"chevrons-right":"chevrons-left":i?"chevrons-left":"chevrons-right";break;case l.GRID:e=this.classicGrid?i?"chevrons-up":"chevrons-down":i?"chevrons-left":"chevrons-right"}return e}_getMapSizeClass(t,i){let e="";switch(t){case l.HORIZONTAL:e=(this._isMobile&&this._hideTable?"height-full":i?"height-1-2":"height-0")+" width-full position-relative";break;case l.GRID:e=this.classicGrid?(i?"position-relative":"position-absolute-53")+" height-full width-full display-flex":"height-full position-relative "+(i?"width-1-3":"width-0");break;case l.VERTICAL:e="height-full position-relative "+(i?"width-1-2":"width-0")}return e}_getTableSizeClass(t,i){let e="";switch(t){case l.HORIZONTAL:e=(i?"height-1-2":"height-full")+" width-full display-flex flex-column";break;case l.GRID:e=this.classicGrid?(i?"height-full":"height-53")+" position-relative width-full display-flex":(i?"width-2-3":"width-full")+" height-full display-flex";break;case l.VERTICAL:e=(i?"width-1-2":"width-full")+" height-full display-flex"}return e}_getBody(t,e,s,h){const o=this.classicGrid&&t===l.GRID&&e?"display-grid":t===l.HORIZONTAL?"":"display-flex";return i("calcite-panel",{class:"width-full height-full"},this.classicGrid?i("div",{class:`width-full height-full overflow-hidden ${o}`},this._getTable(t,e,h),this._getMapAndCard(t,e,s)):i("div",{class:`width-full height-full overflow-hidden ${o}`},this._getMapAndCard(t,e,s),this._getTable(t,e,h)))}_getMapAndCard(t,e,s){const h=this._getMapSizeClass(t,e);return this.classicGrid?i("div",{class:`${h} overflow-hidden`},this._getCardNode(),this._getMapNode(t,s)):i("div",{class:`${h} overflow-hidden`},this._getMapNode(t,s),this._getPopupExpandNode())}_getMapNode(t,e){var s;return i("div",{class:`${this.classicGrid&&t===l.GRID?"width-full":this._layoutMode!==l.HORIZONTAL||e?this._layoutMode===l.HORIZONTAL&&this._isMobile&&this.hideMap?"height-0":"adjusted-height-50":""} overflow-hidden ${this.classicGrid&&t===l.GRID?"display-flex height-full width-1-2":t===l.HORIZONTAL&&!e||t===l.GRID&&!e?"":"visibility-hidden"}`},i("map-card",{basemapConfig:this.basemapConfig,class:"width-full",defaultWebmapId:this.defaultWebmap,enableBasemap:this.enableBasemap,enableFloorFilter:this.enableFloorFilter,enableFullscreen:this.enableFullscreen,enableHome:this.enableHome,enableLegend:this.enableLegend,enableMapToolsExpand:!0,enableSearch:this.enableSearch,hidden:this._expandPopup,homeZoomIndex:3,homeZoomPosition:"top-left",homeZoomToolsSize:"s",mapInfos:null===(s=this.mapInfos)||void 0===s?void 0:s.filter((t=>!1!==t.visible)),mapWidgetsIndex:0,mapWidgetsPosition:"top-right",mapWidgetsSize:"m",stackTools:!0,theme:this.theme,toolOrder:["legend","search","fullscreen","basemap","floorfilter"]}))}_getPopupExpandNode(){var t;const e=this._expandPopup?"chevrons-down":"chevrons-up",s="expand-popup",h=this._expandPopup?this._translations.collapsePopup:this._translations.expandPopup,l="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light",o=this._expandPopup?1===(null===(t=this.mapInfos)||void 0===t?void 0:t.length)||this._isMobile?"position-absolute-0":"position-absolute-50":"height-full",a=this._isMobile?"display-none height-0":"";return i("div",{class:`${this._isMobile?"calcite-mode-light":"calcite-mode-dark"} ${o}`},i("calcite-panel",null,this._isMobile?void 0:i("div",{class:`display-flex align-items-center ${a}`,slot:"header-content"},i("calcite-icon",{icon:"information",scale:"s"}),i("div",{class:"padding-inline-start-75"},this._translations.information)),i("calcite-action",{class:a,disabled:this._tableOnly,icon:e,id:s,onClick:()=>this._togglePopup(),slot:"header-actions-end",text:""}),this._tableOnly?void 0:i("calcite-tooltip",{class:l,label:"",placement:"bottom","reference-element":s},i("span",null,h)),this._getCardNode()))}_togglePopup(){this._expandPopup=!this._expandPopup}_getCardNode(){return i("div",{class:"width-50 height-full "+("dark"===this.theme?"calcite-mode-dark":"calcite-mode-light")},i("card-manager",{class:(this._expandPopup||this._isMobile?"height-full":"height-50")+" width-full",isMobile:this._isMobile,mapView:null==this?void 0:this._mapView,zoomAndScrollToSelected:this.zoomAndScrollToSelected}))}_getTable(t,e,s){const h=s?"visibility-hidden":"",o=this._getTableSizeClass(t,e),a=this._getDividerIcon(t,e),d=e?this._translations.close:this._translations.open,n="toggle-layout",r=this.defaultWebmap&&this.defaultLayer;return i("calcite-shell",{class:`${o} ${h} border-bottom`},this._isMobile?void 0:i("calcite-action-bar",{class:"border-sides",expandDisabled:!0,layout:t===l.HORIZONTAL||this.classicGrid?"horizontal":"vertical",slot:this.classicGrid&&t!==l.VERTICAL?"footer":this.classicGrid&&t===l.VERTICAL?"panel-end":t===l.HORIZONTAL?"header":"panel-start"},i("calcite-action",{class:"toggle-node",icon:a,id:n,onClick:()=>this._toggleLayout(),text:""}),i("calcite-tooltip",{label:d,placement:"bottom","reference-element":n},i("span",null,d))),i("div",{class:"width-full height-full position-relative"},i("layer-table",{defaultGlobalId:r?this._defaultGlobalId:void 0,defaultLayerId:r?this.defaultLayer:"",defaultOid:r&&!this.defaultGlobalId?this._defaultOid:void 0,enableAutoRefresh:this.enableAutoRefresh,enableCSV:this.enableCSV,enableColumnReorder:this.enableColumnReorder,enableInlineEdit:this.enableInlineEdit,enableShare:this.enableShare,isMobile:this._isMobile,mapInfo:this._mapInfo,mapView:null==this?void 0:this._mapView,onlyShowUpdatableLayers:this.onlyShowUpdatableLayers,ref:t=>this._layerTable=t,shareIncludeEmbed:this.shareIncludeEmbed,shareIncludeSocial:this.shareIncludeSocial,showNewestFirst:this.showNewestFirst,zoomAndScrollToSelected:this.zoomAndScrollToSelected})))}_onResize(){this._isMobile=this.el.offsetWidth<1024,this._layoutMode=this._isMobile?l.HORIZONTAL:l.GRID,this._panelOpen=!0}_toggleLayout(){this._panelOpen=!this._panelOpen}showHideMapPopupAndTable(t){this.hideMap=t,this._expandPopup=!1,this._hideTable=t,this._hideFooter=t}_getMapInfo(t){let i;return this.mapInfos.some((e=>{if(e.id===t)return i=e,!0})),Object.assign({},i)}async _setMapView(){this._mapInfo=this._getMapInfo(this._mapChange.id),this._mapView=this._mapChange.mapView,this._initMapZoom(),this._mapView.popupEnabled=!1,this._defaultCenter&&this._defaultLevel&&(await this._mapView.goTo({center:this._defaultCenter,zoom:this._defaultLevel}),this._defaultCenter=void 0,this._defaultLevel=void 0)}_initMapZoom(){this.enableZoom?this.enableZoom&&this._mapView.ui.add({component:"zoom",position:"top-left",index:0}):this._mapView.ui.remove("zoom")}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}get el(){return s(this)}static get watchers(){return{defaultCenter:["defaultCenterWatchHandler"],defaultGlobalId:["defaultGlobalIdWatchHandler"],defaultOid:["defaultOidWatchHandler"],defaultLevel:["defaultLevelWatchHandler"],enableZoom:["enableZoomWatchHandler"],_isMobile:["_isMobileWatchHandler"]}}};o.style=":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.padding-1-2{padding:0.5rem}.display-flex{display:flex}.width-full{width:100%}.width-1-2{position:relative;width:50%}.width-1-3{position:relative;width:33.33%}.width-2-3{position:relative;width:66.66%}.width-0{width:0}.height-full{height:100%}.height-1-2{position:relative;height:50%}.height-0{height:0}.toggle-node{width:51px;height:51px}.overflow-hidden{overflow:hidden}.flex-column{flex-direction:column}.border{border:1px solid var(--calcite-color-border-3)}.border-bottom{border-bottom:1px solid var(--calcite-color-border-3)}.border-sides{border-left:1px solid var(--calcite-color-border-3);border-right:1px solid var(--calcite-color-border-3)}.position-relative{position:relative}.height-50{height:50%}.adjusted-height-50{height:calc(50% - 25px)}.adjusted-height-100{height:calc(100% - 50px)}.adjusted-height-100-50{height:calc(100% - 50px)}.display-none{display:none}.height-53{height:53px}.position-absolute-53{position:absolute;top:53px}.display-grid{display:grid}.height-50-px{height:50px}.padding-inline-start-75{padding-inline-start:0.75rem}.align-items-center{align-items:center}.esri-floor-filter__close-levels-button{width:40px !important;height:40px !important}.esri-floor-filter__level-button{width:40px !important;height:40px !important}.esri-floor-filter__browse-button{width:40px !important;height:40px !important}.position-absolute-50{position:absolute;top:50px;bottom:0px;left:0px;right:0px}.position-absolute-0{position:absolute;top:0px;bottom:0px;left:0px;right:0px}.visibility-hidden{visibility:hidden;height:0px}";export{o as crowdsource_manager}
|