@esri/solutions-components 0.8.29 → 0.8.30

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,7 +57,14 @@ export declare class FloorFilter {
57
57
  * esri/core/Accessor: https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Accessor.html#WatchHandle
58
58
  */
59
59
  protected _siteHandle: __esri.WatchHandle;
60
+ /**
61
+ * Watch for changes to the mapView and re-init the floor filter
62
+ */
60
63
  mapViewWatchHandler(): Promise<void>;
64
+ /**
65
+ * Watch for changes to the enabled property and re-init or destroy the floor filter
66
+ */
67
+ enabledWatchHandler(): Promise<void>;
61
68
  /**
62
69
  * Emitted on demand when the Facility is changed
63
70
  */
@@ -74,6 +81,9 @@ export declare class FloorFilter {
74
81
  * StencilJS: Called once just after the component is first connected to the DOM.
75
82
  */
76
83
  componentWillLoad(): Promise<void>;
84
+ /**
85
+ * Renders the component.
86
+ */
77
87
  render(): any;
78
88
  /**
79
89
  * Load esri javascript api modules
@@ -83,8 +93,20 @@ export declare class FloorFilter {
83
93
  * @protected
84
94
  */
85
95
  protected _initModules(): Promise<void>;
96
+ /**
97
+ * Destroy the widget and remove the containing element if it exists
98
+ *
99
+ * @protected
100
+ */
101
+ protected _destroyWidget(): void;
102
+ /**
103
+ * Destroy the widget and remove the containing element then re-create the container element
104
+ *
105
+ * @protected
106
+ */
107
+ protected _initContainer(): void;
86
108
  /**
87
109
  * Initialize the floor filter or reset the current view if it already exists
88
110
  */
89
- protected _initFloorFilter(view: __esri.MapView, webMap: __esri.WebMap): void;
111
+ protected _initFloorFilter(view: __esri.MapView): Promise<void>;
90
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solutions-components",
3
- "version": "0.8.29",
3
+ "version": "0.8.30",
4
4
  "description": "Web Components for Esri's Solutions Applications",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -1,6 +0,0 @@
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 t,h as i,H as s,g as e,c as a}from"./p-6d753a3d.js";import{l as h,g as o}from"./p-896c9644.js";import"./p-82e085d0.js";const n=class{constructor(i){t(this,i),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 i(s,{key:"7fe5ef48d77de087f17498e2e1f3370a069e8629"},i("div",{key:"aca555c687352046a138343cab6f656234069644",ref:t=>{this._basemapElement=t}}))}async componentDidLoad(){this.mapView&&await this.mapViewWatchHandler()}async _initModules(){const[t,i]=await h(["esri/widgets/BasemapGallery","esri/widgets/BasemapGallery/support/PortalBasemapsSource"]);this.BasemapGallery=t,this.PortalBasemapsSource=i}async _initBaseMapGallery(t){var i;if(this.BasemapGallery){this.basemapWidget&&this.basemapWidget.destroy();const s=new this.PortalBasemapsSource({query:(null===(i=this.basemapConfig)||void 0===i?void 0:i.basemapGroupId)?`id:${this.basemapConfig.basemapGroupId}`:null,filterFunction:this.basemapConfig?t=>!this.basemapConfig.basemapIdsToFilter.includes(t.portalItem.id):()=>!0});await s.refresh(),this.basemapWidget=new this.BasemapGallery({container:this._basemapElement,view:t,source:s})}}get el(){return e(this)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};n.style=":host{display:block}";const c=class{constructor(i){t(this,i),this.facilityChanged=a(this,"facilityChanged",7),this.levelChanged=a(this,"levelChanged",7),this.siteChanged=a(this,"siteChanged",7),this.enabled=void 0,this.floorFilterWidget=void 0,this.mapView=void 0}async mapViewWatchHandler(){console.log("mapViewWatchHandler FF");const t=this.mapView.map;await t.when((()=>{console.log("webMap.when FF"),this.floorFilterWidget&&(this.floorFilterWidget.destroy(),this.floorFilterWidget=void 0,console.log("floorFilterWidget destroyed")),this._floorFilterElement&&(this._floorFilterElement.remove(),this._floorFilterElement=document.createElement("div"),console.log("this._floorFilterElement created")),this._initFloorFilter(this.mapView,t)}))}async componentWillLoad(){return this._initModules()}render(){return i(s,{key:"df3c419f3eaf30590c44c4919f0eeddfc333b81d"},i("div",{key:"8496099f3bc35f34db6e47f73870ead9144df0a4",ref:t=>{this._floorFilterElement=t}}))}async _initModules(){const[t,i]=await h(["esri/widgets/FloorFilter","esri/core/reactiveUtils"]);this.FloorFilter=t,this.reactiveUtils=i}_initFloorFilter(t,i){var s,e,a;console.log("_initFloorFilter"),console.log(`view: ${t}`),console.log(`this.enabled: ${this.enabled}`),console.log(`this.FloorFilter: ${this.FloorFilter}`),console.log(`webMap?.floorInfo: ${null==i?void 0:i.floorInfo}`),t&&this.enabled&&this.FloorFilter&&(null==i?void 0:i.floorInfo)&&(this.floorFilterWidget=new this.FloorFilter({container:this._floorFilterElement,view:t}),null===(s=this._facilityHandle)||void 0===s||s.remove(),this._facilityHandle=this.reactiveUtils.watch((()=>this.floorFilterWidget.facility),(t=>{this.facilityChanged.emit(t)})),null===(e=this._levelHandle)||void 0===e||e.remove(),this._levelHandle=this.reactiveUtils.watch((()=>this.floorFilterWidget.level),(t=>{this.levelChanged.emit(t)})),null===(a=this._siteHandle)||void 0===a||a.remove(),this._siteHandle=this.reactiveUtils.watch((()=>this.floorFilterWidget.site),(t=>{this.siteChanged.emit(t)})))}get el(){return e(this)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};c.style=":host{display:block}";const r=class{constructor(i){t(this,i),this.fullscreenStateChange=a(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 i(s,{key:"943217d26f3cf5861c165c3300ba24736ce8f7dc"},i("div",{key:"6c76ebf6e63dab19f24d776cd27cd86b74ea93d0",class:"fullscreen-widget",ref:t=>{this._fullscreenElement=t}}))}async componentDidUpdate(){await this._initFullscreenWidget()}async componentDidLoad(){await this._initFullscreenWidget()}async _initModules(){const[t,i]=await h(["esri/widgets/Fullscreen","esri/core/reactiveUtils"]);this.Fullscreen=t,this.reactiveUtils=i}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),(t=>this.fullscreenStateChange.emit(t)))}))):this.fullscreenWidget&&(this.fullscreenWidget.view=this.mapView)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};r.style=":host{display:block}";const l=class{constructor(i){t(this,i),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 i(s,{key:"bdd3b848bec1aec6f8c7676f8bab5e9463b16064"},i("div",{key:"d7bb217db6971758ef8774d19d6ac5cfa94a0ddc",ref:t=>{this._legendElement=t}}))}async componentDidLoad(){this.mapView&&await this.mapViewWatchHandler()}async _initModules(){const[t]=await h(["esri/widgets/Legend"]);this.Legend=t}_initLegend(t){t&&this.Legend&&(this.legendWidget?this.legendWidget.view=t:this.legendWidget=new this.Legend({container:this._legendElement,view:t}))}get el(){return e(this)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};l.style=":host{display:block}";const d=class{constructor(i){t(this,i),this.mapInfoChange=a(this,"mapInfoChange",7),this._loadedId="",this.mapInfos=[],this._mapListExpanded=!1,this._translations=void 0,this._webMapInfo=void 0}_webMapInfoWatchHandler(t,i){t&&JSON.stringify(t)!==JSON.stringify(i)&&(this._loadedId=null==t?void 0:t.id,this.mapInfoChange.emit(t))}async mapInfosWatchHandler(t,i){t&&JSON.stringify(t)!==JSON.stringify(i)&&this._webMapSelected(t[0])}async setMapByID(t){var i;const s=null===(i=this.mapInfos)||void 0===i?void 0:i.filter((i=>i.id===t));t&&(null==s?void 0:s.length)>0&&this._webMapSelected(s[0])}async componentWillLoad(){await this._getTranslations()}render(){return i(s,{key:"86994e2c4d87809c1508b073c3af1c0975c2d81d"},this._getToolbar(),this._getMapNameList(this._mapListExpanded))}async componentDidLoad(){const t=this.mapInfos&&this.mapInfos.length>0?this.mapInfos[0]:void 0;t&&this._webMapSelected(t)}_getMapPicker(){var t;const s="map-picker-expand-toggle";return i("div",{class:"width-full"},i("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===(t=this._webMapInfo)||void 0===t?void 0:t.name),i("calcite-tooltip",{label:"",placement:"bottom","reference-element":s},i("span",null,this._translations.switchMap)))}_getToolbar(){return i("div",{class:"display-flex"},i("calcite-action-bar",{class:"border-bottom-1 action-bar-size","expand-disabled":!0,layout:"horizontal",slot:"header"},this._getMapPicker()))}_getMapNameList(t){return i("div",{class:t?"map-list border-bottom-1":"display-none"},i("calcite-list",{id:"mapList",ref:t=>this._list=t,selectionAppearance:"border",selectionMode:"single"},this.mapInfos.map((t=>i("calcite-list-item",{label:t.name,onClick:()=>this._webMapSelected(t),selected:t.id===this._loadedId,value:t.id})))))}_webMapSelected(t){this._mapListExpanded=!1,this._webMapInfo=t}_chooseMap(){this._mapListExpanded=!this._mapListExpanded}async _getTranslations(){const t=await o(this.el);this._translations=t[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(i){t(this,i),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 i(s,{key:"5036a89c6a686b2486ff88dffd06f0bed1ea510e"},i("div",{key:"4c5ede4d9877ff0ca0f16706c99aba354df21fd1",class:"search-widget",ref:t=>{this._searchElement=t}}))}async _initModules(){const[t,i]=await h(["esri/widgets/Search","esri/layers/FeatureLayer"]);this.Search=t,this.FeatureLayer=i}_initSearchWidget(){if(this.mapView&&this._searchElement&&!this.searchWidget){let t={view:this.mapView,container:this._searchElement,searchTerm:this.searchTerm};if(this.searchConfiguration){const i=this._getSearchConfig(this.searchConfiguration,this.mapView);t=Object.assign({},i)}this.searchWidget=new this.Search(t),this.searchWidget.popupEnabled=this.popupEnabled,this.searchWidget.resultGraphicEnabled=this.resultGraphicEnabled}else this.searchWidget&&(this.searchWidget.view=this.mapView)}_getSearchConfig(t,i){const s=t.sources;return(null==s?void 0:s.length)>0?(t.includeDefaultSources=!1,s.forEach((t=>{var s,e;if(t.hasOwnProperty("layer")){const a=t,h=null===(s=a.layer)||void 0===s?void 0:s.id,o=h?i.map.findLayerById(h):null,n=null===(e=null==a?void 0:a.layer)||void 0===e?void 0:e.url;o?a.layer=o:n&&(a.layer=new this.FeatureLayer(n))}})),null==s||s.forEach((t=>{if(t.hasOwnProperty("locator")){const i=t;"ArcGIS World Geocoding Service"===(null==i?void 0:i.name)&&(i.outFields=i.outFields||["Addr_type","Match_addr","StAddr","City"],i.singleLineFieldName="SingleLine"),i.url=i.url,delete i.url}}))):t=Object.assign(Object.assign({},t),{includeDefaultSources:!0}),t}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(i){t(this,i),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 t,i;this._hasFloorInfo=null===(i=null===(t=this.mapView)||void 0===t?void 0:t.map)||void 0===i?void 0:i.floorInfo}))}async _showBasemapWidgetWatchHandler(t){t?this.mapView.ui.add(this._basemapElement.basemapWidget,{position:this.position,index:1}):this.mapView.ui.remove(this._basemapElement.basemapWidget)}async _showFloorFilterWatchHandler(t){const i=this._floorFilterElement.floorFilterWidget;t?this.mapView.ui.add(i,{position:this.position,index:1}):this.mapView.ui.remove(i)}async _showFullscreenWatchHandler(t){const i=this._fullscreenElement.fullscreenWidget;t?"ready"===i.viewModel.state&&i.viewModel.enter():"active"===i.viewModel.state&&i.viewModel.exit()}async _showLegendWidgetWatchHandler(t){t?this.mapView.ui.add(this._legendElement.legendWidget,{position:this.position,index:1}):this.mapView.ui.remove(this._legendElement.legendWidget)}async _showSearchWidgetWatchHandler(t){t?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 t=this._showTools?"":"display-none",e=this._showSearchWidget?"":"display-none",a=this._showBasemapWidget?"":"display-none",h=this._showLegendWidget?"":"display-none",o=this._showFloorFilter?"":"display-none",n=this._showFullscreen?"":"display-none",c=this.enableSingleExpand?"margin-top-1-2":"",r=this.toolOrder?this.toolOrder:["legend","search","fullscreen","floorfilter"],l=this.stackTools?"box-shadow":"";return i(s,{key:"a1557491ffd833bed11843dbe1bd040a9d2d6b15"},i("div",{key:"8866b3bc6e05fa75605b078e1a3deecaf6392024",class:this.enableBasemap||this.enableFullscreen||this.enableLegend||this.enableSearch?"":"display-none"},this.enableSingleExpand?i("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,i("div",{key:"6a4e62ad1afcca39365aa965ffabedf8933051d4",class:`${c} ${l} ${t}`},this._getMapWidgets(r))),i("basemap-gallery",{key:"4edade9536c0912a89f6a9335ae05ae46669e14d",basemapConfig:this.basemapConfig,class:a,mapView:this.mapView,ref:t=>{this._basemapElement=t}}),i("map-search",{key:"046d02c1927def025294645c6e855906fabd30aa",class:e,mapView:this.mapView,ref:t=>{this._searchElement=t},resultGraphicEnabled:!0,searchConfiguration:this.searchConfiguration}),i("map-legend",{key:"54575e31073bdc68b611939eb0e619e4479b26f3",class:h,mapView:this.mapView,ref:t=>{this._legendElement=t}}),i("map-fullscreen",{key:"9a54a22e12c372dd85717f83cf31b4ace80489eb",class:n,mapView:this.mapView,onFullscreenStateChange:t=>this._fullscreenStateChange(t.detail),ref:t=>{this._fullscreenElement=t}}),i("floor-filter",{key:"ffadf501a03186ed6f2fec8754cd758faea5b4dd",class:o,enabled:this.enableFloorFilter,mapView:this.mapView,ref:t=>{this._floorFilterElement=t}}))}async _initModules(){const[t]=await h(["esri/widgets/Expand"]);this.Expand=t}_setZoomToolsSize(){var t,i;const s=null===(t=document.getElementsByClassName("esri-zoom")[0])||void 0===t?void 0:t.children[0],e=null===(i=document.getElementsByClassName("esri-zoom")[0])||void 0===i?void 0:i.children[1];if(s&&e){const t="s"===this.homeZoomToolsSize?"32px":"m"===this.homeZoomToolsSize?"40px":"48px";s.style.width=t,s.style.height=t,e.style.width=t,e.style.height=t}}_getMapWidgets(t){const i=this._showFullscreen?"full-screen-exit":"full-screen",s=this._showFullscreen?this._translations.exitFullscreen:this._translations.enterFullscreen;return t.map((t=>{var e,a,h,o,n;switch(t){case"legend":return this.enableLegend&&this.enableSingleExpand?this._getActionGroup("legend",!1,this._translations.legend,(()=>this._showLegend())):this.enableLegend?this._getWidget(t,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(t,null===(a=this._searchElement)||void 0===a?void 0:a.searchWidget,!0):void 0;case"fullscreen":return this.enableFullscreen&&this.enableSingleExpand?this._getActionGroup(i,!1,s,(()=>this._expand())):this.enableFullscreen?this._getWidget(t,null===(h=this._fullscreenElement)||void 0===h?void 0:h.fullscreenWidget,!1):void 0;case"basemap":return this.enableBasemap&&this.enableSingleExpand?this._getActionGroup("basemap",!1,this._translations.basemap,(()=>this._toggleBasemapPicker())):this.enableBasemap?this._getWidget(t,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(t,null===(n=this._floorFilterElement)||void 0===n?void 0:n.floorFilterWidget,!0):void 0}}))}_fullscreenStateChange(t){"ready"===t&&this._showFullscreen?this._showFullscreen=!1:"active"!==t||this._showFullscreen||(this._showFullscreen=!0)}_getActionGroup(t,s,e,a){return i("div",null,i("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:t,id:t,onClick:a,scale:"s",text:""},i("calcite-icon",{icon:"cheveron-up",scale:"s",slot:"icon"})),i("calcite-tooltip",{label:"",placement:"trailing","reference-element":t},i("span",null,e)))}_getWidget(t,i,s){if(this._widgets.indexOf(t)<0&&this.mapView&&i){const e=this.toolOrder.indexOf(t),a=new this.Expand({view:this.mapView,content:i});this.mapView.ui.add(s?a:i,{position:this.position,index:e>-1?e+(this.enableHome?2:1):1}),this._widgets.push(t)}}_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 t=await o(this.el);this._translations=t[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,c as floor_filter,r as map_fullscreen,l as map_legend,d as map_picker,p as map_search,u as map_tools}