@esri/solutions-components 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/card-manager_3.cjs.entry.js +3 -1
- package/dist/cjs/crowdsource-manager.cjs.entry.js +3 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +37 -1
- package/dist/collection/components/layer-table/layer-table.js +37 -1
- package/dist/components/crowdsource-manager.js +5 -1
- package/dist/components/layer-table2.js +5 -1
- package/dist/esm/card-manager_3.entry.js +3 -1
- package/dist/esm/crowdsource-manager.entry.js +3 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/p-3c3b48c7.entry.js +6 -0
- package/dist/solutions-components/p-7e9449c5.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +8 -0
- package/dist/types/components/layer-table/layer-table.d.ts +8 -0
- package/dist/types/components.d.ts +32 -0
- package/package.json +1 -1
- package/dist/solutions-components/p-a4a0c7c5.entry.js +0 -6
- package/dist/solutions-components/p-b070bd54.entry.js +0 -6
@@ -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 t,h as i,H as s,g as e,c as h}from"./p-78780f63.js";import{g as a}from"./p-6b943f52.js";import{q as o,a as l,g as n,b as d,c as r}from"./p-b7e2c75b.js";import{l as c}from"./p-48ff9cea.js";import{d as p}from"./p-d6050d57.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(i){t(this,i),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(t){const i=t.detail;this._cardLoading=!0;const s=i.length>0?await o(i,this.layer,[],!1,this.mapView.spatialReference):[];this._graphics=s.sort(((t,s)=>i.indexOf(t.getObjectId())-i.indexOf(s.getObjectId()))),this._cardLoading=!1}async layerSelectionChange(t){const i=t.detail[0];this.layer=await l(this.mapView,i)}async componentWillLoad(){await this._getTranslations()}render(){var t,e;const h=(null===(t=this._graphics)||void 0===t?void 0:t.length)>0?"":"display-none",a=(null===(e=this._graphics)||void 0===e?void 0:e.length)>0?"display-none":"";return i(s,null,i("div",{class:"overflow-auto height-full"},i("calcite-shell",{class:"position-relative "+h},i("div",null,i("info-card",{graphics:this._graphics,isLoading:this._cardLoading,mapView:this.mapView,zoomAndScrollToSelected:this.zoomAndScrollToSelected}))),i("calcite-shell",{class:"position-relative "+a},i("div",{class:"padding-1"},i("calcite-notice",{icon:"table",open:!0},i("div",{slot:"message"},this._translations.selectFeaturesToStart))))))}async _getTranslations(){const t=await a(this.el);this._translations=t[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 v=class{constructor(i){t(this,i),this.featureSelectionChange=h(this,"featureSelectionChange",7),this.openFilterOptions=h(this,"openFilterOptions",7),this._allIds=[],this._defaultGlobalIdHonored=!1,this._defaultOidHonored=!1,this._tableSorting=!1,this.onTableNodeCreate=t=>{this._tableNode=t},this.defaultLayerId=void 0,this.defaultGlobalId=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.enableZoom=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._isDeleting=!1,this._layer=void 0,this._selectedIndexes=[],this._showHideOpen=!1,this._showOnlySelected=!1,this._sortActive=!1,this._translations=void 0}enableZoomWatchHandler(){var t;(null===(t=this._toolInfos)||void 0===t?void 0:t.length)>0&&this._initToolInfos()}enableCSVWatchHandler(){var t;(null===(t=this._toolInfos)||void 0===t?void 0:t.length)>0&&this._initToolInfos()}enableInlineEditWatchHandler(){this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit)}_controlsThatFitWatchHandler(){const t=this._controlsThatFit?this._controlsThatFit.reduce(((t,i)=>(t.push(i.id),t)),[]):[];this._toolInfos=this._toolInfos.map((i=>{if(i&&this._controlsThatFit){const s=this._getId(i.icon);return i.isOverflow=t.indexOf(s)<0,i}}))}async mapViewWatchHandler(){this._mapClickHandle&&this._mapClickHandle.remove(),this.mapView&&(this._updateShareUrl(),this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",(t=>{this._mapClicked(t)})))}async _layerWatchHandler(){this._fetchingData=!0,await this._resetTable(),this._updateShareUrl(),this._fetchingData=!1}async _selectedIndexesWatchHandler(){this._updateShareUrl(),this._validateEnabledActions()}async _sortActiveWatchHandler(){this._sortActive||await this._sortTable()}async selectionChanged(t){if(this.zoomAndScrollToSelected){const i=t.detail,s=i.getObjectId(),e=this._table.viewModel.getObjectIdIndex(s);this._table.scrollToIndex(e);const h=i.layer;let a;this.mapView.allLayerViews.toArray().some((t=>{if(t.layer.title===h.title&&"feature"===t.layer.type)return a=t,!0})),a&&await n([s],a,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=new ResizeObserver((()=>this._onResize()))}render(){const t=this._fetchingData?"display-none":"",e=this._fetchingData?"":"display-none",h=this._allIds.length.toString(),a=this._selectedIndexes.length.toString();return i(s,null,i("calcite-shell",null,this._getTableControlRow("header"),i("div",{class:"height-full-adjusted width-full"},i("calcite-panel",{class:"height-full width-full"},i("calcite-loader",{class:e,label:this._translations.fetchingData,scale:"l"}),i("div",{class:t,ref:this.onTableNodeCreate})),i("div",{class:"bottom-left text-color height-19"},this._translations.recordsSelected.replace("{{total}}",h).replace("{{selected}}",a)))),this._deleteMessage())}async componentDidLoad(){this._resizeObserver.observe(this._toolbar),document.onclick=t=>this._handleDocumentClick(t)}componentDidRender(){this._updateToolbar()}async _initModules(){const[t,i]=await c(["esri/widgets/FeatureTable","esri/core/reactiveUtils"]);this.FeatureTable=t,this.reactiveUtils=i}_onResize(){this._updateToolbar()}_getTableControlRow(t){return i("div",{class:"display-flex border-bottom height-51",ref:t=>this._toolbar=t,slot:t},this._getActionBar(),this._getDropdown("more-table-options"),this.enableShare?this._getShare("share"):void 0)}_getActionBar(){return i("calcite-action-bar",{expandDisabled:!0,expanded:!0,id:this._getId("bar"),layout:"horizontal"},i("div",{class:"border-end",id:"solutions-map-layer-picker-container"},i("map-layer-picker",{appearance:"transparent",defaultLayerId:this.defaultLayerId,mapView:this.mapView,onLayerSelectionChange:t=>this._layerSelectionChanged(t),onlyShowUpdatableLayers:this.onlyShowUpdatableLayers,placeholderIcon:"layers",scale:"l",showTables:!0,type:"dropdown"})),this._getActions())}_getActions(){return this._getActionItems().reduce(((t,s)=>(s&&!s.isOverflow&&t.push(s.isDanger?this._getDangerAction(s.icon,s.label,s.func,s.disabled):s.isSublist?i("calcite-dropdown",{closeOnSelectDisabled:!0,id:this._getId(s.icon),onCalciteDropdownBeforeClose:()=>this._forceShowHide(),ref:t=>this._showHideDropdown=t},this._getAction(this._showHideOpen?"chevron-down":s.icon,s.label,s.func,s.disabled,"trigger"),this._showHideOpen?this._getFieldlist():void 0):this._getAction(s.icon,s.label,s.func,s.disabled)),t)),[])}_getFieldlist(){return this._columnsInfo?i("calcite-dropdown-group",{"selection-mode":"multiple"},Object.keys(this._columnsInfo).map((t=>i("calcite-dropdown-item",{id:t,onClick:t=>{const i=t.target;this._columnsInfo[i.id]=i.selected,i.selected?this._table.showColumn(i.id):this._table.hideColumn(i.id)},selected:this._columnsInfo[t]},t)))):void 0}_validateEnabledActions(){const t=this._featuresSelected(),i=["zoom-to-object","trash","erase","selected-items-filter"];this._toolInfos.forEach((s=>{s&&i.indexOf(s.icon)>-1&&(s.disabled=!t)}))}_initToolInfos(){var t;const i=this._featuresSelected(),s=this._featuresEmpty();this._toolInfos=[this.enableZoom?{icon:"zoom-to-object",label:this._translations.zoom,func:()=>this._zoom(),disabled:!i,isOverflow:!1}:void 0,(null===(t=this.mapInfo)||void 0===t?void 0:t.filters)?{icon:"filter",label:this._translations.filters,func:()=>this._filter(),disabled:!1,isOverflow:!1}:void 0,this._deleteEnabled?{icon:"trash",label:this._translations.delete,func:()=>this._delete(),disabled:!i,isDanger:!0,isOverflow:!1}:void 0,{icon:"erase",label:this._translations.clearSelection,func:()=>this._clearSelection(),disabled:!i,isOverflow:!1},{icon:"selected-items-filter",label:this._showOnlySelected?this._translations.showAll:this._translations.showSelected,func:()=>this._toggleShowSelected(),disabled:!i,isOverflow:!1},{icon:"list-check-all",func:()=>this._selectAll(),label:this._translations.selectAll,disabled:s,isOverflow:!1},{icon:"compare",func:()=>this._switchSelected(),label:this._translations.switchSelected,disabled:s,isOverflow:!1},{icon:"refresh",func:()=>this._refresh(),label:this._translations.refresh,disabled:!1,isOverflow:!1},this.enableCSV?{icon:"export",func:()=>{this._exportToCSV()},label:this._translations.exportCSV,disabled:s,isOverflow:!1}:void 0,{icon:this._showHideOpen?"chevron-down":"chevron-right",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}_updateToolbar(){this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((()=>{clearTimeout(this._timeout),this._setToolbarSizeInfos();const t=this._toolbar.offsetWidth;let i=this._toolbarSizeInfos.reduce(((t,i)=>t+i.width),0);const s=["solutions-more","solutions-map-layer-picker-container","solutions-action-share"];if(i>t){if(this._toolbarSizeInfos.length>0){const e=[...this._toolbarSizeInfos].reverse().reduce(((e,h)=>(s.indexOf(h.id)<0&&(i>t?i-=h.width:e.push(h)),e)),[]).reverse();this._setControlsThatFit(e,s)}}else if(this._defaultVisibleToolSizeInfos){const e=this._toolbarSizeInfos.reduce(((t,i)=>(t.push(i.id),t)),[]);let h=!1;const a=[...this._defaultVisibleToolSizeInfos].reduce(((a,o)=>(!h&&s.indexOf(o.id)<0&&(e.indexOf(o.id)>-1||i+o.width<=t)?(e.indexOf(o.id)<0&&(i+=o.width),a.push(o)):s.indexOf(o.id)<0&&i+o.width>t&&(h=!0),a)),[]);this._setControlsThatFit(a,s)}}),5)}_setControlsThatFit(t,i){let s=JSON.stringify(t)!==JSON.stringify(this._controlsThatFit);document.getElementById("solutions-action-bar").childNodes.forEach((t=>{i.indexOf(t.id)<0&&!s&&(s=this._controlsThatFit.map((t=>t.id)).indexOf(t.id)<0)})),s&&(this._controlsThatFit=[...t])}_setToolbarSizeInfos(){let t=!1;this._toolbarSizeInfos=[],this._toolbar.childNodes.forEach(((i,s)=>{0===s?i.childNodes.forEach((i=>{this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0)})):i.referenceElement||(this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0))})),t&&!this._defaultVisibleToolSizeInfos&&(this._defaultVisibleToolSizeInfos=[...this._toolbarSizeInfos])}_getActionItems(){return this._toolInfos.filter((t=>t&&!t.isOverflow))}_getDropdown(t){const s=this._getDropdownItems();return s.length>0?i("calcite-dropdown",{closeOnSelectDisabled:!0,disabled:void 0===this._layer,id:"solutions-more",onCalciteDropdownBeforeClose:()=>this._forceShowHide(),ref:t=>this._moreDropdown=t},i("calcite-action",{appearance:"solid",id:t,label:"",onClick:()=>this._closeShowHide(),slot:"trigger",text:""},i("calcite-button",{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral"},this._translations.more)),i("calcite-dropdown-group",{"selection-mode":"none"},s.map((t=>i("calcite-dropdown-group",{class:t.disabled?"disabled":"",selectionMode:t.disabled?"none":"single"},i("calcite-dropdown-item",{iconStart:t.isSublist&&this._showHideOpen?"chevron-down":t.icon,id:"solutions-subset-list",onClick:t.func},t.label))))),this._showHideOpen?this._getFieldlist():void 0):void 0}_getDropdownItems(){return this._toolInfos.filter((t=>t&&t.isOverflow))}_getAction(t,s,e,h,a){const o=void 0===this._layer||h;return i("div",{class:"display-flex",id:this._getId(t),slot:a},i("calcite-action",{appearance:"solid",disabled:o,icon:t,id:t,label:s,onClick:e,text:s,textEnabled:!0}),this._getToolTip("bottom",t,s))}_getShare(t){return i("div",{class:"share-action",id:this._getId(t)},i("instant-apps-social-share",{autoUpdateShareUrl:!1,class:"instant-app-share",embed:this.shareIncludeEmbed,popoverButtonIconScale:"s",ref:t=>this._shareNode=t,scale:"m",shareButtonColor:"neutral",socialMedia:this.shareIncludeSocial,view:this.mapView}),this._getToolTip("bottom",t,this._translations.share))}_updateShareUrl(){var t,i,s,e;const h=null===(t=this._shareNode)||void 0===t?void 0:t.shareUrl;if(!h)return;const a=new URL(h);(null===(i=this.mapInfo)||void 0===i?void 0:i.id)&&a.searchParams.set("webmap",this.mapInfo.id),(null===(s=this._layer)||void 0===s?void 0:s.id)&&a.searchParams.set("layer",this._layer.id),(null===(e=this._selectedIndexes)||void 0===e?void 0:e.length)>0&&a.searchParams.set("oid",this._selectedIndexes.join(",")),this._shareNode.shareUrl=a.href}_getToolTip(t,s,e){return i("calcite-tooltip",{placement:t,"reference-element":s},i("span",null,e))}_getId(t){return`solutions-action-${t}`}_getDangerAction(t,s,e,h){const a=void 0===this._layer||h;return i("div",{class:"display-flex",id:this._getId(t)},i("calcite-action",{appearance:"solid",disabled:a,id:t,onClick:e,text:""},i("calcite-button",{appearance:"transparent",iconStart:t,kind:"danger"},s)),this._getToolTip("bottom",t,s))}async _getTable(t,i){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:i},container:t})})),this._initColumnsInfo(),this._checkEditEnabled(),await this._table.when((()=>{this._table.highlightIds.on("change",(()=>{this._selectedIndexes=this._table.highlightIds.toArray().reverse(),this._showOnlySelected&&(this._featuresSelected()?this._table.filterBySelection():this._toggleShowSelected()),this.featureSelectionChange.emit(this._selectedIndexes)})),this.reactiveUtils.watch((()=>this._table.activeSortOrders),(t=>{var i,s,e,h;this._sortActive=!!this._layer&&(t.length>0&&"asc"===(null===(i=t[0])||void 0===i?void 0:i.direction)||"desc"===(null===(s=t[0])||void 0===s?void 0:s.direction)||null===(null===(e=t[0])||void 0===e?void 0:e.direction)&&(null===(h=t[0])||void 0===h?void 0:h.fieldName)===this._layer.objectIdField)}))})))}async _resetTable(){var t;this._clearSelection(),this._allIds=[],this.featureSelectionChange.emit(this._selectedIndexes);const i=this._getColumnTemplates(this._layer.id,null===(t=this._layer)||void 0===t?void 0:t.fields);this._allIds=await d(this._layer),this._table?i&&(this._table.tableTemplate.columnTemplates=i):await this._getTable(this._tableNode,i),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 t,i;if(this._table.highlightIds.removeAll(),this._table.clearSelectionFilter(),this._initColumnsInfo(),!this._defaultOidHonored&&(null===(t=this.defaultOid)||void 0===t?void 0:t.length)>0&&this.defaultOid[0]>-1&&(this._selectDefaultFeature(this.defaultOid),this._defaultOidHonored=!0),!this._defaultGlobalIdHonored&&(null===(i=this.defaultGlobalId)||void 0===i?void 0:i.length)>0){const t=await r(this.defaultGlobalId,this._layer),i=(null==t?void 0:t.length)>0?t.map((t=>t.getObjectId())):void 0;i&&this._selectDefaultFeature(i),this._defaultGlobalIdHonored=!0}})),this._showOnlySelected=!1,this._sortActive=!1,await this._sortTable()}_initColumnsInfo(){this._columnsInfo=this._table.columns.reduce(((t,i)=>(t[i.name]=!i.hidden,t)),{})}_selectDefaultFeature(t){t.length>0&&(this._table.highlightIds.addMany(t),this._table.when((()=>{const i=this._table.viewModel.getObjectIdIndex(t[0]);this._table.viewModel.scrollToIndex(i)})))}_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(t){var i;const s=null===(i=t.target)||void 0===i?void 0:i.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))}_deleteMessage(){return i("calcite-modal",{"aria-labelledby":"modal-title",kind:"danger",onCalciteModalClose:()=>this._deleteClosed(),open:this._confirmDelete},i("div",{class:"display-flex align-center",id:"modal-title",slot:"header"},this._translations.deleteFeature),i("div",{slot:"content"},this._translations.confirm),i("calcite-button",{appearance:"outline",kind:"danger",onClick:()=>this._deleteClosed(),slot:"secondary",width:"full"},this._translations.cancel),i("calcite-button",{kind:"danger",loading:this._isDeleting,onClick:()=>{this._deleteFeatures()},slot:"primary",width:"full"},this._translations.delete))}async _deleteFeatures(){this._isDeleting=!0;const t=this._table.highlightIds.toArray().map((t=>({objectId:t})));await this._layer.applyEdits({deleteFeatures:t}),await this._table.refresh(),this._allIds=await d(this._layer),this._isDeleting=!1,this._deleteClosed()}async _mapClicked(t){const i={include:this._layer},s=await this.mapView.hitTest(t.screenPoint,i);s.results.length>0&&(s.results.forEach((t=>{this._clearSelection();const i=t.graphic.getObjectId(),s=this._table.highlightIds.indexOf(i);s>-1?this._table.highlightIds.removeAt(s):this._table.highlightIds.add(i)})),this._showOnlySelected&&this._table.filterBySelection())}_deleteClosed(){this._confirmDelete=!1}_selectAll(){const t=this._allIds;this._table.highlightIds.removeAll(),this._table.highlightIds.addMany(t),this._selectedIndexes=t}_toggleShowSelected(){this._showOnlySelected=!this._showOnlySelected,this._showOnlySelected?this._table.filterBySelection():this._table.clearSelectionFilter()}_clearSelection(){var t;this._selectedIndexes=[],null===(t=this._table)||void 0===t||t.highlightIds.removeAll()}_filter(){this.openFilterOptions.emit()}_switchSelected(){const t=[...this._selectedIndexes];this._table.highlightIds.removeAll();const i=this._allIds.reduce(((i,s)=>(t.indexOf(s)<0&&i.push(s),i)),[]).sort(((t,i)=>t-i));this._table.highlightIds.addMany(i),this._selectedIndexes=i}async _exportToCSV(){const t={},i=this._table.highlightIds.toArray();t[this._layer.id]={selectionSetNames:[this._layer.title],ids:i,layer:this._layer},p(null,t,!1,!1,!0)}async _refresh(){await this._table.refresh(),this.featureSelectionChange.emit(this._selectedIndexes)}_zoom(){this._table.zoomToSelection()}_delete(){this._confirmDelete=!0}async _layerSelectionChanged(t){var i;const s=t.detail[0];if(s!==(null===(i=this._layer)||void 0===i?void 0:i.id)||this._featuresEmpty()){this._fetchingData=!0;const t=await l(this.mapView,s);await t.when((()=>{this._layer=t}))}this._fetchingData=!1}_getColumnTemplates(t,i){var s;let e;null===(s=this.mapInfo.layerInfos)||void 0===s||s.some((i=>{if(i.id===t)return e=i,!0}));let h=null==e?void 0:e.columnTemplates;return i&&(h=h?h.map((t=>(i.some((i=>{if(i.name===t.fieldName)return t.label=i.alias,!0})),t))):i.map((t=>({type:"field",fieldName:t.name,label:t.alias})))),h}async _getTranslations(){const t=await a(this.el);this._translations=t[0]}get el(){return e(this)}static get watchers(){return{enableZoom:["enableZoomWatchHandler"],enableCSV:["enableCSVWatchHandler"],enableInlineEdit:["enableInlineEditWatchHandler"],_controlsThatFit:["_controlsThatFitWatchHandler"],mapView:["mapViewWatchHandler"],_layer:["_layerWatchHandler"],_selectedIndexes:["_selectedIndexesWatchHandler"],_sortActive:["_sortActiveWatchHandler"]}}};v.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-ui-border-2)}.border-end{border-inline-end:1px solid var(--calcite-ui-border-2)}.border-bottom{border-bottom:1px solid var(--calcite-ui-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-ui-background)}.text-color{color:var(--calcite-ui-text-1)}.align-center{align-items:center}.danger-color{color:var(--calcite-ui-danger)}.esri-feature-table vaadin-grid{border:none !important}vaadin-grid-cell-content{padding:var(--lumo-space-xs) var(--lumo-space-m) !important;font-size:14px !important}.share-action{position:absolute;right:0;margin-top:4px;margin-inline-end:4px;margin-bottom:4px}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-ui-opacity-disabled);pointer-events:none}.instant-app-share{height:42px !important;display:inline-flex}';const b=class{constructor(i){t(this,i),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.enableSearch=void 0,this.enableBasemap=void 0,this.basemapConfig=void 0,this.hidden=void 0,this.mapInfos=[],this.mapView=void 0,this.theme=void 0,this._searchConfiguration=void 0,this._webMapInfo=void 0}enableHomeWatchHandler(){this._initHome()}async mapInfoChange(t){await this._loadMap(t.detail)}async componentWillLoad(){await this._initModules()}render(){const t=this.hidden?"visibility-hidden":"",e="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light";return i(s,null,i("map-picker",{mapInfos:this.mapInfos,ref:t=>this._mapPicker=t}),i("div",{class:`map-height ${t}`,ref:t=>this._mapDiv=t}),i("map-tools",{basemapConfig:this.basemapConfig,class:`box-shadow ${e}`,enableBasemap:this.enableBasemap,enableFloorFilter:this.enableFloorFilter,enableFullscreen:this.enableFullscreen,enableLegend:this.enableLegend,enableSearch:this.enableSearch,mapView:this.mapView,ref:t=>this._mapTools=t,searchConfiguration:this._searchConfiguration}))}async _initModules(){const[t,i,s]=await c(["esri/WebMap","esri/views/MapView","esri/widgets/Home"]);this.WebMap=t,this.MapView=i,this.Home=s}async _loadMap(t){var i;const s=!this._defaultWebmapHonored&&this.defaultWebmapId,e=null===(i=this.mapInfos)||void 0===i?void 0:i.filter((t=>t.id===this.defaultWebmapId));this._webMapInfo=s&&e?e[0]:!(null==t?void 0:t.id)&&this.mapInfos.length>0?this.mapInfos[0]:t;const h=this._webMapInfo.id,a=s&&(null==t?void 0:t.id)===this.defaultWebmapId;if(this._loadedId!==h&&!s||a){const t=new this.WebMap({portalItem:{id:h}});this.mapView=new this.MapView({container:this._mapDiv,map:t,resizeAlign:"center"}),this._loadedId=h,this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),await this.mapView.when((()=>{this._initHome(),this.mapView.ui.add(this._mapTools,{position:"top-right",index:0}),this._defaultWebmapHonored=!!a||this._defaultWebmapHonored,this.mapChanged.emit({id:h,mapView:this.mapView})}))}else s&&(this._defaultWebmapHonored=!0,this._mapPicker.setMapByID(h))}_initHome(){this.enableHome?(this._homeWidget=new this.Home({view:this.mapView}),this.mapView.ui.add(this._homeWidget,{position:"top-left",index:3})):this._homeWidget&&this.mapView.ui.remove(this._homeWidget)}get el(){return e(this)}static get watchers(){return{enableHome:["enableHomeWatchHandler"]}}};b.style=":host{display:block;--calcite-label-margin-bottom:0;--calcite-block-padding:0}.map-height{height:calc(100% - 51px)}.box-shadow{box-shadow:none !important}.visibility-hidden{visibility:hidden}";export{u as card_manager,v as layer_table,b as map_card}
|
@@ -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 t,h as i,H as e,g as s}from"./p-78780f63.js";import{g as h}from"./p-6b943f52.js";import{E as l}from"./p-4af32c75.js";import"./p-d918ec36.js";import"./p-e1a4994d.js";const a=class{constructor(i){t(this,i),this._shouldSetMapView=!1,this.classicGrid=!1,this.defaultCenter="",this.defaultGlobalId="",this.defaultLayer="",this.defaultLevel="",this.defaultOid="",this.defaultWebmap="",this.enableAutoRefresh=!1,this.enableColumnReorder=!0,this.enableCSV=!0,this.enableFloorFilter=!0,this.enableFullscreen=!0,this.enableInlineEdit=!1,this.enableLegend=!0,this.enableSearch=!0,this.enableShare=!1,this.enableHome=!0,this.enableZoom=!0,this.enableBasemap=!0,this.basemapConfig=void 0,this.showNewestFirst=!0,this.hideMap=!1,this.mapInfos=[],this.onlyShowUpdatableLayers=!0,this.searchConfiguration=void 0,this.shareIncludeEmbed=void 0,this.shareIncludeSocial=void 0,this.theme="light",this.zoomAndScrollToSelected=!1,this._expandPopup=!1,this._translations=void 0,this._layoutMode=l.GRID,this._mapView=void 0,this._panelOpen=!0}defaultCenterWatchHandler(){this._defaultCenter=this.defaultCenter?this.defaultCenter.split(";").map((t=>parseFloat(t))):void 0}defaultGlobalIdWatchHandler(){this._defaultGlobalId=this.defaultGlobalId?this.defaultGlobalId.indexOf(",")>-1?this.defaultGlobalId.split(","):[this.defaultGlobalId]:void 0}defaultOidWatchHandler(){this._defaultOid=this.defaultOid?this.defaultOid.indexOf(",")>-1?this.defaultOid.split(",").map((t=>parseInt(t,10))):[parseInt(this.defaultOid,10)]:void 0}defaultLevelWatchHandler(){this._defaultLevel=this.defaultLevel?parseInt(this.defaultLevel,10):void 0}enableZoomWatchHandler(){this._initMapZoom()}async layoutChanged(t){this._layoutMode=t.detail}async mapChanged(t){this._mapChange=t.detail,await this._mapChange.mapView.when((async()=>{await this._setMapView()}))}async beforeMapChanged(){this._expandPopup&&(this._shouldSetMapView=!0,this._expandPopup=!1)}async componentWillLoad(){await this._getTranslations()}render(){return i(e,null,i("calcite-shell",{class:"position-relative"},i("calcite-panel",{class:"width-full height-full"},this._getBody(this._layoutMode,this._panelOpen,this.hideMap))))}async componentDidRender(){this._shouldSetMapView&&(this._shouldSetMapView=!1,await this._setMapView())}_getDividerIcon(t,i){let e="";switch(t){case l.HORIZONTAL:e=this.classicGrid?i?"chevrons-down":"chevrons-up":i?"chevrons-up":"chevrons-down";break;case l.VERTICAL:e=this.classicGrid?i?"chevrons-right":"chevrons-left":i?"chevrons-left":"chevrons-right";break;case l.GRID:e=this.classicGrid?i?"chevrons-up":"chevrons-down":i?"chevrons-left":"chevrons-right"}return e}_getMapSizeClass(t,i){let e="";switch(t){case l.HORIZONTAL:e=(i?"height-1-2":"height-0")+" width-full position-relative";break;case l.GRID:e=this.classicGrid?(i?"position-relative":"position-absolute-53")+" height-full width-full display-flex":"height-full position-relative "+(i?"width-1-3":"width-0");break;case l.VERTICAL:e="height-full position-relative "+(i?"width-1-2":"width-0")}return e}_getTableSizeClass(t,i){let e="";switch(t){case l.HORIZONTAL:e=(i?"height-1-2":"height-full")+" width-full display-flex flex-column";break;case l.GRID:e=this.classicGrid?(i?"height-full":"height-53")+" position-relative width-full display-flex":(i?"width-2-3":"width-full")+" height-full display-flex";break;case l.VERTICAL:e=(i?"width-1-2":"width-full")+" height-full display-flex"}return e}_getBody(t,e,s){const h=this.classicGrid&&t===l.GRID&&e?"display-grid":t===l.HORIZONTAL?"":"display-flex";return i("calcite-panel",{class:"width-full height-full"},this.classicGrid?i("div",{class:`width-full height-full ${h}`},this._getTable(t,e),this._getMapAndCard(t,e,s)):i("div",{class:`width-full height-full ${h}`},this._getMapAndCard(t,e,s),this._getTable(t,e)))}_getMapAndCard(t,e,s){const h=this._getMapSizeClass(t,e);return this.classicGrid?i("div",{class:`${h} overflow-hidden`},this._getCardNode(),this._getMapNode(t,s)):i("div",{class:`${h} overflow-hidden`},this._getMapNode(t,s),this._getPopupExpandNode())}_getMapNode(t,e){var s;return i("div",{class:`${this.classicGrid&&t===l.GRID?"width-full":"adjusted-height-50"} overflow-hidden ${this.classicGrid&&t===l.GRID?"display-flex height-full width-1-2":t!==l.GRID||e?"display-none":""}`},i("map-card",{basemapConfig:this.basemapConfig,class:"width-full",defaultWebmapId:this.defaultWebmap,enableBasemap:this.enableBasemap,enableFloorFilter:this.enableFloorFilter,enableFullscreen:this.enableFullscreen,enableHome:this.enableHome,enableLegend:this.enableLegend,enableSearch:this.enableSearch,hidden:this._expandPopup,mapInfos:null===(s=this.mapInfos)||void 0===s?void 0:s.filter((t=>!1!==t.visible)),theme:this.theme}))}_getPopupExpandNode(){const t=this._expandPopup?"chevrons-down":"chevrons-up",e="expand-popup",s=this._expandPopup?this._translations.collapsePopup:this._translations.expandPopup,h="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light";return i("div",{class:"calcite-mode-dark "+(this._expandPopup?"position-absolute-50":"height-full")},i("calcite-panel",null,i("div",{class:"display-flex align-items-center",slot:"header-content"},i("calcite-icon",{icon:"information",scale:"s"}),i("div",{class:"padding-inline-start-75"},this._translations.information)),i("calcite-action",{icon:t,id:e,onClick:()=>this._togglePopup(),slot:"header-actions-end",text:""}),i("calcite-tooltip",{class:h,label:"",placement:"bottom","reference-element":e},i("span",null,s)),this._getCardNode()))}_togglePopup(){this._expandPopup=!this._expandPopup}_getCardNode(){return i("div",{class:"width-50 height-full "+("dark"===this.theme?"calcite-mode-dark":"calcite-mode-light")},i("card-manager",{class:(this._expandPopup?"height-full":"height-50")+" width-full",mapView:null==this?void 0:this._mapView,zoomAndScrollToSelected:this.zoomAndScrollToSelected}))}_getTable(t,e){const s=this._getTableSizeClass(t,e),h=this._getDividerIcon(t,e),a=e?this._translations.close:this._translations.open,o="toggle-layout",d=this.defaultWebmap&&this.defaultLayer;return i("calcite-shell",{class:s+" border-bottom"},i("calcite-action-bar",{class:"border-sides",expandDisabled:!0,layout:t===l.HORIZONTAL||this.classicGrid?"horizontal":"vertical",slot:this.classicGrid&&t!==l.VERTICAL?"footer":this.classicGrid&&t===l.VERTICAL?"panel-end":t===l.HORIZONTAL?"header":"panel-start"},i("calcite-action",{class:"toggle-node",icon:h,id:o,onClick:()=>this._toggleLayout(),text:""}),i("calcite-tooltip",{label:a,placement:"bottom","reference-element":o},i("span",null,a))),i("div",{class:"width-full height-full position-relative"},i("layer-table",{defaultGlobalId:d?this._defaultGlobalId:void 0,defaultLayerId:d?this.defaultLayer:"",defaultOid:d&&!this.defaultGlobalId?this._defaultOid:void 0,enableAutoRefresh:this.enableAutoRefresh,enableCSV:this.enableCSV,enableColumnReorder:this.enableColumnReorder,enableInlineEdit:this.enableInlineEdit,enableShare:this.enableShare,enableZoom:this.enableZoom,mapInfo:this._mapInfo,mapView:null==this?void 0:this._mapView,onlyShowUpdatableLayers:this.onlyShowUpdatableLayers,shareIncludeEmbed:this.shareIncludeEmbed,shareIncludeSocial:this.shareIncludeSocial,showNewestFirst:this.showNewestFirst,zoomAndScrollToSelected:this.zoomAndScrollToSelected})))}_toggleLayout(){this._panelOpen=!this._panelOpen}_getMapInfo(t){let i;return this.mapInfos.some((e=>{if(e.id===t)return i=e,!0})),i}async _setMapView(){this._mapInfo=this._getMapInfo(this._mapChange.id),this._mapView=this._mapChange.mapView,this._initMapZoom(),this._mapView.popupEnabled=!1,this._defaultCenter&&this._defaultLevel&&(await this._mapView.goTo({center:this._defaultCenter,zoom:this._defaultLevel}),this._defaultCenter=void 0,this._defaultLevel=void 0)}_initMapZoom(){this.enableZoom?this.enableZoom&&this._mapView.ui.add({component:"zoom",position:"top-left",index:0}):this._mapView.ui.remove("zoom")}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}get el(){return s(this)}static get watchers(){return{defaultCenter:["defaultCenterWatchHandler"],defaultGlobalId:["defaultGlobalIdWatchHandler"],defaultOid:["defaultOidWatchHandler"],defaultLevel:["defaultLevelWatchHandler"],enableZoom:["enableZoomWatchHandler"]}}};a.style=":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-ui-foreground-1)}.padding-1-2{padding:0.5rem}.display-flex{display:flex}.width-full{width:100%}.width-1-2{position:relative;width:50%}.width-1-3{position:relative;width:33.33%}.width-2-3{position:relative;width:66.66%}.width-0{width:0}.height-full{height:100%}.height-1-2{position:relative;height:50%}.height-0{height:0}.toggle-node{width:51px;height:51px}.overflow-hidden{overflow:hidden}.flex-column{flex-direction:column}.border{border:1px solid var(--calcite-ui-border-3)}.border-bottom{border-bottom:1px solid var(--calcite-ui-border-3)}.border-sides{border-left:1px solid var(--calcite-ui-border-3);border-right:1px solid var(--calcite-ui-border-3)}.position-relative{position:relative}.height-50{height:50%}.adjusted-height-50{height:calc(50% - 25px)}.adjusted-height-100{height:calc(100% - 50px)}.adjusted-height-100-50{height:calc(100% - 50px)}.display-none{display:none}.height-53{height:53px}.position-absolute-53{position:absolute;top:53px}.display-grid{display:grid}.height-50-px{height:50px}.padding-inline-start-75{padding-inline-start:0.75rem}.align-items-center{align-items:center}.esri-floor-filter__close-levels-button{width:40px !important;height:40px !important}.esri-floor-filter__level-button{width:40px !important;height:40px !important}.esri-floor-filter__browse-button{width:40px !important;height:40px !important}.position-absolute-50{position:absolute;top:50px;bottom:0px;left:0px;right:0px}";export{a as crowdsource_manager}
|