@esri/solutions-components 0.6.9 → 0.6.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/t9n/crowdsource-manager/resources.json +2 -1
- package/dist/assets/t9n/crowdsource-manager/resources_en.json +2 -1
- package/dist/assets/t9n/info-card/resources.json +4 -1
- package/dist/assets/t9n/info-card/resources_en.json +4 -1
- package/dist/assets/t9n/layer-table/resources.json +2 -1
- package/dist/assets/t9n/layer-table/resources_en.json +2 -1
- package/dist/assets/t9n/map-tools/resources.json +0 -3
- package/dist/assets/t9n/map-tools/resources_en.json +0 -3
- package/dist/cjs/basemap-gallery_5.cjs.entry.js +6 -61
- package/dist/cjs/card-manager_3.cjs.entry.js +22 -12
- package/dist/cjs/crowdsource-manager.cjs.entry.js +27 -5
- package/dist/cjs/{downloadUtils-1f057ec0.js → downloadUtils-471a6a2d.js} +16 -10
- package/dist/cjs/edit-card_2.cjs.entry.js +34 -2
- package/dist/cjs/{index.es-a1507f1c.js → index.es-33154f03.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-select-tools_3.cjs.entry.js +1 -1
- package/dist/cjs/public-notification.cjs.entry.js +1 -1
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/components/card-manager/card-manager.js +1 -1
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.css +23 -2
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +27 -4
- package/dist/collection/components/info-card/info-card.css +15 -2
- package/dist/collection/components/info-card/info-card.js +34 -1
- package/dist/collection/components/layer-table/layer-table.css +20 -0
- package/dist/collection/components/layer-table/layer-table.js +5 -1
- package/dist/collection/components/map-card/map-card.css +0 -7
- package/dist/collection/components/map-card/map-card.js +13 -7
- package/dist/collection/components/map-picker/map-picker.css +5 -1
- package/dist/collection/components/map-picker/map-picker.js +2 -2
- package/dist/collection/components/map-tools/map-tools.css +14 -0
- package/dist/collection/components/map-tools/map-tools.js +2 -59
- package/dist/collection/utils/downloadUtils.js +15 -9
- package/dist/collection/utils/downloadUtils.ts +21 -10
- package/dist/components/card-manager2.js +6 -6
- package/dist/components/crowdsource-manager.js +28 -5
- package/dist/components/downloadUtils.js +15 -9
- package/dist/components/info-card2.js +40 -7
- package/dist/components/layer-table2.js +6 -2
- package/dist/components/map-card2.js +14 -8
- package/dist/components/map-picker2.js +3 -3
- package/dist/components/map-tools2.js +3 -58
- package/dist/esm/basemap-gallery_5.entry.js +6 -61
- package/dist/esm/card-manager_3.entry.js +22 -12
- package/dist/esm/crowdsource-manager.entry.js +27 -5
- package/dist/esm/{downloadUtils-64c27514.js → downloadUtils-8d4c13bb.js} +16 -10
- package/dist/esm/edit-card_2.entry.js +34 -2
- package/dist/esm/{index.es-b7bc2db1.js → index.es-065c3035.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-select-tools_3.entry.js +1 -1
- package/dist/esm/public-notification.entry.js +1 -1
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/{p-12f06497.entry.js → p-0dd8368d.entry.js} +1 -1
- package/dist/solutions-components/p-46352a57.entry.js +6 -0
- package/dist/solutions-components/{p-22d06238.js → p-6eb4ba8f.js} +1 -1
- package/dist/solutions-components/{p-a26dc184.js → p-95c11620.js} +2 -2
- package/dist/solutions-components/p-9eba78eb.entry.js +6 -0
- package/dist/solutions-components/{p-b2a52acb.entry.js → p-c26cd409.entry.js} +1 -1
- package/dist/solutions-components/p-d4cb29ed.entry.js +6 -0
- package/dist/solutions-components/p-fb7ca639.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/downloadUtils.ts +21 -10
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +17 -0
- package/dist/types/components/info-card/info-card.d.ts +23 -0
- package/dist/types/components/map-card/map-card.d.ts +4 -0
- package/dist/types/components/map-tools/map-tools.d.ts +0 -42
- package/dist/types/utils/downloadUtils.d.ts +7 -3
- package/package.json +1 -1
- package/dist/solutions-components/p-0dce2c3b.entry.js +0 -6
- package/dist/solutions-components/p-476eb52c.entry.js +0 -6
- package/dist/solutions-components/p-8b8a6c1f.entry.js +0 -6
- package/dist/solutions-components/p-97a4001d.entry.js +0 -6
@@ -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 e,g as h}from"./p-9310b882.js";import{g as l}from"./p-7f9642d5.js";import{E as s}from"./p-868df4a0.js";import"./p-e1a4994d.js";const o=class{constructor(i){t(this,i),this.classicGrid=!1,this.showNewestFirst=!0,this.hideMap=!1,this.mapInfos=[],this.searchConfiguration=void 0,this.zoomAndScrollToSelected=!1,this._translations=void 0,this._layoutMode=s.GRID,this._mapView=void 0,this._panelOpen=!0}async layoutChanged(t){this._layoutMode=t.detail}async mapChanged(t){const i=t.detail;this._mapInfo=this._getMapInfo(i.id),this._mapView=i.mapView,this._mapView.popupEnabled=!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))))}_getDividerIcon(t,i){let e="";switch(t){case s.HORIZONTAL:e=this.classicGrid?i?"chevrons-down":"chevrons-up":i?"chevrons-up":"chevrons-down";break;case s.VERTICAL:e=this.classicGrid?i?"chevrons-right":"chevrons-left":i?"chevrons-left":"chevrons-right";break;case s.GRID:e=this.classicGrid?i?"chevrons-up":"chevrons-down":i?"chevrons-left":"chevrons-right"}return e}_getMapSizeClass(t,i){let e="";switch(t){case s.HORIZONTAL:e=(i?"height-1-2":"height-0")+" width-full position-relative";break;case s.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 s.VERTICAL:e="height-full position-relative "+(i?"width-1-2":"width-0")}return e}_getTableSizeClass(t,i){let e="";switch(t){case s.HORIZONTAL:e=(i?"height-1-2":"height-full")+" width-full display-flex flex-column";break;case s.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 s.VERTICAL:e=(i?"width-1-2":"width-full")+" height-full display-flex"}return e}_getBody(t,e,h){const l=this.classicGrid&&t===s.GRID&&e?"display-grid":t===s.HORIZONTAL?"":"display-flex";return i("calcite-panel",{class:"width-full height-full"},this.classicGrid?i("div",{class:`width-full height-full ${l}`},this._getTable(t,e),this._getMapAndCard(t,e,h)):i("div",{class:`width-full height-full ${l}`},this._getMapAndCard(t,e,h),this._getTable(t,e)))}_getMapAndCard(t,e,h){const l=this._getMapSizeClass(t,e);return this.classicGrid?i("div",{class:`${l} overflow-hidden`},this._getCardNode(t,h),this._getMapNode(t,h)):i("div",{class:`${l} overflow-hidden`},this._getMapNode(t,h),this._getCardNode(t,h))}_getMapNode(t,e){return i("div",{class:`${this.classicGrid&&t===s.GRID?"width-full":"adjusted-height-50"} overflow-hidden ${this.classicGrid&&t===s.GRID?"display-flex height-full width-1-2":t!==s.GRID||e?"display-none":""}`},i("map-card",{class:"width-full",mapInfos:this.mapInfos}))}_getCardNode(t,e){return i("div",{class:"padding-1-2 "+(this.classicGrid&&t===s.GRID?"width-full adjusted-height-100":"width-50 height-full")},i("card-manager",{class:(this.classicGrid&&t===s.GRID?"":t!==s.GRID||e?"adjusted-height-100":"adjusted-height-50")+" width-full",mapView:null==this?void 0:this._mapView,zoomAndScrollToSelected:this.zoomAndScrollToSelected}))}_getTable(t,e){const h=this._getTableSizeClass(t,e),l=this._getDividerIcon(t,e),o=e?this._translations.close:this._translations.open,a="toggle-layout";return i("calcite-shell",{class:h+" border-bottom"},i("calcite-action-bar",{class:"border",expandDisabled:!0,layout:t===s.HORIZONTAL||this.classicGrid?"horizontal":"vertical",slot:this.classicGrid&&t!==s.VERTICAL?"footer":this.classicGrid&&t===s.VERTICAL?"panel-end":t===s.HORIZONTAL?"header":"panel-start"},i("calcite-action",{class:"toggle-node",icon:l,id:a,onClick:()=>this._toggleLayout(),text:""}),i("calcite-tooltip",{label:o,placement:"bottom","reference-element":a},i("span",null,o))),i("div",{class:"width-full height-full position-relative"},i("layer-table",{mapInfo:this._mapInfo,mapView:null==this?void 0:this._mapView,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 _getTranslations(){const t=await l(this.el);this._translations=t[0]}get el(){return h(this)}};o.style=":host{display:block;--calcite-label-margin-bottom:0px}.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)}.position-relative{position:relative}.height-50{height:50%}.adjusted-height-50{height:calc(50% - 0.5rem)}.adjusted-height-100{height:calc(100% - 1rem)}.display-none{display:none}.height-53{height:53px}.position-absolute-53{position:absolute;top:53px}.display-grid{display:grid}";export{o as crowdsource_manager}
|
@@ -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,c as i,h as s,H as e,g as a}from"./p-9310b882.js";import{l as o}from"./p-0266ca81.js";import{g as n}from"./p-7f9642d5.js";import"./p-e1a4994d.js";const h=class{constructor(s){t(this,s),this.closeEdit=i(this,"closeEdit",7),this._shouldClose=!1,this.graphics=void 0,this.mapView=void 0,this.open=!1,this.graphicIndex=0,this._translations=void 0}graphicIndexWatchHandler(){this._initEditorWidget()}graphicsWatchHandler(){this._initEditorWidget()}mapViewWatchHandler(){this._initEditorWidget()}async componentWillLoad(){await this._initModules(),await this._getTranslations()}async componentWillRender(){var t,i;const s=document.getElementsByTagName("layer-table");if(1===s.length){const t=s[0];this.graphics=await t.getSelectedGraphics()}(null===(t=this.graphics)||void 0===t?void 0:t.length)>0&&(null===(i=this.graphics[0])||void 0===i?void 0:i.layer)&&(this._layer=this.graphics[0].layer)}render(){var t;const i=!((null===(t=this.graphics)||void 0===t?void 0:t.length)>0&&this.graphics[0]&&this.graphics[0].layer.editingEnabled);return s(e,null,s("div",{class:"position-relative"},i?s("calcite-notice",{kind:"warning",open:!0,slot:"content-top",width:"full"},s("div",{slot:"message"},this._translations.enableEditing)):void 0,s("div",{slot:"content"},s("div",{id:"feature-form",ref:t=>this._editContainer=t}))))}async _initModules(){const[t,i]=await o(["esri/widgets/Editor","esri/core/reactiveUtils"]);this.Editor=t,this.reactiveUtils=i}_initEditorWidget(){if(this.mapView&&this.graphics&&this.graphics.length>0&&this.graphics[0]){this._editor&&this._editor.destroy();const t=document.createElement("div");this._editor=new this.Editor({allowedWorkflows:"update",view:this.mapView,visibleElements:{snappingControls:!1,sketchTooltipControls:!1},container:t}),this._editHandle&&this._attachmentHandle&&this._activeWorkflowHandle&&(this._editHandle.remove(),this._attachmentHandle.remove(),this._activeWorkflowHandle.remove()),this._attachmentHandle=this.reactiveUtils.when((()=>"adding-attachment"===this._editor.viewModel.state||"editing-attachment"===this._editor.viewModel.state),(()=>{this._shouldClose=!1})),this._editHandle=this.reactiveUtils.when((()=>"ready"===this._editor.viewModel.state),(()=>{this._shouldClose&&(this.closeEdit.emit(),this._shouldClose=!1),this.graphicIndex>-1&&this.graphics.length>0&&this.open&&!this._shouldClose&&(this._editor.startUpdateWorkflowAtFeatureEdit(this.graphics[this.graphicIndex]),this._shouldClose=!0)})),this._activeWorkflowHandle=this.reactiveUtils.watch((()=>{var t;return null===(t=this._editor.viewModel.activeWorkflow)||void 0===t?void 0:t.activeWorkflow}),(t=>{"update-table-record"!==(null==t?void 0:t.type)&&"create-features"!==(null==t?void 0:t.type)||(this._shouldClose=!1)})),this._editContainer.appendChild(t)}}async _getTranslations(){const t=await n(this.el);this._translations=t[0]}get el(){return a(this)}static get watchers(){return{graphicIndex:["graphicIndexWatchHandler"],graphics:["graphicsWatchHandler"],mapView:["mapViewWatchHandler"]}}};h.style=":host{display:block}.padding-bottom-1{padding-bottom:1rem}.font-bold{font-weight:var(--calcite-font-weight-bold)}.font-500{font-weight:var(--calcite-font-weight-medium)}.font-italic{font-style:italic}#feature-form{--calcite-ui-background:none;padding-top:0px}.padding-sides-bottom-1{padding:0 1rem 1rem 1rem}.position-relative{position:relative}.esri-editor__prompt--danger{position:relative !important;width:100% !important;background-color:var(--calcite-ui-foreground-1) !important}";const l=class{constructor(s){t(this,s),this.selectionChanged=i(this,"selectionChanged",7),this.graphics=void 0,this.isLoading=!1,this.mapView=void 0,this.zoomAndScrollToSelected=void 0,this._alertOpen=!1,this._editRecordOpen=!1,this._translations=void 0}async graphicsWatchHandler(){var t;if(this.graphics.length>0){const i=null===(t=this.graphics[0])||void 0===t?void 0:t.layer;this._editEnabled=i.editingEnabled&&i.capabilities.operations.supportsUpdate,this._features.open({features:this.graphics})}else this._features.clear(),this._features.close()}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this._initFeaturesWidget()}))}async getSelectedFeature(){return this._features.selectedFeature}async closeEdit(){this._editRecordOpen=!1}async componentWillLoad(){await this._initModules(),await this._getTranslations()}render(){var t;const i=this.isLoading||this._editRecordOpen?"display-none":"position-absolute",a=!this.isLoading&&this._editRecordOpen?"position-absolute":"display-none",o=!this.isLoading&&this._editRecordOpen?"display-none":"";return s(e,null,s("calcite-shell",null,s("calcite-loader",{class:this.isLoading?"":"display-none",label:this._translations.fetchingData}),s("div",{class:"esri-widget "+i,id:"features-node"}),s("div",{class:`${o} edit-btn edit-btn-position`},s("calcite-action",{appearance:"transparent",icon:"pencil",id:"solutions-edit",onClick:()=>this._openEditRecord(),scale:"m"}),s("calcite-tooltip",{label:"",placement:"bottom","reference-element":"solutions-edit"},s("span",null,this._translations.edit))),s("edit-card",{class:a,graphicIndex:null===(t=this._features)||void 0===t?void 0:t.selectedFeatureIndex,graphics:this.graphics,mapView:this.mapView,open:this._editRecordOpen}),s("calcite-alert",{icon:"layer-broken",kind:"warning",label:"",onCalciteAlertClose:()=>this._alertClosed(),open:this._alertOpen,placement:"top"},s("div",{slot:"title"},this._translations.editDisabled),s("div",{slot:"message"},this._translations.enableEditing))))}async _initModules(){const[t,i]=await o(["esri/widgets/Features","esri/core/reactiveUtils"]);this.Features=t,this.reactiveUtils=i}async _initFeaturesWidget(){this._features?this._features.view=this.mapView:(this._features=new this.Features({view:this.mapView,container:"features-node",visibleElements:{actionBar:!1,closeButton:!1,heading:!0}}),this.zoomAndScrollToSelected&&this.reactiveUtils.watch((()=>this._features.selectedFeatureIndex),(t=>{t>-1&&this.selectionChanged.emit(this._features.selectedFeature)})))}_alertClosed(){this._alertOpen=!1}_editRecordClosed(){this._editRecordOpen=!1}_openEditRecord(){this._editEnabled?this._editRecordOpen=!0:this._alertOpen=!0}async _getTranslations(){const t=await n(this.el);this._translations=t[0]}get el(){return a(this)}static get watchers(){return{graphics:["graphicsWatchHandler"],mapView:["mapViewWatchHandler"]}}};l.style=':host{display:block;--calcite-label-margin-bottom:0}table{border-collapse:collapse;width:100%}th,td{text-align:left;padding:8px}tr:nth-child(odd){background:var(--calcite-ui-foreground-2)}.bottom-border{padding-bottom:0.5rem;border-bottom:1px solid var(--calcite-ui-border-1)}.padding-1-2{padding:0.5rem}.padding-top-1-2{padding-top:0.5rem}.font-color-3{color:var(--calcite-ui-text-3)}.display-none{display:none}.display-flex{display:flex}.position-absolute{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto}.edit-btn{z-index:999;position:absolute;width:50px}.edit-btn-position{right:0}html[dir="rtl"] .edit-btn-position{left:0}';export{h as edit_card,l as info_card}
|
@@ -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-9310b882.js";import{l as h}from"./p-0266ca81.js";import{g as n}from"./p-7f9642d5.js";import{g as o}from"./p-868df4a0.js";import"./p-e1a4994d.js";const r=class{constructor(i){t(this,i),this.mapView=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,null,i("div",{ref:t=>{this._basemapElement=t}}))}async _initModules(){const[t]=await h(["esri/widgets/BasemapGallery"]);this.BasemapGallery=t}_initBaseMapGallery(t){t&&this.BasemapGallery&&(this.basemapWidget?this.basemapWidget.view=t:this.basemapWidget=new this.BasemapGallery({container:this._basemapElement,view:t}))}get el(){return e(this)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};r.style=":host{display:block}";const c=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,null,i("div",{ref:t=>{this._legendElement=t}}))}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"]}}};c.style=":host{display:block}";const l=class{constructor(i){t(this,i),this.mapInfoChange=a(this,"mapInfoChange",7),this._loadedId="",this.mapInfos=[],this._mapListExpanded=!1,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))}mapInfosWatchHandler(t,i){t&&JSON.stringify(t)!==JSON.stringify(i)&&this.mapInfoChange.emit(t[0])}render(){return i(s,null,this._getToolbar(),this._getMapNameList(this._mapListExpanded))}async componentDidRender(){this._mapListExpanded&&await this._list.setFocus()}componentDidLoad(){const t=this.mapInfos&&this.mapInfos.length>0?this.mapInfos[0]:void 0;t&&this._webMapSelected(t)}_getMapPicker(){var t;return i("calcite-button",{alignment:"icon-end-space-between",appearance:"solid",class:"width-full height-full",iconEnd:this._mapListExpanded?"chevron-up":"chevron-down",kind:"neutral",onClick:()=>this._chooseMap(),width:"full"},null===(t=this._webMapInfo)||void 0===t?void 0:t.name)}_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":"display-none"},i("calcite-list",{id:"mapList",ref:t=>this._list=t,selectionAppearance:"border"},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}get el(){return e(this)}static get watchers(){return{_webMapInfo:["_webMapInfoWatchHandler"],mapInfos:["mapInfosWatchHandler"]}}};l.style=":host{display:block}.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-ui-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-scrim-background);z-index:1;width:100%;height:-moz-fit-content;height:fit-content}.display-none{display:none}";const d=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,null,i("div",{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,n=h?i.map.findLayerById(h):null,o=null===(e=null==a?void 0:a.layer)||void 0===e?void 0:e.url;n?a.layer=n:o&&(a.layer=new this.FeatureLayer(o))}})),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"]}}};d.style=":host{display:block}.search-widget{width:100% !important;border:1px solid var(--calcite-ui-border-input)}";const p=class{constructor(i){t(this,i),this.expandMap=a(this,"expandMap",7),this.layout="vertical",this.mapView=void 0,this.searchConfiguration=void 0,this._translations=void 0,this._showTools=!0,this._showBasemapWidget=!1,this._showLegendWidget=!1,this._showSearchWidget=!1}async mapViewWatchHandler(){await this.mapView.when((()=>{this._homeExtent=this.mapView.extent}))}async _showBasemapWidgetWatchHandler(t){t?this.mapView.ui.add(this._basemapElement.basemapWidget,{position:"top-right",index:1}):this.mapView.ui.remove(this._basemapElement.basemapWidget)}async _showLegendWidgetWatchHandler(t){t?this.mapView.ui.add(this._legendElement.legendWidget,{position:"top-right",index:1}):this.mapView.ui.remove(this._legendElement.legendWidget)}async _showSearchWidgetWatchHandler(t){t?this.mapView.ui.add(this._searchElement.searchWidget,{position:"top-right",index:1}):this.mapView.ui.remove(this._searchElement.searchWidget)}async componentWillLoad(){await this._getTranslations()}render(){const t=this._showTools?"":"display-none",e=this._showSearchWidget?"":"display-none",a=this._showBasemapWidget?"":"display-none",h=this._showLegendWidget?"":"display-none";return i(s,null,i("div",null,i("calcite-action",{alignment:"center",class:"border",compact:!1,icon:this._showTools?"chevrons-up":"chevrons-down",onClick:()=>{this._toggleTools()},text:""}),i("calcite-action-bar",{class:`border margin-top-1-2 ${t}`,"expand-disabled":!0,layout:this.layout},this._getActionGroup("home",!1,this._translations.home,(()=>{this._goHome()})),this._getActionGroup("plus",!1,this._translations.zoomIn,(()=>{this._zoomIn()})),this._getActionGroup("minus",!1,this._translations.zoomOut,(()=>{this._zoomOut()})),this._getActionGroup("legend",!1,this._translations.legend,(()=>this._showLegend())),this._getActionGroup("magnifying-glass",!1,this._translations.search,(()=>this._search())),this._getActionGroup("expand",!1,this._translations.expand,(()=>this._expand())),this._getActionGroup("basemap",!1,this._translations.basemap,(()=>this._toggleBasemapPicker())))),i("basemap-gallery",{class:a,mapView:this.mapView,ref:t=>{this._basemapElement=t}}),i("map-search",{class:e,mapView:this.mapView,ref:t=>{this._searchElement=t},searchConfiguration:this.searchConfiguration}),i("map-legend",{class:h,mapView:this.mapView,ref:t=>{this._legendElement=t}}))}_getActionGroup(t,s,e,a){return i("calcite-action-group",null,i("calcite-action",{alignment:"center",compact:!1,disabled:s,icon:t,id:t,onClick:a,text:""},i("calcite-icon",{icon:"cheveron-up",scale:"s",slot:"icon"})),i("calcite-tooltip",{label:"",placement:"bottom","reference-element":t},i("span",null,e)))}async _goHome(){await this.mapView.goTo(this._homeExtent)}_showLegend(){this._showLegendWidget=!this._showLegendWidget,this._showTools=!1}_search(){this._showSearchWidget=!this._showSearchWidget,this._showTools=!1}async _zoomIn(){await this._zoom(this.mapView.zoom+1)}async _zoomOut(){await this._zoom(this.mapView.zoom-1)}async _zoom(t){var i;await(null===(i=this.mapView)||void 0===i?void 0:i.goTo({target:this.mapView.center,zoom:t}))}_toggleBasemapPicker(){this._showBasemapWidget=!this._showBasemapWidget,this._showTools=!1}_expand(){this.expandMap.emit(o.EXPAND)}_toggleTools(){this._showTools||(this._showBasemapWidget=!1,this._showSearchWidget=!1,this._showLegendWidget=!1),this._showTools=!this._showTools}async _getTranslations(){const t=await n(this.el);this._translations=t[0]}get el(){return e(this)}static get watchers(){return{mapView:["mapViewWatchHandler"],_showBasemapWidget:["_showBasemapWidgetWatchHandler"],_showLegendWidget:["_showLegendWidgetWatchHandler"],_showSearchWidget:["_showSearchWidgetWatchHandler"]}}};p.style=":host{display:block}.display-none{display:none}.border{border:1px solid var(--calcite-ui-border-3)}.margin-top-1-2{margin-top:0.5rem}";export{r as basemap_gallery,c as map_legend,l as map_picker,d as map_search,p as map_tools}
|
@@ -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-9310b882.js";import{g as h}from"./p-7f9642d5.js";import{q as l,a as n,b as o,g as c,c as r}from"./p-f8dd2784.js";import{l as d}from"./p-0266ca81.js";import{d as p}from"./p-a26dc184.js";import"./p-e1a4994d.js";import"./p-868df4a0.js";const m=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 l(i,this.layer,[],!1,this.mapView.spatialReference):[];this._graphics=s,this._cardLoading=!1}async layerSelectionChange(t){const i=t.detail[0];this.layer=await n(this.mapView,i)}async componentWillLoad(){await this._getTranslations()}render(){var t,e;const a=(null===(t=this._graphics)||void 0===t?void 0:t.length)>0?"":"display-none",h=(null===(e=this._graphics)||void 0===e?void 0:e.length)>0?"display-none":"";return i(s,null,i("div",{class:"border-rounded overflow-auto height-full"},i("calcite-shell",{class:"position-relative padding-1 "+a},i("div",null,i("info-card",{graphics:this._graphics,isLoading:this._cardLoading,mapView:this.mapView,zoomAndScrollToSelected:this.zoomAndScrollToSelected}))),i("div",{class:"padding-1 "+h},i("calcite-notice",{icon:"table",open:!0},i("div",{slot:"message"},this._translations.selectFeaturesToStart)))))}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}get el(){return e(this)}};m.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}.border-rounded{border:1px solid var(--calcite-ui-border-2);border-radius:5px}.height-full{height:100%}card-manager{display:block}";const u=class{constructor(i){t(this,i),this.featureSelectionChange=a(this,"featureSelectionChange",7),this._allIds=[],this._tableSorting=!1,this.onTableNodeCreate=t=>{this._tableNode=t},this.mapInfo=void 0,this.mapView=void 0,this.showNewestFirst=void 0,this.zoomAndScrollToSelected=void 0,this._alertOpen=!1,this._fetchingData=!1,this._layer=void 0,this._selectedIndexes=[],this._showOnlySelected=!1,this._sortActive=!1,this._translations=void 0}async mapViewWatchHandler(){this._fetchingData=!0;const t=await o(this.mapView);this._layer=await n(this.mapView,t[0]),this.reactiveUtils.on((()=>this.mapView),"click",(t=>{this._mapClicked(t)})),this._fetchingData=!1}async _layerWatchHandler(){this._fetchingData=!0,await this._resetTable(),this._fetchingData=!1}async _sortActiveWatchHandler(){this._sortActive||await this._sortTable()}async getSelectedGraphics(){return this._selectedIndexes.length>0?await this._getGraphics(this._selectedIndexes):[]}async selectionChanged(t){if(this.zoomAndScrollToSelected){const i=t.detail,s=i.getObjectId(),e=this._table.viewModel.getObjectIdIndex(s);this._table.scrollToIndex(e);const a=i.layer;let h;this.mapView.allLayerViews.toArray().some((t=>{if(t.layer.title===a.title&&"feature"===t.layer.type)return h=t,!0})),h&&await c([s],h,this.mapView,!0)}}async componentWillLoad(){await this._getTranslations(),await this._initModules()}render(){if(!this._layer)return null;const t=this._fetchingData?"display-none":"",e=this._fetchingData?"":"display-none",a=this._alertShowAction?"":"display-none";return i(s,null,i("calcite-shell",null,this._getTableControlRow("header"),i("div",{class:"height-full 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("calcite-alert",{icon:this._alertIcon,kind:this._alertKind,label:"",onCalciteAlertClose:()=>this._alertClosed(),open:this._alertOpen,placement:"top"},i("div",{slot:"title"},this._alertTitle),i("div",{slot:"message"},this._alertMessage),i("calcite-link",{class:a,onClick:this._alertActionFunction,slot:"link"},this._alertActionText))))}async _initModules(){const[t,i]=await d(["esri/widgets/FeatureTable","esri/core/reactiveUtils"]);this.FeatureTable=t,this.reactiveUtils=i}_getTableControlRow(t){const s=this._selectedIndexes.length>0;return i("div",{class:"display-flex table-border height-51",slot:t},i("calcite-action-bar",{expandDisabled:!0,expanded:!0,layout:"horizontal"},i("div",{class:"border-end"},i("map-layer-picker",{appearance:"transparent",mapView:this.mapView,onLayerSelectionChange:t=>this._layerSelectionChanged(t),placeholderIcon:"layers",scale:"l",type:"dropdown"})),i("calcite-action",{appearance:"solid",disabled:!s,icon:"magnifying-glass",id:"magnifying-glass",label:this._translations.zoom,onClick:()=>this._zoom(),text:this._translations.zoom,textEnabled:!0}),i("calcite-tooltip",{label:"",placement:"bottom","reference-element":"magnifying-glass"},i("span",null,this._translations.zoom)),i("calcite-action",{appearance:"solid",icon:"filter",id:"filter",onClick:()=>this._filter(),text:this._translations.filters,"text-enabled":"true",textEnabled:!0}),i("calcite-tooltip",{label:"",placement:"bottom","reference-element":"filter"},i("span",null,this._translations.filters)),i("calcite-action",{appearance:"solid",disabled:!s,id:"trash",onClick:()=>this._delete(),text:""},i("calcite-button",{appearance:"transparent",iconStart:"trash",kind:"danger"},this._translations.delete)),i("calcite-tooltip",{label:"",placement:"bottom","reference-element":"trash"},i("span",null,this._translations.delete)),i("calcite-action",{appearance:"solid",disabled:!s,icon:"erase",id:"erase",onClick:()=>this._clearSelection(),text:this._translations.clearSelection,"text-enabled":"true",textEnabled:!0}),i("calcite-tooltip",{label:"",placement:"bottom","reference-element":"erase"},i("span",null,this._translations.clearSelection))),i("calcite-dropdown",null,i("calcite-action",{appearance:"solid",label:"",slot:"trigger",text:""},i("calcite-button",{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral"},this._translations.more)),i("calcite-dropdown-group",{"selection-mode":"none"},i("calcite-dropdown-item",{iconStart:"list-check-all",onClick:()=>this._selectAll()},this._translations.selectAll),i("calcite-dropdown-item",{iconStart:"selected-items-filter",onClick:()=>this._toggleShowSelected()},this._showOnlySelected?this._translations.showAll:this._translations.showSelected),i("calcite-dropdown-item",{iconStart:"refresh",onClick:()=>this._switchSelected()},this._translations.switchSelected),i("calcite-dropdown-item",{iconStart:"refresh",onClick:()=>this._refresh()},this._translations.refresh),i("calcite-dropdown-item",{iconStart:"export",onClick:()=>{this._exportToCSV()}},this._translations.exportCSV))))}async _getTable(t,i){this._layer&&await this._layer.when((async()=>{this._table=new this.FeatureTable({layer:this._layer,view:this.mapView,highlightEnabled:!0,multiSortEnabled:!1,visibleElements:{header:!1,menu:!1},tableTemplate:{columnTemplates:i},container:t}),await this._table.when((async()=>{this._table.highlightIds.on("change",(()=>{this._selectedIndexes=this._table.highlightIds.toArray(),this._showOnlySelected&&(this._selectedIndexes.length>0?this._table.filterBySelection():this._toggleShowSelected()),this.featureSelectionChange.emit(this._selectedIndexes)})),this.reactiveUtils.watch((()=>this._table.activeSortOrders),(t=>{var i,s,e,a;this._sortActive=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===(a=t[0])||void 0===a?void 0:a.fieldName)===this._layer.objectIdField}))}))}))}async _resetTable(){if(this._layer&&this._table){this._clearSelection(),this._allIds=[],this.featureSelectionChange.emit(this._selectedIndexes);const t=this._getColumnTemplates(this._layer.id);this._table.layer=this._layer,this._table.tableTemplate.columnTemplates=t,this._editEnabled=this._layer.editingEnabled,this._table.view=this.mapView,this._table.editingEnabled=this._editEnabled,this._table.clearSelectionFilter(),this._showOnlySelected=!1,this._sortActive=!1,await this._sortTable()}}async _sortTable(){this._table&&this._layer&&!this._sortActive&&!this._tableSorting&&this.showNewestFirst&&(this._tableSorting=!0,await this._table.when((async()=>{await this._layer.when((async()=>{this._table.sortColumn(this._layer.objectIdField,"desc"),this._tableSorting=!1}))})))}async _mapClicked(t){const i={include:this._layer},s=await this.mapView.hitTest(t.screenPoint,i);s.results.length>0&&(s.results.forEach((t=>{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())}_alertClosed(){this._alertOpen=!1}_selectAll(){const t=this._allIds;this._table.highlightIds.addMany(t),this._selectedIndexes=t}_toggleShowSelected(){this._showOnlySelected=!this._showOnlySelected,this._showOnlySelected?this._table.filterBySelection():this._table.clearSelectionFilter()}_clearSelection(){this._selectedIndexes=[],this._table.highlightIds.removeAll()}_filter(){alert("do whatever this button is supposed to do")}_switchSelected(){const t=[...this._selectedIndexes];this._table.highlightIds.removeAll();const i=this._allIds.reduce(((i,s)=>(t.indexOf(s)<0&&i.push(s),i)),[]);this._table.highlightIds.addMany(i),this._selectedIndexes=i}async _exportToCSV(){const t={},i=this._table.highlightIds.toArray();t[this._layer.id]={selectionSetNames:[],ids:i,layer:this._layer},p(t,!1,!0)}_refresh(){this._table.refresh()}_zoom(){this._table.zoomToSelection()}_delete(){this._editEnabled?(this._alertIcon="trash",this._alertTitle=this._translations.deleteRows,this._alertActionText=this._translations.delete,this._alertShowAction=!0,this._alertMessage=this._translations.confirm,this._alertKind="danger",this._alertActionFunction=()=>{this._layer.applyEdits({deleteFeatures:this._table.highlightIds.toArray()}),this._alertOpen=!1}):(this._alertIcon="layer-broken",this._alertTitle=this._translations.deleteDisabled,this._alertShowAction=!1,this._alertMessage=this._translations.enableEditing,this._alertKind="warning"),this._alertOpen=!0}async _getGraphics(t){return t.length>0?l(t,this._table.layer,[],!1,this.mapView.spatialReference):[]}async _layerSelectionChanged(t){const i=t.detail[0];if(i!==this._layer.id||0===this._allIds.length){this._fetchingData=!0;const t=this._getColumnTemplates(i);this._layer=await n(this.mapView,i),this._allIds=await r(this._layer),this._table?t&&(this._table.tableTemplate.columnTemplates=t):await this._getTable(this._tableNode,t),await this._table.when((()=>{this._table.highlightIds.removeAll()})),this._selectedIndexes=[],this._table.layer=this._layer,this._table.render()}this._sortActive=!1,await this._sortTable(),this._fetchingData=!1}_getColumnTemplates(t){var i;let s;return null===(i=this.mapInfo.layerInfos)||void 0===i||i.some((i=>{if(i.id===t)return s=i,!0})),null==s?void 0:s.columnTemplates}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}get el(){return e(this)}static get watchers(){return{mapView:["mapViewWatchHandler"],_layer:["_layerWatchHandler"],_sortActive:["_sortActiveWatchHandler"]}}};u.style=":host{display:block}.height-full{height:100%}.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)}.padding-5{padding:5px}.height-51{height:51px}";const g=class{constructor(i){t(this,i),this.mapChanged=a(this,"mapChanged",7),this._loadedId="",this.mapInfos=[],this.mapView=void 0,this._searchConfiguration=void 0,this._webMapInfo=void 0}async mapInfoChange(t){await this._loadMap(t.detail)}async componentWillLoad(){await this._initModules()}render(){return i(s,null,i("map-picker",{mapInfos:this.mapInfos}),i("div",{class:"map-height",ref:t=>this._mapDiv=t}),i("map-tools",{mapView:this.mapView,ref:t=>this._mapTools=t,searchConfiguration:this._searchConfiguration}))}async _initModules(){const[t,i]=await d(["esri/WebMap","esri/views/MapView"]);this.WebMap=t,this.MapView=i}async _loadMap(t){let i=null==t?void 0:t.id;if(this._webMapInfo=(""===i||!i)&&this.mapInfos.length>0?this.mapInfos[0]:t,i=this._webMapInfo.id,this._loadedId!==i){const t=new this.WebMap({portalItem:{id:i}});this.mapView=new this.MapView({container:this._mapDiv,map:t,resizeAlign:"top-left"}),await this.mapView.when((()=>{this._loadedId=i,this._searchConfiguration=this._webMapInfo.searchConfiguration,this.mapChanged.emit({id:i,mapView:this.mapView}),this.mapView.ui.add(this._mapTools,{position:"top-right",index:0})}))}}get el(){return e(this)}};g.style=":host{display:block;--calcite-label-margin-bottom:0;--calcite-block-padding:0}.map-height{height:calc(100% - 58px)}.esri-zoom{display:none !important}";export{m as card_manager,u as layer_table,g as map_card}
|