@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
@@ -19,32 +19,45 @@
19
19
  * limitations under the License.
20
20
  */
21
21
  import { Host, h } from '@stencil/core';
22
+ import { loadModules } from "../../utils/loadModules";
22
23
  import { getLocaleComponentStrings } from "../../utils/locale";
23
- import { getMapLayerView, goToSelection } from "../../utils/mapViewUtils";
24
+ import { getMapLayerView, goToSelection, getMapLayerIds } from "../../utils/mapViewUtils";
24
25
  import { queryAllFeatures } from "../../utils/queryUtils";
25
26
  import * as downloadUtils from "../../utils/downloadUtils";
26
- // TODO look for options to better handle very large number of records
27
- // has a hard time especially with select all when we have many rows
28
- // TODO test with data that contains domains
29
27
  export class LayerTable {
30
28
  constructor() {
29
+ /**
30
+ * string[]: List of field names to display
31
+ */
32
+ this._fieldNames = [];
31
33
  /**
32
34
  * esri/Graphic[]: https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html
33
35
  */
34
36
  this._graphics = [];
35
37
  /**
36
- * string[]: List of field names to display
38
+ * Store a reference to the table node after it's first created
39
+ * and initializes the FeatureTable
40
+ *
41
+ * @returns void
37
42
  */
38
- this._fieldNames = [];
43
+ this.onTableNodeCreate = (node) => {
44
+ this._tableNode = node;
45
+ this._getTable(node);
46
+ };
39
47
  this.mapView = undefined;
40
- this._translations = undefined;
48
+ this._layerView = undefined;
41
49
  this._selectedIndexes = [];
50
+ this._translations = undefined;
42
51
  }
43
52
  //--------------------------------------------------------------------------
44
53
  //
45
54
  // Watch handlers
46
55
  //
47
56
  //--------------------------------------------------------------------------
57
+ async mapViewWatchHandler() {
58
+ const mapLayerIds = await getMapLayerIds(this.mapView);
59
+ this._layerView = await getMapLayerView(this.mapView, mapLayerIds[0]);
60
+ }
48
61
  //--------------------------------------------------------------------------
49
62
  //
50
63
  // Methods (public)
@@ -67,18 +80,35 @@ export class LayerTable {
67
80
  */
68
81
  async componentWillLoad() {
69
82
  await this._getTranslations();
83
+ await this._initModules();
70
84
  }
71
85
  /**
72
86
  * Renders the component.
73
87
  */
74
88
  render() {
75
- return (h(Host, null, this._getTableControlRow(), h("div", { class: "data-container" }, h("div", { class: "table-container" }, h("div", { class: "table" }, this._getTableHeader(), this._getTableRows()))), h("edit-record-modal", { ref: (el) => this._editMultipleMpdal = el })));
89
+ if (!this._layerView) {
90
+ return null;
91
+ }
92
+ 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 })));
76
93
  }
77
94
  //--------------------------------------------------------------------------
78
95
  //
79
96
  // Functions (protected)
80
97
  //
81
98
  //--------------------------------------------------------------------------
