@arcgis/core 6.0.0-next.6 → 6.0.0-next.8
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/arcade/functions/knowledgegraph.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{f09c9d9a554c33a753b4.js → 02253bdffbd580af22d8.js} +1 -1
- package/assets/esri/core/workers/chunks/06ab24a083c3229228dd.js +1 -0
- package/assets/esri/core/workers/chunks/09a63cc1987f8636c5b0.js +1 -0
- package/assets/esri/core/workers/chunks/{8ba32d3a0df4a206ef1c.js → 15cc2c295682f48030f9.js} +1 -1
- package/assets/esri/core/workers/chunks/17b76e0d401c7e396d10.js +1 -0
- package/assets/esri/core/workers/chunks/{c18189710d6198516175.js → 19b9d393046a780e6c3f.js} +1 -1
- package/assets/esri/core/workers/chunks/1b35ec54968fbeec17ce.js +1 -0
- package/assets/esri/core/workers/chunks/1c0c5cb13c2590aae906.js +1 -0
- package/assets/esri/core/workers/chunks/1e0d2715d603f48a7e0b.js +1 -0
- package/assets/esri/core/workers/chunks/{83589144eeeb08f45557.js → 2aeb5cc32284dd3e4d22.js} +1 -1
- package/assets/esri/core/workers/chunks/{9a7fc93cc693fd12b5d8.js → 2b6c74646ff475a6e302.js} +1 -1
- package/assets/esri/core/workers/chunks/2d9a1f23ec6ce90723ac.js +1 -0
- package/assets/esri/core/workers/chunks/340621182db9e8edbec2.js +1 -0
- package/assets/esri/core/workers/chunks/{71f739bb3f7350704af6.js → 384ae10053d35940de73.js} +1 -1
- package/assets/esri/core/workers/chunks/3b3e519f15ed52c83f0c.js +1 -0
- package/assets/esri/core/workers/chunks/{72019baeba520edb6bb0.js → 3b737dae6efed627406e.js} +1 -1
- package/assets/esri/core/workers/chunks/3c0ed15b544df6fb0903.js +1 -0
- package/assets/esri/core/workers/chunks/3ffda5bf0b91700dc308.js +1 -0
- package/assets/esri/core/workers/chunks/{1317ecdfd0cfa683a493.js → 42323093827adffe56d3.js} +1 -1
- package/assets/esri/core/workers/chunks/451d7d456df0f4466563.js +1 -0
- package/assets/esri/core/workers/chunks/4a6b92ecbb1f1c55cc43.js +1 -0
- package/assets/esri/core/workers/chunks/4e544de61f07ca660236.js +1 -0
- package/assets/esri/core/workers/chunks/{67ac6b326bf80fc3d33d.js → 53be85d04cd2da4f391d.js} +1 -1
- package/assets/esri/core/workers/chunks/54778dec1598818d93cb.js +1 -0
- package/assets/esri/core/workers/chunks/{06e7400f5ebe0719b81c.js → 5a5d80c2519aa3ea8878.js} +1 -1
- package/assets/esri/core/workers/chunks/{fb4ff0ac2bc445fec413.js → 5b434e8c98e7119d4a3b.js} +1 -1
- package/assets/esri/core/workers/chunks/606ea251075fe81a1206.js +1 -0
- package/assets/esri/core/workers/chunks/{3ac9dcbb0571a2580236.js → 62c8c9ad09e0166207fd.js} +1 -1
- package/assets/esri/core/workers/chunks/6588725275c75fae0d9c.js +1 -0
- package/assets/esri/core/workers/chunks/{ac4cc49104d26c384e98.js → 658b2642ab6880770e4e.js} +1 -1
- package/assets/esri/core/workers/chunks/68be3fb88ca61f82fb90.js +1 -0
- package/assets/esri/core/workers/chunks/6c9266120d46e8c69dbf.js +1 -0
- package/assets/esri/core/workers/chunks/6ebe73f69ae822053b70.js +1 -0
- package/assets/esri/core/workers/chunks/6ef647b7769d27529f9c.js +1 -0
- package/assets/esri/core/workers/chunks/709e019885822b1f6f3e.js +1 -0
- package/assets/esri/core/workers/chunks/70cc2d79653d66e85b58.js +1 -0
- package/assets/esri/core/workers/chunks/{cbe6c0f32608cb504695.js → 776ae25a34352d3468bc.js} +1 -1
- package/assets/esri/core/workers/chunks/8730e7e6e0296f43f10b.js +1 -0
- package/assets/esri/core/workers/chunks/8bea0d706ede6f84f8aa.js +1 -0
- package/assets/esri/core/workers/chunks/900181f68449d8f82eeb.js +1 -0
- package/assets/esri/core/workers/chunks/939942b00ba380e2957e.js +1 -0
- package/assets/esri/core/workers/chunks/{1ef39aef6b33c530cbe4.js → 966d0832a3c1f03668a0.js} +1 -1
- package/assets/esri/core/workers/chunks/9a28a66807a1e3557018.js +1 -0
- package/assets/esri/core/workers/chunks/{2f9033890c465acff698.js → 9bf48a907f91ea004648.js} +1 -1
- package/assets/esri/core/workers/chunks/9c7fa9d324fa0bf64d9c.js +1 -0
- package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +1 -0
- package/assets/esri/core/workers/chunks/{1ba1f705b6ce5c8ea702.js → a655ebdb4bf0660615a2.js} +1 -1
- package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +1 -0
- package/assets/esri/core/workers/chunks/af349c7bc8ef41a0e1bd.js +1 -0
- package/assets/esri/core/workers/chunks/{250d3be6d3849d71fed8.js → c29c474c4b1049352d3e.js} +1 -1
- package/assets/esri/core/workers/chunks/c8ba0673d1b87216e619.js +1 -0
- package/assets/esri/core/workers/chunks/{4d3f97a48046021713a6.js → ceb112fe7aef354f8051.js} +1 -1
- package/assets/esri/core/workers/chunks/d6ad4390df576198e45b.js +1 -0
- package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +1 -0
- package/assets/esri/core/workers/chunks/ded8b64a46992c3ae693.js +1 -0
- package/assets/esri/core/workers/chunks/{0b36abcbf03037b4073d.js → e1af43e2a8f2ef1059e3.js} +1 -1
- package/assets/esri/core/workers/chunks/eaf6d587477399a83088.js +1 -0
- package/assets/esri/core/workers/chunks/ecaac39dde7ec4213264.js +1 -0
- package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +1 -0
- package/assets/esri/core/workers/chunks/f31b424a3667686af10c.js +1 -0
- package/assets/esri/core/workers/chunks/{711cfb84659cb4437679.js → f528ac5c648ca6a98582.js} +1 -1
- package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +1 -0
- package/assets/esri/core/workers/chunks/fb444954be74c1962ced.js +1 -0
- package/assets/esri/core/workers/chunks/fecaf0bc28aeea4d15db.js +1 -0
- package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationSettings.scss +1 -1
- package/assets/esri/themes/base/widgets/_Features.scss +1 -1
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +5 -9
- package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +2 -4
- package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -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/BatchAttributeForm/t9n/messages.en.json +1 -1
- package/chunks/GlobalIllumination.glsl.js +4 -2
- package/chunks/GlobalIlluminationBlur.glsl.js +3 -5
- package/chunks/GlobalIlluminationUpscale.glsl.js +1 -1
- package/config.js +1 -1
- package/core/colorUtils.js +1 -1
- package/core/has.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/form/elements/inputs/DynamicChoiceInput.d.ts +35 -5
- package/geometry/projectionUtils.js +1 -1
- package/geometry/support/scaleUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/ParquetLayer.d.ts +3 -2
- package/layers/ParquetLayer.js +1 -1
- package/layers/graphics/data/FeatureStore.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/data/geometryUtils.js +1 -1
- package/layers/graphics/data/projectionSupport.js +1 -1
- package/layers/knowledgeGraph/layerUtils.js +1 -1
- package/layers/knowledgeGraph/nodeMovementUtils.js +1 -1
- package/layers/mixins/ScaleRangeLayer.js +1 -1
- package/layers/mixins/SublayersOwner.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/package.json +2 -2
- package/popup/FeaturesModel.d.ts +26 -5
- package/popup/FeaturesModel.js +1 -1
- package/rest/support/printTaskUtils.js +1 -1
- package/symbols/cim/CIMSymbolHelper.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.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/AFeatureTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
- package/views/3d/analysis/Viewshed/types.d.ts +3 -1
- package/views/3d/environment/Environment.d.ts +2 -2
- package/views/3d/environment/Environment.js +1 -1
- package/views/3d/environment/EnvironmentView.js +2 -0
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
- package/views/3d/layers/DynamicLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/RouteLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/support/FeatureTile.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
- package/views/3d/layers/support/SampledGeometryMaxDistanceRatio.js +1 -1
- package/views/3d/support/elevationUpdateUtils.js +1 -1
- package/views/3d/support/popupHitTest.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js +2 -2
- package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/draw/Draw.d.ts +1 -1
- package/views/draw/support/InteractiveHandle.js +1 -1
- package/views/interactive/options/SnappingOptions.d.ts +1 -0
- package/views/interactive/options/TooltipOptions.d.ts +1 -0
- package/views/interactive/options/ViewOptions.d.ts +1 -0
- package/views/interactive/snapping/FeatureSnappingSourceInfo.js +1 -1
- package/views/interactive/support/Units.d.ts +1 -0
- package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
- package/views/interactive/tooltip/components/ElevationModeSelect.js +1 -1
- package/views/layers/LayerView.js +1 -1
- package/views/layers/LineOfSightLayerView.d.ts +3 -4
- package/views/layers/ViewshedLayerView.d.ts +5 -6
- package/views/support/layerViewUtils.js +1 -1
- package/views/support/projectionUtils.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/DirectionalPad.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor.d.ts +10 -0
- package/widgets/Expand.js +1 -1
- package/widgets/FeatureForm.d.ts +2 -2
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesDrillIn.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
- package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
- package/widgets/PanoramicVideoViewer.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Search/SearchResultRenderer.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.d.ts +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
- package/widgets/Sketch.d.ts +1 -1
- package/widgets/Track/TrackViewModel.d.ts +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
- package/widgets/UtilityNetworkTrace/types.d.ts +2 -2
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/UtilityNetworkValidateTopology.js +1 -1
- package/widgets/ValuePicker.js +1 -1
- package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
- package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
- package/widgets/support/GridControls.js +1 -1
- package/widgets/support/PluginSettingsControls.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/widgets/support/componentsUtils.js +1 -1
- package/assets/esri/core/workers/chunks/00a600c71ceebe7bfeee.js +0 -1
- package/assets/esri/core/workers/chunks/00d24415bdeb0adae3df.js +0 -1
- package/assets/esri/core/workers/chunks/0193df3f9fb23633da87.js +0 -1
- package/assets/esri/core/workers/chunks/02d4f91652a79d2b637e.js +0 -1
- package/assets/esri/core/workers/chunks/07aa6d36f1006b6ab7ff.js +0 -1
- package/assets/esri/core/workers/chunks/107b025dc5b09465a78f.js +0 -1
- package/assets/esri/core/workers/chunks/1f43e06dcfe56229bb0f.js +0 -1
- package/assets/esri/core/workers/chunks/25d6c674b1c4829f040f.js +0 -1
- package/assets/esri/core/workers/chunks/25e6013e2c095629b236.js +0 -1
- package/assets/esri/core/workers/chunks/2a570ce6b99dac6ee996.js +0 -1
- package/assets/esri/core/workers/chunks/2c90f7a6432cd716db8b.js +0 -1
- package/assets/esri/core/workers/chunks/2e6a2f4d686b71249c0e.js +0 -1
- package/assets/esri/core/workers/chunks/303fde8f3459dde16555.js +0 -1
- package/assets/esri/core/workers/chunks/350540770781b281c39a.js +0 -1
- package/assets/esri/core/workers/chunks/3880d2c7fb14955d7f93.js +0 -1
- package/assets/esri/core/workers/chunks/3b017b718ea2d4ed498f.js +0 -1
- package/assets/esri/core/workers/chunks/43fc42405167a5537039.js +0 -1
- package/assets/esri/core/workers/chunks/4d82db661365daa513a6.js +0 -1
- package/assets/esri/core/workers/chunks/56851011276de0b3e318.js +0 -1
- package/assets/esri/core/workers/chunks/5f3ab77a79c408423fde.js +0 -1
- package/assets/esri/core/workers/chunks/633a9051580c5302d2f7.js +0 -1
- package/assets/esri/core/workers/chunks/6469c0d18d3663e7da4b.js +0 -1
- package/assets/esri/core/workers/chunks/65654e481cce9ae40e54.js +0 -1
- package/assets/esri/core/workers/chunks/669e39c3437d7273f0c7.js +0 -1
- package/assets/esri/core/workers/chunks/798a63653f82c0e842c5.js +0 -1
- package/assets/esri/core/workers/chunks/84fcbf7a1d04f01685d1.js +0 -1
- package/assets/esri/core/workers/chunks/8b54589f173259c1ba55.js +0 -1
- package/assets/esri/core/workers/chunks/8e511079918e2fd9261f.js +0 -1
- package/assets/esri/core/workers/chunks/95b82cbbe355266c65d7.js +0 -1
- package/assets/esri/core/workers/chunks/9673a9efec86040b8c13.js +0 -1
- package/assets/esri/core/workers/chunks/a010d2e4e34eb7bc1fec.js +0 -1
- package/assets/esri/core/workers/chunks/b05a41a60e30935644be.js +0 -1
- package/assets/esri/core/workers/chunks/bff767ec5bb4c0d6b324.js +0 -1
- package/assets/esri/core/workers/chunks/c906f984b2b6e7578c06.js +0 -1
- package/assets/esri/core/workers/chunks/d21257d2e2a37266c0f7.js +0 -1
- package/assets/esri/core/workers/chunks/d270cc9807161033686e.js +0 -1
- package/assets/esri/core/workers/chunks/de02a6a1f4810f99e9bb.js +0 -1
- package/assets/esri/core/workers/chunks/e5943f3a4bbc12c06c4d.js +0 -1
- package/assets/esri/core/workers/chunks/ec9a2425b4a498054a19.js +0 -1
- package/assets/esri/core/workers/chunks/f0a68d2900d24f56afa0.js +0 -1
- package/assets/esri/core/workers/chunks/f0aaa646b17ffdbdcefa.js +0 -1
- package/assets/esri/core/workers/chunks/f46a0d7cf588ba1b4157.js +0 -1
- package/assets/esri/core/workers/chunks/f762f70e7d39634ce797.js +0 -1
- package/assets/esri/core/workers/chunks/fccbb902fe08448f91de.js +0 -1
- package/assets/esri/core/workers/chunks/fd0254c6fc6c03ec11ba.js +0 -1
- package/views/3d/environment/EnvironmentManager.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{clamp as n}from"../../../../core/mathUtils.js";import{throwIfAborted as r,waitTick as i}from"../../../../core/promiseUtils.js";import a from"../../../../geometry/Mesh.js";import o from"../../../../geometry/Point.js";import{projectAsync as s}from"../../../../geometry/projectionUtils.js";import c from"../../../../geometry/support/MeshVertexAttributes.js";import{projectVertices as l,updateFrustum as u}from"../../../../layers/orientedImagery/core/coverageUtils.js";import d from"../../../../layers/orientedImagery/transformations/updateElevation.js";import{getPointerActions as f,eventMatchesMousePointerActions as p}from"../../../../views/input/handlers/support.js";import{fixedImageSize as m,invalidCameraHeading as h}from"../../constants.js";import{createFeatureCoverage as g}from"../../featureCoverage.js";import{activeFrustumSymbol as _,additionalFrustumSymbol as v}from"../../symbols.js";import{getDefaultSuperimposeFov as y,panoramicSuperimposeMaxFov as b,panoramicSuperimposeMinFov as x,panoramicSuperimposeZoomOutFactor as S,panoramicSuperimposeZoomInFactor as C,getViewCameraFieldOfView as w,panoramicSuperimposeMaxTilt as T,panoramicSuperimposeMinTilt as E,panoramicSuperimposeKeyboardAngleStep as D}from"../../support/superimposeUtils.js";class O{constructor(o){this.viewModel=o,this._defaultSuperimposeSecondaryDragAction=null,this._defaultSuperimposeNavigationHandles=[],this._panoramicSuperimposeAnchor=null,this._panoramicSuperimposeLastScreenPoint=null,this._panoramicSuperimposeNavigationHandles=[],this.createFootprints=async n=>{let{coverageFrustums:i,currentBestFeature:o,isAdditionalCoverageVisible:u,view:d}=this.viewModel,f=i.filter(t);for(let t of f){let i=t.clone();if(!d.spatialReference.equals(i.spatialReference)){let{components:e,spatialReference:t,origin:o,vertexAttributes:u,vertexSpace:f}=i;if(f.type===`local`){let e=await s(o,d.spatialReference,n);r(n),i.centerAt(e)}else{let o=u.position,s=Float64Array.from(await l([...o],t.clone(),d.spatialReference.clone(),n));r(n),i=new a({vertexAttributes:new c({position:s}),components:e,spatialReference:d.spatialReference.clone()})}}t.imageID===o.attributes.objectId?this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:t.imageID},geometry:i,symbol:_.clone(),visible:!1}):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:t.imageID},geometry:i,symbol:v.clone(),visible:u}))}},this.updateFootprint=async(n,i,a)=>{let{bestFeatureFootprint:o,currentBestFeature:c,activeViewer:l,footprintExtent:d,view:f,mode:p}=this.viewModel,h=p===`video`?m:l?.imageSize,g=i??c;if(!c||!o?.geometry||!h||!d||!g||!f?.spatialReference){this.viewModel.updateCurrentCoveragePolygon(null);return}let{attributes:{cameraHeight:v,location:y,cameraPitch:b,horizontalFieldOfView:x,verticalFieldOfView:S,cameraRoll:C}}=g,w=null;i&&(w=await this._computeFeatureFootprint(i,a));let T=g.attributes.location.toArray(),{vertexAttributes:{position:E},spatialReference:D}=(i&&w?w:o).geometry,O=await k(E,D,y.spatialReference),A=await this.viewModel.getMapPoint(n);r(a);let j=A.filter(t);if(!j.length)return;j[0].spatialReference.equals(y.spatialReference)||(j=await Promise.all(j.map(async e=>{let t=await s(e,y.spatialReference,a);return r(a),t})));let M=await u(n.map(({x:e,y:t})=>[e,t]),j.map(e=>e.toArray()),{cameraHeight:v,cameraLocation:T,cameraPitch:b,frustumVertices:O,horizontalFieldOfView:x,imageHeight:h[1],imageWidth:h[0],inSRS:{wkid:y.spatialReference.wkid},outSRS:{wkid:f.spatialReference.wkid},verticalFieldOfView:S,cameraRoll:C??0,options:a});this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:g.attributes.objectId},geometry:M,symbol:_.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateVideoFootprint=async n=>{let{points:i,feature:a,scale:o,options:c}=n,{bestFeatureFootprint:l,currentBestFeature:d,activeViewer:f,footprintExtent:p,view:h,mode:g}=this.viewModel,v=g===`video`?m:f?.imageSize,y=a??d;if(!d||!l?.geometry||!v||!p||!y||!h?.spatialReference||g===`none`){this.viewModel.updateCurrentCoveragePolygon(null);return}let{attributes:{cameraHeight:b,location:x,cameraPitch:S,horizontalFieldOfView:C,verticalFieldOfView:w,cameraRoll:T}}=y,E=null;a&&(E=await this._computeFeatureFootprint(a,c));let D=y.attributes.location.toArray(),{vertexAttributes:{position:O},spatialReference:A}=(a&&E?E:l).geometry,M=await k(O,A,x.spatialReference),N={feature:y,mode:g,imageSize:v,footprintExtent:p},P=await this.viewModel.getMapPointForFeature(i,N,c);r(c);let F=P.filter(t);if(!F.length)return;F[0].spatialReference.equals(x.spatialReference)||(F=await Promise.all(F.map(async e=>{let t=await s(e,x.spatialReference,c);return r(c),t})));let I=await u(i.map(({x:e,y:t})=>[e,t]),F.map(e=>e.toArray()),{cameraHeight:b,cameraLocation:D,cameraPitch:S,frustumVertices:M,horizontalFieldOfView:C,imageHeight:v[1],imageWidth:v[0],inSRS:{wkid:x.spatialReference.wkid},outSRS:{wkid:h.spatialReference.wkid},verticalFieldOfView:w,cameraRoll:T??0,options:c});if(o&&I){let e=j(I);I.scale(o,{origin:e})}this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:y.attributes.objectId},geometry:I,symbol:_.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateFootprintPanorama=async(t,n)=>{await i(n);let{horizontalFieldOfView:r,pitch:a,verticalFieldOfView:o,yaw:c,feature:l}=t,u=l?.clone()??this.viewModel.currentBestFeature?.clone();if(!u)return;let{attributes:d}=u;d.orientedImageryType=null,d.cameraHeading=c,d.cameraPitch=a,d.horizontalFieldOfView=r,d.verticalFieldOfView=o,d.cameraRoll=0;let{frustum:f}=g(d);if(!f){this.viewModel.updateCurrentCoveragePolygon(null);return}let p=this.viewModel.view?.spatialReference.equals(f.spatialReference)?f.clone():await s(f.clone(),this.viewModel.view?.spatialReference,n);this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:d.objectId},geometry:p,symbol:_.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updatePanoramicSuperimposeCamera=async(e,t)=>{let{camera:n,currentBestFeature:i}=e,{view:a}=this.viewModel;if(a?.type!==`3d`)return;let o=i.attributes.location,c=o.spatialReference.equals(a.spatialReference)?o:await s(o,a.spatialReference,t);if(r(t),!c)return;let l=n.clone();l.position=c.clone(),a.camera=l,this._enablePanoramicSuperimposeNavigation(c)},this.updateDefaultSuperimposeCamera=async(e,t)=>{let{currentBestFeature:i}=e,{view:a}=this.viewModel;if(a?.type!==`3d`)return;let{cameraHeading:o,cameraPitch:c,cameraRoll:l,horizontalFieldOfView:u,location:d,verticalFieldOfView:f}=i.attributes,p=d.spatialReference.equals(a.spatialReference)?d.clone():await s(d,a.spatialReference,t);if(r(t),!p)return;let m=y(a,u,f,l??0),g=a.camera.clone();g.position=p,g.fov=n(g.fov,x,b),o!=null&&o!==h&&(g.heading=o),c!=null&&(g.tilt=c),m!=null&&(g.fov=m),a.camera=g},this.enableDefaultSuperimposeNavigation=()=>{let{view:e}=this.viewModel;if(e?.type!==`3d`)return;let t=e.navigation.actionMap;this._defaultSuperimposeSecondaryDragAction??=t.dragSecondary,t.dragSecondary!==`none`&&(t.dragSecondary=`none`),this._defaultSuperimposeNavigationHandles.length||(this._defaultSuperimposeNavigationHandles=[e.on(`drag`,this._handleDefaultSuperimposeDrag)])},this.disableDefaultSuperimposeNavigation=()=>{let{view:e}=this.viewModel,t=this._defaultSuperimposeSecondaryDragAction;this._defaultSuperimposeNavigationHandles.forEach(e=>e.remove()),this._defaultSuperimposeNavigationHandles=[],e?.type!==`3d`||t==null||(e.navigation.actionMap.dragSecondary=t),this._defaultSuperimposeSecondaryDragAction=null},this.disablePanoramicSuperimposeNavigation=()=>{this._panoramicSuperimposeNavigationHandles.forEach(e=>e.remove()),this._panoramicSuperimposeNavigationHandles=[],this._panoramicSuperimposeAnchor=null,this._panoramicSuperimposeLastScreenPoint=null},this._handleDefaultSuperimposeDrag=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`)return;let n=f(`rotate`,t.navigation.actionMap);p(e,n)&&e.stopPropagation()},this._handlePanoramicSuperimposeDoubleClick=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;e.stopPropagation();let r=t.camera.clone(),i=e.native.ctrlKey?S:C;r.position=this._panoramicSuperimposeAnchor.clone(),r.fov=n(r.fov*i,x,b),t.camera=r},this._handlePanoramicSuperimposeDrag=e=>{let{view:t}=this.viewModel;if(t&&t.type===`3d`&&this._panoramicSuperimposeAnchor)switch(e.stopPropagation(),e.action){case`start`:this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};return;case`update`:{let r=this._panoramicSuperimposeLastScreenPoint;if(!r){this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};return}let i=r.x-e.x,a=e.y-r.y;this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};let o=t.camera.clone(),{horizontal:s,vertical:c}=w(t);o.position=this._panoramicSuperimposeAnchor.clone(),o.heading+=s*i/Math.max(t.width,1),o.tilt=n(o.tilt+c*a/Math.max(t.height,1),E,T),t.camera=o;return}case`end`:this._panoramicSuperimposeLastScreenPoint=null;return}},this._handlePanoramicSuperimposeKeyDown=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;let r=t.camera.clone(),i=!0;switch(r.position=this._panoramicSuperimposeAnchor.clone(),e.key){case`ArrowLeft`:r.heading-=D;break;case`ArrowRight`:r.heading+=D;break;case`ArrowUp`:r.tilt=n(r.tilt-D,E,T);break;case`ArrowDown`:r.tilt=n(r.tilt+D,E,T);break;default:i=!1}i&&(e.stopPropagation(),t.camera=r)},this._handlePanoramicSuperimposeWheel=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;e.stopPropagation();let r=t.camera.clone();r.position=this._panoramicSuperimposeAnchor.clone(),r.fov=n(r.fov*(e.deltaY>0?S:C),x,b),t.camera=r}}async _computeFeatureFootprint(e,t){let{currentBestFeature:n,view:i}=this.viewModel,a=n?.elevationSample;if(a?.extent&&!a.extent.contains(e.geometry)&&(a=await this.viewModel.processFeatureElevation([e],e.geometry.clone(),t)??a),a){let n=await d(e.geometry.clone(),{elevationSample:a},t);r(t),e.attributes.elevation=n.z}return A(e,i.spatialReference,t)}_enablePanoramicSuperimposeNavigation(e){let{view:t}=this.viewModel;t&&t.type===`3d`&&(this.disablePanoramicSuperimposeNavigation(),this._panoramicSuperimposeAnchor=e.clone(),this._panoramicSuperimposeNavigationHandles=[t.on(`drag`,this._handlePanoramicSuperimposeDrag),t.on(`mouse-wheel`,this._handlePanoramicSuperimposeWheel),t.on(`double-click`,this._handlePanoramicSuperimposeDoubleClick),t.on(`key-down`,this._handlePanoramicSuperimposeKeyDown)])}}async function k(e,t,n,r){return Float64Array.from((await Promise.all(e.reduce((e,t,n)=>{let r=Math.floor(n/3);return e[r]=e[r]??[],e[r].push(t),e},[]).map(async e=>(await s(new o(e,t),n,r)).toArray()))).flat())}const A=async(t,n,i)=>{let{frustum:o}=g(t.attributes),u=o.clone();if(!n.equals(u.spatialReference)){let{components:e,spatialReference:t,origin:o,vertexAttributes:d,vertexSpace:f}=u;if(f.type===`local`){let e=await s(o,n,i);r(i),u.centerAt(e)}else{let o=d.position,s=Float64Array.from(await l([...o],t.clone(),n.clone(),i));r(i),u=new a({vertexAttributes:new c({position:s}),components:e,spatialReference:n.clone()})}}return new e({attributes:{imageID:o.imageID},geometry:u,symbol:_.clone(),visible:!1})},j=e=>{let t=e.vertexAttributes.position,n=0,r=0,i=0,a=t.length/3;for(let e=0;e<t.length;e+=3)n+=t[e],r+=t[e+1],i+=t[e+2];return new o({x:n/a,y:r/a,z:i/a,spatialReference:e.spatialReference})};export{O as default};
|
|
2
|
+
import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{clamp as n}from"../../../../core/mathUtils.js";import{throwIfAborted as r,waitTick as i}from"../../../../core/promiseUtils.js";import a from"../../../../geometry/Mesh.js";import o from"../../../../geometry/Point.js";import{projectAsync as s}from"../../../../geometry/projectionUtils.js";import c from"../../../../geometry/support/MeshVertexAttributes.js";import{projectVertices as l,updateFrustum as u}from"../../../../layers/orientedImagery/core/coverageUtils.js";import d from"../../../../layers/orientedImagery/transformations/updateElevation.js";import{getPointerActions as f,eventMatchesMousePointerActions as p}from"../../../../views/input/handlers/support.js";import{fixedImageSize as m,invalidCameraHeading as h}from"../../constants.js";import{createFeatureCoverage as g}from"../../featureCoverage.js";import{activeFrustumSymbol as _,additionalFrustumSymbol as v}from"../../symbols.js";import{getDefaultSuperimposeFov as y,panoramicSuperimposeMaxFov as b,panoramicSuperimposeMinFov as x,panoramicSuperimposeZoomOutFactor as S,panoramicSuperimposeZoomInFactor as C,getViewCameraFieldOfView as w,panoramicSuperimposeMaxTilt as T,panoramicSuperimposeMinTilt as E,panoramicSuperimposeKeyboardAngleStep as D}from"../../support/superimposeUtils.js";class O{constructor(o){this.viewModel=o,this._defaultSuperimposeSecondaryDragAction=null,this._defaultSuperimposeNavigationHandles=[],this._panoramicSuperimposeAnchor=null,this._panoramicSuperimposeLastScreenPoint=null,this._panoramicSuperimposeNavigationHandles=[],this.createFootprints=async n=>{let{coverageFrustums:i,currentBestFeature:o,isAdditionalCoverageVisible:u,view:d}=this.viewModel,f=i.filter(t);for(let t of f){let i=t.clone();if(!d.spatialReference.equals(i.spatialReference)){let{components:e,spatialReference:t,origin:o,vertexAttributes:u,vertexSpace:f}=i;if(f.type===`local`){let e=await s(o,d.spatialReference,n);r(n),i.centerAt(e)}else{let o=u.position,s=Float64Array.from(await l([...o],t.clone(),d.spatialReference.clone(),n));r(n),i=new a({vertexAttributes:new c({position:s}),components:e,spatialReference:d.spatialReference.clone()})}}t.imageID===o.attributes.objectId?this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:t.imageID},geometry:i,symbol:_.clone(),visible:!1}):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:t.imageID},geometry:i,symbol:v.clone(),visible:u}))}},this.updateFootprint=async(n,i,a)=>{let{bestFeatureFootprint:o,currentBestFeature:c,activeViewer:l,footprintExtent:d,view:f,mode:p}=this.viewModel,h=p===`video`?m:l?.imageSize,g=i??c;if(!c||!o?.geometry||!h||!d||!g||!f?.spatialReference){this.viewModel.updateCurrentCoveragePolygon(null);return}let{attributes:{cameraHeight:v,location:y,cameraPitch:b,horizontalFieldOfView:x,verticalFieldOfView:S,cameraRoll:C}}=g,w=null;i&&(w=await this._computeFeatureFootprint(i,a));let T=g.attributes.location.toArray(),{vertexAttributes:{position:E},spatialReference:D}=(i&&w?w:o).geometry,O=await k(E,D,y.spatialReference),A=await this.viewModel.getMapPoint(n);r(a);let j=A.filter(t);if(!j.length)return;j[0].spatialReference.equals(y.spatialReference)||(j=await Promise.all(j.map(async e=>{let t=await s(e,y.spatialReference,a);return r(a),t})));let M=await u(n.map(({x:e,y:t})=>[e,t]),j.map(e=>e.toArray()),{cameraHeight:v,cameraLocation:T,cameraPitch:b,frustumVertices:O,horizontalFieldOfView:x,imageHeight:h[1],imageWidth:h[0],inSRS:{wkid:y.spatialReference.wkid},outSRS:{wkid:f.spatialReference.wkid},verticalFieldOfView:S,cameraRoll:C??0,options:a});this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:g.attributes.objectId},geometry:M,symbol:_.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateVideoFootprint=async n=>{let{points:i,feature:a,scale:o,options:c}=n,{bestFeatureFootprint:l,currentBestFeature:d,activeViewer:f,footprintExtent:p,view:h,mode:g}=this.viewModel,v=g===`video`?m:f?.imageSize,y=a??d;if(!d||!l?.geometry||!v||!p||!y||!h?.spatialReference||g===`none`){this.viewModel.updateCurrentCoveragePolygon(null);return}let{attributes:{cameraHeight:b,location:x,cameraPitch:S,horizontalFieldOfView:C,verticalFieldOfView:w,cameraRoll:T}}=y,E=null;a&&(E=await this._computeFeatureFootprint(a,c));let D=y.attributes.location.toArray(),{vertexAttributes:{position:O},spatialReference:A}=(a&&E?E:l).geometry,M=await k(O,A,x.spatialReference),N={feature:y,mode:g,imageSize:v,footprintExtent:p},P=await this.viewModel.getMapPointForFeature(i,N,c);r(c);let F=P.filter(t);if(!F.length)return;F[0].spatialReference.equals(x.spatialReference)||(F=await Promise.all(F.map(async e=>{let t=await s(e,x.spatialReference,c);return r(c),t})));let I=await u(i.map(({x:e,y:t})=>[e,t]),F.map(e=>e.toArray()),{cameraHeight:b,cameraLocation:D,cameraPitch:S,frustumVertices:M,horizontalFieldOfView:C,imageHeight:v[1],imageWidth:v[0],inSRS:{wkid:x.spatialReference.wkid},outSRS:{wkid:h.spatialReference.wkid},verticalFieldOfView:w,cameraRoll:T??0,options:c});if(o&&I){let e=j(I);I.scale(o,{origin:e})}this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:y.attributes.objectId},geometry:I,symbol:_.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateFootprintPanorama=async(t,n)=>{await i(n);let{horizontalFieldOfView:r,pitch:a,verticalFieldOfView:o,yaw:s,feature:c}=t,l=c?.clone()??this.viewModel.currentBestFeature?.clone();if(!l)return;let{attributes:u}=l;u.orientedImageryType=null,u.cameraHeading=s,u.cameraPitch=a,u.horizontalFieldOfView=r,u.verticalFieldOfView=o,u.cameraRoll=0;let{frustum:d}=g(u);!d||!this.viewModel.view?.spatialReference.equals(d.spatialReference)?this.viewModel.updateCurrentCoveragePolygon(null):this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:u.objectId},geometry:d.clone(),symbol:_.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updatePanoramicSuperimposeCamera=async(e,t)=>{let{camera:n,currentBestFeature:i}=e,{view:a}=this.viewModel;if(a?.type!==`3d`)return;let o=i.attributes.location,c=o.spatialReference.equals(a.spatialReference)?o:await s(o,a.spatialReference,t);if(r(t),!c)return;let l=n.clone();l.position=c.clone(),a.camera=l,this._enablePanoramicSuperimposeNavigation(c)},this.updateDefaultSuperimposeCamera=async(e,t)=>{let{currentBestFeature:i}=e,{view:a}=this.viewModel;if(a?.type!==`3d`)return;let{cameraHeading:o,cameraPitch:c,cameraRoll:l,horizontalFieldOfView:u,location:d,verticalFieldOfView:f}=i.attributes,p=d.spatialReference.equals(a.spatialReference)?d.clone():await s(d,a.spatialReference,t);if(r(t),!p)return;let m=y(a,u,f,l??0),g=a.camera.clone();g.position=p,g.fov=n(g.fov,x,b),o!=null&&o!==h&&(g.heading=o),c!=null&&(g.tilt=c),m!=null&&(g.fov=m),a.camera=g},this.enableDefaultSuperimposeNavigation=()=>{let{view:e}=this.viewModel;if(e?.type!==`3d`)return;let t=e.navigation.actionMap;this._defaultSuperimposeSecondaryDragAction??=t.dragSecondary,t.dragSecondary!==`none`&&(t.dragSecondary=`none`),this._defaultSuperimposeNavigationHandles.length||(this._defaultSuperimposeNavigationHandles=[e.on(`drag`,this._handleDefaultSuperimposeDrag)])},this.disableDefaultSuperimposeNavigation=()=>{let{view:e}=this.viewModel,t=this._defaultSuperimposeSecondaryDragAction;this._defaultSuperimposeNavigationHandles.forEach(e=>e.remove()),this._defaultSuperimposeNavigationHandles=[],e?.type!==`3d`||t==null||(e.navigation.actionMap.dragSecondary=t),this._defaultSuperimposeSecondaryDragAction=null},this.disablePanoramicSuperimposeNavigation=()=>{this._panoramicSuperimposeNavigationHandles.forEach(e=>e.remove()),this._panoramicSuperimposeNavigationHandles=[],this._panoramicSuperimposeAnchor=null,this._panoramicSuperimposeLastScreenPoint=null},this._handleDefaultSuperimposeDrag=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`)return;let n=f(`rotate`,t.navigation.actionMap);p(e,n)&&e.stopPropagation()},this._handlePanoramicSuperimposeDoubleClick=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;e.stopPropagation();let r=t.camera.clone(),i=e.native.ctrlKey?S:C;r.position=this._panoramicSuperimposeAnchor.clone(),r.fov=n(r.fov*i,x,b),t.camera=r},this._handlePanoramicSuperimposeDrag=e=>{let{view:t}=this.viewModel;if(t&&t.type===`3d`&&this._panoramicSuperimposeAnchor)switch(e.stopPropagation(),e.action){case`start`:this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};return;case`update`:{let r=this._panoramicSuperimposeLastScreenPoint;if(!r){this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};return}let i=r.x-e.x,a=e.y-r.y;this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};let o=t.camera.clone(),{horizontal:s,vertical:c}=w(t);o.position=this._panoramicSuperimposeAnchor.clone(),o.heading+=s*i/Math.max(t.width,1),o.tilt=n(o.tilt+c*a/Math.max(t.height,1),E,T),t.camera=o;return}case`end`:this._panoramicSuperimposeLastScreenPoint=null;return}},this._handlePanoramicSuperimposeKeyDown=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;let r=t.camera.clone(),i=!0;switch(r.position=this._panoramicSuperimposeAnchor.clone(),e.key){case`ArrowLeft`:r.heading-=D;break;case`ArrowRight`:r.heading+=D;break;case`ArrowUp`:r.tilt=n(r.tilt-D,E,T);break;case`ArrowDown`:r.tilt=n(r.tilt+D,E,T);break;default:i=!1}i&&(e.stopPropagation(),t.camera=r)},this._handlePanoramicSuperimposeWheel=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;e.stopPropagation();let r=t.camera.clone();r.position=this._panoramicSuperimposeAnchor.clone(),r.fov=n(r.fov*(e.deltaY>0?S:C),x,b),t.camera=r}}async _computeFeatureFootprint(e,t){let{currentBestFeature:n,view:i}=this.viewModel,a=n?.elevationSample;if(a?.extent&&!a.extent.contains(e.geometry)&&(a=await this.viewModel.processFeatureElevation([e],e.geometry.clone(),t)??a),a){let n=await d(e.geometry.clone(),{elevationSample:a},t);r(t),e.attributes.elevation=n.z}return A(e,i.spatialReference,t)}_enablePanoramicSuperimposeNavigation(e){let{view:t}=this.viewModel;t&&t.type===`3d`&&(this.disablePanoramicSuperimposeNavigation(),this._panoramicSuperimposeAnchor=e.clone(),this._panoramicSuperimposeNavigationHandles=[t.on(`drag`,this._handlePanoramicSuperimposeDrag),t.on(`mouse-wheel`,this._handlePanoramicSuperimposeWheel),t.on(`double-click`,this._handlePanoramicSuperimposeDoubleClick),t.on(`key-down`,this._handlePanoramicSuperimposeKeyDown)])}}async function k(e,t,n,r){return Float64Array.from((await Promise.all(e.reduce((e,t,n)=>{let r=Math.floor(n/3);return e[r]=e[r]??[],e[r].push(t),e},[]).map(async e=>(await s(new o(e,t),n,r)).toArray()))).flat())}const A=async(t,n,i)=>{let{frustum:o}=g(t.attributes),u=o.clone();if(!n.equals(u.spatialReference)){let{components:e,spatialReference:t,origin:o,vertexAttributes:d,vertexSpace:f}=u;if(f.type===`local`){let e=await s(o,n,i);r(i),u.centerAt(e)}else{let o=d.position,s=Float64Array.from(await l([...o],t.clone(),n.clone(),i));r(i),u=new a({vertexAttributes:new c({position:s}),components:e,spatialReference:n.clone()})}}return new e({attributes:{imageID:o.imageID},geometry:u,symbol:_.clone(),visible:!1})},j=e=>{let t=e.vertexAttributes.position,n=0,r=0,i=0,a=t.length/3;for(let e=0;e<t.length;e+=3)n+=t[e],r+=t[e+1],i+=t[e+2];return new o({x:n/a,y:r/a,z:i/a,spatialReference:e.spatialReference})};export{O as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{loadCalciteComponents as e}from"../../support/componentsUtils.js";import{tsx as t}from"../../support/widget.js";function n(){return e({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`)})}function r(e){let{expandDisabled:n,layout:r,overlayPositioning:i,actions:a}=e;return t(`calcite-action-bar`,{
|
|
2
|
+
import{loadCalciteComponents as e}from"../../support/componentsUtils.js";import{tsx as t}from"../../support/widget.js";function n(){return e({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`)})}function r(e){let{expandDisabled:n,layout:r,overlayPositioning:i,actions:a}=e;return t(`calcite-action-bar`,{expandToggleDisabled:n,floating:!0,layout:r,overlayPositioning:i,slot:`fab`},a.map(e=>t(`calcite-action`,{icon:e.icon,key:e.title,scale:e.scale,text:e.text,title:e.title,onclick:e.onclick})))}function i(e){let{uiStrings:n,layout:i,onNext:a,onPrev:o}=e;return t(r,{actions:[{icon:`chevron-left`,scale:`s`,text:n.previous,title:n.previous,onclick:o},{icon:`chevron-right`,scale:`s`,text:n.next,title:n.next,onclick:a}],expandDisabled:!0,layout:i,overlayPositioning:`fixed`})}export{r as FloatingActionBar,i as SequentialNavigationUI,n as loadSequentialNavigationUIComponents};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import{get as r}from"../../../core/accessorSupport/get.js";import i from"../../Widget.js";import{loadCalciteComponents as a}from"../../support/componentsUtils.js";import{tsx as o}from"../../support/widget.js";const s={point:()=>[l(`pin`,`point`,`draw.point`),l(`line`,`polyline`,`draw.polyline`),l(`polygon`,`polygon`,`draw.polygon`)],polyline:()=>[l(`line`,`polyline`,`draw.polyline`)],polygon:()=>[l(`polygon`,`polygon`,`draw.polygon`)]};let c=class extends i{constructor(e){super(e),this.messages=null,this.type=null}loadDependencies(){return a({"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`),"action-group":()=>import(`@esri/calcite-components/dist/components/calcite-action-group`),action:()=>import(`@esri/calcite-components/dist/components/calcite-action`)})}static{this.vnodeSelector=`calcite-action-bar`}render(){let{messages:e,type:t}=this,n=u(t);return o(`calcite-action-bar`,{
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import{get as r}from"../../../core/accessorSupport/get.js";import i from"../../Widget.js";import{loadCalciteComponents as a}from"../../support/componentsUtils.js";import{tsx as o}from"../../support/widget.js";const s={point:()=>[l(`pin`,`point`,`draw.point`),l(`line`,`polyline`,`draw.polyline`),l(`polygon`,`polygon`,`draw.polygon`)],polyline:()=>[l(`line`,`polyline`,`draw.polyline`)],polygon:()=>[l(`polygon`,`polygon`,`draw.polygon`)]};let c=class extends i{constructor(e){super(e),this.messages=null,this.type=null}loadDependencies(){return a({"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`),"action-group":()=>import(`@esri/calcite-components/dist/components/calcite-action-group`),action:()=>import(`@esri/calcite-components/dist/components/calcite-action`)})}static{this.vnodeSelector=`calcite-action-bar`}render(){let{messages:e,type:t}=this,n=u(t);return o(`calcite-action-bar`,{expandToggleDisabled:!0,floating:!0,layout:`horizontal`,position:`start`},n.map(({icon:t,messageKey:n,action:i})=>{let a=r(e,n);return o(`calcite-action-group`,null,o(`calcite-action`,{alignment:`center`,bind:this,"data-action":i,icon:t,text:a,title:a,onclick:this.onAction}))}))}};e([t()],c.prototype,`messages`,void 0),e([t()],c.prototype,`onAction`,void 0),e([t()],c.prototype,`type`,void 0),c=e([n(`esri.widgets.OrientedImageryViewer.components.SketchTools`)],c);function l(e,t,n){return{icon:e,messageKey:n,action:`draw-${t}`}}function u(e){return[{icon:`cursor`,messageKey:`selectFeature`,action:`select-feature`},...s[e]?.()??[],{icon:`save`,messageKey:`save`,action:`save`},{icon:`trash`,messageKey:`delete`,action:`delete-feature`}]}const d=c;export{d as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../Camera.js";import{property as n,subclass as r}from"../core/accessorSupport/decorators.js";import i from"./Widget.js";import a from"./PanoramicViewer/PanoramicVideoViewerViewModel.js";import{loadCalciteComponents as o}from"./support/componentsUtils.js";import{globalCss as s}from"./support/globalCss.js";import{tsx as c,messageBundle as l,vmEvent as u}from"./support/widget.js";const d=`esri-panoramic-viewer`,f=`${d}__slider-container`;let p=class extends i{constructor(e){super(e),this.messagesCommon=null,this.viewModel=new a,this._afterContainerCreate=e=>{this.imageRenderer.container=e},this.addGraphic=(e,t)=>{this.viewModel.addGraphic(e,t)},this.addManyGraphics=e=>{this.viewModel.addManyGraphics(e)},this.clearGraphics=()=>{this.viewModel.clearGraphics()},this.clearImage=()=>{this.viewModel.clearImage()},this.loadVideo=e=>this.viewModel.loadVideo(e),this.removeGraphic=e=>{this.viewModel.removeGraphic(e)},this.removeManyGraphics=e=>{this.viewModel.removeManyGraphics(e)}}loadDependencies(){return o({panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`),"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`),"action-group":()=>import(`@esri/calcite-components/dist/components/calcite-action-group`),action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),slider:()=>import(`@esri/calcite-components/dist/components/calcite-slider`)})}get activeAudioIcon(){let{videoMuted:e}=this.viewModel;return e?`sound-off`:`sound`}get activeVideoIcon(){let{videoPaused:e,videoLoaded:t}=this.viewModel;return!t||e!==!1?`play`:`pause`}get autoLoad(){return this.viewModel.autoLoad}set autoLoad(e){this.viewModel.autoLoad=e}get camera(){return this.viewModel.camera}set camera(e){e&&(this.viewModel.camera=e)}get clickAction(){return this.viewModel.clickAction}set clickAction(e){this.viewModel.clickAction=e}get fov(){return this.camera?.fov}set fov(e){this.viewModel.fov=e}get hfov(){return this.viewModel.hfov}get horizonAngles(){return this.viewModel.horizonAngles}get icon(){return`360-view`}set icon(e){this._overrideIfSome(`icon`,e)}get imageRenderer(){return this.viewModel.imageRenderer}get imageSize(){return this.viewModel.imageSize}get oiViewModel(){return this.viewModel.oiViewModel}set oiViewModel(e){this.viewModel.oiViewModel=e}get video(){return this.viewModel.video}get videoSource(){return this.viewModel.videoSource}set videoSource(e){this.viewModel.videoSource=e}get pitch(){return this.viewModel.pitch}set pitch(e){this.viewModel.pitch=e}get state(){return this.viewModel.state}get ui(){return this.imageRenderer.ui}get vfov(){return this.viewModel.vfov}get yaw(){return this.viewModel.yaw}set yaw(e){this.viewModel.yaw=e}_handleVideoSeek(e){let t=this.viewModel?.video;t&&(t.currentTime=e.target.value,t.play())}reset(){this.viewModel.resetVideo()}render(){let{control:e,reset:t}=this.messagesCommon,{mute:n,unmute:r}=this.messages;return c(`calcite-panel`,null,c(`calcite-panel`,{loading:this.viewModel.updating},c(`calcite-panel`,{afterCreate:this._afterContainerCreate,bind:this,class:this.classes(s.widget,d)}),c(`calcite-block`,{class:f,expanded:!0},c(`calcite-slider`,{bind:this,labelHandles:!0,labelTicks:!0,max:this.viewModel?.videoDuration,minLabel:`0`,value:this.viewModel.currentTime??0,onCalciteSliderChange:this._handleVideoSeek})),c(`calcite-action-bar`,{
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../Camera.js";import{property as n,subclass as r}from"../core/accessorSupport/decorators.js";import i from"./Widget.js";import a from"./PanoramicViewer/PanoramicVideoViewerViewModel.js";import{loadCalciteComponents as o}from"./support/componentsUtils.js";import{globalCss as s}from"./support/globalCss.js";import{tsx as c,messageBundle as l,vmEvent as u}from"./support/widget.js";const d=`esri-panoramic-viewer`,f=`${d}__slider-container`;let p=class extends i{constructor(e){super(e),this.messagesCommon=null,this.viewModel=new a,this._afterContainerCreate=e=>{this.imageRenderer.container=e},this.addGraphic=(e,t)=>{this.viewModel.addGraphic(e,t)},this.addManyGraphics=e=>{this.viewModel.addManyGraphics(e)},this.clearGraphics=()=>{this.viewModel.clearGraphics()},this.clearImage=()=>{this.viewModel.clearImage()},this.loadVideo=e=>this.viewModel.loadVideo(e),this.removeGraphic=e=>{this.viewModel.removeGraphic(e)},this.removeManyGraphics=e=>{this.viewModel.removeManyGraphics(e)}}loadDependencies(){return o({panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`),"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`),"action-group":()=>import(`@esri/calcite-components/dist/components/calcite-action-group`),action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),slider:()=>import(`@esri/calcite-components/dist/components/calcite-slider`)})}get activeAudioIcon(){let{videoMuted:e}=this.viewModel;return e?`sound-off`:`sound`}get activeVideoIcon(){let{videoPaused:e,videoLoaded:t}=this.viewModel;return!t||e!==!1?`play`:`pause`}get autoLoad(){return this.viewModel.autoLoad}set autoLoad(e){this.viewModel.autoLoad=e}get camera(){return this.viewModel.camera}set camera(e){e&&(this.viewModel.camera=e)}get clickAction(){return this.viewModel.clickAction}set clickAction(e){this.viewModel.clickAction=e}get fov(){return this.camera?.fov}set fov(e){this.viewModel.fov=e}get hfov(){return this.viewModel.hfov}get horizonAngles(){return this.viewModel.horizonAngles}get icon(){return`360-view`}set icon(e){this._overrideIfSome(`icon`,e)}get imageRenderer(){return this.viewModel.imageRenderer}get imageSize(){return this.viewModel.imageSize}get oiViewModel(){return this.viewModel.oiViewModel}set oiViewModel(e){this.viewModel.oiViewModel=e}get video(){return this.viewModel.video}get videoSource(){return this.viewModel.videoSource}set videoSource(e){this.viewModel.videoSource=e}get pitch(){return this.viewModel.pitch}set pitch(e){this.viewModel.pitch=e}get state(){return this.viewModel.state}get ui(){return this.imageRenderer.ui}get vfov(){return this.viewModel.vfov}get yaw(){return this.viewModel.yaw}set yaw(e){this.viewModel.yaw=e}_handleVideoSeek(e){let t=this.viewModel?.video;t&&(t.currentTime=e.target.value,t.play())}reset(){this.viewModel.resetVideo()}render(){let{control:e,reset:t}=this.messagesCommon,{mute:n,unmute:r}=this.messages;return c(`calcite-panel`,null,c(`calcite-panel`,{loading:this.viewModel.updating},c(`calcite-panel`,{afterCreate:this._afterContainerCreate,bind:this,class:this.classes(s.widget,d)}),c(`calcite-block`,{class:f,expanded:!0},c(`calcite-slider`,{bind:this,labelHandles:!0,labelTicks:!0,max:this.viewModel?.videoDuration,minLabel:`0`,value:this.viewModel.currentTime??0,onCalciteSliderChange:this._handleVideoSeek})),c(`calcite-action-bar`,{expandToggleDisabled:!0,layout:`horizontal`},c(`calcite-action-group`,null,c(`calcite-action`,{bind:this,icon:this.activeVideoIcon,text:`Play`,title:this.viewModel.videoPaused?e.play:e.pause,onclick:()=>this.viewModel.playPanoramicVideoHandler()})),c(`calcite-action-group`,null,c(`calcite-action`,{bind:this,icon:`refresh`,text:`Rewind`,title:t,onclick:()=>this.viewModel.rewindPanoramicVideoHandler()})),c(`calcite-action-group`,null,c(`calcite-action`,{bind:this,icon:this.activeAudioIcon,text:`Audio`,title:this.viewModel.videoMuted?n:r,onclick:()=>this.viewModel.togglePanoramicAudio()})))))}static{this.vnodeSelector=`calcite-panel`}};e([n()],p.prototype,`activeAudioIcon`,null),e([n()],p.prototype,`activeVideoIcon`,null),e([n({type:Boolean})],p.prototype,`autoLoad`,null),e([n({type:t})],p.prototype,`camera`,null),e([n()],p.prototype,`clickAction`,null),e([n({type:Number})],p.prototype,`fov`,null),e([n({readOnly:!0,type:Number})],p.prototype,`hfov`,null),e([n()],p.prototype,`horizonAngles`,null),e([n()],p.prototype,`icon`,null),e([n({readOnly:!0})],p.prototype,`imageRenderer`,null),e([n({readOnly:!0})],p.prototype,`imageSize`,null),e([n()],p.prototype,`oiViewModel`,null),e([n(),l(`esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer`)],p.prototype,`messages`,void 0),e([n(),l(`esri/t9n/common`)],p.prototype,`messagesCommon`,void 0),e([n()],p.prototype,`video`,null),e([n()],p.prototype,`videoSource`,null),e([n({type:Number})],p.prototype,`pitch`,null),e([n({readOnly:!0})],p.prototype,`state`,null),e([n()],p.prototype,`ui`,null),e([n({readOnly:!0,type:Number})],p.prototype,`vfov`,null),e([u([`click`,`hittest-response`,`pixel-location`]),n({type:a})],p.prototype,`viewModel`,void 0),e([n({type:Number})],p.prototype,`yaw`,null),p=e([r(`esri.widgets.PanoramicVideoViewer`)],p);const m=p;export{m as default};
|
package/widgets/Print.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{formatNumber as t}from"../intl.js";import n from"../core/Collection.js";import{deprecateWidget as r}from"../core/deprecate.js";import{JSONMap as i}from"../core/jsonMap.js";import a from"../core/Logger.js";import{watch as o,on as s,whenOnce as c}from"../core/reactiveUtils.js";import{unitName as l}from"../core/unitFormatUtils.js";import{addProxy as u,hasSameOrigin as d}from"../core/urlUtils.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{ensureInteger as m}from"../core/accessorSupport/ensureType.js";import h from"../geometry/SpatialReference.js";import{isValid as g}from"../geometry/support/spatialReferenceUtils.js";import _ from"../portal/Portal.js";import{reArcGISOnlineDomain as v}from"../portal/support/urlUtils.js";import{findToken as y}from"../rest/utils.js";import{formatJsonMap as b}from"../rest/support/fileFormat.js";import x from"./Widget.js";import S from"./Print/FileLink.js";import C from"./Print/PrintViewModel.js";import w from"./Print/TemplateOptions.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import{globalCss as E}from"./support/globalCss.js";import{Heading as D}from"./support/Heading.js";import{legacyIcon as O}from"./support/legacyIcon.js";import{messageBundle as k,tsx as A,isRTL as j,tsxFragment as M,isActivationKey as N}from"./support/widget.js";const P=`map-only`,F=`esri-print`,I={base:F,headerTitle:`${F}__header-title`,layoutTabList:`${F}__layout-tab-list`,layoutTab:`${F}__layout-tab`,layoutSection:`${F}__layout-section`,mapOnlySection:`${F}__map-only-section`,panelItemsCentered:`${F}__panel-items--centered`,loader:`${F}__loader`,swapButton:`${F}__swap-button`,printButton:`${F}__export-button`,printButtonSection:`${F}__export-button-section`,printButtonSectionDivider:`${F}__export-button-section--divider`,templateSelectContainer:`${F}__template-select-container`,templateSelectIcon:`${F}__template-select-icon`,templateSelectError:`${F}__template-select-error`,templateSelectArrow:`${F}__template-select-arrow`,formSectionContainer:`${F}__form-section-container`,advancedOptionsSection:`${F}__advanced-options-section`,advancedOptionsContainer:`${F}__advanced-options-container`,browseTemplateButtonContainer:`${F}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${F}__browse-template-button-container-filter`,exportedFilesContainer:`${F}__export-panel-container`,exportedFilesTitle:`${F}__export-title`,exportedFile:`${F}__exported-file`,exportedFileLinkTitle:`${F}__exported-file-link-title`,exportedFileLinkDescription:`${F}__exported-file-link-description`,exportedFilesEmpty:`${F}__exported-files-empty`,printWidgetContainer:`${F}__container`,content:`${F}__content`,panelContainer:`${F}__panel-container`,scaleInfoContainer:`${F}__scale-info-container`,scaleInputContainer:`${F}__scale-input-container`,scaleInput:`${F}__scale-input`,sizeContainer:`${F}__size-container`,panelError:`${F}__panel--error`,exportedFileLoader:`${F}__exported-file--loader`,exportSection:`${F}__export-section`,exportSectionCentered:`${F}__export-section--centered`,templateButtonContainer:`${F}__template-button-container`,templateDoneButton:`${F}__template-done-button`,templateSelectFlowItemContainer:`${F}__template-select-flow-item-container`,templateSelectFlowItemContent:`${F}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${F}__template-select-flow-item-list-heading`,srLabel:`${F}__sr-label`,invalidWkidText:`${F}__invalid-wkid-text`};function L(e){return!isNaN(e)&&e>0&&Number.isFinite(e)}function R(e){return e?.toLowerCase()===P}function z(e){let{state:t,extension:n}=e;switch(t){case`pending`:return`spinner`;case`error`:return`exclamation-mark-circle`;default:return n?.toLowerCase()?.includes(`pdf`)?`file-pdf`:`file`}}const B=new i({inch:`inches`,foot:`feet`,yard:`yards`,mile:`miles`,"nautical-mile":`nautical-miles`,millimeter:`millimeters`,centimeter:`centimeters`,decimeter:`decimeters`,meter:`meters`,kilometer:`kilometers`}),V=new Map([[`a3-landscape`,`a3-landscape`],[`a3-portrait`,`a3-portrait`],[`a4-landscape`,`a4-landscape`],[`a4-portrait`,`a4-portrait`],[`letter-ansi-a-landscape`,`ansi-a-landscape`],[`letter-ansi-a-portrait`,`ansi-a-portrait`],[`tabloid-ansi-b-landscape`,`ansi-b-landscape`],[`tabloid-ansi-b-portrait`,`ansi-b-portrait`]]);let H=class extends x{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._selectedTab=`layoutTab`,this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new C,this._onInput=e=>{this._selectedTab===`layoutTab`?this.templateOptions.title=e.currentTarget.value:this._selectedTab===`mapOnlyTab`&&(this.templateOptions.fileName=e.currentTarget.value)},this._handleLinkClick=e=>{let t=e.currentTarget[`data-item`];if(!t||t.state!==`ready`||!t.url)return;let n=y(this.viewModel.effectivePrintServiceUrl),r=t.url,i=document.createElement(`a`);if(i.target=`_blank`,i.href=r,i.rel=`noreferrer`,i.download=t.formattedName??``,!n){i.click(),e.stopPropagation();return}e.preventDefault();let a=new URL(r);a.searchParams.set(`token`,n),i.href=a.href,i.click(),i.href=r},r(a.getLogger(this),`Print`,`arcgis-print`,{version:`4.33`}),this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([o(()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format],()=>{let{templatesInfo:e}=this.viewModel;if(!e)return;if(this._formats.length!==e.format.choiceList.length){let t=b.apiValues;this._formats=e.format.choiceList.map(e=>{let n=t.find(t=>RegExp(`\\b${t}\\b`,`i`).test(e))??e;return{value:n,label:e===n?e.toUpperCase():e}}).sort((e,t)=>e.label.localeCompare(t.label))}let t=this._formats.some(({value:e})=>RegExp(`\\b${e}\\b`,`i`).test(this.templateOptions.format));if(e.format.defaultValue&&!t){let t=this._formats.find(({value:t})=>RegExp(`\\b${t}\\b`,`i`).test(e.format.defaultValue))?.value;t&&(this.templateOptions.format=t)}}),o(()=>[this.templateOptions.id,this.viewModel.loaded],()=>{let{layout:e}=this.templateOptions;this._selectedTab=R(e)?`mapOnlyTab`:`layoutTab`,this._selectedTab===`layoutTab`&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))}),o(()=>this.templateOptions.dpi,e=>{e<=0&&(this.templateOptions.dpi=1)}),o(()=>this.viewModel.view?.scale,e=>{e&&(!this.templateOptions.scaleEnabled||!this.templateOptions.scale)&&(this.templateOptions.scale=e)}),s(()=>this.viewModel,`submit`,e=>this.emit(`submit`,e)),s(()=>this.viewModel,`complete`,e=>this.emit(`complete`,e))]);let{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;let n=setTimeout(()=>{this._awaitingServerResponse=!0,this.scheduleRender()},500);this.viewModel.load().then(()=>{clearTimeout(n),this._awaitingServerResponse=!1},()=>{})}loadDependencies(){return T({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),checkbox:()=>import(`@esri/calcite-components/dist/components/calcite-checkbox`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),"input-number":()=>import(`@esri/calcite-components/dist/components/calcite-input-number`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),loader:()=>import(`@esri/calcite-components/dist/components/calcite-loader`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`),link:()=>import(`@esri/calcite-components/dist/components/calcite-link`)})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get exportedLinks(){return this.viewModel.exportedLinks}set exportedLinks(e){this.viewModel.exportedLinks=e}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return`print`}set icon(e){this._overrideIfSome(`icon`,e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get outSpatialReference(){return this.viewModel.outSpatialReference}set outSpatialReference(e){this.viewModel.outSpatialReference=e}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get saveExportEnabled(){return this.viewModel.saveExportEnabled}set saveExportEnabled(e){this.viewModel.saveExportEnabled=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){let{messages:e,templateOptions:t,viewModel:n,view:r}=this,{attributionEnabled:i,author:a,copyright:o,dpi:s,format:c,height:l,layout:u,layoutItem:d,legendEnabled:f,northArrowEnabled:p,scaleBarEnabled:_,scaleEnabled:v,scale:y,width:b}=t,x=n.state!==`ready`||this._awaitingServerResponse||!(u||d),S=this._renderTitleOrFileNameSection(),C=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.fileFormatTitle,A(`calcite-combobox`,{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:({currentTarget:e})=>{this.templateOptions.format=e.selectedItems[0]?.value??`pdf`}},this._formats.map(({value:e,label:t},n)=>A(`calcite-combobox-item`,{heading:t,key:`file-format-${n}`,selected:e===this.templateOptions.format,value:e}))))),w=A(`calcite-label`,{layout:`inline`},A(`calcite-switch`,{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),T=A(`div`,null,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.template,A(`calcite-block`,{class:I.templateSelectContainer,collapsible:!1,description:this._getPageSizeLabel(this._selectedTemplate),heading:this._getTemplateLabel(this._selectedTemplate,!0),key:`template-select-block`,label:e.template,loading:this._selectedTemplate?.state===`loading`,tabIndex:0,onclick:()=>this._showTemplates=!0,onkeydown:e=>{(e.key===`Enter`||e.key===` `)&&(this._showTemplates=!0)}},A(`calcite-icon`,{class:I.templateSelectIcon,icon:(this._selectedTemplate?.layout?V.get(this._selectedTemplate.layout):null)||`custom-print`,key:`template-select-icon`,scale:`l`,slot:`content-start`}),this._selectedTemplate?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-select-error`,scale:`s`,slot:`actions-end`}):null,A(`calcite-icon`,{class:I.templateSelectArrow,icon:j()?`chevron-left`:`chevron-right`,key:`template-select-arrow`,scale:`s`,slot:`actions-end`})))),w),k=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.dpi,A(`calcite-input-number`,{bind:this,"data-input-name":`dpi`,min:1,value:`${s}`,onCalciteInputNumberInput:this._updateNumberInputValue}))),M=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,A(`div`,{class:I.srLabel},e.outSpatialReference,A(`calcite-link`,{href:`https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references/`,target:`_blank`},`(WKID)`)),A(`calcite-input-number`,{bind:this,"data-input-name":`outSpatialReference`,integer:!0,numberButtonType:`none`,value:n.outSpatialReference?.wkid?.toString()??``,onCalciteInputNumberInput:({currentTarget:e})=>{let t=m(e.value);n.outSpatialReference=Number.isNaN(t)||t==null?null:new h({wkid:t}),this._isValidSpatialReference=!n.outSpatialReference||g(n.outSpatialReference)}}),this._isValidSpatialReference?null:A(`div`,{class:I.invalidWkidText,key:`out-sr-${n.outSpatialReference?.wkid}`},e.invalidWkid))),N=A(`div`,{class:this.classes(I.scaleInfoContainer,I.formSectionContainer)},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:v,"data-option-name":`scaleEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scale),A(`div`,{class:I.scaleInputContainer},A(`calcite-input-number`,{"aria-label":e.scaleLabel,"aria-valuenow":`${y}`,bind:this,class:I.scaleInput,"data-input-name":`scale`,disabled:!v,value:`${y}`,onCalciteInputNumberInput:this._updateNumberInputValue}),A(`calcite-button`,{appearance:`outline`,"aria-label":e.reset,bind:this,disabled:!v,iconStart:`refresh`,kind:`neutral`,onclick:this._resetToCurrentScale}))),P=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:I.advancedOptionsContainer,key:`advanced-section-for-layout`},N,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??!0?A(`div`,{class:I.formSectionContainer,key:`author-info`},A(`calcite-label`,null,e.author,A(`calcite-input`,{bind:this,"data-input-name":`author`,value:a??``,onCalciteInputInput:this._updateInputValue}))):null,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??!0?A(`div`,{class:I.formSectionContainer,key:`copyright-text`},A(`calcite-label`,null,e.copyright,A(`calcite-input`,{bind:this,"data-input-name":`copyright`,value:o??``,onCalciteInputInput:this._updateInputValue}))):null,k,M,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??!0?A(`div`,{class:I.formSectionContainer,key:`legend-info`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!f,"data-option-name":`legendEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?A(`div`,{class:I.formSectionContainer,key:`north-arrow`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!p,"data-option-name":`northArrowEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null,this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length?A(`div`,{class:I.formSectionContainer,key:`scale-bar`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!_,"data-option-name":`scaleBarEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scaleBar)):null),F=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:I.advancedOptionsContainer},N,k,M,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:i,"data-option-name":`attributionEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),L=this.exportedLinks.toArray(),R=this._renderExportedLinkItems(L),z={[I.exportSectionCentered]:!L.length},B=this._selectedTab===`layoutTab`?A(`section`,{"aria-labelledby":`${this.id}__layoutTab`,class:I.layoutSection,id:`${this.id}__layoutContent`,key:`esri-print__layoutContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??!0?S:null,T,this._selectedTab===`layoutTab`?C:null,A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),collapsible:!0,disabled:!(u||d?.id),heading:e.advancedOptions,id:`advancedOptionsForLayout`,key:`advanced-options-for-layout`},P))):this._selectedTab===`mapOnlyTab`?A(`section`,{"aria-labelledby":`${this.id}__mapOnlyTab`,class:I.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:`esri-print__mapOnlyContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},S,C,A(`div`,null,A(`div`,{class:this.classes(I.sizeContainer,I.formSectionContainer)},A(`calcite-label`,null,e.width,A(`calcite-input-number`,{bind:this,"data-input-name":`width`,value:`${b}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`calcite-label`,null,e.height,A(`calcite-input-number`,{bind:this,"data-input-name":`height`,value:`${l}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`button`,{"aria-label":e.swap,bind:this,class:this.classes(E.widgetButton,I.swapButton,O.swap),type:`button`,onclick:this._switchInput})),w),A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),collapsible:!0,heading:e.advancedOptions,id:`advancedOptionsForMapOnly`,key:`advanced-options-for-map-only`},F))):A(`section`,{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(I.exportSection,z),id:`${this.id}__exportContent`,key:`esri-print__exportContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},A(`div`,{afterUpdate:this._scrollExportIntoView,bind:this,class:I.exportedFilesContainer},L.length===0?A(`div`,{class:I.exportedFilesEmpty},A(`calcite-icon`,{icon:`file`,scale:`l`}),A(`div`,null,A(D,{class:I.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),A(`div`,null,e.exportHint))):R))),H=r?.type!==`2d`,U=A(`div`,{class:I.panelError},r?H?e.sceneViewError:e.serviceError:e.noViewError),W=L.some(({state:e})=>e===`pending`),G=A(`div`,{class:I.content,key:`panel`},A(`div`,null,A(`ul`,{bind:this,class:I.layoutTabList,role:`tablist`,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown},A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`layoutTab`}`,class:I.layoutTab,"data-tab-id":`layoutTab`,id:`${this.id}__layoutTab`,role:`tab`,tabIndex:0},e.layoutTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`mapOnlyTab`}`,class:I.layoutTab,"data-tab-id":`mapOnlyTab`,id:`${this.id}__mapOnlyTab`,role:`tab`,tabIndex:0},e.mapOnlyTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`exportTab`}`,class:I.layoutTab,"data-tab-id":`exportTab`,id:`${this.id}__exportedFilesTab`,role:`tab`,tabIndex:0},W?A(`calcite-loader`,{inline:!0,label:`loading`,scale:`s`}):null,e.exportsTab)),B),this._selectedTab===`exportTab`?null:A(`div`,{class:this.classes(I.printButtonSection,!this.saveExportHidden&&this.portal?I.printButtonSectionDivider:null),key:`export-button-section`},!this.saveExportHidden&&this.portal?A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:this.saveExportEnabled,onCalciteCheckboxChange:e=>{this.saveExportEnabled=!!e.currentTarget.checked}}),e.saveExportToMyContent):null,A(`calcite-button`,{"aria-label":e.exportDescription,bind:this,class:this.classes(I.printButton),disabled:x||!(u||d?.id)&&!c,scale:`l`,width:`full`,onclick:this._handlePrintMap},e.export))),K=A(`calcite-flow`,{key:`root-flow`},A(`calcite-flow-item`,{bind:this,key:`root-flow-item`,selected:!this._showTemplates},A(`div`,{class:I.printWidgetContainer},this.headerVisible?A(`header`,{class:I.headerTitle},e.export):null,this.error||H||!r?U:G)),this._renderChooseTemplateFlowItem()),q=n.state===`initializing`,J=q?this._renderLoader():K,Y={[I.panelItemsCentered]:q};return A(`div`,{bind:this,class:this.classes(I.base,E.widget,E.panel,Y)},J)}_getPageSizeLabel(e){if(!e)return;let n=e.layoutTemplateInfo;if(!n)return;let r=B.fromJSON(n.pageUnits.toLowerCase());return`${t(n.pageSize[0])} \u00D7 ${t(n.pageSize[1])} ${l(this.messagesUnits,r,`abbr`)}`}_getTemplateLabel(e,t=!1){if(!e)return t?this.messages.selectTemplate:this.messages.untitled;let{label:n,layout:r,layoutItem:i}=e;return(r&&!i&&this.messages[r]?this.messages[r]:null)||((n??r??i?.id)?.replaceAll(`_`,` `)??this.messages.untitled)}_getPortalTemplates(){return this.includeDefaultTemplates&&this.includeOrganizationTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!!t?.id):[]}_getDefaultTemplates(){return this.includeDefaultTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!t?.id):[]}_getPrintServiceTemplates(){return!this.includeDefaultTemplates||!this._getDefaultTemplates().length?this.viewModel.printServiceTemplates.toArray().filter(({layout:e})=>!R(e)):[]}_renderLayoutTemplates(e,t=!1,n=!1){return t&&e.sort((e,t)=>(e.label??``)>(t.label??``)?1:-1),e.map(e=>A(`calcite-list-item`,{description:this._getPageSizeLabel(e),key:`template-${e.id}-${e.id===this.templateOptions.id}`,label:this._getTemplateLabel(e),selected:e.id===this.templateOptions.id,title:e.description??``,value:e},A(`calcite-icon`,{icon:(e.layout?V.get(e.layout):null)||`custom-print`,slot:`content-start`}),e.state===`loading`?A(`calcite-loader`,{inline:!0,key:`template-loader-${e.id}`,label:`loading`,scale:`s`,slot:`content-end`}):null,e?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-error-${e.id}`,scale:`s`,slot:`content-end`}):null,n?A(`calcite-action`,{icon:`trash`,slot:`actions-end`,text:`delete`,onclick:()=>this.viewModel.removePortalTemplate(e)}):null))}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;let{messages:e}=this,t=v.test(this.portal?.url),n=this.viewModel.browseTemplates.toArray(),r=this._getPortalTemplates(),i=this._getDefaultTemplates(),a=this._getPrintServiceTemplates(),o=n.length+r.length+i.length+a.length>15,s=this.browseTemplateButtonOnClick?A(`calcite-button`,{appearance:`outline`,class:o?I.browseTemplateButtonContainerFilter:I.browseTemplateButtonContainer,iconStart:`folder`,key:`browse-template-button`,slot:o?`filter-actions-end`:`default`,onclick:this.browseTemplateButtonOnClick},o?null:e.browseTemplates):null;return A(`calcite-flow-item`,{bind:this,closable:!1,heading:e.chooseTemplate,key:`template-flow-item`,selected:this._showTemplates,onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},A(`div`,{class:I.templateSelectFlowItemContainer},A(`div`,{class:I.templateSelectFlowItemContent},o?null:s,A(`calcite-list`,{filterEnabled:o,filterProps:[`label`],key:`template-list`,label:e.templateList,selectionMode:`single-persist`,onCalciteListChange:({currentTarget:e})=>this.viewModel.applyTemplate(e.selectedItems[0]?.value)},o?s:null,n.length?A(`div`,{key:`my-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.myTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(n,!0,!0)):null,r.length?A(`div`,{key:`org-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.organizationTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(r)):null,n.length||r.length?i.length?A(`div`,{key:`default-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(i,!0)):null:this._renderLayoutTemplates(i,!0),n.length||r.length?a.length?A(`div`,{key:`service-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(a)):null:this._renderLayoutTemplates(a))),A(`div`,{class:I.templateButtonContainer},A(`calcite-button`,{class:I.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){let{customTextElements:e}=this.templateOptions;return e?A(`div`,{class:I.formSectionContainer,key:`custom-text-elements`},e.map((e,t)=>{let[n,r]=Object.entries(e)[0];return n===`date`?null:A(`calcite-label`,{key:`custom-text-elements-${n}-${t}`},n,A(`calcite-input`,{bind:this,"data-input-custom":!0,"data-input-name":n,value:r??``,onCalciteInputInput:this._updateInputValue}))})):null}_renderTitleOrFileNameSection(){let{title:e,fileName:t,titlePlaceHolder:n,fileNamePlaceHolder:r}=this.messages,i=this._selectedTab===`layoutTab`?e:t,a=this._selectedTab===`layoutTab`?n:r,o=this._selectedTab===`layoutTab`?this.templateOptions.title:this.templateOptions.fileName;return A(`div`,{class:I.formSectionContainer,key:i},A(`calcite-label`,null,i,A(`calcite-input`,{placeholder:a,value:o??``,onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;let t=e.getAttribute(`data-tab-id`);(t===`layoutTab`&&this._selectedTab===`layoutTab`||t===`mapOnlyTab`&&this._selectedTab===`mapOnlyTab`||t===`exportTab`&&this._selectedTab===`exportTab`)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){let e={[I.loader]:this._awaitingServerResponse};return A(`div`,{class:this.classes(e),key:`loader`})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,n){let r=e.find(e=>{let[n]=Object.entries(e)[0];return n===t});r[t]=n}_updateInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),r=!!t[`data-input-custom`],{templateOptions:i}=this;r?this._updateCustomTextElementValue(i.customTextElements,n,t.value):i[n]=t.value}_updateNumberInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),{templateOptions:r}=this,i=Number(t.value);L(i)?r[n]=i:t.value=`${r[n]}`}_handlePrintMap(){this._pendingExportScroll=!0;let{templateOptions:e}=this,t=this._selectedTab===`layoutTab`?e.title:e.fileName,{promise:n}=this.viewModel.export(t||this.messages.untitled);this._selectedTab=`exportTab`,n.then(()=>this.scheduleRender())}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;let e=this._rootNode;if(!e)return;let{clientHeight:t,scrollHeight:n}=e,r=n-t;r>0&&(e.scrollTop=r)}_toggleInputValue(e){let t=e.target,n=t.getAttribute(`data-option-name`);this.templateOptions[n]=t.checked,n===`scaleEnabled`&&this._resetToCurrentScale()}_renderExportedLinkItemPopover(e){let t=this.messages,n=e.formattedName??``,{state:r}=e,i=this.saveAsButtonCallback&&r!==`error`&&this._isFormatAllowedForSaving(e.extension);return r!==`pending`&&i?A(`calcite-popover`,{autoClose:!0,key:`${n}-popover`,label:`Popover`,offsetDistance:1,overlayPositioning:`fixed`,pointerDisabled:!0,referenceElement:`${n}-popover-button`,scale:`s`,topLayerDisabled:this.topLayerDisabled},A(`calcite-list`,{label:``},e.portalItem?A(`calcite-list-item`,{label:t.openItem,onCalciteListItemSelect:()=>{let t=e.portalItem;if(!t||!t.itemPageUrl)return;let n=document.createElement(`a`);n.target=`_blank`,n.href=t.itemPageUrl,n.rel=`noreferrer`,n.click()}},A(`calcite-icon`,{icon:`launch2`,key:`${n}-launch-icon`,scale:`s`,slot:`content-start`})):A(`calcite-list-item`,{label:t.saveAs,onCalciteListItemSelect:async()=>{this.saveAsButtonCallback&&(c(()=>e.portalItem).then(e=>{e.itemPageUrl&&this.scheduleRender()}),await this.saveAsButtonCallback(e))}},A(`calcite-icon`,{icon:`save`,key:`${n}-save-icon`,scale:`s`,slot:`content-start`})),A(`calcite-list-item`,{label:this.messagesCommon.delete,onCalciteListItemSelect:()=>this.exportedLinks.remove(e)},A(`calcite-icon`,{icon:`trash`,key:`${n}-delete-icon`,scale:`s`,slot:`content-start`})))):null}_renderExportedLinkItemContent(e){let t=this.messages,{url:n,state:r,error:i}=e,a=e.formattedName??``,o=n||null;o&&=u(o);let s=d(o,location.href),c=r===`error`?i?.name===`print-task:cim-symbol-unsupported`?t.exportWebMapCIMError:t.exportWebMapError:null;return A(`div`,{class:I.exportedFile,"data-item":e,slot:`content`,onclick:this._handleLinkClick},A(`div`,null,A(`div`,{class:I.exportedFileLinkTitle},a),A(`div`,{class:I.exportedFileLinkDescription},r===`pending`?t.generatingExport:c||(s?t.ready:t.linkReady))),r===`ready`?A(`calcite-icon`,{"aria-label":`${a}. ${t.linkReady}`,icon:s?`download-to`:`launch`,key:`${a}-end-icon`,scale:`s`,slot:`content-end`}):null)}_renderExportedLinkItemIcon(e){let t=e.formattedName??``;return e.state===`pending`?A(`calcite-loader`,{class:I.exportedFileLoader,inline:!0,key:`${t}-loader`,label:this.messages.generatingExport,scale:`m`,slot:`content-start`}):A(`calcite-icon`,{icon:z(e),key:`${t}-start-icon`,scale:`s`,slot:`content-start`})}_renderExportedLinkItemAction(e){let{state:t}=e,n=e.formattedName??``,r=this.saveAsButtonCallback&&t!==`error`&&this._isFormatAllowedForSaving(e.extension);return t===`pending`?null:A(`calcite-action`,{icon:r?`ellipsis`:`x`,id:r?`${n}-popover-button`:void 0,key:r?`${n}-saveAs-action`:`${n}-action`,slot:`actions-end`,text:r?this.messagesCommon.options:this.messagesCommon.remove,onclick:r?void 0:()=>{this.exportedLinks.remove(e)}})}_renderExportedLinkItem(e){let t=e.formattedName??``;return A(M,null,A(`calcite-list-item`,{key:t,label:t},this._renderExportedLinkItemContent(e),this._renderExportedLinkItemIcon(e),this._renderExportedLinkItemAction(e)),this._renderExportedLinkItemPopover(e))}_renderExportedLinkItems(e){return A(`calcite-list`,{filterEnabled:e?.length>10,label:this.messages.exportedLinksList,selectionMode:`none`},e.map(this._renderExportedLinkItem.bind(this)))}_isFormatAllowedForSaving(e){return!this.allowedFormatsForSaving||this.allowedFormatsForSaving===`all`||!!(e&&this.allowedFormatsForSaving.includes(e))}_toggleLayoutPanel(e){let t=e.target;this._toggleTab(t.getAttribute(`data-tab-id`))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===`mapOnlyTab`)this.viewModel.applyTemplate(P);else if(this._selectedTab===`layoutTab`){let e=this._selectedTemplate??this.viewModel.defaultTemplate;this.viewModel.applyTemplate(e)}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){let{key:t}=e,n=e.target.getAttribute(`data-tab-id`);if(N(t))this._toggleTab(n),e.preventDefault(),e.stopPropagation();else if(t===`ArrowLeft`||t===`ArrowRight`){switch(n){case`layoutTab`:this._toggleTab(t===`ArrowLeft`?`exportTab`:`mapOnlyTab`);break;case`mapOnlyTab`:this._toggleTab(t===`ArrowLeft`?`layoutTab`:`exportTab`);break;case`exportTab`:this._toggleTab(t===`ArrowLeft`?`mapOnlyTab`:`layoutTab`)}e.preventDefault(),e.stopPropagation()}}};e([f()],H.prototype,`_showTemplates`,void 0),e([f()],H.prototype,`_isValidSpatialReference`,void 0),e([f()],H.prototype,`allowedFormats`,null),e([f()],H.prototype,`allowedFormatsForSaving`,void 0),e([f()],H.prototype,`allowedLayouts`,null),e([f()],H.prototype,`browseTemplateButtonOnClick`,void 0),e([f()],H.prototype,`error`,null),e([f({type:n.ofType(S)})],H.prototype,`exportedLinks`,null),e([f()],H.prototype,`extraParameters`,null),e([f()],H.prototype,`headerVisible`,void 0),e([f()],H.prototype,`headingLevel`,void 0),e([f()],H.prototype,`icon`,null),e([f()],H.prototype,`includeDefaultTemplates`,null),e([f()],H.prototype,`includeOrganizationTemplates`,void 0),e([f()],H.prototype,`label`,null),e([f(),k(`esri/widgets/Print/t9n/Print`)],H.prototype,`messages`,void 0),e([f(),k(`esri/t9n/common`)],H.prototype,`messagesCommon`,void 0),e([f(),k(`esri/core/t9n/Units`)],H.prototype,`messagesUnits`,void 0),e([f({type:h})],H.prototype,`outSpatialReference`,null),e([f({type:_})],H.prototype,`portal`,null),e([f()],H.prototype,`saveExportEnabled`,null),e([f()],H.prototype,`saveExportHidden`,void 0),e([f()],H.prototype,`showPrintAreaEnabled`,null),e([f()],H.prototype,`printServiceUrl`,null),e([f()],H.prototype,`saveAsButtonCallback`,void 0),e([f()],H.prototype,`templateCustomTextElements`,null),e([f({type:w})],H.prototype,`templateOptions`,null),e([f()],H.prototype,`view`,null),e([f({type:C})],H.prototype,`viewModel`,void 0),H=e([p(`esri.widgets.Print`)],H);const U=H;export{U as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{formatNumber as t}from"../intl.js";import n from"../core/Collection.js";import{deprecateWidget as r}from"../core/deprecate.js";import{JSONMap as i}from"../core/jsonMap.js";import a from"../core/Logger.js";import{watch as o,on as s,whenOnce as c}from"../core/reactiveUtils.js";import{unitName as l}from"../core/unitFormatUtils.js";import{addProxy as u,hasSameOrigin as d}from"../core/urlUtils.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{ensureInteger as m}from"../core/accessorSupport/ensureType.js";import h from"../geometry/SpatialReference.js";import{isValid as g}from"../geometry/support/spatialReferenceUtils.js";import _ from"../portal/Portal.js";import{reArcGISOnlineDomain as v}from"../portal/support/urlUtils.js";import{findToken as y}from"../rest/utils.js";import{formatJsonMap as b}from"../rest/support/fileFormat.js";import x from"./Widget.js";import S from"./Print/FileLink.js";import C from"./Print/PrintViewModel.js";import w from"./Print/TemplateOptions.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import{globalCss as E}from"./support/globalCss.js";import{Heading as D}from"./support/Heading.js";import{legacyIcon as O}from"./support/legacyIcon.js";import{messageBundle as k,tsx as A,isRTL as j,tsxFragment as M,isActivationKey as N}from"./support/widget.js";const P=`map-only`,F=`esri-print`,I={base:F,headerTitle:`${F}__header-title`,layoutTabList:`${F}__layout-tab-list`,layoutTab:`${F}__layout-tab`,layoutSection:`${F}__layout-section`,mapOnlySection:`${F}__map-only-section`,panelItemsCentered:`${F}__panel-items--centered`,loader:`${F}__loader`,swapButton:`${F}__swap-button`,printButton:`${F}__export-button`,printButtonSection:`${F}__export-button-section`,printButtonSectionDivider:`${F}__export-button-section--divider`,templateSelectContainer:`${F}__template-select-container`,templateSelectIcon:`${F}__template-select-icon`,templateSelectError:`${F}__template-select-error`,templateSelectArrow:`${F}__template-select-arrow`,formSectionContainer:`${F}__form-section-container`,advancedOptionsSection:`${F}__advanced-options-section`,advancedOptionsContainer:`${F}__advanced-options-container`,browseTemplateButtonContainer:`${F}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${F}__browse-template-button-container-filter`,exportedFilesContainer:`${F}__export-panel-container`,exportedFilesTitle:`${F}__export-title`,exportedFile:`${F}__exported-file`,exportedFileLinkTitle:`${F}__exported-file-link-title`,exportedFileLinkDescription:`${F}__exported-file-link-description`,exportedFilesEmpty:`${F}__exported-files-empty`,printWidgetContainer:`${F}__container`,content:`${F}__content`,panelContainer:`${F}__panel-container`,scaleInfoContainer:`${F}__scale-info-container`,scaleInputContainer:`${F}__scale-input-container`,scaleInput:`${F}__scale-input`,sizeContainer:`${F}__size-container`,panelError:`${F}__panel--error`,exportedFileLoader:`${F}__exported-file--loader`,exportSection:`${F}__export-section`,exportSectionCentered:`${F}__export-section--centered`,templateButtonContainer:`${F}__template-button-container`,templateDoneButton:`${F}__template-done-button`,templateSelectFlowItemContainer:`${F}__template-select-flow-item-container`,templateSelectFlowItemContent:`${F}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${F}__template-select-flow-item-list-heading`,srLabel:`${F}__sr-label`,invalidWkidText:`${F}__invalid-wkid-text`};function L(e){return!isNaN(e)&&e>0&&Number.isFinite(e)}function R(e){return e?.toLowerCase()===P}function z(e){let{state:t,extension:n}=e;switch(t){case`pending`:return`spinner`;case`error`:return`exclamation-mark-circle`;default:return n?.toLowerCase()?.includes(`pdf`)?`file-pdf`:`file`}}const B=new i({inch:`inches`,foot:`feet`,yard:`yards`,mile:`miles`,"nautical-mile":`nautical-miles`,millimeter:`millimeters`,centimeter:`centimeters`,decimeter:`decimeters`,meter:`meters`,kilometer:`kilometers`}),V=new Map([[`a3-landscape`,`a3-landscape`],[`a3-portrait`,`a3-portrait`],[`a4-landscape`,`a4-landscape`],[`a4-portrait`,`a4-portrait`],[`letter-ansi-a-landscape`,`ansi-a-landscape`],[`letter-ansi-a-portrait`,`ansi-a-portrait`],[`tabloid-ansi-b-landscape`,`ansi-b-landscape`],[`tabloid-ansi-b-portrait`,`ansi-b-portrait`]]);let H=class extends x{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._selectedTab=`layoutTab`,this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new C,this._onInput=e=>{this._selectedTab===`layoutTab`?this.templateOptions.title=e.currentTarget.value:this._selectedTab===`mapOnlyTab`&&(this.templateOptions.fileName=e.currentTarget.value)},this._handleLinkClick=e=>{let t=e.currentTarget[`data-item`];if(!t||t.state!==`ready`||!t.url)return;let n=y(this.viewModel.effectivePrintServiceUrl),r=t.url,i=document.createElement(`a`);if(i.target=`_blank`,i.href=r,i.rel=`noreferrer`,i.download=t.formattedName??``,!n){i.click(),e.stopPropagation();return}e.preventDefault();let a=new URL(r);a.searchParams.set(`token`,n),i.href=a.href,i.click(),i.href=r},r(a.getLogger(this),`Print`,`arcgis-print`,{version:`4.33`}),this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([o(()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format],()=>{let{templatesInfo:e}=this.viewModel;if(!e)return;if(this._formats.length!==e.format.choiceList.length){let t=b.apiValues;this._formats=e.format.choiceList.map(e=>{let n=t.find(t=>RegExp(`\\b${t}\\b`,`i`).test(e))??e;return{value:n,label:e===n?e.toUpperCase():e}}).sort((e,t)=>e.label.localeCompare(t.label))}let t=this._formats.some(({value:e})=>RegExp(`\\b${e}\\b`,`i`).test(this.templateOptions.format));if(e.format.defaultValue&&!t){let t=this._formats.find(({value:t})=>RegExp(`\\b${t}\\b`,`i`).test(e.format.defaultValue))?.value;t&&(this.templateOptions.format=t)}}),o(()=>[this.templateOptions.id,this.viewModel.loaded],()=>{let{layout:e}=this.templateOptions;this._selectedTab=R(e)?`mapOnlyTab`:`layoutTab`,this._selectedTab===`layoutTab`&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))}),o(()=>this.templateOptions.dpi,e=>{e<=0&&(this.templateOptions.dpi=1)}),o(()=>this.viewModel.view?.scale,e=>{e&&(!this.templateOptions.scaleEnabled||!this.templateOptions.scale)&&(this.templateOptions.scale=e)}),s(()=>this.viewModel,`submit`,e=>this.emit(`submit`,e)),s(()=>this.viewModel,`complete`,e=>this.emit(`complete`,e))]);let{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;let n=setTimeout(()=>{this._awaitingServerResponse=!0,this.scheduleRender()},500);this.viewModel.load().then(()=>{clearTimeout(n),this._awaitingServerResponse=!1},()=>{})}loadDependencies(){return T({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),checkbox:()=>import(`@esri/calcite-components/dist/components/calcite-checkbox`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),"input-number":()=>import(`@esri/calcite-components/dist/components/calcite-input-number`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),loader:()=>import(`@esri/calcite-components/dist/components/calcite-loader`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`),link:()=>import(`@esri/calcite-components/dist/components/calcite-link`)})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get exportedLinks(){return this.viewModel.exportedLinks}set exportedLinks(e){this.viewModel.exportedLinks=e}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return`print`}set icon(e){this._overrideIfSome(`icon`,e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get outSpatialReference(){return this.viewModel.outSpatialReference}set outSpatialReference(e){this.viewModel.outSpatialReference=e}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get saveExportEnabled(){return this.viewModel.saveExportEnabled}set saveExportEnabled(e){this.viewModel.saveExportEnabled=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){let{messages:e,templateOptions:t,viewModel:n,view:r}=this,{attributionEnabled:i,author:a,copyright:o,dpi:s,format:c,height:l,layout:u,layoutItem:d,legendEnabled:f,northArrowEnabled:p,scaleBarEnabled:_,scaleEnabled:v,scale:y,width:b}=t,x=n.state!==`ready`||this._awaitingServerResponse||!(u||d),S=this._renderTitleOrFileNameSection(),C=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.fileFormatTitle,A(`calcite-combobox`,{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:({currentTarget:e})=>{this.templateOptions.format=e.selectedItems[0]?.value??`pdf`}},this._formats.map(({value:e,label:t},n)=>A(`calcite-combobox-item`,{heading:t,key:`file-format-${n}`,selected:e===this.templateOptions.format,value:e}))))),w=A(`calcite-label`,{layout:`inline`},A(`calcite-switch`,{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),T=A(`div`,null,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.template,A(`calcite-block`,{class:I.templateSelectContainer,description:this._getPageSizeLabel(this._selectedTemplate),expandable:!1,heading:this._getTemplateLabel(this._selectedTemplate,!0),key:`template-select-block`,label:e.template,loading:this._selectedTemplate?.state===`loading`,tabIndex:0,onclick:()=>this._showTemplates=!0,onkeydown:e=>{(e.key===`Enter`||e.key===` `)&&(this._showTemplates=!0)}},A(`calcite-icon`,{class:I.templateSelectIcon,icon:(this._selectedTemplate?.layout?V.get(this._selectedTemplate.layout):null)||`custom-print`,key:`template-select-icon`,scale:`l`,slot:`content-start`}),this._selectedTemplate?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-select-error`,scale:`s`,slot:`actions-end`}):null,A(`calcite-icon`,{class:I.templateSelectArrow,icon:j()?`chevron-left`:`chevron-right`,key:`template-select-arrow`,scale:`s`,slot:`actions-end`})))),w),k=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,e.dpi,A(`calcite-input-number`,{bind:this,"data-input-name":`dpi`,min:1,value:`${s}`,onCalciteInputNumberInput:this._updateNumberInputValue}))),M=A(`div`,{class:I.formSectionContainer},A(`calcite-label`,null,A(`div`,{class:I.srLabel},e.outSpatialReference,A(`calcite-link`,{href:`https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references/`,target:`_blank`},`(WKID)`)),A(`calcite-input-number`,{bind:this,"data-input-name":`outSpatialReference`,integer:!0,numberButtonType:`none`,value:n.outSpatialReference?.wkid?.toString()??``,onCalciteInputNumberInput:({currentTarget:e})=>{let t=m(e.value);n.outSpatialReference=Number.isNaN(t)||t==null?null:new h({wkid:t}),this._isValidSpatialReference=!n.outSpatialReference||g(n.outSpatialReference)}}),this._isValidSpatialReference?null:A(`div`,{class:I.invalidWkidText,key:`out-sr-${n.outSpatialReference?.wkid}`},e.invalidWkid))),N=A(`div`,{class:this.classes(I.scaleInfoContainer,I.formSectionContainer)},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:v,"data-option-name":`scaleEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scale),A(`div`,{class:I.scaleInputContainer},A(`calcite-input-number`,{"aria-label":e.scaleLabel,"aria-valuenow":`${y}`,bind:this,class:I.scaleInput,"data-input-name":`scale`,disabled:!v,value:`${y}`,onCalciteInputNumberInput:this._updateNumberInputValue}),A(`calcite-button`,{appearance:`outline`,"aria-label":e.reset,bind:this,disabled:!v,iconStart:`refresh`,kind:`neutral`,onclick:this._resetToCurrentScale}))),P=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:I.advancedOptionsContainer,key:`advanced-section-for-layout`},N,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??!0?A(`div`,{class:I.formSectionContainer,key:`author-info`},A(`calcite-label`,null,e.author,A(`calcite-input`,{bind:this,"data-input-name":`author`,value:a??``,onCalciteInputInput:this._updateInputValue}))):null,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??!0?A(`div`,{class:I.formSectionContainer,key:`copyright-text`},A(`calcite-label`,null,e.copyright,A(`calcite-input`,{bind:this,"data-input-name":`copyright`,value:o??``,onCalciteInputInput:this._updateInputValue}))):null,k,M,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??!0?A(`div`,{class:I.formSectionContainer,key:`legend-info`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!f,"data-option-name":`legendEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?A(`div`,{class:I.formSectionContainer,key:`north-arrow`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!p,"data-option-name":`northArrowEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null,this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length?A(`div`,{class:I.formSectionContainer,key:`scale-bar`},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:!!_,"data-option-name":`scaleBarEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.scaleBar)):null),F=A(`div`,{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:I.advancedOptionsContainer},N,k,M,A(`div`,{class:I.formSectionContainer},A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:i,"data-option-name":`attributionEnabled`,onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),L=this.exportedLinks.toArray(),R=this._renderExportedLinkItems(L),z={[I.exportSectionCentered]:!L.length},B=this._selectedTab===`layoutTab`?A(`section`,{"aria-labelledby":`${this.id}__layoutTab`,class:I.layoutSection,id:`${this.id}__layoutContent`,key:`esri-print__layoutContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??!0?S:null,T,this._selectedTab===`layoutTab`?C:null,A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),disabled:!(u||d?.id),expandable:!0,heading:e.advancedOptions,id:`advancedOptionsForLayout`,key:`advanced-options-for-layout`},P))):this._selectedTab===`mapOnlyTab`?A(`section`,{"aria-labelledby":`${this.id}__mapOnlyTab`,class:I.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:`esri-print__mapOnlyContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},S,C,A(`div`,null,A(`div`,{class:this.classes(I.sizeContainer,I.formSectionContainer)},A(`calcite-label`,null,e.width,A(`calcite-input-number`,{bind:this,"data-input-name":`width`,value:`${b}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`calcite-label`,null,e.height,A(`calcite-input-number`,{bind:this,"data-input-name":`height`,value:`${l}`,onCalciteInputNumberInput:this._updateNumberInputValue})),A(`button`,{"aria-label":e.swap,bind:this,class:this.classes(E.widgetButton,I.swapButton,O.swap),type:`button`,onclick:this._switchInput})),w),A(`calcite-block`,{"aria-label":e.advancedOptions,class:this.classes(I.panelContainer,I.advancedOptionsSection),expandable:!0,heading:e.advancedOptions,id:`advancedOptionsForMapOnly`,key:`advanced-options-for-map-only`},F))):A(`section`,{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(I.exportSection,z),id:`${this.id}__exportContent`,key:`esri-print__exportContent`,role:`tabpanel`},A(`div`,{class:I.panelContainer},A(`div`,{afterUpdate:this._scrollExportIntoView,bind:this,class:I.exportedFilesContainer},L.length===0?A(`div`,{class:I.exportedFilesEmpty},A(`calcite-icon`,{icon:`file`,scale:`l`}),A(`div`,null,A(D,{class:I.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),A(`div`,null,e.exportHint))):R))),H=r?.type!==`2d`,U=A(`div`,{class:I.panelError},r?H?e.sceneViewError:e.serviceError:e.noViewError),W=L.some(({state:e})=>e===`pending`),G=A(`div`,{class:I.content,key:`panel`},A(`div`,null,A(`ul`,{bind:this,class:I.layoutTabList,role:`tablist`,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown},A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`layoutTab`}`,class:I.layoutTab,"data-tab-id":`layoutTab`,id:`${this.id}__layoutTab`,role:`tab`,tabIndex:0},e.layoutTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`mapOnlyTab`}`,class:I.layoutTab,"data-tab-id":`mapOnlyTab`,id:`${this.id}__mapOnlyTab`,role:`tab`,tabIndex:0},e.mapOnlyTab),A(`li`,{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===`exportTab`}`,class:I.layoutTab,"data-tab-id":`exportTab`,id:`${this.id}__exportedFilesTab`,role:`tab`,tabIndex:0},W?A(`calcite-loader`,{inline:!0,label:`loading`,scale:`s`}):null,e.exportsTab)),B),this._selectedTab===`exportTab`?null:A(`div`,{class:this.classes(I.printButtonSection,!this.saveExportHidden&&this.portal?I.printButtonSectionDivider:null),key:`export-button-section`},!this.saveExportHidden&&this.portal?A(`calcite-label`,{layout:`inline`},A(`calcite-checkbox`,{bind:this,checked:this.saveExportEnabled,onCalciteCheckboxChange:e=>{this.saveExportEnabled=!!e.currentTarget.checked}}),e.saveExportToMyContent):null,A(`calcite-button`,{"aria-label":e.exportDescription,bind:this,class:this.classes(I.printButton),disabled:x||!(u||d?.id)&&!c,scale:`l`,width:`full`,onclick:this._handlePrintMap},e.export))),K=A(`calcite-flow`,{key:`root-flow`},A(`calcite-flow-item`,{bind:this,key:`root-flow-item`,selected:!this._showTemplates},A(`div`,{class:I.printWidgetContainer},this.headerVisible?A(`header`,{class:I.headerTitle},e.export):null,this.error||H||!r?U:G)),this._renderChooseTemplateFlowItem()),q=n.state===`initializing`,J=q?this._renderLoader():K,Y={[I.panelItemsCentered]:q};return A(`div`,{bind:this,class:this.classes(I.base,E.widget,E.panel,Y)},J)}_getPageSizeLabel(e){if(!e)return;let n=e.layoutTemplateInfo;if(!n)return;let r=B.fromJSON(n.pageUnits.toLowerCase());return`${t(n.pageSize[0])} \u00D7 ${t(n.pageSize[1])} ${l(this.messagesUnits,r,`abbr`)}`}_getTemplateLabel(e,t=!1){if(!e)return t?this.messages.selectTemplate:this.messages.untitled;let{label:n,layout:r,layoutItem:i}=e;return(r&&!i&&this.messages[r]?this.messages[r]:null)||((n??r??i?.id)?.replaceAll(`_`,` `)??this.messages.untitled)}_getPortalTemplates(){return this.includeDefaultTemplates&&this.includeOrganizationTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!!t?.id):[]}_getDefaultTemplates(){return this.includeDefaultTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!R(e)&&!t?.id):[]}_getPrintServiceTemplates(){return!this.includeDefaultTemplates||!this._getDefaultTemplates().length?this.viewModel.printServiceTemplates.toArray().filter(({layout:e})=>!R(e)):[]}_renderLayoutTemplates(e,t=!1,n=!1){return t&&e.sort((e,t)=>(e.label??``)>(t.label??``)?1:-1),e.map(e=>A(`calcite-list-item`,{description:this._getPageSizeLabel(e),key:`template-${e.id}-${e.id===this.templateOptions.id}`,label:this._getTemplateLabel(e),selected:e.id===this.templateOptions.id,title:e.description??``,value:e},A(`calcite-icon`,{icon:(e.layout?V.get(e.layout):null)||`custom-print`,slot:`content-start`}),e.state===`loading`?A(`calcite-loader`,{inline:!0,key:`template-loader-${e.id}`,label:`loading`,scale:`s`,slot:`content-end`}):null,e?.state===`error`?A(`calcite-icon`,{class:I.templateSelectError,icon:`exclamation-mark-circle`,key:`template-error-${e.id}`,scale:`s`,slot:`content-end`}):null,n?A(`calcite-action`,{icon:`trash`,slot:`actions-end`,text:`delete`,onclick:()=>this.viewModel.removePortalTemplate(e)}):null))}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;let{messages:e}=this,t=v.test(this.portal?.url),n=this.viewModel.browseTemplates.toArray(),r=this._getPortalTemplates(),i=this._getDefaultTemplates(),a=this._getPrintServiceTemplates(),o=n.length+r.length+i.length+a.length>15,s=this.browseTemplateButtonOnClick?A(`calcite-button`,{appearance:`outline`,class:o?I.browseTemplateButtonContainerFilter:I.browseTemplateButtonContainer,iconStart:`folder`,key:`browse-template-button`,slot:o?`filter-actions-end`:`default`,onclick:this.browseTemplateButtonOnClick},o?null:e.browseTemplates):null;return A(`calcite-flow-item`,{bind:this,closable:!1,heading:e.chooseTemplate,key:`template-flow-item`,selected:this._showTemplates,onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},A(`div`,{class:I.templateSelectFlowItemContainer},A(`div`,{class:I.templateSelectFlowItemContent},o?null:s,A(`calcite-list`,{filterEnabled:o,filterProps:[`label`],key:`template-list`,label:e.templateList,selectionMode:`single-persist`,onCalciteListChange:({currentTarget:e})=>this.viewModel.applyTemplate(e.selectedItems[0]?.value)},o?s:null,n.length?A(`div`,{key:`my-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.myTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(n,!0,!0)):null,r.length?A(`div`,{key:`org-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.organizationTemplates,t?A(`calcite-chip`,{appearance:`outline`,kind:`neutral`,label:e.beta,scale:`s`},e.beta):null),this._renderLayoutTemplates(r)):null,n.length||r.length?i.length?A(`div`,{key:`default-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(i,!0)):null:this._renderLayoutTemplates(i,!0),n.length||r.length?a.length?A(`div`,{key:`service-templates`},A(`div`,{class:I.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(a)):null:this._renderLayoutTemplates(a))),A(`div`,{class:I.templateButtonContainer},A(`calcite-button`,{class:I.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){let{customTextElements:e}=this.templateOptions;return e?A(`div`,{class:I.formSectionContainer,key:`custom-text-elements`},e.map((e,t)=>{let[n,r]=Object.entries(e)[0];return n===`date`?null:A(`calcite-label`,{key:`custom-text-elements-${n}-${t}`},n,A(`calcite-input`,{bind:this,"data-input-custom":!0,"data-input-name":n,value:r??``,onCalciteInputInput:this._updateInputValue}))})):null}_renderTitleOrFileNameSection(){let{title:e,fileName:t,titlePlaceHolder:n,fileNamePlaceHolder:r}=this.messages,i=this._selectedTab===`layoutTab`?e:t,a=this._selectedTab===`layoutTab`?n:r,o=this._selectedTab===`layoutTab`?this.templateOptions.title:this.templateOptions.fileName;return A(`div`,{class:I.formSectionContainer,key:i},A(`calcite-label`,null,i,A(`calcite-input`,{placeholder:a,value:o??``,onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;let t=e.getAttribute(`data-tab-id`);(t===`layoutTab`&&this._selectedTab===`layoutTab`||t===`mapOnlyTab`&&this._selectedTab===`mapOnlyTab`||t===`exportTab`&&this._selectedTab===`exportTab`)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){let e={[I.loader]:this._awaitingServerResponse};return A(`div`,{class:this.classes(e),key:`loader`})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,n){let r=e.find(e=>{let[n]=Object.entries(e)[0];return n===t});r[t]=n}_updateInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),r=!!t[`data-input-custom`],{templateOptions:i}=this;r?this._updateCustomTextElementValue(i.customTextElements,n,t.value):i[n]=t.value}_updateNumberInputValue(e){let t=e.currentTarget,n=t.getAttribute(`data-input-name`),{templateOptions:r}=this,i=Number(t.value);L(i)?r[n]=i:t.value=`${r[n]}`}_handlePrintMap(){this._pendingExportScroll=!0;let{templateOptions:e}=this,t=this._selectedTab===`layoutTab`?e.title:e.fileName,{promise:n}=this.viewModel.export(t||this.messages.untitled);this._selectedTab=`exportTab`,n.then(()=>this.scheduleRender())}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;let e=this._rootNode;if(!e)return;let{clientHeight:t,scrollHeight:n}=e,r=n-t;r>0&&(e.scrollTop=r)}_toggleInputValue(e){let t=e.target,n=t.getAttribute(`data-option-name`);this.templateOptions[n]=t.checked,n===`scaleEnabled`&&this._resetToCurrentScale()}_renderExportedLinkItemPopover(e){let t=this.messages,n=e.formattedName??``,{state:r}=e,i=this.saveAsButtonCallback&&r!==`error`&&this._isFormatAllowedForSaving(e.extension);return r!==`pending`&&i?A(`calcite-popover`,{autoClose:!0,key:`${n}-popover`,label:`Popover`,offsetDistance:1,overlayPositioning:`fixed`,pointerDisabled:!0,referenceElement:`${n}-popover-button`,scale:`s`,topLayerDisabled:this.topLayerDisabled},A(`calcite-list`,{label:``},e.portalItem?A(`calcite-list-item`,{label:t.openItem,onCalciteListItemSelect:()=>{let t=e.portalItem;if(!t||!t.itemPageUrl)return;let n=document.createElement(`a`);n.target=`_blank`,n.href=t.itemPageUrl,n.rel=`noreferrer`,n.click()}},A(`calcite-icon`,{icon:`launch2`,key:`${n}-launch-icon`,scale:`s`,slot:`content-start`})):A(`calcite-list-item`,{label:t.saveAs,onCalciteListItemSelect:async()=>{this.saveAsButtonCallback&&(c(()=>e.portalItem).then(e=>{e.itemPageUrl&&this.scheduleRender()}),await this.saveAsButtonCallback(e))}},A(`calcite-icon`,{icon:`save`,key:`${n}-save-icon`,scale:`s`,slot:`content-start`})),A(`calcite-list-item`,{label:this.messagesCommon.delete,onCalciteListItemSelect:()=>this.exportedLinks.remove(e)},A(`calcite-icon`,{icon:`trash`,key:`${n}-delete-icon`,scale:`s`,slot:`content-start`})))):null}_renderExportedLinkItemContent(e){let t=this.messages,{url:n,state:r,error:i}=e,a=e.formattedName??``,o=n||null;o&&=u(o);let s=d(o,location.href),c=r===`error`?i?.name===`print-task:cim-symbol-unsupported`?t.exportWebMapCIMError:t.exportWebMapError:null;return A(`div`,{class:I.exportedFile,"data-item":e,slot:`content`,onclick:this._handleLinkClick},A(`div`,null,A(`div`,{class:I.exportedFileLinkTitle},a),A(`div`,{class:I.exportedFileLinkDescription},r===`pending`?t.generatingExport:c||(s?t.ready:t.linkReady))),r===`ready`?A(`calcite-icon`,{"aria-label":`${a}. ${t.linkReady}`,icon:s?`download-to`:`launch`,key:`${a}-end-icon`,scale:`s`,slot:`content-end`}):null)}_renderExportedLinkItemIcon(e){let t=e.formattedName??``;return e.state===`pending`?A(`calcite-loader`,{class:I.exportedFileLoader,inline:!0,key:`${t}-loader`,label:this.messages.generatingExport,scale:`m`,slot:`content-start`}):A(`calcite-icon`,{icon:z(e),key:`${t}-start-icon`,scale:`s`,slot:`content-start`})}_renderExportedLinkItemAction(e){let{state:t}=e,n=e.formattedName??``,r=this.saveAsButtonCallback&&t!==`error`&&this._isFormatAllowedForSaving(e.extension);return t===`pending`?null:A(`calcite-action`,{icon:r?`ellipsis`:`x`,id:r?`${n}-popover-button`:void 0,key:r?`${n}-saveAs-action`:`${n}-action`,slot:`actions-end`,text:r?this.messagesCommon.options:this.messagesCommon.remove,onclick:r?void 0:()=>{this.exportedLinks.remove(e)}})}_renderExportedLinkItem(e){let t=e.formattedName??``;return A(M,null,A(`calcite-list-item`,{key:t,label:t},this._renderExportedLinkItemContent(e),this._renderExportedLinkItemIcon(e),this._renderExportedLinkItemAction(e)),this._renderExportedLinkItemPopover(e))}_renderExportedLinkItems(e){return A(`calcite-list`,{filterEnabled:e?.length>10,label:this.messages.exportedLinksList,selectionMode:`none`},e.map(this._renderExportedLinkItem.bind(this)))}_isFormatAllowedForSaving(e){return!this.allowedFormatsForSaving||this.allowedFormatsForSaving===`all`||!!(e&&this.allowedFormatsForSaving.includes(e))}_toggleLayoutPanel(e){let t=e.target;this._toggleTab(t.getAttribute(`data-tab-id`))}_toggleTab(e,t=!0){if(this._selectedTab=e,this._selectedTab===`mapOnlyTab`)this.viewModel.applyTemplate(P);else if(this._selectedTab===`layoutTab`){let e=this._selectedTemplate??this.viewModel.defaultTemplate;this.viewModel.applyTemplate(e)}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){let{key:t}=e,n=e.target.getAttribute(`data-tab-id`);if(N(t))this._toggleTab(n),e.preventDefault(),e.stopPropagation();else if(t===`ArrowLeft`||t===`ArrowRight`){switch(n){case`layoutTab`:this._toggleTab(t===`ArrowLeft`?`exportTab`:`mapOnlyTab`);break;case`mapOnlyTab`:this._toggleTab(t===`ArrowLeft`?`layoutTab`:`exportTab`);break;case`exportTab`:this._toggleTab(t===`ArrowLeft`?`mapOnlyTab`:`layoutTab`)}e.preventDefault(),e.stopPropagation()}}};e([f()],H.prototype,`_showTemplates`,void 0),e([f()],H.prototype,`_isValidSpatialReference`,void 0),e([f()],H.prototype,`allowedFormats`,null),e([f()],H.prototype,`allowedFormatsForSaving`,void 0),e([f()],H.prototype,`allowedLayouts`,null),e([f()],H.prototype,`browseTemplateButtonOnClick`,void 0),e([f()],H.prototype,`error`,null),e([f({type:n.ofType(S)})],H.prototype,`exportedLinks`,null),e([f()],H.prototype,`extraParameters`,null),e([f()],H.prototype,`headerVisible`,void 0),e([f()],H.prototype,`headingLevel`,void 0),e([f()],H.prototype,`icon`,null),e([f()],H.prototype,`includeDefaultTemplates`,null),e([f()],H.prototype,`includeOrganizationTemplates`,void 0),e([f()],H.prototype,`label`,null),e([f(),k(`esri/widgets/Print/t9n/Print`)],H.prototype,`messages`,void 0),e([f(),k(`esri/t9n/common`)],H.prototype,`messagesCommon`,void 0),e([f(),k(`esri/core/t9n/Units`)],H.prototype,`messagesUnits`,void 0),e([f({type:h})],H.prototype,`outSpatialReference`,null),e([f({type:_})],H.prototype,`portal`,null),e([f()],H.prototype,`saveExportEnabled`,null),e([f()],H.prototype,`saveExportHidden`,void 0),e([f()],H.prototype,`showPrintAreaEnabled`,null),e([f()],H.prototype,`printServiceUrl`,null),e([f()],H.prototype,`saveAsButtonCallback`,void 0),e([f()],H.prototype,`templateCustomTextElements`,null),e([f({type:w})],H.prototype,`templateOptions`,null),e([f()],H.prototype,`view`,null),e([f({type:C})],H.prototype,`viewModel`,void 0),H=e([p(`esri.widgets.Print`)],H);const U=H;export{U as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{formatNumber as t,substitute as n}from"../intl.js";import{deprecateWidget as r}from"../core/deprecate.js";import{on as i}from"../core/events.js";import a from"../core/Logger.js";import{destroyMaybe as o}from"../core/maybe.js";import{watch as s,initial as c,when as l}from"../core/reactiveUtils.js";import{property as u,cast as d,subclass as f}from"../core/accessorSupport/decorators.js";import p from"./Slider.js";import m from"./Widget.js";import{css as h}from"./ScaleRangeSlider/css.js";import{getScalePreviewSource as g,getScalePreviewSpriteBackgroundPosition as _}from"./ScaleRangeSlider/scalePreviewUtils.js";import v from"./ScaleRangeSlider/ScaleRanges.js";import y from"./ScaleRangeSlider/ScaleRangeSliderViewModel.js";import{loadCalciteComponents as b}from"./support/componentsUtils.js";import{globalCss as x}from"./support/globalCss.js";import{messageBundle as S,tsx as C}from"./support/widget.js";import{storeNode as w,setFocus as T}from"./support/widgetUtils.js";const E={preview:!0,scaleMenus:{maxScaleMenu:!0,minScaleMenu:!0}},D={maximumFractionDigits:0};let O=class extends m{constructor(e,t){super(e,t),this._activeMenu=null,this._activeThumb=null,this._customInput=null,this._maxThumbNode=null,this._minThumbNode=null,this._lastPreviewReferenceElement=null,this._previewAutoCloseTimeoutId=void 0,this._previewPopover=null,this._slider=new p({suppressDeprecationWarning:!0,thumbCreatedFunction:(e,t,n)=>{e===0?this._minThumbNode=n:e===1&&(this._maxThumbNode=n),this.addHandles([i(n,`mouseenter`,()=>{this._activeThumb=e,this._lastPreviewReferenceElement=n,this.scheduleRender()}),i(n,`mouseleave`,()=>{this._previewAutoCloseTimeoutId||(this._activeThumb=null,this.scheduleRender())})])}}),this.disabled=!1,this.messages=null,this.region=`US`,this.showWorldValue=!1,this.viewModel=new y,this.visibleElements=E,this._repositionPreviewPopover=()=>{let e=this._previewPopover;e&&e.open&&this._activeThumb!=null&&this._getReferenceNode(this._activeThumb)&&requestAnimationFrame(()=>e.reposition())},this._afterInputNumberCreate=e=>{`value`in e&&e.value!=null&&`setNumberValue`in e&&e.setNumberValue({committing:!1,value:e.value,origin:`direct`}),this._customInput=e},this._handleCustomScaleInputChange=(e,t)=>{let{viewModel:{scaleRanges:n}}=this,r=Number.parseFloat(t.value);Number.isNaN(r)?t.value=e:this._setScale(n.clampScale(r))},this.announceDeprecation=()=>{r(a.getLogger(this),`Scale Range Slider`,`arcgis-slider-scale-range`,{version:`5.0`})}}loadDependencies(){return b({button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),dropdown:()=>import(`@esri/calcite-components/dist/components/calcite-dropdown`),"dropdown-group":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-group`),"dropdown-item":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),"input-number":()=>import(`@esri/calcite-components/dist/components/calcite-input-number`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`)})}initialize(){this.addHandles([s(()=>this.viewModel,e=>this._slider.viewModel=e?.sliderViewModel??null,c),s(()=>this._interactive,e=>{this._slider.disabled=!e,e||this._setActiveMenu(null)},c),this._slider.on(`thumb-drag`,({index:e})=>{this._activeThumb=e,this._lastPreviewReferenceElement=this._getReferenceNode(e),clearTimeout(this._previewAutoCloseTimeoutId),this._previewAutoCloseTimeoutId=setTimeout(()=>{this._previewAutoCloseTimeoutId=void 0,this._activeThumb=null},250)}),l(()=>this.view?.stationary===!0,()=>this.scheduleRender())])}destroy(){this._slider=o(this._slider)}get _maxScaleMenuEnabled(){let{scaleMenus:e}=this.visibleElements;return e===!0||typeof e!=`boolean`&&e?.maxScaleMenu===!0}get _minScaleMenuEnabled(){let{scaleMenus:e}=this.visibleElements;return e===!0||typeof e!=`boolean`&&e?.minScaleMenu===!0}get _interactive(){return this.viewModel?.state!==`disabled`&&!this.disabled}get effectiveMaxScale(){return this.viewModel.effectiveMaxScale}get effectiveMinScale(){return this.viewModel.effectiveMinScale}get effectiveMaxScaleLimit(){return this.viewModel.effectiveMaxScaleLimit}get effectiveMinScaleLimit(){return this.viewModel.effectiveMinScaleLimit}get icon(){return`actual-size`}set icon(e){this._overrideIfSome(`icon`,e)}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 maxScale(){return this.viewModel.maxScale}set maxScale(e){this.viewModel.maxScale=e}get maxScaleLimit(){return this.viewModel.maxScaleLimit}set maxScaleLimit(e){this.viewModel.maxScaleLimit=e}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}get minScale(){return this.viewModel.minScale}set minScale(e){this.viewModel.minScale=e}get minScaleLimit(){return this.viewModel.minScaleLimit}set minScaleLimit(e){this.viewModel.minScaleLimit=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...E,...e,scaleMenus:typeof e?.scaleMenus==`boolean`?e.scaleMenus:{...E.scaleMenus,...e?.scaleMenus}}}formatScale(e){return`1:${t(e,D)}`}render(){let{_interactive:e,_slider:t,label:n,view:r,viewModel:{state:i}}=this,a=this._getLabel(`min`),o=this._getLabel(`max`),{segmentElements:s}=t,c=s.at(this.mode===`min-scale-only`?-1:-2);return c&&c.classList.add(h.segmentElementActive),C(`div`,{"aria-label":n,class:this.classes(h.base,x.widget,e?null:x.disabled)},C(`div`,{class:h.scaleIndicatorWrapper,dir:`ltr`},i===`ready`&&r?this._renderCurrentScaleIndicator():null,t.render(),this._renderPreviewPopover()),C(`div`,{class:h.scaleMenuContainer},this._minScaleMenuEnabled&&a?this._renderScaleMenuToggle(`min`,a):null,C(`div`,{class:h.scaleMenuSeparator}),this._maxScaleMenuEnabled&&o?this._renderScaleMenuToggle(`max`,o):null))}_renderPreviewPopover(){let{_activeThumb:e}=this,t=this._getReferenceNode(e)??this._lastPreviewReferenceElement,n=e!=null&&this.visibleElements.preview&&t!=null;return n?C(`calcite-popover`,{afterCreate:w,afterUpdate:this._repositionPreviewPopover,bind:this,"data-node-ref":`_previewPopover`,label:this.messages.preview,offsetDistance:16,open:n,overlayPositioning:`fixed`,placement:`top`,referenceElement:t??void 0,topLayerDisabled:this.topLayerDisabled,triggerDisabled:!0},this._renderScalePreview()):null}_getReferenceNode(e){return e===0?this._minThumbNode:e===1?this._maxThumbNode:null}_renderScalePreview(){let{_activeThumb:e,_slider:t,region:n,viewModel:{scaleRanges:r}}=this,i=e===0||this.mode!==`range`?t.values[0]:t.values[1],a=Object.keys(v.RecommendedScales).indexOf(r.findScaleRangeByIndex(i).id),o={backgroundImage:g(n),backgroundPosition:_(a)};return C(`div`,{class:h.scalePreview},C(`div`,{class:h.scalePreviewThumbnail,styles:o}))}_getLabel(e){let{_slider:t,messages:n,mode:r,viewModel:{scaleRanges:i}}=this,[a,o]=t.values,s=e===`min`||r!==`range`?a:o,c=n.scaleRangeLabels[i.findScaleRangeByIndex(s).id];switch(r){case`range`:return c;case`max-scale-only`:return e===`min`?null:c;case`min-scale-only`:return e===`min`?c:null}}_renderScaleMenuToggle(e,t){let{_activeMenu:n,_interactive:r}=this,i=n===e;return[C(`calcite-dropdown`,{closeOnSelectDisabled:!0,"data-type":e,open:i,overlayPositioning:`fixed`,placement:e===`max`?`bottom-end`:`bottom-start`,scale:`s`,topLayerDisabled:this.topLayerDisabled,onCalciteDropdownClose:({currentTarget:t})=>{this._activeMenu===e&&this._setActiveMenu(null),T(t.querySelector(`calcite-button`))},onCalciteDropdownOpen:()=>this._setActiveMenu(e)},C(`calcite-button`,{appearance:i?`outline`:`transparent`,"aria-pressed":i.toString(),class:h.scaleMenuToggle,disabled:!r,iconEnd:`chevron-down`,scale:`s`,slot:`trigger`},t),i&&e===`max`?this._renderMaxScaleMenu():null,i&&e===`min`?this._renderMinScaleMenu():null)]}_renderMinScaleMenu(){let{effectiveMaxScale:e,effectiveMinScaleLimit:t,view:n,viewModel:{scaleRanges:r}}=this,i=n?n.scale:void 0;return this._renderScaleMenu({type:`min`,min:t,max:r.findScaleRange(e).minScale,viewScale:i})}_renderMaxScaleMenu(){let{effectiveMinScale:e,effectiveMaxScaleLimit:t,view:n,viewModel:{scaleRanges:r}}=this,i=n?n.scale:void 0;return this._renderScaleMenu({type:`max`,min:r.findScaleRange(e).maxScale,max:t,viewScale:i})}_renderScaleMenu({viewScale:e,min:t,max:n,type:r}){let{effectiveMaxScale:i,effectiveMinScale:a,messages:o,showWorldValue:s}=this,c=r===`max`?i:a,l=v.fromScaleRange({minScale:t,maxScale:n}),u=this.messages.featuredScaleLabels,d=v.RecommendedScales,f=Object.keys(d).filter(e=>l.contains(d[e])).map(e=>this._renderScaleMenuItem({scaleLabel:u[e],scaleValue:d[e],isSelected:c===d[e],valueVisible:e!==`world`||s}));return C(`calcite-dropdown-group`,{key:`${this.id}__scale-menu--${r}`},this._renderCustomScaleValue({currentScale:c}),e==null?null:this._renderScaleMenuItem({scaleValue:e,scaleLabel:o.featuredScaleLabels.current,isSelected:c===e,valueVisible:!0}),f)}_renderCustomScaleValue({currentScale:e}){let{messages:t}=this,n=Math.round(e).toString();return C(`calcite-dropdown-item`,{afterCreate:e=>void T(e),key:`custom-scale`,label:t.featuredScaleLabels.custom,onCalciteDropdownItemSelect:()=>void T(this._customInput)},C(`calcite-label`,{scale:`s`},C(`span`,null,t.featuredScaleLabels.custom),C(`calcite-input-number`,{afterCreate:this._afterInputNumberCreate,groupSeparator:!0,inputMode:`numeric`,max:v.RecommendedScales.world,min:0,numberButtonType:`none`,placeholder:t.customScaleInputTooltip,prefixText:`1:`,scale:`s`,step:1,value:n,onCalciteInputNumberChange:({currentTarget:e})=>this._handleCustomScaleInputChange(n,e)})))}_renderScaleMenuItem(e){let{scaleValue:t,scaleLabel:n,valueVisible:r,isSelected:i}=e;return C(`calcite-dropdown-item`,{key:n,label:n,selected:i,onCalciteDropdownItemSelect:this._setScale.bind(this,t)},n,r?C(`div`,{class:h.scaleMenuSubLabel},this.formatScale(t)):void 0)}_renderCurrentScaleIndicator(){let{_slider:e,messages:t,view:r,viewModel:{scaleRanges:i}}=this,a=i.clampScale(r.scale),o=this.viewModel.mapScaleToSlider(a),s=o/e.max,c=t.scaleRangeLabels[i.findScaleRangeByIndex(o).id],l=n(t.currentScaleTooltip,{scaleLabel:c});return C(`div`,{class:h.scaleIndicatorContainer,key:`scale-indicator`},C(`div`,{"aria-label":l,class:h.scaleIndicator,styles:{left:`${s*100}%`},title:l},this.renderCurrentScaleIndicatorIcon()))}renderCurrentScaleIndicatorIcon(){return C(`calcite-icon`,{class:h.scaleIndicatorIcon,icon:`caret-up`,scale:`s`})}_setScale(e){this._activeMenu===`max`?this.maxScale=Math.min(e,this.effectiveMinScale-1):this.minScale=Math.max(e,this.effectiveMaxScale+1),this._setActiveMenu(null)}_setActiveMenu(e){this._activeMenu=e}};e([u()],O.prototype,`_activeMenu`,void 0),e([u()],O.prototype,`_activeThumb`,void 0),e([u()],O.prototype,`_customInput`,void 0),e([u()],O.prototype,`_maxScaleMenuEnabled`,null),e([u()],O.prototype,`_minScaleMenuEnabled`,null),e([u()],O.prototype,`_slider`,void 0),e([u({readOnly:!0})],O.prototype,`_interactive`,null),e([u()],O.prototype,`disabled`,void 0),e([u()],O.prototype,`effectiveMaxScale`,null),e([u()],O.prototype,`effectiveMinScale`,null),e([u()],O.prototype,`effectiveMaxScaleLimit`,null),e([u()],O.prototype,`effectiveMinScaleLimit`,null),e([u()],O.prototype,`icon`,null),e([u()],O.prototype,`label`,null),e([u()],O.prototype,`layer`,null),e([u()],O.prototype,`maxScale`,null),e([u()],O.prototype,`maxScaleLimit`,null),e([u(),S(`esri/widgets/ScaleRangeSlider/t9n/ScaleRangeSlider`)],O.prototype,`messages`,void 0),e([u()],O.prototype,`mode`,null),e([u()],O.prototype,`minScale`,null),e([u()],O.prototype,`minScaleLimit`,null),e([u()],O.prototype,`region`,void 0),e([u()],O.prototype,`showWorldValue`,void 0),e([u()],O.prototype,`view`,null),e([u({type:y})],O.prototype,`viewModel`,void 0),e([u()],O.prototype,`visibleElements`,void 0),e([d(`visibleElements`)],O.prototype,`castVisibleElements`,null),O=e([f(`esri.widgets.ScaleRangeSlider`)],O);const k=O;export{k as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{formatNumber as t,substitute as n}from"../intl.js";import{deprecateWidget as r}from"../core/deprecate.js";import{on as i}from"../core/events.js";import a from"../core/Logger.js";import{destroyMaybe as o}from"../core/maybe.js";import{watch as s,initial as c,when as l}from"../core/reactiveUtils.js";import{property as u,cast as d,subclass as f}from"../core/accessorSupport/decorators.js";import p from"./Slider.js";import m from"./Widget.js";import{css as h}from"./ScaleRangeSlider/css.js";import{getScalePreviewSource as g,getScalePreviewSpriteBackgroundPosition as _}from"./ScaleRangeSlider/scalePreviewUtils.js";import v from"./ScaleRangeSlider/ScaleRanges.js";import y from"./ScaleRangeSlider/ScaleRangeSliderViewModel.js";import{createDropdownReference as b,loadCalciteComponents as x}from"./support/componentsUtils.js";import{globalCss as S}from"./support/globalCss.js";import{messageBundle as C,tsx as w}from"./support/widget.js";import{storeNode as T,setFocus as E}from"./support/widgetUtils.js";const D={preview:!0,scaleMenus:{maxScaleMenu:!0,minScaleMenu:!0}},O={maximumFractionDigits:0};let k=class extends m{constructor(e,t){super(e,t),this._activeMenu=null,this._activeThumb=null,this._customInput=null,this._maxThumbNode=null,this._minThumbNode=null,this._lastPreviewReferenceElement=null,this._previewAutoCloseTimeoutId=void 0,this._previewPopover=null,this._scaleMenuReferences={min:b(),max:b()},this._slider=new p({suppressDeprecationWarning:!0,thumbCreatedFunction:(e,t,n)=>{e===0?this._minThumbNode=n:e===1&&(this._maxThumbNode=n),this.addHandles([i(n,`mouseenter`,()=>{this._activeThumb=e,this._lastPreviewReferenceElement=n,this.scheduleRender()}),i(n,`mouseleave`,()=>{this._previewAutoCloseTimeoutId||(this._activeThumb=null,this.scheduleRender())})])}}),this.disabled=!1,this.messages=null,this.region=`US`,this.showWorldValue=!1,this.viewModel=new y,this.visibleElements=D,this._repositionPreviewPopover=()=>{let e=this._previewPopover;e&&e.open&&this._activeThumb!=null&&this._getReferenceNode(this._activeThumb)&&requestAnimationFrame(()=>e.reposition())},this._afterInputNumberCreate=e=>{`value`in e&&e.value!=null&&`setNumberValue`in e&&e.setNumberValue({committing:!1,value:e.value,origin:`direct`}),this._customInput=e},this._handleCustomScaleInputChange=(e,t)=>{let{viewModel:{scaleRanges:n}}=this,r=Number.parseFloat(t.value);Number.isNaN(r)?t.value=e:this._setScale(n.clampScale(r))},this.announceDeprecation=()=>{r(a.getLogger(this),`Scale Range Slider`,`arcgis-slider-scale-range`,{version:`5.0`})}}loadDependencies(){return x({button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),dropdown:()=>import(`@esri/calcite-components/dist/components/calcite-dropdown`),"dropdown-group":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-group`),"dropdown-item":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),"input-number":()=>import(`@esri/calcite-components/dist/components/calcite-input-number`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`)})}initialize(){this.addHandles([s(()=>this.viewModel,e=>this._slider.viewModel=e?.sliderViewModel??null,c),s(()=>this._interactive,e=>{this._slider.disabled=!e,e||this._setActiveMenu(null)},c),this._slider.on(`thumb-drag`,({index:e})=>{this._activeThumb=e,this._lastPreviewReferenceElement=this._getReferenceNode(e),clearTimeout(this._previewAutoCloseTimeoutId),this._previewAutoCloseTimeoutId=setTimeout(()=>{this._previewAutoCloseTimeoutId=void 0,this._activeThumb=null},250)}),l(()=>this.view?.stationary===!0,()=>this.scheduleRender())])}destroy(){this._scaleMenuReferences.min.destroy(),this._scaleMenuReferences.max.destroy(),this._slider=o(this._slider)}get _maxScaleMenuEnabled(){let{scaleMenus:e}=this.visibleElements;return e===!0||typeof e!=`boolean`&&e?.maxScaleMenu===!0}get _minScaleMenuEnabled(){let{scaleMenus:e}=this.visibleElements;return e===!0||typeof e!=`boolean`&&e?.minScaleMenu===!0}get _interactive(){return this.viewModel?.state!==`disabled`&&!this.disabled}get effectiveMaxScale(){return this.viewModel.effectiveMaxScale}get effectiveMinScale(){return this.viewModel.effectiveMinScale}get effectiveMaxScaleLimit(){return this.viewModel.effectiveMaxScaleLimit}get effectiveMinScaleLimit(){return this.viewModel.effectiveMinScaleLimit}get icon(){return`actual-size`}set icon(e){this._overrideIfSome(`icon`,e)}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 maxScale(){return this.viewModel.maxScale}set maxScale(e){this.viewModel.maxScale=e}get maxScaleLimit(){return this.viewModel.maxScaleLimit}set maxScaleLimit(e){this.viewModel.maxScaleLimit=e}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}get minScale(){return this.viewModel.minScale}set minScale(e){this.viewModel.minScale=e}get minScaleLimit(){return this.viewModel.minScaleLimit}set minScaleLimit(e){this.viewModel.minScaleLimit=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...D,...e,scaleMenus:typeof e?.scaleMenus==`boolean`?e.scaleMenus:{...D.scaleMenus,...e?.scaleMenus}}}formatScale(e){return`1:${t(e,O)}`}render(){let{_interactive:e,_slider:t,label:n,view:r,viewModel:{state:i}}=this,a=this._getLabel(`min`),o=this._getLabel(`max`),{segmentElements:s}=t,c=s.at(this.mode===`min-scale-only`?-1:-2);return c&&c.classList.add(h.segmentElementActive),w(`div`,{"aria-label":n,class:this.classes(h.base,S.widget,e?null:S.disabled)},w(`div`,{class:h.scaleIndicatorWrapper,dir:`ltr`},i===`ready`&&r?this._renderCurrentScaleIndicator():null,t.render(),this._renderPreviewPopover()),w(`div`,{class:h.scaleMenuContainer},this._minScaleMenuEnabled&&a?this._renderScaleMenuToggle(`min`,a):null,w(`div`,{class:h.scaleMenuSeparator}),this._maxScaleMenuEnabled&&o?this._renderScaleMenuToggle(`max`,o):null))}_renderPreviewPopover(){let{_activeThumb:e}=this,t=this._getReferenceNode(e)??this._lastPreviewReferenceElement,n=e!=null&&this.visibleElements.preview&&t!=null;return n?w(`calcite-popover`,{afterCreate:T,afterUpdate:this._repositionPreviewPopover,bind:this,"data-node-ref":`_previewPopover`,label:this.messages.preview,offsetDistance:16,open:n,overlayPositioning:`fixed`,placement:`top`,referenceElement:t??void 0,topLayerDisabled:this.topLayerDisabled,triggerDisabled:!0},this._renderScalePreview()):null}_getReferenceNode(e){return e===0?this._minThumbNode:e===1?this._maxThumbNode:null}_renderScalePreview(){let{_activeThumb:e,_slider:t,region:n,viewModel:{scaleRanges:r}}=this,i=e===0||this.mode!==`range`?t.values[0]:t.values[1],a=Object.keys(v.RecommendedScales).indexOf(r.findScaleRangeByIndex(i).id),o={backgroundImage:g(n),backgroundPosition:_(a)};return w(`div`,{class:h.scalePreview},w(`div`,{class:h.scalePreviewThumbnail,styles:o}))}_getLabel(e){let{_slider:t,messages:n,mode:r,viewModel:{scaleRanges:i}}=this,[a,o]=t.values,s=e===`min`||r!==`range`?a:o,c=n.scaleRangeLabels[i.findScaleRangeByIndex(s).id];switch(r){case`range`:return c;case`max-scale-only`:return e===`min`?null:c;case`min-scale-only`:return e===`min`?c:null}}_renderScaleMenuToggle(e,t){let{_activeMenu:n,_interactive:r}=this,i=n===e,a=this._scaleMenuReferences[e],{storeTrigger:o,destroy:s,referenceTrigger:c}=a;return[w(`calcite-button`,{afterCreate:o,afterRemoved:s,afterUpdate:o,appearance:i?`outline`:`transparent`,"aria-pressed":i.toString(),class:h.scaleMenuToggle,disabled:!r,iconEnd:`chevron-down`,key:`scale-menu-${e}-trigger`,scale:`s`},t),w(`calcite-dropdown`,{afterCreate:c,afterUpdate:c,closeOnSelectDisabled:!0,"data-type":e,key:`scale-menu-${e}-dropdown`,open:i,overlayPositioning:`fixed`,placement:e===`max`?`bottom-end`:`bottom-start`,scale:`s`,topLayerDisabled:this.topLayerDisabled,onCalciteDropdownClose:()=>{this._activeMenu===e&&this._setActiveMenu(null),E(a.trigger)},onCalciteDropdownOpen:()=>this._setActiveMenu(e)},i&&e===`max`?this._renderMaxScaleMenu():null,i&&e===`min`?this._renderMinScaleMenu():null)]}_renderMinScaleMenu(){let{effectiveMaxScale:e,effectiveMinScaleLimit:t,view:n,viewModel:{scaleRanges:r}}=this,i=n?n.scale:void 0;return this._renderScaleMenu({type:`min`,min:t,max:r.findScaleRange(e).minScale,viewScale:i})}_renderMaxScaleMenu(){let{effectiveMinScale:e,effectiveMaxScaleLimit:t,view:n,viewModel:{scaleRanges:r}}=this,i=n?n.scale:void 0;return this._renderScaleMenu({type:`max`,min:r.findScaleRange(e).maxScale,max:t,viewScale:i})}_renderScaleMenu({viewScale:e,min:t,max:n,type:r}){let{effectiveMaxScale:i,effectiveMinScale:a,messages:o,showWorldValue:s}=this,c=r===`max`?i:a,l=v.fromScaleRange({minScale:t,maxScale:n}),u=this.messages.featuredScaleLabels,d=v.RecommendedScales,f=Object.keys(d).filter(e=>l.contains(d[e])).map(e=>this._renderScaleMenuItem({scaleLabel:u[e],scaleValue:d[e],isSelected:c===d[e],valueVisible:e!==`world`||s}));return w(`calcite-dropdown-group`,{key:`${this.id}__scale-menu--${r}`},this._renderCustomScaleValue({currentScale:c}),e==null?null:this._renderScaleMenuItem({scaleValue:e,scaleLabel:o.featuredScaleLabels.current,isSelected:c===e,valueVisible:!0}),f)}_renderCustomScaleValue({currentScale:e}){let{messages:t}=this,n=Math.round(e).toString();return w(`calcite-dropdown-item`,{afterCreate:e=>void E(e),key:`custom-scale`,label:t.featuredScaleLabels.custom,onCalciteDropdownItemSelect:()=>void E(this._customInput)},w(`calcite-label`,{scale:`s`},w(`span`,null,t.featuredScaleLabels.custom),w(`calcite-input-number`,{afterCreate:this._afterInputNumberCreate,groupSeparator:!0,inputMode:`numeric`,max:v.RecommendedScales.world,min:0,numberButtonType:`none`,placeholder:t.customScaleInputTooltip,prefixText:`1:`,scale:`s`,step:1,value:n,onCalciteInputNumberChange:({currentTarget:e})=>this._handleCustomScaleInputChange(n,e)})))}_renderScaleMenuItem(e){let{scaleValue:t,scaleLabel:n,valueVisible:r,isSelected:i}=e;return w(`calcite-dropdown-item`,{key:n,label:n,selected:i,onCalciteDropdownItemSelect:this._setScale.bind(this,t)},n,r?w(`div`,{class:h.scaleMenuSubLabel},this.formatScale(t)):void 0)}_renderCurrentScaleIndicator(){let{_slider:e,messages:t,view:r,viewModel:{scaleRanges:i}}=this,a=i.clampScale(r.scale),o=this.viewModel.mapScaleToSlider(a),s=o/e.max,c=t.scaleRangeLabels[i.findScaleRangeByIndex(o).id],l=n(t.currentScaleTooltip,{scaleLabel:c});return w(`div`,{class:h.scaleIndicatorContainer,key:`scale-indicator`},w(`div`,{"aria-label":l,class:h.scaleIndicator,styles:{left:`${s*100}%`},title:l},this.renderCurrentScaleIndicatorIcon()))}renderCurrentScaleIndicatorIcon(){return w(`calcite-icon`,{class:h.scaleIndicatorIcon,icon:`caret-up`,scale:`s`})}_setScale(e){this._activeMenu===`max`?this.maxScale=Math.min(e,this.effectiveMinScale-1):this.minScale=Math.max(e,this.effectiveMaxScale+1),this._setActiveMenu(null)}_setActiveMenu(e){this._activeMenu=e}};e([u()],k.prototype,`_activeMenu`,void 0),e([u()],k.prototype,`_activeThumb`,void 0),e([u()],k.prototype,`_customInput`,void 0),e([u()],k.prototype,`_maxScaleMenuEnabled`,null),e([u()],k.prototype,`_minScaleMenuEnabled`,null),e([u()],k.prototype,`_slider`,void 0),e([u({readOnly:!0})],k.prototype,`_interactive`,null),e([u()],k.prototype,`disabled`,void 0),e([u()],k.prototype,`effectiveMaxScale`,null),e([u()],k.prototype,`effectiveMinScale`,null),e([u()],k.prototype,`effectiveMaxScaleLimit`,null),e([u()],k.prototype,`effectiveMinScaleLimit`,null),e([u()],k.prototype,`icon`,null),e([u()],k.prototype,`label`,null),e([u()],k.prototype,`layer`,null),e([u()],k.prototype,`maxScale`,null),e([u()],k.prototype,`maxScaleLimit`,null),e([u(),C(`esri/widgets/ScaleRangeSlider/t9n/ScaleRangeSlider`)],k.prototype,`messages`,void 0),e([u()],k.prototype,`mode`,null),e([u()],k.prototype,`minScale`,null),e([u()],k.prototype,`minScaleLimit`,null),e([u()],k.prototype,`region`,void 0),e([u()],k.prototype,`showWorldValue`,void 0),e([u()],k.prototype,`view`,null),e([u({type:y})],k.prototype,`viewModel`,void 0),e([u()],k.prototype,`visibleElements`,void 0),e([d(`visibleElements`)],k.prototype,`castVisibleElements`,null),k=e([f(`esri.widgets.ScaleRangeSlider`)],k);const A=k;export{A as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{substitute as t}from"../../intl.js";import{property as n,subclass as r}from"../../core/accessorSupport/decorators.js";import{popupFromView as i}from"../../views/popupAdapter.js";import a from"../Widget.js";import{css as o}from"./searchResultRendererCSS.js";import s from"./SearchViewModel.js";import{loadCalciteComponents as c}from"../support/componentsUtils.js";import{globalCss as l}from"../support/globalCss.js";import{messageBundle as u,tsx as d}from"../support/widget.js";let f=class extends a{constructor(e,t){super(e,t),this.messages=null,this.showMoreResultsOpen=!1,this.viewModel=null}loadDependencies(){return c({block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),"list-item-group":()=>import(`@esri/calcite-components/dist/components/calcite-list-item-group`)})}destroy(){this.viewModel=null}render(){return d(`div`,{class:this.classes(o.base,l.widget)},this.viewModel?.selectedResult?.name??``,this._renderMoreResults())}_renderMoreResults(){if(!this.viewModel)return null;let{resultCount:e,results:n}=this.viewModel;return!e||e<2||!n?null:d(`calcite-block`,{class:o.moreResults,
|
|
2
|
+
import{__decorate as e}from"tslib";import{substitute as t}from"../../intl.js";import{property as n,subclass as r}from"../../core/accessorSupport/decorators.js";import{popupFromView as i}from"../../views/popupAdapter.js";import a from"../Widget.js";import{css as o}from"./searchResultRendererCSS.js";import s from"./SearchViewModel.js";import{loadCalciteComponents as c}from"../support/componentsUtils.js";import{globalCss as l}from"../support/globalCss.js";import{messageBundle as u,tsx as d}from"../support/widget.js";let f=class extends a{constructor(e,t){super(e,t),this.messages=null,this.showMoreResultsOpen=!1,this.viewModel=null}loadDependencies(){return c({block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),"list-item-group":()=>import(`@esri/calcite-components/dist/components/calcite-list-item-group`)})}destroy(){this.viewModel=null}render(){return d(`div`,{class:this.classes(o.base,l.widget)},this.viewModel?.selectedResult?.name??``,this._renderMoreResults())}_renderMoreResults(){if(!this.viewModel)return null;let{resultCount:e,results:n}=this.viewModel;return!e||e<2||!n?null:d(`calcite-block`,{class:o.moreResults,expandable:!0,expanded:this.showMoreResultsOpen,heading:t(this.messages.showMoreResults,{count:e-1}),onCalciteBlockClose:()=>this._toggleShowMoreResults(!1),onCalciteBlockOpen:()=>this._toggleShowMoreResults(!0)},n.map(e=>this._renderMoreResultsList(e,n?.length>1)))}_renderListItem(e){return d(`calcite-list-item`,{key:`result-${e.sourceIndex}-${e.key}`,label:e.name,onCalciteListItemSelect:()=>this._selectResult(e)})}_renderMoreResultsList(e,t){let{results:n}=e;if(!(n?.length??0)||!n)return null;let r=this.viewModel?.selectedResult,i=this._getSourceName(e.source,e.sourceIndex),a=n.filter(e=>e!==r).map(e=>this._renderListItem(e));return d(`calcite-list`,{label:i},t?d(`calcite-list-item-group`,{heading:i,key:`group-${e.sourceIndex}`},a):a)}_selectResult(e){this.showMoreResultsOpen=!1,this.viewModel?.select(e)}_toggleShowMoreResults(e){this.showMoreResultsOpen=e;let t=i(this.viewModel?.view);t&&`reposition`in t&&typeof t.reposition==`function`&&t.reposition()}_getSourceName(e,t){return t===s.ALL_INDEX?this.messages.all:e.name}};e([n(),u(`esri/widgets/Search/t9n/Search`)],f.prototype,`messages`,void 0),e([n()],f.prototype,`showMoreResultsOpen`,void 0),e([n({type:s})],f.prototype,`viewModel`,void 0),f=e([r(`esri.widgets.Search.SearchResultRenderer`)],f);const p=f;export{p as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{isSome as n,equals as r}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import{deprecateUnnecessaryViewModel as a}from"../../core/deprecate.js";import"../../core/has.js";import o from"../../core/Logger.js";import{abortMaybe as s,destroyMaybe as c}from"../../core/maybe.js";import{after as l,throwIfAborted as u}from"../../core/promiseUtils.js";import{watch as d,syncAndInitial as f}from"../../core/reactiveUtils.js";import{createScreenPointArray as p,createRenderScreenPointArray as m}from"../../core/screenUtils.js";import{convertTime as h,offsetDateUTC as g}from"../../core/timeUtils.js";import{property as _,subclass as v}from"../../core/accessorSupport/decorators.js";import{create as y}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{g as b}from"../../chunks/boundedPlane.js";import{longitudeToTimezone as x}from"../../views/3d/support/earthUtils.js";import{computeDirectionsOverTime as S}from"../../views/3d/support/sunUtils.js";import C from"./DiscreteOptions.js";import w from"./DurationOptions.js";import{ShadowTooltipViewModel as T}from"./ShadowTooltipViewModel.js";import E from"./ThresholdOptions.js";import{breadthFirstBinaryPartitioning as D}from"../support/traversalUtils.js";const O=[],k=y(),A=[],j=h(1,`hours`,`milliseconds`);let M=class extends t{constructor(e){super(e),this.view=null,this.tooltip=new T({getDuration:e=>this.getDuration(e)}),this.startTimeOfDay=h(10,`hours`,`milliseconds`),this.endTimeOfDay=h(16,`hours`,`milliseconds`),this.visualizationType=`threshold`,this.thresholdOptions=new E({suppressDeprecationWarning:!0}),this.durationOptions=new w({suppressDeprecationWarning:!0}),this.discreteOptions=new C({suppressDeprecationWarning:!0}),this._running=!0,this._stopPreviewingTask=null,this._updatedRecently=!1,this._autoRestoreForcePreviewEnabled=!0,this._utcOffset=null,e?.suppressDeprecationWarning||a(o.getLogger(this),`Shadow Cast`,`arcgis-shadow-cast`,{version:`5.0`}),this.date=new Date}normalizeCtorArgs(e){let{suppressDeprecationWarning:t,...n}=e??{};return n}initialize(){this.addHandles([d(()=>({view:this.view,tooltipEnabled:this._tooltipEnabled}),({view:e,tooltipEnabled:t})=>{this.tooltip.view=e,this.tooltip.enabled=t},f),d(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{s(this._stopPreviewingTask),this._updatedRecently=!0,this._autoRestoreForcePreviewEnabled&&(this._stopPreviewingTask=i(async e=>{await l(500,e),u(e),this._updatedRecently=!1}))},{sync:!0,initial:!0,equals:(e,t)=>F(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),d(()=>({renderer:this.renderer,parameters:this._visualizationParameters}),e=>N(e.renderer,e.parameters),f),d(()=>({renderer:this.renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext}),e=>N(e.renderer,{lightDirections:e.lightDirections,lightDirectionsContext:e.lightDirectionsContext}),f),d(()=>({renderer:this.renderer,parameters:{enabled:this._running}}),e=>N(e.renderer,e.parameters),f),d(()=>({renderer:this.renderer,parameters:{previewing:this._previewing}}),e=>N(e.renderer,e.parameters),{sync:!0,initial:!0,equals:()=>!1})])}destroy(){this.stop(),N(this.renderer,{enabled:!1}),c(this.tooltip),this._stopPreviewingTask=s(this._stopPreviewingTask)}get state(){return this.view!=null&&this.view.ready&&this._referencePosition!=null?`ready`:`disabled`}set date(e){let t=new Date(e);t.setHours(0,0,0,0),this._set(`date`,t)}get utcOffset(){return this._utcOffset??this._utcOffsetAuto}set utcOffset(e){this._utcOffset=e}get testData(){}get _previewing(){let e=this._updatedRecently,t=this._sceneUpdating;return e||t}get _sceneUpdating(){let{view:e}=this;if(e?.allLayerViews==null)return!0;let{stationary:t,navigating:n,interacting:r,graphicsView:i}=e,a=!t||n||r,o=this._shadowLayerViews?.some(e=>e.updating)??!1,s=!i?.suspended&&!!i?.updating;return a||o||s}get _utcOffsetAuto(){let e=this._referencePosition;return e==null?0:x(e[0],!1)}get _dateUTCOffset(){let e=this.date;return e=g(e,-e.getTimezoneOffset(),`minutes`),e=g(e,-this.utcOffset,`hours`),e}get _startDateTimeUTC(){return g(this._dateUTCOffset,this.startTimeOfDay)}get _endDateTimeUTC(){return g(this._dateUTCOffset,this.endTimeOfDay)}get _referencePosition(){return this.view?.environmentManager?.referencePositionGeographic}get _durationInterval(){return this._duration>0?Math.floor(this._duration/254):255}get _interval(){let e=this._durationInterval;switch(this.visualizationType){case`threshold`:case`duration`:return e;case`discrete`:return this.discreteOptions.interval||e}}get _intervalContext(){let{contextEnabled:e,contextOptions:{interval:t}}=this.thresholdOptions;return this.visualizationType===`threshold`&&e?t||this._durationInterval:-1}get _durationSampleCount(){return this._lightDirections.length}get _duration(){return this.endTimeOfDay-this.startTimeOfDay}get _lightDirections(){return this._calculateLightDirections(this._interval)}get _lightDirectionsContext(){return this._calculateLightDirections(this._intervalContext)}_calculateLightDirections(e){let{view:t}=this;if(t==null||e<=0)return O;let n=t.viewingMode===`global`?k:this._referencePosition;if(n==null)return O;let r=S(this._startDateTimeUTC,this._endDateTimeUTC,e,n,t.state.viewingMode,255),i=r.length;A.length=0;let a=D(0,i,A),o=Array(i);for(let e=0;e<i;++e)o[e]=r[a[e]];return o}get _tooltipEnabled(){return this.state===`ready`&&this.visualizationType!==`discrete`&&this._running&&!this._previewing}get _visualizationParameters(){if(!this._running)return null;switch(this.visualizationType){case`threshold`:return this._thresholdVisualizationParameters;case`duration`:return this._durationVisualizationParameters;case`discrete`:return this._discreteVisualizationParameters}}get _thresholdVisualizationParameters(){let{value:e,color:t}=this.thresholdOptions,n=this._duration;return{visualization:2,thresholdColor:t.toUnitRGBA(),threshold:n>0?e/this._duration:0,...this._thresholdDiscreteVisualizationParameters}}get _thresholdDiscreteVisualizationParameters(){let{contextOptions:{color:e},contextEnabled:t}=this.thresholdOptions,n=e.toUnitRGBA(),r=[n[0],n[1],n[2],0];return t?{visualization:3,gradientColorRamp:[[0,r],[1,n]]}:{}}get _durationVisualizationParameters(){let{color:e,mode:t}=this.durationOptions,n=this._duration,r=n>0&&t===`hourly`?j/n:0,i=e.toUnitRGBA(),a=[i[0],i[1],i[2],0];return r===0?{...this._discreteVisualizationParameters,gradientColorRamp:[[0,a],[1,i]]}:{bandedGradientColorRamp:[[0,a],[1,i]],visualization:1,bandSize:r}}get _discreteVisualizationParameters(){let e=this.discreteOptions.color.toUnitRGBA();return{gradientColorRamp:[[0,[e[0],e[1],e[2],0]],[1,e]],visualization:0}}get _shadowLayerViews(){return this.view?.allLayerViews.items.filter(P)}get _previewDependencies(){let{view:e,_shadowLayerViews:t}=this;if(e==null||t==null)return null;let r=e.slice.plane,i=t,a=i.map(e=>e.layer).filter(n),o=i.map(e=>e.suspended),s=a.map(e=>e.visible),c=a.map(e=>e.opacity),l=!!e.graphicsView?.suspended,u=a.filter(e=>`definitionExpression`in e).map(e=>e.definitionExpression),d=i.filter(e=>`filter`in e).map(e=>e.filter);return{slicePlane:r,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:o,graphicsViewSuspended:l,layerVisibilities:s,layerOpacities:c,filters:d,definitionExpressions:u}}get renderer(){let{view:e}=this;if(e==null)return null;let t=e.stage;return t==null?null:t.renderer}start(){this.setRunning(!0)}stop(){this.setRunning(!1)}setRunning(e){this._running=e}async getDuration(e){let{view:t,renderer:n,_durationSampleCount:r}=this;if(t==null||n==null||r===0)return 0;let i=t.state.camera.screenToRender(p(e.x,e.y),m());return n.readAccumulatedShadow(i)*this._duration}};e([_()],M.prototype,`state`,null),e([_()],M.prototype,`view`,void 0),e([_()],M.prototype,`tooltip`,void 0),e([_({type:Date,nonNullable:!0})],M.prototype,`date`,null),e([_({type:Number,nonNullable:!0})],M.prototype,`utcOffset`,null),e([_({type:Number,nonNullable:!0})],M.prototype,`startTimeOfDay`,void 0),e([_({type:Number,nonNullable:!0})],M.prototype,`endTimeOfDay`,void 0),e([_({type:[`threshold`,`duration`,`discrete`],nonNullable:!0})],M.prototype,`visualizationType`,void 0),e([_({type:E,nonNullable:!0})],M.prototype,`thresholdOptions`,void 0),e([_({type:w,nonNullable:!0})],M.prototype,`durationOptions`,void 0),e([_({type:C,nonNullable:!0})],M.prototype,`discreteOptions`,void 0),e([_()],M.prototype,`_running`,void 0),e([_()],M.prototype,`_stopPreviewingTask`,void 0),e([_()],M.prototype,`_updatedRecently`,void 0),e([_()],M.prototype,`_autoRestoreForcePreviewEnabled`,void 0),e([_()],M.prototype,`_sceneUpdating`,null),e([_()],M.prototype,`_utcOffset`,void 0),e([_()],M.prototype,`_utcOffsetAuto`,null),e([_()],M.prototype,`_dateUTCOffset`,null),e([_()],M.prototype,`_startDateTimeUTC`,null),e([_()],M.prototype,`_endDateTimeUTC`,null),e([_()],M.prototype,`_referencePosition`,null),e([_()],M.prototype,`_interval`,null),e([_()],M.prototype,`_intervalContext`,null),e([_()],M.prototype,`_durationSampleCount`,null),e([_()],M.prototype,`_duration`,null),e([_()],M.prototype,`_lightDirections`,null),e([_()],M.prototype,`_lightDirectionsContext`,null),e([_()],M.prototype,`_tooltipEnabled`,null),e([_()],M.prototype,`_visualizationParameters`,null),e([_()],M.prototype,`_thresholdVisualizationParameters`,null),e([_()],M.prototype,`_thresholdDiscreteVisualizationParameters`,null),e([_()],M.prototype,`_durationVisualizationParameters`,null),e([_()],M.prototype,`_discreteVisualizationParameters`,null),e([_()],M.prototype,`_shadowLayerViews`,null),e([_()],M.prototype,`_previewDependencies`,null),e([_()],M.prototype,`renderer`,null),M=e([v(`esri.widgets.ShadowCast.ShadowCastViewModel`)],M);function N(e,t){e!=null&&t!=null&&e.setParameters({shadowCast:t})}function P(e){if(e.suspended)return!1;switch(e.type){case`building-scene-3d`:case`csv-3d`:case`elevation-3d`:case`feature-3d`:case`geojson-3d`:case`integrated-mesh-3d`:case`integrated-mesh-3dtiles`:case`ogc-feature-3d`:case`route-3d`:case`scene-layer-3d`:case`scene-layer-graphics-3d`:case`stream-3d`:case`wms-3d`:case`catalog-footprint-3d`:return!0;case`base-dynamic-3d`:case`catalog-3d`:case`catalog-dynamic-group-3d`:case`dimension-3d`:case`gaussian-splat-3d`:case`imagery-3d`:case`imagery-tile-3d`:case`line-of-sight-3d`:case`map-image-3d`:case`point-cloud-3d`:case`tile-3d`:case`vector-tile-3d`:case`viewshed-3d`:case`voxel-3d`:case`wfs-3d`:case`wmts-3d`:case`media-3d`:return!1;case`group`:return!1;case`graphics-3d`:return e.layer.graphics.some(e=>{let{symbol:t}=e;return t==null||t.type!==`text`&&!(`symbolLayers`in t)||t.type!==`text`&&t.symbolLayers.some(e=>e.type!==`text`)});default:return!1}}function F(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;let n=b(e.slicePlane,t.slicePlane),i=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),a=r(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,o=r(e.layerVisibilities,t.layerVisibilities),s=r(e.layerOpacities,t.layerOpacities),c=r(e.filters,t.filters),l=r(e.definitionExpressions,t.definitionExpressions);return n&&i&&a&&o&&s&&c&&l}const I=M;export{I as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{isSome as n,equals as r}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import{deprecateUnnecessaryViewModel as a}from"../../core/deprecate.js";import"../../core/has.js";import o from"../../core/Logger.js";import{abortMaybe as s,destroyMaybe as c}from"../../core/maybe.js";import{after as l,throwIfAborted as u}from"../../core/promiseUtils.js";import{watch as d,syncAndInitial as f}from"../../core/reactiveUtils.js";import{createScreenPointArray as p,createRenderScreenPointArray as m}from"../../core/screenUtils.js";import{convertTime as h,offsetDateUTC as g}from"../../core/timeUtils.js";import{property as _,subclass as v}from"../../core/accessorSupport/decorators.js";import{create as y}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{g as b}from"../../chunks/boundedPlane.js";import{longitudeToTimezone as x}from"../../views/3d/support/earthUtils.js";import{computeDirectionsOverTime as S}from"../../views/3d/support/sunUtils.js";import C from"./DiscreteOptions.js";import w from"./DurationOptions.js";import{ShadowTooltipViewModel as T}from"./ShadowTooltipViewModel.js";import E from"./ThresholdOptions.js";import{breadthFirstBinaryPartitioning as D}from"../support/traversalUtils.js";const O=[],k=y(),A=[],j=h(1,`hours`,`milliseconds`);let M=class extends t{constructor(e){super(e),this.view=null,this.tooltip=new T({getDuration:e=>this.getDuration(e)}),this.startTimeOfDay=h(10,`hours`,`milliseconds`),this.endTimeOfDay=h(16,`hours`,`milliseconds`),this.visualizationType=`threshold`,this.thresholdOptions=new E({suppressDeprecationWarning:!0}),this.durationOptions=new w({suppressDeprecationWarning:!0}),this.discreteOptions=new C({suppressDeprecationWarning:!0}),this._running=!0,this._stopPreviewingTask=null,this._updatedRecently=!1,this._autoRestoreForcePreviewEnabled=!0,this._utcOffset=null,e?.suppressDeprecationWarning||a(o.getLogger(this),`Shadow Cast`,`arcgis-shadow-cast`,{version:`5.0`}),this.date=new Date}normalizeCtorArgs(e){let{suppressDeprecationWarning:t,...n}=e??{};return n}initialize(){this.addHandles([d(()=>({view:this.view,tooltipEnabled:this._tooltipEnabled}),({view:e,tooltipEnabled:t})=>{this.tooltip.view=e,this.tooltip.enabled=t},f),d(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{s(this._stopPreviewingTask),this._updatedRecently=!0,this._autoRestoreForcePreviewEnabled&&(this._stopPreviewingTask=i(async e=>{await l(500,e),u(e),this._updatedRecently=!1}))},{sync:!0,initial:!0,equals:(e,t)=>F(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),d(()=>({renderer:this.renderer,parameters:this._visualizationParameters}),e=>N(e.renderer,e.parameters),f),d(()=>({renderer:this.renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext}),e=>N(e.renderer,{lightDirections:e.lightDirections,lightDirectionsContext:e.lightDirectionsContext}),f),d(()=>({renderer:this.renderer,parameters:{enabled:this._running}}),e=>N(e.renderer,e.parameters),f),d(()=>({renderer:this.renderer,parameters:{previewing:this._previewing}}),e=>N(e.renderer,e.parameters),{sync:!0,initial:!0,equals:()=>!1})])}destroy(){this.stop(),N(this.renderer,{enabled:!1}),c(this.tooltip),this._stopPreviewingTask=s(this._stopPreviewingTask)}get state(){return this.view!=null&&this.view.ready&&this._referencePosition!=null?`ready`:`disabled`}set date(e){let t=new Date(e);t.setHours(0,0,0,0),this._set(`date`,t)}get utcOffset(){return this._utcOffset??this._utcOffsetAuto}set utcOffset(e){this._utcOffset=e}get testData(){}get _previewing(){let e=this._updatedRecently,t=this._sceneUpdating;return e||t}get _sceneUpdating(){let{view:e}=this;if(e?.allLayerViews==null)return!0;let{stationary:t,navigating:n,interacting:r,graphicsView:i}=e,a=!t||n||r,o=this._shadowLayerViews?.some(e=>e.updating)??!1,s=!i?.suspended&&!!i?.updating;return a||o||s}get _utcOffsetAuto(){let e=this._referencePosition;return e==null?0:x(e[0],!1)}get _dateUTCOffset(){let e=this.date;return e=g(e,-e.getTimezoneOffset(),`minutes`),e=g(e,-this.utcOffset,`hours`),e}get _startDateTimeUTC(){return g(this._dateUTCOffset,this.startTimeOfDay)}get _endDateTimeUTC(){return g(this._dateUTCOffset,this.endTimeOfDay)}get _referencePosition(){return this.view?.environmentView?.referencePositionGeographic}get _durationInterval(){return this._duration>0?Math.floor(this._duration/254):255}get _interval(){let e=this._durationInterval;switch(this.visualizationType){case`threshold`:case`duration`:return e;case`discrete`:return this.discreteOptions.interval||e}}get _intervalContext(){let{contextEnabled:e,contextOptions:{interval:t}}=this.thresholdOptions;return this.visualizationType===`threshold`&&e?t||this._durationInterval:-1}get _durationSampleCount(){return this._lightDirections.length}get _duration(){return this.endTimeOfDay-this.startTimeOfDay}get _lightDirections(){return this._calculateLightDirections(this._interval)}get _lightDirectionsContext(){return this._calculateLightDirections(this._intervalContext)}_calculateLightDirections(e){let{view:t}=this;if(t==null||e<=0)return O;let n=t.viewingMode===`global`?k:this._referencePosition;if(n==null)return O;let r=S(this._startDateTimeUTC,this._endDateTimeUTC,e,n,t.state.viewingMode,255),i=r.length;A.length=0;let a=D(0,i,A),o=Array(i);for(let e=0;e<i;++e)o[e]=r[a[e]];return o}get _tooltipEnabled(){return this.state===`ready`&&this.visualizationType!==`discrete`&&this._running&&!this._previewing}get _visualizationParameters(){if(!this._running)return null;switch(this.visualizationType){case`threshold`:return this._thresholdVisualizationParameters;case`duration`:return this._durationVisualizationParameters;case`discrete`:return this._discreteVisualizationParameters}}get _thresholdVisualizationParameters(){let{value:e,color:t}=this.thresholdOptions,n=this._duration;return{visualization:2,thresholdColor:t.toUnitRGBA(),threshold:n>0?e/this._duration:0,...this._thresholdDiscreteVisualizationParameters}}get _thresholdDiscreteVisualizationParameters(){let{contextOptions:{color:e},contextEnabled:t}=this.thresholdOptions,n=e.toUnitRGBA(),r=[n[0],n[1],n[2],0];return t?{visualization:3,gradientColorRamp:[[0,r],[1,n]]}:{}}get _durationVisualizationParameters(){let{color:e,mode:t}=this.durationOptions,n=this._duration,r=n>0&&t===`hourly`?j/n:0,i=e.toUnitRGBA(),a=[i[0],i[1],i[2],0];return r===0?{...this._discreteVisualizationParameters,gradientColorRamp:[[0,a],[1,i]]}:{bandedGradientColorRamp:[[0,a],[1,i]],visualization:1,bandSize:r}}get _discreteVisualizationParameters(){let e=this.discreteOptions.color.toUnitRGBA();return{gradientColorRamp:[[0,[e[0],e[1],e[2],0]],[1,e]],visualization:0}}get _shadowLayerViews(){return this.view?.allLayerViews.items.filter(P)}get _previewDependencies(){let{view:e,_shadowLayerViews:t}=this;if(e==null||t==null)return null;let r=e.slice.plane,i=t,a=i.map(e=>e.layer).filter(n),o=i.map(e=>e.suspended),s=a.map(e=>e.visible),c=a.map(e=>e.opacity),l=!!e.graphicsView?.suspended,u=a.filter(e=>`definitionExpression`in e).map(e=>e.definitionExpression),d=i.filter(e=>`filter`in e).map(e=>e.filter);return{slicePlane:r,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:o,graphicsViewSuspended:l,layerVisibilities:s,layerOpacities:c,filters:d,definitionExpressions:u}}get renderer(){let{view:e}=this;if(e==null)return null;let t=e.stage;return t==null?null:t.renderer}start(){this.setRunning(!0)}stop(){this.setRunning(!1)}setRunning(e){this._running=e}async getDuration(e){let{view:t,renderer:n,_durationSampleCount:r}=this;if(t==null||n==null||r===0)return 0;let i=t.state.camera.screenToRender(p(e.x,e.y),m());return n.readAccumulatedShadow(i)*this._duration}};e([_()],M.prototype,`state`,null),e([_()],M.prototype,`view`,void 0),e([_()],M.prototype,`tooltip`,void 0),e([_({type:Date,nonNullable:!0})],M.prototype,`date`,null),e([_({type:Number,nonNullable:!0})],M.prototype,`utcOffset`,null),e([_({type:Number,nonNullable:!0})],M.prototype,`startTimeOfDay`,void 0),e([_({type:Number,nonNullable:!0})],M.prototype,`endTimeOfDay`,void 0),e([_({type:[`threshold`,`duration`,`discrete`],nonNullable:!0})],M.prototype,`visualizationType`,void 0),e([_({type:E,nonNullable:!0})],M.prototype,`thresholdOptions`,void 0),e([_({type:w,nonNullable:!0})],M.prototype,`durationOptions`,void 0),e([_({type:C,nonNullable:!0})],M.prototype,`discreteOptions`,void 0),e([_()],M.prototype,`_running`,void 0),e([_()],M.prototype,`_stopPreviewingTask`,void 0),e([_()],M.prototype,`_updatedRecently`,void 0),e([_()],M.prototype,`_autoRestoreForcePreviewEnabled`,void 0),e([_()],M.prototype,`_sceneUpdating`,null),e([_()],M.prototype,`_utcOffset`,void 0),e([_()],M.prototype,`_utcOffsetAuto`,null),e([_()],M.prototype,`_dateUTCOffset`,null),e([_()],M.prototype,`_startDateTimeUTC`,null),e([_()],M.prototype,`_endDateTimeUTC`,null),e([_()],M.prototype,`_referencePosition`,null),e([_()],M.prototype,`_interval`,null),e([_()],M.prototype,`_intervalContext`,null),e([_()],M.prototype,`_durationSampleCount`,null),e([_()],M.prototype,`_duration`,null),e([_()],M.prototype,`_lightDirections`,null),e([_()],M.prototype,`_lightDirectionsContext`,null),e([_()],M.prototype,`_tooltipEnabled`,null),e([_()],M.prototype,`_visualizationParameters`,null),e([_()],M.prototype,`_thresholdVisualizationParameters`,null),e([_()],M.prototype,`_thresholdDiscreteVisualizationParameters`,null),e([_()],M.prototype,`_durationVisualizationParameters`,null),e([_()],M.prototype,`_discreteVisualizationParameters`,null),e([_()],M.prototype,`_shadowLayerViews`,null),e([_()],M.prototype,`_previewDependencies`,null),e([_()],M.prototype,`renderer`,null),M=e([v(`esri.widgets.ShadowCast.ShadowCastViewModel`)],M);function N(e,t){e!=null&&t!=null&&e.setParameters({shadowCast:t})}function P(e){if(e.suspended)return!1;switch(e.type){case`building-scene-3d`:case`csv-3d`:case`elevation-3d`:case`feature-3d`:case`geojson-3d`:case`integrated-mesh-3d`:case`integrated-mesh-3dtiles`:case`ogc-feature-3d`:case`route-3d`:case`scene-layer-3d`:case`scene-layer-graphics-3d`:case`stream-3d`:case`wms-3d`:case`catalog-footprint-3d`:return!0;case`base-dynamic-3d`:case`catalog-3d`:case`catalog-dynamic-group-3d`:case`dimension-3d`:case`gaussian-splat-3d`:case`imagery-3d`:case`imagery-tile-3d`:case`line-of-sight-3d`:case`map-image-3d`:case`point-cloud-3d`:case`tile-3d`:case`vector-tile-3d`:case`viewshed-3d`:case`voxel-3d`:case`wfs-3d`:case`wmts-3d`:case`media-3d`:return!1;case`group`:return!1;case`graphics-3d`:return e.layer.graphics.some(e=>{let{symbol:t}=e;return t==null||t.type!==`text`&&!(`symbolLayers`in t)||t.type!==`text`&&t.symbolLayers.some(e=>e.type!==`text`)});default:return!1}}function F(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;let n=b(e.slicePlane,t.slicePlane),i=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),a=r(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,o=r(e.layerVisibilities,t.layerVisibilities),s=r(e.layerOpacities,t.layerOpacities),c=r(e.filters,t.filters),l=r(e.definitionExpressions,t.definitionExpressions);return n&&i&&a&&o&&s&&c&&l}const I=M;export{I as default};
|
|
@@ -1125,7 +1125,7 @@ export default class SketchViewModel extends EventedAccessor {
|
|
|
1125
1125
|
* // get the graphic as it is being updated
|
|
1126
1126
|
* const graphic = event.graphics[0];
|
|
1127
1127
|
* // check if the graphic is intersecting school buffers
|
|
1128
|
-
* intersects =
|
|
1128
|
+
* intersects = intersectsExecute(buffers, graphic.geometry);
|
|
1129
1129
|
*
|
|
1130
1130
|
* // change the graphic symbol to valid or invalid symbol
|
|
1131
1131
|
* // depending the graphic location
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import a from"../../../Widget.js";import o from"./MeasuredContentGroup.js";import s from"./OverflowGroup.js";import c from"./ResponsiveToolbarManager.js";import{SplitButton as l}from"./SplitButton.js";import{loadCalciteComponents as u}from"../../../support/componentsUtils.js";import{tsx as d}from"../../../support/widget.js";const f=`esri-responsive-toolbar`,p={rulerBase:`${f}__ruler`,rulerBarHorizontal:`${f}__ruler--bar`,rulerBarVertical:`${f}__ruler--bar--vertical`,rulerPadVertical:`${f}__ruler--pad--vertical`,rulerPadHorizontal:`${f}__ruler--pad--horizontal`,bar:`${f}__bar`,barHorizontal:`${f}__bar--horizontal`,barVertical:`${f}__bar--vertical`,pad:`${f}__pad`,padVertical:`${f}__pad--vertical`,padHorizontal:`${f}__pad--horizontal`};let m=class extends a{constructor(e){super(e),this.scale=`m`,this.barStyle=`floating`,this._measurementManager=new c,this._managedWidgets=new Map}loadDependencies(){return u({"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`)})}destroy(){this._measurementManager=n(this._measurementManager),this._managedWidgets.forEach(e=>e.destroy()),this._managedWidgets.clear()}set layout(e){let t=this._get(`layout`);this._set(`layout`,e),this._measurementManager&&(this._measurementManager.layout=e),t!==e&&this.scheduleRender()}get _barClasses(){let e=this.barStyle===`docked`,t=this.layout===`vertical`;return{[p.barHorizontal]:e&&!t,[p.barVertical]:e&&t,[p.bar]:e,[p.padHorizontal]:!e&&!t,[p.padVertical]:!e&&t,[p.pad]:!e}}render(){let{layout:e,scale:t,barStyle:n}=this,r={layout:e,scale:t,expandDisabled:!0,key:`measured-toolbar`},i=n===`docked`?e===`vertical`?p.rulerBarVertical:p.rulerBarHorizontal:e===`horizontal`?p.rulerPadHorizontal:p.rulerPadVertical,a=this._renderChildren();return a.length?d(`div`,{key:`toolbar-wrapper`},d(`div`,{afterCreate:e=>{this._measurementManager?.connect(e)},class:this.classes(p.rulerBase,i),key:`ruler-element`}),d(`calcite-action-bar`,{...r,classes:this._barClasses,floating:n!==`docked`,
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import a from"../../../Widget.js";import o from"./MeasuredContentGroup.js";import s from"./OverflowGroup.js";import c from"./ResponsiveToolbarManager.js";import{SplitButton as l}from"./SplitButton.js";import{loadCalciteComponents as u}from"../../../support/componentsUtils.js";import{tsx as d}from"../../../support/widget.js";const f=`esri-responsive-toolbar`,p={rulerBase:`${f}__ruler`,rulerBarHorizontal:`${f}__ruler--bar`,rulerBarVertical:`${f}__ruler--bar--vertical`,rulerPadVertical:`${f}__ruler--pad--vertical`,rulerPadHorizontal:`${f}__ruler--pad--horizontal`,bar:`${f}__bar`,barHorizontal:`${f}__bar--horizontal`,barVertical:`${f}__bar--vertical`,pad:`${f}__pad`,padVertical:`${f}__pad--vertical`,padHorizontal:`${f}__pad--horizontal`};let m=class extends a{constructor(e){super(e),this.scale=`m`,this.barStyle=`floating`,this._measurementManager=new c,this._managedWidgets=new Map}loadDependencies(){return u({"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`)})}destroy(){this._measurementManager=n(this._measurementManager),this._managedWidgets.forEach(e=>e.destroy()),this._managedWidgets.clear()}set layout(e){let t=this._get(`layout`);this._set(`layout`,e),this._measurementManager&&(this._measurementManager.layout=e),t!==e&&this.scheduleRender()}get _barClasses(){let e=this.barStyle===`docked`,t=this.layout===`vertical`;return{[p.barHorizontal]:e&&!t,[p.barVertical]:e&&t,[p.bar]:e,[p.padHorizontal]:!e&&!t,[p.padVertical]:!e&&t,[p.pad]:!e}}render(){let{layout:e,scale:t,barStyle:n}=this,r={layout:e,scale:t,expandDisabled:!0,key:`measured-toolbar`},i=n===`docked`?e===`vertical`?p.rulerBarVertical:p.rulerBarHorizontal:e===`horizontal`?p.rulerPadHorizontal:p.rulerPadVertical,a=this._renderChildren();return a.length?d(`div`,{key:`toolbar-wrapper`},d(`div`,{afterCreate:e=>{this._measurementManager?.connect(e)},class:this.classes(p.rulerBase,i),key:`ruler-element`}),d(`calcite-action-bar`,{...r,classes:this._barClasses,floating:n!==`docked`,overflowMode:`none`},a)):null}_renderChildren(){if(!this.children)return[];let e=new Set,n=[];for(let t of this.children){if(!t.properties?.key||!(`group-kind`in t.properties)||!t.children?.length)continue;let r=t.properties,i=r.key;e.add(i);let a=this.barStyle===`docked`?r.slot??void 0:void 0,c=r.priority??0,u=r[`group-kind`]??`overflow-group`,d=r[`allow-collapse`]??!0,f=u===`measured-content-group`,p=this._managedWidgets.get(i);if(p)p.children=t.children,p.priority=c,`allowCollapse`in p&&(p.allowCollapse=d),p.slot=a,p.layout=this.layout,p.scale=this.scale,p.measurementManager=this._measurementManager,p instanceof o&&(p.useActionGroup=f),n.push(p);else{let e={scale:this.scale,priority:c,measurementManager:this._measurementManager,children:t.children,slot:a,layout:this.layout};switch(u){case`split-button`:{let t=new l({...e,allowCollapse:d});this._managedWidgets.set(i,t),n.push(t);break}case`overflow-group`:{let t=new s({...e,allowCollapse:d});this._managedWidgets.set(i,t),n.push(t);break}case`measured-content`:{let t=new o({...e});this._managedWidgets.set(i,t),n.push(t);break}case`measured-content-group`:{let t=new o({...e,useActionGroup:!0});this._managedWidgets.set(i,t),n.push(t);break}}}}for(let[t]of this._managedWidgets.entries())e.has(t)||(this._managedWidgets.get(t)?.destroy(),this._managedWidgets.delete(t));return this._measurementManager?.allocate(),n.map(e=>e.render()).filter(t)}};e([r()],m.prototype,`scale`,void 0),e([r({value:`horizontal`})],m.prototype,`layout`,null),e([r()],m.prototype,`barStyle`,void 0),e([r()],m.prototype,`_measurementManager`,void 0),e([r()],m.prototype,`_managedWidgets`,void 0),e([r()],m.prototype,`_barClasses`,null),m=e([i(`esri.widgets.Sketch.support.ResponsiveToolbar.ResponsiveToolbar`)],m);export{m as default};
|
package/widgets/Sketch.d.ts
CHANGED
|
@@ -836,7 +836,7 @@ export default class Sketch extends Widget<SketchProperties> {
|
|
|
836
836
|
* // get the graphic as it is being updated
|
|
837
837
|
* const graphic = event.graphics[0];
|
|
838
838
|
* // check if the graphic is intersecting school buffers
|
|
839
|
-
* intersects =
|
|
839
|
+
* intersects = intersectsExecute(buffers, graphic.geometry);
|
|
840
840
|
*
|
|
841
841
|
* // change the graphic symbol to valid or invalid symbol
|
|
842
842
|
* // depending the graphic location
|
|
@@ -91,7 +91,7 @@ export default class TrackViewModel extends GeolocationPositioning {
|
|
|
91
91
|
* const geofenceExtent = new Extent({
|
|
92
92
|
* // whatever
|
|
93
93
|
* });
|
|
94
|
-
* return
|
|
94
|
+
* return withinExecute(myLocation, geofenceExtent);
|
|
95
95
|
* };
|
|
96
96
|
*/
|
|
97
97
|
accessor positionFilterFunction: PositionFilterFunction | null | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import n from"../core/Logger.js";import{watch as r,initial as i,on as a}from"../core/reactiveUtils.js";import{property as o,subclass as s}from"../core/accessorSupport/decorators.js";import c from"../symbols/SimpleLineSymbol.js";import l from"./Widget.js";import{loadCalciteComponents as u}from"./support/componentsUtils.js";import{messageBundle as d,tsx as f}from"./support/widget.js";import p from"./UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js";import m from"./UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js";import h from"./UtilityNetworkAssociations/VisibleElements.js";const g=`esri-un-associations`,_={action:`${g}__action`,blockContent:`${g}__block-content`,blockSectionSettings:`${g}__block-section-settings`,combobox:`${g}__combobox`,comboboxItem:`${g}__combobox-item`,divControlsMain:`${g}__div-controls-main`,label:`${g}__label`,labelAndCombobox:`${g}__label-and-combobox`,labelAndSlider:`${g}__label-and-slider`,labelAndToggle:`${g}__label-and-toggle`,panel:`${g}__panel`,slider:`${g}__slider`,statusIconWarning:`${g}__status-icon-warning`,switch:`${g}__switch`,widgetContainer:`${g}__widget-container`};let v=class extends l{constructor(e,r){super(e,r),this._autoRefreshAssociations=!0,this._associationsOptionsEnabled=!1,this._maxAllowableAssociationsSliderMax=1e3,this._maxAllowableAssociationsSliderMin=250,this._maxAllowableAssociationsSliderStep=250,this.messages=null,this.messagesCommon=null,this.viewModel=new m,this.visibleElements=new h,this.announceDeprecation=()=>{t(n.getLogger(this),`Utility Network Associations`,`arcgis-utility-network-associations`,{version:`5.0`})}}initialize(){this.addHandles([r(()=>[this.view?.stationary,this.showAssociationsEnabled,this.includeConnectivityAssociations,this.includeStructuralAttachmentAssociations,this.maxAllowableAssociations],()=>{this.autoRefreshAssociations===!0&&(this.showAssociationsEnabled===!0?this.viewModel.showAssociations():this.viewModel.removeAssociations())}),r(()=>this.view?.map?.utilityNetworks,e=>{e?.items.forEach(async(e,t)=>{e.loaded||await e.load(),t===0&&(this.utilityNetwork=e)})},i),a(()=>this.view?.map?.utilityNetworks,`change`,e=>{let t=e.target;e.added.forEach(async e=>{e.loaded||await e.load()}),e.removed.some(e=>e.layerUrl===this.utilityNetwork?.layerUrl)&&(this.utilityNetwork=null),this.utilityNetwork=t.length?t.getItemAt(0):null})])}get autoRefreshAssociations(){return this._autoRefreshAssociations}set autoRefreshAssociations(e){this._autoRefreshAssociations=e}get connectivityAssociationsLineSymbol(){return this.viewModel.connectivityAssociationsLineSymbol}set connectivityAssociationsLineSymbol(e){this.viewModel.connectivityAssociationsLineSymbol=e}get icon(){return`view-associations`}set icon(e){this._overrideIfSome(`icon`,e)}get includeConnectivityAssociations(){return this.viewModel.includeConnectivityAssociations}set includeConnectivityAssociations(e){this.viewModel.includeConnectivityAssociations=e}get includeStructuralAttachmentAssociations(){return this.viewModel.includeStructuralAttachmentAssociations}set includeStructuralAttachmentAssociations(e){this.viewModel.includeStructuralAttachmentAssociations=e}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get maxAllowableAssociations(){return this.viewModel.maxAllowableAssociations}set maxAllowableAssociations(e){this.viewModel.maxAllowableAssociations=e}get maxAllowableAssociationsSliderMax(){return this._maxAllowableAssociationsSliderMax}set maxAllowableAssociationsSliderMax(e){e<=this.maxAllowableAssociationsSliderMin||(this._maxAllowableAssociationsSliderMax=e)}get maxAllowableAssociationsSliderMin(){return this._maxAllowableAssociationsSliderMin}set maxAllowableAssociationsSliderMin(e){e<0||e>=this.maxAllowableAssociationsSliderMax||(this._maxAllowableAssociationsSliderMin=e)}get maxAllowableAssociationsSliderStep(){return this._maxAllowableAssociationsSliderStep}set maxAllowableAssociationsSliderStep(e){this._maxAllowableAssociationsSliderStep=e}get showArrowsConnectivity(){return this.viewModel.showArrowsConnectivity}set showArrowsConnectivity(e){this.viewModel.showArrowsConnectivity=e}get showArrowsStructuralAttachment(){return this.viewModel.showArrowsStructuralAttachment}set showArrowsStructuralAttachment(e){this.viewModel.showArrowsStructuralAttachment=e}get showAssociationsEnabled(){return this.viewModel.showAssociationsEnabled}set showAssociationsEnabled(e){this.viewModel.showAssociationsEnabled=e}get structuralAttachmentAssociationsLineSymbol(){return this.viewModel.structuralAttachmentAssociationsLineSymbol}set structuralAttachmentAssociationsLineSymbol(e){this.viewModel.structuralAttachmentAssociationsLineSymbol=e}get utilityNetwork(){return this.viewModel.utilityNetwork}set utilityNetwork(e){this.viewModel.utilityNetwork=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){let{label:e}=this;return f(`div`,{class:_.widgetContainer},f(`calcite-block`,{class:_.blockContent,collapsible:!0,heading:e},this._renderStatusIcon(),this.autoRefreshAssociations?this._renderShowAssociationsSwitch():this._renderRefreshAssociationsAction(),this._renderContent()),this._renderWarningIconTooltip(),this._renderStatusIconTooltip(),this._renderShowAssociationsTooltip(),this._renderRefreshAssociationsActionTooltip())}loadDependencies(){return u({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),"block-section":()=>import(`@esri/calcite-components/dist/components/calcite-block-section`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`),slider:()=>import(`@esri/calcite-components/dist/components/calcite-slider`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),tooltip:()=>import(`@esri/calcite-components/dist/components/calcite-tooltip`)})}_connectivityAssociationsSwitchChange(e){this.includeConnectivityAssociations=e.currentTarget.checked}_getLoadErrorMessagesAsNotices(e,t){return f(`calcite-notice`,{closable:!1,key:`error-notice-${t}`,kind:`warning`,open:!0,scale:`s`},f(`div`,{slot:`message`},e))}_maxAllowableAssociationsSliderChange(e){this.maxAllowableAssociations=Number(e.currentTarget.value)}_refreshAssociations(){let{viewModel:e,viewModel:{state:t}}=this;(t===`ready`||t===`warning`)&&e.showAssociations()}_renderConnectivityAssociationsSettings(){let{messages:{input:{enableConnectivity:e}},visibleElements:{connectivityAssociationsSettings:t}}=this;if(t)return f(`calcite-block-section`,{class:_.blockSectionSettings,text:e},f(p,{id:`${this.id}-symbol-picker-connectivity`,lineSymbol:this.connectivityAssociationsLineSymbol,showArrows:this.showArrowsConnectivity,visibleElements:t}))}_renderConnectivityAssociationsToggle(){let{messages:{input:{enableConnectivity:e}}}=this;return f(`div`,{class:_.labelAndToggle,key:`connectivityAssociationsToggleDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-switch`,{bind:this,checked:this.includeConnectivityAssociations,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,onCalciteSwitchChange:this._connectivityAssociationsSwitchChange}))}_renderComboboxItem({heading:e,value:t,selected:n}){return f(`calcite-combobox-item`,{class:_.comboboxItem,heading:e,selected:n,value:t})}_renderContent(){let{viewModel:{loadErrors:e,state:t}}=this;return t===`disabled`?f(`div`,{class:_.divControlsMain,key:`loadErrorsDiv`},e.items.map(this._getLoadErrorMessagesAsNotices)):f(`calcite-panel`,{class:_.panel,disabled:t===`loading`},f(`div`,{class:_.divControlsMain},this._renderConnectivityAssociationsToggle(),this._renderStructuralAttachmentAssociationsToggle(),this._renderSettingsPane()))}_renderLoadingIcon(){let{messagesCommon:{executing:e,loading:t},viewModel:{state:n}}=this,r=`${this.id}-status-action`;return f(`calcite-action`,{class:_.statusIconWarning,icon:`spinner`,id:r,loading:!0,scale:`s`,slot:`actions-end`,text:n===`executing`?e:t})}_renderMaxAllowableAssociationsSlider(){let{messages:{input:{maxAllowableAssociations:e}},visibleElements:{maxAllowableAssociationsSlider:t}}=this;if(t)return f(`div`,{class:_.labelAndSlider,key:`maxAllowableAssociationsSliderDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-slider`,{bind:this,class:_.slider,labelTicks:!0,max:this.maxAllowableAssociationsSliderMax,min:this.maxAllowableAssociationsSliderMin,scale:`s`,snap:!0,step:this.maxAllowableAssociationsSliderStep,ticks:this.maxAllowableAssociationsSliderStep,value:this.maxAllowableAssociations,onCalciteSliderChange:this._maxAllowableAssociationsSliderChange}))}_renderRefreshAssociationsAction(){let{messages:{input:{refreshAssociations:e}},viewModel:{state:t}}=this,n=`${this.id}-refresh-action`;return f(`calcite-action`,{bind:this,class:_.action,disabled:t===`disabled`,icon:`refresh-f`,id:n,loading:t===`loading`,slot:`actions-end`,text:e,onclick:this._refreshAssociations})}_renderRefreshAssociationsActionTooltip(){let{messages:{input:{refreshAssociations:e}}}=this,t=`${this.id}-refresh-action`;return f(`calcite-tooltip`,{overlayPositioning:`fixed`,referenceElement:t,topLayerDisabled:this.topLayerDisabled},e)}_renderSettingsPane(){let{messagesCommon:{settings:e},visibleElements:{maxAllowableAssociationsSlider:t,connectivityAssociationsSettings:n,structuralAttachmentAssociationsSettings:r}}=this;if((this.view?.map).utilityNetworks?.items?.length!==1||t||n||r)return f(`calcite-block`,{class:_.blockContent,collapsible:!0,heading:e},f(`div`,{class:_.divControlsMain},this._renderUtilityNetworkSettings(),this._renderMaxAllowableAssociationsSlider()),this._renderConnectivityAssociationsSettings(),this._renderStructuralAttachmentAssociationsSettings())}_renderShowAssociationsSwitch(){let{viewModel:{state:e}}=this,t=`${this.id}-show-associations-switch`;return f(`calcite-switch`,{bind:this,checked:this.showAssociationsEnabled,class:_.switch,disabled:e===`disabled`,id:t,slot:`actions-end`,onCalciteSwitchChange:this._showAssociationsSwitchChange})}_renderShowAssociationsTooltip(){let{messages:{input:{enableAssociations:e}}}=this,t=`${this.id}-show-associations-switch`;return f(`calcite-tooltip`,{referenceElement:t,topLayerDisabled:this.topLayerDisabled},e)}_renderStatusIcon(){let{viewModel:{state:e}}=this;switch(e){case`disabled`:case`warning`:return this._renderWarningIcon();case`loading`:case`executing`:return this._renderLoadingIcon();default:return}}_renderStatusIconTooltip(){let{messagesCommon:{executing:e,loading:t},viewModel:{state:n}}=this,r=`${this.id}-status-action`;return f(`calcite-tooltip`,{overlayPositioning:`fixed`,referenceElement:r,topLayerDisabled:this.topLayerDisabled},n===`executing`?e:t)}_renderStructuralAttachmentAssociationsSettings(){let{messages:{input:{enableStructuralAttachment:e}},visibleElements:{structuralAttachmentAssociationsSettings:t}}=this;if(t)return f(`calcite-block-section`,{class:_.blockSectionSettings,text:e},f(p,{id:`${this.id}-symbol-picker-structural-attachment`,lineSymbol:this.structuralAttachmentAssociationsLineSymbol,showArrows:this.showArrowsStructuralAttachment,visibleElements:t}))}_renderStructuralAttachmentAssociationsToggle(){let{messages:{input:{enableStructuralAttachment:e}}}=this;return f(`div`,{class:_.labelAndToggle,key:`structuralAttachmentAssociationsToggleDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-switch`,{bind:this,checked:this.includeStructuralAttachmentAssociations,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,onCalciteSwitchChange:this._structuralAttAssociationsSwitchChange}))}_renderUtilityNetworkSettings(){let{messages:{input:{utilityNetwork:e}}}=this,t=(this.view?.map).utilityNetworks?.items;if(t?.length===1)return null;let n=t?.map(e=>{let t=e.title,n=e.layerUrl,r=e.layerUrl===this.utilityNetwork?.layerUrl;return this._renderComboboxItem({heading:t,value:n,selected:r})});return f(`div`,{class:_.labelAndCombobox,key:`utilityNetworkComboboxDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-combobox`,{class:_.combobox,clearDisabled:!0,label:``,maxItems:3,overlayPositioning:`fixed`,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:e=>{let n=t?.find(t=>t.layerUrl===e.currentTarget.value);this.utilityNetwork=n}},n))}_showAssociationsSwitchChange({currentTarget:e}){let{viewModel:t}=this;this.showAssociationsEnabled=e.checked,this._associationsOptionsEnabled=e.checked,this.showAssociationsEnabled||t.removeAssociations()}_structuralAttAssociationsSwitchChange(e){this.includeStructuralAttachmentAssociations=e.currentTarget.checked}_renderWarningIcon(){let e=`${this.id}-warning-action`;return f(`calcite-icon`,{class:_.statusIconWarning,icon:`exclamation-mark-triangle`,id:e,scale:`s`,slot:`actions-end`})}_renderWarningIconTooltip(){let{viewModel:{executionError:e,state:t}}=this,n=`${this.id}-warning-action`;switch(t){case`warning`:return f(`calcite-tooltip`,{referenceElement:n,topLayerDisabled:this.topLayerDisabled},e);default:return}}};e([o()],v.prototype,`autoRefreshAssociations`,null),e([o({type:c})],v.prototype,`connectivityAssociationsLineSymbol`,null),e([o()],v.prototype,`icon`,null),e([o()],v.prototype,`includeConnectivityAssociations`,null),e([o()],v.prototype,`includeStructuralAttachmentAssociations`,null),e([o()],v.prototype,`label`,null),e([o()],v.prototype,`maxAllowableAssociations`,null),e([o()],v.prototype,`maxAllowableAssociationsSliderMax`,null),e([o()],v.prototype,`maxAllowableAssociationsSliderMin`,null),e([o()],v.prototype,`maxAllowableAssociationsSliderStep`,null),e([o(),d(`esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations`)],v.prototype,`messages`,void 0),e([o(),d(`esri/t9n/common`)],v.prototype,`messagesCommon`,void 0),e([o()],v.prototype,`showArrowsConnectivity`,null),e([o()],v.prototype,`showArrowsStructuralAttachment`,null),e([o()],v.prototype,`showAssociationsEnabled`,null),e([o({type:c})],v.prototype,`structuralAttachmentAssociationsLineSymbol`,null),e([o()],v.prototype,`utilityNetwork`,null),e([o()],v.prototype,`view`,null),e([o({type:m})],v.prototype,`viewModel`,void 0),e([o({type:h,nonNullable:!0})],v.prototype,`visibleElements`,void 0),v=e([s(`esri.widgets.UtilityNetworkAssociations`)],v);const y=v;export{y as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import n from"../core/Logger.js";import{watch as r,initial as i,on as a}from"../core/reactiveUtils.js";import{property as o,subclass as s}from"../core/accessorSupport/decorators.js";import c from"../symbols/SimpleLineSymbol.js";import l from"./Widget.js";import{loadCalciteComponents as u}from"./support/componentsUtils.js";import{messageBundle as d,tsx as f}from"./support/widget.js";import p from"./UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js";import m from"./UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js";import h from"./UtilityNetworkAssociations/VisibleElements.js";const g=`esri-un-associations`,_={action:`${g}__action`,blockContent:`${g}__block-content`,blockSectionSettings:`${g}__block-section-settings`,combobox:`${g}__combobox`,comboboxItem:`${g}__combobox-item`,divControlsMain:`${g}__div-controls-main`,label:`${g}__label`,labelAndCombobox:`${g}__label-and-combobox`,labelAndSlider:`${g}__label-and-slider`,labelAndToggle:`${g}__label-and-toggle`,panel:`${g}__panel`,slider:`${g}__slider`,statusIconWarning:`${g}__status-icon-warning`,switch:`${g}__switch`,widgetContainer:`${g}__widget-container`};let v=class extends l{constructor(e,r){super(e,r),this._autoRefreshAssociations=!0,this._associationsOptionsEnabled=!1,this._maxAllowableAssociationsSliderMax=1e3,this._maxAllowableAssociationsSliderMin=250,this._maxAllowableAssociationsSliderStep=250,this.messages=null,this.messagesCommon=null,this.viewModel=new m,this.visibleElements=new h,this.announceDeprecation=()=>{t(n.getLogger(this),`Utility Network Associations`,`arcgis-utility-network-associations`,{version:`5.0`})}}initialize(){this.addHandles([r(()=>[this.view?.stationary,this.showAssociationsEnabled,this.includeConnectivityAssociations,this.includeStructuralAttachmentAssociations,this.maxAllowableAssociations],()=>{this.autoRefreshAssociations===!0&&(this.showAssociationsEnabled===!0?this.viewModel.showAssociations():this.viewModel.removeAssociations())}),r(()=>this.view?.map?.utilityNetworks,e=>{e?.items.forEach(async(e,t)=>{e.loaded||await e.load(),t===0&&(this.utilityNetwork=e)})},i),a(()=>this.view?.map?.utilityNetworks,`change`,e=>{let t=e.target;e.added.forEach(async e=>{e.loaded||await e.load()}),e.removed.some(e=>e.layerUrl===this.utilityNetwork?.layerUrl)&&(this.utilityNetwork=null),this.utilityNetwork=t.length?t.getItemAt(0):null})])}get autoRefreshAssociations(){return this._autoRefreshAssociations}set autoRefreshAssociations(e){this._autoRefreshAssociations=e}get connectivityAssociationsLineSymbol(){return this.viewModel.connectivityAssociationsLineSymbol}set connectivityAssociationsLineSymbol(e){this.viewModel.connectivityAssociationsLineSymbol=e}get icon(){return`view-associations`}set icon(e){this._overrideIfSome(`icon`,e)}get includeConnectivityAssociations(){return this.viewModel.includeConnectivityAssociations}set includeConnectivityAssociations(e){this.viewModel.includeConnectivityAssociations=e}get includeStructuralAttachmentAssociations(){return this.viewModel.includeStructuralAttachmentAssociations}set includeStructuralAttachmentAssociations(e){this.viewModel.includeStructuralAttachmentAssociations=e}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get maxAllowableAssociations(){return this.viewModel.maxAllowableAssociations}set maxAllowableAssociations(e){this.viewModel.maxAllowableAssociations=e}get maxAllowableAssociationsSliderMax(){return this._maxAllowableAssociationsSliderMax}set maxAllowableAssociationsSliderMax(e){e<=this.maxAllowableAssociationsSliderMin||(this._maxAllowableAssociationsSliderMax=e)}get maxAllowableAssociationsSliderMin(){return this._maxAllowableAssociationsSliderMin}set maxAllowableAssociationsSliderMin(e){e<0||e>=this.maxAllowableAssociationsSliderMax||(this._maxAllowableAssociationsSliderMin=e)}get maxAllowableAssociationsSliderStep(){return this._maxAllowableAssociationsSliderStep}set maxAllowableAssociationsSliderStep(e){this._maxAllowableAssociationsSliderStep=e}get showArrowsConnectivity(){return this.viewModel.showArrowsConnectivity}set showArrowsConnectivity(e){this.viewModel.showArrowsConnectivity=e}get showArrowsStructuralAttachment(){return this.viewModel.showArrowsStructuralAttachment}set showArrowsStructuralAttachment(e){this.viewModel.showArrowsStructuralAttachment=e}get showAssociationsEnabled(){return this.viewModel.showAssociationsEnabled}set showAssociationsEnabled(e){this.viewModel.showAssociationsEnabled=e}get structuralAttachmentAssociationsLineSymbol(){return this.viewModel.structuralAttachmentAssociationsLineSymbol}set structuralAttachmentAssociationsLineSymbol(e){this.viewModel.structuralAttachmentAssociationsLineSymbol=e}get utilityNetwork(){return this.viewModel.utilityNetwork}set utilityNetwork(e){this.viewModel.utilityNetwork=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){let{label:e}=this;return f(`div`,{class:_.widgetContainer},f(`calcite-block`,{class:_.blockContent,expandable:!0,heading:e},this._renderStatusIcon(),this.autoRefreshAssociations?this._renderShowAssociationsSwitch():this._renderRefreshAssociationsAction(),this._renderContent()),this._renderWarningIconTooltip(),this._renderStatusIconTooltip(),this._renderShowAssociationsTooltip(),this._renderRefreshAssociationsActionTooltip())}loadDependencies(){return u({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),"block-section":()=>import(`@esri/calcite-components/dist/components/calcite-block-section`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`),slider:()=>import(`@esri/calcite-components/dist/components/calcite-slider`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),tooltip:()=>import(`@esri/calcite-components/dist/components/calcite-tooltip`)})}_connectivityAssociationsSwitchChange(e){this.includeConnectivityAssociations=e.currentTarget.checked}_getLoadErrorMessagesAsNotices(e,t){return f(`calcite-notice`,{closable:!1,key:`error-notice-${t}`,kind:`warning`,open:!0,scale:`s`},f(`div`,{slot:`message`},e))}_maxAllowableAssociationsSliderChange(e){this.maxAllowableAssociations=Number(e.currentTarget.value)}_refreshAssociations(){let{viewModel:e,viewModel:{state:t}}=this;(t===`ready`||t===`warning`)&&e.showAssociations()}_renderConnectivityAssociationsSettings(){let{messages:{input:{enableConnectivity:e}},visibleElements:{connectivityAssociationsSettings:t}}=this;if(t)return f(`calcite-block-section`,{class:_.blockSectionSettings,text:e},f(p,{id:`${this.id}-symbol-picker-connectivity`,lineSymbol:this.connectivityAssociationsLineSymbol,showArrows:this.showArrowsConnectivity,visibleElements:t}))}_renderConnectivityAssociationsToggle(){let{messages:{input:{enableConnectivity:e}}}=this;return f(`div`,{class:_.labelAndToggle,key:`connectivityAssociationsToggleDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-switch`,{bind:this,checked:this.includeConnectivityAssociations,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,onCalciteSwitchChange:this._connectivityAssociationsSwitchChange}))}_renderComboboxItem({heading:e,value:t,selected:n}){return f(`calcite-combobox-item`,{class:_.comboboxItem,heading:e,selected:n,value:t})}_renderContent(){let{viewModel:{loadErrors:e,state:t}}=this;return t===`disabled`?f(`div`,{class:_.divControlsMain,key:`loadErrorsDiv`},e.items.map(this._getLoadErrorMessagesAsNotices)):f(`calcite-panel`,{class:_.panel,disabled:t===`loading`},f(`div`,{class:_.divControlsMain},this._renderConnectivityAssociationsToggle(),this._renderStructuralAttachmentAssociationsToggle(),this._renderSettingsPane()))}_renderLoadingIcon(){let{messagesCommon:{executing:e,loading:t},viewModel:{state:n}}=this,r=`${this.id}-status-action`;return f(`calcite-action`,{class:_.statusIconWarning,icon:`spinner`,id:r,loading:!0,scale:`s`,slot:`actions-end`,text:n===`executing`?e:t})}_renderMaxAllowableAssociationsSlider(){let{messages:{input:{maxAllowableAssociations:e}},visibleElements:{maxAllowableAssociationsSlider:t}}=this;if(t)return f(`div`,{class:_.labelAndSlider,key:`maxAllowableAssociationsSliderDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-slider`,{bind:this,class:_.slider,labelTicks:!0,max:this.maxAllowableAssociationsSliderMax,min:this.maxAllowableAssociationsSliderMin,scale:`s`,snap:!0,step:this.maxAllowableAssociationsSliderStep,ticks:this.maxAllowableAssociationsSliderStep,value:this.maxAllowableAssociations,onCalciteSliderChange:this._maxAllowableAssociationsSliderChange}))}_renderRefreshAssociationsAction(){let{messages:{input:{refreshAssociations:e}},viewModel:{state:t}}=this,n=`${this.id}-refresh-action`;return f(`calcite-action`,{bind:this,class:_.action,disabled:t===`disabled`,icon:`refresh-f`,id:n,loading:t===`loading`,slot:`actions-end`,text:e,onclick:this._refreshAssociations})}_renderRefreshAssociationsActionTooltip(){let{messages:{input:{refreshAssociations:e}}}=this,t=`${this.id}-refresh-action`;return f(`calcite-tooltip`,{overlayPositioning:`fixed`,referenceElement:t,topLayerDisabled:this.topLayerDisabled},e)}_renderSettingsPane(){let{messagesCommon:{settings:e},visibleElements:{maxAllowableAssociationsSlider:t,connectivityAssociationsSettings:n,structuralAttachmentAssociationsSettings:r}}=this;if((this.view?.map).utilityNetworks?.items?.length!==1||t||n||r)return f(`calcite-block`,{class:_.blockContent,expandable:!0,heading:e},f(`div`,{class:_.divControlsMain},this._renderUtilityNetworkSettings(),this._renderMaxAllowableAssociationsSlider()),this._renderConnectivityAssociationsSettings(),this._renderStructuralAttachmentAssociationsSettings())}_renderShowAssociationsSwitch(){let{viewModel:{state:e}}=this,t=`${this.id}-show-associations-switch`;return f(`calcite-switch`,{bind:this,checked:this.showAssociationsEnabled,class:_.switch,disabled:e===`disabled`,id:t,slot:`actions-end`,onCalciteSwitchChange:this._showAssociationsSwitchChange})}_renderShowAssociationsTooltip(){let{messages:{input:{enableAssociations:e}}}=this,t=`${this.id}-show-associations-switch`;return f(`calcite-tooltip`,{referenceElement:t,topLayerDisabled:this.topLayerDisabled},e)}_renderStatusIcon(){let{viewModel:{state:e}}=this;switch(e){case`disabled`:case`warning`:return this._renderWarningIcon();case`loading`:case`executing`:return this._renderLoadingIcon();default:return}}_renderStatusIconTooltip(){let{messagesCommon:{executing:e,loading:t},viewModel:{state:n}}=this,r=`${this.id}-status-action`;return f(`calcite-tooltip`,{overlayPositioning:`fixed`,referenceElement:r,topLayerDisabled:this.topLayerDisabled},n===`executing`?e:t)}_renderStructuralAttachmentAssociationsSettings(){let{messages:{input:{enableStructuralAttachment:e}},visibleElements:{structuralAttachmentAssociationsSettings:t}}=this;if(t)return f(`calcite-block-section`,{class:_.blockSectionSettings,text:e},f(p,{id:`${this.id}-symbol-picker-structural-attachment`,lineSymbol:this.structuralAttachmentAssociationsLineSymbol,showArrows:this.showArrowsStructuralAttachment,visibleElements:t}))}_renderStructuralAttachmentAssociationsToggle(){let{messages:{input:{enableStructuralAttachment:e}}}=this;return f(`div`,{class:_.labelAndToggle,key:`structuralAttachmentAssociationsToggleDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-switch`,{bind:this,checked:this.includeStructuralAttachmentAssociations,disabled:!this._associationsOptionsEnabled&&this.autoRefreshAssociations,onCalciteSwitchChange:this._structuralAttAssociationsSwitchChange}))}_renderUtilityNetworkSettings(){let{messages:{input:{utilityNetwork:e}}}=this,t=(this.view?.map).utilityNetworks?.items;if(t?.length===1)return null;let n=t?.map(e=>{let t=e.title,n=e.layerUrl,r=e.layerUrl===this.utilityNetwork?.layerUrl;return this._renderComboboxItem({heading:t,value:n,selected:r})});return f(`div`,{class:_.labelAndCombobox,key:`utilityNetworkComboboxDiv`},f(`calcite-label`,{class:_.label},e),f(`calcite-combobox`,{class:_.combobox,clearDisabled:!0,label:``,maxItems:3,overlayPositioning:`fixed`,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:e=>{let n=t?.find(t=>t.layerUrl===e.currentTarget.value);this.utilityNetwork=n}},n))}_showAssociationsSwitchChange({currentTarget:e}){let{viewModel:t}=this;this.showAssociationsEnabled=e.checked,this._associationsOptionsEnabled=e.checked,this.showAssociationsEnabled||t.removeAssociations()}_structuralAttAssociationsSwitchChange(e){this.includeStructuralAttachmentAssociations=e.currentTarget.checked}_renderWarningIcon(){let e=`${this.id}-warning-action`;return f(`calcite-icon`,{class:_.statusIconWarning,icon:`exclamation-mark-triangle`,id:e,scale:`s`,slot:`actions-end`})}_renderWarningIconTooltip(){let{viewModel:{executionError:e,state:t}}=this,n=`${this.id}-warning-action`;switch(t){case`warning`:return f(`calcite-tooltip`,{referenceElement:n,topLayerDisabled:this.topLayerDisabled},e);default:return}}};e([o()],v.prototype,`autoRefreshAssociations`,null),e([o({type:c})],v.prototype,`connectivityAssociationsLineSymbol`,null),e([o()],v.prototype,`icon`,null),e([o()],v.prototype,`includeConnectivityAssociations`,null),e([o()],v.prototype,`includeStructuralAttachmentAssociations`,null),e([o()],v.prototype,`label`,null),e([o()],v.prototype,`maxAllowableAssociations`,null),e([o()],v.prototype,`maxAllowableAssociationsSliderMax`,null),e([o()],v.prototype,`maxAllowableAssociationsSliderMin`,null),e([o()],v.prototype,`maxAllowableAssociationsSliderStep`,null),e([o(),d(`esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations`)],v.prototype,`messages`,void 0),e([o(),d(`esri/t9n/common`)],v.prototype,`messagesCommon`,void 0),e([o()],v.prototype,`showArrowsConnectivity`,null),e([o()],v.prototype,`showArrowsStructuralAttachment`,null),e([o()],v.prototype,`showAssociationsEnabled`,null),e([o({type:c})],v.prototype,`structuralAttachmentAssociationsLineSymbol`,null),e([o()],v.prototype,`utilityNetwork`,null),e([o()],v.prototype,`view`,null),e([o({type:m})],v.prototype,`viewModel`,void 0),e([o({type:h,nonNullable:!0})],v.prototype,`visibleElements`,void 0),v=e([s(`esri.widgets.UtilityNetworkAssociations`)],v);const y=v;export{y as default};
|