@arcgis/core 4.28.0-next.20230919 → 4.28.0-next.20230921
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/Color.js +1 -1
- package/WebScene.js +1 -1
- package/arcade/ArcadeDate.js +1 -1
- package/arcade/executionError.js +1 -1
- package/arcade/featureset/support/errorsupport.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/06621efb2573fad23b45.js +1 -0
- package/assets/esri/core/workers/chunks/072b4e041b8630c513a0.js +1 -0
- package/assets/esri/core/workers/chunks/101f776316a85b708927.js +1 -0
- package/assets/esri/core/workers/chunks/107546ef77a45d31c7ac.js +1 -0
- package/assets/esri/core/workers/chunks/10fd951bd296b2beeeba.js +1 -0
- package/assets/esri/core/workers/chunks/114269dda1d296893908.js +1 -0
- package/assets/esri/core/workers/chunks/126df6237fc80608344e.js +1 -0
- package/assets/esri/core/workers/chunks/134524cf6b1ebf208338.js +1 -0
- package/assets/esri/core/workers/chunks/17a36704e63ca1b34c5d.js +1 -0
- package/assets/esri/core/workers/chunks/1c83f47d446f2bca1721.js +1 -0
- package/assets/esri/core/workers/chunks/{09d395a9786607294689.js → 1c8469fbde39d85ee622.js} +1 -1
- package/assets/esri/core/workers/chunks/1cbaba30f55f00f7498b.js +1 -0
- package/assets/esri/core/workers/chunks/21a9c8aa2a9e9990df41.js +1 -0
- package/assets/esri/core/workers/chunks/{506874f562ce11f8914a.js → 243a4eed107d363dfad8.js} +1 -1
- package/assets/esri/core/workers/chunks/24629402c647ef6b5f6b.js +1 -0
- package/assets/esri/core/workers/chunks/2a1c1be9c202462cf54d.js +1 -0
- package/assets/esri/core/workers/chunks/2bb69d76a13564e8e455.js +1 -0
- package/assets/esri/core/workers/chunks/2d0d03cbea83c868edba.js +1 -0
- package/assets/esri/core/workers/chunks/2e130cb2f1038055c07b.js +1 -0
- package/assets/esri/core/workers/chunks/32ba4eba730e9232d964.js +1 -0
- package/assets/esri/core/workers/chunks/{b428fcb53ecc82b49e66.js → 332689bf60d246485993.js} +1 -1
- package/assets/esri/core/workers/chunks/3619e04cbb6691549014.js +1 -0
- package/assets/esri/core/workers/chunks/37116fb4c68cf3c3890a.js +1 -0
- package/assets/esri/core/workers/chunks/{3a7ad0d24264e2bc2e87.js → 3ca759f72d3bb29e9ea9.js} +22 -22
- package/assets/esri/core/workers/chunks/3dbfb4f370a874393822.js +1 -0
- package/assets/esri/core/workers/chunks/3f4e9b1663ec521bfe00.js +1 -0
- package/assets/esri/core/workers/chunks/406db5c90271a3a203d4.js +1 -0
- package/assets/esri/core/workers/chunks/4339ce8aaf87fabb80cc.js +1 -0
- package/assets/esri/core/workers/chunks/4369a6c1e0a82ab4db6a.js +1 -0
- package/assets/esri/core/workers/chunks/43ba2bacd0f7d19915f7.js +1 -0
- package/assets/esri/core/workers/chunks/44b8e75593b7df1843e1.js +1 -0
- package/assets/esri/core/workers/chunks/467a821d05df8ec0dc1c.js +1 -0
- package/assets/esri/core/workers/chunks/47be4c75dd6372b96fe4.js +1 -0
- package/assets/esri/core/workers/chunks/53097659f31750c03a6d.js +1 -0
- package/assets/esri/core/workers/chunks/{c1141056581af072aee9.js → 580039dd491854ca325c.js} +1 -1
- package/assets/esri/core/workers/chunks/59c00d6fba0fd1c03d01.js +1 -0
- package/assets/esri/core/workers/chunks/5a5720caa64a46daadf9.js +1 -0
- package/assets/esri/core/workers/chunks/5edb99b58549cd66b394.js +1 -0
- package/assets/esri/core/workers/chunks/6203ddf6caad3d356327.js +1 -0
- package/assets/esri/core/workers/chunks/652749dc847fcb887234.js +1 -0
- package/assets/esri/core/workers/chunks/6c495077cc79e1898927.js +1 -0
- package/assets/esri/core/workers/chunks/{e5c3beebd507e1dda35f.js → 749fc49246093d693227.js} +1 -1
- package/assets/esri/core/workers/chunks/74d3ecb1a06d9f81e2c5.js +1 -0
- package/assets/esri/core/workers/chunks/77c15b1c2729c780f75a.js +1 -0
- package/assets/esri/core/workers/chunks/7ea33aa455c5143affb1.js +1 -0
- package/assets/esri/core/workers/chunks/7ed70c96fbfe00792e7c.js +1 -0
- package/assets/esri/core/workers/chunks/8ab832468300cc4feb5a.js +1 -0
- package/assets/esri/core/workers/chunks/90771b0de3e520a1df9a.js +1 -0
- package/assets/esri/core/workers/chunks/94188fe381239d48a975.js +1 -0
- package/assets/esri/core/workers/chunks/a277c980ba8704939688.js +1 -0
- package/assets/esri/core/workers/chunks/b1746c022fe6edaeda55.js +1 -0
- package/assets/esri/core/workers/chunks/b449d6bd5851187d419f.js +1 -0
- package/assets/esri/core/workers/chunks/bbc0dcd316c5598bc9ad.js +1 -0
- package/assets/esri/core/workers/chunks/bc1dc6383e60e7e61d50.js +1 -0
- package/assets/esri/core/workers/chunks/bc6323bdc98013da6fe5.js +1 -0
- package/assets/esri/core/workers/chunks/bde89b2684b6185992ef.js +1 -0
- package/assets/esri/core/workers/chunks/c4bb67150ccd01ea6014.js +1 -0
- package/assets/esri/core/workers/chunks/{727548fffd4e270617d3.js → c6ea5aac232d1eca04dd.js} +1 -1
- package/assets/esri/core/workers/chunks/c8438c2d9ac48afe4033.js +1 -0
- package/assets/esri/core/workers/chunks/c9dfb145f0c1d93e0fbd.js +1 -0
- package/assets/esri/core/workers/chunks/cad260881653567bc8f9.js +1 -0
- package/assets/esri/core/workers/chunks/cec607d0138351a4952e.js +1 -0
- package/assets/esri/core/workers/chunks/d24afa6d8fd0061d9f00.js +1 -0
- package/assets/esri/core/workers/chunks/{f147269d85adfb4588ed.js → d9061beaa43065316062.js} +1 -1
- package/assets/esri/core/workers/chunks/dd7508d4016715371e0c.js +1 -0
- package/assets/esri/core/workers/chunks/dff1c3c38dda2bd1a9d6.js +1 -0
- package/assets/esri/core/workers/chunks/e55f7fc7eff0074ce0fc.js +1 -0
- package/assets/esri/core/workers/chunks/eb01f4cdb9b918cc61e7.js +1 -0
- package/assets/esri/core/workers/chunks/ec8258c9dc1491e97fc8.js +1 -0
- package/assets/esri/core/workers/chunks/ed1fbc1bc8d50453e2f5.js +1 -0
- package/assets/esri/core/workers/chunks/eeac53da496de4cd4182.js +1 -0
- package/assets/esri/core/workers/chunks/eef27d305023034084a4.js +1 -0
- package/assets/esri/core/workers/chunks/f38c54ada9e7012a2960.js +1 -0
- package/assets/esri/core/workers/chunks/f508ccfde6425dabe9ac.js +1 -0
- package/assets/esri/core/workers/chunks/f5e0ff5292b9fd18fc92.js +1 -0
- package/assets/esri/core/workers/chunks/f5eb8b5021620be7538e.js +1 -0
- package/assets/esri/images/portal/onlinemedialayer16.png +0 -0
- package/assets/esri/themes/base/widgets/_FeatureForm.scss +2 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ar.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bg.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bs.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ca.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_cs.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_da.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_de.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_el.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_en.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_es.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_et.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fi.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_he.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hu.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_id.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_it.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ja.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ko.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lt.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lv.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_nb.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_nl.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pl.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-BR.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-PT.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ro.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ru.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sk.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sl.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sv.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_th.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_tr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_uk.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_vi.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-CN.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-HK.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-TW.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ar.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bg.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ca.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_cs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_da.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_de.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_el.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_en.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_es.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_et.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_he.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hu.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_id.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_it.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ja.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ko.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lt.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nb.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-BR.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-PT.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ro.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ru.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_th.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_tr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_uk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_vi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-CN.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-HK.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-TW.json +1 -1
- package/chunks/LaserlinePath.glsl.js +5 -1
- package/core/HandleOwner.js +1 -1
- package/core/MemCache.js +1 -1
- package/core/date.js +5 -0
- package/core/sql.js +1 -1
- package/core/string.js +1 -1
- package/interfaces.d.ts +60 -43
- package/intl/date.js +1 -1
- package/layers/GeoJSONLayer.js +1 -1
- package/layers/ImageryLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/WFSLayer.js +1 -1
- package/layers/graphics/sources/GeoJSONSource.js +1 -1
- package/layers/graphics/sources/MemorySource.js +1 -1
- package/layers/graphics/sources/WFSSource.js +1 -1
- package/layers/graphics/sources/WFSSourceWorker.js +1 -1
- package/layers/graphics/sources/csv/csv.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/geojson/geojson.js +1 -1
- package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/{views/interactive/tooltip/tooltipInfoUnion.js → layers/graphics/sources/support/QueryEngineBuildLayer.js} +1 -0
- package/layers/graphics/sources/support/sourceUtils.js +1 -1
- package/layers/mixins/SceneService.js +1 -1
- package/layers/ogc/wfsUtils.js +1 -1
- package/layers/save/utils.js +1 -1
- package/layers/support/editableLayers.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/labelFormatUtils.js +1 -1
- package/layers/support/layersCreator.js +1 -1
- package/layers/support/rasterFunctionUtils.js +1 -1
- package/layers/support/rasterFunctions/creators/createBandIndexFunctions.js +1 -1
- package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +1 -1
- package/layers/support/rasterFunctions/creators/createLocalFunctions.js +1 -1
- package/networks/support/utils.js +1 -1
- package/package.json +1 -1
- package/portal/PortalItem.js +1 -1
- package/portal/support/layersLoader.js +1 -1
- package/rest/geometryService/cut.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/versionManagement/deleteVersion.js +1 -1
- package/rest/versionManagement/gdbVersion/alterVersion.js +1 -1
- package/rest/versionManagement/gdbVersion/post.js +1 -1
- package/rest/versionManagement/gdbVersion/reconcile.js +1 -1
- package/rest/versionManagement/gdbVersion/serverVersionUtils.js +5 -0
- package/support/revision.js +1 -1
- package/time/timeZoneUtils.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/webgl/mesh/factories/WGLMeshFactory.js +1 -1
- package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
- package/views/2d/layers/features/sources/DataTileSource.js +1 -1
- package/views/2d/layers/features/sources/StreamSource.js +1 -1
- package/views/2d/layers/features/support/whereUtils.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
- package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/LocalAtmosphere.js +1 -1
- package/views/3d/externalRenderers/StageRenderer.js +1 -1
- package/views/3d/interactive/manipulatorUtils.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/graphics/wosrLoader.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/overlayImageUtils.js +1 -1
- package/views/3d/layers/support/patternUtils.js +1 -1
- package/views/3d/support/LaserLineRenderer.js +1 -1
- package/views/3d/support/StreamDataLoader.js +1 -1
- package/views/3d/support/dito.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/hud/AlignPixel.glsl.js +10 -12
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDVisibility.glsl.js +8 -21
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/Attribute.js +1 -1
- package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
- package/views/3d/webgl-engine/lib/Camera.js +1 -1
- package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.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/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/materials/internal/MaterialUtil.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/View.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/support/HighlightHelper.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/layerUtils.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/keybindings.js +1 -1
- package/views/interactive/tooltip/SketchTooltipInfo.js +1 -1
- package/views/interactive/tooltip/TooltipContentWithHelpMessage.js +1 -1
- package/views/interactive/tooltip/TooltipEditableField.js +1 -1
- package/views/interactive/tooltip/TranslateTooltipInfos.js +1 -1
- package/views/interactive/tooltip/content/Fields.js +5 -0
- package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/webdoc/saveAPIKeyUtils.js +5 -0
- package/webdoc/webdocSaveUtils.js +1 -1
- package/widgets/BasemapGallery.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Feature/FeatureRelationship.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureForm/EditableInput.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/RelationshipInput.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
- package/widgets/Fullscreen.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/Swipe.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace/support/ResultAreaHandler.js +1 -1
- package/widgets/UtilityNetworkTrace/support/UtilityHelper.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/support/SketchTooltipControls.js +1 -1
- package/widgets/support/globalCss.js +1 -1
- package/assets/esri/core/workers/chunks/0274b84548cb048562e4.js +0 -1
- package/assets/esri/core/workers/chunks/034accc7cab6c88a3b31.js +0 -1
- package/assets/esri/core/workers/chunks/0839b45999fcb556e460.js +0 -1
- package/assets/esri/core/workers/chunks/09589852b129bfb5624f.js +0 -1
- package/assets/esri/core/workers/chunks/132e9e6147304ffd128d.js +0 -1
- package/assets/esri/core/workers/chunks/1790ca4193d730f5f206.js +0 -1
- package/assets/esri/core/workers/chunks/1a449168d30a688e6128.js +0 -1
- package/assets/esri/core/workers/chunks/1c94624fd001c803a814.js +0 -1
- package/assets/esri/core/workers/chunks/25ab3bec45de900be36e.js +0 -1
- package/assets/esri/core/workers/chunks/273167b2dd46e58b8739.js +0 -1
- package/assets/esri/core/workers/chunks/2c5eb8aaad696fa16744.js +0 -1
- package/assets/esri/core/workers/chunks/353bad8530710a284592.js +0 -1
- package/assets/esri/core/workers/chunks/357d452b8522185cc433.js +0 -1
- package/assets/esri/core/workers/chunks/3c2be3d204e6bf87266a.js +0 -1
- package/assets/esri/core/workers/chunks/3c2c64832fb498bbaa83.js +0 -1
- package/assets/esri/core/workers/chunks/3c4d59018ce8502c65e7.js +0 -1
- package/assets/esri/core/workers/chunks/43eff89599f36d83924b.js +0 -1
- package/assets/esri/core/workers/chunks/4632ada4af99cab70a61.js +0 -1
- package/assets/esri/core/workers/chunks/481eab7879ed5d8a1f67.js +0 -1
- package/assets/esri/core/workers/chunks/4b3a5cc435435c81e6a5.js +0 -1
- package/assets/esri/core/workers/chunks/4f34fd8c2bb769541e9c.js +0 -1
- package/assets/esri/core/workers/chunks/4f5a0bc7411c0db33662.js +0 -1
- package/assets/esri/core/workers/chunks/56a4cea67cc579bf7547.js +0 -1
- package/assets/esri/core/workers/chunks/56afd89d08c874f620a1.js +0 -1
- package/assets/esri/core/workers/chunks/5b08d578521562b166e3.js +0 -1
- package/assets/esri/core/workers/chunks/5f938d6da9fd3f3edc74.js +0 -1
- package/assets/esri/core/workers/chunks/6108d72faf48a592c8ba.js +0 -1
- package/assets/esri/core/workers/chunks/656a8be4ce1bec721366.js +0 -1
- package/assets/esri/core/workers/chunks/7531ebc60e9ae61220e0.js +0 -1
- package/assets/esri/core/workers/chunks/77923afde29ae1ff10ca.js +0 -1
- package/assets/esri/core/workers/chunks/79683324be49aab79dd8.js +0 -1
- package/assets/esri/core/workers/chunks/7cdb4416afd5922cf5f3.js +0 -1
- package/assets/esri/core/workers/chunks/7e87bc83a0a2715e3016.js +0 -1
- package/assets/esri/core/workers/chunks/7f680cf24dd97d61bcd2.js +0 -1
- package/assets/esri/core/workers/chunks/7f797fed73cf7b48a686.js +0 -1
- package/assets/esri/core/workers/chunks/861609ebd3a77b787b0f.js +0 -1
- package/assets/esri/core/workers/chunks/869c3927f1e246cd1e42.js +0 -1
- package/assets/esri/core/workers/chunks/95371c0f5464f5daae9f.js +0 -1
- package/assets/esri/core/workers/chunks/962b99fd273709c726d3.js +0 -1
- package/assets/esri/core/workers/chunks/98fbcbb2115376d7ff62.js +0 -1
- package/assets/esri/core/workers/chunks/9abcd1d11bfd92f872ab.js +0 -1
- package/assets/esri/core/workers/chunks/9b54b5bdb6367c36f6e9.js +0 -1
- package/assets/esri/core/workers/chunks/9dab9f6c07ececa7f851.js +0 -1
- package/assets/esri/core/workers/chunks/9ff6ce486898713af7e2.js +0 -1
- package/assets/esri/core/workers/chunks/a98a435d4dbea73f7517.js +0 -1
- package/assets/esri/core/workers/chunks/b05bb6e784e5453696be.js +0 -1
- package/assets/esri/core/workers/chunks/b51d0ec283f61f638a48.js +0 -1
- package/assets/esri/core/workers/chunks/b5ee6c0c07fa50410370.js +0 -1
- package/assets/esri/core/workers/chunks/b9cf8f02974aeb3ce208.js +0 -1
- package/assets/esri/core/workers/chunks/bdf13091bd0e1ab0db7e.js +0 -1
- package/assets/esri/core/workers/chunks/bef1a1218a94ab6e2b51.js +0 -1
- package/assets/esri/core/workers/chunks/c22c2b15fe5f2c97a2ae.js +0 -1
- package/assets/esri/core/workers/chunks/c880d2f0ff06b3bf731f.js +0 -1
- package/assets/esri/core/workers/chunks/c88869d2a647c22dc3e6.js +0 -1
- package/assets/esri/core/workers/chunks/cc96be71fee49f07dcd4.js +0 -1
- package/assets/esri/core/workers/chunks/e4237360eef474d1f0ac.js +0 -1
- package/assets/esri/core/workers/chunks/e54ae2a4281dd58e0707.js +0 -1
- package/assets/esri/core/workers/chunks/e977e721f6f50e3c5f13.js +0 -1
- package/assets/esri/core/workers/chunks/ed31cf6688c0f7dac1f9.js +0 -1
- package/assets/esri/core/workers/chunks/f07a0ea10428adecea1a.js +0 -1
- package/assets/esri/core/workers/chunks/f1eab5c67ed808c18f86.js +0 -1
- package/assets/esri/core/workers/chunks/f2e7142a8db164940544.js +0 -1
- package/assets/esri/core/workers/chunks/f939b4166f76975f5da0.js +0 -1
- package/assets/esri/core/workers/chunks/ff4f4107a866e4a68386.js +0 -1
- package/layers/ogc/dateUtils.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{destroyMaybe as t}from"../../core/maybe.js";import{after as s}from"../../core/promiseUtils.js";import{watch as r,initial as i,on as o}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import{cast as l}from"../../core/accessorSupport/decorators/cast.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import d from"../Widget.js";import c from"./FeatureRelationship/FeatureRelationshipViewModel.js";import u from"./support/FeatureElementInfo.js";import{loadCalciteComponents as h}from"../support/componentsUtils.js";import{globalCss as p}from"../support/globalCss.js";import{legacyIcon as m}from"../support/legacyIcon.js";import{isRTL as v}from"../support/widgetUtils.js";import{messageBundle as _}from"../support/decorators/messageBundle.js";import{tsx as g}from"../support/jsxFactory.js";import{substitute as w}from"../../intl/substitute.js";const f="esri-feature",b=`${f}-relationship`,y={base:b,listContainer:`${b}__list`,listItem:`${b}__list-item`,listItemHidden:`${b}__list-item--hidden`,listContainerQuerying:`${b}__list--querying`,featureObserver:`${f}__feature-observer`,stickySpinnerContainer:`${f}__sticky-loading-container`,loadingSpinnerContainer:`${f}__loading-container`,spinner:`${f}__loading-spinner`},F={title:!0,description:!0};let I=class extends d{constructor(e,t){super(e,t),this._featureElementInfo=null,this._relatedFeatureIntersectionObserverNode=null,this._relatedFeatureIntersectionObserver=new IntersectionObserver((([e])=>{e?.isIntersecting&&this._increaseFeaturePage()}),{root:window.document}),this.headingLevel=2,this.viewModel=new c,this.messages=null,this.messagesCommon=null,this.visibleElements={...F},this._increaseFeaturePage=()=>{const{state:e,showAllEnabled:t,relatedFeatures:s,featuresPerPage:r,featurePage:i}=this.viewModel;"ready"===e&&t&&s.length>=r*i&&this.viewModel.featurePage++}}initialize(){this._featureElementInfo=new u,this.addHandles([r((()=>[this.viewModel.description,this.viewModel.title,this.headingLevel]),(()=>this._setupFeatureElementInfo()),i),r((()=>[this.viewModel.state,this.viewModel.showAllEnabled,this._relatedFeatureIntersectionObserverNode]),(()=>this._handleRelatedFeatureObserverChange())),o((()=>this.viewModel.relatedFeatureViewModels),"change",(()=>this._setupRelatedFeatureViewModels()))])}loadDependencies(){return h({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js")})}destroy(){this._unobserveRelatedFeatureObserver(),this._featureElementInfo=t(this._featureElementInfo)}get displayShowAllButton(){const{showAllEnabled:e,featureCount:t,displayCount:s,state:r}=this.viewModel;return!e&&!!t&&"ready"===r&&(t>s||0===s)}get displayListItems(){return this.displayShowAllButton||this.viewModel.relatedFeatureViewModels.length>0}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get featureCountDescription(){const{messages:e}=this,{featureCount:t}=this.viewModel;return w(e?.numberRecords,{number:t})}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}castVisibleElements(e){return{...F,...e}}render(){const{state:e}=this.viewModel;return g("div",{class:this.classes(y.base,p.widget)},this._featureElementInfo?.render(),"loading"===e?this._renderLoading():"disabled"===e?this._renderRelationshipNotFound():this._renderRelatedFeatures())}_renderStickyLoading(){return"querying"===this.viewModel.state?g("div",{key:"sticky-loader",class:y.stickySpinnerContainer},this._renderLoadingIcon()):null}_renderLoadingIcon(){return g("span",{class:this.classes(m.loadingIndicator,y.spinner)})}_renderLoading(){return g("div",{key:"loading-container",class:y.loadingSpinnerContainer},this._renderLoadingIcon())}_renderShowAllIconNode(){return g("calcite-icon",{scale:"s",icon:"list",slot:"content-end"})}_renderChevronIconNode(){const e=v(this.container)?"chevron-left":"chevron-right";return g("calcite-icon",{scale:"s",icon:e,slot:"content-end"})}_renderRelatedFeature(e){const{itemDescriptionFieldName:t}=this.viewModel,s=e.title;e.description=t&&e.formattedAttributes?.global[t];const r="loading"===e.state;return g("calcite-list-item",{class:this.classes(y.listItem,{[y.listItemHidden]:r}),key:e.uid,label:s,description:e.description??"",onCalciteListItemSelect:()=>this.emit("select-record",{featureViewModel:e})},this._renderChevronIconNode())}_renderShowAllListItem(){return this.displayShowAllButton?g("calcite-list-item",{key:"show-all-item",label:this.messages?.showAll,description:this.featureCountDescription,onCalciteListItemSelect:()=>this.emit("show-all-records")},this._renderShowAllIconNode()):null}_renderNoRelatedFeaturesMessage(){return g("calcite-notice",{key:"no-related-features-message",icon:"information",open:!0,kind:"brand",scale:"s",width:"full"},g("div",{slot:"message"},this.messages?.noRelatedFeatures))}_renderFeatureObserver(){return g("div",{key:"feature-observer",class:y.featureObserver,bind:this,afterCreate:this._relatedFeatureIntersectionObserverCreated})}_renderList(){const{relatedFeatureViewModels:e}=this.viewModel;return g("calcite-list",null,e.toArray().map((e=>this._renderRelatedFeature(e))),this._renderShowAllListItem())}_renderRelatedFeatures(){const{displayListItems:e}=this,{state:t}=this.viewModel;return g("div",{key:"list-container",class:this.classes(y.listContainer,{[y.listContainerQuerying]:"querying"===t})},e?this._renderList():"ready"===t?this._renderNoRelatedFeaturesMessage():null,this._renderStickyLoading(),this._renderFeatureObserver())}_renderRelationshipNotFound(){return g("calcite-notice",{key:"relationship-not-found",icon:"exclamation-mark-triangle",open:!0,kind:"danger",scale:"s",width:"full"},g("div",{slot:"message"},this.messages?.relationshipNotFound))}_setupRelatedFeatureViewModels(){const{relatedFeatureViewModels:e}=this.viewModel,t="related-feature-viewmodels";this.removeHandles(t),e?.forEach((e=>{this.addHandles(r((()=>[e.title,e.state]),(()=>this.scheduleRender()),i),t)})),this.scheduleRender()}_setupFeatureElementInfo(){const{headingLevel:e,visibleElements:t}=this,s=t.description&&this.description,r=t.title&&this.title;this._featureElementInfo?.set({description:s,title:r,headingLevel:e})}async _handleRelatedFeatureObserverChange(){this._unobserveRelatedFeatureObserver();const{state:e,showAllEnabled:t}=this.viewModel;await s(0),this._relatedFeatureIntersectionObserverNode&&"ready"===e&&t&&this._relatedFeatureIntersectionObserver.observe(this._relatedFeatureIntersectionObserverNode)}_relatedFeatureIntersectionObserverCreated(e){this._relatedFeatureIntersectionObserverNode=e}_unobserveRelatedFeatureObserver(){this._relatedFeatureIntersectionObserverNode&&this._relatedFeatureIntersectionObserver.unobserve(this._relatedFeatureIntersectionObserverNode)}};e([n()],I.prototype,"_relatedFeatureIntersectionObserverNode",void 0),e([n({readOnly:!0})],I.prototype,"displayShowAllButton",null),e([n({readOnly:!0})],I.prototype,"displayListItems",null),e([n()],I.prototype,"description",null),e([n({readOnly:!0})],I.prototype,"featureCountDescription",null),e([n()],I.prototype,"headingLevel",void 0),e([n()],I.prototype,"title",null),e([n({type:c})],I.prototype,"viewModel",void 0),e([n(),_("esri/widgets/Feature/t9n/Feature")],I.prototype,"messages",void 0),e([n(),_("esri/t9n/common")],I.prototype,"messagesCommon",void 0),e([n()],I.prototype,"visibleElements",void 0),e([l("visibleElements")],I.prototype,"castVisibleElements",null),I=e([a("esri.widgets.Feature.FeatureRelationship")],I);const M=I;export{M as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{destroyMaybe as t}from"../../core/maybe.js";import{after as s}from"../../core/promiseUtils.js";import{watch as r,initial as i,on as o}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import{cast as l}from"../../core/accessorSupport/decorators/cast.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import d from"../Widget.js";import c from"./FeatureRelationship/FeatureRelationshipViewModel.js";import u from"./support/FeatureElementInfo.js";import{loadCalciteComponents as h}from"../support/componentsUtils.js";import{globalCss as p}from"../support/globalCss.js";import{legacyIcon as m}from"../support/legacyIcon.js";import{isRTL as v}from"../support/widgetUtils.js";import{messageBundle as _}from"../support/decorators/messageBundle.js";import{tsx as g}from"../support/jsxFactory.js";import{substitute as w}from"../../intl/substitute.js";const f="esri-feature",b=`${f}-relationship`,y={base:b,listContainer:`${b}__list`,listItem:`${b}__list-item`,listItemHidden:`${b}__list-item--hidden`,listContainerQuerying:`${b}__list--querying`,featureObserver:`${f}__feature-observer`,stickySpinnerContainer:`${f}__sticky-loading-container`,loadingSpinnerContainer:`${f}__loading-container`,spinner:`${f}__loading-spinner`},F={title:!0,description:!0};let I=class extends d{constructor(e,t){super(e,t),this._featureElementInfo=null,this._relatedFeatureIntersectionObserverNode=null,this._relatedFeatureIntersectionObserver=new IntersectionObserver((([e])=>{e?.isIntersecting&&this._increaseFeaturePage()}),{root:window.document}),this.headingLevel=2,this.viewModel=new c,this.messages=null,this.messagesCommon=null,this.visibleElements={...F},this._increaseFeaturePage=()=>{const{state:e,showAllEnabled:t,relatedFeatures:s,featuresPerPage:r,featurePage:i}=this.viewModel;"ready"===e&&t&&s.length>=r*i&&this.viewModel.featurePage++}}initialize(){this._featureElementInfo=new u,this.addHandles([r((()=>[this.viewModel.description,this.viewModel.title,this.headingLevel]),(()=>this._setupFeatureElementInfo()),i),r((()=>[this.viewModel.state,this.viewModel.showAllEnabled,this._relatedFeatureIntersectionObserverNode]),(()=>this._handleRelatedFeatureObserverChange())),o((()=>this.viewModel.relatedFeatureViewModels),"change",(()=>this._setupRelatedFeatureViewModels()))])}loadDependencies(){return h({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js")})}destroy(){this._unobserveRelatedFeatureObserver(),this._featureElementInfo=t(this._featureElementInfo)}get displayShowAllButton(){const{showAllEnabled:e,featureCount:t,displayCount:s,state:r}=this.viewModel;return!e&&!!t&&"ready"===r&&(t>s||0===s)}get displayListItems(){return this.displayShowAllButton||this.viewModel.relatedFeatureViewModels.length>0}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get featureCountDescription(){const{messages:e}=this,{featureCount:t}=this.viewModel;return w(e?.numberRecords,{number:t})}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}castVisibleElements(e){return{...F,...e}}render(){const{state:e}=this.viewModel;return g("div",{class:this.classes(y.base,p.widget)},this._featureElementInfo?.render(),"loading"===e?this._renderLoading():"disabled"===e?this._renderRelationshipNotFound():this._renderRelatedFeatures())}_renderStickyLoading(){return"querying"===this.viewModel.state?g("div",{key:"sticky-loader",class:y.stickySpinnerContainer},this._renderLoadingIcon()):null}_renderLoadingIcon(){return g("span",{class:this.classes(m.loadingIndicator,p.rotating,y.spinner)})}_renderLoading(){return g("div",{key:"loading-container",class:y.loadingSpinnerContainer},this._renderLoadingIcon())}_renderShowAllIconNode(){return g("calcite-icon",{scale:"s",icon:"list",slot:"content-end"})}_renderChevronIconNode(){const e=v(this.container)?"chevron-left":"chevron-right";return g("calcite-icon",{scale:"s",icon:e,slot:"content-end"})}_renderRelatedFeature(e){const{itemDescriptionFieldName:t}=this.viewModel,s=e.title;e.description=t&&e.formattedAttributes?.global[t];const r="loading"===e.state;return g("calcite-list-item",{class:this.classes(y.listItem,{[y.listItemHidden]:r}),key:e.uid,label:s,description:e.description??"",onCalciteListItemSelect:()=>this.emit("select-record",{featureViewModel:e})},this._renderChevronIconNode())}_renderShowAllListItem(){return this.displayShowAllButton?g("calcite-list-item",{key:"show-all-item",label:this.messages?.showAll,description:this.featureCountDescription,onCalciteListItemSelect:()=>this.emit("show-all-records")},this._renderShowAllIconNode()):null}_renderNoRelatedFeaturesMessage(){return g("calcite-notice",{key:"no-related-features-message",icon:"information",open:!0,kind:"brand",scale:"s",width:"full"},g("div",{slot:"message"},this.messages?.noRelatedFeatures))}_renderFeatureObserver(){return g("div",{key:"feature-observer",class:y.featureObserver,bind:this,afterCreate:this._relatedFeatureIntersectionObserverCreated})}_renderList(){const{relatedFeatureViewModels:e}=this.viewModel;return g("calcite-list",null,e.toArray().map((e=>this._renderRelatedFeature(e))),this._renderShowAllListItem())}_renderRelatedFeatures(){const{displayListItems:e}=this,{state:t}=this.viewModel;return g("div",{key:"list-container",class:this.classes(y.listContainer,{[y.listContainerQuerying]:"querying"===t})},e?this._renderList():"ready"===t?this._renderNoRelatedFeaturesMessage():null,this._renderStickyLoading(),this._renderFeatureObserver())}_renderRelationshipNotFound(){return g("calcite-notice",{key:"relationship-not-found",icon:"exclamation-mark-triangle",open:!0,kind:"danger",scale:"s",width:"full"},g("div",{slot:"message"},this.messages?.relationshipNotFound))}_setupRelatedFeatureViewModels(){const{relatedFeatureViewModels:e}=this.viewModel,t="related-feature-viewmodels";this.removeHandles(t),e?.forEach((e=>{this.addHandles(r((()=>[e.title,e.state]),(()=>this.scheduleRender()),i),t)})),this.scheduleRender()}_setupFeatureElementInfo(){const{headingLevel:e,visibleElements:t}=this,s=t.description&&this.description,r=t.title&&this.title;this._featureElementInfo?.set({description:s,title:r,headingLevel:e})}async _handleRelatedFeatureObserverChange(){this._unobserveRelatedFeatureObserver();const{state:e,showAllEnabled:t}=this.viewModel;await s(0),this._relatedFeatureIntersectionObserverNode&&"ready"===e&&t&&this._relatedFeatureIntersectionObserver.observe(this._relatedFeatureIntersectionObserverNode)}_relatedFeatureIntersectionObserverCreated(e){this._relatedFeatureIntersectionObserverNode=e}_unobserveRelatedFeatureObserver(){this._relatedFeatureIntersectionObserverNode&&this._relatedFeatureIntersectionObserver.unobserve(this._relatedFeatureIntersectionObserverNode)}};e([n()],I.prototype,"_relatedFeatureIntersectionObserverNode",void 0),e([n({readOnly:!0})],I.prototype,"displayShowAllButton",null),e([n({readOnly:!0})],I.prototype,"displayListItems",null),e([n()],I.prototype,"description",null),e([n({readOnly:!0})],I.prototype,"featureCountDescription",null),e([n()],I.prototype,"headingLevel",void 0),e([n()],I.prototype,"title",null),e([n({type:c})],I.prototype,"viewModel",void 0),e([n(),_("esri/widgets/Feature/t9n/Feature")],I.prototype,"messages",void 0),e([n(),_("esri/t9n/common")],I.prototype,"messagesCommon",void 0),e([n()],I.prototype,"visibleElements",void 0),e([l("visibleElements")],I.prototype,"castVisibleElements",null),I=e([a("esri.widgets.Feature.FeatureRelationship")],I);const M=I;export{M as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Logger.js";import{replace as t}from"../../../core/string.js";import{formatDate as n,convertDateFormatToIntlOptions as r,utcTimeZone as i,formatTimestamp as o,formatTimeOnly as a,formatDateOnly as l}from"../../../intl/date.js";import{formatNumber as u,convertNumberFormatToIntlOptions as s}from"../../../intl/number.js";import{isRasterPixelValueField as f,featureHasFields as c}from"../../../layers/support/fieldUtils.js";import{isFeatureLayer as d,getEffectiveLayerCapabilities as p}from"../../../layers/support/layerUtils.js";import{loadArcade as y}from"../../../support/arcadeOnDemand.js";const m="esri.widgets.Feature.support.featureUtils",g=e.getLogger(m),h=/href=(""|'')/gi,I=/(\{([^\{\r\n]+)\})/g,b=/\'/g,F=/^\s*expression\//i,w=/(\n)/gi,N=/[\u00A0-\u9999<>\&]/gim,j=/href\s*=\s*(?:\"([^\"]+)\"|\'([^\']+)\')/gi,E=/^(?:mailto:|tel:)/,T="relationships/",x=r("short-date-short-time");function C(e){if(null!=e)return(e.sourceLayer||e.layer)??void 0}async function q(e,t){return"function"==typeof e?e(t):e}function A(e=""){if(e)return!E.test(e.trim().toLowerCase())}function M(e){return!!e&&F.test(e)}function v(e,t){if(!M(t)||!e)return null;const n=t.replace(F,"").toLowerCase();let r=null;return e.some((e=>e.name.toLowerCase()===n&&(r=e,!0))),r}function L(e,t){const n=v(t,e?.fieldName);return n?n.title||null:e?e.label||e.fieldName:null}function R(e,t){const n=t.get(e.toLowerCase());return`{${n&&n.fieldName||e}}`}function Z(e){return e.replaceAll(h,"")}function $(e,t){const n=U(t,e);return n?n.name:e}function D(e,t){return e&&e.map((e=>$(e,t)))}function U(e,t){return e&&"function"==typeof e.getField&&t?e.getField(t)??null:null}function G(e){return`${e}`.trim()}function O({attributes:e,globalAttributes:t,layer:n,text:r,expressionAttributes:i,fieldInfoMap:o}){return r?k({formattedAttributes:t,template:z(r,{...t,...i,...e},n),fieldInfoMap:o}):""}function k({formattedAttributes:e,template:n,fieldInfoMap:r}){return G(Z(t(t(n,(e=>R(e,r))),e)))}function S(e,t,n=!1){const r=t[e];if("string"==typeof r){const i="%27",o=(n?encodeURIComponent(r):r).replaceAll(b,i);t[e]=o}}function P(e,t=!1){const n={...e};return Object.keys(n).forEach((e=>S(e,n,t))),n}function Q(e,n,r){const i=(n=G(n))&&"{"!==n[0];return t(e,P(r,i||!1))}function _(e,t){return e.replaceAll(I,((e,n,r)=>{const i=U(t,r);return i?`{${i.name}}`:n}))}function z(e,t,n){const r=_(e,n);return r?r.replaceAll(j,((e,n,r)=>Q(e,n||r,t))):r}function H(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function B(e){return null!=e&&"object"==typeof e&&"layer"in e&&!!e.layer}function J(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-image"===e.type}function K(e){return null!=e&&"object"==typeof e&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&("feature"===e.type||"scene"===e.type)&&"when"in e}function V(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function W(e){return K(e)&&V(e)}function X(e){return!!e&&"object"==typeof e&&"sourceLayer"in e&&W(e.sourceLayer)}function Y(e,t){const{fieldInfos:c,fieldName:p,preventPlacesFormatting:y,layer:m,timeZone:g}=t,h=ne(c,p),I=U(m,p);if(h&&!f(p)){const t=I?.type,u=h.format?.dateFormat;if("date"===t||"date-only"===t||"time-only"===t||"timestamp-offset"===t||u){if("number"==typeof e){const t=!B(m)&&d(m)&&m.datesInUnknownTimezone||B(m)&&J(m.layer)&&m.layer.datesInUnknownTimezone;return n(e,{...r(u??"short-date-short-time"),timeZone:t?i.timeZone:g})}switch(t){case"date-only":return l(e,u?r(u):void 0);case"time-only":return a(e,u?r(u):void 0);case"timestamp-offset":return o(e,u?r(u):void 0)}}}const b=h?.format;return"string"==typeof e&&f(p)&&b?ee(e,b):"string"==typeof(e=H(e,b))||null==e||null==b?se(e):u(e,y?{...s(b),minimumFractionDigits:0,maximumFractionDigits:20}:s(b))}function ee(e,t){return e=e.trim(),/\d{2}-\d{2}/.test(e)?e:e.includes(",")?te(e,",",", ",t):e.includes(";")?te(e,";","; ",t):e.includes(" ")?te(e," "," ",t):u(Number(e),s(t))}function te(e,t,n,r){return e.trim().split(t).map((e=>u(Number(e),s(r)))).join(n)}function ne(e,t){if(e&&e.length&&t)return e.find((e=>e.fieldName?.toLowerCase()===t.toLowerCase()))}function re({fieldName:e,graphic:t,layer:n}){if(me(e))return null;if(!n||"function"!=typeof n.getFeatureType)return null;const{typeIdField:r}=n;if(!r||e!==r)return null;const i=n.getFeatureType(t);return i?i.name:null}function ie({fieldName:e,value:t,graphic:n,layer:r}){if(me(e))return null;if(!r||"function"!=typeof r.getFieldDomain)return null;const i=n&&r.getFieldDomain(e,{feature:n});return i&&"coded-value"===i.type?i.getName(t):null}function oe(e,t){const{creatorField:r,creationDateField:i,editorField:o,editDateField:a}=e;if(!t)return;const l=t[a];if("number"==typeof l){const e=t[o];return{type:"edit",date:n(l,x),user:e}}const u=t[i];if("number"==typeof u){const e=t[r];return{type:"create",date:n(u,x),user:e}}return null}function ae(e,t){const n=new Map;return e?(e.forEach((e=>{const r=$(e.fieldName,t);e.fieldName=r,n.set(r.toLowerCase(),e)})),n):n}function le(e){const t=[];if(!e)return t;const{fieldInfos:n,content:r}=e;return n&&t.push(...n),r&&Array.isArray(r)?(r.forEach((e=>{if("fields"===e.type){const n=e&&e.fieldInfos;n&&t.push(...n)}})),t):t}function ue(e){return e.replaceAll(N,(e=>`&#${e.charCodeAt(0)};`))}function se(e){return"string"==typeof e?e.replaceAll(w,'<br class="esri-text-new-line" />'):e}function fe(e){const{value:t,fieldName:r,fieldInfos:i,fieldInfoMap:u,layer:s,graphic:f,timeZone:c}=e;if(null==t)return"";const d=ie({fieldName:r,value:t,graphic:f,layer:s});if(d)return d;const p=re({fieldName:r,graphic:f,layer:s});if(p)return p;if(u.get(r.toLowerCase()))return Y(t,{fieldInfos:i||Array.from(u.values()),fieldName:r,layer:s,timeZone:c});switch(s?.fieldsIndex?.get(r)?.type){case"date":return n(t);case"date-only":return l(t);case"time-only":return a(t);case"timestamp-offset":return o(t)}return se(t)}function ce({fieldInfos:e,attributes:t,layer:n,graphic:r,fieldInfoMap:i,relatedInfos:o,timeZone:a}){const l={};return o?.forEach((t=>Ie({attributes:l,relatedInfo:t,fieldInfoMap:i,fieldInfos:e,layer:n,timeZone:a}))),t&&Object.keys(t).forEach((o=>{const u=t[o];l[o]=fe({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:n,value:u,graphic:r,timeZone:a})})),l}async function de(e,t){const{layer:n,graphic:r,outFields:i,objectIds:o,returnGeometry:a,spatialReference:l}=e,u=o[0];if("number"!=typeof u&&"string"!=typeof u){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:n,graphic:r,objectId:u,requiredFields:i};return g.warn(e,t),null}if(!p(n)?.operations?.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:n,graphic:r,requiredFields:i,returnGeometry:a};return g.warn(e,t),null}const s=n.createQuery();s.objectIds=o,s.outFields=i?.length?i:[n.objectIdField],s.returnGeometry=!!a,s.returnZ=!!a,s.returnM=!!a,s.outSpatialReference=l;return(await n.queryFeatures(s,t)).features[0]}async function pe(e){if(!e.expressionInfos?.length)return!1;const t=await y(),{arcadeUtils:{hasGeometryFunctions:n}}=t;return n(e)}async function ye({graphic:e,popupTemplate:t,layer:n,spatialReference:r},i){if(!n||!t)return;if("function"==typeof n.load&&await n.load(i),!e.attributes)return;const o=e.attributes[n.objectIdField];if(null==o)return;const a=[o],l=await t.getRequiredFields(n.fieldsIndex),u=c(l,e),s=u?[]:l,f=t.returnGeometry||await pe(t);if(u&&!f)return;const d=await de({layer:n,graphic:e,outFields:s,objectIds:a,returnGeometry:f,spatialReference:r},i);d&&(d.geometry&&(e.geometry=d.geometry),d.attributes&&(e.attributes={...e.attributes,...d.attributes}))}function me(e=""){return!!e&&e.includes(T)}function ge(e){return e?`${T}${e.layerId}/${e.fieldName}`:""}function he({attributes:e,graphic:t,relatedInfo:n,fieldInfos:r,fieldInfoMap:i,layer:o,timeZone:a}){e&&t&&n&&Object.keys(t.attributes).forEach((l=>{const u=ge({layerId:n.relation.id.toString(),fieldName:l}),s=t.attributes[l];e[u]=fe({fieldName:u,fieldInfos:r,fieldInfoMap:i,layer:o,value:s,graphic:t,timeZone:a})}))}function Ie({attributes:e,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}){e&&t&&(t.relatedFeatures?.forEach((a=>he({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))),t.relatedStatsFeatures?.forEach((a=>he({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))))}const be=e=>{if(!e)return!1;const t=e.toUpperCase();return t.includes("CURRENT_TIMESTAMP")||t.includes("CURRENT_DATE")||t.includes("CURRENT_TIME")},Fe=({layer:e,method:t,query:n,definitionExpression:r})=>{if(!e.capabilities?.query?.supportsCacheHint||"attachments"===t)return;const i=null!=n.where?n.where:null,o=null!=n.geometry?n.geometry:null;be(r)||be(i)||"extent"===o?.type||"tile"===n.resultType||(n.cacheHint=!0)},we=({query:e,layer:t,method:n})=>{Fe({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})},Ne=({queryPayload:e,layer:t,method:n})=>{Fe({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})};function je(e,t,n){return e&&t&&n?Ee(e.allLayers,t,n)||Ee(e.allTables,t,n):null}function Ee(e,t,n){const r="scene"===t.type&&t.associatedLayer?t.associatedLayer.url:t.url;return e.filter(W).find((e=>e!==t&&e.url===r&&e.layerId===n.relatedTableId))}function Te(e){const t=e.getObjectId();return null!=t?`oid:${t}`:`uid:${e.uid}`}export{se as applyTextFormattingHTML,ae as createfieldInfoMap,je as findRelatedLayer,_ as fixTokens,ce as formatAttributes,oe as formatEditInfo,Y as formatValueToFieldInfo,le as getAllFieldInfos,ne as getFieldInfo,L as getFieldInfoLabel,$ as getFixedFieldName,D as getFixedFieldNames,Te as getHighlightKeyForFeature,C as getSourceLayer,q as graphicCallback,ue as htmlEntities,M as isExpressionField,K as isFeatureSupportedLayer,X as isGraphicForRelatableFeatureSupportedLayer,W as isRelatableFeatureSupportedLayer,V as isRelatableLayer,me as isRelatedField,we as preLayerQueryCallback,Ne as preRequestCallback,de as querySourceLayer,ye as queryUpdatedFeature,A as shouldOpenInNewTab,k as substituteAttributes,O as substituteFieldsInLinksAndAttributes};
|
|
5
|
+
import e from"../../../core/Logger.js";import{replace as t}from"../../../core/string.js";import{formatDate as n,formatTimestamp as r,formatTimeOnly as i,convertDateFormatToIntlOptions as o,formatDateOnly as a}from"../../../intl/date.js";import{formatNumber as l,convertNumberFormatToIntlOptions as u}from"../../../intl/number.js";import{isRasterPixelValueField as s,featureHasFields as f}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as c,isFeatureLayer as d}from"../../../layers/support/layerUtils.js";import{loadArcade as m}from"../../../support/arcadeOnDemand.js";import{utc as p,shortTimeZoneName as y,unknown as g}from"../../../time/timeZoneUtils.js";const h="esri.widgets.Feature.support.featureUtils",I=e.getLogger(h),b=/href=(""|'')/gi,F=/(\{([^\{\r\n]+)\})/g,N=/\'/g,w=/^\s*expression\//i,j=/(\n)/gi,Z=/[\u00A0-\u9999<>\&]/gim,E=/href\s*=\s*(?:\"([^\"]+)\"|\'([^\']+)\')/gi,T=/^(?:mailto:|tel:)/,v="relationships/",x=o("short-date-short-time");function C(e){if(null!=e)return(e.sourceLayer||e.layer)??void 0}async function q(e,t){return"function"==typeof e?e(t):e}function A(e=""){if(e)return!T.test(e.trim().toLowerCase())}function M(e){return!!e&&w.test(e)}function L(e,t){if(!M(t)||!e)return null;const n=t.replace(w,"").toLowerCase();let r=null;return e.some((e=>e.name.toLowerCase()===n&&(r=e,!0))),r}function R(e,t){const n=L(t,e?.fieldName);return n?n.title||null:e?e.label||e.fieldName:null}function $(e,t){const n=t.get(e.toLowerCase());return`{${n&&n.fieldName||e}}`}function D(e){return e.replaceAll(b,"")}function U(e,t){const n=O(t,e);return n?n.name:e}function G(e,t){return e&&e.map((e=>U(e,t)))}function O(e,t){return e&&"function"==typeof e.getField&&t?e.getField(t)??null:null}function S(e){return`${e}`.trim()}function k({attributes:e,globalAttributes:t,layer:n,text:r,expressionAttributes:i,fieldInfoMap:o}){return r?P({formattedAttributes:t,template:B(r,{...t,...i,...e},n),fieldInfoMap:o}):""}function P({formattedAttributes:e,template:n,fieldInfoMap:r}){return S(D(t(t(n,(e=>$(e,r))),e)))}function Q(e,t,n=!1){const r=t[e];if("string"==typeof r){const i="%27",o=(n?encodeURIComponent(r):r).replaceAll(N,i);t[e]=o}}function _(e,t=!1){const n={...e};return Object.keys(n).forEach((e=>Q(e,n,t))),n}function H(e,n,r){const i=(n=S(n))&&"{"!==n[0];return t(e,_(r,i||!1))}function z(e,t){return e.replaceAll(F,((e,n,r)=>{const i=O(t,r);return i?`{${i.name}}`:n}))}function B(e,t,n){const r=z(e,n);return r?r.replaceAll(E,((e,n,r)=>H(e,n||r,t))):r}function J(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function K(e){return null!=e&&"object"==typeof e&&"layer"in e&&!!e.layer}function V(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-image"===e.type}function W(e){return null!=e&&"object"==typeof e&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&("feature"===e.type||"scene"===e.type)&&"when"in e}function X(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function Y(e){return W(e)&&X(e)}function ee(e){return!!e&&"object"==typeof e&&"sourceLayer"in e&&Y(e.sourceLayer)}function te(e,t,n,r){const i=d(e)?e:K(e)&&V(e.layer)?e.layer:void 0,o=i?.datesInUnknownTimezone??!1,a="timestamp-offset"===r?void 0:i?.preferredTimeReference?.timeZone??p,l=t===g,u=n.timeStyle||n.hour;return{timeZone:o?p:l?a:t,timeZoneName:l&&!o&&u?y:void 0}}function ne(e,t){const{fieldInfos:f,fieldName:c,preventPlacesFormatting:d,layer:m,timeZone:p}=t,y=oe(f,c),g=O(m,c);if(y&&!s(c)){const t=g?.type,l=y.format?.dateFormat;if("date"===t||"date-only"===t||"time-only"===t||"timestamp-offset"===t||l){if("number"==typeof e){const r=o(l??"short-date-short-time"),{timeZone:i,timeZoneName:a}=te(m,p,r,t);return n(e,{...r,timeZone:i,timeZoneName:a})}switch(t){case"date-only":return a(e,l?o(l):void 0);case"time-only":return i(e,l?o(l):void 0);case"timestamp-offset":{const n=o(l??"short-date-short-time"),{timeZone:i,timeZoneName:a}=te(m,p,n,t);return r(e,{...n,timeZone:i,timeZoneName:a})}}}}const h=y?.format;return"string"==typeof e&&s(c)&&h?re(e,h):"string"==typeof(e=J(e,h))||null==e||null==h?de(e):l(e,d?{...u(h),minimumFractionDigits:0,maximumFractionDigits:20}:u(h))}function re(e,t){return e=e.trim(),/\d{2}-\d{2}/.test(e)?e:e.includes(",")?ie(e,",",", ",t):e.includes(";")?ie(e,";","; ",t):e.includes(" ")?ie(e," "," ",t):l(Number(e),u(t))}function ie(e,t,n,r){return e.trim().split(t).map((e=>l(Number(e),u(r)))).join(n)}function oe(e,t){if(e&&e.length&&t)return e.find((e=>e.fieldName?.toLowerCase()===t.toLowerCase()))}function ae({fieldName:e,graphic:t,layer:n}){if(Ie(e))return null;if(!n||"function"!=typeof n.getFeatureType)return null;const{typeIdField:r}=n;if(!r||e!==r)return null;const i=n.getFeatureType(t);return i?i.name:null}function le({fieldName:e,value:t,graphic:n,layer:r}){if(Ie(e))return null;if(!r||"function"!=typeof r.getFieldDomain)return null;const i=n&&r.getFieldDomain(e,{feature:n});return i&&"coded-value"===i.type?i.getName(t):null}function ue(e,t){const{creatorField:r,creationDateField:i,editorField:o,editDateField:a}=e;if(!t)return;const l=t[a];if("number"==typeof l){const e=t[o];return{type:"edit",date:n(l,x),user:e}}const u=t[i];if("number"==typeof u){const e=t[r];return{type:"create",date:n(u,x),user:e}}return null}function se(e,t){const n=new Map;return e?(e.forEach((e=>{const r=U(e.fieldName,t);e.fieldName=r,n.set(r.toLowerCase(),e)})),n):n}function fe(e){const t=[];if(!e)return t;const{fieldInfos:n,content:r}=e;return n&&t.push(...n),r&&Array.isArray(r)?(r.forEach((e=>{if("fields"===e.type){const n=e&&e.fieldInfos;n&&t.push(...n)}})),t):t}function ce(e){return e.replaceAll(Z,(e=>`&#${e.charCodeAt(0)};`))}function de(e){return"string"==typeof e?e.replaceAll(j,'<br class="esri-text-new-line" />'):e}function me(e){const{value:t,fieldName:o,fieldInfos:l,fieldInfoMap:u,layer:s,graphic:f,timeZone:c}=e;if(null==t)return"";const d=le({fieldName:o,value:t,graphic:f,layer:s});if(d)return d;const m=ae({fieldName:o,graphic:f,layer:s});if(m)return m;if(u.get(o.toLowerCase()))return ne(t,{fieldInfos:l||Array.from(u.values()),fieldName:o,layer:s,timeZone:c});switch(s?.fieldsIndex?.get(o)?.type){case"date":return n(t);case"date-only":return a(t);case"time-only":return i(t);case"timestamp-offset":return r(t)}return de(t)}function pe({fieldInfos:e,attributes:t,layer:n,graphic:r,fieldInfoMap:i,relatedInfos:o,timeZone:a}){const l={};return o?.forEach((t=>Ne({attributes:l,relatedInfo:t,fieldInfoMap:i,fieldInfos:e,layer:n,timeZone:a}))),t&&Object.keys(t).forEach((o=>{const u=t[o];l[o]=me({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:n,value:u,graphic:r,timeZone:a})})),l}async function ye(e,t){const{layer:n,graphic:r,outFields:i,objectIds:o,returnGeometry:a,spatialReference:l}=e,u=o[0];if("number"!=typeof u&&"string"!=typeof u){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:n,graphic:r,objectId:u,requiredFields:i};return I.warn(e,t),null}if(!c(n)?.operations?.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:n,graphic:r,requiredFields:i,returnGeometry:a};return I.warn(e,t),null}const s=n.createQuery();s.objectIds=o,s.outFields=i?.length?i:[n.objectIdField],s.returnGeometry=!!a,s.returnZ=!!a,s.returnM=!!a,s.outSpatialReference=l;return(await n.queryFeatures(s,t)).features[0]}async function ge(e){if(!e.expressionInfos?.length)return!1;const t=await m(),{arcadeUtils:{hasGeometryFunctions:n}}=t;return n(e)}async function he({graphic:e,popupTemplate:t,layer:n,spatialReference:r},i){if(!n||!t)return;if("function"==typeof n.load&&await n.load(i),!e.attributes)return;const o=e.attributes[n.objectIdField];if(null==o)return;const a=[o],l=await t.getRequiredFields(n.fieldsIndex),u=f(l,e),s=u?[]:l,c=t.returnGeometry||await ge(t);if(u&&!c)return;const d=await ye({layer:n,graphic:e,outFields:s,objectIds:a,returnGeometry:c,spatialReference:r},i);d&&(d.geometry&&(e.geometry=d.geometry),d.attributes&&(e.attributes={...e.attributes,...d.attributes}))}function Ie(e=""){return!!e&&e.includes(v)}function be(e){return e?`${v}${e.layerId}/${e.fieldName}`:""}function Fe({attributes:e,graphic:t,relatedInfo:n,fieldInfos:r,fieldInfoMap:i,layer:o,timeZone:a}){e&&t&&n&&Object.keys(t.attributes).forEach((l=>{const u=be({layerId:n.relation.id.toString(),fieldName:l}),s=t.attributes[l];e[u]=me({fieldName:u,fieldInfos:r,fieldInfoMap:i,layer:o,value:s,graphic:t,timeZone:a})}))}function Ne({attributes:e,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}){e&&t&&(t.relatedFeatures?.forEach((a=>Fe({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))),t.relatedStatsFeatures?.forEach((a=>Fe({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))))}const we=e=>{if(!e)return!1;const t=e.toUpperCase();return t.includes("CURRENT_TIMESTAMP")||t.includes("CURRENT_DATE")||t.includes("CURRENT_TIME")},je=({layer:e,method:t,query:n,definitionExpression:r})=>{if(!e.capabilities?.query?.supportsCacheHint||"attachments"===t)return;const i=null!=n.where?n.where:null,o=null!=n.geometry?n.geometry:null;we(r)||we(i)||"extent"===o?.type||"tile"===n.resultType||(n.cacheHint=!0)},Ze=({query:e,layer:t,method:n})=>{je({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})},Ee=({queryPayload:e,layer:t,method:n})=>{je({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})};function Te(e,t,n){return e&&t&&n?ve(e.allLayers,t,n)||ve(e.allTables,t,n):null}function ve(e,t,n){const r="scene"===t.type&&t.associatedLayer?t.associatedLayer.url:t.url;return e.filter(Y).find((e=>e!==t&&e.url===r&&e.layerId===n.relatedTableId))}function xe(e){const t=e.getObjectId();return null!=t?`oid:${t}`:`uid:${e.uid}`}export{de as applyTextFormattingHTML,se as createfieldInfoMap,Te as findRelatedLayer,z as fixTokens,pe as formatAttributes,ue as formatEditInfo,ne as formatValueToFieldInfo,fe as getAllFieldInfos,oe as getFieldInfo,R as getFieldInfoLabel,U as getFixedFieldName,G as getFixedFieldNames,xe as getHighlightKeyForFeature,C as getSourceLayer,q as graphicCallback,ce as htmlEntities,M as isExpressionField,W as isFeatureSupportedLayer,ee as isGraphicForRelatableFeatureSupportedLayer,Y as isRelatableFeatureSupportedLayer,X as isRelatableLayer,Ie as isRelatedField,Ze as preLayerQueryCallback,Ee as preRequestCallback,ye as querySourceLayer,he as queryUpdatedFeature,A as shouldOpenInNewTab,P as substituteAttributes,k as substituteFieldsInLinksAndAttributes};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveLayerCapabilities as s}from"../../layers/support/layerUtils.js";import{capabilitiesAllowEditType as o}from"./featureFormUtils.js";import i from"./InputBase.js";let a=class extends i{constructor(t){super(t),this.arcadeEditType="NA",this.editableExpressionExecutor=null}get editable(){return!!this.layerAllowsEdits&&(this.evaluatedEditableExpression??!
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveLayerCapabilities as s}from"../../layers/support/layerUtils.js";import{capabilitiesAllowEditType as o}from"./featureFormUtils.js";import i from"./InputBase.js";let a=class extends i{constructor(t){super(t),this.arcadeEditType="NA",this.editableExpressionExecutor=null}get editable(){return!!this.layerAllowsEdits&&(this.evaluatedEditableExpression??!0)}get evaluatedEditableExpression(){const{editableExpressionExecutor:t}=this;return null!=t?!!t.lastEvaluatedValue:null}get layerAllowsEdits(){const{layer:t}=this;if(!t)return!1;const e=s(t),r=e?.operations.supportsEditing,i=o(e,this.arcadeEditType);return!(!r||!i)}};t([e()],a.prototype,"arcadeEditType",void 0),t([e()],a.prototype,"editable",null),t([e()],a.prototype,"editableExpressionExecutor",void 0),t([e()],a.prototype,"evaluatedEditableExpression",null),t([e()],a.prototype,"layerAllowsEdits",null),a=t([r("esri.widgets.FeatureForm.EditableInput")],a);const l=a;export{l as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{deprecatedProperty as n}from"../../core/deprecate.js";import s from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import{EsriPromiseMixin as r}from"../../core/Promise.js";import{watch as a}from"../../core/reactiveUtils.js";import{templateHasKey as l}from"../../core/string.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as c}from"../../core/support/UpdatingHandles.js";import d from"../../form/FormTemplate.js";import h from"../../layers/support/ContingentValue.js";import{isEditableLayer as f}from"../../layers/support/editableLayers.js";import m from"../../layers/support/LayerContingentValuesCache.js";import{flattenFieldInputs as g,flattenRelationshipInputs as y,parseFormTemplateString as _,isGroupInput as v,isGroupElement as F,isFieldElement as I,isRelationshipElement as C,isRelationshipInput as E,isFieldInput as x,getNormalizedFeatureTypeInfo as V,valueIsValidContingentValue as b}from"./featureFormUtils.js";import w from"./FieldInput.js";import{createFormExpressionArcadeExecutor as j}from"./FormExpressionArcadeExecutor.js";import{FormExpressionsManager as T}from"./FormExpressionsManager.js";import A from"./GroupInput.js";import M from"./RelationshipInput.js";const R=new t({attributes:{}}),S=["editableExpression","requiredExpression","valueExpression","visibilityExpression"],N=["visibilityExpression"],H=["editableExpression","visibilityExpression"],L="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",k="#JSAPI_CONTINGENT_VALUE_ANY_HASH",U="#JSAPI_CONTINGENT_VALUE_NULL_HASH",P="esri.widgets.FeatureForm.FeatureFormViewModel",W=i.getLogger(P);let O=class extends(r(s.EventedAccessor)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=R.clone(),this._initialFeature=R.clone(),this._updatingHandles=new c,this.arcadeEditType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.inputs=[],this.map=null,this.relatedRecordCallbacks=null,this.strict=!1}initialize(){const e=a((()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this.feature,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])=>e===o&&t===r&&n===a&&s===l&&i===u,initial:!0}),t=a((()=>this._arcadeContextInfo),(e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e)})),n=a((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(m.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._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map((e=>[e.name,e])))}get activeRelationshipInput(){return this.allRelationshipInputs.find((e=>e.relationshipId===this.relationshipId))}get _arcadeContextInfo(){const{_initialFeature:e,arcadeEditType:t,layer:n,map:s,spatialReference:i}=this;return{layer:f(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i}}get allFieldInputs(){return g(this.inputs)}get allRelationshipInputs(){return y(this.inputs)}get _layerFieldsByName(){return new Map(this.layer?.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){this._featureClone=e?e.clone():R.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),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 fieldsWithInvalidCodedValue(){const e=this.allFieldInputs;return new Set(e.filter((e=>{const{name:t,domain:n,value:s}=e;if("coded-value"===n?.type){const e=this.getFieldValueOptionsForField(t);return null!=s&&""!==s&&!e.flat().some((e=>e.value===s))}return!1})))}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 null!=e&&e.description&&t?_(e.description,this.getValues(),t.fieldsIndex):null}get formTitle(){const{formTemplate:e,layer:t}=this;return null!=e&&e.title&&t?_(e.title,this.getValues(),t.fieldsIndex):null}get formHeaderVisible(){const{activeRelationshipInput:e,formDescription:t,formTitle:n}=this;return!(e||!t&&!n)}set inputFields(e){n(W,"inputFields",{replacement:"FeatureFormViewModel.inputs",version:"4.27"}),this.inputs=e}get inputFields(){return n(W,"inputFields",{replacement:"FeatureFormViewModel.inputs",version:"4.27"}),this.inputs}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 updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every((({valid:e})=>e))}get view(){return n(W,"view",{replacement:"FeatureForm.map",version:"4.27"}),this._get("view")}set view(e){n(W,"view",{replacement:"FeatureForm.map",version:"4.27"}),this._set("view",e),e?.map&&(this.map=e.map)}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=this.fieldsWithContingentValues.has(e)?this._getContingentValueOptionsForField(e,t):[];if(i.length>0){const e=new Set(i.map((e=>e.value)));return[i,s.filter((t=>!e.has(t.value)))]}return[s,[]]}getValue(e){const{_featureClone:t,layer:n}=this,s=!!n?.getField(e);return t.getAttribute(e)??(s?null:void 0)}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;n.geometry=t.geometry,null!=e&&this._updatingHandles.addPromise(e.evaluateInvalidatedByGeometry().finally((()=>this._afterExpressionsEvaluated())))}_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}=this;if(!o)return;const r={arcadeEditType:n,feature:e,initialFeature:t,layer:o},a=i.slice(),l=null!=s&&s.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(a,s.elements,r):this._updateInputsUsingLayerFields(a,o?.fields,r);this.inputs=l,await this._startExpressions()}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(v(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=this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter(G),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}_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):F(a)?this._makeGroupInputFromElement(a,s):I(a)?this._makeFieldInputFromElement(a,s,i):C(a)?this._makeRelationshipInputFromElement(a,s,i):null;if(n){if(r.push(n),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),v(n)){const{feature:e}=s;n.set({feature:e})}else if(E(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else n.set(s);if(F(a)){const e=a.elements.filter((e=>G(e)));n.inputs=this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return i.getLogger(this).warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const i of e)if(v(i)){for(const e of i.inputs)e.destroy();i.inputs.length=0,i.destroy()}else E(i)?i.destroy():x(i)&&(null!==i.element?i.destroy():s.set(i.field,i));const o=[],{arcadeEditType:r,feature:a,initialFeature:l,layer:u}=n;for(const i of t){const e=s.get(i)??new w({arcadeEditType:r,field:i,feature:a,initialFeature:l,layer:u,value:a?.getAttribute(i.name)??null,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden});o.push(e),s.delete(i)}for(const[i,p]of s.entries())s.delete(i),p.destroy();return o}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)}_makeFieldInputFromElement(e,t,n){const{arcadeEditType:s,feature:i,initialFeature:o,layer:r}=t,{fieldName:a}=e,l=a&&this._layerFieldsByName.get(a);return l?new w({arcadeEditType:s,element:e,field:l,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden}):null}_makeGroupInputFromElement(e,t){const{feature:n,layer:s}=t;return new A({element:e,inputs:[],feature:n,layer:s})}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o}=t;return new M({element:e,feature:i,group:n,layer:o,map:s})}_assignExpressionExecutors(e,t,n){const s=F(t)?N:C(t)?H:S,i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const i=t[o],{_expressionExecutorLookup:r}=this;if(null!=i&&""!==i){const t=this._expressionInfosLookup.get(i)?.expression??i;if(r.has(t))e[s]=this._useExecutor(r.get(t));else if(n.has(t)){const i=n.get(t).then((t=>(e[s]=t,t)));n.set(t,i)}else{const i=j(t,this.layer).then((n=>(e[s]=this._useExecutor(n),r.set(t,n),n)));n.set(t,i)}}}return i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s,formTemplate:i}=this;this._expressionsManager=new T({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:u}=V(o);if(t===a&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);s.sourceLayer=this.feature.sourceLayer=e}const e=new Set;for(const t of u)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")}}if(null!=i){const{description:e,title:n}=i;n&&l(n,t)&&this.notifyChange("formTitle"),e&&l(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}=V(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(k)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(k),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(k)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(k),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:f}=this._compareObjectTypes(n.objectType,o.objectType);if(l||c)continue;if(r&&p||a&&u){s.values[i]=new h({objectType:"null"});continue}if(r&&f||a&&d)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const m=Math.max(n.minValue,o.minValue),g=Math.min(n.maxValue,o.maxValue);if(m>g)return null;s.values[i]=new h({objectType:"range",minValue:m,maxValue:g})}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===k)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,r=new Set,a=new Set;for(const l of i)if(o.has(l)){const e=this.layer?.getFieldDomain(l,{feature:this.feature});if(null==e)continue;switch(e.type){case"coded-value":r.add(l);break;case"range":a.add(l)}}return{codedValueFields:[...r],rangeFields:[...a]}}_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)||b(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[L,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[k,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${U}`):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}}};function G(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||(i.getLogger(P).warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}e([u()],O.prototype,"_expressionInfosLookup",null),e([u()],O.prototype,"_featureClone",void 0),e([u()],O.prototype,"activeRelationshipInput",null),e([u()],O.prototype,"_arcadeContextInfo",null),e([u({readOnly:!0})],O.prototype,"allFieldInputs",null),e([u()],O.prototype,"allRelationshipInputs",null),e([u()],O.prototype,"_layerFieldsByName",null),e([u()],O.prototype,"arcadeEditType",void 0),e([u()],O.prototype,"contingencyConstraintViolations",void 0),e([u()],O.prototype,"disabled",void 0),e([u()],O.prototype,"feature",null),e([u()],O.prototype,"fieldsWithContingentValues",null),e([u()],O.prototype,"fieldsWithInvalidCodedValue",null),e([u({type:d})],O.prototype,"formTemplate",null),e([u()],O.prototype,"formDescription",null),e([u()],O.prototype,"formTitle",null),e([u()],O.prototype,"formHeaderVisible",null),e([u()],O.prototype,"inputs",void 0),e([u()],O.prototype,"inputFields",null),e([u()],O.prototype,"joinedContingentValues",null),e([u()],O.prototype,"layer",null),e([u()],O.prototype,"map",void 0),e([u()],O.prototype,"relatedRecordCallbacks",void 0),e([u()],O.prototype,"relationshipId",null),e([u()],O.prototype,"spatialReference",null),e([u()],O.prototype,"state",null),e([u()],O.prototype,"strict",void 0),e([u()],O.prototype,"submittable",null),e([u()],O.prototype,"updating",null),e([u()],O.prototype,"valid",null),e([u()],O.prototype,"view",null),e([u()],O.prototype,"getValues",null),e([u()],O.prototype,"submit",null),O=e([p(P)],O);const $=O;export{$ as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{deprecatedProperty as n}from"../../core/deprecate.js";import s from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import{EsriPromiseMixin as r}from"../../core/Promise.js";import{watch as a}from"../../core/reactiveUtils.js";import{templateHasKey as l}from"../../core/string.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as c}from"../../core/support/UpdatingHandles.js";import d from"../../form/FormTemplate.js";import h from"../../layers/support/ContingentValue.js";import{isEditableLayer as f}from"../../layers/support/editableLayers.js";import m from"../../layers/support/LayerContingentValuesCache.js";import{flattenFieldInputs as g,flattenRelationshipInputs as y,parseFormTemplateString as _,isGroupInput as v,isGroupElement as F,isFieldElement as I,isRelationshipElement as C,isRelationshipInput as E,isFieldInput as x,getNormalizedFeatureTypeInfo as V,valueIsValidContingentValue as b}from"./featureFormUtils.js";import w from"./FieldInput.js";import{createFormExpressionArcadeExecutor as j}from"./FormExpressionArcadeExecutor.js";import{FormExpressionsManager as T}from"./FormExpressionsManager.js";import A from"./GroupInput.js";import M from"./RelationshipInput.js";const R=new t({attributes:{}}),S=["editableExpression","requiredExpression","valueExpression","visibilityExpression"],H=["visibilityExpression"],N=["editableExpression","visibilityExpression"],L="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",k="#JSAPI_CONTINGENT_VALUE_ANY_HASH",U="#JSAPI_CONTINGENT_VALUE_NULL_HASH",P="esri.widgets.FeatureForm.FeatureFormViewModel",W=i.getLogger(P);let O=class extends(r(s.EventedAccessor)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=R.clone(),this._initialFeature=R.clone(),this._updatingHandles=new c,this.arcadeEditType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.highlightHelper=null,this.inputs=[],this.map=null,this.relatedRecordCallbacks=null,this.strict=!1}initialize(){const e=a((()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this.feature,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])=>e===o&&t===r&&n===a&&s===l&&i===u,initial:!0}),t=a((()=>this._arcadeContextInfo),(e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e)})),n=a((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(m.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 activeRelationshipInput(){return this.allRelationshipInputs.find((e=>e.relationshipId===this.relationshipId))}get _arcadeContextInfo(){const{_initialFeature:e,arcadeEditType:t,layer:n,map:s,spatialReference:i}=this;return{layer:f(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i}}get allFieldInputs(){return g(this.inputs)}get allRelationshipInputs(){return y(this.inputs)}get _layerFieldsByName(){return new Map(this.layer?.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){this._featureClone=e?e.clone():R.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),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 fieldsWithInvalidCodedValue(){const e=this.allFieldInputs;return new Set(e.filter((e=>{const{name:t,domain:n,value:s}=e;if("coded-value"===n?.type){const e=this.getFieldValueOptionsForField(t);return null!=s&&""!==s&&!e.flat().some((e=>e.value===s))}return!1})))}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 null!=e&&e.description&&t?_(e.description,this.getValues(),t.fieldsIndex):null}get formTitle(){const{formTemplate:e,layer:t}=this;return null!=e&&e.title&&t?_(e.title,this.getValues(),t.fieldsIndex):null}get formHeaderVisible(){const{activeRelationshipInput:e,formDescription:t,formTitle:n}=this;return!(e||!t&&!n)}set inputFields(e){n(W,"inputFields",{replacement:"FeatureFormViewModel.inputs",version:"4.27"}),this.inputs=e}get inputFields(){return n(W,"inputFields",{replacement:"FeatureFormViewModel.inputs",version:"4.27"}),this.inputs}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 updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every((({valid:e})=>e))}get view(){return n(W,"view",{replacement:"FeatureForm.map",version:"4.27"}),this._get("view")}set view(e){n(W,"view",{replacement:"FeatureForm.map",version:"4.27"}),this._set("view",e),e?.map&&(this.map=e.map)}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=this.fieldsWithContingentValues.has(e)?this._getContingentValueOptionsForField(e,t):[];if(i.length>0){const e=new Set(i.map((e=>e.value)));return[i,s.filter((t=>!e.has(t.value)))]}return[s,[]]}getValue(e){const{_featureClone:t,layer:n}=this,s=!!n?.getField(e);return t.getAttribute(e)??(s?null:void 0)}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;n.geometry=t.geometry,null!=e&&this._updatingHandles.addPromise(e.evaluateInvalidatedByGeometry().finally((()=>this._afterExpressionsEvaluated())))}_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}=this;if(!o)return;const r={arcadeEditType:n,feature:e,initialFeature:t,layer:o},a=i.slice(),l=null!=s&&s.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(a,s.elements,r):this._updateInputsUsingLayerFields(a,o?.fields,r);this.inputs=l,await this._startExpressions()}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(v(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=this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter(G),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}_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):F(a)?this._makeGroupInputFromElement(a,s):I(a)?this._makeFieldInputFromElement(a,s,i):C(a)?this._makeRelationshipInputFromElement(a,s,i):null;if(n){if(r.push(n),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),v(n)){const{feature:e}=s;n.set({feature:e})}else if(E(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else n.set(s);if(F(a)){const e=a.elements.filter((e=>G(e)));n.inputs=this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return i.getLogger(this).warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const i of e)if(v(i)){for(const e of i.inputs)e.destroy();i.inputs.length=0,i.destroy()}else E(i)?i.destroy():x(i)&&(null!==i.element?i.destroy():s.set(i.field,i));const o=[],{arcadeEditType:r,feature:a,initialFeature:l,layer:u}=n;for(const i of t){const e=s.get(i)??new w({arcadeEditType:r,field:i,feature:a,initialFeature:l,layer:u,value:a?.getAttribute(i.name)??null,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden});o.push(e),s.delete(i)}for(const[i,p]of s.entries())s.delete(i),p.destroy();return o}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)}_makeFieldInputFromElement(e,t,n){const{arcadeEditType:s,feature:i,initialFeature:o,layer:r}=t,{fieldName:a}=e,l=a&&this._layerFieldsByName.get(a);return l?new w({arcadeEditType:s,element:e,field:l,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden}):null}_makeGroupInputFromElement(e,t){const{feature:n,layer:s}=t;return new A({element:e,inputs:[],feature:n,layer:s})}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o}=t;return new M({element:e,feature:i,group:n,layer:o,map:s})}_assignExpressionExecutors(e,t,n){const s=F(t)?H:C(t)?N:S,i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const i=t[o],{_expressionExecutorLookup:r}=this;if(null!=i&&""!==i){const t=this._expressionInfosLookup.get(i)?.expression??i;if(r.has(t))e[s]=this._useExecutor(r.get(t));else if(n.has(t)){const i=n.get(t).then((t=>(e[s]=t,t)));n.set(t,i)}else{const i=j(t,this.layer).then((n=>(e[s]=this._useExecutor(n),r.set(t,n),n)));n.set(t,i)}}}return i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s,formTemplate:i}=this;this._expressionsManager=new T({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:u}=V(o);if(t===a&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);s.sourceLayer=this.feature.sourceLayer=e}const e=new Set;for(const t of u)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")}}if(null!=i){const{description:e,title:n}=i;n&&l(n,t)&&this.notifyChange("formTitle"),e&&l(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}=V(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(k)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(k),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(k)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(k),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:f}=this._compareObjectTypes(n.objectType,o.objectType);if(l||c)continue;if(r&&p||a&&u){s.values[i]=new h({objectType:"null"});continue}if(r&&f||a&&d)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const m=Math.max(n.minValue,o.minValue),g=Math.min(n.maxValue,o.maxValue);if(m>g)return null;s.values[i]=new h({objectType:"range",minValue:m,maxValue:g})}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===k)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,r=new Set,a=new Set;for(const l of i)if(o.has(l)){const e=this.layer?.getFieldDomain(l,{feature:this.feature});if(null==e)continue;switch(e.type){case"coded-value":r.add(l);break;case"range":a.add(l)}}return{codedValueFields:[...r],rangeFields:[...a]}}_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)||b(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[L,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[k,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${U}`):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}}};function G(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||(i.getLogger(P).warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}e([u()],O.prototype,"_expressionInfosLookup",null),e([u()],O.prototype,"_featureClone",void 0),e([u()],O.prototype,"activeRelationshipInput",null),e([u()],O.prototype,"_arcadeContextInfo",null),e([u({readOnly:!0})],O.prototype,"allFieldInputs",null),e([u()],O.prototype,"allRelationshipInputs",null),e([u()],O.prototype,"_layerFieldsByName",null),e([u()],O.prototype,"arcadeEditType",void 0),e([u()],O.prototype,"contingencyConstraintViolations",void 0),e([u()],O.prototype,"disabled",void 0),e([u()],O.prototype,"feature",null),e([u()],O.prototype,"fieldsWithContingentValues",null),e([u()],O.prototype,"fieldsWithInvalidCodedValue",null),e([u({type:d})],O.prototype,"formTemplate",null),e([u()],O.prototype,"formDescription",null),e([u()],O.prototype,"formTitle",null),e([u()],O.prototype,"formHeaderVisible",null),e([u()],O.prototype,"highlightHelper",void 0),e([u()],O.prototype,"inputs",void 0),e([u()],O.prototype,"inputFields",null),e([u()],O.prototype,"joinedContingentValues",null),e([u()],O.prototype,"layer",null),e([u()],O.prototype,"map",void 0),e([u()],O.prototype,"relatedRecordCallbacks",void 0),e([u()],O.prototype,"relationshipId",null),e([u()],O.prototype,"spatialReference",null),e([u()],O.prototype,"state",null),e([u()],O.prototype,"strict",void 0),e([u()],O.prototype,"submittable",null),e([u()],O.prototype,"updating",null),e([u()],O.prototype,"valid",null),e([u()],O.prototype,"view",null),e([u()],O.prototype,"getValues",null),e([u()],O.prototype,"submit",null),O=e([p(P)],O);const $=O;export{$ as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{watch as t,initial as r}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{watch as t,initial as r}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveLayerCapabilities as l}from"../../layers/support/layerUtils.js";import o from"../Feature/FeatureRelationship/FeatureRelationshipViewModel.js";import{isRelatableFeatureSupportedLayer as a}from"../Feature/support/featureUtils.js";import n from"./EditableInput.js";const p=3;let d=class extends n{constructor(e){super(e),this._relationshipVM=null,this.group=null,this.type="relationship",this.addHandles([t((()=>({feature:this.feature,element:this.element,layer:this.layer})),(e=>this._createRelationshipVM(e)),r)])}destroy(){this._relationshipVM?.destroy()}get canAddRelatedFeature(){const{editable:e,featureCount:t,relationship:r}=this;if(!r||!this.loaded||!this.relatedLayerAllowsAdds)return!1;const{cardinality:s,role:i}=r;return!("one-to-one"===s&&t>0)&&("many-to-many"!==s&&(!("one-to-many"===s&&"destination"===i&&t>0)&&e))}get displayCount(){return this.element.displayCount??p}get displayType(){return this.element.displayType}get editable(){return!!this.relatedLayerAllowsEdits&&(this.evaluatedEditableExpression??!0)}get featureCount(){return this._relationshipVM?.featureCount??0}get loaded(){return"ready"===this._relationshipVM?.state}get map(){return this._get("map")}set map(e){e&&this._relationshipVM?.set("map",e),this._set("map",e)}get orderByFields(){return this.element.orderByFields}get originHasValidKey(){return!(!this.relationship||!this.feature.getAttribute(this.relationship.keyField))}get relationship(){return this._relationshipVM?.relationship}get relationshipId(){return this.element.relationshipId}get relatedFeatureInfos(){return this._relationshipVM?.relatedFeatureInfos??[]}get relatedLayer(){return this._relationshipVM?.relatedLayer}get relatedLayerIsTable(){return!!this.relatedLayer?.isTable}get relatedLayerAllowsAdds(){const{relatedLayer:e}=this;if(!e||!this.relatedLayerAllowsEdits)return!1;const t=l(e);return!!t?.operations?.supportsAdd}get relatedLayerAllowsEdits(){const{relatedLayer:e}=this;if(!e)return!1;const t=l(e);return!!t?.operations?.supportsEditing}get showAllEnabled(){return this._get("showAllEnabled")}set showAllEnabled(e){this._relationshipVM?.set("showAllEnabled",e),this._set("showAllEnabled",e)}get showAllActionVisible(){return!this.showAllEnabled&&this.featureCount>0&&this.featureCount>this.displayCount}get visible(){const{relationship:e}=this;if(!e)return!1;const{cardinality:t}=e;return"many-to-many"!==t&&(null!=this.evaluatedVisibilityExpression?this.evaluatedVisibilityExpression:null!=this.element)}get updating(){return"loading"===this._relationshipVM?.state||"querying"===this._relationshipVM?.state}incrementPage(){this._relationshipVM&&this._relationshipVM.featurePage++}getRelatedFeatureByObjectId(e){return this._relationshipVM?.getRelatedFeatureByObjectId(e)}_createRelationshipVM(e){const{feature:t,element:r,layer:s}=e;if(this._relationshipVM?.destroy(),!t||!r||!s)return;const{displayCount:i,map:l,orderByFields:n,relationshipId:p,showAllEnabled:d}=this;a(s)&&(this._relationshipVM=new o({graphic:t,displayCount:i,layer:s,map:l,orderByFields:n,relationshipId:p,showAllEnabled:d}))}};e([s()],d.prototype,"_relationshipVM",void 0),e([s()],d.prototype,"canAddRelatedFeature",null),e([s()],d.prototype,"displayCount",null),e([s()],d.prototype,"displayType",null),e([s()],d.prototype,"editable",null),e([s()],d.prototype,"featureCount",null),e([s()],d.prototype,"group",void 0),e([s()],d.prototype,"loaded",null),e([s()],d.prototype,"map",null),e([s()],d.prototype,"orderByFields",null),e([s()],d.prototype,"originHasValidKey",null),e([s()],d.prototype,"relationship",null),e([s()],d.prototype,"relationshipId",null),e([s()],d.prototype,"relatedFeatureInfos",null),e([s()],d.prototype,"relatedLayer",null),e([s()],d.prototype,"relatedLayerIsTable",null),e([s()],d.prototype,"relatedLayerAllowsAdds",null),e([s()],d.prototype,"relatedLayerAllowsEdits",null),e([s()],d.prototype,"showAllEnabled",null),e([s()],d.prototype,"showAllActionVisible",null),e([s({readOnly:!0})],d.prototype,"type",void 0),e([s()],d.prototype,"visible",null),e([s()],d.prototype,"updating",null),d=e([i("esri.widgets.FeatureForm.RelationshipInput")],d);const u=d;export{u 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.28/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{deprecatedProperty as i}from"../core/deprecate.js";import s from"../core/Logger.js";import{watch as o,whenOnce as n}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/has.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import{isIntegerField as l}from"../layers/support/fieldUtils.js";import d from"./Widget.js";import{css as c}from"./FeatureForm/css.js";import{isGroupInput as p,isFieldInput as u,isRelationshipInput as m,isInputInGroupInput as h,isFieldElementWithInputType as b,getErrorMessageForFieldInput as v,getIconForFeature as _,isNumberFieldInput as g}from"./FeatureForm/featureFormUtils.js";import f from"./FeatureForm/FeatureFormViewModel.js";import{loadCalciteComponents as C}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as y,prepareFieldValueForDateComponents as R,numberingSystem as F,getFieldValueFromDateComponent as w,getFieldValueFromDateComponents as I,isCalciteDateComponent as O}from"./support/dateUtils.js";import{globalCss as k}from"./support/globalCss.js";import{Heading as M,incrementHeadingLevel as x}from"./support/Heading.js";import{legacyIcon as N}from"./support/legacyIcon.js";import"./support/widgetUtils.js";import{messageBundle as j}from"./support/decorators/messageBundle.js";import{vmEvent as L}from"./support/decorators/vmEvent.js";import{tsx as D}from"./support/jsxFactory.js";import{substitute as V}from"../intl/substitute.js";const T="data-field-name",E="esri.widgets.FeatureForm",U=s.getLogger(E);let A=class extends d{constructor(e,t){super(e,t),this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver((e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()}),{root:window.document}),this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new f,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,relatedRecordCallbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t)=>{const{feature:i,relatedRecordCallbacks:s}=this;i&&s?.addRelatedRecord&&s.addRelatedRecord({parentFeature:i,relatedLayer:t,relationshipId:e})},this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupClick=this._onGroupClick.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._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([o((()=>this.feature),(()=>{n((()=>!this.viewModel.updating)).then((()=>{const e=this._getFocusableInput("forward");this._inputsWithChanges.clear(),this._dateComponentMap.clear(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0}))})),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()}})),o((()=>[this.viewModel.activeRelationshipInput,this._listObserverNode]),(()=>this._onObserverChange()))])}loadDependencies(){return C({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message.js"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress.js"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button.js"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const e=this.relatedRecordCallbacks;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}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 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 relatedRecordCallbacks(){return this.viewModel.relatedRecordCallbacks}set relatedRecordCallbacks(e){this.viewModel.relatedRecordCallbacks=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 view(){return i(U,"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view}set view(e){i(U,"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view=e}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return D("div",{class:this.classes(c.base,k.widget,k.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return D("form",{class:c.form,novalidate:!0,onsubmit:this._onFormSubmit,onkeydown:this._onFormKeyDown},this._renderHeader(),this._renderContent())}_renderHeader(){const e=this.viewModel;if(!e.formHeaderVisible)return;const t=null!=e.formTitle&&D(M,{key:"title",level:this.headingLevel},e.formTitle),i=null!=e.formDescription&&D("p",{class:c.description,key:"description"},e.formDescription);return D("div",{class:c.formHeader},t,i)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderActiveRelationshipInput(e.activeRelationshipInput):e.inputs.filter(t).filter((e=>e.visible)).map(((e,t)=>p(e)?this._renderGroup(e,t):u(e)?this._renderLabeledField(e):m(e)?this._renderRelationshipInput(e):void 0))}_renderActiveRelationshipInput(e){return this._renderRelationshipInput(e)}_renderDescriptionOrEmpty(e,t){return null==e?null:D("div",{class:this.classes(c.description),id:t},e)}_renderGroup(e,t){const{formTemplate:i,disabled:s}=this,{description:o,inputs:n,label:r,state:a}=e,l=n.filter((e=>e.visible)),d=this.viewModel.findField(this._focusedFieldName),p=!(!d||d.group!==e),h=`${this.id}_group_${t}`,b=`${this.id}_group-label_${t}`,v=`${this.id}_group-description_${t}`,_=this._renderDescriptionOrEmpty(o,v),g="sequential"===this.groupDisplay,f=g?p:"expanded"===a,C=f?N.up:N.down;return D("fieldset",{"aria-expanded":f.toString(),"aria-labelledby":b,"aria-describedby":o?v:"",class:this.classes(c.group,g?c.groupSequential:null,f?null:c.groupCollapsed,p?c.groupActive:null,s?c.inputDisabled:null),disabled:s,"data-group":e,id:h,key:t,onclick:this._onGroupClick},D("button",{role:g?"presentation":void 0,class:c.groupHeader,type:"button",tabIndex:g?-1:0},D("div",{class:c.groupTitle},D(M,{class:c.groupLabel,id:b,level:null!=i&&i.title?x(this.headingLevel):this.headingLevel},r),_),g?null:D("span",{class:this.classes(C,c.groupToggleIcon)})),l.map((e=>u(e)?this._renderLabeledField(e):m(e)?this._renderRelationshipInput(e):void 0)))}_getFocusableInput(e,t){const i=this.viewModel.allFieldInputs,s="forward"===e?i:i.slice().reverse();let o;if(!t||m(t))o=0;else if(p(t)){const e=t.inputs.find(u);o=e?s.indexOf(e):0}else{let i;if(h(t)&&"collapsed"===t.group.state){const s=t.group.inputs.filter(u);i="forward"===e?s[s.length-1]:s[0]}else i=t;o=s.indexOf(i)+1}for(let n=o;n<s.length;n++){const e=s[n];if(e.visible&&u(e))return e}return null}_renderLabeledField(e){const{dataType:t,feature:i,label:s,layer:o,required:n}=e,r={"aria-label":n?V(this.messages.requiredFieldLabel,{name:s}):s,class:c.label,key:`${o.id}-${i.uid}-${e.name}`},a=[D("div",{class:c.labelTextContent,key:"labelTextContainer"},s,n?D("span",{title:this.messagesCommon.required,"aria-hidden":!0},"*"):void 0),"unsupported"!==t?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)];return D("date"===t?"label":"calcite-label",{...r},a)}_renderFieldInput(e){const{dataType:t,domain:i,inputType:s,name:o,updating:n}=e,r=this.getCommonInputProps(e);if("coded-value"===i?.type){const t=this.viewModel.getFieldValueOptionsForField(o,this.messages.empty);return"switch"!==s||e.hasInvalidSwitchValue?"radio-buttons"===s?this._renderRadioButtonComponents(e,t.flat(),r):this._renderComboBoxComponent(e,t,r):this._renderSwitchComponent(e,r)}if("datetime-picker"===s||"date"===t)return this._renderDateComponents(e,r);const a="number"===t?this._renderNumberComponent(e,r):this._renderStringComponent(e,r);return n?D("div",{key:`${r.key}-input-updating-wrapper`,class:c.fieldInputWrapper},a,D("div",{class:c.fieldInputLoader},D("calcite-progress",{type:"indeterminate"}))):a}_renderStringComponent(e,t){return D("calcite-input",{...t,type:"text-area"===e.inputType?"textarea":"text",onCalciteInputInput:e=>this._saveValueFromComponent(e.target)})}_renderNumberComponent(e,t){return D("calcite-input-number",{...t,type:"number",integer:l(e.field),onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.target)})}_renderDateComponents(e,t){const{dateDataType:i,includeTime:s,label:o,name:n,valid:r,value:a}=e,{class:l,max:d,min:p,key:u,readOnly:m,required:h}=t;if("string"===i)return this._renderReadOnlyComponent(e,y(e.field,t.value));const{date:b,time:v}=R(a),_=null!=d?R(d):void 0,g=null!=p?R(p):void 0,f=_?.date??void 0,C=g?.date??void 0,w={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!r,label:o,numberingSystem:F,overlayPositioning:"fixed",readOnly:m,required:h,tabIndex:t.tabIndex,[T]:n,onfocus:this._onComponentFocus};return D("div",{key:`${u}-date-time-container`,class:c.dateInputContainer},D("calcite-input-date-picker",{bind:this,...w,class:this.classes(l,c.inputDate),"data-date-part":"date",key:`${u}-date-input`,valueAsDate:b??void 0,maxAsDate:f,minAsDate:C,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target),onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target,!0)}}),s?D("calcite-input-time-picker",{bind:this,...w,class:this.classes(l,c.inputTime),"data-date-part":"time",key:`${u}-time-input`,value:v??void 0,step:1,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target),onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target,!0)}}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return D("calcite-input",{...i,class:this.classes(c.fieldInput,c.inputDisabled),readOnly:!0,type:"text",value:null!=t?`${t}`:i.value})}_renderComboBoxComponent(e,t,i){const{value:s,name:o}=e,{messages:n,messagesTemplates:r,viewModel:a,_inputsWithChanges:l}=this,d=t.map((e=>e.map((({name:e,value:t})=>D("calcite-combobox-item",{key:`#${t}`,selected:s===t,textLabel:e,value:`${t}`}))))),[c,p]=d;this.viewModel.fieldsWithInvalidCodedValue.has(e)&&p.unshift(D("calcite-combobox-item",{key:"incompatible-option",readOnly:!0,textLabel:`${e.value}`,value:`${e.value}`}));const u=p.length>0?[D("calcite-combobox-item-group",{key:"recommended",label:n.recommended},c),D("calcite-combobox-item-group",{key:"other",label:r.other},p)]:c,m="INSERT"===a.arcadeEditType,h=l.has(o),b=null==s&&(!m||h);if(e.showNoValueOptionEnabled){const t="",i=e.showNoValueLabel||n.empty;u.unshift(D("calcite-combobox-item",{value:t,textLabel:n.empty,selected:b,key:"empty-option"},i))}const v=m&&e.showNoValueOptionEnabled&&!h?()=>{}:i.onblur;return D("calcite-combobox",{...i,selectionMode:"single",disabled:i.readOnly,allowCustomValues:!1,clearDisabled:!0,overlayPositioning:"fixed",onblur:v,onCalciteComboboxChange:({target:e})=>{b&&0===e.selectedItems.length?this._ignoreDeselectionOfNoValueOption(e):this._saveValueFromComponent(e)}},u)}_renderRadioButtonComponents(e,t,i){const{name:s,value:o}=e,n=t.map((({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,name:s,value:t,selected:t===o,props:i})));if(e.showNoValueOptionEnabled){const t="",r=e.showNoValueLabel||this.messages.empty,a=o===t||null===o;n.unshift(this._renderRadioButtonComponent({key:"empty-option",label:r,name:s,value:t,selected:a,props:i}))}return D("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:c.inputRadioGroup,"data-field-name":i[T],key:`${i.key}-radio-group`,layout:"vertical",name:i.key,required:i.required},n)}_renderSwitchComponent(e,t){const{value:i}=e,s=!!b(e.element,"switch")&&i===e.element.input.onValue;return D("calcite-switch",{...t,checked:s,class:c.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.target)})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:s,label:o,props:n}){return D("calcite-label",{layout:"inline",key:e,class:c.inputRadioLabel},D("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:s,class:c.inputRadio,disabled:n.readOnly,name:t,value:i,onblur:()=>{this._focusedFieldName=null},onCalciteRadioButtonChange:({target:e})=>{e.checked&&this._saveValueFromComponent(e)}}),o)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.valid?v(e,this.messages):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?D("calcite-input-message",{status:"invalid",icon:!0},i):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){const{featureCount:t,relationshipId:i,showAllActionVisible:s}=e,{relatedRecordCallbacks:o}=this;if(!s||!o?.showAllRelatedRecords)return;const n=this.messages;return D("calcite-list-item",{description:V(n.totalCount,{count:t}),label:n.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(i)},D("calcite-icon",{slot:"content-end",scale:"s",icon:"list"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:s}=e,{relatedRecordCallbacks:o}=this;if(t&&o?.addRelatedRecord&&s)return D("calcite-button",{alignment:"center",appearance:"outline-fill",class:c.centeredButton,disabled:e.updating,iconStart:"plus",key:`${i}-add-button`,round:!0,scale:"s",width:"half",onclick:()=>this._onAddRelatedRecordsClick(i,s)},this.messages.addRecord)}_renderRelatedRecordListItem(e,t){const{feature:i,description:s,title:o}=e,{feature:n,relatedRecordCallbacks:r}=this,a=()=>{r?.editRelatedRecord&&n&&r.editRelatedRecord({parentFeature:n,relationshipId:t,relatedFeature:i})};return D("calcite-list-item",{bind:this,description:s,label:o,key:`${t}-${i.uid}`,value:o,onclick:a},D("calcite-icon",{slot:"content-start",scale:"m",icon:_(i)}),D("calcite-icon",{slot:"content-end",scale:"s",icon:"chevron-right"}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled||!e.editable)return;const{featureCount:t,relationshipId:i,showAllEnabled:s}=e,o=s?null:this._renderDescriptionOrEmpty(e.description),n=t>0?this._renderRelatedRecordsList(e):e.loaded?this._renderNoRelatedRecordsNotice():void 0;return D("calcite-label",{class:this.classes(c.label,c.relationshipLabel),key:`relationship-${i}-container`},D("div",null,this._renderRelatedRecordsHeaderContainer(e),o,n),this._renderAddRelatedRecordButton(e))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return D("div",{class:c.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},D("span",null,e.label),t?D("calcite-loader",{label:this.messagesCommon?.loading,inline:!0,key:"loader",scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t}=e;return D("calcite-list",{class:c.relatedRecordsList},e.relatedFeatureInfos.map((e=>this._renderRelatedRecordListItem(e,t))),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoRelatedRecordsNotice(){return D("calcite-notice",{open:!0,scale:"s",kind:"brand",icon:"information",width:"full"},D("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return D("div",{key:"feature-observer",class:c.listObserver,bind:this,afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved})}getCommonInputProps(e){const{disabled:t,groupDisplay:i}=this,{editable:s,group:o,hint:n,label:r,maxLength:a,minLength:l,name:d,range:{max:p,min:u},required:m,valid:h,value:b}=e,v=this._inputsWithChanges.has(d),_=!s||t,g="all"===i&&null!=o&&"collapsed"===o.state;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":h?"false":"true",class:this.classes(c.fieldInput,_?c.inputDisabled:null,v&&!h?c.inputInvalid:null),key:d,label:r,max:null!=p?p:void 0,min:null!=u?u:void 0,maxlength:a>-1?`${a}`:"",minlength:l>-1?`${l}`:"",placeholder:n??void 0,readOnly:_,required:m,tabIndex:g?-1:0,value:null==b?"":`${b}`,onfocus:this._onComponentFocus,onblur:this._onComponentBlur,onkeydown:this._onComponentKeyDown,[T]:d}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(T))}_afterDateComponentCreateOrUpdate(e){const{name:t}=this._getFieldInputFromHTMLElement(e),i=this._dateComponentMap.get(t),s=O(e);null!=i?s?i.date=e:i.time=e:this._dateComponentMap.set(t,{[s?"date":"time"]:e}),this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);g(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"),s=t||i;s&&this._afterComponentCreateOrUpdate(s)}_afterComponentCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),s=t.findField(this._focusedFieldName);this._attemptFocusOnNextRender&&s===i&&(this._attemptFocusOnNextRender=!1,h(i)&&(i.group.state="expanded"),e.setFocus())}_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,t=!1){const{name:i}=this._getFieldInputFromHTMLElement(e),s=this._dateComponentMap.get(i);if(!s||!s.date)return;const o=w(e),n=this._getFieldInputFromHTMLElement(s.date),r=I(n,s.date,s.time);this.viewModel.getValue(i)!==r&&(null!==o&&null!==r?this._updateFieldValue(i,r):t&&this._updateFieldValue(i,null))}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e);this._updateFieldValue(t.name,this._parseValue(e))}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&h(i)&&"collapsed"===i.group.state&&(i.group.state="expanded")}_updateFieldValue(e,t){if(this.viewModel.setValue(e,t),this._inputsWithChanges.add(e),this.viewModel.fieldsWithContingentValues.has(e)){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 b(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):i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:i}=e;0===i.length&&t&&"selected"in t?t.selected=!0:U.warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupClick(e){const t=e.currentTarget["data-group"],i="expanded"===t.state,s="sequential"===this.groupDisplay,o=`.${c.groupHeader}`;if(!(i&&!e.target.closest(o))){if(this._focusedFieldName=this._getFocusableInput("forward",t)?.name||null,s){const s=e.target.closest(o);if(i&&!s)return;this.viewModel.inputs.forEach((e=>{p(e)&&e!==t&&(e.state="collapsed")}))}t.state=i?"collapsed":"expanded",this._attemptFocusOnNextRender=s,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;if(!e)return;const{showAllEnabled:t,updating:i}=e;this._listObserverNode&&!i&&t&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}};e([r()],A.prototype,"_listObserverNode",void 0),e([r()],A.prototype,"_relatedRecordsEnabled",null),e([r()],A.prototype,"disabled",null),e([r()],A.prototype,"feature",null),e([r()],A.prototype,"formTemplate",null),e([r()],A.prototype,"groupDisplay",void 0),e([r()],A.prototype,"headingLevel",void 0),e([r()],A.prototype,"label",null),e([r()],A.prototype,"layer",null),e([r()],A.prototype,"map",null),e([r(),j("esri/widgets/FeatureForm/t9n/FeatureForm")],A.prototype,"messages",void 0),e([r(),j("esri/t9n/common")],A.prototype,"messagesCommon",void 0),e([r(),j("esri/widgets/Feature/t9n/Feature")],A.prototype,"messagesFeature",void 0),e([r(),j("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],A.prototype,"messagesTemplates",void 0),e([r()],A.prototype,"relatedRecordCallbacks",null),e([r()],A.prototype,"relationshipId",null),e([r()],A.prototype,"spatialReference",null),e([r()],A.prototype,"strict",null),e([r()],A.prototype,"view",null),e([r(),L(["value-change","submit"])],A.prototype,"viewModel",void 0),A=e([a(E)],A);const $=A;export{$ as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{deprecatedProperty as i}from"../core/deprecate.js";import o from"../core/Logger.js";import{watch as s,whenOnce as n}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/has.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import{isIntegerField as l}from"../layers/support/fieldUtils.js";import d from"./Widget.js";import{css as c}from"./FeatureForm/css.js";import{isGroupInput as p,isFieldInput as u,isRelationshipInput as m,isInputInGroupInput as h,isFieldElementWithInputType as b,getErrorMessageForFieldInput as v,getIconForFeature as g,isNumberFieldInput as _}from"./FeatureForm/featureFormUtils.js";import f from"./FeatureForm/FeatureFormViewModel.js";import{loadCalciteComponents as C}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as y,prepareFieldValueForDateComponents as F,numberingSystem as R,getFieldValueFromDateComponent as w,getFieldValueFromDateComponents as I,isCalciteDateComponent as O}from"./support/dateUtils.js";import{globalCss as k}from"./support/globalCss.js";import{Heading as M,incrementHeadingLevel as x}from"./support/Heading.js";import{legacyIcon as N}from"./support/legacyIcon.js";import"./support/widgetUtils.js";import{messageBundle as L}from"./support/decorators/messageBundle.js";import{vmEvent as V}from"./support/decorators/vmEvent.js";import{tsx as j}from"./support/jsxFactory.js";import{substitute as D}from"../intl/substitute.js";const T="data-field-name",E="esri.widgets.FeatureForm",U=o.getLogger(E);let A=class extends d{constructor(e,t){super(e,t),this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver((e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()}),{root:window.document}),this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new f,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,relatedRecordCallbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t)=>{const{feature:i,relatedRecordCallbacks: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._onGroupClick=this._onGroupClick.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._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([s((()=>this.feature),(()=>{n((()=>!this.viewModel.updating)).then((()=>{const e=this._getFocusableInput("forward");this._inputsWithChanges.clear(),this._dateComponentMap.clear(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0}))})),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()}})),s((()=>[this.viewModel.activeRelationshipInput,this._listObserverNode]),(()=>this._onObserverChange()))])}loadDependencies(){return C({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message.js"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress.js"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button.js"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const e=this.relatedRecordCallbacks;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}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 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 relatedRecordCallbacks(){return this.viewModel.relatedRecordCallbacks}set relatedRecordCallbacks(e){this.viewModel.relatedRecordCallbacks=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 view(){return i(U,"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view}set view(e){i(U,"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view=e}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return j("div",{class:this.classes(c.base,k.widget,k.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return j("form",{class:c.form,novalidate:!0,onsubmit:this._onFormSubmit,onkeydown:this._onFormKeyDown},this._renderHeader(),this._renderContent())}_renderHeader(){const e=this.viewModel;if(!e.formHeaderVisible)return;const t=null!=e.formTitle&&j(M,{key:"title",level:this.headingLevel},e.formTitle),i=null!=e.formDescription&&j("p",{class:c.description,key:"description"},e.formDescription);return j("div",{class:c.formHeader},t,i)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderActiveRelationshipInput(e.activeRelationshipInput):e.inputs.filter(t).filter((e=>e.visible)).map(((e,t)=>p(e)?this._renderGroup(e,t):u(e)?this._renderLabeledField(e):m(e)?this._renderRelationshipInput(e):void 0))}_renderActiveRelationshipInput(e){return this._renderRelationshipInput(e)}_renderDescriptionOrEmpty(e,t){return null==e?null:j("div",{class:this.classes(c.description),id:t},e)}_renderGroup(e,t){const{formTemplate:i,disabled:o}=this,{description:s,inputs:n,label:r,state:a}=e,l=n.filter((e=>e.visible)),d=this.viewModel.findField(this._focusedFieldName),p=!(!d||d.group!==e),h=`${this.id}_group_${t}`,b=`${this.id}_group-label_${t}`,v=`${this.id}_group-description_${t}`,g=this._renderDescriptionOrEmpty(s,v),_="sequential"===this.groupDisplay,f=_?p:"expanded"===a,C=f?N.up:N.down;return j("fieldset",{"aria-expanded":f.toString(),"aria-labelledby":b,"aria-describedby":s?v:"",class:this.classes(c.group,_?c.groupSequential:null,f?null:c.groupCollapsed,p?c.groupActive:null,o?c.inputDisabled:null),disabled:o,"data-group":e,id:h,key:t,onclick:this._onGroupClick},j("button",{role:_?"presentation":void 0,class:c.groupHeader,type:"button",tabIndex:_?-1:0},j("div",{class:c.groupTitle},j(M,{class:c.groupLabel,id:b,level:null!=i&&i.title?x(this.headingLevel):this.headingLevel},r),g),_?null:j("span",{class:this.classes(C,c.groupToggleIcon)})),l.map((e=>u(e)?this._renderLabeledField(e):m(e)?this._renderRelationshipInput(e):void 0)))}_getFocusableInput(e,t){const i=this.viewModel.allFieldInputs,o="forward"===e?i:i.slice().reverse();let s;if(!t||m(t))s=0;else if(p(t)){const e=t.inputs.find(u);s=e?o.indexOf(e):0}else{let i;if(h(t)&&"collapsed"===t.group.state){const o=t.group.inputs.filter(u);i="forward"===e?o[o.length-1]:o[0]}else i=t;s=o.indexOf(i)+1}for(let n=s;n<o.length;n++){const e=o[n];if(e.visible&&u(e))return e}return null}_renderLabeledField(e){const{dataType:t,feature:i,label:o,layer:s,required:n}=e,r={"aria-label":n?D(this.messages.requiredFieldLabel,{name:o}):o,class:c.label,key:`${s.id}-${i.uid}-${e.name}`},a=[j("div",{class:c.labelTextContent,key:"labelTextContainer"},o,n?j("span",{title:this.messagesCommon.required,"aria-hidden":!0},"*"):void 0),"unsupported"!==t?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)];return j("date"===t?"label":"calcite-label",{...r},a)}_renderFieldInput(e){const{dataType:t,domain:i,inputType:o,name:s,updating:n}=e,r=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(),r):this._renderComboBoxComponent(e,t,r):this._renderSwitchComponent(e,r)}if("datetime-picker"===o||"date"===t)return this._renderDateComponents(e,r);const a="number"===t?this._renderNumberComponent(e,r):this._renderStringComponent(e,r);return n?j("div",{key:`${r.key}-input-updating-wrapper`,class:c.fieldInputWrapper},a,j("div",{class:c.fieldInputLoader},j("calcite-progress",{type:"indeterminate"}))):a}_renderStringComponent(e,t){return j("calcite-input",{...t,type:"text-area"===e.inputType?"textarea":"text",onCalciteInputInput:e=>this._saveValueFromComponent(e.target)})}_renderNumberComponent(e,t){return j("calcite-input-number",{...t,type:"number",integer:l(e.field),onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.target)})}_renderDateComponents(e,t){const{dateDataType:i,includeTime:o,label:s,name:n,valid:r,value:a}=e,{class:l,max:d,min:p,key:u,readOnly:m,required:h}=t;if("string"===i)return this._renderReadOnlyComponent(e,y(e.field,t.value));const{date:b,time:v}=F(a),g=null!=d?F(d):void 0,_=null!=p?F(p):void 0,f=g?.date??void 0,C=_?.date??void 0,w={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!r,label:s,numberingSystem:R,overlayPositioning:"fixed",readOnly:m,required:h,tabIndex:t.tabIndex,[T]:n,onfocus:this._onComponentFocus};return j("div",{key:`${u}-date-time-container`,class:c.dateInputContainer},j("calcite-input-date-picker",{bind:this,...w,class:this.classes(l,c.inputDate),"data-date-part":"date",key:`${u}-date-input`,valueAsDate:b??void 0,maxAsDate:f,minAsDate:C,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target),onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target,!0)}}),o?j("calcite-input-time-picker",{bind:this,...w,class:this.classes(l,c.inputTime),"data-date-part":"time",key:`${u}-time-input`,value:v??void 0,step:1,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target),onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target,!0)}}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return j("calcite-input",{...i,class:this.classes(c.fieldInput,c.inputDisabled),readOnly:!0,type:"text",value:null!=t?`${t}`:i.value})}_renderComboBoxComponent(e,t,i){const{value:o,name:s}=e,{messages:n,messagesTemplates:r,viewModel:a,_inputsWithChanges:l}=this,d=t.map((e=>e.map((({name:e,value:t})=>j("calcite-combobox-item",{key:`#${t}`,selected:o===t,textLabel:e,value:`${t}`}))))),[c,p]=d;this.viewModel.fieldsWithInvalidCodedValue.has(e)&&p.unshift(j("calcite-combobox-item",{key:"incompatible-option",readOnly:!0,textLabel:`${e.value}`,value:`${e.value}`}));const u=p.length>0?[j("calcite-combobox-item-group",{key:"recommended",label:n.recommended},c),j("calcite-combobox-item-group",{key:"other",label:r.other},p)]:c,m="INSERT"===a.arcadeEditType,h=l.has(s),b=null==o&&(!m||h);if(e.showNoValueOptionEnabled){const t="",i=e.showNoValueLabel||n.empty;u.unshift(j("calcite-combobox-item",{value:t,textLabel:n.empty,selected:b,key:"empty-option"},i))}const v=m&&e.showNoValueOptionEnabled&&!h?()=>{}:i.onblur;return j("calcite-combobox",{...i,selectionMode:"single",disabled:i.readOnly,allowCustomValues:!1,clearDisabled:!0,overlayPositioning:"fixed",onblur:v,onCalciteComboboxChange:({target:e})=>{b&&0===e.selectedItems.length?this._ignoreDeselectionOfNoValueOption(e):this._saveValueFromComponent(e)}},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="",r=e.showNoValueLabel||this.messages.empty,a=s===t||null===s;n.unshift(this._renderRadioButtonComponent({key:"empty-option",label:r,name:o,value:t,selected:a,props:i}))}return j("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:c.inputRadioGroup,"data-field-name":i[T],key:`${i.key}-radio-group`,layout:"vertical",name:i.key,required:i.required},n)}_renderSwitchComponent(e,t){const{value:i}=e,o=!!b(e.element,"switch")&&i===e.element.input.onValue;return j("calcite-switch",{...t,checked:o,class:c.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.target)})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:o,label:s,props:n}){return j("calcite-label",{layout:"inline",key:e,class:c.inputRadioLabel},j("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:o,class:c.inputRadio,disabled:n.readOnly,name:t,value:i,onblur:()=>{this._focusedFieldName=null},onCalciteRadioButtonChange:({target:e})=>{e.checked&&this._saveValueFromComponent(e)}}),s)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.valid?v(e,this.messages):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?j("calcite-input-message",{status:"invalid",icon:!0},i):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){const{featureCount:t,relationshipId:i,showAllActionVisible:o}=e,{relatedRecordCallbacks:s}=this;if(!o||!s?.showAllRelatedRecords)return;const n=this.messages;return j("calcite-list-item",{description:D(n.totalCount,{count:t}),label:n.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(i)},j("calcite-icon",{slot:"content-end",scale:"s",icon:"list"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:o}=e,{relatedRecordCallbacks:s}=this;if(t&&s?.addRelatedRecord&&o)return j("calcite-button",{alignment:"center",appearance:"outline-fill",class:c.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:"plus",key:`${i}-add-button`,round:!0,scale:"s",width:"half",onclick:()=>this._onAddRelatedRecordsClick(i,o)},this.messages.addRecord)}_renderRelatedRecordListItem(e,t){const{feature:i,description:o,title:s}=e,{feature:n,relatedRecordCallbacks:r}=this,{highlightHelper:a}=this.viewModel,l=()=>{a?.removeAll(),r?.editRelatedRecord&&n&&r.editRelatedRecord({parentFeature:n,relationshipId:t,relatedFeature:i})},d=a?()=>a.add(i):void 0,c=a?()=>a.remove(i):void 0;return j("calcite-list-item",{bind:this,description:o,label:s,key:`${t}-${i.uid}`,value:s,onclick:l,onmouseenter:d,onmouseleave:c},j("calcite-icon",{slot:"content-start",scale:"m",icon:g(i)}),j("calcite-icon",{slot:"content-end",scale:"s",icon:"chevron-right"}))}_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 j("calcite-label",{class:this.classes(c.label,c.relationshipLabel),key:`relationship-${i}-container`},j("div",null,this._renderRelatedRecordsHeaderContainer(e),s,n),this._renderAddRelatedRecordButton(e))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return j("div",{class:c.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},j("span",null,e.label),t?j("calcite-loader",{label:this.messagesCommon?.loading,inline:!0,key:"loader",scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t}=e;return j("calcite-list",{class:c.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=s?.label,r=D(i,{relatedLayerName:e.relatedLayer?.title,originKeyField:n});return j("calcite-notice",{open:!0,scale:"s",kind:"brand",icon:"information",width:"full"},j("div",{slot:"message"},r))}_renderNoRelatedRecordsNotice(){return j("calcite-notice",{open:!0,scale:"s",kind:"brand",icon:"information",width:"full"},j("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return j("div",{key:"feature-observer",class:c.listObserver,bind:this,afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved})}getCommonInputProps(e){const{disabled:t,groupDisplay:i}=this,{editable:o,group:s,hint:n,label:r,maxLength:a,minLength:l,name:d,range:{max:p,min:u},required:m,valid:h,value:b}=e,v=this._inputsWithChanges.has(d),g=!o||t,_="all"===i&&null!=s&&"collapsed"===s.state;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":h?"false":"true",class:this.classes(c.fieldInput,g?c.inputDisabled:null,v&&!h?c.inputInvalid:null),key:d,label:r,max:null!=p?p:void 0,min:null!=u?u:void 0,maxlength:a>-1?`${a}`:"",minlength:l>-1?`${l}`:"",placeholder:n??void 0,readOnly:g,required:m,tabIndex:_?-1:0,value:null==b?"":`${b}`,onfocus:this._onComponentFocus,onblur:this._onComponentBlur,onkeydown:this._onComponentKeyDown,[T]:d}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(T))}_afterDateComponentCreateOrUpdate(e){const{name:t}=this._getFieldInputFromHTMLElement(e),i=this._dateComponentMap.get(t),o=O(e);null!=i?o?i.date=e:i.time=e:this._dateComponentMap.set(t,{[o?"date":"time"]:e}),this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);_(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,h(i)&&(i.group.state="expanded"),e.setFocus())}_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,t=!1){const{name:i}=this._getFieldInputFromHTMLElement(e),o=this._dateComponentMap.get(i);if(!o||!o.date)return;const s=w(e),n=this._getFieldInputFromHTMLElement(o.date),r=I(n,o.date,o.time);this.viewModel.getValue(i)!==r&&(null!==s&&null!==r?this._updateFieldValue(i,r):t&&this._updateFieldValue(i,null))}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e);this._updateFieldValue(t.name,this._parseValue(e))}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&h(i)&&"collapsed"===i.group.state&&(i.group.state="expanded")}_updateFieldValue(e,t){if(this.viewModel.setValue(e,t),this._inputsWithChanges.add(e),this.viewModel.fieldsWithContingentValues.has(e)){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 b(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):i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:i}=e;0===i.length&&t&&"selected"in t?t.selected=!0:U.warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupClick(e){const t=e.currentTarget["data-group"],i="expanded"===t.state,o="sequential"===this.groupDisplay,s=`.${c.groupHeader}`;if(!(i&&!e.target.closest(s))){if(this._focusedFieldName=this._getFocusableInput("forward",t)?.name||null,o){const o=e.target.closest(s);if(i&&!o)return;this.viewModel.inputs.forEach((e=>{p(e)&&e!==t&&(e.state="collapsed")}))}t.state=i?"collapsed":"expanded",this._attemptFocusOnNextRender=o,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;if(!e)return;const{showAllEnabled:t,updating:i}=e;this._listObserverNode&&!i&&t&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}};e([r()],A.prototype,"_listObserverNode",void 0),e([r()],A.prototype,"_relatedRecordsEnabled",null),e([r()],A.prototype,"disabled",null),e([r()],A.prototype,"feature",null),e([r()],A.prototype,"formTemplate",null),e([r()],A.prototype,"groupDisplay",void 0),e([r()],A.prototype,"headingLevel",void 0),e([r()],A.prototype,"label",null),e([r()],A.prototype,"layer",null),e([r()],A.prototype,"map",null),e([r(),L("esri/widgets/FeatureForm/t9n/FeatureForm")],A.prototype,"messages",void 0),e([r(),L("esri/t9n/common")],A.prototype,"messagesCommon",void 0),e([r(),L("esri/widgets/Feature/t9n/Feature")],A.prototype,"messagesFeature",void 0),e([r(),L("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],A.prototype,"messagesTemplates",void 0),e([r()],A.prototype,"relatedRecordCallbacks",null),e([r()],A.prototype,"relationshipId",null),e([r()],A.prototype,"spatialReference",null),e([r()],A.prototype,"strict",null),e([r()],A.prototype,"view",null),e([r(),V(["value-change","submit"])],A.prototype,"viewModel",void 0),A=e([a(E)],A);const $=A;export{$ as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import s from"../../core/ObjectPool.js";import{when as r}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveLayerCapabilities as a}from"../../layers/support/layerUtils.js";import i from"./TemplateItem.js";import n from"./TemplateItemGroup.js";var p;const
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import s from"../../core/ObjectPool.js";import{when as r}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveLayerCapabilities as a}from"../../layers/support/layerUtils.js";import i from"./TemplateItem.js";import n from"./TemplateItemGroup.js";import{getAllTemplatesForLayer as u}from"../support/templateUtils.js";var p;const m=({layer:e})=>({key:e,label:e.title??""}),y=({layer:e})=>({key:e.geometryType,label:e.geometryType??""});let c=p=class extends t.EventedAccessor{constructor(e){super(e),this._groupPool=new s(n),this._itemPool=new s(i),this.disabled=!1,this.disabledItemFunction=null,this.filterFunction=null,this.selectedItem=null}initialize(){this._get("groupBy")||(this.groupBy="layer")}get _featureTemplatesByLayer(){if(!this.layers)return new Map;const e=new Map;for(const t of this.layers)if("subtype-group"===t.type)for(const s of t.sublayers)e.set(s,u(s));else e.set(t,u(t));return e}set groupBy(e){if(this._set("groupBy",e),"function"!=typeof e)switch(e){case"layer":this._groupByFunction=m;break;case"geometry":this._groupByFunction=y;break;default:this._groupByFunction=null}else this._groupByFunction=t=>this._ensureGroupByObject(e(t))}set layers(e){const t="layers";if(this.removeHandles(t),e){const s=()=>this.notifyChange("state");this.addHandles(e.map((e=>r((()=>e.loadStatus),s))),t)}this._set("layers",e)}get layers(){return this._get("layers")}get state(){const{layers:e}=this;return e&&0!==e.length?e.some((e=>"loading"===e.loadStatus||"not-loaded"===e.loadStatus))?"loading":"ready":"disabled"}get numberOfFeatureTemplates(){return Array.from(this._featureTemplatesByLayer.values()).reduce(((e,t)=>e+t.length),0)}get items(){if(0===this.numberOfFeatureTemplates)return this._releasePreviousItems(),[];const e=this._featureTemplatesByLayer,t=[],s=null!=this.filterFunction?this.filterFunction:p._nullFilterFunction;for(const[l,i]of e)if(l.loaded||"subtype-sublayer"===l.type&&l.parent?.loaded){const e=a(l)?.operations;if(e?.supportsEditing&&e?.supportsAdd)for(const r of i)t.push({layer:l,template:r,matchesFilter:s({label:r.name})})}if(null==this._groupByFunction){const e=t.filter((({matchesFilter:e})=>e)).map((({template:e,layer:t})=>this._createItem(e,t)));return this._releasePreviousItems(),e}const r=new Map;for(const l of t){const{template:e,layer:t}=l,s=this._groupByFunction({template:e,layer:t}),{key:o,label:a}=null!=s.key?s:p.nullGroupBy;r.has(o)||r.set(o,{label:a,templateItemInfos:[]}),r.get(o)?.templateItemInfos.push(l)}const o=[];for(const l of r.values()){const{label:e,templateItemInfos:t}=l,r=t.filter((({matchesFilter:e})=>e)),a=s({label:e})?t:t.length>0?r:[];if(a.length>0){const t=a.map((({template:e,layer:t})=>this._createItem(e,t)));o.push(this._createGroup(e,t))}}return 1===o.length&&o[0].label===p.nullGroupBy.label?(this._releasePreviousItems(),o[0].items):(this._releasePreviousItems(),o)}refresh(){this.notifyChange("items")}select(e,{emit:t=!0}={}){const s=this.selectedItem,r=e?.clone()||null;this._set("selectedItem",r),t&&this.emit("select",{item:r,oldItem:s,template:r?.template??null})}_createItem(e,t){const s=this._itemPool.acquire(),r=this.disabledItemFunction?.({template:e,layer:t})??!1;return s.set({disabled:r,layer:t,template:e}),s}_createGroup(e,t){const s=this._groupPool.acquire();return s.set("label",e),s.items=t,s}_releasePreviousItems(){this._destroyItems(this._get("items"))}_destroyItems(e){if(!e)return;e[0]instanceof i?e.forEach((e=>this._destroyItem(e))):e.forEach((e=>this._destroyGroup(e)))}_destroyGroup(e){e.items.forEach((e=>this._destroyItem(e))),e.items.length=0,this._groupPool.release(e)}_destroyItem(e){e.layer=null,e.template=null,this._itemPool.release(e)}_ensureGroupByObject(e){return"string"==typeof e?{key:e,label:e}:e}};c.nullGroupBy={key:Symbol(),label:"Other"},c._nullFilterFunction=e=>!0,e([o()],c.prototype,"_featureTemplatesByLayer",null),e([o()],c.prototype,"_groupByFunction",void 0),e([o()],c.prototype,"disabled",void 0),e([o()],c.prototype,"disabledItemFunction",void 0),e([o()],c.prototype,"filterFunction",void 0),e([o()],c.prototype,"groupBy",null),e([o()],c.prototype,"layers",null),e([o()],c.prototype,"state",null),e([o({readOnly:!0})],c.prototype,"numberOfFeatureTemplates",null),e([o({readOnly:!0})],c.prototype,"items",null),e([o({readOnly:!0})],c.prototype,"selectedItem",void 0),c=p=e([l("esri.widgets.FeatureTemplates.FeatureTemplatesViewModel")],c);const h=c;export{h as default};
|
package/widgets/Fullscreen.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import o from"./Fullscreen/FullscreenViewModel.js";import{globalCss as l}from"./support/globalCss.js";import{legacyIcon as i}from"./support/legacyIcon.js";import{accessibleHandler as n}from"./support/decorators/accessibleHandler.js";import{messageBundle as a}from"./support/decorators/messageBundle.js";import{tsx as p}from"./support/jsxFactory.js";import"./support/widgetUtils.js";const c={base:"esri-fullscreen"};let d=class extends r{constructor(e,t){super(e,t),this.messages=null,this.viewModel=new o}get element(){return this.viewModel.element}set element(e){this.viewModel.element=e}get fullscreenTitle(){const e=this.viewModel?.state;return"active"===e?this.messages.exit:"ready"===e?this.messages.enter:""}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e=this.viewModel?.state,{fullscreenTitle:t}=this,s={[l.disabled]:"disabled"===e||"feature-unsupported"===e};return p("div",{bind:this,class:this.classes(c.base,l.
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import o from"./Fullscreen/FullscreenViewModel.js";import{globalCss as l}from"./support/globalCss.js";import{legacyIcon as i}from"./support/legacyIcon.js";import{accessibleHandler as n}from"./support/decorators/accessibleHandler.js";import{messageBundle as a}from"./support/decorators/messageBundle.js";import{tsx as p}from"./support/jsxFactory.js";import"./support/widgetUtils.js";const c={base:"esri-fullscreen"};let d=class extends r{constructor(e,t){super(e,t),this.messages=null,this.viewModel=new o}get element(){return this.viewModel.element}set element(e){this.viewModel.element=e}get fullscreenTitle(){const e=this.viewModel?.state;return"active"===e?this.messages.exit:"ready"===e?this.messages.enter:""}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e=this.viewModel?.state,{fullscreenTitle:t}=this,s={[l.disabled]:"disabled"===e||"feature-unsupported"===e};return p("div",{bind:this,class:this.classes(c.base,l.widget,l.widgetButton,s),role:"button",tabIndex:0,onclick:this._toggle,onkeydown:this._toggle,"aria-label":t,title:t},this._renderIcon(),this._renderTitle())}_renderIcon(){const e=this.viewModel?.state,t={[i.zoomOutFixed]:"ready"===e||"disabled"===e||"feature-unsupported"===e,[i.zoomInFixed]:"active"===e};return p("span",{class:this.classes(i.icon,t),"aria-hidden":"true"})}_renderTitle(){return p("span",{class:i.fontFallbackText},this.fullscreenTitle)}_toggle(){this.viewModel.toggle()}};e([t()],d.prototype,"element",null),e([t({readOnly:!0})],d.prototype,"fullscreenTitle",null),e([t()],d.prototype,"label",null),e([t(),a("esri/widgets/Fullscreen/t9n/Fullscreen")],d.prototype,"messages",void 0),e([t()],d.prototype,"view",null),e([t({type:o})],d.prototype,"viewModel",void 0),e([n()],d.prototype,"_toggle",null),d=e([s("esri.widgets.Fullscreen")],d);const u=d;export{u as default};
|