99
+ /**
100
+ * Load esri javascript api modules
101
+ *
102
+ * @returns Promise resolving when function is done
103
+ *
104
+ * @protected
105
+ */
106
+ async _initModules() {
107
+ const [FeatureTable] = await loadModules([
108
+ "esri/widgets/FeatureTable"
109
+ ]);
110
+ this.FeatureTable = FeatureTable;
111
+ }
82
112
  /**
83
113
  * Gets a row of controls that can be used for various interactions with the table
84
114
  *
@@ -90,104 +120,26 @@ export class LayerTable {
90
120
  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))))));
91
121
  }
92
122
  /**
93
- * Gets the table header with a select all control and column headers for each field
94
- *
95
- * @returns The dom node that contains the header
96
- */
97
- _getTableHeader() {
98
- return (h("div", { class: "header" }, h("div", { class: "table-header-cell padding-3-4" }, h("calcite-checkbox", { class: "display-flex justify-center", onClick: () => this._selectAll(this._selectAllElement.checked), ref: (el) => this._selectAllElement = el })), this._fieldNames.map(name => this._getTableHeaderCell(name))));
99
- }
100
- /**
101
- * Gets a header cell for the table header
123
+ * Initialize the FeatureTable
102
124
  *
103
- * @param name the string to display in the cell
104
- *
105
- * @returns The dom node that contains the header cell
106
- */
107
- _getTableHeaderCell(name) {
108
- return (h("div", { class: "table-header-cell field-width" }, name));
109
- }
110
- /**
111
- * Gets the table rows for all features
112
- *
113
- * @returns The dom node that contains the body of the table
114
- */
115
- _getTableRows() {
116
- return (h("div", { class: "table-body" }, this._graphics.map((g, i) => this._getTableRow(g, i))));
117
- }
118
- /**
119
- * Gets the individual table row for a feature
120
- *
121
- * @param g the graphic the row is based on
122
- * @param index the index location of the row within the table
123
- *
124
- * @returns The dom node that contains the row
125
- */
126
- _getTableRow(g, index) {
127
- // TODO think through this more...should build the fieldType info once up front rather
128
- // than on every single value...
129
- const checked = this._selectedIndexes.indexOf(index) > -1;
130
- return (h("div", { class: "row" }, h("div", { class: "table-cell table-border padding-3-4" }, h("calcite-checkbox", { checked: checked, class: "display-flex justify-center", onClick: () => this._rowSelected(index), value: index })), this._fieldNames.map(name => {
131
- const field = this._layerView.layer.fieldsIndex.get(name);
132
- return this._getTableRowCell(g.attributes[name], field, checked);
133
- })));
134
- }
135
- /**
136
- * Gets the individual table cell for the provided field
137
- *
138
- * @param v the value to display
139
- * @param field the field the row is based on
140
- * @param rowSelected when true editable fields will render a control that will allow the value to be updated
141
- *
142
- * @returns The dom node that contains the table cell
125
+ * @returns void
143
126
  */
