@arcgis/core 4.30.0-next.20240521 → 4.30.0-next.20240523
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WebMap.js +1 -1
- package/assets/components/assets/icon/developerCredentials16.json +1 -0
- package/assets/components/assets/icon/developerCredentials24.json +1 -0
- package/assets/components/assets/icon/developerCredentials32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{d7722531be4892293cb1.js → 00c49f6c84444e69f3a1.js} +1 -1
- package/assets/esri/core/workers/chunks/01927419855947110cc1.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{df26d7d07fed1f124fc2.js → 0903b492782dca69eb48.js} +1 -1
- package/assets/esri/core/workers/chunks/158c05b16372d8ed33ea.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/190913c221964292333b.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{2529a4b1e135223833f0.js → 2635ab64e75d4ec700a8.js} +1 -1
- package/assets/esri/core/workers/chunks/{f965644347007e3d68e2.js → 27dc94db9ed42b237ecb.js} +1 -1
- package/assets/esri/core/workers/chunks/{e727392db3b7998e5c28.js → 357707efc0cb8a1842c1.js} +1 -1
- package/assets/esri/core/workers/chunks/{0ae3ea7a73f3b5083968.js → 3a01cf7e3355f3c78378.js} +1 -1
- package/assets/esri/core/workers/chunks/4268373bf374b2a6252a.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/43e1c935452b489e422e.js +1 -0
- package/assets/esri/core/workers/chunks/{938b158a7edbbb8e08a1.js → 44f8b57b0d8cfeabda1f.js} +1 -1
- package/assets/esri/core/workers/chunks/{15212a82e283d6df2873.js → 4ae885f257660545ceeb.js} +1 -1
- package/assets/esri/core/workers/chunks/{4ea2ced4b5ea1c8a1cee.js → 4ba866a10711b6a8158f.js} +1 -1
- package/assets/esri/core/workers/chunks/50ee28a1944bde74a7c1.js +1 -0
- package/assets/esri/core/workers/chunks/{d745c2df59e5d6c7a1dd.js → 53aa9124c11c03f70521.js} +1 -1
- package/assets/esri/core/workers/chunks/59b193d42e8abf9d4088.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{eafbe663f7a61d3222c5.js → 5efe1300a39ab9c7bbab.js} +1 -1
- package/assets/esri/core/workers/chunks/{eac4ec8c410eaf9e621c.js → 606f8b907166190a8b65.js} +2 -2
- package/assets/esri/core/workers/chunks/{eac4ec8c410eaf9e621c.js.LICENSE.txt → 606f8b907166190a8b65.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/653da6469fe62e061efc.js +1 -0
- package/assets/esri/core/workers/chunks/{5349b0de83ae4be8afe2.js → 6c1ded9acf5c8be493ea.js} +1 -1
- package/assets/esri/core/workers/chunks/{46225ebc10a4398170b5.js → 712ba8ad69b1aab6f508.js} +1 -1
- package/assets/esri/core/workers/chunks/{7d210c2a5a135da2c37d.js → 7c68dc664c0b4cf2a46b.js} +1 -1
- package/assets/esri/core/workers/chunks/88c7d84a1fde246ca71f.js +1 -0
- package/assets/esri/core/workers/chunks/9b04a666726b5d2ff3c5.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/9c75837b7e75f0f38dc0.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/a6b138f330625d98f856.js +1 -0
- package/assets/esri/core/workers/chunks/{e4a0fd9e0f8887009b92.js → a8a19e5a7ae4ec16480a.js} +1 -1
- package/assets/esri/core/workers/chunks/{fcf0016d56df8a69f6c1.js → aa198e898b46c6e89d0b.js} +1 -1
- package/assets/esri/core/workers/chunks/b2562f5d0d5a44dc004e.js +1 -0
- package/assets/esri/core/workers/chunks/{04faa3bf4ef5a6f0ccb4.js → b3de9bc3e75476b0a7e9.js} +1 -1
- package/assets/esri/core/workers/chunks/{bd0545bb100b3393fd85.js → bbec62f8792520993909.js} +1 -1
- package/assets/esri/core/workers/chunks/bcd230d67bac27a1b36d.js +1 -0
- package/assets/esri/core/workers/chunks/bf6e75cc75d3bdfb70cb.js +1 -0
- package/assets/esri/core/workers/chunks/{5acac4616c53a95cc48f.js → c0c8e1a709648e1305c6.js} +1 -1
- package/assets/esri/core/workers/chunks/c80568ff68be908b3c30.js +1 -0
- package/assets/esri/core/workers/chunks/{85f24b441369e50e6ee1.js → c96ab8d56830b8ce07ed.js} +1 -1
- package/assets/esri/core/workers/chunks/{4f3a87586e334c52d0bf.js → caffbaa8b0a67d117f34.js} +1 -1
- package/assets/esri/core/workers/chunks/ccad364912ff1d85a9dc.js +1 -0
- package/assets/esri/core/workers/chunks/{7b4ed96554722be59ae2.js → d8140b5316e80d734155.js} +1 -1
- package/assets/esri/core/workers/chunks/dde183c6bb1710ff16df.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/e3711bc5b100b64cac3a.js +1 -0
- package/assets/esri/core/workers/chunks/{2d5d66cee7c3ec992bcd.js → e93e59f6907fa4c1081c.js} +1 -1
- package/assets/esri/images/portal/knowledgegraphlayer16.png +0 -0
- package/assets/esri/themes/base/widgets/_FeatureTable.scss +15 -1
- package/assets/esri/themes/base/widgets/_Grid.scss +4 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
- package/chunks/LineSeries.js +1 -1
- package/chunks/Theme.js +1 -1
- package/chunks/Tooltip.js +1 -1
- package/chunks/chartUtilsAm5.js +1 -1
- package/core/sql/WhereClause.js +1 -1
- package/core/workers/InvokeHandler.js +1 -1
- package/core/workers/RemoteClient.js +1 -1
- package/interfaces.d.ts +543 -77
- package/layers/BuildingSceneLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
- package/layers/mixins/OperationalLayer.js +1 -1
- package/layers/support/editableLayers.js +1 -1
- package/package.json +2 -2
- package/portal/PortalItem.js +1 -1
- package/portal/schemas/buildingSceneLayerItem.js +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
- package/rest/print.js +1 -1
- package/rest/support/printTaskUtils.js +1 -1
- package/smartMapping/renderers/support/referenceSizeUtils.js +1 -1
- package/smartMapping/support/adapters/support/layerUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
- package/views/2d/GoToManager.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/utils.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/PipelineConnectionHandlers.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/sources/strategies/AFetchLoadStrategy.js +1 -1
- package/views/2d/layers/support/FeatureCommandQueue.js +1 -1
- package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils.js +1 -1
- package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
- package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
- package/views/3d/interactive/editingTools/undoRecords.js +5 -0
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/widgets/CatalogLayerList/CatalogLayerListViewModel.d.ts +4 -0
- package/widgets/CatalogLayerList.d.ts +4 -0
- package/widgets/CatalogLayerList.js +1 -1
- package/widgets/DirectionalPad/DirectionalPadViewModel.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/FeatureForm/support/textManipulationUtils.js +1 -1
- package/widgets/FeatureTable/VisibleElements.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/LayerList/ListItemPanel.js +1 -1
- package/widgets/LayerList/support/layerListUtils.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
- package/assets/esri/core/workers/chunks/0753c636c2801f067235.js +0 -1
- package/assets/esri/core/workers/chunks/3716015ccf0888c0a21d.js +0 -1
- package/assets/esri/core/workers/chunks/3f86042d9c0cc2d9acba.js +0 -1
- package/assets/esri/core/workers/chunks/50936725c9bd23b780ef.js +0 -1
- package/assets/esri/core/workers/chunks/5c8c5290b9fcb5a4468f.js +0 -1
- package/assets/esri/core/workers/chunks/95fb6643bd54d354f266.js +0 -1
- package/assets/esri/core/workers/chunks/aa020d495f464eff0134.js +0 -1
- package/assets/esri/core/workers/chunks/b52295fa9cf2f3244b65.js +0 -1
- package/assets/esri/core/workers/chunks/cbb3a56e4072cdf25a9d.js +0 -1
- package/assets/esri/core/workers/chunks/f4f1e1c1758542434384.js +0 -1
- package/assets/esri/core/workers/chunks/fb48e8e42379fdf8a094.js +0 -1
- package/views/3d/interactive/editingTools/transform/undoRecords.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../core/Error.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{combineTimeExtent as a}from"../../layers/support/timeSupport.js";import{getDefaultDatumTransformationForDataset as o,projectDatasetExtent as n}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{getFetchPopupTemplate as l}from"./support/popupUtils.js";const u=u=>{let p=class extends u{constructor(){super(...arguments),this._rasterFieldPrefix="Raster.",this.layer=null,this.view=null,this.tileInfo=null}get fullExtent(){return this._getfullExtent()}get timeExtent(){return a(this.layer,this.view?.timeExtent,this._get("timeExtent"))}get hasTilingEffects(){return!!(this.layer.renderer&&"dynamicRangeAdjustment"in this.layer.renderer&&this.layer.renderer.dynamicRangeAdjustment)}get datumTransformation(){return o(this.layer.fullExtent,this.view.spatialReference,!0)}supportsSpatialReference(e){return!!n(this.layer.serviceRasterInfo,e)}async fetchPopupFeaturesAtLocation(e,i){const{layer:s}=this;if(!e)throw new r("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:s});const{popupEnabled:a}=s,o=l(s,i);if(!a||null==o)return[];const n=[],{value:u,magdirValue:p,processedValue:c}=await s.identify(e,{timeExtent:this.timeExtent,signal:i?.signal});let m="";if(u?.length){m="imagery-tile"===s.type&&s.hasStandardTime()&&null!=u[0]?u.map((e=>s.getStandardTimeValue(e))).join(", "):u.join(", ");const e={ObjectId:0},r="Raster.ServicePixelValue";e[r]="imagery-tile"===s.type&&"Function"===s.raster.datasetFormat?c?.join(", "):m,e[r+".Raw"]=m;const i=s.serviceRasterInfo?.attributeTable;if(null!=
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../core/Error.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{combineTimeExtent as a}from"../../layers/support/timeSupport.js";import{getDefaultDatumTransformationForDataset as o,projectDatasetExtent as n}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{getFetchPopupTemplate as l}from"./support/popupUtils.js";const u=u=>{let p=class extends u{constructor(){super(...arguments),this._rasterFieldPrefix="Raster.",this.layer=null,this.view=null,this.tileInfo=null}get fullExtent(){return this._getfullExtent()}get timeExtent(){return a(this.layer,this.view?.timeExtent,this._get("timeExtent"))}get hasTilingEffects(){return!!(this.layer.renderer&&"dynamicRangeAdjustment"in this.layer.renderer&&this.layer.renderer.dynamicRangeAdjustment)}get datumTransformation(){return o(this.layer.fullExtent,this.view.spatialReference,!0)}supportsSpatialReference(e){return!!n(this.layer.serviceRasterInfo,e)}async fetchPopupFeaturesAtLocation(e,i){const{layer:s}=this;if(!e)throw new r("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:s});const{popupEnabled:a}=s,o=l(s,i);if(!a||null==o)return[];const n=[],{value:u,magdirValue:p,processedValue:c}=await s.identify(e,{timeExtent:this.timeExtent,signal:i?.signal});let m="";if(u?.length){m="imagery-tile"===s.type&&s.hasStandardTime()&&null!=u[0]?u.map((e=>s.getStandardTimeValue(e))).join(", "):u.join(", ");const e={ObjectId:0},r="Raster.ServicePixelValue";e[r]="imagery-tile"===s.type&&"Function"===s.raster.datasetFormat?c?.join(", "):m,e[r+".Raw"]=m;const i=s.raster?.rasterInfo??s.serviceRasterInfo,a=i?.attributeTable;if(null!=a){const{fields:t,features:i}=a,s=t.find((({name:e})=>"value"===e.toLowerCase())),o=e[r],n=s?i.find((e=>String(e.attributes[s.name])===o)):null;if(n)for(const r in n.attributes)if(n.attributes.hasOwnProperty(r)){e[this._rasterFieldPrefix+r]=n.attributes[r]}}const o=i?.dataType;"vector-magdir"!==o&&"vector-uv"!==o||(e["Raster.Magnitude"]=p?.[0],e["Raster.Direction"]=p?.[1]);const l=new t({geometry:this.fullExtent.clone(),attributes:e,layer:s,sourceLayer:s});n.push(l)}return n}_getfullExtent(){return n(this.layer.serviceRasterInfo,this.view.spatialReference)}};return e([i()],p.prototype,"fullExtent",null),e([i()],p.prototype,"layer",void 0),e([i({readOnly:!0})],p.prototype,"timeExtent",null),e([i()],p.prototype,"view",void 0),e([i()],p.prototype,"tileInfo",void 0),e([i({readOnly:!0})],p.prototype,"hasTilingEffects",null),e([i()],p.prototype,"datumTransformation",null),p=e([s("esri.views.layers.ImageryTileLayerView")],p),p};export{u as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{IdentifiableMixin as i}from"../core/Identifiable.js";import o from"../core/ReactiveMap.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{getActionIcon as n,getActionStyles as r}from"../support/actions/actionUtils.js";import a from"./Widget.js";import c from"./CatalogLayerList/CatalogLayerListViewModel.js";import d from"./CatalogLayerList/CatalogLayerListVisibleElements.js";import{css as m}from"./CatalogLayerList/css.js";import p from"./LayerList/ListItem.js";import{minDragEnabledItems as u,minFilterItems as h,getItem as g,listItemHasChildren as v,areChildrenHidden as y,getStatusIcon as f,getVisibilityIcon as _}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as I}from"./support/componentsUtils.js";import{globalCss as b}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as w}from"./support/decorators/messageBundle.js";import{vmEvent as L}from"./support/decorators/vmEvent.js";import{tsx as A}from"./support/jsxFactory.js";const C=t.ofType(p);let M=class extends(i(a)){constructor(e,t){super(e,t),this._activeItem=null,this._tooltipReferenceMap=new o,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._rootGroupUid=`operational-${this.uid}`,this.collapsed=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=u,this.minFilterItems=h,this.selectedItems=new C,this.selectionMode="none",this.viewModel=new c,this.visibilityAppearance="default",this.visibleElements=new d,this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(m.item)));this._activeItem=g(t)}}loadDependencies(){return I({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._tooltipReferenceMap.clear()}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.visibleElements.filter}get catalogItems(){return this.viewModel.catalogItems}set catalogItems(e){this.viewModel.catalogItems=e}get catalogLayer(){return this.viewModel.catalogLayer}set catalogLayer(e){this.viewModel.catalogLayer=e}get icon(){return"catalog-dataset"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[b.hidden]:"loading"===e,[b.disabled]:"disabled"===e},i=this.catalogItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)));return A("div",{class:this.classes(m.base,b.widget,b.panel,t)},i?.length?[this._renderItemTooltips(i),this._renderItems(i)]:this._renderNoItems())}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?A("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:t.get(e.layer.uid)},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return A("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return A("div",{class:m.itemMessage,key:"esri-layer-list__no-items"},A("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)).toArray().map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return A("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),A("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderItems(e){const{visible:t,collapsed:i,_filterEnabled:o,_rootGroupUid:s,visibleElements:{closeButton:l,collapseButton:n,heading:r,flow:a},selectionMode:c,filterText:d,filterPlaceholder:p,messages:u}=this,h=[A("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:l,closed:!t,collapsed:i,collapsible:n,heading:r?u.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},A("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},"data-layer-type":s,filterEnabled:o,filterPlaceholder:p,filterText:o?d:"",group:s,key:"root-list",label:u.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:c,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListFilter:e=>this.filterText=e.target?.filterText??""},e?.toArray().map((e=>this._renderItem(e))),e?.length&&o?A("div",{class:m.filterNoResults,slot:"filter-no-results"},A("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(e)];return t?a?A("calcite-flow",{key:"root-flow"},h):h:null}_renderChildList(e,t=[]){const{_rootGroupUid:i,viewModel:{listModeDisabled:o},selectionMode:s}=this,{children:l}=e,n=v(e),r=!(!o&&y(e.layer))&&!n&&"group"===e.layer?.type;return n||r?A("calcite-list",{"data-item":e,"data-layer-type":i,group:`${i}-${e.layer.uid}`,key:`child-list-${e.layer.uid}`,selectionAppearance:"border",selectionMode:s},l?.filter((e=>!e.hidden)).toArray().map((i=>this._renderItem(i,e,[...t,e.title])))):null}_renderItemMessage(e){return e.error?A("div",{class:m.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},A("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},A("div",{slot:"message"},this.messages.layerError))):e.incompatible?A("div",{class:m.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},A("calcite-notice",{afterCreate:t=>this._setTooltipReference(t,e),afterRemoved:()=>this._removeTooltipReference(e),bind:this,icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},A("div",{slot:"message"},this.messages.layerIncompatible))):null}_getLayerTitle(e){return e.title||this.messages.untitledLayer}_renderItem(e,t,i){const{_activeItem:o,selectionMode:s,selectedItems:l,messages:n}=this,r=this._getLayerTitle(e),a=e.visibleAtCurrentScale?r:`${r} (${n.layerInvisibleAtScale})`,c=this._filterActions(e.actionsSections),d=this._countActions(c);return A("calcite-list-item",{class:this.classes(m.item,{[m.itemActive]:o===e}),"data-item":e,"data-layer-id":e.layer.id,id:e.layer.uid,key:`list-item-${e.layer.uid}`,label:r,metadata:{parentTitles:i,title:r},open:e.open,selected:"none"!==s&&l.includes(e),title:a,value:e.layer.uid,onCalciteListItemSelect:i=>this._handleCalciteListItemSelect(i,e,t),onCalciteListItemToggle:t=>this._handleCalciteListItemToggle(t,e)},A("div",{class:this.classes({[m.itemContent]:!0,[m.itemInvisibleAtScale]:!e.visibleAtCurrentScale}),slot:"content"},r),this._renderItemStatus(e,t),this._renderItemToggle(e,t),this._renderItemTemporaryIcon(e),this._renderChildList(e,i),this._renderItemMessage(e),this._renderPanel(e.panel),this._renderPanelAction(e.panel),d>1?this._renderActionsSections(e,c):1===d?this._renderAction({item:e,action:this._getSingleAction(c),textEnabled:!1}):null)}_renderItemStatus(e,t){const{visibleElements:i}=this;if(!i.statusIndicators)return null;const{connectionStatus:o,publishing:s,updating:l}=e,n=l&&!t,r=!!o;return A("calcite-icon",{class:this.classes({[m.statusIndicator]:!0,[m.publishing]:s,[m.updating]:n,[m.connectionStatus]:r,[m.connectionStatusConnected]:r&&"connected"===o}),icon:f({connectionStatus:o,publishing:s}),key:"layer-item-status",scale:"s",slot:"actions-end"})}_renderItemTemporaryIcon(e){return this.visibleElements.temporaryLayerIndicators&&"persistenceEnabled"in e.layer&&!e.layer.persistenceEnabled?A("calcite-icon",{class:m.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"actions-start",title:this.messages.temporary}):null}_renderItemToggle(e,t){const{messages:i,visibilityAppearance:o}=this,{visible:s}=e,l=t?.visibilityMode;if("inherited"===l)return null;const n=_({visible:s,exclusive:"exclusive"===l,visibilityAppearance:o}),r="checkbox"===o,a=i.layerVisibility;return A("calcite-action",{appearance:"transparent",class:m.visibleToggle,icon:r?n:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:r?"actions-start":"actions-end",text:a,title:a},r?null:A("calcite-icon",{class:this.classes({[m.visibleIcon]:"exclusive"!==l&&s}),icon:n,scale:"s"}))}_renderPanel(e){return!e?.open||e.disabled||e.flowEnabled?null:A("div",{class:m.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}_renderPanelAction(e){if(!e?.visible)return null;const{open:t,title:i,disabled:o}=e;return A("calcite-action",{active:t,appearance:"transparent",disabled:o,icon:n(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}_renderActionsSections(e,t){const i=this.messagesCommon.options;return A("calcite-action-menu",{appearance:"transparent",key:"item-action-menu",label:this.messagesCommon.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:t=>e.actionsOpen=t.target.open},A("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:i,title:i}),t.toArray().map(((t,i)=>this._renderActionSection(e,t,i))))}_renderActionSection(e,t,i){return A("calcite-action-group",{key:`action-section-${i}`},t.toArray().map((t=>this._renderAction({item:e,action:t,textEnabled:!0}))))}_renderFallbackIcon(e){const{className:t,icon:i}=e;if(i)return null;const o="image"in e?e.image:void 0,s={[m.itemActionIcon]:!!t,[m.itemActionImage]:!!o};return t&&(s[t]=!0),o||t?A("span",{"aria-hidden":"true",class:this.classes(m.itemActionIcon,s),key:"icon",styles:r(o)}):null}_renderAction(e){const{item:t,action:i,textEnabled:o}=e;if(!i)return null;const{active:s,disabled:l,title:r,type:a,indicator:c}=i;return A("calcite-action",{active:"toggle"===a&&i.value,appearance:"transparent",disabled:l,icon:n(i),indicator:c,key:`action-${i.uid}`,loading:s,onclick:()=>this._triggerAction(t,i),scale:"s",slot:o?void 0:"actions-end",text:r??"",textEnabled:o,title:r??void 0},this._renderFallbackIcon(i))}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.layer.uid,e)}_removeTooltipReference(e){this._tooltipReferenceMap.delete(e.layer.uid)}_getSingleAction(e){return e.reduce((e=>e)).find((e=>e&&("button"===e.type||"toggle"===e.type)))}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.triggerAction(t,e))}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>g(e))).filter(Boolean);i.removeAll(),i.addMany(o)}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_handleCalciteListItemSelect(e,t,i){g(e.target)===t&&"none"===this.selectionMode&&"inherited"!==i?.visibilityMode&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&(this._focusPanelFlowItem=!0)}_toggleVisibility(e,t){if(!e)return;const i=t?.visibilityMode;"exclusive"===i&&e.visible||(e.visible=!e.visible)}};e([s()],M.prototype,"_activeItem",void 0),e([s()],M.prototype,"_tooltipReferenceMap",void 0),e([s()],M.prototype,"_focusRootFlowItem",void 0),e([s()],M.prototype,"_focusPanelFlowItem",void 0),e([s()],M.prototype,"_filterEnabled",null),e([s()],M.prototype,"catalogItems",null),e([s()],M.prototype,"catalogLayer",null),e([s()],M.prototype,"collapsed",void 0),e([s()],M.prototype,"filterPlaceholder",void 0),e([s()],M.prototype,"filterText",void 0),e([s()],M.prototype,"headingLevel",void 0),e([s()],M.prototype,"icon",null),e([s()],M.prototype,"label",null),e([s()],M.prototype,"listItemCreatedFunction",null),e([s(),w("esri/widgets/CatalogLayerList/t9n/CatalogLayerList")],M.prototype,"messages",void 0),e([s(),w("esri/t9n/common")],M.prototype,"messagesCommon",void 0),e([s()],M.prototype,"minDragEnabledItems",void 0),e([s()],M.prototype,"minFilterItems",void 0),e([s()],M.prototype,"selectedItems",void 0),e([s()],M.prototype,"selectionMode",void 0),e([s()],M.prototype,"view",null),e([L("trigger-action"),s({type:c})],M.prototype,"viewModel",void 0),e([s()],M.prototype,"visibilityAppearance",void 0),e([s({type:d,nonNullable:!0})],M.prototype,"visibleElements",void 0),M=e([l("esri.widgets.CatalogLayerList")],M);const F=M;export{F as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{IdentifiableMixin as i}from"../core/Identifiable.js";import o from"../core/ReactiveMap.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{getActionIcon as n,getActionStyles as r}from"../support/actions/actionUtils.js";import a from"./Widget.js";import c from"./CatalogLayerList/CatalogLayerListViewModel.js";import d from"./CatalogLayerList/CatalogLayerListVisibleElements.js";import{css as m}from"./CatalogLayerList/css.js";import p from"./LayerList/ListItem.js";import{minFilterItems as u,getItem as h,listItemHasChildren as g,areChildrenHidden as v,getStatusIcon as y,getVisibilityIcon as f}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import{globalCss as I}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import{vmEvent as w}from"./support/decorators/vmEvent.js";import{tsx as L}from"./support/jsxFactory.js";const A=t.ofType(p);let C=class extends(i(a)){constructor(e,t){super(e,t),this._activeItem=null,this._tooltipReferenceMap=new o,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._rootGroupUid=`operational-${this.uid}`,this.collapsed=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.minFilterItems=u,this.selectedItems=new A,this.selectionMode="none",this.viewModel=new c,this.visibilityAppearance="default",this.visibleElements=new d,this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(m.item)));this._activeItem=h(t)}}loadDependencies(){return _({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._tooltipReferenceMap.clear()}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.visibleElements.filter}get catalogItems(){return this.viewModel.catalogItems}set catalogItems(e){this.viewModel.catalogItems=e}get catalogLayer(){return this.viewModel.catalogLayer}set catalogLayer(e){this.viewModel.catalogLayer=e}get icon(){return"catalog-dataset"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[I.hidden]:"loading"===e,[I.disabled]:"disabled"===e},i=this.catalogItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)));return L("div",{class:this.classes(m.base,I.widget,I.panel,t)},i?.length?[this._renderItemTooltips(i),this._renderItems(i)]:this._renderNoItems())}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?L("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:t.get(e.layer.uid)},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return L("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return L("div",{class:m.itemMessage,key:"esri-layer-list__no-items"},L("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)).toArray().map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return L("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),L("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderItems(e){const{visible:t,collapsed:i,_filterEnabled:o,_rootGroupUid:s,visibleElements:{closeButton:l,collapseButton:n,heading:r,flow:a},selectionMode:c,filterText:d,filterPlaceholder:p,messages:u}=this,h=[L("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:l,closed:!t,collapsed:i,collapsible:n,heading:r?u.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},L("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},"data-layer-type":s,filterEnabled:o,filterPlaceholder:p,filterText:o?d:"",group:s,key:"root-list",label:u.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:c,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListFilter:e=>this.filterText=e.target?.filterText??""},e?.toArray().map((e=>this._renderItem(e))),e?.length&&o?L("div",{class:m.filterNoResults,slot:"filter-no-results"},L("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(e)];return t?a?L("calcite-flow",{key:"root-flow"},h):h:null}_renderChildList(e,t=[]){const{_rootGroupUid:i,viewModel:{listModeDisabled:o},selectionMode:s}=this,{children:l}=e,n=g(e),r=!(!o&&v(e.layer))&&!n&&"group"===e.layer?.type;return n||r?L("calcite-list",{"data-item":e,"data-layer-type":i,group:`${i}-${e.layer.uid}`,key:`child-list-${e.layer.uid}`,selectionAppearance:"border",selectionMode:s},l?.filter((e=>!e.hidden)).toArray().map((i=>this._renderItem(i,e,[...t,e.title])))):null}_renderItemMessage(e){return e.error?L("div",{class:m.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},L("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},L("div",{slot:"message"},this.messages.layerError))):e.incompatible?L("div",{class:m.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},L("calcite-notice",{afterCreate:t=>this._setTooltipReference(t,e),afterRemoved:()=>this._removeTooltipReference(e),bind:this,icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},L("div",{slot:"message"},this.messages.layerIncompatible))):null}_getLayerTitle(e){return e.title||this.messages.untitledLayer}_renderItem(e,t,i){const{_activeItem:o,selectionMode:s,selectedItems:l,messages:n}=this,r=this._getLayerTitle(e),a=e.visibleAtCurrentScale?r:`${r} (${n.layerInvisibleAtScale})`,c=this._filterActions(e.actionsSections),d=this._countActions(c);return L("calcite-list-item",{class:this.classes(m.item,{[m.itemActive]:o===e}),"data-item":e,"data-layer-id":e.layer.id,id:e.layer.uid,key:`list-item-${e.layer.uid}`,label:r,metadata:{parentTitles:i,title:r},open:e.open,selected:"none"!==s&&l.includes(e),title:a,value:e.layer.uid,onCalciteListItemSelect:i=>this._handleCalciteListItemSelect(i,e,t),onCalciteListItemToggle:t=>this._handleCalciteListItemToggle(t,e)},L("div",{class:this.classes({[m.itemContent]:!0,[m.itemInvisibleAtScale]:!e.visibleAtCurrentScale}),slot:"content"},r),this._renderItemStatus(e,t),this._renderItemToggle(e,t),this._renderItemTemporaryIcon(e),this._renderChildList(e,i),this._renderItemMessage(e),this._renderPanel(e.panel),this._renderPanelAction(e.panel),d>1?this._renderActionsSections(e,c):1===d?this._renderAction({item:e,action:this._getSingleAction(c),textEnabled:!1}):null)}_renderItemStatus(e,t){const{visibleElements:i}=this;if(!i.statusIndicators)return null;const{connectionStatus:o,publishing:s,updating:l}=e,n=l&&!t,r=!!o;return L("calcite-icon",{class:this.classes({[m.statusIndicator]:!0,[m.publishing]:s,[m.updating]:n,[m.connectionStatus]:r,[m.connectionStatusConnected]:r&&"connected"===o}),icon:y({connectionStatus:o,publishing:s}),key:"layer-item-status",scale:"s",slot:"actions-end"})}_renderItemTemporaryIcon(e){return this.visibleElements.temporaryLayerIndicators&&"persistenceEnabled"in e.layer&&!e.layer.persistenceEnabled?L("calcite-icon",{class:m.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"actions-start",title:this.messages.temporary}):null}_renderItemToggle(e,t){const{messages:i,visibilityAppearance:o}=this,{visible:s}=e,l=t?.visibilityMode;if("inherited"===l)return null;const n=f({visible:s,exclusive:"exclusive"===l,visibilityAppearance:o}),r="checkbox"===o,a=i.layerVisibility;return L("calcite-action",{appearance:"transparent",class:m.visibleToggle,icon:r?n:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:r?"actions-start":"actions-end",text:a,title:a},r?null:L("calcite-icon",{class:this.classes({[m.visibleIcon]:"exclusive"!==l&&s}),icon:n,scale:"s"}))}_renderPanel(e){return!e?.open||e.disabled||e.flowEnabled?null:L("div",{class:m.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}_renderPanelAction(e){if(!e?.visible)return null;const{open:t,title:i,disabled:o}=e;return L("calcite-action",{active:t,appearance:"transparent",disabled:o,icon:n(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}_renderActionsSections(e,t){const i=this.messagesCommon.options;return L("calcite-action-menu",{appearance:"transparent",key:"item-action-menu",label:this.messagesCommon.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:t=>e.actionsOpen=t.target.open},L("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:i,title:i}),t.toArray().map(((t,i)=>this._renderActionSection(e,t,i))))}_renderActionSection(e,t,i){return L("calcite-action-group",{key:`action-section-${i}`},t.toArray().map((t=>this._renderAction({item:e,action:t,textEnabled:!0}))))}_renderFallbackIcon(e){const{className:t,icon:i}=e;if(i)return null;const o="image"in e?e.image:void 0,s={[m.itemActionIcon]:!!t,[m.itemActionImage]:!!o};return t&&(s[t]=!0),o||t?L("span",{"aria-hidden":"true",class:this.classes(m.itemActionIcon,s),key:"icon",styles:r(o)}):null}_renderAction(e){const{item:t,action:i,textEnabled:o}=e;if(!i)return null;const{active:s,disabled:l,title:r,type:a,indicator:c}=i;return L("calcite-action",{active:"toggle"===a&&i.value,appearance:"transparent",disabled:l,icon:n(i),indicator:c,key:`action-${i.uid}`,loading:s,onclick:()=>this._triggerAction(t,i),scale:"s",slot:o?void 0:"actions-end",text:r??"",textEnabled:o,title:r??void 0},this._renderFallbackIcon(i))}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.layer.uid,e)}_removeTooltipReference(e){this._tooltipReferenceMap.delete(e.layer.uid)}_getSingleAction(e){return e.reduce((e=>e)).find((e=>e&&("button"===e.type||"toggle"===e.type)))}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.triggerAction(t,e))}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>h(e))).filter(Boolean);i.removeAll(),i.addMany(o)}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_handleCalciteListItemSelect(e,t,i){h(e.target)===t&&"none"===this.selectionMode&&"inherited"!==i?.visibilityMode&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&(this._focusPanelFlowItem=!0)}_toggleVisibility(e,t){if(!e)return;const i=t?.visibilityMode;"exclusive"===i&&e.visible||(e.visible=!e.visible)}};e([s()],C.prototype,"_activeItem",void 0),e([s()],C.prototype,"_tooltipReferenceMap",void 0),e([s()],C.prototype,"_focusRootFlowItem",void 0),e([s()],C.prototype,"_focusPanelFlowItem",void 0),e([s()],C.prototype,"_filterEnabled",null),e([s()],C.prototype,"catalogItems",null),e([s()],C.prototype,"catalogLayer",null),e([s()],C.prototype,"collapsed",void 0),e([s()],C.prototype,"filterPlaceholder",void 0),e([s()],C.prototype,"filterText",void 0),e([s()],C.prototype,"headingLevel",void 0),e([s()],C.prototype,"icon",null),e([s()],C.prototype,"label",null),e([s()],C.prototype,"listItemCreatedFunction",null),e([s(),b("esri/widgets/CatalogLayerList/t9n/CatalogLayerList")],C.prototype,"messages",void 0),e([s(),b("esri/t9n/common")],C.prototype,"messagesCommon",void 0),e([s()],C.prototype,"minFilterItems",void 0),e([s()],C.prototype,"selectedItems",void 0),e([s()],C.prototype,"selectionMode",void 0),e([s()],C.prototype,"view",null),e([w("trigger-action"),s({type:c})],C.prototype,"viewModel",void 0),e([s()],C.prototype,"visibilityAppearance",void 0),e([s({type:d,nonNullable:!0})],C.prototype,"visibleElements",void 0),C=e([l("esri.widgets.CatalogLayerList")],C);const M=C;export{M as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Evented.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{directionalPadMoveOnceDuration as s}from"./constants.js";import{css as n}from"./css.js";import{angleToUnitVector as r,toUnitVector as v,vectorToClosestAngle as m}from"./utils.js";import{GoToMixin as a}from"../support/GoTo.js";let d=class extends(a(e.EventedAccessor)){constructor(t){super(t),this._initialAngle=void 0,this._movementVector=void 0,this._widgetCenter=void 0,this._anyAngleMovementEnabled=!1,this._movementTimeout=void 0,this._disabled=!1,this._moveOnceDuration=s,this.angle=void 0,this.speed=1,this.beginFollowingPointer=(t,e)=>{if(this.disabled)return;this._widgetCenter=e;const o=this._pointerLocationToVector(t);if(void 0===o)return;const i=this._resolveClosestAngle(t,o);void 0!==i&&(this._emitMove(r(i)),this.angle=i,this._initialAngle=i,this._setMovementTimeout((()=>{void 0===this._widgetCenter&&this._stopMovement()})),document.addEventListener("pointermove",this._onPointerMove,{passive:!0}),document.addEventListener("pointerup",this._onPointerUp,{passive:!0,once:!0}))},this.moveOnce=t=>{const e=r(t);this._emitMove(e),this._setMovementTimeout(this._stopMovement)},this._pointerLocationToVector=t=>{if(void 0===this._widgetCenter)return;const{x:e,y:o}=v(this._widgetCenter,t);return{x:e,y:-o}},this._resolveClosestAngle=(t,e)=>{const o=t.target,i=o?.getAttribute?.("data-angle"),s=o?.classList?.contains(n.compassButton);if(s)return;const r=Number.parseInt(i??"",10);return Number.isNaN(r)?m(e):r},this._onPointerMove=t=>{if(0===t.buttons)return void this._stopMovement();const e=this._pointerLocationToVector(t);if(void 0===e)return;this._setMovementTimeout(void 0);const o=this._resolveClosestAngle(t,e);if(void 0===o)return void this._emitStop();const i=r(o),s=null!=this._initialAngle&&this._initialAngle!==o;this._anyAngleMovementEnabled||=s;const n=this._anyAngleMovementEnabled?e:i;(n.x!==this._movementVector?.x||n.y!==this._movementVector?.y)&&(this.angle=o,this._emitMove(n))},this._onPointerUp=()=>{void 0===this._movementTimeout?this._stopMovement():this._widgetCenter=void 0},this._stopMovement=()=>{this._emitStop(),this._widgetCenter=void 0,this._initialAngle=void 0,this._anyAngleMovementEnabled=!1,document.removeEventListener("pointermove",this._onPointerMove),document.removeEventListener("pointerup",this._stopMovement),this._setMovementTimeout(void 0)},this.on("move-start",(()=>this.view?.mapViewNavigation.begin())),this.on("move-direction-change",(({vector:{x:t,y:e}})=>this.view?.mapViewNavigation.continuousPanVector({x:t*this.speed,y:e*this.speed}))),this.on("move-stop",(()=>this.view?.mapViewNavigation.stop()))}destroy(){this._stopMovement()}get disabled(){const{view:t,_disabled:e,supported:o}=this;return!1===t?.ready||e||!o}set disabled(t){this._disabled=t}get rotation(){return this.view?.rotation??this._get("rotation")??0}set rotation(t){this.view?this.view.constraints.rotationEnabled&&this.callGoTo({target:{rotation:t},options:{animate:0===t}}):this._set("rotation",t)}get supported(){return null==this.view||"2d"===this.view.type}get state(){const{disabled:t,angle:e}=this;return t?"disabled":null!=e?"moving":"ready"}_setMovementTimeout(t){clearTimeout(this._movementTimeout),this._movementTimeout=void 0===t?void 0:setTimeout((()=>{this._movementTimeout=void 0,t()}),this._moveOnceDuration)}_emitMove(t){null==this._movementVector&&this._emitMoveStartEvent({vector:t});const e=this._movementVector;this._movementVector=t,this._emitMoveDirectionChangeEvent({vector:t,oldVector:e})}_emitStop(){this.angle=void 0,void 0!==this._movementVector&&(this._emitMoveStopEvent({oldVector:this._movementVector}),this._movementVector=void 0)}_emitMoveStartEvent(t){this.emit("move-start",{...t,type:"move-start"})}_emitMoveDirectionChangeEvent(t){this.emit("move-direction-change",{...t,type:"move-direction-change"})}_emitMoveStopEvent(t){this.emit("move-stop",{...t,type:"move-stop"})}};t([o()],d.prototype,"_initialAngle",void 0),t([o()],d.prototype,"_movementVector",void 0),t([o()],d.prototype,"_widgetCenter",void 0),t([o()],d.prototype,"_anyAngleMovementEnabled",void 0),t([o()],d.prototype,"_movementTimeout",void 0),t([o()],d.prototype,"_disabled",void 0),t([o()],d.prototype,"_moveOnceDuration",void 0),t([o()],d.prototype,"disabled",null),t([o()],d.prototype,"angle",void 0),t([o({type:Number,range:{min:0,max:100}})],d.prototype,"speed",void 0),t([o()],d.prototype,"rotation",null),t([o()],d.prototype,"supported",null),t([o({readOnly:!0})],d.prototype,"state",null),t([o()],d.prototype,"view",void 0),d=t([i("esri.widgets.DirectionalPad.DirectionalPadViewModel")],d);const h=d;export{h as default};
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Evented.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{directionalPadMoveOnceDuration as s}from"./constants.js";import{css as n}from"./css.js";import{angleToUnitVector as r,toUnitVector as v,vectorToClosestAngle as m}from"./utils.js";import{GoToMixin as a}from"../support/GoTo.js";let d=class extends(a(e.EventedAccessor)){constructor(t){super(t),this._initialAngle=void 0,this._movementVector=void 0,this._widgetCenter=void 0,this._anyAngleMovementEnabled=!1,this._movementTimeout=void 0,this._disabled=!1,this._moveOnceDuration=s,this.angle=void 0,this.speed=1,this.beginFollowingPointer=(t,e)=>{if(this.disabled)return;this._widgetCenter=e;const o=this._pointerLocationToVector(t);if(void 0===o)return;const i=this._resolveClosestAngle(t,o);void 0!==i&&(this._emitMove(r(i)),this.angle=i,this._initialAngle=i,this._setMovementTimeout((()=>{void 0===this._widgetCenter&&this._stopMovement()})),document.addEventListener("pointermove",this._onPointerMove,{passive:!0}),document.addEventListener("pointerup",this._onPointerUp,{passive:!0,once:!0}))},this.moveOnce=t=>{const e=r(t);this._emitMove(e),this._setMovementTimeout(this._stopMovement)},this._pointerLocationToVector=t=>{if(void 0===this._widgetCenter)return;const{x:e,y:o}=v(this._widgetCenter,t);return{x:e,y:-o}},this._resolveClosestAngle=(t,e)=>{const o=t.target,i=o?.getAttribute?.("data-angle"),s=o?.classList?.contains(n.compassButton);if(s)return;const r=Number.parseInt(i??"",10);return Number.isNaN(r)?m(e):r},this._onPointerMove=t=>{if(0===t.buttons)return void this._stopMovement();const e=this._pointerLocationToVector(t);if(void 0===e)return;this._setMovementTimeout(void 0);const o=this._resolveClosestAngle(t,e);if(void 0===o)return void this._emitStop();const i=r(o),s=null!=this._initialAngle&&this._initialAngle!==o;this._anyAngleMovementEnabled||=s;const n=this._anyAngleMovementEnabled?e:i;(n.x!==this._movementVector?.x||n.y!==this._movementVector?.y)&&(this.angle=o,this._emitMove(n))},this._onPointerUp=()=>{void 0===this._movementTimeout?this._stopMovement():this._widgetCenter=void 0},this._stopMovement=()=>{this._emitStop(),this._widgetCenter=void 0,this._initialAngle=void 0,this._anyAngleMovementEnabled=!1,document.removeEventListener("pointermove",this._onPointerMove),document.removeEventListener("pointerup",this._stopMovement),this._setMovementTimeout(void 0)},this.on("move-start",(()=>this.view?.mapViewNavigation.begin())),this.on("move-direction-change",(({vector:{x:t,y:e}})=>this.view?.mapViewNavigation.continuousPanVector({x:t*this.speed,y:e*this.speed}))),this.on("move-stop",(()=>this.view?.mapViewNavigation.stop()))}destroy(){this._stopMovement()}get disabled(){const{view:t,_disabled:e,supported:o}=this;return!1===t?.ready||e||!o}set disabled(t){this._disabled=t}get rotation(){return this.view?.rotation??this._get("rotation")??0}set rotation(t){this.view?this.view.constraints.rotationEnabled&&this.callGoTo({target:{rotation:t},options:{animate:0===t&&void 0}}):this._set("rotation",t)}get supported(){return null==this.view||"2d"===this.view.type}get state(){const{disabled:t,angle:e}=this;return t?"disabled":null!=e?"moving":"ready"}_setMovementTimeout(t){clearTimeout(this._movementTimeout),this._movementTimeout=void 0===t?void 0:setTimeout((()=>{this._movementTimeout=void 0,t()}),this._moveOnceDuration)}_emitMove(t){null==this._movementVector&&this._emitMoveStartEvent({vector:t});const e=this._movementVector;this._movementVector=t,this._emitMoveDirectionChangeEvent({vector:t,oldVector:e})}_emitStop(){this.angle=void 0,void 0!==this._movementVector&&(this._emitMoveStopEvent({oldVector:this._movementVector}),this._movementVector=void 0)}_emitMoveStartEvent(t){this.emit("move-start",{...t,type:"move-start"})}_emitMoveDirectionChangeEvent(t){this.emit("move-direction-change",{...t,type:"move-direction-change"})}_emitMoveStopEvent(t){this.emit("move-stop",{...t,type:"move-stop"})}};t([o()],d.prototype,"_initialAngle",void 0),t([o()],d.prototype,"_movementVector",void 0),t([o()],d.prototype,"_widgetCenter",void 0),t([o()],d.prototype,"_anyAngleMovementEnabled",void 0),t([o()],d.prototype,"_movementTimeout",void 0),t([o()],d.prototype,"_disabled",void 0),t([o()],d.prototype,"_moveOnceDuration",void 0),t([o()],d.prototype,"disabled",null),t([o()],d.prototype,"angle",void 0),t([o({type:Number,range:{min:0,max:100}})],d.prototype,"speed",void 0),t([o()],d.prototype,"rotation",null),t([o()],d.prototype,"supported",null),t([o({readOnly:!0})],d.prototype,"state",null),t([o()],d.prototype,"view",void 0),d=t([i("esri.widgets.DirectionalPad.DirectionalPadViewModel")],d);const h=d;export{h as default};
|
package/widgets/Expand.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import s from"./Expand/ExpandViewModel.js";import{loadCalciteComponents as l}from"./support/componentsUtils.js";import{globalCss as i}from"./support/globalCss.js";import{isWidget as r,hasDomNode as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import n from"./Widget.js";import s from"./Expand/ExpandViewModel.js";import{loadCalciteComponents as l}from"./support/componentsUtils.js";import{globalCss as i}from"./support/globalCss.js";import{isWidget as r,hasDomNode as p}from"./support/widget.js";import{tsx as a}from"./support/jsxFactory.js";import{messageBundle as c}from"./support/decorators/messageBundle.js";const d="esri-expand",h={base:d,toggle:`${d}__toggle`,popoverContent:`${d}__popover-content`,panelContent:`${d}__panel-content`,sheet:`${d}__sheet`,panelIconNumber:`${d}__panel-icon-number`,contentContainer:`${d}__content-container`,icon:"esri-collapse__icon",iconFlip:"esri-collapse__icon-flip",iconExpanded:`${d}__icon--expanded`,iconNumber:`${d}__icon-number`,content:`${d}__content`,contentExpanded:`${d}__content--expanded`},u="chevrons-left",m="chevrons-right";let g=class extends n{constructor(e,t){super(e,t),this.closeOnEsc=!0,this.collapseTooltip="",this.content="",this.expandTooltip="",this.iconNumber=0,this.messages=null,this.messagesCommon=null,this.mode="auto",this.placement=null,this.viewModel=new s,this.toggle=()=>{this.viewModel.expanded=!this.viewModel.expanded},this._handlePopoverClose=e=>{e.target===this._popoverEl&&(this.viewModel.expanded=e.target.open)},this._handleSheetClose=e=>{this.viewModel.expanded=e.target.open},this._handlePanelClose=e=>{this.viewModel.expanded=!e.target.closed},this._handleKeyDown=e=>{this.viewModel.expanded&&"Escape"===e.key&&!this._willCloseOnEsc(e)&&e.preventDefault()},this._storeToggleButtonEl=e=>{this._toggleButtonEl=e},this._storePopoverEl=e=>{this._popoverEl=e}}loadDependencies(){return l({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel.js"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover.js"),sheet:()=>import("@esri/calcite-components/dist/components/calcite-sheet.js")})}get expandTitle(){const{expanded:e,messagesCommon:t,collapseTooltip:o,expandTooltip:n}=this;return(e?o||t?.collapse:n||t?.expand)??""}get _displaySheet(){switch(this.mode){case"drawer":return!0;case"auto":return"xsmall"===this.viewModel.view?.widthBreakpoint;default:return!1}}get autoCollapse(){return this.viewModel.autoCollapse}set autoCollapse(e){this.viewModel.autoCollapse=e}get collapseIcon(){return m}set collapseIcon(e){this._overrideIfSome("collapseIcon",e)}get expanded(){return this.viewModel.expanded}set expanded(e){this.viewModel.expanded=e}get expandIcon(){return r(this.content)?this.content.icon:u}set expandIcon(e){this._overrideIfSome("expandIcon",e)}get group(){return this.viewModel.group}set group(e){this.viewModel.group=e}get icon(){return null}get label(){return(r(this.content)?this.content.label:null)??this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}expand(){this.viewModel.expanded=!0}collapse(){this.viewModel.expanded=!1}render(){const{_displaySheet:e,_toggleButtonEl:t,viewModel:{expanded:o},label:n,placement:s}=this;return a("div",{class:this.classes(h.base,i.widget)},this._renderToggle(),e?a("calcite-sheet",{class:h.sheet,heightScale:"l",label:n,onkeydown:this._handleKeyDown,open:o,position:"block-end",onCalciteSheetClose:this._handleSheetClose},a("calcite-panel",{closable:!0,closed:!o,heading:n,onkeydown:this._handleKeyDown,onCalcitePanelClose:this._handlePanelClose},a("div",{class:h.panelContent},this._renderContent()))):t?a("calcite-popover",{afterCreate:this._storePopoverEl,afterUpdate:this._storePopoverEl,label:n,onkeydown:this._handleKeyDown,open:o,overlayPositioning:"fixed",placement:s??this._getPlacement(),referenceElement:t,onCalcitePopoverClose:this._handlePopoverClose},a("div",{class:h.popoverContent},this._renderContent())):null)}_getPlacement(){const{container:e,view:t}=this,o=e&&t?t.ui.getPosition(e):null;if(!o||"manual"===o)return"auto";const[n,s]=o.split("-");return`${"right"===s?"left":"right"}-${"bottom"===n?"end":"start"}`}_willCloseOnEsc(e){const{closeOnEsc:t}=this;return"function"==typeof t?t(e):t}_renderBadgeNumber(){const{expanded:e,iconNumber:t}=this;return t&&!e?a("span",{class:h.iconNumber,key:"expand__icon-number"},t):null}_renderToggleButton(){const{expanded:e,expandTitle:t,expandIcon:o,collapseIcon:n}=this,s=e?n:o,l=s===u||s===m;return a("calcite-button",{afterCreate:this._storeToggleButtonEl,afterUpdate:this._storeToggleButtonEl,class:i.widgetButton,kind:"neutral",label:t,onclick:this.toggle,scale:"s",title:t},s?a("calcite-icon",{class:this.classes(h.icon,l&&h.iconFlip),icon:s,scale:"s"}):null)}_renderToggle(){return a("div",{class:h.toggle},this._renderToggleButton(),this._renderBadgeNumber())}_renderContent(){const{content:e}=this;return"string"==typeof e?a("div",{class:h.contentContainer,innerHTML:e,key:"content__string"}):r(e)?a("div",{class:h.contentContainer,key:"content__widget"},e.render()):e instanceof HTMLElement?a("div",{afterCreate:this._attachToNode,bind:e,class:h.contentContainer,key:"content__html-element"}):p(e)?a("div",{afterCreate:this._attachToNode,bind:e.domNode,class:h.contentContainer,key:"content__node"}):null}_attachToNode(e){const t=this;e.appendChild(t)}};e([t({readOnly:!0})],g.prototype,"expandTitle",null),e([t()],g.prototype,"_toggleButtonEl",void 0),e([t()],g.prototype,"_displaySheet",null),e([t()],g.prototype,"autoCollapse",null),e([t()],g.prototype,"closeOnEsc",void 0),e([t()],g.prototype,"collapseIcon",null),e([t()],g.prototype,"collapseTooltip",void 0),e([t()],g.prototype,"content",void 0),e([t()],g.prototype,"expanded",null),e([t()],g.prototype,"expandIcon",null),e([t()],g.prototype,"expandTooltip",void 0),e([t()],g.prototype,"group",null),e([t()],g.prototype,"icon",null),e([t()],g.prototype,"iconNumber",void 0),e([t()],g.prototype,"label",null),e([t(),c("esri/widgets/Expand/t9n/Expand")],g.prototype,"messages",void 0),e([t(),c("esri/t9n/common")],g.prototype,"messagesCommon",void 0),e([t()],g.prototype,"mode",void 0),e([t()],g.prototype,"placement",void 0),e([t()],g.prototype,"view",null),e([t({type:s})],g.prototype,"viewModel",void 0),g=e([o("esri.widgets.Expand")],g);const _=g;export{_ as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
let e;async function
|
|
5
|
+
let e;const t=["blockquote","html","hr","checkbox","table","tablerow","tablecell","image"];async function a(t){return e||await n(),e.parse(t)}async function n(){const{Marked:a}=await import("marked"),n=e=>`<span style="text-decoration:line-through;">${e}</span>`,l=(e,t,a)=>`<a${null!=e?` href="${e}"`:""}${null!=t?` title="${t}"`:""} target="_blank">${a??""}</a>`,r=()=>"",o={};for(const e of t)o[e]=r;e=new a({renderer:{del:n,link:l,...o}})}export{a as compileTextElementMarkdownToHTML};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import s from"./ColumnMenuVisibleElements.js";import n from"./TableMenuVisibleElements.js";let r=class extends e{constructor(o){super(o),this.columnMenus=!0,this.columnMenuItems=new s,this.close=!1,this.header=!0,this.layerDropdown=!1,this.menu=!0,this.menuItems=new n,this.progress=!0,this.selectionColumn=!0,this.tooltips=!0}};o([t({type:Boolean,nonNullable:!0})],r.prototype,"columnMenus",void 0),o([t({type:s,nonNullable:!0})],r.prototype,"columnMenuItems",void 0),o([t({type:Boolean,nonNullable:!0})],r.prototype,"close",void 0),o([t({type:Boolean,nonNullable:!0})],r.prototype,"header",void 0),o([t({type:Boolean,nonNullable:!0})],r.prototype,"layerDropdown",void 0),o([t({type:Boolean,nonNullable:!0})],r.prototype,"menu",void 0),o([t({type:n,nonNullable:!0})],r.prototype,"menuItems",void 0),o([t({type:Boolean,nonNullable:!0})],r.prototype,"progress",void 0),o([t({type:Boolean,nonNullable:!0})],r.prototype,"selectionColumn",void 0),o([t({type:Boolean,nonNullable:!0})],r.prototype,"tooltips",void 0),r=o([l("esri.widgets.FeatureTable.VisibleElements")],r);const p=r;export{p as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{equals as s,isSome as i}from"../../../core/arrayUtils.js";import o from"../../../core/Collection.js";import a from"../../../core/Error.js";import{clone as n}from"../../../core/lang.js";import u from"../../../core/Logger.js";import{watch as l,when as p}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import c from"../../../rest/support/AttachmentQuery.js";import y from"../../../rest/support/RelationshipQuery.js";import{isIFeatureTableSupportedLayerWithAttachments as _,isIFeatureTableSupportedLayerWithEditing as m,isIFeatureTableSupportedLayerWithRelationships as f}from"./tableUtils.js";let g=class extends r{constructor(e){super(e),this._editOperationQueue=new o,this._hasStaleCache=!1,this._loaded=!1,this._loadError=!1,this._loading=!1,this._objectIdCache=new o,this._queryOperationQueue=new o,this.attachmentsEnabled=!1,this.count=0,this.failures=new o,this.filterGeometry=null,this.itemCache=new o,this.layer=null,this.objectIds=null,this.relationshipConfig=null,this.relatedRecordsEnabled=!1,this.returnGeometry=!1,this.timeExtent=null,this.where=null}initialize(){this.addHandles([l((()=>[this.filterGeometry,this.layer,this.objectIds,this.relationshipConfig,this.returnGeometry,this.timeExtent,this.where]),(()=>this._reset())),p((()=>this.attachmentsEnabled),(()=>this._reset())),p((()=>this.relatedRecordsEnabled),(()=>this._reset()))])}destroy(){this.layer=null,this.itemCache?.destroy(),this.failures?.destroy()}get _capabilities(){const{layer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _layerWithAttachments(){const{_capabilities:e,attachmentsEnabled:t,layer:r,supportsAttachments:s}=this;if(e&&r&&t&&s)return _(r)?r:null}get _layerWithEditing(){const e=this.layer;return m(e)&&this.supportsEditing?e:null}get _layerWithRelationships(){const e=this.layer;return f(e)&&this.supportsQueryRelated?e:null}get _relatedLayer(){return this.relationshipConfig?.relatedLayer}get _relatedLayerCapabilities(){const{_relatedLayer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _relatedLayerSupportsCacheHint(){return!!this._relatedLayerCapabilities?.queryRelated?.supportsCacheHint}get _relatedLayerSupportsQuery(){return!!this._relatedLayerCapabilities?.operations.supportsQuery}get _relatedLayerSupportsQueryRelated(){const{_relatedLayerCapabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get _canUseRelatedLayer(){return!(!this._relatedLayerSupportsQuery||!this._relatedLayerSupportsQueryRelated)}get canAddRelatedFeature(){const{state:e,relationship:t,supportsAdd:r,supportsEditing:s}=this;if("loaded"!==e||!t||!r||!s)return!1;const{count:i}=this,{cardinality:o,role:a}=t,n=i>0;return("one-to-one"!==o||!n)&&("one-to-many"!==o||"origin"!==a||!n)}get effectiveTimeExtent(){const{layer:e,timeExtent:t}=this;return t||e&&"timeExtent"in e&&e.timeExtent||null}get effectiveWhere(){return this.where||this.layer?.definitionExpression||"1=1"}get orderByFields(){return this._get("orderByFields")||[]}set orderByFields(e){const t=this.orderByFields;s(e,t)||(this.itemCache.removeAll(),this._hasStaleCache=!0,this._set("orderByFields",e))}get querying(){return this._queryOperationQueue.length>0}get relationship(){const{relationshipConfig:e}=this;return null==e?.relationshipId?null:this.relationships?.find((t=>t.id===e.relationshipId))}get relationshipIds(){return this.relationships?.map((e=>e.id))??[]}get relationships(){return this._layerWithRelationships?.relationships}get state(){const{layer:e,_loaded:t,_loadError:r,_loading:s}=this;return!e||e.destroyed?"disabled":r||e.loadError?"error":"loaded"===e.loadStatus&&t?"loaded":s?"loading":"ready"}get supportsAdd(){return!!this._capabilities?.operations.supportsAdd}get supportsAttachments(){const{_capabilities:e}=this;return!(!e?.data?.supportsAttachment||!e?.operations.supportsQueryAttachments)}get supportsCacheHint(){return!!this._capabilities?.query?.supportsCacheHint}get supportsCacheHintQueryRelated(){return!!this._capabilities?.queryRelated?.supportsCacheHint}get supportsDelete(){return!!this._capabilities?.operations.supportsDelete}get supportsEditing(){return!!this._capabilities?.operations.supportsEditing}get supportsOrderBy(){return!!this._capabilities?.query?.supportsOrderBy}get supportsPagination(){return!!this._capabilities?.query?.supportsPagination}get supportsQuery(){return!!this._capabilities?.operations.supportsQuery}get supportsQueryRelated(){const{_capabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get supportsUpdate(){return!!this._capabilities?.operations.supportsUpdate}get syncing(){return this._editOperationQueue.length>0}async load(){const{layer:e}=this;if(!this._loading&&!this._loaded&&e){this._reset(),this._loading=!0;try{await e.when(),await this._syncLayerInfo(),this._loaded=!0,this._loading=!1}catch(t){throw this._reset(),this._loadError=!0,this._logError("store:load-error","An error occurred."),t}}}async refreshLayerInfo(){return this._syncLayerInfo()}async addItems(e){}async fetchItems(e){const{page:t,pageSize:r}=e,s=t*r,i=s+r,{layer:o,state:a}=this;return o&&"loaded"===a?this._query({layer:o,start:s,num:i,page:t,pageSize:r}):[]}async verifyFeaturesByObjectId(e){const{layer:t,state:r}=this;if(!t||"loaded"!==r)return[];const{objectIdField:s}=t,{features:i}=await this._verifyFeaturesByObjectId(e);return e.map((e=>i.some((t=>{const r=t.getObjectId()??t.attributes[s];return e===r}))))}async query(e){const{state:t}=this;return this.supportsQuery&&"loaded"===t?this._query(e):[]}async removeItemAt(e){}async reset(){this._reset()}async updateItem(e){await this._update(e)}async deleteRowsByObjectId(e){const{_layerWithEditing:t}=this;if(!this.supportsDelete||!t)throw new a("store:delete-error","Delete is not supported.");const r=e.map((e=>this.getItemByObjectId(e)?.feature)).filter(i);return this._queueEditOperation((()=>t.applyEdits({deleteFeatures:r})))}getItemByObjectId(e){const{itemCache:t,layer:r}=this;if(!r)return;const s=r.objectIdField;return t.find((({feature:t})=>!!t&&(t.getObjectId()??t.attributes[s])===e))}getItemIndexByObjectId(e){const{itemCache:t,layer:r}=this;if(!r)return-1;const s=r.objectIdField;return t.findIndex((({feature:t})=>!!t&&(t.getObjectId()??t.attributes[s])===e))}getLocalItemAt(e){return this.itemCache.at(e)}at(e){return Promise.resolve(this.itemCache.at(e))}_reset(){this.itemCache.removeAll(),this.failures.removeAll(),this._editOperationQueue.removeAll(),this._queryOperationQueue.removeAll(),this._hasStaleCache=!1,this._loading=!1,this._loaded=!1,this._loadError=!1,this._set("count",0),this._objectIdCache.removeAll()}_getIdsFromFeatures(e,t){return e.map((e=>e.getObjectId()??e.attributes[t]))}_resultsToFeatureData(e){const{attachments:t,features:r,layer:s,relatedRecords:i}=e,o=s.objectIdField;return r.map((e=>{const{attributes:r}=e,a=e.getObjectId()??r[o],n=[];return e.layer||e.sourceLayer||(e.layer=s,e.sourceLayer=s),i.forEach(((e,t)=>{n.push({relationshipId:t,count:e[a]??0})})),{objectId:a,feature:e,attachments:t[a]??null,relatedRecords:n}}))}async _update(e){const{_layerWithEditing:r}=this;if(!this.supportsUpdate||!r)throw new a("store:update-error","Update is not supported.");const{index:s,name:i,value:o}=e,u=await this.at(s);if(!u?.feature)throw new a("store:update-error","Feature with provided 'objectId' not found.");const{feature:l}=u,p=n(l.attributes);p[i]=o;const d=new t({attributes:p}),h=r.applyEdits({updateFeatures:[d]}).then((e=>{const{updateFeatureResults:t}=e,r=t.find((e=>!!e.error));if(r)throw r.error;return t.length&&(l.attributes=p),e}));return this._queueEditOperation((()=>h))}async _query(e){const{refresh:t}=e;return!0===t?(this.itemCache.removeAll(),this._syncLayerInfo().then((()=>this._queryFeatureData(e)))):(this._hasStaleCache&&(await this._syncObjectIdCache(),this._hasStaleCache=!1),this._queryFeatureData(e))}async _queryFeatureData(e){const{layer:t}=e;return this._queueQueryOperation((async()=>{const r=await this._queryFeatures(e),s=this._getIdsFromFeatures(r,t.objectIdField),i=await this._queryAttachments(s),o=await this._queryRelatedCounts(s);return this._resultsToFeatureData({layer:t,features:r,attachments:i,relatedRecords:o})||[]}))}async _syncLayerInfo(){await this._syncCount(),await this._syncObjectIdCache()}async _syncCount(){await this._queryCount().then((e=>this._set("count",e)))}async _syncObjectIdCache(){if(this.supportsPagination)return;const e=await this._queryForObjectIds();this._objectIdCache.removeAll(),this._objectIdCache.addMany(e)}async _queryCount(){const{_relatedLayerSupportsCacheHint:e,layer:t,relationshipConfig:r,supportsCacheHint:s}=this;if(!t)return 0;if(r&&this._canUseRelatedLayer){const{objectId:t,relatedLayer:s,relationshipId:i}=r;return(await s.queryRelatedFeaturesCount(new y({cacheHint:e,relationshipId:i,objectIds:[t]})))[t]??0}const{effectiveTimeExtent:i,effectiveWhere:o,filterGeometry:a,objectIds:n}=this,u=t.createQuery();return u.geometry=a,u.returnGeometry=!1,u.where=o,u.timeExtent=i,u.objectIds=n,s&&(u.cacheHint=!0),t.queryFeatureCount(u)}async _queryRelatedCounts(e){const{_layerWithRelationships:t,relationshipIds:r,supportsCacheHintQueryRelated:s}=this,i=new Map;return t&&e?.length&&r.length?(await Promise.allSettled(r.map((async r=>{const o=await t.queryRelatedFeaturesCount(new y({cacheHint:s,relationshipId:r,objectIds:e}));i.set(r,o)}))),i):i}_queryForObjectIds(){const{effectiveTimeExtent:e,effectiveWhere:t,filterGeometry:r,layer:s,objectIds:i,orderByFields:o,supportsCacheHint:a,supportsOrderBy:n}=this;if(!s)return Promise.resolve([]);const u=s.createQuery();return u.geometry=r,u.outFields=[s.objectIdField],u.returnGeometry=!1,u.where=t,u.timeExtent=e,u.objectIds=i,n&&(u.orderByFields=o),a&&(u.cacheHint=!0),s.queryObjectIds(u)}async _queryFeatures(e){const{relationshipConfig:t}=this;if(t&&this._canUseRelatedLayer)return this._queryRelatedFeatures(e,t);const{effectiveTimeExtent:r,effectiveWhere:s,filterGeometry:i,objectIds:o,orderByFields:a,returnGeometry:n,supportsCacheHint:u,supportsOrderBy:l,supportsPagination:p}=this,{layer:d,start:h,pageSize:c}=e,y=d.createQuery();y.returnGeometry=n,p?(y.start=h,y.num=c,y.where=s,y.timeExtent=r,y.objectIds=o):y.objectIds=o||this._getObjectIdsForPage(h,c??0),l&&(y.orderByFields=a),i&&(y.geometry=i),u&&(y.cacheHint=!0);return(await d.queryFeatures(y)).features}async _queryRelatedFeatures(e,t){const{orderByFields:r,returnGeometry:s,supportsCacheHint:i}=this,{layer:o,start:a,pageSize:n}=e,{objectId:u,relatedLayer:l,relationshipId:p}=t,d=o.createQuery(),h=new y({cacheHint:i,num:n??0,objectIds:[u],orderByFields:r,outFields:["*"],relationshipId:p,returnGeometry:s,start:a,where:d.where??void 0}),c=await l.queryRelatedFeatures(h);return c[u]?.features||[]}async _verifyFeaturesByObjectId(e){const{layer:t}=this;if(!t||!this.supportsQuery)throw new a("store:query-error","Layer does not support query operation.");const{effectiveTimeExtent:r,effectiveWhere:s,orderByFields:i,supportsCacheHint:o,supportsOrderBy:n}=this,u=t.createQuery();return u.where=s,u.timeExtent=r,u.returnGeometry=!1,u.objectIds=e,u.outFields=[t.objectIdField],n&&(u.orderByFields=i),o&&(u.cacheHint=!0),t.queryFeatures(u)}_getObjectIdsForPage(e,t){const r=this._objectIdCache.toArray();return r.length>=e+t?r.slice(e,e+t):r.slice(e)}_queryAttachments(e){const{_layerWithAttachments:t,effectiveWhere:r}=this;return t?t.queryAttachments(new c({objectIds:e,where:r})):Promise.resolve({})}_syncLocalCache(e){const{layer:t}=this;if(!t)return;const{objectIdField:r}=t,{itemCache:s}=this;e.forEach((e=>{if(e?.feature){const{feature:t}=e,i=t.getObjectId()??t.attributes[r];if(null!=i){const t=this.getItemIndexByObjectId(i);-1===t?s.add(e):s.splice(t,1,e)}}}))}_queueQueryOperation(e){return this._queryOperationQueue.push(e),e().then((t=>this._queryOperationQueue.includes(e)?(this._syncLocalCache(t),t):[])).catch((t=>{this._logError("store:query-error","An error occurred.");const r={error:t,retry:()=>{this.failures.remove(r),this._queueQueryOperation(e)},cancel:()=>this.failures.remove(r)};return this.failures.add(r),[]})).then((t=>(this._queryOperationQueue.remove(e),t)))}_queueEditOperation(e){return this._editOperationQueue.push(e),e().then((t=>(this._editOperationQueue.remove(e),t))).catch((t=>{this._logError("store:edit-error","An error occurred.");const r={error:t,retry:()=>{this.failures.remove(r),this._queueEditOperation(e)},cancel:()=>this.failures.remove(r)};throw this.failures.add(r),this._editOperationQueue.remove(e),t}))}_logError(e,t){u.getLogger(this).error(e,t)}};e([d({readOnly:!0})],g.prototype,"_capabilities",null),e([d()],g.prototype,"_editOperationQueue",void 0),e([d()],g.prototype,"_hasStaleCache",void 0),e([d({readOnly:!0})],g.prototype,"_layerWithAttachments",null),e([d({readOnly:!0})],g.prototype,"_layerWithEditing",null),e([d({readOnly:!0})],g.prototype,"_layerWithRelationships",null),e([d()],g.prototype,"_loaded",void 0),e([d()],g.prototype,"_loadError",void 0),e([d()],g.prototype,"_loading",void 0),e([d()],g.prototype,"_objectIdCache",void 0),e([d()],g.prototype,"_queryOperationQueue",void 0),e([d({readOnly:!0})],g.prototype,"_relatedLayer",null),e([d({readOnly:!0})],g.prototype,"_relatedLayerCapabilities",null),e([d({readOnly:!0})],g.prototype,"_relatedLayerSupportsCacheHint",null),e([d()],g.prototype,"_relatedLayerSupportsQuery",null),e([d()],g.prototype,"_relatedLayerSupportsQueryRelated",null),e([d()],g.prototype,"_canUseRelatedLayer",null),e([d()],g.prototype,"attachmentsEnabled",void 0),e([d()],g.prototype,"canAddRelatedFeature",null),e([d({readOnly:!0})],g.prototype,"count",void 0),e([d()],g.prototype,"effectiveTimeExtent",null),e([d()],g.prototype,"effectiveWhere",null),e([d({readOnly:!0})],g.prototype,"failures",void 0),e([d()],g.prototype,"filterGeometry",void 0),e([d({readOnly:!0})],g.prototype,"itemCache",void 0),e([d()],g.prototype,"layer",void 0),e([d()],g.prototype,"objectIds",void 0),e([d()],g.prototype,"orderByFields",null),e([d({readOnly:!0})],g.prototype,"querying",null),e([d()],g.prototype,"relationship",null),e([d()],g.prototype,"relationshipConfig",void 0),e([d()],g.prototype,"relationshipIds",null),e([d()],g.prototype,"relationships",null),e([d()],g.prototype,"relatedRecordsEnabled",void 0),e([d()],g.prototype,"returnGeometry",void 0),e([d({readOnly:!0})],g.prototype,"state",null),e([d()],g.prototype,"supportsAdd",null),e([d()],g.prototype,"supportsAttachments",null),e([d()],g.prototype,"supportsCacheHint",null),e([d()],g.prototype,"supportsCacheHintQueryRelated",null),e([d()],g.prototype,"supportsDelete",null),e([d()],g.prototype,"supportsEditing",null),e([d()],g.prototype,"supportsOrderBy",null),e([d()],g.prototype,"supportsPagination",null),e([d()],g.prototype,"supportsQuery",null),e([d()],g.prototype,"supportsQueryRelated",null),e([d()],g.prototype,"supportsUpdate",null),e([d({readOnly:!0})],g.prototype,"syncing",null),e([d()],g.prototype,"timeExtent",void 0),e([d()],g.prototype,"where",void 0),g=e([h("esri.widgets.FeatureTable.support.FeatureStore")],g);const b=g;export{b as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{equals as s,isSome as i}from"../../../core/arrayUtils.js";import o from"../../../core/Collection.js";import a from"../../../core/Error.js";import{clone as n}from"../../../core/lang.js";import u from"../../../core/Logger.js";import{watch as l,when as p}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import c from"../../../rest/support/AttachmentQuery.js";import y from"../../../rest/support/RelationshipQuery.js";import{isIFeatureTableSupportedLayerWithAttachments as _,isIFeatureTableSupportedLayerWithEditing as m,isIFeatureTableSupportedLayerWithRelationships as f}from"./tableUtils.js";let g=class extends r{constructor(e){super(e),this._editOperationQueue=new o,this._hasStaleCache=!1,this._loaded=!1,this._loadError=!1,this._loading=!1,this._objectIdCache=new o,this._queryOperationQueue=new o,this.attachmentsEnabled=!1,this.count=0,this.failures=new o,this.filterGeometry=null,this.itemCache=new o,this.layer=null,this.objectIds=null,this.relationshipConfig=null,this.relatedRecordsEnabled=!1,this.returnGeometry=!1,this.timeExtent=null,this.where=null}initialize(){this.addHandles([l((()=>[this.filterGeometry,this.layer,this.objectIds,this.relationshipConfig,this.returnGeometry,this.timeExtent,this.where]),(()=>this._reset())),p((()=>this.attachmentsEnabled),(()=>this._reset())),p((()=>this.relatedRecordsEnabled),(()=>this._reset()))])}destroy(){this.layer=null,this.itemCache?.destroy(),this.failures?.destroy()}get _capabilities(){const{layer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _layerWithAttachments(){const{_capabilities:e,attachmentsEnabled:t,layer:r,supportsAttachments:s}=this;if(e&&r&&t&&s)return _(r)?r:null}get _layerWithEditing(){const e=this.layer;return m(e)&&this.supportsEditing?e:null}get _layerWithRelationships(){const e=this.layer;return f(e)&&this.supportsQueryRelated?e:null}get _relatedLayer(){return this.relationshipConfig?.relatedLayer}get _relatedLayerCapabilities(){const{_relatedLayer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _relatedLayerSupportsCacheHint(){return!!this._relatedLayerCapabilities?.queryRelated?.supportsCacheHint}get _relatedLayerSupportsQuery(){return!!this._relatedLayerCapabilities?.operations.supportsQuery}get _relatedLayerSupportsQueryRelated(){const{_relatedLayerCapabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get _canUseRelatedLayer(){return!(!this._relatedLayerSupportsQuery||!this._relatedLayerSupportsQueryRelated)}get canAddRelatedFeature(){const{state:e,relationship:t,supportsAdd:r,supportsEditing:s}=this;if("loaded"!==e||!t||!r||!s)return!1;const{count:i}=this,{cardinality:o,role:a}=t,n=i>0;return("one-to-one"!==o||!n)&&("one-to-many"!==o||"origin"!==a||!n)}get effectiveTimeExtent(){const{layer:e,timeExtent:t}=this;return t||e&&"timeExtent"in e&&e.timeExtent||null}get effectiveWhere(){return this.where||this.layer?.definitionExpression||"1=1"}get orderByFields(){return this._get("orderByFields")||[]}set orderByFields(e){const t=this.orderByFields;s(e,t)||(this.itemCache.removeAll(),this._hasStaleCache=!0,this._set("orderByFields",e))}get querying(){return this._queryOperationQueue.length>0}get relationship(){const{relationshipConfig:e}=this;return null==e?.relationshipId?null:this.relationships?.find((t=>t.id===e.relationshipId))}get relationshipIds(){return this.relationships?.map((e=>e.id))??[]}get relationships(){return this._layerWithRelationships?.relationships}get state(){const{layer:e,_loaded:t,_loadError:r,_loading:s}=this;return!e||e.destroyed?"disabled":r||e.loadError?"error":"loaded"===e.loadStatus&&t?"loaded":s?"loading":"ready"}get supportsAdd(){return!!this._capabilities?.operations.supportsAdd}get supportsAttachments(){const{_capabilities:e}=this;return!(!e?.data?.supportsAttachment||!e?.operations.supportsQueryAttachments)}get supportsCacheHint(){return!!this._capabilities?.query?.supportsCacheHint}get supportsCacheHintQueryRelated(){return!!this._capabilities?.queryRelated?.supportsCacheHint}get supportsDelete(){return!!this._capabilities?.operations.supportsDelete}get supportsEditing(){return!!this._capabilities?.operations.supportsEditing}get supportsOrderBy(){return!!this._capabilities?.query?.supportsOrderBy}get supportsPagination(){return!!this._capabilities?.query?.supportsPagination}get supportsQuery(){return!!this._capabilities?.operations.supportsQuery}get supportsQueryRelated(){const{_capabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get supportsUpdate(){return!!this._capabilities?.operations.supportsUpdate}get syncing(){return this._editOperationQueue.length>0}async load(){const{layer:e}=this;if(!this._loading&&!this._loaded&&e){this._reset(),this._loading=!0;try{await e.when(),await this._syncLayerInfo(),this._loaded=!0,this._loading=!1}catch(t){throw this._reset(),this._loadError=!0,this._logError("store:load-error","An error occurred."),t}}}async refreshLayerInfo(){return this._syncLayerInfo()}async addItems(e){}async fetchItems(e){const{page:t,pageSize:r}=e,s=t*r,i=s+r,{layer:o,state:a}=this;return o&&"loaded"===a?this._query({layer:o,start:s,num:i,page:t,pageSize:r}):[]}async verifyFeaturesByObjectId(e){const{layer:t,state:r}=this;if(!t||"loaded"!==r)return[];const{objectIdField:s}=t,{features:i}=await this._verifyFeaturesByObjectId(e);return e.map((e=>i.some((t=>{const r=t.getObjectId()??t.attributes[s];return e===r}))))}async query(e){const{state:t}=this;return this.supportsQuery&&"loaded"===t?this._query(e):[]}async removeItemAt(e){}async reset(){this._reset()}async updateItem(e){await this._update(e)}async deleteRowsByObjectId(e){const{_layerWithEditing:t}=this;if(!this.supportsDelete||!t)throw new a("store:delete-error","Delete is not supported.");const r=e.map((e=>this.getItemByObjectId(e)?.feature)).filter(i);return this._queueEditOperation((()=>t.applyEdits({deleteFeatures:r})))}getItemByObjectId(e){const{itemCache:t,layer:r}=this;if(!r)return;const s=r.objectIdField;return t.find((({feature:t})=>!!t&&(t.getObjectId()??t.attributes[s])===e))}getItemIndexByObjectId(e){const{itemCache:t,layer:r}=this;if(!r)return-1;const s=r.objectIdField;return t.findIndex((({feature:t})=>!!t&&(t.getObjectId()??t.attributes[s])===e))}getLocalItemAt(e){return this.itemCache.at(e)}at(e){return Promise.resolve(this.itemCache.at(e))}_reset(){this.itemCache.removeAll(),this.failures.removeAll(),this._editOperationQueue.removeAll(),this._queryOperationQueue.removeAll(),this._hasStaleCache=!1,this._loading=!1,this._loaded=!1,this._loadError=!1,this._set("count",0),this._objectIdCache.removeAll()}_getIdsFromFeatures(e,t){return e.map((e=>e.getObjectId()??e.attributes[t]))}_resultsToFeatureData(e){const{attachments:t,features:r,layer:s,relatedRecords:i}=e,o=s.objectIdField;return r.map((e=>{const{attributes:r}=e,a=e.getObjectId()??r[o],n=[];return e.layer||e.sourceLayer||(e.layer=s,e.sourceLayer=s),i.forEach(((e,t)=>{n.push({relationshipId:t,count:e[a]??0})})),{objectId:a,feature:e,attachments:t[a]??null,relatedRecords:n}}))}async _update(e){const{_layerWithEditing:r}=this;if(!this.supportsUpdate||!r)throw new a("store:update-error","Update is not supported.");const{index:s,name:i,value:o}=e,u=await this.at(s);if(!u?.feature)throw new a("store:update-error","Feature with provided 'objectId' not found.");const{feature:l}=u,p=n(l.attributes);p[i]=o;const d=new t({attributes:p}),h=r.applyEdits({updateFeatures:[d]}).then((e=>{const{updateFeatureResults:t}=e,r=t.find((e=>!!e.error));if(r)throw r.error;return t.length&&(l.attributes=p),e}));return this._queueEditOperation((()=>h))}async _query(e){const{refresh:t}=e;return!0===t?(this.itemCache.removeAll(),this._syncLayerInfo().then((()=>this._queryFeatureData(e)))):(this._hasStaleCache&&(await this._syncObjectIdCache(),this._hasStaleCache=!1),this._queryFeatureData(e))}async _queryFeatureData(e){const{layer:t}=e;return this._queueQueryOperation((async()=>{const r=await this._queryFeatures(e),s=this._getIdsFromFeatures(r,t.objectIdField),i=await this._queryAttachments(s),o=await this._queryRelatedCounts(s);return this._resultsToFeatureData({layer:t,features:r,attachments:i,relatedRecords:o})||[]}))}async _syncLayerInfo(){await this._syncCount(),await this._syncObjectIdCache()}async _syncCount(){await this._queryCount().then((e=>this._set("count",e)))}async _syncObjectIdCache(){if(this.supportsPagination)return;const e=await this._queryForObjectIds();this._objectIdCache.removeAll(),this._objectIdCache.addMany(e)}async _queryCount(){const{_relatedLayerSupportsCacheHint:e,layer:t,relationshipConfig:r,supportsCacheHint:s}=this;if(!t)return 0;if(r&&this._canUseRelatedLayer){const{objectId:t,relatedLayer:s,relationshipId:i}=r;return(await s.queryRelatedFeaturesCount(new y({cacheHint:e,relationshipId:i,objectIds:[t]})))[t]??0}const{effectiveTimeExtent:i,effectiveWhere:o,filterGeometry:a,objectIds:n}=this,u=t.createQuery();return u.geometry=a,u.returnGeometry=!1,u.where=o,u.timeExtent=i,u.objectIds=n?.length?n:void 0,s&&(u.cacheHint=!0),t.queryFeatureCount(u)}async _queryRelatedCounts(e){const{_layerWithRelationships:t,relationshipIds:r,supportsCacheHintQueryRelated:s}=this,i=new Map;return t&&e?.length&&r.length?(await Promise.allSettled(r.map((async r=>{const o=await t.queryRelatedFeaturesCount(new y({cacheHint:s,relationshipId:r,objectIds:e}));i.set(r,o)}))),i):i}_queryForObjectIds(){const{effectiveTimeExtent:e,effectiveWhere:t,filterGeometry:r,layer:s,objectIds:i,orderByFields:o,supportsCacheHint:a,supportsOrderBy:n}=this;if(!s)return Promise.resolve([]);const u=s.createQuery();return u.geometry=r,u.outFields=[s.objectIdField],u.returnGeometry=!1,u.where=t,u.timeExtent=e,u.objectIds=i?.length?i:void 0,n&&(u.orderByFields=o),a&&(u.cacheHint=!0),s.queryObjectIds(u)}async _queryFeatures(e){const{relationshipConfig:t}=this;if(t&&this._canUseRelatedLayer)return this._queryRelatedFeatures(e,t);const{effectiveTimeExtent:r,effectiveWhere:s,filterGeometry:i,objectIds:o,orderByFields:a,returnGeometry:n,supportsCacheHint:u,supportsOrderBy:l,supportsPagination:p}=this,{layer:d,start:h,pageSize:c}=e,y=o?.length,_=d.createQuery();_.returnGeometry=n,p?(_.start=h,_.num=c,_.where=s,_.timeExtent=r,_.objectIds=y?o:void 0):_.objectIds=y?o:this._getObjectIdsForPage(h,c??0),l&&(_.orderByFields=a),i&&(_.geometry=i),u&&(_.cacheHint=!0);return(await d.queryFeatures(_)).features}async _queryRelatedFeatures(e,t){const{orderByFields:r,returnGeometry:s,supportsCacheHint:i}=this,{layer:o,start:a,pageSize:n}=e,{objectId:u,relatedLayer:l,relationshipId:p}=t,d=o.createQuery(),h=new y({cacheHint:i,num:n??0,objectIds:[u],orderByFields:r,outFields:["*"],relationshipId:p,returnGeometry:s,start:a,where:d.where??void 0}),c=await l.queryRelatedFeatures(h);return c[u]?.features||[]}async _verifyFeaturesByObjectId(e){const{layer:t}=this;if(!t||!this.supportsQuery)throw new a("store:query-error","Layer does not support query operation.");const{effectiveTimeExtent:r,effectiveWhere:s,orderByFields:i,supportsCacheHint:o,supportsOrderBy:n}=this,u=t.createQuery();return u.where=s,u.timeExtent=r,u.returnGeometry=!1,u.objectIds=e.length?e:void 0,u.outFields=[t.objectIdField],n&&(u.orderByFields=i),o&&(u.cacheHint=!0),t.queryFeatures(u)}_getObjectIdsForPage(e,t){const r=this._objectIdCache.toArray();return r.length>=e+t?r.slice(e,e+t):r.slice(e)}_queryAttachments(e){const{_layerWithAttachments:t,effectiveWhere:r}=this;return t?t.queryAttachments(new c({objectIds:e,where:r})):Promise.resolve({})}_syncLocalCache(e){const{layer:t}=this;if(!t)return;const{objectIdField:r}=t,{itemCache:s}=this;e.forEach((e=>{if(e?.feature){const{feature:t}=e,i=t.getObjectId()??t.attributes[r];if(null!=i){const t=this.getItemIndexByObjectId(i);-1===t?s.add(e):s.splice(t,1,e)}}}))}_queueQueryOperation(e){return this._queryOperationQueue.push(e),e().then((t=>this._queryOperationQueue.includes(e)?(this._syncLocalCache(t),t):[])).catch((t=>{this._logError("store:query-error","An error occurred.");const r={error:t,retry:()=>{this.failures.remove(r),this._queueQueryOperation(e)},cancel:()=>this.failures.remove(r)};return this.failures.add(r),[]})).then((t=>(this._queryOperationQueue.remove(e),t)))}_queueEditOperation(e){return this._editOperationQueue.push(e),e().then((t=>(this._editOperationQueue.remove(e),t))).catch((t=>{this._logError("store:edit-error","An error occurred.");const r={error:t,retry:()=>{this.failures.remove(r),this._queueEditOperation(e)},cancel:()=>this.failures.remove(r)};throw this.failures.add(r),this._editOperationQueue.remove(e),t}))}_logError(e,t){u.getLogger(this).error(e,t)}};e([d({readOnly:!0})],g.prototype,"_capabilities",null),e([d()],g.prototype,"_editOperationQueue",void 0),e([d()],g.prototype,"_hasStaleCache",void 0),e([d({readOnly:!0})],g.prototype,"_layerWithAttachments",null),e([d({readOnly:!0})],g.prototype,"_layerWithEditing",null),e([d({readOnly:!0})],g.prototype,"_layerWithRelationships",null),e([d()],g.prototype,"_loaded",void 0),e([d()],g.prototype,"_loadError",void 0),e([d()],g.prototype,"_loading",void 0),e([d()],g.prototype,"_objectIdCache",void 0),e([d()],g.prototype,"_queryOperationQueue",void 0),e([d({readOnly:!0})],g.prototype,"_relatedLayer",null),e([d({readOnly:!0})],g.prototype,"_relatedLayerCapabilities",null),e([d({readOnly:!0})],g.prototype,"_relatedLayerSupportsCacheHint",null),e([d()],g.prototype,"_relatedLayerSupportsQuery",null),e([d()],g.prototype,"_relatedLayerSupportsQueryRelated",null),e([d()],g.prototype,"_canUseRelatedLayer",null),e([d()],g.prototype,"attachmentsEnabled",void 0),e([d()],g.prototype,"canAddRelatedFeature",null),e([d({readOnly:!0})],g.prototype,"count",void 0),e([d()],g.prototype,"effectiveTimeExtent",null),e([d()],g.prototype,"effectiveWhere",null),e([d({readOnly:!0})],g.prototype,"failures",void 0),e([d()],g.prototype,"filterGeometry",void 0),e([d({readOnly:!0})],g.prototype,"itemCache",void 0),e([d()],g.prototype,"layer",void 0),e([d()],g.prototype,"objectIds",void 0),e([d()],g.prototype,"orderByFields",null),e([d({readOnly:!0})],g.prototype,"querying",null),e([d()],g.prototype,"relationship",null),e([d()],g.prototype,"relationshipConfig",void 0),e([d()],g.prototype,"relationshipIds",null),e([d()],g.prototype,"relationships",null),e([d()],g.prototype,"relatedRecordsEnabled",void 0),e([d()],g.prototype,"returnGeometry",void 0),e([d({readOnly:!0})],g.prototype,"state",null),e([d()],g.prototype,"supportsAdd",null),e([d()],g.prototype,"supportsAttachments",null),e([d()],g.prototype,"supportsCacheHint",null),e([d()],g.prototype,"supportsCacheHintQueryRelated",null),e([d()],g.prototype,"supportsDelete",null),e([d()],g.prototype,"supportsEditing",null),e([d()],g.prototype,"supportsOrderBy",null),e([d()],g.prototype,"supportsPagination",null),e([d()],g.prototype,"supportsQuery",null),e([d()],g.prototype,"supportsQueryRelated",null),e([d()],g.prototype,"supportsUpdate",null),e([d({readOnly:!0})],g.prototype,"syncing",null),e([d()],g.prototype,"timeExtent",void 0),e([d()],g.prototype,"where",void 0),g=e([h("esri.widgets.FeatureTable.support.FeatureStore")],g);const b=g;export{b as default};
|
package/widgets/FeatureTable.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{watch as i,sync as l,initial as o,on as s}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import d from"./FeatureTable/ColumnMenuVisibleElements.js";import c from"./FeatureTable/FeatureTableViewModel.js";import h from"./FeatureTable/VisibleElements.js";import p from"./FeatureTable/support/FieldColumnTemplate.js";import m from"./FeatureTable/support/TableTemplate.js";import{uniqueColumnNames as u,isIFeatureTableSupportedLayerWithAttachments as g}from"./FeatureTable/support/tableUtils.js";import{loadCalciteComponents as b}from"./support/componentsUtils.js";import{globalCss as w}from"./support/globalCss.js";import{Heading as v}from"./support/Heading.js";import{renderingSanitizer as y}from"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{vmEvent as _}from"./support/decorators/vmEvent.js";import{tsx as M}from"./support/jsxFactory.js";import{substitute as C}from"../intl/substitute.js";var S;const E="esri-feature-table",T=`${E}__prompt`,A={base:E,content:`${E}__content`,menuPopover:`${E}__menu-popover`,tableContainer:`${E}__table-container`,tableNavigation:`${E}__table-navigation`,expanded:`${E}__expanded`,collapsed:`${E}__collapsed`,promptContainer:T,promptHeader:`${T}__header`,promptHeading:`${T}__header__heading`,promptMessage:`${T}__message`,promptDivider:`${T}__divider`,promptActions:`${T}__actions`},I={clearSelection:"clear-selection",delete:"trash",refresh:"refresh",showAll:"selection-x",showSelected:"selection-filter",zoomToSelection:"zoom-to-object"};let R=S=class extends a{constructor(e,i){super(e,i),this._columnVisibilityActions=new Map,this._prompt=null,this._showAllTablesEnabled=!1,this.disabled=!1,this.menuConfig=null,this.relatedTables=new t,this.tableParent=null,this.title=null,this.viewModel=new c,this.visibleElements=new h,this.visibleElementsOverride=null,this._showDeletePrompt=this._showDeletePrompt.bind(this),this._onDeleteSelectionClick=this._onDeleteSelectionClick.bind(this)}initialize(){this.addHandles([i((()=>[this.viewModel.store.querying,this.viewModel.store.syncing,this.editingEnabled]),(()=>this.scheduleRender())),i((()=>({visibleElements:this._effectiveVisibleElements,items:this.columns.length})),(({visibleElements:e})=>{this.columns.forEach((t=>t.visibleElements=e)),this.refreshCellContent()}),l),i((()=>this._effectiveVisibleElements.selectionColumn),(e=>{this.grid&&(this.grid.selectionColumnEnabled=e)}),o),s((()=>this.viewModel),"show-related-table",(e=>this._onShowRelatedTable(e))),i((()=>this.viewModel.state),(e=>{"disabled"===e&&this.relatedTables.length&&this._drainRelatedTables()}))])}loadDependencies(){return b({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel.js"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover.js"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress.js"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js"),"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar.js"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown.js"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group.js"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone.js")})}destroy(){this._clearPrompt()}get _effectiveTitle(){const{layer:e,messages:t,state:i,highlightIds:l,title:o,viewModel:s}=this;if(o)return y.sanitize("function"==typeof o?o():o);if(!e)return t.noLayer;switch(i){case"disabled":return t.errorLayer;case"ready":return y.sanitize(e.title);case"loading":return t.loading;case"error":return t.errorData}return C(t.header,{title:y.sanitize(e.title),count:s.size,selected:l.length})}get _effectiveVisibleElements(){return this.visibleElementsOverride??this.visibleElements}get _hasCustomMenuItems(){return!!this.menuConfig?.items?.length}get _hasDefaultMenuItems(){return!!(this._showClearSelectionAction||this._showDeleteSelectionAction||this._showRefreshDataAction||this._showZoomToSelectionAction||this._showSelectedRecordsShowSelectedAction||this._showSelectedRecordsShowAllAction||this._showColumnsVisibilityAction)}get _shouldShowMenu(){const{header:e,menu:t}=this._effectiveVisibleElements;return!(!e||!t||!this._hasDefaultMenuItems&&!this._hasCustomMenuItems)}get _showClearSelectionAction(){return!(!this.highlightIds.length||!this._effectiveVisibleElements.menuItems?.clearSelection||this.relatedTables.length)}get _showColumnsVisibilityAction(){const{header:e,menu:t,menuItems:i}=this._effectiveVisibleElements;return!(!(e&&t&&i?.toggleColumns)||this.showRelatedTableCallback||this._showAllTablesEnabled)}get _showDeleteSelectionAction(){return!(!(this.editingEnabled&&this.highlightIds.length&&this._effectiveVisibleElements.menuItems?.deleteSelection&&this.layer?.capabilities?.operations?.supportsDelete)||this.relatedTables.length)}get _showRefreshDataAction(){return!!this._effectiveVisibleElements.menuItems?.refreshData}get _showSelectedRecordsShowSelectedAction(){const e=this.objectIds.length,t=this.highlightIds.length;return!(!t||!this._effectiveVisibleElements.menuItems?.selectedRecordsShowSelectedToggle||e&&t===e||this.relatedTables.length)}get _showSelectedRecordsShowAllAction(){return!(!this._effectiveVisibleElements.menuItems?.selectedRecordsShowAllToggle||!this.objectIds.length||this.relatedTables.length)}get _showZoomToSelectionAction(){return!!(this.view&&this.highlightIds.length&&this._effectiveVisibleElements.menuItems?.zoomToSelection)}get actionColumnConfig(){return this.viewModel.actionColumnConfig}set actionColumnConfig(e){this.viewModel.actionColumnConfig=e}get activeFilters(){return this.viewModel.activeFilters}get activeSortOrders(){return this.viewModel.activeSortOrders}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get autoRefreshEnabled(){return this.viewModel.autoRefreshEnabled}set autoRefreshEnabled(e){this.viewModel.autoRefreshEnabled=e}get columnPerformanceModeEnabled(){return this.viewModel.columnPerformanceModeEnabled}set columnPerformanceModeEnabled(e){this.viewModel.columnPerformanceModeEnabled=e}get columnReorderingEnabled(){return this.viewModel.columnReorderingEnabled}set columnReorderingEnabled(e){this.viewModel.columnReorderingEnabled=e}get columns(){return this.viewModel.columns}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get filterGeometry(){return this.viewModel.filterGeometry}set filterGeometry(e){this.viewModel.filterGeometry=e}get filterBySelectionEnabled(){return this.viewModel.filterBySelectionEnabled}set filterBySelectionEnabled(e){this.viewModel.filterBySelectionEnabled=e}get grid(){return this.viewModel.grid}get hiddenFields(){return this.viewModel.hiddenFields}set hiddenFields(e){this.viewModel.hiddenFields=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get highlightIds(){return this.viewModel.highlightIds}set highlightIds(e){this.viewModel.highlightIds=e}get icon(){return"table"}set icon(e){this._overrideIfSome("icon",e)}get isQueryingOrSyncing(){return this.viewModel.isQueryingOrSyncing||this.relatedTables.some((e=>!!e.isQueryingOrSyncing))}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get layerView(){return this.viewModel.layerView}get messages(){return this.viewModel.messages}set messages(e){this.viewModel.messages=e}get messagesCommon(){return this.viewModel.messagesCommon}set messagesCommon(e){this.viewModel.messagesCommon=e}get messagesURIUtils(){return this.viewModel.messagesURIUtils}set messagesURIUtils(e){this.viewModel.messagesURIUtils=e}get multipleSelectionEnabled(){return this.viewModel.multipleSelectionEnabled}set multipleSelectionEnabled(e){this.viewModel.multipleSelectionEnabled=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get objectIds(){return this.viewModel.objectIds}set objectIds(e){this.viewModel.objectIds=e}get pageSize(){return this.viewModel.pageSize}set pageSize(e){this.viewModel.pageSize=e}get relatedRecordsEnabled(){return this.viewModel.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.viewModel.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relationship(){return this.viewModel.relationship}get relationshipColumnConfigs(){return this.viewModel.relationshipColumnConfigs}set relationshipColumnConfigs(e){this.viewModel.relationshipColumnConfigs=e}get relationshipConfig(){return this.viewModel.relationshipConfig}set relationshipConfig(e){this.viewModel.relationshipConfig=e}get returnGeometryEnabled(){return this.viewModel.returnGeometryEnabled}set returnGeometryEnabled(e){this.viewModel.returnGeometryEnabled=e}get rowHighlightIds(){return this.viewModel.rowHighlightIds}set rowHighlightIds(e){this.viewModel.rowHighlightIds=e}get selectionSource(){return this.viewModel.selectionSource}set selectionSource(e){this.viewModel.selectionSource=e}get showRelatedTableCallback(){return this.viewModel.showRelatedTableCallback}set showRelatedTableCallback(e){this.viewModel.showRelatedTableCallback=e}get size(){return this.viewModel.size}get state(){return this.viewModel.state}get tableTemplate(){return this.viewModel.tableTemplate}set tableTemplate(e){this.viewModel.tableTemplate=e}get tableTemplateOverride(){return this.viewModel.tableTemplateOverride}set tableTemplateOverride(e){this.viewModel.tableTemplateOverride=e}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(e){this.viewModel.timeExtent=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}clearSelectionFilter(){this.viewModel.clearSelectionFilter()}deleteSelection(e){return this.highlightIds.length?e?(this._showDeletePrompt(),this.scheduleRender(),Promise.resolve()):this.viewModel.deleteSelection():Promise.resolve()}filterBySelection(){this.viewModel.filterBySelection()}findColumn(e){return this.viewModel.findColumn(e)}hideColumn(e){this.grid?.hideColumn(e)}async refresh(){this.relatedTables.forEach((async e=>await e.refresh())),await this.viewModel.refresh()}refreshCellContent(){this.viewModel.refreshCellContent()}showAllColumns(){this.viewModel.showAllColumns()}showColumn(e){this.grid?.showColumn(e)}sortColumn(e,t){this.viewModel.sortColumn(e,t)}scrollToIndex(e){this.viewModel.scrollToIndex(e)}toggleColumnVisibility(e){this.viewModel.toggleColumnVisibility(e)}zoomToSelection(){this.viewModel.zoomToSelection()}render(){const{_prompt:e,_effectiveVisibleElements:t,isQueryingOrSyncing:i,menuConfig:l,state:o}=this;return M("div",{bind:this,class:this.classes(A.base,w.widget)},M("calcite-panel",{bind:this,class:A.content,closable:t.close,disabled:this.disabled||"disabled"===o,heading:t.header?this._effectiveTitle:void 0,loading:"loading"===o,menuOpen:!!l?.open,overlayPositioning:"fixed",onCalcitePanelClose:e=>{e.target.closed=!1,this.emit("close")}},t.progress?M("calcite-progress",{type:i?"indeterminate":"determinate"}):null,this._renderColumnVisibilityAction(),this._renderHeaderMenuActions(),this._renderRelatedTableNavigationBar(),M("div",{class:A.tableContainer},this._renderTables())),e?M("calcite-scrim",null,this._renderPrompt(e)):null)}_renderTables(){const{_showAllTablesEnabled:e,grid:t,relatedTables:i}=this;if(i.length){const l=i.toArray(),o=1===l.length,s=this.classes(A.base,e?A.expanded:A.collapsed),n=e||o,r=e?l:o?[l[0]]:l.slice(-2);return M("calcite-panel",null,M("div",null,[n?M("div",{class:s},t?.render()):void 0,...r.map((e=>{const t=i.indexOf(e);return M("div",{class:s,key:`related-${t}`},e.render())})),,]))}return t?.render()}_clearPrompt(){this._prompt=null}_renderPrompt({title:e,message:t,context:i,actions:l}){const o=M("calcite-button",{appearance:"solid",key:"prompt-primary-button",kind:"danger"===i?"danger":"brand",onclick:l.primary.action,width:l.secondary?"half":"full"},l.primary.label),s=l.secondary?M("calcite-button",{appearance:"outline",key:"prompt-secondary-button",kind:"danger"===i?"danger":"brand",onclick:l.secondary.action,width:"half"},l.secondary.label):null;return M("div",{class:`${A.promptContainer}--${i}`},M("div",{class:A.promptHeader},M("calcite-icon",{icon:"exclamation-mark-triangle"}),M(v,{class:A.promptHeading,level:2},e)),M("div",{class:A.promptMessage},t),M("div",{class:A.promptDivider}),M("div",{class:A.promptActions},s,o))}_showDeletePrompt(){const{messages:e,messagesCommon:t}=this,i=C(e.deleteSelectionCount,{count:this.highlightIds.length});this._prompt={title:i,message:e.deleteRecordsRemoved,context:"danger",actions:{primary:{label:t.delete,action:this._onDeleteSelectionClick},secondary:{label:e.keepRecords,action:()=>this._clearPrompt()}}}}async _onDeleteSelectionClick(){try{await this.viewModel.deleteSelection()}finally{this._clearPrompt()}}_renderHeaderMenuAction(e){const{disabled:t,hidden:i,icon:l,text:o,clickFunction:s}=e;if(!i)return M("calcite-action",{disabled:t??this.menuConfig?.disabled,icon:l??void 0,key:o,onclick:()=>s(),slot:"header-menu-actions",text:o,textEnabled:!0,title:o})}_renderHeaderMenuActions(){return this._shouldShowMenu?[this._renderDefaultHeaderMenuActions(),this._renderCustomHeaderMenuActions()]:[]}_renderDefaultHeaderMenuActions(){if(!this._hasDefaultMenuItems)return[];const{messages:e}=this,t=[];return this._showRefreshDataAction&&t.push(this._renderHeaderMenuAction({icon:I.refresh,text:e.refreshData,clickFunction:()=>this.refresh()})),this._showDeleteSelectionAction&&t.push(this._renderHeaderMenuAction({icon:I.delete,text:e.deleteSelection,clickFunction:()=>this.deleteSelection(!0)})),this._showClearSelectionAction&&t.push(this._renderHeaderMenuAction({icon:I.clearSelection,text:e.clearSelection,clickFunction:()=>this.highlightIds?.removeAll()})),this._showZoomToSelectionAction&&t.push(this._renderHeaderMenuAction({icon:I.zoomToSelection,text:e.zoomToSelection,clickFunction:()=>this.zoomToSelection()})),this._showSelectedRecordsShowSelectedAction&&t.push(this._renderHeaderMenuAction({icon:I.showSelected,text:e.showSelected,clickFunction:()=>{const{objectIds:e}=this;e.removeAll(),e.addMany(this.highlightIds.toArray())}})),this._showSelectedRecordsShowAllAction&&t.push(this._renderHeaderMenuAction({icon:I.showAll,text:e.showAllRecords,clickFunction:()=>this.objectIds.removeAll()})),t}_renderCustomHeaderMenuActions(){return this.menuConfig?.items?.map((({disabled:e,hidden:t,icon:i,label:l,clickFunction:o})=>this._renderHeaderMenuAction({hidden:"function"==typeof t?t():t,icon:i,text:l,disabled:e,clickFunction:e=>o(e)})))??[]}_renderColumnVisibilityAction(){if(!this._showColumnsVisibilityAction)return[];const{_columnVisibilityActions:e,_effectiveVisibleElements:t,id:i,messages:l}=this,o=this.relatedTables.at(-1)||this,s=o.columns.toArray(),n=l?.toggleColumns,r=`${i}__toggle-columns-action`,a=[M("calcite-action",{afterCreate:t=>e.set(i,t),afterRemoved:()=>e.delete(i),appearance:"transparent",bind:this,disabled:o.menuConfig?.disabled,icon:"show-column",id:r,slot:"header-actions-end",text:n},t.tooltips?M("calcite-tooltip",{closeOnClick:!0,overlayPositioning:"fixed",placement:"bottom-end",slot:"tooltip"},n):null)];return o.menuConfig?.disabled||a.push(M("calcite-popover",{autoClose:!0,class:A.menuPopover,label:n,overlayPositioning:"fixed",placement:"top-end",pointerDisabled:!0,referenceElement:e.get(i)},M("calcite-list",{filterEnabled:!0,selectionMode:"multiple"},...s.map((({effectiveLabel:e,fieldName:t,hidden:i})=>M("calcite-list-item",{key:`toggle-columns__item-${t}`,label:e,selected:!i,value:t,onCalciteListItemSelect:({target:e})=>o.toggleColumnVisibility(e.value)})))))),a}_onShowRelatedTable(e){if(this.showRelatedTableCallback)return;const{relatedTables:t}=this,{length:i}=t,l=i?t.getItemAt(i-1):this;this._collapseRelatedTable(l,e),this._createRelatedTable(e)}_renderRelatedTableNavigationBar(){const e=this.messages.exitRelatedRecords;if(this.relatedTables.length&&!this.showRelatedTableCallback)return M("div",{class:A.tableNavigation,key:"table-nav"},M("calcite-action",{icon:"move-up",key:e,onclick:()=>this._drainRelatedTables(),text:e,title:e}),this.relatedTables.toArray().map(((e,t)=>this._renderRelatedTableNavigationAction(e,t))),M("div",null,M("calcite-label",{layout:"inline"},"Show all tables",M("calcite-switch",{checked:this._showAllTablesEnabled,onCalciteSwitchChange:e=>{const{relatedTables:t}=this,i=!!e.target.checked,l=t.at(-1);this._showAllTablesEnabled=i,l&&(i?this._enterShowAllView(l):this._exitShowAllView(l))}}))))}_renderRelatedTableNavigationAction(e,t){const i=this._getLabelForRelatedTableNavigationAction(e);return M("calcite-action",{icon:"chevron-right",key:t,onclick:()=>this._drainRelatedTablesAboveIndex(t),text:i,textEnabled:!0,title:e.layer?.title||""})}_getLabelForRelatedTableNavigationAction(e){const t=e.layer?.title;if(!t)return"";const{relatedTables:i}=this;if(i.length<=1)return t;return i.indexOf(e)!==i.length-1&&t.length>20?`${t.slice(0,20)}...`:t}_drainRelatedTables(){this.relatedTables.drain((e=>!e.destroyed&&e.destroy())),this.set({_showAllTablesEnabled:!1,multipleSelectionEnabled:!0,tableTemplateOverride:null,relationshipColumnConfigs:null,visibleElementsOverride:null}),this.hiddenFields.removeMany([u.action,u.attachments])}_drainRelatedTablesAboveIndex(e){const t=this.relatedTables,i=t.filter(((t,i)=>i>e));i.forEach((e=>!e.destroyed&&e.destroy())),t.removeMany(i);const l=t.at(-1);if(!l?.layer||!l?.relationship)return;const{layer:o,relationship:s}=l;this._showAllTablesEnabled?this._enterShowAllView(l):l.set({multipleSelectionEnabled:!0,tableTemplateOverride:null,relationshipColumnConfigs:this._getRelationshipIdsToShow(o,s.id),visibleElementsOverride:null}),l.hiddenFields.removeMany([u.action,u.attachments])}_getRelatedTableMenuItemConfig(e,t,i){return t.fields.map((({alias:l,name:o})=>({selected:o===i,label:l||o,clickFunction:i=>{i.stopPropagation(),e.tableTemplateOverride=new m({columnTemplates:[this._createRelatedFieldColumnTemplate(e,t,o)]})}})))}_createRelatedFieldColumnTemplate(e,t,i){return new p({fieldName:i,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._getRelatedTableMenuItemConfig(e,t,i)},resizable:!1})}_enterShowAllView(e){const t=e.layer;if(!t)return;const i=e===this,{visibleElements:l}=e,o=t.displayField||t.objectIdField;e.set({relationshipColumnConfigs:[],tableTemplateOverride:new m({columnTemplates:[this._createRelatedFieldColumnTemplate(e,t,o)]}),visibleElementsOverride:new h({header:i&&l.header,progress:i&&l.progress,columnMenus:l.columnMenus,close:l.close,tooltips:l.tooltips,selectionColumn:!1,columnMenuItems:new d({sortAscending:!1,sortDescending:!1})})}),e.hiddenFields.addMany([u.action,u.attachments])}_exitShowAllView(e){const{layer:t,relationship:i}=e;t&&null!=i?.id&&(e.set({relationshipColumnConfigs:this._getRelationshipIdsToShow(t,i.id),tableTemplateOverride:null,visibleElementsOverride:null}),e.hiddenFields.removeMany([u.action,u.attachments]))}_collapseRelatedTable(e,i){const{relatedLayer:l,feature:o,relationshipId:s}=i,n=l.relationships?.find((({id:e})=>e===s)),{objectIdField:r}=l,a=l.displayField||n?.keyField||r,c=o.getObjectId()??o.attributes[r],p=e===this,{visibleElements:g}=e;e.set({highlightIds:new t([c]),multipleSelectionEnabled:!1,relationshipColumnConfigs:[{relationshipId:s,collapsed:!0}],tableTemplateOverride:new m({columnTemplates:[this._createRelatedFieldColumnTemplate(e,l,a)]}),visibleElementsOverride:new h({header:p&&g.header,progress:p&&g.progress,columnMenus:g.columnMenus,close:g.close,tooltips:g.tooltips,selectionColumn:!1,columnMenuItems:new d({sortAscending:!1,sortDescending:!1})})}),e.hiddenFields.addMany([u.action,u.attachments])}_getRelationshipIdsToShow(e,t){return(e.relationships??[]).filter((e=>!(e.id===t&&"one-to-one"===e.cardinality))).map((({id:e})=>({relationshipId:e})))}async _createRelatedTable(e){const{editingEnabled:t,relatedTables:i,view:l,viewModel:o}=this,{layer:n,feature:r,relatedLayer:a,relationshipId:d}=e,c=r.getObjectId()??r.attributes[a.objectIdField],p=i.length,m=p?i.getItemAt(p-1):this;await n.load();const u=this.attachmentsEnabled&&g(n),b=new S({layer:n,attachmentsEnabled:u,editingEnabled:t,relatedRecordsEnabled:!0,relationshipConfig:{objectId:c,relatedLayer:a,relationshipId:d},relationshipColumnConfigs:this._getRelationshipIdsToShow(n,d),tableParent:m,view:l,visibleElements:new h({header:!1,progress:!1}),showRelatedTableCallback:({feature:e,layer:t,relatedLayer:i,relationshipId:l})=>{null!=(e.getObjectId()??e.attributes[i.objectIdField])&&o.emit("show-related-table",{feature:e,layer:t,relatedLayer:i,relationshipId:l})}});b.addHandles([s((()=>m.highlightIds),"change",(({added:e})=>{const t=e[0];null!=t&&(b.highlightIds.removeAll(),b.relationshipConfig={objectId:t,relatedLayer:a,relationshipId:d})})),s((()=>m),"cell-click",(e=>{const{feature:t}=e;if(t){const e=t.getObjectId()??t.attributes[a.objectIdField];null!=e&&m.highlightIds.add(e)}}))]),this.relatedTables.add(b),this.scheduleRender()}};e([n()],R.prototype,"_columnVisibilityActions",void 0),e([n()],R.prototype,"_effectiveTitle",null),e([n()],R.prototype,"_effectiveVisibleElements",null),e([n()],R.prototype,"_hasCustomMenuItems",null),e([n()],R.prototype,"_hasDefaultMenuItems",null),e([n()],R.prototype,"_prompt",void 0),e([n()],R.prototype,"_shouldShowMenu",null),e([n()],R.prototype,"_showAllTablesEnabled",void 0),e([n()],R.prototype,"_showClearSelectionAction",null),e([n()],R.prototype,"_showColumnsVisibilityAction",null),e([n()],R.prototype,"_showDeleteSelectionAction",null),e([n()],R.prototype,"_showRefreshDataAction",null),e([n()],R.prototype,"_showSelectedRecordsShowSelectedAction",null),e([n()],R.prototype,"_showSelectedRecordsShowAllAction",null),e([n()],R.prototype,"_showZoomToSelectionAction",null),e([n()],R.prototype,"actionColumnConfig",null),e([n({readOnly:!0})],R.prototype,"activeFilters",null),e([n({readOnly:!0})],R.prototype,"activeSortOrders",null),e([n()],R.prototype,"attachmentsEnabled",null),e([n()],R.prototype,"autoRefreshEnabled",null),e([n()],R.prototype,"columnPerformanceModeEnabled",null),e([n()],R.prototype,"columnReorderingEnabled",null),e([n({readOnly:!0})],R.prototype,"columns",null),e([n()],R.prototype,"disabled",void 0),e([n()],R.prototype,"editingEnabled",null),e([n()],R.prototype,"filterGeometry",null),e([n()],R.prototype,"filterBySelectionEnabled",null),e([n({readOnly:!0})],R.prototype,"grid",null),e([n()],R.prototype,"hiddenFields",null),e([n()],R.prototype,"highlightEnabled",null),e([n()],R.prototype,"highlightIds",null),e([n()],R.prototype,"icon",null),e([n()],R.prototype,"isQueryingOrSyncing",null),e([n()],R.prototype,"label",null),e([n()],R.prototype,"layer",null),e([n()],R.prototype,"layerView",null),e([n(),f("esri/widgets/FeatureTable/t9n/FeatureTable")],R.prototype,"messages",null),e([n(),f("esri/t9n/common")],R.prototype,"messagesCommon",null),e([n(),f("esri/widgets/support/t9n/uriUtils")],R.prototype,"messagesURIUtils",null),e([n()],R.prototype,"menuConfig",void 0),e([n()],R.prototype,"multipleSelectionEnabled",null),e([n()],R.prototype,"multiSortEnabled",null),e([n()],R.prototype,"objectIds",null),e([n()],R.prototype,"pageSize",null),e([n()],R.prototype,"relatedRecordsEnabled",null),e([n()],R.prototype,"relatedTable",null),e([n()],R.prototype,"relatedTables",void 0),e([n()],R.prototype,"relationship",null),e([n()],R.prototype,"relationshipColumnConfigs",null),e([n()],R.prototype,"relationshipConfig",null),e([n()],R.prototype,"returnGeometryEnabled",null),e([n()],R.prototype,"rowHighlightIds",null),e([n()],R.prototype,"selectionSource",null),e([n()],R.prototype,"showRelatedTableCallback",null),e([n()],R.prototype,"size",null),e([n({readOnly:!0})],R.prototype,"state",null),e([n({constructOnly:!0})],R.prototype,"tableParent",void 0),e([n()],R.prototype,"tableTemplate",null),e([n()],R.prototype,"tableTemplateOverride",null),e([n()],R.prototype,"title",void 0),e([n()],R.prototype,"timeExtent",null),e([n()],R.prototype,"timeZone",null),e([n()],R.prototype,"view",null),e([n({type:c}),_(["cell-click","cell-pointerover","cell-pointerout","cell-keydown","show-related-table"])],R.prototype,"viewModel",void 0),e([n({type:h,nonNullable:!0})],R.prototype,"visibleElements",void 0),e([n({type:h})],R.prototype,"visibleElementsOverride",void 0),R=S=e([r("esri.widgets.FeatureTable")],R);const j=R;export{j as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{watch as i,sync as l,initial as o,on as s}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import{isLayerFromCatalog as a}from"../layers/catalog/catalogUtils.js";import d from"./Widget.js";import c from"./FeatureTable/ColumnMenuVisibleElements.js";import h from"./FeatureTable/FeatureTableViewModel.js";import p from"./FeatureTable/VisibleElements.js";import m from"./FeatureTable/support/FieldColumnTemplate.js";import u from"./FeatureTable/support/TableTemplate.js";import{isIFeatureTableSupportedLayer as g,uniqueColumnNames as b,isIFeatureTableSupportedLayerWithAttachments as w}from"./FeatureTable/support/tableUtils.js";import{loadCalciteComponents as v}from"./support/componentsUtils.js";import{globalCss as y}from"./support/globalCss.js";import{Heading as f}from"./support/Heading.js";import{renderingSanitizer as _}from"./support/widgetUtils.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{vmEvent as C}from"./support/decorators/vmEvent.js";import{tsx as T}from"./support/jsxFactory.js";import{substitute as E}from"../intl/substitute.js";var S;const A="esri-feature-table",I=`${A}__prompt`,R={base:A,content:`${A}__content`,menuPopover:`${A}__menu-popover`,layerDropdownMenu:`${A}__layer-switcher-menu`,tableContainer:`${A}__table-container`,tableNavigation:`${A}__table-navigation`,expanded:`${A}__expanded`,collapsed:`${A}__collapsed`,promptContainer:I,promptHeader:`${I}__header`,promptHeading:`${I}__header__heading`,promptMessage:`${I}__message`,promptDivider:`${I}__divider`,promptActions:`${I}__actions`},j={clearSelection:"clear-selection",delete:"trash",refresh:"refresh",showAll:"selection-x",showSelected:"selection-filter",zoomToSelection:"zoom-to-object"};let k=S=class extends d{constructor(e,i){super(e,i),this._columnVisibilityActions=new Map,this._prompt=null,this._showAllTablesEnabled=!1,this.disabled=!1,this.layers=null,this.menuConfig=null,this.relatedTables=new t,this.tableParent=null,this.title=null,this.viewModel=new h,this.visibleElements=new p,this.visibleElementsOverride=null,this._showDeletePrompt=this._showDeletePrompt.bind(this),this._onDeleteSelectionClick=this._onDeleteSelectionClick.bind(this)}initialize(){this.addHandles([i((()=>[this.viewModel.store.querying,this.viewModel.store.syncing,this.editingEnabled]),(()=>this.scheduleRender())),i((()=>({visibleElements:this._effectiveVisibleElements,items:this.columns.length})),(({visibleElements:e})=>{this.columns.forEach((t=>t.visibleElements=e)),this.refreshCellContent()}),l),i((()=>this._effectiveVisibleElements.selectionColumn),(e=>{this.grid&&(this.grid.selectionColumnEnabled=e)}),o),s((()=>this.viewModel),"show-related-table",(e=>this._onShowRelatedTable(e))),i((()=>this.viewModel.state),(e=>{"disabled"===e&&this.relatedTables.length&&this._drainRelatedTables()}))])}loadDependencies(){return v({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown.js"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group.js"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel.js"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover.js"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress.js"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js"),"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone.js")})}destroy(){this._clearPrompt()}get _effectiveLayers(){const{layer:e,layers:t}=this,i=t?.length?[...t]:[...this._viewLayers];return e&&!i.includes(e)&&i.push(e),i}get _effectiveTitle(){const{layer:e,messages:t,state:i,highlightIds:l,title:o,viewModel:s}=this;if(o)return _.sanitize("function"==typeof o?o():o);if(!e)return t.noLayer;switch(i){case"disabled":return t.errorLayer;case"ready":return _.sanitize(e.title);case"loading":return t.loading;case"error":return t.errorData}return E(t.header,{title:_.sanitize(e.title),count:s.size,selected:l.length})}get _effectiveVisibleElements(){return this.visibleElementsOverride??this.visibleElements}get _hasCustomMenuItems(){return!!this.menuConfig?.items?.length}get _hasDefaultMenuItems(){return!!(this._showClearSelectionAction||this._showDeleteSelectionAction||this._showRefreshDataAction||this._showZoomToSelectionAction||this._showSelectedRecordsShowSelectedAction||this._showSelectedRecordsShowAllAction||this._showColumnsVisibilityAction)}get _shouldShowMenu(){const{header:e,menu:t}=this._effectiveVisibleElements;return!(!e||!t||!this._hasDefaultMenuItems&&!this._hasCustomMenuItems)}get _showClearSelectionAction(){return!(!this.highlightIds.length||!this._effectiveVisibleElements.menuItems?.clearSelection||this.relatedTables.length)}get _showColumnsVisibilityAction(){const{header:e,menu:t,menuItems:i}=this._effectiveVisibleElements;return!(!(e&&t&&i?.toggleColumns)||this.showRelatedTableCallback||this._showAllTablesEnabled)}get _showDeleteSelectionAction(){return!(!(this.editingEnabled&&this.highlightIds.length&&this._effectiveVisibleElements.menuItems?.deleteSelection&&this.layer?.capabilities?.operations?.supportsDelete)||this.relatedTables.length)}get _showLayerDropdown(){return!(!this._effectiveLayers.length||!this._effectiveVisibleElements.layerDropdown)}get _showRefreshDataAction(){return!!this._effectiveVisibleElements.menuItems?.refreshData}get _showSelectedRecordsShowSelectedAction(){const e=this.objectIds.length,t=this.highlightIds.length;return!(!t||!this._effectiveVisibleElements.menuItems?.selectedRecordsShowSelectedToggle||e&&t===e||this.relatedTables.length)}get _showSelectedRecordsShowAllAction(){return!(!this._effectiveVisibleElements.menuItems?.selectedRecordsShowAllToggle||!this.objectIds.length||this.relatedTables.length)}get _showZoomToSelectionAction(){return!!(this.view&&this.highlightIds.length&&this._effectiveVisibleElements.menuItems?.zoomToSelection)}get _viewLayers(){const e=this.view?.map;if(!e)return[];const t=[...e.allLayers,...e.allTables];return t.length?t.filter((e=>!a(e)&&g(e))):[]}get actionColumnConfig(){return this.viewModel.actionColumnConfig}set actionColumnConfig(e){this.viewModel.actionColumnConfig=e}get activeFilters(){return this.viewModel.activeFilters}get activeSortOrders(){return this.viewModel.activeSortOrders}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get autoRefreshEnabled(){return this.viewModel.autoRefreshEnabled}set autoRefreshEnabled(e){this.viewModel.autoRefreshEnabled=e}get columnPerformanceModeEnabled(){return this.viewModel.columnPerformanceModeEnabled}set columnPerformanceModeEnabled(e){this.viewModel.columnPerformanceModeEnabled=e}get columnReorderingEnabled(){return this.viewModel.columnReorderingEnabled}set columnReorderingEnabled(e){this.viewModel.columnReorderingEnabled=e}get columns(){return this.viewModel.columns}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get filterGeometry(){return this.viewModel.filterGeometry}set filterGeometry(e){this.viewModel.filterGeometry=e}get filterBySelectionEnabled(){return this.viewModel.filterBySelectionEnabled}set filterBySelectionEnabled(e){this.viewModel.filterBySelectionEnabled=e}get grid(){return this.viewModel.grid}get hiddenFields(){return this.viewModel.hiddenFields}set hiddenFields(e){this.viewModel.hiddenFields=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get highlightIds(){return this.viewModel.highlightIds}set highlightIds(e){this.viewModel.highlightIds=e}get icon(){return"table"}set icon(e){this._overrideIfSome("icon",e)}get isQueryingOrSyncing(){return this.viewModel.isQueryingOrSyncing||this.relatedTables.some((e=>!!e.isQueryingOrSyncing))}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this._drainRelatedTables(),this.viewModel.layer=e}get layerView(){return this.viewModel.layerView}get messages(){return this.viewModel.messages}set messages(e){this.viewModel.messages=e}get messagesCommon(){return this.viewModel.messagesCommon}set messagesCommon(e){this.viewModel.messagesCommon=e}get messagesURIUtils(){return this.viewModel.messagesURIUtils}set messagesURIUtils(e){this.viewModel.messagesURIUtils=e}get multipleSelectionEnabled(){return this.viewModel.multipleSelectionEnabled}set multipleSelectionEnabled(e){this.viewModel.multipleSelectionEnabled=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get objectIds(){return this.viewModel.objectIds}set objectIds(e){this.viewModel.objectIds=e}get pageSize(){return this.viewModel.pageSize}set pageSize(e){this.viewModel.pageSize=e}get relatedRecordsEnabled(){return this.viewModel.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.viewModel.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relationship(){return this.viewModel.relationship}get relationshipColumnConfigs(){return this.viewModel.relationshipColumnConfigs}set relationshipColumnConfigs(e){this.viewModel.relationshipColumnConfigs=e}get relationshipConfig(){return this.viewModel.relationshipConfig}set relationshipConfig(e){this.viewModel.relationshipConfig=e}get returnGeometryEnabled(){return this.viewModel.returnGeometryEnabled}set returnGeometryEnabled(e){this.viewModel.returnGeometryEnabled=e}get rowHighlightIds(){return this.viewModel.rowHighlightIds}set rowHighlightIds(e){this.viewModel.rowHighlightIds=e}get selectionSource(){return this.viewModel.selectionSource}set selectionSource(e){this.viewModel.selectionSource=e}get showRelatedTableCallback(){return this.viewModel.showRelatedTableCallback}set showRelatedTableCallback(e){this.viewModel.showRelatedTableCallback=e}get size(){return this.viewModel.size}get state(){return this.viewModel.state}get tableTemplate(){return this.viewModel.tableTemplate}set tableTemplate(e){this.viewModel.tableTemplate=e}get tableTemplateOverride(){return this.viewModel.tableTemplateOverride}set tableTemplateOverride(e){this.viewModel.tableTemplateOverride=e}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(e){this.viewModel.timeExtent=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}clearSelectionFilter(){this.viewModel.clearSelectionFilter()}deleteSelection(e){return this.highlightIds.length?e?(this._showDeletePrompt(),this.scheduleRender(),Promise.resolve()):this.viewModel.deleteSelection():Promise.resolve()}filterBySelection(){this.viewModel.filterBySelection()}findColumn(e){return this.viewModel.findColumn(e)}hideColumn(e){this.grid?.hideColumn(e)}async refresh(){this.relatedTables.forEach((async e=>await e.refresh())),await this.viewModel.refresh()}refreshCellContent(){this.viewModel.refreshCellContent()}showAllColumns(){this.viewModel.showAllColumns()}showColumn(e){this.grid?.showColumn(e)}sortColumn(e,t){this.viewModel.sortColumn(e,t)}scrollToIndex(e){this.viewModel.scrollToIndex(e)}toggleColumnVisibility(e){this.viewModel.toggleColumnVisibility(e)}zoomToSelection(){this.viewModel.zoomToSelection()}render(){const{_prompt:e,_effectiveVisibleElements:t,isQueryingOrSyncing:i,menuConfig:l,state:o}=this;return T("div",{bind:this,class:this.classes(R.base,y.widget)},T("calcite-panel",{bind:this,class:R.content,closable:t.close,disabled:this.disabled||"disabled"===o,heading:t.header?this._effectiveTitle:void 0,loading:"loading"===o,menuOpen:!!l?.open,overlayPositioning:"fixed",onCalcitePanelClose:e=>{e.target.closed=!1,this.emit("close")}},t.progress?T("calcite-progress",{type:i?"indeterminate":"determinate"}):null,this._showLayerDropdown?this._renderLayerDropdown():null,this._renderColumnVisibilityAction(),this._renderHeaderMenuActions(),this._renderRelatedTableNavigationBar(),T("div",{class:R.tableContainer},this._renderTables())),e?T("calcite-scrim",null,this._renderPrompt(e)):null)}_renderTables(){const{_showAllTablesEnabled:e,grid:t,relatedTables:i}=this;if(i.length){const l=i.toArray(),o=1===l.length,s=this.classes(R.base,e?R.expanded:R.collapsed),n=e||o,r=e?l:o?[l[0]]:l.slice(-2);return T("calcite-panel",{overlayPositioning:"fixed"},T("div",null,[n?T("div",{class:s},t?.render()):void 0,...r.map((e=>{const t=i.indexOf(e);return T("div",{class:s,key:`related-${t}`},e.render())})),,]))}return t?.render()}_clearPrompt(){this._prompt=null}_renderPrompt({title:e,message:t,context:i,actions:l}){const o=T("calcite-button",{appearance:"solid",key:"prompt-primary-button",kind:"danger"===i?"danger":"brand",onclick:l.primary.action,width:l.secondary?"half":"full"},l.primary.label),s=l.secondary?T("calcite-button",{appearance:"outline",key:"prompt-secondary-button",kind:"danger"===i?"danger":"brand",onclick:l.secondary.action,width:"half"},l.secondary.label):null;return T("div",{class:`${R.promptContainer}--${i}`},T("div",{class:R.promptHeader},T("calcite-icon",{icon:"exclamation-mark-triangle"}),T(f,{class:R.promptHeading,level:2},e)),T("div",{class:R.promptMessage},t),T("div",{class:R.promptDivider}),T("div",{class:R.promptActions},s,o))}_showDeletePrompt(){const{messages:e,messagesCommon:t}=this,i=E(e.deleteSelectionCount,{count:this.highlightIds.length});this._prompt={title:i,message:e.deleteRecordsRemoved,context:"danger",actions:{primary:{label:t.delete,action:this._onDeleteSelectionClick},secondary:{label:e.keepRecords,action:()=>this._clearPrompt()}}}}async _onDeleteSelectionClick(){try{await this.viewModel.deleteSelection()}finally{this._clearPrompt()}}_renderHeaderMenuAction(e){const{disabled:t,hidden:i,icon:l,text:o,clickFunction:s}=e;if(!i)return T("calcite-action",{disabled:t??this.menuConfig?.disabled,icon:l??void 0,key:o,onclick:()=>s(),slot:"header-menu-actions",text:o,textEnabled:!0,title:o})}_renderHeaderMenuActions(){return this._shouldShowMenu?[this._renderDefaultHeaderMenuActions(),this._renderCustomHeaderMenuActions()]:[]}_renderDefaultHeaderMenuActions(){if(!this._hasDefaultMenuItems)return[];const{messages:e}=this,t=[];return this._showRefreshDataAction&&t.push(this._renderHeaderMenuAction({icon:j.refresh,text:e.refreshData,clickFunction:()=>this.refresh()})),this._showDeleteSelectionAction&&t.push(this._renderHeaderMenuAction({icon:j.delete,text:e.deleteSelection,clickFunction:()=>this.deleteSelection(!0)})),this._showClearSelectionAction&&t.push(this._renderHeaderMenuAction({icon:j.clearSelection,text:e.clearSelection,clickFunction:()=>this.highlightIds?.removeAll()})),this._showZoomToSelectionAction&&t.push(this._renderHeaderMenuAction({icon:j.zoomToSelection,text:e.zoomToSelection,clickFunction:()=>this.zoomToSelection()})),this._showSelectedRecordsShowSelectedAction&&t.push(this._renderHeaderMenuAction({icon:j.showSelected,text:e.showSelected,clickFunction:()=>{const{objectIds:e}=this;e.removeAll(),e.addMany(this.highlightIds.toArray())}})),this._showSelectedRecordsShowAllAction&&t.push(this._renderHeaderMenuAction({icon:j.showAll,text:e.showAllRecords,clickFunction:()=>this.objectIds.removeAll()})),t}_renderCustomHeaderMenuActions(){return this.menuConfig?.items?.map((({disabled:e,hidden:t,icon:i,label:l,clickFunction:o})=>this._renderHeaderMenuAction({hidden:"function"==typeof t?t():t,icon:i,text:l,disabled:e,clickFunction:e=>o(e)})))??[]}_renderColumnVisibilityAction(){if(!this._showColumnsVisibilityAction)return[];const{_columnVisibilityActions:e,_effectiveVisibleElements:t,id:i,messages:l}=this,o=this.relatedTables.at(-1)||this,s=o.columns.toArray(),n=l?.toggleColumns,r=`${i}__toggle-columns-action`,a=[T("calcite-action",{afterCreate:t=>e.set(i,t),afterRemoved:()=>e.delete(i),appearance:"transparent",bind:this,disabled:o.menuConfig?.disabled,icon:"show-column",id:r,slot:"header-actions-end",text:n},t.tooltips?T("calcite-tooltip",{closeOnClick:!0,overlayPositioning:"fixed",placement:"bottom-end",slot:"tooltip"},n):null)];return o.menuConfig?.disabled||a.push(T("calcite-popover",{autoClose:!0,class:R.menuPopover,label:n,overlayPositioning:"fixed",placement:"top-end",pointerDisabled:!0,referenceElement:e.get(i)},T("calcite-list",{filterEnabled:!0,selectionMode:"multiple"},...s.map((({effectiveLabel:e,fieldName:t,hidden:i})=>T("calcite-list-item",{key:`toggle-columns__item-${t}`,label:e,selected:!i,value:t,onCalciteListItemSelect:({target:e})=>o.toggleColumnVisibility(e.value)})))))),a}_renderLayerDropdownItem(e){return T("calcite-dropdown-item",{label:e.title??"",onclick:()=>{this.layer=e},selected:e===this.layer,value:e.id},e.title)}_renderLayerDropdown(){const e=this.messages.selectALayer;return T("div",{class:R.layerDropdownMenu,key:`${this.id}-layerDropdown`,slot:"header-actions-start"},T("calcite-dropdown",{bind:this,maxItems:5,overlayPositioning:"fixed",placement:"bottom-end"},T("calcite-action",{icon:"layers",slot:"trigger",text:e,title:e}),T("calcite-dropdown-group",{selectionMode:"single"},this._effectiveLayers.map((e=>this._renderLayerDropdownItem(e)))??null)))}_onShowRelatedTable(e){if(this.showRelatedTableCallback)return;const{relatedTables:t}=this,{length:i}=t,l=i?t.getItemAt(i-1):this;this._collapseRelatedTable(l,e),this._createRelatedTable(e)}_renderRelatedTableNavigationBar(){const{messages:e}=this,t=e.exitRelatedRecords;if(this.relatedTables.length&&!this.showRelatedTableCallback)return T("div",{class:R.tableNavigation,key:"table-nav"},T("calcite-action",{icon:"move-up",key:t,onclick:()=>this._drainRelatedTables(),text:t,title:t}),this.relatedTables.toArray().map(((e,t)=>this._renderRelatedTableNavigationAction(e,t))),T("div",null,T("calcite-label",{layout:"inline"},e.showAllTables,T("calcite-switch",{checked:this._showAllTablesEnabled,onCalciteSwitchChange:e=>{const{relatedTables:t}=this,i=!!e.target.checked,l=t.at(-1);this._showAllTablesEnabled=i,l&&(i?this._enterShowAllView(l):this._exitShowAllView(l))}}))))}_renderRelatedTableNavigationAction(e,t){const i=this._getLabelForRelatedTableNavigationAction(e);return T("calcite-action",{icon:"chevron-right",key:t,onclick:()=>this._drainRelatedTablesAboveIndex(t),text:i,textEnabled:!0,title:e.layer?.title||""})}_getLabelForRelatedTableNavigationAction(e){const t=e.layer?.title;if(!t)return"";const{relatedTables:i}=this;if(i.length<=1)return t;return i.indexOf(e)!==i.length-1&&t.length>20?`${t.slice(0,20)}...`:t}_drainRelatedTables(){this.relatedTables.drain((e=>!e.destroyed&&e.destroy())),this.set({_showAllTablesEnabled:!1,multipleSelectionEnabled:!0,tableTemplateOverride:null,relationshipColumnConfigs:null,visibleElementsOverride:null}),this.hiddenFields.removeMany([b.action,b.attachments])}_drainRelatedTablesAboveIndex(e){const t=this.relatedTables,i=t.filter(((t,i)=>i>e));i.forEach((e=>!e.destroyed&&e.destroy())),t.removeMany(i);const l=t.at(-1);if(!l?.layer||!l?.relationship)return;const{layer:o,relationship:s}=l;this._showAllTablesEnabled?this._enterShowAllView(l):l.set({multipleSelectionEnabled:!0,tableTemplateOverride:null,relationshipColumnConfigs:this._getRelationshipIdsToShow(o,s.id),visibleElementsOverride:null}),l.hiddenFields.removeMany([b.action,b.attachments])}_getRelatedTableMenuItemConfig(e,t,i){return t.fields.map((({alias:l,name:o})=>({selected:o===i,label:l||o,clickFunction:i=>{i.stopPropagation(),e.tableTemplateOverride=new u({columnTemplates:[this._createRelatedFieldColumnTemplate(e,t,o)]})}})))}_createRelatedFieldColumnTemplate(e,t,i){return new m({fieldName:i,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._getRelatedTableMenuItemConfig(e,t,i)},resizable:!1})}_enterShowAllView(e){const t=e.layer;if(!t)return;const i=e===this,{visibleElements:l}=e,o=t.displayField||t.objectIdField;e.set({relationshipColumnConfigs:[],tableTemplateOverride:new u({columnTemplates:[this._createRelatedFieldColumnTemplate(e,t,o)]}),visibleElementsOverride:new p({header:i&&l.header,progress:i&&l.progress,columnMenus:l.columnMenus,close:l.close,tooltips:l.tooltips,selectionColumn:!1,columnMenuItems:new c({sortAscending:!1,sortDescending:!1})})}),e.hiddenFields.addMany([b.action,b.attachments])}_exitShowAllView(e){const{layer:t,relationship:i}=e;t&&null!=i?.id&&(e.set({relationshipColumnConfigs:this._getRelationshipIdsToShow(t,i.id),tableTemplateOverride:null,visibleElementsOverride:null}),e.hiddenFields.removeMany([b.action,b.attachments]))}_collapseRelatedTable(e,i){const{relatedLayer:l,feature:o,relationshipId:s}=i,n=l.relationships?.find((({id:e})=>e===s)),{objectIdField:r}=l,a=l.displayField||n?.keyField||r,d=o.getObjectId()??o.attributes[r],h=e===this,{close:m,columnMenus:g,header:w,layerDropdown:v,menu:y,menuItems:f,progress:_,tooltips:M}=e.visibleElements;e.set({highlightIds:new t([d]),multipleSelectionEnabled:!1,relationshipColumnConfigs:[{relationshipId:s,collapsed:!0}],tableTemplateOverride:new u({columnTemplates:[this._createRelatedFieldColumnTemplate(e,l,a)]}),visibleElementsOverride:new p({header:h&&w,progress:h&&_,columnMenus:g,close:m,layerDropdown:v,menu:y,menuItems:f,tooltips:M,selectionColumn:!1,columnMenuItems:new c({sortAscending:!1,sortDescending:!1})})}),e.hiddenFields.addMany([b.action,b.attachments])}_getRelationshipIdsToShow(e,t){return(e.relationships??[]).filter((e=>!(e.id===t&&"one-to-one"===e.cardinality))).map((({id:e})=>({relationshipId:e})))}async _createRelatedTable(e){const{editingEnabled:t,relatedTables:i,view:l,viewModel:o}=this,{layer:n,feature:r,relatedLayer:a,relationshipId:d}=e,c=r.getObjectId()??r.attributes[a.objectIdField],h=i.length,m=h?i.getItemAt(h-1):this;await n.load();const u=this.attachmentsEnabled&&w(n),g=new S({layer:n,attachmentsEnabled:u,editingEnabled:t,relatedRecordsEnabled:!0,relationshipConfig:{objectId:c,relatedLayer:a,relationshipId:d},relationshipColumnConfigs:this._getRelationshipIdsToShow(n,d),tableParent:m,view:l,visibleElements:new p({header:!1,progress:!1}),showRelatedTableCallback:({feature:e,layer:t,relatedLayer:i,relationshipId:l})=>{null!=(e.getObjectId()??e.attributes[i.objectIdField])&&o.emit("show-related-table",{feature:e,layer:t,relatedLayer:i,relationshipId:l})}});g.addHandles([s((()=>m.highlightIds),"change",(({added:e})=>{const t=e[0];null!=t&&(g.highlightIds.removeAll(),g.relationshipConfig={objectId:t,relatedLayer:a,relationshipId:d})})),s((()=>m),"cell-click",(e=>{const{feature:t}=e;if(t){const e=t.getObjectId()??t.attributes[a.objectIdField];null!=e&&m.highlightIds.add(e)}}))]),this.relatedTables.add(g),this.scheduleRender()}};e([n()],k.prototype,"_columnVisibilityActions",void 0),e([n()],k.prototype,"_effectiveLayers",null),e([n()],k.prototype,"_effectiveTitle",null),e([n()],k.prototype,"_effectiveVisibleElements",null),e([n()],k.prototype,"_hasCustomMenuItems",null),e([n()],k.prototype,"_hasDefaultMenuItems",null),e([n()],k.prototype,"_prompt",void 0),e([n()],k.prototype,"_shouldShowMenu",null),e([n()],k.prototype,"_showAllTablesEnabled",void 0),e([n()],k.prototype,"_showClearSelectionAction",null),e([n()],k.prototype,"_showColumnsVisibilityAction",null),e([n()],k.prototype,"_showDeleteSelectionAction",null),e([n()],k.prototype,"_showLayerDropdown",null),e([n()],k.prototype,"_showRefreshDataAction",null),e([n()],k.prototype,"_showSelectedRecordsShowSelectedAction",null),e([n()],k.prototype,"_showSelectedRecordsShowAllAction",null),e([n()],k.prototype,"_showZoomToSelectionAction",null),e([n()],k.prototype,"_viewLayers",null),e([n()],k.prototype,"actionColumnConfig",null),e([n({readOnly:!0})],k.prototype,"activeFilters",null),e([n({readOnly:!0})],k.prototype,"activeSortOrders",null),e([n()],k.prototype,"attachmentsEnabled",null),e([n()],k.prototype,"autoRefreshEnabled",null),e([n()],k.prototype,"columnPerformanceModeEnabled",null),e([n()],k.prototype,"columnReorderingEnabled",null),e([n({readOnly:!0})],k.prototype,"columns",null),e([n()],k.prototype,"disabled",void 0),e([n()],k.prototype,"editingEnabled",null),e([n()],k.prototype,"filterGeometry",null),e([n()],k.prototype,"filterBySelectionEnabled",null),e([n({readOnly:!0})],k.prototype,"grid",null),e([n()],k.prototype,"hiddenFields",null),e([n()],k.prototype,"highlightEnabled",null),e([n()],k.prototype,"highlightIds",null),e([n()],k.prototype,"icon",null),e([n()],k.prototype,"isQueryingOrSyncing",null),e([n()],k.prototype,"label",null),e([n()],k.prototype,"layer",null),e([n()],k.prototype,"layers",void 0),e([n()],k.prototype,"layerView",null),e([n(),M("esri/widgets/FeatureTable/t9n/FeatureTable")],k.prototype,"messages",null),e([n(),M("esri/t9n/common")],k.prototype,"messagesCommon",null),e([n(),M("esri/widgets/support/t9n/uriUtils")],k.prototype,"messagesURIUtils",null),e([n()],k.prototype,"menuConfig",void 0),e([n()],k.prototype,"multipleSelectionEnabled",null),e([n()],k.prototype,"multiSortEnabled",null),e([n()],k.prototype,"objectIds",null),e([n()],k.prototype,"pageSize",null),e([n()],k.prototype,"relatedRecordsEnabled",null),e([n()],k.prototype,"relatedTable",null),e([n()],k.prototype,"relatedTables",void 0),e([n()],k.prototype,"relationship",null),e([n()],k.prototype,"relationshipColumnConfigs",null),e([n()],k.prototype,"relationshipConfig",null),e([n()],k.prototype,"returnGeometryEnabled",null),e([n()],k.prototype,"rowHighlightIds",null),e([n()],k.prototype,"selectionSource",null),e([n()],k.prototype,"showRelatedTableCallback",null),e([n()],k.prototype,"size",null),e([n({readOnly:!0})],k.prototype,"state",null),e([n({constructOnly:!0})],k.prototype,"tableParent",void 0),e([n()],k.prototype,"tableTemplate",null),e([n()],k.prototype,"tableTemplateOverride",null),e([n()],k.prototype,"title",void 0),e([n()],k.prototype,"timeExtent",null),e([n()],k.prototype,"timeZone",null),e([n()],k.prototype,"view",null),e([n({type:h}),C(["cell-click","cell-pointerover","cell-pointerout","cell-keydown","show-related-table"])],k.prototype,"viewModel",void 0),e([n({type:p,nonNullable:!0})],k.prototype,"visibleElements",void 0),e([n({type:p})],k.prototype,"visibleElementsOverride",void 0),k=S=e([r("esri.widgets.FeatureTable")],k);const F=k;export{F as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import{isSome as i}from"../../core/arrayUtils.js";import s from"../../core/Error.js";import r from"../../core/Logger.js";import{debounce as o,isAbortError as a}from"../../core/promiseUtils.js";import n from"../../core/ReactiveSet.js";import{watch as l,when as h,sync as u}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{initializeProjection as p,project as g}from"../../geometry/projection.js";import{getPointFromGeometry as m}from"../../geometry/support/geometryUtils.js";import{geographicToWebMercator as f}from"../../geometry/support/webMercatorUtils.js";import y from"../../layers/Layer.js";import{fallbackObjectIDAttribute as F}from"../../layers/LayerConstants.js";import{getDisplayedSymbol as w}from"../../symbols/support/symbolUtils.js";import{system as v}from"../../time/timeZoneUtils.js";import{highlightsSupported as _}from"../../views/support/layerViewUtils.js";import b from"../Feature/FeatureViewModel.js";import{ActionsCollection as C,zoomToFeature as P,zoomToClusteredFeatures as E,browseClusteredFeatures as j}from"../Popup/actions.js";import{triggerAction as M,isClusterFeature as A,removeClusteredFeaturesForBrowsing as L,displayClusterExtent as V,browseAggregateFeatures as I,getSelectedTarget as S}from"../Popup/actionUtils.js";import x from"../support/AnchorElementViewModel.js";import{GoToMixin as O}from"../support/GoTo.js";import T from"../../symbols/SimpleFillSymbol.js";import R from"../../geometry/Point.js";const H=()=>[P.clone()],B=()=>[E.clone(),j.clone()];let U=null;function Z(e,t){return"building-scene"===e||"2d"===t&&("map-image"===e||"tile"===e||"imagery"===e||"imagery-tile"===e)}let G=class extends(O(x)){constructor(e){super(e),this._pendingPromises=new n,this._fetchFeaturesController=null,this._highlightSelectedFeaturePromise=null,this._highlightActiveFeaturePromise=null,this._selectedClusterFeature=null,this._locationScaleHandle=null,this.actions=new C,this.activeFeature=null,this.autoCloseEnabled=!1,this.browseClusterEnabled=!1,this.content=null,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.selectedClusterBoundaryFeature=new t({symbol:new T({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null,this._debouncedLocationUpdate=o((async e=>{const{spatialReference:t}=this,i=this.selectedFeature?.geometry?.type,s=this.location??e;if("mesh"!==i&&t&&s&&this.selectedFeature)if("point"!==i)try{const{pendingFeatures:e}=await this._fetchFeaturesWithController({mapPoint:s}),i=(await Promise.all(e)).flat().filter(Boolean);if(!i.length)return;if(i.length!==this.features.length){const e=this._getHighlightLayer(this.selectedFeature),t="imagery"===e?.type?void 0:e&&"objectIdField"in e?e.objectIdField||F:null;if(t){const s=this.selectedFeature.getObjectId(),r=i.findIndex((i=>{const r=this._getHighlightLayer(i);return r?.uid===e?.uid&&i.attributes[t]===s}));this.features=i,this.selectedFeatureIndex=r}}const r=i[this.selectedFeatureIndex]?.geometry,o=("mesh"!==r?.type?r:null)??this.selectedFeature.geometry,a=o?g(o,t):null;if(!a)return;U||(U=await import("../../geometry/geometryEngineAsync.js")),await U.intersects(a,s)||(this.location=(await U.nearestCoordinate(a,s)).coordinate??s)}catch(o){a(o)||r.getLogger(this).error(o)}else this.location=m(this.selectedFeature.geometry)??s}))}initialize(){this.addHandles([this.on("view-change",(()=>this._autoClose())),l((()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view]),(()=>this._highlightSelectedFeature())),l((()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view]),(()=>this._highlightActiveFeature())),l((()=>this.view?.animation?.state),(e=>this._animationStateChange(e))),l((()=>this.location),(e=>this._locationChange(e))),l((()=>this.selectedFeature),(e=>this._selectedFeatureChange(e))),l((()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage]),(()=>this._selectedFeatureIndexChange())),l((()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels]),(()=>this._setGraphicOnFeatureViewModels())),l((()=>this.featureViewModels),(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>M({event:e,viewModel:this,view:this.view}))),h((()=>!this.waitingForResult),(()=>this._waitingForResultChange()),u),l((()=>[this.features,this.map,this.spatialReference,this.timeZone]),(()=>this._updateFeatureVMs())),l((()=>this.view?.scale),(()=>this._viewScaleChange())),h((()=>!this.visible),(()=>this.browseClusterEnabled=!1)),l((()=>this.browseClusterEnabled),(e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing()))])}destroy(){this._cancelFetchingFeatures(),this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null,this._locationScaleHandle?.remove(),this._locationScaleHandle=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new C;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,a=r?i.concat(t):t,n=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=n?.actions,h=n?.overwriteActions?l:l?.concat(a)??a;return h?.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){const e=this._get("defaultActions")||new C;return e.removeAll(),e.addMany(A(this.selectedFeature)?B():H()),e}get featureCount(){return this.features.length}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1)}set location(e){let t=e;const i=this.spatialReference?.isWebMercator,s=e?.spatialReference?.isWGS84;s&&i&&(t=f(e)),this._set("location",t)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),(e=e.slice(0)).forEach((e=>this._pendingPromises.add(e))),e.reduce(((e,t)=>e.finally((()=>t.then((e=>{this._pendingPromises.has(t)&&this._updateFeatures(e)})).finally((()=>this._pendingPromises.delete(t))).catch((()=>{}))))),Promise.resolve())):this._set("promises",[])}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;e=isNaN(e)||e<-1||!t?-1:(e+t)%t,this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{view:e,map:t}=this;return e?e.ready?"ready":"disabled":t?"ready":"disabled"}get timeZone(){return this.view?.timeZone??v}set timeZone(e){this._overrideIfSome("timeZone",e)}get waitingForContents(){return this.featureViewModels.some((e=>e.waitingForContent))}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}centerAtLocation(){const{view:e}=this,t=S(this);return t&&e?this.callGoTo({target:{target:t,scale:e.scale}}):Promise.reject(new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e)throw new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return i.fetchPopupFeatures(e,{pointerType:t?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t?.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.at(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex++,this}previous(){return this.selectedFeatureIndex--,this}disableClusterBrowsing(){L(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;"2d"===e?.type?A(t)?(await V(this),await I(this)):r.getLogger(this).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):r.getLogger(this).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}handleViewClick(e){this._fetchFeaturesAndOpen(e)}_animationStateChange(e){this.zoomToLocation||(P.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=[this.selectedClusterBoundaryFeature,this._selectedClusterFeature].filter(i);this.view?.graphics?.removeMany(e),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(A(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=this.selectedFeature?[this.selectedFeature]:[])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i,view:s}=this;s&&i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>1?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>1?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null===i)return;const o=((i-1)*s+t)%t,a=o+s;r.slice(o,a).forEach(((t,i)=>{t&&(t.graphic??=e[o+i])}))}async _selectedFeatureChange(e){const{location:t,updateLocationEnabled:i,view:s}=this;if(e&&s){if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),A(e))return;return e.symbol=await w(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}if(e.symbol=await w(e),!i&&t||!e.geometry){if(i&&!e.geometry){await this.centerAtLocation();const e=s.center?.clone();e&&(this.location=e)}}else this.location=m(e.geometry)}}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}async _setFetchFeaturesPromises(e){const{pendingFeatures:t}=await this._fetchFeaturesWithController({mapPoint:e});this.promises=t}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i,view:s,spatialReference:r,map:o,timeZone:a,location:n}=this;if(A(e)||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t?.length)return;const l=i.slice(0),h=[];t.forEach(((t,i)=>{if(!t)return;let u=null;if(l.some(((e,i)=>(e&&e.graphic===t&&(u=e,l.splice(i,1)),!!u))),u)h[i]=u;else{const l=new b({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:r,graphic:t===e?t:null,location:n,map:o,view:s,timeZone:a});h[i]=l}})),l.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",h)}async _getScreenPoint(e,t){const{spatialReference:i,view:s}=this;if(!s)return null;await(s?.when());const r=e?.spatialReference;return r&&i?(await p(r,i,null,t),s.toScreen(e)):null}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null}async _projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,event:i,signal:s}){return this.fetchFeatures(t??await this._getScreenPoint(e??this.location,{signal:s}),{signal:s,event:i})}_fetchFeaturesWithController({mapPoint:e,screenPoint:t,event:i}){this._cancelFetchingFeatures();const s=new AbortController,{signal:r}=s;this._fetchFeaturesController=s;const o=this._projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,signal:r,event:i});return o.catch((()=>{})).then((()=>{this._fetchFeaturesController=null})),o}async _fetchFeaturesAndOpen(e){const{mapPoint:t,screenPoint:i}=e,{view:s}=this;this._locationScaleHandle?.remove(),this._locationScaleHandle=l((()=>this.view?.scale),(()=>this._debouncedLocationUpdate(t).catch((e=>{a(e)||r.getLogger(this).error(e)}))));const{pendingFeatures:o}=await this._fetchFeaturesWithController({mapPoint:t,screenPoint:i,event:e});s?.popup&&"open"in s.popup&&s.popup.open({location:t??void 0,promises:o})}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return i&&"layer"in i&&i.layer?i.layer:"map-notes"===i?.type||"subtype-group"===i?.type?i:t}_getHighlightTarget(e,t,i){if(Z(t.type,i))return e;const s=e.getObjectId();if(null!=s)return s;const r="imagery"===t.type?void 0:"objectIdField"in t?t.objectIdField||F:null,o=e.attributes;return o&&r&&o[r]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightActiveFeature(){const e="highlight-active-feature";this.removeHandles(e);const{highlightEnabled:t,view:i,activeFeature:s,visible:r}=this;if(!(s&&i&&t&&r))return;const o=this._getHighlightLayer(s);if(!(o&&o instanceof y&&this._mapIncludesLayer(o)))return;const a=this._getLayerView(i,o);this._highlightActiveFeaturePromise=a;const n=await a;if(!(n&&_(n)&&this._highlightActiveFeaturePromise===a&&this.activeFeature&&this.highlightEnabled))return;const l=n.highlight(this._getHighlightTarget(s,o,i.type));this.addHandles(l,e)}async _highlightSelectedFeature(){const e="highlight-selected-feature";this.removeHandles(e);const{selectedFeature:t,highlightEnabled:i,view:s,visible:r}=this;if(!(t&&s&&i&&r))return;const o=this._getHighlightLayer(t);if(!(o&&o instanceof y&&this._mapIncludesLayer(o)))return;const a=this._getLayerView(s,o);this._highlightSelectedFeaturePromise=a;const n=await a;if(!(n&&_(n)&&this._highlightSelectedFeaturePromise===a&&this.selectedFeature&&this.highlightEnabled&&this.visible))return;const l=n.highlight(this._getHighlightTarget(t,o,s.type));this.addHandles(l,e)}_updateFeatures(e){const{features:t}=this,i=e.filter((e=>!t.includes(e)));i?.length&&(this.features=t.concat(i))}};e([c()],G.prototype,"_fetchFeaturesController",void 0),e([c({type:C})],G.prototype,"actions",void 0),e([c({readOnly:!0})],G.prototype,"active",null),e([c()],G.prototype,"activeFeature",void 0),e([c({readOnly:!0})],G.prototype,"allActions",null),e([c()],G.prototype,"autoCloseEnabled",void 0),e([c()],G.prototype,"browseClusterEnabled",void 0),e([c()],G.prototype,"content",void 0),e([c({type:C,readOnly:!0})],G.prototype,"defaultActions",null),e([c({type:Boolean})],G.prototype,"defaultPopupTemplateEnabled",void 0),e([c({readOnly:!0})],G.prototype,"featureCount",null),e([c()],G.prototype,"featurePage",void 0),e([c({value:[]})],G.prototype,"features",null),e([c()],G.prototype,"featuresPerPage",void 0),e([c()],G.prototype,"featureMenuOpen",void 0),e([c()],G.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],G.prototype,"featureViewModels",void 0),e([c()],G.prototype,"highlightEnabled",void 0),e([c()],G.prototype,"includeDefaultActions",void 0),e([c({type:R})],G.prototype,"location",null),e([c()],G.prototype,"map",null),e([c({readOnly:!0})],G.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],G.prototype,"promiseCount",null),e([c()],G.prototype,"promises",null),e([c({readOnly:!0})],G.prototype,"selectedClusterBoundaryFeature",void 0),e([c({value:null,readOnly:!0})],G.prototype,"selectedFeature",null),e([c({value:-1})],G.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],G.prototype,"selectedFeatureViewModel",null),e([c({readOnly:!0})],G.prototype,"state",null),e([c()],G.prototype,"timeZone",null),e([c()],G.prototype,"title",void 0),e([c()],G.prototype,"updateLocationEnabled",void 0),e([c()],G.prototype,"view",void 0),e([c()],G.prototype,"visible",void 0),e([c({readOnly:!0})],G.prototype,"waitingForContents",null),e([c({readOnly:!0})],G.prototype,"waitingForResult",null),e([c()],G.prototype,"zoomFactor",void 0),e([c()],G.prototype,"zoomToLocation",void 0),e([c()],G.prototype,"centerAtLocation",null),G=e([d("esri.widgets.Features.FeaturesViewModel")],G);const z=G;export{z as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import{isSome as i}from"../../core/arrayUtils.js";import s from"../../core/Error.js";import r from"../../core/Logger.js";import{debounce as o,isAbortError as a}from"../../core/promiseUtils.js";import n from"../../core/ReactiveSet.js";import{watch as l,when as u,sync as h}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{initializeProjection as p,project as g}from"../../geometry/projection.js";import{getPointFromGeometry as m}from"../../geometry/support/geometryUtils.js";import{geographicToWebMercator as f}from"../../geometry/support/webMercatorUtils.js";import y from"../../layers/Layer.js";import{fallbackObjectIDAttribute as F}from"../../layers/LayerConstants.js";import{getDisplayedSymbol as w}from"../../symbols/support/symbolUtils.js";import{system as v}from"../../time/timeZoneUtils.js";import{highlightsSupported as _}from"../../views/support/layerViewUtils.js";import b from"../Feature/FeatureViewModel.js";import{ActionsCollection as C,zoomToFeature as P,zoomToClusteredFeatures as E,browseClusteredFeatures as j}from"../Popup/actions.js";import{triggerAction as M,isClusterFeature as A,removeClusteredFeaturesForBrowsing as L,displayClusterExtent as V,browseAggregateFeatures as I,getSelectedTarget as S}from"../Popup/actionUtils.js";import x from"../support/AnchorElementViewModel.js";import{GoToMixin as O}from"../support/GoTo.js";import T from"../../symbols/SimpleFillSymbol.js";import R from"../../geometry/Point.js";const H=()=>[P.clone()],B=()=>[E.clone(),j.clone()];let U=null;function Z(e,t){return"building-scene"===e||"2d"===t&&("map-image"===e||"tile"===e||"imagery"===e||"imagery-tile"===e)}let G=class extends(O(x)){constructor(e){super(e),this._pendingPromises=new n,this._fetchFeaturesController=null,this._highlightSelectedFeaturePromise=null,this._highlightActiveFeaturePromise=null,this._selectedClusterFeature=null,this._locationScaleHandle=null,this.actions=new C,this.activeFeature=null,this.autoCloseEnabled=!1,this.browseClusterEnabled=!1,this.content=null,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.selectedClusterBoundaryFeature=new t({symbol:new T({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null,this._debouncedLocationUpdate=o((async e=>{const{spatialReference:t}=this,i=this.selectedFeature?.geometry?.type,s=this.location??e;if("mesh"!==i&&t&&s&&this.selectedFeature)if("point"!==i)try{const{pendingFeatures:e}=await this._fetchFeaturesWithController({mapPoint:s}),i=(await Promise.all(e)).flat().filter(Boolean);if(!i.length)return;if(i.length!==this.features.length){const e=this._getHighlightLayer(this.selectedFeature),t="imagery"===e?.type?void 0:e&&"objectIdField"in e?e.objectIdField||F:null;if(t){const s=this.selectedFeature.getObjectId(),r=i.findIndex((i=>{const r=this._getHighlightLayer(i);return r?.uid===e?.uid&&i.attributes[t]===s}));this.features=i,this.selectedFeatureIndex=r}}const r=i[this.selectedFeatureIndex]?.geometry,o=("mesh"!==r?.type?r:null)??this.selectedFeature.geometry,a=o?g(o,t):null;if(!a)return;U||(U=await import("../../geometry/geometryEngineAsync.js")),await U.intersects(a,s)||(this.location=(await U.nearestCoordinate(a,s)).coordinate??s)}catch(o){a(o)||r.getLogger(this).error(o)}else this.location=m(this.selectedFeature.geometry)??s}))}initialize(){this.addHandles([this.on("view-change",(()=>this._autoClose())),l((()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view]),(()=>this._highlightSelectedFeature())),l((()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view]),(()=>this._highlightActiveFeature())),l((()=>this.view?.animation?.state),(e=>this._animationStateChange(e))),l((()=>this.location),(e=>this._locationChange(e))),l((()=>this.selectedFeature),(e=>this._selectedFeatureChange(e))),l((()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage]),(()=>this._selectedFeatureIndexChange())),l((()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels]),(()=>this._setGraphicOnFeatureViewModels())),l((()=>this.featureViewModels),(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>M({event:e,viewModel:this,view:this.view}))),u((()=>!this.waitingForResult),(()=>this._waitingForResultChange()),h),l((()=>[this.features,this.map,this.spatialReference,this.timeZone]),(()=>this._updateFeatureVMs())),l((()=>this.view?.scale),(()=>this._viewScaleChange())),u((()=>!this.visible),(()=>this.browseClusterEnabled=!1)),l((()=>this.browseClusterEnabled),(e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing()))])}destroy(){this._cancelFetchingFeatures(),this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null,this._locationScaleHandle?.remove(),this._locationScaleHandle=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new C;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,a=r?i.concat(t):t,n=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=n?.actions,u=n?.overwriteActions?l:l?.concat(a)??a;return u?.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){const e=this._get("defaultActions")||new C;return e.removeAll(),e.addMany(A(this.selectedFeature)?B():H()),e}get featureCount(){return this.features.length}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1)}set location(e){let t=e;const i=this.spatialReference?.isWebMercator,s=e?.spatialReference?.isWGS84;s&&i&&(t=f(e)),this._set("location",t)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),(e=e.slice(0)).forEach((e=>this._pendingPromises.add(e))),e.reduce(((e,t)=>e.finally((()=>t.then((e=>{this._pendingPromises.has(t)&&this._updateFeatures(e)})).finally((()=>this._pendingPromises.delete(t))).catch((()=>{}))))),Promise.resolve())):this._set("promises",[])}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;e=isNaN(e)||e<-1||!t?-1:(e+t)%t,this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{view:e,map:t}=this;return e?e.ready?"ready":"disabled":t?"ready":"disabled"}get timeZone(){return this.view?.timeZone??v}set timeZone(e){this._overrideIfSome("timeZone",e)}get waitingForContents(){return this.featureViewModels.some((e=>e.waitingForContent))}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}centerAtLocation(){const{view:e}=this,t=S(this);return t&&e?this.callGoTo({target:{target:t,scale:e.scale}}):Promise.reject(new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e)throw new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return i.fetchPopupFeatures(e,{pointerType:t?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t?.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.at(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex++,this}previous(){return this.selectedFeatureIndex--,this}disableClusterBrowsing(){L(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;"2d"===e?.type?A(t)?(await V(this),await I(this)):r.getLogger(this).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):r.getLogger(this).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}handleViewClick(e){this._fetchFeaturesAndOpen(e)}_animationStateChange(e){this.zoomToLocation||(P.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=[this.selectedClusterBoundaryFeature,this._selectedClusterFeature].filter(i);this.view?.graphics?.removeMany(e),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(A(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=this.selectedFeature?[this.selectedFeature]:[])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i,view:s}=this;s&&i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>1?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>1?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null===i)return;const o=((i-1)*s+t)%t,a=o+s;r.slice(o,a).forEach(((t,i)=>{t&&(t.graphic??=e[o+i])}))}async _selectedFeatureChange(e){const{location:t,updateLocationEnabled:i,view:s}=this;if(!e||!s)return;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),A(e))return;return e.symbol=await w(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}const r=e.sourceLayer?.type;if("map-image"!==r&&"imagery"!==r&&"imagery-tile"!==r||(e.symbol=await w(e)),!i&&t||!e.geometry){if(i&&!e.geometry){await this.centerAtLocation();const e=s.center?.clone();e&&(this.location=e)}}else this.location=m(e.geometry)}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}async _setFetchFeaturesPromises(e){const{pendingFeatures:t}=await this._fetchFeaturesWithController({mapPoint:e});this.promises=t}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i,view:s,spatialReference:r,map:o,timeZone:a,location:n}=this;if(A(e)||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t?.length)return;const l=i.slice(0),u=[];t.forEach(((t,i)=>{if(!t)return;let h=null;if(l.some(((e,i)=>(e&&e.graphic===t&&(h=e,l.splice(i,1)),!!h))),h)u[i]=h;else{const l=new b({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:r,graphic:t===e?t:null,location:n,map:o,view:s,timeZone:a});u[i]=l}})),l.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",u)}async _getScreenPoint(e,t){const{spatialReference:i,view:s}=this;if(!s)return null;await(s?.when());const r=e?.spatialReference;return r&&i?(await p(r,i,null,t),s.toScreen(e)):null}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null}async _projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,event:i,signal:s}){return this.fetchFeatures(t??await this._getScreenPoint(e??this.location,{signal:s}),{signal:s,event:i})}_fetchFeaturesWithController({mapPoint:e,screenPoint:t,event:i}){this._cancelFetchingFeatures();const s=new AbortController,{signal:r}=s;this._fetchFeaturesController=s;const o=this._projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,signal:r,event:i});return o.catch((()=>{})).then((()=>{this._fetchFeaturesController=null})),o}async _fetchFeaturesAndOpen(e){const{mapPoint:t,screenPoint:i}=e,{view:s}=this;this._locationScaleHandle?.remove(),this._locationScaleHandle=l((()=>this.view?.scale),(()=>this._debouncedLocationUpdate(t).catch((e=>{a(e)||r.getLogger(this).error(e)}))));const{pendingFeatures:o}=await this._fetchFeaturesWithController({mapPoint:t,screenPoint:i,event:e});s?.popup&&"open"in s.popup&&s.popup.open({location:t??void 0,promises:o})}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return i&&"layer"in i&&i.layer?i.layer:"map-notes"===i?.type||"subtype-group"===i?.type?i:t}_getHighlightTarget(e,t,i){if(Z(t.type,i))return e;const s=e.getObjectId();if(null!=s)return s;const r="imagery"===t.type?void 0:"objectIdField"in t?t.objectIdField||F:null,o=e.attributes;return o&&r&&o[r]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightActiveFeature(){const e="highlight-active-feature";this.removeHandles(e);const{highlightEnabled:t,view:i,activeFeature:s,visible:r}=this;if(!(s&&i&&t&&r))return;const o=this._getHighlightLayer(s);if(!(o&&o instanceof y&&this._mapIncludesLayer(o)))return;const a=this._getLayerView(i,o);this._highlightActiveFeaturePromise=a;const n=await a;if(!(n&&_(n)&&this._highlightActiveFeaturePromise===a&&this.activeFeature&&this.highlightEnabled))return;const l=n.highlight(this._getHighlightTarget(s,o,i.type));this.addHandles(l,e)}async _highlightSelectedFeature(){const e="highlight-selected-feature";this.removeHandles(e);const{selectedFeature:t,highlightEnabled:i,view:s,visible:r}=this;if(!(t&&s&&i&&r))return;const o=this._getHighlightLayer(t);if(!(o&&o instanceof y&&this._mapIncludesLayer(o)))return;const a=this._getLayerView(s,o);this._highlightSelectedFeaturePromise=a;const n=await a;if(!(n&&_(n)&&this._highlightSelectedFeaturePromise===a&&this.selectedFeature&&this.highlightEnabled&&this.visible))return;const l=n.highlight(this._getHighlightTarget(t,o,s.type));this.addHandles(l,e)}_updateFeatures(e){const{features:t}=this,i=e.filter((e=>!t.includes(e)));i?.length&&(this.features=t.concat(i))}};e([c()],G.prototype,"_fetchFeaturesController",void 0),e([c({type:C})],G.prototype,"actions",void 0),e([c({readOnly:!0})],G.prototype,"active",null),e([c()],G.prototype,"activeFeature",void 0),e([c({readOnly:!0})],G.prototype,"allActions",null),e([c()],G.prototype,"autoCloseEnabled",void 0),e([c()],G.prototype,"browseClusterEnabled",void 0),e([c()],G.prototype,"content",void 0),e([c({type:C,readOnly:!0})],G.prototype,"defaultActions",null),e([c({type:Boolean})],G.prototype,"defaultPopupTemplateEnabled",void 0),e([c({readOnly:!0})],G.prototype,"featureCount",null),e([c()],G.prototype,"featurePage",void 0),e([c({value:[]})],G.prototype,"features",null),e([c()],G.prototype,"featuresPerPage",void 0),e([c()],G.prototype,"featureMenuOpen",void 0),e([c()],G.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],G.prototype,"featureViewModels",void 0),e([c()],G.prototype,"highlightEnabled",void 0),e([c()],G.prototype,"includeDefaultActions",void 0),e([c({type:R})],G.prototype,"location",null),e([c()],G.prototype,"map",null),e([c({readOnly:!0})],G.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],G.prototype,"promiseCount",null),e([c()],G.prototype,"promises",null),e([c({readOnly:!0})],G.prototype,"selectedClusterBoundaryFeature",void 0),e([c({value:null,readOnly:!0})],G.prototype,"selectedFeature",null),e([c({value:-1})],G.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],G.prototype,"selectedFeatureViewModel",null),e([c({readOnly:!0})],G.prototype,"state",null),e([c()],G.prototype,"timeZone",null),e([c()],G.prototype,"title",void 0),e([c()],G.prototype,"updateLocationEnabled",void 0),e([c()],G.prototype,"view",void 0),e([c()],G.prototype,"visible",void 0),e([c({readOnly:!0})],G.prototype,"waitingForContents",null),e([c({readOnly:!0})],G.prototype,"waitingForResult",null),e([c()],G.prototype,"zoomFactor",void 0),e([c()],G.prototype,"zoomToLocation",void 0),e([c()],G.prototype,"centerAtLocation",null),G=e([d("esri.widgets.Features.FeaturesViewModel")],G);const z=G;export{z as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{IdentifiableMixin as t}from"../../core/Identifiable.js";import{destroyMaybe as i}from"../../core/maybe.js";import{watch as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{IdentifiableMixin as t}from"../../core/Identifiable.js";import{destroyMaybe as i}from"../../core/maybe.js";import{watch as n,initial as r}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import l from"../Widget.js";import{isSublayer as d}from"./support/layerListUtils.js";import{isWidget as a}from"../support/widget.js";import{tsx as p}from"../support/jsxFactory.js";let g=class extends(t(l)){constructor(e,t){super(e,t),this._legend=null,this.className=null,this.content=null,this.flowEnabled=!1,this.image=null,this.listItem=null,this.open=!1,this.visible=!0}initialize(){this.addHandles([n((()=>this._canCreateLegend),(()=>this._createLegend()),r),n((()=>[this._legend,this._legendOptions]),(()=>this._updateLegend()),r)])}destroy(){this._legend=i(this._legend)}get _canCreateLegend(){const{content:e,listItem:t}=this;if(!t)return!1;const i="legend";return e===i||null!=e&&!!Array.isArray(e)&&e.includes(i)}get _legendOptions(){const{listItem:e,_legendLayerInfo:t}=this,i=e?.view;return t&&i?{view:i,layerInfos:[t]}:{}}get _legendLayerInfo(){const e=this.listItem?.layer;if(!e||"subtype-sublayer"===e.type)return null;const t=d(e)?e:null,i=e?.parent,n=null!=i&&"type"in i&&"map-image"===i.type?t?.source:null,r="";return n&&i?{layer:i,title:r,sublayerIds:[n.mapLayerId]}:{layer:e,title:r}}get disabled(){const{listItem:e,_legend:t,content:i}=this;return!e||!(Array.isArray(i)&&i.length>1)&&(!!t&&(!t.activeLayerInfos?.length||!e.visibleAtCurrentScale||!e.visible))}set disabled(e){this._overrideIfSome("disabled",e)}get icon(){const{image:e}=this,t=this._getFirstWidget();return this._get("icon")??(!e&&t?t.icon:null)}set icon(e){this._overrideIfSome("icon",e)}get title(){return this._get("title")||(this._getFirstWidget()?.label??"")}set title(e){this._override("title",e)}render(){return p("div",{class:"esri-list-item-panel"},this._renderContents())}_renderContent(e){const{_legend:t,disabled:i}=this;return!e||i?null:"legend"===e&&t?p("div",{key:"legend-widget"},t.render()):"string"==typeof e?p("div",{innerHTML:e,key:e}):a(e)?p("div",{key:"content-widget"},e.render()):e instanceof HTMLElement?p("div",{afterCreate:this._attachToNode,bind:e,key:"content-element"}):null}_renderContents(){const{content:e}=this;return Array.isArray(e)?e.map((e=>this._renderContent(e))):this._renderContent(e)}async _createLegend(){if(i(this._legend),this._legend=null,!this._canCreateLegend)return;const{default:e}=await import("../Legend.js"),t=new e(this._legendOptions);this._legend=t}_attachToNode(e){e.appendChild(this)}_updateLegend(){const e=this._legend;e&&e.set(this._legendOptions)}_getWidget(e){return"legend"===e?this._legend:a(e)?e:null}_getFirstWidget(){const{content:e}=this;return Array.isArray(e)?e.map((e=>this._getWidget(e))).find((e=>e)):this._getWidget(e)}};e([s()],g.prototype,"_legend",void 0),e([s()],g.prototype,"_canCreateLegend",null),e([s()],g.prototype,"_legendOptions",null),e([s()],g.prototype,"_legendLayerInfo",null),e([s()],g.prototype,"className",void 0),e([s()],g.prototype,"content",void 0),e([s()],g.prototype,"disabled",null),e([s()],g.prototype,"flowEnabled",void 0),e([s()],g.prototype,"icon",null),e([s()],g.prototype,"image",void 0),e([s()],g.prototype,"listItem",void 0),e([s()],g.prototype,"open",void 0),e([s()],g.prototype,"title",null),e([s()],g.prototype,"visible",void 0),g=e([o("esri.widgets.LayerList.ListItemPanel")],g);const c=g;export{c as default};
|