@esri/solutions-components 0.5.1 → 0.5.2

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