@arcgis/core 5.2.0-next.128 → 5.2.0-next.129
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/applications/Components/imageryUtils.js +1 -1
- package/arcade/batchExec.js +1 -1
- package/arcade/geometry/adapters/dehydrated.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/06da350b4ea25732f52b.js +1 -0
- package/assets/esri/core/workers/chunks/{67dcf9b873cb037b2647.js → 081c9ccaa5884c730a91.js} +1 -1
- package/assets/esri/core/workers/chunks/094102031cc77b20db74.js +1 -0
- package/assets/esri/core/workers/chunks/0b85c844af97b2fb0ba8.js +1 -0
- package/assets/esri/core/workers/chunks/{86d7a3ae672a51b75fcc.js → 0d44f793d3b0d33153ac.js} +1 -1
- package/assets/esri/core/workers/chunks/0de140199161fcd15a0c.js +1 -0
- package/assets/esri/core/workers/chunks/0deceece4b465f653f58.js +1 -0
- package/assets/esri/core/workers/chunks/111dc5653daa7f3e1001.js +1 -0
- package/assets/esri/core/workers/chunks/139e3da8ea081e21539e.js +1 -0
- package/assets/esri/core/workers/chunks/142bedebd37d747f84ba.js +1 -0
- package/assets/esri/core/workers/chunks/15dc28b4fa5b5110472b.js +1 -0
- package/assets/esri/core/workers/chunks/{dd02cc18ebebb90778c6.js → 17e2bfc7468c23e43bef.js} +1 -1
- package/assets/esri/core/workers/chunks/196d33f4d8e3a256ad94.js +1 -0
- package/assets/esri/core/workers/chunks/1a02c68de65a67ab6a67.js +1 -0
- package/assets/esri/core/workers/chunks/{4165eb86471ea3bbf364.js → 1aecf7106a21320e054e.js} +1 -1
- package/assets/esri/core/workers/chunks/1bc03b8065cbbbb06c87.js +1 -0
- package/assets/esri/core/workers/chunks/1beb32170d659bc43977.js +1 -0
- package/assets/esri/core/workers/chunks/20ee32fee219afbcfee3.js +1 -0
- package/assets/esri/core/workers/chunks/{9467744cb7d094a5067a.js → 21d2f5324db0b199060c.js} +1 -1
- package/assets/esri/core/workers/chunks/22abb9a74f6594f9db2a.js +1 -0
- package/assets/esri/core/workers/chunks/237795866c075880531b.js +1 -0
- package/assets/esri/core/workers/chunks/25e4da9c6837ab0fa585.js +1 -0
- package/assets/esri/core/workers/chunks/2a5fde737dc99627142e.js +1 -0
- package/assets/esri/core/workers/chunks/3412050ae63ff7dcaf36.js +1 -0
- package/assets/esri/core/workers/chunks/35316724c8d3cc39cf80.js +1 -0
- package/assets/esri/core/workers/chunks/354cc6cd2a56937f1747.js +1 -0
- package/assets/esri/core/workers/chunks/365ae479765ca9e47de4.js +1 -0
- package/assets/esri/core/workers/chunks/{8190fcb1dd10ad20feed.js → 36ef86701883a20dd6f6.js} +1 -1
- package/assets/esri/core/workers/chunks/3759e272a1d43534a190.js +1 -0
- package/assets/esri/core/workers/chunks/397ddcf0b8e858a17b70.js +1 -0
- package/assets/esri/core/workers/chunks/3a7a558e30b5cb81c801.js +1 -0
- package/assets/esri/core/workers/chunks/3c9405d310a1b08c901e.js +1 -0
- package/assets/esri/core/workers/chunks/{e10fe4c77b8dc4492092.js → 3ce53562926b05e71af5.js} +1 -1
- package/assets/esri/core/workers/chunks/3d174a84b785fc633a5a.js +1 -0
- package/assets/esri/core/workers/chunks/3d67fed3e53993c38b58.js +1 -0
- package/assets/esri/core/workers/chunks/42bdeeff55fb1a3f735f.js +1 -0
- package/assets/esri/core/workers/chunks/48f1532520b76fa7f0c2.js +1 -0
- package/assets/esri/core/workers/chunks/{00d9e41deecf5828975c.js → 4adc3822ed9f498f5653.js} +1 -1
- package/assets/esri/core/workers/chunks/{d5f0fed415b5b155d57c.js → 51741ef8225d470716fe.js} +1 -1
- package/assets/esri/core/workers/chunks/5191e481d0e19a7f3888.js +1 -0
- package/assets/esri/core/workers/chunks/{7fcee3a1b900ddc9a5e3.js → 540acf6abdee9dbd453e.js} +1 -1
- package/assets/esri/core/workers/chunks/{d9b63cf111035b05cd2e.js → 5484b89adc53430226d5.js} +1 -1
- package/assets/esri/core/workers/chunks/55361b50ecfc98db2ffb.js +1 -0
- package/assets/esri/core/workers/chunks/58da7c41c1bcef2f4141.js +1 -0
- package/assets/esri/core/workers/chunks/5979bbefb09d132c008f.js +1 -0
- package/assets/esri/core/workers/chunks/{84db05e872dbf35c80a2.js → 5982c6a8459c1237b298.js} +1 -1
- package/assets/esri/core/workers/chunks/{0a20f84b5f004a77a9f9.js → 5abfc4f447b01d6bf287.js} +1 -1
- package/assets/esri/core/workers/chunks/{4c0dba437de0969a5b63.js → 5b9f88194433410bad5b.js} +1 -1
- package/assets/esri/core/workers/chunks/5f794f4e0113d5dd50ba.js +1 -0
- package/assets/esri/core/workers/chunks/62a30692e2a7612bafc1.js +1 -0
- package/assets/esri/core/workers/chunks/62aa7daad4ca7332854e.js +1 -0
- package/assets/esri/core/workers/chunks/66926c3686d5ef2d4692.js +29 -0
- package/assets/esri/core/workers/chunks/6994ba168465b77a36af.js +1 -0
- package/assets/esri/core/workers/chunks/6d0c6fda9100fe89f3cb.js +1 -0
- package/assets/esri/core/workers/chunks/72a898894438f177cd62.js +1 -0
- package/assets/esri/core/workers/chunks/78d4455237120103f639.js +1 -0
- package/assets/esri/core/workers/chunks/7fccf53aa751cd9dae57.js +1 -0
- package/assets/esri/core/workers/chunks/{6267a1fe1603daa399b4.js → 81327e10200065a0ccef.js} +1 -1
- package/assets/esri/core/workers/chunks/84a3fbe5d85a357f4e82.js +1 -0
- package/assets/esri/core/workers/chunks/862479729f2d036f606b.js +1 -0
- package/assets/esri/core/workers/chunks/8a9aa6db11d0f643961c.js +1 -0
- package/assets/esri/core/workers/chunks/8dfea65341991e13ab71.js +1 -0
- package/assets/esri/core/workers/chunks/8e92925043dc49ed1018.js +1 -0
- package/assets/esri/core/workers/chunks/8f0b2b0ca239b01f44d0.js +1 -0
- package/assets/esri/core/workers/chunks/93a89168c18db88f60e7.js +1 -0
- package/assets/esri/core/workers/chunks/991c854a4459c82d4d93.js +1 -0
- package/assets/esri/core/workers/chunks/{f90cad9f007a11154c0d.js → 9b080d07699b56f06c5f.js} +1 -1
- package/assets/esri/core/workers/chunks/9cd69aa3880838a834f8.js +1 -0
- package/assets/esri/core/workers/chunks/{2ca49fb4590cc34a02bd.js → 9d87f38b16dda1ff7978.js} +1 -1
- package/assets/esri/core/workers/chunks/9fd1e5a2c0a261ed2a33.js +1 -0
- package/assets/esri/core/workers/chunks/a189e520da39919cdcca.js +1 -0
- package/assets/esri/core/workers/chunks/a3a5cb664bdb1db190dd.js +1 -0
- package/assets/esri/core/workers/chunks/a63c456ecf018ec06778.js +1 -0
- package/assets/esri/core/workers/chunks/{842f993fa60b410cb613.js → a8322a978e33c7349fdf.js} +1 -1
- package/assets/esri/core/workers/chunks/{f479b4a4cee4bb2e046c.js → aa96eea0899757ab38c7.js} +1 -1
- package/assets/esri/core/workers/chunks/ab0b2a76247dfd56b92d.js +1 -0
- package/assets/esri/core/workers/chunks/ab7337b076d152a8eb9e.js +1 -0
- package/assets/esri/core/workers/chunks/ac0de274853a42d518a1.js +1 -0
- package/assets/esri/core/workers/chunks/ad372e399e20d5a3262d.js +1 -0
- package/assets/esri/core/workers/chunks/ae75b3e5320d03dff64c.js +1 -0
- package/assets/esri/core/workers/chunks/ae98530d5816306216b3.js +1 -0
- package/assets/esri/core/workers/chunks/afc94c4b9bc007fe310f.js +1 -0
- package/assets/esri/core/workers/chunks/afe54923339e957b71b9.js +1 -0
- package/assets/esri/core/workers/chunks/bbcac00362fef5e3956d.js +1 -0
- package/assets/esri/core/workers/chunks/{1302bf9718747cd9fdd9.js → bcee161dd1c4781d1998.js} +1 -1
- package/assets/esri/core/workers/chunks/{d1f54b0079fb71a15612.js → bd231bc0624eb889ac14.js} +1 -1
- package/assets/esri/core/workers/chunks/c0075715fbe7bec10fc3.js +1 -0
- package/assets/esri/core/workers/chunks/c4e1e864fb8c119b2520.js +1 -0
- package/assets/esri/core/workers/chunks/c93cedf9e53da5aaa35b.js +1 -0
- package/assets/esri/core/workers/chunks/{2d592c935571de80a2e2.js → c9690810b198a97bc16d.js} +1 -1
- package/assets/esri/core/workers/chunks/cada517cc25fa37f778c.js +1 -0
- package/assets/esri/core/workers/chunks/cd1821bf601949674e02.js +1 -0
- package/assets/esri/core/workers/chunks/{1b42d163ef22e3565bb7.js → cf7b7e54cd87422ca62a.js} +1 -1
- package/assets/esri/core/workers/chunks/d195c57fc6de3560653d.js +1 -0
- package/assets/esri/core/workers/chunks/d7f830a06ded11f2fc80.js +1 -0
- package/assets/esri/core/workers/chunks/d877783815afd21dbe98.js +1 -0
- package/assets/esri/core/workers/chunks/db5181fcea96cc2ede3e.js +1 -0
- package/assets/esri/core/workers/chunks/{6e8187a77846239ed112.js → de28a86775235bd5d3c4.js} +2 -2
- package/assets/esri/core/workers/chunks/df6992416cba9539f1ed.js +1 -0
- package/assets/esri/core/workers/chunks/e4005d95a396e1af9ac2.js +1 -0
- package/assets/esri/core/workers/chunks/{668ec0bdfb2095e90c9e.js → e495697860f7207da4c7.js} +1 -1
- package/assets/esri/core/workers/chunks/f163502c513205c892e7.js +1 -0
- package/assets/esri/core/workers/chunks/f287ec0fcb611f82ebb0.js +1 -0
- package/assets/esri/core/workers/chunks/{37ae52c71bf9c70fbb92.js → f2d45d15d0ba2537a4eb.js} +1 -1
- package/assets/esri/core/workers/chunks/{d507d7d7a7282fc38e8d.js → f652d1db26fbdea1a79b.js} +1 -1
- package/assets/esri/core/workers/chunks/f6b38ed75baae198c19b.js +1 -0
- package/assets/esri/core/workers/chunks/{168b45c5d8233f23793e.js → f6cfc901267a229de7a1.js} +2 -2
- package/assets/esri/core/workers/chunks/f6d04d14323b926f1025.js +1 -0
- package/assets/esri/core/workers/chunks/f7ab606be37373312ebe.js +1 -0
- package/assets/esri/core/workers/chunks/{3b7dff15a0058ea29886.js → f92178ac6dc9abff304f.js} +1 -1
- package/assets/esri/core/workers/chunks/fc39593febef74a036f1.js +1 -0
- package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +7 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ar.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.bg.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.bs.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ca.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.cs.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.da.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.de.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.el.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.es.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.et.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.fi.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.fr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.he.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.hr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.hu.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.id.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.it.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ja.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ko.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.lt.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.lv.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.nl.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.no.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.pl.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ro.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.ru.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.sk.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.sl.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.sr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.sv.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.th.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.tr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.uk.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.vi.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/messages.zh-TW.json +1 -1
- package/chunks/batchExec.js +2 -0
- package/config.js +1 -1
- package/geometry/support/intersects.js +1 -1
- package/geometry/support/intersectsBase.js +1 -1
- package/kernel.js +1 -1
- package/layers/GeospatialPDFLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/graphics/hydrateGeometryJSON.js +2 -0
- package/layers/graphics/hydratedFeatures.js +1 -1
- package/layers/graphics/hydratedSpatialReference.js +2 -0
- package/layers/raster/datasets/DBFParser.js +1 -1
- package/layers/raster/datasets/ImageAuxRaster.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/layers/raster/formats/JpgPlus.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/formats/Raw.js +1 -1
- package/layers/support/arcadeUtils.js +1 -1
- package/package.json +3 -3
- package/popup/FeatureContent.js +1 -1
- package/popup/FeatureContentCollection.d.ts +2 -0
- package/popup/FeatureContentCollection.js +1 -1
- package/popup/support/featureUtils.js +1 -1
- package/rest/imageService.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/loadArcade.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/engine/vectorTiles/GeometryUtils.js +1 -1
- package/views/2d/engine/vectorTiles/TileManager.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileFeatureIndex.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/SymbolRepository.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/util.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleLayer.js +1 -1
- package/views/2d/layerViewModuleImportUtils.js +1 -1
- package/views/2d/layers/GeospatialPDFLayerView2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/features/schema/processor/MatcherSchema.js +1 -1
- package/views/2d/layers/graphics/GraphicStore.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/2d/support/hitTestUtils.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/layers/GeospatialPDFLayerView3D.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/DOMContainer.d.ts +18 -8
- package/views/VideoView.d.ts +38 -0
- package/views/VideoView.js +1 -1
- package/views/View.d.ts +20 -2
- package/views/View.js +1 -1
- package/views/input/types.d.ts +19 -6
- package/views/interactive/dragEventPipeline.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/assets/esri/core/workers/chunks/025da54eef112d7e8f66.js +0 -1
- package/assets/esri/core/workers/chunks/02f94f9d704f03ddb5c6.js +0 -1
- package/assets/esri/core/workers/chunks/038d2b80d96237c25b6f.js +0 -1
- package/assets/esri/core/workers/chunks/04d4cd66485b622403d0.js +0 -1
- package/assets/esri/core/workers/chunks/05afa8c2b5929ce0545a.js +0 -1
- package/assets/esri/core/workers/chunks/09676cfa99b90fe0cc63.js +0 -1
- package/assets/esri/core/workers/chunks/0aadee0437fa061e4ff5.js +0 -1
- package/assets/esri/core/workers/chunks/0ccd4200c5a2a5de6e16.js +0 -1
- package/assets/esri/core/workers/chunks/1262918b2161d79851c0.js +0 -1
- package/assets/esri/core/workers/chunks/1406a884241809b62bff.js +0 -1
- package/assets/esri/core/workers/chunks/1c33aa349beea9a3792f.js +0 -1
- package/assets/esri/core/workers/chunks/1f135269aea3931e11b2.js +0 -1
- package/assets/esri/core/workers/chunks/24014f3701c31ee74bc2.js +0 -1
- package/assets/esri/core/workers/chunks/25a2e02677a74834c8b5.js +0 -1
- package/assets/esri/core/workers/chunks/2afce71e8b6ae86e0792.js +0 -1
- package/assets/esri/core/workers/chunks/2c7bb5c9751524687002.js +0 -1
- package/assets/esri/core/workers/chunks/2ebad7e588b26e74cefe.js +0 -1
- package/assets/esri/core/workers/chunks/319434415d2c0561bc59.js +0 -1
- package/assets/esri/core/workers/chunks/39d71e83261bff46f6bf.js +0 -1
- package/assets/esri/core/workers/chunks/3aceedec9abfb2fdfa18.js +0 -1
- package/assets/esri/core/workers/chunks/3c6ee445e49da0076ac1.js +0 -1
- package/assets/esri/core/workers/chunks/3f045f09ac95e7f22a97.js +0 -1
- package/assets/esri/core/workers/chunks/4327d2c39a660bd89da7.js +0 -1
- package/assets/esri/core/workers/chunks/462fd57af8ed7921d6ba.js +0 -1
- package/assets/esri/core/workers/chunks/474d9541d387b31ad275.js +0 -1
- package/assets/esri/core/workers/chunks/48a2f68e06a2e90b77d0.js +0 -1
- package/assets/esri/core/workers/chunks/4a73f73f1698fad2df20.js +0 -1
- package/assets/esri/core/workers/chunks/4f464047c6f6c9486efd.js +0 -1
- package/assets/esri/core/workers/chunks/500f6d6f0ffa235cae85.js +0 -1
- package/assets/esri/core/workers/chunks/526cc64ae46dec3fbeda.js +0 -1
- package/assets/esri/core/workers/chunks/550d4df0732352fa48b5.js +0 -1
- package/assets/esri/core/workers/chunks/581285e4d7bbe1b7c27a.js +0 -1
- package/assets/esri/core/workers/chunks/58fb92775d668cfd295c.js +0 -1
- package/assets/esri/core/workers/chunks/5adf2792416b22cd602f.js +0 -1
- package/assets/esri/core/workers/chunks/5aee7739afb5160d4ace.js +0 -1
- package/assets/esri/core/workers/chunks/6006bd8a5ed945fa2776.js +0 -1
- package/assets/esri/core/workers/chunks/606cca69eaea84bfcdc6.js +0 -1
- package/assets/esri/core/workers/chunks/64ee22134fda2f09c094.js +0 -1
- package/assets/esri/core/workers/chunks/66ef6c034455abd61f39.js +0 -1
- package/assets/esri/core/workers/chunks/67678054342178b601cf.js +0 -1
- package/assets/esri/core/workers/chunks/67fd2cdb2e6834bfa710.js +0 -1
- package/assets/esri/core/workers/chunks/6c82cbcd504c711a7450.js +0 -1
- package/assets/esri/core/workers/chunks/75294f515c7f8393181c.js +0 -1
- package/assets/esri/core/workers/chunks/75879ae88fd87b089a87.js +0 -1
- package/assets/esri/core/workers/chunks/761ea719ec1b4d562db2.js +0 -1
- package/assets/esri/core/workers/chunks/78085f804969c9282700.js +0 -1
- package/assets/esri/core/workers/chunks/7d6da4e89aa951e6523f.js +0 -1
- package/assets/esri/core/workers/chunks/80f16f5f15518013f7d0.js +0 -1
- package/assets/esri/core/workers/chunks/8465e2c7221125fd3cc4.js +0 -1
- package/assets/esri/core/workers/chunks/87aaed3dfa903bdf853c.js +0 -1
- package/assets/esri/core/workers/chunks/892dc038d569cffd26dc.js +0 -1
- package/assets/esri/core/workers/chunks/8a842cde240aef12e417.js +0 -1
- package/assets/esri/core/workers/chunks/8f1c5f5e70d4b33d021d.js +0 -1
- package/assets/esri/core/workers/chunks/9020bd7a0e488d55ef14.js +0 -1
- package/assets/esri/core/workers/chunks/92509dd25996c6390a31.js +0 -1
- package/assets/esri/core/workers/chunks/9ccc2c8f7416943cc373.js +0 -29
- package/assets/esri/core/workers/chunks/9d6a96e4c7ccedcb0c13.js +0 -1
- package/assets/esri/core/workers/chunks/9ec04faad97be55309b8.js +0 -1
- package/assets/esri/core/workers/chunks/a08385ebf1715414c1a6.js +0 -1
- package/assets/esri/core/workers/chunks/a3a33ffa34f4d645ddfe.js +0 -1
- package/assets/esri/core/workers/chunks/b396c4b4bb144200acc7.js +0 -1
- package/assets/esri/core/workers/chunks/b9c834e3c0701e9b14a2.js +0 -1
- package/assets/esri/core/workers/chunks/bbfb80a6983574007ce5.js +0 -1
- package/assets/esri/core/workers/chunks/bcf2e5cf6b9c6d0442bb.js +0 -1
- package/assets/esri/core/workers/chunks/c35e9dee87937f483a3d.js +0 -1
- package/assets/esri/core/workers/chunks/c5b733c3a5b2680042a2.js +0 -1
- package/assets/esri/core/workers/chunks/cbeba973ef5593ffbba3.js +0 -1
- package/assets/esri/core/workers/chunks/ccaeabc3be07f3c96f50.js +0 -1
- package/assets/esri/core/workers/chunks/d25fb32a233d2128afbe.js +0 -1
- package/assets/esri/core/workers/chunks/d5ef269ab0ee3744b05d.js +0 -1
- package/assets/esri/core/workers/chunks/d94a2b3b2ef49af9c2e3.js +0 -1
- package/assets/esri/core/workers/chunks/dc92710a8fdfb9135e55.js +0 -1
- package/assets/esri/core/workers/chunks/dd4ecf81250cc001d040.js +0 -1
- package/assets/esri/core/workers/chunks/e0894a308c84d5c158b0.js +0 -1
- package/assets/esri/core/workers/chunks/e4016ae9cb8f16e3efc3.js +0 -1
- package/assets/esri/core/workers/chunks/e6a4cef0af9be30ffe3d.js +0 -1
- package/assets/esri/core/workers/chunks/eaa7cb3ffa8c11706a09.js +0 -1
- package/assets/esri/core/workers/chunks/ed31ec586b754241474d.js +0 -1
- package/assets/esri/core/workers/chunks/ef6e52f9b656751eebaf.js +0 -1
- package/assets/esri/core/workers/chunks/f2fca9a3a40170996ea2.js +0 -1
- package/assets/esri/core/workers/chunks/f5d06cd6d30a5f742f73.js +0 -1
- package/assets/esri/core/workers/chunks/f71ec8a260405ed07958.js +0 -1
- package/assets/esri/core/workers/chunks/f91cab9904020cf25d50.js +0 -1
- package/assets/esri/core/workers/chunks/fb11ff3f2eae5f072560.js +0 -1
- package/assets/esri/core/workers/chunks/ff0e9f8d323eb1729650.js +0 -1
- /package/assets/esri/core/workers/chunks/{6e8187a77846239ed112.js.LICENSE.txt → de28a86775235bd5d3c4.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{168b45c5d8233f23793e.js.LICENSE.txt → f6cfc901267a229de7a1.js.LICENSE.txt} +0 -0
package/views/DOMContainer.d.ts
CHANGED
|
@@ -20,12 +20,13 @@ export interface DOMContainerProperties extends Partial<Pick<DOMContainer, "aria
|
|
|
20
20
|
*/
|
|
21
21
|
container?: HTMLDivElement | string | null;
|
|
22
22
|
/**
|
|
23
|
-
* Indicates whether the focus region
|
|
24
|
-
*
|
|
25
|
-
* Set this property to `true` to show the centered focus region once the view is ready, or `false` to hide it.
|
|
23
|
+
* Indicates whether the [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion) is enabled. Set this property to `true` to show the centered focus region, or `false` to hide it.
|
|
24
|
+
* The focus region can also be enabled/disabled by pressing the `Shift` + `Alt`/`Option` + `O` keyboard shortcut when the view is in focus.
|
|
26
25
|
*
|
|
27
26
|
* @default false
|
|
28
27
|
* @since 5.2
|
|
28
|
+
* @see [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion)
|
|
29
|
+
* @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
|
|
29
30
|
*/
|
|
30
31
|
focusRegionEnabled?: boolean;
|
|
31
32
|
/**
|
|
@@ -116,20 +117,29 @@ export abstract class DOMContainer {
|
|
|
116
117
|
*/
|
|
117
118
|
get focused(): boolean;
|
|
118
119
|
/**
|
|
119
|
-
* The screen rectangle
|
|
120
|
+
* The screen rectangle of the active focus region, or `null` when [focusRegionEnabled](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionEnabled) is `false`.
|
|
121
|
+
* This screen rectangle represents the area of the view that is currently in focus and can be used with methods that require a screen rectangle as input, such as `hitTest()`.
|
|
122
|
+
*
|
|
123
|
+
* | Action | Keyboard Shortcut / Property |
|
|
124
|
+
* |--------|----------------------------|
|
|
125
|
+
* | Enable or disable focus region | Use the `Shift` + `Alt`/`Option` + `O` keyboard shortcut while the view component is in focus or set the [focusRegionEnabled](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionEnabled) property to `true` or `false`. |
|
|
126
|
+
* | Resize focus region | Use the `Shift` + `Alt`/`Option` + Up/Down arrow keys while the focus region is enabled. |
|
|
120
127
|
*
|
|
121
|
-
*
|
|
128
|
+
* To know when this focus region is selected, listen for the [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select) event.
|
|
122
129
|
*
|
|
123
130
|
* @since 5.2
|
|
131
|
+
* @see [focusRegionEnabled](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionEnabled)
|
|
132
|
+
* @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
|
|
124
133
|
*/
|
|
125
134
|
get focusRegion(): ScreenRect | null;
|
|
126
135
|
/**
|
|
127
|
-
* Indicates whether the focus region
|
|
128
|
-
*
|
|
129
|
-
* Set this property to `true` to show the centered focus region once the view is ready, or `false` to hide it.
|
|
136
|
+
* Indicates whether the [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion) is enabled. Set this property to `true` to show the centered focus region, or `false` to hide it.
|
|
137
|
+
* The focus region can also be enabled/disabled by pressing the `Shift` + `Alt`/`Option` + `O` keyboard shortcut when the view is in focus.
|
|
130
138
|
*
|
|
131
139
|
* @default false
|
|
132
140
|
* @since 5.2
|
|
141
|
+
* @see [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion)
|
|
142
|
+
* @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
|
|
133
143
|
*/
|
|
134
144
|
accessor focusRegionEnabled: boolean;
|
|
135
145
|
/**
|
package/views/VideoView.d.ts
CHANGED
|
@@ -5,11 +5,22 @@ import type VideoLayer from "../layers/VideoLayer.js";
|
|
|
5
5
|
import type Navigation from "./navigation/Navigation.js";
|
|
6
6
|
import type { EventedMixin } from "../core/Evented.js";
|
|
7
7
|
import type { EsriPromiseMixin } from "../core/Promise.js";
|
|
8
|
+
import type { ScreenRect } from "../core/types.js";
|
|
8
9
|
import type { DOMContainer, DOMContainerProperties } from "./DOMContainer.js";
|
|
9
10
|
import type { Viewport2DMixin } from "./Viewport2DMixin.js";
|
|
10
11
|
import type { NavigationProperties } from "./navigation/Navigation.js";
|
|
11
12
|
|
|
12
13
|
export interface VideoViewProperties extends DOMContainerProperties, Partial<Pick<VideoView, "layer" | "map" | "operationalDataVisible" | "scale">> {
|
|
14
|
+
/**
|
|
15
|
+
* Indicates whether the [DOMContainer.focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion) is enabled. Set this property to `true` to show the centered focus region, or `false` to hide it.
|
|
16
|
+
* The focus region can also be enabled/disabled by pressing the `Shift` + `Alt`/`Option` + `O` keyboard shortcut when the view is in focus.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
* @since 5.2
|
|
20
|
+
* @see [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion)
|
|
21
|
+
* @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
|
|
22
|
+
*/
|
|
23
|
+
focusRegionEnabled?: boolean;
|
|
13
24
|
/**
|
|
14
25
|
* Options to configure the navigation behavior of the View.
|
|
15
26
|
*
|
|
@@ -58,6 +69,33 @@ export interface VideoViewProperties extends DOMContainerProperties, Partial<Pic
|
|
|
58
69
|
*/
|
|
59
70
|
export default class VideoView extends VideoViewSuperclass {
|
|
60
71
|
constructor(properties?: VideoViewProperties);
|
|
72
|
+
/**
|
|
73
|
+
* The screen rectangle of the active focus region, or `null` when [DOMContainer.focusRegionEnabled](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionEnabled) is `false`.
|
|
74
|
+
* This screen rectangle represents the area of the view that is currently in focus and can be used with methods that require a screen rectangle as input, such as `hitTest()`.
|
|
75
|
+
*
|
|
76
|
+
* | Action | Keyboard Shortcut / Property |
|
|
77
|
+
* |--------|----------------------------|
|
|
78
|
+
* | Enable or disable focus region | Use the `Shift` + `Alt`/`Option` + `O` keyboard shortcut while the view component is in focus or set the [DOMContainer.focusRegionEnabled](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionEnabled) property to `true` or `false`. |
|
|
79
|
+
* | Resize focus region | Use the `Shift` + `Alt`/`Option` + Up/Down arrow keys while the focus region is enabled. |
|
|
80
|
+
*
|
|
81
|
+
* To know when this focus region is selected, listen for the [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select) event.
|
|
82
|
+
*
|
|
83
|
+
* @internal
|
|
84
|
+
* @since 5.2
|
|
85
|
+
* @see [focusRegionEnabled](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegionEnabled)
|
|
86
|
+
* @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
|
|
87
|
+
*/
|
|
88
|
+
get focusRegion(): ScreenRect | null;
|
|
89
|
+
/**
|
|
90
|
+
* Indicates whether the [DOMContainer.focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion) is enabled. Set this property to `true` to show the centered focus region, or `false` to hide it.
|
|
91
|
+
* The focus region can also be enabled/disabled by pressing the `Shift` + `Alt`/`Option` + `O` keyboard shortcut when the view is in focus.
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
* @since 5.2
|
|
95
|
+
* @see [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion)
|
|
96
|
+
* @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
|
|
97
|
+
*/
|
|
98
|
+
accessor focusRegionEnabled: boolean;
|
|
61
99
|
/** The [VideoLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/VideoLayer/) to display in the view. */
|
|
62
100
|
accessor layer: VideoLayer | null | undefined;
|
|
63
101
|
/** A reference to the associated [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/) or [WebMap](https://developers.arcgis.com/javascript/latest/references/core/WebMap/). */
|
package/views/VideoView.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import{EventedMixin as o}from"../core/Evented.js";import{destroyMaybe as r}from"../core/maybe.js";import{EsriPromiseMixin as a}from"../core/Promise.js";import{watch as n,syncAndInitial as l,whenOnce as p,when as h}from"../core/reactiveUtils.js";import{property as d,cast as m,subclass as c}from"../core/accessorSupport/decorators.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import{create as y,fromValues as u}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import f from"../geometry/Extent.js";import w from"../geometry/Point.js";import v from"../geometry/SpatialReference.js";import{projectLoad as j,projectExecute as _}from"../geometry/operators/projectOperator.js";import b from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as C}from"../layers/support/MediaElementView.js";import S from"../layers/support/TileInfo.js";import V from"../layers/support/VideoElement.js";import{DOMContainer as M}from"./DOMContainer.js";import{Viewport2DBaseMixin as x}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as R}from"./Viewport2DMixin.js";import D from"./2d/AnimationManager.js";import z from"./2d/MapViewConstraints.js";import"./2d/engine/Stage.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"../core/RandomLCG.js";import"../core/has.js";import"../core/Logger.js";import"./2d/engine/transitions/FadeTransition.js";import"./webgl/BufferObject.js";import"./webgl/FramebufferObject.js";import"./webgl/Program.js";import"./webgl/Renderbuffer.js";import"./webgl/Texture.js";import"./webgl/enums.js";import"./webgl/Util.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import{Container as P}from"./2d/engine/Container.js";import"./2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"../geometry/Polygon.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"./webgl/UniformBufferLayout.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtils.js";import"./2d/layers/support/util.js";import T from"./2d/navigation/MapViewNavigation.js";import"../request.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"../core/mathUtils.js";import"../core/urlUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/units.js";import"../geometry/ellipsoidUtils.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polyline.js";import"../geometry/spatialReferenceEllipsoidUtils.js";import"../geometry/operators/support/GeographicTransformation.js";import"../geometry/projection/projectors.js";import"../geometry/support/spatialReferenceUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import"../geometry/support/Ellipsoid.js";import{ViewStateManager as E}from"./2d/ViewStateManager.js";import G from"./2d/engine/webgl/Overlay.js";import O from"./2d/engine/webgl/OverlayContainer.js";import q from"./navigation/Navigation.js";import U from"./ui/DefaultUI.js";import H from"./ui/video/DefaultUIVideo.js";const F=new t("#000");let k;async function A(){const[,{ParentStage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);k=e}const I=.01,L=["feature","geojson","csv","stream","ogc-feature","catalog","wfs","parquet","graphics","group"];let N=class extends(R(x(M(o(a(s)))))){constructor(e){super(e),this._isValid=!1,this._readyCycleForced=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.map=null,this.navigation=new q,this.ready=!1,this.spatialReference=new v({wkid:0}),this.stateManager=new E({constraints:new z({view:this,minScale:1,maxScale:I})}),this.type="2d",this.ui=new H,this.view2dType="video",this.addHandles([n(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),n(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),n(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),n(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},l)])}initialize(){this._prevZoomEnabled="zoom"===this.navigation.actionMap.mouseWheel&&this.ui.components.includes("zoom"),this._prevRotationEnabled="rotate"===this.navigation.actionMap.dragSecondary&&this.ui.components.includes("compass"),this.addHandles([n(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?"none":"zoom",this.navigation.actionMap.dragPrimary=this.operationalDataVisible?"none":"pan",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"zoom"!==e):[...new Set([...this.ui.components,"zoom"])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?"none":"rotate",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"compass"!==e):[...new Set([...this.ui.components,"compass"])])))},l)]),this.addResolvingPromise(A().then(()=>(this._isValid=!0,p(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=r(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get layer(){return this._get("layer")}set layer(e){e!==this._get("layer")&&(this.constructed&&!this.destroyed&&(this._forceReadyCycle(),this.addResolvingPromise(p(()=>this.ready))),this._set("layer",e))}get preconditionsReady(){return!(!this._isValid||this._readyCycleForced||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,o=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,o]:o<=t?[e,o]:[s,t]:i>=1?o<=t?[e,o]:[s,t]:s<=e?[s,t]:[e,o]}async hitTest(e,t){if(!this._operationalDataView||!this._operationalDataView.ready)return{screenPoint:e,results:[]};const i=this._operationalDataView.videoToMap(e);if(!i)return{screenPoint:e,results:[]};const s=this._operationalDataView.state.toScreen(y(),i);return this._operationalDataView.hitTest({x:s[0],y:s[1]},t)}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);const t={renderingOptions:this.renderingOptions,backgroundColor:F,groundControlPoints:()=>this._groundControlPoints(),getSize:()=>this.videoSize},i=new k(this._getOrCreateRenderCanvas(),t);this.stage=i,this._prepareStage(this.stage),this.childStage=i.childStage,this._prepareChildStage(this.childStage);const s=new D({view:this});this._set("animationManager",s);const o=new T({view:this,animationManager:s});this._set("mapViewNavigation",o),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.frameTask?.stop(),this.stationaryManager?.clear(),this.stage?.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer?.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager?.ready&&this.stateManager.teardown()}_getViewpoint(){return new i({targetGeometry:new w({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([n(()=>this.stationary,t=>e.stationary=t,l),n(()=>this.state.id,()=>e.state=this.state,l),n(()=>this.renderingOptions,t=>e.renderingOptions=t,l)],"video-view"),this._extent=new f({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new C({element:new V({video:this.layer?.videoElement,georeference:new b({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new G(this._videoElementView);this._overlayContainer=new O,this._overlayContainer.addChild(t),this._effectsContainer=new P,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);const i=document.createElement("div");i.classList.add("esri-video-poster"),this.container?.classList.add("esri-video-view"),this.container?.appendChild(i)}_prepareChildStage(e){this.addHandles([n(()=>this.map,async t=>{if(!t)return;const{default:i}=await(import("./video/VideoOperationalDataView.js"));this._operationalDataView=new i({stage:e,layerViewFilter:e=>new Set(L).has(e.type),width:this.size[0],height:this.size[1],map:t,groundControlPoints:()=>this._groundControlPoints(),getVideoResolution:()=>u(this.layer?.videoWidth||0,this.layer?.videoHeight||0),getSize:()=>this.size}),p(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},l),n(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;const t=this.layer.groundControlPoints,i=t?.length;if(!i)return;await j();const s=new Array(i),o=e.state.spatialReference;for(let e=0;e<i;e++){const{lat:i,lon:r}=t[e];s[e]=_(new w(r,i),o)}let r=1/0,a=1/0,n=-1/0,l=-1/0;for(const e of s)r=Math.min(r,e.x),a=Math.min(a,e.y),n=Math.max(n,e.x),l=Math.max(l,e.y);const p=f.fromJSON({xmin:r,ymin:a,xmax:n,ymax:l,spatialReference:o});await(this._operationalDataView?.goTo(p,{animate:!1}).catch(()=>{}))},l)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let o=t;o>I;o/=2)i.push(o);i.push(I);const{lods:s}=S.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,o=i*e.scale/2,r=e.targetGeometry.clone();return r.x=Math.max(s,Math.min(t-s,r.x)),r.y=Math.max(o,Math.min(i-o,r.y)),e.targetGeometry=r,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}_forceReadyCycle(){this.ready&&(h(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}_groundControlPoints(){return this.layer?.groundControlPoints}};e([d()],N.prototype,"_overlayContainer",void 0),e([d()],N.prototype,"_isValid",void 0),e([d()],N.prototype,"_readyCycleForced",void 0),e([d()],N.prototype,"_effectsContainer",void 0),e([d()],N.prototype,"constraintsInfo",null),e([d()],N.prototype,"operationalDataVisible",void 0),e([d()],N.prototype,"layer",null),e([d()],N.prototype,"map",void 0),e([d({type:q,nonNullable:!0})],N.prototype,"navigation",void 0),e([d({readOnly:!0})],N.prototype,"preconditionsReady",null),e([d({readOnly:!0})],N.prototype,"ready",void 0),e([d({readOnly:!0})],N.prototype,"rendering",null),e([d()],N.prototype,"scale",null),e([d()],N.prototype,"spatialReference",void 0),e([d()],N.prototype,"stateManager",void 0),e([d()],N.prototype,"type",void 0),e([d(),m(e=>e instanceof U?e:g(H,e))],N.prototype,"ui",void 0),e([d({readOnly:!0})],N.prototype,"videoSize",null),e([d({readOnly:!0})],N.prototype,"view2dType",void 0),N=e([c("esri.views.VideoView")],N);const W=N;export{W as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import{EventedMixin as o}from"../core/Evented.js";import{destroyMaybe as r}from"../core/maybe.js";import{EsriPromiseMixin as a}from"../core/Promise.js";import{watch as n,syncAndInitial as l,whenOnce as p,when as h}from"../core/reactiveUtils.js";import{property as d,cast as m,subclass as c}from"../core/accessorSupport/decorators.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import{create as y,fromValues as u}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import f from"../geometry/Extent.js";import w from"../geometry/Point.js";import v from"../geometry/SpatialReference.js";import{projectLoad as j,projectExecute as _}from"../geometry/operators/projectOperator.js";import b from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as C}from"../layers/support/MediaElementView.js";import S from"../layers/support/TileInfo.js";import V from"../layers/support/VideoElement.js";import{DOMContainer as M}from"./DOMContainer.js";import{Viewport2DBaseMixin as x}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as R}from"./Viewport2DMixin.js";import D from"./2d/AnimationManager.js";import z from"./2d/MapViewConstraints.js";import"./2d/engine/Stage.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"../core/RandomLCG.js";import"../core/has.js";import"../core/Logger.js";import"./2d/engine/transitions/FadeTransition.js";import"./webgl/BufferObject.js";import"./webgl/FramebufferObject.js";import"./webgl/Program.js";import"./webgl/Renderbuffer.js";import"./webgl/Texture.js";import"./webgl/enums.js";import"./webgl/Util.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import{Container as P}from"./2d/engine/Container.js";import"./2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"../geometry/Polygon.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"./webgl/UniformBufferLayout.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtils.js";import"./2d/layers/support/util.js";import T from"./2d/navigation/MapViewNavigation.js";import"../request.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"../core/mathUtils.js";import"../core/urlUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/units.js";import"../geometry/ellipsoidUtils.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polyline.js";import"../geometry/spatialReferenceEllipsoidUtils.js";import"../geometry/operators/support/GeographicTransformation.js";import"../geometry/projection/projectors.js";import"../geometry/support/spatialReferenceUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import"../geometry/support/Ellipsoid.js";import{ViewStateManager as E}from"./2d/ViewStateManager.js";import G from"./2d/engine/webgl/Overlay.js";import O from"./2d/engine/webgl/OverlayContainer.js";import q from"./navigation/Navigation.js";import U from"./ui/DefaultUI.js";import H from"./ui/video/DefaultUIVideo.js";const F=new t("#000");let k;async function A(){const[,{ParentStage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);k=e}const I=.01,L=["feature","geojson","csv","stream","ogc-feature","catalog","wfs","parquet","graphics","group"];let N=class extends(R(x(M(o(a(s)))))){constructor(e){super(e),this._isValid=!1,this._readyCycleForced=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.map=null,this.navigation=new q,this.ready=!1,this.spatialReference=new v({wkid:0}),this.stateManager=new E({constraints:new z({view:this,minScale:1,maxScale:I})}),this.type="2d",this.ui=new H,this.view2dType="video",this.addHandles([n(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),n(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),n(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),n(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},l)])}initialize(){this._prevZoomEnabled="zoom"===this.navigation.actionMap.mouseWheel&&this.ui.components.includes("zoom"),this._prevRotationEnabled="rotate"===this.navigation.actionMap.dragSecondary&&this.ui.components.includes("compass"),this.addHandles([n(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?"none":"zoom",this.navigation.actionMap.dragPrimary=this.operationalDataVisible?"none":"pan",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"zoom"!==e):[...new Set([...this.ui.components,"zoom"])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?"none":"rotate",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"compass"!==e):[...new Set([...this.ui.components,"compass"])])))},l)]),this.addResolvingPromise(A().then(()=>(this._isValid=!0,p(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=r(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get focusRegion(){return super.focusRegion}get layer(){return this._get("layer")}set layer(e){e!==this._get("layer")&&(this.constructed&&!this.destroyed&&(this._forceReadyCycle(),this.addResolvingPromise(p(()=>this.ready))),this._set("layer",e))}get preconditionsReady(){return!(!this._isValid||this._readyCycleForced||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,o=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,o]:o<=t?[e,o]:[s,t]:i>=1?o<=t?[e,o]:[s,t]:s<=e?[s,t]:[e,o]}async hitTest(e,t){if(!this._operationalDataView||!this._operationalDataView.ready)return{screenPoint:e,results:[]};const i=this._operationalDataView.videoToMap(e);if(!i)return{screenPoint:e,results:[]};const s=this._operationalDataView.state.toScreen(y(),i);return this._operationalDataView.hitTest({x:s[0],y:s[1]},t)}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);const t={renderingOptions:this.renderingOptions,backgroundColor:F,groundControlPoints:()=>this._groundControlPoints(),getSize:()=>this.videoSize},i=new k(this._getOrCreateRenderCanvas(),t);this.stage=i,this._prepareStage(this.stage),this.childStage=i.childStage,this._prepareChildStage(this.childStage);const s=new D({view:this});this._set("animationManager",s);const o=new T({view:this,animationManager:s});this._set("mapViewNavigation",o),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.frameTask?.stop(),this.stationaryManager?.clear(),this.stage?.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer?.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager?.ready&&this.stateManager.teardown()}_getViewpoint(){return new i({targetGeometry:new w({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([n(()=>this.stationary,t=>e.stationary=t,l),n(()=>this.state.id,()=>e.state=this.state,l),n(()=>this.renderingOptions,t=>e.renderingOptions=t,l)],"video-view"),this._extent=new f({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new C({element:new V({video:this.layer?.videoElement,georeference:new b({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new G(this._videoElementView);this._overlayContainer=new O,this._overlayContainer.addChild(t),this._effectsContainer=new P,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);const i=document.createElement("div");i.classList.add("esri-video-poster"),this.container?.classList.add("esri-video-view"),this.container?.appendChild(i)}_prepareChildStage(e){this.addHandles([n(()=>this.map,async t=>{if(!t)return;const{default:i}=await(import("./video/VideoOperationalDataView.js"));this._operationalDataView=new i({stage:e,layerViewFilter:e=>new Set(L).has(e.type),width:this.size[0],height:this.size[1],map:t,groundControlPoints:()=>this._groundControlPoints(),getVideoResolution:()=>u(this.layer?.videoWidth||0,this.layer?.videoHeight||0),getSize:()=>this.size}),p(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},l),n(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;const t=this.layer.groundControlPoints,i=t?.length;if(!i)return;await j();const s=new Array(i),o=e.state.spatialReference;for(let e=0;e<i;e++){const{lat:i,lon:r}=t[e];s[e]=_(new w(r,i),o)}let r=1/0,a=1/0,n=-1/0,l=-1/0;for(const e of s)r=Math.min(r,e.x),a=Math.min(a,e.y),n=Math.max(n,e.x),l=Math.max(l,e.y);const p=f.fromJSON({xmin:r,ymin:a,xmax:n,ymax:l,spatialReference:o});await(this._operationalDataView?.goTo(p,{animate:!1}).catch(()=>{}))},l)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let o=t;o>I;o/=2)i.push(o);i.push(I);const{lods:s}=S.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,o=i*e.scale/2,r=e.targetGeometry.clone();return r.x=Math.max(s,Math.min(t-s,r.x)),r.y=Math.max(o,Math.min(i-o,r.y)),e.targetGeometry=r,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}_forceReadyCycle(){this.ready&&(h(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}_groundControlPoints(){return this.layer?.groundControlPoints}};e([d()],N.prototype,"_overlayContainer",void 0),e([d()],N.prototype,"_isValid",void 0),e([d()],N.prototype,"_readyCycleForced",void 0),e([d()],N.prototype,"_effectsContainer",void 0),e([d()],N.prototype,"constraintsInfo",null),e([d()],N.prototype,"operationalDataVisible",void 0),e([d()],N.prototype,"layer",null),e([d()],N.prototype,"map",void 0),e([d({type:q,nonNullable:!0})],N.prototype,"navigation",void 0),e([d({readOnly:!0})],N.prototype,"preconditionsReady",null),e([d({readOnly:!0})],N.prototype,"ready",void 0),e([d({readOnly:!0})],N.prototype,"rendering",null),e([d()],N.prototype,"scale",null),e([d()],N.prototype,"spatialReference",void 0),e([d()],N.prototype,"stateManager",void 0),e([d()],N.prototype,"type",void 0),e([d(),m(e=>e instanceof U?e:g(H,e))],N.prototype,"ui",void 0),e([d({readOnly:!0})],N.prototype,"videoSize",null),e([d({readOnly:!0})],N.prototype,"view2dType",void 0),N=e([c("esri.views.VideoView")],N);const W=N;export{W as default};
|
package/views/View.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ import type HighlightOptions from "./support/HighlightOptions.js";
|
|
|
19
19
|
import type { ReadonlyArrayOrCollection, ReadonlyCollection } from "../core/Collection.js";
|
|
20
20
|
import type { EventedMixin } from "../core/Evented.js";
|
|
21
21
|
import type { EsriPromise } from "../core/Promise.js";
|
|
22
|
+
import type { ScreenRect } from "../core/types.js";
|
|
22
23
|
import type { SpatialReferenceProperties } from "../geometry/SpatialReference.js";
|
|
23
24
|
import type { SceneViewEventTypes, PersistableComponent } from "./types.js";
|
|
24
25
|
import type { ViewPadding } from "./ui/types.js";
|
|
@@ -408,12 +409,29 @@ export default abstract class View<TLayerView extends LayerView = LayerView> ext
|
|
|
408
409
|
*/
|
|
409
410
|
accessor fatalError: EsriError | null | undefined;
|
|
410
411
|
/**
|
|
411
|
-
*
|
|
412
|
+
* The screen rectangle of the active focus region, or `null` when [focusRegionEnabled](https://developers.arcgis.com/javascript/latest/references/core/views/View/#focusRegionEnabled) is `false`.
|
|
413
|
+
* This screen rectangle represents the area of the view that is currently in focus and can be used with methods that require a screen rectangle as input, such as `hitTest()`.
|
|
412
414
|
*
|
|
413
|
-
*
|
|
415
|
+
* | Action | Keyboard Shortcut / Property |
|
|
416
|
+
* |--------|----------------------------|
|
|
417
|
+
* | Enable or disable focus region | Use the `Shift` + `Alt`/`Option` + `O` keyboard shortcut while the view component is in focus or set the [focusRegionEnabled](https://developers.arcgis.com/javascript/latest/references/core/views/View/#focusRegionEnabled) property to `true` or `false`. |
|
|
418
|
+
* | Resize focus region | Use the `Shift` + `Alt`/`Option` + Up/Down arrow keys while the focus region is enabled. |
|
|
419
|
+
*
|
|
420
|
+
* To know when this focus region is selected, listen for the [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select) event.
|
|
421
|
+
*
|
|
422
|
+
* @since 5.2
|
|
423
|
+
* @see [focusRegionEnabled](https://developers.arcgis.com/javascript/latest/references/core/views/View/#focusRegionEnabled)
|
|
424
|
+
* @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
|
|
425
|
+
*/
|
|
426
|
+
get focusRegion(): ScreenRect | null;
|
|
427
|
+
/**
|
|
428
|
+
* Indicates whether the [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/View/#focusRegion) is enabled. Set this property to `true` to show the centered focus region, or `false` to hide it.
|
|
429
|
+
* The focus region can also be enabled/disabled by pressing the `Shift` + `Alt`/`Option` + `O` keyboard shortcut when the view is in focus.
|
|
414
430
|
*
|
|
415
431
|
* @default false
|
|
416
432
|
* @since 5.2
|
|
433
|
+
* @see [focusRegion](https://developers.arcgis.com/javascript/latest/references/core/views/View/#focusRegion)
|
|
434
|
+
* @see [focus-region-select](https://developers.arcgis.com/javascript/latest/references/core/views/View/#event-focus-region-select)
|
|
417
435
|
*/
|
|
418
436
|
accessor focusRegionEnabled: boolean;
|
|
419
437
|
/**
|
package/views/View.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../Map.js";import{createTask as i}from"../core/asyncUtils.js";import r from"../core/Collection.js";import s from"../core/CollectionFlattener.js";import{referenceSetter as a}from"../core/collectionUtils.js";import o from"../core/Error.js";import{EventedMixin as n}from"../core/Evented.js";import l from"../core/Handles.js";import{makeHandle as p}from"../core/handleUtils.js";import has from"../core/has.js";import{isLoadable as h}from"../core/Loadable.js";import d from"../core/Logger.js";import{destroyMaybe as u,abortMaybe as y}from"../core/maybe.js";import{EsriPromise as m}from"../core/Promise.js";import{after as c}from"../core/promiseUtils.js";import g from"../core/ReactiveSet.js";import{watch as f,sync as w,whenOnce as v,when as _,syncAndInitial as M}from"../core/reactiveUtils.js";import{property as V,subclass as b}from"../core/accessorSupport/decorators.js";import{owningCollectionProperty as R}from"../core/support/OwningCollection.js";import{UpdatingHandles as S}from"../core/support/UpdatingHandles.js";import T from"../geometry/Extent.js";import j from"../geometry/HeightModelInfo.js";import E from"../geometry/SpatialReference.js";import{equals as L}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as F}from"../support/AnalysesCollection.js";import{GraphicsCollection as x}from"../support/GraphicsCollection.js";import{system as C}from"../time/constants.js";import O from"../time/TimeExtent.js";import{isTimeZoneValid as k}from"../time/timeZoneUtils.js";import H from"./BasemapView.js";import I from"./Magnifier.js";import Z from"./SelectionManager.js";import q from"./Theme.js";import{ToolViewManager as W}from"./ToolViewManager.js";import{GlyphMosaic as A}from"./2d/engine/webgl/GlyphMosaic.js";import{makeDefaultHighlightOptions as P}from"./3d/support/DefaultHighlights.js";import D from"./input/Input.js";import{ViewEvents as U}from"./input/ViewEvents.js";import z from"./interactive/options/ViewOptions.js";import N from"./navigation/Navigation.js";import{deduplicateAttributionItems as G}from"./support/attributionUtils.js";import{DefaultsFromMap as $}from"./support/DefaultsFromMap.js";import{defaultHighlightName as B}from"./support/HighlightDefaults.js";import J from"./support/HighlightOptions.js";import K from"./support/LayerViewManager.js";import Q from"./support/RequiredFieldsOptions.js";import{checkWebAssemblyRequirements as X}from"./support/WebAssemblyRequirements.js";import{checkWebGLRequirements as Y}from"./support/WebGLRequirements.js";var ee;let te=class extends(n(m)){static{ee=this}constructor(e){super(e),this._userSpatialReference=null,this.handles=new l,this.updatingHandles=new S,this.allLayerViews=new s({getCollections:()=>this.layerviewCollections,getChildrenFunction:re}),this.animationsEnabled=!0,this.focusRegionEnabled=!1,this.attributionVisible=!0,this.basemapView=null,this.dependencies={popup:void 0},this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new x,this.typeSpecificPreconditionsReady=!0,this.layerViews=new r,this.magnifier=new I,this.options=new z,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this._lowPriorityCursorHandles=new r,this._highPriorityCursorHandles=new r,this.input=new D,this.navigation=new N,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new U(this),this.requiredFieldsOptions=new Q,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this._glyphMosaic=null,this.theme=null,this.registeredComponents=new g,this.handles.add(f(()=>this.preconditionsReady,e=>{const t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,ee.views.add(this)):(this._lockedSpatialReference=null,ee.views.remove(this)),this.notifyChange("spatialReference"),!e&&t)this.toolViewManager?.detach(),this.analysisViewManager?.detach(),this.layerViewManager?.clear(),this._glyphMosaic?.dispose(),this._teardown();else if(e&&!t){try{this._startup()}catch(i){return void queueMicrotask(()=>{this.fatalError=new o("view:startup-error","View._startup failed",i)})}this._glyphMosaic=new A(1024,1024,!0),this.analysisViewManager?.attach(),this.toolViewManager.attach()}},w)),this.analyses=new F}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then(()=>(this._isValid=!0,v(()=>this.ready)))),this.basemapView=new H({view:this}),this.layerViewManager=new K({view:this,layerViewFilter:e=>this.layerViewFilter?.(e)??!0,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},layerviewMapping:this._layerToLayerviewMapping}),this.toolViewManager=new W({view:this}),this.selectionManager=new Z({view:this}),this.addHandles([_(()=>"map-content-error"===this.readyState&&!this.spatialReference,()=>{d.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")}),f(()=>this.initialExtentRequired,e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e},M),f(()=>this.ready,e=>{this.defaultsFromMap&&(this.defaultsFromMap.viewReady=e)},w),f(()=>this.defaultsFromMapInputSpatialReference(),e=>{this.defaultsFromMap&&(this.defaultsFromMap.inputSpatialReference=e)},M),f(()=>this.defaultsFromMapInputHeightModelInfo(),e=>{this.defaultsFromMap&&(this.defaultsFromMap.inputHeightModelInfo=e)},M)])}get _layerToLayerviewMapping(){return ee._layerToLayerview}static{this._layerToLayerview=[["view.map.basemap.baseLayers","view.basemapView.baseLayerViews"],["view.map.basemap.groundLayers","view.basemapView.groundLayerViews"],["view.map.basemap.referenceLayers","view.basemapView.referenceLayerViews"],["view.map.layers","view.layerViews"]]}destroy(){this.destroyed||(ee.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=u(this.graphics),this.analyses=u(this.analyses),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),this.analysisViewManager=u(this.analysisViewManager),this.toolViewManager=u(this.toolViewManager),this.layerViewManager=u(this.layerViewManager),this.selectionManager=u(this.selectionManager),this.basemapView=u(this.basemapView),this.layerViews.destroyAll(),this.invalidate(),this.handles.destroy(),this.map=u(this.map),this.updatingHandles.destroy())}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return d.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get analyses(){return this._get("analyses")}set analyses(e){this._set("analyses",e)}get animation(){return this._get("animation")}set animation(e){this._set("animation",e)}get attributionItems(){return this.suspended?[]:G(this._get("attributionItems"),this.getAttributionItems())}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new $({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(e){this._set("extent",e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}glyphMosaic(){return this._glyphMosaic}get highlights(){return this._get("highlights")??P()}set highlights(e){this._set("highlights",a(e,this._get("highlights"),r.ofType(J)))}get defaultHighlight(){return this.highlights.find(({name:e})=>e===B)}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){if(this.destroying||this.destroyed)return!1;const{map:e,spatialReference:t}=this;return!(this.fatalError||!this._isValid||this._readyCycleForced||!e||h(e)&&!e.loaded||0===this.width||0===this.height||!t||!this._validateSpatialReference(t)||!this._lockedSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){e!==this._get("map")&&(e?.destroyed&&(d.getLogger(this).warn("#map","The provided map is already destroyed",{map:e}),e=null),h(e)&&e.load().catch(()=>{}),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set("map",e))}get canZoomIn(){return!!this.ready}get canZoomOut(){return!!this.ready}get readyState(){if(this.destroyed)return this._get("readyState");if(!this.map)return"missing-map";if("container"in this&&!this.container)return"missing-container";if(this.fatalError)return"rendering-error";if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){const e=!("loaded"in this.map)||this.map.loaded,t=this.map.ground.loaded,r=this.map.basemap?.loaded??!0;return e&&r&&t&&!this.map?.allLayers.length?"empty-map":(this._readyStateWaitingTask||(this._readyStateWaitingTask=i(e=>c(has("view-readyState-waiting-delay"),null,e)),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,"ready-state-task")),this._readyStateWaitingTask?.finished?"map-content-error":"loading")}return this._readyStateWaitingTask=y(this._readyStateWaitingTask),this.removeHandles("ready-state-task"),this.ready?"ready":"loading"}get spatialReference(){const{_userSpatialReference:e}=this;if(e&&null!==e.vcsWkid)return e;const t=e??this._lockedSpatialReference??this.getWebDocumentSpatialReference()??this.defaultsFromMap?.spatialReference??null,i=this.defaultsFromMap?.combinedHorizontalAndVerticalSpatialReference;return i?.equals(t)?i:t}set spatialReference(e){const t=!L(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(this.spatialReference))}_spatialReferenceChanged(e){}getWebDocumentSpatialReference(){return null}defaultsFromMapInputSpatialReference(){return this._userSpatialReference??this.getWebDocumentSpatialReference()??(this.ready?this._lockedSpatialReference:null)}defaultsFromMapInputHeightModelInfo(){return this.map?.heightModelInfo??null}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??C}set timeZone(e){this._userTimeZone=e,k(e)||d.getLogger(this).warn("#timeZone",`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._highPriorityCursorHandles.at(-1)?.cursor??this._lowPriorityCursorHandles.at(-1)?.cursor??"default"}acquireCursor(e,t="low"){const i="high"===t?this._highPriorityCursorHandles:this._lowPriorityCursorHandles,r={cursor:e},s=p(()=>i.remove(r));return i.add(r),this.addHandles(s),s}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new q}registerComponent(e){this.registeredComponents.add(e)}unregisterComponent(e){this.registeredComponents.delete(e)}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getAttributionItems(){return this.allLayerViews.items.flatMap(e=>e.attributionItems)}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}getSurface(){return null}importLayerView(e){throw new o("view:importLayerView-missing","importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){const e=Y(this.type);if(e)throw this._displayWebGLError(),d.getLogger(this).warn("#validate()",e.message),e;const t=await X();if(t)throw d.getLogger(this).warn("#validate()",t.message),t}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return null!=this.getSpatialReferenceSupport(e)}when(e,t){return this.isResolved()&&!this.ready&&d.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(_(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}on(e,t){return super.on(e,t)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}static{this.views=new r}_displayWebGLError(){const e=document.createElement("div");e.setAttribute("style","display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;");const t=document.createElement("div");t.innerHTML="Unable to display map. WebGL2 support is required.",t.setAttribute("style","font-size: 24px; font-weight: bold;");const i=document.createElement("div");i.innerHTML="Ensure that your browser and hardware meet the minimum requirements.",i.setAttribute("style","font-size: 18px;");const r=document.createElement("a");r.innerHTML="https://esriurl.com/webgl-faq",r.target="_blank",r.setAttribute("style","font-size: 18px;"),r.href="https://esriurl.com/webgl-faq",e.appendChild(t),e.appendChild(i),e.appendChild(r);const s=this.getSurface();s&&s.appendChild(e)}};e([V()],te.prototype,"_userSpatialReference",void 0),e([V()],te.prototype,"activeTool",null),e([V({readOnly:!0})],te.prototype,"allLayerViews",void 0),e([V({readOnly:!0})],te.prototype,"layerviewCollections",null),e([V(R(F,"analyses"))],te.prototype,"analyses",null),e([V()],te.prototype,"animation",null),e([V()],te.prototype,"animationsEnabled",void 0),e([V()],te.prototype,"focusRegionEnabled",void 0),e([V({readOnly:!0})],te.prototype,"attributionItems",null),e([V()],te.prototype,"attributionVisible",void 0),e([V()],te.prototype,"basemapView",void 0),e([V()],te.prototype,"center",null),e([V()],te.prototype,"defaultsFromMapSettings",null),e([V()],te.prototype,"defaultsFromMap",null),e([V()],te.prototype,"dependencies",void 0),e([V()],te.prototype,"displayFilterEnabled",void 0),e([V({type:T})],te.prototype,"extent",null),e([V()],te.prototype,"fatalError",void 0),e([V(R(x,"graphics"))],te.prototype,"graphics",void 0),e([V({readOnly:!0,type:j})],te.prototype,"heightModelInfo",null),e([V({type:r.ofType(J)})],te.prototype,"highlights",null),e([V({readOnly:!0})],te.prototype,"interacting",null),e([V({constructOnly:!0})],te.prototype,"layerViewFilter",void 0),e([V({readOnly:!0})],te.prototype,"navigating",null),e([V({readOnly:!0})],te.prototype,"preconditionsReady",null),e([V({readOnly:!0})],te.prototype,"typeSpecificPreconditionsReady",void 0),e([V({type:r,readOnly:!0})],te.prototype,"layerViews",void 0),e([V()],te.prototype,"resolution",null),e([V({type:I})],te.prototype,"magnifier",void 0),e([V({nonNullable:!0,type:z})],te.prototype,"options",void 0),e([V({value:null,type:t})],te.prototype,"map",null),e([V()],te.prototype,"padding",void 0),e([V({readOnly:!0})],te.prototype,"ready",void 0),e([V({readOnly:!0})],te.prototype,"canZoomIn",null),e([V({readOnly:!0})],te.prototype,"canZoomOut",null),e([V()],te.prototype,"_readyStateWaitingTask",void 0),e([V({readOnly:!0})],te.prototype,"readyState",null),e([V({type:E})],te.prototype,"spatialReference",null),e([V()],te.prototype,"stationary",null),e([V({type:O})],te.prototype,"timeExtent",null),e([V({type:String,nonNullable:!0})],te.prototype,"timeZone",null),e([V()],te.prototype,"tools",null),e([V()],te.prototype,"toolViewManager",void 0),e([V({readOnly:!0})],te.prototype,"type",void 0),e([V({type:Number})],te.prototype,"scale",void 0),e([V({readOnly:!0})],te.prototype,"updating",void 0),e([V({readOnly:!0})],te.prototype,"initialExtentRequired",void 0),e([V({readOnly:!0})],te.prototype,"initialExtent",null),e([V()],te.prototype,"cursor",null),e([V({readOnly:!0})],te.prototype,"input",void 0),e([V({type:N,nonNullable:!0})],te.prototype,"navigation",void 0),e([V()],te.prototype,"layerViewManager",void 0),e([V()],te.prototype,"analysisViewManager",void 0),e([V()],te.prototype,"selectionManager",void 0),e([V()],te.prototype,"width",void 0),e([V()],te.prototype,"height",void 0),e([V({readOnly:!0})],te.prototype,"resizing",void 0),e([V({value:null,readOnly:!0})],te.prototype,"size",null),e([V({readOnly:!0})],te.prototype,"suspended",void 0),e([V({readOnly:!0})],te.prototype,"viewEvents",void 0),e([V()],te.prototype,"_isValid",void 0),e([V()],te.prototype,"_readyCycleForced",void 0),e([V()],te.prototype,"_lockedSpatialReference",void 0),e([V()],te.prototype,"_userTimeZone",void 0),e([V()],te.prototype,"_lockedTimeZone",void 0),e([V()],te.prototype,"_userTimeExtent",void 0),e([V()],te.prototype,"_lockedTimeExtent",void 0),e([V({type:q})],te.prototype,"theme",void 0),e([V({readOnly:!0,type:q})],te.prototype,"effectiveTheme",null),e([V({readOnly:!0})],te.prototype,"registeredComponents",void 0),te=ee=e([b("esri.views.View")],te);const ie=globalThis.$arcgis;function re(e){return e.layerViews}ie&&!ie.views&&Object.defineProperty(ie,"views",{configurable:!1,enumerable:!0,writable:!1,value:te.views});export{te as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../Map.js";import{createTask as i}from"../core/asyncUtils.js";import r from"../core/Collection.js";import s from"../core/CollectionFlattener.js";import{referenceSetter as a}from"../core/collectionUtils.js";import o from"../core/Error.js";import{EventedMixin as n}from"../core/Evented.js";import l from"../core/Handles.js";import{makeHandle as p}from"../core/handleUtils.js";import has from"../core/has.js";import{isLoadable as h}from"../core/Loadable.js";import d from"../core/Logger.js";import{destroyMaybe as u,abortMaybe as y}from"../core/maybe.js";import{EsriPromise as m}from"../core/Promise.js";import{after as c}from"../core/promiseUtils.js";import g from"../core/ReactiveSet.js";import{watch as f,sync as w,whenOnce as v,when as _,syncAndInitial as M}from"../core/reactiveUtils.js";import{property as V,subclass as b}from"../core/accessorSupport/decorators.js";import{owningCollectionProperty as R}from"../core/support/OwningCollection.js";import{UpdatingHandles as S}from"../core/support/UpdatingHandles.js";import T from"../geometry/Extent.js";import j from"../geometry/HeightModelInfo.js";import E from"../geometry/SpatialReference.js";import{equals as L}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as F}from"../support/AnalysesCollection.js";import{GraphicsCollection as x}from"../support/GraphicsCollection.js";import{system as C}from"../time/constants.js";import O from"../time/TimeExtent.js";import{isTimeZoneValid as k}from"../time/timeZoneUtils.js";import H from"./BasemapView.js";import I from"./Magnifier.js";import Z from"./SelectionManager.js";import q from"./Theme.js";import{ToolViewManager as W}from"./ToolViewManager.js";import{GlyphMosaic as A}from"./2d/engine/webgl/GlyphMosaic.js";import{makeDefaultHighlightOptions as P}from"./3d/support/DefaultHighlights.js";import D from"./input/Input.js";import{ViewEvents as U}from"./input/ViewEvents.js";import z from"./interactive/options/ViewOptions.js";import N from"./navigation/Navigation.js";import{deduplicateAttributionItems as G}from"./support/attributionUtils.js";import{DefaultsFromMap as $}from"./support/DefaultsFromMap.js";import{defaultHighlightName as B}from"./support/HighlightDefaults.js";import J from"./support/HighlightOptions.js";import K from"./support/LayerViewManager.js";import Q from"./support/RequiredFieldsOptions.js";import{checkWebAssemblyRequirements as X}from"./support/WebAssemblyRequirements.js";import{checkWebGLRequirements as Y}from"./support/WebGLRequirements.js";var ee;let te=class extends(n(m)){static{ee=this}constructor(e){super(e),this._userSpatialReference=null,this.handles=new l,this.updatingHandles=new S,this.allLayerViews=new s({getCollections:()=>this.layerviewCollections,getChildrenFunction:re}),this.animationsEnabled=!0,this.focusRegionEnabled=!1,this.attributionVisible=!0,this.basemapView=null,this.dependencies={popup:void 0},this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new x,this.typeSpecificPreconditionsReady=!0,this.layerViews=new r,this.magnifier=new I,this.options=new z,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this._lowPriorityCursorHandles=new r,this._highPriorityCursorHandles=new r,this.input=new D,this.navigation=new N,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new U(this),this.requiredFieldsOptions=new Q,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this._glyphMosaic=null,this.theme=null,this.registeredComponents=new g,this.handles.add(f(()=>this.preconditionsReady,e=>{const t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,ee.views.add(this)):(this._lockedSpatialReference=null,ee.views.remove(this)),this.notifyChange("spatialReference"),!e&&t)this.toolViewManager?.detach(),this.analysisViewManager?.detach(),this.layerViewManager?.clear(),this._glyphMosaic?.dispose(),this._teardown();else if(e&&!t){try{this._startup()}catch(i){return void queueMicrotask(()=>{this.fatalError=new o("view:startup-error","View._startup failed",i)})}this._glyphMosaic=new A(1024,1024,!0),this.analysisViewManager?.attach(),this.toolViewManager.attach()}},w)),this.analyses=new F}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then(()=>(this._isValid=!0,v(()=>this.ready)))),this.basemapView=new H({view:this}),this.layerViewManager=new K({view:this,layerViewFilter:e=>this.layerViewFilter?.(e)??!0,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},layerviewMapping:this._layerToLayerviewMapping}),this.toolViewManager=new W({view:this}),this.selectionManager=new Z({view:this}),this.addHandles([_(()=>"map-content-error"===this.readyState&&!this.spatialReference,()=>{d.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")}),f(()=>this.initialExtentRequired,e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e},M),f(()=>this.ready,e=>{this.defaultsFromMap&&(this.defaultsFromMap.viewReady=e)},w),f(()=>this.defaultsFromMapInputSpatialReference(),e=>{this.defaultsFromMap&&(this.defaultsFromMap.inputSpatialReference=e)},M),f(()=>this.defaultsFromMapInputHeightModelInfo(),e=>{this.defaultsFromMap&&(this.defaultsFromMap.inputHeightModelInfo=e)},M)])}get _layerToLayerviewMapping(){return ee._layerToLayerview}static{this._layerToLayerview=[["view.map.basemap.baseLayers","view.basemapView.baseLayerViews"],["view.map.basemap.groundLayers","view.basemapView.groundLayerViews"],["view.map.basemap.referenceLayers","view.basemapView.referenceLayerViews"],["view.map.layers","view.layerViews"]]}destroy(){this.destroyed||(ee.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=u(this.graphics),this.analyses=u(this.analyses),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),this.analysisViewManager=u(this.analysisViewManager),this.toolViewManager=u(this.toolViewManager),this.layerViewManager=u(this.layerViewManager),this.selectionManager=u(this.selectionManager),this.basemapView=u(this.basemapView),this.layerViews.destroyAll(),this.invalidate(),this.handles.destroy(),this.map=u(this.map),this.updatingHandles.destroy())}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return d.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get analyses(){return this._get("analyses")}set analyses(e){this._set("analyses",e)}get animation(){return this._get("animation")}set animation(e){this._set("animation",e)}get focusRegion(){return null}get attributionItems(){return this.suspended?[]:G(this._get("attributionItems"),this.getAttributionItems())}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new $({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(e){this._set("extent",e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}glyphMosaic(){return this._glyphMosaic}get highlights(){return this._get("highlights")??P()}set highlights(e){this._set("highlights",a(e,this._get("highlights"),r.ofType(J)))}get defaultHighlight(){return this.highlights.find(({name:e})=>e===B)}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){if(this.destroying||this.destroyed)return!1;const{map:e,spatialReference:t}=this;return!(this.fatalError||!this._isValid||this._readyCycleForced||!e||h(e)&&!e.loaded||0===this.width||0===this.height||!t||!this._validateSpatialReference(t)||!this._lockedSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){e!==this._get("map")&&(e?.destroyed&&(d.getLogger(this).warn("#map","The provided map is already destroyed",{map:e}),e=null),h(e)&&e.load().catch(()=>{}),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set("map",e))}get canZoomIn(){return!!this.ready}get canZoomOut(){return!!this.ready}get readyState(){if(this.destroyed)return this._get("readyState");if(!this.map)return"missing-map";if("container"in this&&!this.container)return"missing-container";if(this.fatalError)return"rendering-error";if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){const e=!("loaded"in this.map)||this.map.loaded,t=this.map.ground.loaded,r=this.map.basemap?.loaded??!0;return e&&r&&t&&!this.map?.allLayers.length?"empty-map":(this._readyStateWaitingTask||(this._readyStateWaitingTask=i(e=>c(has("view-readyState-waiting-delay"),null,e)),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,"ready-state-task")),this._readyStateWaitingTask?.finished?"map-content-error":"loading")}return this._readyStateWaitingTask=y(this._readyStateWaitingTask),this.removeHandles("ready-state-task"),this.ready?"ready":"loading"}get spatialReference(){const{_userSpatialReference:e}=this;if(e&&null!==e.vcsWkid)return e;const t=e??this._lockedSpatialReference??this.getWebDocumentSpatialReference()??this.defaultsFromMap?.spatialReference??null,i=this.defaultsFromMap?.combinedHorizontalAndVerticalSpatialReference;return i?.equals(t)?i:t}set spatialReference(e){const t=!L(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(this.spatialReference))}_spatialReferenceChanged(e){}getWebDocumentSpatialReference(){return null}defaultsFromMapInputSpatialReference(){return this._userSpatialReference??this.getWebDocumentSpatialReference()??(this.ready?this._lockedSpatialReference:null)}defaultsFromMapInputHeightModelInfo(){return this.map?.heightModelInfo??null}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??C}set timeZone(e){this._userTimeZone=e,k(e)||d.getLogger(this).warn("#timeZone",`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._highPriorityCursorHandles.at(-1)?.cursor??this._lowPriorityCursorHandles.at(-1)?.cursor??"default"}acquireCursor(e,t="low"){const i="high"===t?this._highPriorityCursorHandles:this._lowPriorityCursorHandles,r={cursor:e},s=p(()=>i.remove(r));return i.add(r),this.addHandles(s),s}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new q}registerComponent(e){this.registeredComponents.add(e)}unregisterComponent(e){this.registeredComponents.delete(e)}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getAttributionItems(){return this.allLayerViews.items.flatMap(e=>e.attributionItems)}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}getSurface(){return null}importLayerView(e){throw new o("view:importLayerView-missing","importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){const e=Y(this.type);if(e)throw this._displayWebGLError(),d.getLogger(this).warn("#validate()",e.message),e;const t=await X();if(t)throw d.getLogger(this).warn("#validate()",t.message),t}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return null!=this.getSpatialReferenceSupport(e)}when(e,t){return this.isResolved()&&!this.ready&&d.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(_(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}on(e,t){return super.on(e,t)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}static{this.views=new r}_displayWebGLError(){const e=document.createElement("div");e.setAttribute("style","display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;");const t=document.createElement("div");t.innerHTML="Unable to display map. WebGL2 support is required.",t.setAttribute("style","font-size: 24px; font-weight: bold;");const i=document.createElement("div");i.innerHTML="Ensure that your browser and hardware meet the minimum requirements.",i.setAttribute("style","font-size: 18px;");const r=document.createElement("a");r.innerHTML="https://esriurl.com/webgl-faq",r.target="_blank",r.setAttribute("style","font-size: 18px;"),r.href="https://esriurl.com/webgl-faq",e.appendChild(t),e.appendChild(i),e.appendChild(r);const s=this.getSurface();s&&s.appendChild(e)}};e([V()],te.prototype,"_userSpatialReference",void 0),e([V()],te.prototype,"activeTool",null),e([V({readOnly:!0})],te.prototype,"allLayerViews",void 0),e([V({readOnly:!0})],te.prototype,"layerviewCollections",null),e([V(R(F,"analyses"))],te.prototype,"analyses",null),e([V()],te.prototype,"animation",null),e([V()],te.prototype,"animationsEnabled",void 0),e([V()],te.prototype,"focusRegionEnabled",void 0),e([V()],te.prototype,"focusRegion",null),e([V({readOnly:!0})],te.prototype,"attributionItems",null),e([V()],te.prototype,"attributionVisible",void 0),e([V()],te.prototype,"basemapView",void 0),e([V()],te.prototype,"center",null),e([V()],te.prototype,"defaultsFromMapSettings",null),e([V()],te.prototype,"defaultsFromMap",null),e([V()],te.prototype,"dependencies",void 0),e([V()],te.prototype,"displayFilterEnabled",void 0),e([V({type:T})],te.prototype,"extent",null),e([V()],te.prototype,"fatalError",void 0),e([V(R(x,"graphics"))],te.prototype,"graphics",void 0),e([V({readOnly:!0,type:j})],te.prototype,"heightModelInfo",null),e([V({type:r.ofType(J)})],te.prototype,"highlights",null),e([V({readOnly:!0})],te.prototype,"interacting",null),e([V({constructOnly:!0})],te.prototype,"layerViewFilter",void 0),e([V({readOnly:!0})],te.prototype,"navigating",null),e([V({readOnly:!0})],te.prototype,"preconditionsReady",null),e([V({readOnly:!0})],te.prototype,"typeSpecificPreconditionsReady",void 0),e([V({type:r,readOnly:!0})],te.prototype,"layerViews",void 0),e([V()],te.prototype,"resolution",null),e([V({type:I})],te.prototype,"magnifier",void 0),e([V({nonNullable:!0,type:z})],te.prototype,"options",void 0),e([V({value:null,type:t})],te.prototype,"map",null),e([V()],te.prototype,"padding",void 0),e([V({readOnly:!0})],te.prototype,"ready",void 0),e([V({readOnly:!0})],te.prototype,"canZoomIn",null),e([V({readOnly:!0})],te.prototype,"canZoomOut",null),e([V()],te.prototype,"_readyStateWaitingTask",void 0),e([V({readOnly:!0})],te.prototype,"readyState",null),e([V({type:E})],te.prototype,"spatialReference",null),e([V()],te.prototype,"stationary",null),e([V({type:O})],te.prototype,"timeExtent",null),e([V({type:String,nonNullable:!0})],te.prototype,"timeZone",null),e([V()],te.prototype,"tools",null),e([V()],te.prototype,"toolViewManager",void 0),e([V({readOnly:!0})],te.prototype,"type",void 0),e([V({type:Number})],te.prototype,"scale",void 0),e([V({readOnly:!0})],te.prototype,"updating",void 0),e([V({readOnly:!0})],te.prototype,"initialExtentRequired",void 0),e([V({readOnly:!0})],te.prototype,"initialExtent",null),e([V()],te.prototype,"cursor",null),e([V({readOnly:!0})],te.prototype,"input",void 0),e([V({type:N,nonNullable:!0})],te.prototype,"navigation",void 0),e([V()],te.prototype,"layerViewManager",void 0),e([V()],te.prototype,"analysisViewManager",void 0),e([V()],te.prototype,"selectionManager",void 0),e([V()],te.prototype,"width",void 0),e([V()],te.prototype,"height",void 0),e([V({readOnly:!0})],te.prototype,"resizing",void 0),e([V({value:null,readOnly:!0})],te.prototype,"size",null),e([V({readOnly:!0})],te.prototype,"suspended",void 0),e([V({readOnly:!0})],te.prototype,"viewEvents",void 0),e([V()],te.prototype,"_isValid",void 0),e([V()],te.prototype,"_readyCycleForced",void 0),e([V()],te.prototype,"_lockedSpatialReference",void 0),e([V()],te.prototype,"_userTimeZone",void 0),e([V()],te.prototype,"_lockedTimeZone",void 0),e([V()],te.prototype,"_userTimeExtent",void 0),e([V()],te.prototype,"_lockedTimeExtent",void 0),e([V({type:q})],te.prototype,"theme",void 0),e([V({readOnly:!0,type:q})],te.prototype,"effectiveTheme",null),e([V({readOnly:!0})],te.prototype,"registeredComponents",void 0),te=ee=e([b("esri.views.View")],te);const ie=globalThis.$arcgis;function re(e){return e.layerViews}ie&&!ie.views&&Object.defineProperty(ie,"views",{configurable:!1,enumerable:!0,writable:!1,value:te.views});export{te as default};
|
package/views/input/types.d.ts
CHANGED
|
@@ -499,19 +499,19 @@ export interface FocusRegionSelectEvent {
|
|
|
499
499
|
*/
|
|
500
500
|
type: "focus-region-select";
|
|
501
501
|
/**
|
|
502
|
-
* The keyboard event that triggered the focus
|
|
502
|
+
* The keyboard event that triggered the focus region selection.
|
|
503
503
|
*
|
|
504
504
|
* @since 5.2
|
|
505
505
|
*/
|
|
506
506
|
native: KeyboardEvent;
|
|
507
507
|
/**
|
|
508
|
-
* Indicates whether the default popup
|
|
508
|
+
* Indicates whether the default behavior of the `arcgis-popup` opening with the features in the focus region has been prevented.
|
|
509
509
|
*
|
|
510
510
|
* @since 5.2
|
|
511
511
|
*/
|
|
512
512
|
defaultPrevented: boolean;
|
|
513
513
|
/**
|
|
514
|
-
* Prevents the default
|
|
514
|
+
* Prevents the default behavior of the `arcgis-popup` opening with the features in the focus region.
|
|
515
515
|
*
|
|
516
516
|
* @since 5.2
|
|
517
517
|
*/
|
|
@@ -1048,10 +1048,23 @@ export interface ViewEventTypes extends ViewBaseEventTypes {
|
|
|
1048
1048
|
*/
|
|
1049
1049
|
"key-down": KeyDownEvent;
|
|
1050
1050
|
/**
|
|
1051
|
-
* Fires
|
|
1052
|
-
*
|
|
1053
|
-
* Call `event.preventDefault()` to cancel default popup behavior and run custom logic.
|
|
1051
|
+
* Fires when the focus region is selected using the `Enter` or `Space` key.
|
|
1052
|
+
* Use this event to react to the selection of the [focus region](https://developers.arcgis.com/javascript/latest/references/core/views/DOMContainer/#focusRegion) via keyboard input and perform any necessary actions based on that selection, such as performing a hitTest on the focus region.
|
|
1054
1053
|
*
|
|
1054
|
+
* @example
|
|
1055
|
+
* ```js
|
|
1056
|
+
* reactiveUtils.on(() => view,
|
|
1057
|
+
* "focus-region-select",
|
|
1058
|
+
* async (event) => {
|
|
1059
|
+
* const focusRegion = view.focusRegion;
|
|
1060
|
+
* // fetch the features for the focus region
|
|
1061
|
+
* const generator = await view.fetchPopupFeatures(focusRegion, {
|
|
1062
|
+
* pointerType: event.pointerType,
|
|
1063
|
+
* });
|
|
1064
|
+
* // convert the async generator to an array of features and process them
|
|
1065
|
+
* const features = await Array.fromAsync(generator);
|
|
1066
|
+
* });
|
|
1067
|
+
* ```
|
|
1055
1068
|
* @since 5.2
|
|
1056
1069
|
*/
|
|
1057
1070
|
"focus-region-select": FocusRegionSelectEvent;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{isSome as t}from"../../core/arrayUtils.js";import"../../core/has.js";import{clone as n}from"../../core/lang.js";import{clamp as e}from"../../core/mathUtils.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{project as a}from"../../geometry/projectionUtils.js";import{isMeshWithRelativeVertexSpace as o}from"../../geometry/support/meshVertexSpaceUtils.js";import{clonePoint as l
|
|
2
|
+
import{isSome as t}from"../../core/arrayUtils.js";import"../../core/has.js";import{clone as n}from"../../core/lang.js";import{clamp as e}from"../../core/mathUtils.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{project as a}from"../../geometry/projectionUtils.js";import{isMeshWithRelativeVertexSpace as o}from"../../geometry/support/meshVertexSpaceUtils.js";import{clonePoint as l}from"../../layers/graphics/hydratedFeatures.js";import{hydratedSpatialReference as c}from"../../layers/graphics/hydratedSpatialReference.js";import{getZForElevationMode as s}from"../../support/elevationInfoUtils.js";import{EditGeometryOperations as u}from"./editGeometry/EditGeometryOperations.js";function i(t,n){let e=null,r=null;return a=>{if("cancel"===a.action)return void(null!=r&&(r.execute({action:"cancel"}),e=null,r=null));const o={action:a.action,screenStart:a.start,screenEnd:a.screenPoint};"start"===a.action&&null==e&&(e=new D,r=new D,n(t,e,r,a.pointerType,o)),null!=e&&e.execute(o),"end"===a.action&&null!=e&&(e=null,r=null)}}function p(t,n){return t.events.on("drag",i(t,n))}function m(t,n){const e=[t.x,t.y,t.z??0],r=n,a=[Math.cos(r),Math.sin(r)],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]);if(0===o)return null;a[0]/=o,a[1]/=o;const l=t=>{const n=(t.x-e[0])*a[0]+(t.y-e[1])*a[1];t.x=e[0]+n*a[0],t.y=e[1]+n*a[1]};return t=>(l(t.mapStart),l(t.mapEnd),{...t,axis:a})}function f(t){let n=null;const e=j();return r=>{if("start"===r.action&&(n=y(t,r.mapStart.spatialReference)),null==n)return null;const a=e(r);if(!a)return null;const{translationX:o,translationY:l,translationZ:c}=a;return n.move(o,l,c,r.action),a}}function d(t,n){return null==t?null:t.spatialReference.equals(n)?t.clone():a(t,n)}function y(t,n){const e=t.operations;if(!e)return null;const r=e.data.geometry,l=c(n);if(r.spatialReference.equals(l))return x(t,e,()=>{});if("mesh"!==r.type){const n=d(r,l);if(null==n)return null;const o=r.spatialReference,c=u.fromGeometry(n,e.viewingMode);return x(t,c,()=>{const t=c.data.geometry,n=a(t,o);e.trySetGeometry(n)})}if(o(r)){const n=d(r.origin,l);if(!n)return null;const o=r.spatialReference,c=u.fromGeometry(n,e.viewingMode);return x(t,e,()=>{const t=a(c.data.geometry,o),n=t.x-r.origin.x,l=t.y-r.origin.y,s=(t.z??0)-(r.origin.z??0);e.move(n,l,s)})}return null}function x(t,n,e){let r=0,a=0,o=0;return{move:(l,c,s,u)=>{"start"===u&&(r=0,a=0,o=0);const i=l-r,p=c-a,m=s-o;n.move(i,p,m),r+=i,a+=p,o+=m,e(),"end"===u&&t.endInteraction?.()}}}function E(t,n=null,e){let r=null;const o=null==n||t.spatialReference?.equals(n)?t=>t:t=>null!=t?a(t,n):t,l={exclude:[],...e};return n=>{if("start"===n.action&&(r=o(t.toMap(n.screenStart,l))),null==r)return null;const e=o(t.toMap(n.screenEnd,l));return null!=e?{...n,mapStart:r,mapEnd:e}:null}}function S(n){const e=n.map(t=>f(t)).filter(t),r=j();return t=>{const n=r(t);return e.forEach(n=>n(t)),n}}function h(t,e){const r=new Map;for(const a of e)r.set(a,n(t[a]));return n=>(r.forEach((n,e)=>{t[e]=n}),n)}function g(t){const n=t.operations?.createResetState();return t=>(n?.remove(),t)}function v(t){const n=t.map(t=>g(t)).filter(t=>null!=t);return t=>(n.forEach(n=>n(t)),t)}function z(){let t=0,n=0,e=0;return r=>{"start"===r.action&&(t=r.mapStart.x,n=r.mapStart.y,e=r.mapStart.z??0);const a=r.mapEnd.x-t,o=r.mapEnd.y-n,l=(r.mapEnd.z??0)-e;return t=r.mapEnd.x,n=r.mapEnd.y,e=r.mapEnd.z,{...r,mapDeltaX:a,mapDeltaY:o,mapDeltaZ:l,mapDeltaSpatialReference:r.mapStart.spatialReference}}}function j(){let t=0,n=0,e=0;return r=>{"start"===r.action&&(t=r.mapStart.x,n=r.mapStart.y,e=r.mapStart.z??0);const a=r.mapEnd.x-t,o=r.mapEnd.y-n,l=(r.mapEnd.z??0)-e;return{...r,translationX:a,translationY:o,translationZ:l}}}function R(){let t=0,n=0;return e=>{"start"===e.action&&(t=e.screenStart.x,n=e.screenStart.y);const r=e.screenEnd.x-t,a=e.screenEnd.y-n;return t=e.screenEnd.x,n=e.screenEnd.y,{...e,screenDeltaX:r,screenDeltaY:a}}}function M(t,n){let a=null,o=0,l=0;return c=>{if("start"===c.action&&(a=t.toScreen?.(n),null!=a&&(a.x<0||a.x>t.width||a.y<0||a.y>t.height?a=null:(o=c.screenStart.x-a.x,l=c.screenStart.y-a.y))),null==a)return null;const s=e(c.screenEnd.x-o,0,t.width),u=e(c.screenEnd.y-l,0,t.height),i=r(s,u);return c.screenStart=a,c.screenEnd=i,c}}const w=()=>{};class D{constructor(){this.execute=w}next(t,n=new D){return null!=t&&(this.execute=e=>{const r=t(e);null!=r&&n.execute(r)}),n}}function U(t,n,e=[]){if("2d"===t.type)return t=>t;let r=null;return a=>{"start"===a.action&&(r=t.toMap(a.screenStart,{exclude:e}),null!=r&&(r.z=s(r,t,n)));const o=t.toMap(a.screenEnd,{exclude:e});null!=o&&(o.z=s(o,t,n));const l=null!=r&&null!=o?{sceneStart:r,sceneEnd:o}:null;return{...a,scenePoints:l}}}function G(t,n,e){const r=n.elevationProvider.getElevation(t.x,t.y,t.z??0,t.spatialReference,"scene")??0,a=l(t);return a.z=r,a.hasZ=!0,a.z=s(a,n,e),a}function q(t,n){if("2d"===t.type)return t=>t;let e=null;return r=>{"start"===r.action&&(e=G(r.mapStart,t,n));const a=G(r.mapEnd,t,n),o=null!=e&&null!=a?{sceneStart:e,sceneEnd:a}:null;return{...r,scenePoints:o}}}export{D as EventPipeline,z as addMapDelta,j as addMapTranslation,R as addScreenDelta,m as constrainToMapAxis,i as createDragEventPipelineCallback,p as createManipulatorDragEventPipeline,M as dragAtLocation,f as dragManipulatedObject,S as dragManipulatedObjectMany,g as resetManipulatedObject,v as resetManipulatedObjectMany,h as resetProperties,U as sceneSnappingAtLocation,q as sceneSnappingAtProjectedLocation,E as screenToMap};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../Graphic.js";import r from"../../core/Error.js";import{makeHandle as i}from"../../core/handleUtils.js";import{property as a}from"../../core/accessorSupport/decorators.js";import{isFunctionRaster as s}from"../../layers/raster/datasets/datasetUtils.js";import{getDefaultDatumTransformationForDataset as n,projectDatasetExtent as l,getSourceScale as o}from"../../layers/raster/functions/rasterProjectionHelper.js";import{addMultidimensionalFieldValues as u,commonRasterFieldNames as p,rasterFieldPrefix as c}from"../../layers/support/rasterFieldUtils.js";import{hasTimeOptions as m,combineTimeExtent as f}from"../../layers/support/timeSupport.js";import y from"./LayerView.js";import{getFetchPopupTemplate as h}from"./support/popupUtils.js";class d extends y{constructor(...t){super(...t),this.layer=null,this.tileInfo=null}get fullExtent(){try{return this.layer.loaded?this._getFullExtent():null}catch{return null}}get timeExtent(){return m(this.layer)?f(this.layer,this.view?.timeExtent,this._get("timeExtent")):null}get hasTilingEffects(){const{renderer:t}=this.layer;return!!("raster-stretch"===t?.type&&t.dynamicRangeAdjustment&&!("min-max"===t.stretchType||"standard-deviation"===t.stretchType))}get datumTransformation(){try{return this.layer.loaded?n(this.layer.fullExtent,this.view.spatialReference,!0):null}catch{return null}}supportsSpatialReference(t){try{return!this.layer.loaded||!!l(this.layer.serviceRasterInfo,t)}catch{return!1}}async fetchPopupFeaturesAtTarget(t,i,a){const{layer:n}=this;if(!("popupTemplate"in n))return[];if(!i)throw new r("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:n});const{popupEnabled:l}=n,o=h(n,a);if(!l||null==o)return[];"polygon"===i.type&&(i=i.extent?.center);const m=[],{value:f,magdirValue:y,processedValue:d}=await n.identify(i,{timeExtent:this.timeExtent,signal:a?.signal});let g="";if(f?.length){g="imagery-tile"===n.type&&n.hasStandardTime()&&null!=f[0]?f.map(t=>n.getStandardTimeValue(t)).join(", "):f.join(", ");const t={ObjectId:0};t[p.servicePixelValue]="imagery-tile"===n.type&&s(n.raster)?d?.join(", "):g,t[p.rawServicePixelValue]=g;const r=n.raster?.rasterInfo??n.serviceRasterInfo,i=r?.attributeTable;if(null!=i){const{fields:e,features:r}=i,a=e.find(({name:t})=>"value"===t.toLowerCase()),s=t[p.servicePixelValue],n=a?r.find(t=>String(t.attributes[a.name])===s):null;if(n)for(const i in n.attributes)if(n.attributes.hasOwnProperty(i)){t[c+i]=n.attributes[i]}}const a=r?.dataType;"vector-magdir"!==a&&"vector-uv"!==a||(t[p.magnitude]=y?.[0],t[p.direction]=y?.[1]);const{multidimensionalDefinition:l}=n.normalizeRasterFetchOptions({timeExtent:this.timeExtent});u(n.rasterFields,t,l);const{graphicOrigin:o}=n,h=new e({geometry:this.fullExtent?.clone(),attributes:t,layer:n,origin:o,sourceLayer:n});m.push(h)}return m}highlight(t,e){return i()}async getSourceScale(){return await this.layer.load(),o(this.layer.serviceRasterInfo,this.view.spatialReference)}_getFullExtent(){return l(this.layer.serviceRasterInfo,this.view.spatialReference)}}t([a()],d.prototype,"fullExtent",null),t([a()],d.prototype,"layer",void 0),t([a({readOnly:!0})],d.prototype,"timeExtent",null),t([a()],d.prototype,"tileInfo",void 0),t([a({readOnly:!0})],d.prototype,"hasTilingEffects",null),t([a()],d.prototype,"datumTransformation",null);export{d as default};
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../Graphic.js";import r from"../../core/Error.js";import{makeHandle as i}from"../../core/handleUtils.js";import{property as a}from"../../core/accessorSupport/decorators.js";import{isFunctionRaster as s}from"../../layers/raster/datasets/datasetUtils.js";import{getDefaultDatumTransformationForDataset as n,projectDatasetExtent as l,getSourceScale as o}from"../../layers/raster/functions/rasterProjectionHelper.js";import{addMultidimensionalFieldValues as u,commonRasterFieldNames as p,rasterFieldPrefix as c}from"../../layers/support/rasterFieldUtils.js";import{hasTimeOptions as m,combineTimeExtent as f}from"../../layers/support/timeSupport.js";import y from"./LayerView.js";import{getFetchPopupTemplate as h}from"./support/popupUtils.js";class d extends y{constructor(...t){super(...t),this.layer=null,this.tileInfo=null}get fullExtent(){try{return this.layer.loaded?this._getFullExtent():null}catch{return null}}get timeExtent(){return m(this.layer)?f(this.layer,this.view?.timeExtent,this._get("timeExtent")):null}get hasTilingEffects(){if(!("renderer"in this.layer))return!1;const{renderer:t}=this.layer;return!!("raster-stretch"===t?.type&&t.dynamicRangeAdjustment&&!("min-max"===t.stretchType||"standard-deviation"===t.stretchType))}get datumTransformation(){try{return this.layer.loaded?n(this.layer.fullExtent,this.view.spatialReference,!0):null}catch{return null}}supportsSpatialReference(t){try{return!this.layer.loaded||!!l(this.layer.serviceRasterInfo,t)}catch{return!1}}async fetchPopupFeaturesAtTarget(t,i,a){const{layer:n}=this;if(!("popupTemplate"in n))return[];if(!i)throw new r("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:n});const{popupEnabled:l}=n,o=h(n,a);if(!l||null==o)return[];"polygon"===i.type&&(i=i.extent?.center);const m=[],{value:f,magdirValue:y,processedValue:d}=await n.identify(i,{timeExtent:this.timeExtent,signal:a?.signal});let g="";if(f?.length){g="imagery-tile"===n.type&&n.hasStandardTime()&&null!=f[0]?f.map(t=>n.getStandardTimeValue(t)).join(", "):f.join(", ");const t={ObjectId:0};t[p.servicePixelValue]="imagery-tile"===n.type&&s(n.raster)?d?.join(", "):g,t[p.rawServicePixelValue]=g;const r=n.raster?.rasterInfo??n.serviceRasterInfo,i=r?.attributeTable;if(null!=i){const{fields:e,features:r}=i,a=e.find(({name:t})=>"value"===t.toLowerCase()),s=t[p.servicePixelValue],n=a?r.find(t=>String(t.attributes[a.name])===s):null;if(n)for(const i in n.attributes)if(n.attributes.hasOwnProperty(i)){t[c+i]=n.attributes[i]}}const a=r?.dataType;"vector-magdir"!==a&&"vector-uv"!==a||(t[p.magnitude]=y?.[0],t[p.direction]=y?.[1]);const{multidimensionalDefinition:l}=n.normalizeRasterFetchOptions({timeExtent:this.timeExtent});u(n.rasterFields,t,l);const{graphicOrigin:o}=n,h=new e({geometry:this.fullExtent?.clone(),attributes:t,layer:n,origin:o,sourceLayer:n});m.push(h)}return m}highlight(t,e){return i()}async getSourceScale(){return await this.layer.load(),o(this.layer.serviceRasterInfo,this.view.spatialReference)}_getFullExtent(){return l(this.layer.serviceRasterInfo,this.view.spatialReference)}}t([a()],d.prototype,"fullExtent",null),t([a()],d.prototype,"layer",void 0),t([a({readOnly:!0})],d.prototype,"timeExtent",null),t([a()],d.prototype,"tileInfo",void 0),t([a({readOnly:!0})],d.prototype,"hasTilingEffects",null),t([a()],d.prototype,"datumTransformation",null);export{d as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{getAssetUrl as t}from"../../assets.js";import r from"../../Graphic.js";import s from"../../PopupTemplate.js";import{isSome as o}from"../../core/arrayUtils.js";import i from"../../core/Error.js";import{EventedAccessor as l}from"../../core/Evented.js";import a from"../../core/Logger.js";import{mappedFind as n}from"../../core/maybe.js";import{eachAlways as u,after as c}from"../../core/promiseUtils.js";import{watch as h,initial as p,whenOnce as g}from"../../core/reactiveUtils.js";import{property as d,subclass as m}from"../../core/accessorSupport/decorators.js";import y from"../../geometry/Point.js";import f from"../../geometry/SpatialReference.js";import{getPointWithElevation as S}from"../../geometry/support/geometryUtils.js";import _ from"../../portal/Portal.js";import{isApiKeyApplicable as v}from"../../support/apiKeyUtils.js";import w from"../../symbols/PictureMarkerSymbol.js";import b from"../../symbols/SimpleFillSymbol.js";import x from"../../symbols/SimpleLineSymbol.js";import L from"../../symbols/TextSymbol.js";import{highlightsSupported as I}from"../../views/support/layerViewUtils.js";import T from"./LayerSearchSource.js";import E from"./LocatorSearchSource.js";import{SourceCollection as R}from"./types.js";import{isArcGISWorldGeocoder as F,meteredArcGISLocatorUrl as P,isProxiedArcGISWorldGeocoder as j,isMeteredArcGISWorldGeocoder as O}from"./support/locatorUtils.js";import{supported as C,getCurrentPosition as G,positionToPoint as A}from"../support/geolocationUtils.js";import{GoTo as N}from"../support/GoTo.js";function D(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const M="highlight",V=f.WGS84,J="esri/images/search/search-symbol-32.png",U=/<[\s\S]*?>/g,H=-1;let k=class extends(N(l)){constructor(e){super(e),this._defaultPopupTemplate=new s({content:"{Match_addr}"}),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultSources=new R,this.defaultSymbols={point:new w({url:t(J),size:24,width:24,height:24}),polyline:new x({color:[130,130,130,1],width:2}),polygon:new b({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=_.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.resultLocation=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new R,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){this.addHandles([h(()=>[this.includeDefaultSources,this.view,this.portal],()=>this._update(),p),h(()=>this.messages,()=>{this._defaultPopupTemplate.title=this.messages?.searchResult??"",this._update()},p)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}static{this.ALL_INDEX=H}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:H}set activeSourceIndex(e){this._overrideIfSome("activeSourceIndex",e)}get allPlaceholder(){return this.messages?.allPlaceholder}set allPlaceholder(e){this._overrideIfSome("allPlaceholder",e)}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:r}=this,s="function"==typeof r?r.call(null,{sources:e,defaultSources:t}):r?t.concat(e):e,o=this._get("allSources")||new R;return o.removeAll(),o.addMany(s.filter(Boolean)),o}get defaultPopupTemplate(){return this._defaultPopupTemplate}set defaultPopupTemplate(e){this._overrideIfSome("defaultPopupTemplate",e)}get locationEnabled(){return this._get("locationEnabled")||C()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=C();if(e&&!t){const e=new i("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});a.getLogger(this).error(e)}this._override("locationEnabled",!!e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:r}=this;if(t===H)return r??"";const s=e.at(t);return s?.placeholder??""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight();const{view:e,resultGraphic:t}=this;e&&t&&e.graphics.remove(t),this._set("resultLocation",null),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const r=(async()=>{try{const r=await this._createSuggestionForSearch(e);await this.when();const s=await this._getResultsFromSources(r,t);if(t?.signal?.aborted)return null;const o={activeSourceIndex:this.activeSourceIndex,searchTerm:r.text??"",numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(o,s,r);const i=this._getFirstResult(o.results),l=r.location&&i?i.name:r.text,a=l?.replaceAll(U,"");return this._set("searchTerm",a),(r.key&&"number"==typeof r.sourceIndex||r.location)&&this._set("selectedSuggestion",r),this._set("results",o.results),this._set("resultCount",o.results.reduce((e,t)=>e+(t.results?.length??0),0)),this.emit("search-complete",o),await this._selectFirstResult(i),o}finally{this._clearSearching()}})();return this._searching=r,r}async searchNearby(e){if(!this.locationEnabled){const e=new i("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});throw a.getLogger(this).error(e),e}const t=(async()=>{try{const t=await G(),r=await A({position:t,view:this.view},e);return await this.search(r,e)}finally{this._clearSearching()}})();return this._searching=t,t}async select(e){if(this.clearGraphics(),!e){const t=new i("select:missing-parameter","Cannot select without a searchResult.",{value:e});throw a.getLogger(this).error(t),t}const{view:t}=this,s=D(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=null!=s?this.allSources.at(s):null;if(!o){const e=new i("select:missing-source","Cannot select without a source.",{source:o});throw a.getLogger(this).error(e),e}const l=o instanceof T?this._getLayerSourcePopupTemplate(o):o.popupTemplate,n=o.resultSymbol||this._getDefaultSymbol(e),c=D(o,"resultGraphicEnabled")?!!o.resultGraphicEnabled:this.resultGraphicEnabled,h=D(o,"autoNavigate")?!!o.autoNavigate:this.autoNavigate,p=D(o,"popupEnabled")?!!o.popupEnabled:this.popupEnabled,g=p?l||this.popupTemplate||this.defaultPopupTemplate:null,{feature:d}=e;if(!d){const e=new i("select:missing-feature","Cannot select without a feature.",{feature:d});throw a.getLogger(this).error(e),e}const{attributes:m,geometry:y,layer:f,sourceLayer:_}=d;let v=null;if(y){const{labelPointExecute:e}=await(import("../../geometry/operators/labelPointOperator.js"));v=e(y)}const w={layerViewQuery:this._getLayerView(d),elevationQuery:t&&null!=v?S(v,t):Promise.resolve(v)},b=await u(w),x=b.layerViewQuery.value,E=b.elevationQuery.value;n instanceof L&&(n.text=e.name);const R=t&&h?e.target||e.extent:null,F=null!=R?this._goToSearchResult(R):Promise.resolve();await F;const P=x?d:new r({geometry:y,symbol:n,attributes:m,layer:f,sourceLayer:_,popupTemplate:g});return x&&I(x)&&!p&&this._highlightFeature({graphic:P,layerView:x}),!x&&c&&t&&t.graphics.push(P),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",P),this._set("resultLocation",E),this.emit("select-result",{popupEnabled:p,result:e,source:o,sourceIndex:s}),e}async suggest(e,t,r){const s=e||this.searchTerm;this.emit("suggest-start",{searchTerm:s}),await this._suggestTimer(t,r);const o=await this._suggestImmediate(s,r);return this._set("suggestions",o?.results),this._set("suggestionCount",o?.results.reduce((e,t)=>e+(t.results?.length??0),0)??null),this.emit("suggest-complete",o),o}async when(){await g(()=>!this.updating)}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const r=this._updatingPromise=u([e?.load(),t?.when()]);if(this.destroyed)return;if(await r,r!==this._updatingPromise)return}this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){const e=this.portal?.helperServices?.geocode;if(!e)return[];return e.map(e=>{if(!1===e.placefinding)return;const t=F(e.url)&&v(e.url)?{url:P}:null,r=E.fromJSON({...e,...t}),s=r.url;if(F(s)||j(s)||O(s)){const e=r.outFields??["Addr_type","Match_addr","StAddr","City"],t=(r.placeholder||this.messages?.placeholder)??"",s="number"==typeof r.defaultZoomScale?r.defaultZoomScale:2500;r.singleLineFieldName="SingleLine",r.outFields=e,r.placeholder=t,r.defaultZoomScale=s}return r.singleLineFieldName?r:void 0}).filter(o)}_destroyFeatureLayers(){this._createdFeatureLayers.forEach(e=>e?.destroy()),this._createdFeatureLayers=[]}_getLayerSources(e,t){const r=this.view?.map;return e.map(e=>{const s=r.findLayerById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=T.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then(e=>{i.layer=e}),i}).filter(o).toArray()}_getTableSources(e,t){const r=this.view?.map;return e.map(e=>{if(!e.id)return;const s=r.findTableById(e.id);if(!s)return;const o=this._getLayerJSON(e),i=T.fromJSON(o);return i.placeholder=t,this._getLayer(s,o).then(e=>{i.layer=e}),i}).filter(o).toArray()}_convertApplicationProperties(){const e=this.view?.map,t=e?.applicationProperties?.viewing?.search;if(!t)return[];const{enabled:r,hintText:s,layers:o,tables:i}=t;if(!r)return[];return[...this._getLayerSources(o,s),...this._getTableSources(i,s)]}async _getSubLayer(e,t){if(await e.load(),!e.allSublayers)throw new Error;const r=e.allSublayers.find(e=>e.id===t.subLayer);if(!r)throw new Error;const s=await(r.createFeatureLayer?.());if(!s)throw new Error;return this._createdFeatureLayers.push(s),s}async _getBuildingSubLayer(e,t){await e.load();const r=e.allSublayers.find(e=>e.id===t.subLayer);if("building-component"!==r?.type)throw new Error;if(await r.load(),null==r.associatedLayer)throw new Error;return await r.associatedLayer.load(),r}async _getLayer(e,t){if("map-image"===e.type)try{return await this._getSubLayer(e,t)}catch(r){const t=new i("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return a.getLogger(this).error(t),null}return"building-scene"===e.type?this._getBuildingSubLayer(e,t):(await e.load(),e.capabilities?.operations?.supportsQuery?e:null)}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;this._destroyFeatureLayers(),e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_suggestTimer(e,t){const r=null!=e?e:this.suggestionDelay;return c(r,null,t?.signal)}async _createLocationForSearch(e){if(e instanceof r&&e.geometry){const{labelPointExecute:t}=await(import("../../geometry/operators/labelPointOperator.js"));return t(e.geometry)}return e instanceof y?e:Array.isArray(e)&&2===e.length?new y({longitude:e[0],latitude:e[1]}):null}async _createSuggestionForSearch(e){if(e&&D(e,"key")&&D(e,"text")&&D(e,"sourceIndex"))return e;const t=await this._createLocationForSearch(e),r="string"==typeof e?e:this.searchTerm,{selectedSuggestion:s,selectedResult:o}=this,i=!e&&s&&o,l=i&&s.key===o.key&&s.sourceIndex===o.sourceIndex,a=i&&s.location;return l||a?s:{location:t,text:t?"":r,sourceIndex:null,key:null}}_getFirstResult(e){return n(e,({results:e})=>e?.[0])??null}async _selectFirstResult(e){return this.autoSelect&&e?this.select(e):null}async _suggestImmediate(e,t){await this.when();const r=await this._getSuggestionsFromSources(e,t);if(t?.signal?.aborted)return null;const s={activeSourceIndex:this.activeSourceIndex,searchTerm:e??"",numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(s,r),s}_formatSourceResponse(e,t,r){const s=t?.value||[],o=t?.error,i=this.allSources.at(r);if(o){const t={sourceIndex:r,source:i,error:o};e.errors.push(t),a.getLogger(this).error(o),e.numErrors++}else{const t={sourceIndex:r,source:i,results:s};e.results.push(t),e.numResults+=s.length}}_formatResponse(e,t,r){if(t)if(e.activeSourceIndex===H){const s=r&&D(r,"sourceIndex")&&-1!==r.sourceIndex?r.sourceIndex:void 0;t.forEach((t,r)=>{const o=void 0!==s?s:r;this._formatSourceResponse(e,t,o)})}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}async _getResultsFromSources(e,t){const{allSources:r}=this,s=!e.location&&D(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!r.length){const e=new i("search:no-sources-defined","At least one source is required.",{allSources:r});throw a.getLogger(this).error(e),e}return s===H?r.forEach((r,s)=>{o.push(this._getResultsFromSource(e,s,t))}):o.push(this._getResultsFromSource(e,s,t)),u(o)}async _getSuggestionsFromSources(e,t){const{allSources:r,activeSourceIndex:s}=this,o=[];if(!r.length){const e=new i("suggest:no-sources-defined","At least one source is required.",{allSources:r});throw a.getLogger(this).error(e),e}return s===H?r.forEach((r,s)=>{o.push(this._getSuggestionsFromSource(e,s,t))}):o.push(this._getSuggestionsFromSource(e,s,t)),u(o)}async _getResultsFromSource(e,t,r){const s=null!=t?this.allSources.at(t):null;if(!s)return null;const{location:o=null}=e,i=this.view?.spatialReference??V,l=D(s,"maxResults")?s.maxResults:this.maxResults,a=!!(s instanceof T&&D(s,"exactMatch"))&&s.exactMatch,{view:n}=this;return s.getResults?.({exactMatch:a,location:o,maxResults:l,sourceIndex:t,spatialReference:i,suggestResult:e,view:n},r)}async _getSuggestionsFromSource(e,t,r){const s=this.allSources.at(t);if(!s)return null;e??="";const o=D(s,"suggestionsEnabled")?s.suggestionsEnabled:this.suggestionsEnabled,i=e?.length,l=D(s,"minSuggestCharacters")?s.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&i>=l){const o=this.view?.spatialReference||V,i=D(s,"maxSuggestions")?s.maxSuggestions:this.maxSuggestions,{view:l}=this,a=!!(s instanceof T&&D(s,"exactMatch"))&&s.exactMatch;return s.getSuggestions?.({view:l,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:i,exactMatch:a},r)}return null}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return D(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){return n(this.results??[],({results:t,sourceIndex:r})=>{const s=t?.includes(e);return s?r:null})??null}async _goToSearchResult(e){this._abortGoTo();const t=new AbortController;this._gotoController=t;const r={target:{target:e},options:{signal:t.signal}};e||(r.options.animate=!1),await this.callGoTo(r),this._gotoController=null}_getDefaultSymbol(e){const{defaultSymbols:t}=this,r=e.feature?.geometry;if(null==r)return null;switch(r.type){case"point":case"multipoint":return t.point;case"polyline":return t.polyline;case"extent":case"polygon":return t.polygon;default:return null}}_removeHighlight(){this.removeHandles(M)}async _getLayerView(e){const{view:t}=this;if(!e||!t)return null;const{layer:r,sourceLayer:s}=e,o=r??s;return o&&"building-component"!==o.type&&"subtype-sublayer"!==o.type?(await t.when(),t.whenLayerView(o)):null}_highlightFeature(e){const{graphic:t,layerView:r}=e,{attributes:s,layer:o,sourceLayer:i}=t,l=o??i,{objectIdField:a}=l,n=(a&&s?.[a])??null,u=r.highlight(n??t);this.addHandles(u,M)}_setResultFloor(e){const{view:t}=this,r=e.feature?.attributes,s=e.feature?.sourceLayer;if(s&&"floorInfo"in s&&s?.floorInfo?.floorField&&r){const e=r[s.floorInfo.floorField];t?.emit("select-result-floor",e)}}};e([d()],k.prototype,"_searching",void 0),e([d()],k.prototype,"_updatingPromise",void 0),e([d({readOnly:!0,value:null})],k.prototype,"activeSource",null),e([d()],k.prototype,"activeSourceIndex",null),e([d()],k.prototype,"allPlaceholder",null),e([d({readOnly:!0})],k.prototype,"allSources",null),e([d()],k.prototype,"autoNavigate",void 0),e([d()],k.prototype,"autoSelect",void 0),e([d({type:s})],k.prototype,"defaultPopupTemplate",null),e([d({readOnly:!0})],k.prototype,"defaultSources",void 0),e([d()],k.prototype,"defaultSymbols",void 0),e([d()],k.prototype,"includeDefaultSources",void 0),e([d()],k.prototype,"locationEnabled",null),e([d()],k.prototype,"maxInputLength",void 0),e([d()],k.prototype,"maxResults",void 0),e([d()],k.prototype,"maxSuggestions",void 0),e([d()],k.prototype,"messages",void 0),e([d()],k.prototype,"minSuggestCharacters",void 0),e([d({readOnly:!0})],k.prototype,"placeholder",null),e([d()],k.prototype,"popupEnabled",void 0),e([d({type:s})],k.prototype,"popupTemplate",void 0),e([d({type:_})],k.prototype,"portal",void 0),e([d()],k.prototype,"resultCount",void 0),e([d()],k.prototype,"resultGraphicEnabled",void 0),e([d({readOnly:!0})],k.prototype,"resultGraphic",void 0),e([d({readOnly:!0})],k.prototype,"resultLocation",void 0),e([d({readOnly:!0})],k.prototype,"results",void 0),e([d({readOnly:!0})],k.prototype,"selectedSuggestion",void 0),e([d()],k.prototype,"searchAllEnabled",void 0),e([d({readOnly:!0})],k.prototype,"selectedResult",void 0),e([d()],k.prototype,"searchTerm",null),e([d({type:R})],k.prototype,"sources",void 0),e([d({readOnly:!0})],k.prototype,"state",null),e([d()],k.prototype,"suggestionDelay",void 0),e([d()],k.prototype,"suggestionCount",void 0),e([d({readOnly:!0})],k.prototype,"suggestions",void 0),e([d()],k.prototype,"suggestionsEnabled",void 0),e([d({readOnly:!0})],k.prototype,"updating",null),e([d()],k.prototype,"view",void 0),e([d()],k.prototype,"clear",null),k=e([m("esri.widgets.Search.SearchViewModel")],k);const B=k;export{B as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{getAssetUrl as t}from"../../assets.js";import s from"../../Graphic.js";import r from"../../PopupTemplate.js";import{isSome as o}from"../../core/arrayUtils.js";import i from"../../core/Error.js";import{EventedAccessor as l}from"../../core/Evented.js";import a from"../../core/Logger.js";import{mappedFind as n}from"../../core/maybe.js";import{eachAlways as u,after as c}from"../../core/promiseUtils.js";import{watch as h,initial as p,whenOnce as g}from"../../core/reactiveUtils.js";import{property as d,subclass as m}from"../../core/accessorSupport/decorators.js";import y from"../../geometry/Point.js";import f from"../../geometry/SpatialReference.js";import{getPointWithElevation as S}from"../../geometry/support/geometryUtils.js";import{getPopupLayer as _}from"../../popup/support/featureUtils.js";import v from"../../portal/Portal.js";import{isApiKeyApplicable as w}from"../../support/apiKeyUtils.js";import b from"../../symbols/PictureMarkerSymbol.js";import x from"../../symbols/SimpleFillSymbol.js";import L from"../../symbols/SimpleLineSymbol.js";import I from"../../symbols/TextSymbol.js";import{highlightsSupported as T}from"../../views/support/layerViewUtils.js";import E from"./LayerSearchSource.js";import R from"./LocatorSearchSource.js";import{SourceCollection as F}from"./types.js";import{isSearchableLayer as P}from"./support/layerSearchUtils.js";import{isArcGISWorldGeocoder as j,meteredArcGISLocatorUrl as O,isProxiedArcGISWorldGeocoder as C,isMeteredArcGISWorldGeocoder as G}from"./support/locatorUtils.js";import{supported as A,getCurrentPosition as N,positionToPoint as D}from"../support/geolocationUtils.js";import{GoTo as M}from"../support/GoTo.js";function U(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const V="highlight",J=f.WGS84,H="esri/images/search/search-symbol-32.png",k=/<[\s\S]*?>/g,B=-1;let Q=class extends(M(l)){constructor(e){super(e),this._defaultPopupTemplate=new r({content:"{Match_addr}"}),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultSources=new F,this.defaultSymbols={point:new b({url:t(H),size:24,width:24,height:24}),polyline:new L({color:[130,130,130,1],width:2}),polygon:new x({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=v.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.resultLocation=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new F,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){this.addHandles([h(()=>[this.includeDefaultSources,this.view,this.portal],()=>this._update(),p),h(()=>this.messages,()=>{this._defaultPopupTemplate.title=this.messages?.searchResult??"",this._update()},p)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}static{this.ALL_INDEX=B}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:B}set activeSourceIndex(e){this._overrideIfSome("activeSourceIndex",e)}get allPlaceholder(){return this.messages?.allPlaceholder}set allPlaceholder(e){this._overrideIfSome("allPlaceholder",e)}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:s}=this,r="function"==typeof s?s.call(null,{sources:e,defaultSources:t}):s?t.concat(e):e,o=this._get("allSources")||new F;return o.removeAll(),o.addMany(r.filter(Boolean)),o}get defaultPopupTemplate(){return this._defaultPopupTemplate}set defaultPopupTemplate(e){this._overrideIfSome("defaultPopupTemplate",e)}get locationEnabled(){return this._get("locationEnabled")||A()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=A();if(e&&!t){const e=new i("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});a.getLogger(this).error(e)}this._override("locationEnabled",!!e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:s}=this;if(t===B)return s??"";const r=e.at(t);return r?.placeholder??""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight();const{view:e,resultGraphic:t}=this;e&&t&&e.graphics.remove(t),this._set("resultLocation",null),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const s=(async()=>{try{const s=await this._createSuggestionForSearch(e);await this.when();const r=await this._getResultsFromSources(s,t);if(t?.signal?.aborted)return null;const o={activeSourceIndex:this.activeSourceIndex,searchTerm:s.text??"",numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(o,r,s);const i=this._getFirstResult(o.results),l=s.location&&i?i.name:s.text,a=l?.replaceAll(k,"");return this._set("searchTerm",a),(s.key&&"number"==typeof s.sourceIndex||s.location)&&this._set("selectedSuggestion",s),this._set("results",o.results),this._set("resultCount",o.results.reduce((e,t)=>e+(t.results?.length??0),0)),this.emit("search-complete",o),await this._selectFirstResult(i),o}finally{this._clearSearching()}})();return this._searching=s,s}async searchNearby(e){if(!this.locationEnabled){const e=new i("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});throw a.getLogger(this).error(e),e}const t=(async()=>{try{const t=await N(),s=await D({position:t,view:this.view},e);return await this.search(s,e)}finally{this._clearSearching()}})();return this._searching=t,t}async select(e){if(this.clearGraphics(),!e){const t=new i("select:missing-parameter","Cannot select without a searchResult.",{value:e});throw a.getLogger(this).error(t),t}const{view:t}=this,r=U(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=null!=r?this.allSources.at(r):null;if(!o){const e=new i("select:missing-source","Cannot select without a source.",{source:o});throw a.getLogger(this).error(e),e}const l=o instanceof E?this._getLayerSourcePopupTemplate(o):o.popupTemplate,n=o.resultSymbol||this._getDefaultSymbol(e),c=U(o,"resultGraphicEnabled")?!!o.resultGraphicEnabled:this.resultGraphicEnabled,h=U(o,"autoNavigate")?!!o.autoNavigate:this.autoNavigate,p=U(o,"popupEnabled")?!!o.popupEnabled:this.popupEnabled,g=p?l||this.popupTemplate||this.defaultPopupTemplate:null,{feature:d}=e;if(!d){const e=new i("select:missing-feature","Cannot select without a feature.",{feature:d});throw a.getLogger(this).error(e),e}const{attributes:m,geometry:y}=d,f=_(d);let v=null;if(y){const{labelPointExecute:e}=await(import("../../geometry/operators/labelPointOperator.js"));v=e(y)}const w={layerViewQuery:this._getLayerView(d),elevationQuery:t&&null!=v?S(v,t):Promise.resolve(v)},b=await u(w),x=b.layerViewQuery.value,L=b.elevationQuery.value;n instanceof I&&(n.text=e.name);const R=t&&h?e.target||e.extent:null,F=null!=R?this._goToSearchResult(R):Promise.resolve();await F;const P=x?d:new s({geometry:y,symbol:n,attributes:m,layer:f,origin:d.origin,popupTemplate:g});return x&&T(x)&&!p&&this._highlightFeature({graphic:P,layerView:x}),!x&&c&&t&&t.graphics.push(P),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",P),this._set("resultLocation",L),this.emit("select-result",{popupEnabled:p,result:e,source:o,sourceIndex:r}),e}async suggest(e,t,s){const r=e||this.searchTerm;this.emit("suggest-start",{searchTerm:r}),await this._suggestTimer(t,s);const o=await this._suggestImmediate(r,s);return this._set("suggestions",o?.results),this._set("suggestionCount",o?.results.reduce((e,t)=>e+(t.results?.length??0),0)??null),this.emit("suggest-complete",o),o}async when(){await g(()=>!this.updating)}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const s=this._updatingPromise=u([e?.load(),t?.when()]);if(this.destroyed)return;if(await s,s!==this._updatingPromise)return}this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){const e=this.portal?.helperServices?.geocode;if(!e)return[];return e.map(e=>{if(!1===e.placefinding)return;const t=j(e.url)&&w(e.url)?{url:O}:null,s=R.fromJSON({...e,...t}),r=s.url;if(j(r)||C(r)||G(r)){const e=s.outFields??["Addr_type","Match_addr","StAddr","City"],t=(s.placeholder||this.messages?.placeholder)??"",r="number"==typeof s.defaultZoomScale?s.defaultZoomScale:2500;s.singleLineFieldName="SingleLine",s.outFields=e,s.placeholder=t,s.defaultZoomScale=r}return s.singleLineFieldName?s:void 0}).filter(o)}_destroyFeatureLayers(){this._createdFeatureLayers.forEach(e=>e?.destroy()),this._createdFeatureLayers=[]}_getLayerSources(e,t){const s=this.view?.map;return e.map(e=>{const r=s.findLayerById(e.id);if(!r)return;const o=this._getLayerJSON(e),i=E.fromJSON(o);return i.placeholder=t,this._getLayer(r,o).then(e=>{i.layer=e}),i}).filter(o).toArray()}_getTableSources(e,t){const s=this.view?.map;return e.map(e=>{if(!e.id)return;const r=s.findTableById(e.id);if(!r)return;const o=this._getLayerJSON(e),i=E.fromJSON(o);return i.placeholder=t,this._getLayer(r,o).then(e=>{i.layer=e}),i}).filter(o).toArray()}_convertApplicationProperties(){const e=this.view?.map,t=e?.applicationProperties?.viewing?.search;if(!t)return[];const{enabled:s,hintText:r,layers:o,tables:i}=t;if(!s)return[];return[...this._getLayerSources(o,r),...this._getTableSources(i,r)]}async _getSubLayer(e,t){if(await e.load(),!e.allSublayers)throw new Error;const s=e.allSublayers.find(e=>e.id===t.subLayer);if(!s)throw new Error;const r=await(s.createFeatureLayer?.());if(!r)throw new Error;return this._createdFeatureLayers.push(r),r}async _getBuildingSubLayer(e,t){await e.load();const s=e.allSublayers.find(e=>e.id===t.subLayer);if("building-component"!==s?.type)throw new Error;if(await s.load(),null==s.associatedLayer)throw new Error;return await s.associatedLayer.load(),s}async _getLayer(e,t){if("map-image"===e.type)try{return await this._getSubLayer(e,t)}catch(s){const t=new i("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return a.getLogger(this).error(t),null}return"building-scene"===e.type?this._getBuildingSubLayer(e,t):(await e.load(),e.capabilities?.operations?.supportsQuery?e:null)}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;this._destroyFeatureLayers(),e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_suggestTimer(e,t){const s=null!=e?e:this.suggestionDelay;return c(s,null,t?.signal)}async _createLocationForSearch(e){if(e instanceof s&&e.geometry){const{labelPointExecute:t}=await(import("../../geometry/operators/labelPointOperator.js"));return t(e.geometry)}return e instanceof y?e:Array.isArray(e)&&2===e.length?new y({longitude:e[0],latitude:e[1]}):null}async _createSuggestionForSearch(e){if(e&&U(e,"key")&&U(e,"text")&&U(e,"sourceIndex"))return e;const t=await this._createLocationForSearch(e),s="string"==typeof e?e:this.searchTerm,{selectedSuggestion:r,selectedResult:o}=this,i=!e&&r&&o,l=i&&r.key===o.key&&r.sourceIndex===o.sourceIndex,a=i&&r.location;return l||a?r:{location:t,text:t?"":s,sourceIndex:null,key:null}}_getFirstResult(e){return n(e,({results:e})=>e?.[0])??null}async _selectFirstResult(e){return this.autoSelect&&e?this.select(e):null}async _suggestImmediate(e,t){await this.when();const s=await this._getSuggestionsFromSources(e,t);if(t?.signal?.aborted)return null;const r={activeSourceIndex:this.activeSourceIndex,searchTerm:e??"",numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(r,s),r}_formatSourceResponse(e,t,s){const r=t?.value||[],o=t?.error,i=this.allSources.at(s);if(o){const t={sourceIndex:s,source:i,error:o};e.errors.push(t),a.getLogger(this).error(o),e.numErrors++}else{const t={sourceIndex:s,source:i,results:r};e.results.push(t),e.numResults+=r.length}}_formatResponse(e,t,s){if(t)if(e.activeSourceIndex===B){const r=s&&U(s,"sourceIndex")&&-1!==s.sourceIndex?s.sourceIndex:void 0;t.forEach((t,s)=>{const o=void 0!==r?r:s;this._formatSourceResponse(e,t,o)})}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}async _getResultsFromSources(e,t){const{allSources:s}=this,r=!e.location&&U(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!s.length){const e=new i("search:no-sources-defined","At least one source is required.",{allSources:s});throw a.getLogger(this).error(e),e}return r===B?s.forEach((s,r)=>{o.push(this._getResultsFromSource(e,r,t))}):o.push(this._getResultsFromSource(e,r,t)),u(o)}async _getSuggestionsFromSources(e,t){const{allSources:s,activeSourceIndex:r}=this,o=[];if(!s.length){const e=new i("suggest:no-sources-defined","At least one source is required.",{allSources:s});throw a.getLogger(this).error(e),e}return r===B?s.forEach((s,r)=>{o.push(this._getSuggestionsFromSource(e,r,t))}):o.push(this._getSuggestionsFromSource(e,r,t)),u(o)}async _getResultsFromSource(e,t,s){const r=null!=t?this.allSources.at(t):null;if(!r)return null;const{location:o=null}=e,i=this.view?.spatialReference??J,l=U(r,"maxResults")?r.maxResults:this.maxResults,a=!!(r instanceof E&&U(r,"exactMatch"))&&r.exactMatch,{view:n}=this;return r.getResults?.({exactMatch:a,location:o,maxResults:l,sourceIndex:t,spatialReference:i,suggestResult:e,view:n},s)}async _getSuggestionsFromSource(e,t,s){const r=this.allSources.at(t);if(!r)return null;e??="";const o=U(r,"suggestionsEnabled")?r.suggestionsEnabled:this.suggestionsEnabled,i=e?.length,l=U(r,"minSuggestCharacters")?r.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&i>=l){const o=this.view?.spatialReference||J,i=U(r,"maxSuggestions")?r.maxSuggestions:this.maxSuggestions,{view:l}=this,a=!!(r instanceof E&&U(r,"exactMatch"))&&r.exactMatch;return r.getSuggestions?.({view:l,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:i,exactMatch:a},s)}return null}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return U(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){return n(this.results??[],({results:t,sourceIndex:s})=>{const r=t?.includes(e);return r?s:null})??null}async _goToSearchResult(e){this._abortGoTo();const t=new AbortController;this._gotoController=t;const s={target:{target:e},options:{signal:t.signal}};e||(s.options.animate=!1),await this.callGoTo(s),this._gotoController=null}_getDefaultSymbol(e){const{defaultSymbols:t}=this,s=e.feature?.geometry;if(null==s)return null;switch(s.type){case"point":case"multipoint":return t.point;case"polyline":return t.polyline;case"extent":case"polygon":return t.polygon;default:return null}}_removeHighlight(){this.removeHandles(V)}async _getLayerView(e){const{view:t}=this;if(!e||!t)return null;const s=_(e);return s?"building-component"===s.type||"subtype-sublayer"===s.type?null:(await t.when(),t.whenLayerView(s)):null}_highlightFeature(e){const{graphic:t,layerView:s}=e,{attributes:r}=t,o=_(t);if(!P(o))return;const{objectIdField:i}=o,l=(i&&r?.[i])??null,a=s.highlight(l??t);this.addHandles(a,V)}_setResultFloor(e){const{view:t}=this,s=e.feature?.attributes,r=_(e.feature);if(P(r)&&r.floorInfo?.floorField&&s){const e=s[r.floorInfo.floorField];t?.emit("select-result-floor",e)}}};e([d()],Q.prototype,"_searching",void 0),e([d()],Q.prototype,"_updatingPromise",void 0),e([d({readOnly:!0,value:null})],Q.prototype,"activeSource",null),e([d()],Q.prototype,"activeSourceIndex",null),e([d()],Q.prototype,"allPlaceholder",null),e([d({readOnly:!0})],Q.prototype,"allSources",null),e([d()],Q.prototype,"autoNavigate",void 0),e([d()],Q.prototype,"autoSelect",void 0),e([d({type:r})],Q.prototype,"defaultPopupTemplate",null),e([d({readOnly:!0})],Q.prototype,"defaultSources",void 0),e([d()],Q.prototype,"defaultSymbols",void 0),e([d()],Q.prototype,"includeDefaultSources",void 0),e([d()],Q.prototype,"locationEnabled",null),e([d()],Q.prototype,"maxInputLength",void 0),e([d()],Q.prototype,"maxResults",void 0),e([d()],Q.prototype,"maxSuggestions",void 0),e([d()],Q.prototype,"messages",void 0),e([d()],Q.prototype,"minSuggestCharacters",void 0),e([d({readOnly:!0})],Q.prototype,"placeholder",null),e([d()],Q.prototype,"popupEnabled",void 0),e([d({type:r})],Q.prototype,"popupTemplate",void 0),e([d({type:v})],Q.prototype,"portal",void 0),e([d()],Q.prototype,"resultCount",void 0),e([d()],Q.prototype,"resultGraphicEnabled",void 0),e([d({readOnly:!0})],Q.prototype,"resultGraphic",void 0),e([d({readOnly:!0})],Q.prototype,"resultLocation",void 0),e([d({readOnly:!0})],Q.prototype,"results",void 0),e([d({readOnly:!0})],Q.prototype,"selectedSuggestion",void 0),e([d()],Q.prototype,"searchAllEnabled",void 0),e([d({readOnly:!0})],Q.prototype,"selectedResult",void 0),e([d()],Q.prototype,"searchTerm",null),e([d({type:F})],Q.prototype,"sources",void 0),e([d({readOnly:!0})],Q.prototype,"state",null),e([d()],Q.prototype,"suggestionDelay",void 0),e([d()],Q.prototype,"suggestionCount",void 0),e([d({readOnly:!0})],Q.prototype,"suggestions",void 0),e([d()],Q.prototype,"suggestionsEnabled",void 0),e([d({readOnly:!0})],Q.prototype,"updating",null),e([d()],Q.prototype,"view",void 0),e([d()],Q.prototype,"clear",null),Q=e([m("esri.widgets.Search.SearchViewModel")],Q);const Z=Q;export{Z as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{substitute as e,formatDate as t}from"../../../intl.js";import r from"../../../core/Error.js";import{clone as i}from"../../../core/lang.js";import n from"../../../core/Logger.js";import{mappedFind as l}from"../../../core/maybe.js";import{getMetersPerUnitForSR as o}from"../../../core/units.js";import s from"../../../geometry/Polygon.js";import{getExtentFromGeometry as u,scaleExtent as a}from"../../../geometry/support/geometryUtils.js";import c from"../../../rest/support/FullTextSearch.js";const
|
|
2
|
+
import{substitute as e,formatDate as t}from"../../../intl.js";import r from"../../../core/Error.js";import{clone as i}from"../../../core/lang.js";import n from"../../../core/Logger.js";import{mappedFind as l}from"../../../core/maybe.js";import{getMetersPerUnitForSR as o}from"../../../core/units.js";import s from"../../../geometry/Polygon.js";import{getExtentFromGeometry as u,scaleExtent as a}from"../../../geometry/support/geometryUtils.js";import{getPopupLayer as c}from"../../../popup/support/featureUtils.js";import d from"../../../rest/support/FullTextSearch.js";const f=/https?:\/\/services.*\.arcgis\.com/i,p=/(?:\{([^}]+)\})/g,m=()=>n.getLogger("esri.widgets.Search.support.layerSearchUtils");function g(e,t){const{exactMatch:i=!1,location:n,maxResults:l,spatialReference:s,source:u,sourceIndex:a,suggestResult:c,view:d}=e,{layer:f,filter:p,zoomScale:g}=u,y=d?.scale,S=h(u,d),R=t?.signal;return F(f).then(()=>{const e=f.popupTemplate;return e?e.getRequiredFields(f.fieldsIndex):null}).then(e=>{const{objectIdField:t,returnZ:h}=f,F=j(u);if(!L(f,F))throw m().error("invalid-field: displayField is invalid."),new r("getResults():invalid-field","displayField is invalid.");const q=e?.length?e:[F],C=u.outFields||q,M=x(C);C.includes(t)||M||C.push(t),f.floorInfo?.floorField&&C.push(f.floorInfo.floorField);if(!(M||I(f,C)))throw m().error("invalid-field: outField is invalid."),new r("getResults():invalid-field","outField is invalid.");const A=f.createQuery(),{orderByFields:O}=u;if(O&&(A.orderByFields=O),s){A.outSpatialReference=s;const e=1/o(s);e&&(A.maxAllowableOffset=e)}const k="mesh"===f.geometryType||"multipatch"===f.geometryType,D=f.capabilities?.data?.supportsZ&&!k;if(A.returnZ=D&&!1!==h,A.returnGeometry=!0,A.multipatchOption=k?"xyFootprint":null,C&&(A.outFields=C),n)A.geometry=n;else if(c.key)A.objectIds=[c.key];else{const e=u.searchFields||[F];if(!I(f,e))throw m().error("invalid-field: search field is invalid."),new r("getResults():invalid-field","search field is invalid.");T(f)&&(A.num=l),S&&(A.geometry=S);const t=c.text?.trim();if(!t)return[];const n=c.text,{prefix:o="",suffix:s=""}=u,a=E(`${o}${n}${s}`);b(f)&&w(f,e)&&!i&&n&&(A.fullText=$({text:n,searchFields:e}));const d=N({searchTerm:a,layer:f,searchFields:e,filter:p,exactMatch:i,query:A,type:"search"});if(A.where=d,!v(A))return[]}return f.queryFeatures(A,{signal:R}).then(async e=>{const{labelPointExecute:t}=await(import("../../../geometry/operators/labelPointOperator.js"));return G(e,d,u,a,F,y,g,t)})})}function y(e,t){const{source:i,spatialReference:n,view:l,suggestTerm:o,maxSuggestions:s,sourceIndex:u,exactMatch:a}=e,{layer:c,filter:d}=i,f=t?.signal,g=h(i,l);return F(c).then(()=>{if(!T(c))return[];const e=j(i),t=i.searchFields||[e],l=[];i.suggestionTemplate?i.suggestionTemplate.replaceAll(p,(e,t)=>(l.push(t),e)):l.push(e);const y=x(l);l.includes(c.objectIdField)||y||l.push(c.objectIdField);const h=L(c,e),F=y||I(c,l),S=I(c,t);if(!h)throw m().error("invalid-field: displayField is invalid."),new r("getSuggestions():invalid-field","displayField is invalid.");if(!F)throw m().error("invalid-field: outField is invalid."),new r("getSuggestions():invalid-field","outField is invalid.");if(!S)throw m().error("invalid-field: search field is invalid."),new r("getSuggestions():invalid-field","search field is invalid.");const R=c.createQuery(),{orderByFields:q}=i;q&&(R.orderByFields=q),R.outSpatialReference=n,R.returnGeometry=!1,R.num=s,R.outFields=l,g&&(R.geometry=g);if(!o.trim())return[];const{prefix:C="",suffix:M=""}=i,A=E(`${C}${o}${M}`);b(c)&&w(c,t)&&!a&&o&&(R.fullText=$({text:o,searchFields:t}));const O=N({searchTerm:A,layer:c,searchFields:t,filter:d,exactMatch:a,query:R,type:"suggest"});return R.where=O,v(R)?c.queryFeatures(R,{signal:f}).then(t=>U(t,i,u,e)):[]})}function h(e,t){const{filter:r,withinViewEnabled:i}=e,n=t?.extent,l=r?.geometry;return l??(i&&n?n:void 0)}function x(e){return e&&e.includes("*")}async function F(e){e&&await e.load()}function v(e){return!(!e.fullText&&!e.where)}function w(e,t){const r=e?.indexes;if(!r||!t?.length)return!1;return r.filter(e=>"FullText"===e.indexType).some(e=>{const r=e.fields?.split(",").map(e=>e.trim().toLowerCase())||[];return t.every(e=>r.includes(e.toLowerCase()))})}function $({text:e,searchFields:t}){return e.trim().split(" ").filter(e=>!!e.trim()).map(e=>new d({onFields:t,searchTerm:e,searchType:"prefix"}))}function b(e){return e?.capabilities?.query?.supportsFullTextSearch??!1}function T(e){return e?.capabilities?.query?.supportsPagination??!1}function S(e){return e?.fieldsIndex?.fields?.find(e=>"string"===e.type)?.name??""}function j(e){return e.displayField||e.layer.displayField||S(e.layer)}function I(e,t){return!(!e||!t?.length)&&t.every(t=>L(e,t))}function L(e,t){return!!e.getField(t)}function R(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return!0;return!1}function q({codedValues:e},t,r){return l(e??[],e=>{const i=e.name,n=r?i:i.toLowerCase();return(r?t:t.toLowerCase())===n?e.code.toString():null})??null}function E(e){return e.replaceAll("'","''")}function C(e,t){const r=t?.where;return r?`(${e}) AND (${r})`:e}function M({currentTerm:e,field:t,filter:r,exactMatch:i,url:n,type:l}){const o=t?.type,s=t?.name;if("string"===o||"date"===o||"global-id"===o){const t=f.test(n??""),o=t&&R(e)?"N":"";if(i&&"search"===l)return C(`${s} = ${o}'${e}'`,r);if(t){return C(`${s} LIKE ${o}${`'${e}%'`}`,r)}return C(`${`LOWER(${s})`} LIKE ${o}${`'${e.toLowerCase()}%'`}`,r)}if("oid"===o||"small-integer"===o||"integer"===o||"single"===o||"double"===o){const t=Number(e);return isNaN(t)?null:C(`${s} = ${t}`,r)}return C(`${s} = ${e}`,r)}function A(e,t){return e?` OR (${t})`:`(${t})`}function N({searchTerm:e,layer:t,searchFields:r,filter:i,exactMatch:n,query:l,type:o}){const{definitionExpression:s,url:u}=t;let a="";return!l.fullText&&e&&r&&r.forEach(r=>{const l=t.getField(r),s=t.getFieldDomain?.(r),c=("coded-value"===s?.type?q(s,e,n):null)||e||null;if(null!==c){const e=M({currentTerm:c,field:l,filter:i,exactMatch:n,url:u,type:o});e&&(a+=A(a,e))}}),s&&a?`(${s}) AND (${a})`:l.fullText&&s?s:a}function O(e,t){let r=null;const{codedValues:i}=e;return i&&i.length&&i.some(e=>e.code===t&&(r=e.name,!0)),r}function k(e,t){return e[t]??e[Object.keys(e).find(e=>e.toLowerCase()===t.toLowerCase())]}function D(e){return!!e&&"getField"in e&&"queryFeatures"in e}function B(r,i,n){const l=c(r);if(!D(l))return"";const{attributes:o}=r,s=l.getFieldDomain?.(n,{feature:r});if(i)return e(i,o);if(n&&o){const e=l.getField(n),r=k(o,n);return null==r?"":"coded-value"===s?.type?O(s,r)??"":"date"===e?.type?t(new Date(r)):"number"==typeof r?r.toString():"string"!=typeof r?"":r.trim()}return""}function P(e,t,r,i){const n=c(e),{attributes:l}=e,o=D(n)&&n.objectIdField?l[n.objectIdField]:null;return{text:B(e,t.suggestionTemplate,i),key:o,sourceIndex:r}}function U(e,t,r,i){return e.features.map(e=>P(e,t,r,i))}function V(e){return null!=e&&null!=e.minScale&&null!=e.maxScale}function Z(e,t,r,n,l,o,d,f){const p=e.clone(),m=c(e);p.layer=m,p.origin=e.origin;const g=D(m)?m.objectIdField:void 0,y=g?e.attributes[g]:null,h=B(e,r.searchTemplate,l);null!=o&&V(m)&&(m.minScale&&m.minScale<o?o=m.minScale:m.maxScale&&m.maxScale>o&&(o=m.maxScale));const x=u(p.geometry,t,o,f),F="number"==typeof d&&x?a(i(x),t??void 0,d):x,v=e.clone();return v.layer=m,v.origin=e.origin,null!=F&&(v.geometry=s.fromExtent(F)),{extent:F,target:v,feature:p,key:y,name:h,sourceIndex:n}}function G(e,t,r,i,n,l,o,s){return e.features.map(e=>Z(e,t,r,i,n,l,o,s))}export{$ as createFullTextSearchInfos,g as getResults,y as getSuggestions,D as isSearchableLayer};
|