@esri/solutions-components 0.6.33 → 0.6.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) 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 +91 -15
  4. package/dist/cjs/crowdsource-manager.cjs.entry.js +30 -3
  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 +34 -4
  13. package/dist/collection/components/edit-card/edit-card.js +19 -6
  14. package/dist/collection/components/layer-table/layer-table.js +80 -9
  15. package/dist/collection/components/map-card/map-card.js +52 -4
  16. package/dist/collection/demos/crowdsource-manager.html +5 -4
  17. package/dist/collection/utils/mapViewUtils.js +17 -0
  18. package/dist/collection/utils/mapViewUtils.ts +20 -0
  19. package/dist/components/crowdsource-manager.js +33 -4
  20. package/dist/components/edit-card2.js +19 -6
  21. package/dist/components/layer-table2.js +62 -10
  22. package/dist/components/map-card2.js +36 -5
  23. package/dist/components/map-layer-picker2.js +1 -1
  24. package/dist/components/map-select-tools2.js +1 -1
  25. package/dist/components/mapViewUtils.js +18 -1
  26. package/dist/components/public-notification.js +1 -1
  27. package/dist/components/refine-selection2.js +1 -1
  28. package/dist/esm/calcite-alert_3.entry.js +20 -6
  29. package/dist/esm/calcite-combobox_6.entry.js +1 -1
  30. package/dist/esm/card-manager_3.entry.js +91 -15
  31. package/dist/esm/crowdsource-manager.entry.js +30 -3
  32. package/dist/esm/{downloadUtils-ddd7eeb7.js → downloadUtils-76379e4a.js} +2 -2
  33. package/dist/esm/{index.es-a53707d1.js → index.es-0d134a52.js} +2 -2
  34. package/dist/esm/loader.js +1 -1
  35. package/dist/esm/map-select-tools_3.entry.js +2 -2
  36. package/dist/esm/{mapViewUtils-43c930f1.js → mapViewUtils-08f6cfce.js} +18 -1
  37. package/dist/esm/public-notification.entry.js +2 -2
  38. package/dist/esm/solutions-components.js +1 -1
  39. package/dist/solutions-components/demos/crowdsource-manager.html +5 -4
  40. package/dist/solutions-components/{p-05ba41f9.js → p-03130804.js} +1 -1
  41. package/dist/solutions-components/{p-e05cf92d.entry.js → p-0f50087e.entry.js} +2 -2
  42. package/dist/solutions-components/{p-f2194390.js → p-15070568.js} +1 -1
  43. package/dist/solutions-components/{p-4792005c.entry.js → p-1682bd0f.entry.js} +1 -1
  44. package/dist/solutions-components/p-63867402.entry.js +6 -0
  45. package/dist/solutions-components/{p-50a3a887.entry.js → p-81a0c88f.entry.js} +1 -1
  46. package/dist/solutions-components/{p-978a26b3.entry.js → p-9800e602.entry.js} +1 -1
  47. package/dist/solutions-components/{p-b745143d.js → p-b02eb8f4.js} +2 -2
  48. package/dist/solutions-components/p-eba875d9.entry.js +6 -0
  49. package/dist/solutions-components/solutions-components.esm.js +1 -1
  50. package/dist/solutions-components/utils/mapViewUtils.ts +20 -0
  51. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +10 -0
  52. package/dist/types/components/edit-card/edit-card.d.ts +5 -1
  53. package/dist/types/components/layer-table/layer-table.d.ts +28 -0
  54. package/dist/types/components/map-card/map-card.d.ts +18 -0
  55. package/dist/types/components.d.ts +16 -0
  56. package/dist/types/utils/mapViewUtils.d.ts +9 -0
  57. package/package.json +1 -1
  58. package/dist/solutions-components/p-65ade5af.entry.js +0 -6
  59. package/dist/solutions-components/p-a5342c42.entry.js +0 -6
