@arcgis/core 4.27.0-next.20230521 → 4.27.0-next.20230523
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Graphic.js +1 -1
- package/WebMap.js +1 -1
- package/arcade/featureset/actions/SpatialFilter.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
- package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/030b43764f945cb1f8b0.js +1 -0
- package/assets/esri/core/workers/chunks/0d02856e55d20b99fc8b.js +1 -0
- package/assets/esri/core/workers/chunks/{69242c66492717c7388c.js → 0fcb8d408696075338e2.js} +1 -1
- package/assets/esri/core/workers/chunks/{b91c155de9a89e4e6971.js → 187c3b971ed0fc4363ef.js} +1 -1
- package/assets/esri/core/workers/chunks/{85c6ce93aa41e6b65997.js → 18db07d739a713cc0465.js} +1 -1
- package/assets/esri/core/workers/chunks/1b6177e23327be645c8c.js +1 -0
- package/assets/esri/core/workers/chunks/28286014a575042619ee.js +1 -0
- package/assets/esri/core/workers/chunks/{692dfeb2e255fdc0ade2.js → 39288fa69561d21f04f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{2b9d3e60977934a6d471.js → 3bc6b5f0643364749ef8.js} +1 -1
- package/assets/esri/core/workers/chunks/45e5ad704d18dd0857ce.js +1 -0
- package/assets/esri/core/workers/chunks/4d24efa01d1accc5a5f0.js +1 -0
- package/assets/esri/core/workers/chunks/{6312783626bacf52df7a.js → 55486c644e8b01326a0d.js} +1 -1
- package/assets/esri/core/workers/chunks/5576858f56314afcb4d5.js +1 -0
- package/assets/esri/core/workers/chunks/{62d9d15f0d00a75da42c.js → 571dac507622948ac03e.js} +1 -1
- package/assets/esri/core/workers/chunks/59063d6abf70f6598425.js +1 -0
- package/assets/esri/core/workers/chunks/5a4c04bf4f57e74457c5.js +1 -0
- package/assets/esri/core/workers/chunks/5bf04c32e0ac89dcbf9f.js +1 -0
- package/assets/esri/core/workers/chunks/6a3d611e8842afbb50ab.js +2 -0
- package/assets/esri/core/workers/chunks/{55ca6ba8b40921025181.js.LICENSE.txt → 6a3d611e8842afbb50ab.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/70d6e5edf05ef7079fa8.js +1 -0
- package/assets/esri/core/workers/chunks/71bdf8f10aee0077f681.js +1 -0
- package/assets/esri/core/workers/chunks/72b2c3c8e76da699690c.js +1 -0
- package/assets/esri/core/workers/chunks/78ce0b1af62435d8ebf4.js +1 -0
- package/assets/esri/core/workers/chunks/791f529e90135398b3d5.js +1 -0
- package/assets/esri/core/workers/chunks/8d3abfe6fdc5ac8d6cb7.js +1 -0
- package/assets/esri/core/workers/chunks/{1edc5c06874cb12c5478.js → 924e4a18d8403d1caea3.js} +1 -1
- package/assets/esri/core/workers/chunks/96d339abcd917f1f0ae1.js +1 -0
- package/assets/esri/core/workers/chunks/97cdbec7532cfcdf9ad2.js +1 -0
- package/assets/esri/core/workers/chunks/{f3f6035a17f7dcd19675.js → 9ab400a89dd701778d2c.js} +1 -1
- package/assets/esri/core/workers/chunks/{1488b3d48232844b8bb4.js → 9fe349f43d5ff5a4ac2d.js} +1 -1
- package/assets/esri/core/workers/chunks/{22396dd3717d17a5d235.js → a1c31bb8c12831539328.js} +1 -1
- package/assets/esri/core/workers/chunks/b0571b9e602218cdc7aa.js +1 -0
- package/assets/esri/core/workers/chunks/b1d88f8e528bf7092f35.js +1 -0
- package/assets/esri/core/workers/chunks/b4e2dc6b3d06b426e596.js +1 -0
- package/assets/esri/core/workers/chunks/{48abcb2d88f22e6e9fde.js → c2cb9fa18c77f0c5104e.js} +1 -1
- package/assets/esri/core/workers/chunks/cad7a2092ea7f51dbd8b.js +1 -0
- package/assets/esri/core/workers/chunks/d08800a30b1227591986.js +1 -0
- package/assets/esri/core/workers/chunks/d725dbbdeb05322e6d88.js +1 -0
- package/assets/esri/core/workers/chunks/df3e497d12ed77bae168.js +1 -0
- package/assets/esri/core/workers/chunks/fb080339bfaf32731ca6.js +1 -0
- package/assets/esri/core/workers/chunks/{56fc7924b4fb30239c19.js → fdf58386a67e54c09bfb.js} +1 -1
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
- package/assets/esri/themes/base/_core.scss +2 -0
- package/assets/esri/themes/base/widgets/_BasemapGallery.scss +86 -96
- package/assets/esri/themes/base/widgets/_FloorFilter.scss +6 -0
- package/assets/esri/themes/base/widgets/_UtilityNetworkValidateTopology.scss +40 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_en.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_nb.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ar.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_bg.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_bs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ca.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_cs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_da.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_de.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_el.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_en.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_es.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_et.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_fi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_fr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_he.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_hr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_hu.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_id.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_it.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ja.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ko.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_lt.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_lv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_nb.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_nl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pt-BR.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pt-PT.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ro.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ru.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_th.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_tr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_uk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_vi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-CN.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-HK.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-TW.json +1 -1
- package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
- package/chunks/arcgis-knowledge-client-core.js +1 -1
- package/chunks/mat4.js +1 -1
- package/core/accessorSupport/write.js +1 -1
- package/core/fontUtils.js +1 -1
- package/core/libs/gl-matrix-2/math/mat4.js +1 -1
- package/geometry/Mesh.js +1 -1
- package/geometry/support/MeshGeoreferencedRelativeVertexSpace.d.ts +4 -0
- package/geometry/support/MeshGeoreferencedRelativeVertexSpace.js +5 -0
- package/geometry/support/MeshGeoreferencedVertexSpace.d.ts +4 -0
- package/geometry/support/MeshGeoreferencedVertexSpace.js +5 -0
- package/geometry/support/MeshLocalVertexSpace.d.ts +4 -0
- package/geometry/support/MeshLocalVertexSpace.js +5 -0
- package/geometry/support/MeshTransform.d.ts +4 -0
- package/geometry/support/MeshTransform.js +1 -1
- package/geometry/support/meshUtils/ElevationSamplerWorker.js +1 -1
- package/geometry/support/meshUtils/centerAt.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/geometry.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
- package/geometry/support/meshUtils/geographicUtils.js +1 -1
- package/geometry/support/meshUtils/georeference.js +1 -1
- package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/meshUtils/offset.js +1 -1
- package/geometry/support/meshUtils/primitives.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/geometry/support/meshUtils/scale.js +1 -1
- package/interfaces.d.ts +227 -25
- package/layers/LinkChartLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/graphics/data/attributeSupport.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/knowledgeGraph/SessionMemoryStorage.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/CompositeBandFunction.js +1 -1
- package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
- package/layers/support/rasterFunctions/ExtractBandFunctionArguments.js +1 -1
- package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
- package/networks/support/TopologyValidationJobInfo.js +1 -1
- package/package.json +2 -2
- package/popup/FieldInfo.js +1 -1
- package/portal/Portal.js +1 -1
- package/rest/support/FeatureSet.js +1 -1
- package/rest/support/meshFeatureSet.js +1 -1
- package/smartMapping/symbology/color.js +1 -1
- package/smartMapping/symbology/support/colors.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/support/utils.js +1 -1
- package/views/2d/layers/StreamLayerView2D.js +1 -1
- package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/meshFastUpdateUtils.js +1 -1
- package/views/3d/interactive/editingTools/moveGraphic/GraphicMoveTool.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateMeshAdapter.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/undoRecords.js +1 -1
- package/views/3d/layers/StreamLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/symbolComplexity.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/DisplayQualityProfile.js +1 -1
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/webgl-engine/lib/Camera.js +1 -1
- package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
- package/views/3d/webgl-engine/lib/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/helpMessageUtils.js +1 -1
- package/views/interactive/dragEventPipeline.js +1 -1
- package/views/layers/StreamLayerView.js +1 -1
- package/widgets/BasemapGallery/css.js +1 -1
- package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
- package/widgets/BasemapGallery.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/Edits.js +1 -1
- package/widgets/Editor/Upload.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Locate.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.js +5 -0
- package/widgets/UtilityNetworkValidateTopology.js +5 -0
- package/widgets/support/widgetUtils.js +1 -1
- package/assets/esri/core/workers/chunks/163bf2e13abbdd298374.js +0 -1
- package/assets/esri/core/workers/chunks/23f73f81aea461c0c6e6.js +0 -1
- package/assets/esri/core/workers/chunks/2640204c4655aa535ccb.js +0 -1
- package/assets/esri/core/workers/chunks/2bf42d060f877566b989.js +0 -1
- package/assets/esri/core/workers/chunks/34ec9623a1bece86a82b.js +0 -1
- package/assets/esri/core/workers/chunks/3bf52139340827794c3b.js +0 -1
- package/assets/esri/core/workers/chunks/3cebdd77a8401495097f.js +0 -1
- package/assets/esri/core/workers/chunks/48cb634255e39711a720.js +0 -1
- package/assets/esri/core/workers/chunks/4d5f71d84c85f45c97ea.js +0 -1
- package/assets/esri/core/workers/chunks/52d02021e858820bc4fa.js +0 -1
- package/assets/esri/core/workers/chunks/55ca6ba8b40921025181.js +0 -2
- package/assets/esri/core/workers/chunks/64b8f65e2ef6cbf08380.js +0 -1
- package/assets/esri/core/workers/chunks/662e479c370c11bcb8a7.js +0 -1
- package/assets/esri/core/workers/chunks/78aede1e114deefacb54.js +0 -1
- package/assets/esri/core/workers/chunks/7ef100158ca28631fcaf.js +0 -1
- package/assets/esri/core/workers/chunks/93ad67930aa7d4a4b0ac.js +0 -1
- package/assets/esri/core/workers/chunks/964795dfb57f0d0635d0.js +0 -1
- package/assets/esri/core/workers/chunks/99ce0a202dcd3d7dc290.js +0 -1
- package/assets/esri/core/workers/chunks/abe6c99a1a719543dbe8.js +0 -1
- package/assets/esri/core/workers/chunks/c3bf44146fddfe8990f7.js +0 -1
- package/assets/esri/core/workers/chunks/cbe817e966b57599bafd.js +0 -1
- package/assets/esri/core/workers/chunks/e15b5d7e46a834eacc57.js +0 -1
- package/assets/esri/core/workers/chunks/e1e0b3580e2c3098c9f4.js +0 -1
- package/assets/esri/core/workers/chunks/e305d20e4424451cab5b.js +0 -1
- package/assets/esri/core/workers/chunks/e6836c84470fb6bd25bf.js +0 -1
- package/assets/esri/core/workers/chunks/f924732902703233655e.js +0 -1
- package/assets/esri/core/workers/chunks/ff1c005eede0cf964332.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import{id as s}from"../../../kernel.js";import r from"../../../request.js";import a from"../../../TimeExtent.js";import{isSome as i}from"../../../core/arrayUtils.js";import o from"../../../core/Error.js";import has from"../../../core/has.js";import{JSONMap as n}from"../../../core/jsonMap.js";import u from"../../../core/Loadable.js";import l from"../../../core/Logger.js";import{setDeepValue as d}from"../../../core/object.js";import{debounce as c,after as p}from"../../../core/promiseUtils.js";import{join as h,parseData as y}from"../../../core/urlUtils.js";import{generateBracedUUID as m}from"../../../core/uuid.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import R from"../../../geometry/Extent.js";import{initializeProjection as b,project as F}from"../../../geometry/projection.js";import{fromJSON as S}from"../../../geometry/support/jsonUtils.js";import{isOriginalExternal as E}from"../../../geometry/support/meshUtils/External.js";import{isFeatureIdentifierArrayWithGlobalId as q,isFeatureIdentifierArrayWithObjectId as w}from"../editingSupport.js";import{createDrawingInfo as _}from"./support/clientSideDefaults.js";import O from"./support/QueryTask.js";import{isHostedAgolService as I}from"../../support/arcgisLayerUrl.js";import{getAssetMapTable as A}from"../../support/infoFor3D.js";import{executeQueryJSON as j}from"../../../rest/query/executeQueryJSON.js";import{unapplyEditsZUnitScaling as T}from"../../../rest/query/operations/editsZScale.js";import x from"../../../rest/support/Query.js";import N from"../../../geometry/SpatialReference.js";const J=new n({originalAndCurrentFeatures:"original-and-current-features",none:"none"}),v=new Set(["Feature Layer","Table"]),k=new n({Started:"published",Publishing:"publishing",Stopped:"unavailable"});let M=class extends u{constructor(){super(...arguments),this.type="feature-layer",this.refresh=c((async()=>{await this.load();const e=this.sourceJSON.editingInfo?.lastEditDate;if(null==e)return{dataChanged:!0,updates:{}};try{await this._fetchService(null)}catch{return{dataChanged:!0,updates:{}}}const t=e!==this.sourceJSON.editingInfo?.lastEditDate;return{dataChanged:t,updates:t?{editingInfo:this.sourceJSON.editingInfo,extent:this.sourceJSON.extent}:null}})),this._ongoingAssetUploads=new Map}load(e){const t=null!=e?e.signal:null,s=this.layer.sourceJSON;return this.addResolvingPromise(this._fetchService(s,t)),Promise.resolve(this)}get queryTask(){const{capabilities:e,parsedUrl:t,dynamicDataSource:s,infoFor3D:r,gdbVersion:a,spatialReference:i,fieldsIndex:o}=this.layer,n=has("featurelayer-pbf")&&e?.query.supportsFormatPBF&&null==r,u=e?.operations?.supportsQueryAttachments??!1;return new O({url:t.path,pbfSupported:n,fieldsIndex:o,infoFor3D:r,dynamicDataSource:s,gdbVersion:a,sourceSpatialReference:i,queryAttachmentsSupported:u})}async addAttachment(e,t){await this.load();const s=e.attributes[this.layer.objectIdField],a=this.layer.parsedUrl.path+"/"+s+"/addAttachment",i=this._getLayerRequestOptions(),o=this._getFormDataForAttachment(t,i.query);try{const e=await r(a,{body:o});return this._createFeatureEditResult(e.data.addAttachmentResult)}catch(n){throw this._createAttachmentErrorResult(s,n)}}async updateAttachment(e,t,s){await this.load();const a=e.attributes[this.layer.objectIdField],i=this.layer.parsedUrl.path+"/"+a+"/updateAttachment",o=this._getLayerRequestOptions({query:{attachmentId:t}}),n=this._getFormDataForAttachment(s,o.query);try{const e=await r(i,{body:n});return this._createFeatureEditResult(e.data.updateAttachmentResult)}catch(u){throw this._createAttachmentErrorResult(a,u)}}async applyEdits(e,t){await this.load();const{layer:a}=this,o=a.infoFor3D,n=null!=o,u=n||(t?.globalIdUsed??!1),l=e.addFeatures?.map((e=>this._getFeatureJSON(e,o)))??[],d=(await Promise.all(l)).filter(i),c=e.updateFeatures?.map((e=>this._getFeatureJSON(e,o)))??[],p=(await Promise.all(c)).filter(i),h=this._getFeatureIds(e.deleteFeatures,u);T(d,p,a.spatialReference);const y=await this._getAttachmentEditsJSON(e),m=n?await this._uploadMeshesAndGetAssetMapEditsJSON(e):null,g=a.capabilities.editing.supportsAsyncApplyEdits&&null!=m&&(0!==m.adds.length||0!==m.updates.length),f={gdbVersion:t?.gdbVersion||a.gdbVersion,rollbackOnFailure:t?.rollbackOnFailureEnabled,useGlobalIds:u,returnEditMoment:t?.returnEditMoment,usePreviousEditMoment:t?.usePreviousEditMoment,sessionId:t?.sessionId,async:g};t?.returnServiceEditsOption?(f.edits=JSON.stringify([{id:a.layerId,adds:d,updates:p,deletes:h,attachments:y,assetMaps:m}]),f.returnServiceEditsOption=J.toJSON(t?.returnServiceEditsOption),f.returnServiceEditsInSourceSR=t?.returnServiceEditsInSourceSR):(f.adds=d.length?JSON.stringify(d):null,f.updates=p.length?JSON.stringify(p):null,f.deletes=h.length?u?JSON.stringify(h):h.join(","):null,f.attachments=y&&JSON.stringify(y),f.assetMaps=null!=m?JSON.stringify(m):void 0);const R=this._getLayerRequestOptions({method:"post",query:f}),b=t?.returnServiceEditsOption?a.url:a.parsedUrl.path,F=g?await this._asyncApplyEdits(b+"/applyEdits",R):await r(b+"/applyEdits",R);if(!a.capabilities.operations?.supportsEditing&&a.effectiveCapabilities?.operations?.supportsEditing){const e=s?.findCredential(a.url);await(e?.refreshToken())}return this._createEditsResult(F)}async deleteAttachments(e,t){await this.load();const s=e.attributes[this.layer.objectIdField],a=this.layer.parsedUrl.path+"/"+s+"/deleteAttachments";try{return(await r(a,this._getLayerRequestOptions({query:{attachmentIds:t.join(",")},method:"post"}))).data.deleteAttachmentResults.map(this._createFeatureEditResult)}catch(i){throw this._createAttachmentErrorResult(s,i)}}fetchRecomputedExtents(e={}){const t=e.signal;return this.load({signal:t}).then((async()=>{const t=this._getLayerRequestOptions({...e,query:{returnUpdates:!0}}),{layerId:s,url:i}=this.layer,{data:o}=await r(`${i}/${s}`,t),{id:n,extent:u,fullExtent:l,timeExtent:d}=o,c=u||l;return{id:n,fullExtent:c&&R.fromJSON(c),timeExtent:d&&a.fromJSON({start:d[0],end:d[1]})}}))}async queryAttachments(e,t={}){await this.load();const s=this._getLayerRequestOptions(t);return this.queryTask.executeAttachmentQuery(e,s)}async queryFeatures(e,t){return await this.load(),this.queryTask.execute(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeaturesJSON(e,t){return await this.load(),this.queryTask.executeJSON(e,{...t,query:this._createRequestQueryOptions(t)})}async queryObjectIds(e,t){return await this.load(),this.queryTask.executeForIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeatureCount(e,t){return await this.load(),this.queryTask.executeForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryExtent(e,t){return await this.load(),this.queryTask.executeForExtent(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeatures(e,t){return await this.load(),this.queryTask.executeRelationshipQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeaturesCount(e,t){return await this.load(),this.queryTask.executeRelationshipQueryForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopFeatures(e,t){return await this.load(),this.queryTask.executeTopFeaturesQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopObjectIds(e,t){return await this.load(),this.queryTask.executeForTopIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopExtents(e,t){return await this.load(),this.queryTask.executeForTopExtents(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopCount(e,t){return await this.load(),this.queryTask.executeForTopCount(e,{...t,query:this._createRequestQueryOptions(t)})}async fetchPublishingStatus(){if(!I(this.layer.url))return"unavailable";const e=h(this.layer.url,"status"),t=await r(e,{query:{f:"json"}});return k.fromJSON(t.data.status)}async uploadAssets(e,t){const{uploadAssets:s}=await import("./support/uploadAssets.js");return s(e,{layer:this.layer,ongoingUploads:this._ongoingAssetUploads},t)}async _asyncApplyEdits(e,t){const s=(await r(e,t)).data.statusUrl;for(;;){const e=(await r(s,{query:{f:"json"},responseType:"json"})).data;switch(e.status){case"Completed":return r(e.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new o("async-applyEdits-failed","asynchronous applyEdits call failed.");case"Failed ImportChanges":case"InProgress":case"Pending":case"ExportAttachments":case"ExportChanges":case"ExportingData":case"ExportingSnapshot":case"ImportAttachments":case"ProvisioningReplica":case"UnRegisteringReplica":break;default:throw new o("async-applyEdits-failed","asynchronous applyEdits call failed (undefined response status)")}await p(U)}}_createRequestQueryOptions(e){const t={...this.layer.customParameters,token:this.layer.apiKey,...e?.query};return this.layer.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t}async _fetchService(e,t){if(!e){const{data:s}=await r(this.layer.parsedUrl.path,this._getLayerRequestOptions({query:has("featurelayer-advanced-symbols")?{returnAdvancedSymbols:!0}:{},signal:t}));e=s}this.sourceJSON=this._patchServiceJSON(e);const s=e.type;if(!v.has(s))throw new o("feature-layer-source:unsupported-type",`Source type "${s}" is not supported`)}_patchServiceJSON(e){if("Table"!==e.type&&e.geometryType&&!e?.drawingInfo?.renderer&&!e.defaultSymbol){const t=_(e.geometryType).renderer;d("drawingInfo.renderer",t,e)}return"esriGeometryMultiPatch"===e.geometryType&&e.infoFor3D&&(e.geometryType="mesh"),e}async _getFeatureJSON(e,t){const{geometry:s}=e,r={...e.attributes};if(null!=t&&null!=e.geometry&&"mesh"===e.geometry.type){const{transformFieldRoles:s}=t,{origin:a,spatialReference:i,transform:o}=e.geometry,n=this.layer.spatialReference;await b(i,n);const u=F(a,n);if(r[s.originX]=u.x,r[s.originY]=u.y,r[s.originZ]=u.z,null!=o){const{translation:e,scale:t,rotation:a}=o;r[s.translationX]=e[0],r[s.translationY]=-e[2],r[s.translationZ]=e[1],r[s.scaleX]=t[0],r[s.scaleY]=t[1],r[s.scaleZ]=t[2],r[s.rotationX]=a[0],r[s.rotationY]=a[2],r[s.rotationZ]=a[1],r[s.rotationDeg]=a[3]}return{geometry:null,attributes:r}}return null==s?{attributes:r}:"mesh"===s.type||"extent"===s.type?null:{geometry:s.toJSON(),attributes:r}}async _getAttachmentEditsJSON(e){const t=await Promise.all((e.addAttachments??[]).map((e=>this._getAttachmentEditJSON(e)))),s=await Promise.all((e.updateAttachments??[]).map((e=>this._getAttachmentEditJSON(e)))),r=e.deleteAttachments??[];return t.length||s.length||r.length?{adds:t,updates:s,deletes:[...r]}:null}async _getAttachmentEditJSON(e){const{feature:t,attachment:s}=e,{globalId:r,name:a,contentType:i,data:o,uploadId:n}=s,u={globalId:r,parentGlobalId:null,contentType:null,name:null,uploadId:null,data:null};if(t&&(u.parentGlobalId="attributes"in t?t.attributes&&t.attributes[this.layer.globalIdField]:t.globalId),n)u.uploadId=n;else if(o){const e=await y(o);e&&(u.contentType=e.mediaType,u.data=e.data),o instanceof File&&(u.name=o.name)}return a&&(u.name=a),i&&(u.contentType=i),u}async _uploadMeshesAndGetAssetMapEditsJSON(e){const{addAssetFeatures:t}=e;if(!t?.length)return null;const s=await this._filterRedundantAssetMaps(t);if(!t?.length)return null;const r=s.map((e=>e.geometry));return await this.uploadAssets(r),{adds:this._getAssetMapEditsJSON(s),updates:[],deletes:[]}}_getAssetMapEditsJSON(e){const t=new Array,s=this.layer.globalIdField,r=this.layer.parsedUrl;for(const a of e){const e=a.geometry,{metadata:i}=e,o=i.getExternalSourcesOnService(r),n=a.getAttribute(s);if(0===o.length){l.getLogger(this).error(`Skipping feature ${n}. The mesh it is associated with has not been uploaded to the service and cannot be mapped to it.`);continue}const{source:u}=o.find(E)??o[0],{transform:d}=e,c=!d||!d.geographic?["PROJECT_VERTICES"]:[];for(const s of u)1===s.parts.length?t.push({globalId:m(),parentGlobalId:n,assetName:s.assetName,assetHash:s.parts[0].partHash,flags:c}):l.getLogger(this).error(`Skipping asset ${s.assetName}. It does not have exactly one part, so we cannot map it to a feature.`)}return t}_getFeatureIds(e,t){if(!e||0===e.length)return[];if(t&&q(e))return e.map((e=>e.globalId));if(w(e))return e.map((e=>e.objectId));const{layer:s}=this,r=t?s.globalIdField:s.objectIdField;return r?e.map((e=>e.getAttribute(r))):[]}_createEditsResult(e){const t=e.data,{layerId:s}=this.layer,r=[];let a=null;if(Array.isArray(t))for(const u of t)r.push({id:u.id,editedFeatures:u.editedFeatures}),u.id===s&&(a={addResults:u.addResults??[],updateResults:u.updateResults??[],deleteResults:u.deleteResults??[],attachments:u.attachments,editMoment:u.editMoment});else a=t;const i=a?.assetMaps;if(i){for(const e of i.addResults)e.success||l.getLogger(this).error(`Failed to map asset to feature with globalId ${e.globalId}.`);for(const e of i.updateResults)e.success||l.getLogger(this).error(`Failed to map asset to feature with globalId ${e.globalId}.`)}const o=a?.attachments,n={addFeatureResults:a?.addResults?.map(this._createFeatureEditResult,this)??[],updateFeatureResults:a?.updateResults?.map(this._createFeatureEditResult,this)??[],deleteFeatureResults:a?.deleteResults?.map(this._createFeatureEditResult,this)??[],addAttachmentResults:o&&o.addResults?o.addResults.map(this._createFeatureEditResult,this):[],updateAttachmentResults:o&&o.updateResults?o.updateResults.map(this._createFeatureEditResult,this):[],deleteAttachmentResults:o&&o.deleteResults?o.deleteResults.map(this._createFeatureEditResult,this):[]};if(a?.editMoment&&(n.editMoment=a.editMoment),r.length>0){n.editedFeatureResults=[];for(const e of r){const{editedFeatures:t}=e,s=t?.spatialReference?new N(t.spatialReference):null;n.editedFeatureResults.push({layerId:e.id,editedFeatures:{adds:t?.adds?.map((e=>this._createEditedFeature(e,s)))||[],updates:t?.updates?.map((e=>({original:this._createEditedFeature(e[0],s),current:this._createEditedFeature(e[1],s)})))||[],deletes:t?.deletes?.map((e=>this._createEditedFeature(e,s)))||[],spatialReference:s}})}}return n}_createEditedFeature(e,s){return new t({attributes:e.attributes,geometry:S({...e.geometry,spatialReference:s})})}_createFeatureEditResult(e){const t=!0===e.success?null:e.error||{code:void 0,description:void 0};return{objectId:e.objectId,globalId:e.globalId,error:t?new o("feature-layer-source:edit-failure",t.description,{code:t.code}):null}}_createAttachmentErrorResult(e,t){const s=t.details.messages&&t.details.messages[0]||t.message,r=t.details.httpStatus||t.details.messageCode;return{objectId:e,globalId:null,error:new o("feature-layer-source:attachment-failure",s,{code:r})}}_getFormDataForAttachment(e,t){const s=e instanceof FormData?e:e&&e.elements?new FormData(e):null;if(s)for(const r in t){const e=t[r];null!=e&&(s.set?s.set(r,e):s.append(r,e))}return s}_getLayerRequestOptions(e={}){const{parsedUrl:t,gdbVersion:s,dynamicDataSource:r}=this.layer;return{...e,query:{gdbVersion:s,layer:r?JSON.stringify({source:r}):void 0,...t.query,f:"json",...this._createRequestQueryOptions(e)},responseType:"json"}}async _filterRedundantAssetMaps(e){const{layer:t}=this,{globalIdField:s,infoFor3D:r,parsedUrl:a}=t;if(null==r||null==s)return e;const o=A(r);if(null==o)return e;const n=h(a.path,`../${o.id}`),u=e.map((e=>e.getAttribute(s))).filter(i);if(0===u.length)return e;const{assetMapFieldRoles:{parentGlobalId:l,assetHash:d}}=r,c=new x;c.where=`${l} IN (${u.map((e=>`'${e}'`))})`,c.outFields=[d,l],c.returnGeometry=!1;const p=await j(n,c),{features:y}=p;return 0===y.length?e:e.filter((e=>{const t=e.getAttribute(s);if(!t)return!0;const{metadata:r}=e.geometry,i=y.filter((e=>e.getAttribute(l)===t));if(0===i.length)return!0;const o=i.map((e=>e.getAttribute(d)));return r.getExternalSourcesOnService(a).flatMap((({source:e})=>e.flatMap((e=>e.parts.map((e=>e.partHash)))))).some((e=>o.every((t=>e!==t))))}))}};e([g()],M.prototype,"type",void 0),e([g({constructOnly:!0})],M.prototype,"layer",void 0),e([g({readOnly:!0})],M.prototype,"queryTask",null),M=e([f("esri.layers.graphics.sources.FeatureLayerSource")],M);const U=1e3,Q=M;export{Q as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import{id as s}from"../../../kernel.js";import r from"../../../request.js";import a from"../../../TimeExtent.js";import{isSome as i}from"../../../core/arrayUtils.js";import o from"../../../core/Error.js";import has from"../../../core/has.js";import{JSONMap as n}from"../../../core/jsonMap.js";import u from"../../../core/Loadable.js";import l from"../../../core/Logger.js";import{setDeepValue as d}from"../../../core/object.js";import{debounce as c,after as p}from"../../../core/promiseUtils.js";import{join as h,parseData as y}from"../../../core/urlUtils.js";import{generateBracedUUID as m}from"../../../core/uuid.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import R from"../../../geometry/Extent.js";import{initializeProjection as b,project as F}from"../../../geometry/projection.js";import{fromJSON as S}from"../../../geometry/support/jsonUtils.js";import{isOriginalExternal as E}from"../../../geometry/support/meshUtils/External.js";import{isFeatureIdentifierArrayWithGlobalId as q,isFeatureIdentifierArrayWithObjectId as w}from"../editingSupport.js";import{createDrawingInfo as _}from"./support/clientSideDefaults.js";import O from"./support/QueryTask.js";import{isHostedAgolService as I}from"../../support/arcgisLayerUrl.js";import{getAssetMapTable as A}from"../../support/infoFor3D.js";import{executeQueryJSON as j}from"../../../rest/query/executeQueryJSON.js";import{unapplyEditsZUnitScaling as T}from"../../../rest/query/operations/editsZScale.js";import x from"../../../rest/support/Query.js";import N from"../../../geometry/SpatialReference.js";const J=new n({originalAndCurrentFeatures:"original-and-current-features",none:"none"}),v=new Set(["Feature Layer","Table"]),k=new n({Started:"published",Publishing:"publishing",Stopped:"unavailable"});let M=class extends u{constructor(){super(...arguments),this.type="feature-layer",this.refresh=c((async()=>{await this.load();const e=this.sourceJSON.editingInfo?.lastEditDate;if(null==e)return{dataChanged:!0,updates:{}};try{await this._fetchService(null)}catch{return{dataChanged:!0,updates:{}}}const t=e!==this.sourceJSON.editingInfo?.lastEditDate;return{dataChanged:t,updates:t?{editingInfo:this.sourceJSON.editingInfo,extent:this.sourceJSON.extent}:null}})),this._ongoingAssetUploads=new Map}load(e){const t=null!=e?e.signal:null,s=this.layer.sourceJSON;return this.addResolvingPromise(this._fetchService(s,t)),Promise.resolve(this)}get queryTask(){const{capabilities:e,parsedUrl:t,dynamicDataSource:s,infoFor3D:r,gdbVersion:a,spatialReference:i,fieldsIndex:o}=this.layer,n=has("featurelayer-pbf")&&e?.query.supportsFormatPBF&&null==r,u=e?.operations?.supportsQueryAttachments??!1;return new O({url:t.path,pbfSupported:n,fieldsIndex:o,infoFor3D:r,dynamicDataSource:s,gdbVersion:a,sourceSpatialReference:i,queryAttachmentsSupported:u})}async addAttachment(e,t){await this.load();const s=e.attributes[this.layer.objectIdField],a=this.layer.parsedUrl.path+"/"+s+"/addAttachment",i=this._getLayerRequestOptions(),o=this._getFormDataForAttachment(t,i.query);try{const e=await r(a,{body:o});return this._createFeatureEditResult(e.data.addAttachmentResult)}catch(n){throw this._createAttachmentErrorResult(s,n)}}async updateAttachment(e,t,s){await this.load();const a=e.attributes[this.layer.objectIdField],i=this.layer.parsedUrl.path+"/"+a+"/updateAttachment",o=this._getLayerRequestOptions({query:{attachmentId:t}}),n=this._getFormDataForAttachment(s,o.query);try{const e=await r(i,{body:n});return this._createFeatureEditResult(e.data.updateAttachmentResult)}catch(u){throw this._createAttachmentErrorResult(a,u)}}async applyEdits(e,t){await this.load();const{layer:a}=this,o=a.infoFor3D,n=null!=o,u=n||(t?.globalIdUsed??!1),l=e.addFeatures?.map((e=>this._getFeatureJSON(e,o)))??[],d=(await Promise.all(l)).filter(i),c=e.updateFeatures?.map((e=>this._getFeatureJSON(e,o)))??[],p=(await Promise.all(c)).filter(i),h=this._getFeatureIds(e.deleteFeatures,u);T(d,p,a.spatialReference);const y=await this._getAttachmentEditsJSON(e),m=n?await this._uploadMeshesAndGetAssetMapEditsJSON(e):null,g=a.capabilities.editing.supportsAsyncApplyEdits&&null!=m&&(0!==m.adds.length||0!==m.updates.length),f={gdbVersion:t?.gdbVersion||a.gdbVersion,rollbackOnFailure:t?.rollbackOnFailureEnabled,useGlobalIds:u,returnEditMoment:t?.returnEditMoment,usePreviousEditMoment:t?.usePreviousEditMoment,sessionId:t?.sessionId,async:g};t?.returnServiceEditsOption?(f.edits=JSON.stringify([{id:a.layerId,adds:d,updates:p,deletes:h,attachments:y,assetMaps:m}]),f.returnServiceEditsOption=J.toJSON(t?.returnServiceEditsOption),f.returnServiceEditsInSourceSR=t?.returnServiceEditsInSourceSR):(f.adds=d.length?JSON.stringify(d):null,f.updates=p.length?JSON.stringify(p):null,f.deletes=h.length?u?JSON.stringify(h):h.join(","):null,f.attachments=y&&JSON.stringify(y),f.assetMaps=null!=m?JSON.stringify(m):void 0);const R=this._getLayerRequestOptions({method:"post",query:f}),b=t?.returnServiceEditsOption?a.url:a.parsedUrl.path,F=g?await this._asyncApplyEdits(b+"/applyEdits",R):await r(b+"/applyEdits",R);if(!a.capabilities.operations?.supportsEditing&&a.effectiveCapabilities?.operations?.supportsEditing){const e=s?.findCredential(a.url);await(e?.refreshToken())}return this._createEditsResult(F)}async deleteAttachments(e,t){await this.load();const s=e.attributes[this.layer.objectIdField],a=this.layer.parsedUrl.path+"/"+s+"/deleteAttachments";try{return(await r(a,this._getLayerRequestOptions({query:{attachmentIds:t.join(",")},method:"post"}))).data.deleteAttachmentResults.map(this._createFeatureEditResult)}catch(i){throw this._createAttachmentErrorResult(s,i)}}fetchRecomputedExtents(e={}){const t=e.signal;return this.load({signal:t}).then((async()=>{const t=this._getLayerRequestOptions({...e,query:{returnUpdates:!0}}),{layerId:s,url:i}=this.layer,{data:o}=await r(`${i}/${s}`,t),{id:n,extent:u,fullExtent:l,timeExtent:d}=o,c=u||l;return{id:n,fullExtent:c&&R.fromJSON(c),timeExtent:d&&a.fromJSON({start:d[0],end:d[1]})}}))}async queryAttachments(e,t={}){await this.load();const s=this._getLayerRequestOptions(t);return this.queryTask.executeAttachmentQuery(e,s)}async queryFeatures(e,t){return await this.load(),this.queryTask.execute(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeaturesJSON(e,t){return await this.load(),this.queryTask.executeJSON(e,{...t,query:this._createRequestQueryOptions(t)})}async queryObjectIds(e,t){return await this.load(),this.queryTask.executeForIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeatureCount(e,t){return await this.load(),this.queryTask.executeForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryExtent(e,t){return await this.load(),this.queryTask.executeForExtent(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeatures(e,t){return await this.load(),this.queryTask.executeRelationshipQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeaturesCount(e,t){return await this.load(),this.queryTask.executeRelationshipQueryForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopFeatures(e,t){return await this.load(),this.queryTask.executeTopFeaturesQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopObjectIds(e,t){return await this.load(),this.queryTask.executeForTopIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopExtents(e,t){return await this.load(),this.queryTask.executeForTopExtents(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopCount(e,t){return await this.load(),this.queryTask.executeForTopCount(e,{...t,query:this._createRequestQueryOptions(t)})}async fetchPublishingStatus(){if(!I(this.layer.url))return"unavailable";const e=h(this.layer.url,"status"),t=await r(e,{query:{f:"json"}});return k.fromJSON(t.data.status)}async uploadAssets(e,t){const{uploadAssets:s}=await import("./support/uploadAssets.js");return s(e,{layer:this.layer,ongoingUploads:this._ongoingAssetUploads},t)}async _asyncApplyEdits(e,t){const s=(await r(e,t)).data.statusUrl;for(;;){const e=(await r(s,{query:{f:"json"},responseType:"json"})).data;switch(e.status){case"Completed":return r(e.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new o("async-applyEdits-failed","asynchronous applyEdits call failed.");case"Failed ImportChanges":case"InProgress":case"Pending":case"ExportAttachments":case"ExportChanges":case"ExportingData":case"ExportingSnapshot":case"ImportAttachments":case"ProvisioningReplica":case"UnRegisteringReplica":break;default:throw new o("async-applyEdits-failed","asynchronous applyEdits call failed (undefined response status)")}await p(U)}}_createRequestQueryOptions(e){const t={...this.layer.customParameters,token:this.layer.apiKey,...e?.query};return this.layer.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t}async _fetchService(e,t){if(!e){const{data:s}=await r(this.layer.parsedUrl.path,this._getLayerRequestOptions({query:has("featurelayer-advanced-symbols")?{returnAdvancedSymbols:!0}:{},signal:t}));e=s}this.sourceJSON=this._patchServiceJSON(e);const s=e.type;if(!v.has(s))throw new o("feature-layer-source:unsupported-type",`Source type "${s}" is not supported`)}_patchServiceJSON(e){if("Table"!==e.type&&e.geometryType&&!e?.drawingInfo?.renderer&&!e.defaultSymbol){const t=_(e.geometryType).renderer;d("drawingInfo.renderer",t,e)}return"esriGeometryMultiPatch"===e.geometryType&&e.infoFor3D&&(e.geometryType="mesh"),e}async _getFeatureJSON(e,t){const{geometry:s}=e,r={...e.attributes};if(null!=t&&null!=e.geometry&&"mesh"===e.geometry.type){const{transformFieldRoles:s}=t,{origin:a,spatialReference:i,transform:o}=e.geometry,n=this.layer.spatialReference;await b(i,n);const u=F(a,n);if(r[s.originX]=u.x,r[s.originY]=u.y,r[s.originZ]=u.z??0,null!=o){const{translation:e,scale:t,rotation:a}=o;r[s.translationX]=e[0],r[s.translationY]=-e[2],r[s.translationZ]=e[1],r[s.scaleX]=t[0],r[s.scaleY]=t[1],r[s.scaleZ]=t[2],r[s.rotationX]=a[0],r[s.rotationY]=a[2],r[s.rotationZ]=a[1],r[s.rotationDeg]=a[3]}return{geometry:null,attributes:r}}return null==s?{attributes:r}:"mesh"===s.type||"extent"===s.type?null:{geometry:s.toJSON(),attributes:r}}async _getAttachmentEditsJSON(e){const t=await Promise.all((e.addAttachments??[]).map((e=>this._getAttachmentEditJSON(e)))),s=await Promise.all((e.updateAttachments??[]).map((e=>this._getAttachmentEditJSON(e)))),r=e.deleteAttachments??[];return t.length||s.length||r.length?{adds:t,updates:s,deletes:[...r]}:null}async _getAttachmentEditJSON(e){const{feature:t,attachment:s}=e,{globalId:r,name:a,contentType:i,data:o,uploadId:n}=s,u={globalId:r,parentGlobalId:null,contentType:null,name:null,uploadId:null,data:null};if(t&&(u.parentGlobalId="attributes"in t?t.attributes&&t.attributes[this.layer.globalIdField]:t.globalId),n)u.uploadId=n;else if(o){const e=await y(o);e&&(u.contentType=e.mediaType,u.data=e.data),o instanceof File&&(u.name=o.name)}return a&&(u.name=a),i&&(u.contentType=i),u}async _uploadMeshesAndGetAssetMapEditsJSON(e){const{addAssetFeatures:t}=e;if(!t?.length)return null;const s=await this._filterRedundantAssetMaps(t);if(!t?.length)return null;const r=s.map((e=>e.geometry));return await this.uploadAssets(r),{adds:this._getAssetMapEditsJSON(s),updates:[],deletes:[]}}_getAssetMapEditsJSON(e){const t=new Array,s=this.layer.globalIdField,r=this.layer.parsedUrl;for(const a of e){const e=a.geometry,{metadata:i}=e,o=i.getExternalSourcesOnService(r),n=a.getAttribute(s);if(0===o.length){l.getLogger(this).error(`Skipping feature ${n}. The mesh it is associated with has not been uploaded to the service and cannot be mapped to it.`);continue}const{source:u}=o.find(E)??o[0],{vertexSpace:d}=e,c=d.isGeoreferenced?["PROJECT_VERTICES"]:[];for(const s of u)1===s.parts.length?t.push({globalId:m(),parentGlobalId:n,assetName:s.assetName,assetHash:s.parts[0].partHash,flags:c}):l.getLogger(this).error(`Skipping asset ${s.assetName}. It does not have exactly one part, so we cannot map it to a feature.`)}return t}_getFeatureIds(e,t){if(!e||0===e.length)return[];if(t&&q(e))return e.map((e=>e.globalId));if(w(e))return e.map((e=>e.objectId));const{layer:s}=this,r=t?s.globalIdField:s.objectIdField;return r?e.map((e=>e.getAttribute(r))):[]}_createEditsResult(e){const t=e.data,{layerId:s}=this.layer,r=[];let a=null;if(Array.isArray(t))for(const u of t)r.push({id:u.id,editedFeatures:u.editedFeatures}),u.id===s&&(a={addResults:u.addResults??[],updateResults:u.updateResults??[],deleteResults:u.deleteResults??[],attachments:u.attachments,editMoment:u.editMoment});else a=t;const i=a?.assetMaps;if(i){for(const e of i.addResults)e.success||l.getLogger(this).error(`Failed to map asset to feature with globalId ${e.globalId}.`);for(const e of i.updateResults)e.success||l.getLogger(this).error(`Failed to map asset to feature with globalId ${e.globalId}.`)}const o=a?.attachments,n={addFeatureResults:a?.addResults?.map(this._createFeatureEditResult,this)??[],updateFeatureResults:a?.updateResults?.map(this._createFeatureEditResult,this)??[],deleteFeatureResults:a?.deleteResults?.map(this._createFeatureEditResult,this)??[],addAttachmentResults:o&&o.addResults?o.addResults.map(this._createFeatureEditResult,this):[],updateAttachmentResults:o&&o.updateResults?o.updateResults.map(this._createFeatureEditResult,this):[],deleteAttachmentResults:o&&o.deleteResults?o.deleteResults.map(this._createFeatureEditResult,this):[]};if(a?.editMoment&&(n.editMoment=a.editMoment),r.length>0){n.editedFeatureResults=[];for(const e of r){const{editedFeatures:t}=e,s=t?.spatialReference?new N(t.spatialReference):null;n.editedFeatureResults.push({layerId:e.id,editedFeatures:{adds:t?.adds?.map((e=>this._createEditedFeature(e,s)))||[],updates:t?.updates?.map((e=>({original:this._createEditedFeature(e[0],s),current:this._createEditedFeature(e[1],s)})))||[],deletes:t?.deletes?.map((e=>this._createEditedFeature(e,s)))||[],spatialReference:s}})}}return n}_createEditedFeature(e,s){return new t({attributes:e.attributes,geometry:S({...e.geometry,spatialReference:s})})}_createFeatureEditResult(e){const t=!0===e.success?null:e.error||{code:void 0,description:void 0};return{objectId:e.objectId,globalId:e.globalId,error:t?new o("feature-layer-source:edit-failure",t.description,{code:t.code}):null}}_createAttachmentErrorResult(e,t){const s=t.details.messages&&t.details.messages[0]||t.message,r=t.details.httpStatus||t.details.messageCode;return{objectId:e,globalId:null,error:new o("feature-layer-source:attachment-failure",s,{code:r})}}_getFormDataForAttachment(e,t){const s=e instanceof FormData?e:e&&e.elements?new FormData(e):null;if(s)for(const r in t){const e=t[r];null!=e&&(s.set?s.set(r,e):s.append(r,e))}return s}_getLayerRequestOptions(e={}){const{parsedUrl:t,gdbVersion:s,dynamicDataSource:r}=this.layer;return{...e,query:{gdbVersion:s,layer:r?JSON.stringify({source:r}):void 0,...t.query,f:"json",...this._createRequestQueryOptions(e)},responseType:"json"}}async _filterRedundantAssetMaps(e){const{layer:t}=this,{globalIdField:s,infoFor3D:r,parsedUrl:a}=t;if(null==r||null==s)return e;const o=A(r);if(null==o)return e;const n=h(a.path,`../${o.id}`),u=e.map((e=>e.getAttribute(s))).filter(i);if(0===u.length)return e;const{assetMapFieldRoles:{parentGlobalId:l,assetHash:d}}=r,c=new x;c.where=`${l} IN (${u.map((e=>`'${e}'`))})`,c.outFields=[d,l],c.returnGeometry=!1;const p=await j(n,c),{features:y}=p;return 0===y.length?e:e.filter((e=>{const t=e.getAttribute(s);if(!t)return!0;const{metadata:r}=e.geometry,i=y.filter((e=>e.getAttribute(l)===t));if(0===i.length)return!0;const o=i.map((e=>e.getAttribute(d)));return r.getExternalSourcesOnService(a).flatMap((({source:e})=>e.flatMap((e=>e.parts.map((e=>e.partHash)))))).some((e=>o.every((t=>e!==t))))}))}};e([g()],M.prototype,"type",void 0),e([g({constructOnly:!0})],M.prototype,"layer",void 0),e([g({readOnly:!0})],M.prototype,"queryTask",null),M=e([f("esri.layers.graphics.sources.FeatureLayerSource")],M);const U=1e3,Q=M;export{Q 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import i from"../../core/Error.js";import n from"../../core/Logger.js";import{parseWhereClause as o}from"../../core/sql.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{encodeGeohash as a}from"../../geohash/geohashUtils.js";import p from"../../geometry/Polygon.js";import{initializeProjection as m,project as d}from"../../geometry/projection.js";import{WGS84 as l}from"../../geometry/support/spatialReferenceUtils.js";import h from"./SessionMemoryStorage.js";import{executeQueryStreaming as c}from"../../rest/knowledgeGraphService.js";import y from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import u from"../../rest/support/Query.js";const f="ESRI__ID",g="ESRI__ORIGIN_ID",b="ESRI__DESTINATION_ID",T="ESRI__LAYOUT_GEOMETRY",w=12,D=n.getLogger("esri.rest.knowledgeGraph.knowledgeGraphLayer.KnowledgeGraphLayerDataManager");let I=class extends t{constructor(e){super(e),this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this._processingCacheUpdatesLookup=new Map,this._memberIdTypeLookup=new Map;const t=new Map;e.knowledgeGraph.dataModel.entityTypes?.forEach((i=>{i.name&&(t.set(i.name,"entity"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.entityTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((i=>{i.name&&(t.set(i.name,"relationship"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.relationshipTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,n)=>{if("entity"===t.get(n))this.entityTypeNames.add(n);else{if("relationship"!==t.get(n))return D.warn(`A named type, ${n}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(n);this.relationshipTypeNames.add(n)}const o=new Map;i.members?.forEach((e=>{this._memberIdTypeLookup.set(e.id,n);const t=this.getById(e.id);t&&o.set(e.id,t)})),this.sublayerCaches.set(n,o)}))}addToLayerInclusionSet(e){e.forEach((({typeName:e,id:t})=>{if(!this.inclusionModeDefinition)throw new i("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){const n=this.inclusionModeDefinition.namedTypeDefinitions.get(e);if(n.useAllData)throw new i("knowledge-graph:layer-data-manager","You cannot add members to an exclusion list for a sublayer where the sublayer is set to always retrieve its entire data set");n.members||(n.members=new Map),n.members.set(t,{id:t}),this._memberIdTypeLookup.set(t,e)}}else{const i=new Map;i.set(t,{id:t}),this.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:i}),this._memberIdTypeLookup.set(t,e)}}))}getById(e){return h.getInstance().readFromStoreById(e)}async getData(e,t,i){if(t.objectType.name&&this.inclusionModeDefinition?.namedTypeDefinitions&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(t.objectType.name))return[];let n;if(n=e||new u({where:"1=1",outFields:["*"]}),"link-chart"===t.parentCompositeLayer.type){const e=t.parentCompositeLayer,i=this._processingCacheUpdatesLookup.get(t.objectType.name??""),o=n.outFields,s=n.geometry;let r="",p="";s&&s.extent&&(r=a(s.extent.ymin,s.extent.xmin,w),p=a(s.extent.ymax,s.extent.xmax,w)),o&&1===o.length&&o[0]===f&&"1=1"===n.where||await Promise.all(i??[]);const m=this.sublayerCaches.has(t.objectType.name??"")?Array.from(this.sublayerCaches.get(t.objectType.name)?.values()):[],d=[];return m.forEach((i=>{if(i.geometry=e.linkChartDiagramLookup.get(i.attributes[t.objectIdField]),i.attributes[T]=i.geometry,r&&p){const n=e.linkChartGeohashLookup.get(i.attributes[t.objectIdField]);n?n>=r&&n<=p&&d.push(i):d.push(i)}else d.push(i)})),d}return this.retrieveDataFromService(n,t,i)}async getConnectedRecordIds(e){const t=[],i=[],n=new Map;return e.forEach((e=>{if(this._memberIdTypeLookup.has(e)){const t=this._memberIdTypeLookup.get(e);if(!this.entityTypeNames.has(t))return;n.has(t)?n.get(t)?.push(e):n.set(t,[e])}})),n.forEach(((e,n)=>{const o=`MATCH (n:${n})-[r]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`,s=new Promise((i=>{(async()=>{const i=(await c(this.knowledgeGraph,new y({openCypherQuery:o,bindParameters:{ids:e}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:n}=await i.read();if(e)break;for(let i=0;i<n.length;i++){const e=n[i];t.push({id:e[0],typeName:e[1]}),t.push({id:e[2],typeName:e[3]})}}}catch(n){if("AbortError"!==n.name)throw n;D.info("Request aborted as expected")}})().then((()=>{i()}))}));i.push(s)})),await Promise.all(i),t}async refreshCacheContent(e,t,n,o=!0){const s=h.getInstance(),r=[],a=new Map,p=new Map;this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,e)})),this.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&p.set(e.name,e)})),e||this.inclusionModeDefinition?e?e.forEach((e=>{if(this._memberIdTypeLookup.has(e)){const t=this._memberIdTypeLookup.get(e);a.has(t)?a.get(t)?.push(e):a.set(t,[e])}})):this.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e.useAllData?a.set(t,null):e.members&&e.members.forEach((e=>{a.has(t)&&null!==a.get(t)?a.get(t)?.push(e.id):a.set(t,[e.id])}))})):(this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&a.set(e.name,null)})),this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&a.set(e.name,null)})));for(const[m,d]of a){const e=new Promise((e=>{const r=async()=>{const e=new Set,r=[];let a,l="",h=!1;if(t||p.get(m)?.properties?.forEach((t=>{t.name&&e.add(t.name)})),n&&this.geographicLookup.has(m)){const t=this.geographicLookup.get(m)?.name;t&&e.add(t)}if(this.entityTypeNames.has(m))l=`MATCH (n:${m}) ${d?"WHERE id(n) IN $ids ":""}return ID(n)`,e.forEach((e=>{l+=`, n.${e}`,r.push(e)}));else{if(!this.relationshipTypeNames.has(m))throw new i("knowledge-graph:layer-data-manager",`The graph type of ${m} could not be determined. Was this type set in the KG data model and inclusion definition?`);h=!0,l=`MATCH ()-[n:${m}]->() ${d?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,e.forEach((e=>{l+=`, n.${e}`,r.push(e)}))}a=new y(d?{openCypherQuery:l,bindParameters:{ids:d}}:{openCypherQuery:l});const u=(await c(this.knowledgeGraph,a)).resultRowsStream.getReader();for(;;){const{done:e,value:t}=await u.read();if(e)break;const i=[];for(let o=0;o<t.length;o++){const e=t[o];let n=0,s=0;const a={properties:{}};for(a.id=e[n],n++,s++,h&&(a.originId=e[n],n++,s++,a.destinationId=e[n],n++,s++);n<e.length;n++)a.properties[r[n-s]]=e[n];i.push(a)}const n=s.writeToStore(i,f,this.geographicLookup.get(m)?.name);this.sublayerCaches.has(m)||this.sublayerCaches.set(m,new Map),o&&!this.inclusionModeDefinition?.namedTypeDefinitions.has(m)&&this.inclusionModeDefinition?.namedTypeDefinitions.set(m,{useAllData:!1,members:new Map}),o&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members&&(this.inclusionModeDefinition.namedTypeDefinitions.get(m).members=new Map);const a=this.sublayerCaches.get(m);n.forEach((e=>{a?.set(e.attributes[f],e),o&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members.has(e.attributes[f])&&(this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members.set(e.attributes[f],{id:e.attributes[f]}),this._memberIdTypeLookup.set(e.attributes[f],m))}))}};r().then((()=>{e(null)}))}));r.push(e),this._processingCacheUpdatesLookup.get(m)?.push(e)}await Promise.all(r)}removeFromLayer(e){const t=new Set;e.forEach((e=>{this._memberIdTypeLookup.get(e)&&t.add(this._memberIdTypeLookup.get(e)),this._memberIdTypeLookup.delete(e),this.inclusionModeDefinition?.namedTypeDefinitions.forEach((t=>{t.members?.has(e)&&t.members.delete(e)}))})),t.forEach((t=>{this.sublayerCaches.get(t)?.forEach(((i,n)=>{e.includes(n)&&this.sublayerCaches.get(t)?.delete(n)}))}))}async retrieveDataFromService(e,t,i){const n=h.getInstance(),s=new Set,r=[];let a,u="",g=[],b=t.parentCompositeLayer.sublayerIdsCache.has(t.objectType.name)?Array.from(t.parentCompositeLayer.sublayerIdsCache.get(t.objectType.name).values()).sort():null;const T="relationship"===t.graphType;if(!this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData)if(null!=e.objectIds&&b&&b.length>0){const t=e.objectIds;e.objectIds=b.filter((e=>t.includes(e)))}else if(null!=e.objectIds)b=e.objectIds;else{if(this.inclusionModeDefinition?.namedTypeDefinitions.has(t.objectType.name)&&(!this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members||this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members?.size<1))return e.objectIds=[],[];e.objectIds=b}if(null!=e.outFields){const i=e.outFields;i.includes("*")?t.fields.forEach((e=>{s.add(e.name)})):i.forEach((e=>{e!==f&&e!==t.geometryFieldName&&s.add(e)}))}if(null!=e.geometry){const i=e.geometry;let n;if(i?.extent?.spatialReference&&!i.spatialReference?.isWGS84?(await m(i.extent.spatialReference,l),n=d(i.extent,l)):n=i.extent,null!=e.where&&"1=1"!==e.where){const i=await o(e.where.toUpperCase(),t.fieldsIndex);t.fields.forEach((e=>{i.fieldNames.includes(e.name)&&s.add(e.name)}))}u=T?`Match ()-[n:${t.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${t.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n)`,e.returnGeometry&&t.geometryFieldName&&s.add(t.geometryFieldName),s.forEach((e=>{u+=`, n.${e}`,r.push(e)})),a=new y({openCypherQuery:u,bindParameters:{param_filter_geom:new p({rings:[[[n.xmin,n.ymin],[n.xmin,n.ymax],[n.xmax,n.ymax],[n.xmax,n.ymin],[n.xmin,n.ymin]]]})}})}else{let i="";if(null!=e.where&&"1=1"!==e.where){const n=await o(e.where,t.fieldsIndex);t.fields.forEach((e=>{n.fieldNames.includes(e.name)&&s.add(e.name)}));const r=["column-reference","string","number","binary-expression"],a=["=","<","<=","<>",">",">=","AND","OR","LIKE"];let p=!1;const m=e=>{if("column-reference"===e.type)return`n.${e.column}`;if("string"===e.type)return`'${e.value}'`;if("number"===e.type)return`${e.value}`;if("binary-expression"===e.type&&r.includes(e.left.type)&&r.includes(e.right.type)&&a.includes(e.operator))return`${m(e.left)} ${e.operator} ${m(e.right)}`;if("binary-expression"===e.type&&"LIKE"===e.operator){let t="";if("function"===e.left.type&&"column-reference"===e.left.args.value[0].type)t+=`lower(n.${e.left.args.value[0].column})`;else{if("column-reference"!==e.left.type)return p=!0,"";t+=`lower(n.${e.left.column})`}if(t+=" CONTAINS (","string"!==e.right.type)return p=!0,"";{let i=e.right.value;"%"===i.charAt(0)&&(i=i.slice(1)),"%"===i.charAt(i.length-1)&&(i=i.slice(0,-1)),t+=`'${i.toLowerCase()}')`}return t}return p=!0,""};i=m(n.parseTree),p&&(i="")}let n="";n=T?`Match ()-[n:${t.objectType.name}]->()`:`Match (n:${t.objectType.name})`;let p=!1;b&&(p=!0,n+=" WHERE ID(n) IN $ids"),i&&(n+=p?" AND":" WHERE",n+=` ${i}`),n+=" return ID(n)",T&&(n+=", id(startNode(n)), id(endNode(n))"),e.returnGeometry&&t.geometryFieldName&&s.add(t.geometryFieldName),s.forEach((e=>{n+=`, n.${e}`,r.push(e)})),a=new y(b?{openCypherQuery:n,bindParameters:{ids:b}}:{openCypherQuery:n})}const w=(await c(t.parentCompositeLayer.dataManager.knowledgeGraph,a,i)).resultRowsStream.getReader();for(;;){const{done:e,value:i}=await w.read();if(e)break;const o=[];for(let t=0;t<i.length;t++){const e=i[t];let n=0,s=0;const a={properties:{}};for(a.id=e[n],n++,s++,T&&(a.originId=e[n],n++,s++,a.destinationId=e[n],n++,s++);n<e.length;n++)a.properties[r[n-s]]=e[n];o.push(a)}g=g.concat(n.writeToStore(o,f,t.parentCompositeLayer.dataManager.geographicLookup.get(t.objectType.name)?.name))}return g}};e([s()],I.prototype,"knowledgeGraph",void 0),e([s()],I.prototype,"inclusionModeDefinition",void 0),e([s()],I.prototype,"entityTypeNames",void 0),e([s()],I.prototype,"relationshipTypeNames",void 0),e([s()],I.prototype,"geographicLookup",void 0),e([s()],I.prototype,"sublayerCaches",void 0),I=e([r("esri.rest.knowledgeGraph.knowledgeGraphLayer.KnowledgeGraphLayerDataManager")],I);export{w as GEOHASH_ENCODING_PRECISION,I as KnowledgeGraphLayerDataManager,b as MOCK_DESTINATION_ID_FIELD_NAME,T as MOCK_LAYOUT_GEOMETRY_FIELD_NAME,f as MOCK_OID_FIELD_NAME,g as MOCK_ORIGIN_ID_FIELD_NAME};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import i from"../../core/Error.js";import n from"../../core/Logger.js";import{parseWhereClause as o}from"../../core/sql.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{encodeGeohash as a}from"../../geohash/geohashUtils.js";import p from"../../geometry/Polygon.js";import{initializeProjection as m,project as d}from"../../geometry/projection.js";import{WGS84 as l}from"../../geometry/support/spatialReferenceUtils.js";import h from"./SessionMemoryStorage.js";import{executeQueryStreaming as c}from"../../rest/knowledgeGraphService.js";import y from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import u from"../../rest/support/Query.js";const f="ESRI__ID",g="ESRI__ORIGIN_ID",b="ESRI__DESTINATION_ID",T="ESRI__LAYOUT_GEOMETRY",w=12,D=n.getLogger("esri.rest.knowledgeGraph.knowledgeGraphLayer.KnowledgeGraphLayerDataManager");let I=class extends t{constructor(e){super(e),this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this._processingCacheUpdatesLookup=new Map,this._memberIdTypeLookup=new Map;const t=new Map;e.knowledgeGraph.dataModel.entityTypes?.forEach((i=>{i.name&&(t.set(i.name,"entity"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.entityTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((i=>{i.name&&(t.set(i.name,"relationship"),this._processingCacheUpdatesLookup.set(i.name,[]),e.inclusionModeDefinition&&!e.inclusionModeDefinition?.generateAllSublayers||this.relationshipTypeNames.add(i.name),i.properties?.forEach((e=>{e.geometryType&&"esriGeometryNull"!==e.geometryType&&this.geographicLookup.set(i.name,{name:e.name??"",geometryType:e.geometryType})})))})),e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,n)=>{if("entity"===t.get(n))this.entityTypeNames.add(n);else{if("relationship"!==t.get(n))return D.warn(`A named type, ${n}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(n);this.relationshipTypeNames.add(n)}const o=new Map;i.members?.forEach((e=>{this._memberIdTypeLookup.set(e.id,n);const t=this.getById(e.id);t&&o.set(e.id,t)})),this.sublayerCaches.set(n,o)}))}addToLayerInclusionSet(e){e.forEach((({typeName:e,id:t})=>{if(!this.inclusionModeDefinition)throw new i("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(e)){const n=this.inclusionModeDefinition.namedTypeDefinitions.get(e);if(n.useAllData)throw new i("knowledge-graph:layer-data-manager","You cannot add members to an exclusion list for a sublayer where the sublayer is set to always retrieve its entire data set");n.members||(n.members=new Map),n.members.set(t,{id:t}),this._memberIdTypeLookup.set(t,e)}}else{const i=new Map;i.set(t,{id:t}),this.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:i}),this._memberIdTypeLookup.set(t,e)}}))}getById(e){return h.getInstance().readFromStoreById(e)}async getData(e,t,i){if(t.objectType.name&&this.inclusionModeDefinition?.namedTypeDefinitions&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(t.objectType.name))return[];let n;if(n=e||new u({where:"1=1",outFields:["*"]}),"link-chart"===t.parentCompositeLayer.type){const e=t.parentCompositeLayer,i=this._processingCacheUpdatesLookup.get(t.objectType.name??""),o=n.outFields,s=n.geometry;let r="",p="";s&&s.extent&&(r=a(s.extent.ymin,s.extent.xmin,w),p=a(s.extent.ymax,s.extent.xmax,w)),o&&1===o.length&&o[0]===f&&"1=1"===n.where||await Promise.all(i??[]);const m=this.sublayerCaches.has(t.objectType.name??"")?Array.from(this.sublayerCaches.get(t.objectType.name)?.values()):[],d=[];return m.forEach((i=>{if(i.geometry=e.linkChartDiagramLookup.get(i.attributes[t.objectIdField]),i.attributes[T]=i.geometry,r&&p){const n=e.linkChartGeohashLookup.get(i.attributes[t.objectIdField]);n?n>=r&&n<=p&&d.push(i):d.push(i)}else d.push(i)})),d}return this.retrieveDataFromService(n,t,i)}async getConnectedRecordIds(e){const t=[],i=[],n=new Map;return e.forEach((e=>{if(this._memberIdTypeLookup.has(e)){const t=this._memberIdTypeLookup.get(e);if(!this.entityTypeNames.has(t))return;n.has(t)?n.get(t)?.push(e):n.set(t,[e])}})),n.forEach(((e,n)=>{const o=`MATCH (n:${n})-[r]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`,s=new Promise((i=>{(async()=>{const i=(await c(this.knowledgeGraph,new y({openCypherQuery:o,bindParameters:{ids:e}}))).resultRowsStream.getReader();try{for(;;){const{done:e,value:n}=await i.read();if(e)break;for(let i=0;i<n.length;i++){const e=n[i];t.push({id:e[0],typeName:e[1]}),t.push({id:e[2],typeName:e[3]})}}}catch(n){if("AbortError"!==n.name)throw n;D.info("Request aborted as expected")}})().then((()=>{i()}))}));i.push(s)})),await Promise.all(i),t}async refreshCacheContent(e,t,n,o=!0){const s=h.getInstance(),r=[],a=new Map,p=new Map;this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&p.set(e.name,e)})),this.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&p.set(e.name,e)})),e||this.inclusionModeDefinition?e?e.forEach((e=>{if(this._memberIdTypeLookup.has(e)){const t=this._memberIdTypeLookup.get(e);a.has(t)?a.get(t)?.push(e):a.set(t,[e])}})):this.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e.useAllData?a.set(t,null):e.members&&e.members.forEach((e=>{a.has(t)&&null!==a.get(t)?a.get(t)?.push(e.id):a.set(t,[e.id])}))})):(this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&a.set(e.name,null)})),this.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&a.set(e.name,null)})));for(const[m,d]of a){const e=new Promise((e=>{const r=async()=>{const e=new Set,r=[];let a,l="",h=!1;if(t||p.get(m)?.properties?.forEach((t=>{t.name&&e.add(t.name)})),n&&this.geographicLookup.has(m)){const t=this.geographicLookup.get(m)?.name;t&&e.add(t)}if(this.entityTypeNames.has(m))l=`MATCH (n:${m}) ${d?"WHERE id(n) IN $ids ":""}return ID(n)`,e.forEach((e=>{l+=`, n.${e}`,r.push(e)}));else{if(!this.relationshipTypeNames.has(m))throw new i("knowledge-graph:layer-data-manager",`The graph type of ${m} could not be determined. Was this type set in the KG data model and inclusion definition?`);h=!0,l=`MATCH ()-[n:${m}]->() ${d?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,e.forEach((e=>{l+=`, n.${e}`,r.push(e)}))}a=new y(d?{openCypherQuery:l,bindParameters:{ids:d}}:{openCypherQuery:l});const u=(await c(this.knowledgeGraph,a)).resultRowsStream.getReader();for(;;){const{done:e,value:t}=await u.read();if(e)break;const i=[];for(let o=0;o<t.length;o++){const e=t[o];let n=0,s=0;const a={properties:{}};for(a.id=e[n],n++,s++,h&&(a.originId=e[n],n++,s++,a.destinationId=e[n],n++,s++);n<e.length;n++)a.properties[r[n-s]]=e[n];i.push(a)}const n=s.writeToStore(i,f,this.geographicLookup.get(m)?.name);this.sublayerCaches.has(m)||this.sublayerCaches.set(m,new Map),o&&!this.inclusionModeDefinition?.namedTypeDefinitions.has(m)&&this.inclusionModeDefinition?.namedTypeDefinitions.set(m,{useAllData:!1,members:new Map}),o&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members&&(this.inclusionModeDefinition.namedTypeDefinitions.get(m).members=new Map);const a=this.sublayerCaches.get(m);n.forEach((e=>{a?.set(e.attributes[f],e),o&&!this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members.has(e.attributes[f])&&(this.inclusionModeDefinition?.namedTypeDefinitions.get(m).members.set(e.attributes[f],{id:e.attributes[f]}),this._memberIdTypeLookup.set(e.attributes[f],m))}))}};r().then((()=>{e(null)}))}));r.push(e),this._processingCacheUpdatesLookup.get(m)?.push(e)}await Promise.all(r)}removeFromLayer(e){const t=new Set;e.forEach((e=>{this._memberIdTypeLookup.get(e)&&t.add(this._memberIdTypeLookup.get(e)),this._memberIdTypeLookup.delete(e),this.inclusionModeDefinition?.namedTypeDefinitions.forEach((t=>{t.members?.has(e)&&t.members.delete(e)}))})),t.forEach((t=>{this.sublayerCaches.get(t)?.forEach(((i,n)=>{e.includes(n)&&this.sublayerCaches.get(t)?.delete(n)}))}))}async retrieveDataFromService(e,t,i){const n=h.getInstance(),s=new Set,r=[];let a,u="",g=[],b=t.parentCompositeLayer.sublayerIdsCache.has(t.objectType.name)?Array.from(t.parentCompositeLayer.sublayerIdsCache.get(t.objectType.name).values()).sort():null;const T="relationship"===t.graphType;if(!this.inclusionModeDefinition?.namedTypeDefinitions?.get(t.objectType.name)?.useAllData)if(null!=e.objectIds&&b&&b.length>0){const t=e.objectIds;e.objectIds=b.filter((e=>t.includes(e)))}else if(null!=e.objectIds)b=e.objectIds;else{if(this.inclusionModeDefinition?.namedTypeDefinitions.has(t.objectType.name)&&(!this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members||this.inclusionModeDefinition.namedTypeDefinitions.get(t.objectType.name)?.members?.size<1))return e.objectIds=[],[];e.objectIds=b}if(null!=e.outFields){const i=e.outFields;i.includes("*")?t.fields.forEach((e=>{s.add(e.name)})):i.forEach((e=>{e!==f&&e!==t.geometryFieldName&&s.add(e)}))}if(null!=e.geometry){const i=e.geometry;let n;if(i?.extent?.spatialReference&&!i.spatialReference?.isWGS84?(await m(i.extent.spatialReference,l),n=d(i.extent,l)):n=i.extent,null!=e.where&&"1=1"!==e.where){const i=await o(e.where.toUpperCase(),t.fieldsIndex);t.fields.forEach((e=>{i.fieldNames.includes(e.name)&&s.add(e.name)}))}u=T?`Match ()-[n:${t.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${t.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${t.geometryFieldName}) return ID(n)`,t.geometryFieldName&&s.add(t.geometryFieldName),s.forEach((e=>{u+=`, n.${e}`,r.push(e)})),a=new y({openCypherQuery:u,bindParameters:{param_filter_geom:new p({rings:[[[n.xmin,n.ymin],[n.xmin,n.ymax],[n.xmax,n.ymax],[n.xmax,n.ymin],[n.xmin,n.ymin]]]})}})}else{let i="";if(null!=e.where&&"1=1"!==e.where){const n=await o(e.where,t.fieldsIndex);t.fields.forEach((e=>{n.fieldNames.includes(e.name)&&s.add(e.name)}));const r=["column-reference","string","number","binary-expression"],a=["=","<","<=","<>",">",">=","AND","OR","LIKE"];let p=!1;const m=e=>{if("column-reference"===e.type)return`n.${e.column}`;if("string"===e.type)return`'${e.value}'`;if("number"===e.type)return`${e.value}`;if("binary-expression"===e.type&&r.includes(e.left.type)&&r.includes(e.right.type)&&a.includes(e.operator))return`${m(e.left)} ${e.operator} ${m(e.right)}`;if("binary-expression"===e.type&&"LIKE"===e.operator){let t="";if("function"===e.left.type&&"column-reference"===e.left.args.value[0].type)t+=`lower(n.${e.left.args.value[0].column})`;else{if("column-reference"!==e.left.type)return p=!0,"";t+=`lower(n.${e.left.column})`}if(t+=" CONTAINS (","string"!==e.right.type)return p=!0,"";{let i=e.right.value;"%"===i.charAt(0)&&(i=i.slice(1)),"%"===i.charAt(i.length-1)&&(i=i.slice(0,-1)),t+=`'${i.toLowerCase()}')`}return t}return p=!0,""};i=m(n.parseTree),p&&(i="")}let n="";n=T?`Match ()-[n:${t.objectType.name}]->()`:`Match (n:${t.objectType.name})`;let p=!1;b&&(p=!0,n+=" WHERE ID(n) IN $ids"),i&&(n+=p?" AND":" WHERE",n+=` ${i}`),n+=" return ID(n)",T&&(n+=", id(startNode(n)), id(endNode(n))"),e.returnGeometry&&t.geometryFieldName&&s.add(t.geometryFieldName),s.forEach((e=>{n+=`, n.${e}`,r.push(e)})),a=new y(b?{openCypherQuery:n,bindParameters:{ids:b}}:{openCypherQuery:n})}const w=(await c(t.parentCompositeLayer.dataManager.knowledgeGraph,a,i)).resultRowsStream.getReader();for(;;){const{done:e,value:i}=await w.read();if(e)break;const o=[];for(let t=0;t<i.length;t++){const e=i[t];let n=0,s=0;const a={properties:{}};for(a.id=e[n],n++,s++,T&&(a.originId=e[n],n++,s++,a.destinationId=e[n],n++,s++);n<e.length;n++)a.properties[r[n-s]]=e[n];o.push(a)}g=g.concat(n.writeToStore(o,f,t.parentCompositeLayer.dataManager.geographicLookup.get(t.objectType.name)?.name))}return g}};e([s()],I.prototype,"knowledgeGraph",void 0),e([s()],I.prototype,"inclusionModeDefinition",void 0),e([s()],I.prototype,"entityTypeNames",void 0),e([s()],I.prototype,"relationshipTypeNames",void 0),e([s()],I.prototype,"geographicLookup",void 0),e([s()],I.prototype,"sublayerCaches",void 0),I=e([r("esri.rest.knowledgeGraph.knowledgeGraphLayer.KnowledgeGraphLayerDataManager")],I);export{w as GEOHASH_ENCODING_PRECISION,I as KnowledgeGraphLayerDataManager,b as MOCK_DESTINATION_ID_FIELD_NAME,T as MOCK_LAYOUT_GEOMETRY_FIELD_NAME,f as MOCK_OID_FIELD_NAME,g as MOCK_ORIGIN_ID_FIELD_NAME};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{convertFromGeometry as e}from"../graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../graphics/OptimizedFeature.js";const r="ESRI__DESTINATION_ID",i="ESRI__ORIGIN_ID";class s{constructor(){this._featureLookup=new Map}static getInstance(){return s.instance||(s.instance=new s),s.instance}static resetInstance(){s.instance&&(s.instance=null)}deleteFromStore(e){e.forEach((e=>{this._featureLookup.delete(e)}))}readFromStoreByList(e){const t=[];return e.forEach((e=>{const r=this.readFromStoreById(e);r&&t.push(r)})),t}readFromStoreById(e){return this._featureLookup.get(e)??null}writeToStore(s,o,n){const p=[];return s.forEach((s=>{if(!s||!s.id)return;s.properties||(s.properties=[]);let a,u=null;if(n&&(u=s.properties[n]?e(s.properties[n]):null),"originId"in s&&"destinationId"in s&&(s.properties[i]=s.originId,s.properties[r]=s.destinationId),s.properties[o]=s.id,s.id&&this._featureLookup.has(s.id)){const e=this._featureLookup.get(s.id);a=new t(u?JSON.parse(JSON.stringify(u)):e?.geometry?JSON.parse(JSON.stringify(e.geometry)):null,JSON.parse(JSON.stringify(Object.assign(s.properties
|
|
5
|
+
import{convertFromGeometry as e}from"../graphics/featureConversionUtils.js";import{OptimizedFeature as t}from"../graphics/OptimizedFeature.js";const r="ESRI__DESTINATION_ID",i="ESRI__ORIGIN_ID";class s{constructor(){this._featureLookup=new Map}static getInstance(){return s.instance||(s.instance=new s),s.instance}static resetInstance(){s.instance&&(s.instance=null)}deleteFromStore(e){e.forEach((e=>{this._featureLookup.delete(e)}))}readFromStoreByList(e){const t=[];return e.forEach((e=>{const r=this.readFromStoreById(e);r&&t.push(r)})),t}readFromStoreById(e){return this._featureLookup.get(e)??null}writeToStore(s,o,n){const p=[];return s.forEach((s=>{if(!s||!s.id)return;s.properties||(s.properties=[]);let a,u=null;if(n&&(u=s.properties[n]?e(s.properties[n]):null),"originId"in s&&"destinationId"in s&&(s.properties[i]=s.originId,s.properties[r]=s.destinationId),s.properties[o]=s.id,s.id&&this._featureLookup.has(s.id)&&this._featureLookup.get(s.id).attributes){const e=this._featureLookup.get(s.id);a=new t(u?JSON.parse(JSON.stringify(u)):e?.geometry?JSON.parse(JSON.stringify(e.geometry)):null,JSON.parse(JSON.stringify(Object.assign(e.attributes,s.properties))),null,s.properties[o])}else a=new t(u?JSON.parse(JSON.stringify(u)):null,s.properties,null,s.properties[o]);this._featureLookup.set(s.id,a),p.push(a)})),p}}export{s 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import i from"../../renderers/Renderer.js";import o from"../../renderers/SimpleRenderer.js";import n from"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import"../../core/has.js";import s from"../../core/Error.js";import{HandleOwnerMixin as l}from"../../core/HandleOwner.js";import{IdentifiableMixin as a}from"../../core/Identifiable.js";import{clone as p}from"../../core/lang.js";import d from"../../core/Loadable.js";import u from"../../core/Logger.js";import{MultiOriginJSONMixin as y}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as c}from"../../core/object.js";import{sqlAnd as m}from"../../core/sql.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{writer as g}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as v}from"../../core/accessorSupport/PropertyOrigin.js";import{createTypeReader as j}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import w from"../../form/FormTemplate.js";import{labelsVisible as O,legendEnabled as S,minScale as F,maxScale as I,popupEnabled as T}from"./commonProperties.js";import{createQuery as E}from"./featureLayerUtils.js";import C from"./FeatureTemplate.js";import{defineFieldProperties as A}from"./fieldProperties.js";import{fixRendererFields as x}from"./fieldUtils.js";import R from"./LabelClass.js";import{reader as P}from"./labelingInfo.js";import D from"../../rest/support/Query.js";import{createPopupTemplate as L}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as q,defaultPolylineSymbol2D as U,defaultPointSymbol2D as V}from"../../symbols/support/defaults.js";const G=["charts","editingEnabled","formTemplate","labelsVisible","labelingInfo","legendEnabled","minScale","maxScale","opacity","popupEnabled","popupTemplate","renderer","subtypeCode","templates","title","visible"],N={key:"type",base:i,errorContext:"renderer",typeMap:{simple:o,"unique-value":n,"class-breaks":r}},$=A(),k=j({types:N});let M=0;function _(e){const t=e.json.write;return"object"==typeof t?t.ignoreOrigin=!0:e.json.write={ignoreOrigin:!0},e}function H(e){return new o({symbol:B(e)})}function B(e){switch(e){case"point":case"multipoint":return V.clone();case"polyline":return U.clone();case"polygon":case"multipatch":return q.clone();default:return null}}function Q(e,t){return!!t&&("unique-value"===e?.type&&"string"==typeof e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function z(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function J(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=z(e,t);if(null!=o){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new C({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}const K="esri.layers.support.SubtypeSublayer";let W=class extends(l(y(a(d)))){constructor(e){super(e),this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${M++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let n;if(i){n=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:s})=>{if(!s)return;const l=o?.fields?.find((e=>e.name===t));if(!l)return;const a={name:t};let p=!1;r!==l.alias&&(a.alias=r,p=!0),i!==l.editable&&(a.editable=i,p=!0),n.push(a),p&&e++})),0===e&&n.length===i.length&&(n=null)}else n=p(e);n?.length&&c(r,n,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,s=o?.find((e=>e.code===r)),l=s?.defaultValues,a=s?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find((e=>e.name===i));if(e.visible=!t||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const s=l?.[i]??null;e.defaultValue=i===n?r:s;const u=a?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get geometryType(){return this.parent?.geometryType}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||u.getLogger(K).error(Y("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){x(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?H(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,n=k(i,t,r);let s;const{subtypeCode:l}=this;if(null!=l&&Q(n,t.subtypeField)){const e=n.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(l)));e&&(s=new o({symbol:e.symbol}))}else"simple"!==n?.type||n.visualVariables?.length||(s=n);return s}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const o=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return o?void 0:k(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference}readTemplatesFromService(e,t){return[J(this.subtypeCode,t)]}readTitleFromService(e,t){const r=z(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw Y("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new s("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:i}=this;if(!i)throw Y("updateAttachment");if(e.getAttribute(i.subtypeField)!==this.subtypeCode)throw new s("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return i.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw Y("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new s("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw Y("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:s}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:s,title:o}}return L(t,e)}createQuery(){if(!this.parent)throw Y("createQuery");const e=E(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=m(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e){return this._getLayerDomain(e)}hasUserOverrides(){return G.some((e=>this.originIdOf(e)===v.USER))}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw Y("queryAttachments");const i=e.clone();return i.where=X(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw Y("queryFeatures");const i=D.from(e)??r.createQuery();return null!=e&&(i.where=X(i.where,r.parent.subtypeField,r.subtypeCode)),r.parent.queryFeatures(i,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([f({readOnly:!0,json:{read:!1}})],W.prototype,"capabilities",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"effectiveCapabilities",null),e([f({json:{write:{ignoreOrigin:!0}}})],W.prototype,"charts",void 0),e([f({type:Boolean,nonNullable:!0,json:{name:"enableEditing",write:{ignoreOrigin:!0}}})],W.prototype,"editingEnabled",void 0),e([f({type:Boolean,readOnly:!0})],W.prototype,"effectiveEditingEnabled",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"elevationInfo",null),e([f({readOnly:!0,json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],W.prototype,"fieldOverrides",void 0),e([g("fieldOverrides")],W.prototype,"writeFieldOverrides",null),e([f({...$.fields,readOnly:!0,json:{read:!1}})],W.prototype,"fields",null),e([f($.fieldsIndex)],W.prototype,"fieldsIndex",void 0),e([f({type:w,json:{name:"formInfo",write:{ignoreOrigin:!0}}})],W.prototype,"formTemplate",void 0),e([f({type:String,readOnly:!0,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],W.prototype,"id",void 0),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"geometryType",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"type",void 0),e([f(_(p(O)))],W.prototype,"labelsVisible",void 0),e([f({type:[R],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:P},write:{ignoreOrigin:!0}}})],W.prototype,"labelingInfo",void 0),e([f({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],W.prototype,"layerType",void 0),e([f(_(p(S)))],W.prototype,"legendEnabled",void 0),e([f({type:["show","hide"]})],W.prototype,"listMode",void 0),e([f((()=>{const e=p(F);return e.json.origins.service.read=!1,_(e)})())],W.prototype,"minScale",void 0),e([f((()=>{const e=p(I);return e.json.origins.service.read=!1,_(e)})())],W.prototype,"maxScale",void 0),e([f({readOnly:!0})],W.prototype,"effectiveScaleRange",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"objectIdField",null),e([f({type:Number,range:{min:0,max:1},nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],W.prototype,"opacity",void 0),e([f()],W.prototype,"parent",void 0),e([f(_(p(T)))],W.prototype,"popupEnabled",void 0),e([f({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],W.prototype,"popupTemplate",void 0),e([f({readOnly:!0})],W.prototype,"defaultPopupTemplate",null),e([f({types:N,json:{write:{target:"layerDefinition.drawingInfo.renderer",ignoreOrigin:!0}}})],W.prototype,"renderer",null),e([b("service","renderer",["drawingInfo.renderer","subtypeField","type"])],W.prototype,"readRendererFromService",null),e([b("renderer",["layerDefinition.drawingInfo.renderer"])],W.prototype,"readRenderer",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"spatialReference",null),e([f({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],W.prototype,"subtypeCode",void 0),e([f({type:[C],json:{name:"layerDefinition.templates",write:{ignoreOrigin:!0}}})],W.prototype,"templates",void 0),e([b("service","templates",["geometryType","subtypeField","subtypes","type"])],W.prototype,"readTemplatesFromService",null),e([f({type:String,json:{write:{ignoreOrigin:!0}}})],W.prototype,"title",void 0),e([b("service","title",["subtypes"])],W.prototype,"readTitleFromService",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"url",null),e([f({readOnly:!0})],W.prototype,"userHasUpdateItemPrivileges",null),e([f({type:Boolean,nonNullable:!0,json:{name:"visibility",write:{ignoreOrigin:!0}}})],W.prototype,"visible",void 0),W=e([h(K)],W);const X=(e,t,r)=>{const i=new RegExp(`${t}=[0-9]`),o=`${t}=${r}`,n=e??"";return i.test(n)?n.replace(i,o):m(o,n)},Y=e=>new s(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),Z=W;export{Z as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import i from"../../renderers/Renderer.js";import o from"../../renderers/SimpleRenderer.js";import n from"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import"../../core/has.js";import s from"../../core/Error.js";import{HandleOwnerMixin as l}from"../../core/HandleOwner.js";import{IdentifiableMixin as a}from"../../core/Identifiable.js";import{clone as p}from"../../core/lang.js";import d from"../../core/Loadable.js";import u from"../../core/Logger.js";import{MultiOriginJSONMixin as y}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as c}from"../../core/object.js";import{sqlAnd as m}from"../../core/sql.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{reader as b}from"../../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{writer as g}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as v}from"../../core/accessorSupport/PropertyOrigin.js";import{createTypeReader as j}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import w from"../../form/FormTemplate.js";import{labelsVisible as O,legendEnabled as S,minScale as F,maxScale as I,popupEnabled as T}from"./commonProperties.js";import{createQuery as E}from"./featureLayerUtils.js";import C from"./FeatureTemplate.js";import{defineFieldProperties as A}from"./fieldProperties.js";import{fixRendererFields as x}from"./fieldUtils.js";import R from"./LabelClass.js";import{reader as P}from"./labelingInfo.js";import D from"../../rest/support/Query.js";import{createPopupTemplate as L}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as q,defaultPolylineSymbol2D as U,defaultPointSymbol2D as V}from"../../symbols/support/defaults.js";const G=["charts","editingEnabled","formTemplate","labelsVisible","labelingInfo","legendEnabled","minScale","maxScale","opacity","popupEnabled","popupTemplate","renderer","subtypeCode","templates","title","visible"],N={key:"type",base:i,errorContext:"renderer",typeMap:{simple:o,"unique-value":n,"class-breaks":r}},$=A(),k=j({types:N});let M=0;function _(e){const t=e.json.write;return"object"==typeof t?t.ignoreOrigin=!0:e.json.write={ignoreOrigin:!0},e}function H(e){return new o({symbol:B(e)})}function B(e){switch(e){case"point":case"multipoint":return V.clone();case"polyline":return U.clone();case"polygon":case"multipatch":return q.clone();default:return null}}function Q(e,t){return!!t&&("unique-value"===e?.type&&"string"==typeof e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function z(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function J(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=z(e,t);if(null!=o){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new C({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}const K="esri.layers.support.SubtypeSublayer";let W=class extends(l(y(a(d)))){constructor(e){super(e),this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${M++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let n;if(i){n=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:s})=>{if(!s)return;const l=o?.fields?.find((e=>e.name===t));if(!l)return;const a={name:t};let p=!1;r!==l.alias&&(a.alias=r,p=!0),i!==l.editable&&(a.editable=i,p=!0),n.push(a),p&&e++})),0===e&&n.length===i.length&&(n=null)}else n=p(e);n?.length&&c(r,n,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,s=o?.find((e=>e.code===r)),l=s?.defaultValues,a=s?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find((e=>e.name===i));if(e.visible=!t||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const s=l?.[i]??null;e.defaultValue=i===n?r:s;const u=a?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get geometryType(){return this.parent?.geometryType}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||u.getLogger(K).error(Y("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){x(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?H(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,n=k(i,t,r);let s;const{subtypeCode:l}=this;if(null!=l&&Q(n,t.subtypeField)){const e=n.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(l)));e&&(s=new o({symbol:e.symbol}))}else"simple"!==n?.type||n.visualVariables?.length||(s=n);return s}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const o=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return o?void 0:k(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference}readTemplatesFromService(e,t){return[J(this.subtypeCode,t)]}readTitleFromService(e,t){const r=z(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw Y("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new s("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:i}=this;if(!i)throw Y("updateAttachment");if(e.getAttribute(i.subtypeField)!==this.subtypeCode)throw new s("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return i.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw Y("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new s("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw Y("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:s}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:s,title:o}}return L(t,e)}createQuery(){if(!this.parent)throw Y("createQuery");const e=E(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=m(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e){return this._getLayerDomain(e)}hasUserOverrides(){return G.some((e=>this.originIdOf(e)===v.USER))}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw Y("queryAttachments");const i=e.clone();return i.where=X(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw Y("queryFeatures");const i=D.from(e)??r.createQuery();return null!=e&&(i.where=X(i.where,r.parent.subtypeField,r.subtypeCode)),r.parent.queryFeatures(i,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([f({readOnly:!0,json:{read:!1}})],W.prototype,"capabilities",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"effectiveCapabilities",null),e([f({json:{write:{ignoreOrigin:!0}}})],W.prototype,"charts",void 0),e([f({type:Boolean,nonNullable:!0,json:{name:"enableEditing",write:{ignoreOrigin:!0}}})],W.prototype,"editingEnabled",void 0),e([f({type:Boolean,readOnly:!0})],W.prototype,"effectiveEditingEnabled",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"elevationInfo",null),e([f({readOnly:!0,json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],W.prototype,"fieldOverrides",void 0),e([g("fieldOverrides")],W.prototype,"writeFieldOverrides",null),e([f({...$.fields,readOnly:!0,json:{read:!1}})],W.prototype,"fields",null),e([f($.fieldsIndex)],W.prototype,"fieldsIndex",void 0),e([f({type:w,json:{name:"formInfo",write:{ignoreOrigin:!0}}})],W.prototype,"formTemplate",void 0),e([f({type:String,readOnly:!0,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],W.prototype,"id",void 0),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"geometryType",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"type",void 0),e([f(_(p(O)))],W.prototype,"labelsVisible",void 0),e([f({type:[R],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:P},write:{ignoreOrigin:!0}}})],W.prototype,"labelingInfo",void 0),e([f({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],W.prototype,"layerType",void 0),e([f(_(p(S)))],W.prototype,"legendEnabled",void 0),e([f({type:["show","hide"]})],W.prototype,"listMode",void 0),e([f((()=>{const e=p(F);return e.json.origins.service.read=!1,_(e)})())],W.prototype,"minScale",void 0),e([f((()=>{const e=p(I);return e.json.origins.service.read=!1,_(e)})())],W.prototype,"maxScale",void 0),e([f({readOnly:!0})],W.prototype,"effectiveScaleRange",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"objectIdField",null),e([f({type:Number,range:{min:0,max:1},nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],W.prototype,"opacity",void 0),e([f()],W.prototype,"parent",void 0),e([f(_(p(T)))],W.prototype,"popupEnabled",void 0),e([f({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],W.prototype,"popupTemplate",void 0),e([f({readOnly:!0})],W.prototype,"defaultPopupTemplate",null),e([f({types:N,json:{write:{target:"layerDefinition.drawingInfo.renderer",ignoreOrigin:!0}}})],W.prototype,"renderer",null),e([b("service","renderer",["drawingInfo.renderer","subtypeField","type"])],W.prototype,"readRendererFromService",null),e([b("renderer",["layerDefinition.drawingInfo.renderer"])],W.prototype,"readRenderer",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"spatialReference",null),e([f({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],W.prototype,"subtypeCode",void 0),e([f({type:[C],json:{name:"layerDefinition.templates",write:{ignoreOrigin:!0}}})],W.prototype,"templates",void 0),e([b("service","templates",["geometryType","subtypeField","subtypes","type"])],W.prototype,"readTemplatesFromService",null),e([f({type:String,json:{write:{ignoreOrigin:!0}}})],W.prototype,"title",void 0),e([b("service","title",["subtypes"])],W.prototype,"readTitleFromService",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"url",null),e([f({readOnly:!0})],W.prototype,"userHasUpdateItemPrivileges",null),e([f({type:Boolean,nonNullable:!0,json:{name:"visibility",write:{ignoreOrigin:!0}}})],W.prototype,"visible",void 0),W=e([h(K)],W);const X=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),o=`${t}=${r}`,n=e??"";return i.test(n)?n.replace(i,o):m(o,n)},Y=e=>new s(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),Z=W;export{Z 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import r from"./BandArithmeticFunctionArguments.js";import{calculateBandIndex as n,getBandMatrix3 as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import r from"./BandArithmeticFunctionArguments.js";import{calculateBandIndex as n,getBandMatrix3 as i}from"./bandIndexUtils.js";import a from"./BaseRasterFunction.js";const o=new Set(["vari","mtvi2","rtvi-core","evi"]);let c=class extends a{constructor(){super(...arguments),this.functionName="BandArithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const e=this.sourceRasterInfos[0];if(e.bandCount<2)return{success:!1,supportsGPU:!1,error:"band-arithmetic-function: source raster has insufficient amount of raster bands"};const s=e.clone();s.pixelType=this.outputPixelType,s.statistics=null,s.histograms=null,s.bandCount="sultan"===this.functionArguments.method?3:1,s.keyProperties={...s.keyProperties,BandProperties:void 0},this.rasterInfo=s;return{success:!0,supportsGPU:!["custom","gvitm","sultan"].includes(this.functionArguments.method)}}_processPixels(e){const s=e.pixelBlocks?.[0];if(null==s)return s;const{method:t,bandIndexes:r}=this.functionArguments,i=r.split(" ").map((e=>parseFloat(e)));return n(s,{method:t,bandIndexes:i,equation:r})}_getWebGLParameters(){const e=this.functionArguments.bandIndexes.split(" ").map((e=>parseFloat(e)-1));2===e.length&&e.push(0);const s=this.isInputBandIdsSwizzled?[0,1,2]:e;let t,r;const n=new Float32Array(3),{method:a}=this.functionArguments;switch(a){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":t=i([s[0],s[1],0]),r="ndxi";break;case"ndwi":t=i([s[1],s[0],0]),r="ndxi";break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":t=i([s[0],s[1],0]),r="sr";break;case"ci-g":case"ci-re":t=i([s[0],s[1],0]),r="ci";break;case"savi":t=i([s[0],s[1],0]),r="savi",n[0]=e[2]+1;break;case"tsavi":t=i([s[0],s[1],0]),r="tsavi",n[0]=e[2]+1,n[1]=e[3]+1,n[2]=e[4]+1;break;case"msavi":t=i([s[0],s[1],0]),r="msavi";break;case"gemi":t=i([s[0],s[1],0]),r="gemi";break;case"pvi":t=i([s[0],s[1],0]),r="tsavi",n[0]=e[2]+1,n[1]=e[3]+1;break;case"vari":t=i([s[0],s[1],s[2]]),r="vari";break;case"mtvi2":t=i([s[0],s[1],s[2]]),r="mtvi2";break;case"rtvi-core":t=i([s[0],s[1],s[2]]),r="rtvicore";break;case"evi":t=i([s[0],s[1],s[2]]),r="evi";break;case"wndwi":t=i([s[0],s[1],0]),r="wndwi",n[0]=e[3]?e[3]+1:.5;break;case"bai":t=i([s[1],s[0],0]),r="bai";break;default:t=i([0,1,2]),r="custom"}return{bandIndexMat3:t,indexType:r,adjustments:n}}_getInputBandIds(e){if("custom"===this.functionArguments.method)return e;const s=this.functionArguments.bandIndexes.split(" ").map((e=>parseFloat(e)-1)),t=e.length,r=s.map((e=>e>=t?t-1:e)),n=o.has(this.functionArguments.method)?3:2,i=r.slice(0,n).map((s=>e[s]));return 2===i.length&&i.push(0),i}};e([s({json:{write:!0,name:"rasterFunction"}})],c.prototype,"functionName",void 0),e([s({type:r,json:{write:!0,name:"rasterFunctionArguments"}})],c.prototype,"functionArguments",void 0),e([s()],c.prototype,"rasterArgumentNames",void 0),c=e([t("esri.layers.support.rasterFunctions.BandArithmeticFunction")],c);const u=c;export{u 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import{JSONSupport as s}from"../../../core/JSONSupport.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import{cast as r}from"../../../core/accessorSupport/decorators/cast.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../PixelBlock.js";import o from"../RasterInfo.js";const a=new Set(["slope","aspect","curvature","hillshade","shadedrelief"]);let u=class extends s{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0,this.id=-1,this.isNoopProcess=!1,this.rawInputBandIds=[],this.isInputBandIdsSwizzled=!1,this.swizzledBandSelection=[],this.isBranch=!1,this._bindingResult=null}get supportsGPU(){return this._bindingResult.supportsGPU}get flatWebGLFunctionChain(){const t=this.getWebGLProcessorDefinition();if(!t)return null;const s=[t],{parameters:e}=t;let r=e.rasters||e.raster&&[e.raster];for(;r?.length;){s.unshift(...r);const t=[];for(let s=0;s<r.length;s++){const{parameters:e}=r[s],n=e.rasters||e.raster&&[e.raster];n?.length&&t.push(...n)}r=t}for(let o=s.length-1;o>=0;o--)s[o].isNoopProcess&&s.splice(o,1);let n=!1;for(let o=0;o<s.length;o++){const t=s[o];t.id=s.length-o-1;const{rasters:e}=t.parameters;n=n||null!=e&&e.length>1}const i=s.some((({name:t})=>a.has(t.toLowerCase())));return{functions:s,hasBranches:n,hasSurfaceFunction:i}}bind(t,s=!1,e=-1){this.id=e+1;const r=this._getRasterValues();let n=!0;for(let i=0;i<r.length;i++){const e=r[i];if(null!=e&&this._isRasterFunctionValue(e)){const r=e.bind(t,s,this.id+i);if(!r.success)return this._bindingResult=r,r;n=n&&r.supportsGPU}}return!this.rasterInfo||s?(this.sourceRasterInfos=this._getSourceRasterInfos(t),this._bindingResult=this._bindSourceRasters(),this._bindingResult.supportsGPU=n&&this._bindingResult.supportsGPU,this.processInputBandIds(),this._bindingResult):(this._bindingResult={success:!0,supportsGPU:!0},this.processInputBandIds(),this._bindingResult)}process(t){const s=this._getRasterValues(),e=0===s.length?t.pixelBlocks??t.primaryPixelBlocks:s.map((s=>this._readRasterValue(s,t)));return this._processPixels({...t,pixelBlocks:e})}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);let s;if(t.length>1){const s=t.map((t=>t.processInputBandIds()[0]));this.rawInputBandIds=s,this.isInputBandIdsSwizzled=this.rawInputBandIds.some(((t,s)=>t!==s));const e=t.filter((t=>"ExtractBand"===t.functionName));return e.length&&e.forEach(((t,s)=>{t.isInputBandIdsSwizzled=!0,t.swizzledBandSelection=[s,s,s]})),this.rawInputBandIds}const e=t[0];if(e){if(s=e.processInputBandIds(),e.isInputBandIdsSwizzled)return this.rawInputBandIds=s,s}else{s=[];const{bandCount:t}=this.sourceRasterInfos[0];for(let e=0;e<t;e++)s.push(e)}const r=this._getInputBandIds(s);return this.isInputBandIdsSwizzled=r.some(((t,s)=>t!==s)),this.rawInputBandIds=r,this.rawInputBandIds}getPrimaryRasters(){const t=[],s=[];return this._getPrimaryRasters(this,t,s),{rasters:t,rasterIds:s}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:s,rasters:e}=this.functionArguments;return e&&Array.isArray(e)&&e.length?(t.rasters=e.map((t=>this._isRasterFunctionValue(t)?t.getWebGLProcessorDefinition():"number"==typeof t?{name:"Constant",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1})),t.rasters.some((t=>null!=t))||(t.rasters=null)):this._isRasterFunctionValue(s)&&(t.raster=s.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}_getOutputPixelType(t){return"unknown"===this.outputPixelType?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_isOutputRoundingNeeded(){const{outputPixelType:t}=this;return(t?.startsWith("u")||t?.startsWith("s"))??!1}_getRasterValues(){const{rasterArgumentNames:t}=this;return"rasters"===t[0]?this.functionArguments.rasters??[]:t.map((t=>this.functionArguments[t])).flat()}_getSourceRasterInfos(t){const s=this._getRasterValues(),{rasterInfos:e,rasterIds:r}=t;if(0===s.length)return e;const n=s.map((t=>t&&"object"==typeof t&&"bind"in t&&t.rasterInfo?t.rasterInfo:"string"==typeof t&&r.includes(t)?e[r.indexOf(t)]:"number"!=typeof t?e[0]:void 0)),i=n.find((t=>t))??e[0];return n.forEach(((t,s)=>{void 0===t&&(n[s]=i)})),n}_getPrimaryRasterId(t){return t?.url}_getPrimaryRasters(t,s=[],e=[]){for(let r=0;r<t.sourceRasters.length;r++){const n=t.sourceRasters[r];if("number"!=typeof n)if("bind"in n)this._getPrimaryRasters(n,s,e);else{const t=n,r=this._getPrimaryRasterId(t);if(null==r)continue;e.includes(r)||(this.mainPrimaryRasterId===r?(s.unshift(t),e.unshift(r)):(s.push(t),e.push(r)))}}}_isRasterFunctionValue(t){return null!=t&&"object"==typeof t&&"getWebGLProcessorDefinition"in t}_readRasterValue(t,s){const{primaryPixelBlocks:e}=s;if(null==t||"$$"===t){const t=e[0];return null==t?null:t.clone()}if("string"==typeof t){const r=s.primaryRasterIds.indexOf(t);return-1===r?null:e[r]}if("number"==typeof t){const s=e[0];if(null==s)return null;const{width:r,height:n,pixelType:o,mask:a}=s,u=a?new Uint8Array(a):null,p=new Float32Array(r*n);p.fill(t);const l=this.sourceRasterInfos[0].bandCount,c=new Array(l).fill(p);return new i({width:r,height:n,pixelType:o,pixels:c,mask:u})}return t.process(s)}};t([e({json:{write:!0}})],u.prototype,"functionName",void 0),t([e({json:{write:!0}})],u.prototype,"functionArguments",void 0),t([e()],u.prototype,"rasterArgumentNames",void 0),t([e({json:{write:!0}}),r((t=>t?.toLowerCase()))],u.prototype,"outputPixelType",void 0),t([e({json:{write:!0}})],u.prototype,"mainPrimaryRasterId",void 0),t([e()],u.prototype,"sourceRasters",void 0),t([e({type:[o],json:{write:!0}})],u.prototype,"sourceRasterInfos",void 0),t([e({json:{write:!0}})],u.prototype,"rasterInfo",void 0),t([e({json:{write:!0}})],u.prototype,"readingBufferSize",void 0),t([e({json:{write:!0}})],u.prototype,"id",void 0),t([e()],u.prototype,"isNoopProcess",void 0),t([e()],u.prototype,"supportsGPU",null),t([e()],u.prototype,"rawInputBandIds",void 0),t([e()],u.prototype,"isInputBandIdsSwizzled",void 0),t([e()],u.prototype,"swizzledBandSelection",void 0),t([e()],u.prototype,"isBranch",void 0),t([e()],u.prototype,"flatWebGLFunctionChain",null),t([e()],u.prototype,"_bindingResult",void 0),u=t([n("esri.layers.support.rasterFunctions.BaseRasterFunction")],u);const p=u;export{p as default};
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import{JSONSupport as s}from"../../../core/JSONSupport.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import{cast as r}from"../../../core/accessorSupport/decorators/cast.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../PixelBlock.js";import o from"../RasterInfo.js";const a=new Set(["slope","aspect","curvature","hillshade","shadedrelief"]);let u=class extends s{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0,this.id=-1,this.isNoopProcess=!1,this.rawInputBandIds=[],this.isInputBandIdsSwizzled=!1,this.swizzledBandSelection=[],this.isBranch=!1,this._bindingResult=null}get supportsGPU(){return this._bindingResult.supportsGPU}get flatWebGLFunctionChain(){const t=this.getWebGLProcessorDefinition();if(!t)return null;const s=[t],{parameters:e}=t;let r=e.rasters||e.raster&&[e.raster];for(;r?.length;){s.unshift(...r);const t=[];for(let s=0;s<r.length;s++){const{parameters:e}=r[s],n=e.rasters||e.raster&&[e.raster];n?.length&&t.push(...n)}r=t}for(let o=s.length-1;o>=0;o--)s[o].isNoopProcess&&s.splice(o,1);let n=!1;for(let o=0;o<s.length;o++){const t=s[o];t.id=s.length-o-1;const{rasters:e}=t.parameters;n=n||null!=e&&e.length>1}const i=s.some((({name:t})=>a.has(t.toLowerCase())));return{functions:s,hasBranches:n,hasSurfaceFunction:i}}bind(t,s=!1,e=-1){this.id=e+1;const r=this._getRasterValues();let n=!0;for(let i=0;i<r.length;i++){const e=r[i];if(null!=e&&this._isRasterFunctionValue(e)){const r=e.bind(t,s,this.id+i);if(!r.success)return this._bindingResult=r,r;n=n&&r.supportsGPU}}return!this.rasterInfo||s?(this.sourceRasterInfos=this._getSourceRasterInfos(t),this._bindingResult=this._bindSourceRasters(),this._bindingResult.success&&this._patchRasterInfo(),this._bindingResult.supportsGPU=n&&this._bindingResult.supportsGPU,this.processInputBandIds(),this._bindingResult):(this._bindingResult={success:!0,supportsGPU:!0},this.processInputBandIds(),this._bindingResult)}process(t){const s=this._getRasterValues(),e=0===s.length?t.pixelBlocks??t.primaryPixelBlocks:s.map((s=>this._readRasterValue(s,t)));return this._processPixels({...t,pixelBlocks:e})}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);let s;if(t.length>1){const s=t.map((t=>t.processInputBandIds()[0]));this.rawInputBandIds=s,this.isInputBandIdsSwizzled=this.rawInputBandIds.some(((t,s)=>t!==s));const e=t.filter((t=>"ExtractBand"===t.functionName));return e.length&&e.forEach(((t,s)=>{t.isInputBandIdsSwizzled=!0,t.swizzledBandSelection=[s,s,s]})),this.rawInputBandIds}const e=t[0];if(e){if(s=e.processInputBandIds(),e.isInputBandIdsSwizzled)return this.rawInputBandIds=s,s}else{s=[];const{bandCount:t}=this.sourceRasterInfos[0];for(let e=0;e<t;e++)s.push(e)}const r=this._getInputBandIds(s);return this.isInputBandIdsSwizzled=r.some(((t,s)=>t!==s)),this.rawInputBandIds=r,this.rawInputBandIds}getPrimaryRasters(){const t=[],s=[];return this._getPrimaryRasters(this,t,s),{rasters:t,rasterIds:s}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:s,rasters:e}=this.functionArguments;return e&&Array.isArray(e)&&e.length?(t.rasters=e.map((t=>this._isRasterFunctionValue(t)?t.getWebGLProcessorDefinition():"number"==typeof t?{name:"Constant",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1})),t.rasters.some((t=>null!=t))||(t.rasters=null)):this._isRasterFunctionValue(s)&&(t.raster=s.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}_getOutputPixelType(t){return"unknown"===this.outputPixelType?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_isOutputRoundingNeeded(){const{outputPixelType:t}=this;return(t?.startsWith("u")||t?.startsWith("s"))??!1}_getRasterValues(){const{rasterArgumentNames:t}=this;return"rasters"===t[0]?this.functionArguments.rasters??[]:t.map((t=>this.functionArguments[t])).flat()}_getSourceRasterInfos(t){const s=this._getRasterValues(),{rasterInfos:e,rasterIds:r}=t;if(0===s.length)return e;const n=s.map((t=>t&&"object"==typeof t&&"bind"in t&&t.rasterInfo?t.rasterInfo:"string"==typeof t&&r.includes(t)?e[r.indexOf(t)]:"number"!=typeof t?e[0]:void 0)),i=n.find((t=>t))??e[0];return n.forEach(((t,s)=>{void 0===t&&(n[s]=i)})),n}_getPrimaryRasterId(t){return t?.url}_getPrimaryRasters(t,s=[],e=[]){for(let r=0;r<t.sourceRasters.length;r++){const n=t.sourceRasters[r];if("number"!=typeof n)if("bind"in n)this._getPrimaryRasters(n,s,e);else{const t=n,r=this._getPrimaryRasterId(t);if(null==r)continue;e.includes(r)||(this.mainPrimaryRasterId===r?(s.unshift(t),e.unshift(r)):(s.push(t),e.push(r)))}}}_isRasterFunctionValue(t){return null!=t&&"object"==typeof t&&"getWebGLProcessorDefinition"in t}_readRasterValue(t,s){const{primaryPixelBlocks:e}=s;if(null==t||"$$"===t){const t=e[0];return null==t?null:t.clone()}if("string"==typeof t){const r=s.primaryRasterIds.indexOf(t);return-1===r?null:e[r]}if("number"==typeof t){const s=e[0];if(null==s)return null;const{width:r,height:n,pixelType:o,mask:a}=s,u=a?new Uint8Array(a):null,p=new Float32Array(r*n);p.fill(t);const l=this.sourceRasterInfos[0].bandCount,c=new Array(l).fill(p);return new i({width:r,height:n,pixelType:o,pixels:c,mask:u})}return t.process(s)}_patchRasterInfo(){const{rasterInfo:t}=this;if(!t?.keyProperties)return;const{bandCount:s,keyProperties:e,statistics:r,histograms:n}=t,i=e.BandProperties;i&&i.length!==s&&(t.keyProperties={...e,BandProperties:void 0}),r&&r.length!==s&&(t.statistics=r.length>s?r.slice(0,s):null),n&&n.length!==s&&(t.histograms=n.length>s?n.slice(0,s):null)}};t([e({json:{write:!0}})],u.prototype,"functionName",void 0),t([e({json:{write:!0}})],u.prototype,"functionArguments",void 0),t([e()],u.prototype,"rasterArgumentNames",void 0),t([e({json:{write:!0}}),r((t=>t?.toLowerCase()))],u.prototype,"outputPixelType",void 0),t([e({json:{write:!0}})],u.prototype,"mainPrimaryRasterId",void 0),t([e()],u.prototype,"sourceRasters",void 0),t([e({type:[o],json:{write:!0}})],u.prototype,"sourceRasterInfos",void 0),t([e({json:{write:!0}})],u.prototype,"rasterInfo",void 0),t([e({json:{write:!0}})],u.prototype,"readingBufferSize",void 0),t([e({json:{write:!0}})],u.prototype,"id",void 0),t([e()],u.prototype,"isNoopProcess",void 0),t([e()],u.prototype,"supportsGPU",null),t([e()],u.prototype,"rawInputBandIds",void 0),t([e()],u.prototype,"isInputBandIdsSwizzled",void 0),t([e()],u.prototype,"swizzledBandSelection",void 0),t([e()],u.prototype,"isBranch",void 0),t([e()],u.prototype,"flatWebGLFunctionChain",null),t([e()],u.prototype,"_bindingResult",void 0),u=t([n("esri.layers.support.rasterFunctions.BaseRasterFunction")],u);const p=u;export{p 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import{property as
|
|
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 s}from"../../../core/accessorSupport/decorators/subclass.js";import r from"./BaseRasterFunction.js";import o from"./CompositeBandFunctionArguments.js";import{compositeBands as n}from"./pixelUtils.js";let i=class extends r{constructor(){super(...arguments),this.functionName="CompositeBand",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];this.outputPixelType=this._getOutputPixelType(e.pixelType);const s=e.clone();if(s.attributeTable=null,s.colormap=null,s.pixelType=this.outputPixelType,s.bandCount=t.map((({bandCount:t})=>t)).reduce(((t,e)=>t+e)),t.every((({statistics:t})=>null!=t&&t.length))){const e=[];t.forEach((({statistics:t})=>null!=t&&e.push(...t))),s.statistics=e}if(t.every((({histograms:t})=>null!=t&&t.length))){const e=[];t.forEach((({histograms:t})=>null!=t&&e.push(...t))),s.histograms=e}s.bandCount>1&&(s.colormap=null,s.attributeTable=null);const r=t.every((t=>t.keyProperties.BandProperties?.length))?t.flatMap((t=>t.keyProperties.BandProperties)):void 0;s.keyProperties={...s.keyProperties,BandProperties:r},this.rasterInfo=s;return{success:!0,supportsGPU:s.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;if(!e)return null;const s=e?.[0];return null==s?null:n(e)}_getWebGLParameters(){return{bandCount:this.rasterInfo.bandCount}}};t([e({json:{write:!0,name:"rasterFunction"}})],i.prototype,"functionName",void 0),t([e({type:o,json:{write:!0,name:"rasterFunctionArguments"}})],i.prototype,"functionArguments",void 0),t([e()],i.prototype,"rasterArgumentNames",void 0),i=t([s("esri.layers.support.rasterFunctions.CompositeBandFunction")],i);const a=i;export{a 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.27/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 n}from"../../../core/accessorSupport/decorators/subclass.js";import{getBandMatrix3 as s}from"./bandIndexUtils.js";import r from"./BaseRasterFunction.js";import
|
|
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 n}from"../../../core/accessorSupport/decorators/subclass.js";import{getBandMatrix3 as s}from"./bandIndexUtils.js";import r from"./BaseRasterFunction.js";import a from"./ExtractBandFunctionArguments.js";import{MissingBandAction as o}from"./pixelUtils.js";let i=class extends r{constructor(){super(...arguments),this.functionName="ExtractBand",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{functionArguments:t,sourceRasterInfos:e}=this,n=e[0],{method:s,bandNames:r,bandWavelengths:a,bandIds:i,missingBandAction:l}=t,u=r?.length&&("name"===s||"id"!==s&&!i?.length),c=a?.length&&("wavelength"===s||"id"!==s&&!i?.length),h=l===o.fail,d=u?this._matchBandNames(n,r):c?this._matchBandWavelengths(n,a,h):this._matchBandIds(n,i,h);if(null==d){return{success:!1,supportsGPU:!1,error:`extract-band-function: Invalid ${u?"band names":c?"band wavelengths":"band ids"} for the imagery data source`}}this.functionArguments.bandIds=d,this.functionArguments.method="id",this.outputPixelType=this._getOutputPixelType("f32");const m=n.clone();m.pixelType=this.outputPixelType,m.bandCount=d.length;const{statistics:p,histograms:g}=m;null!=p&&p.length&&(m.statistics=d.map((t=>p[t]||p[p.length-1]))),null!=g&&g.length&&(m.histograms=d.map((t=>g[t]||g[g.length-1])));let f=m.keyProperties?.BandProperties;f?.length&&(f=d.map((t=>t>=f.length?f[f.length-1]:f[t])),m.keyProperties={...m.keyProperties,BandProperties:f}),this.rasterInfo=m;return{success:!0,supportsGPU:m.bandCount<=3}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const n=e.pixels.length,s=this.functionArguments.bandIds.map((t=>t>=n?n-1:t));return e.extractBands(s)}_getWebGLParameters(){let t;if(this.isInputBandIdsSwizzled)t=this.swizzledBandSelection.length?this.swizzledBandSelection:[0,1,2];else{t=[...this.functionArguments.bandIds],0===t.length?t=[0,1,2]:t.length<3&&(t[1]=t[1]??t[0],t[2]=t[2]??t[1]);for(let e=0;e<3;e++)t[e]=Math.min(t[e],2)}return{bandIndexMat3:s(t)}}_getInputBandIds(t){const e=t.length;return this.functionArguments.bandIds.map((t=>t>=e?e-1:t)).map((e=>t[e]))}_matchBandNames(t,e){const n=t.bandInfos.map((({name:t})=>t.toLowerCase())),s=[];for(let r=0;r<e.length;r++){const t=e[r].toLowerCase();let a=n.indexOf(t);if(-1===a&&"nearinfrared"===t&&(a=n.findIndex((t=>t.startsWith("nearinfrared_1"))),-1===a&&(a=n.findIndex((t=>t.startsWith("nearinfrared"))))),-1===a)return null;s.push(a)}return s}_matchBandIds(t,e,n){const{bandCount:s}=t;return!e?.length||n&&e.some((t=>t<0||t>=s))?null:e}_matchBandWavelengths(t,e,n){const{bandInfos:s}=t,r=[];for(let i=0;i<s.length;i++){const{minWavelength:t,maxWavelength:e}=s[i];if(!t||!e)return null;r.push({minWavelength:t,maxWavelength:e})}const{wavelengthMatchTolerance:a}=this.functionArguments,o=[];for(let i=0;i<e.length;i++){const t=e[i];let s=!1,l=-1,u=Number.MAX_VALUE;for(let e=0;e<r.length;e++){const n=r[e],a=t>=n.minWavelength&&t<=n.maxWavelength,o=Math.abs(t-(n.minWavelength+n.maxWavelength)/2);a?o<u&&(s=!0,l=e,u=o):!s&&o<u&&(l=e,u=o)}if(!s&&a&&u<a&&(s=!0),!s&&n)return null;o.push(l)}return o}};t([e({json:{write:!0,name:"rasterFunction"}})],i.prototype,"functionName",void 0),t([e({type:a,json:{write:!0,name:"rasterFunctionArguments"}})],i.prototype,"functionArguments",void 0),t([e()],i.prototype,"rasterArgumentNames",void 0),i=t([n("esri.layers.support.rasterFunctions.ExtractBandFunction")],i);const l=i;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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.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{enumeration as s}from"../../../core/accessorSupport/decorators/enumeration.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import r from"./BaseFunctionArguments.js";import{MissingBandAction as n}from"./pixelUtils.js";var a;let i=a=class extends r{constructor(){super(...arguments),this.bandIds=[],this.bandNames=[],this.bandWavelengths=[],this.missingBandAction=n.bestMatch}clone(){return new a({bandIds:[...this.bandIds],bandNames:[...this.bandNames],missingBandAction:this.missingBandAction,method:this.method,wavelengthMatchTolerance:this.wavelengthMatchTolerance})}};t([o({json:{write:!0}})],i.prototype,"bandIds",void 0),t([o({json:{write:!0}})],i.prototype,"bandNames",void 0),t([o({json:{write:!0}})],i.prototype,"bandWavelengths",void 0),t([s({0:"name",1:"wavelength",2:"id"})],i.prototype,"method",void 0),t([o({json:{write:!0}})],i.prototype,"missingBandAction",void 0),t([o({json:{write:!0}})],i.prototype,"wavelengthMatchTolerance",void 0),i=a=t([e("esri.layers.support.rasterFunctions.ExtractBandFunctionArguments")],i);const c=i;export{c 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{calculateNDVI as
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{calculateNDVI as e,getBandMatrix3 as n}from"./bandIndexUtils.js";import o from"./BaseRasterFunction.js";import i from"./NDVIFunctionArguments.js";let u=class extends o{constructor(){super(...arguments),this.functionName="NDVI",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{scientificOutput:t,visibleBandID:s,infraredBandID:r}=this.functionArguments;this.outputPixelType=this._getOutputPixelType(t?"f32":"u8");const e=this.sourceRasterInfos[0],n=Math.max(s,r);if(e.bandCount<2||n>=e.bandCount)return{success:!1,supportsGPU:!1,error:"ndvi-function: source raster has insufficient amount of raster bands"};const o=e.clone();o.pixelType=this.outputPixelType,o.colormap=null,o.histograms=null,o.bandCount=1,o.keyProperties={...o.keyProperties,BandProperties:void 0};const[i,u,a,c]=t?[-1,1,0,.1]:[0,200,100,10];return o.statistics=[{min:i,max:u,avg:a,stddev:c}],this.rasterInfo=o,{success:!0,supportsGPU:!0}}_processPixels(t){const s=t.pixelBlocks?.[0];if(null==s)return null;const{visibleBandID:r,infraredBandID:n,scientificOutput:o}=this.functionArguments;return e(s,r,n,!o)}_getWebGLParameters(){const{visibleBandID:t,infraredBandID:s,scientificOutput:r}=this.functionArguments,e=this.isInputBandIdsSwizzled?[0,1,2]:[s,t,0];return{bandIndexMat3:n(e),scaled:!r}}_getInputBandIds(t){const{visibleBandID:s,infraredBandID:r}=this.functionArguments;return[r,s,0].map((s=>t[s]))}};t([s({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),t([s({type:i,json:{write:!0,name:"rasterFunctionArguments"}})],u.prototype,"functionArguments",void 0),t([s()],u.prototype,"rasterArgumentNames",void 0),u=t([r("esri.layers.support.rasterFunctions.NDVIFunction")],u);const a=u;export{a 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../request.js";import"../../core/has.js";import{strict as s}from"../../core/jsonMap.js";import{createAbortError as r}from"../../core/promiseUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{enumeration as i}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import c from"../../rest/networks/support/ValidateNetworkTopologyResult.js";const n=s()({Pending:"job-waiting",InProgress:"job-executing",Completed:"job-succeeded"});let p=class extends c{constructor(t){super(t),this.statusUrl=null,this.status=null,this.submissionTime=null,this.lastUpdatedTime=null,this._timer=void 0}destroy(){clearInterval(this._timer)}async checkJobStatus(t){const s={...t,query:{f:"json"}},{data:r}=await e(this.statusUrl,s);return this.read(r),
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../request.js";import"../../core/has.js";import{strict as s}from"../../core/jsonMap.js";import{createAbortError as r}from"../../core/promiseUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{enumeration as i}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import c from"../../rest/networks/support/ValidateNetworkTopologyResult.js";const n=s()({Pending:"job-waiting",InProgress:"job-executing",Completed:"job-succeeded"});let p=class extends c{constructor(t){super(t),this.statusUrl=null,this.status=null,this.submissionTime=null,this.lastUpdatedTime=null,this._timer=void 0}destroy(){clearInterval(this._timer)}async checkJobStatus(t){const s={...t,query:{f:"json"}},{data:r}=await e(this.statusUrl,s);return this.read(r),this.editsResolver&&this.editsResolver.resolve({edits:null,addedFeatures:[],updatedFeatures:[],deletedFeatures:[],addedAttachments:[],updatedAttachments:[],deletedAttachments:[],exceededTransferLimit:!0}),this}async waitForJobCompletion(t={}){const{interval:e=1e3,statusCallback:s}=t;return new Promise(((t,o)=>{this._clearTimer();const i=setInterval((()=>{this._timer||o(r()),this.checkJobStatus().then((e=>{const{status:r}=e;switch(this.status=r,r){case"job-succeeded":this._clearTimer(),t(this);break;case"job-waiting":case"job-executing":s&&s(this)}}),(t=>{this._clearTimer(),o(t)}))}),e);this._timer=i}))}_clearTimer(){clearInterval(this._timer),this._timer=void 0}};t([o()],p.prototype,"editsResolver",void 0),t([o({type:String,json:{write:!0}})],p.prototype,"statusUrl",void 0),t([i(n)],p.prototype,"status",void 0),t([o({type:Date,json:{type:Number,write:{writer:(t,e)=>{e.submissionTime=t?t.getTime():null}}}})],p.prototype,"submissionTime",void 0),t([o({type:Date,json:{type:Number,write:{writer:(t,e)=>{e.lastUpdatedTime=t?t.getTime():null}}}})],p.prototype,"lastUpdatedTime",void 0),p=t([a("esri.networks.support.TopologyValidationJobInfo")],p);const l=p;export{l as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "4.27.0-next.
|
|
3
|
+
"version": "4.27.0-next.20230523",
|
|
4
4
|
"homepage": "https://js.arcgis.com",
|
|
5
5
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
6
6
|
"keywords": [
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@esri/calcite-colors": "~6.1.0",
|
|
30
30
|
"@esri/calcite-components": "^1.3.1",
|
|
31
31
|
"@popperjs/core": "~2.11.7",
|
|
32
|
-
"focus-trap": "~7.4.
|
|
32
|
+
"focus-trap": "~7.4.3",
|
|
33
33
|
"luxon": "~3.3.0",
|
|
34
34
|
"sortablejs": "~1.15.0"
|
|
35
35
|
},
|
package/popup/FieldInfo.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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../chunks/tslib.es6.js";import{JSONMap as o}from"../core/jsonMap.js";import{JSONSupport as e}from"../core/JSONSupport.js";import{clone as i}from"../core/lang.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{enumeration as s}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import l from"./support/FieldInfoFormat.js";var a;let n=a=class extends e{constructor(t){super(t),this.fieldName=null,this.format=null,this.isEditable=!0,this.label=null,this.stringFieldOption="text-box",this.statisticType=null,this.tooltip=null,this.visible=!0}clone(){return new a({fieldName:this.fieldName,format:this.format?i(this.format):null,isEditable:this.isEditable,label:this.label,stringFieldOption:this.stringFieldOption,statisticType:this.statisticType,tooltip:this.tooltip,visible:this.visible})}};t([r({type:String,json:{write:!0}})],n.prototype,"fieldName",void 0),t([r({type:l,json:{write:!0}})],n.prototype,"format",void 0),t([r({type:Boolean,json:{write:!0,default:!0}})],n.prototype,"isEditable",void 0),t([r({type:String,json:{write:!0}})],n.prototype,"label",void 0),t([s(new o({richtext:"rich-text",textarea:"text-area",textbox:"text-box"}),{default:"text-box"})],n.prototype,"stringFieldOption",void 0),t([r({type:["count","sum","min","max","avg","stddev","var"],json:{write:!0}})],n.prototype,"statisticType",void 0),t([r({type:String,json:{write:!0}})],n.prototype,"tooltip",void 0),t([r({type:Boolean,json:{write:!0}})],n.prototype,"visible",void 0),n=a=t([p("esri.popup.FieldInfo")],n);const c=n;export{c as default};
|
|
5
|
+
import{_ as t}from"../chunks/tslib.es6.js";import{JSONMap as o}from"../core/jsonMap.js";import{JSONSupport as e}from"../core/JSONSupport.js";import{clone as i}from"../core/lang.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{enumeration as s}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import l from"./support/FieldInfoFormat.js";var a;let n=a=class extends e{constructor(t){super(t),this.fieldName=null,this.format=null,this.isEditable=!0,this.label=null,this.stringFieldOption="text-box",this.statisticType=null,this.tooltip=null,this.visible=!0}clone(){return new a({fieldName:this.fieldName,format:this.format?i(this.format):null,isEditable:this.isEditable,label:this.label,stringFieldOption:this.stringFieldOption,statisticType:this.statisticType,tooltip:this.tooltip,visible:this.visible})}};t([r({type:String,json:{write:!0}})],n.prototype,"fieldName",void 0),t([r({type:l,json:{write:!0}})],n.prototype,"format",void 0),t([r({type:Boolean,json:{write:{alwaysWriteDefaults:!0},default:!0}})],n.prototype,"isEditable",void 0),t([r({type:String,json:{write:!0}})],n.prototype,"label",void 0),t([s(new o({richtext:"rich-text",textarea:"text-area",textbox:"text-box"}),{default:"text-box"})],n.prototype,"stringFieldOption",void 0),t([r({type:["count","sum","min","max","avg","stddev","var"],json:{write:!0}})],n.prototype,"statisticType",void 0),t([r({type:String,json:{write:!0}})],n.prototype,"tooltip",void 0),t([r({type:Boolean,json:{write:!0}})],n.prototype,"visible",void 0),n=a=t([p("esri.popup.FieldInfo")],n);const c=n;export{c as default};
|
package/portal/Portal.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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import{id as r}from"../kernel.js";import o from"../request.js";import s from"../core/Error.js";import{JSONSupportMixin as i}from"../core/JSONSupport.js";import a from"../core/Loadable.js";import{destroyMaybe as l,removeMaybe as n}from"../core/maybe.js";import{throwIfAborted as u,isAborted as p,createAbortError as d,throwIfAbortError as h}from"../core/promiseUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import{ensureType as c}from"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import v from"../geometry/Extent.js";import{getLocale as S}from"../intl/locale.js";import{ensureDefaultPortalInstance as g}from"./portalDefault.js";import P from"./PortalQueryParams.js";import G from"./PortalQueryResult.js";import O from"./PortalUser.js";import{supportsApiKey as B}from"../support/apiKeyUtils.js";var D;let U;const b={PortalGroup:()=>import("./PortalGroup.js"),PortalItem:()=>import("./PortalItem.js"),PortalUser:()=>import("./PortalUser.js")};let Q=D=class extends(i(a)){constructor(e){super(e),this._esriIdCredentialCreateHandle=null,this.access=null,this.allSSL=!1,this.authMode="auto",this.authorizedCrossOriginDomains=null,this.basemapGalleryGroupQuery=null,this.basemapGalleryGroupQuery3D=null,this.bingKey=null,this.canListApps=!1,this.canListData=!1,this.canListPreProvisionedItems=!1,this.canProvisionDirectPurchase=!1,this.canSearchPublic=!0,this.canShareBingPublic=!1,this.canSharePublic=!1,this.canSignInArcGIS=!1,this.canSignInIDP=!1,this.colorSetsGroupQuery=null,this.commentsEnabled=!1,this.created=null,this.culture=null,this.customBaseUrl=null,this.defaultBasemap=null,this.defaultDevBasemap=null,this.defaultExtent=null,this.defaultVectorBasemap=null,this.description=null,this.devBasemapGalleryGroupQuery=null,this.eueiEnabled=null,this.featuredGroups=null,this.featuredItemsGroupQuery=null,this.galleryTemplatesGroupQuery=null,this.livingAtlasGroupQuery=null,this.hasCategorySchema=!1,this.helperServices=null,this.homePageFeaturedContent=null,this.homePageFeaturedContentCount=null,this.httpPort=null,this.httpsPort=null,this.id=null,this.ipCntryCode=null,this.isPortal=!1,this.isReadOnly=!1,this.layerTemplatesGroupQuery=null,this.maxTokenExpirationMinutes=null,this.modified=null,this.name=null,this.portalHostname=null,this.portalMode=null,this.portalProperties=null,this.region=null,this.rotatorPanels=null,this.showHomePageDescription=!1,this.sourceJSON=null,this.supportsHostedServices=!1,this.symbolSetsGroupQuery=null,this.templatesGroupQuery=null,this.units=null,this.url=t.portalUrl,this.urlKey=null,this.user=null,this.useStandardizedQuery=!1,this.useVectorBasemaps=!1,this.vectorBasemapGalleryGroupQuery=null}normalizeCtorArgs(e){return"string"==typeof e?{url:e}:e}destroy(){C.unregister(this),this.defaultBasemap=l(this.defaultBasemap),this.defaultDevBasemap=l(this.defaultDevBasemap),this.defaultVectorBasemap=l(this.defaultVectorBasemap),this._esriIdCredentialCreateHandle=n(this._esriIdCredentialCreateHandle)}readAuthorizedCrossOriginDomains(e){if(e)for(const r of e)t.request.trustedServers.includes(r)||t.request.trustedServers.push(r);return e}readDefaultBasemap(e){return this._readBasemap(e)}readDefaultDevBasemap(e){return this._readBasemap(e)}readDefaultVectorBasemap(e){return this._readBasemap(e)}get extraQuery(){const e=!(this.user&&this.user.orgId)||this.canSearchPublic;return this.id&&!e?` AND orgid:${this.id}`:null}get isOrganization(){return!!this.access}get itemPageUrl(){return this.url?`${this.url}/home/item.html`:null}get restUrl(){let e=this.url;if(e){const t=e.indexOf("/sharing");e=t>0?e.substring(0,t):this.url.replace(/\/+$/,""),e+="/sharing/rest"}return e}get thumbnailUrl(){const e=this.restUrl,t=this.thumbnail;return e&&t?this._normalizeSSL(e+"/portals/self/resources/"+t):null}readUrlKey(e){return e?e.toLowerCase():e}readUser(e){let t=null;return e&&(t=O.fromJSON(e),t.portal=this),t}load(e){const t=import("../Basemap.js").then((({default:t})=>{u(e),U=t})).then((()=>this.sourceJSON?this.sourceJSON:this.fetchSelf(this.authMode,!1,e))).then((e=>{if(r){const e=r;this.credential=e.findCredential(this.restUrl),this.credential||this.authMode!==D.AUTH_MODE_AUTO||(this._esriIdCredentialCreateHandle?.remove(),this._esriIdCredentialCreateHandle=e.on("credential-create",q(new WeakRef(this))),C.register(this,this._esriIdCredentialCreateHandle,this))}this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(t),Promise.resolve(this)}async createElevationLayers(){await this.load();const e=this._getHelperService("defaultElevationLayers"),t=(await import("../layers/ElevationLayer.js")).default;return e?e.map((e=>new t({id:e.id,url:e.url}))):[]}async fetchBasemaps(e,t){const r=await this._fetchBasemaps(e,t);if(t?.fetchBasemaps3D){const o=await this._fetchBasemaps3D(e,t);r.unshift(...o)}return r}fetchCategorySchema(e){return this.hasCategorySchema?this.request(this.restUrl+"/portals/self/categorySchema",e).then((e=>e.categorySchema)):p(e)?Promise.reject(d()):Promise.resolve([])}fetchFeaturedGroups(e){const t=this.featuredGroups,r=new P;if(r.num=100,r.sortField="title",t&&t.length){const o=[];for(const e of t)o.push(`(title:"${e.title}" AND owner:${e.owner})`);return r.query=o.join(" OR "),this.queryGroups(r,e).then((e=>e.results))}return p(e)?Promise.reject(d()):Promise.resolve([])}fetchRegions(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/regions",{...e,query:{culture:t}})}fetchSettings(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/self/settings",{...e,query:{culture:t}})}static getDefault(){return g((()=>new D))}queryGroups(e,t){return this.queryPortal("/community/groups",e,"PortalGroup",t)}queryItems(e,t){return this.queryPortal("/search",e,"PortalItem",t)}queryUsers(e,t){return e.sortField||(e.sortField="username"),this.queryPortal("/community/users",e,"PortalUser",t)}fetchSelf(e=this.authMode,t=!1,r){const o=this.restUrl+"/portals/self",s={authMode:e,query:{culture:S().toLowerCase()},...r};return"auto"===s.authMode&&(s.authMode="no-prompt"),t&&(s.query.default=!0),this.request(o,s)}queryPortal(e,t,r,o){const s=c(P,t),i=t=>this.request(this.restUrl+e,{...s.toRequestOptions(this),...o}).then((e=>{const r=s.clone();return r.start=e.nextStart,new G({nextQueryParams:r,queryParams:s,total:e.total,results:D._resultsToTypedArray(t,{portal:this},e,o)})})).then((e=>Promise.all(e.results.map((t=>"function"==typeof t.when?t.when():e))).then((()=>e),(t=>(h(t),e)))));return r&&b[r]?b[r]().then((({default:e})=>(u(o),i(e)))):i()}signIn(){if(this.authMode===D.AUTH_MODE_ANONYMOUS)return Promise.reject(new s("portal:invalid-auth-mode",`Current "authMode"' is "${this.authMode}"`));if("failed"===this.loadStatus)return Promise.reject(this.loadError);const e=e=>Promise.resolve().then((()=>"not-loaded"===this.loadStatus?(e||(this.authMode="immediate"),this.load().then((()=>null))):"loading"===this.loadStatus?this.load().then((()=>this.credential?null:(this.credential=e,this.fetchSelf("immediate")))):this.user&&this.credential===e?null:(this.credential=e,this.fetchSelf("immediate")))).then((e=>{e&&(this.sourceJSON=e,this.read(e))}));return r?r.getCredential(this.restUrl).then((t=>e(t))):e(this.credential)}normalizeUrl(e){const t=this.credential&&this.credential.token;return this._normalizeSSL(t?e+(e.includes("?")?"&":"?")+"token="+t:e)}requestToTypedArray(e,t,r){return this.request(e,t).then((e=>{const t=D._resultsToTypedArray(r,{portal:this},e);return Promise.all(t.map((t=>"function"==typeof t.when?t.when():e))).then((()=>t),(()=>t))}))}request(e,t={}){const r={f:"json",...t.query},{authMode:s=(this.authMode===D.AUTH_MODE_ANONYMOUS?"anonymous":"auto"),body:i=null,cacheBust:a=!1,method:l="auto",responseType:n="json",signal:u}=t,p={authMode:s,body:i,cacheBust:a,method:l,query:r,responseType:n,timeout:0,signal:u};return o(this._normalizeSSL(e),p).then((e=>e.data))}toJSON(){throw new s("internal:not-yet-implemented","Portal.toJSON is not yet implemented")}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new D({sourceJSON:e})}_getHelperService(e){const t=this.helperServices&&this.helperServices[e];if(!t)throw new s("portal:service-not-found",`The \`helperServices\` do not include an entry named "${e}"`);return t}async _fetchBasemaps(e,r){const o=new P;o.query=e||(t.apiKey&&B(this.url)?this.devBasemapGalleryGroupQuery:this.useVectorBasemaps?this.vectorBasemapGalleryGroupQuery:this.basemapGalleryGroupQuery),o.disableExtraQuery=!0;const s=await this.queryGroups(o,r);if(!s.total)return[];const i=s.results[0];o.num=100,o.query='type:"Web Map" -type:"Web Application"',o.sortField=i.sortField||"name",o.sortOrder=i.sortOrder||"desc";const a=await i.queryItems(o,r);if(!a.total)return[];return a.results.filter((e=>"Web Map"===e.type)).map((e=>new U({portalItem:e})))}async _fetchBasemaps3D(e,t){const r=e||this.basemapGalleryGroupQuery3D;if(!r)return[];const o=new P({query:r,disableExtraQuery:!0}),s=await this.queryGroups(o,t);if(!s.total)return[];const i=s.results[0];o.num=100,o.query='type:"Web Scene"',o.sortField=i.sortField||"name",o.sortOrder=i.sortOrder||"desc";const a=await i.queryItems(o,t);if(!a.total)return[];return a.results.filter((e=>"Web Scene"===e.type)).map((e=>new U({portalItem:e})))}_normalizeSSL(e){return e.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(e){if(e){const t=U.fromJSON(e);return t.portalItem={portal:this},t}return null}static _resultsToTypedArray(e,t,r,o){let s=[];if(r){const i=null!=o?o.signal:null;s=r.listings||r.notifications||r.userInvitations||r.tags||r.items||r.groups||r.comments||r.provisions||r.results||r.relatedItems||r,(e||t)&&(s=s.map((r=>{const o=Object.assign(e?e.fromJSON(r):r,t);return"function"==typeof o.load&&o.load(i),o})))}else s=[];return s}};Q.AUTH_MODE_ANONYMOUS="anonymous",Q.AUTH_MODE_AUTO="auto",Q.AUTH_MODE_IMMEDIATE="immediate",e([y()],Q.prototype,"access",void 0),e([y()],Q.prototype,"allSSL",void 0),e([y()],Q.prototype,"authMode",void 0),e([y()],Q.prototype,"authorizedCrossOriginDomains",void 0),e([m("authorizedCrossOriginDomains")],Q.prototype,"readAuthorizedCrossOriginDomains",null),e([y()],Q.prototype,"basemapGalleryGroupQuery",void 0),e([y({json:{name:"3DBasemapGalleryGroupQuery"}})],Q.prototype,"basemapGalleryGroupQuery3D",void 0),e([y()],Q.prototype,"bingKey",void 0),e([y()],Q.prototype,"canListApps",void 0),e([y()],Q.prototype,"canListData",void 0),e([y()],Q.prototype,"canListPreProvisionedItems",void 0),e([y()],Q.prototype,"canProvisionDirectPurchase",void 0),e([y()],Q.prototype,"canSearchPublic",void 0),e([y()],Q.prototype,"canShareBingPublic",void 0),e([y()],Q.prototype,"canSharePublic",void 0),e([y()],Q.prototype,"canSignInArcGIS",void 0),e([y()],Q.prototype,"canSignInIDP",void 0),e([y()],Q.prototype,"colorSetsGroupQuery",void 0),e([y()],Q.prototype,"commentsEnabled",void 0),e([y({type:Date})],Q.prototype,"created",void 0),e([y()],Q.prototype,"credential",void 0),e([y()],Q.prototype,"culture",void 0),e([y()],Q.prototype,"currentVersion",void 0),e([y()],Q.prototype,"customBaseUrl",void 0),e([y()],Q.prototype,"defaultBasemap",void 0),e([m("defaultBasemap")],Q.prototype,"readDefaultBasemap",null),e([y()],Q.prototype,"defaultDevBasemap",void 0),e([m("defaultDevBasemap")],Q.prototype,"readDefaultDevBasemap",null),e([y({type:v})],Q.prototype,"defaultExtent",void 0),e([y()],Q.prototype,"defaultVectorBasemap",void 0),e([m("defaultVectorBasemap")],Q.prototype,"readDefaultVectorBasemap",null),e([y()],Q.prototype,"description",void 0),e([y()],Q.prototype,"devBasemapGalleryGroupQuery",void 0),e([y()],Q.prototype,"eueiEnabled",void 0),e([y({readOnly:!0})],Q.prototype,"extraQuery",null),e([y()],Q.prototype,"featuredGroups",void 0),e([y()],Q.prototype,"featuredItemsGroupQuery",void 0),e([y()],Q.prototype,"galleryTemplatesGroupQuery",void 0),e([y()],Q.prototype,"livingAtlasGroupQuery",void 0),e([y()],Q.prototype,"hasCategorySchema",void 0),e([y()],Q.prototype,"helpBase",void 0),e([y()],Q.prototype,"helperServices",void 0),e([y()],Q.prototype,"helpMap",void 0),e([y()],Q.prototype,"homePageFeaturedContent",void 0),e([y()],Q.prototype,"homePageFeaturedContentCount",void 0),e([y()],Q.prototype,"httpPort",void 0),e([y()],Q.prototype,"httpsPort",void 0),e([y()],Q.prototype,"id",void 0),e([y()],Q.prototype,"ipCntryCode",void 0),e([y({readOnly:!0})],Q.prototype,"isOrganization",null),e([y()],Q.prototype,"isPortal",void 0),e([y()],Q.prototype,"isReadOnly",void 0),e([y({readOnly:!0})],Q.prototype,"itemPageUrl",null),e([y()],Q.prototype,"layerTemplatesGroupQuery",void 0),e([y()],Q.prototype,"maxTokenExpirationMinutes",void 0),e([y({type:Date})],Q.prototype,"modified",void 0),e([y()],Q.prototype,"name",void 0),e([y()],Q.prototype,"portalHostname",void 0),e([y()],Q.prototype,"portalMode",void 0),e([y()],Q.prototype,"portalProperties",void 0),e([y()],Q.prototype,"region",void 0),e([y({readOnly:!0})],Q.prototype,"restUrl",null),e([y()],Q.prototype,"rotatorPanels",void 0),e([y()],Q.prototype,"showHomePageDescription",void 0),e([y()],Q.prototype,"sourceJSON",void 0),e([y()],Q.prototype,"staticImagesUrl",void 0),e([y({json:{name:"2DStylesGroupQuery"}})],Q.prototype,"stylesGroupQuery2d",void 0),e([y({json:{name:"stylesGroupQuery"}})],Q.prototype,"stylesGroupQuery3d",void 0),e([y()],Q.prototype,"supportsHostedServices",void 0),e([y()],Q.prototype,"symbolSetsGroupQuery",void 0),e([y()],Q.prototype,"templatesGroupQuery",void 0),e([y()],Q.prototype,"thumbnail",void 0),e([y({readOnly:!0})],Q.prototype,"thumbnailUrl",null),e([y()],Q.prototype,"units",void 0),e([y()],Q.prototype,"url",void 0),e([y()],Q.prototype,"urlKey",void 0),e([m("urlKey")],Q.prototype,"readUrlKey",null),e([y()],Q.prototype,"user",void 0),e([m("user")],Q.prototype,"readUser",null),e([y()],Q.prototype,"useStandardizedQuery",void 0),e([y()],Q.prototype,"useVectorBasemaps",void 0),e([y()],Q.prototype,"vectorBasemapGalleryGroupQuery",void 0),Q=D=e([f("esri.portal.Portal")],Q);const j=Q,C=new FinalizationRegistry((e=>{e.remove()}));function q(e){const t=r;return()=>{const r=e.deref();r&&t.findCredential(r.restUrl)&&r.signIn().catch((()=>{}))}}export{j as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import{id as r}from"../kernel.js";import o from"../request.js";import s from"../core/Error.js";import{JSONSupportMixin as i}from"../core/JSONSupport.js";import a from"../core/Loadable.js";import{destroyMaybe as l,removeMaybe as u}from"../core/maybe.js";import{throwIfAborted as n,isAborted as p,createAbortError as d,throwIfAbortError as h}from"../core/promiseUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import{ensureType as c}from"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import v from"../geometry/Extent.js";import{getLocale as S}from"../intl/locale.js";import{ensureDefaultPortalInstance as g}from"./portalDefault.js";import P from"./PortalQueryParams.js";import G from"./PortalQueryResult.js";import B from"./PortalUser.js";import{supportsApiKey as O}from"../support/apiKeyUtils.js";var D;let U;const b={PortalGroup:()=>import("./PortalGroup.js"),PortalItem:()=>import("./PortalItem.js"),PortalUser:()=>import("./PortalUser.js")};let Q=D=class extends(i(a)){constructor(e){super(e),this._esriIdCredentialCreateHandle=null,this.access=null,this.allSSL=!1,this.authMode="auto",this.authorizedCrossOriginDomains=null,this.basemapGalleryGroupQuery=null,this.basemapGalleryGroupQuery3D=null,this.bingKey=null,this.canListApps=!1,this.canListData=!1,this.canListPreProvisionedItems=!1,this.canProvisionDirectPurchase=!1,this.canSearchPublic=!0,this.canShareBingPublic=!1,this.canSharePublic=!1,this.canSignInArcGIS=!1,this.canSignInIDP=!1,this.colorSetsGroupQuery=null,this.commentsEnabled=!1,this.created=null,this.culture=null,this.customBaseUrl=null,this.defaultBasemap=null,this.defaultDevBasemap=null,this.defaultExtent=null,this.defaultVectorBasemap=null,this.description=null,this.devBasemapGalleryGroupQuery=null,this.eueiEnabled=null,this.featuredGroups=null,this.featuredItemsGroupQuery=null,this.galleryTemplatesGroupQuery=null,this.livingAtlasGroupQuery=null,this.hasCategorySchema=!1,this.helperServices=null,this.homePageFeaturedContent=null,this.homePageFeaturedContentCount=null,this.httpPort=null,this.httpsPort=null,this.id=null,this.ipCntryCode=null,this.isPortal=!1,this.isReadOnly=!1,this.layerTemplatesGroupQuery=null,this.maxTokenExpirationMinutes=null,this.modified=null,this.name=null,this.portalHostname=null,this.portalMode=null,this.portalProperties=null,this.region=null,this.rotatorPanels=null,this.showHomePageDescription=!1,this.sourceJSON=null,this.supportsHostedServices=!1,this.symbolSetsGroupQuery=null,this.templatesGroupQuery=null,this.units=null,this.url=t.portalUrl,this.urlKey=null,this.user=null,this.use3dBasemaps=!0,this.useStandardizedQuery=!1,this.useVectorBasemaps=!1,this.vectorBasemapGalleryGroupQuery=null}normalizeCtorArgs(e){return"string"==typeof e?{url:e}:e}destroy(){C.unregister(this),this.defaultBasemap=l(this.defaultBasemap),this.defaultDevBasemap=l(this.defaultDevBasemap),this.defaultVectorBasemap=l(this.defaultVectorBasemap),this._esriIdCredentialCreateHandle=u(this._esriIdCredentialCreateHandle)}readAuthorizedCrossOriginDomains(e){if(e)for(const r of e)t.request.trustedServers.includes(r)||t.request.trustedServers.push(r);return e}readDefaultBasemap(e){return this._readBasemap(e)}readDefaultDevBasemap(e){return this._readBasemap(e)}readDefaultVectorBasemap(e){return this._readBasemap(e)}get extraQuery(){const e=!(this.user&&this.user.orgId)||this.canSearchPublic;return this.id&&!e?` AND orgid:${this.id}`:null}get isOrganization(){return!!this.access}get itemPageUrl(){return this.url?`${this.url}/home/item.html`:null}get restUrl(){let e=this.url;if(e){const t=e.indexOf("/sharing");e=t>0?e.substring(0,t):this.url.replace(/\/+$/,""),e+="/sharing/rest"}return e}get thumbnailUrl(){const e=this.restUrl,t=this.thumbnail;return e&&t?this._normalizeSSL(e+"/portals/self/resources/"+t):null}readUrlKey(e){return e?e.toLowerCase():e}readUser(e){let t=null;return e&&(t=B.fromJSON(e),t.portal=this),t}load(e){const t=import("../Basemap.js").then((({default:t})=>{n(e),U=t})).then((()=>this.sourceJSON?this.sourceJSON:this.fetchSelf(this.authMode,!1,e))).then((e=>{if(r){const e=r;this.credential=e.findCredential(this.restUrl),this.credential||this.authMode!==D.AUTH_MODE_AUTO||(this._esriIdCredentialCreateHandle?.remove(),this._esriIdCredentialCreateHandle=e.on("credential-create",q(new WeakRef(this))),C.register(this,this._esriIdCredentialCreateHandle,this))}this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(t),Promise.resolve(this)}async createElevationLayers(){await this.load();const e=this._getHelperService("defaultElevationLayers"),t=(await import("../layers/ElevationLayer.js")).default;return e?e.map((e=>new t({id:e.id,url:e.url}))):[]}async fetchBasemaps(e,t){const r=await this._fetchBasemaps(e,t);if(!0===t?.include3d&&!1!==this.use3dBasemaps){const o=await this._fetchBasemaps3D(e,t);r.unshift(...o)}return r}fetchCategorySchema(e){return this.hasCategorySchema?this.request(this.restUrl+"/portals/self/categorySchema",e).then((e=>e.categorySchema)):p(e)?Promise.reject(d()):Promise.resolve([])}fetchFeaturedGroups(e){const t=this.featuredGroups,r=new P;if(r.num=100,r.sortField="title",t&&t.length){const o=[];for(const e of t)o.push(`(title:"${e.title}" AND owner:${e.owner})`);return r.query=o.join(" OR "),this.queryGroups(r,e).then((e=>e.results))}return p(e)?Promise.reject(d()):Promise.resolve([])}fetchRegions(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/regions",{...e,query:{culture:t}})}fetchSettings(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/self/settings",{...e,query:{culture:t}})}static getDefault(){return g((()=>new D))}queryGroups(e,t){return this.queryPortal("/community/groups",e,"PortalGroup",t)}queryItems(e,t){return this.queryPortal("/search",e,"PortalItem",t)}queryUsers(e,t){return e.sortField||(e.sortField="username"),this.queryPortal("/community/users",e,"PortalUser",t)}fetchSelf(e=this.authMode,t=!1,r){const o=this.restUrl+"/portals/self",s={authMode:e,query:{culture:S().toLowerCase()},...r};return"auto"===s.authMode&&(s.authMode="no-prompt"),t&&(s.query.default=!0),this.request(o,s)}queryPortal(e,t,r,o){const s=c(P,t),i=t=>this.request(this.restUrl+e,{...s.toRequestOptions(this),...o}).then((e=>{const r=s.clone();return r.start=e.nextStart,new G({nextQueryParams:r,queryParams:s,total:e.total,results:D._resultsToTypedArray(t,{portal:this},e,o)})})).then((e=>Promise.all(e.results.map((t=>"function"==typeof t.when?t.when():e))).then((()=>e),(t=>(h(t),e)))));return r&&b[r]?b[r]().then((({default:e})=>(n(o),i(e)))):i()}signIn(){if(this.authMode===D.AUTH_MODE_ANONYMOUS)return Promise.reject(new s("portal:invalid-auth-mode",`Current "authMode"' is "${this.authMode}"`));if("failed"===this.loadStatus)return Promise.reject(this.loadError);const e=e=>Promise.resolve().then((()=>"not-loaded"===this.loadStatus?(e||(this.authMode="immediate"),this.load().then((()=>null))):"loading"===this.loadStatus?this.load().then((()=>this.credential?null:(this.credential=e,this.fetchSelf("immediate")))):this.user&&this.credential===e?null:(this.credential=e,this.fetchSelf("immediate")))).then((e=>{e&&(this.sourceJSON=e,this.read(e))}));return r?r.getCredential(this.restUrl).then((t=>e(t))):e(this.credential)}normalizeUrl(e){const t=this.credential&&this.credential.token;return this._normalizeSSL(t?e+(e.includes("?")?"&":"?")+"token="+t:e)}requestToTypedArray(e,t,r){return this.request(e,t).then((e=>{const t=D._resultsToTypedArray(r,{portal:this},e);return Promise.all(t.map((t=>"function"==typeof t.when?t.when():e))).then((()=>t),(()=>t))}))}request(e,t={}){const r={f:"json",...t.query},{authMode:s=(this.authMode===D.AUTH_MODE_ANONYMOUS?"anonymous":"auto"),body:i=null,cacheBust:a=!1,method:l="auto",responseType:u="json",signal:n}=t,p={authMode:s,body:i,cacheBust:a,method:l,query:r,responseType:u,timeout:0,signal:n};return o(this._normalizeSSL(e),p).then((e=>e.data))}toJSON(){throw new s("internal:not-yet-implemented","Portal.toJSON is not yet implemented")}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new D({sourceJSON:e})}_getHelperService(e){const t=this.helperServices&&this.helperServices[e];if(!t)throw new s("portal:service-not-found",`The \`helperServices\` do not include an entry named "${e}"`);return t}async _fetchBasemaps(e,r){const o=new P;o.query=e||(t.apiKey&&O(this.url)?this.devBasemapGalleryGroupQuery:this.useVectorBasemaps?this.vectorBasemapGalleryGroupQuery:this.basemapGalleryGroupQuery),o.disableExtraQuery=!0;const s=await this.queryGroups(o,r);if(!s.total)return[];const i=s.results[0];o.num=100,o.query='type:"Web Map" -type:"Web Application"',o.sortField=i.sortField||"name",o.sortOrder=i.sortOrder||"desc";const a=await i.queryItems(o,r);if(!a.total)return[];return a.results.filter((e=>"Web Map"===e.type)).map((e=>new U({portalItem:e})))}async _fetchBasemaps3D(e,t){const r=e||this.basemapGalleryGroupQuery3D;if(!r)return[];const o=new P({query:r,disableExtraQuery:!0}),s=await this.queryGroups(o,t);if(!s.total)return[];const i=s.results[0];o.num=100,o.query='type:"Web Scene"',o.sortField=i.sortField||"name",o.sortOrder=i.sortOrder||"desc";const a=await i.queryItems(o,t);if(!a.total)return[];return a.results.filter((e=>"Web Scene"===e.type)).map((e=>new U({portalItem:e})))}_normalizeSSL(e){return e.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(e){if(e){const t=U.fromJSON(e);return t.portalItem={portal:this},t}return null}static _resultsToTypedArray(e,t,r,o){let s=[];if(r){const i=null!=o?o.signal:null;s=r.listings||r.notifications||r.userInvitations||r.tags||r.items||r.groups||r.comments||r.provisions||r.results||r.relatedItems||r,(e||t)&&(s=s.map((r=>{const o=Object.assign(e?e.fromJSON(r):r,t);return"function"==typeof o.load&&o.load(i),o})))}else s=[];return s}};Q.AUTH_MODE_ANONYMOUS="anonymous",Q.AUTH_MODE_AUTO="auto",Q.AUTH_MODE_IMMEDIATE="immediate",e([y()],Q.prototype,"access",void 0),e([y()],Q.prototype,"allSSL",void 0),e([y()],Q.prototype,"authMode",void 0),e([y()],Q.prototype,"authorizedCrossOriginDomains",void 0),e([m("authorizedCrossOriginDomains")],Q.prototype,"readAuthorizedCrossOriginDomains",null),e([y()],Q.prototype,"basemapGalleryGroupQuery",void 0),e([y({json:{name:"3DBasemapGalleryGroupQuery"}})],Q.prototype,"basemapGalleryGroupQuery3D",void 0),e([y()],Q.prototype,"bingKey",void 0),e([y()],Q.prototype,"canListApps",void 0),e([y()],Q.prototype,"canListData",void 0),e([y()],Q.prototype,"canListPreProvisionedItems",void 0),e([y()],Q.prototype,"canProvisionDirectPurchase",void 0),e([y()],Q.prototype,"canSearchPublic",void 0),e([y()],Q.prototype,"canShareBingPublic",void 0),e([y()],Q.prototype,"canSharePublic",void 0),e([y()],Q.prototype,"canSignInArcGIS",void 0),e([y()],Q.prototype,"canSignInIDP",void 0),e([y()],Q.prototype,"colorSetsGroupQuery",void 0),e([y()],Q.prototype,"commentsEnabled",void 0),e([y({type:Date})],Q.prototype,"created",void 0),e([y()],Q.prototype,"credential",void 0),e([y()],Q.prototype,"culture",void 0),e([y()],Q.prototype,"currentVersion",void 0),e([y()],Q.prototype,"customBaseUrl",void 0),e([y()],Q.prototype,"defaultBasemap",void 0),e([m("defaultBasemap")],Q.prototype,"readDefaultBasemap",null),e([y()],Q.prototype,"defaultDevBasemap",void 0),e([m("defaultDevBasemap")],Q.prototype,"readDefaultDevBasemap",null),e([y({type:v})],Q.prototype,"defaultExtent",void 0),e([y()],Q.prototype,"defaultVectorBasemap",void 0),e([m("defaultVectorBasemap")],Q.prototype,"readDefaultVectorBasemap",null),e([y()],Q.prototype,"description",void 0),e([y()],Q.prototype,"devBasemapGalleryGroupQuery",void 0),e([y()],Q.prototype,"eueiEnabled",void 0),e([y({readOnly:!0})],Q.prototype,"extraQuery",null),e([y()],Q.prototype,"featuredGroups",void 0),e([y()],Q.prototype,"featuredItemsGroupQuery",void 0),e([y()],Q.prototype,"galleryTemplatesGroupQuery",void 0),e([y()],Q.prototype,"livingAtlasGroupQuery",void 0),e([y()],Q.prototype,"hasCategorySchema",void 0),e([y()],Q.prototype,"helpBase",void 0),e([y()],Q.prototype,"helperServices",void 0),e([y()],Q.prototype,"helpMap",void 0),e([y()],Q.prototype,"homePageFeaturedContent",void 0),e([y()],Q.prototype,"homePageFeaturedContentCount",void 0),e([y()],Q.prototype,"httpPort",void 0),e([y()],Q.prototype,"httpsPort",void 0),e([y()],Q.prototype,"id",void 0),e([y()],Q.prototype,"ipCntryCode",void 0),e([y({readOnly:!0})],Q.prototype,"isOrganization",null),e([y()],Q.prototype,"isPortal",void 0),e([y()],Q.prototype,"isReadOnly",void 0),e([y({readOnly:!0})],Q.prototype,"itemPageUrl",null),e([y()],Q.prototype,"layerTemplatesGroupQuery",void 0),e([y()],Q.prototype,"maxTokenExpirationMinutes",void 0),e([y({type:Date})],Q.prototype,"modified",void 0),e([y()],Q.prototype,"name",void 0),e([y()],Q.prototype,"portalHostname",void 0),e([y()],Q.prototype,"portalMode",void 0),e([y()],Q.prototype,"portalProperties",void 0),e([y()],Q.prototype,"region",void 0),e([y({readOnly:!0})],Q.prototype,"restUrl",null),e([y()],Q.prototype,"rotatorPanels",void 0),e([y()],Q.prototype,"showHomePageDescription",void 0),e([y()],Q.prototype,"sourceJSON",void 0),e([y()],Q.prototype,"staticImagesUrl",void 0),e([y({json:{name:"2DStylesGroupQuery"}})],Q.prototype,"stylesGroupQuery2d",void 0),e([y({json:{name:"stylesGroupQuery"}})],Q.prototype,"stylesGroupQuery3d",void 0),e([y()],Q.prototype,"supportsHostedServices",void 0),e([y()],Q.prototype,"symbolSetsGroupQuery",void 0),e([y()],Q.prototype,"templatesGroupQuery",void 0),e([y()],Q.prototype,"thumbnail",void 0),e([y({readOnly:!0})],Q.prototype,"thumbnailUrl",null),e([y()],Q.prototype,"units",void 0),e([y()],Q.prototype,"url",void 0),e([y()],Q.prototype,"urlKey",void 0),e([m("urlKey")],Q.prototype,"readUrlKey",null),e([y()],Q.prototype,"user",void 0),e([m("user")],Q.prototype,"readUser",null),e([y()],Q.prototype,"use3dBasemaps",void 0),e([y()],Q.prototype,"useStandardizedQuery",void 0),e([y()],Q.prototype,"useVectorBasemaps",void 0),e([y()],Q.prototype,"vectorBasemapGalleryGroupQuery",void 0),Q=D=e([f("esri.portal.Portal")],Q);const j=Q,C=new FinalizationRegistry((e=>{e.remove()}));function q(e){const t=r;return()=>{const r=e.deref();r&&t.findCredential(r.restUrl)&&r.signIn().catch((()=>{}))}}export{j 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{geometryTypes as t}from"../../geometry.js";import r from"../../Graphic.js";import{JSONMap as o}from"../../core/jsonMap.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{geometryTypes as t}from"../../geometry.js";import r from"../../Graphic.js";import{JSONMap as o}from"../../core/jsonMap.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as n}from"../../core/lang.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{reader as l}from"../../core/accessorSupport/decorators/reader.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import m from"../../geometry/SpatialReference.js";import{fromJSON as c,isPolygon as u}from"../../geometry/support/jsonUtils.js";import y from"../../layers/support/Field.js";var f;const h=new o({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let g=f=class extends s{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){const o=m.fromJSON(t.spatialReference),s=[];for(let n=0;n<e.length;n++){const t=e[n],i=r.fromJSON(t),l=t.geometry&&t.geometry.spatialReference;null==i.geometry||l||(i.geometry.spatialReference=o);const a=t.aggregateGeometries,p=i.aggregateGeometries;if(a&&null!=p)for(const e in p){const t=p[e],r=a[e],s=r?.spatialReference;null==t||s||(t.spatialReference=o)}s.push(i)}return s}writeGeometryType(e,t,r,o){if(e)return void h.write(e,t,r,o);const{features:s}=this;if(s)for(const n of s)if(n&&null!=n.geometry)return void h.write(n.geometry.type,t,r,o)}readQueryGeometry(e,t){if(!e)return null;const r=!!e.spatialReference,o=c(e);return o&&!r&&t.spatialReference&&(o.spatialReference=m.fromJSON(t.spatialReference)),o}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:r}=this;if(r)for(const o of r)if(o&&null!=o.geometry&&o.geometry.spatialReference)return void(t.spatialReference=o.geometry.spatialReference.toJSON())}clone(){return new f(this.cloneProperties())}cloneProperties(){return n({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let r=0;r<t.features.length;r++){const o=t.features[r];if(o.geometry){const t=e&&e[r];o.geometry=t&&t.toJSON()||o.geometry}}return t}quantize(e){const{scale:[t,r],translate:[o,s]}=e,n=e=>Math.round((e-o)/t),i=e=>Math.round((s-e)/r),l=this.features,a=this._getQuantizationFunction(this.geometryType,n,i);for(let p=0,m=l.length;p<m;p++)a?.(l[p].geometry)||(l.splice(p,1),p--,m--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:r}=this;if(!r)return this;const{translate:[o,s],scale:[n,i]}=r,l=e=>e*n+o,a=e=>s-e*i;let p=null,m=null;if(this.hasZ&&null!=r?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=r;p=r=>r*t+e}if(this.hasM&&null!=r?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=r;m=r=>null==r?r:r*t+e}const c=this._getHydrationFunction(e,l,a,p,m);for(const{geometry:u}of t)null!=u&&c&&c(u);return this.transform=null,this}_quantizePoints(e,t,r){let o,s;const n=[];for(let i=0,l=e.length;i<l;i++){const l=e[i];if(i>0){const e=t(l[0]),i=r(l[1]);e===o&&i===s||(n.push([e-o,i-s]),o=e,s=i)}else o=t(l[0]),s=r(l[1]),n.push([o,s])}return n.length>0?n:null}_getQuantizationFunction(e,t,r){return"point"===e?e=>(e.x=t(e.x),e.y=r(e.y),e):"polyline"===e||"polygon"===e?e=>{const o=u(e)?e.rings:e.paths,s=[];for(let n=0,i=o.length;n<i;n++){const e=o[n],i=this._quantizePoints(e,t,r);i&&s.push(i)}return s.length>0?(u(e)?e.rings=s:e.paths=s,e):null}:"multipoint"===e?e=>{const o=this._quantizePoints(e.points,t,r);return o&&o.length>0?(e.points=o,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,r,o,s){return"point"===e?e=>{e.x=t(e.x),e.y=r(e.y),o&&(e.z=o(e.z))}:"polyline"===e||"polygon"===e?e=>{const n=u(e)?e.rings:e.paths;let i,l;for(let o=0,s=n.length;o<s;o++){const e=n[o];for(let o=0,s=e.length;o<s;o++){const s=e[o];o>0?(i+=s[0],l+=s[1]):(i=s[0],l=s[1]),s[0]=t(i),s[1]=r(l)}}if(o&&s)for(let t=0,r=n.length;t<r;t++){const e=n[t];for(let t=0,r=e.length;t<r;t++){const r=e[t];r[2]=o(r[2]),r[3]=s(r[3])}}else if(o)for(let t=0,r=n.length;t<r;t++){const e=n[t];for(let t=0,r=e.length;t<r;t++){const r=e[t];r[2]=o(r[2])}}else if(s)for(let t=0,r=n.length;t<r;t++){const e=n[t];for(let t=0,r=e.length;t<r;t++){const r=e[t];r[2]=s(r[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=r(e.ymin),e.xmax=t(e.xmax),e.ymax=r(e.ymax),o&&null!=e.zmax&&null!=e.zmin&&(e.zmax=o(e.zmax),e.zmin=o(e.zmin)),s&&null!=e.mmax&&null!=e.mmin&&(e.mmax=s(e.mmax),e.mmin=s(e.mmin))}:"multipoint"===e?e=>{const n=e.points;let i,l;for(let o=0,s=n.length;o<s;o++){const e=n[o];o>0?(i+=e[0],l+=e[1]):(i=e[0],l=e[1]),e[0]=t(i),e[1]=r(l)}if(o&&s)for(let t=0,r=n.length;t<r;t++){const e=n[t];e[2]=o(e[2]),e[3]=s(e[3])}else if(o)for(let t=0,r=n.length;t<r;t++){const e=n[t];e[2]=o(e[2])}else if(s)for(let t=0,r=n.length;t<r;t++){const e=n[t];e[2]=s(e[2])}}:null}};e([i({type:String,json:{write:!0}})],g.prototype,"displayFieldName",void 0),e([i({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],g.prototype,"exceededTransferLimit",void 0),e([i({type:[r],json:{write:!0}})],g.prototype,"features",void 0),e([l("features")],g.prototype,"readFeatures",null),e([i({type:[y],json:{write:!0}})],g.prototype,"fields",void 0),e([i({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:h.read}}})],g.prototype,"geometryType",void 0),e([p("geometryType")],g.prototype,"writeGeometryType",null),e([i({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],g.prototype,"hasM",void 0),e([i({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],g.prototype,"hasZ",void 0),e([i({types:t,json:{write:!0}})],g.prototype,"queryGeometry",void 0),e([l("queryGeometry")],g.prototype,"readQueryGeometry",null),e([i({type:m,json:{write:!0}})],g.prototype,"spatialReference",void 0),e([p("spatialReference")],g.prototype,"writeSpatialReference",null),e([i({json:{write:!0}})],g.prototype,"transform",void 0),g=f=e([a("esri.rest.support.FeatureSet")],g),g.prototype.toJSON.isDefaultToJSON=!0;const d=g;export{d as default};
|