@arcgis/core 5.1.0-next.110 → 5.1.0-next.112
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/03babc21d1781142a974.js +1 -0
- package/assets/esri/core/workers/chunks/08efd64acdfe46985293.js +1 -0
- package/assets/esri/core/workers/chunks/0b76534b60014d74ecb9.js +1 -0
- package/assets/esri/core/workers/chunks/{622bdd1b9d5d292ec12b.js → 0e6a388d51d9dbae46ba.js} +1 -1
- 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/{ddebc1dc10a2d207389f.js → 282f3d364411efac7b80.js} +1 -1
- package/assets/esri/core/workers/chunks/{d6d5ee9d0d998d730f81.js → 2bd334f9ab89334df713.js} +1 -1
- package/assets/esri/core/workers/chunks/340c68d09d2e8bef6727.js +2 -0
- package/assets/esri/core/workers/chunks/{17604cbd4d24158e2c16.js → 3835097520296b0517af.js} +1 -1
- package/assets/esri/core/workers/chunks/481dc7503587972a6bd2.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/{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/{94eab215bab3e4e0e5b5.js → 711d1873c760313e287f.js} +1 -1
- package/assets/esri/core/workers/chunks/{4e13d639419ac64f7563.js → 7c077e1a63ab97bf3e87.js} +1 -1
- 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/9ebc461529d5286fa2c2.js +2 -0
- package/assets/esri/core/workers/chunks/a95398214e530f896a2d.js +1 -0
- package/assets/esri/core/workers/chunks/{fc1fe1f58a65a1694c09.js → b02a68bbab07557cf02d.js} +1 -1
- 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/d02aa7438f46c1c2167a.js +2 -0
- 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/{55334ad3618899cdbf78.js → e5854a3f69dffaf9464d.js} +2 -2
- package/assets/esri/core/workers/chunks/ed939fd5d3827a3f70e0.js +1 -0
- package/assets/esri/core/workers/chunks/fe8334352d256d691a95.js +1 -0
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +7 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/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_ar.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
- 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/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
- package/layers/graphics/sources/parquet/PortalParquetLayerFileProvider.js +1 -1
- package/layers/support/SceneModification.js +1 -1
- package/layers/support/SceneModifications.js +1 -1
- package/layers/support/parquetUtils.js +1 -1
- package/package.json +2 -2
- package/renderers/ClassBreaksRenderer.js +1 -1
- package/renderers/UniqueValueRenderer.js +1 -1
- package/rest/print.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/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/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/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/shaders/GaussianSplatTechniqueConfiguration.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 +10 -1
- 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/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -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/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.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/PrintViewModel.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/Search.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/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/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/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/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/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/{69c9eb93553b006b640d.js.LICENSE.txt → 340c68d09d2e8bef6727.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{549d348ca181d06aefb7.js.LICENSE.txt → 481dc7503587972a6bd2.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{1d1929f98d941179be29.js.LICENSE.txt → 9ebc461529d5286fa2c2.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{b69d1d528e271568cbd8.js.LICENSE.txt → d02aa7438f46c1c2167a.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{55334ad3618899cdbf78.js.LICENSE.txt → e5854a3f69dffaf9464d.js.LICENSE.txt} +0 -0
|
@@ -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" | "submitHasBeenAttempted" | "timeZone" | "userHasChangedValues">> {}
|
|
17
|
+
export interface BatchAttributeFormViewModelProperties extends Partial<Pick<BatchAttributeFormViewModel, "activeFeatureIndex" | "disabled" | "editType" | "features" | "layerInfos" | "map" | "readOnly" | "selectedAttachment" | "selectedAttachmentAddElementId" | "selectedAttachmentListElementId" | "submitHasBeenAttempted" | "timeZone" | "userHasChangedValues">> {}
|
|
18
18
|
|
|
19
19
|
export interface BatchAttributeFormViewModelEvents {
|
|
20
20
|
/**
|
|
@@ -214,6 +214,10 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
|
|
|
214
214
|
* @internal
|
|
215
215
|
*/
|
|
216
216
|
get selectedAttachmentDetails(): SelectedAttachmentDetails | null;
|
|
217
|
+
/** @internal */
|
|
218
|
+
accessor selectedAttachmentListElementId: string | null;
|
|
219
|
+
/** @internal */
|
|
220
|
+
get selectedAttachmentListInput(): AttachmentElementInput | null;
|
|
217
221
|
/** The set of form inputs used in `batch` editing [mode](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel/#mode). */
|
|
218
222
|
get sharedForm(): BatchFormInputs;
|
|
219
223
|
/**
|
|
@@ -337,6 +341,11 @@ export default class BatchAttributeFormViewModel extends EventedAccessor {
|
|
|
337
341
|
* @internal
|
|
338
342
|
*/
|
|
339
343
|
setSelectedAttachmentAddElementId(elementId: string | null | undefined): void;
|
|
344
|
+
/**
|
|
345
|
+
* @param elementId - Attachment element identifier, or `null`/`undefined` to clear the selection.
|
|
346
|
+
* @internal
|
|
347
|
+
*/
|
|
348
|
+
setSelectedAttachmentListElementId(elementId: string | null | undefined): void;
|
|
340
349
|
/**
|
|
341
350
|
* @param elementId - Attachment element identifier.
|
|
342
351
|
* @param files - Files to stage for addition.
|
|
@@ -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 a from"../../core/Error.js";import{EventedAccessor as n}from"../../core/Evented.js";import r from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{abortMaybe as l,destroyMaybe as h}from"../../core/maybe.js";import{throwIfAborted as c,isAbortError as p}from"../../core/promiseUtils.js";import u from"../../core/ReactiveMap.js";import{on as m,sync as d,watch as f,syncAndInitial as g,whenOnce as y}from"../../core/reactiveUtils.js";import{property as v,subclass as A}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 x}from"../../time/constants.js";import{getAttachmentKey as w}from"./attachmentUtils.js";import{createReactiveGraphic as E,isAttributeFormSupportedLayerWithAttachments as C,layerSupportsQueryAttachments as M,queryAttachmentsForElements as k}from"./batchAttributeFormUtils.js";import{ArcadeExecutorProvider as b}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as T}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as V}from"./expressions/ExpressionsModel.js";import j from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as H}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as L,isFieldInput as S}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 Z=class extends n{constructor(t){super(t),this._attachmentCache=new u,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 j({inputs:[]}),this._emptyFormTemplate=new B({elements:[]}),this._featureFormMap=new Map,this._prepareTask=null,this._reactiveGraphicLookup=new u,this._updatingHandles=new _,this._layerTemplateMap=new u,this._layerContingentValuesMap=new u,this._workingFeatures=new i,this._expressionsManager=new T({arcadeContext:{editType:"NA",spatialReference:null,map:null,timeZone:x}}),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.addHandles([m(()=>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(),this._syncAttachments()},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(),h(this._expressionsManager),this._updatingHandles.destroy(),this._reactiveGraphicLookup=new u,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.selectedAttachmentAddElementId?"adding-attachments":this.selectedAttachment?"viewing-attachment-details":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)}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(L(t)){const e=t.inputs.find(t=>S(t)&&!t.valid);if(e)return{input:e,groupInput:t}}if(S(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(){const{page:t}=this;"viewing-attachment-details"!==t?"adding-attachments"!==t?"viewing-associated-features"!==t?"viewing-associated-layers"!==t||this.setActiveAssociationsInput(null):this.setActiveAssociationsLayer(null):this.setSelectedAttachmentAddElementId(null):this.setSelectedAttachment(null)}async goHome(){this.setSelectedAttachment(null),this.setActiveAssociationsLayer(null),this.setActiveAssociationsInput(null),this.setSelectedAttachmentAddElementId(null)}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 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 a=this._findAttachment(i,e);a&&0!==s.trim().length&&(i.stageRenameAttachment(a,s.trim()),this.userHasChangedValues=!0,this._emitAttachmentsChange(i))}async stageReplaceAttachment(t,e,s){const i=this._findAttachmentInput(t);if(!i)return;const a=this._findAttachment(i,e);a&&(await i.stageReplaceAttachment(a,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}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?H(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 a=[],n=[],r=this._featureFormMap.get(i)?.allAttachmentElementInputs??[];for(const t of r)e(a,t.toSubmitEdits()),t.valid||n.push(t.template.elementId);t.set(s,{feature:s,values:{...i.attributes},invalidFields:[],attachmentEdits:a,invalidAttachmentElementIds:n})}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(),h(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new T({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{c(e);const s=new Map;for(const a of t){const t=await R(a);if(c(e),t){const e=t.fieldGroups.flatMap(t=>t.fields);this._layerContingentValuesMap.set(a,new Set(e))}else this._layerContingentValuesMap.set(a,new Set);const i=O(this.layerInfos,a),n=await G(a,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this.timeZone},i?.formTemplate);c(e),this._layerTemplateMap.set(a,n);const r=n.getExpressionExecutorsForLayer(a);if(this._expressionsManager.layerExpressionsModelMap.set(a,new V({preserveFieldValuesWhenHidden:n.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 n.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 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 i=new B({elements:Array.from(s.values())});this.sharedFormTemplate=i,this.sharedForm=H(i,{allFeatures:this._workingFeatures,expressionsManager:this._expressionsManager,map:this.map}),await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray())}catch(s){throw p(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 u,0!==t.length){this._workingFeatures.addMany(t.map(E));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 a=this._attachmentCache.get(e),n=s.allAttachmentElementInputs;if(!n.length)return;let r;if(a){const t=a.get(i);t&&(r=t)}if(!r){r=await k(e,i,n);o(this._attachmentCache,e,()=>new u).set(i,r)}for(const o of n)o.applyFetchedAttachments(z(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,"disabled",void 0),t([v()],Z.prototype,"calculating",null),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,"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,"_layerTemplateMap",void 0),t([v()],Z.prototype,"_layerContingentValuesMap",void 0),t([v()],Z.prototype,"_workingFeatures",void 0),t([v()],Z.prototype,"_expressionsManager",void 0),Z=t([A("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],Z);const D=Z;function P(t){return null!=t&&t.trim().length>0}function $(t,e){const s=t.keywords;return P(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=>!P(t.keywords));const t=i.toLowerCase();return e.filter(e=>!P(e.keywords)||$(e,t))}if(N(i))return e;const a=i.toLowerCase();return e.filter(t=>$(t,a))}export{D 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 i 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{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 f,initial as A,whenOnce as v}from"../../core/reactiveUtils.js";import{property as y,subclass as F}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as _}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 k,queryAttachmentsForElements as V}from"./batchAttributeFormUtils.js";import{ReactiveContingentValuesManager as b}from"./ReactiveContingentValuesManager.js";import{ArcadeExecutorProvider as L}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as T}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as S}from"./expressions/ExpressionsModel.js";import j from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as H}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as B,isFieldInput as R}from"./inputs/support/inputUtils.js";import O from"./templates/BatchFormTemplate.js";import{createBatchFormTemplate as G}from"./templates/support/createBatchFormTemplate.js";import{isExcludedFromSharedForm as U,isGroupElementTemplate as W}from"./templates/support/templateUtils.js";import{ContingentValuesManager as P}from"../support/ContingentValuesManager.js";import{isEmptyValue as N}from"../support/forms/formUtils.js";function Z(t,e){return t?.find(t=>t.layer===e)}let D=class extends a{constructor(t){super(t),this._attachmentCache=new m,this.activeFeatureIndex=-1,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 L,this._activeAssociationsInput=null,this._ownContingentValuesManager=null,this._activeFormInputsByElementId=new Map,this._emptyForm=new j({inputs:[]}),this._emptyFormTemplate=new O({elements:[]}),this._featureFormMap=new Map,this._prepareTask=null,this._reactiveGraphicLookup=new m,this._updatingHandles=new _,this._layerTemplateMap=new m,this._workingFeatures=new n,this._expressionsManager=new T({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 P),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},f),g(()=>this.contingentValuesManager,t=>{l(this._reactiveContingentValuesManager),this._reactiveContingentValuesManager=new b({manager:t})},A)]),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.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=w(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 n=s.attachments.findIndex(e=>x(e)===t.attachmentKey);if(-1===n)return null;return{attachment:s.attachments[n],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(B(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 i("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 i("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))}stageRenameAttachment(t,e,s){const n=this._findAttachmentInput(t);if(!n)return;const i=this._findAttachment(n,e);i&&0!==s.trim().length&&(n.stageRenameAttachment(i,s.trim()),this.userHasChangedValues=!0,this._emitAttachmentsChange(n))}async stageReplaceAttachment(t,e,s){const n=this._findAttachmentInput(t);if(!n)return;const i=this._findAttachment(n,e);i&&(await n.stageReplaceAttachment(i,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)}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 v(()=>!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?H(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 i=[],a=[],r=this._featureFormMap.get(n)?.allAttachmentElementInputs??[];for(const t of r)e(i,t.toSubmitEdits()),t.valid||a.push(t.template.elementId);t.set(s,{feature:s,values:{...n.attributes},invalidFields:[],attachmentEdits:i,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 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 T({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 i of t){const t=Z(this.layerInfos,i),n=await G(i,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this.timeZone},t?.formTemplate);h(e),this._layerTemplateMap.set(i,n);const a=n.getExpressionExecutorsForLayer(i);if(this._expressionsManager.layerExpressionsModelMap.set(i,new S({preserveFieldValuesWhenHidden:n.preserveFieldValuesWhenHidden,executorMap:a})),!this._hasAsyncArcadeExpressions)for(const e of a.keys()){const t=a.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(U(e))continue;const t=e.clone();W(t)&&(t.elements=t.elements.filter(t=>!U(t)));const{elementId:n}=t;s.has(n)?s.get(n).foldIn(t):s.set(n,t)}}if(this.hasTooManyComplexFeatures)throw new i("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 i("too-many-features","There are too many features to load into the form.");const n=new O({elements:Array.from(s.values())});this.sharedFormTemplate=n,this.sharedForm=H(n,{allFeatures:this._workingFeatures,expressionsManager:this._expressionsManager,getFieldValueOptionsForFeature:this._getFieldValueOptionsForFeature,map:this.map}),await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray()),await v(()=>!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)&&k(e)))return;const n=t.getObjectId();if(null==n)return;const i=this._attachmentCache.get(e),a=s.allAttachmentElementInputs;if(!a.length)return;let r;if(i){const t=i.get(n);t&&(r=t)}if(!r){r=await V(e,n,a);o(this._attachmentCache,e,()=>new m).set(n,r)}for(const o of a)o.applyFetchedAttachments(q(o,r))}};t([y()],D.prototype,"_attachmentCache",void 0),t([y({readOnly:!0})],D.prototype,"activeFeature",null),t([y()],D.prototype,"activeFeatureIndex",void 0),t([y({readOnly:!0})],D.prototype,"activeForm",null),t([y({readOnly:!0})],D.prototype,"activeLayer",null),t([y()],D.prototype,"activeAssociationsInput",null),t([y()],D.prototype,"disabled",void 0),t([y()],D.prototype,"calculating",null),t([y()],D.prototype,"contingentValuesManager",void 0),t([y()],D.prototype,"editType",void 0),t([y()],D.prototype,"features",void 0),t([y()],D.prototype,"expressionEvaluationFailed",null),t([y()],D.prototype,"hasNonActiveInvalidFeatures",null),t([y()],D.prototype,"hasAsyncArcadeExpressions",null),t([y()],D.prototype,"_hasAsyncArcadeExpressions",void 0),t([y()],D.prototype,"invalidFeatures",null),t([y()],D.prototype,"hasVisibleInputs",null),t([y()],D.prototype,"hasLayersWithContingentValues",null),t([y()],D.prototype,"maximumFeatureCount",void 0),t([y()],D.prototype,"maximumFeatureCountWithComplexForms",void 0),t([y()],D.prototype,"visibleInputs",null),t([y()],D.prototype,"map",void 0),t([y()],D.prototype,"noVisibleElementsReason",null),t([y()],D.prototype,"page",null),t([y()],D.prototype,"pageStack",void 0),t([y()],D.prototype,"readOnly",void 0),t([y()],D.prototype,"spatialReference",void 0),t([y()],D.prototype,"submitHasBeenAttempted",void 0),t([y()],D.prototype,"timeZone",void 0),t([y()],D.prototype,"updating",null),t([y()],D.prototype,"valid",null),t([y()],D.prototype,"layers",null),t([y()],D.prototype,"mode",null),t([y()],D.prototype,"sharedForm",void 0),t([y()],D.prototype,"sharedFormTemplate",void 0),t([y()],D.prototype,"selectedAttachment",null),t([y()],D.prototype,"selectedAttachmentAddElementId",null),t([y()],D.prototype,"selectedAttachmentListElementId",null),t([y()],D.prototype,"selectedAttachmentListInput",null),t([y()],D.prototype,"selectedAttachmentAddInput",null),t([y()],D.prototype,"selectedAttachmentDetails",null),t([y()],D.prototype,"userHasChangedValues",void 0),t([y()],D.prototype,"layerInfos",void 0),t([y()],D.prototype,"_arcadeExecutorProvider",void 0),t([y()],D.prototype,"_activeAssociationsInput",void 0),t([y()],D.prototype,"_prepareTask",void 0),t([y()],D.prototype,"_reactiveGraphicLookup",void 0),t([y()],D.prototype,"_layerTemplateMap",void 0),t([y()],D.prototype,"_workingFeatures",void 0),t([y()],D.prototype,"_expressionsManager",void 0),D=t([F("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],D);const $=D;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(N(n))return e.filter(t=>!z(t.keywords));const t=n.toLowerCase();return e.filter(e=>!z(e.keywords)||K(e,t))}if(N(n))return e;const i=n.toLowerCase();return e.filter(t=>K(t,i))}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`,
|
|
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};
|
|
@@ -8,7 +8,7 @@ import type { ArcadeBatchFormCalculationContextInfo } from "../expressions/types
|
|
|
8
8
|
import type { EditableInputProperties } from "./EditableInput.js";
|
|
9
9
|
|
|
10
10
|
/** @since 5.1 */
|
|
11
|
-
export interface AttachmentElementInputProperties extends EditableInputProperties, Partial<Pick<AttachmentElementInput, "attachments">> {}
|
|
11
|
+
export interface AttachmentElementInputProperties extends EditableInputProperties, Partial<Pick<AttachmentElementInput, "attachments" | "displayCount">> {}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* This is a read-only support class that represents an [attachment element](https://developers.arcgis.com/javascript/latest/references/core/form/elements/AttachmentElement/) in a [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/).
|
|
@@ -20,12 +20,31 @@ export interface AttachmentElementInputProperties extends EditableInputPropertie
|
|
|
20
20
|
*/
|
|
21
21
|
export default class AttachmentElementInput extends EditableInput<any> {
|
|
22
22
|
constructor(properties: AttachmentElementInputProperties);
|
|
23
|
+
/**
|
|
24
|
+
* Indicates whether all attachments for this input are visible on the default page.
|
|
25
|
+
*
|
|
26
|
+
* @since 5.1
|
|
27
|
+
*/
|
|
28
|
+
get allAttachmentsVisibleOnDefaultPage(): boolean;
|
|
23
29
|
/** Indicates if the input allows users to rename attachments. */
|
|
24
30
|
get allowUserRename(): boolean | null | undefined;
|
|
25
31
|
/** The input's attachment keyword. This is used to filter attachments associated with the active feature. */
|
|
26
32
|
get attachmentKeyword(): string | null | undefined;
|
|
27
33
|
/** The attachments applicable to this input. */
|
|
28
34
|
accessor attachments: AttachmentInfo[];
|
|
35
|
+
/**
|
|
36
|
+
* The attachments visible on the default page before showing the full attachments list action.
|
|
37
|
+
*
|
|
38
|
+
* @since 5.1
|
|
39
|
+
*/
|
|
40
|
+
get defaultPageAttachments(): AttachmentInfo[];
|
|
41
|
+
/**
|
|
42
|
+
* The maximum number of attachments displayed on the default page before showing the full attachments list action.
|
|
43
|
+
*
|
|
44
|
+
* @default 3
|
|
45
|
+
* @since 5.1
|
|
46
|
+
*/
|
|
47
|
+
accessor displayCount: number;
|
|
29
48
|
/** Indicates if the attachment filename should be displayed. */
|
|
30
49
|
get displayFilename(): boolean | null | undefined;
|
|
31
50
|
/**
|
|
@@ -85,6 +104,11 @@ export default class AttachmentElementInput extends EditableInput<any> {
|
|
|
85
104
|
* @internal
|
|
86
105
|
*/
|
|
87
106
|
isFileAllowed(file: Blob | File): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* @param attachment - Attachment metadata to check.
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
isStagedAttachmentAddition(attachment: AttachmentInfo): boolean;
|
|
88
112
|
/**
|
|
89
113
|
* @param params - Attachment information and content to stage as a new attachment.
|
|
90
114
|
* @returns The staged attachment metadata.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../core/Collection.js";import a from"../../../core/Logger.js";import{isAbortError as s}from"../../../core/promiseUtils.js";import n from"../../../core/ReactiveMap.js";import r from"../../../core/ReactiveSet.js";import{generateBracedUUID as i}from"../../../core/uuid.js";import{property as o,subclass as l}from"../../../core/accessorSupport/decorators.js";import{getEffectiveLayerCapabilities as c}from"../../../layers/support/layerUtils.js";import m from"../../../rest/query/support/AttachmentInfo.js";import{getAttachmentTypeCategory as h}from"../../Attachments/support/attachmentUtils.js";import{getAttachmentUrl as d}from"../attachmentUtils.js";import{isAttributeFormSupportedLayer as p}from"../batchAttributeFormUtils.js";import u from"./EditableInput.js";import g from"./SingleFeatureInputAdapter.js";let y=-1,f=class extends u{constructor(t){super(t),this.attachments=[],this.group=null,this.single=new g({input:this}),this.type="attachment",this._initialAttachments=[],this._stagedAdds=new e,this._stagedDeletes=new r,this._stagedUpdates=new n,this._temporaryAttachmentUrls=new n}get allowUserRename(){return this.template.allowUserRename}get addDisabled(){const t=this.maxAttachmentCount;return null!=t&&this.attachments.length>=t}get accept(){const{categories:t}=this;if(!t.size)return;const e=[];return t.has("image")&&e.push("image/*"),t.has("audio")&&e.push("audio/*"),t.has("video")&&e.push("video/*"),t.has("document")&&e.push("text/*","application/*","model/*"),e.length>0?e.join(","):void 0}get categories(){const{input:t}=this,e=new Set;if(!t)return e;if("attachment"===t.type){const{inputTypes:a}=t;if(!a||0===a.length)return e;for(const t of a)_(e,t.type);return e}return _(e,t.type),e}get attachmentKeyword(){return this.template.attachmentKeyword?.trim()}get displayFilename(){return this.template.displayFilename}get feature(){return this.single.feature}get hasAttachmentChanges(){return this._stagedAdds.length>0||this._stagedUpdates.size>0||this._stagedDeletes.size>0}get input(){return this.template.input}get layer(){return this.single.layer}get maxAttachmentCount(){return this.template.maxAttachmentCount}get minAttachmentCount(){return this.template.minAttachmentCount}get supportsResize(){const{layer:t}=this;if(!t)return!1;const e=c(t);return!!e&&("attachment"in e&&!!e.attachment?.supportsResize)}get useOriginalFilename(){return this.template.useOriginalFilename}get valid(){const t=this.attachments.length,e=this.minAttachmentCount??-1/0,a=this.maxAttachmentCount??1/0,s=this.hasAttachmentChanges;return!(t<e||t>a)||!s}get _expressionLayer(){const t=this.layer;if(t)return"scene"===t.type&&"associatedLayer"in t&&null!=t.associatedLayer?t.associatedLayer:"feature"===t.type?t:void 0}destroy(){this._clearTemporaryAttachmentUrls()}applyFetchedAttachments(t){for(const e of t)this._normalizeAttachmentName(e);this._initialAttachments=t,this._recomputeAttachments()}clearAttachmentChanges(){this._clearTemporaryAttachmentUrls(),this._stagedAdds.removeAll(),this._stagedUpdates.clear(),this._stagedDeletes.clear(),this._recomputeAttachments()}stageAddAttachment(t){const{contentType:e,data:a,name:s}=t,n=t.globalId??i(),r=a instanceof Blob?a.size:void 0,o=s.trim(),l=new m({contentType:e??void 0,globalId:n,id:y--,keywords:this.attachmentKeyword??void 0,name:o,size:r});return this._setTemporaryAttachmentUrl(n,a),this._stagedAdds.add({globalId:n,info:l,data:a}),this._recomputeAttachments(),l}async stageAddAttachments(t,e){const a=t.filter(t=>this.isFileAllowed(t));if(0===a.length)return[];const s=[],n=new Map,r=Date.now();for(let i=0;i<a.length;i++){const t=a[i],o=t instanceof File?t.name:`attachment-${r}_${i+1}`,l=await this._computeAttachmentFilename(o,e),c=this._makeUniqueFilenameForOperation(n,l);s.push(this.stageAddAttachment({contentType:t.type,data:t,name:c}))}return s}findAttachment(t){if(t)return this.attachments.find(e=>e.globalId===t)}getAttachmentPreviewUrl(t,e){return(t.globalId?this._temporaryAttachmentUrls.get(t.globalId):void 0)??d(t,this.supportsResize,e)}isFileAllowed(t){if(!t.type)return!0;const{categories:e}=this;return!e.size||e.has(h(t.type))}stageDeleteAttachment(t){const e=t.globalId;if(!e)return;const a=this._stagedAdds.findIndex(t=>t.globalId===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedUpdates.delete(e),this._stagedDeletes.add(e),this._recomputeAttachments()}stageRenameAttachment(t,e){const a=t.globalId;if(!a)return;const s=this._stagedAdds.find(t=>t.globalId===a);if(s)return s.info.name=e,void this._recomputeAttachments();const n=this._stagedUpdates.get(a);this._stagedUpdates.set(a,{...n,info:t,name:e}),this._recomputeAttachments()}async stageReplaceAttachment(t,e,a){const s=e instanceof File?e.name:t.name,n=await this._computeAttachmentFilename(s,a);this._stageReplaceAttachment(t,e,n)}toSubmitEdits(){const t=[],e=[],s=Array.from(this._stagedDeletes);if(0===this._stagedAdds.length&&0===this._stagedUpdates.size&&0===s.length)return null;const n=this._featureIdentifier;if(!n)return a.getLogger(this).error("Unable to build attachment edits without a valid feature and layer."),null;for(const a of this._stagedAdds)t.push({feature:n,attachment:{globalId:a.globalId,contentType:a.info.contentType,data:a.data,name:a.info.name}});for(const[a,r]of this._stagedUpdates)e.push({feature:n,attachment:{globalId:a,contentType:r.contentType,data:r.data,name:r.name}});return{label:this.template.label,attachmentKeyword:this.attachmentKeyword,add:t,delete:s,update:e}}_recomputeAttachments(){const t=this._stagedDeletes,e=[];for(const a of this._stagedAdds)e.push(a.info);for(const a of this._initialAttachments){const s=a.globalId;if(!s||!t.has(s)){if(s&&this._stagedUpdates.has(s)){const t=this._stagedUpdates.get(s),n=a.clone();null!=t.name&&(n.name=t.name),e.push(n);continue}e.push(a)}}this.attachments=e}get _featureIdentifier(){const t=this.single.feature,e=this.layer;if(!t||!p(e))return null;const a=e.objectIdField,s="globalIdField"in e?e.globalIdField:null,n=t.getGlobalId()??(s?t.getAttribute(s):void 0);if(n)return{globalId:n};const r=t.getObjectId()??t.getAttribute(a),i=Number(r);return null==r||isNaN(i)?null:{objectId:i}}async _computeAttachmentFilename(t,e){const n=this.template.filenameExpressionExecutor;if(!n)return t;const r=this.single.feature,i=r?.plainGraphic,o=this._expressionLayer,l={$originalfeature:r?.original,$editcontext:{editType:e.editType},$layer:o,$featureset:o,$datastore:o?.url,$feature:i,$map:e.map},c={rawOutput:!0,spatialReference:e.spatialReference,timeZone:e.timeZone};try{const t=n.isAsync?await n.executeAsync(l,c):n.execute(l,c);if("string"==typeof t&&t.trim().length>0)return t.trim()}catch(m){s(m)||a.getLogger(this).error("Failed evaluating attachment filename expression",m)}return t}_makeUniqueFilenameForOperation(t,e){const a=e.toLowerCase(),s=t.get(a)??0;if(t.set(a,s+1),0===s)return e;const n=e.lastIndexOf(".");return`${n>0?e.slice(0,n):e}_${s}${n>0?e.slice(n):""}`}_stageReplaceAttachment(t,e,a){const s=t.globalId;if(!s)return;const n=this._stagedAdds.find(t=>t.globalId===s);if(n)return n.data=e,n.info.name=a,n.info.contentType=e.type,n.info.size=e.size,this._setTemporaryAttachmentUrl(s,e),void this._recomputeAttachments();const r=this._stagedUpdates.get(s);this._setTemporaryAttachmentUrl(s,e),this._stagedUpdates.set(s,{...r,info:t,contentType:e.type||r?.contentType,data:e,name:a}),this._recomputeAttachments()}_normalizeAttachmentName(t){const{name:e}=t;"string"==typeof e&&(t.name=e.trim())}_setTemporaryAttachmentUrl(t,e){if(this._clearTemporaryAttachmentUrl(t),!(e instanceof Blob))return;const a=URL.createObjectURL(e);return this._temporaryAttachmentUrls.set(t,a),a}_clearTemporaryAttachmentUrl(t){const e=this._temporaryAttachmentUrls.get(t);e&&(URL.revokeObjectURL(e),this._temporaryAttachmentUrls.delete(t))}_clearTemporaryAttachmentUrls(){for(const t of this._temporaryAttachmentUrls.values())URL.revokeObjectURL(t);this._temporaryAttachmentUrls.clear()}};t([o()],f.prototype,"allowUserRename",null),t([o({readOnly:!0})],f.prototype,"addDisabled",null),t([o({readOnly:!0})],f.prototype,"accept",null),t([o({readOnly:!0})],f.prototype,"categories",null),t([o()],f.prototype,"attachmentKeyword",null),t([o()],f.prototype,"attachments",void 0),t([o()],f.prototype,"displayFilename",null),t([o()],f.prototype,"feature",null),t([o()],f.prototype,"group",void 0),t([o({readOnly:!0})],f.prototype,"hasAttachmentChanges",null),t([o()],f.prototype,"input",null),t([o()],f.prototype,"layer",null),t([o()],f.prototype,"maxAttachmentCount",null),t([o()],f.prototype,"minAttachmentCount",null),t([o({readOnly:!0})],f.prototype,"single",void 0),t([o({readOnly:!0})],f.prototype,"type",void 0),t([o({readOnly:!0})],f.prototype,"supportsResize",null),t([o()],f.prototype,"useOriginalFilename",null),t([o({readOnly:!0})],f.prototype,"valid",null),t([o()],f.prototype,"_initialAttachments",void 0),t([o()],f.prototype,"_expressionLayer",null),t([o()],f.prototype,"_stagedAdds",void 0),t([o()],f.prototype,"_stagedDeletes",void 0),t([o()],f.prototype,"_stagedUpdates",void 0),t([o()],f.prototype,"_temporaryAttachmentUrls",void 0),t([o()],f.prototype,"_featureIdentifier",null),f=t([l("esri.widgets.BatchAttributeForm.inputs.AttachmentElementInput")],f);const A=f;function _(t,e){switch(e){case"audio":t.add("audio");break;case"document":t.add("document");break;case"image":case"signature":t.add("image");break;case"video":t.add("video")}}export{A as default};
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Collection.js";import a from"../../../core/Logger.js";import{isAbortError as s}from"../../../core/promiseUtils.js";import n from"../../../core/ReactiveMap.js";import r from"../../../core/ReactiveSet.js";import{generateBracedUUID as i}from"../../../core/uuid.js";import{property as o,subclass as l}from"../../../core/accessorSupport/decorators.js";import{getEffectiveLayerCapabilities as c}from"../../../layers/support/layerUtils.js";import h from"../../../rest/query/support/AttachmentInfo.js";import{getAttachmentTypeCategory as m}from"../../Attachments/support/attachmentUtils.js";import{getAttachmentUrl as d}from"../attachmentUtils.js";import{isAttributeFormSupportedLayer as p}from"../batchAttributeFormUtils.js";import u from"./EditableInput.js";import g from"./SingleFeatureInputAdapter.js";let y=-1,f=class extends u{constructor(t){super(t),this.attachments=[],this.displayCount=3,this.group=null,this.single=new g({input:this}),this.type="attachment",this._initialAttachments=[],this._stagedAdds=new e,this._stagedDeletes=new r,this._stagedUpdates=new n,this._temporaryAttachmentUrls=new n}get allowUserRename(){return this.template.allowUserRename}get addDisabled(){const t=this.maxAttachmentCount;return null!=t&&this.attachments.length>=t}get accept(){const{categories:t}=this;if(!t.size)return;const e=[];return t.has("image")&&e.push("image/*"),t.has("audio")&&e.push("audio/*"),t.has("video")&&e.push("video/*"),t.has("document")&&e.push("text/*","application/*","model/*"),e.length>0?e.join(","):void 0}get categories(){const{input:t}=this,e=new Set;if(!t)return e;if("attachment"===t.type){const{inputTypes:a}=t;if(!a||0===a.length)return e;for(const t of a)_(e,t.type);return e}return _(e,t.type),e}get attachmentKeyword(){return this.template.attachmentKeyword?.trim()}get displayFilename(){return this.template.displayFilename}get allAttachmentsVisibleOnDefaultPage(){return this.defaultPageAttachments.length===this.attachments.length}get defaultPageAttachments(){return this.attachments.slice(0,this.displayCount)}get feature(){return this.single.feature}get hasAttachmentChanges(){return this._stagedAdds.length>0||this._stagedUpdates.size>0||this._stagedDeletes.size>0}get input(){return this.template.input}get layer(){return this.single.layer}get maxAttachmentCount(){return this.template.maxAttachmentCount}get minAttachmentCount(){return this.template.minAttachmentCount}get supportsResize(){const{layer:t}=this;if(!t)return!1;const e=c(t);return!!e&&("attachment"in e&&!!e.attachment?.supportsResize)}get useOriginalFilename(){return this.template.useOriginalFilename}get valid(){const t=this.attachments.length,e=this.minAttachmentCount??-1/0,a=this.maxAttachmentCount??1/0,s=this.hasAttachmentChanges;return!(t<e||t>a)||!s}get _expressionLayer(){const t=this.layer;if(t)return"scene"===t.type&&"associatedLayer"in t&&null!=t.associatedLayer?t.associatedLayer:"feature"===t.type?t:void 0}destroy(){this._clearTemporaryAttachmentUrls()}applyFetchedAttachments(t){for(const e of t)this._normalizeAttachmentName(e);this._initialAttachments=t,this._recomputeAttachments()}clearAttachmentChanges(){this._clearTemporaryAttachmentUrls(),this._stagedAdds.removeAll(),this._stagedUpdates.clear(),this._stagedDeletes.clear(),this._recomputeAttachments()}stageAddAttachment(t){const{contentType:e,data:a,name:s}=t,n=t.globalId??i(),r=a instanceof Blob?a.size:void 0,o=s.trim(),l=new h({contentType:e??void 0,globalId:n,id:y--,keywords:this.attachmentKeyword??void 0,name:o,size:r});return this._setTemporaryAttachmentUrl(n,a),this._stagedAdds.add({globalId:n,info:l,data:a}),this._recomputeAttachments(),l}async stageAddAttachments(t,e){const a=t.filter(t=>this.isFileAllowed(t));if(0===a.length)return[];const s=[],n=new Map,r=Date.now();for(let i=0;i<a.length;i++){const t=a[i],o=t instanceof File?t.name:`attachment-${r}_${i+1}`,l=await this._computeAttachmentFilename(o,e),c=this._makeUniqueFilenameForOperation(n,l);s.push(this.stageAddAttachment({contentType:t.type,data:t,name:c}))}return s}findAttachment(t){if(t)return this.attachments.find(e=>e.globalId===t)}getAttachmentPreviewUrl(t,e){return(t.globalId?this._temporaryAttachmentUrls.get(t.globalId):void 0)??d(t,this.supportsResize,e)}isFileAllowed(t){if(!t.type)return!0;const{categories:e}=this;return!e.size||e.has(m(t.type))}isStagedAttachmentAddition(t){return"number"==typeof t.id&&t.id<0}stageDeleteAttachment(t){const e=t.globalId;if(!e)return;const a=this._stagedAdds.findIndex(t=>t.globalId===e);if(a>-1)return this._clearTemporaryAttachmentUrl(e),this._stagedAdds.removeAt(a),void this._recomputeAttachments();this._clearTemporaryAttachmentUrl(e),this._stagedUpdates.delete(e),this._stagedDeletes.add(e),this._recomputeAttachments()}stageRenameAttachment(t,e){const a=t.globalId;if(!a)return;const s=this._stagedAdds.find(t=>t.globalId===a);if(s)return s.info.name=e,void this._recomputeAttachments();const n=this._stagedUpdates.get(a);this._stagedUpdates.set(a,{...n,info:t,name:e}),this._recomputeAttachments()}async stageReplaceAttachment(t,e,a){const s=e instanceof File?e.name:t.name,n=await this._computeAttachmentFilename(s,a);this._stageReplaceAttachment(t,e,n)}toSubmitEdits(){const t=[],e=[],s=Array.from(this._stagedDeletes);if(0===this._stagedAdds.length&&0===this._stagedUpdates.size&&0===s.length)return null;const n=this._featureIdentifier;if(!n)return a.getLogger(this).error("Unable to build attachment edits without a valid feature and layer."),null;for(const a of this._stagedAdds)t.push({feature:n,attachment:{globalId:a.globalId,contentType:a.info.contentType,data:a.data,name:a.info.name}});for(const[a,r]of this._stagedUpdates)e.push({feature:n,attachment:{globalId:a,contentType:r.contentType,data:r.data,name:r.name}});return{label:this.template.label,attachmentKeyword:this.attachmentKeyword,add:t,delete:s,update:e}}_recomputeAttachments(){const t=this._stagedDeletes,e=[];for(const a of this._stagedAdds)e.push(a.info);for(const a of this._initialAttachments){const s=a.globalId;if(!s||!t.has(s)){if(s&&this._stagedUpdates.has(s)){const t=this._stagedUpdates.get(s),n=a.clone();null!=t.name&&(n.name=t.name),e.push(n);continue}e.push(a)}}this.attachments=e}get _featureIdentifier(){const t=this.single.feature,e=this.layer;if(!t||!p(e))return null;const a=e.objectIdField,s="globalIdField"in e?e.globalIdField:null,n=t.getGlobalId()??(s?t.getAttribute(s):void 0);if(n)return{globalId:n};const r=t.getObjectId()??t.getAttribute(a),i=Number(r);return null==r||isNaN(i)?null:{objectId:i}}async _computeAttachmentFilename(t,e){const n=this.template.filenameExpressionExecutor;if(!n)return t;const r=this.single.feature,i=r?.plainGraphic,o=this._expressionLayer,l={$originalfeature:r?.original,$editcontext:{editType:e.editType},$layer:o,$featureset:o,$datastore:o?.url,$feature:i,$map:e.map},c={rawOutput:!0,spatialReference:e.spatialReference,timeZone:e.timeZone};try{const t=n.isAsync?await n.executeAsync(l,c):n.execute(l,c);if("string"==typeof t&&t.trim().length>0)return t.trim()}catch(h){s(h)||a.getLogger(this).error("Failed evaluating attachment filename expression",h)}return t}_makeUniqueFilenameForOperation(t,e){const a=e.toLowerCase(),s=t.get(a)??0;if(t.set(a,s+1),0===s)return e;const n=e.lastIndexOf(".");return`${n>0?e.slice(0,n):e}_${s}${n>0?e.slice(n):""}`}_stageReplaceAttachment(t,e,a){const s=t.globalId;if(!s)return;const n=this._stagedAdds.find(t=>t.globalId===s);if(n)return n.data=e,n.info.name=a,n.info.contentType=e.type,n.info.size=e.size,this._setTemporaryAttachmentUrl(s,e),void this._recomputeAttachments();const r=this._stagedUpdates.get(s);this._setTemporaryAttachmentUrl(s,e),this._stagedUpdates.set(s,{...r,info:t,contentType:e.type||r?.contentType,data:e,name:a}),this._recomputeAttachments()}_normalizeAttachmentName(t){const{name:e}=t;"string"==typeof e&&(t.name=e.trim())}_setTemporaryAttachmentUrl(t,e){if(this._clearTemporaryAttachmentUrl(t),!(e instanceof Blob))return;const a=URL.createObjectURL(e);return this._temporaryAttachmentUrls.set(t,a),a}_clearTemporaryAttachmentUrl(t){const e=this._temporaryAttachmentUrls.get(t);e&&(URL.revokeObjectURL(e),this._temporaryAttachmentUrls.delete(t))}_clearTemporaryAttachmentUrls(){for(const t of this._temporaryAttachmentUrls.values())URL.revokeObjectURL(t);this._temporaryAttachmentUrls.clear()}};t([o()],f.prototype,"allowUserRename",null),t([o({readOnly:!0})],f.prototype,"addDisabled",null),t([o({readOnly:!0})],f.prototype,"accept",null),t([o({readOnly:!0})],f.prototype,"categories",null),t([o()],f.prototype,"attachmentKeyword",null),t([o()],f.prototype,"attachments",void 0),t([o()],f.prototype,"displayFilename",null),t([o({readOnly:!0})],f.prototype,"allAttachmentsVisibleOnDefaultPage",null),t([o({readOnly:!0})],f.prototype,"defaultPageAttachments",null),t([o()],f.prototype,"displayCount",void 0),t([o()],f.prototype,"feature",null),t([o()],f.prototype,"group",void 0),t([o({readOnly:!0})],f.prototype,"hasAttachmentChanges",null),t([o()],f.prototype,"input",null),t([o()],f.prototype,"layer",null),t([o()],f.prototype,"maxAttachmentCount",null),t([o()],f.prototype,"minAttachmentCount",null),t([o({readOnly:!0})],f.prototype,"single",void 0),t([o({readOnly:!0})],f.prototype,"type",void 0),t([o({readOnly:!0})],f.prototype,"supportsResize",null),t([o()],f.prototype,"useOriginalFilename",null),t([o({readOnly:!0})],f.prototype,"valid",null),t([o()],f.prototype,"_initialAttachments",void 0),t([o()],f.prototype,"_expressionLayer",null),t([o()],f.prototype,"_stagedAdds",void 0),t([o()],f.prototype,"_stagedDeletes",void 0),t([o()],f.prototype,"_stagedUpdates",void 0),t([o()],f.prototype,"_temporaryAttachmentUrls",void 0),t([o()],f.prototype,"_featureIdentifier",null),f=t([l("esri.widgets.BatchAttributeForm.inputs.AttachmentElementInput")],f);const A=f;function _(t,e){switch(e){case"audio":t.add("audio");break;case"document":t.add("document");break;case"image":case"signature":t.add("image");break;case"video":t.add("video")}}export{A 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{isSome as t}from"../../../core/arrayUtils.js";import{getOrCreateMapValue as i}from"../../../core/MapUtils.js";import{property as l,subclass as r}from"../../../core/accessorSupport/decorators.js";import{isMultipleChoiceInput as o}from"../../../form/elements/inputs/inputUtils.js";import n from"../../../layers/support/CodedValue.js";import s from"../../../layers/support/CodedValueDomain.js";import{getDomainRange as a,dateTimeFieldValuesToNumericRange as u,isDomainValidForField as h}from"../../../layers/support/domainUtils.js";import{isNumericField as p,isStringField as c,isTimeOnlyField as m,getFieldRange as d,isDateOnlyField as f,isTimestampOffsetField as C}from"../../../layers/support/fieldUtils.js";import{supportsFieldConfiguration as g}from"../../../layers/support/layerUtils.js";import y from"../../../layers/support/RangeDomain.js";import{isAnyDateField as b}from"../../../smartMapping/support/utils.js";import{isNumber as x}from"../../../support/guards.js";import v from"./EditableInput.js";import{visibilityCodeToBoolean as V,differentValuesString as O,isFieldInputWithShowNoValueOptionInput as M}from"./support/inputUtils.js";import{otherChoiceCheckedPlaceholderValue as _,multipleChoiceOtherChoiceCheckedStateByExpressionsManager as F}from"./support/multipleChoiceInputUtils.js";import{isEmptyValue as S,getMaxLength as w,getMinLength as E,dateIsValid as k,validateFormValue as D}from"../../support/forms/formUtils.js";let N=class extends v{constructor(e){super(e),this.group=null,this.type="field",this.userHasChangedValue=!1,this._hasIntersectionWithElementFieldDomain=!1}get compositeError(){if(this.valid)return null;const{errors:e}=this;if(e.length<this.features.length)return"batch-attribute-form-validation::features-have-different-errors";const t=e[0];for(const i of e)if(i.error!==t.error)return"batch-attribute-form-validation::features-have-different-errors";return t.error}get dataType(){const{field:e}=this;return p(e)?"number":c(e)?"text":b(e)||m(e)?"date":"unsupported"}get domain(){const e=this._allDomains.toArray();return this.calculateDomain(e)}get distinctValues(){if(this.featuresHaveSameValue)return[this.value];const e=new Set;for(const t of this.features)e.add(t.getAttribute(this.fieldName));return Array.from(e)}get editable(){return!!this.field.editable&&(this._evaluatedEditableExpression??!0)}get label(){const e=this.template;if(null!=e.label&&""!==e.label)return e.label;const{field:t,layers:i}=this;if(1===i.length){const e=i[0];if(g(e)){const i=e.getFieldAlias(t.name);if(null!=i&&""!==i)return i}}return t.alias||t.name}get effectiveVisible(){return V(this.effectiveVisibilityCode)}get effectiveVisibilityCode(){const{visibilityCode:e}=this;if("visible"!==e)return e;const{group:t}=this;if(null==t)return e;const i=t.visibilityCode;return"hidden:visibility-expression:all-features"===i?"hidden:group-visibility-expression:all-features":"hidden:visibility-expression:some-features"===i?"hidden:group-visibility-expression:some-features":e}get errors(){return this._validate()}get featuresHaveSameValue(){const{fieldName:e}=this,t=this.features.at(0)?.getAttribute(e);return this.features.every(i=>i.getAttribute(e)===t)}get field(){return this.template.field}get fieldName(){return this.field.name}get input(){return this.template.input}get multipleChoiceInput(){const{input:e}=this;return e&&o(e)?e:null}get multipleChoiceChoices(){const{multipleChoiceInput:e}=this;if(!e)return null;const t=new Map;for(const i of e.choices)t.has(i.value)||t.set(i.value,i);return Array.from(t.values())}get multipleChoiceValues(){return this.multipleChoiceChoices?.map(e=>e.value)??null}get multipleChoiceOtherChoiceFieldName(){return this.multipleChoiceInput?.otherChoice?.fieldName??null}get multipleChoiceOtherChoiceHint(){return this.multipleChoiceInput?.otherChoice?.hint??""}get multipleChoiceOtherChoiceLabel(){return this.multipleChoiceInput?.otherChoice?.label??null}get hasMultipleChoiceOtherChoiceField(){const{multipleChoiceOtherChoiceFieldName:e}=this;return!!e&&this.layers.every(t=>null!=t.getField(e))}get shouldShowMultipleChoiceOtherChoice(){return null!=this.multipleChoiceInput?.otherChoice&&this.hasMultipleChoiceOtherChoiceField}set shouldShowMultipleChoiceOtherChoice(e){this._overrideIfSome("shouldShowMultipleChoiceOtherChoice",e)}get multipleChoiceOtherChoiceValue(){const{multipleChoiceOtherChoiceFieldName:e}=this;if(!e||!this.shouldShowMultipleChoiceOtherChoice)return null;const t=this.features.map(t=>t.getAttribute(e));if(0===t.length)return null;const[i]=t;return t.every(e=>e===i)?i:O}get multipleChoiceOtherChoiceMaxLength(){const{multipleChoiceOtherChoiceFieldName:e}=this;if(!e||!this.shouldShowMultipleChoiceOtherChoice)return;let t;for(const i of this.layers){const l=i.getField(e)?.length;null==l||l<0||(t=null==t?l:Math.min(t,l))}return t}getMultipleChoiceOtherChoiceRenderState(e){const t=this.multipleChoiceOtherChoiceFieldName??void 0,i=this.shouldShowMultipleChoiceOtherChoice,l=this.multipleChoiceOtherChoiceValue,r=i?this.multipleChoiceOtherChoiceCheckboxState:{checked:!1,indeterminate:!1},o=i?this.getExplicitMultipleChoiceOtherChoiceCheckedState():void 0,n=void 0===o?r:{checked:o,indeterminate:!1};return{fieldName:t,hint:this.multipleChoiceOtherChoiceHint,label:this.multipleChoiceOtherChoiceLabel??e,shouldShow:i,checkboxState:n,value:l,normalizedValue:l===_?"":l,maxLength:this.multipleChoiceOtherChoiceMaxLength}}get multipleChoiceOtherChoiceCheckboxState(){const e=this.multipleChoiceOtherChoiceFieldName;if(!e)return{checked:!1,indeterminate:!1};const t=this.features.map(t=>t.getAttribute(e));return{checked:t.length>0&&t.every(e=>!S(e)),indeterminate:t.some(e=>!S(e))&&t.some(e=>S(e))}}initializeExplicitMultipleChoiceOtherChoiceCheckedState(){this.hasExplicitMultipleChoiceOtherChoiceCheckedState()||this.setExplicitMultipleChoiceOtherChoiceCheckedState(this.multipleChoiceOtherChoiceCheckboxState.checked)}hasExplicitMultipleChoiceOtherChoiceCheckedState(){return void 0!==this.getExplicitMultipleChoiceOtherChoiceCheckedState()}getExplicitMultipleChoiceOtherChoiceCheckedState(){const e=this._multipleChoiceOtherChoiceCheckedStateKey;if(e)return this._multipleChoiceOtherChoiceCheckedStateStore.get(e)}setExplicitMultipleChoiceOtherChoiceCheckedState(e){const t=this._multipleChoiceOtherChoiceCheckedStateKey;t&&this._multipleChoiceOtherChoiceCheckedStateStore.set(t,e)}stashMultipleChoiceOtherChoiceDraftValueForFeatures(e,t){const i=this.multipleChoiceOtherChoiceFieldName;if(i)for(const l of e)l.stashAttribute(i,t)}setMultipleChoiceOtherChoiceDraftValuesFromFeatures(e){const t=this.multipleChoiceOtherChoiceFieldName;if(t)for(const i of e)i.stashAttribute(t,i.getAttribute(t))}getMultipleChoiceOtherChoiceDraftValue(e){const t=this.multipleChoiceOtherChoiceFieldName;if(t)return e.getStashedAttribute(t)}get invalidFeatures(){return this.errors.map(e=>e.feature)}get _multipleChoiceOtherChoiceCheckedStateKey(){return null!=this.multipleChoiceOtherChoiceFieldName?this.template.elementId:null}get _multipleChoiceOtherChoiceCheckedStateStore(){const e=this.expressionsManager;return e?i(F,e,()=>new Map):new Map}get isSubtypeField(){return this.layers.some(e=>{if(e&&"subtypeField"in e){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1})}get showNoValueOptionEnabled(){const{input:e}=this;return!this.required&&(!M(e)||!0===e?.showNoValueOption)}get showNoValueLabel(){const{input:e}=this;return M(e)?e?.noValueOptionLabel:null}get includeTime(){const{template:e,field:t}=this;return"date"===this.dataType&&("time-only"===t.type||"date-only"!==t.type&&("datetime-picker"!==e.input?.type||e.input.includeTime))}get includeTimeOffset(){if("timestamp-offset"!==this.field.type)return!1;const{input:e}=this;return!e||"timestampoffset-picker"===e.type&&e.includeTimeOffset}get maxLength(){return w({dataType:this.dataType,field:this.field,input:this.input})}get minLength(){return E({dataType:this.dataType,field:this.field,input:this.input})}get range(){if("date"===this.dataType)return this._dateRange;const{domain:e,field:t}=this;if(e){const i=a(t,e);return{max:i?.max,min:i?.min}}const i=this._allDomains.toArray().every(e=>!e)?d(t):null;return{max:i?.max===Number.MAX_VALUE?null:i?.max??null,min:i?.min===-Number.MAX_VALUE?null:i?.min??null}}get required(){if(!this.editable)return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const e=this.visible&&!1!==this.group?.visible,t=this._evaluatedRequiredExpression;return!(!e||null==t)&&t}get submittable(){return(!this.required||!this.distinctValues.some(e=>S(e)))&&!!this.valid}get valid(){return 0===this.errors.length}get value(){return this.featuresHaveSameValue?this.features.at(0)?.getAttribute(this.fieldName)??null:O}get visibilityCode(){return this.field.visible?this._fieldShouldHaveDomain&&null==this.domain?"hidden:no-domain-in-common":this._baseVisibilityCode:"hidden:field-definition"}get codedValueDomainOptions(){return"coded-value"===this.domain?.type?this.domain.codedValues.map(({name:e,code:t})=>({name:e,value:t})):[]}get codedValueOptions(){const e=this.codedValueDomainOptions,{value:t}=this,i=null==t||t===O||e.some(e=>e.value===t)?[]:[{name:`${t}`,value:t}];return[e,i]}get _evaluatedRequiredExpression(){let e=!1,t=!0;const i=this.template;for(const l of this.features){if(null==i.getExpressionExecutorsForLayer(l.layer)?.requiredExpression)continue;t=!1;const r=this._lookupEvaluatedExpression(l,"required");"success"===r?.status?e=e||!0===r.result:e=!0}return t?null:e}get _allDomains(){const e=this.template.domain;return this.features.map(t=>{const i=t.layer.getFieldDomain(this.fieldName,{feature:t.plainGraphic});return"range"===i?.type||"range"===e?.type?i??this.template.domain:i})}get _fieldShouldHaveDomain(){return!!this._hasIntersectionWithElementFieldDomain||this._allDomains.some(t)}get _dateFormRange(){if("date"!==this.dataType)return{};const{input:e}=this;if(!e)return{};const{type:t}=e;let i={};if("date-picker"!==t&&"time-picker"!==t&&"timestampoffset-picker"!==t||(i=u(this.field,e.max,e.min)),"datetime-picker"===t){const{max:t,min:l}=e;i={max:null!=t&&k(t)?t.getTime():null,min:null!=l&&k(l)?l.getTime():null}}return{min:i.min,max:i.max,rawMax:i?.rawMax??null,rawMin:i?.rawMin??null}}get _dateRange(){const{_dateFormRange:e,template:t,field:i,domain:l}=this;if("date"!==this.dataType)return{};if(!l)return this._fieldShouldHaveDomain?{}:e;const r=a(i,l);if(!r)return e;const{max:o,min:n,rawMax:s,rawMin:u}=e,{type:h}=t.field;if("date"===h){const{max:e,min:t}=r;return{max:x(o)&&(null===e||null!=e&&o<=e)?o:e??null,min:x(n)&&(null===t||null!=t&&n>=t)?n:t??null}}if("date-only"===h||"time-only"===h||"timestamp-offset"===h){const{max:e,min:t,rawMax:i,rawMin:l}=r,a=x(o)&&s&&(null==e||o<e),h=x(n)&&u&&(null==t||n>t);return{max:a?o:e,min:h?n:t,rawMax:a?s:i,rawMin:h?u:l}}return{}}async setValueFromUser(e){this.userHasChangedValue=!0;const t=[],i=this.fieldName;for(const l of this.features)l.getAttribute(i)!==e&&t.push(l);this._setValue(e),await this.expressionsManager.valueChanged(i,t)}_setValue(e){const{fieldName:t}=this;for(const i of this.features)i.setAttribute(t,e)}_validate(){const{dataType:e,fieldName:t,maxLength:i,minLength:l,range:r}=this,o=[],{multipleChoiceInput:n}=this;for(const s of this.features){const{layer:a}=s,u=a.getField(t)??this.field,h=a.getFieldDomain(t,{feature:s.plainGraphic}),p=this.calculateDomain([h]),c=this._requiredForFeature(s),m=s.getAttribute(t),d=D(m,{dataType:e,domain:p,field:u,maxLength:i,minLength:l,multipleChoice:n,range:r,required:c});d&&o.push({error:d,feature:s.source})}return o}_editableForFeature(e){if(!this.field.editable)return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.editableExpression)return!0;const t=this._lookupEvaluatedExpression(e,"editable");return"success"===t?.status&&!0===t.result}_effectiveVisibleFeature(e){if(this.group&&!this.group.visibleForFeature(e))return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.visibilityExpression)return!0;const t=this._lookupEvaluatedExpression(e,"visibility");return"success"===t?.status&&!0===t.result}_requiredForFeature(e){if(!this._editableForFeature(e))return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const t=this._effectiveVisibleFeature(e);if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.requiredExpression)return!1;const i=this._lookupEvaluatedExpression(e,"required");return"success"!==i?.status?t:t&&!0===i.result}calculateDomain(e){const t=e.find(e=>null!=e),i=this.template.domain;if(!t)return i&&h(this.field,i)?i:null;switch(t.type){case"coded-value":if(e.some(e=>!e)){if(!i)return null;e=e.filter(e=>null!==e)}break;case"range":e=e.filter(e=>null!==e)}if(!e.every(e=>e?.type===t?.type))return null;let l=null;switch(t?.type){case"range":l=this._intersectRangeDomains(e);break;case"coded-value":l=this._intersectCodedValueDomains(e)}return l}_intersectCodedValueDomains(e){if(!e.length)return null;const t=new Map(e[0].codedValues.map(({code:e,name:t})=>[e,t])),i=this.template.domain?new Map(this.template.domain.codedValues.map(({code:e,name:t})=>[e,t])):null;for(const o of e)for(const[e,i]of t){o.codedValues.some(t=>t.code===e&&t.name===i)||t.delete(e)}let l=t;if(i){l=new Map;for(const[e,r]of i)t.has(e)&&l.set(e,r)}const r=Array.from(l.entries()).map(([e,t])=>new n({code:e,name:t}));return r.length?new s({codedValues:r}):null}_intersectRangeDomains(e){if(!e.length)return null;let t=e[0];for(let l=1;l<e.length;l++){if(!t)return null;t=this._findMinMaxValuesBetweenTwoDomains(t,e[l])}if(t&&!h(this.field,t))return null;const{domain:i}=this.template;if(t&&i&&i instanceof y){const e=this._findMinMaxValuesBetweenTwoDomains(t,i);return this._hasIntersectionWithElementFieldDomain=!!e,e}return t}_getMinMaxFromRangeDomain(e){const t=e.minValue,i=e.maxValue,{field:l}=this;return f(l)||m(l)||C(l)?u(l,i,t):{min:null!=t&&"number"==typeof t?t:null,max:null!=i&&"number"==typeof i?i:null}}_findMinMaxValuesBetweenTwoDomains(e,t){const i=new y,l=this._getMinMaxFromRangeDomain(e),r=this._getMinMaxFromRangeDomain(t),{field:o}=this,n=this._getValidRangeValue(l.min,-1/0),s=this._getValidRangeValue(l.max,1/0),a=this._getValidRangeValue(r.min,-1/0),u=this._getValidRangeValue(r.max,1/0);return i.minValue=Math.max(n,a),i.maxValue=Math.min(s,u),i.minValue===-1/0||i.maxValue===1/0||i.minValue>i.maxValue?null:((f(o)||m(o)||C(o))&&(i.minValue=Number(l.min)>Number(r.min)?l.rawMin:r.rawMin,i.maxValue=Number(l.max)<Number(r.max)?l.rawMax:r.rawMax),i.name="intersection",i)}_getValidRangeValue(e,t){return x(e)?e:t}};e([l()],N.prototype,"dataType",null),e([l()],N.prototype,"domain",null),e([l()],N.prototype,"distinctValues",null),e([l()],N.prototype,"editable",null),e([l()],N.prototype,"label",null),e([l()],N.prototype,"effectiveVisible",null),e([l()],N.prototype,"effectiveVisibilityCode",null),e([l()],N.prototype,"errors",null),e([l()],N.prototype,"featuresHaveSameValue",null),e([l()],N.prototype,"field",null),e([l()],N.prototype,"fieldName",null),e([l()],N.prototype,"group",void 0),e([l()],N.prototype,"input",null),e([l()],N.prototype,"multipleChoiceInput",null),e([l()],N.prototype,"multipleChoiceChoices",null),e([l()],N.prototype,"multipleChoiceValues",null),e([l()],N.prototype,"multipleChoiceOtherChoiceFieldName",null),e([l()],N.prototype,"multipleChoiceOtherChoiceHint",null),e([l()],N.prototype,"multipleChoiceOtherChoiceLabel",null),e([l()],N.prototype,"hasMultipleChoiceOtherChoiceField",null),e([l()],N.prototype,"shouldShowMultipleChoiceOtherChoice",null),e([l()],N.prototype,"multipleChoiceOtherChoiceValue",null),e([l()],N.prototype,"multipleChoiceOtherChoiceMaxLength",null),e([l()],N.prototype,"multipleChoiceOtherChoiceCheckboxState",null),e([l()],N.prototype,"invalidFeatures",null),e([l()],N.prototype,"_multipleChoiceOtherChoiceCheckedStateStore",null),e([l()],N.prototype,"isSubtypeField",null),e([l()],N.prototype,"showNoValueOptionEnabled",null),e([l()],N.prototype,"showNoValueLabel",null),e([l()],N.prototype,"includeTime",null),e([l()],N.prototype,"includeTimeOffset",null),e([l()],N.prototype,"maxLength",null),e([l()],N.prototype,"minLength",null),e([l()],N.prototype,"range",null),e([l()],N.prototype,"required",null),e([l()],N.prototype,"submittable",null),e([l({readOnly:!0})],N.prototype,"type",void 0),e([l()],N.prototype,"userHasChangedValue",void 0),e([l()],N.prototype,"valid",null),e([l()],N.prototype,"value",null),e([l()],N.prototype,"visibilityCode",null),e([l()],N.prototype,"_evaluatedRequiredExpression",null),e([l()],N.prototype,"_hasIntersectionWithElementFieldDomain",void 0),e([l()],N.prototype,"_allDomains",null),e([l()],N.prototype,"_fieldShouldHaveDomain",null),e([l()],N.prototype,"_dateFormRange",null),e([l()],N.prototype,"_dateRange",null),N=e([r("esri.widgets.BatchAttributeForm.inputs.FieldInput")],N);const A=N;export{A as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../../../core/arrayUtils.js";import{getOrCreateMapValue as i}from"../../../core/MapUtils.js";import{property as l,subclass as r}from"../../../core/accessorSupport/decorators.js";import{isMultipleChoiceInput as o}from"../../../form/elements/inputs/inputUtils.js";import n from"../../../layers/support/CodedValue.js";import s from"../../../layers/support/CodedValueDomain.js";import{getDomainRange as a,dateTimeFieldValuesToNumericRange as u,isDomainValidForField as h}from"../../../layers/support/domainUtils.js";import{isNumericField as p,isStringField as c,isTimeOnlyField as m,getFieldRange as d,isDateOnlyField as f,isTimestampOffsetField as C}from"../../../layers/support/fieldUtils.js";import{supportsFieldConfiguration as g}from"../../../layers/support/layerUtils.js";import y from"../../../layers/support/RangeDomain.js";import{isAnyDateField as b}from"../../../smartMapping/support/utils.js";import{isNumber as x}from"../../../support/guards.js";import v from"./EditableInput.js";import{visibilityCodeToBoolean as V,differentValuesString as O,isFieldInputWithShowNoValueOptionInput as F}from"./support/inputUtils.js";import{otherChoiceCheckedPlaceholderValue as M,multipleChoiceOtherChoiceCheckedStateByExpressionsManager as _}from"./support/multipleChoiceInputUtils.js";import{isEmptyValue as S,getMaxLength as w,getMinLength as E,dateIsValid as k,validateFormValue as D}from"../../support/forms/formUtils.js";let N=class extends v{constructor(e){super(e),this.getFieldValueOptionsForFeature=null,this.group=null,this.type="field",this.userHasChangedValue=!1,this._hasIntersectionWithElementFieldDomain=!1}get compositeError(){if(this.valid)return null;const{errors:e}=this;if(e.length<this.features.length)return"batch-attribute-form-validation::features-have-different-errors";const t=e[0];for(const i of e)if(i.error!==t.error)return"batch-attribute-form-validation::features-have-different-errors";return t.error}get dataType(){const{field:e}=this;return p(e)?"number":c(e)?"text":b(e)||m(e)?"date":"unsupported"}get domain(){const e=this._allDomains.toArray();return this.calculateDomain(e)}get distinctValues(){if(this.featuresHaveSameValue)return[this.value];const e=new Set;for(const t of this.features)e.add(t.getAttribute(this.fieldName));return Array.from(e)}get editable(){return!!this.field.editable&&(this._evaluatedEditableExpression??!0)}get label(){const e=this.template;if(null!=e.label&&""!==e.label)return e.label;const{field:t,layers:i}=this;if(1===i.length){const e=i[0];if(g(e)){const i=e.getFieldAlias(t.name);if(null!=i&&""!==i)return i}}return t.alias||t.name}get effectiveVisible(){return V(this.effectiveVisibilityCode)}get effectiveVisibilityCode(){const{visibilityCode:e}=this;if("visible"!==e)return e;const{group:t}=this;if(null==t)return e;const i=t.visibilityCode;return"hidden:visibility-expression:all-features"===i?"hidden:group-visibility-expression:all-features":"hidden:visibility-expression:some-features"===i?"hidden:group-visibility-expression:some-features":e}get errors(){return this._validate()}get featuresHaveSameValue(){const{fieldName:e}=this,t=this.features.at(0)?.getAttribute(e);return this.features.every(i=>i.getAttribute(e)===t)}get field(){return this.template.field}get fieldName(){return this.field.name}get input(){return this.template.input}get multipleChoiceInput(){const{input:e}=this;return e&&o(e)?e:null}get multipleChoiceChoices(){const{multipleChoiceInput:e}=this;if(!e)return null;const t=new Map;for(const i of e.choices)t.has(i.value)||t.set(i.value,i);return Array.from(t.values())}get multipleChoiceValues(){return this.multipleChoiceChoices?.map(e=>e.value)??null}get multipleChoiceOtherChoiceFieldName(){return this.multipleChoiceInput?.otherChoice?.fieldName??null}get multipleChoiceOtherChoiceHint(){return this.multipleChoiceInput?.otherChoice?.hint??""}get multipleChoiceOtherChoiceLabel(){return this.multipleChoiceInput?.otherChoice?.label??null}get hasMultipleChoiceOtherChoiceField(){const{multipleChoiceOtherChoiceFieldName:e}=this;return!!e&&this.layers.every(t=>null!=t.getField(e))}get shouldShowMultipleChoiceOtherChoice(){return null!=this.multipleChoiceInput?.otherChoice&&this.hasMultipleChoiceOtherChoiceField}set shouldShowMultipleChoiceOtherChoice(e){this._overrideIfSome("shouldShowMultipleChoiceOtherChoice",e)}get multipleChoiceOtherChoiceValue(){const{multipleChoiceOtherChoiceFieldName:e}=this;if(!e||!this.shouldShowMultipleChoiceOtherChoice)return null;const t=this.features.map(t=>t.getAttribute(e));if(0===t.length)return null;const[i]=t;return t.every(e=>e===i)?i:O}get multipleChoiceOtherChoiceMaxLength(){const{multipleChoiceOtherChoiceFieldName:e}=this;if(!e||!this.shouldShowMultipleChoiceOtherChoice)return;let t;for(const i of this.layers){const l=i.getField(e)?.length;null==l||l<0||(t=null==t?l:Math.min(t,l))}return t}getMultipleChoiceOtherChoiceRenderState(e){const t=this.multipleChoiceOtherChoiceFieldName??void 0,i=this.shouldShowMultipleChoiceOtherChoice,l=this.multipleChoiceOtherChoiceValue,r=i?this.multipleChoiceOtherChoiceCheckboxState:{checked:!1,indeterminate:!1},o=i?this.getExplicitMultipleChoiceOtherChoiceCheckedState():void 0,n=void 0===o?r:{checked:o,indeterminate:!1};return{fieldName:t,hint:this.multipleChoiceOtherChoiceHint,label:this.multipleChoiceOtherChoiceLabel??e,shouldShow:i,checkboxState:n,value:l,normalizedValue:l===M?"":l,maxLength:this.multipleChoiceOtherChoiceMaxLength}}get multipleChoiceOtherChoiceCheckboxState(){const e=this.multipleChoiceOtherChoiceFieldName;if(!e)return{checked:!1,indeterminate:!1};const t=this.features.map(t=>t.getAttribute(e));return{checked:t.length>0&&t.every(e=>!S(e)),indeterminate:t.some(e=>!S(e))&&t.some(e=>S(e))}}initializeExplicitMultipleChoiceOtherChoiceCheckedState(){this.hasExplicitMultipleChoiceOtherChoiceCheckedState()||this.setExplicitMultipleChoiceOtherChoiceCheckedState(this.multipleChoiceOtherChoiceCheckboxState.checked)}hasExplicitMultipleChoiceOtherChoiceCheckedState(){return void 0!==this.getExplicitMultipleChoiceOtherChoiceCheckedState()}getExplicitMultipleChoiceOtherChoiceCheckedState(){const e=this._multipleChoiceOtherChoiceCheckedStateKey;if(e)return this._multipleChoiceOtherChoiceCheckedStateStore.get(e)}setExplicitMultipleChoiceOtherChoiceCheckedState(e){const t=this._multipleChoiceOtherChoiceCheckedStateKey;t&&this._multipleChoiceOtherChoiceCheckedStateStore.set(t,e)}stashMultipleChoiceOtherChoiceDraftValueForFeatures(e,t){const i=this.multipleChoiceOtherChoiceFieldName;if(i)for(const l of e)l.stashAttribute(i,t)}setMultipleChoiceOtherChoiceDraftValuesFromFeatures(e){const t=this.multipleChoiceOtherChoiceFieldName;if(t)for(const i of e)i.stashAttribute(t,i.getAttribute(t))}getMultipleChoiceOtherChoiceDraftValue(e){const t=this.multipleChoiceOtherChoiceFieldName;if(t)return e.getStashedAttribute(t)}get invalidFeatures(){return this.errors.map(e=>e.feature)}get _multipleChoiceOtherChoiceCheckedStateKey(){return null!=this.multipleChoiceOtherChoiceFieldName?this.template.elementId:null}get _multipleChoiceOtherChoiceCheckedStateStore(){const e=this.expressionsManager;return e?i(_,e,()=>new Map):new Map}get isSubtypeField(){return this.layers.some(e=>{if(e&&"subtypeField"in e){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.fieldName}return!1})}get showNoValueOptionEnabled(){const{input:e}=this;return!this.required&&(!F(e)||!0===e?.showNoValueOption)}get showNoValueLabel(){const{input:e}=this;return F(e)?e?.noValueOptionLabel:null}get includeTime(){const{template:e,field:t}=this;return"date"===this.dataType&&("time-only"===t.type||"date-only"!==t.type&&("datetime-picker"!==e.input?.type||e.input.includeTime))}get includeTimeOffset(){if("timestamp-offset"!==this.field.type)return!1;const{input:e}=this;return!e||"timestampoffset-picker"===e.type&&e.includeTimeOffset}get maxLength(){return w({dataType:this.dataType,field:this.field,input:this.input})}get minLength(){return E({dataType:this.dataType,field:this.field,input:this.input})}get range(){if("date"===this.dataType)return this._dateRange;const{domain:e,field:t}=this;if(e){const i=a(t,e);return{max:i?.max,min:i?.min}}const i=this._allDomains.toArray().every(e=>!e)?d(t):null;return{max:i?.max===Number.MAX_VALUE?null:i?.max??null,min:i?.min===-Number.MAX_VALUE?null:i?.min??null}}get required(){if(!this.editable)return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const e=this.visible&&!1!==this.group?.visible,t=this._evaluatedRequiredExpression;return!(!e||null==t)&&t}get submittable(){return(!this.required||!this.distinctValues.some(e=>S(e)))&&!!this.valid}get valid(){return 0===this.errors.length}get value(){return this.featuresHaveSameValue?this.features.at(0)?.getAttribute(this.fieldName)??null:O}get visibilityCode(){return this.field.visible?this._fieldShouldHaveDomain&&null==this.domain?"hidden:no-domain-in-common":this._baseVisibilityCode:"hidden:field-definition"}get codedValueDomainOptions(){return"coded-value"===this.domain?.type?this.domain.codedValues.map(({name:e,code:t})=>({name:e,value:t})):[]}get codedValueOptions(){const{getFieldValueOptionsForFeature:e}=this;if(1===this.features.length&&e){const t=this.features.at(0);return e({domain:this.domain??void 0,feature:t,fieldName:this.fieldName,layer:t.layer})}const t=this.codedValueDomainOptions,{value:i}=this,l=null==i||i===O||t.some(e=>e.value===i)?[]:[{name:`${i}`,value:i}];return{recommended:t,other:[],unsupported:l,containsEmptyOption:!1}}get _evaluatedRequiredExpression(){let e=!1,t=!0;const i=this.template;for(const l of this.features){if(null==i.getExpressionExecutorsForLayer(l.layer)?.requiredExpression)continue;t=!1;const r=this._lookupEvaluatedExpression(l,"required");"success"===r?.status?e=e||!0===r.result:e=!0}return t?null:e}get _allDomains(){const e=this.template.domain;return this.features.map(t=>{const i=t.layer.getFieldDomain(this.fieldName,{feature:t.plainGraphic});return"range"===i?.type||"range"===e?.type?i??this.template.domain:i})}get _fieldShouldHaveDomain(){return!!this._hasIntersectionWithElementFieldDomain||this._allDomains.some(t)}get _dateFormRange(){if("date"!==this.dataType)return{};const{input:e}=this;if(!e)return{};const{type:t}=e;let i={};if("date-picker"!==t&&"time-picker"!==t&&"timestampoffset-picker"!==t||(i=u(this.field,e.max,e.min)),"datetime-picker"===t){const{max:t,min:l}=e;i={max:null!=t&&k(t)?t.getTime():null,min:null!=l&&k(l)?l.getTime():null}}return{min:i.min,max:i.max,rawMax:i?.rawMax??null,rawMin:i?.rawMin??null}}get _dateRange(){const{_dateFormRange:e,template:t,field:i,domain:l}=this;if("date"!==this.dataType)return{};if(!l)return this._fieldShouldHaveDomain?{}:e;const r=a(i,l);if(!r)return e;const{max:o,min:n,rawMax:s,rawMin:u}=e,{type:h}=t.field;if("date"===h){const{max:e,min:t}=r;return{max:x(o)&&(null===e||null!=e&&o<=e)?o:e??null,min:x(n)&&(null===t||null!=t&&n>=t)?n:t??null}}if("date-only"===h||"time-only"===h||"timestamp-offset"===h){const{max:e,min:t,rawMax:i,rawMin:l}=r,a=x(o)&&s&&(null==e||o<e),h=x(n)&&u&&(null==t||n>t);return{max:a?o:e,min:h?n:t,rawMax:a?s:i,rawMin:h?u:l}}return{}}async setValueFromUser(e){this.userHasChangedValue=!0;const t=[],i=this.fieldName;for(const l of this.features)l.getAttribute(i)!==e&&t.push(l);this._setValue(e),await this.expressionsManager.valueChanged(i,t)}_setValue(e){const{fieldName:t}=this;for(const i of this.features)i.setAttribute(t,e)}_validate(){const{dataType:e,fieldName:t,maxLength:i,minLength:l,range:r}=this,o=[],{multipleChoiceInput:n}=this;for(const s of this.features){const{layer:a}=s,u=a.getField(t)??this.field,h=a.getFieldDomain(t,{feature:s.plainGraphic}),p=this.calculateDomain([h]),c=this._requiredForFeature(s),m=s.getAttribute(t),d=D(m,{dataType:e,domain:p,field:u,maxLength:i,minLength:l,multipleChoice:n,range:r,required:c});d&&o.push({error:d,feature:s.source})}return o}_editableForFeature(e){if(!this.field.editable)return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.editableExpression)return!0;const t=this._lookupEvaluatedExpression(e,"editable");return"success"===t?.status&&!0===t.result}_effectiveVisibleFeature(e){if(this.group&&!this.group.visibleForFeature(e))return!1;if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.visibilityExpression)return!0;const t=this._lookupEvaluatedExpression(e,"visibility");return"success"===t?.status&&!0===t.result}_requiredForFeature(e){if(!this._editableForFeature(e))return!1;if(!this.field.nullable||this.isSubtypeField)return!0;const t=this._effectiveVisibleFeature(e);if(null==this.template.getExpressionExecutorsForLayer(e.layer)?.requiredExpression)return!1;const i=this._lookupEvaluatedExpression(e,"required");return"success"!==i?.status?t:t&&!0===i.result}calculateDomain(e){const t=e.find(e=>null!=e),i=this.template.domain;if(!t)return i&&h(this.field,i)?i:null;switch(t.type){case"coded-value":if(e.some(e=>!e)){if(!i)return null;e=e.filter(e=>null!==e)}break;case"range":e=e.filter(e=>null!==e)}if(!e.every(e=>e?.type===t?.type))return null;let l=null;switch(t?.type){case"range":l=this._intersectRangeDomains(e);break;case"coded-value":l=this._intersectCodedValueDomains(e)}return l}_intersectCodedValueDomains(e){if(!e.length)return null;const t=new Map(e[0].codedValues.map(({code:e,name:t})=>[e,t])),i=this.template.domain?new Map(this.template.domain.codedValues.map(({code:e,name:t})=>[e,t])):null;for(const o of e)for(const[e,i]of t){o.codedValues.some(t=>t.code===e&&t.name===i)||t.delete(e)}let l=t;if(i){l=new Map;for(const[e,r]of i)t.has(e)&&l.set(e,r)}const r=Array.from(l.entries()).map(([e,t])=>new n({code:e,name:t}));return r.length?new s({codedValues:r}):null}_intersectRangeDomains(e){if(!e.length)return null;let t=e[0];for(let l=1;l<e.length;l++){if(!t)return null;t=this._findMinMaxValuesBetweenTwoDomains(t,e[l])}if(t&&!h(this.field,t))return null;const{domain:i}=this.template;if(t&&i&&i instanceof y){const e=this._findMinMaxValuesBetweenTwoDomains(t,i);return this._hasIntersectionWithElementFieldDomain=!!e,e}return t}_getMinMaxFromRangeDomain(e){const t=e.minValue,i=e.maxValue,{field:l}=this;return f(l)||m(l)||C(l)?u(l,i,t):{min:null!=t&&"number"==typeof t?t:null,max:null!=i&&"number"==typeof i?i:null}}_findMinMaxValuesBetweenTwoDomains(e,t){const i=new y,l=this._getMinMaxFromRangeDomain(e),r=this._getMinMaxFromRangeDomain(t),{field:o}=this,n=this._getValidRangeValue(l.min,-1/0),s=this._getValidRangeValue(l.max,1/0),a=this._getValidRangeValue(r.min,-1/0),u=this._getValidRangeValue(r.max,1/0);return i.minValue=Math.max(n,a),i.maxValue=Math.min(s,u),i.minValue===-1/0||i.maxValue===1/0||i.minValue>i.maxValue?null:((f(o)||m(o)||C(o))&&(i.minValue=Number(l.min)>Number(r.min)?l.rawMin:r.rawMin,i.maxValue=Number(l.max)<Number(r.max)?l.rawMax:r.rawMax),i.name="intersection",i)}_getValidRangeValue(e,t){return x(e)?e:t}};e([l()],N.prototype,"dataType",null),e([l()],N.prototype,"domain",null),e([l()],N.prototype,"distinctValues",null),e([l()],N.prototype,"editable",null),e([l()],N.prototype,"label",null),e([l()],N.prototype,"effectiveVisible",null),e([l()],N.prototype,"effectiveVisibilityCode",null),e([l()],N.prototype,"errors",null),e([l()],N.prototype,"featuresHaveSameValue",null),e([l()],N.prototype,"field",null),e([l()],N.prototype,"fieldName",null),e([l()],N.prototype,"getFieldValueOptionsForFeature",void 0),e([l()],N.prototype,"group",void 0),e([l()],N.prototype,"input",null),e([l()],N.prototype,"multipleChoiceInput",null),e([l()],N.prototype,"multipleChoiceChoices",null),e([l()],N.prototype,"multipleChoiceValues",null),e([l()],N.prototype,"multipleChoiceOtherChoiceFieldName",null),e([l()],N.prototype,"multipleChoiceOtherChoiceHint",null),e([l()],N.prototype,"multipleChoiceOtherChoiceLabel",null),e([l()],N.prototype,"hasMultipleChoiceOtherChoiceField",null),e([l()],N.prototype,"shouldShowMultipleChoiceOtherChoice",null),e([l()],N.prototype,"multipleChoiceOtherChoiceValue",null),e([l()],N.prototype,"multipleChoiceOtherChoiceMaxLength",null),e([l()],N.prototype,"multipleChoiceOtherChoiceCheckboxState",null),e([l()],N.prototype,"invalidFeatures",null),e([l()],N.prototype,"_multipleChoiceOtherChoiceCheckedStateStore",null),e([l()],N.prototype,"isSubtypeField",null),e([l()],N.prototype,"showNoValueOptionEnabled",null),e([l()],N.prototype,"showNoValueLabel",null),e([l()],N.prototype,"includeTime",null),e([l()],N.prototype,"includeTimeOffset",null),e([l()],N.prototype,"maxLength",null),e([l()],N.prototype,"minLength",null),e([l()],N.prototype,"range",null),e([l()],N.prototype,"required",null),e([l()],N.prototype,"submittable",null),e([l({readOnly:!0})],N.prototype,"type",void 0),e([l()],N.prototype,"userHasChangedValue",void 0),e([l()],N.prototype,"valid",null),e([l()],N.prototype,"value",null),e([l()],N.prototype,"visibilityCode",null),e([l()],N.prototype,"codedValueDomainOptions",null),e([l()],N.prototype,"codedValueOptions",null),e([l()],N.prototype,"_evaluatedRequiredExpression",null),e([l()],N.prototype,"_hasIntersectionWithElementFieldDomain",void 0),e([l()],N.prototype,"_allDomains",null),e([l()],N.prototype,"_fieldShouldHaveDomain",null),e([l()],N.prototype,"_dateFormRange",null),e([l()],N.prototype,"_dateRange",null),N=e([r("esri.widgets.BatchAttributeForm.inputs.FieldInput")],N);const A=N;export{A as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Error.js";import t from"../AttachmentElementInput.js";import
|
|
2
|
+
import e from"../../../../core/Error.js";import t from"../AttachmentElementInput.js";import r from"../BatchFormInputs.js";import s from"../FieldInput.js";import n from"../GroupInput.js";import o from"../RelationshipElementInput.js";import a from"../TextElementInput.js";import i from"../UtilityNetworkAssociationsElementInput.js";import{isFieldElementTemplate as l,isGroupElementTemplate as p,isRelationshipElementTemplate as m,isTextElementTemplate as u,isAttachmentElementTemplate as f,isUtilityNetworkAssociationsElementTemplate as c}from"../../templates/support/templateUtils.js";function h(e,t){const s=new r({inputs:e.elements.map(e=>I(e,t)),template:e});return x(s),s}function x(e){const t=e.allFieldInputs,r=new Set(t.map(e=>e.fieldName));for(const s of t){const e=s.multipleChoiceOtherChoiceFieldName;if(!e)continue;const t=s.layers[0]?.getField(e)?.name??e;r.has(t)&&(s.shouldShowMultipleChoiceOtherChoice=!1)}}function I(r,h){const{allFeatures:x,expressionsManager:w,getFieldValueOptionsForFeature:d,map:g}=h,F=new Set(r.layers),y=x.filter(e=>F.has(e.layer)),j=y.length===x.length;if(l(r))return new s({existsInAllLayers:j,features:y,template:r,expressionsManager:w,getFieldValueOptionsForFeature:d});if(p(r)){const e=r.elements.map(e=>I(e,h));return new n({existsInAllLayers:j,features:y,inputs:e,template:r,expressionsManager:w})}if(m(r))return new o({existsInAllLayers:j,features:y,template:r,expressionsManager:w});if(u(r))return new a({existsInAllLayers:j,features:y,template:r,expressionsManager:w});if(f(r))return new t({existsInAllLayers:j,features:y,template:r,expressionsManager:w});if(c(r))return new i({existsInAllLayers:j,features:y,template:r,expressionsManager:w,map:g});throw new e("batch-attribute-form:unsupported-element-template","The type of form element template provided is not supported")}export{h as createBatchFormInputsFromBatchFormTemplate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{getEffectiveFieldAlias as o}from"../../../../editing/fieldUtils.js";import i from"../../../../form/ExpressionInfo.js";import{isMultipleChoiceInput as s}from"../../../../form/elements/inputs/inputUtils.js";import{isAttachmentElement as a,isFieldElement as l,isGroupElement as m,isRelationshipElement as d,isTextElement as p,isUtilityNetworkAssociationsElement as c}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as f,isFieldVisibleByDefault as u}from"../../../../layers/support/fieldUtils.js";import{isSubtypeSublayer as x,isSubtypeGroupLayer as y}from"../../../../layers/support/layerUtils.js";import{isNumber as w}from"../../../../support/guards.js";import{unknown as h}from"../../../../time/constants.js";import{makeExpressionInfosMap as E,makeExecutorSetForFormElement as b}from"../../expressions/expressionUtils.js";import{AttachmentElementTemplate as T}from"../AttachmentElementTemplate.js";import I from"../BatchFormTemplate.js";import{FieldElementTemplate as v}from"../FieldElementTemplate.js";import{GroupElementTemplate as g}from"../GroupElementTemplate.js";import{RelationshipElementTemplate as j}from"../RelationshipElementTemplate.js";import{TextElementTemplate as F}from"../TextElementTemplate.js";import{UtilityNetworkAssociationsElementTemplate as C}from"../UtilityNetworkAssociationsElementTemplate.js";import{compileTextElementMarkdownToHTML as P}from"./textElementTemplateUtils.js";const L="expression/dea57012-47ca4b55a000-8df62742ed0c",A=e("form-attachment-filename-calculation"),U=()=>n.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function Z(e,t,r=e.formTemplate){return r?.elements&&r.elements.length>0?B(r,e,t):N(e,t)}async function N(e,{arcadeExecutorProvider:t,formTimeZone:r}){const n=new Set(f(e)),o={arcadeExecutorProvider:t,formTimeZone:r,layer:e},i=[];for(const a of e.fields)G(a,e,n)&&i.push(O(a,o));const s=await Promise.all(i);return new I({elements:s,preserveFieldValuesWhenHidden:!0})}function k(e,t){for(const r of e??[])if("group"!==r.type){if("field"===r.type){if(!1===r.editable&&!r.editableExpression)return!0;if(t.subtypeField&&(x(t)||y(t))&&r.fieldName?.toLowerCase()===t.subtypeField.toLowerCase())return!0}}else if(k(r.elements??[],t))return!0;return!1}async function B(e,t,r){let n=null;k(e.elements??[],t)&&(n=new i({title:"",name:L,expression:"false"}));const o=E(n?[...e.expressionInfos??[],n]:e.expressionInfos),s={description:e.description,elements:new Array,title:e.title,preserveFieldValuesWhenHidden:e.preserveFieldValuesWhenHidden,supportsAttachmentElements:e.supportsAttachmentElements},{elements:a}=e;if(!a)return new I(s);const{arcadeExecutorProvider:l,formTimeZone:m}=r;for(const i of a){const e=await R(i,{arcadeExecutorProvider:l,expressionInfos:o,layer:t,formTimeZone:m});e&&s.elements.push(e)}return e.supportsAttachmentElements,new I(s)}async function H(e,{arcadeExecutorProvider:r,expressionInfos:n,layer:o}){const i=n.get(e.filenameExpression),s=i?await t(i.expression,A):null,a=new T({allowUserRename:e.allowUserRename,attachmentKeyword:e.attachmentKeyword,description:e.description,displayFilename:e.displayFilename,filenameExpressionExecutor:s,input:e.input,label:e.label,maxAttachmentCount:e.maxAttachmentCount,minAttachmentCount:e.minAttachmentCount,useOriginalFilename:e.useOriginalFilename}),l=await b({element:e,expressionInfos:n,provider:r});return a.addLayer(o,l),a}async function R(e,t){return a(e)?H(e,{arcadeExecutorProvider:t.arcadeExecutorProvider,expressionInfos:t.expressionInfos,layer:t.layer}):l(e)?S(e,t):m(e)?V(e,t):d(e)?W(e,t):p(e)?z(e,t):c(e)?K(e,t):null}async function S(e,{arcadeExecutorProvider:t,expressionInfos:n,layer:o,formTimeZone:i}){const{fieldsIndex:a}=o,{description:l,domain:m,fieldName:d,hint:p,input:c,label:f}=e;if(null==d||!a.has(d))return U().warn(new r("batch-attribute-form:invalid-form-element-field",`Field element with label '${f}' does not refer to a valid field`)),null;if(!1!==e.editable||e.editableExpression||((e=e.clone()).editableExpression=L),o.subtypeField&&(x(o)||y(o))&&e.fieldName?.toLowerCase()===o.subtypeField.toLowerCase()&&((e=e.clone()).editableExpression=L),c&&s(c)&&c.otherChoice){const e=c.otherChoice.fieldName,t=a.get(e);t&&t.name!==e&&(c.otherChoice=c.otherChoice.clone(),c.otherChoice.fieldName=t.name)}const u=new v({description:l,domain:m,field:a.get(d),hint:p,input:c,formTimeZone:i,layerTimeZone:$(o),label:f}),w=await b({element:e,expressionInfos:n,provider:t});return u.addLayer(o,w),u}async function V(e,t){const{arcadeExecutorProvider:r,expressionInfos:n,layer:o}=t,{description:i,label:s,initialState:a}=e,l=[];for(const p of e.elements){const e=await R(p,t);e&&l.push(e)}const m=new g({description:i,elements:l,label:s,initialState:a??"expanded"}),d=await b({element:e,expressionInfos:n,provider:r});return m.addLayer(o,d),m}async function W(e,t){const{description:r,label:n,displayCount:o,displayType:i,orderByFields:s,relationshipId:a}=e,{arcadeExecutorProvider:l,expressionInfos:m,layer:d}=t,p=new j({description:r,...w(o)&&{displayCount:o},displayType:i,label:n,orderByFields:s,relationshipId:a}),c=await b({element:e,expressionInfos:m,provider:l});return p.addLayer(d,c),p}async function z(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n}){const{description:o,label:i,text:s,textFormat:a}=e,{fieldsIndex:l}=n,m=s&&"markdown"===a?await P(s):s,d=new F({compiledText:m,description:o,fieldsIndex:l,label:i}),p=await b({element:e,expressionInfos:r,provider:t}),{expressionParts:c}=d;if(c.length){const e=await Promise.all(c.map(e=>{const n=r.get(e)?.expression??e;return t.getArcadeExecutor(n)}));p.textExpressions=e}return d.addLayer(n,p),d}async function K(e,t){const{associationTypes:r,description:n,label:o}=e,{arcadeExecutorProvider:i,expressionInfos:s,layer:a}=t,l=new C({associationTypes:r,description:n,label:o}),m=await b({element:e,expressionInfos:s,provider:i});return l.addLayer(a,m),l}async function O(e,{arcadeExecutorProvider:t,layer:r,formTimeZone:n}){const i=o(e,r)||e.name,s=new v({field:e,label:i,formTimeZone:n,layerTimeZone:$(r)}),a={},l=(y(r)||x(r))&&r.subtypeField&&r.subtypeField.toLowerCase()===e.name.toLowerCase();return!l&&e.editable&&r.userHasUpdateItemPrivileges&&(a.editableExpression=await t.getArcadeExecutor("true")),l&&(a.editableExpression=await t.getArcadeExecutor("false")),s.addLayer(r,a),s}function G(e,t,r){return!r.has(e.name.toLowerCase())&&u(e,t)}function $(e){return x(e)&&e.parent&&(e=e.parent),e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone?h:e&&"preferredTimeZone"in e&&e.preferredTimeZone?e.preferredTimeZone:null}export{Z as createBatchFormTemplate,N as createBatchFormTemplateFromFields};
|
|
2
|
+
import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{getEffectiveFieldAlias as o}from"../../../../editing/fieldUtils.js";import i from"../../../../form/ExpressionInfo.js";import{isMultipleChoiceInput as s}from"../../../../form/elements/inputs/inputUtils.js";import{isAttachmentElement as a,isFieldElement as l,isGroupElement as m,isRelationshipElement as d,isTextElement as p,isUtilityNetworkAssociationsElement as c}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as f,isFieldVisibleByDefault as u}from"../../../../layers/support/fieldUtils.js";import{isSubtypeSublayer as x,isSubtypeGroupLayer as y}from"../../../../layers/support/layerUtils.js";import{isNumber as w}from"../../../../support/guards.js";import{unknown as h}from"../../../../time/constants.js";import{makeExpressionInfosMap as E,makeExecutorSetForFormElement as b}from"../../expressions/expressionUtils.js";import{AttachmentElementTemplate as T}from"../AttachmentElementTemplate.js";import I from"../BatchFormTemplate.js";import{FieldElementTemplate as v}from"../FieldElementTemplate.js";import{GroupElementTemplate as g}from"../GroupElementTemplate.js";import{RelationshipElementTemplate as j}from"../RelationshipElementTemplate.js";import{TextElementTemplate as F}from"../TextElementTemplate.js";import{UtilityNetworkAssociationsElementTemplate as C}from"../UtilityNetworkAssociationsElementTemplate.js";import{compileTextElementMarkdownToHTML as P}from"./textElementTemplateUtils.js";const L="expression/dea57012-47ca4b55a000-8df62742ed0c",A=e("form-attachment-filename-calculation"),U=()=>n.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function Z(e,t,r=e.formTemplate){return await e.load(),r?.elements&&r.elements.length>0?B(r,e,t):N(e,t)}async function N(e,{arcadeExecutorProvider:t,formTimeZone:r}){const n=new Set(f(e)),o={arcadeExecutorProvider:t,formTimeZone:r,layer:e},i=[];for(const a of e.fields)G(a,e,n)&&i.push(O(a,o));const s=await Promise.all(i);return new I({elements:s,preserveFieldValuesWhenHidden:!0})}function k(e,t){for(const r of e??[])if("group"!==r.type){if("field"===r.type){if(!1===r.editable&&!r.editableExpression)return!0;if(t.subtypeField&&(x(t)||y(t))&&r.fieldName?.toLowerCase()===t.subtypeField.toLowerCase())return!0}}else if(k(r.elements??[],t))return!0;return!1}async function B(e,t,r){let n=null;k(e.elements??[],t)&&(n=new i({title:"",name:L,expression:"false"}));const o=E(n?[...e.expressionInfos??[],n]:e.expressionInfos),s={description:e.description,elements:new Array,title:e.title,preserveFieldValuesWhenHidden:e.preserveFieldValuesWhenHidden,supportsAttachmentElements:e.supportsAttachmentElements},{elements:a}=e;if(!a)return new I(s);const{arcadeExecutorProvider:l,formTimeZone:m}=r;for(const i of a){const e=await R(i,{arcadeExecutorProvider:l,expressionInfos:o,layer:t,formTimeZone:m});e&&s.elements.push(e)}return e.supportsAttachmentElements,new I(s)}async function H(e,{arcadeExecutorProvider:r,expressionInfos:n,layer:o}){const i=n.get(e.filenameExpression),s=i?await t(i.expression,A):null,a=new T({allowUserRename:e.allowUserRename,attachmentKeyword:e.attachmentKeyword,description:e.description,displayFilename:e.displayFilename,filenameExpressionExecutor:s,input:e.input,label:e.label,maxAttachmentCount:e.maxAttachmentCount,minAttachmentCount:e.minAttachmentCount,useOriginalFilename:e.useOriginalFilename}),l=await b({element:e,expressionInfos:n,provider:r});return a.addLayer(o,l),a}async function R(e,t){return a(e)?H(e,{arcadeExecutorProvider:t.arcadeExecutorProvider,expressionInfos:t.expressionInfos,layer:t.layer}):l(e)?S(e,t):m(e)?V(e,t):d(e)?W(e,t):p(e)?z(e,t):c(e)?K(e,t):null}async function S(e,{arcadeExecutorProvider:t,expressionInfos:n,layer:o,formTimeZone:i}){const{fieldsIndex:a}=o,{description:l,domain:m,fieldName:d,hint:p,input:c,label:f}=e;if(null==d||!a.has(d))return U().warn(new r("batch-attribute-form:invalid-form-element-field",`Field element with label '${f}' does not refer to a valid field`)),null;if(!1!==e.editable||e.editableExpression||((e=e.clone()).editableExpression=L),o.subtypeField&&(x(o)||y(o))&&e.fieldName?.toLowerCase()===o.subtypeField.toLowerCase()&&((e=e.clone()).editableExpression=L),c&&s(c)&&c.otherChoice){const e=c.otherChoice.fieldName,t=a.get(e);t&&t.name!==e&&(c.otherChoice=c.otherChoice.clone(),c.otherChoice.fieldName=t.name)}const u=new v({description:l,domain:m,field:a.get(d),hint:p,input:c,formTimeZone:i,layerTimeZone:$(o),label:f}),w=await b({element:e,expressionInfos:n,provider:t});return u.addLayer(o,w),u}async function V(e,t){const{arcadeExecutorProvider:r,expressionInfos:n,layer:o}=t,{description:i,label:s,initialState:a}=e,l=[];for(const p of e.elements){const e=await R(p,t);e&&l.push(e)}const m=new g({description:i,elements:l,label:s,initialState:a??"expanded"}),d=await b({element:e,expressionInfos:n,provider:r});return m.addLayer(o,d),m}async function W(e,t){const{description:r,label:n,displayCount:o,displayType:i,orderByFields:s,relationshipId:a}=e,{arcadeExecutorProvider:l,expressionInfos:m,layer:d}=t,p=new j({description:r,...w(o)&&{displayCount:o},displayType:i,label:n,orderByFields:s,relationshipId:a}),c=await b({element:e,expressionInfos:m,provider:l});return p.addLayer(d,c),p}async function z(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:n}){const{description:o,label:i,text:s,textFormat:a}=e,{fieldsIndex:l}=n,m=s&&"markdown"===a?await P(s):s,d=new F({compiledText:m,description:o,fieldsIndex:l,label:i}),p=await b({element:e,expressionInfos:r,provider:t}),{expressionParts:c}=d;if(c.length){const e=await Promise.all(c.map(e=>{const n=r.get(e)?.expression??e;return t.getArcadeExecutor(n)}));p.textExpressions=e}return d.addLayer(n,p),d}async function K(e,t){const{associationTypes:r,description:n,label:o}=e,{arcadeExecutorProvider:i,expressionInfos:s,layer:a}=t,l=new C({associationTypes:r,description:n,label:o}),m=await b({element:e,expressionInfos:s,provider:i});return l.addLayer(a,m),l}async function O(e,{arcadeExecutorProvider:t,layer:r,formTimeZone:n}){const i=o(e,r)||e.name,s=new v({field:e,label:i,formTimeZone:n,layerTimeZone:$(r)}),a={},l=(y(r)||x(r))&&r.subtypeField&&r.subtypeField.toLowerCase()===e.name.toLowerCase();return!l&&e.editable&&r.userHasUpdateItemPrivileges&&(a.editableExpression=await t.getArcadeExecutor("true")),l&&(a.editableExpression=await t.getArcadeExecutor("false")),s.addLayer(r,a),s}function G(e,t,r){return!r.has(e.name.toLowerCase())&&u(e,t)}function $(e){return x(e)&&e.parent&&(e=e.parent),e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone?h:e&&"preferredTimeZone"in e&&e.preferredTimeZone?e.preferredTimeZone:null}export{Z as createBatchFormTemplate,N as createBatchFormTemplateFromFields};
|