@esri/solutions-components 0.7.30 → 0.7.31

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.
Files changed (60) hide show
  1. package/dist/assets/t9n/crowdsource-reporter/resources.json +7 -5
  2. package/dist/assets/t9n/crowdsource-reporter/resources_en.json +7 -5
  3. package/dist/assets/t9n/feature-list/resources.json +1 -1
  4. package/dist/assets/t9n/feature-list/resources_en.json +1 -1
  5. package/dist/assets/t9n/layer-list/resources.json +1 -1
  6. package/dist/assets/t9n/layer-list/resources_en.json +1 -1
  7. package/dist/cjs/{calcite-flow_4.cjs.entry.js → calcite-flow_5.cjs.entry.js} +235 -19
  8. package/dist/cjs/card-manager_3.cjs.entry.js +1 -1
  9. package/dist/cjs/crowdsource-reporter.cjs.entry.js +221 -32
  10. package/dist/cjs/{downloadUtils-83c6d3c3.js → downloadUtils-10e0de31.js} +2 -2
  11. package/dist/cjs/{index.es-bd1a93b2.js → index.es-72dc7ab9.js} +1 -1
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/cjs/map-select-tools_3.cjs.entry.js +1 -1
  14. package/dist/cjs/public-notification.cjs.entry.js +1 -1
  15. package/dist/cjs/solutions-components.cjs.js +1 -1
  16. package/dist/collection/collection-manifest.json +1 -0
  17. package/dist/collection/components/create-feature/create-feature.css +23 -0
  18. package/dist/collection/components/create-feature/create-feature.js +361 -0
  19. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +10 -1
  20. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +260 -33
  21. package/dist/collection/components/feature-list/feature-list.js +1 -0
  22. package/dist/collection/components/layer-list/layer-list.js +60 -16
  23. package/dist/collection/demos/crowdsource-reporter.html +26 -11
  24. package/dist/collection/utils/downloadUtils.js +1 -1
  25. package/dist/collection/utils/downloadUtils.ts +1 -1
  26. package/dist/components/create-feature.d.ts +11 -0
  27. package/dist/components/create-feature.js +11 -0
  28. package/dist/components/create-feature2.js +226 -0
  29. package/dist/components/crowdsource-reporter.js +297 -90
  30. package/dist/components/downloadUtils.js +1 -1
  31. package/dist/components/feature-list2.js +1 -0
  32. package/dist/components/layer-list2.js +38 -17
  33. package/dist/esm/{calcite-flow_4.entry.js → calcite-flow_5.entry.js} +235 -20
  34. package/dist/esm/card-manager_3.entry.js +1 -1
  35. package/dist/esm/crowdsource-reporter.entry.js +222 -33
  36. package/dist/esm/{downloadUtils-d070a467.js → downloadUtils-d297078f.js} +2 -2
  37. package/dist/esm/{index.es-d48535a2.js → index.es-3b4fa9d0.js} +1 -1
  38. package/dist/esm/loader.js +1 -1
  39. package/dist/esm/map-select-tools_3.entry.js +1 -1
  40. package/dist/esm/public-notification.entry.js +1 -1
  41. package/dist/esm/solutions-components.js +1 -1
  42. package/dist/solutions-components/demos/crowdsource-reporter.html +26 -11
  43. package/dist/solutions-components/{p-f120ff40.entry.js → p-09ec8c8f.entry.js} +1 -1
  44. package/dist/solutions-components/{p-55b835a1.js → p-103c5318.js} +2 -2
  45. package/dist/solutions-components/{p-309cdea1.entry.js → p-57d49d15.entry.js} +1 -1
  46. package/dist/solutions-components/{p-b913a4fd.js → p-8ec25bf4.js} +1 -1
  47. package/dist/solutions-components/{p-f22ff57e.entry.js → p-921f21d5.entry.js} +1 -1
  48. package/dist/solutions-components/p-b4e2cac4.entry.js +17 -0
  49. package/dist/solutions-components/p-bb6562ab.entry.js +6 -0
  50. package/dist/solutions-components/solutions-components.esm.js +1 -1
  51. package/dist/solutions-components/utils/downloadUtils.ts +1 -1
  52. package/dist/types/components/create-feature/create-feature.d.ts +107 -0
  53. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +132 -12
  54. package/dist/types/components/feature-list/feature-list.d.ts +1 -0
  55. package/dist/types/components/layer-list/layer-list.d.ts +6 -0
  56. package/dist/types/components.d.ts +89 -0
  57. package/dist/types/preact.d.ts +6 -0
  58. package/package.json +1 -1
  59. package/dist/solutions-components/p-2f162664.entry.js +0 -6
  60. package/dist/solutions-components/p-94ee3ef7.entry.js +0 -17
@@ -0,0 +1,107 @@
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
+ import { EventEmitter } from "../../stencil-public-runtime";
18
+ export declare class CreateFeature {
19
+ el: HTMLCreateFeatureElement;
20
+ /**
21
+ * esri/views/MapView: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html
22
+ */
23
+ mapView: __esri.MapView;
24
+ /**
25
+ * string: Layer id of the feature layer in which the new feature is to be created
26
+ */
27
+ selectedLayerId: string;
28
+ /**
29
+ * esri/widgets/Editor: https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor.html
30
+ * The Editor constructor
31
+ */
32
+ protected Editor: typeof import("esri/widgets/Editor");
33
+ /**
34
+ * esri/widgets/Editor: https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor.html
35
+ * The Editor instance
36
+ */
37
+ protected _editor: __esri.Editor;
38
+ /**
39
+ * HTMLDivElement: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDivElement
40
+ */
41
+ protected _editContainer: HTMLDivElement;
42
+ /**
43
+ * Called each time the mapView prop is changed.
44
+ */
45
+ mapViewWatchHandler(): Promise<void>;
46
+ /**
47
+ * Destroy the Editor widget instance
48
+ * @returns Promise that resolves when the operation is complete
49
+ */
50
+ close(): Promise<void>;
51
+ /**
52
+ * Submit the created feature
53
+ * @returns Promise that resolves when the operation is complete
54
+ */
55
+ submit(): Promise<void>;
56
+ /**
57
+ * Emitted on demand when the feature is created successfully
58
+ */
59
+ success: EventEmitter<void>;
60
+ /**
61
+ * Emitted on demand when the feature creation is failed
62
+ */
63
+ fail: EventEmitter<Error>;
64
+ /**
65
+ * Emitted on demand when drawing is completed
66
+ */
67
+ drawComplete: EventEmitter<void>;
68
+ /**
69
+ * StencilJS: Called once just after the component is first connected to the DOM.
70
+ * @returns Promise when complete
71
+ */
72
+ componentWillLoad(): Promise<void>;
73
+ /**
74
+ * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
75
+ */
76
+ componentDidLoad(): Promise<void>;
77
+ /**
78
+ * Renders the component.
79
+ */
80
+ render(): any;
81
+ /**
82
+ * Init Editor widget and starts the create workflow
83
+ */
84
+ protected init(): Promise<void>;
85
+ /**
86
+ * Load esri javascript api modules
87
+ * @returns Promise resolving when function is done
88
+ * @protected
89
+ */
90
+ protected initModules(): Promise<void>;
91
+ /**
92
+ * Display editor widget to create the new feature
93
+ * @protected
94
+ */
95
+ protected createEditorWidget(): Promise<void>;
96
+ /**
97
+ * Start creating the feature
98
+ * @protected
99
+ */
100
+ protected startCreate(): Promise<void>;
101
+ /**
102
+ * On creation of feature emit the event that the feature is created
103
+ * @param evt feature submit event
104
+ * @protected
105
+ */
106
+ protected submitted(evt: any): Promise<void>;
107
+ }
@@ -15,7 +15,7 @@
15
15
  */
