@esri/solutions-components 0.7.21 → 0.7.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -472,93 +472,95 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
472
472
  const featuresSelected = this._featuresSelected();
473
473
  const featuresEmpty = this._featuresEmpty();
474
474
  const hasFilterExpressions = this._hasFilterExpressions();
475
- this._toolInfos = [{
476
- active: false,
477
- icon: "zoom-to-object",
478
- indicator: false,
479
- label: this._translations.zoom,
480
- func: () => this._zoom(),
481
- disabled: !featuresSelected,
482
- isOverflow: false
483
- },
484
- hasFilterExpressions ? {
485
- active: false,
486
- icon: "filter",
487
- indicator: false,
488
- label: this._translations.filters,
489
- func: () => this._toggleFilter(),
490
- disabled: false,
491
- isOverflow: false
492
- } : undefined,
493
- this._deleteEnabled ? {
494
- active: false,
495
- icon: "trash",
496
- indicator: false,
497
- label: this._translations.delete,
498
- func: () => this._delete(),
499
- disabled: !featuresSelected,
500
- isDanger: true,
501
- isOverflow: false
502
- } : undefined, {
503
- active: false,
504
- icon: "erase",
505
- indicator: false,
506
- label: this._translations.clearSelection,
507
- func: () => this._clearSelection(),
508
- disabled: !featuresSelected,
509
- isOverflow: false
510
- }, {
511
- active: false,
512
- icon: "selected-items-filter",
513
- indicator: false,
514
- label: this._showOnlySelected ? this._translations.showAll : this._translations.showSelected,
515
- func: () => this._toggleShowSelected(),
516
- disabled: !featuresSelected,
517
- isOverflow: false
518
- }, {
519
- active: false,
520
- icon: "list-check-all",
521
- indicator: false,
522
- func: () => this._selectAll(),
523
- label: this._translations.selectAll,
524
- disabled: featuresEmpty,
525
- isOverflow: false
526
- }, {
527
- active: false,
528
- icon: "compare",
529
- indicator: false,
530
- func: () => this._switchSelected(),
531
- label: this._translations.switchSelected,
532
- disabled: featuresEmpty,
533
- isOverflow: false
534
- }, {
535
- active: false,
536
- icon: "refresh",
537
- indicator: false,
538
- func: () => this._refresh(),
539
- label: this._translations.refresh,
540
- disabled: false,
541
- isOverflow: false
542
- },
543
- this.enableCSV ? {
544
- active: false,
545
- icon: "export",
546
- indicator: false,
547
- func: () => void this._exportToCSV(),
548
- label: this._translations.exportCSV,
549
- disabled: featuresEmpty,
550
- isOverflow: false
551
- } : undefined, {
552
- active: false,
553
- icon: this._showHideOpen ? "chevron-down" : "chevron-right",
554
- indicator: false,
555
- func: () => this._toggleShowHide(),
556
- label: this._translations.showHideColumns,
557
- disabled: false,
558
- isOverflow: false,
559
- isSublist: true
560
- }];
561
- this._defaultVisibleToolSizeInfos = undefined;
475
+ if (this._translations) {
476
+ this._toolInfos = [{
477
+ active: false,
478
+ icon: "zoom-to-object",
479
+ indicator: false,
480
+ label: this._translations.zoom,
481
+ func: () => this._zoom(),
482
+ disabled: !featuresSelected,
483
+ isOverflow: false
484
+ },
485
+ hasFilterExpressions ? {
486
+ active: false,
487
+ icon: "filter",
488
+ indicator: false,
489
+ label: this._translations.filters,
490
+ func: () => this._toggleFilter(),
491
+ disabled: false,
492
+ isOverflow: false
493
+ } : undefined,
494
+ this._deleteEnabled ? {
495
+ active: false,
496
+ icon: "trash",
497
+ indicator: false,
498
+ label: this._translations.delete,
499
+ func: () => this._delete(),
500
+ disabled: !featuresSelected,
501
+ isDanger: true,
502
+ isOverflow: false
503
+ } : undefined, {
504
+ active: false,
505
+ icon: "erase",
506
+ indicator: false,
507
+ label: this._translations.clearSelection,
508
+ func: () => this._clearSelection(),
509
+ disabled: !featuresSelected,
510
+ isOverflow: false
511
+ }, {
512
+ active: false,
513
+ icon: "selected-items-filter",
514
+ indicator: false,
515
+ label: this._showOnlySelected ? this._translations.showAll : this._translations.showSelected,
516
+ func: () => this._toggleShowSelected(),
517
+ disabled: !featuresSelected,
518
+ isOverflow: false
519
+ }, {
520
+ active: false,
521
+ icon: "list-check-all",
522
+ indicator: false,
523
+ func: () => this._selectAll(),
524
+ label: this._translations.selectAll,
525
+ disabled: featuresEmpty,
526
+ isOverflow: false
527
+ }, {
528
+ active: false,
529
+ icon: "compare",
530
+ indicator: false,
531
+ func: () => this._switchSelected(),
532
+ label: this._translations.switchSelected,
533
+ disabled: featuresEmpty,
534
+ isOverflow: false
535
+ }, {
536
+ active: false,
537
+ icon: "refresh",
538
+ indicator: false,
539
+ func: () => this._refresh(),
540
+ label: this._translations.refresh,
541
+ disabled: false,
542
+ isOverflow: false
543
+ },
544
+ this.enableCSV ? {
545
+ active: false,
546
+ icon: "export",
547
+ indicator: false,
548
+ func: () => void this._exportToCSV(),
549
+ label: this._translations.exportCSV,
550
+ disabled: featuresEmpty,
551
+ isOverflow: false
552
+ } : undefined, {
553
+ active: false,
554
+ icon: this._showHideOpen ? "chevron-down" : "chevron-right",
555
+ indicator: false,
556
+ func: () => this._toggleShowHide(),
557
+ label: this._translations.showHideColumns,
558
+ disabled: false,
559
+ isOverflow: false,
560
+ isSublist: true
561
+ }];
562
+ this._defaultVisibleToolSizeInfos = undefined;
563
+ }
562
564
  }
563
565
  /**
564
566
  * Returns true when one ore more features are selected
@@ -769,12 +771,21 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
769
771
  if ((_b = this.mapInfo) === null || _b === void 0 ? void 0 : _b.id) {
770
772
  urlObj.searchParams.set("webmap", this.mapInfo.id);
771
773
  }
774
+ else {
775
+ urlObj.searchParams.delete("webmap");
776
+ }
772
777
  if ((_c = this._layer) === null || _c === void 0 ? void 0 : _c.id) {
773
778
  urlObj.searchParams.set("layer", this._layer.id);
774
779
  }
780
+ else {
781
+ urlObj.searchParams.delete("layer");
782
+ }
775
783
  if (((_d = this._selectedIndexes) === null || _d === void 0 ? void 0 : _d.length) > 0) {
776
784
  urlObj.searchParams.set("oid", this._selectedIndexes.join(","));
777
785
  }
786
+ else {
787
+ urlObj.searchParams.delete("oid");
788
+ }
778
789
  if (this._filterActive) {
779
790
  const filter = JSON.parse(this._filterList.urlParams.get("filter"));
780
791
  const layerExpressions = this._filterList.layerExpressions.map(layerExp => {
@@ -788,7 +799,11 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
788
799
  });
789
800
  urlObj.searchParams.set("filter", JSON.stringify(layerExpressions));
790
801
  }
802
+ else {
803
+ urlObj.searchParams.delete("filter");
804
+ }
791
805
  this._shareNode.shareUrl = urlObj.href;
806
+ history.pushState(history.state, document.title, urlObj.href);
792
807
  }
793
808
  /**
794
809
  * Get a tooltip
@@ -1108,7 +1123,7 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
1108
1123
  */
