@esri/solutions-components 0.5.1 → 0.5.2

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 (156) hide show
  1. package/dist/assets/arcgis-pdf-creator/PDFCreator.js +6 -3
  2. package/dist/assets/arcgis-pdf-creator/PDFCreator_jsPDF.js +1 -1
  3. package/dist/assets/arcgis-pdf-creator/PDFCreator_pdf_lib.js +1 -1
  4. package/dist/assets/arcgis-pdf-creator/PDFLabels.js +54 -3
  5. package/dist/assets/arcgis-pdf-creator/grid.js +1 -1
  6. package/dist/assets/data/images/grid.png +0 -0
  7. package/dist/assets/data/images/horizontal.png +0 -0
  8. package/dist/assets/data/images/vertical.png +0 -0
  9. package/dist/assets/t9n/crowdsource-manager/resources.json +7 -1
  10. package/dist/assets/t9n/crowdsource-manager/resources_en.json +7 -1
  11. package/dist/cjs/buffer-tools_6.cjs.entry.js +85 -85
  12. package/dist/cjs/{calcite-block_2.cjs.entry.js → calcite-action-bar_4.cjs.entry.js} +307 -18
  13. package/dist/cjs/{calcite-action.cjs.entry.js → calcite-action_2.cjs.entry.js} +84 -1
  14. package/dist/cjs/{calcite-combobox_3.cjs.entry.js → calcite-chip_4.cjs.entry.js} +187 -61
  15. package/dist/cjs/{calcite-dropdown-group_4.cjs.entry.js → calcite-dropdown_5.cjs.entry.js} +467 -1
  16. package/dist/cjs/calcite-input-message_5.cjs.entry.js +283 -283
  17. package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
  18. package/dist/cjs/{calcite-action-bar_2.cjs.entry.js → calcite-tooltip.cjs.entry.js} +2 -208
  19. package/dist/cjs/crowdsource-manager.cjs.entry.js +88 -14
  20. package/dist/cjs/{downloadUtils-b85476e8.js → downloadUtils-9359e9ff.js} +1218 -1127
  21. package/dist/cjs/{index.es-3ba50626.js → index.es-9c0d0ed6.js} +10682 -10682
  22. package/dist/cjs/{interfaces-17c631bf.js → interfaces-cac36920.js} +6 -0
  23. package/dist/cjs/layer-table_2.cjs.entry.js +512 -0
  24. package/dist/cjs/loader.cjs.js +30 -30
  25. package/dist/cjs/{mapViewUtils-df63bfa4.js → mapViewUtils-090f4d4d.js} +24 -24
  26. package/dist/cjs/public-notification.cjs.entry.js +69 -49
  27. package/dist/cjs/solution-configuration.cjs.entry.js +2 -2
  28. package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
  29. package/dist/cjs/{solution-store-b86759b2.js → solution-store-d28c332e.js} +1 -1
  30. package/dist/cjs/solutions-components.cjs.js +31 -31
  31. package/dist/collection/assets/arcgis-pdf-creator/PDFCreator.js +6 -3
  32. package/dist/collection/assets/arcgis-pdf-creator/PDFCreator_jsPDF.js +1 -1
  33. package/dist/collection/assets/arcgis-pdf-creator/PDFCreator_pdf_lib.js +1 -1
  34. package/dist/collection/assets/arcgis-pdf-creator/PDFLabels.js +54 -3
  35. package/dist/collection/assets/arcgis-pdf-creator/grid.js +1 -1
  36. package/dist/collection/components/crowdsource-manager/crowdsource-manager.css +122 -0
  37. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +130 -14
  38. package/dist/collection/components/layer-table/layer-table.css +2 -70
  39. package/dist/collection/components/layer-table/layer-table.js +66 -106
  40. package/dist/collection/components/map-card/map-card.css +4 -7
  41. package/dist/collection/components/map-card/map-card.js +44 -10
  42. package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
  43. package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
  44. package/dist/collection/components/public-notification/public-notification.js +45 -27
  45. package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +1 -1
  46. package/dist/collection/demos/crowdsource-manager.html +14 -41
  47. package/dist/collection/utils/csvDownload.js +41 -0
  48. package/dist/collection/utils/csvDownload.ts +42 -0
  49. package/dist/collection/utils/csvUtils.js +6 -23
  50. package/dist/collection/utils/csvUtils.ts +8 -27
  51. package/dist/collection/utils/downloadUtils.js +30 -14
  52. package/dist/collection/utils/downloadUtils.ts +36 -14
  53. package/dist/collection/utils/interfaces.js +6 -0
  54. package/dist/collection/utils/interfaces.ts +6 -0
  55. package/dist/collection/utils/pdfUtils.js +9 -6
  56. package/dist/collection/utils/pdfUtils.ts +13 -8
  57. package/dist/collection/utils/test/csvUtils.spec.tsx +56 -0
  58. package/dist/collection/utils/test/downloadUtils.spec.tsx +133 -0
  59. package/dist/components/crowdsource-manager.js +293 -17
  60. package/dist/components/downloadUtils.js +133 -42
  61. package/dist/components/interfaces3.js +7 -1
  62. package/dist/components/layer-table.js +1 -443
  63. package/dist/components/layer-table2.js +429 -0
  64. package/dist/components/map-card.js +1 -339
  65. package/dist/{esm/map-card.entry.js → components/map-card2.js} +118 -22
  66. package/dist/components/map-draw-tools2.js +16 -16
  67. package/dist/components/map-layer-picker2.js +1 -1
  68. package/dist/components/map-select-tools2.js +38 -38
  69. package/dist/components/public-notification.js +102 -82
  70. package/dist/components/queryUtils.js +10 -10
  71. package/dist/components/refine-selection-tools2.js +3 -3
  72. package/dist/components/refine-selection2.js +1 -1
  73. package/dist/components/solution-resource-item2.js +1 -1
  74. package/dist/components/solution-store.js +1 -1
  75. package/dist/esm/buffer-tools_6.entry.js +76 -76
  76. package/dist/esm/{calcite-block_2.entry.js → calcite-action-bar_4.entry.js} +307 -20
  77. package/dist/esm/{calcite-action.entry.js → calcite-action_2.entry.js} +84 -2
  78. package/dist/esm/{calcite-combobox_3.entry.js → calcite-chip_4.entry.js} +181 -56
  79. package/dist/esm/{calcite-dropdown-group_4.entry.js → calcite-dropdown_5.entry.js} +468 -3
  80. package/dist/esm/calcite-input-message_5.entry.js +275 -275
  81. package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
  82. package/dist/esm/{calcite-action-bar_2.entry.js → calcite-tooltip.entry.js} +4 -209
  83. package/dist/esm/crowdsource-manager.entry.js +88 -14
  84. package/dist/esm/{downloadUtils-f278742f.js → downloadUtils-a8f139c5.js} +1214 -1123
  85. package/dist/esm/{index.es-6f3a1143.js → index.es-a75412ff.js} +10596 -10596
  86. package/dist/esm/{interfaces-d0d83efa.js → interfaces-cd4054e5.js} +7 -1
  87. package/dist/esm/layer-table_2.entry.js +507 -0
  88. package/dist/esm/loader.js +26 -26
  89. package/dist/esm/{mapViewUtils-bd1809f0.js → mapViewUtils-8ffcd36d.js} +12 -12
  90. package/dist/esm/public-notification.entry.js +65 -45
  91. package/dist/esm/solution-configuration.entry.js +2 -2
  92. package/dist/esm/solution-contents_3.entry.js +2 -2
  93. package/dist/esm/{solution-store-477288ac.js → solution-store-1b67f2c8.js} +1 -1
  94. package/dist/esm/solutions-components.js +26 -26
  95. package/dist/solutions-components/demos/crowdsource-manager.html +14 -41
  96. package/dist/solutions-components/{p-dd11eeb2.js → p-1395b0ef.js} +1 -1
  97. package/dist/solutions-components/{p-cbac29fb.entry.js → p-1affd711.entry.js} +18 -18
  98. package/dist/solutions-components/p-30de8da1.entry.js +17 -0
  99. package/dist/solutions-components/{p-91cad71e.entry.js → p-439c878d.entry.js} +3 -9
  100. package/dist/solutions-components/{p-03e2c6fd.js → p-765a27f3.js} +60 -60
  101. package/dist/solutions-components/p-813a04c3.entry.js +6 -0
  102. package/dist/solutions-components/{p-9e8a371f.entry.js → p-874b39a7.entry.js} +3 -3
  103. package/dist/solutions-components/p-8cece97f.js +21 -0
  104. package/dist/solutions-components/{p-dd0241fb.entry.js → p-97aa7211.entry.js} +1 -1
  105. package/dist/solutions-components/{p-0e459cc7.entry.js → p-a955a3e6.entry.js} +10 -4
  106. package/dist/solutions-components/{p-40c12650.js → p-bb64bd47.js} +453 -437
  107. package/dist/solutions-components/{p-70e1d4d8.entry.js → p-c392dd95.entry.js} +17 -17
  108. package/dist/solutions-components/p-ca386a72.entry.js +6 -0
  109. package/dist/solutions-components/p-d47d74a6.entry.js +23 -0
  110. package/dist/solutions-components/p-db846ee2.entry.js +11 -0
  111. package/dist/solutions-components/{p-88e5a76d.js → p-dc53c9c1.js} +36 -36
  112. package/dist/solutions-components/p-e1c93241.entry.js +6 -0
  113. package/dist/solutions-components/{p-4cbaf0f1.entry.js → p-e6d235d6.entry.js} +1 -1
  114. package/dist/solutions-components/solutions-components.esm.js +6 -6
  115. package/dist/solutions-components/utils/csvDownload.ts +42 -0
  116. package/dist/solutions-components/utils/csvUtils.ts +8 -27
  117. package/dist/solutions-components/utils/downloadUtils.ts +36 -14
  118. package/dist/solutions-components/utils/interfaces.ts +6 -0
  119. package/dist/solutions-components/utils/pdfUtils.ts +13 -8
  120. package/dist/solutions-components/utils/test/csvUtils.spec.tsx +56 -0
  121. package/dist/solutions-components/utils/test/downloadUtils.spec.tsx +133 -0
  122. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +39 -0
  123. package/dist/types/components/layer-table/layer-table.d.ts +35 -48
  124. package/dist/types/components/map-card/map-card.d.ts +10 -6
  125. package/dist/types/components/public-notification/public-notification.d.ts +18 -6
  126. package/dist/types/components.d.ts +1621 -1601
  127. package/dist/types/preact.d.ts +2 -1
  128. package/dist/types/utils/csvDownload.d.ts +24 -0
  129. package/dist/types/utils/csvUtils.d.ts +2 -1
  130. package/dist/types/utils/downloadUtils.d.ts +25 -0
  131. package/dist/types/utils/interfaces.d.ts +5 -0
  132. package/dist/types/utils/pdfUtils.d.ts +2 -1
  133. package/package.json +4 -4
  134. package/dist/cjs/calcite-chip.cjs.entry.js +0 -142
  135. package/dist/cjs/calcite-dropdown.cjs.entry.js +0 -481
  136. package/dist/cjs/calcite-handle.cjs.entry.js +0 -99
  137. package/dist/cjs/calcite-loader.cjs.entry.js +0 -95
  138. package/dist/cjs/layer-table.cjs.entry.js +0 -317
  139. package/dist/cjs/map-card.cjs.entry.js +0 -252
  140. package/dist/esm/calcite-chip.entry.js +0 -138
  141. package/dist/esm/calcite-dropdown.entry.js +0 -477
  142. package/dist/esm/calcite-handle.entry.js +0 -95
  143. package/dist/esm/calcite-loader.entry.js +0 -91
  144. package/dist/esm/layer-table.entry.js +0 -313
  145. package/dist/solutions-components/p-045d3988.entry.js +0 -12
  146. package/dist/solutions-components/p-11132485.entry.js +0 -11
  147. package/dist/solutions-components/p-15b43c29.entry.js +0 -11
  148. package/dist/solutions-components/p-5034aabc.entry.js +0 -11
  149. package/dist/solutions-components/p-6f012424.entry.js +0 -6
  150. package/dist/solutions-components/p-7fd10eb3.entry.js +0 -11
  151. package/dist/solutions-components/p-a57ef371.entry.js +0 -6
  152. package/dist/solutions-components/p-bc39f296.entry.js +0 -6
  153. package/dist/solutions-components/p-c93d8e80.entry.js +0 -6
  154. package/dist/solutions-components/p-dbc9a5a8.js +0 -21
  155. package/dist/solutions-components/p-f5c70be2.entry.js +0 -6
  156. package/dist/solutions-components/p-f6b17cc6.entry.js +0 -11