@@ -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';
@@ -63,6 +63,7 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
63
63
  this.enableAutoRefresh = undefined;
64
64
  this.enableCSV = undefined;
65
65
  this.enableInlineEdit = undefined;
66
+ this.enableZoom = undefined;
66
67
  this.mapInfo = undefined;
67
68
  this.mapView = undefined;
68
69
  this.onlyShowUpdatableLayers = undefined;
@@ -83,6 +84,32 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
83
84
  // Watch handlers
84
85
  //
85
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
+ }
86
113
  /**
87
114
  * watch for changes to the list of controls that will currently fit in the display
88
115
  */
@@ -286,7 +313,7 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
286
313
  * @returns void
287
314
  */
288
315
  _validateEnabledActions() {
289
- const featuresSelected = this._selectedIndexes.length > 0;
316
+ const featuresSelected = this._featuresSelected();
290
317
  const selectionDependant = [
291
318
  "zoom-to-object",
292
319
  "trash",
@@ -308,14 +335,16 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
308
335
  */
309
336
  _initToolInfos() {
310
337
  var _a;
311
- const featuresSelected = this._selectedIndexes.length > 0;
312
- this._toolInfos = [{
338
+ const featuresSelected = this._featuresSelected();
339
+ const featuresEmpty = this._featuresEmpty();
340
+ this._toolInfos = [this.enableZoom ? {
313
341
  icon: "zoom-to-object",
314
342
  label: this._translations.zoom,
315
343
  func: () => this._zoom(),
316
344
  disabled: !featuresSelected,
317
345
  isOverflow: false
318
- }, ((_a = this.mapInfo) === null || _a === void 0 ? void 0 : _a.filters) ? {
346
+ } : undefined,
347
+ ((_a = this.mapInfo) === null || _a === void 0 ? void 0 : _a.filters) ? {
319
348
  icon: "filter",
320
349
  label: this._translations.filters,
321
350
  func: () => this._filter(),
@@ -345,13 +374,13 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
345
374
  icon: "list-check-all",
346
375
  func: () => this._selectAll(),
347
376
  label: this._translations.selectAll,
348
- disabled: false,
377
+ disabled: featuresEmpty,
349
378
  isOverflow: false
350
379
  }, {
351
380
  icon: "compare",
352
381
  func: () => this._switchSelected(),
353
382
  label: this._translations.switchSelected,
354
- disabled: false,
383
+ disabled: featuresEmpty,
355
384
  isOverflow: false
356
385
  }, {
357
386
  icon: "refresh",
@@ -364,11 +393,27 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
364
393
  icon: "export",
365
394
  func: () => void this._exportToCSV(),
366
395
  label: this._translations.exportCSV,
367
- disabled: false,
396
+ disabled: featuresEmpty,
368
397
  isOverflow: false
369
398
  } : undefined];
370
399
  this._defaultVisibleToolSizeInfos = undefined;
371
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
+ }
372
417
  /**
373
418
  * Add/Remove tools from the action bar and dropdown based on available size
374
419
  *
@@ -597,7 +642,7 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
597
642
  // https://github.com/Esri/solutions-components/issues/365
598
643
  this._selectedIndexes = this._table.highlightIds.toArray().reverse();
599
644
  if (this._showOnlySelected) {
600
- if (this._selectedIndexes.length > 0) {
645
+ if (this._featuresSelected()) {
601
646
  this._table.filterBySelection();
602
647
  }
603
648
  else {
@@ -847,7 +892,7 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
847
892
  async _layerSelectionChanged(evt) {
848
893
  var _a;
849
894
  const id = evt.detail[0];
850
- 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()) {
851
896
  this._fetchingData = true;
852
897
  const layer = await getLayerOrTable(this.mapView, id);
853
898
  await layer.when(() => {
@@ -904,6 +949,9 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
904
949
  }
905
950
  get el() { return this; }
906
951
  static get watchers() { return {
952
+ "enableZoom": ["enableZoomWatchHandler"],
953
+ "enableCSV": ["enableCSVWatchHandler"],
954
+ "enableInlineEdit": ["enableInlineEditWatchHandler"],
907
955
  "_controlsThatFit": ["_controlsThatFitWatchHandler"],
908
956
  "mapView": ["mapViewWatchHandler"],
909
957
  "_layer": ["_layerWatchHandler"],
@@ -915,6 +963,7 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
915
963
  "enableAutoRefresh": [4, "enable-auto-refresh"],
916
964
  "enableCSV": [4, "enable-c-s-v"],
917
965
  "enableInlineEdit": [4, "enable-inline-edit"],
966
+ "enableZoom": [4, "enable-zoom"],
918
967
  "mapInfo": [16],
919
968
  "mapView": [16],
920
969
  "onlyShowUpdatableLayers": [4, "only-show-updatable-layers"],
@@ -930,6 +979,9 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
930
979
  "_sortActive": [32],
931
980
  "_translations": [32]
932
981
  }, [[8, "selectionChanged", "selectionChanged"], [8, "editsComplete", "editsComplete"], [8, "noLayersFound", "noLayersFound"]], {
982
+ "enableZoom": ["enableZoomWatchHandler"],
983
+ "enableCSV": ["enableCSVWatchHandler"],
984
+ "enableInlineEdit": ["enableInlineEditWatchHandler"],
933
985
  "_controlsThatFit": ["_controlsThatFitWatchHandler"],
934
986
  "mapView": ["mapViewWatchHandler"],
935
987
  "_layer": ["_layerWatchHandler"],
@@ -42,6 +42,7 @@ const MapCard = /*@__PURE__*/ proxyCustomElement(class MapCard extends HTMLEleme
42
42
  * string: the id of map currently displayed
43
43
  */
44
44
  this._loadedId = "";
45
+ this.enableHome = undefined;
45
46
  this.enableLegend = undefined;
46
47
  this.enableFloorFilter = undefined;
47
48
  this.enableFullscreen = undefined;
@@ -54,6 +55,17 @@ const MapCard = /*@__PURE__*/ proxyCustomElement(class MapCard extends HTMLEleme
54
55
  this._searchConfiguration = undefined;
55
56
  this._webMapInfo = undefined;
56
57
  }
58
+ //--------------------------------------------------------------------------
59
+ //
60
+ // Watch handlers
61
+ //
62
+ //--------------------------------------------------------------------------
63
+ /**
64
+ * Add/remove home widget
65
+ */
66
+ enableHomeWatchHandler() {
67
+ this._initHome();
68
+ }
57
69
  /**
58
70
  * Listen for changes to map info and load the appropriate map
59
71
  */
@@ -128,10 +140,7 @@ const MapCard = /*@__PURE__*/ proxyCustomElement(class MapCard extends HTMLEleme
128
140
  this._searchConfiguration = this._webMapInfo.searchConfiguration;
129
141
  this.beforeMapChanged.emit();
130
142
  await this.mapView.when(() => {
131
- const home = new this.Home({
132
- view: this.mapView
133
- });
134
- this.mapView.ui.add(home, { position: "top-left", index: 3 });
143
+ this._initHome();
135
144
  this.mapView.ui.add(this._mapTools, { position: "top-right", index: 0 });
136
145
  this.mapChanged.emit({
137
146
  id: id,
@@ -140,9 +149,29 @@ const MapCard = /*@__PURE__*/ proxyCustomElement(class MapCard extends HTMLEleme
140
149
  });
141
150
  }
142
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
+ }
143
168
  get el() { return this; }
169
+ static get watchers() { return {
170
+ "enableHome": ["enableHomeWatchHandler"]
171
+ }; }
144
172
  static get style() { return mapCardCss; }
145
173
  }, [0, "map-card", {
174
+ "enableHome": [4, "enable-home"],
146
175
  "enableLegend": [4, "enable-legend"],
147
176
  "enableFloorFilter": [4, "enable-floor-filter"],
148
177
  "enableFullscreen": [4, "enable-fullscreen"],
@@ -154,7 +183,9 @@ const MapCard = /*@__PURE__*/ proxyCustomElement(class MapCard extends HTMLEleme
154
183
  "mapView": [16],
155
184
  "_searchConfiguration": [32],
156
185
  "_webMapInfo": [32]
157
- }, [[8, "mapInfoChange", "mapInfoChange"]]]);
186
+ }, [[8, "mapInfoChange", "mapInfoChange"]], {
187
+ "enableHome": ["enableHomeWatchHandler"]
188
+ }]);
158
189
  function defineCustomElement() {
159
190
  if (typeof customElements === "undefined") {
160
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';
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
7
7
  import { e as ESelectionMode, b as EDrawMode, E as EWorkflowType } from './interfaces.js';
8
- import { d as getFeatureLayerView, e as getIdSets, f as highlightAllFeatures } from './mapViewUtils.js';
8
+ import { e as getFeatureLayerView, f as getIdSets, i as highlightAllFeatures } from './mapViewUtils.js';
9
9
  import { d as queryFeaturesByGeometry } from './queryUtils.js';
10
10
  import { s as state } from './publicNotificationStore.js';
11
11
  import { g as getLocaleComponentStrings } from './locale.js';
@@ -14,10 +14,12 @@ import { g as getBreakpoints } from './responsive-4d7ef153.js';
14
14
  import { c as createObserver } from './observers-115d1b4b.js';
15
15
  import { l as loadModules } from './loadModules-687a30c5.js';
16
16
  import { g as getLocaleComponentStrings } from './locale-6be4e8f0.js';
17
+ import { k as getAllLayers } from './mapViewUtils-08f6cfce.js';
17
18
  import './guid-99d025c6.js';
18
19
  import './resources-bb8600a6.js';
19
20
  import './key-5ab69c42.js';
20
21
  import './_commonjsHelpers-d5f9d613.js';
22
+ import './interfaces-7470d906.js';
21
23
 
22
24
  /*!
23
25
  * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
@@ -354,7 +356,7 @@ const EditCard = class {
354
356
  var _a;
355
357
  if (v && ((_a = this.graphics) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.graphicIndex > -1) {
356
358
  this._editorLoading = true;
357
- this._initEditorWidget();
359
+ await this._initEditorWidget();
358
360
  if (this.graphicIndex > -1 && this.graphics.length > 0 && this.open && !this._shouldClose) {
359
361
  await this._startUpdate();
360
362
  }
@@ -436,19 +438,24 @@ const EditCard = class {
436
438
  *
437
439
  * @returns void
438
440
  */
439
- _initEditorWidget() {
441
+ async _initEditorWidget() {
440
442
  if (this.mapView && this.graphics && this.graphics.length > 0 && this.graphics[0]) {
441
443
  if (this._editor) {
442
444
  this._editor.destroy();
443
445
  }
444
446
  const container = document.createElement("div");
447
+ const layers = await getAllLayers(this.mapView);
448
+ const layerInfos = layers.map(layer => {
449
+ return {
450
+ layer,
451
+ geometryUpdatesEnabled: false,
452
+ addEnabled: false
453
+ };
454
+ });
445
455
  this._editor = new this.Editor({
446
456
  allowedWorkflows: "update",
447
457
  view: this.mapView,
448
- layerInfos: [{
449
- layer: this._layer,
450
- geometryUpdatesEnabled: false
451
- }],
458
+ layerInfos,
452
459
  visibleElements: {
453
460
  snappingControls: false,
454
461
  sketchTooltipControls: false
@@ -459,6 +466,7 @@ const EditCard = class {
459
466
  this._editHandle.remove();
460
467
  this._attachmentHandle.remove();
461
468
  this._activeWorkflowHandle.remove();
469
+ this._addRelatedRecordHandle.remove();
462
470
  }
463
471
  this._attachmentHandle = this.reactiveUtils.when(() => this._editor.viewModel.state === "adding-attachment" ||
464
472
  this._editor.viewModel.state === "editing-attachment" ||
@@ -478,6 +486,12 @@ const EditCard = class {
478
486
  this._shouldClose = false;
479
487
  }
480
488
  });
489
+ // Temp workaround until a new prop is added at 4.29
490
+ this._addRelatedRecordHandle = this.reactiveUtils.when(() => !!this._editor.viewModel.featureFormViewModel.relatedRecordCallbacks, () => {
491
+ this._editor.viewModel.featureFormViewModel.relatedRecordCallbacks.addRelatedRecord = null;
492
+ }, {
493
+ once: true
494
+ });
481
495
  // had issues with destroy before adding like this
482
496
  this._editContainer.appendChild(container);
483
497
  }
@@ -21,7 +21,7 @@ import { d as debounce } from './debounce-229b1a22.js';
21
21
  import { c as connectConditionalSlotComponent, d as disconnectConditionalSlotComponent } from './conditionalSlot-94095778.js';
22
22
  import { i as isActivationKey } from './key-5ab69c42.js';
23
23
  import { g as getLocaleComponentStrings } from './locale-6be4e8f0.js';
24
- import { k as getMapLayerHash, l as getMapTableHash } from './mapViewUtils-43c930f1.js';
24
+ import { l as getMapLayerHash, m as getMapTableHash } from './mapViewUtils-08f6cfce.js';
25
25
  import { s as state } from './publicNotificationStore-f25d1e95.js';
26
26
  import './resources-bb8600a6.js';
27
27
  import './browser-b8a2c2d7.js';
@@ -5,9 +5,9 @@
5
5
  */
6
6
  import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-0740c914.js';
7
7
  import { g as getLocaleComponentStrings } from './locale-6be4e8f0.js';
8
- import { q as queryFeaturesByID, a as getLayerOrTable, g as goToSelection, b as queryAllIds } from './mapViewUtils-43c930f1.js';
8
+ import { q as queryFeaturesByID, a as getLayerOrTable, g as goToSelection, b as queryAllIds } from './mapViewUtils-08f6cfce.js';
9
9
  import { l as loadModules } from './loadModules-687a30c5.js';
10
- import { d as downloadCSV } from './downloadUtils-ddd7eeb7.js';
10
+ import { d as downloadCSV } from './downloadUtils-76379e4a.js';
11
11
  import './_commonjsHelpers-d5f9d613.js';
12
12
  import './interfaces-7470d906.js';
13
13
  import './clean-url-bce022e6.js';
@@ -128,6 +128,7 @@ const LayerTable = class {
128
128
  this.enableAutoRefresh = undefined;
129
129
  this.enableCSV = undefined;
130
130
  this.enableInlineEdit = undefined;
131
+ this.enableZoom = undefined;
131
132
  this.mapInfo = undefined;
132
133
  this.mapView = undefined;
133
134
  this.onlyShowUpdatableLayers = undefined;
@@ -148,6 +149,32 @@ const LayerTable = class {
148
149
  // Watch handlers
149
150
  //
150
151
  //--------------------------------------------------------------------------
152
+ /**
153
+ * Reset the toolInfos when zoom tool is enabled/disabled
154
+ */
155
+ enableZoomWatchHandler() {
156
+ var _a;
157
+ if (((_a = this._toolInfos) === null || _a === void 0 ? void 0 : _a.length) > 0) {
158
+ this._initToolInfos();
159
+ }
160
+ }
161
+ /**
162
+ * Reset the toolInfos when export csv is enabled/disabled
163
+ */
164
+ enableCSVWatchHandler() {
165
+ var _a;
166
+ if (((_a = this._toolInfos) === null || _a === void 0 ? void 0 : _a.length) > 0) {
167
+ this._initToolInfos();
168
+ }
169
+ }
170
+ /**
171
+ * Update the table when enableInlineEdit is enabled/disabled
172
+ */
173
+ enableInlineEditWatchHandler() {
174
+ if (this._table) {
175
+ this._table.editingEnabled = this._editEnabled && this.enableInlineEdit;
176
+ }
177
+ }
151
178
  /**
152
179
  * watch for changes to the list of controls that will currently fit in the display
153
180
  */
@@ -351,7 +378,7 @@ const LayerTable = class {
351
378
  * @returns void
352
379
  */
353
380
  _validateEnabledActions() {
354
- const featuresSelected = this._selectedIndexes.length > 0;
381
+ const featuresSelected = this._featuresSelected();
355
382
  const selectionDependant = [
356
383
  "zoom-to-object",
357
384
  "trash",
@@ -373,14 +400,16 @@ const LayerTable = class {
373
400
  */
374
401
  _initToolInfos() {
375
402
  var _a;
376
- const featuresSelected = this._selectedIndexes.length > 0;
377
- this._toolInfos = [{
403
+ const featuresSelected = this._featuresSelected();
404
+ const featuresEmpty = this._featuresEmpty();
405
+ this._toolInfos = [this.enableZoom ? {
378
406
  icon: "zoom-to-object",
379
407
  label: this._translations.zoom,
380
408
  func: () => this._zoom(),
381
409
  disabled: !featuresSelected,
382
410
  isOverflow: false
383
- }, ((_a = this.mapInfo) === null || _a === void 0 ? void 0 : _a.filters) ? {
411
+ } : undefined,
412
+ ((_a = this.mapInfo) === null || _a === void 0 ? void 0 : _a.filters) ? {
384
413
  icon: "filter",
385
414
  label: this._translations.filters,
386
415
  func: () => this._filter(),
@@ -410,13 +439,13 @@ const LayerTable = class {
410
439
  icon: "list-check-all",
411
440
  func: () => this._selectAll(),
412
441
  label: this._translations.selectAll,
413
- disabled: false,
442
+ disabled: featuresEmpty,
414
443
  isOverflow: false
415
444
  }, {
416
445
  icon: "compare",
417
446
  func: () => this._switchSelected(),
418
447
  label: this._translations.switchSelected,
419
- disabled: false,
448
+ disabled: featuresEmpty,
420
449
  isOverflow: false
421
450
  }, {
422
451
  icon: "refresh",
@@ -429,11 +458,27 @@ const LayerTable = class {
429
458
  icon: "export",
430
459
  func: () => void this._exportToCSV(),
431
460
  label: this._translations.exportCSV,
432
- disabled: false,
461
+ disabled: featuresEmpty,
433
462
  isOverflow: false
434
463
  } : undefined];
435
464
  this._defaultVisibleToolSizeInfos = undefined;
436
465
  }
466
+ /**
467
+ * Returns true when one ore more features are selected
468
+ *
469
+ * @returns boolean
470
+ */
471
+ _featuresSelected() {
472
+ return this._selectedIndexes.length > 0;
473
+ }
474
+ /**
475
+ * Return true when we have no features
476
+ *
477
+ * @returns boolean
478
+ */
479
+ _featuresEmpty() {
480
+ return this._allIds.length === 0;
481
+ }
437
482
  /**
438
483
  * Add/Remove tools from the action bar and dropdown based on available size
439
484
  *
@@ -662,7 +707,7 @@ const LayerTable = class {
662
707
  // https://github.com/Esri/solutions-components/issues/365
663
708
  this._selectedIndexes = this._table.highlightIds.toArray().reverse();
664
709
  if (this._showOnlySelected) {
665
- if (this._selectedIndexes.length > 0) {
710
+ if (this._featuresSelected()) {
666
711
  this._table.filterBySelection();
667
712
  }
668
713
  else {
@@ -912,7 +957,7 @@ const LayerTable = class {
912
957
  async _layerSelectionChanged(evt) {
913
958
  var _a;
914
959
  const id = evt.detail[0];
915
- if (id !== ((_a = this._layer) === null || _a === void 0 ? void 0 : _a.id) || this._allIds.length === 0) {
960
+ if (id !== ((_a = this._layer) === null || _a === void 0 ? void 0 : _a.id) || this._featuresEmpty()) {
916
961
  this._fetchingData = true;
917
962
  const layer = await getLayerOrTable(this.mapView, id);
918
963
  await layer.when(() => {
@@ -969,6 +1014,9 @@ const LayerTable = class {
969
1014
  }
970
1015
  get el() { return getElement(this); }
971
1016
  static get watchers() { return {
1017
+ "enableZoom": ["enableZoomWatchHandler"],
1018
+ "enableCSV": ["enableCSVWatchHandler"],
1019
+ "enableInlineEdit": ["enableInlineEditWatchHandler"],
972
1020
  "_controlsThatFit": ["_controlsThatFitWatchHandler"],
973
1021
  "mapView": ["mapViewWatchHandler"],
974
1022
  "_layer": ["_layerWatchHandler"],
@@ -989,6 +1037,7 @@ const MapCard = class {
989
1037
  * string: the id of map currently displayed
990
1038
  */
991
1039
  this._loadedId = "";
1040
+ this.enableHome = undefined;
992
1041
  this.enableLegend = undefined;
993
1042
  this.enableFloorFilter = undefined;
994
1043
  this.enableFullscreen = undefined;
@@ -1001,6 +1050,17 @@ const MapCard = class {
1001
1050
  this._searchConfiguration = undefined;
1002
1051
  this._webMapInfo = undefined;
1003
1052
  }
1053
+ //--------------------------------------------------------------------------
1054
+ //
1055
+ // Watch handlers
1056
+ //
1057
+ //--------------------------------------------------------------------------
1058
+ /**
1059
+ * Add/remove home widget
1060
+ */
1061
+ enableHomeWatchHandler() {
1062
+ this._initHome();
1063
+ }
1004
1064
  /**
1005
1065
  * Listen for changes to map info and load the appropriate map
1006
1066
  */
@@ -1075,10 +1135,7 @@ const MapCard = class {
1075
1135
  this._searchConfiguration = this._webMapInfo.searchConfiguration;
1076
1136
  this.beforeMapChanged.emit();
1077
1137
  await this.mapView.when(() => {
1078
- const home = new this.Home({
1079
- view: this.mapView
1080
- });
1081
- this.mapView.ui.add(home, { position: "top-left", index: 3 });
1138
+ this._initHome();
1082
1139
  this.mapView.ui.add(this._mapTools, { position: "top-right", index: 0 });
1083
1140
  this.mapChanged.emit({
1084
1141
  id: id,
@@ -1087,7 +1144,26 @@ const MapCard = class {
1087
1144
  });
1088
1145
  }
1089
1146
  }
1147
+ /**
1148
+ * Add/remove the home widget base on enableHome prop
1149
+ *
1150
+ * @protected
1151
+ */
1152
+ _initHome() {
1153
+ if (this.enableHome) {
1154
+ this._homeWidget = new this.Home({
1155
+ view: this.mapView
1156
+ });
1157
+ this.mapView.ui.add(this._homeWidget, { position: "top-left", index: 3 });
1158
+ }
1159
+ else if (this._homeWidget) {
1160
+ this.mapView.ui.remove(this._homeWidget);
1161
+ }
1162
+ }
1090
1163
  get el() { return getElement(this); }
1164
+ static get watchers() { return {
1165
+ "enableHome": ["enableHomeWatchHandler"]
1166
+ }; }
1091
1167
  };
1092
1168
  MapCard.style = mapCardCss;
1093
1169