@esri/solutions-components 0.5.0 → 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 (162) 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 +88 -92
  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} +131 -5
  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 +19 -17
  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-415ab342.js → downloadUtils-9359e9ff.js} +135 -44
  21. package/dist/cjs/{index.es-98008aa0.js → index.es-9c0d0ed6.js} +3 -3
  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 +1 -1
  25. package/dist/cjs/{mapViewUtils-f617ae9a.js → mapViewUtils-090f4d4d.js} +3 -3
  26. package/dist/cjs/public-notification.cjs.entry.js +173 -48
  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 +1 -1
  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 +4 -8
  43. package/dist/collection/components/map-select-tools/map-select-tools.js +75 -15
  44. package/dist/collection/components/public-notification/public-notification.js +217 -25
  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/queryUtils.js +2 -2
  58. package/dist/collection/utils/queryUtils.ts +2 -2
  59. package/dist/collection/utils/test/csvUtils.spec.tsx +56 -0
  60. package/dist/collection/utils/test/downloadUtils.spec.tsx +133 -0
  61. package/dist/components/crowdsource-manager.js +293 -17
  62. package/dist/components/downloadUtils.js +133 -42
  63. package/dist/components/interfaces3.js +7 -1
  64. package/dist/components/layer-table.js +1 -443
  65. package/dist/components/layer-table2.js +429 -0
  66. package/dist/components/map-card.js +1 -339
  67. package/dist/{esm/map-card.entry.js → components/map-card2.js} +118 -22
  68. package/dist/components/map-draw-tools2.js +19 -23
  69. package/dist/components/map-layer-picker2.js +1 -1
  70. package/dist/components/map-select-tools2.js +21 -16
  71. package/dist/components/public-notification.js +209 -81
  72. package/dist/components/queryUtils.js +2 -2
  73. package/dist/components/refine-selection-tools2.js +3 -3
  74. package/dist/components/refine-selection2.js +1 -1
  75. package/dist/components/solution-resource-item2.js +1 -1
  76. package/dist/components/solution-store.js +1 -1
  77. package/dist/esm/buffer-tools_6.entry.js +79 -83
  78. package/dist/esm/{calcite-block_2.entry.js → calcite-action-bar_4.entry.js} +307 -20
  79. package/dist/esm/{calcite-action.entry.js → calcite-action_2.entry.js} +84 -2
  80. package/dist/esm/{calcite-combobox_3.entry.js → calcite-chip_4.entry.js} +134 -9
  81. package/dist/esm/{calcite-dropdown-group_4.entry.js → calcite-dropdown_5.entry.js} +468 -3
  82. package/dist/esm/calcite-input-message_5.entry.js +19 -17
  83. package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
  84. package/dist/esm/{calcite-action-bar_2.entry.js → calcite-tooltip.entry.js} +4 -209
  85. package/dist/esm/crowdsource-manager.entry.js +88 -14
  86. package/dist/esm/{downloadUtils-606b0f0e.js → downloadUtils-a8f139c5.js} +135 -44
  87. package/dist/esm/{index.es-c736c805.js → index.es-a75412ff.js} +3 -3
  88. package/dist/esm/{interfaces-d0d83efa.js → interfaces-cd4054e5.js} +7 -1
  89. package/dist/esm/layer-table_2.entry.js +507 -0
  90. package/dist/esm/loader.js +1 -1
  91. package/dist/esm/{mapViewUtils-4e945e07.js → mapViewUtils-8ffcd36d.js} +4 -4
  92. package/dist/esm/public-notification.entry.js +169 -44
  93. package/dist/esm/solution-configuration.entry.js +2 -2
  94. package/dist/esm/solution-contents_3.entry.js +2 -2
  95. package/dist/esm/{solution-store-477288ac.js → solution-store-1b67f2c8.js} +1 -1
  96. package/dist/esm/solutions-components.js +1 -1
  97. package/dist/solutions-components/demos/crowdsource-manager.html +14 -41
  98. package/dist/solutions-components/{p-dd11eeb2.js → p-1395b0ef.js} +1 -1
  99. package/dist/solutions-components/{p-4f5641b4.entry.js → p-1affd711.entry.js} +18 -18
  100. package/dist/solutions-components/p-30de8da1.entry.js +17 -0
  101. package/dist/solutions-components/{p-91cad71e.entry.js → p-439c878d.entry.js} +3 -9
  102. package/dist/solutions-components/{p-72117a18.js → p-765a27f3.js} +1 -1
  103. package/dist/solutions-components/p-813a04c3.entry.js +6 -0
  104. package/dist/solutions-components/{p-9e8a371f.entry.js → p-874b39a7.entry.js} +3 -3
  105. package/dist/solutions-components/p-8cece97f.js +21 -0
  106. package/dist/solutions-components/{p-dd0241fb.entry.js → p-97aa7211.entry.js} +1 -1
  107. package/dist/solutions-components/{p-0e459cc7.entry.js → p-a955a3e6.entry.js} +10 -4
  108. package/dist/solutions-components/{p-6a657ff6.js → p-bb64bd47.js} +25 -9
  109. package/dist/solutions-components/p-c392dd95.entry.js +17 -0
  110. package/dist/solutions-components/p-ca386a72.entry.js +6 -0
  111. package/dist/solutions-components/p-d47d74a6.entry.js +23 -0
  112. package/dist/solutions-components/p-db846ee2.entry.js +11 -0
  113. package/dist/solutions-components/p-dc53c9c1.js +36 -0
  114. package/dist/solutions-components/p-e1c93241.entry.js +6 -0
  115. package/dist/solutions-components/{p-4cbaf0f1.entry.js → p-e6d235d6.entry.js} +1 -1
  116. package/dist/solutions-components/solutions-components.esm.js +6 -6
  117. package/dist/solutions-components/utils/csvDownload.ts +42 -0
  118. package/dist/solutions-components/utils/csvUtils.ts +8 -27
  119. package/dist/solutions-components/utils/downloadUtils.ts +36 -14
  120. package/dist/solutions-components/utils/interfaces.ts +6 -0
  121. package/dist/solutions-components/utils/pdfUtils.ts +13 -8
  122. package/dist/solutions-components/utils/queryUtils.ts +2 -2
  123. package/dist/solutions-components/utils/test/csvUtils.spec.tsx +56 -0
  124. package/dist/solutions-components/utils/test/downloadUtils.spec.tsx +133 -0
  125. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +39 -0
  126. package/dist/types/components/layer-table/layer-table.d.ts +35 -48
  127. package/dist/types/components/map-card/map-card.d.ts +10 -6
  128. package/dist/types/components/map-select-tools/map-select-tools.d.ts +16 -1
  129. package/dist/types/components/public-notification/public-notification.d.ts +86 -4
  130. package/dist/types/components.d.ts +68 -0
  131. package/dist/types/preact.d.ts +2 -1
  132. package/dist/types/utils/csvDownload.d.ts +24 -0
  133. package/dist/types/utils/csvUtils.d.ts +2 -1
  134. package/dist/types/utils/downloadUtils.d.ts +25 -0
  135. package/dist/types/utils/interfaces.d.ts +5 -0
  136. package/dist/types/utils/pdfUtils.d.ts +2 -1
  137. package/package.json +4 -4
  138. package/dist/cjs/calcite-chip.cjs.entry.js +0 -142
  139. package/dist/cjs/calcite-dropdown.cjs.entry.js +0 -481
  140. package/dist/cjs/calcite-handle.cjs.entry.js +0 -99
  141. package/dist/cjs/calcite-loader.cjs.entry.js +0 -95
  142. package/dist/cjs/layer-table.cjs.entry.js +0 -317
  143. package/dist/cjs/map-card.cjs.entry.js +0 -252
  144. package/dist/esm/calcite-chip.entry.js +0 -138
  145. package/dist/esm/calcite-dropdown.entry.js +0 -477
  146. package/dist/esm/calcite-handle.entry.js +0 -95
  147. package/dist/esm/calcite-loader.entry.js +0 -91
  148. package/dist/esm/layer-table.entry.js +0 -313
  149. package/dist/solutions-components/p-11132485.entry.js +0 -11
  150. package/dist/solutions-components/p-15b43c29.entry.js +0 -11
  151. package/dist/solutions-components/p-5034aabc.entry.js +0 -11
  152. package/dist/solutions-components/p-5ee7b022.entry.js +0 -12
  153. package/dist/solutions-components/p-6f012424.entry.js +0 -6
  154. package/dist/solutions-components/p-7fd10eb3.entry.js +0 -11
  155. package/dist/solutions-components/p-84bbaebf.entry.js +0 -6
  156. package/dist/solutions-components/p-88e28de2.js +0 -36
  157. package/dist/solutions-components/p-a57ef371.entry.js +0 -6
  158. package/dist/solutions-components/p-ac76d270.entry.js +0 -17
  159. package/dist/solutions-components/p-dbc9a5a8.js +0 -21
  160. package/dist/solutions-components/p-e162304e.entry.js +0 -6
  161. package/dist/solutions-components/p-f5c70be2.entry.js +0 -6
  162. package/dist/solutions-components/p-f6b17cc6.entry.js +0 -11