@@ -18,6 +18,12 @@
18
18
  * See the License for the specific language governing permissions and
19
19
  * limitations under the License.
20
20
  */
21
+ var ELayoutMode;
22
+ (function (ELayoutMode) {
23
+ ELayoutMode["GRID"] = "GRID";
24
+ ELayoutMode["HORIZONTAL"] = "HORIZONTAL";
25
+ ELayoutMode["VERTICAL"] = "VERTICAL";
26
+ })(ELayoutMode || (ELayoutMode = {}));
21
27
  /**
22
28
  * Resource update types
23
29
  */
@@ -77,4 +83,4 @@ var EExpandType;
77
83
  EExpandType["COLLAPSE"] = "COLLAPSE";
78
84
  })(EExpandType || (EExpandType = {}));
79
85
 
80
- export { EWorkflowType as E, EExpandType as a, EPageType as b, ESketchType as c, EExportType as d, EUpdateType as e, ESelectionMode as f, ERefineMode as g, ESelectionType as h };
86
+ export { ELayoutMode as E, EPageType as a, ESketchType as b, EWorkflowType as c, EExportType as d, EUpdateType as e, ESelectionMode as f, ERefineMode as g, EExpandType as h, ESelectionType as i };
@@ -0,0 +1,507 @@
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 registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-c246d90e.js';
7
+ import { l as loadModules } from './loadModules-b299cd43.js';
8
+ import { g as getLocaleComponentStrings } from './locale-7bf10e0a.js';
9
+ import { e as getMapLayerIds, g as getMapLayerView, b as goToSelection, f as queryAllFeatures } from './mapViewUtils-8ffcd36d.js';
10
+ import { d as downloadCSV } from './downloadUtils-a8f139c5.js';
11
+ import { h as EExpandType } from './interfaces-cd4054e5.js';
12
+ import './_commonjsHelpers-d5f9d613.js';
13
+
14
+ const layerTableCss = ":host{display:block}.table-div{height:calc(100% - 35px)}.display-flex{display:flex}.table-border{border:1px solid var(--calcite-ui-border-2)}";
15
+
16
+ const LayerTable = class {
17
+ constructor(hostRef) {
18
+ registerInstance(this, hostRef);
19
+ /**
20
+ * string[]: List of field names to display
21
+ */
22
+ this._fieldNames = [];
23
+ /**
24
+ * esri/Graphic[]: https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html
25
+ */
26
+ this._graphics = [];
27
+ /**
28
+ * Store a reference to the table node after it's first created
29
+ * and initializes the FeatureTable
30
+ *
31
+ * @returns void
32
+ */
33
+ this.onTableNodeCreate = (node) => {
34
+ this._tableNode = node;
35
+ this._getTable(node);
36
+ };
37
+ this.mapView = undefined;
38
+ this._layerView = undefined;
39
+ this._selectedIndexes = [];
40
+ this._translations = undefined;
41
+ }
42
+ //--------------------------------------------------------------------------
43
+ //
44
+ // Watch handlers
45
+ //
46
+ //--------------------------------------------------------------------------
47
+ async mapViewWatchHandler() {
48
+ const mapLayerIds = await getMapLayerIds(this.mapView);
49
+ this._layerView = await getMapLayerView(this.mapView, mapLayerIds[0]);
50
+ }
51
+ //--------------------------------------------------------------------------
52
+ //
53
+ // Methods (public)
54
+ //
55
+ //--------------------------------------------------------------------------
56
+ //--------------------------------------------------------------------------
57
+ //
58
+ // Events (public)
59
+ //
60
+ //--------------------------------------------------------------------------
61
+ //--------------------------------------------------------------------------
62
+ //
63
+ // Functions (lifecycle)
64
+ //
65
+ //--------------------------------------------------------------------------
66
+ /**
67
+ * StencilJS: Called once just after the component is first connected to the DOM.
68
+ *
69
+ * @returns Promise when complete
70
+ */
71
+ async componentWillLoad() {
72
+ await this._getTranslations();
73
+ await this._initModules();
74
+ }
75
+ /**
76
+ * Renders the component.
77
+ */
78
+ render() {
79
+ if (!this._layerView) {
80
+ return null;
81
+ }
82
+ return (h(Host, null, this._getTableControlRow(), h("div", { class: "table-div width-full" }, h("calcite-panel", { class: "height-full width-full" }, h("div", { ref: this.onTableNodeCreate }))), h("edit-record-modal", { ref: (el) => this._editMultipleMpdal = el })));
83
+ }
84
+ //--------------------------------------------------------------------------
85
+ //
86
+ // Functions (protected)
87
+ //
88
+ //--------------------------------------------------------------------------
89
+ /**
90
+ * Load esri javascript api modules
91
+ *
92
+ * @returns Promise resolving when function is done
93
+ *
94
+ * @protected
95
+ */
96
+ async _initModules() {
97
+ const [FeatureTable] = await loadModules([
98
+ "esri/widgets/FeatureTable"
99
+ ]);
100
+ this.FeatureTable = FeatureTable;
101
+ }
102
+ /**
103
+ * Gets a row of controls that can be used for various interactions with the table
104
+ *
105
+ * @returns The dom node that contains the controls
106
+ */
107
+ _getTableControlRow() {
108
+ const featuresSelected = this._selectedIndexes.length > 0;
109
+ const multiFeaturesSelected = this._selectedIndexes.length > 1;
110
+ return (h("div", { class: "display-flex table-border" }, h("map-layer-picker", { mapView: this.mapView, onLayerSelectionChange: (evt) => this._layerSelectionChanged(evt) }), h("div", null, h("calcite-button", { appearance: 'transparent', color: 'neutral', disabled: !featuresSelected, iconStart: 'magnifying-glass', onClick: () => this._zoom() }, this._translations.zoom), h("calcite-button", { appearance: 'transparent', color: 'neutral', disabled: !multiFeaturesSelected, iconStart: 'pencil', onClick: () => this._editMultiple() }, this._translations.editMultiple), h("calcite-button", { appearance: 'transparent', color: 'neutral', disabled: !featuresSelected, iconStart: 'trash', onClick: () => this._delete() }, this._translations.delete), h("calcite-split-button", { appearance: "transparent", color: "neutral", "primary-text": this._translations.more }, h("calcite-dropdown-group", { "selection-mode": "none" }, h("calcite-dropdown-item", { iconStart: 'list-check-all', onClick: () => this._selectAll(true) }, this._translations.selectAll), h("calcite-dropdown-item", { iconStart: 'selected-items-filter', onClick: () => this._showSelected() }, this._translations.showSelected), h("calcite-dropdown-item", { iconStart: 'erase', onClick: () => this._clearSelection() }, this._translations.clearSelection), h("calcite-dropdown-item", { iconStart: 'refresh', onClick: () => this._switchSelected() }, this._translations.switchSelected), h("calcite-dropdown-item", { iconStart: 'export', onClick: () => this._exportToCSV() }, this._translations.exportCSV))))));
111
+ }
112
+ /**
113
+ * Initialize the FeatureTable
114
+ *
115
+ * @returns void
116
+ */
117
+ _getTable(node) {
118
+ var _a;
119
+ if ((_a = this._layerView) === null || _a === void 0 ? void 0 : _a.layer) {
120
+ this._table = new this.FeatureTable({
121
+ layer: this._layerView.layer,
122
+ view: this.mapView,
123
+ editingEnabled: true,
124
+ highlightOnRowSelectEnabled: true,
125
+ multiSortEnabled: false,
126
+ visibleElements: {
127
+ header: false,
128
+ menu: false
129
+ },
130
+ container: node
131
+ });
132
+ }
133
+ }
134
+ /**
135
+ * Select or deselect all rows
136
+ *
137
+ * @param checked When true all rows will be selected
138
+ *
139
+ * @returns void
140
+ */
141
+ _selectAll(checked) {
142
+ this._selectedIndexes = checked ? this._graphics.map((_g, i) => i) : [];
143
+ }
144
+ // need to discuss with team
145
+ _showSelected() {
146
+ console.log("_showSelected");
147
+ }
148
+ /**
149
+ * Clears the selected indexes
150
+ *
151
+ * @returns void
152
+ */
153
+ _clearSelection() {
154
+ this._selectedIndexes = [];
155
+ }
156
+ /**
157
+ * Select all rows that are not currently selectd
158
+ *
159
+ * @returns void
160
+ */
161
+ _switchSelected() {
162
+ const currentIndexes = [...this._selectedIndexes];
163
+ this._selectedIndexes = this._graphics.reduce((prev, _cur, i) => {
164
+ if (currentIndexes.indexOf(i) < 0) {
165
+ prev.push(i);
166
+ }
167
+ return prev;
168
+ }, []);
169
+ }
170
+ /**
171
+ * Export all selected rows as CSV
172
+ *
173
+ * @returns a promise that will resolve when the operation is complete
174
+ */
175
+ async _exportToCSV() {
176
+ return downloadCSV([], this._layerView.layer, this._getSelectedIds(), false, // formatUsingLayerPopup
177
+ false, // removeDuplicates
178
+ true);
179
+ }
180
+ /**
181
+ * Zoom to all selected features
182
+ *
183
+ * @returns a promise that will resolve when the operation is complete
184
+ */
185
+ _zoom() {
186
+ const ids = this._getSelectedIds();
187
+ void goToSelection(ids, this._layerView, this.mapView, true);
188
+ }
189
+ /**
190
+ * Open the edit multiple modal
191
+ *
192
+ * @returns void
193
+ */
194
+ _editMultiple() {
195
+ this._editMultipleMpdal.open = true;
196
+ }
197
+ /**
198
+ * Delete all selected records
199
+ *
200
+ * @returns a promise that will resolve when the operation is complete
201
+ */
202
+ _delete() {
203
+ console.log("delete");
204
+ }
205
+ /**
206
+ * Get the graphics for all selected indexes
207
+ *
208
+ * @param indexes the indexes for the graphics to fetch
209
+ *
210
+ * @returns An array of selected graphics
211
+ */
212
+ _getGraphics(indexes) {
213
+ return this._graphics.filter((_g, i) => indexes.indexOf(i) > -1);
214
+ }
215
+ /**
216
+ * Gets the object ids for all selected rows
217
+ *
218
+ * @returns An array of object ids
219
+ */
220
+ _getSelectedIds() {
221
+ const graphics = this._getGraphics(this._selectedIndexes);
222
+ return graphics.map(g => g.getObjectId());
223
+ }
224
+ /**
225
+ * Update the selected indexes based on the current row
226
+ *
227
+ * @param index the index of the selected row
228
+ *
229
+ * @returns void
230
+ */
231
+ _rowSelected(index) {
232
+ const indexOfSelected = this._selectedIndexes.indexOf(index);
233
+ if (indexOfSelected > -1) {
234
+ this._selectedIndexes.splice(indexOfSelected, 1);
235
+ this._selectedIndexes = [...this._selectedIndexes];
236
+ }
237
+ else {
238
+ this._selectedIndexes = [...this._selectedIndexes, index];
239
+ }
240
+ }
241
+ /**
242
+ * Handles layer selection change to show new table
243
+ *
244
+ * @returns a promise that will resolve when the operation is complete
245
+ */
246
+ async _layerSelectionChanged(evt) {
247
+ const layerName = evt.detail[0];
248
+ this._layerView = await getMapLayerView(this.mapView, layerName);
249
+ // TODO rethink this...when we use later we need to be able to lookup with name
250
+ this._fieldNames = this._layerView.layer.fields.map(f => f.alias || f.name);
251
+ this._graphics = await queryAllFeatures(0, this._layerView.layer, []);
252
+ this._selectedIndexes = [];
253
+ this._table.layer = this._layerView.layer;
254
+ this._table.render();
255
+ }
256
+ /**
257
+ * Fetches the component's translations
258
+ *
259
+ * @returns Promise when complete
260
+ * @protected
261
+ */
262
+ async _getTranslations() {
263
+ const messages = await getLocaleComponentStrings(this.el);
264
+ this._translations = messages[0];
265
+ }
266
+ get el() { return getElement(this); }
267
+ static get watchers() { return {
268
+ "mapView": ["mapViewWatchHandler"]
269
+ }; }
270
+ };
271
+ LayerTable.style = layerTableCss;
272
+
273
+ const mapCardCss = ":host{display:block;--calcite-label-margin-bottom:0;--calcite-block-padding:0}.action-bar-size{height:3.5rem;width:100%}.action-center{-webkit-box-align:center;-webkit-align-items:center;-ms-grid-row-align:center;align-items:center;align-content:center;justify-content:center}.border-bottom-1{border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3)}.width-1-7{width:14.28%}.width-1-6{width:16.66%}.width-full{width:100%}.height-full{height:100%}.display-flex{display:flex}.display-grid{display:inline-grid}.block-button{border-bottom:0}.block-button:hover{background-color:var(--calcite-ui-foreground-2)}.block-button:active{background-color:var(--calcite-ui-foreground-3)}.map-list{position:absolute;inset:3.5rem 0 0 0;display:flex;flex-direction:column;overflow:hidden;animation:calcite-scrim-fade-in var(--calcite-internal-animation-timing-medium) ease-in-out;background-color:var(--calcite-scrim-background);z-index:1;width:100%;height:-moz-fit-content;height:fit-content}.map-height{height:calc(100% - 58px)}.display-none{display:none}.esri-zoom{display:none !important}";
274
+
275
+ const MapCard = class {
276
+ constructor(hostRef) {
277
+ registerInstance(this, hostRef);
278
+ this.expandMap = createEvent(this, "expandMap", 7);
279
+ this.mapChanged = createEvent(this, "mapChanged", 7);
280
+ /**
281
+ * string: the id of map currently displayed
282
+ */
283
+ this._loadedId = "";
284
+ this.mapInfos = [];
285
+ this.mapView = undefined;
286
+ this._mapListExpanded = false;
287
+ this._translations = undefined;
288
+ this._webMapId = "";
289
+ }
290
+ //--------------------------------------------------------------------------
291
+ //
292
+ // Watch handlers
293
+ //
294
+ //--------------------------------------------------------------------------
295
+ /**
296
+ * Called each time the _webMapId prop is changed.
297
+ */
298
+ _webMapIdWatchHandler(v, oldV) {
299
+ if (v && JSON.stringify(v) !== JSON.stringify(oldV)) {
300
+ this._loadMap(v);
301
+ }
302
+ }
303
+ /**
304
+ * Called each time the mapInfos prop is changed.
305
+ */
306
+ mapInfosWatchHandler(v, oldV) {
307
+ if (v && JSON.stringify(v) !== JSON.stringify(oldV)) {
308
+ this._loadMap(v[0].id);
309
+ }
310
+ }
311
+ //--------------------------------------------------------------------------
312
+ //
313
+ // Functions (lifecycle)
314
+ //
315
+ //--------------------------------------------------------------------------
316
+ /**
317
+ * StencilJS: Called once just after the component is first connected to the DOM.
318
+ */
319
+ async componentWillLoad() {
320
+ await this._getTranslations();
321
+ await this._initModules();
322
+ }
323
+ /**
324
+ * StencilJS: Called after every render.
325
+ */
326
+ componentDidRender() {
327
+ // the container node for the map view needs to exist before the view is created
328
+ this._loadMap(this._webMapId);
329
+ }
330
+ /**
331
+ * Renders the component.
332
+ */
333
+ render() {
334
+ return (h(Host, null, this._getToolbar(), this._getMapNameList(this._mapListExpanded), h("div", { class: "map-height", ref: (el) => (this._mapDiv = el) })));
335
+ }
336
+ //--------------------------------------------------------------------------
337
+ //
338
+ // Functions (protected)
339
+ //
340
+ //--------------------------------------------------------------------------
341
+ /**
342
+ * Load esri javascript api modules
343
+ *
344
+ * @returns Promise resolving when function is done
345
+ *
346
+ * @protected
347
+ */
348
+ async _initModules() {
349
+ const [WebMap, MapView] = await loadModules([
350
+ "esri/WebMap",
351
+ "esri/views/MapView"
352
+ ]);
353
+ this.WebMap = WebMap;
354
+ this.MapView = MapView;
355
+ }
356
+ /**
357
+ * Create the toolbar (controls used for map and app interactions)
358
+ *
359
+ * @returns The dom node with the toolbar
360
+ *
361
+ * @protected
362
+ */
363
+ _getToolbar() {
364
+ return (h("div", { class: "display-flex" }, h("calcite-action-bar", { class: "border-bottom-1 action-bar-size", "expand-disabled": true, layout: "horizontal", slot: "header" }, this._getMapPicker(), this._getActionGroup("home", false, this._translations.home, () => this._goHome()), this._getActionGroup("list", false, this._translations.list, () => this._showList()), this._getActionGroup("magnifying-glass-plus", false, this._translations.search, () => this._search()), this._getActionGroup("plus", false, this._translations.zoomIn, () => this._zoomIn()), this._getActionGroup("minus", false, this._translations.zoomOut, () => this._zoomOut()), this._getActionGroup("expand", false, this._translations.expand, () => this._expand()))));
365
+ }
366
+ /**
367
+ * Load the webmap for the provided id
368
+ *
369
+ * @param id the webmap id to load
370
+ *
371
+ * @returns void
372
+ *
373
+ * @protected
374
+ */
375
+ _loadMap(id) {
376
+ // on the first render use the first child of the provided mapInfos
377
+ if (id === "" && this.mapInfos.length > 0) {
378
+ id = this.mapInfos[0].id;
379
+ }
380
+ if (this._loadedId !== id) {
381
+ const webMap = new this.WebMap({
382
+ portalItem: { id }
383
+ });
384
+ this.mapView = new this.MapView({
385
+ container: this._mapDiv,
386
+ map: webMap,
387
+ // TODO consider this more...seems to cause less overflow issues when the component is resized
388
+ resizeAlign: "top-left"
389
+ });
390
+ this._loadedId = id;
391
+ this.mapChanged.emit(this.mapView);
392
+ }
393
+ }
394
+ /**
395
+ * Get a calcite action group for the current action
396
+ *
397
+ * @param icon the icon to display for the current action
398
+ * @param disabled should the action be disabled
399
+ * @param tip information tip to display helpful details to end user
400
+ * @param func the associated onClick function to execute
401
+ *
402
+ * @returns the dom node for the action group
403
+ *
404
+ * @protected
405
+ */
406
+ _getActionGroup(icon, disabled, tip, func) {
407
+ return (h("calcite-action-group", { class: "action-center width-1-6", layout: "horizontal" }, h("calcite-action", { alignment: "center", class: "width-full height-full", compact: false, disabled: disabled, icon: icon, id: icon, onClick: func, text: "" }, h("calcite-icon", { icon: "cheveron-up", scale: "s", slot: "icon" })), h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": icon }, h("span", null, tip))));
408
+ }
409
+ /**
410
+ * Get a calcite action group for the map list
411
+ * Actions do not support multiple icons so this uses a block
412
+ *
413
+ * @returns the dom node for the action group
414
+ *
415
+ * @protected
416
+ */
417
+ _getMapPicker() {
418
+ const mapListIcon = this._mapListExpanded ? "chevron-up" : "chevron-down";
419
+ return (h("calcite-action-group", { class: "action-center width-1-6", layout: "horizontal" }, h("calcite-block", { class: "action-center block-button width-full height-full display-grid", heading: '', onClick: () => this._chooseMap() }, h("calcite-icon", { icon: "map", scale: "s", slot: "icon" }), h("calcite-icon", { icon: mapListIcon, scale: "s", slot: "icon" }), h("calcite-tooltip", { label: "", placement: "bottom" }, h("span", null, this._translations.mapName)))));
420
+ }
421
+ /**
422
+ * Get a pick list for all maps in mapInfos
423
+ *
424
+ * @param show boolean to indicate if the list should be shown or hidden
425
+ *
426
+ * @returns the dom node for the list of maps
427
+ *
428
+ * @protected
429
+ */
430
+ _getMapNameList(show) {
431
+ const listClass = show ? "map-list" : "display-none";
432
+ return (h("div", { class: listClass }, h("calcite-pick-list", { id: "mapList" }, this.mapInfos.map(mapInfo => {
433
+ return (h("calcite-pick-list-item", { label: mapInfo.name, onClick: () => this._webMapSelected(mapInfo.id), selected: mapInfo.id === this._loadedId, value: mapInfo.id }));
434
+ }))));
435
+ }
436
+ /**
437
+ * Fired when the user clicks on the map list
438
+ *
439
+ * @param id the web map id selected from the list
440
+ *
441
+ * @returns void
442
+ *
443
+ * @protected
444
+ */
445
+ _webMapSelected(id) {
446
+ this._mapListExpanded = false;
447
+ this._webMapId = id;
448
+ }
449
+ /**
450
+ * Toggles the open/close state of the map list
451
+ *
452
+ * @returns the dom node for the action group
453
+ *
454
+ * @protected
455
+ */
456
+ _chooseMap() {
457
+ this._mapListExpanded = !this._mapListExpanded;
458
+ }
459
+ // Need to discuss this with the team
460
+ _goHome() {
461
+ alert("go home");
462
+ }
463
+ // need to discuss this with the team
464
+ _showList() {
465
+ alert("show list");
466
+ }
467
+ // Need to discuss this with the team
468
+ _search() {
469
+ alert("search");
470
+ }
471
+ // Need to explore map fixed zoom in considerations
472
+ _zoomIn() {
473
+ alert("zoom in");
474
+ }
475
+ // Need to explore map fixed zoom out considerations
476
+ _zoomOut() {
477
+ alert("zoom out");
478
+ }
479
+ /**
480
+ * Emit the expand map event
481
+ *
482
+ * @returns void
483
+ *
484
+ * @protected
485
+ */
486
+ _expand() {
487
+ this.expandMap.emit(EExpandType.EXPAND);
488
+ }
489
+ /**
490
+ * Fetches the component's translations
491
+ *
492
+ * @returns Promise when complete
493
+ * @protected
494
+ */
495
+ async _getTranslations() {
496
+ const messages = await getLocaleComponentStrings(this.el);
497
+ this._translations = messages[0];
498
+ }
499
+ get el() { return getElement(this); }
500
+ static get watchers() { return {
501
+ "_webMapId": ["_webMapIdWatchHandler"],
502
+ "mapInfos": ["mapInfosWatchHandler"]
503
+ }; }
504
+ };
505
+ MapCard.style = mapCardCss;
506
+
507
+ export { LayerTable as layer_table, MapCard as map_card };