144
- _getTableRowCell(v, field, rowSelected) {
145
- const editable = field.editable && rowSelected;
146
- const inputType = this._getInputType(field.type);
147
- // TODO find some domain data to test with..this has not been tested
148
- let domainInput;
149
- const domain = field.domain;
150
- if (domain) {
151
- if (domain.type === "coded-value") {
152
- domainInput = (h("calcite-select", { label: '' }, domain.codedValues.map(cv => {
153
- return (h("calcite-option", { label: cv.name, selected: v === cv.code.toString(), value: cv.code }));
154
- })));
155
- }
156
- else {
157
- // range domain
158
- const range = domain;
159
- domainInput = (h("calcite-input", { max: range.maxValue, min: range.minValue, type: "number", value: v }));
160
- }
127
+ _getTable(node) {
128
+ var _a;
129
+ if ((_a = this._layerView) === null || _a === void 0 ? void 0 : _a.layer) {
130
+ this._table = new this.FeatureTable({
131
+ layer: this._layerView.layer,
132
+ view: this.mapView,
133
+ editingEnabled: true,
134
+ highlightOnRowSelectEnabled: true,
135
+ multiSortEnabled: false,
136
+ visibleElements: {
137
+ header: false,
138
+ menu: false
139
+ },
140
+ container: node
141
+ });
161
142
  }
162
- ;
163
- return (h("div", { class: "table-cell table-border field-width" }, editable && domainInput ? domainInput : editable ? (h("calcite-input", { type: inputType, value: v })) : v));
164
- }
165
- /**
166
- * Simple lookup that will get the appropriate edit control for the value type
167
- *
168
- * @param type the Esri field type
169
- *
170
- * @returns A string for the type of control to create based on the provided field type
171
- */
172
- _getInputType(type) {
173
- // JS API field types
174
- // "string" | "small-integer" | "integer" | "single" | "double" | "long" | "date" | "oid" | "geometry" | "blob" | "raster" | "guid" | "global-id" | "xml"
175
- // not sure about these: "geometry" | "blob" | "raster" | | "xml"
176
- // Calcite input types
177
- // color date datetime-local email file image month number password search tel text(default) textarea time url week
178
- const inputTypes = {
179
- "string": 'text',
180
- "small-integer": "number",
181
- "integer": "number",
182
- "single": "number",
183
- "double": "number",
184
- "long": "number",
185
- "date": "datetime-local",
186
- "oid": "number",
187
- "guid": "text",
188
- "global-id": "text"
189
- };
190
- return Object.keys(inputTypes).indexOf(type) > -1 ? inputTypes[type] : "text";
191
143
  }
192
144
  /**
193
145
  * Select or deselect all rows
@@ -308,6 +260,8 @@ export class LayerTable {
308
260
  this._fieldNames = this._layerView.layer.fields.map(f => f.alias || f.name);
309
261
  this._graphics = await queryAllFeatures(0, this._layerView.layer, []);
310
262
  this._selectedIndexes = [];
263
+ this._table.layer = this._layerView.layer;
264
+ this._table.render();
311
265
  }
312
266
  /**
313
267
  * Fetches the component's translations
@@ -320,7 +274,6 @@ export class LayerTable {
320
274
  this._translations = messages[0];
321
275
  }
322
276
  static get is() { return "layer-table"; }
323
- static get encapsulation() { return "shadow"; }
324
277
  static get originalStyleUrls() {
325
278
  return {
326
279
  "$": ["layer-table.css"]
@@ -356,9 +309,16 @@ export class LayerTable {
356
309
  }
357
310
  static get states() {
358
311
  return {
359
- "_translations": {},
360
- "_selectedIndexes": {}
312
+ "_layerView": {},
313
+ "_selectedIndexes": {},
314
+ "_translations": {}
361
315
  };
362
316
  }
363
317
  static get elementRef() { return "el"; }
318
+ static get watchers() {
319
+ return [{
320
+ "propName": "mapView",
321
+ "methodName": "mapViewWatchHandler"
322
+ }];
323
+ }
364
324
  }
@@ -61,6 +61,10 @@
61
61
  display: flex;
62
62
  }
63
63
 
64
+ .display-grid {
65
+ display: inline-grid;
66
+ }
67
+
64
68
  /* only used if we need to do the map action seperately */
65
69
  .block-button {
66
70
  border-bottom: 0;
@@ -74,13 +78,6 @@
74
78
  background-color: var(--calcite-ui-foreground-3);
75
79
  }
76
80
 
77
- .map-view {
78
- padding: 0;
79
- margin: 0;
80
- height: 100%;
81
- width: 100%;
82
- }
83
-
84
81
  .map-list {
85
82
  position: absolute;
86
83
  inset: 3.5rem 0 0 0;
@@ -35,13 +35,9 @@ export class MapCard {
35
35
  * string: the id of map currently displayed
36
36
  */
37
37
  this._loadedId = "";
38
- /**
39
- * string: the id of the container div for the map
40
- */
41
- this._mapDivId = "map-div";
42
38
  this.mapInfos = [];
39
+ this.mapView = undefined;
43
40
  this._mapListExpanded = false;
44
- this._mapView = undefined;
45
41
  this._translations = undefined;
46
42
  this._webMapId = "";
47
43
  }
@@ -89,7 +85,7 @@ export class MapCard {
89
85
  * Renders the component.
90
86
  */
91
87
  render() {
92
- return (h(Host, null, this._getToolbar(), this._getMapNameList(this._mapListExpanded), h("div", { class: "map-height", id: this._mapDivId })));
88
+ return (h(Host, null, this._getToolbar(), this._getMapNameList(this._mapListExpanded), h("div", { class: "map-height", ref: (el) => (this._mapDiv = el) })));
93
89
  }
94
90
  //--------------------------------------------------------------------------
95
91
  //
@@ -139,13 +135,14 @@ export class MapCard {
139
135
  const webMap = new this.WebMap({
140
136
  portalItem: { id }
141
137
  });
142
- this._mapView = new this.MapView({
143
- container: this._mapDivId,
138
+ this.mapView = new this.MapView({
139
+ container: this._mapDiv,
144
140
  map: webMap,
145
141
  // TODO consider this more...seems to cause less overflow issues when the component is resized
146
142
  resizeAlign: "top-left"
147
143
  });
148
144
  this._loadedId = id;
145
+ this.mapChanged.emit(this.mapView);
149
146
  }
150
147
  }
151
148
  /**
@@ -173,7 +170,7 @@ export class MapCard {
173
170
  */
174
171
  _getMapPicker() {
175
172
  const mapListIcon = this._mapListExpanded ? "chevron-up" : "chevron-down";
176
- 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", 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)))));
173
+ 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)))));
177
174
  }