@@ -19,17 +19,16 @@
19
19
  * limitations under the License.
20
20
  */
21
21
  import { Host, h } from '@stencil/core';
22
+ import { getLocaleComponentStrings } from "../../utils/locale";
23
+ import { ELayoutMode } from '../../utils/interfaces';
22
24
  export class CrowdsourceManager {
23
- //--------------------------------------------------------------------------
24
- //
25
- // Properties (public)
26
- //
27
- //--------------------------------------------------------------------------
28
- //--------------------------------------------------------------------------
29
- //
30
- // State (internal)
31
- //
32
- //--------------------------------------------------------------------------
25
+ constructor() {
26
+ this.mapInfos = [];
27
+ this._translations = undefined;
28
+ this._layoutMode = ELayoutMode.GRID;
29
+ this._mapView = undefined;
30
+ this._panelOpen = true;
31
+ }
33
32
  //--------------------------------------------------------------------------
34
33
  //
35
34
  // Properties (protected)
@@ -50,19 +49,95 @@ export class CrowdsourceManager {
50
49
  // Events (public)
51
50
  //
52
51
  //--------------------------------------------------------------------------
52
+ /**
53
+ * Handle changes to the buffer distance value
54
+ */
55
+ mapChanged(event) {
56
+ this._mapView = event.detail;
57
+ }
53
58
  //--------------------------------------------------------------------------
54
59
  //
55
60
  // Functions (lifecycle)
56
61
  //
57
62
  //--------------------------------------------------------------------------
63
+ async componentWillLoad() {
64
+ await this._getTranslations();
65
+ }
58
66
  render() {
59
- return (h(Host, null, h("slot", null)));
67
+ return (h(Host, null, h("calcite-panel", { class: "width-full height-full", heading: this._translations.header }, h("div", { class: "display-flex", slot: "header-actions-end" }, h("div", { class: "header-text" }, "Layout"), this._getAction("grid-background", ELayoutMode.GRID, this._translations.grid), this._getAction("horizontal-background", ELayoutMode.VERTICAL, this._translations.horizontal), this._getAction("vertical-background", ELayoutMode.HORIZONTAL, this._translations.vertical)), this._getBody(this._layoutMode, this._panelOpen))));
60
68
  }
61
69
  //--------------------------------------------------------------------------
62
70
  //
63
71
  // Functions (protected)
64
72
  //
65
73
  //--------------------------------------------------------------------------
74
+ _getAction(imgClass, layoutMode, tip) {
75
+ return (h("div", null, h("calcite-action", { alignment: "center", appearance: "transparent", compact: false, id: imgClass, indicator: layoutMode === this._layoutMode, onClick: () => { this._setLayoutMode(layoutMode); }, text: "" }, h("div", { class: imgClass + " img-background" })), h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": imgClass }, h("span", null, tip))));
76
+ }
77
+ _getDividerIcon(layoutMode, panelOpen) {
78
+ let icon = "";
79
+ switch (layoutMode) {
80
+ case ELayoutMode.HORIZONTAL:
81
+ icon = panelOpen ? "chevrons-up" : "chevrons-down";
82
+ break;
83
+ default:
84
+ icon = panelOpen ? "chevrons-left" : "chevrons-right";
85
+ break;
86
+ }
87
+ return icon;
88
+ }
89
+ _getMapSizeClass(layoutMode, panelOpen) {
90
+ let sizeClass = "";
91
+ switch (layoutMode) {
92
+ case ELayoutMode.HORIZONTAL:
93
+ sizeClass = `${panelOpen ? "height-1-2" : "height-0"} width-full position-relative`;
94
+ break;
95
+ case ELayoutMode.GRID:
96
+ sizeClass = `height-full position-relative ${panelOpen ? "width-1-3" : "width-0"}`;
97
+ break;
98
+ case ELayoutMode.VERTICAL:
99
+ sizeClass = `height-full position-relative ${panelOpen ? "width-1-2" : "width-0"}`;
100
+ break;
101
+ }
102
+ return sizeClass;
103
+ }
104
+ _getTableSizeClass(layoutMode, panelOpen) {
105
+ let sizeClass = "";
106
+ switch (layoutMode) {
107
+ case ELayoutMode.HORIZONTAL:
108
+ sizeClass = `${panelOpen ? "height-1-2" : "height-full"} width-full display-flex flex-column`;
109
+ break;
110
+ case ELayoutMode.GRID:
111
+ sizeClass = `${panelOpen ? "width-2-3" : "width-full"} height-full display-flex`;
112
+ break;
113
+ case ELayoutMode.VERTICAL:
114
+ sizeClass = `${panelOpen ? "width-1-2" : "width-full"} height-full display-flex`;
115
+ break;
116
+ }
117
+ return sizeClass;
118
+ }
119
+ _getBody(layoutMode, panelOpen) {
120
+ const displayFlex = layoutMode === ELayoutMode.HORIZONTAL ? "" : "display-flex";
121
+ return (h("calcite-shell", { class: "width-full height-full pad-top-51" }, h("div", { class: `width-full height-full ${displayFlex}` }, this._getMap(layoutMode, panelOpen), this._getTable(layoutMode, panelOpen))));
122
+ }
123
+ _getMap(layoutMode, panelOpen) {
124
+ const mapSizeClass = this._getMapSizeClass(layoutMode, panelOpen);
125
+ return (h("div", { class: `${mapSizeClass} overflow-hidden` }, h("div", { style: { "overflow": "hidden" } }, h("map-card", { mapInfos: this.mapInfos }))));
126
+ }
127
+ _getTable(layoutMode, panelOpen) {
128
+ const tableSizeClass = this._getTableSizeClass(layoutMode, panelOpen);
129
+ const icon = this._getDividerIcon(layoutMode, panelOpen);
130
+ const tooltip = panelOpen ? this._translations.close : this._translations.open;
131
+ const id = "toggle-layout";
132
+ const toggleSizeClass = layoutMode === ELayoutMode.HORIZONTAL ? "divider-h" : "divider-w";
133
+ return (h("div", { class: tableSizeClass }, h("div", { class: `border ${toggleSizeClass}` }, h("div", { class: "toggle-node" }, h("calcite-action", { class: "toggle-node", icon: icon, id: id, onclick: () => this._toggleLayout(), text: "" }), h("calcite-tooltip", { label: tooltip, placement: "bottom", "reference-element": id }, h("span", null, tooltip)))), h("div", { class: "width-full height-full" }, h("layer-table", { mapView: this === null || this === void 0 ? void 0 : this._mapView }))));
134
+ }
135
+ _setLayoutMode(layoutMode) {
136
+ this._layoutMode = layoutMode;
137
+ }
138
+ _toggleLayout() {
139
+ this._panelOpen = !this._panelOpen;
140
+ }
66
141
  /**
67
142
  * Fetches the component's translations
68
143
  *
@@ -70,11 +145,10 @@ export class CrowdsourceManager {
70
145
  * @protected
71
146
  */
72
147
  async _getTranslations() {
73
- // const messages = await getLocaleComponentStrings(this.el);
74
- // this._translations = messages[0] as typeof BufferTools_T9n;
148
+ const messages = await getLocaleComponentStrings(this.el);
149
+ this._translations = messages[0];
75
150
  }
76
151
  static get is() { return "crowdsource-manager"; }
77
- static get encapsulation() { return "shadow"; }
78
152
  static get originalStyleUrls() {
79
153
  return {
80
154
  "$": ["crowdsource-manager.css"]
@@ -85,5 +159,47 @@ export class CrowdsourceManager {
85
159
  "$": ["crowdsource-manager.css"]
86
160
  };
87
161
  }
162
+ static get properties() {
163
+ return {
164
+ "mapInfos": {
165
+ "type": "unknown",
166
+ "mutable": false,
167
+ "complexType": {
168
+ "original": "IMapInfo[]",
169
+ "resolved": "IMapInfo[]",
170
+ "references": {
171
+ "IMapInfo": {
172
+ "location": "import",
173
+ "path": "../../utils/interfaces"
174
+ }
175
+ }
176
+ },
177
+ "required": false,
178
+ "optional": false,
179
+ "docs": {
180
+ "tags": [],
181
+ "text": "IMapInfo[]: array of map infos (name and id)"
182
+ },
183
+ "defaultValue": "[]"
184
+ }
185
+ };
186
+ }
187
+ static get states() {
188
+ return {
189
+ "_translations": {},
190
+ "_layoutMode": {},
191
+ "_mapView": {},
192
+ "_panelOpen": {}
193
+ };
194
+ }
88
195
  static get elementRef() { return "el"; }
196
+ static get listeners() {
197
+ return [{
198
+ "name": "mapChanged",
199
+ "method": "mapChanged",
200
+ "target": "window",
201
+ "capture": false,
202
+ "passive": false
203
+ }];
204
+ }
89
205
  }
@@ -18,44 +18,8 @@
18
18
  display: block;
19
19
  }
20
20
 
21
- .table {
22
- display: table;
23
- width: 100%;
24
- }
25
-
26
- .header {
27
- display: table-header-group;
28
- background-color: #757575;
29
- font-weight: 500;
30
- font-size: var(--calcite-font-size-0);
31
- color: var(--calcite-ui-text-inverse);
32
- position: sticky;
33
- top: 0;
34
- z-index: 1;
35
- }
36
-
37
- .table-header-cell {
38
- display: table-cell;
39
- text-align: justify;
40
- border-right: 1px solid var(--calcite-ui-border-2);
41
- padding: 0.5rem;
42
- }
43
-
44
- .table-body {
45
- display: table-row-group;
46
- }
47
-
48
- .row {
49
- display: table-row;
50
- }
51
-
52
- .table-cell {
53
- display: table-cell;
54
- padding: 0.5rem;
55
- }
56
-
57
- .display-table-header {
58
- display: table-header-group;
21
+ .table-div {
22
+ height: calc(100% - 35px);
59
23
  }
60
24
 
61
25
  .display-flex {
@@ -65,35 +29,3 @@
65
29
  .table-border {
66
30
  border: 1px solid var(--calcite-ui-border-2);
67
31
  }
68
-
69
- .justify-center {
70
- justify-content: center;
71
- }
72
-
73
- .table-container {
74
- width: 100%;
75
- }
76
-
77
- .overflow-auto {
78
- overflow: auto;
79
- }
80
-
81
- .data-container {
82
- overflow: auto;
83
- height: calc(100% - 35px);
84
- }
85
-
86
- .row:nth-child(odd) {
87
- background: var(--calcite-ui-foreground-3);
88
- }
89
-
90
- .padding-3-4 {
91
- padding: 0.75rem;
92
- }
93
-
94
- .field-width {
95
- white-space: nowrap;
96
- min-width: 300px;
97
- max-width: 300px;
98
- overflow: hidden;
99
- }
@@ -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
  }
@@ -165,9 +165,9 @@ export class MapDrawTools {
165
165
  "mode": "hybrid"
166
166
  }
167
167
  });
168
- this.pointSymbol = this._sketchWidget.viewModel.pointSymbol;
169
- this.polylineSymbol = this._sketchWidget.viewModel.polylineSymbol;
170
- this.polygonSymbol = this._sketchWidget.viewModel.polygonSymbol;
168
+ this._sketchWidget.viewModel.polylineSymbol = this.polylineSymbol;
169
+ this._sketchWidget.viewModel.pointSymbol = this.pointSymbol;
170
+ this._sketchWidget.viewModel.polygonSymbol = this.polygonSymbol;
171
171
  this._sketchWidget.visibleElements = {
172
172
  selectionTools: {
173
173
  "lasso-selection": false,
@@ -178,10 +178,6 @@ export class MapDrawTools {
178
178
  undoRedoMenu: false
179
179
  };
180
180
  this._sketchWidget.on("update", (evt) => {
181
- if (evt.state === "start") {
182
- this.graphics = evt.graphics;
183
- this.sketchGraphicsChange.emit(this.graphics);
184
- }
185
181
  if (evt.state === "active") {
186
182
  clearTimeout(this._selectionTimer);
187
183
  this._selectionTimer = setTimeout(() => {