@arcgis/core 6.0.0-next.15 → 6.0.0-next.17
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/analysis/LineOfSightAnalysis.d.ts +49 -32
- package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
- package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
- package/analysis/Viewshed.d.ts +23 -3
- package/analysis/ViewshedAnalysis.d.ts +33 -13
- package/arcade/geometry/operatorsWorkerConnection.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00d66e3fba5ab4d2aa3c.js +1 -0
- package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
- package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +1 -0
- package/assets/esri/core/workers/chunks/164c8eeefa8232b2b191.js +2 -0
- package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
- package/assets/esri/core/workers/chunks/1967b9c96045a5802d08.js +1 -0
- package/assets/esri/core/workers/chunks/{1bca39e0e651426bdbb5.js → 1b1d3f6916d2cb751435.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed6e9d7f71bfd2691717.js → 1c77de1e79860f8d2228.js} +1 -1
- package/assets/esri/core/workers/chunks/1e40a26dcce4d1dadc28.js +1 -0
- package/assets/esri/core/workers/chunks/{261fea092ee7d27608a0.js → 20a2124cbe43e5527c40.js} +1 -1
- package/assets/esri/core/workers/chunks/237a1f68a0efbfe5b77c.js +1 -0
- package/assets/esri/core/workers/chunks/{3418877328f4f0830300.js → 24dac4970526a4e0ae63.js} +1 -1
- package/assets/esri/core/workers/chunks/26ceb0ff8d93dbb9b84f.js +1 -0
- package/assets/esri/core/workers/chunks/2853606099602f73d379.js +1 -0
- package/assets/esri/core/workers/chunks/2981e904ab62f3ed80d0.js +2 -0
- package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +1 -0
- package/assets/esri/core/workers/chunks/32cc59e126df8c96a0cf.js +2 -0
- package/assets/esri/core/workers/chunks/{4df6cb1bee5d0720a43e.js → 34e0a8a3a2beea50f4f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
- package/assets/esri/core/workers/chunks/{1e0d2715d603f48a7e0b.js → 370aad23df597db80d65.js} +1 -1
- package/assets/esri/core/workers/chunks/3e30b96a8c75bd5b9ae2.js +1 -0
- package/assets/esri/core/workers/chunks/{25f19fc929f25ddd628c.js → 42753cf4965a94bc91ca.js} +1 -1
- package/assets/esri/core/workers/chunks/42d44c7d532df5ee70e9.js +1 -0
- package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +1 -0
- package/assets/esri/core/workers/chunks/{6400446b7615b97c3521.js → 45f826554499c38968c6.js} +1 -1
- package/assets/esri/core/workers/chunks/48cc58890fddbcf69cef.js +1 -0
- package/assets/esri/core/workers/chunks/494bd434fee9032e1d02.js +1 -0
- package/assets/esri/core/workers/chunks/{33e4ff228a8c81b99022.js → 4abd3753cd9b80e4d937.js} +1 -1
- package/assets/esri/core/workers/chunks/{b564ec4e03478f5659db.js → 4c240ca50f70bf30813f.js} +1 -1
- package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
- package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
- package/assets/esri/core/workers/chunks/{70d3055f15d8b0cf4074.js → 532e9cda8ac3601d8892.js} +1 -1
- package/assets/esri/core/workers/chunks/5529831dd891382c79df.js +1 -0
- package/assets/esri/core/workers/chunks/{953ba13299e7aa92c1a0.js → 564565246dae080f5e6c.js} +1 -1
- package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +1 -0
- package/assets/esri/core/workers/chunks/{2145a512d269d64036b0.js → 58c3ae6030def2ed5f31.js} +1 -1
- package/assets/esri/core/workers/chunks/5a19a9c3e01d3d415188.js +1 -0
- package/assets/esri/core/workers/chunks/5a830bc35adbedd33783.js +1 -0
- package/assets/esri/core/workers/chunks/{eb04e1717a1002cda3ab.js → 5b91e2dffdc84c006539.js} +1 -1
- package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
- package/assets/esri/core/workers/chunks/603fdbbe9534c614928f.js +1 -0
- package/assets/esri/core/workers/chunks/{4e6f40cbdb8c508e6df1.js → 60f92eb03c6e17ab4747.js} +1 -1
- package/assets/esri/core/workers/chunks/{67ebc5a3d46b254b725c.js → 612345f17f5eeb99ea8f.js} +1 -1
- package/assets/esri/core/workers/chunks/{1b077c92345ffb5916c2.js → 65c98f3449044fa4fd79.js} +1 -1
- package/assets/esri/core/workers/chunks/{2bd4ee083ca4ad221f8b.js → 65cb5e39c467a35621ca.js} +1 -1
- package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +1 -0
- package/assets/esri/core/workers/chunks/67a35155b8b4d36f171e.js +1 -0
- package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +1 -0
- package/assets/esri/core/workers/chunks/{89e76de5ae3328d821a4.js → 69f6d5997b8ff1326e39.js} +1 -1
- package/assets/esri/core/workers/chunks/{ae31fd416bbb41a81392.js → 6ad309154fe84210d23c.js} +1 -1
- package/assets/esri/core/workers/chunks/{a40b6d8b5c73e06e14d4.js → 6c255c029d67423e4dac.js} +1 -1
- package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
- package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
- package/assets/esri/core/workers/chunks/784d6c6949284ed6e10b.js +1 -0
- package/assets/esri/core/workers/chunks/{3ffda5bf0b91700dc308.js → 78643f116677950ea29a.js} +1 -1
- package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
- package/assets/esri/core/workers/chunks/{e2190361247f35b02b32.js → 7b5cd150a4d0139850be.js} +1 -1
- package/assets/esri/core/workers/chunks/7bbfe9ff352afc566367.js +1 -0
- package/assets/esri/core/workers/chunks/7d2cbc767c336d15e4d5.js +1 -0
- package/assets/esri/core/workers/chunks/{ac5a6603f7fa78d3e4c8.js → 7e8611cb709f105946f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{05cd33d41d91f8d09633.js → 7fb7493f483cd9878bfa.js} +1 -1
- package/assets/esri/core/workers/chunks/{590e6c70206122e4cc3c.js → 844eedda8f749972f707.js} +2 -2
- package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
- package/assets/esri/core/workers/chunks/{601e1d020b8115497944.js → 8a485130781b49dbf608.js} +1 -1
- package/assets/esri/core/workers/chunks/{0ccab50877b24f862d6e.js → 8ac2098ecdc40ad41055.js} +1 -1
- package/assets/esri/core/workers/chunks/{a655ebdb4bf0660615a2.js → 8b4e9fd88c0c313416d4.js} +1 -1
- package/assets/esri/core/workers/chunks/{4e544de61f07ca660236.js → 8c12269d26f5a4c753cb.js} +1 -1
- package/assets/esri/core/workers/chunks/{46b4fb6a7fe4877b0efc.js → 94baa354e50c03b82b25.js} +2 -2
- package/assets/esri/core/workers/chunks/9503eedfdda55fc5adab.js +1 -0
- package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
- package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
- package/assets/esri/core/workers/chunks/98be2f621801e230aa01.js +1 -0
- package/assets/esri/core/workers/chunks/999c23da883eb11cb29e.js +1 -0
- package/assets/esri/core/workers/chunks/9b6929faf649e81265fb.js +1 -0
- package/assets/esri/core/workers/chunks/9d61740ef8bdcc162be1.js +1 -0
- package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
- package/assets/esri/core/workers/chunks/a35c69a4751d28c39907.js +1 -0
- package/assets/esri/core/workers/chunks/{3b3e519f15ed52c83f0c.js → a49fe94933b65b4b64f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{1819c45655c836b9a8d7.js → a4d3944700f1cc240176.js} +1 -1
- package/assets/esri/core/workers/chunks/{ec8b7476eac4718eb0ac.js → a504a5e06cb89a620799.js} +1 -1
- package/assets/esri/core/workers/chunks/a596779eaeec7310671d.js +1 -0
- package/assets/esri/core/workers/chunks/{d5d0fe8e198ff5a902ee.js → a5c8f9f5be4ef5063b42.js} +1 -1
- package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
- package/assets/esri/core/workers/chunks/{90bdf86f553e2742d67c.js → ab1660f5f8a5268c2fac.js} +1 -1
- package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
- package/assets/esri/core/workers/chunks/{b8337492e2b753aefac4.js → ace41659a5ca0e5abfc3.js} +1 -1
- package/assets/esri/core/workers/chunks/ae0563d573baf91e01f7.js +1 -0
- package/assets/esri/core/workers/chunks/{3c0ed15b544df6fb0903.js → b48952e1fb4cb7360dd0.js} +1 -1
- package/assets/esri/core/workers/chunks/b5e7475cc5fbf31289d3.js +1 -0
- package/assets/esri/core/workers/chunks/b686cd74975da09b9c91.js +2 -0
- package/assets/esri/core/workers/chunks/{aa36c3a9bbaa086e3757.js → b8fd7c3b36981261378b.js} +1 -1
- package/assets/esri/core/workers/chunks/bd046399e05e759e0bc2.js +1 -0
- package/assets/esri/core/workers/chunks/bd46a04a9ee4ea9e6ef1.js +2 -0
- package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
- package/assets/esri/core/workers/chunks/bfb39590c548188f5052.js +1 -0
- package/assets/esri/core/workers/chunks/c4ddac23bd649d24f3f2.js +1 -0
- package/assets/esri/core/workers/chunks/cddc3e285f763ccf33c2.js +1 -0
- package/assets/esri/core/workers/chunks/d08ff41e2a9bcd58b64a.js +1 -0
- package/assets/esri/core/workers/chunks/d62afb71f4ece4283994.js +1 -0
- package/assets/esri/core/workers/chunks/dc1761cba0454fda3cf9.js +1 -0
- package/assets/esri/core/workers/chunks/{0f617980c7dd9ad0444f.js → dd0310184fe4832755a8.js} +1 -1
- package/assets/esri/core/workers/chunks/dfa5f1311806473e473f.js +1 -0
- package/assets/esri/core/workers/chunks/{4ac1d3e49e242e373a92.js → e0650b1408197d3ac862.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ff6d1ed3c0f1285f3e7.js → e0d9dc97985561320bd4.js} +1 -1
- package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
- package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
- package/assets/esri/core/workers/chunks/eca44e53bcee9b08d70a.js +1 -0
- package/assets/esri/core/workers/chunks/f00458654c7c34c369ef.js +1 -0
- package/assets/esri/core/workers/chunks/f3cd610084e3f4d8656b.js +1 -0
- package/assets/esri/core/workers/chunks/f47fe4433b05fca5c3ad.js +1 -0
- package/assets/esri/core/workers/chunks/f7bfa3d33b05b250ce33.js +1 -0
- package/assets/esri/core/workers/chunks/f91bc1cb1014e05be763.js +1 -0
- package/assets/esri/core/workers/chunks/{19676b2c5f8b0a5ee680.js → facd1ff23203fed67686.js} +1 -1
- package/assets/esri/core/workers/chunks/{634523cc7757da9020e4.js → fb70ab267a08e24b710f.js} +1 -1
- package/assets/esri/core/workers/chunks/fc139f251dc0523074e7.js +1 -0
- package/assets/esri/core/workers/chunks/{40a584cb952e94326e9e.js → fcb86d24fc7e0666b564.js} +1 -1
- package/assets/esri/themes/base/widgets/_Weather.scss +1 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/UnitFactory.js +1 -1
- package/chunks/basis_encoder.js +1 -1
- package/chunks/basis_transcoder.js +1 -1
- package/chunks/index.js +1 -1
- package/chunks/lclayout.js +1 -1
- package/chunks/lerc-wasm.js +1 -1
- package/config.d.ts +2 -0
- package/config.js +1 -1
- package/core/accessorSupport/DefaultsStore.js +1 -1
- package/core/accessorSupport/MultiOriginStore.js +1 -1
- package/core/accessorSupport/Store.js +1 -1
- package/core/accessorSupport/decorators/reader.js +1 -1
- package/core/accessorSupport/decorators/writer.js +1 -1
- package/core/sql/WhereGrammar.js +2 -2
- package/core/workers/WorkerOwner.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/core/workers/workers.js +2 -2
- package/core/workers.d.ts +9 -0
- package/editing/sharedTemplates/executor/builders/equallySpaced.js +1 -1
- package/form/elements/inputs/DynamicChoiceInput.d.ts +4 -2
- package/geometry/Mesh.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/curves/bezierCurveUtils.js +1 -1
- package/geometry/support/curves/ellipticArc7Utils.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/geometry/support/polygonExtentClipping.js +1 -1
- package/identity/Credential.js +1 -1
- package/kernel.js +1 -1
- package/layers/AnnotationFeatureLayer.d.ts +2 -2
- package/layers/AnnotationFeatureLayer.js +1 -1
- package/layers/CatalogLayer.d.ts +2 -2
- package/layers/CatalogLayer.js +1 -1
- package/layers/DimensionFeatureLayer.d.ts +2 -2
- package/layers/DimensionFeatureLayer.js +1 -1
- package/layers/ElevationLayer.js +1 -1
- package/layers/FeatureLayer.d.ts +4 -4
- package/layers/FeatureLayer.js +1 -1
- package/layers/GeoJSONLayer.d.ts +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/LineOfSightLayer.d.ts +10 -8
- package/layers/SceneLayer.js +1 -1
- package/layers/SubtypeGroupLayer.d.ts +2 -2
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/ViewshedLayer.d.ts +1 -1
- package/layers/VoxelLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/effects/parser.js +3 -3
- package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
- package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
- package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
- package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
- package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
- package/layers/graphics/sources/parquet/FileProvider.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
- package/layers/mixins/ReloadableLayer.js +2 -0
- package/layers/raster/datasets/BaseRaster.js +1 -1
- package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
- package/layers/raster/datasets/ImageAuxRaster.js +2 -2
- package/layers/raster/datasets/ImageServerRaster.js +1 -1
- package/layers/raster/datasets/InMemoryRaster.js +1 -1
- package/layers/raster/datasets/MRFRaster.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/layers/raster/datasets/WCSRaster.js +1 -1
- package/layers/raster/formats/ElevationCodec.js +2 -0
- package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
- package/layers/raster/formats/Lerc.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/formats/TiffDecoder.js +1 -1
- package/layers/raster/formats/Zlib.js +1 -1
- package/layers/raster/functions/stretchUtils.js +1 -1
- package/layers/raster/functions/vectorFieldUtils.js +1 -1
- package/layers/support/FieldsIndex.js +1 -1
- package/layers/support/LercWorker.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/TileInfo.d.ts +1 -1
- package/layers/support/TileInfo.js +1 -1
- package/layers/support/featureReductionProperties.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/layers/support/layerOriginUtils.js +1 -1
- package/layers/video/VideoController.js +10 -10
- package/libs/maquette/projection.js +1 -1
- package/networks/UtilityNetworkTraceAnalysis.js +1 -1
- package/package.json +6 -6
- package/popup/FeatureModel.js +1 -1
- package/popup/FeaturesModel.js +1 -1
- package/portal/Portal.js +1 -1
- package/request/process.js +1 -1
- package/request/types.d.ts +7 -0
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/networks/trace.js +1 -1
- package/rest/query/executeQuery.js +1 -1
- package/smartMapping/raster/renderers/shadedRelief.js +1 -1
- package/smartMapping/renderers/univariateColorSize.js +1 -1
- package/smartMapping/statistics/support/statsWorker.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerBinningAdapter.js +1 -1
- package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/OGCFeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/smartMapping/support/clusterUtils.js +1 -1
- package/statistics/utils.js +1 -1
- package/symbols/cim/CIMCursor.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/support/ElevationInfo.d.ts +4 -3
- package/time/TimeExtent.d.ts +1 -1
- package/undoredo/support/Services.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +2 -2
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/grid/GridView2D.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
- package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/types.d.ts +7 -0
- package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
- package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/SpatialIndex2D.js +1 -1
- package/views/3d/layers/i3s/I3SNode.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
- package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
- package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
- package/views/3d/support/elevationUpdateUtils.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/sphereExtentUtils.js +2 -0
- package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/View.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/InteractiveHandle.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/draw/support/editingSessionUtils.js +1 -1
- package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
- package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
- package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
- package/views/interactive/options/TooltipOptions.d.ts +2 -0
- package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
- package/views/interactive/sketch/constraintUtils.js +1 -1
- package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
- package/views/interactive/snapping/SnappingManagerPool.js +1 -1
- package/views/interactive/snapping/allLayerSnapping.js +1 -1
- package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
- package/views/layers/LayerView.js +1 -1
- package/views/layers/LineOfSightLayerView.d.ts +35 -13
- package/views/layers/SketchLayerView.d.ts +1 -0
- package/views/layers/ViewshedLayerView.d.ts +36 -12
- package/views/webgl/Program.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.d.ts +2 -1
- package/widgets/BasemapToggle/BasemapToggleViewModel.d.ts +2 -0
- package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.d.ts +2 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
- package/widgets/ElevationProfile/components/Statistics.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/Expand/ExpandViewModel.d.ts +2 -0
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
- package/widgets/FeatureTable/support/TableTemplate.js +1 -1
- package/widgets/Fullscreen/FullscreenViewModel.d.ts +3 -1
- package/widgets/Home/HomeViewModel.d.ts +2 -0
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/Swipe/SwipeViewModel.d.ts +2 -0
- package/widgets/Swipe/types.d.ts +9 -2
- package/widgets/TimeSlider/TimeSliderViewModel.d.ts +9 -5
- package/widgets/TimeSlider/types.d.ts +7 -0
- package/widgets/TimeSlider.d.ts +2 -3
- package/widgets/TimeSlider.js +1 -1
- package/widgets/Track/TrackViewModel.d.ts +4 -0
- package/widgets/Track/types.d.ts +1 -0
- package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/Selector3D/selectorUtils.js +1 -1
- package/widgets/support/componentsUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0050916e462e3c9e0627.js +0 -1
- package/assets/esri/core/workers/chunks/024b44c0c8876627f904.js +0 -1
- package/assets/esri/core/workers/chunks/02c5d027bdaee67869cf.js +0 -1
- package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
- package/assets/esri/core/workers/chunks/0c8c01097847617261b9.js +0 -1
- package/assets/esri/core/workers/chunks/0d931c7579b6409a696d.js +0 -1
- package/assets/esri/core/workers/chunks/12c154342fff876f2f1e.js +0 -1
- package/assets/esri/core/workers/chunks/1e11d2e97d17685b878a.js +0 -1
- package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
- package/assets/esri/core/workers/chunks/21ddb26526bcb2b122c3.js +0 -1
- package/assets/esri/core/workers/chunks/2eae542fe7f0f6576ac1.js +0 -1
- package/assets/esri/core/workers/chunks/34cbaf844730ac2d92c2.js +0 -2
- package/assets/esri/core/workers/chunks/3c301a689c7853c9fa67.js +0 -2
- package/assets/esri/core/workers/chunks/3f946c13ad97fbed867b.js +0 -1
- package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +0 -1
- package/assets/esri/core/workers/chunks/46a7da93a63663878583.js +0 -1
- package/assets/esri/core/workers/chunks/4a1e23e021bac37a88ab.js +0 -1
- package/assets/esri/core/workers/chunks/4c4117e28ea358a32088.js +0 -1
- package/assets/esri/core/workers/chunks/54b18559280a7d2a8d93.js +0 -1
- package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
- package/assets/esri/core/workers/chunks/604f0f4150fb79ee54c8.js +0 -1
- package/assets/esri/core/workers/chunks/6299be5e7e26bf3c6859.js +0 -1
- package/assets/esri/core/workers/chunks/62ac588f7dd1d24d0c9d.js +0 -1
- package/assets/esri/core/workers/chunks/62c8c9ad09e0166207fd.js +0 -1
- package/assets/esri/core/workers/chunks/62d6e101e9bd9557a410.js +0 -1
- package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
- package/assets/esri/core/workers/chunks/665e31c494d2af505acc.js +0 -1
- package/assets/esri/core/workers/chunks/6f4e6022a52de0c54aab.js +0 -1
- package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
- package/assets/esri/core/workers/chunks/745a153d0cd34faa124e.js +0 -1
- package/assets/esri/core/workers/chunks/7572c2bc5062e66f6330.js +0 -1
- package/assets/esri/core/workers/chunks/76ab353d80d786777161.js +0 -2
- package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +0 -1
- package/assets/esri/core/workers/chunks/8293600f94553afc8c38.js +0 -1
- package/assets/esri/core/workers/chunks/8431ca60ad33d594e323.js +0 -1
- package/assets/esri/core/workers/chunks/8483c50ed8f280fd74bb.js +0 -1
- package/assets/esri/core/workers/chunks/876f7633c15f1e31078d.js +0 -1
- package/assets/esri/core/workers/chunks/8ca9648eacb894283513.js +0 -1
- package/assets/esri/core/workers/chunks/8cb716f110d164030309.js +0 -1
- package/assets/esri/core/workers/chunks/91ebb2ccab1889eb7e81.js +0 -1
- package/assets/esri/core/workers/chunks/94e427040edb469d58ad.js +0 -1
- package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +0 -1
- package/assets/esri/core/workers/chunks/9e1a3b6a08c96dcefdde.js +0 -1
- package/assets/esri/core/workers/chunks/9e3e442a9874ed23a043.js +0 -1
- package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +0 -1
- package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
- package/assets/esri/core/workers/chunks/b49df4ebd4be1181b0f9.js +0 -2
- package/assets/esri/core/workers/chunks/b557824bc1fa163d72a3.js +0 -2
- package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +0 -1
- package/assets/esri/core/workers/chunks/d8f1cefcad02d7353d4b.js +0 -1
- package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
- package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +0 -1
- package/assets/esri/core/workers/chunks/de02f60258e6985ef676.js +0 -1
- package/assets/esri/core/workers/chunks/e10b57aefcc89671116e.js +0 -1
- package/assets/esri/core/workers/chunks/e65dfa19f030ec298437.js +0 -1
- package/assets/esri/core/workers/chunks/ed8786fed345718ed684.js +0 -1
- package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +0 -1
- package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +0 -1
- package/assets/esri/core/workers/chunks/fc44227c1756f65b95df.js +0 -1
- package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
- package/assets/esri/core/workers/chunks/fe9879ecd69ac4329291.js +0 -1
- package/layers/mixins/FeatureLayerReload.js +0 -2
- /package/assets/esri/core/workers/chunks/{b557824bc1fa163d72a3.js.LICENSE.txt → 164c8eeefa8232b2b191.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{b49df4ebd4be1181b0f9.js.LICENSE.txt → 2981e904ab62f3ed80d0.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{34cbaf844730ac2d92c2.js.LICENSE.txt → 32cc59e126df8c96a0cf.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{590e6c70206122e4cc3c.js.LICENSE.txt → 844eedda8f749972f707.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{3c301a689c7853c9fa67.js.LICENSE.txt → b686cd74975da09b9c91.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{76ab353d80d786777161.js.LICENSE.txt → bd46a04a9ee4ea9e6ef1.js.LICENSE.txt} +0 -0
|
@@ -3,6 +3,7 @@ import type Accessor from "../../core/Accessor.js";
|
|
|
3
3
|
import type { BasemapProperties } from "../../Basemap.js";
|
|
4
4
|
import type { MapViewOrSceneView } from "../../views/MapViewOrSceneView.js";
|
|
5
5
|
|
|
6
|
+
/** @deprecated since 5.2. Use the Basemap Toggle component's [`nextBasemap`](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-basemap-toggle/#nextBasemap) and [`view`](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-basemap-toggle/#view) properties instead. */
|
|
6
7
|
export interface BasemapToggleViewModelProperties extends Partial<Pick<BasemapToggleViewModel, "view">> {
|
|
7
8
|
/**
|
|
8
9
|
* The next basemap for toggling. One of the following values may be set to this property:
|
|
@@ -13,6 +14,7 @@ export interface BasemapToggleViewModelProperties extends Partial<Pick<BasemapTo
|
|
|
13
14
|
nextBasemap?: BasemapProperties | string | null;
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
/** @deprecated since 5.2. Use the Basemap Toggle component's [`state`](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-basemap-toggle/#state) property instead. */
|
|
16
18
|
export type BasemapToggleViewModelState = "ready" | "incompatible-next-basemap" | "loading" | "disabled";
|
|
17
19
|
|
|
18
20
|
/**
|
|
@@ -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{deprecateUnnecessaryViewModel as n}from"../../core/deprecate.js";import r from"../../core/Logger.js";import{watch as i,initial as a,whenOnce as o}from"../../core/reactiveUtils.js";import{property as s,subclass as c}from"../../core/accessorSupport/decorators.js";import{isLoaded as l,canProjectWithoutEngine as u,load as d}from"../../geometry/projectionUtils.js";import{equals as f}from"../../geometry/support/spatialReferenceUtils.js";import{basemapEnsureType as p}from"../../support/basemapEnsureType.js";import{findSpatialReference as m,getBasemapThumbnailUrl as h}from"../../support/basemapUtils.js";let g=class extends t{constructor(e){super(e),this._loadingProjectionEngine=!1,this.view=null,e?.suppressDeprecationWarning||n(r.getLogger(this),`Basemap Toggle`,`arcgis-basemap-toggle`,{version:`5.2`}),this.nextBasemap=p(`hybrid`)}normalizeCtorArgs(e){let{suppressDeprecationWarning:t,...n}=e??{};return n}initialize(){i(()=>this.nextBasemap,e=>{e&&!e.loaded&&e.load().catch(()=>{})},a)}destroy(){this.view=null}get _nextBasemapSpatialReferenceTask(){return m(this.view,this.nextBasemap)}get _viewSpatialReferenceLocked(){let{view:e}=this;return e&&`spatialReferenceLocked`in e?e.spatialReferenceLocked:!0}get activeBasemap(){return p(this.view?.map?.basemap??`topo-vector`)}get nextBasemap(){return this._get(`nextBasemap`)}set nextBasemap(e){this._set(`nextBasemap`,p(e))}get state(){let{view:e}=this;if(!e?.ready||this._nextBasemapSpatialReferenceTask.updating)return`disabled`;let{spatialReference:t}=this._nextBasemapSpatialReferenceTask;return this._viewSpatialReferenceLocked&&t!=null&&!e.spatialReference.equals(t)?`incompatible-next-basemap`:this._loadingProjectionEngine?`loading`:`ready`}async toggle(){let{activeBasemap:e,nextBasemap:t,state:n,view:r}=this;if(!r||n===`disabled`||n===`incompatible-next-basemap`)return;let i=this._viewSpatialReferenceLocked;if(!i){if(await o(()=>!this._nextBasemapSpatialReferenceTask.updating),t!==this.nextBasemap||e!==this.activeBasemap)return;let{spatialReference:n}=this._nextBasemapSpatialReferenceTask;if(n
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{deprecateUnnecessaryViewModel as n}from"../../core/deprecate.js";import r from"../../core/Logger.js";import{watch as i,initial as a,whenOnce as o}from"../../core/reactiveUtils.js";import{property as s,subclass as c}from"../../core/accessorSupport/decorators.js";import{isLoaded as l,canProjectWithoutEngine as u,load as d}from"../../geometry/projectionUtils.js";import{equals as f}from"../../geometry/support/spatialReferenceUtils.js";import{basemapEnsureType as p}from"../../support/basemapEnsureType.js";import{findSpatialReference as m,getBasemapThumbnailUrl as h}from"../../support/basemapUtils.js";let g=class extends t{constructor(e){super(e),this._loadingProjectionEngine=!1,this.view=null,e?.suppressDeprecationWarning||n(r.getLogger(this),`Basemap Toggle`,`arcgis-basemap-toggle`,{version:`5.2`}),this.nextBasemap=p(`hybrid`)}normalizeCtorArgs(e){let{suppressDeprecationWarning:t,...n}=e??{};return n}initialize(){i(()=>this.nextBasemap,e=>{e&&!e.loaded&&e.load().catch(()=>{})},a)}destroy(){this.view=null}get _nextBasemapSpatialReferenceTask(){return m(this.view,this.nextBasemap)}get _viewSpatialReferenceLocked(){let{view:e}=this;return e&&`spatialReferenceLocked`in e?e.spatialReferenceLocked:!0}get activeBasemap(){return p(this.view?.map?.basemap??`topo-vector`)}get nextBasemap(){return this._get(`nextBasemap`)}set nextBasemap(e){this._set(`nextBasemap`,p(e))}get state(){let{view:e}=this;if(!e?.ready||this._nextBasemapSpatialReferenceTask.updating)return`disabled`;let{spatialReference:t}=this._nextBasemapSpatialReferenceTask;return this._viewSpatialReferenceLocked&&t!=null&&!e.spatialReference.equals(t)?`incompatible-next-basemap`:this._loadingProjectionEngine?`loading`:`ready`}async toggle(){let{activeBasemap:e,nextBasemap:t,state:n,view:r}=this;if(!r||n===`disabled`||n===`incompatible-next-basemap`)return;let i=this._viewSpatialReferenceLocked;if(!i){if(await o(()=>!this._nextBasemapSpatialReferenceTask.updating),t!==this.nextBasemap||e!==this.activeBasemap)return;let{spatialReference:n}=this._nextBasemapSpatialReferenceTask;if(n==null||f(r.spatialReference,n)||l()||u(r.spatialReference,n)||(this._loadingProjectionEngine=!0,await d(),this._loadingProjectionEngine=!1),t!==this.nextBasemap||e!==this.activeBasemap)return}r.map.basemap=t,!i&&this._nextBasemapSpatialReferenceTask.spatialReference!=null&&!f(r.spatialReference,this._nextBasemapSpatialReferenceTask.spatialReference)&&(r.spatialReference=this._nextBasemapSpatialReferenceTask.spatialReference),this.nextBasemap=e}static getThumbnailUrl(e){return h(e)}};e([s()],g.prototype,`_loadingProjectionEngine`,void 0),e([s({readOnly:!0})],g.prototype,`_nextBasemapSpatialReferenceTask`,null),e([s({readOnly:!0})],g.prototype,`_viewSpatialReferenceLocked`,null),e([s({readOnly:!0})],g.prototype,`activeBasemap`,null),e([s()],g.prototype,`nextBasemap`,null),e([s({readOnly:!0})],g.prototype,`state`,null),e([s()],g.prototype,`view`,void 0),e([s()],g.prototype,`toggle`,null),g=e([c(`esri.widgets.BasemapToggle.BasemapToggleViewModel`)],g);const _=g;export{_ as default};
|
package/widgets/Directions.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{isSome as t}from"../core/arrayUtils.js";import n from"../core/Collection.js";import{deprecateWidget as r}from"../core/deprecate.js";import{addEventListener as i}from"../core/events.js";import{makeHandle as a}from"../core/handleUtils.js";import o from"../core/Logger.js";import{destroyMaybe as s}from"../core/maybe.js";import{debounce as c,isAbortError as l}from"../core/promiseUtils.js";import{watch as u,initial as d,on as f}from"../core/reactiveUtils.js";import{escapeRegExpString as p}from"../core/string.js";import{property as m,subclass as h}from"../core/accessorSupport/decorators.js";import{onLocaleChange as g,getLocaleLanguage as _}from"../intl/locale.js";import v from"../portal/Portal.js";import{defaultUnitPropertyMetadata as y}from"../properties/defaultUnit.js";import b from"../rest/support/Stop.js";import x from"../symbols/SimpleMarkerSymbol.js";import S from"./Search.js";import C from"./Widget.js";import{css as w}from"./Directions/css.js";import{DirectionsSearchTool as T}from"./Directions/DirectionsSearchTool.js";import E from"./Directions/DirectionsViewModel.js";import D from"./Directions/DirectionsVisibleElements.js";import{formatDistance as O,formatDuration as k,DepartureTimeOption as A,getIconName as j}from"./Directions/support/directionsUtils.js";import{isArcGISWorldGeocoder as M,meteredArcGISLocatorUrl as N}from"./Search/support/locatorUtils.js";import{loadCalciteComponents as P}from"./support/componentsUtils.js";import{globalCss as F}from"./support/globalCss.js";import{messageBundle as I,tsx as L}from"./support/widget.js";function R(e){let{branchName:n,displayText:r,exitName:i,intersectingName:a,name:o,towardName:s}=e;if(r==null)return null;let c=[n,i,a,o,s].filter(t).sort((e,t)=>t.length-e.length).map(e=>p(e));if(!c.length)return r;let l=new RegExp(c.join(`|`),`g`),u=r.matchAll(l),d=0,f=[];for(let{0:e,index:t}of u)f.push(r.slice(d,t),L(`span`,{class:w.labelEmphasize,key:`maneuver-${t}`},e)),d=t+e.length;return f.push(r.slice(d)),L(`span`,null,f)}const z=`print-preview-closed`;let B=class extends C{constructor(e,t){super(e,t),this._activeManeuver=null,this._placeholderStops=new n([new b,new b]),this._portalFolderCombobox=null,this._portalFolders=null,this._portalItemNameInput=null,this._portalUserName=null,this._printPreviewDialog=null,this._sections=null,this._stopsToSearches=new Map,this._editNoticeClosed=!1,this._printPreviewDialogOpen=!1,this._currentFlowItem=`primary`,this._parentFlowItem=`primary`,this._saveState=`initialized`,this._searchTool=null,this.headingLevel=2,this.messages=null,this.messagesUnits=null,this.searchProperties={popupEnabled:!1,resultGraphicEnabled:!1},this.viewModel=new E,this.visibleElements=new D,this._solveRouteDebounced=c(()=>this._solveRoute()),this.announceDeprecation=()=>{r(o.getLogger(this),`Directions`,`arcgis-directions`,{version:`5.0`})}}initialize(){this.addHandles([u(()=>this.viewModel.layer,()=>{this.viewModel.load().catch(()=>{})},d),u(()=>this.viewModel.layer?.routeInfo,()=>{this._sections=this._getStopSections()},d),u(()=>this.viewModel.layer?.stops.toArray(),e=>{e&&this.view?.activeTool&&this._searchTool&&this.view.activeTool===this._searchTool&&!e.includes(this._searchTool.stop)&&(this.view.tools.remove(this._searchTool),this._searchTool=null)})])}loadDependencies(){return P({accordion:()=>import(`@esri/calcite-components/dist/components/calcite-accordion`),"accordion-item":()=>import(`@esri/calcite-components/dist/components/calcite-accordion-item`),action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),"action-menu":()=>import(`@esri/calcite-components/dist/components/calcite-action-menu`),"block-section":()=>import(`@esri/calcite-components/dist/components/calcite-block-section`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),"input-date-picker":()=>import(`@esri/calcite-components/dist/components/calcite-input-date-picker`),"input-time-picker":()=>import(`@esri/calcite-components/dist/components/calcite-input-time-picker`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),loader:()=>import(`@esri/calcite-components/dist/components/calcite-loader`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`)})}destroy(){this._stopsToSearches.forEach(s)}get apiKey(){return this.viewModel.apiKey}set apiKey(e){this.viewModel.apiKey=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get displayedStops(){return this.effectiveStops.toArray().filter(({locationType:e})=>e!==`waypoint`)}get effectiveStops(){return this.viewModel.layer?.stops??this._placeholderStops}get icon(){return`right`}set icon(e){this._overrideIfSome(`icon`,e)}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get lastRoute(){return this.viewModel.lastRoute}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxStops(){return this.viewModel.maxStops}set maxStops(e){this.viewModel.maxStops=e}get unit(){return this.defaultUnit}set unit(e){this._overrideIfSome(`unit`,e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}acquireSearch(e){let{view:t}=this.viewModel;if(this._stopsToSearches.has(e)){let n=this._stopsToSearches.get(e);return n.view=t,this._overrideDefaultSources(n),n}let n=new S({icon:``,popupEnabled:!1,resultGraphicEnabled:!1,view:t,suppressDeprecationWarning:!0,...this.searchProperties});return this._normalizeSearchSources(n),this.addHandles([f(()=>n.allSources,`change`,()=>this._normalizeSearchSources(n)),n.on(`search-clear`,()=>{e.geometry=null,e.name=null,this.viewModel.layer?.removeResult()}),n.on(`select-result`,()=>{let t=n.selectedResult;e.geometry=t?.feature.geometry,e.name=t?.name,this._solveRouteDebounced()}),u(()=>n.searchTerm,t=>{e.name=t}),g(()=>this._normalizeSearchSources(n))],n),this._stopsToSearches.set(e,n),n}getDirections(){return this.viewModel.getDirections()}render(){return L(`div`,{class:this.classes(w.base,F.widget,F.panel)},L(`calcite-flow`,null,this._renderPrimaryFlowItem(),this._renderDirectionsFlowItem(),this._renderEditFlowItem(),this._renderSaveFlowItem()),this._renderPrintDocument())}save(){return this.viewModel.save()}saveAs(e,t={}){return this.viewModel.saveAs(e,t)}zoomToRoute(){return this.viewModel.zoomToRoute()}_applyLocatorSourceOverrides({allSources:e}){for(let t of e)`url`in t&&t.url&&(t.language=_(),t.locationType??=`street`,M(t.url)&&this.apiKey&&t.apiKey==null&&(t.apiKey=this.apiKey,t.url=N))}_disposeSearch(e){if(!e||!this._stopsToSearches.has(e))return;let t=this._stopsToSearches.get(e);this.removeHandles(t),t.destroy(),this._stopsToSearches.delete(e)}_getErrorDescription(){switch(this.viewModel.lastError?.name){case`directions-view-model:unable-to-route`:return this.messages.errors.unableToRoute;case`directions-view-model:service-metadata-unavailable`:return this.messages.errors.unableToLoadServiceMetadata;default:return this.messages.errors.unknownError}}_getNetworkFeatureName(e){switch(e.type){case`stop`:switch(e.locationType){case`stop`:default:return this.messages.networkFeatures.stops.stop;case`waypoint`:return this.messages.networkFeatures.stops.waypoint;case`break`:return this.messages.networkFeatures.stops.break}case`point-barrier`:return this.messages.networkFeatures.pointBarrier;case`polyline-barrier`:return this.messages.networkFeatures.polylineBarrier;case`polygon-barrier`:return this.messages.networkFeatures.polygonBarrier}}_getRouteCostSummary(){let e=this.viewModel.layer?.routeInfo;if(!e)return null;let t=e.totalDistance??0,n=e.totalDuration??0,{messagesUnits:r,unit:i}=this;return{distance:O(r,t,i),duration:k(n)}}_getStopCostDescription(e){if(!e.directions.length)return;let{totalDistance:t,totalDuration:n}=e.directions.reduce((e,{lines:t})=>{for(let{distance:n,duration:r}of t)e.totalDistance+=n??0,e.totalDuration+=r??0;return e},{totalDistance:0,totalDuration:0}),{messagesUnits:r,unit:i}=this,a=O(r,t,i);return`${k(n)} (${a})`}_getStopSections(){if(!this.viewModel.layer)return null;let{directionPoints:e,directionLines:t,stops:n}=this.viewModel.layer;if(!e||!t)return null;let r=[],i=null;for(let a of e){let{objectId:e,stopId:o}=a;if(o!=null){let e=n.find(({objectId:e})=>e===o);(!i||i.stop!==e)&&(i={stop:e,directions:[]},r.push(i));continue}if(i==null)continue;let s=t.toArray().filter(({directionPointId:t})=>t===e);s.length!==0&&i.directions.push({directionPoint:a,lines:s})}return r}_handleAddStopClick(){let e=new x;this.viewModel.layer?.stops.add(new b({symbol:e}))}_handleAutoSolveChange({target:e}){this.viewModel.autoSolve=e.checked}_handleCreatePolylineBarrierClick(){this.viewModel.create(`polyline-barrier`)}_handleClearRouteClick(){this._currentFlowItem=`primary`,this.viewModel.reset()}_handleCreateStopClick(){this.viewModel.create(`stop`)}_handleDeleteNetworkFeatureClick(e){this.viewModel.remove(e),this.viewModel.autoSolve&&this._solveRouteDebounced()}_handleDeleteStopClick(e){this.effectiveStops.remove(e),this._disposeSearch(e),this._solveRouteDebounced()}_handleDepartureDateChange({currentTarget:{value:e}}){Array.isArray(e)||(this.viewModel.departureIsoDate=e,this._solveRouteDebounced())}_handleDepartureTimeChange({currentTarget:{value:e}}){this.viewModel.departureIsoTime=e,this._solveRouteDebounced()}_handleDepartureTimeOptionChange({currentTarget:e}){let{selectedItems:t}=e;t.length&&(this.viewModel.departureOption=t[0].value,this._solveRouteDebounced())}_handleDirectionsFlowItemBackClick(e){e.stopPropagation(),this._currentFlowItem=`primary`}_handleDirectionTurnItemSelect(e){this._activeManeuver===e?this.zoomToRoute():(this._activeManeuver=e,this.viewModel.centerAt(e.geometry))}_handleDirectionTurnPointerEnter(e){this.viewModel.highlight(e)}_handleDirectionTurnPointerLeave(){this.viewModel.clearHighlights()}_handleEditFlowItemBackClick(e){e.stopPropagation(),this.viewModel.stopEditing(),this._currentFlowItem=`primary`}_handleEditingDoneClick(){this.viewModel.stopEditing(),this._currentFlowItem=`primary`}_handleEditNoticeClose(){this._editNoticeClosed=!0}_handleEditRouteClick(){this._currentFlowItem=`edit`,this.viewModel.startEditing()}_handleItemDetailsClick(){let e=this.viewModel.layer?.portalItem;e&&window.open(`${e.portal.url}/home/item.html?id=${e.id}`,`_blank`)}_handleLocateStopClick(e){let{view:t}=this;if(!t)return;let n=`directions-search-tool`;this.removeHandles(n),this._searchTool=new T({stop:e,view:t}),this.addHandles([this._searchTool.on(`click`,async t=>{if(t.stopPropagation(),t.mapPoint&&this._stopsToSearches.has(e)){let n=this._stopsToSearches.get(e),r=(await n.search(t.mapPoint))?.results?.[0].results?.[0];if(r){let{feature:t,name:i}=r;n.searchTerm=i,e.geometry=t.geometry}}this.removeHandles(n)}),a(()=>{this._searchTool&&=(this.view?.tools.remove(this._searchTool),null)})],n),t.addAndActivateTool(this._searchTool)}_handleOptimizeStopOrderToggle({target:{expanded:e}}){this.viewModel.routeParameters.findBestSequence=e,e&&this._removeWaypoints(),this._solveRouteDebounced()}_handlePanToStopClick(e){this.viewModel.centerAt(e)}_handlePreserveFirstStopChange({target:{checked:e}}){this.viewModel.routeParameters.preserveFirstStop=e,this._solveRouteDebounced()}_handlePreserveLastStopChange({target:{checked:e}}){this.viewModel.routeParameters.preserveLastStop=e,this._solveRouteDebounced()}_handlePrintPreviewDialogAfterCreate(e){document.body.appendChild(e),e.showModal(),this._printPreviewDialog=e,this.removeHandles(z),this.addHandles([i(e,`close`,this._handlePrintPreviewDialogClosed.bind(this)),a(()=>{this._printPreviewDialog&&(document.body.removeChild(this._printPreviewDialog),this._printPreviewDialog=null,this._printPreviewDialogOpen=!1)})],z)}_handlePrintPreviewDialogClick(){this._printPreviewDialogOpen=!0}_handlePrintPreviewDialogCloseClick(){this._printPreviewDialog?.close()}_handlePrintPreviewDialogClosed(){this.removeHandles(z)}_handlePrintPreviewDialogPrintClick(){document.body.classList.add(w.printPreviewMedia),window.print(),document.body.classList.remove(w.printPreviewMedia),this._printPreviewDialog?.close()}_handleResolveRouteClick(){this._solveRouteDebounced()}_handleReverseStopOrderClick(){this._removeWaypoints(),this.effectiveStops.reverse(),this._solveRouteDebounced()}_handleSaveErrorCloseClick(){this._currentFlowItem=this._parentFlowItem}_handleSaveFlowItemBackClick(e){e.stopPropagation(),this._currentFlowItem=this._parentFlowItem}async _handleSaveLayerAs(){let e=v.getDefault();try{await e.signIn()}catch(e){if(l(e)||e.name===`identity-manager:user-aborted`)return;this._parentFlowItem=this._currentFlowItem,this._currentFlowItem=`save`,this._saveState=`connect-to-portal-error`;return}this._saveState=`fetch-portal-information`,this._parentFlowItem=this._currentFlowItem,this._currentFlowItem=`save`,this._portalUserName=e.user?.username;try{this._portalFolders=await e.user?.fetchFolders()}catch{this._saveState=`fetch-portal-information-error`;return}this._saveState=`save-layer`}_handleSaveLayerClick(){this.viewModel.layer?.save()}_handleSaveLayerButtonClick(){this._saveState=`saving`;let{layer:e}=this;if(!e||!this._portalFolders)return;let t=this._portalItemNameInput?.value,n=this._portalFolderCombobox?.value,r=this._portalFolders.find(({id:e})=>e===n);e.saveAs({title:t},{folder:r}).then(()=>{e.title=t,this._currentFlowItem=this._parentFlowItem}).catch(()=>{this._saveState=`saving-error`})}_handleSaveLayerCancelClick(){this._currentFlowItem=this._parentFlowItem}_handleSaveLayerFolderCreate(e){this._portalFolderCombobox=e}_handleSaveLayerNameCreate(e){this._portalItemNameInput=e}_handleSignInClick(){this.viewModel.load().catch(()=>{})}_handleStopListReorder({detail:{dragEl:e,newIndex:t}}){this._removeWaypoints(),this.effectiveStops.reorder(e.value,t),this._solveRouteDebounced()}_handleTravelModeChange({currentTarget:{selectedItems:e}}){e.length&&(this.viewModel.selectedTravelMode=e[0].value,this._solveRouteDebounced())}_handleViewDrivingDirectionsClick(){this._currentFlowItem=`directions`}_normalizeSearchSources(e){this._overrideDefaultSources(e),this._applyLocatorSourceOverrides(e)}_overrideDefaultSources(e){for(let t of e.viewModel.defaultSources)t.autoNavigate=!1}_removeWaypoints(){let e=this.viewModel.layer?.stops;if(e){let t=e.filter(({locationType:e})=>e===`waypoint`);e.removeMany(t)}}_renderClearRouteAction(e){return L(`calcite-action`,{bind:this,icon:`trash`,key:`clear-route`,onclick:this._handleClearRouteClick,...e,text:this.messages.common.clear,textEnabled:!0})}_renderDeleteStopAction(e){return L(`calcite-action`,{icon:`trash`,slot:`actions-end`,text:this.messages.deleteStop,title:this.messages.deleteStop,onclick:this._handleDeleteStopClick.bind(this,e)})}_renderDepartureTime(){let{DEPART_AT:e,NOW:t,UNSPECIFIED:n}=A;return L(`calcite-label`,{class:w.departureTime,key:`departure-time`},this.messages.departureTime,L(`calcite-combobox`,{bind:this,label:this.messages.departureTime,overlayPositioning:`fixed`,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:this._handleDepartureTimeOptionChange},L(`calcite-combobox-item`,{heading:this.messages.leaveNow,key:t,label:this.messages.leaveNow,selected:this.viewModel.departureOption===t,value:t}),L(`calcite-combobox-item`,{heading:this.messages.departAt,key:e,label:this.messages.departAt,selected:this.viewModel.departureOption===e,value:e}),L(`calcite-combobox-item`,{heading:this.messages.timeUnspecified,key:n,label:this.messages.timeUnspecified,selected:this.viewModel.departureOption===n,value:n})))}_renderDepartureTimeOptions(){return this.viewModel.departureOption===A.DEPART_AT?L(`div`,{class:w.departureTimeOptions},L(`calcite-input-date-picker`,{bind:this,scale:`s`,topLayerDisabled:this.topLayerDisabled,value:this.viewModel.departureIsoDate,onCalciteInputDatePickerChange:this._handleDepartureDateChange}),L(`calcite-input-time-picker`,{bind:this,scale:`s`,value:this.viewModel.departureIsoTime,onCalciteInputTimePickerClose:this._handleDepartureTimeChange})):null}_renderDirectionsFlowItem(){if(this._currentFlowItem!==`directions`)return null;let e=this._getRouteCostSummary();if(!this._sections||!e)return null;let{distance:t,duration:n}=e,{formattedEta:r}=this.viewModel,i=this._sections.at(0)?.stop.name??``,a=this._sections.at(-1)?.stop.name??``;return L(`calcite-flow-item`,{bind:this,key:`directions-flow-item`,overlayPositioning:`fixed`,selected:this._currentFlowItem===`directions`,onCalciteFlowItemBack:this._handleDirectionsFlowItemBackClick},L(`div`,{class:w.directionsHeader,slot:`header-content`},L(`div`,{class:w.headerStops},L(`span`,null,this.messages.from),` `,L(`span`,{class:w.directionsHeaderStopName},i),L(`span`,null,this.messages.to),` `,L(`span`,{class:w.directionsHeaderStopName},a)),L(`div`,{class:w.flexColumn},L(`span`,null,`${n} (${t})`),r?L(`span`,null,r):null)),this._renderRouteLayerActions({slot:`header-menu-actions`}),L(`calcite-accordion`,{class:w.accordion,iconPosition:`start`,selectionMode:`single`},this._sections.map((e,t)=>this._renderDirectionSection(e,t))))}_renderDirectionSection(e,t){let{stop:n,directions:r}=e,{name:i}=n,a=t===0,o=this._getStopCostDescription(e);return L(`calcite-accordion-item`,{description:o,expanded:a,heading:i??``,key:`stop-${t}`},L(`calcite-action`,{icon:`zoom-to-object`,slot:`actions-end`,text:this.messages.panToStop,title:this.messages.panToStop,onclick:this._handlePanToStopClick.bind(this,n)}),this._renderDirectionTurns(r))}_renderDirectionTurns(e){return L(`calcite-list`,{label:this.messages.drivingDirections,selectionMode:`none`},e.map((e,t)=>{let{directionPoint:n,lines:r}=e,i=r[0],{distance:a,duration:o}=i,s=O(this.messagesUnits,a??0,this.unit),c=k(o??0),l=s&&c?`${s} | ${c}`:`${s||c}`,u=R(n),d=j(n.directionPointType);return L(`calcite-list-item`,{class:w.labelNoBottomMargin,key:`driving-direction-${t}`,onCalciteListItemSelect:this._handleDirectionTurnItemSelect.bind(this,i),onpointerenter:this._handleDirectionTurnPointerEnter.bind(this,i),onpointerleave:this._handleDirectionTurnPointerLeave.bind(this)},L(`calcite-icon`,{icon:d,slot:`content-start`}),L(`div`,{slot:`content`},L(`calcite-label`,{layout:`inline`,scale:`s`},u),L(`calcite-label`,{layout:`inline`,scale:`s`},l)))}))}_renderEditNotice(){return this._editNoticeClosed?null:L(`div`,{class:w.editInformationContainer,key:w.editInformationContainer},L(`calcite-notice`,{bind:this,closable:!0,kind:`info`,open:!0,onCalciteNoticeClose:this._handleEditNoticeClose},L(`calcite-label`,{scale:`s`,slot:`message`},this.messages.editInstructions)))}_renderEditFlowItem(){return this._currentFlowItem===`edit`?L(`calcite-flow-item`,{bind:this,heading:this.messages.editRoute,headingLevel:this.headingLevel,key:`edit-flow-item`,loading:this.viewModel.state===`routing`,selected:this._currentFlowItem===`edit`,onCalciteFlowItemBack:this._handleEditFlowItemBackClick},L(`div`,{class:w.flexColumn,key:`edit-container`},this._renderEditNotice(),L(`div`,{class:w.editToolbarContainer},L(`calcite-label`,{layout:`inline`,scale:`s`},this.messages.automaticallySolve,L(`calcite-switch`,{bind:this,checked:this.viewModel.autoSolve,scale:`s`,onCalciteSwitchChange:this._handleAutoSolveChange})),L(`div`,{class:w.editToolbar},L(`calcite-action`,{bind:this,disabled:!this.viewModel.layer||this.viewModel.layer.stops.length>=this.maxStops,icon:`flag`,scale:`s`,text:this.messages.networkFeatures.stops.stop,textEnabled:!0,onclick:this._handleCreateStopClick}),L(`calcite-action`,{bind:this,icon:`line`,scale:`s`,text:this.messages.barrier,textEnabled:!0,onclick:this._handleCreatePolylineBarrierClick}),L(`calcite-action`,{bind:this,class:w.solveRoute,disabled:this.viewModel.autoSolve,icon:`refresh`,scale:`s`,text:this.messages.solve,textEnabled:!0,onclick:this._handleResolveRouteClick}))),L(`div`,{class:w.selectedFeatureContainer},L(`calcite-list`,{label:this.messages.selectedNetworkFeatures,scale:`s`,selectionMode:`none`},this.viewModel.selectedNetworkFeatures?.toArray().map((e,t)=>L(`calcite-list-item`,{description:this._getNetworkFeatureName(e),key:`network-feature-${t}`,label:e.name??e.objectId?.toString()??this.messages.unnamed},L(`calcite-action`,{icon:`trash`,slot:`actions-end`,text:this.messages.common.delete,onclick:this._handleDeleteNetworkFeatureClick.bind(this,e)}))))),L(`div`,{class:w.editFooter},this._renderEditFooterContent()))):null}_renderEditFooterContent(){return this.viewModel.lastError?this._renderErrorNotice():L(`calcite-button`,{appearance:`outline-fill`,bind:this,width:`full`,onclick:this._handleEditingDoneClick},this.messages.common.done)}_renderErrorNotice(){return L(`calcite-notice`,{icon:`exclamation-mark-circle`,kind:`danger`,open:!0},L(`calcite-label`,{class:w.labelNoBottomMargin,slot:`message`},this._getErrorDescription()))}_renderFooter(){if(!this.viewModel.layer)return L(`div`,{class:w.primaryFooter,key:`footer-missing-layer`},L(`calcite-notice`,{icon:`information`,open:!0},L(`calcite-label`,{class:w.labelNoBottomMargin,slot:`message`},this.messages.missingLayer)));if(this.viewModel.state===`unauthenticated`)return L(`div`,{class:w.primaryFooterCentered,key:`footer-sign-in`},L(`calcite-label`,null,this.messages.signInRequired),L(`calcite-button`,{bind:this,onclick:this._handleSignInClick},this.messages.common.auth.signIn));if(this.viewModel.state===`routing`)return L(`div`,{class:this.classes(w.primaryFooter,w.primaryFooterLoader),key:`footer-routing`},L(`calcite-loader`,{label:this.messages.solve,scale:`s`}));if(this.viewModel.state===`error`)return L(`div`,{class:w.primaryFooter,key:`footer-service-error`},this._renderErrorNotice());if(!this.viewModel.layer?.routeInfo)return L(`div`,{class:w.primaryFooter,key:`footer-unsolved-route`},L(`calcite-notice`,{icon:`information`,open:!0},L(`calcite-label`,{class:w.labelNoBottomMargin,slot:`message`},this.messages.directionsPlaceholder)));let e=this._getRouteCostSummary();if(!e||!this.viewModel.layer?.directionPoints)return L(`div`,{class:w.primaryFooter,key:`footer-invalid-route`},L(`calcite-notice`,{icon:`exclamation-mark-triangle`,kind:`danger`,open:!0},L(`calcite-label`,{class:w.labelNoBottomMargin,slot:`message`},this.messages.invalidRoute)));let{distance:t,duration:n}=e,{formattedEta:r}=this.viewModel;return L(`div`,{class:w.routeItem,key:`footer-directions-summary`},L(`button`,{"aria-busy":`false`,"aria-label":this.messages.viewDrivingDirections,"aria-live":`polite`,bind:this,class:w.routeItemButton,title:this.messages.viewDrivingDirections,type:`button`,onclick:this._handleViewDrivingDirectionsClick},L(`div`,{class:w.routeItemButtonContent},L(`span`,{class:w.routeItemLabel},`${n} (${t})`),L(`span`,{class:w.routeItemDescription},r)),L(`calcite-icon`,{flipRtl:!0,icon:`chevron-right`,scale:`s`})),L(`calcite-action-menu`,{label:`test`},L(`calcite-action`,{icon:`ellipsis`,key:`route-actions`,slot:`trigger`,text:`Route actions`}),this._renderRouteLayerActions()))}_renderInteractiveRouteActions(){return L(`div`,{class:w.actionContainer,key:w.actionContainer},L(`calcite-button`,{appearance:`outline`,bind:this,class:w.addStopButton,disabled:this.effectiveStops.length>=this.maxStops,iconStart:`plus`,kind:`neutral`,label:this.messages.addStop,title:this.messages.addStop,width:`half`,onclick:this._handleAddStopClick},this.messages.addStop),this.visibleElements.editRouteButton?L(`calcite-button`,{appearance:`outline`,bind:this,class:w.editRouteButton,disabled:this.viewModel.view?.type!==`2d`,iconStart:`pencil`,kind:`neutral`,label:this.messages.editRoute,title:this.messages.editRoute,width:`half`,onclick:this._handleEditRouteClick},this.messages.editRoute):null)}_renderLocateStopAction(e){if(e.name!=null||e.geometry!=null)return null;let t=this.effectiveStops.indexOf(e),n=!!this.view?.activeTool&&this.view.activeTool===this._searchTool&&this._searchTool.stop===e;return L(`calcite-action`,{active:n,icon:`crosshair`,key:`stop-location-action-${t}`,slot:`actions-end`,text:this.messages.pickALocationOnTheMap,title:this.messages.pickALocationOnTheMap,onclick:this._handleLocateStopClick.bind(this,e)})}_renderOptimizeStopOrder(){let{routeParameters:e}=this.viewModel,{findBestSequence:t,preserveFirstStop:n,preserveLastStop:r}=e;return L(`calcite-block-section`,{bind:this,class:w.optimizeSection,text:this.messages.optimizeOrder,toggleDisplay:`switch`,onCalciteBlockSectionToggle:this._handleOptimizeStopOrderToggle},t?[L(`calcite-label`,{class:w.optimizeSwitches,key:`preserve-first-stop`,layout:`inline-space-between`},this.messages.preserveFirstStop,L(`calcite-switch`,{bind:this,checked:n,scale:`s`,onCalciteSwitchChange:this._handlePreserveFirstStopChange})),L(`calcite-label`,{class:w.optimizeSwitches,key:`preserve-last-stop`,layout:`inline-space-between`},this.messages.preserveLastStop,L(`calcite-switch`,{bind:this,checked:r,scale:`s`,onCalciteSwitchChange:this._handlePreserveLastStopChange}))]:null)}_renderPrimaryFlowItem(){return L(`calcite-flow-item`,{key:`primary-flow-item`,loading:this.viewModel.state===`initializing`,selected:this._currentFlowItem===`primary`},L(`calcite-panel`,{class:w.primaryFlowItem,disabled:!this.viewModel.layer||this.viewModel.state===`unauthenticated`||this.viewModel.state===`error`&&!this.viewModel.serviceDescription},this._renderStops(),this._renderInteractiveRouteActions(),this._renderSeparator(),this._renderRouteSolveOptions()),this._renderFooter())}_renderPrintDocument(){if(!this._printPreviewDialogOpen)return null;let e=this._getRouteCostSummary();if(!this._sections||!e)return null;let{distance:t,duration:n}=e,{formattedEta:r}=this.viewModel,i=this._sections.at(0)?.stop.name??``,a=this._sections.at(-1)?.stop.name??``;return L(`dialog`,{afterCreate:this._handlePrintPreviewDialogAfterCreate,bind:this,class:w.printPreviewDialog},L(`div`,{class:w.printPreviewContent},L(`div`,{class:w.printPreviewHeader},L(`div`,{class:w.printPreviewHeaderLabel},L(`div`,{class:w.headerStops},L(`span`,null,this.messages.from),` `,L(`span`,{class:w.directionsHeaderStopName},i),L(`span`,null,this.messages.to),` `,L(`span`,{class:w.directionsHeaderStopName},a))),L(`div`,{class:this.classes(w.printPreviewHeaderButtons,w.printPreviewHideOnPrint)},L(`calcite-button`,{autofocus:!0,bind:this,class:w.printPreviewDialogPrint,iconStart:`print`,onclick:this._handlePrintPreviewDialogPrintClick},this.messages.common.print),L(`calcite-button`,{appearance:`outline`,bind:this,class:w.printPreviewDialogClose,iconStart:`x-circle`,onclick:this._handlePrintPreviewDialogCloseClick},this.messages.common.close))),L(`div`,{class:w.directionsHeader},L(`span`,null,`${n} (${t})`),r?L(`span`,null,r):null),this._sections.map((e,t)=>this._renderPrintSection(e,t))))}_renderPrintManeuver(e,t){let{directionPoint:n,lines:r}=e,{distance:i,duration:a}=r.at(0)??{},o=O(this.messagesUnits,i??0,this.unit),s=k(a??0),c=o&&s?`${o} | ${s}`:`${o||s}`,l=R(n),u=j(n.directionPointType);return L(`div`,{class:this.classes(w.flexRow,w.printPreviewAvoidPageBreak),key:`direction-${t}`},L(`calcite-icon`,{icon:u,preload:!0}),L(`div`,{class:w.flexColumn},L(`span`,null,l),L(`span`,null,c)))}_renderPrintRouteAction(e){if(!this.visibleElements.printButton)return null;let t=!this.viewModel.layer?.routeInfo;return L(`calcite-action`,{bind:this,disabled:t,icon:`print`,key:`print-route`,onclick:this._handlePrintPreviewDialogClick,...e,text:this.messages.common.print,textEnabled:!0})}_renderPrintSection({stop:e,directions:t},n){return L(`div`,{class:w.printPreviewSection,key:`section-${n}`},L(`span`,{class:w.directionsHeaderStopName},e.name??``),t.map((e,t)=>this._renderPrintManeuver(e,t)))}_renderRouteLayerActions(e){return[this._renderClearRouteAction(e),this._renderSaveLayerAction(e),this._renderSaveLayerAsAction(e),this._renderPrintRouteAction(e),this._renderViewItemDetailsAction(e)]}_renderRouteSolveOptions(){return L(`div`,{class:w.marginInlineMedium,key:`route-solve-options`},this._renderTravelModes(),this._renderDepartureTime(),this._renderDepartureTimeOptions(),this._renderOptimizeStopOrder())}_renderSaveContent(){switch(this._saveState){case`initialized`:return this._renderSaveInitialized();case`connect-to-portal`:return this._renderSaveProcessing(this.messages.identity.lblSigning);case`connect-to-portal-error`:return this._renderSaveError(this.messages.errors.authenticating);case`fetch-portal-information`:return this._renderSaveProcessing(this.messages.processing.fetching);case`fetch-portal-information-error`:return this._renderSaveError(this.messages.errors.fetching);case`save-layer`:return this._renderSaveLayerSettings();case`saving`:return this._renderSaveProcessing(this.messages.processing.saving);case`saving-error`:return this._renderSaveError(this.messages.errors.saving)}}_renderSaveError(e){return L(`calcite-panel`,{class:w.paddingMedium,key:`save-layer-error`},L(`div`,{class:w.saveError},L(`calcite-icon`,{class:w.saveErrorIcon,icon:`exclamation-mark-triangle`,scale:`l`,textLabel:this.messages.common.errorMessage}),L(`calcite-label`,{class:w.saveErrorLabel},e)),L(`calcite-button`,{appearance:`outline`,bind:this,slot:`footer-start`,width:`full`,onclick:this._handleSaveErrorCloseClick},this.messages.common.close))}_renderSaveInitialized(){return L(`calcite-panel`,{class:w.paddingMedium,key:`save-layer-initialized`})}_renderSaveFlowItem(){return this._currentFlowItem===`save`?L(`calcite-flow-item`,{bind:this,heading:this.messages.saveLayer,headingLevel:this.headingLevel,key:`save-layer-flow-item`,selected:this._currentFlowItem===`save`,onCalciteFlowItemBack:this._handleSaveFlowItemBackClick},this._renderSaveContent()):null}_renderSaveLayerAction(e){if(!this.visibleElements.saveButton)return null;let t=this.viewModel.layer,n=t?.routeInfo,r=t?.portalItem?.itemControl,i=!!n&&(r===`admin`||r===`update`);return L(`calcite-action`,{bind:this,disabled:!i,icon:`save`,key:`save-route`,onclick:this._handleSaveLayerClick,...e,text:this.messages.common.save,textEnabled:!0})}_renderSaveLayerAsAction(e){if(!this.visibleElements.saveAsButton)return null;let t=!this.viewModel.layer?.routeInfo;return L(`calcite-action`,{disabled:t,icon:`save-as`,key:`save-as-route`,onclick:()=>{this._handleSaveLayerAs()},...e,text:this.messages.common.saveAs,textEnabled:!0})}_renderSaveLayerSettings(){if(this.layer==null||this._portalFolders==null||this._portalUserName==null)return this._renderSaveInitialized();let{stops:e}=this.layer,t=`${e.at(0).name} - ${e.at(-1).name}`,n=[L(`calcite-combobox-item`,{heading:`${this._portalUserName} (${this.messages.common.home})`,key:w.folderHome,selected:!0,value:w.folderHome}),...this._portalFolders.map(e=>L(`calcite-combobox-item`,{heading:e.title??``,key:`${w.folder}-${e.id}`,value:e.id}))];return L(`calcite-panel`,{key:`save-layer-panel`},L(`div`,{class:w.paddingMedium},L(`calcite-label`,null,this.messages.layerName,L(`calcite-input`,{afterCreate:this._handleSaveLayerNameCreate,bind:this,label:this.messages.layerName,value:t})),L(`calcite-label`,null,this.messages.saveInFolder,L(`calcite-combobox`,{afterCreate:this._handleSaveLayerFolderCreate,bind:this,label:this.messages.saveInFolder,overlayPositioning:`fixed`,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled},n))),L(`calcite-button`,{bind:this,slot:`footer-start`,width:`full`,onclick:this._handleSaveLayerButtonClick},this.messages.common.save),L(`calcite-button`,{appearance:`outline`,bind:this,slot:`footer-start`,width:`full`,onclick:this._handleSaveLayerCancelClick},this.messages.common.cancel))}_renderSaveProcessing(e){return L(`calcite-panel`,{class:w.marginInlineMedium,key:`save-layer-processing`},L(`calcite-loader`,{class:w.saveProcessLoader,label:e,text:e}))}_renderSeparator(){return L(`div`,{class:w.separator})}_renderStop(e){let t=this.acquireSearch(e);e.name!=null&&(t.searchTerm=e.name);let n=this._renderLocateStopAction(e),r=this.effectiveStops.length>2&&this._renderDeleteStopAction(e);return L(`calcite-list-item`,{key:e,value:e},n,r,L(`div`,{class:w.stopItem,slot:`content`},t.render()))}_renderStops(){let e=this.displayedStops;for(let t of this._stopsToSearches.keys())e.includes(t)||this._disposeSearch(t);return L(`div`,{class:w.stopContainer,key:w.stopContainer},L(`calcite-list`,{bind:this,class:w.stopList,dragEnabled:!0,label:this.messages.widgetLabel,scale:`s`,onCalciteListOrderChange:this._handleStopListReorder},e.map(e=>this._renderStop(e))),e.length===2&&L(`calcite-action`,{bind:this,icon:`arrow-up-down`,text:this.messages.reverseStops,title:this.messages.reverseStops,onclick:this._handleReverseStopOrderClick}))}_renderTravelMode(e){let{id:t,name:n}=e;return L(`calcite-combobox-item`,{heading:n,key:t,label:n,selected:this.viewModel.selectedTravelMode?.id===t,value:e})}_renderTravelModes(){return this.viewModel.travelModes.length?L(`calcite-label`,{key:`travel-modes`},this.messages.mode,L(`calcite-combobox`,{bind:this,label:this.messages.mode,overlayPositioning:`fixed`,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:this._handleTravelModeChange},this.viewModel.travelModes.map(e=>this._renderTravelMode(e)))):null}_renderViewItemDetailsAction(e){return this.visibleElements.layerDetails?L(`calcite-action`,{bind:this,disabled:!this.viewModel.layer?.portalItem,icon:`launch`,key:`open-route-details-link`,onclick:this._handleItemDetailsClick,...e,text:this.messages.viewLayerDetails,textEnabled:!0}):null}async _solveRoute(){if(this.viewModel.updateDepartureTime(),(this.viewModel.layer?.stops.filter(({geometry:e})=>!!e).length??0)<2)this.viewModel.clearResults();else try{await this.viewModel.getDirections()}catch{}}};e([m()],B.prototype,`_editNoticeClosed`,void 0),e([m()],B.prototype,`_printPreviewDialogOpen`,void 0),e([m()],B.prototype,`_currentFlowItem`,void 0),e([m()],B.prototype,`_saveState`,void 0),e([m()],B.prototype,`_searchTool`,void 0),e([m()],B.prototype,`apiKey`,null),e([m(y)],B.prototype,`defaultUnit`,void 0),e([m()],B.prototype,`goToOverride`,null),e([m()],B.prototype,`headingLevel`,void 0),e([m()],B.prototype,`displayedStops`,null),e([m()],B.prototype,`effectiveStops`,null),e([m()],B.prototype,`icon`,null),e([m()],B.prototype,`label`,null),e([m({readOnly:!0})],B.prototype,`lastRoute`,null),e([m()],B.prototype,`layer`,null),e([m()],B.prototype,`maxStops`,null),e([m(),I(`esri/widgets/Directions/t9n/Directions`)],B.prototype,`messages`,void 0),e([m(),I(`esri/core/t9n/Units`)],B.prototype,`messagesUnits`,void 0),e([m()],B.prototype,`searchProperties`,void 0),e([m()],B.prototype,`unit`,null),e([m()],B.prototype,`view`,null),e([m({type:E})],B.prototype,`viewModel`,void 0),e([m({type:D,nonNullable:!0})],B.prototype,`visibleElements`,void 0),B=e([h(`esri.widgets.Directions`)],B);const V=B;export{V as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../core/arrayUtils.js";import n from"../core/Collection.js";import{deprecateWidget as r}from"../core/deprecate.js";import{addEventListener as i}from"../core/events.js";import{makeHandle as a}from"../core/handleUtils.js";import o from"../core/Logger.js";import{destroyMaybe as s}from"../core/maybe.js";import{debounce as c,isAbortError as l}from"../core/promiseUtils.js";import{watch as u,initial as d,on as f}from"../core/reactiveUtils.js";import{escapeRegExpString as p}from"../core/string.js";import{property as m,subclass as h}from"../core/accessorSupport/decorators.js";import{onLocaleChange as g,getLocaleLanguage as _}from"../intl/locale.js";import v from"../portal/Portal.js";import{defaultUnitPropertyMetadata as y}from"../properties/defaultUnit.js";import b from"../rest/support/Stop.js";import x from"../symbols/SimpleMarkerSymbol.js";import S from"./Search.js";import C from"./Widget.js";import{css as w}from"./Directions/css.js";import{DirectionsSearchTool as T}from"./Directions/DirectionsSearchTool.js";import E from"./Directions/DirectionsViewModel.js";import D from"./Directions/DirectionsVisibleElements.js";import{formatDistance as O,formatDuration as k,DepartureTimeOption as A,getIconName as j}from"./Directions/support/directionsUtils.js";import{isArcGISWorldGeocoder as M,meteredArcGISLocatorUrl as N}from"./Search/support/locatorUtils.js";import{loadCalciteComponents as P}from"./support/componentsUtils.js";import{globalCss as F}from"./support/globalCss.js";import{messageBundle as I,tsx as L}from"./support/widget.js";function R(e){let{branchName:n,displayText:r,exitName:i,intersectingName:a,name:o,towardName:s}=e;if(r==null)return null;let c=[n,i,a,o,s].filter(t).sort((e,t)=>t.length-e.length).map(e=>p(e));if(!c.length)return r;let l=new RegExp(c.join(`|`),`g`),u=r.matchAll(l),d=0,f=[];for(let{0:e,index:t}of u)f.push(r.slice(d,t),L(`span`,{class:w.labelEmphasize,key:`maneuver-${t}`},e)),d=t+e.length;return f.push(r.slice(d)),L(`span`,null,f)}const z=`print-preview-closed`;let B=class extends C{constructor(e,t){super(e,t),this._activeManeuver=null,this._placeholderStops=new n([new b,new b]),this._portalFolderCombobox=null,this._portalFolders=null,this._portalItemNameInput=null,this._portalUserName=null,this._printPreviewDialog=null,this._sections=null,this._stopsToSearches=new Map,this._editNoticeClosed=!1,this._printPreviewDialogOpen=!1,this._currentFlowItem=`primary`,this._parentFlowItem=`primary`,this._saveState=`initialized`,this._searchTool=null,this.headingLevel=2,this.messages=null,this.messagesUnits=null,this.searchProperties={popupEnabled:!1,resultGraphicEnabled:!1},this.viewModel=new E,this.visibleElements=new D,this._solveRouteDebounced=c(()=>this._solveRoute()),this.announceDeprecation=()=>{r(o.getLogger(this),`Directions`,`arcgis-directions`,{version:`5.0`})}}initialize(){this.addHandles([u(()=>this.viewModel.layer,()=>{this.viewModel.load().catch(()=>{})},d),u(()=>this.viewModel.layer?.routeInfo,()=>{this._sections=this._getStopSections()},d),u(()=>this.viewModel.layer?.stops.toArray(),e=>{e&&this.view?.activeTool&&this._searchTool&&this.view.activeTool===this._searchTool&&!e.includes(this._searchTool.stop)&&(this.view.tools.remove(this._searchTool),this._searchTool=null)})])}loadDependencies(){return P({accordion:()=>import(`@esri/calcite-components/dist/components/calcite-accordion`),"accordion-item":()=>import(`@esri/calcite-components/dist/components/calcite-accordion-item`),action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),"action-menu":()=>import(`@esri/calcite-components/dist/components/calcite-action-menu`),"block-section":()=>import(`@esri/calcite-components/dist/components/calcite-block-section`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),flow:()=>import(`@esri/calcite-components/dist/components/calcite-flow`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),"input-date-picker":()=>import(`@esri/calcite-components/dist/components/calcite-input-date-picker`),"input-time-picker":()=>import(`@esri/calcite-components/dist/components/calcite-input-time-picker`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),loader:()=>import(`@esri/calcite-components/dist/components/calcite-loader`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`)})}destroy(){this._stopsToSearches.forEach(s)}get apiKey(){return this.viewModel.apiKey}set apiKey(e){this.viewModel.apiKey=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get displayedStops(){return this.effectiveStops.toArray().filter(({locationType:e})=>e!==`waypoint`)}get effectiveStops(){return this.viewModel.layer?.stops??this._placeholderStops}get icon(){return`right`}set icon(e){this._overrideIfSome(`icon`,e)}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get lastRoute(){return this.viewModel.lastRoute}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxStops(){return this.viewModel.maxStops}set maxStops(e){this.viewModel.maxStops=e}get unit(){return this.defaultUnit}set unit(e){this._overrideIfSome(`unit`,e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}acquireSearch(e){let{view:t}=this.viewModel;if(this._stopsToSearches.has(e)){let n=this._stopsToSearches.get(e);return n.view=t,this._overrideDefaultSources(n),n}let n=new S({icon:``,popupEnabled:!1,resultGraphicEnabled:!1,view:t,suppressDeprecationWarning:!0,...this.searchProperties});return this._normalizeSearchSources(n),this.addHandles([f(()=>n.allSources,`change`,()=>this._normalizeSearchSources(n)),n.on(`search-clear`,()=>{e.geometry=null,e.name=null,this.viewModel.layer?.removeResult()}),n.on(`select-result`,()=>{let t=n.selectedResult;e.geometry=t?.feature.geometry,e.name=t?.name,this._solveRouteDebounced()}),u(()=>n.searchTerm,t=>{e.name=t}),g(()=>this._normalizeSearchSources(n))],n),this._stopsToSearches.set(e,n),n}getDirections(){return this.viewModel.getDirections()}render(){return L(`div`,{class:this.classes(w.base,F.widget,F.panel)},L(`calcite-flow`,null,this._renderPrimaryFlowItem(),this._renderDirectionsFlowItem(),this._renderEditFlowItem(),this._renderSaveFlowItem()),this._renderPrintDocument())}save(){return this.viewModel.save()}saveAs(e,t={}){return this.viewModel.saveAs(e,t)}zoomToRoute(){return this.viewModel.zoomToRoute()}_applyLocatorSourceOverrides({allSources:e}){for(let t of e)`url`in t&&t.url&&(t.language=_(),t.locationType??=`street`,M(t.url)&&this.apiKey&&t.apiKey==null&&(t.apiKey=this.apiKey,t.url=N))}_disposeSearch(e){if(!e||!this._stopsToSearches.has(e))return;let t=this._stopsToSearches.get(e);this.removeHandles(t),t.destroy(),this._stopsToSearches.delete(e)}_getErrorDescription(){switch(this.viewModel.lastError?.name){case`directions-view-model:unable-to-route`:return this.messages.errors.unableToRoute;case`directions-view-model:service-metadata-unavailable`:return this.messages.errors.unableToLoadServiceMetadata;default:return this.messages.errors.unknownError}}_getNetworkFeatureName(e){switch(e.type){case`stop`:switch(e.locationType){case`stop`:default:return this.messages.networkFeatures.stops.stop;case`waypoint`:return this.messages.networkFeatures.stops.waypoint;case`break`:return this.messages.networkFeatures.stops.break}case`point-barrier`:return this.messages.networkFeatures.pointBarrier;case`polyline-barrier`:return this.messages.networkFeatures.polylineBarrier;case`polygon-barrier`:return this.messages.networkFeatures.polygonBarrier}}_getRouteCostSummary(){let e=this.viewModel.layer?.routeInfo;if(!e)return null;let t=e.totalDistance??0,n=e.totalDuration??0,{messagesUnits:r,unit:i}=this;return{distance:O(r,t,i),duration:k(n)}}_getStopCostDescription(e){if(!e.directions.length)return;let{totalDistance:t,totalDuration:n}=e.directions.reduce((e,{lines:t})=>{for(let{distance:n,duration:r}of t)e.totalDistance+=n??0,e.totalDuration+=r??0;return e},{totalDistance:0,totalDuration:0}),{messagesUnits:r,unit:i}=this,a=O(r,t,i);return`${k(n)} (${a})`}_getStopSections(){if(!this.viewModel.layer)return null;let{directionPoints:e,directionLines:t,stops:n}=this.viewModel.layer;if(!e||!t)return null;let r=[],i=null;for(let a of e){let{objectId:e,stopId:o}=a;if(o!=null){let e=n.find(({objectId:e})=>e===o);i&&i.stop===e||(i={stop:e,directions:[]},r.push(i));continue}if(i==null)continue;let s=t.toArray().filter(({directionPointId:t})=>t===e);s.length!==0&&i.directions.push({directionPoint:a,lines:s})}return r}_handleAddStopClick(){let e=new x;this.viewModel.layer?.stops.add(new b({symbol:e}))}_handleAutoSolveChange({target:e}){this.viewModel.autoSolve=e.checked}_handleCreatePolylineBarrierClick(){this.viewModel.create(`polyline-barrier`)}_handleClearRouteClick(){this._currentFlowItem=`primary`,this.viewModel.reset()}_handleCreateStopClick(){this.viewModel.create(`stop`)}_handleDeleteNetworkFeatureClick(e){this.viewModel.remove(e),this.viewModel.autoSolve&&this._solveRouteDebounced()}_handleDeleteStopClick(e){this.effectiveStops.remove(e),this._disposeSearch(e),this._solveRouteDebounced()}_handleDepartureDateChange({currentTarget:{value:e}}){Array.isArray(e)||(this.viewModel.departureIsoDate=e,this._solveRouteDebounced())}_handleDepartureTimeChange({currentTarget:{value:e}}){this.viewModel.departureIsoTime=e,this._solveRouteDebounced()}_handleDepartureTimeOptionChange({currentTarget:e}){let{selectedItems:t}=e;t.length&&(this.viewModel.departureOption=t[0].value,this._solveRouteDebounced())}_handleDirectionsFlowItemBackClick(e){e.stopPropagation(),this._currentFlowItem=`primary`}_handleDirectionTurnItemSelect(e){this._activeManeuver===e?this.zoomToRoute():(this._activeManeuver=e,this.viewModel.centerAt(e.geometry))}_handleDirectionTurnPointerEnter(e){this.viewModel.highlight(e)}_handleDirectionTurnPointerLeave(){this.viewModel.clearHighlights()}_handleEditFlowItemBackClick(e){e.stopPropagation(),this.viewModel.stopEditing(),this._currentFlowItem=`primary`}_handleEditingDoneClick(){this.viewModel.stopEditing(),this._currentFlowItem=`primary`}_handleEditNoticeClose(){this._editNoticeClosed=!0}_handleEditRouteClick(){this._currentFlowItem=`edit`,this.viewModel.startEditing()}_handleItemDetailsClick(){let e=this.viewModel.layer?.portalItem;e&&window.open(`${e.portal.url}/home/item.html?id=${e.id}`,`_blank`)}_handleLocateStopClick(e){let{view:t}=this;if(!t)return;let n=`directions-search-tool`;this.removeHandles(n),this._searchTool=new T({stop:e,view:t}),this.addHandles([this._searchTool.on(`click`,async t=>{if(t.stopPropagation(),t.mapPoint&&this._stopsToSearches.has(e)){let n=this._stopsToSearches.get(e),r=(await n.search(t.mapPoint))?.results?.[0].results?.[0];if(r){let{feature:t,name:i}=r;n.searchTerm=i,e.geometry=t.geometry}}this.removeHandles(n)}),a(()=>{this._searchTool&&=(this.view?.tools.remove(this._searchTool),null)})],n),t.addAndActivateTool(this._searchTool)}_handleOptimizeStopOrderToggle({target:{expanded:e}}){this.viewModel.routeParameters.findBestSequence=e,e&&this._removeWaypoints(),this._solveRouteDebounced()}_handlePanToStopClick(e){this.viewModel.centerAt(e)}_handlePreserveFirstStopChange({target:{checked:e}}){this.viewModel.routeParameters.preserveFirstStop=e,this._solveRouteDebounced()}_handlePreserveLastStopChange({target:{checked:e}}){this.viewModel.routeParameters.preserveLastStop=e,this._solveRouteDebounced()}_handlePrintPreviewDialogAfterCreate(e){document.body.appendChild(e),e.showModal(),this._printPreviewDialog=e,this.removeHandles(z),this.addHandles([i(e,`close`,this._handlePrintPreviewDialogClosed.bind(this)),a(()=>{this._printPreviewDialog&&(document.body.removeChild(this._printPreviewDialog),this._printPreviewDialog=null,this._printPreviewDialogOpen=!1)})],z)}_handlePrintPreviewDialogClick(){this._printPreviewDialogOpen=!0}_handlePrintPreviewDialogCloseClick(){this._printPreviewDialog?.close()}_handlePrintPreviewDialogClosed(){this.removeHandles(z)}_handlePrintPreviewDialogPrintClick(){document.body.classList.add(w.printPreviewMedia),window.print(),document.body.classList.remove(w.printPreviewMedia),this._printPreviewDialog?.close()}_handleResolveRouteClick(){this._solveRouteDebounced()}_handleReverseStopOrderClick(){this._removeWaypoints(),this.effectiveStops.reverse(),this._solveRouteDebounced()}_handleSaveErrorCloseClick(){this._currentFlowItem=this._parentFlowItem}_handleSaveFlowItemBackClick(e){e.stopPropagation(),this._currentFlowItem=this._parentFlowItem}async _handleSaveLayerAs(){let e=v.getDefault();try{await e.signIn()}catch(e){if(l(e)||e.name===`identity-manager:user-aborted`)return;this._parentFlowItem=this._currentFlowItem,this._currentFlowItem=`save`,this._saveState=`connect-to-portal-error`;return}this._saveState=`fetch-portal-information`,this._parentFlowItem=this._currentFlowItem,this._currentFlowItem=`save`,this._portalUserName=e.user?.username;try{this._portalFolders=await e.user?.fetchFolders()}catch{this._saveState=`fetch-portal-information-error`;return}this._saveState=`save-layer`}_handleSaveLayerClick(){this.viewModel.layer?.save()}_handleSaveLayerButtonClick(){this._saveState=`saving`;let{layer:e}=this;if(!e||!this._portalFolders)return;let t=this._portalItemNameInput?.value,n=this._portalFolderCombobox?.value,r=this._portalFolders.find(({id:e})=>e===n);e.saveAs({title:t},{folder:r}).then(()=>{e.title=t,this._currentFlowItem=this._parentFlowItem}).catch(()=>{this._saveState=`saving-error`})}_handleSaveLayerCancelClick(){this._currentFlowItem=this._parentFlowItem}_handleSaveLayerFolderCreate(e){this._portalFolderCombobox=e}_handleSaveLayerNameCreate(e){this._portalItemNameInput=e}_handleSignInClick(){this.viewModel.load().catch(()=>{})}_handleStopListReorder({detail:{dragEl:e,newIndex:t}}){this._removeWaypoints(),this.effectiveStops.reorder(e.value,t),this._solveRouteDebounced()}_handleTravelModeChange({currentTarget:{selectedItems:e}}){e.length&&(this.viewModel.selectedTravelMode=e[0].value,this._solveRouteDebounced())}_handleViewDrivingDirectionsClick(){this._currentFlowItem=`directions`}_normalizeSearchSources(e){this._overrideDefaultSources(e),this._applyLocatorSourceOverrides(e)}_overrideDefaultSources(e){for(let t of e.viewModel.defaultSources)t.autoNavigate=!1}_removeWaypoints(){let e=this.viewModel.layer?.stops;if(e){let t=e.filter(({locationType:e})=>e===`waypoint`);e.removeMany(t)}}_renderClearRouteAction(e){return L(`calcite-action`,{bind:this,icon:`trash`,key:`clear-route`,onclick:this._handleClearRouteClick,...e,text:this.messages.common.clear,textEnabled:!0})}_renderDeleteStopAction(e){return L(`calcite-action`,{icon:`trash`,slot:`actions-end`,text:this.messages.deleteStop,title:this.messages.deleteStop,onclick:this._handleDeleteStopClick.bind(this,e)})}_renderDepartureTime(){let{DEPART_AT:e,NOW:t,UNSPECIFIED:n}=A;return L(`calcite-label`,{class:w.departureTime,key:`departure-time`},this.messages.departureTime,L(`calcite-combobox`,{bind:this,label:this.messages.departureTime,overlayPositioning:`fixed`,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:this._handleDepartureTimeOptionChange},L(`calcite-combobox-item`,{heading:this.messages.leaveNow,key:t,label:this.messages.leaveNow,selected:this.viewModel.departureOption===t,value:t}),L(`calcite-combobox-item`,{heading:this.messages.departAt,key:e,label:this.messages.departAt,selected:this.viewModel.departureOption===e,value:e}),L(`calcite-combobox-item`,{heading:this.messages.timeUnspecified,key:n,label:this.messages.timeUnspecified,selected:this.viewModel.departureOption===n,value:n})))}_renderDepartureTimeOptions(){return this.viewModel.departureOption===A.DEPART_AT?L(`div`,{class:w.departureTimeOptions},L(`calcite-input-date-picker`,{bind:this,scale:`s`,topLayerDisabled:this.topLayerDisabled,value:this.viewModel.departureIsoDate,onCalciteInputDatePickerChange:this._handleDepartureDateChange}),L(`calcite-input-time-picker`,{bind:this,scale:`s`,value:this.viewModel.departureIsoTime,onCalciteInputTimePickerClose:this._handleDepartureTimeChange})):null}_renderDirectionsFlowItem(){if(this._currentFlowItem!==`directions`)return null;let e=this._getRouteCostSummary();if(!this._sections||!e)return null;let{distance:t,duration:n}=e,{formattedEta:r}=this.viewModel,i=this._sections.at(0)?.stop.name??``,a=this._sections.at(-1)?.stop.name??``;return L(`calcite-flow-item`,{bind:this,key:`directions-flow-item`,overlayPositioning:`fixed`,selected:this._currentFlowItem===`directions`,onCalciteFlowItemBack:this._handleDirectionsFlowItemBackClick},L(`div`,{class:w.directionsHeader,slot:`header-content`},L(`div`,{class:w.headerStops},L(`span`,null,this.messages.from),` `,L(`span`,{class:w.directionsHeaderStopName},i),L(`span`,null,this.messages.to),` `,L(`span`,{class:w.directionsHeaderStopName},a)),L(`div`,{class:w.flexColumn},L(`span`,null,`${n} (${t})`),r?L(`span`,null,r):null)),this._renderRouteLayerActions({slot:`header-menu-actions`}),L(`calcite-accordion`,{class:w.accordion,iconPosition:`start`,selectionMode:`single`},this._sections.map((e,t)=>this._renderDirectionSection(e,t))))}_renderDirectionSection(e,t){let{stop:n,directions:r}=e,{name:i}=n,a=t===0,o=this._getStopCostDescription(e);return L(`calcite-accordion-item`,{description:o,expanded:a,heading:i??``,key:`stop-${t}`},L(`calcite-action`,{icon:`zoom-to-object`,slot:`actions-end`,text:this.messages.panToStop,title:this.messages.panToStop,onclick:this._handlePanToStopClick.bind(this,n)}),this._renderDirectionTurns(r))}_renderDirectionTurns(e){return L(`calcite-list`,{label:this.messages.drivingDirections,selectionMode:`none`},e.map((e,t)=>{let{directionPoint:n,lines:r}=e,i=r[0],{distance:a,duration:o}=i,s=O(this.messagesUnits,a??0,this.unit),c=k(o??0),l=s&&c?`${s} | ${c}`:`${s||c}`,u=R(n),d=j(n.directionPointType);return L(`calcite-list-item`,{class:w.labelNoBottomMargin,key:`driving-direction-${t}`,onCalciteListItemSelect:this._handleDirectionTurnItemSelect.bind(this,i),onpointerenter:this._handleDirectionTurnPointerEnter.bind(this,i),onpointerleave:this._handleDirectionTurnPointerLeave.bind(this)},L(`calcite-icon`,{icon:d,slot:`content-start`}),L(`div`,{slot:`content`},L(`calcite-label`,{layout:`inline`,scale:`s`},u),L(`calcite-label`,{layout:`inline`,scale:`s`},l)))}))}_renderEditNotice(){return this._editNoticeClosed?null:L(`div`,{class:w.editInformationContainer,key:w.editInformationContainer},L(`calcite-notice`,{bind:this,closable:!0,kind:`info`,open:!0,onCalciteNoticeClose:this._handleEditNoticeClose},L(`calcite-label`,{scale:`s`,slot:`message`},this.messages.editInstructions)))}_renderEditFlowItem(){return this._currentFlowItem===`edit`?L(`calcite-flow-item`,{bind:this,heading:this.messages.editRoute,headingLevel:this.headingLevel,key:`edit-flow-item`,loading:this.viewModel.state===`routing`,selected:this._currentFlowItem===`edit`,onCalciteFlowItemBack:this._handleEditFlowItemBackClick},L(`div`,{class:w.flexColumn,key:`edit-container`},this._renderEditNotice(),L(`div`,{class:w.editToolbarContainer},L(`calcite-label`,{layout:`inline`,scale:`s`},this.messages.automaticallySolve,L(`calcite-switch`,{bind:this,checked:this.viewModel.autoSolve,scale:`s`,onCalciteSwitchChange:this._handleAutoSolveChange})),L(`div`,{class:w.editToolbar},L(`calcite-action`,{bind:this,disabled:!this.viewModel.layer||this.viewModel.layer.stops.length>=this.maxStops,icon:`flag`,scale:`s`,text:this.messages.networkFeatures.stops.stop,textEnabled:!0,onclick:this._handleCreateStopClick}),L(`calcite-action`,{bind:this,icon:`line`,scale:`s`,text:this.messages.barrier,textEnabled:!0,onclick:this._handleCreatePolylineBarrierClick}),L(`calcite-action`,{bind:this,class:w.solveRoute,disabled:this.viewModel.autoSolve,icon:`refresh`,scale:`s`,text:this.messages.solve,textEnabled:!0,onclick:this._handleResolveRouteClick}))),L(`div`,{class:w.selectedFeatureContainer},L(`calcite-list`,{label:this.messages.selectedNetworkFeatures,scale:`s`,selectionMode:`none`},this.viewModel.selectedNetworkFeatures?.toArray().map((e,t)=>L(`calcite-list-item`,{description:this._getNetworkFeatureName(e),key:`network-feature-${t}`,label:e.name??e.objectId?.toString()??this.messages.unnamed},L(`calcite-action`,{icon:`trash`,slot:`actions-end`,text:this.messages.common.delete,onclick:this._handleDeleteNetworkFeatureClick.bind(this,e)}))))),L(`div`,{class:w.editFooter},this._renderEditFooterContent()))):null}_renderEditFooterContent(){return this.viewModel.lastError?this._renderErrorNotice():L(`calcite-button`,{appearance:`outline-fill`,bind:this,width:`full`,onclick:this._handleEditingDoneClick},this.messages.common.done)}_renderErrorNotice(){return L(`calcite-notice`,{icon:`exclamation-mark-circle`,kind:`danger`,open:!0},L(`calcite-label`,{class:w.labelNoBottomMargin,slot:`message`},this._getErrorDescription()))}_renderFooter(){if(!this.viewModel.layer)return L(`div`,{class:w.primaryFooter,key:`footer-missing-layer`},L(`calcite-notice`,{icon:`information`,open:!0},L(`calcite-label`,{class:w.labelNoBottomMargin,slot:`message`},this.messages.missingLayer)));if(this.viewModel.state===`unauthenticated`)return L(`div`,{class:w.primaryFooterCentered,key:`footer-sign-in`},L(`calcite-label`,null,this.messages.signInRequired),L(`calcite-button`,{bind:this,onclick:this._handleSignInClick},this.messages.common.auth.signIn));if(this.viewModel.state===`routing`)return L(`div`,{class:this.classes(w.primaryFooter,w.primaryFooterLoader),key:`footer-routing`},L(`calcite-loader`,{label:this.messages.solve,scale:`s`}));if(this.viewModel.state===`error`)return L(`div`,{class:w.primaryFooter,key:`footer-service-error`},this._renderErrorNotice());if(!this.viewModel.layer?.routeInfo)return L(`div`,{class:w.primaryFooter,key:`footer-unsolved-route`},L(`calcite-notice`,{icon:`information`,open:!0},L(`calcite-label`,{class:w.labelNoBottomMargin,slot:`message`},this.messages.directionsPlaceholder)));let e=this._getRouteCostSummary();if(!e||!this.viewModel.layer?.directionPoints)return L(`div`,{class:w.primaryFooter,key:`footer-invalid-route`},L(`calcite-notice`,{icon:`exclamation-mark-triangle`,kind:`danger`,open:!0},L(`calcite-label`,{class:w.labelNoBottomMargin,slot:`message`},this.messages.invalidRoute)));let{distance:t,duration:n}=e,{formattedEta:r}=this.viewModel;return L(`div`,{class:w.routeItem,key:`footer-directions-summary`},L(`button`,{"aria-busy":`false`,"aria-label":this.messages.viewDrivingDirections,"aria-live":`polite`,bind:this,class:w.routeItemButton,title:this.messages.viewDrivingDirections,type:`button`,onclick:this._handleViewDrivingDirectionsClick},L(`div`,{class:w.routeItemButtonContent},L(`span`,{class:w.routeItemLabel},`${n} (${t})`),L(`span`,{class:w.routeItemDescription},r)),L(`calcite-icon`,{flipRtl:!0,icon:`chevron-right`,scale:`s`})),L(`calcite-action-menu`,{label:`test`},L(`calcite-action`,{icon:`ellipsis`,key:`route-actions`,slot:`trigger`,text:`Route actions`}),this._renderRouteLayerActions()))}_renderInteractiveRouteActions(){return L(`div`,{class:w.actionContainer,key:w.actionContainer},L(`calcite-button`,{appearance:`outline`,bind:this,class:w.addStopButton,disabled:this.effectiveStops.length>=this.maxStops,iconStart:`plus`,kind:`neutral`,label:this.messages.addStop,title:this.messages.addStop,width:`half`,onclick:this._handleAddStopClick},this.messages.addStop),this.visibleElements.editRouteButton?L(`calcite-button`,{appearance:`outline`,bind:this,class:w.editRouteButton,disabled:this.viewModel.view?.type!==`2d`,iconStart:`pencil`,kind:`neutral`,label:this.messages.editRoute,title:this.messages.editRoute,width:`half`,onclick:this._handleEditRouteClick},this.messages.editRoute):null)}_renderLocateStopAction(e){if(e.name!=null||e.geometry!=null)return null;let t=this.effectiveStops.indexOf(e),n=!!this.view?.activeTool&&this.view.activeTool===this._searchTool&&this._searchTool.stop===e;return L(`calcite-action`,{active:n,icon:`crosshair`,key:`stop-location-action-${t}`,slot:`actions-end`,text:this.messages.pickALocationOnTheMap,title:this.messages.pickALocationOnTheMap,onclick:this._handleLocateStopClick.bind(this,e)})}_renderOptimizeStopOrder(){let{routeParameters:e}=this.viewModel,{findBestSequence:t,preserveFirstStop:n,preserveLastStop:r}=e;return L(`calcite-block-section`,{bind:this,class:w.optimizeSection,text:this.messages.optimizeOrder,toggleDisplay:`switch`,onCalciteBlockSectionToggle:this._handleOptimizeStopOrderToggle},t?[L(`calcite-label`,{class:w.optimizeSwitches,key:`preserve-first-stop`,layout:`inline-space-between`},this.messages.preserveFirstStop,L(`calcite-switch`,{bind:this,checked:n,scale:`s`,onCalciteSwitchChange:this._handlePreserveFirstStopChange})),L(`calcite-label`,{class:w.optimizeSwitches,key:`preserve-last-stop`,layout:`inline-space-between`},this.messages.preserveLastStop,L(`calcite-switch`,{bind:this,checked:r,scale:`s`,onCalciteSwitchChange:this._handlePreserveLastStopChange}))]:null)}_renderPrimaryFlowItem(){return L(`calcite-flow-item`,{key:`primary-flow-item`,loading:this.viewModel.state===`initializing`,selected:this._currentFlowItem===`primary`},L(`calcite-panel`,{class:w.primaryFlowItem,disabled:!this.viewModel.layer||this.viewModel.state===`unauthenticated`||this.viewModel.state===`error`&&!this.viewModel.serviceDescription},this._renderStops(),this._renderInteractiveRouteActions(),this._renderSeparator(),this._renderRouteSolveOptions()),this._renderFooter())}_renderPrintDocument(){if(!this._printPreviewDialogOpen)return null;let e=this._getRouteCostSummary();if(!this._sections||!e)return null;let{distance:t,duration:n}=e,{formattedEta:r}=this.viewModel,i=this._sections.at(0)?.stop.name??``,a=this._sections.at(-1)?.stop.name??``;return L(`dialog`,{afterCreate:this._handlePrintPreviewDialogAfterCreate,bind:this,class:w.printPreviewDialog},L(`div`,{class:w.printPreviewContent},L(`div`,{class:w.printPreviewHeader},L(`div`,{class:w.printPreviewHeaderLabel},L(`div`,{class:w.headerStops},L(`span`,null,this.messages.from),` `,L(`span`,{class:w.directionsHeaderStopName},i),L(`span`,null,this.messages.to),` `,L(`span`,{class:w.directionsHeaderStopName},a))),L(`div`,{class:this.classes(w.printPreviewHeaderButtons,w.printPreviewHideOnPrint)},L(`calcite-button`,{autofocus:!0,bind:this,class:w.printPreviewDialogPrint,iconStart:`print`,onclick:this._handlePrintPreviewDialogPrintClick},this.messages.common.print),L(`calcite-button`,{appearance:`outline`,bind:this,class:w.printPreviewDialogClose,iconStart:`x-circle`,onclick:this._handlePrintPreviewDialogCloseClick},this.messages.common.close))),L(`div`,{class:w.directionsHeader},L(`span`,null,`${n} (${t})`),r?L(`span`,null,r):null),this._sections.map((e,t)=>this._renderPrintSection(e,t))))}_renderPrintManeuver(e,t){let{directionPoint:n,lines:r}=e,{distance:i,duration:a}=r.at(0)??{},o=O(this.messagesUnits,i??0,this.unit),s=k(a??0),c=o&&s?`${o} | ${s}`:`${o||s}`,l=R(n),u=j(n.directionPointType);return L(`div`,{class:this.classes(w.flexRow,w.printPreviewAvoidPageBreak),key:`direction-${t}`},L(`calcite-icon`,{icon:u,preload:!0}),L(`div`,{class:w.flexColumn},L(`span`,null,l),L(`span`,null,c)))}_renderPrintRouteAction(e){if(!this.visibleElements.printButton)return null;let t=!this.viewModel.layer?.routeInfo;return L(`calcite-action`,{bind:this,disabled:t,icon:`print`,key:`print-route`,onclick:this._handlePrintPreviewDialogClick,...e,text:this.messages.common.print,textEnabled:!0})}_renderPrintSection({stop:e,directions:t},n){return L(`div`,{class:w.printPreviewSection,key:`section-${n}`},L(`span`,{class:w.directionsHeaderStopName},e.name??``),t.map((e,t)=>this._renderPrintManeuver(e,t)))}_renderRouteLayerActions(e){return[this._renderClearRouteAction(e),this._renderSaveLayerAction(e),this._renderSaveLayerAsAction(e),this._renderPrintRouteAction(e),this._renderViewItemDetailsAction(e)]}_renderRouteSolveOptions(){return L(`div`,{class:w.marginInlineMedium,key:`route-solve-options`},this._renderTravelModes(),this._renderDepartureTime(),this._renderDepartureTimeOptions(),this._renderOptimizeStopOrder())}_renderSaveContent(){switch(this._saveState){case`initialized`:return this._renderSaveInitialized();case`connect-to-portal`:return this._renderSaveProcessing(this.messages.identity.lblSigning);case`connect-to-portal-error`:return this._renderSaveError(this.messages.errors.authenticating);case`fetch-portal-information`:return this._renderSaveProcessing(this.messages.processing.fetching);case`fetch-portal-information-error`:return this._renderSaveError(this.messages.errors.fetching);case`save-layer`:return this._renderSaveLayerSettings();case`saving`:return this._renderSaveProcessing(this.messages.processing.saving);case`saving-error`:return this._renderSaveError(this.messages.errors.saving)}}_renderSaveError(e){return L(`calcite-panel`,{class:w.paddingMedium,key:`save-layer-error`},L(`div`,{class:w.saveError},L(`calcite-icon`,{class:w.saveErrorIcon,icon:`exclamation-mark-triangle`,scale:`l`,textLabel:this.messages.common.errorMessage}),L(`calcite-label`,{class:w.saveErrorLabel},e)),L(`calcite-button`,{appearance:`outline`,bind:this,slot:`footer-start`,width:`full`,onclick:this._handleSaveErrorCloseClick},this.messages.common.close))}_renderSaveInitialized(){return L(`calcite-panel`,{class:w.paddingMedium,key:`save-layer-initialized`})}_renderSaveFlowItem(){return this._currentFlowItem===`save`?L(`calcite-flow-item`,{bind:this,heading:this.messages.saveLayer,headingLevel:this.headingLevel,key:`save-layer-flow-item`,selected:this._currentFlowItem===`save`,onCalciteFlowItemBack:this._handleSaveFlowItemBackClick},this._renderSaveContent()):null}_renderSaveLayerAction(e){if(!this.visibleElements.saveButton)return null;let t=this.viewModel.layer,n=t?.routeInfo,r=t?.portalItem?.itemControl,i=!!n&&(r===`admin`||r===`update`);return L(`calcite-action`,{bind:this,disabled:!i,icon:`save`,key:`save-route`,onclick:this._handleSaveLayerClick,...e,text:this.messages.common.save,textEnabled:!0})}_renderSaveLayerAsAction(e){if(!this.visibleElements.saveAsButton)return null;let t=!this.viewModel.layer?.routeInfo;return L(`calcite-action`,{disabled:t,icon:`save-as`,key:`save-as-route`,onclick:()=>{this._handleSaveLayerAs()},...e,text:this.messages.common.saveAs,textEnabled:!0})}_renderSaveLayerSettings(){if(this.layer==null||this._portalFolders==null||this._portalUserName==null)return this._renderSaveInitialized();let{stops:e}=this.layer,t=`${e.at(0).name} - ${e.at(-1).name}`,n=[L(`calcite-combobox-item`,{heading:`${this._portalUserName} (${this.messages.common.home})`,key:w.folderHome,selected:!0,value:w.folderHome}),...this._portalFolders.map(e=>L(`calcite-combobox-item`,{heading:e.title??``,key:`${w.folder}-${e.id}`,value:e.id}))];return L(`calcite-panel`,{key:`save-layer-panel`},L(`div`,{class:w.paddingMedium},L(`calcite-label`,null,this.messages.layerName,L(`calcite-input`,{afterCreate:this._handleSaveLayerNameCreate,bind:this,label:this.messages.layerName,value:t})),L(`calcite-label`,null,this.messages.saveInFolder,L(`calcite-combobox`,{afterCreate:this._handleSaveLayerFolderCreate,bind:this,label:this.messages.saveInFolder,overlayPositioning:`fixed`,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled},n))),L(`calcite-button`,{bind:this,slot:`footer-start`,width:`full`,onclick:this._handleSaveLayerButtonClick},this.messages.common.save),L(`calcite-button`,{appearance:`outline`,bind:this,slot:`footer-start`,width:`full`,onclick:this._handleSaveLayerCancelClick},this.messages.common.cancel))}_renderSaveProcessing(e){return L(`calcite-panel`,{class:w.marginInlineMedium,key:`save-layer-processing`},L(`calcite-loader`,{class:w.saveProcessLoader,label:e,text:e}))}_renderSeparator(){return L(`div`,{class:w.separator})}_renderStop(e){let t=this.acquireSearch(e);e.name!=null&&(t.searchTerm=e.name);let n=this._renderLocateStopAction(e),r=this.effectiveStops.length>2&&this._renderDeleteStopAction(e);return L(`calcite-list-item`,{key:e,value:e},n,r,L(`div`,{class:w.stopItem,slot:`content`},t.render()))}_renderStops(){let e=this.displayedStops;for(let t of this._stopsToSearches.keys())e.includes(t)||this._disposeSearch(t);return L(`div`,{class:w.stopContainer,key:w.stopContainer},L(`calcite-list`,{bind:this,class:w.stopList,dragEnabled:!0,label:this.messages.widgetLabel,scale:`s`,onCalciteListOrderChange:this._handleStopListReorder},e.map(e=>this._renderStop(e))),e.length===2&&L(`calcite-action`,{bind:this,icon:`arrow-up-down`,text:this.messages.reverseStops,title:this.messages.reverseStops,onclick:this._handleReverseStopOrderClick}))}_renderTravelMode(e){let{id:t,name:n}=e;return L(`calcite-combobox-item`,{heading:n,key:t,label:n,selected:this.viewModel.selectedTravelMode?.id===t,value:e})}_renderTravelModes(){return this.viewModel.travelModes.length?L(`calcite-label`,{key:`travel-modes`},this.messages.mode,L(`calcite-combobox`,{bind:this,label:this.messages.mode,overlayPositioning:`fixed`,selectionMode:`single-persist`,topLayerDisabled:this.topLayerDisabled,onCalciteComboboxChange:this._handleTravelModeChange},this.viewModel.travelModes.map(e=>this._renderTravelMode(e)))):null}_renderViewItemDetailsAction(e){return this.visibleElements.layerDetails?L(`calcite-action`,{bind:this,disabled:!this.viewModel.layer?.portalItem,icon:`launch`,key:`open-route-details-link`,onclick:this._handleItemDetailsClick,...e,text:this.messages.viewLayerDetails,textEnabled:!0}):null}async _solveRoute(){if(this.viewModel.updateDepartureTime(),(this.viewModel.layer?.stops.filter(({geometry:e})=>!!e).length??0)<2)this.viewModel.clearResults();else try{await this.viewModel.getDirections()}catch{}}};e([m()],B.prototype,`_editNoticeClosed`,void 0),e([m()],B.prototype,`_printPreviewDialogOpen`,void 0),e([m()],B.prototype,`_currentFlowItem`,void 0),e([m()],B.prototype,`_saveState`,void 0),e([m()],B.prototype,`_searchTool`,void 0),e([m()],B.prototype,`apiKey`,null),e([m(y)],B.prototype,`defaultUnit`,void 0),e([m()],B.prototype,`goToOverride`,null),e([m()],B.prototype,`headingLevel`,void 0),e([m()],B.prototype,`displayedStops`,null),e([m()],B.prototype,`effectiveStops`,null),e([m()],B.prototype,`icon`,null),e([m()],B.prototype,`label`,null),e([m({readOnly:!0})],B.prototype,`lastRoute`,null),e([m()],B.prototype,`layer`,null),e([m()],B.prototype,`maxStops`,null),e([m(),I(`esri/widgets/Directions/t9n/Directions`)],B.prototype,`messages`,void 0),e([m(),I(`esri/core/t9n/Units`)],B.prototype,`messagesUnits`,void 0),e([m()],B.prototype,`searchProperties`,void 0),e([m()],B.prototype,`unit`,null),e([m()],B.prototype,`view`,null),e([m({type:E})],B.prototype,`viewModel`,void 0),e([m({type:D,nonNullable:!0})],B.prototype,`visibleElements`,void 0),B=e([h(`esri.widgets.Directions`)],B);const V=B;export{V as default};
|
|
@@ -5,6 +5,7 @@ import type { SystemOrLengthUnit } from "../../core/units.js";
|
|
|
5
5
|
import type { LinearMeasurement, MeasurementState } from "../types.js";
|
|
6
6
|
import type { SnappingOptionsProperties } from "../../views/interactive/snapping/SnappingOptions.js";
|
|
7
7
|
|
|
8
|
+
/** @deprecated since 5.2. Use the [Distance Measurement 2D component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-distance-measurement-2d/) directly or [DistanceMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/DistanceMeasurementAnalysis/) instead. */
|
|
8
9
|
export interface DistanceMeasurement2DViewModelProperties extends Partial<Pick<DistanceMeasurement2DViewModel, "view">> {
|
|
9
10
|
/**
|
|
10
11
|
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/snapping/SnappingOptions/) for sketching.
|
|
@@ -47,7 +48,7 @@ export interface DistanceMeasurement2DViewModelProperties extends Partial<Pick<D
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
/**
|
|
50
|
-
* Provides the logic for the [DistanceMeasurement2D](https://developers.arcgis.com/javascript/latest/references/core/widgets/DistanceMeasurement2D/) widget
|
|
51
|
+
* Provides the logic for the [DistanceMeasurement2D](https://developers.arcgis.com/javascript/latest/references/core/widgets/DistanceMeasurement2D/) widget.
|
|
51
52
|
*
|
|
52
53
|
* @deprecated since version 5.2. Use the [Distance Measurement 2D component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-distance-measurement-2d/) directly or [DistanceMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/DistanceMeasurementAnalysis/) instead.
|
|
53
54
|
* @since 4.10
|
|
@@ -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/Collection.js";import r from"../../core/Error.js";import{makeHandle as i,handlesGroup as a,abortHandle as o}from"../../core/handleUtils.js";import"../../core/has.js";import s from"../../core/Logger.js";import{removeMaybe as c,destroyMaybe as l}from"../../core/maybe.js";import{isPromiseLike as u,debounce as d}from"../../core/promiseUtils.js";import{whenOnce as f,watch as p,initial as m,sync as h,syncAndInitial as g}from"../../core/reactiveUtils.js";import{generateBracedUUID as _}from"../../core/uuid.js";import{property as v,subclass as y}from"../../core/accessorSupport/decorators.js";import{isSharedTemplateOrMetadata as b,isSharedTemplate as x,getCreationAttributes as S,isStandardFeatureTemplate as C}from"../../editing/templateUtils.js";import{getFullTemplate as w}from"../../editing/sharedTemplates/templateLoader.js";import T from"../../layers/GraphicsLayer.js";import{isSceneLayer as E,isTable as D}from"../../layers/support/layerUtils.js";import{isNumber as ee}from"../../support/guards.js";import{getDisplayedSymbol as O}from"../../symbols/support/symbolUtils.js";import{updateGraphicSymbolWhenRequired as k}from"../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as A}from"../../views/draw/support/helpMessageUtils.js";import j from"../../views/draw/support/HighlightHelper.js";import M from"../../views/interactive/sketch/SketchOptions.js";import te from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as ne}from"../../views/support/HighlightDefaults.js";import re from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import ie from"./CreateFeaturesWorkflowData.js";import{isModelUpload as N,handleModelUpload as ae}from"./modelUploadUtils.js";import P from"./Workflow.js";import{activeSketchToolDrawsUnsupportedCurve as F,createToolFromGeometryType as I,containsUnsupportedCurve as L,findEditorItemForLayer as R,getServiceEditsFromWorkflowData as z,getServiceInfoForLayer as B,orderEditsByRelationshipDependencies as V,getServiceLayersById as H,startCreatingNewFeature as U,syncUpdateOptions as W,findLayerInfo as G,handleFormValuesChangeEvent as K,isTerminalUpdateEventType as q,getVisualVariableAttributes as J,startUpdatingFeatureGeometry as oe,createWorkflowSteps as se,avoidFeatureTemplateSelectionWithOnlyOneItem as ce,setUpSketchCreateWatchers as le,setRelationshipFields as ue,showProgressCursor as de,setVisualVariablesAndElevationInfoForUpdate as fe,visualVariableInteractiveUpdate as pe}from"./workflowUtils.js";import{makeServiceEditsWithAttachments as me,makeEditsWithAttachments as he,parseEditResultsAndCollectAddAttachmentData as ge}from"./support/attachmentUtils.js";import _e from"../Sketch/SketchViewModel.js";var Y;const ve=Symbol(),X=Symbol(),Z=Symbol(),Q=Symbol(),ye={point:[`point`],multipoint:[`multipoint`],polygon:[`polygon`,`freehandPolygon`,`rectangle`,`circle`],polyline:[`polyline`,`freehandPolyline`],mesh:[],multipatch:[]};let $=Y=class extends P{constructor(e){super(e),this.type=`create-features`,this.createFeatureState=`create-new`,this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._formViewModel=new re({attachmentsEnabled:!0}),this._sketchLayer=null,this._sketchViewModel=null,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get allowSave(){return!this.updating}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPendingEdits(){if(this.pendingFeatures.some(e=>!!this.data.getEditsForPendingFeature(e)?.modified))return!0;let{creationInfo:e,upload:t}=this.data,{activeComponent:n,createGraphic:r}=this._sketchViewModel,i=r?.geometry?.type;return!!((i===`polyline`||i===`polygon`||i===`multipoint`)&&(n?.type===`draw-2d`||n?.type===`draw-3d`)&&n.drawOperation.committedVertices.length>0||t&&(t.state===`pending`||t.state===`success`)||e?.geometryToPlace)}get hasPreviousStep(){return this.formViewModel.canGoBack||this._stepIndex>0||this.createFeatureState===`update-pending`&&!!this.data.selectedPendingFeature&&!this.parent&&!N(this.data.creationInfo)}get helpMessage(){let{creationInfo:e,viewModel:t}=this.data;if(this.stepId!==`creating-features`||!e)return;let{_sketchViewModel:n}=this,{drawTool:r,isUsingLegacyCreateTools:i}=n;if(!i)return r?.helpMessageKey??`noTool`;let a=e.layer.geometryType,o=n.createGraphic;if(a===`mesh`){this._getDrawMeshHelpMessage||import(`../../views/draw/support/helpMessageUtils3d.js`).then(e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage});let{view:e}=t;return e?.type===`3d`?this._getDrawMeshHelpMessage?.(o,e):void 0}let{activeCreateToolDrawMode:s,activeTool:c}=n;return A(c===`rectangle`||c===`circle`?c:a,o?.geometry,s)}get noticeMessage(){if(F(this._sketchViewModel,this.data.editorItem))return`curveToolDensifyWarning`}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter(e=>this.data.isDisplayable(e)).length}get parent(){return this.data.parent}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return this.numPendingFeatures===0}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get saveActionLabel(){return`create`}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchUpdateOptions(){let{editorItem:e}=this.data;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!E(e?.layer)&&!!e?.capabilities.supportsTrueCurve}}}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){let e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e||this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(b(this.data.fullTemplate)){let{tool:t}=I(e,this.data.fullTemplate);return[t]}return t?.type!==`2d`&&e===`multipoint`?[]:[...ye[e]]}getUpdating(){return!!this._sketchViewModel?.updating}async enter(){this._isActive=!0,this.stepId!==`awaiting-feature-creation-info`&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([Z])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),D(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(e){let{formViewModel:t}=this;if(t.pendingSubtypeChoice)return;await t.submit(),this._stashValidationState();let n=this.data.selectedPendingFeature,r=this._hasValidationErrors(n)?n:this.data.pendingFeatures.find(e=>this._hasValidationErrors(e));if(r){await this._startUpdating({feature:r}),await t?.submit();return}let{pendingFeatures:i,editorItem:a}=this.data;return a&&e&&L(i.toArray(),a)&&!await e(`curveEditingDensifyPrompt`)?this.reset():super.save()}back(e){return this._formViewModel.canGoBack?this._formViewModel.goBack():this.createFeatureState===`update-pending`&&this.data.selectedPendingFeature&&!N(this.data.creationInfo)&&!this.parent?this._clearSelectedFeature():super.back(e)}previous(e){return this._formViewModel.canGoBack?this._formViewModel.goBack():this.createFeatureState===`update-pending`&&this.data.selectedPendingFeature&&!N(this.data.creationInfo)?this._clearSelectedFeature():super.previous(e)}cancelFeature(e){this.data.isSharedTemplateWorkflow?s.getLogger(this).warn(`Cannot cancel individual features created by shared templates.`):(this.data.removePendingFeature(e),this.sketchViewModel.removeGraphic(e))}static create(e){let{applyEdits:t,applyEditsFeatureService:n,addAttachmentsCallback:r,isNested:i,creationInfo:a,parent:o,snappingManager:s,startAt:c,viewModel:l}=e,u=e.sketchOptions??new M,d=a?.layer,f=d?R(l.editorItems,d):void 0,p=new Y({data:new ie({creationInfo:a,editorItem:f,parent:o,sketchOptions:u,snappingManager:s,viewModel:l}),isNested:i,onCommit:async e=>{let{creationInfo:i}=e;if(!i)return;p._sketchViewModel.cancel();let a=e.pendingFeatures.toArray(),{layer:o}=i,s=o.capabilities?.editing.supportsGlobalId&&`globalIdField`in o,{fullTemplate:c}=e,u=z(p.data),d=x(c)&&u;if(s){if(Se(a),d){let t=me(u,e),r=await B(o,l.view)?.load();r&&(t=V({edits:t,serviceInfo:r,view:l.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await n(c.featureService,t,{globalIdUsed:!0,honorSequenceOfEdits:!0,gdbVersion:c.layer.gdbVersion??void 0})}else await t(o,he(a,e),{globalIdUsed:!0});return}let f=d?await n(c.featureService,u,{gdbVersion:c.layer.gdbVersion??void 0}):[await t(o,{addFeatures:a})];f?.length&&e.attachmentsModified&&!s&&await Promise.all(f.map(t=>{if(!t?.addFeatureResults)return;let n=ge(a,t.addFeatureResults,o,e);return r(o,n)}))}});return p._set(`steps`,this._createWorkflowSteps(p,c)),p}_fadeExistingFeatures(e){if(`effect`in e){let t=e.effect;return e.effect=`saturate(0.6) opacity(0.8)`,i(()=>e.effect=t)}let t=e.opacity;return e.opacity=.7,i(()=>e.opacity=t)}async _initializeFullTemplateAndExecutorInfo(e){let{creationInfo:t}=e,{view:n}=e.viewModel;if(!t||!n)return null;let r=await w(n,t.template);if(e.fullTemplate=r,r&&x(r)){let{createTemplateExecutor:i}=await import(`../../editing/sharedTemplates/executor/createTemplateExecutor.js`);e.templateExecutorInfo={completionResults:[],executor:await i(r),serviceLayersById:H(t.layer,n)}}return r}async _startCreating(){this.removeHandles(X);let{data:e}=this;if(!e.creationInfo)return;let t=this.data.creationInfo?.maxFeatures;t&&this.numPendingFeatures>=t?(this.sketchViewModel.cancel(),this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)})):(this.createFeatureState=`create-new`,await U(this._sketchViewModel,this._sketchLayer,e))}async _clearSelectedFeature(){let e=this._formViewModel.pendingSubtypeChoice;e&&(e.resolve(`undo`),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=c(this._featureFormHandle),this._formViewModel.features=new n,this._formViewModel.activeFeatureIndex=-1}_stashValidationState(){let e=this._formViewModel.activeFeature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._formViewModel.valid)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();let{data:r,pendingFeatures:i}=this;i.includes(e)||r.addPendingFeature(e,t),r.selectedPendingFeature=e;let{_formViewModel:o,_sketchViewModel:s,sketchUpdateOptions:l}=this,{creationInfo:u,viewModel:d}=r,{layerInfos:m,view:h}=d;if(!h||!u)return;W(s,l),c(this._featureFormHandle);let g=e.sourceLayer,_=G(m,g),v=h.spatialReference;o.set({editType:`INSERT`,features:new n([e]),activeFeatureIndex:0,layerInfos:_?[_]:null,spatialReference:v,view:h}),await f(()=>o.updating===!1),await k(e,h.type===`2d`?h.scale:null);let y=r.getEditsForPendingFeature(e);y?.attachmentsModified&&o.applyStashedAttachmentEdits(y.attachmentEdits),this._featureFormHandle=a([o.on(`values-change`,K({filter:e=>e===y?.feature,forEachValueChange:(e,t)=>{if(ee(t)){let n=this._visualVariableAttributes;n.size&&!n.size.isUpdatingInteractively&&e===n.size.field&&n.size.setInitialValue(t),n.rotation&&!n.rotation.isUpdatingInteractively&&e===n.rotation.field&&n.rotation.setInitialValue(t)}},forEachFeature:e=>{y?.updateAttributes(o.getValues(e)),k(e,h.type===`2d`?h.scale:null)}})),o.on(`attachments-change`,e=>y?.setAttachmentEdits(e.attachmentEdits)),s.on([`update`,`undo`,`redo`],t=>{(t.type===`undo`||t.type===`redo`||t.type===`update`&&t.toolEventInfo!=null&&q(t.toolEventInfo.type))&&o.notifyGeometriesChanged([e])}),p(()=>o.activeFeature?.sourceLayer,t=>e.sourceLayer=t),p(()=>[o.activeFeature,o.valid],()=>this._stashValidationState())]),this.createFeatureState=`update-pending`}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});let{_sketchLayer:n,_sketchViewModel:r,data:i}=this,{creationInfo:a,viewModel:o}=i,{view:s}=o;if(!s||!a)return;let c=e.sourceLayer??a.layer;if(!D(c))return this._visualVariableAttributes=J(e),oe({graphic:e,sketchLayer:n,sketchViewModel:r,sourceLayer:c,updateOptions:this.sketchUpdateOptions,visualVariables:this._visualVariableAttributes})}static _createWorkflowSteps(e,t=`awaiting-feature-creation-info`){let{data:n}=e,r=n.creationInfo?.layer,i=se([`awaiting-feature-creation-info`,`creating-features`,`adding-attachment`,`editing-attachment`],t,{"awaiting-feature-creation-info":()=>({id:`awaiting-feature-creation-info`,async setUp(){let{creationInfo:t,viewModel:i}=n,{view:a}=i;a&&(N(t)?e.addHandles(await ae({view:a,data:n,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(r&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(r),this.id),e.addHandles(i.featureTemplatesViewModel.on(`select`,({item:t})=>{t&&(n.creationInfo={...n.creationInfo,layer:t.layer,template:t.template},e.next())}),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:`creating-features`,async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){t.canceled&&e.removeHandles([Z,ve,X,Q])}}),"adding-attachment":()=>({id:`adding-attachment`,parent:`creating-features`,async setUp(){},async tearDown(){}}),"editing-attachment":()=>({id:`editing-attachment`,parent:`creating-features`,async setUp(){},async tearDown(){}})});return ce(n,i)}static _configureSketchViewModel(e){let{data:t,_sketchLayer:n,_sketchViewModel:r}=e,{creationInfo:o,viewModel:s}=t,{view:c}=s,l=[];if(!c)return i();if(c.type===`2d`){o&&l.push(e._fadeExistingFeatures(o.layer));let t=d((e,t)=>Promise.all(e.map(e=>k(e,t))));l.push(p(()=>c.scale,e=>t(n.graphics,e)))}let u=S(t.fullTemplate,o?.attributeOverrides,o?.layer),f=p(()=>r.createGraphic&&r.activeComponent,()=>{r.createGraphic&&r.activeComponent&&!e.hasHandles(X)&&e._updatingHandles.consumePromise(le({creationAttributes:u,data:t,sketchViewModel:r,view:c}).then(t=>e.addHandles(t,X)))}),m=async t=>{if((t.state===`cancel`||t.state===`complete`)&&e.removeHandles(X),t.state===`cancel`&&c.activeTool!==null&&c.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),t.state===`complete`&&t.graphic){let n=await e._processEdits(t.graphic,{scale:c.type===`2d`?c.scale:null,useSourceLayer:!0});n&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:n}))}},h=async i=>{let{_formViewModel:a}=e;if(i.graphics.length>1){await e._clearSelectedFeature();return}let s=i.graphics[0];if(i.state===`complete`){if((e.numPendingFeatures===o?.maxFeatures||!a.valid)&&a.activeForm.touchAll(),await e._clearSelectedFeature(),e.data.selectedPendingFeature==null&&(c.activeTool==null||c.activeTool===e.sketchViewModel.activeComponent)&&(await e.sketchViewModel.wait(),e.sketchViewModel.state===`ready`&&e.data.creationInfo?.layer.geometryType!==`mesh`))return e._startCreating()}else if(i.state===`start`)return s.sourceLayer??=t.creationInfo?.layer,await fe({graphic:s,sketchLayer:n,sketchViewModel:r,visualVariables:e._visualVariableAttributes,sourceLayer:s.sourceLayer}),e._selectFeatureForUpdate({feature:s});else if(i.state===`active`){await e.updatePendingFeature(s);let t=e._visualVariableAttributes;pe(c,s,i,t)&&await k(s,c.type===`2d`?c.scale:null);let n=s.attributes,{rotation:r,size:o}=t;if(r!=null){let{field:t}=r;e._updatingHandles.consumePromise(a.setFieldValue(t,n[t]))}if(o!=null){let{field:t}=o;e._updatingHandles.consumePromise(a.setFieldValue(t,n[t]))}}},g=async n=>{if(n.graphics.forEach(e=>{t.removePendingFeature(e)}),!N(t.creationInfo))return e._startCreating()},_=async()=>{if(N(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};l.push(f,r.on(`create`,t=>e._updatingHandles.addPromise(m(t))),r.on(`update`,t=>e._updatingHandles.addPromise(h(t))),r.on(`delete`,t=>e._updatingHandles.addPromise(g(t))),e._updatingHandles.addWhen(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(_())),i(()=>{r.cancel()}),be(r,n,t),...xe(t));let v=a(l);return r.addHandles(v),v}_initializeSketchViewModel(){let{data:e}=this,{view:t}=e.viewModel,n=new T({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:`hide`,title:`createFeaturesWorkflow-internal`}),r=new _e({layer:n,creationMode:`single`,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:t});this._sketchLayer=n,this._sketchViewModel=r,t?.map.add(n),this.addHandles([i(()=>{t?.destroyed||t?.map.remove(n),l(n)}),p(()=>this.numPendingFeatures>0,e=>this._sketchViewModel.updateOnGraphicClick=e,m),p(()=>this.sketchUpdateOptions,e=>{r.defaultUpdateOptions=e,W(r,e)},h)])}_hasValidationErrors(e){return e?!this.data.isSubmittable(e):!1}async _processEdits(e,t){let{data:r,_formViewModel:i,_sketchLayer:a}=this,{layerInfos:o,view:s}=r.viewModel;i.editType=`INSERT`,i.spatialReference=s?.spatialReference,i.view=s;let{templateExecutorInfo:c}=r;if(!c){let t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}a.remove(e);let{executor:l}=c,d=l(e.geometry,`completion`),p=u(d)?await d:d;c.completionResults.push(p),ue(p.relationships),i.editType=`INSERT`,i.spatialReference=s?.spatialReference,i.view=s,p.primary&&r.creationInfo?.attributeOverrides&&(p.primary.graphic.attributes={...p.primary.graphic.attributes,...r.creationInfo.attributeOverrides});for(let e of p.edits){let n=null;if(e.addFeatures)for(let r of e.addFeatures){let e=r.clone();e.geometry=null,r.geometry!=null&&(r.symbol=await O(r,t),a.add(r)),r.sourceLayer!==n?.layer&&(n=G(o,r.sourceLayer));let i=!!p.associationGraphics?.has(r);await this._addAndInitializeEdits(r,e,n,i)}}return i.features=new n,i.activeFeatureIndex=-1,await f(()=>!i.updating),p.edits.reduce((e,t)=>e+(t.addFeatures?.length??0),0)>1?null:p.primary?.graphic}async _addAndInitializeEdits(e,t,r,i=!1){let{data:a,_formViewModel:o}=this,{layerInfos:s}=a.viewModel,c=a.addPendingFeature(e,t,{isAssociation:i});r??=G(s,e.sourceLayer),o.features=new n([e]),o.activeFeatureIndex=0,o.layerInfos=r?[r]:null,await f(()=>!o.updating),c.updateAttributes(o.getValues(e)),c.submittable=o.valid}async _setUpCreatingFeaturesStep(){if(this.hasHandles(Z))return;let{data:e,sketchViewModel:n}=this,{creationInfo:o,viewModel:s}=e,{view:l}=s;if(!l||!o?.layer)throw new r(`missing-parameters`,`CreateFeaturesWorkflow requires a view and creationInfo.`);let{initialFeature:u,layer:d}=o,f=[],h=[];this._featureFormHandle=c(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=R(s.editorItems,o.layer),o.template&&(e.fullTemplate??await this._initializeFullTemplateAndExecutorInfo(e),h.push(i(()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])}))),n.allowDeleteKey=!e.isSharedTemplateWorkflow;let g=de(l);f.push(g);let _=D(o.layer),{template:v}=o,y=!v||C(v)||b(v)&&v.type===`feature`,x=_&&y;try{if(x){let n=u??new t({attributes:S(e.fullTemplate,o.attributeOverrides,d),sourceLayer:d}),r=await this._processEdits(n);r&&await this._startUpdating({feature:r})}else f.push(Y._configureSketchViewModel(this)),u?(N(o)&&o.geometryToPlace&&(u.attributes=S(e.fullTemplate,o.attributeOverrides,d)),n.addGraphic(u),await this._startUpdating({feature:u})):await this._startCreating()}finally{g.remove()}let w=i(()=>{for(let t of e.pendingFeatures)n.removeGraphic(t),e.removePendingFeature(t)}),T=p(()=>l?.timeZone,e=>this.data.timeZone=e,m),E=i(()=>{N(o)&&s.cancelWorkflow({warnIfNoWorkflow:!1})});this._featureFormHandle&&f.push(this._featureFormHandle),this.addHandles(f,this._handleKeys.beforeCommit),this.addHandles(h,this._handleKeys.afterCommit),this.addHandles([a(f),a(h),E,w,T],Z)}async _waitForActiveToolCleared(){let e=this.data.viewModel.view;if(e?.activeTool==null)return;let t=new AbortController;this.addHandles(o(t),Q),await f(()=>e?.activeTool==null,t.signal),t.abort()}};e([v()],$.prototype,`allowSave`,null),e([v()],$.prototype,`createFeatureState`,void 0),e([v()],$.prototype,`curveResizeDisabled`,null),e([v()],$.prototype,`curveUpdatesDisabled`,null),e([v()],$.prototype,`data`,void 0),e([v({constructOnly:!0})],$.prototype,`isNested`,void 0),e([v()],$.prototype,`formViewModel`,null),e([v()],$.prototype,`hasInvalidFormTemplate`,null),e([v()],$.prototype,`hasPendingEdits`,null),e([v()],$.prototype,`hasPreviousStep`,null),e([v()],$.prototype,`_getDrawMeshHelpMessage`,void 0),e([v()],$.prototype,`helpMessage`,null),e([v()],$.prototype,`noticeMessage`,null),e([v()],$.prototype,`layer`,null),e([v()],$.prototype,`parent`,null),e([v()],$.prototype,`keyboardCancellationEnabled`,null),e([v()],$.prototype,`reliesOnOwnerAdminPrivileges`,null),e([v()],$.prototype,`saveActionLabel`,null),e([v()],$.prototype,`shouldShowAttachments`,null),e([v()],$.prototype,`shouldAllowAttachmentEditing`,null),e([v()],$.prototype,`sketchUpdateOptions`,null),e([v()],$.prototype,`sketchViewModel`,null),e([v()],$.prototype,`availableCreateTools`,null),$=Y=e([y(`esri.widgets.Editor.CreateFeaturesWorkflow`)],$);function be(e,t,n){let r=null,o=()=>e.snappingOptions.featureSources,s=()=>(r=new te({layer:t}),o().add(r),r),c=()=>{r!=null&&(o().remove(r),r=l(r))};return a([p(()=>{let e=n.creationInfo?.layer,t=o().find(t=>t.layer===e);return{hasFeatureLayerSource:!!t,enabled:t?.enabled??!1}},({hasFeatureLayerSource:e,enabled:t})=>{if(e)r??=s(),r.enabled=t;else return c()},g),i(c)])}function xe(e){let t=e.viewModel.view;if(!t)return[];let n=[];if(t.type===`3d`){let r=new j({view:t});n.push(p(()=>e.selectedPendingFeature,(e,t)=>{r.remove(e),r.add(t)}),i(()=>r.destroy()))}let r=new j({view:t,highlightName:ne});return n.push(p(()=>e.temporaryHighlightFeature,e=>{r.removeAll(),r.add(e)}),i(()=>r.destroy())),n}function Se(e){for(let t of e){let{sourceLayer:e}=t;e&&`globalIdField`in e&&e.globalIdField!=null&&(t.attributes[e.globalIdField]??=_())}}const Ce=$;export{Ce as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import n from"../../core/Collection.js";import r from"../../core/Error.js";import{makeHandle as i,handlesGroup as a,abortHandle as o}from"../../core/handleUtils.js";import"../../core/has.js";import s from"../../core/Logger.js";import{removeMaybe as c,destroyMaybe as l}from"../../core/maybe.js";import{isPromiseLike as u,debounce as d}from"../../core/promiseUtils.js";import{whenOnce as f,watch as p,initial as m,sync as h,syncAndInitial as g}from"../../core/reactiveUtils.js";import{generateBracedUUID as _}from"../../core/uuid.js";import{property as v,subclass as y}from"../../core/accessorSupport/decorators.js";import{isSharedTemplateOrMetadata as b,isSharedTemplate as x,getCreationAttributes as S,isStandardFeatureTemplate as C}from"../../editing/templateUtils.js";import{getFullTemplate as w}from"../../editing/sharedTemplates/templateLoader.js";import T from"../../layers/GraphicsLayer.js";import{isSceneLayer as E,isTable as D}from"../../layers/support/layerUtils.js";import{isNumber as ee}from"../../support/guards.js";import{getDisplayedSymbol as O}from"../../symbols/support/symbolUtils.js";import{updateGraphicSymbolWhenRequired as k}from"../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as A}from"../../views/draw/support/helpMessageUtils.js";import j from"../../views/draw/support/HighlightHelper.js";import M from"../../views/interactive/sketch/SketchOptions.js";import te from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as ne}from"../../views/support/HighlightDefaults.js";import re from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import ie from"./CreateFeaturesWorkflowData.js";import{isModelUpload as N,handleModelUpload as ae}from"./modelUploadUtils.js";import P from"./Workflow.js";import{activeSketchToolDrawsUnsupportedCurve as F,createToolFromGeometryType as I,containsUnsupportedCurve as L,findEditorItemForLayer as R,getServiceEditsFromWorkflowData as z,getServiceInfoForLayer as B,orderEditsByRelationshipDependencies as V,getServiceLayersById as H,startCreatingNewFeature as U,syncUpdateOptions as W,findLayerInfo as G,handleFormValuesChangeEvent as K,isTerminalUpdateEventType as q,getVisualVariableAttributes as J,startUpdatingFeatureGeometry as oe,createWorkflowSteps as se,avoidFeatureTemplateSelectionWithOnlyOneItem as ce,setUpSketchCreateWatchers as le,setRelationshipFields as ue,showProgressCursor as de,setVisualVariablesAndElevationInfoForUpdate as fe,visualVariableInteractiveUpdate as pe}from"./workflowUtils.js";import{makeServiceEditsWithAttachments as me,makeEditsWithAttachments as he,parseEditResultsAndCollectAddAttachmentData as ge}from"./support/attachmentUtils.js";import _e from"../Sketch/SketchViewModel.js";var Y;const ve=Symbol(),X=Symbol(),Z=Symbol(),Q=Symbol(),ye={point:[`point`],multipoint:[`multipoint`],polygon:[`polygon`,`freehandPolygon`,`rectangle`,`circle`],polyline:[`polyline`,`freehandPolyline`],mesh:[],multipatch:[]};let $=Y=class extends P{constructor(e){super(e),this.type=`create-features`,this.createFeatureState=`create-new`,this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._formViewModel=new re({attachmentsEnabled:!0}),this._sketchLayer=null,this._sketchViewModel=null,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get allowSave(){return!this.updating}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPendingEdits(){if(this.pendingFeatures.some(e=>!!this.data.getEditsForPendingFeature(e)?.modified))return!0;let{creationInfo:e,upload:t}=this.data,{activeComponent:n,createGraphic:r}=this._sketchViewModel,i=r?.geometry?.type;return!!((i===`polyline`||i===`polygon`||i===`multipoint`)&&(n?.type===`draw-2d`||n?.type===`draw-3d`)&&n.drawOperation.committedVertices.length>0||t&&(t.state===`pending`||t.state===`success`)||e?.geometryToPlace)}get hasPreviousStep(){return this.formViewModel.canGoBack||this._stepIndex>0||this.createFeatureState===`update-pending`&&!!this.data.selectedPendingFeature&&!this.parent&&!N(this.data.creationInfo)}get helpMessage(){let{creationInfo:e,viewModel:t}=this.data;if(this.stepId!==`creating-features`||!e)return;let{_sketchViewModel:n}=this,{drawTool:r,isUsingLegacyCreateTools:i}=n;if(!i)return r?.helpMessageKey??`noTool`;let a=e.layer.geometryType,o=n.createGraphic;if(a===`mesh`){this._getDrawMeshHelpMessage||import(`../../views/draw/support/helpMessageUtils3d.js`).then(e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage});let{view:e}=t;return e?.type===`3d`?this._getDrawMeshHelpMessage?.(o,e):void 0}let{activeCreateToolDrawMode:s,activeTool:c}=n;return A(c===`rectangle`||c===`circle`?c:a,o?.geometry,s)}get noticeMessage(){if(F(this._sketchViewModel,this.data.editorItem))return`curveToolDensifyWarning`}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter(e=>this.data.isDisplayable(e)).length}get parent(){return this.data.parent}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return this.numPendingFeatures===0}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get saveActionLabel(){return`create`}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchUpdateOptions(){let{editorItem:e}=this.data;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!E(e?.layer)&&!!e?.capabilities.supportsTrueCurve}}}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){let e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e||this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(b(this.data.fullTemplate)){let{tool:t}=I(e,this.data.fullTemplate);return[t]}return t?.type!==`2d`&&e===`multipoint`?[]:[...ye[e]]}getUpdating(){return!!this._sketchViewModel?.updating}async enter(){this._isActive=!0,this.stepId!==`awaiting-feature-creation-info`&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([Z])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),D(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(e){let{formViewModel:t}=this;if(t.pendingSubtypeChoice)return;await t.submit(),this._stashValidationState();let n=this.data.selectedPendingFeature,r=this._hasValidationErrors(n)?n:this.data.pendingFeatures.find(e=>this._hasValidationErrors(e));if(r){await this._startUpdating({feature:r}),await t?.submit();return}let{pendingFeatures:i,editorItem:a}=this.data;return a&&e&&L(i.toArray(),a)&&!await e(`curveEditingDensifyPrompt`)?this.reset():super.save()}back(e){return this._formViewModel.canGoBack?this._formViewModel.goBack():this.createFeatureState===`update-pending`&&this.data.selectedPendingFeature&&!N(this.data.creationInfo)&&!this.parent?this._clearSelectedFeature():super.back(e)}previous(e){return this._formViewModel.canGoBack?this._formViewModel.goBack():this.createFeatureState===`update-pending`&&this.data.selectedPendingFeature&&!N(this.data.creationInfo)?this._clearSelectedFeature():super.previous(e)}cancelFeature(e){this.data.isSharedTemplateWorkflow?s.getLogger(this).warn(`Cannot cancel individual features created by shared templates.`):(this.data.removePendingFeature(e),this.sketchViewModel.removeGraphic(e))}static create(e){let{applyEdits:t,applyEditsFeatureService:n,addAttachmentsCallback:r,isNested:i,creationInfo:a,parent:o,snappingManager:s,startAt:c,viewModel:l}=e,u=e.sketchOptions??new M,d=a?.layer,f=d?R(l.editorItems,d):void 0,p=new Y({data:new ie({creationInfo:a,editorItem:f,parent:o,sketchOptions:u,snappingManager:s,viewModel:l}),isNested:i,onCommit:async e=>{let{creationInfo:i}=e;if(!i)return;p._sketchViewModel.cancel();let a=e.pendingFeatures.toArray(),{layer:o}=i,s=o.capabilities?.editing.supportsGlobalId&&`globalIdField`in o,{fullTemplate:c}=e,u=z(p.data),d=x(c)&&u;if(s){if(Se(a),d){let t=me(u,e),r=await B(o,l.view)?.load();r&&(t=V({edits:t,serviceInfo:r,view:l.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await n(c.featureService,t,{globalIdUsed:!0,honorSequenceOfEdits:!0,gdbVersion:c.layer.gdbVersion??void 0})}else await t(o,he(a,e),{globalIdUsed:!0});return}let f=d?await n(c.featureService,u,{gdbVersion:c.layer.gdbVersion??void 0}):[await t(o,{addFeatures:a})];f?.length&&e.attachmentsModified&&!s&&await Promise.all(f.map(t=>{if(!t?.addFeatureResults)return;let n=ge(a,t.addFeatureResults,o,e);return r(o,n)}))}});return p._set(`steps`,this._createWorkflowSteps(p,c)),p}_fadeExistingFeatures(e){if(`effect`in e){let t=e.effect;return e.effect=`saturate(0.6) opacity(0.8)`,i(()=>e.effect=t)}let t=e.opacity;return e.opacity=.7,i(()=>e.opacity=t)}async _initializeFullTemplateAndExecutorInfo(e){let{creationInfo:t}=e,{view:n}=e.viewModel;if(!t||!n)return null;let r=await w(n,t.template);if(e.fullTemplate=r,r&&x(r)){let{createTemplateExecutor:i}=await import(`../../editing/sharedTemplates/executor/createTemplateExecutor.js`);e.templateExecutorInfo={completionResults:[],executor:await i(r),serviceLayersById:H(t.layer,n)}}return r}async _startCreating(){this.removeHandles(X);let{data:e}=this;if(!e.creationInfo)return;let t=this.data.creationInfo?.maxFeatures;t&&this.numPendingFeatures>=t?(this.sketchViewModel.cancel(),this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)})):(this.createFeatureState=`create-new`,await U(this._sketchViewModel,this._sketchLayer,e))}async _clearSelectedFeature(){let e=this._formViewModel.pendingSubtypeChoice;e&&(e.resolve(`undo`),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=c(this._featureFormHandle),this._formViewModel.features=new n,this._formViewModel.activeFeatureIndex=-1}_stashValidationState(){let e=this._formViewModel.activeFeature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._formViewModel.valid)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();let{data:r,pendingFeatures:i}=this;i.includes(e)||r.addPendingFeature(e,t),r.selectedPendingFeature=e;let{_formViewModel:o,_sketchViewModel:s,sketchUpdateOptions:l}=this,{creationInfo:u,viewModel:d}=r,{layerInfos:m,view:h}=d;if(!h||!u)return;W(s,l),c(this._featureFormHandle);let g=e.sourceLayer,_=G(m,g),v=h.spatialReference;o.set({editType:`INSERT`,features:new n([e]),activeFeatureIndex:0,layerInfos:_?[_]:null,spatialReference:v,view:h}),await f(()=>o.updating===!1),await k(e,h.type===`2d`?h.scale:null);let y=r.getEditsForPendingFeature(e);y?.attachmentsModified&&o.applyStashedAttachmentEdits(y.attachmentEdits),this._featureFormHandle=a([o.on(`values-change`,K({filter:e=>e===y?.feature,forEachValueChange:(e,t)=>{if(ee(t)){let n=this._visualVariableAttributes;n.size&&!n.size.isUpdatingInteractively&&e===n.size.field&&n.size.setInitialValue(t),n.rotation&&!n.rotation.isUpdatingInteractively&&e===n.rotation.field&&n.rotation.setInitialValue(t)}},forEachFeature:e=>{y?.updateAttributes(o.getValues(e)),k(e,h.type===`2d`?h.scale:null)}})),o.on(`attachments-change`,e=>y?.setAttachmentEdits(e.attachmentEdits)),s.on([`update`,`undo`,`redo`],t=>{(t.type===`undo`||t.type===`redo`||t.type===`update`&&t.toolEventInfo!=null&&q(t.toolEventInfo.type))&&o.notifyGeometriesChanged([e])}),p(()=>o.activeFeature?.sourceLayer,t=>e.sourceLayer=t),p(()=>[o.activeFeature,o.valid],()=>this._stashValidationState())]),this.createFeatureState=`update-pending`}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});let{_sketchLayer:n,_sketchViewModel:r,data:i}=this,{creationInfo:a,viewModel:o}=i,{view:s}=o;if(!s||!a)return;let c=e.sourceLayer??a.layer;if(!D(c))return this._visualVariableAttributes=J(e),oe({graphic:e,sketchLayer:n,sketchViewModel:r,sourceLayer:c,updateOptions:this.sketchUpdateOptions,visualVariables:this._visualVariableAttributes})}static _createWorkflowSteps(e,t=`awaiting-feature-creation-info`){let{data:n}=e,r=n.creationInfo?.layer,i=se([`awaiting-feature-creation-info`,`creating-features`,`adding-attachment`,`editing-attachment`],t,{"awaiting-feature-creation-info":()=>({id:`awaiting-feature-creation-info`,async setUp(){let{creationInfo:t,viewModel:i}=n,{view:a}=i;a&&(N(t)?e.addHandles(await ae({view:a,data:n,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(r&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(r),this.id),e.addHandles(i.featureTemplatesViewModel.on(`select`,({item:t})=>{t&&(n.creationInfo={...n.creationInfo,layer:t.layer,template:t.template},e.next())}),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:`creating-features`,async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){t.canceled&&e.removeHandles([Z,ve,X,Q])}}),"adding-attachment":()=>({id:`adding-attachment`,parent:`creating-features`,async setUp(){},async tearDown(){}}),"editing-attachment":()=>({id:`editing-attachment`,parent:`creating-features`,async setUp(){},async tearDown(){}})});return ce(n,i)}static _configureSketchViewModel(e){let{data:t,_sketchLayer:n,_sketchViewModel:r}=e,{creationInfo:o,viewModel:s}=t,{view:c}=s,l=[];if(!c)return i();if(c.type===`2d`){o&&l.push(e._fadeExistingFeatures(o.layer));let t=d((e,t)=>Promise.all(e.map(e=>k(e,t))));l.push(p(()=>c.scale,e=>t(n.graphics,e)))}let u=S(t.fullTemplate,o?.attributeOverrides,o?.layer),f=p(()=>r.createGraphic&&r.activeComponent,()=>{r.createGraphic&&r.activeComponent&&!e.hasHandles(X)&&e._updatingHandles.consumePromise(le({creationAttributes:u,data:t,sketchViewModel:r,view:c}).then(t=>e.addHandles(t,X)))}),m=async t=>{if((t.state===`cancel`||t.state===`complete`)&&e.removeHandles(X),t.state===`cancel`&&c.activeTool!==null&&c.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),t.state===`complete`&&t.graphic){let n=await e._processEdits(t.graphic,{scale:c.type===`2d`?c.scale:null,useSourceLayer:!0});n&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:n}))}},h=async i=>{let{_formViewModel:a}=e;if(i.graphics.length>1){await e._clearSelectedFeature();return}let s=i.graphics[0];if(i.state===`complete`){if(e.numPendingFeatures!==o?.maxFeatures&&a.valid||a.activeForm.touchAll(),await e._clearSelectedFeature(),e.data.selectedPendingFeature==null&&(c.activeTool==null||c.activeTool===e.sketchViewModel.activeComponent)&&(await e.sketchViewModel.wait(),e.sketchViewModel.state===`ready`&&e.data.creationInfo?.layer.geometryType!==`mesh`))return e._startCreating()}else if(i.state===`start`)return s.sourceLayer??=t.creationInfo?.layer,await fe({graphic:s,sketchLayer:n,sketchViewModel:r,visualVariables:e._visualVariableAttributes,sourceLayer:s.sourceLayer}),e._selectFeatureForUpdate({feature:s});else if(i.state===`active`){await e.updatePendingFeature(s);let t=e._visualVariableAttributes;pe(c,s,i,t)&&await k(s,c.type===`2d`?c.scale:null);let n=s.attributes,{rotation:r,size:o}=t;if(r!=null){let{field:t}=r;e._updatingHandles.consumePromise(a.setFieldValue(t,n[t]))}if(o!=null){let{field:t}=o;e._updatingHandles.consumePromise(a.setFieldValue(t,n[t]))}}},g=async n=>{if(n.graphics.forEach(e=>{t.removePendingFeature(e)}),!N(t.creationInfo))return e._startCreating()},_=async()=>{if(N(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};l.push(f,r.on(`create`,t=>e._updatingHandles.addPromise(m(t))),r.on(`update`,t=>e._updatingHandles.addPromise(h(t))),r.on(`delete`,t=>e._updatingHandles.addPromise(g(t))),e._updatingHandles.addWhen(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(_())),i(()=>{r.cancel()}),be(r,n,t),...xe(t));let v=a(l);return r.addHandles(v),v}_initializeSketchViewModel(){let{data:e}=this,{view:t}=e.viewModel,n=new T({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:`hide`,title:`createFeaturesWorkflow-internal`}),r=new _e({layer:n,creationMode:`single`,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:t});this._sketchLayer=n,this._sketchViewModel=r,t?.map.add(n),this.addHandles([i(()=>{t?.destroyed||t?.map.remove(n),l(n)}),p(()=>this.numPendingFeatures>0,e=>this._sketchViewModel.updateOnGraphicClick=e,m),p(()=>this.sketchUpdateOptions,e=>{r.defaultUpdateOptions=e,W(r,e)},h)])}_hasValidationErrors(e){return e?!this.data.isSubmittable(e):!1}async _processEdits(e,t){let{data:r,_formViewModel:i,_sketchLayer:a}=this,{layerInfos:o,view:s}=r.viewModel;i.editType=`INSERT`,i.spatialReference=s?.spatialReference,i.view=s;let{templateExecutorInfo:c}=r;if(!c){let t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}a.remove(e);let{executor:l}=c,d=l(e.geometry,`completion`),p=u(d)?await d:d;c.completionResults.push(p),ue(p.relationships),i.editType=`INSERT`,i.spatialReference=s?.spatialReference,i.view=s,p.primary&&r.creationInfo?.attributeOverrides&&(p.primary.graphic.attributes={...p.primary.graphic.attributes,...r.creationInfo.attributeOverrides});for(let e of p.edits){let n=null;if(e.addFeatures)for(let r of e.addFeatures){let e=r.clone();e.geometry=null,r.geometry!=null&&(r.symbol=await O(r,t),a.add(r)),r.sourceLayer!==n?.layer&&(n=G(o,r.sourceLayer));let i=!!p.associationGraphics?.has(r);await this._addAndInitializeEdits(r,e,n,i)}}return i.features=new n,i.activeFeatureIndex=-1,await f(()=>!i.updating),p.edits.reduce((e,t)=>e+(t.addFeatures?.length??0),0)>1?null:p.primary?.graphic}async _addAndInitializeEdits(e,t,r,i=!1){let{data:a,_formViewModel:o}=this,{layerInfos:s}=a.viewModel,c=a.addPendingFeature(e,t,{isAssociation:i});r??=G(s,e.sourceLayer),o.features=new n([e]),o.activeFeatureIndex=0,o.layerInfos=r?[r]:null,await f(()=>!o.updating),c.updateAttributes(o.getValues(e)),c.submittable=o.valid}async _setUpCreatingFeaturesStep(){if(this.hasHandles(Z))return;let{data:e,sketchViewModel:n}=this,{creationInfo:o,viewModel:s}=e,{view:l}=s;if(!l||!o?.layer)throw new r(`missing-parameters`,`CreateFeaturesWorkflow requires a view and creationInfo.`);let{initialFeature:u,layer:d}=o,f=[],h=[];this._featureFormHandle=c(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=R(s.editorItems,o.layer),o.template&&(e.fullTemplate??await this._initializeFullTemplateAndExecutorInfo(e),h.push(i(()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])}))),n.allowDeleteKey=!e.isSharedTemplateWorkflow;let g=de(l);f.push(g);let _=D(o.layer),{template:v}=o,y=!v||C(v)||b(v)&&v.type===`feature`,x=_&&y;try{if(x){let n=u??new t({attributes:S(e.fullTemplate,o.attributeOverrides,d),sourceLayer:d}),r=await this._processEdits(n);r&&await this._startUpdating({feature:r})}else f.push(Y._configureSketchViewModel(this)),u?(N(o)&&o.geometryToPlace&&(u.attributes=S(e.fullTemplate,o.attributeOverrides,d)),n.addGraphic(u),await this._startUpdating({feature:u})):await this._startCreating()}finally{g.remove()}let w=i(()=>{for(let t of e.pendingFeatures)n.removeGraphic(t),e.removePendingFeature(t)}),T=p(()=>l?.timeZone,e=>this.data.timeZone=e,m),E=i(()=>{N(o)&&s.cancelWorkflow({warnIfNoWorkflow:!1})});this._featureFormHandle&&f.push(this._featureFormHandle),this.addHandles(f,this._handleKeys.beforeCommit),this.addHandles(h,this._handleKeys.afterCommit),this.addHandles([a(f),a(h),E,w,T],Z)}async _waitForActiveToolCleared(){let e=this.data.viewModel.view;if(e?.activeTool==null)return;let t=new AbortController;this.addHandles(o(t),Q),await f(()=>e?.activeTool==null,t.signal),t.abort()}};e([v()],$.prototype,`allowSave`,null),e([v()],$.prototype,`createFeatureState`,void 0),e([v()],$.prototype,`curveResizeDisabled`,null),e([v()],$.prototype,`curveUpdatesDisabled`,null),e([v()],$.prototype,`data`,void 0),e([v({constructOnly:!0})],$.prototype,`isNested`,void 0),e([v()],$.prototype,`formViewModel`,null),e([v()],$.prototype,`hasInvalidFormTemplate`,null),e([v()],$.prototype,`hasPendingEdits`,null),e([v()],$.prototype,`hasPreviousStep`,null),e([v()],$.prototype,`_getDrawMeshHelpMessage`,void 0),e([v()],$.prototype,`helpMessage`,null),e([v()],$.prototype,`noticeMessage`,null),e([v()],$.prototype,`layer`,null),e([v()],$.prototype,`parent`,null),e([v()],$.prototype,`keyboardCancellationEnabled`,null),e([v()],$.prototype,`reliesOnOwnerAdminPrivileges`,null),e([v()],$.prototype,`saveActionLabel`,null),e([v()],$.prototype,`shouldShowAttachments`,null),e([v()],$.prototype,`shouldAllowAttachmentEditing`,null),e([v()],$.prototype,`sketchUpdateOptions`,null),e([v()],$.prototype,`sketchViewModel`,null),e([v()],$.prototype,`availableCreateTools`,null),$=Y=e([y(`esri.widgets.Editor.CreateFeaturesWorkflow`)],$);function be(e,t,n){let r=null,o=()=>e.snappingOptions.featureSources,s=()=>(r=new te({layer:t}),o().add(r),r),c=()=>{r!=null&&(o().remove(r),r=l(r))};return a([p(()=>{let e=n.creationInfo?.layer,t=o().find(t=>t.layer===e);return{hasFeatureLayerSource:!!t,enabled:t?.enabled??!1}},({hasFeatureLayerSource:e,enabled:t})=>{if(e)r??=s(),r.enabled=t;else return c()},g),i(c)])}function xe(e){let t=e.viewModel.view;if(!t)return[];let n=[];if(t.type===`3d`){let r=new j({view:t});n.push(p(()=>e.selectedPendingFeature,(e,t)=>{r.remove(e),r.add(t)}),i(()=>r.destroy()))}let r=new j({view:t,highlightName:ne});return n.push(p(()=>e.temporaryHighlightFeature,e=>{r.removeAll(),r.add(e)}),i(()=>r.destroy())),n}function Se(e){for(let t of e){let{sourceLayer:e}=t;e&&`globalIdField`in e&&e.globalIdField!=null&&(t.attributes[e.globalIdField]??=_())}}const Ce=$;export{Ce as default};
|
|
@@ -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/Error.js";import{makeHandle as r,handlesGroup as i,abortHandle as a}from"../../../core/handleUtils.js";import"../../../core/has.js";import o from"../../../core/Logger.js";import{removeMaybe as s,destroyMaybe as c}from"../../../core/maybe.js";import{isPromiseLike as l,debounce as u}from"../../../core/promiseUtils.js";import{watch as d,initial as f,sync as p,whenOnce as m,syncAndInitial as h}from"../../../core/reactiveUtils.js";import{generateBracedUUID as g}from"../../../core/uuid.js";import{property as _,subclass as v}from"../../../core/accessorSupport/decorators.js";import{isSharedTemplateOrMetadata as y,isSharedTemplate as b,getCreationAttributes as x,isStandardFeatureTemplate as ee}from"../../../editing/templateUtils.js";import{getFullTemplate as S}from"../../../editing/sharedTemplates/templateLoader.js";import C from"../../../layers/GraphicsLayer.js";import{isSceneLayer as w,isTable as T}from"../../../layers/support/layerUtils.js";import{isNumber as E}from"../../../support/guards.js";import{getDisplayedSymbol as D}from"../../../symbols/support/symbolUtils.js";import{updateGraphicSymbolWhenRequired as O}from"../../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as k}from"../../../views/draw/support/helpMessageUtils.js";import A from"../../../views/draw/support/HighlightHelper.js";import j from"../../../views/interactive/sketch/SketchOptions.js";import te from"../../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as M}from"../../../views/support/HighlightDefaults.js";import{isModelUpload as N,handleModelUpload as ne}from"../modelUploadUtils.js";import{activeSketchToolDrawsUnsupportedCurve as re,createToolFromGeometryType as ie,containsUnsupportedCurve as ae,findEditorItemForLayer as P,getServiceEditsFromWorkflowData as F,getServiceInfoForLayer as I,orderEditsByRelationshipDependencies as L,getServiceLayersById as R,startCreatingNewFeature as z,syncUpdateOptions as B,findLayerInfo as V,isTerminalUpdateEventType as H,getVisualVariableAttributes as U,startUpdatingFeatureGeometry as W,createWorkflowSteps as G,avoidFeatureTemplateSelectionWithOnlyOneItem as K,setUpSketchCreateWatchers as q,setRelationshipFields as J,showProgressCursor as oe,setVisualVariablesAndElevationInfoForUpdate as se,visualVariableInteractiveUpdate as ce}from"../workflowUtils.js";import le from"./CreateFeaturesWorkflowData.js";import ue from"./Workflow.js";import{prepareAttachmentsForCreateFeaturesWorkflow as de}from"./workflowUtils.js";import fe from"../../FeatureForm/FeatureFormViewModel.js";import pe from"../../Sketch/SketchViewModel.js";var Y;const me=Symbol(),X=Symbol(),Z=Symbol(),Q=Symbol(),he={point:[`point`],multipoint:[`multipoint`],polygon:[`polygon`,`freehandPolygon`,`rectangle`,`circle`],polyline:[`polyline`,`freehandPolyline`],mesh:[],multipatch:[]};let $=Y=class extends ue{constructor(e){super(e),this.type=`create-features`,this.createFeatureState=`create-new`,this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._formViewModel=new fe,this._sketchLayer=null,this._sketchViewModel=null,this._attachmentFileInfos=new Map,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get allowSave(){return!this.updating}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPendingEdits(){if(this.pendingFeatures.some(e=>!!this.data.getEditsForPendingFeature(e)?.modified))return!0;let{creationInfo:e,upload:t}=this.data,{activeComponent:n,createGraphic:r}=this._sketchViewModel,i=r?.geometry?.type;return!!((i===`polyline`||i===`polygon`||i===`multipoint`)&&(n?.type===`draw-2d`||n?.type===`draw-3d`)&&n.drawOperation.committedVertices.length>0||t&&(t.state===`pending`||t.state===`success`)||e?.geometryToPlace)}get hasPreviousStep(){return this._stepIndex>0||this.createFeatureState===`update-pending`&&!!this.data.selectedPendingFeature&&!this.parent&&!N(this.data.creationInfo)}get helpMessage(){let{creationInfo:e,viewModel:t}=this.data;if(this.stepId!==`creating-features`||!e)return;let{_sketchViewModel:n}=this,{drawTool:r,isUsingLegacyCreateTools:i}=n;if(!i)return r?.helpMessageKey??`noTool`;let a=e.layer.geometryType,o=n.createGraphic;if(a===`mesh`){this._getDrawMeshHelpMessage||import(`../../../views/draw/support/helpMessageUtils3d.js`).then(e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage});let{view:e}=t;return e?.type===`3d`?this._getDrawMeshHelpMessage?.(o,e):void 0}let{activeCreateToolDrawMode:s,activeTool:c}=n;return k(c===`rectangle`||c===`circle`?c:a,o?.geometry,s)}get noticeMessage(){if(re(this._sketchViewModel,this.data.editorItem))return`curveToolDensifyWarning`}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter(e=>this.data.isDisplayable(e)).length}get parent(){return this.data.parent}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return this.numPendingFeatures===0}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get saveActionLabel(){return`create`}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchUpdateOptions(){let{editorItem:e}=this.data;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!w(e?.layer)&&!!e?.capabilities.supportsTrueCurve}}}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){let e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e||this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(y(this.data.fullTemplate)){let{tool:t}=ie(e,this.data.fullTemplate);return[t]}return t?.type!==`2d`&&e===`multipoint`?[]:[...he[e]]}get _attachmentsActive(){let e=this.data.viewModel.attachmentsViewModel.mode,t=this.stepId;return this.shouldShowAttachments&&(e===`add`||e===`edit`||t===`adding-attachment`||t===`editing-attachment`)}getUpdating(){return!!this._sketchViewModel?.updating}async enter(){this._isActive=!0,this.stepId!==`awaiting-feature-creation-info`&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([Z])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),T(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(e){let{formViewModel:t}=this;if(t.pendingSubtypeChoice)return;t.submit(),this._stashValidationState();let n=this.data.selectedPendingFeature,r=this._hasValidationErrors(n)?n:this.data.pendingFeatures.find(e=>this._hasValidationErrors(e));if(r){await this._startUpdating({feature:r}),t?.submit();return}let{pendingFeatures:i,editorItem:a}=this.data;return a&&e&&ae(i.toArray(),a)&&!await e(`curveEditingDensifyPrompt`)?this.reset():super.save()}back(e){return this.createFeatureState===`update-pending`&&this.data.selectedPendingFeature&&!N(this.data.creationInfo)&&!this._attachmentsActive&&!this.parent?this._clearSelectedFeature():super.back(e)}previous(e){return this.createFeatureState===`update-pending`&&this.data.selectedPendingFeature&&!N(this.data.creationInfo)&&!this._attachmentsActive?this._clearSelectedFeature():super.previous(e)}cancelFeature(e){this.data.isSharedTemplateWorkflow?o.getLogger(this).warn(`Cannot cancel individual features created by shared templates.`):(this.data.removePendingFeature(e),this.sketchViewModel.removeGraphic(e))}static create(e){let{addAttachmentsCallback:t,applyEdits:n,applyEditsFeatureService:r,isNested:i,creationInfo:a,parent:o,snappingManager:s,startAt:c,viewModel:l}=e,u=e.sketchOptions??new j,d=a?.layer,f=d?P(l.editorItems,d):void 0,p=new Y({data:new le({creationInfo:a,editorItem:f,parent:o,sketchOptions:u,snappingManager:s,viewModel:l}),isNested:i,onCommit:async e=>{let{creationInfo:i}=e;if(!i)return;p._sketchViewModel.cancel();let a=e.pendingFeatures.toArray(),{layer:o}=i,s=o.capabilities?.editing.supportsGlobalId&&`globalIdField`in o,c=p._attachmentFileInfos,{fullTemplate:u}=e,d=F(p.data),f=b(u)&&d;if(s){if(ye(a),f){let t=xe(d,c),n=await I(o,l.view)?.load();n&&(t=L({edits:t,serviceInfo:n,view:l.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await r(u.featureService,t,{globalIdUsed:!0,honorSequenceOfEdits:!0,gdbVersion:u.layer.gdbVersion??void 0})}else{let e=be(a,c);await n(o,e,{globalIdUsed:!0})}return}let m=f?await r(u.featureService,d,{gdbVersion:u.layer.gdbVersion??void 0}):[await n(o,{addFeatures:a})];m&&c.size>0&&await Promise.all(m.map(e=>{if(e?.addFeatureResults)return t(o,ve(a,e.addFeatureResults,o,c))}))}});return p._set(`steps`,this._createWorkflowSteps(p,c)),p}_fadeExistingFeatures(e){if(`effect`in e){let t=e.effect;return e.effect=`saturate(0.6) opacity(0.8)`,r(()=>e.effect=t)}let t=e.opacity;return e.opacity=.7,r(()=>e.opacity=t)}async _initializeFullTemplateAndExecutorInfo(e){let{creationInfo:t}=e,{view:n}=e.viewModel;if(!t||!n)return null;let r=await S(n,t.template);if(e.fullTemplate=r,r&&b(r)){let{createTemplateExecutor:i}=await import(`../../../editing/sharedTemplates/executor/createTemplateExecutor.js`);e.templateExecutorInfo={completionResults:[],executor:await i(r),serviceLayersById:R(t.layer,n)}}return r}async _startCreating(){this.removeHandles(X);let{data:e}=this;if(!e.creationInfo)return;let t=this.data.creationInfo?.maxFeatures;t&&this.numPendingFeatures>=t?(this.sketchViewModel.cancel(),this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)})):(this.createFeatureState=`create-new`,await z(this._sketchViewModel,this._sketchLayer,e))}async _clearSelectedFeature(){let e=this._formViewModel.pendingSubtypeChoice;e&&(e.resolve(`undo`),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=s(this._featureFormHandle),this._formViewModel.feature=null;let t=this.data.viewModel.attachmentsViewModel;(t.mode===`add`||t.mode===`edit`)&&await this.data.viewModel.activeWorkflow?.previous()}_stashValidationState(){let e=this._formViewModel.feature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._formViewModel.submittable)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();let{data:n,pendingFeatures:r}=this;r.includes(e)||n.addPendingFeature(e,t),n.selectedPendingFeature=e;let{_formViewModel:a,_sketchViewModel:o,sketchUpdateOptions:c}=this,{creationInfo:l,viewModel:u}=n,{attachmentsViewModel:f,layerInfos:p,view:m}=u;if(!m||!l)return;B(o,c),s(this._featureFormHandle);let h=e.sourceLayer,g=V(p,h)?.formTemplate,_=m.spatialReference;a.set({editType:`INSERT`,feature:e,formTemplate:g,spatialReference:_,view:m}),(f.mode===`add`||f.mode===`edit`)&&await u.activeWorkflow?.previous(),f.graphic=e,f.fileInfos.removeAll(),f.mode=`view`,(this._attachmentFileInfos.get(e)||[]).forEach(({file:e,form:t})=>f.addFile(e,t)),await O(e,m.type===`2d`?m.scale:null);let v=n.getEditsForPendingFeature(e);this._featureFormHandle=i([a.on(`value-change`,async({fieldName:t,value:n})=>{if(v?.updateAttributes(a.getValues()),E(n)){let e=this._visualVariableAttributes;e.size&&!e.size.isUpdatingInteractively&&t===e.size.field&&e.size.setInitialValue(n),e.rotation&&!e.rotation.isUpdatingInteractively&&t===e.rotation.field&&e.rotation.setInitialValue(n)}await O(e,m.type===`2d`?m.scale:null)}),o.on([`update`,`undo`,`redo`],e=>{(e.type===`undo`||e.type===`redo`||e.type===`update`&&e.toolEventInfo!=null&&H(e.toolEventInfo.type))&&a.notifyFeatureGeometryChanged()}),d(()=>a.feature?.sourceLayer,t=>e.sourceLayer=t),d(()=>[a.feature,a.submittable],()=>this._stashValidationState())]),this.createFeatureState=`update-pending`}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});let{_sketchLayer:n,_sketchViewModel:r,data:i}=this,{creationInfo:a,viewModel:o}=i,{view:s}=o;if(!s||!a)return;let c=e.sourceLayer??a.layer;if(!T(c))return this._visualVariableAttributes=U(e),W({graphic:e,sketchLayer:n,sketchViewModel:r,sourceLayer:c,updateOptions:this.sketchUpdateOptions,visualVariables:this._visualVariableAttributes})}static _createWorkflowSteps(e,t=`awaiting-feature-creation-info`){let{data:n}=e,r=n.creationInfo?.layer,i=G([`awaiting-feature-creation-info`,`creating-features`,`adding-attachment`,`editing-attachment`],t,{"awaiting-feature-creation-info":()=>({id:`awaiting-feature-creation-info`,async setUp(){let{creationInfo:t,viewModel:i}=n,{view:a}=i;a&&(N(t)?e.addHandles(await ne({view:a,data:n,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(r&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(r),this.id),e.addHandles(i.featureTemplatesViewModel.on(`select`,({item:t})=>{t&&(n.creationInfo={...n.creationInfo,layer:t.layer,template:t.template},e.next())}),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:`creating-features`,async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){let{viewModel:r}=n;t.canceled&&(e.removeHandles([Z,me,X,Q]),r.attachmentsViewModel.fileInfos.removeAll(),e._attachmentFileInfos.clear())}}),"adding-attachment":()=>({id:`adding-attachment`,parent:`creating-features`,async setUp(){},async tearDown(){let{attachmentsViewModel:t}=n.viewModel,{graphic:r,fileInfos:i}=t;e._attachmentFileInfos.set(r,i.toArray()),t.mode=`view`}}),"editing-attachment":()=>({id:`editing-attachment`,parent:`creating-features`,async setUp(){},async tearDown(){let{attachmentsViewModel:t}=n.viewModel,{graphic:r,fileInfos:i}=t;e._attachmentFileInfos.set(r,i.toArray()),t.mode=`view`}})});return K(n,i)}static _configureSketchViewModel(e){let{data:t,_sketchLayer:n,_sketchViewModel:a}=e,{creationInfo:o,viewModel:s}=t,{view:c}=s,l=[];if(!c)return r();if(c.type===`2d`){o&&l.push(e._fadeExistingFeatures(o.layer));let t=u((e,t)=>Promise.all(e.map(e=>O(e,t))));l.push(d(()=>c.scale,e=>t(n.graphics,e)))}let f=x(t.fullTemplate,o?.attributeOverrides,o?.layer),p=d(()=>a.createGraphic&&a.activeComponent,()=>{a.createGraphic&&a.activeComponent&&!e.hasHandles(X)&&e._updatingHandles.consumePromise(q({creationAttributes:f,data:t,sketchViewModel:a,view:c}).then(t=>e.addHandles(t,X)))}),m=async t=>{if((t.state===`cancel`||t.state===`complete`)&&e.removeHandles(X),t.state===`cancel`&&c.activeTool!==null&&c.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),t.state===`complete`&&t.graphic){let n=await e._processEdits(t.graphic,{scale:c.type===`2d`?c.scale:null,useSourceLayer:!0});n&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:n}))}},h=async r=>{let{attachmentsViewModel:i}=s,{_formViewModel:l}=e;if(r.graphics.length>1){await e._clearSelectedFeature();return}let u=r.graphics[0];if(r.state===`complete`){let{submittable:t}=l;if((e.numPendingFeatures===o?.maxFeatures||!t)&&l.submit(),await e._clearSelectedFeature(),(i.mode===`add`||i.mode===`edit`)&&await s.activeWorkflow?.previous(),e.data.selectedPendingFeature==null&&(c.activeTool==null||c.activeTool===e.sketchViewModel.activeComponent)&&(await e.sketchViewModel.wait(),e.sketchViewModel.state===`ready`&&e.data.creationInfo?.layer.geometryType!==`mesh`))return e._startCreating()}else if(r.state===`start`)return u.sourceLayer??=t.creationInfo?.layer,await se({graphic:u,sketchLayer:n,sketchViewModel:a,visualVariables:e._visualVariableAttributes,sourceLayer:u.sourceLayer}),e._selectFeatureForUpdate({feature:u});else if(r.state===`active`){await e.updatePendingFeature(u);let t=e._visualVariableAttributes;ce(c,u,r,t)&&await O(u,c.type===`2d`?c.scale:null);let n=u.attributes,{rotation:i,size:a}=t;if(i!=null){let{field:e}=i;l.setValue(e,n[e])}if(a!=null){let{field:e}=a;l.setValue(e,n[e])}}},g=async n=>{if(n.graphics.forEach(e=>{t.removePendingFeature(e)}),!N(t.creationInfo))return e._startCreating()},_=async()=>{if(N(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};l.push(p,a.on(`create`,t=>e._updatingHandles.addPromise(m(t))),a.on(`update`,t=>e._updatingHandles.addPromise(h(t))),a.on(`delete`,t=>e._updatingHandles.addPromise(g(t))),e._updatingHandles.addWhen(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(_())),r(()=>{a.cancel()}),ge(a,n,t),..._e(t));let v=i(l);return a.addHandles(v),v}_initializeSketchViewModel(){let{data:e}=this,{view:t}=e.viewModel,n=new C({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:`hide`,title:`createFeaturesWorkflow-internal`}),i=new pe({layer:n,creationMode:`single`,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:t});this._sketchLayer=n,this._sketchViewModel=i,t?.map.add(n),this.addHandles([r(()=>{t?.destroyed||t?.map.remove(n),c(n)}),d(()=>this.numPendingFeatures>0,e=>this._sketchViewModel.updateOnGraphicClick=e,f),d(()=>this.sketchUpdateOptions,e=>{i.defaultUpdateOptions=e,B(i,e)},p)])}_hasValidationErrors(e){return e?!this.data.isSubmittable(e)||!!this._formViewModel.validateContingencyConstraints(e.attributes,{includeIncompleteViolations:!0})?.length:!1}async _processEdits(e,t){let{data:n,_formViewModel:r,_sketchLayer:i}=this,{layerInfos:a,view:o}=n.viewModel;r.editType=`INSERT`,r.spatialReference=o?.spatialReference,r.view=o;let{templateExecutorInfo:s}=n;if(!s){let t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}i.remove(e);let{executor:c}=s,u=c(e.geometry,`completion`),d=l(u)?await u:u;s.completionResults.push(d),J(d.relationships),r.editType=`INSERT`,r.spatialReference=o?.spatialReference,r.view=o,d.primary&&n.creationInfo?.attributeOverrides&&(d.primary.graphic.attributes={...d.primary.graphic.attributes,...n.creationInfo.attributeOverrides});for(let e of d.edits){let n=null;if(e.addFeatures)for(let r of e.addFeatures){let e=r.clone();e.geometry=null,r.geometry!=null&&(r.symbol=await D(r,t),i.add(r)),r.sourceLayer!==n?.layer&&(n=V(a,r.sourceLayer));let o=!!d.associationGraphics?.has(r);await this._addAndInitializeEdits(r,e,n,o)}}return r.feature=null,await m(()=>!r.updating),d.edits.reduce((e,t)=>e+(t.addFeatures?.length??0),0)>1?null:d.primary?.graphic}async _addAndInitializeEdits(e,t,n,r=!1){let{data:i,_formViewModel:a}=this,{layerInfos:o}=i.viewModel,s=i.addPendingFeature(e,t,{isAssociation:r});n??=V(o,e.sourceLayer),a.feature=e,a.formTemplate=n?.formTemplate,await m(()=>!a.updating),s.updateAttributes(a.getValues()),s.submittable=a.submittable}async _setUpCreatingFeaturesStep(){if(this.hasHandles(Z))return;let{data:e,sketchViewModel:a}=this,{creationInfo:o,viewModel:c}=e,{attachmentsViewModel:l,view:u}=c;if(!u||!o?.layer)throw new n(`missing-parameters`,`CreateFeaturesWorkflow requires a view and creationInfo.`);let{initialFeature:p,layer:m}=o,h=[],g=[];this._featureFormHandle=s(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=P(c.editorItems,o.layer),o.template&&(e.fullTemplate??await this._initializeFullTemplateAndExecutorInfo(e),g.push(r(()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])}))),a.allowDeleteKey=!e.isSharedTemplateWorkflow,de(l),h.push(d(()=>l.mode,e=>{switch(e){case`add`:this.go(`adding-attachment`);break;case`edit`:this.go(`editing-attachment`)}}));let _=oe(u);h.push(_);let v=T(o.layer),{template:b}=o,S=!b||ee(b)||y(b)&&b.type===`feature`,C=v&&S;try{if(C){let n=p??new t({attributes:x(e.fullTemplate,o.attributeOverrides,m),sourceLayer:m}),r=await this._processEdits(n);r&&await this._startUpdating({feature:r})}else h.push(Y._configureSketchViewModel(this)),p?(N(o)&&o.geometryToPlace&&(p.attributes=x(e.fullTemplate,o.attributeOverrides,m)),a.addGraphic(p),await this._startUpdating({feature:p})):await this._startCreating()}finally{_.remove()}let w=r(()=>{for(let t of e.pendingFeatures)a.removeGraphic(t),e.removePendingFeature(t)}),E=d(()=>u?.timeZone,e=>this.data.timeZone=e,f),D=r(()=>{N(o)&&c.cancelWorkflow({warnIfNoWorkflow:!1})});this._featureFormHandle&&h.push(this._featureFormHandle),this.addHandles(h,this._handleKeys.beforeCommit),this.addHandles(g,this._handleKeys.afterCommit),this.addHandles([r(()=>l.fileInfos.removeAll()),i(h),i(g),D,w,E],Z)}async _waitForActiveToolCleared(){let e=this.data.viewModel.view;if(e?.activeTool==null)return;let t=new AbortController;this.addHandles(a(t),Q),await m(()=>e?.activeTool==null,t.signal),t.abort()}};e([_()],$.prototype,`allowSave`,null),e([_()],$.prototype,`createFeatureState`,void 0),e([_()],$.prototype,`curveResizeDisabled`,null),e([_()],$.prototype,`curveUpdatesDisabled`,null),e([_()],$.prototype,`data`,void 0),e([_({constructOnly:!0})],$.prototype,`isNested`,void 0),e([_()],$.prototype,`formViewModel`,null),e([_()],$.prototype,`hasInvalidFormTemplate`,null),e([_()],$.prototype,`hasPendingEdits`,null),e([_()],$.prototype,`hasPreviousStep`,null),e([_()],$.prototype,`_getDrawMeshHelpMessage`,void 0),e([_()],$.prototype,`helpMessage`,null),e([_()],$.prototype,`noticeMessage`,null),e([_()],$.prototype,`layer`,null),e([_()],$.prototype,`parent`,null),e([_()],$.prototype,`keyboardCancellationEnabled`,null),e([_()],$.prototype,`reliesOnOwnerAdminPrivileges`,null),e([_()],$.prototype,`saveActionLabel`,null),e([_()],$.prototype,`shouldShowAttachments`,null),e([_()],$.prototype,`shouldAllowAttachmentEditing`,null),e([_()],$.prototype,`sketchUpdateOptions`,null),e([_()],$.prototype,`sketchViewModel`,null),e([_()],$.prototype,`availableCreateTools`,null),e([_()],$.prototype,`_attachmentsActive`,null),$=Y=e([v(`esri.widgets.Editor.legacy.CreateFeaturesWorkflow`)],$);function ge(e,t,n){let a=null,o=()=>e.snappingOptions.featureSources,s=()=>(a=new te({layer:t}),o().add(a),a),l=()=>{a!=null&&(o().remove(a),a=c(a))};return i([d(()=>{let e=n.creationInfo?.layer,t=o().find(t=>t.layer===e);return{hasFeatureLayerSource:!!t,enabled:t?.enabled??!1}},({hasFeatureLayerSource:e,enabled:t})=>{if(e)a??=s(),a.enabled=t;else return l()},h),r(l)])}function _e(e){let t=e.viewModel.view;if(!t)return[];let n=[];if(t.type===`3d`){let i=new A({view:t});n.push(d(()=>e.selectedPendingFeature,(e,t)=>{i.remove(e),i.add(t)}),r(()=>i.destroy()))}let i=new A({view:t,highlightName:M});return n.push(d(()=>e.temporaryHighlightFeature,e=>{i.removeAll(),i.add(e)}),r(()=>i.destroy())),n}function ve(e,t,n,r){let i=[];return t.forEach((t,a)=>{if(!t.error){let o=e[a],s=r.get(o)||[];o.attributes[n.objectIdField]=t.objectId,s.forEach(({form:e})=>i.push({feature:o,attachment:e}))}}),i}function ye(e){for(let t of e){let{sourceLayer:e}=t;e&&`globalIdField`in e&&e.globalIdField!=null&&(t.attributes[e.globalIdField]??=g())}}function be(e,t){let n=[];if(!t||t.size===0)return{addFeatures:e};for(let[e,r]of t)for(let{file:t}of r)n.push({feature:e,attachment:{globalId:g(),data:t}});return n.length?{addFeatures:e,addAttachments:n}:{addFeatures:e}}function xe(e,t){return e.map(e=>{let{addFeatures:n}=e;if(!n||n.length===0)return e;let r=[];for(let e of n){let n=t.get(e);if(n)for(let{file:t}of n)r.push({feature:e,attachment:{globalId:g(),data:t}})}return r.length?{...e,addAttachments:r}:e})}const Se=$;export{Se as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Error.js";import{makeHandle as r,handlesGroup as i,abortHandle as a}from"../../../core/handleUtils.js";import"../../../core/has.js";import o from"../../../core/Logger.js";import{removeMaybe as s,destroyMaybe as c}from"../../../core/maybe.js";import{isPromiseLike as l,debounce as u}from"../../../core/promiseUtils.js";import{watch as d,initial as f,sync as p,whenOnce as m,syncAndInitial as h}from"../../../core/reactiveUtils.js";import{generateBracedUUID as g}from"../../../core/uuid.js";import{property as _,subclass as v}from"../../../core/accessorSupport/decorators.js";import{isSharedTemplateOrMetadata as y,isSharedTemplate as b,getCreationAttributes as x,isStandardFeatureTemplate as ee}from"../../../editing/templateUtils.js";import{getFullTemplate as S}from"../../../editing/sharedTemplates/templateLoader.js";import C from"../../../layers/GraphicsLayer.js";import{isSceneLayer as w,isTable as T}from"../../../layers/support/layerUtils.js";import{isNumber as E}from"../../../support/guards.js";import{getDisplayedSymbol as D}from"../../../symbols/support/symbolUtils.js";import{updateGraphicSymbolWhenRequired as O}from"../../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as k}from"../../../views/draw/support/helpMessageUtils.js";import A from"../../../views/draw/support/HighlightHelper.js";import j from"../../../views/interactive/sketch/SketchOptions.js";import te from"../../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as M}from"../../../views/support/HighlightDefaults.js";import{isModelUpload as N,handleModelUpload as ne}from"../modelUploadUtils.js";import{activeSketchToolDrawsUnsupportedCurve as re,createToolFromGeometryType as ie,containsUnsupportedCurve as ae,findEditorItemForLayer as P,getServiceEditsFromWorkflowData as F,getServiceInfoForLayer as I,orderEditsByRelationshipDependencies as L,getServiceLayersById as R,startCreatingNewFeature as z,syncUpdateOptions as B,findLayerInfo as V,isTerminalUpdateEventType as H,getVisualVariableAttributes as U,startUpdatingFeatureGeometry as W,createWorkflowSteps as G,avoidFeatureTemplateSelectionWithOnlyOneItem as K,setUpSketchCreateWatchers as q,setRelationshipFields as J,showProgressCursor as oe,setVisualVariablesAndElevationInfoForUpdate as se,visualVariableInteractiveUpdate as ce}from"../workflowUtils.js";import le from"./CreateFeaturesWorkflowData.js";import ue from"./Workflow.js";import{prepareAttachmentsForCreateFeaturesWorkflow as de}from"./workflowUtils.js";import fe from"../../FeatureForm/FeatureFormViewModel.js";import pe from"../../Sketch/SketchViewModel.js";var Y;const me=Symbol(),X=Symbol(),Z=Symbol(),Q=Symbol(),he={point:[`point`],multipoint:[`multipoint`],polygon:[`polygon`,`freehandPolygon`,`rectangle`,`circle`],polyline:[`polyline`,`freehandPolyline`],mesh:[],multipatch:[]};let $=Y=class extends ue{constructor(e){super(e),this.type=`create-features`,this.createFeatureState=`create-new`,this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._formViewModel=new fe,this._sketchLayer=null,this._sketchViewModel=null,this._attachmentFileInfos=new Map,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get allowSave(){return!this.updating}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPendingEdits(){if(this.pendingFeatures.some(e=>!!this.data.getEditsForPendingFeature(e)?.modified))return!0;let{creationInfo:e,upload:t}=this.data,{activeComponent:n,createGraphic:r}=this._sketchViewModel,i=r?.geometry?.type;return!!((i===`polyline`||i===`polygon`||i===`multipoint`)&&(n?.type===`draw-2d`||n?.type===`draw-3d`)&&n.drawOperation.committedVertices.length>0||t&&(t.state===`pending`||t.state===`success`)||e?.geometryToPlace)}get hasPreviousStep(){return this._stepIndex>0||this.createFeatureState===`update-pending`&&!!this.data.selectedPendingFeature&&!this.parent&&!N(this.data.creationInfo)}get helpMessage(){let{creationInfo:e,viewModel:t}=this.data;if(this.stepId!==`creating-features`||!e)return;let{_sketchViewModel:n}=this,{drawTool:r,isUsingLegacyCreateTools:i}=n;if(!i)return r?.helpMessageKey??`noTool`;let a=e.layer.geometryType,o=n.createGraphic;if(a===`mesh`){this._getDrawMeshHelpMessage||import(`../../../views/draw/support/helpMessageUtils3d.js`).then(e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage});let{view:e}=t;return e?.type===`3d`?this._getDrawMeshHelpMessage?.(o,e):void 0}let{activeCreateToolDrawMode:s,activeTool:c}=n;return k(c===`rectangle`||c===`circle`?c:a,o?.geometry,s)}get noticeMessage(){if(re(this._sketchViewModel,this.data.editorItem))return`curveToolDensifyWarning`}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter(e=>this.data.isDisplayable(e)).length}get parent(){return this.data.parent}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return this.numPendingFeatures===0}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get saveActionLabel(){return`create`}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchUpdateOptions(){let{editorItem:e}=this.data;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!w(e?.layer)&&!!e?.capabilities.supportsTrueCurve}}}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){let e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e||this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(y(this.data.fullTemplate)){let{tool:t}=ie(e,this.data.fullTemplate);return[t]}return t?.type!==`2d`&&e===`multipoint`?[]:[...he[e]]}get _attachmentsActive(){let e=this.data.viewModel.attachmentsViewModel.mode,t=this.stepId;return this.shouldShowAttachments&&(e===`add`||e===`edit`||t===`adding-attachment`||t===`editing-attachment`)}getUpdating(){return!!this._sketchViewModel?.updating}async enter(){this._isActive=!0,this.stepId!==`awaiting-feature-creation-info`&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([Z])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),T(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(e){let{formViewModel:t}=this;if(t.pendingSubtypeChoice)return;t.submit(),this._stashValidationState();let n=this.data.selectedPendingFeature,r=this._hasValidationErrors(n)?n:this.data.pendingFeatures.find(e=>this._hasValidationErrors(e));if(r){await this._startUpdating({feature:r}),t?.submit();return}let{pendingFeatures:i,editorItem:a}=this.data;return a&&e&&ae(i.toArray(),a)&&!await e(`curveEditingDensifyPrompt`)?this.reset():super.save()}back(e){return this.createFeatureState===`update-pending`&&this.data.selectedPendingFeature&&!N(this.data.creationInfo)&&!this._attachmentsActive&&!this.parent?this._clearSelectedFeature():super.back(e)}previous(e){return this.createFeatureState===`update-pending`&&this.data.selectedPendingFeature&&!N(this.data.creationInfo)&&!this._attachmentsActive?this._clearSelectedFeature():super.previous(e)}cancelFeature(e){this.data.isSharedTemplateWorkflow?o.getLogger(this).warn(`Cannot cancel individual features created by shared templates.`):(this.data.removePendingFeature(e),this.sketchViewModel.removeGraphic(e))}static create(e){let{addAttachmentsCallback:t,applyEdits:n,applyEditsFeatureService:r,isNested:i,creationInfo:a,parent:o,snappingManager:s,startAt:c,viewModel:l}=e,u=e.sketchOptions??new j,d=a?.layer,f=d?P(l.editorItems,d):void 0,p=new Y({data:new le({creationInfo:a,editorItem:f,parent:o,sketchOptions:u,snappingManager:s,viewModel:l}),isNested:i,onCommit:async e=>{let{creationInfo:i}=e;if(!i)return;p._sketchViewModel.cancel();let a=e.pendingFeatures.toArray(),{layer:o}=i,s=o.capabilities?.editing.supportsGlobalId&&`globalIdField`in o,c=p._attachmentFileInfos,{fullTemplate:u}=e,d=F(p.data),f=b(u)&&d;if(s){if(ye(a),f){let t=xe(d,c),n=await I(o,l.view)?.load();n&&(t=L({edits:t,serviceInfo:n,view:l.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await r(u.featureService,t,{globalIdUsed:!0,honorSequenceOfEdits:!0,gdbVersion:u.layer.gdbVersion??void 0})}else{let e=be(a,c);await n(o,e,{globalIdUsed:!0})}return}let m=f?await r(u.featureService,d,{gdbVersion:u.layer.gdbVersion??void 0}):[await n(o,{addFeatures:a})];m&&c.size>0&&await Promise.all(m.map(e=>{if(e?.addFeatureResults)return t(o,ve(a,e.addFeatureResults,o,c))}))}});return p._set(`steps`,this._createWorkflowSteps(p,c)),p}_fadeExistingFeatures(e){if(`effect`in e){let t=e.effect;return e.effect=`saturate(0.6) opacity(0.8)`,r(()=>e.effect=t)}let t=e.opacity;return e.opacity=.7,r(()=>e.opacity=t)}async _initializeFullTemplateAndExecutorInfo(e){let{creationInfo:t}=e,{view:n}=e.viewModel;if(!t||!n)return null;let r=await S(n,t.template);if(e.fullTemplate=r,r&&b(r)){let{createTemplateExecutor:i}=await import(`../../../editing/sharedTemplates/executor/createTemplateExecutor.js`);e.templateExecutorInfo={completionResults:[],executor:await i(r),serviceLayersById:R(t.layer,n)}}return r}async _startCreating(){this.removeHandles(X);let{data:e}=this;if(!e.creationInfo)return;let t=this.data.creationInfo?.maxFeatures;t&&this.numPendingFeatures>=t?(this.sketchViewModel.cancel(),this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)})):(this.createFeatureState=`create-new`,await z(this._sketchViewModel,this._sketchLayer,e))}async _clearSelectedFeature(){let e=this._formViewModel.pendingSubtypeChoice;e&&(e.resolve(`undo`),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=s(this._featureFormHandle),this._formViewModel.feature=null;let t=this.data.viewModel.attachmentsViewModel;(t.mode===`add`||t.mode===`edit`)&&await this.data.viewModel.activeWorkflow?.previous()}_stashValidationState(){let e=this._formViewModel.feature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._formViewModel.submittable)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();let{data:n,pendingFeatures:r}=this;r.includes(e)||n.addPendingFeature(e,t),n.selectedPendingFeature=e;let{_formViewModel:a,_sketchViewModel:o,sketchUpdateOptions:c}=this,{creationInfo:l,viewModel:u}=n,{attachmentsViewModel:f,layerInfos:p,view:m}=u;if(!m||!l)return;B(o,c),s(this._featureFormHandle);let h=e.sourceLayer,g=V(p,h)?.formTemplate,_=m.spatialReference;a.set({editType:`INSERT`,feature:e,formTemplate:g,spatialReference:_,view:m}),(f.mode===`add`||f.mode===`edit`)&&await u.activeWorkflow?.previous(),f.graphic=e,f.fileInfos.removeAll(),f.mode=`view`,(this._attachmentFileInfos.get(e)||[]).forEach(({file:e,form:t})=>f.addFile(e,t)),await O(e,m.type===`2d`?m.scale:null);let v=n.getEditsForPendingFeature(e);this._featureFormHandle=i([a.on(`value-change`,async({fieldName:t,value:n})=>{if(v?.updateAttributes(a.getValues()),E(n)){let e=this._visualVariableAttributes;e.size&&!e.size.isUpdatingInteractively&&t===e.size.field&&e.size.setInitialValue(n),e.rotation&&!e.rotation.isUpdatingInteractively&&t===e.rotation.field&&e.rotation.setInitialValue(n)}await O(e,m.type===`2d`?m.scale:null)}),o.on([`update`,`undo`,`redo`],e=>{(e.type===`undo`||e.type===`redo`||e.type===`update`&&e.toolEventInfo!=null&&H(e.toolEventInfo.type))&&a.notifyFeatureGeometryChanged()}),d(()=>a.feature?.sourceLayer,t=>e.sourceLayer=t),d(()=>[a.feature,a.submittable],()=>this._stashValidationState())]),this.createFeatureState=`update-pending`}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});let{_sketchLayer:n,_sketchViewModel:r,data:i}=this,{creationInfo:a,viewModel:o}=i,{view:s}=o;if(!s||!a)return;let c=e.sourceLayer??a.layer;if(!T(c))return this._visualVariableAttributes=U(e),W({graphic:e,sketchLayer:n,sketchViewModel:r,sourceLayer:c,updateOptions:this.sketchUpdateOptions,visualVariables:this._visualVariableAttributes})}static _createWorkflowSteps(e,t=`awaiting-feature-creation-info`){let{data:n}=e,r=n.creationInfo?.layer,i=G([`awaiting-feature-creation-info`,`creating-features`,`adding-attachment`,`editing-attachment`],t,{"awaiting-feature-creation-info":()=>({id:`awaiting-feature-creation-info`,async setUp(){let{creationInfo:t,viewModel:i}=n,{view:a}=i;a&&(N(t)?e.addHandles(await ne({view:a,data:n,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(r&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(r),this.id),e.addHandles(i.featureTemplatesViewModel.on(`select`,({item:t})=>{t&&(n.creationInfo={...n.creationInfo,layer:t.layer,template:t.template},e.next())}),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:`creating-features`,async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){let{viewModel:r}=n;t.canceled&&(e.removeHandles([Z,me,X,Q]),r.attachmentsViewModel.fileInfos.removeAll(),e._attachmentFileInfos.clear())}}),"adding-attachment":()=>({id:`adding-attachment`,parent:`creating-features`,async setUp(){},async tearDown(){let{attachmentsViewModel:t}=n.viewModel,{graphic:r,fileInfos:i}=t;e._attachmentFileInfos.set(r,i.toArray()),t.mode=`view`}}),"editing-attachment":()=>({id:`editing-attachment`,parent:`creating-features`,async setUp(){},async tearDown(){let{attachmentsViewModel:t}=n.viewModel,{graphic:r,fileInfos:i}=t;e._attachmentFileInfos.set(r,i.toArray()),t.mode=`view`}})});return K(n,i)}static _configureSketchViewModel(e){let{data:t,_sketchLayer:n,_sketchViewModel:a}=e,{creationInfo:o,viewModel:s}=t,{view:c}=s,l=[];if(!c)return r();if(c.type===`2d`){o&&l.push(e._fadeExistingFeatures(o.layer));let t=u((e,t)=>Promise.all(e.map(e=>O(e,t))));l.push(d(()=>c.scale,e=>t(n.graphics,e)))}let f=x(t.fullTemplate,o?.attributeOverrides,o?.layer),p=d(()=>a.createGraphic&&a.activeComponent,()=>{a.createGraphic&&a.activeComponent&&!e.hasHandles(X)&&e._updatingHandles.consumePromise(q({creationAttributes:f,data:t,sketchViewModel:a,view:c}).then(t=>e.addHandles(t,X)))}),m=async t=>{if((t.state===`cancel`||t.state===`complete`)&&e.removeHandles(X),t.state===`cancel`&&c.activeTool!==null&&c.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),t.state===`complete`&&t.graphic){let n=await e._processEdits(t.graphic,{scale:c.type===`2d`?c.scale:null,useSourceLayer:!0});n&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:n}))}},h=async r=>{let{attachmentsViewModel:i}=s,{_formViewModel:l}=e;if(r.graphics.length>1){await e._clearSelectedFeature();return}let u=r.graphics[0];if(r.state===`complete`){let{submittable:t}=l;if(e.numPendingFeatures!==o?.maxFeatures&&t||l.submit(),await e._clearSelectedFeature(),(i.mode===`add`||i.mode===`edit`)&&await s.activeWorkflow?.previous(),e.data.selectedPendingFeature==null&&(c.activeTool==null||c.activeTool===e.sketchViewModel.activeComponent)&&(await e.sketchViewModel.wait(),e.sketchViewModel.state===`ready`&&e.data.creationInfo?.layer.geometryType!==`mesh`))return e._startCreating()}else if(r.state===`start`)return u.sourceLayer??=t.creationInfo?.layer,await se({graphic:u,sketchLayer:n,sketchViewModel:a,visualVariables:e._visualVariableAttributes,sourceLayer:u.sourceLayer}),e._selectFeatureForUpdate({feature:u});else if(r.state===`active`){await e.updatePendingFeature(u);let t=e._visualVariableAttributes;ce(c,u,r,t)&&await O(u,c.type===`2d`?c.scale:null);let n=u.attributes,{rotation:i,size:a}=t;if(i!=null){let{field:e}=i;l.setValue(e,n[e])}if(a!=null){let{field:e}=a;l.setValue(e,n[e])}}},g=async n=>{if(n.graphics.forEach(e=>{t.removePendingFeature(e)}),!N(t.creationInfo))return e._startCreating()},_=async()=>{if(N(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};l.push(p,a.on(`create`,t=>e._updatingHandles.addPromise(m(t))),a.on(`update`,t=>e._updatingHandles.addPromise(h(t))),a.on(`delete`,t=>e._updatingHandles.addPromise(g(t))),e._updatingHandles.addWhen(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(_())),r(()=>{a.cancel()}),ge(a,n,t),..._e(t));let v=i(l);return a.addHandles(v),v}_initializeSketchViewModel(){let{data:e}=this,{view:t}=e.viewModel,n=new C({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:`hide`,title:`createFeaturesWorkflow-internal`}),i=new pe({layer:n,creationMode:`single`,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:t});this._sketchLayer=n,this._sketchViewModel=i,t?.map.add(n),this.addHandles([r(()=>{t?.destroyed||t?.map.remove(n),c(n)}),d(()=>this.numPendingFeatures>0,e=>this._sketchViewModel.updateOnGraphicClick=e,f),d(()=>this.sketchUpdateOptions,e=>{i.defaultUpdateOptions=e,B(i,e)},p)])}_hasValidationErrors(e){return e?!this.data.isSubmittable(e)||!!this._formViewModel.validateContingencyConstraints(e.attributes,{includeIncompleteViolations:!0})?.length:!1}async _processEdits(e,t){let{data:n,_formViewModel:r,_sketchLayer:i}=this,{layerInfos:a,view:o}=n.viewModel;r.editType=`INSERT`,r.spatialReference=o?.spatialReference,r.view=o;let{templateExecutorInfo:s}=n;if(!s){let t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}i.remove(e);let{executor:c}=s,u=c(e.geometry,`completion`),d=l(u)?await u:u;s.completionResults.push(d),J(d.relationships),r.editType=`INSERT`,r.spatialReference=o?.spatialReference,r.view=o,d.primary&&n.creationInfo?.attributeOverrides&&(d.primary.graphic.attributes={...d.primary.graphic.attributes,...n.creationInfo.attributeOverrides});for(let e of d.edits){let n=null;if(e.addFeatures)for(let r of e.addFeatures){let e=r.clone();e.geometry=null,r.geometry!=null&&(r.symbol=await D(r,t),i.add(r)),r.sourceLayer!==n?.layer&&(n=V(a,r.sourceLayer));let o=!!d.associationGraphics?.has(r);await this._addAndInitializeEdits(r,e,n,o)}}return r.feature=null,await m(()=>!r.updating),d.edits.reduce((e,t)=>e+(t.addFeatures?.length??0),0)>1?null:d.primary?.graphic}async _addAndInitializeEdits(e,t,n,r=!1){let{data:i,_formViewModel:a}=this,{layerInfos:o}=i.viewModel,s=i.addPendingFeature(e,t,{isAssociation:r});n??=V(o,e.sourceLayer),a.feature=e,a.formTemplate=n?.formTemplate,await m(()=>!a.updating),s.updateAttributes(a.getValues()),s.submittable=a.submittable}async _setUpCreatingFeaturesStep(){if(this.hasHandles(Z))return;let{data:e,sketchViewModel:a}=this,{creationInfo:o,viewModel:c}=e,{attachmentsViewModel:l,view:u}=c;if(!u||!o?.layer)throw new n(`missing-parameters`,`CreateFeaturesWorkflow requires a view and creationInfo.`);let{initialFeature:p,layer:m}=o,h=[],g=[];this._featureFormHandle=s(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=P(c.editorItems,o.layer),o.template&&(e.fullTemplate??await this._initializeFullTemplateAndExecutorInfo(e),g.push(r(()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])}))),a.allowDeleteKey=!e.isSharedTemplateWorkflow,de(l),h.push(d(()=>l.mode,e=>{switch(e){case`add`:this.go(`adding-attachment`);break;case`edit`:this.go(`editing-attachment`)}}));let _=oe(u);h.push(_);let v=T(o.layer),{template:b}=o,S=!b||ee(b)||y(b)&&b.type===`feature`,C=v&&S;try{if(C){let n=p??new t({attributes:x(e.fullTemplate,o.attributeOverrides,m),sourceLayer:m}),r=await this._processEdits(n);r&&await this._startUpdating({feature:r})}else h.push(Y._configureSketchViewModel(this)),p?(N(o)&&o.geometryToPlace&&(p.attributes=x(e.fullTemplate,o.attributeOverrides,m)),a.addGraphic(p),await this._startUpdating({feature:p})):await this._startCreating()}finally{_.remove()}let w=r(()=>{for(let t of e.pendingFeatures)a.removeGraphic(t),e.removePendingFeature(t)}),E=d(()=>u?.timeZone,e=>this.data.timeZone=e,f),D=r(()=>{N(o)&&c.cancelWorkflow({warnIfNoWorkflow:!1})});this._featureFormHandle&&h.push(this._featureFormHandle),this.addHandles(h,this._handleKeys.beforeCommit),this.addHandles(g,this._handleKeys.afterCommit),this.addHandles([r(()=>l.fileInfos.removeAll()),i(h),i(g),D,w,E],Z)}async _waitForActiveToolCleared(){let e=this.data.viewModel.view;if(e?.activeTool==null)return;let t=new AbortController;this.addHandles(a(t),Q),await m(()=>e?.activeTool==null,t.signal),t.abort()}};e([_()],$.prototype,`allowSave`,null),e([_()],$.prototype,`createFeatureState`,void 0),e([_()],$.prototype,`curveResizeDisabled`,null),e([_()],$.prototype,`curveUpdatesDisabled`,null),e([_()],$.prototype,`data`,void 0),e([_({constructOnly:!0})],$.prototype,`isNested`,void 0),e([_()],$.prototype,`formViewModel`,null),e([_()],$.prototype,`hasInvalidFormTemplate`,null),e([_()],$.prototype,`hasPendingEdits`,null),e([_()],$.prototype,`hasPreviousStep`,null),e([_()],$.prototype,`_getDrawMeshHelpMessage`,void 0),e([_()],$.prototype,`helpMessage`,null),e([_()],$.prototype,`noticeMessage`,null),e([_()],$.prototype,`layer`,null),e([_()],$.prototype,`parent`,null),e([_()],$.prototype,`keyboardCancellationEnabled`,null),e([_()],$.prototype,`reliesOnOwnerAdminPrivileges`,null),e([_()],$.prototype,`saveActionLabel`,null),e([_()],$.prototype,`shouldShowAttachments`,null),e([_()],$.prototype,`shouldAllowAttachmentEditing`,null),e([_()],$.prototype,`sketchUpdateOptions`,null),e([_()],$.prototype,`sketchViewModel`,null),e([_()],$.prototype,`availableCreateTools`,null),e([_()],$.prototype,`_attachmentsActive`,null),$=Y=e([v(`esri.widgets.Editor.legacy.CreateFeaturesWorkflow`)],$);function ge(e,t,n){let a=null,o=()=>e.snappingOptions.featureSources,s=()=>(a=new te({layer:t}),o().add(a),a),l=()=>{a!=null&&(o().remove(a),a=c(a))};return i([d(()=>{let e=n.creationInfo?.layer,t=o().find(t=>t.layer===e);return{hasFeatureLayerSource:!!t,enabled:t?.enabled??!1}},({hasFeatureLayerSource:e,enabled:t})=>{if(e)a??=s(),a.enabled=t;else return l()},h),r(l)])}function _e(e){let t=e.viewModel.view;if(!t)return[];let n=[];if(t.type===`3d`){let i=new A({view:t});n.push(d(()=>e.selectedPendingFeature,(e,t)=>{i.remove(e),i.add(t)}),r(()=>i.destroy()))}let i=new A({view:t,highlightName:M});return n.push(d(()=>e.temporaryHighlightFeature,e=>{i.removeAll(),i.add(e)}),r(()=>i.destroy())),n}function ve(e,t,n,r){let i=[];return t.forEach((t,a)=>{if(!t.error){let o=e[a],s=r.get(o)||[];o.attributes[n.objectIdField]=t.objectId,s.forEach(({form:e})=>i.push({feature:o,attachment:e}))}}),i}function ye(e){for(let t of e){let{sourceLayer:e}=t;e&&`globalIdField`in e&&e.globalIdField!=null&&(t.attributes[e.globalIdField]??=g())}}function be(e,t){let n=[];if(!t||t.size===0)return{addFeatures:e};for(let[e,r]of t)for(let{file:t}of r)n.push({feature:e,attachment:{globalId:g(),data:t}});return n.length?{addFeatures:e,addAttachments:n}:{addFeatures:e}}function xe(e,t){return e.map(e=>{let{addFeatures:n}=e;if(!n||n.length===0)return e;let r=[];for(let e of n){let n=t.get(e);if(n)for(let{file:t}of n)r.push({feature:e,attachment:{globalId:g(),data:t}})}return r.length?{...e,addAttachments:r}:e})}const Se=$;export{Se as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{throttle as t}from"../../../core/throttle.js";import{formatDecimal as n,formatAngleDegrees as r}from"../../../core/unitFormatUtils.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import o from"../../Widget.js";import{statisticsCss as s}from"../css.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import{throttle as t}from"../../../core/throttle.js";import{formatDecimal as n,formatAngleDegrees as r}from"../../../core/unitFormatUtils.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import o from"../../Widget.js";import{statisticsCss as s}from"../css.js";import{getConfig as c,notAvailable as l}from"../support/constants.js";import{loadCalciteComponents as u}from"../../support/componentsUtils.js";import{messageBundle as d,tsx as f}from"../../support/widget.js";let p=class extends o{constructor(e,n){super(e,n),this._updateLayout=e=>{let t=e.parentElement,n=e.style.display;t?.removeChild(e),document.body.appendChild(e),e.style.display=`block`;let r=80;for(let t of e.childNodes)t instanceof HTMLElement&&(r=Math.max(r,t.offsetWidth));document.body.removeChild(e),t?.appendChild(e),e.style.display=n,e.style.setProperty(`--max-width`,`${r}px`)},this._updateLayoutThrottled=t(this._updateLayout,100)}loadDependencies(){return u({icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`)})}initialize(){this.addHandles(this._updateLayoutThrottled)}render(){return f(`div`,{afterCreate:this._updateLayout,afterUpdate:this._updateLayoutThrottled,bind:this,class:s.base},this._renderStatistics())}_renderStatistics(){let e=this._messages?.statistics;return e?[this._renderDistanceStatistic(`maxDistance`,e.maxDistance),this._renderElevationStatistic(`elevationGain`,e.gain),this._renderElevationStatistic(`elevationLoss`,e.loss),this._renderElevationStatistic(`minElevation`,e.minElevation),this._renderElevationStatistic(`maxElevation`,e.maxElevation),this._renderElevationStatistic(`avgElevation`,e.avgElevation),this._renderSlopeStatistic(`maxPositiveSlope`,`maxNegativeSlope`,e.maxSlope),this._renderSlopeStatistic(`avgPositiveSlope`,`avgNegativeSlope`,e.avgSlope)]:[]}_renderDistanceStatistic(e,t){let r=c().formatPrecision,i=this._renderValue(e,e=>{let t=this.effectiveUnits.distance;return n(this._messagesUnits,e,t,r)});return this._renderStatistic(t,i)}_renderElevationStatistic(e,t){let r=c().formatPrecision,i=this._renderValue(e,e=>{let t=this.effectiveUnits.elevation;return n(this._messagesUnits,e,t,r)});return this._renderStatistic(t,i)}_renderSlopeStatistic(e,t,n){let i=c().formatPrecision,a=f(`div`,{class:s.slopeValue,key:`slope-up`},f(`calcite-icon`,{icon:`arrow-up`,scale:`s`}),this._renderValue(e,e=>r(e,`degrees`,`geographic`,`geographic`,i)),f(`calcite-icon`,{icon:`arrow-down`,scale:`s`}),this._renderValue(t,e=>r(e,`degrees`,`geographic`,`geographic`,i)));return this._renderStatistic(n,a)}_renderStatistic(e,t){return f(`div`,{class:s.statistic},f(`label`,{class:s.statisticLabel},e),f(`div`,{class:s.statisticValue},t))}_renderValue(e,t){let n=this.line,r=(n.progress===1?n.statistics:null)?.[e];return r==null?l:t(r)}};e([i()],p.prototype,`effectiveUnits`,void 0),e([i()],p.prototype,`line`,void 0),e([i(),d(`esri/widgets/ElevationProfile/t9n/ElevationProfile`)],p.prototype,`_messages`,void 0),e([i(),d(`esri/core/t9n/Units`)],p.prototype,`_messagesUnits`,void 0),p=e([a(`esri.widgets.ElevationProfile.components.Statistics`)],p);export{p as Statistics};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import*as e from"@amcharts/amcharts5/index.js";import{XYChart as t,ValueAxis as n,AxisRendererX as r,AxisRendererY as i,XYCursor as a,LineSeries as o}from"@amcharts/amcharts5/xy.js";import s from"@amcharts/amcharts5/themes/Dark.js";import c from"@amcharts/amcharts5/themes/Responsive.js";import{formatNumber as l,substitute as u}from"../../../intl.js";import{handlesGroup as d,makeHandle as f}from"../../../core/handleUtils.js";import"../../../core/has.js";import{throwIfAborted as p}from"../../../core/promiseUtils.js";import{signal as m}from"../../../core/signal.js";import{unitName as h,formatDecimal as g}from"../../../core/unitFormatUtils.js";import{convertUnit as _}from"../../../core/units.js";import{getEpsilon as v}from"../../../core/libs/gl-matrix-2/math/common.js";import{isDarkMode as ee}from"../../../support/modeUtils.js";import{getConfig as y,notAvailable as b}from"./constants.js";import{getTranslatedLineTitle as x}from"./intlUtils.js";import{niceScale as S}from"./niceScale.js";import{binaryFindClosest as te}from"./profileUtils.js";import{createRoot as ne}from"../../support/chartUtilsAm5.js";import{isRTL as C}from"../../support/widget.js";const w=`#f8f8f8`,T=`#a9a9a9`,E=`#323232`,D=.001,O={fontFamily:`Avenir Next`,paddingBottom:6,paddingLeft:0,paddingRight:0,paddingTop:0,axisGridStroke:`#f4f4f4`,axisLabelsFontSize:9,axisLabelsFontWeight:`400`,axisLabelsColor:T,axisTooltipFontSize:12,axisTooltipBackgroundColor:E,axisTooltipLabelColor:w,axisTooltipPaddingTop:3,axisTooltipPaddingBottom:3,axisTooltipPaddingHorizontal:4,xAxisMinGridDistance:50,xAxisLabelsSpacing:6,xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:4,yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:w,seriesTooltipLabelColor:E,seriesFillLighten:.9,seriesTooltipSpacing:6,seriesTooltipPaddingVertical:4,seriesTooltipPaddingHorizontal:4},k={...O,axisGridStroke:E,axisLabelsColor:T,axisTooltipBackgroundColor:E,axisTooltipLabelColor:w,seriesTooltipBackgroundColor:E,seriesTooltipLabelColor:w,seriesFillLighten:-.75},A={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function re(e){let a=await ne(e.container);p(e.abortOptions);let o=ee(e.container),l=o?k:O;a.setThemes(o?[c.new(a),s.new(a)]:[c.new(a)]);let u=C(e.container),f=a.container.children.push(t.new(a,{panX:!0,panY:!0,paddingTop:l.paddingTop,paddingBottom:l.paddingBottom,paddingLeft:u?l.paddingRight:l.paddingLeft,paddingRight:u?l.paddingLeft:l.paddingRight,maxTooltipDistance:-1}));f.zoomOutButton.set(`forceHidden`,!0);let h=f.xAxes.push(n.new(a,{renderer:r.new(a,{})})),g=f.yAxes.push(n.new(a,{renderer:i.new(a,{})})),_=m(null),v=m(`loading`),y={params:e,chart:f,xAxis:h,yAxis:g,seriesInfos:new Map,messages:null,theme:l,pointerIsOver:!1,rtl:u,onCursorPositionChange:e.onCursorPositionChange,onRangeChange:e.onRangeChange,get state(){return v.value},get data(){return _.value},set data(e){_.value=e}};N(y),ie(y),M(y);let b=d([U(y),G(y),$(a.events.once(`frameended`,()=>{v.value=`ready`})),$(a)]),x;return{destroy:()=>{b.remove(),v.value=`destroyed`},update:e=>{(e.data!==y.data||e.messages!==y.messages)&&(j(y)||ae(y,e))},zoomOut:()=>P(y),test:x}}function j(e){return e.state===`destroyed`}function M({chart:e,xAxis:t,yAxis:n}){let r=a.new(e.root,{behavior:`none`,xAxis:t,yAxis:n,snapToSeriesBy:`y`});r.lineY.set(`visible`,!1),e.set(`cursor`,r)}function N(t){let{chart:n,xAxis:r,theme:i}=t;r.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:J(t,`distance`),strictMinMax:!0,strictMinMaxSelection:!0}),r.axisHeader.set(`forceHidden`,!0);let a=r.get(`renderer`);a.setAll({inside:!1,minGridDistance:i.xAxisMinGridDistance}),a.labels.template.setAll({centerX:e.p0,centerY:e.p0,fill:e.color(i.axisLabelsColor),fontFamily:i.fontFamily,fontSize:i.axisLabelsFontSize,fontWeight:i.axisLabelsFontWeight,maxPosition:i.xAxisMaxLabelPosition,minPosition:i.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:i.xAxisLabelsSpacing});let o=r.set(`tooltip`,e.Tooltip.new(n.root,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));o.get(`background`)?.setAll({fill:e.color(i.axisTooltipBackgroundColor),stroke:void 0}),o.label.setAll({fill:e.color(i.axisTooltipLabelColor),fontFamily:i.fontFamily,fontSize:i.axisTooltipFontSize,paddingBottom:i.axisTooltipPaddingBottom,paddingLeft:i.axisTooltipPaddingHorizontal,paddingRight:i.axisTooltipPaddingHorizontal,paddingTop:i.axisTooltipPaddingTop,direction:t.rtl?`rtl`:`ltr`}),a.grid.template.setAll({strokeOpacity:1,stroke:e.color(i.axisGridStroke)})}function ie(t){let{yAxis:n,theme:r,rtl:i}=t;n.setAll({baseValue:y().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:J(t,`elevation`),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),n.axisHeader.set(`visible`,!1);let a=n.get(`renderer`);a.setAll({minGridDistance:r.yAxisMinGridDistance,opposite:i,inside:!0}),a.labels.template.setAll({centerX:e.p0,centerY:e.p100,fill:e.color(r.axisLabelsColor),fontFamily:r.fontFamily,fontSize:r.axisLabelsFontSize,fontWeight:r.axisLabelsFontWeight,maxPosition:r.yAxisMaxLabelPosition,minPosition:r.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:i?0:r.yAxisLabelSpacing,paddingRight:i?r.yAxisLabelSpacing:0,paddingTop:0,textAlign:`start`}),a.grid.template.setAll({strokeOpacity:1,stroke:e.color(r.axisGridStroke)})}function ae(e,t){if(j(e))return;let n=e.data??void 0,r=t.data??void 0,i=n!==r,a=n?.effectiveUnits!==r?.effectiveUnits,o=n?.uniformScaling!==r?.uniformScaling;e.data=r,e.messages=t.messages,(i||a)&&(oe(e),R(e)),o&&P(e),K(e)}function P(e){j(e)||(e.xAxis.zoom(0,1),e.yAxis.zoom(0,1))}function oe(e){let{chart:t,data:n,xAxis:r,yAxis:i}=e,{minX:a,maxX:o,minY:s,maxY:c}=F({data:n,pixelWidth:r.width(),pixelHeight:i.height()}),l=!!n?.uniformScaling,u=!!n?.refined;t.setAll({panX:!0,panY:l,pinchZoomX:u,pinchZoomY:u&&l,wheelX:`panX`,wheelY:u?l?`zoomXY`:`zoomX`:`none`}),r.setAll({max:o,min:a,panX:!0,panY:!1,zoomX:!0,zoomY:l}),i.setAll({max:c,min:s,panX:!1,panY:l,zoomX:l,zoomY:l})}function F({data:e,pixelWidth:t,pixelHeight:n}){if(e==null)return A;let r=e.statistics,i=r?.maxDistance,a=r?.minElevation,o=r?.maxElevation;if(i==null||a==null||o==null)return A;let s=Math.max(i-0,D),c=Math.max(o-a,D),l=e.effectiveUnits;if(e.dynamicElevationRange){let e=_(s,l.distance,l.elevation);c=Math.max(c,e/y().maxChartRatio)}return a-=.02*c,o=a+c+.1*c,[a,o]=S(a,o,10),c=o-a,e.uniformScaling?I({data:e,bounds:{minX:0,maxX:i,minY:a,maxY:o},pixelWidth:t,pixelHeight:n,centered:!0}):{minX:0,maxX:0+s,minY:a,maxY:a+c}}function I({data:e,bounds:t,pixelWidth:n,pixelHeight:r,centered:i}){if(e==null)return t;let{minX:a,maxX:o,minY:s,maxY:c}=t;if(a==null||o==null||s==null||c==null)return A;let l=o-a,u=c-s,d=e.effectiveUnits,f=_(u,d.elevation,d.distance),p=l/n,m=f/r/p;return m>=1?[a,o]=L([a,o],m):[s,c]=L([s,c],1/m),{minX:a,maxX:o,minY:s,maxY:c}}function L([e,t],n,r){let i=(t-e)*n;{let n=(e+t)/2-i/2;return[n,n+i]}}function R(e){let{chart:t,data:n,seriesInfos:r,xAxis:i,yAxis:a}=e;if(n==null||n.lines.length===0){t.series.clear();return}let o=new Map,s=new Set(t.series.values),c=n.lines.length;for(let i=0;i<c;i++){let a=n.lines[i],l=r.get(a.id);l?(l.fill&&s.delete(l.fill),s.delete(l.line)):(l=B(e,a),l.fill&&t.series.push(l.fill),t.series.push(l.line)),o.set(l.id,l);let u=c-i-1;l.fill?.set(`layer`,u),l.line.set(`layer`,c+u),z(e,l,a)}e.seriesInfos=o;for(let e of s)t.series.removeValue(e);i.set(`layer`,c+1),a.set(`layer`,c+2)}function z({theme:t},n,r){let i=e.color(r.color.toCss()),a=r.samples??[],o=a.length>0,{line:s,fill:c}=n;s.set(`visible`,o),s.set(`stroke`,i),c?.set(`visible`,o),c?.set(`fill`,e.Color.lighten(i,t.seriesFillLighten)),s.data.setAll(a),c?.data.setAll(a)}function B(e,t){let{id:n}=t,r=V(e,`line-${n}`);r.setAll({dy:t.chartStrokeOffsetY,tooltip:void 0}),r.strokes.template.setAll({strokeWidth:t.chartStrokeWidth});let i=null;return t.chartFillEnabled&&(i=V(e,`fill-${n}`),i.fills.template.setAll({fillOpacity:1,visible:!0})),{id:n,line:r,fill:i}}function V(e,t){return o.new(e.chart.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:t,stroke:void 0,valueXField:`distance`,valueYField:`elevation`,xAxis:e.xAxis,yAxis:e.yAxis})}function H({theme:t,chart:n,rtl:r}){let i=e.Tooltip.new(n.root,{autoTextColor:!1,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:`vertical`,visible:!1}),a=t.seriesTooltipPaddingHorizontal,o=t.seriesTooltipPaddingVertical;return i.label.setAll({fill:e.color(t.seriesTooltipLabelColor),fontFamily:t.fontFamily,fontSize:t.seriesTooltipFontSize,paddingBottom:o,paddingLeft:a,paddingRight:a,paddingTop:o,textAlign:r?`end`:`start`,direction:`ltr`}),i.get(`background`)?.setAll({stroke:void 0,fill:e.color(t.seriesTooltipBackgroundColor)}),i.adapters.add(`dy`,e=>{let n=t.seriesTooltipSpacing,r=i.get(`pointTo`)?.y??0;return(e??0)+(i.y()>r?n:-n)}),i}function U(e){let{xAxis:t,yAxis:n}=e,r=()=>{e.onRangeChange(W(t),W(n))},i=e=>[e.on(`start`,r),e.on(`end`,r)];return Q([...i(t),...i(n)])}function W(e){let t=Math.abs((e.get(`end`)??0)-(e.get(`start`)??0)),n=t===0?1:1/t;return Math.abs(1-n)<v()?1:n}function G(e){let{chart:t}=e,n=t.plotContainer.events,r=t=>{e.pointerIsOver=t,K(e)},i=()=>{r(!1),e.onCursorPositionChange(null,null)};return Q([n.on(`pointerover`,()=>r(!0)),n.on(`pointerout`,i),n.on(`blur`,i)])}function K(e){let{chart:t,data:n,xAxis:r,yAxis:i}=e,o=t.get(`cursor`);if(!n?.refined){o?.events.removeType(`cursormoved`),o?.dispose(),t.set(`cursor`,void 0);return}if(!o){let n=a.new(t.root,{behavior:`none`,xAxis:r,yAxis:i,snapToSeriesBy:`y`});n.lineY.set(`visible`,!1),n.events.on(`cursormoved`,se(e)),t.set(`cursor`,n)}let s=ce(e);s?e.seriesInfos.forEach(t=>{let n=t.line.get(`tooltip`)??H(e);n.label.set(`text`,s),t.line.set(`tooltip`,n)}):e.seriesInfos.forEach(e=>{e.line.get(`tooltip`)?.dispose(),e.line.set(`tooltip`,void 0)}),e.xAxis.getTooltip().setAll({tooltipText:de(e)})}function se(e){return()=>{if(!e.pointerIsOver)return;K(e);let{chart:t,xAxis:n,yAxis:r}=e,i=t.get(`cursor`),a=i?.getPrivate(`positionX`)??0,o=i?.getPrivate(`positionY`)??0,s=e.data;if(s?.statistics!=null){let{maxDistance:e,minElevation:t,maxElevation:i}=s.statistics,c,l;e!=null&&(W(n)===1?(c=0,l=e):(c=X(n),l=Z(n)),a=q(a,c,l,0,e)),t!=null&&i!=null&&(W(r)===1?(c=t,l=i):(c=X(r),l=Z(r)),o=q(o,c,l,t,i))}e.onCursorPositionChange(a,o)}}function q(e,t,n,r,i){return(t+e*(n-t)-r)/(i-r)}function ce(e){let{data:t}=e,n=t?.lines.map(t=>({line:t,y:Y(e,t)?.elevation})).sort(le);return!n||n.length===0||n[0].y==null?null:n.map(({y:t,line:n})=>ue(e,n,t)).join(`
|
|
2
|
+
import*as e from"@amcharts/amcharts5/index.js";import{XYChart as t,ValueAxis as n,AxisRendererX as r,AxisRendererY as i,XYCursor as a,LineSeries as o}from"@amcharts/amcharts5/xy.js";import s from"@amcharts/amcharts5/themes/Dark.js";import c from"@amcharts/amcharts5/themes/Responsive.js";import{formatNumber as l,substitute as u}from"../../../intl.js";import{handlesGroup as d,makeHandle as f}from"../../../core/handleUtils.js";import"../../../core/has.js";import{throwIfAborted as p}from"../../../core/promiseUtils.js";import{signal as m}from"../../../core/signal.js";import{unitName as h,formatDecimal as g}from"../../../core/unitFormatUtils.js";import{convertUnit as _}from"../../../core/units.js";import{getEpsilon as v}from"../../../core/libs/gl-matrix-2/math/common.js";import{isDarkMode as ee}from"../../../support/modeUtils.js";import{getConfig as y,notAvailable as b}from"./constants.js";import{getTranslatedLineTitle as x}from"./intlUtils.js";import{niceScale as S}from"./niceScale.js";import{binaryFindClosest as te}from"./profileUtils.js";import{createRoot as ne}from"../../support/chartUtilsAm5.js";import{isRTL as C}from"../../support/widget.js";const w=`#f8f8f8`,T=`#a9a9a9`,E=`#323232`,D=.001,O={fontFamily:`Avenir Next`,paddingBottom:6,paddingLeft:0,paddingRight:0,paddingTop:0,axisGridStroke:`#f4f4f4`,axisLabelsFontSize:9,axisLabelsFontWeight:`400`,axisLabelsColor:T,axisTooltipFontSize:12,axisTooltipBackgroundColor:E,axisTooltipLabelColor:w,axisTooltipPaddingTop:3,axisTooltipPaddingBottom:3,axisTooltipPaddingHorizontal:4,xAxisMinGridDistance:50,xAxisLabelsSpacing:6,xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:4,yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:w,seriesTooltipLabelColor:E,seriesFillLighten:.9,seriesTooltipSpacing:6,seriesTooltipPaddingVertical:4,seriesTooltipPaddingHorizontal:4},k={...O,axisGridStroke:E,axisLabelsColor:T,axisTooltipBackgroundColor:E,axisTooltipLabelColor:w,seriesTooltipBackgroundColor:E,seriesTooltipLabelColor:w,seriesFillLighten:-.75},A={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function re(e){let a=await ne(e.container);p(e.abortOptions);let o=ee(e.container),l=o?k:O;a.setThemes(o?[c.new(a),s.new(a)]:[c.new(a)]);let u=C(e.container),f=a.container.children.push(t.new(a,{panX:!0,panY:!0,paddingTop:l.paddingTop,paddingBottom:l.paddingBottom,paddingLeft:u?l.paddingRight:l.paddingLeft,paddingRight:u?l.paddingLeft:l.paddingRight,maxTooltipDistance:-1}));f.zoomOutButton.set(`forceHidden`,!0);let h=f.xAxes.push(n.new(a,{renderer:r.new(a,{})})),g=f.yAxes.push(n.new(a,{renderer:i.new(a,{})})),_=m(null),v=m(`loading`),y={params:e,chart:f,xAxis:h,yAxis:g,seriesInfos:new Map,messages:null,theme:l,pointerIsOver:!1,rtl:u,onCursorPositionChange:e.onCursorPositionChange,onRangeChange:e.onRangeChange,get state(){return v.value},get data(){return _.value},set data(e){_.value=e}};N(y),ie(y),M(y);let b=d([U(y),G(y),$(a.events.once(`frameended`,()=>{v.value=`ready`})),$(a)]),x;return{destroy:()=>{b.remove(),v.value=`destroyed`},update:e=>{e.data===y.data&&e.messages===y.messages||j(y)||ae(y,e)},zoomOut:()=>P(y),test:x}}function j(e){return e.state===`destroyed`}function M({chart:e,xAxis:t,yAxis:n}){let r=a.new(e.root,{behavior:`none`,xAxis:t,yAxis:n,snapToSeriesBy:`y`});r.lineY.set(`visible`,!1),e.set(`cursor`,r)}function N(t){let{chart:n,xAxis:r,theme:i}=t;r.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:J(t,`distance`),strictMinMax:!0,strictMinMaxSelection:!0}),r.axisHeader.set(`forceHidden`,!0);let a=r.get(`renderer`);a.setAll({inside:!1,minGridDistance:i.xAxisMinGridDistance}),a.labels.template.setAll({centerX:e.p0,centerY:e.p0,fill:e.color(i.axisLabelsColor),fontFamily:i.fontFamily,fontSize:i.axisLabelsFontSize,fontWeight:i.axisLabelsFontWeight,maxPosition:i.xAxisMaxLabelPosition,minPosition:i.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:i.xAxisLabelsSpacing});let o=r.set(`tooltip`,e.Tooltip.new(n.root,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));o.get(`background`)?.setAll({fill:e.color(i.axisTooltipBackgroundColor),stroke:void 0}),o.label.setAll({fill:e.color(i.axisTooltipLabelColor),fontFamily:i.fontFamily,fontSize:i.axisTooltipFontSize,paddingBottom:i.axisTooltipPaddingBottom,paddingLeft:i.axisTooltipPaddingHorizontal,paddingRight:i.axisTooltipPaddingHorizontal,paddingTop:i.axisTooltipPaddingTop,direction:t.rtl?`rtl`:`ltr`}),a.grid.template.setAll({strokeOpacity:1,stroke:e.color(i.axisGridStroke)})}function ie(t){let{yAxis:n,theme:r,rtl:i}=t;n.setAll({baseValue:y().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:J(t,`elevation`),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),n.axisHeader.set(`visible`,!1);let a=n.get(`renderer`);a.setAll({minGridDistance:r.yAxisMinGridDistance,opposite:i,inside:!0}),a.labels.template.setAll({centerX:e.p0,centerY:e.p100,fill:e.color(r.axisLabelsColor),fontFamily:r.fontFamily,fontSize:r.axisLabelsFontSize,fontWeight:r.axisLabelsFontWeight,maxPosition:r.yAxisMaxLabelPosition,minPosition:r.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:i?0:r.yAxisLabelSpacing,paddingRight:i?r.yAxisLabelSpacing:0,paddingTop:0,textAlign:`start`}),a.grid.template.setAll({strokeOpacity:1,stroke:e.color(r.axisGridStroke)})}function ae(e,t){if(j(e))return;let n=e.data??void 0,r=t.data??void 0,i=n!==r,a=n?.effectiveUnits!==r?.effectiveUnits,o=n?.uniformScaling!==r?.uniformScaling;e.data=r,e.messages=t.messages,(i||a)&&(oe(e),R(e)),o&&P(e),K(e)}function P(e){j(e)||(e.xAxis.zoom(0,1),e.yAxis.zoom(0,1))}function oe(e){let{chart:t,data:n,xAxis:r,yAxis:i}=e,{minX:a,maxX:o,minY:s,maxY:c}=F({data:n,pixelWidth:r.width(),pixelHeight:i.height()}),l=!!n?.uniformScaling,u=!!n?.refined;t.setAll({panX:!0,panY:l,pinchZoomX:u,pinchZoomY:u&&l,wheelX:`panX`,wheelY:u?l?`zoomXY`:`zoomX`:`none`}),r.setAll({max:o,min:a,panX:!0,panY:!1,zoomX:!0,zoomY:l}),i.setAll({max:c,min:s,panX:!1,panY:l,zoomX:l,zoomY:l})}function F({data:e,pixelWidth:t,pixelHeight:n}){if(e==null)return A;let r=e.statistics,i=r?.maxDistance,a=r?.minElevation,o=r?.maxElevation;if(i==null||a==null||o==null)return A;let s=Math.max(i-0,D),c=Math.max(o-a,D),l=e.effectiveUnits;if(e.dynamicElevationRange){let e=_(s,l.distance,l.elevation);c=Math.max(c,e/y().maxChartRatio)}return a-=.02*c,o=a+c+.1*c,[a,o]=S(a,o,10),c=o-a,e.uniformScaling?I({data:e,bounds:{minX:0,maxX:i,minY:a,maxY:o},pixelWidth:t,pixelHeight:n,centered:!0}):{minX:0,maxX:0+s,minY:a,maxY:a+c}}function I({data:e,bounds:t,pixelWidth:n,pixelHeight:r,centered:i}){if(e==null)return t;let{minX:a,maxX:o,minY:s,maxY:c}=t;if(a==null||o==null||s==null||c==null)return A;let l=o-a,u=c-s,d=e.effectiveUnits,f=_(u,d.elevation,d.distance),p=l/n,m=f/r/p;return m>=1?[a,o]=L([a,o],m):[s,c]=L([s,c],1/m),{minX:a,maxX:o,minY:s,maxY:c}}function L([e,t],n,r){let i=(t-e)*n;{let n=(e+t)/2-i/2;return[n,n+i]}}function R(e){let{chart:t,data:n,seriesInfos:r,xAxis:i,yAxis:a}=e;if(n==null||n.lines.length===0){t.series.clear();return}let o=new Map,s=new Set(t.series.values),c=n.lines.length;for(let i=0;i<c;i++){let a=n.lines[i],l=r.get(a.id);l?(l.fill&&s.delete(l.fill),s.delete(l.line)):(l=B(e,a),l.fill&&t.series.push(l.fill),t.series.push(l.line)),o.set(l.id,l);let u=c-i-1;l.fill?.set(`layer`,u),l.line.set(`layer`,c+u),z(e,l,a)}e.seriesInfos=o;for(let e of s)t.series.removeValue(e);i.set(`layer`,c+1),a.set(`layer`,c+2)}function z({theme:t},n,r){let i=e.color(r.color.toCss()),a=r.samples??[],o=a.length>0,{line:s,fill:c}=n;s.set(`visible`,o),s.set(`stroke`,i),c?.set(`visible`,o),c?.set(`fill`,e.Color.lighten(i,t.seriesFillLighten)),s.data.setAll(a),c?.data.setAll(a)}function B(e,t){let{id:n}=t,r=V(e,`line-${n}`);r.setAll({dy:t.chartStrokeOffsetY,tooltip:void 0}),r.strokes.template.setAll({strokeWidth:t.chartStrokeWidth});let i=null;return t.chartFillEnabled&&(i=V(e,`fill-${n}`),i.fills.template.setAll({fillOpacity:1,visible:!0})),{id:n,line:r,fill:i}}function V(e,t){return o.new(e.chart.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:t,stroke:void 0,valueXField:`distance`,valueYField:`elevation`,xAxis:e.xAxis,yAxis:e.yAxis})}function H({theme:t,chart:n,rtl:r}){let i=e.Tooltip.new(n.root,{autoTextColor:!1,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:`vertical`,visible:!1}),a=t.seriesTooltipPaddingHorizontal,o=t.seriesTooltipPaddingVertical;return i.label.setAll({fill:e.color(t.seriesTooltipLabelColor),fontFamily:t.fontFamily,fontSize:t.seriesTooltipFontSize,paddingBottom:o,paddingLeft:a,paddingRight:a,paddingTop:o,textAlign:r?`end`:`start`,direction:`ltr`}),i.get(`background`)?.setAll({stroke:void 0,fill:e.color(t.seriesTooltipBackgroundColor)}),i.adapters.add(`dy`,e=>{let n=t.seriesTooltipSpacing,r=i.get(`pointTo`)?.y??0;return(e??0)+(i.y()>r?n:-n)}),i}function U(e){let{xAxis:t,yAxis:n}=e,r=()=>{e.onRangeChange(W(t),W(n))},i=e=>[e.on(`start`,r),e.on(`end`,r)];return Q([...i(t),...i(n)])}function W(e){let t=Math.abs((e.get(`end`)??0)-(e.get(`start`)??0)),n=t===0?1:1/t;return Math.abs(1-n)<v()?1:n}function G(e){let{chart:t}=e,n=t.plotContainer.events,r=t=>{e.pointerIsOver=t,K(e)},i=()=>{r(!1),e.onCursorPositionChange(null,null)};return Q([n.on(`pointerover`,()=>r(!0)),n.on(`pointerout`,i),n.on(`blur`,i)])}function K(e){let{chart:t,data:n,xAxis:r,yAxis:i}=e,o=t.get(`cursor`);if(!n?.refined){o?.events.removeType(`cursormoved`),o?.dispose(),t.set(`cursor`,void 0);return}if(!o){let n=a.new(t.root,{behavior:`none`,xAxis:r,yAxis:i,snapToSeriesBy:`y`});n.lineY.set(`visible`,!1),n.events.on(`cursormoved`,se(e)),t.set(`cursor`,n)}let s=ce(e);s?e.seriesInfos.forEach(t=>{let n=t.line.get(`tooltip`)??H(e);n.label.set(`text`,s),t.line.set(`tooltip`,n)}):e.seriesInfos.forEach(e=>{e.line.get(`tooltip`)?.dispose(),e.line.set(`tooltip`,void 0)}),e.xAxis.getTooltip().setAll({tooltipText:de(e)})}function se(e){return()=>{if(!e.pointerIsOver)return;K(e);let{chart:t,xAxis:n,yAxis:r}=e,i=t.get(`cursor`),a=i?.getPrivate(`positionX`)??0,o=i?.getPrivate(`positionY`)??0,s=e.data;if(s?.statistics!=null){let{maxDistance:e,minElevation:t,maxElevation:i}=s.statistics,c,l;e!=null&&(W(n)===1?(c=0,l=e):(c=X(n),l=Z(n)),a=q(a,c,l,0,e)),t!=null&&i!=null&&(W(r)===1?(c=t,l=i):(c=X(r),l=Z(r)),o=q(o,c,l,t,i))}e.onCursorPositionChange(a,o)}}function q(e,t,n,r,i){return(t+e*(n-t)-r)/(i-r)}function ce(e){let{data:t}=e,n=t?.lines.map(t=>({line:t,y:Y(e,t)?.elevation})).sort(le);return!n||n.length===0||n[0].y==null?null:n.map(({y:t,line:n})=>ue(e,n,t)).join(`
|
|
3
3
|
`)}function le({y:e},{y:t}){return e==null?1:t==null?-1:t-e}function ue(e,t,n){let{data:r,messages:i}=e;if(r==null||i==null)return``;let a=`[${t.color.toHex()}]●[/]`,o=y().formatPrecision,s=u(i.chartTooltip,{name:x(t,i),elevation:n==null?b:g(i,n,r.effectiveUnits.elevation,o)});return e.rtl?s+` `+a:a+` `+s}function de(e){let{data:t,messages:n}=e;if(t==null||n==null)return``;let r=t.lines[0],i=r?Y(e,r):null,a=y().formatPrecision;return i==null?`-`:g(n,i.distance,t.effectiveUnits.distance,a)}function J(t,n){let r=e.NumberFormatter.new(t.chart.root,{});return r.format=(e,r,i)=>{let{data:a,messages:o}=t;return o==null||a==null||typeof e==`string`?``:`${l(e,{maximumFractionDigits:i})} ${h(o,a.effectiveUnits[n],`abbr`)}`},r}function Y({chart:e,xAxis:t},n){let r=n.samples??[];if(r.length===0)return null;let i=e.get(`cursor`)?.getPrivate(`positionX`)??0,a=t.toAxisPosition(i),o=t.positionToValue(a);return te(r,o,e=>e.distance)}function X(e){return e.positionToValue(e.get(`start`)??0)}function Z(e){return e.positionToValue(e.get(`end`)??1)}function Q(e){return d(e.map($))}function $(e){return f(()=>{e?.dispose()})}export{re as createChart,F as getAdjustedBounds};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type Accessor from "../../core/Accessor.js";
|
|
2
2
|
import type { MapViewOrSceneView } from "../../views/MapViewOrSceneView.js";
|
|
3
3
|
|
|
4
|
+
/** @deprecated since 5.2. Use the [Expand component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-expand/) instead. */
|
|
4
5
|
export interface ExpandViewModelProperties extends Partial<Pick<ExpandViewModel, "autoCollapse" | "expanded" | "group" | "view">> {}
|
|
5
6
|
|
|
7
|
+
/** @deprecated since 5.2. Use the Expand component's [`state`](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-expand/#state) property instead. */
|
|
6
8
|
export type ExpandViewModelState = "ready" | "disabled";
|
|
7
9
|
|
|
8
10
|
/**
|