@esri/solutions-components 0.3.9 → 0.4.1

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 (79) hide show
  1. package/dist/assets/t9n/public-notification/resources.json +0 -2
  2. package/dist/assets/t9n/public-notification/resources_en.json +0 -2
  3. package/dist/cjs/buffer-tools_6.cjs.entry.js +5 -2
  4. package/dist/cjs/calcite-input-message_5.cjs.entry.js +1342 -18
  5. package/dist/cjs/{calcite-input-message.calcite-notice.map-select-tools.pdf-download.refine-selection-cd8ad61e.js → downloadUtils-27dbd8b9.js} +205 -1337
  6. package/dist/cjs/{index.es-e89ba2a1.js → index.es-40d341ed.js} +3 -13
  7. package/dist/cjs/layer-table.cjs.entry.js +5 -15
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/public-notification.cjs.entry.js +23 -2
  10. package/dist/cjs/solutions-components.cjs.js +1 -1
  11. package/dist/collection/components/layer-table/layer-table.js +4 -16
  12. package/dist/collection/components/map-search/map-search.js +1 -1
  13. package/dist/collection/components/map-select-tools/map-select-tools.js +73 -17
  14. package/dist/collection/components/pdf-download/pdf-download.js +9 -76
  15. package/dist/collection/components/public-notification/public-notification.js +45 -3
  16. package/dist/collection/components/refine-selection/refine-selection.js +1 -1
  17. package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +13 -5
  18. package/dist/collection/demos/buffer-tools.html +1 -1
  19. package/dist/collection/utils/csvUtils.js +4 -0
  20. package/dist/collection/utils/csvUtils.ts +7 -0
  21. package/dist/collection/utils/downloadUtils.js +181 -0
  22. package/dist/collection/utils/downloadUtils.ts +235 -0
  23. package/dist/collection/utils/interfaces.ts +8 -1
  24. package/dist/collection/utils/pdfUtils.js +7 -0
  25. package/dist/collection/utils/pdfUtils.ts +13 -2
  26. package/dist/components/downloadUtils.js +2279 -0
  27. package/dist/components/index.es.js +1 -1
  28. package/dist/components/layer-table.js +5 -16
  29. package/dist/components/map-layer-picker2.js +1 -1
  30. package/dist/components/map-search.js +1 -1
  31. package/dist/components/map-select-tools2.js +69 -19
  32. package/dist/components/pdf-download2.js +10 -2124
  33. package/dist/components/public-notification.js +24 -3
  34. package/dist/components/queryUtils.js +1 -1
  35. package/dist/components/refine-selection-tools2.js +6 -3
  36. package/dist/components/refine-selection2.js +1 -1
  37. package/dist/esm/buffer-tools_6.entry.js +6 -3
  38. package/dist/esm/calcite-combobox_3.entry.js +1 -1
  39. package/dist/esm/calcite-input-message_5.entry.js +1341 -13
  40. package/dist/esm/{calcite-input-message.calcite-notice.map-select-tools.pdf-download.refine-selection-ddd74bd6.js → downloadUtils-76e38a94.js} +206 -1335
  41. package/dist/esm/{index.es-8edafdb2.js → index.es-489f4f08.js} +2 -12
  42. package/dist/esm/layer-table.entry.js +6 -16
  43. package/dist/esm/loader.js +1 -1
  44. package/dist/esm/{mapViewUtils-63e118f8.js → mapViewUtils-02696ab6.js} +1 -1
  45. package/dist/esm/public-notification.entry.js +24 -3
  46. package/dist/esm/solutions-components.js +1 -1
  47. package/dist/solutions-components/demos/buffer-tools.html +1 -1
  48. package/dist/solutions-components/{p-cc2e20c8.js → p-1bfd07e3.js} +1 -1
  49. package/dist/solutions-components/{p-117174e8.entry.js → p-335fce8c.entry.js} +1 -1
  50. package/dist/solutions-components/p-4ef94c6b.entry.js +6 -0
  51. package/dist/solutions-components/p-5d27b47d.entry.js +17 -0
  52. package/dist/solutions-components/p-92cb569a.entry.js +6 -0
  53. package/dist/solutions-components/{p-2a96314a.entry.js → p-a3b60bc9.entry.js} +2 -2
  54. package/dist/solutions-components/{p-98884f44.js → p-bff8aa4e.js} +3 -3
  55. package/dist/solutions-components/p-caa7e7a7.js +437 -0
  56. package/dist/solutions-components/solutions-components.esm.js +1 -1
  57. package/dist/solutions-components/utils/csvUtils.ts +7 -0
  58. package/dist/solutions-components/utils/downloadUtils.ts +235 -0
  59. package/dist/solutions-components/utils/interfaces.ts +8 -1
  60. package/dist/solutions-components/utils/pdfUtils.ts +13 -2
  61. package/dist/types/components/json-editor/assets/monaco-editor/monaco.d.ts +8262 -0
  62. package/dist/types/components/map-select-tools/map-select-tools.d.ts +19 -1
  63. package/dist/types/components/pdf-download/pdf-download.d.ts +0 -18
  64. package/dist/types/components/public-notification/public-notification.d.ts +10 -0
  65. package/dist/types/components/refine-selection-tools/refine-selection-tools.d.ts +2 -2
  66. package/dist/types/components.d.ts +6 -2
  67. package/dist/types/preact.d.ts +2 -1
  68. package/dist/types/utils/downloadUtils.d.ts +40 -0
  69. package/dist/types/utils/interfaces.d.ts +6 -2
  70. package/dist/types/utils/pdfUtils.d.ts +3 -1
  71. package/package.json +1 -1
  72. package/dist/cjs/csvUtils-3a56c6d8.js +0 -54
  73. package/dist/components/csvUtils.js +0 -52
  74. package/dist/esm/csvUtils-23b5418f.js +0 -52
  75. package/dist/solutions-components/p-15f9b0a0.entry.js +0 -6
  76. package/dist/solutions-components/p-238db156.js +0 -416
  77. package/dist/solutions-components/p-3069e3b7.js +0 -21
  78. package/dist/solutions-components/p-6d28f991.entry.js +0 -6
  79. package/dist/solutions-components/p-c5341977.entry.js +0 -6