16
16
  /// <reference types="arcgis-js-api" />
17
17
  import { VNode, EventEmitter } from "../../stencil-public-runtime";
18
- import { IMapChange, IMapInfo, ISearchConfiguration, theme } from "../../utils/interfaces";
18
+ import { IMapChange, IMapClick, IMapInfo, ISearchConfiguration, theme } from "../../utils/interfaces";
19
19
  import CrowdsourceReporter_T9n from "../../assets/t9n/crowdsource-reporter/resources.json";
20
20
  export declare class CrowdsourceReporter {
21
21
  el: HTMLCrowdsourceReporterElement;
@@ -59,6 +59,14 @@ export declare class CrowdsourceReporter {
59
59
  * esri/views/MapView: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html
60
60
  */
61
61
  mapView: __esri.MapView;
62
+ /**
63
+ * string: Layer id of the feature from URL params
64
+ */
65
+ layerId: string;
66
+ /**
67
+ * string: Object id of the feature from URL params
68
+ */
69
+ objectId: string;
62
70
  /**
63
71
  * string: The word(s) to display in the reports submit button
64
72
  */
@@ -125,9 +133,21 @@ export declare class CrowdsourceReporter {
125
133
  */
126
134
  _hasValidLayers: boolean;
127
135
  /**
128
- * string: The selected feature layer's name from the layer's list
129
- */
136
+ * string: The selected feature layer's name from the layer's list
137
+ */
130
138
  _selectedLayerName: string;
139
+ /**
140
+ * boolean: When true show the success message in the panel
141
+ */
142
+ _reportSubmitted: boolean;
143
+ /**
144
+ * boolean: When true show the submit and cancel button
145
+ */
146
+ _showSubmitCancelButton: boolean;
147
+ /**
148
+ * string: Error message when feature creation fails
149
+ */
150
+ _featureCreationFailedErrorMsg: string;
131
151
  /**
132
152
  * IMapChange: The current map change details
133
153
  */
@@ -140,6 +160,10 @@ export declare class CrowdsourceReporter {
140
160
  * number: zoom level the map should go to
141
161
  */
142
162
  protected _defaultLevel: number;
163
+ /**
164
+ * __esri.FeatureLayer[]: Valid layers from the current map
165
+ */
166
+ protected _validLayers: __esri.FeatureLayer[];
143
167
  /**
144
168
  * string: The selected feature layer's id from the layer's list
145
169
  */
@@ -156,6 +180,22 @@ export declare class CrowdsourceReporter {
156
180
  * IHandle: The map click handle
157
181
  */
158
182
  protected _mapClickHandle: IHandle;
183
+ /**
184
+ * HTMLCreateFeatureElement: Create Feature component instance
185
+ */
186
+ protected _createFeature: HTMLCreateFeatureElement;
187
+ /**
188
+ * HTMLLayerListElement: Create Layer list component instance
189
+ */
190
+ protected _layerList: HTMLLayerListElement;
191
+ /**
192
+ * HTMLInstantAppsSocialShareElement: Share element
193
+ */
194
+ protected _shareNode: HTMLInstantAppsSocialShareElement;
195
+ /**
196
+ * ObjectId of the feature currently shown in the details
197
+ */
198
+ protected _currentFeatureId: string;
159
199
  /**
160
200
  * Called each time the mapView prop is changed.
161
201
  */
@@ -186,6 +226,12 @@ export declare class CrowdsourceReporter {
186
226
  * @protected
187
227
  */
188
228
  protected _initModules(): Promise<void>;
229
+ /**
230
+ * Set the selected layer id and layer name
231
+ * @param layerId string layerId of the selected layer
232
+ * @param layerName string layerName of the selected layer
233
+ */
234
+ protected setSelectedLayer(layerId: string, layerName: string): void;
189
235
  /**
190
236
  * Get the reporter app functionality
191
237
  * @protected
@@ -197,22 +243,76 @@ export declare class CrowdsourceReporter {
197
243
  * @protected
198
244
  */
199
245
  protected getLayerListFlowItem(): Node;
246
+ /**
247
+ * Get the layer list for creating a report
248
+ * @returns Choose category flow item
249
+ * @protected
250
+ */
251
+ protected getChooseCategoryFlowItem(): Node;
252
+ /**
253
+ * Get Feature create form of the selected feature layer
254
+ * @returns feature create form
255
+ * @protected
256
+ */
257
+ protected getFeatureCreateFlowItem(): Node;
258
+ /**
259
+ * When drawing of incident location completed on map show the submit and cancel button
260
+ * @protected
261
+ */
262
+ protected showSubmitCancelButton(): void;
263
+ /**
264
+ * On back from create feature, call submit editor to destroy the Editor widget instance
265
+ * @protected
266
+ */
267
+ protected onSubmitButtonClick(): void;
268
+ /**
269
+ * On back from create feature, call close editor to destroy the Editor widget instance
270
+ * @protected
271
+ */
272
+ protected backFromCreateFeaturePanel(): void;
273
+ /**
274
+ * On creating the feature is failed, show the error message
275
+ * @param evt Event which has feature failed message
276
+ * @protected
277
+ */
278
+ protected createFeatureFailed(evt: CustomEvent): void;
279
+ /**
280
+ * On submit report navigate to the layer list home page and refresh the layer list
281
+ * @protected
282
+ */
283
+ protected navigateHomePage(): void;
284
+ /**
285
+ * Update the selected layer id and name
286
+ * @param evt Event which has details of selected layerId and layerName
287
+ * @protected
288
+ */
289
+ protected highlightSelectedLayer(evt: CustomEvent): void;
290
+ /**
291
+ * On next button click open the feature create flow item
292
+ * @protected
293
+ */
294
+ protected navigateToCreateFeature(): Promise<void>;
295
+ /**
296
+ * On report an incident button click open the create a report panel with the layer list
297
+ * @protected
298
+ */
299
+ protected navigateToChooseCategory(): void;
200
300
  /**
201
301
  * When layer list is loaded, we will receive the list of layers, if its means we don't have any valid layer to be listed
202
302
  * @param evt Event which has list of layers
203
303
  * @protected
204
304
  */
205
- protected layerListLoaded(evt: CustomEvent): void;
305
+ protected layerListLoaded(evt: CustomEvent): Promise<void>;
206
306
  /**On click of layer list item show feature list
207
307
  * @param evt Event which has details of selected layerId and layerName
208
308
  * @protected
209
309
  */
210
310
  protected displayFeaturesList(evt: CustomEvent): void;
211
311
  /**
212
- * On back from feature list navigate to the Layer list panel
312
+ * On back from selected panel navigate to the previous panel
213
313
  * @protected
214
314
  */
215
- protected backFromFeatureList(): void;
315
+ protected backFromSelectedPanel(): void;
216
316
  /**
217
317
  * Toggle side panel in case of mobile mode
218
318
  * @protected
@@ -236,13 +336,24 @@ export declare class CrowdsourceReporter {
236
336
  * @returns Node
237
337
  */
238
338
  protected getFeatureDetailsFlowItem(): Node;
339
+ /**
340
+ * Sets the selected features and updates the first feature as the current selected feature
341
+ * @param features Graphics array of the features selected
342
+ */
343
+ protected setSelectedFeatures(features: __esri.Graphic[]): void;
344
+ /**
345
+ * Set the object id of the current selected feature, and also updates the current selected layer details
346
+ * @param selectedFeature Graphic currently shown in feature details
347
+ */
348
+ protected setCurrentFeature(selectedFeature?: __esri.Graphic): void;
239
349
  /**
240
350
  * On Feature details change update the Layer title and the current selected layer id
241
351
  * @param evt Event hold the details of current feature graphic in the info-card
242
352
  */
243
- protected featureDetailsChanged(evt: any): void;
353
+ protected featureDetailsChanged(evt: CustomEvent): void;
244
354
  /**
245
355
  * Returns the action button to Expand/Collapse side panel in mobile mode
356
+ * @protected
246
357
  */
247
358
  protected getActionToExpandCollapsePanel(): Node;
248
359
  /**
@@ -254,21 +365,30 @@ export declare class CrowdsourceReporter {
254
365
  * Handle map click event
255
366
  * @param layers Array of layerIds
256
367
  *
257
- * @protected
368
+ * @protected
258
369
  */
259
- protected handleMapClick(layers: string[]): void;
370
+ protected handleMapClick(): void;
260
371
  /**
261
372
  * On map click do hitTest and get the clicked graphics of valid layers and show feature details
262
- * @param event
263
- * @param layers
373
+ * @param event IMapClick map click event details
264
374
  *
265
375
  * @protected
266
376
  */
267
- protected onMapClick(event: any, layers: string[]): Promise<void>;
377
+ protected onMapClick(event: IMapClick): Promise<void>;
268
378
  /**
269
379
  * Fetches the component's translations
270
380
  * @returns Promise when complete
271
381
  * @protected
272
382
  */
273
383
  protected _getTranslations(): Promise<void>;
384
+ /**
385
+ * Updates the share url for current selected feature
386
+ * @returns
387
+ * @protected
388
+ */
389
+ protected _updateShareURL(): string;
390
+ /**
391
+ * Navigates to selected features detail based on the URL params
392
+ */
393
+ protected loadFeatureFromURLParams(): Promise<void>;
274
394
  }
@@ -91,6 +91,7 @@ export declare class FeatureList {
91
91
  render(): any;
92
92
  /**
93
93
  * Initialize the features list using the selected layer
94
+ * @protected
94
95
  */
95
96
  protected initializeFeatureItems(): Promise<void>;
96
97
  /**
@@ -23,6 +23,7 @@ interface ILayerDetailsHash {
23
23
  name: string;
24
24
  formattedFeatureCount: string;
25
25
  supportsUpdate: boolean;
26
+ supportsAdd: boolean;
26
27
  }
27
28
  export declare class LayerList {
28
29
  el: HTMLLayerListElement;
@@ -66,6 +67,11 @@ export declare class LayerList {
66
67
  * ILayerItemHash: id/name lookup
67
68
  */
68
69
  protected _layerItemsHash: ILayerItemsHash;
70
+ /**
71
+ * Refresh the layer list which will fetch the latest layer count and update the list
72
+ * @returns Promise that resolves when the operation is complete
73
+ */
74
+ refresh(): Promise<void>;
69
75
  /**
70
76
  * Emitted on demand when feature layer clicked with details layerId and layerName
71
77
  */
@@ -86,6 +86,26 @@ export namespace Components {
86
86
  */
87
87
  "zoomAndScrollToSelected": boolean;
88
88
  }
89
+ interface CreateFeature {
90
+ /**
91
+ * Destroy the Editor widget instance
92
+ * @returns Promise that resolves when the operation is complete
93
+ */
94
+ "close": () => Promise<void>;
95
+ /**
96
+ * esri/views/MapView: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html
97
+ */
98
+ "mapView": __esri.MapView;
99
+ /**
100
+ * string: Layer id of the feature layer in which the new feature is to be created
101
+ */
102
+ "selectedLayerId": string;
103
+ /**
104
+ * Submit the created feature
105
+ * @returns Promise that resolves when the operation is complete
106
+ */
107
+ "submit": () => Promise<void>;
108
+ }
89
109
  interface CrowdsourceManager {
90
110
  /**
91
111
  * IBasemapConfig: List of any basemaps to filter out from the basemap widget
@@ -245,6 +265,10 @@ export namespace Components {
245
265
  * boolean: When true the application will be in mobile mode, controls the mobile or desktop view
246
266
  */
247
267
  "isMobile": boolean;
268
+ /**
269
+ * string: Layer id of the feature from URL params
270
+ */
271
+ "layerId": string;
248
272
  /**
249
273
  * string[]: list of layer ids
250
274
  */
@@ -261,6 +285,10 @@ export namespace Components {
261
285
  * esri/views/MapView: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html
262
286
  */
263
287
  "mapView": __esri.MapView;
288
+ /**
289
+ * string: Object id of the feature from URL params
290
+ */
291
+ "objectId": string;
264
292
  /**
265
293
  * string: The word(s) to display in the reports submit button
266
294
  */
@@ -452,6 +480,11 @@ export namespace Components {
452
480
  * string: Error message to be displayed when no layers found
453
481
  */
454
482
  "noLayerErrorMsg"?: string;
483
+ /**
484
+ * Refresh the layer list which will fetch the latest layer count and update the list
485
+ * @returns Promise that resolves when the operation is complete
486
+ */
487
+ "refresh": () => Promise<void>;
455
488
  /**
456
489
  * boolean: if true display's feature count for each layer
457
490
  */
@@ -1268,6 +1301,10 @@ export interface BufferToolsCustomEvent<T> extends CustomEvent<T> {
1268
1301
  detail: T;
1269
1302
  target: HTMLBufferToolsElement;
1270
1303
  }
1304
+ export interface CreateFeatureCustomEvent<T> extends CustomEvent<T> {
1305
+ detail: T;
1306
+ target: HTMLCreateFeatureElement;
1307
+ }
1271
1308
  export interface CrowdsourceReporterCustomEvent<T> extends CustomEvent<T> {
1272
1309
  detail: T;
1273
1310
  target: HTMLCrowdsourceReporterElement;
@@ -1402,6 +1439,25 @@ declare global {
1402
1439
  prototype: HTMLCardManagerElement;
1403
1440
  new (): HTMLCardManagerElement;
1404
1441
  };
1442
+ interface HTMLCreateFeatureElementEventMap {
1443
+ "success": void;
1444
+ "fail": Error;
1445
+ "drawComplete": void;
1446
+ }
1447
+ interface HTMLCreateFeatureElement extends Components.CreateFeature, HTMLStencilElement {
1448
+ addEventListener<K extends keyof HTMLCreateFeatureElementEventMap>(type: K, listener: (this: HTMLCreateFeatureElement, ev: CreateFeatureCustomEvent<HTMLCreateFeatureElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
1449
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1450
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1451
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1452
+ removeEventListener<K extends keyof HTMLCreateFeatureElementEventMap>(type: K, listener: (this: HTMLCreateFeatureElement, ev: CreateFeatureCustomEvent<HTMLCreateFeatureElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
1453
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1454
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1455
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1456
+ }
1457
+ var HTMLCreateFeatureElement: {
1458
+ prototype: HTMLCreateFeatureElement;
1459
+ new (): HTMLCreateFeatureElement;
1460
+ };
1405
1461
  interface HTMLCrowdsourceManagerElement extends Components.CrowdsourceManager, HTMLStencilElement {
1406
1462
  }
1407
1463
  var HTMLCrowdsourceManagerElement: {
@@ -1953,6 +2009,7 @@ declare global {
1953
2009
  "basemap-gallery": HTMLBasemapGalleryElement;
1954
2010
  "buffer-tools": HTMLBufferToolsElement;
1955
2011
  "card-manager": HTMLCardManagerElement;
2012
+ "create-feature": HTMLCreateFeatureElement;
1956
2013
  "crowdsource-manager": HTMLCrowdsourceManagerElement;
1957
2014
  "crowdsource-reporter": HTMLCrowdsourceReporterElement;
1958
2015
  "deduct-calculator": HTMLDeductCalculatorElement;
@@ -2082,6 +2139,28 @@ declare namespace LocalJSX {
2082
2139
  */
2083
2140
  "zoomAndScrollToSelected"?: boolean;
2084
2141
  }
2142
+ interface CreateFeature {
2143
+ /**
2144
+ * esri/views/MapView: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html
2145
+ */
2146
+ "mapView"?: __esri.MapView;
2147
+ /**
2148
+ * Emitted on demand when drawing is completed
2149
+ */
2150
+ "onDrawComplete"?: (event: CreateFeatureCustomEvent<void>) => void;
2151
+ /**
2152
+ * Emitted on demand when the feature creation is failed
2153
+ */
2154
+ "onFail"?: (event: CreateFeatureCustomEvent<Error>) => void;
2155
+ /**
2156
+ * Emitted on demand when the feature is created successfully
2157
+ */
2158
+ "onSuccess"?: (event: CreateFeatureCustomEvent<void>) => void;
2159
+ /**
2160
+ * string: Layer id of the feature layer in which the new feature is to be created
2161
+ */
2162
+ "selectedLayerId"?: string;
2163
+ }
2085
2164
  interface CrowdsourceManager {
2086
2165
  /**
2087
2166
  * IBasemapConfig: List of any basemaps to filter out from the basemap widget
@@ -2241,6 +2320,10 @@ declare namespace LocalJSX {
2241
2320
  * boolean: When true the application will be in mobile mode, controls the mobile or desktop view
2242
2321
  */
2243
2322
  "isMobile"?: boolean;
2323
+ /**
2324
+ * string: Layer id of the feature from URL params
2325
+ */
2326
+ "layerId"?: string;
2244
2327
  /**
2245
2328
  * string[]: list of layer ids
2246
2329
  */
@@ -2257,6 +2340,10 @@ declare namespace LocalJSX {
2257
2340
  * esri/views/MapView: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html
2258
2341
  */
2259
2342
  "mapView"?: __esri.MapView;
2343
+ /**
2344
+ * string: Object id of the feature from URL params
2345
+ */
2346
+ "objectId"?: string;
2260
2347
  /**
2261
2348
  * Emitted when toggle panel button is clicked in reporter
2262
2349
  */
@@ -3302,6 +3389,7 @@ declare namespace LocalJSX {
3302
3389
  "basemap-gallery": BasemapGallery;
3303
3390
  "buffer-tools": BufferTools;
3304
3391
  "card-manager": CardManager;
3392
+ "create-feature": CreateFeature;
3305
3393
  "crowdsource-manager": CrowdsourceManager;
3306
3394
  "crowdsource-reporter": CrowdsourceReporter;
3307
3395
  "deduct-calculator": DeductCalculator;
@@ -3357,6 +3445,7 @@ declare module "@stencil/core" {
3357
3445
  "basemap-gallery": LocalJSX.BasemapGallery & JSXBase.HTMLAttributes<HTMLBasemapGalleryElement>;
3358
3446
  "buffer-tools": LocalJSX.BufferTools & JSXBase.HTMLAttributes<HTMLBufferToolsElement>;
3359
3447
  "card-manager": LocalJSX.CardManager & JSXBase.HTMLAttributes<HTMLCardManagerElement>;
3448
+ "create-feature": LocalJSX.CreateFeature & JSXBase.HTMLAttributes<HTMLCreateFeatureElement>;
3360
3449
  "crowdsource-manager": LocalJSX.CrowdsourceManager & JSXBase.HTMLAttributes<HTMLCrowdsourceManagerElement>;
3361
3450
  "crowdsource-reporter": LocalJSX.CrowdsourceReporter & JSXBase.HTMLAttributes<HTMLCrowdsourceReporterElement>;
3362
3451
  "deduct-calculator": LocalJSX.DeductCalculator & JSXBase.HTMLAttributes<HTMLDeductCalculatorElement>;
@@ -502,6 +502,12 @@ declare module "preact/src/jsx" {
502
502
 
503
503
  "card-manager": JSX.SolutionsCardManager & JSXInternal.HTMLAttributes<HTMLSolutionsCardManagerElement>
504
504
 
505
+ "create-feature": Omit<JSX.SolutionsCreateFeature, "onSuccess" | "onFail" | "onDrawComplete"> & JSXInternal.HTMLAttributes<HTMLSolutionsCreateFeatureElement> & {
506
+ "onsuccess"?: (event: CustomEvent<any>) => void;
507
+ "onfail"?: (event: CustomEvent<any>) => void;
508
+ "ondrawComplete"?: (event: CustomEvent<any>) => void;
509
+ }
510
+
505
511
  "crowdsource-manager": JSX.SolutionsCrowdsourceManager & JSXInternal.HTMLAttributes<HTMLSolutionsCrowdsourceManagerElement>
506
512
 
507
513
  "crowdsource-reporter": Omit<JSX.SolutionsCrowdsourceReporter, "onTogglePanel"> & JSXInternal.HTMLAttributes<HTMLSolutionsCrowdsourceReporterElement> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solutions-components",
3
- "version": "0.7.30",
3
+ "version": "0.7.31",
4
4
  "description": "Web Components for Esri's Solutions Applications",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -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,c as i,h as s,H as e,g as h}from"./p-78780f63.js";import{l as a,g as o}from"./p-e902ba19.js";import{a as l}from"./p-2c382841.js";import"./p-d918ec36.js";import"./p-e1a4994d.js";import"./p-c1cf3ebc.js";const c=class{constructor(s){t(this,s),this.togglePanel=i(this,"togglePanel",7),this.description=void 0,this.isMobile=void 0,this.enableAnonymousAccess=void 0,this.enableAnonymousComments=void 0,this.enableComments=void 0,this.enableLogin=void 0,this.enableNewReports=void 0,this.layers=void 0,this.loginTitle=void 0,this.mapView=void 0,this.reportButtonText=void 0,this.reportsHeader=void 0,this.reportSubmittedMessage=void 0,this.searchConfiguration=void 0,this.showComments=void 0,this.defaultWebmap="",this.enableSearch=!0,this.enableHome=!0,this.mapInfos=[],this.theme="light",this.enableZoom=!0,this._mapInfo=void 0,this._flowItems=["layer-list"],this._sidePanelCollapsed=!1,this._translations=void 0,this._hasValidLayers=!1,this._selectedLayerName=void 0}async isMobileWatchHandler(){this._sidePanelCollapsed=!1}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.setMapView()}))}async componentWillLoad(){await this._initModules(),await this._getTranslations()}render(){return s(e,null,s("div",null,s("calcite-shell",{"content-behind":!0},this._getReporter())))}async _initModules(){const[t]=await a(["esri/core/reactiveUtils"]);this.reactiveUtils=t}_getReporter(){const t=[];return this._flowItems.forEach((i=>{switch(i){case"layer-list":t.push(this.getLayerListFlowItem());break;case"feature-list":t.push(this.getFeatureListFlowItem(this._selectedLayerId,this._selectedLayerName));break;case"feature-details":t.push(this.getFeatureDetailsFlowItem())}})),s("calcite-panel",{class:"width-full "+("dark"===this.theme?"calcite-mode-dark":"calcite-mode-light")},this.mapView?s("calcite-flow",null,(null==t?void 0:t.length)>0&&t):s("calcite-loader",{scale:"m"}))}getLayerListFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this.reportsHeader},this._hasValidLayers&&s("calcite-action",{icon:"sort-ascending-arrow",slot:this.isMobile?"header-menu-actions":"header-actions-end",text:this._translations.sort,"text-enabled":this.isMobile}),this._hasValidLayers&&s("calcite-action",{icon:"filter",slot:this.isMobile?"header-menu-actions":"header-actions-end",text:this._translations.filter,"text-enabled":this.isMobile}),this.isMobile&&this.getActionToExpandCollapsePanel(),this._hasValidLayers&&this.enableNewReports&&s("calcite-button",{appearance:"secondary",slot:"footer",width:"full"},this.reportButtonText),s("calcite-panel",{"full-height":!0,"full-width":!0},s("layer-list",{class:"height-full",layers:this.layers,mapView:this.mapView,noLayerErrorMsg:this._translations.noLayerToDisplayErrorMsg,onLayerSelect:this.displayFeaturesList.bind(this),onLayersListLoaded:this.layerListLoaded.bind(this),showFeatureCount:!0,showNextIcon:!0})))}layerListLoaded(t){const i=t.detail;this.handleMapClick(i),this._hasValidLayers=i.length>0}displayFeaturesList(t){this._selectedLayerId=t.detail.layerId,this._selectedLayerName=t.detail.layerName,this._flowItems=[...this._flowItems,"feature-list"]}backFromFeatureList(){const t=[...this._flowItems];t.pop(),this._flowItems=[...t]}toggleSidePanel(){this._sidePanelCollapsed=!this._sidePanelCollapsed,this.togglePanel.emit(this._sidePanelCollapsed)}async onFeatureSelectFromList(t){this._selectedFeature=[t.detail],this._flowItems=[...this._flowItems,"feature-details"]}getFeatureListFlowItem(t,i){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:i,onCalciteFlowItemBack:this.backFromFeatureList.bind(this)},s("calcite-action",{icon:"sort-ascending-arrow",slot:this.isMobile?"header-menu-actions":"header-actions-end",text:this._translations.sort,"text-enabled":this.isMobile}),s("calcite-action",{icon:"filter",slot:this.isMobile?"header-menu-actions":"header-actions-end",text:this._translations.filter,"text-enabled":this.isMobile}),this.isMobile&&this.getActionToExpandCollapsePanel(),this.enableNewReports&&s("calcite-button",{appearance:"secondary",slot:"footer",width:"full"},this.reportButtonText),s("calcite-panel",{"full-height":!0},s("feature-list",{class:"height-full",highlightOnMap:!0,mapView:this.mapView,noFeaturesFoundMsg:this._translations.featureErrorMsg,onFeatureSelect:this.onFeatureSelectFromList.bind(this),pageSize:30,selectedLayerId:t})))}getFeatureDetailsFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._selectedLayerName,onCalciteFlowItemBack:this.backFromFeatureList.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),s("calcite-action",{icon:"share",slot:"header-actions-end",text:this._translations.share}),s("calcite-panel",{"full-height":!0},s("info-card",{allowEditing:!1,graphics:this._selectedFeature,isLoading:!1,isMobile:!1,mapView:this.mapView,onSelectionChanged:this.featureDetailsChanged.bind(this),zoomAndScrollToSelected:!0})))}featureDetailsChanged(t){this._selectedLayerId=t.detail[0].layer.id,this._selectedLayerName=t.detail[0].layer.title}getActionToExpandCollapsePanel(){return s("calcite-action",{icon:this._sidePanelCollapsed?"chevrons-up":"chevrons-down",onClick:this.toggleSidePanel.bind(this),slot:"header-actions-end",text:this._sidePanelCollapsed?this._translations.expand:this._translations.collapse})}async setMapView(){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)}handleMapClick(t){this._mapClickHandle&&this._mapClickHandle.remove(),this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",(i=>{this.onMapClick(i,t)}))}async onMapClick(t,i){this.mapView.popupEnabled=!1;const s=await l(this.mapView),e=[];s.forEach((t=>{i.includes(t.id)&&e.push(t)}));const h={include:e},a=await this.mapView.hitTest(t,h);if(a.results.length>0){const t=[];a.results.forEach((function(i){"graphic"===i.type&&t.push(i.graphic)})),this._selectedFeature=t,this._flowItems=this._flowItems.length&&"feature-details"!==this._flowItems[this._flowItems.length-1]?[...this._flowItems,"feature-details"]:[...this._flowItems]}}async _getTranslations(){const t=await o(this.el);this._translations=t[0]}get el(){return h(this)}static get watchers(){return{isMobile:["isMobileWatchHandler"],mapView:["mapViewWatchHandler"]}}};c.style=":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.width-full{width:100% !important}.width-0{width:0}.height-full{height:100% !important}.height-0{height:0}.overflow-hidden{overflow:hidden}.border{border:1px solid var(--calcite-color-border-3)}.error-msg{padding:10px}";export{c as crowdsource_reporter}
@@ -1,17 +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,g as s,c as e,H as a,F as o}from"./p-78780f63.js";import{c as n}from"./p-5b566d55.js";import{c as l,s as c,a as r}from"./p-f10944e6.js";import{a as h}from"./p-83fd31d5.js";import{c as d,u as p,d as m}from"./p-0c97de08.js";import{c as u,d as f}from"./p-de281b08.js";import{c as g,s as v,d as b,u as y}from"./p-981e9549.js";import{S as w}from"./p-35c58364.js";import{P as x}from"./p-515a319e.js";import{g as k,c as L,h as C,d as j,a as I}from"./p-2c382841.js";import{g as z,f as D}from"./p-e902ba19.js";import"./p-fcefdfff.js";import"./p-29d68474.js";import"./p-c92fff33.js";import"./p-1e2ffee3.js";import"./p-c1cf3ebc.js";import"./p-d918ec36.js";import"./p-e1a4994d.js";
7
- /*!
8
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
9
- * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
10
- * v2.0.0
11
- */const F=class{constructor(i){t(this,i),this.itemMutationObserver=n("mutation",(()=>this.updateFlowProps())),this.getFlowDirection=(t,i)=>t&&i>1||t>1?i<t?"retreating":"advancing":null,this.updateFlowProps=()=>{const{customItemSelectors:t,el:i,items:s}=this,e=Array.from(i.querySelectorAll("calcite-flow-item"+(t?`,${t}`:""))).filter((t=>t.closest("calcite-flow")===i)),a=s.length,o=e.length,n=e[o-1],l=e[o-2];if(o&&n&&e.forEach((t=>{t.showBackButton=t===n&&o>1,t.hidden=t!==n})),l&&(l.menuOpen=!1),this.items=e,a!==o){const t=this.getFlowDirection(a,o);this.itemCount=o,this.flowDirection=t}},this.customItemSelectors=void 0,this.flowDirection=null,this.itemCount=0,this.items=[]}async back(){const{items:t}=this,i=t[t.length-1];if(!i)return;const s=i.beforeBack?i.beforeBack:()=>Promise.resolve();try{await s.call(i)}catch(t){return}return i.remove(),i}async setFocus(){await l(this);const{items:t}=this,i=t[t.length-1];return null==i?void 0:i.setFocus()}connectedCallback(){var t;null===(t=this.itemMutationObserver)||void 0===t||t.observe(this.el,{childList:!0,subtree:!0}),this.updateFlowProps()}async componentWillLoad(){c(this)}componentDidLoad(){r(this)}disconnectedCallback(){var t;null===(t=this.itemMutationObserver)||void 0===t||t.disconnect()}async handleItemBackClick(t){if(!t.defaultPrevented)return await this.back(),this.setFocus()}render(){const{flowDirection:t}=this;return i("div",{class:{frame:!0,"frame--advancing":"advancing"===t,"frame--retreating":"retreating"===t}},i("slot",null))}get el(){return s(this)}};F.style=":host{box-sizing:border-box;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host{position:relative;display:flex;inline-size:100%;flex:1 1 auto;align-items:stretch;overflow:hidden;background-color:transparent}:host .frame{position:relative;margin:0px;display:flex;inline-size:100%;flex:1 1 auto;flex-direction:column;align-items:stretch;padding:0px}:host ::slotted(calcite-flow-item),:host ::slotted(calcite-panel){block-size:100%}:host ::slotted(.calcite-match-height:last-child){display:flex;flex:1 1 auto;overflow:hidden}:host .frame--advancing{animation:calcite-frame-advance var(--calcite-animation-timing)}:host .frame--retreating{animation:calcite-frame-retreat var(--calcite-animation-timing)}@keyframes calcite-frame-advance{0%{--tw-bg-opacity:0.5;transform:translate3d(50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}@keyframes calcite-frame-retreat{0%{--tw-bg-opacity:0.5;transform:translate3d(-50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}:host([hidden]){display:none}[hidden]{display:none}";
12
- /*!
13
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
14
- * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
15
- * v2.0.0
16
- */
17
- const S=class{constructor(i){t(this,i),this.calciteFlowItemBack=e(this,"calciteFlowItemBack",7),this.calciteFlowItemScroll=e(this,"calciteFlowItemScroll",6),this.calciteFlowItemClose=e(this,"calciteFlowItemClose",6),this.calciteFlowItemToggle=e(this,"calciteFlowItemToggle",6),this.handlePanelScroll=t=>{t.stopPropagation(),this.calciteFlowItemScroll.emit()},this.handlePanelClose=t=>{t.stopPropagation(),this.calciteFlowItemClose.emit()},this.handlePanelToggle=t=>{t.stopPropagation(),this.collapsed=t.target.collapsed,this.calciteFlowItemToggle.emit()},this.backButtonClick=()=>{this.calciteFlowItemBack.emit()},this.setBackRef=t=>{this.backButtonEl=t},this.setContainerRef=t=>{this.containerEl=t},this.closable=!1,this.closed=!1,this.collapsed=!1,this.collapseDirection="down",this.collapsible=!1,this.beforeBack=void 0,this.description=void 0,this.disabled=!1,this.heading=void 0,this.headingLevel=void 0,this.loading=!1,this.menuOpen=!1,this.messageOverrides=void 0,this.messages=void 0,this.showBackButton=!1,this.defaultMessages=void 0,this.effectiveLocale=""}onMessagesChange(){}connectedCallback(){d(this),u(this),g(this)}async componentWillLoad(){await v(this),c(this)}componentDidRender(){p(this)}disconnectedCallback(){m(this),f(this),b(this)}componentDidLoad(){r(this)}effectiveLocaleChange(){y(this,this.effectiveLocale)}async setFocus(){await l(this);const{backButtonEl:t,containerEl:i}=this;return t?t.setFocus():i?i.setFocus():void 0}async scrollContentTo(t){var i;await(null===(i=this.containerEl)||void 0===i?void 0:i.scrollContentTo(t))}renderBackButton(){const{el:t}=this,s="rtl"===h(t),{showBackButton:e,backButtonClick:a,messages:o}=this,n=o.back;return e?i("calcite-action",{"aria-label":n,class:"back-button",icon:s?"chevron-right":"chevron-left",key:"flow-back-button",onClick:a,scale:"s",slot:"header-actions-start",text:n,title:n,ref:this.setBackRef}):null}render(){const{collapsed:t,collapseDirection:s,collapsible:e,closable:o,closed:n,description:l,disabled:c,heading:r,headingLevel:h,loading:d,menuOpen:p,messages:m}=this;return i(a,null,i("calcite-panel",{closable:o,closed:n,collapseDirection:s,collapsed:t,collapsible:e,description:l,disabled:c,heading:r,headingLevel:h,loading:d,menuOpen:p,messageOverrides:m,onCalcitePanelClose:this.handlePanelClose,onCalcitePanelScroll:this.handlePanelScroll,onCalcitePanelToggle:this.handlePanelToggle,ref:this.setContainerRef},this.renderBackButton(),i("slot",{name:"action-bar",slot:w.actionBar}),i("slot",{name:"header-actions-start",slot:w.headerActionsStart}),i("slot",{name:"header-actions-end",slot:w.headerActionsEnd}),i("slot",{name:"header-content",slot:w.headerContent}),i("slot",{name:"header-menu-actions",slot:w.headerMenuActions}),i("slot",{name:"fab",slot:w.fab}),i("slot",{name:"footer-actions",slot:w.footerActions}),i("slot",{name:"footer",slot:w.footer}),i("slot",null)))}static get assetsDirs(){return["assets"]}get el(){return s(this)}static get watchers(){return{messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}};S.style=":host{box-sizing:border-box;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host([disabled]){cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{position:relative;display:flex;inline-size:100%;flex:1 1 auto}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.back-button{border-width:0px;border-style:solid;border-color:var(--calcite-color-border-3);border-inline-end-width:1px}calcite-panel{--calcite-panel-footer-padding:var(--calcite-flow-item-footer-padding);--calcite-panel-header-border-block-end:var(--calcite-flow-item-header-border-block-end)}:host([hidden]){display:none}[hidden]{display:none}";const P=class{constructor(i){t(this,i),this.featureSelect=e(this,"featureSelect",7),this.selectedLayerId=void 0,this.mapView=void 0,this.noFeaturesFoundMsg=void 0,this.pageSize=100,this.highlightOnMap=!1,this._featureItems=[],this._featuresCount=0,this._isLoading=!1,this._translations=void 0}async selectedLayerWatchHandler(){this._selectedLayer=await k(this.mapView,this.selectedLayerId),await this.initializeFeatureItems()}async componentWillLoad(){await this._getTranslations(),this._isLoading=!0,this._popupUtils=new x,this.mapView&&this.selectedLayerId&&(this._selectedLayer=await k(this.mapView,this.selectedLayerId))}async componentDidLoad(){await this.initializeFeatureItems()}render(){return i("calcite-panel",{"full-height":!0,"full-width":!0},this._isLoading&&i("calcite-loader",{scale:"m"}),0===this._featureItems.length&&!this._isLoading&&i("calcite-notice",{class:"error-msg",icon:"feature-details",kind:"info",open:!0},i("div",{slot:"message"},this.noFeaturesFoundMsg?this.noFeaturesFoundMsg:this._translations.featureErrorMsg)),i("calcite-list",{"selection-appearance":"border","selection-mode":"single"},!this._isLoading&&this._featureItems.length>0&&this._featureItems),this._featuresCount>this.pageSize&&i("div",{class:"width-full",slot:"footer"},i("calcite-pagination",{class:"pagination","full-width":!0,onCalcitePaginationChange:this.pageChanged.bind(this),"page-size":this.pageSize,"start-item":"1","total-items":this._featuresCount})))}async initializeFeatureItems(){this._selectedLayer&&(this._isLoading=!0,this._featureItems=await this.queryPage(0),this._featuresCount=await this._selectedLayer.queryFeatureCount(),this._isLoading=!1)}async pageChanged(t){this._isLoading=!0,this._highlightHandle&&(this._highlightHandle.remove(),this._highlightHandle=null);const i=t.target.startItem-1;this._featureItems=await this.queryPage(i),this._isLoading=!1}async featureClicked(t,i){if(this.highlightOnMap&&this._highlightHandle&&(this._highlightHandle.remove(),this._highlightHandle=null),t.target.selected){if(this.highlightOnMap){const i=Number(t.target.value),s=await L(this.mapView,this.selectedLayerId);this._highlightHandle=await C([i],s,this.mapView,!0)}this.featureSelect.emit(i)}}async queryPage(t){const i=this._selectedLayer,s=i.objectIdField,e={start:t,num:this.pageSize,outFields:["*"],returnGeometry:!0,where:i.definitionExpression,outSpatialReference:this.mapView.spatialReference.toJSON()};s&&(e.orderByFields=[s.toString()+" DESC"]);const a=await i.queryFeatures(e);return await this.createFeatureItem(a)}async createFeatureItem(t){const i=(null==t?void 0:t.features).map((async t=>{const i=await this._popupUtils.getPopupTitle(t,this.mapView.map);return this.getFeatureItem(t,i)}));return Promise.all(i)}getFeatureItem(t,s){const e=t.attributes[this._selectedLayer.objectIdField].toString();return i("calcite-list-item",{onCalciteListItemSelect:i=>{this.featureClicked(i,t)},value:e},i("div",{class:"popup-title",slot:"content-start"},s=null!=s?s:e),i("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}async _getTranslations(){const t=await z(this.el);this._translations=t[0]}get el(){return s(this)}static get watchers(){return{selectedLayerId:["selectedLayerWatchHandler"]}}};P.style=":host{display:block}.width-full{width:100%}.pagination{display:flex;justify-content:center}.error-msg{padding:10px;width:calc(100% - 20px)}.popup-title{font-weight:500;padding:10px 12px}";const B=class{constructor(i){t(this,i),this.layerSelect=e(this,"layerSelect",7),this.layersListLoaded=e(this,"layersListLoaded",7),this.mapView=void 0,this.layers=void 0,this.noLayerErrorMsg=void 0,this.showFeatureCount=!0,this.showNextIcon=!1,this._noLayersToDisplay=!1,this._mapLayerIds=[],this._isLoading=!1,this._translations=void 0}async componentWillLoad(){await this._getTranslations(),this._isLoading=!0}async componentDidLoad(){await this.setLayers(),this._isLoading=!1}render(){return i(o,null,this._isLoading&&i("calcite-loader",{scale:"m"}),!this._isLoading&&this.mapView&&this._noLayersToDisplay&&i("calcite-notice",{class:"error-msg",icon:"layers-reference",kind:"danger",open:!0},i("div",{slot:"title"},this._translations.error),i("div",{slot:"message"},this.noLayerErrorMsg?this.noLayerErrorMsg:this._translations.noLayerToDisplayErrorMsg)),!this._isLoading&&this.mapView&&i("calcite-list",{"selection-appearance":"border","selection-mode":this.showNextIcon?"none":"single"},this.renderLayerList()))}async setLayers(){this.mapView&&await this.initLayerHash()}async initLayerHash(){const t=[];this._layerItemsHash=await j(this.mapView,!0);const i=await I(this.mapView);this.showFeatureCount&&i.forEach((async i=>{var s,e;if("feature"===(null==i?void 0:i.type)&&(null==i?void 0:i.editingEnabled)&&(null===(e=null===(s=null==i?void 0:i.capabilities)||void 0===s?void 0:s.operations)||void 0===e?void 0:e.supportsUpdate)){const s=i.createQuery(),e=i.queryFeatureCount(s);t.push(e),e.then((async t=>{const s=isNaN(t)?"":await D(t,{places:0,api:4,type:"decimal"});this._layerItemsHash[i.id].formattedFeatureCount=s}))}})),await Promise.all(t).then((()=>{const t=this.getEditableIds(this._layerItemsHash);this._mapLayerIds=t.reverse(),this.handleNoLayersToDisplay()}),(()=>{this._mapLayerIds=[],this.handleNoLayersToDisplay()}))}handleNoLayersToDisplay(){this._noLayersToDisplay=!(this._mapLayerIds.length>0),this.layersListLoaded.emit(this._mapLayerIds)}getEditableIds(t){var i;const s=(null===(i=this.layers)||void 0===i?void 0:i.length)>0?this.layers:[];return Object.keys(t).reduce(((i,e)=>{let a=t[e].supportsUpdate;return(null==s?void 0:s.length)>0&&(a=s.indexOf(e)>-1&&t[e].supportsUpdate),a&&i.push(e),i}),[])}renderLayerList(){return this._mapLayerIds.length>0&&this._mapLayerIds.reduce(((t,i)=>(this._layerItemsHash[i]&&t.push(this.getLayerListItem(i)),t)),[])}getLayerListItem(t){const s=this._layerItemsHash[t].formattedFeatureCount;return i("calcite-list-item",{onCalciteListItemSelect:()=>{this.onLayerItemSelected(t)}},i("div",{class:"layer-name",slot:"content-start"},this._layerItemsHash[t].name),this.showFeatureCount&&void 0!==s&&""!==s&&i("div",{class:this.showNextIcon?"":"feature-count",slot:"content-end"},"("+s+")"),this.showNextIcon&&i("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}onLayerItemSelected(t){this.layerSelect.emit({layerId:t,layerName:this._layerItemsHash[t].name})}async _getTranslations(){const t=await z(this.el);this._translations=t[0]}get el(){return s(this)}};B.style=":host{display:block}.error-msg{padding:10px}.layer-name{font-weight:500;padding:10px 12px}.feature-count{padding-right:12px}";export{F as calcite_flow,S as calcite_flow_item,P as feature_list,B as layer_list}