178
175
  /**
179
176
  * Get a pick list for all maps in mapInfos
@@ -291,13 +288,31 @@ export class MapCard {
291
288
  "text": "IMapInfo[]: array of map infos (name and id)"
292
289
  },
293
290
  "defaultValue": "[]"
291
+ },
292
+ "mapView": {
293
+ "type": "unknown",
294
+ "mutable": false,
295
+ "complexType": {
296
+ "original": "__esri.MapView",
297
+ "resolved": "MapView",
298
+ "references": {
299
+ "___esri": {
300
+ "location": "global"
301
+ }
302
+ }
303
+ },
304
+ "required": false,
305
+ "optional": false,
306
+ "docs": {
307
+ "tags": [],
308
+ "text": "esri/views/View: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html"
309
+ }
294
310
  }
295
311
  };
296
312
  }
297
313
  static get states() {
298
314
  return {
299
315
  "_mapListExpanded": {},
300
- "_mapView": {},
301
316
  "_translations": {},
302
317
  "_webMapId": {}
303
318
  };
@@ -323,6 +338,25 @@ export class MapCard {
323
338
  }
324
339
  }
325
340
  }
341
+ }, {
342
+ "method": "mapChanged",
343
+ "name": "mapChanged",
344
+ "bubbles": true,
345
+ "cancelable": true,
346
+ "composed": true,
347
+ "docs": {
348
+ "tags": [],
349
+ "text": "Emitted when a new map is loaded"
350
+ },
351
+ "complexType": {
352
+ "original": "__esri.MapView",
353
+ "resolved": "MapView",
354
+ "references": {
355
+ "___esri": {
356
+ "location": "global"
357
+ }
358
+ }
359
+ }
326
360
  }];
327
361
  }
328
362
  static get elementRef() { return "el"; }
@@ -142,7 +142,7 @@ export class MapDrawTools {
142
142
  this._sketchGraphicsLayer = this.mapView.map.layers.getItemAt(sketchIndex);
143
143
  }
144
144
  else {
145
- this._sketchGraphicsLayer = new this.GraphicsLayer({ title });
145
+ this._sketchGraphicsLayer = new this.GraphicsLayer({ title, listMode: "hide" });
146
146
  state.managedLayers.push(title);
147
147
  this.mapView.map.layers.add(this._sketchGraphicsLayer);
148
148
  }
@@ -361,7 +361,7 @@ export class MapSelectTools {
361
361
  this._bufferGraphicsLayer = this.mapView.map.layers.getItemAt(bufferIndex);
362
362
  }
363
363
  else {
364
- this._bufferGraphicsLayer = new this.GraphicsLayer({ title });
364
+ this._bufferGraphicsLayer = new this.GraphicsLayer({ title, listMode: "hide" });
365
365
  state.managedLayers.push(title);
366
366
  const sketchIndex = this.mapView.map.layers.findIndex((l) => l.title === this._translations.sketchLayer);
367
367
  if (sketchIndex > -1) {
@@ -85,17 +85,6 @@ export class PublicNotification {
85
85
  void this._home();
86
86
  }
87
87
  }
88
- /**
89
- * Called each time the selectionSets prop is changed.
90
- */
91
- async selectionSetsWatchHandler(v, oldV) {
92
- if (v && v !== oldV && v.length > 0) {
93
- const nonRefineSets = v.filter(ss => ss.workflowType !== EWorkflowType.REFINE);
94
- if (nonRefineSets.length === 0) {
95
- this._selectionSets = [];
96
- }
97
- }
98
- }
99
88
  /**
100
89
  * Called each time the sketchLineSymbol prop is changed.
101
90
  */
