@arcgis/core 4.28.0-next.20230921 → 4.28.0-next.20230923
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/Graphic.js +1 -1
- package/PopupTemplate.js +1 -1
- package/TimeExtent.js +1 -1
- package/arcade/ArcadeDate.js +1 -1
- package/arcade/Feature.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/actions/Adapted.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/FeatureSetIterator.js +1 -1
- package/arcade/featureset/support/StatsField.js +1 -1
- package/arcade/featureset/support/sqlUtils.js +1 -1
- package/arcade/functions/convertdirection.js +1 -1
- package/arcade/functions/date.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetstats.js +1 -1
- package/arcade/treeAnalysis.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/02156fd04279f4d0fd3f.js +1 -0
- package/assets/esri/core/workers/chunks/07f6175b52366b2c28bd.js +1 -0
- package/assets/esri/core/workers/chunks/098073c3b2849f56dad8.js +1 -0
- package/assets/esri/core/workers/chunks/1186ba1947bd0c32f148.js +1 -0
- package/assets/esri/core/workers/chunks/186445b9fbedd261f684.js +1 -0
- package/assets/esri/core/workers/chunks/{580039dd491854ca325c.js → 21fc02f0d5716c4a7acd.js} +1 -1
- package/assets/esri/core/workers/chunks/{dff1c3c38dda2bd1a9d6.js → 246a954347fe9318190e.js} +1 -1
- package/assets/esri/core/workers/chunks/{c9dfb145f0c1d93e0fbd.js → 250bb6ae6f1992b5b4f9.js} +1 -1
- package/assets/esri/core/workers/chunks/{314c307e30f308a40a28.js → 25b09e9c0511c8e1cf8a.js} +1 -1
- package/assets/esri/core/workers/chunks/2a0b3b52ecd787a613bc.js +1 -0
- package/assets/esri/core/workers/chunks/2bc9b55e655968229ef4.js +1 -0
- package/assets/esri/core/workers/chunks/2f0924e7aa89e689da4a.js +1 -0
- package/assets/esri/core/workers/chunks/3f218d65ec451b2a1027.js +1 -0
- package/assets/esri/core/workers/chunks/425b5733bb88e6efe242.js +1 -0
- package/assets/esri/core/workers/chunks/45d6b942cdccca2ce44a.js +1 -0
- package/assets/esri/core/workers/chunks/4bf1a7e82a68ccee0ee1.js +1 -0
- package/assets/esri/core/workers/chunks/4c110c7f4f940ec58010.js +1 -0
- package/assets/esri/core/workers/chunks/{bde89b2684b6185992ef.js → 4ed77097e69fa3096ce4.js} +1 -1
- package/assets/esri/core/workers/chunks/4fe5bac782a742d5b1c0.js +1 -0
- package/assets/esri/core/workers/chunks/{1cbaba30f55f00f7498b.js → 51324d042f469f3b8914.js} +1 -1
- package/assets/esri/core/workers/chunks/{3f4e9b1663ec521bfe00.js → 542ce10e1872399790b4.js} +1 -1
- package/assets/esri/core/workers/chunks/54d2b7e2ac4ba883bee8.js +1 -0
- package/assets/esri/core/workers/chunks/54ecb6cae310818d1aa2.js +1 -0
- package/assets/esri/core/workers/chunks/57c932e289d89d97da4b.js +1 -0
- package/assets/esri/core/workers/chunks/{6403de6fc067cf8f7436.js → 592c1fb531f2be928e8a.js} +1 -1
- package/assets/esri/core/workers/chunks/59a807220d6f0dd18776.js +1 -0
- package/assets/esri/core/workers/chunks/59dff10d7ad2b1bf469e.js +1 -0
- package/assets/esri/core/workers/chunks/609a475ab395f2ce63e2.js +1 -0
- package/assets/esri/core/workers/chunks/612c485c5aad1548d708.js +1 -0
- package/assets/esri/core/workers/chunks/{2bb69d76a13564e8e455.js → 645ba2d5c10184632d23.js} +1 -1
- package/assets/esri/core/workers/chunks/{332689bf60d246485993.js → 65186e168dd112ac6221.js} +1 -1
- package/assets/esri/core/workers/chunks/6b9248fb2d6aadbce7bb.js +1 -0
- package/assets/esri/core/workers/chunks/709465832d306e02df52.js +1 -0
- package/assets/esri/core/workers/chunks/72c5bd6f7b8541b8d69e.js +1 -0
- package/assets/esri/core/workers/chunks/{bbc0dcd316c5598bc9ad.js → 74368a5213def6c200a2.js} +1 -1
- package/assets/esri/core/workers/chunks/{94188fe381239d48a975.js → 76483c9a8848f3106126.js} +1 -1
- package/assets/esri/core/workers/chunks/7aa58c96798447ce5907.js +1 -0
- package/assets/esri/core/workers/chunks/7d078b8b9997b5300c0a.js +1 -0
- package/assets/esri/core/workers/chunks/7fe641cf1467496e670a.js +1 -0
- package/assets/esri/core/workers/chunks/{df8f62beb36fb9d2ac81.js → 810c8d6ff19976fd1366.js} +1 -1
- package/assets/esri/core/workers/chunks/8458ed96f3e72814cef2.js +1 -0
- package/assets/esri/core/workers/chunks/{243a4eed107d363dfad8.js → 887652bbdb3b71d0a089.js} +1 -1
- package/assets/esri/core/workers/chunks/896bfda379cf620b63ec.js +1 -0
- package/assets/esri/core/workers/chunks/91c9f0d59eaed7a735ce.js +1 -0
- package/assets/esri/core/workers/chunks/{1f7e041140088f8ac489.js → 97073a60f0ea2a397165.js} +1 -1
- package/assets/esri/core/workers/chunks/97658ac749664a07c92d.js +1 -0
- package/assets/esri/core/workers/chunks/{1da74a306aa5b4eacaae.js → 9866bbaeaf885c2dcca9.js} +1 -1
- package/assets/esri/core/workers/chunks/a39ae87298ac674f129d.js +1 -0
- package/assets/esri/core/workers/chunks/a7b3048c19348540e004.js +1 -0
- package/assets/esri/core/workers/chunks/a8ca4b116909e47722f9.js +1 -0
- package/assets/esri/core/workers/chunks/{101f776316a85b708927.js → a99070ec4c06c435b744.js} +1 -1
- package/assets/esri/core/workers/chunks/ab145d13932d87dd7bf9.js +1 -0
- package/assets/esri/core/workers/chunks/{77c15b1c2729c780f75a.js → aeeeb386134b341d7ad2.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ca759f72d3bb29e9ea9.js → af54b233f6d6ad70b4a3.js} +2 -2
- package/assets/esri/core/workers/chunks/b9146daae8457224fd08.js +1 -0
- package/assets/esri/core/workers/chunks/bcdd2e8841abcb4df6da.js +1 -0
- package/assets/esri/core/workers/chunks/be05cc0cdabd5e051045.js +1 -0
- package/assets/esri/core/workers/chunks/c5f5f37bef11c6fbdc40.js +1 -0
- package/assets/esri/core/workers/chunks/d414dba3179bcf75bc6b.js +1 -0
- package/assets/esri/core/workers/chunks/{b449d6bd5851187d419f.js → d6e5408f9fa6b4bcd118.js} +1 -1
- package/assets/esri/core/workers/chunks/d9fb500cbd0f04d219a3.js +1 -0
- package/assets/esri/core/workers/chunks/e0dd6789fb797e9b7206.js +1 -0
- package/assets/esri/core/workers/chunks/{6f271249e042086d5a16.js → e4e49deae8da74f629db.js} +1 -1
- package/assets/esri/core/workers/chunks/e5dcff7a4fa84ba09670.js +1 -0
- package/assets/esri/core/workers/chunks/{f508ccfde6425dabe9ac.js → ee0bf611d191103a7046.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed1fbc1bc8d50453e2f5.js → f793cd41fcd022baeea2.js} +1 -1
- package/assets/esri/core/workers/chunks/fad6a7bb82a0a2df726f.js +1 -0
- package/assets/esri/themes/base/widgets/_FeatureForm.scss +2 -84
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +2 -0
- 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/chunks/arcade.js +1 -1
- package/config.js +1 -1
- package/core/Accessor.js +1 -1
- package/core/accessorSupport/diffUtils.js +1 -1
- package/core/has.js +1 -1
- package/core/number.js +1 -1
- package/core/reactiveUtils.js +1 -1
- package/core/sql/DateOnly.js +1 -1
- package/core/sql/WhereClause.js +1 -1
- package/core/sql.js +1 -1
- package/core/timeUtils.js +1 -1
- package/identity/IdentityForm.js +1 -1
- package/identity/IdentityModal.js +1 -1
- package/interfaces.d.ts +48 -203
- package/layers/LinkChartLayer.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/applyEditsUtils.js +5 -0
- package/layers/graphics/editingSupport.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/EditBusLayer.js +1 -1
- package/layers/orientedImagery/core/CameraOrientationLTP.js +1 -1
- package/layers/orientedImagery/core/ElevationSourceDefinitions.js +5 -0
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/orientedImagery/core/cameraOrientationFactory.js +1 -1
- package/layers/orientedImagery/core/utils.js +5 -0
- package/layers/orientedImagery/transformations/groundToImageUtils.js +1 -1
- package/layers/support/fieldProperties.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/imageryRendererUtils.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +1 -1
- package/networks/Network.js +1 -1
- package/package.json +1 -1
- package/request.js +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/rest/support/DirectionsFeatureSet.js +1 -1
- package/smartMapping/renderers/pieChart.js +1 -1
- package/smartMapping/renderers/relationship.js +1 -1
- package/smartMapping/renderers/support/utils.js +1 -1
- package/smartMapping/statistics/support/ageUtils.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/smartMapping/support/utils.js +1 -1
- package/support/apiKeyUtils.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/support/svgUtils.js +1 -1
- package/time/TimeReference.js +1 -1
- package/time/timeReferenceUtils.js +1 -1
- package/versionManagement/VersionManagementService.js +1 -1
- package/versionManagement/support/EditMomentStack.js +5 -0
- package/versionManagement/support/versionManagementUtils.js +1 -1
- package/views/2d/engine/Container.js +1 -1
- package/views/2d/engine/DisplayObject.js +1 -1
- package/views/2d/engine/ManagedCanvas.js +5 -0
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/webgl/GroupContainer.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/WGLContainer.js +1 -1
- package/views/2d/engine/webgl/WorldExtentClipRenderer.js +1 -1
- package/views/2d/engine/webgl/effects/FeatureEffect.js +1 -1
- package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
- package/views/2d/engine/webgl/effects/HittestEffectVTL.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/layers/GeoRSSLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/WMTSLayerView2D.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
- package/views/2d/layers/graphics/BaseGraphicContainer.js +1 -1
- package/views/2d/layers/graphics/GraphicContainer.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/layers/graphics/HighlightGraphicContainer.js +1 -1
- package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
- package/views/2d/layers/support/DisplayGL.js +1 -1
- package/views/2d/webglDeps.js +1 -1
- package/views/3d/glTF/loader.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveManipulation.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/isSupportedGraphic.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/i3s/featureEditing.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/support/buffer/glUtil.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginInput.js +1 -1
- package/views/3d/webgl-engine/effects/blit/Blit.js +5 -0
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/RenderSlot.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureFactory.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgeProcessing.js +1 -1
- package/views/View.js +1 -1
- package/views/interactive/tooltip/TooltipContentWithHelpMessage.js +1 -1
- package/views/interactive/tooltip/TooltipEditableField.js +1 -1
- package/views/interactive/tooltip/constraintUtils.js +1 -1
- package/views/interactive/tooltip/content/Fields.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawCircle.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawMesh.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawRectangle.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentScale.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentReshapeEdgeOffset.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformAbsolute.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformScale.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateGraphic.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateGraphicXY.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateGraphicZ.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertexXY.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertexZ.js +1 -1
- package/views/support/angularMeasurementUtils.js +1 -1
- package/views/ui/UI.js +1 -1
- package/views/webgl/ShaderTranspiler.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/contextUtils.js +1 -1
- package/webmap/InitialViewProperties.js +1 -1
- package/widgets/AreaMeasurement2D.js +1 -1
- package/widgets/AreaMeasurement3D.js +1 -1
- package/widgets/Attachments/AttachmentsViewModel.js +1 -1
- package/widgets/Attachments.js +1 -1
- package/widgets/Attribution.js +1 -1
- package/widgets/BasemapGallery.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BasemapToggle.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
- package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
- package/widgets/BuildingExplorer.js +1 -1
- package/widgets/Compass.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
- package/widgets/Daylight.js +1 -1
- package/widgets/DirectLineMeasurement3D.js +1 -1
- package/widgets/DirectionalPad.js +1 -1
- package/widgets/Directions/components/SaveLayer.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/DistanceMeasurement2D.js +1 -1
- package/widgets/Editor/components/FooterActions.js +1 -1
- package/widgets/Editor/components/Notices.js +1 -1
- package/widgets/Editor/components/PanelContent.js +1 -1
- package/widgets/Editor/components/PanelToolbar.js +1 -1
- package/widgets/Editor/components/Prompt.js +1 -1
- package/widgets/Editor/components/Settings.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor/components/UploadDetails.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile/components/LegendItem.js +1 -1
- package/widgets/ElevationProfile/components/SettingsButton.js +1 -1
- package/widgets/ElevationProfile/components/Statistics.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Feature/FeatureContent.js +1 -1
- package/widgets/Feature/FeatureExpression.js +1 -1
- package/widgets/Feature/FeatureFields.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/Feature/FeatureRelationship.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Feature/support/FeatureContentMixin.js +1 -1
- package/widgets/Feature/support/FeatureElementInfo.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/GroupInput.js +1 -1
- package/widgets/FeatureForm/css.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/FeatureTemplates/ItemList.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/Features/FeaturesRelatedRecords.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/FloorFilter.js +1 -1
- package/widgets/Fullscreen.js +1 -1
- package/widgets/Histogram.js +1 -1
- package/widgets/HistogramRangeSlider.js +1 -1
- package/widgets/Home.js +1 -1
- package/widgets/LayerList/ListItemPanel.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Legend/styles/Card.js +1 -1
- package/widgets/Legend/styles/Classic.js +1 -1
- package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
- package/widgets/Legend/styles/support/univariateUtils.js +1 -1
- package/widgets/LineOfSight.js +1 -1
- package/widgets/Locate.js +1 -1
- package/widgets/NavigationToggle.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleRangeSlider/scalePreviewUtils.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Search/SearchResultRenderer.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/ShadowCast/components/DiscreteConfigurator.js +1 -1
- package/widgets/ShadowCast/components/DurationConfigurator.js +1 -1
- package/widgets/ShadowCast/components/ShadowTooltipContent.js +1 -1
- package/widgets/ShadowCast/components/ThresholdConfigurator.js +1 -1
- package/widgets/ShadowCast.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/Slider.js +1 -1
- package/widgets/Swipe.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/Track.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/UtilityNetworkValidateTopology.js +1 -1
- package/widgets/ValuePicker.js +1 -1
- package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
- package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
- package/widgets/VideoPlayer.js +1 -1
- package/widgets/Weather/LabeledSlider.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/Zoom/IconButton.js +1 -1
- package/widgets/smartMapping/BinaryColorSizeSlider.js +1 -1
- package/widgets/smartMapping/ClassedColorSlider.js +1 -1
- package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
- package/widgets/smartMapping/ColorSizeSlider.js +1 -1
- package/widgets/smartMapping/ColorSlider.js +1 -1
- package/widgets/smartMapping/HeatmapSlider.js +1 -1
- package/widgets/smartMapping/OpacitySlider.js +1 -1
- package/widgets/smartMapping/SizeSlider.js +1 -1
- package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
- package/widgets/support/ColorPicker.js +1 -1
- package/widgets/support/DatePicker.js +1 -1
- package/widgets/support/Heading.js +1 -1
- package/widgets/support/LabeledSwitch.js +1 -1
- package/widgets/support/MeasurementWidgetContent.js +1 -1
- package/widgets/support/Popover.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/SketchTooltipControls.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/widgets/support/TimePicker.js +1 -1
- package/widgets/support/TimezonePicker.js +1 -1
- package/widgets/support/UnitSelect.js +1 -1
- package/widgets/support/dateUtils.js +1 -1
- package/assets/esri/core/workers/chunks/072b4e041b8630c513a0.js +0 -1
- package/assets/esri/core/workers/chunks/092920c25cac89c038ee.js +0 -1
- package/assets/esri/core/workers/chunks/114269dda1d296893908.js +0 -1
- package/assets/esri/core/workers/chunks/126df6237fc80608344e.js +0 -1
- package/assets/esri/core/workers/chunks/1b3655f5bf5d90fa8730.js +0 -1
- package/assets/esri/core/workers/chunks/1c83f47d446f2bca1721.js +0 -1
- package/assets/esri/core/workers/chunks/1cf7bb514e7eefc3e9c6.js +0 -1
- package/assets/esri/core/workers/chunks/21a9c8aa2a9e9990df41.js +0 -1
- package/assets/esri/core/workers/chunks/24629402c647ef6b5f6b.js +0 -1
- package/assets/esri/core/workers/chunks/2a1c1be9c202462cf54d.js +0 -1
- package/assets/esri/core/workers/chunks/2cb36f9686693234991a.js +0 -1
- package/assets/esri/core/workers/chunks/2d0d03cbea83c868edba.js +0 -1
- package/assets/esri/core/workers/chunks/2e130cb2f1038055c07b.js +0 -1
- package/assets/esri/core/workers/chunks/3619e04cbb6691549014.js +0 -1
- package/assets/esri/core/workers/chunks/3dbfb4f370a874393822.js +0 -1
- package/assets/esri/core/workers/chunks/406db5c90271a3a203d4.js +0 -1
- package/assets/esri/core/workers/chunks/4369a6c1e0a82ab4db6a.js +0 -1
- package/assets/esri/core/workers/chunks/4f4a424d1747d04501df.js +0 -1
- package/assets/esri/core/workers/chunks/59c00d6fba0fd1c03d01.js +0 -1
- package/assets/esri/core/workers/chunks/5a5720caa64a46daadf9.js +0 -1
- package/assets/esri/core/workers/chunks/5edb99b58549cd66b394.js +0 -1
- package/assets/esri/core/workers/chunks/6203ddf6caad3d356327.js +0 -1
- package/assets/esri/core/workers/chunks/650a317b6dc245a7060f.js +0 -1
- package/assets/esri/core/workers/chunks/7a358b1fd0c0cce59e9b.js +0 -1
- package/assets/esri/core/workers/chunks/83d1a1b3d371c991cc4c.js +0 -1
- package/assets/esri/core/workers/chunks/846b7a81b870c8b238a1.js +0 -1
- package/assets/esri/core/workers/chunks/8ab832468300cc4feb5a.js +0 -1
- package/assets/esri/core/workers/chunks/bc1dc6383e60e7e61d50.js +0 -1
- package/assets/esri/core/workers/chunks/bc6323bdc98013da6fe5.js +0 -1
- package/assets/esri/core/workers/chunks/c4bb67150ccd01ea6014.js +0 -1
- package/assets/esri/core/workers/chunks/c60cf62f374e71e562fc.js +0 -1
- package/assets/esri/core/workers/chunks/c6ea5aac232d1eca04dd.js +0 -1
- package/assets/esri/core/workers/chunks/c8438c2d9ac48afe4033.js +0 -1
- package/assets/esri/core/workers/chunks/c8f239c25fe864f0e47a.js +0 -1
- package/assets/esri/core/workers/chunks/cad260881653567bc8f9.js +0 -1
- package/assets/esri/core/workers/chunks/d824f4b405a72cd2fa74.js +0 -1
- package/assets/esri/core/workers/chunks/dd7508d4016715371e0c.js +0 -1
- package/assets/esri/core/workers/chunks/e55f7fc7eff0074ce0fc.js +0 -1
- package/assets/esri/core/workers/chunks/eef27d305023034084a4.js +0 -1
- package/assets/esri/core/workers/chunks/f38c54ada9e7012a2960.js +0 -1
- package/assets/esri/core/workers/chunks/f5e0ff5292b9fd18fc92.js +0 -1
- package/assets/esri/core/workers/chunks/f5eb8b5021620be7538e.js +0 -1
- package/core/watchUtils.d.ts +0 -4
- package/core/watchUtils.js +0 -5
package/widgets/Popup.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../chunks/tslib.es6.js";import{deprecatedProperty as e}from"../core/deprecate.js";import{eventKey as i}from"../core/events.js";import o from"../core/Logger.js";import{watch as n,on as s,whenOnce as r}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import d from"../support/actions/ActionButton.js";import c from"./Features.js";import p from"./Widget.js";import{css as h}from"./Popup/css.js";import u from"./Popup/PopupViewModel.js";import g from"./Popup/PopupVisibleElements.js";import{globalCss as v}from"./support/globalCss.js";import{isRTL as w}from"./support/widgetUtils.js";import{messageBundle as m}from"./support/decorators/messageBundle.js";import{vmEvent as b}from"./support/decorators/vmEvent.js";import{tsx as f}from"./support/jsxFactory.js";const _={buttonEnabled:!0,position:"auto",breakpoint:{width:544}};let k=class extends p{constructor(t,e){super(t,e),this._dockAction=new d({id:"popup-dock-action"}),this._featuresWidget=new c({responsiveActionsEnabled:!0}),this._containerNode=null,this._mainContainerNode=null,this._pointerOffsetInPx=16,this.alignment="auto",this.collapsed=!1,this.collapseEnabled=!0,this.dockEnabled=!1,this.headingLevel=2,this.maxInlineActions=3,this.messages=null,this.spinnerEnabled=!0,this.viewModel=new u,this.visibleElements=new g}initialize(){this.addHandles([n((()=>[this.viewModel?.view?.widthBreakpoint,this.dockEnabled]),(()=>this._handleDockIcon()),{initial:!0}),n((()=>[this.dockEnabled,this.messages?.undock,this.messages?.dock]),(()=>this._handleDockEnabled()),{initial:!0}),n((()=>this.dockOptions),(t=>{const{_dockAction:e}=this,i=this._featuresWidget.headerActions;i.remove(e),t.buttonEnabled&&i.add(e)}),{initial:!0}),n((()=>this.viewModel?.screenLocation),(()=>this._positionContainer())),n((()=>[this.viewModel?.active,this.dockEnabled]),(()=>this._toggleScreenLocationEnabled())),n((()=>[this.viewModel?.screenLocation,this.viewModel?.view?.padding,this.viewModel?.view?.size,this.viewModel?.active,this.viewModel?.location,this.alignment]),(()=>this.reposition())),n((()=>this.viewModel?.view?.size),((t,e)=>this._updateDockEnabledForViewSize(t,e))),n((()=>this.viewModel?.view),((t,e)=>this._viewChange(t,e))),n((()=>this.viewModel?.view?.ready),((t,e)=>this._viewReadyChange(t??!1,e??!1))),n((()=>this.viewModel),(()=>this._featuresWidget.viewModel=this.viewModel),{initial:!0}),n((()=>this._featureNavigationTop),(t=>this._featuresWidget.featureNavigationTop=t),{initial:!0}),n((()=>this.headingLevel),(t=>this._featuresWidget.headingLevel=t),{initial:!0}),n((()=>this.collapseEnabled),(t=>this._featuresWidget.visibleElements.collapseButton=t),{initial:!0}),n((()=>this.collapsed),(t=>this._featuresWidget.collapsed=t),{initial:!0}),n((()=>this.visibleElements.closeButton),(t=>this._featuresWidget.visibleElements.closeButton=!!t),{initial:!0}),n((()=>this.spinnerEnabled),(t=>this._featuresWidget.visibleElements.spinner=t),{initial:!0}),n((()=>this.visibleElements.featureNavigation),(t=>this._featuresWidget.visibleElements.featureNavigation=!!t),{initial:!0}),s((()=>this._featuresWidget),"trigger-header-action",(t=>{t.action===this._dockAction&&(this.dockEnabled=!this.dockEnabled)}))])}destroy(){this._dockAction.destroy(),this._featuresWidget?.destroy()}get _featureNavigationTop(){const{currentAlignment:t,currentDockPosition:e}=this;return"bottom-left"===t||"bottom-center"===t||"bottom-right"===t||"top-left"===e||"top-center"===e||"top-right"===e}get actions(){return this.viewModel.actions}set actions(t){this.viewModel.actions=t}get autoCloseEnabled(){return this.viewModel.autoCloseEnabled}set autoCloseEnabled(t){this.viewModel.autoCloseEnabled=t}get autoOpenEnabled(){return e(o.getLogger(this),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled}set autoOpenEnabled(t){e(o.getLogger(this),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled=t}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(t){this.viewModel.defaultPopupTemplateEnabled=t}get content(){return this.viewModel.content}set content(t){this.viewModel.content=t}get currentAlignment(){return this._getCurrentAlignment()}get currentDockPosition(){return this._getCurrentDockPosition()}get dockOptions(){return this._get("dockOptions")||_}set dockOptions(t){const e={..._},i=this.viewModel?.view?.breakpoints,o={};i&&(o.width=i.xsmall,o.height=i.xsmall);const n={...e,...t},s={...e.breakpoint,...o},{breakpoint:r}=n;"object"==typeof r?n.breakpoint={...s,...r}:r&&(n.breakpoint=s),this._set("dockOptions",n),this._setCurrentDockPosition(),this.reposition()}get featureCount(){return this.viewModel.featureCount}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(t){this.viewModel.featureMenuOpen=t}get features(){return this.viewModel.features}set features(t){this.viewModel.features=t}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(t){this.viewModel.goToOverride=t}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(t){this.viewModel.highlightEnabled=t}get location(){return this.viewModel.location}set location(t){this.viewModel.location=t}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}get promises(){return this.viewModel.promises}set promises(t){this.viewModel.promises=t}get selectedFeature(){return this.viewModel.selectedFeature}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(t){this.viewModel.selectedFeatureIndex=t}get selectedFeatureWidget(){return this._featuresWidget.selectedFeatureWidget}get title(){return this.viewModel.title}set title(t){this.viewModel.title=t}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(t){this.viewModel.updateLocationEnabled=t}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get visible(){return this.viewModel.visible}set visible(t){this.viewModel.visible=t}blur(){const{active:t}=this.viewModel;t||o.getLogger(this).warn("Popup can only be blurred when currently active."),this._featuresWidget.blur()}clear(){return this.viewModel.clear()}close(){this.visible=!1}fetchFeatures(t,e){return this.viewModel.fetchFeatures(t,e)}focus(){const{active:t}=this.viewModel;t||o.getLogger(this).warn("Popup can only be focused when currently active."),this._featuresWidget.focus()}next(){return this.viewModel.next()}open(t){const e=!!t&&!!t.featureMenuOpen,i={collapsed:!!t&&!!t.collapsed,featureMenuOpen:e};this.set(i),this.viewModel.open(t),this._shouldFocus(t)}previous(){return this.viewModel.previous()}reposition(){this.renderNow(),this._positionContainer(),this._setCurrentAlignment()}triggerAction(t){return this.viewModel.triggerAction(t)}render(){const{dockEnabled:t,currentAlignment:e,currentDockPosition:i}=this,{active:o}=this.viewModel,n=o&&t,s=o&&!t,r=this.selectedFeature?.layer?.title,l=this.selectedFeature?.layer?.id,a={[h.alignTopCenter]:"top-center"===e,[h.alignBottomCenter]:"bottom-center"===e,[h.alignTopLeft]:"top-left"===e,[h.alignBottomLeft]:"bottom-left"===e,[h.alignTopRight]:"top-right"===e,[h.alignBottomRight]:"bottom-right"===e,[h.isDocked]:n,[h.shadow]:s,[h.isDockedTopLeft]:"top-left"===i,[h.isDockedTopCenter]:"top-center"===i,[h.isDockedTopRight]:"top-right"===i,[h.isDockedBottomLeft]:"bottom-left"===i,[h.isDockedBottomCenter]:"bottom-center"===i,[h.isDockedBottomRight]:"bottom-right"===i};return f("div",{class:this.classes(h.base,a),role:"presentation","data-layer-title":r,"data-layer-id":l,bind:this,afterCreate:this._positionContainer,afterUpdate:this._positionContainer},o?[this._renderMainContainer(),this._renderPointer()]:null)}_renderPointer(){return this.dockEnabled?null:f("div",{key:"popup-pointer",class:h.pointer,role:"presentation"},f("div",{class:this.classes(h.pointerDirection,h.shadow)}))}_renderMainContainer(){const{dockEnabled:t}=this,e={[h.shadow]:t};return f("div",{class:this.classes(h.main,v.widget,e),bind:this,afterCreate:this._setMainContainerNode,afterUpdate:this._setMainContainerNode,onkeyup:this._handleMainKeyup},this._featuresWidget.render())}_handleMainKeyup(t){const e=i(t);"ArrowLeft"===e&&(t.stopPropagation(),this.previous()),"ArrowRight"===e&&(t.stopPropagation(),this.next())}async _shouldFocus(t){t?.shouldFocus&&(await r((()=>!0===this.viewModel?.active)),this.focus())}_isOutsideView(t){const{popupHeight:e,popupWidth:i,screenLocation:o,side:n,view:s}=t;if(isNaN(i)||isNaN(e)||!s||!o)return!1;const r=s.padding;return"right"===n&&o.x+i/2>s.width-r.right||("left"===n&&o.x-i/2<r.left||("top"===n&&o.y-e<r.top||"bottom"===n&&o.y+e>s.height-r.bottom))}_calculateAutoAlignment(t){if("auto"!==t)return t;const{_pointerOffsetInPx:e,_containerNode:i,_mainContainerNode:o,viewModel:n}=this,{screenLocation:s,view:r}=n;if(null==s||!r||!i)return"top-center";function l(t){return parseInt(t.replaceAll(/[^-\d\.]/g,""),10)}const a=o?window.getComputedStyle(o,null):null,d=a?l(a.getPropertyValue("max-height")):0,c=a?l(a.getPropertyValue("height")):0,{height:p,width:h}=i.getBoundingClientRect(),u=h+e,g=Math.max(p,d,c)+e,v=this._isOutsideView({popupHeight:g,popupWidth:u,screenLocation:s,side:"right",view:r}),w=this._isOutsideView({popupHeight:g,popupWidth:u,screenLocation:s,side:"left",view:r}),m=this._isOutsideView({popupHeight:g,popupWidth:u,screenLocation:s,side:"top",view:r}),b=this._isOutsideView({popupHeight:g,popupWidth:u,screenLocation:s,side:"bottom",view:r});return w?m?"bottom-right":"top-right":v?m?"bottom-left":"top-left":m?b?"top-center":"bottom-center":"top-center"}_callCurrentAlignment(t){return"function"==typeof t?t.call(this):t}_getCurrentAlignment(){const{alignment:t,dockEnabled:e}=this;return e||!this.viewModel.active?null:this._calculatePositionResult(this._calculateAutoAlignment(this._callCurrentAlignment(t)))}_setCurrentAlignment(){this._set("currentAlignment",this._getCurrentAlignment())}_setCurrentDockPosition(){this._set("currentDockPosition",this._getCurrentDockPosition())}_calculatePositionResult(t){const e=["left","right"];return w(this.container)&&e.reverse(),t?.replace(/leading/gi,e[0]).replaceAll(/trailing/gi,e[1])}_callDockPosition(t){return"function"==typeof t?t.call(this):t}_getDockPosition(){return this._calculatePositionResult(this._calculateAutoDockPosition(this._callDockPosition(this.dockOptions?.position)))}_getCurrentDockPosition(){return this.dockEnabled&&this.viewModel.active?this._getDockPosition():null}_calculateAutoDockPosition(t){if("auto"!==t)return t;const e=this.viewModel?.view,i=w(this.container)?"top-left":"top-right";if(!e)return i;const o=e.padding||{left:0,right:0,top:0,bottom:0},n=e.width-o.left-o.right,{breakpoints:s}=e;return s&&n<=s.xsmall?"bottom-center":i}_getDockIcon(){const t=this._getDockPosition();if(this.dockEnabled)return"minimize";switch(t){case"top-left":case"bottom-left":return"dock-left";case"top-center":return"maximize";case"bottom-center":return"dock-bottom";default:return"dock-right"}}_handleDockIcon(){this._dockAction.icon=this._getDockIcon()}_handleDockEnabled(){this._dockAction.title=this.dockEnabled?this.messages?.undock:this.messages?.dock}_setMainContainerNode(t){this._mainContainerNode=t}_positionContainer(t=this._containerNode){if(t&&(this._containerNode=t),!this._containerNode)return;const{screenLocation:e}=this.viewModel,{width:i}=this._containerNode.getBoundingClientRect(),o=this._calculatePositionStyle(e,i);o&&Object.assign(this._containerNode.style,o)}_calculateFullWidth(t){const{currentAlignment:e,_pointerOffsetInPx:i}=this;return"top-left"===e||"bottom-left"===e||"top-right"===e||"bottom-right"===e?t+i:t}_calculateAlignmentPosition(t,e,i,o){const{currentAlignment:n,_pointerOffsetInPx:s}=this;if(!i)return;const{padding:r}=i,l=o/2,a=i.height-e,d=i.width-t;return"bottom-center"===n?{top:e+s-r.top,left:t-l-r.left}:"top-left"===n?{bottom:a+s-r.bottom,right:d+s-r.right}:"bottom-left"===n?{top:e+s-r.top,right:d+s-r.right}:"top-right"===n?{bottom:a+s-r.bottom,left:t+s-r.left}:"bottom-right"===n?{top:e+s-r.top,left:t+s-r.left}:"top-center"===n?{bottom:a+s-r.bottom,left:t-l-r.left}:void 0}_calculatePositionStyle(t,e){const{dockEnabled:i,view:o}=this;if(!o)return;if(i)return{left:"",top:"",right:"",bottom:""};if(null==t||!e)return;const n=this._calculateFullWidth(e),s=this._calculateAlignmentPosition(t.x,t.y,o,n);return s?{top:void 0!==s.top?`${s.top}px`:"auto",left:void 0!==s.left?`${s.left}px`:"auto",bottom:void 0!==s.bottom?`${s.bottom}px`:"auto",right:void 0!==s.right?`${s.right}px`:"auto"}:void 0}_viewChange(t,e){t&&e&&(this.close(),this.clear())}_viewReadyChange(t,e){t?this._wireUpView():e&&(this.close(),this.clear())}_wireUpView(){this._setDockEnabledForViewSize(this.dockOptions)}_dockingThresholdCrossed(t,e,i){const[o,n]=t,[s,r]=e,{width:l=0,height:a=0}=i??{};return o<=l&&s>l||o>l&&s<=l||n<=a&&r>a||n>a&&r<=a}_updateDockEnabledForViewSize(t,e){if(!t||!e)return;const i=this.viewModel?.view?.padding||{left:0,right:0,top:0,bottom:0},o=i.left+i.right,n=i.top+i.bottom,s=[],r=[];s[0]=t[0]-o,s[1]=t[1]-n,r[0]=e[0]-o,r[1]=e[1]-n;const{dockOptions:l}=this,a=l.breakpoint;this._dockingThresholdCrossed(s,r,a)&&this._setDockEnabledForViewSize(l),this._setCurrentDockPosition()}_toggleScreenLocationEnabled(){const{dockEnabled:t,viewModel:e}=this;if(!e)return;const i=e.active&&!t;e.screenLocationEnabled=i}_shouldDockAtCurrentViewSize(t){const e=t.breakpoint,i=this.viewModel?.view?.ui;if(!i)return!1;const{width:o,height:n}=i;if(isNaN(o)||isNaN(n))return!1;if(!e)return!1;const s=e.hasOwnProperty("width")&&o<=(e.width??0),r=e.hasOwnProperty("height")&&n<=(e.height??0);return s||r}_setDockEnabledForViewSize(t){t.breakpoint&&(this.dockEnabled=this._shouldDockAtCurrentViewSize(t))}};t([l({readOnly:!0})],k.prototype,"_featureNavigationTop",null),t([l()],k.prototype,"actions",null),t([l()],k.prototype,"alignment",void 0),t([l()],k.prototype,"autoCloseEnabled",null),t([l()],k.prototype,"autoOpenEnabled",null),t([l()],k.prototype,"defaultPopupTemplateEnabled",null),t([l()],k.prototype,"content",null),t([l()],k.prototype,"collapsed",void 0),t([l()],k.prototype,"collapseEnabled",void 0),t([l({readOnly:!0})],k.prototype,"currentAlignment",null),t([l({readOnly:!0})],k.prototype,"currentDockPosition",null),t([l()],k.prototype,"dockOptions",null),t([l()],k.prototype,"dockEnabled",void 0),t([l({readOnly:!0})],k.prototype,"featureCount",null),t([l()],k.prototype,"featureMenuOpen",null),t([l()],k.prototype,"features",null),t([l()],k.prototype,"goToOverride",null),t([l()],k.prototype,"headingLevel",void 0),t([l()],k.prototype,"highlightEnabled",null),t([l()],k.prototype,"location",null),t([l()],k.prototype,"label",null),t([l()],k.prototype,"maxInlineActions",void 0),t([l(),m("esri/widgets/Popup/t9n/Popup")],k.prototype,"messages",void 0),t([l()],k.prototype,"promises",null),t([l({readOnly:!0})],k.prototype,"selectedFeature",null),t([l()],k.prototype,"selectedFeatureIndex",null),t([l({readOnly:!0})],k.prototype,"selectedFeatureWidget",null),t([l()],k.prototype,"spinnerEnabled",void 0),t([l()],k.prototype,"title",null),t([l()],k.prototype,"updateLocationEnabled",null),t([l()],k.prototype,"view",null),t([l({type:u}),b(["triggerAction","trigger-action"])],k.prototype,"viewModel",void 0),t([l()],k.prototype,"visible",null),t([l({type:g,nonNullable:!0})],k.prototype,"visibleElements",void 0),k=t([a("esri.widgets.Popup")],k);const M=k;export{M as default};
|
|
5
|
+
import{_ as t}from"../chunks/tslib.es6.js";import{deprecatedProperty as e}from"../core/deprecate.js";import{eventKey as i}from"../core/events.js";import o from"../core/Logger.js";import{watch as n,on as s,whenOnce as r}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import d from"../support/actions/ActionButton.js";import c from"./Features.js";import p from"./Widget.js";import{css as h}from"./Popup/css.js";import u from"./Popup/PopupViewModel.js";import g from"./Popup/PopupVisibleElements.js";import{globalCss as v}from"./support/globalCss.js";import{isRTL as w}from"./support/widgetUtils.js";import{messageBundle as m}from"./support/decorators/messageBundle.js";import{vmEvent as b}from"./support/decorators/vmEvent.js";import{tsx as f}from"./support/jsxFactory.js";const _={buttonEnabled:!0,position:"auto",breakpoint:{width:544}};let k=class extends p{constructor(t,e){super(t,e),this._dockAction=new d({id:"popup-dock-action"}),this._featuresWidget=new c({responsiveActionsEnabled:!0}),this._containerNode=null,this._mainContainerNode=null,this._pointerOffsetInPx=16,this.alignment="auto",this.collapsed=!1,this.collapseEnabled=!0,this.dockEnabled=!1,this.headingLevel=2,this.maxInlineActions=3,this.messages=null,this.spinnerEnabled=!0,this.viewModel=new u,this.visibleElements=new g}initialize(){this.addHandles([n((()=>[this.viewModel?.view?.widthBreakpoint,this.dockEnabled]),(()=>this._handleDockIcon()),{initial:!0}),n((()=>[this.dockEnabled,this.messages?.undock,this.messages?.dock]),(()=>this._handleDockEnabled()),{initial:!0}),n((()=>this.dockOptions),(t=>{const{_dockAction:e}=this,i=this._featuresWidget.headerActions;i.remove(e),t.buttonEnabled&&i.add(e)}),{initial:!0}),n((()=>this.viewModel?.screenLocation),(()=>this._positionContainer())),n((()=>[this.viewModel?.active,this.dockEnabled]),(()=>this._toggleScreenLocationEnabled())),n((()=>[this.viewModel?.screenLocation,this.viewModel?.view?.padding,this.viewModel?.view?.size,this.viewModel?.active,this.viewModel?.location,this.alignment]),(()=>this.reposition())),n((()=>this.viewModel?.view?.size),((t,e)=>this._updateDockEnabledForViewSize(t,e))),n((()=>this.viewModel?.view),((t,e)=>this._viewChange(t,e))),n((()=>this.viewModel?.view?.ready),((t,e)=>this._viewReadyChange(t??!1,e??!1))),n((()=>this.viewModel),(()=>this._featuresWidget.viewModel=this.viewModel),{initial:!0}),n((()=>this._featureNavigationTop),(t=>this._featuresWidget.featureNavigationTop=t),{initial:!0}),n((()=>this.headingLevel),(t=>this._featuresWidget.headingLevel=t),{initial:!0}),n((()=>this.collapseEnabled),(t=>this._featuresWidget.visibleElements.collapseButton=t),{initial:!0}),n((()=>this.collapsed),(t=>this._featuresWidget.collapsed=t),{initial:!0}),n((()=>this.visibleElements.closeButton),(t=>this._featuresWidget.visibleElements.closeButton=!!t),{initial:!0}),n((()=>this.spinnerEnabled),(t=>this._featuresWidget.visibleElements.spinner=t),{initial:!0}),n((()=>this.visibleElements.featureNavigation),(t=>this._featuresWidget.visibleElements.featureNavigation=!!t),{initial:!0}),s((()=>this._featuresWidget),"trigger-header-action",(t=>{t.action===this._dockAction&&(this.dockEnabled=!this.dockEnabled)}))])}destroy(){this._dockAction.destroy(),this._featuresWidget?.destroy()}get _featureNavigationTop(){const{currentAlignment:t,currentDockPosition:e}=this;return"bottom-left"===t||"bottom-center"===t||"bottom-right"===t||"top-left"===e||"top-center"===e||"top-right"===e}get actions(){return this.viewModel.actions}set actions(t){this.viewModel.actions=t}get autoCloseEnabled(){return this.viewModel.autoCloseEnabled}set autoCloseEnabled(t){this.viewModel.autoCloseEnabled=t}get autoOpenEnabled(){return e(o.getLogger(this),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled}set autoOpenEnabled(t){e(o.getLogger(this),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled=t}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(t){this.viewModel.defaultPopupTemplateEnabled=t}get content(){return this.viewModel.content}set content(t){this.viewModel.content=t}get currentAlignment(){return this._getCurrentAlignment()}get currentDockPosition(){return this._getCurrentDockPosition()}get dockOptions(){return this._get("dockOptions")||_}set dockOptions(t){const e={..._},i=this.viewModel?.view?.breakpoints,o={};i&&(o.width=i.xsmall,o.height=i.xsmall);const n={...e,...t},s={...e.breakpoint,...o},{breakpoint:r}=n;"object"==typeof r?n.breakpoint={...s,...r}:r&&(n.breakpoint=s),this._set("dockOptions",n),this._setCurrentDockPosition(),this.reposition()}get featureCount(){return this.viewModel.featureCount}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(t){this.viewModel.featureMenuOpen=t}get features(){return this.viewModel.features}set features(t){this.viewModel.features=t}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(t){this.viewModel.goToOverride=t}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(t){this.viewModel.highlightEnabled=t}get location(){return this.viewModel.location}set location(t){this.viewModel.location=t}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}get promises(){return this.viewModel.promises}set promises(t){this.viewModel.promises=t}get selectedFeature(){return this.viewModel.selectedFeature}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(t){this.viewModel.selectedFeatureIndex=t}get selectedFeatureWidget(){return this._featuresWidget.selectedFeatureWidget}get title(){return this.viewModel.title}set title(t){this.viewModel.title=t}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(t){this.viewModel.updateLocationEnabled=t}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get visible(){return this.viewModel.visible}set visible(t){this.viewModel.visible=t}blur(){const{active:t}=this.viewModel;t||o.getLogger(this).warn("Popup can only be blurred when currently active."),this._featuresWidget.blur()}clear(){return this.viewModel.clear()}close(){this.visible=!1}fetchFeatures(t,e){return this.viewModel.fetchFeatures(t,e)}focus(){const{active:t}=this.viewModel;t||o.getLogger(this).warn("Popup can only be focused when currently active."),this._featuresWidget.focus()}next(){return this.viewModel.next()}open(t){const e=!!t&&!!t.featureMenuOpen,i={collapsed:!!t&&!!t.collapsed,featureMenuOpen:e};this.set(i),this.viewModel.open(t),this._shouldFocus(t)}previous(){return this.viewModel.previous()}reposition(){this.renderNow(),this._positionContainer(),this._setCurrentAlignment()}triggerAction(t){return this.viewModel.triggerAction(t)}render(){const{dockEnabled:t,currentAlignment:e,currentDockPosition:i}=this,{active:o}=this.viewModel,n=o&&t,s=o&&!t,r=this.selectedFeature?.layer?.title,l=this.selectedFeature?.layer?.id,a={[h.alignTopCenter]:"top-center"===e,[h.alignBottomCenter]:"bottom-center"===e,[h.alignTopLeft]:"top-left"===e,[h.alignBottomLeft]:"bottom-left"===e,[h.alignTopRight]:"top-right"===e,[h.alignBottomRight]:"bottom-right"===e,[h.isDocked]:n,[h.shadow]:s,[h.isDockedTopLeft]:"top-left"===i,[h.isDockedTopCenter]:"top-center"===i,[h.isDockedTopRight]:"top-right"===i,[h.isDockedBottomLeft]:"bottom-left"===i,[h.isDockedBottomCenter]:"bottom-center"===i,[h.isDockedBottomRight]:"bottom-right"===i};return f("div",{afterCreate:this._positionContainer,afterUpdate:this._positionContainer,bind:this,class:this.classes(h.base,a),"data-layer-id":l,"data-layer-title":r,role:"presentation"},o?[this._renderMainContainer(),this._renderPointer()]:null)}_renderPointer(){return this.dockEnabled?null:f("div",{class:h.pointer,key:"popup-pointer",role:"presentation"},f("div",{class:this.classes(h.pointerDirection,h.shadow)}))}_renderMainContainer(){const{dockEnabled:t}=this,e={[h.shadow]:t};return f("div",{afterCreate:this._setMainContainerNode,afterUpdate:this._setMainContainerNode,bind:this,class:this.classes(h.main,v.widget,e),onkeyup:this._handleMainKeyup},this._featuresWidget.render())}_handleMainKeyup(t){const e=i(t);"ArrowLeft"===e&&(t.stopPropagation(),this.previous()),"ArrowRight"===e&&(t.stopPropagation(),this.next())}async _shouldFocus(t){t?.shouldFocus&&(await r((()=>!0===this.viewModel?.active)),this.focus())}_isOutsideView(t){const{popupHeight:e,popupWidth:i,screenLocation:o,side:n,view:s}=t;if(isNaN(i)||isNaN(e)||!s||!o)return!1;const r=s.padding;return"right"===n&&o.x+i/2>s.width-r.right||("left"===n&&o.x-i/2<r.left||("top"===n&&o.y-e<r.top||"bottom"===n&&o.y+e>s.height-r.bottom))}_calculateAutoAlignment(t){if("auto"!==t)return t;const{_pointerOffsetInPx:e,_containerNode:i,_mainContainerNode:o,viewModel:n}=this,{screenLocation:s,view:r}=n;if(null==s||!r||!i)return"top-center";function l(t){return parseInt(t.replaceAll(/[^-\d\.]/g,""),10)}const a=o?window.getComputedStyle(o,null):null,d=a?l(a.getPropertyValue("max-height")):0,c=a?l(a.getPropertyValue("height")):0,{height:p,width:h}=i.getBoundingClientRect(),u=h+e,g=Math.max(p,d,c)+e,v=this._isOutsideView({popupHeight:g,popupWidth:u,screenLocation:s,side:"right",view:r}),w=this._isOutsideView({popupHeight:g,popupWidth:u,screenLocation:s,side:"left",view:r}),m=this._isOutsideView({popupHeight:g,popupWidth:u,screenLocation:s,side:"top",view:r}),b=this._isOutsideView({popupHeight:g,popupWidth:u,screenLocation:s,side:"bottom",view:r});return w?m?"bottom-right":"top-right":v?m?"bottom-left":"top-left":m?b?"top-center":"bottom-center":"top-center"}_callCurrentAlignment(t){return"function"==typeof t?t.call(this):t}_getCurrentAlignment(){const{alignment:t,dockEnabled:e}=this;return e||!this.viewModel.active?null:this._calculatePositionResult(this._calculateAutoAlignment(this._callCurrentAlignment(t)))}_setCurrentAlignment(){this._set("currentAlignment",this._getCurrentAlignment())}_setCurrentDockPosition(){this._set("currentDockPosition",this._getCurrentDockPosition())}_calculatePositionResult(t){const e=["left","right"];return w(this.container)&&e.reverse(),t?.replace(/leading/gi,e[0]).replaceAll(/trailing/gi,e[1])}_callDockPosition(t){return"function"==typeof t?t.call(this):t}_getDockPosition(){return this._calculatePositionResult(this._calculateAutoDockPosition(this._callDockPosition(this.dockOptions?.position)))}_getCurrentDockPosition(){return this.dockEnabled&&this.viewModel.active?this._getDockPosition():null}_calculateAutoDockPosition(t){if("auto"!==t)return t;const e=this.viewModel?.view,i=w(this.container)?"top-left":"top-right";if(!e)return i;const o=e.padding||{left:0,right:0,top:0,bottom:0},n=e.width-o.left-o.right,{breakpoints:s}=e;return s&&n<=s.xsmall?"bottom-center":i}_getDockIcon(){const t=this._getDockPosition();if(this.dockEnabled)return"minimize";switch(t){case"top-left":case"bottom-left":return"dock-left";case"top-center":return"maximize";case"bottom-center":return"dock-bottom";default:return"dock-right"}}_handleDockIcon(){this._dockAction.icon=this._getDockIcon()}_handleDockEnabled(){this._dockAction.title=this.dockEnabled?this.messages?.undock:this.messages?.dock}_setMainContainerNode(t){this._mainContainerNode=t}_positionContainer(t=this._containerNode){if(t&&(this._containerNode=t),!this._containerNode)return;const{screenLocation:e}=this.viewModel,{width:i}=this._containerNode.getBoundingClientRect(),o=this._calculatePositionStyle(e,i);o&&Object.assign(this._containerNode.style,o)}_calculateFullWidth(t){const{currentAlignment:e,_pointerOffsetInPx:i}=this;return"top-left"===e||"bottom-left"===e||"top-right"===e||"bottom-right"===e?t+i:t}_calculateAlignmentPosition(t,e,i,o){const{currentAlignment:n,_pointerOffsetInPx:s}=this;if(!i)return;const{padding:r}=i,l=o/2,a=i.height-e,d=i.width-t;return"bottom-center"===n?{top:e+s-r.top,left:t-l-r.left}:"top-left"===n?{bottom:a+s-r.bottom,right:d+s-r.right}:"bottom-left"===n?{top:e+s-r.top,right:d+s-r.right}:"top-right"===n?{bottom:a+s-r.bottom,left:t+s-r.left}:"bottom-right"===n?{top:e+s-r.top,left:t+s-r.left}:"top-center"===n?{bottom:a+s-r.bottom,left:t-l-r.left}:void 0}_calculatePositionStyle(t,e){const{dockEnabled:i,view:o}=this;if(!o)return;if(i)return{left:"",top:"",right:"",bottom:""};if(null==t||!e)return;const n=this._calculateFullWidth(e),s=this._calculateAlignmentPosition(t.x,t.y,o,n);return s?{top:void 0!==s.top?`${s.top}px`:"auto",left:void 0!==s.left?`${s.left}px`:"auto",bottom:void 0!==s.bottom?`${s.bottom}px`:"auto",right:void 0!==s.right?`${s.right}px`:"auto"}:void 0}_viewChange(t,e){t&&e&&(this.close(),this.clear())}_viewReadyChange(t,e){t?this._wireUpView():e&&(this.close(),this.clear())}_wireUpView(){this._setDockEnabledForViewSize(this.dockOptions)}_dockingThresholdCrossed(t,e,i){const[o,n]=t,[s,r]=e,{width:l=0,height:a=0}=i??{};return o<=l&&s>l||o>l&&s<=l||n<=a&&r>a||n>a&&r<=a}_updateDockEnabledForViewSize(t,e){if(!t||!e)return;const i=this.viewModel?.view?.padding||{left:0,right:0,top:0,bottom:0},o=i.left+i.right,n=i.top+i.bottom,s=[],r=[];s[0]=t[0]-o,s[1]=t[1]-n,r[0]=e[0]-o,r[1]=e[1]-n;const{dockOptions:l}=this,a=l.breakpoint;this._dockingThresholdCrossed(s,r,a)&&this._setDockEnabledForViewSize(l),this._setCurrentDockPosition()}_toggleScreenLocationEnabled(){const{dockEnabled:t,viewModel:e}=this;if(!e)return;const i=e.active&&!t;e.screenLocationEnabled=i}_shouldDockAtCurrentViewSize(t){const e=t.breakpoint,i=this.viewModel?.view?.ui;if(!i)return!1;const{width:o,height:n}=i;if(isNaN(o)||isNaN(n))return!1;if(!e)return!1;const s=e.hasOwnProperty("width")&&o<=(e.width??0),r=e.hasOwnProperty("height")&&n<=(e.height??0);return s||r}_setDockEnabledForViewSize(t){t.breakpoint&&(this.dockEnabled=this._shouldDockAtCurrentViewSize(t))}};t([l({readOnly:!0})],k.prototype,"_featureNavigationTop",null),t([l()],k.prototype,"actions",null),t([l()],k.prototype,"alignment",void 0),t([l()],k.prototype,"autoCloseEnabled",null),t([l()],k.prototype,"autoOpenEnabled",null),t([l()],k.prototype,"defaultPopupTemplateEnabled",null),t([l()],k.prototype,"content",null),t([l()],k.prototype,"collapsed",void 0),t([l()],k.prototype,"collapseEnabled",void 0),t([l({readOnly:!0})],k.prototype,"currentAlignment",null),t([l({readOnly:!0})],k.prototype,"currentDockPosition",null),t([l()],k.prototype,"dockOptions",null),t([l()],k.prototype,"dockEnabled",void 0),t([l({readOnly:!0})],k.prototype,"featureCount",null),t([l()],k.prototype,"featureMenuOpen",null),t([l()],k.prototype,"features",null),t([l()],k.prototype,"goToOverride",null),t([l()],k.prototype,"headingLevel",void 0),t([l()],k.prototype,"highlightEnabled",null),t([l()],k.prototype,"location",null),t([l()],k.prototype,"label",null),t([l()],k.prototype,"maxInlineActions",void 0),t([l(),m("esri/widgets/Popup/t9n/Popup")],k.prototype,"messages",void 0),t([l()],k.prototype,"promises",null),t([l({readOnly:!0})],k.prototype,"selectedFeature",null),t([l()],k.prototype,"selectedFeatureIndex",null),t([l({readOnly:!0})],k.prototype,"selectedFeatureWidget",null),t([l()],k.prototype,"spinnerEnabled",void 0),t([l()],k.prototype,"title",null),t([l()],k.prototype,"updateLocationEnabled",null),t([l()],k.prototype,"view",null),t([l({type:u}),b(["triggerAction","trigger-action"])],k.prototype,"viewModel",void 0),t([l()],k.prototype,"visible",null),t([l({type:g,nonNullable:!0})],k.prototype,"visibleElements",void 0),k=t([a("esri.widgets.Popup")],k);const M=k;export{M as default};
|
package/widgets/Print.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{on as a,eventKey as i}from"../core/events.js";import{clone as s}from"../core/lang.js";import n from"../core/Logger.js";import{watch as o,initial as l}from"../core/reactiveUtils.js";import{addProxy as r,hasSameOrigin as p}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{getToken as u}from"../rest/utils.js";import h from"./Widget.js";import m from"./Print/FileLink.js";import _ from"./Print/PrintViewModel.js";import b from"./Print/TemplateOptions.js";import{globalCss as v}from"./support/globalCss.js";import{Heading as y}from"./support/Heading.js";import{legacyIcon as f}from"./support/legacyIcon.js";import g from"./support/Popover.js";import{isActivationKey as T,keepMenuItemWithinView as w}from"./support/widgetUtils.js";import{messageBundle as O}from"./support/decorators/messageBundle.js";import{tsx as x}from"./support/jsxFactory.js";const C=t.ofType(m),L="MAP_ONLY";var I;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab"}(I||(I={}));const k="esri-print",S=`${k}__advanced-options-button`,$={base:k,widgetIcon:f.printer,headerTitle:`${k}__header-title`,inputText:`${k}__input-text`,layoutTabList:`${k}__layout-tab-list`,layoutTab:`${k}__layout-tab`,layoutSection:`${k}__layout-section`,mapOnlySection:`${k}__map-only-section`,scaleInput:`${k}__scale-input`,templateList:`${k}__template-list`,templateListScroller:`${k}__template-list-scroller`,templateListFooter:`${k}__template-list-footer`,loader:`${k}__loader`,advancedOptionsButton:S,advancedOptionsButtonContainer:`${S}-container`,advancedOptionsButtonTitle:`${S}-title`,advancedOptionsButtonIconOpened:`${S}-icon--opened`,advancedOptionsButtonIconClosed:`${S}-icon--closed`,advancedOptionsButtonIconClosed_RTL:`${S}-icon--closed-rtl`,refreshButton:`${k}__refresh-button`,swapButton:`${k}__swap-button`,linkButton:`${k}__link-button`,printButton:`${k}__export-button`,templateButton:`${k}__template-button`,formSectionContainer:`${k}__form-section-container`,advancedOptionsSection:`${k}__advanced-options-section`,advancedOptionsContainer:`${k}__advanced-options-container`,authorInfoContainer:`${k}__author-info-container`,copyrightInfoContainer:`${k}__copyright-info-container`,exportedFilesContainer:`${k}__export-panel-container`,exportedFilesTitle:`${k}__export-title`,exportedFile:`${k}__exported-file`,exportedFileLink:`${k}__exported-file-link`,exportedFileLinkTitle:`${k}__exported-file-link-title`,heightContainer:`${k}__height-container`,legendInfoContainer:`${k}__legend-info-container`,printWidgetContainer:`${k}__container`,panelContainer:`${k}__panel-container`,scaleInfoContainer:`${k}__scale-info-container`,scaleInputContainer:`${k}__scale-input-container`,sizeContainer:`${k}__size-container`,widthContainer:`${k}__width-container`,panelError:`${k}__panel--error`,exportedFileError:`${k}__exported-file--error`},M="User sets an invalid layout, resetting it to the default valid one...",F="User sets an invalid format, resetting it to the default valid one...";function E(e){const t=8.3333,a=11.4583;return{width:Math.round(e*t),height:Math.round(e*a)}}function P(e){return!isNaN(e)&&e>0}function V(e){return e?.toUpperCase()===L}let A=class extends h{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._advancedOptionsVisibleForLayout=!1,this._advancedOptionsVisibleForMapOnly=!1,this._awaitingServerResponse=!1,this._exportedFileNameMap={},this._focusedTemplateIndex=0,this._layoutTabSelected=!0,this._pendingExportScroll=!1,this._rootNode=null,this._selectTemplateNode=null,this._templateListPopover=new g({owner:this,placement:"top",offset:[0,-100],anchorElement:()=>this._selectTemplateNode,renderContentFunction:this._renderTemplateList}),this.exportedLinks=new C,this.headingLevel=3,this.iconClass=$.widgetIcon,this.icon=null,this.templateOptions=new b,this.viewModel=new _,this._handleTemplateListCreation=e=>e.focus(),this._handleTemplateChildBlur=e=>{const t=e.relatedTarget?.closest(`.${$.templateList}`);t||this._handleCloseTemplateSelection()},this._handleCloseTemplateSelection=()=>{this._focusedTemplateIndex=0,this._templateListPopover.open=!1,this._selectTemplateNode?.focus()},this._handleSelectTemplateClick=()=>{this._focusedTemplateIndex=0,this._templateListPopover.open=!0},this._handleTemplateListClick=e=>{const t=B(e.target);t&&this._applyTemplate(t)},this._handleTemplateListKeyDown=e=>{if(this._focusedTemplateIndex){if(T(e.key))return this._applyTemplate(this.viewModel.defaultTemplates.at(this._focusedTemplateIndex)),void e.preventDefault();if("ArrowDown"===e.key||"ArrowUp"===e.key){const{defaultTemplates:t}=this.viewModel,a="ArrowDown"===e.key?1:-1,i=(this._focusedTemplateIndex+a)%t.length;this._focusedTemplateIndex=i<0?t.length-1:i;const s=e.currentTarget;w(s.querySelectorAll(`.${v.menuItem}`)[this._focusedTemplateIndex],s.parentElement),e.preventDefault()}"Escape"===e.key&&this._handleCloseTemplateSelection()}},this._removeLink=e=>{const t=e.currentTarget["data-item"];t&&"error"===t.state&&this.exportedLinks.remove(t)},this._handleLinkClick=e=>{const t=e.currentTarget,{href:a}=t,i=u(this.viewModel.effectivePrintServiceUrl);if(!i)return;if(!e.isTrusted)return void e.stopPropagation();e.preventDefault();const s=new URL(a);s.searchParams.set("token",i),t.href=s.href,t.click(),t.href=a},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([o((()=>this.viewModel?.templatesInfo),(e=>{const{format:t,layout:a}=this.templateOptions;if(e){const i=a===e.layout.defaultValue||V(a)||e.layout.choiceList&&a&&e.layout.choiceList.includes(a),s=t===e.format.defaultValue||e.format.choiceList&&t&&e.format.choiceList.includes(t);i||(a&&n.getLogger(this).warn(M),this.templateOptions.layout=e.layout.defaultValue),s||(t&&n.getLogger(this).warn(F),this.templateOptions.format=e.format.defaultValue),V(a)&&(this._layoutTabSelected=!1)}}),l),o((()=>this.templateOptions?.format),(e=>{const{viewModel:{templatesInfo:t}}=this;if(t&&e){let a=!1;t.format.choiceList&&t.format.choiceList.forEach((t=>{t.toUpperCase()===e.toUpperCase()&&(this.templateOptions.format=t,a=!0)})),a||(this.templateOptions.format=t.format.defaultValue,n.getLogger(this).warn(F)),this.scheduleRender()}}),l),o((()=>this.templateOptions?.layout),(e=>{const{viewModel:{templatesInfo:t}}=this;if(t&&e){this._layoutTabSelected=!V(e);let a=!this._layoutTabSelected;a||t.layout.choiceList&&t.layout.choiceList.forEach((t=>{t.toUpperCase()===e.toUpperCase()&&(this.templateOptions.layout=t,a=!0)})),a||(this.templateOptions.layout=t.layout.defaultValue,n.getLogger(this).warn(M));const i=this.viewModel.effectiveTemplateCustomTextElements[this.templateOptions.layout];this.templateOptions.customTextElements=i?s(i):null,this.scheduleRender()}}),l),o((()=>this.templateOptions?.dpi),(e=>{e<=0?this.templateOptions.dpi=1:this.scheduleRender()}),l),o((()=>this.viewModel?.view?.scale),(e=>{const{scale:t,scaleEnabled:a}=this.templateOptions;a&&t||(this.templateOptions.scale=e)}),l)]);const{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;const a=setTimeout((()=>{this._awaitingServerResponse=!0,this.scheduleRender()}),500);this.viewModel.load().then((()=>clearTimeout(a)))}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 extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=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 portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=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 view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{attributionEnabled:e,author:t,copyright:a,dpi:i,format:s,height:n,layout:o,legendEnabled:l,northArrowEnabled:r,scaleEnabled:p,scale:d,width:c}=this.templateOptions,u="ready"!==this.viewModel?.state,h=this._renderTitleOrFileNameSection(),{includeDefaultTemplates:m,messages:_,viewModel:b}=this,g=this.viewModel?.templatesInfo?.format?.choiceList||[],T=g.length>0?g.map((e=>x("option",{key:e,selected:e===s,value:e},e.toUpperCase()))):x("option",{key:"format-default-option"},_.formatDefaultOption),w=x("div",{class:$.formSectionContainer},x("label",null,_.fileFormatTitle,x("select",{class:v.select,onchange:this._updateFromOption,"data-target-property":"format",bind:this},T))),O=this.viewModel?.templatesInfo?.layout?.choiceList,C=O?.length?O.map((e=>x("option",{key:e,selected:e===o,value:e},_[e]||e))):x("option",{key:"layout-default-option"},_.layoutDefaultOption),L=x("div",{class:$.formSectionContainer},x("label",null,_.layoutTitle,x("select",{class:v.select,onchange:this._updateFromOption,"data-target-property":"layout",bind:this},C))),k=x("div",{class:$.formSectionContainer},x("label",null,_.dpi,x("input",{type:"number",class:this.classes($.inputText,v.input),"data-input-name":"dpi",onchange:this._handleDPIChange,value:`${i}`,min:"1",tabIndex:0,bind:this}))),S=x("div",{class:this.classes($.scaleInfoContainer,$.formSectionContainer)},x("label",null,x("input",{"data-option-name":"scaleEnabled",checked:p,type:"checkbox",tabIndex:0,onchange:this._toggleInputValue,bind:this}),_.scale),x("div",{class:$.scaleInputContainer},x("input",{"aria-label":_.scaleLabel,"aria-valuenow":`${d}`,role:"spinbutton",type:"number",class:this.classes($.inputText,v.input,$.scaleInput),tabIndex:0,"data-input-name":"scale",onchange:this._updateInputValue,disabled:!p,value:`${d}`,bind:this}),x("button",{type:"button","aria-label":_.reset,class:this.classes(v.widgetButton,$.refreshButton,f.refresh),tabIndex:0,onclick:this._resetToCurrentScale,bind:this}))),M=this._advancedOptionsVisibleForLayout?x("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:$.advancedOptionsContainer},S,x("div",{class:this.classes($.authorInfoContainer,$.formSectionContainer)},x("label",null,_.author,x("input",{type:"text",value:t??"",class:this.classes($.inputText,v.input),tabIndex:0,"data-input-name":"author",onchange:this._updateInputValue,bind:this}))),x("div",{class:this.classes($.copyrightInfoContainer,$.formSectionContainer)},x("label",null,_.copyright,x("input",{type:"text",class:this.classes($.inputText,v.input),tabIndex:0,value:a??"","data-input-name":"copyright",onchange:this._updateInputValue,bind:this}))),k,x("div",{class:this.classes($.legendInfoContainer,$.formSectionContainer)},x("label",null,x("input",{type:"checkbox","data-option-name":"legendEnabled",tabIndex:0,checked:l,onchange:this._toggleInputValue,bind:this}),_.legend)),this.viewModel.templateToNorthArrowInfo[o]?x("div",{class:this.classes($.legendInfoContainer,$.formSectionContainer),key:"north-arrow"},x("label",null,x("input",{type:"checkbox","data-option-name":"northArrowEnabled",tabIndex:0,checked:r,onchange:this._toggleInputValue,bind:this}),_.northArrow)):null,this._renderCustomTextElementSection()):null,F=this._advancedOptionsVisibleForMapOnly?x("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:$.advancedOptionsContainer},S,k,x("div",{class:$.formSectionContainer},x("label",null,x("input",{"data-option-name":"attributionEnabled",type:"checkbox",onchange:this._toggleInputValue,tabIndex:0,checked:e,bind:this}),_.attribution)),this._renderCustomTextElementSection()):null,E=this._layoutTabSelected?x("section",{key:"esri-print__layoutContent",id:`${this.id}__layoutContent`,"aria-labelledby":`${this.id}__layoutTab`,class:$.layoutSection,role:"tabpanel"},x("div",{class:$.panelContainer},h,L,this._layoutTabSelected?w:null),x("div",{class:this.classes($.panelContainer,$.advancedOptionsSection)},x("button",{"aria-label":_.advancedOptions,"aria-expanded":this._advancedOptionsVisibleForLayout?"true":"false",class:$.advancedOptionsButton,onclick:this._showAdvancedOptions,bind:this,type:"button"},x("div",{class:$.advancedOptionsButtonContainer},x("span",{"aria-hidden":"true",class:this.classes(f.rightTriangleArrow,$.advancedOptionsButtonIconClosed)}),x("span",{"aria-hidden":"true",class:this.classes(f.leftTriangleArrow,$.advancedOptionsButtonIconClosed_RTL)}),x("span",{"aria-hidden":"true",class:this.classes(f.downArrow,$.advancedOptionsButtonIconOpened)}),x("span",{class:$.advancedOptionsButtonTitle},_.advancedOptions))),M)):x("section",{key:"esri-print__mapOnlyContent",id:`${this.id}__mapOnlyContent`,"aria-labelledby":`${this.id}__mapOnlyTab`,class:$.mapOnlySection,role:"tabpanel"},x("div",{class:$.panelContainer},h,this._layoutTabSelected?null:w,x("div",{class:this.classes($.sizeContainer,$.formSectionContainer)},x("div",{class:$.widthContainer},x("label",null,_.width,x("input",{type:"number",class:this.classes($.inputText,v.input),"data-input-name":"width",onchange:this._updateInputValue,value:`${c}`,tabIndex:0,bind:this}))),x("div",{class:$.heightContainer},x("label",null,_.height,x("input",{type:"number",class:this.classes($.inputText,v.input),"data-input-name":"height",onchange:this._updateInputValue,value:`${n}`,tabIndex:0,bind:this}))),x("button",{type:"button","aria-label":_.swap,class:this.classes(v.widgetButton,$.swapButton,f.swap),onclick:this._switchInput,tabIndex:0,bind:this})),x("div",{class:this.classes($.panelContainer,$.advancedOptionsSection)},x("button",{"aria-label":_.advancedOptions,"aria-expanded":this._advancedOptionsVisibleForMapOnly?"true":"false",type:"button",class:$.advancedOptionsButton,onclick:this._showAdvancedOptions,bind:this},x("div",{class:$.advancedOptionsButtonContainer},x("span",{"aria-hidden":"true",class:this.classes(f.rightTriangleArrow,$.advancedOptionsButtonIconClosed)}),x("span",{"aria-hidden":"true",class:this.classes(f.leftTriangleArrow,$.advancedOptionsButtonIconClosed_RTL)}),x("span",{"aria-hidden":"true",class:this.classes(f.downArrow,$.advancedOptionsButtonIconOpened)}),x("span",{class:$.advancedOptionsButtonTitle},_.advancedOptions))),F))),P=this.exportedLinks.toArray(),V=this._renderExportedLink(P),A={[v.buttonDisabled]:u||!o&&!s},{view:B}=this,D=!B||"2d"!==B.type,N=x("div",{class:$.panelError},D?_.sceneViewError:_.serviceError),j=x("div",null,x("ul",{class:$.layoutTabList,role:"tablist",onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,bind:this},x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,id:`${this.id}__layoutTab`,"data-tab-id":I.layout,class:$.layoutTab,role:"tab",tabIndex:0,"aria-selected":`${this._layoutTabSelected}`},_.layoutTab),x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,id:`${this.id}__mapOnlyTab`,"data-tab-id":I.mapOnly,class:$.layoutTab,role:"tab",tabIndex:0,"aria-selected":`${!this._layoutTabSelected}`},_.mapOnlyTab)),E,x("button",{"aria-label":_.exportDescription,type:"button",class:this.classes($.printButton,v.button,A),disabled:u,tabIndex:0,onclick:this._handlePrintMap,bind:this},_.export),m&&b.defaultTemplates.length>0?this._renderTemplateSectionTrigger():null,x("div",{class:$.exportedFilesContainer,afterUpdate:this._scrollExportIntoView,bind:this},x(y,{class:$.exportedFilesTitle,level:this.headingLevel},_.exportText),P.length>0?null:x("div",null,x("div",null,_.exportHint)),V)),U=x("div",{class:$.printWidgetContainer},x("header",{class:$.headerTitle},_.export),this.error||D||!this.view?N:j),R="initializing"===this.viewModel?.state?this._renderLoader():U;return x("div",{afterCreate:this._handleRootAfterCreate,bind:this,class:this.classes($.base,v.widget,v.panel)},R)}_renderTemplateSectionTrigger(){const{messages:e,_templateListPopover:t}=this,a=t.open;return x("button",{afterCreate:e=>this._selectTemplateNode=e,"aria-controls":a?`${this.id}__template-selection`:"","aria-label":e.selectTemplateDescription,"aria-pressed":a.toString(),class:this.classes(v.button,v.buttonTertiary,$.templateButton),onclick:this._handleSelectTemplateClick,title:e.selectTemplateDescription,type:"button"},e.selectTemplate)}_renderCustomTextElementSection(){const{templateOptions:{customTextElements:e}}=this;return e?x("div",{class:$.formSectionContainer,key:"custom-text-elements"},e.map((e=>{const[t,a]=Object.entries(e)[0];return"date"===t?null:x("label",{key:t},t,x("input",{bind:this,class:this.classes($.inputText,v.input),"data-input-custom":!0,"data-input-name":t,onchange:this._updateInputValue,type:"text",value:a}))}))):null}_renderTemplateList(){const{messages:e,messagesCommon:t,viewModel:a}=this,{defaultTemplates:i}=a,s=e.selectTemplateDescription,n=`${this.id}__template-selection`;return x("div",{class:this.classes($.templateList,v.widget,v.panel),id:n},x(y,{class:v.menuHeader,level:this.headingLevel},e.selectTemplate),x("div",{class:$.templateListScroller},x("ul",{afterCreate:this._handleTemplateListCreation,"aria-activedescendant":`${this.id}__template-item--${this._focusedTemplateIndex}`,"aria-label":s,class:v.menuList,key:"templates",onblur:this._handleTemplateChildBlur,onclick:this._handleTemplateListClick,onkeydown:this._handleTemplateListKeyDown,role:"listbox",tabIndex:0,title:s},i.toArray().map(((t,a)=>{const i=a===this._focusedTemplateIndex,s=t.description??"",n=t.label??"";return x("li",{"aria-label":s,class:this.classes(v.menuItem,{[v.menuItemFocus]:i}),"data-template":t,id:`${this.id}__template-item--${a}`,key:n,title:s},V(n)?e.mapOnlyTab:n)})))),x("div",{class:$.templateListFooter},x("button",{type:"button",class:this.classes(v.button,v.buttonSecondary),onblur:this._handleTemplateChildBlur,onclick:this._handleCloseTemplateSelection},t.done)))}_applyTemplate(e){const{format:t,layout:a,layoutOptions:i}=e,{templateOptions:s}=this;this._templateListPopover.open=!1,this._toggleTab("map-only"===a?I.mapOnly:I.layout,!1),t&&(s.format=t),a&&(s.layout=a),this._focusedTemplateIndex=null,s.legendEnabled=i?.legend??s.legendEnabled,this._handleCloseTemplateSelection()}_renderTitleOrFileNameSection(){const{templateOptions:e,messages:t}=this;let a,i,s,n;return this._layoutTabSelected?(a=t.title,i=t.titlePlaceHolder,s=e.title,n="title"):(a=t.fileName,i=t.fileNamePlaceHolder,s=e.fileName,n="fileName"),x("div",{class:$.formSectionContainer,key:n},x("label",null,a,x("input",{type:"text",tabIndex:0,placeholder:i,class:this.classes($.inputText,v.input),value:s??"","data-input-name":n,onchange:this._updateInputValue,bind:this})))}_handleRootAfterCreate(e){this._rootNode=e,this.addHandles(a(e,"scroll",(()=>{this._templateListPopover.open&&this._handleCloseTemplateSelection()})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;const t=e.getAttribute("data-tab-id");("layoutTab"===t&&this._layoutTabSelected||"mapOnlyTab"===t&&!this._layoutTabSelected)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[$.loader]:this._awaitingServerResponse};return x("div",{class:this.classes(e),key:"loader"})}_createFileLink(e,t){const a=t||this.messages.untitled,i=e.format.toLowerCase(),s=i.includes("png")?"png":i,n=a+s;return void 0!==this._exportedFileNameMap[n]?this._exportedFileNameMap[n]++:this._exportedFileNameMap[n]=0,new m({name:a,extension:s,count:this._exportedFileNameMap[n]})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,a){e.find((e=>{const[a]=Object.entries(e)[0];return a===t}))[t]=a}_updateInputValue(e){const t=e.target,a=t.getAttribute("data-input-name"),i=!!t["data-input-custom"],{templateOptions:s}=this;if(i)return void this._updateCustomTextElementValue(s.customTextElements,a,t.value);let n;if("number"===t.type){if(!P(t.valueAsNumber)){const e=s[a];return void(t.value=`${e}`)}n=t.valueAsNumber}else n=t.value;s[a]=n}_handleDPIChange(e){this._updateInputValue(e);const t=e.currentTarget.valueAsNumber,{height:a,width:i}=E(t),{templateOptions:s}=this;s.height=a,s.width=i}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e}=this,t=this.viewModel.toPrintTemplate(e),a=this._layoutTabSelected?t.layoutOptions?.titleText:e.fileName,i=this._createFileLink(t,a);this.exportedLinks.add(i),this.emit("submit",{link:i}),this.viewModel.print(t).then((e=>{i.set({url:e&&e.url,state:"ready"})})).catch((e=>{i.set({error:e,state:"error"})})).then((()=>{this.emit("complete",{link:i}),this.scheduleRender()}))}_updateFromOption(e){const t=e.target,a=t.selectedOptions?t.selectedOptions.item(0)?.value:t.options[t.selectedIndex].value,i=t.getAttribute("data-target-property");this.templateOptions[i]=a}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_showAdvancedOptions(){this._layoutTabSelected?this._advancedOptionsVisibleForLayout=!this._advancedOptionsVisibleForLayout:this._advancedOptionsVisibleForMapOnly=!this._advancedOptionsVisibleForMapOnly}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;const e=this._rootNode;if(!e)return;const{clientHeight:t,scrollHeight:a}=e,i=a-t;i>0&&(e.scrollTop=i)}_toggleInputValue(e){const t=e.target,a=t.getAttribute("data-option-name");this.templateOptions[a]=t.checked,"scaleEnabled"===a&&(this.templateOptions[a]||this._resetToCurrentScale())}_renderExportedLink(e){const t=this.messages;return e.map((e=>{const{error:a,url:i,state:s}=e,n=e.formattedName??"",o="error"===s,l="pending"===s,d="ready"===s,c={[v.anchorDisabled]:l||o};let u=i||null;u&&(u=r(u));const h=p(i,location.href),m={[f.loadingIndicator]:l,[v.rotating]:l,[f.download]:h&&d,[f.launchLinkExternal]:!h&&d,[f.error]:o,[$.exportedFileError]:o},_={[$.exportedFileError]:o};let b;b=l?t.pending:d?t.ready:t.errorMessage;const y=o?"print-task:cim-symbol-unsupported"===a?.name?t.exportWebMapCIMError:t.exportWebMapError:"";return x("div",{"aria-label":b,class:$.exportedFile,"data-item":e,key:n,onclick:this._removeLink,title:y},x("a",{"aria-label":`${n}. ${t.linkReady}`,download:n,href:u??"",rel:"noreferrer",tabIndex:0,target:"_blank",class:this.classes($.exportedFileLink,v.anchor,c),onclick:this._handleLinkClick},x("span",{class:this.classes(m)}),x("span",{class:this.classes($.exportedFileLinkTitle,_)},n)))}))}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._layoutTabSelected=e===I.layout,this._layoutTabSelected){const e=this.viewModel?.templatesInfo?.layout?.choiceList;this.templateOptions.layout=e?e[0]:"letter-ansi-a-landscape"}else this.templateOptions.layout=L;t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const t=i(e),a=e.target.getAttribute("data-tab-id");if(T(t))return this._toggleTab(a),e.preventDefault(),void e.stopPropagation();"ArrowLeft"!==t&&"ArrowRight"!==t||(this._toggleTab(a===I.layout?I.mapOnly:I.layout),e.preventDefault(),e.stopPropagation())}};function B(e){return e?.["data-template"]}e([d()],A.prototype,"allowedFormats",null),e([d()],A.prototype,"allowedLayouts",null),e([d()],A.prototype,"error",null),e([d({type:C})],A.prototype,"exportedLinks",void 0),e([d()],A.prototype,"extraParameters",null),e([d()],A.prototype,"headingLevel",void 0),e([d()],A.prototype,"iconClass",void 0),e([d()],A.prototype,"icon",void 0),e([d()],A.prototype,"includeDefaultTemplates",null),e([d()],A.prototype,"label",null),e([d(),O("esri/widgets/Print/t9n/Print")],A.prototype,"messages",void 0),e([d(),O("esri/t9n/common")],A.prototype,"messagesCommon",void 0),e([d()],A.prototype,"portal",null),e([d()],A.prototype,"printServiceUrl",null),e([d()],A.prototype,"templateCustomTextElements",null),e([d({type:b})],A.prototype,"templateOptions",void 0),e([d()],A.prototype,"view",null),e([d({type:_})],A.prototype,"viewModel",void 0),A=e([c("esri.widgets.Print")],A);const D=A;export{D as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{on as a,eventKey as i}from"../core/events.js";import{clone as s}from"../core/lang.js";import n from"../core/Logger.js";import{watch as o,initial as l}from"../core/reactiveUtils.js";import{addProxy as r,hasSameOrigin as p}from"../core/urlUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{getToken as u}from"../rest/utils.js";import h from"./Widget.js";import m from"./Print/FileLink.js";import _ from"./Print/PrintViewModel.js";import b from"./Print/TemplateOptions.js";import{globalCss as v}from"./support/globalCss.js";import{Heading as y}from"./support/Heading.js";import{legacyIcon as f}from"./support/legacyIcon.js";import g from"./support/Popover.js";import{isActivationKey as T,keepMenuItemWithinView as w}from"./support/widgetUtils.js";import{messageBundle as O}from"./support/decorators/messageBundle.js";import{tsx as x}from"./support/jsxFactory.js";const C=t.ofType(m),L="MAP_ONLY";var I;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab"}(I||(I={}));const k="esri-print",S=`${k}__advanced-options-button`,$={base:k,widgetIcon:f.printer,headerTitle:`${k}__header-title`,inputText:`${k}__input-text`,layoutTabList:`${k}__layout-tab-list`,layoutTab:`${k}__layout-tab`,layoutSection:`${k}__layout-section`,mapOnlySection:`${k}__map-only-section`,scaleInput:`${k}__scale-input`,templateList:`${k}__template-list`,templateListScroller:`${k}__template-list-scroller`,templateListFooter:`${k}__template-list-footer`,loader:`${k}__loader`,advancedOptionsButton:S,advancedOptionsButtonContainer:`${S}-container`,advancedOptionsButtonTitle:`${S}-title`,advancedOptionsButtonIconOpened:`${S}-icon--opened`,advancedOptionsButtonIconClosed:`${S}-icon--closed`,advancedOptionsButtonIconClosed_RTL:`${S}-icon--closed-rtl`,refreshButton:`${k}__refresh-button`,swapButton:`${k}__swap-button`,linkButton:`${k}__link-button`,printButton:`${k}__export-button`,templateButton:`${k}__template-button`,formSectionContainer:`${k}__form-section-container`,advancedOptionsSection:`${k}__advanced-options-section`,advancedOptionsContainer:`${k}__advanced-options-container`,authorInfoContainer:`${k}__author-info-container`,copyrightInfoContainer:`${k}__copyright-info-container`,exportedFilesContainer:`${k}__export-panel-container`,exportedFilesTitle:`${k}__export-title`,exportedFile:`${k}__exported-file`,exportedFileLink:`${k}__exported-file-link`,exportedFileLinkTitle:`${k}__exported-file-link-title`,heightContainer:`${k}__height-container`,legendInfoContainer:`${k}__legend-info-container`,printWidgetContainer:`${k}__container`,panelContainer:`${k}__panel-container`,scaleInfoContainer:`${k}__scale-info-container`,scaleInputContainer:`${k}__scale-input-container`,sizeContainer:`${k}__size-container`,widthContainer:`${k}__width-container`,panelError:`${k}__panel--error`,exportedFileError:`${k}__exported-file--error`},M="User sets an invalid layout, resetting it to the default valid one...",F="User sets an invalid format, resetting it to the default valid one...";function E(e){const t=8.3333,a=11.4583;return{width:Math.round(e*t),height:Math.round(e*a)}}function P(e){return!isNaN(e)&&e>0}function V(e){return e?.toUpperCase()===L}let A=class extends h{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._advancedOptionsVisibleForLayout=!1,this._advancedOptionsVisibleForMapOnly=!1,this._awaitingServerResponse=!1,this._exportedFileNameMap={},this._focusedTemplateIndex=0,this._layoutTabSelected=!0,this._pendingExportScroll=!1,this._rootNode=null,this._selectTemplateNode=null,this._templateListPopover=new g({owner:this,placement:"top",offset:[0,-100],anchorElement:()=>this._selectTemplateNode,renderContentFunction:this._renderTemplateList}),this.exportedLinks=new C,this.headingLevel=3,this.iconClass=$.widgetIcon,this.icon=null,this.templateOptions=new b,this.viewModel=new _,this._handleTemplateListCreation=e=>e.focus(),this._handleTemplateChildBlur=e=>{const t=e.relatedTarget?.closest(`.${$.templateList}`);t||this._handleCloseTemplateSelection()},this._handleCloseTemplateSelection=()=>{this._focusedTemplateIndex=0,this._templateListPopover.open=!1,this._selectTemplateNode?.focus()},this._handleSelectTemplateClick=()=>{this._focusedTemplateIndex=0,this._templateListPopover.open=!0},this._handleTemplateListClick=e=>{const t=B(e.target);t&&this._applyTemplate(t)},this._handleTemplateListKeyDown=e=>{if(this._focusedTemplateIndex){if(T(e.key))return this._applyTemplate(this.viewModel.defaultTemplates.at(this._focusedTemplateIndex)),void e.preventDefault();if("ArrowDown"===e.key||"ArrowUp"===e.key){const{defaultTemplates:t}=this.viewModel,a="ArrowDown"===e.key?1:-1,i=(this._focusedTemplateIndex+a)%t.length;this._focusedTemplateIndex=i<0?t.length-1:i;const s=e.currentTarget;w(s.querySelectorAll(`.${v.menuItem}`)[this._focusedTemplateIndex],s.parentElement),e.preventDefault()}"Escape"===e.key&&this._handleCloseTemplateSelection()}},this._removeLink=e=>{const t=e.currentTarget["data-item"];t&&"error"===t.state&&this.exportedLinks.remove(t)},this._handleLinkClick=e=>{const t=e.currentTarget,{href:a}=t,i=u(this.viewModel.effectivePrintServiceUrl);if(!i)return;if(!e.isTrusted)return void e.stopPropagation();e.preventDefault();const s=new URL(a);s.searchParams.set("token",i),t.href=s.href,t.click(),t.href=a},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([o((()=>this.viewModel?.templatesInfo),(e=>{const{format:t,layout:a}=this.templateOptions;if(e){const i=a===e.layout.defaultValue||V(a)||e.layout.choiceList&&a&&e.layout.choiceList.includes(a),s=t===e.format.defaultValue||e.format.choiceList&&t&&e.format.choiceList.includes(t);i||(a&&n.getLogger(this).warn(M),this.templateOptions.layout=e.layout.defaultValue),s||(t&&n.getLogger(this).warn(F),this.templateOptions.format=e.format.defaultValue),V(a)&&(this._layoutTabSelected=!1)}}),l),o((()=>this.templateOptions?.format),(e=>{const{viewModel:{templatesInfo:t}}=this;if(t&&e){let a=!1;t.format.choiceList&&t.format.choiceList.forEach((t=>{t.toUpperCase()===e.toUpperCase()&&(this.templateOptions.format=t,a=!0)})),a||(this.templateOptions.format=t.format.defaultValue,n.getLogger(this).warn(F)),this.scheduleRender()}}),l),o((()=>this.templateOptions?.layout),(e=>{const{viewModel:{templatesInfo:t}}=this;if(t&&e){this._layoutTabSelected=!V(e);let a=!this._layoutTabSelected;a||t.layout.choiceList&&t.layout.choiceList.forEach((t=>{t.toUpperCase()===e.toUpperCase()&&(this.templateOptions.layout=t,a=!0)})),a||(this.templateOptions.layout=t.layout.defaultValue,n.getLogger(this).warn(M));const i=this.viewModel.effectiveTemplateCustomTextElements[this.templateOptions.layout];this.templateOptions.customTextElements=i?s(i):null,this.scheduleRender()}}),l),o((()=>this.templateOptions?.dpi),(e=>{e<=0?this.templateOptions.dpi=1:this.scheduleRender()}),l),o((()=>this.viewModel?.view?.scale),(e=>{const{scale:t,scaleEnabled:a}=this.templateOptions;a&&t||(this.templateOptions.scale=e)}),l)]);const{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;const a=setTimeout((()=>{this._awaitingServerResponse=!0,this.scheduleRender()}),500);this.viewModel.load().then((()=>clearTimeout(a)))}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 extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=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 portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=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 view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{attributionEnabled:e,author:t,copyright:a,dpi:i,format:s,height:n,layout:o,legendEnabled:l,northArrowEnabled:r,scaleEnabled:p,scale:d,width:c}=this.templateOptions,u="ready"!==this.viewModel?.state,h=this._renderTitleOrFileNameSection(),{includeDefaultTemplates:m,messages:_,viewModel:b}=this,g=this.viewModel?.templatesInfo?.format?.choiceList||[],T=g.length>0?g.map((e=>x("option",{key:e,selected:e===s,value:e},e.toUpperCase()))):x("option",{key:"format-default-option"},_.formatDefaultOption),w=x("div",{class:$.formSectionContainer},x("label",null,_.fileFormatTitle,x("select",{bind:this,class:v.select,"data-target-property":"format",onchange:this._updateFromOption},T))),O=this.viewModel?.templatesInfo?.layout?.choiceList,C=O?.length?O.map((e=>x("option",{key:e,selected:e===o,value:e},_[e]||e))):x("option",{key:"layout-default-option"},_.layoutDefaultOption),L=x("div",{class:$.formSectionContainer},x("label",null,_.layoutTitle,x("select",{bind:this,class:v.select,"data-target-property":"layout",onchange:this._updateFromOption},C))),k=x("div",{class:$.formSectionContainer},x("label",null,_.dpi,x("input",{bind:this,class:this.classes($.inputText,v.input),"data-input-name":"dpi",min:"1",onchange:this._handleDPIChange,tabIndex:0,type:"number",value:`${i}`}))),S=x("div",{class:this.classes($.scaleInfoContainer,$.formSectionContainer)},x("label",null,x("input",{bind:this,checked:p,"data-option-name":"scaleEnabled",onchange:this._toggleInputValue,tabIndex:0,type:"checkbox"}),_.scale),x("div",{class:$.scaleInputContainer},x("input",{"aria-label":_.scaleLabel,"aria-valuenow":`${d}`,bind:this,class:this.classes($.inputText,v.input,$.scaleInput),"data-input-name":"scale",disabled:!p,onchange:this._updateInputValue,role:"spinbutton",tabIndex:0,type:"number",value:`${d}`}),x("button",{"aria-label":_.reset,bind:this,class:this.classes(v.widgetButton,$.refreshButton,f.refresh),onclick:this._resetToCurrentScale,tabIndex:0,type:"button"}))),M=this._advancedOptionsVisibleForLayout?x("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:$.advancedOptionsContainer},S,x("div",{class:this.classes($.authorInfoContainer,$.formSectionContainer)},x("label",null,_.author,x("input",{bind:this,class:this.classes($.inputText,v.input),"data-input-name":"author",onchange:this._updateInputValue,tabIndex:0,type:"text",value:t??""}))),x("div",{class:this.classes($.copyrightInfoContainer,$.formSectionContainer)},x("label",null,_.copyright,x("input",{bind:this,class:this.classes($.inputText,v.input),"data-input-name":"copyright",onchange:this._updateInputValue,tabIndex:0,type:"text",value:a??""}))),k,x("div",{class:this.classes($.legendInfoContainer,$.formSectionContainer)},x("label",null,x("input",{bind:this,checked:l,"data-option-name":"legendEnabled",onchange:this._toggleInputValue,tabIndex:0,type:"checkbox"}),_.legend)),this.viewModel.templateToNorthArrowInfo[o]?x("div",{class:this.classes($.legendInfoContainer,$.formSectionContainer),key:"north-arrow"},x("label",null,x("input",{bind:this,checked:r,"data-option-name":"northArrowEnabled",onchange:this._toggleInputValue,tabIndex:0,type:"checkbox"}),_.northArrow)):null,this._renderCustomTextElementSection()):null,F=this._advancedOptionsVisibleForMapOnly?x("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:$.advancedOptionsContainer},S,k,x("div",{class:$.formSectionContainer},x("label",null,x("input",{bind:this,checked:e,"data-option-name":"attributionEnabled",onchange:this._toggleInputValue,tabIndex:0,type:"checkbox"}),_.attribution)),this._renderCustomTextElementSection()):null,E=this._layoutTabSelected?x("section",{"aria-labelledby":`${this.id}__layoutTab`,class:$.layoutSection,id:`${this.id}__layoutContent`,key:"esri-print__layoutContent",role:"tabpanel"},x("div",{class:$.panelContainer},h,L,this._layoutTabSelected?w:null),x("div",{class:this.classes($.panelContainer,$.advancedOptionsSection)},x("button",{"aria-expanded":this._advancedOptionsVisibleForLayout?"true":"false","aria-label":_.advancedOptions,bind:this,class:$.advancedOptionsButton,onclick:this._showAdvancedOptions,type:"button"},x("div",{class:$.advancedOptionsButtonContainer},x("span",{"aria-hidden":"true",class:this.classes(f.rightTriangleArrow,$.advancedOptionsButtonIconClosed)}),x("span",{"aria-hidden":"true",class:this.classes(f.leftTriangleArrow,$.advancedOptionsButtonIconClosed_RTL)}),x("span",{"aria-hidden":"true",class:this.classes(f.downArrow,$.advancedOptionsButtonIconOpened)}),x("span",{class:$.advancedOptionsButtonTitle},_.advancedOptions))),M)):x("section",{"aria-labelledby":`${this.id}__mapOnlyTab`,class:$.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:"esri-print__mapOnlyContent",role:"tabpanel"},x("div",{class:$.panelContainer},h,this._layoutTabSelected?null:w,x("div",{class:this.classes($.sizeContainer,$.formSectionContainer)},x("div",{class:$.widthContainer},x("label",null,_.width,x("input",{bind:this,class:this.classes($.inputText,v.input),"data-input-name":"width",onchange:this._updateInputValue,tabIndex:0,type:"number",value:`${c}`}))),x("div",{class:$.heightContainer},x("label",null,_.height,x("input",{bind:this,class:this.classes($.inputText,v.input),"data-input-name":"height",onchange:this._updateInputValue,tabIndex:0,type:"number",value:`${n}`}))),x("button",{"aria-label":_.swap,bind:this,class:this.classes(v.widgetButton,$.swapButton,f.swap),onclick:this._switchInput,tabIndex:0,type:"button"})),x("div",{class:this.classes($.panelContainer,$.advancedOptionsSection)},x("button",{"aria-expanded":this._advancedOptionsVisibleForMapOnly?"true":"false","aria-label":_.advancedOptions,bind:this,class:$.advancedOptionsButton,onclick:this._showAdvancedOptions,type:"button"},x("div",{class:$.advancedOptionsButtonContainer},x("span",{"aria-hidden":"true",class:this.classes(f.rightTriangleArrow,$.advancedOptionsButtonIconClosed)}),x("span",{"aria-hidden":"true",class:this.classes(f.leftTriangleArrow,$.advancedOptionsButtonIconClosed_RTL)}),x("span",{"aria-hidden":"true",class:this.classes(f.downArrow,$.advancedOptionsButtonIconOpened)}),x("span",{class:$.advancedOptionsButtonTitle},_.advancedOptions))),F))),P=this.exportedLinks.toArray(),V=this._renderExportedLink(P),A={[v.buttonDisabled]:u||!o&&!s},{view:B}=this,D=!B||"2d"!==B.type,N=x("div",{class:$.panelError},D?_.sceneViewError:_.serviceError),j=x("div",null,x("ul",{bind:this,class:$.layoutTabList,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,role:"tablist"},x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._layoutTabSelected}`,class:$.layoutTab,"data-tab-id":I.layout,id:`${this.id}__layoutTab`,role:"tab",tabIndex:0},_.layoutTab),x("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${!this._layoutTabSelected}`,class:$.layoutTab,"data-tab-id":I.mapOnly,id:`${this.id}__mapOnlyTab`,role:"tab",tabIndex:0},_.mapOnlyTab)),E,x("button",{"aria-label":_.exportDescription,bind:this,class:this.classes($.printButton,v.button,A),disabled:u,onclick:this._handlePrintMap,tabIndex:0,type:"button"},_.export),m&&b.defaultTemplates.length>0?this._renderTemplateSectionTrigger():null,x("div",{afterUpdate:this._scrollExportIntoView,bind:this,class:$.exportedFilesContainer},x(y,{class:$.exportedFilesTitle,level:this.headingLevel},_.exportText),P.length>0?null:x("div",null,x("div",null,_.exportHint)),V)),U=x("div",{class:$.printWidgetContainer},x("header",{class:$.headerTitle},_.export),this.error||D||!this.view?N:j),R="initializing"===this.viewModel?.state?this._renderLoader():U;return x("div",{afterCreate:this._handleRootAfterCreate,bind:this,class:this.classes($.base,v.widget,v.panel)},R)}_renderTemplateSectionTrigger(){const{messages:e,_templateListPopover:t}=this,a=t.open;return x("button",{afterCreate:e=>this._selectTemplateNode=e,"aria-controls":a?`${this.id}__template-selection`:"","aria-label":e.selectTemplateDescription,"aria-pressed":a.toString(),class:this.classes(v.button,v.buttonTertiary,$.templateButton),onclick:this._handleSelectTemplateClick,title:e.selectTemplateDescription,type:"button"},e.selectTemplate)}_renderCustomTextElementSection(){const{templateOptions:{customTextElements:e}}=this;return e?x("div",{class:$.formSectionContainer,key:"custom-text-elements"},e.map((e=>{const[t,a]=Object.entries(e)[0];return"date"===t?null:x("label",{key:t},t,x("input",{bind:this,class:this.classes($.inputText,v.input),"data-input-custom":!0,"data-input-name":t,onchange:this._updateInputValue,type:"text",value:a}))}))):null}_renderTemplateList(){const{messages:e,messagesCommon:t,viewModel:a}=this,{defaultTemplates:i}=a,s=e.selectTemplateDescription,n=`${this.id}__template-selection`;return x("div",{class:this.classes($.templateList,v.widget,v.panel),id:n},x(y,{class:v.menuHeader,level:this.headingLevel},e.selectTemplate),x("div",{class:$.templateListScroller},x("ul",{afterCreate:this._handleTemplateListCreation,"aria-activedescendant":`${this.id}__template-item--${this._focusedTemplateIndex}`,"aria-label":s,class:v.menuList,key:"templates",onblur:this._handleTemplateChildBlur,onclick:this._handleTemplateListClick,onkeydown:this._handleTemplateListKeyDown,role:"listbox",tabIndex:0,title:s},i.toArray().map(((t,a)=>{const i=a===this._focusedTemplateIndex,s=t.description??"",n=t.label??"";return x("li",{"aria-label":s,class:this.classes(v.menuItem,{[v.menuItemFocus]:i}),"data-template":t,id:`${this.id}__template-item--${a}`,key:n,title:s},V(n)?e.mapOnlyTab:n)})))),x("div",{class:$.templateListFooter},x("button",{class:this.classes(v.button,v.buttonSecondary),onblur:this._handleTemplateChildBlur,onclick:this._handleCloseTemplateSelection,type:"button"},t.done)))}_applyTemplate(e){const{format:t,layout:a,layoutOptions:i}=e,{templateOptions:s}=this;this._templateListPopover.open=!1,this._toggleTab("map-only"===a?I.mapOnly:I.layout,!1),t&&(s.format=t),a&&(s.layout=a),this._focusedTemplateIndex=null,s.legendEnabled=i?.legend??s.legendEnabled,this._handleCloseTemplateSelection()}_renderTitleOrFileNameSection(){const{templateOptions:e,messages:t}=this;let a,i,s,n;return this._layoutTabSelected?(a=t.title,i=t.titlePlaceHolder,s=e.title,n="title"):(a=t.fileName,i=t.fileNamePlaceHolder,s=e.fileName,n="fileName"),x("div",{class:$.formSectionContainer,key:n},x("label",null,a,x("input",{bind:this,class:this.classes($.inputText,v.input),"data-input-name":n,onchange:this._updateInputValue,placeholder:i,tabIndex:0,type:"text",value:s??""})))}_handleRootAfterCreate(e){this._rootNode=e,this.addHandles(a(e,"scroll",(()=>{this._templateListPopover.open&&this._handleCloseTemplateSelection()})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;const t=e.getAttribute("data-tab-id");("layoutTab"===t&&this._layoutTabSelected||"mapOnlyTab"===t&&!this._layoutTabSelected)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[$.loader]:this._awaitingServerResponse};return x("div",{class:this.classes(e),key:"loader"})}_createFileLink(e,t){const a=t||this.messages.untitled,i=e.format.toLowerCase(),s=i.includes("png")?"png":i,n=a+s;return void 0!==this._exportedFileNameMap[n]?this._exportedFileNameMap[n]++:this._exportedFileNameMap[n]=0,new m({name:a,extension:s,count:this._exportedFileNameMap[n]})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,a){e.find((e=>{const[a]=Object.entries(e)[0];return a===t}))[t]=a}_updateInputValue(e){const t=e.target,a=t.getAttribute("data-input-name"),i=!!t["data-input-custom"],{templateOptions:s}=this;if(i)return void this._updateCustomTextElementValue(s.customTextElements,a,t.value);let n;if("number"===t.type){if(!P(t.valueAsNumber)){const e=s[a];return void(t.value=`${e}`)}n=t.valueAsNumber}else n=t.value;s[a]=n}_handleDPIChange(e){this._updateInputValue(e);const t=e.currentTarget.valueAsNumber,{height:a,width:i}=E(t),{templateOptions:s}=this;s.height=a,s.width=i}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e}=this,t=this.viewModel.toPrintTemplate(e),a=this._layoutTabSelected?t.layoutOptions?.titleText:e.fileName,i=this._createFileLink(t,a);this.exportedLinks.add(i),this.emit("submit",{link:i}),this.viewModel.print(t).then((e=>{i.set({url:e&&e.url,state:"ready"})})).catch((e=>{i.set({error:e,state:"error"})})).then((()=>{this.emit("complete",{link:i}),this.scheduleRender()}))}_updateFromOption(e){const t=e.target,a=t.selectedOptions?t.selectedOptions.item(0)?.value:t.options[t.selectedIndex].value,i=t.getAttribute("data-target-property");this.templateOptions[i]=a}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_showAdvancedOptions(){this._layoutTabSelected?this._advancedOptionsVisibleForLayout=!this._advancedOptionsVisibleForLayout:this._advancedOptionsVisibleForMapOnly=!this._advancedOptionsVisibleForMapOnly}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;const e=this._rootNode;if(!e)return;const{clientHeight:t,scrollHeight:a}=e,i=a-t;i>0&&(e.scrollTop=i)}_toggleInputValue(e){const t=e.target,a=t.getAttribute("data-option-name");this.templateOptions[a]=t.checked,"scaleEnabled"===a&&(this.templateOptions[a]||this._resetToCurrentScale())}_renderExportedLink(e){const t=this.messages;return e.map((e=>{const{error:a,url:i,state:s}=e,n=e.formattedName??"",o="error"===s,l="pending"===s,d="ready"===s,c={[v.anchorDisabled]:l||o};let u=i||null;u&&(u=r(u));const h=p(i,location.href),m={[f.loadingIndicator]:l,[v.rotating]:l,[f.download]:h&&d,[f.launchLinkExternal]:!h&&d,[f.error]:o,[$.exportedFileError]:o},_={[$.exportedFileError]:o};let b;b=l?t.pending:d?t.ready:t.errorMessage;const y=o?"print-task:cim-symbol-unsupported"===a?.name?t.exportWebMapCIMError:t.exportWebMapError:"";return x("div",{"aria-label":b,class:$.exportedFile,"data-item":e,key:n,onclick:this._removeLink,title:y},x("a",{"aria-label":`${n}. ${t.linkReady}`,class:this.classes($.exportedFileLink,v.anchor,c),download:n,href:u??"",onclick:this._handleLinkClick,rel:"noreferrer",tabIndex:0,target:"_blank"},x("span",{class:this.classes(m)}),x("span",{class:this.classes($.exportedFileLinkTitle,_)},n)))}))}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._layoutTabSelected=e===I.layout,this._layoutTabSelected){const e=this.viewModel?.templatesInfo?.layout?.choiceList;this.templateOptions.layout=e?e[0]:"letter-ansi-a-landscape"}else this.templateOptions.layout=L;t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const t=i(e),a=e.target.getAttribute("data-tab-id");if(T(t))return this._toggleTab(a),e.preventDefault(),void e.stopPropagation();"ArrowLeft"!==t&&"ArrowRight"!==t||(this._toggleTab(a===I.layout?I.mapOnly:I.layout),e.preventDefault(),e.stopPropagation())}};function B(e){return e?.["data-template"]}e([d()],A.prototype,"allowedFormats",null),e([d()],A.prototype,"allowedLayouts",null),e([d()],A.prototype,"error",null),e([d({type:C})],A.prototype,"exportedLinks",void 0),e([d()],A.prototype,"extraParameters",null),e([d()],A.prototype,"headingLevel",void 0),e([d()],A.prototype,"iconClass",void 0),e([d()],A.prototype,"icon",void 0),e([d()],A.prototype,"includeDefaultTemplates",null),e([d()],A.prototype,"label",null),e([d(),O("esri/widgets/Print/t9n/Print")],A.prototype,"messages",void 0),e([d(),O("esri/t9n/common")],A.prototype,"messagesCommon",void 0),e([d()],A.prototype,"portal",null),e([d()],A.prototype,"printServiceUrl",null),e([d()],A.prototype,"templateCustomTextElements",null),e([d({type:b})],A.prototype,"templateOptions",void 0),e([d()],A.prototype,"view",null),e([d({type:_})],A.prototype,"viewModel",void 0),A=e([c("esri.widgets.Print")],A);const D=A;export{D as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getAssetUrl as e}from"../../assets.js";import"../../intl.js";import{getLocale as n}from"../../intl/locale.js";const s="en-wo",r=n().substr(0,2);var t;!function(e){e.ar="ar",e.bg="bg",e.cs="cs",e.da="da",e.de="de",e.el="el",e.en="en",e.es="es",e.et="et",e.fi="fi",e.fr="fr",e.is="is",e.it="it",e.ja="ja",e.ko="ko",e.lt="lt",e.lv="lv",e.nl="nl",e.nn="nn",e.pl="pl",e.pt="pt",e.ro="ro",e.ru="ru",e.sk="sk",e.sv="sv",e.th="th",e.zh="zh"}(t||(t={}));const i={ae:t.en,ar:t.es,at:t.de,au:t.en,be:t.nl,bg:t.bg,bo:t.es,br:t.pt,ca:t.en,ch:t.de,ci:t.fr,cl:t.es,cn:t.zh,co:t.es,cr:t.es,cz:t.cs,de:t.de,dk:t.da,ee:t.et,eg:t.en,es:t.es,fi:t.fi,fr:t.fr,gb:t.en,gl:t.da,gr:t.el,gt:t.es,hk:t.en,id:t.en,ie:t.en,il:t.en,in:t.en,iq:t.ar,is:t.is,it:t.it,jp:t.ja,ke:t.en,kr:t.ko,kw:t.ar,li:t.de,lt:t.lt,lu:t.en,lv:t.lv,ma:t.fr,mg:t.fr,ml:t.fr,mo:t.en,mx:t.es,my:t.en,ni:t.es,nl:t.nl,no:t.nn,nz:t.en,pe:t.es,pl:t.pl,pr:t.es,pt:t.pt,ro:t.ro,ru:t.ru,rw:t.en,se:t.sv,sg:t.en,sk:t.sk,sr:t.nl,sv:t.es,th:t.th,tn:t.fr,tw:t.zh,us:t.en,ve:t.es,vi:t.en,wo:t.en,za:t.en},l=["ar-iq","ar-kw","bg-bg","cs-cz","da-dk","da-gl","de-at","de-ch","de-de","de-li","el-gr","en-ae","en-au","en-ca","en-eg","en-gb","en-hk","en-id","en-ie","en-il","en-in","en-iq","en-ke","en-lu","en-mo","en-my","en-nz","en-rw","en-sg","en-us","en-vi","en-wo","en-za","es-ar","es-bo","es-cl","es-co","es-cr","es-es","es-gt","es-mx","es-ni","es-pe","es-pr","es-sv","es-ve","et-ee","fi-fi","fr-ci","fr-fr","fr-ma","fr-mg","fr-ml","fr-tn","is-is","it-it","ja-jp","ko-kr","lt-lt","lv-lv","nl-be","nl-nl","nl-sr","nn-no","pl-pl","pt-br","pt-pt","ro-ro","ru-ru","sk-sk","sv-se","th-th","zh-cn","zh-tw"];function
|
|
5
|
+
import{getAssetUrl as e}from"../../assets.js";import"../../intl.js";import{getLocale as n}from"../../intl/locale.js";const s="en-wo",r=n().substr(0,2);var t;!function(e){e.ar="ar",e.bg="bg",e.cs="cs",e.da="da",e.de="de",e.el="el",e.en="en",e.es="es",e.et="et",e.fi="fi",e.fr="fr",e.is="is",e.it="it",e.ja="ja",e.ko="ko",e.lt="lt",e.lv="lv",e.nl="nl",e.nn="nn",e.pl="pl",e.pt="pt",e.ro="ro",e.ru="ru",e.sk="sk",e.sv="sv",e.th="th",e.zh="zh"}(t||(t={}));const i={ae:t.en,ar:t.es,at:t.de,au:t.en,be:t.nl,bg:t.bg,bo:t.es,br:t.pt,ca:t.en,ch:t.de,ci:t.fr,cl:t.es,cn:t.zh,co:t.es,cr:t.es,cz:t.cs,de:t.de,dk:t.da,ee:t.et,eg:t.en,es:t.es,fi:t.fi,fr:t.fr,gb:t.en,gl:t.da,gr:t.el,gt:t.es,hk:t.en,id:t.en,ie:t.en,il:t.en,in:t.en,iq:t.ar,is:t.is,it:t.it,jp:t.ja,ke:t.en,kr:t.ko,kw:t.ar,li:t.de,lt:t.lt,lu:t.en,lv:t.lv,ma:t.fr,mg:t.fr,ml:t.fr,mo:t.en,mx:t.es,my:t.en,ni:t.es,nl:t.nl,no:t.nn,nz:t.en,pe:t.es,pl:t.pl,pr:t.es,pt:t.pt,ro:t.ro,ru:t.ru,rw:t.en,se:t.sv,sg:t.en,sk:t.sk,sr:t.nl,sv:t.es,th:t.th,tn:t.fr,tw:t.zh,us:t.en,ve:t.es,vi:t.en,wo:t.en,za:t.en},l=new Set(["ar-iq","ar-kw","bg-bg","cs-cz","da-dk","da-gl","de-at","de-ch","de-de","de-li","el-gr","en-ae","en-au","en-ca","en-eg","en-gb","en-hk","en-id","en-ie","en-il","en-in","en-iq","en-ke","en-lu","en-mo","en-my","en-nz","en-rw","en-sg","en-us","en-vi","en-wo","en-za","es-ar","es-bo","es-cl","es-co","es-cr","es-es","es-gt","es-mx","es-ni","es-pe","es-pr","es-sv","es-ve","et-ee","fi-fi","fr-ci","fr-fr","fr-ma","fr-mg","fr-ml","fr-tn","is-is","it-it","ja-jp","ko-kr","lt-lt","lv-lv","nl-be","nl-nl","nl-sr","nn-no","pl-pl","pt-br","pt-pt","ro-ro","ru-ru","sk-sk","sv-se","th-th","zh-cn","zh-tw"]);function a(e){return e.toLowerCase()}function o(n){return`url(${e(`esri/widgets/ScaleRangeSlider/images/scalePreview/${n}.jpg`)})`}function c(e){e=a(e);const n=`${r}-${e}`,t=`${i[e]}-${e}`;return o(l.has(n)?n:l.has(t)?t:s)}function f(e){const n=5,s=5;if(e<0||e>=n*s)return;return`-${128*(e%n)}px -${128*Math.floor(e/s)}px`}export{s as fallbackSpriteSheetFileName,c as getScalePreviewSource,f as getScalePreviewSpriteBackgroundPosition,r as languageCode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{on as t}from"../core/events.js";import{destroyMaybe as i}from"../core/maybe.js";import{watch as l,initial as s,when as a}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import{cast as r}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import c from"./Slider.js";import u from"./Widget.js";import{css as m}from"./ScaleRangeSlider/css.js";import{getScalePreviewSource as d,getScalePreviewSpriteBackgroundPosition as p}from"./ScaleRangeSlider/scalePreviewUtils.js";import v from"./ScaleRangeSlider/ScaleRanges.js";import h from"./ScaleRangeSlider/ScaleRangeSliderViewModel.js";import{loadCalciteComponents as S}from"./support/componentsUtils.js";import{globalCss as M}from"./support/globalCss.js";import{storeNode as g}from"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{tsx as _}from"./support/jsxFactory.js";import{formatNumber as b}from"../intl/number.js";import{substitute as w}from"../intl/substitute.js";const x={preview:!0,scaleMenus:{maxScaleMenu:!0,minScaleMenu:!0}},y={maximumFractionDigits:0},T="1:",C=16;let j=class extends u{constructor(e,i){super(e,i),this._activeMenu=null,this._activeThumb=null,this._maxThumbNode=null,this._minThumbNode=null,this._previewAutoCloseTimeoutId=void 0,this._previewPopover=null,this._scaleMenuToggleMax=null,this._scaleMenuToggleMin=null,this._slider=new c({thumbCreatedFunction:(e,i,l)=>{0===e?this._minThumbNode=l:1===e&&(this._maxThumbNode=l),this.addHandles([t(l,"mouseenter",(()=>{this._activeThumb=e,this.scheduleRender()})),t(l,"mouseleave",(()=>{this._previewAutoCloseTimeoutId||(this._activeThumb=null,this.scheduleRender())}))])}}),this.disabled=!1,this.messages=null,this.region="US",this.viewModel=new h,this.visibleElements=x,this._afterMenuListCreate=e=>{e.setFocus()},this._afterComponentCreate=e=>{"value"in e&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"})},this._handleCustomScaleInputChange=(e,t)=>{const{viewModel:{scaleRanges:i}}=this,l=Number.parseFloat(t.value);Number.isNaN(l)?t.value=e:this._setScale(i.clampScale(l))}}loadDependencies(){return S({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover.js")})}initialize(){this.addHandles([l((()=>this.viewModel),(e=>this._slider.viewModel=e?.sliderViewModel??null),s),l((()=>this._interactive),(e=>{this._slider.disabled=!e,e||this._setActiveMenu(null)}),s),this._slider.on("thumb-drag",(({index:e})=>{this._activeThumb=e,clearTimeout(this._previewAutoCloseTimeoutId);const t=250;this._previewAutoCloseTimeoutId=setTimeout((()=>{this._previewAutoCloseTimeoutId=void 0,this._activeThumb=null}),t)})),a((()=>!0===this.view?.stationary),(()=>this.scheduleRender()))])}destroy(){this._slider=i(this._slider)}get _maxScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&e.maxScaleMenu}get _minScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&e.minScaleMenu}get _interactive(){return"disabled"!==this.viewModel?.state&&!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 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 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{...x,...e,scaleMenus:"boolean"==typeof e?.scaleMenus?e.scaleMenus:{...x.scaleMenus,...e?.scaleMenus}}}formatScale(e){return`${T}${b(e,y)}`}render(){const{_interactive:e,_slider:t,label:i,messages:l,view:s,viewModel:{scaleRanges:a,state:n}}=this,r=l.scaleRangeLabels,o=r[a.findScaleRangeByIndex(t.values[0]).id],c=r[a.findScaleRangeByIndex(t.values[1]).id];return _("div",{"aria-label":i,class:this.classes(m.base,M.widget,e?null:M.disabled)},_("div",{class:m.scaleIndicatorWrapper,dir:"ltr"},"ready"===n&&s?this._renderCurrentScaleIndicator():null,t.render(),this._renderPreviewPopover()),_("div",{class:m.scaleMenuContainer},this._minScaleMenuEnabled?this._renderScaleMenuToggle("min",o):null,_("div",{class:m.scaleMenuSeparator}),this._maxScaleMenuEnabled?this._renderScaleMenuToggle("max",c):null))}_renderPreviewPopover(){const{_activeThumb:e}=this,t=null!=e&&this.visibleElements.preview,i=t?0===e?this._minThumbNode:this._maxThumbNode:"";return _("calcite-popover",{afterCreate:g,afterUpdate:()=>this._previewPopover?.reposition(),bind:this,"data-node-ref":"_previewPopover",label:this.messages.preview,offsetDistance:C,open:t,overlayPositioning:"fixed",placement:"top",referenceElement:i,triggerDisabled:!0},this._renderScalePreview())}_renderMinScaleMenu(){const{effectiveMaxScale:e,effectiveMinScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,s=i?i.scale:void 0;return this._renderScaleMenu({type:"min",min:t,max:l.findScaleRange(e).minScale,viewScale:s})}_renderMaxScaleMenu(){const{effectiveMinScale:e,effectiveMaxScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,s=i?i.scale:void 0;return this._renderScaleMenu({type:"max",min:l.findScaleRange(e).maxScale,max:t,viewScale:s})}_renderScalePreview(){const{_activeThumb:e,_slider:t,region:i,viewModel:{scaleRanges:l}}=this,s=0===e?t.values[0]:t.values[1],a=Object.keys(v.RecommendedScales).indexOf(l.findScaleRangeByIndex(s).id),n={backgroundImage:d(i),backgroundPosition:p(a)};return _("div",{class:m.scalePreview},_("div",{class:m.scalePreviewThumbnail,styles:n}))}_renderScaleMenu({viewScale:e,min:t,max:i,type:l}){const{effectiveMaxScale:s,effectiveMinScale:a,messages:n}=this,r="max"===l?s:a,o=v.fromScaleRange({minScale:t,maxScale:i}),c=this.messages.featuredScaleLabels,u=v.RecommendedScales,d=Object.keys(u).filter((e=>o.contains(u[e]))).map((e=>this._renderScaleMenuItem({scaleLabel:c[e],scaleValue:u[e],isSelected:r===u[e],valueVisible:"world"!==e}))),p=`${this.id}__scale-menu--${l}`;return _("div",{class:m.scaleMenu,id:p,key:p},this._renderCurrentScaleValue({currentScale:r}),_("calcite-list",{class:m.scaleMenuScroller,afterCreate:this._afterMenuListCreate,selectionMode:"single-persist",selectionAppearance:"icon"},null!=e?this._renderScaleMenuItem({scaleValue:e,scaleLabel:n.featuredScaleLabels.current,isSelected:r===e,valueVisible:!0}):null,d))}_renderScaleMenuToggle(e,t){const{_activeMenu:i,_interactive:l}=this,s=i===e,a="max"===e?"_scaleMenuToggleMax":"_scaleMenuToggleMin";return[_("calcite-button",{"aria-controls":s?`${this.id}__scale-menu--${e}`:"","aria-pressed":s?"true":"false",class:m.scaleMenuToggle,"data-type":e,key:`${e}-scale-menu-toggle`,disabled:!l,"data-node-ref":a,afterCreate:g,bind:this,appearance:s?"outline":"transparent",scale:"s",iconEnd:"chevron-down"},t),_("calcite-popover",{label:e,open:s,onCalcitePopoverOpen:()=>this._setActiveMenu(e),onCalcitePopoverClose:()=>{this._activeMenu===e&&this._setActiveMenu(null)},overlayPositioning:"fixed",placement:"max"===e?"bottom-end":"bottom-start",referenceElement:this[a],autoClose:!0},s&&"max"===e?this._renderMaxScaleMenu():null,s&&"min"===e?this._renderMinScaleMenu():null)]}_renderCurrentScaleValue({currentScale:e}){const t=Math.round(e).toString();return _("calcite-input-number",{min:0,step:1,scale:"s",max:v.RecommendedScales.world,placeholder:this.messages.customScaleInputTooltip,"aria-label":this.messages.currentScale,groupSeparator:!0,numberButtonType:"none",prefixText:T,inputMode:"numeric",afterCreate:this._afterComponentCreate,key:"value",value:t,onCalciteInputNumberChange:({target:e})=>this._handleCustomScaleInputChange(t,e)})}_renderScaleMenuItem(e){const{scaleValue:t,scaleLabel:i,valueVisible:l,isSelected:s}=e;return _("calcite-list-item",{label:i,description:l?this.formatScale(t):void 0,value:t,bind:this,selected:s,key:i,onCalciteListItemSelect:this._setScale.bind(this,t)})}_renderCurrentScaleIndicator(){const{_slider:e,messages:t,view:i,viewModel:{scaleRanges:l}}=this,s=l.clampScale(i.scale),a=this.viewModel.mapScaleToSlider(s),n=a/e.max,r=t.scaleRangeLabels[l.findScaleRangeByIndex(a).id],o=w(t.currentScaleTooltip,{scaleLabel:r});return _("div",{class:m.scaleIndicatorContainer,key:"scale-indicator"},_("div",{"aria-label":o,class:m.scaleIndicator,styles:{left:100*n+"%"},title:o},_("calcite-icon",{class:m.scaleIndicatorIcon,scale:"s",icon:"caret-up"})))}_setScale(e){"max"===this._activeMenu?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([n()],j.prototype,"_activeThumb",void 0),e([n()],j.prototype,"_maxScaleMenuEnabled",null),e([n()],j.prototype,"_minScaleMenuEnabled",null),e([n()],j.prototype,"_scaleMenuToggleMax",void 0),e([n()],j.prototype,"_scaleMenuToggleMin",void 0),e([n()],j.prototype,"_slider",void 0),e([n({readOnly:!0})],j.prototype,"_interactive",null),e([n()],j.prototype,"disabled",void 0),e([n()],j.prototype,"effectiveMaxScale",null),e([n()],j.prototype,"effectiveMinScale",null),e([n()],j.prototype,"effectiveMaxScaleLimit",null),e([n()],j.prototype,"effectiveMinScaleLimit",null),e([n()],j.prototype,"label",null),e([n()],j.prototype,"layer",null),e([n()],j.prototype,"maxScale",null),e([n()],j.prototype,"maxScaleLimit",null),e([n(),f("esri/widgets/ScaleRangeSlider/t9n/ScaleRangeSlider")],j.prototype,"messages",void 0),e([n()],j.prototype,"minScale",null),e([n()],j.prototype,"minScaleLimit",null),e([n()],j.prototype,"region",void 0),e([n()],j.prototype,"view",null),e([n()],j.prototype,"viewModel",void 0),e([n()],j.prototype,"visibleElements",void 0),e([r("visibleElements")],j.prototype,"castVisibleElements",null),j=e([o("esri.widgets.ScaleRangeSlider")],j);const L=j;export{L as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{on as t}from"../core/events.js";import{destroyMaybe as i}from"../core/maybe.js";import{watch as l,initial as s,when as a}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import{cast as r}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import c from"./Slider.js";import u from"./Widget.js";import{css as m}from"./ScaleRangeSlider/css.js";import{getScalePreviewSource as d,getScalePreviewSpriteBackgroundPosition as p}from"./ScaleRangeSlider/scalePreviewUtils.js";import v from"./ScaleRangeSlider/ScaleRanges.js";import h from"./ScaleRangeSlider/ScaleRangeSliderViewModel.js";import{loadCalciteComponents as S}from"./support/componentsUtils.js";import{globalCss as M}from"./support/globalCss.js";import{storeNode as g}from"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{tsx as _}from"./support/jsxFactory.js";import{formatNumber as b}from"../intl/number.js";import{substitute as w}from"../intl/substitute.js";const x={preview:!0,scaleMenus:{maxScaleMenu:!0,minScaleMenu:!0}},y={maximumFractionDigits:0},T="1:",C=16;let j=class extends u{constructor(e,i){super(e,i),this._activeMenu=null,this._activeThumb=null,this._maxThumbNode=null,this._minThumbNode=null,this._previewAutoCloseTimeoutId=void 0,this._previewPopover=null,this._scaleMenuToggleMax=null,this._scaleMenuToggleMin=null,this._slider=new c({thumbCreatedFunction:(e,i,l)=>{0===e?this._minThumbNode=l:1===e&&(this._maxThumbNode=l),this.addHandles([t(l,"mouseenter",(()=>{this._activeThumb=e,this.scheduleRender()})),t(l,"mouseleave",(()=>{this._previewAutoCloseTimeoutId||(this._activeThumb=null,this.scheduleRender())}))])}}),this.disabled=!1,this.messages=null,this.region="US",this.viewModel=new h,this.visibleElements=x,this._afterMenuListCreate=e=>{e.setFocus()},this._afterComponentCreate=e=>{"value"in e&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"})},this._handleCustomScaleInputChange=(e,t)=>{const{viewModel:{scaleRanges:i}}=this,l=Number.parseFloat(t.value);Number.isNaN(l)?t.value=e:this._setScale(i.clampScale(l))}}loadDependencies(){return S({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover.js")})}initialize(){this.addHandles([l((()=>this.viewModel),(e=>this._slider.viewModel=e?.sliderViewModel??null),s),l((()=>this._interactive),(e=>{this._slider.disabled=!e,e||this._setActiveMenu(null)}),s),this._slider.on("thumb-drag",(({index:e})=>{this._activeThumb=e,clearTimeout(this._previewAutoCloseTimeoutId);const t=250;this._previewAutoCloseTimeoutId=setTimeout((()=>{this._previewAutoCloseTimeoutId=void 0,this._activeThumb=null}),t)})),a((()=>!0===this.view?.stationary),(()=>this.scheduleRender()))])}destroy(){this._slider=i(this._slider)}get _maxScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&e.maxScaleMenu}get _minScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&e.minScaleMenu}get _interactive(){return"disabled"!==this.viewModel?.state&&!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 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 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{...x,...e,scaleMenus:"boolean"==typeof e?.scaleMenus?e.scaleMenus:{...x.scaleMenus,...e?.scaleMenus}}}formatScale(e){return`${T}${b(e,y)}`}render(){const{_interactive:e,_slider:t,label:i,messages:l,view:s,viewModel:{scaleRanges:a,state:n}}=this,r=l.scaleRangeLabels,o=r[a.findScaleRangeByIndex(t.values[0]).id],c=r[a.findScaleRangeByIndex(t.values[1]).id];return _("div",{"aria-label":i,class:this.classes(m.base,M.widget,e?null:M.disabled)},_("div",{class:m.scaleIndicatorWrapper,dir:"ltr"},"ready"===n&&s?this._renderCurrentScaleIndicator():null,t.render(),this._renderPreviewPopover()),_("div",{class:m.scaleMenuContainer},this._minScaleMenuEnabled?this._renderScaleMenuToggle("min",o):null,_("div",{class:m.scaleMenuSeparator}),this._maxScaleMenuEnabled?this._renderScaleMenuToggle("max",c):null))}_renderPreviewPopover(){const{_activeThumb:e}=this,t=null!=e&&this.visibleElements.preview,i=t?0===e?this._minThumbNode:this._maxThumbNode:"";return _("calcite-popover",{afterCreate:g,afterUpdate:()=>this._previewPopover?.reposition(),bind:this,"data-node-ref":"_previewPopover",label:this.messages.preview,offsetDistance:C,open:t,overlayPositioning:"fixed",placement:"top",referenceElement:i,triggerDisabled:!0},this._renderScalePreview())}_renderMinScaleMenu(){const{effectiveMaxScale:e,effectiveMinScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,s=i?i.scale:void 0;return this._renderScaleMenu({type:"min",min:t,max:l.findScaleRange(e).minScale,viewScale:s})}_renderMaxScaleMenu(){const{effectiveMinScale:e,effectiveMaxScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,s=i?i.scale:void 0;return this._renderScaleMenu({type:"max",min:l.findScaleRange(e).maxScale,max:t,viewScale:s})}_renderScalePreview(){const{_activeThumb:e,_slider:t,region:i,viewModel:{scaleRanges:l}}=this,s=0===e?t.values[0]:t.values[1],a=Object.keys(v.RecommendedScales).indexOf(l.findScaleRangeByIndex(s).id),n={backgroundImage:d(i),backgroundPosition:p(a)};return _("div",{class:m.scalePreview},_("div",{class:m.scalePreviewThumbnail,styles:n}))}_renderScaleMenu({viewScale:e,min:t,max:i,type:l}){const{effectiveMaxScale:s,effectiveMinScale:a,messages:n}=this,r="max"===l?s:a,o=v.fromScaleRange({minScale:t,maxScale:i}),c=this.messages.featuredScaleLabels,u=v.RecommendedScales,d=Object.keys(u).filter((e=>o.contains(u[e]))).map((e=>this._renderScaleMenuItem({scaleLabel:c[e],scaleValue:u[e],isSelected:r===u[e],valueVisible:"world"!==e}))),p=`${this.id}__scale-menu--${l}`;return _("div",{class:m.scaleMenu,id:p,key:p},this._renderCurrentScaleValue({currentScale:r}),_("calcite-list",{afterCreate:this._afterMenuListCreate,class:m.scaleMenuScroller,selectionAppearance:"icon",selectionMode:"single-persist"},null!=e?this._renderScaleMenuItem({scaleValue:e,scaleLabel:n.featuredScaleLabels.current,isSelected:r===e,valueVisible:!0}):null,d))}_renderScaleMenuToggle(e,t){const{_activeMenu:i,_interactive:l}=this,s=i===e,a="max"===e?"_scaleMenuToggleMax":"_scaleMenuToggleMin";return[_("calcite-button",{afterCreate:g,appearance:s?"outline":"transparent","aria-controls":s?`${this.id}__scale-menu--${e}`:"","aria-pressed":s?"true":"false",bind:this,class:m.scaleMenuToggle,"data-node-ref":a,"data-type":e,disabled:!l,iconEnd:"chevron-down",key:`${e}-scale-menu-toggle`,scale:"s"},t),_("calcite-popover",{autoClose:!0,label:e,open:s,overlayPositioning:"fixed",placement:"max"===e?"bottom-end":"bottom-start",referenceElement:this[a],onCalcitePopoverClose:()=>{this._activeMenu===e&&this._setActiveMenu(null)},onCalcitePopoverOpen:()=>this._setActiveMenu(e)},s&&"max"===e?this._renderMaxScaleMenu():null,s&&"min"===e?this._renderMinScaleMenu():null)]}_renderCurrentScaleValue({currentScale:e}){const t=Math.round(e).toString();return _("calcite-input-number",{afterCreate:this._afterComponentCreate,"aria-label":this.messages.currentScale,groupSeparator:!0,inputMode:"numeric",key:"value",max:v.RecommendedScales.world,min:0,numberButtonType:"none",placeholder:this.messages.customScaleInputTooltip,prefixText:T,scale:"s",step:1,value:t,onCalciteInputNumberChange:({target:e})=>this._handleCustomScaleInputChange(t,e)})}_renderScaleMenuItem(e){const{scaleValue:t,scaleLabel:i,valueVisible:l,isSelected:s}=e;return _("calcite-list-item",{bind:this,description:l?this.formatScale(t):void 0,key:i,label:i,selected:s,value:t,onCalciteListItemSelect:this._setScale.bind(this,t)})}_renderCurrentScaleIndicator(){const{_slider:e,messages:t,view:i,viewModel:{scaleRanges:l}}=this,s=l.clampScale(i.scale),a=this.viewModel.mapScaleToSlider(s),n=a/e.max,r=t.scaleRangeLabels[l.findScaleRangeByIndex(a).id],o=w(t.currentScaleTooltip,{scaleLabel:r});return _("div",{class:m.scaleIndicatorContainer,key:"scale-indicator"},_("div",{"aria-label":o,class:m.scaleIndicator,styles:{left:100*n+"%"},title:o},_("calcite-icon",{class:m.scaleIndicatorIcon,icon:"caret-up",scale:"s"})))}_setScale(e){"max"===this._activeMenu?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([n()],j.prototype,"_activeThumb",void 0),e([n()],j.prototype,"_maxScaleMenuEnabled",null),e([n()],j.prototype,"_minScaleMenuEnabled",null),e([n()],j.prototype,"_scaleMenuToggleMax",void 0),e([n()],j.prototype,"_scaleMenuToggleMin",void 0),e([n()],j.prototype,"_slider",void 0),e([n({readOnly:!0})],j.prototype,"_interactive",null),e([n()],j.prototype,"disabled",void 0),e([n()],j.prototype,"effectiveMaxScale",null),e([n()],j.prototype,"effectiveMinScale",null),e([n()],j.prototype,"effectiveMaxScaleLimit",null),e([n()],j.prototype,"effectiveMinScaleLimit",null),e([n()],j.prototype,"label",null),e([n()],j.prototype,"layer",null),e([n()],j.prototype,"maxScale",null),e([n()],j.prototype,"maxScaleLimit",null),e([n(),f("esri/widgets/ScaleRangeSlider/t9n/ScaleRangeSlider")],j.prototype,"messages",void 0),e([n()],j.prototype,"minScale",null),e([n()],j.prototype,"minScaleLimit",null),e([n()],j.prototype,"region",void 0),e([n()],j.prototype,"view",null),e([n()],j.prototype,"viewModel",void 0),e([n()],j.prototype,"visibleElements",void 0),e([r("visibleElements")],j.prototype,"castVisibleElements",null),j=e([o("esri.widgets.ScaleRangeSlider")],j);const L=j;export{L as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import t from"../Widget.js";import{css as o}from"./searchResultRendererCSS.js";import l from"./SearchViewModel.js";import{globalCss as i}from"../support/globalCss.js";import{accessibleHandler as u}from"../support/decorators/accessibleHandler.js";import{messageBundle as n}from"../support/decorators/messageBundle.js";import{tsx as c}from"../support/jsxFactory.js";import"../support/widgetUtils.js";let d=class extends t{constructor(e,s){super(e,s),this.messages=null,this.showMoreResultsOpen=!1,this.viewModel=null}destroy(){this.viewModel=null}render(){const e={[o.showMoreResults]:this.showMoreResultsOpen};return c("div",{class:this.classes(o.base,i.widget)},c("div",{
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import t from"../Widget.js";import{css as o}from"./searchResultRendererCSS.js";import l from"./SearchViewModel.js";import{globalCss as i}from"../support/globalCss.js";import{accessibleHandler as u}from"../support/decorators/accessibleHandler.js";import{messageBundle as n}from"../support/decorators/messageBundle.js";import{tsx as c}from"../support/jsxFactory.js";import"../support/widgetUtils.js";let d=class extends t{constructor(e,s){super(e,s),this.messages=null,this.showMoreResultsOpen=!1,this.viewModel=null}destroy(){this.viewModel=null}render(){const e={[o.showMoreResults]:this.showMoreResultsOpen};return c("div",{class:this.classes(o.base,i.widget)},c("div",{class:this.classes(o.moreResults,e),key:"esri-search-renderer__container"},this._renderSearchResultName(),this._renderMoreResults()))}_renderMoreResults(){return c("div",{key:"esri-search-renderer__more-results"},this._renderMoreResultsButton(),this._renderMoreResultsLists())}_renderSearchResultName(){const e=this.viewModel?.selectedResult,s=e&&e.name||"";return c("div",{class:o.moreResultsItem,key:"esri-search-renderer__result-name"},s)}_renderMoreResultsLists(){const{viewModel:e}=this;if(!e)return[];const s=e.results;if((e.resultCount??0)<2)return null;const r=s?.map((e=>this._renderMoreResultsList(e)));return c("div",{class:o.moreResultsList,key:"esri-search-renderer__more-results-container"},r)}_renderMoreResultsButton(){const{messages:e,viewModel:s}=this;if(!s)return null;return(s.resultCount??0)<2?null:c("div",{class:o.moreResultsItem,key:"esri-search-renderer__more-results-button"},c("a",{bind:this,class:i.anchor,href:"#",onclick:this._showMoreResultsClick,onkeydown:this._showMoreResultsClick},this.showMoreResultsOpen?e.hideMoreResults:e.showMoreResults))}_renderMoreResultsHeader(e,s){return c("div",{class:o.moreResultsListHeader,key:`esri-search-result-renderer__header-${s}`},e)}_renderMoreResultsList(e){const{results:s}=e,r=s?.length??0,t=r>0,o=this.viewModel?.selectedResult,l=1===r&&s[0]===o,i=this._getSourceName(e.source,e.sourceIndex),u=(this.viewModel?.results?.length??0)>1&&!l?this._renderMoreResultsHeader(i,e.sourceIndex):null,n=t&&s.map(((e,s)=>this._renderMoreResultsListItem(e,s))),d=t&&!l?c("ul",{key:`esri-search-result-renderer__list-${e.sourceIndex}`},n):null;return t?c("div",{key:`esri-search-result-renderer__results-${e.sourceIndex}`},u,d):null}_renderMoreResultsListItem(e,s){const r=this.viewModel?.selectedResult;return e!==r?c("li",{key:`esri-search-result-renderer__list-item-${s}`},c("a",{bind:this,class:i.anchor,"data-result":e,href:"#",onclick:this._selectResultClick,onkeydown:this._selectResultClick,tabIndex:0},e.name)):null}_showMoreResultsClick(e){e.preventDefault(),this.showMoreResultsOpen=!this.showMoreResultsOpen;const s=this.viewModel?.view?.popup;s&&"reposition"in s&&s.reposition()}_selectResultClick(e){e.preventDefault();const s=e.currentTarget["data-result"];this.viewModel?.select(s)}_getSourceName(e,s){return s===l.ALL_INDEX?this.messages.all:e.name}};e([s(),n("esri/widgets/Search/t9n/Search")],d.prototype,"messages",void 0),e([s()],d.prototype,"showMoreResultsOpen",void 0),e([s()],d.prototype,"viewModel",void 0),e([u()],d.prototype,"_showMoreResultsClick",null),e([u()],d.prototype,"_selectResultClick",null),d=e([r("esri.widgets.Search.SearchResultRenderer")],d);const a=d;export{a as default};
|
package/widgets/Search.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{eventKey as t}from"../core/events.js";import{destroyMaybe as s,abortMaybe as r}from"../core/maybe.js";import{watch as i,on as n,initial as o}from"../core/reactiveUtils.js";import{escapeRegExpString as u}from"../core/string.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import c from"./Widget.js";import{css as d}from"./Search/css.js";import h from"./Search/SearchResultRenderer.js";import g from"./Search/SearchViewModel.js";import{globalCss as p}from"./support/globalCss.js";import{legacyIcon as _}from"./support/legacyIcon.js";import{storeNode as m,keepMenuItemWithinView as v,isActivationKey as M}from"./support/widgetUtils.js";import{messageBundle as S}from"./support/decorators/messageBundle.js";import{vmEvent as w}from"./support/decorators/vmEvent.js";import{tsx as I}from"./support/jsxFactory.js";import{substitute as b}from"../intl/substitute.js";const y=/<[a-z/][\s\S]*>/i,f=(e,t)=>{const s=u(t).split(/\s/),r=new RegExp(`(${s.join("|")})`,"gi");return e.replace(r,(e=>`<strong>${e}</strong>`))};let C=class extends c{constructor(e,t){super(e,t),this._activeMenuItemIndex=-1,this._inputNode=null,this._menuItemCount=0,this._sourceMenuButtonNode=null,this._sourceListNode=null,this._suggestionListNode=null,this._searchResultRenderer=new h,this._suggestController=null,this._searchController=null,this._locateFailed=!1,this._container=null,this.activeMenu="none",this.disabled=!1,this.iconClass=d.widgetIcon,this.icon=null,this.messages=null,this.messagesCommon=null,this.viewModel=new g,this._clearActiveMenu=()=>{this.activeMenu="none"},this._removeActiveMenu=e=>{const t=e.relatedTarget;t&&this._container?.contains(t)||this._clearActiveMenu()},this.addHandles([i((()=>this.searchTerm),(e=>{(e&&"warning"===this.activeMenu||!e&&!this.viewModel?.selectedSuggestion?.location)&&this._clearActiveMenu()})),n((()=>this.viewModel?.allSources),"change",(()=>this._watchSourceChanges())),i((()=>this.activeMenu),(()=>this._resetActiveMenuItemIndex()),o),i((()=>this.viewModel?.defaultPopupTemplate),(e=>{e&&(e.content=this._renderSearchResultsContent.bind(this))}),o)])}destroy(){this._cancelSuggest(),this._cancelSearch(),this._searchResultRenderer=s(this._searchResultRenderer)}get displayedSearchTerm(){return`${this.viewModel.searchTerm}`.trim()}get inputId(){return this._buildId("input")}get suggestionsMenuId(){return this._buildId("suggest-menu")}get sourceMenuId(){return this._buildId("source-menu")}get sourceMenuButtonId(){return this._buildId("source-menu-button")}get activeSource(){return this.viewModel?.activeSource}get activeSourceIndex(){return this.viewModel.activeSourceIndex}set activeSourceIndex(e){this.viewModel.activeSourceIndex=e}get allPlaceholder(){return this.viewModel.allPlaceholder}set allPlaceholder(e){this.viewModel.allPlaceholder=e}get allSources(){return this.viewModel.allSources}get autoNavigate(){return this.viewModel.autoNavigate}set autoNavigate(e){this.viewModel.autoNavigate=e}get autoSelect(){return this.viewModel.autoSelect}set autoSelect(e){this.viewModel.autoSelect=e}get defaultSources(){return this.viewModel.defaultSources}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get includeDefaultSources(){return this.viewModel.includeDefaultSources}set includeDefaultSources(e){this.viewModel.includeDefaultSources=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get locationEnabled(){return this.viewModel.locationEnabled}set locationEnabled(e){this.viewModel.locationEnabled=e}get maxResults(){return this.viewModel.maxResults}set maxResults(e){this.viewModel.maxResults=e}get maxSuggestions(){return this.viewModel.maxSuggestions}set maxSuggestions(e){this.viewModel.maxSuggestions=e}get minSuggestCharacters(){return this.viewModel.minSuggestCharacters}set minSuggestCharacters(e){this.viewModel.minSuggestCharacters=e}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(e){this.viewModel.popupEnabled=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get portal(){return this.viewModel?.portal}set portal(e){this.viewModel&&(this.viewModel.portal=e)}get resultGraphic(){return this.viewModel.resultGraphic}set resultGraphic(e){this.viewModel.resultGraphic=e}get resultGraphicEnabled(){return this.viewModel.resultGraphicEnabled}set resultGraphicEnabled(e){this.viewModel.resultGraphicEnabled=e}get results(){return this.viewModel.results}get searchAllEnabled(){return this.viewModel.searchAllEnabled}set searchAllEnabled(e){this.viewModel.searchAllEnabled=e}get searchTerm(){return this.viewModel.searchTerm}set searchTerm(e){this.viewModel.searchTerm=e}get selectedResult(){return this.viewModel.selectedResult}get sources(){return this.viewModel.sources}set sources(e){this.viewModel.sources=e}get suggestions(){return this.viewModel.suggestions}get suggestionsEnabled(){return this.viewModel.suggestionsEnabled}set suggestionsEnabled(e){this.viewModel.suggestionsEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}clear(){this.viewModel.clear()}focus(){this._inputNode?.focus(),this.emit("search-focus")}blur(){this._inputNode?.blur(),this.emit("search-blur")}async search(e){this._clearActiveMenu(),this._cancelSuggest(),this._cancelSearch();const t=new AbortController,{signal:s}=t;this._searchController=t;try{const r=await this.viewModel.search(e,{signal:s});if(this._searchController!==t)return;return this.activeMenu=r?.numResults?"none":"warning",this._searchController=null,r}catch(r){if(this._searchController!==t)return;return this._clearActiveMenu(),void(this._searchController=null)}}async suggest(e){this._cancelSuggest();const t=new AbortController,{signal:s}=t;this._suggestController=t;try{const r=await this.viewModel.suggest(e,null,{signal:s});if(this._suggestController!==t)return;return this._suggestController=null,r?.numResults&&this._openSuggestionMenu(),this._scrollToTopSuggestion(),r}catch(r){return this._suggestController!==t||(this._suggestController=null),null}}render(){const{state:e}=this.viewModel,t={[p.disabled]:"disabled"===e,[p.widgetDisabled]:this.disabled};return I("div",{class:this.classes(d.base,p.widget,t)},"loading"===e?this._renderLoader():this._renderContainer())}_renderSubmitButton(){const{messages:e,disabled:t}=this;return I("button",{"aria-label":e.searchButtonTitle,bind:this,disabled:t,class:this.classes(d.submitButton,p.widgetButton),key:"esri-search__submit-button",onclick:this._handleSearchButtonClick,title:e.searchButtonTitle,type:"button"},I("span",{"aria-hidden":"true",class:_.search}))}_renderWarningMenu(){return I("div",{key:"esri-search__error-menu",class:this.classes(p.menu,d.warningMenu)},I("div",{class:d.warningMenuBody},this._renderWarning()))}_renderSourceMenuButton(){const{messages:e,activeMenu:t,sourceMenuId:s,sourceMenuButtonId:r,disabled:i}=this,{activeSourceIndex:n,allSources:o}=this.viewModel;return o.length>1?I("button",{id:r,key:"esri-search__source-menu-button",bind:this,disabled:i,"aria-label":e.searchIn,title:e.searchIn,"aria-haspopup":"true","aria-expanded":("source"===t).toString(),"aria-controls":s,class:this.classes(d.sourcesButton,p.widgetButton),onclick:this._handleSourcesMenuToggleClick,onfocus:this._handleSourcesMenuToggleFocus,afterCreate:m,"data-node-ref":"_sourceMenuButtonNode",type:"button"},I("span",{"aria-hidden":"true",class:this.classes(_.downArrow,d.sourcesButtonDown)}),I("span",{"aria-hidden":"true",class:this.classes(_.upArrow,d.sourcesButtonUp)}),I("span",{class:d.sourceName},this._getSourceName(n))):null}_renderSourcesList(){const{allSources:e,searchAllEnabled:t}=this.viewModel,{_activeMenuItemIndex:s,activeMenu:r,sourceMenuId:i,sourceMenuButtonId:n}=this,o="source"===r&&s>-1?this._buildId("source-item",s):null;return e.length>1?I("ul",{"aria-activedescendant":o,"aria-labelledby":n,id:i,role:"menu",bind:this,afterCreate:m,onkeydown:this._handleSourceMenuKeydown,onkeyup:this._handleSourceMenuKeyup,"data-node-ref":"_sourceListNode",class:p.menuList,tabIndex:-1},t?this._renderSource(g.ALL_INDEX):null,e.map(((e,t)=>this._renderSource(t))).toArray()):null}_renderSourcesMenu(){const{allSources:e}=this.viewModel;return e.length>1?I("div",{key:"esri-search__source-menu",class:this.classes(p.menu,d.sourcesMenu)},this._renderSourcesList()):null}_renderLoader(){const{messages:e,messagesCommon:t,disabled:s}=this;return I("div",{class:p.loader,key:"base-loader",tabIndex:s?-1:void 0},I("span",{"aria-hidden":"true",class:p.loaderAnimation}),I("span",{class:_.fontFallbackText},e.searchButtonTitle),I("span",{class:p.loaderText},t.loading))}_renderContainer(){const{allSources:e,state:t}=this.viewModel,{activeMenu:s}=this,r={[d.hasMultipleSources]:e.length>1,[d.isLoading]:"loading"===t,[d.isSearching]:"searching"===t,[d.showWarning]:"warning"===s,[d.showSources]:"source"===s,[d.showSuggestions]:"suggestion"===s};return I("div",{tabIndex:-1,afterCreate:e=>{this._container=e,e.addEventListener("focusout",this._removeActiveMenu)},afterRemoved:e=>{e.removeEventListener("focusout",this._removeActiveMenu)},class:this.classes(r,d.container),key:"base-container"},this._renderSourceMenuButton(),this._renderSourcesMenu(),this._renderInputContainer(),this._renderSubmitButton(),this._renderWarningMenu())}_renderClearButton(){return this.searchTerm?I("button",{bind:this,disabled:this.disabled,class:this.classes(d.clearButton,p.widgetButton),key:"esri-search__clear-button",onclick:this._handleClearButtonClick,onfocus:this._clearActiveMenu,title:this.messages.clearButtonTitle,type:"button"},I("span",{"aria-hidden":"true",class:_.close})):null}_renderLocationGroup(){const{messages:e,locationEnabled:t,displayedSearchTerm:s}=this,r=t&&!s,i="suggestion"===this.activeMenu&&0===this._activeMenuItemIndex;return r?I("ul",{role:"group",key:"esri-search__suggestion-list-current-location",class:this.classes(p.menuList,d.suggestionList,d.suggestionListCurrentLocation)},I("li",{bind:this,"data-current-location-item":!0,onclick:this._handleUseCurrentLocationClick,id:this._buildId("suggestion-item",0),"aria-selected":("suggestion"===this.activeMenu&&0===this._activeMenuItemIndex).toString(),role:"option",class:this.classes(p.menuItem,i?p.menuItemFocus:null)},I("span",{"aria-hidden":"true",class:_.locateCircled})," ",e.useCurrentLocation)):null}_renderInput(){const{activeMenu:e,locationEnabled:t,displayedSearchTerm:s,messages:r,suggestionsMenuId:i,inputId:n,_activeMenuItemIndex:o,disabled:u}=this,{maxInputLength:l,placeholder:a,searchTerm:c,suggestionCount:h}=this.viewModel,g=!(!(t&&!s)&&!h),_="suggestion"===e&&o>-1?this._buildId("suggestion-item",o):null;return I("input",{"aria-activedescendant":_,"aria-autocomplete":"list","aria-expanded":(g&&"suggestion"===e).toString(),"aria-controls":g?i:null,"aria-haspopup":"listbox","aria-label":r.searchButtonTitle,bind:this,disabled:u,placeholder:a,maxlength:l,autocomplete:"off",type:"text",class:this.classes(p.input,d.input),value:c,id:n,role:"combobox",onkeyup:this._handleInputKeyup,onclick:this._openSuggestionMenu,oninput:this._handleInputPaste,onpaste:this._handleInputPaste,afterCreate:m,"data-node-ref":"_inputNode",onfocus:this.focus,onblur:this.blur,title:c?"":a})}_renderForm(){return I("form",{key:"esri-search__form",bind:this,disabled:this.disabled,class:d.form,onsubmit:this._formSubmit,role:"search"},this._renderInput())}_renderSuggestList(e){const{sourceIndex:t}=e,{results:s}=e,r=s?.length;return r?I("ul",{role:"group",key:`esri-search__suggestion-list-${t}`,class:this.classes(p.menuList,d.suggestionList)},s?.map((e=>this._renderSuggestion(e,this._menuItemCount++)))):null}_renderSuggestionsGroup(){const{suggestions:e}=this.viewModel;return e?e.map((e=>[this._renderSuggestionHeader(e),this._renderSuggestList(e)])):[]}_renderSuggestionsMenu(){const{displayedSearchTerm:e,locationEnabled:t,suggestionsMenuId:s,inputId:r}=this,{suggestionCount:i}=this.viewModel,n=t&&!e||i;return this._menuItemCount=0,n?I("div",{id:s,key:"esri-search__suggestions-menu",class:this.classes(p.menu,d.suggestionsMenu),role:"listbox","aria-labelledby":r,bind:this,afterCreate:m,"data-node-ref":"_suggestionListNode"},this._renderLocationGroup(),this._renderSuggestionsGroup()):null}_renderInputContainer(){return I("div",{key:"esri-search__input-container",class:d.inputContainer},this._renderForm(),this._renderSuggestionsMenu(),this._renderClearButton())}_renderSuggestionHeader(e){const{allSources:t,activeSourceIndex:s}=this.viewModel,{sourceIndex:r}=e,i=e.results?.length,n=t.length>1&&s===g.ALL_INDEX;return i&&n?I("div",{key:`esri-search__suggestion-header-${r}`,class:p.menuHeader},this._getSourceName(r)):null}_renderSuggestion(e,t){const{_activeMenuItemIndex:s,viewModel:{searchTerm:r}}=this;if(!r)return;const i="suggestion"===this.activeMenu&&s===t;return I("li",{bind:this,id:this._buildId("suggestion-item",t),"aria-selected":("suggestion"===this.activeMenu&&this._activeMenuItemIndex===t).toString(),onclick:this._handleSuggestionClick,key:`esri-search__suggestion_${t}`,"data-suggestion":e,role:"option",innerHTML:this._getSuggestResultHTML(e.text,r),class:this.classes(p.menuItem,i?p.menuItemFocus:null)})}_renderSource(e){const{activeSourceIndex:t,searchAllEnabled:s}=this.viewModel,r={[p.menuItemActive]:e===t,[p.menuItemFocus]:"source"===this.activeMenu&&e===(s?this._activeMenuItemIndex-1:this._activeMenuItemIndex)},i=s?e+1:e;return I("li",{bind:this,key:`esri-search__source-${e}`,id:this._buildId("source-item",i),"aria-checked":(e===t).toString(),onclick:this._handleSourceClick,"data-source-index":e,role:"menuitemradio",class:this.classes(d.source,p.menuItem,r)},this._getSourceName(e))}_renderNoResultsWarning(e){const{messages:t}=this,s=e?b(t.noResultsFoundForValue,{value:`"${e}"`}):t.noResultsFound;return I("div",{key:"esri-search__no_results"},I("div",{class:d.warningMenuHeader},t.noResults),I("div",{class:d.warningMenuText},s))}_renderEmptySearchWarning(){const{messages:e}=this;return I("div",{key:"esri-search__empty-search"},I("span",{"aria-hidden":"true",class:_.noticeTriangle}),I("span",{class:d.noValueText},e.emptyValue))}_renderLocateWarning(){const{messages:e}=this;return I("div",{key:"esri-search__locate-error"},I("span",{"aria-hidden":"true",class:_.noticeTriangle}),I("span",{class:d.noValueText},e.locateError))}_renderWarning(){const{displayedSearchTerm:e,_locateFailed:t}=this,{viewModel:s}=this;return t?this._renderLocateWarning():s.selectedSuggestion?.location||e?this._renderNoResultsWarning(e):this._renderEmptySearchWarning()}_resetActiveMenuItemIndex(){this._activeMenuItemIndex=-1}_buildId(e,t){return`${this.id}-${e}${void 0===t?"":`-${t}`}`}_watchSourceChanges(){const{viewModel:{allSources:e}}=this,t="sources";this.removeHandles(t),e.forEach((e=>this.addHandles(i((()=>e.name),(()=>this.scheduleRender())),t)))}_handleSourcesMenuToggleFocus(){"source"!==this.activeMenu&&this._clearActiveMenu()}_handleSourcesMenuToggleClick(){const e="source"===this.activeMenu;this.activeMenu=e?"none":"source",this.renderNow(),"source"===this.activeMenu&&this._sourceListNode?.focus()}_handleClearButtonClick(){this.viewModel.clear(),this._focus()}_handleSearchButtonClick(){this.search()}_handleSuggestionClick(e){const t=x(e.currentTarget);t&&(this._focus(),this.search(t))}_handleUseCurrentLocationClick(){this._useCurrentLocation()}_useCurrentLocation(){this._focus("none"),this._cancelSuggest(),this._cancelSearch();const e=new AbortController,{signal:t}=e;this._searchController=e;(async()=>{try{const e=await this.viewModel.searchNearby({signal:t});this.activeMenu=e?.numResults?"none":"warning"}catch(e){this._locateFailed=!0,this.activeMenu="warning"}finally{this._searchController=null}})()}_handleSourceClick(e){this._setSourceFromMenuItem(e.currentTarget)}_setSourceFromMenuItem(e){if(!e)return;const t=T(e);null!=t&&(this.viewModel.activeSourceIndex=t,this._clearActiveMenu(),this._sourceMenuButtonNode?.focus())}_cancelSuggest(){this._suggestController=r(this._suggestController)}_cancelSearch(){this._searchController=r(this._searchController),this._locateFailed=!1}_handleInputKeyup(e){const s=t(e);if(e.ctrlKey||e.metaKey||"Copy"===s||"ArrowLeft"===s||"ArrowRight"===s||"Shift"===s)return;if("Tab"===s||"Escape"===s||e.shiftKey&&"Tab"===s)return this._cancelSuggest(),void("Escape"===s&&this._clearActiveMenu());const r="Home"===s||"End"===s||"ArrowUp"===s||"ArrowDown"===s;if("Enter"===s&&this._activeMenuItemIndex<0)return void this._cancelSuggest();const i=this._suggestionListNode?.getElementsByTagName("li");if(i?.length){if("suggestion"!==this.activeMenu&&this._openSuggestionMenu(),r)return e.preventDefault(),this._cancelSuggest(),void this._handleItemNavigation(s,i,this._suggestionListNode);const t=i[this._activeMenuItemIndex];if("Enter"===s&&t){const e=x(t);return void(e?(this._focus(),this.search(e)):E(t)&&this._useCurrentLocation())}}this.viewModel.searchTerm&&this.suggest()}_handleItemNavigation(e,t,s){const r=this._activeMenuItemIndex;"Home"===e&&(this._activeMenuItemIndex=0),"End"===e&&(this._activeMenuItemIndex=t.length-1),"ArrowUp"===e&&(this._activeMenuItemIndex=this._activeMenuItemIndex<=0?t.length-1:this._activeMenuItemIndex-1),"ArrowDown"===e&&(this._activeMenuItemIndex=this._activeMenuItemIndex===t.length-1?0:this._activeMenuItemIndex+1),r!==this._activeMenuItemIndex&&s&&v(t[this._activeMenuItemIndex],s)}_scrollToTopSuggestion(){this._suggestionListNode&&(this._suggestionListNode.scrollTop=0)}_openSuggestionMenu(){this.activeMenu="suggestion"}_handleInputPaste(e){const t=e.target;this.viewModel.searchTerm!==t.value&&(this.viewModel.searchTerm=t.value),this.viewModel.searchTerm&&this.suggest()}_handleSourceMenuKeydown(e){const s=t(e);if(M(s)){e.preventDefault();const t=this._sourceListNode?.getElementsByTagName("li"),s=t?.[this._activeMenuItemIndex];this._setSourceFromMenuItem(s)}else"ArrowUp"!==s&&"ArrowDown"!==s&&"End"!==s&&"Home"!==s||e.preventDefault()}_handleSourceMenuKeyup(e){const s=t(e),r="ArrowUp"===s||"ArrowDown"===s||"End"===s||"Home"===s;if(r&&e.preventDefault(),"Escape"===s)return this._clearActiveMenu(),void this._sourceMenuButtonNode?.focus();const i=this._sourceListNode?.getElementsByTagName("li");return i&&0!==i.length&&r?("source"!==this.activeMenu&&(this.activeMenu="source"),void this._handleItemNavigation(s,i,this._sourceListNode?.parentElement)):void 0}_focus(e){this.focus(),e&&(this.activeMenu=e)}_formSubmit(e){e.preventDefault(),-1===this._activeMenuItemIndex&&this.search()}_getSourceName(e){const{messages:t}=this,s=this.viewModel,{allSources:r}=s,i=r.at(e);return e===g.ALL_INDEX?t.all:i&&i.name||t.untitledSource}_getSuggestResultHTML(e,t){return e?y.test(e)?e:f(e,t):this.messages.untitledResult}_renderSearchResultsContent(){return this._searchResultRenderer.showMoreResultsOpen=!1,this._searchResultRenderer.viewModel=this.viewModel,this._searchResultRenderer}};function x(e){return e?.["data-suggestion"]}function T(e){return e?.["data-source-index"]}function E(e){return!!e?.["data-current-location-item"]}e([l()],C.prototype,"_activeMenuItemIndex",void 0),e([l()],C.prototype,"displayedSearchTerm",null),e([l({readOnly:!0})],C.prototype,"inputId",null),e([l({readOnly:!0})],C.prototype,"suggestionsMenuId",null),e([l({readOnly:!0})],C.prototype,"sourceMenuId",null),e([l({readOnly:!0})],C.prototype,"sourceMenuButtonId",null),e([l()],C.prototype,"activeMenu",void 0),e([l({readOnly:!0})],C.prototype,"activeSource",null),e([l()],C.prototype,"activeSourceIndex",null),e([l()],C.prototype,"allPlaceholder",null),e([l({readOnly:!0})],C.prototype,"allSources",null),e([l()],C.prototype,"autoNavigate",null),e([l()],C.prototype,"autoSelect",null),e([l({readOnly:!0})],C.prototype,"defaultSources",null),e([l()],C.prototype,"disabled",void 0),e([l()],C.prototype,"goToOverride",null),e([l()],C.prototype,"iconClass",void 0),e([l()],C.prototype,"icon",void 0),e([l()],C.prototype,"includeDefaultSources",null),e([l()],C.prototype,"label",null),e([l()],C.prototype,"locationEnabled",null),e([l()],C.prototype,"maxResults",null),e([l()],C.prototype,"maxSuggestions",null),e([l(),S("esri/widgets/Search/t9n/Search")],C.prototype,"messages",void 0),e([l(),S("esri/t9n/common")],C.prototype,"messagesCommon",void 0),e([l()],C.prototype,"minSuggestCharacters",null),e([l()],C.prototype,"popupEnabled",null),e([l()],C.prototype,"popupTemplate",null),e([l()],C.prototype,"portal",null),e([l()],C.prototype,"resultGraphic",null),e([l()],C.prototype,"resultGraphicEnabled",null),e([l({readOnly:!0})],C.prototype,"results",null),e([l()],C.prototype,"searchAllEnabled",null),e([l()],C.prototype,"searchTerm",null),e([l({readOnly:!0})],C.prototype,"selectedResult",null),e([l()],C.prototype,"sources",null),e([l({readOnly:!0})],C.prototype,"suggestions",null),e([l()],C.prototype,"suggestionsEnabled",null),e([l()],C.prototype,"view",null),e([w(["search-complete","search-clear","search-start","select-result","suggest-start","suggest-complete"]),l({type:g})],C.prototype,"viewModel",void 0),C=e([a("esri.widgets.Search")],C);const L=C;export{L as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{eventKey as t}from"../core/events.js";import{destroyMaybe as s,abortMaybe as r}from"../core/maybe.js";import{watch as i,on as n,initial as o}from"../core/reactiveUtils.js";import{escapeRegExpString as u}from"../core/string.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import c from"./Widget.js";import{css as d}from"./Search/css.js";import h from"./Search/SearchResultRenderer.js";import g from"./Search/SearchViewModel.js";import{globalCss as p}from"./support/globalCss.js";import{legacyIcon as _}from"./support/legacyIcon.js";import{storeNode as m,keepMenuItemWithinView as v,isActivationKey as M}from"./support/widgetUtils.js";import{messageBundle as S}from"./support/decorators/messageBundle.js";import{vmEvent as w}from"./support/decorators/vmEvent.js";import{tsx as I}from"./support/jsxFactory.js";import{substitute as b}from"../intl/substitute.js";const y=/<[a-z/][\s\S]*>/i,f=(e,t)=>{const s=u(t).split(/\s/),r=new RegExp(`(${s.join("|")})`,"gi");return e.replace(r,(e=>`<strong>${e}</strong>`))};let C=class extends c{constructor(e,t){super(e,t),this._activeMenuItemIndex=-1,this._inputNode=null,this._menuItemCount=0,this._sourceMenuButtonNode=null,this._sourceListNode=null,this._suggestionListNode=null,this._searchResultRenderer=new h,this._suggestController=null,this._searchController=null,this._locateFailed=!1,this._container=null,this.activeMenu="none",this.disabled=!1,this.iconClass=d.widgetIcon,this.icon=null,this.messages=null,this.messagesCommon=null,this.viewModel=new g,this._clearActiveMenu=()=>{this.activeMenu="none"},this._removeActiveMenu=e=>{const t=e.relatedTarget;t&&this._container?.contains(t)||this._clearActiveMenu()},this.addHandles([i((()=>this.searchTerm),(e=>{(e&&"warning"===this.activeMenu||!e&&!this.viewModel?.selectedSuggestion?.location)&&this._clearActiveMenu()})),n((()=>this.viewModel?.allSources),"change",(()=>this._watchSourceChanges())),i((()=>this.activeMenu),(()=>this._resetActiveMenuItemIndex()),o),i((()=>this.viewModel?.defaultPopupTemplate),(e=>{e&&(e.content=this._renderSearchResultsContent.bind(this))}),o)])}destroy(){this._cancelSuggest(),this._cancelSearch(),this._searchResultRenderer=s(this._searchResultRenderer)}get displayedSearchTerm(){return`${this.viewModel.searchTerm}`.trim()}get inputId(){return this._buildId("input")}get suggestionsMenuId(){return this._buildId("suggest-menu")}get sourceMenuId(){return this._buildId("source-menu")}get sourceMenuButtonId(){return this._buildId("source-menu-button")}get activeSource(){return this.viewModel?.activeSource}get activeSourceIndex(){return this.viewModel.activeSourceIndex}set activeSourceIndex(e){this.viewModel.activeSourceIndex=e}get allPlaceholder(){return this.viewModel.allPlaceholder}set allPlaceholder(e){this.viewModel.allPlaceholder=e}get allSources(){return this.viewModel.allSources}get autoNavigate(){return this.viewModel.autoNavigate}set autoNavigate(e){this.viewModel.autoNavigate=e}get autoSelect(){return this.viewModel.autoSelect}set autoSelect(e){this.viewModel.autoSelect=e}get defaultSources(){return this.viewModel.defaultSources}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get includeDefaultSources(){return this.viewModel.includeDefaultSources}set includeDefaultSources(e){this.viewModel.includeDefaultSources=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get locationEnabled(){return this.viewModel.locationEnabled}set locationEnabled(e){this.viewModel.locationEnabled=e}get maxResults(){return this.viewModel.maxResults}set maxResults(e){this.viewModel.maxResults=e}get maxSuggestions(){return this.viewModel.maxSuggestions}set maxSuggestions(e){this.viewModel.maxSuggestions=e}get minSuggestCharacters(){return this.viewModel.minSuggestCharacters}set minSuggestCharacters(e){this.viewModel.minSuggestCharacters=e}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(e){this.viewModel.popupEnabled=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get portal(){return this.viewModel?.portal}set portal(e){this.viewModel&&(this.viewModel.portal=e)}get resultGraphic(){return this.viewModel.resultGraphic}set resultGraphic(e){this.viewModel.resultGraphic=e}get resultGraphicEnabled(){return this.viewModel.resultGraphicEnabled}set resultGraphicEnabled(e){this.viewModel.resultGraphicEnabled=e}get results(){return this.viewModel.results}get searchAllEnabled(){return this.viewModel.searchAllEnabled}set searchAllEnabled(e){this.viewModel.searchAllEnabled=e}get searchTerm(){return this.viewModel.searchTerm}set searchTerm(e){this.viewModel.searchTerm=e}get selectedResult(){return this.viewModel.selectedResult}get sources(){return this.viewModel.sources}set sources(e){this.viewModel.sources=e}get suggestions(){return this.viewModel.suggestions}get suggestionsEnabled(){return this.viewModel.suggestionsEnabled}set suggestionsEnabled(e){this.viewModel.suggestionsEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}clear(){this.viewModel.clear()}focus(){this._inputNode?.focus(),this.emit("search-focus")}blur(){this._inputNode?.blur(),this.emit("search-blur")}async search(e){this._clearActiveMenu(),this._cancelSuggest(),this._cancelSearch();const t=new AbortController,{signal:s}=t;this._searchController=t;try{const r=await this.viewModel.search(e,{signal:s});if(this._searchController!==t)return;return this.activeMenu=r?.numResults?"none":"warning",this._searchController=null,r}catch(r){if(this._searchController!==t)return;return this._clearActiveMenu(),void(this._searchController=null)}}async suggest(e){this._cancelSuggest();const t=new AbortController,{signal:s}=t;this._suggestController=t;try{const r=await this.viewModel.suggest(e,null,{signal:s});if(this._suggestController!==t)return;return this._suggestController=null,r?.numResults&&this._openSuggestionMenu(),this._scrollToTopSuggestion(),r}catch(r){return this._suggestController!==t||(this._suggestController=null),null}}render(){const{state:e}=this.viewModel,t={[p.disabled]:"disabled"===e,[p.widgetDisabled]:this.disabled};return I("div",{class:this.classes(d.base,p.widget,t)},"loading"===e?this._renderLoader():this._renderContainer())}_renderSubmitButton(){const{messages:e,disabled:t}=this;return I("button",{"aria-label":e.searchButtonTitle,bind:this,class:this.classes(d.submitButton,p.widgetButton),disabled:t,key:"esri-search__submit-button",onclick:this._handleSearchButtonClick,title:e.searchButtonTitle,type:"button"},I("span",{"aria-hidden":"true",class:_.search}))}_renderWarningMenu(){return I("div",{class:this.classes(p.menu,d.warningMenu),key:"esri-search__error-menu"},I("div",{class:d.warningMenuBody},this._renderWarning()))}_renderSourceMenuButton(){const{messages:e,activeMenu:t,sourceMenuId:s,sourceMenuButtonId:r,disabled:i}=this,{activeSourceIndex:n,allSources:o}=this.viewModel;return o.length>1?I("button",{afterCreate:m,"aria-controls":s,"aria-expanded":("source"===t).toString(),"aria-haspopup":"true","aria-label":e.searchIn,bind:this,class:this.classes(d.sourcesButton,p.widgetButton),"data-node-ref":"_sourceMenuButtonNode",disabled:i,id:r,key:"esri-search__source-menu-button",onclick:this._handleSourcesMenuToggleClick,onfocus:this._handleSourcesMenuToggleFocus,title:e.searchIn,type:"button"},I("span",{"aria-hidden":"true",class:this.classes(_.downArrow,d.sourcesButtonDown)}),I("span",{"aria-hidden":"true",class:this.classes(_.upArrow,d.sourcesButtonUp)}),I("span",{class:d.sourceName},this._getSourceName(n))):null}_renderSourcesList(){const{allSources:e,searchAllEnabled:t}=this.viewModel,{_activeMenuItemIndex:s,activeMenu:r,sourceMenuId:i,sourceMenuButtonId:n}=this,o="source"===r&&s>-1?this._buildId("source-item",s):null;return e.length>1?I("ul",{afterCreate:m,"aria-activedescendant":o,"aria-labelledby":n,bind:this,class:p.menuList,"data-node-ref":"_sourceListNode",id:i,onkeydown:this._handleSourceMenuKeydown,onkeyup:this._handleSourceMenuKeyup,role:"menu",tabIndex:-1},t?this._renderSource(g.ALL_INDEX):null,e.map(((e,t)=>this._renderSource(t))).toArray()):null}_renderSourcesMenu(){const{allSources:e}=this.viewModel;return e.length>1?I("div",{class:this.classes(p.menu,d.sourcesMenu),key:"esri-search__source-menu"},this._renderSourcesList()):null}_renderLoader(){const{messages:e,messagesCommon:t,disabled:s}=this;return I("div",{class:p.loader,key:"base-loader",tabIndex:s?-1:void 0},I("span",{"aria-hidden":"true",class:p.loaderAnimation}),I("span",{class:_.fontFallbackText},e.searchButtonTitle),I("span",{class:p.loaderText},t.loading))}_renderContainer(){const{allSources:e,state:t}=this.viewModel,{activeMenu:s}=this,r={[d.hasMultipleSources]:e.length>1,[d.isLoading]:"loading"===t,[d.isSearching]:"searching"===t,[d.showWarning]:"warning"===s,[d.showSources]:"source"===s,[d.showSuggestions]:"suggestion"===s};return I("div",{afterCreate:e=>{this._container=e,e.addEventListener("focusout",this._removeActiveMenu)},afterRemoved:e=>{e.removeEventListener("focusout",this._removeActiveMenu)},class:this.classes(r,d.container),key:"base-container",tabIndex:-1},this._renderSourceMenuButton(),this._renderSourcesMenu(),this._renderInputContainer(),this._renderSubmitButton(),this._renderWarningMenu())}_renderClearButton(){return this.searchTerm?I("button",{bind:this,class:this.classes(d.clearButton,p.widgetButton),disabled:this.disabled,key:"esri-search__clear-button",onclick:this._handleClearButtonClick,onfocus:this._clearActiveMenu,title:this.messages.clearButtonTitle,type:"button"},I("span",{"aria-hidden":"true",class:_.close})):null}_renderLocationGroup(){const{messages:e,locationEnabled:t,displayedSearchTerm:s}=this,r=t&&!s,i="suggestion"===this.activeMenu&&0===this._activeMenuItemIndex;return r?I("ul",{class:this.classes(p.menuList,d.suggestionList,d.suggestionListCurrentLocation),key:"esri-search__suggestion-list-current-location",role:"group"},I("li",{"aria-selected":("suggestion"===this.activeMenu&&0===this._activeMenuItemIndex).toString(),bind:this,class:this.classes(p.menuItem,i?p.menuItemFocus:null),"data-current-location-item":!0,id:this._buildId("suggestion-item",0),onclick:this._handleUseCurrentLocationClick,role:"option"},I("span",{"aria-hidden":"true",class:_.locateCircled})," ",e.useCurrentLocation)):null}_renderInput(){const{activeMenu:e,locationEnabled:t,displayedSearchTerm:s,messages:r,suggestionsMenuId:i,inputId:n,_activeMenuItemIndex:o,disabled:u}=this,{maxInputLength:l,placeholder:a,searchTerm:c,suggestionCount:h}=this.viewModel,g=!(!(t&&!s)&&!h),_="suggestion"===e&&o>-1?this._buildId("suggestion-item",o):null;return I("input",{afterCreate:m,"aria-activedescendant":_,"aria-autocomplete":"list","aria-controls":g?i:null,"aria-expanded":(g&&"suggestion"===e).toString(),"aria-haspopup":"listbox","aria-label":r.searchButtonTitle,autocomplete:"off",bind:this,class:this.classes(p.input,d.input),"data-node-ref":"_inputNode",disabled:u,id:n,maxlength:l,onblur:this.blur,onclick:this._openSuggestionMenu,onfocus:this.focus,oninput:this._handleInputPaste,onkeyup:this._handleInputKeyup,onpaste:this._handleInputPaste,placeholder:a,role:"combobox",title:c?"":a,type:"text",value:c})}_renderForm(){return I("form",{bind:this,class:d.form,disabled:this.disabled,key:"esri-search__form",onsubmit:this._formSubmit,role:"search"},this._renderInput())}_renderSuggestList(e){const{sourceIndex:t}=e,{results:s}=e,r=s?.length;return r?I("ul",{class:this.classes(p.menuList,d.suggestionList),key:`esri-search__suggestion-list-${t}`,role:"group"},s?.map((e=>this._renderSuggestion(e,this._menuItemCount++)))):null}_renderSuggestionsGroup(){const{suggestions:e}=this.viewModel;return e?e.map((e=>[this._renderSuggestionHeader(e),this._renderSuggestList(e)])):[]}_renderSuggestionsMenu(){const{displayedSearchTerm:e,locationEnabled:t,suggestionsMenuId:s,inputId:r}=this,{suggestionCount:i}=this.viewModel,n=t&&!e||i;return this._menuItemCount=0,n?I("div",{afterCreate:m,"aria-labelledby":r,bind:this,class:this.classes(p.menu,d.suggestionsMenu),"data-node-ref":"_suggestionListNode",id:s,key:"esri-search__suggestions-menu",role:"listbox"},this._renderLocationGroup(),this._renderSuggestionsGroup()):null}_renderInputContainer(){return I("div",{class:d.inputContainer,key:"esri-search__input-container"},this._renderForm(),this._renderSuggestionsMenu(),this._renderClearButton())}_renderSuggestionHeader(e){const{allSources:t,activeSourceIndex:s}=this.viewModel,{sourceIndex:r}=e,i=e.results?.length,n=t.length>1&&s===g.ALL_INDEX;return i&&n?I("div",{class:p.menuHeader,key:`esri-search__suggestion-header-${r}`},this._getSourceName(r)):null}_renderSuggestion(e,t){const{_activeMenuItemIndex:s,viewModel:{searchTerm:r}}=this;if(!r)return;const i="suggestion"===this.activeMenu&&s===t;return I("li",{"aria-selected":("suggestion"===this.activeMenu&&this._activeMenuItemIndex===t).toString(),bind:this,class:this.classes(p.menuItem,i?p.menuItemFocus:null),"data-suggestion":e,id:this._buildId("suggestion-item",t),innerHTML:this._getSuggestResultHTML(e.text,r),key:`esri-search__suggestion_${t}`,onclick:this._handleSuggestionClick,role:"option"})}_renderSource(e){const{activeSourceIndex:t,searchAllEnabled:s}=this.viewModel,r={[p.menuItemActive]:e===t,[p.menuItemFocus]:"source"===this.activeMenu&&e===(s?this._activeMenuItemIndex-1:this._activeMenuItemIndex)},i=s?e+1:e;return I("li",{"aria-checked":(e===t).toString(),bind:this,class:this.classes(d.source,p.menuItem,r),"data-source-index":e,id:this._buildId("source-item",i),key:`esri-search__source-${e}`,onclick:this._handleSourceClick,role:"menuitemradio"},this._getSourceName(e))}_renderNoResultsWarning(e){const{messages:t}=this,s=e?b(t.noResultsFoundForValue,{value:`"${e}"`}):t.noResultsFound;return I("div",{key:"esri-search__no_results"},I("div",{class:d.warningMenuHeader},t.noResults),I("div",{class:d.warningMenuText},s))}_renderEmptySearchWarning(){const{messages:e}=this;return I("div",{key:"esri-search__empty-search"},I("span",{"aria-hidden":"true",class:_.noticeTriangle}),I("span",{class:d.noValueText},e.emptyValue))}_renderLocateWarning(){const{messages:e}=this;return I("div",{key:"esri-search__locate-error"},I("span",{"aria-hidden":"true",class:_.noticeTriangle}),I("span",{class:d.noValueText},e.locateError))}_renderWarning(){const{displayedSearchTerm:e,_locateFailed:t}=this,{viewModel:s}=this;return t?this._renderLocateWarning():s.selectedSuggestion?.location||e?this._renderNoResultsWarning(e):this._renderEmptySearchWarning()}_resetActiveMenuItemIndex(){this._activeMenuItemIndex=-1}_buildId(e,t){return`${this.id}-${e}${void 0===t?"":`-${t}`}`}_watchSourceChanges(){const{viewModel:{allSources:e}}=this,t="sources";this.removeHandles(t),e.forEach((e=>this.addHandles(i((()=>e.name),(()=>this.scheduleRender())),t)))}_handleSourcesMenuToggleFocus(){"source"!==this.activeMenu&&this._clearActiveMenu()}_handleSourcesMenuToggleClick(){const e="source"===this.activeMenu;this.activeMenu=e?"none":"source",this.renderNow(),"source"===this.activeMenu&&this._sourceListNode?.focus()}_handleClearButtonClick(){this.viewModel.clear(),this._focus()}_handleSearchButtonClick(){this.search()}_handleSuggestionClick(e){const t=x(e.currentTarget);t&&(this._focus(),this.search(t))}_handleUseCurrentLocationClick(){this._useCurrentLocation()}_useCurrentLocation(){this._focus("none"),this._cancelSuggest(),this._cancelSearch();const e=new AbortController,{signal:t}=e;this._searchController=e;(async()=>{try{const e=await this.viewModel.searchNearby({signal:t});this.activeMenu=e?.numResults?"none":"warning"}catch(e){this._locateFailed=!0,this.activeMenu="warning"}finally{this._searchController=null}})()}_handleSourceClick(e){this._setSourceFromMenuItem(e.currentTarget)}_setSourceFromMenuItem(e){if(!e)return;const t=T(e);null!=t&&(this.viewModel.activeSourceIndex=t,this._clearActiveMenu(),this._sourceMenuButtonNode?.focus())}_cancelSuggest(){this._suggestController=r(this._suggestController)}_cancelSearch(){this._searchController=r(this._searchController),this._locateFailed=!1}_handleInputKeyup(e){const s=t(e);if(e.ctrlKey||e.metaKey||"Copy"===s||"ArrowLeft"===s||"ArrowRight"===s||"Shift"===s)return;if("Tab"===s||"Escape"===s||e.shiftKey&&"Tab"===s)return this._cancelSuggest(),void("Escape"===s&&this._clearActiveMenu());const r="Home"===s||"End"===s||"ArrowUp"===s||"ArrowDown"===s;if("Enter"===s&&this._activeMenuItemIndex<0)return void this._cancelSuggest();const i=this._suggestionListNode?.getElementsByTagName("li");if(i?.length){if("suggestion"!==this.activeMenu&&this._openSuggestionMenu(),r)return e.preventDefault(),this._cancelSuggest(),void this._handleItemNavigation(s,i,this._suggestionListNode);const t=i[this._activeMenuItemIndex];if("Enter"===s&&t){const e=x(t);return void(e?(this._focus(),this.search(e)):E(t)&&this._useCurrentLocation())}}this.viewModel.searchTerm&&this.suggest()}_handleItemNavigation(e,t,s){const r=this._activeMenuItemIndex;"Home"===e&&(this._activeMenuItemIndex=0),"End"===e&&(this._activeMenuItemIndex=t.length-1),"ArrowUp"===e&&(this._activeMenuItemIndex=this._activeMenuItemIndex<=0?t.length-1:this._activeMenuItemIndex-1),"ArrowDown"===e&&(this._activeMenuItemIndex=this._activeMenuItemIndex===t.length-1?0:this._activeMenuItemIndex+1),r!==this._activeMenuItemIndex&&s&&v(t[this._activeMenuItemIndex],s)}_scrollToTopSuggestion(){this._suggestionListNode&&(this._suggestionListNode.scrollTop=0)}_openSuggestionMenu(){this.activeMenu="suggestion"}_handleInputPaste(e){const t=e.target;this.viewModel.searchTerm!==t.value&&(this.viewModel.searchTerm=t.value),this.viewModel.searchTerm&&this.suggest()}_handleSourceMenuKeydown(e){const s=t(e);if(M(s)){e.preventDefault();const t=this._sourceListNode?.getElementsByTagName("li"),s=t?.[this._activeMenuItemIndex];this._setSourceFromMenuItem(s)}else"ArrowUp"!==s&&"ArrowDown"!==s&&"End"!==s&&"Home"!==s||e.preventDefault()}_handleSourceMenuKeyup(e){const s=t(e),r="ArrowUp"===s||"ArrowDown"===s||"End"===s||"Home"===s;if(r&&e.preventDefault(),"Escape"===s)return this._clearActiveMenu(),void this._sourceMenuButtonNode?.focus();const i=this._sourceListNode?.getElementsByTagName("li");return i&&0!==i.length&&r?("source"!==this.activeMenu&&(this.activeMenu="source"),void this._handleItemNavigation(s,i,this._sourceListNode?.parentElement)):void 0}_focus(e){this.focus(),e&&(this.activeMenu=e)}_formSubmit(e){e.preventDefault(),-1===this._activeMenuItemIndex&&this.search()}_getSourceName(e){const{messages:t}=this,s=this.viewModel,{allSources:r}=s,i=r.at(e);return e===g.ALL_INDEX?t.all:i&&i.name||t.untitledSource}_getSuggestResultHTML(e,t){return e?y.test(e)?e:f(e,t):this.messages.untitledResult}_renderSearchResultsContent(){return this._searchResultRenderer.showMoreResultsOpen=!1,this._searchResultRenderer.viewModel=this.viewModel,this._searchResultRenderer}};function x(e){return e?.["data-suggestion"]}function T(e){return e?.["data-source-index"]}function E(e){return!!e?.["data-current-location-item"]}e([l()],C.prototype,"_activeMenuItemIndex",void 0),e([l()],C.prototype,"displayedSearchTerm",null),e([l({readOnly:!0})],C.prototype,"inputId",null),e([l({readOnly:!0})],C.prototype,"suggestionsMenuId",null),e([l({readOnly:!0})],C.prototype,"sourceMenuId",null),e([l({readOnly:!0})],C.prototype,"sourceMenuButtonId",null),e([l()],C.prototype,"activeMenu",void 0),e([l({readOnly:!0})],C.prototype,"activeSource",null),e([l()],C.prototype,"activeSourceIndex",null),e([l()],C.prototype,"allPlaceholder",null),e([l({readOnly:!0})],C.prototype,"allSources",null),e([l()],C.prototype,"autoNavigate",null),e([l()],C.prototype,"autoSelect",null),e([l({readOnly:!0})],C.prototype,"defaultSources",null),e([l()],C.prototype,"disabled",void 0),e([l()],C.prototype,"goToOverride",null),e([l()],C.prototype,"iconClass",void 0),e([l()],C.prototype,"icon",void 0),e([l()],C.prototype,"includeDefaultSources",null),e([l()],C.prototype,"label",null),e([l()],C.prototype,"locationEnabled",null),e([l()],C.prototype,"maxResults",null),e([l()],C.prototype,"maxSuggestions",null),e([l(),S("esri/widgets/Search/t9n/Search")],C.prototype,"messages",void 0),e([l(),S("esri/t9n/common")],C.prototype,"messagesCommon",void 0),e([l()],C.prototype,"minSuggestCharacters",null),e([l()],C.prototype,"popupEnabled",null),e([l()],C.prototype,"popupTemplate",null),e([l()],C.prototype,"portal",null),e([l()],C.prototype,"resultGraphic",null),e([l()],C.prototype,"resultGraphicEnabled",null),e([l({readOnly:!0})],C.prototype,"results",null),e([l()],C.prototype,"searchAllEnabled",null),e([l()],C.prototype,"searchTerm",null),e([l({readOnly:!0})],C.prototype,"selectedResult",null),e([l()],C.prototype,"sources",null),e([l({readOnly:!0})],C.prototype,"suggestions",null),e([l()],C.prototype,"suggestionsEnabled",null),e([l()],C.prototype,"view",null),e([w(["search-complete","search-clear","search-start","select-result","suggest-start","suggest-complete"]),l({type:g})],C.prototype,"viewModel",void 0),C=e([a("esri.widgets.Search")],C);const L=C;export{L as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../../chunks/tslib.es6.js";import{generateUUID as e}from"../../../core/uuid.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{formatDuration as r}from"../../../intl/duration.js";import i from"../../Widget.js";import{discreteConfiguratorCss as c}from"../css.js";import{Label as l}from"./Label.js";import{LabeledColorPicker as p}from"./LabeledColorPicker.js";import{loadCalciteComponents as a}from"../../support/componentsUtils.js";import"../../support/widgetUtils.js";import{messageBundle as n}from"../../support/decorators/messageBundle.js";import{tsx as m}from"../../support/jsxFactory.js";let d=class extends i{constructor(o){super(o),this.colorPickerVisible=!0,this._selectId=`select-${e()}`,this._colorPickerId=`color-picker-${e()}`,this._onColorChange=o=>{this.options.color=o}}loadDependencies(){return a({label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),option:()=>import("@esri/calcite-components/dist/components/calcite-option.js"),select:()=>import("@esri/calcite-components/dist/components/calcite-select.js")})}render(){const o=this._messages.discrete,e=o.intervalLabel,{color:t,interval:s,intervalOptions:i}=this.options;return m("div",{class:c.base},m(l,{for:this._selectId,label:e},m("calcite-select",{id:this._selectId,label:e,
|
|
5
|
+
import{_ as o}from"../../../chunks/tslib.es6.js";import{generateUUID as e}from"../../../core/uuid.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{formatDuration as r}from"../../../intl/duration.js";import i from"../../Widget.js";import{discreteConfiguratorCss as c}from"../css.js";import{Label as l}from"./Label.js";import{LabeledColorPicker as p}from"./LabeledColorPicker.js";import{loadCalciteComponents as a}from"../../support/componentsUtils.js";import"../../support/widgetUtils.js";import{messageBundle as n}from"../../support/decorators/messageBundle.js";import{tsx as m}from"../../support/jsxFactory.js";let d=class extends i{constructor(o){super(o),this.colorPickerVisible=!0,this._selectId=`select-${e()}`,this._colorPickerId=`color-picker-${e()}`,this._onColorChange=o=>{this.options.color=o}}loadDependencies(){return a({label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),option:()=>import("@esri/calcite-components/dist/components/calcite-option.js"),select:()=>import("@esri/calcite-components/dist/components/calcite-select.js")})}render(){const o=this._messages.discrete,e=o.intervalLabel,{color:t,interval:s,intervalOptions:i}=this.options;return m("div",{class:c.base},m(l,{for:this._selectId,label:e},m("calcite-select",{bind:this,id:this._selectId,label:e,onCalciteSelectChange:this._onIntervalChange},i.toArray().map((o=>m("calcite-option",{key:o,selected:o===s,value:String(o)},r(o)))))),this.colorPickerVisible?m(p,{id:this._colorPickerId,label:o.colorLabel,value:t,onChange:this._onColorChange}):null)}_onIntervalChange(o){const e=parseInt(o.target.selectedOption?.value,10);Number.isFinite(e)&&(this.options.interval=e)}};o([t()],d.prototype,"options",void 0),o([t()],d.prototype,"colorPickerVisible",void 0),o([t(),n("esri/widgets/ShadowCast/t9n/ShadowCast")],d.prototype,"_messages",void 0),d=o([s("esri.widgets.ShadowCast.components.DiscreteConfigurator")],d);export{d as DiscreteConfigurator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../../chunks/tslib.es6.js";import{generateUUID as t}from"../../../core/uuid.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import r from"../../Widget.js";import{durationConfiguratorCss as i}from"../css.js";import{DurationMode as c}from"../DurationMode.js";import{Label as l}from"./Label.js";import{LabeledColorPicker as
|
|
5
|
+
import{_ as o}from"../../../chunks/tslib.es6.js";import{generateUUID as t}from"../../../core/uuid.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import r from"../../Widget.js";import{durationConfiguratorCss as i}from"../css.js";import{DurationMode as c}from"../DurationMode.js";import{Label as l}from"./Label.js";import{LabeledColorPicker as n}from"./LabeledColorPicker.js";import{loadCalciteComponents as a}from"../../support/componentsUtils.js";import"../../support/widgetUtils.js";import{messageBundle as p}from"../../support/decorators/messageBundle.js";import{tsx as m}from"../../support/jsxFactory.js";let u=class extends r{constructor(o){super(o),this.colorPickerVisible=!0,this._modeSelectorId=`mode-selector-${t()}`,this._colorPickerId=`color-picker-${t()}`,this._onColorChange=o=>{this.options.color=o},this._setContinuous=()=>{this.options.mode=c.Continuous},this._setHourly=()=>{this.options.mode=c.Hourly}}loadDependencies(){return a({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js")})}render(){const o=this._messages.duration,{color:t,mode:s}=this.options;return m("div",{class:i.base},m(l,{for:this._modeSelectorId,label:o.modeLabel},m("div",{class:i.radioGroup},m(d,{active:s===c.Continuous,label:o.continuousLabel,onclick:this._setContinuous}),m(d,{active:s===c.Hourly,label:o.hourlyLabel,onclick:this._setHourly}))),this.colorPickerVisible?m(n,{id:this._colorPickerId,label:o.colorLabel,value:t,onChange:this._onColorChange}):null)}};function d({active:o,label:t,...s}){return m("calcite-button",{alignment:"center",appearance:o?"solid":"outline",scale:"s",width:"half",...s},t)}o([s()],u.prototype,"options",void 0),o([s()],u.prototype,"colorPickerVisible",void 0),o([s(),p("esri/widgets/ShadowCast/t9n/ShadowCast")],u.prototype,"_messages",void 0),u=o([e("esri.widgets.ShadowCast.components.DurationConfigurator")],u);export{u as DurationConfigurator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{roundToNearest as o}from"../../../core/mathUtils.js";import{convertTime as s}from"../../../core/timeUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import{formatDuration as i}from"../../../intl/duration.js";import m from"../../Widget.js";import{tooltipCss as a}from"../css.js";import"../../support/widgetUtils.js";import{messageBundle as n}from"../../support/decorators/messageBundle.js";import{tsx as p}from"../../support/jsxFactory.js";import{substitute as c}from"../../../intl/substitute.js";const l=s(1,"minutes","milliseconds"),d=s(15,"minutes","milliseconds");let u=class extends m{constructor(t,o){super(t,o),this.accumulatedShadowTime=null,this._messages=null}render(){const t=this._formattedContent;return p("div",{class:a.base},t
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{roundToNearest as o}from"../../../core/mathUtils.js";import{convertTime as s}from"../../../core/timeUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import{formatDuration as i}from"../../../intl/duration.js";import m from"../../Widget.js";import{tooltipCss as a}from"../css.js";import"../../support/widgetUtils.js";import{messageBundle as n}from"../../support/decorators/messageBundle.js";import{tsx as p}from"../../support/jsxFactory.js";import{substitute as c}from"../../../intl/substitute.js";const l=s(1,"minutes","milliseconds"),d=s(15,"minutes","milliseconds");let u=class extends m{constructor(t,o){super(t,o),this.accumulatedShadowTime=null,this._messages=null}render(){const t=this._formattedContent;return p("div",{class:a.base},t?p("div",{class:a.content},t):null)}get _formattedContent(){const t=this._messages,s=this.accumulatedShadowTime;if(null==t||null==s)return null;const r=o(s,s<d?l:d);return c(t.timeInShadow,{duration:i(r)})}};t([r()],u.prototype,"accumulatedShadowTime",void 0),t([r()],u.prototype,"view",void 0),t([r(),n("esri/widgets/ShadowCast/t9n/ShadowCast")],u.prototype,"_messages",void 0),t([r({readOnly:!0})],u.prototype,"_formattedContent",null),u=t([e("esri.widgets.ShadowCast.components.ShadowTooltipContent")],u);export{u as ShadowTooltipContent};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{watch as s,syncAndInitial as r}from"../../../core/reactiveUtils.js";import{convertTime as t}from"../../../core/timeUtils.js";import{generateUUID as i}from"../../../core/uuid.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{formatNumber as c}from"../../../intl/number.js";import m from"../../Slider.js";import n from"../../Widget.js";import{thresholdConfiguratorCss as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{watch as s,syncAndInitial as r}from"../../../core/reactiveUtils.js";import{convertTime as t}from"../../../core/timeUtils.js";import{generateUUID as i}from"../../../core/uuid.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{formatNumber as c}from"../../../intl/number.js";import m from"../../Slider.js";import n from"../../Widget.js";import{thresholdConfiguratorCss as u}from"../css.js";import{Label as p}from"./Label.js";import{LabeledColorPicker as d}from"./LabeledColorPicker.js";import{loadCalciteComponents as h}from"../../support/componentsUtils.js";import"../../support/widgetUtils.js";import{messageBundle as v}from"../../support/decorators/messageBundle.js";import{tsx as b}from"../../support/jsxFactory.js";let j=class extends n{constructor(e){super(e),this.colorPickerVisible=!0,this._valueSliderId=`value-slider-${i()}`,this._colorPickerId=`color-picker-${i()}`,this._valueSlider=new m({visibleElements:{labels:!1,rangeLabels:!1},steps:t(30,"minutes","milliseconds"),labelFormatFunction:(e,o)=>{const s=t(e,"milliseconds","hours");return"tick"===o?c(s,{maximumFractionDigits:0}):""}}),this._onColorChange=e=>{this.options.color=e}}initialize(){const e=({value:e})=>{this.options.value=e};this.addHandles([s((()=>{const{value:e,minValue:o,maxValue:s}=this.options;return{value:e,minValue:o,maxValue:s}}),(({value:e,minValue:o,maxValue:s})=>{const r=this._valueSlider;r.min=o,r.max=s,r.values=[e];const i=s-o,l=Math.floor(t(i,"milliseconds","hours"));r.tickConfigs=[{mode:"count",values:2*l+1,labelsVisible:!1},{mode:"count",values:l+1,labelsVisible:!0}]}),r),this._valueSlider.on("thumb-change",e),this._valueSlider.on("thumb-drag",e)])}loadDependencies(){return h({label:()=>import("@esri/calcite-components/dist/components/calcite-label.js")})}destroy(){this._valueSlider=o(this._valueSlider)}render(){const e=this._messages.threshold,{color:o}=this.options;return b("div",{class:u.base},b(p,{class:u.valueLabel,for:this._valueSliderId,label:e.valueLabel},this._valueSlider.render()),this.colorPickerVisible?b(d,{id:this._colorPickerId,label:e.colorLabel,value:o,onChange:this._onColorChange}):null)}get testData(){return{valueSlider:this._valueSlider}}};e([l()],j.prototype,"options",void 0),e([l()],j.prototype,"colorPickerVisible",void 0),e([l()],j.prototype,"testData",null),e([l()],j.prototype,"_valueSlider",void 0),e([l(),v("esri/widgets/ShadowCast/t9n/ShadowCast")],j.prototype,"_messages",void 0),j=e([a("esri.widgets.ShadowCast.components.ThresholdConfigurator")],j);export{j as ThresholdConfigurator};
|
package/widgets/ShadowCast.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{destroyMaybe as i}from"../core/maybe.js";import{watch as t,syncAndInitial as s}from"../core/reactiveUtils.js";import{convertTime as o}from"../core/timeUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{destroyMaybe as i}from"../core/maybe.js";import{watch as t,syncAndInitial as s}from"../core/reactiveUtils.js";import{convertTime as o}from"../core/timeUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{substitute as a}from"../intl/substitute.js";import n from"./Slider.js";import d from"./Widget.js";import{css as m}from"./ShadowCast/css.js";import{ShadowCastState as c}from"./ShadowCast/ShadowCastState.js";import p from"./ShadowCast/ShadowCastViewModel.js";import h from"./ShadowCast/ShadowCastVisibleElements.js";import{ShadowVisualizationType as u}from"./ShadowCast/ShadowVisualizationType.js";import{DiscreteConfigurator as v}from"./ShadowCast/components/DiscreteConfigurator.js";import{DurationConfigurator as w}from"./ShadowCast/components/DurationConfigurator.js";import{ShadowTooltip as f}from"./ShadowCast/components/ShadowTooltip.js";import{ThresholdConfigurator as g}from"./ShadowCast/components/ThresholdConfigurator.js";import{loadCalciteComponents as b}from"./support/componentsUtils.js";import y from"./support/DatePicker.js";import{globalCss as S}from"./support/globalCss.js";import{Heading as C}from"./support/Heading.js";import{formatSliderLabel as _}from"./support/timeWidgetUtils.js";import{TimezonePicker as T}from"./support/TimezonePicker.js";import"./support/widgetUtils.js";import{messageBundle as j}from"./support/decorators/messageBundle.js";import{tsx as M}from"./support/jsxFactory.js";import{formatDate as k}from"../intl/date.js";var D;!function(e){e.Slider="slider"}(D||(D={}));const z={hour:"2-digit",minute:"2-digit",timeZone:"UTC"},V=/(.*)\s(.*)/,O={labelFormatFunction:_,min:0,max:1439,steps:15,rangeLabelInputsEnabled:!1,visibleElements:{labels:!1,rangeLabels:!1},tickConfigs:[{mode:"position",values:[0,360,720,1080,1439],labelsVisible:!0,tickCreatedFunction:(e,i,t)=>{i.classList.add(S.primaryTick),t.classList.add(S.primaryTickLabel);const s=t.innerText.match(V);s&&(t.innerHTML=`${s[1]}<br><div class="${S.primaryTickAmPm}">${s[2]}</div>`)}},{mode:"position",values:[120,240,480,600,840,960,1200,1320],tickCreatedFunction:(e,i)=>{i.classList.add(S.secondaryTick)}}]};let L=class extends d{constructor(e,i){super(e,i),this.viewModel=null,this.headingLevel=4,this.iconClass=m.widgetIcon,this.icon=null,this.visibleElements=new h,this._defaultViewModel=null,this._timeSlider=new n({...O,container:document.createElement("div")}),this._tooltip=null,this._onTimezoneChange=e=>{this.viewModel.utcOffset=e},this._onDateChange=e=>{this.viewModel.date=e},e?.viewModel||(this._defaultViewModel=new p({view:e?.view}),this.viewModel=this._defaultViewModel)}initialize(){this.addHandles([t((()=>({viewModel:this.viewModel,slider:this._timeSlider})),(e=>this._connectTimeSlider(e)),s),t((()=>({container:this.view?.surface,viewModel:this.viewModel,tooltipVisible:this.visibleElements.tooltip})),(({container:e,viewModel:t,tooltipVisible:s})=>{this._tooltip=i(this._tooltip),null!=e&&s&&(this._tooltip=new f({viewModel:t,container:e}))}),s),t((()=>({viewModel:this.viewModel,visible:this.visible})),(({viewModel:e,visible:i})=>e.setRunning(i)),s)])}destroy(){this._timeSlider=i(this._timeSlider),null!=this._defaultViewModel&&this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy()}loadDependencies(){return b({select:()=>import("@esri/calcite-components/dist/components/calcite-select.js"),option:()=>import("@esri/calcite-components/dist/components/calcite-option.js")})}render(){const{visibleElements:e,viewModel:i}=this,t=i.state===c.Disabled;return M("div",{class:this.classes(m.base,S.widget,S.panel,{[S.widgetDisabled]:t}),key:this},this._renderTimeRangeSection(),e.visualizationOptions?this._renderVisualizationOptionsSection():null)}get view(){return this.viewModel?.view}set view(e){this.viewModel&&(this.viewModel.view=e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get testData(){return{tooltip:this._tooltip}}_connectTimeSlider({viewModel:e,slider:i}){if(this.removeHandles(D.Slider),null==i)return;const r=e=>o(e,"milliseconds","minutes"),l=e=>o(e,"minutes","milliseconds"),a=({index:i,value:t})=>{0===i?e.startTimeOfDay=l(t):e.endTimeOfDay=l(t)};this.addHandles([t((()=>[e.startTimeOfDay,e.endTimeOfDay]),(e=>{i.values=e.map(r)}),s),i.on("thumb-change",a),i.on("thumb-drag",a),i.on("segment-drag",(()=>{[e.startTimeOfDay,e.endTimeOfDay]=i.values.map(l)}))],D.Slider)}_renderTimeRangeSection(){const{visibleElements:e}=this;return e.timeRangeSlider||e.datePicker?M("section",{class:m.timeRange,key:"time-range"},M(C,{level:this.headingLevel},this.messages.timeLabel),e.timeRangeSlider?this._renderTimeRange():null,e.datePicker?this._renderDatePicker():null):null}_renderTimeRange(){const{messages:e,viewModel:i,visibleElements:t}=this,{startTimeOfDay:s,endTimeOfDay:o}=i,[r,l]=[s,o].map((e=>k(new Date(e),z)));return[M("div",{class:m.timeRangeIndicator,key:"time-range-indicator"},a(e.timeRange,{start:r,end:l}),t.timezone?M(T,{value:i.utcOffset,onChange:this._onTimezoneChange}):null),M("div",{afterCreate:this._timeSliderContainerAfterCreate,afterRemoved:this._timeSliderContainerAfterRemoved,bind:this,key:"time-slider-container"})]}_timeSliderContainerAfterCreate(e){const i=this._timeSlider?.container;i&&e.appendChild(i)}_timeSliderContainerAfterRemoved(e){const i=this._timeSlider?.container;i&&e.removeChild(i)}_renderDatePicker(){return M("div",{class:m.datePickerContainer,key:"date-picker"},M(y,{value:this.viewModel.date,onChange:this._onDateChange}))}_renderVisualizationOptionsSection(){const{headingLevel:e,messages:i,viewModel:t,visibleElements:s}=this,o=s.colorPicker,r=e=>this.classes(t.visualizationType===e?null:m.visualizationConfigHidden);return M("section",{class:m.visualization,key:"visualization"},M(C,{level:e},i.visualizationLabel),this._renderVisualizationSelect(),M("div",{class:r(u.Threshold),key:"threshold-configurator"},M(g,{colorPickerVisible:o,options:t.thresholdOptions})),M("div",{class:r(u.Duration),key:"duration-configurator"},M(w,{colorPickerVisible:o,options:t.durationOptions})),M("div",{class:r(u.Discrete),key:"discrete-configurator"},M(v,{colorPickerVisible:o,options:t.discreteOptions})))}_renderVisualizationSelect(){const e=this.messages,i=this.viewModel.visualizationType;return M("calcite-select",{bind:this,class:m.visualizationSelect,key:"visualization-select",label:e.visualizationLabel,onCalciteSelectChange:this._onVisualizationTypeChange},[{type:u.Threshold,label:e.threshold.label},{type:u.Duration,label:e.duration.label},{type:u.Discrete,label:e.discrete.label}].map((({type:e,label:t})=>M("calcite-option",{selected:e===i,value:e},t))))}_onVisualizationTypeChange(e){const i=e.target.selectedOption?.value;this.viewModel.visualizationType=i??u.Threshold}};e([r()],L.prototype,"viewModel",void 0),e([r()],L.prototype,"view",null),e([r()],L.prototype,"headingLevel",void 0),e([r()],L.prototype,"iconClass",void 0),e([r()],L.prototype,"icon",void 0),e([r()],L.prototype,"label",null),e([r({type:h,nonNullable:!0})],L.prototype,"visibleElements",void 0),e([r(),j("esri/widgets/ShadowCast/t9n/ShadowCast")],L.prototype,"messages",void 0),e([r()],L.prototype,"_defaultViewModel",void 0),e([r()],L.prototype,"_timeSlider",void 0),e([r()],L.prototype,"_tooltip",void 0),L=e([l("esri.widgets.ShadowCast")],L);const R=L;export{R as default};
|