@arcgis/core 4.33.0-next.20250203 → 4.33.0-next.20250205
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/WebScene.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{d3a8aabdbfb59dd433e3.js → 01c3507d78398baaf61b.js} +1 -1
- package/assets/esri/core/workers/chunks/06f693780f70e5a627c4.js +1 -0
- package/assets/esri/core/workers/chunks/1a2e1a414e651e988435.js +2 -0
- package/assets/esri/core/workers/chunks/{bf9bc52a3c559108c19a.js.LICENSE.txt → 1a2e1a414e651e988435.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{6e25742ceedea7fb1b97.js → 287362f9af132fafe4de.js} +1 -1
- package/assets/esri/core/workers/chunks/308ec51ff4a66f7fcb0d.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/354531dc2f0dea2ad96f.js +2 -0
- package/assets/esri/core/workers/chunks/{6e8905f20101c1f4509d.js.LICENSE.txt → 354531dc2f0dea2ad96f.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/41cd1a5c99ab3bbd1fb4.js +1 -0
- package/assets/esri/core/workers/chunks/44abd2cd17aae3299ede.js +1 -0
- package/assets/esri/core/workers/chunks/{e9f0402fa3ac5a249807.js → 5196c43dbce48d1b81ae.js} +1 -1
- package/assets/esri/core/workers/chunks/568bcf809fcfd4d9c713.js +1 -0
- package/assets/esri/core/workers/chunks/{f2fae056a81f12b56b04.js → 5e7f16b312077ca8c18d.js} +1 -1
- package/assets/esri/core/workers/chunks/61243217aed5de012e93.js +1 -0
- package/assets/esri/core/workers/chunks/69d307758262e5d7a32e.js +1 -0
- package/assets/esri/core/workers/chunks/6d5bfcc7856cafe7b043.js +2 -0
- package/assets/esri/core/workers/chunks/{7d3a441d2eb18d709ef9.js.LICENSE.txt → 6d5bfcc7856cafe7b043.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/72cf9192292e5c85c6df.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{bc50585615f07d5ec1a9.js → 746c964cf07e4306f21f.js} +1 -1
- package/assets/esri/core/workers/chunks/77764ca90bdd13ee2167.js +2 -0
- package/assets/esri/core/workers/chunks/{25c8cc30faade043c8dc.js.LICENSE.txt → 77764ca90bdd13ee2167.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/7b11bf5799ecb3640b48.js +314 -0
- package/assets/esri/core/workers/chunks/{07360fde6ea65664e6ca.js → 82d26884127ed772cc4b.js} +1 -1
- package/assets/esri/core/workers/chunks/{ba3c18d1efde46461231.js → 8438fba57e82e4cc7c11.js} +1 -1
- package/assets/esri/core/workers/chunks/{d1678945cf6a58f76863.js → 858b191c078d04232342.js} +1 -1
- package/assets/esri/core/workers/chunks/{0ef5b0f8aa8a09acd6e0.js → 8e90c5fee4ad7c7275dc.js} +1 -1
- package/assets/esri/core/workers/chunks/918bdba41fa470cf77fd.js +1 -0
- package/assets/esri/core/workers/chunks/{3ec51b75d1a86dad6cb1.js → 91d2bdfa6e34c10b7f50.js} +1 -1
- package/assets/esri/core/workers/chunks/{12dd892cf61a76fb40ad.js → 991e0f619f1f81f94d56.js} +1 -1
- package/assets/esri/core/workers/chunks/9a27824d94df702e6e28.js +1 -0
- package/assets/esri/core/workers/chunks/a2409d4921c02614169a.js +1 -0
- package/assets/esri/core/workers/chunks/{7810579a5a780933cdc9.js → ad3e692681b50bd1acc2.js} +1 -1
- package/assets/esri/core/workers/chunks/{adfa126cea32298c28e9.js → b1269b51cef3e11c85e3.js} +1 -1
- package/assets/esri/core/workers/chunks/{692b3d03346f030aa649.js → b1f5344e57ee679a7e81.js} +44 -44
- package/assets/esri/core/workers/chunks/b21b152fa15896577242.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{c7a94e569c905f97244a.js → b33122adfd1fb68f7c0f.js} +1 -1
- package/assets/esri/core/workers/chunks/{da77eefaad83c0644380.js → b8fae500c69ca2cff62a.js} +1 -1
- package/assets/esri/core/workers/chunks/b9ce0049e27a3e1ed9f9.js +1 -0
- package/assets/esri/core/workers/chunks/b9d9a1dc3c5d799e2685.js +1 -0
- package/assets/esri/core/workers/chunks/{79afe4674a0557eb26e4.js → bf26f58210755875748c.js} +1 -1
- package/assets/esri/core/workers/chunks/c032bcd25e2e7a57ad43.js +1 -0
- package/assets/esri/core/workers/chunks/{5adeb979f178944b9ce5.js → c4c2b94e5cee7b824093.js} +1 -1
- package/assets/esri/core/workers/chunks/{3e872e5e528dca7bee0c.js → cc75bbfd779f409943a3.js} +1 -1
- package/assets/esri/core/workers/chunks/{4c5279fedf982a174706.js → d175953337fa655dc6b0.js} +1 -1
- package/assets/esri/core/workers/chunks/d35efcbe439500bf18bc.js +1 -0
- package/assets/esri/core/workers/chunks/e26dc0c1654316bb1558.js +1 -0
- package/assets/esri/core/workers/chunks/{448ee44c7f594e5b2551.js → e410a09650530d7aad10.js} +1 -1
- package/assets/esri/core/workers/chunks/{2345344be4b0e487d3a6.js → f198f4ba7d3d52882d98.js} +1 -1
- package/assets/esri/core/workers/chunks/{881ddbdeb40336208e90.js → f29715459ecd46180829.js} +1 -1
- package/assets/esri/core/workers/chunks/f4e48bbdbc9da10ec71a.js +1 -0
- package/assets/esri/themes/base/_core.scss +0 -2
- package/assets/esri/themes/base/widgets/_Directions.scss +172 -420
- package/assets/esri/themes/base/widgets/_Editor.scss +31 -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/widgets/Directions/t9n/Directions_ar.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_no.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
- package/chunks/ColorMaterial.glsl.js +4 -5
- package/chunks/ComponentShader.glsl.js +30 -30
- package/chunks/DefaultMaterial.glsl.js +19 -19
- package/chunks/HUDMaterial.glsl.js +34 -34
- package/chunks/MeasurementArrow.glsl.js +6 -6
- package/chunks/NativeLine.glsl.js +4 -4
- package/chunks/Pattern.glsl.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/RealisticTree.glsl.js +14 -14
- package/chunks/RibbonLine.glsl.js +32 -32
- package/chunks/Terrain.glsl.js +31 -31
- package/chunks/WaterSurface.glsl.js +15 -15
- package/copyright.txt +0 -29
- package/core/Collection.js +1 -1
- package/core/has.js +1 -1
- package/geometry/support/centroid.js +1 -1
- package/interfaces.d.ts +152 -13
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/capabilities.js +1 -1
- package/layers/support/featureLayerUtils.js +1 -1
- package/layers/support/labelUtils.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/package.json +4 -5
- package/popup/content/AttachmentsContent.js +1 -1
- package/popup/support/AttachmentsOrderByInfo.d.ts +4 -0
- package/popup/support/AttachmentsOrderByInfo.js +5 -0
- package/portal/schemas/definitions.js +1 -1
- package/rest/imageService/fetchRasterInfo.js +1 -1
- package/rest/query/operations/queryAttachments.js +1 -1
- package/rest/support/AttachmentQuery.js +1 -1
- package/support/revision.js +1 -1
- package/support/timeUtils.d.ts +0 -1
- package/support/timeUtils.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/animationUtils.js +1 -1
- package/symbols/cim/defaultCIMValues.js +1 -1
- package/views/2d/engine/webgl/animations/utils.js +1 -1
- package/views/2d/engine/webgl/mesh/factories/FeatureMeshFactory.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/gradientStrokeConstants.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientStrokeShader.js +1 -1
- package/views/2d/engine/webgl/util/LabelMatcher.js +1 -1
- package/views/2d/engine/webgl/util/createMatcher.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
- package/views/3d/layers/support/FeatureTileTree3D.js +1 -1
- package/views/3d/layers/support/FeatureVisibilityFilter.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js +3 -3
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +8 -8
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/layers/ImageryTileLayerView.d.ts +4 -0
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/webscene/spec-certification/index.js +1 -1
- package/widgets/Attachments/AttachmentsViewModel.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Directions/DirectionsSearchTool.js +5 -0
- package/widgets/Directions/DirectionsViewModel.js +1 -1
- package/widgets/Directions/DirectionsVisibleElements.js +5 -0
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflowData.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/Edits.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/VisibleElements.js +1 -1
- package/widgets/Editor/components/CreateFeaturesPanelContent.js +1 -1
- package/widgets/Editor/components/PanelToolbar.js +1 -1
- package/widgets/Editor/components/PendingFeatureList.js +5 -0
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor/css.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/FieldInput.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend.js +1 -1
- package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch/VisibleElements.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/support/ItemList.js +1 -1
- package/widgets/support/geolocationUtils.js +1 -1
- package/assets/esri/core/workers/chunks/06d72622590dbd38c5de.js +0 -1
- package/assets/esri/core/workers/chunks/0a19e1aec6a5502e391a.js +0 -1
- package/assets/esri/core/workers/chunks/12964a4b16113cdc9c93.js +0 -1
- package/assets/esri/core/workers/chunks/1e3ab66d0e8a7f160f33.js +0 -1
- package/assets/esri/core/workers/chunks/25c8cc30faade043c8dc.js +0 -2
- package/assets/esri/core/workers/chunks/326a3f50e585e492b673.js +0 -1
- package/assets/esri/core/workers/chunks/34d464dacee52739c98c.js +0 -1
- package/assets/esri/core/workers/chunks/402de76b5de05615e111.js +0 -1
- package/assets/esri/core/workers/chunks/4cab082b8432ddc05345.js +0 -1
- package/assets/esri/core/workers/chunks/6e8905f20101c1f4509d.js +0 -2
- package/assets/esri/core/workers/chunks/6f796f2836f949ab7359.js +0 -1
- package/assets/esri/core/workers/chunks/7d3a441d2eb18d709ef9.js +0 -2
- package/assets/esri/core/workers/chunks/ba37ab9e560644dc1f18.js +0 -1
- package/assets/esri/core/workers/chunks/bf9bc52a3c559108c19a.js +0 -2
- package/assets/esri/core/workers/chunks/c74441fbe0f63633796f.js +0 -1
- package/assets/esri/core/workers/chunks/dd46ec81cebe1a0a7b9c.js +0 -1
- package/assets/esri/core/workers/chunks/e444ec05a8a1dfbd21a8.js +0 -1
- package/assets/esri/core/workers/chunks/f8367c21fa91435c7c53.js +0 -1
- package/assets/esri/core/workers/chunks/fb1a89f753057f889971.js +0 -314
- package/assets/esri/core/workers/chunks/ffa2b9d70830aed03a8f.js +0 -1
- package/assets/esri/themes/base/widgets/_SaveLayer.scss +0 -40
- package/assets/esri/widgets/support/t9n/SaveLayer.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_ar.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_bg.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_bs.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_ca.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_cs.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_da.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_de.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_el.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_en.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_es.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_et.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_fi.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_fr.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_he.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_hr.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_hu.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_id.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_it.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_ja.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_ko.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_lt.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_lv.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_nl.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_no.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_pl.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_pt-BR.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_pt-PT.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_ro.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_ru.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_sk.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_sl.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_sr.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_sv.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_th.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_tr.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_uk.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_vi.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_zh-CN.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_zh-HK.json +0 -1
- package/assets/esri/widgets/support/t9n/SaveLayer_zh-TW.json +0 -1
- package/widgets/Directions/components/SaveLayer.js +0 -5
- package/widgets/Directions/css.js +0 -5
- /package/{views/3d/webgl-engine/core/shaderLibrary/util → webscene/support}/AlphaCutoff.js +0 -0
package/widgets/Editor.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{mappedFind as t}from"../core/maybe.js";import{createResolver as s}from"../core/promiseUtils.js";import{watch as o,initial as i,on as r,when as a}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import d from"../views/interactive/sketch/SketchValueOptions.js";import c from"./Attachments.js";import m from"./FeatureForm.js";import p from"./FeatureTemplates.js";import h from"./Spinner.js";import u from"./Widget.js";import{css as g}from"./Editor/css.js";import w from"./Editor/EditorViewModel.js";import{isModelUpload as f}from"./Editor/modelUploadUtils.js";import v from"./Editor/VisibleElements.js";import{loadCreateFeaturesPanelContentComponents as _,CreateFeaturesPanelContent as y}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as F,FeatureList as k}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as M,FooterActions as A}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as b,Notice as C}from"./Editor/components/Notices.js";import{loadPanelContentComponents as E,PanelContent as W,PanelContentSection as P,PanelContentMessage as T}from"./Editor/components/PanelContent.js";import{PanelToolbar as L,loadPanelToolbarComponents as j}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as I,Prompt as U}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as D,UpdateFeaturePanelContent as S}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as O,UploadDetails as V}from"./Editor/components/UploadDetails.js";import{loadCalciteComponents as x}from"./support/componentsUtils.js";import{globalCss as B}from"./support/globalCss.js";import{incrementHeadingLevel as G,Heading as R}from"./support/Heading.js";import{renderItem as q}from"./support/ItemList.js";import{connectDelayedLoading as H}from"./support/loaderUtils.js";import"./support/widgetUtils.js";import{messageBundle as N}from"./support/decorators/messageBundle.js";import{vmEvent as z}from"./support/decorators/vmEvent.js";import{tsx as $}from"./support/jsxFactory.js";import{substitute as J}from"../intl/substitute.js";let K=class extends u{constructor(e,t){super(e,t),this._featureForm=new m,this._attachments=new c({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new p({enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?$("calcite-icon",{class:g.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new h,this._loading=!1,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=new w,this.visibleElements=new v,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureForm=()=>this._featureForm.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSelectIcon=()=>$("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:s},...o)=>{const{visibleElements:i}=this;return $("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:s,onCalciteFlowItemBack:this._onBack},i.settingsMenu?$(L,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:i}):null,...o)},this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,s={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&f(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&t.activeFeatureFormViewModel?.activeAssociation?this._showPromptAndWait({...s,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(s)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteFeatureFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepFeature,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then((()=>e.back())))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then((()=>e.back())))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this.addHandles([o((()=>G(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),i),r((()=>this.viewModel.activeWorkflow),"cancel-request",(({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then((t=>t?e.allow():e.deny()))})),a((()=>this.viewModel.featureFormViewModel),(e=>{this._featureForm.viewModel=e}),i),o((()=>this.viewModel),(e=>{this._attachments.viewModel=e?.attachmentsViewModel??null,this._featureTemplates.viewModel=e?.featureTemplatesViewModel??null,this._spinner.viewModel=e?.spinnerViewModel??null,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt}),i),o((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"})}),i),o((()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel]),(([e])=>{e&&(this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel?.set(e.sketch))}),i),a((()=>this._attachments?.error),(e=>this._onAttachmentsError(e))),a((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:o,cancel:i}]=e;this._showPrompt({title:t.errorWarningTitle,message:J(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{o(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{i(),this._clearPrompt()}}}})})),o((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}})),o((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e)),H({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting},setEffectiveLoading:e=>{this._loading=e}})])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy()}loadDependencies(){return Promise.all([x({flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),_(),F(),M(),b(),E(),j(),I(),D(),O()])}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get activeWorkflow(){return this.viewModel.activeWorkflow}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,s=this.classes(g.base,B.widget,B.panel);if(!t)return $("div",{class:s,key:"empty"});const{pageStack:o}=t,i=o.length-1,r=o.map(((e,t)=>this._renderPage(e,t===i)));return $("div",{class:s,key:"base"},e.flow?$("calcite-flow",{key:"flow"},r):r,this._prompt?$(U,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const s={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(s);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(s);case"creating-features-upload-details":return this._renderUploadDetails(s);case"creating-features":return this._renderCreatingFeatures(s);case"editing-existing-feature":case"editing-attributes":return this._renderUpdateFeature(s);case"awaiting-update-feature-candidate":return this._renderFeatureList(s);case"adding-attachment":return this._renderAttachmentAdding(s);case"editing-attachment":return this._renderAttachmentEditing(s);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(s)}return $("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:s}=this;return $(t,{heading:s.selectTemplate,key:"templates-panel",...e},$(W,{key:"feature-templates"},$(P,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:s,messages:o}=this;if("create-features"!==s?.type)return null;const i=s.data.upload;return i?$(t,{heading:o.createFeatures,key:"upload-details-panel",...e},$(V,{helpMessage:this._helpMessage,messages:o,upload:i})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:s,messages:o,messagesCommon:i,headingLevel:r,viewModel:a}=this;if(!s)return null;const n="create-features"===s.type&&s.numPendingFeatures>0||"update"===s.type&&"create-features"===s?.activeWorkflow?.type&&s.activeWorkflow?.numPendingFeatures>0;return $(t,{heading:o.createFeatures,key:"create-features-panel",...e},n?$(S,{editorViewModel:a,headingLevel:r,messages:o,messagesCommon:i,renderAttachments:this._renderAttachments,renderFeatureForm:this._renderFeatureForm,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):$(y,{helpMessage:this._helpMessage}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:s,messagesCommon:o,headingLevel:i,viewModel:r}=this;return $(t,{heading:s.editFeature,key:"update-feature-panel",...e},$(S,{editorViewModel:r,headingLevel:i,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderFeatureForm:this._renderFeatureForm,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_getAssociationTypeTitle(e){if(!e)return null;if(e.title)return e.title;const{messagesFeature:t}=this;switch(e.type){case"attachment":return t.associationsAttachments;case"connectivity":return t.associationsConnectivity;case"structure":return t.associationsStructure;case"content":return t.associationsContents;case"container":return t.associationsContainer}}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:s,messagesCommon:o,headingLevel:i,viewModel:r}=this,a=r.featureFormViewModel?.activeAssociationInput?.activeAssociationType,n=this._getAssociationTypeTitle(a)??s.editFeature;return $(t,{heading:n,key:"viewing-associated-layers-panel",...e},$(S,{editorViewModel:r,headingLevel:i,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderFeatureForm:this._renderFeatureForm,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderCustomTemplateGroupContent(e){const{messages:s,viewModel:o}=this,i=t(e.group.items,(e=>o.itemHasInvalidFormTemplate(e)?s.formFieldCreateError:void 0));return i?$(C,{kind:"warning",message:i}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:s,messages:o,messagesCommon:i}=this;return $(t,{heading:o.addAttachment,key:"attachment-adding-panel",...e},$(W,{key:"attachments"},this._renderAttachments()),$(A,{buttons:[{label:s.submitting?i.cancel:i.add,disabled:s.submitting||!s.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:s,activeWorkflow:o,messages:i,messagesCommon:r}=this;return o?$(t,{heading:i.editAttachment,key:"attachment-editing-panel",...e},$(W,{key:"attachments"},this._renderAttachments()),o.shouldAllowAttachmentEditing?$(A,{buttons:[{label:r.update,disabled:s.submitting||!s.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:s.submitting,label:r.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:s,viewModel:o,visibleElements:i}=this,r=this._helpMessage;return $(t,{heading:s.widgetLabel,key:"landing-panel",...e},$(W,{key:"landing-content"},o.editorItems.length?[i.editFeaturesSection?$(P,{key:"edit-actions"},this._renderUpdateActions()):null,i.createFeaturesSection&&o.canCreateVisible?$(P,{key:"create-actions"},this._renderCreateActions()):null]:$(T,{key:"no-content"},s.noEditableLayers)),r?$("div",{class:g.helpMessage,key:"footer-actions",slot:"footer"},r):void 0)}get _helpMessage(){const{activeWorkflow:e,messages:t,view:s}=this,o=e?.helpMessage;return o?t["3d"===s?.type?"helpMessages3d":"helpMessages2d"]?.[o]:void 0}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:s}=this,o={id:"select",label:t.select};return $("div",{class:g.updateActions,key:"update-actions"},$(R,{level:G(this.headingLevel)},e.editFeatures),$("calcite-list",{class:g.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},q({disabled:!s.canUpdateVisible,grouped:!1,item:o,selectedItem:"awaiting-feature-to-update"===s.activeWorkflow?.stepId?o:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return $("div",{key:"create-actions"},$(R,{level:G(this.headingLevel)},this.messages.createFeatures),$("div",{class:g.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:t,viewModel:s}=this,{activeWorkflow:o}=s;if("update"!==o?.type)return null;const i=o.data.candidates,r=J(this.messages.multipleFeaturesTemplate,{total:i.length});return $(t,{heading:r,key:"feature-list",...e},$(k,{editorItems:s.editorItems,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:o,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t)}))}_showPromptAndWait({title:e,message:t,yesLabel:o,noLabel:i}){const r=s(),{view:a}=this,n=a?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:o,action:()=>r.resolve(!0)},secondary:{label:i,action:()=>r.resolve(!1)}}}),r.promise.finally((()=>{this._clearPrompt(),n&&a?.focus()}))}};e([n()],K.prototype,"_featureForm",void 0),e([n()],K.prototype,"_attachments",void 0),e([n()],K.prototype,"_featureTemplates",void 0),e([n()],K.prototype,"_filterText",void 0),e([n()],K.prototype,"_prompt",void 0),e([n()],K.prototype,"_spinner",void 0),e([n()],K.prototype,"_deleteButtonCommonInfo",null),e([n()],K.prototype,"_loading",void 0),e([n({readOnly:!0})],K.prototype,"activeWorkflow",null),e([n()],K.prototype,"headingLevel",void 0),e([n()],K.prototype,"hideTemplatesForInactiveLayers",null),e([n()],K.prototype,"icon",null),e([n()],K.prototype,"label",null),e([n()],K.prototype,"labelOptions",null),e([n()],K.prototype,"layerInfos",null),e([n(),N("esri/widgets/Editor/t9n/Editor")],K.prototype,"messages",void 0),e([n(),N("esri/t9n/common")],K.prototype,"messagesCommon",void 0),e([n(),N("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],K.prototype,"messagesTemplates",void 0),e([n(),N("esri/widgets/Feature/t9n/Feature")],K.prototype,"messagesFeature",void 0),e([n()],K.prototype,"snappingOptions",null),e([n()],K.prototype,"tooltipOptions",null),e([n()],K.prototype,"supportingWidgetDefaults",void 0),e([n({type:d,nonNullable:!0})],K.prototype,"valueOptions",null),e([n()],K.prototype,"view",null),e([n(),z(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],K.prototype,"viewModel",void 0),e([n({type:v,nonNullable:!0})],K.prototype,"visibleElements",void 0),e([n()],K.prototype,"_helpMessage",null),K=e([l("esri.widgets.Editor")],K);const Q=K;export{Q as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{mappedFind as t,abortMaybe as s,destroyMaybe as o}from"../core/maybe.js";import{createResolver as i}from"../core/promiseUtils.js";import{watch as r,initial as a,on as n,when as l}from"../core/reactiveUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import m from"../views/interactive/sketch/SketchValueOptions.js";import h from"./Attachments.js";import p from"./FeatureForm.js";import u from"./FeatureTemplates.js";import g from"./Spinner.js";import w from"./Widget.js";import{css as v}from"./Editor/css.js";import _ from"./Editor/EditorViewModel.js";import{isModelUpload as f}from"./Editor/modelUploadUtils.js";import k from"./Editor/VisibleElements.js";import{loadCreateFeaturesPanelContentComponents as y,CreateFeaturesPanelContent as b}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as F,FeatureList as M}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as A,FooterActions as T}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as C,Notice as E}from"./Editor/components/Notices.js";import{loadPanelContentComponents as P,PanelContent as W,PanelContentSection as L,PanelContentMessage as j}from"./Editor/components/PanelContent.js";import{PanelToolbar as S,loadPanelToolbarComponents as I}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as U,Prompt as D}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as O,UpdateFeaturePanelContent as V}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as x,UploadDetails as B}from"./Editor/components/UploadDetails.js";import{VisibleElements as R,CreateToolVisibilityMap as G}from"./Sketch/VisibleElements.js";import{loadCalciteComponents as z}from"./support/componentsUtils.js";import{globalCss as H}from"./support/globalCss.js";import{incrementHeadingLevel as q,Heading as N}from"./support/Heading.js";import{renderItem as K}from"./support/ItemList.js";import{connectDelayedLoading as $}from"./support/loaderUtils.js";import"./support/widgetUtils.js";import{messageBundle as J}from"./support/decorators/messageBundle.js";import{vmEvent as Q}from"./support/decorators/vmEvent.js";import{tsx as X}from"./support/jsxFactory.js";import{substitute as Y}from"../intl/substitute.js";const Z=Symbol("sketch-setup-handles");let ee=class extends w{constructor(e,t){super(e,t),this._featureForm=new p,this._sketchToolbar=null,this._attachments=new h({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new u({enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?X("calcite-icon",{class:v.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new g,this._loading=!1,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=new _,this.visibleElements=new k,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureForm=()=>this._featureForm.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSketch=()=>this._sketchToolbar?X("div",{class:v.sketchContainer,key:"editor-sketch-container"},this._sketchToolbar?.render()):void 0,this._renderSelectIcon=()=>X("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:s},...o)=>{const{visibleElements:i}=this;return X("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:s,onCalciteFlowItemBack:this._onBack},i.settingsMenu?X(S,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:i}):null,...o)},this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,s={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&f(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&t.activeFeatureFormViewModel?.activeAssociation?this._showPromptAndWait({...s,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(s)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteFeatureFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepFeature,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then((()=>e.back())))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then((()=>e.back())))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this.addHandles([r((()=>q(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),a),n((()=>this.viewModel.activeWorkflow),"cancel-request",(({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then((t=>t?e.allow():e.deny()))})),l((()=>this.viewModel.featureFormViewModel),(e=>{this._featureForm.viewModel=e}),a),r((()=>this.viewModel),(e=>{this._attachments.viewModel=e?.attachmentsViewModel??null,this._featureTemplates.viewModel=e?.featureTemplatesViewModel??null,this._spinner.viewModel=e?.spinnerViewModel??null,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt}),a),r((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"})}),a),r((()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel]),(([e])=>{e&&(this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel?.set(e.sketch))}),a),l((()=>this._attachments?.error),(e=>this._onAttachmentsError(e))),l((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:o,cancel:i}]=e;this._showPrompt({title:t.errorWarningTitle,message:Y(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{o(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{i(),this._clearPrompt()}}}})})),r((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}})),r((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e)),r((()=>this.visibleElements.sketch),(()=>this._setupSketch()),a),$({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting},setEffectiveLoading:e=>{this._loading=e}})])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy()}loadDependencies(){return Promise.all([z({flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),y(),F(),A(),C(),P(),I(),U(),O(),x()])}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get activeWorkflow(){return this.viewModel.activeWorkflow}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,s=this.classes(v.base,H.widget,H.panel);if(!t)return X("div",{class:s,key:"empty"});const{pageStack:o}=t,i=o.length-1,r=o.map(((e,t)=>this._renderPage(e,t===i)));return X("div",{class:s,key:"base"},e.flow?X("calcite-flow",{key:"flow"},r):r,this._prompt?X(D,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const s={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(s);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(s);case"creating-features-upload-details":return this._renderUploadDetails(s);case"creating-features":return this._renderCreatingFeatures(s);case"editing-existing-feature":case"editing-attributes":return this._renderUpdateFeature(s);case"awaiting-update-feature-candidate":return this._renderFeatureList(s);case"adding-attachment":return this._renderAttachmentAdding(s);case"editing-attachment":return this._renderAttachmentEditing(s);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(s)}return X("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:s}=this;return X(t,{heading:s.selectTemplate,key:"templates-panel",...e},X(W,{key:"feature-templates"},X(L,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:s,messages:o}=this;if("create-features"!==s?.type)return null;const i=s.data.upload;return i?X(t,{heading:o.createFeatures,key:"upload-details-panel",...e},X(B,{helpMessage:this._helpMessage,messages:o,upload:i})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:s,messages:o,messagesCommon:i,headingLevel:r,viewModel:a}=this;if(!s)return null;const n="create-features"===s.type&&s.numPendingFeatures>0||"update"===s.type&&"create-features"===s?.activeWorkflow?.type&&s.activeWorkflow?.numPendingFeatures>0;return X(t,{heading:o.createFeatures,key:"create-features-panel",...e},n?X(V,{editorViewModel:a,headingLevel:r,messages:o,messagesCommon:i,renderAttachments:this._renderAttachments,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):X(b,{helpMessage:this._helpMessage,renderSketchToolbar:this._renderSketch}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:s,messagesCommon:o,headingLevel:i,viewModel:r}=this;return X(t,{heading:s.editFeature,key:"update-feature-panel",...e},X(V,{editorViewModel:r,headingLevel:i,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_getAssociationTypeTitle(e){if(!e)return null;if(e.title)return e.title;const{messagesFeature:t}=this;switch(e.type){case"attachment":return t.associationsAttachments;case"connectivity":return t.associationsConnectivity;case"structure":return t.associationsStructure;case"content":return t.associationsContents;case"container":return t.associationsContainer}}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:s,messagesCommon:o,headingLevel:i,viewModel:r}=this,a=r.featureFormViewModel?.activeAssociationInput?.activeAssociationType,n=this._getAssociationTypeTitle(a)??s.editFeature;return X(t,{heading:n,key:"viewing-associated-layers-panel",...e},X(V,{editorViewModel:r,headingLevel:i,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderCustomTemplateGroupContent(e){const{messages:s,viewModel:o}=this,i=t(e.group.items,(e=>o.itemHasInvalidFormTemplate(e)?s.formFieldCreateError:void 0));return i?X(E,{kind:"warning",message:i}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:s,messages:o,messagesCommon:i}=this;return X(t,{heading:o.addAttachment,key:"attachment-adding-panel",...e},X(W,{key:"attachments"},this._renderAttachments()),X(T,{buttons:[{label:s.submitting?i.cancel:i.add,disabled:s.submitting||!s.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:s,activeWorkflow:o,messages:i,messagesCommon:r}=this;return o?X(t,{heading:i.editAttachment,key:"attachment-editing-panel",...e},X(W,{key:"attachments"},this._renderAttachments()),o.shouldAllowAttachmentEditing?X(T,{buttons:[{label:r.update,disabled:s.submitting||!s.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:s.submitting,label:r.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:s,viewModel:o,visibleElements:i}=this,r=this._helpMessage;return X(t,{heading:s.widgetLabel,key:"landing-panel",...e},X(W,{key:"landing-content"},o.editorItems.length?[i.editFeaturesSection?X(L,{key:"edit-actions"},this._renderUpdateActions()):null,i.createFeaturesSection&&o.canCreateVisible?X(L,{key:"create-actions"},this._renderCreateActions()):null]:X(j,{key:"no-content"},s.noEditableLayers)),r?X("div",{class:v.helpMessage,key:"footer-actions",slot:"footer"},r):void 0)}get _helpMessage(){const{activeWorkflow:e,messages:t,view:s}=this,o=e?.helpMessage;return o?t["3d"===s?.type?"helpMessages3d":"helpMessages2d"]?.[o]:void 0}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:s}=this,o={id:"select",label:t.select};return X("div",{class:v.updateActions,key:"update-actions"},X(N,{level:q(this.headingLevel)},e.editFeatures),X("calcite-list",{class:v.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},K({disabled:!s.canUpdateVisible,grouped:!1,item:o,selectedItem:"awaiting-feature-to-update"===s.activeWorkflow?.stepId?o:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return X("div",{key:"create-actions"},X(N,{level:q(this.headingLevel)},this.messages.createFeatures),X("div",{class:v.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:t,viewModel:s}=this,{activeWorkflow:o}=s;if("update"!==o?.type)return null;const i=o.data.candidates,r=Y(this.messages.multipleFeaturesTemplate,{total:i.length});return X(t,{heading:r,key:"feature-list",...e},X(M,{editorItems:s.editorItems,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:o,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t)}))}_showPromptAndWait({title:e,message:t,yesLabel:s,noLabel:o}){const r=i(),{view:a}=this,n=a?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:s,action:()=>r.resolve(!0)},secondary:{label:o,action:()=>r.resolve(!1)}}}),r.promise.finally((()=>{this._clearPrompt(),n&&a?.focus()}))}async _setupSketch(){if(!!!this.visibleElements.sketch)return this._sketchImportAbortController=s(this._sketchImportAbortController),this._sketchToolbar=o(this._sketchToolbar),void this.removeHandles(Z);if(this._sketchImportAbortController)return;const e=new AbortController;this._sketchImportAbortController=e;const t=await import("./Sketch.js");if(!e.signal.aborted)try{this._sketchToolbar=new t.default({toolbarKind:"docked",contextualToolLocation:"inline-end",scale:"s",visibleElements:new R({deleteButton:!1,settingsMenu:!1,directionModePicker:!1,selectionCountLabel:!1,duplicateButton:!1,createTools:new G({freehandPolygon:!0,freehandPolyline:!0})})}),this.addHandles([r((()=>this.viewModel.activeLeafWorkflow?.availableCreateTools),(e=>{this._sketchToolbar&&(this._sketchToolbar.availableCreateTools=e)}),a),r((()=>this.visibleElements.undoRedoButtons),(e=>{this._sketchToolbar&&(this._sketchToolbar.visibleElements.undoRedoMenu=e)}),a),l((()=>this.viewModel?.sketchViewModel),(e=>{this._sketchToolbar&&(this._sketchToolbar.viewModel=e)}),a),l((()=>!!this.messages),(()=>{this._sketchToolbar&&(this._sketchToolbar.customActions=[{icon:"zoom-to-object",text:this.messages.zoomTo,onclick:()=>this.viewModel.zoomTo(),id:"editor-custom-zoom-to",position:"before-selection-set"}])}),{once:!0,initial:!0})],Z)}finally{this._sketchImportAbortController=null}}};e([d()],ee.prototype,"_featureForm",void 0),e([d()],ee.prototype,"_sketchToolbar",void 0),e([d()],ee.prototype,"_attachments",void 0),e([d()],ee.prototype,"_featureTemplates",void 0),e([d()],ee.prototype,"_filterText",void 0),e([d()],ee.prototype,"_prompt",void 0),e([d()],ee.prototype,"_spinner",void 0),e([d()],ee.prototype,"_deleteButtonCommonInfo",null),e([d()],ee.prototype,"_loading",void 0),e([d({readOnly:!0})],ee.prototype,"activeWorkflow",null),e([d()],ee.prototype,"headingLevel",void 0),e([d()],ee.prototype,"hideTemplatesForInactiveLayers",null),e([d()],ee.prototype,"icon",null),e([d()],ee.prototype,"label",null),e([d()],ee.prototype,"labelOptions",null),e([d()],ee.prototype,"layerInfos",null),e([d(),J("esri/widgets/Editor/t9n/Editor")],ee.prototype,"messages",void 0),e([d(),J("esri/t9n/common")],ee.prototype,"messagesCommon",void 0),e([d(),J("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],ee.prototype,"messagesTemplates",void 0),e([d(),J("esri/widgets/Feature/t9n/Feature")],ee.prototype,"messagesFeature",void 0),e([d()],ee.prototype,"snappingOptions",null),e([d()],ee.prototype,"tooltipOptions",null),e([d()],ee.prototype,"supportingWidgetDefaults",void 0),e([d({type:m,nonNullable:!0})],ee.prototype,"valueOptions",null),e([d()],ee.prototype,"view",null),e([d(),Q(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],ee.prototype,"viewModel",void 0),e([d({type:k,nonNullable:!0})],ee.prototype,"visibleElements",void 0),e([d()],ee.prototype,"_helpMessage",null),ee=e([c("esri.widgets.Editor")],ee);const te=ee;export{te as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as i}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import o from"../../core/Accessor.js";import{isSome as r}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import n from"../../core/Identifiable.js";import a from"../../core/Logger.js";import{isAbortError as l,eachAlways as c}from"../../core/promiseUtils.js";import{watch as p,on as d,whenOnce as u,initial as h}from"../../core/reactiveUtils.js";import{throttle as f}from"../../core/throttle.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import{cast as _}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import b from"../../geometry/Point.js";import g from"../../geometry/SpatialReference.js";import A from"../../popup/content/TextContent.js";import{getFeaturePopupTitle as w}from"../../support/popupUtils.js";import{system as I}from"../../time/timeZoneUtils.js";import M from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import v from"./FeatureContent/FeatureContentViewModel.js";import C from"./FeatureExpression/FeatureExpressionViewModel.js";import F from"./FeatureFields/FeatureFieldsViewModel.js";import x from"./FeatureMedia/FeatureMediaViewModel.js";import V from"./FeatureRelationship/FeatureRelationshipViewModel.js";import{createCompiledExpressions as T}from"./support/arcadeFeatureUtils.js";import{createFieldInfoMap as E,getAllFieldInfos as j,getSourceLayer as P,querySourceLayer as R,isRelatableFeatureSupportedLayer as L,isAssociatedFeatureSupportedLayer as O,substituteFieldsInLinksAndAttributes as Z,isExpressionField as k,isRelatedField as N,formatEditInfo as U,graphicCallback as B,queryUpdatedFeature as S,formatAttributes as H,preLayerQueryCallback as D,preRequestCallback as G}from"./support/featureUtils.js";import{queryLayerInfos as q,queryRelatedFeatures as Q,setRelatedFeatures as z,getRelatedFieldInfo as J,createRelatedInfo as K,updateRelatedInfo as W}from"./support/relatedFeatureUtils.js";import X from"../support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js";var Y;const $=1,ee="content-view-models",te="relationship-view-models",ie="association-view-models",oe={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0,utilityNetworkAssociationsContent:!0};let re=Y=class extends(n.IdentifiableMixin(o)){constructor(e){super(e),this._error=null,this._featureAbortController=null,this._associationVMAbortController=null,this._graphicChangedThrottled=f(this._graphicChanged,$,this),this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...oe},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.location=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&!!t.attachmentsContent||"custom"===e.type&&!!t.customContent||"fields"===e.type&&!!t.fieldsContent||"media"===e.type&&!!t.mediaContent||"text"===e.type&&!!t.textContent||"expression"===e.type&&!!t.expressionContent||"relationship"===e.type&&!!t.relationshipContent||"utility-network-associations"===e.type&&!!t.utilityNetworkAssociationsContent},this.addHandles(p((()=>[this.graphic,this._effectivePopupTemplate,this.abilities,this.timeZone]),(()=>this._graphicChangedThrottled()),h))}initialize(){this.addHandles(this._graphicChangedThrottled)}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return null!=this.graphic?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return E(j(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return P(this.graphic)}castAbilities(e){return{...oe,...e}}get isTable(){return this._sourceLayer?.isTable||!1}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(e){this._featureAbortController=new AbortController,this._set("graphic",e?.clone()??null)}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get timeZone(){return this.view?.timeZone??I}set timeZone(e){this._overrideIfSome("timeZone",e)}get map(){return this.view?.map||null}set map(e){this._override("map",e)}get waitingForContent(){return!(!this._featureAbortController&&!this._associationVMAbortController)}setActiveMedia(e,t){const i=this.contentViewModels[e];i instanceof x&&i.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof x&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof x&&t.previous()}async updateGeometry(){const{graphic:e,spatialReference:t,_sourceLayer:i}=this;await(i?.load());const o=i?.objectIdField;if(!o||!e||!i)return;const r=e?.attributes?.[o];if(null==r)return;const s=[r];if(!e.geometry){const o=await R({layer:i,graphic:e,outFields:[],objectIds:s,returnGeometry:!0,spatialReference:t}),r=o?.geometry;r&&(e.geometry=r)}}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async _graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:e}=this;if(!e)return;const t=new AbortController;this._featureAbortController=t;try{await this._queryFeature({signal:t.signal})}catch(i){l(i)||(this._error=i,a.getLogger(this).error("error","The popupTemplate could not be displayed for this feature.",{error:i,graphic:e,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===t&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:e}=this;e&&e.abort(),this._featureAbortController=null}_compileContentElement(e,t){return"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):"expression"===e.type?this._compileExpression(e,t):"relationship"===e.type?this._compileRelationship(e,t):"utility-network-associations"===e.type?this._compileUtilityNetworkAssociation(e,t):void 0}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(((e,t)=>this._compileContentElement(e,t))).filter(r):"string"==typeof e?this._compileText(new A({text:e}),0).text:e}_destroyContentViewModels(){this.removeHandles(te),this.removeHandles(ee),this.contentViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("contentViewModels",[])}_matchesFeature(e,t){const i=e?.graphic?.getObjectId(),o=t?.getObjectId();return null!=i&&null!=o&&i===o}_setRelatedFeaturesViewModels({relatedFeatureViewModels:e,relatedFeatures:t,map:i}){const{view:o,spatialReference:r,timeZone:s}=this;t?.filter(Boolean).forEach((t=>{e.some((e=>this._matchesFeature(e,t)))||e.add(new Y({abilities:{relationshipContent:!1},map:i,view:o,spatialReference:r,timeZone:s,graphic:t}))})),e.forEach((i=>{const o=t?.find((e=>this._matchesFeature(i,e)));o||e.remove(i)}))}_setExpressionContentVM(e,t){const i=this.formattedAttributes,{contentElement:o,contentElementViewModel:r}=e,s=o?.type;r&&s&&("fields"===s&&(this._createFieldsFormattedAttributes({contentElement:o,contentElementIndex:t,formattedAttributes:i}),r.set(this._createFieldsVMParams(o,t))),"media"===s&&(this._createMediaFormattedAttributes({contentElement:o,contentElementIndex:t,formattedAttributes:i}),r.set(this._createMediaVMParams(o,t))),"text"===s&&r.set(this._createTextVMParams(o)))}_compileRelationship(e,t){const{displayCount:i,orderByFields:o,relationshipId:r,title:s,description:n}=e,{_sourceLayer:a,graphic:l,map:c}=this;if(!L(a))return;const p=new V({displayCount:i,graphic:l,orderByFields:o,relationshipId:r,layer:a,map:c,...this._compileTitleAndDesc({title:s,description:n})});return this.contentViewModels[t]=p,this.addHandles(d((()=>p.relatedFeatures),"change",(()=>this._setRelatedFeaturesViewModels(p))),te),e}_matchesGlobalFeature(e,t){const i=e?.association.globalId,o=t?.association.globalId;return null!=i&&null!=o&&i===o}async _setUpUtilityNetworkAssociationsViewModels(e,t,i){const{view:o,spatialReference:r,timeZone:n}=this;e.forEach(((i,o)=>{const r=t.get(o);r?i.forEach((t=>{r.find((e=>this._matchesGlobalFeature(t,e)))||(i.remove(t),0===i.length&&e.delete(o))})):(i.removeAll(),e.delete(o))})),t.forEach(((t,a)=>{const l=e.get(a)||new s;t?.filter(Boolean).forEach((e=>{l.some((t=>this._matchesGlobalFeature(t,e)))||l.add({association:e.association,featureViewModel:new Y({abilities:{utilityNetworkAssociationsContent:!1},map:i,view:o,spatialReference:r,timeZone:n,graphic:e.feature}),terminalName:e.terminalName})})),e.set(a,l)}));const a=new AbortController;this._associationVMAbortController=a,await this._sortListObjectsByTitle(e,{signal:a.signal}),this._associationVMAbortController===a&&(this._associationVMAbortController=null)}async _sortListObjectsByTitle(e,t){for(const i of e.values()){const e=i.map((e=>u((()=>"ready"===e.featureViewModel.state),t?.signal)));await Promise.all(e),i.sort(this._compareByFeatureTitle)}}_compareByFeatureTitle(e,t){const i=w(e.featureViewModel),o=w(t.featureViewModel);return i.localeCompare(o,void 0,{numeric:!0})}_compileUtilityNetworkAssociation(e,t){const{displayCount:i,title:o,description:r,associationTypes:s}=e,{_sourceLayer:n,graphic:a,map:l}=this;if(!O(n))return;const c=new X({graphic:a,displayCount:i,associationTypes:s,layer:n,map:l,...this._compileTitleAndDesc({title:o,description:r})});return this.contentViewModels[t]=c,this.addHandles([p((()=>c.associationFeatures.values()),(()=>this._setUpUtilityNetworkAssociationsViewModels(c.associationViewModels,c.associationFeatures,c.map)))],ie),e}_compileExpression(e,t){const{expressionInfo:i}=e,{graphic:o,map:r,spatialReference:s,view:n,location:a}=this,l=new C({expressionInfo:i,graphic:o,interceptor:Y.interceptor,map:r,spatialReference:s,view:n,location:a});return this.contentViewModels[t]=l,this.addHandles(p((()=>l.contentElementViewModel),(()=>this._setExpressionContentVM(l,t)),h),ee),e}_compileAttachments(e,t){const{graphic:i}=this,{description:o,title:r}=e;return this.contentViewModels[t]=new M({graphic:i,...this._compileTitleAndDesc({title:r,description:o})}),e}_compileCustom(e,t){const{graphic:i}=this,{creator:o,destroyer:r}=e;return this.contentViewModels[t]=new v({graphic:i,creator:o,destroyer:r}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:i,_sourceLayer:o,graphic:r,formattedAttributes:s}=this,n=r?.attributes,a=this._expressionAttributes,l=s.global;return{title:Z({attributes:n,fieldInfoMap:i,globalAttributes:l,expressionAttributes:a,layer:o,text:e}),description:Z({attributes:n,fieldInfoMap:i,globalAttributes:l,expressionAttributes:a,layer:o,text:t})}}_createFieldsVMParams(e,t){const i=this._effectivePopupTemplate,o=this.formattedAttributes,r={...o?.global,...o?.content[t]},s=e?.fieldInfos||i?.fieldInfos,n=s?.filter((({fieldName:e})=>!!e&&(k(e)||N(e)||r.hasOwnProperty(e)))),a=i?.expressionInfos,{description:l,title:c}=e;return{attributes:r,expressionInfos:a,fieldInfos:n,...this._compileTitleAndDesc({title:c,description:l})}}_compileFields(e,t){const i=e.clone(),o=new F(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=o,i.fieldInfos=o.formattedFieldInfos.slice(),i}_createMediaVMParams(e,t){const{abilities:i,graphic:o,_fieldInfoMap:r,_effectivePopupTemplate:s,relatedInfos:n,_sourceLayer:a,_expressionAttributes:l}=this,c=this.formattedAttributes,p=o?.attributes??{},{description:d,mediaInfos:u,title:h}=e;return{abilities:{chartAnimation:i.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:p,isAggregate:o?.isAggregate,layer:a,fieldInfoMap:r,formattedAttributes:{...c?.global,...c?.content[t]},expressionAttributes:l,mediaInfos:u,popupTemplate:s,relatedInfos:n,...this._compileTitleAndDesc({title:h,description:d})}}_compileMedia(e,t){const i=e.clone(),o=new x(this._createMediaVMParams(e,t));return i.mediaInfos=o.formattedMediaInfos.slice(),this.contentViewModels[t]=o,i}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:i,_sourceLayer:o,_expressionAttributes:r}=this;if(e&&e.text){const s=t?.attributes??{},n=this.formattedAttributes?.global??{};e.text=Z({attributes:s,fieldInfoMap:i,globalAttributes:n,expressionAttributes:r,layer:o,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const i=e.clone();return this.contentViewModels[t]=new v(this._createTextVMParams(i)),i}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:i,timeZone:o}=this;if(!e)return;const{lastEditInfoEnabled:r}=e,s=t?.editFieldsInfo;return r&&s?U(s,i?.attributes,o,t):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:i,graphic:o,_expressionAttributes:r}=this,s=o?.attributes??{},n=this.formattedAttributes?.global??{};return Z({attributes:s,fieldInfoMap:t,globalAttributes:n,expressionAttributes:r,layer:i,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this;return t?B({type:"title",value:e?.title,event:{graphic:t}}):null}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this;return t?B({type:"content",value:e?.content,event:{graphic:t}}):null}async _queryFeature(e){const{_featureAbortController:t,_sourceLayer:i,graphic:o,_effectivePopupTemplate:r}=this,s=this.map,n=this.view,a=this.spatialReference,l=this.location;if(t!==this._featureAbortController||!o)return;await S({graphic:o,popupTemplate:r,layer:i,spatialReference:a},e);const{content:{value:p},title:{value:d}}=await c({content:this._getContent(),title:this._getTitle()}),{expressionAttributes:{value:u}}=await c({checkForRelatedFeatures:this._checkForRelatedFeatures(e),expressionAttributes:T({expressionInfos:r?.expressionInfos,spatialReference:a,graphic:o,map:s,interceptor:Y.interceptor,view:n,options:e,location:l})});t===this._featureAbortController&&o&&(this._expressionAttributes=u,this._graphicExpressionAttributes={...o.attributes,...u},this._set("formattedAttributes",this._createFormattedAttributes(p)),this._set("title",this._compileTitle(d)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(p)||null))}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){const{_effectivePopupTemplate:o,graphic:r,relatedInfos:s,_sourceLayer:n,_fieldInfoMap:a,_graphicExpressionAttributes:l,timeZone:c}=this;i.content[t]=H({fieldInfos:o?.fieldInfos,graphic:r,attributes:{...l,...e.attributes},layer:n,fieldInfoMap:a,relatedInfos:s,timeZone:c})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){if(e.fieldInfos){const{graphic:o,relatedInfos:r,_sourceLayer:s,_fieldInfoMap:n,_graphicExpressionAttributes:a,timeZone:l}=this;i.content[t]=H({fieldInfos:e.fieldInfos,graphic:o,attributes:{...a,...e.attributes},layer:s,fieldInfoMap:n,relatedInfos:r,timeZone:l})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:i,relatedInfos:o,_sourceLayer:r,_fieldInfoMap:s,_graphicExpressionAttributes:n,timeZone:a}=this,l=t?.fieldInfos,c={global:H({fieldInfos:l,graphic:i,attributes:n,layer:r,fieldInfoMap:s,relatedInfos:o,timeZone:a}),content:[]};return Array.isArray(e)&&e.forEach(((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:c}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:c})})),c}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:i}=this;return this._queryRelatedInfos(t,j(i),e)}async _queryRelatedInfos(e,t,i){const{relatedInfos:o,_sourceLayer:r}=this;o.clear();const s=null!=r?.associatedLayer?await(r?.associatedLayer.load(i)):r;if(!s||!e)return;const n=t.filter((e=>!!e.fieldName&&N(e.fieldName)));if(!n?.length)return;t.forEach((e=>this._configureRelatedInfo(e,s)));const a=await q({relatedInfos:o,layer:s},i);Object.keys(a).forEach((e=>{const t=o.get(e.toString()),i=a[e]?.value;t&&i&&(t.layerInfo=i.data)}));const l=await Q({graphic:e,relatedInfos:o,layer:s},i);Object.keys(l).forEach((e=>{z(l[e]?.value,o.get(e.toString()))}))}_configureRelatedInfo(e,t){const{relatedInfos:i}=this,o=J(e.fieldName||"");if(!o)return;const{layerId:r,fieldName:s}=o;if(!r)return;const n=i.get(r.toString())||K(r,t);n&&(W({relatedInfo:n,fieldName:s,fieldInfo:e}),this.relatedInfos.set(r,n))}};re.interceptor=new i(D,G),e([m()],re.prototype,"_error",void 0),e([m()],re.prototype,"_featureAbortController",void 0),e([m()],re.prototype,"_associationVMAbortController",void 0),e([m({readOnly:!0})],re.prototype,"_effectivePopupTemplate",null),e([m({readOnly:!0})],re.prototype,"_fieldInfoMap",null),e([m({readOnly:!0})],re.prototype,"_sourceLayer",null),e([m()],re.prototype,"abilities",void 0),e([_("abilities")],re.prototype,"castAbilities",null),e([m({readOnly:!0})],re.prototype,"content",void 0),e([m({readOnly:!0})],re.prototype,"contentViewModels",void 0),e([m()],re.prototype,"description",void 0),e([m({type:Boolean})],re.prototype,"defaultPopupTemplateEnabled",void 0),e([m({readOnly:!0})],re.prototype,"isTable",null),e([m({readOnly:!0})],re.prototype,"state",null),e([m({readOnly:!0})],re.prototype,"formattedAttributes",void 0),e([m({type:t,value:null})],re.prototype,"graphic",null),e([m({readOnly:!0})],re.prototype,"lastEditInfo",void 0),e([m({type:b})],re.prototype,"location",void 0),e([m({readOnly:!0})],re.prototype,"relatedInfos",void 0),e([m({type:g})],re.prototype,"spatialReference",null),e([m()],re.prototype,"timeZone",null),e([m({readOnly:!0})],re.prototype,"title",void 0),e([m()],re.prototype,"map",null),e([m({readOnly:!0})],re.prototype,"waitingForContent",null),e([m()],re.prototype,"view",void 0),re=Y=e([y("esri.widgets.Feature.FeatureViewModel")],re);const se=re;export{se as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as i}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import o from"../../core/Accessor.js";import{isSome as r}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import n from"../../core/Identifiable.js";import a from"../../core/Logger.js";import{isAbortError as l,eachAlways as c}from"../../core/promiseUtils.js";import{watch as p,on as d,whenOnce as u,initial as h}from"../../core/reactiveUtils.js";import{throttle as f}from"../../core/throttle.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import{cast as _}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import b from"../../geometry/Point.js";import g from"../../geometry/SpatialReference.js";import A from"../../popup/content/TextContent.js";import{getFeaturePopupTitle as w}from"../../support/popupUtils.js";import{system as I}from"../../time/timeZoneUtils.js";import M from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import v from"./FeatureContent/FeatureContentViewModel.js";import F from"./FeatureExpression/FeatureExpressionViewModel.js";import C from"./FeatureFields/FeatureFieldsViewModel.js";import x from"./FeatureMedia/FeatureMediaViewModel.js";import V from"./FeatureRelationship/FeatureRelationshipViewModel.js";import{createCompiledExpressions as T}from"./support/arcadeFeatureUtils.js";import{createFieldInfoMap as E,getAllFieldInfos as j,getSourceLayer as P,querySourceLayer as R,isRelatableFeatureSupportedLayer as L,isAssociatedFeatureSupportedLayer as O,substituteFieldsInLinksAndAttributes as Z,isExpressionField as k,isRelatedField as N,formatEditInfo as U,graphicCallback as B,queryUpdatedFeature as S,formatAttributes as H,preLayerQueryCallback as D,preRequestCallback as G}from"./support/featureUtils.js";import{queryLayerInfos as q,queryRelatedFeatures as Q,setRelatedFeatures as z,getRelatedFieldInfo as J,createRelatedInfo as K,updateRelatedInfo as W}from"./support/relatedFeatureUtils.js";import X from"../support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js";var Y;const $=1,ee="content-view-models",te="relationship-view-models",ie="association-view-models",oe={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0,utilityNetworkAssociationsContent:!0};let re=Y=class extends(n.IdentifiableMixin(o)){constructor(e){super(e),this._error=null,this._featureAbortController=null,this._associationVMAbortController=null,this._graphicChangedThrottled=f(this._graphicChanged,$,this),this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...oe},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.location=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&!!t.attachmentsContent||"custom"===e.type&&!!t.customContent||"fields"===e.type&&!!t.fieldsContent||"media"===e.type&&!!t.mediaContent||"text"===e.type&&!!t.textContent||"expression"===e.type&&!!t.expressionContent||"relationship"===e.type&&!!t.relationshipContent||"utility-network-associations"===e.type&&!!t.utilityNetworkAssociationsContent},this.addHandles(p((()=>[this.graphic,this._effectivePopupTemplate,this.abilities,this.timeZone]),(()=>this._graphicChangedThrottled()),h))}initialize(){this.addHandles(this._graphicChangedThrottled)}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return null!=this.graphic?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return E(j(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return P(this.graphic)}castAbilities(e){return{...oe,...e}}get isTable(){return this._sourceLayer?.isTable||!1}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(e){this._featureAbortController=new AbortController,this._set("graphic",e?.clone()??null)}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get timeZone(){return this.view?.timeZone??I}set timeZone(e){this._overrideIfSome("timeZone",e)}get map(){return this.view?.map||null}set map(e){this._override("map",e)}get waitingForContent(){return!(!this._featureAbortController&&!this._associationVMAbortController)}setActiveMedia(e,t){const i=this.contentViewModels[e];i instanceof x&&i.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof x&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof x&&t.previous()}async updateGeometry(){const{graphic:e,spatialReference:t,_sourceLayer:i}=this;await(i?.load());const o=i?.objectIdField;if(!o||!e||!i)return;const r=e?.attributes?.[o];if(null==r)return;const s=[r];if(!e.geometry){const o=await R({layer:i,graphic:e,outFields:[],objectIds:s,returnGeometry:!0,spatialReference:t}),r=o?.geometry;r&&(e.geometry=r)}}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async _graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:e}=this;if(!e)return;const t=new AbortController;this._featureAbortController=t;try{await this._queryFeature({signal:t.signal})}catch(i){l(i)||(this._error=i,a.getLogger(this).error("error","The popupTemplate could not be displayed for this feature.",{error:i,graphic:e,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===t&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:e}=this;e&&e.abort(),this._featureAbortController=null}_compileContentElement(e,t){return"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):"expression"===e.type?this._compileExpression(e,t):"relationship"===e.type?this._compileRelationship(e,t):"utility-network-associations"===e.type?this._compileUtilityNetworkAssociation(e,t):void 0}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(((e,t)=>this._compileContentElement(e,t))).filter(r):"string"==typeof e?this._compileText(new A({text:e}),0).text:e}_destroyContentViewModels(){this.removeHandles(te),this.removeHandles(ee),this.contentViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("contentViewModels",[])}_matchesFeature(e,t){const i=e?.graphic?.getObjectId(),o=t?.getObjectId();return null!=i&&null!=o&&i===o}_setRelatedFeaturesViewModels({relatedFeatureViewModels:e,relatedFeatures:t,map:i}){const{view:o,spatialReference:r,timeZone:s}=this;t?.filter(Boolean).forEach((t=>{e.some((e=>this._matchesFeature(e,t)))||e.add(new Y({abilities:{relationshipContent:!1},map:i,view:o,spatialReference:r,timeZone:s,graphic:t}))})),e.forEach((i=>{const o=t?.find((e=>this._matchesFeature(i,e)));o||e.remove(i)}))}_setExpressionContentVM(e,t){const i=this.formattedAttributes,{contentElement:o,contentElementViewModel:r}=e,s=o?.type;r&&s&&("fields"===s&&(this._createFieldsFormattedAttributes({contentElement:o,contentElementIndex:t,formattedAttributes:i}),r.set(this._createFieldsVMParams(o,t))),"media"===s&&(this._createMediaFormattedAttributes({contentElement:o,contentElementIndex:t,formattedAttributes:i}),r.set(this._createMediaVMParams(o,t))),"text"===s&&r.set(this._createTextVMParams(o)))}_compileRelationship(e,t){const{displayCount:i,orderByFields:o,relationshipId:r,title:s,description:n}=e,{_sourceLayer:a,graphic:l,map:c}=this;if(!L(a))return;const p=new V({displayCount:i,graphic:l,orderByFields:o,relationshipId:r,layer:a,map:c,...this._compileTitleAndDesc({title:s,description:n})});return this.contentViewModels[t]=p,this.addHandles(d((()=>p.relatedFeatures),"change",(()=>this._setRelatedFeaturesViewModels(p))),te),e}_matchesGlobalFeature(e,t){const i=e?.association.globalId,o=t?.association.globalId;return null!=i&&null!=o&&i===o}async _setUpUtilityNetworkAssociationsViewModels(e,t,i){const{view:o,spatialReference:r,timeZone:n}=this;e.forEach(((i,o)=>{const r=t.get(o);r?i.forEach((t=>{r.find((e=>this._matchesGlobalFeature(t,e)))||(i.remove(t),0===i.length&&e.delete(o))})):(i.removeAll(),e.delete(o))})),t.forEach(((t,a)=>{const l=e.get(a)||new s;t?.filter(Boolean).forEach((e=>{l.some((t=>this._matchesGlobalFeature(t,e)))||l.add({association:e.association,featureViewModel:new Y({abilities:{utilityNetworkAssociationsContent:!1},map:i,view:o,spatialReference:r,timeZone:n,graphic:e.feature}),terminalName:e.terminalName})})),e.set(a,l)}));const a=new AbortController;this._associationVMAbortController=a,await this._sortListObjectsByTitle(e,{signal:a.signal}),this._associationVMAbortController===a&&(this._associationVMAbortController=null)}async _sortListObjectsByTitle(e,t){for(const i of e.values()){const e=i.map((e=>u((()=>"ready"===e.featureViewModel.state),t?.signal)));await Promise.all(e),i.sort(this._compareByFeatureTitle)}}_compareByFeatureTitle(e,t){const i=w(e.featureViewModel),o=w(t.featureViewModel);return i.localeCompare(o,void 0,{numeric:!0})}_compileUtilityNetworkAssociation(e,t){const{displayCount:i,title:o,description:r,associationTypes:s}=e,{_sourceLayer:n,graphic:a,map:l}=this;if(!O(n))return;const c=new X({graphic:a,displayCount:i,associationTypes:s,layer:n,map:l,...this._compileTitleAndDesc({title:o,description:r})});return this.contentViewModels[t]=c,this.addHandles([p((()=>c.associationFeatures.values()),(()=>this._setUpUtilityNetworkAssociationsViewModels(c.associationViewModels,c.associationFeatures,c.map)))],ie),e}_compileExpression(e,t){const{expressionInfo:i}=e,{graphic:o,map:r,spatialReference:s,view:n,location:a}=this,l=new F({expressionInfo:i,graphic:o,interceptor:Y.interceptor,map:r,spatialReference:s,view:n,location:a});return this.contentViewModels[t]=l,this.addHandles(p((()=>l.contentElementViewModel),(()=>this._setExpressionContentVM(l,t)),h),ee),e}_compileAttachments(e,t){const{graphic:i}=this,{description:o,title:r,orderByFields:s}=e;return this.contentViewModels[t]=new M({graphic:i,orderByFields:s,...this._compileTitleAndDesc({title:r,description:o})}),e}_compileCustom(e,t){const{graphic:i}=this,{creator:o,destroyer:r}=e;return this.contentViewModels[t]=new v({graphic:i,creator:o,destroyer:r}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:i,_sourceLayer:o,graphic:r,formattedAttributes:s}=this,n=r?.attributes,a=this._expressionAttributes,l=s.global;return{title:Z({attributes:n,fieldInfoMap:i,globalAttributes:l,expressionAttributes:a,layer:o,text:e}),description:Z({attributes:n,fieldInfoMap:i,globalAttributes:l,expressionAttributes:a,layer:o,text:t})}}_createFieldsVMParams(e,t){const i=this._effectivePopupTemplate,o=this.formattedAttributes,r={...o?.global,...o?.content[t]},s=e?.fieldInfos||i?.fieldInfos,n=s?.filter((({fieldName:e})=>!!e&&(k(e)||N(e)||r.hasOwnProperty(e)))),a=i?.expressionInfos,{description:l,title:c}=e;return{attributes:r,expressionInfos:a,fieldInfos:n,...this._compileTitleAndDesc({title:c,description:l})}}_compileFields(e,t){const i=e.clone(),o=new C(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=o,i.fieldInfos=o.formattedFieldInfos.slice(),i}_createMediaVMParams(e,t){const{abilities:i,graphic:o,_fieldInfoMap:r,_effectivePopupTemplate:s,relatedInfos:n,_sourceLayer:a,_expressionAttributes:l}=this,c=this.formattedAttributes,p=o?.attributes??{},{description:d,mediaInfos:u,title:h}=e;return{abilities:{chartAnimation:i.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:p,isAggregate:o?.isAggregate,layer:a,fieldInfoMap:r,formattedAttributes:{...c?.global,...c?.content[t]},expressionAttributes:l,mediaInfos:u,popupTemplate:s,relatedInfos:n,...this._compileTitleAndDesc({title:h,description:d})}}_compileMedia(e,t){const i=e.clone(),o=new x(this._createMediaVMParams(e,t));return i.mediaInfos=o.formattedMediaInfos.slice(),this.contentViewModels[t]=o,i}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:i,_sourceLayer:o,_expressionAttributes:r}=this;if(e&&e.text){const s=t?.attributes??{},n=this.formattedAttributes?.global??{};e.text=Z({attributes:s,fieldInfoMap:i,globalAttributes:n,expressionAttributes:r,layer:o,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const i=e.clone();return this.contentViewModels[t]=new v(this._createTextVMParams(i)),i}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:i,timeZone:o}=this;if(!e)return;const{lastEditInfoEnabled:r}=e,s=t?.editFieldsInfo;return r&&s?U(s,i?.attributes,o,t):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:i,graphic:o,_expressionAttributes:r}=this,s=o?.attributes??{},n=this.formattedAttributes?.global??{};return Z({attributes:s,fieldInfoMap:t,globalAttributes:n,expressionAttributes:r,layer:i,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this;return t?B({type:"title",value:e?.title,event:{graphic:t}}):null}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this;return t?B({type:"content",value:e?.content,event:{graphic:t}}):null}async _queryFeature(e){const{_featureAbortController:t,_sourceLayer:i,graphic:o,_effectivePopupTemplate:r}=this,s=this.map,n=this.view,a=this.spatialReference,l=this.location;if(t!==this._featureAbortController||!o)return;await S({graphic:o,popupTemplate:r,layer:i,spatialReference:a},e);const{content:{value:p},title:{value:d}}=await c({content:this._getContent(),title:this._getTitle()}),{expressionAttributes:{value:u}}=await c({checkForRelatedFeatures:this._checkForRelatedFeatures(e),expressionAttributes:T({expressionInfos:r?.expressionInfos,spatialReference:a,graphic:o,map:s,interceptor:Y.interceptor,view:n,options:e,location:l})});t===this._featureAbortController&&o&&(this._expressionAttributes=u,this._graphicExpressionAttributes={...o.attributes,...u},this._set("formattedAttributes",this._createFormattedAttributes(p)),this._set("title",this._compileTitle(d)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(p)||null))}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){const{_effectivePopupTemplate:o,graphic:r,relatedInfos:s,_sourceLayer:n,_fieldInfoMap:a,_graphicExpressionAttributes:l,timeZone:c}=this;i.content[t]=H({fieldInfos:o?.fieldInfos,graphic:r,attributes:{...l,...e.attributes},layer:n,fieldInfoMap:a,relatedInfos:s,timeZone:c})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){if(e.fieldInfos){const{graphic:o,relatedInfos:r,_sourceLayer:s,_fieldInfoMap:n,_graphicExpressionAttributes:a,timeZone:l}=this;i.content[t]=H({fieldInfos:e.fieldInfos,graphic:o,attributes:{...a,...e.attributes},layer:s,fieldInfoMap:n,relatedInfos:r,timeZone:l})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:i,relatedInfos:o,_sourceLayer:r,_fieldInfoMap:s,_graphicExpressionAttributes:n,timeZone:a}=this,l=t?.fieldInfos,c={global:H({fieldInfos:l,graphic:i,attributes:n,layer:r,fieldInfoMap:s,relatedInfos:o,timeZone:a}),content:[]};return Array.isArray(e)&&e.forEach(((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:c}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:c})})),c}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:i}=this;return this._queryRelatedInfos(t,j(i),e)}async _queryRelatedInfos(e,t,i){const{relatedInfos:o,_sourceLayer:r}=this;o.clear();const s=null!=r?.associatedLayer?await(r?.associatedLayer.load(i)):r;if(!s||!e)return;const n=t.filter((e=>!!e.fieldName&&N(e.fieldName)));if(!n?.length)return;t.forEach((e=>this._configureRelatedInfo(e,s)));const a=await q({relatedInfos:o,layer:s},i);Object.keys(a).forEach((e=>{const t=o.get(e.toString()),i=a[e]?.value;t&&i&&(t.layerInfo=i.data)}));const l=await Q({graphic:e,relatedInfos:o,layer:s},i);Object.keys(l).forEach((e=>{z(l[e]?.value,o.get(e.toString()))}))}_configureRelatedInfo(e,t){const{relatedInfos:i}=this,o=J(e.fieldName||"");if(!o)return;const{layerId:r,fieldName:s}=o;if(!r)return;const n=i.get(r.toString())||K(r,t);n&&(W({relatedInfo:n,fieldName:s,fieldInfo:e}),this.relatedInfos.set(r,n))}};re.interceptor=new i(D,G),e([m()],re.prototype,"_error",void 0),e([m()],re.prototype,"_featureAbortController",void 0),e([m()],re.prototype,"_associationVMAbortController",void 0),e([m({readOnly:!0})],re.prototype,"_effectivePopupTemplate",null),e([m({readOnly:!0})],re.prototype,"_fieldInfoMap",null),e([m({readOnly:!0})],re.prototype,"_sourceLayer",null),e([m()],re.prototype,"abilities",void 0),e([_("abilities")],re.prototype,"castAbilities",null),e([m({readOnly:!0})],re.prototype,"content",void 0),e([m({readOnly:!0})],re.prototype,"contentViewModels",void 0),e([m()],re.prototype,"description",void 0),e([m({type:Boolean})],re.prototype,"defaultPopupTemplateEnabled",void 0),e([m({readOnly:!0})],re.prototype,"isTable",null),e([m({readOnly:!0})],re.prototype,"state",null),e([m({readOnly:!0})],re.prototype,"formattedAttributes",void 0),e([m({type:t,value:null})],re.prototype,"graphic",null),e([m({readOnly:!0})],re.prototype,"lastEditInfo",void 0),e([m({type:b})],re.prototype,"location",void 0),e([m({readOnly:!0})],re.prototype,"relatedInfos",void 0),e([m({type:g})],re.prototype,"spatialReference",null),e([m()],re.prototype,"timeZone",null),e([m({readOnly:!0})],re.prototype,"title",void 0),e([m()],re.prototype,"map",null),e([m({readOnly:!0})],re.prototype,"waitingForContent",null),e([m()],re.prototype,"view",void 0),re=Y=e([y("esri.widgets.Feature.FeatureViewModel")],re);const se=re;export{se as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{neverReached as n}from"../../core/compilerUtils.js";import s from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import r from"../../core/Promise.js";import{watch as a,whenOnce as l,on as u}from"../../core/reactiveUtils.js";import{templateHasKey as p}from"../../core/string.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../core/support/UpdatingHandles.js";import f from"../../form/FormTemplate.js";import{isUtilityNetworkAssociationsElement as m,isGroupElement as g,isFieldElement as y,isRelationshipElement as _,isTextElement as v}from"../../form/support/formUtils.js";import I from"../../layers/support/ContingentValue.js";import{isEditableLayer as x}from"../../layers/support/editableLayers.js";import E from"../../layers/support/LayerContingentValuesCache.js";import{utc as C,unknown as F,system as b}from"../../time/timeZoneUtils.js";import{flattenAssociationInputs as V,flattenFieldInputs as w,isGroupInput as A,flattenRelationshipInputs as j,parseFormTemplateString as T,isRelationshipInput as M,isFieldInput as N,isTextElementInput as k,getNormalizedFeatureTypeInfo as L,valueIsValidContingentValue as R}from"./featureFormUtils.js";import S from"./FieldInput.js";import{FormExpressionsManager as H}from"./FormExpressionsManager.js";import U from"./GroupInput.js";import Z from"./RelationshipInput.js";import P from"./TextElementInput.js";import O from"./UtilityNetworkAssociationInput.js";import{createFormExpressionArcadeExecutor as W}from"../support/forms/expressions/FormExpressionArcadeExecutor.js";const G=new t({attributes:{}}),$={field:["editableExpression","requiredExpression","valueExpression","visibilityExpression"],group:["visibilityExpression"],relationship:["editableExpression","visibilityExpression"],text:["visibilityExpression"],utilityNetworkAssociations:["editableExpression","visibilityExpression"]},D="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",z="#JSAPI_CONTINGENT_VALUE_ANY_HASH",J="#JSAPI_CONTINGENT_VALUE_NULL_HASH",B="esri.widgets.FeatureForm.FeatureFormViewModel",K=()=>i.getLogger(B);let q=class extends(r.EsriPromiseMixin(s.EventedAccessor)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=G.clone(),this._initialFeature=G.clone(),this._timeZone=null,this._updatingHandles=new h,this.activeAssociation=null,this.arcadeEditType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.highlightHelper=null,this.inputs=[],this.map=null,this.callbacks=null,this.strict=!1,this.hasPendingSubtypeChoice=!1}initialize(){const e=a((()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this.feature,this.timeZone,this.arcadeEditType]),(async([e,t])=>{null!=e&&(t?this._updatingHandles.addPromise(this._updateInputs()):e.load().catch((()=>{})))}),{equals:([e,t,n,s,i,o],[r,a,l,u,p,c])=>e===r&&t===a&&n===l&&s===u&&i===p&&o===c,initial:!0}),t=a((()=>this._arcadeContextInfo),(e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e,this._updatingHandles.addPromise(this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))))})),n=a((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(E.createLoadedLayerContingentValuesCache(t).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0});this.addHandles([e,t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this.highlightHelper?.removeAll(),this._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map((e=>[e.name,e])))}get activeAssociationInput(){return this.allAssociationInputs.find((e=>e.uid===this.associationId))}get activeRelationshipInput(){return this.allRelationshipInputs.find((e=>e.relationshipId===this.relationshipId))}get _arcadeContextInfo(){const{_initialFeature:e,arcadeEditType:t,layer:n,map:s,spatialReference:i,timeZone:o}=this;return{layer:x(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i,timeZone:o}}get associationId(){return this._get("associationId")}set associationId(e){null==e&&this.activeAssociationInput?.viewModel&&(this.activeAssociationInput.viewModel.activeAssociationType=null),this._set("associationId",e)}get associatedLayer(){return this.activeAssociationInput?.associatedLayer}set associatedLayer(e){this.activeAssociationInput&&(this.activeAssociationInput.associatedLayer=e)}get allAssociationInputs(){return V(this.inputs)}get allFieldInputs(){return w(this.inputs)}get allGroupInputs(){return this.inputs.filter(A)}get allRelationshipInputs(){return j(this.inputs)}get _layerFieldsByName(){return new Map(this.layer?.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){const t=this._get("feature");this._featureClone=e?e.clone():G.clone(),this._initialFeature=this._featureClone.clone(),this._expressionsManager&&(this._expressionsManager.feature=this._featureClone),e?(this._resetFieldInputValues(this._featureClone),this.allRelationshipInputs.forEach((t=>t.feature=e))):(this.inputs.forEach((e=>e.destroy())),this.inputs.length=0),t!==e&&(this.hasPendingSubtypeChoice=!1),this.contingencyConstraintViolations.clear(),this._set("feature",e)}get fieldsWithContingentValues(){if(null==this._contingentValuesCache)return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){void 0===e?this._clearOverride("formTemplate"):this._override("formTemplate",e)}get formDescription(){const{formTemplate:e,layer:t}=this;return e?.description&&t?T({label:e.description,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formTitle(){const{formTemplate:e,layer:t}=this;return e?.title&&t?T({label:e.title,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formHeaderVisible(){const{activeRelationshipInput:e,activeAssociationInput:t,formDescription:n,formTitle:s}=this;return!(e||t||!n&&!s)}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){this._override("layer",e)}get relationshipId(){return this._get("relationshipId")}set relationshipId(e){const t=this.allRelationshipInputs;if(null!=e&&e===this.relationshipId||t.forEach((e=>e.showAllEnabled=!1)),null!=e){const n=t.find((t=>t.relationshipId===e));n&&(n.showAllEnabled=!0)}this._set("relationshipId",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.layer?.loaded?"ready":"disabled"}get submittable(){return!!this.valid||this.allFieldInputs.filter((e=>!e.valid)).every((({submittable:e})=>e))}get timeZone(){const{layer:e}=this;if(e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone)return C;const t=e&&"preferredTimeZone"in e&&e.preferredTimeZone;return this._timeZone===F?t||C:this._timeZone||b}set timeZone(e){this._timeZone=e}get updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every((({valid:e})=>e))}findField(e){return this.allFieldInputs.find((t=>t.name===e))}getFieldValueOptionsForField(e,t){const n=this.findField(e);if(!n)return[[],[],[]];const s="coded-value"===n.domain?.type?n.domain.codedValues.map((({name:e,code:t})=>({name:e,value:t}))):[],i=null==n.value||s.some((e=>e.value===n.value))?[]:[{name:`${n.value}`,value:n.value}],o=this.fieldsWithContingentValues.has(e)?this._getContingentValueOptionsForField(e,t):[];if(o.length>0){const e=new Set(o.map((e=>e.value)));return[o,s.filter((t=>!e.has(t.value))),i]}return[s,[],i]}getValue(e){const t=this.layer?.getField(e);if(null!=t)return this._featureClone.getAttribute(t.name)??null}setValue(e,t){const{_featureClone:n,strict:s}=this,i=this.findField(e);t=""===t?null:t,i&&n.getAttribute(e)!==t&&(i.value=t,s&&!i.valid||(this._afterValueChange(i),null!=this._expressionsManager&&this._updatingHandles.addPromise(this._expressionsManager.evaluateInvalidated([i.name]).finally((()=>this._afterExpressionsEvaluated())))))}getValues(){return{...this._featureClone.attributes}}overrideInitialFeature(e){this._initialFeature=e}submit(){const e=this.allFieldInputs,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),n=e.filter((e=>!e.valid)).map((({name:e})=>e)),s=this.getValues();if(this.validateContingencyConstraints(s,{includeIncompleteViolations:!0}).length>0)for(const[i,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(i),n.push(i));this.emit("submit",{valid:[...t],invalid:n,values:s})}validateContingencyConstraints(e,t){const{_contingentValuesCache:n}=this,s=new Map;if(this.contingencyConstraintViolations=s,null==n)return[];const{invalid:i,incomplete:o}=n.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?o:[]];for(const a of r)for(const e of a.fieldGroup.fields)s.set(e,a);return r}notifyFeatureGeometryChanged(){const{_expressionsManager:e,feature:t,_featureClone:n}=this;t&&(n.geometry=t.geometry,null!=e&&this._updatingHandles.addPromise(e.evaluateInvalidatedByGeometry().finally((()=>this._afterExpressionsEvaluated()))))}applySubtypeDefaults(e){const{defaultValues:t}=e,{allFieldInputs:n}=this;for(const{name:s}of n){const e=t[s];null!=e&&this.setValue(s,e)}}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}async _updateInputs(){this._stopExpressions();const{_featureClone:e,_initialFeature:t,arcadeEditType:n,formTemplate:s,inputs:i,layer:o,timeZone:r}=this;if(!o)return;const a={arcadeEditType:n,feature:e,initialFeature:t,layer:o,timeZone:r},l=i.slice(),u=s?.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(l,s.elements,a):this._updateInputsUsingLayerFields(l,o?.fields,a);this.inputs=u,await this._startExpressions()}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(A(r)){s.set(r.element,r);for(const e of r.inputs)e.element&&s.set(e.element,e)}else r.element&&s.set(r.element,r);const i=new Map,o=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter(Y),sharedInitializationProperties:n,group:null,newExpressionExecutorPromises:i});for(const[r,a]of s.entries())s.delete(r),a.destroy();return await Promise.all(Array.from(i.values())),o}async _updateInputsUsingFormElementsRecursive(e){const{existingInputsByElement:t,updatedElements:n,sharedInitializationProperties:s,group:i,newExpressionExecutorPromises:o}=e,r=[];for(const a of n){const e=t.has(a),n=e?t.get(a):this._makeInputFromElement(a,s,i);if(n){if(r.push(n),await l((()=>!n.updating)),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),A(n)){const{feature:e,timeZone:t}=s;n.set({feature:e,timeZone:t})}else if(M(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else m(n)?(n.set(s),n.set({map:this.map})):n.set(s);if(g(a)){const e=a.elements.filter((e=>Y(e)));n.inputs=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return K().warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const o of e)if(A(o)){for(const e of o.inputs)e.destroy();o.inputs.length=0,o.destroy()}else M(o)?o.destroy():N(o)&&(null!==o.element?o.destroy():s.set(o.field,o));const i=[];for(const o of t){const e=n.feature?.getAttribute(o.name)??null,t=s.get(o)??new S({field:o,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden});i.push(t.set({...n,value:e})),s.delete(o)}for(const[o,r]of s.entries())s.delete(o),r.destroy();return i}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)}_makeInputFromElement(e,t,s){return g(e)?Q(e,t):y(e)?this._makeFieldInputFromElement(e,t,s):_(e)?this._makeRelationshipInputFromElement(e,t,s):m(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):v(e)?X(e,t):m(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):n()}_makeFieldInputFromElement(e,t,n){const{arcadeEditType:s,feature:i,initialFeature:o,layer:r,timeZone:a}=t,{fieldName:l}=e,u=l&&this._layerFieldsByName.get(l);return u?new S({arcadeEditType:s,element:e,field:u,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden,timeZone:a}):null}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t,a=new Z({element:e,feature:i,group:n,layer:o,map:s,timeZone:r});return a.addHandles(u((()=>a.relatedLayer),"edits",(()=>this._expressionsManager?.evaluateAsyncExpressions()))),a}_makeUtilityNetworkAssociationInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t;return new O({element:e,feature:i,group:n,layer:o,map:s,timeZone:r})}_assignExpressionExecutors(e,t,n){const s=$[t.type],i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const r=t[o];if(null!=r&&""!==r){const t=this._expressionInfosLookup.get(r)?.expression??r;i.push(this._getOrCreateExecutorForExpression(t,n).then((t=>{e[s]=this._useExecutor(t)})))}}return k(e)&&i.push(...this._assignTextElementExpressionExecutors(e,n)),i}_assignTextElementExpressionExecutors(e,t){const{_expressionInfosLookup:n}=this,s=[];for(const o of e.expressionsUsed){const r=n.get(o);null!=r?s.push(this._getOrCreateExecutorForExpression(r.expression,t).then((t=>e.setExpressionExecutor(o,this._useExecutor(t))))):i.getLogger(this).error("feature-form:expression-not-found",`Could not find expressionInfo object with name '${o}'`)}for(const i of e.fieldsUsed){const n=`return $feature['${i}'];`;s.push(this._getOrCreateExecutorForExpression(n,t).then((t=>e.setFieldExecutor(i,this._useExecutor(t)))))}return s}async _getOrCreateExecutorForExpression(e,t){const{_expressionExecutorLookup:n}=this;if(n.has(e))return n.get(e);if(t.has(e))return t.get(e);const s=W(e,this.layer);t.set(e,s);const i=await s;return n.set(e,i),i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s,formTemplate:i}=this;this._expressionsManager=new H({executors:e,feature:n,arcadeContextInfo:t,fieldInputs:s,preserveFieldValuesWhenHidden:!0===i?.preserveFieldValuesWhenHidden})}async _startExpressions(){if(0===this._expressionExecutorsInUse.size)return;const e=Array.from(this._expressionExecutorsInUse);this._createExpressionsManager(e),await this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))}_stopExpressions(){this._expressionsManager=o(this._expressionsManager),this._expressionExecutorsInUse.clear()}_useExecutor(e){return this._expressionExecutorsInUse.add(e),e}_afterValueChange(e){const{name:t,value:n}=e,{_featureClone:s,formTemplate:i,layer:o}=this;if(!o)return;const r=s.getAttribute(t);s.setAttribute(t,n);const{typeFieldName:a,types:l}=L(o);if((e.isSubtypeField||t===a)&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);this.feature&&(this.feature.sourceLayer=e),s.sourceLayer=e}const e=new Set;for(const t of l)if(t.domains&&"object"==typeof t.domains)for(const n of Object.keys(t.domains))e.add(n);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}this.notifyChange("joinedContingentValues")}if(null!=i){const{description:e,title:n}=i;n&&p(n,t)&&this.notifyChange("formTitle"),e&&p(e,t)&&this.notifyChange("formDescription")}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allFieldInputs)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_joinContingentValues(){const e=this._contingentValuesCache;if(null==e)return[];const{typeFieldName:t}=L(this.layer),n=t?this.getValue(t):null,s=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,o=[];for(const s of e)s.isRetired||null!=s.subtype&&s.subtype.code!==n||o.push({values:s.values});o.length>0&&s.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(s);return[...i.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,n=[],s=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const i=t.get(e),o=l,r=[i.name,o.name].sort().join("|");if(s.has(r))continue;n.push([i,o]),s.add(r),t.set(e,o)}else t.set(e,l);const i=new Set(n.flat()),o=new Set(e);for(const l of i)o.delete(l);const r=new Map,a=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),a.set(l,e)}for(const[l,u]of n){const e=a.get(l),t=a.get(u);if(e===t)continue;const n=r.get(e),s=r.get(t);for(const i of s)n.add(i),a.set(i,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let s=t.shift(),i=this._generateJoinKey(n.fields,s.fields),o=new Set([...n.fields,...s.fields]),r=new Map;for(const l of n.contingencies){const[e]=this._hashContingency(l,i.codedValueFields,!0);r.has(e)?r.get(e)?.push(l):r.set(e,[l])}for(;t.length>0;){const e=new Map,n=t.shift(),a=this._generateJoinKey(o,n.fields);for(const t of s.contingencies){const[n,s]=this._hashContingency(t,i.codedValueFields),o=s?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(z)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(z),i.codedValueFields)),null!=o)for(const r of o){const n=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,i.rangeFields):this._joinContingencies(r,t);if(null==n)break;const[s]=this._hashContingency(n,a.codedValueFields,!0);e.has(s)?e.get(s)?.push(n):e.set(s,[n])}}r=e,s=n,i=a,o=new Set([...o,...s.fields])}const a=[];for(const l of s.contingencies){const[e,t]=this._hashContingency(l,i.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(z)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(z),i.codedValueFields)),null!=n)for(const s of n){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(s,l,i.rangeFields):this._joinContingencies(s,l);null!=e&&a.push(e)}}return a}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[s,i]of Object.entries(n.values))"any"===i.objectType&&null!=e.values[s]&&(n.values[s]=e.values[s]);return n}_joinContingenciesWithRangeDomains(e,t,n){const s=this._joinContingencies(e,t);for(const i of n){const n=e.values[i],o=t.values[i],{leftIsNull:r,rightIsNull:a,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:c,leftIsRange:d,rightIsRange:h}=this._compareObjectTypes(n.objectType,o.objectType);if(l||c)continue;if(r&&p||a&&u){s.values[i]=new I({objectType:"null"});continue}if(r&&h||a&&d)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const f=Math.max(n.minValue,o.minValue),m=Math.min(n.maxValue,o.maxValue);if(f>m)return null;s.values[i]=new I({objectType:"range",minValue:f,maxValue:m})}return s}_findMatchingContingenciesContainingAny(e,t,n){return t.filter((t=>n.every((n=>{const s=t.values[n],i=e.values[n];return"any"===s.objectType||"any"===i.objectType||s.codedValue?.code===i.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const n=RegExp(`${t}$`),s=[];for(const[i,o]of e){if(i===z)break;n.test(i)&&s.push(...o)}return s}_generateJoinKey(e,t){const n=Array.isArray(e)?new Set(e):e,s=Array.isArray(t)?new Set(t):t,i=n.size<s.size?n:s,o=i===n?s:n,{feature:r}=this,a=new Set,l=new Set;for(const u of i)if(o.has(u)){const e=this.layer?.getFieldDomain(u,{feature:r??void 0,excludeImpliedDomains:!0});if(null==e)continue;switch(e.type){case"coded-value":a.add(u);break;case"range":l.add(u)}}return{codedValueFields:[...a],rangeFields:[...l]}}_contingencyIsValid(e,t){const n={};for(const{name:s,value:i}of this.allFieldInputs)this.fieldsWithContingentValues.has(s)&&null!=i&&s!==e&&(n[s]=i);return Object.entries(n).every((([e,n])=>!t.values.hasOwnProperty(e)||R(n,t.values[e])))}_getContingentValueOptionsForField(e,t){const n=this.joinedContingentValues.slice(),s=new Map,i={code:"",name:t??"No value"};for(const o of n){const t=o.values[e];if("code"===t?.objectType||"null"===t?.objectType){const{code:n,name:r}=t.codedValue&&"null"!==t.objectType?t.codedValue:i;!s.has(n)&&this._contingencyIsValid(e,o)&&s.set(n,{name:r,value:n})}}return[...s.values()]}_hashContingency(e,t,n=!1){if(t.length<1)return[D,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[z,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${J}`):s.push(`${o}:${t.codedValue?.code}`)}return[s.sort().join("&"),i]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}get test(){return{featureClone:this._featureClone}}};function Y(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||"text"===e.type||"utilityNetworkAssociations"===e.type||(K().warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}function Q(e,t){const{feature:n,layer:s}=t;return new U({element:e,inputs:[],feature:n,layer:s})}function X(e,t,n=null){const{feature:s,layer:i,timeZone:o}=t;return new P({element:e,feature:s,group:n,layer:i,timeZone:o})}e([c()],q.prototype,"_expressionInfosLookup",null),e([c()],q.prototype,"_featureClone",void 0),e([c()],q.prototype,"_timeZone",void 0),e([c()],q.prototype,"activeAssociation",void 0),e([c()],q.prototype,"activeAssociationInput",null),e([c()],q.prototype,"activeRelationshipInput",null),e([c()],q.prototype,"_arcadeContextInfo",null),e([c()],q.prototype,"associationId",null),e([c()],q.prototype,"associatedLayer",null),e([c()],q.prototype,"allAssociationInputs",null),e([c()],q.prototype,"allFieldInputs",null),e([c()],q.prototype,"allGroupInputs",null),e([c()],q.prototype,"allRelationshipInputs",null),e([c()],q.prototype,"_layerFieldsByName",null),e([c()],q.prototype,"arcadeEditType",void 0),e([c()],q.prototype,"contingencyConstraintViolations",void 0),e([c()],q.prototype,"disabled",void 0),e([c()],q.prototype,"feature",null),e([c()],q.prototype,"fieldsWithContingentValues",null),e([c({type:f})],q.prototype,"formTemplate",null),e([c()],q.prototype,"formDescription",null),e([c()],q.prototype,"formTitle",null),e([c()],q.prototype,"formHeaderVisible",null),e([c()],q.prototype,"highlightHelper",void 0),e([c()],q.prototype,"inputs",void 0),e([c()],q.prototype,"joinedContingentValues",null),e([c()],q.prototype,"layer",null),e([c()],q.prototype,"map",void 0),e([c()],q.prototype,"callbacks",void 0),e([c()],q.prototype,"relationshipId",null),e([c()],q.prototype,"spatialReference",null),e([c()],q.prototype,"state",null),e([c()],q.prototype,"strict",void 0),e([c()],q.prototype,"submittable",null),e([c()],q.prototype,"timeZone",null),e([c()],q.prototype,"updating",null),e([c()],q.prototype,"valid",null),e([c()],q.prototype,"hasPendingSubtypeChoice",void 0),e([c()],q.prototype,"getValues",null),e([c()],q.prototype,"submit",null),e([c()],q.prototype,"test",null),q=e([d(B)],q);const ee=q;export{ee as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{neverReached as n}from"../../core/compilerUtils.js";import s from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import r from"../../core/Promise.js";import{watch as a,whenOnce as l,on as u}from"../../core/reactiveUtils.js";import{templateHasKey as p}from"../../core/string.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../core/support/UpdatingHandles.js";import f from"../../form/FormTemplate.js";import{isUtilityNetworkAssociationsElement as m,isGroupElement as g,isFieldElement as y,isRelationshipElement as _,isTextElement as v}from"../../form/support/formUtils.js";import I from"../../layers/support/ContingentValue.js";import{isEditableLayer as x}from"../../layers/support/editableLayers.js";import E from"../../layers/support/LayerContingentValuesCache.js";import{utc as C,unknown as F,system as b}from"../../time/timeZoneUtils.js";import{flattenAssociationInputs as V,flattenFieldInputs as w,isGroupInput as A,flattenRelationshipInputs as j,parseFormTemplateString as T,isRelationshipInput as M,isFieldInput as N,isTextElementInput as k,getNormalizedFeatureTypeInfo as L,valueIsValidContingentValue as R}from"./featureFormUtils.js";import S from"./FieldInput.js";import{FormExpressionsManager as H}from"./FormExpressionsManager.js";import U from"./GroupInput.js";import Z from"./RelationshipInput.js";import P from"./TextElementInput.js";import O from"./UtilityNetworkAssociationInput.js";import{createFormExpressionArcadeExecutor as W}from"../support/forms/expressions/FormExpressionArcadeExecutor.js";const G=new t({attributes:{}}),$={field:["editableExpression","requiredExpression","valueExpression","visibilityExpression"],group:["visibilityExpression"],relationship:["editableExpression","visibilityExpression"],text:["visibilityExpression"],utilityNetworkAssociations:["editableExpression","visibilityExpression"]},D="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",z="#JSAPI_CONTINGENT_VALUE_ANY_HASH",J="#JSAPI_CONTINGENT_VALUE_NULL_HASH",B="esri.widgets.FeatureForm.FeatureFormViewModel",K=()=>i.getLogger(B);let q=class extends(r.EsriPromiseMixin(s.EventedAccessor)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=G.clone(),this._initialFeature=G.clone(),this._timeZone=null,this._updatingHandles=new h,this.activeAssociation=null,this.arcadeEditType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.highlightHelper=null,this.inputs=[],this.map=null,this.callbacks=null,this.strict=!1,this.pendingSubtypeChoice=null}initialize(){const e=a((()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this.feature,this.timeZone,this.arcadeEditType]),(async([e,t])=>{null!=e&&(t?this._updatingHandles.addPromise(this._updateInputs()):e.load().catch((()=>{})))}),{equals:([e,t,n,s,i,o],[r,a,l,u,p,c])=>e===r&&t===a&&n===l&&s===u&&i===p&&o===c,initial:!0}),t=a((()=>this._arcadeContextInfo),(e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e,this._updatingHandles.addPromise(this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))))})),n=a((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(E.createLoadedLayerContingentValuesCache(t).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0});this.addHandles([e,t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this.highlightHelper?.removeAll(),this._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map((e=>[e.name,e])))}get activeAssociationInput(){return this.allAssociationInputs.find((e=>e.uid===this.associationId))}get activeRelationshipInput(){return this.allRelationshipInputs.find((e=>e.relationshipId===this.relationshipId))}get _arcadeContextInfo(){const{_initialFeature:e,arcadeEditType:t,layer:n,map:s,spatialReference:i,timeZone:o}=this;return{layer:x(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i,timeZone:o}}get associationId(){return this._get("associationId")}set associationId(e){null==e&&this.activeAssociationInput?.viewModel&&(this.activeAssociationInput.viewModel.activeAssociationType=null),this._set("associationId",e)}get associatedLayer(){return this.activeAssociationInput?.associatedLayer}set associatedLayer(e){this.activeAssociationInput&&(this.activeAssociationInput.associatedLayer=e)}get allAssociationInputs(){return V(this.inputs)}get allFieldInputs(){return w(this.inputs)}get allGroupInputs(){return this.inputs.filter(A)}get allRelationshipInputs(){return j(this.inputs)}get _layerFieldsByName(){return new Map(this.layer?.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){const t=this._get("feature");this._featureClone=e?e.clone():G.clone(),this._initialFeature=this._featureClone.clone(),this._expressionsManager&&(this._expressionsManager.feature=this._featureClone),e?(this._resetFieldInputValues(this._featureClone),this.allRelationshipInputs.forEach((t=>t.feature=e))):(this.inputs.forEach((e=>e.destroy())),this.inputs.length=0),t!==e&&(this.pendingSubtypeChoice=null),this.contingencyConstraintViolations.clear(),this._set("feature",e)}get fieldsWithContingentValues(){if(null==this._contingentValuesCache)return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){void 0===e?this._clearOverride("formTemplate"):this._override("formTemplate",e)}get formDescription(){const{formTemplate:e,layer:t}=this;return e?.description&&t?T({label:e.description,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formTitle(){const{formTemplate:e,layer:t}=this;return e?.title&&t?T({label:e.title,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formHeaderVisible(){const{activeRelationshipInput:e,activeAssociationInput:t,formDescription:n,formTitle:s}=this;return!(e||t||!n&&!s)}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){this._override("layer",e)}get relationshipId(){return this._get("relationshipId")}set relationshipId(e){const t=this.allRelationshipInputs;if(null!=e&&e===this.relationshipId||t.forEach((e=>e.showAllEnabled=!1)),null!=e){const n=t.find((t=>t.relationshipId===e));n&&(n.showAllEnabled=!0)}this._set("relationshipId",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.layer?.loaded?"ready":"disabled"}get submittable(){return!!this.valid||this.allFieldInputs.filter((e=>!e.valid)).every((({submittable:e})=>e))}get timeZone(){const{layer:e}=this;if(e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone)return C;const t=e&&"preferredTimeZone"in e&&e.preferredTimeZone;return this._timeZone===F?t||C:this._timeZone||b}set timeZone(e){this._timeZone=e}get updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every((({valid:e})=>e))}findField(e){return this.allFieldInputs.find((t=>t.name===e))}getFieldValueOptionsForField(e,t){const n=this.findField(e);if(!n)return[[],[],[]];const s="coded-value"===n.domain?.type?n.domain.codedValues.map((({name:e,code:t})=>({name:e,value:t}))):[],i=null==n.value||s.some((e=>e.value===n.value))?[]:[{name:`${n.value}`,value:n.value}],o=this.fieldsWithContingentValues.has(e)?this._getContingentValueOptionsForField(e,t):[];if(o.length>0){const e=new Set(o.map((e=>e.value)));return[o,s.filter((t=>!e.has(t.value))),i]}return[s,[],i]}getValue(e){const t=this.layer?.getField(e);if(null!=t)return this._featureClone.getAttribute(t.name)??null}setValue(e,t){const{_featureClone:n,strict:s}=this,i=this.findField(e);t=""===t?null:t,i&&n.getAttribute(e)!==t&&(i.value=t,s&&!i.valid||(this._afterValueChange(i),null!=this._expressionsManager&&this._updatingHandles.addPromise(this._expressionsManager.evaluateInvalidated([i.name]).finally((()=>this._afterExpressionsEvaluated())))))}getValues(){return{...this._featureClone.attributes}}overrideInitialFeature(e){this._initialFeature=e}submit(){const e=this.allFieldInputs,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),n=e.filter((e=>!e.valid)).map((({name:e})=>e)),s=this.getValues();if(this.validateContingencyConstraints(s,{includeIncompleteViolations:!0}).length>0)for(const[i,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(i),n.push(i));this.notifyChange("submittable"),this.notifyChange("valid"),this.emit("submit",{valid:[...t],invalid:n,values:s})}validateContingencyConstraints(e,t){const{_contingentValuesCache:n}=this,s=new Map;if(this.contingencyConstraintViolations=s,null==n)return[];const{invalid:i,incomplete:o}=n.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?o:[]];for(const a of r)for(const e of a.fieldGroup.fields)s.set(e,a);return r}notifyFeatureGeometryChanged(){const{_expressionsManager:e,feature:t,_featureClone:n}=this;t&&(n.geometry=t.geometry,null!=e&&this._updatingHandles.addPromise(e.evaluateInvalidatedByGeometry().finally((()=>this._afterExpressionsEvaluated()))))}applySubtypeDefaults(e){const{defaultValues:t}=e,{allFieldInputs:n}=this;for(const{name:s}of n){const e=t[s];null!=e&&this.setValue(s,e)}}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}async _updateInputs(){this._stopExpressions();const{_featureClone:e,_initialFeature:t,arcadeEditType:n,formTemplate:s,inputs:i,layer:o,timeZone:r}=this;if(!o)return;const a={arcadeEditType:n,feature:e,initialFeature:t,layer:o,timeZone:r},l=i.slice(),u=s?.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(l,s.elements,a):this._updateInputsUsingLayerFields(l,o?.fields,a);this.inputs=u,await this._startExpressions()}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(A(r)){s.set(r.element,r);for(const e of r.inputs)e.element&&s.set(e.element,e)}else r.element&&s.set(r.element,r);const i=new Map,o=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter(Y),sharedInitializationProperties:n,group:null,newExpressionExecutorPromises:i});for(const[r,a]of s.entries())s.delete(r),a.destroy();return await Promise.all(Array.from(i.values())),o}async _updateInputsUsingFormElementsRecursive(e){const{existingInputsByElement:t,updatedElements:n,sharedInitializationProperties:s,group:i,newExpressionExecutorPromises:o}=e,r=[];for(const a of n){const e=t.has(a),n=e?t.get(a):this._makeInputFromElement(a,s,i);if(n){if(r.push(n),await l((()=>!n.updating)),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),A(n)){const{feature:e,timeZone:t}=s;n.set({feature:e,timeZone:t})}else if(M(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else m(n)?(n.set(s),n.set({map:this.map})):n.set(s);if(g(a)){const e=a.elements.filter((e=>Y(e)));n.inputs=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return K().warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const o of e)if(A(o)){for(const e of o.inputs)e.destroy();o.inputs.length=0,o.destroy()}else M(o)?o.destroy():N(o)&&(null!==o.element?o.destroy():s.set(o.field,o));const i=[];for(const o of t){const e=n.feature?.getAttribute(o.name)??null,t=s.get(o)??new S({field:o,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden});i.push(t.set({...n,value:e})),s.delete(o)}for(const[o,r]of s.entries())s.delete(o),r.destroy();return i}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)}_makeInputFromElement(e,t,s){return g(e)?Q(e,t):y(e)?this._makeFieldInputFromElement(e,t,s):_(e)?this._makeRelationshipInputFromElement(e,t,s):m(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):v(e)?X(e,t):m(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):n()}_makeFieldInputFromElement(e,t,n){const{arcadeEditType:s,feature:i,initialFeature:o,layer:r,timeZone:a}=t,{fieldName:l}=e,u=l&&this._layerFieldsByName.get(l);return u?new S({arcadeEditType:s,element:e,field:u,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden,timeZone:a}):null}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t,a=new Z({element:e,feature:i,group:n,layer:o,map:s,timeZone:r});return a.addHandles(u((()=>a.relatedLayer),"edits",(()=>this._expressionsManager?.evaluateAsyncExpressions()))),a}_makeUtilityNetworkAssociationInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t;return new O({element:e,feature:i,group:n,layer:o,map:s,timeZone:r})}_assignExpressionExecutors(e,t,n){const s=$[t.type],i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const r=t[o];if(null!=r&&""!==r){const t=this._expressionInfosLookup.get(r)?.expression??r;i.push(this._getOrCreateExecutorForExpression(t,n).then((t=>{e[s]=this._useExecutor(t)})))}}return k(e)&&i.push(...this._assignTextElementExpressionExecutors(e,n)),i}_assignTextElementExpressionExecutors(e,t){const{_expressionInfosLookup:n}=this,s=[];for(const o of e.expressionsUsed){const r=n.get(o);null!=r?s.push(this._getOrCreateExecutorForExpression(r.expression,t).then((t=>e.setExpressionExecutor(o,this._useExecutor(t))))):i.getLogger(this).error("feature-form:expression-not-found",`Could not find expressionInfo object with name '${o}'`)}for(const i of e.fieldsUsed){const n=`return $feature['${i}'];`;s.push(this._getOrCreateExecutorForExpression(n,t).then((t=>e.setFieldExecutor(i,this._useExecutor(t)))))}return s}async _getOrCreateExecutorForExpression(e,t){const{_expressionExecutorLookup:n}=this;if(n.has(e))return n.get(e);if(t.has(e))return t.get(e);const s=W(e,this.layer);t.set(e,s);const i=await s;return n.set(e,i),i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s,formTemplate:i}=this;this._expressionsManager=new H({executors:e,feature:n,arcadeContextInfo:t,fieldInputs:s,preserveFieldValuesWhenHidden:!0===i?.preserveFieldValuesWhenHidden})}async _startExpressions(){if(0===this._expressionExecutorsInUse.size)return;const e=Array.from(this._expressionExecutorsInUse);this._createExpressionsManager(e),await this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))}_stopExpressions(){this._expressionsManager=o(this._expressionsManager),this._expressionExecutorsInUse.clear()}_useExecutor(e){return this._expressionExecutorsInUse.add(e),e}_afterValueChange(e){const{name:t,value:n}=e,{_featureClone:s,formTemplate:i,layer:o}=this;if(!o)return;const r=s.getAttribute(t);s.setAttribute(t,n);const{typeFieldName:a,types:l}=L(o);if((e.isSubtypeField||t===a)&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);this.feature&&(this.feature.sourceLayer=e),s.sourceLayer=e}const e=new Set;for(const t of l)if(t.domains&&"object"==typeof t.domains)for(const n of Object.keys(t.domains))e.add(n);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}this.notifyChange("joinedContingentValues")}if(null!=i){const{description:e,title:n}=i;n&&p(n,t)&&this.notifyChange("formTitle"),e&&p(e,t)&&this.notifyChange("formDescription")}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allFieldInputs)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_joinContingentValues(){const e=this._contingentValuesCache;if(null==e)return[];const{typeFieldName:t}=L(this.layer),n=t?this.getValue(t):null,s=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,o=[];for(const s of e)s.isRetired||null!=s.subtype&&s.subtype.code!==n||o.push({values:s.values});o.length>0&&s.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(s);return[...i.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,n=[],s=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const i=t.get(e),o=l,r=[i.name,o.name].sort().join("|");if(s.has(r))continue;n.push([i,o]),s.add(r),t.set(e,o)}else t.set(e,l);const i=new Set(n.flat()),o=new Set(e);for(const l of i)o.delete(l);const r=new Map,a=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),a.set(l,e)}for(const[l,u]of n){const e=a.get(l),t=a.get(u);if(e===t)continue;const n=r.get(e),s=r.get(t);for(const i of s)n.add(i),a.set(i,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let s=t.shift(),i=this._generateJoinKey(n.fields,s.fields),o=new Set([...n.fields,...s.fields]),r=new Map;for(const l of n.contingencies){const[e]=this._hashContingency(l,i.codedValueFields,!0);r.has(e)?r.get(e)?.push(l):r.set(e,[l])}for(;t.length>0;){const e=new Map,n=t.shift(),a=this._generateJoinKey(o,n.fields);for(const t of s.contingencies){const[n,s]=this._hashContingency(t,i.codedValueFields),o=s?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(z)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(z),i.codedValueFields)),null!=o)for(const r of o){const n=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,i.rangeFields):this._joinContingencies(r,t);if(null==n)break;const[s]=this._hashContingency(n,a.codedValueFields,!0);e.has(s)?e.get(s)?.push(n):e.set(s,[n])}}r=e,s=n,i=a,o=new Set([...o,...s.fields])}const a=[];for(const l of s.contingencies){const[e,t]=this._hashContingency(l,i.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(z)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(z),i.codedValueFields)),null!=n)for(const s of n){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(s,l,i.rangeFields):this._joinContingencies(s,l);null!=e&&a.push(e)}}return a}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[s,i]of Object.entries(n.values))"any"===i.objectType&&null!=e.values[s]&&(n.values[s]=e.values[s]);return n}_joinContingenciesWithRangeDomains(e,t,n){const s=this._joinContingencies(e,t);for(const i of n){const n=e.values[i],o=t.values[i],{leftIsNull:r,rightIsNull:a,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:c,leftIsRange:d,rightIsRange:h}=this._compareObjectTypes(n.objectType,o.objectType);if(l||c)continue;if(r&&p||a&&u){s.values[i]=new I({objectType:"null"});continue}if(r&&h||a&&d)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const f=Math.max(n.minValue,o.minValue),m=Math.min(n.maxValue,o.maxValue);if(f>m)return null;s.values[i]=new I({objectType:"range",minValue:f,maxValue:m})}return s}_findMatchingContingenciesContainingAny(e,t,n){return t.filter((t=>n.every((n=>{const s=t.values[n],i=e.values[n];return"any"===s.objectType||"any"===i.objectType||s.codedValue?.code===i.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const n=RegExp(`${t}$`),s=[];for(const[i,o]of e){if(i===z)break;n.test(i)&&s.push(...o)}return s}_generateJoinKey(e,t){const n=Array.isArray(e)?new Set(e):e,s=Array.isArray(t)?new Set(t):t,i=n.size<s.size?n:s,o=i===n?s:n,{feature:r}=this,a=new Set,l=new Set;for(const u of i)if(o.has(u)){const e=this.layer?.getFieldDomain(u,{feature:r??void 0,excludeImpliedDomains:!0});if(null==e)continue;switch(e.type){case"coded-value":a.add(u);break;case"range":l.add(u)}}return{codedValueFields:[...a],rangeFields:[...l]}}_contingencyIsValid(e,t){const n={};for(const{name:s,value:i}of this.allFieldInputs)this.fieldsWithContingentValues.has(s)&&null!=i&&s!==e&&(n[s]=i);return Object.entries(n).every((([e,n])=>!t.values.hasOwnProperty(e)||R(n,t.values[e])))}_getContingentValueOptionsForField(e,t){const n=this.joinedContingentValues.slice(),s=new Map,i={code:"",name:t??"No value"};for(const o of n){const t=o.values[e];if("code"===t?.objectType||"null"===t?.objectType){const{code:n,name:r}=t.codedValue&&"null"!==t.objectType?t.codedValue:i;!s.has(n)&&this._contingencyIsValid(e,o)&&s.set(n,{name:r,value:n})}}return[...s.values()]}_hashContingency(e,t,n=!1){if(t.length<1)return[D,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[z,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${J}`):s.push(`${o}:${t.codedValue?.code}`)}return[s.sort().join("&"),i]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}get test(){return{featureClone:this._featureClone}}};function Y(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||"text"===e.type||"utilityNetworkAssociations"===e.type||(K().warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}function Q(e,t){const{feature:n,layer:s}=t;return new U({element:e,inputs:[],feature:n,layer:s})}function X(e,t,n=null){const{feature:s,layer:i,timeZone:o}=t;return new P({element:e,feature:s,group:n,layer:i,timeZone:o})}e([c()],q.prototype,"_expressionInfosLookup",null),e([c()],q.prototype,"_featureClone",void 0),e([c()],q.prototype,"_timeZone",void 0),e([c()],q.prototype,"activeAssociation",void 0),e([c()],q.prototype,"activeAssociationInput",null),e([c()],q.prototype,"activeRelationshipInput",null),e([c()],q.prototype,"_arcadeContextInfo",null),e([c()],q.prototype,"associationId",null),e([c()],q.prototype,"associatedLayer",null),e([c()],q.prototype,"allAssociationInputs",null),e([c()],q.prototype,"allFieldInputs",null),e([c()],q.prototype,"allGroupInputs",null),e([c()],q.prototype,"allRelationshipInputs",null),e([c()],q.prototype,"_layerFieldsByName",null),e([c()],q.prototype,"arcadeEditType",void 0),e([c()],q.prototype,"contingencyConstraintViolations",void 0),e([c()],q.prototype,"disabled",void 0),e([c()],q.prototype,"feature",null),e([c()],q.prototype,"fieldsWithContingentValues",null),e([c({type:f})],q.prototype,"formTemplate",null),e([c()],q.prototype,"formDescription",null),e([c()],q.prototype,"formTitle",null),e([c()],q.prototype,"formHeaderVisible",null),e([c()],q.prototype,"highlightHelper",void 0),e([c()],q.prototype,"inputs",void 0),e([c()],q.prototype,"joinedContingentValues",null),e([c()],q.prototype,"layer",null),e([c()],q.prototype,"map",void 0),e([c()],q.prototype,"callbacks",void 0),e([c()],q.prototype,"relationshipId",null),e([c()],q.prototype,"spatialReference",null),e([c()],q.prototype,"state",null),e([c()],q.prototype,"strict",void 0),e([c()],q.prototype,"submittable",null),e([c()],q.prototype,"timeZone",null),e([c()],q.prototype,"updating",null),e([c()],q.prototype,"valid",null),e([c()],q.prototype,"pendingSubtypeChoice",void 0),e([c()],q.prototype,"getValues",null),e([c()],q.prototype,"submit",null),e([c()],q.prototype,"test",null),q=e([d(B)],q);const ee=q;export{ee as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Error.js";import{watch as i,sync as l}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{getDomainRange as s,dateTimeFieldValuesToNumericRange as u,validateDomainValue as a}from"../../layers/support/domainUtils.js";import{isFieldVisibleByDefault as o,getLowerCaseEditTrackingFields as p,isNumericField as d,isStringField as m,isTimeOnlyField as h,getFieldRange as f}from"../../layers/support/fieldUtils.js";import{isAnyDateField as y}from"../../smartMapping/support/utils.js";import{isNumber as c}from"../../support/guards.js";import{isRelatableFeatureSupportedLayer as g}from"../Feature/support/featureUtils.js";import x from"./EditableInput.js";import{isFieldElementWithInputType as v,valueIsInvalidSwitchValue as E,isFieldElementWithShowNoValueOptionInput as b}from"./featureFormUtils.js";import{timeResolutionToStepMap as _,isArcadeDate as V,arcadeDateToFieldValue as w}from"../support/dateUtils.js";import{dateIsValid as T,FieldInputDataTypes as F,getMaxLength as D,getMinLength as L,validateFormValue as j}from"../support/forms/formUtils.js";let M=class extends x{constructor(e){super(e),this._storedValue=null,this.error=null,this.preservesValueWhenHidden=!0,this.field=null,this.group=null,this.requiredExpressionExecutor=null,this.type="field",this._fieldInputWasVisibleDuringLifetime=!1,this.valueExpressionExecutor=null}initialize(){this.addHandles(i((()=>this.feature),(()=>this._fieldInputWasVisibleDuringLifetime=!1),l))}get _dateFormRange(){const{element:e,field:t}=this;if("date"!==this.dataType)return{};const i=e?.domain?s(t,e.domain):null;if(!e?.input)return i??{};const l=e.input,{type:n}=l;let r={};if("date-picker"!==n&&"time-picker"!==n&&"datetimeoffset-picker"!==n||(r=u(t,l.max,l.min)),"datetime-picker"===n){const{max:e,min:t}=l;r={max:null!=e&&T(e)?e.getTime():null,min:null!=t&&T(t)?t.getTime():null}}const{max:a,min:o}=r;if(i){const{max:e,min:t}=i,l=c(e)&&(null==a||null!=a&&e<a),n=c(t)&&(null==o||null!=o&&t>o);return{max:l?e:a??null,min:n?t:o??null,rawMax:l?i.rawMax:r?.rawMax??null,rawMin:n?i.rawMin:r?.rawMin??null}}return{min:o,max:a,rawMax:r?.rawMax??null,rawMin:r?.rawMin??null}}get _dateRange(){const{_dateFormRange:e,field:t}=this;if("date"!==this.dataType)return{};const i=s(t);if(!i)return e;const{max:l,min:n,rawMax:r,rawMin:u}=e;if("date"===t.type){const{max:e,min:t}=i;return{max:c(l)&&(null===e||null!=e&&l<e)?l:e??null,min:c(n)&&(null===t||null!=t&&n>t)?n:t??null}}if("date-only"===t.type||"time-only"===t.type||"timestamp-offset"===t.type){const{max:e,min:t,rawMax:s,rawMin:a}=i,o=c(l)&&r&&(null==e||l<e),p=c(n)&&u&&(null==t||n>t);return{max:o?l:e,min:p?n:t,rawMax:o?r:s,rawMin:p?u:a}}return{max:null,min:null}}get _configAllowsEdits(){const{element:e,layer:t,name:i}=this;if(null!=e)return e.editableExpression?!!this.evaluatedEditableExpression:!1!==e.editable;if(t?.userHasUpdateItemPrivileges)return!0;const l=t&&"popupTemplate"in t?t?.popupTemplate?.fieldInfos?.find((({fieldName:e})=>e===i)):null;return l?.isEditable??!0}get _layerAndFieldAllowEdits(){return this.layerAllowsEdits&&this.field?.editable}get _isVisibleByDefault(){const{field:e,layer:t}=this;return!!e?.visible&&o(e,t)}get _isEditTrackingField(){return p(this.layer).includes(this.name?.toLowerCase())}get _shouldUseValueExpression(){return this._layerAndFieldAllowEdits&&!this._configAllowsEdits&&null!=this.valueExpressionExecutor&&this.valueExpressionExecutor.initialExecutionComplete}get isSubtypeField(){const{layer:e}=this;if(e&&"subtypeField"in e){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.name}return!1}get valueIsOutOfDomain(){const{domain:e,value:t,field:i}=this;return!(!e||null==t)&&null!==a(i,t,e)}get dataType(){const{field:e}=this;return d(e)?F.Number:m(e)?F.Text:y(e)||h(e)?F.Date:F.Unsupported}get dateDataType(){if(this.dataType===F.Date)return"date"!==this.field.type?"string":"number"}get domain(){const{layer:e,feature:t,name:i,element:l}=this,n=l?.domain;return null!=n&&this._isDomainCompatible(n)?n:e.getFieldDomain(i,{feature:t})}get editable(){return!!this._layerAndFieldAllowEdits&&(this.evaluatedEditableExpression??this._configAllowsEdits)}get evaluatedRequiredExpression(){const{requiredExpressionExecutor:e}=this;return null!=e?!!e.lastEvaluatedValue:null}get evaluatedValueExpression(){const{valueExpressionExecutor:e}=this;return null!=e?e.lastEvaluatedValue:null}get hint(){return this.element?.hint}get includeDate(){return!(this.dataType!==F.Date||"time-only"===this.field.type)}get includeTime(){const{element:e,field:t}=this;if(this.dataType!==F.Date)return!1;if("time-only"===t.type)return!0;if("date-only"===t.type)return!1;const i="datetime-picker"===e?.input?.type?e.input.includeTime:void 0;return void 0===i||i}get includeTimeOffset(){if("timestamp-offset"!==this.field.type)return!1;const e=this.element?.input;return!e||"datetimeoffset-picker"===e.type&&e.includeTimeOffset}set initialFeature(e){this._set("initialFeature",e),this.notifyChange("valid")}get inputType(){return this.element?.input?.type}get hasInvalidSwitchValue(){const{element:e}=this,t=v(e,"switch")?e.input:null;return!t||E(this.value,t)}get isRelationshipKeyField(){const{field:e,layer:t}=this;return g(t)&&!!t.relationships?.some((t=>t.keyField===e.name))}get label(){const{field:e}=this;return this.getFormattedLabel(this.element?.label)??e.alias??e.name}get maxLength(){return D({dataType:this.dataType,field:this.field,input:this.element?.input})}get minLength(){return L({dataType:this.dataType,field:this.field,input:this.element?.input})}get name(){return this.field?.name}get range(){const{domain:e,element:t,field:i}=this;if("date"===this.dataType)return this._dateRange;const l=s(i,e)||f(i,e),n=l?.max===Number.MAX_VALUE?null:l?.max??null,r=l?.min===-Number.MAX_VALUE?null:l?.min??null;if(!t?.domain||"range"!==t.domain.type)return{max:n,min:r};const{max:u,min:a}=s(i)||{};return{max:null!=u&&(null===n||null!=n&&u<n)?u:n,min:null!=a&&(null===r||null!=r&&a>r)?a:r}}get required(){const{editable:e,evaluatedRequiredExpression:t,field:i,visible:l,isSubtypeField:n}=this;if(!e)return!1;if(!1===i?.nullable)return!0;if(n)return!0;return!(!l||!1===this.group?.visible||null==t)&&t}set required(e){this._overrideIfSome("required",e)}get showNoValueOptionEnabled(){const{element:e}=this;return!this.required&&(!b(e)||e.input.showNoValueOption)}get showNoValueLabel(){const{element:e}=this;return b(e)?e.input.noValueOptionLabel:null}get submittable(){const{field:e,required:t,valid:i,value:l}=this;return(!t||null!=l)&&(!!i||this.initialFeature.getAttribute(e.name)===l)}get timeResolution(){const e=this.element?.input;if(e&&("datetimeoffset-picker"===e.type||"time-picker"===e.type))return e.timeResolution??"minutes"}get timeStep(){return null!=this.timeResolution?_.get(this.timeResolution):void 0}get updating(){const{editableExpressionExecutor:e,valueExpressionExecutor:t,visibilityExpressionExecutor:i,preservesValueWhenHidden:l}=this;return null!=t&&t.updating||null!=e&&e.updating||!1===l&&null!=i&&i.updating}get valid(){const e=this.editable?this._validate():null;return this._set("error",e),null===e}get value(){if(this._fieldInputWasVisibleDuringLifetime=this._fieldInputWasVisibleDuringLifetime||this.visible&&!1!==this.group?.visible,!1===this.preservesValueWhenHidden&&this._fieldInputWasVisibleDuringLifetime&&(!1===this.visibilityExpressionExecutor?.lastEvaluatedValue||!1===this.group?.visibilityExpressionExecutor?.lastEvaluatedValue))return null!==this._storedValue&&this.set("_storedValue",null),null;if(this._shouldUseValueExpression){const e=this.evaluatedValueExpression;return this.dataType===F.Date?this._arcadeOutputToDateFieldValue(e):null!=e&&"object"==typeof e?`${e}`:e}return this._storedValue}set value(e){this.notifyChange("evaluatedVisibilityExpression"),this.set("_storedValue",e)}get visible(){return!this._isEditTrackingField&&(null!=this.evaluatedVisibilityExpression?this.evaluatedVisibilityExpression:null!=this.element&&!1!==this.field?.visible||this._isVisibleByDefault)}_arcadeOutputToDateFieldValue(e){const i=this.field.type;try{if("object"==typeof e){if(null===e)throw new t("feature-form:invalid-date-value");if(V(e))return w(e,i);if("getTime"in e&&"function"==typeof e.getTime&&"date"===i)return parseInt(e.getTime(),10);if("date-only"===i||"time-only"===i||"timestamp-offset"===i)return e.toString()}else{if("string"==typeof e)return"date"===i?parseInt(e,10):e;if("number"==typeof e&&"date"===i)return e}throw new t("feature-form:invalid-date-value")}catch{return"date"===i?NaN:""}}_isDomainCompatible(e){const{field:t}=this;if("coded-value"===e?.type){const i=typeof e.codedValues[0].code;if("string"===i&&m(t)||"number"===i&&d(t))return!0}return!!("range"===e?.type&&d(t)||y(t)||h(t))}_validate(){const{dataType:e,domain:t,field:i,minLength:l,range:n,required:r,value:s,maxLength:u}=this;return j(s,{dataType:e,domain:t,field:i,maxLength:u,minLength:l,range:n,required:r})}};e([n()],M.prototype,"_dateFormRange",null),e([n()],M.prototype,"_dateRange",null),e([n()],M.prototype,"_storedValue",void 0),e([n()],M.prototype,"_configAllowsEdits",null),e([n()],M.prototype,"_layerAndFieldAllowEdits",null),e([n()],M.prototype,"_isVisibleByDefault",null),e([n()],M.prototype,"_isEditTrackingField",null),e([n()],M.prototype,"_shouldUseValueExpression",null),e([n()],M.prototype,"isSubtypeField",null),e([n()],M.prototype,"valueIsOutOfDomain",null),e([n()],M.prototype,"dataType",null),e([n()],M.prototype,"dateDataType",null),e([n()],M.prototype,"domain",null),e([n()],M.prototype,"editable",null),e([n({readOnly:!0})],M.prototype,"error",void 0),e([n({constructOnly:!0})],M.prototype,"preservesValueWhenHidden",void 0),e([n()],M.prototype,"evaluatedRequiredExpression",null),e([n()],M.prototype,"evaluatedValueExpression",null),e([n()],M.prototype,"field",void 0),e([n()],M.prototype,"group",void 0),e([n({readOnly:!0})],M.prototype,"hint",null),e([n()],M.prototype,"includeDate",null),e([n()],M.prototype,"includeTime",null),e([n()],M.prototype,"includeTimeOffset",null),e([n()],M.prototype,"initialFeature",null),e([n({readOnly:!0})],M.prototype,"inputType",null),e([n()],M.prototype,"hasInvalidSwitchValue",null),e([n()],M.prototype,"isRelationshipKeyField",null),e([n()],M.prototype,"label",null),e([n()],M.prototype,"maxLength",null),e([n()],M.prototype,"minLength",null),e([n({readOnly:!0})],M.prototype,"name",null),e([n()],M.prototype,"range",null),e([n()],M.prototype,"required",null),e([n()],M.prototype,"requiredExpressionExecutor",void 0),e([n()],M.prototype,"showNoValueOptionEnabled",null),e([n()],M.prototype,"submittable",null),e([n()],M.prototype,"timeResolution",null),e([n()],M.prototype,"timeStep",null),e([n({readOnly:!0})],M.prototype,"type",void 0),e([n()],M.prototype,"updating",null),e([n()],M.prototype,"valid",null),e([n({value:null})],M.prototype,"value",null),e([n()],M.prototype,"valueExpressionExecutor",void 0),e([n()],M.prototype,"visible",null),M=e([r("esri.widgets.FeatureForm.FieldInput")],M);const O=M;export{O as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Error.js";import{watch as i,sync as l}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{getDomainRange as s,dateTimeFieldValuesToNumericRange as u,validateDomainValue as a}from"../../layers/support/domainUtils.js";import{isFieldVisibleByDefault as o,getLowerCaseEditTrackingFields as p,isNumericField as d,isStringField as m,isTimeOnlyField as h,getFieldRange as f}from"../../layers/support/fieldUtils.js";import{isAnyDateField as y}from"../../smartMapping/support/utils.js";import{isNumber as c}from"../../support/guards.js";import{isRelatableFeatureSupportedLayer as g}from"../Feature/support/featureUtils.js";import x from"./EditableInput.js";import{isFieldElementWithInputType as v,valueIsInvalidSwitchValue as E,isFieldElementWithShowNoValueOptionInput as b}from"./featureFormUtils.js";import{timeResolutionToStepMap as _,isArcadeDate as V,arcadeDateToFieldValue as w}from"../support/dateUtils.js";import{dateIsValid as T,FieldInputDataTypes as F,getMaxLength as D,getMinLength as L,validateFormValue as j}from"../support/forms/formUtils.js";let M=class extends x{constructor(e){super(e),this._storedValue=null,this.error=null,this.preservesValueWhenHidden=!0,this.field=null,this.group=null,this.requiredExpressionExecutor=null,this.type="field",this._fieldInputWasVisibleDuringLifetime=!1,this.valueExpressionExecutor=null}initialize(){this.addHandles(i((()=>this.feature),(()=>this._fieldInputWasVisibleDuringLifetime=!1),l))}get _dateFormRange(){const{element:e,field:t}=this;if("date"!==this.dataType)return{};const i=e?.domain?s(t,e.domain):null;if(!e?.input)return i??{};const l=e.input,{type:n}=l;let r={};if("date-picker"!==n&&"time-picker"!==n&&"datetimeoffset-picker"!==n||(r=u(t,l.max,l.min)),"datetime-picker"===n){const{max:e,min:t}=l;r={max:null!=e&&T(e)?e.getTime():null,min:null!=t&&T(t)?t.getTime():null}}const{max:a,min:o}=r;if(i){const{max:e,min:t}=i,l=c(e)&&(null==a||null!=a&&e<a),n=c(t)&&(null==o||null!=o&&t>o);return{max:l?e:a??null,min:n?t:o??null,rawMax:l?i.rawMax:r?.rawMax??null,rawMin:n?i.rawMin:r?.rawMin??null}}return{min:o,max:a,rawMax:r?.rawMax??null,rawMin:r?.rawMin??null}}get _dateRange(){const{_dateFormRange:e,field:t}=this;if("date"!==this.dataType)return{};const i=s(t);if(!i)return e;const{max:l,min:n,rawMax:r,rawMin:u}=e;if("date"===t.type){const{max:e,min:t}=i;return{max:c(l)&&(null===e||null!=e&&l<e)?l:e??null,min:c(n)&&(null===t||null!=t&&n>t)?n:t??null}}if("date-only"===t.type||"time-only"===t.type||"timestamp-offset"===t.type){const{max:e,min:t,rawMax:s,rawMin:a}=i,o=c(l)&&r&&(null==e||l<e),p=c(n)&&u&&(null==t||n>t);return{max:o?l:e,min:p?n:t,rawMax:o?r:s,rawMin:p?u:a}}return{max:null,min:null}}get _configAllowsEdits(){const{element:e,layer:t,name:i}=this;if(null!=e)return e.editableExpression?!!this.evaluatedEditableExpression:!1!==e.editable;if(t?.userHasUpdateItemPrivileges)return!0;const l=t&&"popupTemplate"in t?t?.popupTemplate?.fieldInfos?.find((({fieldName:e})=>e===i)):null;return l?.isEditable??!0}get _layerAndFieldAllowEdits(){return this.layerAllowsEdits&&this.field?.editable}get _isVisibleByDefault(){const{field:e,layer:t}=this;return!!e?.visible&&o(e,t)}get _isEditTrackingField(){return p(this.layer).includes(this.name?.toLowerCase())}get _shouldUseValueExpression(){return this._layerAndFieldAllowEdits&&!this._configAllowsEdits&&null!=this.valueExpressionExecutor&&this.valueExpressionExecutor.initialExecutionComplete}get isSubtypeField(){const{layer:e}=this;if(e&&"subtypeField"in e){const{subtypeField:t,fieldsIndex:i}=e;return(i.get(t)?.name??t)===this.name}return!1}get valueIsOutOfDomain(){const{domain:e,value:t,field:i}=this;return!(!e||null==t)&&null!==a(i,t,e)}get dataType(){const{field:e}=this;return d(e)?F.Number:m(e)?F.Text:y(e)||h(e)?F.Date:F.Unsupported}get dateDataType(){if(this.dataType===F.Date)return"date"!==this.field.type?"string":"number"}get domain(){const{layer:e,feature:t,name:i,element:l}=this,n=l?.domain;return null!=n&&this._isDomainCompatible(n)?n:e.getFieldDomain(i,{feature:t})}get editable(){return!!this._layerAndFieldAllowEdits&&(this.evaluatedEditableExpression??this._configAllowsEdits)}get evaluatedRequiredExpression(){const{requiredExpressionExecutor:e}=this;return null!=e?!!e.lastEvaluatedValue:null}get evaluatedValueExpression(){const{valueExpressionExecutor:e}=this;return null!=e?e.lastEvaluatedValue:null}get hint(){return this.element?.hint}get includeDate(){return!(this.dataType!==F.Date||"time-only"===this.field.type)}get includeTime(){const{element:e,field:t}=this;if(this.dataType!==F.Date)return!1;if("time-only"===t.type)return!0;if("date-only"===t.type)return!1;const i="datetime-picker"===e?.input?.type?e.input.includeTime:void 0;return void 0===i||i}get includeTimeOffset(){if("timestamp-offset"!==this.field.type)return!1;const e=this.element?.input;return!e||"datetimeoffset-picker"===e.type&&e.includeTimeOffset}set initialFeature(e){this._set("initialFeature",e),this.notifyChange("valid")}get inputType(){return this.element?.input?.type}get hasInvalidSwitchValue(){const{element:e}=this,t=v(e,"switch")?e.input:null;return!t||E(this.value,t)}get isRelationshipKeyField(){const{field:e,layer:t}=this;return g(t)&&!!t.relationships?.some((t=>t.keyField===e.name))}get label(){const{field:e}=this;return this.getFormattedLabel(this.element?.label)??e.alias??e.name}get maxLength(){return D({dataType:this.dataType,field:this.field,input:this.element?.input})}get minLength(){return L({dataType:this.dataType,field:this.field,input:this.element?.input})}get name(){return this.field?.name}get range(){const{domain:e,element:t,field:i}=this;if("date"===this.dataType)return this._dateRange;const l=s(i,e)||f(i,e),n=l?.max===Number.MAX_VALUE?null:l?.max??null,r=l?.min===-Number.MAX_VALUE?null:l?.min??null;if(!t?.domain||"range"!==t.domain.type)return{max:n,min:r};const{max:u,min:a}=s(i)||{};return{max:null!=u&&(null===n||null!=n&&u<n)?u:n,min:null!=a&&(null===r||null!=r&&a>r)?a:r}}get required(){const{editable:e,evaluatedRequiredExpression:t,field:i,visible:l,isSubtypeField:n}=this;if(!e)return!1;if(!1===i?.nullable)return!0;if(n)return!0;return!(!l||!1===this.group?.visible||null==t)&&t}set required(e){this._overrideIfSome("required",e)}get showNoValueOptionEnabled(){const{element:e}=this;return!this.required&&(!b(e)||e.input.showNoValueOption)}get showNoValueLabel(){const{element:e}=this;return b(e)?e.input.noValueOptionLabel:null}get submittable(){const{field:e,required:t,valid:i,value:l}=this;return(!t||null!=l)&&(!!i||this.initialFeature.getAttribute(e.name)===l)}get timeResolution(){const e=this.element?.input;if(e&&("datetimeoffset-picker"===e.type||"time-picker"===e.type))return e.timeResolution??"minutes"}get timeStep(){return null!=this.timeResolution?_.get(this.timeResolution):void 0}get updating(){const{editableExpressionExecutor:e,valueExpressionExecutor:t,visibilityExpressionExecutor:i,preservesValueWhenHidden:l}=this;return null!=t&&t.updating||null!=e&&e.updating||!1===l&&null!=i&&i.updating}get valid(){const e=this.editable?this._validate():null;return this._set("error",e),null===e}get value(){if(this._fieldInputWasVisibleDuringLifetime=this._fieldInputWasVisibleDuringLifetime||this.visible&&!1!==this.group?.visible,!1===this.preservesValueWhenHidden&&this._fieldInputWasVisibleDuringLifetime&&(!1===this.visibilityExpressionExecutor?.lastEvaluatedValue||!1===this.group?.visibilityExpressionExecutor?.lastEvaluatedValue))return null!==this._storedValue&&this.set("_storedValue",null),null;if(this._shouldUseValueExpression){const e=this.evaluatedValueExpression;return this.dataType===F.Date?this._arcadeOutputToDateFieldValue(e):null!=e&&"object"==typeof e?`${e}`:e}return this._storedValue}set value(e){this.notifyChange("evaluatedVisibilityExpression"),this.set("_storedValue",e),this.notifyChange("value"),this.notifyChange("valid")}get visible(){return!this._isEditTrackingField&&(null!=this.evaluatedVisibilityExpression?this.evaluatedVisibilityExpression:null!=this.element&&!1!==this.field?.visible||this._isVisibleByDefault)}_arcadeOutputToDateFieldValue(e){const i=this.field.type;try{if("object"==typeof e){if(null===e)throw new t("feature-form:invalid-date-value");if(V(e))return w(e,i);if("getTime"in e&&"function"==typeof e.getTime&&"date"===i)return parseInt(e.getTime(),10);if("date-only"===i||"time-only"===i||"timestamp-offset"===i)return e.toString()}else{if("string"==typeof e)return"date"===i?parseInt(e,10):e;if("number"==typeof e&&"date"===i)return e}throw new t("feature-form:invalid-date-value")}catch{return"date"===i?NaN:""}}_isDomainCompatible(e){const{field:t}=this;if("coded-value"===e?.type){const i=typeof e.codedValues[0].code;if("string"===i&&m(t)||"number"===i&&d(t))return!0}return!!("range"===e?.type&&d(t)||y(t)||h(t))}_validate(){const{dataType:e,domain:t,field:i,minLength:l,range:n,required:r,value:s,maxLength:u}=this;return j(s,{dataType:e,domain:t,field:i,maxLength:u,minLength:l,range:n,required:r})}};e([n()],M.prototype,"_dateFormRange",null),e([n()],M.prototype,"_dateRange",null),e([n()],M.prototype,"_storedValue",void 0),e([n()],M.prototype,"_configAllowsEdits",null),e([n()],M.prototype,"_layerAndFieldAllowEdits",null),e([n()],M.prototype,"_isVisibleByDefault",null),e([n()],M.prototype,"_isEditTrackingField",null),e([n()],M.prototype,"_shouldUseValueExpression",null),e([n()],M.prototype,"isSubtypeField",null),e([n()],M.prototype,"valueIsOutOfDomain",null),e([n()],M.prototype,"dataType",null),e([n()],M.prototype,"dateDataType",null),e([n()],M.prototype,"domain",null),e([n()],M.prototype,"editable",null),e([n({readOnly:!0})],M.prototype,"error",void 0),e([n({constructOnly:!0})],M.prototype,"preservesValueWhenHidden",void 0),e([n()],M.prototype,"evaluatedRequiredExpression",null),e([n()],M.prototype,"evaluatedValueExpression",null),e([n()],M.prototype,"field",void 0),e([n()],M.prototype,"group",void 0),e([n({readOnly:!0})],M.prototype,"hint",null),e([n()],M.prototype,"includeDate",null),e([n()],M.prototype,"includeTime",null),e([n()],M.prototype,"includeTimeOffset",null),e([n()],M.prototype,"initialFeature",null),e([n({readOnly:!0})],M.prototype,"inputType",null),e([n()],M.prototype,"hasInvalidSwitchValue",null),e([n()],M.prototype,"isRelationshipKeyField",null),e([n()],M.prototype,"label",null),e([n()],M.prototype,"maxLength",null),e([n()],M.prototype,"minLength",null),e([n({readOnly:!0})],M.prototype,"name",null),e([n()],M.prototype,"range",null),e([n()],M.prototype,"required",null),e([n()],M.prototype,"requiredExpressionExecutor",void 0),e([n()],M.prototype,"showNoValueOptionEnabled",null),e([n()],M.prototype,"submittable",null),e([n()],M.prototype,"timeResolution",null),e([n()],M.prototype,"timeStep",null),e([n({readOnly:!0})],M.prototype,"type",void 0),e([n()],M.prototype,"updating",null),e([n()],M.prototype,"valid",null),e([n({value:null})],M.prototype,"value",null),e([n()],M.prototype,"valueExpressionExecutor",void 0),e([n()],M.prototype,"visible",null),M=e([r("esri.widgets.FeatureForm.FieldInput")],M);const O=M;export{O as default};
|
package/widgets/FeatureForm.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import"../core/has.js";import i from"../core/Logger.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{createResolver as s}from"../core/promiseUtils.js";import{watch as n,whenOnce as a}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{isIntegerField as d}from"../layers/support/fieldUtils.js";import{getSubtypesFromLayer as c}from"../layers/support/layerUtils.js";import{isString as u}from"../support/guards.js";import p from"./Widget.js";import{Prompt as m}from"./Editor/components/Prompt.js";import h from"./Feature/FeatureUtilityNetworkAssociations.js";import{css as v}from"./FeatureForm/css.js";import{isGroupInput as _,isFieldInput as g,isRelationshipInput as b,isTextElementInput as f,isUtilityNetworkAssociationInput as y,flattenInputs as C,isInputInGroupInput as F,isFieldElementWithInputType as w,getErrorMessageForFieldInput as R,getIconForFeature as k,isNumberFieldInput as O,subtypeChangeShouldPrompt as I}from"./FeatureForm/featureFormUtils.js";import M from"./FeatureForm/FeatureFormViewModel.js";import N from"./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js";import{loadCalciteComponents as L}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as T,getIntlOptionsForField as x,numberingSystem as D,prepareISOFieldValueForDateComponents as V,prepareUnixFieldValueForDateComponents as A,normalizeTimeOnlyString as U,getISOFieldValueFromDateComponents as S,getUnixFieldValueFromDateComponents as E}from"./support/dateUtils.js";import{globalCss as j}from"./support/globalCss.js";import{Heading as P,incrementHeadingLevel as $}from"./support/Heading.js";import{setFocus as H}from"./support/widgetUtils.js";import{messageBundle as Z}from"./support/decorators/messageBundle.js";import{vmEvent as G}from"./support/decorators/vmEvent.js";import{tsx as W}from"./support/jsxFactory.js";import{substitute as B}from"../intl/substitute.js";const K="data-field-name";let q=class extends p{constructor(e,t){super(e,t),this._associationsWidgetsMap=new Map,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._pendingSubtypeChoice=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver((e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()}),{root:window.document}),this._prompt=null,this._featureFormUNAssociationList=null,this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new M,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,callbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t)=>{const{feature:i,callbacks:o}=this;i&&o?.addRelatedRecord&&o.addRelatedRecord({parentFeature:i,relatedLayer:t,relationshipId:e})},this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupToggle=this._onGroupToggle.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreate=this._afterComponentCreate.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([n((()=>this.feature),(()=>{this._inputsWithChanges.clear(),this._dateComponentMap.clear(),a((()=>!this.viewModel.updating)).then((()=>{const e=this._getFocusableInput("forward");this._syncGroupInputStates(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0}))})),n((()=>this.groupDisplay),(()=>this._syncGroupInputStates())),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._inputsWithChanges.add(e))),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}})),n((()=>[this.viewModel.activeRelationshipInput,this._listObserverNode]),(()=>this._onObserverChange())),n((()=>this.viewModel.activeAssociationInput),(e=>{e&&this._featureFormUNAssociationList&&(this._featureFormUNAssociationList.associationInput=e,this._featureFormUNAssociationList.viewModel=e.viewModel)}))])}loadDependencies(){return L({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const{callbacks:e}=this;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get _utilityNetworkAssociationsEnabled(){const{callbacks:e}=this;return!(!e?.viewAssociatedLayers||!e.viewAssociatedFeatures)}get _subtypes(){return c(this.layer)}get associationId(){return this.viewModel.associationId}set associationId(e){this.viewModel.associationId=e}get associatedLayer(){return this.viewModel.associatedLayer}set associatedLayer(e){this.viewModel.associatedLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}get icon(){return"form-field"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get relationshipId(){return this.viewModel.relationshipId}set relationshipId(e){this.viewModel.relationshipId=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return W("div",{class:this.classes(v.base,j.widget,j.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return W("div",null,W("form",{class:v.form,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderHeader(),this._renderContent()),this._prompt?W(m,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderHeader(){const e=this.viewModel,{formTitle:t,formDescription:i}=e;if(!e.formHeaderVisible)return;const o=null!=t&&W(P,{key:"title",level:this.headingLevel},t),s=null!=i&&W("p",{class:v.description,key:"description"},i);return W("div",{class:v.formHeader},o,s)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderRelationshipInput(e.activeRelationshipInput):e.activeAssociationInput?this._renderFeatureFormUtilityNetworkAssociationList():e.inputs.filter(t).filter((e=>e.visible)).map((e=>this._renderInput(e)))}_renderInput(e){return _(e)?this._renderGroup(e):g(e)?this._renderLabeledField(e):b(e)?this._renderRelationshipInput(e):f(e)?this._renderTextElementInput(e):y(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderFeatureFormUtilityNetworkAssociationList(){return this._featureFormUNAssociationList?.render()}_selectAssociatedLayer(e){const{feature:t,callbacks:i}=this;t&&i?.viewAssociatedFeatures&&i.viewAssociatedFeatures({associatedLayer:e.layer})}_selectAssociatedFeature(e){const{feature:t,callbacks:i}=this;t&&i?.selectAssociatedFeature&&i.selectAssociatedFeature({parentFeature:t,feature:e.feature,association:e.association})}_setUpUtilityNetworkAssociationList(){this._featureFormUNAssociationList||(this._featureFormUNAssociationList=new N({onSelectLayer:this._selectAssociatedLayer.bind(this),onSelectFeature:this._selectAssociatedFeature.bind(this)}))}_renderUtilityNetworkAssociationsElementInput(e){if(this._utilityNetworkAssociationsEnabled)return this._setUpUtilityNetworkAssociationList(),o(this._associationsWidgetsMap,e,(()=>new h({onSelectAssociationType:({viewModel:t,listType:i})=>{t.activeAssociationType=i;const{feature:o,callbacks:s}=this;o&&s?.viewAssociatedLayers&&s.viewAssociatedLayers({associationId:e.uid})},viewModel:e.associationsViewModel}))).render()}_renderDescriptionOrEmpty(e,t){return null==e?null:W("div",{class:this.classes(v.description),id:t},e)}_renderGroup(e){const{disabled:t,formTemplate:i,headingLevel:o}=this,{description:s,id:n,inputs:a,label:r,open:l}=e,d=a.filter((e=>e.visible)),c=this.viewModel.findField(this._focusedFieldName),u=c?.group===e,p="sequential"===this.groupDisplay;return W("calcite-block",{class:this.classes(v.group,p?v.groupSequential:null,u?v.groupActive:null,t?v.inputDisabled:null),collapsible:!0,"data-group":e,description:s||void 0,disabled:t,heading:r??"",headingLevel:i?.title?$(o):o,id:n,key:n,open:l,onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},d.map((e=>this._renderInput(e))))}_getFocusableInput(e,t){const i=C(this.viewModel.inputs);let o;if("backward"===e&&i.reverse(),t)if(_(t)){const e=t.inputs.find((e=>e.visible));o=e?i.indexOf(e):0}else{let s;if(F(t)&&!t.group.open){const i=t.group.inputs.filter(g);s="forward"===e?i[i.length-1]:i[0]}else s=t;o=i.indexOf(s)+1}else o=0;for(let s=o;s<i.length;s++){const e=i[s];if(e.visible&&g(e))return e}return null}_renderLabeledField(e){const{dataType:t,feature:i,label:o,layer:s,required:n}=e,a={"aria-label":n?B(this.messages.requiredFieldLabel,{name:o}):o,class:v.label,key:`${s.id}-${i.uid}-${e.name}`},r=[W("div",{class:v.labelTextContent,key:"labelTextContainer"},o,n?W("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==t?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)];return"date"===t&&"coded-value"!==e.domain?.type?W("label",{...a},r):W("calcite-label",{...a},r)}_renderFieldInput(e){const{dataType:t,domain:i,inputType:o,name:s}=e,n=this.getCommonInputProps(e);if("coded-value"===i?.type){const t=this.viewModel.getFieldValueOptionsForField(s,this.messages.empty);return"switch"!==o||e.hasInvalidSwitchValue?"radio-buttons"===o?this._renderRadioButtonComponents(e,t.flat(),n):this._renderComboBoxComponent(e,t,n):this._renderSwitchComponent(e,n)}return"datetime-picker"===o||"date"===t?this._renderDateComponents(e,n):"number"===t?this._renderNumberComponent(e,n):this._renderStringComponent(e,n)}_renderStringComponent(e,t){return"text-area"===e.inputType?t.readOnly?W("calcite-input",{...t,loading:e.updating,type:"textarea",onCalciteInputInput:e=>this._saveValueFromComponent(e.currentTarget)}):W("calcite-text-area",{...t,resize:"vertical",onCalciteTextAreaInput:e=>this._saveValueFromComponent(e.currentTarget)}):W("calcite-input",{...t,loading:e.updating,type:"text",onCalciteInputInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderNumberComponent(e,t){const i=d(e.field),o=i&&""!==t.value?Math.round(parseFloat(t.value)).toString():t.value;return W("calcite-input-number",{...t,integer:i,loading:e.updating,type:"number",value:o,onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderDateComponents(e,t){const{field:i}=e;switch(i.type){case"date":return this._renderDateFieldComponents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,T(i,t.value,{timeZone:this.timeZone,...x(i)}))}}_renderDateOnlyFieldComponent(e,t){const{range:i,valid:o,value:s}=e,{class:n,key:a,readOnly:r}=t,{rawMax:l,rawMin:d}=i;return W("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!o,class:n,"data-date-part":"date","data-field-name":t[K],key:`${a}-date-input`,max:u(l)?l:void 0,min:u(d)?d:void 0,numberingSystem:D,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:r,value:null!=s?`${s}`:void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{valid:i,value:o}=e,{class:s,key:n,readOnly:a}=t;return W("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,class:s,"data-date-part":"time","data-field-name":t[K],key:`${n}-time-input`,numberingSystem:D,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:a,step:e.timeStep,value:null!=o?`${o}`:void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{name:i,range:o,timeZone:s,valid:n,value:a}=e,{class:r,key:l,readOnly:d}=t,{rawMax:c,rawMin:u}=o,p={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,numberingSystem:D,overlayPositioning:"fixed",readOnly:d,[K]:i,onfocus:this._onComponentFocus},m=V(c,s),h=V(u,s),_=V(a,s);return W("div",{class:v.dateInputContainer,key:`${l}-date-time-container`},W("calcite-input-date-picker",{...p,class:r,"data-date-part":"date",key:`${l}-date-input`,max:m?.date??void 0,min:h?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:_.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),W("calcite-input-time-picker",{...p,class:r,"data-date-part":"time",key:`${l}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:e.timeStep,value:_.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),e.includeTimeOffset?W("calcite-input-time-zone",{...p,class:r,"data-date-part":"timeZone",disabled:d,key:`${l}-timezone-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:_.timeZoneOffset??"0",onCalciteInputTimeZoneChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderDateFieldComponents(e,t){const{includeTime:i,name:o,valid:s,value:n}=e,{class:a,key:r,max:l,min:d,readOnly:c}=t,{timeZone:u}=this,p={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!s,numberingSystem:D,overlayPositioning:"fixed",readOnly:c,[K]:o,onfocus:this._onComponentFocus},m=A(n,u),h=A(l,u),_=A(d,u);return W("div",{class:v.dateInputContainer,key:`${r}-date-time-container`},W("calcite-input-date-picker",{...p,class:a,"data-date-part":"date",key:`${r}-date-input`,max:h?.date??void 0,min:_?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:m.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),i?W("calcite-input-time-picker",{...p,class:a,"data-date-part":"time",key:`${r}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:1,value:m.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return W("calcite-input",{...i,class:this.classes(v.fieldInput,v.inputDisabled),readOnly:!0,type:"text",value:null!=t?`${t}`:i.value})}_renderComboBoxComponent(e,t,i){const{value:o,name:s}=e,{viewModel:n,_inputsWithChanges:a}=this,r="INSERT"===n.arcadeEditType,l=a.has(s),d=null==o&&(!r||l),c=r&&e.showNoValueOptionEnabled&&!l?()=>{}:i.onblur;return W("calcite-combobox",{...i,allowCustomValues:!1,clearDisabled:!0,disabled:i.readOnly,onblur:c,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:t})=>{d&&0===t.selectedItems.length?this._ignoreDeselectionOfNoValueOption(t):e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveValueFromComponent(t)}},this.renderComboboxOptionsList(e,t))}renderComboboxOptionsList(e,t){const{value:i,name:o}=e,{messages:s,messagesTemplates:n,viewModel:a,_inputsWithChanges:r}=this,[l,d,c]=t.map((e=>e.map((({name:e,value:t})=>W("calcite-combobox-item",{key:`#${t}`,selected:i===t,textLabel:e,value:`${t}`}))))),u=[];d.length>0&&u.push(W("calcite-combobox-item-group",{key:"other",label:n.other},d)),c.length>0&&u.push(W("calcite-combobox-item-group",{key:"unsupported",label:s.subtypes.unsupportedDomainGroupTitle},c)),u.length>0?u.unshift(W("calcite-combobox-item-group",{key:"recommended",label:s.recommended},l)):u.push(...l);const p="INSERT"===a.arcadeEditType,m=r.has(o),h=null==i&&(!p||m);return e.showNoValueOptionEnabled&&u.unshift(W("calcite-combobox-item",{key:"empty-option",selected:h,textLabel:e.showNoValueLabel||s.empty,value:""})),u}_renderRadioButtonComponents(e,t,i){const{name:o,value:s}=e,n=t.map((({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,name:o,value:t,selected:t===s,props:i})));if(e.showNoValueOptionEnabled){const t="",a=e.showNoValueLabel||this.messages.empty,r=s===t||null===s;n.unshift(this._renderRadioButtonComponent({key:"empty-option",label:a,name:o,value:t,selected:r,props:i}))}return W("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:v.inputRadioGroup,"data-field-name":i[K],key:`${i.key}-radio-group`,layout:"vertical",name:i.key,required:i.required},n)}_renderSwitchComponent(e,t){const{value:i}=e,o=!!w(e.element,"switch")&&i===e.element.input.onValue;return W("calcite-switch",{...t,checked:o,class:v.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.currentTarget)})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:o,label:s,props:n}){return W("calcite-label",{class:v.inputRadioLabel,key:e,layout:"inline"},W("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:o,class:v.inputRadio,disabled:n.readOnly,name:t,onblur:()=>{this._focusedFieldName=null},value:i,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveValueFromComponent(e)}}),s)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.submittable?R(e,this.messages,this.timeZone):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?W("calcite-input-message",{icon:!0,status:"invalid"},i):this._inputsWithChanges.has(t)&&e.valueIsOutOfDomain?W("calcite-input-message",{icon:!0,status:"idle"},this.messages.subtypes.fieldOutOfSubtypeDomainWarning):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){const{featureCount:t,relationshipId:i,showAllActionVisible:o}=e,{callbacks:s}=this;if(!o||!s?.showAllRelatedRecords)return;const n=this.messages;return W("calcite-list-item",{description:B(n.totalCount,{count:t}),label:n.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(i)},W("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:o}=e,{messages:s,callbacks:n}=this;if(t&&n?.addRelatedRecord&&o)return W("calcite-button",{alignment:"center",appearance:"outline-fill",class:v.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:"plus",key:`${i}-add-button`,onclick:()=>{!e.updating&&e.originHasValidKey&&this._onAddRelatedRecordsClick(i,o)},round:!0,scale:"s",width:"full"},e.relatedLayerIsTable?s.addRecord:s.addFeature)}_renderRelatedRecordListItem(e,t){const{feature:i,description:o,title:s}=e,{feature:n,callbacks:a}=this,{highlightHelper:r}=this.viewModel,l=()=>{r?.removeAll(),a?.editRelatedRecord&&n&&a.editRelatedRecord({parentFeature:n,relationshipId:t,relatedFeature:i})},d=r?()=>r.add(i):void 0,c=r?()=>r.remove(i):void 0;return W("calcite-list-item",{bind:this,description:o,key:`${t}-${i.uid}`,label:s,onclick:l,onmouseenter:d,onmouseleave:c,value:s},W("calcite-icon",{icon:k(i),slot:"content-start"}),W("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled||!e.editable)return;const{featureCount:t,relationshipId:i,showAllEnabled:o}=e,s=o?null:this._renderDescriptionOrEmpty(e.description),n=t>0?this._renderRelatedRecordsList(e):e.loaded?e.originHasValidKey?this._renderNoRelatedRecordsNotice():this._renderNoValidOriginKeyNotice(e):void 0;return W("calcite-label",{class:this.classes(v.label,v.relatedRecordsLabel),key:`relationship-${i}-container`},W("div",null,this._renderRelatedRecordsHeaderContainer(e),s,n),this._renderAddRelatedRecordButton(e))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return W("div",{class:v.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},W("span",null,e.label),t?W("calcite-loader",{inline:!0,key:"loader",label:this.messagesCommon?.loading,scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t}=e;return W("calcite-list",{class:v.relatedRecordsList,label:this.messages?.relatedRecordsList},e.relatedFeatureInfos.map((e=>this._renderRelatedRecordListItem(e,t))),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoValidOriginKeyNotice(e){const{messages:t}=this,i=e.relatedLayerIsTable?t.noOriginKeyRecord:t.noOriginKeyFeature,o=e.relationship?.keyField,s=this.viewModel.findField(o),n=e.layer?.fieldsIndex.get(o),a=s?.label||n?.alias||o,r=B(i,{relatedLayerName:e.relatedLayer?.title,originKeyField:a});return W("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},W("div",{slot:"message"},r))}_renderNoRelatedRecordsNotice(){return W("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},W("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return W("div",{afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved,bind:this,class:v.listObserver,key:"feature-observer"})}_renderTextElementInput(e){return W("div",{class:v.textElement,innerHTML:e.text,key:e.id})}getCommonInputProps(e){const{disabled:t}=this,{editable:i,hint:o,label:s,maxLength:n,minLength:a,name:r,range:{max:l,min:d},required:c,valid:u,value:p}=e,m=this._inputsWithChanges.has(r),h=!i||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":u?"false":"true",class:this.classes(v.fieldInput,h?v.inputDisabled:null),status:m&&!u?"invalid":"idle",key:r,label:s,max:null!=l?l:void 0,min:null!=d?d:void 0,maxLength:n>-1?n:void 0,minLength:a>-1?a:void 0,placeholder:o??void 0,readOnly:h,required:c,value:null==p?"":`${p}`,onblur:this._onComponentBlur,onfocus:this._onComponentFocus,onkeydown:this._onComponentKeyDown,[K]:r}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(K))}_afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e),i=e.dataset.datePart,o=this._dateComponentMap.get(t.name);if("valueAsDate"in e&&null!=e.value&&null!=t.value){const i=new ResizeObserver((()=>{switch(e.value=void 0,t.field.type){case"date":e.value=A(t.value,this.timeZone).date??"";break;case"timestamp-offset":e.value=V(t.value,this.timeZone).date??"";break;default:e.value=`${t.value}`}i.unobserve(e)}));i.observe(e)}if(null!=o)switch(i){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}else this._dateComponentMap.set(t.name,{[i]:e});this._afterDateComponentCreateOrUpdate(e)}_afterDateComponentCreateOrUpdate(e){this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);O(t)&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._afterComponentCreateOrUpdate(e)}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_afterComponentCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),o=t.findField(this._focusedFieldName);this._attemptFocusOnNextRender&&o===i&&(this._attemptFocusOnNextRender=!1,F(i)&&(i.group.open=!0),H(e))}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=i.name}_onComponentBlur(e){const t=e.target;this._focusedFieldName=null,this._saveValueFromComponent(t)}_saveValueFromDateComponent(e){const{timeZone:t}=this,i=this._getFieldInputFromHTMLElement(e),o=i.field.type,{name:s,range:n}=i,a=this._dateComponentMap.get(s);if(!a)return;let r=this.viewModel.getValue(s),l=null;"date-only"===o?l=Array.isArray(e.value)?e.value[0]:e.value:"time-only"===o?(r=U(r),l=U(e.value)):l="timestamp-offset"===o?null!=e.value?S({dateComponent:a.date,timeComponent:a.time,timeZoneComponent:a.timeZone,oldValue:r,defaultTimeZone:t}):null:null!=e.value?E({oldValue:r,dateComponent:a.date,timeComponent:a.time,timeZone:t,max:n.max,min:n.min}):null,null!==l&&e.value?r!==l&&this._updateFieldValue(s,l):this._updateFieldValue(s,null)}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e),i=this._parseValue(e),o=t.value;t.isSubtypeField&&I(this.layer,o,i)?this._pendingSubtypeChoice||i===o||(this._pendingSubtypeChoice=this._handleSubtypeChoice(t,i)):this._updateFieldValue(t.name,i)}async _handleSubtypeChoice(e,t){const{value:i,name:o}=e,{messages:n,viewModel:a,messagesCommon:r,_subtypes:l}=this;if(this._updateFieldValue(o,t),!l?.length)return;const d=l.find((e=>e.code===t)),c=l.find((e=>e.code===i))?.name??`${i}`;if(!d)return;a.hasPendingSubtypeChoice=!0;const u=s();let p="update-fields";const m=[{label:n.subtypes.useDefaultValuesOption,value:"update-fields"},{label:n.subtypes.keepCurrentValuesOption,value:"keep-existing"}],h={context:"info",title:n.subtypes.changeWarningTitle,message:B(n.subtypes.changeWarning,{originalType:c,newType:d.name}),radios:m,defaultRadioSelection:"update-fields",onRadioSelection:e=>p=e,actions:{primary:{label:r.apply,action:()=>u.resolve(p),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>u.resolve("undo")}},cancel:()=>u.reject()};try{this.showPrompt(h);switch(await u.promise){case"update-fields":a.applySubtypeDefaults(d),this._validateContingenciesForNonNullFields();break;case"keep-existing":this._validateContingenciesForNonNullFields();break;case"undo":this._updateFieldValue(e.name,i)}}finally{a.hasPendingSubtypeChoice=!1,this.clearPrompt(),this._pendingSubtypeChoice=null}}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&F(i)&&!i.group.open&&(i.group.open=!0)}_updateFieldValue(e,t){const i=this.viewModel.getValue(e);this.viewModel.setValue(e,t),this._inputsWithChanges.add(e);i!==t&&this.viewModel.fieldsWithContingentValues.has(e)&&this._validateContingenciesForNonNullFields()}_validateContingenciesForNonNullFields(){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>null!=t)));this.viewModel.validateContingencyConstraints(e)}_parseValue(e){const t=this._getFieldInputFromHTMLElement(e),i=e.value;return w(t.element,"switch")?e.checked?t.element.input.onValue:t.element.input.offValue:null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:o}=e;0===o.length&&t&&"selected"in t?t.selected=!0:i.getLogger(this).warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupToggle(e,t){e.open?(t.open=!0,this._focusedFieldName=this._getFocusableInput("forward",t)?.name||null,this._attemptFocusOnNextRender=!0,"sequential"===this.groupDisplay&&this.viewModel.allGroupInputs.forEach((e=>{e!==t&&(e.open=!1)}))):t.open=!1,this.scheduleRender()}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.allGroupInputs;if(!e.length)return;const t=e.filter((e=>e.open));0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach((e=>e.open=!1))}get test(){return{inputsWithChanges:this._inputsWithChanges,updateValue:this._saveValueFromComponent.bind(this)}}};e([r()],q.prototype,"_listObserverNode",void 0),e([r()],q.prototype,"_relatedRecordsEnabled",null),e([r()],q.prototype,"_utilityNetworkAssociationsEnabled",null),e([r()],q.prototype,"_prompt",void 0),e([r()],q.prototype,"_subtypes",null),e([r()],q.prototype,"associationId",null),e([r()],q.prototype,"associatedLayer",null),e([r()],q.prototype,"disabled",null),e([r()],q.prototype,"feature",null),e([r()],q.prototype,"_featureFormUNAssociationList",void 0),e([r()],q.prototype,"formTemplate",null),e([r()],q.prototype,"groupDisplay",void 0),e([r()],q.prototype,"headingLevel",void 0),e([r()],q.prototype,"icon",null),e([r()],q.prototype,"label",null),e([r()],q.prototype,"layer",null),e([r()],q.prototype,"map",null),e([r(),Z("esri/widgets/FeatureForm/t9n/FeatureForm")],q.prototype,"messages",void 0),e([r(),Z("esri/t9n/common")],q.prototype,"messagesCommon",void 0),e([r(),Z("esri/widgets/Feature/t9n/Feature")],q.prototype,"messagesFeature",void 0),e([r(),Z("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],q.prototype,"messagesTemplates",void 0),e([r()],q.prototype,"callbacks",null),e([r()],q.prototype,"relationshipId",null),e([r()],q.prototype,"spatialReference",null),e([r()],q.prototype,"strict",null),e([r()],q.prototype,"timeZone",null),e([r()],q.prototype,"showPrompt",null),e([r()],q.prototype,"clearPrompt",null),e([r(),G(["value-change","submit"])],q.prototype,"viewModel",void 0),e([r()],q.prototype,"test",null),q=e([l("esri.widgets.FeatureForm")],q);const z=q;export{z as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import"../core/has.js";import i from"../core/Logger.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{createResolver as s}from"../core/promiseUtils.js";import{watch as n,whenOnce as a}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{isIntegerField as d}from"../layers/support/fieldUtils.js";import{getSubtypesFromLayer as c}from"../layers/support/layerUtils.js";import{isString as u}from"../support/guards.js";import p from"./Widget.js";import{Prompt as m}from"./Editor/components/Prompt.js";import h from"./Feature/FeatureUtilityNetworkAssociations.js";import{css as v}from"./FeatureForm/css.js";import{isGroupInput as _,isFieldInput as g,isRelationshipInput as b,isTextElementInput as f,isUtilityNetworkAssociationInput as y,flattenInputs as C,isInputInGroupInput as F,isFieldElementWithInputType as w,getErrorMessageForFieldInput as R,getIconForFeature as k,isNumberFieldInput as O,subtypeChangeShouldPrompt as I}from"./FeatureForm/featureFormUtils.js";import M from"./FeatureForm/FeatureFormViewModel.js";import N from"./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js";import{loadCalciteComponents as L}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as T,getIntlOptionsForField as x,numberingSystem as D,prepareISOFieldValueForDateComponents as V,prepareUnixFieldValueForDateComponents as A,normalizeTimeOnlyString as U,getISOFieldValueFromDateComponents as S,getUnixFieldValueFromDateComponents as E}from"./support/dateUtils.js";import{globalCss as j}from"./support/globalCss.js";import{Heading as P,incrementHeadingLevel as $}from"./support/Heading.js";import{setFocus as H}from"./support/widgetUtils.js";import{messageBundle as Z}from"./support/decorators/messageBundle.js";import{vmEvent as G}from"./support/decorators/vmEvent.js";import{tsx as W}from"./support/jsxFactory.js";import{substitute as B}from"../intl/substitute.js";const K="data-field-name";let q=class extends p{constructor(e,t){super(e,t),this._associationsWidgetsMap=new Map,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._pendingSubtypeChoice=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver((e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()}),{root:window.document}),this._prompt=null,this._featureFormUNAssociationList=null,this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new M,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,callbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t)=>{const{feature:i,callbacks:o}=this;i&&o?.addRelatedRecord&&o.addRelatedRecord({parentFeature:i,relatedLayer:t,relationshipId:e})},this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupToggle=this._onGroupToggle.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreate=this._afterComponentCreate.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([n((()=>this.feature),(()=>{this._inputsWithChanges.clear(),this._dateComponentMap.clear(),a((()=>!this.viewModel.updating)).then((()=>{const e=this._getFocusableInput("forward");this._syncGroupInputStates(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0}))})),n((()=>this.groupDisplay),(()=>this._syncGroupInputStates())),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._inputsWithChanges.add(e))),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}})),n((()=>[this.viewModel.activeRelationshipInput,this._listObserverNode]),(()=>this._onObserverChange())),n((()=>this.viewModel.activeAssociationInput),(e=>{e&&this._featureFormUNAssociationList&&(this._featureFormUNAssociationList.associationInput=e,this._featureFormUNAssociationList.viewModel=e.viewModel)}))])}loadDependencies(){return L({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const{callbacks:e}=this;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get _utilityNetworkAssociationsEnabled(){const{callbacks:e}=this;return!(!e?.viewAssociatedLayers||!e.viewAssociatedFeatures)}get _subtypes(){return c(this.layer)}get associationId(){return this.viewModel.associationId}set associationId(e){this.viewModel.associationId=e}get associatedLayer(){return this.viewModel.associatedLayer}set associatedLayer(e){this.viewModel.associatedLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}get icon(){return"form-field"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get relationshipId(){return this.viewModel.relationshipId}set relationshipId(e){this.viewModel.relationshipId=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return W("div",{class:this.classes(v.base,j.widget,j.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return W("div",null,W("form",{class:v.form,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderHeader(),this._renderContent()),this._prompt?W(m,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderHeader(){const e=this.viewModel,{formTitle:t,formDescription:i}=e;if(!e.formHeaderVisible)return;const o=null!=t&&W(P,{key:"title",level:this.headingLevel},t),s=null!=i&&W("p",{class:v.description,key:"description"},i);return W("div",{class:v.formHeader},o,s)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderRelationshipInput(e.activeRelationshipInput):e.activeAssociationInput?this._renderFeatureFormUtilityNetworkAssociationList():e.inputs.filter(t).filter((e=>e.visible)).map((e=>this._renderInput(e)))}_renderInput(e){return _(e)?this._renderGroup(e):g(e)?this._renderLabeledField(e):b(e)?this._renderRelationshipInput(e):f(e)?this._renderTextElementInput(e):y(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderFeatureFormUtilityNetworkAssociationList(){return this._featureFormUNAssociationList?.render()}_selectAssociatedLayer(e){const{feature:t,callbacks:i}=this;t&&i?.viewAssociatedFeatures&&i.viewAssociatedFeatures({associatedLayer:e.layer})}_selectAssociatedFeature(e){const{feature:t,callbacks:i}=this;t&&i?.selectAssociatedFeature&&i.selectAssociatedFeature({parentFeature:t,feature:e.feature,association:e.association})}_setUpUtilityNetworkAssociationList(){this._featureFormUNAssociationList||(this._featureFormUNAssociationList=new N({onSelectLayer:this._selectAssociatedLayer.bind(this),onSelectFeature:this._selectAssociatedFeature.bind(this)}))}_renderUtilityNetworkAssociationsElementInput(e){if(this._utilityNetworkAssociationsEnabled)return this._setUpUtilityNetworkAssociationList(),o(this._associationsWidgetsMap,e,(()=>new h({onSelectAssociationType:({viewModel:t,listType:i})=>{t.activeAssociationType=i;const{feature:o,callbacks:s}=this;o&&s?.viewAssociatedLayers&&s.viewAssociatedLayers({associationId:e.uid})},viewModel:e.associationsViewModel}))).render()}_renderDescriptionOrEmpty(e,t){return null==e?null:W("div",{class:this.classes(v.description),id:t},e)}_renderGroup(e){const{disabled:t,formTemplate:i,headingLevel:o}=this,{description:s,id:n,inputs:a,label:r,open:l}=e,d=a.filter((e=>e.visible)),c=this.viewModel.findField(this._focusedFieldName),u=c?.group===e,p="sequential"===this.groupDisplay;return W("calcite-block",{class:this.classes(v.group,p?v.groupSequential:null,u?v.groupActive:null,t?v.inputDisabled:null),collapsible:!0,"data-group":e,description:s||void 0,disabled:t,heading:r??"",headingLevel:i?.title?$(o):o,id:n,key:n,open:l,onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},d.map((e=>this._renderInput(e))))}_getFocusableInput(e,t){const i=C(this.viewModel.inputs);let o;if("backward"===e&&i.reverse(),t)if(_(t)){const e=t.inputs.find((e=>e.visible));o=e?i.indexOf(e):0}else{let s;if(F(t)&&!t.group.open){const i=t.group.inputs.filter(g);s="forward"===e?i[i.length-1]:i[0]}else s=t;o=i.indexOf(s)+1}else o=0;for(let s=o;s<i.length;s++){const e=i[s];if(e.visible&&g(e))return e}return null}_renderLabeledField(e){const{dataType:t,feature:i,label:o,layer:s,required:n}=e,a={"aria-label":n?B(this.messages.requiredFieldLabel,{name:o}):o,class:v.label,key:`${s.id}-${i.uid}-${e.name}`},r=[W("div",{class:v.labelTextContent,key:"labelTextContainer"},o,n?W("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==t?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)];return"date"===t&&"coded-value"!==e.domain?.type?W("label",{...a},r):W("calcite-label",{...a},r)}_renderFieldInput(e){const{dataType:t,domain:i,inputType:o,name:s}=e,n=this.getCommonInputProps(e);if("coded-value"===i?.type){const t=this.viewModel.getFieldValueOptionsForField(s,this.messages.empty);return"switch"!==o||e.hasInvalidSwitchValue?"radio-buttons"===o?this._renderRadioButtonComponents(e,t.flat(),n):this._renderComboBoxComponent(e,t,n):this._renderSwitchComponent(e,n)}return"datetime-picker"===o||"date"===t?this._renderDateComponents(e,n):"number"===t?this._renderNumberComponent(e,n):this._renderStringComponent(e,n)}_renderStringComponent(e,t){return"text-area"===e.inputType?t.readOnly?W("calcite-input",{...t,loading:e.updating,type:"textarea",onCalciteInputInput:e=>this._saveValueFromComponent(e.currentTarget)}):W("calcite-text-area",{...t,resize:"vertical",onCalciteTextAreaInput:e=>this._saveValueFromComponent(e.currentTarget)}):W("calcite-input",{...t,loading:e.updating,type:"text",onCalciteInputInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderNumberComponent(e,t){const i=d(e.field),o=i&&""!==t.value?Math.round(parseFloat(t.value)).toString():t.value;return W("calcite-input-number",{...t,integer:i,loading:e.updating,type:"number",value:o,onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderDateComponents(e,t){const{field:i}=e;switch(i.type){case"date":return this._renderDateFieldComponents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,T(i,t.value,{timeZone:this.timeZone,...x(i)}))}}_renderDateOnlyFieldComponent(e,t){const{range:i,valid:o,value:s}=e,{class:n,key:a,readOnly:r}=t,{rawMax:l,rawMin:d}=i;return W("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!o,class:n,"data-date-part":"date","data-field-name":t[K],key:`${a}-date-input`,max:u(l)?l:void 0,min:u(d)?d:void 0,numberingSystem:D,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:r,value:null!=s?`${s}`:void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{valid:i,value:o}=e,{class:s,key:n,readOnly:a}=t;return W("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,class:s,"data-date-part":"time","data-field-name":t[K],key:`${n}-time-input`,numberingSystem:D,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:a,step:e.timeStep,value:null!=o?`${o}`:void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{name:i,range:o,timeZone:s,valid:n,value:a}=e,{class:r,key:l,readOnly:d}=t,{rawMax:c,rawMin:u}=o,p={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,numberingSystem:D,overlayPositioning:"fixed",readOnly:d,[K]:i,onfocus:this._onComponentFocus},m=V(c,s),h=V(u,s),_=V(a,s);return W("div",{class:v.dateInputContainer,key:`${l}-date-time-container`},W("calcite-input-date-picker",{...p,class:r,"data-date-part":"date",key:`${l}-date-input`,max:m?.date??void 0,min:h?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:_.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),W("calcite-input-time-picker",{...p,class:r,"data-date-part":"time",key:`${l}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:e.timeStep,value:_.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),e.includeTimeOffset?W("calcite-input-time-zone",{...p,class:r,"data-date-part":"timeZone",disabled:d,key:`${l}-timezone-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:_.timeZoneOffset??"0",onCalciteInputTimeZoneChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderDateFieldComponents(e,t){const{includeTime:i,name:o,valid:s,value:n}=e,{class:a,key:r,max:l,min:d,readOnly:c}=t,{timeZone:u}=this,p={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!s,numberingSystem:D,overlayPositioning:"fixed",readOnly:c,[K]:o,onfocus:this._onComponentFocus},m=A(n,u),h=A(l,u),_=A(d,u);return W("div",{class:v.dateInputContainer,key:`${r}-date-time-container`},W("calcite-input-date-picker",{...p,class:a,"data-date-part":"date",key:`${r}-date-input`,max:h?.date??void 0,min:_?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:m.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),i?W("calcite-input-time-picker",{...p,class:a,"data-date-part":"time",key:`${r}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:1,value:m.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return W("calcite-input",{...i,class:this.classes(v.fieldInput,v.inputDisabled),readOnly:!0,type:"text",value:null!=t?`${t}`:i.value})}_renderComboBoxComponent(e,t,i){const{value:o,name:s}=e,{viewModel:n,_inputsWithChanges:a}=this,r="INSERT"===n.arcadeEditType,l=a.has(s),d=null==o&&(!r||l),c=r&&e.showNoValueOptionEnabled&&!l?()=>{}:i.onblur;return W("calcite-combobox",{...i,allowCustomValues:!1,clearDisabled:!0,disabled:i.readOnly,onblur:c,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:t})=>{d&&0===t.selectedItems.length?this._ignoreDeselectionOfNoValueOption(t):e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveValueFromComponent(t)}},this.renderComboboxOptionsList(e,t))}renderComboboxOptionsList(e,t){const{value:i,name:o}=e,{messages:s,messagesTemplates:n,viewModel:a,_inputsWithChanges:r}=this,[l,d,c]=t.map((e=>e.map((({name:e,value:t})=>W("calcite-combobox-item",{key:`#${t}`,selected:i===t,textLabel:e,value:`${t}`}))))),u=[];d.length>0&&u.push(W("calcite-combobox-item-group",{key:"other",label:n.other},d)),c.length>0&&u.push(W("calcite-combobox-item-group",{key:"unsupported",label:s.subtypes.unsupportedDomainGroupTitle},c)),u.length>0?u.unshift(W("calcite-combobox-item-group",{key:"recommended",label:s.recommended},l)):u.push(...l);const p="INSERT"===a.arcadeEditType,m=r.has(o),h=null==i&&(!p||m);return e.showNoValueOptionEnabled&&u.unshift(W("calcite-combobox-item",{key:"empty-option",selected:h,textLabel:e.showNoValueLabel||s.empty,value:""})),u}_renderRadioButtonComponents(e,t,i){const{name:o,value:s}=e,n=t.map((({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,name:o,value:t,selected:t===s,props:i})));if(e.showNoValueOptionEnabled){const t="",a=e.showNoValueLabel||this.messages.empty,r=s===t||null===s;n.unshift(this._renderRadioButtonComponent({key:"empty-option",label:a,name:o,value:t,selected:r,props:i}))}return W("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:v.inputRadioGroup,"data-field-name":i[K],key:`${i.key}-radio-group`,layout:"vertical",name:i.key,required:i.required},n)}_renderSwitchComponent(e,t){const{value:i}=e,o=!!w(e.element,"switch")&&i===e.element.input.onValue;return W("calcite-switch",{...t,checked:o,class:v.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.currentTarget)})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:o,label:s,props:n}){return W("calcite-label",{class:v.inputRadioLabel,key:e,layout:"inline"},W("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:o,class:v.inputRadio,disabled:n.readOnly,name:t,onblur:()=>{this._focusedFieldName=null},value:i,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveValueFromComponent(e)}}),s)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.submittable?R(e,this.messages,this.timeZone):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?W("calcite-input-message",{icon:!0,status:"invalid"},i):this._inputsWithChanges.has(t)&&e.valueIsOutOfDomain?W("calcite-input-message",{icon:!0,status:"idle"},this.messages.subtypes.fieldOutOfSubtypeDomainWarning):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){const{featureCount:t,relationshipId:i,showAllActionVisible:o}=e,{callbacks:s}=this;if(!o||!s?.showAllRelatedRecords)return;const n=this.messages;return W("calcite-list-item",{description:B(n.totalCount,{count:t}),label:n.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(i)},W("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:o}=e,{messages:s,callbacks:n}=this;if(t&&n?.addRelatedRecord&&o)return W("calcite-button",{alignment:"center",appearance:"outline-fill",class:v.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:"plus",key:`${i}-add-button`,onclick:()=>{!e.updating&&e.originHasValidKey&&this._onAddRelatedRecordsClick(i,o)},round:!0,scale:"s",width:"full"},e.relatedLayerIsTable?s.addRecord:s.addFeature)}_renderRelatedRecordListItem(e,t){const{feature:i,description:o,title:s}=e,{feature:n,callbacks:a}=this,{highlightHelper:r}=this.viewModel,l=()=>{r?.removeAll(),a?.editRelatedRecord&&n&&a.editRelatedRecord({parentFeature:n,relationshipId:t,relatedFeature:i})},d=r?()=>r.add(i):void 0,c=r?()=>r.remove(i):void 0;return W("calcite-list-item",{bind:this,description:o,key:`${t}-${i.uid}`,label:s,onclick:l,onmouseenter:d,onmouseleave:c,value:s},W("calcite-icon",{icon:k(i),slot:"content-start"}),W("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled||!e.editable)return;const{featureCount:t,relationshipId:i,showAllEnabled:o}=e,s=o?null:this._renderDescriptionOrEmpty(e.description),n=t>0?this._renderRelatedRecordsList(e):e.loaded?e.originHasValidKey?this._renderNoRelatedRecordsNotice():this._renderNoValidOriginKeyNotice(e):void 0;return W("calcite-label",{class:this.classes(v.label,v.relatedRecordsLabel),key:`relationship-${i}-container`},W("div",null,this._renderRelatedRecordsHeaderContainer(e),s,n),this._renderAddRelatedRecordButton(e))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return W("div",{class:v.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},W("span",null,e.label),t?W("calcite-loader",{inline:!0,key:"loader",label:this.messagesCommon?.loading,scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t}=e;return W("calcite-list",{class:v.relatedRecordsList,label:this.messages?.relatedRecordsList},e.relatedFeatureInfos.map((e=>this._renderRelatedRecordListItem(e,t))),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoValidOriginKeyNotice(e){const{messages:t}=this,i=e.relatedLayerIsTable?t.noOriginKeyRecord:t.noOriginKeyFeature,o=e.relationship?.keyField,s=this.viewModel.findField(o),n=e.layer?.fieldsIndex.get(o),a=s?.label||n?.alias||o,r=B(i,{relatedLayerName:e.relatedLayer?.title,originKeyField:a});return W("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},W("div",{slot:"message"},r))}_renderNoRelatedRecordsNotice(){return W("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},W("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return W("div",{afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved,bind:this,class:v.listObserver,key:"feature-observer"})}_renderTextElementInput(e){return W("div",{class:v.textElement,innerHTML:e.text,key:e.id})}getCommonInputProps(e){const{disabled:t}=this,{editable:i,hint:o,label:s,maxLength:n,minLength:a,name:r,range:{max:l,min:d},required:c,valid:u,value:p}=e,m=this._inputsWithChanges.has(r),h=!i||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":u?"false":"true",class:this.classes(v.fieldInput,h?v.inputDisabled:null),status:m&&!u?"invalid":"idle",key:r,label:s,max:null!=l?l:void 0,min:null!=d?d:void 0,maxLength:n>-1?n:void 0,minLength:a>-1?a:void 0,placeholder:o??void 0,readOnly:h,required:c,value:null==p?"":`${p}`,onblur:this._onComponentBlur,onfocus:this._onComponentFocus,onkeydown:this._onComponentKeyDown,[K]:r}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(K))}_afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e),i=e.dataset.datePart,o=this._dateComponentMap.get(t.name);if("valueAsDate"in e&&null!=e.value&&null!=t.value){const i=new ResizeObserver((()=>{switch(e.value=void 0,t.field.type){case"date":e.value=A(t.value,this.timeZone).date??"";break;case"timestamp-offset":e.value=V(t.value,this.timeZone).date??"";break;default:e.value=`${t.value}`}i.unobserve(e)}));i.observe(e)}if(null!=o)switch(i){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}else this._dateComponentMap.set(t.name,{[i]:e});this._afterDateComponentCreateOrUpdate(e)}_afterDateComponentCreateOrUpdate(e){this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);O(t)&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._afterComponentCreateOrUpdate(e)}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_afterComponentCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),o=t.findField(this._focusedFieldName);this._attemptFocusOnNextRender&&o===i&&(this._attemptFocusOnNextRender=!1,F(i)&&(i.group.open=!0),H(e))}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=i.name}_onComponentBlur(e){const t=e.target;this._focusedFieldName=null;"readOnly"in t&&t.readOnly||this._saveValueFromComponent(t)}_saveValueFromDateComponent(e){const{timeZone:t}=this,i=this._getFieldInputFromHTMLElement(e),o=i.field.type,{name:s,range:n}=i,a=this._dateComponentMap.get(s);if(!a)return;let r=this.viewModel.getValue(s),l=null;"date-only"===o?l=Array.isArray(e.value)?e.value[0]:e.value:"time-only"===o?(r=U(r),l=U(e.value)):l="timestamp-offset"===o?null!=e.value?S({dateComponent:a.date,timeComponent:a.time,timeZoneComponent:a.timeZone,oldValue:r,defaultTimeZone:t}):null:null!=e.value?E({oldValue:r,dateComponent:a.date,timeComponent:a.time,timeZone:t,max:n.max,min:n.min}):null,null!==l&&e.value?r!==l&&this._updateFieldValue(s,l):this._updateFieldValue(s,null)}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e),i=this._parseValue(e),o=t.value;t.isSubtypeField&&I(this.layer,o,i)?this._pendingSubtypeChoice||i===o||(this._pendingSubtypeChoice=this._handleSubtypeChoice(t,i)):this._updateFieldValue(t.name,i)}async _handleSubtypeChoice(e,t){const{value:i,name:o}=e,{messages:n,viewModel:a,messagesCommon:r,_subtypes:l}=this;if(this._updateFieldValue(o,t),!l?.length)return;const d=l.find((e=>e.code===t)),c=l.find((e=>e.code===i))?.name??`${i}`;if(!d)return;const u=s();a.pendingSubtypeChoice=u;let p="update-fields";const m=[{label:n.subtypes.useDefaultValuesOption,value:"update-fields"},{label:n.subtypes.keepCurrentValuesOption,value:"keep-existing"}],h={context:"info",title:n.subtypes.changeWarningTitle,message:B(n.subtypes.changeWarning,{originalType:c,newType:d.name}),radios:m,defaultRadioSelection:"update-fields",onRadioSelection:e=>p=e,actions:{primary:{label:r.apply,action:()=>u.resolve(p),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>u.resolve("undo")}},cancel:()=>u.reject()};try{this.showPrompt(h);switch(await u.promise){case"update-fields":a.applySubtypeDefaults(d),this._validateContingenciesForNonNullFields();break;case"keep-existing":this._validateContingenciesForNonNullFields();break;case"undo":this._updateFieldValue(e.name,i)}}finally{a.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&F(i)&&!i.group.open&&(i.group.open=!0)}_updateFieldValue(e,t){const i=this.viewModel.getValue(e);this.viewModel.setValue(e,t),this._inputsWithChanges.add(e);i!==t&&this.viewModel.fieldsWithContingentValues.has(e)&&this._validateContingenciesForNonNullFields()}_validateContingenciesForNonNullFields(){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>null!=t)));this.viewModel.validateContingencyConstraints(e)}_parseValue(e){const t=this._getFieldInputFromHTMLElement(e),i=e.value;return w(t.element,"switch")?e.checked?t.element.input.onValue:t.element.input.offValue:null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:o}=e;0===o.length&&t&&"selected"in t?t.selected=!0:i.getLogger(this).warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupToggle(e,t){e.open?(t.open=!0,this._focusedFieldName=this._getFocusableInput("forward",t)?.name||null,this._attemptFocusOnNextRender=!0,"sequential"===this.groupDisplay&&this.viewModel.allGroupInputs.forEach((e=>{e!==t&&(e.open=!1)}))):t.open=!1,this.scheduleRender()}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.allGroupInputs;if(!e.length)return;const t=e.filter((e=>e.open));0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach((e=>e.open=!1))}get test(){return{inputsWithChanges:this._inputsWithChanges,updateValue:this._saveValueFromComponent.bind(this)}}};e([r()],q.prototype,"_listObserverNode",void 0),e([r()],q.prototype,"_relatedRecordsEnabled",null),e([r()],q.prototype,"_utilityNetworkAssociationsEnabled",null),e([r()],q.prototype,"_prompt",void 0),e([r()],q.prototype,"_subtypes",null),e([r()],q.prototype,"associationId",null),e([r()],q.prototype,"associatedLayer",null),e([r()],q.prototype,"disabled",null),e([r()],q.prototype,"feature",null),e([r()],q.prototype,"_featureFormUNAssociationList",void 0),e([r()],q.prototype,"formTemplate",null),e([r()],q.prototype,"groupDisplay",void 0),e([r()],q.prototype,"headingLevel",void 0),e([r()],q.prototype,"icon",null),e([r()],q.prototype,"label",null),e([r()],q.prototype,"layer",null),e([r()],q.prototype,"map",null),e([r(),Z("esri/widgets/FeatureForm/t9n/FeatureForm")],q.prototype,"messages",void 0),e([r(),Z("esri/t9n/common")],q.prototype,"messagesCommon",void 0),e([r(),Z("esri/widgets/Feature/t9n/Feature")],q.prototype,"messagesFeature",void 0),e([r(),Z("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],q.prototype,"messagesTemplates",void 0),e([r()],q.prototype,"callbacks",null),e([r()],q.prototype,"relationshipId",null),e([r()],q.prototype,"spatialReference",null),e([r()],q.prototype,"strict",null),e([r()],q.prototype,"timeZone",null),e([r()],q.prototype,"showPrompt",null),e([r()],q.prototype,"clearPrompt",null),e([r(),G(["value-change","submit"])],q.prototype,"viewModel",void 0),e([r()],q.prototype,"test",null),q=e([l("esri.widgets.FeatureForm")],q);const z=q;export{z as default};
|