@esri/solutions-components 0.7.47 → 0.7.48
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/basemap-gallery_7.cjs.entry.js +13 -5
- package/dist/cjs/card-manager_3.cjs.entry.js +34 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/components/floor-filter/floor-filter.js +41 -5
- package/dist/collection/components/layer-table/layer-table.js +46 -3
- package/dist/collection/demos/crowdsource-manager.html +6 -0
- package/dist/components/floor-filter2.js +13 -5
- package/dist/components/layer-table2.js +35 -4
- package/dist/esm/basemap-gallery_7.entry.js +13 -5
- package/dist/esm/card-manager_3.entry.js +34 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/demos/crowdsource-manager.html +6 -0
- package/dist/solutions-components/p-6a83b842.entry.js +6 -0
- package/dist/solutions-components/p-fec03ab3.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/types/components/floor-filter/floor-filter.d.ts +16 -0
- package/dist/types/components/layer-table/layer-table.d.ts +21 -1
- package/dist/types/components.d.ts +10 -0
- package/dist/types/preact.d.ts +3 -1
- package/package.json +1 -1
- package/dist/solutions-components/p-26764dd7.entry.js +0 -6
- package/dist/solutions-components/p-fc4df904.entry.js +0 -6
@@ -38,6 +38,12 @@
|
|
38
38
|
<script type="module" src="../solutions-components.esm.js"></script>
|
39
39
|
|
40
40
|
<script>
|
41
|
+
// require(["esri/config"], (
|
42
|
+
// esriConfig
|
43
|
+
// ) => {
|
44
|
+
// esriConfig.portalUrl = "https://holistic.mapsdevext.arcgis.com";
|
45
|
+
// });
|
46
|
+
|
41
47
|
function addValues() {
|
42
48
|
const demo = document.getElementById("demo");
|
43
49
|
|
@@ -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-7d280d8a.js";import{l as a,g as o}from"./p-b04c9dc3.js";import"./p-d918ec36.js";import"./p-e1a4994d.js";const n=class{constructor(t){i(this,t),this.mapView=void 0,this.basemapConfig=void 0,this.basemapWidget=void 0}async mapViewWatchHandler(){await this.mapView.when((()=>{this._initBaseMapGallery(this.mapView)}))}async componentWillLoad(){return this._initModules()}render(){return t(s,null,t("div",{ref:i=>{this._basemapElement=i}}))}async componentDidLoad(){this.mapView&&await this.mapViewWatchHandler()}async _initModules(){const[i,t]=await a(["esri/widgets/BasemapGallery","esri/widgets/BasemapGallery/support/PortalBasemapsSource"]);this.BasemapGallery=i,this.PortalBasemapsSource=t}async _initBaseMapGallery(i){var t;if(this.BasemapGallery){this.basemapWidget&&this.basemapWidget.destroy();const s=new this.PortalBasemapsSource({query:(null===(t=this.basemapConfig)||void 0===t?void 0:t.basemapGroupId)?`id:${this.basemapConfig.basemapGroupId}`:null,filterFunction:this.basemapConfig?i=>!this.basemapConfig.basemapIdsToFilter.includes(i.portalItem.id):()=>!0});await s.refresh(),this.basemapWidget=new this.BasemapGallery({container:this._basemapElement,view:i,source:s})}}get el(){return e(this)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};n.style=":host{display:block}";const r=class{constructor(t){i(this,t),this.facilityChanged=h(this,"facilityChanged",7),this.levelChanged=h(this,"levelChanged",7),this.siteChanged=h(this,"siteChanged",7),this.enabled=void 0,this.floorFilterWidget=void 0,this.mapView=void 0}async mapViewWatchHandler(){await this.mapView.when((()=>{this._initFloorFilter(this.mapView)}))}async componentWillLoad(){return this._initModules()}render(){return t(s,null,t("div",{ref:i=>{this._floorFilterElement=i}}))}async _initModules(){const[i,t]=await a(["esri/widgets/FloorFilter","esri/core/reactiveUtils"]);this.FloorFilter=i,this.reactiveUtils=t}_initFloorFilter(i){var t,s,e,h;i&&this.enabled&&this.FloorFilter&&(null===(t=null==i?void 0:i.map)||void 0===t?void 0:t.floorInfo)&&(this.floorFilterWidget?this.floorFilterWidget.viewModel.view=i:(this.floorFilterWidget=new this.FloorFilter({container:this._floorFilterElement,view:i}),null===(s=this._facilityHandle)||void 0===s||s.remove(),this._facilityHandle=this.reactiveUtils.watch((()=>this.floorFilterWidget.facility),(i=>{this.facilityChanged.emit(i)})),null===(e=this._levelHandle)||void 0===e||e.remove(),this._levelHandle=this.reactiveUtils.watch((()=>this.floorFilterWidget.level),(i=>{this.levelChanged.emit(i)})),null===(h=this._siteHandle)||void 0===h||h.remove(),this._siteHandle=this.reactiveUtils.watch((()=>this.floorFilterWidget.site),(i=>{this.siteChanged.emit(i)}))))}get el(){return e(this)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};r.style=":host{display:block}";const l=class{constructor(t){i(this,t),this.fullscreenStateChange=h(this,"fullscreenStateChange",7),this.mapView=void 0,this.fullscreenWidget=void 0}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this._initFullscreenWidget()}))}async componentWillLoad(){await this._initModules()}render(){return t(s,null,t("div",{class:"fullscreen-widget",ref:i=>{this._fullscreenElement=i}}))}async componentDidUpdate(){await this._initFullscreenWidget()}async componentDidLoad(){await this._initFullscreenWidget()}async _initModules(){const[i,t]=await a(["esri/widgets/Fullscreen","esri/core/reactiveUtils"]);this.Fullscreen=i,this.reactiveUtils=t}async _initFullscreenWidget(){this.mapView&&this._fullscreenElement&&!this.fullscreenWidget?(this.fullscreenWidget=new this.Fullscreen({view:this.mapView}),await this.fullscreenWidget.when((()=>{this._fullscreenStateChangeHandle&&this._fullscreenStateChangeHandle.remove(),this._fullscreenStateChangeHandle=this.reactiveUtils.watch((()=>this.fullscreenWidget.viewModel.state),(i=>this.fullscreenStateChange.emit(i)))}))):this.fullscreenWidget&&(this.fullscreenWidget.view=this.mapView)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};l.style=":host{display:block}";const c=class{constructor(t){i(this,t),this.mapView=void 0,this.legendWidget=void 0}async mapViewWatchHandler(){await this.mapView.when((()=>{this._initLegend(this.mapView)}))}async componentWillLoad(){return this._initModules()}render(){return t(s,null,t("div",{ref:i=>{this._legendElement=i}}))}async componentDidLoad(){this.mapView&&await this.mapViewWatchHandler()}async _initModules(){const[i]=await a(["esri/widgets/Legend"]);this.Legend=i}_initLegend(i){i&&this.Legend&&(this.legendWidget?this.legendWidget.view=i:this.legendWidget=new this.Legend({container:this._legendElement,view:i}))}get el(){return e(this)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};c.style=":host{display:block}";const d=class{constructor(t){i(this,t),this.mapInfoChange=h(this,"mapInfoChange",7),this._loadedId="",this.mapInfos=[],this._mapListExpanded=!1,this._translations=void 0,this._webMapInfo=void 0}_webMapInfoWatchHandler(i,t){i&&JSON.stringify(i)!==JSON.stringify(t)&&(this._loadedId=null==i?void 0:i.id,this.mapInfoChange.emit(i))}async mapInfosWatchHandler(i,t){i&&JSON.stringify(i)!==JSON.stringify(t)&&this._webMapSelected(i[0])}async setMapByID(i){var t;const s=null===(t=this.mapInfos)||void 0===t?void 0:t.filter((t=>t.id===i));i&&(null==s?void 0:s.length)>0&&this._webMapSelected(s[0])}async componentWillLoad(){await this._getTranslations()}render(){return t(s,null,this._getToolbar(),this._getMapNameList(this._mapListExpanded))}async componentDidLoad(){const i=this.mapInfos&&this.mapInfos.length>0?this.mapInfos[0]:void 0;i&&this._webMapSelected(i)}_getMapPicker(){var i;const s="map-picker-expand-toggle";return t("div",{class:"width-full"},t("calcite-button",{alignment:"icon-end-space-between",appearance:"transparent",class:"width-full height-full",iconEnd:this._mapListExpanded?"chevron-up":"chevron-down",id:s,kind:"neutral",onClick:()=>this._chooseMap(),width:"full"},null===(i=this._webMapInfo)||void 0===i?void 0:i.name),t("calcite-tooltip",{label:"",placement:"bottom","reference-element":s},t("span",null,this._translations.switchMap)))}_getToolbar(){return t("div",{class:"display-flex"},t("calcite-action-bar",{class:"border-bottom-1 action-bar-size","expand-disabled":!0,layout:"horizontal",slot:"header"},this._getMapPicker()))}_getMapNameList(i){return t("div",{class:i?"map-list border-bottom-1":"display-none"},t("calcite-list",{id:"mapList",ref:i=>this._list=i,selectionAppearance:"border",selectionMode:"single"},this.mapInfos.map((i=>t("calcite-list-item",{label:i.name,onClick:()=>this._webMapSelected(i),selected:i.id===this._loadedId,value:i.id})))))}_webMapSelected(i){this._mapListExpanded=!1,this._webMapInfo=i}_chooseMap(){this._mapListExpanded=!this._mapListExpanded}async _getTranslations(){const i=await o(this.el);this._translations=i[0]}get el(){return e(this)}static get watchers(){return{_webMapInfo:["_webMapInfoWatchHandler"],mapInfos:["mapInfosWatchHandler"]}}};d.style=":host{display:block;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.width-full{width:100%}.height-full{height:100%}.display-flex{display:flex}.border-bottom-1{border-width:0px;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-color-border-3)}.action-bar-size{height:51px;width:100%}.map-list{position:absolute;display:flex;flex-direction:column;overflow:hidden;animation:calcite-scrim-fade-in var(--calcite-internal-animation-timing-medium) ease-in-out;background-color:var(--calcite-color-background);z-index:1000;width:100%;height:-moz-fit-content;height:fit-content}.display-none{display:none}.align-center{align-items:center}";const p=class{constructor(t){i(this,t),this.mapView=void 0,this.popupEnabled=!1,this.resultGraphicEnabled=!1,this.searchConfiguration=void 0,this.searchTerm=void 0,this.searchWidget=void 0}async watchSearchConfigurationHandler(){this._initSearchWidget()}async mapViewWatchHandler(){await this.mapView.when((()=>{this._initSearchWidget()}))}async componentWillLoad(){await this._initModules()}async componentDidLoad(){return this._initSearchWidget()}render(){return t(s,null,t("div",{class:"search-widget",ref:i=>{this._searchElement=i}}))}async _initModules(){const[i,t]=await a(["esri/widgets/Search","esri/layers/FeatureLayer"]);this.Search=i,this.FeatureLayer=t}_initSearchWidget(){if(this.mapView&&this._searchElement&&!this.searchWidget){let i={view:this.mapView,container:this._searchElement,searchTerm:this.searchTerm};if(this.searchConfiguration){const t=this._getSearchConfig(this.searchConfiguration,this.mapView);i=Object.assign({},t)}this.searchWidget=new this.Search(i),this.searchWidget.popupEnabled=this.popupEnabled,this.searchWidget.resultGraphicEnabled=this.resultGraphicEnabled}else this.searchWidget&&(this.searchWidget.view=this.mapView)}_getSearchConfig(i,t){const s=i.sources;return(null==s?void 0:s.length)>0?(i.includeDefaultSources=!1,s.forEach((i=>{var s,e;if(i.hasOwnProperty("layer")){const h=i,a=null===(s=h.layer)||void 0===s?void 0:s.id,o=a?t.map.findLayerById(a):null,n=null===(e=null==h?void 0:h.layer)||void 0===e?void 0:e.url;o?h.layer=o:n&&(h.layer=new this.FeatureLayer(n))}})),null==s||s.forEach((i=>{if(i.hasOwnProperty("locator")){const t=i;"ArcGIS World Geocoding Service"===(null==t?void 0:t.name)&&(t.outFields=t.outFields||["Addr_type","Match_addr","StAddr","City"],t.singleLineFieldName="SingleLine"),t.url=t.url,delete t.url}}))):i=Object.assign(Object.assign({},i),{includeDefaultSources:!0}),i}static get watchers(){return{searchConfiguration:["watchSearchConfigurationHandler"],mapView:["mapViewWatchHandler"]}}};p.style=":host{display:block}.search-widget{width:100% !important;border:1px solid var(--calcite-color-border-input)}";const u=class{constructor(t){i(this,t),this._widgets=[],this.basemapConfig=void 0,this.enableLegend=void 0,this.enableFloorFilter=void 0,this.enableFullscreen=void 0,this.enableSearch=void 0,this.enableBasemap=void 0,this.enableHome=void 0,this.enableSingleExpand=void 0,this.homeZoomToolsSize="m",this.layout="vertical",this.mapView=void 0,this.mapWidgetsSize="m",this.position="top-right",this.searchConfiguration=void 0,this.stackTools=!0,this.toolOrder=void 0,this._hasFloorInfo=!1,this._translations=void 0,this._showTools=!0,this._showBasemapWidget=!1,this._showFloorFilter=!1,this._showFullscreen=!1,this._showLegendWidget=!1,this._showSearchWidget=!1}async mapViewWatchHandler(){await this.mapView.when((()=>{var i,t;this._hasFloorInfo=null===(t=null===(i=this.mapView)||void 0===i?void 0:i.map)||void 0===t?void 0:t.floorInfo}))}async _showBasemapWidgetWatchHandler(i){i?this.mapView.ui.add(this._basemapElement.basemapWidget,{position:this.position,index:1}):this.mapView.ui.remove(this._basemapElement.basemapWidget)}async _showFloorFilterWatchHandler(i){const t=this._floorFilterElement.floorFilterWidget;i?this.mapView.ui.add(t,{position:this.position,index:1}):this.mapView.ui.remove(t)}async _showFullscreenWatchHandler(i){const t=this._fullscreenElement.fullscreenWidget;i?"ready"===t.viewModel.state&&t.viewModel.enter():"active"===t.viewModel.state&&t.viewModel.exit()}async _showLegendWidgetWatchHandler(i){i?this.mapView.ui.add(this._legendElement.legendWidget,{position:this.position,index:1}):this.mapView.ui.remove(this._legendElement.legendWidget)}async _showSearchWidgetWatchHandler(i){i?this.mapView.ui.add(this._searchElement.searchWidget,{position:this.position,index:1}):this.mapView.ui.remove(this._searchElement.searchWidget)}async componentWillLoad(){await this._getTranslations(),await this._initModules()}render(){this._setZoomToolsSize();const i=this._showTools?"":"display-none",e=this._showSearchWidget?"":"display-none",h=this._showBasemapWidget?"":"display-none",a=this._showLegendWidget?"":"display-none",o=this._showFloorFilter?"":"display-none",n=this._showFullscreen?"":"display-none",r=this.enableSingleExpand?"margin-top-1-2":"",l=this.toolOrder?this.toolOrder:["legend","search","fullscreen","floorfilter"],c=this.stackTools?"box-shadow":"";return t(s,null,t("div",{class:this.enableBasemap||this.enableFullscreen||this.enableLegend||this.enableSearch?"":"display-none"},this.enableSingleExpand?t("div",{class:"box-shadow"},this._getActionGroup(this._showTools?"chevrons-up":"chevrons-down",!1,this._showTools?this._translations.collapse:this._translations.expand,(()=>this._toggleTools()))):void 0,t("div",{class:`${r} ${c} ${i}`},this._getMapWidgets(l))),t("basemap-gallery",{basemapConfig:this.basemapConfig,class:h,mapView:this.mapView,ref:i=>{this._basemapElement=i}}),t("map-search",{class:e,mapView:this.mapView,ref:i=>{this._searchElement=i},resultGraphicEnabled:!0,searchConfiguration:this.searchConfiguration}),t("map-legend",{class:a,mapView:this.mapView,ref:i=>{this._legendElement=i}}),t("map-fullscreen",{class:n,mapView:this.mapView,onFullscreenStateChange:i=>this._fullscreenStateChange(i.detail),ref:i=>{this._fullscreenElement=i}}),t("floor-filter",{class:o,enabled:this.enableFloorFilter,mapView:this.mapView,ref:i=>{this._floorFilterElement=i}}))}async _initModules(){const[i]=await a(["esri/widgets/Expand"]);this.Expand=i}_setZoomToolsSize(){var i,t;const s=null===(i=document.getElementsByClassName("esri-zoom")[0])||void 0===i?void 0:i.children[0],e=null===(t=document.getElementsByClassName("esri-zoom")[0])||void 0===t?void 0:t.children[1];if(s&&e){const i="s"===this.homeZoomToolsSize?"32px":"m"===this.homeZoomToolsSize?"40px":"48px";s.style.width=i,s.style.height=i,e.style.width=i,e.style.height=i}}_getMapWidgets(i){const t=this._showFullscreen?"full-screen-exit":"full-screen",s=this._showFullscreen?this._translations.exitFullscreen:this._translations.enterFullscreen;return i.map((i=>{var e,h,a,o,n;switch(i){case"legend":return this.enableLegend&&this.enableSingleExpand?this._getActionGroup("legend",!1,this._translations.legend,(()=>this._showLegend())):this.enableLegend?this._getWidget(i,null===(e=this._legendElement)||void 0===e?void 0:e.legendWidget,!0):void 0;case"search":return this.enableSearch&&this.enableSingleExpand?this._getActionGroup("magnifying-glass",!1,this._translations.search,(()=>this._search())):this.enableSearch?this._getWidget(i,null===(h=this._searchElement)||void 0===h?void 0:h.searchWidget,!0):void 0;case"fullscreen":return this.enableFullscreen&&this.enableSingleExpand?this._getActionGroup(t,!1,s,(()=>this._expand())):this.enableFullscreen?this._getWidget(i,null===(a=this._fullscreenElement)||void 0===a?void 0:a.fullscreenWidget,!1):void 0;case"basemap":return this.enableBasemap&&this.enableSingleExpand?this._getActionGroup("basemap",!1,this._translations.basemap,(()=>this._toggleBasemapPicker())):this.enableBasemap?this._getWidget(i,null===(o=this._basemapElement)||void 0===o?void 0:o.basemapWidget,!0):void 0;case"floorfilter":return this.enableFloorFilter&&this._hasFloorInfo&&this.enableSingleExpand?this._getActionGroup("urban-model",!1,this._translations.floorFilter,(()=>this._toggleFloorFilter())):this.enableFloorFilter&&this._hasFloorInfo?this._getWidget(i,null===(n=this._floorFilterElement)||void 0===n?void 0:n.floorFilterWidget,!0):void 0}}))}_fullscreenStateChange(i){"ready"===i&&this._showFullscreen?this._showFullscreen=!1:"active"!==i||this._showFullscreen||(this._showFullscreen=!0)}_getActionGroup(i,s,e,h){return t("div",null,t("calcite-action",{alignment:"center",class:`${"s"===this.mapWidgetsSize?"square-32":"m"===this.mapWidgetsSize?"square-40":"square-48"} ${this.stackTools?"":"margin-bottom-1-2"} border-bottom ${this.stackTools?"":"box-shadow"}`,compact:!1,disabled:s,icon:i,id:i,onClick:h,scale:"s",text:""},t("calcite-icon",{icon:"cheveron-up",scale:"s",slot:"icon"})),t("calcite-tooltip",{label:"",placement:"trailing","reference-element":i},t("span",null,e)))}_getWidget(i,t,s){if(this._widgets.indexOf(i)<0&&this.mapView&&t){const e=this.toolOrder.indexOf(i),h=new this.Expand({view:this.mapView,content:t});this.mapView.ui.add(s?h:t,{position:this.position,index:e>-1?e+(this.enableHome?2:1):1}),this._widgets.push(i)}}_showLegend(){this._showLegendWidget=!this._showLegendWidget,this._showTools=!1}_search(){this._showSearchWidget=!this._showSearchWidget,this._showTools=!1}_toggleBasemapPicker(){this._showBasemapWidget=!this._showBasemapWidget,this._showTools=!1}_toggleFloorFilter(){this._showFloorFilter=!this._showFloorFilter,this._showTools=!1}_expand(){this._showFullscreen=!this._showFullscreen}_toggleTools(){this._showTools||(this._showBasemapWidget=!1,this._showSearchWidget=!1,this._showLegendWidget=!1,this._showFloorFilter=!1),this._showTools=!this._showTools}async _getTranslations(){const i=await o(this.el);this._translations=i[0]}get el(){return e(this)}static get watchers(){return{mapView:["mapViewWatchHandler"],_showBasemapWidget:["_showBasemapWidgetWatchHandler"],_showFloorFilter:["_showFloorFilterWatchHandler"],_showFullscreen:["_showFullscreenWatchHandler"],_showLegendWidget:["_showLegendWidgetWatchHandler"],_showSearchWidget:["_showSearchWidgetWatchHandler"]}}};u.style=":host{display:block}.display-none{display:none}.margin-top-1-2{margin-top:0.5rem}.square-32{width:32px;height:32px}.square-40{width:40px;height:40px}.square-48{width:48px;height:48px}.width-40{width:40px}.square-40-41{width:40px;height:41px}.border-bottom{border-bottom:1px solid var(--calcite-color-border-3)}.box-shadow{box-shadow:0 1px 2px rgba(0, 0, 0, 0.3)}.margin-bottom-1-2{margin-bottom:0.5rem}";export{n as basemap_gallery,r as floor_filter,l as map_fullscreen,c as map_legend,d as map_picker,p as map_search,u as map_tools}
|
@@ -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-7d280d8a.js";import{g as o,l}from"./p-b04c9dc3.js";import{q as a,g as n,c as d,e as r,f as c,i as v}from"./p-c897e3eb.js";import{d as p}from"./p-d9995b7e.js";import"./p-d918ec36.js";import"./p-e1a4994d.js";import"./p-c1cf3ebc.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 n(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._ctrlIsPressed=!1,this._defaultFilterHonored=!1,this._defaultGlobalIdHonored=!1,this._defaultOidHonored=!1,this._observerSet=!1,this._shiftIsPressed=!1,this._skipOnChange=!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.selectedIds=[],this.shareIncludeEmbed=void 0,this.shareIncludeSocial=void 0,this.showNewestFirst=void 0,this.zoomAndScrollToSelected=void 0,this._allIds=[],this._controlsThatFit=void 0,this._csvExporting=!1,this._fetchingData=!1,this._filterActive=!1,this._filterOpen=!1,this._layer=void 0,this._selectAllActive=!1,this._showHideOpen=!1,this._showOnlySelected=!1,this._toolInfos=void 0,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)}enableShareWatchHandler(){this._toolbar&&this._updateToolbar()}_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(){this._initToolInfos(),this._updateToolbar()}async mapViewWatchHandler(){this._mapClickHandle&&this._mapClickHandle.remove(),this.mapView&&(this._floorExpression=void 0,this._updateShareUrl(),this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",(i=>{this._mapClicked(i)})))}async _layerWatchHandler(){var i;this._fetchingData=!0,await(null===(i=this._layer)||void 0===i?void 0:i.when((async()=>{var i;this._definitionExpression=this._layer.definitionExpression,this._floorField=null===(i=this._layer.floorInfo)||void 0===i?void 0:i.floorField,this._updateFloorDefinitionExpression(),await this._resetTable(),this._updateShareUrl(),this._initLayerExpressions(),this._fetchingData=!1})))}async selectedIdsWatchHandler(){this._updateShareUrl(),this._validateEnabledActions(),this._selectAllActive&&this.selectedIds.length!==this._allIds.length&&(this._selectAllActive=!1)}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 d([s],h,this.mapView,!0)}}async editsComplete(i){const t=i.detail;"delete"!==t&&"add"!==t||(this._allIds=await r(this._layer)),await this._refresh()}async facilityChanged(i){this._floorFacility=i.detail,this._updateFloorDefinitionExpression()}async levelChanged(i){this._floorLevel=i.detail,this._updateFloorDefinitionExpression()}async siteChanged(i){this._floorSite=i.detail,this._updateFloorDefinitionExpression()}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.selectedIds.length.toString(),l=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 ${l}`},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._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,s]=await l(["esri/widgets/FeatureTable","esri/core/reactiveUtils","esri/widgets/FeatureTable/support/TableTemplate"]);this.FeatureTable=i,this.reactiveUtils=t,this.TableTemplate=s}_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(){const i=this._getActionItems();return null==i?void 0:i.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,s.loading,"trigger"),this._showHideOpen?this._getFieldlist():void 0):this._getAction(s.active,s.icon,s.indicator,s.label,s.func,s.disabled,s.loading)),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:void 0,icon:"trash",indicator:void 0,label:void 0,func:void 0,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,loading:this._csvExporting,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)}_updateFloorDefinitionExpression(){if(this._floorField&&this._floorLevel){const i=`${this._floorField} = '${this._floorLevel}'`,t=this._layer.definitionExpression;this._layer.definitionExpression=(null==t?void 0:t.indexOf(this._floorExpression))>-1?t.replace(this._floorExpression,i):t?`${t} AND (${i})`:i,this._floorExpression=i}}_featuresSelected(){return this.selectedIds.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._toolbar&&this._toolInfos&&(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,l)=>(!h&&s.indexOf(l.id)<0&&(e.indexOf(l.id)>-1||t+l.width<=i)?(e.indexOf(l.id)<0&&(t+=l.width),o.push(l)):s.indexOf(l.id)<0&&t+l.width>i&&(h=!0),o)),[]);this._setControlsThatFit(o,s)}}),250))}_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",{disabled:i.loading,iconStart:i.isSublist&&this._showHideOpen?"chevron-down":i.loading?"":i.icon,id:"solutions-subset-list",onClick:i.func},i.loading?t("div",{class:"display-flex"},t("calcite-loader",{inline:!0,label:i.label,scale:"m"}),i.label):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,l,a,n){const d=void 0===this._layer||l;return t("div",{class:"display-flex",id:this._getId(s),slot:n},t("calcite-action",{active:i,appearance:"solid",disabled:d,icon:s,id:s,indicator:e,label:h,loading:a,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.selectedIds)||void 0===e?void 0:e.length)>0?o.searchParams.set("oid",this.selectedIds.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}_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)},"trash"===i?t("delete-button",{buttonType:"action",class:"display-flex",disabled:o,icon:i,ids:this._getIds(),layer:this._layer}):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))}_getIds(){return this._table.highlightIds.toArray()}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)}))})))}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.selectedIds=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 c(this._layer,this._layer.definitionExpression,i);let e=!1;const h=this._table.viewModel.getObjectIdIndex(this._previousCurrentId),o=this._table.viewModel.getObjectIdIndex(this._currentId),l=h<o?h:o,a=o>h?o:h;this._skipOnChange=l+1!==a;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.selectedIds.indexOf(s)>-1||h>=l&&h<=a)&&i.indexOf(s)<0&&h>-1&&i.push(s),i}),[]);this.selectedIds=h<o?n.reverse():n,this._table.highlightIds.addMany(this.selectedIds.filter((i=>t.indexOf(i)<0)))}}else if(this.selectedIds.length>0){this._skipOnChange=!0;const s=this.selectedIds.length>1&&1===i.removed.length?i.removed:t.filter((i=>this.selectedIds.indexOf(i)<0));this._clearSelection(),this.selectedIds=[...s],s.length>0?this._table.highlightIds.add(s[0]):this._skipOnChange=!1}else this.selectedIds=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.selectedIds)}_resetColumnTemplates(){var i,t;const s=this._getColumnTemplates(null===(i=this._layer)||void 0===i?void 0:i.id,null===(t=this._layer)||void 0===t?void 0:t.fields);if(this._table&&s){this._table.tableTemplate=new this.TableTemplate({columnTemplates:s});const i=s.map((i=>i.fieldName));this._initColumnsInfo(i)}}async _resetTable(){var i;this._clearSelection(),this._allIds=[],this.featureSelectionChange.emit(this.selectedIds);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||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,await this.reactiveUtils.once((()=>"loaded"===this._table.state)).then((async()=>{var i,t;if(this._table.highlightIds.removeAll(),this._table.clearSelectionFilter(),this._resetColumnTemplates(),!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 v(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,await this._sortTable(),this._initToolInfos(),this._updateToolbar()}))}_initColumnsInfo(i){var t,s;const e=null===(t=this._table)||void 0===t?void 0:t.columns.reduce(((t,s)=>((!i||(null==i?void 0:i.indexOf(s.name))>-1)&&(t[s.name]=!s.hidden),t)),{}),h=null===(s=this._table)||void 0===s?void 0:s.columns.map((i=>i.name));(i?i.filter((i=>h.indexOf(i)<0)):[]).forEach((i=>{e[i]=!0})),this._columnsInfo=i?i.reduce(((i,t)=>(i[t]=e[t],i)),{}):e}_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.showNewestFirst&&(await this._table.when(),await this._layer.when((()=>{this._table.sortColumn(this._layer.objectIdField,"desc")})))}_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:()=>{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:!1,closeBtn:!0,closeBtnOnClick:async()=>this._closeFilter(),comboboxOverlayPositioning:"fixed",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(){const i=this._layer.definitionExpression;if(this._floorExpression){const t=new RegExp(`${this._floorField} = ['].+[']`,"gm");this._layer.definitionExpression=i&&this._floorField&&i.indexOf(`${this._floorField} = '`)>-1?i.replace(t,this._floorExpression):i?`${i} AND (${this._floorExpression})`:this._floorExpression}this._filterActive=this._definitionExpression!==this._layer.definitionExpression&&(!this._floorExpression||this._layer.definitionExpression!==this._floorExpression),this._updateShareUrl()}async _closeFilter(){this._filterOpen&&(this._allIds=await r(this._layer),this._filterOpen=!1)}async _mapClicked(i){const t={include:this._layer},s=await this.mapView.hitTest(i.screenPoint,t);s.results.length>0?(s.results.forEach((i=>{const t=i.graphic.getObjectId();this._table.highlightIds.indexOf(t)<0&&this._table.highlightIds.add(t)})),this._showOnlySelected&&this._table.filterBySelection()):this._clearSelection()}_selectAll(){const i=this._allIds;this._table.highlightIds.removeAll(),this._skipOnChange=!0,this._table.highlightIds.addMany(i),this.selectedIds=i,this._finishOnChange(),this._selectAllActive=!0}_toggleShowSelected(){this._showOnlySelected=!this._showOnlySelected,this._showOnlySelected?this._table.filterBySelection():this._table.clearSelectionFilter()}_clearSelection(){var i;this.selectedIds=[],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=>{var t;return i.id===(null===(t=this._layer)||void 0===t?void 0:t.id)})):[],this._filterList.layerExpressions=this._layerExpressions,this._filterActive=this._layerExpressions.filter((i=>(console.log(i),i.expressions.filter((i=>i.active)).length>0))).length>0}_switchSelected(){const i=[...this.selectedIds];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.selectedIds=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)),[]);this._updateToolInfoLoading("export",!0),this._csvExporting=!0,await p(null,i,!1,!1,!0,s,!0,!0),this._updateToolInfoLoading("export",!1),this._csvExporting=!1}_updateToolInfoLoading(i,t){this._toolInfos.some((s=>{if((null==s?void 0:s.icon)===i)return s.loading=t,!0}))}async _refresh(){await this._table.refresh(),this.featureSelectionChange.emit(this.selectedIds)}_zoom(){this._table.zoomToSelection()}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 n(this.mapView,s);await i.when((()=>{this._layer=i}))}this._fetchingData=!1}_getColumnTemplates(i,t){var s,e;let h;null===(e=null===(s=this.mapInfo)||void 0===s?void 0:s.layerOptions)||void 0===e||e.layers.some((t=>{if(t.id===i)return h=t,!0}));const o=(null==h?void 0:h.fields)&&(null==h?void 0:h.fieldOrder)?h.fieldOrder.filter((i=>h.fields.indexOf(i)>-1)):void 0;let l;return t&&(l=h&&(null==h?void 0:h.fields)?t.reduce(((i,t)=>{if(h.fields.indexOf(t.name)>-1){const s={type:"field",fieldName:t.name,label:t.alias,menuConfig:this._getMenuConfig(t.name)};i.push(s)}return i}),[]).sort(this._sortFields.bind(this,null==h?void 0:h.fieldOrder)):t.map((i=>({type:"field",fieldName:i.name,label:i.alias,menuConfig:this._getMenuConfig(i.name)})))),o?null==l?void 0:l.sort(this._sortFields.bind(this,o)):l}_sortFields(i,t,s){return(null==i?void 0:i.indexOf(t.fieldName))-i.indexOf(s.fieldName)}_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"],enableShare:["enableShareWatchHandler"],_controlsThatFit:["_controlsThatFitWatchHandler"],isMobile:["isMobileWatchHandler"],mapInfo:["mapInfoWatchHandler"],mapView:["mapViewWatchHandler"],_layer:["_layerWatchHandler"],selectedIds:["selectedIdsWatchHandler"]}}};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-1":"",o="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light",l=(null===(i=this.mapInfos)||void 0===i?void 0:i.length)>1?"":"display-none",a=(null===(e=this.mapInfos)||void 0===e?void 0:e.length)>1?"map-height":"height-full";return t(s,null,t("map-picker",{class:l,mapInfos:this.mapInfos,ref:i=>this._mapPicker=i}),t("div",{class:`${a} ${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 l(["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,l=s&&(null==i?void 0:i.id)===this.defaultWebmapId;if(this._loadedId!==o&&!s||l){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=!!l||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-1{visibility:hidden;height:1px;}.display-none{display:none}";export{u as card_manager,b as layer_table,m as map_card}
|