1109
1124
  _filterModal() {
1110
1125
  var _a, _b, _c;
1111
- return (h("calcite-modal", { "aria-labelledby": "modal-title", class: "modal", kind: "brand", onCalciteModalClose: async () => this._closeFilter(), open: this._filterOpen, widthScale: "s" }, h("div", { class: "display-flex align-center", id: "modal-title", slot: "header" }, (_b = (_a = this._translations) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.replace("{{title}}", (_c = this._layer) === null || _c === void 0 ? void 0 : _c.title)), h("div", { slot: "content" }, h("instant-apps-filter-list", { autoUpdateUrl: false, closeBtn: true, closeBtnOnClick: async () => this._closeFilter(), layerExpressions: this._layerExpressions, onFilterListReset: () => this._handleFilterListReset(), onFilterUpdate: () => this._handleFilterUpdate(), ref: (el) => this._filterList = el, view: this.mapView, zoomBtn: false }))));
1126
+ return (h("calcite-modal", { "aria-labelledby": "modal-title", class: "modal", kind: "brand", onCalciteModalClose: async () => this._closeFilter(), open: this._filterOpen, widthScale: "s" }, h("div", { class: "display-flex align-center", id: "modal-title", slot: "header" }, (_b = (_a = this._translations) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.replace("{{title}}", (_c = this._layer) === null || _c === void 0 ? void 0 : _c.title)), h("div", { slot: "content" }, h("instant-apps-filter-list", { autoUpdateUrl: true, closeBtn: true, closeBtnOnClick: async () => this._closeFilter(), layerExpressions: this._layerExpressions, onFilterListReset: () => this._handleFilterListReset(), onFilterUpdate: () => this._handleFilterUpdate(), ref: (el) => this._filterList = el, view: this.mapView, zoomBtn: false }))));
1112
1127
  }
1113
1128
  /**
1114
1129
  * Reset the filter active prop
@@ -526,93 +526,95 @@ const LayerTable = class {
526
526
  const featuresSelected = this._featuresSelected();
527
527
  const featuresEmpty = this._featuresEmpty();
528
528
  const hasFilterExpressions = this._hasFilterExpressions();
529
- this._toolInfos = [{
530
- active: false,
531
- icon: "zoom-to-object",
532
- indicator: false,
533
- label: this._translations.zoom,
534
- func: () => this._zoom(),
535
- disabled: !featuresSelected,
536
- isOverflow: false
537
- },
538
- hasFilterExpressions ? {
539
- active: false,
540
- icon: "filter",
541
- indicator: false,
542
- label: this._translations.filters,
543
- func: () => this._toggleFilter(),
544
- disabled: false,
545
- isOverflow: false
546
- } : undefined,
547
- this._deleteEnabled ? {
548
- active: false,
549
- icon: "trash",
550
- indicator: false,
551
- label: this._translations.delete,
552
- func: () => this._delete(),
553
- disabled: !featuresSelected,
554
- isDanger: true,
555
- isOverflow: false
556
- } : undefined, {
557
- active: false,
558
- icon: "erase",
559
- indicator: false,
560
- label: this._translations.clearSelection,
561
- func: () => this._clearSelection(),
562
- disabled: !featuresSelected,
563
- isOverflow: false
564
- }, {
565
- active: false,
566
- icon: "selected-items-filter",
567
- indicator: false,
568
- label: this._showOnlySelected ? this._translations.showAll : this._translations.showSelected,
569
- func: () => this._toggleShowSelected(),
570
- disabled: !featuresSelected,
571
- isOverflow: false
572
- }, {
573
- active: false,
574
- icon: "list-check-all",
575
- indicator: false,
576
- func: () => this._selectAll(),
577
- label: this._translations.selectAll,
578
- disabled: featuresEmpty,
579
- isOverflow: false
580
- }, {
581
- active: false,
582
- icon: "compare",
583
- indicator: false,
584
- func: () => this._switchSelected(),
585
- label: this._translations.switchSelected,
586
- disabled: featuresEmpty,
587
- isOverflow: false
588
- }, {
589
- active: false,
590
- icon: "refresh",
591
- indicator: false,
592
- func: () => this._refresh(),
593
- label: this._translations.refresh,
594
- disabled: false,
595
- isOverflow: false
596
- },
597
- this.enableCSV ? {
598
- active: false,
599
- icon: "export",
600
- indicator: false,
601
- func: () => void this._exportToCSV(),
602
- label: this._translations.exportCSV,
603
- disabled: featuresEmpty,
604
- isOverflow: false
605
- } : undefined, {
606
- active: false,
607
- icon: this._showHideOpen ? "chevron-down" : "chevron-right",
608
- indicator: false,
609
- func: () => this._toggleShowHide(),
610
- label: this._translations.showHideColumns,
611
- disabled: false,
612
- isOverflow: false,
613
- isSublist: true
614
- }];
615
- this._defaultVisibleToolSizeInfos = undefined;
529
+ if (this._translations) {
530
+ this._toolInfos = [{
531
+ active: false,
532
+ icon: "zoom-to-object",
533
+ indicator: false,
534
+ label: this._translations.zoom,
535
+ func: () => this._zoom(),
536
+ disabled: !featuresSelected,
537
+ isOverflow: false
538
+ },
539
+ hasFilterExpressions ? {
540
+ active: false,
541
+ icon: "filter",
542
+ indicator: false,
543
+ label: this._translations.filters,
544
+ func: () => this._toggleFilter(),
545
+ disabled: false,
546
+ isOverflow: false
547
+ } : undefined,
548
+ this._deleteEnabled ? {
549
+ active: false,
550
+ icon: "trash",
551
+ indicator: false,
552
+ label: this._translations.delete,
553
+ func: () => this._delete(),
554
+ disabled: !featuresSelected,
555
+ isDanger: true,
556
+ isOverflow: false
557
+ } : undefined, {
558
+ active: false,
559
+ icon: "erase",
560
+ indicator: false,
561
+ label: this._translations.clearSelection,
562
+ func: () => this._clearSelection(),
563
+ disabled: !featuresSelected,
564
+ isOverflow: false
565
+ }, {
566
+ active: false,
567
+ icon: "selected-items-filter",
568
+ indicator: false,
569
+ label: this._showOnlySelected ? this._translations.showAll : this._translations.showSelected,
570
+ func: () => this._toggleShowSelected(),
571
+ disabled: !featuresSelected,
572
+ isOverflow: false
573
+ }, {
574
+ active: false,
575
+ icon: "list-check-all",
576
+ indicator: false,
577
+ func: () => this._selectAll(),
578
+ label: this._translations.selectAll,
579
+ disabled: featuresEmpty,
580
+ isOverflow: false
581
+ }, {
582
+ active: false,
583
+ icon: "compare",
584
+ indicator: false,
585
+ func: () => this._switchSelected(),
586
+ label: this._translations.switchSelected,
587
+ disabled: featuresEmpty,
588
+ isOverflow: false
589
+ }, {
590
+ active: false,
591
+ icon: "refresh",
592
+ indicator: false,
593
+ func: () => this._refresh(),
594
+ label: this._translations.refresh,
595
+ disabled: false,
596
+ isOverflow: false
597
+ },
598
+ this.enableCSV ? {
599
+ active: false,
600
+ icon: "export",
601
+ indicator: false,
602
+ func: () => void this._exportToCSV(),
603
+ label: this._translations.exportCSV,
604
+ disabled: featuresEmpty,
605
+ isOverflow: false
606
+ } : undefined, {
607
+ active: false,
608
+ icon: this._showHideOpen ? "chevron-down" : "chevron-right",
609
+ indicator: false,
610
+ func: () => this._toggleShowHide(),
611
+ label: this._translations.showHideColumns,
612
+ disabled: false,
613
+ isOverflow: false,
614
+ isSublist: true
615
+ }];
616
+ this._defaultVisibleToolSizeInfos = undefined;
617
+ }
616
618
  }
617
619
  /**
618
620
  * Returns true when one ore more features are selected
@@ -823,12 +825,21 @@ const LayerTable = class {
823
825
  if ((_b = this.mapInfo) === null || _b === void 0 ? void 0 : _b.id) {
824
826
  urlObj.searchParams.set("webmap", this.mapInfo.id);
825
827
  }
828
+ else {
829
+ urlObj.searchParams.delete("webmap");
830
+ }
826
831
  if ((_c = this._layer) === null || _c === void 0 ? void 0 : _c.id) {
827
832
  urlObj.searchParams.set("layer", this._layer.id);
828
833
  }
834
+ else {
835
+ urlObj.searchParams.delete("layer");
836
+ }
829
837
  if (((_d = this._selectedIndexes) === null || _d === void 0 ? void 0 : _d.length) > 0) {
830
838
  urlObj.searchParams.set("oid", this._selectedIndexes.join(","));
831
839
  }
840
+ else {
841
+ urlObj.searchParams.delete("oid");
842
+ }
832
843
  if (this._filterActive) {
833
844
  const filter = JSON.parse(this._filterList.urlParams.get("filter"));
834
845
  const layerExpressions = this._filterList.layerExpressions.map(layerExp => {
@@ -842,7 +853,11 @@ const LayerTable = class {
842
853
  });
843
854
  urlObj.searchParams.set("filter", JSON.stringify(layerExpressions));
844
855
  }
856
+ else {
857
+ urlObj.searchParams.delete("filter");
858
+ }
845
859
  this._shareNode.shareUrl = urlObj.href;
860
+ history.pushState(history.state, document.title, urlObj.href);
846
861
  }
847
862
  /**
848
863
  * Get a tooltip
@@ -1162,7 +1177,7 @@ const LayerTable = class {
1162
1177
  */
1163
1178
  _filterModal() {
1164
1179
  var _a, _b, _c;
1165
- return (h("calcite-modal", { "aria-labelledby": "modal-title", class: "modal", kind: "brand", onCalciteModalClose: async () => this._closeFilter(), open: this._filterOpen, widthScale: "s" }, h("div", { class: "display-flex align-center", id: "modal-title", slot: "header" }, (_b = (_a = this._translations) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.replace("{{title}}", (_c = this._layer) === null || _c === void 0 ? void 0 : _c.title)), h("div", { slot: "content" }, h("instant-apps-filter-list", { autoUpdateUrl: false, closeBtn: true, closeBtnOnClick: async () => this._closeFilter(), layerExpressions: this._layerExpressions, onFilterListReset: () => this._handleFilterListReset(), onFilterUpdate: () => this._handleFilterUpdate(), ref: (el) => this._filterList = el, view: this.mapView, zoomBtn: false }))));
1180
+ return (h("calcite-modal", { "aria-labelledby": "modal-title", class: "modal", kind: "brand", onCalciteModalClose: async () => this._closeFilter(), open: this._filterOpen, widthScale: "s" }, h("div", { class: "display-flex align-center", id: "modal-title", slot: "header" }, (_b = (_a = this._translations) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.replace("{{title}}", (_c = this._layer) === null || _c === void 0 ? void 0 : _c.title)), h("div", { slot: "content" }, h("instant-apps-filter-list", { autoUpdateUrl: true, closeBtn: true, closeBtnOnClick: async () => this._closeFilter(), layerExpressions: this._layerExpressions, onFilterListReset: () => this._handleFilterListReset(), onFilterUpdate: () => this._handleFilterUpdate(), ref: (el) => this._filterList = el, view: this.mapView, zoomBtn: false }))));
1166
1181
  }
1167
1182
  /**
1168
1183
  * Reset the filter active prop
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright 2022 Esri
3
+ * Licensed under the Apache License, Version 2.0
4
+ * http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ import{r as i,h as t,H as s,g as e,c as h}from"./p-78780f63.js";import{g as o}from"./p-6b943f52.js";import{q as a,a as l,g as n,b as d,c as r,d as c}from"./p-b5d1b979.js";import{l as p}from"./p-48ff9cea.js";import{d as v}from"./p-c9f87acb.js";import"./p-d918ec36.js";import"./p-e1a4994d.js";import"./p-4af32c75.js";import"./p-d89fff3a.js";import"./p-a230b270.js";import"./p-220ec0d1.js";const u=class{constructor(t){i(this,t),this.isMobile=void 0,this.layer=void 0,this.mapView=void 0,this.zoomAndScrollToSelected=void 0,this._cardLoading=!1,this._graphics=void 0,this._translations=void 0}async featureSelectionChange(i){const t=i.detail;this._cardLoading=!0;const s=t.length>0?await a(t,this.layer,[],!1,this.mapView.spatialReference):[];this._graphics=s.sort(((i,s)=>t.indexOf(i.getObjectId())-t.indexOf(s.getObjectId()))),this._cardLoading=!1}async layerSelectionChange(i){const t=i.detail[0];this.layer=await l(this.mapView,t)}async componentWillLoad(){await this._getTranslations()}render(){var i,e;const h=(null===(i=this._graphics)||void 0===i?void 0:i.length)>0?"":"display-none",o=(null===(e=this._graphics)||void 0===e?void 0:e.length)>0?"display-none":"";return t(s,null,t("div",{class:"overflow-auto height-full"},t("calcite-shell",{class:"position-relative "+h},t("div",null,t("info-card",{graphics:this._graphics,isLoading:this._cardLoading,isMobile:this.isMobile,mapView:this.mapView,zoomAndScrollToSelected:this.zoomAndScrollToSelected}))),t("calcite-shell",{class:"position-relative "+o},t("div",{class:"padding-1"},t("calcite-notice",{icon:"table",open:!0},t("div",{slot:"message"},this._translations.selectFeaturesToStart))))))}async _getTranslations(){const i=await o(this.el);this._translations=i[0]}get el(){return e(this)}};u.style=":host{display:block !important}.display-flex{display:flex}.display-none{display:none}.w-100{width:100%}.padding-bottom-1{padding-bottom:1rem}.padding-1{padding:1rem}.position-relative{position:relative}.focus-margin{margin:1px 1px 0px 1px}.overflow-auto{overflow:auto}.height-full{height:100%}card-manager{display:block}";const b=class{constructor(t){i(this,t),this.featureSelectionChange=h(this,"featureSelectionChange",7),this._allIds=[],this._ctrlIsPressed=!1,this._defaultFilterHonored=!1,this._defaultGlobalIdHonored=!1,this._defaultOidHonored=!1,this._observerSet=!1,this._shiftIsPressed=!1,this._skipOnChange=!1,this._tableSorting=!1,this.onTableNodeCreate=i=>{this._tableNode=i},this.defaultFilter=void 0,this.defaultGlobalId=void 0,this.defaultLayerId=void 0,this.defaultOid=void 0,this.enableAutoRefresh=void 0,this.enableColumnReorder=!0,this.enableCSV=void 0,this.enableInlineEdit=void 0,this.enableShare=void 0,this.isMobile=void 0,this.mapInfo=void 0,this.mapView=void 0,this.onlyShowUpdatableLayers=void 0,this.shareIncludeEmbed=void 0,this.shareIncludeSocial=void 0,this.showNewestFirst=void 0,this.zoomAndScrollToSelected=void 0,this._confirmDelete=!1,this._controlsThatFit=void 0,this._fetchingData=!1,this._filterActive=!1,this._filterOpen=!1,this._isDeleting=!1,this._layer=void 0,this._selectAllActive=!1,this._selectedIndexes=[],this._showHideOpen=!1,this._showOnlySelected=!1,this._sortActive=!1,this._translations=void 0}enableCSVWatchHandler(){var i;(null===(i=this._toolInfos)||void 0===i?void 0:i.length)>0&&this._initToolInfos()}enableInlineEditWatchHandler(){this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit)}_controlsThatFitWatchHandler(){var i;const t=this._controlsThatFit?this._controlsThatFit.reduce(((i,t)=>(i.push(t.id),i)),[]):[];this._toolInfos=null===(i=this._toolInfos)||void 0===i?void 0:i.map((i=>{if(i&&this._controlsThatFit){const s=this._getId(i.icon);return i.isOverflow=t.indexOf(s)<0,i}}))}isMobileWatchHandler(){this._toolInfos||this.isMobile||this._initToolInfos()}async mapInfoWatchHandler(){var i;(null===(i=this._toolInfos)||void 0===i?void 0:i.length)>0&&this._initToolInfos()}async mapViewWatchHandler(){this._mapClickHandle&&this._mapClickHandle.remove(),this.mapView&&(this._updateShareUrl(),this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",(i=>{this._mapClicked(i)})))}async _layerWatchHandler(){this._fetchingData=!0,this._definitionExpression=this._layer.definitionExpression,await this._resetTable(),this._updateShareUrl(),this._initLayerExpressions(),this._fetchingData=!1}async _selectedIndexesWatchHandler(){this._updateShareUrl(),this._validateEnabledActions(),this._selectAllActive&&this._selectedIndexes.length!==this._allIds.length&&(this._selectAllActive=!1)}async _sortActiveWatchHandler(){this._sortActive||await this._sortTable()}async deleteFeatures(){return this._delete()}async selectionChanged(i){const t=i.detail[0],s=t.getObjectId();if(this.zoomAndScrollToSelected){const i=this._table.viewModel.getObjectIdIndex(s);this._table.scrollToIndex(i);const e=t.layer;let h;this.mapView.allLayerViews.toArray().some((i=>{if(i.layer.title===e.title&&"feature"===i.layer.type)return h=i,!0})),h&&await n([s],h,this.mapView,!0)}}async editsComplete(){await this._refresh()}noLayersFound(){this._layer=void 0,this._allIds=[],this._clearSelection()}async componentWillLoad(){await this._getTranslations(),await this._initModules(),this._initToolInfos(),this._resizeObserver||(this._resizeObserver=new ResizeObserver((()=>this._onResize())))}render(){const i=this._fetchingData?"display-none":"",e=this._fetchingData?"":"display-none",h=this._allIds.length.toString(),o=this._selectedIndexes.length.toString(),a=this.isMobile?"height-full":"height-full-adjusted";return this._validateActiveActions(),t(s,null,t("calcite-shell",null,this._getTableControlRow("header"),t("div",{class:`width-full ${a}`},t("calcite-panel",{class:"height-full width-full"},t("calcite-loader",{class:e,label:this._translations.fetchingData,scale:"l"}),t("div",{class:i,ref:this.onTableNodeCreate})),this.isMobile?void 0:t("div",{class:"bottom-left text-color height-19"},this._translations.recordsSelected.replace("{{total}}",h).replace("{{selected}}",o)))),this._deleteMessage(),this._filterModal())}async componentDidLoad(){this.isMobile||this._observerSet||(this._resizeObserver.observe(this._toolbar),this._observerSet=!0),document.onclick=i=>this._handleDocumentClick(i),document.onkeydown=i=>this._handleKeyDown(i),document.onkeyup=i=>this._handleKeyUp(i)}componentDidRender(){this._updateToolbar()}async _initModules(){const[i,t]=await p(["esri/widgets/FeatureTable","esri/core/reactiveUtils"]);this.FeatureTable=i,this.reactiveUtils=t}_onResize(){this._updateToolbar()}_getTableControlRow(i){return t("div",{class:"display-flex border-bottom height-51",ref:i=>this._toolbar=i,slot:i},this._getActionBar(),this.isMobile?void 0:this._getDropdown("more-table-options"),this.enableShare&&!this.isMobile?this._getShare("share"):void 0)}_getActionBar(){const i=this.isMobile?"width-full":"",s=this.isMobile?"border-top":"";return t("calcite-action-bar",{class:i,expandDisabled:!0,expanded:!0,id:this._getId("bar"),layout:"horizontal"},t("div",{class:`border-end ${i} ${s}`,id:"solutions-map-layer-picker-container"},t("map-layer-picker",{appearance:"transparent",defaultLayerId:this.defaultLayerId,display:"inline-flex",height:50,isMobile:this.isMobile,mapView:this.mapView,onLayerSelectionChange:i=>this._layerSelectionChanged(i),onlyShowUpdatableLayers:this.onlyShowUpdatableLayers,placeholderIcon:"layers",scale:"l",showSingleLayerAsLabel:!0,showTables:!0,type:"dropdown"})),this.isMobile?void 0:this._getActions())}_getActions(){return this._getActionItems().reduce(((i,s)=>(s&&!s.isOverflow&&i.push(s.isDanger?this._getDangerAction(s.icon,s.label,s.func,s.disabled):s.isSublist?t("calcite-dropdown",{closeOnSelectDisabled:!0,id:this._getId(s.icon),onCalciteDropdownBeforeClose:()=>this._forceShowHide(),ref:i=>this._showHideDropdown=i},this._getAction(s.active,this._showHideOpen?"chevron-down":s.icon,s.indicator,s.label,s.func,s.disabled,"trigger"),this._showHideOpen?this._getFieldlist():void 0):this._getAction(s.active,s.icon,s.indicator,s.label,s.func,s.disabled)),i)),[])}_getFieldlist(){return this._columnsInfo?t("calcite-dropdown-group",{"selection-mode":"multiple"},Object.keys(this._columnsInfo).map((i=>t("calcite-dropdown-item",{id:i,onClick:i=>{const t=i.target;this._columnsInfo[t.id]=t.selected,t.selected?this._table.showColumn(t.id):this._table.hideColumn(t.id)},selected:this._columnsInfo[i]},i)))):void 0}_validateEnabledActions(){var i;const t=this._featuresSelected(),s=["zoom-to-object","trash","erase","selected-items-filter"];null===(i=this._toolInfos)||void 0===i||i.forEach((i=>{i&&s.indexOf(i.icon)>-1&&(i.disabled=!t)}))}_validateActiveActions(){var i;const t=["filter","list-check-all","selected-items-filter"];null===(i=this._toolInfos)||void 0===i||i.forEach((i=>{i&&t.indexOf(i.icon)>-1&&("filter"===i.icon&&(i.indicator=this._filterActive),"list-check-all"===i.icon&&(i.active=this._selectAllActive),"selected-items-filter"===i.icon&&(i.active=this._showOnlySelected))}))}_initToolInfos(){const i=this._featuresSelected(),t=this._featuresEmpty(),s=this._hasFilterExpressions();this._translations&&(this._toolInfos=[{active:!1,icon:"zoom-to-object",indicator:!1,label:this._translations.zoom,func:()=>this._zoom(),disabled:!i,isOverflow:!1},s?{active:!1,icon:"filter",indicator:!1,label:this._translations.filters,func:()=>this._toggleFilter(),disabled:!1,isOverflow:!1}:void 0,this._deleteEnabled?{active:!1,icon:"trash",indicator:!1,label:this._translations.delete,func:()=>this._delete(),disabled:!i,isDanger:!0,isOverflow:!1}:void 0,{active:!1,icon:"erase",indicator:!1,label:this._translations.clearSelection,func:()=>this._clearSelection(),disabled:!i,isOverflow:!1},{active:!1,icon:"selected-items-filter",indicator:!1,label:this._showOnlySelected?this._translations.showAll:this._translations.showSelected,func:()=>this._toggleShowSelected(),disabled:!i,isOverflow:!1},{active:!1,icon:"list-check-all",indicator:!1,func:()=>this._selectAll(),label:this._translations.selectAll,disabled:t,isOverflow:!1},{active:!1,icon:"compare",indicator:!1,func:()=>this._switchSelected(),label:this._translations.switchSelected,disabled:t,isOverflow:!1},{active:!1,icon:"refresh",indicator:!1,func:()=>this._refresh(),label:this._translations.refresh,disabled:!1,isOverflow:!1},this.enableCSV?{active:!1,icon:"export",indicator:!1,func:()=>{this._exportToCSV()},label:this._translations.exportCSV,disabled:t,isOverflow:!1}:void 0,{active:!1,icon:this._showHideOpen?"chevron-down":"chevron-right",indicator:!1,func:()=>this._toggleShowHide(),label:this._translations.showHideColumns,disabled:!1,isOverflow:!1,isSublist:!0}],this._defaultVisibleToolSizeInfos=void 0)}_featuresSelected(){return this._selectedIndexes.length>0}_featuresEmpty(){return 0===this._allIds.length}_hasFilterExpressions(){var i,t,s;let e;return(null===(t=null===(i=this.mapInfo)||void 0===i?void 0:i.filterConfig)||void 0===t?void 0:t.layerExpressions)&&(null===(s=this._layer)||void 0===s?void 0:s.id)&&(e=this.mapInfo.filterConfig.layerExpressions.filter((i=>i.id===this._layer.id))),(null==e?void 0:e.length)>0}_updateToolbar(){this._timeout&&clearTimeout(this._timeout),this.isMobile||(this._timeout=setTimeout((()=>{clearTimeout(this._timeout),this._setToolbarSizeInfos();const i=this._toolbar.offsetWidth;let t=this._toolbarSizeInfos.reduce(((i,t)=>i+t.width),0);const s=["solutions-more","solutions-map-layer-picker-container","solutions-action-share"];if(t>i){if(this._toolbarSizeInfos.length>0){const e=[...this._toolbarSizeInfos].reverse().reduce(((e,h)=>(s.indexOf(h.id)<0&&(t>i?t-=h.width:e.push(h)),e)),[]).reverse();this._setControlsThatFit(e,s)}}else if(this._defaultVisibleToolSizeInfos){const e=this._toolbarSizeInfos.reduce(((i,t)=>(i.push(t.id),i)),[]);let h=!1;const o=[...this._defaultVisibleToolSizeInfos].reduce(((o,a)=>(!h&&s.indexOf(a.id)<0&&(e.indexOf(a.id)>-1||t+a.width<=i)?(e.indexOf(a.id)<0&&(t+=a.width),o.push(a)):s.indexOf(a.id)<0&&t+a.width>i&&(h=!0),o)),[]);this._setControlsThatFit(o,s)}}),5))}_setControlsThatFit(i,t){let s=JSON.stringify(i)!==JSON.stringify(this._controlsThatFit);document.getElementById("solutions-action-bar").childNodes.forEach((i=>{t.indexOf(i.id)<0&&!s&&(s=this._controlsThatFit.map((i=>i.id)).indexOf(i.id)<0)})),s&&(this._controlsThatFit=[...i])}_setToolbarSizeInfos(){let i=!1;this._toolbarSizeInfos=[],this._toolbar.childNodes.forEach(((t,s)=>{0===s?t.childNodes.forEach((t=>{this._toolbarSizeInfos.push({id:t.id,width:t.offsetWidth}),i||(i=t.offsetWidth>0)})):t.referenceElement||(this._toolbarSizeInfos.push({id:t.id,width:t.offsetWidth}),i||(i=t.offsetWidth>0))})),i&&!this._defaultVisibleToolSizeInfos&&(this._defaultVisibleToolSizeInfos=[...this._toolbarSizeInfos])}_getActionItems(){var i;return null===(i=this._toolInfos)||void 0===i?void 0:i.filter((i=>i&&!i.isOverflow))}_getDropdown(i){const s=this._getDropdownItems();return s.length>0?t("calcite-dropdown",{closeOnSelectDisabled:!0,disabled:void 0===this._layer,id:"solutions-more",onCalciteDropdownBeforeClose:()=>this._forceShowHide(),ref:i=>this._moreDropdown=i},t("calcite-action",{appearance:"solid",id:i,label:"",onClick:()=>this._closeShowHide(),slot:"trigger",text:""},t("calcite-button",{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral"},this._translations.more)),t("calcite-dropdown-group",{"selection-mode":"none"},s.map((i=>t("calcite-dropdown-group",{class:i.disabled?"disabled":"",selectionMode:i.disabled?"none":"single"},t("calcite-dropdown-item",{iconStart:i.isSublist&&this._showHideOpen?"chevron-down":i.icon,id:"solutions-subset-list",onClick:i.func},i.label))))),this._showHideOpen?this._getFieldlist():void 0):void 0}_getDropdownItems(){var i;return null===(i=this._toolInfos)||void 0===i?void 0:i.filter((i=>i&&i.isOverflow))}_getAction(i,s,e,h,o,a,l){const n=void 0===this._layer||a;return t("div",{class:"display-flex",id:this._getId(s),slot:l},t("calcite-action",{active:i,appearance:"solid",disabled:n,icon:s,id:s,indicator:e,label:h,onClick:o,text:h,textEnabled:!0}),this._getToolTip("bottom",s,h))}_getShare(i){return t("div",{class:"share-action",id:this._getId(i)},t("instant-apps-social-share",{autoUpdateShareUrl:!1,class:"instant-app-share",embed:this.shareIncludeEmbed,popoverButtonIconScale:"s",ref:i=>this._shareNode=i,scale:"m",shareButtonColor:"neutral",shareButtonType:"action",socialMedia:this.shareIncludeSocial,view:this.mapView}),this._getToolTip("bottom",i,this._translations.share))}_updateShareUrl(){var i,t,s,e;const h=null===(i=this._shareNode)||void 0===i?void 0:i.shareUrl;if(!h)return;const o=new URL(h);if((null===(t=this.mapInfo)||void 0===t?void 0:t.id)?o.searchParams.set("webmap",this.mapInfo.id):o.searchParams.delete("webmap"),(null===(s=this._layer)||void 0===s?void 0:s.id)?o.searchParams.set("layer",this._layer.id):o.searchParams.delete("layer"),(null===(e=this._selectedIndexes)||void 0===e?void 0:e.length)>0?o.searchParams.set("oid",this._selectedIndexes.join(",")):o.searchParams.delete("oid"),this._filterActive){const i=JSON.parse(this._filterList.urlParams.get("filter")),t=this._filterList.layerExpressions.map((t=>(t.expressions=t.expressions.map((t=>(t.id.toString()===i.expressionId.toString()&&(t.active=!0),t))),t)));o.searchParams.set("filter",JSON.stringify(t))}else o.searchParams.delete("filter");this._shareNode.shareUrl=o.href,history.pushState(history.state,document.title,o.href)}_getToolTip(i,s,e){return t("calcite-tooltip",{placement:i,"reference-element":s},t("span",null,e))}_getId(i){return`solutions-action-${i}`}_getDangerAction(i,s,e,h){const o=void 0===this._layer||h;return t("div",{class:"display-flex",id:this._getId(i)},t("calcite-action",{appearance:"solid",disabled:o,id:i,onClick:e,text:""},t("calcite-button",{appearance:"transparent",iconStart:i,kind:"danger"},s)),this._getToolTip("bottom",i,s))}async _getTable(i,t){this._layer&&(await this._layer.when((()=>{this._table=new this.FeatureTable({autoRefreshEnabled:this.enableAutoRefresh,layer:this._layer,view:this.mapView,columnReorderingEnabled:this.enableColumnReorder,editingEnabled:this._editEnabled&&this.enableInlineEdit,highlightEnabled:!0,multiSortEnabled:!1,visibleElements:{header:!1,menu:!1},tableTemplate:{columnTemplates:t},container:i})})),this._initColumnsInfo(),this._checkEditEnabled(),await this._table.when((()=>{this._table.highlightIds.on("change",(i=>{this._handleOnChange(i)})),this.reactiveUtils.watch((()=>this._table.activeSortOrders),(i=>{var t,s,e,h;this._sortActive=!!this._layer&&(i.length>0&&"asc"===(null===(t=i[0])||void 0===t?void 0:t.direction)||"desc"===(null===(s=i[0])||void 0===s?void 0:s.direction)||null===(null===(e=i[0])||void 0===e?void 0:e.direction)&&(null===(h=i[0])||void 0===h?void 0:h.fieldName)===this._layer.objectIdField)}))})))}async _handleOnChange(i){const t=[...this._table.highlightIds.toArray()];if(this._skipOnChange)this._skipOnChange=!1;else{if(this._ctrlIsPressed||this._shiftIsPressed){if(this._ctrlIsPressed)this._selectedIndexes=t.reverse();else if(this._shiftIsPressed&&(this._skipOnChange=!0,this._previousCurrentId=this._currentId,this._currentId=[...this._table.highlightIds.toArray()].reverse()[0],this._previousCurrentId!==this._currentId)){const i=this._table.activeSortOrders.reduce(((i,t)=>(i.push(`${t.fieldName} ${t.direction}`),i)),[]),s=await d(this._layer,this._layer.definitionExpression,i);let e=!1;const h=this._table.viewModel.getObjectIdIndex(this._previousCurrentId),o=this._table.viewModel.getObjectIdIndex(this._currentId),a=h<o?h:o,l=o>h?o:h;this._skipOnChange=a+1!==l;const n=s.reduce(((i,t)=>{const s=t,h=this._table.viewModel.getObjectIdIndex(s);return s!==this._currentId&&s!==this._previousCurrentId||(e=!e,i.indexOf(s)<0&&i.push(s)),e&&i.indexOf(s)<0&&i.push(s),(this._selectedIndexes.indexOf(s)>-1||h>=a&&h<=l)&&i.indexOf(s)<0&&h>-1&&i.push(s),i}),[]);this._selectedIndexes=h<o?n.reverse():n,this._table.highlightIds.addMany(this._selectedIndexes.filter((i=>t.indexOf(i)<0)))}}else if(this._selectedIndexes.length>0){this._skipOnChange=!0;const s=this._selectedIndexes.length>1&&1===i.removed.length?i.removed:t.filter((i=>this._selectedIndexes.indexOf(i)<0));this._clearSelection(),this._selectedIndexes=[...s],s.length>0?this._table.highlightIds.add(s[0]):this._skipOnChange=!1}else this._selectedIndexes=t.reverse();this._finishOnChange()}this._currentId=[...this._table.highlightIds.toArray()].reverse()[0]}_finishOnChange(){this._showOnlySelected&&(this._featuresSelected()?this._table.filterBySelection():this._toggleShowSelected()),this.featureSelectionChange.emit(this._selectedIndexes)}async _resetTable(){var i;this._clearSelection(),this._allIds=[],this.featureSelectionChange.emit(this._selectedIndexes);const t=this._getColumnTemplates(this._layer.id,null===(i=this._layer)||void 0===i?void 0:i.fields);this._allIds=await r(this._layer),this._table?t&&(this._table.tableTemplate.columnTemplates=t):await this._getTable(this._tableNode,t),this._table.layer=this._layer,this._table.view=this.mapView,this._checkEditEnabled(),this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit,this._initToolInfos(),await this._table.when((async()=>{var i,t;if(this._table.highlightIds.removeAll(),this._table.clearSelectionFilter(),this._initColumnsInfo(),!this._defaultOidHonored&&(null===(i=this.defaultOid)||void 0===i?void 0:i.length)>0&&this.defaultOid[0]>-1&&(this._selectDefaultFeature(this.defaultOid),this._defaultOidHonored=!0),!this._defaultGlobalIdHonored&&(null===(t=this.defaultGlobalId)||void 0===t?void 0:t.length)>0){const i=await c(this.defaultGlobalId,this._layer),t=(null==i?void 0:i.length)>0?i.map((i=>i.getObjectId())):void 0;t&&this._selectDefaultFeature(t),this._defaultGlobalIdHonored=!0}!this._defaultFilterHonored&&this.defaultFilter&&this._filterList&&(this._layerExpressions=this.defaultFilter,this._filterActive=!0,this._defaultFilterHonored=!0)})),this._showOnlySelected=!1,this._sortActive=!1,await this._sortTable()}_initColumnsInfo(){this._columnsInfo=this._table.columns.reduce(((i,t)=>(i[t.name]=!t.hidden,i)),{})}_selectDefaultFeature(i){i.length>0&&(this._table.highlightIds.addMany(i),this._table.when((()=>{const t=this._table.viewModel.getObjectIdIndex(i[0]);this._table.viewModel.scrollToIndex(t)})))}_checkEditEnabled(){this._editEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsUpdate,this._deleteEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsDelete}async _sortTable(){this._table&&this._layer&&!this._sortActive&&!this._tableSorting&&this.showNewestFirst&&(this._tableSorting=!0,await this._table.when(),await this._layer.when((()=>{this._table.sortColumn(this._layer.objectIdField,"desc"),this._tableSorting=!1})))}_forceShowHide(){this._showHideDropdown&&(this._showHideDropdown.open=this._showHideOpen),this._moreDropdown&&(this._moreDropdown.open=this._showHideOpen)}_toggleShowHide(){this._showHideOpen=!this._showHideOpen}_closeShowHide(){this._showHideOpen=!1}_handleDocumentClick(i){var t;const s=null===(t=i.target)||void 0===t?void 0:t.id;this._showHideOpen&&Object.keys(this._columnsInfo).indexOf(s)<0&&"solutions-subset-list"!==s&&"chevron-right"!==s&&(this._closeShowHide(),this._moreDropdown&&(this._moreDropdown.open=!1),this._showHideDropdown&&(this._showHideDropdown.open=!1))}_handleKeyDown(i){this._ctrlIsPressed=i.ctrlKey,this._shiftIsPressed=i.shiftKey}_handleKeyUp(i){this._ctrlIsPressed=i.ctrlKey,this._shiftIsPressed=i.shiftKey}_filterModal(){var i,s,e;return t("calcite-modal",{"aria-labelledby":"modal-title",class:"modal",kind:"brand",onCalciteModalClose:async()=>this._closeFilter(),open:this._filterOpen,widthScale:"s"},t("div",{class:"display-flex align-center",id:"modal-title",slot:"header"},null===(s=null===(i=this._translations)||void 0===i?void 0:i.filter)||void 0===s?void 0:s.replace("{{title}}",null===(e=this._layer)||void 0===e?void 0:e.title)),t("div",{slot:"content"},t("instant-apps-filter-list",{autoUpdateUrl:!0,closeBtn:!0,closeBtnOnClick:async()=>this._closeFilter(),layerExpressions:this._layerExpressions,onFilterListReset:()=>this._handleFilterListReset(),onFilterUpdate:()=>this._handleFilterUpdate(),ref:i=>this._filterList=i,view:this.mapView,zoomBtn:!1})))}_handleFilterListReset(){this._filterActive=!1,this._updateShareUrl()}_handleFilterUpdate(){this._filterActive=this._definitionExpression!==this._layer.definitionExpression,this._updateShareUrl()}async _closeFilter(){this._filterOpen&&(this._allIds=await r(this._layer),this._filterOpen=!1)}_deleteMessage(){return t("calcite-modal",{"aria-labelledby":"modal-title",kind:"danger",onCalciteModalClose:()=>this._deleteClosed(),open:this._confirmDelete},t("div",{class:"display-flex align-center",id:"modal-title",slot:"header"},this._translations.deleteFeature),t("div",{slot:"content"},this._translations.confirm),t("calcite-button",{appearance:"outline",kind:"danger",onClick:()=>this._deleteClosed(),slot:"secondary",width:"full"},this._translations.cancel),t("calcite-button",{kind:"danger",loading:this._isDeleting,onClick:()=>{this._deleteFeatures()},slot:"primary",width:"full"},this._translations.delete))}async _deleteFeatures(){this._isDeleting=!0;const i=this._table.highlightIds.toArray().map((i=>({objectId:i})));await this._layer.applyEdits({deleteFeatures:i}),await this._table.refresh(),this._allIds=await r(this._layer),this._isDeleting=!1,this._deleteClosed()}async _mapClicked(i){const t={include:this._layer},s=await this.mapView.hitTest(i.screenPoint,t);s.results.length>0&&(s.results.forEach((i=>{this._clearSelection();const t=i.graphic.getObjectId(),s=this._table.highlightIds.indexOf(t);s>-1?this._table.highlightIds.removeAt(s):this._table.highlightIds.add(t)})),this._showOnlySelected&&this._table.filterBySelection())}_deleteClosed(){this._confirmDelete=!1}_selectAll(){const i=this._allIds;this._table.highlightIds.removeAll(),this._skipOnChange=!0,this._table.highlightIds.addMany(i),this._selectedIndexes=i,this._finishOnChange(),this._selectAllActive=!0}_toggleShowSelected(){this._showOnlySelected=!this._showOnlySelected,this._showOnlySelected?this._table.filterBySelection():this._table.clearSelectionFilter()}_clearSelection(){var i;this._selectedIndexes=[],null===(i=this._table)||void 0===i||i.highlightIds.removeAll(),this._finishOnChange()}_toggleFilter(){this._filterOpen=!this._filterOpen}_initLayerExpressions(){var i,t;const s=null===(t=null===(i=this.mapInfo)||void 0===i?void 0:i.filterConfig)||void 0===t?void 0:t.layerExpressions;this._layerExpressions=s?s.filter((i=>i.id===this._layer.id)):[]}_switchSelected(){const i=[...this._selectedIndexes];this._table.highlightIds.removeAll();const t=this._allIds.reduce(((t,s)=>(i.indexOf(s)<0&&t.push(s),t)),[]).sort(((i,t)=>i-t));this._skipOnChange=!0,this._table.highlightIds.addMany(t),this._selectedIndexes=t,this._finishOnChange()}async _exportToCSV(){const i={},t=this._table.highlightIds.toArray();i[this._layer.id]={selectionSetNames:[this._layer.title],ids:t,layer:this._layer};const s=this._table.columns.toArray().reduce(((i,t)=>(t.hidden||i.push(t.name.toLocaleLowerCase()),i)),[]);v(null,i,!1,!1,!0,s)}async _refresh(){await this._table.refresh(),this.featureSelectionChange.emit(this._selectedIndexes)}_zoom(){this._table.zoomToSelection()}_delete(){this._confirmDelete=!0}async _layerSelectionChanged(i){var t;const s=i.detail[0];if(s!==(null===(t=this._layer)||void 0===t?void 0:t.id)||this._featuresEmpty()){this._fetchingData=!0;const i=await l(this.mapView,s);await i.when((()=>{this._layer=i}))}this._fetchingData=!1}_getColumnTemplates(i,t){var s;let e;null===(s=this.mapInfo.layerInfos)||void 0===s||s.some((t=>{if(t.id===i)return e=t,!0}));let h=null==e?void 0:e.columnTemplates;return t&&(h=h?h.map((i=>(t.some((t=>{if(t.name===i.fieldName)return i.label=t.alias,i.menuConfig=this._getMenuConfig(t.name),!0})),i))):t.map((i=>({type:"field",fieldName:i.name,label:i.alias,menuConfig:this._getMenuConfig(i.name)})))),h}_getMenuConfig(i){return{items:[{label:this._translations.hideField,iconClass:"esri-icon-non-visible",autoCloseMenu:!0,clickFunction:()=>{this._handleHideClick(i)}}]}}_handleHideClick(i){this._columnsInfo[i]=!1,this._table.hideColumn(i),this._table.tableTemplate.columnTemplates.forEach((t=>{t.fieldName===i&&(t.visible=!1)}))}async _getTranslations(){const i=await o(this.el);this._translations=i[0]}get el(){return e(this)}static get watchers(){return{enableCSV:["enableCSVWatchHandler"],enableInlineEdit:["enableInlineEditWatchHandler"],_controlsThatFit:["_controlsThatFitWatchHandler"],isMobile:["isMobileWatchHandler"],mapInfo:["mapInfoWatchHandler"],mapView:["mapViewWatchHandler"],_layer:["_layerWatchHandler"],_selectedIndexes:["_selectedIndexesWatchHandler"],_sortActive:["_sortActiveWatchHandler"]}}};b.style=':host{display:block}.height-full{height:100%}.height-full-adjusted{height:calc(100% - 20px)}.width-full{width:100%}.display-flex{display:flex}.table-border{border:1px solid var(--calcite-color-border-2)}.border-end{border-inline-end:1px solid var(--calcite-color-border-2)}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.padding-5{padding:5px}.padding-end-1{padding-inline-end:1rem}.height-51{height:51px}.height-50-px{height:50px}.bottom-left{position:absolute;left:0;bottom:0;padding-left:5px}html[dir="rtl"] .bottom-left{position:absolute;right:0;bottom:0;padding-right:5px}.height-19{height:19px}.background{background-color:var(--calcite-color-background)}.text-color{color:var(--calcite-color-text-1)}.align-center{align-items:center}.danger-color{color:var(--calcite-color-status-danger)}.esri-feature-table vaadin-grid{border:none !important}vaadin-grid-cell-content{font-size:14px !important;color:var(--calcite-color-text-3) !important}.share-action{position:absolute;right:0}html[dir="rtl"] .share-action{left:0}.disabled{cursor:default !important;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.instant-app-share{height:50px !important;display:inline-flex}.border-top{border-top:1px solid var(--calcite-color-border-2)}.modal{--calcite-modal-content-padding:0}';const m=class{constructor(t){i(this,t),this.mapChanged=h(this,"mapChanged",7),this.beforeMapChanged=h(this,"beforeMapChanged",7),this._defaultWebmapHonored=!1,this._loadedId="",this.defaultWebmapId="",this.enableHome=void 0,this.enableLegend=void 0,this.enableFloorFilter=void 0,this.enableFullscreen=void 0,this.enableSingleExpand=!0,this.enableSearch=void 0,this.enableBasemap=void 0,this.basemapConfig=void 0,this.hidden=void 0,this.homeZoomIndex=3,this.homeZoomPosition="top-left",this.homeZoomToolsSize="m",this.mapInfos=[],this.mapWidgetsIndex=0,this.mapWidgetsPosition="top-right",this.mapWidgetsSize="m",this.mapView=void 0,this.stackTools=!0,this.theme=void 0,this.toolOrder=void 0,this._searchConfiguration=void 0,this._webMapInfo=void 0}enableHomeWatchHandler(){this._initHome()}async mapInfoChange(i){await this._loadMap(i.detail)}async componentWillLoad(){await this._initModules()}render(){var i,e;const h=this.hidden?"visibility-hidden":"",o="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light",a=(null===(i=this.mapInfos)||void 0===i?void 0:i.length)>1?"":"display-none",l=(null===(e=this.mapInfos)||void 0===e?void 0:e.length)>1?"map-height":"height-full";return t(s,null,t("map-picker",{class:a,mapInfos:this.mapInfos,ref:i=>this._mapPicker=i}),t("div",{class:`${l} ${h}`,ref:i=>this._mapDiv=i}),t("map-tools",{basemapConfig:this.basemapConfig,class:`box-shadow ${o}`,enableBasemap:this.enableBasemap,enableFloorFilter:this.enableFloorFilter,enableFullscreen:this.enableFullscreen,enableHome:this.enableHome,enableLegend:this.enableLegend,enableSearch:this.enableSearch,enableSingleExpand:this.enableSingleExpand,homeZoomToolsSize:this.homeZoomToolsSize,mapView:this.mapView,mapWidgetsSize:this.mapWidgetsSize,position:this.mapWidgetsPosition,ref:i=>this._mapTools=i,searchConfiguration:this._searchConfiguration,stackTools:this.stackTools,toolOrder:this.toolOrder}))}async _initModules(){const[i,t,s]=await p(["esri/WebMap","esri/views/MapView","esri/widgets/Home"]);this.WebMap=i,this.MapView=t,this.Home=s}async _loadMap(i){var t;const s=!this._defaultWebmapHonored&&this.defaultWebmapId,e=null===(t=this.mapInfos)||void 0===t?void 0:t.filter((i=>i.id===this.defaultWebmapId)),h=JSON.stringify(i)!==JSON.stringify(this._webMapInfo);this._webMapInfo=s&&e?e[0]:!(null==i?void 0:i.id)&&this.mapInfos.length>0?this.mapInfos[0]:i;const o=this._webMapInfo.id,a=s&&(null==i?void 0:i.id)===this.defaultWebmapId;if(this._loadedId!==o&&!s||a){const i=new this.WebMap({portalItem:{id:o}});this.mapView=new this.MapView({container:this._mapDiv,map:i,resizeAlign:"center"}),this._loadedId=o,this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),await this.mapView.when((()=>{this._initHome(),this.mapView.ui.add(this._mapTools,{position:this.mapWidgetsPosition,index:this.mapWidgetsIndex}),this._defaultWebmapHonored=!!a||this._defaultWebmapHonored,this.mapChanged.emit({id:o,mapView:this.mapView})}))}else s?(this._defaultWebmapHonored=!0,this._mapPicker.setMapByID(o)):h&&(this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),this.mapChanged.emit({id:o,mapView:this.mapView}))}_initHome(){if(this.enableHome){this._homeWidget=new this.Home({view:this.mapView}),this.mapView.ui.add(this._homeWidget,{position:this.homeZoomPosition,index:this.homeZoomIndex});const i="s"===this.homeZoomToolsSize?"32px":"m"===this.homeZoomToolsSize?"40px":"48px";this._homeWidget.domNode.style.height=i,this._homeWidget.domNode.style.width=i}else this._homeWidget&&this.mapView.ui.remove(this._homeWidget)}get el(){return e(this)}static get watchers(){return{enableHome:["enableHomeWatchHandler"]}}};m.style=":host{display:block;--calcite-label-margin-bottom:0;--calcite-block-padding:0}.map-height{height:calc(100% - 51px)}.height-full{height:100%}.box-shadow{box-shadow:none !important}.visibility-hidden{visibility:hidden}.display-none{display:none}";export{u as card_manager,b as layer_table,m as map_card}