@arcgis/core 6.0.0-next.23 → 6.0.0-next.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Graphic.d.ts +47 -14
- package/PopupTemplate.js +1 -1
- package/WebScene.d.ts +3 -0
- package/arcade/functions/string.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{db9921fbda556f142c4a.js → 04d55ed51e8b2683c4b4.js} +1 -1
- package/assets/esri/core/workers/chunks/{435b90168f79c5587a07.js → 04ecf15524ff3838c01c.js} +1 -1
- package/assets/esri/core/workers/chunks/{e2f42aec02bff33b25dd.js → 09300e74e5b014ce6269.js} +1 -1
- package/assets/esri/core/workers/chunks/{fcb86d24fc7e0666b564.js → 096b2bf1c0d69d27f20c.js} +1 -1
- package/assets/esri/core/workers/chunks/{612345f17f5eeb99ea8f.js → 0d9c4c6c571ce26d356b.js} +1 -1
- package/assets/esri/core/workers/chunks/{0f725cf79ce00e790a7d.js → 1168bc5c9f0a7e1f63a2.js} +1 -1
- package/assets/esri/core/workers/chunks/{12a7997a40c77f5c9160.js → 151e5799ede763a03ee2.js} +1 -1
- package/assets/esri/core/workers/chunks/{a64446a3328a7323e307.js → 173f89c55a5c79ff065b.js} +1 -1
- package/assets/esri/core/workers/chunks/{8715661a838361d4211a.js → 1b24a40c0fa197014873.js} +1 -1
- package/assets/esri/core/workers/chunks/{ca0d4ce453d8eb35467d.js → 277263466837e1673f56.js} +1 -1
- package/assets/esri/core/workers/chunks/{b1d989b72203113a06fe.js → 2a36fe3f3f257a779a1b.js} +1 -1
- package/assets/esri/core/workers/chunks/{ffcb99693182a621a93e.js → 2cf8172be83b10b11bdc.js} +1 -1
- package/assets/esri/core/workers/chunks/{fcaf9450642fcef83286.js → 3048e74e6246324ce6fc.js} +1 -1
- package/assets/esri/core/workers/chunks/{95b82cbbe355266c65d7.js → 30af63b3b750142faadb.js} +1 -1
- package/assets/esri/core/workers/chunks/30dcf2cfb31cb70de7df.js +1 -0
- package/assets/esri/core/workers/chunks/{9f0a973a0dd28953ce25.js → 371e2ddb88cc6b9a41e8.js} +1 -1
- package/assets/esri/core/workers/chunks/3fd5c3cd8457ddc68798.js +1 -0
- package/assets/esri/core/workers/chunks/{62fec1816907f070f079.js → 3fe04f13215474accb09.js} +1 -1
- package/assets/esri/core/workers/chunks/{f47fe4433b05fca5c3ad.js → 42f6194633c2d879c8da.js} +1 -1
- package/assets/esri/core/workers/chunks/{cddc3e285f763ccf33c2.js → 4869e097261ded90b8bb.js} +1 -1
- package/assets/esri/core/workers/chunks/{d8a7eba588d374b2f961.js → 4bb9a5f4ca944d3fc206.js} +1 -1
- package/assets/esri/core/workers/chunks/{8052da8be251c3ff2176.js → 4d93bed14945e3d34d5c.js} +1 -1
- package/assets/esri/core/workers/chunks/{65cb5e39c467a35621ca.js → 56e903ccef66cbe18f92.js} +1 -1
- package/assets/esri/core/workers/chunks/{44d5508042cacdfcac47.js → 58da3f8cf0f7f6a7e4fa.js} +1 -1
- package/assets/esri/core/workers/chunks/{bc915fb182d463d804e6.js → 5c04835b0b52461183cd.js} +1 -1
- package/assets/esri/core/workers/chunks/{7e8611cb709f105946f5.js → 6061232c96e11eb7b25d.js} +1 -1
- package/assets/esri/core/workers/chunks/{1e514e1c9aabefa04201.js → 64382363d6dc04ff1eac.js} +1 -1
- package/assets/esri/core/workers/chunks/{c82daefb193aae895bc0.js → 67e06d606c7fd2064adf.js} +1 -1
- package/assets/esri/core/workers/chunks/{434a8ba841a59e0deab9.js → 67e533748435253aaba6.js} +1 -1
- package/assets/esri/core/workers/chunks/{feb41abc03d677df6f73.js → 6b9961261241fdce0e94.js} +1 -1
- package/assets/esri/core/workers/chunks/{949bee7b304e625a7891.js → 6db0f8fe1402643fbe1a.js} +1 -1
- package/assets/esri/core/workers/chunks/{96c4ea9cfa3930f1c3fb.js → 6f1d6453184e0a1530ad.js} +1 -1
- package/assets/esri/core/workers/chunks/6f897b4e7ddd1dd1672b.js +1 -0
- package/assets/esri/core/workers/chunks/{0049b66ccbfb168caa76.js → 7124ad8dc5ad40dc66f3.js} +1 -1
- package/assets/esri/core/workers/chunks/{6e107ce73633de8ac257.js → 72f4dad65e16a7d7c58f.js} +1 -1
- package/assets/esri/core/workers/chunks/{0df9a906f7823c23d426.js → 7566321c6a2913f2852b.js} +1 -1
- package/assets/esri/core/workers/chunks/{c4ddac23bd649d24f3f2.js → 75d551a449bba61ce238.js} +1 -1
- package/assets/esri/core/workers/chunks/{af349c7bc8ef41a0e1bd.js → 7748c2886d0122b40eeb.js} +1 -1
- package/assets/esri/core/workers/chunks/{b4c3ec081874b49ff89b.js → 78fbe330f16bdbdb886e.js} +1 -1
- package/assets/esri/core/workers/chunks/79483c05867ba1386f5a.js +1 -0
- package/assets/esri/core/workers/chunks/7b482afb9fd1229f5707.js +1 -0
- package/assets/esri/core/workers/chunks/7c631e2947243e2c9bde.js +1 -0
- package/assets/esri/core/workers/chunks/7db9e615e60d824eac1b.js +1 -0
- package/assets/esri/core/workers/chunks/{8a7b02037151767542f1.js → 7dbf4c7480bf9c72820d.js} +1 -1
- package/assets/esri/core/workers/chunks/{64b360625c68cb863a08.js → 84940d8e14caf5a27e04.js} +1 -1
- package/assets/esri/core/workers/chunks/{1b1d3f6916d2cb751435.js → 87177e0f82e8a6ae3189.js} +1 -1
- package/assets/esri/core/workers/chunks/{5cb26bbaa08114aec5ce.js → 89cc1a5539b82fb46216.js} +1 -1
- package/assets/esri/core/workers/chunks/{9d40786c5ceface786ba.js → 8a485130781b49dbf608.js} +1 -1
- package/assets/esri/core/workers/chunks/8b5dcc4282772bf6b675.js +1 -0
- package/assets/esri/core/workers/chunks/{8c12269d26f5a4c753cb.js → 8ebaf5754e86a45b0497.js} +1 -1
- package/assets/esri/core/workers/chunks/{542e5640ea1b80ef801a.js → 9189dfe19a2a2ccd5173.js} +1 -1
- package/assets/esri/core/workers/chunks/{67a35155b8b4d36f171e.js → 926e0a3827eaf16ca8b4.js} +1 -1
- package/assets/esri/core/workers/chunks/{dc1761cba0454fda3cf9.js → 9630234267098115de4d.js} +1 -1
- package/assets/esri/core/workers/chunks/{10d80e793019dfb45ca2.js → 987424121cf30b0f3c50.js} +1 -1
- package/assets/esri/core/workers/chunks/9afc87474cef1fc4fe4a.js +1 -0
- package/assets/esri/core/workers/chunks/{facd1ff23203fed67686.js → 9b048f80c2d28d527373.js} +1 -1
- package/assets/esri/core/workers/chunks/9dd48e75b4e8d9811d81.js +1 -0
- package/assets/esri/core/workers/chunks/{ee08ae5b73439a1ff666.js → a163c6005aba3378edaa.js} +1 -1
- package/assets/esri/core/workers/chunks/{517106048980a3cbe072.js → a4b822ee45810c4c292a.js} +1 -1
- package/assets/esri/core/workers/chunks/{092e311cb7aea92a6a26.js → acb265a22be5e12f38e5.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a411ddae7a47015370c.js → acf4737ba509cbd73cce.js} +1 -1
- package/assets/esri/core/workers/chunks/{d247dd53788d512b9c9f.js → af3c6794334626b94f00.js} +1 -1
- package/assets/esri/core/workers/chunks/{532e9cda8ac3601d8892.js → b12acf1f694f82e00df9.js} +1 -1
- package/assets/esri/core/workers/chunks/{636cd05abfbdff19029e.js → ba3d5abff65aefcb8dee.js} +1 -1
- package/assets/esri/core/workers/chunks/{504184828048310a052c.js → bdc221d94300c225665a.js} +1 -1
- package/assets/esri/core/workers/chunks/c0eb27263f608dc3684b.js +1 -0
- package/assets/esri/core/workers/chunks/c2318c014e97ba519be8.js +1 -0
- package/assets/esri/core/workers/chunks/{7f8e327acad48c9e75ea.js → c62237c344e341619341.js} +1 -1
- package/assets/esri/core/workers/chunks/{a2ad3e620c98e2b2eb06.js → cd355baab983033c3ef0.js} +1 -1
- package/assets/esri/core/workers/chunks/{7be6d621a0d1e33dfff4.js → d070fcb73ce274ab80e4.js} +1 -1
- package/assets/esri/core/workers/chunks/{6d41444b46677aa762a7.js → db41490bd39d863305bf.js} +1 -1
- package/assets/esri/core/workers/chunks/{fc5a36e54929e03efa86.js → dba5f44c4e4a3f075df2.js} +1 -1
- package/assets/esri/core/workers/chunks/{3e30b96a8c75bd5b9ae2.js → ddc95cdac6c06fc4794c.js} +1 -1
- package/assets/esri/core/workers/chunks/{a5c8f9f5be4ef5063b42.js → df26ec0b508cf4716e0a.js} +1 -1
- package/assets/esri/core/workers/chunks/{f426da2210888cc264b4.js → e83f9abee611c5b80009.js} +1 -1
- package/assets/esri/core/workers/chunks/{8487727f1197cf7dbf50.js → ef12fa3574d4cbf8b084.js} +1 -1
- package/assets/esri/core/workers/chunks/f10c883eb26330e3421c.js +1 -0
- package/assets/esri/core/workers/chunks/f46e92c67986c8c09bdd.js +1 -0
- package/assets/esri/core/workers/chunks/{709e019885822b1f6f3e.js → f905f1a1aa4c123cbe83.js} +1 -1
- package/assets/esri/core/workers/chunks/{5b91e2dffdc84c006539.js → fb37f0848196c28b7fd7.js} +1 -1
- package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
- package/assets/esri/libs/librust-text/pkg/text_bg.wasm +0 -0
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/basis_encoder.js +1 -1
- package/chunks/basis_transcoder.js +1 -1
- package/chunks/draco_mesh_decoder.js +1 -1
- package/chunks/dxt_encoder.js +1 -1
- package/chunks/i3s.js +1 -1
- package/chunks/lclayout.js +1 -1
- package/chunks/lerc-wasm.js +1 -1
- package/chunks/libtess-f32.js +1 -1
- package/chunks/libtess-f64.js +1 -1
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/chunks/parquet.js +1 -1
- package/chunks/qb3-wasm.js +1 -1
- package/chunks/rbush.js +1 -1
- package/chunks/text.js +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/config.js +1 -1
- package/core/workers/WorkerFallback.js +4 -2
- package/core/workers/workerFactory.js +1 -1
- package/core/workers/workers.js +4 -2
- package/geometry/support/labelPoint.js +1 -1
- package/graphic/AnnotationFeatureGraphicOrigin.d.ts +49 -9
- package/graphic/BuildingGraphicOrigin.d.ts +49 -0
- package/graphic/CSVGraphicOrigin.d.ts +42 -9
- package/graphic/CatalogGraphicOrigin.d.ts +42 -9
- package/graphic/DimensionFeatureGraphicOrigin.d.ts +42 -9
- package/graphic/FeatureGraphicOrigin.d.ts +42 -9
- package/graphic/GeoJSONGraphicOrigin.d.ts +42 -9
- package/graphic/GeoRSSGraphicOrigin.d.ts +42 -9
- package/graphic/GraphicOrigin.d.ts +52 -12
- package/graphic/ImageryGraphicOrigin.d.ts +42 -9
- package/graphic/ImageryTileGraphicOrigin.d.ts +42 -9
- package/graphic/KMLGraphicOrigin.d.ts +47 -10
- package/graphic/KnowledgeGraphGraphicOrigin.d.ts +49 -1
- package/graphic/LinkChartGraphicOrigin.d.ts +49 -1
- package/graphic/MapImageGraphicOrigin.d.ts +49 -1
- package/graphic/MapNotesGraphicOrigin.d.ts +48 -1
- package/graphic/OGCFeatureGraphicOrigin.d.ts +42 -9
- package/graphic/OrientedImageryGraphicOrigin.d.ts +42 -9
- package/graphic/ParquetGraphicOrigin.d.ts +42 -9
- package/graphic/PointCloudGraphicOrigin.d.ts +43 -0
- package/graphic/SceneGraphicOrigin.d.ts +43 -0
- package/graphic/SketchGraphicOrigin.d.ts +43 -0
- package/graphic/StreamGraphicOrigin.d.ts +43 -0
- package/graphic/SubtypeGroupGraphicOrigin.d.ts +49 -1
- package/graphic/TileGraphicOrigin.d.ts +49 -1
- package/graphic/VectorTileGraphicOrigin.d.ts +43 -14
- package/graphic/VoxelGraphicOrigin.d.ts +43 -0
- package/graphic/WCSGraphicOrigin.d.ts +43 -0
- package/graphic/WFSGraphicOrigin.d.ts +42 -9
- package/graphic/getGraphicOriginTitle.d.ts +21 -3
- package/kernel.js +1 -1
- package/layers/GaussianSplatLayer.d.ts +2 -1
- package/layers/ParquetLayer.d.ts +24 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/mixins/ReloadableLayer.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/save/featureLayerUtils.js +1 -1
- package/layers/save/imageryUtils.js +1 -1
- package/layers/save/mapImageLayerUtils.js +1 -1
- package/layers/save/mediaLayerUtils.js +1 -1
- package/layers/save/parquetLayerUtils.js +2 -0
- package/layers/save/streamLayerUtils.js +1 -1
- package/layers/support/LabelClass.d.ts +8 -2
- package/layers/support/layersMapping.js +1 -1
- package/layers/support/rasterJobHelper.js +1 -1
- package/layers/video/VideoController.js +5 -5
- package/package.json +2 -2
- package/popup/content.js +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/portal/schemas/webScene.js +1 -1
- package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
- package/rest/query/operations/pbfFlatFeatureSet.js +1 -1
- package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
- package/undoredo/support/ApplySet.js +1 -1
- package/views/2d/engine/flow/ProcessingTimeEstimate.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/LabelParameters.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
- package/views/3d/layers/graphics/pointUtils.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/layers/support/Tiles3DBVH.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/groundNavigationUtils.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/worldSizedRibbonLineIntersectionUtils.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/draw/SegmentDrawAction.js +1 -1
- package/views/interactive/snapping/SnappingManagerPool.js +1 -1
- package/views/interactive/tooltip/content/TooltipContent.js +1 -1
- package/views/interactive/tooltip/fields/TooltipField.js +1 -1
- package/views/support/LayerViewManager.js +1 -1
- package/views/support/ScheduledQueueProcessor.js +1 -1
- package/views/support/screenshotUtils.js +1 -1
- package/views/ui/UI.js +1 -1
- package/webdoc/support/webdocSaveUtils.js +1 -1
- package/webscene/Slide.d.ts +1 -2
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
- package/widgets/FeatureTable/RelationshipColumn.js +1 -1
- package/widgets/OrientedImageryViewer/ImageMeasurementWorker.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +0 -1
- package/assets/esri/core/workers/chunks/42753cf4965a94bc91ca.js +0 -1
- package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +0 -1
- package/assets/esri/core/workers/chunks/5046214dd32029cb733d.js +0 -1
- package/assets/esri/core/workers/chunks/58865772bed48141a56a.js +0 -1
- package/assets/esri/core/workers/chunks/72e6d594b7262430ae55.js +0 -1
- package/assets/esri/core/workers/chunks/7d11710e1586a3d75887.js +0 -1
- package/assets/esri/core/workers/chunks/8f74d92ac69714b9fd4e.js +0 -1
- package/assets/esri/core/workers/chunks/947674b2ca8be65b9bcc.js +0 -1
- package/assets/esri/core/workers/chunks/9e7c4eda135c4911b268.js +0 -1
- package/assets/esri/core/workers/chunks/a09d2e1e2540921e4717.js +0 -1
- package/assets/esri/core/workers/chunks/dfa5f1311806473e473f.js +0 -1
- package/assets/esri/core/workers/chunks/fc76aff0f7d95e517d8f.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as n,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as a}from"../../../../core/time.js";import{copy as o,set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as l,subtract as u,dot as d,scale as f,add as p,copy as m,length as h,distance as g,lerp as _,transformMat4 as v,normalize as y}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPoints as S,distance2 as C,closestLineSegmentPoint as w,projectPoint as T,projectPointFraction as E,create as D}from"../../../../geometry/support/lineSegment.js";import{fromPoints as O,signedDistance as k,getNormal as ee,create as A}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as te,BufferViewFloat as j,BufferViewVec4Unorm8 as ne,BufferViewVec4f16 as re,BufferViewUint32 as ie}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as ae,isColor as M,isDepth as oe,isColorHighlightOLIDOrDepth as se,is2DGeometryOutput as ce}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as le}from"../effects/geometry/olidUtils.js";import ue from"../lib/GLMaterial.js";import{LineMaterial as de}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as fe,screenPolygonIntersectsBufferedSegment as pe}from"../lib/screenPolygonOverlapUtils.js";import{Hit as me,DrapedHit as he}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as ge}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as _e,assert as N}from"../lib/Util.js";import{isImagePattern as ve}from"./lineStippleUtils.js";import{VisualVariablePassParameters as ye}from"./VisualVariablePassParameters.js";import{writeColor as be}from"./internal/bufferWriterUtils.js";import{intersectRayWithWorldSizedLineSegment as xe}from"./internal/worldSizedRibbonLineIntersectionUtils.js";import{n as Se}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as Ce,getTextureBufferLayout as we}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as Te}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as Ee}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as De}from"../../../../webscene/support/AlphaCutoff.js";class Oe extends de{constructor(e,t){super(e,Ae),this.produces=new Map([[2,e=>ae(e)||M(e)&&this.parameters.renderOccluded===8],[3,e=>oe(e)],[10,e=>se(e)&&this.parameters.renderOccluded===8],[11,e=>se(e)&&this.parameters.renderOccluded===8],[4,e=>M(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[8,e=>M(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[18,e=>ce(e)]]),this._configuration=new Ee(t.state.isGlobal),this._isAssumedMetalDriver=t.stage.renderer.renderContext.rctx.isAssumedMetalDriver}updateConfiguration(e){super.updateConfiguration(e),this._configuration.useFlatJoinVarying=!this._isAssumedMetalDriver;let t=this.parameters.stipplePattern!=null&&this.parameters.stippleTexture!=null&&e.output!==10,n=t&&this.parameters.isImagePattern()&&this._configuration.draped,r=this.parameters.usesWorldSizedWidth(n);this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=t,this._configuration.stippleOffColorEnabled=t&&this.parameters.stippleOffColor!=null,this._configuration.stipplePreferContinuous=t&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=Pe(this.parameters.join,t),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins=this.parameters.join===`round`,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=this.parameters.markerParameters!=null&&Ne(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&this.parameters.innerColor!=null,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=+!!this.emissions,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSized=r,this._configuration.imagePattern=n}get visible(){return this.parameters.color[3]>=De||this.parameters.stipplePattern!=null&&(this.parameters.stippleOffColor?.[3]??0)>De}get emissions(){return this.parameters.emissiveStrength>0?this.parameters.renderOccluded===8?1:2:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},n,r,i,a,o,s){if(!n.options.selectionMode)return;let c=this._getLineSize(e,!0),l=r[0],u=r[1],d=I(c,o,s,this.parameters.usesWorldSizedWidth()),f=Number.MAX_VALUE,p=0;for(let n of Me(z,B,this.parameters,e)){let e=l-z[0],r=u-z[1],i=B[0]-z[0],a=B[1]-z[1],o=i*e+a*r,s=i*i+a*a,c=t(o/s,0,1),d=i*c-e,m=a*c-r,h=d*d+m*m;h<f&&(f=h,p=n)}f<d*d&&i(a.distance,a.renderDistance,a.normal,p)}intersectRay(t,n,r,i,a,o){let{options:s,camera:c}=r;if(!s.selectionMode||!t.visible||!c)return;if(!_e(n)){e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`);return}let l=this._getLineSize(t.attributes);this.parameters.worldSized?this._intersectRayWithWorldSizedLine(t,n,r,l,o):this._intersectRayWithScreenSizedLine(t,n,r,l,o)}_intersectRayWithScreenSizedLine(e,t,n,r,i){let{camera:a}=n,s=e.attributes,c=s.get(`position`).data,_=G;o(_,n.point);let v=r*a.pixelRatio,y=$*a.pixelRatio,b=v/2+y;l(Z[0],_[0]-b,_[1]+b,0),l(Z[1],_[0]+b,_[1]+b,0),l(Z[2],_[0]+b,_[1]-b,0),l(Z[3],_[0]-b,_[1]-b,0);for(let e=0;e<4;e++)if(!a.unprojectFromRenderScreen(Z[e],Q[e]))return;O(a.eye,Q[0],Q[1],Ue),O(a.eye,Q[1],Q[2],We),O(a.eye,Q[2],Q[3],Ge),O(a.eye,Q[3],Q[0],Ke);let x=Number.MAX_VALUE,T=0;for(let e of this._forEachTransformedLineSegment(L,R,c,t,F(this.parameters,s))){if(k(Ue,L)<0&&k(Ue,R)<0||k(We,L)<0&&k(We,R)<0||k(Ge,L)<0&&k(Ge,R)<0||k(Ke,L)<0&&k(Ke,R)<0)continue;let t=a.projectToRenderScreen(L,K),n=a.projectToRenderScreen(R,q);if(t==null||n==null)continue;if(t[2]<0&&n[2]>0){u(U,L,R);let e=a.frustum,n=-k(e[4],L)/d(U,ee(e[4]));if(f(U,U,n),p(L,L,U),!a.projectToRenderScreen(L,t))continue}else if(t[2]>0&&n[2]<0){u(U,R,L);let e=a.frustum,t=-k(e[4],R)/d(U,ee(e[4]));if(f(U,U,t),p(R,R,U),!a.projectToRenderScreen(R,n))continue}else if(t[2]<0&&n[2]<0)continue;t[2]=0,n[2]=0;let i=S(t,n,J),o=C(i,_);if(!(o>=x)){if(this.parameters.screenSizePerspective){let e=this.computeScreenSizePerspectiveWidth(i,L,R,_,a,r,y);if(o>=e*e)continue}x=o,m(ze,L),m(Be,R),T=e}}if(x<b*b){let{rayBegin:e,rayEnd:t}=n,r=Number.MAX_VALUE;if(w(S(ze,Be,J),S(e,t,He),W)){u(W,W,e);let n=h(W);f(W,W,1/n),r=n/g(e,t)}i(r,r,W,T)}}_intersectRayWithWorldSizedLine(e,t,n,r,i){let{camera:a,ray:o,metersPerRenderUnit:s}=n,c=e.attributes,l=c.get(`position`).data,u=r/(2*s),d=1/0,f=0;for(let e of this._forEachTransformedLineSegment(L,R,l,t,F(this.parameters,c))){let t=xe(L,R,u,a,o,Ve);if(t!=null&&t<d&&(d=t,f=e,m(W,Ve),t===0))break}d<1/0&&i(d,d,W,f)}intersectScreenPolygon(t,n,r,i){let{options:a,camera:o,screenPolygonPrimitiveProcessor:s}=r;if(!a.selectionMode||!t.visible)return null;if(!_e(n))return e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`),null;let c=t.attributes,l=c.get(`position`).data,u=this._getLineSize(c),d=$,f=d*o.pixelRatio,p=new me(4);for(let e of this._forEachTransformedLineSegment(L,R,l,n,F(this.parameters,c)))for(let[t,n]of s.processLineSegment(Je,L,R)){if(!fe(o,t,n,K,q))continue;let r=S(K,q,J),a=u/2+d;this.parameters.screenSizePerspective&&(_(G,K,q,.5),a=Math.max(a,this.computeScreenSizePerspectiveWidth(r,t,n,G,o,u,f)/o.pixelRatio)),o.renderToScreen(K,Le),o.renderToScreen(q,Re),pe(i,Le,Re,a)&&(T(S(t,n,He),o.eye,V),p.updateIfCloserFromValues(g(o.eye,V),e,V,null))}return p}intersectScreenPolygonDraped({attributes:e},t,n,r,i,a){if(!n.options.selectionMode)return null;let o=I(this._getLineSize(e,!0),i,a,this.parameters.usesWorldSizedWidth());for(let n of Me(z,B,this.parameters,e,t))if(pe(r,z,B,o))return new he(n);return null}createBufferWriter(){return new je(Ce(this.parameters),we(this.parameters),this.parameters,this._isAssumedMetalDriver)}createGLMaterial(e){return new ke(e)}validateParameters(e){e.join!==`miter`&&(e.miterLimit=0),e.markerParameters!=null&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return this.parameters.hasAnimation?(this.setParameters({timeElapsed:i(e.time)},!1),e.dt!==0):!1}computeScreenSizePerspectiveWidth(e,t,n,r,i,a,o){let s=E(e,r);_(V,t,n,s),v(Ie,V,i.viewMatrix);let c=h(Ie),l=this.computeCameraAbsCosAngle(V,i,this._configuration.spherical);return Fe.update(l,c,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize),Fe.apply(a)*i.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,n){return n?y(W,e):l(W,0,0,1),u(H,e,t.eye),y(H,H),Math.abs(d(W,H))}_getLineSize(e,n=!1){let r=this.parameters.width;if(this.parameters.vvSize){let i=e.get(`sizeFeatureAttribute`).data[0];Number.isNaN(i)?n&&(r*=this.parameters.vvSize.fallback[0]):r*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has(`size`)&&(r*=e.get(`size`).data[0]);return r}*_forEachTransformedLineSegment(e,t,n,r,i){let a=i?n.length-2:n.length-5;for(let i=0;i<a;i+=3){e[0]=n[i]+r[12],e[1]=n[i+1]+r[13],e[2]=n[i+2]+r[14];let a=(i+3)%n.length;t[0]=n[a]+r[12],t[1]=n[a+1]+r[13],t[2]=n[a+2]+r[14],yield i/3}}}class ke extends ue{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){let{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(Te,e)}}class Ae extends ye{constructor(){super(...arguments),this._width=0,this.color=x,this.join=`miter`,this.cap=0,this.miterLimit=5,this.shadingEnabled=!1,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=a(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=a(0),this.endTime=a(1/0),this.worldSized=!1}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||this.stipplePattern!=null&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return this.animation!==0}usesWorldSizedWidth(e=this.isImagePattern()){return this.worldSized||e}isImagePattern(){return ve(this.stipplePattern)&&this.stippleTexture!=null}}class je{constructor(e,t,n,r){this.layout=e,this.textureBufferLayout=t,this._parameters=n,this._isAssumedMetalDriver=r,this.numJoinSubdivisions=Pe(this._parameters.join,this._parameters.stipplePattern!=null)}_isClosed(e){return F(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get(`position`).data.length/3+(this._isClosed(e)?3:2)}elementCount(e){let t=e.get(`position`).indices.length/2+1,n=this._isClosed(e),r=n?2:4,i=+!n,a=n?t:t-1,o=this.numJoinSubdivisions*2+(this._isAssumedMetalDriver?8:4);return r+=(a-i)*o,r+=2,this._parameters.wireframe&&(r=2+(r-2)*4),r}write(e,t,n,r,i,a){a!=null&&this._writeTextureBuffer(e,n,a),r!=null&&this._writeVertexBuffer(e,n,r,i)}_writeTextureBuffer(e,t,n){let r=t.get(`position`),i=r.data.length/3,a=this._isClosed(t),{buffer:o,offset:s}=n,c=o.getField(`position`,te),l=o.getField(`u0`,j),u=o.getField(`sizeFeatureAttribute`,j),d=o.getField(`size`,j),f=o.getField(`colorFeatureAttribute`,j),p=o.getField(`color`,ne),h=o.getField(`olidColor`,ne),_=o.getField(`timeStamps`,re),v=o.getField(`opacityFeatureAttribute`,j),y=t.get(`sizeFeatureAttribute`)?.data,b=t.get(`size`)?.data,x=t.get(`colorFeatureAttribute`)?.data,S=t.get(`color`)?.data,C=t.get(`opacityFeatureAttribute`)?.data,w=t.get(`distanceToStart`)?.data,T=t.get(`timeStamps`);N(c!==null,`Expected valid position field in texture buffer`),N(l!==null,`Expected valid u0 field in texture buffer`);let E=0;for(let t=0;t<i;++t){this._getTransformedPosition(X,r.data,t,e),t>0&&(w==null?E+=g(Y,X):E=w[t]??E);let n=s+t+1;if(c.setVec(n,X),l.set(n,E),m(Y,X),u&&u.set(n,y?.length===1?y[0]:y?.[t]??0),d&&d.set(n,b?.length===1?b[0]:b?.[t]??1),f&&f.set(n,x?.length===1?x[0]:x?.[t]??0),p){if(S!=null){let e=Math.min(t*4,S.length-4);p.setValues(n,S[e],S[e+1],S[e+2],S[e+3])}else p.setValues(n,1,1,1,1)}v&&v.set(n,C?.length===1?C[0]:C?.[t]??0)}if(_!=null&&T!=null){N(T.size===4);let e=T.data;for(let t=0;t<i;++t){let n=t*4,r=s+t+1;_.set(r,0,e[n]),_.set(r,1,e[n+1]),_.set(r,2,e[n+2]),_.set(r,3,e[n+3])}}if(a){let e=s,t=s+1,n=s+2,r=s+i,a=r+1,u=r+2;o.copyItem(r,e),o.copyItem(t,a),o.copyItem(n,u),c.getVec(r,Y),c.getVec(t,X);let d=w?.[i]??E+g(Y,X);l.set(a,d)}else{let e=s,t=s+1,n=s+i,r=n+1;o.copyItem(t,e),o.copyItem(n,r)}let D=t.get(`olidColor`);le()&&D!=null&&h!=null&&be(D,4,h,s)}_writeVertexBuffer(e,t,n,r){let{buffer:i,offset:a}=n,{layout:o}=this,s=t.get(`position`),c=s.indices,l=s.data.length/3,u=this._isClosed(t),d=l+(u?3:2);c&&c.length!==2*(l-1)&&console.warn(`RibbonLineMaterial does not support indices`);let f=i.getField(`textureElementIndex`,ie);N(f!=null,`Missing texture buffer index field`),N(r!=null,`Using a texture layout, but the texture range for this instance was not provided`);let p=r.from;N(r.numElements===d,`Expected number of elements in TextureBuffer to equal number of points`);let m=new Float32Array(i.buffer),h=new Float16Array(i.buffer),g=new Uint32Array(i.buffer),_=o.stride/4,v=a*_,y=v,b=m.BYTES_PER_ELEMENT/h.BYTES_PER_ELEMENT,x=(e,t,n,r=!1)=>{let i=n+1;g[v]=p+i,v++;let a=v*b;h[a++]=e,h[a++]=t+(r?Math.sign(t)*8:0),v=Math.ceil(a/b)};v+=_;let S=0,C=0;u?(S=0,C=l):(x(1,-4,0),x(1,4,0),S=1,C=l-1);let w=this._isAssumedMetalDriver;for(let e=S;e<C;e++){x(0,-1,e),x(0,1,e),w&&(x(0,-1,e,!0),x(0,1,e,!0));let t=this.numJoinSubdivisions;for(let n=0;n<t;++n){let r=(n+1)/(t+1);x(r,-1,e,w),x(r,1,e,w)}x(1,-2,e,w),x(1,2,e,w),w&&(x(1,-2,e),x(1,2,e))}u?(x(0,-1,C),x(0,1,C)):(x(0,-5,C),x(0,5,C)),P(m,y+_,m,y,_),v=P(m,v-_,m,v,_),this._parameters.wireframe&&this._addWireframeVertices(i,y,v,_)}_getTransformedPosition(e,t,n,r){let i=n*3;l(e,t[i+0],t[i+1],t[i+2]),r&&v(e,e,r)}_addWireframeVertices(e,t,n,r){let i=new Uint8Array(e.buffer,n*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(n-t)*Float32Array.BYTES_PER_ELEMENT),o=r*Float32Array.BYTES_PER_ELEMENT,s=0,c=e=>s=P(a,e,i,s,o);for(let e=0;e<=a.length-4*o;e+=o*2)c(e),c(e+2*o),c(e+1*o),c(e+2*o),c(e+1*o),c(e+3*o)}}function P(e,t,n,r,i){for(let a=0;a<i;a++)n[r++]=e[t++];return r}function F(e,t){return e.isClosed?t.get(`position`).indices.length>2:!1}function I(e,t,n,r){return r?e/(2*n)+$*t:(e/2+$)*t}function*Me(e,t,n,r,i){let a=r.get(`position`).data,c=F(n,r)?a.length-2:a.length-5,l=i?.[0]??0,u=i?.[1]??0;s(e,a[0]+l,a[1]+u);for(let n=3;n<c+3;n+=3){let r=n%a.length;s(t,a[r]+l,a[r+1]+u),yield n/3,o(e,t)}}function Ne(e){return e.anchor===1&&e.hideOnShortSegments&&e.placement===`begin-end`&&e.worldSpace}function Pe(e,t){let n=+!!t;switch(e){case`miter`:case`bevel`:return n;case`round`:return Se+n}}const Fe=new ge,L=b(),R=b(),z=c(),B=c(),V=b(),Ie=b(),H=b(),U=b(),W=b(),G=b(),K=n(),q=n(),Le=r(),Re=r(),ze=b(),Be=b(),Ve=b(),J=D(),He=D(),Y=b(),X=b(),Z=[n(),n(),n(),n()],Q=[b(),b(),b(),b()],Ue=A(),We=A(),Ge=A(),Ke=A(),$=4,qe={getDrapedRibbonLineMaxDistance:I},Je=[b(),b()];export{Ae as Parameters,Oe as RibbonLineMaterial,qe as test};
|
|
2
|
+
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as n,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as a}from"../../../../core/time.js";import{copy as o,set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as l,subtract as u,dot as d,scale as f,add as p,copy as m,length as h,distance as g,lerp as _,transformMat4 as v,normalize as y}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPoints as S,distance2 as C,closestLineSegmentPoint as w,projectPoint as T,projectPointFraction as E,create as D}from"../../../../geometry/support/lineSegment.js";import{fromPoints as O,signedDistance as k,getNormal as ee,create as A}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as te,BufferViewFloat as j,BufferViewVec4Unorm8 as ne,BufferViewVec4f16 as re,BufferViewUint32 as ie}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as ae,isColor as M,isDepth as oe,isColorHighlightOLIDOrDepth as se,is2DGeometryOutput as ce}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as le}from"../effects/geometry/olidUtils.js";import ue from"../lib/GLMaterial.js";import{LineMaterial as de}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as fe,screenPolygonIntersectsBufferedSegment as pe}from"../lib/screenPolygonOverlapUtils.js";import{Hit as me,DrapedHit as he}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as ge}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as _e,assert as N}from"../lib/Util.js";import{isImagePattern as ve}from"./lineStippleUtils.js";import{VisualVariablePassParameters as ye}from"./VisualVariablePassParameters.js";import{writeColor as be}from"./internal/bufferWriterUtils.js";import{intersectRayWithWorldSizedLineSegment as xe,intersectScreenPolygonWithWorldSizedLineSegment as Se}from"./internal/worldSizedRibbonLineIntersectionUtils.js";import{n as Ce}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as we,getTextureBufferLayout as Te}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as Ee}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as De}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Oe}from"../../../../webscene/support/AlphaCutoff.js";class ke extends de{constructor(e,t){super(e,je),this.produces=new Map([[2,e=>ae(e)||M(e)&&this.parameters.renderOccluded===8],[3,e=>oe(e)],[10,e=>se(e)&&this.parameters.renderOccluded===8],[11,e=>se(e)&&this.parameters.renderOccluded===8],[4,e=>M(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[8,e=>M(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[18,e=>ce(e)]]),this._configuration=new De(t.state.isGlobal),this._isAssumedMetalDriver=t.stage.renderer.renderContext.rctx.isAssumedMetalDriver}updateConfiguration(e){super.updateConfiguration(e),this._configuration.useFlatJoinVarying=!this._isAssumedMetalDriver;let t=this.parameters.stipplePattern!=null&&this.parameters.stippleTexture!=null&&e.output!==10,n=t&&this.parameters.isImagePattern()&&this._configuration.draped,r=this.parameters.usesWorldSizedWidth(n);this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=t,this._configuration.stippleOffColorEnabled=t&&this.parameters.stippleOffColor!=null,this._configuration.stipplePreferContinuous=t&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=Fe(this.parameters.join,t),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins=this.parameters.join===`round`,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=this.parameters.markerParameters!=null&&Pe(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&this.parameters.innerColor!=null,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=+!!this.emissions,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSized=r,this._configuration.imagePattern=n}get visible(){return this.parameters.color[3]>=Oe||this.parameters.stipplePattern!=null&&(this.parameters.stippleOffColor?.[3]??0)>Oe}get emissions(){return this.parameters.emissiveStrength>0?this.parameters.renderOccluded===8?1:2:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},n,r,i,a,o,s){if(!n.options.selectionMode)return;let c=this._getLineSize(e,!0),l=r[0],u=r[1],d=I(c,o,s,this.parameters.usesWorldSizedWidth()),f=Number.MAX_VALUE,p=0;for(let n of Ne(z,B,this.parameters,e)){let e=l-z[0],r=u-z[1],i=B[0]-z[0],a=B[1]-z[1],o=i*e+a*r,s=i*i+a*a,c=t(o/s,0,1),d=i*c-e,m=a*c-r,h=d*d+m*m;h<f&&(f=h,p=n)}f<d*d&&i(a.distance,a.renderDistance,a.normal,p)}intersectRay(t,n,r,i,a,o){let{options:s,camera:c}=r;if(!s.selectionMode||!t.visible||!c)return;if(!_e(n)){e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`);return}let l=this._getLineSize(t.attributes);this.parameters.worldSized?this._intersectRayWithWorldSizedLine(t,n,r,l,o):this._intersectRayWithScreenSizedLine(t,n,r,l,o)}_intersectRayWithScreenSizedLine(e,t,n,r,i){let{camera:a}=n,s=e.attributes,c=s.get(`position`).data,_=Re;o(_,n.point);let v=r*a.pixelRatio,y=$*a.pixelRatio,b=v/2+y;l(Y[0],_[0]-b,_[1]+b,0),l(Y[1],_[0]+b,_[1]+b,0),l(Y[2],_[0]+b,_[1]-b,0),l(Y[3],_[0]-b,_[1]-b,0);for(let e=0;e<4;e++)if(!a.unprojectFromRenderScreen(Y[e],X[e]))return;O(a.eye,X[0],X[1],Ke),O(a.eye,X[1],X[2],Z),O(a.eye,X[2],X[3],qe),O(a.eye,X[3],X[0],Q);let x=Number.MAX_VALUE,T=0;for(let e of this._forEachTransformedLineSegment(L,R,c,t,F(this.parameters,s))){if(k(Ke,L)<0&&k(Ke,R)<0||k(Z,L)<0&&k(Z,R)<0||k(qe,L)<0&&k(qe,R)<0||k(Q,L)<0&&k(Q,R)<0)continue;let t=a.projectToRenderScreen(L,G),n=a.projectToRenderScreen(R,K);if(t==null||n==null)continue;if(t[2]<0&&n[2]>0){u(U,L,R);let e=a.frustum,n=-k(e[4],L)/d(U,ee(e[4]));if(f(U,U,n),p(L,L,U),!a.projectToRenderScreen(L,t))continue}else if(t[2]>0&&n[2]<0){u(U,R,L);let e=a.frustum,t=-k(e[4],R)/d(U,ee(e[4]));if(f(U,U,t),p(R,R,U),!a.projectToRenderScreen(R,n))continue}else if(t[2]<0&&n[2]<0)continue;t[2]=0,n[2]=0;let i=S(t,n,We),o=C(i,_);if(!(o>=x)){if(this.parameters.screenSizePerspective){let e=this.computeScreenSizePerspectiveWidth(i,L,R,_,a,r,y);if(o>=e*e)continue}x=o,m(Ve,L),m(He,R),T=e}}if(x<b*b){let{rayBegin:e,rayEnd:t}=n,r=Number.MAX_VALUE;if(w(S(Ve,He,We),S(e,t,Ge),W)){u(W,W,e);let n=h(W);f(W,W,1/n),r=n/g(e,t)}i(r,r,W,T)}}_intersectRayWithWorldSizedLine(e,t,n,r,i){let{camera:a,ray:o,metersPerRenderUnit:s}=n,c=e.attributes,l=c.get(`position`).data,u=r/(2*s),d=1/0,f=0;for(let e of this._forEachTransformedLineSegment(L,R,l,t,F(this.parameters,c))){let t=xe(L,R,u,a,o,Ue);if(t!=null&&t<d&&(d=t,f=e,m(W,Ue),t===0))break}d<1/0&&i(d,d,W,f)}intersectScreenPolygon(t,n,r,i){let{options:a}=r;if(!a.selectionMode||!t.visible)return null;if(!_e(n))return e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`),null;let o=this._getLineSize(t.attributes);return this.parameters.worldSized?this._intersectWorldSizedPolygon(t,n,r,i,o):this._intersectScreenSizedPolygon(t,n,r,i,o)}_intersectScreenSizedPolygon(e,t,n,r,i){let{camera:a,screenPolygonPrimitiveProcessor:o}=n,s=e.attributes,c=s.get(`position`).data,l=$,u=l*a.pixelRatio,d=new me(4);for(let e of this._forEachTransformedLineSegment(L,R,c,t,F(this.parameters,s)))for(let[t,n]of o.processLineSegment(Ye,L,R)){if(!fe(a,t,n,G,K))continue;let o=S(G,K,We),s=i/2+l;this.parameters.screenSizePerspective&&(_(Re,G,K,.5),s=Math.max(s,this.computeScreenSizePerspectiveWidth(o,t,n,Re,a,i,u)/a.pixelRatio)),a.renderToScreen(G,ze),a.renderToScreen(K,Be),pe(r,ze,Be,s)&&(T(S(t,n,Ge),a.eye,V),d.updateIfCloserFromValues(g(a.eye,V),e,V,null))}return d}_intersectWorldSizedPolygon(e,t,n,r,i){let{camera:a,screenPolygonPrimitiveProcessor:o,metersPerRenderUnit:s}=n,{attributes:c}=e,l=c.get(`position`).data,u=i/(2*s),d=new me(4);for(let e of this._forEachTransformedLineSegment(L,R,l,t,F(this.parameters,c)))for(let[t,n]of o.processLineSegment(Ye,L,R)){T(S(t,n,Ge),a.eye,V);let i=g(a.eye,V);d.valid&&i>=d.distance||Se(t,n,u,a,r)&&d.updateIfCloserFromValues(i,e,V,null)}return d}intersectScreenPolygonDraped({attributes:e},t,n,r,i,a){if(!n.options.selectionMode)return null;let o=I(this._getLineSize(e,!0),i,a,this.parameters.usesWorldSizedWidth());for(let n of Ne(z,B,this.parameters,e,t))if(pe(r,z,B,o))return new he(n);return null}createBufferWriter(){return new Me(we(this.parameters),Te(this.parameters),this.parameters,this._isAssumedMetalDriver)}createGLMaterial(e){return new Ae(e)}validateParameters(e){e.join!==`miter`&&(e.miterLimit=0),e.markerParameters!=null&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return this.parameters.hasAnimation?(this.setParameters({timeElapsed:i(e.time)},!1),e.dt!==0):!1}computeScreenSizePerspectiveWidth(e,t,n,r,i,a,o){let s=E(e,r);_(V,t,n,s),v(Le,V,i.viewMatrix);let c=h(Le),l=this.computeCameraAbsCosAngle(V,i,this._configuration.spherical);return Ie.update(l,c,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize),Ie.apply(a)*i.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,n){return n?y(W,e):l(W,0,0,1),u(H,e,t.eye),y(H,H),Math.abs(d(W,H))}_getLineSize(e,n=!1){let r=this.parameters.width;if(this.parameters.vvSize){let i=e.get(`sizeFeatureAttribute`).data[0];Number.isNaN(i)?n&&(r*=this.parameters.vvSize.fallback[0]):r*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has(`size`)&&(r*=e.get(`size`).data[0]);return r}*_forEachTransformedLineSegment(e,t,n,r,i){let a=i?n.length-2:n.length-5;for(let i=0;i<a;i+=3){e[0]=n[i]+r[12],e[1]=n[i+1]+r[13],e[2]=n[i+2]+r[14];let a=(i+3)%n.length;t[0]=n[a]+r[12],t[1]=n[a+1]+r[13],t[2]=n[a+2]+r[14],yield i/3}}}class Ae extends ue{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){let{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(Ee,e)}}class je extends ye{constructor(){super(...arguments),this._width=0,this.color=x,this.join=`miter`,this.cap=0,this.miterLimit=5,this.shadingEnabled=!1,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=a(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=a(0),this.endTime=a(1/0),this.worldSized=!1}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||this.stipplePattern!=null&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return this.animation!==0}usesWorldSizedWidth(e=this.isImagePattern()){return this.worldSized||e}isImagePattern(){return ve(this.stipplePattern)&&this.stippleTexture!=null}}class Me{constructor(e,t,n,r){this.layout=e,this.textureBufferLayout=t,this._parameters=n,this._isAssumedMetalDriver=r,this.numJoinSubdivisions=Fe(this._parameters.join,this._parameters.stipplePattern!=null)}_isClosed(e){return F(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get(`position`).data.length/3+(this._isClosed(e)?3:2)}elementCount(e){let t=e.get(`position`).indices.length/2+1,n=this._isClosed(e),r=n?2:4,i=+!n,a=n?t:t-1,o=this.numJoinSubdivisions*2+(this._isAssumedMetalDriver?8:4);return r+=(a-i)*o,r+=2,this._parameters.wireframe&&(r=2+(r-2)*4),r}write(e,t,n,r,i,a){a!=null&&this._writeTextureBuffer(e,n,a),r!=null&&this._writeVertexBuffer(e,n,r,i)}_writeTextureBuffer(e,t,n){let r=t.get(`position`),i=r.data.length/3,a=this._isClosed(t),{buffer:o,offset:s}=n,c=o.getField(`position`,te),l=o.getField(`u0`,j),u=o.getField(`sizeFeatureAttribute`,j),d=o.getField(`size`,j),f=o.getField(`colorFeatureAttribute`,j),p=o.getField(`color`,ne),h=o.getField(`olidColor`,ne),_=o.getField(`timeStamps`,re),v=o.getField(`opacityFeatureAttribute`,j),y=t.get(`sizeFeatureAttribute`)?.data,b=t.get(`size`)?.data,x=t.get(`colorFeatureAttribute`)?.data,S=t.get(`color`)?.data,C=t.get(`opacityFeatureAttribute`)?.data,w=t.get(`distanceToStart`)?.data,T=t.get(`timeStamps`);N(c!==null,`Expected valid position field in texture buffer`),N(l!==null,`Expected valid u0 field in texture buffer`);let E=0;for(let t=0;t<i;++t){this._getTransformedPosition(J,r.data,t,e),t>0&&(w==null?E+=g(q,J):E=w[t]??E);let n=s+t+1;if(c.setVec(n,J),l.set(n,E),m(q,J),u&&u.set(n,y?.length===1?y[0]:y?.[t]??0),d&&d.set(n,b?.length===1?b[0]:b?.[t]??1),f&&f.set(n,x?.length===1?x[0]:x?.[t]??0),p){if(S!=null){let e=Math.min(t*4,S.length-4);p.setValues(n,S[e],S[e+1],S[e+2],S[e+3])}else p.setValues(n,1,1,1,1)}v&&v.set(n,C?.length===1?C[0]:C?.[t]??0)}if(_!=null&&T!=null){N(T.size===4);let e=T.data;for(let t=0;t<i;++t){let n=t*4,r=s+t+1;_.set(r,0,e[n]),_.set(r,1,e[n+1]),_.set(r,2,e[n+2]),_.set(r,3,e[n+3])}}if(a){let e=s,t=s+1,n=s+2,r=s+i,a=r+1,u=r+2;o.copyItem(r,e),o.copyItem(t,a),o.copyItem(n,u),c.getVec(r,q),c.getVec(t,J);let d=w?.[i]??E+g(q,J);l.set(a,d)}else{let e=s,t=s+1,n=s+i,r=n+1;o.copyItem(t,e),o.copyItem(n,r)}let D=t.get(`olidColor`);le()&&D!=null&&h!=null&&be(D,4,h,s)}_writeVertexBuffer(e,t,n,r){let{buffer:i,offset:a}=n,{layout:o}=this,s=t.get(`position`),c=s.indices,l=s.data.length/3,u=this._isClosed(t),d=l+(u?3:2);c&&c.length!==2*(l-1)&&console.warn(`RibbonLineMaterial does not support indices`);let f=i.getField(`textureElementIndex`,ie);N(f!=null,`Missing texture buffer index field`),N(r!=null,`Using a texture layout, but the texture range for this instance was not provided`);let p=r.from;N(r.numElements===d,`Expected number of elements in TextureBuffer to equal number of points`);let m=new Float32Array(i.buffer),h=new Float16Array(i.buffer),g=new Uint32Array(i.buffer),_=o.stride/4,v=a*_,y=v,b=m.BYTES_PER_ELEMENT/h.BYTES_PER_ELEMENT,x=(e,t,n,r=!1)=>{let i=n+1;g[v]=p+i,v++;let a=v*b;h[a++]=e,h[a++]=t+(r?Math.sign(t)*8:0),v=Math.ceil(a/b)};v+=_;let S=0,C=0;u?(S=0,C=l):(x(1,-4,0),x(1,4,0),S=1,C=l-1);let w=this._isAssumedMetalDriver;for(let e=S;e<C;e++){x(0,-1,e),x(0,1,e),w&&(x(0,-1,e,!0),x(0,1,e,!0));let t=this.numJoinSubdivisions;for(let n=0;n<t;++n){let r=(n+1)/(t+1);x(r,-1,e,w),x(r,1,e,w)}x(1,-2,e,w),x(1,2,e,w),w&&(x(1,-2,e),x(1,2,e))}u?(x(0,-1,C),x(0,1,C)):(x(0,-5,C),x(0,5,C)),P(m,y+_,m,y,_),v=P(m,v-_,m,v,_),this._parameters.wireframe&&this._addWireframeVertices(i,y,v,_)}_getTransformedPosition(e,t,n,r){let i=n*3;l(e,t[i+0],t[i+1],t[i+2]),r&&v(e,e,r)}_addWireframeVertices(e,t,n,r){let i=new Uint8Array(e.buffer,n*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(n-t)*Float32Array.BYTES_PER_ELEMENT),o=r*Float32Array.BYTES_PER_ELEMENT,s=0,c=e=>s=P(a,e,i,s,o);for(let e=0;e<=a.length-4*o;e+=o*2)c(e),c(e+2*o),c(e+1*o),c(e+2*o),c(e+1*o),c(e+3*o)}}function P(e,t,n,r,i){for(let a=0;a<i;a++)n[r++]=e[t++];return r}function F(e,t){return e.isClosed?t.get(`position`).indices.length>2:!1}function I(e,t,n,r){return r?e/(2*n)+$*t:(e/2+$)*t}function*Ne(e,t,n,r,i){let a=r.get(`position`).data,c=F(n,r)?a.length-2:a.length-5,l=i?.[0]??0,u=i?.[1]??0;s(e,a[0]+l,a[1]+u);for(let n=3;n<c+3;n+=3){let r=n%a.length;s(t,a[r]+l,a[r+1]+u),yield n/3,o(e,t)}}function Pe(e){return e.anchor===1&&e.hideOnShortSegments&&e.placement===`begin-end`&&e.worldSpace}function Fe(e,t){let n=+!!t;switch(e){case`miter`:case`bevel`:return n;case`round`:return Ce+n}}const Ie=new ge,L=b(),R=b(),z=c(),B=c(),V=b(),Le=b(),H=b(),U=b(),W=b(),Re=b(),G=n(),K=n(),ze=r(),Be=r(),Ve=b(),He=b(),Ue=b(),We=D(),Ge=D(),q=b(),J=b(),Y=[n(),n(),n(),n()],X=[b(),b(),b(),b()],Ke=A(),Z=A(),qe=A(),Q=A(),$=4,Je={getDrapedRibbonLineMaxDistance:I},Ye=[b(),b()];export{je as Parameters,ke as RibbonLineMaterial,Je as test};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{Material as e,MaterialParameters as t}from"../lib/Material.js";import{intersectTriangleGeometryPolygon2D as n}from"../lib/PolygonIntersections2D.js";import{intersectTriangleGeometry as r,intersectTriangleGeometry2D as i}from"../lib/RayIntersections.js";import{
|
|
2
|
+
import{Material as e,MaterialParameters as t}from"../lib/Material.js";import{intersectTriangleGeometryPolygon2D as n}from"../lib/PolygonIntersections2D.js";import{intersectTriangleGeometry as r,intersectTriangleGeometry2D as i}from"../lib/RayIntersections.js";import{intersectTriangleGeometryWithScreenPolygon as a,DrapedHit as o}from"../lib/screenPolygonTriangleIntersections.js";import{intersectWithPolygonOffset as s,applyPolygonOffsetToHit as c}from"./intersectWithPolygonOffset.js";class l extends e{updateConfiguration(e){super.updateConfiguration(e),this._configuration.transparent=this.transparent,this._configuration.enableOITOffset=e.enableOITOffset,this._configuration.polygonOffset=this.parameters.polygonOffset}intersectRay(e,t,n,i,a,o){return o=s(o,this._configuration,i,a),r(e,n,i,a,null,o)}intersectRayDraped(e,t,n,r){return i(n[0],n[1],e,r)}intersectScreenPolygon(e,t,n,r){return c(a(e,n,t,r,null),this._configuration,n.camera.eye)}intersectScreenPolygonDraped(e,t,r,i){let a=n(i,t,e);return a===null?null:new o(a)}}class u extends t{constructor(){super(...arguments),this.polygonOffset=0}}export{l as TriangleMaterial,u as TriangleMaterialParameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{fromMat4 as
|
|
2
|
+
import e from"../../../../../core/PooledArray.js";import{fromMat4 as t,transpose as n}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{subtract as i,dot as a,scaleAndAdd as o,set as s,length as c,scale as l,transformMat4 as u,transformMat3 as d,cross as f,squaredLength as p,normalize as m,copy as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as _,create as v}from"../../../../../geometry/support/aaBoundingBox.js";import{fromValues as y,clipSlab as b,create as x,getStart as S}from"../../../../../geometry/support/clipRay.js";import{intersectsTransformedAabb as C}from"../../../../../geometry/support/frustumPlanes.js";import{clipClosedNegativeHalfspace as w}from"../../../../../geometry/support/plane.js";import{wrap as T}from"../../../../../geometry/support/ray.js";import{Sphere as E}from"../../../../../geometry/support/sphere.js";import{intersectConvexPolygonWithScreenPolygon as D}from"../../lib/screenPolygonTriangleIntersections.js";function O(e,t,n,r,c,l){y(c,0,1/0,W);for(let r of[0,1,2])if(!b(r,Math.min(e[r],t[r])-n,Math.max(e[r],t[r])+n,W))return null;if(!w(r.frustum[4],W)||!w(r.frustum[5],W))return null;let u=M(e,t,r,L,R,l);if(u===0)return null;i(B,c.origin,e);let d=a(B,l),f=a(c.direction,l),p=P(c.direction,l);if(Math.abs(f)>p){let e=-d/f;return e<W.c0||e>W.c1?null:(o(B,B,c.direction,e),I(a(B,L),a(B,R),u,n*n)?e:null)}if(Math.abs(d)>P(B,l))return null;let m=a(B,L),h=a(B,R),g=a(c.direction,L),_=a(c.direction,R);return s(W.ray.origin,m,h,0),s(W.ray.direction,g,_,0),!b(0,-n,u+n,W)||!b(1,-n,n,W)?null:k(W,u,n)}function k(e,t,n){let r=S(e,B);if(I(r[0],r[1],t,n*n))return e.c0;s(G.center,r[0]<0?0:t,0,0),G.radius=n;let i=e.ray.direction;if(!G.intersectRay(T(r,i),K))return null;let a=Math.abs(i[0])>Math.abs(i[1])?0:1,o=e.c0+(K[a]-r[a])/i[a];return o<=e.c1?o:null}function A(e,t,n,r,i){let a=N(e,t,n,q);if(!C(i.broadPhaseFrustum,a,null)||M(e,t,r,L,R,z)===0)return!1;let[s,c,l,u]=Y;return F(s,e,L,R,-n,-n),F(c,t,L,R,n,-n),F(l,t,L,R,n,n),F(u,e,L,R,-n,n),D(i,Y,r,Z)?(o(s,e,R,-n),o(c,t,R,-n),o(l,t,R,n),o(u,e,R,n),D(i,Y,r,Z)?!0:j(e,-n,L,R,r,i)||j(t,n,L,R,r,i)):!1}function j(e,t,n,r,i,a){let o=Math.abs(t);if(!C(a.broadPhaseFrustum,N(e,e,o,q),null))return!1;X.length=0,h(X.pushNew(),e),F(X.pushNew(),e,n,r,0,o);for(let[i,a]of J)F(X.pushNew(),e,n,r,i*t,a*o);return D(a,X,i,Z)}function M(e,r,a,o,h,g){i(o,r,e);let _=c(o);if(_===0)return 0;l(o,o,1/_);let v=a.viewMatrix;u(V,e,v),t(H,v),d(U,o,H);let y=a.projectionMatrix,b=y[11]*V[2]+y[15],x=y[11]*U[2],S=y[0]*(U[0]*b-V[0]*x),C=y[5]*(U[1]*b-V[1]*x),w=a.fullViewport,T=C*w[3]/(y[0]*w[2]),E=-S*w[2]/(y[5]*w[3]),D=Math.hypot(T,E);if(D===0)return 0;let O=T/D,k=E/D;return s(h,O,k,0),n(H,H),d(h,h,H),f(g,o,h),p(g)===0?0:(m(g,g),f(h,g,o),_)}function N(e,t,n,r){return _(Math.min(e[0],t[0])-n,Math.min(e[1],t[1])-n,Math.min(e[2],t[2])-n,Math.max(e[0],t[0])+n,Math.max(e[1],t[1])+n,Math.max(e[2],t[2])+n,r)}function P(e,t){return 16*2**-52*(Math.abs(e[0]*t[0])+Math.abs(e[1]*t[1])+Math.abs(e[2]*t[2]))}function F(e,t,n,r,i,a){o(e,t,n,i),o(e,e,r,a)}function I(e,t,n,r){let i=e<0?e:e>n?e-n:0;return i*i+t*t<=r}const L=g(),R=g(),z=g(),B=g(),V=g(),H=r(),U=g(),W=x(),G=new E,K=g(),q=v(),J=Array.from({length:3},(e,t)=>{let n=(t+1)*Math.PI/3;return t===2?[0,-1]:[Math.sin(n),Math.cos(n)]}),Y=[g(),g(),g(),g()],X=new e({allocator:e=>e??g()}),Z=new e({allocator:e=>e??g()});export{O as intersectRayWithWorldSizedLineSegment,A as intersectScreenPolygonWithWorldSizedLineSegment};
|
package/views/DOMContainer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{byId as t,reparent as n}from"../core/domUtils.js";import{on as r}from"../core/events.js";import{makeHandle as i}from"../core/handleUtils.js";import a from"../core/Logger.js";import{destroyMaybe as o,removeMaybe as s}from"../core/maybe.js";import{watch as c,initial as l,syncAndInitial as u}from"../core/reactiveUtils.js";import{addFrameTask as d}from"../core/scheduling.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{Attribution as m}from"./Attribution.js";import h from"./overlay/FocusRegionOverlayItem.js";import g from"./overlay/ViewOverlay.js";const _=[0,0];function v(e){let t=(e.ownerDocument||window.document).defaultView,n=e.getBoundingClientRect();return _[0]=n.left+(t?.pageXOffset??0),_[1]=n.top+(t?.pageYOffset??0),_}function y(e){e&&(e.textContent=``,e.parentNode&&e.parentNode.removeChild(e))}const b=process.env.NODE_ENV===`test`,x=b?0:16,S=b?0:750,C=b?0:512,w={left:0,top:0,right:0,bottom:0},T={toggle:`KeyO`,resizeLarger:`ArrowUp`,resizeSmaller:`ArrowDown`,select:new Set([`Enter`,`Space`])},E=_=>{let b=_,E=class extends b{constructor(...e){super(...e),this._freqInfo={freq:x,time:S},this._overlayRenderTaskHandle=null,this._focusRegionOverlayItem=new h,this.aria={},this.attributionMode=null,this.height=0,this.focusRegionVisible=!1,this.focusRegionShortcutEnabled=!1,this.messagesCommon=null,this.overlay=null,this.position=null,this.resizing=!1,this.root=null,this.surface=null,this.suspended=!0,this.userContent=null,this.width=0,this.widthBreakpoint=null,this.addHandles([c(()=>[this.focusRegionVisible,this.overlay,this.ready],()=>this._syncFocusRegionOverlayItemVisibility(this.focusRegionVisible&&this.ready),{initial:!0}),c(()=>this.cursor,e=>{let{surface:t}=this;t&&t.setAttribute(`data-cursor`,e)}),c(()=>this.navigating,e=>{let{surface:t}=this;t&&t.setAttribute(`data-navigating`,e.toString())}),c(()=>[this.aria,this.surface],()=>this._updateAria(),{initial:!0}),c(()=>{let{left:e,top:t,right:n,bottom:r}=this.padding??w;return[this.width,this.height,e,t,n,r]},([e,t,n,r,i,a])=>{let{_focusRegionOverlayItem:o}=this;o.backgroundHeight=t,o.backgroundWidth=e,o.padding={left:n,top:r,right:i,bottom:a},o.updateBoxSize()})])}initialize(){let e=this;this.addHandles([c(()=>this.ui,(e,t)=>this._handleUIChange(e,t),l),e.on(`focus`,()=>this.notifyChange(`focused`)),e.on(`blur`,()=>this.notifyChange(`focused`)),e.on(`key-down`,t=>{let{shiftKey:n,altKey:r,code:i,defaultPrevented:a}=t.native,{toggle:o,resizeLarger:s,resizeSmaller:c,select:l}=T,u=this.focusRegionVisible&&n&&r&&(i===s||i===c);if(!t.repeat||u){if(!a&&n&&r&&i===o&&this.focusRegionShortcutEnabled)this._toggleFocusRegion(),t.preventDefault();else if(!a&&u){let{_focusRegionOverlayItem:e}=this;e.resizeBoxSize(i===s?50:-50),t.preventDefault(),t.native.stopPropagation(),t.stopPropagation()}else!a&&this.focusRegionVisible&&l.has(i)&&this._selectFocusRegion(t,e)}})])}destroy(){this.destroyed||(this.focusRegionVisible=!1,this._syncFocusRegionOverlayItemVisibility(!1),this.ui?.destroy(),this.container=null)}get attributionHeight(){return this._attribution?.height??0}get container(){return this._get(`container`)??null}set container(e){let r=this._get(`container`),i=t(e);if(!i&&typeof e==`string`&&a.getLogger(this).error(`#container`,`element with id '${e}' not found`),r===i)return;if(this._stopMeasuring(),this.removeHandles(`container`),r&&(r.classList.remove(`esri-view`),this._overlayRenderTaskHandle&&=(this._overlayRenderTaskHandle.remove(),null),this.overlay&&(this.overlay.destroy(),this._set(`overlay`,null)),this._attribution=o(this._attribution),this.root&&(y(this.root),this._set(`root`,null)),this.userContent&&(n(this.userContent,r),y(this.userContent),this._set(`userContent`,null))),!i){this._set(`width`,0),this._set(`height`,0),this._set(`position`,null),this._set(`suspended`,!0),this._set(`surface`,null),this._set(`container`,null);return}i.classList.add(`esri-view`);let f=document.createElement(`div`);f.className=`esri-view-user-storage`,n(i,f),i.appendChild(f),this._set(`userContent`,f);let p=document.createElement(`div`);p.className=`esri-view-root`,i.insertBefore(p,i.firstChild),this._set(`root`,p);let h=document.createElement(`div`);h.className=`esri-view-surface`,h.setAttribute(`role`,`application`),h.tabIndex=0,p.appendChild(h),this._set(`surface`,h);let _=new g;p.appendChild(_.surface),this._set(`overlay`,_),this._syncFocusRegionOverlayItemVisibility(!1),this.addHandles(c(()=>_.needsRender,e=>{this._overlayRenderTaskHandle=e&&!this._overlayRenderTaskHandle?d({render:()=>this.overlay?.render()}):s(this._overlayRenderTaskHandle)},l),`container`),this.addHandles([c(()=>({visible:this.attributionVisible,items:this.attributionItems,mode:this.attributionMode}),({visible:e,items:t,mode:n})=>{e?(this._attribution||=new m({attributionItems:this.attributionItems,mode:this.attributionMode}),this._attribution.appendBefore(p,this.ui?.container??null),this._attribution.attributionItems=t,this._attribution.mode=n):this._attribution=o(this._attribution)},u)],`container`),this.forceDOMReadyCycle(),this._set(`container`,i),this._startMeasuring()}get focused(){let e=document.activeElement===this.surface;return document.hasFocus()&&e}get focusRegion(){return this.focusRegionVisible?this._focusRegionOverlayItem.getScreenRect():null}get size(){return[this.width,this.height]}get ui(){return this._get(`ui`)}set ui(e){let t=this._get(`ui`);t!==e&&t?.destroy(),this._set(`ui`,e)}blur(){this.surface?.blur()}focus(){this.surface?.focus()}pageToContainer(e,t,n){let r=this.position;return e-=r?r[0]:0,t-=r?r[1]:0,n?(n[0]=e,n[1]=t):n=[e,t],n}containerToPage(e,t,n){let r=this.position;return e+=r?r[0]:0,t+=r?r[1]:0,n?(n[0]=e,n[1]=t):n=[e,t],n}_updateAria(){let{surface:e,aria:t}=this;e&&(e.ariaLabelledByElements=t?.labelledByElements??null,e.ariaDescribedByElements=t?.describedByElements??null,e.ariaLabel=t?.label??null,e.ariaDescription=t?.description??null)}_selectFocusRegion(e,t){let n=this._makeFocusRegionSelectEvent(e);t.emit(`focus-region-select`,n),e.preventDefault()}_makeFocusRegionSelectEvent(e){let t={type:`focus-region-select`,native:e.native,defaultPrevented:!1,preventDefault:()=>{t.defaultPrevented=!0},stopPropagation:()=>{e.stopPropagation()}};return t}_toggleFocusRegion(){this.focusRegionVisible=!this.focusRegionVisible}_updateFocusRegionOverlayItem(){let{_focusRegionOverlayItem:e}=this;e.backgroundHeight=this.height,e.backgroundWidth=this.width,e.padding=this.padding??w,e.updateBoxSize()}_syncFocusRegionOverlayItemVisibility(e){let{_focusRegionOverlayItem:t,overlay:n}=this,r=e;t.visible=r,n&&(n.removeItem(t),r&&(this._updateFocusRegionOverlayItem(),n.addItem(t)))}_handleUIChange(e,t){this.removeHandles(`ui`),t&&t!==e&&t.destroy(),e&&(e.view=this,this.addHandles(c(()=>this.root,t=>{if(!t)e.container=null;else{let n=document.createElement(`div`);t.insertBefore(n,this._attribution?.surface??null),e.container=n}},l),`ui`)),this._set(`ui`,e)}_stopMeasuring(){this.removeHandles(`measuring`),this._get(`resizing`)&&this._set(`resizing`,!1)}_startMeasuring(){let e=this._freqInfo;e.freq=x,e.time=S;let t=d({prepare:e=>{let n=this._measure(),r=this._freqInfo;r.time+=e.deltaTime,n&&(r.freq=x,this._get(`resizing`)||this._set(`resizing`,!0))
|
|
2
|
+
import{__decorate as e}from"tslib";import{byId as t,reparent as n}from"../core/domUtils.js";import{on as r}from"../core/events.js";import{makeHandle as i}from"../core/handleUtils.js";import a from"../core/Logger.js";import{destroyMaybe as o,removeMaybe as s}from"../core/maybe.js";import{watch as c,initial as l,syncAndInitial as u}from"../core/reactiveUtils.js";import{addFrameTask as d}from"../core/scheduling.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{Attribution as m}from"./Attribution.js";import h from"./overlay/FocusRegionOverlayItem.js";import g from"./overlay/ViewOverlay.js";const _=[0,0];function v(e){let t=(e.ownerDocument||window.document).defaultView,n=e.getBoundingClientRect();return _[0]=n.left+(t?.pageXOffset??0),_[1]=n.top+(t?.pageYOffset??0),_}function y(e){e&&(e.textContent=``,e.parentNode&&e.parentNode.removeChild(e))}const b=process.env.NODE_ENV===`test`,x=b?0:16,S=b?0:750,C=b?0:512,w={left:0,top:0,right:0,bottom:0},T={toggle:`KeyO`,resizeLarger:`ArrowUp`,resizeSmaller:`ArrowDown`,select:new Set([`Enter`,`Space`])},E=_=>{let b=_,E=class extends b{constructor(...e){super(...e),this._freqInfo={freq:x,time:S},this._overlayRenderTaskHandle=null,this._focusRegionOverlayItem=new h,this.aria={},this.attributionMode=null,this.height=0,this.focusRegionVisible=!1,this.focusRegionShortcutEnabled=!1,this.messagesCommon=null,this.overlay=null,this.position=null,this.resizing=!1,this.root=null,this.surface=null,this.suspended=!0,this.userContent=null,this.width=0,this.widthBreakpoint=null,this.addHandles([c(()=>[this.focusRegionVisible,this.overlay,this.ready],()=>this._syncFocusRegionOverlayItemVisibility(this.focusRegionVisible&&this.ready),{initial:!0}),c(()=>this.cursor,e=>{let{surface:t}=this;t&&t.setAttribute(`data-cursor`,e)}),c(()=>this.navigating,e=>{let{surface:t}=this;t&&t.setAttribute(`data-navigating`,e.toString())}),c(()=>[this.aria,this.surface],()=>this._updateAria(),{initial:!0}),c(()=>{let{left:e,top:t,right:n,bottom:r}=this.padding??w;return[this.width,this.height,e,t,n,r]},([e,t,n,r,i,a])=>{let{_focusRegionOverlayItem:o}=this;o.backgroundHeight=t,o.backgroundWidth=e,o.padding={left:n,top:r,right:i,bottom:a},o.updateBoxSize()})])}initialize(){let e=this;this.addHandles([c(()=>this.ui,(e,t)=>this._handleUIChange(e,t),l),e.on(`focus`,()=>this.notifyChange(`focused`)),e.on(`blur`,()=>this.notifyChange(`focused`)),e.on(`key-down`,t=>{let{shiftKey:n,altKey:r,code:i,defaultPrevented:a}=t.native,{toggle:o,resizeLarger:s,resizeSmaller:c,select:l}=T,u=this.focusRegionVisible&&n&&r&&(i===s||i===c);if(!t.repeat||u){if(!a&&n&&r&&i===o&&this.focusRegionShortcutEnabled)this._toggleFocusRegion(),t.preventDefault();else if(!a&&u){let{_focusRegionOverlayItem:e}=this;e.resizeBoxSize(i===s?50:-50),t.preventDefault(),t.native.stopPropagation(),t.stopPropagation()}else!a&&this.focusRegionVisible&&l.has(i)&&this._selectFocusRegion(t,e)}})])}destroy(){this.destroyed||(this.focusRegionVisible=!1,this._syncFocusRegionOverlayItemVisibility(!1),this.ui?.destroy(),this.container=null)}get attributionHeight(){return this._attribution?.height??0}get container(){return this._get(`container`)??null}set container(e){let r=this._get(`container`),i=t(e);if(!i&&typeof e==`string`&&a.getLogger(this).error(`#container`,`element with id '${e}' not found`),r===i)return;if(this._stopMeasuring(),this.removeHandles(`container`),r&&(r.classList.remove(`esri-view`),this._overlayRenderTaskHandle&&=(this._overlayRenderTaskHandle.remove(),null),this.overlay&&(this.overlay.destroy(),this._set(`overlay`,null)),this._attribution=o(this._attribution),this.root&&(y(this.root),this._set(`root`,null)),this.userContent&&(n(this.userContent,r),y(this.userContent),this._set(`userContent`,null))),!i){this._set(`width`,0),this._set(`height`,0),this._set(`position`,null),this._set(`suspended`,!0),this._set(`surface`,null),this._set(`container`,null);return}i.classList.add(`esri-view`);let f=document.createElement(`div`);f.className=`esri-view-user-storage`,n(i,f),i.appendChild(f),this._set(`userContent`,f);let p=document.createElement(`div`);p.className=`esri-view-root`,i.insertBefore(p,i.firstChild),this._set(`root`,p);let h=document.createElement(`div`);h.className=`esri-view-surface`,h.setAttribute(`role`,`application`),h.tabIndex=0,p.appendChild(h),this._set(`surface`,h);let _=new g;p.appendChild(_.surface),this._set(`overlay`,_),this._syncFocusRegionOverlayItemVisibility(!1),this.addHandles(c(()=>_.needsRender,e=>{this._overlayRenderTaskHandle=e&&!this._overlayRenderTaskHandle?d({render:()=>this.overlay?.render()}):s(this._overlayRenderTaskHandle)},l),`container`),this.addHandles([c(()=>({visible:this.attributionVisible,items:this.attributionItems,mode:this.attributionMode}),({visible:e,items:t,mode:n})=>{e?(this._attribution||=new m({attributionItems:this.attributionItems,mode:this.attributionMode}),this._attribution.appendBefore(p,this.ui?.container??null),this._attribution.attributionItems=t,this._attribution.mode=n):this._attribution=o(this._attribution)},u)],`container`),this.forceDOMReadyCycle(),this._set(`container`,i),this._startMeasuring()}get focused(){let e=document.activeElement===this.surface;return document.hasFocus()&&e}get focusRegion(){return this.focusRegionVisible?this._focusRegionOverlayItem.getScreenRect():null}get size(){return[this.width,this.height]}get ui(){return this._get(`ui`)}set ui(e){let t=this._get(`ui`);t!==e&&t?.destroy(),this._set(`ui`,e)}blur(){this.surface?.blur()}focus(){this.surface?.focus()}pageToContainer(e,t,n){let r=this.position;return e-=r?r[0]:0,t-=r?r[1]:0,n?(n[0]=e,n[1]=t):n=[e,t],n}containerToPage(e,t,n){let r=this.position;return e+=r?r[0]:0,t+=r?r[1]:0,n?(n[0]=e,n[1]=t):n=[e,t],n}_updateAria(){let{surface:e,aria:t}=this;e&&(e.ariaLabelledByElements=t?.labelledByElements??null,e.ariaDescribedByElements=t?.describedByElements??null,e.ariaLabel=t?.label??null,e.ariaDescription=t?.description??null)}_selectFocusRegion(e,t){let n=this._makeFocusRegionSelectEvent(e);t.emit(`focus-region-select`,n),e.preventDefault()}_makeFocusRegionSelectEvent(e){let t={type:`focus-region-select`,native:e.native,defaultPrevented:!1,preventDefault:()=>{t.defaultPrevented=!0},stopPropagation:()=>{e.stopPropagation()}};return t}_toggleFocusRegion(){this.focusRegionVisible=!this.focusRegionVisible}_updateFocusRegionOverlayItem(){let{_focusRegionOverlayItem:e}=this;e.backgroundHeight=this.height,e.backgroundWidth=this.width,e.padding=this.padding??w,e.updateBoxSize()}_syncFocusRegionOverlayItemVisibility(e){let{_focusRegionOverlayItem:t,overlay:n}=this,r=e;t.visible=r,n&&(n.removeItem(t),r&&(this._updateFocusRegionOverlayItem(),n.addItem(t)))}_handleUIChange(e,t){this.removeHandles(`ui`),t&&t!==e&&t.destroy(),e&&(e.view=this,this.addHandles(c(()=>this.root,t=>{if(!t)e.container=null;else{let n=document.createElement(`div`);t.insertBefore(n,this._attribution?.surface??null),e.container=n}},l),`ui`)),this._set(`ui`,e)}_stopMeasuring(){this.removeHandles(`measuring`),this._get(`resizing`)&&this._set(`resizing`,!1)}_startMeasuring(){let e=this._freqInfo;e.freq=x,e.time=S;let t=d({prepare:e=>{let n=this._measure(),r=this._freqInfo;r.time+=e.deltaTime,n&&(r.freq=x,this._get(`resizing`)||this._set(`resizing`,!0)),r.time<r.freq||(r.time=0,r.freq=this._position()||n?x:Math.min(S,r.freq*2),!n&&r.freq>=C&&(t.pause(),this._get(`resizing`)&&this._set(`resizing`,!1)))}}),n=new ResizeObserver(n=>{e.freq=x,e.time=S,t.resume()});this.container!=null&&n.observe(this.container);let a=i(()=>n.disconnect());this.addHandles([r(window,`resize`,()=>{e.freq=x,e.time=S,t.resume()}),a,t],`measuring`),this._measure(),this._position()}_measure(){let e=this.container,t=e?e.clientWidth:0,n=e?e.clientHeight:0;if(t===0||n===0)return this.suspended||this._set(`suspended`,!0),!1;let r=this.width,i=this.height;return t===r&&n===i?(this.suspended&&this._set(`suspended`,!1),!1):(this._set(`width`,t),this._set(`height`,n),this.suspended&&this._set(`suspended`,!1),this.emit(`resize`,{oldWidth:r,oldHeight:i,width:t,height:n}),!0)}_position(){let e=this.container,t=this.position,n=e&&v(e);return n&&(!t||n[0]!==t[0]||n[1]!==t[1])?(this._set(`position`,[n[0],n[1]]),!0):!1}forceDOMReadyCycle(){}};return e([f()],E.prototype,`_attribution`,void 0),e([f()],E.prototype,`aria`,void 0),e([f()],E.prototype,`attributionHeight`,null),e([f()],E.prototype,`attributionMode`,void 0),e([f()],E.prototype,`container`,null),e([f({readOnly:!0})],E.prototype,`focused`,null),e([f({readOnly:!0})],E.prototype,`height`,void 0),e([f()],E.prototype,`focusRegionVisible`,void 0),e([f()],E.prototype,`focusRegionShortcutEnabled`,void 0),e([f()],E.prototype,`focusRegion`,null),e([f()],E.prototype,`messagesCommon`,void 0),e([f({type:g})],E.prototype,`overlay`,void 0),e([f({readOnly:!0})],E.prototype,`position`,void 0),e([f({readOnly:!0})],E.prototype,`resizing`,void 0),e([f({readOnly:!0})],E.prototype,`root`,void 0),e([f({value:null,readOnly:!0})],E.prototype,`size`,null),e([f({readOnly:!0})],E.prototype,`surface`,void 0),e([f({readOnly:!0})],E.prototype,`suspended`,void 0),e([f({nonNullable:!0})],E.prototype,`ui`,null),e([f({readOnly:!0})],E.prototype,`userContent`,void 0),e([f({readOnly:!0})],E.prototype,`width`,void 0),e([f()],E.prototype,`widthBreakpoint`,void 0),E=e([p(`esri.views.DOMContainer`)],E),E};export{E as DOMContainer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../core/accessorSupport/decorators.js";import r from"../../geometry/Point.js";import i from"./CursorUpdateEvent.js";import a from"./DrawAction.js";import o from"./DrawCompleteEvent.js";import s from"./VertexAddEvent.js";import{createViewAlignedCoordinateSystem as c}from"./support/surfaceCoordinateSystems.js";import{ViewEventPriorities as l}from"../input/InputManager.js";import{sketchKeys as u}from"../interactive/keybindings.js";import{EditGeometry as d,Part as f}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as p}from"../interactive/editGeometry/EditGeometryOperations.js";import{createScreenPointFromEvent as m}from"../support/screenUtils.js";const h=[`freehand`,`click`];let g=class extends a{constructor(e){super(e),this._isDragging=!1,this._panEnabled=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.viewAlignedCoordinateSystem=null,this.mode=`freehand`}initialize(){this.view.type===`2d`?this._addViewHandles():this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit(`destroy`)}complete(){this._completeDrawing()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){this.mode===`click`?this.addHandles(this._getClickModeViewHandles()):this.addHandles(this._getDragModeViewHandles())}_getDragModeViewHandles(){return[this.view.on(`immediate-click`,e=>{e.stopPropagation(),e.mapPoint&&!this._panEnabled&&this.getCoordsFromScreenPoint(m(e))!=null&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))},l.TOOL),this.view.on(`pointer-down`,e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping()
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../core/accessorSupport/decorators.js";import r from"../../geometry/Point.js";import i from"./CursorUpdateEvent.js";import a from"./DrawAction.js";import o from"./DrawCompleteEvent.js";import s from"./VertexAddEvent.js";import{createViewAlignedCoordinateSystem as c}from"./support/surfaceCoordinateSystems.js";import{ViewEventPriorities as l}from"../input/InputManager.js";import{sketchKeys as u}from"../interactive/keybindings.js";import{EditGeometry as d,Part as f}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as p}from"../interactive/editGeometry/EditGeometryOperations.js";import{createScreenPointFromEvent as m}from"../support/screenUtils.js";const h=[`freehand`,`click`];let g=class extends a{constructor(e){super(e),this._isDragging=!1,this._panEnabled=!1,this._addVertexOnPointerUp=!1,this._drawTool=null,this.viewAlignedCoordinateSystem=null,this.mode=`freehand`}initialize(){this.view.type===`2d`?this._addViewHandles():this.addResolvingPromise(this._addDrawTool())}destroy(){this._removeDrawTool(),this.emit(`destroy`)}complete(){this._completeDrawing()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){this.mode===`click`?this.addHandles(this._getClickModeViewHandles()):this.addHandles(this._getDragModeViewHandles())}_getDragModeViewHandles(){return[this.view.on(`immediate-click`,e=>{e.stopPropagation(),e.mapPoint&&!this._panEnabled&&this.getCoordsFromScreenPoint(m(e))!=null&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))},l.TOOL),this.view.on(`pointer-down`,e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._panEnabled||(this._resetGeometry(),this._addVertexOnPointerUp=!0,this._cursorScreenPoint=m(e),this._activePointerId=e.pointerId,this._vertexAddHandler(e),this._isDragging=!1,e.pointerType===`touch`&&this._updateCursor()))},l.TOOL),this.view.on(`pointer-move`,e=>{this._abortSnapping(),this._activePointerId==null&&e.pointerType!==`touch`&&(this._cursorScreenPoint=m(e),this._updateCursor())},l.TOOL),this.view.on(`pointer-drag`,e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0,this._cursorScreenPoint=m(e),this._updateCursor())},l.TOOL),this.view.on(`pointer-up`,e=>{this._shouldHandlePointerEvent(e)&&this._addVertexOnPointerUp&&(this._abortSnapping(),this._activePointerId=null,this._isDragging&&this._vertexAddHandler(e),this._committedVertices.length===2&&this._drawCompleteHandler(e),this._isDragging=!1)},l.TOOL),this.view.on(`key-down`,e=>{e.key===u.complete&&this._cursorScreenPoint?(this._abortSnapping(),this._vertexAddHandler(e),this._drawCompleteHandler(e)):e.key===u.pan&&(this._panEnabled=!0)},l.TOOL),this.view.on(`key-up`,e=>{e.key===u.pan&&(this._panEnabled=!1)},l.TOOL),this.view.on(`drag`,e=>{this._activePointerId!=null&&e.stopPropagation()},l.TOOL),this.view.on(`drag`,[`Shift`],e=>{e.stopPropagation()},l.TOOL)]}_getClickModeViewHandles(){return[this.view.on(`pointer-down`,e=>{this._abortSnapping(),this._cursorScreenPoint=m(e),this._activePointerId=e.pointerId,this._isDragging=!1,e.pointerType===`touch`&&this._updateCursor()},l.TOOL),this.view.on(`pointer-move`,e=>{this._abortSnapping(),this._cursorScreenPoint=m(e),this._activePointerId==null&&e.pointerType!==`touch`&&this._updateCursor()},l.TOOL),this.view.on(`pointer-drag`,e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0)},l.TOOL),this.view.on(`pointer-up`,e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=null,e.stopPropagation(),this._isDragging||this._vertexAddHandler(e),this.vertices.length===2&&!this._isDragging&&this._drawCompleteHandler(e),this._isDragging=!1)},l.TOOL),this.view.on(`key-down`,e=>{e.key===u.vertexAdd&&this._cursorScreenPoint&&(this._vertexAddHandler(e),this.vertices.length===2&&this._drawCompleteHandler(e)),e.key===u.complete&&this._cursorScreenPoint&&this.vertices.length===2&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))},l.TOOL)]}async _addDrawTool(){let{LegacyDrawTool:e}=await import(`./LegacyDrawTool.js`),t=new e({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:`segment`,mode:this.mode});this.destroyed?t.destroy():(this._drawTool=t,this.view.addAndActivateTool(t),this.addHandles([t.on(`vertex-add`,e=>{e.vertices.length===1&&this.emit(`vertex-add`,new s(this.view,e.vertices[0].vertexIndex,t.getVertexCoords()))}),t.on(`cursor-update`,e=>{e.vertices.length===1&&this.emit(`cursor-update`,new i(this.view,e.vertices[0].vertexIndex,t.getVertexCoords()))}),t.on(`complete`,e=>{this.emit(`draw-complete`,new o(t.getVertexCoords())),this._removeDrawTool()}),this.view.on(`key-down`,e=>{e.key===u.vertexAdd&&!e.repeat&&this.mode===`click`?t.drawOperation.numCommittedVertices>0?t.completeCreateOperation():t.drawOperation.commitStagedVertex():e.key===u.complete&&!e.repeat&&t.completeCreateOperation()},l.TOOL)]))}_removeDrawTool(){this._drawTool&&=(this.view.tools.remove(this._drawTool),null)}_addVertex(e){let t=this._coordinateHelper.arrayToVector(e);if(this._isDuplicateOfLastVertex(t))return;this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertexToFirstPart(t),this._committedVertices.length===1&&(this.viewAlignedCoordinateSystem=c(this.view,this._committedVertices[0]));let n=this._committedVertices.length-1,r=new s(this.view,n,this.vertices);this.emit(`vertex-add`,r)}_updateCursor(){if(this._popCursorVertex(),!this._cursorScreenPoint)return;let e=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);e!=null&&this._pushCursorVertex(e.vertex,()=>this.emit(`cursor-update`,new i(this.view,this._activeComponent.vertices.length,this.vertices,this._stagedVertex==null?null:new r(this._stagedVertex))))}_completeDrawing(){if(this._drawTool){this._drawTool.completeCreateOperation(),this.removeAllHandles();return}if(this._activePointerId=null,this._popCursorVertex(),this._cursorScreenPoint=null,this._isDragging=!1,this._abortSnapping(),this._snappingManager!=null&&this._snappingManager.doneSnapping(),this.vertices.length<1)return;let e=new o(this.vertices);this.emit(`draw-complete`,e),e.defaultPrevented||this.removeAllHandles()}_resetGeometry(){this._editGeometryOperations.destroy(),this._editGeometryOperations=new p(new d(`polygon`,this._coordinateHelper),2),this._activeComponent=new f(this._coordinateHelper.spatialReference,2),this._editGeometryOperations.data.parts.push(this._activeComponent)}};e([t({type:h})],g.prototype,`mode`,void 0),g=e([n(`esri.views.draw.SegmentDrawAction`)],g);const _=g;export{_ as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{makeHandle as e}from"../../../core/handleUtils.js";import{nextTick as t}from"../../../core/nextTick.js";import{makeAllLayerSnappingOptions as n,makePointPlacementSnappingOptions as r}from"./allLayerSnapping.js";import{SnappingManager as i}from"./SnappingManager.js";const a=new Map,o=new Map;function s(e){return l(e,a,r)}function c(e){return l(e,o,n)}function l(t,n,r){if(!n.has(t)){let e=r(t),a=new i({view:t,options:e.options});n.set(t,{referenceCount:0,snappingManager:a,remove:()=>{e.remove(),a.destroy()}})}let a=n.get(t);return a.referenceCount++,{snappingManager:a.snappingManager,...e(()=>u(t,n,a))}}function u(e,n,r){r.referenceCount
|
|
2
|
+
import{makeHandle as e}from"../../../core/handleUtils.js";import{nextTick as t}from"../../../core/nextTick.js";import{makeAllLayerSnappingOptions as n,makePointPlacementSnappingOptions as r}from"./allLayerSnapping.js";import{SnappingManager as i}from"./SnappingManager.js";const a=new Map,o=new Map;function s(e){return l(e,a,r)}function c(e){return l(e,o,n)}function l(t,n,r){if(!n.has(t)){let e=r(t),a=new i({view:t,options:e.options});n.set(t,{referenceCount:0,snappingManager:a,remove:()=>{e.remove(),a.destroy()}})}let a=n.get(t);return a.referenceCount++,{snappingManager:a.snappingManager,...e(()=>u(t,n,a))}}function u(e,n,r){r.referenceCount--,r.referenceCount>0||t(()=>{r.referenceCount===0&&(r.remove(),n.delete(e))})}export{s as acquireForFeaturePlacement,c as acquireForViewOptions};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{prefersReducedMotion as t}from"../../../../core/a11yUtils.js";import{on as n}from"../../../../core/events.js";import"../../../../core/has.js";import{memoize as r}from"../../../../core/memoize.js";import{throwIfNotAbortError as i,throwIfAborted as a,after as o}from"../../../../core/promiseUtils.js";import{waitAnimationFrame as s,waitTick as c}from"../../../../core/scheduling.js";import{unitName as l}from"../../../../core/unitFormatUtils.js";import{defaultAreaUnit as u,defaultVerticalLengthUnit as d,defaultLengthUnit as f}from"../../../../core/units.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as h}from"../../../../support/getDefaultUnitForView.js";import{tooltipKeys as g}from"../../keybindings.js";import{table as _,contentHeader as v,contentHeaderSpacer as y,contentHeaderActions as b,contentInputMode as x,content as S,helpMessageText as C,helpMessageIcon as w,helpMessage as T,drawContentHeaderActions as E}from"../css.js";import{getFormatters as D}from"../fields/parsingAndFormattingUtils.js";import O from"../../../../widgets/Widget.js";import{loadCalciteComponents as k}from"../../../../widgets/support/componentsUtils.js";import{tsx as A,tsxFragment as j,classes as M,messageBundle as N}from"../../../../widgets/support/widget.js";const P=Symbol(`dragHandles`);let F=class extends O{constructor(){super(...arguments),this._focusAbortController=new AbortController,this._transitionInfo=null,this._mode=`feedback`,this._getFormatters=r(D),this._onHeaderPointerDown=e=>{let t=e.target;if(!(t instanceof HTMLElement)||t?.tagName?.toLowerCase()===`calcite-button`)return;this.removeHandles(P),e.preventDefault(),e.stopPropagation();let r=process.env.NODE_ENV!==`test`;r&&t.setPointerCapture(e.pointerId),this.tooltip.onDragStart(e.clientX,e.clientY),this.addHandles([n(t,`pointermove`,({clientX:e,clientY:t})=>{this.tooltip.onDrag(e,t)}),n(t,[`pointerup`,`pointercancel`],n=>{this.removeHandles(P),r&&t.releasePointerCapture(e.pointerId),this.tooltip.onDragEnd()}),n(t,`touchstart`,e=>e.preventDefault())],P)},this._onDiscard=()=>{this.destroyed||(this.tooltip.emit(`discard`),this.info.clearInputValues(),this.exitInputMode())},this._onCommit=(e,t)=>{if(this.destroyed)return;if(this.tooltip.emit(`commit`,{type:t}),t===`commit-and-exit`){this.exitInputMode();return}if(t===`commit-on-blur`)return;let n=this._getFocusableElements(),r=n.length,i=n.indexOf(e);if(i===-1){this.exitInputMode();return}let a=((i+(t===`commit-and-next`?1:-1))%r+r)%r;I(n.at(a))},this._onKeyDown=e=>{switch(e.code){case g.next:return this._onNextKey(e);case g.discard:return e.stopPropagation(),this._onDiscard()}}}get mode(){return this._mode}get _displayUnits(){let{displayUnits:e}=this.info.toolOptions.values,t=h(this.tooltip.view);return{length:e.length??t,verticalLength:e.verticalLength??t,area:e.area??t}}get _inputUnitInfos(){let e=this._messagesUnits,t=t=>({unit:t,abbreviation:l(e,t,`abbr`)}),{inputUnits:n}=this.info.toolOptions.values,r=h(this.tooltip.view),i=n.length??r,a=n.verticalLength??r,o=n.area??r;return{length:t(f(i)),verticalLength:t(d(a)),area:t(u(o)),angle:t(`degrees`)}}get _formatters(){return this._getFormatters(this._messagesUnits,this._displayUnits)}get _elevationModeContext(){let{elevationModeContext:e}=this.info;return e&&{get mode(){return e.mode},get disabled(){return e.disabled},onChange:t=>{for(let e of this.info.editableFields){let t=this.domNode?.querySelector(`[data-field-id="${e.id}"]`);e.dirty&&t&&e.onCommit(`commit-on-blur`,t,this.fieldContext)}this.info.editableFields.some(e=>e.invalid)||e.onChange(t)}}}get fieldContext(){return{formatters:this._formatters,inputUnitInfos:this._inputUnitInfos,messages:this._messagesTooltip,toolOptions:this.info.toolOptions,elevationModeContext:this._elevationModeContext,topLayerDisabled:this.topLayerDisabled,onCommit:this._onCommit,onDiscard:this._onDiscard}}render(){let{visibleElements:e}=this.info.toolOptions.tooltips,t=this._renderedContent,n=this._renderedActions,r=this._renderedHelpMessage,i=t.length>0,a=i||!!r,o=this.mode===`input`;return A(`div`,{class:M(S,o&&x),tabIndex:-1,onkeydown:this._onKeyDown},o&&a&&e.header?A(`div`,{class:v,"data-testid":`tooltip-header`,key:`header`,onpointerdown:this._onHeaderPointerDown},A(`calcite-button`,{appearance:`transparent`,"data-testid":`tooltip-back-button`,iconFlipRtl:`both`,iconStart:`chevron-left`,key:`discard-button`,kind:`neutral`,scale:`s`,tabIndex:-1,onclick:this._onDiscard}),n.length>0?A(j,null,A(`div`,{class:y,key:`spacer`}),A(`div`,{class:b,key:`actions`},n)):null):null,i?A(`div`,{class:_,key:`content`},...t):null,r)}destroy(){this._focusAbortController.abort(),this._transitionInfo?.transition.skipTransition()}_renderActions(){return null}loadDependencies(){return k({button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`)})}async enterInputMode(e,t){try{await this._transitionTo(`input`,t),await this._focusField(e)}catch(e){i(e)}}async exitInputMode({focusOnView:e=!0}={}){try{let{container:t,info:n}=this;n.clearInputValues();let r=e?t?.closest(`.esri-view`)?.querySelector(`.esri-view-surface`):null;await this._transitionTo(`feedback`),r instanceof HTMLElement&&r.focus()}catch(e){i(e)}}_onNextKey(e){let t=this._getFocusableElements(),n=t.at(0),r=t.at(-1);n&&r&&(e.shiftKey?document.activeElement===n&&(e.preventDefault(),e.stopPropagation(),I(r)):document.activeElement===r&&(e.preventDefault(),e.stopPropagation(),I(n)))}get _renderedContent(){return L(this._renderContent())}get _renderedActions(){return L(this._renderActions())}get _renderedHelpMessage(){let{toolOptions:e,visibleElements:t}=this.info;if(!t.helpMessage)return null;let n=e.tooltips.helpMessage??this._defaultHelpMessage;if(!n)return null;let r=e.tooltips.helpMessageIcon??`information`;return A(`div`,{class:T,key:`help-message`},r?A(`calcite-icon`,{class:w,icon:r,scale:`s`}):null,A(`div`,{class:C},n))}get _defaultHelpMessage(){let{helpMessage:e,viewType:t}=this.info;if(e==null)return null;let n=t===`3d`?`helpMessages3d`:`helpMessages2d`;return this._messagesTooltip?.sketch?.[n]?.[e]}async _focusField(e){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;let{signal:t}=this._focusAbortController;await this._waitForInputs(),a(t);let n=this._getFocusableFields();await I(e?n.find(t=>t.getAttribute(`data-field-name`)===e):n.at(0))}async _transitionTo(e,n){if(this._mode===e&&!this._transitionInfo)return;if(this._transitionInfo?.mode===e)return this._transitionInfo.transition.finished;this._transitionInfo?.transition.skipTransition();let r=async()=>{this.destroyed||(this._mode=e,await c()
|
|
2
|
+
import{__decorate as e}from"tslib";import{prefersReducedMotion as t}from"../../../../core/a11yUtils.js";import{on as n}from"../../../../core/events.js";import"../../../../core/has.js";import{memoize as r}from"../../../../core/memoize.js";import{throwIfNotAbortError as i,throwIfAborted as a,after as o}from"../../../../core/promiseUtils.js";import{waitAnimationFrame as s,waitTick as c}from"../../../../core/scheduling.js";import{unitName as l}from"../../../../core/unitFormatUtils.js";import{defaultAreaUnit as u,defaultVerticalLengthUnit as d,defaultLengthUnit as f}from"../../../../core/units.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as h}from"../../../../support/getDefaultUnitForView.js";import{tooltipKeys as g}from"../../keybindings.js";import{table as _,contentHeader as v,contentHeaderSpacer as y,contentHeaderActions as b,contentInputMode as x,content as S,helpMessageText as C,helpMessageIcon as w,helpMessage as T,drawContentHeaderActions as E}from"../css.js";import{getFormatters as D}from"../fields/parsingAndFormattingUtils.js";import O from"../../../../widgets/Widget.js";import{loadCalciteComponents as k}from"../../../../widgets/support/componentsUtils.js";import{tsx as A,tsxFragment as j,classes as M,messageBundle as N}from"../../../../widgets/support/widget.js";const P=Symbol(`dragHandles`);let F=class extends O{constructor(){super(...arguments),this._focusAbortController=new AbortController,this._transitionInfo=null,this._mode=`feedback`,this._getFormatters=r(D),this._onHeaderPointerDown=e=>{let t=e.target;if(!(t instanceof HTMLElement)||t?.tagName?.toLowerCase()===`calcite-button`)return;this.removeHandles(P),e.preventDefault(),e.stopPropagation();let r=process.env.NODE_ENV!==`test`;r&&t.setPointerCapture(e.pointerId),this.tooltip.onDragStart(e.clientX,e.clientY),this.addHandles([n(t,`pointermove`,({clientX:e,clientY:t})=>{this.tooltip.onDrag(e,t)}),n(t,[`pointerup`,`pointercancel`],n=>{this.removeHandles(P),r&&t.releasePointerCapture(e.pointerId),this.tooltip.onDragEnd()}),n(t,`touchstart`,e=>e.preventDefault())],P)},this._onDiscard=()=>{this.destroyed||(this.tooltip.emit(`discard`),this.info.clearInputValues(),this.exitInputMode())},this._onCommit=(e,t)=>{if(this.destroyed)return;if(this.tooltip.emit(`commit`,{type:t}),t===`commit-and-exit`){this.exitInputMode();return}if(t===`commit-on-blur`)return;let n=this._getFocusableElements(),r=n.length,i=n.indexOf(e);if(i===-1){this.exitInputMode();return}let a=((i+(t===`commit-and-next`?1:-1))%r+r)%r;I(n.at(a))},this._onKeyDown=e=>{switch(e.code){case g.next:return this._onNextKey(e);case g.discard:return e.stopPropagation(),this._onDiscard()}}}get mode(){return this._mode}get _displayUnits(){let{displayUnits:e}=this.info.toolOptions.values,t=h(this.tooltip.view);return{length:e.length??t,verticalLength:e.verticalLength??t,area:e.area??t}}get _inputUnitInfos(){let e=this._messagesUnits,t=t=>({unit:t,abbreviation:l(e,t,`abbr`)}),{inputUnits:n}=this.info.toolOptions.values,r=h(this.tooltip.view),i=n.length??r,a=n.verticalLength??r,o=n.area??r;return{length:t(f(i)),verticalLength:t(d(a)),area:t(u(o)),angle:t(`degrees`)}}get _formatters(){return this._getFormatters(this._messagesUnits,this._displayUnits)}get _elevationModeContext(){let{elevationModeContext:e}=this.info;return e&&{get mode(){return e.mode},get disabled(){return e.disabled},onChange:t=>{for(let e of this.info.editableFields){let t=this.domNode?.querySelector(`[data-field-id="${e.id}"]`);e.dirty&&t&&e.onCommit(`commit-on-blur`,t,this.fieldContext)}this.info.editableFields.some(e=>e.invalid)||e.onChange(t)}}}get fieldContext(){return{formatters:this._formatters,inputUnitInfos:this._inputUnitInfos,messages:this._messagesTooltip,toolOptions:this.info.toolOptions,elevationModeContext:this._elevationModeContext,topLayerDisabled:this.topLayerDisabled,onCommit:this._onCommit,onDiscard:this._onDiscard}}render(){let{visibleElements:e}=this.info.toolOptions.tooltips,t=this._renderedContent,n=this._renderedActions,r=this._renderedHelpMessage,i=t.length>0,a=i||!!r,o=this.mode===`input`;return A(`div`,{class:M(S,o&&x),tabIndex:-1,onkeydown:this._onKeyDown},o&&a&&e.header?A(`div`,{class:v,"data-testid":`tooltip-header`,key:`header`,onpointerdown:this._onHeaderPointerDown},A(`calcite-button`,{appearance:`transparent`,"data-testid":`tooltip-back-button`,iconFlipRtl:`both`,iconStart:`chevron-left`,key:`discard-button`,kind:`neutral`,scale:`s`,tabIndex:-1,onclick:this._onDiscard}),n.length>0?A(j,null,A(`div`,{class:y,key:`spacer`}),A(`div`,{class:b,key:`actions`},n)):null):null,i?A(`div`,{class:_,key:`content`},...t):null,r)}destroy(){this._focusAbortController.abort(),this._transitionInfo?.transition.skipTransition()}_renderActions(){return null}loadDependencies(){return k({button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`)})}async enterInputMode(e,t){try{await this._transitionTo(`input`,t),await this._focusField(e)}catch(e){i(e)}}async exitInputMode({focusOnView:e=!0}={}){try{let{container:t,info:n}=this;n.clearInputValues();let r=e?t?.closest(`.esri-view`)?.querySelector(`.esri-view-surface`):null;await this._transitionTo(`feedback`),r instanceof HTMLElement&&r.focus()}catch(e){i(e)}}_onNextKey(e){let t=this._getFocusableElements(),n=t.at(0),r=t.at(-1);n&&r&&(e.shiftKey?document.activeElement===n&&(e.preventDefault(),e.stopPropagation(),I(r)):document.activeElement===r&&(e.preventDefault(),e.stopPropagation(),I(n)))}get _renderedContent(){return L(this._renderContent())}get _renderedActions(){return L(this._renderActions())}get _renderedHelpMessage(){let{toolOptions:e,visibleElements:t}=this.info;if(!t.helpMessage)return null;let n=e.tooltips.helpMessage??this._defaultHelpMessage;if(!n)return null;let r=e.tooltips.helpMessageIcon??`information`;return A(`div`,{class:T,key:`help-message`},r?A(`calcite-icon`,{class:w,icon:r,scale:`s`}):null,A(`div`,{class:C},n))}get _defaultHelpMessage(){let{helpMessage:e,viewType:t}=this.info;if(e==null)return null;let n=t===`3d`?`helpMessages3d`:`helpMessages2d`;return this._messagesTooltip?.sketch?.[n]?.[e]}async _focusField(e){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;let{signal:t}=this._focusAbortController;await this._waitForInputs(),a(t);let n=this._getFocusableFields();await I(e?n.find(t=>t.getAttribute(`data-field-name`)===e):n.at(0))}async _transitionTo(e,n){if(this._mode===e&&!this._transitionInfo)return;if(this._transitionInfo?.mode===e)return this._transitionInfo.transition.finished;this._transitionInfo?.transition.skipTransition();let r=async()=>{this.destroyed||(this._mode=e,await c(),this.destroyed||(this.renderNow(),await c(),this.destroyed||n?.()))};if(process.env.NODE_ENV===`test`||!this.domNode?.firstChild||!document.startViewTransition||t()){await r();return}this.autoRenderingEnabled=!1;let i=this._transitionInfo={transition:document.startViewTransition(async()=>{this.destroyed||i!==this._transitionInfo||(this.autoRenderingEnabled=!0,await r())}),mode:e};try{await i.transition.finished}finally{i===this._transitionInfo&&(this._transitionInfo=null)}}async _waitForInputs(){let e=()=>Array.from(this.domNode?.querySelectorAll(`calcite-input`)??[]);for(;e().length===0;)await o(R);await s()}_getFocusableFields(){let e=Array.from(this.domNode?.querySelectorAll(`calcite-input:not([read-only]):not([disabled])`)??[]),t=Array.from(this.domNode?.querySelectorAll(`[data-tooltip-inline-control]:not([disabled])`)??[]);return[...e,...t]}_getFocusableElements(){let e=this.domNode?.querySelector(`.${E}`);return[...Array.from(e?.querySelectorAll(`.${b} calcite-button:not([disabled])`)??[]),...this._getFocusableFields()]}};e([N(`esri/core/t9n/Units`),p()],F.prototype,`_messagesUnits`,void 0),e([N(`esri/views/interactive/tooltip/t9n/Tooltip`),p()],F.prototype,`_messagesTooltip`,void 0),e([p()],F.prototype,`info`,void 0),e([p()],F.prototype,`tooltip`,void 0),e([p()],F.prototype,`_mode`,void 0),e([p()],F.prototype,`mode`,null),e([p()],F.prototype,`_displayUnits`,null),e([p()],F.prototype,`_inputUnitInfos`,null),e([p()],F.prototype,`_formatters`,null),e([p()],F.prototype,`_elevationModeContext`,null),e([p()],F.prototype,`fieldContext`,null),e([p()],F.prototype,`_renderedContent`,null),e([p()],F.prototype,`_renderedActions`,null),e([p()],F.prototype,`_renderedHelpMessage`,null),e([p()],F.prototype,`_defaultHelpMessage`,null),F=e([m(`esri.views.interactive.tooltip.content.TooltipContent`)],F);async function I(e){await e?.componentOnReady?.(),await e?.setFocus()}function L(e){return(Array.isArray(e)?e:[e]).flat(10).filter(e=>!!e)}const R=20;export{F as TooltipContent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{generateUUID as n}from"../../../../core/uuid.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";let a=class extends t{constructor(e){super(e),this.actual=null,this.lockable=!0,this.id=n(),this.inputValue=null,this.name=null,this.readOnly=!1,this.suffix=null,this.visible=!0,this.invalid=!1,this.unlockOnVertexPlacement=!0,this.displayOrder=0}get committed(){return this.lockable?this._get(`committed`):null}set committed(e){this.lockable&&this._set(`committed`,e)}get dirty(){return this.inputValue!=null}get lockDisabled(){return this.actual==null&&!this.dirty&&!this.locked}get locked(){return this.lockable&&this.committed!=null}onInput(e){this.inputValue=e,this.invalid=!1}onCommit(e,t,n){this.lockable?this._onCommitLockable(e,n):this._onCommitNonLockable(n)
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{generateUUID as n}from"../../../../core/uuid.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";let a=class extends t{constructor(e){super(e),this.actual=null,this.lockable=!0,this.id=n(),this.inputValue=null,this.name=null,this.readOnly=!1,this.suffix=null,this.visible=!0,this.invalid=!1,this.unlockOnVertexPlacement=!0,this.displayOrder=0}get committed(){return this.lockable?this._get(`committed`):null}set committed(e){this.lockable&&this._set(`committed`,e)}get dirty(){return this.inputValue!=null}get lockDisabled(){return this.actual==null&&!this.dirty&&!this.locked}get locked(){return this.lockable&&this.committed!=null}onInput(e){this.inputValue=e,this.invalid=!1}onCommit(e,t,n){this.lockable?this._onCommitLockable(e,n):this._onCommitNonLockable(n),this.invalid&&e===`commit-and-exit`||n.onCommit(t,e)}_onCommitLockable(e,t){let{inputValue:n,locked:r}=this;r&&o(n)?this.unlock():(e===`commit-and-exit`&&!r||n!=null)&&this._parseInputAndLock(t)}_onCommitNonLockable(e){let{inputValue:t}=this;o(t)?this.lockable?this.setActual(null):this.clearInputValue():t!=null&&this._parseInputAndSetActual(e)}applyValue(e){this.lockable?this.lock(e):this.setActual(e)}clearInputValue(){this.inputValue=null,this.invalid=!1}setActual(e){this.actual=e,this.clearInputValue()}lock(e){this.lockable&&(this.committed=e??this.actual,this.clearInputValue())}unlock(){this.lockable&&(this.committed=null,this.clearInputValue())}toggleLock(e){this.lockable&&(this.locked?this.unlock():this._parseInputAndLock(e))}getSuffix(e){let{suffix:t}=this;return typeof t==`function`?t(e):t}getFormattedValue(e){let{actual:t,committed:n,format:r}=this;return n==null?t==null?null:r(t,e):r(n,e)}getRawDisplayValue(e){let{actual:t,committed:n,inputValue:r}=this;return r??(this.lockable&&n!=null?this.formatForInputMode(n,e):t==null?null:this.formatForInputMode(t,e))}_parseInputAndSetActual(e){let{inputValue:t}=this;if(t==null||o(t))return this.setActual(null);let n=this.parse(t,e);n==null?this.invalid=!0:this.setActual(n)}_parseInputAndLock(e){let{inputValue:t,actual:n}=this;if(o(t))return this.unlock();if(t==null)return this.lock(n);let r=this.parse(t,e);r==null?this.invalid=!0:this.lock(r)}};e([r()],a.prototype,`actual`,void 0),e([r()],a.prototype,`committed`,null),e([r()],a.prototype,`dirty`,null),e([r()],a.prototype,`lockDisabled`,null),e([r()],a.prototype,`format`,void 0),e([r()],a.prototype,`formatForInputMode`,void 0),e([r()],a.prototype,`lockable`,void 0),e([r()],a.prototype,`locked`,null),e([r()],a.prototype,`id`,void 0),e([r()],a.prototype,`inputValue`,void 0),e([r()],a.prototype,`name`,void 0),e([r()],a.prototype,`parse`,void 0),e([r()],a.prototype,`readOnly`,void 0),e([r()],a.prototype,`suffix`,void 0),e([r()],a.prototype,`title`,void 0),e([r()],a.prototype,`visible`,void 0),e([r()],a.prototype,`invalid`,void 0),e([r()],a.prototype,`unlockOnVertexPlacement`,void 0),e([r()],a.prototype,`displayOrder`,void 0),a=e([i(`esri.views.interactive.tooltip.fields.TooltipField`)],a);function o(e){return e!=null&&e.trim()===``}export{a as TooltipField};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import n from"../../core/Error.js";import r from"../../core/Logger.js";import{someMap as i}from"../../core/MapUtils.js";import{createAbortError as a,isAbortError as o}from"../../core/promiseUtils.js";import s from"../../core/ReactiveMap.js";import{on as c,watch as l,syncAndInitial as u}from"../../core/reactiveUtils.js";import{schedule as d}from"../../core/scheduling.js";import{property as f,subclass as p}from"../../core/accessorSupport/decorators.js";import{get as m}from"../../core/accessorSupport/get.js";import{UpdatingHandles as h}from"../../core/support/UpdatingHandles.js";import{destroyMap as g}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as _}from"./LayerLayerViewInfo.js";function v(e){return typeof e==`object`&&!!e&&`layerViews`in e}let y=class extends t{constructor(e){super(e),this._layerLayerViewInfoMap=new s,this._recyclingInfoMap=new s,this._watchUpdatingTracking=new h,this._preloadLayerViewModules=()=>{let e=this.view.map?.allLayers;if(e)for(let t of e)this.layerViewFilter?.(t)!==!1&&this.layerViewImporter.hasLayerViewModule(t)&&this.layerViewImporter.importLayerView(t)},this._reschedule=()=>this.destroyed?Promise.reject():(this._workPromise??(this._workPromise=Promise.withResolvers(),this._workPromise.promise.catch(()=>{})),this.removeHandles(`reschedule`),this.addHandles(d(this._doWork),`reschedule`),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;let{map:e}=this.view;if(!e){this.clear();return}if(this._map!==e&&(this.clear(),this._map=e),this._workPromise==null)return;this.removeHandles(`reschedule`),this.removeHandles(`collection-change`);let t=new Set,n=[],r=this.view.ready,i=e=>{if(e!=null){for(let a of e)if(a){if(this.layerViewFilter?.(a)===!1)continue;t.add(a);let e=this._layerLayerViewInfoMap.get(a);e&&r?e.start():!e&&!this._recyclingInfoMap.has(a)&&n.push(a),`layers`in a&&a.layers&&i(a.layers)}}};for(let e of this._rootCollectionNames)i(m(this,e));let a=[],s=e=>{let t=e.tryRecycle(n);if(t){let n=e.layer;this._recyclingInfoMap.set(n,e),this._watchUpdatingTracking.consumePromise(t),t.then(()=>{this._recyclingInfoMap.get(n)===e&&e.promise===t&&(this._recyclingInfoMap.delete(n),this._layerLayerViewInfoMap.set(n,e),this._reschedule())}).catch(r=>{this._recyclingInfoMap.get(n)!==e||e.promise!==t||o(r)||(this._recyclingInfoMap.delete(n),e.destroy(),this._reschedule())})}else a.push(e)};for(let e of this._layerLayerViewInfoMap.values())t.has(e.layer)||(this._layerLayerViewInfoMap.delete(e.layer),s(e));for(let e of this._recyclingInfoMap.values())t.has(e.layer)||(this._recyclingInfoMap.delete(e.layer),s(e));for(let e of n)this._createLayerView(e);this._refreshCollections(),a.forEach(e=>e.destroy());let c=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);t.forEach(e=>`layers`in e&&c.push(e.layers)),this.addHandles(c.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),`collection-change`),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([c(()=>this.view?.map?.allLayers,`change`,this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),l(()=>{let e=this.view,t=e?.map;return[t?.basemap,t?.ground,t?.layers,e?.ready]},()=>this._reschedule().catch(()=>{}),u)]),this._preloadLayerViewModules(),this._reschedule().catch(()=>{})}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),g(this._recyclingInfoMap),g(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,this._workPromise!=null&&(this._workPromise.reject(a()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return this._workPromise!=null||this._watchUpdatingTracking.updating||i(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(let t of this._layerLayerViewInfoMap.values())t.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),g(this._layerLayerViewInfoMap),g(this._recyclingInfoMap))}async whenLayerView(e){await this._reschedule();let t=this._layerLayerViewInfoMap.get(e)?.promise;if(!t){let t=this._recyclingInfoMap.get(e)?.promise;if(!t)throw new n(`view:no-layerview-for-layer`,`No layerview has been found for the layer`,{layer:e});return t}return t}isCreatingLayerViewsForLayer(e,t){let n=this._layerLayerViewInfoMap.get(e);if(!n?.done)return!0;let r=n.layerView;return r&&t&&r.parent!==t?!0:n.done&&r&&`layers`in e&&e.layers?.length?e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,r)):!1}get allLayerViews(){let e=[];for(let t of this._layerLayerViewInfoMap.values())t.layerView&&e.push(t.layerView);for(let t of this._recyclingInfoMap.values())t.layerView&&e.push(t.layerView);return e}_refreshCollections(){for(let[e,t]of this._layersToLayerViews)this._populateLayerViewsOwners(m(this,e),m(this,t),this.view)}_clearCollections(){for(let e of this._layersToLayerViews.values())m(this,e)?.removeAll()}_populateLayerViewsOwners(e,t,n){if(!e||!t){t?.removeAll();return}let r=0;for(let i of e){let e=this._layerLayerViewInfoMap.get(i);if(!e?.layerView)continue;let{layerView:a}=e;a.layer=i,a.parent=n,t.at(r)!==a&&t.splice(r,0,a),`layers`in i&&v(a)&&this._populateLayerViewsOwners(i.layers,a.layerViews,a),++r}r<t.length&&t.splice(r)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);let t=new _(e,this.view,this.layerViewImporter),n=t.promise?.then(()=>this._refreshCollections(),t=>{(!t||!o(t)&&t.name!==`cancelled:layerview-create`)&&r.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??`no title`}', id:'${e.id??`no id`}' of type '${e.type}'.`,{layer:e,error:t})
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import n from"../../core/Error.js";import r from"../../core/Logger.js";import{someMap as i}from"../../core/MapUtils.js";import{createAbortError as a,isAbortError as o}from"../../core/promiseUtils.js";import s from"../../core/ReactiveMap.js";import{on as c,watch as l,syncAndInitial as u}from"../../core/reactiveUtils.js";import{schedule as d}from"../../core/scheduling.js";import{property as f,subclass as p}from"../../core/accessorSupport/decorators.js";import{get as m}from"../../core/accessorSupport/get.js";import{UpdatingHandles as h}from"../../core/support/UpdatingHandles.js";import{destroyMap as g}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as _}from"./LayerLayerViewInfo.js";function v(e){return typeof e==`object`&&!!e&&`layerViews`in e}let y=class extends t{constructor(e){super(e),this._layerLayerViewInfoMap=new s,this._recyclingInfoMap=new s,this._watchUpdatingTracking=new h,this._preloadLayerViewModules=()=>{let e=this.view.map?.allLayers;if(e)for(let t of e)this.layerViewFilter?.(t)!==!1&&this.layerViewImporter.hasLayerViewModule(t)&&this.layerViewImporter.importLayerView(t)},this._reschedule=()=>this.destroyed?Promise.reject():(this._workPromise??(this._workPromise=Promise.withResolvers(),this._workPromise.promise.catch(()=>{})),this.removeHandles(`reschedule`),this.addHandles(d(this._doWork),`reschedule`),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;let{map:e}=this.view;if(!e){this.clear();return}if(this._map!==e&&(this.clear(),this._map=e),this._workPromise==null)return;this.removeHandles(`reschedule`),this.removeHandles(`collection-change`);let t=new Set,n=[],r=this.view.ready,i=e=>{if(e!=null){for(let a of e)if(a){if(this.layerViewFilter?.(a)===!1)continue;t.add(a);let e=this._layerLayerViewInfoMap.get(a);e&&r?e.start():!e&&!this._recyclingInfoMap.has(a)&&n.push(a),`layers`in a&&a.layers&&i(a.layers)}}};for(let e of this._rootCollectionNames)i(m(this,e));let a=[],s=e=>{let t=e.tryRecycle(n);if(t){let n=e.layer;this._recyclingInfoMap.set(n,e),this._watchUpdatingTracking.consumePromise(t),t.then(()=>{this._recyclingInfoMap.get(n)===e&&e.promise===t&&(this._recyclingInfoMap.delete(n),this._layerLayerViewInfoMap.set(n,e),this._reschedule())}).catch(r=>{this._recyclingInfoMap.get(n)!==e||e.promise!==t||o(r)||(this._recyclingInfoMap.delete(n),e.destroy(),this._reschedule())})}else a.push(e)};for(let e of this._layerLayerViewInfoMap.values())t.has(e.layer)||(this._layerLayerViewInfoMap.delete(e.layer),s(e));for(let e of this._recyclingInfoMap.values())t.has(e.layer)||(this._recyclingInfoMap.delete(e.layer),s(e));for(let e of n)this._createLayerView(e);this._refreshCollections(),a.forEach(e=>e.destroy());let c=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);t.forEach(e=>`layers`in e&&c.push(e.layers)),this.addHandles(c.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),`collection-change`),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([c(()=>this.view?.map?.allLayers,`change`,this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),l(()=>{let e=this.view,t=e?.map;return[t?.basemap,t?.ground,t?.layers,e?.ready]},()=>this._reschedule().catch(()=>{}),u)]),this._preloadLayerViewModules(),this._reschedule().catch(()=>{})}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),g(this._recyclingInfoMap),g(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,this._workPromise!=null&&(this._workPromise.reject(a()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return this._workPromise!=null||this._watchUpdatingTracking.updating||i(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(let t of this._layerLayerViewInfoMap.values())t.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),g(this._layerLayerViewInfoMap),g(this._recyclingInfoMap))}async whenLayerView(e){await this._reschedule();let t=this._layerLayerViewInfoMap.get(e)?.promise;if(!t){let t=this._recyclingInfoMap.get(e)?.promise;if(!t)throw new n(`view:no-layerview-for-layer`,`No layerview has been found for the layer`,{layer:e});return t}return t}isCreatingLayerViewsForLayer(e,t){let n=this._layerLayerViewInfoMap.get(e);if(!n?.done)return!0;let r=n.layerView;return r&&t&&r.parent!==t?!0:n.done&&r&&`layers`in e&&e.layers?.length?e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,r)):!1}get allLayerViews(){let e=[];for(let t of this._layerLayerViewInfoMap.values())t.layerView&&e.push(t.layerView);for(let t of this._recyclingInfoMap.values())t.layerView&&e.push(t.layerView);return e}_refreshCollections(){for(let[e,t]of this._layersToLayerViews)this._populateLayerViewsOwners(m(this,e),m(this,t),this.view)}_clearCollections(){for(let e of this._layersToLayerViews.values())m(this,e)?.removeAll()}_populateLayerViewsOwners(e,t,n){if(!e||!t){t?.removeAll();return}let r=0;for(let i of e){let e=this._layerLayerViewInfoMap.get(i);if(!e?.layerView)continue;let{layerView:a}=e;a.layer=i,a.parent=n,t.at(r)!==a&&t.splice(r,0,a),`layers`in i&&v(a)&&this._populateLayerViewsOwners(i.layers,a.layerViews,a),++r}r<t.length&&t.splice(r)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);let t=new _(e,this.view,this.layerViewImporter),n=t.promise?.then(()=>this._refreshCollections(),t=>{(!t||!o(t)&&t.name!==`cancelled:layerview-create`)&&r.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??`no title`}', id:'${e.id??`no id`}' of type '${e.type}'.`,{layer:e,error:t}),this.destroyed||this._refreshCollections()});this._watchUpdatingTracking.consumePromise(n),this._layerLayerViewInfoMap.set(e,t),this.view.ready&&t.start()}};e([f()],y.prototype,`_workPromise`,void 0),e([f({readOnly:!0})],y.prototype,`_watchUpdatingTracking`,void 0),e([f({readOnly:!0})],y.prototype,`_layersToLayerViews`,void 0),e([f({constructOnly:!0})],y.prototype,`layerviewMapping`,void 0),e([f({readOnly:!0})],y.prototype,`_rootCollectionNames`,null),e([f({constructOnly:!0})],y.prototype,`layerViewFilter`,void 0),e([f()],y.prototype,`layerViewImporter`,void 0),e([f({readOnly:!0})],y.prototype,`updating`,null),e([f({readOnly:!0})],y.prototype,`updatingRemaining`,null),e([f({constructOnly:!0})],y.prototype,`view`,void 0),e([f({readOnly:!0})],y.prototype,`allLayerViews`,null),y=e([p(`esri.views.support.LayerViewManager`)],y);const b=y;export{b as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import"../../core/has.js";import{removeMaybe as e}from"../../core/maybe.js";import{onAbort as t,onAbortOrThrow as n,createAbortError as r,isPromiseLike as i}from"../../core/promiseUtils.js";import a from"../../core/Queue.js";import o from"../../core/ReactiveMap.js";import{schedule as s}from"../../core/scheduling.js";import{signal as c}from"../../core/signal.js";class l{constructor(e,t){this.item=e,this.controller=t,this.promise=null}}class u{constructor(e){this._schedule=null,this._task=null,this._deferreds=new o,this._controllers=new o,this._processingItems=new o,this._pausedSignal=c(!1),this.concurrency=1,e.concurrency&&(this.concurrency=e.concurrency),this._queue=new a(e.peeker),this.process=e.process;let t=e.scheduler;
|
|
2
|
+
import"../../core/has.js";import{removeMaybe as e}from"../../core/maybe.js";import{onAbort as t,onAbortOrThrow as n,createAbortError as r,isPromiseLike as i}from"../../core/promiseUtils.js";import a from"../../core/Queue.js";import o from"../../core/ReactiveMap.js";import{schedule as s}from"../../core/scheduling.js";import{signal as c}from"../../core/signal.js";class l{constructor(e,t){this.item=e,this.controller=t,this.promise=null}}class u{constructor(e){this._schedule=null,this._task=null,this._deferreds=new o,this._controllers=new o,this._processingItems=new o,this._pausedSignal=c(!1),this.concurrency=1,e.concurrency&&(this.concurrency=e.concurrency),this._queue=new a(e.peeker),this.process=e.process;let t=e.scheduler;this._scheduler=t??null,this._priority=e.priority??null}destroy(){this.clear(),this._schedule=e(this._schedule),this._task=e(this._task),this._scheduler=this._priority=null}get updating(){return!!this._task?.updating||this.readyToRun}get length(){return this._processingItems.size+this._queue.length}abort(e){let t=this._controllers.get(e);t&&t.abort()}clear(){this._queue.clear();let t=[];this._controllers.forEach(e=>t.push(e)),this._controllers.clear(),t.forEach(e=>e.abort()),this._processingItems.clear(),this._cancelNext(),this._task=e(this._task)}forEach(e){this._deferreds.forEach((t,n)=>e(n))}get(e){let t=this._deferreds.get(e);return t?t.promise:void 0}isOngoing(e){return this._processingItems.has(e)}has(e){return this._deferreds.has(e)}pause(){this._pausedSignal.value||(this._pausedSignal.value=!0,this._cancelNext())}push(i,a){let o=this.get(i);if(o)return o;let s=new AbortController,c=null;a&&(c=t(a,()=>s.abort()));let l=()=>{let e=this._processingItems.get(i);e&&e.controller.abort(),u(),f.reject(r())},u=()=>{d.remove(),c?.remove(),this._removeItem(i),this._queue.remove(i),this._scheduleNext(),this._queue.length||(this._task=e(this._task))},d=n(s.signal,l),f=Promise.withResolvers();return this._deferreds.set(i,f),this._controllers.set(i,s),f.promise.then(u,u),this._queue.push(i),this._scheduleNext(),f.promise}last(){return this._queue.last()}lastPromise(){let e=this.last();return e?this.get(e):null}peek(){return this._queue.peek()}popLast(){let e=this._queue.popLast();return e&&(this._deferreds.get(e)?.reject(r()),this._removeItem(e)),e}reset(){let e=Array.from(this._processingItems.values());this._processingItems.clear();for(let t of e)this._queue.push(t.item),t.controller.abort();this._scheduleNext()}resume(){this._pausedSignal.value&&(this._pausedSignal.value=!1,this._scheduleNext())}takeAll(){let e=[];for(;this._queue.length;)e.push(this._queue.pop());return this.clear(),e}get readyToRun(){return!this._pausedSignal.value&&this._queue.length>0&&this._processingItems.size<this.concurrency}runTask(e){for(;!e.done&&this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop()),e.madeProgress()}_removeItem(e){this._deferreds.delete(e),this._controllers.delete(e),this._processingItems.delete(e)}_scheduleNext(){!this._queue.length||this._task||this._pausedSignal.value||this._schedule||(!this._task&&this._scheduler&&this._priority?this._task=this._scheduler.registerTask(this._priority,this):this._schedule=s(()=>{this._schedule=null,this._next()}))}_next(){for(;this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop())}_cancelNext(){this._schedule&&=(this._schedule.remove(),null)}_processResult(e,t){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).resolve(t))}_processError(e,t){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).reject(t))}_canProcessFulfillment(e){return!(!this._deferreds.get(e.item)||this._processingItems.get(e.item)!==e)}_process(e){if(e==null)return;let t,n=new AbortController,r=new l(e,n);this._processingItems.set(e,r);try{t=this.process(e,n.signal)}catch(e){this._processError(r,e)}i(t)?(r.promise=t,t.then(e=>this._processResult(r,e),e=>this._processError(r,e))):this._processResult(r,t)}get test(){}}export{u as ScheduledQueueProcessor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{clamp as e}from"../../core/mathUtils.js";import{createEmptyImageData as t}from"../../core/imageUtils.js";const n=2048;function r(t,n){let{format:r,quality:i,rotation:a,disableDecorations:o}=t||{},s=b(t,n.padding),c=_(t,{width:n.width-s.left-s.right,height:n.height-s.top-s.bottom}),{width:l,height:u}=g(t,c),d=x(r),f=E[d];return{format:d,quality:e(i??f,0,100),area:c,width:l,height:u,rotation:a,disableDecorations:!!o,ignoreBackground:!!t?.ignoreBackground,ignorePadding:!!t?.ignorePadding}}function i(e,t){let n=r(e,t),i=n.area,a=n.width/i.width,o=b(n,t.padding),s=o.left+o.right,c=o.top+o.bottom,l=t.width-s,u=t.height-c,d=Math.floor(l*a+s),f=Math.floor(u*a+c),p=e?.layers??[],m=n.ignoreBackground,h=n.ignorePadding;return{framebufferWidth:d,framebufferHeight:f,region:{x:Math.floor(i.x*a)+o.left,y:Math.floor(i.y*a)+o.top,width:n.width,height:n.height},format:n.format,quality:n.quality,rotation:n.rotation,pixelRatio:a,layers:p,disableDecorations:n.disableDecorations,ignoreBackground:m,ignorePadding:h,olidColor:!1}}function a(e,t,n){let{ctx:r,canvas:i}=s(e,n),a=r.getImageData(0,0,e.width,e.height),o=d(i,t);return c(i),{dataUrl:o,data:a}}function o(e,t){let{ctx:n,canvas:r}=s(e,t),i=n.getImageData(0,0,e.width,e.height);return c(r),i}function s(e,t){let n=l();t.premultipliedAlpha&&C(e),n.width=e.width,n.height=e.height;let r=n.getContext(`2d`,{willReadFrequently:!0});return r.putImageData(e,0,0),t.flipY&&S(r),{ctx:r,canvas:n}}function c(e){e.width=0,e.height=0}function l(){return u??=document.createElement(`canvas`),u}let u=null;function d(e,t){let n=w[t.format],r=t.quality/100;return e.toDataURL(n,r)}function f(t,n){let r=x(t),i=E[r];return{format:r,quality:e(n??i,0,100)}}function p(e,t){return t/Math.max(e[0],e[1])}function m(e,t,n,r=0,i=0,a=e.width-r,o=e.height-i,s=!1){let{data:c}=e,{width:l,height:u,data:d}=t,f=a/l,p=o/u,m=Math.ceil(f/2),h=Math.ceil(p/2),g=e.width;for(let e=0;e<u;e++)for(let t=0;t<l;t++){let a=(t+(s?u-e-1:e)*l)*4,o=0,_=0,v=0,y=0,b=0,x=0,S=(e+.5)*p;for(let a=Math.floor(e*p);a<(e+1)*p;a++){let e=Math.abs(S-(a+.5))/h,s=(t+.5)*f,l=e*e;for(let e=Math.floor(t*f);e<(t+1)*f;e++){let t=Math.abs(s-(e+.5))/m,u=Math.sqrt(l+t*t);if(u>=1)continue;let d=2*u*u*u-3*u*u+1,f=4*(r+e+(i+a)*g);x+=d*c[f+3],_+=d,!n&&c[f+3]<255&&(d=d*c[f+3]/255),v+=d*c[f],y+=d*c[f+1],b+=d*c[f+2],o+=d}}d[a]=v/o,d[a+1]=y/o,d[a+2]=b/o,d[a+3]=x/_}return t}function h(e,t,r){if(!t)return e;let{framebufferWidth:i,framebufferHeight:a,pixelRatio:o,region:s}=e,c=b(e,r),l=c.left+c.right,u=c.top+c.bottom,d=i-l,f=a-u,p=Math.min(8,Math.min((n-l)/d,(n-u)/f));return p<1.5?e:{...e,framebufferWidth:Math.round(d*p)+l,framebufferHeight:Math.round(f*p)+u,pixelRatio:o*p,resample:{region:{x:Math.round((s.x-c.left)*p)+c.left,y:Math.round((s.y-c.top)*p)+c.top,width:Math.round(s.width*p),height:Math.round(s.height*p)},width:i,height:a}}}function g(e,t){if(!e)return t;let n=e.width,r=e.height;if(n!=null&&r!=null)return{width:Math.floor(n),height:Math.floor(r)};if(n==null&&r==null)return t;let i=t.width/t.height;return r==null?{width:Math.floor(n),height:Math.floor(n/i)}:{width:Math.floor(r*i),height:Math.floor(r)}}function _(e,t){let n={x:0,y:0,width:t.width,height:t.height};if(e?.area){e.area.x!=null&&(n.x=Math.floor(e.area.x)),e.area.y!=null&&(n.y=Math.floor(e.area.y));let r=e.area.width==null?null:Math.floor(e.area.width),i=e.area.height==null?null:Math.floor(e.area.height);if(n.width=t.width-n.x,n.height=t.height-n.y,r!=null&&i!=null)n.width=Math.min(n.width,r),n.height=Math.min(n.height,i);else if(r==null&&i!=null){let e=Math.min(n.width,r);n.height=e/n.width*n.height,n.width=e}else if(r!=null&&i==null){let e=Math.min(n.height,i);n.width=e/n.height*n.width,n.height=e}}return v(y(n,e),t)}function v(e,t){let n=Math.floor(Math.max(e.x,0)),r=Math.floor(Math.max(e.y,0)),i={x:n,y:r,width:Math.floor(Math.min(e.width,t.width-n)),height:Math.floor(Math.min(e.height,t.height-r))},a=i.width/i.height,o=e.width/e.height;if(o===a)return i;if(o>a){let e=Math.floor(i.width/o),t=i.height-e;return{x:i.x,y:Math.floor(i.y+t/2),width:i.width,height:e}}let s=Math.floor(i.height*o),c=i.width-s;return{x:Math.floor(i.x+c/2),y:i.y,width:s,height:i.height}}function y(e,t){if(t?.width==null||t.height==null)return e;let n=t.width/t.height,r=e.width/e.height;if(r===n)return e;if(r<n){let t=Math.floor(e.height*n);return e.x-=(t-e.width)/2,e.width=t,e}let i=Math.floor(e.width/n);return e.y-=(i-e.height)/2,e.height=i,e}function b(e,t){return!t||e?.ignorePadding?D:t}function x(e){switch(e){case`png`:case`jpg`:case`jpeg`:return e;case null:case void 0:return T;default:return T}}function S(e){e.save(),e.globalCompositeOperation=`copy`,e.scale(1,-1),e.translate(0,-e.canvas.height),e.drawImage(e.canvas,0,0),e.restore()}function C(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4){let n=t[e+3];if(n!==255&&n>0){let r=255/n;t[e]=t[e]*r,t[e+1]=t[e+1]*r,t[e+2]=t[e+2]*r}}}const w={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`},T=`png`,E={png:100,jpg:98,jpeg:98},D={top:0,right:0,bottom:0,left:0};export{r as completeUserSettings,t as createEmptyImageData,a as encode,o as encodeData,f as getFormatAndQuality,p as getMaximumResolutionScale,m as resampleHermite,h as screenshotSuperSampleSettings,d as toDataUrl,i as toRenderSettings};
|
|
2
|
+
import{clamp as e}from"../../core/mathUtils.js";import{createEmptyImageData as t}from"../../core/imageUtils.js";const n=2048;function r(t,n){let{format:r,quality:i,rotation:a,disableDecorations:o}=t||{},s=b(t,n.padding),c=_(t,{width:n.width-s.left-s.right,height:n.height-s.top-s.bottom}),{width:l,height:u}=g(t,c),d=x(r),f=E[d];return{format:d,quality:e(i??f,0,100),area:c,width:l,height:u,rotation:a,disableDecorations:!!o,ignoreBackground:!!t?.ignoreBackground,ignorePadding:!!t?.ignorePadding}}function i(e,t){let n=r(e,t),i=n.area,a=n.width/i.width,o=b(n,t.padding),s=o.left+o.right,c=o.top+o.bottom,l=t.width-s,u=t.height-c,d=Math.floor(l*a+s),f=Math.floor(u*a+c);(d<=0||f<=0)&&(d=i.width,f=i.height);let p=e?.layers??[],m=n.ignoreBackground,h=n.ignorePadding;return{framebufferWidth:d,framebufferHeight:f,region:{x:Math.floor(i.x*a)+o.left,y:Math.floor(i.y*a)+o.top,width:n.width,height:n.height},format:n.format,quality:n.quality,rotation:n.rotation,pixelRatio:a,layers:p,disableDecorations:n.disableDecorations,ignoreBackground:m,ignorePadding:h,olidColor:!1}}function a(e,t,n){let{ctx:r,canvas:i}=s(e,n),a=r.getImageData(0,0,e.width,e.height),o=d(i,t);return c(i),{dataUrl:o,data:a}}function o(e,t){let{ctx:n,canvas:r}=s(e,t),i=n.getImageData(0,0,e.width,e.height);return c(r),i}function s(e,t){let n=l();t.premultipliedAlpha&&C(e),n.width=e.width,n.height=e.height;let r=n.getContext(`2d`,{willReadFrequently:!0});return r.putImageData(e,0,0),t.flipY&&S(r),{ctx:r,canvas:n}}function c(e){e.width=0,e.height=0}function l(){return u??=document.createElement(`canvas`),u}let u=null;function d(e,t){let n=w[t.format],r=t.quality/100;return e.toDataURL(n,r)}function f(t,n){let r=x(t),i=E[r];return{format:r,quality:e(n??i,0,100)}}function p(e,t){return t/Math.max(e[0],e[1])}function m(e,t,n,r=0,i=0,a=e.width-r,o=e.height-i,s=!1){let{data:c}=e,{width:l,height:u,data:d}=t,f=a/l,p=o/u,m=Math.ceil(f/2),h=Math.ceil(p/2),g=e.width;for(let e=0;e<u;e++)for(let t=0;t<l;t++){let a=(t+(s?u-e-1:e)*l)*4,o=0,_=0,v=0,y=0,b=0,x=0,S=(e+.5)*p;for(let a=Math.floor(e*p);a<(e+1)*p;a++){let e=Math.abs(S-(a+.5))/h,s=(t+.5)*f,l=e*e;for(let e=Math.floor(t*f);e<(t+1)*f;e++){let t=Math.abs(s-(e+.5))/m,u=Math.sqrt(l+t*t);if(u>=1)continue;let d=2*u*u*u-3*u*u+1,f=4*(r+e+(i+a)*g);x+=d*c[f+3],_+=d,!n&&c[f+3]<255&&(d=d*c[f+3]/255),v+=d*c[f],y+=d*c[f+1],b+=d*c[f+2],o+=d}}d[a]=v/o,d[a+1]=y/o,d[a+2]=b/o,d[a+3]=x/_}return t}function h(e,t,r){if(!t)return e;let{framebufferWidth:i,framebufferHeight:a,pixelRatio:o,region:s}=e,c=b(e,r),l=c.left+c.right,u=c.top+c.bottom,d=i-l,f=a-u,p=Math.min(8,Math.min((n-l)/d,(n-u)/f));return p<1.5?e:{...e,framebufferWidth:Math.round(d*p)+l,framebufferHeight:Math.round(f*p)+u,pixelRatio:o*p,resample:{region:{x:Math.round((s.x-c.left)*p)+c.left,y:Math.round((s.y-c.top)*p)+c.top,width:Math.round(s.width*p),height:Math.round(s.height*p)},width:i,height:a}}}function g(e,t){if(!e)return t;let n=e.width,r=e.height;if(n!=null&&r!=null)return{width:Math.floor(n),height:Math.floor(r)};if(n==null&&r==null)return t;let i=t.width/t.height;return r==null?{width:Math.floor(n),height:Math.floor(n/i)}:{width:Math.floor(r*i),height:Math.floor(r)}}function _(e,t){let n={x:0,y:0,width:t.width,height:t.height};if(e?.area){e.area.x!=null&&(n.x=Math.floor(e.area.x)),e.area.y!=null&&(n.y=Math.floor(e.area.y));let r=e.area.width==null?null:Math.floor(e.area.width),i=e.area.height==null?null:Math.floor(e.area.height);if(n.width=t.width-n.x,n.height=t.height-n.y,r!=null&&i!=null)n.width=Math.min(n.width,r),n.height=Math.min(n.height,i);else if(r==null&&i!=null){let e=Math.min(n.width,r);n.height=e/n.width*n.height,n.width=e}else if(r!=null&&i==null){let e=Math.min(n.height,i);n.width=e/n.height*n.width,n.height=e}}return v(y(n,e),t)}function v(e,t){let n=Math.floor(Math.max(e.x,0)),r=Math.floor(Math.max(e.y,0)),i={x:n,y:r,width:t.width>0?Math.floor(Math.min(e.width,t.width-n)):e.width,height:t.height>0?Math.floor(Math.min(e.height,t.height-r)):e.height},a=i.width/i.height,o=e.width/e.height;if(o===a)return i;if(o>a){let e=Math.floor(i.width/o),t=i.height-e;return{x:i.x,y:Math.floor(i.y+t/2),width:i.width,height:e}}let s=Math.floor(i.height*o),c=i.width-s;return{x:Math.floor(i.x+c/2),y:i.y,width:s,height:i.height}}function y(e,t){if(t?.width==null||t.height==null)return e;let n=t.width/t.height,r=e.width>0&&e.height>0?e.width/e.height:0;if(r===0)return e.x=0,e.y=0,e.width=Math.floor(t.width),e.height=Math.floor(t.height),e;if(r===n)return e;if(r<n){let t=Math.floor(e.height*n);return e.x-=(t-e.width)/2,e.width=t,e}let i=Math.floor(e.width/n);return e.y-=(i-e.height)/2,e.height=i,e}function b(e,t){return!t||e?.ignorePadding?D:t}function x(e){switch(e){case`png`:case`jpg`:case`jpeg`:return e;case null:case void 0:return T;default:return T}}function S(e){e.save(),e.globalCompositeOperation=`copy`,e.scale(1,-1),e.translate(0,-e.canvas.height),e.drawImage(e.canvas,0,0),e.restore()}function C(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4){let n=t[e+3];if(n!==255&&n>0){let r=255/n;t[e]=t[e]*r,t[e+1]=t[e+1]*r,t[e+2]=t[e+2]*r}}}const w={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`},T=`png`,E={png:100,jpg:98,jpeg:98},D={top:0,right:0,bottom:0,left:0};export{r as completeUserSettings,t as createEmptyImageData,a as encode,o as encodeData,f as getFormatAndQuality,p as getMaximumResolutionScale,m as resampleHermite,h as screenshotSuperSampleSettings,d as toDataUrl,i as toRenderSettings};
|
package/views/ui/UI.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{getLocale as t,onLocaleChange as n}from"../../intl.js";import r from"../../core/Accessor.js";import{isSome as i}from"../../core/arrayUtils.js";import{EventedAccessor as a}from"../../core/Evented.js";import{makeHandle as o}from"../../core/handleUtils.js";import{watch as s,initial as c}from"../../core/reactiveUtils.js";import{property as l,cast as u,subclass as d}from"../../core/accessorSupport/decorators.js";import{setCalciteModeClass as f}from"../../support/modeUtils.js";import p from"./Component.js";import{isRTL as m}from"../../widgets/support/widget.js";const h={left:0,top:0,bottom:0,right:0},g={bottom:30,top:15,right:15,left:15},_=`esri-ui`,v={ui:_,corner:`${_}-corner`,innerContainer:`${_}-inner-container`,manualContainer:`${_}-manual-container`,cornerContainer:`${_}-corner-container`,topLeft:`${_}-top-left`,topRight:`${_}-top-right`,bottomLeft:`${_}-bottom-left`,bottomRight:`${_}-bottom-right`};function y(e){return e&&!e._started&&typeof e.postMixInProperties==`function`&&typeof e.buildRendering==`function`&&typeof e.postCreate==`function`&&typeof e.startup==`function`}function b(e){return e===0?`0`:`${e}px`}function x(e){let t=typeof e==`object`&&!!e&&Object.getPrototypeOf(e);return(t===null||t===Object.prototype)&&(`component`in e||`index`in e||`position`in e)?e:null}function S(e,{top:t,bottom:n,left:r,right:i}){e.style.top=t,e.style.bottom=n,e.style.left=r,e.style.right=i}let C=class extends a{constructor(e){super(e),this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this._components=[],this._componentMap=new Map,this._removeWidgetHandleKey=Symbol(`componentOnRemoveSymbol`),this._locale=t(),this.view=null,this._applyViewPadding=()=>{let e=this.container;e&&S(e,this._toPixelPosition(this._getViewPadding()))},this._applyUIPadding=()=>{let e=this._innerContainer;e&&S(e,this._toPixelPosition(this.padding))},this._initContainers()}initialize(){this.addHandles([s(()=>[this.view?.padding,this.container],this._applyViewPadding,c),s(()=>this.padding,this._applyUIPadding,c),s(()=>[this.container,this._locale],([e,t])=>{e&&e.setAttribute(`lang`,t)},c),n(e=>{this._locale=e})])}destroy(){this.removeAllHandles(),this.container=null;for(let e of this._components.slice())e.node?.remove(),e.destroy();this._components.length=0,this._componentMap.clear(),this._innerContainer=null,this._manualContainer=null,this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this.view=null,this._set(`view`,null)}set container(e){let t=this._get(`container`);e!==t&&(e&&(e.classList.add(v.ui),f(e),this._attachContainers(e)),t&&(t.classList.remove(v.ui),S(t,{top:``,bottom:``,left:``,right:``}),t.textContent=``),this._set(`container`,e))}get height(){let e=this.view?.height??0;if(e===0)return e;let{top:t,bottom:n}=this._getViewPadding();return Math.max(e-t-n,0)}get padding(){return this._get(`padding`)}set padding(e){this._overrideIfSome(`padding`,e)}castPadding(e){return typeof e==`number`?{bottom:e,top:e,right:e,left:e}:{...g,...e}}get width(){let e=this.view?.width??0;if(e===0)return e;let{left:t,right:n}=this._getViewPadding();return Math.max(e-t-n,0)}add(e,t){let n,r,i;if(Array.isArray(e)){e.forEach(e=>this.add(e,t));return}let a=x(e);a&&({index:n,position:t,component:e,key:r}=a),t&&typeof t==`object`&&({index:n,key:r,position:t,internal:i}=t),!
|
|
2
|
+
import{__decorate as e}from"tslib";import{getLocale as t,onLocaleChange as n}from"../../intl.js";import r from"../../core/Accessor.js";import{isSome as i}from"../../core/arrayUtils.js";import{EventedAccessor as a}from"../../core/Evented.js";import{makeHandle as o}from"../../core/handleUtils.js";import{watch as s,initial as c}from"../../core/reactiveUtils.js";import{property as l,cast as u,subclass as d}from"../../core/accessorSupport/decorators.js";import{setCalciteModeClass as f}from"../../support/modeUtils.js";import p from"./Component.js";import{isRTL as m}from"../../widgets/support/widget.js";const h={left:0,top:0,bottom:0,right:0},g={bottom:30,top:15,right:15,left:15},_=`esri-ui`,v={ui:_,corner:`${_}-corner`,innerContainer:`${_}-inner-container`,manualContainer:`${_}-manual-container`,cornerContainer:`${_}-corner-container`,topLeft:`${_}-top-left`,topRight:`${_}-top-right`,bottomLeft:`${_}-bottom-left`,bottomRight:`${_}-bottom-right`};function y(e){return e&&!e._started&&typeof e.postMixInProperties==`function`&&typeof e.buildRendering==`function`&&typeof e.postCreate==`function`&&typeof e.startup==`function`}function b(e){return e===0?`0`:`${e}px`}function x(e){let t=typeof e==`object`&&!!e&&Object.getPrototypeOf(e);return(t===null||t===Object.prototype)&&(`component`in e||`index`in e||`position`in e)?e:null}function S(e,{top:t,bottom:n,left:r,right:i}){e.style.top=t,e.style.bottom=n,e.style.left=r,e.style.right=i}let C=class extends a{constructor(e){super(e),this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this._components=[],this._componentMap=new Map,this._removeWidgetHandleKey=Symbol(`componentOnRemoveSymbol`),this._locale=t(),this.view=null,this._applyViewPadding=()=>{let e=this.container;e&&S(e,this._toPixelPosition(this._getViewPadding()))},this._applyUIPadding=()=>{let e=this._innerContainer;e&&S(e,this._toPixelPosition(this.padding))},this._initContainers()}initialize(){this.addHandles([s(()=>[this.view?.padding,this.container],this._applyViewPadding,c),s(()=>this.padding,this._applyUIPadding,c),s(()=>[this.container,this._locale],([e,t])=>{e&&e.setAttribute(`lang`,t)},c),n(e=>{this._locale=e})])}destroy(){this.removeAllHandles(),this.container=null;for(let e of this._components.slice())e.node?.remove(),e.destroy();this._components.length=0,this._componentMap.clear(),this._innerContainer=null,this._manualContainer=null,this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this.view=null,this._set(`view`,null)}set container(e){let t=this._get(`container`);e!==t&&(e&&(e.classList.add(v.ui),f(e),this._attachContainers(e)),t&&(t.classList.remove(v.ui),S(t,{top:``,bottom:``,left:``,right:``}),t.textContent=``),this._set(`container`,e))}get height(){let e=this.view?.height??0;if(e===0)return e;let{top:t,bottom:n}=this._getViewPadding();return Math.max(e-t-n,0)}get padding(){return this._get(`padding`)}set padding(e){this._overrideIfSome(`padding`,e)}castPadding(e){return typeof e==`number`?{bottom:e,top:e,right:e,left:e}:{...g,...e}}get width(){let e=this.view?.width??0;if(e===0)return e;let{left:t,right:n}=this._getViewPadding();return Math.max(e-t-n,0)}add(e,t){let n,r,i;if(Array.isArray(e)){e.forEach(e=>this.add(e,t));return}let a=x(e);a&&({index:n,position:t,component:e,key:r}=a),t&&typeof t==`object`&&({index:n,key:r,position:t,internal:i}=t),!e||t&&!this._isValidPosition(t)||this._add(e,t,n??this._getNumComponentsAtPosition(t),r,i)}remove(e,t){if(!e)return;if(Array.isArray(e))return e.map(e=>this.remove(e,t));let n=this._find(e);if(n){let e=this._componentMap.get(n);if(!e||e.key!==t)return;let r=this._components.indexOf(n);return n.node.parentNode?.removeChild(n.node),this._componentMap.delete(n),n.widget?.removeHandlesReference(this._removeWidgetHandleKey),this._components.forEach(t=>{let n=this._componentMap.get(t);n&&n.position===e.position&&n.index>e.index&&n.index--}),this._components.splice(r,1)[0]}}empty(e,t={removeInternal:!1}){if(Array.isArray(e)){for(let n of e)this.empty(n,t);return}let n=this._positionNameToContainerLookup[e??`manual`],r=Array.prototype.slice.call(n.children).map(e=>this._findByNode(e)).filter(e=>e==null?!1:!(this._componentMap.get(e)?.internal??!1)||t.removeInternal);for(let e of r)this.remove(e)}move(e,t){if(Array.isArray(e)&&e.forEach(e=>this.move(e,t)),!e)return;let n,r=x(e)||x(t);if(r&&(n=r.index,t=r.position,e=r.component||e),t&&!this._isValidPosition(t))return;let i=this.remove(e);i&&this.add(i,{position:t,index:n})}find(e){if(!e)return null;let t=this._findById(e);return t&&(t.widget||t.node)}getComponents(e,t={includeInternal:!1}){return e?Array.isArray(e)?e.flatMap(e=>this._getComponentsAtPosition(e,t)):this._getComponentsAtPosition(e,t):this._components.filter(e=>t.includeInternal||!(this._componentMap.get(e)?.internal??!1)).map(({widget:e,node:t})=>e??t)}getPosition(e){for(let t in this._positionNameToContainerLookup)if(this._positionNameToContainerLookup[t].contains(e))return t;return null}_add(e,t,n,i,a){e instanceof p||(e=new p({node:e}));let{widget:s}=e;s!=null&&s instanceof r&&s.addHandles(o(()=>{queueMicrotask(()=>this.remove(e))}),this._removeWidgetHandleKey);let c=this._positionNameToContainerLookup[t];this._components.some(e=>{let t=this._componentMap.get(e)?.position,r=t?this._positionNameToContainerLookup[t]:null;return c===r&&this._componentMap.get(e)?.index===n})&&this._components.forEach(e=>{let t=this._componentMap.get(e),r=t?.position,i=r?this._positionNameToContainerLookup[r]:null;t&&i===c&&t.index>=n&&t.index++}),this._place({component:e,position:t,index:n}),this._components.push(e),this._componentMap.set(e,{key:i,position:t,internal:a,index:n})}_find(e){return e?e instanceof p?this._findByComponent(e):typeof e==`string`?this._findById(e):`domNode`in e?this._findByNode(e.domNode):this._findByNode(e):null}_getViewPadding(){return this.view?.padding??h}_attachContainers(e){e.appendChild(this._innerContainer),e.appendChild(this._manualContainer)}_initContainers(){let e=document.createElement(`div`);e.classList.add(v.innerContainer,v.cornerContainer);let t=document.createElement(`div`);t.classList.add(v.innerContainer,v.manualContainer);let n=document.createElement(`div`);n.classList.add(v.topLeft,v.corner),e.appendChild(n);let r=document.createElement(`div`);r.classList.add(v.topRight,v.corner),e.appendChild(r);let i=document.createElement(`div`);i.classList.add(v.bottomLeft,v.corner),e.appendChild(i);let a=document.createElement(`div`);a.classList.add(v.bottomRight,v.corner),e.appendChild(a),this._innerContainer=e,this._manualContainer=t;let o=m();this._cornerNameToContainerLookup={"top-left":n,"top-right":r,"bottom-left":i,"bottom-right":a,"top-leading":o?r:n,"top-trailing":o?n:r,"bottom-leading":o?a:i,"bottom-trailing":o?i:a},this._positionNameToContainerLookup={manual:t,...this._cornerNameToContainerLookup}}_isValidPosition(e){return!!this._positionNameToContainerLookup[e]}_place(e){let t=e.position??`manual`,{component:n,index:r}=e,i=this._positionNameToContainerLookup[t],a=r!=null&&r>-1;if(y(n.widget)&&n.widget.startup(),!a){i.appendChild(n.node);return}let o=Array.from(i.children);if(o.length===0)i.appendChild(n.node);else{for(let e of o){let t=this._findByNode(e);if(t&&r<(this._componentMap.get(t)?.index??0)){e.parentNode?.insertBefore(n.node,e);return}}i.appendChild(n.node)}}_toPixelPosition(e){return{top:b(e.top),left:b(e.left),right:b(e.right),bottom:b(e.bottom)}}_findByComponent(e){return this._components.find(t=>t===e)??null}_findById(e){return this._components.find(({id:t})=>t===e)??null}_findByNode(e){return e?this._components.find(({node:t})=>t===e):null}_getComponentsAtPosition(e,t){let n=this._positionNameToContainerLookup[e];return Array.prototype.slice.call(n.children).map(e=>this._findByNode(e)).filter(i).filter(e=>t.includeInternal||!(this._componentMap.get(e)?.internal??!1)).map(({widget:e,node:t})=>e??t)}_getNumComponentsAtPosition(e){return this._positionNameToContainerLookup[e]?.children.length??0}};e([l()],C.prototype,`_locale`,void 0),e([l()],C.prototype,`container`,null),e([l()],C.prototype,`height`,null),e([l({value:g})],C.prototype,`padding`,null),e([u(`padding`)],C.prototype,`castPadding`,null),e([l()],C.prototype,`view`,void 0),e([l()],C.prototype,`width`,null),C=e([d(`esri.views.ui.UI`)],C);const w=C;export{w as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import{MultiOriginJSONSupport as t}from"../../core/MultiOriginJSONSupport.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{hasSameCanonicalPortal as r,urlToObject as i}from"../../core/urlUtils.js";import{updateOrigins as a}from"../../core/accessorSupport/originUtils.js";import o from"../../geometry/SpatialReference.js";import{webMercatorToGeographic as s}from"../../geometry/support/webMercatorUtils.js";import{isServerOrServicesAGOLUrl as c}from"../../layers/support/arcgisLayerUrl.js";import{isLayerWithFeatureLayerSource as l,isFeatureCollectionLayer as u}from"../../layers/support/layerUtils.js";import d from"../../portal/Portal.js";import f from"../../portal/PortalItem.js";import{createForItemWrite as ee}from"../../portal/support/jsonContext.js";import{removeTypeKeyword as p,
|
|
2
|
+
import e from"../../core/Error.js";import{MultiOriginJSONSupport as t}from"../../core/MultiOriginJSONSupport.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{hasSameCanonicalPortal as r,urlToObject as i}from"../../core/urlUtils.js";import{updateOrigins as a}from"../../core/accessorSupport/originUtils.js";import o from"../../geometry/SpatialReference.js";import{webMercatorToGeographic as s}from"../../geometry/support/webMercatorUtils.js";import{isServerOrServicesAGOLUrl as c}from"../../layers/support/arcgisLayerUrl.js";import{isLayerWithFeatureLayerSource as l,isFeatureCollectionLayer as u}from"../../layers/support/layerUtils.js";import d from"../../portal/Portal.js";import f from"../../portal/PortalItem.js";import{createForItemWrite as ee}from"../../portal/support/jsonContext.js";import{removeTypeKeyword as p,typeKeyword as m,addTypeKeyword as te,toggleTypeKeyword as h,hasTypeKeyword as g}from"../../portal/support/portalItemUtils.js";import{project as ne}from"../../rest/geometryService/project.js";import _ from"../../rest/support/ProjectParameters.js";import{hasDeveloperBasemapLayer as v,isDeveloperBasemapLayer as y}from"../../support/basemapUtils.js";import{saveResources as b}from"./resourceUtils.js";import{beforeSave as x,evaluateWriteErrors as S,hasCharts as re}from"./saveUtils.js";import{hasWebDocumentAsPrimaryContent as C,hasWebDocumentAsResource as w}from"./utils.js";const T=[`NatGeo_World_Map`,`Ocean_Basemap`,`USA_Topo_Maps`,`World_Imagery`,`World_Street_Map`,`World_Terrain_Base`,`World_Topo_Map`,`World_Hillshade`,`Canvas/World_Light_Gray_Base`,`Canvas/World_Light_Gray_Reference`,`Canvas/World_Dark_Gray_Base`,`Canvas/World_Dark_Gray_Reference`,`Ocean/World_Ocean_Base`,`Ocean/World_Ocean_Reference`,`Reference/World_Boundaries_and_Places`,`Reference/World_Reference_Overlay`,`Reference/World_Transportation`].map(e=>e.toLowerCase());async function E(e,t,r){r??={},k(e,t),await n(()=>!t.updatingFromView),await t.load(),await M(t),await x(t),await j(e,t);let i=t.portalItem,{json:a,jsonContext:o}=await D(t,i,e.origin,t.portalItemResourcePath);return S(o,{errorName:`${e.name}:save`},r),await N(t,i),await ue(e,t,i,a,o),await Promise.all([C(i)?t.updateItemThumbnail():null,b(t.resourceReferences,o)]),i}async function D(e,t,n,r){let i=w(t),a=i&&t.id===e.portalItem?.id&&r!==e.portalItemResourcePath,o=ee(t,n,{withResources:!0,forceNewItemContext:a});o.portalItemResourcePath=i?r:null;let s=e.write({},o);return await Promise.all(o.resources.pendingOperations),{json:s,jsonContext:o}}async function O(e,t,r,i){i??={};let a=t.portalItem,o=await ie(e,t,r,i);await n(()=>!t.updatingFromView),await t.load(),await M(t),await x(t),await j(e,t);let{json:s,jsonContext:c}=await D(t,o,e.origin,i.portalItemResourcePath);S(c,{errorName:`${e.name}:save`},i),await V(t,o);let l,u=C(o);return u&&(l=t.getThumbnailState()),await Y(e,t,o,s,c,i)&&(t.resourceReferences.portalItem=o),l&&t.restoreThumbnailFromState(l),await Promise.all([u?t.updateItemThumbnail(a):null,b(t.resourceReferences,c)]),o}function k(t,n){if(!n.portalItem)throw new e(`${t.name}:portal-item-not-set`,`Portal item to save to has not been set on the WebMap`);A(t,n.portalItem)}function A(t,n){let r=n.type,i=t.supportedItemTypes;if(!r||!i.has(r))throw new e(`${t.name}:portal-item-wrong-type`,`Portal item needs to have one of these types: '${Array.from(i).join(`', '`)}'`)}async function j(t,n){if(t.name!==`linkchart`&&!n.basemap?.baseLayers.length)throw new e(`${t.name}:save`,`Map does not have a valid basemap with a base layer.`)}async function ie(t,n,r,i){let a=f.from(r);a.id&&await a.load();let{portalItemResourcePath:o}=i,{name:s,primaryItemType:c}=t;if(w(a)){if(!o)throw new e(`${s}:missing-portal-item-resource-path`,`'portalItemResourcePath' is required to save a map to '${a.type}' item`);if(o===n.portalItemResourcePath&&a.id===n.portalItem?.id)throw new e(`${s}:invalid-portal-item-resource-path`,`Target 'portalItemResourcePath' should be different from '${s}.portalItemResourcePath'`);return a}if(o)throw new e(`${s}:portal-item-resource-path-not-supported`,`'portalItemResourcePath' is not supported when saving a map to '${c}' item`);return a.id&&(a=a.clone(),a.id=null),a.type||(a.type=c),a.portal||(a.portal=d.getDefault()),A(t,a),a}function M(e){let t=[];return e.basemap&&t.push(e.basemap.load()),e.ground&&t.push(e.ground.load()),Promise.allSettled(t).then(()=>{})}async function N(e,t){w(t)||(t.extent=await q(e.portalItem,e.initialViewProperties.viewpoint.targetGeometry),await H(e,t))}const P=m.JSAPI,F=`CollectorDisabled`,I=`OfflineDisabled`,L=`Workforce Project`,R=`Workforce Worker`,z=`Workforce Dispatcher`,B=m.DEVELOPER_BASEMAP;async function V(e,t){w(t)||(p(t,F),p(t,`FieldMapsDisabled`),p(t,m.METADATA),p(t,I),p(t,`Offline Map Areas`),p(t,z),p(t,L),p(t,R),await N(e,t))}async function H(e,t){te(t,P),await U(e),h(t,`Collector`,!g(t,F)&&!g(t,L)&&!g(t,R)&&!g(t,z)&&G(e)),h(t,`Data Editing`,G(e)),h(t,`Offline`,!g(t,I)&&K(e)),h(t,B,v(e.basemap)),h(t,`UtilityNetwork`,!!e.utilityNetworks?.length),h(t,`ParcelFabric`,!!e.parcelFabric),h(t,`IPS`,!!e.ipsInfo),h(t,m.CHARTS,re(e)),t.typeKeywords&&=t.typeKeywords.filter((e,t,n)=>n.indexOf(e)===t)}function U(e){let t=W(e).map(e=>e.load()).toArray();return Promise.allSettled(t).then(()=>{})}function W(e){return e.allLayers.concat(e.allTables)}function G(e){return W(e).some(e=>e.loaded&&l(e)&&e.capabilities.operations.supportsEditing&&`editingEnabled`in e&&e.editingEnabled&&(e.type!==`subtype-group`||e.sublayers.some(e=>e.editingEnabled)))}function K(e){return W(e).filter(e=>e.type!==`group`).every(t=>t.loaded&&oe(e,t))}async function q(e,t){let n=t.clone().normalize(),r;if(n.length>1)for(let e of n)r?e.width>r.width&&(r=e):r=e;else r=n[0];return J(e,r)}async function J(e,t){let n=t.spatialReference;if(n.isWGS84)return t.clone();if(n.isWebMercator)return s(t);let{getGeometryServiceURL:r}=await import(`../../portal/support/geometryServiceUtils.js`),i=await r(e),a=new _({geometries:[t],outSpatialReference:o.WGS84});return(await ne(i,a))[0]}function ae(e){return u(e)||e.type===`map-notes`||e.type===`route`||e.type===`sketch`}function oe(e,t){return l(t)&&t.capabilities.operations.supportsSync||ae(t)&&!t.portalItem||se(t)&&!ce(t)&&t.spatialReference.equals(e.initialViewProperties.spatialReference)}function se(e){return e.type===`imagery-tile`?e.supportsExportMapTiles():(e.type===`tile`||e.type===`vector-tile`)&&(e.capabilities.operations.supportsExportTiles||le(e)||y(e))}function ce(e){return e.type===`vector-tile`&&Object.keys(e.sourceNameToSource).length>1}function le(e){return e.type===`tile`&&c(e.url)&&T.some(t=>e.url?.toLowerCase().includes(`/`+t+`/`))}async function ue(e,t,n,r,i){C(n)?await n.update({data:r}):(await n.portal.signIn(),await n.resourceFromPath(t.portalItemResourcePath).update($(r))),Q(e,t,n,r,i)}async function Y(t,n,r,i,a,o){let s=n.portalItem,c={item:s,authenticated:!!(s?.id&&s.portal.user)},l=r.portal;await l.signIn();let{copyAllowed:u,itemReloaded:d}=await X(c,l);if(c.authenticated||=d,!u)throw new e(`${t.name}:save-as-copy-not-allowed`,`Owner of this map does not allow others to save a copy`);let f=!1;if(C(r))f=await Z(r,c,i,o);else{let e=r.resourceFromPath(o.portalItemResourcePath);await r.addResource(e,$(i))}return n.portalItem=r,n.portalItemResourcePath=o.portalItemResourcePath,Q(t,n,r,i,a),f}async function X(e,t){let{item:n,authenticated:r}=e;return n&&C(n)&&n.id&&n.typeKeywords?.includes(`useOnly`)?n.portal.portalHostname===t.portalHostname?(r||await n.reload(),{copyAllowed:n.itemControl===`admin`||n.itemControl===`update`,itemReloaded:!0}):{copyAllowed:!1,itemReloaded:!1}:{copyAllowed:!0,itemReloaded:!1}}async function Z(e,t,n,i){let a=e.portal,{item:o}=t,{folder:s,copyAllResources:c}=i,l=!1;if(c&&o?.id&&o.type===e.type&&r(o.portal.url,a.url)&&parseInt(o.portal.currentVersion,10)>=2023){let{total:e}=await o.fetchResources();l=!!e}if(l){let t=await o.copy({copyResources:`all`,folder:s});e.id=t.id,e.portal=t.portal;let r=e.toJSON();await e.load(),e.read(r),await e.update({data:n})}else await a.user.addItem({item:e,folder:s,data:n});return l}function Q(e,n,r,o,s){t.prototype.read.call(n,{version:o.version,authoringApp:o.authoringApp,authoringAppVersion:o.authoringAppVersion},{origin:e.origin,ignoreDefaults:!0,url:r.itemUrl?i(r.itemUrl):void 0}),a(s),n.resourceInfo=o}function $(e){return new Blob([JSON.stringify(e)],{type:`application/json`})}export{D as createJSON,Z as initializeNewItem,X as isCopyAllowed,E as save,O as saveAs};
|
package/webscene/Slide.d.ts
CHANGED
|
@@ -186,8 +186,7 @@ export default class Slide extends SlideSuperclass {
|
|
|
186
186
|
* @param options - Creation options. See properties below for object specifications.
|
|
187
187
|
* @returns When resolved, returns the created slide.
|
|
188
188
|
* @example
|
|
189
|
-
* // Creates a slide from the view and
|
|
190
|
-
* // adds it to the webscene
|
|
189
|
+
* // Creates a slide from the view and adds it to the webscene
|
|
191
190
|
* Slide.createFrom(view).then(function(slide){
|
|
192
191
|
* webscene.presentation.slides.add(slide);
|
|
193
192
|
* });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import n from"../../core/Error.js";import{makeHandle as r,abortHandle as i}from"../../core/handleUtils.js";import a from"../../core/Logger.js";import{isAborted as o}from"../../core/promiseUtils.js";import{property as s,subclass as c}from"../../core/accessorSupport/decorators.js";import l from"../../views/draw/support/HighlightHelper.js";import{temporaryHighlightName as u}from"../../views/support/HighlightDefaults.js";import d from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import f from"./UpdateRecordWorkflowData.js";import p from"./Workflow.js";import{fetchFullFeatures as m,handleFormValuesChangeEvent as h}from"./workflowUtils.js";import{toEditAttachmentsPayload as g,toAttachmentEdit as _}from"./support/attachmentUtils.js";var v;const y={exit:Symbol()};let b=class extends p{static{v=this}constructor(e){super(e),this._highlightHelper=null,this.fullFeature=null,this.type=`update-table-record`}initialize(){let{data:e}=this,{edits:t}=e,{view:s}=e.viewModel,c=t.feature;s&&(this._highlightHelper=new l({view:s,highlightName:u}),this.addHandles(r(()=>this._highlightHelper?.removeAll())));let d=new AbortController;this.addHandles(i(d)),this._updatingHandles.consumePromise(m([c],c.sourceLayer,e.viewModel.view.spatialReference,d.signal).then(([e])=>{o(d)||(this._onFullFeatureLoaded(e),this._initializeFormViewModel())},e=>(a.getLogger(this).error(`initialize()`,`Failed to fetch full feature for update workflow.`,e),this.cancel({force:!0,error:new n(`editor:failed-to-fetch-full-feature`,`Failed to retrieve all information for this feature. The update cannot proceed.`,{detail:{error:e}})}))))}get allowSave(){return!this.data.readOnly&&this.hasPendingEdits&&!this.updating}get editorItem(){return this.data.editorItem}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return this.data.editorItem.hasInvalidFormTemplate}get hasPendingEdits(){return this.data.edits.modified&&!this.data.readOnly}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get saveActionLabel(){return`update`}get shouldShowAttachments(){return this.editorItem.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return this.editorItem.capabilities.update.attachments.enabled}get reliesOnOwnerAdminPrivileges(){let e=this.editorItem.capabilities;return e.update.reliesOnOwnerAdminPrivileges||e.delete.reliesOnOwnerAdminPrivileges}async enter(){}exit(e){this.removeHandles(y.exit)}async start(){return await super.start(),null}_initializeFormViewModel(){let{association:e,edits:n,viewModel:{view:r},readOnly:i,editorItem:a}=this.data,{fullFeature:o}=this,s=a.layerInfo?[a.layerInfo]:null,c=this._formViewModel=new d({activeFeatureIndex:0,attachmentsEnabled:!0,editType:`UPDATE`,features:new t([o]),highlightHelper:this._highlightHelper,layerInfos:s,readOnly:i,spatialReference:r.spatialReference,view:r,callbacks:this.data.formCallbacks});e&&c.setActiveAssociation(e);let{initialFeature:l}=n;l&&c.overrideOriginalFeature(o,l),this.addHandles([c.on(`values-change`,h({filter:e=>e===o,forEachFeature:()=>{n.updateAttributes(c.getValues(o)),o.attributes=n.feature.attributes}})),c.on(`attachments-change`,e=>n.setAttachmentEdits(e.attachmentEdits))])}_onFullFeatureLoaded(e){this.fullFeature=e;let{edits:t}=this.data;t.updateAttributes(e.attributes),t.trackChanges()}static async create(e){let t=new v({data:await f.create(e),onCommit:this._onCommitFactory(e.applyEdits,e.applyAttachmentEdits)});return t._set(`steps`,this._createWorkflowSteps(t)),t}static _createWorkflowSteps(e){return[{id:`editing-attributes`,async setUp(){},async tearDown(){}},{id:`adding-attachment`,async setUp(){},async tearDown(){}},{id:`editing-attachment`,async setUp(){},async tearDown(){}}]}static{this._onCommitFactory=(e,t)=>async n=>{let{edits:r,editorItem:i}=n,{feature:a}=r;if(!a)return;let o=a.sourceLayer,s=i.supportsGlobalIds&&`globalIdField`in o,c={},l;x(c,r,i),!r.stagedForDelete&&r.attachmentsModified&&s&&(l={globalIdUsed:!0},S(c,r))
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import n from"../../core/Error.js";import{makeHandle as r,abortHandle as i}from"../../core/handleUtils.js";import a from"../../core/Logger.js";import{isAborted as o}from"../../core/promiseUtils.js";import{property as s,subclass as c}from"../../core/accessorSupport/decorators.js";import l from"../../views/draw/support/HighlightHelper.js";import{temporaryHighlightName as u}from"../../views/support/HighlightDefaults.js";import d from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import f from"./UpdateRecordWorkflowData.js";import p from"./Workflow.js";import{fetchFullFeatures as m,handleFormValuesChangeEvent as h}from"./workflowUtils.js";import{toEditAttachmentsPayload as g,toAttachmentEdit as _}from"./support/attachmentUtils.js";var v;const y={exit:Symbol()};let b=class extends p{static{v=this}constructor(e){super(e),this._highlightHelper=null,this.fullFeature=null,this.type=`update-table-record`}initialize(){let{data:e}=this,{edits:t}=e,{view:s}=e.viewModel,c=t.feature;s&&(this._highlightHelper=new l({view:s,highlightName:u}),this.addHandles(r(()=>this._highlightHelper?.removeAll())));let d=new AbortController;this.addHandles(i(d)),this._updatingHandles.consumePromise(m([c],c.sourceLayer,e.viewModel.view.spatialReference,d.signal).then(([e])=>{o(d)||(this._onFullFeatureLoaded(e),this._initializeFormViewModel())},e=>(a.getLogger(this).error(`initialize()`,`Failed to fetch full feature for update workflow.`,e),this.cancel({force:!0,error:new n(`editor:failed-to-fetch-full-feature`,`Failed to retrieve all information for this feature. The update cannot proceed.`,{detail:{error:e}})}))))}get allowSave(){return!this.data.readOnly&&this.hasPendingEdits&&!this.updating}get editorItem(){return this.data.editorItem}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return this.data.editorItem.hasInvalidFormTemplate}get hasPendingEdits(){return this.data.edits.modified&&!this.data.readOnly}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get saveActionLabel(){return`update`}get shouldShowAttachments(){return this.editorItem.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return this.editorItem.capabilities.update.attachments.enabled}get reliesOnOwnerAdminPrivileges(){let e=this.editorItem.capabilities;return e.update.reliesOnOwnerAdminPrivileges||e.delete.reliesOnOwnerAdminPrivileges}async enter(){}exit(e){this.removeHandles(y.exit)}async start(){return await super.start(),null}_initializeFormViewModel(){let{association:e,edits:n,viewModel:{view:r},readOnly:i,editorItem:a}=this.data,{fullFeature:o}=this,s=a.layerInfo?[a.layerInfo]:null,c=this._formViewModel=new d({activeFeatureIndex:0,attachmentsEnabled:!0,editType:`UPDATE`,features:new t([o]),highlightHelper:this._highlightHelper,layerInfos:s,readOnly:i,spatialReference:r.spatialReference,view:r,callbacks:this.data.formCallbacks});e&&c.setActiveAssociation(e);let{initialFeature:l}=n;l&&c.overrideOriginalFeature(o,l),this.addHandles([c.on(`values-change`,h({filter:e=>e===o,forEachFeature:()=>{n.updateAttributes(c.getValues(o)),o.attributes=n.feature.attributes}})),c.on(`attachments-change`,e=>n.setAttachmentEdits(e.attachmentEdits))])}_onFullFeatureLoaded(e){this.fullFeature=e;let{edits:t}=this.data;t.updateAttributes(e.attributes),t.trackChanges()}static async create(e){let t=new v({data:await f.create(e),onCommit:this._onCommitFactory(e.applyEdits,e.applyAttachmentEdits)});return t._set(`steps`,this._createWorkflowSteps(t)),t}static _createWorkflowSteps(e){return[{id:`editing-attributes`,async setUp(){},async tearDown(){}},{id:`adding-attachment`,async setUp(){},async tearDown(){}},{id:`editing-attachment`,async setUp(){},async tearDown(){}}]}static{this._onCommitFactory=(e,t)=>async n=>{let{edits:r,editorItem:i}=n,{feature:a}=r;if(!a)return;let o=a.sourceLayer,s=i.supportsGlobalIds&&`globalIdField`in o,c={},l;x(c,r,i),!r.stagedForDelete&&r.attachmentsModified&&s&&(l={globalIdUsed:!0},S(c,r)),Object.keys(c).length>0&&!await e(o,c,l)||!r.stagedForDelete&&r.attachmentsModified&&!s&&await t(o,g(a,r.attachmentEdits))}}get test(){return{formViewModel:this._formViewModel}}};e([s()],b.prototype,`_formViewModel`,void 0),e([s()],b.prototype,`allowSave`,null),e([s()],b.prototype,`editorItem`,null),e([s()],b.prototype,`formViewModel`,null),e([s()],b.prototype,`fullFeature`,void 0),e([s()],b.prototype,`hasInvalidFormTemplate`,null),e([s()],b.prototype,`hasPendingEdits`,null),e([s()],b.prototype,`layer`,null),e([s()],b.prototype,`parent`,null),e([s()],b.prototype,`saveActionLabel`,null),e([s()],b.prototype,`shouldShowAttachments`,null),e([s()],b.prototype,`shouldAllowAttachmentEditing`,null),e([s()],b.prototype,`reliesOnOwnerAdminPrivileges`,null),b=v=e([c(`esri.widgets.Editor.UpdateRecordWorkflow`)],b);function x(e,t,n){let{feature:r,attributesModified:i,geometryModified:a,stagedForDelete:o}=t;if(!r||!(i||a||o))return;let s=r.sourceLayer,c=r.clone();if(!i||o){let e=s.objectIdField;if(c.attributes={[e]:r.getAttribute(e)},s.type===`scene`&&s.infoFor3D!=null){let e=s.associatedLayer?.globalIdField;e!=null&&c.setAttribute(e,r.getAttribute(e))}}if(n.supportsGlobalIds&&`globalIdField`in s){let e=s.globalIdField;e!=null&&c.setAttribute(e,r.getAttribute(e))}(!a||o)&&(c.geometry=null);let l=o?`deleteFeatures`:`updateFeatures`;e[l]=[c]}function S(e,t){let n=[],r=[],i=[];t.attachmentEdits.forEach(e=>{e.adds.forEach(e=>n.push(_(e))),e.updates.forEach(e=>r.push(_(e))),e.deletes.forEach(e=>i.push(e.globalId))}),n.length>0&&(e.addAttachments=n),r.length>0&&(e.updateAttachments=r),i.length>0&&(e.deleteAttachments=i)}export{b as UpdateRecordWorkflow,y as handleKeys};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Accessor.js";import{isSome as r}from"../../../core/arrayUtils.js";import{ClonableMixin as i}from"../../../core/Clonable.js";import a from"../../../core/Collection.js";import{IdentifiableMixin as o}from"../../../core/Identifiable.js";import{ignoreAbortErrors as s,debounce as c}from"../../../core/promiseUtils.js";import{watch as l,initial as u}from"../../../core/reactiveUtils.js";import{property as d,subclass as f}from"../../../core/accessorSupport/decorators.js";import{getFixedFieldName as p,isRelatableFeatureSupportedLayer as m,findRelatedLayer as h}from"../../../popup/support/featureUtils.js";import g from"../../../rest/support/RelationshipQuery.js";import{getFieldsInTitleAndDesc as _}from"../../FeatureForm/featureFormUtils.js";let v=class extends i(o(n)){constructor(e){super(e),this._loaded=!1,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.activeCategory=null,this.allCategories=null,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,this._cancelQuery=()=>{let{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{let{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{let{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();let e=new AbortController;this._queryAbortController=e,await s(this._query()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._loaded=!1,this._cancelQueryFeatureCount();let e=new AbortController;this._queryFeatureCountAbortController=e,await s(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null),this._loaded=!0},this._queryPageController=async()=>{let e=new AbortController;this._queryPageAbortController=e,await s(this._queryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=c(this._queryController,100),this._queryFeatureCountDebounced=c(this._queryFeatureCountController,100),this._queryPageDebounced=c(this._queryPageController,100),this._query=async()=>{let{_queryAbortController:e,relatedFeatures:t}=this;this.featureCount&&(this.relatedLayer?.type!==`subtype-group`||this.activeCategory)&&(this._destroyRelatedFeatureViewModels(),this.featurePage=1,t.destroyAll(),!this.destroyed&&t.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:e?.signal}))))},this.addHandles([l(()=>[this.displayCount,this.graphic,this.layer,this.layer?.loaded,this.map,this.orderByFields,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount,this.activeCategory],()=>this._queryDebounced().catch(()=>{}),u),l(()=>[this.featurePage,this.showAllEnabled],()=>this._queryPageDebounced().catch(()=>{})),l(()=>[this.layer,this.relationshipId,this.objectId,this.canQuery,this.activeCategory],()=>this._queryFeatureCountDebounced().catch(()=>{}))])}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.destroyAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){let{featuresPerPage:t,featureCount:n}=this,r=Math.ceil(n/t)||1;this._set(`featurePage`,Math.min(Math.max(e,1),r))}get featurePage(){return this._get(`featurePage`)}get orderByFieldsFixedCasing(){let{orderByFields:e,relatedLayer:t}=this;return e&&t?.loaded?e.map(e=>{let n=e.clone();return n.field=p(e.field,t),n}):e??[]}get supportsCacheHint(){return!!this.layer?.capabilities?.queryRelated?.supportsCacheHint}get canLoad(){return!!this.map&&this.relationshipId!=null&&typeof this.objectId==`number`}get canQuery(){let e=this.layer?.capabilities?.queryRelated;return!!this.relatedLayer&&!!this.relationship&&this.relationshipId!=null&&this.objectId!=null&&!!e?.supportsCount&&!!e?.supportsPagination}get allCategoriesCount(){return this.allCategories?.length??0}get categories(){let{allCategories:e}=this;return this.showAllEnabled?e:e?.slice(0,this.displayCount)??null}set displayCount(e){this._set(`displayCount`,Math.min(Math.max(e??3,0),10))}get displayCount(){return this._get(`displayCount`)}get itemDescriptionFieldName(){return this.orderByFieldsFixedCasing[0]?.field||null}get objectId(){return(this.objectIdField&&this.graphic?.attributes?.[this.objectIdField])??null}get objectIdField(){return this.layer?.objectIdField||null}get relatedFeatures(){return this._get(`relatedFeatures`)||new a}get relatedLayer(){let{layer:e,map:t,relationship:n}=this;if(!e?.loaded||!t||!n)return null;let r=e.type===`subtype-sublayer`&&e.parent&&m(e.parent)?e.parent:e;return h(t,r,n)??null}get relatedLayerKeyField(){let{relatedLayer:e,relationshipId:t}=this;return e?.loaded&&t!=null?e.relationships?.find(e=>e.id===t)?.keyField:null}get relatedLayerKeyFields(){let{relatedLayer:e}=this;return e?.loaded?e.relationships?.map(e=>e.keyField).filter(r)??[]:[]}get relationship(){let{relationshipId:e,layer:t}=this;return e!=null&&t?.loaded?t.relationships?.find(({id:t})=>t===e)??null:null}get relationshipKey(){let{relationshipKeyField:e}=this;return(e&&this.graphic?.attributes?.[e])??null}get relationshipKeyField(){return this.relationship?.keyField||null}get relatedFeatureViewModels(){return this._get(`relatedFeatureViewModels`)||new a}get state(){let{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:n,canQuery:r,_loaded:i,canLoad:a}=this;return t||a&&!i?`loading`:e||n?`querying`:r?`ready`:`disabled`}getRelatedFeatureByObjectId(e){return this.relatedFeatures.find(t=>t.getObjectId()===e)}refresh(){this._queryFeatureCountDebounced().catch(()=>{})}_destroyRelatedFeatureViewModels(){this.relatedFeatureViewModels?.destroyAll()}async _queryFeatureCount(){let{layer:e,relatedLayer:t}=this;await e?.load(),await t?.load();let{_queryFeatureCountAbortController:n,activeCategory:i,canQuery:a,objectId:o,relatedLayerKeyField:s,relationshipId:c,relationshipKey:l,supportsCacheHint:u}=this;if(!a||!e||!t||o==null){this._set(`featureCount`,0),this._set(`allCategories`,null);return}if(t?.type===`subtype-group`&&!i){if(this._set(`featureCount`,0),this._destroyRelatedFeatureViewModels(),this.featurePage=1,this.relatedFeatures.destroyAll(),s&&l!=null){let{default:e}=await import(`../../../smartMapping/statistics/uniqueValues.js`),{uniqueValueInfos:i}=await e({layer:t,sqlWhere:`${s} = '${l}'`,field:t.subtypeField,signal:n?.signal}),a=i.map(({count:e,value:n})=>{let r=t.subtypes?.find(e=>e.code===n)?.name;return n!=null&&r?{count:e,value:n,name:r}:void 0}).filter(r);this._set(`allCategories`,a)}return}let{historicMoment:d,gdbVersion:f}=e,p=new g({cacheHint:u,gdbVersion:f,historicMoment:d,relationshipId:c,returnGeometry:!1,objectIds:[o],where:this._getRelationshipWhereClause(t)}),m=await e.queryRelatedFeaturesCount(p,{signal:n?.signal});this._set(`allCategories`,null),this._set(`featureCount`,m[o]||0)}_getRelationshipWhereClause(e){let{activeCategory:t}=this,n=e.createQuery(),r=`subtypeField`in e?e.subtypeField:void 0,i=t&&r?`${r} = ${t.value}`:void 0,a=n.where;return a&&i?`(${a}) AND (${i})`:a??i}_sliceFeatures(e){let{showAllEnabled:t,displayCount:n}=this;return t?e:n?e.slice(0,n):[]}async _queryPage(){let{relatedFeatures:e,featurePage:t,showAllEnabled:n,_queryPageAbortController:r,featureCount:i}=this;!n||t<2||!i||this.relatedLayer?.type===`subtype-group`&&!this.activeCategory||e.addMany(await this._queryRelatedFeatures({signal:r?.signal}))}async _queryRelatedFeatures(e){let{displayCount:t,featureCount:n,featurePage:r,featuresPerPage:i,layer:a,orderByFieldsFixedCasing:o,relatedLayer:s,relatedLayerKeyFields:c,relationshipId:l,showAllEnabled:u,supportsCacheHint:d}=this,{canQuery:f,objectId:p}=this;if(!f||!a||!s||p==null)return[];let m=u?((r-1)*i+n)%n:0,h=u?i:t,v=s.objectIdField,b=`subtypeField`in s?s.subtypeField:void 0,x=[...o.map(e=>e.field),..._(s),...c,v,b].filter(y),S=o.map(e=>`${e.field} ${e.order}`),{historicMoment:C,gdbVersion:w}=a,T=new g({orderByFields:S,start:m,num:h,outFields:x,cacheHint:d,historicMoment:C,gdbVersion:w,relationshipId:l,returnGeometry:!1,objectIds:[p],where:this._getRelationshipWhereClause(s)}),E=(await a.queryRelatedFeatures(T,{signal:e?.signal}))[p]?.features||[];return s.type===`subtype-group`&&b?E.forEach(e=>{let t=e.attributes[b],n=s.findSublayerForSubtypeCode?.(t);e.sourceLayer=n,e.layer=n}):E.forEach(e=>{e.sourceLayer=s,e.layer=s}),E}};e([d()],v.prototype,`_loaded`,void 0),e([d()],v.prototype,`_queryAbortController`,void 0),e([d()],v.prototype,`_queryPageAbortController`,void 0),e([d()],v.prototype,`_queryFeatureCountAbortController`,void 0),e([d({value:1})],v.prototype,`featurePage`,null),e([d()],v.prototype,`featuresPerPage`,void 0),e([d({readOnly:!0})],v.prototype,`orderByFieldsFixedCasing`,null),e([d({readOnly:!0})],v.prototype,`supportsCacheHint`,null),e([d({readOnly:!0})],v.prototype,`canLoad`,null),e([d({readOnly:!0})],v.prototype,`canQuery`,null),e([d()],v.prototype,`activeCategory`,void 0),e([d({readOnly:!0})],v.prototype,`allCategories`,void 0),e([d({readOnly:!0})],v.prototype,`allCategoriesCount`,null),e([d({readOnly:!0})],v.prototype,`categories`,null),e([d()],v.prototype,`description`,void 0),e([d({value:3})],v.prototype,`displayCount`,null),e([d({type:t})],v.prototype,`graphic`,void 0),e([d({readOnly:!0})],v.prototype,`itemDescriptionFieldName`,null),e([d()],v.prototype,`layer`,void 0),e([d()],v.prototype,`map`,void 0),e([d({readOnly:!0})],v.prototype,`objectId`,null),e([d({readOnly:!0})],v.prototype,`objectIdField`,null),e([d()],v.prototype,`orderByFields`,void 0),e([d({readOnly:!0})],v.prototype,`relatedFeatures`,null),e([d({readOnly:!0})],v.prototype,`relatedLayer`,null),e([d({readOnly:!0})],v.prototype,`relatedLayerKeyField`,null),e([d({readOnly:!0})],v.prototype,`relatedLayerKeyFields`,null),e([d({readOnly:!0})],v.prototype,`relationship`,null),e([d({readOnly:!0})],v.prototype,`relationshipKey`,null),e([d({readOnly:!0})],v.prototype,`relationshipKeyField`,null),e([d({readOnly:!0})],v.prototype,`featureCount`,void 0),e([d({readOnly:!0})],v.prototype,`relatedFeatureViewModels`,null),e([d()],v.prototype,`relationshipId`,void 0),e([d()],v.prototype,`showAllEnabled`,void 0),e([d()],v.prototype,`state`,null),e([d()],v.prototype,`title`,void 0),v=e([f(`esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel`)],v);function y(e){return e!=null&&e!==``}export{v as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Accessor.js";import{isSome as r}from"../../../core/arrayUtils.js";import{ClonableMixin as i}from"../../../core/Clonable.js";import a from"../../../core/Collection.js";import{IdentifiableMixin as o}from"../../../core/Identifiable.js";import{ignoreAbortErrors as s,debounce as c}from"../../../core/promiseUtils.js";import{watch as l,initial as u}from"../../../core/reactiveUtils.js";import{property as d,subclass as f}from"../../../core/accessorSupport/decorators.js";import{getFixedFieldName as p,isRelatableFeatureSupportedLayer as m,findRelatedLayer as h}from"../../../popup/support/featureUtils.js";import g from"../../../rest/support/RelationshipQuery.js";import{getFieldsInTitleAndDesc as _}from"../../FeatureForm/featureFormUtils.js";let v=class extends i(o(n)){constructor(e){super(e),this._loaded=!1,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.activeCategory=null,this.allCategories=null,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,this._cancelQuery=()=>{let{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{let{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{let{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();let e=new AbortController;this._queryAbortController=e,await s(this._query()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._loaded=!1,this._cancelQueryFeatureCount();let e=new AbortController;this._queryFeatureCountAbortController=e,await s(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null),this._loaded=!0},this._queryPageController=async()=>{let e=new AbortController;this._queryPageAbortController=e,await s(this._queryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=c(this._queryController,100),this._queryFeatureCountDebounced=c(this._queryFeatureCountController,100),this._queryPageDebounced=c(this._queryPageController,100),this._query=async()=>{let{_queryAbortController:e,relatedFeatures:t}=this;this.featureCount&&(this.relatedLayer?.type!==`subtype-group`||this.activeCategory)&&(this._destroyRelatedFeatureViewModels(),this.featurePage=1,t.destroyAll(),this.destroyed||t.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:e?.signal}))))},this.addHandles([l(()=>[this.displayCount,this.graphic,this.layer,this.layer?.loaded,this.map,this.orderByFields,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount,this.activeCategory],()=>this._queryDebounced().catch(()=>{}),u),l(()=>[this.featurePage,this.showAllEnabled],()=>this._queryPageDebounced().catch(()=>{})),l(()=>[this.layer,this.relationshipId,this.objectId,this.canQuery,this.activeCategory],()=>this._queryFeatureCountDebounced().catch(()=>{}))])}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.destroyAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){let{featuresPerPage:t,featureCount:n}=this,r=Math.ceil(n/t)||1;this._set(`featurePage`,Math.min(Math.max(e,1),r))}get featurePage(){return this._get(`featurePage`)}get orderByFieldsFixedCasing(){let{orderByFields:e,relatedLayer:t}=this;return e&&t?.loaded?e.map(e=>{let n=e.clone();return n.field=p(e.field,t),n}):e??[]}get supportsCacheHint(){return!!this.layer?.capabilities?.queryRelated?.supportsCacheHint}get canLoad(){return!!this.map&&this.relationshipId!=null&&typeof this.objectId==`number`}get canQuery(){let e=this.layer?.capabilities?.queryRelated;return!!this.relatedLayer&&!!this.relationship&&this.relationshipId!=null&&this.objectId!=null&&!!e?.supportsCount&&!!e?.supportsPagination}get allCategoriesCount(){return this.allCategories?.length??0}get categories(){let{allCategories:e}=this;return this.showAllEnabled?e:e?.slice(0,this.displayCount)??null}set displayCount(e){this._set(`displayCount`,Math.min(Math.max(e??3,0),10))}get displayCount(){return this._get(`displayCount`)}get itemDescriptionFieldName(){return this.orderByFieldsFixedCasing[0]?.field||null}get objectId(){return(this.objectIdField&&this.graphic?.attributes?.[this.objectIdField])??null}get objectIdField(){return this.layer?.objectIdField||null}get relatedFeatures(){return this._get(`relatedFeatures`)||new a}get relatedLayer(){let{layer:e,map:t,relationship:n}=this;if(!e?.loaded||!t||!n)return null;let r=e.type===`subtype-sublayer`&&e.parent&&m(e.parent)?e.parent:e;return h(t,r,n)??null}get relatedLayerKeyField(){let{relatedLayer:e,relationshipId:t}=this;return e?.loaded&&t!=null?e.relationships?.find(e=>e.id===t)?.keyField:null}get relatedLayerKeyFields(){let{relatedLayer:e}=this;return e?.loaded?e.relationships?.map(e=>e.keyField).filter(r)??[]:[]}get relationship(){let{relationshipId:e,layer:t}=this;return e!=null&&t?.loaded?t.relationships?.find(({id:t})=>t===e)??null:null}get relationshipKey(){let{relationshipKeyField:e}=this;return(e&&this.graphic?.attributes?.[e])??null}get relationshipKeyField(){return this.relationship?.keyField||null}get relatedFeatureViewModels(){return this._get(`relatedFeatureViewModels`)||new a}get state(){let{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:n,canQuery:r,_loaded:i,canLoad:a}=this;return t||a&&!i?`loading`:e||n?`querying`:r?`ready`:`disabled`}getRelatedFeatureByObjectId(e){return this.relatedFeatures.find(t=>t.getObjectId()===e)}refresh(){this._queryFeatureCountDebounced().catch(()=>{})}_destroyRelatedFeatureViewModels(){this.relatedFeatureViewModels?.destroyAll()}async _queryFeatureCount(){let{layer:e,relatedLayer:t}=this;await e?.load(),await t?.load();let{_queryFeatureCountAbortController:n,activeCategory:i,canQuery:a,objectId:o,relatedLayerKeyField:s,relationshipId:c,relationshipKey:l,supportsCacheHint:u}=this;if(!a||!e||!t||o==null){this._set(`featureCount`,0),this._set(`allCategories`,null);return}if(t?.type===`subtype-group`&&!i){if(this._set(`featureCount`,0),this._destroyRelatedFeatureViewModels(),this.featurePage=1,this.relatedFeatures.destroyAll(),s&&l!=null){let{default:e}=await import(`../../../smartMapping/statistics/uniqueValues.js`),{uniqueValueInfos:i}=await e({layer:t,sqlWhere:`${s} = '${l}'`,field:t.subtypeField,signal:n?.signal}),a=i.map(({count:e,value:n})=>{let r=t.subtypes?.find(e=>e.code===n)?.name;return n!=null&&r?{count:e,value:n,name:r}:void 0}).filter(r);this._set(`allCategories`,a)}return}let{historicMoment:d,gdbVersion:f}=e,p=new g({cacheHint:u,gdbVersion:f,historicMoment:d,relationshipId:c,returnGeometry:!1,objectIds:[o],where:this._getRelationshipWhereClause(t)}),m=await e.queryRelatedFeaturesCount(p,{signal:n?.signal});this._set(`allCategories`,null),this._set(`featureCount`,m[o]||0)}_getRelationshipWhereClause(e){let{activeCategory:t}=this,n=e.createQuery(),r=`subtypeField`in e?e.subtypeField:void 0,i=t&&r?`${r} = ${t.value}`:void 0,a=n.where;return a&&i?`(${a}) AND (${i})`:a??i}_sliceFeatures(e){let{showAllEnabled:t,displayCount:n}=this;return t?e:n?e.slice(0,n):[]}async _queryPage(){let{relatedFeatures:e,featurePage:t,showAllEnabled:n,_queryPageAbortController:r,featureCount:i}=this;!n||t<2||!i||this.relatedLayer?.type===`subtype-group`&&!this.activeCategory||e.addMany(await this._queryRelatedFeatures({signal:r?.signal}))}async _queryRelatedFeatures(e){let{displayCount:t,featureCount:n,featurePage:r,featuresPerPage:i,layer:a,orderByFieldsFixedCasing:o,relatedLayer:s,relatedLayerKeyFields:c,relationshipId:l,showAllEnabled:u,supportsCacheHint:d}=this,{canQuery:f,objectId:p}=this;if(!f||!a||!s||p==null)return[];let m=u?((r-1)*i+n)%n:0,h=u?i:t,v=s.objectIdField,b=`subtypeField`in s?s.subtypeField:void 0,x=[...o.map(e=>e.field),..._(s),...c,v,b].filter(y),S=o.map(e=>`${e.field} ${e.order}`),{historicMoment:C,gdbVersion:w}=a,T=new g({orderByFields:S,start:m,num:h,outFields:x,cacheHint:d,historicMoment:C,gdbVersion:w,relationshipId:l,returnGeometry:!1,objectIds:[p],where:this._getRelationshipWhereClause(s)}),E=(await a.queryRelatedFeatures(T,{signal:e?.signal}))[p]?.features||[];return s.type===`subtype-group`&&b?E.forEach(e=>{let t=e.attributes[b],n=s.findSublayerForSubtypeCode?.(t);e.sourceLayer=n,e.layer=n}):E.forEach(e=>{e.sourceLayer=s,e.layer=s}),E}};e([d()],v.prototype,`_loaded`,void 0),e([d()],v.prototype,`_queryAbortController`,void 0),e([d()],v.prototype,`_queryPageAbortController`,void 0),e([d()],v.prototype,`_queryFeatureCountAbortController`,void 0),e([d({value:1})],v.prototype,`featurePage`,null),e([d()],v.prototype,`featuresPerPage`,void 0),e([d({readOnly:!0})],v.prototype,`orderByFieldsFixedCasing`,null),e([d({readOnly:!0})],v.prototype,`supportsCacheHint`,null),e([d({readOnly:!0})],v.prototype,`canLoad`,null),e([d({readOnly:!0})],v.prototype,`canQuery`,null),e([d()],v.prototype,`activeCategory`,void 0),e([d({readOnly:!0})],v.prototype,`allCategories`,void 0),e([d({readOnly:!0})],v.prototype,`allCategoriesCount`,null),e([d({readOnly:!0})],v.prototype,`categories`,null),e([d()],v.prototype,`description`,void 0),e([d({value:3})],v.prototype,`displayCount`,null),e([d({type:t})],v.prototype,`graphic`,void 0),e([d({readOnly:!0})],v.prototype,`itemDescriptionFieldName`,null),e([d()],v.prototype,`layer`,void 0),e([d()],v.prototype,`map`,void 0),e([d({readOnly:!0})],v.prototype,`objectId`,null),e([d({readOnly:!0})],v.prototype,`objectIdField`,null),e([d()],v.prototype,`orderByFields`,void 0),e([d({readOnly:!0})],v.prototype,`relatedFeatures`,null),e([d({readOnly:!0})],v.prototype,`relatedLayer`,null),e([d({readOnly:!0})],v.prototype,`relatedLayerKeyField`,null),e([d({readOnly:!0})],v.prototype,`relatedLayerKeyFields`,null),e([d({readOnly:!0})],v.prototype,`relationship`,null),e([d({readOnly:!0})],v.prototype,`relationshipKey`,null),e([d({readOnly:!0})],v.prototype,`relationshipKeyField`,null),e([d({readOnly:!0})],v.prototype,`featureCount`,void 0),e([d({readOnly:!0})],v.prototype,`relatedFeatureViewModels`,null),e([d()],v.prototype,`relationshipId`,void 0),e([d()],v.prototype,`showAllEnabled`,void 0),e([d()],v.prototype,`state`,null),e([d()],v.prototype,`title`,void 0),v=e([f(`esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel`)],v);function y(e){return e!=null&&e!==``}export{v as default};
|