@arcgis/core 5.1.0-next.111 → 5.1.0-next.113
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/analysis/ElevationProfile/ElevationProfileGroup.d.ts +3 -0
- package/analysis/ElevationProfile/ElevationProfileLineQuery.d.ts +1 -0
- package/analysis/ElevationProfileAnalysis.d.ts +5 -0
- package/analysis/ShadowCast/DiscreteOptions.d.ts +2 -2
- package/analysis/ShadowCast/TotalDurationOptions.d.ts +13 -4
- package/analysis/ShadowCastAnalysis.d.ts +8 -5
- package/arcade/Dictionary.js +1 -1
- package/arcade/Feature.js +1 -1
- package/arcade/Pixel.js +1 -1
- package/arcade/Voxel.js +1 -1
- package/arcade/arcade.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeEnvironment.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/compilerUtils.js +1 -1
- package/arcade/containerUtils.js +1 -1
- package/arcade/debug.js +1 -1
- package/arcade/enum.js +1 -1
- package/arcade/executionError.js +1 -1
- package/arcade/functions/convertdirection.js +1 -1
- package/arcade/functions/date.js +1 -1
- package/arcade/functions/feature.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/arcade/functions/featuresetstats.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geometry.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/arcade/functions/knowledgegraph.js +1 -1
- package/arcade/functions/maths.js +1 -1
- package/arcade/functions/stats.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade/functions/track.js +1 -1
- package/arcade/geometry/constructors.js +1 -1
- package/arcade/geometry/functions.js +1 -1
- package/arcade/geometry/unitConversion.js +1 -1
- package/arcade.js +1 -1
- package/assets/components/assets/icon/returnToDefault16.json +1 -0
- package/assets/components/assets/icon/returnToDefault24.json +1 -0
- package/assets/components/assets/icon/returnToDefault32.json +1 -0
- package/assets/components/assets/icon/reviewMap16.json +1 -0
- package/assets/components/assets/icon/reviewMap24.json +1 -0
- package/assets/components/assets/icon/reviewMap32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{622bdd1b9d5d292ec12b.js → 02c0640005b09007bb70.js} +1 -1
- package/assets/esri/core/workers/chunks/0b76534b60014d74ecb9.js +1 -0
- package/assets/esri/core/workers/chunks/{34e026549ba2822b8ebd.js → 13d43a0683c42b94feb6.js} +1 -1
- package/assets/esri/core/workers/chunks/{4f9ea7544b2d0e88a05c.js → 13f0e08de2dfab07d212.js} +1 -1
- package/assets/esri/core/workers/chunks/{35bbd63319d8aa9f31cc.js → 169c9eb6cd000e067c4b.js} +1 -1
- package/assets/esri/core/workers/chunks/{d4014213c476bf8099af.js → 18c4207b1cb0777560ba.js} +1 -1
- package/assets/esri/core/workers/chunks/{58c15c42e6a618386a2f.js → 1c8c8050d60205cf2156.js} +1 -1
- package/assets/esri/core/workers/chunks/1f537c05c2f643acb5e7.js +1 -0
- package/assets/esri/core/workers/chunks/241aeff6afd074ce105b.js +1 -0
- package/assets/esri/core/workers/chunks/{beff5b4e15edee12bd4c.js → 271e42b7cd3c3441839e.js} +3 -3
- package/assets/esri/core/workers/chunks/{ddebc1dc10a2d207389f.js → 282f3d364411efac7b80.js} +1 -1
- package/assets/esri/core/workers/chunks/{d6d5ee9d0d998d730f81.js → 2bd334f9ab89334df713.js} +1 -1
- package/assets/esri/core/workers/chunks/32f128a1615d71bbe899.js +2 -0
- package/assets/esri/core/workers/chunks/{17604cbd4d24158e2c16.js → 3835097520296b0517af.js} +1 -1
- package/assets/esri/core/workers/chunks/40df608337d562553ce1.js +2 -0
- package/assets/esri/core/workers/chunks/{9f4a9b193485f88d4461.js → 4afe76de6e82e86fe697.js} +1 -1
- package/assets/esri/core/workers/chunks/{ac408c62565e2c8b5975.js → 4c5cdd2712c938fafc5d.js} +1 -1
- package/assets/esri/core/workers/chunks/{94eab215bab3e4e0e5b5.js → 52a91c314afec70199bc.js} +1 -1
- package/assets/esri/core/workers/chunks/5c6742728fa705d2e16e.js +1 -0
- package/assets/esri/core/workers/chunks/{ece30bfd5c49b8d99752.js → 5e5c7cc74ff1c9603aff.js} +1 -1
- package/assets/esri/core/workers/chunks/{502c3da8c49bf885f51d.js → 63ea9035dcf9ce45560c.js} +1 -1
- package/assets/esri/core/workers/chunks/{33ec193e6d7a0cb9d8dd.js → 6b66a6f69aa03338c346.js} +1 -1
- package/assets/esri/core/workers/chunks/{56b6b68d9459b1edea43.js → 6c97b5bc408f051606d2.js} +1 -1
- package/assets/esri/core/workers/chunks/701125f6cdd91ff3655f.js +2 -0
- package/assets/esri/core/workers/chunks/7995e6983456c779adf9.js +1 -0
- package/assets/esri/core/workers/chunks/{4e13d639419ac64f7563.js → 7c077e1a63ab97bf3e87.js} +1 -1
- package/assets/esri/core/workers/chunks/860465c4f44c373d0a1c.js +1 -0
- package/assets/esri/core/workers/chunks/86f2de7dda7992ae706c.js +1 -0
- package/assets/esri/core/workers/chunks/{a29cd1f5c7bb4f6a5a4f.js → 8d4881c879c86b353e08.js} +1 -1
- package/assets/esri/core/workers/chunks/{6e21675bbd7a44070771.js → 8ff83c59462dea6e3427.js} +1 -1
- package/assets/esri/core/workers/chunks/979bab62cad788180770.js +1 -0
- package/assets/esri/core/workers/chunks/9890c85a238879490926.js +1 -0
- package/assets/esri/core/workers/chunks/9a11ff75009fef45b8c1.js +1 -0
- package/assets/esri/core/workers/chunks/a70fa35b2d19460637e9.js +2 -0
- package/assets/esri/core/workers/chunks/a95398214e530f896a2d.js +1 -0
- package/assets/esri/core/workers/chunks/ae74f722fb385e45fcf1.js +1 -0
- package/assets/esri/core/workers/chunks/{fc1fe1f58a65a1694c09.js → b4badbcf1bdb7823d825.js} +1 -1
- package/assets/esri/core/workers/chunks/b78fb24b47d9f31f18c6.js +1 -0
- package/assets/esri/core/workers/chunks/ba31616de9d73d83d867.js +1 -0
- package/assets/esri/core/workers/chunks/c7662455252b48531da1.js +1 -0
- package/assets/esri/core/workers/chunks/ca92176d5348e2c533d7.js +1 -0
- package/assets/esri/core/workers/chunks/cd5206e19d86c60e3cf0.js +1 -0
- package/assets/esri/core/workers/chunks/{bfb417d72d0c90e116fe.js → cedf3e316d6f89cf7005.js} +1 -1
- package/assets/esri/core/workers/chunks/d33a08e5f589355c57a3.js +1 -0
- package/assets/esri/core/workers/chunks/dd29fd1b3da90d3ca6b1.js +1 -0
- package/assets/esri/core/workers/chunks/e0036fa0324a96a88248.js +1 -0
- package/assets/esri/core/workers/chunks/e95ce76b5b816256a519.js +1 -0
- package/assets/esri/core/workers/chunks/ed939fd5d3827a3f70e0.js +1 -0
- package/assets/esri/core/workers/chunks/fbcf09526dc1bbe94b91.js +2 -0
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +22 -6
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_ar.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_en.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
- package/assets/esri/widgets/Features/t9n/Features_en.json +1 -1
- package/chunks/GaussianSplatShadow.glsl.js +11 -9
- package/chunks/ShadowCastVisualize.glsl.js +26 -18
- package/chunks/aiServices.js +1 -1
- package/chunks/arcade.js +1 -1
- package/chunks/array.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/config.js +1 -1
- package/identity/IdentityModal.js +1 -1
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/KnowledgeGraphLayer.d.ts +6 -4
- package/layers/KnowledgeGraphLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
- package/layers/graphics/sources/parquet/PortalParquetLayerFileProvider.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/support/SceneModification.js +1 -1
- package/layers/support/SceneModifications.js +1 -1
- package/layers/support/featureLayerUtils.js +1 -1
- package/layers/support/parquetUtils.js +1 -1
- package/linkChart/LinkChartProperties.js +1 -1
- package/linkChart/utils.js +1 -1
- package/package.json +2 -2
- package/renderers/ClassBreaksRenderer.js +1 -1
- package/renderers/UniqueValueRenderer.js +1 -1
- package/rest/support/TranslateContent.js +1 -1
- package/rest/support/TranslateParameters.js +1 -1
- package/rest/support/TranslateResult.js +1 -1
- package/rest/translate.js +1 -1
- package/rest/utils.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/types.d.ts +45 -1
- package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedLineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/3d/analysis/ShadowCast/ShadowCastTooltip.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedDrawToolRenderer.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
- package/views/3d/analysis/Viewshed/viewshedToolManipulatorUtils.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/QualityProfile.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +3 -3
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathEvaluator.js +2 -0
- package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
- package/views/3d/webgl-engine/lib/PathFrame2D.js +2 -0
- package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
- package/views/3d/webgl-engine/lib/PathVertex.js +1 -1
- package/views/3d/webgl-engine/lib/PathVertexInfo.js +2 -0
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatShadow.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +1 -1
- package/views/DOMContainer.d.ts +2 -0
- package/views/LinkChartView.d.ts +47 -0
- package/views/MapView.d.ts +1 -85
- package/views/VideoView.d.ts +8 -1
- package/views/View2D.d.ts +78 -2
- package/views/draw/support/Reshape.js +1 -1
- package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
- package/views/interactive/tooltip/content/TooltipContent.js +1 -1
- package/views/types.d.ts +2 -3
- package/views/ui/DefaultUI.d.ts +1 -0
- package/widgets/Attachments.js +1 -1
- package/widgets/BasemapGallery.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BasemapToggle.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +17 -3
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/css.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +25 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.d.ts +46 -1
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/UtilityNetworkAssociationsElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/interfaceUtils.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm/types.d.ts +1 -1
- package/widgets/BatchAttributeForm.d.ts +2 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.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/CatalogLayerList.js +1 -1
- package/widgets/Compass.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Daylight.js +1 -1
- package/widgets/DirectionalPad.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/components/FeatureList.js +1 -1
- package/widgets/Editor/components/FooterActions.js +1 -1
- package/widgets/Editor/components/PendingFeatureList.js +1 -1
- package/widgets/Editor/components/Prompt.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/ElevationProfile/components/LegendItem.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
- package/widgets/FeatureForm/RelationshipInput.d.ts +3 -3
- package/widgets/FeatureForm/RelationshipInput.js +1 -1
- package/widgets/FeatureForm/UtilityNetworkAssociationInput.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesDrillIn.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/FloorFilter.js +1 -1
- package/widgets/FovOverlay.js +1 -1
- package/widgets/Fullscreen.js +1 -1
- package/widgets/Home.js +1 -1
- package/widgets/LayerList/LayerListItem.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Locate.js +1 -1
- package/widgets/NavigationToggle.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationActions.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationUI360.js +1 -1
- package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
- package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
- package/widgets/OrientedImageryViewer/components/VideoEnhancementTools.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/PanoramicVideoViewer.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/OverflowGroup.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/SplitButton.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/TimeZoneLabel.js +1 -1
- package/widgets/Track.js +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/UtilityNetworkValidateTopology.js +1 -1
- package/widgets/ValuePicker.js +1 -1
- package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
- package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
- package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/Zoom.js +1 -1
- package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
- package/widgets/support/ColorPicker.js +1 -1
- package/widgets/support/ContingentValuesManager.js +1 -1
- package/widgets/support/FilterBuilder.js +1 -1
- package/widgets/support/GridControls.js +1 -1
- package/widgets/support/ItemList.js +1 -1
- package/widgets/support/LabeledSwitch.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.d.ts +66 -6
- package/widgets/support/SelectionToolbar/types.d.ts +20 -1
- package/assets/esri/core/workers/chunks/1d1929f98d941179be29.js +0 -2
- package/assets/esri/core/workers/chunks/286bf3be9f524bde9529.js +0 -1
- package/assets/esri/core/workers/chunks/36ecb0082b8804b10fbf.js +0 -1
- package/assets/esri/core/workers/chunks/41a95ad470ec42ecd5a2.js +0 -1
- package/assets/esri/core/workers/chunks/547dc6ccb989bd962661.js +0 -1
- package/assets/esri/core/workers/chunks/549d348ca181d06aefb7.js +0 -2
- package/assets/esri/core/workers/chunks/55334ad3618899cdbf78.js +0 -2
- package/assets/esri/core/workers/chunks/56d9d3f108ff6e719dd4.js +0 -1
- package/assets/esri/core/workers/chunks/5c44638670e40e092ce3.js +0 -1
- package/assets/esri/core/workers/chunks/63934843c9f4ef779a07.js +0 -1
- package/assets/esri/core/workers/chunks/69c9eb93553b006b640d.js +0 -2
- package/assets/esri/core/workers/chunks/8330302096d4312a4393.js +0 -1
- package/assets/esri/core/workers/chunks/885eac78a76184efa1e5.js +0 -1
- package/assets/esri/core/workers/chunks/8a1751187a20b6578875.js +0 -1
- package/assets/esri/core/workers/chunks/95dee5853c6e89f15ea9.js +0 -1
- package/assets/esri/core/workers/chunks/9da2f2b67837b491cfa3.js +0 -1
- package/assets/esri/core/workers/chunks/a913a1c83a667ed0e711.js +0 -1
- package/assets/esri/core/workers/chunks/aca9591d3467a24f8329.js +0 -1
- package/assets/esri/core/workers/chunks/b69d1d528e271568cbd8.js +0 -2
- package/assets/esri/core/workers/chunks/bc249bb667f0564ad093.js +0 -1
- package/assets/esri/core/workers/chunks/c8b96104641cb4afd4df.js +0 -1
- package/assets/esri/core/workers/chunks/cdb48d198145493f76f3.js +0 -1
- package/assets/esri/core/workers/chunks/d00b9c1fd0865bf8f317.js +0 -1
- package/assets/esri/core/workers/chunks/deab352545c34cac148c.js +0 -1
- package/assets/esri/core/workers/chunks/e2bb95d601789bbda73b.js +0 -1
- package/assets/esri/core/workers/chunks/f1bb426400dac02880f1.js +0 -1
- package/assets/esri/core/workers/chunks/f3f984c62311c20a9db8.js +0 -1
- /package/assets/esri/core/workers/chunks/{55334ad3618899cdbf78.js.LICENSE.txt → 32f128a1615d71bbe899.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{69c9eb93553b006b640d.js.LICENSE.txt → 40df608337d562553ce1.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{549d348ca181d06aefb7.js.LICENSE.txt → 701125f6cdd91ff3655f.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{b69d1d528e271568cbd8.js.LICENSE.txt → a70fa35b2d19460637e9.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{1d1929f98d941179be29.js.LICENSE.txt → fbcf09526dc1bbe94b91.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{prefersReducedMotion as e}from"../../../../core/a11yUtils.js";import{on as o}from"../../../../core/events.js";import"../../../../core/has.js";import{memoize as i}from"../../../../core/memoize.js";import{throwIfNotAbortError as s,throwIfAborted as n,after as r}from"../../../../core/promiseUtils.js";import{waitAnimationFrame as a,waitTick as l}from"../../../../core/scheduling.js";import{unitName as c}from"../../../../core/unitFormatUtils.js";import{defaultAreaUnit as p,defaultVerticalLengthUnit as d,defaultLengthUnit as u}from"../../../../core/units.js";import{property as h,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as f}from"../../../../support/getDefaultUnitForView.js";import{tooltipKeys as _}from"../../keybindings.js";import{table as g,contentHeader as y,contentHeaderSpacer as v,contentHeaderActions as b,contentInputMode as w,content as I,helpMessageText as k,helpMessageIcon as A,helpMessage as C,drawContentHeaderActions as D}from"../css.js";import{getFormatters as M}from"../fields/parsingAndFormattingUtils.js";import U from"../../../../widgets/Widget.js";import{loadCalciteComponents as F}from"../../../../widgets/support/componentsUtils.js";import{messageBundle as j,tsx as x,tsxFragment as E,classes as T}from"../../../../widgets/support/widget.js";const H=Symbol("dragHandles");let N=class extends U{constructor(){super(...arguments),this._focusAbortController=new AbortController,this._transitionInfo=null,this._mode="feedback",this._getFormatters=i(M),this._onHeaderPointerDown=t=>{const e=t.target;if(!(e instanceof HTMLElement)||"calcite-button"===e?.tagName?.toLowerCase())return;this.removeHandles(H),t.preventDefault(),t.stopPropagation();const i="test"!==process.env.NODE_ENV;i&&e.setPointerCapture(t.pointerId),this.tooltip.onDragStart(t.clientX,t.clientY),this.addHandles([o(e,"pointermove",({clientX:t,clientY:e})=>{this.tooltip.onDrag(t,e)}),o(e,["pointerup","pointercancel"],o=>{this.removeHandles(H),i&&e.releasePointerCapture(t.pointerId),this.tooltip.onDragEnd()}),o(e,"touchstart",t=>t.preventDefault())],H)},this._onDiscard=()=>{this.destroyed||(this.tooltip.emit("discard"),this.info.clearInputValues(),this.exitInputMode())},this._onCommit=(t,e)=>{if(this.destroyed)return;if(this.tooltip.emit("commit",{type:e}),"commit-and-exit"===e)return void this.exitInputMode();if("commit-on-blur"===e)return;const o=this._getFocusableElements(),i=o.length,s=o.indexOf(t);if(-1===s)return void this.exitInputMode();const n=((s+("commit-and-next"===e?1:-1))%i+i)%i;O(o.at(n))},this._onKeyDown=t=>{switch(t.code){case _.next:return this._onNextKey(t);case _.discard:return t.stopPropagation(),this._onDiscard()}}}get mode(){return this._mode}get _displayUnits(){const{displayUnits:t}=this.info.sketchOptions.values,e=f(this.tooltip.view);return{length:t.length??e,verticalLength:t.verticalLength??e,area:t.area??e}}get _inputUnitInfos(){const t=this._messagesUnits,e=e=>({unit:e,abbreviation:c(t,e,"abbr")}),{inputUnits:o}=this.info.sketchOptions.values,i=f(this.tooltip.view),s=o.length??i,n=o.verticalLength??i,r=o.area??i;return{length:e(u(s)),verticalLength:e(d(n)),area:e(p(r)),angle:e("degrees")}}get _formatters(){return this._getFormatters(this._messagesUnits,this._displayUnits)}get fieldContext(){return{formatters:this._formatters,inputUnitInfos:this._inputUnitInfos,messages:this._messagesTooltip,sketchOptions:this.info.sketchOptions,onCommit:this._onCommit,onDiscard:this._onDiscard}}render(){const{visibleElements:t}=this.info.sketchOptions.tooltips,e=this._renderedContent,o=this._renderedActions,i=this._renderedHelpMessage,s=e.length>0,n=s||!!i,r="input"===this.mode;return x("div",{class:T(I,r&&w),onkeydown:this._onKeyDown
|
|
2
|
+
import{__decorate as t}from"tslib";import{prefersReducedMotion as e}from"../../../../core/a11yUtils.js";import{on as o}from"../../../../core/events.js";import"../../../../core/has.js";import{memoize as i}from"../../../../core/memoize.js";import{throwIfNotAbortError as s,throwIfAborted as n,after as r}from"../../../../core/promiseUtils.js";import{waitAnimationFrame as a,waitTick as l}from"../../../../core/scheduling.js";import{unitName as c}from"../../../../core/unitFormatUtils.js";import{defaultAreaUnit as p,defaultVerticalLengthUnit as d,defaultLengthUnit as u}from"../../../../core/units.js";import{property as h,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as f}from"../../../../support/getDefaultUnitForView.js";import{tooltipKeys as _}from"../../keybindings.js";import{table as g,contentHeader as y,contentHeaderSpacer as v,contentHeaderActions as b,contentInputMode as w,content as I,helpMessageText as k,helpMessageIcon as A,helpMessage as C,drawContentHeaderActions as D}from"../css.js";import{getFormatters as M}from"../fields/parsingAndFormattingUtils.js";import U from"../../../../widgets/Widget.js";import{loadCalciteComponents as F}from"../../../../widgets/support/componentsUtils.js";import{messageBundle as j,tsx as x,tsxFragment as E,classes as T}from"../../../../widgets/support/widget.js";const H=Symbol("dragHandles");let N=class extends U{constructor(){super(...arguments),this._focusAbortController=new AbortController,this._transitionInfo=null,this._mode="feedback",this._getFormatters=i(M),this._onHeaderPointerDown=t=>{const e=t.target;if(!(e instanceof HTMLElement)||"calcite-button"===e?.tagName?.toLowerCase())return;this.removeHandles(H),t.preventDefault(),t.stopPropagation();const i="test"!==process.env.NODE_ENV;i&&e.setPointerCapture(t.pointerId),this.tooltip.onDragStart(t.clientX,t.clientY),this.addHandles([o(e,"pointermove",({clientX:t,clientY:e})=>{this.tooltip.onDrag(t,e)}),o(e,["pointerup","pointercancel"],o=>{this.removeHandles(H),i&&e.releasePointerCapture(t.pointerId),this.tooltip.onDragEnd()}),o(e,"touchstart",t=>t.preventDefault())],H)},this._onDiscard=()=>{this.destroyed||(this.tooltip.emit("discard"),this.info.clearInputValues(),this.exitInputMode())},this._onCommit=(t,e)=>{if(this.destroyed)return;if(this.tooltip.emit("commit",{type:e}),"commit-and-exit"===e)return void this.exitInputMode();if("commit-on-blur"===e)return;const o=this._getFocusableElements(),i=o.length,s=o.indexOf(t);if(-1===s)return void this.exitInputMode();const n=((s+("commit-and-next"===e?1:-1))%i+i)%i;O(o.at(n))},this._onKeyDown=t=>{switch(t.code){case _.next:return this._onNextKey(t);case _.discard:return t.stopPropagation(),this._onDiscard()}}}get mode(){return this._mode}get _displayUnits(){const{displayUnits:t}=this.info.sketchOptions.values,e=f(this.tooltip.view);return{length:t.length??e,verticalLength:t.verticalLength??e,area:t.area??e}}get _inputUnitInfos(){const t=this._messagesUnits,e=e=>({unit:e,abbreviation:c(t,e,"abbr")}),{inputUnits:o}=this.info.sketchOptions.values,i=f(this.tooltip.view),s=o.length??i,n=o.verticalLength??i,r=o.area??i;return{length:e(u(s)),verticalLength:e(d(n)),area:e(p(r)),angle:e("degrees")}}get _formatters(){return this._getFormatters(this._messagesUnits,this._displayUnits)}get fieldContext(){return{formatters:this._formatters,inputUnitInfos:this._inputUnitInfos,messages:this._messagesTooltip,sketchOptions:this.info.sketchOptions,onCommit:this._onCommit,onDiscard:this._onDiscard}}render(){const{visibleElements:t}=this.info.sketchOptions.tooltips,e=this._renderedContent,o=this._renderedActions,i=this._renderedHelpMessage,s=e.length>0,n=s||!!i,r="input"===this.mode;return x("div",{class:T(I,r&&w),tabIndex:-1,onkeydown:this._onKeyDown},r&&n&&t.header?x("div",{class:y,"data-testid":"tooltip-header",key:"header",onpointerdown:this._onHeaderPointerDown},x("calcite-button",{appearance:"transparent","data-testid":"tooltip-back-button",iconFlipRtl:"both",iconStart:"chevron-left",key:"discard-button",kind:"neutral",scale:"s",tabIndex:-1,onclick:this._onDiscard}),o.length>0?x(E,null,x("div",{class:v,key:"spacer"}),x("div",{class:b,key:"actions"},o)):null):null,s?x("div",{class:g,key:"content"},...e):null,i)}destroy(){this._focusAbortController.abort(),this._transitionInfo?.transition.skipTransition()}_renderActions(){return null}loadDependencies(){return F({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input")})}async enterInputMode(t,e){try{await this._transitionTo("input",e),await this._focusField(t)}catch(o){s(o)}}async exitInputMode({focusOnView:t=!0}={}){try{const{container:e,info:o}=this;o.clearInputValues();const i=t?e?.closest(".esri-view")?.querySelector(".esri-view-surface"):null;await this._transitionTo("feedback"),i instanceof HTMLElement&&i.focus()}catch(e){s(e)}}_onNextKey(t){const e=this._getFocusableElements(),o=e.at(0),i=e.at(-1);o&&i&&(t.shiftKey?document.activeElement===o&&(t.preventDefault(),t.stopPropagation(),O(i)):document.activeElement===i&&(t.preventDefault(),t.stopPropagation(),O(o)))}get _renderedContent(){return S(this._renderContent())}get _renderedActions(){return S(this._renderActions())}get _renderedHelpMessage(){const{sketchOptions:t,visibleElements:e}=this.info;if(!e.helpMessage)return null;const o=t.tooltips.helpMessage??this._defaultHelpMessage;if(!o)return null;const i=t.tooltips.helpMessageIcon??"information";return x("div",{class:C,key:"help-message"},i?x("calcite-icon",{class:A,icon:i,scale:"s"}):null,x("div",{class:k},o))}get _defaultHelpMessage(){const{helpMessage:t,viewType:e}=this.info;if(null==t)return null;const o="3d"===e?"helpMessages3d":"helpMessages2d";return this._messagesTooltip?.sketch?.[o]?.[t]}async _focusField(t){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;const{signal:e}=this._focusAbortController;await this._waitForInputs(),n(e);const o=this._getFocusableInputs(),i=t?o.find(e=>e.getAttribute("data-field-name")===t):o.at(0);await O(i)}async _transitionTo(t,o){if(this._mode===t&&!this._transitionInfo)return;if(this._transitionInfo?.mode===t)return this._transitionInfo.transition.finished;this._transitionInfo?.transition.skipTransition();const i=async()=>{this.destroyed||(this._mode=t,await l(),this.destroyed||(this.renderNow(),await l(),this.destroyed||o?.()))};if("test"===process.env.NODE_ENV||!this.domNode?.firstChild||!document.startViewTransition||e())return void await i();this.autoRenderingEnabled=!1;const s=this._transitionInfo={transition:document.startViewTransition(async()=>{this.destroyed||s!==this._transitionInfo||(this.autoRenderingEnabled=!0,await i())}),mode:t};try{await s.transition.finished}finally{s===this._transitionInfo&&(this._transitionInfo=null)}}async _waitForInputs(){const t=()=>Array.from(this.domNode?.querySelectorAll("calcite-input")??[]);for(;0===t().length;)await r(P);await a()}_getFocusableInputs(){return Array.from(this.domNode?.querySelectorAll("calcite-input:not([read-only]):not([disabled])")??[])}_getFocusableElements(){const t=this.domNode?.querySelector(`.${D}`);return[...Array.from(t?.querySelectorAll(`.${b} calcite-button:not([disabled])`)??[]),...this._getFocusableInputs()]}};async function O(t){await(t?.componentOnReady?.()),await(t?.setFocus())}function S(t){return(Array.isArray(t)?t:[t]).flat(10).filter(t=>!!t)}t([j("esri/core/t9n/Units"),h()],N.prototype,"_messagesUnits",void 0),t([j("esri/views/interactive/tooltip/t9n/Tooltip"),h()],N.prototype,"_messagesTooltip",void 0),t([h()],N.prototype,"info",void 0),t([h()],N.prototype,"tooltip",void 0),t([h()],N.prototype,"_mode",void 0),t([h()],N.prototype,"mode",null),t([h()],N.prototype,"_displayUnits",null),t([h()],N.prototype,"_inputUnitInfos",null),t([h()],N.prototype,"_formatters",null),t([h()],N.prototype,"fieldContext",null),t([h()],N.prototype,"_renderedContent",null),t([h()],N.prototype,"_renderedActions",null),t([h()],N.prototype,"_renderedHelpMessage",null),t([h()],N.prototype,"_defaultHelpMessage",null),N=t([m("esri.views.interactive.tooltip.content.TooltipContent")],N);const P=20;export{N as TooltipContent};
|
package/views/types.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ import type ImageryTileLayer from "../layers/ImageryTileLayer.js";
|
|
|
19
19
|
import type Layer from "../layers/Layer.js";
|
|
20
20
|
import type MediaLayer from "../layers/MediaLayer.js";
|
|
21
21
|
import type RouteLayer from "../layers/RouteLayer.js";
|
|
22
|
-
import type WCSLayer from "../layers/WCSLayer.js";
|
|
23
22
|
import type BuildingSublayer from "../layers/buildingSublayers/BuildingSublayer.js";
|
|
24
23
|
import type SubtypeSublayer from "../layers/support/SubtypeSublayer.js";
|
|
25
24
|
import type { ReadonlyArrayOrCollection } from "../core/Collection.js";
|
|
@@ -469,7 +468,7 @@ export interface LayerHit {
|
|
|
469
468
|
}
|
|
470
469
|
|
|
471
470
|
/**
|
|
472
|
-
* Object specification for the raster hit results returned from [ImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryLayer/)
|
|
471
|
+
* Object specification for the raster hit results returned from [ImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryLayer/) or [ImageryTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ImageryTileLayer/) in [ViewHitTestResult](https://developers.arcgis.com/javascript/latest/references/core/views/types/#ViewHitTestResult) of the [MapView.hitTest()](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#hitTest) method.
|
|
473
472
|
*
|
|
474
473
|
* @since 5.1
|
|
475
474
|
*/
|
|
@@ -481,7 +480,7 @@ export interface RasterHit {
|
|
|
481
480
|
*
|
|
482
481
|
* @since 5.1
|
|
483
482
|
*/
|
|
484
|
-
layer: ImageryTileLayer | ImageryLayer
|
|
483
|
+
layer: ImageryTileLayer | ImageryLayer;
|
|
485
484
|
/**
|
|
486
485
|
* The point geometry in the spatial reference of the view corresponding with the input screen coordinates.
|
|
487
486
|
*
|
package/views/ui/DefaultUI.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export interface DefaultUIProperties extends UIProperties, Partial<Pick<DefaultU
|
|
|
51
51
|
* <html dir="rtl">
|
|
52
52
|
* ```
|
|
53
53
|
*
|
|
54
|
+
* @deprecated since 5.1. Please use [arcgis-map](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-map/), [arcgis-scene](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-scene/) or [arcgis-link-chart](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-link-chart/) with [slots](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-map/#slots) instead.
|
|
54
55
|
* @since 4.0
|
|
55
56
|
* @see [SceneView.ui](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#ui)
|
|
56
57
|
* @see [MapView.ui](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#ui)
|
package/widgets/Attachments.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../Graphic.js";import{deprecatedModule as s}from"../core/deprecate.js";import i from"../core/Error.js";import a from"../core/Logger.js";import{on as n,watch as r,initial as l}from"../core/reactiveUtils.js";import{formatFileSize as o}from"../core/unitFormatUtils.js";import{property as d,cast as c,subclass as m}from"../core/accessorSupport/decorators.js";import h from"./Widget.js";import u from"./Attachments/AttachmentsViewModel.js";import{getIconPath as p,isSupportedImage as b}from"./Attachments/support/attachmentUtils.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import{globalCss as g}from"./support/globalCss.js";import{legacyIcon as v}from"./support/legacyIcon.js";import{tsx as f,isRTL as y,messageBundle as w}from"./support/widget.js";import{discardNode as A,storeNode as M}from"./support/widgetUtils.js";const F={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},k="esri-attachments",I={base:k,loaderContainer:`${k}__loader-container`,loader:`${k}__loader`,container:`${k}__container`,containerList:`${k}__container--list`,containerPreview:`${k}__container--preview`,actions:`${k}__actions`,deleteButton:`${k}__delete-button`,addAttachmentButton:`${k}__add-attachment-button`,errorMessage:`${k}__error-message`,items:`${k}__items`,item:`${k}__item`,itemButton:`${k}__item-button`,itemMask:`${k}__item-mask`,itemMaskIcon:`${k}__item-mask--icon`,itemImage:`${k}__image`,itemImageResizable:`${k}__image--resizable`,itemLabel:`${k}__label`,itemFilename:`${k}__filename`,itemChevronIcon:`${k}__item-chevron-icon`,itemLink:`${k}__item-link`,itemLinkOverlay:`${k}__item-link-overlay`,itemLinkOverlayIcon:`${k}__item-link-overlay-icon`,itemAddIcon:`${k}__item-add-icon`,formNode:`${k}__form-node`,fileFieldset:`${k}__file-fieldset`,fileLabel:`${k}__file-label`,fileName:`${k}__file-name`,fileInput:`${k}__file-input`,metadata:`${k}__metadata`,metadataFieldset:`${k}__metadata-fieldset`,progressBar:`${k}__progress-bar`},$=window.CSS;let T=class extends h{constructor(e,t){super(e,t),this.displayType="auto",this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=null,this.visibleElements={...F},this._supportsImageOrientation=$&&$.supports&&$.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null,e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{s(a.getLogger("esri.widgets.Attachments"),"esri.widgets.Attachments",{replacement:"Use the Popup and Editor components to view and edit attachments respectively.",version:"5.0",see:"https://www.esriurl.com/components-transition-plan/",warnOnce:!0})})}normalizeCtorArgs(e){e?.viewModel||(e={viewModel:new u,...e});const{suppressDeprecationWarning:t,...s}=e;return s}initialize(){this.addHandles([n(()=>this.viewModel?.attachmentInfos,"change",()=>this.scheduleRender()),n(()=>this.viewModel?.fileInfos,"change",()=>this.scheduleRender()),r(()=>this.viewModel?.mode,()=>this._modeChanged(),l)])}loadDependencies(){return _({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")})}get capabilities(){return this.viewModel.capabilities}set capabilities(e){this.viewModel.capabilities=e}get effectiveDisplayType(){const{displayType:e}=this;return e&&"auto"!==e?e:this.viewModel.supportsResizeAttachments?"preview":"list"}get attachmentKeywords(){return this.viewModel.attachmentKeywords}set attachmentKeywords(e){this.viewModel.attachmentKeywords=e}get attachmentTypes(){return this.viewModel.attachmentTypes}set attachmentTypes(e){this.viewModel.attachmentTypes=e}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get icon(){return"attachment"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}castVisibleElements(e){return{...F,...e}}addAttachment(){const{_addAttachmentForm:e,viewModel:t}=this;return this._set("submitting",!0),this._set("error",null),t.addAttachment(e).then(e=>(this._set("submitting",!1),this._set("error",null),t.mode="view",e)).catch(e=>{throw this._set("submitting",!1),this._set("error",new i("attachments:add-attachment",this.messages.addErrorMessage,e)),e})}deleteAttachment(e){const{viewModel:t}=this;return this._set("submitting",!0),this._set("error",null),t.deleteAttachment(e).then(e=>(this._set("submitting",!1),this._set("error",null),t.mode="view",e)).catch(e=>{throw this._set("submitting",!1),this._set("error",new i("attachments:delete-attachment",this.messages.deleteErrorMessage,e)),e})}updateAttachment(){const{viewModel:e}=this,{_updateAttachmentForm:t}=this;return this._set("submitting",!0),this._set("error",null),e.updateAttachment(t).then(t=>(this._set("submitting",!1),this._set("error",null),e.mode="view",t)).catch(e=>{throw this._set("submitting",!1),this._set("error",new i("attachments:update-attachment",this.messages.updateErrorMessage,e)),e})}addFile(){const e=this.viewModel.addFile(this.selectedFile,this._addAttachmentForm);return this.viewModel.mode="view",e}updateFile(){const{viewModel:e}=this,t=e.updateFile(this.selectedFile,this._updateAttachmentForm,e.activeFileInfo);return e.mode="view",t}deleteFile(e){const t=this.viewModel.deleteFile(e||this.viewModel.activeFileInfo?.file);return this.viewModel.mode="view",t}render(){const{submitting:e,viewModel:t}=this,{state:s}=t;return f("div",{class:this.classes(I.base,g.widget)},e?this._renderProgressBar():null,"loading"===s?this._renderLoading():this._renderAttachments(),this._renderErrorMessage())}_renderErrorMessage(){const{error:e,visibleElements:t}=this;return e&&t.errorMessage?f("div",{class:I.errorMessage,key:"error-message"},e.message):null}_renderAttachments(){const{activeFileInfo:e,mode:t,activeAttachmentInfo:s}=this.viewModel;return"add"===t?this._renderAddForm():"edit"===t?this._renderDetailsForm(s||e):this._renderAttachmentContainer()}_renderLoading(){return f("div",{class:I.loaderContainer,key:"loader"},f("div",{class:I.loader}))}_renderProgressBar(){return this.visibleElements.progressBar?f("div",{class:I.progressBar,key:"progress-bar"}):null}_renderAddForm(){const{submitting:e,selectedFile:t}=this,s=e||!t,i=this.visibleElements.cancelAddButton?f("button",{bind:this,class:this.classes(g.button,g.buttonTertiary,g.buttonSmall,g.buttonHalf,e&&g.buttonDisabled),disabled:e,onclick:this._cancelForm,type:"button"},this.messages.cancel):null,a=this.visibleElements.addSubmitButton?f("button",{class:this.classes(g.button,g.buttonSecondary,g.buttonSmall,g.buttonHalf,{[g.buttonDisabled]:s}),disabled:s,type:"submit"},this.messages.add):null,n=t?f("span",{class:I.fileName,key:"file-name"},t.name):null,r=f("form",{afterCreate:M,afterRemoved:A,bind:this,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},f("fieldset",{class:I.fileFieldset},n,f("label",{class:this.classes(I.fileLabel,g.button,g.buttonSecondary)},t?this.messages.changeFile:this.messages.selectFile,f("input",{bind:this,class:I.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))),a,i);return f("div",{class:I.formNode,key:"add-form-container"},r)}_renderDetailsForm(e){const{visibleElements:t,viewModel:s,selectedFile:i,submitting:a}=this,{capabilities:n}=s,r=a||!i;let l,d,c,m;i?(l=i.type,d=i.name,c=i.size):e&&"file"in e?(l=e.file.type,d=e.file.name,c=e.file.size):e&&"contentType"in e&&(l=e.contentType,d=e.name,c=e.size,m=e.url);const h=n.editing&&n.operations?.delete&&t.deleteButton?f("button",{bind:this,class:this.classes(g.button,g.buttonSmall,g.buttonTertiary,I.deleteButton,{[g.buttonDisabled]:a}),disabled:a,key:"delete-button",onclick:t=>this._submitDeleteAttachment(t,e),type:"button"},this.messages.delete):void 0,u=n.editing&&n.operations?.update&&t.updateButton?f("button",{class:this.classes(g.button,g.buttonSmall,g.buttonThird,{[g.buttonDisabled]:r}),disabled:r,key:"update-button",type:"submit"},this.messages.update):void 0,p=this.visibleElements.cancelUpdateButton?f("button",{bind:this,class:this.classes(g.button,g.buttonSmall,g.buttonTertiary,g.buttonThird,{[g.buttonDisabled]:a}),disabled:a,key:"cancel-button",onclick:this._cancelForm,type:"button"},this.messages.cancel):void 0,b=n.editing&&n.operations?.update?f("fieldset",{class:I.fileFieldset,key:"file"},f("span",{class:I.fileName,key:"file-name"},d),f("label",{class:this.classes(I.fileLabel,g.button,g.buttonSecondary)},this.messages.changeFile,f("input",{bind:this,class:I.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))):void 0,_=f("fieldset",{class:I.metadataFieldset,key:"size"},f("label",null,o(this.messagesUnits,c??0))),v=f("fieldset",{class:I.metadataFieldset,key:"content-type"},f("label",null,l)),y=null!=m?f("a",{class:I.itemLink,href:m,rel:"noreferrer",target:"_blank"},this._renderImageMask(e,400),f("div",{class:I.itemLinkOverlay},f("span",{class:I.itemLinkOverlayIcon},f("calcite-icon",{icon:"launch"})))):this._renderImageMask(e,400),w=f("form",{afterCreate:M,afterRemoved:A,bind:this,"data-node-ref":"_updateAttachmentForm",onsubmit:t=>this._submitUpdateAttachment(t,e)},f("div",{class:I.metadata},_,v),b,f("div",{class:I.actions},h,p,u));return f("div",{class:I.formNode,key:"edit-form-container"},y,w)}_renderImageMask(e,t){return e?"file"in e?this._renderGenericImageMask(e.file.name,e.file.type):this._renderImageMaskForAttachment(e,t):null}_renderGenericImageMask(e,t){const{supportsResizeAttachments:s}=this.viewModel,i=p(t),a={[I.itemImageResizable]:s};return f("div",{class:this.classes(I.itemMaskIcon,I.itemMask),key:i},f("img",{alt:e,class:this.classes(a,I.itemImage),src:i,title:e}))}_renderImageMaskForAttachment(e,t){const{supportsResizeAttachments:s}=this.viewModel;if(!e)return null;const{contentType:i,name:a,size:n,url:r}=e;if(!s||!b(i))return this._renderGenericImageMask(a,i);const l=this._getCSSTransform(e),o=l?{transform:l,"image-orientation":"none"}:{},d=`${r}${r?.includes("?")?"&":"?"}w=${t}&s=${n}`,c={[I.itemImageResizable]:s};return f("div",{class:this.classes(I.itemMask),key:d},f("img",{alt:a,class:this.classes(c,I.itemImage),src:d,styles:o,title:a}))}_renderFile(e){const{file:t}=e;return f("li",{class:I.item,key:t},f("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:I.itemButton,key:"details-button",onclick:()=>this._startEditFile(e),title:this.messages.attachmentDetails,type:"button"},this._renderImageMask(e),f("label",{class:I.itemLabel},f("span",{class:I.itemFilename},t.name||this.messages.noTitle),f("span",{"aria-hidden":"true",class:this.classes(I.itemChevronIcon,y(this.container)?v.left:v.right)}))))}_renderAttachmentInfo({attachmentInfo:e,displayType:t}){const{viewModel:s,effectiveDisplayType:i}=this,{capabilities:a,supportsResizeAttachments:n}=s,{contentType:r,name:l,url:o}=e,d=this._renderImageMask(e,"list"===t?48:400),c=a.editing?f("span",{"aria-hidden":"true",class:this.classes(I.itemChevronIcon,y(this.container)?v.left:v.right)}):null,m=[d,"preview"===i&&n&&b(r)?null:f("label",{class:I.itemLabel},f("span",{class:I.itemFilename},l||this.messages.noTitle),c)],h=a.editing?f("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:I.itemButton,"data-attachment-info-id":e.id,key:"details-button",onclick:()=>this._startEditAttachment(e),title:this.messages.attachmentDetails,type:"button"},m):f("a",{class:I.itemButton,href:o??void 0,key:"details-link",rel:"noreferrer",target:"_blank"},m);return f("li",{class:I.item,key:e},h)}_renderAttachmentContainer(){const{effectiveDisplayType:e,viewModel:t,visibleElements:s}=this,{attachmentInfos:i,capabilities:a,fileInfos:n}=t,r=!!i?.length,l=!!n?.length,o={[I.containerList]:"preview"!==e,[I.containerPreview]:"preview"===e},d=a.editing&&a.operations?.add&&s.addButton?f("button",{bind:this,class:this.classes(g.button,g.buttonTertiary,I.addAttachmentButton),onclick:()=>this._startAddAttachment(),type:"button"},f("span",{"aria-hidden":"true",class:this.classes(I.itemAddIcon,v.plus)}),this.messages.add):void 0,c=r?f("ul",{class:I.items,key:"attachments-list"},i.toArray().map(t=>this._renderAttachmentInfo({attachmentInfo:t,displayType:e}))):void 0,m=l?f("ul",{class:I.items,key:"file-list"},n.toArray().map(e=>this._renderFile(e))):void 0,h=l||r?void 0:f("div",{class:g.empty},this.messages.noAttachments);return f("div",{class:this.classes(I.container,o),key:"attachments-container"},c,m,h,d)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(e){const t=e.target,s=t.files?.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(e,t){e.preventDefault(),t&&("file"in t?this.deleteFile(t.file):t&&this.deleteAttachment(t))}_submitAddAttachment(e){e.preventDefault(),this.viewModel.filesEnabled?this.addFile():this.addAttachment()}_submitUpdateAttachment(e,t){e.preventDefault(),t&&"file"in t?this.updateFile():this.updateAttachment()}_startEditAttachment(e){const{viewModel:t}=this;t.activeFileInfo=null,t.activeAttachmentInfo=e,t.mode="edit"}_startEditFile(e){const{viewModel:t}=this;t.activeAttachmentInfo=null,t.activeFileInfo=e,t.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(e){e.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(e){const{orientationInfo:t}=e;return!this._supportsImageOrientation&&t?[t.rotation?`rotate(${t.rotation}deg)`:"",t.mirrored?"scaleX(-1)":""].join(" "):""}};e([d()],T.prototype,"capabilities",null),e([d()],T.prototype,"displayType",void 0),e([d({readOnly:!0})],T.prototype,"effectiveDisplayType",null),e([d()],T.prototype,"attachmentKeywords",null),e([d()],T.prototype,"attachmentTypes",null),e([d({type:t})],T.prototype,"graphic",null),e([d()],T.prototype,"icon",null),e([d()],T.prototype,"label",null),e([d(),w("esri/widgets/Attachments/t9n/Attachments")],T.prototype,"messages",void 0),e([d(),w("esri/core/t9n/Units")],T.prototype,"messagesUnits",void 0),e([d({readOnly:!0})],T.prototype,"selectedFile",void 0),e([d({readOnly:!0})],T.prototype,"submitting",void 0),e([d({readOnly:!0})],T.prototype,"error",void 0),e([d({type:u})],T.prototype,"viewModel",void 0),e([d()],T.prototype,"visibleElements",void 0),e([c("visibleElements")],T.prototype,"castVisibleElements",null),T=e([m("esri.widgets.Attachments")],T);export{T as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../Graphic.js";import{deprecatedModule as s}from"../core/deprecate.js";import i from"../core/Error.js";import a from"../core/Logger.js";import{on as n,watch as r,initial as l}from"../core/reactiveUtils.js";import{formatFileSize as o}from"../core/unitFormatUtils.js";import{property as d,cast as c,subclass as m}from"../core/accessorSupport/decorators.js";import h from"./Widget.js";import u from"./Attachments/AttachmentsViewModel.js";import{getIconPath as p,isSupportedImage as b}from"./Attachments/support/attachmentUtils.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import{globalCss as g}from"./support/globalCss.js";import{legacyIcon as v}from"./support/legacyIcon.js";import{tsx as f,isRTL as y,messageBundle as w}from"./support/widget.js";import{discardNode as A,storeNode as M}from"./support/widgetUtils.js";const F={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},k="esri-attachments",I={base:k,loaderContainer:`${k}__loader-container`,loader:`${k}__loader`,container:`${k}__container`,containerList:`${k}__container--list`,containerPreview:`${k}__container--preview`,actions:`${k}__actions`,deleteButton:`${k}__delete-button`,addAttachmentButton:`${k}__add-attachment-button`,errorMessage:`${k}__error-message`,items:`${k}__items`,item:`${k}__item`,itemButton:`${k}__item-button`,itemMask:`${k}__item-mask`,itemMaskIcon:`${k}__item-mask--icon`,itemImage:`${k}__image`,itemImageResizable:`${k}__image--resizable`,itemLabel:`${k}__label`,itemFilename:`${k}__filename`,itemChevronIcon:`${k}__item-chevron-icon`,itemLink:`${k}__item-link`,itemLinkOverlay:`${k}__item-link-overlay`,itemLinkOverlayIcon:`${k}__item-link-overlay-icon`,itemAddIcon:`${k}__item-add-icon`,formNode:`${k}__form-node`,fileFieldset:`${k}__file-fieldset`,fileLabel:`${k}__file-label`,fileName:`${k}__file-name`,fileInput:`${k}__file-input`,metadata:`${k}__metadata`,metadataFieldset:`${k}__metadata-fieldset`,progressBar:`${k}__progress-bar`},$=window.CSS;let T=class extends h{constructor(e,t){super(e,t),this.displayType="auto",this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=null,this.visibleElements={...F},this._supportsImageOrientation=$&&$.supports&&$.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null,e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{s(a.getLogger("esri.widgets.Attachments"),"esri.widgets.Attachments",{replacement:"Use the Popup and Editor components to view and edit attachments respectively.",version:"5.0",see:"https://www.esriurl.com/components-transition-plan/",warnOnce:!0})})}normalizeCtorArgs(e){e?.viewModel||(e={viewModel:new u,...e});const{suppressDeprecationWarning:t,...s}=e;return s}initialize(){this.addHandles([n(()=>this.viewModel?.attachmentInfos,"change",()=>this.scheduleRender()),n(()=>this.viewModel?.fileInfos,"change",()=>this.scheduleRender()),r(()=>this.viewModel?.mode,()=>this._modeChanged(),l)])}loadDependencies(){return _({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")})}get capabilities(){return this.viewModel.capabilities}set capabilities(e){this.viewModel.capabilities=e}get effectiveDisplayType(){const{displayType:e}=this;return e&&"auto"!==e?e:this.viewModel.supportsResizeAttachments?"preview":"list"}get attachmentKeywords(){return this.viewModel.attachmentKeywords}set attachmentKeywords(e){this.viewModel.attachmentKeywords=e}get attachmentTypes(){return this.viewModel.attachmentTypes}set attachmentTypes(e){this.viewModel.attachmentTypes=e}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get icon(){return"attachment"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}castVisibleElements(e){return{...F,...e}}addAttachment(){const{_addAttachmentForm:e,viewModel:t}=this;return this._set("submitting",!0),this._set("error",null),t.addAttachment(e).then(e=>(this._set("submitting",!1),this._set("error",null),t.mode="view",e)).catch(e=>{throw this._set("submitting",!1),this._set("error",new i("attachments:add-attachment",this.messages.addErrorMessage,e)),e})}deleteAttachment(e){const{viewModel:t}=this;return this._set("submitting",!0),this._set("error",null),t.deleteAttachment(e).then(e=>(this._set("submitting",!1),this._set("error",null),t.mode="view",e)).catch(e=>{throw this._set("submitting",!1),this._set("error",new i("attachments:delete-attachment",this.messages.deleteErrorMessage,e)),e})}updateAttachment(){const{viewModel:e}=this,{_updateAttachmentForm:t}=this;return this._set("submitting",!0),this._set("error",null),e.updateAttachment(t).then(t=>(this._set("submitting",!1),this._set("error",null),e.mode="view",t)).catch(e=>{throw this._set("submitting",!1),this._set("error",new i("attachments:update-attachment",this.messages.updateErrorMessage,e)),e})}addFile(){const e=this.viewModel.addFile(this.selectedFile,this._addAttachmentForm);return this.viewModel.mode="view",e}updateFile(){const{viewModel:e}=this,t=e.updateFile(this.selectedFile,this._updateAttachmentForm,e.activeFileInfo);return e.mode="view",t}deleteFile(e){const t=this.viewModel.deleteFile(e||this.viewModel.activeFileInfo?.file);return this.viewModel.mode="view",t}render(){const{submitting:e,viewModel:t}=this,{state:s}=t;return f("div",{class:this.classes(I.base,g.widget)},e?this._renderProgressBar():null,"loading"===s?this._renderLoading():this._renderAttachments(),this._renderErrorMessage())}_renderErrorMessage(){const{error:e,visibleElements:t}=this;return e&&t.errorMessage?f("div",{class:I.errorMessage,key:"error-message"},e.message):null}_renderAttachments(){const{activeFileInfo:e,mode:t,activeAttachmentInfo:s}=this.viewModel;return"add"===t?this._renderAddForm():"edit"===t?this._renderDetailsForm(s||e):this._renderAttachmentContainer()}_renderLoading(){return f("div",{class:I.loaderContainer,key:"loader"},f("div",{class:I.loader}))}_renderProgressBar(){return this.visibleElements.progressBar?f("div",{class:I.progressBar,key:"progress-bar"}):null}_renderAddForm(){const{submitting:e,selectedFile:t}=this,s=e||!t,i=this.visibleElements.cancelAddButton?f("button",{bind:this,class:this.classes(g.button,g.buttonTertiary,g.buttonSmall,g.buttonHalf,e&&g.buttonDisabled),disabled:e,type:"button",onclick:this._cancelForm},this.messages.cancel):null,a=this.visibleElements.addSubmitButton?f("button",{class:this.classes(g.button,g.buttonSecondary,g.buttonSmall,g.buttonHalf,{[g.buttonDisabled]:s}),disabled:s,type:"submit"},this.messages.add):null,n=t?f("span",{class:I.fileName,key:"file-name"},t.name):null,r=f("form",{afterCreate:M,afterRemoved:A,bind:this,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},f("fieldset",{class:I.fileFieldset},n,f("label",{class:this.classes(I.fileLabel,g.button,g.buttonSecondary)},t?this.messages.changeFile:this.messages.selectFile,f("input",{bind:this,class:I.fileInput,name:"attachment",type:"file",onchange:this._handleFileInputChange}))),a,i);return f("div",{class:I.formNode,key:"add-form-container"},r)}_renderDetailsForm(e){const{visibleElements:t,viewModel:s,selectedFile:i,submitting:a}=this,{capabilities:n}=s,r=a||!i;let l,d,c,m;i?(l=i.type,d=i.name,c=i.size):e&&"file"in e?(l=e.file.type,d=e.file.name,c=e.file.size):e&&"contentType"in e&&(l=e.contentType,d=e.name,c=e.size,m=e.url);const h=n.editing&&n.operations?.delete&&t.deleteButton?f("button",{bind:this,class:this.classes(g.button,g.buttonSmall,g.buttonTertiary,I.deleteButton,{[g.buttonDisabled]:a}),disabled:a,key:"delete-button",type:"button",onclick:t=>this._submitDeleteAttachment(t,e)},this.messages.delete):void 0,u=n.editing&&n.operations?.update&&t.updateButton?f("button",{class:this.classes(g.button,g.buttonSmall,g.buttonThird,{[g.buttonDisabled]:r}),disabled:r,key:"update-button",type:"submit"},this.messages.update):void 0,p=this.visibleElements.cancelUpdateButton?f("button",{bind:this,class:this.classes(g.button,g.buttonSmall,g.buttonTertiary,g.buttonThird,{[g.buttonDisabled]:a}),disabled:a,key:"cancel-button",type:"button",onclick:this._cancelForm},this.messages.cancel):void 0,b=n.editing&&n.operations?.update?f("fieldset",{class:I.fileFieldset,key:"file"},f("span",{class:I.fileName,key:"file-name"},d),f("label",{class:this.classes(I.fileLabel,g.button,g.buttonSecondary)},this.messages.changeFile,f("input",{bind:this,class:I.fileInput,name:"attachment",type:"file",onchange:this._handleFileInputChange}))):void 0,_=f("fieldset",{class:I.metadataFieldset,key:"size"},f("label",null,o(this.messagesUnits,c??0))),v=f("fieldset",{class:I.metadataFieldset,key:"content-type"},f("label",null,l)),y=null!=m?f("a",{class:I.itemLink,href:m,rel:"noreferrer",target:"_blank"},this._renderImageMask(e,400),f("div",{class:I.itemLinkOverlay},f("span",{class:I.itemLinkOverlayIcon},f("calcite-icon",{icon:"launch"})))):this._renderImageMask(e,400),w=f("form",{afterCreate:M,afterRemoved:A,bind:this,"data-node-ref":"_updateAttachmentForm",onsubmit:t=>this._submitUpdateAttachment(t,e)},f("div",{class:I.metadata},_,v),b,f("div",{class:I.actions},h,p,u));return f("div",{class:I.formNode,key:"edit-form-container"},y,w)}_renderImageMask(e,t){return e?"file"in e?this._renderGenericImageMask(e.file.name,e.file.type):this._renderImageMaskForAttachment(e,t):null}_renderGenericImageMask(e,t){const{supportsResizeAttachments:s}=this.viewModel,i=p(t),a={[I.itemImageResizable]:s};return f("div",{class:this.classes(I.itemMaskIcon,I.itemMask),key:i},f("img",{alt:e,class:this.classes(a,I.itemImage),src:i,title:e}))}_renderImageMaskForAttachment(e,t){const{supportsResizeAttachments:s}=this.viewModel;if(!e)return null;const{contentType:i,name:a,size:n,url:r}=e;if(!s||!b(i))return this._renderGenericImageMask(a,i);const l=this._getCSSTransform(e),o=l?{transform:l,"image-orientation":"none"}:{},d=`${r}${r?.includes("?")?"&":"?"}w=${t}&s=${n}`,c={[I.itemImageResizable]:s};return f("div",{class:this.classes(I.itemMask),key:d},f("img",{alt:a,class:this.classes(c,I.itemImage),src:d,styles:o,title:a}))}_renderFile(e){const{file:t}=e;return f("li",{class:I.item,key:t},f("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:I.itemButton,key:"details-button",title:this.messages.attachmentDetails,type:"button",onclick:()=>this._startEditFile(e)},this._renderImageMask(e),f("label",{class:I.itemLabel},f("span",{class:I.itemFilename},t.name||this.messages.noTitle),f("span",{"aria-hidden":"true",class:this.classes(I.itemChevronIcon,y(this.container)?v.left:v.right)}))))}_renderAttachmentInfo({attachmentInfo:e,displayType:t}){const{viewModel:s,effectiveDisplayType:i}=this,{capabilities:a,supportsResizeAttachments:n}=s,{contentType:r,name:l,url:o}=e,d=this._renderImageMask(e,"list"===t?48:400),c=a.editing?f("span",{"aria-hidden":"true",class:this.classes(I.itemChevronIcon,y(this.container)?v.left:v.right)}):null,m=[d,"preview"===i&&n&&b(r)?null:f("label",{class:I.itemLabel},f("span",{class:I.itemFilename},l||this.messages.noTitle),c)],h=a.editing?f("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:I.itemButton,"data-attachment-info-id":e.id,key:"details-button",title:this.messages.attachmentDetails,type:"button",onclick:()=>this._startEditAttachment(e)},m):f("a",{class:I.itemButton,href:o??void 0,key:"details-link",rel:"noreferrer",target:"_blank"},m);return f("li",{class:I.item,key:e},h)}_renderAttachmentContainer(){const{effectiveDisplayType:e,viewModel:t,visibleElements:s}=this,{attachmentInfos:i,capabilities:a,fileInfos:n}=t,r=!!i?.length,l=!!n?.length,o={[I.containerList]:"preview"!==e,[I.containerPreview]:"preview"===e},d=a.editing&&a.operations?.add&&s.addButton?f("button",{bind:this,class:this.classes(g.button,g.buttonTertiary,I.addAttachmentButton),type:"button",onclick:()=>this._startAddAttachment()},f("span",{"aria-hidden":"true",class:this.classes(I.itemAddIcon,v.plus)}),this.messages.add):void 0,c=r?f("ul",{class:I.items,key:"attachments-list"},i.toArray().map(t=>this._renderAttachmentInfo({attachmentInfo:t,displayType:e}))):void 0,m=l?f("ul",{class:I.items,key:"file-list"},n.toArray().map(e=>this._renderFile(e))):void 0,h=l||r?void 0:f("div",{class:g.empty},this.messages.noAttachments);return f("div",{class:this.classes(I.container,o),key:"attachments-container"},c,m,h,d)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(e){const t=e.target,s=t.files?.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(e,t){e.preventDefault(),t&&("file"in t?this.deleteFile(t.file):t&&this.deleteAttachment(t))}_submitAddAttachment(e){e.preventDefault(),this.viewModel.filesEnabled?this.addFile():this.addAttachment()}_submitUpdateAttachment(e,t){e.preventDefault(),t&&"file"in t?this.updateFile():this.updateAttachment()}_startEditAttachment(e){const{viewModel:t}=this;t.activeFileInfo=null,t.activeAttachmentInfo=e,t.mode="edit"}_startEditFile(e){const{viewModel:t}=this;t.activeAttachmentInfo=null,t.activeFileInfo=e,t.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(e){e.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(e){const{orientationInfo:t}=e;return!this._supportsImageOrientation&&t?[t.rotation?`rotate(${t.rotation}deg)`:"",t.mirrored?"scaleX(-1)":""].join(" "):""}};e([d()],T.prototype,"capabilities",null),e([d()],T.prototype,"displayType",void 0),e([d({readOnly:!0})],T.prototype,"effectiveDisplayType",null),e([d()],T.prototype,"attachmentKeywords",null),e([d()],T.prototype,"attachmentTypes",null),e([d({type:t})],T.prototype,"graphic",null),e([d()],T.prototype,"icon",null),e([d()],T.prototype,"label",null),e([d(),w("esri/widgets/Attachments/t9n/Attachments")],T.prototype,"messages",void 0),e([d(),w("esri/core/t9n/Units")],T.prototype,"messagesUnits",void 0),e([d({readOnly:!0})],T.prototype,"selectedFile",void 0),e([d({readOnly:!0})],T.prototype,"submitting",void 0),e([d({readOnly:!0})],T.prototype,"error",void 0),e([d({type:u})],T.prototype,"viewModel",void 0),e([d()],T.prototype,"visibleElements",void 0),e([c("visibleElements")],T.prototype,"castVisibleElements",null),T=e([m("esri.widgets.Attachments")],T);export{T as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{getAssetUrl as t}from"../assets.js";import{deprecateWidget as s}from"../core/deprecate.js";import a from"../core/Logger.js";import{when as i}from"../core/reactiveUtils.js";import{property as r,subclass as o}from"../core/accessorSupport/decorators.js";import{getBasemapThumbnailUrl as l,isBasemap3D as n,isBasemapInBeta as d}from"../support/basemapUtils.js";import m from"./Widget.js";import p from"./BasemapGallery/BasemapGalleryViewModel.js";import{css as c}from"./BasemapGallery/css.js";import{loadCalciteComponents as h}from"./support/componentsUtils.js";import{globalCss as g}from"./support/globalCss.js";import{Heading as u}from"./support/Heading.js";import{messageBundle as v,accessibleHandler as b,tsx as y}from"./support/widget.js";let w=class extends m{constructor(e,t){super(e,t),this.disabled=!1,this.headingLevel=2,this.messages=null,this.viewModel=new p,this._focusBasemapItemEnabled=!1,s(a.getLogger(this),"Basemap Gallery","arcgis-basemap-gallery",{version:"4.32"})}initialize(){this.addHandles(i(()=>this.source,()=>this.viewModel.loadSource(),{sync:!0,initial:!0}))}loadDependencies(){return h({scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip")})}get activeBasemap(){return this.viewModel.activeBasemap}set activeBasemap(e){this.viewModel.activeBasemap=e}get icon(){return"basemap"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get source(){return this.viewModel.source}set source(e){this.viewModel.source=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e="loading"===this.source.state,t=this.disabled||"disabled"===this.viewModel.state,s={[c.sourceLoading]:e,[g.disabled]:t};return y("div",{class:this.classes(c.base,g.widget,g.panel,s),key:"container"},this._getContext())}_getContext(){if("unsupported"===this.viewModel.state)return y("div",{class:g.empty,key:"empty-message"},y(u,{level:this.headingLevel},this.messages.unsupported));if("loading"===this.source.state)return y("div",{class:c.loader,key:"loader"});const e=this.viewModel.items;return e.length>0?y("ul",{"aria-disabled":this.disabled,"aria-label":this.label,bind:this,class:c.itemContainer,key:"item-container",onkeydown:this._handleKeyDown
|
|
2
|
+
import{__decorate as e}from"tslib";import{getAssetUrl as t}from"../assets.js";import{deprecateWidget as s}from"../core/deprecate.js";import a from"../core/Logger.js";import{when as i}from"../core/reactiveUtils.js";import{property as r,subclass as o}from"../core/accessorSupport/decorators.js";import{getBasemapThumbnailUrl as l,isBasemap3D as n,isBasemapInBeta as d}from"../support/basemapUtils.js";import m from"./Widget.js";import p from"./BasemapGallery/BasemapGalleryViewModel.js";import{css as c}from"./BasemapGallery/css.js";import{loadCalciteComponents as h}from"./support/componentsUtils.js";import{globalCss as g}from"./support/globalCss.js";import{Heading as u}from"./support/Heading.js";import{messageBundle as v,accessibleHandler as b,tsx as y}from"./support/widget.js";let w=class extends m{constructor(e,t){super(e,t),this.disabled=!1,this.headingLevel=2,this.messages=null,this.viewModel=new p,this._focusBasemapItemEnabled=!1,s(a.getLogger(this),"Basemap Gallery","arcgis-basemap-gallery",{version:"4.32"})}initialize(){this.addHandles(i(()=>this.source,()=>this.viewModel.loadSource(),{sync:!0,initial:!0}))}loadDependencies(){return h({scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip")})}get activeBasemap(){return this.viewModel.activeBasemap}set activeBasemap(e){this.viewModel.activeBasemap=e}get icon(){return"basemap"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get source(){return this.viewModel.source}set source(e){this.viewModel.source=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e="loading"===this.source.state,t=this.disabled||"disabled"===this.viewModel.state,s={[c.sourceLoading]:e,[g.disabled]:t};return y("div",{class:this.classes(c.base,g.widget,g.panel,s),key:"container"},this._getContext())}_getContext(){if("unsupported"===this.viewModel.state)return y("div",{class:g.empty,key:"empty-message"},y(u,{level:this.headingLevel},this.messages.unsupported));if("loading"===this.source.state)return y("div",{class:c.loader,key:"loader"});const e=this.viewModel.items;return e.length>0?y("ul",{"aria-disabled":this.disabled,"aria-label":this.label,bind:this,class:c.itemContainer,key:"item-container",role:"radiogroup",onkeydown:this._handleKeyDown},e.map((e,t)=>this._renderBasemapGalleryItem(e,t)).toArray()):y("div",{class:g.empty,key:"empty-message"},y(u,{level:this.headingLevel},this.messages.noBasemaps))}_getRoundRobinIndex(e,t){return(e+t)%t}_handleKeyDown(e){const{key:t}=e;if(!["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(t))return;e.preventDefault();const{items:s,activeBasemapIndex:a}=this.viewModel,i="ArrowUp"===t||"ArrowLeft"===t?this._getRoundRobinIndex(Math.max(a-1,-1),s.length):this._getRoundRobinIndex(a+1,s.length),r=s.at(i);"ready"===r?.state&&(this.viewModel.activeBasemap=r.basemap),this._focusBasemapItemEnabled=!0}_focusBasemapItem(e){this._focusBasemapItemEnabled&&0===e.tabIndex&&(e.focus(),this._focusBasemapItemEnabled=!1)}_handleClick(e){const t=e.currentTarget["data-item"];"ready"===t.state&&(this.viewModel.activeBasemap=t.basemap)}_renderBasemapGalleryItem(e,s){const a=l(e.basemap)||t("esri/themes/base/images/basemap-toggle-64.svg"),i=e.basemap.title,r=e.basemap.portalItem?.snippet,o=e.error?.message||r||i,{viewModel:{state:d,activeBasemapIndex:m}}=this,p=this.disabled||"disabled"===d,h=m===s,u=h||-1===m&&0===s?0:-1,v="loading"===d,b={[c.selectedItem]:h,[c.itemError]:"error"===e.state},w=`basemapgallery-item-${e.uid}`;return y("li",{afterUpdate:this._focusBasemapItem,"aria-checked":h.toString(),"aria-disabled":p.toString(),"aria-labelledby":w,bind:this,class:this.classes(c.item,b),"data-item":e,key:e.uid,role:"radio",tabIndex:u,title:o,onclick:this._handleClick,onkeydown:this._handleClick},y("img",{alt:"",class:c.itemThumbnail,src:a}),y("div",{class:c.itemContent,key:"content"},y("div",{class:c.itemTitle,key:"title"},y("span",{id:w},i)),n(e.basemap)?this._renderTags(e.basemap):null),"loading"===e.state||h&&v?y("calcite-scrim",null,y("span",{"aria-hidden":"true",class:g.loaderAnimation,key:"loader",role:"presentation"})):null)}_renderTags(e){return y("div",{class:c.itemTagsContainer,key:"tag"},this._render3DTag(),d(e)?this._renderBetaTag():null)}_render3DTag(){const{messages:e}=this;return y("calcite-chip",{key:"tag-3d",label:e.tag3D,scale:"s"},this.messages.tag3D)}_renderBetaTag(){const{messages:e}=this;return y("calcite-chip",{appearance:"outline-fill",key:"tag-beta",label:e.tagBeta,scale:"s"},this.messages.tagBeta)}};e([r()],w.prototype,"activeBasemap",null),e([r()],w.prototype,"disabled",void 0),e([r()],w.prototype,"headingLevel",void 0),e([r()],w.prototype,"icon",null),e([r()],w.prototype,"label",null),e([r(),v("esri/widgets/BasemapGallery/t9n/BasemapGallery")],w.prototype,"messages",void 0),e([r()],w.prototype,"source",null),e([r()],w.prototype,"view",null),e([r({type:p})],w.prototype,"viewModel",void 0),e([r()],w.prototype,"_focusBasemapItemEnabled",void 0),e([b()],w.prototype,"_handleClick",null),w=e([o("esri.widgets.BasemapGallery")],w);const f=w;export{f as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../core/Collection.js";import{deprecateWidget as i}from"../core/deprecate.js";import{IdentifiableMixin as s}from"../core/Identifiable.js";import o from"../core/Logger.js";import r from"../core/ReactiveMap.js";import{on as l,initial as a,watch as n,syncAndInitial as d}from"../core/reactiveUtils.js";import{property as c,subclass as p}from"../core/accessorSupport/decorators.js";import m from"./Widget.js";import h from"./BasemapLayerList/BasemapLayerListViewModel.js";import u from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as g}from"./BasemapLayerList/css.js";import f from"./LayerList/LayerListItem.js";import y from"./LayerList/ListItem.js";import{minFilterItems as _,getItem as b,getLayerType as L,removeDestroyedListItems as v,setFilterPredicate as I,sortLayersToIds as w,sortChildLayersToIds as F}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as E}from"./support/componentsUtils.js";import{globalCss as C}from"./support/globalCss.js";import{incrementHeadingLevel as T}from"./support/Heading.js";import{calciteListFilterProps as M}from"./support/listUtils.js";import{tsx as P,messageBundle as O,vmEvent as A}from"./support/widget.js";import{setFocus as B}from"./support/widgetUtils.js";const R=t.ofType(y),k="nested",D=".*\\S+.*",j="data-basemap-layer-type";let x=class extends(s(m)){constructor(e,s){super(e,s),this._baseListEl=null,this._referenceListEl=null,this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._focusEditingFlowItem=!1,this._layerListMap=new r,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterPredicate=null,this.baseFilterText="",this.referenceFilterPredicate=null,this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=_,this.openedLayers=new t,this.openedLayerLists=new t,this.tableList=null,this.selectedItems=new R,this.selectionMode="none",this.tileOptions=null,this.viewModel=new h,this.visibilityAppearance="default",this.visibleElements=new u,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const o="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,r=b(e);if(!r?.sortable)return!1;const l=b(t),a=L(t),n=b(i),d=L(i),c=!!a&&!!d&&a===d,p={selected:r,from:l,to:n},m=t.group,h=i.group,u=l?.layer?.type??"",g=n?.layer?.type??"",f=new Set(["map-image","catalog","knowledge-graph"]),y="sublayer";return m&&h&&"function"==typeof o?o.call(null,p):c&&!f.has(u)&&!f.has(g)&&r?.layer?.type!==y},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find(e=>e.classList?.contains(g.item));this._activeItem=b(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:o,newIndex:r}=e;if(!s||!i||t?.newIndex===r&&t?.dragEl===o&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e,this._selectedDragItemLayerUid=o.value;const l=s,a=i;if(l===a){const e=Array.from(s.children).filter(e=>e?.matches("calcite-list-item")).map(e=>e.value);return void this._sortLayers(l,e)}this._moveLayerFromChildList({toEl:a,fromEl:l,dragEl:o,newIndex:r})},this.announceDeprecation=()=>{i(o.getLogger(this),"Basemap Layer List","arcgis-basemap-layer-list",{version:"5.0"})}}initialize(){this.addHandles([l(()=>this.openedLayers,"change",()=>this._handleOpenedLayersChange(),a),n(()=>[this.viewModel.referenceItems.toArray(),this.viewModel.baseItems.toArray()],()=>v(this.selectedItems),d),n(()=>[this.baseFilterPredicate,this._baseListEl],()=>I(this._baseListEl,this.baseFilterPredicate)),n(()=>[this.referenceFilterPredicate,this._referenceListEl],()=>I(this._referenceListEl,this.referenceFilterPredicate))])}loadDependencies(){return E({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._tooltipReferenceMap.clear(),this._destroyOpenedLayerLists()}get _visibleBaseItems(){return this.baseItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _visibleReferenceItems(){return this.referenceItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _openedPanelItems(){return this._visibleReferenceItems.concat(this._visibleBaseItems).flatten(e=>e.children).filter(({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)}get _totalBaseItems(){return this.viewModel.baseItems.flatten(e=>e.children.filter(e=>"catalog-dynamic-group"!==e.layer?.type)).length}get _totalReferenceItems(){return this.viewModel.referenceItems.flatten(e=>e.children.filter(e=>"catalog-dynamic-group"!==e.layer?.type)).length}get _baseFilterEnabled(){return this._totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this._totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map((t,i)=>this._renderLayerFlowItem(t,i===e.length-1))}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[C.hidden]:"loading"===e,[C.disabled]:"disabled"===e};return P("div",{class:this.classes(g.base,C.widget,C.panel,t)},this._renderItems())}async _createCatalogLayerList(e){const{default:t}=await import("./CatalogLayerList.js"),{headingLevel:i,catalogOptions:s,view:o,filterPlaceholder:r,minFilterItems:l,selectionMode:a,visibilityAppearance:n,_onCatalogOpen:d,_onTablesOpen:c,layerTablesEnabled:p}=this;return new t({headingLevel:i,view:o,filterPlaceholder:r,minFilterItems:l,selectionMode:a,visibilityAppearance:n,...s,catalogLayer:e,layerTablesEnabled:p,onCatalogOpen:d,onTablesOpen:c})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await import("./TableList.js"),{headingLevel:i,selectionMode:s,dragEnabled:o}=this;return new t({headingLevel:i,selectionMode:s,dragEnabled:o,...this._getTableListParams(e)})}async _createFlowList(e,t){const{_layerListMap:i}=this,s=i.get(e);if(s)return s;const o="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,o),o}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const s=new AbortController,{signal:o}=s;this._openedLayersController=s,e.forEach((i,s)=>{t.includes(s)||(i.destroy(),e.delete(s))});const r=await Promise.all(t.map(e=>this._createFlowList(e,o)));if(o.aborted)return;i.removeAll(),i.addMany(r);const l=i.at(-1);l?"catalogLayer"in l?(this._set("catalogLayerList",l),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",l)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){return e?P("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,overlayPositioning:"fixed",referenceElement:this._tooltipReferenceMap.get(e.layer?.uid),topLayerDisabled:this.topLayerDisabled},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter(e=>!e.hidden).toArray().map(e=>this._renderItemTooltipNodes(e))}_renderItemTooltips(){return this._visibleReferenceItems.concat(this._visibleBaseItems)?.toArray().map(e=>this._renderItemTooltipNodes(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,B(e))}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map(({title:i,panel:s},o)=>{const r=()=>this._handlePanelFlowItemBack(s);return P("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:s.title,headingLevel:this.headingLevel,key:`flow-panel-${s.uid}`,selected:!t.length&&o===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),r()}},s.render(),P("calcite-button",{appearance:"transparent",onclick:r,slot:"footer-start",width:"full"},this.messagesCommon.back))})}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,B(e))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,B(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,B(e))}_renderItem(e,t,i,s){return P(f,{activeItem:this._activeItem,canMove:this._canMove,css:g,displayMode:k,dragDisabled:t,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:i,parentTitles:s,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const o=b(i),r=b(e),l=b(t),a=N(t),n=N(e);a&&n&&this.viewModel.moveListItem({targetItem:o,fromParentItem:l,toParentItem:r,newIndex:s,from:a,to:n})}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:s}=e;t.insertBefore(i,t.children[s])}_sortLayers(e,t){if(e)if(e===this._referenceListEl||e===this._baseListEl){const i=e===this._referenceListEl?"reference":"base",s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;w(s,t)}else{const i=b(e);if(!i)return;F(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map(e=>b(e)).filter(Boolean);i.removeAll(),i.addMany(s)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return P("div",{class:g.editing},P("calcite-label",null,e.basemapTitle,P("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:D,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return P("calcite-button",{appearance:"outline",bind:this,label:e,onclick:this._toggleEditingTitle,slot:"footer",title:e,width:"full"},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return P("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"full"},e.form.ok)}_renderEditingForm(){return this.editingTitle?P("form",{bind:this,class:g.editingForm,onsubmit:this._formSubmit},P("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,selected:0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton())):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:t,messagesCommon:i}=this,s=i.edit;return t.editTitleButton&&!e?P("calcite-action",{bind:this,icon:"pencil",onclick:this._toggleEditingTitle,slot:"header-actions-end",text:s,title:s}):null}_renderNoLayersInfoMessage(e){return P("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return P("div",{class:g.itemMessage},P("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(e)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:o,flow:r},messages:l,viewModel:a}=this,n=[P("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:o?a.basemapTitle??l.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!this.editingTitle&&0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(),this._renderBaseSection()),this._renderEditingForm(),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return t?[r?P("calcite-flow",{key:"root-flow"},n):n,this._renderItemTooltips()]:null}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:s}=this,o=e.title||this.messages.untitledLayer;return P("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:o,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),s.pop();const t=s.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderList(e,t,i){const{messages:s,dragEnabled:o,selectionMode:r,filterPlaceholder:l,baseFilterText:a,referenceFilterText:n,_baseFilterEnabled:d,_referenceFilterEnabled:c,_rootGroupUid:p}=this,m="reference"===t?s.noReferenceLayers:s.noBaseLayers,h="reference"===t?c:d;return P("calcite-block",{class:g.section,collapsible:!0,expanded:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:T(this.headingLevel),key:`block-${t}`},e?.length?null:this._renderNoLayersInfo(m,t),P("calcite-list",{afterCreate:e=>{"reference"===t?this._referenceListEl=e:this._baseListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{"reference"===t?this._referenceListEl=null:this._baseListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),displayMode:k,filterProps:M,[j]:t,"data-layer-type":p,dragEnabled:o,filterEnabled:h,filterPlaceholder:l,filterText:h?"reference"===t?n:a:"",group:p,key:`list-${t}`,label:s.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:r,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},e?.toArray().map(e=>this._renderItem(e,i)),h?P("div",{class:g.filterNoResults,slot:"filter-no-results"},P("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(m))):null))}_renderBaseSection(){const{_visibleBaseItems:e}=this;return this.visibleElements.baseLayers?this._renderList(e,"base",1===e?.length):null}_renderReferenceSection(){return this.visibleElements.referenceLayers?this._renderList(this._visibleReferenceItems,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function N(e){return e?.closest(`[${j}]`)?.getAttribute(j)}e([c()],x.prototype,"_baseListEl",void 0),e([c()],x.prototype,"_referenceListEl",void 0),e([c()],x.prototype,"_activeItem",void 0),e([c()],x.prototype,"_tooltipReferenceMap",void 0),e([c()],x.prototype,"_focusRootFlowItem",void 0),e([c()],x.prototype,"_focusPanelFlowItem",void 0),e([c()],x.prototype,"_focusLayerFlowItem",void 0),e([c()],x.prototype,"_focusEditingFlowItem",void 0),e([c()],x.prototype,"_layerListMap",void 0),e([c()],x.prototype,"_visibleBaseItems",null),e([c()],x.prototype,"_visibleReferenceItems",null),e([c()],x.prototype,"_openedPanelItems",null),e([c()],x.prototype,"_totalBaseItems",null),e([c()],x.prototype,"_totalReferenceItems",null),e([c()],x.prototype,"_baseFilterEnabled",null),e([c()],x.prototype,"_referenceFilterEnabled",null),e([c()],x.prototype,"_renderedOpenLayerFlowItems",null),e([c()],x.prototype,"basemapTitle",null),e([c({readOnly:!0})],x.prototype,"catalogLayerList",void 0),e([c()],x.prototype,"catalogOptions",void 0),e([c()],x.prototype,"collapsed",void 0),e([c()],x.prototype,"dragEnabled",void 0),e([c()],x.prototype,"editingTitle",void 0),e([c()],x.prototype,"filterPlaceholder",void 0),e([c()],x.prototype,"baseFilterPredicate",void 0),e([c()],x.prototype,"baseFilterText",void 0),e([c()],x.prototype,"referenceFilterPredicate",void 0),e([c()],x.prototype,"referenceFilterText",void 0),e([c()],x.prototype,"listItemCanGiveFunction",void 0),e([c()],x.prototype,"listItemCanReceiveFunction",void 0),e([c()],x.prototype,"baseListItemCreatedFunction",null),e([c()],x.prototype,"headingLevel",void 0),e([c()],x.prototype,"icon",null),e([c()],x.prototype,"knowledgeGraphOptions",void 0),e([c()],x.prototype,"label",null),e([c()],x.prototype,"layerTablesEnabled",void 0),e([c()],x.prototype,"mapImageOptions",void 0),e([c(),O("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],x.prototype,"messages",void 0),e([c(),O("esri/t9n/common")],x.prototype,"messagesCommon",void 0),e([c()],x.prototype,"minFilterItems",void 0),e([c({readOnly:!0})],x.prototype,"openedLayers",void 0),e([c({readOnly:!0})],x.prototype,"openedLayerLists",void 0),e([c()],x.prototype,"referenceListItemCreatedFunction",null),e([c({readOnly:!0})],x.prototype,"tableList",void 0),e([c({readOnly:!0})],x.prototype,"baseItems",null),e([c({readOnly:!0})],x.prototype,"referenceItems",null),e([c({type:R})],x.prototype,"selectedItems",void 0),e([c()],x.prototype,"selectionMode",void 0),e([c()],x.prototype,"tileOptions",void 0),e([c()],x.prototype,"view",null),e([A("trigger-action"),c({type:h})],x.prototype,"viewModel",void 0),e([c()],x.prototype,"visibilityAppearance",void 0),e([c({type:u,nonNullable:!0})],x.prototype,"visibleElements",void 0),x=e([p("esri.widgets.BasemapLayerList")],x);const U=x;export{U as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../core/Collection.js";import{deprecateWidget as i}from"../core/deprecate.js";import{IdentifiableMixin as s}from"../core/Identifiable.js";import o from"../core/Logger.js";import r from"../core/ReactiveMap.js";import{on as l,initial as a,watch as n,syncAndInitial as d}from"../core/reactiveUtils.js";import{property as c,subclass as p}from"../core/accessorSupport/decorators.js";import m from"./Widget.js";import h from"./BasemapLayerList/BasemapLayerListViewModel.js";import u from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as g}from"./BasemapLayerList/css.js";import f from"./LayerList/LayerListItem.js";import y from"./LayerList/ListItem.js";import{minFilterItems as _,getItem as b,getLayerType as L,removeDestroyedListItems as v,setFilterPredicate as I,sortLayersToIds as w,sortChildLayersToIds as F}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as E}from"./support/componentsUtils.js";import{globalCss as C}from"./support/globalCss.js";import{incrementHeadingLevel as T}from"./support/Heading.js";import{calciteListFilterProps as M}from"./support/listUtils.js";import{tsx as P,messageBundle as O,vmEvent as A}from"./support/widget.js";import{setFocus as B}from"./support/widgetUtils.js";const R=t.ofType(y),k="nested",D=".*\\S+.*",j="data-basemap-layer-type";let x=class extends(s(m)){constructor(e,s){super(e,s),this._baseListEl=null,this._referenceListEl=null,this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._focusEditingFlowItem=!1,this._layerListMap=new r,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterPredicate=null,this.baseFilterText="",this.referenceFilterPredicate=null,this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minFilterItems=_,this.openedLayers=new t,this.openedLayerLists=new t,this.tableList=null,this.selectedItems=new R,this.selectionMode="none",this.tileOptions=null,this.viewModel=new h,this.visibilityAppearance="default",this.visibleElements=new u,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const o="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,r=b(e);if(!r?.sortable)return!1;const l=b(t),a=L(t),n=b(i),d=L(i),c=!!a&&!!d&&a===d,p={selected:r,from:l,to:n},m=t.group,h=i.group,u=l?.layer?.type??"",g=n?.layer?.type??"",f=new Set(["map-image","catalog","knowledge-graph"]),y="sublayer";return m&&h&&"function"==typeof o?o.call(null,p):c&&!f.has(u)&&!f.has(g)&&r?.layer?.type!==y},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find(e=>e.classList?.contains(g.item));this._activeItem=b(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:o,newIndex:r}=e;if(!s||!i||t?.newIndex===r&&t?.dragEl===o&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e,this._selectedDragItemLayerUid=o.value;const l=s,a=i;if(l===a){const e=Array.from(s.children).filter(e=>e?.matches("calcite-list-item")).map(e=>e.value);return void this._sortLayers(l,e)}this._moveLayerFromChildList({toEl:a,fromEl:l,dragEl:o,newIndex:r})},this.announceDeprecation=()=>{i(o.getLogger(this),"Basemap Layer List","arcgis-basemap-layer-list",{version:"5.0"})}}initialize(){this.addHandles([l(()=>this.openedLayers,"change",()=>this._handleOpenedLayersChange(),a),n(()=>[this.viewModel.referenceItems.toArray(),this.viewModel.baseItems.toArray()],()=>v(this.selectedItems),d),n(()=>[this.baseFilterPredicate,this._baseListEl],()=>I(this._baseListEl,this.baseFilterPredicate)),n(()=>[this.referenceFilterPredicate,this._referenceListEl],()=>I(this._referenceListEl,this.referenceFilterPredicate))])}loadDependencies(){return E({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._tooltipReferenceMap.clear(),this._destroyOpenedLayerLists()}get _visibleBaseItems(){return this.baseItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _visibleReferenceItems(){return this.referenceItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _openedPanelItems(){return this._visibleReferenceItems.concat(this._visibleBaseItems).flatten(e=>e.children).filter(({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)}get _totalBaseItems(){return this.viewModel.baseItems.flatten(e=>e.children.filter(e=>"catalog-dynamic-group"!==e.layer?.type)).length}get _totalReferenceItems(){return this.viewModel.referenceItems.flatten(e=>e.children.filter(e=>"catalog-dynamic-group"!==e.layer?.type)).length}get _baseFilterEnabled(){return this._totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this._totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map((t,i)=>this._renderLayerFlowItem(t,i===e.length-1))}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[C.hidden]:"loading"===e,[C.disabled]:"disabled"===e};return P("div",{class:this.classes(g.base,C.widget,C.panel,t)},this._renderItems())}async _createCatalogLayerList(e){const{default:t}=await import("./CatalogLayerList.js"),{headingLevel:i,catalogOptions:s,view:o,filterPlaceholder:r,minFilterItems:l,selectionMode:a,visibilityAppearance:n,_onCatalogOpen:d,_onTablesOpen:c,layerTablesEnabled:p}=this;return new t({headingLevel:i,view:o,filterPlaceholder:r,minFilterItems:l,selectionMode:a,visibilityAppearance:n,...s,catalogLayer:e,layerTablesEnabled:p,onCatalogOpen:d,onTablesOpen:c})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await import("./TableList.js"),{headingLevel:i,selectionMode:s,dragEnabled:o}=this;return new t({headingLevel:i,selectionMode:s,dragEnabled:o,...this._getTableListParams(e)})}async _createFlowList(e,t){const{_layerListMap:i}=this,s=i.get(e);if(s)return s;const o="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,o),o}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const s=new AbortController,{signal:o}=s;this._openedLayersController=s,e.forEach((i,s)=>{t.includes(s)||(i.destroy(),e.delete(s))});const r=await Promise.all(t.map(e=>this._createFlowList(e,o)));if(o.aborted)return;i.removeAll(),i.addMany(r);const l=i.at(-1);l?"catalogLayer"in l?(this._set("catalogLayerList",l),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",l)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){return e?P("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,overlayPositioning:"fixed",referenceElement:this._tooltipReferenceMap.get(e.layer?.uid),topLayerDisabled:this.topLayerDisabled},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter(e=>!e.hidden).toArray().map(e=>this._renderItemTooltipNodes(e))}_renderItemTooltips(){return this._visibleReferenceItems.concat(this._visibleBaseItems)?.toArray().map(e=>this._renderItemTooltipNodes(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,B(e))}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map(({title:i,panel:s},o)=>{const r=()=>this._handlePanelFlowItemBack(s);return P("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:s.title,headingLevel:this.headingLevel,key:`flow-panel-${s.uid}`,selected:!t.length&&o===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),r()}},s.render(),P("calcite-button",{appearance:"transparent",slot:"footer-start",width:"full",onclick:r},this.messagesCommon.back))})}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,B(e))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,B(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,B(e))}_renderItem(e,t,i,s){return P(f,{activeItem:this._activeItem,canMove:this._canMove,css:g,displayMode:k,dragDisabled:t,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:i,parentTitles:s,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const o=b(i),r=b(e),l=b(t),a=N(t),n=N(e);a&&n&&this.viewModel.moveListItem({targetItem:o,fromParentItem:l,toParentItem:r,newIndex:s,from:a,to:n})}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:s}=e;t.insertBefore(i,t.children[s])}_sortLayers(e,t){if(e)if(e===this._referenceListEl||e===this._baseListEl){const i=e===this._referenceListEl?"reference":"base",s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;w(s,t)}else{const i=b(e);if(!i)return;F(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map(e=>b(e)).filter(Boolean);i.removeAll(),i.addMany(s)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return P("div",{class:g.editing},P("calcite-label",null,e.basemapTitle,P("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:D,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return P("calcite-button",{appearance:"outline",bind:this,label:e,slot:"footer",title:e,width:"full",onclick:this._toggleEditingTitle},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return P("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"full"},e.form.ok)}_renderEditingForm(){return this.editingTitle?P("form",{bind:this,class:g.editingForm,onsubmit:this._formSubmit},P("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,selected:0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton())):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:t,messagesCommon:i}=this,s=i.edit;return t.editTitleButton&&!e?P("calcite-action",{bind:this,icon:"pencil",slot:"header-actions-end",text:s,title:s,onclick:this._toggleEditingTitle}):null}_renderNoLayersInfoMessage(e){return P("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return P("div",{class:g.itemMessage},P("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(e)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:o,flow:r},messages:l,viewModel:a}=this,n=[P("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:o?a.basemapTitle??l.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!this.editingTitle&&0===this.openedLayers.length&&0===this._openedPanelItems.length,onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(),this._renderBaseSection()),this._renderEditingForm(),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return t?[r?P("calcite-flow",{key:"root-flow"},n):n,this._renderItemTooltips()]:null}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:s}=this,o=e.title||this.messages.untitledLayer;return P("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:o,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),s.pop();const t=s.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderList(e,t,i){const{messages:s,dragEnabled:o,selectionMode:r,filterPlaceholder:l,baseFilterText:a,referenceFilterText:n,_baseFilterEnabled:d,_referenceFilterEnabled:c,_rootGroupUid:p}=this,m="reference"===t?s.noReferenceLayers:s.noBaseLayers,h="reference"===t?c:d;return P("calcite-block",{class:g.section,collapsible:!0,expanded:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:T(this.headingLevel),key:`block-${t}`},e?.length?null:this._renderNoLayersInfo(m,t),P("calcite-list",{afterCreate:e=>{"reference"===t?this._referenceListEl=e:this._baseListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{"reference"===t?this._referenceListEl=null:this._baseListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),displayMode:k,filterProps:M,[j]:t,"data-layer-type":p,dragEnabled:o,filterEnabled:h,filterPlaceholder:l,filterText:h?"reference"===t?n:a:"",group:p,key:`list-${t}`,label:s.widgetLabel,selectionAppearance:"border",selectionMode:r,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail),onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem},e?.toArray().map(e=>this._renderItem(e,i)),h?P("div",{class:g.filterNoResults,slot:"filter-no-results"},P("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(m))):null))}_renderBaseSection(){const{_visibleBaseItems:e}=this;return this.visibleElements.baseLayers?this._renderList(e,"base",1===e?.length):null}_renderReferenceSection(){return this.visibleElements.referenceLayers?this._renderList(this._visibleReferenceItems,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function N(e){return e?.closest(`[${j}]`)?.getAttribute(j)}e([c()],x.prototype,"_baseListEl",void 0),e([c()],x.prototype,"_referenceListEl",void 0),e([c()],x.prototype,"_activeItem",void 0),e([c()],x.prototype,"_tooltipReferenceMap",void 0),e([c()],x.prototype,"_focusRootFlowItem",void 0),e([c()],x.prototype,"_focusPanelFlowItem",void 0),e([c()],x.prototype,"_focusLayerFlowItem",void 0),e([c()],x.prototype,"_focusEditingFlowItem",void 0),e([c()],x.prototype,"_layerListMap",void 0),e([c()],x.prototype,"_visibleBaseItems",null),e([c()],x.prototype,"_visibleReferenceItems",null),e([c()],x.prototype,"_openedPanelItems",null),e([c()],x.prototype,"_totalBaseItems",null),e([c()],x.prototype,"_totalReferenceItems",null),e([c()],x.prototype,"_baseFilterEnabled",null),e([c()],x.prototype,"_referenceFilterEnabled",null),e([c()],x.prototype,"_renderedOpenLayerFlowItems",null),e([c()],x.prototype,"basemapTitle",null),e([c({readOnly:!0})],x.prototype,"catalogLayerList",void 0),e([c()],x.prototype,"catalogOptions",void 0),e([c()],x.prototype,"collapsed",void 0),e([c()],x.prototype,"dragEnabled",void 0),e([c()],x.prototype,"editingTitle",void 0),e([c()],x.prototype,"filterPlaceholder",void 0),e([c()],x.prototype,"baseFilterPredicate",void 0),e([c()],x.prototype,"baseFilterText",void 0),e([c()],x.prototype,"referenceFilterPredicate",void 0),e([c()],x.prototype,"referenceFilterText",void 0),e([c()],x.prototype,"listItemCanGiveFunction",void 0),e([c()],x.prototype,"listItemCanReceiveFunction",void 0),e([c()],x.prototype,"baseListItemCreatedFunction",null),e([c()],x.prototype,"headingLevel",void 0),e([c()],x.prototype,"icon",null),e([c()],x.prototype,"knowledgeGraphOptions",void 0),e([c()],x.prototype,"label",null),e([c()],x.prototype,"layerTablesEnabled",void 0),e([c()],x.prototype,"mapImageOptions",void 0),e([c(),O("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],x.prototype,"messages",void 0),e([c(),O("esri/t9n/common")],x.prototype,"messagesCommon",void 0),e([c()],x.prototype,"minFilterItems",void 0),e([c({readOnly:!0})],x.prototype,"openedLayers",void 0),e([c({readOnly:!0})],x.prototype,"openedLayerLists",void 0),e([c()],x.prototype,"referenceListItemCreatedFunction",null),e([c({readOnly:!0})],x.prototype,"tableList",void 0),e([c({readOnly:!0})],x.prototype,"baseItems",null),e([c({readOnly:!0})],x.prototype,"referenceItems",null),e([c({type:R})],x.prototype,"selectedItems",void 0),e([c()],x.prototype,"selectionMode",void 0),e([c()],x.prototype,"tileOptions",void 0),e([c()],x.prototype,"view",null),e([A("trigger-action"),c({type:h})],x.prototype,"viewModel",void 0),e([c()],x.prototype,"visibilityAppearance",void 0),e([c({type:u,nonNullable:!0})],x.prototype,"visibleElements",void 0),x=e([p("esri.widgets.BasemapLayerList")],x);const U=x;export{U as default};
|
package/widgets/BasemapToggle.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import s from"../core/Logger.js";import{property as i,cast as a,subclass as o}from"../core/accessorSupport/decorators.js";import{getBasemapThumbnailUrl as l}from"../support/basemapUtils.js";import r from"./Widget.js";import n from"./BasemapToggle/BasemapToggleViewModel.js";import{css as c}from"./BasemapToggle/css.js";import{loadCalciteComponents as p}from"./support/componentsUtils.js";import{globalCss as m}from"./support/globalCss.js";import{messageBundle as d,tsx as g}from"./support/widget.js";function u(e){const t=l(e);return t?{backgroundImage:"url("+t+")"}:{backgroundImage:""}}const v={title:!1};let b=class extends r{constructor(e,i){super(e,i),this.messages=null,this.viewModel=new n,this.visibleElements={...v},this.toggle=()=>this.viewModel.toggle(),t(s.getLogger(this),"Basemap Toggle","arcgis-basemap-toggle",{version:"4.32"})}loadDependencies(){return p({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim")})}get activeBasemap(){return this.viewModel.activeBasemap}get icon(){return"layer-basemap"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get nextBasemap(){return this.viewModel.nextBasemap}set nextBasemap(e){this.viewModel.nextBasemap=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...v,...e}}render(){const e=this.viewModel,t="disabled"===e.state?null:e.activeBasemap,s="disabled"===e.state?null:e.nextBasemap,i="loading"===e.state,a="incompatible-next-basemap"===e.state,o=s?.title??"",l=s&&"loaded"!==s.loadStatus;let r;const n=this.visibleElements.title&&o,p=a;return(n||p)&&(r=g("div",{class:c.overlay,key:"overlay"},n?g("span",{class:c.title,title:o},o):null,p?g("calcite-scrim",{class:c.overlayScrim,title:this.messages.incompatibleSpatialReference},g("calcite-icon",{icon:"exclamation-mark-triangle"})):null)),g("div",{class:this.classes(c.base,m.widget)},g("calcite-button",{appearance:"transparent","data-basemap-id":s?s.id:"",disabled:a,kind:"neutral",label:this.label,onclick:()=>{this.toggle()}
|
|
2
|
+
import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import s from"../core/Logger.js";import{property as i,cast as a,subclass as o}from"../core/accessorSupport/decorators.js";import{getBasemapThumbnailUrl as l}from"../support/basemapUtils.js";import r from"./Widget.js";import n from"./BasemapToggle/BasemapToggleViewModel.js";import{css as c}from"./BasemapToggle/css.js";import{loadCalciteComponents as p}from"./support/componentsUtils.js";import{globalCss as m}from"./support/globalCss.js";import{messageBundle as d,tsx as g}from"./support/widget.js";function u(e){const t=l(e);return t?{backgroundImage:"url("+t+")"}:{backgroundImage:""}}const v={title:!1};let b=class extends r{constructor(e,i){super(e,i),this.messages=null,this.viewModel=new n,this.visibleElements={...v},this.toggle=()=>this.viewModel.toggle(),t(s.getLogger(this),"Basemap Toggle","arcgis-basemap-toggle",{version:"4.32"})}loadDependencies(){return p({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim")})}get activeBasemap(){return this.viewModel.activeBasemap}get icon(){return"layer-basemap"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get nextBasemap(){return this.viewModel.nextBasemap}set nextBasemap(e){this.viewModel.nextBasemap=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...v,...e}}render(){const e=this.viewModel,t="disabled"===e.state?null:e.activeBasemap,s="disabled"===e.state?null:e.nextBasemap,i="loading"===e.state,a="incompatible-next-basemap"===e.state,o=s?.title??"",l=s&&"loaded"!==s.loadStatus;let r;const n=this.visibleElements.title&&o,p=a;return(n||p)&&(r=g("div",{class:c.overlay,key:"overlay"},n?g("span",{class:c.title,title:o},o):null,p?g("calcite-scrim",{class:c.overlayScrim,title:this.messages.incompatibleSpatialReference},g("calcite-icon",{icon:"exclamation-mark-triangle"})):null)),g("div",{class:this.classes(c.base,m.widget)},g("calcite-button",{appearance:"transparent","data-basemap-id":s?s.id:"",disabled:a,kind:"neutral",label:this.label,title:this.label,onclick:()=>{this.toggle()}},g("div",{class:this.classes(c.container,c.secondaryBasemapImage)},g("div",{class:c.image,styles:u(t)})),g("div",{class:c.container},g("div",{class:this.classes(c.image,l?c.imageLoading:null),styles:u(s)},l||i?g("calcite-scrim",null,g("span",{"aria-hidden":"true",class:m.loaderAnimation,role:"presentation"})):null),r)))}};e([i({readOnly:!0})],b.prototype,"activeBasemap",null),e([i()],b.prototype,"icon",null),e([i()],b.prototype,"label",null),e([i(),d("esri/widgets/BasemapToggle/t9n/BasemapToggle")],b.prototype,"messages",void 0),e([i()],b.prototype,"nextBasemap",null),e([i()],b.prototype,"view",null),e([i({type:n})],b.prototype,"viewModel",void 0),e([i()],b.prototype,"visibleElements",void 0),e([a("visibleElements")],b.prototype,"castVisibleElements",null),b=e([o("esri.widgets.BasemapToggle")],b);const h=b;export{h as default};
|
|
@@ -14,7 +14,7 @@ import type { AssociationsLayerUnion, AttachmentsChangeEvent, AttributeFormSuppo
|
|
|
14
14
|
import type { FormInput } from "./inputs/types.js";
|
|
15
15
|
import type { EditType } from "../support/forms/types.js";
|
|
16
16
|
|
|
17
|
-
export interface BatchAttributeFormViewModelProperties extends Partial<Pick<BatchAttributeFormViewModel, "activeFeatureIndex" | "disabled" | "editType" | "features" | "layerInfos" | "map" | "readOnly" | "selectedAttachment" | "selectedAttachmentAddElementId" | "selectedAttachmentListElementId" | "submitHasBeenAttempted" | "timeZone" | "userHasChangedValues">> {}
|
|
17
|
+
export interface BatchAttributeFormViewModelProperties extends Partial<Pick<BatchAttributeFormViewModel, "activeFeatureIndex" | "disabled" | "editType" | "features" | "layerInfos" | "map" | "readOnly" | "selectedAttachment" | "selectedAttachmentAddElementId" | "selectedAttachmentListElementId" | "showingSelectedAttachmentReplacePage" | "submitHasBeenAttempted" | "timeZone" | "userHasChangedValues">> {}
|
|
18
18
|
|
|
19
19
|
export interface BatchAttributeFormViewModelEvents {
|
|
20
20
|
/**
|
|
@@ -220,6 +220,8 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
|
|
|
220
220
|
get selectedAttachmentListInput(): AttachmentElementInput | null;
|
|
221
221
|
/** The set of form inputs used in `batch` editing [mode](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel/#mode). */
|
|
222
222
|
get sharedForm(): BatchFormInputs;
|
|
223
|
+
/** @internal */
|
|
224
|
+
accessor showingSelectedAttachmentReplacePage: boolean;
|
|
223
225
|
/**
|
|
224
226
|
* Indicates whether the view model is ready to be used. Upon construction,
|
|
225
227
|
* and then again any time the `features` Collection is modified or
|
|
@@ -308,6 +310,12 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
|
|
|
308
310
|
* @internal
|
|
309
311
|
*/
|
|
310
312
|
goHome(): Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* @param elementId - Attachment element identifier.
|
|
315
|
+
* @param attachmentGlobalId - Global identifier of the attachment whose staged changes should be cleared.
|
|
316
|
+
* @internal
|
|
317
|
+
*/
|
|
318
|
+
resetAttachmentChanges(elementId: string, attachmentGlobalId: string): void;
|
|
311
319
|
/**
|
|
312
320
|
* Used to specify a specific input to view associated layers for.
|
|
313
321
|
* Related to the 'viewing-associated-layers' page.
|
|
@@ -346,6 +354,11 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
|
|
|
346
354
|
* @internal
|
|
347
355
|
*/
|
|
348
356
|
setSelectedAttachmentListElementId(elementId: string | null | undefined): void;
|
|
357
|
+
/**
|
|
358
|
+
* @param value - Whether the selected attachment replace page should be shown.
|
|
359
|
+
* @internal
|
|
360
|
+
*/
|
|
361
|
+
setShowingSelectedAttachmentReplacePage(value: boolean): void;
|
|
349
362
|
/**
|
|
350
363
|
* @param elementId - Attachment element identifier.
|
|
351
364
|
* @param files - Files to stage for addition.
|
|
@@ -365,7 +378,7 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
|
|
|
365
378
|
* @param name - New attachment name.
|
|
366
379
|
* @internal
|
|
367
380
|
*/
|
|
368
|
-
stageRenameAttachment(elementId: string, attachmentGlobalId: string, name: string): void
|
|
381
|
+
stageRenameAttachment(elementId: string, attachmentGlobalId: string, name: string): Promise<void>;
|
|
369
382
|
/**
|
|
370
383
|
* @param elementId - Attachment element identifier.
|
|
371
384
|
* @param attachmentGlobalId - Global identifier of the attachment to replace.
|
|
@@ -376,6 +389,7 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
|
|
|
376
389
|
/**
|
|
377
390
|
* This method triggers the `"submit"` event, and causes [submitHasBeenAttempted](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel/#submitHasBeenAttempted) to become `true`. It does _not_ do anything to persist the updated values. It is up to the client to verify if these values are appropriate. For example, calling [FeatureLayer.applyEdits()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#applyEdits) method to update the features' attributes.
|
|
378
391
|
*
|
|
392
|
+
* @returns Resolves after any pending attachment hydration completes and the `"submit"` event has been emitted.
|
|
379
393
|
* @example
|
|
380
394
|
* // Listen for when 'submit' is called on the form.
|
|
381
395
|
* // Once it is fired, update the feature.
|
|
@@ -384,7 +398,7 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
|
|
|
384
398
|
* // execute the 'submit()' method.
|
|
385
399
|
* document.getElementById("btnUpdate").addEventListener("click", () => form.submit());
|
|
386
400
|
*/
|
|
387
|
-
submit(): void
|
|
401
|
+
submit(): Promise<void>;
|
|
388
402
|
/**
|
|
389
403
|
* Determines if user input has caused the given feature to become invalid. Only returns `true` if _all_ of the following three conditions are true of the given feature:
|
|
390
404
|
* 1. It had no validation errors at the start of the editing session.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{pushIfSome as e}from"../../core/arrayUtils.js";import{createTask as s}from"../../core/asyncUtils.js";import i from"../../core/Collection.js";import n from"../../core/Error.js";import{EventedAccessor as a}from"../../core/Evented.js";import r from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{abortMaybe as l,destroyMaybe as c}from"../../core/maybe.js";import{throwIfAborted as h,isAbortError as u}from"../../core/promiseUtils.js";import m from"../../core/ReactiveMap.js";import{on as p,sync as d,watch as f,syncAndInitial as g,whenOnce as A}from"../../core/reactiveUtils.js";import{property as y,subclass as v}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as _}from"../../core/support/UpdatingHandles.js";import F from"../../geometry/SpatialReference.js";import{getGraphicLayer as I}from"../../graphic/graphicOriginUtils.js";import{system as E}from"../../time/constants.js";import{getAttachmentKey as w}from"./attachmentUtils.js";import{createReactiveGraphic as x,isAttributeFormSupportedLayerWithAttachments as C,layerSupportsQueryAttachments as M,queryAttachmentsForElements as k}from"./batchAttributeFormUtils.js";import{ArcadeExecutorProvider as b}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as L}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as T}from"./expressions/ExpressionsModel.js";import S from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as V}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as j,isFieldInput as H}from"./inputs/support/inputUtils.js";import B from"./templates/BatchFormTemplate.js";import{getLayerContingentValuesMetaData as R}from"./templates/support/contingentValuesUtils.js";import{createBatchFormTemplate as G}from"./templates/support/createBatchFormTemplate.js";import{isExcludedFromSharedForm as U,isGroupElementTemplate as W}from"./templates/support/templateUtils.js";import{isEmptyValue as N}from"../support/forms/formUtils.js";function O(t,e){return t?.find(t=>t.layer===e)}let P=class extends a{constructor(t){super(t),this._attachmentCache=new m,this.activeFeatureIndex=-1,this.disabled=!1,this.editType="NA",this.features=new i,this._hasAsyncArcadeExpressions=!1,this.maximumFeatureCount=2e3,this.maximumFeatureCountWithComplexForms=50,this.map=null,this.pageStack=[],this.readOnly=!1,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.timeZone=null,this.userHasChangedValues=!1,this.layerInfos=null,this._arcadeExecutorProvider=new b,this._activeAssociationsInput=null,this._activeFormInputsByElementId=new Map,this._emptyForm=new S({inputs:[]}),this._emptyFormTemplate=new B({elements:[]}),this._featureFormMap=new Map,this._prepareTask=null,this._reactiveGraphicLookup=new m,this._updatingHandles=new _,this._layerTemplateMap=new m,this._layerContingentValuesMap=new m,this._workingFeatures=new i,this._expressionsManager=new L({arcadeContext:{editType:"NA",spatialReference:null,map:null,timeZone:E}}),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.addHandles([p(()=>this.features,"after-changes",()=>{this.goHome(),this.notifyChange("layers"),this._prepare()},d),f(()=>[this.features,this.map,this.timeZone,this.editType],()=>this._prepare(),d),f(()=>this.activeForm,()=>{this.goHome(),this._activeFormInputsByElementId.clear(),this._syncAttachments()},d),f(()=>this.activeFeature,()=>{this.goHome()},d),f(()=>this.page,t=>{const e=[...this.pageStack];if(e.includes(t))for(;e.length&&e.at(-1)!==t;)e.pop();else e.push(t);this.pageStack=e},g)]),this._prepare()}destroy(){this._prepareTask=l(this._prepareTask),this._workingFeatures.destroyAll(),c(this._expressionsManager),this._updatingHandles.destroy(),this._reactiveGraphicLookup=new m,this._emptyForm.destroy(),this._emptyFormTemplate.destroy()}get activeFeature(){const t=this.activeFeatureIndex;return t<0?null:this.features.at(t)}get activeForm(){if("batch"===this.mode)return this.sharedForm;const t=this._workingFeatures.at(this.activeFeatureIndex);if(!t)return this._emptyForm;const e=this._featureFormMap.get(t);if(e)return e;const s=this._makeBatchFormInputsForFeature(t);return s!==this._emptyForm&&this._featureFormMap.set(t,s),s}get activeLayer(){const{activeFeature:t}=this;if(!t)return null;return I(t)??null}get activeAssociationsInput(){return this._activeAssociationsInput}get calculating(){return this._expressionsManager.calculating}get expressionsManager(){return this._expressionsManager}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if("batch"===this.mode)return!1;const{activeFeature:t}=this;return this.invalidFeatures.some(e=>e!==t)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){for(const t of this.layers){const e=this._layerContingentValuesMap.get(t);if(e&&e.size>0)return!0}return!1}get visibleInputs(){return this.activeForm.inputs.filter(t=>t.visible)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(0===this.activeForm.inputs.length)return"noElements";const t=new Set;for(const e of this.activeForm.inputs)switch(e.visibilityCode){case"hidden:not-in-all-layers":case"hidden:no-domain-in-common":t.add("noElementsInCommon");break;case"hidden:field-definition":case"hidden:group-visibility-expression:all-features":case"hidden:visibility-expression:all-features":t.add("allElementsHidden");break;case"hidden:group-visibility-expression:some-features":case"hidden:visibility-expression:some-features":return"elementsHiddenInSome"}return t.has("allElementsHidden")?"allElementsHidden":"noElementsInCommon"}get page(){return this.selectedAttachmentDetails?"viewing-attachment-details":this.selectedAttachmentAddInput?"adding-attachments":this.selectedAttachmentListInput?"viewing-attachments":this.activeAssociationsInput?.associatedLayer?"viewing-associated-features":this.activeAssociationsInput?"viewing-associated-layers":"default"}get status(){const t=this._prepareTask;return null==t?"not-loaded":t.finished?null!=t.error?"failed":"loaded":"loading"}get submittable(){return this.valid,!0}get updating(){return this._updatingHandles.updating||this.calculating}get valid(){return this.sharedForm.valid&&Array.from(this._featureFormMap.values()).every(t=>t.valid)}get layers(){const t=new Set;return this.features.forEach(e=>{const s=I(e);s&&t.add(s)}),Array.from(t)}get mode(){return this.activeFeatureIndex>-1?"single":"batch"}submit(){this.submitHasBeenAttempted=!0,this.emit("submit",{name:"submit",results:this._makeSubmitResults(),valid:this.valid})}get selectedAttachment(){return this._get("selectedAttachment")??null}set selectedAttachment(t){this._set("selectedAttachment",t),null!=t&&(this.selectedAttachmentAddElementId=null)}get selectedAttachmentAddElementId(){return this._get("selectedAttachmentAddElementId")??null}set selectedAttachmentAddElementId(t){this._set("selectedAttachmentAddElementId",t),null!=t&&(this.selectedAttachment=null,this.selectedAttachmentListElementId=null)}get selectedAttachmentListElementId(){return this._get("selectedAttachmentListElementId")??null}set selectedAttachmentListElementId(t){this._set("selectedAttachmentListElementId",t),null!=t&&(this.selectedAttachment=null,this.selectedAttachmentAddElementId=null)}get selectedAttachmentListInput(){const t=this.selectedAttachmentListElementId,e=this.activeForm;return t&&e&&e.allAttachmentElementInputs.find(e=>e.template.elementId===t)||null}get selectedAttachmentAddInput(){const t=this.selectedAttachmentAddElementId,e=this.activeForm;return t&&e&&e.allAttachmentElementInputs.find(e=>e.template.elementId===t)||null}get selectedAttachmentDetails(){const t=this.selectedAttachment,e=this.activeForm;if(!t||!e)return null;const s=e.allAttachmentElementInputs.find(e=>e.template.elementId===t.elementId);if(!s)return null;const i=s.attachments.findIndex(e=>w(e)===t.attachmentKey);if(-1===i)return null;return{attachment:s.attachments[i],input:s}}findFieldInput(t){if(null==t)return;const e=this._activeFormInputsByElementId;if(e.has(t))return e.get(t);const s=this.activeForm.allFieldInputs.find(e=>e.template.elementId===t);return void 0!==s?(e.set(t,s),s):void 0}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(const t of this.visibleInputs){if(j(t)){const e=t.inputs.find(t=>H(t)&&!t.valid);if(e)return{input:e,groupInput:t}}if(H(t)&&!t.valid)return{input:t}}}getFieldInputValue(t){return this.findFieldInput(t)?.value}getValues(t){const e=this._reactiveGraphicLookup.get(t);if(!e)throw new n("feature-not-found","The given feature is not present in the BatchAttributeForm");return{...e.attributes}}async goBack(){switch(this.page){case"viewing-attachment-details":return void this.setSelectedAttachment(null);case"adding-attachments":return void this.setSelectedAttachmentAddElementId(null);case"viewing-attachments":return void this.setSelectedAttachmentListElementId(null);case"viewing-associated-features":return void this.setActiveAssociationsLayer(null);case"viewing-associated-layers":return void this.setActiveAssociationsInput(null);default:return}}async goHome(){this._syncStateToPage("default")}notifyGeometriesChanged(t){const e=[];for(const s of t){const t=this._reactiveGraphicLookup.get(s);t&&(e.push(t),t.geometry=s.geometry)}this._expressionsManager.runGeometryDependentExpressions(e)}async setFieldInputValue(t,e){const s=new Set(this.invalidFeatures);await t.setValueFromUser(e),this.userHasChangedValues=!0,this._trackValidityChange(s),this.emit("value-change",{features:t.features.toArray().map(t=>t.source),fieldName:t.fieldName,name:"value-change",value:e})}async setValue(t,e){const s=this.findFieldInput(t);if(null==s)throw new n("no-FieldInput-found",`Cannot set the value of FieldInput with ID: ${t} because none was found in the active form`);await this.setFieldInputValue(s,e)}async stageAddAttachments(t,e){if(0===e.length)return[];const s=this._findAttachmentInput(t);if(!s)return[];const i=await s.stageAddAttachments(e,this._expressionsManager.arcadeContext);return 0===i.length||(this.userHasChangedValues=!0,this._emitAttachmentsChange(s)),i}stageDeleteAttachment(t,e){const s=this._findAttachmentInput(t);if(!s)return;const i=this._findAttachment(s,e);i&&(s.stageDeleteAttachment(i),this.userHasChangedValues=!0,this._emitAttachmentsChange(s))}stageRenameAttachment(t,e,s){const i=this._findAttachmentInput(t);if(!i)return;const n=this._findAttachment(i,e);n&&0!==s.trim().length&&(i.stageRenameAttachment(n,s.trim()),this.userHasChangedValues=!0,this._emitAttachmentsChange(i))}async stageReplaceAttachment(t,e,s){const i=this._findAttachmentInput(t);if(!i)return;const n=this._findAttachment(i,e);n&&(await i.stageReplaceAttachment(n,s,this._expressionsManager.arcadeContext),this.userHasChangedValues=!0,this._emitAttachmentsChange(i))}clearAttachmentChanges(t){const e=this._findAttachmentInput(t);e&&(e.clearAttachmentChanges(),this._emitAttachmentsChange(e))}setActiveAssociationsInput(t){this._activeAssociationsInput=t}setActiveAssociationsLayer(t){this._activeAssociationsInput?.setAssociatedLayer(t)}setActiveAssociationType(t){this._activeAssociationsInput?.setActiveAssociationType(t)}setSelectedAttachment(t){this.selectedAttachment=t??null}setSelectedAttachmentAddElementId(t){this.selectedAttachmentAddElementId=t??null}setSelectedAttachmentListElementId(t){this.selectedAttachmentListElementId=t??null}_syncStateToPage(t){switch(t){case"viewing-attachment-details":return this.setSelectedAttachmentAddElementId(null),this.setActiveAssociationsLayer(null),void this.setActiveAssociationsInput(null);case"viewing-attachments":return this.setSelectedAttachment(null),this.setSelectedAttachmentAddElementId(null),this.setActiveAssociationsLayer(null),void this.setActiveAssociationsInput(null);case"adding-attachments":return this.setSelectedAttachment(null),this.setSelectedAttachmentListElementId(null),this.setActiveAssociationsLayer(null),void this.setActiveAssociationsInput(null);case"viewing-associated-features":return this.setSelectedAttachment(null),this.setSelectedAttachmentAddElementId(null),void this.setSelectedAttachmentListElementId(null);case"viewing-associated-layers":return this.setSelectedAttachment(null),this.setSelectedAttachmentAddElementId(null),this.setSelectedAttachmentListElementId(null),void this.setActiveAssociationsLayer(null);default:return this.setSelectedAttachment(null),this.setSelectedAttachmentAddElementId(null),this.setSelectedAttachmentListElementId(null),this.setActiveAssociationsLayer(null),void this.setActiveAssociationsInput(null)}}userChangesHaveMadeFeatureInvalid(t){return!!this._reactiveGraphicLookup.get(t)?.userChangesHaveMadeInvalid}async _trackValidityChange(t){await A(()=>!1===this.calculating);const e=this.invalidFeatures;for(const s of e)!1===t.has(s)&&this._reactiveGraphicLookup.has(s)&&(this._reactiveGraphicLookup.get(s).userChangesHaveMadeInvalid=!0)}validate(){return!1}_makeBatchFormInputsForFeature(t){const e=this._layerTemplateMap.get(t.layer);return e?V(e,{allFeatures:new i([t]),expressionsManager:this._expressionsManager,map:this.map}):this._emptyForm}_makeSubmitResults(){const t=new Map;for(const[s,i]of this._reactiveGraphicLookup){const n=[],a=[],r=this._featureFormMap.get(i)?.allAttachmentElementInputs??[];for(const t of r)e(n,t.toSubmitEdits()),t.valid||a.push(t.template.elementId);t.set(s,{feature:s,values:{...i.attributes},invalidFields:[],attachmentEdits:n,invalidAttachmentElementIds:a})}for(const e of this.sharedForm.allFieldInputs)for(const s of e.invalidFeatures)t.get(s)?.invalidFields.push(e.fieldName);return Array.from(t.values())}_findAttachmentInput(t){const e=this.activeForm.allAttachmentElementInputs.find(e=>e.template.elementId===t);return e||r.getLogger(this).error(`Attachment input not found for elementId '${t}'`),e}_findAttachment(t,e){const s=t.findAttachment(e);return s||r.getLogger(this).error(`Attachment '${e}' not found for attachment element '${t.template.elementId}'`),s}_makeAttachmentEdits(t){const s=[];for(const i of t.allAttachmentElementInputs)e(s,i.toSubmitEdits());return s}_emitAttachmentsChange(t){const e=t.single.feature;if(!e)return;const s=this._featureFormMap.get(e);this.emit("attachments-change",{name:"attachments-change",feature:e.source,attachmentEdits:this._makeAttachmentEdits(s??this.activeForm),valid:this.valid})}_prepare(){this._hasAsyncArcadeExpressions=!1,this._prepareTask=l(this._prepareTask),this._updateWorkingFeatures(),c(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new L({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??F.WebMercator,map:this.map,timeZone:this.timeZone||"system"}});const{layers:t}=this;if(0===t.length)return;const e=s(async e=>{try{h(e);const s=new Map;for(const n of t){const t=await R(n);if(h(e),t){const e=t.fieldGroups.flatMap(t=>t.fields);this._layerContingentValuesMap.set(n,new Set(e))}else this._layerContingentValuesMap.set(n,new Set);const i=O(this.layerInfos,n),a=await G(n,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this.timeZone},i?.formTemplate);h(e),this._layerTemplateMap.set(n,a);const r=a.getExpressionExecutorsForLayer(n);if(this._expressionsManager.layerExpressionsModelMap.set(n,new T({preserveFieldValuesWhenHidden:a.preserveFieldValuesWhenHidden,executorMap:r})),!this._hasAsyncArcadeExpressions)for(const e of r.keys()){const t=r.get(e);if(this._hasAsyncArcadeExpressions=!0===(t.editableExpression?.isAsync||t.requiredExpression?.isAsync||t.valueExpression?.isAsync||t.visibilityExpression?.isAsync),this._hasAsyncArcadeExpressions)break}for(const e of a.elements){if(U(e))continue;const t=e.clone();W(t)&&(t.elements=t.elements.filter(t=>!U(t)));const{elementId:i}=t;s.has(i)?s.get(i).foldIn(t):s.set(i,t)}}if(this.hasTooManyComplexFeatures)throw new n("too-many-features-with-complex-forms","There are too many features to load into the form with the configured complexity");if(this.hasTooManyFeatures)throw new n("too-many-features","There are too many features to load into the form.");const i=new B({elements:Array.from(s.values())});this.sharedFormTemplate=i,this.sharedForm=V(i,{allFeatures:this._workingFeatures,expressionsManager:this._expressionsManager,map:this.map}),await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray())}catch(s){throw u(s)||r.getLogger(this).error("Failed preparing form",s),s}});this._updatingHandles.consumePromise(e.promise),this._prepareTask=e}_updateWorkingFeatures(){this._workingFeatures.destroyAll();for(const e of this._featureFormMap.values())e.destroy();this._featureFormMap.clear(),this._attachmentCache.clear();const{features:t}=this;if(this._reactiveGraphicLookup=new m,0!==t.length){this._workingFeatures.addMany(t.map(x));for(const t of this._workingFeatures)this._reactiveGraphicLookup.set(t.source,t)}}async _syncAttachments(){const{activeFeature:t,activeLayer:e,activeForm:s}=this;if(!(t&&s&&C(e)&&M(e)))return;const i=t.getObjectId();if(null==i)return;const n=this._attachmentCache.get(e),a=s.allAttachmentElementInputs;if(!a.length)return;let r;if(n){const t=n.get(i);t&&(r=t)}if(!r){r=await k(e,i,a);o(this._attachmentCache,e,()=>new m).set(i,r)}for(const o of a)o.applyFetchedAttachments(z(o,r))}};t([y()],P.prototype,"_attachmentCache",void 0),t([y({readOnly:!0})],P.prototype,"activeFeature",null),t([y()],P.prototype,"activeFeatureIndex",void 0),t([y({readOnly:!0})],P.prototype,"activeForm",null),t([y({readOnly:!0})],P.prototype,"activeLayer",null),t([y()],P.prototype,"activeAssociationsInput",null),t([y()],P.prototype,"disabled",void 0),t([y()],P.prototype,"calculating",null),t([y()],P.prototype,"editType",void 0),t([y()],P.prototype,"features",void 0),t([y()],P.prototype,"expressionEvaluationFailed",null),t([y()],P.prototype,"hasNonActiveInvalidFeatures",null),t([y()],P.prototype,"hasAsyncArcadeExpressions",null),t([y()],P.prototype,"_hasAsyncArcadeExpressions",void 0),t([y()],P.prototype,"invalidFeatures",null),t([y()],P.prototype,"hasVisibleInputs",null),t([y()],P.prototype,"hasLayersWithContingentValues",null),t([y()],P.prototype,"maximumFeatureCount",void 0),t([y()],P.prototype,"maximumFeatureCountWithComplexForms",void 0),t([y()],P.prototype,"visibleInputs",null),t([y()],P.prototype,"map",void 0),t([y()],P.prototype,"noVisibleElementsReason",null),t([y()],P.prototype,"page",null),t([y()],P.prototype,"pageStack",void 0),t([y()],P.prototype,"readOnly",void 0),t([y()],P.prototype,"spatialReference",void 0),t([y()],P.prototype,"submitHasBeenAttempted",void 0),t([y()],P.prototype,"timeZone",void 0),t([y()],P.prototype,"updating",null),t([y()],P.prototype,"valid",null),t([y()],P.prototype,"layers",null),t([y()],P.prototype,"mode",null),t([y()],P.prototype,"sharedForm",void 0),t([y()],P.prototype,"sharedFormTemplate",void 0),t([y()],P.prototype,"selectedAttachment",null),t([y()],P.prototype,"selectedAttachmentAddElementId",null),t([y()],P.prototype,"selectedAttachmentListElementId",null),t([y()],P.prototype,"selectedAttachmentListInput",null),t([y()],P.prototype,"selectedAttachmentAddInput",null),t([y()],P.prototype,"selectedAttachmentDetails",null),t([y()],P.prototype,"userHasChangedValues",void 0),t([y()],P.prototype,"layerInfos",void 0),t([y()],P.prototype,"_arcadeExecutorProvider",void 0),t([y()],P.prototype,"_activeAssociationsInput",void 0),t([y()],P.prototype,"_prepareTask",void 0),t([y()],P.prototype,"_reactiveGraphicLookup",void 0),t([y()],P.prototype,"_layerTemplateMap",void 0),t([y()],P.prototype,"_layerContingentValuesMap",void 0),t([y()],P.prototype,"_workingFeatures",void 0),t([y()],P.prototype,"_expressionsManager",void 0),P=t([v("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],P);const Z=P;function D(t){return null!=t&&t.trim().length>0}function $(t,e){const s=t.keywords;return D(s)&&s.toLowerCase()===e}function z(t,e){const s="attachment"===t.input?.type?t.input.attachmentAssociationType:"exact",i=t.attachmentKeyword;if("any"===s)return e;if("exactOrNone"===s){if(N(i))return e.filter(t=>!D(t.keywords));const t=i.toLowerCase();return e.filter(e=>!D(e.keywords)||$(e,t))}if(N(i))return e;const n=i.toLowerCase();return e.filter(t=>$(t,n))}export{Z as default};
|
|
2
|
+
import{__decorate as t}from"tslib";import{pushIfSome as e}from"../../core/arrayUtils.js";import{createTask as s}from"../../core/asyncUtils.js";import n from"../../core/Collection.js";import a from"../../core/Error.js";import{EventedAccessor as i}from"../../core/Evented.js";import r from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{destroyMaybe as l,abortMaybe as c}from"../../core/maybe.js";import{throwIfAborted as h,isAbortError as u}from"../../core/promiseUtils.js";import m from"../../core/ReactiveMap.js";import{on as d,sync as p,watch as g,syncAndInitial as A,initial as f,whenOnce as y}from"../../core/reactiveUtils.js";import{property as v,subclass as _}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as F}from"../../core/support/UpdatingHandles.js";import I from"../../geometry/SpatialReference.js";import{getGraphicLayer as w}from"../../graphic/graphicOriginUtils.js";import{system as E}from"../../time/constants.js";import{getAttachmentKey as x}from"./attachmentUtils.js";import{createReactiveGraphic as M,isAttributeFormSupportedLayerWithAttachments as C,layerSupportsQueryAttachments as b,queryAttachmentsForElements as k}from"./batchAttributeFormUtils.js";import{ReactiveContingentValuesManager as S}from"./ReactiveContingentValuesManager.js";import{ArcadeExecutorProvider as V}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as L}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as T}from"./expressions/ExpressionsModel.js";import H from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as j}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as P,isFieldInput as R}from"./inputs/support/inputUtils.js";import B from"./templates/BatchFormTemplate.js";import{createBatchFormTemplate as U}from"./templates/support/createBatchFormTemplate.js";import{isExcludedFromSharedForm as O,isGroupElementTemplate as G}from"./templates/support/templateUtils.js";import{ContingentValuesManager as D}from"../support/ContingentValuesManager.js";import{isEmptyValue as W}from"../support/forms/formUtils.js";function N(t,e){return t?.find(t=>t.layer===e)}let Z=class extends i{constructor(t){super(t),this._attachmentCache=new m,this.activeFeatureIndex=-1,this.callbacks=null,this.disabled=!1,this.editType="NA",this.features=new n,this._hasAsyncArcadeExpressions=!1,this.maximumFeatureCount=2e3,this.maximumFeatureCountWithComplexForms=50,this.map=null,this.pageStack=[],this.readOnly=!1,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.timeZone=null,this.userHasChangedValues=!1,this.layerInfos=null,this._arcadeExecutorProvider=new V,this._activeAssociationsInput=null,this._ownContingentValuesManager=null,this._activeFormInputsByElementId=new Map,this._emptyForm=new H({inputs:[]}),this._emptyFormTemplate=new B({elements:[]}),this._featureFormMap=new Map,this._prepareTask=null,this._reactiveGraphicLookup=new m,this._updatingHandles=new F,this._submitTask=null,this._layerTemplateMap=new m,this._workingFeatures=new n,this._expressionsManager=new L({arcadeContext:{editType:"NA",spatialReference:null,map:null,timeZone:E}}),this._getFieldValueOptionsForFeature=t=>this._reactiveContingentValuesManager.getAndWatchFieldValueOptions(t),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.contingentValuesManager||(this.contingentValuesManager=this._ownContingentValuesManager=new D),this.addHandles([d(()=>this.features,"after-changes",()=>{this.goHome(),this.notifyChange("layers"),this._prepare()},p),g(()=>[this.features,this.map,this.timeZone,this.editType],()=>this._prepare(),p),g(()=>this.activeForm,()=>{this.goHome(),this._activeFormInputsByElementId.clear(),this._syncAttachments()},p),g(()=>this.activeFeature,()=>{this.goHome()},p),g(()=>this.page,t=>{const e=[...this.pageStack];if(e.includes(t))for(;e.length&&e.at(-1)!==t;)e.pop();else e.push(t);this.pageStack=e},A),g(()=>this.contingentValuesManager,t=>{l(this._reactiveContingentValuesManager),this._reactiveContingentValuesManager=new S({manager:t})},f)]),this._prepare()}destroy(){this._prepareTask=c(this._prepareTask),this._workingFeatures.destroyAll(),l(this._expressionsManager),l(this._reactiveContingentValuesManager),this._updatingHandles.destroy(),this._reactiveGraphicLookup=new m,this._emptyForm.destroy(),this._emptyFormTemplate.destroy(),this._ownContingentValuesManager=l(this._ownContingentValuesManager)}get activeFeature(){const t=this.activeFeatureIndex;return t<0?null:this.features.at(t)}get activeForm(){if("batch"===this.mode)return this.sharedForm;const t=this._workingFeatures.at(this.activeFeatureIndex);if(!t)return this._emptyForm;const e=this._featureFormMap.get(t);if(e)return e;const s=this._makeBatchFormInputsForFeature(t);return s!==this._emptyForm&&this._featureFormMap.set(t,s),s}get activeLayer(){const{activeFeature:t}=this;if(!t)return null;return w(t)??null}get activeAssociationsInput(){return this._activeAssociationsInput}get calculating(){return this._expressionsManager.calculating}get expressionsManager(){return this._expressionsManager}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if("batch"===this.mode)return!1;const{activeFeature:t}=this;return this.invalidFeatures.some(e=>e!==t)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){const t=this.contingentValuesManager;for(const e of this.layers)if(t.getFieldsWithContingentValues(e).size>0)return!0;return!1}get visibleInputs(){return this.activeForm.inputs.filter(t=>t.visible)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(0===this.activeForm.inputs.length)return"noElements";const t=new Set;for(const e of this.activeForm.inputs)switch(e.visibilityCode){case"hidden:not-in-all-layers":case"hidden:no-domain-in-common":t.add("noElementsInCommon");break;case"hidden:field-definition":case"hidden:group-visibility-expression:all-features":case"hidden:visibility-expression:all-features":t.add("allElementsHidden");break;case"hidden:group-visibility-expression:some-features":case"hidden:visibility-expression:some-features":return"elementsHiddenInSome"}return t.has("allElementsHidden")?"allElementsHidden":"noElementsInCommon"}get page(){return this.showingSelectedAttachmentReplacePage&&this.selectedAttachmentDetails?"replacing-attachment":this.selectedAttachmentDetails?"viewing-attachment-details":this.selectedAttachmentAddInput?"adding-attachments":this.selectedAttachmentListInput?"viewing-attachments":this.activeAssociationsInput?.associatedLayer?"viewing-associated-features":this.activeAssociationsInput?"viewing-associated-layers":"default"}get status(){const t=this._prepareTask;return null==t?"not-loaded":t.finished?null!=t.error?"failed":"loaded":"loading"}get submittable(){return this.valid,!0}get updating(){return this._updatingHandles.updating||this.calculating||this._hasPendingAttachmentHydration}get valid(){return this.sharedForm.valid&&Array.from(this._featureFormMap.values()).every(t=>t.valid)}get layers(){const t=new Set;return this.features.forEach(e=>{const s=w(e);s&&t.add(s)}),Array.from(t)}get mode(){return this.activeFeatureIndex>-1?"single":"batch"}submit(){if(this.submitHasBeenAttempted=!0,!this._hasPendingAttachmentHydration)return this._emitSubmit(),Promise.resolve();if(this._submitTask)return this._submitTask.promise;const t=s(async()=>{await Promise.all(this._allAttachmentInputs.map(t=>t.waitForPendingAttachmentUpdateData())),this._emitSubmit()});return this._submitTask=t,t.promise.finally(()=>{this._submitTask===t&&(this._submitTask=null)}),t.promise}get selectedAttachment(){return this._get("selectedAttachment")??null}set selectedAttachment(t){this.showingSelectedAttachmentReplacePage=!1,this._set("selectedAttachment",t),null!=t&&(this.selectedAttachmentAddElementId=null)}get selectedAttachmentAddElementId(){return this._get("selectedAttachmentAddElementId")??null}set selectedAttachmentAddElementId(t){this.showingSelectedAttachmentReplacePage=!1,this._set("selectedAttachmentAddElementId",t),null!=t&&(this.selectedAttachment=null,this.selectedAttachmentListElementId=null)}get selectedAttachmentListElementId(){return this._get("selectedAttachmentListElementId")??null}set selectedAttachmentListElementId(t){this._set("selectedAttachmentListElementId",t),null!=t&&(this.selectedAttachment=null,this.selectedAttachmentAddElementId=null)}get selectedAttachmentListInput(){const t=this.selectedAttachmentListElementId,e=this.activeForm;return t&&e&&e.allAttachmentElementInputs.find(e=>e.template.elementId===t)||null}get showingSelectedAttachmentReplacePage(){return this._get("showingSelectedAttachmentReplacePage")??!1}set showingSelectedAttachmentReplacePage(t){this._set("showingSelectedAttachmentReplacePage",t&&null!=this.selectedAttachmentDetails)}get selectedAttachmentAddInput(){const t=this.selectedAttachmentAddElementId,e=this.activeForm;return t&&e&&e.allAttachmentElementInputs.find(e=>e.template.elementId===t)||null}get selectedAttachmentDetails(){const t=this.selectedAttachment,e=this.activeForm;if(!t||!e)return null;const s=e.allAttachmentElementInputs.find(e=>e.template.elementId===t.elementId);if(!s)return null;const n=s.attachments.findIndex(e=>x(e)===t.attachmentKey);if(-1===n)return null;return{attachment:s.attachments[n],input:s}}get _allAttachmentInputs(){const t=[...this.sharedForm.allAttachmentElementInputs];for(const e of this._featureFormMap.values())t.push(...e.allAttachmentElementInputs);return t}get _hasPendingAttachmentHydration(){return this._allAttachmentInputs.some(t=>t.hasPendingAttachmentUpdateData)}findFieldInput(t){if(null==t)return;const e=this._activeFormInputsByElementId;if(e.has(t))return e.get(t);const s=this.activeForm.allFieldInputs.find(e=>e.template.elementId===t);return void 0!==s?(e.set(t,s),s):void 0}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(const t of this.visibleInputs){if(P(t)){const e=t.inputs.find(t=>R(t)&&!t.valid);if(e)return{input:e,groupInput:t}}if(R(t)&&!t.valid)return{input:t}}}getFieldInputValue(t){return this.findFieldInput(t)?.value}getValues(t){const e=this._reactiveGraphicLookup.get(t);if(!e)throw new a("feature-not-found","The given feature is not present in the BatchAttributeForm");return{...e.attributes}}async goBack(){switch(this.page){case"replacing-attachment":return void this.setShowingSelectedAttachmentReplacePage(!1);case"viewing-attachment-details":return void this.setSelectedAttachment(null);case"adding-attachments":return void this.setSelectedAttachmentAddElementId(null);case"viewing-attachments":return void this.setSelectedAttachmentListElementId(null);case"viewing-associated-features":return void this.setActiveAssociationsLayer(null);case"viewing-associated-layers":return void this.setActiveAssociationsInput(null);default:return}}async goHome(){this._syncStateToPage("default")}notifyGeometriesChanged(t){const e=[];for(const s of t){const t=this._reactiveGraphicLookup.get(s);t&&(e.push(t),t.geometry=s.geometry)}this._expressionsManager.runGeometryDependentExpressions(e)}async setFieldInputValue(t,e){const s=new Set(this.invalidFeatures);await t.setValueFromUser(e),this.userHasChangedValues=!0,this._trackValidityChange(s),this.emit("value-change",{features:t.features.toArray().map(t=>t.source),fieldName:t.fieldName,name:"value-change",value:e})}async setValue(t,e){const s=this.findFieldInput(t);if(null==s)throw new a("no-FieldInput-found",`Cannot set the value of FieldInput with ID: ${t} because none was found in the active form`);await this.setFieldInputValue(s,e)}async stageAddAttachments(t,e){if(0===e.length)return[];const s=this._findAttachmentInput(t);if(!s)return[];const n=await s.stageAddAttachments(e,this._expressionsManager.arcadeContext);return 0===n.length||(this.userHasChangedValues=!0,this._emitAttachmentsChange(s)),n}stageDeleteAttachment(t,e){const s=this._findAttachmentInput(t);if(!s)return;const n=this._findAttachment(s,e);n&&(s.stageDeleteAttachment(n),this.userHasChangedValues=!0,this._emitAttachmentsChange(s))}async stageRenameAttachment(t,e,s){const n=this._findAttachmentInput(t);if(!n)return;const a=this._findAttachment(n,e);a&&0!==s.trim().length&&(n.stageRenameAttachment(a,s.trim()),this.userHasChangedValues=!0,await n.ensureStagedUpdateData(a),this._emitAttachmentsChange(n))}async stageReplaceAttachment(t,e,s){const n=this._findAttachmentInput(t);if(!n)return;const a=this._findAttachment(n,e);if(!a)return;await n.stageReplaceAttachment(a,s,this._expressionsManager.arcadeContext)&&(this.userHasChangedValues=!0,this._emitAttachmentsChange(n))}clearAttachmentChanges(t){const e=this._findAttachmentInput(t);e&&(e.clearAttachmentChanges(),this._emitAttachmentsChange(e))}setActiveAssociationsInput(t){this._activeAssociationsInput=t}setActiveAssociationsLayer(t){this._activeAssociationsInput?.setAssociatedLayer(t)}setActiveAssociationType(t){this._activeAssociationsInput?.setActiveAssociationType(t)}resetAttachmentChanges(t,e){const s=this._findAttachmentInput(t);if(!s)return;const n=this._findAttachment(s,e);n&&(s.discardStagedEdits(n),this._emitAttachmentsChange(s))}setSelectedAttachment(t){this.selectedAttachment=t??null}setShowingSelectedAttachmentReplacePage(t){this.showingSelectedAttachmentReplacePage=t}setSelectedAttachmentAddElementId(t){this.selectedAttachmentAddElementId=t??null}setSelectedAttachmentListElementId(t){this.selectedAttachmentListElementId=t??null}_syncStateToPage(t){switch(t){case"replacing-attachment":case"viewing-attachment-details":return this.setSelectedAttachmentAddElementId(null),this.setActiveAssociationsLayer(null),void this.setActiveAssociationsInput(null);case"viewing-attachments":return this.setSelectedAttachment(null),this.setSelectedAttachmentAddElementId(null),this.setActiveAssociationsLayer(null),void this.setActiveAssociationsInput(null);case"adding-attachments":return this.setSelectedAttachment(null),this.setSelectedAttachmentListElementId(null),this.setActiveAssociationsLayer(null),void this.setActiveAssociationsInput(null);case"viewing-associated-features":return this.setSelectedAttachment(null),this.setSelectedAttachmentAddElementId(null),void this.setSelectedAttachmentListElementId(null);case"viewing-associated-layers":return this.setSelectedAttachment(null),this.setSelectedAttachmentAddElementId(null),this.setSelectedAttachmentListElementId(null),void this.setActiveAssociationsLayer(null);default:return this.setShowingSelectedAttachmentReplacePage(!1),this.setSelectedAttachment(null),this.setSelectedAttachmentAddElementId(null),this.setSelectedAttachmentListElementId(null),this.setActiveAssociationsLayer(null),void this.setActiveAssociationsInput(null)}}userChangesHaveMadeFeatureInvalid(t){return!!this._reactiveGraphicLookup.get(t)?.userChangesHaveMadeInvalid}async _trackValidityChange(t){await y(()=>!1===this.calculating);const e=this.invalidFeatures;for(const s of e)!1===t.has(s)&&this._reactiveGraphicLookup.has(s)&&(this._reactiveGraphicLookup.get(s).userChangesHaveMadeInvalid=!0)}validate(){return!1}_makeBatchFormInputsForFeature(t){const e=this._layerTemplateMap.get(t.layer);return e?j(e,{allFeatures:new n([t]),expressionsManager:this._expressionsManager,getFieldValueOptionsForFeature:this._getFieldValueOptionsForFeature,map:this.map}):this._emptyForm}_makeSubmitResults(){const t=new Map;for(const[s,n]of this._reactiveGraphicLookup){const a=[],i=[],r=this._featureFormMap.get(n)?.allAttachmentElementInputs??[];for(const t of r)e(a,t.toSubmitEdits()),t.valid||i.push(t.template.elementId);t.set(s,{feature:s,values:{...n.attributes},invalidFields:[],attachmentEdits:a,invalidAttachmentElementIds:i})}for(const e of this.sharedForm.allFieldInputs)for(const s of e.invalidFeatures)t.get(s)?.invalidFields.push(e.fieldName);return Array.from(t.values())}_emitSubmit(){this.emit("submit",{name:"submit",results:this._makeSubmitResults(),valid:this.valid})}_findAttachmentInput(t){const e=this.activeForm.allAttachmentElementInputs.find(e=>e.template.elementId===t);return e||r.getLogger(this).error(`Attachment input not found for elementId '${t}'`),e}_findAttachment(t,e){const s=t.findAttachment(e);return s||r.getLogger(this).error(`Attachment '${e}' not found for attachment element '${t.template.elementId}'`),s}_makeAttachmentEdits(t){const s=[];for(const n of t.allAttachmentElementInputs)e(s,n.toSubmitEdits());return s}_emitAttachmentsChange(t){const e=t.single.feature;if(!e)return;const s=this._featureFormMap.get(e);this.emit("attachments-change",{name:"attachments-change",feature:e.source,attachmentEdits:this._makeAttachmentEdits(s??this.activeForm),valid:this.valid})}_prepare(){this._hasAsyncArcadeExpressions=!1,this._prepareTask=c(this._prepareTask),this._updateWorkingFeatures(),l(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new L({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??I.WebMercator,map:this.map,timeZone:this.timeZone||"system"}});const{layers:t}=this;if(0===t.length)return;const e=s(async e=>{try{h(e),this.contingentValuesManager.layers.addMany(t);const s=new Map;await Promise.all(t.map(t=>t.load()));for(const a of t){const t=N(this.layerInfos,a),n=await U(a,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this.timeZone},t?.formTemplate);h(e),this._layerTemplateMap.set(a,n);const i=n.getExpressionExecutorsForLayer(a);if(this._expressionsManager.layerExpressionsModelMap.set(a,new T({preserveFieldValuesWhenHidden:n.preserveFieldValuesWhenHidden,executorMap:i})),!this._hasAsyncArcadeExpressions)for(const e of i.keys()){const t=i.get(e);if(this._hasAsyncArcadeExpressions=!0===(t.editableExpression?.isAsync||t.requiredExpression?.isAsync||t.valueExpression?.isAsync||t.visibilityExpression?.isAsync),this._hasAsyncArcadeExpressions)break}for(const e of n.elements){if(O(e))continue;const t=e.clone();G(t)&&(t.elements=t.elements.filter(t=>!O(t)));const{elementId:n}=t;s.has(n)?s.get(n).foldIn(t):s.set(n,t)}}if(this.hasTooManyComplexFeatures)throw new a("too-many-features-with-complex-forms","There are too many features to load into the form with the configured complexity");if(this.hasTooManyFeatures)throw new a("too-many-features","There are too many features to load into the form.");const n=new B({elements:Array.from(s.values())});this.sharedFormTemplate=n,this.sharedForm=j(n,{allFeatures:this._workingFeatures,expressionsManager:this._expressionsManager,getFieldValueOptionsForFeature:this._getFieldValueOptionsForFeature,map:this.map}),await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray()),await y(()=>!this.contingentValuesManager.updating)}catch(s){throw u(s)||r.getLogger(this).error("Failed preparing form",s),s}});this._updatingHandles.consumePromise(e.promise),this._prepareTask=e}_updateWorkingFeatures(){this._workingFeatures.destroyAll();for(const e of this._featureFormMap.values())e.destroy();this._featureFormMap.clear(),this._attachmentCache.clear();const{features:t}=this;if(this._reactiveGraphicLookup=new m,0!==t.length){this._workingFeatures.addMany(t.map(M));for(const t of this._workingFeatures)this._reactiveGraphicLookup.set(t.source,t)}}async _syncAttachments(){const{activeFeature:t,activeLayer:e,activeForm:s}=this;if(!(t&&s&&C(e)&&b(e)))return;const n=t.getObjectId();if(null==n)return;const a=this._attachmentCache.get(e),i=s.allAttachmentElementInputs;if(!i.length)return;let r;if(a){const t=a.get(n);t&&(r=t)}if(!r){r=await k(e,n,i);o(this._attachmentCache,e,()=>new m).set(n,r)}for(const o of i)o.applyFetchedAttachments(q(o,r))}};t([v()],Z.prototype,"_attachmentCache",void 0),t([v({readOnly:!0})],Z.prototype,"activeFeature",null),t([v()],Z.prototype,"activeFeatureIndex",void 0),t([v({readOnly:!0})],Z.prototype,"activeForm",null),t([v({readOnly:!0})],Z.prototype,"activeLayer",null),t([v()],Z.prototype,"activeAssociationsInput",null),t([v()],Z.prototype,"callbacks",void 0),t([v()],Z.prototype,"disabled",void 0),t([v()],Z.prototype,"calculating",null),t([v()],Z.prototype,"contingentValuesManager",void 0),t([v()],Z.prototype,"editType",void 0),t([v()],Z.prototype,"features",void 0),t([v()],Z.prototype,"expressionEvaluationFailed",null),t([v()],Z.prototype,"hasNonActiveInvalidFeatures",null),t([v()],Z.prototype,"hasAsyncArcadeExpressions",null),t([v()],Z.prototype,"_hasAsyncArcadeExpressions",void 0),t([v()],Z.prototype,"invalidFeatures",null),t([v()],Z.prototype,"hasVisibleInputs",null),t([v()],Z.prototype,"hasLayersWithContingentValues",null),t([v()],Z.prototype,"maximumFeatureCount",void 0),t([v()],Z.prototype,"maximumFeatureCountWithComplexForms",void 0),t([v()],Z.prototype,"visibleInputs",null),t([v()],Z.prototype,"map",void 0),t([v()],Z.prototype,"noVisibleElementsReason",null),t([v()],Z.prototype,"page",null),t([v()],Z.prototype,"pageStack",void 0),t([v()],Z.prototype,"readOnly",void 0),t([v()],Z.prototype,"spatialReference",void 0),t([v()],Z.prototype,"submitHasBeenAttempted",void 0),t([v()],Z.prototype,"timeZone",void 0),t([v()],Z.prototype,"updating",null),t([v()],Z.prototype,"valid",null),t([v()],Z.prototype,"layers",null),t([v()],Z.prototype,"mode",null),t([v()],Z.prototype,"sharedForm",void 0),t([v()],Z.prototype,"sharedFormTemplate",void 0),t([v()],Z.prototype,"selectedAttachment",null),t([v()],Z.prototype,"selectedAttachmentAddElementId",null),t([v()],Z.prototype,"selectedAttachmentListElementId",null),t([v()],Z.prototype,"selectedAttachmentListInput",null),t([v()],Z.prototype,"showingSelectedAttachmentReplacePage",null),t([v()],Z.prototype,"selectedAttachmentAddInput",null),t([v()],Z.prototype,"selectedAttachmentDetails",null),t([v()],Z.prototype,"userHasChangedValues",void 0),t([v()],Z.prototype,"layerInfos",void 0),t([v()],Z.prototype,"_arcadeExecutorProvider",void 0),t([v()],Z.prototype,"_activeAssociationsInput",void 0),t([v()],Z.prototype,"_prepareTask",void 0),t([v()],Z.prototype,"_reactiveGraphicLookup",void 0),t([v()],Z.prototype,"_allAttachmentInputs",null),t([v()],Z.prototype,"_hasPendingAttachmentHydration",null),t([v()],Z.prototype,"_layerTemplateMap",void 0),t([v()],Z.prototype,"_workingFeatures",void 0),t([v()],Z.prototype,"_expressionsManager",void 0),Z=t([_("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],Z);const $=Z;function z(t){return null!=t&&t.trim().length>0}function K(t,e){const s=t.keywords;return z(s)&&s.toLowerCase()===e}function q(t,e){const s="attachment"===t.input?.type?t.input.attachmentAssociationType:"exact",n=t.attachmentKeyword;if("any"===s)return e;if("exactOrNone"===s){if(W(n))return e.filter(t=>!z(t.keywords));const t=n.toLowerCase();return e.filter(e=>!z(e.keywords)||K(e,t))}if(W(n))return e;const a=n.toLowerCase();return e.filter(t=>K(t,a))}export{$ as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
const t="esri-batch-attribute-form",e=`${t}__group`,a=`${t}__input`,n=`${t}__attachment-element`,i=`${t}__multiple-choice-input`,l={base:t,form:`${t}__form`,formHeader:`${t}__form-header`,noticeError:`${t}__notice-error`,label:`${t}__label`,labelTextContent:`${t}__label-text-content`,fieldInput:`${a}`,inputRadio:`${a}--radio`,placeholderRadio:`${a}--radio-placeholder`,inputRadioGroup:`${a}--radio-group`,inputRadioLabel:`${a}--radio-label`,inputDisabled:`${a}--disabled`,inputSwitch:`${a}--switch`,dateInputContainer:`${`${t}__date`}-input-container`,textElementInput:`${t}__text-element-input`,attachmentElementInput:`${n}-input`,attachmentElementLabel:`${n}-label`,attachmentElementList:`${n}-list`,attachmentElementListItem:`${n}-list-item`,attachmentElementListItemStart:`${n}-list-item-start`,attachmentElementListItemStagedIndicator:`${n}-list-item-staged-indicator`,attachmentElementListItemThumb:`${n}-list-item-thumb`,attachmentElementListItemIcon:`${n}-list-item-icon`,attachmentElementEmptyState:`${n}-empty-state`,attachmentElementEmptyAction:`${n}-empty-action`,attachmentElementAllPanel:`${n}-all-panel`,attachmentElementAddPanel:`${n}-add-panel`,attachmentElementFileInput:`${n}-file-input`,attachmentElementAddDropzone:`${n}-add-dropzone`,attachmentElementAddDropzoneIcon:`${n}-add-dropzone-icon`,attachmentElementAddDropzoneHeading:`${n}-add-dropzone-heading`,attachmentElementAddDropzoneDetail:`${n}-add-dropzone-detail`,attachmentElementDetail:`${n}-detail`,attachmentElementDetailPreview:`${n}-detail-preview`,attachmentElementDetailPreviewImage:`${n}-detail-preview-image`,attachmentElementDetailPreviewIcon:`${n}-detail-preview-icon`,attachmentElementDetailActions:`${n}-detail-actions`,attachmentElementDetailMetadata:`${n}-detail-metadata`,attachmentElementDetailMetadataLabel:`${n}-detail-metadata-label`,attachmentElementDetailMetadataValue:`${n}-detail-metadata-value`,relationshipElementInput:`${t}__relationship-element-input`,utilityNetworkAssociationsElementInput:`${t}__utility-network-associations-element-input`,centeredButton:`${t}__centered-button`,description:`${t}__description-text`,block:`${t}__block`,group:e,groupSequential:`${e}--sequential`,individualElement:`${e}__individual-element`,multipleChoiceInput:`${i}`,multipleChoiceSelectAll:`${i}__select-all`,multipleChoiceOtherChoice:`${i}__other-choice`,multipleChoiceOtherChoiceWithSelectAll:`${i}__other-choice--with-select-all`};export{l as css};
|
|
2
|
+
const t="esri-batch-attribute-form",e=`${t}__group`,a=`${t}__input`,n=`${t}__attachment-element`,i=`${t}__multiple-choice-input`,l={base:t,form:`${t}__form`,formHeader:`${t}__form-header`,noticeError:`${t}__notice-error`,label:`${t}__label`,labelTextContent:`${t}__label-text-content`,fieldInput:`${a}`,inputRadio:`${a}--radio`,placeholderRadio:`${a}--radio-placeholder`,inputRadioGroup:`${a}--radio-group`,inputRadioLabel:`${a}--radio-label`,inputDisabled:`${a}--disabled`,inputSwitch:`${a}--switch`,dateInputContainer:`${`${t}__date`}-input-container`,textElementInput:`${t}__text-element-input`,attachmentElementInput:`${n}-input`,attachmentElementLabel:`${n}-label`,attachmentElementList:`${n}-list`,attachmentElementListItem:`${n}-list-item`,attachmentElementListItemStart:`${n}-list-item-start`,attachmentElementListItemStagedIndicator:`${n}-list-item-staged-indicator`,attachmentElementListItemThumb:`${n}-list-item-thumb`,attachmentElementListItemIcon:`${n}-list-item-icon`,attachmentElementEmptyState:`${n}-empty-state`,attachmentElementEmptyAction:`${n}-empty-action`,attachmentElementAllPanel:`${n}-all-panel`,attachmentElementAddPanel:`${n}-add-panel`,attachmentElementFileInput:`${n}-file-input`,attachmentElementAddDropzone:`${n}-add-dropzone`,attachmentElementAddDropzoneIcon:`${n}-add-dropzone-icon`,attachmentElementAddDropzoneHeading:`${n}-add-dropzone-heading`,attachmentElementAddDropzoneDetail:`${n}-add-dropzone-detail`,attachmentElementDetail:`${n}-detail`,attachmentElementDetailPreview:`${n}-detail-preview`,attachmentElementDetailPreviewImage:`${n}-detail-preview-image`,attachmentElementDetailPreviewIcon:`${n}-detail-preview-icon`,attachmentElementDetailActions:`${n}-detail-actions`,attachmentElementDetailMetadata:`${n}-detail-metadata`,attachmentElementDetailMetadataGroup:`${n}-detail-metadata-group`,attachmentElementDetailFileNameRow:`${n}-detail-file-name-row`,attachmentElementDetailFileNameInput:`${n}-detail-file-name-input`,attachmentElementDetailMetadataLabel:`${n}-detail-metadata-label`,attachmentElementDetailMetadataValue:`${n}-detail-metadata-value`,relationshipElementInput:`${t}__relationship-element-input`,utilityNetworkAssociationsElementInput:`${t}__utility-network-associations-element-input`,centeredButton:`${t}__centered-button`,description:`${t}__description-text`,block:`${t}__block`,group:e,groupSequential:`${e}--sequential`,individualElement:`${e}__individual-element`,multipleChoiceInput:`${i}`,multipleChoiceSelectAll:`${i}__select-all`,multipleChoiceOtherChoice:`${i}__other-choice`,multipleChoiceOtherChoiceWithSelectAll:`${i}__other-choice--with-select-all`};export{l as css};
|
|
@@ -88,11 +88,33 @@ export default class AttachmentElementInput extends EditableInput<any> {
|
|
|
88
88
|
applyFetchedAttachments(attachments: AttachmentInfo[]): void;
|
|
89
89
|
/** @internal */
|
|
90
90
|
clearAttachmentChanges(): void;
|
|
91
|
+
/**
|
|
92
|
+
* @param attachment - Attachment whose staged changes should be cleared.
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
discardStagedEdits(attachment: AttachmentInfo): void;
|
|
96
|
+
/**
|
|
97
|
+
* @param attachment - Attachment whose staged update data should be hydrated when needed.
|
|
98
|
+
* @returns `true` when staged update data was hydrated for the attachment.
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
ensureStagedUpdateData(attachment: AttachmentInfo): Promise<boolean>;
|
|
91
102
|
/**
|
|
92
103
|
* @param attachmentGlobalId - Global identifier of the attachment to retrieve.
|
|
93
104
|
* @internal
|
|
94
105
|
*/
|
|
95
106
|
findAttachment(attachmentGlobalId: string): AttachmentInfo | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* @param attachment - Attachment whose staged edit state should be resolved.
|
|
109
|
+
* @returns The current staged edit state for the provided attachment.
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
getAttachmentEditState(attachment: AttachmentInfo): {
|
|
113
|
+
initialName: string | null;
|
|
114
|
+
isDeleted: boolean;
|
|
115
|
+
isRenamed: boolean;
|
|
116
|
+
isReplaced: boolean;
|
|
117
|
+
};
|
|
96
118
|
/**
|
|
97
119
|
* @param attachment - Attachment whose preview URL should be resolved.
|
|
98
120
|
* @param thumbnailSize - Optional thumbnail width to request for committed service-backed attachments.
|
|
@@ -144,7 +166,9 @@ export default class AttachmentElementInput extends EditableInput<any> {
|
|
|
144
166
|
* @param arcadeContextInfo - Context information used for filename expression evaluation.
|
|
145
167
|
* @internal
|
|
146
168
|
*/
|
|
147
|
-
stageReplaceAttachment(attachment: AttachmentInfo, file: Blob | File, arcadeContextInfo: ArcadeBatchFormCalculationContextInfo): Promise<
|
|
169
|
+
stageReplaceAttachment(attachment: AttachmentInfo, file: Blob | File, arcadeContextInfo: ArcadeBatchFormCalculationContextInfo): Promise<boolean>;
|
|
148
170
|
/** @internal */
|
|
149
171
|
toSubmitEdits(): PendingAttachmentEdits | null;
|
|
172
|
+
/** @internal */
|
|
173
|
+
waitForPendingAttachmentUpdateData(): Promise<void>;
|
|
150
174
|
}
|