@esri/solutions-components 0.6.34 → 0.6.35

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 (61) hide show
  1. package/dist/cjs/calcite-alert_3.cjs.entry.js +20 -6
  2. package/dist/cjs/calcite-combobox_6.cjs.entry.js +1 -1
  3. package/dist/cjs/card-manager_3.cjs.entry.js +83 -13
  4. package/dist/cjs/crowdsource-manager.cjs.entry.js +27 -4
  5. package/dist/cjs/{downloadUtils-b37689dd.js → downloadUtils-37d9aaf3.js} +2 -2
  6. package/dist/cjs/{index.es-83e253dc.js → index.es-d1d9b140.js} +2 -2
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/map-select-tools_3.cjs.entry.js +2 -2
  9. package/dist/cjs/{mapViewUtils-303bf42d.js → mapViewUtils-96172223.js} +18 -0
  10. package/dist/cjs/public-notification.cjs.entry.js +2 -2
  11. package/dist/cjs/solutions-components.cjs.js +1 -1
  12. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +30 -4
  13. package/dist/collection/components/edit-card/edit-card.js +19 -6
  14. package/dist/collection/components/layer-table/layer-table.js +56 -5
  15. package/dist/collection/components/map-card/map-card.js +34 -6
  16. package/dist/collection/utils/mapViewUtils.js +17 -0
  17. package/dist/collection/utils/mapViewUtils.ts +20 -0
  18. package/dist/components/crowdsource-manager.js +30 -5
  19. package/dist/components/edit-card2.js +19 -6
  20. package/dist/components/layer-table2.js +54 -6
  21. package/dist/components/map-card2.js +34 -7
  22. package/dist/components/map-layer-picker2.js +1 -1
  23. package/dist/components/map-select-tools2.js +1 -1
  24. package/dist/components/mapViewUtils.js +18 -1
  25. package/dist/components/public-notification.js +1 -1
  26. package/dist/components/refine-selection2.js +1 -1
  27. package/dist/esm/calcite-alert_3.entry.js +20 -6
  28. package/dist/esm/calcite-combobox_6.entry.js +1 -1
  29. package/dist/esm/card-manager_3.entry.js +83 -13
  30. package/dist/esm/crowdsource-manager.entry.js +27 -4
  31. package/dist/esm/{downloadUtils-ddd7eeb7.js → downloadUtils-76379e4a.js} +2 -2
  32. package/dist/esm/{index.es-a53707d1.js → index.es-0d134a52.js} +2 -2
  33. package/dist/esm/loader.js +1 -1
  34. package/dist/esm/map-select-tools_3.entry.js +2 -2
  35. package/dist/esm/{mapViewUtils-43c930f1.js → mapViewUtils-08f6cfce.js} +18 -1
  36. package/dist/esm/public-notification.entry.js +2 -2
  37. package/dist/esm/solutions-components.js +1 -1
  38. package/dist/solutions-components/{p-05ba41f9.js → p-03130804.js} +1 -1
  39. package/dist/solutions-components/{p-e05cf92d.entry.js → p-0f50087e.entry.js} +2 -2
  40. package/dist/solutions-components/{p-f2194390.js → p-15070568.js} +1 -1
  41. package/dist/solutions-components/{p-4792005c.entry.js → p-1682bd0f.entry.js} +1 -1
  42. package/dist/solutions-components/p-63867402.entry.js +6 -0
  43. package/dist/solutions-components/{p-50a3a887.entry.js → p-81a0c88f.entry.js} +1 -1
  44. package/dist/solutions-components/{p-978a26b3.entry.js → p-9800e602.entry.js} +1 -1
  45. package/dist/solutions-components/{p-b745143d.js → p-b02eb8f4.js} +2 -2
  46. package/dist/solutions-components/p-eba875d9.entry.js +6 -0
  47. package/dist/solutions-components/solutions-components.esm.js +1 -1
  48. package/dist/solutions-components/utils/mapViewUtils.ts +20 -0
  49. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +10 -0
  50. package/dist/types/components/edit-card/edit-card.d.ts +5 -1
  51. package/dist/types/components/layer-table/layer-table.d.ts +24 -0
  52. package/dist/types/components/map-card/map-card.d.ts +14 -0
  53. package/dist/types/utils/mapViewUtils.d.ts +9 -0
  54. package/package.json +1 -1
  55. package/dist/esm/polyfills/core-js.js +0 -11
  56. package/dist/esm/polyfills/dom.js +0 -79
  57. package/dist/esm/polyfills/es5-html-element.js +0 -1
  58. package/dist/esm/polyfills/index.js +0 -34
  59. package/dist/esm/polyfills/system.js +0 -6
  60. package/dist/solutions-components/p-506db776.entry.js +0 -6
  61. package/dist/solutions-components/p-80243d29.entry.js +0 -6