@@ -152,6 +152,12 @@ export declare class MapSelectTools {
152
152
  * string: A label to help uniquely identify the selection set
153
153
  */
154
154
  protected _selectionLabel: string;
155
+ /**
156
+ * number[]: When empty or undefined the geometries will be used for selection
157
+ * When it has values they will be used directly when no buffer is provided
158
+ * see https://github.com/Esri/solutions-components/issues/148
159
+ */
160
+ protected _skipGeomOIDs: number[];
155
161
  /**
156
162
  * Called each time the geometries prop is changed.
157
163
  *
@@ -201,6 +207,10 @@ export declare class MapSelectTools {
201
207
  * Handle changes to the selection sets
202
208
  */
203
209
  labelChange(event: CustomEvent): void;
210
+ /**
211
+ * Handle changes to the search configuration
212
+ */
213
+ searchConfigurationChangeChanged(event: CustomEvent): void;
204
214
  /**
205
215
  * Listen to changes in the sketch graphics
206
216
  *
@@ -282,6 +292,12 @@ export declare class MapSelectTools {
282
292
  * @protected
283
293
  */
284
294
  protected _workflowChange(evt: CustomEvent): void;
295
+ /**
296
+ * Highlight the features in the map based on OIDs when skipOIDs have been defined
297
+ *
298
+ * @protected
299
+ */
300
+ protected _highlightWithOIDsOrGeoms(): Promise<void>;
285
301
  /**
286
302
  * Highlight the features in the map
287
303
  *
@@ -327,10 +343,12 @@ export declare class MapSelectTools {
327
343
  * @param type worflow type
328
344
  * @param graphics graphics to be used for selection
329
345
  * @param label selection label
346
+ * @param useOIDs indicates if the OIDs should override the geometry for selection
347
+ * @param oids list of IDs to select when useGeoms is false
330
348
  *
331
349
  * @protected
332
350
  */
333
- protected _updateSelection(type: EWorkflowType, graphics: __esri.Graphic[], label: string): void;
351
+ protected _updateSelection(type: EWorkflowType, graphics: __esri.Graphic[], label: string, useOIDs: boolean, oids?: number[]): void;
334
352
  /**
335
353
  * Fetches the component's translations
336
354
  *
@@ -73,15 +73,6 @@ export declare class PdfDownload {
73
73
  * @protected
74
74
  */
75
75
  protected _initModules(): Promise<void>;
76
- /**
77
- * Converts the text of a custom popup into a multiline label specification; conversion splits text into
78
- * lines on <br>s, and removes HTML tags. It does not handle Arcade and related records.
79
- *
80
- * @param popupInfo Layer's popupInfo structure containing description, fieldInfos, and expressionInfos, e.g.,
81
- * "<div style='text-align: left;'>{NAME}<br />{STREET}<br />{CITY}, {STATE} {ZIP} <br /></div>"
82
- * @return Label spec
83
- */
84
- _convertPopupToLabelSpec(popupInfo: string): string[];
85
76
  /**
86
77
  * Gets the formatted pdf export size text
87
78
  *
@@ -97,15 +88,6 @@ export declare class PdfDownload {
97
88
  * @protected
98
89
  */
99
90
  protected _getTranslations(): Promise<void>;
100
- /**
101
- * Creates labels from items.
102
- *
103
- * @param ids List of ids to download
104
- * @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
105
- * @param includeHeaderNames Add the label format at the front of the list of generated labels
106
- * @returns Promise resolving when function is done
107
- */
108
- protected _prepareLabels(ids: number[], removeDuplicates: boolean, includeHeaderNames?: boolean): Promise<string[][]>;
109
91
  /**
110
92
  * Renders the pdf export size options
111
93
  *
@@ -171,6 +171,12 @@ export declare class PublicNotification {
171
171
  * Called each time the mapView prop is changed.
172
172
  */
173
173
  mapViewWatchHandler(v: __esri.MapView): Promise<void>;
174
+ /**
175
+ * Called each time the searchConfiguration prop is changed.
176
+ *
177
+ * @returns Promise when complete
178
+ */
179
+ watchSearchConfigurationHandler(newValue: ISearchConfiguration, oldValue: ISearchConfiguration): Promise<void>;
174
180
  /**
175
181
  * Called each time the selectionSets prop is changed.
176
182
  */
@@ -183,6 +189,10 @@ export declare class PublicNotification {
183
189
  * Emitted on demand when a buffer is generated.
184
190
  */
185
191
  labelChange: EventEmitter<string>;
192
+ /**
193
+ * Emitted on demand when searchConfiguration gets a new value
194
+ */
195
+ searchConfigurationChange: EventEmitter<ISearchConfiguration>;
186
196
  /**
187
197
  * Handle changes to the buffer distance value
188
198
  */
@@ -15,7 +15,7 @@
15
15
  */
16
16
  /// <reference types="arcgis-js-api" />
17
17
  import { EventEmitter, VNode } from "../../stencil-public-runtime";
18
- import { ERefineMode, ESelectionMode, ESelectionType, IRefineOperation, ISelectionSet } from "../../utils/interfaces";
18
+ import { ERefineMode, ESelectionMode, ESelectionType, IRefineOperation, IRefineSelectionEvent, ISelectionSet } from "../../utils/interfaces";
19
19
  import RefineSelectionTools_T9n from "../../assets/t9n/refine-selection-tools/resources.json";
20
20
  export declare class RefineSelectionTools {
21
21
  el: HTMLRefineSelectionToolsElement;
@@ -135,7 +135,7 @@ export declare class RefineSelectionTools {
135
135
  /**
136
136
  * Emitted on demand when selection graphics change.
137
137
  */
138
- refineSelectionGraphicsChange: EventEmitter<any[]>;
138
+ refineSelectionGraphicsChange: EventEmitter<IRefineSelectionEvent>;
139
139
  /**
140
140
  * Emitted on demand when selection ids change
141
141
  */
@@ -5,7 +5,7 @@
5
5
  * It contains typing information for all components that exist in this project.
6
6
  */
7
7
  import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
- import { DistanceUnit, EExpandType, ERefineMode, ESelectionMode, ESketchType, EWorkflowType, IInfoCardValues, IInventoryItem, IMapInfo, IMediaCardValues, ISearchConfiguration, ISearchResult, ISelectionSet, ISolutionSpatialReferenceInfo, ISpatialRefRepresentation, IValueChange, SelectionMode } from "./utils/interfaces";
8
+ import { DistanceUnit, EExpandType, ERefineMode, ESelectionMode, ESketchType, EWorkflowType, IInfoCardValues, IInventoryItem, IMapInfo, IMediaCardValues, IRefineSelectionEvent, ISearchConfiguration, ISearchResult, ISelectionSet, ISolutionSpatialReferenceInfo, ISpatialRefRepresentation, IValueChange, SelectionMode } from "./utils/interfaces";
9
9
  import { UserSession } from "@esri/solution-common";
10
10
  export namespace Components {
11
11
  interface AddRecordModal {
@@ -1211,6 +1211,10 @@ declare namespace LocalJSX {
1211
1211
  * Emitted on demand when a buffer is generated.
1212
1212
  */
1213
1213
  "onLabelChange"?: (event: PublicNotificationCustomEvent<string>) => void;
1214
+ /**
1215
+ * Emitted on demand when searchConfiguration gets a new value
1216
+ */
1217
+ "onSearchConfigurationChange"?: (event: PublicNotificationCustomEvent<ISearchConfiguration>) => void;
1214
1218
  /**
1215
1219
  * ISearchConfiguration: Configuration details for the Search widget
1216
1220
  */
@@ -1292,7 +1296,7 @@ declare namespace LocalJSX {
1292
1296
  /**
1293
1297
  * Emitted on demand when selection graphics change.
1294
1298
  */
1295
- "onRefineSelectionGraphicsChange"?: (event: RefineSelectionToolsCustomEvent<any[]>) => void;
1299
+ "onRefineSelectionGraphicsChange"?: (event: RefineSelectionToolsCustomEvent<IRefineSelectionEvent>) => void;
1296
1300
  /**
1297
1301
  * Emitted on demand when selection ids change
1298
1302
  */
@@ -466,8 +466,9 @@ declare module "preact/src/jsx" {
466
466
 
467
467
  "pdf-download": JSX.SolutionsPdfDownload & JSXInternal.HTMLAttributes<HTMLSolutionsPdfDownloadElement>
468
468
 
469
- "public-notification": Omit<JSX.SolutionsPublicNotification, "onLabelChange"> & JSXInternal.HTMLAttributes<HTMLSolutionsPublicNotificationElement> & {
469
+ "public-notification": Omit<JSX.SolutionsPublicNotification, "onLabelChange" | "onSearchConfigurationChange"> & JSXInternal.HTMLAttributes<HTMLSolutionsPublicNotificationElement> & {
470
470
  "onlabelChange"?: (event: CustomEvent<any>) => void;
471
+ "onsearchConfigurationChange"?: (event: CustomEvent<any>) => void;
471
472
  }
472
473
 
473
474
  "refine-selection": Omit<JSX.SolutionsRefineSelection, "onSelectionSetsChanged"> & JSXInternal.HTMLAttributes<HTMLSolutionsRefineSelectionElement> & {
@@ -0,0 +1,40 @@
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 { ILabel } from "./pdfUtils";
18
+ export { ILabel } from "./pdfUtils";
19
+ /**
20
+ * Downloads csv of mailing labels for the provided list of ids
21
+ *
22
+ * @param layer Layer providing features and attributes for download
23
+ * @param ids List of ids to download
24
+ * @param formatUsingLayerPopup When true, the layer's popup is used to choose attributes for each column; when false,
25
+ * all attributes are exported
26
+ * @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
27
+ * @param addColumnTitle Indicates if column headings should be included in output
28
+ * @returns Promise resolving when function is done
29
+ */
30
+ export declare function downloadCSV(layer: __esri.FeatureLayer, ids: number[], formatUsingLayerPopup: boolean, removeDuplicates?: boolean, addColumnTitle?: boolean): Promise<void>;
31
+ /**
32
+ * Downloads csv of mailing labels for the provided list of ids
33
+ *
34
+ * @param layer Layer providing features and attributes for download
35
+ * @param ids List of ids to download
36
+ * @param removeDuplicates When true a single label is generated when multiple featues have a shared address value
37
+ * @param labelPageDescription Provides PDF page layout info
38
+ * @returns Promise resolving when function is done
39
+ */
40
+ export declare function downloadPDF(layer: __esri.FeatureLayer, ids: number[], removeDuplicates: boolean, labelPageDescription: ILabel): Promise<void>;
@@ -86,7 +86,7 @@ export interface ISearchConfiguration {
86
86
  searchAllEnabled?: boolean;
87
87
  sources: Array<ILocatorSourceConfigItem | ILayerSourceConfigItem>;
88
88
  }
89
- interface ISearchSourceConfigItem {
89
+ export interface ISearchSourceConfigItem {
90
90
  maxResults: number;
91
91
  maxSuggestions: number;
92
92
  minSuggestCharacters: number;
@@ -335,6 +335,11 @@ export interface ISelectionSet {
335
335
  refineIds: IRefineIds;
336
336
  redoStack?: IRefineOperation[];
337
337
  undoStack?: IRefineOperation[];
338
+ skipGeomOIDs?: number[];
339
+ }
340
+ export interface IRefineSelectionEvent {
341
+ graphics: __esri.Graphic[];
342
+ useOIDs: boolean;
338
343
  }
339
344
  export interface IRefineIds {
340
345
  addIds: number[];
@@ -360,4 +365,3 @@ export interface IMapInfo {
360
365
  id: string;
361
366
  name: string;
362
367
  }
363
- export {};
@@ -13,10 +13,12 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import * as PDFLabels from "../assets/arcgis-pdf-creator/PDFLabels";
17
+ export { ILabel } from "../assets/arcgis-pdf-creator/PDFLabels";
16
18
  /**
17
19
  * Exports a PDF of labels.
18
20
  *
19
21
  * @param labels Labels to write
20
22
  * @param labelPageDescription Page format to use for labels
21
23
  */
22
- export declare function exportPDF(labels: string[][], labelPageDescription: any): void;
24
+ export declare function exportPDF(labels: string[][], labelPageDescription: PDFLabels.ILabel): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solutions-components",
3
- "version": "0.3.9",
3
+ "version": "0.4.1",
4
4
  "description": "Web Components for Esri's Solutions Applications",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -1,54 +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
- 'use strict';
7
-
8
- /** @license
9
- * Copyright 2022 Esri
10
- *
11
- * Licensed under the Apache License, Version 2.0 (the "License");
12
- * you may not use this file except in compliance with the License.
13
- * You may obtain a copy of the License at
14
- *
15
- * http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- * See the License for the specific language governing permissions and
21
- * limitations under the License.
22
- */
23
- /**
24
- * Export a csv of the attributes from the features that match the provided ids
25
- *
26
- * @param labels Labels to write
27
- */
28
- function exportCSV(labels) {
29
- // Format values to string so it doesn't get tripped up when a value has a comma
30
- // another option could be to export with a different delimiter
31
- const outputLines = labels.map(label => Object.values(label).map(v => `"${v}"`).join(",") + "\r\n");
32
- _downloadCSVFile(outputLines, `notify-${Date.now().toString()}`);
33
- }
34
- /**
35
- * Download the CSV file
36
- *
37
- * @param outputLines Lines of output to write to file
38
- * @param fileTitle Title (without file extension) to use for file; defaults to "export"
39
- *
40
- * @see {@link https://medium.com/@danny.pule/export-json-to-csv-file-using-javascript-a0b7bc5b00d2}
41
- */
42
- function _downloadCSVFile(outputLines, fileTitle) {
43
- const link = document.createElement("a");
44
- if (link.download !== undefined) {
45
- link.href = URL.createObjectURL(new Blob(outputLines, { type: "text/csv;charset=utf-8;" }));
46
- link.download = `${fileTitle}.csv` || "export.csv";
47
- link.style.visibility = "hidden";
48
- document.body.appendChild(link);
49
- link.click();
50
- document.body.removeChild(link);
51
- }
52
- }
53
-
54
- exports.exportCSV = exportCSV;
@@ -1,52 +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
- /** @license
7
- * Copyright 2022 Esri
8
- *
9
- * Licensed under the Apache License, Version 2.0 (the "License");
10
- * you may not use this file except in compliance with the License.
11
- * You may obtain a copy of the License at
12
- *
13
- * http://www.apache.org/licenses/LICENSE-2.0
14
- *
15
- * Unless required by applicable law or agreed to in writing, software
16
- * distributed under the License is distributed on an "AS IS" BASIS,
17
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
- * See the License for the specific language governing permissions and
19
- * limitations under the License.
20
- */
21
- /**
22
- * Export a csv of the attributes from the features that match the provided ids
23
- *
24
- * @param labels Labels to write
25
- */
26
- function exportCSV(labels) {
27
- // Format values to string so it doesn't get tripped up when a value has a comma
28
- // another option could be to export with a different delimiter
29
- const outputLines = labels.map(label => Object.values(label).map(v => `"${v}"`).join(",") + "\r\n");
30
- _downloadCSVFile(outputLines, `notify-${Date.now().toString()}`);
31
- }
32
- /**
33
- * Download the CSV file
34
- *
35
- * @param outputLines Lines of output to write to file
36
- * @param fileTitle Title (without file extension) to use for file; defaults to "export"
37
- *
38
- * @see {@link https://medium.com/@danny.pule/export-json-to-csv-file-using-javascript-a0b7bc5b00d2}
39
- */
40
- function _downloadCSVFile(outputLines, fileTitle) {
41
- const link = document.createElement("a");
42
- if (link.download !== undefined) {
43
- link.href = URL.createObjectURL(new Blob(outputLines, { type: "text/csv;charset=utf-8;" }));
44
- link.download = `${fileTitle}.csv` || "export.csv";
45
- link.style.visibility = "hidden";
46
- document.body.appendChild(link);
47
- link.click();
48
- document.body.removeChild(link);
49
- }
50
- }
51
-
52
- export { exportCSV as e };
@@ -1,52 +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
- /** @license
7
- * Copyright 2022 Esri
8
- *
9
- * Licensed under the Apache License, Version 2.0 (the "License");
10
- * you may not use this file except in compliance with the License.
11
- * You may obtain a copy of the License at
12
- *
13
- * http://www.apache.org/licenses/LICENSE-2.0
14
- *
15
- * Unless required by applicable law or agreed to in writing, software
16
- * distributed under the License is distributed on an "AS IS" BASIS,
17
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
- * See the License for the specific language governing permissions and
19
- * limitations under the License.
20
- */
21
- /**
22
- * Export a csv of the attributes from the features that match the provided ids
23
- *
24
- * @param labels Labels to write
25
- */
26
- function exportCSV(labels) {
27
- // Format values to string so it doesn't get tripped up when a value has a comma
28
- // another option could be to export with a different delimiter
29
- const outputLines = labels.map(label => Object.values(label).map(v => `"${v}"`).join(",") + "\r\n");
30
- _downloadCSVFile(outputLines, `notify-${Date.now().toString()}`);
31
- }
32
- /**
33
- * Download the CSV file
34
- *
35
- * @param outputLines Lines of output to write to file
36
- * @param fileTitle Title (without file extension) to use for file; defaults to "export"
37
- *
38
- * @see {@link https://medium.com/@danny.pule/export-json-to-csv-file-using-javascript-a0b7bc5b00d2}
39
- */
40
- function _downloadCSVFile(outputLines, fileTitle) {
41
- const link = document.createElement("a");
42
- if (link.download !== undefined) {
43
- link.href = URL.createObjectURL(new Blob(outputLines, { type: "text/csv;charset=utf-8;" }));
44
- link.download = `${fileTitle}.csv` || "export.csv";
45
- link.style.visibility = "hidden";
46
- document.body.appendChild(link);
47
- link.click();
48
- document.body.removeChild(link);
49
- }
50
- }
51
-
52
- export { exportCSV as e };
@@ -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 i,c as t,h as s,H as e,g as a}from"./p-c2f00d41.js";import{b as l,c as n,E as d,d as o}from"./p-dbc9a5a8.js";import{l as h}from"./p-eea93a37.js";import{a as c,c as r,g as p,h as g}from"./p-cc2e20c8.js";import{s as b}from"./p-4557d5a8.js";import{g as u}from"./p-9260d75a.js";import{g as m,a as f}from"./p-fc884dd6.js";import"./p-00444009.js";import"./p-e1a4994d.js";const v=class{constructor(s){i(this,s),this.labelChange=t(this,"labelChange",7),this.addresseeLayerIds=[],this.bufferColor=[227,139,79,.8],this.bufferOutlineColor=[255,255,255],this.customLabelEnabled=void 0,this.defaultBufferDistance=void 0,this.defaultBufferUnit=void 0,this.featureEffect=void 0,this.featureHighlightEnabled=void 0,this.mapView=void 0,this.noResultText=void 0,this.searchConfiguration=void 0,this.selectionLayerIds=[],this.showRefineSelection=!1,this.showSearchSettings=!0,this.addresseeLayer=void 0,this._downloadActive=!0,this._numSelected=0,this._pageType=l.LIST,this._saveEnabled=!1,this._selectionSets=[],this._sketchType=n.INTERACTIVE,this._selectionWorkflowType=d.SEARCH,this._showLayerSelectionChangeModal=!1,this._translations=void 0}async mapViewWatchHandler(i){(null==i?void 0:i.popup)&&(this._popupsEnabled=null==i?void 0:i.popup.autoOpenEnabled)}async selectionSetsWatchHandler(i,t){i&&i!==t&&i.length>0&&0===i.filter((i=>i.workflowType!==d.REFINE)).length&&(this._selectionSets=[])}async pageTypeWatchHandler(i,t){if(this._checkPopups(),this._clearHighlight(),t!==l.SELECT&&t!==l.REFINE||await this._clearSelection(),i!==l.SELECT)return this._highlightFeatures()}distanceChanged(i){this._updateLabel(i,"distance"),this._distance=i.detail.newValue}selectionSetsChanged(i){this._selectionSets=[...i.detail]}sketchTypeChange(i){this._sketchType=i.detail}unitChanged(i){this._updateLabel(i,"unit"),this._unit=i.detail.newValue}async componentWillLoad(){await this._getTranslations(),await this._initModules()}render(){const i=this._selectionSets.length>0;return s(e,null,s("calcite-shell",null,s("calcite-action-bar",{class:"border-bottom-1 action-bar-size","expand-disabled":!0,layout:"horizontal",slot:"header"},this._getActionGroup("list-check",!1,l.LIST,this._translations.myLists),this.showRefineSelection?this._getActionGroup("test-data",!i,l.REFINE,this._translations.refineSelection):void 0,this._getActionGroup("file-pdf",!i,l.PDF,this._translations.downloadPDF),this._getActionGroup("file-csv",!i,l.CSV,this._translations.downloadCSV)),this._getPage(this._pageType)))}async _initModules(){const[i]=await h(["esri/geometry/geometryEngine"]);this._geometryEngine=i}_getActionGroup(i,t,e,a){return s("calcite-action-group",{class:this.showRefineSelection?"action-center w-1-4":"action-center w-1-3",layout:"horizontal"},s("calcite-action",{active:this._pageType===e,alignment:"center",class:"width-full height-full",compact:!1,disabled:t,icon:i,id:i,onClick:()=>{this._setPageType(e)},text:""}),s("calcite-tooltip",{label:"",placement:"bottom","reference-element":i},s("span",null,a)))}_setPageType(i){this._pageType=i}_getPage(i){let t;switch(i){case l.LIST:t=this._getListPage();break;case l.SELECT:t=this._getSelectPage();break;case l.REFINE:t=this._getRefinePage();break;case l.PDF:t=this._getPDFPage();break;case l.CSV:t=this._getCSVPage()}return t}_getListPage(){const i=this._selectionSets.filter((i=>i.workflowType!==d.REFINE)).length>0,t=m(this._selectionSets);return i?s("calcite-panel",null,s("div",{class:"padding-top-sides-1"},s("calcite-label",{class:"font-bold"},this._translations.myLists)),this._getNotice(this._translations.listHasSetsTip,"padding-sides-1 padding-bottom-1"),this._getMapLayerPicker(),s("div",{class:"display-block padding-sides-1 height-1-1-2"},s("div",{class:"display-block float-left"},s("calcite-label",{alignment:"start",class:"font-bold"},this._translations.notifications)),s("div",{class:"display-block float-right"},s("calcite-input-message",{active:!0,class:"info-blue margin-top-0",scale:"m"},this._translations.uniqueCout.replace("{{n}}",t.toString())))),i?this._getSelectionSetList():s("div",{class:"info-message"},s("calcite-input-message",{active:!0,class:"info-blue",scale:"m"},this._translations.noNotifications)),s("div",{class:"display-flex padding-1"},s("calcite-button",{onClick:()=>{this._setPageType(l.SELECT)},width:"full"},this._translations.add)),this._showModal(this._showLayerSelectionChangeModal)):s("calcite-panel",null,s("div",{class:"padding-top-sides-1"},s("calcite-label",{class:"font-bold"},this._translations.myLists)),s("div",{class:"padding-sides-1"},s("calcite-label",null,this._translations.notifications)),s("div",{class:"info-message padding-bottom-1"},s("calcite-input-message",{active:!0,class:"info-blue",scale:"m"},this._translations.noNotifications)),this._getNotice(this._translations.selectLayerAndAdd,"padding-sides-1 padding-bottom-1"),this._getMapLayerPicker(),s("div",{class:"display-flex padding-1"},s("calcite-button",{onClick:()=>{this._setPageType(l.SELECT)},width:"full"},this._translations.add)))}_getMapLayerPicker(){var i;return s("div",{class:"display-flex padding-sides-1"},s("calcite-label",{class:"font-bold width-full"},this._translations.addresseeLayer,s("map-layer-picker",{enabledLayerIds:this.addresseeLayerIds,mapView:this.mapView,onLayerSelectionChange:i=>this._layerSelectionChange(i),selectedLayerIds:this.addresseeLayer?[null===(i=this.addresseeLayer)||void 0===i?void 0:i.layer.id]:[],selectionMode:"single"})))}_getSelectionSetList(){return s("calcite-list",{class:"list-border margin-sides-1"},this._selectionSets.reduce(((i,t,e)=>(t.workflowType!==d.REFINE&&i.push(s("calcite-list-item",{description:this._translations.selectedFeatures.replace("{{n}}",t.selectedIds.length.toString()),label:t.label,onClick:()=>this._gotoSelection(t,this.mapView)},this._getAction(!0,"pencil","",(i=>this._openSelection(t,i)),!1,"actions-end"),this._getAction(!0,"x","",(i=>this._deleteSelection(e,i)),!1,"actions-end"))),i)),[]))}_showModal(i){return s("calcite-modal",{"aria-labelledby":"modal-title","background-color":"grey",color:"red",open:i,scale:"s",width:"s"},s("div",{id:"modal-title",slot:"header"},this._translations.shouldProceed),s("div",{slot:"content"},this._translations.proceedInfo),s("calcite-button",{appearance:"outline",onClick:()=>this._cancelLayerChange(),slot:"secondary",width:"full"},this._translations.cancel),s("calcite-button",{onClick:()=>this._handleLayerChange(),slot:"primary",width:"full"},this._translations.proceed))}_cancelLayerChange(){this._layerSelectionChangeEvt.preventDefault(),this._layerSelectionChangeEvt.stopPropagation(),this._layerSelectionChangeEvt=void 0,this._showLayerSelectionChangeModal=!1}async _handleLayerChange(){var i,t;this._showLayerSelectionChangeModal=!1;const s=(null===(t=null===(i=this._layerSelectionChangeEvt)||void 0===i?void 0:i.detail)||void 0===t?void 0:t.length)>0?this._layerSelectionChangeEvt.detail[0]:"";await this._updateAddresseeLayer(s)}_getSelectPage(){var i,t;const e=this._selectionWorkflowType===d.SELECT?this._translations.selectLayerTip:this._selectionWorkflowType===d.SKETCH?this._sketchType===n.INTERACTIVE?this._translations.selectSketchTip:this._translations.selectLayerTip:this._translations.selectSearchTip,a=this.customLabelEnabled?"":"display-none";return s("calcite-panel",null,this._getLabel(this._translations.stepTwoFull.replace("{{layer}}",null===(i=this.addresseeLayer)||void 0===i?void 0:i.layer.title)),this._getNotice(e),s("div",{class:"padding-top-sides-1"},s("map-select-tools",{bufferColor:this.bufferColor,bufferOutlineColor:this.bufferOutlineColor,class:"font-bold",defaultBufferDistance:this.defaultBufferDistance,defaultBufferUnit:this.defaultBufferUnit,enabledLayerIds:this.selectionLayerIds,isUpdate:!!this._activeSelection,mapView:this.mapView,onSelectionSetChange:i=>this._updateForSelection(i),onWorkflowTypeChange:i=>this._updateForWorkflowType(i),ref:i=>{this._selectTools=i},searchConfiguration:this.searchConfiguration,selectLayerView:this.addresseeLayer,selectionSet:this._activeSelection,showBufferTools:this.showSearchSettings})),s("div",{class:"padding-sides-1 padding-bottom-1",style:{"align-items":"end",display:"flex"}},s("calcite-icon",{class:"info-blue padding-end-1-2",icon:"feature-layer",scale:"s"}),s("calcite-input-message",{active:!0,class:"info-blue",scale:"m"},this.noResultText&&0===this._numSelected?this.noResultText:this._translations.selectedAddresses.replace("{{n}}",this._numSelected.toString()).replace("{{layer}}",(null===(t=this.addresseeLayer)||void 0===t?void 0:t.layer.title)||""))),s("div",{class:"padding-sides-1 "+a},s("calcite-label",{class:"font-bold"},"Name label",s("calcite-input",{onInput:()=>{this.labelChange.emit(this._labelName.value)},placeholder:"Insert label here...",ref:i=>{this._labelName=i},value:this._customLabel||""}))),this._getPageNavButtons(this._translations.done,0===this._numSelected,(()=>{this._saveSelection()}),this._translations.cancel,!1,(()=>{this._home()})))}_getRefinePage(){return s("calcite-panel",null,this._getLabel(this._translations.refineSelection),this._getNotice(this._translations.refineTip,"padding-sides-1"),s("refine-selection",{addresseeLayer:this.addresseeLayer,enabledLayerIds:this.selectionLayerIds,mapView:this.mapView,selectionSets:this._selectionSets}))}_getPDFPage(){return this._getDownloadPage(o.PDF)}_getCSVPage(){return this._getDownloadPage(o.CSV)}_getDownloadPage(i){const t=i===o.PDF;return s("calcite-panel",null,s("div",null,s("div",{class:"padding-top-sides-1"},s("calcite-label",{class:"font-bold"},t?this._translations.pdfDownloads:this._translations.csvDownloads),s("calcite-label",null,this._translations.notifications)),this._getSelectionLists(),s("div",{class:"margin-side-1 padding-top-1 border-bottom"}),s("div",{class:"padding-top-sides-1"},s("calcite-label",{layout:"inline"},s("calcite-checkbox",{disabled:!this._downloadActive,ref:i=>{this._removeDuplicates=i}}),this._translations.removeDuplicate)),s("div",{class:t?"":"display-none"},this._getLabel(this._translations.selectPDFLabelOption,!1),s("div",{class:"padding-sides-1"},s("pdf-download",{disabled:!this._downloadActive,layerView:this.addresseeLayer,ref:i=>{this._downloadTools=i}}))),s("div",{class:"padding-1 display-flex"},s("calcite-button",{disabled:!this._downloadActive,onClick:t?()=>this._downloadPDF():()=>this._downloadCSV(),width:"full"},t?this._translations.downloadPDF:this._translations.downloadCSV))))}_getPageNavButtons(i,t,e,a,l,n){return s("div",null,s("div",{class:"display-flex padding-top-sides-1"},s("calcite-button",{disabled:t,onClick:e,width:"full"},i)),s("div",{class:"display-flex padding-top-1-2 padding-sides-1"},s("calcite-button",{appearance:"outline",disabled:l,onClick:n,width:"full"},a)))}_getNotice(i,t="padding-1"){return s("calcite-notice",{class:t,color:"green",icon:"lightbulb",open:!0},s("div",{slot:"message"},i))}_getLabel(i,t=!1){return s("div",{class:"padding-top-sides-1"},s("calcite-label",{class:"font-bold","disable-spacing":t},i))}_getSelectionLists(){return this._selectionSets.reduce(((i,t)=>(t.workflowType!==d.REFINE&&(!this._downloadActive&&t.download&&(this._downloadActive=!0),i.push(s("div",{class:"display-flex padding-sides-1 padding-bottom-1"},s("calcite-checkbox",{checked:t.download,class:"align-center",onClick:()=>{this._toggleDownload(t.id)}}),s("calcite-list",{class:"list-border margin-start-1-2 w-100",id:"download-list"},s("calcite-list-item",{description:this._translations.selectedFeatures.replace("{{n}}",t.selectedIds.length.toString()),disabled:!t.download,label:t.label,onClick:()=>{this._toggleDownload(t.id)}}))))),i)),[])||s("div",null)}async _toggleDownload(i){let t=!1;this._selectionSets=this._selectionSets.map((s=>(s.download=s.id===i?!s.download:s.download,t=!!s.download||t,s))),this._downloadActive=t,await this._highlightFeatures()}_downloadPDF(){const i=f(this._getDownloadSelectionSets());this._downloadTools.downloadPDF(i,this._removeDuplicates.checked)}_downloadCSV(){const i=f(this._getDownloadSelectionSets());this._downloadTools.downloadCSV(i,this._removeDuplicates.checked)}_getDownloadSelectionSets(){return this._selectionSets.filter((i=>i.download||i.workflowType===d.REFINE))}_updateLabel(i,t){this._customLabel&&(this._customLabel=this._customLabel.replace("unit"===t?`${this._distance} ${i.detail.oldValue}`:`${i.detail.oldValue} ${this._unit}`,"unit"===t?`${this._distance} ${i.detail.newValue}`:`${i.detail.newValue} ${this._unit}`),this._labelName.value=this._customLabel,this.labelChange.emit(this._labelName.value))}_updateForWorkflowType(i){this._selectionWorkflowType=i.detail}_getAction(i,t,e,a,l=!1,n=""){return s("calcite-action",{disabled:!i,icon:t,indicator:l,onClick:a,slot:n,text:e})}_updateForSelection(i){this._numSelected=i.detail,this._saveEnabled=this._numSelected>0}async _home(){await this._clearSelection(),"boolean"==typeof this._popupsEnabled&&this.mapView.popup&&(this.mapView.popup.autoOpenEnabled=this._popupsEnabled),this._setPageType(l.LIST)}async _layerSelectionChange(i){var t,s,e;const a=(null===(t=null==i?void 0:i.detail)||void 0===t?void 0:t.length)>0?i.detail[0]:"";a!==(null===(s=this.addresseeLayer)||void 0===s?void 0:s.layer.id)&&(this._showLayerSelectionChangeModal=void 0!==(null===(e=this.addresseeLayer)||void 0===e?void 0:e.layer.id)&&this._selectionSets.length>0,this._showLayerSelectionChangeModal?this._layerSelectionChangeEvt=i:await this._updateAddresseeLayer(a))}async _updateAddresseeLayer(i){this.addresseeLayer=await c(this.mapView,i),await this._updateSelectionSets(this.addresseeLayer)}async _updateSelectionSets(i){const t=this._selectionSets.filter((i=>i.workflowType!==d.REFINE)),s=[];return t.forEach((t=>{t.layerView=i,t.selectedIds=[],s.push(r(t,this._geometryEngine))})),Promise.all(s).then((async i=>{i.forEach(((i,s)=>{t[s].selectedIds=i})),await this._highlightFeatures(),this._selectionSets=[...t]}))}async _saveSelection(){var i,t;const s=await(null===(i=this._selectTools)||void 0===i?void 0:i.getSelection()),e=null===(t=this._selectTools)||void 0===t?void 0:t.isUpdate;return this._selectionSets=e?this._selectionSets.map((i=>i.id===s.id?s:i)):[...this._selectionSets,s],this._home()}async _clearSelection(){var i;await(null===(i=this._selectTools)||void 0===i?void 0:i.clearSelection()),this._numSelected=0,this._activeSelection=void 0,this._customLabel=void 0,this._distance=void 0,this._unit=void 0}_deleteSelection(i,t){return t.stopPropagation(),this._selectionSets=this._selectionSets.filter(((t,s)=>{if(s!==i)return t})),this._highlightFeatures()}_gotoSelection(i,t){p(i.selectedIds,i.layerView,t,this.featureHighlightEnabled,this.featureEffect)}_openSelection(i,t){t.stopPropagation(),this._activeSelection=i,this._distance=this._activeSelection.distance,this._unit=this._activeSelection.unit,this._customLabel=this._activeSelection.label,this._pageType=l.SELECT}async _highlightFeatures(){this._clearHighlight();const i=f(this._selectionSets);i.length>0&&(b.highlightHandle=await g(i,this.addresseeLayer,this.mapView))}_checkPopups(){var i;"boolean"!=typeof this._popupsEnabled&&(this._popupsEnabled=null===(i=this.mapView)||void 0===i?void 0:i.popup.autoOpenEnabled)}_clearHighlight(){var i;b&&b.highlightHandle&&(null===(i=b.highlightHandle)||void 0===i||i.remove())}async _getTranslations(){const i=await u(this.el);this._translations=i[0]}get el(){return a(this)}static get watchers(){return{mapView:["mapViewWatchHandler"],_selectionSets:["selectionSetsWatchHandler"],_pageType:["pageTypeWatchHandler"]}}};v.style=':host{display:block;--calcite-input-message-spacing-value:0}.align-center{align-items:center}.border-bottom-1{border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3)}.action-bar-size{height:3.5rem;width:100%}.w-1-3{width:33.3%}.w-1-4{width:25%}.action-center{-webkit-box-align:center;-webkit-align-items:center;-ms-grid-row-align:center;align-items:center;align-content:center;justify-content:center}.width-full{width:100%}.height-full{height:100%}.padding-1{padding:1rem}.padding-top-sides-1{-webkit-padding-before:1rem;padding-block-start:1rem;-webkit-padding-start:1rem;padding-inline-start:1rem;-webkit-padding-end:1rem;padding-inline-end:1rem}.padding-sides-1{-webkit-padding-start:1rem;padding-inline-start:1rem;-webkit-padding-end:1rem;padding-inline-end:1rem}.padding-end-1-2{-webkit-padding-end:.5rem;padding-inline-end:.5rem}.padding-top-1-2{-webkit-padding-before:.5rem;padding-block-start:.5rem}.padding-top-1{padding-top:1rem}.padding-bottom-1{padding-bottom:1rem}.info-blue{color:#00A0FF}.info-message{justify-content:center;display:grid}.font-bold{font-weight:bold}.display-flex{display:flex}.display-block{display:block}.display-none{display:none}.main-label{float:left}html[dir="rtl"] .main-label{float:right}.back-label:hover{cursor:pointer;color:var(--calcite-ui-brand-hover)}.border-bottom{border-bottom:1px solid var(--calcite-ui-border-2)}.margin-side-1{-webkit-margin-start:1rem;margin-inline-start:1rem;-webkit-margin-end:1rem;margin-inline-end:1rem}.border-top{border-top:1px solid var(--calcite-ui-border-2)}.w-100{width:100%}.w-50{width:50%}.padding-1-2{padding:0.5rem}.list-border{border:1px solid var(--calcite-ui-border-2)}.margin-sides-1{-webkit-margin-start:1rem;margin-inline-start:1rem;-webkit-margin-end:1rem;margin-inline-end:1rem}.margin-start-1-2{-webkit-margin-start:0.5rem;margin-inline-start:0.5rem}.float-right{float:right}.float-right[dir="rtl"]{float:left}.float-left{float:left}.float-left[dir="rtl"]{float:right}.margin-top-0{-webkit-margin-before:0 !important;margin-block-start:0 !important}.height-1-1-2{height:1.5rem}.main-background{background-color:var(--calcite-ui-foreground-2)}.num-selected{align-items:center;display:flex}';export{v as public_notification}