@@ -338,7 +327,7 @@ export class PublicNotification {
338
327
  * @protected
339
328
  */
340
329
  _getListPage() {
341
- const hasSets = this._selectionSets.filter(ss => ss.workflowType !== EWorkflowType.REFINE).length > 0;
330
+ const hasSets = this._hasSelections();
342
331
  const total = utils.getTotal(this._selectionSets);
343
332
  return hasSets ? (h("calcite-panel", null, h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: "font-bold" }, this._translations.myLists)), this._getNotice(this._translations.listHasSetsTip, "padding-sides-1 padding-bottom-1"), this._getMapLayerPicker(), h("div", { class: "display-block padding-sides-1 height-1-1-2" }, h("div", { class: "display-block float-left" }, h("calcite-label", { alignment: "start", class: "font-bold" }, this._translations.notifications)), h("div", { class: "display-block float-right" }, h("calcite-input-message", { active: true, class: "info-blue margin-top-0", scale: "m" }, this._translations.uniqueCout.replace("{{n}}", total.toString())))), hasSets ? this._getSelectionSetList() : (h("div", { class: "info-message" }, h("calcite-input-message", { active: true, class: "info-blue", scale: "m" }, this._translations.noNotifications))), h("div", { class: "display-flex padding-1" }, h("calcite-button", { onClick: () => { this._setPageType(EPageType.SELECT); }, width: "full" }, this._translations.add)), this._showModal(this._showLayerSelectionChangeModal))) : (h("calcite-panel", null, h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: "font-bold" }, this._translations.myLists)), h("div", { class: "padding-sides-1" }, h("calcite-label", null, this._translations.notifications)), h("div", { class: "info-message padding-bottom-1" }, h("calcite-input-message", { active: true, class: "info-blue", scale: "m" }, this._translations.noNotifications)), this._getNotice(this._translations.selectLayerAndAdd, "padding-sides-1 padding-bottom-1"), this._getMapLayerPicker(), h("div", { class: "display-flex padding-1" }, h("calcite-button", { onClick: () => { this._setPageType(EPageType.SELECT); }, width: "full" }, this._translations.add))));
344
333
  }