@@ -21,6 +21,7 @@
21
21
  import { Host, h } from "@stencil/core";
22
22
  import { loadModules } from "../../utils/loadModules";
23
23
  import { getLocaleComponentStrings } from "../../utils/locale";
24
+ import { getAllLayers } from "../../utils/mapViewUtils";
24
25
  export class EditCard {
25
26
  constructor() {
26
27
  /**
@@ -51,7 +52,7 @@ export class EditCard {
51
52
  var _a;
52
53
  if (v && ((_a = this.graphics) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.graphicIndex > -1) {
53
54
  this._editorLoading = true;
54
- this._initEditorWidget();
55
+ await this._initEditorWidget();
55
56
  if (this.graphicIndex > -1 && this.graphics.length > 0 && this.open && !this._shouldClose) {
56
57
  await this._startUpdate();
57
58
  }
@@ -133,19 +134,24 @@ export class EditCard {
133
134
  *
134
135
  * @returns void
135
136
  */
136
- _initEditorWidget() {
137
+ async _initEditorWidget() {
137
138
  if (this.mapView && this.graphics && this.graphics.length > 0 && this.graphics[0]) {
138
139
  if (this._editor) {
139
140
  this._editor.destroy();
140
141
  }
141
142
  const container = document.createElement("div");
143
+ const layers = await getAllLayers(this.mapView);
144
+ const layerInfos = layers.map(layer => {
145
+ return {
146
+ layer,
147
+ geometryUpdatesEnabled: false,
148
+ addEnabled: false
149
+ };
150
+ });
142
151
  this._editor = new this.Editor({
143
152
  allowedWorkflows: "update",
144
153
  view: this.mapView,
145
- layerInfos: [{
146
- layer: this._layer,
147
- geometryUpdatesEnabled: false
148
- }],
154
+ layerInfos,
149
155
  visibleElements: {
150
156
  snappingControls: false,
151
157
  sketchTooltipControls: false
@@ -156,6 +162,7 @@ export class EditCard {
156
162
  this._editHandle.remove();
157
163
  this._attachmentHandle.remove();
158
164
  this._activeWorkflowHandle.remove();
165
+ this._addRelatedRecordHandle.remove();
159
166
  }
160
167
  this._attachmentHandle = this.reactiveUtils.when(() => this._editor.viewModel.state === "adding-attachment" ||
161
168
  this._editor.viewModel.state === "editing-attachment" ||
@@ -175,6 +182,12 @@ export class EditCard {
175
182
  this._shouldClose = false;
176
183
  }
177
184
  });
185
+ // Temp workaround until a new prop is added at 4.29
186
+ this._addRelatedRecordHandle = this.reactiveUtils.when(() => !!this._editor.viewModel.featureFormViewModel.relatedRecordCallbacks, () => {
187
+ this._editor.viewModel.featureFormViewModel.relatedRecordCallbacks.addRelatedRecord = null;
188
+ }, {
189
+ once: true
190
+ });
178
191
  // had issues with destroy before adding like this
179
192
  this._editContainer.appendChild(container);
180
193
  }
@@ -69,6 +69,32 @@ export class LayerTable {
69
69
  // Watch handlers
70
70
  //
71
71
  //--------------------------------------------------------------------------
72
+ /**
73
+ * Reset the toolInfos when zoom tool is enabled/disabled
74
+ */
75
+ enableZoomWatchHandler() {
76
+ var _a;
77
+ if (((_a = this._toolInfos) === null || _a === void 0 ? void 0 : _a.length) > 0) {
78
+ this._initToolInfos();
79
+ }
80
+ }
81
+ /**
82
+ * Reset the toolInfos when export csv is enabled/disabled
83
+ */
84
+ enableCSVWatchHandler() {
85
+ var _a;
86
+ if (((_a = this._toolInfos) === null || _a === void 0 ? void 0 : _a.length) > 0) {
87
+ this._initToolInfos();
88
+ }
89
+ }
90
+ /**
91
+ * Update the table when enableInlineEdit is enabled/disabled
92
+ */
93
+ enableInlineEditWatchHandler() {
94
+ if (this._table) {
95
+ this._table.editingEnabled = this._editEnabled && this.enableInlineEdit;
96
+ }
97
+ }
72
98
  /**
73
99
  * watch for changes to the list of controls that will currently fit in the display
74
100
  */
@@ -272,7 +298,7 @@ export class LayerTable {
272
298
  * @returns void
273
299
  */
274
300
  _validateEnabledActions() {
275
- const featuresSelected = this._selectedIndexes.length > 0;
301
+ const featuresSelected = this._featuresSelected();
276
302
  const selectionDependant = [
277
303
  "zoom-to-object",
278
304
  "trash",
@@ -294,8 +320,8 @@ export class LayerTable {
294
320
  */
295
321
  _initToolInfos() {
296
322
  var _a;
297
- const featuresSelected = this._selectedIndexes.length > 0;
298
- const featuresEmpty = this._allIds.length === 0;
323
+ const featuresSelected = this._featuresSelected();
324
+ const featuresEmpty = this._featuresEmpty();
299
325
  this._toolInfos = [this.enableZoom ? {
300
326
  icon: "zoom-to-object",
301
327
  label: this._translations.zoom,
@@ -357,6 +383,22 @@ export class LayerTable {
357
383
  } : undefined];
358
384
  this._defaultVisibleToolSizeInfos = undefined;
359
385
  }
386
+ /**
387
+ * Returns true when one ore more features are selected
388
+ *
389
+ * @returns boolean
390
+ */
391
+ _featuresSelected() {
392
+ return this._selectedIndexes.length > 0;
393
+ }
394
+ /**
395
+ * Return true when we have no features
396
+ *
397
+ * @returns boolean
398
+ */
399
+ _featuresEmpty() {
400
+ return this._allIds.length === 0;
401
+ }
360
402
  /**
361
403
  * Add/Remove tools from the action bar and dropdown based on available size
362
404
  *
@@ -585,7 +627,7 @@ export class LayerTable {
585
627
  // https://github.com/Esri/solutions-components/issues/365
586
628
  this._selectedIndexes = this._table.highlightIds.toArray().reverse();
587
629
  if (this._showOnlySelected) {
588
- if (this._selectedIndexes.length > 0) {
630
+ if (this._featuresSelected()) {
589
631
  this._table.filterBySelection();
590
632
  }
591
633
  else {
@@ -835,7 +877,7 @@ export class LayerTable {
835
877
  async _layerSelectionChanged(evt) {
836
878
  var _a;
837
879
  const id = evt.detail[0];
838
- if (id !== ((_a = this._layer) === null || _a === void 0 ? void 0 : _a.id) || this._allIds.length === 0) {
880
+ if (id !== ((_a = this._layer) === null || _a === void 0 ? void 0 : _a.id) || this._featuresEmpty()) {
839
881
  this._fetchingData = true;
840
882
  const layer = await getLayerOrTable(this.mapView, id);
841
883
  await layer.when(() => {
@@ -1114,6 +1156,15 @@ export class LayerTable {
1114
1156
  static get elementRef() { return "el"; }
1115
1157
  static get watchers() {
1116
1158
  return [{
1159
+ "propName": "enableZoom",
1160
+ "methodName": "enableZoomWatchHandler"
1161
+ }, {
1162
+ "propName": "enableCSV",
1163
+ "methodName": "enableCSVWatchHandler"
1164
+ }, {
1165
+ "propName": "enableInlineEdit",
1166
+ "methodName": "enableInlineEditWatchHandler"
1167
+ }, {
1117
1168
  "propName": "_controlsThatFit",
1118
1169
  "methodName": "_controlsThatFitWatchHandler"
1119
1170
  }, {
@@ -45,6 +45,17 @@ export class MapCard {
45
45
  this._searchConfiguration = undefined;
46
46
  this._webMapInfo = undefined;
47
47
  }
48
+ //--------------------------------------------------------------------------
49
+ //
50
+ // Watch handlers
51
+ //
52
+ //--------------------------------------------------------------------------
53
+ /**
54
+ * Add/remove home widget
55
+ */
56
+ enableHomeWatchHandler() {
57
+ this._initHome();
58
+ }
48
59
  /**
49
60
  * Listen for changes to map info and load the appropriate map
50
61
  */
@@ -119,12 +130,7 @@ export class MapCard {
119
130
  this._searchConfiguration = this._webMapInfo.searchConfiguration;
120
131
  this.beforeMapChanged.emit();
121
132
  await this.mapView.when(() => {
122
- if (this.enableHome) {
123
- const home = new this.Home({
124
- view: this.mapView
125
- });
126
- this.mapView.ui.add(home, { position: "top-left", index: 3 });
127
- }
133
+ this._initHome();
128
134
  this.mapView.ui.add(this._mapTools, { position: "top-right", index: 0 });
129
135
  this.mapChanged.emit({
130
136
  id: id,
@@ -133,6 +139,22 @@ export class MapCard {
133
139
  });
134
140
  }
135
141
  }
142
+ /**
143
+ * Add/remove the home widget base on enableHome prop
144
+ *
145
+ * @protected
146
+ */
147
+ _initHome() {
148
+ if (this.enableHome) {
149
+ this._homeWidget = new this.Home({
150
+ view: this.mapView
151
+ });
152
+ this.mapView.ui.add(this._homeWidget, { position: "top-left", index: 3 });
153
+ }
154
+ else if (this._homeWidget) {
155
+ this.mapView.ui.remove(this._homeWidget);
156
+ }
157
+ }
136
158
  static get is() { return "map-card"; }
137
159
  static get originalStyleUrls() {
138
160
  return {
@@ -376,6 +398,12 @@ export class MapCard {
376
398
  }];
377
399
  }
378
400
  static get elementRef() { return "el"; }
401
+ static get watchers() {
402
+ return [{
403
+ "propName": "enableHome",
404
+ "methodName": "enableHomeWatchHandler"
405
+ }];
406
+ }
379
407
  static get listeners() {
380
408
  return [{
381
409
  "name": "mapInfoChange",
@@ -130,6 +130,23 @@ export async function getLayerOrTable(mapView, id) {
130
130
  });
131
131
  return layers.length > 0 ? layers[0] : undefined;
132
132
  }
133
+ /**
134
+ * Gets all of the layers from the current map when the map and their layerView is ready
135
+ *
136
+ * @param mapView the map view to fetch the layer names from
137
+ *
138
+ * @returns Promise resolving with an array of all layers
139
+ *
140
+ */
141
+ export async function getAllLayers(mapView) {
142
+ const layers = mapView.map.allLayers.toArray();
143
+ let layerViewPromises;
144
+ await mapView.when(() => {
145
+ layerViewPromises = layers.map(l => mapView.whenLayerView(l));
146
+ });
147
+ await Promise.allSettled(layerViewPromises);
148
+ return layers;
149
+ }
133
150
  /**
134
151
  * Highlight features by OID
135
152
  *
@@ -155,6 +155,26 @@ export async function getLayerOrTable(
155
155
  return layers.length > 0 ? layers[0] : undefined;
156
156
  }
157
157
 
158
+ /**
159
+ * Gets all of the layers from the current map when the map and their layerView is ready
160
+ *
161
+ * @param mapView the map view to fetch the layer names from
162
+ *
163
+ * @returns Promise resolving with an array of all layers
164
+ *
165
+ */
166
+ export async function getAllLayers(
167
+ mapView: __esri.MapView
168
+ ): Promise<__esri.Layer[]> {
169
+ const layers = mapView.map.allLayers.toArray();
170
+ let layerViewPromises;
171
+ await mapView.when(() => {
172
+ layerViewPromises = layers.map(l => mapView.whenLayerView(l));
173
+ });
174
+ await Promise.allSettled(layerViewPromises);
175
+ return layers;
176
+ }
177
+
158
178
  /**
159
179
  * Highlight features by OID
160
180
  *
@@ -91,6 +91,12 @@ const CrowdsourceManager$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceM
91
91
  // Watch handlers
92
92
  //
93
93
  //--------------------------------------------------------------------------
94
+ /**
95
+ * When true the map zoom tools will be available
96
+ */
97
+ enableZoomWatchHandler() {
98
+ this._initMapZoom();
99
+ }
94
100
  //--------------------------------------------------------------------------
95
101
  //
96
102
  // Methods (public)
@@ -373,14 +379,28 @@ const CrowdsourceManager$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceM
373
379
  * @protected
374
380
  */
375
381
  _setMapView() {
376
- var _a, _b;
377
382
  this._mapInfo = this._getMapInfo(this._mapChange.id);
378
383
  this._mapView = this._mapChange.mapView;
379
- if (!this.enableZoom && ((_b = (_a = this._mapView) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.components.indexOf("zoom")) > -1) {
380
- this._mapView.ui.components = this._mapView.ui.components.filter(c => c !== "zoom");
381
- }
384
+ this._initMapZoom();
382
385
  this._mapView.popupEnabled = false;
383
386
  }
387
+ /**
388
+ * Add/remove zoom tools based on enableZoom prop
389
+ *
390
+ * @protected
391
+ */
392
+ _initMapZoom() {
393
+ if (!this.enableZoom) {
394
+ this._mapView.ui.remove("zoom");
395
+ }
396
+ else if (this.enableZoom) {
397
+ this._mapView.ui.add({
398
+ component: "zoom",
399
+ position: "top-left",
400
+ index: 0
401
+ });
402
+ }
403
+ }
384
404
  /**
385
405
  * Fetches the component's translations
386
406
  *
@@ -392,6 +412,9 @@ const CrowdsourceManager$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceM
392
412
  this._translations = messages[0];
393
413
  }
394
414
  get el() { return this; }
415
+ static get watchers() { return {
416
+ "enableZoom": ["enableZoomWatchHandler"]
417
+ }; }
395
418
  static get style() { return crowdsourceManagerCss; }
396
419
  }, [0, "crowdsource-manager", {
397
420
  "classicGrid": [4, "classic-grid"],
@@ -418,7 +441,9 @@ const CrowdsourceManager$1 = /*@__PURE__*/ proxyCustomElement(class CrowdsourceM
418
441
  "_layoutMode": [32],
419
442
  "_mapView": [32],
420
443
  "_panelOpen": [32]
421
- }, [[8, "layoutChanged", "layoutChanged"], [8, "mapChanged", "mapChanged"], [8, "beforeMapChanged", "beforeMapChanged"]]]);
444
+ }, [[8, "layoutChanged", "layoutChanged"], [8, "mapChanged", "mapChanged"], [8, "beforeMapChanged", "beforeMapChanged"]], {
445
+ "enableZoom": ["enableZoomWatchHandler"]
446
+ }]);
422
447
  function defineCustomElement$1() {
423
448
  if (typeof customElements === "undefined") {
424
449
  return;
@@ -6,6 +6,7 @@
6
6
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
7
7
  import { l as loadModules } from './loadModules.js';
8
8
  import { g as getLocaleComponentStrings } from './locale.js';
9
+ import { a as getAllLayers } from './mapViewUtils.js';
9
10
  import { d as defineCustomElement$3 } from './icon.js';
10
11
  import { d as defineCustomElement$2 } from './loader.js';
11
12
  import { d as defineCustomElement$1 } from './notice.js';
@@ -46,7 +47,7 @@ const EditCard = /*@__PURE__*/ proxyCustomElement(class EditCard extends HTMLEle
46
47
  var _a;
47
48
  if (v && ((_a = this.graphics) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.graphicIndex > -1) {
48
49
  this._editorLoading = true;
49
- this._initEditorWidget();
50
+ await this._initEditorWidget();
50
51
  if (this.graphicIndex > -1 && this.graphics.length > 0 && this.open && !this._shouldClose) {
51
52
  await this._startUpdate();
52
53
  }
@@ -128,19 +129,24 @@ const EditCard = /*@__PURE__*/ proxyCustomElement(class EditCard extends HTMLEle
128
129
  *
129
130
  * @returns void
130
131
  */
131
- _initEditorWidget() {
132
+ async _initEditorWidget() {
132
133
  if (this.mapView && this.graphics && this.graphics.length > 0 && this.graphics[0]) {
133
134
  if (this._editor) {
134
135
  this._editor.destroy();
135
136
  }
136
137
  const container = document.createElement("div");
138
+ const layers = await getAllLayers(this.mapView);
139
+ const layerInfos = layers.map(layer => {
140
+ return {
141
+ layer,
142
+ geometryUpdatesEnabled: false,
143
+ addEnabled: false
144
+ };
145
+ });
137
146
  this._editor = new this.Editor({
138
147
  allowedWorkflows: "update",
139
148
  view: this.mapView,
140
- layerInfos: [{
141
- layer: this._layer,
142
- geometryUpdatesEnabled: false
143
- }],
149
+ layerInfos,
144
150
  visibleElements: {
145
151
  snappingControls: false,
146
152
  sketchTooltipControls: false
@@ -151,6 +157,7 @@ const EditCard = /*@__PURE__*/ proxyCustomElement(class EditCard extends HTMLEle
151
157
  this._editHandle.remove();
152
158
  this._attachmentHandle.remove();
153
159
  this._activeWorkflowHandle.remove();
160
+ this._addRelatedRecordHandle.remove();
154
161
  }
155
162
  this._attachmentHandle = this.reactiveUtils.when(() => this._editor.viewModel.state === "adding-attachment" ||
156
163
  this._editor.viewModel.state === "editing-attachment" ||
@@ -170,6 +177,12 @@ const EditCard = /*@__PURE__*/ proxyCustomElement(class EditCard extends HTMLEle
170
177
  this._shouldClose = false;
171
178
  }
172
179
  });
180
+ // Temp workaround until a new prop is added at 4.29
181
+ this._addRelatedRecordHandle = this.reactiveUtils.when(() => !!this._editor.viewModel.featureFormViewModel.relatedRecordCallbacks, () => {
182
+ this._editor.viewModel.featureFormViewModel.relatedRecordCallbacks.addRelatedRecord = null;
183
+ }, {
184
+ once: true
185
+ });
173
186
  // had issues with destroy before adding like this
174
187
  this._editContainer.appendChild(container);
175
188
  }
@@ -6,7 +6,7 @@
6
6
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
7
7
  import { l as loadModules } from './loadModules.js';
8
8
  import { g as getLocaleComponentStrings } from './locale.js';
9
- import { a as goToSelection, g as getLayerOrTable } from './mapViewUtils.js';
9
+ import { b as goToSelection, g as getLayerOrTable } from './mapViewUtils.js';
10
10
  import { b as queryAllIds } from './queryUtils.js';
11
11
  import { d as downloadCSV } from './downloadUtils.js';
12
12
  import { d as defineCustomElement$n } from './action.js';
@@ -84,6 +84,32 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
84
84
  // Watch handlers
85
85
  //
86
86
  //--------------------------------------------------------------------------
87
+ /**
88
+ * Reset the toolInfos when zoom tool is enabled/disabled
89
+ */
90
+ enableZoomWatchHandler() {
91
+ var _a;
92
+ if (((_a = this._toolInfos) === null || _a === void 0 ? void 0 : _a.length) > 0) {
93
+ this._initToolInfos();
94
+ }
95
+ }
96
+ /**
97
+ * Reset the toolInfos when export csv is enabled/disabled
98
+ */
99
+ enableCSVWatchHandler() {
100
+ var _a;
101
+ if (((_a = this._toolInfos) === null || _a === void 0 ? void 0 : _a.length) > 0) {
102
+ this._initToolInfos();
103
+ }
104
+ }
105
+ /**
106
+ * Update the table when enableInlineEdit is enabled/disabled
107
+ */
108
+ enableInlineEditWatchHandler() {
109
+ if (this._table) {
110
+ this._table.editingEnabled = this._editEnabled && this.enableInlineEdit;
111
+ }
112
+ }
87
113
  /**
88
114
  * watch for changes to the list of controls that will currently fit in the display
89
115
  */
@@ -287,7 +313,7 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
287
313
  * @returns void
288
314
  */
289
315
  _validateEnabledActions() {
290
- const featuresSelected = this._selectedIndexes.length > 0;
316
+ const featuresSelected = this._featuresSelected();
291
317
  const selectionDependant = [
292
318
  "zoom-to-object",
293
319
  "trash",
@@ -309,8 +335,8 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
309
335
  */
310
336
  _initToolInfos() {
311
337
  var _a;
312
- const featuresSelected = this._selectedIndexes.length > 0;
313
- const featuresEmpty = this._allIds.length === 0;
338
+ const featuresSelected = this._featuresSelected();
339
+ const featuresEmpty = this._featuresEmpty();
314
340
  this._toolInfos = [this.enableZoom ? {
315
341
  icon: "zoom-to-object",
316
342
  label: this._translations.zoom,
@@ -372,6 +398,22 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
372
398
  } : undefined];
373
399
  this._defaultVisibleToolSizeInfos = undefined;
374
400
  }
401
+ /**
402
+ * Returns true when one ore more features are selected
403
+ *
404
+ * @returns boolean
405
+ */
406
+ _featuresSelected() {
407
+ return this._selectedIndexes.length > 0;
408
+ }
409
+ /**
410
+ * Return true when we have no features
411
+ *
412
+ * @returns boolean
413
+ */
414
+ _featuresEmpty() {
415
+ return this._allIds.length === 0;
416
+ }
375
417
  /**
376
418
  * Add/Remove tools from the action bar and dropdown based on available size
377
419
  *
@@ -600,7 +642,7 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
600
642
  // https://github.com/Esri/solutions-components/issues/365
601
643
  this._selectedIndexes = this._table.highlightIds.toArray().reverse();
602
644
  if (this._showOnlySelected) {
603
- if (this._selectedIndexes.length > 0) {
645
+ if (this._featuresSelected()) {
604
646
  this._table.filterBySelection();
605
647
  }
606
648
  else {
@@ -850,7 +892,7 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
850
892
  async _layerSelectionChanged(evt) {
851
893
  var _a;
852
894
  const id = evt.detail[0];
853
- if (id !== ((_a = this._layer) === null || _a === void 0 ? void 0 : _a.id) || this._allIds.length === 0) {
895
+ if (id !== ((_a = this._layer) === null || _a === void 0 ? void 0 : _a.id) || this._featuresEmpty()) {
854
896
  this._fetchingData = true;
855
897
  const layer = await getLayerOrTable(this.mapView, id);
856
898
  await layer.when(() => {
@@ -907,6 +949,9 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
907
949
  }
908
950
  get el() { return this; }
909
951
  static get watchers() { return {
952
+ "enableZoom": ["enableZoomWatchHandler"],
953
+ "enableCSV": ["enableCSVWatchHandler"],
954
+ "enableInlineEdit": ["enableInlineEditWatchHandler"],
910
955
  "_controlsThatFit": ["_controlsThatFitWatchHandler"],
911
956
  "mapView": ["mapViewWatchHandler"],
912
957
  "_layer": ["_layerWatchHandler"],
@@ -934,6 +979,9 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
934
979
  "_sortActive": [32],
935
980
  "_translations": [32]
936
981
  }, [[8, "selectionChanged", "selectionChanged"], [8, "editsComplete", "editsComplete"], [8, "noLayersFound", "noLayersFound"]], {
982
+ "enableZoom": ["enableZoomWatchHandler"],
983
+ "enableCSV": ["enableCSVWatchHandler"],
984
+ "enableInlineEdit": ["enableInlineEditWatchHandler"],
937
985
  "_controlsThatFit": ["_controlsThatFitWatchHandler"],
938
986
  "mapView": ["mapViewWatchHandler"],
939
987
  "_layer": ["_layerWatchHandler"],
@@ -55,6 +55,17 @@ const MapCard = /*@__PURE__*/ proxyCustomElement(class MapCard extends HTMLEleme
55
55
  this._searchConfiguration = undefined;
56
56
  this._webMapInfo = undefined;
57
57
  }
58
+ //--------------------------------------------------------------------------
59
+ //
60
+ // Watch handlers
61
+ //
62
+ //--------------------------------------------------------------------------
63
+ /**
64
+ * Add/remove home widget
65
+ */
66
+ enableHomeWatchHandler() {
67
+ this._initHome();
68
+ }
58
69
  /**
59
70
  * Listen for changes to map info and load the appropriate map
60
71
  */
@@ -129,12 +140,7 @@ const MapCard = /*@__PURE__*/ proxyCustomElement(class MapCard extends HTMLEleme
129
140
  this._searchConfiguration = this._webMapInfo.searchConfiguration;
130
141
  this.beforeMapChanged.emit();
131
142
  await this.mapView.when(() => {
132
- if (this.enableHome) {
133
- const home = new this.Home({
134
- view: this.mapView
135
- });
136
- this.mapView.ui.add(home, { position: "top-left", index: 3 });
137
- }
143
+ this._initHome();
138
144
  this.mapView.ui.add(this._mapTools, { position: "top-right", index: 0 });
139
145
  this.mapChanged.emit({
140
146
  id: id,
@@ -143,7 +149,26 @@ const MapCard = /*@__PURE__*/ proxyCustomElement(class MapCard extends HTMLEleme
143
149
  });
144
150
  }
145
151
  }
152
+ /**
153
+ * Add/remove the home widget base on enableHome prop
154
+ *
155
+ * @protected
156
+ */
157
+ _initHome() {
158
+ if (this.enableHome) {
159
+ this._homeWidget = new this.Home({
160
+ view: this.mapView
161
+ });
162
+ this.mapView.ui.add(this._homeWidget, { position: "top-left", index: 3 });
163
+ }
164
+ else if (this._homeWidget) {
165
+ this.mapView.ui.remove(this._homeWidget);
166
+ }
167
+ }
146
168
  get el() { return this; }
169
+ static get watchers() { return {
170
+ "enableHome": ["enableHomeWatchHandler"]
171
+ }; }
147
172
  static get style() { return mapCardCss; }
148
173
  }, [0, "map-card", {
149
174
  "enableHome": [4, "enable-home"],
@@ -158,7 +183,9 @@ const MapCard = /*@__PURE__*/ proxyCustomElement(class MapCard extends HTMLEleme
158
183
  "mapView": [16],
159
184
  "_searchConfiguration": [32],
160
185
  "_webMapInfo": [32]
161
- }, [[8, "mapInfoChange", "mapInfoChange"]]]);
186
+ }, [[8, "mapInfoChange", "mapInfoChange"]], {
187
+ "enableHome": ["enableHomeWatchHandler"]
188
+ }]);
162
189
  function defineCustomElement() {
163
190
  if (typeof customElements === "undefined") {
164
191
  return;
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
7
7
  import { g as getLocaleComponentStrings } from './locale.js';
8
- import { b as getMapLayerHash, c as getMapTableHash } from './mapViewUtils.js';
8
+ import { c as getMapLayerHash, d as getMapTableHash } from './mapViewUtils.js';
9
9
  import { s as state } from './publicNotificationStore.js';
10
10
  import { d as defineCustomElement$e } from './action.js';
11
11
  import { d as defineCustomElement$d } from './button.js';
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
7
7
  import { l as loadModules } from './loadModules.js';
8
- import { a as goToSelection, h as highlightFeatures, d as getFeatureLayerView } from './mapViewUtils.js';
8
+ import { b as goToSelection, h as highlightFeatures, e as getFeatureLayerView } from './mapViewUtils.js';
9
9
  import { c as queryObjectIds, g as getQueryGeoms, d as queryFeaturesByGeometry } from './queryUtils.js';
10
10
  import { E as EWorkflowType } from './interfaces.js';
11
11
  import { s as state } from './publicNotificationStore.js';
@@ -131,6 +131,23 @@ async function getLayerOrTable(mapView, id) {
131
131
  });
132
132
  return layers.length > 0 ? layers[0] : undefined;
133
133
  }
134
+ /**
135
+ * Gets all of the layers from the current map when the map and their layerView is ready
136
+ *
137
+ * @param mapView the map view to fetch the layer names from
138
+ *
139
+ * @returns Promise resolving with an array of all layers
140
+ *
141
+ */
142
+ async function getAllLayers(mapView) {
143
+ const layers = mapView.map.allLayers.toArray();
144
+ let layerViewPromises;
145
+ await mapView.when(() => {
146
+ layerViewPromises = layers.map(l => mapView.whenLayerView(l));
147
+ });
148
+ await Promise.allSettled(layerViewPromises);
149
+ return layers;
150
+ }
134
151
  /**
135
152
  * Highlight features by OID
136
153
  *
@@ -239,4 +256,4 @@ async function goToSelection(ids, layerView, mapView, flashFeatures = true, feat
239
256
  }
240
257
  }
241
258
 
242
- export { goToSelection as a, getMapLayerHash as b, getMapTableHash as c, getFeatureLayerView as d, getIdSets as e, highlightAllFeatures as f, getLayerOrTable as g, highlightFeatures as h };
259
+ export { getAllLayers as a, goToSelection as b, getMapLayerHash as c, getMapTableHash as d, getFeatureLayerView as e, getIdSets as f, getLayerOrTable as g, highlightFeatures as h, highlightAllFeatures as i };
@@ -6,7 +6,7 @@
6
6
  import { proxyCustomElement, HTMLElement, createEvent, getAssetPath, h, Host } from '@stencil/core/internal/client';
7
7
  import { c as EExportType, d as EPageType, E as EWorkflowType } from './interfaces.js';
8
8
  import { l as loadModules } from './loadModules.js';
9
- import { a as goToSelection, h as highlightFeatures } from './mapViewUtils.js';
9
+ import { b as goToSelection, h as highlightFeatures } from './mapViewUtils.js';
10
10
  import { s as state } from './publicNotificationStore.js';
11
11
  import { g as getLocaleComponentStrings } from './locale.js';
12
12
  import { c as consolidateLabels, r as removeDuplicateLabels } from './downloadUtils.js';