@@ -363,7 +352,8 @@ export class PublicNotification {
363
352
  // REFINE is handled seperately from the core selection sets
364
353
  // You can only access after clicking the refine action
365
354
  this._selectionSets.reduce((prev, cur, i) => {
366
- if (cur.workflowType !== EWorkflowType.REFINE) {
355
+ const validSet = this._isValidSet(cur);
356
+ if (validSet) {
367
357
  prev.push((h("calcite-list-item", { description: this._translations.selectedFeatures.replace("{{n}}", cur.selectedIds.length.toString()), label: cur.label, onClick: () => this._gotoSelection(cur, this.mapView) }, this._getAction(true, "pencil", "", (evt) => this._openSelection(cur, evt), false, "actions-end"), this._getAction(true, "x", "", (evt) => this._deleteSelection(i, evt), false, "actions-end"))));
368
358
  }
369
359
  return prev;
@@ -404,14 +394,38 @@ export class PublicNotification {
404
394
  await this._updateAddresseeLayer(id);
405
395
  }
406
396
  /**
407
- * Check if any selection sets exist.
397
+ * Check if any valid selection sets exist.
408
398
  *
409
- * @returns true if selection sets exist
399
+ * @returns true if valid selection sets exist
410
400
  *
411
401
  * @protected
412
402
  */
413
403
  _hasSelections() {
414
- return this._selectionSets.length > 0;
404
+ return this._selectionSets.filter(ss => this._isValidSet(ss)).length > 0;
405
+ }
406
+ /**
407
+ * Check if any duplicates exist
408
+ *
409
+ * @returns true if duplicates are found
410
+ *
411
+ * @protected
412
+ */
413
+ _hasDuplicates() {
414
+ const selectedIds = this._selectionSets.reduce((prev, cur) => {
415
+ return prev.concat(cur.download ? cur.selectedIds : []);
416
+ }, []);
417
+ return selectedIds.length > new Set(selectedIds).size;
418
+ }
419
+ /**
420
+ * Check if a selection set is valid (exists or has at least one added if its a refine set)
421
+ *
422
+ * @returns true if selection set is valid
423
+ *
424
+ * @protected
425
+ */
426
+ _isValidSet(ss) {
427
+ var _a, _b;
428
+ return ss.workflowType === EWorkflowType.REFINE ? ((_b = (_a = ss === null || ss === void 0 ? void 0 : ss.refineIds) === null || _a === void 0 ? void 0 : _a.addIds) === null || _b === void 0 ? void 0 : _b.length) > 0 : true;
415
429
  }
416
430
  /**
417
431
  * Create the Select page that shows the selection workflows
@@ -480,7 +494,8 @@ export class PublicNotification {
480
494
  _getDownloadPage(type) {
481
495
  const isPdf = type === EExportType.PDF;
482
496
  const hasSelections = this._hasSelections();
483
- return (h("calcite-panel", null, h("div", null, h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: "font-bold" }, isPdf ? this._translations.downloadPDF : this._translations.downloadCSV)), hasSelections ? (h("div", null, h("div", { class: "padding-top-sides-1" }, h("calcite-label", null, this._translations.notifications)), this._getSelectionLists(), h("div", { class: "margin-side-1 padding-top-1 border-bottom" }), h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: isPdf ? "display-none" : "", layout: "inline" }, h("calcite-checkbox", { disabled: !this._downloadActive, ref: (el) => { this._removeDuplicatesCSV = el; } }), this._translations.removeDuplicate), h("calcite-label", { class: isPdf ? "" : "display-none", layout: "inline" }, h("calcite-checkbox", { disabled: !this._downloadActive, ref: (el) => { this._removeDuplicatesPDF = el; } }), this._translations.removeDuplicate)), h("div", { class: isPdf ? "" : "display-none" }, this._getLabel(this._translations.selectPDFLabelOption, false), h("div", { class: "padding-sides-1" }, h("pdf-download", { disabled: !this._downloadActive, layerView: this.addresseeLayer, ref: (el) => { this._downloadTools = el; } }))), h("div", { class: "padding-1 display-flex" }, h("calcite-button", { disabled: !this._downloadActive, onClick: isPdf ? () => this._downloadPDF() : () => this._downloadCSV(), width: "full" }, isPdf ? this._translations.downloadPDF : this._translations.downloadCSV)))) : (this._getNotice(this._translations.downloadNoLists, "padding-sides-1 padding-bottom-1")))));
497
+ const hasDuplicates = this._hasDuplicates();
498
+ return (h("calcite-panel", null, h("div", null, h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: "font-bold" }, isPdf ? this._translations.downloadPDF : this._translations.downloadCSV)), hasSelections ? (h("div", null, h("div", { class: "padding-top-sides-1" }, h("calcite-label", null, this._translations.notifications)), this._getSelectionLists(), h("div", { class: "margin-side-1 padding-top-1 border-bottom" }), h("div", { class: "padding-top-sides-1" }, h("calcite-label", { class: isPdf ? "display-none" : "", disabled: !hasDuplicates, layout: "inline" }, h("calcite-checkbox", { disabled: !hasDuplicates, ref: (el) => { this._removeDuplicatesCSV = el; } }), this._translations.removeDuplicate), h("calcite-label", { class: isPdf ? "" : "display-none", disabled: !hasDuplicates, layout: "inline" }, h("calcite-checkbox", { disabled: !hasDuplicates, ref: (el) => { this._removeDuplicatesPDF = el; } }), this._translations.removeDuplicate)), h("div", { class: isPdf ? "" : "display-none" }, this._getLabel(this._translations.selectPDFLabelOption, false), h("div", { class: "padding-sides-1" }, h("pdf-download", { disabled: !this._downloadActive, layerView: this.addresseeLayer, ref: (el) => { this._downloadTools = el; } }))), h("div", { class: "padding-1 display-flex" }, h("calcite-button", { disabled: !this._downloadActive, onClick: isPdf ? () => this._downloadPDF() : () => this._downloadCSV(), width: "full" }, isPdf ? this._translations.downloadPDF : this._translations.downloadCSV)))) : (this._getNotice(this._translations.downloadNoLists, "padding-sides-1 padding-bottom-1")))));
484
499
  }
485
500
  /**
486
501
  * Create the stacked navigation buttons for a page
@@ -530,7 +545,8 @@ export class PublicNotification {
530
545
  */
531
546
  _getSelectionLists() {
532
547
  return this._selectionSets.reduce((prev, cur) => {
533
- if (cur.workflowType !== EWorkflowType.REFINE) {
548
+ const validSet = this._isValidSet(cur);
549
+ if (validSet) {
534
550
  if (!this._downloadActive && cur.download) {
535
551
  this._downloadActive = true;
536
552
  }
@@ -693,7 +709,7 @@ export class PublicNotification {
693
709
  * @protected
694
710
  */
695
711
  async _updateSelectionSets(layerView) {
696
- const _selectionSets = this._selectionSets.filter(selectionSet => selectionSet.workflowType !== EWorkflowType.REFINE);
712
+ const _selectionSets = this._selectionSets;
697
713
  const oidDefs = [];
698
714
  _selectionSets.forEach(selectionSet => {
699
715
  selectionSet.layerView = layerView;
@@ -777,11 +793,16 @@ export class PublicNotification {
777
793
  */
778
794
  _openSelection(selectionSet, evt) {
779
795
  evt.stopPropagation();
780
- this._activeSelection = selectionSet;
781
- this._distance = this._activeSelection.distance;
782
- this._unit = this._activeSelection.unit;
783
- this._customLabel = this._activeSelection.label;
784
- this._pageType = EPageType.SELECT;
796
+ if (selectionSet.workflowType === EWorkflowType.REFINE) {
797
+ this._pageType = EPageType.REFINE;
798
+ }
799
+ else {
800
+ this._activeSelection = selectionSet;
801
+ this._distance = this._activeSelection.distance;
802
+ this._unit = this._activeSelection.unit;
803
+ this._customLabel = this._activeSelection.label;
804
+ this._pageType = EPageType.SELECT;
805
+ }
785
806
  }
786
807
  /**
787
808
  * Highlight any selected features in the map
@@ -1217,9 +1238,6 @@ export class PublicNotification {
1217
1238
  }, {
1218
1239
  "propName": "searchConfiguration",
1219
1240
  "methodName": "watchSearchConfigurationHandler"
1220
- }, {
1221
- "propName": "_selectionSets",
1222
- "methodName": "selectionSetsWatchHandler"
1223
1241
  }, {
1224
1242
  "propName": "sketchLineSymbol",
1225
1243
  "methodName": "sketchLineSymbolWatchHandler"
@@ -205,7 +205,7 @@ export class RefineSelectionTools {
205
205
  this._sketchGraphicsLayer = this.mapView.map.layers.getItemAt(sketchIndex);
206
206
  }
207
207
  else {
208
- this._sketchGraphicsLayer = new this.GraphicsLayer({ title });
208
+ this._sketchGraphicsLayer = new this.GraphicsLayer({ title, listMode: "hide" });
209
209
  state.managedLayers.push(title);
210
210
  this.mapView.map.layers.add(this._sketchGraphicsLayer);
211
211
  }
@@ -22,26 +22,9 @@
22
22
  | limitations under the License.
23
23
  -->
24
24
  <style>
25
- #viewDiv {
26
- padding: 0;
27
- margin: 0;
28
- height: 100%;
29
- width: 100%;
30
- }
31
- .over-map {
32
- position: absolute;
33
- right: 0px;
34
- background-color: var(--calcite-ui-foreground-1);
35
- }
36
- .column {
37
- min-width: 300px;
38
- padding: 1rem;
39
- border: 1px solid var(--calcite-ui-border-2);
40
- height: -webkit-fill-available;
41
- height: 100%;
42
- }
43
- .column[dir="rtl"] {
44
- float: left;
25
+ .crowdsource {
26
+ height: 100vh;
27
+ width: 100vw;
45
28
  }
46
29
  </style>
47
30
 
@@ -56,30 +39,20 @@
56
39
  <script type="module" src="../solutions-components.esm.js"></script>
57
40
 
58
41
  <script>
59
- require(["esri/WebMap", "esri/views/MapView"], (
60
- WebMap,
61
- MapView
62
- ) => {
63
- var webMap = new WebMap({
64
- portalItem: {
65
- // solutions
66
- // id: "3715f4899bea4b2a948347c5c2357e58"
67
- // InstantApps
68
- id: "863e4f6f2a7840db896cc1b1606d552d"
69
- }
70
- });
71
-
42
+ function addValues() {
72
43
  const demo = document.getElementById("demo");
73
- demo.mapView = new MapView({
74
- container: "viewDiv",
75
- map: webMap
76
- });
77
- });
44
+ demo.mapInfos = [{
45
+ id: "863e4f6f2a7840db896cc1b1606d552d",
46
+ name: "Name of map 1"
47
+ }, {
48
+ id: "3715f4899bea4b2a948347c5c2357e58",
49
+ name: "Name of map 2"
50
+ }];
51
+ }
78
52
  </script>
79
53
  </head>
80
54
 
81
- <body>
82
- <div id="viewDiv"></div>
83
- <crowdsource-manager id="demo" class="over-map column"></crowdsource-manager>
55
+ <body onload="addValues()">
56
+ <crowdsource-manager id="demo" class="crowdsource"/>
84
57
  </body>
85
58
  </html>